Skip to content

feat(multiselect): sync styles and API with Figma - #195

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

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

Conversation

@khaliulin

@khaliulin khaliulin commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

MultiSelect is synced with Figma UI Kit (DS) v2.1: component tokens are aligned with the reference export and wired into the preset for the first time (previously only the Aura theme defaults were applied), a kit CSS layer on dt() is added, the API gains captionSeverity, and stories follow the one-story-per-Figma-preset rule.

Changes

  1. tokens.json: 26 multiselect token replacements from the reference (field geometry, sm/lg sizes, states, options, groups, overlay, icons); extend.paddingX/paddingY removed as duplicates of the root branch.
  2. map-tokens.ts: spread tokens.components.multiselect together with multiselectCss — component tokens reach the preset for the first time.
  3. New tokens/components/multiselect.ts: label/caption wrapper layout, field (min-width 272, max-width 100%), focus/invalid ring, readonly, DS xlarge mode, FloatLabel, uppercase groups.
  4. multiselect.component.ts: captionSeverity via ExtraCaptionComponent, required as NG_VALIDATORS, placeholder suppressed in float mode, showHeader/showToggleAll per the Overlay reference.
  5. Stories: Default, Error, Disabled, Readonly, Chips, Fluid, FloatLabel; original example component files preserved; a host component pins the preview width to 272px.
  6. docs/components-api/multiselect.md: captionSeverity added to the API table.
  • Restore all 5 original example component files. Apply only the typing/API compatibility changes needed to compile them against the current component. Keep existing descriptions verbatim and keep the current single-instance story list.

  • Keep Show code limited to the displayed instance and update it when Controls change. Restore existing story and Control descriptions verbatim from main.

API changes

  • captionSeverity: ExtraCaptionSeverity ('base' | 'success' | 'warning' | 'danger' | 'info'), default 'base'. The caption text is rendered by ExtraCaptionComponent with a severity icon.
  • required: boolean, default false — now an NG_VALIDATORS validator (an empty field makes the FormControl invalid; previously the input was decorative). Backward compatible.
  • size="xlarge": rendered per the DS xlarge mode (font 20 / line-height 26 / icon 20 / height 56) — PrimeNG has no xlg, the p-multiselect-xlg class is layered on top of large.

Technical notes for reviewers

  • extend.paddingX/paddingY removed: in the Figma reference they are the same variable (a single targetVariableId), and PrimeUIX collapses both paths into one CSS variable --p-multiselect-padding-x/y (gate G7). diff.mjs shows 2 missing entries — expected.
  • option.selectedFocusBackground = bg.neutral.weak.default — a deliberate deviation from the reference (medium.active) accepted during review; the iteration history lives in comp-json/FORM/MultiSelect/CHANGES.md.
  • Story field width is pinned by the host component MultiSelectStoryHostComponent (encapsulation: None — a scoped story style cannot reach PrimeNG markup); the component itself follows the Figma canon: min-width 272, grows with the container, fluid stretches it, but never wider than the parent (max-width: 100% on the body wrapper children).
  • Panel header: showHeader = showFilter, showToggleAll = false — the Overlay reference only has the filter, without a select-all checkbox.
  • FloatLabel: PrimeNG behavior as in InputText (label rests in the center, rises on focus); the reference draws it statically raised — a question for design.

Visual changes

  • Field radius 14 → 10px; paddings 14 → 12px; sm: font 14, lg: font 18, xlg: font 20 (heights 36/42/50/56).
  • Selected option: transparent background instead of a dark fill, text fg.default instead of white; focused — weak.default #f0f0f1.
  • Groups: transparent, weight 400 (was 600 with a white plate), uppercase.
  • Chevron/clear icons: muted #85888e (was #181a1f); overlay border #cecfd2; invalid border #db3424.
  • In stories the field has the fixed 272px width as in the mockup.

Verification

  • Gates: check-component multiselect ✓ (G1–G8), check-stories-bg/single/controls ✓; check-figma-values light/dark ✓ for the field, 1 documented deviation for the Option (selectedFocusBackground); check-dt-refs — clean for multiselect.

  • Storybook: 7 stories checked in light and dark, the API-TESTS.md matrix — all rows pass (comp-json/FORM/MultiSelect/API-TESTS.md), no console errors; test-storybook 297/297.

  • Not verified: npm run lint — @angular-eslint/builder is not installed in this branch; style snapshots (UPDATE_STYLE_BASELINES) — the infrastructure lives in origin/storybook-style-snapshots and is not merged.

  • PASS (example restoration): targeted strict Angular template compilation of all 5 restored examples; check-stories-bg; check-stories-source for the full current story list and changed Controls; check-stories-descriptions against origin/main; check-stories-single and check-stories-controls.

  • The restored standalone files remain available as source examples; restoring them does not add combinatorial stories to the current Storybook index.

