@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
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useId,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
10
|
+
import { useUiStrings } from "../../i18n/index.js";
|
|
11
|
+
import { cn } from "../../utils/cn.js";
|
|
12
|
+
import { useControllableState } from "../../utils/use-controllable-state.js";
|
|
13
|
+
import { formProgress } from "../auth-illustration/model.js";
|
|
14
|
+
import { useOptionalAuth } from "../internal/auth-context.js";
|
|
15
|
+
import {
|
|
16
|
+
LoginFormContext
|
|
17
|
+
} from "./context.js";
|
|
18
|
+
import {
|
|
19
|
+
LoginFormError,
|
|
20
|
+
LoginFormFooter,
|
|
21
|
+
LoginFormHeader,
|
|
22
|
+
LoginFormIdentifier,
|
|
23
|
+
LoginFormOptions,
|
|
24
|
+
LoginFormPassword,
|
|
25
|
+
LoginFormPortals,
|
|
26
|
+
LoginFormProviders,
|
|
27
|
+
LoginFormSubmit
|
|
28
|
+
} from "./parts.js";
|
|
29
|
+
const MAX_ILLUSTRATED_PORTALS = 3;
|
|
30
|
+
function LoginForm({
|
|
31
|
+
onSubmit,
|
|
32
|
+
portals = [],
|
|
33
|
+
portal: portalProp,
|
|
34
|
+
appearance: appearanceProp,
|
|
35
|
+
defaultPortal,
|
|
36
|
+
onPortalChange,
|
|
37
|
+
loading: loadingProp,
|
|
38
|
+
error: errorProp,
|
|
39
|
+
success: successProp,
|
|
40
|
+
children,
|
|
41
|
+
className,
|
|
42
|
+
classNames,
|
|
43
|
+
onFocus,
|
|
44
|
+
onBlur,
|
|
45
|
+
...props
|
|
46
|
+
}) {
|
|
47
|
+
const strings = useUiStrings();
|
|
48
|
+
const auth = useOptionalAuth();
|
|
49
|
+
const baseId = useId();
|
|
50
|
+
const identifierRef = useRef(null);
|
|
51
|
+
const passwordRef = useRef(null);
|
|
52
|
+
const [identifier, setIdentifier] = useState("");
|
|
53
|
+
const [password, setPassword] = useState("");
|
|
54
|
+
const [remember, setRemember] = useState(false);
|
|
55
|
+
const [internal, setInternal] = useState({ loading: false, error: null, success: false, field: null });
|
|
56
|
+
const [portalValue, setPortalValue] = useControllableState({
|
|
57
|
+
prop: portalProp,
|
|
58
|
+
defaultProp: defaultPortal ?? portals[0]?.value ?? "",
|
|
59
|
+
onChange: onPortalChange
|
|
60
|
+
});
|
|
61
|
+
const appearance = appearanceProp ?? (auth?.panel === "solid" ? "open" : "card");
|
|
62
|
+
const loading = loadingProp ?? internal.loading;
|
|
63
|
+
const error = errorProp !== void 0 ? errorProp : internal.error;
|
|
64
|
+
const success = successProp ?? internal.success;
|
|
65
|
+
const portalIndex = Math.max(
|
|
66
|
+
0,
|
|
67
|
+
portals.findIndex((option) => option.value === portalValue)
|
|
68
|
+
);
|
|
69
|
+
const portal = portals[portalIndex];
|
|
70
|
+
const invalidField = error ? internal.field ?? "password" : null;
|
|
71
|
+
const errorPlacement = error === null || error === void 0 || error === "" ? null : errorProp === void 0 && internal.fieldError ? "field" : "form";
|
|
72
|
+
const focusedField = useRef(null);
|
|
73
|
+
const leftOutcome = useRef(false);
|
|
74
|
+
const setAuthState = auth?.setState;
|
|
75
|
+
const setAuthProgress = auth?.setProgress;
|
|
76
|
+
const setAuthActive = auth?.setActiveIndex;
|
|
77
|
+
const progress = formProgress(identifier.length, password.length > 0);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
setAuthProgress?.(progress);
|
|
80
|
+
}, [progress, setAuthProgress]);
|
|
81
|
+
const hasPortal = portal !== void 0;
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (hasPortal) setAuthActive?.(Math.min(portalIndex, MAX_ILLUSTRATED_PORTALS - 1));
|
|
84
|
+
}, [hasPortal, portalIndex, setAuthActive]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (success) {
|
|
87
|
+
leftOutcome.current = true;
|
|
88
|
+
setAuthState?.("success");
|
|
89
|
+
} else if (error) {
|
|
90
|
+
leftOutcome.current = true;
|
|
91
|
+
setAuthState?.("error");
|
|
92
|
+
} else if (leftOutcome.current) {
|
|
93
|
+
leftOutcome.current = false;
|
|
94
|
+
const field = focusedField.current;
|
|
95
|
+
setAuthState?.(field === "identifier" ? "typing" : field || loading ? "password" : "idle");
|
|
96
|
+
}
|
|
97
|
+
}, [success, error, loading, setAuthState]);
|
|
98
|
+
const context = useMemo(
|
|
99
|
+
() => ({
|
|
100
|
+
ids: {
|
|
101
|
+
identifier: `${baseId}-identifier`,
|
|
102
|
+
password: `${baseId}-password`,
|
|
103
|
+
error: `${baseId}-error`,
|
|
104
|
+
fieldError: `${baseId}-field-error`,
|
|
105
|
+
portals: `${baseId}-portals`
|
|
106
|
+
},
|
|
107
|
+
portals,
|
|
108
|
+
portal,
|
|
109
|
+
setPortal: setPortalValue,
|
|
110
|
+
identifier,
|
|
111
|
+
password,
|
|
112
|
+
appearance,
|
|
113
|
+
remember,
|
|
114
|
+
setRemember,
|
|
115
|
+
loading,
|
|
116
|
+
error,
|
|
117
|
+
invalidField,
|
|
118
|
+
errorPlacement,
|
|
119
|
+
setValue: (field, value) => {
|
|
120
|
+
if (field === "identifier") setIdentifier(value);
|
|
121
|
+
else setPassword(value);
|
|
122
|
+
if (internal.error || internal.field) {
|
|
123
|
+
setInternal((current) => ({ ...current, error: null, field: null }));
|
|
124
|
+
}
|
|
125
|
+
setAuthState?.(field === "identifier" ? "typing" : "password");
|
|
126
|
+
},
|
|
127
|
+
identifierRef,
|
|
128
|
+
passwordRef,
|
|
129
|
+
classNames
|
|
130
|
+
}),
|
|
131
|
+
[
|
|
132
|
+
baseId,
|
|
133
|
+
portals,
|
|
134
|
+
portal,
|
|
135
|
+
setPortalValue,
|
|
136
|
+
identifier,
|
|
137
|
+
password,
|
|
138
|
+
appearance,
|
|
139
|
+
remember,
|
|
140
|
+
loading,
|
|
141
|
+
error,
|
|
142
|
+
invalidField,
|
|
143
|
+
errorPlacement,
|
|
144
|
+
internal.error,
|
|
145
|
+
internal.field,
|
|
146
|
+
classNames,
|
|
147
|
+
setAuthState
|
|
148
|
+
]
|
|
149
|
+
);
|
|
150
|
+
const fieldOf = (target) => target === identifierRef.current ? "identifier" : target === passwordRef.current ? "password" : null;
|
|
151
|
+
const handleFocus = (event) => {
|
|
152
|
+
onFocus?.(event);
|
|
153
|
+
const field = fieldOf(event.target);
|
|
154
|
+
if (field) focusedField.current = field;
|
|
155
|
+
if (field && !loading && !success && !error) {
|
|
156
|
+
setAuthState?.(field === "identifier" ? "typing" : "password");
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const handleBlur = (event) => {
|
|
160
|
+
onBlur?.(event);
|
|
161
|
+
if (!fieldOf(event.target)) return;
|
|
162
|
+
const next = event.relatedTarget;
|
|
163
|
+
const staying = next !== null && fieldOf(next) !== null;
|
|
164
|
+
if (!staying) focusedField.current = null;
|
|
165
|
+
if (!staying && !loading && !success && !error) setAuthState?.("idle");
|
|
166
|
+
};
|
|
167
|
+
const fail = (message, field, fieldError = false) => {
|
|
168
|
+
setInternal({ loading: false, error: message, success: false, field, fieldError });
|
|
169
|
+
(field === "identifier" ? identifierRef : passwordRef).current?.focus();
|
|
170
|
+
};
|
|
171
|
+
const handleSubmit = async (event) => {
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
if (loading) return;
|
|
174
|
+
if (!identifier.trim()) return fail(strings.enterIdentifier, "identifier", true);
|
|
175
|
+
if (!password) return fail(strings.enterPassword, "password", true);
|
|
176
|
+
const values = {
|
|
177
|
+
identifier: identifier.trim(),
|
|
178
|
+
password,
|
|
179
|
+
portal: portal?.value,
|
|
180
|
+
remember
|
|
181
|
+
};
|
|
182
|
+
setInternal({ loading: true, error: null, success: false, field: null });
|
|
183
|
+
try {
|
|
184
|
+
await onSubmit?.(values);
|
|
185
|
+
setInternal({ loading: false, error: null, success: onSubmit !== void 0, field: null });
|
|
186
|
+
} catch (cause) {
|
|
187
|
+
fail(
|
|
188
|
+
cause instanceof Error && cause.message ? cause.message : strings.signInFailed,
|
|
189
|
+
"password"
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
return /* @__PURE__ */ jsx(LoginFormContext, { value: context, children: /* @__PURE__ */ jsx(
|
|
194
|
+
"form",
|
|
195
|
+
{
|
|
196
|
+
method: "post",
|
|
197
|
+
noValidate: true,
|
|
198
|
+
...props,
|
|
199
|
+
"aria-busy": loading || void 0,
|
|
200
|
+
onFocus: handleFocus,
|
|
201
|
+
onBlur: handleBlur,
|
|
202
|
+
onSubmit: handleSubmit,
|
|
203
|
+
"data-appearance": appearance,
|
|
204
|
+
className: cn(
|
|
205
|
+
"grid",
|
|
206
|
+
appearance === "open" ? "mx-auto w-full max-w-110 gap-5" : "gap-3.5 px-7 pt-6.5 pb-5.5 @max-md/auth:px-1 @max-md/auth:pt-4",
|
|
207
|
+
appearance === "open" && auth?.panel === "paper" && "px-7 pt-7.5 pb-6",
|
|
208
|
+
classNames?.root,
|
|
209
|
+
className
|
|
210
|
+
),
|
|
211
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
212
|
+
/* @__PURE__ */ jsx(LoginFormHeader, {}),
|
|
213
|
+
/* @__PURE__ */ jsx(LoginFormPortals, {}),
|
|
214
|
+
/* @__PURE__ */ jsx(LoginFormError, {}),
|
|
215
|
+
/* @__PURE__ */ jsx(LoginFormIdentifier, {}),
|
|
216
|
+
/* @__PURE__ */ jsx(LoginFormPassword, {}),
|
|
217
|
+
/* @__PURE__ */ jsx(LoginFormSubmit, {})
|
|
218
|
+
] })
|
|
219
|
+
}
|
|
220
|
+
) });
|
|
221
|
+
}
|
|
222
|
+
LoginForm.Header = LoginFormHeader;
|
|
223
|
+
LoginForm.Portals = LoginFormPortals;
|
|
224
|
+
LoginForm.Identifier = LoginFormIdentifier;
|
|
225
|
+
LoginForm.Password = LoginFormPassword;
|
|
226
|
+
LoginForm.Options = LoginFormOptions;
|
|
227
|
+
LoginForm.Providers = LoginFormProviders;
|
|
228
|
+
LoginForm.Error = LoginFormError;
|
|
229
|
+
LoginForm.Submit = LoginFormSubmit;
|
|
230
|
+
LoginForm.Footer = LoginFormFooter;
|
|
231
|
+
export {
|
|
232
|
+
LoginForm
|
|
233
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { type ButtonProps } from "../../atoms/button/button.js";
|
|
3
|
+
import { Lock } from "../../icons/index.js";
|
|
4
|
+
export interface LoginFormHeaderProps extends Omit<ComponentPropsWithoutRef<"div">, "title"> {
|
|
5
|
+
/** Defaults to the localized "Sign in". */
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
/** Defaults to the description of the selected portal. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Heading element of the title. Defaults to `h1`: the form is the point of the page. */
|
|
10
|
+
titleAs?: "h1" | "h2" | "h3";
|
|
11
|
+
}
|
|
12
|
+
export declare function LoginFormHeader({ title, description, titleAs: Title, className, ...props }: LoginFormHeaderProps): import("react").JSX.Element;
|
|
13
|
+
export interface LoginFormPortalsProps {
|
|
14
|
+
/** Visible heading of the picker. Defaults to the localized "Sign in as". */
|
|
15
|
+
label?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Picker of the portal the person signs in through: a radio group of icon tiles with arrow-key
|
|
20
|
+
* navigation. Renders nothing when the form has fewer than two portals.
|
|
21
|
+
*/
|
|
22
|
+
export declare function LoginFormPortals({ label, className }: LoginFormPortalsProps): import("react").JSX.Element | null;
|
|
23
|
+
export interface LoginFormFieldProps {
|
|
24
|
+
/** Visible label. The default design hides it visually and keeps it for assistive technology. */
|
|
25
|
+
label?: string;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function LoginFormIdentifier({ label, placeholder, className }: LoginFormFieldProps): import("react").JSX.Element;
|
|
30
|
+
export interface LoginFormPasswordProps extends LoginFormFieldProps {
|
|
31
|
+
/** Adds a "Forgot your password?" link to this address. */
|
|
32
|
+
forgotHref?: string;
|
|
33
|
+
/** Replaces the forgot link with any node (a router link, a button). */
|
|
34
|
+
forgot?: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
export declare function LoginFormPassword({ label, placeholder, forgotHref, forgot, className, }: LoginFormPasswordProps): import("react").JSX.Element;
|
|
37
|
+
export interface LoginFormErrorProps extends Omit<ComponentPropsWithoutRef<"p">, "children"> {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Live region for errors about the sign-in itself (wrong credentials, a server message), shown as a
|
|
41
|
+
* callout with an alert icon; place it above the fields. A field left empty is reported under that
|
|
42
|
+
* field instead. It stays in the page while empty so the message is announced.
|
|
43
|
+
*/
|
|
44
|
+
export declare function LoginFormError({ className, ...props }: LoginFormErrorProps): import("react").JSX.Element;
|
|
45
|
+
export interface LoginFormSubmitProps extends Omit<ButtonProps, "type" | "loading"> {
|
|
46
|
+
}
|
|
47
|
+
export declare function LoginFormSubmit({ children, className, ...props }: LoginFormSubmitProps): import("react").JSX.Element;
|
|
48
|
+
export interface LoginFormFooterProps extends ComponentPropsWithoutRef<"div"> {
|
|
49
|
+
}
|
|
50
|
+
/** Terms and privacy links under the form. In the card appearance it is a strip running edge to edge. */
|
|
51
|
+
export declare function LoginFormFooter({ className, ...props }: LoginFormFooterProps): import("react").JSX.Element;
|
|
52
|
+
export { Lock as LoginFormLockIcon };
|
|
53
|
+
export interface LoginFormOptionsProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
54
|
+
/** Label of the checkbox. Defaults to the localized "Remember me". */
|
|
55
|
+
rememberLabel?: string;
|
|
56
|
+
/** Help link or button at the end of the row. */
|
|
57
|
+
help?: ReactNode;
|
|
58
|
+
/** Adds the localized "Need help?" link to this address when `help` is not given. */
|
|
59
|
+
helpHref?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Row under the fields with a remember-me checkbox (reported to `onSubmit` as `remember`) and a help slot. */
|
|
62
|
+
export declare function LoginFormOptions({ rememberLabel, help, helpHref, className, ...props }: LoginFormOptionsProps): import("react").JSX.Element;
|
|
63
|
+
export interface LoginFormProvidersProps extends ComponentPropsWithoutRef<"div"> {
|
|
64
|
+
/** Text on the divider above the providers. Defaults to the localized "Or log in with". */
|
|
65
|
+
label?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Labelled slot for alternative ways to sign in. The library ships no providers: it renders only
|
|
69
|
+
* the children you pass (buttons, links) in a wrapping row, and nothing when there are none.
|
|
70
|
+
*/
|
|
71
|
+
export declare function LoginFormProviders({ label, children, className, ...props }: LoginFormProvidersProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "../../atoms/button/button.js";
|
|
4
|
+
import { Checkbox } from "../../atoms/checkbox/checkbox.js";
|
|
5
|
+
import { Divider } from "../../atoms/divider/divider.js";
|
|
6
|
+
import { RadioGroupItem, RadioGroupRoot } from "../../atoms/radio-group/radio-group-primitive.js";
|
|
7
|
+
import { Spinner } from "../../atoms/spinner/spinner.js";
|
|
8
|
+
import { Field } from "../../forms/field/field.js";
|
|
9
|
+
import { Input } from "../../forms/input/input.js";
|
|
10
|
+
import { PasswordInput } from "../../forms/password-input/password-input.js";
|
|
11
|
+
import { useUiStrings } from "../../i18n/index.js";
|
|
12
|
+
import {
|
|
13
|
+
BookOpen,
|
|
14
|
+
Check,
|
|
15
|
+
CircleAlert,
|
|
16
|
+
GraduationCap,
|
|
17
|
+
House,
|
|
18
|
+
Lock,
|
|
19
|
+
Mail
|
|
20
|
+
} from "../../icons/index.js";
|
|
21
|
+
import { cn } from "../../utils/cn.js";
|
|
22
|
+
import {
|
|
23
|
+
useLoginForm
|
|
24
|
+
} from "./context.js";
|
|
25
|
+
const FALLBACK_ICONS = [
|
|
26
|
+
/* @__PURE__ */ jsx(BookOpen, {}, "book"),
|
|
27
|
+
/* @__PURE__ */ jsx(House, {}, "house"),
|
|
28
|
+
/* @__PURE__ */ jsx(GraduationCap, {}, "cap")
|
|
29
|
+
];
|
|
30
|
+
function LoginFormHeader({
|
|
31
|
+
title,
|
|
32
|
+
description,
|
|
33
|
+
titleAs: Title = "h1",
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
const strings = useUiStrings();
|
|
38
|
+
const { portal, appearance, classNames } = useLoginForm("Header");
|
|
39
|
+
const open = appearance === "open";
|
|
40
|
+
const text = description ?? portal?.description;
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", { ...props, className: cn("grid gap-1.5", classNames?.header, className), children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
Title,
|
|
44
|
+
{
|
|
45
|
+
className: cn(
|
|
46
|
+
"m-0 font-extrabold tracking-tight",
|
|
47
|
+
open ? "text-4xl" : "text-center text-3xl",
|
|
48
|
+
classNames?.title
|
|
49
|
+
),
|
|
50
|
+
children: title ?? strings.signIn
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
text ? /* @__PURE__ */ jsx(
|
|
54
|
+
"p",
|
|
55
|
+
{
|
|
56
|
+
className: cn(
|
|
57
|
+
"m-0 text-balance text-ink-3 text-control",
|
|
58
|
+
!open && "text-center",
|
|
59
|
+
classNames?.description
|
|
60
|
+
),
|
|
61
|
+
children: text
|
|
62
|
+
}
|
|
63
|
+
) : null
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
const PORTAL_TILE = "relative grid h-13 w-16 place-items-center rounded-input border-[1.5px] border-ink-3 bg-surface text-ink transition-[border-color,background-color,transform,box-shadow] duration-150 group-hover:-translate-y-0.5 group-focus-visible:-translate-y-0.5 group-data-[state=checked]:border-ink group-data-[state=checked]:bg-surface-2 group-data-[state=checked]:shadow-[0_2px_0_var(--ink)] [&>svg]:size-6";
|
|
67
|
+
const PORTAL_CHECK = "absolute top-1 right-1 grid size-4 scale-50 place-items-center rounded-full bg-ink text-surface opacity-0 transition-[opacity,scale] duration-150 group-data-[state=checked]:scale-100 group-data-[state=checked]:opacity-100 [&>svg]:size-3 [&>svg]:stroke-3";
|
|
68
|
+
function LoginFormPortals({ label, className }) {
|
|
69
|
+
const strings = useUiStrings();
|
|
70
|
+
const { portals, portal, setPortal, ids, appearance, classNames } = useLoginForm("Portals");
|
|
71
|
+
if (portals.length < 2) return null;
|
|
72
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-2.5", children: [
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
id: ids.portals,
|
|
77
|
+
className: cn(
|
|
78
|
+
"font-semibold text-ink text-control",
|
|
79
|
+
appearance === "card" && "text-center"
|
|
80
|
+
),
|
|
81
|
+
children: label ?? strings.signInAs
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
RadioGroupRoot,
|
|
86
|
+
{
|
|
87
|
+
"aria-labelledby": ids.portals,
|
|
88
|
+
value: portal?.value ?? "",
|
|
89
|
+
onValueChange: setPortal,
|
|
90
|
+
orientation: "horizontal",
|
|
91
|
+
className: cn("grid gap-2.5", classNames?.portals, className),
|
|
92
|
+
style: { gridTemplateColumns: `repeat(${portals.length}, minmax(0, 1fr))` },
|
|
93
|
+
children: portals.map((option, index) => /* @__PURE__ */ jsxs(
|
|
94
|
+
RadioGroupItem,
|
|
95
|
+
{
|
|
96
|
+
value: option.value,
|
|
97
|
+
className: cn(
|
|
98
|
+
"group grid cursor-pointer justify-items-center gap-1.5 rounded-input bg-transparent p-0 font-medium text-control text-ink focus-visible:focus-ring",
|
|
99
|
+
classNames?.portal
|
|
100
|
+
),
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: PORTAL_TILE, children: [
|
|
103
|
+
option.icon ?? FALLBACK_ICONS[index],
|
|
104
|
+
/* @__PURE__ */ jsx("span", { "data-portal-check": "", className: PORTAL_CHECK, children: /* @__PURE__ */ jsx(Check, {}) })
|
|
105
|
+
] }),
|
|
106
|
+
option.label
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
option.value
|
|
110
|
+
))
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsx(Divider, { className: "mt-1.5", children: strings.withYourAccount })
|
|
114
|
+
] });
|
|
115
|
+
}
|
|
116
|
+
const fieldClasses = "[&_input]:text-fs-140";
|
|
117
|
+
const INVALID_INPUT = {
|
|
118
|
+
root: "focus-within:outline-danger has-[input[aria-invalid=true]]:border-2",
|
|
119
|
+
start: "text-danger"
|
|
120
|
+
};
|
|
121
|
+
function fieldErrorOf(field, { invalidField, errorPlacement, error, ids }) {
|
|
122
|
+
const invalid = invalidField === field;
|
|
123
|
+
const below = invalid && errorPlacement === "field" ? error : null;
|
|
124
|
+
return {
|
|
125
|
+
invalid,
|
|
126
|
+
below,
|
|
127
|
+
describedBy: invalid ? below ? ids.fieldError : ids.error : void 0
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function FieldError({ id, children }) {
|
|
131
|
+
return /* @__PURE__ */ jsxs(
|
|
132
|
+
"p",
|
|
133
|
+
{
|
|
134
|
+
id,
|
|
135
|
+
role: "alert",
|
|
136
|
+
className: "m-0 flex items-center gap-1.5 font-semibold text-danger text-meta [&>svg]:size-3.5 [&>svg]:shrink-0",
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ jsx(CircleAlert, { "aria-hidden": "true" }),
|
|
139
|
+
children
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
function LoginFormIdentifier({ label, placeholder, className }) {
|
|
145
|
+
const strings = useUiStrings();
|
|
146
|
+
const form = useLoginForm("Identifier");
|
|
147
|
+
const { ids, portal, identifier, setValue, identifierRef, appearance, classNames } = form;
|
|
148
|
+
const { invalid, below, describedBy } = fieldErrorOf("identifier", form);
|
|
149
|
+
const hideLabel = appearance === "card";
|
|
150
|
+
const text = label ?? portal?.identifierLabel ?? strings.identifier;
|
|
151
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", "data-login-field": "identifier", children: [
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
Field,
|
|
154
|
+
{
|
|
155
|
+
label: text,
|
|
156
|
+
controlId: ids.identifier,
|
|
157
|
+
classNames: { label: hideLabel ? "sr-only" : "" },
|
|
158
|
+
className: cn(fieldClasses, classNames?.identifier, className),
|
|
159
|
+
children: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
160
|
+
Input,
|
|
161
|
+
{
|
|
162
|
+
ref: identifierRef,
|
|
163
|
+
id: ids.identifier,
|
|
164
|
+
name: "identifier",
|
|
165
|
+
size: "lg",
|
|
166
|
+
autoComplete: "username",
|
|
167
|
+
autoCapitalize: "none",
|
|
168
|
+
spellCheck: false,
|
|
169
|
+
placeholder: placeholder ?? (hideLabel ? text : void 0),
|
|
170
|
+
value: identifier,
|
|
171
|
+
onChange: (event) => setValue("identifier", event.currentTarget.value),
|
|
172
|
+
start: /* @__PURE__ */ jsx(Mail, {}),
|
|
173
|
+
classNames: invalid ? INVALID_INPUT : void 0,
|
|
174
|
+
"aria-invalid": invalid || void 0,
|
|
175
|
+
"aria-describedby": describedBy
|
|
176
|
+
}
|
|
177
|
+
) })
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
below ? /* @__PURE__ */ jsx(FieldError, { id: ids.fieldError, children: below }) : null
|
|
181
|
+
] });
|
|
182
|
+
}
|
|
183
|
+
function LoginFormPassword({
|
|
184
|
+
label,
|
|
185
|
+
placeholder,
|
|
186
|
+
forgotHref,
|
|
187
|
+
forgot,
|
|
188
|
+
className
|
|
189
|
+
}) {
|
|
190
|
+
const strings = useUiStrings();
|
|
191
|
+
const form = useLoginForm("Password");
|
|
192
|
+
const { ids, password, setValue, passwordRef, appearance, classNames } = form;
|
|
193
|
+
const { invalid, below, describedBy } = fieldErrorOf("password", form);
|
|
194
|
+
const hideLabel = appearance === "card";
|
|
195
|
+
const text = label ?? strings.password;
|
|
196
|
+
const link = forgot ?? (forgotHref ? /* @__PURE__ */ jsx(
|
|
197
|
+
"a",
|
|
198
|
+
{
|
|
199
|
+
href: forgotHref,
|
|
200
|
+
className: "font-medium text-accent-ink text-control underline underline-offset-3 focus-visible:focus-ring",
|
|
201
|
+
children: strings.forgotPassword
|
|
202
|
+
}
|
|
203
|
+
) : null);
|
|
204
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", "data-login-field": "password", children: [
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
206
|
+
Field,
|
|
207
|
+
{
|
|
208
|
+
label: text,
|
|
209
|
+
controlId: ids.password,
|
|
210
|
+
classNames: { label: hideLabel ? "sr-only" : "" },
|
|
211
|
+
className: cn(fieldClasses, classNames?.password, className),
|
|
212
|
+
children: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
213
|
+
PasswordInput,
|
|
214
|
+
{
|
|
215
|
+
ref: passwordRef,
|
|
216
|
+
id: ids.password,
|
|
217
|
+
name: "password",
|
|
218
|
+
size: "lg",
|
|
219
|
+
start: /* @__PURE__ */ jsx(Lock, {}),
|
|
220
|
+
placeholder: placeholder ?? (hideLabel ? text : void 0),
|
|
221
|
+
value: password,
|
|
222
|
+
onChange: (event) => setValue("password", event.currentTarget.value),
|
|
223
|
+
classNames: invalid ? INVALID_INPUT : void 0,
|
|
224
|
+
"aria-invalid": invalid || void 0,
|
|
225
|
+
"aria-describedby": describedBy
|
|
226
|
+
}
|
|
227
|
+
) })
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
below ? /* @__PURE__ */ jsx(FieldError, { id: ids.fieldError, children: below }) : null,
|
|
231
|
+
link ? /* @__PURE__ */ jsx("div", { className: "justify-self-end", children: link }) : null
|
|
232
|
+
] });
|
|
233
|
+
}
|
|
234
|
+
function LoginFormError({ className, ...props }) {
|
|
235
|
+
const { ids, error, errorPlacement, classNames } = useLoginForm("Error");
|
|
236
|
+
const message = errorPlacement === "form" ? error : null;
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
"p",
|
|
239
|
+
{
|
|
240
|
+
...props,
|
|
241
|
+
id: ids.error,
|
|
242
|
+
role: "alert",
|
|
243
|
+
className: cn(
|
|
244
|
+
"m-0 empty:absolute",
|
|
245
|
+
message && "flex items-start gap-2 rounded-input bg-danger-soft px-3 py-2.5 font-semibold text-danger text-meta [&>svg]:mt-px [&>svg]:size-4 [&>svg]:shrink-0",
|
|
246
|
+
classNames?.error,
|
|
247
|
+
className
|
|
248
|
+
),
|
|
249
|
+
children: message ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
250
|
+
/* @__PURE__ */ jsx(CircleAlert, { "aria-hidden": "true" }),
|
|
251
|
+
message
|
|
252
|
+
] }) : null
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
function LoginFormSubmit({ children, className, ...props }) {
|
|
257
|
+
const strings = useUiStrings();
|
|
258
|
+
const { loading, appearance, classNames } = useLoginForm("Submit");
|
|
259
|
+
return /* @__PURE__ */ jsxs(
|
|
260
|
+
Button,
|
|
261
|
+
{
|
|
262
|
+
variant: "primary",
|
|
263
|
+
size: "lg",
|
|
264
|
+
block: true,
|
|
265
|
+
...props,
|
|
266
|
+
type: "submit",
|
|
267
|
+
loading,
|
|
268
|
+
className: cn(appearance === "open" && "rounded-pill", classNames?.submit, className),
|
|
269
|
+
children: [
|
|
270
|
+
loading ? /* @__PURE__ */ jsx(Spinner, { size: "sm", label: false }) : null,
|
|
271
|
+
children ?? strings.signInAction
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
function LoginFormFooter({ className, ...props }) {
|
|
277
|
+
const { appearance, classNames } = useLoginForm("Footer");
|
|
278
|
+
return /* @__PURE__ */ jsx(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
...props,
|
|
282
|
+
className: cn(
|
|
283
|
+
"text-ink-3 text-meta [&_a]:text-inherit [&_a]:underline [&_a]:underline-offset-2",
|
|
284
|
+
appearance === "card" ? "-mx-7 -mb-5.5 mt-1 border-t-divider px-5 py-3.5 text-center @max-md/auth:-mx-1 @max-md/auth:px-1" : "text-center",
|
|
285
|
+
classNames?.footer,
|
|
286
|
+
className
|
|
287
|
+
)
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
function LoginFormOptions({
|
|
292
|
+
rememberLabel,
|
|
293
|
+
help,
|
|
294
|
+
helpHref,
|
|
295
|
+
className,
|
|
296
|
+
...props
|
|
297
|
+
}) {
|
|
298
|
+
const strings = useUiStrings();
|
|
299
|
+
const { remember, setRemember, classNames } = useLoginForm("Options");
|
|
300
|
+
const link = help ?? (helpHref ? /* @__PURE__ */ jsx(
|
|
301
|
+
"a",
|
|
302
|
+
{
|
|
303
|
+
href: helpHref,
|
|
304
|
+
className: "font-medium text-accent-ink text-control underline underline-offset-3 focus-visible:focus-ring",
|
|
305
|
+
children: strings.needHelp
|
|
306
|
+
}
|
|
307
|
+
) : null);
|
|
308
|
+
return /* @__PURE__ */ jsxs(
|
|
309
|
+
"div",
|
|
310
|
+
{
|
|
311
|
+
...props,
|
|
312
|
+
className: cn(
|
|
313
|
+
"flex flex-wrap items-center justify-between gap-x-4 gap-y-2",
|
|
314
|
+
classNames?.options,
|
|
315
|
+
className
|
|
316
|
+
),
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsx(
|
|
319
|
+
Checkbox,
|
|
320
|
+
{
|
|
321
|
+
name: "remember",
|
|
322
|
+
checked: remember,
|
|
323
|
+
onCheckedChange: (checked) => setRemember(checked === true),
|
|
324
|
+
label: rememberLabel ?? strings.rememberMe,
|
|
325
|
+
classNames: { wrapper: "-ml-2.75" }
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
link
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
function LoginFormProviders({
|
|
334
|
+
label,
|
|
335
|
+
children,
|
|
336
|
+
className,
|
|
337
|
+
...props
|
|
338
|
+
}) {
|
|
339
|
+
const strings = useUiStrings();
|
|
340
|
+
const { classNames } = useLoginForm("Providers");
|
|
341
|
+
if (children === void 0 || children === null || children === false) return null;
|
|
342
|
+
const text = label ?? strings.orLogInWith;
|
|
343
|
+
return (
|
|
344
|
+
// biome-ignore lint/a11y/useSemanticElements: a fieldset would add a legend and form-disabling behaviour the slot does not want
|
|
345
|
+
/* @__PURE__ */ jsxs(
|
|
346
|
+
"div",
|
|
347
|
+
{
|
|
348
|
+
...props,
|
|
349
|
+
role: "group",
|
|
350
|
+
"aria-label": text,
|
|
351
|
+
className: cn("grid gap-3", classNames?.providers, className),
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ jsx(Divider, { children: text }),
|
|
354
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center justify-center gap-2.5", children })
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
export {
|
|
361
|
+
LoginFormError,
|
|
362
|
+
LoginFormFooter,
|
|
363
|
+
LoginFormHeader,
|
|
364
|
+
LoginFormIdentifier,
|
|
365
|
+
Lock as LoginFormLockIcon,
|
|
366
|
+
LoginFormOptions,
|
|
367
|
+
LoginFormPassword,
|
|
368
|
+
LoginFormPortals,
|
|
369
|
+
LoginFormProviders,
|
|
370
|
+
LoginFormSubmit
|
|
371
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type AuthIllustrationProps } from "../auth-illustration/auth-illustration.js";
|
|
2
|
+
import type { AuthLook } from "../auth-illustration/look.js";
|
|
3
|
+
export type AuthIllustrationVariant = "slabs" | "stack" | "mosaic" | "character" | "statement";
|
|
4
|
+
/** The five looks by name. Importing this module keeps all of them in the bundle. */
|
|
5
|
+
export declare const AUTH_LOOKS: Readonly<Record<AuthIllustrationVariant, AuthLook>>;
|
|
6
|
+
export interface AuthIllustrationAnyProps extends Omit<AuthIllustrationProps, "look"> {
|
|
7
|
+
/** The look by name. Defaults to `slabs`. */
|
|
8
|
+
variant?: AuthIllustrationVariant;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `AuthIllustration` with the look chosen by a string. It imports all five looks on purpose, so an
|
|
12
|
+
* app that renders it pays for every look in its bundle (about 2 to 3 KB gzip each). Apps that use
|
|
13
|
+
* one look should pass it to `AuthIllustration` from its own entry, for example
|
|
14
|
+
* `@jcsoftdev/ui/auth/stack`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function AuthIllustrationAny({ variant, ...props }: AuthIllustrationAnyProps): import("react").JSX.Element;
|