Skip to content

feat(autocomplete): sync styles and API with Figma - #196

Open
khaliulin wants to merge 4 commits into
feature/form-caption-figma-syncfrom
feature/form-autocomplete-figma-sync
Open

khaliulin wants to merge 4 commits into
feature/form-caption-figma-syncfrom
feature/form-autocomplete-figma-sync

Conversation

@khaliulin

Copy link
Copy Markdown
Contributor

Summary

Align AutoComplete styles and behavior with the Figma component and keep each Storybook code snippet consistent with the displayed example.

Changes

  1. Apply token-based field sizes, labels, required markers, dropdown sizing, chip alignment, focus states and grouped suggestions.
  2. Use the shared caption component and fix readonly controls, PrimeNG item/remove templates and form updates.
  3. Provide seven stories with working Controls and a shared dynamic HTML snippet that reflects the current example instead of listing other variants.
  4. Document the caption API and updated readonly and floating-label behavior. Preserve existing component, story and Control descriptions verbatim from main; the multiple example keeps the checkbox behavior described there.

API changes

  • Add captionSeverity: 'base' | 'success' | 'warning' | 'danger' | 'info', default 'base'.
  • readonly disables the dropdown button and hides field clearing; the custom chip remove action respects readonly and disabled states.
  • floatLabel suppresses the placeholder to avoid overlapping text.
  • Existing input and output names remain available; no public API removals.

Technical notes for reviewers

  • Only the components.autocomplete subtree changes in tokens.json; shared token definitions and other component implementations are untouched.
  • Root size variables cover both single and multiple inputs. Chip dimensions reuse the existing chip tokens, producing four intentional cross-component warnings in check-component.
  • Group headers use fonts.fontSize.100 and dimension.space.100 / dimension.space.300: 12 px text and 4 px 10 px padding.
  • PrimeNG templates use #item and #removeicon; checkbox models are standalone. Primitive values are no longer compared through an object data key.
  • CVA writes and disabled-state changes call markForCheck.
  • Story HTML is derived from current args; form setup stays outside the snippet. The local mandatory source gate also runs during preflight. Local rules, gates, baselines and design exports are excluded from this component PR.

Visual changes

  • Align labels, required indicators, caption severity, field sizing, rounded borders and focus/invalid treatment.
  • Keep the dropdown button compact and align chips with the input across sizes.
  • Render uppercase group headers with 12 px text and 4 px 10 px padding in both themes.

Verification

  • check-component autocomplete: 0 FAIL, four intentional chip-token warnings.
  • check-stories-bg autocomplete: PASS.
  • check-stories-controls autocomplete: PASS, all 39 inputs have Controls.
  • check-stories-single autocomplete --port 6007: PASS, seven stories match the local story inventory, one component per story, no console errors.
  • check-stories-source autocomplete --port 6007: PASS for all seven stories, both with initial args and changed Controls (size, label position, readonly, caption severity, dropdown and multiple).
  • check-stories-descriptions autocomplete: PASS, 32 existing descriptions match current main verbatim, including descriptions from example files; new stories do not invent replacement prose.
  • check-push: PASS for the complete PR range, including both mandatory story acceptance gates; only five AutoComplete files are included.
  • Source gate regression tests: 8 PASS, including extra variants, stale/missing inputs and TypeScript setup in HTML.
  • Docs/Default: the actual expanded code block contains one AutoComplete and no form setup.
  • Grouped story: computed font size and padding are 12 px / 4 px 10 px in light and dark themes.
  • tsc --noEmit -p tsconfig.app.json, targeted Prettier and git diff --check: PASS.
  • check-dt-refs: no AutoComplete dead references; the global check reports existing out-of-scope confirm-dialog references and token-name collisions.
  • Not verified: full manual visual acceptance of every combination in both themes and cross-browser coverage.

Known issues and open questions

  • The global token-reference check has existing failures outside AutoComplete. This PR keeps those components unchanged.
  • chipClearable=false hides the remove icon; keyboard removal remains available, as documented.

Stack

Base: feature/form-caption-figma-sync (#193), which depends on the shared token branch (#192). This PR contains only AutoComplete changes.

Danil Khaliulin added 3 commits November 16, 2026 23:44
1. Привести размеры, состояния, dropdown, chips и группировку autocomplete к токенам макета.
2. Добавить captionSeverity через общий компонент подписи, обязательный маркер и корректную обработку readonly.
3. Обновить шаблоны PrimeNG для checkbox и удаления chips, сравнение значений и обновление ControlValueAccessor.
4. Перевести семь stories на общие Controls и показывать в snippet только текущий UI с актуальными параметрами.

Заметки для ревьюеров:
- API: добавлен captionSeverity с вариантами base, success, warning, danger, info; значение по умолчанию base. В режиме floatLabel placeholder скрыт, при readonly dropdown отключён и очистка скрыта.
- Токены: изменён только раздел components.autocomplete; заголовок группы имеет размер текста 12 px и отступы 4 px 10 px через существующие токены.
- Общие caption и chip используются как зависимости; их реализация не изменяется. Базовая ветка содержит общий компонент подписи.
- Stories сохраняют один экземпляр компонента на пример; disabled и invalid управляются через FormControl, HTML-snippet обновляется при изменении Controls.
1. Восстановить исходные формулировки описаний компонента, stories и существующих Controls из main без переформулировок.
2. Сохранить чекбоксы в примере множественного выбора согласно исходному описанию и убрать новые тексты без аналога в main.

Заметки для ревьюеров:
- Изменён только файл stories компонента autocomplete; API компонента и токены не меняются.
- Описание Error дословно взято из исходного примера Invalid; остальные исходные описания также сохранены.
- Проверка описаний сверяет 32 формулировки с main; HTML-snippets по-прежнему отображают только текущий UI.
1. parameters.controls.expanded = true — панель Controls показывает описание, тип, дефолт и группы категорий.
2. Гейты: controls 39/39, descriptions 32/32, source 7/7.
@khaliulin
khaliulin force-pushed the feature/form-autocomplete-figma-sync branch from bb00228 to a2f317c Compare November 18, 2026 12:43
Включает глобальный controls.expanded в .storybook/preview.ts (иначе на ветке панель Controls остаётся компактной до мержа инфраструктурной ветки).
@khaliulin
khaliulin force-pushed the feature/form-autocomplete-figma-sync branch from a2f317c to 3098c86 Compare November 18, 2026 12:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant