@nadicodeai/ui 12.1.102 → 12.1.104
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/dist/components/accordion.d.ts +38 -12
- package/dist/components/accordion.d.ts.map +1 -1
- package/dist/components/accordion.js +36 -15
- package/dist/components/account-menu.js +2 -2
- package/dist/components/action-menu.d.ts +20 -19
- package/dist/components/action-menu.d.ts.map +1 -1
- package/dist/components/action-menu.js +22 -15
- package/dist/components/action-status.d.ts +14 -10
- package/dist/components/action-status.d.ts.map +1 -1
- package/dist/components/action-status.js +14 -10
- package/dist/components/activity-calendar.d.ts +3 -1
- package/dist/components/activity-calendar.d.ts.map +1 -1
- package/dist/components/activity-calendar.js +16 -2
- package/dist/components/activity-feed.d.ts +2 -2
- package/dist/components/activity-feed.d.ts.map +1 -1
- package/dist/components/activity-feed.js +14 -5
- package/dist/components/agent-card.d.ts +11 -5
- package/dist/components/agent-card.d.ts.map +1 -1
- package/dist/components/agent-card.js +13 -7
- package/dist/components/agent-list-row.js +1 -1
- package/dist/components/agent-orb-appearance.d.ts +7 -1
- package/dist/components/agent-orb-appearance.d.ts.map +1 -1
- package/dist/components/agent-orb-appearance.js +26 -0
- package/dist/components/agent-profile.d.ts +8 -7
- package/dist/components/agent-profile.d.ts.map +1 -1
- package/dist/components/agent-profile.js +6 -6
- package/dist/components/alert-dialog.d.ts +25 -16
- package/dist/components/alert-dialog.d.ts.map +1 -1
- package/dist/components/alert-dialog.js +30 -18
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/avatar.d.ts +83 -17
- package/dist/components/avatar.d.ts.map +1 -1
- package/dist/components/avatar.js +89 -23
- package/dist/components/badge.d.ts +59 -8
- package/dist/components/badge.d.ts.map +1 -1
- package/dist/components/badge.js +57 -14
- package/dist/components/breadcrumb.d.ts +18 -7
- package/dist/components/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb.js +37 -13
- package/dist/components/button-group.d.ts +12 -15
- package/dist/components/button-group.d.ts.map +1 -1
- package/dist/components/button-group.js +13 -17
- package/dist/components/button.d.ts +126 -23
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +164 -39
- package/dist/components/calendar.d.ts +26 -15
- package/dist/components/calendar.d.ts.map +1 -1
- package/dist/components/calendar.js +60 -46
- package/dist/components/card-row.d.ts +13 -5
- package/dist/components/card-row.d.ts.map +1 -1
- package/dist/components/card-row.js +24 -10
- package/dist/components/card.d.ts +6 -12
- package/dist/components/card.d.ts.map +1 -1
- package/dist/components/card.js +11 -16
- package/dist/components/carousel.d.ts +3 -3
- package/dist/components/carousel.d.ts.map +1 -1
- package/dist/components/carousel.js +7 -7
- package/dist/components/catalog-drawer.d.ts +7 -7
- package/dist/components/catalog-drawer.d.ts.map +1 -1
- package/dist/components/catalog-drawer.js +6 -6
- package/dist/components/chart-area-stacked.d.ts +1 -1
- package/dist/components/chart-area-stacked.d.ts.map +1 -1
- package/dist/components/chart-area-stacked.js +4 -4
- package/dist/components/chart-axis.d.ts +14 -1
- package/dist/components/chart-axis.d.ts.map +1 -1
- package/dist/components/chart-axis.js +11 -1
- package/dist/components/chart-bar-horizontal.d.ts +2 -2
- package/dist/components/chart-bar-horizontal.d.ts.map +1 -1
- package/dist/components/chart-bar-horizontal.js +14 -5
- package/dist/components/chart-bar-multiple.d.ts +1 -1
- package/dist/components/chart-bar-multiple.d.ts.map +1 -1
- package/dist/components/chart-bar-multiple.js +3 -3
- package/dist/components/chart-bar-stacked.d.ts +1 -1
- package/dist/components/chart-bar-stacked.d.ts.map +1 -1
- package/dist/components/chart-bar-stacked.js +3 -3
- package/dist/components/chart-card.d.ts +17 -6
- package/dist/components/chart-card.d.ts.map +1 -1
- package/dist/components/chart-card.js +11 -4
- package/dist/components/chart-date-range-control.d.ts +18 -9
- package/dist/components/chart-date-range-control.d.ts.map +1 -1
- package/dist/components/chart-date-range-control.js +43 -47
- package/dist/components/chart-sparkline.d.ts +4 -3
- package/dist/components/chart-sparkline.d.ts.map +1 -1
- package/dist/components/chart-sparkline.js +6 -5
- package/dist/components/check-counts.d.ts +44 -0
- package/dist/components/check-counts.d.ts.map +1 -0
- package/dist/components/check-counts.js +51 -0
- package/dist/components/checkbox.d.ts +39 -11
- package/dist/components/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox.js +38 -11
- package/dist/components/choicebox.d.ts +96 -0
- package/dist/components/choicebox.d.ts.map +1 -0
- package/dist/components/choicebox.js +113 -0
- package/dist/components/clearable-input.d.ts +57 -0
- package/dist/components/clearable-input.d.ts.map +1 -0
- package/dist/components/clearable-input.js +58 -0
- package/dist/components/code-block.d.ts +77 -17
- package/dist/components/code-block.d.ts.map +1 -1
- package/dist/components/code-block.js +85 -15
- package/dist/components/collapsible.d.ts +27 -10
- package/dist/components/collapsible.d.ts.map +1 -1
- package/dist/components/collapsible.js +24 -9
- package/dist/components/collection-filters.d.ts +3 -1
- package/dist/components/collection-filters.d.ts.map +1 -1
- package/dist/components/collection-filters.js +7 -9
- package/dist/components/collection-page.d.ts +31 -10
- package/dist/components/collection-page.d.ts.map +1 -1
- package/dist/components/collection-page.js +14 -13
- package/dist/components/collection-search.d.ts +32 -10
- package/dist/components/collection-search.d.ts.map +1 -1
- package/dist/components/collection-search.js +24 -13
- package/dist/components/collection-sort.d.ts.map +1 -1
- package/dist/components/collection-sort.js +2 -2
- package/dist/components/collection-toolbar.d.ts +5 -2
- package/dist/components/collection-toolbar.d.ts.map +1 -1
- package/dist/components/collection-toolbar.js +7 -4
- package/dist/components/combobox.d.ts +97 -22
- package/dist/components/combobox.d.ts.map +1 -1
- package/dist/components/combobox.js +80 -28
- package/dist/components/command.d.ts +34 -21
- package/dist/components/command.d.ts.map +1 -1
- package/dist/components/command.js +33 -25
- package/dist/components/confirm-dialog.d.ts +23 -6
- package/dist/components/confirm-dialog.d.ts.map +1 -1
- package/dist/components/confirm-dialog.js +32 -13
- package/dist/components/context-menu.d.ts +14 -10
- package/dist/components/context-menu.d.ts.map +1 -1
- package/dist/components/context-menu.js +17 -12
- package/dist/components/copy-button.d.ts +5 -2
- package/dist/components/copy-button.d.ts.map +1 -1
- package/dist/components/copy-button.js +16 -8
- package/dist/components/data-table.d.ts +120 -54
- package/dist/components/data-table.d.ts.map +1 -1
- package/dist/components/data-table.js +163 -92
- package/dist/components/desktop-shell.d.ts +4 -2
- package/dist/components/desktop-shell.d.ts.map +1 -1
- package/dist/components/desktop-shell.js +3 -3
- package/dist/components/dialog.d.ts +63 -24
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +52 -31
- package/dist/components/disclosure-row.d.ts +1 -2
- package/dist/components/disclosure-row.d.ts.map +1 -1
- package/dist/components/disclosure-row.js +1 -2
- package/dist/components/disclosure.d.ts +1 -1
- package/dist/components/disclosure.js +1 -1
- package/dist/components/drawer.d.ts +33 -12
- package/dist/components/drawer.d.ts.map +1 -1
- package/dist/components/drawer.js +47 -35
- package/dist/components/dropdown-menu.d.ts +59 -14
- package/dist/components/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu.js +58 -26
- package/dist/components/empty-state.d.ts +35 -12
- package/dist/components/empty-state.d.ts.map +1 -1
- package/dist/components/empty-state.js +35 -17
- package/dist/components/entry-scene.d.ts +4 -4
- package/dist/components/entry-scene.d.ts.map +1 -1
- package/dist/components/entry-scene.js +2 -2
- package/dist/components/field.d.ts +44 -14
- package/dist/components/field.d.ts.map +1 -1
- package/dist/components/field.js +49 -20
- package/dist/components/file-diff.d.ts.map +1 -1
- package/dist/components/file-diff.js +3 -4
- package/dist/components/form-dialog.d.ts +7 -7
- package/dist/components/form-dialog.d.ts.map +1 -1
- package/dist/components/form-dialog.js +13 -11
- package/dist/components/form-drawer.d.ts +10 -7
- package/dist/components/form-drawer.d.ts.map +1 -1
- package/dist/components/form-drawer.js +11 -10
- package/dist/components/gauge.d.ts +64 -0
- package/dist/components/gauge.d.ts.map +1 -0
- package/dist/components/gauge.js +73 -0
- package/dist/components/hover-card.d.ts +72 -14
- package/dist/components/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card.js +51 -17
- package/dist/components/identity-mark.d.ts +8 -1
- package/dist/components/identity-mark.d.ts.map +1 -1
- package/dist/components/identity-mark.js +31 -5
- package/dist/components/input-group.d.ts +44 -21
- package/dist/components/input-group.d.ts.map +1 -1
- package/dist/components/input-group.js +74 -27
- package/dist/components/input.d.ts +64 -12
- package/dist/components/input.d.ts.map +1 -1
- package/dist/components/input.js +51 -15
- package/dist/components/item.d.ts +37 -15
- package/dist/components/item.d.ts.map +1 -1
- package/dist/components/item.js +41 -22
- package/dist/components/kbd.d.ts +49 -13
- package/dist/components/kbd.d.ts.map +1 -1
- package/dist/components/kbd.js +115 -16
- package/dist/components/kpi-card.d.ts +12 -4
- package/dist/components/kpi-card.d.ts.map +1 -1
- package/dist/components/kpi-card.js +13 -4
- package/dist/components/label.d.ts +17 -10
- package/dist/components/label.d.ts.map +1 -1
- package/dist/components/label.js +18 -11
- package/dist/components/library-shelf.d.ts +6 -6
- package/dist/components/library-shelf.d.ts.map +1 -1
- package/dist/components/library-shelf.js +5 -5
- package/dist/components/load-more-button.d.ts +35 -0
- package/dist/components/load-more-button.d.ts.map +1 -0
- package/dist/components/load-more-button.js +26 -0
- package/dist/components/message-notice.d.ts +8 -13
- package/dist/components/message-notice.d.ts.map +1 -1
- package/dist/components/message-notice.js +25 -22
- package/dist/components/middle-truncate.d.ts +33 -0
- package/dist/components/middle-truncate.d.ts.map +1 -0
- package/dist/components/middle-truncate.js +72 -0
- package/dist/components/multi-select.d.ts +94 -0
- package/dist/components/multi-select.d.ts.map +1 -0
- package/dist/components/multi-select.js +132 -0
- package/dist/components/native-select.d.ts +37 -13
- package/dist/components/native-select.d.ts.map +1 -1
- package/dist/components/native-select.js +27 -11
- package/dist/components/notice-banner.d.ts +17 -10
- package/dist/components/notice-banner.d.ts.map +1 -1
- package/dist/components/notice-banner.js +12 -11
- package/dist/components/numbered-steps.d.ts +10 -4
- package/dist/components/numbered-steps.d.ts.map +1 -1
- package/dist/components/numbered-steps.js +9 -7
- package/dist/components/object-page.d.ts +40 -14
- package/dist/components/object-page.d.ts.map +1 -1
- package/dist/components/object-page.js +12 -10
- package/dist/components/object-workspace.d.ts +29 -10
- package/dist/components/object-workspace.d.ts.map +1 -1
- package/dist/components/object-workspace.js +18 -8
- package/dist/components/overview-page.d.ts +2 -2
- package/dist/components/overview-page.d.ts.map +1 -1
- package/dist/components/overview-page.js +8 -7
- package/dist/components/page-actions.d.ts +28 -8
- package/dist/components/page-actions.d.ts.map +1 -1
- package/dist/components/page-actions.js +22 -25
- package/dist/components/page-header.d.ts +11 -4
- package/dist/components/page-header.d.ts.map +1 -1
- package/dist/components/page-header.js +10 -5
- package/dist/components/pending-label.d.ts +6 -5
- package/dist/components/pending-label.d.ts.map +1 -1
- package/dist/components/pending-label.js +14 -6
- package/dist/components/picture-label.d.ts +2 -2
- package/dist/components/picture-label.d.ts.map +1 -1
- package/dist/components/picture-label.js +3 -3
- package/dist/components/portal-sidebar-frame.d.ts +9 -21
- package/dist/components/portal-sidebar-frame.d.ts.map +1 -1
- package/dist/components/portal-sidebar-frame.js +13 -27
- package/dist/components/progress-checklist.d.ts +46 -0
- package/dist/components/progress-checklist.d.ts.map +1 -0
- package/dist/components/progress-checklist.js +46 -0
- package/dist/components/progress.d.ts +48 -8
- package/dist/components/progress.d.ts.map +1 -1
- package/dist/components/progress.js +92 -16
- package/dist/components/prose.d.ts +19 -0
- package/dist/components/prose.d.ts.map +1 -0
- package/dist/components/prose.js +29 -0
- package/dist/components/radio-group.d.ts +51 -12
- package/dist/components/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group.js +42 -12
- package/dist/components/reading-column.js +1 -1
- package/dist/components/record-identity.d.ts +6 -5
- package/dist/components/record-identity.d.ts.map +1 -1
- package/dist/components/record-identity.js +12 -3
- package/dist/components/record-list.d.ts +117 -27
- package/dist/components/record-list.d.ts.map +1 -1
- package/dist/components/record-list.js +185 -55
- package/dist/components/record-time.d.ts +20 -7
- package/dist/components/record-time.d.ts.map +1 -1
- package/dist/components/record-time.js +38 -19
- package/dist/components/resizable.d.ts +7 -5
- package/dist/components/resizable.d.ts.map +1 -1
- package/dist/components/resizable.js +6 -6
- package/dist/components/scope-switcher.d.ts +2 -0
- package/dist/components/scope-switcher.d.ts.map +1 -1
- package/dist/components/scope-switcher.js +2 -2
- package/dist/components/scroll-area.d.ts +47 -11
- package/dist/components/scroll-area.d.ts.map +1 -1
- package/dist/components/scroll-area.js +72 -14
- package/dist/components/segmented-control.d.ts +82 -0
- package/dist/components/segmented-control.d.ts.map +1 -0
- package/dist/components/segmented-control.js +90 -0
- package/dist/components/select.d.ts +55 -15
- package/dist/components/select.d.ts.map +1 -1
- package/dist/components/select.js +62 -19
- package/dist/components/separator.d.ts +12 -5
- package/dist/components/separator.d.ts.map +1 -1
- package/dist/components/separator.js +11 -6
- package/dist/components/settings-facts.d.ts +34 -14
- package/dist/components/settings-facts.d.ts.map +1 -1
- package/dist/components/settings-facts.js +21 -12
- package/dist/components/settings-page.d.ts +4 -4
- package/dist/components/settings-page.js +5 -5
- package/dist/components/settings-section.d.ts +160 -34
- package/dist/components/settings-section.d.ts.map +1 -1
- package/dist/components/settings-section.js +92 -39
- package/dist/components/sheet.d.ts +47 -16
- package/dist/components/sheet.d.ts.map +1 -1
- package/dist/components/sheet.js +40 -19
- package/dist/components/sidebar-sections.d.ts +16 -12
- package/dist/components/sidebar-sections.d.ts.map +1 -1
- package/dist/components/sidebar-sections.js +30 -15
- package/dist/components/sidebar.d.ts +117 -21
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/components/sidebar.js +180 -55
- package/dist/components/skeleton.d.ts +54 -8
- package/dist/components/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton.js +44 -9
- package/dist/components/slider.d.ts +53 -11
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +71 -17
- package/dist/components/snippet.d.ts +57 -0
- package/dist/components/snippet.d.ts.map +1 -0
- package/dist/components/snippet.js +60 -0
- package/dist/components/sonner.d.ts +13 -14
- package/dist/components/sonner.d.ts.map +1 -1
- package/dist/components/sonner.js +25 -22
- package/dist/components/status-badge.d.ts +37 -11
- package/dist/components/status-badge.d.ts.map +1 -1
- package/dist/components/status-badge.js +63 -15
- package/dist/components/status-dot.d.ts +42 -11
- package/dist/components/status-dot.d.ts.map +1 -1
- package/dist/components/status-dot.js +40 -11
- package/dist/components/switch.d.ts +43 -12
- package/dist/components/switch.d.ts.map +1 -1
- package/dist/components/switch.js +42 -12
- package/dist/components/table-card.d.ts +21 -12
- package/dist/components/table-card.d.ts.map +1 -1
- package/dist/components/table-card.js +17 -9
- package/dist/components/table-layouts.d.ts +40 -8
- package/dist/components/table-layouts.d.ts.map +1 -1
- package/dist/components/table-layouts.js +52 -8
- package/dist/components/table-value.d.ts +4 -3
- package/dist/components/table-value.d.ts.map +1 -1
- package/dist/components/table-value.js +6 -5
- package/dist/components/table.d.ts +62 -25
- package/dist/components/table.d.ts.map +1 -1
- package/dist/components/table.js +62 -26
- package/dist/components/tabs.d.ts +86 -17
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +93 -22
- package/dist/components/text-link.d.ts +4 -1
- package/dist/components/text-link.d.ts.map +1 -1
- package/dist/components/text-link.js +4 -1
- package/dist/components/text-with-copy-button.d.ts +30 -0
- package/dist/components/text-with-copy-button.d.ts.map +1 -0
- package/dist/components/text-with-copy-button.js +32 -0
- package/dist/components/textarea.d.ts +40 -10
- package/dist/components/textarea.d.ts.map +1 -1
- package/dist/components/textarea.js +50 -11
- package/dist/components/theme-mode-switcher.d.ts +18 -1
- package/dist/components/theme-mode-switcher.d.ts.map +1 -1
- package/dist/components/theme-mode-switcher.js +20 -2
- package/dist/components/toggle-group.d.ts +28 -8
- package/dist/components/toggle-group.d.ts.map +1 -1
- package/dist/components/toggle-group.js +12 -6
- package/dist/components/toggle.d.ts +6 -3
- package/dist/components/toggle.d.ts.map +1 -1
- package/dist/components/toggle.js +10 -7
- package/dist/components/tooltip.d.ts +43 -12
- package/dist/components/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip.js +45 -16
- package/dist/components/trend-badge.js +1 -1
- package/dist/components/update-card.js +1 -1
- package/dist/eslint/index.js +82 -0
- package/dist/eslint/rules/badge-is-static-label.js +93 -0
- package/dist/eslint/rules/button-icon-slot.js +102 -0
- package/dist/eslint/rules/button-link-for-navigation.js +146 -0
- package/dist/eslint/rules/button-no-aria-label-with-text.js +75 -0
- package/dist/eslint/rules/button-type-roles-only-in-buttons.js +83 -0
- package/dist/eslint/rules/choice-control-has-a-name.js +98 -0
- package/dist/eslint/rules/choice-group-in-fieldset.js +86 -0
- package/dist/eslint/rules/command-shortcut-single-owner.js +118 -0
- package/dist/eslint/rules/confirm-dialog-words.js +63 -0
- package/dist/eslint/rules/data-table-one-unsized-column.js +96 -0
- package/dist/eslint/rules/destructive-action-placement.js +69 -0
- package/dist/eslint/rules/disabled-choice-says-why.js +71 -0
- package/dist/eslint/rules/ellipsis-opens-a-dialog.js +110 -0
- package/dist/eslint/rules/input-group-owners.js +155 -0
- package/dist/eslint/rules/kbd-children-no-modifier-text.js +128 -0
- package/dist/eslint/rules/literal-text.js +41 -0
- package/dist/eslint/rules/middle-truncate-placement.js +69 -0
- package/dist/eslint/rules/no-bare-button-label.js +55 -0
- package/dist/eslint/rules/no-control-in-read-only-surface.js +106 -0
- package/dist/eslint/rules/no-hand-built-busy.js +104 -0
- package/dist/eslint/rules/no-hand-built-theme-picker.js +144 -0
- package/dist/eslint/rules/no-hand-built-tile.js +41 -0
- package/dist/eslint/rules/no-hand-formatted-date.js +87 -0
- package/dist/eslint/rules/no-hand-stacked-avatars.js +67 -0
- package/dist/eslint/rules/no-nested-collapse.js +60 -0
- package/dist/eslint/rules/no-search-in-form.js +47 -0
- package/dist/eslint/rules/no-shadcn-appearance-override.js +2 -16
- package/dist/eslint/rules/no-shell-prompt-in-snippet.js +74 -0
- package/dist/eslint/rules/no-stock-error-words.js +56 -0
- package/dist/eslint/rules/no-tooltip-around-labelled-field.js +72 -0
- package/dist/eslint/rules/no-weight-class-on-strong-in-type-role.js +57 -0
- package/dist/eslint/rules/one-submenu-level.js +43 -0
- package/dist/eslint/rules/one-toast-per-flow.js +91 -0
- package/dist/eslint/rules/option-count.js +167 -0
- package/dist/eslint/rules/page-command-link-not-render.js +43 -0
- package/dist/eslint/rules/progress-needs-name.js +57 -0
- package/dist/eslint/rules/settings-limit-in-footer.js +94 -0
- package/dist/eslint/rules/skeleton-in-region.js +80 -0
- package/dist/eslint/rules/sortable-heading-uses-sort.js +79 -0
- package/dist/eslint/rules/table-cell-inset-owner.js +107 -0
- package/dist/eslint/rules/tabs-selection-is-controlled.js +47 -0
- package/dist/eslint/rules/tooltip-only-arrow.js +38 -0
- package/dist/eslint/rules/tooltip-trigger-accessible-name.js +114 -0
- package/dist/eslint/strict-design-system.js +21 -7
- package/dist/index.d.ts +13 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -13
- package/dist/internal/assistant-ui/attachment.d.ts.map +1 -1
- package/dist/internal/assistant-ui/attachment.js +2 -2
- package/dist/internal/assistant-ui/reasoning.d.ts +1 -1
- package/dist/internal/assistant-ui/reasoning.d.ts.map +1 -1
- package/dist/internal/assistant-ui/tool-fallback.js +1 -1
- package/dist/internal/assistant-ui/tool-group.d.ts +1 -1
- package/dist/internal/assistant-ui/tool-group.d.ts.map +1 -1
- package/dist/internal/assistant-ui/tooltip-icon-button.d.ts +2 -3
- package/dist/internal/assistant-ui/tooltip-icon-button.d.ts.map +1 -1
- package/dist/internal/assistant-ui/tooltip-icon-button.js +1 -1
- package/dist/internal/catalog-list.js +2 -2
- package/dist/internal/collection-note.d.ts +23 -0
- package/dist/internal/collection-note.d.ts.map +1 -0
- package/dist/internal/collection-note.js +17 -0
- package/dist/internal/collection-rail.d.ts +57 -0
- package/dist/internal/collection-rail.d.ts.map +1 -0
- package/dist/internal/collection-rail.js +33 -0
- package/dist/internal/company-logo.d.ts +18 -0
- package/dist/internal/company-logo.d.ts.map +1 -0
- package/dist/internal/company-logo.js +14 -0
- package/dist/internal/control-name.d.ts +12 -0
- package/dist/internal/control-name.d.ts.map +1 -0
- package/dist/internal/control-name.js +1 -0
- package/dist/internal/diff-line.d.ts +9 -0
- package/dist/internal/diff-line.d.ts.map +1 -0
- package/dist/internal/diff-line.js +8 -0
- package/dist/internal/empty.d.ts +8 -4
- package/dist/internal/empty.d.ts.map +1 -1
- package/dist/internal/empty.js +14 -8
- package/dist/internal/field-frame.d.ts +33 -0
- package/dist/internal/field-frame.d.ts.map +1 -0
- package/dist/internal/field-frame.js +20 -0
- package/dist/internal/final-focus.d.ts +8 -0
- package/dist/internal/final-focus.d.ts.map +1 -0
- package/dist/internal/final-focus.js +10 -0
- package/dist/internal/footer-strip.d.ts.map +1 -1
- package/dist/internal/footer-strip.js +3 -1
- package/dist/internal/form-submit.d.ts +9 -5
- package/dist/internal/form-submit.d.ts.map +1 -1
- package/dist/internal/form-submit.js +31 -2
- package/dist/internal/input-box.d.ts +26 -0
- package/dist/internal/input-box.d.ts.map +1 -0
- package/dist/internal/input-box.js +59 -0
- package/dist/internal/menu-surface.d.ts +10 -3
- package/dist/internal/menu-surface.d.ts.map +1 -1
- package/dist/internal/menu-surface.js +10 -3
- package/dist/internal/notice.d.ts +25 -0
- package/dist/internal/notice.d.ts.map +1 -0
- package/dist/internal/notice.js +33 -0
- package/dist/internal/overlay-stem.d.ts +5 -0
- package/dist/internal/overlay-stem.d.ts.map +1 -0
- package/dist/internal/overlay-stem.js +7 -0
- package/dist/internal/phone-sheet.d.ts +4 -0
- package/dist/internal/phone-sheet.d.ts.map +1 -0
- package/dist/internal/phone-sheet.js +2 -0
- package/dist/internal/present-content.d.ts +3 -0
- package/dist/internal/present-content.d.ts.map +1 -0
- package/dist/internal/present-content.js +1 -0
- package/dist/internal/record-menu-items.d.ts +4 -3
- package/dist/internal/record-menu-items.d.ts.map +1 -1
- package/dist/internal/record-menu-items.js +21 -6
- package/dist/internal/settings-save.d.ts +9 -2
- package/dist/internal/settings-save.d.ts.map +1 -1
- package/dist/internal/settings-save.js +19 -6
- package/dist/internal/table-compact-line.d.ts +38 -0
- package/dist/internal/table-compact-line.d.ts.map +1 -0
- package/dist/internal/table-compact-line.js +35 -0
- package/dist/internal/title-when-cut.d.ts +8 -0
- package/dist/internal/title-when-cut.d.ts.map +1 -0
- package/dist/internal/title-when-cut.js +22 -0
- package/dist/internal/unsaved-guard.d.ts +18 -0
- package/dist/internal/unsaved-guard.d.ts.map +1 -0
- package/dist/internal/unsaved-guard.js +31 -0
- package/dist/lib/merge-tokens.generated.js +2 -2
- package/dist/showcase/foundations.d.ts.map +1 -1
- package/dist/showcase/foundations.js +10 -2
- package/dist/showcase/specimens/actions.d.ts +2 -0
- package/dist/showcase/specimens/actions.d.ts.map +1 -1
- package/dist/showcase/specimens/actions.js +30 -5
- package/dist/showcase/specimens/charts.d.ts.map +1 -1
- package/dist/showcase/specimens/charts.js +22 -13
- package/dist/showcase/specimens/choices.d.ts +14 -3
- package/dist/showcase/specimens/choices.d.ts.map +1 -1
- package/dist/showcase/specimens/choices.js +93 -13
- package/dist/showcase/specimens/compositions.d.ts.map +1 -1
- package/dist/showcase/specimens/compositions.js +136 -23
- package/dist/showcase/specimens/data.d.ts +12 -7
- package/dist/showcase/specimens/data.d.ts.map +1 -1
- package/dist/showcase/specimens/data.js +139 -35
- package/dist/showcase/specimens/feedback.d.ts +2 -0
- package/dist/showcase/specimens/feedback.d.ts.map +1 -1
- package/dist/showcase/specimens/feedback.js +39 -15
- package/dist/showcase/specimens/index.d.ts +20 -12
- package/dist/showcase/specimens/index.d.ts.map +1 -1
- package/dist/showcase/specimens/inputs.d.ts +4 -2
- package/dist/showcase/specimens/inputs.d.ts.map +1 -1
- package/dist/showcase/specimens/inputs.js +62 -19
- package/dist/showcase/specimens/menus.d.ts +0 -1
- package/dist/showcase/specimens/menus.d.ts.map +1 -1
- package/dist/showcase/specimens/menus.js +47 -17
- package/dist/showcase/specimens/navigation.d.ts +6 -4
- package/dist/showcase/specimens/navigation.d.ts.map +1 -1
- package/dist/showcase/specimens/navigation.js +61 -32
- package/dist/showcase/specimens/other.d.ts +1 -3
- package/dist/showcase/specimens/other.d.ts.map +1 -1
- package/dist/showcase/specimens/other.js +17 -13
- package/dist/showcase/specimens/status.d.ts +4 -1
- package/dist/showcase/specimens/status.d.ts.map +1 -1
- package/dist/showcase/specimens/status.js +64 -11
- package/dist/showcase/usage.generated.d.ts +1 -1
- package/dist/showcase/usage.generated.d.ts.map +1 -1
- package/dist/showcase/usage.generated.js +632 -544
- package/dist/standalone/index.js +1 -1
- package/dist/styles/components.css +13 -13
- package/dist/styles/globals.css +25 -0
- package/package.json +2 -3
- package/dist/components/approval-row.d.ts +0 -34
- package/dist/components/approval-row.d.ts.map +0 -1
- package/dist/components/approval-row.js +0 -27
- package/dist/components/channel-view.d.ts +0 -112
- package/dist/components/channel-view.d.ts.map +0 -1
- package/dist/components/channel-view.js +0 -84
- package/dist/components/dashboard-shell.d.ts +0 -51
- package/dist/components/dashboard-shell.d.ts.map +0 -1
- package/dist/components/dashboard-shell.js +0 -89
- package/dist/components/direction.d.ts +0 -2
- package/dist/components/direction.d.ts.map +0 -1
- package/dist/components/direction.js +0 -1
- package/dist/components/expandable-block.d.ts +0 -20
- package/dist/components/expandable-block.d.ts.map +0 -1
- package/dist/components/expandable-block.js +0 -32
- package/dist/components/form.d.ts +0 -42
- package/dist/components/form.d.ts.map +0 -1
- package/dist/components/form.js +0 -91
- package/dist/components/label-system.d.ts +0 -17
- package/dist/components/label-system.d.ts.map +0 -1
- package/dist/components/label-system.js +0 -21
- package/dist/components/memory-item.d.ts +0 -21
- package/dist/components/memory-item.d.ts.map +0 -1
- package/dist/components/memory-item.js +0 -18
- package/dist/components/menubar.d.ts +0 -43
- package/dist/components/menubar.d.ts.map +0 -1
- package/dist/components/menubar.js +0 -69
- package/dist/components/navigation-menu.d.ts +0 -26
- package/dist/components/navigation-menu.d.ts.map +0 -1
- package/dist/components/navigation-menu.js +0 -45
- package/dist/components/pagination.d.ts +0 -33
- package/dist/components/pagination.d.ts.map +0 -1
- package/dist/components/pagination.js +0 -41
- package/dist/components/plugin-slot-boundary.d.ts +0 -42
- package/dist/components/plugin-slot-boundary.d.ts.map +0 -1
- package/dist/components/plugin-slot-boundary.js +0 -41
- package/dist/components/status-row.d.ts +0 -32
- package/dist/components/status-row.d.ts.map +0 -1
- package/dist/components/status-row.js +0 -35
|
@@ -1,65 +1,190 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
5
|
import { cva } from "class-variance-authority";
|
|
6
|
+
import { Children, isValidElement } from "react";
|
|
7
|
+
import { PendingLabel } from "./pending-label.js";
|
|
4
8
|
import { cn } from "../lib/utils.js";
|
|
5
|
-
const
|
|
9
|
+
const heldNeutral = "disabled:border-border disabled:bg-muted disabled:text-muted-foreground aria-disabled:border-border aria-disabled:bg-muted aria-disabled:text-muted-foreground";
|
|
10
|
+
const heldDim = "disabled:opacity-50 aria-disabled:not-aria-busy:opacity-50";
|
|
11
|
+
const buttonClasses = cva("group/button inline-flex min-h-touch-target min-w-touch-target shrink-0 items-center justify-center rounded-sm border border-transparent bg-clip-padding text-button font-medium whitespace-nowrap transition-[background-color,border-color,color] duration-[var(--nc-duration-confirm)] ease-[var(--nc-ease-out-strong)] select-none disabled:pointer-events-none aria-disabled:pointer-events-none aria-invalid:border-destructive [@media(hover:hover)_and_(pointer:fine)]:min-h-0 [@media(hover:hover)_and_(pointer:fine)]:min-w-0 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
6
12
|
variants: {
|
|
7
13
|
variant: {
|
|
8
|
-
default:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
default: [
|
|
15
|
+
"bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-hover aria-expanded:bg-primary-hover",
|
|
16
|
+
heldNeutral,
|
|
17
|
+
],
|
|
18
|
+
outline: [
|
|
19
|
+
"border-border bg-(--nc-field,var(--background)) hover:bg-muted hover:text-foreground active:bg-muted aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
20
|
+
heldNeutral,
|
|
21
|
+
],
|
|
22
|
+
secondary: [
|
|
23
|
+
"border-border bg-secondary text-secondary-foreground hover:bg-accent active:bg-accent aria-expanded:bg-accent aria-expanded:text-accent-foreground",
|
|
24
|
+
heldNeutral,
|
|
25
|
+
],
|
|
26
|
+
ghost: [
|
|
27
|
+
"hover:bg-muted hover:text-foreground active:bg-muted aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
28
|
+
heldDim,
|
|
29
|
+
],
|
|
30
|
+
brandGhost: [
|
|
31
|
+
"text-nc-identity-white hover:bg-nc-identity-white/10 hover:text-nc-identity-white aria-expanded:bg-nc-identity-white/10 aria-expanded:text-nc-identity-white",
|
|
32
|
+
heldDim,
|
|
33
|
+
],
|
|
34
|
+
brandSolid: [
|
|
35
|
+
"bg-nc-identity-white text-nc-identity-ink hover:bg-nc-identity-white/90 hover:text-nc-identity-ink active:bg-nc-identity-white/90 active:text-nc-identity-ink",
|
|
36
|
+
heldDim,
|
|
37
|
+
],
|
|
38
|
+
destructive: [
|
|
39
|
+
"bg-destructive text-destructive-foreground hover:brightness-90 active:brightness-90",
|
|
40
|
+
heldNeutral,
|
|
41
|
+
],
|
|
42
|
+
warning: [
|
|
43
|
+
"bg-warning text-warning-foreground hover:brightness-90 active:brightness-90",
|
|
44
|
+
heldNeutral,
|
|
45
|
+
],
|
|
46
|
+
link: ["text-(--nc-link) underline-offset-4 hover:underline", heldDim],
|
|
16
47
|
},
|
|
17
48
|
size: {
|
|
18
|
-
default: "h-control-height gap-
|
|
19
|
-
xs: "h-nadicode-control-height-xs gap-1 px-2 text-xs in-data-[slot=button-group]:rounded-sm has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
-
sm: "h-nadicode-control-height-sm gap-
|
|
21
|
-
lg: "h-nadicode-control-height-lg gap-
|
|
49
|
+
default: "h-control-height gap-0.75 px-button-padding-inline [@media(hover:hover)_and_(pointer:fine)]:min-h-control-height [&_[data-icon]_svg:not([class*='size-'])]:size-3.5",
|
|
50
|
+
xs: "h-nadicode-control-height-xs gap-1 px-2 text-button-xs in-data-[slot=button-group]:rounded-sm has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
51
|
+
sm: "h-nadicode-control-height-sm gap-0.75 px-button-padding-inline-sm in-data-[slot=button-group]:rounded-sm [&_svg:not([class*='size-'])]:size-3.5",
|
|
52
|
+
lg: "h-nadicode-control-height-lg gap-0.75 rounded-md px-button-padding-inline-lg text-button-lg",
|
|
22
53
|
icon: "size-control-height",
|
|
23
|
-
"icon-xs": "size-nadicode-control-height-xs in-data-[slot=button-group]:rounded-sm
|
|
54
|
+
"icon-xs": "size-nadicode-control-height-xs rounded-xs-plus in-data-[slot=button-group]:rounded-sm",
|
|
24
55
|
"icon-sm": "size-nadicode-control-height-sm in-data-[slot=button-group]:rounded-sm",
|
|
25
|
-
"icon-lg": "size-nadicode-control-height-lg",
|
|
56
|
+
"icon-lg": "size-nadicode-control-height-lg rounded-md",
|
|
57
|
+
},
|
|
58
|
+
shape: {
|
|
59
|
+
square: "",
|
|
60
|
+
rounded: "rounded-full px-3",
|
|
61
|
+
circle: "rounded-full",
|
|
26
62
|
},
|
|
27
63
|
},
|
|
28
64
|
defaultVariants: {
|
|
29
65
|
variant: "default",
|
|
30
66
|
size: "default",
|
|
67
|
+
shape: "square",
|
|
31
68
|
},
|
|
32
69
|
});
|
|
33
70
|
/**
|
|
34
|
-
* The button classes for an element that is not a `Button`, such as a
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
71
|
+
* The button classes for an element that is not a `Button`, such as a calendar's
|
|
72
|
+
* day arrows. They pass through `cn` as `Button`'s do, so a variant's border,
|
|
73
|
+
* fill or text replaces the base one instead of losing to it in the stylesheet:
|
|
74
|
+
* unmerged, the base `border-transparent` hides every outline edge. A link
|
|
75
|
+
* drawn as a button is a `ButtonLink`.
|
|
38
76
|
*/
|
|
39
77
|
function buttonVariants(props) {
|
|
40
78
|
return cn(buttonClasses(props));
|
|
41
79
|
}
|
|
80
|
+
function isIconSize(size) {
|
|
81
|
+
return size.startsWith("icon");
|
|
82
|
+
}
|
|
83
|
+
function isText(children) {
|
|
84
|
+
const parts = Children.toArray(children);
|
|
85
|
+
return parts.length > 0 && parts.every((part) => !isValidElement(part));
|
|
86
|
+
}
|
|
87
|
+
function ButtonLabel({ children, className, loading, loadingLabel, }) {
|
|
88
|
+
if (loadingLabel !== undefined) {
|
|
89
|
+
return (_jsx(PendingLabel, { className: className, pending: loading === true, pendingLabel: loadingLabel, children: children }));
|
|
90
|
+
}
|
|
91
|
+
return className === undefined ? children : _jsx("span", { className: className, children: children });
|
|
92
|
+
}
|
|
93
|
+
function ButtonContent({ children, loading, loadingLabel, prefix, size, suffix, }) {
|
|
94
|
+
const labelled = size !== "xs" && !isIconSize(size);
|
|
95
|
+
const labelBox = labelled && (loadingLabel !== undefined || isText(children));
|
|
96
|
+
return (_jsxs(_Fragment, { children: [prefix ? (_jsx("span", { className: cn("inline-flex shrink-0", labelled && "w-5 items-center justify-center"), "data-icon": "inline-start", children: prefix })) : null, _jsx(ButtonLabel, { className: labelBox ? "flex min-w-0 items-center gap-1.5 px-1.5" : undefined, loading: loading, loadingLabel: loadingLabel, children: children }), suffix ? (_jsx("span", { className: cn("inline-flex shrink-0", labelled && "me-0.75 w-3.5 items-center justify-center"), "data-icon": "inline-end", children: suffix })) : null] }));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The package's one button: a command, its label naming the result.
|
|
100
|
+
*
|
|
101
|
+
* @family Actions
|
|
102
|
+
* @when "Use `Button` for actions that mutate state (deploy, save, delete); use `ButtonLink` for navigation that changes the URL." (https://vercel.com/geist/button)
|
|
103
|
+
* Ours: one `default` per surface, the thing this page or dialog is for.
|
|
104
|
+
* @instead "Switch to a `Menu` or `Split Button` when more than one related action shares a row." (https://vercel.com/geist/button)
|
|
105
|
+
* Ours: a link inside a sentence is `TextLink`. A record's secondary commands go in `ActionMenu`. Appending to a list is a
|
|
106
|
+
* `LoadMoreButton`. An on/off value is a `Switch`.
|
|
107
|
+
* @behaviour "Default `Button` is primary." (https://vercel.com/geist/button)
|
|
108
|
+
* "Pass `type="secondary"` for the supporting action and `type="error"` for destructive confirmations." (https://vercel.com/geist/button)
|
|
109
|
+
* "`primary`, `success`, `ghost`, and `violet` are not valid `type` values." (https://vercel.com/geist/button)
|
|
110
|
+
* "For form submits, use `typeName="submit"`." (https://vercel.com/geist/button)
|
|
111
|
+
* "The HTML `type` attribute lives on `typeName`, not on `type`, which controls the visual variant." (https://vercel.com/geist/button)
|
|
112
|
+
* Ours: the look is `variant` (`default`, `secondary`, `outline`, `ghost`, `link`, `destructive` for
|
|
113
|
+
* Geist's error, `warning`) and `type` is the HTML type, `button` unless it submits.
|
|
114
|
+
* "The default size is medium." (https://vercel.com/geist/button)
|
|
115
|
+
* Ours: `xs`, `sm`, `default` (medium) and `lg`; `sm` and `xs` are for a control nested in dense
|
|
116
|
+
* content, such as a composer or an input group, never for chrome.
|
|
117
|
+
* "Pass `loading` instead of swapping in a spinner so the button stays focusable and announces the busy state to assistive tech." (https://vercel.com/geist/button)
|
|
118
|
+
* Ours: `loading` is the only busy state: the button keeps its place and focus, says `loadingLabel`
|
|
119
|
+
* in the label's place, ignores a second press and shows no spinner.
|
|
120
|
+
* "Disable a button only when the action is impossible right now (missing input, insufficient permission); pair with a `Tooltip` that explains why." (https://vercel.com/geist/button)
|
|
121
|
+
* Ours: the reason is written beside the button.
|
|
122
|
+
* "Icon-only buttons should include the `svgOnly` prop and an `aria-label`." (https://vercel.com/geist/button)
|
|
123
|
+
* Ours: an icon-only button takes an `icon` size and its icon as the child; `shape="circle"` is only
|
|
124
|
+
* for it. An icon with text passes as `prefix` or `suffix`.
|
|
125
|
+
* "Combination of `shape="rounded"` and the `shadow` prop, often used on marketing pages." (https://vercel.com/geist/button)
|
|
126
|
+
* Ours: `shape="rounded"` is a pill for a call to action that stands apart (a banner's or a
|
|
127
|
+
* scroller's), with no `shadow` prop.
|
|
128
|
+
* Ours: text children sit in a label box that adds 6 px each side to the padding; an element child
|
|
129
|
+
* (a `render` target, a row with a trailing `Kbd`) lays itself out and gets no box. Colour sits on
|
|
130
|
+
* the whole button for three looks: `default` is ink, `destructive` is the error fill for permanent
|
|
131
|
+
* loss (Delete project), `warning` is the amber fill for a disruptive command that can be undone
|
|
132
|
+
* (Pause project). `link` is the link colour as text, with the arrow as `suffix` when the
|
|
133
|
+
* destination is outside the product. `outline` and `secondary` are neutral with a hairline edge,
|
|
134
|
+
* `ghost` has no chrome, and no look puts a hue on its edge. Held (disabled or `loading`), a filled
|
|
135
|
+
* look drops its hue to the muted fill, the muted text and the hairline, so it reads as unavailable;
|
|
136
|
+
* `ghost` and `link` dim instead. Pressed looks like hover, with no movement.
|
|
137
|
+
* @words "Title Case the label and name what happens: `Deploy Project`, `Invite Member`, `Rotate Key`." (https://vercel.com/geist/button)
|
|
138
|
+
* "Avoid bare verbs (`Submit`) and generic confirms (`OK`, `Confirm`)." (https://vercel.com/geist/button)
|
|
139
|
+
* "Destructive buttons follow `Verb + Noun` and pair 1:1 with their toast: `Delete Project` then `Project deleted`." (https://vercel.com/geist/button)
|
|
140
|
+
* "Mode-switch buttons append `Instead`: `Use a Recovery Code Instead`." (https://vercel.com/geist/button)
|
|
141
|
+
* Ours: sentence case, not Title Case: *Invite member*, *Remove mailbox* then *Mailbox removed*, *Use a
|
|
142
|
+
* recovery code instead*. `loadingLabel` is the same words in the -ing form: *Inviting member*. Italian
|
|
143
|
+
* runs about a third longer (*Rimuovi casella*), so a footer leaves room and a label never wraps.
|
|
144
|
+
* @access "Icon-only buttons require both `svgOnly` and `aria-label`; the validator throws without them." (https://vercel.com/geist/button)
|
|
145
|
+
* "The `aria-label` names the action and the target (`Copy deployment URL`), not the icon (`Copy`)." (https://vercel.com/geist/button)
|
|
146
|
+
* "Don’t set `aria-label` on a button that already has visible text; it overrides the label and creates a screen-reader mismatch." (https://vercel.com/geist/button)
|
|
147
|
+
* Ours: the type requires `aria-label` or `aria-labelledby` on an icon-only button. A native
|
|
148
|
+
* `button`, `type="button"` unless it submits. `loading` sets `aria-busy`. Focus shows the base
|
|
149
|
+
* outline in one colour for every look; nothing repaints it.
|
|
150
|
+
*/
|
|
151
|
+
function Button({ children, className, disabled, focusableWhenDisabled, loading, loadingLabel, prefix, shape = "square", size = "default", suffix, variant = "default", ...props }) {
|
|
152
|
+
const busy = loading === true;
|
|
153
|
+
return (_jsx(ButtonPrimitive, { "data-slot": "button", "data-size": size, "data-variant": variant, "aria-busy": busy || undefined, className: buttonVariants({ variant, size, shape, className }), disabled: disabled || busy, focusableWhenDisabled: focusableWhenDisabled || busy, ...props, children: _jsx(ButtonContent, { loading: loading, loadingLabel: loadingLabel, prefix: prefix, size: size, suffix: suffix, children: children }) }));
|
|
154
|
+
}
|
|
155
|
+
function refuseClick(event) {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
}
|
|
42
158
|
/**
|
|
43
|
-
*
|
|
159
|
+
* A link drawn as a button, with the props of `Button`.
|
|
44
160
|
*
|
|
45
161
|
* @family Actions
|
|
46
|
-
* @when
|
|
47
|
-
*
|
|
48
|
-
* @instead
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* @
|
|
56
|
-
*
|
|
57
|
-
* and a label never wraps.
|
|
58
|
-
* @access A native `button`, `type="button"` unless it submits. An icon-only button carries an
|
|
59
|
-
* `aria-label` naming action and target. Focus is the 2 px ink outline at 2 px offset, drawn once
|
|
60
|
-
* by the base layer, never repainted.
|
|
162
|
+
* @when "Use `Button` for actions that mutate state (deploy, save, delete); use `ButtonLink` for navigation that changes the URL." (https://vercel.com/geist/button)
|
|
163
|
+
* Ours: a sign-in, a download, a record's page. It is read as a link and drawn as a button.
|
|
164
|
+
* @instead A command that changes something is a `Button`. A link inside a sentence is `TextLink`.
|
|
165
|
+
* The product's router link keeps its own behaviour through `render`: `render={<Link href="/agents" />}`.
|
|
166
|
+
* @behaviour "Use `ButtonLink` for links with the same props as `Button`." (https://vercel.com/geist/button)
|
|
167
|
+
* Ours: takes the looks, sizes, `prefix`, `suffix` and `loading` of `Button`. While it is `loading`
|
|
168
|
+
* or `disabled` it ignores a click and stays focusable.
|
|
169
|
+
* @words Sentence case, verb + noun naming the destination or the result: *Open Portal*, *Download
|
|
170
|
+
* invoice*. A destination outside the product ends in the arrow as `suffix`.
|
|
171
|
+
* @access A native `a` with an `href`, never `role="button"`. An icon-only link carries an
|
|
172
|
+
* `aria-label` or `aria-labelledby` naming destination, and the type requires it.
|
|
61
173
|
*/
|
|
62
|
-
function
|
|
63
|
-
|
|
174
|
+
function ButtonLink({ children, className, disabled, loading, loadingLabel, onClick, prefix, render, shape = "square", size = "default", suffix, variant = "default", ...props }) {
|
|
175
|
+
const busy = loading === true;
|
|
176
|
+
const blocked = busy || disabled === true;
|
|
177
|
+
return useRender({
|
|
178
|
+
defaultTagName: "a",
|
|
179
|
+
render,
|
|
180
|
+
state: { slot: "button", size, variant },
|
|
181
|
+
props: mergeProps({
|
|
182
|
+
"aria-busy": busy || undefined,
|
|
183
|
+
"aria-disabled": blocked || undefined,
|
|
184
|
+
className: buttonVariants({ variant, size, shape, className }),
|
|
185
|
+
children: (_jsx(ButtonContent, { loading: loading, loadingLabel: loadingLabel, prefix: prefix, size: size, suffix: suffix, children: children })),
|
|
186
|
+
onClick: blocked ? refuseClick : onClick,
|
|
187
|
+
}, props),
|
|
188
|
+
});
|
|
64
189
|
}
|
|
65
|
-
export { Button, buttonVariants };
|
|
190
|
+
export { Button, ButtonLink, buttonVariants };
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { type DayButton, type Locale, type PropsBase, type PropsRange, type PropsSingle } from "react-day-picker";
|
|
3
|
+
import { buttonVariants } from "./button.js";
|
|
4
|
+
type Controlled<Props extends PropsSingle | PropsRange> = Omit<Props, "onSelect" | "selected"> & {
|
|
5
|
+
/** The chosen day or range, `undefined` before the first choice. */
|
|
6
|
+
selected: Props["selected"];
|
|
7
|
+
/** Called with the new choice. */
|
|
8
|
+
onSelect: NonNullable<Props["onSelect"]>;
|
|
9
|
+
};
|
|
10
|
+
type CalendarProps = PropsBase & (Controlled<PropsSingle> | Controlled<PropsRange>) & {
|
|
11
|
+
buttonVariant?: NonNullable<Parameters<typeof buttonVariants>[0]>["variant"];
|
|
12
|
+
/** The first day that can be picked. */
|
|
13
|
+
minValue?: Date | undefined;
|
|
14
|
+
/** The last day that can be picked. */
|
|
15
|
+
maxValue?: Date | undefined;
|
|
16
|
+
};
|
|
4
17
|
/**
|
|
5
18
|
* A month grid for choosing a day or a range of days.
|
|
6
19
|
*
|
|
7
20
|
* @family Inputs
|
|
8
|
-
* @when
|
|
9
|
-
* `DateRangeControl` in its toolbar, which
|
|
10
|
-
* @instead
|
|
11
|
-
* a recurring schedule is its own field, not a calendar.
|
|
12
|
-
* @behaviour
|
|
13
|
-
*
|
|
14
|
-
* @words
|
|
15
|
-
* pair a URL stores.
|
|
16
|
-
* @access
|
|
17
|
-
* opens and back to its trigger when it closes
|
|
21
|
+
* @when "Pick `<Calendar>` for analytics ranges and any picker where day-of-week and month context matter." "Provide `<Calendar.Presets>` for the common ranges (`Last 7 Days`, `Month to Date`) so users land on the right window in one click." (https://vercel.com/geist/calendar)
|
|
22
|
+
* Ours: a chart or a report's window is one `DateRangeControl` in its toolbar, which puts the common windows as buttons beside this grid.
|
|
23
|
+
* @instead "For ISO dates pasted whole or relative shorthand like `7d`, use a free-form `Input`." (https://vercel.com/geist/calendar)
|
|
24
|
+
* Ours: a time of day or a recurring schedule is its own field, not a calendar.
|
|
25
|
+
* @behaviour "Set `min` and `max` to the data window so users can’t pick outside the retention range." "Support arrow-key day navigation, `Shift` + arrow for week jumps, and `Page Up` / `Page Down` for month jumps." (https://vercel.com/geist/calendar)
|
|
26
|
+
* Ours: `min` and `max` are `minValue` and `maxValue`: a day outside the window cannot be picked and the month arrows stop at it. Up and Down move a week without `Shift`, Left and Right a day, Page Up and Page Down a month. `mode`, `selected` and `onSelect` are required: the grid always chooses and is controlled. The month's name sits left, the round previous and next buttons right, and the weekday letters start 42 px below the top; a day is a 32 px square centred in its column of a 256 px grid, 8 px between weeks and 15 px between the weekday letters and the first week. The first click starts a range, the second ends it. Monday first in Italian. Colour: the ends of a range are ink over a muted band, today is the one blue day (a solid info fill, unless selected), everything else is neutral, Saturday and Sunday are a step lighter than the weekdays and days of other months lighter still, and hover draws only a hairline edge. A calendar that opens from a trigger sits 8 px below it, 280 px wide with its own 12 px padding and no padding of the popover around it.
|
|
27
|
+
* @words "Default to the user’s locale and timezone; never silently render UTC for a US-Pacific viewer." (https://vercel.com/geist/calendar)
|
|
28
|
+
* Ours: dates are written in the reader's locale (*7 Oct – 13 Oct*, *7–13 ott*), never the ISO pair a URL stores.
|
|
29
|
+
* @access "Trap focus inside the popover so Tab cycles day cells and presets instead of the page behind it." "Announce range changes through `aria-live="polite"` so a screen reader hears `From Apr 1 to Apr 28` after the second click." (https://vercel.com/geist/calendar)
|
|
30
|
+
* Ours: a grid of day buttons, each named with its full date. Focus goes into the grid when it opens and back to its trigger when it closes. The selected days are marked as selected; the control that owns the grid announces the range.
|
|
18
31
|
*/
|
|
19
|
-
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, locale, formatters, components, ...props }: React.
|
|
20
|
-
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
21
|
-
}): React.JSX.Element;
|
|
32
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, locale, formatters, components, disabled, maxValue, minValue, ...props }: CalendarProps): React.JSX.Element;
|
|
22
33
|
declare function CalendarDayButton({ className, day, modifiers, locale, ...props }: React.ComponentProps<typeof DayButton> & {
|
|
23
34
|
locale?: Partial<Locale>;
|
|
24
35
|
}): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/components/calendar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/components/calendar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,MAAM,EAEX,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,KAAK,UAAU,CAAC,KAAK,SAAS,WAAW,GAAG,UAAU,IAAI,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAC/F,oEAAoE;IACpE,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC5B,kCAAkC;IAClC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;CAC1C,CAAC;AAEF,KAAK,aAAa,GAAG,SAAS,GAC5B,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG;IACnD,aAAa,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC7E,wCAAwC;IACxC,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,UAAU,EACV,eAAsB,EACtB,aAAuB,EACvB,aAAuB,EACvB,MAAM,EACN,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,qBA4Gf;AA4CD,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,EACH,SAAS,EACT,MAAM,EACN,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,qBAkCvE;AAED,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,38 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
4
|
+
import { DayPicker, getDefaultClassNames, useDayPicker, } from "react-day-picker";
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
|
-
import {
|
|
6
|
+
import { buttonVariants } from "./button.js";
|
|
7
7
|
import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from "lucide-react";
|
|
8
8
|
/**
|
|
9
9
|
* A month grid for choosing a day or a range of days.
|
|
10
10
|
*
|
|
11
11
|
* @family Inputs
|
|
12
|
-
* @when
|
|
13
|
-
* `DateRangeControl` in its toolbar, which
|
|
14
|
-
* @instead
|
|
15
|
-
* a recurring schedule is its own field, not a calendar.
|
|
16
|
-
* @behaviour
|
|
17
|
-
*
|
|
18
|
-
* @words
|
|
19
|
-
* pair a URL stores.
|
|
20
|
-
* @access
|
|
21
|
-
* opens and back to its trigger when it closes
|
|
12
|
+
* @when "Pick `<Calendar>` for analytics ranges and any picker where day-of-week and month context matter." "Provide `<Calendar.Presets>` for the common ranges (`Last 7 Days`, `Month to Date`) so users land on the right window in one click." (https://vercel.com/geist/calendar)
|
|
13
|
+
* Ours: a chart or a report's window is one `DateRangeControl` in its toolbar, which puts the common windows as buttons beside this grid.
|
|
14
|
+
* @instead "For ISO dates pasted whole or relative shorthand like `7d`, use a free-form `Input`." (https://vercel.com/geist/calendar)
|
|
15
|
+
* Ours: a time of day or a recurring schedule is its own field, not a calendar.
|
|
16
|
+
* @behaviour "Set `min` and `max` to the data window so users can’t pick outside the retention range." "Support arrow-key day navigation, `Shift` + arrow for week jumps, and `Page Up` / `Page Down` for month jumps." (https://vercel.com/geist/calendar)
|
|
17
|
+
* Ours: `min` and `max` are `minValue` and `maxValue`: a day outside the window cannot be picked and the month arrows stop at it. Up and Down move a week without `Shift`, Left and Right a day, Page Up and Page Down a month. `mode`, `selected` and `onSelect` are required: the grid always chooses and is controlled. The month's name sits left, the round previous and next buttons right, and the weekday letters start 42 px below the top; a day is a 32 px square centred in its column of a 256 px grid, 8 px between weeks and 15 px between the weekday letters and the first week. The first click starts a range, the second ends it. Monday first in Italian. Colour: the ends of a range are ink over a muted band, today is the one blue day (a solid info fill, unless selected), everything else is neutral, Saturday and Sunday are a step lighter than the weekdays and days of other months lighter still, and hover draws only a hairline edge. A calendar that opens from a trigger sits 8 px below it, 280 px wide with its own 12 px padding and no padding of the popover around it.
|
|
18
|
+
* @words "Default to the user’s locale and timezone; never silently render UTC for a US-Pacific viewer." (https://vercel.com/geist/calendar)
|
|
19
|
+
* Ours: dates are written in the reader's locale (*7 Oct – 13 Oct*, *7–13 ott*), never the ISO pair a URL stores.
|
|
20
|
+
* @access "Trap focus inside the popover so Tab cycles day cells and presets instead of the page behind it." "Announce range changes through `aria-live="polite"` so a screen reader hears `From Apr 1 to Apr 28` after the second click." (https://vercel.com/geist/calendar)
|
|
21
|
+
* Ours: a grid of day buttons, each named with its full date. Focus goes into the grid when it opens and back to its trigger when it closes. The selected days are marked as selected; the control that owns the grid announces the range.
|
|
22
22
|
*/
|
|
23
|
-
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", locale, formatters, components, ...props }) {
|
|
23
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", locale, formatters, components, disabled, maxValue, minValue, ...props }) {
|
|
24
24
|
const defaultClassNames = getDefaultClassNames();
|
|
25
|
-
|
|
25
|
+
const disabledDays = disabled === undefined ? [] : [disabled].flat();
|
|
26
|
+
if (minValue)
|
|
27
|
+
disabledDays.push({ before: minValue });
|
|
28
|
+
if (maxValue)
|
|
29
|
+
disabledDays.push({ after: maxValue });
|
|
30
|
+
return (_jsx(DayPicker, { showOutsideDays: showOutsideDays, disabled: disabledDays, startMonth: minValue, endMonth: maxValue, className: cn("group/calendar bg-background p-3 [--cell-radius:var(--radius-xs-plus)] [--cell-size:var(--spacing-touch-target)] [@media(hover:hover)_and_(pointer:fine)]:[--cell-size:--spacing(8)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw `rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw `rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className), captionLayout: captionLayout, locale: locale, formatters: {
|
|
26
31
|
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
27
32
|
...formatters,
|
|
28
33
|
}, classNames: {
|
|
29
34
|
root: cn("w-fit", defaultClassNames.root),
|
|
30
35
|
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
31
|
-
month: cn("flex w-
|
|
32
|
-
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-
|
|
33
|
-
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
34
|
-
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
35
|
-
month_caption: cn("flex h-(--cell-size) w-full items-center justify-
|
|
36
|
+
month: cn("flex w-[max(16rem,calc(var(--cell-size)*7))] flex-col gap-2.5", defaultClassNames.month),
|
|
37
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-end", defaultClassNames.nav),
|
|
38
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant, size: "icon", shape: "circle" }), "size-(--cell-size) p-0 text-muted-foreground select-none hover:bg-transparent hover:text-foreground aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
39
|
+
button_next: cn(buttonVariants({ variant: buttonVariant, size: "icon", shape: "circle" }), "size-(--cell-size) p-0 text-muted-foreground select-none hover:bg-transparent hover:text-foreground aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
40
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-start", defaultClassNames.month_caption),
|
|
36
41
|
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
37
42
|
dropdown_root: cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root),
|
|
38
43
|
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
@@ -40,52 +45,61 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
40
45
|
? "text-sm"
|
|
41
46
|
: "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
42
47
|
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
43
|
-
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
44
|
-
weekday: cn("flex-1 rounded-(--cell-radius) text-
|
|
48
|
+
weekdays: cn("mb-1.75 flex", defaultClassNames.weekdays),
|
|
49
|
+
weekday: cn("flex-1 rounded-(--cell-radius) text-caption leading-4.5 font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
45
50
|
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
46
51
|
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
47
52
|
week_number: cn("text-label-sm text-muted-foreground select-none", defaultClassNames.week_number),
|
|
48
|
-
day: cn("group/day relative
|
|
49
|
-
? "[&:nth-child(2)[data-selected=true]
|
|
50
|
-
: "[&:first-child[data-selected=true]
|
|
51
|
-
range_start: cn("relative isolate z-0
|
|
52
|
-
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
53
|
-
range_end: cn("relative isolate z-0
|
|
54
|
-
today: cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
53
|
+
day: cn("group/day relative flex h-(--cell-size) flex-1 items-center justify-center p-0 text-center select-none [&:last-child[data-selected=true]]:rounded-r-(--cell-radius)", props.showWeekNumber
|
|
54
|
+
? "[&:nth-child(2)[data-selected=true]]:rounded-l-(--cell-radius)"
|
|
55
|
+
: "[&:first-child[data-selected=true]]:rounded-l-(--cell-radius)", defaultClassNames.day),
|
|
56
|
+
range_start: cn("relative isolate z-0 after:absolute after:inset-y-0 after:start-1/2 after:end-0 after:bg-muted", defaultClassNames.range_start),
|
|
57
|
+
range_middle: cn("rounded-none bg-muted", defaultClassNames.range_middle),
|
|
58
|
+
range_end: cn("relative isolate z-0 before:absolute before:inset-y-0 before:start-0 before:end-1/2 before:bg-muted", defaultClassNames.range_end),
|
|
55
59
|
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
56
60
|
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
57
61
|
hidden: cn("invisible", defaultClassNames.hidden),
|
|
58
62
|
...classNames,
|
|
59
63
|
}, components: {
|
|
60
|
-
Root:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (orientation === "left") {
|
|
65
|
-
return _jsx(ChevronLeftIcon, { className: cn("size-4", className), ...props });
|
|
66
|
-
}
|
|
67
|
-
if (orientation === "right") {
|
|
68
|
-
return _jsx(ChevronRightIcon, { className: cn("size-4", className), ...props });
|
|
69
|
-
}
|
|
70
|
-
return _jsx(ChevronDownIcon, { className: cn("size-4", className), ...props });
|
|
71
|
-
},
|
|
72
|
-
DayButton: ({ ...props }) => _jsx(CalendarDayButton, { locale: locale, ...props }),
|
|
73
|
-
WeekNumber: ({ children, ...props }) => {
|
|
74
|
-
return (_jsx("td", { ...props, children: _jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: children }) }));
|
|
75
|
-
},
|
|
64
|
+
Root: CalendarRoot,
|
|
65
|
+
Chevron: CalendarChevron,
|
|
66
|
+
DayButton: CalendarDay,
|
|
67
|
+
WeekNumber: CalendarWeekNumber,
|
|
76
68
|
...components,
|
|
77
69
|
}, ...props }));
|
|
78
70
|
}
|
|
71
|
+
// The parts the grid draws are module components, so a render of the calendar keeps its days
|
|
72
|
+
// mounted: a part made anew on each render would remount the grid under the pointer.
|
|
73
|
+
function CalendarRoot({ className, rootRef, ...props }) {
|
|
74
|
+
return _jsx("div", { "data-slot": "calendar", ref: rootRef, className: cn(className), ...props });
|
|
75
|
+
}
|
|
76
|
+
function CalendarChevron({ className, orientation, ...props }) {
|
|
77
|
+
if (orientation === "left") {
|
|
78
|
+
return _jsx(ChevronLeftIcon, { className: cn("size-4", className), ...props });
|
|
79
|
+
}
|
|
80
|
+
if (orientation === "right") {
|
|
81
|
+
return _jsx(ChevronRightIcon, { className: cn("size-4", className), ...props });
|
|
82
|
+
}
|
|
83
|
+
return _jsx(ChevronDownIcon, { className: cn("size-4", className), ...props });
|
|
84
|
+
}
|
|
85
|
+
function CalendarDay(props) {
|
|
86
|
+
const { dayPickerProps } = useDayPicker();
|
|
87
|
+
return _jsx(CalendarDayButton, { locale: dayPickerProps.locale, ...props });
|
|
88
|
+
}
|
|
89
|
+
function CalendarWeekNumber({ children, ...props }) {
|
|
90
|
+
return (_jsx("td", { ...props, children: _jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: children }) }));
|
|
91
|
+
}
|
|
79
92
|
function CalendarDayButton({ className, day, modifiers, locale, ...props }) {
|
|
80
93
|
const defaultClassNames = getDefaultClassNames();
|
|
81
94
|
const ref = React.useRef(null);
|
|
95
|
+
const weekend = [0, 6].includes(day.date.getDay());
|
|
82
96
|
React.useEffect(() => {
|
|
83
97
|
if (modifiers.focused)
|
|
84
98
|
ref.current?.focus();
|
|
85
99
|
}, [modifiers.focused]);
|
|
86
|
-
return (_jsx(
|
|
100
|
+
return (_jsx("button", { ref: ref, type: "button", "data-day": day.date.toLocaleDateString(locale?.code), "data-selected-single": modifiers.selected &&
|
|
87
101
|
!modifiers.range_start &&
|
|
88
102
|
!modifiers.range_end &&
|
|
89
|
-
!modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, className: cn("relative isolate z-10 flex
|
|
103
|
+
!modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, "data-today": modifiers.today && !modifiers.selected, "data-weekend": weekend && !modifiers.today && !modifiers.selected && !modifiers.outside, className: cn(buttonVariants({ variant: "ghost", size: "icon" }), "relative isolate z-10 flex size-(--cell-size) shrink-0 flex-col gap-1 border border-transparent leading-none font-normal hover:border-foreground/20 hover:bg-transparent data-[today=true]:bg-info data-[today=true]:text-info-foreground data-[today=true]:hover:bg-info data-[weekend=true]:text-foreground/80 group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className), ...props }));
|
|
90
104
|
}
|
|
91
105
|
export { Calendar, CalendarDayButton };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
-
type CardRowColumns = 2 | 3 | 4 | "auto";
|
|
2
|
+
type CardRowColumns = 2 | 3 | 4 | 5 | "auto";
|
|
3
3
|
type CardRowFrom = "sm" | "md" | "lg" | "xl";
|
|
4
4
|
/**
|
|
5
5
|
* The row sibling cards sit in.
|
|
@@ -14,10 +14,18 @@ type CardRowFrom = "sm" | "md" | "lg" | "xl";
|
|
|
14
14
|
* the default rhythm is wrong. Appearance stays with `Card`.
|
|
15
15
|
*
|
|
16
16
|
* @family Data
|
|
17
|
-
* @when Two to
|
|
18
|
-
* @instead A list of records is `Item` or a table. A single card needs no row.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* @when Two to five sibling cards side by side: the KPIs of an overview, a pair of charts.
|
|
18
|
+
* @instead A list of records is `Item` or a table. A single card needs no row. Geist's ruled
|
|
19
|
+
* `Grid`, with visible guide lines, crosses and cell padding, is not built:
|
|
20
|
+
* "Use Grid for two-dimensional cell-and-guide layouts in marketing pages, docs landing pages, and feature breakdowns where the rule lines and cell borders are part of the design." (https://vercel.com/geist/grid)
|
|
21
|
+
* "For plain n-column responsive content (cards, lists), use Tailwind `grid grid-cols-*` utilities directly; Grid is overkill when guides aren’t visible." (https://vercel.com/geist/grid)
|
|
22
|
+
* Ours: this is that plain n-column case.
|
|
23
|
+
* @behaviour "Set `columns` and `rows` at all three breakpoints so cells reflow predictably between mobile, tablet, and desktop." (https://vercel.com/geist/grid)
|
|
24
|
+
* Ours: one column below `from`, then `columns` columns, 16 px apart, with no `rows`; `auto` gives
|
|
25
|
+
* each card an equal share, and `5` sets two by two with the fifth across, then three over two
|
|
26
|
+
* from `lg`, then all five in one row from `xl` (1280 px), as OpenRouter's Activity sets its five
|
|
27
|
+
* tiles, never with a hole beside the last card. Each card fills its cell, so the bottom edge is even. The row is
|
|
28
|
+
* neutral; it tints nothing.
|
|
21
29
|
* @words None of its own.
|
|
22
30
|
* @access A layout container; reading order is source order.
|
|
23
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-row.d.ts","sourceRoot":"","sources":["../../src/components/card-row.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAItD,KAAK,cAAc,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"card-row.d.ts","sourceRoot":"","sources":["../../src/components/card-row.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAItD,KAAK,cAAc,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;AAC7C,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAwC7C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,iBAAS,OAAO,CAAC,EACf,SAAS,EACT,OAAW,EACX,IAAW,EACX,MAAM,EACN,GAAG,KAAK,EACT,EAAE,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACnC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,8FAgBA;AAED,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,CAAC"}
|
|
@@ -3,33 +3,39 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* One column below `from`, then `columns` columns — `auto` giving each card an
|
|
6
|
-
* equal share of the row however many there are.
|
|
7
|
-
*
|
|
6
|
+
* equal share of the row however many there are. `5` steps up as the width allows:
|
|
7
|
+
* two by two with the fifth across from `from`, three over two from `lg` (the pair
|
|
8
|
+
* sharing the width of the three), and all five in one row from `xl`, 1280 px.
|
|
9
|
+
* Written out so every class string is literal and the Tailwind scanner can see it.
|
|
8
10
|
*/
|
|
9
11
|
const columnClasses = {
|
|
10
12
|
sm: {
|
|
11
13
|
2: "sm:grid-cols-2",
|
|
12
14
|
3: "sm:grid-cols-3",
|
|
13
15
|
4: "sm:grid-cols-4",
|
|
14
|
-
|
|
16
|
+
5: "sm:grid-cols-2 sm:max-lg:[&>:nth-child(5)]:col-span-2 lg:grid-cols-6 lg:max-xl:[&>:nth-child(-n+3)]:col-span-2 lg:max-xl:[&>:nth-child(n+4)]:col-span-3 xl:grid-cols-5",
|
|
17
|
+
auto: "sm:auto-cols-fr sm:grid-flow-col",
|
|
15
18
|
},
|
|
16
19
|
md: {
|
|
17
20
|
2: "md:grid-cols-2",
|
|
18
21
|
3: "md:grid-cols-3",
|
|
19
22
|
4: "md:grid-cols-4",
|
|
20
|
-
|
|
23
|
+
5: "md:grid-cols-2 md:max-lg:[&>:nth-child(5)]:col-span-2 lg:grid-cols-6 lg:max-xl:[&>:nth-child(-n+3)]:col-span-2 lg:max-xl:[&>:nth-child(n+4)]:col-span-3 xl:grid-cols-5",
|
|
24
|
+
auto: "md:auto-cols-fr md:grid-flow-col",
|
|
21
25
|
},
|
|
22
26
|
lg: {
|
|
23
27
|
2: "lg:grid-cols-2",
|
|
24
28
|
3: "lg:grid-cols-3",
|
|
25
29
|
4: "lg:grid-cols-4",
|
|
26
|
-
|
|
30
|
+
5: "lg:grid-cols-6 lg:max-xl:[&>:nth-child(-n+3)]:col-span-2 lg:max-xl:[&>:nth-child(n+4)]:col-span-3 xl:grid-cols-5",
|
|
31
|
+
auto: "lg:auto-cols-fr lg:grid-flow-col",
|
|
27
32
|
},
|
|
28
33
|
xl: {
|
|
29
34
|
2: "xl:grid-cols-2",
|
|
30
35
|
3: "xl:grid-cols-3",
|
|
31
36
|
4: "xl:grid-cols-4",
|
|
32
|
-
|
|
37
|
+
5: "xl:grid-cols-5",
|
|
38
|
+
auto: "xl:auto-cols-fr xl:grid-flow-col",
|
|
33
39
|
},
|
|
34
40
|
};
|
|
35
41
|
/**
|
|
@@ -45,10 +51,18 @@ const columnClasses = {
|
|
|
45
51
|
* the default rhythm is wrong. Appearance stays with `Card`.
|
|
46
52
|
*
|
|
47
53
|
* @family Data
|
|
48
|
-
* @when Two to
|
|
49
|
-
* @instead A list of records is `Item` or a table. A single card needs no row.
|
|
50
|
-
*
|
|
51
|
-
*
|
|
54
|
+
* @when Two to five sibling cards side by side: the KPIs of an overview, a pair of charts.
|
|
55
|
+
* @instead A list of records is `Item` or a table. A single card needs no row. Geist's ruled
|
|
56
|
+
* `Grid`, with visible guide lines, crosses and cell padding, is not built:
|
|
57
|
+
* "Use Grid for two-dimensional cell-and-guide layouts in marketing pages, docs landing pages, and feature breakdowns where the rule lines and cell borders are part of the design." (https://vercel.com/geist/grid)
|
|
58
|
+
* "For plain n-column responsive content (cards, lists), use Tailwind `grid grid-cols-*` utilities directly; Grid is overkill when guides aren’t visible." (https://vercel.com/geist/grid)
|
|
59
|
+
* Ours: this is that plain n-column case.
|
|
60
|
+
* @behaviour "Set `columns` and `rows` at all three breakpoints so cells reflow predictably between mobile, tablet, and desktop." (https://vercel.com/geist/grid)
|
|
61
|
+
* Ours: one column below `from`, then `columns` columns, 16 px apart, with no `rows`; `auto` gives
|
|
62
|
+
* each card an equal share, and `5` sets two by two with the fifth across, then three over two
|
|
63
|
+
* from `lg`, then all five in one row from `xl` (1280 px), as OpenRouter's Activity sets its five
|
|
64
|
+
* tiles, never with a hole beside the last card. Each card fills its cell, so the bottom edge is even. The row is
|
|
65
|
+
* neutral; it tints nothing.
|
|
52
66
|
* @words None of its own.
|
|
53
67
|
* @access A layout container; reading order is source order.
|
|
54
68
|
*/
|