@jcsoftdev/ui 0.5.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 +337 -0
- package/README.md +25 -3
- 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 +6 -1
- package/dist/atoms/button/button.js +2 -2
- package/dist/atoms/chip/chip.d.ts +5 -0
- package/dist/atoms/chip/chip.js +3 -3
- package/dist/atoms/icon-button/icon-button.js +1 -1
- package/dist/atoms/internal/hit-area.d.ts +5 -4
- package/dist/atoms/internal/hit-area.js +1 -1
- package/dist/atoms/progress/index.d.ts +1 -1
- package/dist/atoms/progress/index.js +4 -1
- package/dist/atoms/progress/progress.d.ts +6 -1
- package/dist/atoms/progress/progress.js +19 -1
- package/dist/atoms/radio-group/radio-group.js +1 -1
- package/dist/atoms/status-pill/status-pill.d.ts +16 -5
- package/dist/atoms/status-pill/status-pill.js +43 -18
- package/dist/brand/logo-forge.js +1 -1
- package/dist/charts/candlestick-chart/candlestick-chart.js +2 -2
- package/dist/charts/chart-grid/chart-grid.js +2 -2
- package/dist/charts/chord-chart/chord-chart.js +1 -1
- package/dist/charts/core/axes.js +2 -2
- package/dist/charts/core/cartesian/annotations.js +2 -2
- package/dist/charts/core/cartesian/marks.js +1 -1
- package/dist/charts/core/distribution/marks.js +1 -1
- package/dist/charts/core/distribution/xy-points.js +1 -1
- package/dist/charts/core/export-menu.js +1 -1
- package/dist/charts/funnel-chart/funnel-chart.js +1 -1
- package/dist/charts/gantt-chart/gantt-chart.js +4 -4
- package/dist/charts/gantt-chart/gantt-marks.js +3 -3
- package/dist/charts/index.d.ts +2 -0
- package/dist/charts/index.js +2 -0
- package/dist/charts/maps/geo/map-data-table.js +1 -1
- package/dist/charts/polar-area-chart/polar-area-chart.js +1 -1
- package/dist/charts/radar-chart/radar-chart.js +1 -1
- package/dist/charts/stock-chart/stock-chart.js +1 -1
- package/dist/charts/stock-chart/stock-drawing-layer.js +3 -3
- package/dist/charts/stock-chart/stock-plot.js +2 -2
- package/dist/containers/chat-thread/chat-thread.d.ts +98 -0
- package/dist/containers/chat-thread/chat-thread.js +219 -0
- package/dist/containers/chat-thread/format.d.ts +20 -0
- package/dist/containers/chat-thread/format.js +50 -0
- package/dist/containers/chat-thread/index.d.ts +1 -0
- package/dist/containers/chat-thread/index.js +8 -0
- package/dist/containers/cols/cols.d.ts +1 -1
- package/dist/containers/cols/cols.js +7 -0
- package/dist/containers/comment/comment.js +1 -1
- package/dist/containers/context-rail/context-rail.d.ts +62 -0
- package/dist/containers/context-rail/context-rail.js +175 -0
- package/dist/containers/context-rail/index.d.ts +1 -0
- package/dist/containers/context-rail/index.js +6 -0
- package/dist/containers/dashboard/dashboard.d.ts +40 -0
- package/dist/containers/dashboard/dashboard.js +84 -0
- package/dist/containers/dashboard/index.d.ts +1 -0
- package/dist/containers/dashboard/index.js +14 -0
- package/dist/containers/data-grid/data-grid.demos.js +4 -4
- package/dist/containers/data-grid/data-grid.js +6 -6
- package/dist/containers/data-grid/filter-builder-editor.js +2 -2
- package/dist/containers/data-grid/grid-toolbar.js +1 -1
- package/dist/containers/data-grid/spreadsheet.demos.d.ts +1 -1
- package/dist/containers/data-grid/spreadsheet.demos.js +1 -1
- package/dist/containers/detail-header/detail-header.d.ts +24 -0
- package/dist/containers/detail-header/detail-header.js +32 -0
- package/dist/containers/detail-header/index.d.ts +1 -0
- package/dist/containers/detail-header/index.js +6 -0
- package/dist/containers/facts/facts.js +1 -1
- package/dist/containers/filter-bar/filter-bar.d.ts +58 -0
- package/dist/containers/filter-bar/filter-bar.js +123 -0
- package/dist/containers/filter-bar/index.d.ts +1 -0
- package/dist/containers/filter-bar/index.js +6 -0
- package/dist/containers/hbars/hbars.js +2 -2
- package/dist/containers/index.d.ts +9 -0
- package/dist/containers/index.js +9 -0
- package/dist/containers/kanban/kanban.d.ts +23 -2
- package/dist/containers/kanban/kanban.js +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 +3 -0
- package/dist/forms/index.js +3 -0
- package/dist/forms/input/input.d.ts +6 -2
- package/dist/forms/input/input.js +4 -1
- package/dist/forms/internal/listbox-items.d.ts +1 -1
- package/dist/forms/internal/listbox-items.js +3 -2
- package/dist/forms/native-select/native-select.js +1 -1
- package/dist/forms/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 +86 -0
- package/dist/i18n/strings.js +46 -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/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 +8 -3
- package/src/atoms/chip/chip.tsx +8 -3
- package/src/atoms/icon-button/icon-button.tsx +1 -1
- package/src/atoms/internal/hit-area.ts +5 -4
- package/src/atoms/progress/index.ts +8 -1
- package/src/atoms/progress/progress.tsx +30 -1
- package/src/atoms/radio-group/radio-group.tsx +1 -1
- package/src/atoms/status-pill/status-pill.tsx +59 -18
- package/src/brand/logo-forge.tsx +1 -1
- package/src/charts/candlestick-chart/candlestick-chart.tsx +2 -2
- package/src/charts/chart-grid/chart-grid.tsx +2 -2
- package/src/charts/chord-chart/chord-chart.tsx +1 -1
- package/src/charts/core/axes.tsx +2 -2
- package/src/charts/core/cartesian/annotations.tsx +2 -2
- package/src/charts/core/cartesian/marks.tsx +1 -1
- package/src/charts/core/distribution/marks.tsx +1 -1
- package/src/charts/core/distribution/xy-points.tsx +1 -1
- package/src/charts/core/export-menu.tsx +1 -1
- package/src/charts/funnel-chart/funnel-chart.tsx +1 -1
- package/src/charts/gantt-chart/gantt-chart.tsx +4 -4
- package/src/charts/gantt-chart/gantt-marks.tsx +3 -3
- package/src/charts/index.ts +2 -0
- package/src/charts/maps/geo/map-data-table.tsx +1 -1
- package/src/charts/polar-area-chart/polar-area-chart.tsx +1 -1
- package/src/charts/radar-chart/radar-chart.tsx +1 -1
- package/src/charts/stock-chart/stock-chart.tsx +1 -1
- package/src/charts/stock-chart/stock-drawing-layer.tsx +3 -3
- package/src/charts/stock-chart/stock-plot.tsx +2 -2
- package/src/containers/chat-thread/chat-thread.tsx +331 -0
- package/src/containers/chat-thread/format.ts +67 -0
- package/src/containers/chat-thread/index.ts +12 -0
- package/src/containers/cols/cols.tsx +13 -1
- package/src/containers/comment/comment.tsx +1 -1
- package/src/containers/context-rail/context-rail.tsx +229 -0
- package/src/containers/context-rail/index.ts +7 -0
- package/src/containers/dashboard/dashboard.tsx +142 -0
- package/src/containers/dashboard/index.ts +12 -0
- package/src/containers/data-grid/data-grid.demos.tsx +4 -4
- package/src/containers/data-grid/data-grid.tsx +6 -6
- package/src/containers/data-grid/filter-builder-editor.tsx +2 -2
- package/src/containers/data-grid/grid-toolbar.tsx +1 -1
- package/src/containers/data-grid/spreadsheet.demos.tsx +1 -1
- package/src/containers/detail-header/detail-header.tsx +64 -0
- package/src/containers/detail-header/index.ts +5 -0
- package/src/containers/facts/facts.tsx +1 -1
- package/src/containers/filter-bar/filter-bar.tsx +201 -0
- package/src/containers/filter-bar/index.ts +7 -0
- package/src/containers/hbars/hbars.tsx +2 -2
- package/src/containers/index.ts +9 -0
- package/src/containers/kanban/kanban.tsx +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 +3 -0
- package/src/forms/input/input.tsx +10 -3
- package/src/forms/internal/listbox-items.tsx +3 -4
- package/src/forms/native-select/native-select.tsx +1 -1
- package/src/forms/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 +86 -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,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
Children,
|
|
5
|
+
isValidElement
|
|
6
|
+
} from "react";
|
|
7
|
+
import { composeRefs, Slot } from "../utils/slot.js";
|
|
8
|
+
import { MotionStyles } from "./motion-styles.js";
|
|
9
|
+
import { useEnterPhase } from "./use-enter-phase.js";
|
|
10
|
+
function phaseProps(phase, vars, style) {
|
|
11
|
+
if (phase === "static") return { style };
|
|
12
|
+
return { "data-motion": phase, style: { ...vars, ...style } };
|
|
13
|
+
}
|
|
14
|
+
function Reveal({ delay, inView = false, asChild, style, ref, ...props }) {
|
|
15
|
+
const [phaseRef, phase] = useEnterPhase(inView);
|
|
16
|
+
const Comp = asChild ? Slot : "div";
|
|
17
|
+
const vars = { "--ui-motion-i": 0 };
|
|
18
|
+
if (delay) vars["--ui-motion-delay"] = `${delay}ms`;
|
|
19
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(MotionStyles, {}),
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
Comp,
|
|
23
|
+
{
|
|
24
|
+
ref: composeRefs(ref, phaseRef),
|
|
25
|
+
...phaseProps(phase, vars, style),
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
function Stagger({
|
|
32
|
+
delay,
|
|
33
|
+
inView = false,
|
|
34
|
+
maxStagger,
|
|
35
|
+
as: Tag = "div",
|
|
36
|
+
style,
|
|
37
|
+
ref,
|
|
38
|
+
children,
|
|
39
|
+
...props
|
|
40
|
+
}) {
|
|
41
|
+
const [phaseRef, phase] = useEnterPhase(inView);
|
|
42
|
+
const items = Children.toArray(children);
|
|
43
|
+
const vars = { "--ui-motion-n": Math.max(1, items.length - 1) };
|
|
44
|
+
if (maxStagger !== void 0) vars["--ui-motion-span"] = `${Math.max(0, maxStagger)}ms`;
|
|
45
|
+
const itemVars = (i) => {
|
|
46
|
+
const next = { "--ui-motion-i": i };
|
|
47
|
+
if (delay) next["--ui-motion-delay"] = `${delay}ms`;
|
|
48
|
+
return next;
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51
|
+
/* @__PURE__ */ jsx(MotionStyles, {}),
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
Tag,
|
|
54
|
+
{
|
|
55
|
+
ref: composeRefs(ref, phaseRef),
|
|
56
|
+
"data-motion-stagger": phase === "static" ? void 0 : "",
|
|
57
|
+
style: phase === "static" ? style : { ...vars, ...style },
|
|
58
|
+
...props,
|
|
59
|
+
children: items.map(
|
|
60
|
+
(child, i) => isValidElement(child) ? /* @__PURE__ */ jsx(Slot, { ...phaseProps(phase, itemVars(i)), children: child }, child.key) : child
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
Reveal,
|
|
68
|
+
Stagger
|
|
69
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type RefCallback } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* True when this component's first render came from server HTML (on the server and while
|
|
4
|
+
* hydrating), false when it mounted on the client. Fixed for the component's lifetime, so server
|
|
5
|
+
* markup is never animated after hydration and hydration always matches it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useStartedOnServer(): boolean;
|
|
8
|
+
/** `static`: no motion (server HTML or reduced motion). `wait`: hidden until in view. `enter`: animating in. */
|
|
9
|
+
export type EnterPhase = "static" | "wait" | "enter";
|
|
10
|
+
/** Phase of an enter animation, on mount or (with `inView`) when the element first scrolls into view. */
|
|
11
|
+
export declare function useEnterPhase(inView: boolean): [RefCallback<HTMLElement>, EnterPhase];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState, useSyncExternalStore } from "react";
|
|
3
|
+
import { usePrefersReducedMotion } from "../utils/reduced-motion.js";
|
|
4
|
+
const subscribeNever = () => () => {
|
|
5
|
+
};
|
|
6
|
+
function useStartedOnServer() {
|
|
7
|
+
const hydrating = useSyncExternalStore(
|
|
8
|
+
subscribeNever,
|
|
9
|
+
() => false,
|
|
10
|
+
() => true
|
|
11
|
+
);
|
|
12
|
+
const [started] = useState(hydrating);
|
|
13
|
+
return started;
|
|
14
|
+
}
|
|
15
|
+
function useEnterPhase(inView) {
|
|
16
|
+
const startedOnServer = useStartedOnServer();
|
|
17
|
+
const reduced = usePrefersReducedMotion();
|
|
18
|
+
const [seen, setSeen] = useState(!inView);
|
|
19
|
+
const [node, setNode] = useState(null);
|
|
20
|
+
const animate = !startedOnServer && !reduced;
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!animate || seen || !node) return;
|
|
23
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
24
|
+
setSeen(true);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const observer = new IntersectionObserver((entries) => {
|
|
28
|
+
if (!entries.some((entry) => entry.isIntersecting)) return;
|
|
29
|
+
observer.disconnect();
|
|
30
|
+
setSeen(true);
|
|
31
|
+
});
|
|
32
|
+
observer.observe(node);
|
|
33
|
+
return () => observer.disconnect();
|
|
34
|
+
}, [animate, seen, node]);
|
|
35
|
+
return [setNode, !animate ? "static" : seen ? "enter" : "wait"];
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
useEnterPhase,
|
|
39
|
+
useStartedOnServer
|
|
40
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type AnimationEvent, type Key } from "react";
|
|
2
|
+
type Pulse = "a" | "b";
|
|
3
|
+
/** Props for a highlighted row: spread them on the row element (`tr`, `li`, `div`). */
|
|
4
|
+
export interface HighlightRowProps {
|
|
5
|
+
"data-motion-pulse"?: Pulse;
|
|
6
|
+
onAnimationEnd: (event: AnimationEvent<HTMLElement>) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface HighlightRow<K extends Key> {
|
|
9
|
+
/** Pulses the row with this key, e.g. after it was updated. Calling it again restarts the pulse. */
|
|
10
|
+
highlight: (key: K) => void;
|
|
11
|
+
/** Props for the row with this key. Render `<MotionStyles />` or any motion component once on the page. */
|
|
12
|
+
rowProps: (key: K) => HighlightRowProps;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A brief background pulse (accent tint fading out over 1.6 `--motion-duration`s) on rows that
|
|
16
|
+
* were inserted or updated. Pass the current row keys to pulse every key that appears after the
|
|
17
|
+
* first render automatically; call `highlight(key)` for updates. The rows on the first render
|
|
18
|
+
* (and in server HTML) never pulse, and under reduced motion nothing pulses.
|
|
19
|
+
* In a `tr` the cells carry the pulse, so it shows through cell backgrounds.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useHighlightRow<K extends Key>(keys?: readonly K[]): HighlightRow<K>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { usePrefersReducedMotion } from "../utils/reduced-motion.js";
|
|
4
|
+
function useHighlightRow(keys) {
|
|
5
|
+
const reduced = usePrefersReducedMotion();
|
|
6
|
+
const [pulses, setPulses] = useState(() => /* @__PURE__ */ new Map());
|
|
7
|
+
const known = useRef(null);
|
|
8
|
+
const highlight = useCallback(
|
|
9
|
+
(key) => {
|
|
10
|
+
if (reduced) return;
|
|
11
|
+
setPulses((map) => new Map(map).set(key, map.get(key) === "a" ? "b" : "a"));
|
|
12
|
+
},
|
|
13
|
+
[reduced]
|
|
14
|
+
);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!keys) return;
|
|
17
|
+
const previous = known.current;
|
|
18
|
+
known.current = new Set(keys);
|
|
19
|
+
if (!previous) return;
|
|
20
|
+
for (const key of keys) if (!previous.has(key)) highlight(key);
|
|
21
|
+
}, [keys, highlight]);
|
|
22
|
+
const rowProps = (key) => ({
|
|
23
|
+
"data-motion-pulse": pulses.get(key),
|
|
24
|
+
onAnimationEnd: (event) => {
|
|
25
|
+
if (!event.animationName.startsWith("ui-motion-pulse")) return;
|
|
26
|
+
setPulses((map) => {
|
|
27
|
+
if (!map.has(key)) return map;
|
|
28
|
+
const next = new Map(map);
|
|
29
|
+
next.delete(key);
|
|
30
|
+
return next;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return { highlight, rowProps };
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
useHighlightRow
|
|
38
|
+
};
|
|
@@ -120,7 +120,7 @@ function TabsTrigger({
|
|
|
120
120
|
}
|
|
121
121
|
}),
|
|
122
122
|
className: cn(
|
|
123
|
-
"inline-flex shrink-0 cursor-pointer items-center gap-1.5 whitespace-nowrap border-b-2 border-transparent px-2.5 @max-[420px]/tabs:px-2 pt-2.75 pb-2.5 text-control text-ink-3 hover:text-ink focus-visible:-outline-offset-2 data-[state=active]:border-accent-word data-[state=active]:text-ink",
|
|
123
|
+
"inline-flex min-h-(--touch-target) shrink-0 cursor-pointer items-center gap-1.5 whitespace-nowrap border-b-2 border-transparent px-2.5 @max-[420px]/tabs:px-2 pt-2.75 pb-2.5 text-control text-ink-3 hover:text-ink focus-visible:-outline-offset-2 data-[state=active]:border-accent-word data-[state=active]:text-ink",
|
|
124
124
|
className
|
|
125
125
|
),
|
|
126
126
|
children: [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
import { type ButtonSize } from "../../atoms/button/button.js";
|
|
2
3
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
3
4
|
import { type WizardGate } from "./model.js";
|
|
4
5
|
export type { WizardGate } from "./model.js";
|
|
@@ -32,6 +33,8 @@ export interface WizardProps extends Omit<ComponentPropsWithoutRef<"div">, "chil
|
|
|
32
33
|
backLabel?: string | undefined;
|
|
33
34
|
nextLabel?: string | undefined;
|
|
34
35
|
finishLabel?: string | undefined;
|
|
36
|
+
/** Size of the Back and Next/Finish buttons. Default `md` (38px, the height of a default field). */
|
|
37
|
+
buttonSize?: ButtonSize | undefined;
|
|
35
38
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root. */
|
|
36
39
|
classNames?: ClassNames<WizardPart>;
|
|
37
40
|
}
|
|
@@ -42,4 +45,4 @@ export interface WizardProps extends Omit<ComponentPropsWithoutRef<"div">, "chil
|
|
|
42
45
|
* single-line input advances. Under 420px of its own width the step title becomes visible and
|
|
43
46
|
* the buttons stack.
|
|
44
47
|
*/
|
|
45
|
-
export declare function Wizard({ steps, value: valueProp, defaultValue, onValueChange, onBeforeNext, onComplete, backLabel, nextLabel, finishLabel, className, classNames, ...props }: WizardProps): import("react").JSX.Element | null;
|
|
48
|
+
export declare function Wizard({ steps, value: valueProp, defaultValue, onValueChange, onBeforeNext, onComplete, backLabel, nextLabel, buttonSize, finishLabel, className, classNames, ...props }: WizardProps): import("react").JSX.Element | null;
|
|
@@ -20,6 +20,7 @@ function Wizard({
|
|
|
20
20
|
onComplete,
|
|
21
21
|
backLabel,
|
|
22
22
|
nextLabel,
|
|
23
|
+
buttonSize = "md",
|
|
23
24
|
finishLabel,
|
|
24
25
|
className,
|
|
25
26
|
classNames,
|
|
@@ -139,6 +140,7 @@ function Wizard({
|
|
|
139
140
|
Button,
|
|
140
141
|
{
|
|
141
142
|
variant: "secondary",
|
|
143
|
+
size: buttonSize,
|
|
142
144
|
disabled: index === 0 || pending !== null,
|
|
143
145
|
onClick: () => goTo(index - 1),
|
|
144
146
|
className: classNames?.back,
|
|
@@ -149,6 +151,7 @@ function Wizard({
|
|
|
149
151
|
Button,
|
|
150
152
|
{
|
|
151
153
|
variant: "primary",
|
|
154
|
+
size: buttonSize,
|
|
152
155
|
loading: pending !== null,
|
|
153
156
|
loadingLabel: strings.processing,
|
|
154
157
|
disabled: blocked,
|
|
@@ -14,6 +14,7 @@ import { useUiStrings } from "../../i18n/index.js";
|
|
|
14
14
|
import * as DialogPrimitive from "../../primitives/dialog/dialog.js";
|
|
15
15
|
import { cn } from "../../utils/cn.js";
|
|
16
16
|
import { materialClass } from "../../utils/material.js";
|
|
17
|
+
import { DIALOG_MOTION, OVERLAY_MOTION } from "../../utils/overlay-motion.js";
|
|
17
18
|
import { useControllableState } from "../../utils/use-controllable-state.js";
|
|
18
19
|
import {
|
|
19
20
|
PreviousFocusProvider,
|
|
@@ -191,7 +192,12 @@ function AlertDialogPanel({
|
|
|
191
192
|
}) {
|
|
192
193
|
const previousFocusRef = usePreviousFocus();
|
|
193
194
|
return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { container, children: [
|
|
194
|
-
/* @__PURE__ */ jsx(
|
|
195
|
+
/* @__PURE__ */ jsx(
|
|
196
|
+
DialogPrimitive.Overlay,
|
|
197
|
+
{
|
|
198
|
+
className: cn("fixed inset-0 z-70 bg-scrim", OVERLAY_MOTION, classNames?.overlay)
|
|
199
|
+
}
|
|
200
|
+
),
|
|
195
201
|
/* @__PURE__ */ jsx(
|
|
196
202
|
DialogPrimitive.Content,
|
|
197
203
|
{
|
|
@@ -204,6 +210,7 @@ function AlertDialogPanel({
|
|
|
204
210
|
onCloseAutoFocus: (event) => restoreFocusOnClose(event, previousFocusRef),
|
|
205
211
|
className: cn(
|
|
206
212
|
"@container/dialog fixed top-[9dvh] left-1/2 z-70 flex max-h-[84dvh] w-[min(420px,100%)] max-w-full -translate-x-1/2 flex-col overflow-auto rounded-dialog outline-none surface-overlay shadow-overlay",
|
|
213
|
+
DIALOG_MOTION,
|
|
207
214
|
materialClass(material, "surface-solid"),
|
|
208
215
|
classNames?.root,
|
|
209
216
|
className
|
|
@@ -13,6 +13,7 @@ import { Check } from "../../icons/index.js";
|
|
|
13
13
|
import * as MenuPrimitive from "../../primitives/menu/menu.js";
|
|
14
14
|
import { cn } from "../../utils/cn.js";
|
|
15
15
|
import { materialClass } from "../../utils/material.js";
|
|
16
|
+
import { ITEM_MOTION, POPPER_MOTION } from "../../utils/overlay-motion.js";
|
|
16
17
|
const ContextMenuContext = createContext(null);
|
|
17
18
|
const LONG_PRESS_MS = 600;
|
|
18
19
|
function ContextMenu({
|
|
@@ -141,6 +142,7 @@ function ContextMenuContent({
|
|
|
141
142
|
},
|
|
142
143
|
className: cn(
|
|
143
144
|
"z-85 max-h-(--ui-popper-available-height) min-w-48 max-w-(--ui-popper-available-width) overflow-y-auto rounded-popover border-card surface-overlay p-1.5 text-ink shadow-overlay",
|
|
145
|
+
POPPER_MOTION,
|
|
144
146
|
materialClass(material, "surface-solid"),
|
|
145
147
|
className
|
|
146
148
|
),
|
|
@@ -148,7 +150,7 @@ function ContextMenuContent({
|
|
|
148
150
|
}
|
|
149
151
|
) });
|
|
150
152
|
}
|
|
151
|
-
const itemBase =
|
|
153
|
+
const itemBase = `relative flex min-h-control-sm w-full cursor-pointer select-none items-center gap-density-sm rounded-button px-control-x text-body outline-none data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-surface-2 [&_svg]:size-4 [&_svg]:shrink-0 ${ITEM_MOTION}`;
|
|
152
154
|
function ContextMenuItem({ className, tone = "default", ...props }) {
|
|
153
155
|
return /* @__PURE__ */ jsx(
|
|
154
156
|
MenuPrimitive.Item,
|
|
@@ -5,6 +5,7 @@ import { X } from "../../icons/index.js";
|
|
|
5
5
|
import * as DialogPrimitive from "../../primitives/dialog/dialog.js";
|
|
6
6
|
import { cn } from "../../utils/cn.js";
|
|
7
7
|
import { materialClass } from "../../utils/material.js";
|
|
8
|
+
import { DIALOG_MOTION, OVERLAY_MOTION } from "../../utils/overlay-motion.js";
|
|
8
9
|
import {
|
|
9
10
|
PreviousFocusProvider,
|
|
10
11
|
restoreFocusOnClose,
|
|
@@ -39,13 +40,19 @@ function DialogContent({
|
|
|
39
40
|
const previousFocusRef = usePreviousFocus();
|
|
40
41
|
const strings = useUiStrings();
|
|
41
42
|
return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { container, children: [
|
|
42
|
-
/* @__PURE__ */ jsx(
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
DialogPrimitive.Overlay,
|
|
45
|
+
{
|
|
46
|
+
className: cn("fixed inset-0 z-70 bg-scrim", OVERLAY_MOTION, classNames?.overlay)
|
|
47
|
+
}
|
|
48
|
+
),
|
|
43
49
|
/* @__PURE__ */ jsxs(
|
|
44
50
|
DialogPrimitive.Content,
|
|
45
51
|
{
|
|
46
52
|
className: cn(
|
|
47
53
|
"@container/dialog fixed top-[9dvh] left-1/2 z-70 flex max-h-[84dvh] max-w-full -translate-x-1/2 flex-col overflow-auto rounded-dialog outline-none surface-overlay shadow-overlay",
|
|
48
54
|
widthClasses[width],
|
|
55
|
+
DIALOG_MOTION,
|
|
49
56
|
materialClass(material, "surface-solid"),
|
|
50
57
|
classNames?.root,
|
|
51
58
|
className
|
|
@@ -74,7 +81,8 @@ function DialogContent({
|
|
|
74
81
|
{
|
|
75
82
|
"aria-label": closeLabel ?? strings.close,
|
|
76
83
|
className: cn(
|
|
77
|
-
|
|
84
|
+
// A 30px square (44px under touch) centred where the 24px button was, so the glyph stays put.
|
|
85
|
+
"absolute top-[calc(0.5625rem-0.4375rem*var(--touch))] right-[calc(0.5625rem-0.4375rem*var(--touch))] flex size-control-sm items-center justify-center rounded-event text-ink-3 hover:text-ink",
|
|
78
86
|
classNames?.close
|
|
79
87
|
),
|
|
80
88
|
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-4" })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
2
|
import * as DialogPrimitive from "../../primitives/dialog/dialog.js";
|
|
3
3
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
4
4
|
import { type Material } from "../../utils/material.js";
|
|
@@ -11,7 +11,10 @@ export declare const DrawerTrigger: typeof DialogPrimitive.Trigger;
|
|
|
11
11
|
export declare const DrawerClose: typeof DialogPrimitive.Close;
|
|
12
12
|
export declare function DrawerTitle({ className, ...props }: ComponentPropsWithoutRef<typeof DialogPrimitive.Title>): import("react").JSX.Element;
|
|
13
13
|
export declare function DrawerDescription({ className, ...props }: ComponentPropsWithoutRef<typeof DialogPrimitive.Description>): import("react").JSX.Element;
|
|
14
|
-
export type DrawerContentPart = "root" | "overlay" | "close";
|
|
14
|
+
export type DrawerContentPart = "root" | "overlay" | "close" | "handle";
|
|
15
|
+
export type DrawerSide = "right" | "bottom";
|
|
16
|
+
/** Classes of the content box for a side; exported for tests and for wrappers that restyle it. */
|
|
17
|
+
export declare function drawerSideClass(side: DrawerSide): string;
|
|
15
18
|
export interface DrawerContentProps extends DialogPrimitive.DialogContentProps {
|
|
16
19
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the content and is merged last. */
|
|
17
20
|
classNames?: ClassNames<DrawerContentPart>;
|
|
@@ -26,6 +29,17 @@ export interface DrawerContentProps extends DialogPrimitive.DialogContentProps {
|
|
|
26
29
|
blocking?: boolean;
|
|
27
30
|
/** Accessible label of the close button. */
|
|
28
31
|
closeLabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Edge the panel is anchored to. `"right"` (default) is a side panel up to 430 px wide;
|
|
34
|
+
* `"bottom"` is a bottom sheet across the width, padded by the safe-area inset and capped at
|
|
35
|
+
* 85dvh with its own scroll. Focus is trapped and Escape closes it on both.
|
|
36
|
+
*/
|
|
37
|
+
side?: DrawerSide;
|
|
38
|
+
/**
|
|
39
|
+
* Shows a grab handle at the top of a `side="bottom"` sheet. It is decorative (hidden from
|
|
40
|
+
* assistive tech); dragging it down closes the sheet unless `blocking`. Ignored on other sides.
|
|
41
|
+
*/
|
|
42
|
+
handle?: boolean;
|
|
29
43
|
}
|
|
30
|
-
/**
|
|
31
|
-
export declare function DrawerContent({ className, classNames, material, blocking, closeLabel, children, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, onCloseAutoFocus, ...props }: DrawerContentProps): import("react").JSX.Element;
|
|
44
|
+
/** Side panel (right) or bottom sheet for secondary flows. */
|
|
45
|
+
export declare function DrawerContent({ className, classNames, material, blocking, closeLabel, side, handle, children, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, onCloseAutoFocus, ...props }: DrawerContentProps): import("react").JSX.Element;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef } from "react";
|
|
3
4
|
import { useUiStrings } from "../../i18n/index.js";
|
|
4
5
|
import { X } from "../../icons/index.js";
|
|
5
6
|
import * as DialogPrimitive from "../../primitives/dialog/dialog.js";
|
|
6
7
|
import { cn } from "../../utils/cn.js";
|
|
7
8
|
import { materialClass } from "../../utils/material.js";
|
|
9
|
+
import { DRAWER_MOTION, OVERLAY_MOTION, SHEET_MOTION } from "../../utils/overlay-motion.js";
|
|
8
10
|
import {
|
|
9
11
|
PreviousFocusProvider,
|
|
10
12
|
restoreFocusOnClose,
|
|
@@ -29,12 +31,22 @@ function DrawerDescription({
|
|
|
29
31
|
}) {
|
|
30
32
|
return /* @__PURE__ */ jsx(DialogPrimitive.Description, { className: cn("m-0 text-ink-2", className), ...props });
|
|
31
33
|
}
|
|
34
|
+
const SWIPE_CLOSE_PX = 60;
|
|
35
|
+
const sideClasses = {
|
|
36
|
+
right: "inset-y-0 right-0 h-full w-[min(430px,100%)] max-w-full",
|
|
37
|
+
bottom: "inset-x-0 bottom-0 max-h-[min(85dvh,100%)] w-full rounded-t-card pb-[env(safe-area-inset-bottom)]"
|
|
38
|
+
};
|
|
39
|
+
function drawerSideClass(side) {
|
|
40
|
+
return sideClasses[side];
|
|
41
|
+
}
|
|
32
42
|
function DrawerContent({
|
|
33
43
|
className,
|
|
34
44
|
classNames,
|
|
35
45
|
material,
|
|
36
46
|
blocking = false,
|
|
37
47
|
closeLabel,
|
|
48
|
+
side = "right",
|
|
49
|
+
handle = false,
|
|
38
50
|
children,
|
|
39
51
|
onEscapeKeyDown,
|
|
40
52
|
onPointerDownOutside,
|
|
@@ -44,13 +56,35 @@ function DrawerContent({
|
|
|
44
56
|
}) {
|
|
45
57
|
const previousFocusRef = usePreviousFocus();
|
|
46
58
|
const strings = useUiStrings();
|
|
59
|
+
const closeRef = useRef(null);
|
|
60
|
+
const swipe = useRef(null);
|
|
61
|
+
const bottom = side === "bottom";
|
|
62
|
+
const showHandle = bottom && handle;
|
|
63
|
+
const swipeStart = (event) => {
|
|
64
|
+
swipe.current = event.clientY;
|
|
65
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
66
|
+
};
|
|
67
|
+
const swipeEnd = (event) => {
|
|
68
|
+
const from = swipe.current;
|
|
69
|
+
swipe.current = null;
|
|
70
|
+
if (from !== null && !blocking && event.clientY - from >= SWIPE_CLOSE_PX) {
|
|
71
|
+
closeRef.current?.click();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
47
74
|
return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
|
|
48
|
-
/* @__PURE__ */ jsx(
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
DialogPrimitive.Overlay,
|
|
77
|
+
{
|
|
78
|
+
className: cn("fixed inset-0 z-70 bg-scrim", OVERLAY_MOTION, classNames?.overlay)
|
|
79
|
+
}
|
|
80
|
+
),
|
|
49
81
|
/* @__PURE__ */ jsxs(
|
|
50
82
|
DialogPrimitive.Content,
|
|
51
83
|
{
|
|
52
84
|
className: cn(
|
|
53
|
-
"@container/drawer fixed
|
|
85
|
+
"@container/drawer fixed z-70 flex flex-col overflow-y-auto outline-none surface-overlay shadow-overlay",
|
|
86
|
+
sideClasses[side],
|
|
87
|
+
side === "bottom" ? SHEET_MOTION : DRAWER_MOTION,
|
|
54
88
|
materialClass(material, "surface-solid"),
|
|
55
89
|
classNames?.root,
|
|
56
90
|
className
|
|
@@ -73,13 +107,27 @@ function DrawerContent({
|
|
|
73
107
|
},
|
|
74
108
|
...props,
|
|
75
109
|
children: [
|
|
110
|
+
showHandle ? /* @__PURE__ */ jsx(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
"aria-hidden": "true",
|
|
114
|
+
onPointerDown: swipeStart,
|
|
115
|
+
onPointerUp: swipeEnd,
|
|
116
|
+
onPointerCancel: () => {
|
|
117
|
+
swipe.current = null;
|
|
118
|
+
},
|
|
119
|
+
className: cn("flex shrink-0 touch-none justify-center pt-2 pb-1", classNames?.handle),
|
|
120
|
+
children: /* @__PURE__ */ jsx("span", { className: "h-1 w-9 rounded-pill bg-line-strong" })
|
|
121
|
+
}
|
|
122
|
+
) : null,
|
|
76
123
|
children,
|
|
77
124
|
!blocking && /* @__PURE__ */ jsx(
|
|
78
125
|
DialogPrimitive.Close,
|
|
79
126
|
{
|
|
127
|
+
ref: closeRef,
|
|
80
128
|
"aria-label": closeLabel ?? strings.close,
|
|
81
129
|
className: cn(
|
|
82
|
-
"absolute top-
|
|
130
|
+
"absolute top-[calc(0.5625rem-0.4375rem*var(--touch))] right-[calc(0.5625rem-0.4375rem*var(--touch))] flex size-control-sm items-center justify-center rounded-event text-ink-3 hover:text-ink",
|
|
83
131
|
classNames?.close
|
|
84
132
|
),
|
|
85
133
|
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-4" })
|
|
@@ -96,5 +144,6 @@ export {
|
|
|
96
144
|
DrawerContent,
|
|
97
145
|
DrawerDescription,
|
|
98
146
|
DrawerTitle,
|
|
99
|
-
DrawerTrigger
|
|
147
|
+
DrawerTrigger,
|
|
148
|
+
drawerSideClass
|
|
100
149
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Drawer, DrawerClose, DrawerContent, type DrawerContentPart, type DrawerContentProps, DrawerDescription, DrawerTitle, DrawerTrigger, } from "./drawer.js";
|
|
1
|
+
export { Drawer, DrawerClose, DrawerContent, type DrawerContentPart, type DrawerContentProps, DrawerDescription, type DrawerSide, DrawerTitle, DrawerTrigger, } from "./drawer.js";
|
|
@@ -15,7 +15,7 @@ export declare const DropdownMenuAnchor: typeof MenuPrimitive.Anchor;
|
|
|
15
15
|
/** The default look of a menu panel: radius, surface, padding and shadow. */
|
|
16
16
|
export declare const dropdownMenuSurfaceClasses = "rounded-popover surface-overlay p-1.5 shadow-overlay";
|
|
17
17
|
/** The default look of a menu item, for your own `DropdownMenuItem asChild` or `MenuPrimitive.Item`. */
|
|
18
|
-
export declare const dropdownMenuItemClasses = "flex w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.75 text-body text-ink outline-none data-highlighted:bg-surface-2";
|
|
18
|
+
export declare const dropdownMenuItemClasses = "flex min-h-(--touch-target) w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.75 text-body text-ink outline-none data-highlighted:bg-surface-2";
|
|
19
19
|
export interface DropdownMenuContentProps extends MenuPrimitive.MenuContentProps {
|
|
20
20
|
/** Portal target. Defaults to `document.body`; pass an element to keep a scoped `data-style`. */
|
|
21
21
|
container?: HTMLElement | null;
|
|
@@ -4,6 +4,7 @@ import { Check, ChevronRight } from "../../icons/index.js";
|
|
|
4
4
|
import * as MenuPrimitive from "../../primitives/menu/menu.js";
|
|
5
5
|
import { cn } from "../../utils/cn.js";
|
|
6
6
|
import { materialClass } from "../../utils/material.js";
|
|
7
|
+
import { ITEM_MOTION, POPPER_MOTION } from "../../utils/overlay-motion.js";
|
|
7
8
|
const DropdownMenu = MenuPrimitive.Root;
|
|
8
9
|
const DropdownMenuTrigger = MenuPrimitive.Trigger;
|
|
9
10
|
const DropdownMenuRadioGroup = MenuPrimitive.RadioGroup;
|
|
@@ -13,9 +14,9 @@ const DropdownMenuArrow = MenuPrimitive.Arrow;
|
|
|
13
14
|
const DropdownMenuAnchor = MenuPrimitive.Anchor;
|
|
14
15
|
const placement = "z-85 min-w-[min(14.375rem,var(--ui-popper-available-width))] max-h-(--ui-popper-available-height) max-w-(--ui-popper-available-width) overflow-y-auto";
|
|
15
16
|
const dropdownMenuSurfaceClasses = "rounded-popover surface-overlay p-1.5 shadow-overlay";
|
|
16
|
-
const dropdownMenuItemClasses = "flex w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.75 text-body text-ink outline-none data-highlighted:bg-surface-2";
|
|
17
|
-
const surface = `${placement} ${dropdownMenuSurfaceClasses}`;
|
|
18
|
-
const itemBase = dropdownMenuItemClasses
|
|
17
|
+
const dropdownMenuItemClasses = "flex min-h-(--touch-target) w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.75 text-body text-ink outline-none data-highlighted:bg-surface-2";
|
|
18
|
+
const surface = `${placement} ${POPPER_MOTION} ${dropdownMenuSurfaceClasses}`;
|
|
19
|
+
const itemBase = `${dropdownMenuItemClasses} ${ITEM_MOTION}`;
|
|
19
20
|
function DropdownMenuContent({
|
|
20
21
|
className,
|
|
21
22
|
sideOffset = 6,
|
|
@@ -30,7 +31,7 @@ function DropdownMenuContent({
|
|
|
30
31
|
{
|
|
31
32
|
sideOffset,
|
|
32
33
|
collisionPadding,
|
|
33
|
-
className: bare ? cn(placement, className) : cn(surface, materialClass(material, "surface-solid"), className),
|
|
34
|
+
className: bare ? cn(placement, POPPER_MOTION, className) : cn(surface, materialClass(material, "surface-solid"), className),
|
|
34
35
|
...props
|
|
35
36
|
}
|
|
36
37
|
) });
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import * as PopoverPrimitive from "../../primitives/popover/popover.js";
|
|
14
14
|
import { cn } from "../../utils/cn.js";
|
|
15
15
|
import { materialClass } from "../../utils/material.js";
|
|
16
|
+
import { POPPER_MOTION } from "../../utils/overlay-motion.js";
|
|
16
17
|
import { Slot } from "../../utils/slot.js";
|
|
17
18
|
const HoverCardContext = createContext(null);
|
|
18
19
|
function useHoverCard() {
|
|
@@ -122,6 +123,7 @@ function HoverCardContent({
|
|
|
122
123
|
},
|
|
123
124
|
className: cn(
|
|
124
125
|
"z-85 w-72 max-w-(--ui-popper-available-width) rounded-popover border-card surface-overlay p-card text-body text-ink shadow-overlay",
|
|
126
|
+
POPPER_MOTION,
|
|
125
127
|
materialClass(material, "surface-solid"),
|
|
126
128
|
className
|
|
127
129
|
),
|
|
@@ -3,6 +3,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as PopoverPrimitive from "../../primitives/popover/popover.js";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
5
|
import { materialClass } from "../../utils/material.js";
|
|
6
|
+
import { POPPER_MOTION } from "../../utils/overlay-motion.js";
|
|
6
7
|
const Popover = PopoverPrimitive.Root;
|
|
7
8
|
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
8
9
|
const PopoverClose = PopoverPrimitive.Close;
|
|
@@ -23,6 +24,7 @@ function PopoverContent({
|
|
|
23
24
|
collisionPadding,
|
|
24
25
|
className: cn(
|
|
25
26
|
"z-85 min-w-[min(14.375rem,var(--ui-popper-available-width))] max-h-(--ui-popper-available-height) max-w-(--ui-popper-available-width) overflow-y-auto rounded-popover surface-overlay p-1.5 text-ink shadow-overlay",
|
|
27
|
+
POPPER_MOTION,
|
|
26
28
|
materialClass(material, "surface-solid"),
|
|
27
29
|
className
|
|
28
30
|
),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { ToastTone } from "./toast-store.js";
|
|
2
|
-
export { type ToastAction, Toaster, type ToasterPart, type ToasterPosition, type ToasterProps, type ToastOptions, toast, toastToneClasses, } from "./toaster.js";
|
|
2
|
+
export { type ToastAction, Toaster, type ToasterOffset, type ToasterPart, type ToasterPosition, type ToasterProps, type ToasterResponsivePosition, type ToastOptions, toast, toastToneClasses, } from "./toaster.js";
|
|
@@ -1,13 +1,33 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
1
2
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
2
3
|
import { type ToastTone } from "./toast-store.js";
|
|
3
4
|
export type { ToastAction, ToastOptions } from "./toast.js";
|
|
4
5
|
export { toast } from "./toast.js";
|
|
5
6
|
export type ToasterPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
7
|
+
/**
|
|
8
|
+
* One position, or one per viewport width: `base` always applies, `sm` from 640 px and `lg` from
|
|
9
|
+
* 1024 px of viewport width (a toast is anchored to the viewport, so these are media queries).
|
|
10
|
+
*/
|
|
11
|
+
export type ToasterResponsivePosition = ToasterPosition | {
|
|
12
|
+
base: ToasterPosition;
|
|
13
|
+
sm?: ToasterPosition;
|
|
14
|
+
lg?: ToasterPosition;
|
|
15
|
+
};
|
|
16
|
+
/** Distance from the viewport edges: a number is px, a string is any CSS length (`calc(env(safe-area-inset-bottom) + 4rem)`). */
|
|
17
|
+
export type ToasterOffset = number | string | {
|
|
18
|
+
x?: number | string;
|
|
19
|
+
y?: number | string;
|
|
20
|
+
};
|
|
6
21
|
export type ToasterPart = "root" | "list" | "toast" | "title" | "description" | "action";
|
|
7
22
|
export interface ToasterProps {
|
|
8
23
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
9
24
|
classNames?: ClassNames<ToasterPart>;
|
|
10
|
-
position?:
|
|
25
|
+
position?: ToasterResponsivePosition;
|
|
26
|
+
/**
|
|
27
|
+
* Distance from the edges the region is anchored to. Defaults to 1rem on both axes; `y` is
|
|
28
|
+
* measured from the top or the bottom edge, whichever the position uses.
|
|
29
|
+
*/
|
|
30
|
+
offset?: ToasterOffset;
|
|
11
31
|
/** Default auto dismiss delay in ms; `Infinity` disables it. */
|
|
12
32
|
duration?: number;
|
|
13
33
|
/** Toasts shown at once; older ones wait until a newer one leaves. */
|
|
@@ -25,8 +45,14 @@ export interface ToasterProps {
|
|
|
25
45
|
}
|
|
26
46
|
/** Class map behind each tone. `default` is the inverted neutral toast; the others tint the surface. */
|
|
27
47
|
export declare const toastToneClasses: Readonly<Record<ToastTone, string>>;
|
|
48
|
+
/** Region classes, list direction and offset variables for a position and an offset. */
|
|
49
|
+
export declare function toasterPlacement(position: ToasterResponsivePosition, offset?: ToasterOffset): {
|
|
50
|
+
region: string;
|
|
51
|
+
list: string;
|
|
52
|
+
style: CSSProperties;
|
|
53
|
+
};
|
|
28
54
|
/**
|
|
29
55
|
* Ephemeral, non-critical confirmations. Pass `action: { label, onClick }` to
|
|
30
56
|
* `toast()` for an undo button. Critical messages belong in a banner instead.
|
|
31
57
|
*/
|
|
32
|
-
export declare function Toaster({ position, duration, visibleToasts, className, classNames, label, container, dir, }: ToasterProps): import("react").JSX.Element;
|
|
58
|
+
export declare function Toaster({ position, offset, duration, visibleToasts, className, classNames, label, container, dir, }: ToasterProps): import("react").JSX.Element;
|