From ef69c3793a4d222eaaabce7c847fd44855eb5c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robson=20J=C3=BAnior?= Date: Mon, 29 Jun 2026 14:32:07 -0300 Subject: [PATCH 1/3] feat(webkit): add accordion component Composition accordion (content/accordion): single/multiple open modes, medium/large sizes, left/right chevron placement, v-model:value, and full keyboard + ARIA support. Adds the compound API (Accordion.Item/Trigger/Content), four flat package exports, and the Storybook story. ENG-46311 --- .specs/accordion.md | 209 ++++++++++++ .../content/accordion/Accordion.stories.js | 319 ++++++++++++++++++ packages/webkit/package.json | 5 + .../accordion-content/accordion-content.vue | 47 +++ .../accordion-item/accordion-item.vue | 77 +++++ .../accordion-trigger/accordion-trigger.vue | 109 ++++++ .../content/accordion/accordion.vue | 164 +++++++++ .../src/components/content/accordion/index.ts | 18 + .../content/accordion/injection-key.ts | 65 ++++ 9 files changed, 1013 insertions(+) create mode 100644 .specs/accordion.md create mode 100644 apps/storybook/src/stories/components/content/accordion/Accordion.stories.js create mode 100644 packages/webkit/src/components/content/accordion/accordion-content/accordion-content.vue create mode 100644 packages/webkit/src/components/content/accordion/accordion-item/accordion-item.vue create mode 100644 packages/webkit/src/components/content/accordion/accordion-trigger/accordion-trigger.vue create mode 100644 packages/webkit/src/components/content/accordion/accordion.vue create mode 100644 packages/webkit/src/components/content/accordion/index.ts create mode 100644 packages/webkit/src/components/content/accordion/injection-key.ts diff --git a/.specs/accordion.md b/.specs/accordion.md new file mode 100644 index 000000000..bcb2431c0 --- /dev/null +++ b/.specs/accordion.md @@ -0,0 +1,209 @@ +--- +name: accordion +category: content +structure: composition +status: implemented +spec_version: 1 +figma: + url: https://www.figma.com/design/t97pXRs7xME3SJDs5iZ5RF/Webkit?node-id=480-876 + node_id: "480:876" +checksum: 9622e5553d34740b37547c94095a517c81bec07e36ed29a7e03766753336a2f4 +created: 2026-06-26 +last_updated: 2026-06-26 +--- + +# Accordion — Component Spec + +## Purpose + +A vertically stacked set of disclosure items: each item has a clickable header that expands or collapses its content panel. Use it to condense long content into scannable sections. Unlike `tab-view` (mutually-exclusive panels shown in place), an accordion can keep one item open at a time (`type="single"`) or several at once (`type="multiple"`), and its content expands inline below each header. + +## Usage + +```vue + + + +``` + +Tree-shaking alternative — the same sub-components as standalone imports: + +```vue + +``` + +## Sub-components + +The root ships a **compound API**: an `index.ts` (beside `accordion.vue`) attaches every sub-component to the root so `` / `` / `` resolve from one import; the standalone imports above remain the tree-shaking path. The root is a disclosure component with `data-state="open|closed"`, so `Trigger` / `Content` are the correct anatomy names. Shared open-state flows through `provide`/`inject` (`injection-key.ts`), so the consumer wires nothing. + +- `accordion-item/accordion-item.vue` — One disclosure row. Registers itself with the root by `value`, derives its own open/closed state from the injected context, and groups a `Trigger` + a `Content`. + - Props: `value: string` (**required** — unique identifier used by the open-state model), `disabled?: boolean` (default `false` — prevents this item from toggling; from the Figma component description). + - Slot: `default` — the item's `Accordion.Trigger` and `Accordion.Content`. +- `accordion-trigger/accordion-trigger.vue` — The clickable header row (Figma "Header"): renders the title plus the `pi pi-chevron-down` glyph, toggles the item through the injected context, and exposes `aria-expanded` / `aria-controls`. To satisfy the ARIA accordion pattern, the `