@q1travel/design-system 0.31.0 → 0.31.2
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/contracts/design.dark.md +7 -2
- package/contracts/design.md +7 -2
- package/contracts/implementation-map.md +9 -0
- package/contracts/interface-guidelines.md +5 -1
- package/contracts/table-migration.md +23 -2
- package/contracts/token-naming.md +2 -2
- package/dist-pkg/component-enums.json +14 -0
- package/dist-pkg/design-system.d.ts +51 -10
- package/dist-pkg/design-system.js +3706 -3554
- package/dist-pkg/style.css +191 -28
- package/dist-pkg/tokens.css +6 -6
- package/package.json +2 -2
package/contracts/design.dark.md
CHANGED
|
@@ -456,6 +456,7 @@ Four passes. Do not start at pass three.
|
|
|
456
456
|
- Core tokens define source design values such as color, spacing, radius, and typography.
|
|
457
457
|
- Semantic tokens describe product meaning such as action, surface, border, text, focus, and status.
|
|
458
458
|
- Component mappings consume semantic tokens and define shared behavior for controls and documentation specimens.
|
|
459
|
+
- Input focus shadows use one 4px, 16% semantic-color halo: `--q1-shadow-focus-input` uses focus and `--q1-shadow-focus-input-danger` uses status-danger. Existing real borders retain their resting colors on focus. The shared `--q1-shadow-focus` and `--q1-shadow-focus-danger` keep their two layers. Resting danger shadows that directly consume either input token follow that token; other resting field error shadows remain unchanged.
|
|
459
460
|
|
|
460
461
|
## Usage
|
|
461
462
|
|
|
@@ -533,10 +534,14 @@ CheckCircleFill accepts `tone?: 'default' | 'success'` (default `default`); succ
|
|
|
533
534
|
|
|
534
535
|
**Stat.** Tier C read-only single statistic: `label: string` and `value: ReactNode` are required; `unit?: ReactNode` and `placeholder?: ReactNode` are optional. Only null or undefined values use the placeholder (default `—`); 0, "0", and the empty string remain unchanged. Native HTMLDListElement attributes and className pass through the root. Structure is `<dl class="stat"><dt class="stat__label">label</dt><dd class="stat__value">value<span class="stat__unit">unit</span></dd></dl>`; omit the span when no unit is supplied. Label and unit use label-14 with text-muted; the value uses heading-20-strong with text-primary and tabular-nums. Unit text aligns on the baseline; long content wraps within narrow hosts. The placeholder is visual content without additional ARIA. Stat creates no headings, live regions or interactive elements; hosts own layout, Card surfaces, trends, links and loading. No new tokens or existing-consumer migration; remove Stat usages before reverting this additive export.
|
|
535
536
|
|
|
537
|
+
**FileInput.** Tier B native file selection. Root `div.file-input` contains `input.file-input__native.q1-sr-only` (`type="file"`, `tabIndex=-1`, `aria-hidden=true`), DS `Button.file-input__trigger` (`type="button"`) and `span.file-input__status` (`role="status"`). `name`, `accept`, `multiple`, `required`, `disabled`, `onChange` and `ref` act on the input; ref exposes files and clearing. `id` and all aria attributes act on the button for Label htmlFor / FormField controlId. `className` merges on the root. `buttonLabel?: ReactNode` defaults to 选择文件; variant defaults to secondary and size follows Button. Props derive from input props excluding type/value/defaultValue/children and replacing native numeric size with ButtonSize; only the listed attributes take effect. Status starts empty, shows a single filename or 已选 N 个文件, truncates on one line and retains all names in title. Native validation retains its default event handling and first-invalid-control order. When the invalid hidden input receives focus, its focus listener immediately marks aria-invalid=true and transfers focus to the visible button. Calling form.checkValidity() alone neither moves focus nor marks the button. Selecting files and form reset clear automatic invalid state; an explicit caller aria-invalid, including false, takes precedence. An enabled aria-invalid=true trigger uses the status-danger border at rest and on hover, and shadow-focus-input-danger for focus-visible; resting invalid adds no shadow and disabled styling is unchanged. Callers provide error copy through FormField. Native change and form reset synchronize status; reset waits for the native value to clear. After imperative ref clearing, dispatch change to synchronize display. Caller owns files, validation and upload; no reset prop, drag/drop, progress, preview or file list. Native button keyboard, accessible naming and shared focus ring satisfy Tier B; input is hidden from keyboard and accessibility tree. Existing consumers need no migration; remove new usages before reverting additive exports, CSS and route.
|
|
538
|
+
|
|
539
|
+
**Stepper.** Tier C read-only horizontal steps. Required `steps: StepperStep[]` contains `label: ReactNode` and optional `description?: ReactNode`; required `current: number` is zero-based. Negative current is treated as 0; earlier steps are complete, the matching step is current, later steps are upcoming. Current at or above length completes all steps without a current item. Native ol attributes pass through and className merges; children are supplied through steps. DOM: `ol.stepper > li.stepper__step`, with exactly one state class `stepper__step--complete`, `stepper__step--current` or `stepper__step--upcoming`; only the current li carries `aria-current="step"`. The decorative indicator is aria-hidden; complete uses CheckCircleFill with its default tone, current uses an emphasized numbered circle, upcoming a neutral outlined circle. Every item includes visually hidden state text: 已完成 / 当前步骤 / 未开始. Labels use label-14 and text-primary; descriptions use label-13 and text-muted. Connectors use text-primary after completed steps, border-strong otherwise. Existing tokens only; long labels wrap without overflow in hosts of 360px or less. No built-in navigation, error states, orientation, size or keyboard model. Existing consumers need no migration; remove new usages before reverting the additive exports and route.
|
|
540
|
+
|
|
536
541
|
**Status and feedback.** Banner, ProjectBanner, Note, ErrorCard, RegionErrorState, ErrorMessage, EmptyState, Badge, Pill, CheckCircleFill, StatusDot, ToastProvider, useToast, Feedback, PageFeedback, Spinner, LoadingDots, Skeleton, StatusPage, SkeletonIllustration, EmptyListIllustration.
|
|
537
542
|
|
|
538
|
-
- Banner announces at page scope. Note is an inline aside. ErrorMessage sits against one field. ErrorCard replaces a region that failed to load. Picking the widest one available overstates the problem.
|
|
539
|
-
- RegionErrorState replaces only the failed region in place (table body under a kept header, card body, page section) while the rest of the page stays usable: neutral surface, danger color on the icon only, polite `role=status` by default, built-in retry that keeps focus while `retrying`. ErrorCard is for a failure that blocks the current task (danger card, assertive `role=alert`). EmptyState is a successful load with no data: default `layout="center"` keeps the full empty view; `layout="inline"` is
|
|
543
|
+
- Banner accepts a string `title` and paragraph-inline `children` (text and inline Link, no block elements). `action: BannerAction` is either `{ label, href }` or `{ label, onClick, loading?, disabled? }`, mutually exclusive. The exported `BannerAction` derives button events and states from ButtonProps. Buttons use `type="button"`, size sm, rounded, primary for announcements and secondary for tone strips, with layout class `banner__button-action`. Loading retains focus with aria-disabled and blocks activation; disabled takes priority and leaves the Tab order. Loading adds no aria-busy; Banner adds no role or live region. Progress ignores either action. Existing links and calls omitting new capabilities retain their complete markup; no existing consumer migration is required. Remove button calls and BannerAction imports before reverting this addition. Banner announces at page scope. Note is an inline aside. ErrorMessage sits against one field. ErrorCard replaces a region that failed to load. Picking the widest one available overstates the problem.
|
|
544
|
+
- RegionErrorState replaces only the failed region in place (table body under a kept header, card body, page section) while the rest of the page stays usable: neutral surface, danger color on the icon only, polite `role=status` by default, built-in retry that keeps focus while `retrying`. ErrorCard is for a failure that blocks the current task (danger card, assertive `role=alert`). EmptyState is a successful load with no data: default `layout="center"` keeps the full empty view; `layout="inline"` is a small illustration or icon and regular secondary title row inside a section whose heading and actions belong to the host, without description, actions, or headingLevel. Inline accepts `illustration?: ReactNode`, using `--q1-space-16` (64px) for its width and preserving the artwork aspect ratio; illustration takes priority over icon with a development warning when both are supplied. Without illustration, existing icon-only and title-only calls stay unchanged. Center accepts a decorative `illustration?: ReactNode` in place of icon; when neither illustration nor icon is supplied, it renders `EmptyListIllustration variant="neutral"` inside the decorative `empty-state__illustration` slot. Explicit icons retain their slot with a transparent background in both themes. Both layouts accept `titleHidden?: boolean`: true adds `empty-state--title-hidden` to the existing root and `q1-sr-only` to the required title, preserving its p or h2–h6 tag, text and accessibility semantics. Center keeps illustration/icon, optional description and actions; inline keeps its small illustration or icon. The hidden title takes no layout space; remaining siblings keep the existing gap and margins, and an illustration/icon alone has no trailing margin. Omitted or false preserves the existing DOM, classes and styles exactly. Built-in `EmptyListIllustration` accepts `scene?: 'list' | 'search' | 'complete' | 'chart' | 'inventory' | 'orders' | 'product' | 'permission' | 'purchase' | 'supplier' | 'team' | 'notification' | 'store' | 'task' | 'session' | 'activity'` and the compatible `variant?: 'complete' | 'neutral'`. Explicit scene takes priority; without scene, neutral maps to list and all other calls default to complete. Accepted #830 intentionally changes both standalone default complete and EmptyState default list artwork and internal SVG structure; the outer decorative span, class and 96×104 viewBox remain. Complete draws its own decorative check without depending on CheckCircleFill. All scenes use opaque neutral bodies, token radii, canonical stroke width, and exactly one brand-colored element (light primary-700, dark primary-900); geometry is identical across themes. Body contrast against the actual panel is at least 1.3:1. Both variants have no icon backplate. `layout="strip"` adds a full-width neutral strip for list failures and load-more rows, with retry always inside its right edge. See `implementation-map.md` for the retry and announcement boundary.
|
|
540
545
|
- StatusPage defaults to a whole unavailable page with a caller-owned title, decorative SkeletonIllustration, plain-text description rendered as a paragraph, and actions. Its size="region" variant centers an icon or small illustration, title, description, and up to two actions inside a substantial content region, with a transparent background and content-driven height. ErrorCard covers a blocking compact failure; RegionErrorState is a compact retryable region message with its own status announcement; EmptyState means loading succeeded without content. StatusPage headingLevel accepts 1–6 (default 1); choose the next heading level under the host section. Existing omitted, 1 and 2 calls need no migration. StatusPage creates no live region; its host owns focus and announcements. StatusPage code is metadata only, never a message or spoken number.
|
|
541
546
|
- RegionErrorState replaces only the failed region in place (table body under a kept header, card body, page section) while the rest of the page stays usable: neutral surface, danger color on the icon only, polite `role=status` by default, built-in retry that keeps focus while `retrying`. ErrorCard is for a failure that blocks the current task (danger card, assertive `role=alert`). EmptyState is a successful load with no data. `layout="strip"` adds a full-width neutral strip for list failures and load-more rows, with retry always inside its right edge. See `implementation-map.md` for the retry and announcement boundary.
|
|
542
547
|
- Toast is for non-blocking confirmation of something that already happened. It is not where an error the reader must act on belongs.
|
package/contracts/design.md
CHANGED
|
@@ -456,6 +456,7 @@ Four passes. Do not start at pass three.
|
|
|
456
456
|
- Core tokens define source design values such as color, spacing, radius, and typography.
|
|
457
457
|
- Semantic tokens describe product meaning such as action, surface, border, text, focus, and status.
|
|
458
458
|
- Component mappings consume semantic tokens and define shared behavior for controls and documentation specimens.
|
|
459
|
+
- Input focus shadows use one 4px, 16% semantic-color halo: `--q1-shadow-focus-input` uses focus and `--q1-shadow-focus-input-danger` uses status-danger. Existing real borders retain their resting colors on focus. The shared `--q1-shadow-focus` and `--q1-shadow-focus-danger` keep their two layers. Resting danger shadows that directly consume either input token follow that token; other resting field error shadows remain unchanged.
|
|
459
460
|
|
|
460
461
|
## Usage
|
|
461
462
|
|
|
@@ -533,10 +534,14 @@ CheckCircleFill accepts `tone?: 'default' | 'success'` (default `default`); succ
|
|
|
533
534
|
|
|
534
535
|
**Stat.** Tier C read-only single statistic: `label: string` and `value: ReactNode` are required; `unit?: ReactNode` and `placeholder?: ReactNode` are optional. Only null or undefined values use the placeholder (default `—`); 0, "0", and the empty string remain unchanged. Native HTMLDListElement attributes and className pass through the root. Structure is `<dl class="stat"><dt class="stat__label">label</dt><dd class="stat__value">value<span class="stat__unit">unit</span></dd></dl>`; omit the span when no unit is supplied. Label and unit use label-14 with text-muted; the value uses heading-20-strong with text-primary and tabular-nums. Unit text aligns on the baseline; long content wraps within narrow hosts. The placeholder is visual content without additional ARIA. Stat creates no headings, live regions or interactive elements; hosts own layout, Card surfaces, trends, links and loading. No new tokens or existing-consumer migration; remove Stat usages before reverting this additive export.
|
|
535
536
|
|
|
537
|
+
**FileInput.** Tier B native file selection. Root `div.file-input` contains `input.file-input__native.q1-sr-only` (`type="file"`, `tabIndex=-1`, `aria-hidden=true`), DS `Button.file-input__trigger` (`type="button"`) and `span.file-input__status` (`role="status"`). `name`, `accept`, `multiple`, `required`, `disabled`, `onChange` and `ref` act on the input; ref exposes files and clearing. `id` and all aria attributes act on the button for Label htmlFor / FormField controlId. `className` merges on the root. `buttonLabel?: ReactNode` defaults to 选择文件; variant defaults to secondary and size follows Button. Props derive from input props excluding type/value/defaultValue/children and replacing native numeric size with ButtonSize; only the listed attributes take effect. Status starts empty, shows a single filename or 已选 N 个文件, truncates on one line and retains all names in title. Native validation retains its default event handling and first-invalid-control order. When the invalid hidden input receives focus, its focus listener immediately marks aria-invalid=true and transfers focus to the visible button. Calling form.checkValidity() alone neither moves focus nor marks the button. Selecting files and form reset clear automatic invalid state; an explicit caller aria-invalid, including false, takes precedence. An enabled aria-invalid=true trigger uses the status-danger border at rest and on hover, and shadow-focus-input-danger for focus-visible; resting invalid adds no shadow and disabled styling is unchanged. Callers provide error copy through FormField. Native change and form reset synchronize status; reset waits for the native value to clear. After imperative ref clearing, dispatch change to synchronize display. Caller owns files, validation and upload; no reset prop, drag/drop, progress, preview or file list. Native button keyboard, accessible naming and shared focus ring satisfy Tier B; input is hidden from keyboard and accessibility tree. Existing consumers need no migration; remove new usages before reverting additive exports, CSS and route.
|
|
538
|
+
|
|
539
|
+
**Stepper.** Tier C read-only horizontal steps. Required `steps: StepperStep[]` contains `label: ReactNode` and optional `description?: ReactNode`; required `current: number` is zero-based. Negative current is treated as 0; earlier steps are complete, the matching step is current, later steps are upcoming. Current at or above length completes all steps without a current item. Native ol attributes pass through and className merges; children are supplied through steps. DOM: `ol.stepper > li.stepper__step`, with exactly one state class `stepper__step--complete`, `stepper__step--current` or `stepper__step--upcoming`; only the current li carries `aria-current="step"`. The decorative indicator is aria-hidden; complete uses CheckCircleFill with its default tone, current uses an emphasized numbered circle, upcoming a neutral outlined circle. Every item includes visually hidden state text: 已完成 / 当前步骤 / 未开始. Labels use label-14 and text-primary; descriptions use label-13 and text-muted. Connectors use text-primary after completed steps, border-strong otherwise. Existing tokens only; long labels wrap without overflow in hosts of 360px or less. No built-in navigation, error states, orientation, size or keyboard model. Existing consumers need no migration; remove new usages before reverting the additive exports and route.
|
|
540
|
+
|
|
536
541
|
**Status and feedback.** Banner, ProjectBanner, Note, ErrorCard, RegionErrorState, ErrorMessage, EmptyState, Badge, Pill, CheckCircleFill, StatusDot, ToastProvider, useToast, Feedback, PageFeedback, Spinner, LoadingDots, Skeleton, StatusPage, SkeletonIllustration, EmptyListIllustration.
|
|
537
542
|
|
|
538
|
-
- Banner announces at page scope. Note is an inline aside. ErrorMessage sits against one field. ErrorCard replaces a region that failed to load. Picking the widest one available overstates the problem.
|
|
539
|
-
- RegionErrorState replaces only the failed region in place (table body under a kept header, card body, page section) while the rest of the page stays usable: neutral surface, danger color on the icon only, polite `role=status` by default, built-in retry that keeps focus while `retrying`. ErrorCard is for a failure that blocks the current task (danger card, assertive `role=alert`). EmptyState is a successful load with no data: default `layout="center"` keeps the full empty view; `layout="inline"` is
|
|
543
|
+
- Banner accepts a string `title` and paragraph-inline `children` (text and inline Link, no block elements). `action: BannerAction` is either `{ label, href }` or `{ label, onClick, loading?, disabled? }`, mutually exclusive. The exported `BannerAction` derives button events and states from ButtonProps. Buttons use `type="button"`, size sm, rounded, primary for announcements and secondary for tone strips, with layout class `banner__button-action`. Loading retains focus with aria-disabled and blocks activation; disabled takes priority and leaves the Tab order. Loading adds no aria-busy; Banner adds no role or live region. Progress ignores either action. Existing links and calls omitting new capabilities retain their complete markup; no existing consumer migration is required. Remove button calls and BannerAction imports before reverting this addition. Banner announces at page scope. Note is an inline aside. ErrorMessage sits against one field. ErrorCard replaces a region that failed to load. Picking the widest one available overstates the problem.
|
|
544
|
+
- RegionErrorState replaces only the failed region in place (table body under a kept header, card body, page section) while the rest of the page stays usable: neutral surface, danger color on the icon only, polite `role=status` by default, built-in retry that keeps focus while `retrying`. ErrorCard is for a failure that blocks the current task (danger card, assertive `role=alert`). EmptyState is a successful load with no data: default `layout="center"` keeps the full empty view; `layout="inline"` is a small illustration or icon and regular secondary title row inside a section whose heading and actions belong to the host, without description, actions, or headingLevel. Inline accepts `illustration?: ReactNode`, using `--q1-space-16` (64px) for its width and preserving the artwork aspect ratio; illustration takes priority over icon with a development warning when both are supplied. Without illustration, existing icon-only and title-only calls stay unchanged. Center accepts a decorative `illustration?: ReactNode` in place of icon; when neither illustration nor icon is supplied, it renders `EmptyListIllustration variant="neutral"` inside the decorative `empty-state__illustration` slot. Explicit icons retain their slot with a transparent background in both themes. Both layouts accept `titleHidden?: boolean`: true adds `empty-state--title-hidden` to the existing root and `q1-sr-only` to the required title, preserving its p or h2–h6 tag, text and accessibility semantics. Center keeps illustration/icon, optional description and actions; inline keeps its small illustration or icon. The hidden title takes no layout space; remaining siblings keep the existing gap and margins, and an illustration/icon alone has no trailing margin. Omitted or false preserves the existing DOM, classes and styles exactly. Built-in `EmptyListIllustration` accepts `scene?: 'list' | 'search' | 'complete' | 'chart' | 'inventory' | 'orders' | 'product' | 'permission' | 'purchase' | 'supplier' | 'team' | 'notification' | 'store' | 'task' | 'session' | 'activity'` and the compatible `variant?: 'complete' | 'neutral'`. Explicit scene takes priority; without scene, neutral maps to list and all other calls default to complete. Accepted #830 intentionally changes both standalone default complete and EmptyState default list artwork and internal SVG structure; the outer decorative span, class and 96×104 viewBox remain. Complete draws its own decorative check without depending on CheckCircleFill. All scenes use opaque neutral bodies, token radii, canonical stroke width, and exactly one brand-colored element (light primary-700, dark primary-900); geometry is identical across themes. Body contrast against the actual panel is at least 1.3:1. Both variants have no icon backplate. `layout="strip"` adds a full-width neutral strip for list failures and load-more rows, with retry always inside its right edge. See `implementation-map.md` for the retry and announcement boundary.
|
|
540
545
|
- StatusPage defaults to a whole unavailable page with a caller-owned title, decorative SkeletonIllustration, plain-text description rendered as a paragraph, and actions. Its size="region" variant centers an icon or small illustration, title, description, and up to two actions inside a substantial content region, with a transparent background and content-driven height. ErrorCard covers a blocking compact failure; RegionErrorState is a compact retryable region message with its own status announcement; EmptyState means loading succeeded without content. StatusPage headingLevel accepts 1–6 (default 1); choose the next heading level under the host section. Existing omitted, 1 and 2 calls need no migration. StatusPage creates no live region; its host owns focus and announcements. StatusPage code is metadata only, never a message or spoken number.
|
|
541
546
|
- RegionErrorState replaces only the failed region in place (table body under a kept header, card body, page section) while the rest of the page stays usable: neutral surface, danger color on the icon only, polite `role=status` by default, built-in retry that keeps focus while `retrying`. ErrorCard is for a failure that blocks the current task (danger card, assertive `role=alert`). EmptyState is a successful load with no data. `layout="strip"` adds a full-width neutral strip for list failures and load-more rows, with retry always inside its right edge. See `implementation-map.md` for the retry and announcement boundary.
|
|
542
547
|
- Toast is for non-blocking confirmation of something that already happened. It is not where an error the reader must act on belongs.
|
|
@@ -102,6 +102,11 @@ Click, ArrowLeft/ArrowRight, Home, and End notify activation; controlled selecti
|
|
|
102
102
|
changes only when the parent updates `value`. Keyboard navigation follows the
|
|
103
103
|
focused enabled tab while the parent update is pending, and a later value update
|
|
104
104
|
does not pull focus from the activated button. Consumers own URL synchronization.
|
|
105
|
+
Line disabled labels and their icons use `text-muted`, with at least 3:1 contrast
|
|
106
|
+
against the background in both themes and less contrast than enabled labels. Hover
|
|
107
|
+
and press do not strengthen disabled items. A selected-disabled style combination
|
|
108
|
+
keeps a muted underline; unselected disabled items have no underline. Runtime
|
|
109
|
+
selection still falls back to an enabled item as described above.
|
|
105
110
|
|
|
106
111
|
## Record activity (accepted 2026-10-06)
|
|
107
112
|
|
|
@@ -154,3 +159,7 @@ The announcement region wraps only the icon, the `q1-sr-only` 「错误:」 pr
|
|
|
154
159
|
## ThemeSwitcher selection appearance
|
|
155
160
|
|
|
156
161
|
Accepted 2026-11-02 (#761): ThemeSwitcher keeps a single outer group border. Options have no border; selection uses `--q1-color-bg-selected-neutral` and primary text, with no inset selection edge. Unselected options keep secondary text and the container background. Light and dark selected and unselected text meet 4.5:1 contrast; the selected background differs from the container. Native labeled radios retain their keyboard behavior, hover changes enabled option text to primary, and keyboard focus uses the shared focus shadow. Public props, class names, DOM structure, exports, and tokens are unchanged.
|
|
162
|
+
|
|
163
|
+
## EmptyState title visibility
|
|
164
|
+
|
|
165
|
+
Accepted #568: `EmptyState` supports `titleHidden?: boolean` in both center and inline layouts. Both layouts accept `titleHidden?: boolean`: true adds `empty-state--title-hidden` to the existing root and `q1-sr-only` to the required title, preserving its p or h2–h6 tag, text and accessibility semantics. Center keeps illustration/icon, optional description and actions; inline keeps its small illustration or icon. Inline accepts `illustration?: ReactNode` with width `--q1-space-16` (64px), preserving the artwork aspect ratio; illustration takes priority over icon and supplying both emits a development warning. Description, actions and headingLevel remain center-only. Existing inline icon-only and title-only calls retain their exact rendering. The hidden title takes no layout space; remaining siblings keep the existing gap and margins, and an illustration/icon alone has no trailing margin. Omitted or false preserves the existing DOM, classes and styles exactly.
|
|
@@ -243,4 +243,8 @@ Component pages follow one skeleton so a reader who has used one page can find t
|
|
|
243
243
|
|
|
244
244
|
### Empty illustrations
|
|
245
245
|
|
|
246
|
-
Accepted #830: decorative empty illustrations share a 96×104 viewBox, radius-3 outer frames, radius-1 clips, and ICON_STROKE_WIDTH round strokes. All scene geometry, including half the computed stroke width around each element, stays inside the viewBox. Inventory integrates the bell into the shelf; permission centers a complete padlock on the panel; product uses a front-facing label. No detached brand decorations. The family specimen uses one site-themed card per scene, four columns on wide screens and two on narrow screens. Opaque neutral bodies must contrast at least 1.3:1 against the actual card background. Use no gradients, shadows or particles;
|
|
246
|
+
Accepted #830: decorative empty illustrations share a 96×104 viewBox, radius-3 outer frames, radius-1 clips, and ICON_STROKE_WIDTH round strokes. All scene geometry, including half the computed stroke width around each element, stays inside the viewBox. Inventory integrates the bell into the shelf; permission centers a complete padlock on the panel; product uses a front-facing label. No detached brand decorations. The family specimen uses one site-themed card per scene, four columns on wide screens and two on narrow screens. Opaque neutral bodies must contrast at least 1.3:1 against the actual card background. Use no gradients, shadows or particles; exactly one element uses primary-700 in light and primary-900 in dark, with identical geometry. Scene selects list, search, complete, chart, inventory, orders, product, permission, purchase, supplier, team, notification, store, task, session or activity. Scene takes precedence over the compatible variant; absent scene, neutral maps to list and all other calls to complete. Standalone complete and EmptyState list defaults intentionally receive new artwork and internal SVG structure. Keep the decorative outer span, aria-hidden=true, non-focusable SVG and text-owned state meaning. Complete owns its check; CheckCircleFill semantics are unchanged.
|
|
247
|
+
|
|
248
|
+
### EmptyState illustration-only presentation
|
|
249
|
+
|
|
250
|
+
Accepted #568: `titleHidden` visually hides the required title using `q1-sr-only`, while retaining its original paragraph or heading semantics and accessible text. Illustration/icon remains decorative; description and actions are independent optional center content. Inline accepts a small decorative `illustration?: ReactNode` at `--q1-space-16` (64px) width, preserving its aspect ratio; illustration takes priority over icon, with a development warning when both are supplied. Inline description, actions and headingLevel remain unsupported. Omitted or false leaves the default presentation unchanged; existing inline calls without illustration retain their rendering.
|
|
@@ -39,6 +39,11 @@ library, router, or product-side data model.
|
|
|
39
39
|
navigation in this contract.
|
|
40
40
|
- `renderRow` and composed cells may extend row presentation, but they must
|
|
41
41
|
preserve the table's heading, cell, focus, and selection semantics.
|
|
42
|
+
`TableRowRenderContext<T>.selectionCell: ReactNode | null` exposes the exact
|
|
43
|
+
complete selection cell used by default rows, including the library Checkbox,
|
|
44
|
+
accessible name, controlled state, disabled state, and change handler. It is
|
|
45
|
+
`null` without `selection`. Reuse it when composing content cells; `cells`
|
|
46
|
+
remains unchanged and still includes the selection cell, so do not render both.
|
|
42
47
|
- Loading, empty, and error states are explicit consumer-owned surfaces. Table
|
|
43
48
|
must not invent fetch status, error copy, recovery actions, or business
|
|
44
49
|
permissions. An empty result may be rendered as an adjacent Empty State
|
|
@@ -60,9 +65,25 @@ requires each capability.
|
|
|
60
65
|
- Selection is controlled by the consumer. Table receives the selected row keys
|
|
61
66
|
and reports the next selected-key collection through its change callback; it
|
|
62
67
|
does not keep an independent authoritative selection store.
|
|
68
|
+
- `onSelectionChange(selectedKeys, details)` keeps the selected-key array contents
|
|
69
|
+
and ordering unchanged. Existing single-argument callbacks remain assignable.
|
|
70
|
+
The exported `TableSelectionChangeDetails` is `{ type: 'row' | 'page';
|
|
71
|
+
rowKey?: TableRowKey; checked: boolean; shiftKey: boolean }`. Row changes include
|
|
72
|
+
`rowKey`; current-page changes omit the property entirely. `checked` is the
|
|
73
|
+
control's target state. `shiftKey` reads the triggering native event modifier,
|
|
74
|
+
defaulting to `false` when absent, including native Shift-click and Shift-Space.
|
|
75
|
+
These details do not implement range selection or change default selection behavior.
|
|
63
76
|
- A row is selectable only when the consumer exposes it as selectable. Selection
|
|
64
|
-
controls use
|
|
65
|
-
`:focus-visible` state.
|
|
77
|
+
controls use the library `Checkbox` with accessible names and a visible
|
|
78
|
+
`:focus-visible` state. Header and default row selection share the bare
|
|
79
|
+
`span.control-option.control-option--bare` shell, native checkbox input, and
|
|
80
|
+
`span.control-option__visual`. The former `table__checkbox-control` label is
|
|
81
|
+
removed; consumers targeting it must use the selection cell and Checkbox
|
|
82
|
+
structure. Both controls have equal visual dimensions and horizontal centers,
|
|
83
|
+
and their visual centers align vertically with the first text column,
|
|
84
|
+
retain the selection-column width, and use canonical theme tokens. Coarse
|
|
85
|
+
pointers retain the minimum touch target. Header `indeterminate` and
|
|
86
|
+
`aria-checked="mixed"` expose partial selection.
|
|
66
87
|
- The header select-all control operates on the currently rendered/selectable
|
|
67
88
|
page only.
|
|
68
89
|
- Selecting all adds the selectable keys visible on the current page to the
|
|
@@ -111,9 +111,9 @@ Examples:
|
|
|
111
111
|
|
|
112
112
|
Owner-approved exception (2026-10-05): ErrorMessage, field errors, and ErrorCard titles use `--q1-color-red-900`; other status text retains its existing semantic text token.
|
|
113
113
|
|
|
114
|
-
`--q1-color-focus` is neutral black in light mode and white in dark mode. `--q1-shadow-focus` and `--q1-shadow-focus-
|
|
114
|
+
`--q1-color-focus` is neutral black in light mode and white in dark mode. The shared `--q1-shadow-focus` and `--q1-shadow-focus-danger` remain unchanged: both keep a gapless 1px ring at 34% plus a 4px halo at 16%, using focus and danger color respectively. Inputs already have a real border, so `--q1-shadow-focus-input` omits the 1px shadow and uses only the 4px halo at 16%; focus preserves the resting border color, without an active-border swap or inset stroke. `--q1-input-border-focus` remains an opt-in override and defaults to the resting input border. Invalid inputs retain their danger border; `--q1-shadow-focus-input-danger` uses the same single 4px halo at 16% in danger color. Text links retain the 3px neutral focus underline. Forced colors and high contrast retain visible system outlines.
|
|
115
115
|
|
|
116
|
-
Migration: `--q1-color-bg-panel` remains `#ffffff` in light mode and changes from `#0a0a0a` to `#1a1a1a` in dark mode. The dark canvas, raised surface, and overlay now use `#121212`, `#222222`, and `#2b2b2b`. Downstream overrides that manually raised panel or overlay backgrounds should be reviewed. The 2026-10-05 owner-approved focus change
|
|
116
|
+
Migration: `--q1-color-bg-panel` remains `#ffffff` in light mode and changes from `#0a0a0a` to `#1a1a1a` in dark mode. The dark canvas, raised surface, and overlay now use `#121212`, `#222222`, and `#2b2b2b`. Downstream overrides that manually raised panel or overlay backgrounds should be reviewed. The 2026-10-05 owner-approved focus change replaced the brand ring and inset input stroke with the neutral 1px / 4px recipe. Issue #835 revises its input portion to one 4px halo at 16%, preserving real borders and their resting colors; the shared focus recipe stays unchanged. Consumers with custom focus visuals should update their screenshots and forced-colors fallback. The unused `--q1-shadow-card` name is removed before release.
|
|
117
117
|
|
|
118
118
|
Owner-approved contrast roles (2026-10-07): `--q1-color-border-control` is the resting form-control boundary (light uses `gray-700`, about 3.23:1 on white, since the 2026-10-13 owner decision; dark uses `gray-600`); controls with a strong light border retain that value and opt into this role only in dark mode. Decorative borders retain `border` / `border-strong`. Dark `--q1-color-border-strong` moves from `gray-400` to `gray-500` (2026-10-13) so selected and emphasized outlines stay distinguishable from the default `border`. `--q1-color-accent-graphic` is for brand-colored non-text graphics (light `primary-700`, dark `primary-900`), independent of button action colors. Slider dark unfilled tracks use `gray-500`.
|
|
119
119
|
|
|
@@ -151,20 +151,31 @@ export declare type BadgeTone = 'neutral' | 'info' | 'success' | 'warning' | 'da
|
|
|
151
151
|
|
|
152
152
|
export declare function Banner({ title, children, tone, icon, action, onDismiss, progress, className, ...rest }: BannerProps): JSX.Element;
|
|
153
153
|
|
|
154
|
+
export declare type BannerAction = {
|
|
155
|
+
label: string;
|
|
156
|
+
href: string;
|
|
157
|
+
onClick?: never;
|
|
158
|
+
loading?: never;
|
|
159
|
+
disabled?: never;
|
|
160
|
+
} | {
|
|
161
|
+
label: string;
|
|
162
|
+
href?: never;
|
|
163
|
+
onClick: NonNullable<ButtonProps['onClick']>;
|
|
164
|
+
loading?: ButtonProps['loading'];
|
|
165
|
+
disabled?: ButtonProps['disabled'];
|
|
166
|
+
};
|
|
167
|
+
|
|
154
168
|
export declare type BannerProps = {
|
|
155
169
|
/** 粗体导语,一眼点题。 */
|
|
156
170
|
title: string;
|
|
157
|
-
/**
|
|
171
|
+
/** 段落内文本或行内内容,可放 Link;组件统一用「 — 」与导语衔接。 */
|
|
158
172
|
children?: ReactNode;
|
|
159
173
|
/** 未设 = 页顶公告形态;设值 = 页内卡条形态(neutral 为中性卡条)。 */
|
|
160
174
|
tone?: BannerTone;
|
|
161
175
|
/** 卡条形态的前缀图标;纯装饰(组件自动 aria-hidden)。公告形态与进度形态不渲染图标。 */
|
|
162
176
|
icon?: ReactNode;
|
|
163
|
-
/**
|
|
164
|
-
action?:
|
|
165
|
-
label: string;
|
|
166
|
-
href: string;
|
|
167
|
-
};
|
|
177
|
+
/** 主操作链接或按钮;按钮复用 Button 的 loading / disabled。进度形态忽略 action。 */
|
|
178
|
+
action?: BannerAction;
|
|
168
179
|
/** 关闭回调;设置后渲染关闭按钮。公告形态无关闭;进度形态渲染在进度头右侧。 */
|
|
169
180
|
onDismiss?: () => void;
|
|
170
181
|
/** 进度形态(自有扩展):value 为 0–100 的百分比(非法值归 0),label 供读屏。进度恒为卡条形态。 */
|
|
@@ -1107,11 +1118,13 @@ export declare type EmptyListIllustrationProps = {
|
|
|
1107
1118
|
variant?: 'complete' | 'neutral';
|
|
1108
1119
|
};
|
|
1109
1120
|
|
|
1110
|
-
export declare type EmptyListIllustrationScene = 'list' | 'search' | 'complete' | 'chart' | 'inventory' | 'orders' | 'product' | 'permission';
|
|
1121
|
+
export declare type EmptyListIllustrationScene = 'list' | 'search' | 'complete' | 'chart' | 'inventory' | 'orders' | 'product' | 'permission' | 'purchase' | 'supplier' | 'team' | 'notification' | 'store' | 'task' | 'session' | 'activity';
|
|
1111
1122
|
|
|
1112
|
-
export declare function EmptyState({ icon, illustration, title, description, actions, headingLevel, layout, }: {
|
|
1123
|
+
export declare function EmptyState({ icon, illustration, title, titleHidden, description, actions, headingLevel, layout, }: {
|
|
1113
1124
|
icon?: ReactNode;
|
|
1114
1125
|
title: string;
|
|
1126
|
+
/** 仅视觉隐藏标题,保留原标签与可访问文本。 */
|
|
1127
|
+
titleHidden?: boolean;
|
|
1115
1128
|
} & ({
|
|
1116
1129
|
layout?: 'center';
|
|
1117
1130
|
illustration?: ReactNode;
|
|
@@ -1122,7 +1135,7 @@ export declare function EmptyState({ icon, illustration, title, description, act
|
|
|
1122
1135
|
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
1123
1136
|
} | {
|
|
1124
1137
|
layout: 'inline';
|
|
1125
|
-
illustration?:
|
|
1138
|
+
illustration?: ReactNode;
|
|
1126
1139
|
description?: never;
|
|
1127
1140
|
actions?: never;
|
|
1128
1141
|
headingLevel?: never;
|
|
@@ -1230,6 +1243,14 @@ declare type FieldShellProps = {
|
|
|
1230
1243
|
|
|
1231
1244
|
export declare type FieldSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
1232
1245
|
|
|
1246
|
+
export declare function FileInput({ name, accept, multiple, required, disabled, onChange, ref, id, className, buttonLabel, variant, size, ...rest }: FileInputProps): JSX.Element;
|
|
1247
|
+
|
|
1248
|
+
export declare type FileInputProps = Omit<ComponentPropsWithRef<'input'>, 'type' | 'value' | 'defaultValue' | 'children' | 'size'> & {
|
|
1249
|
+
buttonLabel?: ReactNode;
|
|
1250
|
+
variant?: ButtonVariant;
|
|
1251
|
+
size?: ButtonSize;
|
|
1252
|
+
};
|
|
1253
|
+
|
|
1233
1254
|
export declare function FileTree({ nodes, label, defaultExpanded, }: {
|
|
1234
1255
|
nodes: FileTreeNode[];
|
|
1235
1256
|
label?: string;
|
|
@@ -2569,6 +2590,18 @@ export declare type StatusPageProps = {
|
|
|
2569
2590
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
2570
2591
|
};
|
|
2571
2592
|
|
|
2593
|
+
export declare function Stepper({ steps, current, className, ...rest }: StepperProps): JSX.Element;
|
|
2594
|
+
|
|
2595
|
+
export declare type StepperProps = Omit<ComponentPropsWithoutRef<'ol'>, 'children'> & {
|
|
2596
|
+
steps: StepperStep[];
|
|
2597
|
+
current: number;
|
|
2598
|
+
};
|
|
2599
|
+
|
|
2600
|
+
export declare type StepperStep = {
|
|
2601
|
+
label: ReactNode;
|
|
2602
|
+
description?: ReactNode;
|
|
2603
|
+
};
|
|
2604
|
+
|
|
2572
2605
|
export declare function Switch({ options, ariaLabel, name, defaultValue, value, onChange, size, variant, fullWidth, iconOnly, }: {
|
|
2573
2606
|
options: SwitchOption[];
|
|
2574
2607
|
ariaLabel: string;
|
|
@@ -2669,16 +2702,24 @@ export declare type TableRowRenderContext<T> = {
|
|
|
2669
2702
|
rowKey: TableRowKey;
|
|
2670
2703
|
rowProps: TableHTMLAttributes<HTMLTableRowElement>;
|
|
2671
2704
|
cells: ReactNode;
|
|
2705
|
+
selectionCell: ReactNode | null;
|
|
2672
2706
|
};
|
|
2673
2707
|
|
|
2674
2708
|
export declare type TableSelection<T> = {
|
|
2675
2709
|
selectedKeys: readonly TableRowKey[];
|
|
2676
|
-
onSelectionChange: (selectedKeys: TableRowKey[]) => void;
|
|
2710
|
+
onSelectionChange: (selectedKeys: TableRowKey[], details: TableSelectionChangeDetails) => void;
|
|
2677
2711
|
getRowLabel: (row: T, rowIndex: number) => string;
|
|
2678
2712
|
getRowDisabled?: (row: T, rowIndex: number) => boolean;
|
|
2679
2713
|
selectAllLabel?: string;
|
|
2680
2714
|
};
|
|
2681
2715
|
|
|
2716
|
+
export declare type TableSelectionChangeDetails = {
|
|
2717
|
+
type: 'row' | 'page';
|
|
2718
|
+
rowKey?: TableRowKey;
|
|
2719
|
+
checked: boolean;
|
|
2720
|
+
shiftKey: boolean;
|
|
2721
|
+
};
|
|
2722
|
+
|
|
2682
2723
|
export declare type TableSortDirection = 'asc' | 'desc';
|
|
2683
2724
|
|
|
2684
2725
|
export declare function Tabs({ tabs, ariaLabel, variant, value, defaultValue, onValueChange, }: {
|