@thewhatmatters/wmds 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/CONSUMING.md +3 -2
- package/bin/wmds-check.mjs +108 -10
- package/dist/components/molecules/Breadcrumb/Breadcrumb.d.ts +59 -0
- package/dist/components/molecules/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/molecules/Breadcrumb/Breadcrumb.js +188 -0
- package/dist/components/molecules/Breadcrumb/breadcrumbStyles.d.ts +21 -0
- package/dist/components/molecules/Breadcrumb/breadcrumbStyles.d.ts.map +1 -0
- package/dist/components/molecules/Breadcrumb/breadcrumbStyles.js +11 -0
- package/dist/components/molecules/Dropdown/DropdownItem.d.ts +7 -2
- package/dist/components/molecules/Dropdown/DropdownItem.d.ts.map +1 -1
- package/dist/components/molecules/Dropdown/DropdownItem.js +40 -24
- package/dist/components/organisms/ChatDock/ChatDock.d.ts +9 -18
- package/dist/components/organisms/ChatDock/ChatDock.d.ts.map +1 -1
- package/dist/components/organisms/ChatDock/ChatDock.js +411 -411
- package/dist/components/organisms/ChatDock/ChatDockGate.d.ts +19 -9
- package/dist/components/organisms/ChatDock/ChatDockGate.d.ts.map +1 -1
- package/dist/components/organisms/ChatDock/ChatDockGate.js +152 -123
- package/dist/components/organisms/ChatDock/chatDockGateContext.d.ts +11 -0
- package/dist/components/organisms/ChatDock/chatDockGateContext.d.ts.map +1 -0
- package/dist/components/organisms/ChatDock/chatDockGateContext.js +9 -0
- package/dist/components/organisms/ChatDock/chatDockGateStyles.d.ts +15 -10
- package/dist/components/organisms/ChatDock/chatDockGateStyles.d.ts.map +1 -1
- package/dist/components/organisms/ChatDock/chatDockGateStyles.js +3 -3
- package/dist/components/organisms/ChatDock/chatDockStyles.d.ts +10 -4
- package/dist/components/organisms/ChatDock/chatDockStyles.d.ts.map +1 -1
- package/dist/components/organisms/ChatDock/chatDockStyles.js +9 -6
- package/dist/components/organisms/ChatDock/chatDockViewport.d.ts +6 -0
- package/dist/components/organisms/ChatDock/chatDockViewport.d.ts.map +1 -1
- package/dist/components/organisms/ChatDock/chatDockViewport.js +14 -1
- package/dist/components/organisms/Dialog/Dialog.js +34 -34
- package/dist/components/organisms/Sheet/Sheet.js +38 -38
- package/dist/components/organisms/SiteNav/SiteNav.js +86 -86
- package/dist/components/organisms/Toast/Toast.d.ts.map +1 -1
- package/dist/components/organisms/Toast/Toast.js +11 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +90 -88
- package/dist/lib/compositionAudit.d.ts.map +1 -1
- package/dist/lib/dialogOverlay.d.ts +5 -0
- package/dist/lib/dialogOverlay.d.ts.map +1 -1
- package/dist/lib/dialogOverlay.js +29 -15
- package/dist/styles.css +1 -1
- package/docs/component-contracts.md +4 -2
- package/docs/components.md +7 -6
- package/docs/exports.json +17 -1
- package/docs/patterns/components-accordion--flush.tsx +1 -1
- package/docs/patterns/components-avatar--dropdown-row.tsx +1 -1
- package/docs/patterns/components-badge--outline-tags.tsx +1 -1
- package/docs/patterns/components-badge--with-avatar.tsx +1 -1
- package/docs/patterns/components-breadcrumb--editorial.tsx +9 -0
- package/docs/patterns/components-breadcrumb--long-path.tsx +9 -0
- package/docs/patterns/components-breadcrumb--path.tsx +9 -0
- package/docs/patterns/components-breadcrumb--router-links.tsx +10 -0
- package/docs/patterns/components-button-button--copy-button.tsx +1 -1
- package/docs/patterns/components-button-button--destructive-action.tsx +1 -1
- package/docs/patterns/components-button-button--external-link.tsx +1 -1
- package/docs/patterns/components-button-button--ghost-action.tsx +1 -1
- package/docs/patterns/components-button-button--inverse-action.tsx +1 -1
- package/docs/patterns/components-button-button--link-render.tsx +1 -1
- package/docs/patterns/components-button-button--multi-state-badge.tsx +1 -1
- package/docs/patterns/components-button-button--outline-mono.tsx +1 -1
- package/docs/patterns/components-button-button--primary-action.tsx +1 -1
- package/docs/patterns/components-button-button--row-hug.tsx +1 -1
- package/docs/patterns/components-button-button--row-layout.tsx +1 -1
- package/docs/patterns/components-button-button--secondary-action.tsx +1 -1
- package/docs/patterns/components-button-button--suggestion-pills.tsx +1 -1
- package/docs/patterns/components-button-button--with-count.tsx +1 -1
- package/docs/patterns/components-button-button--with-icon.tsx +1 -1
- package/docs/patterns/components-button-floatingactionbutton--vertical-actions.tsx +1 -1
- package/docs/patterns/components-calembed--pattern-skip-in-footer.tsx +1 -1
- package/docs/patterns/components-card-card--body-slot-occupancy-history.tsx +1 -1
- package/docs/patterns/components-card-card--headerless-media.tsx +1 -1
- package/docs/patterns/components-card-card--outlined-layout.tsx +1 -1
- package/docs/patterns/components-card-card--pinned-height.tsx +1 -1
- package/docs/patterns/components-card-selectablecard--selectable-cards-pattern.tsx +1 -1
- package/docs/patterns/components-chart--audience-activity-heatmap.tsx +1 -1
- package/docs/patterns/components-chart--cartesian-no-data-gaps.tsx +1 -1
- package/docs/patterns/components-chart--occupancy-history-in-card.tsx +1 -1
- package/docs/patterns/components-chart--occupancy-in-card.tsx +1 -1
- package/docs/patterns/components-chart--post-reach-distribution.tsx +1 -1
- package/docs/patterns/components-chart--ranked-audience-breakdown.tsx +1 -1
- package/docs/patterns/components-chart--unit-grid-composition.tsx +1 -1
- package/docs/patterns/components-chatdock--pattern-chat-dock.tsx +1 -1
- package/docs/patterns/components-chatdock--pattern-start-project-gate.tsx +54 -11
- package/docs/patterns/components-chatqa--pattern-qa-with-reply.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--default.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--with-count.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--with-description.tsx +1 -1
- package/docs/patterns/components-checkbox-checkboxgroup--default.tsx +1 -1
- package/docs/patterns/components-checkbox-checkboxgroup--option-counts.tsx +1 -1
- package/docs/patterns/components-descriptionlist--details.tsx +1 -1
- package/docs/patterns/components-descriptionlist--post-metadata.tsx +1 -1
- package/docs/patterns/components-dialog--alert-dialog-destructive.tsx +1 -1
- package/docs/patterns/components-dialog--default-dialog.tsx +1 -1
- package/docs/patterns/components-dialog--form-dialog.tsx +1 -1
- package/docs/patterns/components-displaycontrols--page-utilities.tsx +1 -1
- package/docs/patterns/components-field--horizontal-input.tsx +1 -1
- package/docs/patterns/components-field--horizontal-text-area.tsx +1 -1
- package/docs/patterns/components-field--multi-control.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-ruled-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-with-gallery-intro.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-page-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--ruled-grid-footer-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--sequenced-marketing-hero.tsx +1 -1
- package/docs/patterns/components-herointro--two-line-intro.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-pattern.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-text-sequence.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-with-gallery-intro.tsx +1 -1
- package/docs/patterns/components-indexlist--post-index.tsx +1 -1
- package/docs/patterns/components-intakeconfirmation--booked-pattern.tsx +1 -1
- package/docs/patterns/components-intakeconfirmation--emailed-pattern.tsx +1 -1
- package/docs/patterns/components-intakeform--about-you-pattern.tsx +1 -1
- package/docs/patterns/components-intakemodal--intake-modal-pattern.tsx +1 -1
- package/docs/patterns/components-kbd--command-row.tsx +1 -1
- package/docs/patterns/components-kbd--numbered-choices.tsx +1 -1
- package/docs/patterns/components-kbd--shortcut.tsx +1 -1
- package/docs/patterns/components-moremenu--action-menu.tsx +1 -1
- package/docs/patterns/components-moremenu--in-card-header.tsx +1 -1
- package/docs/patterns/components-navlist--side-nav-settings.tsx +1 -1
- package/docs/patterns/components-pageheader--app-header-pattern.tsx +1 -1
- package/docs/patterns/components-pageheader--page-section-header.tsx +1 -1
- package/docs/patterns/components-pageheader--toolbar-header.tsx +1 -1
- package/docs/patterns/components-panel--end-detail-rail.tsx +1 -1
- package/docs/patterns/components-pillgroup--pill-group-pattern.tsx +1 -1
- package/docs/patterns/components-promptbar--pattern-prompt-bar.tsx +1 -1
- package/docs/patterns/components-prose--article-body.tsx +1 -1
- package/docs/patterns/components-radio-radiogroup--default.tsx +1 -1
- package/docs/patterns/components-scrollhorizontal--project-gallery-pattern.tsx +1 -1
- package/docs/patterns/components-scrollhorizontal--with-intro.tsx +1 -1
- package/docs/patterns/components-sectioncaption--column-caption.tsx +1 -1
- package/docs/patterns/components-sectioncaption--with-action.tsx +1 -1
- package/docs/patterns/components-sheet--bottom-sheet.tsx +1 -1
- package/docs/patterns/components-sheet--end-sheet.tsx +1 -1
- package/docs/patterns/components-sitenav--brand-and-cta.tsx +1 -1
- package/docs/patterns/components-sitenav--centered-links.tsx +1 -1
- package/docs/patterns/components-sitenav--compact.tsx +1 -1
- package/docs/patterns/components-sitenav--marketing-header.tsx +1 -1
- package/docs/patterns/components-sitenav--mega-menu.tsx +1 -1
- package/docs/patterns/components-stat--insights-row.tsx +1 -1
- package/docs/patterns/components-stepprogress--step-progress-pattern.tsx +1 -1
- package/docs/patterns/components-switch--default.tsx +1 -1
- package/docs/patterns/components-switch--settings-row.tsx +1 -1
- package/docs/patterns/components-tab--settings-pages.tsx +1 -1
- package/docs/patterns/components-taskrows--action-details.tsx +1 -1
- package/docs/patterns/components-taskrows--capsules.tsx +1 -1
- package/docs/patterns/components-taskrows--card-with-status-rows.tsx +1 -1
- package/docs/patterns/components-taskrows--controlled-expand.tsx +1 -1
- package/docs/patterns/components-taskrows--custom-slots.tsx +1 -1
- package/docs/patterns/components-taskrows--status-list.tsx +1 -1
- package/docs/patterns/components-taskrows--tag-chips.tsx +1 -1
- package/docs/patterns/components-textlink--external-destination.tsx +1 -1
- package/docs/patterns/components-textlink--inline-prose.tsx +1 -1
- package/docs/patterns/components-textlink--quiet-title.tsx +1 -1
- package/docs/patterns/components-textlink--supporting-copy.tsx +1 -1
- package/docs/patterns/components-textsequence--default.tsx +1 -1
- package/docs/patterns/components-textsequence--reduced-motion.tsx +1 -1
- package/docs/patterns/components-textsequence--shapes.tsx +1 -1
- package/docs/patterns/components-toast--stacked-notifications.tsx +1 -1
- package/docs/patterns/components-tooltip--controlled.tsx +1 -1
- package/docs/patterns/components-tooltip--disabled-control.tsx +1 -1
- package/docs/patterns/components-tooltip--icon-action.tsx +1 -1
- package/docs/patterns/components-tooltip--keyboard-shortcut.tsx +1 -1
- package/docs/patterns/components-tooltip--placement.tsx +1 -1
- package/docs/patterns/foundations-scroll-fade--horizontal-rail.tsx +1 -1
- package/docs/patterns/foundations-scroll-fade--overflowing-list.tsx +1 -1
- package/docs/patterns/guides-chart-explorations--comparison-gallery.tsx +1 -1
- package/docs/patterns/guides-filter-panel--filtered-index.tsx +41 -17
- package/docs/patterns/guides-overlay-flows--notification-preferences.tsx +1 -1
- package/docs/patterns/guides-post-page--post-page.tsx +39 -4
- package/docs/patterns/guides-profile-typography--editorial-profile.tsx +1 -1
- package/docs/patterns/index.json +33 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,44 @@ Every release of `@thewhatmatters/wmds` is listed here, newest first.
|
|
|
7
7
|
- **Pasted patterns:** when a release changes a **Pattern — …** story's Show code, it is named under Consumer actions so apps re-copy it.
|
|
8
8
|
- **How to add an entry** (contributors): add your change to the top entry. If that version is already on npm (`npm view @thewhatmatters/wmds versions`), start a new entry above it and bump `version` in `package.json` to match. `npm run check:changelog` enforces the format.
|
|
9
9
|
|
|
10
|
+
## 0.4.3
|
|
11
|
+
|
|
12
|
+
**ChatDock: the gate takes over the window.** Start a project no longer sits as a card inside the chat. While a `gate` is up the window is the form: one header, the step, and the footer on the window's bottom edge, and the window is modal. Also: two hydration fixes, a promise-based send for the gate pattern, options for the post page and filtered index patterns, and fewer false positives in `wmds-check`. See the amendments to **ADR-0039**, **ADR-0040**, and **ADR-0041**.
|
|
13
|
+
|
|
14
|
+
- **ChatDock `gate`** — fills the window. The window's header, the conversation, the composer, the suggestion rows, the follow-ups, and the disclaimer fade out and wait behind it; finishing or cancelling brings them back as they were. The cap that kept the latest reply in view is gone: the step body takes the window's height and scrolls, and the footer sits on the window's bottom edge (above the home indicator on phones). While the gate is up the fixed window is modal: a scrim covers the page and **SiteNav**, the page is inert and does not scroll, and Tab stays inside (`aria-modal="true"`). Inline previews are not modal.
|
|
15
|
+
- **One close.** The gate's header close (named "Close chat", from ChatDock's `labels.close`), Escape, and a click on the scrim fold the window and keep the gate with its progress; reopening the chat brings it back. The gate's Cancel leaves it. Before, Escape and the gate's close left the gate and the window had a second close.
|
|
16
|
+
- **ChatDock.Gate** — a flush shell in the window instead of a raised card; the step sits on the window surface, not an inset well. New `pending` (shows `labels.pending`, "Sending…", in a status line, disables the step controls, sets `aria-busy`) and `error` (a line over the footer, announced). The header's next control is off on the last step, so `onNext` there is the footer's primary action — "Send" or "Try again" through `continueLabel`. New label `pending`.
|
|
17
|
+
- **Components/ChatDock → Pattern — start a project gate** — `onSubmit` returns a promise. Booking or skipping shows "Sending…"; the confetti, the answers, and the confirmation wait for it to resolve. If it rejects, every answer stays, the gate says the send failed, and Try again sends it again. `close` is the gate's Cancel. New stories: **Start a project — send failed** at 1280 and 390.
|
|
18
|
+
- **Fix: Toaster hydration.** **Toaster** rendered its list in the browser and nothing on the server, so a layout that held it failed hydration on every page. It now renders nothing on the server and in the hydration render, and mounts its list right after.
|
|
19
|
+
- **Fix: ChatDock hydration under reduced motion.** The closed window's inline style differed between the server and a browser that prefers reduced motion. ChatDock now reads reduced motion as off on the server and in the hydration render, and switches right after, while the window is hidden.
|
|
20
|
+
- **Guides/Post page → Pattern — post page** — `metadataSide` (`"start"`, default, or `"end"`) and `metadataColumns` (`4`, default, or `3`; the article takes the rest) place the metadata panel from `lg`. Below `lg` it stacks above the article either way. New story **Metadata on the right**.
|
|
21
|
+
- **Guides/Filter panel → Pattern — filtered index** — a post's `facets` take one option or a list per group (`{ topic: ["guides", "brand"] }`); within a group the options on are alternatives, and each option counts every post that has it. New `defaultSelection` (the filters on when the page opens) and `selection` + `onSelectionChange` (the app holds them). New exported types `FilterSelection` and `FilteredIndexProps`. New story **Starting selection**.
|
|
22
|
+
- **`wmds-check`** — `pattern-drift` compares a pasted pattern's markup and classes with the shipped file (its elements in order, its `className` and `style` values, and its `*Classes` constants), so edits to content, data, handlers, and exported names no longer warn; the warning names the first difference. `raw-color` no longer reads a character reference such as `'` as a hex color.
|
|
23
|
+
|
|
24
|
+
### Consumer actions
|
|
25
|
+
|
|
26
|
+
1. **WhatMatters site: re-copy Components/ChatDock → Pattern — start a project gate** (`node_modules/@thewhatmatters/wmds/docs/patterns/components-chatdock--pattern-start-project-gate.tsx`) over `components/start-project-gate.tsx`, and re-apply only your services, budgets, step copy, and calendar. Then make `onSubmit` return the send's promise and reject when it fails — for example `onSubmit={async (intake) => { const response = await fetch("/api/intake", { method: "POST", body: JSON.stringify(intake) }); if (!response.ok) throw new Error("Intake failed"); }}`. TypeScript flags a handler that returns nothing. Remove the toast you show on a failed send; the gate shows the error and Try again.
|
|
27
|
+
2. **The gate taking over the window: nothing to re-copy.** It comes with the upgrade, and **Pattern — chat dock** is unchanged. While the gate is up the page behind is inert: a site test that clicks the page with the gate open must close the window first (the gate's close, Escape, or the scrim). A test that pressed Escape or the gate's close to leave the gate now finds the window folded with the gate kept; press **Cancel** to leave it.
|
|
28
|
+
3. **Mount `<Toaster />` directly in the layout** and remove the after-hydration workaround.
|
|
29
|
+
4. **WhatMatters site, post page: re-copy Guides/Post page → Pattern — post page** (`node_modules/@thewhatmatters/wmds/docs/patterns/guides-post-page--post-page.tsx`), re-apply only your content, data, and handlers, and pass `metadataSide="end"` and `metadataColumns={3}` where you render `PostPage` instead of editing the panel's classes.
|
|
30
|
+
5. **WhatMatters site, blog index: re-copy Guides/Filter panel → Pattern — filtered index** (`node_modules/@thewhatmatters/wmds/docs/patterns/guides-filter-panel--filtered-index.tsx`) and re-apply only your content and data. Map each post's topics to a list (`facets: { topic: post.topics }`). For the category tags that link to `/blog?topic=<id>`, read the parameter in the page and pass `defaultSelection={{ topic: [topic] }}` when it is set — or pass `selection` and `onSelectionChange` to keep the filters in the URL.
|
|
31
|
+
6. **`npx wmds-check --max-warnings 0`** now passes with content-only edits to pasted patterns. A remaining `pattern-drift` names the first markup or class that differs: re-copy that pattern, or use the pattern's props (steps 4 and 5) instead of editing its classes.
|
|
32
|
+
7. Other apps: steps 2 and 3 only, if they render a ChatDock `gate` or a **Toaster**. **ChatDock.Gate** `pending` and `error`, and the patterns' new props, are optional.
|
|
33
|
+
|
|
34
|
+
## 0.4.2
|
|
35
|
+
|
|
36
|
+
**Breadcrumb** — the path to the current page, after the shadcn/ui breadcrumb: links from the root, a separator between them, the current page last, and a long path folded into a "…" menu of links. See **ADR-0042**.
|
|
37
|
+
|
|
38
|
+
- **Breadcrumb** (new) — pass `items` (`{ label, href }`; the last item, without `href`, is the current page). Above `maxItems` (default 4) the first item and the last two stay and the middle folds into a "…" control; it opens a menu of the hidden links, with focus on the first, arrow keys between them, and Escape back to the control. Long labels truncate. `separator`: `chevron` (default) or `slash`. `variant`: `sans` (default) or `mono` (eyebrow caps). `renderLink` routes every link through your router (`(item) => <Link href={item.href} />`). New **Pattern — path**, **Pattern — long path**, **Pattern — router links**, and **Pattern — editorial**.
|
|
39
|
+
- **Dropdown.Item** `render` — compose a row onto another element, such as `render={<a href />}` for a menu of links.
|
|
40
|
+
- **Guides/Post page → Pattern — post page** — a mono, slash-separated **Breadcrumb** above the title. `PostPageData` gains `breadcrumb`.
|
|
41
|
+
|
|
42
|
+
### Consumer actions
|
|
43
|
+
|
|
44
|
+
1. **WhatMatters site, post page: re-copy Guides/Post page → Pattern — post page** (`node_modules/@thewhatmatters/wmds/docs/patterns/guides-post-page--post-page.tsx`) and re-apply only your content, data, and handlers. Pass `breadcrumb` in `PostPageData`, ending with the post — for example `[{ label: "Home", href: "/" }, { label: "Blog", href: "/blog" }, { label: post.title }]`, with the post's category between Blog and the title if you link categories. To route crumbs through Next, pass `renderLink={(item) => <Link href={item.href} />}` on the pattern's **Breadcrumb**.
|
|
45
|
+
2. **WhatMatters site, other deep pages** (a resource category, a case study): add `<Breadcrumb items={…} />` above the page title — `variant="mono" separator="slash"` on editorial pages, to match the post page.
|
|
46
|
+
3. Other apps: none. **Breadcrumb** and **Dropdown.Item** `render` are new and optional.
|
|
47
|
+
|
|
10
48
|
## 0.4.1
|
|
11
49
|
|
|
12
50
|
**ChatDock:** follow-ups in the open window, actions and a match score under each reply, a Start a project gate in the composer's place, the visitor's messages on a brand tint, and a new open and close transition.
|
package/CONSUMING.md
CHANGED
|
@@ -152,7 +152,7 @@ npx wmds-check app components --max-warnings 0
|
|
|
152
152
|
| `raw-color` | error | hex, `rgb()`, `hsl()`, `oklch()` values in `className` or `style` |
|
|
153
153
|
| `raw-type` | warning | `text-sm`-style sizes or `text-[…]` — use `type-*` utilities |
|
|
154
154
|
| `raw-motion` | warning | `duration-[…]`, `ease-[…]`, `delay-[…]`, numeric Motion durations |
|
|
155
|
-
| `pattern-drift` | warning | a pasted pattern
|
|
155
|
+
| `pattern-drift` | warning | a pasted pattern's markup or classes differ from `docs/patterns/<id>.tsx` in the installed version — its elements in order, its `className` and `style` values, and its `*Classes` constants. Content, data, handlers, and exported names may change without a warning |
|
|
156
156
|
| `pattern-stale` | warning | a pasted pattern's header names an older version |
|
|
157
157
|
| `pattern-removed` | error | a pasted pattern's id no longer ships |
|
|
158
158
|
|
|
@@ -265,9 +265,10 @@ import {
|
|
|
265
265
|
| `Input` | `label`, `description`, `status`, `message`, `loading`, `endBadge`, `icon`, `size` | Components/Input — pill shell; Required via `endBadge={<Badge>…</Badge>}` |
|
|
266
266
|
| `Search` | `size`, `placeholder`, `onSubmit` | Components/Search — inline input + button row |
|
|
267
267
|
| `PromptBar` | `value`, `onValueChange`, `onSend`, `placeholder` (default Ask anything…), `start`, `end` | Components/PromptBar — **Pattern — prompt bar**. Wide pill, inline field (one line empty, up to 3 lines, then scroll), inset **IconButton** send. Muted until there is text, then `--color-brand` (`#011272`). Enter sends. `start` takes the brand mark; `end` takes extra inset controls. Voice and attachments are not part of this version. |
|
|
268
|
-
| `ChatDock` | `title`, `subtitle`, `mark`, `greeting`, `messages` (replies may carry `copyText`, `meta`, `feedback`), `thinking`, `suggestions`, `followUps`, `followUpsPlacement`, `onSend`, `onSuggestionSelect`, `onMessageFeedback`, `gate` (**ChatDock.Gate**), `disclaimer` | Components/ChatDock — **Pattern — chat dock**. The site assistant: a pinned **PromptBar** with suggested-question pills on hover that opens into a non-modal chat window (full screen on phones). The app owns the conversation and the request, and passes `followUps` for the latest reply when it has them (shown under the reply by default). Finished replies get Copy, thumbs, and a score row from `copyText`, `onMessageFeedback` with `feedback`, and `meta`. Start a project runs as a `gate`
|
|
268
|
+
| `ChatDock` | `title`, `subtitle`, `mark`, `greeting`, `messages` (replies may carry `copyText`, `meta`, `feedback`), `thinking`, `suggestions`, `followUps`, `followUpsPlacement`, `onSend`, `onSuggestionSelect`, `onMessageFeedback`, `gate` (**ChatDock.Gate**), `disclaimer` | Components/ChatDock — **Pattern — chat dock**. The site assistant: a pinned **PromptBar** with suggested-question pills on hover that opens into a non-modal chat window (full screen on phones). The app owns the conversation and the request, and passes `followUps` for the latest reply when it has them (shown under the reply by default). Finished replies get Copy, thumbs, and a score row from `copyText`, `onMessageFeedback` with `feedback`, and `meta`. Start a project runs as a `gate` that takes over the window (modal while it is up) — **Pattern — start a project gate**. Replaces the separate ask page. |
|
|
269
269
|
| `Card` | `variant`, `shape`, `padding` | Components/Card/Card — `Card.Header` (`start` | `end`), **`Card.Body` slot** (no default fill), `Card.Footer` |
|
|
270
270
|
| `Accordion` | `variant`, `flush` (plain), `Accordion.Item` `leading` / `label` / `trailing` / `open` | Components/Accordion — FAQ, settings sections; **Pattern — flush** for filter groups. Closed panels leave the tab order |
|
|
271
|
+
| `Breadcrumb` | `items` (`{ label, href }`, current page last), `maxItems`, `separator` (`chevron` \| `slash`), `variant` (`sans` \| `mono`), `renderLink`, `labels` | Components/Breadcrumb — **Pattern — path**, **long path**, **router links**, **editorial** |
|
|
271
272
|
| `DescriptionList` | `layout` (`inline` \| `stacked`), `rule` (`solid` \| `dotted` \| `none`), `variant` (`sans` \| `mono`), `DescriptionList.Item` `name` / `layout` | Components/DescriptionList — **Pattern — post metadata**, **Pattern — details** |
|
|
272
273
|
| `SectionCaption` | `children`, `as`, `id`, `end`, `marker`, `rule` | Components/SectionCaption — **Pattern — column caption**, **Pattern — caption with an action** |
|
|
273
274
|
| `Prose` | `size` (`lg` \| `md`), `measure` (`reading` \| `none`), `as` | Components/Prose — **Pattern — article body**. Full page: **Guides/Post page → Pattern — post page** |
|
package/bin/wmds-check.mjs
CHANGED
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
* raw-color error hex / rgb / hsl colors in className or style
|
|
14
14
|
* raw-type warn text-xs…text-9xl or text-[…] sizes — use type-* utilities
|
|
15
15
|
* raw-motion warn duration-[…] / ease-[…] / delay-[…] utilities, or numeric Motion durations
|
|
16
|
-
* pattern-drift warn a pasted pattern
|
|
16
|
+
* pattern-drift warn a pasted pattern's markup or classes differ from docs/patterns/<id>.tsx in the
|
|
17
|
+
* installed package (its elements, className / style values, *Classes constants);
|
|
18
|
+
* content, data, handlers, and exports may change
|
|
17
19
|
* pattern-stale warn a pasted pattern's header names an older package version
|
|
18
20
|
* pattern-removed error a pasted pattern's id no longer ships
|
|
19
21
|
*
|
|
@@ -77,12 +79,100 @@ const rawControls = [
|
|
|
77
79
|
["textarea", "TextArea / PromptBar"],
|
|
78
80
|
];
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
// Hex colors, not character references such as ' or '.
|
|
83
|
+
const colorValue = /(?<![&\w])#[0-9a-fA-F]{3,8}\b|rgba?\(|hsla?\(|oklch\(/;
|
|
84
|
+
const colorMatch = /(?<![&\w])#[0-9a-fA-F]{3,8}|rgba?\(.*?\)|hsla?\(.*?\)|oklch\(.*?\)/;
|
|
85
|
+
|
|
86
|
+
/** The index past the end of the string literal that opens at `start` (quote or backtick). */
|
|
87
|
+
const skipString = (code, start) => {
|
|
88
|
+
const quote = code[start];
|
|
89
|
+
for (let index = start + 1; index < code.length; index++) {
|
|
90
|
+
const char = code[index];
|
|
91
|
+
if (char === "\\") {
|
|
92
|
+
index++;
|
|
93
|
+
} else if (quote === "`" && char === "$" && code[index + 1] === "{") {
|
|
94
|
+
index = skipBalanced(code, index + 1) - 1;
|
|
95
|
+
} else if (char === quote) {
|
|
96
|
+
return index + 1;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return code.length;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** The index past the bracket that closes the one at `start`, skipping strings. */
|
|
103
|
+
const skipBalanced = (code, start) => {
|
|
104
|
+
let depth = 0;
|
|
105
|
+
for (let index = start; index < code.length; index++) {
|
|
106
|
+
const char = code[index];
|
|
107
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
108
|
+
index = skipString(code, index) - 1;
|
|
109
|
+
} else if ("{([".includes(char)) {
|
|
110
|
+
depth++;
|
|
111
|
+
} else if ("})]".includes(char)) {
|
|
112
|
+
depth--;
|
|
113
|
+
if (depth === 0) return index + 1;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return code.length;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** One attribute value from `start`: a quoted string or a {…} expression. */
|
|
120
|
+
const readValue = (code, start) => {
|
|
121
|
+
const char = code[start];
|
|
122
|
+
if (char === '"' || char === "'") return code.slice(start, skipString(code, start));
|
|
123
|
+
if (char === "{") return code.slice(start, skipBalanced(code, start));
|
|
124
|
+
return "";
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/** A declaration's value from `start` to the semicolon that ends it. */
|
|
128
|
+
const readDeclaration = (code, start) => {
|
|
129
|
+
let depth = 0;
|
|
130
|
+
for (let index = start; index < code.length; index++) {
|
|
131
|
+
const char = code[index];
|
|
132
|
+
if (char === '"' || char === "'" || char === "`") index = skipString(code, index) - 1;
|
|
133
|
+
else if ("{([".includes(char)) depth++;
|
|
134
|
+
else if ("})]".includes(char)) depth--;
|
|
135
|
+
else if (char === ";" && depth === 0) return code.slice(start, index);
|
|
136
|
+
}
|
|
137
|
+
return code.slice(start);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const squash = (text) => text.replace(/\s+/g, " ").trim();
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* What a pasted pattern must keep: its JSX elements in order, every className and style value, and
|
|
144
|
+
* every *Classes constant. Text, data, handler bodies, and names an app exports are content — they
|
|
145
|
+
* can change without drift.
|
|
146
|
+
*/
|
|
147
|
+
const patternStructure = (source) => {
|
|
148
|
+
const code = source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:"'`\\])\/\/.*$/gm, "$1");
|
|
149
|
+
const parts = [];
|
|
150
|
+
const tokens = /(?<![\w.$)\]])<([A-Za-z][\w.]*)|\b(className|style)=|\bconst\s+(\w*Classes)\b[^=]*=\s*/g;
|
|
151
|
+
for (const match of code.matchAll(tokens)) {
|
|
152
|
+
const end = match.index + match[0].length;
|
|
153
|
+
if (match[1]) parts.push(`<${match[1]}>`);
|
|
154
|
+
else if (match[2]) parts.push(`${match[2]}=${squash(readValue(code, end))}`);
|
|
155
|
+
else parts.push(`${match[3]} = ${squash(readDeclaration(code, end))}`);
|
|
156
|
+
}
|
|
157
|
+
return parts;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/** The first place two structures part, for the finding's message — clipped around where they differ. */
|
|
161
|
+
const firstDifference = (shipped, pasted) => {
|
|
162
|
+
const length = Math.max(shipped.length, pasted.length);
|
|
163
|
+
for (let index = 0; index < length; index++) {
|
|
164
|
+
const want = shipped[index];
|
|
165
|
+
const have = pasted[index];
|
|
166
|
+
if (want === have) continue;
|
|
167
|
+
let common = 0;
|
|
168
|
+
while (want != null && have != null && common < want.length && want[common] === have[common]) common++;
|
|
169
|
+
const from = Math.max(0, common - 24);
|
|
170
|
+
const clip = (text) =>
|
|
171
|
+
text == null ? "nothing" : `${from > 0 ? "…" : ""}${text.slice(from, from + 64)}${text.length > from + 64 ? "…" : ""}`;
|
|
172
|
+
return `${clip(have)} where the pattern has ${clip(want)}`;
|
|
173
|
+
}
|
|
174
|
+
return "";
|
|
175
|
+
};
|
|
86
176
|
|
|
87
177
|
for (const file of files) {
|
|
88
178
|
const source = readFileSync(file, "utf8");
|
|
@@ -120,7 +210,7 @@ for (const file of files) {
|
|
|
120
210
|
}
|
|
121
211
|
|
|
122
212
|
if (/(className|class|style)=/.test(line) || /(color|background|border|fill|stroke)\s*:/.test(line)) {
|
|
123
|
-
if (
|
|
213
|
+
if (colorValue.test(line) && !/var\(--/.test(line.match(colorMatch)?.[0] ?? "") && !ignored(lines, index, "raw-color")) {
|
|
124
214
|
report(file, n, "raw-color", "error", "raw color value — use a semantic color utility or token");
|
|
125
215
|
}
|
|
126
216
|
}
|
|
@@ -150,8 +240,16 @@ for (const file of files) {
|
|
|
150
240
|
if (header[1] !== packageVersion) {
|
|
151
241
|
report(file, 1, "pattern-stale", "warn", `pasted from ${header[1]}, installed ${packageVersion} — re-copy if CHANGELOG names it`);
|
|
152
242
|
}
|
|
153
|
-
|
|
154
|
-
|
|
243
|
+
const shippedStructure = patternStructure(readFileSync(shipped, "utf8"));
|
|
244
|
+
const pastedStructure = patternStructure(source);
|
|
245
|
+
if (shippedStructure.join("\n") !== pastedStructure.join("\n")) {
|
|
246
|
+
report(
|
|
247
|
+
file,
|
|
248
|
+
1,
|
|
249
|
+
"pattern-drift",
|
|
250
|
+
"warn",
|
|
251
|
+
`markup or classes differ from docs/patterns/${id}.tsx (${firstDifference(shippedStructure, pastedStructure)}) — allowed edits are content, data, handlers, exports`,
|
|
252
|
+
);
|
|
155
253
|
}
|
|
156
254
|
}
|
|
157
255
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type BreadcrumbSeparator, type BreadcrumbVariant } from "./breadcrumbStyles";
|
|
3
|
+
export { breadcrumbSeparators, breadcrumbVariants, type BreadcrumbSeparator, type BreadcrumbVariant, } from "./breadcrumbStyles";
|
|
4
|
+
/** Layout-only — margin or grid placement. */
|
|
5
|
+
export type BreadcrumbLayoutClassName = string;
|
|
6
|
+
export interface BreadcrumbItemDef {
|
|
7
|
+
/** Stable key. Default: `href`, else `label`. */
|
|
8
|
+
id?: string;
|
|
9
|
+
label: string;
|
|
10
|
+
/** Where the crumb goes. Leave it out on the last item — the current page. */
|
|
11
|
+
href?: string;
|
|
12
|
+
}
|
|
13
|
+
/** A crumb with somewhere to go — what `renderLink` receives. */
|
|
14
|
+
export type BreadcrumbLinkItem = BreadcrumbItemDef & {
|
|
15
|
+
href: string;
|
|
16
|
+
};
|
|
17
|
+
export interface BreadcrumbLabels {
|
|
18
|
+
/** Names the navigation landmark. Default: "Breadcrumb". */
|
|
19
|
+
nav: string;
|
|
20
|
+
/** Names the "…" control. Default: "Show 2 more pages". */
|
|
21
|
+
more: (count: number) => string;
|
|
22
|
+
}
|
|
23
|
+
export declare const breadcrumbDefaultLabels: BreadcrumbLabels;
|
|
24
|
+
export interface BreadcrumbProps {
|
|
25
|
+
/** The path, from the root to the current page (the last item). */
|
|
26
|
+
items: BreadcrumbItemDef[];
|
|
27
|
+
/**
|
|
28
|
+
* The most crumbs shown. A longer path keeps the first item and the last `maxItems - 2`, and
|
|
29
|
+
* folds the middle into a "…" control that opens a menu of its links. Default: 4. Minimum: 3.
|
|
30
|
+
*/
|
|
31
|
+
maxItems?: number;
|
|
32
|
+
/** `chevron` (default) or `slash`. */
|
|
33
|
+
separator?: BreadcrumbSeparator;
|
|
34
|
+
/** `sans` (default, body type) or `mono` (eyebrow caps, for editorial pages). */
|
|
35
|
+
variant?: BreadcrumbVariant;
|
|
36
|
+
/**
|
|
37
|
+
* Route links through your router: return the link element without children, for example
|
|
38
|
+
* `(item) => <Link href={item.href} />`. Default: `<a href={item.href} />`.
|
|
39
|
+
*/
|
|
40
|
+
renderLink?: (item: BreadcrumbLinkItem) => ReactElement;
|
|
41
|
+
labels?: Partial<BreadcrumbLabels>;
|
|
42
|
+
className?: BreadcrumbLayoutClassName;
|
|
43
|
+
}
|
|
44
|
+
type BreadcrumbSlot = {
|
|
45
|
+
kind: "item";
|
|
46
|
+
item: BreadcrumbItemDef;
|
|
47
|
+
current: boolean;
|
|
48
|
+
} | {
|
|
49
|
+
kind: "more";
|
|
50
|
+
items: BreadcrumbItemDef[];
|
|
51
|
+
};
|
|
52
|
+
/** First, the collapsed middle, then the last `maxItems - 2`. */
|
|
53
|
+
export declare function breadcrumbSlots(items: BreadcrumbItemDef[], maxItems?: number): BreadcrumbSlot[];
|
|
54
|
+
/**
|
|
55
|
+
* The path to the current page — links from the root, the current page last. A long path folds its
|
|
56
|
+
* middle into a "…" control that opens a menu of the hidden links.
|
|
57
|
+
*/
|
|
58
|
+
export declare function Breadcrumb({ items, maxItems, separator, variant, renderLink, labels: labelsProp, className, }: BreadcrumbProps): import("react").JSX.Element;
|
|
59
|
+
//# sourceMappingURL=Breadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Breadcrumb/Breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,EAWL,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AAQf,OAAO,EAUL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,uBAAuB,EAAE,gBAGrC,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,iFAAiF;IACjF,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,YAAY,CAAC;IACxD,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,yBAAyB,CAAC;CACvC;AAED,KAAK,cAAc,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC;AAEjD,iEAAiE;AACjE,wBAAgB,eAAe,CAC7B,KAAK,EAAE,iBAAiB,EAAE,EAC1B,QAAQ,SAAI,GACX,cAAc,EAAE,CAiBlB;AAoND;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAY,EACZ,SAAqB,EACrB,OAAgB,EAChB,UAA8B,EAC9B,MAAM,EAAE,UAAU,EAClB,SAAS,GACV,EAAE,eAAe,+BAwCjB"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../../lib/cn.js";
|
|
3
|
+
import { ButtonIcon as t } from "../../atoms/Button/ButtonIcon.js";
|
|
4
|
+
import { IconButton as n } from "../../atoms/IconButton/IconButton.js";
|
|
5
|
+
import { Dropdown as r } from "../Dropdown/Dropdown.js";
|
|
6
|
+
import { measureDropdownMenuStyle as i } from "../Dropdown/dropdownMenuPosition.js";
|
|
7
|
+
import { breadcrumbItemClasses as a, breadcrumbLinkClasses as o, breadcrumbListClasses as s, breadcrumbMoreClasses as c, breadcrumbPageClasses as l, breadcrumbSeparatorClasses as u, breadcrumbSeparators as d, breadcrumbSlashClasses as f, breadcrumbTextClasses as p, breadcrumbVariantClasses as m, breadcrumbVariants as h } from "./breadcrumbStyles.js";
|
|
8
|
+
import { Fragment as g, useCallback as _, useEffect as v, useId as y, useLayoutEffect as b, useRef as x, useState as S } from "react";
|
|
9
|
+
import { ChevronRight as C, Ellipsis as w } from "lucide-react";
|
|
10
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
11
|
+
import { useRender as D } from "@base-ui/react/use-render";
|
|
12
|
+
//#region src/components/molecules/Breadcrumb/Breadcrumb.tsx
|
|
13
|
+
var O = {
|
|
14
|
+
nav: "Breadcrumb",
|
|
15
|
+
more: (e) => `Show ${e} more ${e === 1 ? "page" : "pages"}`
|
|
16
|
+
};
|
|
17
|
+
function k(e, t = 4) {
|
|
18
|
+
let n = Math.max(3, Math.floor(t)), r = e.length - 1, i = (e, t) => ({
|
|
19
|
+
kind: "item",
|
|
20
|
+
item: e,
|
|
21
|
+
current: t === r
|
|
22
|
+
});
|
|
23
|
+
if (e.length <= n) return e.map(i);
|
|
24
|
+
let a = n - 2;
|
|
25
|
+
return [
|
|
26
|
+
i(e[0], 0),
|
|
27
|
+
{
|
|
28
|
+
kind: "more",
|
|
29
|
+
items: e.slice(1, e.length - a)
|
|
30
|
+
},
|
|
31
|
+
...e.slice(e.length - a).map((t, n) => i(t, e.length - a + n))
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
function A(e) {
|
|
35
|
+
return e.id ?? e.href ?? e.label;
|
|
36
|
+
}
|
|
37
|
+
function j(e) {
|
|
38
|
+
return /* @__PURE__ */ T("a", { href: e.href });
|
|
39
|
+
}
|
|
40
|
+
function M(e) {
|
|
41
|
+
return e.href != null;
|
|
42
|
+
}
|
|
43
|
+
function N({ item: e, renderLink: t }) {
|
|
44
|
+
return D({
|
|
45
|
+
render: t(e),
|
|
46
|
+
props: {
|
|
47
|
+
className: o,
|
|
48
|
+
title: e.label,
|
|
49
|
+
children: e.label
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function P({ separator: e }) {
|
|
54
|
+
return /* @__PURE__ */ T("li", {
|
|
55
|
+
role: "presentation",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
className: u,
|
|
58
|
+
children: e === "slash" ? /* @__PURE__ */ T("span", {
|
|
59
|
+
className: f,
|
|
60
|
+
children: "/"
|
|
61
|
+
}) : /* @__PURE__ */ T(t, {
|
|
62
|
+
size: "xs",
|
|
63
|
+
children: /* @__PURE__ */ T(C, {})
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function F({ items: e, label: t, renderLink: a }) {
|
|
68
|
+
let o = y(), s = x(null), l = x(null), u = x(null), [d, f] = S(!1), [p, m] = S(null), h = x(!1), g = _(() => {
|
|
69
|
+
let t = l.current;
|
|
70
|
+
t != null && m(i(t, e.map((e) => ({ label: e.label })), {
|
|
71
|
+
align: "start",
|
|
72
|
+
widthMode: "content"
|
|
73
|
+
}));
|
|
74
|
+
}, [e]), C = _((e) => {
|
|
75
|
+
f(!1), m(null), e && l.current?.querySelector("button")?.focus();
|
|
76
|
+
}, []);
|
|
77
|
+
b(() => {
|
|
78
|
+
if (d) return g(), window.addEventListener("resize", g), window.addEventListener("scroll", g, !0), () => {
|
|
79
|
+
window.removeEventListener("resize", g), window.removeEventListener("scroll", g, !0);
|
|
80
|
+
};
|
|
81
|
+
}, [d, g]), v(() => {
|
|
82
|
+
!d || p == null || !h.current || (h.current = !1, u.current?.querySelector("a, [href], button")?.focus());
|
|
83
|
+
}, [d, p]), v(() => {
|
|
84
|
+
if (!d) return;
|
|
85
|
+
function e(e) {
|
|
86
|
+
s.current != null && !s.current.contains(e.target) && C(!1);
|
|
87
|
+
}
|
|
88
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
89
|
+
}, [d, C]);
|
|
90
|
+
function D() {
|
|
91
|
+
return [...u.current?.querySelectorAll("a, [href], button") ?? []];
|
|
92
|
+
}
|
|
93
|
+
function O(e) {
|
|
94
|
+
if (!d) {
|
|
95
|
+
e.key === "ArrowDown" && (e.preventDefault(), h.current = !0, f(!0));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (e.key === "Escape") {
|
|
99
|
+
e.preventDefault(), C(!0);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
103
|
+
let t = D();
|
|
104
|
+
if (t.length === 0) return;
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
let n = t.indexOf(document.activeElement), r = e.key === "ArrowDown" ? 1 : -1;
|
|
107
|
+
t[n === -1 ? r === 1 ? 0 : t.length - 1 : (n + r + t.length) % t.length]?.focus();
|
|
108
|
+
}
|
|
109
|
+
function k(e) {
|
|
110
|
+
if (!d) return;
|
|
111
|
+
let t = e.relatedTarget;
|
|
112
|
+
(t == null || !s.current?.contains(t)) && C(!1);
|
|
113
|
+
}
|
|
114
|
+
return /* @__PURE__ */ E("div", {
|
|
115
|
+
ref: s,
|
|
116
|
+
className: c,
|
|
117
|
+
onKeyDown: O,
|
|
118
|
+
onBlur: k,
|
|
119
|
+
children: [/* @__PURE__ */ T("div", {
|
|
120
|
+
ref: l,
|
|
121
|
+
className: "inline-flex",
|
|
122
|
+
children: /* @__PURE__ */ T(n, {
|
|
123
|
+
size: "sm",
|
|
124
|
+
icon: /* @__PURE__ */ T(w, {}),
|
|
125
|
+
"aria-label": t,
|
|
126
|
+
title: "",
|
|
127
|
+
"aria-expanded": d,
|
|
128
|
+
"aria-controls": d ? o : void 0,
|
|
129
|
+
onClick: () => {
|
|
130
|
+
d ? C(!1) : (h.current = !0, f(!0));
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
}), d && p != null ? /* @__PURE__ */ T("div", {
|
|
134
|
+
ref: u,
|
|
135
|
+
children: /* @__PURE__ */ T(r.Menu, {
|
|
136
|
+
id: o,
|
|
137
|
+
"aria-label": t,
|
|
138
|
+
style: p,
|
|
139
|
+
children: e.map((e) => /* @__PURE__ */ T("li", { children: M(e) ? /* @__PURE__ */ T(r.Item, {
|
|
140
|
+
truncate: !1,
|
|
141
|
+
render: a(e),
|
|
142
|
+
onClick: () => C(!1),
|
|
143
|
+
children: e.label
|
|
144
|
+
}) : /* @__PURE__ */ T(r.Item, {
|
|
145
|
+
truncate: !1,
|
|
146
|
+
disabled: !0,
|
|
147
|
+
children: e.label
|
|
148
|
+
}) }, A(e)))
|
|
149
|
+
})
|
|
150
|
+
}) : null]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function I({ items: t, maxItems: n = 4, separator: r = "chevron", variant: i = "sans", renderLink: o = j, labels: c, className: u }) {
|
|
154
|
+
let d = {
|
|
155
|
+
...O,
|
|
156
|
+
...c
|
|
157
|
+
}, f = k(t, n);
|
|
158
|
+
return /* @__PURE__ */ T("nav", {
|
|
159
|
+
"aria-label": d.nav,
|
|
160
|
+
className: u,
|
|
161
|
+
"data-variant": i,
|
|
162
|
+
children: /* @__PURE__ */ T("ol", {
|
|
163
|
+
className: e(s, m[i]),
|
|
164
|
+
children: f.map((e, t) => /* @__PURE__ */ E(g, { children: [t > 0 ? /* @__PURE__ */ T(P, { separator: r }) : null, /* @__PURE__ */ T("li", {
|
|
165
|
+
className: a,
|
|
166
|
+
children: e.kind === "more" ? /* @__PURE__ */ T(F, {
|
|
167
|
+
items: e.items,
|
|
168
|
+
label: d.more(e.items.length),
|
|
169
|
+
renderLink: o
|
|
170
|
+
}) : e.current ? /* @__PURE__ */ T("span", {
|
|
171
|
+
className: l,
|
|
172
|
+
"aria-current": "page",
|
|
173
|
+
title: e.item.label,
|
|
174
|
+
children: e.item.label
|
|
175
|
+
}) : M(e.item) ? /* @__PURE__ */ T(N, {
|
|
176
|
+
item: e.item,
|
|
177
|
+
renderLink: o
|
|
178
|
+
}) : /* @__PURE__ */ T("span", {
|
|
179
|
+
className: p,
|
|
180
|
+
title: e.item.label,
|
|
181
|
+
children: e.item.label
|
|
182
|
+
})
|
|
183
|
+
})] }, e.kind === "more" ? "more" : A(e.item)))
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { I as Breadcrumb, O as breadcrumbDefaultLabels, d as breadcrumbSeparators, k as breadcrumbSlots, h as breadcrumbVariants };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const breadcrumbSeparators: readonly ["chevron", "slash"];
|
|
2
|
+
/** Between crumbs: a chevron (default) or a slash. */
|
|
3
|
+
export type BreadcrumbSeparator = (typeof breadcrumbSeparators)[number];
|
|
4
|
+
export declare const breadcrumbVariants: readonly ["sans", "mono"];
|
|
5
|
+
/** `sans` (default) — body type. `mono` — `type-eyebrow` caps, for editorial pages beside **SectionCaption**. */
|
|
6
|
+
export type BreadcrumbVariant = (typeof breadcrumbVariants)[number];
|
|
7
|
+
export declare const breadcrumbListClasses = "m-0 flex min-w-0 list-none flex-wrap items-center gap-x-1.5 gap-y-1 p-0 sm:gap-x-2";
|
|
8
|
+
export declare const breadcrumbVariantClasses: Record<BreadcrumbVariant, string>;
|
|
9
|
+
export declare const breadcrumbItemClasses = "inline-flex min-w-0 items-center";
|
|
10
|
+
/** A link crumb — muted, darkening with an underline on hover, the focus ring. */
|
|
11
|
+
export declare const breadcrumbLinkClasses: string;
|
|
12
|
+
/** The current page — the last crumb, not a link. */
|
|
13
|
+
export declare const breadcrumbPageClasses: string;
|
|
14
|
+
/** A crumb with no link that is not the current page. */
|
|
15
|
+
export declare const breadcrumbTextClasses: string;
|
|
16
|
+
export declare const breadcrumbSeparatorClasses = "inline-flex shrink-0 items-center text-muted";
|
|
17
|
+
/** The slash separator — a character in the crumbs' own type. */
|
|
18
|
+
export declare const breadcrumbSlashClasses = "select-none";
|
|
19
|
+
/** Holds the 36px "…" control in the text line without growing the row. */
|
|
20
|
+
export declare const breadcrumbMoreClasses = "relative -mx-2.5 -my-2 inline-flex";
|
|
21
|
+
//# sourceMappingURL=breadcrumbStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Breadcrumb/breadcrumbStyles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,+BAAgC,CAAC;AAElE,sDAAsD;AACtD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,kBAAkB,2BAA4B,CAAC;AAE5D,iHAAiH;AACjH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,qBAAqB,uFAAuF,CAAC;AAE1H,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAGtE,CAAC;AAEF,eAAO,MAAM,qBAAqB,qCAAqC,CAAC;AAKxE,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,QAOjC,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,QAAwC,CAAC;AAE3E,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,QAA2C,CAAC;AAE9E,eAAO,MAAM,0BAA0B,iDAAiD,CAAC;AAEzF,iEAAiE;AACjE,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../../lib/cn.js";
|
|
3
|
+
import { typographyClass as t } from "../../../lib/typography.js";
|
|
4
|
+
import { motionTransition as n } from "../../../lib/motion.js";
|
|
5
|
+
//#region src/components/molecules/Breadcrumb/breadcrumbStyles.ts
|
|
6
|
+
var r = ["chevron", "slash"], i = ["sans", "mono"], a = "m-0 flex min-w-0 list-none flex-wrap items-center gap-x-1.5 gap-y-1 p-0 sm:gap-x-2", o = {
|
|
7
|
+
sans: e(t("body"), "text-muted"),
|
|
8
|
+
mono: t("eyebrow")
|
|
9
|
+
}, s = "inline-flex min-w-0 items-center", c = "block max-w-[10rem] truncate sm:max-w-[16rem] lg:max-w-[24rem]", l = e(c, "rounded-sm text-muted underline decoration-transparent decoration-solid underline-offset-4", "transition-[color,text-decoration-color]", n("fast"), "hover:text-fg hover:decoration-current", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-body"), u = e(c, "text-fg"), d = e(c, "text-muted"), f = "inline-flex shrink-0 items-center text-muted", p = "select-none", m = "relative -mx-2.5 -my-2 inline-flex";
|
|
10
|
+
//#endregion
|
|
11
|
+
export { s as breadcrumbItemClasses, l as breadcrumbLinkClasses, a as breadcrumbListClasses, m as breadcrumbMoreClasses, u as breadcrumbPageClasses, f as breadcrumbSeparatorClasses, r as breadcrumbSeparators, p as breadcrumbSlashClasses, d as breadcrumbTextClasses, o as breadcrumbVariantClasses, i as breadcrumbVariants };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ButtonHTMLAttributes, ReactNode } from "react";
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactElement, ReactNode } from "react";
|
|
2
2
|
/** Layout-only — not for row colors or typography overrides. */
|
|
3
3
|
export type DropdownItemLayoutClassName = string;
|
|
4
4
|
export interface DropdownItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
@@ -14,10 +14,15 @@ export interface DropdownItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonE
|
|
|
14
14
|
active?: boolean;
|
|
15
15
|
/** When false, label stays full width — **Select** listbox. Default true for action menus. */
|
|
16
16
|
truncate?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Compose the row onto another element (Base UI `render`) — `render={<a href="/docs" />}` for a
|
|
19
|
+
* menu of links, such as **Breadcrumb**'s collapsed pages. `disabled` maps to `aria-disabled`.
|
|
20
|
+
*/
|
|
21
|
+
render?: ReactElement;
|
|
17
22
|
className?: DropdownItemLayoutClassName;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
25
|
* Dropdown row — start | label | end. Used by **Select** listbox options and future menu patterns.
|
|
21
26
|
*/
|
|
22
|
-
export declare function DropdownItem({ children, start, end, selected, active, truncate, disabled, className, type, ...props }: DropdownItemProps): import("react").JSX.Element;
|
|
27
|
+
export declare function DropdownItem({ children, start, end, selected, active, truncate, disabled, className, type, render, ...props }: DropdownItemProps): import("react").JSX.Element;
|
|
23
28
|
//# sourceMappingURL=DropdownItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownItem.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Dropdown/DropdownItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DropdownItem.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Dropdown/DropdownItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAc3E,gEAAgE;AAChE,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACjE,yBAAyB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,wEAAwE;IACxE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oFAAoF;IACpF,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,SAAS,CAAC,EAAE,2BAA2B,CAAC;CACzC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,KAAK,EACL,GAAG,EACH,QAAgB,EAChB,MAAc,EACd,QAAe,EACf,QAAQ,EACR,SAAS,EACT,IAAe,EACf,MAAM,EACN,GAAG,KAAK,EACT,EAAE,iBAAiB,+BA2CnB"}
|
|
@@ -2,35 +2,51 @@
|
|
|
2
2
|
import { cn as e } from "../../../lib/cn.js";
|
|
3
3
|
import { dropdownItemButtonClasses as t, dropdownItemEndClasses as n, dropdownItemLabelClasses as r, dropdownItemLabelFullClasses as i, dropdownItemSelectedCheckClasses as a, dropdownItemStartClasses as o } from "./dropdownStyles.js";
|
|
4
4
|
import { Check as s } from "lucide-react";
|
|
5
|
-
import {
|
|
5
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
import { useRender as d } from "@base-ui/react/use-render";
|
|
6
7
|
//#region src/components/molecules/Dropdown/DropdownItem.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
8
|
+
function f({ children: d, start: f, end: m, selected: h = !1, active: g = !1, truncate: _ = !0, disabled: v, className: y, type: b = "button", render: x, ...S }) {
|
|
9
|
+
let C = h ? /* @__PURE__ */ l("span", {
|
|
9
10
|
className: a,
|
|
10
11
|
"aria-hidden": !0,
|
|
11
|
-
children: /* @__PURE__ */
|
|
12
|
-
}) :
|
|
12
|
+
children: /* @__PURE__ */ l(s, { strokeWidth: 2 })
|
|
13
|
+
}) : m == null ? null : /* @__PURE__ */ l("span", {
|
|
13
14
|
className: n,
|
|
14
|
-
children:
|
|
15
|
+
children: m
|
|
16
|
+
}), w = e(t, h && "hover:bg-transparent focus-visible:bg-transparent", g && !h && "bg-accent-muted", v && "pointer-events-none opacity-50", y), T = /* @__PURE__ */ u(c, { children: [
|
|
17
|
+
f == null ? null : /* @__PURE__ */ l("span", {
|
|
18
|
+
className: o,
|
|
19
|
+
"aria-hidden": !0,
|
|
20
|
+
children: f
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ l("span", {
|
|
23
|
+
className: _ ? r : i,
|
|
24
|
+
children: d
|
|
25
|
+
}),
|
|
26
|
+
C
|
|
27
|
+
] });
|
|
28
|
+
return /* @__PURE__ */ l(p, {
|
|
29
|
+
...S,
|
|
30
|
+
render: x,
|
|
31
|
+
type: b,
|
|
32
|
+
disabled: v,
|
|
33
|
+
className: w,
|
|
34
|
+
children: T
|
|
15
35
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
children: u
|
|
30
|
-
}),
|
|
31
|
-
b
|
|
32
|
-
]
|
|
36
|
+
}
|
|
37
|
+
function p({ render: e, type: t, disabled: n, ...r }) {
|
|
38
|
+
return d({
|
|
39
|
+
render: e,
|
|
40
|
+
defaultTagName: "button",
|
|
41
|
+
props: e ? {
|
|
42
|
+
...r,
|
|
43
|
+
"aria-disabled": n ? !0 : void 0
|
|
44
|
+
} : {
|
|
45
|
+
...r,
|
|
46
|
+
type: t,
|
|
47
|
+
disabled: n
|
|
48
|
+
}
|
|
33
49
|
});
|
|
34
50
|
}
|
|
35
51
|
//#endregion
|
|
36
|
-
export {
|
|
52
|
+
export { f as DropdownItem };
|