@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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ListNavigationKey = "ArrowUp" | "ArrowDown" | "Home" | "End";
|
|
2
|
+
export declare function isListNavigationKey(key: string): key is ListNavigationKey;
|
|
3
|
+
/**
|
|
4
|
+
* The key a navigation key lands on, given the keys in DOM order and the current one.
|
|
5
|
+
* Returns `undefined` for other keys, an unknown current key past the ends, or when nothing moves.
|
|
6
|
+
*/
|
|
7
|
+
export declare function listNavigationTarget(keys: readonly string[], current: string | null | undefined, key: string): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Moves focus between the `data-row-key` rows of a `data-row-scope` container for a navigation
|
|
10
|
+
* key. Returns the row focused, or `undefined` when the key is not handled.
|
|
11
|
+
*/
|
|
12
|
+
export declare function focusRowByKey(container: Element, current: Element, key: string): HTMLElement | undefined;
|
|
13
|
+
/** Focuses the visible row whose `data-row-key` equals `key` under `root`; returns it. */
|
|
14
|
+
export declare function focusRowWithKey(root: Element, key: string): HTMLElement | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const NAVIGATION_KEYS = ["ArrowUp", "ArrowDown", "Home", "End"];
|
|
2
|
+
function isListNavigationKey(key) {
|
|
3
|
+
return NAVIGATION_KEYS.includes(key);
|
|
4
|
+
}
|
|
5
|
+
function listNavigationTarget(keys, current, key) {
|
|
6
|
+
if (!isListNavigationKey(key) || keys.length === 0) return void 0;
|
|
7
|
+
const index = current == null ? -1 : keys.indexOf(current);
|
|
8
|
+
let next;
|
|
9
|
+
if (key === "Home") next = 0;
|
|
10
|
+
else if (key === "End") next = keys.length - 1;
|
|
11
|
+
else if (key === "ArrowDown") next = Math.min(keys.length - 1, index + 1);
|
|
12
|
+
else next = index < 0 ? 0 : Math.max(0, index - 1);
|
|
13
|
+
const target = keys[next];
|
|
14
|
+
return target === current ? void 0 : target;
|
|
15
|
+
}
|
|
16
|
+
const ROW_ATTR = "data-row-key";
|
|
17
|
+
function rowElements(container) {
|
|
18
|
+
return Array.from(container.querySelectorAll(`[${ROW_ATTR}]`)).filter(
|
|
19
|
+
(el) => el.closest("[data-row-scope]") === container && el.getClientRects().length > 0
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function focusRowByKey(container, current, key) {
|
|
23
|
+
const rows = rowElements(container);
|
|
24
|
+
const keys = rows.map((row2) => row2.getAttribute(ROW_ATTR) ?? "");
|
|
25
|
+
const from = current.getAttribute(ROW_ATTR);
|
|
26
|
+
const target = listNavigationTarget(keys, from, key);
|
|
27
|
+
if (target === void 0) return void 0;
|
|
28
|
+
const row = rows[keys.indexOf(target)];
|
|
29
|
+
row?.focus();
|
|
30
|
+
return row;
|
|
31
|
+
}
|
|
32
|
+
function focusRowWithKey(root, key) {
|
|
33
|
+
const row = Array.from(root.querySelectorAll(`[${ROW_ATTR}]`)).find(
|
|
34
|
+
(el) => el.getAttribute(ROW_ATTR) === key && el.getClientRects().length > 0
|
|
35
|
+
);
|
|
36
|
+
row?.focus();
|
|
37
|
+
return row;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
focusRowByKey,
|
|
41
|
+
focusRowWithKey,
|
|
42
|
+
isListNavigationKey,
|
|
43
|
+
listNavigationTarget
|
|
44
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Anchored surfaces (menus, popovers, listboxes, tooltips, hover cards): grow from the anchor side. */
|
|
2
|
+
export declare const POPPER_MOTION = "origin-(--ui-popper-transform-origin) transition-[opacity,scale,translate] duration-(--motion-duration) ease-(--motion-ease) starting:scale-96 starting:opacity-0 starting:data-[side=bottom]:-translate-y-1 starting:data-[side=left]:translate-x-1 starting:data-[side=right]:-translate-x-1 starting:data-[side=top]:translate-y-1 data-[state=closed]:scale-96 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] data-[state=closed]:data-[side=bottom]:-translate-y-1 data-[state=closed]:data-[side=left]:translate-x-1 data-[state=closed]:data-[side=right]:-translate-x-1 data-[state=closed]:data-[side=top]:translate-y-1 motion-reduce:transition-none";
|
|
3
|
+
/** The scrim behind a dialog or drawer: a plain fade. */
|
|
4
|
+
export declare const OVERLAY_MOTION = "transition-opacity duration-(--motion-duration) ease-(--motion-ease) starting:opacity-0 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
5
|
+
/** A centred dialog: fades in while it settles from 97% to full size. */
|
|
6
|
+
export declare const DIALOG_MOTION = "transition-[opacity,scale] duration-(--motion-duration) ease-(--motion-ease) starting:scale-97 starting:opacity-0 data-[state=closed]:scale-97 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
7
|
+
/** A drawer on the inline end: slides in from that edge. */
|
|
8
|
+
export declare const DRAWER_MOTION = "transition-[translate] duration-(--motion-duration) ease-(--motion-ease) starting:translate-x-full data-[state=closed]:translate-x-full data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
9
|
+
/** Highlight of a menu item or listbox option: 120ms at the default 180ms motion duration. */
|
|
10
|
+
export declare const ITEM_MOTION = "transition-colors duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
11
|
+
/** A bottom sheet: slides up from the bottom edge. */
|
|
12
|
+
export declare const SHEET_MOTION = "transition-[translate] duration-(--motion-duration) ease-(--motion-ease) starting:translate-y-full data-[state=closed]:translate-y-full data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const POPPER_MOTION = "origin-(--ui-popper-transform-origin) transition-[opacity,scale,translate] duration-(--motion-duration) ease-(--motion-ease) starting:scale-96 starting:opacity-0 starting:data-[side=bottom]:-translate-y-1 starting:data-[side=left]:translate-x-1 starting:data-[side=right]:-translate-x-1 starting:data-[side=top]:translate-y-1 data-[state=closed]:scale-96 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] data-[state=closed]:data-[side=bottom]:-translate-y-1 data-[state=closed]:data-[side=left]:translate-x-1 data-[state=closed]:data-[side=right]:-translate-x-1 data-[state=closed]:data-[side=top]:translate-y-1 motion-reduce:transition-none";
|
|
2
|
+
const OVERLAY_MOTION = "transition-opacity duration-(--motion-duration) ease-(--motion-ease) starting:opacity-0 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
3
|
+
const DIALOG_MOTION = "transition-[opacity,scale] duration-(--motion-duration) ease-(--motion-ease) starting:scale-97 starting:opacity-0 data-[state=closed]:scale-97 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
4
|
+
const DRAWER_MOTION = "transition-[translate] duration-(--motion-duration) ease-(--motion-ease) starting:translate-x-full data-[state=closed]:translate-x-full data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
5
|
+
const ITEM_MOTION = "transition-colors duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
6
|
+
const SHEET_MOTION = "transition-[translate] duration-(--motion-duration) ease-(--motion-ease) starting:translate-y-full data-[state=closed]:translate-y-full data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
|
|
7
|
+
export {
|
|
8
|
+
DIALOG_MOTION,
|
|
9
|
+
DRAWER_MOTION,
|
|
10
|
+
ITEM_MOTION,
|
|
11
|
+
OVERLAY_MOTION,
|
|
12
|
+
POPPER_MOTION,
|
|
13
|
+
SHEET_MOTION
|
|
14
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Measured content width (px) of `ref.current`, or `null` on the server and for the render before
|
|
4
|
+
* the first measurement. It is read before paint and follows a `ResizeObserver`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useContainerWidth(ref: RefObject<HTMLElement | null>): number | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useState } from "react";
|
|
2
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
3
|
+
function useContainerWidth(ref) {
|
|
4
|
+
const [width, setWidth] = useState(null);
|
|
5
|
+
useIsomorphicLayoutEffect(() => {
|
|
6
|
+
const element = ref.current;
|
|
7
|
+
if (!element) return;
|
|
8
|
+
const measure = () => setWidth(element.getBoundingClientRect().width);
|
|
9
|
+
measure();
|
|
10
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
11
|
+
const observer = new ResizeObserver(measure);
|
|
12
|
+
observer.observe(element);
|
|
13
|
+
return () => observer.disconnect();
|
|
14
|
+
}, [ref]);
|
|
15
|
+
return width;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
useContainerWidth
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcsoftdev/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Token-driven React component library: React 19, Tailwind v4.",
|
|
5
5
|
"author": "jcsoftdev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"typescript": "^5.5.4",
|
|
103
103
|
"vite": "7.3.6",
|
|
104
104
|
"vitest": "4.1.11",
|
|
105
|
-
"@jcsoftdev/ui-tokens": "^0.
|
|
105
|
+
"@jcsoftdev/ui-tokens": "^0.7.0"
|
|
106
106
|
},
|
|
107
107
|
"publishConfig": {
|
|
108
108
|
"access": "public"
|
package/scripts/build-theme.mjs
CHANGED
|
@@ -91,6 +91,10 @@ const decls = (list) => list.map(([k, v]) => ` --${k}: ${v};`).join("\n");
|
|
|
91
91
|
// that references another one is resolved where it is declared: a nested [data-style] must
|
|
92
92
|
// re-declare the whole set instead of relying on :root's already-computed values.
|
|
93
93
|
//
|
|
94
|
+
// data-density="auto" follows the pointer: the `fine` level, or the `coarse` one under
|
|
95
|
+
// @media (pointer: coarse). An explicit level on a nested element wins because it declares the
|
|
96
|
+
// same properties on that element itself.
|
|
97
|
+
//
|
|
94
98
|
// Precedence on one element follows source order at equal specificity (:root[x] on the root,
|
|
95
99
|
// [x] on a nested element): themes < accents < presets < density < radius. A preset's dark
|
|
96
100
|
// values use :root[data-theme] in front of the attribute, so they outrank the theme block.
|
|
@@ -140,7 +144,7 @@ export function stylesOf(tokens) {
|
|
|
140
144
|
|
|
141
145
|
const density = styles.density ?? { levels: [] };
|
|
142
146
|
const densityGoverned = new Set(
|
|
143
|
-
density.levels.length ? ["density", ...(density.scaled ?? [])] : [],
|
|
147
|
+
density.levels.length ? ["density", ...(density.scaled ?? []), ...(density.fixed ?? [])] : [],
|
|
144
148
|
);
|
|
145
149
|
for (const name of densityGoverned) {
|
|
146
150
|
known(name, "density");
|
|
@@ -148,6 +152,16 @@ export function stylesOf(tokens) {
|
|
|
148
152
|
throw new Error(`styles: density token "${name}" is themed`);
|
|
149
153
|
}
|
|
150
154
|
|
|
155
|
+
const levelIds = new Set(density.levels.map((l) => l.id));
|
|
156
|
+
if (density.auto) {
|
|
157
|
+
if (levelIds.has("auto"))
|
|
158
|
+
throw new Error('styles: "auto" is reserved and cannot be a density level');
|
|
159
|
+
for (const side of ["fine", "coarse"]) {
|
|
160
|
+
if (!levelIds.has(density.auto[side]))
|
|
161
|
+
throw new Error(`styles: density auto.${side} names unknown level "${density.auto[side]}"`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
151
165
|
for (const level of density.levels) {
|
|
152
166
|
for (const name of Object.keys(level.values ?? {})) {
|
|
153
167
|
if (!densityGoverned.has(name) || name === "density")
|
|
@@ -208,12 +222,28 @@ function buildStyleBlocks(tokens) {
|
|
|
208
222
|
blocks.push(...variantBlocks("data-style", p.id, entries, themes));
|
|
209
223
|
}
|
|
210
224
|
|
|
211
|
-
|
|
212
|
-
|
|
225
|
+
const fixed = new Set(s.density.fixed ?? []);
|
|
226
|
+
const densityEntries = (level) =>
|
|
227
|
+
s.densityGoverned.map((name) => {
|
|
213
228
|
if (name === "density") return [name, String(level.density)];
|
|
214
|
-
|
|
229
|
+
const base = s.byName.get(name).value;
|
|
230
|
+
return [
|
|
231
|
+
name,
|
|
232
|
+
level.values?.[name] ?? (fixed.has(name) ? base : `calc(${base} * var(--density))`),
|
|
233
|
+
];
|
|
215
234
|
});
|
|
216
|
-
|
|
235
|
+
for (const level of s.density.levels) {
|
|
236
|
+
blocks.push(...variantBlocks("data-density", level.id, densityEntries(level), themes));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// data-density="auto": one side per pointer type. Both sides redeclare the whole set, so a
|
|
240
|
+
// nested [data-density="auto"] resets whatever an explicit level above it declared.
|
|
241
|
+
const auto = s.density.auto;
|
|
242
|
+
if (auto) {
|
|
243
|
+
const side = (id) => densityEntries(s.density.levels.find((l) => l.id === id));
|
|
244
|
+
blocks.push(...variantBlocks("data-density", "auto", side(auto.fine), themes));
|
|
245
|
+
const coarse = variantBlocks("data-density", "auto", side(auto.coarse), themes)[0];
|
|
246
|
+
blocks.push(`@media (pointer: coarse) {\n${indent(coarse)}\n}`);
|
|
217
247
|
}
|
|
218
248
|
|
|
219
249
|
for (const level of s.radiusLevels) {
|
|
@@ -327,6 +357,17 @@ export function buildThemeCss(tokens) {
|
|
|
327
357
|
for (const s of tokens.type?.sizeScale ?? []) {
|
|
328
358
|
lines.push(` --text-${s.name}: ${s.fontSize};`);
|
|
329
359
|
}
|
|
360
|
+
for (const [name, width] of Object.entries(tokens.containers ?? {})) {
|
|
361
|
+
if (!TONE_NAME.test(name)) {
|
|
362
|
+
throw new Error(
|
|
363
|
+
`containers: "${name}" must be kebab-case (lowercase letters, digits, hyphens)`,
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
if (!/^\d+(\.\d+)?(px|rem)$/.test(width)) {
|
|
367
|
+
throw new Error(`containers.${name}: "${width}" must be a literal px or rem width`);
|
|
368
|
+
}
|
|
369
|
+
lines.push(` --container-${name}: ${width};`);
|
|
370
|
+
}
|
|
330
371
|
const styles = stylesOf(tokens);
|
|
331
372
|
for (const [themeVar, name] of Object.entries(tokens.styles?.tailwind ?? {})) {
|
|
332
373
|
if (!styles.byName.has(name)) throw new Error(`styles.tailwind: unknown token "${name}"`);
|
|
@@ -90,7 +90,7 @@ export function CodeBlock({
|
|
|
90
90
|
// biome-ignore lint/a11y/noNoninteractiveTabindex: scrollable region must be keyboard reachable
|
|
91
91
|
tabIndex={0}
|
|
92
92
|
className={cn(
|
|
93
|
-
"m-0 p-3 font-mono text-fs-
|
|
93
|
+
"m-0 p-3 font-mono text-fs-120 leading-relaxed focus-visible:focus-ring",
|
|
94
94
|
wrap ? "whitespace-pre-wrap break-words" : "overflow-x-auto",
|
|
95
95
|
classNames?.pre,
|
|
96
96
|
)}
|
|
@@ -98,6 +98,11 @@ export interface AvatarProps extends Omit<ComponentPropsWithRef<"span">, "childr
|
|
|
98
98
|
tone?: AvatarTone;
|
|
99
99
|
/** Small status dot at the bottom-right corner. */
|
|
100
100
|
status?: StatusDotTone;
|
|
101
|
+
/**
|
|
102
|
+
* Hides the avatar from assistive technology, for one beside a visible name that already says
|
|
103
|
+
* who it is. `aria-hidden` passed directly does the same.
|
|
104
|
+
*/
|
|
105
|
+
decorative?: boolean;
|
|
101
106
|
/** Accessible text for the status dot; defaults to the status name. */
|
|
102
107
|
statusLabel?: string;
|
|
103
108
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
@@ -112,6 +117,7 @@ export function Avatar({
|
|
|
112
117
|
tone = "neutral",
|
|
113
118
|
status: statusTone,
|
|
114
119
|
statusLabel,
|
|
120
|
+
decorative,
|
|
115
121
|
className,
|
|
116
122
|
classNames,
|
|
117
123
|
style,
|
|
@@ -126,8 +132,8 @@ export function Avatar({
|
|
|
126
132
|
|
|
127
133
|
const avatar = (
|
|
128
134
|
<span
|
|
129
|
-
role
|
|
130
|
-
aria-
|
|
135
|
+
{...(decorative || props["aria-hidden"] ? {} : { role: "img", "aria-label": name })}
|
|
136
|
+
{...(decorative ? { "aria-hidden": true } : {})}
|
|
131
137
|
{...props}
|
|
132
138
|
style={customToneStyle(tone, builtinTones, style)}
|
|
133
139
|
className={cn(
|
|
@@ -4,8 +4,8 @@ import { cn } from "../../utils/cn.js";
|
|
|
4
4
|
export type BigDateSize = "normal" | "compact";
|
|
5
5
|
|
|
6
6
|
const sizeClasses: Record<BigDateSize, string> = {
|
|
7
|
-
normal: "text-fs-
|
|
8
|
-
compact: "text-fs-
|
|
7
|
+
normal: "text-fs-240",
|
|
8
|
+
compact: "text-fs-200",
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export interface BigDateProps extends ComponentPropsWithoutRef<"div"> {
|
|
@@ -26,10 +26,14 @@ export const buttonVariantClasses: Readonly<Record<ButtonVariant, string>> = {
|
|
|
26
26
|
danger: "bg-danger-soft text-danger hover:bg-danger-soft/70",
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Class map behind each `size`; exported like {@link buttonVariantClasses}. `sm` and `md` take the
|
|
31
|
+
* shared control heights (`--control-height-sm`, `--control-height-md`), so a button lines up with an
|
|
32
|
+
* `Input`, `Select`, `Combobox`, `DatePicker` or `TimeInput` of the same size.
|
|
33
|
+
*/
|
|
30
34
|
export const buttonSizeClasses: Readonly<Record<ButtonSize, string>> = {
|
|
31
|
-
sm: "h-control-sm px-3 text-fs-
|
|
32
|
-
md: "h-control px-control-x text-fs-130",
|
|
35
|
+
sm: "h-control-sm px-3 text-fs-120 [&_svg]:size-3.5",
|
|
36
|
+
md: "h-control-md px-control-x text-fs-130",
|
|
33
37
|
lg: "h-control-lg px-control-x text-fs-140",
|
|
34
38
|
};
|
|
35
39
|
|
|
@@ -64,6 +68,7 @@ export function buttonClasses({
|
|
|
64
68
|
|
|
65
69
|
export interface ButtonProps extends ComponentPropsWithRef<"button"> {
|
|
66
70
|
variant?: ButtonVariant;
|
|
71
|
+
/** `sm` is 30px and `md` (default) 38px, the heights every form control shares; `lg` is 52px. */
|
|
67
72
|
size?: ButtonSize;
|
|
68
73
|
/**
|
|
69
74
|
* Busy state: the button keeps its focus and its full colour, ignores clicks (a submit button no
|
package/src/atoms/chip/chip.tsx
CHANGED
|
@@ -37,7 +37,7 @@ export type ChipSize = "sm" | "md";
|
|
|
37
37
|
/** Class map behind each `size`; exported like `chipToneClasses`. */
|
|
38
38
|
export const chipSizeClasses: Readonly<Record<ChipSize, string>> = {
|
|
39
39
|
md: "h-6 px-2.5 font-[650] text-fs-120",
|
|
40
|
-
sm: "h-auto min-h-5 px-1.5 py-px font-medium text-fs-
|
|
40
|
+
sm: "h-auto min-h-5 px-1.5 py-px font-medium text-fs-120 tabular-nums",
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
export interface ChipProps extends ComponentPropsWithRef<"span"> {
|
|
@@ -53,6 +53,11 @@ export interface ChipProps extends ComponentPropsWithRef<"span"> {
|
|
|
53
53
|
icon?: ReactNode;
|
|
54
54
|
/** Prefix `info`, `success`, `warning` and `danger` chips with their status glyph. */
|
|
55
55
|
statusIcon?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* A chip with `onClick` (or `role="button"`) is interactive and never shorter than 30px
|
|
58
|
+
* (`--control-height-sm`), the smallest hit area of the kit, whatever its `size`.
|
|
59
|
+
*/
|
|
60
|
+
onClick?: ComponentPropsWithRef<"span">["onClick"];
|
|
56
61
|
/** Appends a remove button that calls this. */
|
|
57
62
|
onRemove?: () => void;
|
|
58
63
|
/** Accessible name of the remove button. Defaults to the localized "Remove". */
|
|
@@ -90,7 +95,7 @@ export function Chip({
|
|
|
90
95
|
custom
|
|
91
96
|
? "bg-(--tone-c-soft) text-(--tone-c-ink)"
|
|
92
97
|
: (chipToneClasses[tone as ChipBuiltinTone] ?? chipToneClasses.neutral),
|
|
93
|
-
|
|
98
|
+
interactive ? "min-h-control-sm" : onRemove && "min-h-(--touch-target)",
|
|
94
99
|
onRemove && "pr-1",
|
|
95
100
|
className,
|
|
96
101
|
)}
|
|
@@ -104,7 +109,7 @@ export function Chip({
|
|
|
104
109
|
type="button"
|
|
105
110
|
aria-label={removeLabel ?? strings.remove}
|
|
106
111
|
onClick={onRemove}
|
|
107
|
-
className="grid size-
|
|
112
|
+
className="-mr-[calc(0.5rem*var(--touch))] grid size-[calc(1rem+1.75rem*var(--touch))] shrink-0 cursor-pointer place-items-center self-center rounded-full text-current opacity-70 hover:opacity-100 focus-visible:focus-ring"
|
|
108
113
|
>
|
|
109
114
|
<X aria-hidden="true" />
|
|
110
115
|
</button>
|
|
@@ -10,7 +10,7 @@ export type IconButtonSize = ButtonSize;
|
|
|
10
10
|
/** Width behind each `size`; the height comes from the matching `Button` size, so the button is square. */
|
|
11
11
|
export const iconButtonSizeClasses: Readonly<Record<IconButtonSize, string>> = {
|
|
12
12
|
sm: "w-control-sm",
|
|
13
|
-
md: "w-control [&_svg]:size-4",
|
|
13
|
+
md: "w-control-md [&_svg]:size-4",
|
|
14
14
|
lg: "w-control-lg [&_svg]:size-4",
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Invisible 44px hit target for a small control under `data-density="touch"
|
|
3
|
-
*
|
|
4
|
-
* be `relative`.
|
|
2
|
+
* Invisible 44px hit target for a small control under `data-density="touch"` (and `"auto"` on a
|
|
3
|
+
* coarse pointer). It is a pseudo element of `--touch-target` size centred on the control, so the
|
|
4
|
+
* visual box and the layout never change; the control must be `relative`. Other densities size it
|
|
5
|
+
* to 0.
|
|
5
6
|
*/
|
|
6
7
|
export const touchHitArea =
|
|
7
|
-
"relative
|
|
8
|
+
"relative after:absolute after:top-1/2 after:left-1/2 after:size-(--touch-target) after:-translate-1/2 after:content-['']";
|
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
import type { ComponentPropsWithoutRef } from "react";
|
|
4
4
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
5
5
|
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { customToneStyle, isCustomTone } from "../../utils/tone.js";
|
|
7
|
+
|
|
8
|
+
export type ProgressBuiltinTone = "accent" | "neutral" | "success" | "warning" | "danger" | "info";
|
|
9
|
+
|
|
10
|
+
/** A built-in tone, or the name of a tone declared in `tonePalettes`. */
|
|
11
|
+
export type ProgressTone = ProgressBuiltinTone | (string & {});
|
|
12
|
+
|
|
13
|
+
const toneClasses: Record<ProgressBuiltinTone, string> = {
|
|
14
|
+
accent: "bg-accent",
|
|
15
|
+
neutral: "bg-ink-3",
|
|
16
|
+
success: "bg-success",
|
|
17
|
+
warning: "bg-warning",
|
|
18
|
+
danger: "bg-danger",
|
|
19
|
+
info: "bg-info",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const builtinTones = new Set<string>(Object.keys(toneClasses));
|
|
6
23
|
|
|
7
24
|
const DEFAULT_MAX = 100;
|
|
8
25
|
|
|
@@ -13,6 +30,8 @@ export interface ProgressProps extends Omit<ComponentPropsWithoutRef<"div">, "ch
|
|
|
13
30
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
14
31
|
classNames?: ClassNames<ProgressPart>;
|
|
15
32
|
max?: number;
|
|
33
|
+
/** Colour of the indicator. Defaults to `"accent"`. The value is always exposed through the progressbar semantics, never by colour alone. */
|
|
34
|
+
tone?: ProgressTone;
|
|
16
35
|
/** Text announced as `aria-valuetext`; defaults to the rounded percentage. */
|
|
17
36
|
getValueLabel?: (value: number, max: number) => string;
|
|
18
37
|
}
|
|
@@ -33,8 +52,10 @@ export function Progress({
|
|
|
33
52
|
value,
|
|
34
53
|
max: maxProp = DEFAULT_MAX,
|
|
35
54
|
getValueLabel = defaultGetValueLabel,
|
|
55
|
+
tone = "accent",
|
|
36
56
|
className,
|
|
37
57
|
classNames,
|
|
58
|
+
style,
|
|
38
59
|
...props
|
|
39
60
|
}: ProgressProps) {
|
|
40
61
|
const max = isValidMax(maxProp) ? maxProp : DEFAULT_MAX;
|
|
@@ -51,6 +72,8 @@ export function Progress({
|
|
|
51
72
|
data-state={state}
|
|
52
73
|
data-value={current ?? undefined}
|
|
53
74
|
data-max={max}
|
|
75
|
+
data-tone={tone === "accent" ? undefined : tone}
|
|
76
|
+
style={customToneStyle(tone, builtinTones, style)}
|
|
54
77
|
className={cn("h-1.5 overflow-hidden rounded-pill bg-track", classNames?.root, className)}
|
|
55
78
|
{...props}
|
|
56
79
|
>
|
|
@@ -58,7 +81,13 @@ export function Progress({
|
|
|
58
81
|
data-state={state}
|
|
59
82
|
data-value={current ?? undefined}
|
|
60
83
|
data-max={max}
|
|
61
|
-
className={cn(
|
|
84
|
+
className={cn(
|
|
85
|
+
"block h-full transition-transform",
|
|
86
|
+
isCustomTone(tone, builtinTones)
|
|
87
|
+
? "bg-(--tone-c)"
|
|
88
|
+
: (toneClasses[tone as ProgressBuiltinTone] ?? toneClasses.accent),
|
|
89
|
+
classNames?.indicator,
|
|
90
|
+
)}
|
|
62
91
|
style={{ transform: `translateX(-${100 - ((current ?? 0) / max) * 100}%)` }}
|
|
63
92
|
/>
|
|
64
93
|
</div>
|
|
@@ -53,7 +53,7 @@ export function RadioGroup({ options, className, classNames, ...props }: RadioGr
|
|
|
53
53
|
key={option.value}
|
|
54
54
|
htmlFor={id}
|
|
55
55
|
className={cn(
|
|
56
|
-
"flex cursor-pointer items-start gap-2 rounded-control border-divider p-2.5 text-body
|
|
56
|
+
"flex cursor-pointer items-start gap-2 rounded-control border-divider p-2.5 text-body min-h-(--touch-target) has-[[data-state=checked]]:border-accent has-[[data-state=checked]]:shadow-[inset_0_0_0_1px_var(--accent)]",
|
|
57
57
|
classNames?.option,
|
|
58
58
|
)}
|
|
59
59
|
>
|
|
@@ -1,47 +1,88 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
4
4
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
5
5
|
import { cn } from "../../utils/cn.js";
|
|
6
6
|
import { Led, type LedStatus } from "../led/index.js";
|
|
7
7
|
|
|
8
|
-
export type StatusPillPart = "root" | "dot" | "label";
|
|
8
|
+
export type StatusPillPart = "root" | "icon" | "dot" | "label";
|
|
9
9
|
|
|
10
10
|
export interface StatusPillProps
|
|
11
11
|
extends Omit<ComponentPropsWithRef<"button">, "children" | "onSelect"> {
|
|
12
12
|
status: LedStatus;
|
|
13
13
|
label: string;
|
|
14
|
-
/**
|
|
14
|
+
/** Decorative leading icon, hidden from screen readers; the label still names the status. */
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
/** Shows the status dot. Defaults to `true` without an `icon` and `false` with one, where the icon carries the look; the label still names the status either way. */
|
|
17
|
+
dot?: boolean;
|
|
18
|
+
/** Hides the visible label when the surrounding container is narrower than 700 px (the status stays announced). Defaults to `false`: the label is always visible. */
|
|
19
|
+
collapseLabel?: boolean;
|
|
20
|
+
/** Makes the pill a button. Without it, and without `onClick`, the pill is a plain `span`. */
|
|
15
21
|
onSelect?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Forces the element: `true` renders a button even without a handler, `false` a `span` even
|
|
24
|
+
* with one. Omitted, the pill is a button only when `onSelect` or `onClick` is given.
|
|
25
|
+
*/
|
|
26
|
+
interactive?: boolean;
|
|
16
27
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
17
28
|
classNames?: ClassNames<StatusPillPart>;
|
|
18
29
|
}
|
|
19
30
|
|
|
20
|
-
/** Pill showing a status LED and its label; the label
|
|
31
|
+
/** Pill showing a status LED and its label; `collapseLabel` hides the label when the surrounding container is narrow. */
|
|
21
32
|
export function StatusPill({
|
|
22
33
|
status,
|
|
23
34
|
label,
|
|
35
|
+
icon,
|
|
36
|
+
dot,
|
|
37
|
+
collapseLabel = false,
|
|
24
38
|
onSelect,
|
|
39
|
+
interactive,
|
|
25
40
|
className,
|
|
26
41
|
classNames,
|
|
27
42
|
...props
|
|
28
43
|
}: StatusPillProps) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
const isButton = interactive ?? (onSelect !== undefined || props.onClick !== undefined);
|
|
45
|
+
const showDot = dot ?? icon == null;
|
|
46
|
+
const rootClass = cn(
|
|
47
|
+
"flex h-control-sm shrink-0 items-center gap-1.5 whitespace-nowrap rounded-badge border-divider bg-surface-control px-2.5 font-semibold text-fs-120 text-ink-2",
|
|
48
|
+
isButton && "hover:enabled:border-line-strong disabled:cursor-default",
|
|
49
|
+
classNames?.root,
|
|
50
|
+
className,
|
|
51
|
+
);
|
|
52
|
+
const content = (
|
|
53
|
+
<>
|
|
54
|
+
{icon ? (
|
|
55
|
+
<span
|
|
56
|
+
aria-hidden="true"
|
|
57
|
+
className={cn("inline-flex shrink-0 [&_svg]:size-3.5", classNames?.icon)}
|
|
58
|
+
>
|
|
59
|
+
{icon}
|
|
60
|
+
</span>
|
|
61
|
+
) : null}
|
|
62
|
+
<Led
|
|
63
|
+
status={status}
|
|
64
|
+
label={label}
|
|
65
|
+
classNames={{ dot: cn(!showDot && "hidden", classNames?.dot) }}
|
|
66
|
+
/>
|
|
67
|
+
<span
|
|
68
|
+
aria-hidden="true"
|
|
69
|
+
className={cn(collapseLabel && "@max-[700px]:hidden", classNames?.label)}
|
|
70
|
+
>
|
|
43
71
|
{label}
|
|
44
72
|
</span>
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
if (!isButton) {
|
|
76
|
+
const { ref, type: _type, disabled: _disabled, onClick: _onClick, ...rest } = props;
|
|
77
|
+
return (
|
|
78
|
+
<span {...(rest as ComponentPropsWithRef<"span">)} ref={ref as never} className={rootClass}>
|
|
79
|
+
{content}
|
|
80
|
+
</span>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return (
|
|
84
|
+
<button type="button" onClick={onSelect} {...props} className={rootClass}>
|
|
85
|
+
{content}
|
|
45
86
|
</button>
|
|
46
87
|
);
|
|
47
88
|
}
|
package/src/brand/logo-forge.tsx
CHANGED
|
@@ -153,7 +153,7 @@ function Field({
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
const choiceBase =
|
|
156
|
-
"inline-flex h-control-sm cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-chip px-3 font-semibold text-fs-
|
|
156
|
+
"inline-flex h-control-sm cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-chip px-3 font-semibold text-fs-120 pressable focus-visible:focus-ring";
|
|
157
157
|
|
|
158
158
|
function choiceClass(on: boolean) {
|
|
159
159
|
return cn(
|
|
@@ -416,7 +416,7 @@ function CandlePlot({
|
|
|
416
416
|
y={4}
|
|
417
417
|
dy="0.34em"
|
|
418
418
|
textAnchor="end"
|
|
419
|
-
className="fill-ink-3 font-medium text-fs-
|
|
419
|
+
className="fill-ink-3 font-medium text-fs-110 tabular-nums"
|
|
420
420
|
>
|
|
421
421
|
{vfmt(maxVolume)}
|
|
422
422
|
</text>
|
|
@@ -499,7 +499,7 @@ function CandlePlot({
|
|
|
499
499
|
y={0}
|
|
500
500
|
dy="0.34em"
|
|
501
501
|
textAnchor="middle"
|
|
502
|
-
className="font-bold text-fs-
|
|
502
|
+
className="font-bold text-fs-110 tabular-nums"
|
|
503
503
|
style={{ fill: "var(--surface)" }}
|
|
504
504
|
>
|
|
505
505
|
{fmt(last.close)}
|
|
@@ -163,12 +163,12 @@ export function ChartGrid({
|
|
|
163
163
|
<header className="flex min-w-0 items-baseline justify-between gap-2">
|
|
164
164
|
<h3
|
|
165
165
|
id={headingId}
|
|
166
|
-
className="m-0 truncate font-bold text-fs-
|
|
166
|
+
className="m-0 truncate font-bold text-fs-120 text-ink-2 leading-tight"
|
|
167
167
|
>
|
|
168
168
|
{panel.title}
|
|
169
169
|
</h3>
|
|
170
170
|
{panel.subtitle ? (
|
|
171
|
-
<span className="shrink-0 font-semibold text-fs-
|
|
171
|
+
<span className="shrink-0 font-semibold text-fs-120 text-ink-3 tabular-nums">
|
|
172
172
|
{panel.subtitle}
|
|
173
173
|
</span>
|
|
174
174
|
) : null}
|
|
@@ -479,7 +479,7 @@ function ChordPlot({
|
|
|
479
479
|
x={at.x}
|
|
480
480
|
y={at.y + (cos > 0.4 ? -2 : cos < -0.4 ? 10 : 4)}
|
|
481
481
|
textAnchor={sin > 0.25 ? "start" : sin < -0.25 ? "end" : "middle"}
|
|
482
|
-
className="pointer-events-none select-none fill-ink-2 font-semibold text-fs-
|
|
482
|
+
className="pointer-events-none select-none fill-ink-2 font-semibold text-fs-120"
|
|
483
483
|
style={{ opacity: dim ? 0.4 : 1, transition: "opacity 150ms" }}
|
|
484
484
|
>
|
|
485
485
|
{groups[group.index]?.name}
|
package/src/charts/core/axes.tsx
CHANGED
|
@@ -120,7 +120,7 @@ export const AxisLeft = memo(function AxisLeft({ ticks, offset, title, color }:
|
|
|
120
120
|
x={-10}
|
|
121
121
|
y={-16}
|
|
122
122
|
textAnchor="end"
|
|
123
|
-
className="fill-ink-3 font-bold text-fs-
|
|
123
|
+
className="fill-ink-3 font-bold text-fs-110"
|
|
124
124
|
style={color ? { fill: color } : undefined}
|
|
125
125
|
>
|
|
126
126
|
{title}
|
|
@@ -152,7 +152,7 @@ export const AxisRight = memo(function AxisRight({ ticks, offset, title, color }
|
|
|
152
152
|
x={10}
|
|
153
153
|
y={-16}
|
|
154
154
|
textAnchor="start"
|
|
155
|
-
className="fill-ink-3 font-bold text-fs-
|
|
155
|
+
className="fill-ink-3 font-bold text-fs-110"
|
|
156
156
|
style={color ? { fill: color } : undefined}
|
|
157
157
|
>
|
|
158
158
|
{title}
|