@jcsoftdev/ui 0.4.0 → 0.6.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 +434 -0
- package/README.md +26 -4
- package/bin/ui-theme.mjs +40 -6
- package/dist/ai/code-block/code-block.js +1 -1
- package/dist/atoms/big-date/big-date.js +2 -2
- package/dist/atoms/button/button.d.ts +14 -2
- package/dist/atoms/button/button.js +12 -5
- package/dist/atoms/chip/chip.d.ts +5 -0
- package/dist/atoms/chip/chip.js +3 -3
- package/dist/atoms/divider/divider.d.ts +15 -0
- package/dist/atoms/divider/divider.js +27 -0
- package/dist/atoms/divider/index.d.ts +1 -0
- package/dist/atoms/divider/index.js +1 -0
- package/dist/atoms/icon-button/icon-button.d.ts +1 -1
- package/dist/atoms/icon-button/icon-button.js +1 -1
- package/dist/atoms/index.d.ts +1 -0
- package/dist/atoms/index.js +1 -0
- 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/auth/auth-illustration/auth-illustration.d.ts +35 -0
- package/dist/auth/auth-illustration/auth-illustration.js +72 -0
- package/dist/auth/auth-illustration/index.d.ts +3 -0
- package/dist/auth/auth-illustration/index.js +11 -0
- package/dist/auth/auth-illustration/look.d.ts +30 -0
- package/dist/auth/auth-illustration/look.js +0 -0
- package/dist/auth/auth-illustration/model.d.ts +133 -0
- package/dist/auth/auth-illustration/model.js +202 -0
- package/dist/auth/auth-illustration/use-art-pointer.d.ts +9 -0
- package/dist/auth/auth-illustration/use-art-pointer.js +69 -0
- package/dist/auth/auth-layout/auth-layout.d.ts +80 -0
- package/dist/auth/auth-layout/auth-layout.js +190 -0
- package/dist/auth/auth-layout/index.d.ts +1 -0
- package/dist/auth/auth-layout/index.js +1 -0
- package/dist/auth/character/character.d.ts +12 -0
- package/dist/auth/character/character.js +333 -0
- package/dist/auth/character/index.d.ts +1 -0
- package/dist/auth/character/index.js +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.js +4 -0
- package/dist/auth/internal/auth-context.d.ts +17 -0
- package/dist/auth/internal/auth-context.js +10 -0
- package/dist/auth/internal/auth-styles.d.ts +1 -0
- package/dist/auth/internal/auth-styles.js +29 -0
- package/dist/auth/internal/portal-glyphs.d.ts +6 -0
- package/dist/auth/internal/portal-glyphs.js +39 -0
- package/dist/auth/login-form/context.d.ts +51 -0
- package/dist/auth/login-form/context.js +12 -0
- package/dist/auth/login-form/index.d.ts +2 -0
- package/dist/auth/login-form/index.js +23 -0
- package/dist/auth/login-form/login-form.d.ts +66 -0
- package/dist/auth/login-form/login-form.js +233 -0
- package/dist/auth/login-form/parts.d.ts +71 -0
- package/dist/auth/login-form/parts.js +371 -0
- package/dist/auth/looks/auth-illustration-any.d.ts +16 -0
- package/dist/auth/looks/auth-illustration-any.js +24 -0
- package/dist/auth/looks/index.d.ts +1 -0
- package/dist/auth/looks/index.js +1 -0
- package/dist/auth/mosaic/index.d.ts +1 -0
- package/dist/auth/mosaic/index.js +1 -0
- package/dist/auth/mosaic/mosaic.d.ts +11 -0
- package/dist/auth/mosaic/mosaic.js +195 -0
- package/dist/auth/slabs/index.d.ts +1 -0
- package/dist/auth/slabs/index.js +1 -0
- package/dist/auth/slabs/slabs.d.ts +13 -0
- package/dist/auth/slabs/slabs.js +136 -0
- package/dist/auth/stack/index.d.ts +1 -0
- package/dist/auth/stack/index.js +1 -0
- package/dist/auth/stack/stack.d.ts +6 -0
- package/dist/auth/stack/stack.js +222 -0
- package/dist/auth/statement/index.d.ts +1 -0
- package/dist/auth/statement/index.js +1 -0
- package/dist/auth/statement/statement.d.ts +13 -0
- package/dist/auth/statement/statement.js +99 -0
- 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 +101 -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 +109 -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 +28 -2
- package/dist/containers/responsive-list/responsive-list.js +134 -25
- 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 +4 -0
- package/dist/forms/index.js +4 -0
- package/dist/forms/input/input.d.ts +6 -2
- package/dist/forms/input/input.js +6 -2
- 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/password-input/index.d.ts +1 -0
- package/dist/forms/password-input/index.js +1 -0
- package/dist/forms/password-input/password-input.d.ts +16 -0
- package/dist/forms/password-input/password-input.js +45 -0
- 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 +150 -0
- package/dist/i18n/strings.js +80 -2
- package/dist/icons/eye.d.ts +2 -0
- package/dist/icons/eye.js +11 -0
- package/dist/icons/graduation-cap.d.ts +2 -0
- package/dist/icons/graduation-cap.js +12 -0
- package/dist/icons/house.d.ts +2 -0
- package/dist/icons/house.js +11 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +8 -0
- package/dist/icons/mail.d.ts +2 -0
- package/dist/icons/mail.js +11 -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.js +10 -2
- 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/toaster.d.ts +28 -2
- package/dist/overlays/toaster/toaster.js +73 -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.js +1 -1
- package/dist/utils/class-tokens.generated.js +4 -6
- 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/icons/svg/eye.svg +4 -0
- package/icons/svg/graduation-cap.svg +5 -0
- package/icons/svg/house.svg +4 -0
- package/icons/svg/mail.svg +4 -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/big-date/big-date.tsx +2 -2
- package/src/atoms/button/button.tsx +33 -6
- package/src/atoms/chip/chip.tsx +8 -3
- package/src/atoms/divider/divider.tsx +40 -0
- package/src/atoms/divider/index.ts +1 -0
- package/src/atoms/icon-button/icon-button.tsx +2 -2
- package/src/atoms/index.ts +1 -0
- 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/auth/auth-illustration/auth-illustration.tsx +100 -0
- package/src/auth/auth-illustration/index.ts +8 -0
- package/src/auth/auth-illustration/look.ts +32 -0
- package/src/auth/auth-illustration/model.ts +330 -0
- package/src/auth/auth-illustration/use-art-pointer.ts +78 -0
- package/src/auth/auth-layout/auth-layout.tsx +282 -0
- package/src/auth/auth-layout/index.ts +1 -0
- package/src/auth/character/character.tsx +346 -0
- package/src/auth/character/index.ts +1 -0
- package/src/auth/index.ts +4 -0
- package/src/auth/internal/auth-context.ts +26 -0
- package/src/auth/internal/auth-styles.tsx +39 -0
- package/src/auth/internal/portal-glyphs.tsx +32 -0
- package/src/auth/login-form/context.ts +78 -0
- package/src/auth/login-form/index.ts +21 -0
- package/src/auth/login-form/login-form.tsx +330 -0
- package/src/auth/login-form/parts.tsx +457 -0
- package/src/auth/looks/auth-illustration-any.tsx +38 -0
- package/src/auth/looks/index.ts +1 -0
- package/src/auth/mosaic/index.ts +1 -0
- package/src/auth/mosaic/mosaic.tsx +255 -0
- package/src/auth/slabs/index.ts +1 -0
- package/src/auth/slabs/slabs.tsx +181 -0
- package/src/auth/stack/index.ts +1 -0
- package/src/auth/stack/stack.tsx +267 -0
- package/src/auth/statement/index.ts +1 -0
- package/src/auth/statement/statement.tsx +122 -0
- 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 +146 -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 +157 -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 +183 -46
- 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 +4 -0
- package/src/forms/input/input.tsx +12 -3
- package/src/forms/internal/listbox-items.tsx +3 -4
- package/src/forms/native-select/native-select.tsx +1 -1
- package/src/forms/password-input/index.ts +1 -0
- package/src/forms/password-input/password-input.tsx +57 -0
- 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 +150 -0
- package/src/icons/eye.tsx +12 -0
- package/src/icons/graduation-cap.tsx +13 -0
- package/src/icons/house.tsx +12 -0
- package/src/icons/index.ts +4 -0
- package/src/icons/mail.tsx +12 -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 +7 -2
- 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/toaster.tsx +113 -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 +1 -1
- package/src/utils/class-tokens.generated.ts +4 -6
- 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
|
@@ -11,7 +11,20 @@ import { TimeInput } from "../time-input/time-input.js";
|
|
|
11
11
|
import { DatePicker } from "./date-picker.js";
|
|
12
12
|
import { dateTimeInRange, joinDateTime, splitDateTime } from "./model.js";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* `date` is the date picker's root and `time` the wrapper of the time field; `dateInput`, `clear`,
|
|
16
|
+
* `trigger`, `content` and `calendar` reach the inner `DatePicker` parts, `timeInput` the time field.
|
|
17
|
+
*/
|
|
18
|
+
export type DateTimePickerPart =
|
|
19
|
+
| "root"
|
|
20
|
+
| "date"
|
|
21
|
+
| "time"
|
|
22
|
+
| "dateInput"
|
|
23
|
+
| "clear"
|
|
24
|
+
| "trigger"
|
|
25
|
+
| "content"
|
|
26
|
+
| "calendar"
|
|
27
|
+
| "timeInput";
|
|
15
28
|
|
|
16
29
|
export interface DateTimePickerProps
|
|
17
30
|
extends Omit<
|
|
@@ -47,6 +60,8 @@ export interface DateTimePickerProps
|
|
|
47
60
|
"aria-invalid"?: boolean | "true" | "false";
|
|
48
61
|
container?: HTMLElement | null;
|
|
49
62
|
material?: Material;
|
|
63
|
+
/** Height of both halves: `sm` is 30px and `md` (default) 38px, like `Button` and `Input`. */
|
|
64
|
+
size?: "sm" | "md";
|
|
50
65
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
51
66
|
classNames?: ClassNames<DateTimePickerPart>;
|
|
52
67
|
}
|
|
@@ -74,6 +89,7 @@ export function DateTimePicker({
|
|
|
74
89
|
invalid,
|
|
75
90
|
container,
|
|
76
91
|
material,
|
|
92
|
+
size = "md",
|
|
77
93
|
className,
|
|
78
94
|
classNames,
|
|
79
95
|
"aria-label": ariaLabel,
|
|
@@ -158,8 +174,16 @@ export function DateTimePicker({
|
|
|
158
174
|
aria-labelledby={ariaLabelledBy}
|
|
159
175
|
container={container}
|
|
160
176
|
material={material}
|
|
177
|
+
size={size}
|
|
161
178
|
className={undefined}
|
|
162
|
-
classNames={{
|
|
179
|
+
classNames={{
|
|
180
|
+
root: cn("flex-[3_1_10rem]", classNames?.date),
|
|
181
|
+
input: classNames?.dateInput,
|
|
182
|
+
clear: classNames?.clear,
|
|
183
|
+
trigger: classNames?.trigger,
|
|
184
|
+
content: classNames?.content,
|
|
185
|
+
calendar: classNames?.calendar,
|
|
186
|
+
}}
|
|
163
187
|
/>
|
|
164
188
|
<div className={cn("flex min-w-0 flex-[2_1_6rem]", classNames?.time)}>
|
|
165
189
|
<TimeInput
|
|
@@ -170,6 +194,8 @@ export function DateTimePicker({
|
|
|
170
194
|
onValueChange={(time) => update({ ...parts, time })}
|
|
171
195
|
required={required}
|
|
172
196
|
step={step}
|
|
197
|
+
size={size}
|
|
198
|
+
className={classNames?.timeInput}
|
|
173
199
|
/>
|
|
174
200
|
</div>
|
|
175
201
|
{name ? <input type="hidden" name={name} value={current} disabled={disabled} /> : null}
|
|
@@ -21,14 +21,17 @@ interface ControlProps {
|
|
|
21
21
|
id?: string;
|
|
22
22
|
"aria-describedby"?: string;
|
|
23
23
|
"aria-invalid"?: boolean;
|
|
24
|
+
"aria-required"?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
const NATIVE = new Set(["INPUT", "SELECT", "TEXTAREA", "BUTTON"]);
|
|
26
29
|
const FORM_TAGS = new Set(["input", "select", "textarea", "button"]);
|
|
27
30
|
const CONTROL =
|
|
28
31
|
'input:not([type="hidden"]):not([disabled]), select, textarea, [role="combobox"], [role="spinbutton"], [role="slider"], [contenteditable="true"]';
|
|
29
32
|
const FALLBACK_CONTROL = 'button:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])';
|
|
30
33
|
|
|
31
|
-
export type FieldPart = "root" | "label" | "optional" | "hint" | "error";
|
|
34
|
+
export type FieldPart = "root" | "label" | "optional" | "required" | "hint" | "error";
|
|
32
35
|
|
|
33
36
|
export interface FieldProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "id"> {
|
|
34
37
|
/** The label content: text or any node (an icon, a tooltip trigger). */
|
|
@@ -38,6 +41,13 @@ export interface FieldProps extends Omit<ComponentPropsWithoutRef<"div">, "child
|
|
|
38
41
|
error?: string | null;
|
|
39
42
|
/** Marks the field as optional by appending the localized marker to the label. */
|
|
40
43
|
optional?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Marks the field as required: a visible `*` marker (hidden from assistive tech, which gets
|
|
46
|
+
* `aria-required` on the control instead). Native validation is not turned on.
|
|
47
|
+
*/
|
|
48
|
+
required?: boolean;
|
|
49
|
+
/** Disables the control and mutes the label. */
|
|
50
|
+
disabled?: boolean;
|
|
41
51
|
/** Id of the control the label and messages belong to. Generated when omitted. */
|
|
42
52
|
id?: string;
|
|
43
53
|
/**
|
|
@@ -60,6 +70,8 @@ export function Field({
|
|
|
60
70
|
hint,
|
|
61
71
|
error,
|
|
62
72
|
optional,
|
|
73
|
+
required,
|
|
74
|
+
disabled,
|
|
63
75
|
id: idProp,
|
|
64
76
|
controlId: controlIdProp,
|
|
65
77
|
children,
|
|
@@ -86,6 +98,8 @@ export function Field({
|
|
|
86
98
|
id: controlId,
|
|
87
99
|
"aria-describedby": describedBy,
|
|
88
100
|
"aria-invalid": error ? true : undefined,
|
|
101
|
+
...(required ? { "aria-required": true } : null),
|
|
102
|
+
...(disabled ? { disabled: true } : null),
|
|
89
103
|
})
|
|
90
104
|
: children;
|
|
91
105
|
|
|
@@ -107,21 +121,34 @@ export function Field({
|
|
|
107
121
|
const merged = [before.describedby, describedBy].filter(Boolean).join(" ");
|
|
108
122
|
if (merged) target.setAttribute("aria-describedby", merged);
|
|
109
123
|
if (error) target.setAttribute("aria-invalid", "true");
|
|
124
|
+
const beforeRequired = target.getAttribute("aria-required");
|
|
125
|
+
if (required) target.setAttribute("aria-required", "true");
|
|
126
|
+
const native = NATIVE.has(target.tagName);
|
|
127
|
+
const disabledName = native ? "disabled" : "aria-disabled";
|
|
128
|
+
const beforeDisabled = target.getAttribute(disabledName);
|
|
129
|
+
if (disabled) target.setAttribute(disabledName, native ? "" : "true");
|
|
110
130
|
return () => {
|
|
111
131
|
for (const [name, value] of [
|
|
112
132
|
["aria-describedby", before.describedby],
|
|
113
133
|
["aria-invalid", before.invalid],
|
|
134
|
+
["aria-required", beforeRequired],
|
|
135
|
+
[disabledName, beforeDisabled],
|
|
114
136
|
] as const) {
|
|
115
137
|
if (value === null) target.removeAttribute(name);
|
|
116
138
|
else target.setAttribute(name, value);
|
|
117
139
|
}
|
|
118
140
|
};
|
|
119
|
-
}, [single, baseId, controlIdProp, idProp, describedBy, error]);
|
|
141
|
+
}, [single, baseId, controlIdProp, idProp, describedBy, error, required, disabled]);
|
|
120
142
|
|
|
121
143
|
return (
|
|
122
144
|
<div {...props} className={cn("flex min-w-0 flex-col gap-1.25", classNames?.root, className)}>
|
|
123
|
-
<Label htmlFor={controlId} className={classNames?.label}>
|
|
145
|
+
<Label htmlFor={controlId} className={cn(disabled && "text-ink-3", classNames?.label)}>
|
|
124
146
|
{label}
|
|
147
|
+
{required ? (
|
|
148
|
+
<span aria-hidden="true" className={cn("ms-0.5 text-danger", classNames?.required)}>
|
|
149
|
+
*
|
|
150
|
+
</span>
|
|
151
|
+
) : null}
|
|
125
152
|
{optional ? (
|
|
126
153
|
<span className={cn("font-normal text-ink-3", classNames?.optional)}>
|
|
127
154
|
{" "}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
|
|
4
|
+
export interface FieldsetProps extends Omit<ComponentPropsWithoutRef<"fieldset">, "title"> {
|
|
5
|
+
/** The group name; announced with each control inside. */
|
|
6
|
+
legend: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Native `<fieldset>` for a group of related controls (a radio set, an address). `disabled`
|
|
12
|
+
* disables every control inside, as the platform does.
|
|
13
|
+
*/
|
|
14
|
+
export function Fieldset({ legend, description, children, className, ...props }: FieldsetProps) {
|
|
15
|
+
return (
|
|
16
|
+
<fieldset {...props} className={cn("m-0 flex min-w-0 flex-col gap-3 border-0 p-0", className)}>
|
|
17
|
+
<legend className="float-left w-full p-0 font-semibold text-ink-2 text-meta">{legend}</legend>
|
|
18
|
+
{description ? <p className="-mt-1.5 text-meta text-ink-3">{description}</p> : null}
|
|
19
|
+
{children}
|
|
20
|
+
</fieldset>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fieldset, type FieldsetProps } from "./fieldset.js";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
4
|
+
import { Button } from "../../atoms/button/index.js";
|
|
5
|
+
import { useUiStrings } from "../../i18n/index.js";
|
|
6
|
+
import { cn } from "../../utils/cn.js";
|
|
7
|
+
|
|
8
|
+
export interface FormFooterProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
9
|
+
/** Called by the cancel button; without it no cancel button renders. */
|
|
10
|
+
onCancel?: () => void;
|
|
11
|
+
cancelLabel?: string;
|
|
12
|
+
/** Default: the localized "Save". */
|
|
13
|
+
submitLabel?: string;
|
|
14
|
+
/** Submit in flight: the submit button is busy (stays focusable, ignores presses), cancel is disabled. */
|
|
15
|
+
busy?: boolean;
|
|
16
|
+
/** Shows the localized "Unsaved changes" hint (polite live region) beside the actions. */
|
|
17
|
+
dirty?: boolean;
|
|
18
|
+
/** Disables the submit button, e.g. while the form is invalid. */
|
|
19
|
+
submitDisabled?: boolean;
|
|
20
|
+
/** Replaces the dirty hint text. */
|
|
21
|
+
hint?: ReactNode;
|
|
22
|
+
/** Extra actions placed before cancel. */
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
/** Pins the footer to the bottom of its scroll container. Default `true`. */
|
|
25
|
+
sticky?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Action row of a form: cancel and submit on the end, an optional dirty hint on the start.
|
|
30
|
+
* Sticky by default, so the actions stay in reach in a long form or a drawer. Place it inside the
|
|
31
|
+
* `<form>` so the submit button submits it.
|
|
32
|
+
*/
|
|
33
|
+
export function FormFooter({
|
|
34
|
+
onCancel,
|
|
35
|
+
cancelLabel,
|
|
36
|
+
submitLabel,
|
|
37
|
+
busy,
|
|
38
|
+
dirty,
|
|
39
|
+
submitDisabled,
|
|
40
|
+
hint,
|
|
41
|
+
children,
|
|
42
|
+
sticky = true,
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}: FormFooterProps) {
|
|
46
|
+
const strings = useUiStrings();
|
|
47
|
+
const hintContent = hint ?? (dirty ? strings.unsavedChanges : null);
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
{...props}
|
|
51
|
+
aria-busy={busy ? "true" : undefined}
|
|
52
|
+
className={cn(
|
|
53
|
+
"@container/form-footer flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2 border-line border-t bg-surface py-3",
|
|
54
|
+
sticky && "sticky bottom-0 z-10",
|
|
55
|
+
className,
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
<p role="status" className="me-auto min-w-0 text-meta text-ink-3">
|
|
59
|
+
{hintContent}
|
|
60
|
+
</p>
|
|
61
|
+
<div className="flex flex-wrap items-center justify-end gap-2">
|
|
62
|
+
{children}
|
|
63
|
+
{onCancel ? (
|
|
64
|
+
<Button type="button" variant="ghost" disabled={busy} onClick={onCancel}>
|
|
65
|
+
{cancelLabel ?? strings.cancel}
|
|
66
|
+
</Button>
|
|
67
|
+
) : null}
|
|
68
|
+
<Button type="submit" variant="primary" loading={busy} disabled={submitDisabled}>
|
|
69
|
+
{submitLabel ?? strings.save}
|
|
70
|
+
</Button>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormFooter, type FormFooterProps } from "./form-footer.js";
|
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef } from "react";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
3
|
|
|
4
|
-
export type
|
|
4
|
+
export type FormGridColumns = 1 | 2 | 3;
|
|
5
|
+
export type FormGridSpan = 1 | 2 | 3 | "full";
|
|
6
|
+
|
|
7
|
+
export interface FormGridProps extends ComponentPropsWithoutRef<"div"> {
|
|
8
|
+
/**
|
|
9
|
+
* Largest column count, reached by container width: 2 columns from 620px, 3 from 900px
|
|
10
|
+
* (the wrapper is the size container). `1` never splits. Default `2`.
|
|
11
|
+
*/
|
|
12
|
+
columns?: FormGridColumns;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const COLUMNS: Record<FormGridColumns, string> = {
|
|
16
|
+
1: "",
|
|
17
|
+
2: "@min-[620px]/form-grid:grid-cols-[repeat(2,minmax(0,1fr))]",
|
|
18
|
+
3: "@min-[620px]/form-grid:grid-cols-[repeat(2,minmax(0,1fr))] @min-[900px]/form-grid:grid-cols-[repeat(3,minmax(0,1fr))]",
|
|
19
|
+
};
|
|
5
20
|
|
|
6
21
|
/**
|
|
7
|
-
* Grid for
|
|
8
|
-
*
|
|
22
|
+
* Grid for fields. One column in a narrow container, then up to `columns` by container width (the
|
|
23
|
+
* wrapper is the size container; the grid keeps `className` and props).
|
|
9
24
|
*/
|
|
10
|
-
export function FormGrid({ className, ...props }: FormGridProps) {
|
|
25
|
+
export function FormGrid({ columns = 2, className, ...props }: FormGridProps) {
|
|
11
26
|
return (
|
|
12
27
|
<div className="@container/form-grid min-w-0">
|
|
13
28
|
<div
|
|
29
|
+
data-columns={columns}
|
|
14
30
|
className={cn(
|
|
15
|
-
"grid grid-cols-[minmax(0,1fr)] gap-3.5
|
|
31
|
+
"group/form-grid grid grid-cols-[minmax(0,1fr)] gap-3.5",
|
|
32
|
+
COLUMNS[columns],
|
|
16
33
|
className,
|
|
17
34
|
)}
|
|
18
35
|
{...props}
|
|
@@ -20,3 +37,23 @@ export function FormGrid({ className, ...props }: FormGridProps) {
|
|
|
20
37
|
</div>
|
|
21
38
|
);
|
|
22
39
|
}
|
|
40
|
+
|
|
41
|
+
export interface FormGridItemProps extends ComponentPropsWithoutRef<"div"> {
|
|
42
|
+
/**
|
|
43
|
+
* Columns the item spans once the grid has them; it never adds a column the grid does not
|
|
44
|
+
* have. `"full"` spans every column at any width. Default `1`.
|
|
45
|
+
*/
|
|
46
|
+
span?: FormGridSpan;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const SPAN: Record<FormGridSpan, string> = {
|
|
50
|
+
1: "",
|
|
51
|
+
2: "group-data-[columns=2]/form-grid:@min-[620px]/form-grid:col-span-2 group-data-[columns=3]/form-grid:@min-[620px]/form-grid:col-span-2",
|
|
52
|
+
3: "group-data-[columns=3]/form-grid:@min-[620px]/form-grid:col-span-2 group-data-[columns=3]/form-grid:@min-[900px]/form-grid:col-span-3",
|
|
53
|
+
full: "col-span-full",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Grid cell that spans several columns; use it around a `Field` that needs the full row. */
|
|
57
|
+
export function FormGridItem({ span = 1, className, ...props }: FormGridItemProps) {
|
|
58
|
+
return <div className={cn("min-w-0", SPAN[span], className)} {...props} />;
|
|
59
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
|
|
4
|
+
export interface FormSectionProps extends Omit<ComponentPropsWithoutRef<"section">, "title"> {
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** The fields; usually a `FormGrid`. */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Titled block of a form: the title and description beside the fields from 640px of container
|
|
13
|
+
* width, stacked above them in a narrower container (the wrapper is the size container).
|
|
14
|
+
*/
|
|
15
|
+
export function FormSection({
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: FormSectionProps) {
|
|
22
|
+
return (
|
|
23
|
+
<section
|
|
24
|
+
{...props}
|
|
25
|
+
className={cn(
|
|
26
|
+
"@container/form-section min-w-0 [&+&]:border-line [&+&]:border-t [&+&]:pt-6",
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
>
|
|
30
|
+
<div className="grid min-w-0 grid-cols-[minmax(0,1fr)] gap-x-8 gap-y-4 @min-[640px]/form-section:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]">
|
|
31
|
+
<header className="flex min-w-0 flex-col gap-1">
|
|
32
|
+
<h3 className="font-semibold text-fs-140 text-ink [overflow-wrap:anywhere]">{title}</h3>
|
|
33
|
+
{description ? (
|
|
34
|
+
<p className="text-fs-130 text-ink-3 [overflow-wrap:anywhere]">{description}</p>
|
|
35
|
+
) : null}
|
|
36
|
+
</header>
|
|
37
|
+
<div className="min-w-0">{children}</div>
|
|
38
|
+
</div>
|
|
39
|
+
</section>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormSection, type FormSectionProps } from "./form-section.js";
|
package/src/forms/index.ts
CHANGED
|
@@ -8,14 +8,18 @@ export * from "./dropzone/index.js";
|
|
|
8
8
|
export * from "./emoji-picker/index.js";
|
|
9
9
|
export * from "./emoji-reaction-button/index.js";
|
|
10
10
|
export * from "./field/index.js";
|
|
11
|
+
export * from "./fieldset/index.js";
|
|
11
12
|
export * from "./form/index.js";
|
|
13
|
+
export * from "./form-footer/index.js";
|
|
12
14
|
export * from "./form-grid/index.js";
|
|
15
|
+
export * from "./form-section/index.js";
|
|
13
16
|
export * from "./inline-select/index.js";
|
|
14
17
|
export * from "./input/index.js";
|
|
15
18
|
export * from "./input-icon/index.js";
|
|
16
19
|
export * from "./label/index.js";
|
|
17
20
|
export * from "./native-select/index.js";
|
|
18
21
|
export * from "./number-stepper/index.js";
|
|
22
|
+
export * from "./password-input/index.js";
|
|
19
23
|
export * from "./pin-input/index.js";
|
|
20
24
|
export * from "./radio-button-group/index.js";
|
|
21
25
|
export * from "./rating/index.js";
|
|
@@ -2,23 +2,27 @@ import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
|
2
2
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/** `sm` (30px) and `md` (38px) are the heights every control shares; `xs` is the older name of `sm`. */
|
|
6
|
+
export type InputSize = "xs" | "sm" | "md" | "lg";
|
|
6
7
|
export type InputVariant = "default" | "bare";
|
|
7
8
|
export type InputPart = "root" | "start" | "end" | "input";
|
|
8
9
|
|
|
9
10
|
const height: Readonly<Record<InputSize, string>> = {
|
|
10
11
|
xs: "h-control-sm",
|
|
11
|
-
|
|
12
|
+
sm: "h-control-sm",
|
|
13
|
+
md: "h-control-md",
|
|
12
14
|
lg: "h-control-lg text-fs-140",
|
|
13
15
|
};
|
|
14
16
|
const paddingX: Readonly<Record<InputSize, string>> = {
|
|
15
17
|
xs: "px-2.5",
|
|
18
|
+
sm: "px-2.5",
|
|
16
19
|
md: "px-3",
|
|
17
20
|
lg: "px-4",
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
export const inputSizeClasses: Readonly<Record<InputSize, string>> = {
|
|
21
24
|
xs: `${height.xs} ${paddingX.xs}`,
|
|
25
|
+
sm: `${height.sm} ${paddingX.sm}`,
|
|
22
26
|
md: `${height.md} ${paddingX.md}`,
|
|
23
27
|
lg: `${height.lg} ${paddingX.lg}`,
|
|
24
28
|
};
|
|
@@ -30,7 +34,10 @@ const RING =
|
|
|
30
34
|
const INVALID = "aria-[invalid=true]:border-danger";
|
|
31
35
|
|
|
32
36
|
export interface InputProps extends Omit<ComponentPropsWithRef<"input">, "size"> {
|
|
33
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* `sm` is the 30px compact field and `md` (default) the 38px one: the heights of `Button` `sm` and
|
|
39
|
+
* `md`. `xs` is the same as `sm`; `lg` is the thumb-friendly field.
|
|
40
|
+
*/
|
|
34
41
|
size?: InputSize;
|
|
35
42
|
/** `bare` drops the border, background and side padding, for a field that sits inside chrome of its own. */
|
|
36
43
|
variant?: InputVariant;
|
|
@@ -105,6 +112,8 @@ export function Input({
|
|
|
105
112
|
classNames?.input,
|
|
106
113
|
)}
|
|
107
114
|
{...props}
|
|
115
|
+
// The wrapper draws the ring; the unlayered base `:focus-visible` rule outranks `outline-none`.
|
|
116
|
+
style={{ outline: "none", ...props.style }}
|
|
108
117
|
/>
|
|
109
118
|
{end != null ? <span className={cn(adornment, classNames?.end)}>{end}</span> : null}
|
|
110
119
|
</span>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { type ReactNode, useId, useMemo } from "react";
|
|
2
2
|
import { Check } from "../../icons/index.js";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { ITEM_MOTION, POPPER_MOTION } from "../../utils/overlay-motion.js";
|
|
4
5
|
import { isGroup, type ListboxItem, type ListboxOption } from "./listbox.js";
|
|
5
6
|
|
|
6
|
-
export const LISTBOX_SURFACE =
|
|
7
|
-
"z-85 min-w-(--ui-popper-anchor-width) max-h-[min(20rem,var(--ui-popper-available-height))] max-w-(--ui-popper-available-width) overflow-y-auto overscroll-contain rounded-popover surface-overlay p-1.5 text-ink shadow-overlay";
|
|
7
|
+
export const LISTBOX_SURFACE = `z-85 min-w-(--ui-popper-anchor-width) max-h-[min(20rem,var(--ui-popper-available-height))] max-w-(--ui-popper-available-width) overflow-y-auto overscroll-contain rounded-popover surface-overlay p-1.5 text-ink shadow-overlay ${POPPER_MOTION}`;
|
|
8
8
|
|
|
9
|
-
const OPTION =
|
|
10
|
-
"flex min-h-[max(2rem,var(--touch-target))] w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.5 text-body text-ink outline-none data-[highlighted]:bg-surface-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
|
|
9
|
+
const OPTION = `flex min-h-[max(2rem,var(--touch-target))] w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.5 text-body text-ink outline-none data-[highlighted]:bg-surface-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 ${ITEM_MOTION}`;
|
|
11
10
|
|
|
12
11
|
export function optionDomId(base: string, index: number): string {
|
|
13
12
|
return `${base}-opt-${index}`;
|
|
@@ -57,7 +57,7 @@ export function NativeSelect({
|
|
|
57
57
|
aria-invalid={invalid || undefined}
|
|
58
58
|
className={cn(
|
|
59
59
|
"w-full min-w-0 appearance-none rounded-input border-control bg-surface-control py-0 pl-3 text-control text-ink focus:border-transparent focus:outline-2 focus:outline-accent-ink focus:-outline-offset-1 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-danger",
|
|
60
|
-
size === "sm" ? "h-control-sm pr-7" : "h-
|
|
60
|
+
size === "sm" ? "h-control-sm pr-7" : "h-control-md pr-8",
|
|
61
61
|
classNames?.select,
|
|
62
62
|
className,
|
|
63
63
|
)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./password-input.js";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { IconButton } from "../../atoms/icon-button/icon-button.js";
|
|
4
|
+
import { useUiStrings } from "../../i18n/index.js";
|
|
5
|
+
import { Eye, EyeOff } from "../../icons/index.js";
|
|
6
|
+
import { useControllableState } from "../../utils/use-controllable-state.js";
|
|
7
|
+
import { Input, type InputProps } from "../input/input.js";
|
|
8
|
+
|
|
9
|
+
export interface PasswordInputProps extends Omit<InputProps, "type" | "end"> {
|
|
10
|
+
/** Whether the password is shown as text. Controlled; omit it for an uncontrolled field. */
|
|
11
|
+
revealed?: boolean;
|
|
12
|
+
/** Initial visibility of an uncontrolled field. Defaults to hidden. */
|
|
13
|
+
defaultRevealed?: boolean;
|
|
14
|
+
onRevealedChange?: (revealed: boolean) => void;
|
|
15
|
+
/** Accessible name of the reveal toggle; defaults to the UI string `showPassword`. */
|
|
16
|
+
revealLabel?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Password field with a reveal toggle at its end. The toggle keeps one name and reports the
|
|
21
|
+
* state through `aria-pressed`, so a screen reader hears "Show password, pressed" rather than a
|
|
22
|
+
* label that flips. Toggling never moves focus out of the field's row and never submits a form.
|
|
23
|
+
*/
|
|
24
|
+
export function PasswordInput({
|
|
25
|
+
revealed: revealedProp,
|
|
26
|
+
defaultRevealed = false,
|
|
27
|
+
onRevealedChange,
|
|
28
|
+
revealLabel,
|
|
29
|
+
autoComplete = "current-password",
|
|
30
|
+
...props
|
|
31
|
+
}: PasswordInputProps) {
|
|
32
|
+
const strings = useUiStrings();
|
|
33
|
+
const [revealed, setRevealed] = useControllableState({
|
|
34
|
+
prop: revealedProp,
|
|
35
|
+
defaultProp: defaultRevealed,
|
|
36
|
+
onChange: onRevealedChange,
|
|
37
|
+
});
|
|
38
|
+
return (
|
|
39
|
+
<Input
|
|
40
|
+
{...props}
|
|
41
|
+
type={revealed ? "text" : "password"}
|
|
42
|
+
autoComplete={autoComplete}
|
|
43
|
+
end={
|
|
44
|
+
<IconButton
|
|
45
|
+
label={revealLabel ?? strings.showPassword}
|
|
46
|
+
aria-pressed={revealed}
|
|
47
|
+
variant="ghost"
|
|
48
|
+
size="sm"
|
|
49
|
+
className="-mr-1.5"
|
|
50
|
+
onClick={() => setRevealed((current) => !current)}
|
|
51
|
+
>
|
|
52
|
+
{revealed ? <EyeOff /> : <Eye />}
|
|
53
|
+
</IconButton>
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Select, type SelectProps } from "./select.js";
|
|
1
|
+
export { Select, type SelectProps, type SelectSize } from "./select.js";
|
|
@@ -2,18 +2,29 @@ import type { ComponentPropsWithoutRef } from "react";
|
|
|
2
2
|
import { ChevronDown } from "../../icons/index.js";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export type SelectSize = "sm" | "md";
|
|
6
|
+
|
|
7
|
+
export interface SelectProps extends Omit<ComponentPropsWithoutRef<"select">, "size"> {
|
|
8
|
+
/** `sm` is 30px and `md` (default) 38px, the heights of `Button` and `Input` of the same size. */
|
|
9
|
+
size?: SelectSize;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const selectSizeClasses: Readonly<Record<SelectSize, string>> = {
|
|
13
|
+
sm: "h-control-sm pl-2.5",
|
|
14
|
+
md: "h-control-md pl-3",
|
|
15
|
+
};
|
|
6
16
|
|
|
7
17
|
/**
|
|
8
18
|
* Wraps the native `<select>` (keeps the system picker on mobile) and draws
|
|
9
19
|
* the chevron with an icon.
|
|
10
20
|
*/
|
|
11
|
-
export function Select({ className, children, ...props }: SelectProps) {
|
|
21
|
+
export function Select({ size = "md", className, children, ...props }: SelectProps) {
|
|
12
22
|
return (
|
|
13
23
|
<span className="relative flex w-full items-center">
|
|
14
24
|
<select
|
|
15
25
|
className={cn(
|
|
16
|
-
"
|
|
26
|
+
"w-full min-w-0 appearance-none rounded-input border-control bg-surface-control py-0 pr-7 text-control text-ink focus:border-transparent focus:outline-2 focus:outline-accent-ink focus:-outline-offset-1 aria-[invalid=true]:border-danger",
|
|
27
|
+
selectSizeClasses[size],
|
|
17
28
|
className,
|
|
18
29
|
)}
|
|
19
30
|
{...props}
|
|
@@ -223,7 +223,7 @@ export function SelectMenu({
|
|
|
223
223
|
}}
|
|
224
224
|
className={cn(
|
|
225
225
|
"flex w-full min-w-0 items-center justify-between gap-2 rounded-input border-control bg-surface-control py-0 pr-2.5 pl-3 text-left text-control text-ink focus:border-transparent focus:outline-2 focus:outline-accent-ink focus:-outline-offset-1 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-danger",
|
|
226
|
-
size === "sm" ? "h-control-sm" : "h-
|
|
226
|
+
size === "sm" ? "h-control-sm" : "h-control-md min-h-(--touch-target)",
|
|
227
227
|
classNames?.trigger,
|
|
228
228
|
className,
|
|
229
229
|
)}
|
|
@@ -12,8 +12,10 @@ import { cn } from "../../utils/cn.js";
|
|
|
12
12
|
export interface TimeInputProps
|
|
13
13
|
extends Omit<
|
|
14
14
|
ComponentPropsWithoutRef<"input">,
|
|
15
|
-
"type" | "value" | "defaultValue" | "onChange" | "step" | "inputMode" | "maxLength"
|
|
15
|
+
"type" | "value" | "defaultValue" | "onChange" | "step" | "inputMode" | "maxLength" | "size"
|
|
16
16
|
> {
|
|
17
|
+
/** `sm` is 30px and `md` (default) 38px, the heights of `Button` and `Input` of the same size. */
|
|
18
|
+
size?: "sm" | "md";
|
|
17
19
|
/** 24h "HH:MM" (controlled). */
|
|
18
20
|
value?: string;
|
|
19
21
|
defaultValue?: string;
|
|
@@ -50,6 +52,7 @@ export function TimeInput({
|
|
|
50
52
|
defaultValue = "",
|
|
51
53
|
onValueChange,
|
|
52
54
|
step = 5,
|
|
55
|
+
size = "md",
|
|
53
56
|
className,
|
|
54
57
|
onBlur,
|
|
55
58
|
onKeyDown,
|
|
@@ -103,7 +106,8 @@ export function TimeInput({
|
|
|
103
106
|
maxLength={5}
|
|
104
107
|
placeholder={placeholder}
|
|
105
108
|
className={cn(
|
|
106
|
-
|
|
109
|
+
size === "sm" ? "h-control-sm" : "h-control-md",
|
|
110
|
+
"w-full min-w-0 rounded-input border-control bg-surface-control px-3 font-mono text-control text-ink tabular-nums placeholder:text-ink-3 focus:border-transparent focus:outline-2 focus:outline-accent-ink focus:-outline-offset-1 aria-[invalid=true]:border-danger",
|
|
107
111
|
className,
|
|
108
112
|
)}
|
|
109
113
|
{...props}
|