@eifi1/ui-kit 0.9.0 → 0.11.0
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/README.md +37 -23
- package/dist/components/alert-banner.d.ts +57 -5
- package/dist/components/alert-banner.js +63 -17
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +6 -0
- package/dist/components/breadcrumbs.d.ts +60 -0
- package/dist/components/breadcrumbs.js +88 -0
- package/dist/components/breadcrumbs.js.map +1 -0
- package/dist/components/bulk-action-bar.d.ts +112 -0
- package/dist/components/bulk-action-bar.js +196 -0
- package/dist/components/bulk-action-bar.js.map +1 -0
- package/dist/components/button-group.d.ts +58 -3
- package/dist/components/button-group.js +56 -5
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/calculator.d.ts +6 -0
- package/dist/components/calendar-heatmap.d.ts +124 -0
- package/dist/components/calendar-heatmap.js +295 -0
- package/dist/components/calendar-heatmap.js.map +1 -0
- package/dist/components/chip.d.ts +31 -5
- package/dist/components/chip.js +85 -5
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +34 -2
- package/dist/components/choice-card.js +49 -0
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/copy-button.d.ts +14 -4
- package/dist/components/copy-button.js +17 -4
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table.js +2 -0
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +22 -2
- package/dist/components/date-picker.js +11 -3
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/description-list.d.ts +43 -6
- package/dist/components/description-list.js +91 -11
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame.d.ts +7 -0
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/disclosure.d.ts +57 -2
- package/dist/components/disclosure.js +24 -12
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/field.d.ts +43 -0
- package/dist/components/field.js +52 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/file-button.d.ts +1 -0
- package/dist/components/file-dropzone.d.ts +4 -4
- package/dist/components/file-dropzone.js +2 -1
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/floating-panel.d.ts +147 -4
- package/dist/components/floating-panel.js +188 -28
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/full-bleed-dialog.d.ts +23 -4
- package/dist/components/full-bleed-dialog.js +11 -2
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/list.d.ts +187 -0
- package/dist/components/list.js +221 -0
- package/dist/components/list.js.map +1 -0
- package/dist/components/menu-item.d.ts +109 -0
- package/dist/components/menu-item.js +88 -0
- package/dist/components/menu-item.js.map +1 -0
- package/dist/components/mini-calendar.d.ts +70 -5
- package/dist/components/mini-calendar.js +166 -62
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +23 -1
- package/dist/components/modal.js +36 -10
- package/dist/components/modal.js.map +1 -1
- package/dist/components/nav-pills.d.ts +66 -0
- package/dist/components/nav-pills.js +65 -0
- package/dist/components/nav-pills.js.map +1 -0
- package/dist/components/number-field.d.ts +6 -0
- package/dist/components/number-input.d.ts +6 -0
- package/dist/components/numpad-sheet.d.ts +6 -0
- package/dist/components/page-contents.js +1 -2
- package/dist/components/page-contents.js.map +1 -1
- package/dist/components/page-header.d.ts +37 -0
- package/dist/components/page-header.js +36 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/progress-bar.d.ts +31 -2
- package/dist/components/progress-bar.js +73 -7
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/series-chart-labels.d.ts +3 -0
- package/dist/components/series-chart-labels.js +2 -1
- package/dist/components/series-chart-labels.js.map +1 -1
- package/dist/components/series-chart.d.ts +32 -0
- package/dist/components/series-chart.js +141 -4
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/settings-fields.d.ts +1 -0
- package/dist/components/status-dot.d.ts +53 -0
- package/dist/components/status-dot.js +57 -0
- package/dist/components/status-dot.js.map +1 -0
- package/dist/components/table.d.ts +78 -13
- package/dist/components/table.js +84 -11
- package/dist/components/table.js.map +1 -1
- package/dist/components/text.d.ts +70 -0
- package/dist/components/text.js +24 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/time-input.d.ts +1 -0
- package/dist/components/toast.d.ts +167 -0
- package/dist/components/toast.js +226 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/toggle-group.d.ts +44 -1
- package/dist/components/toggle-group.js +73 -4
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/tooltip.d.ts +46 -15
- package/dist/components/tooltip.js +87 -47
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/ui.d.ts +158 -7
- package/dist/components/ui.js +191 -10
- package/dist/components/ui.js.map +1 -1
- package/dist/components/user-avatar.d.ts +25 -3
- package/dist/components/user-avatar.js +32 -3
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/hooks/use-close-transition.d.ts +7 -1
- package/dist/hooks/use-close-transition.js +5 -2
- package/dist/hooks/use-close-transition.js.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.js +1 -1
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -1
- package/dist/hooks/use-file-drop.d.ts +1 -0
- package/dist/i18n/defaults.d.ts +6 -0
- package/dist/i18n/defaults.js +11 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +11 -0
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/de-CH-informal.d.ts +6 -0
- package/dist/i18n/locales/de-CH.d.ts +6 -0
- package/dist/i18n/locales/de-informal.d.ts +6 -0
- package/dist/i18n/locales/de.d.ts +6 -0
- package/dist/i18n/locales/de.js +30 -2
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +6 -0
- package/dist/i18n/locales/es.js +30 -2
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +6 -0
- package/dist/i18n/locales/fr.js +30 -2
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +6 -0
- package/dist/i18n/locales/hu.js +30 -2
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +6 -0
- package/dist/i18n/locales/it.js +30 -2
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +6 -0
- package/dist/i18n/locales/zh.js +30 -2
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.d.ts +27 -15
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/clipping.d.ts +25 -0
- package/dist/lib/clipping.js +17 -0
- package/dist/lib/clipping.js.map +1 -0
- package/dist/lib/dates.d.ts +17 -1
- package/dist/lib/dates.js +19 -0
- package/dist/lib/dates.js.map +1 -1
- package/dist/rhf/form.d.ts +1 -0
- package/dist/rhf/use-rhf-wizard-step.d.ts +22 -0
- package/dist/rhf/use-rhf-wizard-step.js +38 -0
- package/dist/rhf/use-rhf-wizard-step.js.map +1 -0
- package/dist/rhf.d.ts +2 -0
- package/dist/rhf.js +1 -0
- package/dist/rhf.js.map +1 -1
- package/dist/search/command-palette.d.ts +19 -2
- package/dist/search/command-palette.js +16 -5
- package/dist/search/command-palette.js.map +1 -1
- package/dist/search/global-search.d.ts +26 -1
- package/dist/search/global-search.js +29 -13
- package/dist/search/global-search.js.map +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/shell/topbar-action-menu.d.ts +73 -3
- package/dist/shell/topbar-action-menu.js +100 -27
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell.d.ts +2 -1
- package/dist/wizard/stepper-nav.d.ts +1 -0
- package/dist/wizard/stepper-nav.js +1 -1
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.d.ts +2 -2
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.js +1 -1
- package/dist/wizard/use-wizard.js.map +1 -1
- package/dist/wizard/wizard-context.d.ts +7 -1
- package/dist/wizard/wizard-context.js +4 -0
- package/dist/wizard/wizard-context.js.map +1 -1
- package/dist/wizard/wizard-summary.js +3 -3
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +2 -1
- package/package.json +16 -12
- package/src/components/alert-banner.tsx +149 -21
- package/src/components/breadcrumbs.tsx +168 -0
- package/src/components/bulk-action-bar.tsx +362 -0
- package/src/components/button-group.tsx +124 -4
- package/src/components/calendar-heatmap.tsx +504 -0
- package/src/components/chip.tsx +128 -7
- package/src/components/choice-card.tsx +97 -1
- package/src/components/copy-button.tsx +29 -7
- package/src/components/data-table.tsx +7 -0
- package/src/components/date-picker.tsx +49 -1
- package/src/components/description-list.tsx +168 -15
- package/src/components/dialog-frame.tsx +7 -0
- package/src/components/disclosure.tsx +93 -21
- package/src/components/field.tsx +137 -0
- package/src/components/file-dropzone.tsx +9 -10
- package/src/components/floating-panel.tsx +366 -15
- package/src/components/full-bleed-dialog.tsx +42 -5
- package/src/components/list.tsx +443 -0
- package/src/components/menu-item.tsx +235 -0
- package/src/components/mini-calendar.tsx +245 -54
- package/src/components/modal.tsx +80 -17
- package/src/components/nav-pills.tsx +145 -0
- package/src/components/page-contents.tsx +4 -4
- package/src/components/page-header.tsx +68 -0
- package/src/components/progress-bar.tsx +129 -11
- package/src/components/series-chart-labels.ts +4 -0
- package/src/components/series-chart.tsx +274 -3
- package/src/components/status-dot.tsx +107 -0
- package/src/components/table.tsx +176 -17
- package/src/components/text.tsx +97 -0
- package/src/components/toast.tsx +441 -0
- package/src/components/toggle-group.tsx +128 -4
- package/src/components/tooltip.tsx +200 -100
- package/src/components/ui.tsx +381 -14
- package/src/components/user-avatar.tsx +57 -3
- package/src/hooks/use-close-transition.ts +14 -5
- package/src/hooks/use-copy-to-clipboard.ts +1 -1
- package/src/i18n/defaults.ts +10 -0
- package/src/i18n/kit-labels.tsx +10 -0
- package/src/i18n/locales/de.ts +29 -0
- package/src/i18n/locales/es.ts +29 -0
- package/src/i18n/locales/fr.ts +29 -0
- package/src/i18n/locales/hu.ts +29 -0
- package/src/i18n/locales/it.ts +29 -0
- package/src/i18n/locales/zh.ts +29 -0
- package/src/index.ts +31 -0
- package/src/lib/clipping.ts +34 -0
- package/src/lib/dates.ts +37 -0
- package/src/rhf/use-rhf-wizard-step.ts +113 -0
- package/src/rhf.ts +2 -0
- package/src/search/command-palette.tsx +42 -5
- package/src/search/global-search.tsx +59 -18
- package/src/shell/topbar-action-menu.tsx +239 -49
- package/src/wizard/stepper-nav.tsx +2 -1
- package/src/wizard/types.ts +2 -2
- package/src/wizard/use-wizard.ts +3 -3
- package/src/wizard/wizard-context.tsx +9 -0
- package/src/wizard/wizard-summary.tsx +14 -10
- package/tokens.css +97 -0
package/README.md
CHANGED
|
@@ -377,24 +377,24 @@ columns, strings and permissions (see the note at the top of `src/feedback/feedb
|
|
|
377
377
|
|
|
378
378
|
<!-- BEGIN GENERATED: exports — node scripts/gen-export-inventory.mjs -->
|
|
379
379
|
|
|
380
|
-
**
|
|
380
|
+
**824 names from 134 modules** — 404 values and 420 types. _Italic_ is a type-only export.
|
|
381
381
|
|
|
382
382
|
Generated from `dist/index.d.ts` by `node scripts/gen-export-inventory.mjs`; the count
|
|
383
383
|
is pinned by `src/__tests__/public-surface.test.ts`. Do not edit between the markers.
|
|
384
384
|
|
|
385
385
|
| Entry point | Names |
|
|
386
386
|
|---|---|
|
|
387
|
-
| `@eifi1/ui-kit` |
|
|
387
|
+
| `@eifi1/ui-kit` | 824 |
|
|
388
388
|
| `@eifi1/ui-kit/chart` | 93 |
|
|
389
|
-
| `@eifi1/ui-kit/shell` |
|
|
389
|
+
| `@eifi1/ui-kit/shell` | 19 |
|
|
390
390
|
| `@eifi1/ui-kit/data-table` | 32 |
|
|
391
|
-
| `@eifi1/ui-kit/wizard` |
|
|
391
|
+
| `@eifi1/ui-kit/wizard` | 22 |
|
|
392
392
|
| `@eifi1/ui-kit/tour` | 7 |
|
|
393
393
|
| `@eifi1/ui-kit/feedback` | 29 |
|
|
394
|
-
| `@eifi1/ui-kit/search` |
|
|
395
|
-
| `@eifi1/ui-kit/dates` |
|
|
394
|
+
| `@eifi1/ui-kit/search` | 22 |
|
|
395
|
+
| `@eifi1/ui-kit/dates` | 22 |
|
|
396
396
|
| `@eifi1/ui-kit/table-text` | 8 |
|
|
397
|
-
| `@eifi1/ui-kit/rhf` |
|
|
397
|
+
| `@eifi1/ui-kit/rhf` | 15 |
|
|
398
398
|
|
|
399
399
|
Everything below is reachable from the main `@eifi1/ui-kit` barrel. The subpaths are a
|
|
400
400
|
re-slicing of it, never a second API.
|
|
@@ -406,6 +406,7 @@ re-slicing of it, never a second API.
|
|
|
406
406
|
| `lib/calc` | `commitExpression`, `evaluateExpression`, `formatResult`, `isBareAmount`, `looksLikeExpression`, `sanitizeLive`, `splitLeadingSign` |
|
|
407
407
|
| `lib/cn` | `cn` |
|
|
408
408
|
| `lib/logger` | `logger`, `setStoreLog` |
|
|
409
|
+
| `lib/clipping` | `CLIPS_ATTRIBUTE` |
|
|
409
410
|
|
|
410
411
|
### hooks
|
|
411
412
|
|
|
@@ -441,7 +442,8 @@ re-slicing of it, never a second API.
|
|
|
441
442
|
|
|
442
443
|
| Module | Exports |
|
|
443
444
|
|---|---|
|
|
444
|
-
| `components/ui` | `Button`, `buttonClasses`, `Card`, `CardAction`, `CardContent`, `CardDescription`, `CardFooter`, `CardHeader`, `CardTitle`, `DEFAULT_PASSWORD_REVEAL_LABELS`, `DEFAULT_TABS_LABELS`, `EmptyState`, `FIELD_BASE`, `FIELD_DISPLAY`, `FIELD_FLOATING_PAD`, `FIELD_INVALID`, `FIELD_TRIGGER`, `FIELD_WRITABLE_LOOK`, `FieldChevron`, `FieldHint`, `FieldLabel`, `FLOATING_INPUT_CLASS`, `FLOATING_LABEL_CLASS`, `FLOATING_LABEL_STATIC`, `FloatingField`, `IconButton`, `Input`, `Label`, `PHONE_QUERY`, `resolvePasswordRevealLabels`, `Select`, `Spinner`, `Tabs`, `Textarea`, _`ButtonClassesOptions`_, _`ButtonProps`_, _`ButtonSize`_, _`ButtonVariant`_, _`CardActionProps`_, _`CardContentProps`_, _`CardDescriptionProps`_, _`CardFooterProps`_, _`CardHeaderProps`_, _`CardProps`_, _`CardTitleProps`_, _`EmptyStateProps`_, _`FieldChevronProps`_, _`FieldHintProps`_, _`FieldLabelProps`_, _`FloatingFieldProps`_, _`IconButtonProps`_, _`IconButtonSize`_, _`InputProps`_, _`LabelProps`_, _`PasswordRevealLabels`_, _`SelectProps`_, _`SpinnerProps`_, _`TabItem`_, _`TabsLabels`_, _`TabsProps`_, _`TextareaProps`_ |
|
|
445
|
+
| `components/ui` | `Button`, `buttonClasses`, `Card`, `CardAction`, `CardContent`, `CardDescription`, `CardFooter`, `CardHeader`, `CardTitle`, `DEFAULT_PASSWORD_REVEAL_LABELS`, `DEFAULT_TABS_LABELS`, `EmptyState`, `FIELD_BASE`, `FIELD_DISPLAY`, `FIELD_FLOATING_PAD`, `FIELD_INVALID`, `FIELD_TRIGGER`, `FIELD_WRITABLE_LOOK`, `FieldChevron`, `FieldHint`, `FieldLabel`, `FLOATING_INPUT_CLASS`, `FLOATING_LABEL_CLASS`, `FLOATING_LABEL_STATIC`, `FloatingField`, `IconButton`, `Input`, `Label`, `PHONE_QUERY`, `resolvePasswordRevealLabels`, `Select`, `Spinner`, `Tabs`, `Textarea`, _`ButtonClassesOptions`_, _`ButtonProps`_, _`ButtonSize`_, _`ButtonTone`_, _`ButtonVariant`_, _`CardActionProps`_, _`CardContentProps`_, _`CardDescriptionProps`_, _`CardFooterProps`_, _`CardHeaderProps`_, _`CardProps`_, _`CardTitleProps`_, _`EmptyStateProps`_, _`FieldChevronProps`_, _`FieldHintProps`_, _`FieldLabelProps`_, _`FloatingFieldProps`_, _`IconButtonProps`_, _`IconButtonSize`_, _`IconButtonTone`_, _`InputProps`_, _`LabelProps`_, _`PasswordRevealLabels`_, _`SelectProps`_, _`SpinnerProps`_, _`TabItem`_, _`TabsLabels`_, _`TabsProps`_, _`TextareaProps`_ |
|
|
446
|
+
| `components/field` | `Field`, _`FieldControlProps`_, _`FieldProps`_ |
|
|
445
447
|
| `components/search-field` | `SearchField`, _`SearchFieldProps`_ |
|
|
446
448
|
| `components/dropdown` | `DropdownPanel`, `DropdownSearchHeader`, `useDropdown`, `useDropdownSearch`, _`DropdownPanelProps`_, _`DropdownSearchHeaderProps`_ |
|
|
447
449
|
| `components/popover` | `DEFAULT_POPOVER_LABELS`, `Popover`, _`PopoverLabels`_, _`PopoverProps`_ |
|
|
@@ -457,7 +459,7 @@ re-slicing of it, never a second API.
|
|
|
457
459
|
| `components/multi-entity-combobox` | `MultiEntityCombobox`, _`MultiEntityComboboxProps`_ |
|
|
458
460
|
| `components/multi-select` | `MultiSelect`, _`MultiSelectOption`_, _`MultiSelectProps`_ |
|
|
459
461
|
| `components/tooltip` | `placeTooltip`, `Tooltip`, _`TooltipPlacement`_, _`TooltipProps`_, _`TooltipSide`_, _`TooltipSize`_, _`TooltipViewport`_ |
|
|
460
|
-
| `components/user-avatar` | `avatarInitials`, `UserAvatar`, _`UserAvatarProps`_ |
|
|
462
|
+
| `components/user-avatar` | `avatarInitials`, `UserAvatar`, _`UserAvatarBadge`_, _`UserAvatarProps`_ |
|
|
461
463
|
| `components/settings-fields` | `LanguageSetting`, `ThemeSetting`, _`LanguageSettingProps`_, _`ThemeSettingProps`_ |
|
|
462
464
|
| `components/field-sync` | `DEFAULT_FIELD_SYNC_LABELS`, `FIELD_SYNC_FRAME`, `FIELD_SYNC_SAVED_MS`, `FieldSyncIndicator`, `FieldSyncRow`, `resolveFieldSyncLabels`, `useFieldSync`, _`FieldSyncIndicatorProps`_, _`FieldSyncLabels`_, _`FieldSyncRowProps`_, _`FieldSyncState`_, _`UseFieldSyncOptions`_, _`UseFieldSyncReturn`_ |
|
|
463
465
|
| `components/month-picker` | `DEFAULT_MONTH_PICKER_LABELS`, `MonthPicker`, _`MonthPickerLabels`_, _`MonthPickerProps`_ |
|
|
@@ -475,10 +477,11 @@ re-slicing of it, never a second API.
|
|
|
475
477
|
| `components/dialog-frame` | `DEFAULT_DIALOG_FRAME_LABELS`, `DialogFrame`, _`DialogFrameLabels`_, _`DialogFrameProps`_ |
|
|
476
478
|
| `components/danger-confirm` | `DangerConfirm`, `DEFAULT_DANGER_CONFIRM_LABELS`, _`DangerConfirmLabels`_, _`DangerConfirmProps`_ |
|
|
477
479
|
| `components/confirm-dialog` | `ConfirmProvider`, `DEFAULT_CONFIRM_DIALOG_LABELS`, `useConfirm`, _`ConfirmDialogLabels`_, _`ConfirmFn`_, _`ConfirmOptions`_, _`ConfirmProviderProps`_, _`ConfirmTone`_ |
|
|
478
|
-
| `components/floating-panel` | `DEFAULT_FLOATING_PANEL_LABELS`, `FloatingActionButton`, `FloatingPanel`, _`FloatingActionButtonProps`_, _`FloatingCorner`_, _`FloatingPanelLabels`_, _`FloatingPanelProps`_ |
|
|
480
|
+
| `components/floating-panel` | `DEFAULT_FLOATING_PANEL_LABELS`, `FloatingAction`, `FloatingActionButton`, `FloatingActionGroup`, `FloatingPanel`, _`FloatingActionButtonProps`_, _`FloatingActionGroupProps`_, _`FloatingActionLinkProps`_, _`FloatingActionProps`_, _`FloatingCorner`_, _`FloatingPanelLabels`_, _`FloatingPanelProps`_ |
|
|
481
|
+
| `components/bulk-action-bar` | `BulkActionBar`, `DEFAULT_BULK_ACTION_BAR_LABELS`, _`BulkActionBarLabels`_, _`BulkActionBarProps`_, _`BulkActionBarVariant`_, _`ResponsiveBulkActionBarVariant`_ |
|
|
479
482
|
| `components/swatch-picker` | `DEFAULT_SWATCH_PICKER_LABELS`, `SwatchPicker`, _`SwatchOption`_, _`SwatchPickerLabels`_, _`SwatchPickerProps`_ |
|
|
480
483
|
| `components/icon-picker` | `DEFAULT_ICON_PICKER_LABELS`, `IconPicker`, _`IconOption`_, _`IconPickerLabels`_, _`IconPickerProps`_ |
|
|
481
|
-
| `components/choice-card` | `ChoiceCard`, `ChoiceCardGroup`, _`ChoiceCardGroupProps`_, _`ChoiceCardMultipleProps`_, _`ChoiceCardOption`_, _`ChoiceCardProps`_, _`ChoiceCardSingleProps`_, _`ChoiceCardType`_ |
|
|
484
|
+
| `components/choice-card` | `ActionCard`, `ChoiceCard`, `ChoiceCardGroup`, _`ActionCardMetaTone`_, _`ActionCardProps`_, _`ChoiceCardGroupProps`_, _`ChoiceCardMultipleProps`_, _`ChoiceCardOption`_, _`ChoiceCardProps`_, _`ChoiceCardSingleProps`_, _`ChoiceCardType`_ |
|
|
482
485
|
| `components/autocomplete` | `Autocomplete`, _`AutocompleteProps`_ |
|
|
483
486
|
| `components/measured-grid` | `DEFAULT_MEASURED_GRID_LABELS`, `MeasuredGrid`, `useMeasuredRows`, _`MeasuredGridColumn`_, _`MeasuredGridLabels`_, _`MeasuredGridProps`_, _`MeasuredGridView`_, _`MeasuredRows`_, _`UseMeasuredRowsOptions`_ |
|
|
484
487
|
| `components/file-button` | `DEFAULT_FILE_PICKER_LABELS`, `FileButton`, `matchesAccept`, `useFilePicker`, _`FileButtonProps`_, _`FilePickerLabels`_, _`FileRejection`_, _`FileRejectionReason`_, _`FileScreenOptions`_, _`UseFilePickerOptions`_, _`UseFilePickerReturn`_ |
|
|
@@ -489,31 +492,40 @@ re-slicing of it, never a second API.
|
|
|
489
492
|
| `components/facing-pair` | `FACING_SIDES`, `facingAxes`, `facingBand`, `facingHeadingPad`, _`FacingSide`_ |
|
|
490
493
|
| `components/series-chart-labels` | `DEFAULT_SERIES_CHART_LABELS`, _`SeriesChartLabels`_ |
|
|
491
494
|
| `components/account-settings` | `PasswordSetting`, `ProfileSetting`, `TwoFactorSetting`, _`PasswordSettingLabels`_, _`ProfileSettingLabels`_, _`TwoFactorSettingLabels`_ |
|
|
492
|
-
| `components/alert-banner` | `AlertBanner`, `alertFrameClass`, `toneFrameClass`, _`AlertBannerProps`_, _`AlertTone`_ |
|
|
495
|
+
| `components/alert-banner` | `AlertBanner`, `alertFrameClass`, `toneFrameClass`, _`AlertBannerProps`_, _`AlertSize`_, _`AlertTone`_ |
|
|
493
496
|
| `components/toggle-group` | `ToggleGroup`, _`ToggleGroupBaseProps`_, _`ToggleGroupClearableProps`_, _`ToggleGroupProps`_, _`ToggleGroupRequiredProps`_, _`ToggleOption`_ |
|
|
494
|
-
| `components/
|
|
497
|
+
| `components/nav-pills` | `NavPills`, _`NavPillItem`_, _`NavPillLinkProps`_, _`NavPillsCurrent`_, _`NavPillsProps`_ |
|
|
498
|
+
| `components/chip` | `Chip`, `ChipInput`, `DEFAULT_CHIP_INPUT_LABELS`, `resolveChipInputLabels`, _`ChipHue`_, _`ChipInputLabels`_, _`ChipInputProps`_, _`ChipLinkProps`_, _`ChipProps`_, _`ChipShape`_, _`ChipSize`_, _`ChipTone`_, _`ChipVariant`_ |
|
|
495
499
|
| `components/wizard-stepper` | `WizardStepper` |
|
|
496
500
|
| `components/hover-menu` | `HoverMenu`, _`HoverMenuProps`_ |
|
|
497
501
|
| `components/modal` | `Modal`, `ModalCloseContext`, `useBackdropClose`, _`ModalProps`_ |
|
|
498
502
|
| `components/full-bleed-dialog` | `FullBleedDialog`, _`FullBleedDialogProps`_ |
|
|
499
503
|
| `components/grouped-picker` | `GroupedPicker`, _`GroupedPickerProps`_, _`PickerGroup`_ |
|
|
500
504
|
| `components/file-dropzone` | `FileDropzone`, _`FileDropzoneProps`_, _`FileDropzoneRejectionFeedback`_, _`FileDropzoneState`_ |
|
|
501
|
-
| `components/mini-calendar` | `DEFAULT_MINI_CALENDAR_LABELS`, `MiniCalendar`, _`MiniCalendarLabels`_, _`MiniCalendarProps`_, _`WeekDay`_ |
|
|
502
|
-
| `components/
|
|
505
|
+
| `components/mini-calendar` | `DEFAULT_MINI_CALENDAR_LABELS`, `MiniCalendar`, _`MiniCalendarDayState`_, _`MiniCalendarLabels`_, _`MiniCalendarProps`_, _`WeekDay`_ |
|
|
506
|
+
| `components/calendar-heatmap` | `CalendarHeatmap`, `DEFAULT_CALENDAR_HEATMAP_LABELS`, `heatmapLevel`, _`CalendarHeatmapDatum`_, _`CalendarHeatmapDay`_, _`CalendarHeatmapLabels`_, _`CalendarHeatmapProps`_ |
|
|
507
|
+
| `components/date-picker` | `DatePicker`, `DateRangePicker`, _`DatePickerProps`_, _`DateRangeCommit`_, _`DateRangeDraftSummary`_, _`DateRangePickerPreset`_, _`DateRangePickerProps`_, _`DateRangeTriggerRenderProps`_, _`DateTriggerAttributes`_ |
|
|
503
508
|
| `components/tree-view` | `TreeRow`, `TreeView`, _`TreeItemState`_, _`TreeNode`_, _`TreeRowProps`_, _`TreeViewProps`_ |
|
|
504
509
|
| `components/chart` | `ChartContainer`, `ChartLegend`, `ChartLegendContent`, `ChartTooltip`, `ChartTooltipContent`, `useChart`, _`ChartConfig`_, _`ChartSeriesConfig`_ |
|
|
505
|
-
| `components/description-list` | `DescriptionItem`, `DescriptionList`, _`DescriptionItemProps`_, _`DescriptionListDensity`_, _`DescriptionListLayout`_, _`DescriptionListProps`_ |
|
|
506
|
-
| `components/progress-bar` | `ProgressBar`, _`ProgressBarProps`_, _`ProgressBarSize`_, _`ProgressBarTone`_ |
|
|
510
|
+
| `components/description-list` | `DescriptionItem`, `DescriptionList`, _`DescriptionItemProps`_, _`DescriptionListColumns`_, _`DescriptionListDensity`_, _`DescriptionListLayout`_, _`DescriptionListProps`_ |
|
|
511
|
+
| `components/progress-bar` | `ProgressBar`, _`ProgressBarProps`_, _`ProgressBarSegment`_, _`ProgressBarSize`_, _`ProgressBarTone`_ |
|
|
507
512
|
| `components/skeleton` | `Skeleton`, _`SkeletonProps`_, _`SkeletonShape`_ |
|
|
508
513
|
| `components/copy-button` | `CopyButton`, `DEFAULT_COPY_BUTTON_LABELS`, _`CopyButtonLabels`_, _`CopyButtonProps`_ |
|
|
509
|
-
| `components/button-group` | `ButtonGroup`, _`ButtonGroupProps`_ |
|
|
510
|
-
| `components/table` | `NUMERIC_CELL_CLASS`, `Table`, `TableBody`, `TableCaption`, `TableCell`, `TableFoot`, `TableHead`, `TableHeaderCell`, `TableRow`, _`TableAlign`_, _`TableBodyProps`_, _`TableCaptionProps`_, _`TableCellProps`_, _`TableDensity`_, _`TableFootProps`_, _`TableHeaderCellProps`_, _`TableHeadProps`_, _`TableProps`_, _`TableRowProps`_ |
|
|
514
|
+
| `components/button-group` | `ButtonGroup`, `ButtonGroupLink`, _`ButtonGroupLinkProps`_, _`ButtonGroupLinkRenderProps`_, _`ButtonGroupProps`_ |
|
|
515
|
+
| `components/table` | `NUMERIC_CELL_CLASS`, `Table`, `TableBody`, `TableCaption`, `TableCell`, `TableEmpty`, `TableFoot`, `TableHead`, `TableHeaderCell`, `TableRow`, _`TableAlign`_, _`TableBodyProps`_, _`TableCaptionProps`_, _`TableCellProps`_, _`TableDensity`_, _`TableEmptyProps`_, _`TableFootProps`_, _`TableHeaderCellProps`_, _`TableHeaderCellSize`_, _`TableHeaderCellWeight`_, _`TableHeadProps`_, _`TableLayout`_, _`TableProps`_, _`TableRowProps`_, _`TableVAlign`_ |
|
|
511
516
|
| `components/separator` | `Separator`, _`SeparatorProps`_ |
|
|
512
517
|
| `components/scroll-area` | `ScrollArea`, _`ScrollAreaProps`_ |
|
|
518
|
+
| `components/list` | `DEFAULT_LIST_LABELS`, `List`, `ListItem`, _`ListDensity`_, _`ListItemLinkProps`_, _`ListItemProps`_, _`ListLabels`_, _`ListProps`_, _`ListSeparator`_ |
|
|
519
|
+
| `components/menu-item` | `MenuItem`, _`MenuItemLinkProps`_, _`MenuItemProps`_, _`MenuItemTone`_ |
|
|
520
|
+
| `components/text` | `Caption`, `CAPTION_CLASS`, `SECTION_LABEL_CLASS`, `SectionLabel`, _`CaptionProps`_, _`SectionLabelProps`_, _`SectionLabelSize`_ |
|
|
521
|
+
| `components/status-dot` | `StatusDot`, _`StatusDotProps`_, _`StatusDotSize`_, _`StatusDotTone`_ |
|
|
522
|
+
| `components/page-header` | `PageHeader`, _`PageHeaderProps`_, _`PageHeaderSize`_ |
|
|
523
|
+
| `components/breadcrumbs` | `Breadcrumbs`, `DEFAULT_BREADCRUMBS_LABELS`, _`BreadcrumbItem`_, _`BreadcrumbLinkProps`_, _`BreadcrumbsLabels`_, _`BreadcrumbsProps`_ |
|
|
524
|
+
| `components/toast` | `DEFAULT_TOAST_LABELS`, `toast`, `TOAST_ACTION_DURATION`, `Toaster`, _`ToastAction`_, _`ToasterOffset`_, _`ToasterProps`_, _`ToastId`_, _`ToastLabels`_, _`ToastOptions`_, _`ToastPosition`_, _`ToastPromiseOptions`_, _`ToastRedoOptions`_, _`ToastSwipeDirection`_, _`ToastUndoOptions`_ |
|
|
513
525
|
| `components/data-table-labels` | `DEFAULT_DATA_TABLE_LABELS`, `missingDataTableLabels`, `resolveDataTableLabels`, _`DataTableLabels`_ |
|
|
514
526
|
| `components/data-table-sort` | `decodeSorts`, `encodeSorts`, `nextSorts`, `normalizeSorts`, _`SortCycle`_, _`SortDir`_, _`SortState`_, _`SortStepOptions`_ |
|
|
515
527
|
| `components/data-table-filters` | `decodeFilterValue`, `decodeFilterValueOfType`, `defaultFilterState`, `encodeFilterValue`, `isFilterActive`, `resolveFilter`, `rowMatches`, _`ColumnFilter`_, _`FilterValue`_ |
|
|
516
|
-
| `components/data-table` | `DataTable`, _`DataTableChrome`_, _`DataTableColumn`_, _`DataTableDensity`_, _`DataTableProps`_, _`FilterState`_, _`MobileSwipeActions`_, _`ServerPagination`_ |
|
|
528
|
+
| `components/data-table` | `DataTable`, _`DataTableCellProps`_, _`DataTableChrome`_, _`DataTableColumn`_, _`DataTableDensity`_, _`DataTableHeadProps`_, _`DataTableProps`_, _`FilterState`_, _`MobileSwipeActions`_, _`ServerPagination`_ |
|
|
517
529
|
| `components/data-table-pagination` | `PAGE_SIZE_OPTIONS`, `Pagination` |
|
|
518
530
|
| `components/data-table-filter-popover` | `FilterPopover` |
|
|
519
531
|
| `components/combobox-core` | _`ComboClearValue`_, _`ComboOption`_ |
|
|
@@ -528,7 +540,7 @@ re-slicing of it, never a second API.
|
|
|
528
540
|
| `shell/app-shell` | `AppShell`, _`AppShellNavItem`_, _`AppShellProps`_, _`AppShellSubItem`_ |
|
|
529
541
|
| `shell/option-switcher-menu` | `OptionSwitcherMenu`, _`OptionSwitcherOption`_ |
|
|
530
542
|
| `shell/role-switcher` | `RoleSwitcher`, _`RoleSwitcherProps`_ |
|
|
531
|
-
| `shell/topbar-action-menu` | `TopBarActionMenu`, _`TopBarMenuEntry`_ |
|
|
543
|
+
| `shell/topbar-action-menu` | `TopBarActionMenu`, _`TopBarMenuEntry`_, _`TopBarMenuHeader`_ |
|
|
532
544
|
|
|
533
545
|
### feedback
|
|
534
546
|
|
|
@@ -544,7 +556,7 @@ re-slicing of it, never a second API.
|
|
|
544
556
|
|---|---|
|
|
545
557
|
| `wizard/types` | `DEFAULT_WIZARD_LABELS`, `resolveWizardLabels`, _`FieldErrors`_, _`StepStatus`_, _`SummaryItem`_, _`SummarySection`_, _`UseWizardOptions`_, _`UseWizardReturn`_, _`ValidateResult`_, _`WizardLabels`_, _`WizardStepConfig`_, _`WizardUrlSync`_ |
|
|
546
558
|
| `wizard/use-wizard` | `useWizard` |
|
|
547
|
-
| `wizard/wizard-context` | `useWizardContext`, `WizardContextProvider`, _`WizardContextValue`_ |
|
|
559
|
+
| `wizard/wizard-context` | `useOptionalWizardContext`, `useWizardContext`, `WizardContextProvider`, _`WizardContextValue`_ |
|
|
548
560
|
| `wizard/validation` | `requiredFieldsValidator`, _`RequiredFieldSpec`_ |
|
|
549
561
|
| `wizard/wizard-step` | `WizardStep` |
|
|
550
562
|
| `wizard/wizard-summary` | `WizardSummary` |
|
|
@@ -560,7 +572,9 @@ re-slicing of it, never a second API.
|
|
|
560
572
|
|
|
561
573
|
| Module | Exports |
|
|
562
574
|
|---|---|
|
|
563
|
-
| `search/command-palette` | `CommandPalette`, `DEFAULT_COMMAND_PALETTE_LABELS`, `useCommandKey`, _`CommandItem`_, _`CommandPaletteLabels`_ |
|
|
575
|
+
| `search/command-palette` | `CommandPalette`, `DEFAULT_COMMAND_PALETTE_LABELS`, `useCommandKey`, _`CommandItem`_, _`CommandPaletteDensity`_, _`CommandPaletteLabels`_ |
|
|
576
|
+
| `search/search-index` | `createSearchIndex`, `matchEntries`, `normalizeSearchText`, `SEARCH_TIER_POINTS`, _`SearchEntry`_, _`SearchHit`_, _`SearchIndex`_, _`SearchIndexOptions`_, _`SearchMatchField`_ |
|
|
577
|
+
| `search/global-search` | `DEFAULT_GLOBAL_SEARCH_LABELS`, `GlobalSearch`, _`GlobalSearchLabels`_, _`GlobalSearchProps`_, _`GlobalSearchSource`_, _`GlobalSearchSuggestion`_, _`GlobalSearchTriggerProps`_ |
|
|
564
578
|
|
|
565
579
|
### i18n
|
|
566
580
|
|
|
@@ -4,7 +4,12 @@ import { ComponentPropsWithoutRef, ReactNode, MouseEvent } from 'react';
|
|
|
4
4
|
/** `info` (0.8.0) is the sky family, for news that is neither good nor bad: keksdose's
|
|
5
5
|
* preview and beta-performance banners, which borrowed `warning` for want of it and
|
|
6
6
|
* so told every user of the preview build that something was wrong. */
|
|
7
|
-
type AlertTone = "danger" | "warning" | "info" | "neutral";
|
|
7
|
+
type AlertTone = "danger" | "warning" | "info" | "success" | "neutral";
|
|
8
|
+
/** `sm` (0.10.0): 12px type and a 14px glyph — the hint line under a field or a total
|
|
9
|
+
* that keksdose spells `text-xs text-amber-700 dark:text-amber-400` by hand
|
|
10
|
+
* (accounts-page's missing-rate note, import-map-step, guest-key-control's two
|
|
11
|
+
* key states, goal-form). At body size those read as a second heading. */
|
|
12
|
+
type AlertSize = "sm" | "md";
|
|
8
13
|
/** The tone's border + surface on their own — for a caller that already has a box
|
|
9
14
|
* with its own radius and padding (e.g. a Card). Remember to shave 1px off that
|
|
10
15
|
* padding for the colored tones, whose border is 2px wide. */
|
|
@@ -12,7 +17,7 @@ declare function toneFrameClass(tone: AlertTone): string;
|
|
|
12
17
|
/** Single source for the warning-callout frame (feedback #277): the tone's border
|
|
13
18
|
* and surface plus this component's own radius and padding, the latter
|
|
14
19
|
* compensating the 2px colored border so toggling tones never shifts layout. */
|
|
15
|
-
declare function alertFrameClass(tone: AlertTone): string;
|
|
20
|
+
declare function alertFrameClass(tone: AlertTone, size?: AlertSize): string;
|
|
16
21
|
interface AlertBannerBaseProps extends Omit<ComponentPropsWithoutRef<"div">, "onClick"> {
|
|
17
22
|
/** Default `danger`. `info` for news, `neutral` for a plain note — see
|
|
18
23
|
* {@link TONE_GLYPH} for why a neutral banner is now allowed. */
|
|
@@ -30,8 +35,55 @@ interface AlertBannerBaseProps extends Omit<ComponentPropsWithoutRef<"div">, "on
|
|
|
30
35
|
* otherwise never hears. The box stays role-less as it always was: it is usually
|
|
31
36
|
* page furniture present at load, and an alert that fires on every navigation is
|
|
32
37
|
* noise. Either way a `role` you pass wins.
|
|
38
|
+
*
|
|
39
|
+
* `strip` (0.10.0): a band across the top of a page or a panel — edge to edge, no
|
|
40
|
+
* radius, only a bottom border, content centred on one line, and usually an
|
|
41
|
+
* {@link action}. kastlan's billing trial-banner and past-due-banner and its tours
|
|
42
|
+
* tour-banner each built this by hand in amber or red Tailwind classes, with a
|
|
43
|
+
* separate dark: spelling apiece. Role-less like the box: it is page furniture.
|
|
44
|
+
*/
|
|
45
|
+
variant?: "box" | "inline" | "strip";
|
|
46
|
+
/** See {@link AlertSize}. Default `md`. */
|
|
47
|
+
size?: AlertSize;
|
|
48
|
+
/**
|
|
49
|
+
* `inline` only (0.11.0): lay the message out as a BLOCK — a full-width `flex` row,
|
|
50
|
+
* the glyph on the text's FIRST line when it wraps — instead of the `inline-flex`,
|
|
51
|
+
* centred line it is by default. keksdose writes `className="flex"` on nearly every
|
|
52
|
+
* inline banner it has (accounts-page:564, holdings-panel:631, import-map-step:66/314,
|
|
53
|
+
* guest-key-control:84) to get a line of its own under a total or a field, and a
|
|
54
|
+
* two-line hint there then centres its glyph between the lines.
|
|
55
|
+
*
|
|
56
|
+
* An option rather than the new default, because the inline-flex is load-bearing for
|
|
57
|
+
* the callers the variant was made for: lenkbank's corner-motion toolbar
|
|
58
|
+
* (corner-motion.tsx:178) sets it as a `shrink-0` item beside the controls, kastlan's
|
|
59
|
+
* import page and keksdose's rules page place it in a run of content — a block would
|
|
60
|
+
* take the whole row in the second kind, and top-align the first against a taller
|
|
61
|
+
* control. Ignored by `box` and `strip`, which are blocks already.
|
|
62
|
+
*/
|
|
63
|
+
block?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* `false` opts an inline banner out of its live region (no `role="alert"` /
|
|
66
|
+
* `role="status"`), for a message that is static page content rather than the answer
|
|
67
|
+
* to something the user just did: keksdose's CAMT review step (camt-review-step:214)
|
|
68
|
+
* renders "unresolved rows block the import" as part of the step, and as
|
|
69
|
+
* `role="alert"` a screen reader interrupted with it on every mount. A `role` you pass
|
|
70
|
+
* still wins. Default `true`; the box and the strip are role-less either way.
|
|
71
|
+
*/
|
|
72
|
+
live?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* An opaque, raised surface (a shadow, and no translucency in dark mode) for a
|
|
75
|
+
* notice that floats over the page — see {@link TONE_ELEVATED}. `box` and `strip`
|
|
76
|
+
* only; an inline message has no surface to raise.
|
|
77
|
+
*/
|
|
78
|
+
elevated?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* A trailing control — the "Update payment method" button on kastlan's trial and
|
|
81
|
+
* past-due strips, the "Exit" on its tour strip. Sits at the end of the row,
|
|
82
|
+
* vertically centred, and never shrinks. On a whole-row banner (`href`/`onClick`)
|
|
83
|
+
* it is rendered BESIDE the row's own link or button, as the × is, because
|
|
84
|
+
* interactive content may not nest.
|
|
33
85
|
*/
|
|
34
|
-
|
|
86
|
+
action?: ReactNode;
|
|
35
87
|
/** Replaces the tone's glyph — a `<Spinner label={null} />` for "Solving…", say.
|
|
36
88
|
* `null` draws none. Always decorative; the text carries the message. */
|
|
37
89
|
icon?: ReactNode;
|
|
@@ -68,6 +120,6 @@ type AlertBannerProps = AlertBannerBaseProps & ({
|
|
|
68
120
|
});
|
|
69
121
|
/** Warning/danger/info callout box with the shared frame and an icon — or, with
|
|
70
122
|
* `variant="inline"`, the same message as a frameless line of toned text. */
|
|
71
|
-
declare function AlertBanner({ tone, variant, icon, onDismiss, dismissLabel, href, onClick, className, children, role, ...rest }: AlertBannerProps): react.JSX.Element;
|
|
123
|
+
declare function AlertBanner({ tone, variant, size, block, live, elevated, action, icon, onDismiss, dismissLabel, href, onClick, className, children, role, ...rest }: AlertBannerProps): react.JSX.Element;
|
|
72
124
|
|
|
73
|
-
export { AlertBanner, type AlertBannerProps, type AlertTone, alertFrameClass, toneFrameClass };
|
|
125
|
+
export { AlertBanner, type AlertBannerProps, type AlertSize, type AlertTone, alertFrameClass, toneFrameClass };
|
|
@@ -1,42 +1,66 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { AlertTriangle, ChevronRight, Info, X } from "lucide-react";
|
|
3
|
+
import { AlertTriangle, CheckCircle2, ChevronRight, Info, X } from "lucide-react";
|
|
4
4
|
import { cn } from "../lib/cn.js";
|
|
5
5
|
import { DEFAULT_COMMON_LABELS, useKitLabels } from "../i18n/kit-labels.js";
|
|
6
6
|
const TONE_FRAME = {
|
|
7
7
|
danger: "border-2 border-[var(--danger-border)] bg-[var(--danger-bg)]",
|
|
8
8
|
warning: "border-2 border-[var(--warning-border)] bg-[var(--warning-bg)]",
|
|
9
9
|
info: "border-2 border-[var(--info-border)] bg-[var(--info-bg)]",
|
|
10
|
+
success: "border-2 border-[var(--success-border)] bg-[var(--success-bg)]",
|
|
10
11
|
neutral: "border border-[var(--border)]"
|
|
11
12
|
};
|
|
13
|
+
const TONE_ELEVATED = {
|
|
14
|
+
danger: "bg-[image:linear-gradient(var(--danger-bg),var(--danger-bg))]",
|
|
15
|
+
warning: "bg-[image:linear-gradient(var(--warning-bg),var(--warning-bg))]",
|
|
16
|
+
info: "bg-[image:linear-gradient(var(--info-bg),var(--info-bg))]",
|
|
17
|
+
success: "bg-[image:linear-gradient(var(--success-bg),var(--success-bg))]",
|
|
18
|
+
neutral: ""
|
|
19
|
+
};
|
|
20
|
+
const ELEVATED = "bg-[var(--bg-surface)] shadow-lg";
|
|
12
21
|
function toneFrameClass(tone) {
|
|
13
22
|
return TONE_FRAME[tone];
|
|
14
23
|
}
|
|
15
|
-
function alertFrameClass(tone) {
|
|
16
|
-
const box = tone === "neutral" ? "rounded-md p-3" : "rounded-md p-[11px]";
|
|
24
|
+
function alertFrameClass(tone, size = "md") {
|
|
25
|
+
const box = size === "sm" ? tone === "neutral" ? "rounded-md px-2.5 py-1.5" : "rounded-md px-[9px] py-[5px]" : tone === "neutral" ? "rounded-md p-3" : "rounded-md p-[11px]";
|
|
17
26
|
return `${box} ${TONE_FRAME[tone]}`;
|
|
18
27
|
}
|
|
28
|
+
function stripFrameClass(tone, size) {
|
|
29
|
+
return cn(
|
|
30
|
+
TONE_FRAME[tone],
|
|
31
|
+
"rounded-none border-0 border-b",
|
|
32
|
+
size === "sm" ? "px-4 py-1.5" : "px-4 py-2"
|
|
33
|
+
);
|
|
34
|
+
}
|
|
19
35
|
const TONE_TEXT = {
|
|
20
36
|
danger: "text-[var(--danger)]",
|
|
21
37
|
warning: "text-[var(--warning)]",
|
|
22
38
|
info: "text-[var(--info)]",
|
|
39
|
+
success: "text-[var(--success)]",
|
|
23
40
|
neutral: "text-[var(--text-secondary)]"
|
|
24
41
|
};
|
|
25
42
|
const TONE_ICON = {
|
|
26
43
|
danger: "text-[var(--danger)]",
|
|
27
44
|
warning: "text-[var(--warning)]",
|
|
28
45
|
info: "text-[var(--info)]",
|
|
46
|
+
success: "text-[var(--success)]",
|
|
29
47
|
neutral: "text-[var(--text-muted)]"
|
|
30
48
|
};
|
|
31
49
|
const TONE_GLYPH = {
|
|
32
50
|
danger: AlertTriangle,
|
|
33
51
|
warning: AlertTriangle,
|
|
34
52
|
info: Info,
|
|
53
|
+
success: CheckCircle2,
|
|
35
54
|
neutral: Info
|
|
36
55
|
};
|
|
37
56
|
function AlertBanner({
|
|
38
57
|
tone = "danger",
|
|
39
58
|
variant = "box",
|
|
59
|
+
size = "md",
|
|
60
|
+
block = false,
|
|
61
|
+
live = true,
|
|
62
|
+
elevated = false,
|
|
63
|
+
action,
|
|
40
64
|
icon,
|
|
41
65
|
onDismiss,
|
|
42
66
|
dismissLabel,
|
|
@@ -49,21 +73,38 @@ function AlertBanner({
|
|
|
49
73
|
}) {
|
|
50
74
|
const common = useKitLabels("common", DEFAULT_COMMON_LABELS, { dismiss: dismissLabel });
|
|
51
75
|
const inline = variant === "inline";
|
|
76
|
+
const strip = variant === "strip";
|
|
77
|
+
const sm = size === "sm";
|
|
52
78
|
const interactive = href !== void 0 || onClick !== void 0;
|
|
53
|
-
const
|
|
79
|
+
const inlineRow = inline && !block;
|
|
80
|
+
const resolvedRole = role ?? (inline && live ? tone === "danger" ? "alert" : "status" : void 0);
|
|
54
81
|
const Glyph = TONE_GLYPH[tone];
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
82
|
+
const nudge = inlineRow || strip ? void 0 : sm ? "mt-px" : "mt-0.5";
|
|
83
|
+
const glyph = icon === null ? null : icon !== void 0 ? /* @__PURE__ */ jsx(
|
|
84
|
+
"span",
|
|
85
|
+
{
|
|
86
|
+
"aria-hidden": true,
|
|
87
|
+
className: cn("flex shrink-0", sm ? "[&_svg]:size-3.5" : "[&_svg]:size-4", nudge, TONE_ICON[tone]),
|
|
88
|
+
children: icon
|
|
89
|
+
}
|
|
90
|
+
) : /* @__PURE__ */ jsx(Glyph, { "aria-hidden": true, className: cn(sm ? "size-3.5" : "size-4", "shrink-0", nudge, TONE_ICON[tone]) });
|
|
91
|
+
const row = cn(
|
|
92
|
+
inlineRow ? "inline-flex items-center" : strip ? "flex flex-wrap items-center gap-y-1" : "flex items-start",
|
|
93
|
+
sm ? "gap-1.5 text-xs" : inline ? "gap-1.5 text-sm" : "gap-2 text-sm"
|
|
94
|
+
);
|
|
95
|
+
const frame = inline ? "" : cn(
|
|
96
|
+
strip ? stripFrameClass(tone, size) : alertFrameClass(tone, size),
|
|
97
|
+
elevated && cn(ELEVATED, TONE_ELEVATED[tone])
|
|
98
|
+
);
|
|
58
99
|
const focusRing = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--bg-surface)]";
|
|
59
100
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
101
|
glyph,
|
|
61
|
-
/* @__PURE__ */ jsx("span", { className: cn(!
|
|
102
|
+
/* @__PURE__ */ jsx("span", { className: cn(!inlineRow && "flex-1", "min-w-0 text-start"), children }),
|
|
62
103
|
interactive && /* @__PURE__ */ jsx(
|
|
63
104
|
ChevronRight,
|
|
64
105
|
{
|
|
65
106
|
"aria-hidden": true,
|
|
66
|
-
className: cn("size-4 shrink-0 opacity-70 rtl:-scale-x-100",
|
|
107
|
+
className: cn(sm ? "size-3.5" : "size-4", "shrink-0 opacity-70 rtl:-scale-x-100", nudge)
|
|
67
108
|
}
|
|
68
109
|
)
|
|
69
110
|
] });
|
|
@@ -86,6 +127,7 @@ function AlertBanner({
|
|
|
86
127
|
children: /* @__PURE__ */ jsx(X, { "aria-hidden": true, className: "size-4" })
|
|
87
128
|
}
|
|
88
129
|
) : null;
|
|
130
|
+
const trailing = action !== void 0 && action !== null ? /* @__PURE__ */ jsx("div", { className: cn("relative z-10 flex shrink-0 items-center gap-2", !strip && !inlineRow && "self-center", strip && "ms-auto"), children: action }) : null;
|
|
89
131
|
if (!interactive) {
|
|
90
132
|
return /* @__PURE__ */ jsxs(
|
|
91
133
|
"div",
|
|
@@ -95,21 +137,24 @@ function AlertBanner({
|
|
|
95
137
|
className: cn(row, frame, TONE_TEXT[tone], className),
|
|
96
138
|
children: [
|
|
97
139
|
content,
|
|
140
|
+
trailing,
|
|
98
141
|
dismiss
|
|
99
142
|
]
|
|
100
143
|
}
|
|
101
144
|
);
|
|
102
145
|
}
|
|
103
146
|
const hover = "cursor-pointer transition-[filter] hover:brightness-[0.97] dark:hover:brightness-110";
|
|
104
|
-
const split = dismiss !== null;
|
|
147
|
+
const split = dismiss !== null || trailing !== null;
|
|
105
148
|
const actionClass = split ? cn(
|
|
106
|
-
"flex min-w-0 flex-1
|
|
107
|
-
|
|
108
|
-
|
|
149
|
+
"flex min-w-0 flex-1 text-start",
|
|
150
|
+
sm ? "gap-1.5" : "gap-2",
|
|
151
|
+
inlineRow || strip ? "items-center" : "items-start",
|
|
152
|
+
"outline-none after:absolute after:inset-0 after:content-['']",
|
|
153
|
+
strip ? "after:rounded-none" : "after:rounded-md",
|
|
109
154
|
"focus-visible:after:ring-2 focus-visible:after:ring-[var(--brand)]"
|
|
110
|
-
) : cn(row, !
|
|
155
|
+
) : cn(row, !inlineRow && "w-full", frame, TONE_TEXT[tone], hover, focusRing, className);
|
|
111
156
|
const actionRest = split ? {} : rest;
|
|
112
|
-
const
|
|
157
|
+
const rowAction = href !== void 0 ? /* @__PURE__ */ jsx(
|
|
113
158
|
"a",
|
|
114
159
|
{
|
|
115
160
|
...actionRest,
|
|
@@ -127,7 +172,7 @@ function AlertBanner({
|
|
|
127
172
|
children: content
|
|
128
173
|
}
|
|
129
174
|
);
|
|
130
|
-
if (!split) return
|
|
175
|
+
if (!split) return rowAction;
|
|
131
176
|
return /* @__PURE__ */ jsxs(
|
|
132
177
|
"div",
|
|
133
178
|
{
|
|
@@ -135,7 +180,8 @@ function AlertBanner({
|
|
|
135
180
|
role: resolvedRole,
|
|
136
181
|
className: cn("relative", row, frame, TONE_TEXT[tone], hover, className),
|
|
137
182
|
children: [
|
|
138
|
-
|
|
183
|
+
rowAction,
|
|
184
|
+
trailing,
|
|
139
185
|
dismiss
|
|
140
186
|
]
|
|
141
187
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/alert-banner.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, MouseEvent, ReactNode } from \"react\";\nimport { AlertTriangle, ChevronRight, Info, X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\n\n/** `info` (0.8.0) is the sky family, for news that is neither good nor bad: keksdose's\n * preview and beta-performance banners, which borrowed `warning` for want of it and\n * so told every user of the preview build that something was wrong. */\nexport type AlertTone = \"danger\" | \"warning\" | \"info\" | \"neutral\";\n\n/** Border + surface per tone, WITHOUT a radius or padding, so a caller that owns\n * its own box (a Card, say) can take the tone alone. Single source for both\n * {@link alertFrameClass} and {@link toneFrameClass}.\n *\n * The colored tones are 2px, not 1px, and that is load-bearing rather than\n * decorative. A 1px border is 1.25 device pixels on a 125%-scaled display — the\n * usual Windows setting — so whether it renders as a solid line or as two\n * half-lit pixels depends on where the box happens to land in device-pixel space.\n * The same card then shows a heavy left edge and a right edge that fades out,\n * which is what feedback #264, #277, #491 and #498 all reported. A 2px border is\n * 2.5 device pixels: it always covers at least two pixels fully, on both edges,\n * at any offset. Callers compensate the extra pixel in their own padding so\n * switching tones never shifts the layout. */\nconst TONE_FRAME: Record<AlertTone, string> = {\n danger: \"border-2 border-[var(--danger-border)] bg-[var(--danger-bg)]\",\n warning: \"border-2 border-[var(--warning-border)] bg-[var(--warning-bg)]\",\n info: \"border-2 border-[var(--info-border)] bg-[var(--info-bg)]\",\n neutral: \"border border-[var(--border)]\",\n};\n\n/** The tone's border + surface on their own — for a caller that already has a box\n * with its own radius and padding (e.g. a Card). Remember to shave 1px off that\n * padding for the colored tones, whose border is 2px wide. */\nexport function toneFrameClass(tone: AlertTone): string {\n return TONE_FRAME[tone];\n}\n\n/** Single source for the warning-callout frame (feedback #277): the tone's border\n * and surface plus this component's own radius and padding, the latter\n * compensating the 2px colored border so toggling tones never shifts layout. */\nexport function alertFrameClass(tone: AlertTone): string {\n const box = tone === \"neutral\" ? \"rounded-md p-3\" : \"rounded-md p-[11px]\";\n return `${box} ${TONE_FRAME[tone]}`;\n}\n\nconst TONE_TEXT: Record<AlertTone, string> = {\n danger: \"text-[var(--danger)]\",\n warning: \"text-[var(--warning)]\",\n info: \"text-[var(--info)]\",\n neutral: \"text-[var(--text-secondary)]\",\n};\n\nconst TONE_ICON: Record<AlertTone, string> = {\n danger: \"text-[var(--danger)]\",\n warning: \"text-[var(--warning)]\",\n info: \"text-[var(--info)]\",\n neutral: \"text-[var(--text-muted)]\",\n};\n\n/** Which glyph a tone draws when the caller names none. The triangle belongs to the\n * two tones that mean \"something is wrong\"; `info` and `neutral` get the ⓘ. That is\n * what makes `neutral` safe to offer at all: until 0.8.0 it was withheld because a\n * triangle with no colour is a warning that looks like a note — and a neutral note\n * that draws no triangle is simply a note (lenkbank's \"values are rounded\"). */\nconst TONE_GLYPH: Record<AlertTone, typeof AlertTriangle> = {\n danger: AlertTriangle,\n warning: AlertTriangle,\n info: Info,\n neutral: Info,\n};\n\ninterface AlertBannerBaseProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onClick\"> {\n /** Default `danger`. `info` for news, `neutral` for a plain note — see\n * {@link TONE_GLYPH} for why a neutral banner is now allowed. */\n tone?: AlertTone;\n /**\n * `box` (default): the framed callout. `inline`: the tone's colour, glyph and role\n * and NOTHING else — no border, no surface, no padding — so it fits inside a\n * toolbar row beside the controls it is about. Lenkbank's corner-motion toolbar\n * shows \"Radius below the minimum\" and \"Solving…\" there; a box would have doubled\n * the row's height every time either appeared.\n *\n * The inline variant is also a LIVE REGION by default — `role=\"alert\"` for\n * `danger`, `role=\"status\"` for the rest — because a message that appears in a\n * toolbar in answer to what the user just did is exactly the kind a screen reader\n * otherwise never hears. The box stays role-less as it always was: it is usually\n * page furniture present at load, and an alert that fires on every navigation is\n * noise. Either way a `role` you pass wins.\n */\n variant?: \"box\" | \"inline\";\n /** Replaces the tone's glyph — a `<Spinner label={null} />` for \"Solving…\", say.\n * `null` draws none. Always decorative; the text carries the message. */\n icon?: ReactNode;\n /** Renders an × at the end that calls this. The banner does not hide itself — the\n * caller removes it (and remembers that it did), as with every other kit control\n * whose state is app state. */\n onDismiss?: () => void;\n /** Accessible name of the ×. Default: `common.dismiss` from the\n * {@link UiKitProvider}, else \"Dismiss\". */\n dismissLabel?: string;\n children: ReactNode;\n}\n\n/**\n * The whole-row modes. keksdose's budget-summary card is a banner you tap to open\n * the budget; built from a `<div onClick>` it was a mouse-only target, and built as a\n * banner with a link inside it was a small target inside a big one that looked like\n * one. So `onClick` makes the banner itself ONE `<button>`, and `href` makes it one\n * `<a>`, with a trailing chevron that says so. Mutually exclusive, as on `Chip`.\n *\n * With `onDismiss` as well, the × cannot go inside the button (interactive content\n * may not nest), so the frame becomes a wrapper holding two siblings: the row's\n * button, stretched over the whole frame, and the × on top of it. It still looks and\n * clicks like one banner with an × in its corner, and the two are separate tab stops.\n */\nexport type AlertBannerProps = AlertBannerBaseProps &\n (\n | {\n /** Makes the whole banner one link. Mutually exclusive with `onClick`. */\n href?: string;\n onClick?: never;\n }\n | {\n href?: never;\n /** Makes the whole banner one button. Mutually exclusive with `href`. The\n * event's element is the `<button>`, not a `<div>`. */\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n }\n );\n\n/** Warning/danger/info callout box with the shared frame and an icon — or, with\n * `variant=\"inline\"`, the same message as a frameless line of toned text. */\nexport function AlertBanner({\n tone = \"danger\",\n variant = \"box\",\n icon,\n onDismiss,\n dismissLabel,\n href,\n onClick,\n className,\n children,\n role,\n ...rest\n}: AlertBannerProps) {\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS, { dismiss: dismissLabel });\n const inline = variant === \"inline\";\n const interactive = href !== undefined || onClick !== undefined;\n const resolvedRole = role ?? (inline ? (tone === \"danger\" ? \"alert\" : \"status\") : undefined);\n\n const Glyph = TONE_GLYPH[tone];\n const glyph =\n icon === null ? null : icon !== undefined ? (\n <span aria-hidden className={cn(\"flex shrink-0 [&_svg]:size-4\", !inline && \"mt-0.5\", TONE_ICON[tone])}>\n {icon}\n </span>\n ) : (\n <Glyph aria-hidden className={cn(\"size-4 shrink-0\", !inline && \"mt-0.5\", TONE_ICON[tone])} />\n );\n\n // The row layout, shared by every shape below.\n const row = inline ? \"inline-flex items-center gap-1.5 text-sm\" : \"flex items-start gap-2 text-sm\";\n const frame = inline ? \"\" : alertFrameClass(tone);\n const focusRing =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--bg-surface)]\";\n\n const content = (\n <>\n {glyph}\n <span className={cn(!inline && \"flex-1\", \"min-w-0 text-start\")}>{children}</span>\n {interactive && (\n <ChevronRight\n aria-hidden\n className={cn(\"size-4 shrink-0 opacity-70 rtl:-scale-x-100\", !inline && \"mt-0.5\")}\n />\n )}\n </>\n );\n\n const dismiss = onDismiss ? (\n <button\n type=\"button\"\n aria-label={common.dismiss}\n onClick={(e) => {\n // A dismiss inside a whole-row banner must not also follow the row.\n e.preventDefault();\n e.stopPropagation();\n onDismiss();\n }}\n className={cn(\n // Negative margins so the × does not make the box taller than its text; the\n // hover wash takes the tone's own hue, so it works on every tone.\n \"relative z-10 -my-0.5 -me-0.5 flex size-6 shrink-0 items-center justify-center rounded transition-colors hover:bg-current/10\",\n focusRing,\n )}\n >\n <X aria-hidden className=\"size-4\" />\n </button>\n ) : null;\n\n if (!interactive) {\n return (\n <div\n // Arbitrary attributes first — a `data-tour` anchor, a test id, an\n // `aria-describedby` — then the layout and tone classes, which are merged\n // through `cn` rather than spread so a caller's `className` refines the box\n // instead of replacing it.\n {...rest}\n role={resolvedRole}\n className={cn(row, frame, TONE_TEXT[tone], className)}\n >\n {content}\n {dismiss}\n </div>\n );\n }\n\n const hover = \"cursor-pointer transition-[filter] hover:brightness-[0.97] dark:hover:brightness-110\";\n // With a dismiss the frame is a wrapper and the row element is stretched over it;\n // without one the row element IS the frame.\n const split = dismiss !== null;\n const actionClass = split\n ? cn(\n \"flex min-w-0 flex-1 gap-2 text-start\",\n inline ? \"items-center\" : \"items-start\",\n \"outline-none after:absolute after:inset-0 after:rounded-md after:content-['']\",\n \"focus-visible:after:ring-2 focus-visible:after:ring-[var(--brand)]\",\n )\n : cn(row, !inline && \"w-full\", frame, TONE_TEXT[tone], hover, focusRing, className);\n // The div's attributes are the row element's: an `id`, a test id or an\n // `aria-describedby` belongs on the thing that takes focus. The live-region role is\n // NOT carried over — a button or a link that is also a `status` is neither.\n const actionRest = split ? {} : rest;\n\n const action =\n href !== undefined ? (\n <a\n {...(actionRest as ComponentPropsWithoutRef<\"a\">)}\n href={href}\n className={actionClass}\n >\n {content}\n </a>\n ) : (\n <button\n {...(actionRest as ComponentPropsWithoutRef<\"button\">)}\n type=\"button\"\n onClick={onClick}\n className={actionClass}\n >\n {content}\n </button>\n );\n\n if (!split) return action;\n return (\n <div\n {...rest}\n role={resolvedRole}\n className={cn(\"relative\", row, frame, TONE_TEXT[tone], hover, className)}\n >\n {action}\n {dismiss}\n </div>\n );\n}\n"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/alert-banner.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, MouseEvent, ReactNode } from \"react\";\nimport { AlertTriangle, CheckCircle2, ChevronRight, Info, X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\n\n/** `info` (0.8.0) is the sky family, for news that is neither good nor bad: keksdose's\n * preview and beta-performance banners, which borrowed `warning` for want of it and\n * so told every user of the preview build that something was wrong. */\nexport type AlertTone = \"danger\" | \"warning\" | \"info\" | \"success\" | \"neutral\";\n\n/** `sm` (0.10.0): 12px type and a 14px glyph — the hint line under a field or a total\n * that keksdose spells `text-xs text-amber-700 dark:text-amber-400` by hand\n * (accounts-page's missing-rate note, import-map-step, guest-key-control's two\n * key states, goal-form). At body size those read as a second heading. */\nexport type AlertSize = \"sm\" | \"md\";\n\n/** Border + surface per tone, WITHOUT a radius or padding, so a caller that owns\n * its own box (a Card, say) can take the tone alone. Single source for both\n * {@link alertFrameClass} and {@link toneFrameClass}.\n *\n * The colored tones are 2px, not 1px, and that is load-bearing rather than\n * decorative. A 1px border is 1.25 device pixels on a 125%-scaled display — the\n * usual Windows setting — so whether it renders as a solid line or as two\n * half-lit pixels depends on where the box happens to land in device-pixel space.\n * The same card then shows a heavy left edge and a right edge that fades out,\n * which is what feedback #264, #277, #491 and #498 all reported. A 2px border is\n * 2.5 device pixels: it always covers at least two pixels fully, on both edges,\n * at any offset. Callers compensate the extra pixel in their own padding so\n * switching tones never shifts the layout. */\nconst TONE_FRAME: Record<AlertTone, string> = {\n danger: \"border-2 border-[var(--danger-border)] bg-[var(--danger-bg)]\",\n warning: \"border-2 border-[var(--warning-border)] bg-[var(--warning-bg)]\",\n info: \"border-2 border-[var(--info-border)] bg-[var(--info-bg)]\",\n success: \"border-2 border-[var(--success-border)] bg-[var(--success-bg)]\",\n neutral: \"border border-[var(--border)]\",\n};\n\n/** `elevated`: the same frame on an OPAQUE surface. The dark tone washes are\n * translucent (a 20–25 % tint), which is right on a page and wrong on anything that\n * floats over one — keksdose's server-wake notice (#209) let the page's own text\n * show through the one message whose job is to be read when nothing else makes\n * sense. So the surface becomes `--bg-surface` and the tone's wash is layered on it\n * as a background IMAGE (a flat gradient), which keeps the exact tint in both themes\n * without a second, opaque copy of every `-bg` token. */\nconst TONE_ELEVATED: Record<AlertTone, string> = {\n danger: \"bg-[image:linear-gradient(var(--danger-bg),var(--danger-bg))]\",\n warning: \"bg-[image:linear-gradient(var(--warning-bg),var(--warning-bg))]\",\n info: \"bg-[image:linear-gradient(var(--info-bg),var(--info-bg))]\",\n success: \"bg-[image:linear-gradient(var(--success-bg),var(--success-bg))]\",\n neutral: \"\",\n};\nconst ELEVATED = \"bg-[var(--bg-surface)] shadow-lg\";\n\n/** The tone's border + surface on their own — for a caller that already has a box\n * with its own radius and padding (e.g. a Card). Remember to shave 1px off that\n * padding for the colored tones, whose border is 2px wide. */\nexport function toneFrameClass(tone: AlertTone): string {\n return TONE_FRAME[tone];\n}\n\n/** Single source for the warning-callout frame (feedback #277): the tone's border\n * and surface plus this component's own radius and padding, the latter\n * compensating the 2px colored border so toggling tones never shifts layout. */\nexport function alertFrameClass(tone: AlertTone, size: AlertSize = \"md\"): string {\n const box =\n size === \"sm\"\n ? tone === \"neutral\"\n ? \"rounded-md px-2.5 py-1.5\"\n : \"rounded-md px-[9px] py-[5px]\"\n : tone === \"neutral\"\n ? \"rounded-md p-3\"\n : \"rounded-md p-[11px]\";\n return `${box} ${TONE_FRAME[tone]}`;\n}\n\n/** The `strip` frame: the tone's surface edge to edge, no radius, and only the BOTTOM\n * border, 1px — a strip is a band across the top of a page, and its one visible edge\n * is the line it draws under itself. kastlan's trial, past-due and tour banners. */\nfunction stripFrameClass(tone: AlertTone, size: AlertSize): string {\n return cn(\n TONE_FRAME[tone],\n \"rounded-none border-0 border-b\",\n size === \"sm\" ? \"px-4 py-1.5\" : \"px-4 py-2\",\n );\n}\n\nconst TONE_TEXT: Record<AlertTone, string> = {\n danger: \"text-[var(--danger)]\",\n warning: \"text-[var(--warning)]\",\n info: \"text-[var(--info)]\",\n success: \"text-[var(--success)]\",\n neutral: \"text-[var(--text-secondary)]\",\n};\n\nconst TONE_ICON: Record<AlertTone, string> = {\n danger: \"text-[var(--danger)]\",\n warning: \"text-[var(--warning)]\",\n info: \"text-[var(--info)]\",\n success: \"text-[var(--success)]\",\n neutral: \"text-[var(--text-muted)]\",\n};\n\n/** Which glyph a tone draws when the caller names none. The triangle belongs to the\n * two tones that mean \"something is wrong\"; `info` and `neutral` get the ⓘ. That is\n * what makes `neutral` safe to offer at all: until 0.8.0 it was withheld because a\n * triangle with no colour is a warning that looks like a note — and a neutral note\n * that draws no triangle is simply a note (lenkbank's \"values are rounded\"). */\nconst TONE_GLYPH: Record<AlertTone, typeof AlertTriangle> = {\n danger: AlertTriangle,\n warning: AlertTriangle,\n info: Info,\n success: CheckCircle2,\n neutral: Info,\n};\n\ninterface AlertBannerBaseProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onClick\"> {\n /** Default `danger`. `info` for news, `neutral` for a plain note — see\n * {@link TONE_GLYPH} for why a neutral banner is now allowed. */\n tone?: AlertTone;\n /**\n * `box` (default): the framed callout. `inline`: the tone's colour, glyph and role\n * and NOTHING else — no border, no surface, no padding — so it fits inside a\n * toolbar row beside the controls it is about. Lenkbank's corner-motion toolbar\n * shows \"Radius below the minimum\" and \"Solving…\" there; a box would have doubled\n * the row's height every time either appeared.\n *\n * The inline variant is also a LIVE REGION by default — `role=\"alert\"` for\n * `danger`, `role=\"status\"` for the rest — because a message that appears in a\n * toolbar in answer to what the user just did is exactly the kind a screen reader\n * otherwise never hears. The box stays role-less as it always was: it is usually\n * page furniture present at load, and an alert that fires on every navigation is\n * noise. Either way a `role` you pass wins.\n *\n * `strip` (0.10.0): a band across the top of a page or a panel — edge to edge, no\n * radius, only a bottom border, content centred on one line, and usually an\n * {@link action}. kastlan's billing trial-banner and past-due-banner and its tours\n * tour-banner each built this by hand in amber or red Tailwind classes, with a\n * separate dark: spelling apiece. Role-less like the box: it is page furniture.\n */\n variant?: \"box\" | \"inline\" | \"strip\";\n /** See {@link AlertSize}. Default `md`. */\n size?: AlertSize;\n /**\n * `inline` only (0.11.0): lay the message out as a BLOCK — a full-width `flex` row,\n * the glyph on the text's FIRST line when it wraps — instead of the `inline-flex`,\n * centred line it is by default. keksdose writes `className=\"flex\"` on nearly every\n * inline banner it has (accounts-page:564, holdings-panel:631, import-map-step:66/314,\n * guest-key-control:84) to get a line of its own under a total or a field, and a\n * two-line hint there then centres its glyph between the lines.\n *\n * An option rather than the new default, because the inline-flex is load-bearing for\n * the callers the variant was made for: lenkbank's corner-motion toolbar\n * (corner-motion.tsx:178) sets it as a `shrink-0` item beside the controls, kastlan's\n * import page and keksdose's rules page place it in a run of content — a block would\n * take the whole row in the second kind, and top-align the first against a taller\n * control. Ignored by `box` and `strip`, which are blocks already.\n */\n block?: boolean;\n /**\n * `false` opts an inline banner out of its live region (no `role=\"alert\"` /\n * `role=\"status\"`), for a message that is static page content rather than the answer\n * to something the user just did: keksdose's CAMT review step (camt-review-step:214)\n * renders \"unresolved rows block the import\" as part of the step, and as\n * `role=\"alert\"` a screen reader interrupted with it on every mount. A `role` you pass\n * still wins. Default `true`; the box and the strip are role-less either way.\n */\n live?: boolean;\n /**\n * An opaque, raised surface (a shadow, and no translucency in dark mode) for a\n * notice that floats over the page — see {@link TONE_ELEVATED}. `box` and `strip`\n * only; an inline message has no surface to raise.\n */\n elevated?: boolean;\n /**\n * A trailing control — the \"Update payment method\" button on kastlan's trial and\n * past-due strips, the \"Exit\" on its tour strip. Sits at the end of the row,\n * vertically centred, and never shrinks. On a whole-row banner (`href`/`onClick`)\n * it is rendered BESIDE the row's own link or button, as the × is, because\n * interactive content may not nest.\n */\n action?: ReactNode;\n /** Replaces the tone's glyph — a `<Spinner label={null} />` for \"Solving…\", say.\n * `null` draws none. Always decorative; the text carries the message. */\n icon?: ReactNode;\n /** Renders an × at the end that calls this. The banner does not hide itself — the\n * caller removes it (and remembers that it did), as with every other kit control\n * whose state is app state. */\n onDismiss?: () => void;\n /** Accessible name of the ×. Default: `common.dismiss` from the\n * {@link UiKitProvider}, else \"Dismiss\". */\n dismissLabel?: string;\n children: ReactNode;\n}\n\n/**\n * The whole-row modes. keksdose's budget-summary card is a banner you tap to open\n * the budget; built from a `<div onClick>` it was a mouse-only target, and built as a\n * banner with a link inside it was a small target inside a big one that looked like\n * one. So `onClick` makes the banner itself ONE `<button>`, and `href` makes it one\n * `<a>`, with a trailing chevron that says so. Mutually exclusive, as on `Chip`.\n *\n * With `onDismiss` as well, the × cannot go inside the button (interactive content\n * may not nest), so the frame becomes a wrapper holding two siblings: the row's\n * button, stretched over the whole frame, and the × on top of it. It still looks and\n * clicks like one banner with an × in its corner, and the two are separate tab stops.\n */\nexport type AlertBannerProps = AlertBannerBaseProps &\n (\n | {\n /** Makes the whole banner one link. Mutually exclusive with `onClick`. */\n href?: string;\n onClick?: never;\n }\n | {\n href?: never;\n /** Makes the whole banner one button. Mutually exclusive with `href`. The\n * event's element is the `<button>`, not a `<div>`. */\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n }\n );\n\n/** Warning/danger/info callout box with the shared frame and an icon — or, with\n * `variant=\"inline\"`, the same message as a frameless line of toned text. */\nexport function AlertBanner({\n tone = \"danger\",\n variant = \"box\",\n size = \"md\",\n block = false,\n live = true,\n elevated = false,\n action,\n icon,\n onDismiss,\n dismissLabel,\n href,\n onClick,\n className,\n children,\n role,\n ...rest\n}: AlertBannerProps) {\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS, { dismiss: dismissLabel });\n const inline = variant === \"inline\";\n const strip = variant === \"strip\";\n const sm = size === \"sm\";\n const interactive = href !== undefined || onClick !== undefined;\n // A block-laid inline banner behaves like a box for layout: a row that may wrap.\n const inlineRow = inline && !block;\n const resolvedRole = role ?? (inline && live ? (tone === \"danger\" ? \"alert\" : \"status\") : undefined);\n\n const Glyph = TONE_GLYPH[tone];\n // Onto the first line of a box's text: 2px at 14px/20px, 1px at 12px/16px.\n const nudge = inlineRow || strip ? undefined : sm ? \"mt-px\" : \"mt-0.5\";\n const glyph =\n icon === null ? null : icon !== undefined ? (\n <span\n aria-hidden\n className={cn(\"flex shrink-0\", sm ? \"[&_svg]:size-3.5\" : \"[&_svg]:size-4\", nudge, TONE_ICON[tone])}\n >\n {icon}\n </span>\n ) : (\n <Glyph aria-hidden className={cn(sm ? \"size-3.5\" : \"size-4\", \"shrink-0\", nudge, TONE_ICON[tone])} />\n );\n\n // The row layout, shared by every shape below. A strip centres, and WRAPS: on a\n // phone a long message plus an action would otherwise squeeze the text into a narrow\n // column, so the action drops under it instead. A box may wrap its text, so it\n // top-aligns and nudges the glyph onto the first line.\n const row = cn(\n inlineRow ? \"inline-flex items-center\" : strip ? \"flex flex-wrap items-center gap-y-1\" : \"flex items-start\",\n sm ? \"gap-1.5 text-xs\" : inline ? \"gap-1.5 text-sm\" : \"gap-2 text-sm\",\n );\n const frame = inline\n ? \"\"\n : cn(\n strip ? stripFrameClass(tone, size) : alertFrameClass(tone, size),\n elevated && cn(ELEVATED, TONE_ELEVATED[tone]),\n );\n const focusRing =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--bg-surface)]\";\n\n const content = (\n <>\n {glyph}\n <span className={cn(!inlineRow && \"flex-1\", \"min-w-0 text-start\")}>{children}</span>\n {interactive && (\n <ChevronRight\n aria-hidden\n className={cn(sm ? \"size-3.5\" : \"size-4\", \"shrink-0 opacity-70 rtl:-scale-x-100\", nudge)}\n />\n )}\n </>\n );\n\n const dismiss = onDismiss ? (\n <button\n type=\"button\"\n aria-label={common.dismiss}\n onClick={(e) => {\n // A dismiss inside a whole-row banner must not also follow the row.\n e.preventDefault();\n e.stopPropagation();\n onDismiss();\n }}\n className={cn(\n // Negative margins so the × does not make the box taller than its text; the\n // hover wash takes the tone's own hue, so it works on every tone.\n \"relative z-10 -my-0.5 -me-0.5 flex size-6 shrink-0 items-center justify-center rounded transition-colors hover:bg-current/10\",\n focusRing,\n )}\n >\n <X aria-hidden className=\"size-4\" />\n </button>\n ) : null;\n\n // `relative z-10` so it stays clickable over a whole-row banner's stretched target.\n const trailing =\n action !== undefined && action !== null ? (\n <div className={cn(\"relative z-10 flex shrink-0 items-center gap-2\", !strip && !inlineRow && \"self-center\", strip && \"ms-auto\")}>\n {action}\n </div>\n ) : null;\n\n if (!interactive) {\n return (\n <div\n // Arbitrary attributes first — a `data-tour` anchor, a test id, an\n // `aria-describedby` — then the layout and tone classes, which are merged\n // through `cn` rather than spread so a caller's `className` refines the box\n // instead of replacing it.\n {...rest}\n role={resolvedRole}\n className={cn(row, frame, TONE_TEXT[tone], className)}\n >\n {content}\n {trailing}\n {dismiss}\n </div>\n );\n }\n\n const hover = \"cursor-pointer transition-[filter] hover:brightness-[0.97] dark:hover:brightness-110\";\n // With a dismiss the frame is a wrapper and the row element is stretched over it;\n // without one the row element IS the frame.\n const split = dismiss !== null || trailing !== null;\n const actionClass = split\n ? cn(\n \"flex min-w-0 flex-1 text-start\",\n sm ? \"gap-1.5\" : \"gap-2\",\n inlineRow || strip ? \"items-center\" : \"items-start\",\n \"outline-none after:absolute after:inset-0 after:content-['']\",\n strip ? \"after:rounded-none\" : \"after:rounded-md\",\n \"focus-visible:after:ring-2 focus-visible:after:ring-[var(--brand)]\",\n )\n : cn(row, !inlineRow && \"w-full\", frame, TONE_TEXT[tone], hover, focusRing, className);\n // The div's attributes are the row element's: an `id`, a test id or an\n // `aria-describedby` belongs on the thing that takes focus. The live-region role is\n // NOT carried over — a button or a link that is also a `status` is neither.\n const actionRest = split ? {} : rest;\n\n const rowAction =\n href !== undefined ? (\n <a\n {...(actionRest as ComponentPropsWithoutRef<\"a\">)}\n href={href}\n className={actionClass}\n >\n {content}\n </a>\n ) : (\n <button\n {...(actionRest as ComponentPropsWithoutRef<\"button\">)}\n type=\"button\"\n onClick={onClick}\n className={actionClass}\n >\n {content}\n </button>\n );\n\n if (!split) return rowAction;\n return (\n <div\n {...rest}\n role={resolvedRole}\n className={cn(\"relative\", row, frame, TONE_TEXT[tone], hover, className)}\n >\n {rowAction}\n {trailing}\n {dismiss}\n </div>\n );\n}\n"],"mappings":"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","names":[]}
|
|
@@ -5,6 +5,7 @@ import { NumberPadSheetLabels } from './numpad-sheet.js';
|
|
|
5
5
|
import '../i18n/kit-labels.js';
|
|
6
6
|
import './data-table-labels.js';
|
|
7
7
|
import './mini-calendar.js';
|
|
8
|
+
import './calendar-heatmap.js';
|
|
8
9
|
import './popover.js';
|
|
9
10
|
import './chip.js';
|
|
10
11
|
import 'lucide-react';
|
|
@@ -12,6 +13,7 @@ import './field-sync.js';
|
|
|
12
13
|
import './ui.js';
|
|
13
14
|
import './tooltip.js';
|
|
14
15
|
import '../hooks/use-anchored-rect.js';
|
|
16
|
+
import '../lib/clipping.js';
|
|
15
17
|
import '../wizard/types.js';
|
|
16
18
|
import '../tour/tour.js';
|
|
17
19
|
import '../search/command-palette.js';
|
|
@@ -37,6 +39,10 @@ import '../feedback/feedback-dialog.js';
|
|
|
37
39
|
import './confirm-dialog.js';
|
|
38
40
|
import './floating-panel.js';
|
|
39
41
|
import './copy-button.js';
|
|
42
|
+
import './bulk-action-bar.js';
|
|
43
|
+
import './list.js';
|
|
44
|
+
import './breadcrumbs.js';
|
|
45
|
+
import './toast.js';
|
|
40
46
|
|
|
41
47
|
interface AmountInputProps {
|
|
42
48
|
value: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
interface BreadcrumbsLabels {
|
|
5
|
+
/** The `nav` landmark's name — what a screen reader lists it as. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The "…" button that reveals the levels collapsed away on a phone. */
|
|
8
|
+
showAll: string;
|
|
9
|
+
}
|
|
10
|
+
declare const DEFAULT_BREADCRUMBS_LABELS: BreadcrumbsLabels;
|
|
11
|
+
interface BreadcrumbItem {
|
|
12
|
+
label: ReactNode;
|
|
13
|
+
/** Where the crumb leads. A crumb without one is text (a level with no page of its
|
|
14
|
+
* own). The LAST crumb is the current page and is text whether or not it has one. */
|
|
15
|
+
href?: string;
|
|
16
|
+
/** A stable React key, when `label` is not a string. */
|
|
17
|
+
key?: string;
|
|
18
|
+
}
|
|
19
|
+
/** What {@link BreadcrumbsProps.renderLink} is handed. Spread it onto your router's
|
|
20
|
+
* link — `({ href, ...p }) => <Link to={href} {...p} />`. */
|
|
21
|
+
interface BreadcrumbLinkProps {
|
|
22
|
+
href: string;
|
|
23
|
+
className: string;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
interface BreadcrumbsProps extends Omit<ComponentPropsWithoutRef<"nav">, "children"> {
|
|
27
|
+
items: BreadcrumbItem[];
|
|
28
|
+
/** Your router's link. Default `<a>`. The API `Chip`, `StatTile` and `ListItem` share. */
|
|
29
|
+
renderLink?: (props: BreadcrumbLinkProps) => ReactElement;
|
|
30
|
+
/**
|
|
31
|
+
* The mark between crumbs. Default a chevron, mirrored in RTL — a chevron pointing
|
|
32
|
+
* right in a right-to-left trail points back toward where you came from. Supply your
|
|
33
|
+
* own and it is drawn as given (a "/" needs no mirroring).
|
|
34
|
+
*/
|
|
35
|
+
separator?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Collapse the middle on phones (below the `md` breakpoint) into a "…" button, keeping
|
|
38
|
+
* the first crumb and the last {@link keepEnd}. Default `true`. kastlan's trail
|
|
39
|
+
* scrolled sideways on a phone instead, which hides the current page — the one crumb
|
|
40
|
+
* that must never be off-screen.
|
|
41
|
+
*/
|
|
42
|
+
collapse?: boolean;
|
|
43
|
+
/** How many crumbs at the end stay visible when collapsed — the current page and its
|
|
44
|
+
* parent by default (2), because "up one level" is what a phone user reaches for. */
|
|
45
|
+
keepEnd?: number;
|
|
46
|
+
/** Overrides the {@link UiKitProvider}'s `breadcrumbs` labels. */
|
|
47
|
+
labels?: Partial<BreadcrumbsLabels>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The trail from the app's root to this page.
|
|
51
|
+
*
|
|
52
|
+
* `nav` + `ol` + `aria-current="page"` on the last crumb: the WAI breadcrumb pattern,
|
|
53
|
+
* which kastlan's (shared/components/layout/breadcrumbs.tsx) nearly was — a `nav` of
|
|
54
|
+
* `span`s, so a screen reader heard no list, no count, and nothing marking where you
|
|
55
|
+
* are. The collapse is CSS (`hidden md:flex`), so it costs no media-query listener and
|
|
56
|
+
* the server's first paint is already right.
|
|
57
|
+
*/
|
|
58
|
+
declare function Breadcrumbs({ items, renderLink, separator, collapse, keepEnd, labels: labelsProp, className, "aria-label": ariaLabel, ...rest }: BreadcrumbsProps): react.JSX.Element | null;
|
|
59
|
+
|
|
60
|
+
export { type BreadcrumbItem, type BreadcrumbLinkProps, Breadcrumbs, type BreadcrumbsLabels, type BreadcrumbsProps, DEFAULT_BREADCRUMBS_LABELS };
|