Known issues and open questions

  • selectedFocusBackground = weak.default — deviation from the reference, accepted during review; design confirmation is desirable.
  • FloatLabel: the reference draws the label statically raised (TT Fellows 12/14), the InputText behavior is implemented — confirm the DS canon with design.
  • The reference draws the base field with paddingY 10 while the reference token link is 12 — a question to design about the actual rendering.

Stack

Base: feature/form-caption-figma-sync (#193). Stack: tokens-base (#192) ← caption (#193) ← multiselect (this PR).

Danil Khaliulin added 3 commits November 13, 2026 22:55
1. Токены multiselect приведены к эталону Figma: 26 замен (геометрия поля 272/10/12/12, размеры sm/lg, состояния, опции, группы, оверлей, иконки), extend.paddingX/paddingY удалены как дубли root-ветки (коллизия G7).
2. Токены multiselect впервые включены в пресет: map-tokens.ts спредит tokens.components.multiselect вместе с multiselectCss, раньше применялась только тема Aura с дефолтами.
3. Добавлен CSS слоя кита (multiselect.ts на dt()): раскладка обёртки label/caption, лейбл, поле с min-width 272 и ограничением max-width 100% против раздувания контентом, focus/invalid ring, readonly, xlarge-мода, FloatLabel по поведению InputText, группы uppercase, шапка панели только с фильтром.
4. API: добавлен captionSeverity (подпись через ExtraCaptionComponent с severity), required работает как NG_VALIDATORS, в floatLabel не передаётся placeholder, showHeader/showToggleAll по референсу Overlay.
5. Stories переделаны по шагу 4a: Default, Error, Disabled, Readonly, Chips, Fluid, FloatLabel — одна сторис один экземпляр; комбинаторные examples/ удалены; хост-компонент фиксирует ширину превью 272px по референсу.
6. Документация API (docs/components-api/multiselect.md) дополнена captionSeverity.

Заметки для ревьюеров:
- API: новый @input captionSeverity: 'base'|'success'|'warning'|'danger'|'info' = 'base' (не ломает); required стал NG_VALIDATORS-валидатором (пустое поле = invalid, раньше был декоративным); остальные входы без изменений.
- Токены: extend.paddingX/paddingY удалены осознанно — в эталоне Figma это та же переменная (один targetVariableId), PrimeUIX схлопывал оба пути в одну CSS-переменную; diff.mjs покажет 2 missing, это ожидаемо.
- Токены: option.selectedFocusBackground = bg.neutral.weak.default — намеренное отклонение от эталона (medium.active) по приёмке, история итераций в comp-json/FORM/MultiSelect/CHANGES.md.
- Технические детали: showHeader/showToggleAll отключают чекбокс «выбрать всё» (в референсе Overlay его нет); ширина поля в stories фиксирована хост-компонентом с encapsulation: None (scoped-стиль сториса не видит PrimeNG-разметку); поле не выходит за фиксированный родитель благодаря max-width: 100% на детях extra-multiselect-body.
- Поведение FloatLabel приведено к InputText: в покое лейбл в центре вместо placeholder, при фокусе поднимается (референс Figma рисует статично поднятым — вопрос дизайну зафиксирован).
1. Восстановить 5 исходных example-файлов компонента вместо лишнего удаления.
2. Согласовать примеры с актуальными типами и API, сохранив исходные описания.
3. Проверить snippets текущих stories, изменённые Controls и строгую Angular-компиляцию восстановленных примеров.

Заметки для ревьюеров:
- Область: только примеры и stories multiselect; производственные компоненты и токены в этом коммите не меняются.
- Stories: сохранён текущий список отдельных примеров; исходные example-файлы доступны рядом с ним.
- Проверки: Angular-компиляция восстановленных примеров и обязательные gates snippets и описаний проходят.
1. parameters.controls.expanded = true — панель Controls показывает описание, тип, дефолт и группы категорий.
2. Гейты: controls 33/33, descriptions 31/31, source 7/7.
@khaliulin
khaliulin force-pushed the feature/form-multiselect-figma-sync branch from 33e6739 to 3236651 Compare November 18, 2026 12:43
Включает глобальный controls.expanded в .storybook/preview.ts (иначе на ветке панель Controls остаётся компактной до мержа инфраструктурной ветки).
@khaliulin
khaliulin force-pushed the feature/form-multiselect-figma-sync branch from 3236651 to 1f671a2 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