@jcsoftdev/ui 0.5.0 → 0.7.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/CHANGELOG.md +361 -0
- package/README.md +31 -5
- package/bin/ui-theme.mjs +40 -6
- package/dist/ai/code-block/code-block.js +1 -1
- package/dist/atoms/avatar/avatar.d.ts +6 -1
- package/dist/atoms/avatar/avatar.js +3 -2
- package/dist/atoms/big-date/big-date.js +2 -2
- package/dist/atoms/button/button.d.ts +6 -1
- package/dist/atoms/button/button.js +2 -2
- package/dist/atoms/chip/chip.d.ts +5 -0
- package/dist/atoms/chip/chip.js +3 -3
- package/dist/atoms/icon-button/icon-button.js +1 -1
- package/dist/atoms/internal/hit-area.d.ts +5 -4
- package/dist/atoms/internal/hit-area.js +1 -1
- package/dist/atoms/progress/index.d.ts +1 -1
- package/dist/atoms/progress/index.js +4 -1
- package/dist/atoms/progress/progress.d.ts +6 -1
- package/dist/atoms/progress/progress.js +19 -1
- package/dist/atoms/radio-group/radio-group.js +1 -1
- package/dist/atoms/status-pill/status-pill.d.ts +16 -5
- package/dist/atoms/status-pill/status-pill.js +43 -18
- package/dist/brand/logo-forge.js +1 -1
- package/dist/charts/candlestick-chart/candlestick-chart.js +2 -2
- package/dist/charts/chart-grid/chart-grid.js +2 -2
- package/dist/charts/chord-chart/chord-chart.js +1 -1
- package/dist/charts/core/axes.js +2 -2
- package/dist/charts/core/cartesian/annotations.js +2 -2
- package/dist/charts/core/cartesian/marks.js +1 -1
- package/dist/charts/core/distribution/marks.js +1 -1
- package/dist/charts/core/distribution/xy-points.js +1 -1
- package/dist/charts/core/export-menu.js +1 -1
- package/dist/charts/funnel-chart/funnel-chart.js +1 -1
- package/dist/charts/gantt-chart/gantt-chart.js +4 -4
- package/dist/charts/gantt-chart/gantt-marks.js +3 -3
- package/dist/charts/index.d.ts +2 -0
- package/dist/charts/index.js +2 -0
- package/dist/charts/maps/geo/map-data-table.js +1 -1
- package/dist/charts/polar-area-chart/polar-area-chart.js +1 -1
- package/dist/charts/radar-chart/radar-chart.js +1 -1
- package/dist/charts/stock-chart/stock-chart.js +1 -1
- package/dist/charts/stock-chart/stock-drawing-layer.js +3 -3
- package/dist/charts/stock-chart/stock-plot.js +2 -2
- package/dist/containers/chat-thread/chat-thread.d.ts +98 -0
- package/dist/containers/chat-thread/chat-thread.js +219 -0
- package/dist/containers/chat-thread/format.d.ts +20 -0
- package/dist/containers/chat-thread/format.js +50 -0
- package/dist/containers/chat-thread/index.d.ts +1 -0
- package/dist/containers/chat-thread/index.js +8 -0
- package/dist/containers/cols/cols.d.ts +1 -1
- package/dist/containers/cols/cols.js +7 -0
- package/dist/containers/comment/comment.js +1 -1
- package/dist/containers/context-rail/context-rail.d.ts +62 -0
- package/dist/containers/context-rail/context-rail.js +175 -0
- package/dist/containers/context-rail/index.d.ts +1 -0
- package/dist/containers/context-rail/index.js +6 -0
- package/dist/containers/dashboard/dashboard.d.ts +40 -0
- package/dist/containers/dashboard/dashboard.js +84 -0
- package/dist/containers/dashboard/index.d.ts +1 -0
- package/dist/containers/dashboard/index.js +14 -0
- package/dist/containers/data-grid/data-grid.demos.js +4 -4
- package/dist/containers/data-grid/data-grid.js +6 -6
- package/dist/containers/data-grid/filter-builder-editor.js +2 -2
- package/dist/containers/data-grid/grid-toolbar.js +1 -1
- package/dist/containers/data-grid/spreadsheet.demos.d.ts +1 -1
- package/dist/containers/data-grid/spreadsheet.demos.js +1 -1
- package/dist/containers/detail-header/detail-header.d.ts +24 -0
- package/dist/containers/detail-header/detail-header.js +32 -0
- package/dist/containers/detail-header/index.d.ts +1 -0
- package/dist/containers/detail-header/index.js +6 -0
- package/dist/containers/facts/facts.js +1 -1
- package/dist/containers/filter-bar/filter-bar.d.ts +58 -0
- package/dist/containers/filter-bar/filter-bar.js +123 -0
- package/dist/containers/filter-bar/index.d.ts +1 -0
- package/dist/containers/filter-bar/index.js +6 -0
- package/dist/containers/hbars/hbars.js +2 -2
- package/dist/containers/index.d.ts +9 -0
- package/dist/containers/index.js +9 -0
- package/dist/containers/kanban/kanban.d.ts +23 -2
- package/dist/containers/kanban/kanban.js +103 -21
- package/dist/containers/kanban/model.d.ts +12 -0
- package/dist/containers/kanban/model.js +8 -0
- package/dist/containers/kpi/kpi.js +1 -1
- package/dist/containers/kpi-group/kpi-group.d.ts +6 -1
- package/dist/containers/kpi-group/kpi-group.js +6 -2
- package/dist/containers/list-detail/index.d.ts +1 -1
- package/dist/containers/list-detail/index.js +4 -0
- package/dist/containers/list-detail/list-detail.d.ts +51 -3
- package/dist/containers/list-detail/list-detail.js +111 -15
- package/dist/containers/page/page.d.ts +17 -4
- package/dist/containers/page/page.js +33 -4
- package/dist/containers/page-header/back.d.ts +10 -0
- package/dist/containers/page-header/back.js +28 -0
- package/dist/containers/page-header/index.d.ts +1 -0
- package/dist/containers/page-header/index.js +1 -0
- package/dist/containers/page-header/page-header.d.ts +19 -2
- package/dist/containers/page-header/page-header.js +26 -2
- package/dist/containers/pagination/cursor-pagination.d.ts +28 -0
- package/dist/containers/pagination/cursor-pagination.js +48 -0
- package/dist/containers/pagination/index.d.ts +3 -0
- package/dist/containers/pagination/index.js +10 -0
- package/dist/containers/pagination/pagination.d.ts +52 -0
- package/dist/containers/pagination/pagination.js +216 -0
- package/dist/containers/pagination/range.d.ts +29 -0
- package/dist/containers/pagination/range.js +42 -0
- package/dist/containers/pagination/use-pagination.d.ts +18 -0
- package/dist/containers/pagination/use-pagination.js +22 -0
- package/dist/containers/responsive-list/responsive-list.d.ts +29 -3
- package/dist/containers/responsive-list/responsive-list.js +202 -82
- package/dist/containers/row-actions/index.d.ts +1 -0
- package/dist/containers/row-actions/index.js +4 -0
- package/dist/containers/row-actions/row-actions.d.ts +26 -0
- package/dist/containers/row-actions/row-actions.js +78 -0
- package/dist/containers/selectable-card/index.d.ts +1 -0
- package/dist/containers/selectable-card/index.js +6 -0
- package/dist/containers/selectable-card/selectable-card.d.ts +26 -0
- package/dist/containers/selectable-card/selectable-card.js +57 -0
- package/dist/containers/settings-layout/settings-layout.d.ts +24 -7
- package/dist/containers/settings-layout/settings-layout.js +63 -8
- package/dist/containers/shortcuts/shortcuts.js +1 -1
- package/dist/containers/table/cell-padding.d.ts +2 -0
- package/dist/containers/table/cell-padding.js +4 -0
- package/dist/containers/table/index.d.ts +1 -0
- package/dist/containers/table/index.js +8 -0
- package/dist/containers/table/sort.d.ts +14 -0
- package/dist/containers/table/sort.js +11 -0
- package/dist/containers/table/table-parts.d.ts +24 -0
- package/dist/containers/table/table-parts.js +52 -0
- package/dist/containers/table/table.d.ts +37 -3
- package/dist/containers/table/table.js +120 -19
- package/dist/containers/table-columns-menu/index.d.ts +1 -0
- package/dist/containers/table-columns-menu/index.js +6 -0
- package/dist/containers/table-columns-menu/table-columns-menu.d.ts +14 -0
- package/dist/containers/table-columns-menu/table-columns-menu.js +46 -0
- package/dist/dashboards/layout.d.ts +1 -27
- package/dist/dashboards/layout.js +8 -40
- package/dist/forms/chip-group/chip-group.d.ts +5 -0
- package/dist/forms/chip-group/chip-group.js +3 -1
- package/dist/forms/combobox/combobox.js +1 -1
- package/dist/forms/copy-field/copy-field.js +1 -1
- package/dist/forms/date-picker/date-picker.d.ts +3 -1
- package/dist/forms/date-picker/date-picker.js +4 -2
- package/dist/forms/date-picker/date-time-picker.d.ts +8 -2
- package/dist/forms/date-picker/date-time-picker.js +13 -2
- package/dist/forms/field/field.d.ts +9 -2
- package/dist/forms/field/field.js +18 -4
- package/dist/forms/fieldset/fieldset.d.ts +11 -0
- package/dist/forms/fieldset/fieldset.js +12 -0
- package/dist/forms/fieldset/index.d.ts +1 -0
- package/dist/forms/fieldset/index.js +4 -0
- package/dist/forms/form-footer/form-footer.d.ts +26 -0
- package/dist/forms/form-footer/form-footer.js +44 -0
- package/dist/forms/form-footer/index.d.ts +1 -0
- package/dist/forms/form-footer/index.js +4 -0
- package/dist/forms/form-grid/form-grid.d.ts +21 -4
- package/dist/forms/form-grid/form-grid.js +20 -3
- package/dist/forms/form-grid/index.d.ts +1 -1
- package/dist/forms/form-grid/index.js +6 -2
- package/dist/forms/form-section/form-section.d.ts +12 -0
- package/dist/forms/form-section/form-section.js +30 -0
- package/dist/forms/form-section/index.d.ts +1 -0
- package/dist/forms/form-section/index.js +4 -0
- package/dist/forms/index.d.ts +3 -0
- package/dist/forms/index.js +3 -0
- package/dist/forms/input/input.d.ts +6 -2
- package/dist/forms/input/input.js +4 -1
- package/dist/forms/internal/listbox-items.d.ts +1 -1
- package/dist/forms/internal/listbox-items.js +3 -2
- package/dist/forms/native-select/native-select.js +1 -1
- package/dist/forms/number-stepper/index.d.ts +1 -1
- package/dist/forms/number-stepper/number-stepper.d.ts +7 -0
- package/dist/forms/number-stepper/number-stepper.js +37 -6
- package/dist/forms/select/index.d.ts +1 -1
- package/dist/forms/select/select.d.ts +5 -2
- package/dist/forms/select/select.js +7 -2
- package/dist/forms/select-menu/select-menu.js +1 -1
- package/dist/forms/time-input/time-input.d.ts +4 -2
- package/dist/forms/time-input/time-input.js +3 -1
- package/dist/i18n/strings.d.ts +94 -0
- package/dist/i18n/strings.js +50 -0
- package/dist/motion/count-up.d.ts +20 -0
- package/dist/motion/count-up.js +59 -0
- package/dist/motion/cross-fade.d.ts +21 -0
- package/dist/motion/cross-fade.js +86 -0
- package/dist/motion/index.d.ts +5 -0
- package/dist/motion/index.js +14 -0
- package/dist/motion/model.d.ts +15 -0
- package/dist/motion/model.js +68 -0
- package/dist/motion/motion-styles.d.ts +1 -0
- package/dist/motion/motion-styles.js +35 -0
- package/dist/motion/reveal.d.ts +37 -0
- package/dist/motion/reveal.js +69 -0
- package/dist/motion/use-enter-phase.d.ts +11 -0
- package/dist/motion/use-enter-phase.js +40 -0
- package/dist/motion/use-highlight-row.d.ts +22 -0
- package/dist/motion/use-highlight-row.js +38 -0
- package/dist/navigation/tabs/tabs.js +1 -1
- package/dist/navigation/wizard/wizard.d.ts +4 -1
- package/dist/navigation/wizard/wizard.js +3 -0
- package/dist/overlays/alert-dialog/alert-dialog.js +8 -1
- package/dist/overlays/context-menu/context-menu.js +3 -1
- package/dist/overlays/dialog/dialog.d.ts +1 -0
- package/dist/overlays/dialog/dialog.js +11 -3
- package/dist/overlays/drawer/drawer.d.ts +18 -4
- package/dist/overlays/drawer/drawer.js +53 -4
- package/dist/overlays/drawer/index.d.ts +1 -1
- package/dist/overlays/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/overlays/dropdown-menu/dropdown-menu.js +5 -4
- package/dist/overlays/hover-card/hover-card.js +2 -0
- package/dist/overlays/popover/popover.js +2 -0
- package/dist/overlays/toaster/index.d.ts +1 -1
- package/dist/overlays/toaster/toast-store.d.ts +2 -0
- package/dist/overlays/toaster/toast-store.js +6 -1
- package/dist/overlays/toaster/toaster.d.ts +28 -2
- package/dist/overlays/toaster/toaster.js +86 -29
- package/dist/overlays/tooltip/tooltip.js +2 -0
- package/dist/primitives/use-presence.js +9 -0
- package/dist/shell/app-shell/app-shell.d.ts +8 -1
- package/dist/shell/app-shell/app-shell.js +50 -3
- package/dist/shell/index.d.ts +1 -0
- package/dist/shell/index.js +1 -0
- package/dist/shell/sidebar/sidebar.d.ts +17 -1
- package/dist/shell/sidebar/sidebar.js +126 -76
- package/dist/shell/topbar/topbar.d.ts +4 -2
- package/dist/shell/topbar/topbar.js +2 -0
- package/dist/showcase/operations-bento.js +2 -2
- package/dist/states/empty-state/empty-state.d.ts +10 -3
- package/dist/states/empty-state/empty-state.js +46 -5
- package/dist/states/error-state/error-state.js +1 -1
- package/dist/states/skeleton/skeleton.d.ts +16 -1
- package/dist/states/skeleton/skeleton.js +13 -5
- package/dist/utils/class-tokens.generated.js +4 -6
- package/dist/utils/focus-chain.d.ts +11 -0
- package/dist/utils/focus-chain.js +39 -0
- package/dist/utils/focus-rescue.d.ts +13 -0
- package/dist/utils/focus-rescue.js +48 -0
- package/dist/utils/list-navigation.d.ts +14 -0
- package/dist/utils/list-navigation.js +44 -0
- package/dist/utils/overlay-motion.d.ts +12 -0
- package/dist/utils/overlay-motion.js +14 -0
- package/dist/utils/use-container-width.d.ts +6 -0
- package/dist/utils/use-container-width.js +19 -0
- package/package.json +2 -2
- package/scripts/build-theme.mjs +46 -5
- package/src/ai/code-block/code-block.tsx +1 -1
- package/src/atoms/avatar/avatar.tsx +8 -2
- package/src/atoms/big-date/big-date.tsx +2 -2
- package/src/atoms/button/button.tsx +8 -3
- package/src/atoms/chip/chip.tsx +8 -3
- package/src/atoms/icon-button/icon-button.tsx +1 -1
- package/src/atoms/internal/hit-area.ts +5 -4
- package/src/atoms/progress/index.ts +8 -1
- package/src/atoms/progress/progress.tsx +30 -1
- package/src/atoms/radio-group/radio-group.tsx +1 -1
- package/src/atoms/status-pill/status-pill.tsx +59 -18
- package/src/brand/logo-forge.tsx +1 -1
- package/src/charts/candlestick-chart/candlestick-chart.tsx +2 -2
- package/src/charts/chart-grid/chart-grid.tsx +2 -2
- package/src/charts/chord-chart/chord-chart.tsx +1 -1
- package/src/charts/core/axes.tsx +2 -2
- package/src/charts/core/cartesian/annotations.tsx +2 -2
- package/src/charts/core/cartesian/marks.tsx +1 -1
- package/src/charts/core/distribution/marks.tsx +1 -1
- package/src/charts/core/distribution/xy-points.tsx +1 -1
- package/src/charts/core/export-menu.tsx +1 -1
- package/src/charts/funnel-chart/funnel-chart.tsx +1 -1
- package/src/charts/gantt-chart/gantt-chart.tsx +4 -4
- package/src/charts/gantt-chart/gantt-marks.tsx +3 -3
- package/src/charts/index.ts +2 -0
- package/src/charts/maps/geo/map-data-table.tsx +1 -1
- package/src/charts/polar-area-chart/polar-area-chart.tsx +1 -1
- package/src/charts/radar-chart/radar-chart.tsx +1 -1
- package/src/charts/stock-chart/stock-chart.tsx +1 -1
- package/src/charts/stock-chart/stock-drawing-layer.tsx +3 -3
- package/src/charts/stock-chart/stock-plot.tsx +2 -2
- package/src/containers/chat-thread/chat-thread.tsx +331 -0
- package/src/containers/chat-thread/format.ts +67 -0
- package/src/containers/chat-thread/index.ts +12 -0
- package/src/containers/cols/cols.tsx +13 -1
- package/src/containers/comment/comment.tsx +1 -1
- package/src/containers/context-rail/context-rail.tsx +229 -0
- package/src/containers/context-rail/index.ts +7 -0
- package/src/containers/dashboard/dashboard.tsx +142 -0
- package/src/containers/dashboard/index.ts +12 -0
- package/src/containers/data-grid/data-grid.demos.tsx +4 -4
- package/src/containers/data-grid/data-grid.tsx +6 -6
- package/src/containers/data-grid/filter-builder-editor.tsx +2 -2
- package/src/containers/data-grid/grid-toolbar.tsx +1 -1
- package/src/containers/data-grid/spreadsheet.demos.tsx +1 -1
- package/src/containers/detail-header/detail-header.tsx +64 -0
- package/src/containers/detail-header/index.ts +5 -0
- package/src/containers/facts/facts.tsx +1 -1
- package/src/containers/filter-bar/filter-bar.tsx +201 -0
- package/src/containers/filter-bar/index.ts +7 -0
- package/src/containers/hbars/hbars.tsx +2 -2
- package/src/containers/index.ts +9 -0
- package/src/containers/kanban/kanban.tsx +148 -39
- package/src/containers/kanban/model.ts +20 -0
- package/src/containers/kpi/kpi.tsx +1 -1
- package/src/containers/kpi-group/kpi-group.tsx +17 -2
- package/src/containers/list-detail/index.ts +5 -0
- package/src/containers/list-detail/list-detail.tsx +159 -9
- package/src/containers/page/page.tsx +61 -7
- package/src/containers/page-header/back.tsx +42 -0
- package/src/containers/page-header/index.ts +1 -0
- package/src/containers/page-header/page-header.tsx +49 -3
- package/src/containers/pagination/cursor-pagination.tsx +79 -0
- package/src/containers/pagination/index.ts +7 -0
- package/src/containers/pagination/pagination.tsx +266 -0
- package/src/containers/pagination/range.ts +68 -0
- package/src/containers/pagination/use-pagination.ts +44 -0
- package/src/containers/responsive-list/responsive-list.tsx +190 -47
- package/src/containers/row-actions/index.ts +1 -0
- package/src/containers/row-actions/row-actions.tsx +114 -0
- package/src/containers/selectable-card/index.ts +5 -0
- package/src/containers/selectable-card/selectable-card.tsx +84 -0
- package/src/containers/settings-layout/settings-layout.tsx +104 -13
- package/src/containers/shortcuts/shortcuts.tsx +1 -1
- package/src/containers/table/cell-padding.ts +2 -0
- package/src/containers/table/index.ts +6 -0
- package/src/containers/table/sort.ts +23 -0
- package/src/containers/table/table-parts.tsx +81 -0
- package/src/containers/table/table.tsx +212 -45
- package/src/containers/table-columns-menu/index.ts +5 -0
- package/src/containers/table-columns-menu/table-columns-menu.tsx +68 -0
- package/src/dashboards/layout.tsx +8 -75
- package/src/forms/chip-group/chip-group.tsx +8 -1
- package/src/forms/combobox/combobox.tsx +1 -1
- package/src/forms/copy-field/copy-field.tsx +1 -1
- package/src/forms/date-picker/date-picker.tsx +7 -2
- package/src/forms/date-picker/date-time-picker.tsx +28 -2
- package/src/forms/field/field.tsx +30 -3
- package/src/forms/fieldset/fieldset.tsx +22 -0
- package/src/forms/fieldset/index.ts +1 -0
- package/src/forms/form-footer/form-footer.tsx +74 -0
- package/src/forms/form-footer/index.ts +1 -0
- package/src/forms/form-grid/form-grid.tsx +42 -5
- package/src/forms/form-grid/index.ts +8 -1
- package/src/forms/form-section/form-section.tsx +41 -0
- package/src/forms/form-section/index.ts +1 -0
- package/src/forms/index.ts +3 -0
- package/src/forms/input/input.tsx +10 -3
- package/src/forms/internal/listbox-items.tsx +3 -4
- package/src/forms/native-select/native-select.tsx +1 -1
- package/src/forms/number-stepper/index.ts +1 -0
- package/src/forms/number-stepper/number-stepper.tsx +51 -6
- package/src/forms/select/index.ts +1 -1
- package/src/forms/select/select.tsx +14 -3
- package/src/forms/select-menu/select-menu.tsx +1 -1
- package/src/forms/time-input/time-input.tsx +6 -2
- package/src/i18n/strings.ts +94 -0
- package/src/motion/count-up.tsx +83 -0
- package/src/motion/cross-fade.tsx +139 -0
- package/src/motion/index.ts +5 -0
- package/src/motion/model.ts +86 -0
- package/src/motion/motion-styles.tsx +47 -0
- package/src/motion/reveal.tsx +115 -0
- package/src/motion/use-enter-phase.ts +50 -0
- package/src/motion/use-highlight-row.ts +63 -0
- package/src/navigation/tabs/tabs.tsx +1 -1
- package/src/navigation/wizard/wizard.tsx +6 -1
- package/src/overlays/alert-dialog/alert-dialog.tsx +5 -1
- package/src/overlays/context-menu/context-menu.tsx +3 -2
- package/src/overlays/dialog/dialog.tsx +9 -3
- package/src/overlays/drawer/drawer.tsx +68 -6
- package/src/overlays/drawer/index.ts +1 -0
- package/src/overlays/dropdown-menu/dropdown-menu.tsx +5 -4
- package/src/overlays/hover-card/hover-card.tsx +2 -0
- package/src/overlays/popover/popover.tsx +2 -0
- package/src/overlays/toaster/index.ts +2 -0
- package/src/overlays/toaster/toast-store.ts +8 -0
- package/src/overlays/toaster/toaster.tsx +127 -17
- package/src/overlays/tooltip/tooltip.tsx +2 -0
- package/src/primitives/use-presence.ts +13 -0
- package/src/shell/app-shell/app-shell.tsx +54 -2
- package/src/shell/index.ts +1 -0
- package/src/shell/sidebar/sidebar.tsx +154 -75
- package/src/shell/topbar/topbar.tsx +8 -0
- package/src/showcase/operations-bento.tsx +2 -2
- package/src/states/empty-state/empty-state.tsx +52 -9
- package/src/states/error-state/error-state.tsx +1 -1
- package/src/states/skeleton/skeleton.tsx +33 -5
- package/src/utils/class-tokens.generated.ts +4 -6
- package/src/utils/focus-chain.ts +53 -0
- package/src/utils/focus-rescue.ts +68 -0
- package/src/utils/list-navigation.ts +63 -0
- package/src/utils/overlay-motion.ts +33 -0
- package/src/utils/use-container-width.ts +24 -0
- package/styles/Theme.kt +15 -18
- package/styles/tailwind.css +29 -28
- package/styles/theme.css +29 -28
- package/styles/tokens.css +46 -0
- package/tokens/default.json +51 -29
|
@@ -27,8 +27,22 @@ export interface SidebarGroup {
|
|
|
27
27
|
id: string;
|
|
28
28
|
label: string;
|
|
29
29
|
items: SidebarItem[];
|
|
30
|
+
/**
|
|
31
|
+
* Turns the group label into a button that shows or hides the items (`aria-expanded`). Ignored
|
|
32
|
+
* in rail mode, where every item stays visible.
|
|
33
|
+
*/
|
|
34
|
+
collapsible?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Starts collapsed when `collapsible`. A group that contains the active item starts open
|
|
37
|
+
* regardless, and an uncontrolled group opens when one of its items becomes active later, so
|
|
38
|
+
* the current page is never hidden.
|
|
39
|
+
*/
|
|
40
|
+
defaultCollapsed?: boolean;
|
|
41
|
+
/** Controlled collapsed state of a `collapsible` group. */
|
|
42
|
+
collapsed?: boolean;
|
|
43
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
30
44
|
}
|
|
31
|
-
export type SidebarPart = "root" | "group" | "groupLabel" | "item" | "link" | "label" | "badge" | "footer" | "scrim";
|
|
45
|
+
export type SidebarPart = "root" | "group" | "groupLabel" | "groupToggle" | "groupItems" | "item" | "link" | "label" | "badge" | "footer" | "scrim";
|
|
32
46
|
export interface SidebarProps {
|
|
33
47
|
groups: SidebarGroup[];
|
|
34
48
|
/** Accessible name of the sidebar landmark. */
|
|
@@ -57,6 +71,8 @@ export interface SidebarProps {
|
|
|
57
71
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
58
72
|
classNames?: ClassNames<SidebarPart>;
|
|
59
73
|
}
|
|
74
|
+
/** Whether an uncontrolled group must open: one of its items just became the active page. */
|
|
75
|
+
export declare function opensOnActivation(wasActive: boolean, isActive: boolean, controlled: boolean): boolean;
|
|
60
76
|
/**
|
|
61
77
|
* Main navigation. Always visible when its app container is wide; an off-canvas drawer under
|
|
62
78
|
* 900 px of container width, `inert` while closed so it is not reachable by keyboard.
|
|
@@ -1,10 +1,127 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
3
|
+
import { useEffect, useId, useRef } from "react";
|
|
4
|
+
import { ChevronDown } from "../../icons/index.js";
|
|
4
5
|
import { cn } from "../../utils/cn.js";
|
|
5
6
|
import { materialClass } from "../../utils/material.js";
|
|
7
|
+
import { useControllableState } from "../../utils/use-controllable-state.js";
|
|
6
8
|
import { useAppShell, useCompactContainer } from "../app-shell/app-shell.js";
|
|
7
9
|
const defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */ jsx("a", { ...props, children });
|
|
10
|
+
function opensOnActivation(wasActive, isActive, controlled) {
|
|
11
|
+
return isActive && !wasActive && !controlled;
|
|
12
|
+
}
|
|
13
|
+
function SidebarGroupSection({ group, rail, renderLink, classNames }) {
|
|
14
|
+
const itemsId = useId();
|
|
15
|
+
const collapsible = group.collapsible === true && !rail;
|
|
16
|
+
const holdsActive = group.items.some((item) => item.active);
|
|
17
|
+
const [collapsedState, setCollapsed] = useControllableState({
|
|
18
|
+
prop: group.collapsed,
|
|
19
|
+
defaultProp: (group.defaultCollapsed ?? false) && !holdsActive,
|
|
20
|
+
onChange: group.onCollapsedChange
|
|
21
|
+
});
|
|
22
|
+
const collapsed = collapsible && collapsedState;
|
|
23
|
+
const wasActive = useRef(holdsActive);
|
|
24
|
+
const uncontrolled = group.collapsed === void 0;
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (opensOnActivation(wasActive.current, holdsActive, !uncontrolled)) setCollapsed(false);
|
|
27
|
+
wasActive.current = holdsActive;
|
|
28
|
+
}, [holdsActive, uncontrolled, setCollapsed]);
|
|
29
|
+
return /* @__PURE__ */ jsxs("nav", { "aria-label": group.label, className: cn("flex flex-col gap-px", classNames?.group), children: [
|
|
30
|
+
collapsible ? /* @__PURE__ */ jsxs(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
type: "button",
|
|
34
|
+
"aria-expanded": !collapsed,
|
|
35
|
+
"aria-controls": itemsId,
|
|
36
|
+
onClick: () => setCollapsed(!collapsed),
|
|
37
|
+
className: cn(
|
|
38
|
+
"flex w-full items-center gap-1 rounded-control px-2.5 pb-1.5 text-left text-overline text-ink-3 hover:text-ink focus-visible:focus-ring",
|
|
39
|
+
classNames?.groupLabel,
|
|
40
|
+
classNames?.groupToggle
|
|
41
|
+
),
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: group.label }),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
ChevronDown,
|
|
46
|
+
{
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
className: cn("size-3.5 shrink-0 transition-transform", collapsed && "-rotate-90")
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
) : /* @__PURE__ */ jsx(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: cn(
|
|
57
|
+
"px-2.5 pb-1.5 text-overline text-ink-3",
|
|
58
|
+
rail && "sr-only",
|
|
59
|
+
classNames?.groupLabel
|
|
60
|
+
),
|
|
61
|
+
children: group.label
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
id: itemsId,
|
|
68
|
+
hidden: collapsed,
|
|
69
|
+
className: cn("flex flex-col gap-px", classNames?.groupItems),
|
|
70
|
+
children: group.items.map((item) => {
|
|
71
|
+
const badgeTone = item.badgeTone === "danger" ? "bg-danger-soft text-danger" : "bg-surface-2 text-ink-2";
|
|
72
|
+
return /* @__PURE__ */ jsx("div", { className: classNames?.item, children: renderLink({
|
|
73
|
+
href: item.href,
|
|
74
|
+
"aria-current": item.active ? "page" : void 0,
|
|
75
|
+
title: rail ? item.label : void 0,
|
|
76
|
+
className: cn(
|
|
77
|
+
"flex min-h-(--touch-target) items-center gap-2.5 rounded-control px-2.5 py-2 text-control text-ink-2 hover:bg-surface-2 hover:text-ink [&_svg]:size-4.25 [&_svg]:shrink-0",
|
|
78
|
+
rail && "relative justify-center",
|
|
79
|
+
item.active && "bg-accent-soft font-bold text-accent-ink",
|
|
80
|
+
classNames?.link
|
|
81
|
+
),
|
|
82
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
83
|
+
item.icon,
|
|
84
|
+
/* @__PURE__ */ jsx("span", { className: cn("min-w-0 truncate", rail && "sr-only", classNames?.label), children: item.label }),
|
|
85
|
+
item.badge !== void 0 && rail ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
"span",
|
|
88
|
+
{
|
|
89
|
+
"aria-hidden": "true",
|
|
90
|
+
className: cn(
|
|
91
|
+
"absolute top-1 right-1 size-2 rounded-full ring-2 ring-surface",
|
|
92
|
+
item.badgeTone === "danger" ? "bg-danger" : "bg-accent",
|
|
93
|
+
classNames?.badge
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
98
|
+
item.badge,
|
|
99
|
+
item.badgeLabel ? ` ${item.badgeLabel}` : null
|
|
100
|
+
] })
|
|
101
|
+
] }) : item.badge !== void 0 ? /* @__PURE__ */ jsxs(
|
|
102
|
+
"span",
|
|
103
|
+
{
|
|
104
|
+
className: cn(
|
|
105
|
+
"ml-auto shrink-0 rounded-chip px-1.5 py-0.75 text-count",
|
|
106
|
+
badgeTone,
|
|
107
|
+
classNames?.badge
|
|
108
|
+
),
|
|
109
|
+
children: [
|
|
110
|
+
item.badge,
|
|
111
|
+
item.badgeLabel ? /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
112
|
+
" ",
|
|
113
|
+
item.badgeLabel
|
|
114
|
+
] }) : null
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
) : null
|
|
118
|
+
] })
|
|
119
|
+
}) }, item.id);
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
8
125
|
function Sidebar({
|
|
9
126
|
groups,
|
|
10
127
|
ariaLabel,
|
|
@@ -66,81 +183,13 @@ function Sidebar({
|
|
|
66
183
|
style,
|
|
67
184
|
children: [
|
|
68
185
|
header,
|
|
69
|
-
groups.map((group) => /* @__PURE__ */
|
|
70
|
-
|
|
186
|
+
groups.map((group) => /* @__PURE__ */ jsx(
|
|
187
|
+
SidebarGroupSection,
|
|
71
188
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
className: cn(
|
|
79
|
-
"px-2.5 pb-1.5 text-overline text-ink-3",
|
|
80
|
-
rail && "sr-only",
|
|
81
|
-
classNames?.groupLabel
|
|
82
|
-
),
|
|
83
|
-
children: group.label
|
|
84
|
-
}
|
|
85
|
-
),
|
|
86
|
-
group.items.map((item) => {
|
|
87
|
-
const badgeTone = item.badgeTone === "danger" ? "bg-danger-soft text-danger" : "bg-surface-2 text-ink-2";
|
|
88
|
-
return /* @__PURE__ */ jsx("div", { className: classNames?.item, children: renderLink({
|
|
89
|
-
href: item.href,
|
|
90
|
-
"aria-current": item.active ? "page" : void 0,
|
|
91
|
-
title: rail ? item.label : void 0,
|
|
92
|
-
className: cn(
|
|
93
|
-
"flex items-center gap-2.5 rounded-control px-2.5 py-2 text-control text-ink-2 hover:bg-surface-2 hover:text-ink [&_svg]:size-4.25 [&_svg]:shrink-0",
|
|
94
|
-
rail && "relative justify-center in-data-[density=touch]:min-h-11",
|
|
95
|
-
item.active && "bg-accent-soft font-bold text-accent-ink",
|
|
96
|
-
classNames?.link
|
|
97
|
-
),
|
|
98
|
-
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
99
|
-
item.icon,
|
|
100
|
-
/* @__PURE__ */ jsx(
|
|
101
|
-
"span",
|
|
102
|
-
{
|
|
103
|
-
className: cn("min-w-0 truncate", rail && "sr-only", classNames?.label),
|
|
104
|
-
children: item.label
|
|
105
|
-
}
|
|
106
|
-
),
|
|
107
|
-
item.badge !== void 0 && rail ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
-
/* @__PURE__ */ jsx(
|
|
109
|
-
"span",
|
|
110
|
-
{
|
|
111
|
-
"aria-hidden": "true",
|
|
112
|
-
className: cn(
|
|
113
|
-
"absolute top-1 right-1 size-2 rounded-full ring-2 ring-surface",
|
|
114
|
-
item.badgeTone === "danger" ? "bg-danger" : "bg-accent",
|
|
115
|
-
classNames?.badge
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
),
|
|
119
|
-
/* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
120
|
-
item.badge,
|
|
121
|
-
item.badgeLabel ? ` ${item.badgeLabel}` : null
|
|
122
|
-
] })
|
|
123
|
-
] }) : item.badge !== void 0 ? /* @__PURE__ */ jsxs(
|
|
124
|
-
"span",
|
|
125
|
-
{
|
|
126
|
-
className: cn(
|
|
127
|
-
"ml-auto shrink-0 rounded-chip px-1.5 py-0.75 text-count",
|
|
128
|
-
badgeTone,
|
|
129
|
-
classNames?.badge
|
|
130
|
-
),
|
|
131
|
-
children: [
|
|
132
|
-
item.badge,
|
|
133
|
-
item.badgeLabel ? /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
134
|
-
" ",
|
|
135
|
-
item.badgeLabel
|
|
136
|
-
] }) : null
|
|
137
|
-
]
|
|
138
|
-
}
|
|
139
|
-
) : null
|
|
140
|
-
] })
|
|
141
|
-
}) }, item.id);
|
|
142
|
-
})
|
|
143
|
-
]
|
|
189
|
+
group,
|
|
190
|
+
rail,
|
|
191
|
+
renderLink,
|
|
192
|
+
classNames
|
|
144
193
|
},
|
|
145
194
|
group.id
|
|
146
195
|
)),
|
|
@@ -160,5 +209,6 @@ function Sidebar({
|
|
|
160
209
|
] });
|
|
161
210
|
}
|
|
162
211
|
export {
|
|
163
|
-
Sidebar
|
|
212
|
+
Sidebar,
|
|
213
|
+
opensOnActivation
|
|
164
214
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode, type Ref } from "react";
|
|
2
2
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
3
3
|
import { type Material } from "../../utils/material.js";
|
|
4
|
-
export type TopbarPart = "root" | "inner" | "menuButton" | "breadcrumbs" | "crumb" | "separator" | "current" | "search" | "searchText" | "shortcut";
|
|
4
|
+
export type TopbarPart = "root" | "inner" | "menuButton" | "start" | "breadcrumbs" | "crumb" | "separator" | "current" | "search" | "searchText" | "shortcut";
|
|
5
5
|
export interface TopbarProps {
|
|
6
|
+
/** Slot at the far start, after the menu button and before the breadcrumbs (a logo, a venue switcher). */
|
|
7
|
+
start?: ReactNode;
|
|
6
8
|
/** Breadcrumb trail in order; the last entry is the current view. Nothing renders when absent or empty. */
|
|
7
9
|
breadcrumbs?: string[];
|
|
8
10
|
/** Accessible name of the breadcrumb landmark. */
|
|
@@ -34,4 +36,4 @@ export interface TopbarProps {
|
|
|
34
36
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
35
37
|
classNames?: ClassNames<TopbarPart>;
|
|
36
38
|
}
|
|
37
|
-
export declare function Topbar({ breadcrumbs, breadcrumbsLabel, onOpenMenu, menuLabel, menuButtonRef, onSearch, searchLabel, searchPlaceholder, actions, end, material, style, className, classNames, }: TopbarProps): import("react").JSX.Element;
|
|
39
|
+
export declare function Topbar({ start, breadcrumbs, breadcrumbsLabel, onOpenMenu, menuLabel, menuButtonRef, onSearch, searchLabel, searchPlaceholder, actions, end, material, style, className, classNames, }: TopbarProps): import("react").JSX.Element;
|
|
@@ -9,6 +9,7 @@ function isApplePlatform() {
|
|
|
9
9
|
return /Mac|iPhone|iPod|iPad/.test(navigator.platform || navigator.userAgent || "");
|
|
10
10
|
}
|
|
11
11
|
function Topbar({
|
|
12
|
+
start,
|
|
12
13
|
breadcrumbs,
|
|
13
14
|
breadcrumbsLabel,
|
|
14
15
|
onOpenMenu,
|
|
@@ -73,6 +74,7 @@ function Topbar({
|
|
|
73
74
|
children: /* @__PURE__ */ jsx(Menu, { className: "size-5", "aria-hidden": "true" })
|
|
74
75
|
}
|
|
75
76
|
) : null,
|
|
77
|
+
start ? /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0 items-center", classNames?.start), children: start }) : null,
|
|
76
78
|
trail.length > 0 ? /* @__PURE__ */ jsxs(
|
|
77
79
|
"nav",
|
|
78
80
|
{
|
|
@@ -378,7 +378,7 @@ function OperationsBento() {
|
|
|
378
378
|
rows: 4,
|
|
379
379
|
index: 0,
|
|
380
380
|
flush: true,
|
|
381
|
-
aside: /* @__PURE__ */ jsx(StatusPill, { status: "success", label: "Caja abierta" }),
|
|
381
|
+
aside: /* @__PURE__ */ jsx(StatusPill, { status: "success", label: "Caja abierta", collapseLabel: true }),
|
|
382
382
|
children: /* @__PURE__ */ jsx("div", { className: "h-full pl-3", children: /* @__PURE__ */ jsx(
|
|
383
383
|
WeekView,
|
|
384
384
|
{
|
|
@@ -414,7 +414,7 @@ function OperationsBento() {
|
|
|
414
414
|
] }),
|
|
415
415
|
/* @__PURE__ */ jsx(Progress, { value: barbero.carga, "aria-label": `Carga de ${barbero.name}` })
|
|
416
416
|
] }),
|
|
417
|
-
/* @__PURE__ */ jsx(StatusPill, { status: barbero.estado, label: barbero.texto })
|
|
417
|
+
/* @__PURE__ */ jsx(StatusPill, { status: barbero.estado, label: barbero.texto, collapseLabel: true })
|
|
418
418
|
] }, barbero.name)) })
|
|
419
419
|
}
|
|
420
420
|
),
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
/** Domain icons shipped with the state: nothing yet, nothing found, not allowed. */
|
|
3
|
+
export type EmptyStateIconName = "inbox" | "search" | "lock";
|
|
2
4
|
export interface EmptyStateProps {
|
|
3
|
-
/** Decorative icon
|
|
4
|
-
icon?: ReactNode;
|
|
5
|
+
/** Decorative icon (hidden from screen readers): a node, or `"inbox"`, `"search"`, `"lock"`. */
|
|
6
|
+
icon?: ReactNode | EmptyStateIconName;
|
|
5
7
|
title: ReactNode;
|
|
6
8
|
description?: ReactNode;
|
|
7
9
|
/** Primary call to action. */
|
|
8
10
|
action?: ReactNode;
|
|
9
11
|
/** `outlined` draws a dashed border around the state. */
|
|
10
12
|
variant?: "plain" | "outlined";
|
|
13
|
+
/**
|
|
14
|
+
* `md` (default) is the centered block state. `sm` is the inline state for a list, a table cell
|
|
15
|
+
* or a card body: one muted row (icon, title, description) with the action after it.
|
|
16
|
+
*/
|
|
17
|
+
size?: "sm" | "md";
|
|
11
18
|
className?: string;
|
|
12
19
|
}
|
|
13
|
-
export declare function EmptyState({ icon, title, description, action, variant, className, }: EmptyStateProps): import("react").JSX.Element;
|
|
20
|
+
export declare function EmptyState({ icon, title, description, action, variant, size, className, }: EmptyStateProps): import("react").JSX.Element;
|
|
@@ -1,26 +1,67 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Inbox, Lock, Search } from "../../icons/index.js";
|
|
2
3
|
import { cn } from "../../utils/cn.js";
|
|
4
|
+
const DOMAIN_ICONS = { inbox: Inbox, search: Search, lock: Lock };
|
|
5
|
+
function renderIcon(icon, iconClass) {
|
|
6
|
+
if (typeof icon === "string" && icon in DOMAIN_ICONS) {
|
|
7
|
+
const Domain = DOMAIN_ICONS[icon];
|
|
8
|
+
return /* @__PURE__ */ jsx(Domain, { className: iconClass });
|
|
9
|
+
}
|
|
10
|
+
return icon;
|
|
11
|
+
}
|
|
3
12
|
function EmptyState({
|
|
4
13
|
icon,
|
|
5
14
|
title,
|
|
6
15
|
description,
|
|
7
16
|
action,
|
|
8
17
|
variant = "plain",
|
|
18
|
+
size = "md",
|
|
9
19
|
className
|
|
10
20
|
}) {
|
|
21
|
+
const small = size === "sm";
|
|
22
|
+
const iconNode = icon ? renderIcon(icon, small ? "size-4" : "size-8") : null;
|
|
11
23
|
return /* @__PURE__ */ jsxs(
|
|
12
24
|
"div",
|
|
13
25
|
{
|
|
26
|
+
"data-size": size,
|
|
14
27
|
className: cn(
|
|
15
|
-
"@container/empty flex min-w-0
|
|
28
|
+
"@container/empty flex min-w-0",
|
|
29
|
+
small ? "flex-wrap items-center gap-x-2 gap-y-1 px-1 py-2 text-fs-130 text-ink-3" : "flex-col items-center gap-2 px-4 py-8 text-center @min-[360px]/empty:px-6 @min-[360px]/empty:py-12",
|
|
16
30
|
variant === "outlined" && "rounded-card border border-line-control border-dashed",
|
|
17
31
|
className
|
|
18
32
|
),
|
|
19
33
|
children: [
|
|
20
|
-
|
|
21
|
-
/* @__PURE__ */ jsx(
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
iconNode ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0 text-ink-3", children: iconNode }) : null,
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
"p",
|
|
37
|
+
{
|
|
38
|
+
className: cn(
|
|
39
|
+
"max-w-full [overflow-wrap:anywhere]",
|
|
40
|
+
small ? "font-medium" : "font-semibold text-fs-140 text-ink"
|
|
41
|
+
),
|
|
42
|
+
children: title
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
description ? /* @__PURE__ */ jsx(
|
|
46
|
+
"p",
|
|
47
|
+
{
|
|
48
|
+
className: cn(
|
|
49
|
+
"[overflow-wrap:anywhere]",
|
|
50
|
+
small ? "min-w-0" : "max-w-[42ch] text-fs-130 text-ink-3"
|
|
51
|
+
),
|
|
52
|
+
children: description
|
|
53
|
+
}
|
|
54
|
+
) : null,
|
|
55
|
+
action ? /* @__PURE__ */ jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: cn(
|
|
59
|
+
"flex max-w-full flex-wrap gap-2",
|
|
60
|
+
small ? "ms-1 items-center" : "mt-2 justify-center"
|
|
61
|
+
),
|
|
62
|
+
children: action
|
|
63
|
+
}
|
|
64
|
+
) : null
|
|
24
65
|
]
|
|
25
66
|
}
|
|
26
67
|
);
|
|
@@ -30,7 +30,7 @@ function ErrorState({
|
|
|
30
30
|
children: [
|
|
31
31
|
/* @__PURE__ */ jsx("p", { className: "max-w-full font-semibold text-fs-140 text-ink [overflow-wrap:anywhere]", children: headline }),
|
|
32
32
|
detail ? /* @__PURE__ */ jsx("p", { className: "max-w-[42ch] text-fs-130 text-ink-3 [overflow-wrap:anywhere]", children: detail }) : null,
|
|
33
|
-
correlationId ? /* @__PURE__ */ jsxs("p", { className: "max-w-full text-fs-
|
|
33
|
+
correlationId ? /* @__PURE__ */ jsxs("p", { className: "max-w-full text-fs-120 text-ink-3 tabular-nums [overflow-wrap:anywhere]", children: [
|
|
34
34
|
correlationLabel ?? strings.correlationPrefix,
|
|
35
35
|
" ",
|
|
36
36
|
correlationId
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
export type SkeletonVariant = "lines" | "table" | "card" | "list" | "kpis" | "key-value" | "bar";
|
|
3
|
+
export interface SkeletonGroupProps {
|
|
4
|
+
/** Text announced once for the whole region. Defaults to the localized "Loading". */
|
|
5
|
+
label?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/** One status announcement for every `Skeleton` inside; they render silent. */
|
|
10
|
+
export declare function SkeletonGroup({ label, className, children }: SkeletonGroupProps): import("react").JSX.Element;
|
|
2
11
|
export interface SkeletonProps {
|
|
3
12
|
variant?: SkeletonVariant;
|
|
4
13
|
/** Number of lines for the `lines` variant. */
|
|
@@ -9,10 +18,16 @@ export interface SkeletonProps {
|
|
|
9
18
|
count?: number;
|
|
10
19
|
/** Text announced to screen readers while loading. */
|
|
11
20
|
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether this skeleton is its own status region. Defaults to `true`, except inside a
|
|
23
|
+
* `SkeletonGroup`, which announces once. Set `false` on repeated skeletons so a screen reader
|
|
24
|
+
* does not say "Loading" for each; wrap them in a `SkeletonGroup` or a status of your own.
|
|
25
|
+
*/
|
|
26
|
+
announce?: boolean;
|
|
12
27
|
/**
|
|
13
28
|
* Classes on the root. The `bar` variant is one block sized by them (`h-8 w-32`), 12px tall and
|
|
14
29
|
* full width otherwise.
|
|
15
30
|
*/
|
|
16
31
|
className?: string;
|
|
17
32
|
}
|
|
18
|
-
export declare function Skeleton({ variant, lines, rows, count, label, className, }: SkeletonProps): import("react").JSX.Element;
|
|
33
|
+
export declare function Skeleton({ variant, lines, rows, count, label, announce, className, }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
3
4
|
import { useUiStrings } from "../../i18n/index.js";
|
|
4
5
|
import { cn } from "../../utils/cn.js";
|
|
5
6
|
const PLACEHOLDER_IDS = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"];
|
|
7
|
+
const SkeletonGroupContext = createContext(false);
|
|
8
|
+
function SkeletonGroup({ label, className, children }) {
|
|
9
|
+
const strings = useUiStrings();
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { role: "status", "aria-busy": "true", "aria-label": label ?? strings.loading, className, children: /* @__PURE__ */ jsx(SkeletonGroupContext.Provider, { value: true, children }) });
|
|
11
|
+
}
|
|
6
12
|
function Bar({ className }) {
|
|
7
13
|
return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("block h-3 rounded-xs bg-surface-2", className) });
|
|
8
14
|
}
|
|
@@ -15,15 +21,16 @@ function Skeleton({
|
|
|
15
21
|
rows = 4,
|
|
16
22
|
count = 4,
|
|
17
23
|
label,
|
|
24
|
+
announce,
|
|
18
25
|
className
|
|
19
26
|
}) {
|
|
20
27
|
const strings = useUiStrings();
|
|
28
|
+
const grouped = useContext(SkeletonGroupContext);
|
|
29
|
+
const silent = !(announce ?? !grouped);
|
|
21
30
|
return /* @__PURE__ */ jsxs(
|
|
22
31
|
"div",
|
|
23
32
|
{
|
|
24
|
-
role: "status",
|
|
25
|
-
"aria-busy": "true",
|
|
26
|
-
"aria-label": label ?? strings.loading,
|
|
33
|
+
...silent ? { "aria-hidden": true } : { role: "status", "aria-busy": true, "aria-label": label ?? strings.loading },
|
|
27
34
|
className: cn(
|
|
28
35
|
"animate-pulse",
|
|
29
36
|
variant === "bar" && "block h-3 w-full rounded-xs bg-surface-2",
|
|
@@ -43,7 +50,7 @@ function Skeleton({
|
|
|
43
50
|
variant === "list" ? /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: items(count, (id, index) => /* @__PURE__ */ jsxs(
|
|
44
51
|
"div",
|
|
45
52
|
{
|
|
46
|
-
className: "grid min-h-
|
|
53
|
+
className: "grid min-h-[calc(2.75rem+0.75rem*var(--touch))] grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-b-divider py-2.5",
|
|
47
54
|
children: [
|
|
48
55
|
/* @__PURE__ */ jsxs("span", { className: "flex flex-col gap-1.5", children: [
|
|
49
56
|
/* @__PURE__ */ jsx(Bar, { className: index % 2 === 0 ? "w-2/5" : "w-1/2" }),
|
|
@@ -76,5 +83,6 @@ function Skeleton({
|
|
|
76
83
|
}
|
|
77
84
|
const KEY_VALUE_WIDTHS = ["w-11/12", "w-3/4", "w-5/6", "w-2/3"];
|
|
78
85
|
export {
|
|
79
|
-
Skeleton
|
|
86
|
+
Skeleton,
|
|
87
|
+
SkeletonGroup
|
|
80
88
|
};
|
|
@@ -19,19 +19,15 @@ const TEXT_SIZES = [
|
|
|
19
19
|
"m-body",
|
|
20
20
|
"m-button",
|
|
21
21
|
"m-meta",
|
|
22
|
-
"fs-95",
|
|
23
22
|
"fs-100",
|
|
24
|
-
"fs-105",
|
|
25
23
|
"fs-110",
|
|
26
|
-
"fs-115",
|
|
27
24
|
"fs-120",
|
|
28
|
-
"fs-125",
|
|
29
25
|
"fs-130",
|
|
30
26
|
"fs-140",
|
|
31
27
|
"fs-150",
|
|
32
28
|
"fs-160",
|
|
33
|
-
"fs-
|
|
34
|
-
"fs-
|
|
29
|
+
"fs-200",
|
|
30
|
+
"fs-240",
|
|
35
31
|
"fs-440"
|
|
36
32
|
];
|
|
37
33
|
const RADII = [
|
|
@@ -72,6 +68,7 @@ const SPACINGS = [
|
|
|
72
68
|
"top-height",
|
|
73
69
|
"control-height",
|
|
74
70
|
"control-height-sm",
|
|
71
|
+
"control-height-md",
|
|
75
72
|
"control-height-lg",
|
|
76
73
|
"input-height",
|
|
77
74
|
"agenda-hour",
|
|
@@ -82,6 +79,7 @@ const SPACINGS = [
|
|
|
82
79
|
"m-hour",
|
|
83
80
|
"control",
|
|
84
81
|
"control-sm",
|
|
82
|
+
"control-md",
|
|
85
83
|
"control-lg",
|
|
86
84
|
"input",
|
|
87
85
|
"control-x",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function isVisible(element: Element): boolean;
|
|
2
|
+
export declare function focusLosing(): boolean;
|
|
3
|
+
/** Focuses the element, or a control inside it; returns whether focus moved there. */
|
|
4
|
+
export declare function focusWithin(element: HTMLElement): boolean;
|
|
5
|
+
/** The element and its ancestors up to the body, nearest first. */
|
|
6
|
+
export declare function focusChain(element: Element | null): HTMLElement[];
|
|
7
|
+
/**
|
|
8
|
+
* Focuses the first element of a chain captured with `focusChain` that still lives in the
|
|
9
|
+
* document: the element itself, otherwise the nearest surviving interactive or list-like ancestor.
|
|
10
|
+
*/
|
|
11
|
+
export declare function restoreFocusFromChain(chain: readonly HTMLElement[]): boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const FOCUSABLE = 'button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
2
|
+
const CONTAINER_TAGS = /* @__PURE__ */ new Set(["UL", "OL", "TBODY", "TABLE", "MAIN", "SECTION", "ARTICLE"]);
|
|
3
|
+
function isVisible(element) {
|
|
4
|
+
return element.getClientRects().length > 0;
|
|
5
|
+
}
|
|
6
|
+
function focusLosing() {
|
|
7
|
+
const active = document.activeElement;
|
|
8
|
+
return active === null || active === document.body || active === document.documentElement;
|
|
9
|
+
}
|
|
10
|
+
function focusWithin(element) {
|
|
11
|
+
const target = element.hasAttribute("tabindex") ? element : element.querySelector(FOCUSABLE) ?? element;
|
|
12
|
+
if (!target.hasAttribute("tabindex") && !target.matches(FOCUSABLE)) {
|
|
13
|
+
target.setAttribute("tabindex", "-1");
|
|
14
|
+
}
|
|
15
|
+
target.focus({ preventScroll: false });
|
|
16
|
+
return document.activeElement === target;
|
|
17
|
+
}
|
|
18
|
+
function focusChain(element) {
|
|
19
|
+
const chain = [];
|
|
20
|
+
for (let node = element; node && node !== document.body; node = node.parentElement) {
|
|
21
|
+
if (node instanceof HTMLElement) chain.push(node);
|
|
22
|
+
}
|
|
23
|
+
return chain;
|
|
24
|
+
}
|
|
25
|
+
function restoreFocusFromChain(chain) {
|
|
26
|
+
for (const [index, element] of chain.entries()) {
|
|
27
|
+
if (!element.isConnected || !isVisible(element)) continue;
|
|
28
|
+
const usable = index === 0 || element.hasAttribute("tabindex") || element.matches(FOCUSABLE) || CONTAINER_TAGS.has(element.tagName) || element.getAttribute("role") === "listbox" || element.getAttribute("role") === "list";
|
|
29
|
+
if (usable && focusWithin(element)) return true;
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
focusChain,
|
|
35
|
+
focusLosing,
|
|
36
|
+
focusWithin,
|
|
37
|
+
isVisible,
|
|
38
|
+
restoreFocusFromChain
|
|
39
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
export interface FocusRescueOptions {
|
|
3
|
+
/** Selector of the items inside the root. */
|
|
4
|
+
item: string;
|
|
5
|
+
/** Selector of the nearest ancestor that groups sibling items; the next item is looked up inside it. */
|
|
6
|
+
group: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* When the focused item leaves the DOM (approved, started, moved away) the browser drops focus on
|
|
10
|
+
* the body. This hands it to the item that took its place, the last one when it was the tail, or
|
|
11
|
+
* the group when nothing is left. Focus that moved on purpose is never touched.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useFocusRescue(rootRef: RefObject<HTMLElement | null>, { item, group }: FocusRescueOptions): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { focusLosing, focusWithin, isVisible } from "./focus-chain.js";
|
|
3
|
+
function useFocusRescue(rootRef, { item, group }) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const root = rootRef.current;
|
|
6
|
+
if (!root) return;
|
|
7
|
+
let tracked = null;
|
|
8
|
+
const itemsOf = (scope) => Array.from(scope.querySelectorAll(item)).filter(
|
|
9
|
+
(candidate) => candidate.closest(group) === scope && isVisible(candidate)
|
|
10
|
+
);
|
|
11
|
+
const track = (element) => {
|
|
12
|
+
const found = element?.closest(item);
|
|
13
|
+
const scope = found?.closest(group);
|
|
14
|
+
if (!found || !scope) return;
|
|
15
|
+
tracked = { element: found, group: scope, index: itemsOf(scope).indexOf(found) };
|
|
16
|
+
};
|
|
17
|
+
const onFocusIn = (event) => track(event.target instanceof HTMLElement ? event.target : null);
|
|
18
|
+
const rescue = () => {
|
|
19
|
+
if (!tracked) return;
|
|
20
|
+
if (tracked.element.isConnected) {
|
|
21
|
+
track(tracked.element);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const lost = tracked;
|
|
25
|
+
if (!focusLosing()) {
|
|
26
|
+
tracked = null;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
tracked = null;
|
|
30
|
+
const scope = lost.group.isConnected ? lost.group : null;
|
|
31
|
+
if (!scope) return;
|
|
32
|
+
const siblings = itemsOf(scope);
|
|
33
|
+
const next = siblings[Math.min(Math.max(lost.index, 0), siblings.length - 1)];
|
|
34
|
+
if (next) focusWithin(next);
|
|
35
|
+
else focusWithin(scope);
|
|
36
|
+
};
|
|
37
|
+
root.addEventListener("focusin", onFocusIn);
|
|
38
|
+
const observer = new MutationObserver(rescue);
|
|
39
|
+
observer.observe(root, { childList: true, subtree: true });
|
|
40
|
+
return () => {
|
|
41
|
+
root.removeEventListener("focusin", onFocusIn);
|
|
42
|
+
observer.disconnect();
|
|
43
|
+
};
|
|
44
|
+
}, [rootRef, item, group]);
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
useFocusRescue
|
|
48
|
+
};
|