@jcsoftdev/ui 0.2.3 → 0.3.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 +288 -7
- package/README.md +2 -1
- package/bin/ui-theme.mjs +1151 -25
- package/dist/ai/attachment/attachment.js +1 -1
- package/dist/ai/chat-list/group.js +3 -1
- package/dist/ai/conversation/conversation.js +1 -1
- package/dist/ai/internal/use-copy.d.ts +1 -5
- package/dist/ai/internal/use-copy.js +1 -32
- package/dist/ai/markdown/parse.js +59 -17
- package/dist/ai/source/source.js +1 -1
- package/dist/atoms/avatar/avatar.d.ts +13 -3
- package/dist/atoms/avatar/avatar.js +40 -2
- package/dist/atoms/avatar/index.d.ts +1 -1
- package/dist/atoms/avatar/index.js +3 -1
- package/dist/atoms/button/button.d.ts +4 -1
- package/dist/atoms/button/button.js +4 -2
- package/dist/atoms/checkbox/checkbox.d.ts +8 -3
- package/dist/atoms/checkbox/checkbox.js +23 -2
- package/dist/atoms/chip/chip.d.ts +9 -3
- package/dist/atoms/chip/chip.js +26 -4
- package/dist/atoms/chip/index.d.ts +1 -1
- package/dist/atoms/chip/index.js +4 -1
- package/dist/atoms/status-dot/index.d.ts +1 -1
- package/dist/atoms/status-dot/status-dot.d.ts +4 -2
- package/dist/atoms/status-dot/status-dot.js +5 -1
- package/dist/charts/bar-chart/bar-race-chart.js +1 -0
- package/dist/charts/beeswarm-chart/beeswarm-chart.js +1 -1
- package/dist/charts/chord-chart/chord-chart.js +13 -5
- package/dist/charts/core/cartesian/cartesian-chart.d.ts +1 -1
- package/dist/charts/core/cartesian/cartesian-chart.js +48 -11
- package/dist/charts/core/cartesian/layout.d.ts +6 -1
- package/dist/charts/core/cartesian/layout.js +14 -5
- package/dist/charts/core/cartesian/marks.d.ts +2 -2
- package/dist/charts/core/cartesian/marks.js +1 -1
- package/dist/charts/core/cartesian/types.d.ts +28 -2
- package/dist/charts/core/category-explorer.d.ts +2 -2
- package/dist/charts/core/category-explorer.js +8 -4
- package/dist/charts/core/chart-dock.d.ts +26 -0
- package/dist/charts/core/chart-dock.js +45 -0
- package/dist/charts/core/chart-frame.d.ts +9 -2
- package/dist/charts/core/chart-frame.js +105 -25
- package/dist/charts/core/distribution/explorer.d.ts +5 -2
- package/dist/charts/core/distribution/explorer.js +12 -5
- package/dist/charts/core/distribution/xy-points.js +1 -1
- package/dist/charts/core/index.d.ts +3 -0
- package/dist/charts/core/index.js +3 -0
- package/dist/charts/core/leave-grace.d.ts +11 -0
- package/dist/charts/core/leave-grace.js +26 -0
- package/dist/charts/core/nearest.d.ts +14 -0
- package/dist/charts/core/nearest.js +22 -0
- package/dist/charts/core/plot-overlay.js +9 -3
- package/dist/charts/core/pointer.test-utils.d.ts +38 -0
- package/dist/charts/core/pointer.test-utils.js +123 -0
- package/dist/charts/core/tooltip.d.ts +25 -2
- package/dist/charts/core/tooltip.js +115 -40
- package/dist/charts/core/touch-select.d.ts +20 -0
- package/dist/charts/core/touch-select.js +184 -0
- package/dist/charts/core/types.d.ts +8 -4
- package/dist/charts/core/types.js +5 -0
- package/dist/charts/core/use-index-navigation.d.ts +17 -6
- package/dist/charts/core/use-index-navigation.js +47 -10
- package/dist/charts/donut-chart/donut-chart.d.ts +5 -1
- package/dist/charts/donut-chart/donut-chart.js +40 -1
- package/dist/charts/donut-chart/slice-labels.d.ts +20 -0
- package/dist/charts/donut-chart/slice-labels.js +20 -0
- package/dist/charts/dumbbell-chart/dumbbell-chart.js +6 -3
- package/dist/charts/fill-gauge-chart/fill-gauge-chart.js +1 -0
- package/dist/charts/funnel-chart/funnel-chart.js +2 -1
- package/dist/charts/gauge-chart/gauge-chart.js +2 -1
- package/dist/charts/heatmap-chart/heatmap-chart.d.ts +4 -1
- package/dist/charts/heatmap-chart/heatmap-chart.js +3 -1
- package/dist/charts/heatmap-chart/heatmap-grid.d.ts +4 -1
- package/dist/charts/heatmap-chart/heatmap-grid.js +3 -1
- package/dist/charts/hex-tile-map/hex-tile-map.js +124 -115
- package/dist/charts/hierarchy-morph/hierarchy-morph.js +2 -1
- package/dist/charts/icicle-chart/icicle-chart.js +7 -9
- package/dist/charts/lollipop-chart/lollipop-chart.js +6 -3
- package/dist/charts/maps/geo/map-viewport.js +1 -1
- package/dist/charts/polar-area-chart/polar-area-chart.js +42 -12
- package/dist/charts/progress-units/progress-units.js +1 -0
- package/dist/charts/radar-chart/radar-chart.js +1 -1
- package/dist/charts/radial-bar-chart/radial-bar-chart.js +2 -1
- package/dist/charts/range-area-chart/range-area-chart.js +3 -2
- package/dist/charts/sankey-chart/sankey-chart.js +12 -4
- package/dist/charts/tree-chart/tree-chart.js +1 -0
- package/dist/charts/treemap-chart/treemap-chart.js +2 -7
- package/dist/charts/waterfall-chart/waterfall-chart.js +6 -3
- package/dist/containers/action-bar/action-bar.d.ts +11 -2
- package/dist/containers/action-bar/action-bar.js +4 -1
- package/dist/containers/card/card.d.ts +21 -3
- package/dist/containers/card/card.js +20 -5
- package/dist/containers/grid/grid.d.ts +15 -0
- package/dist/containers/grid/grid.js +24 -0
- package/dist/containers/grid/index.d.ts +1 -0
- package/dist/containers/grid/index.js +4 -0
- package/dist/containers/index.d.ts +3 -0
- package/dist/containers/index.js +3 -0
- package/dist/containers/kpi/kpi.d.ts +13 -2
- package/dist/containers/kpi/kpi.js +86 -24
- package/dist/containers/kpi-group/index.d.ts +1 -1
- package/dist/containers/kpi-group/index.js +3 -1
- package/dist/containers/kpi-group/kpi-group.d.ts +9 -1
- package/dist/containers/kpi-group/kpi-group.js +11 -1
- package/dist/containers/page/index.d.ts +1 -0
- package/dist/containers/page/index.js +4 -0
- package/dist/containers/page/page.d.ts +7 -0
- package/dist/containers/page/page.js +14 -0
- package/dist/containers/page-header/page-header.d.ts +8 -3
- package/dist/containers/page-header/page-header.js +35 -8
- package/dist/containers/responsive-list/responsive-list.d.ts +1 -1
- package/dist/containers/responsive-list/responsive-list.js +6 -3
- package/dist/containers/stack/index.d.ts +1 -0
- package/dist/containers/stack/index.js +6 -0
- package/dist/containers/stack/stack.d.ts +15 -0
- package/dist/containers/stack/stack.js +43 -0
- package/dist/forms/copy-field/copy-field.d.ts +17 -0
- package/dist/forms/copy-field/copy-field.js +72 -0
- package/dist/forms/copy-field/index.d.ts +1 -0
- package/dist/forms/copy-field/index.js +4 -0
- package/dist/forms/emoji-picker/emoji-picker.js +1 -1
- package/dist/forms/form/form.d.ts +15 -0
- package/dist/forms/form/form.js +29 -0
- package/dist/forms/form/index.d.ts +1 -0
- package/dist/forms/form/index.js +10 -0
- package/dist/forms/index.d.ts +2 -0
- package/dist/forms/index.js +2 -0
- package/dist/forms/input/index.d.ts +1 -1
- package/dist/forms/input/index.js +3 -2
- package/dist/forms/input/input.d.ts +6 -2
- package/dist/forms/input/input.js +9 -3
- package/dist/glass/crystal-map.d.ts +70 -0
- package/dist/glass/crystal-map.js +88 -0
- package/dist/glass/displacement-map.d.ts +117 -0
- package/dist/glass/displacement-map.js +201 -0
- package/dist/glass/index.d.ts +8 -0
- package/dist/glass/index.js +63 -0
- package/dist/glass/lens-crystal.d.ts +29 -0
- package/dist/glass/lens-crystal.js +161 -0
- package/dist/glass/lens-dispersion.d.ts +11 -0
- package/dist/glass/lens-dispersion.js +19 -0
- package/dist/glass/liquid-glass.d.ts +41 -0
- package/dist/glass/liquid-glass.js +256 -0
- package/dist/glass/liquid-motion.d.ts +53 -0
- package/dist/glass/liquid-motion.js +302 -0
- package/dist/glass/liquid-options.d.ts +162 -0
- package/dist/glass/liquid-options.js +179 -0
- package/dist/glass/refraction.d.ts +100 -0
- package/dist/glass/refraction.js +714 -0
- package/dist/glass/specular-map.d.ts +26 -0
- package/dist/glass/specular-map.js +75 -0
- package/dist/glass/spring.d.ts +79 -0
- package/dist/glass/spring.js +58 -0
- package/dist/glass/support.d.ts +13 -0
- package/dist/glass/support.js +14 -0
- package/dist/glass/use-glass-refraction.d.ts +8 -0
- package/dist/glass/use-glass-refraction.js +16 -0
- package/dist/i18n/strings.d.ts +24 -0
- package/dist/i18n/strings.js +18 -2
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +4 -0
- package/dist/icons/key.d.ts +2 -0
- package/dist/icons/key.js +12 -0
- package/dist/icons/webhook.d.ts +2 -0
- package/dist/icons/webhook.js +12 -0
- package/dist/liquid/index.d.ts +3 -0
- package/dist/liquid/index.js +29 -0
- package/dist/navigation/breadcrumbs/breadcrumbs.d.ts +29 -0
- package/dist/navigation/breadcrumbs/breadcrumbs.js +70 -0
- package/dist/navigation/breadcrumbs/index.d.ts +1 -0
- package/dist/navigation/breadcrumbs/index.js +6 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +1 -0
- package/dist/navigation/segmented/index.d.ts +1 -1
- package/dist/navigation/segmented/model.d.ts +5 -0
- package/dist/navigation/segmented/model.js +6 -0
- package/dist/navigation/segmented/segmented.d.ts +17 -3
- package/dist/navigation/segmented/segmented.js +20 -4
- package/dist/overlays/context-menu/context-menu.d.ts +9 -1
- package/dist/overlays/context-menu/context-menu.js +4 -1
- package/dist/overlays/dialog/dialog.d.ts +9 -1
- package/dist/overlays/dialog/dialog.js +3 -0
- package/dist/overlays/drawer/drawer.d.ts +9 -1
- package/dist/overlays/drawer/drawer.js +3 -0
- package/dist/overlays/dropdown-menu/dropdown-menu.d.ts +9 -1
- package/dist/overlays/dropdown-menu/dropdown-menu.js +3 -1
- package/dist/overlays/hover-card/hover-card.d.ts +10 -1
- package/dist/overlays/hover-card/hover-card.js +4 -1
- package/dist/overlays/popover/popover.d.ts +9 -1
- package/dist/overlays/popover/popover.js +3 -0
- package/dist/palette/command-palette/command-palette.d.ts +12 -2
- package/dist/palette/command-palette/command-palette.js +5 -0
- package/dist/primitives/command/command.d.ts +3 -2
- package/dist/primitives/command/command.js +2 -0
- package/dist/primitives/menu/menu.js +1 -1
- package/dist/primitives/popper/popper.js +5 -0
- package/dist/rich-text/rich-text-editor.js +94 -8
- package/dist/rich-text/sanitize.js +70 -20
- package/dist/shell/app-shell/app-shell.d.ts +17 -0
- package/dist/shell/app-shell/app-shell.js +44 -4
- package/dist/shell/bottom-nav/bottom-nav.d.ts +34 -0
- package/dist/shell/bottom-nav/bottom-nav.js +124 -0
- package/dist/shell/bottom-nav/index.d.ts +2 -0
- package/dist/shell/bottom-nav/index.js +9 -0
- package/dist/shell/bottom-nav/split.d.ts +11 -0
- package/dist/shell/bottom-nav/split.js +10 -0
- package/dist/shell/sidebar/sidebar.d.ts +16 -2
- package/dist/shell/sidebar/sidebar.js +46 -4
- package/dist/shell/topbar/topbar.d.ts +20 -9
- package/dist/shell/topbar/topbar.js +16 -9
- package/dist/states/empty-state/empty-state.d.ts +3 -1
- package/dist/states/empty-state/empty-state.js +9 -1
- package/dist/states/error-state/error-state.d.ts +3 -1
- package/dist/states/error-state/error-state.js +2 -0
- package/dist/states/index.d.ts +1 -0
- package/dist/states/index.js +1 -0
- package/dist/states/live-status-bar/index.d.ts +1 -0
- package/dist/states/live-status-bar/index.js +6 -0
- package/dist/states/live-status-bar/live-status-bar.d.ts +17 -0
- package/dist/states/live-status-bar/live-status-bar.js +49 -0
- package/dist/states/offline-banner/offline-banner.d.ts +3 -1
- package/dist/states/offline-banner/offline-banner.js +8 -4
- package/dist/utils/class-groups.js +17 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/material.d.ts +13 -0
- package/dist/utils/material.js +6 -0
- package/dist/utils/tone.d.ts +8 -0
- package/dist/utils/tone.js +17 -0
- package/dist/utils/use-copy.d.ts +5 -0
- package/dist/utils/use-copy.js +35 -0
- package/icons/svg/key.svg +5 -0
- package/icons/svg/webhook.svg +5 -0
- package/package.json +31 -21
- package/scripts/build-theme.d.mts +22 -0
- package/scripts/build-theme.mjs +236 -4
- package/src/ai/attachment/attachment.tsx +1 -1
- package/src/ai/chat-list/group.ts +3 -1
- package/src/ai/conversation/conversation.tsx +1 -1
- package/src/ai/internal/use-copy.ts +1 -38
- package/src/ai/markdown/parse.ts +74 -17
- package/src/ai/source/source.tsx +1 -1
- package/src/atoms/avatar/avatar.tsx +57 -4
- package/src/atoms/avatar/index.ts +8 -1
- package/src/atoms/button/button.tsx +8 -3
- package/src/atoms/checkbox/checkbox.tsx +30 -3
- package/src/atoms/chip/chip.tsx +37 -5
- package/src/atoms/chip/index.ts +7 -1
- package/src/atoms/status-dot/index.ts +1 -0
- package/src/atoms/status-dot/status-dot.tsx +15 -3
- package/src/charts/README.md +21 -0
- package/src/charts/bar-chart/bar-race-chart.tsx +1 -0
- package/src/charts/beeswarm-chart/beeswarm-chart.tsx +1 -1
- package/src/charts/chord-chart/chord-chart.tsx +13 -5
- package/src/charts/core/cartesian/cartesian-chart.tsx +55 -10
- package/src/charts/core/cartesian/layout.ts +29 -10
- package/src/charts/core/cartesian/marks.tsx +3 -3
- package/src/charts/core/cartesian/types.ts +30 -2
- package/src/charts/core/category-explorer.tsx +12 -6
- package/src/charts/core/chart-dock.tsx +68 -0
- package/src/charts/core/chart-frame.tsx +116 -27
- package/src/charts/core/distribution/explorer.tsx +17 -7
- package/src/charts/core/distribution/xy-points.tsx +1 -1
- package/src/charts/core/index.ts +3 -0
- package/src/charts/core/leave-grace.ts +35 -0
- package/src/charts/core/nearest.ts +38 -0
- package/src/charts/core/plot-overlay.tsx +9 -3
- package/src/charts/core/pointer.test-utils.ts +146 -0
- package/src/charts/core/tooltip.tsx +129 -15
- package/src/charts/core/touch-select.ts +250 -0
- package/src/charts/core/types.ts +13 -4
- package/src/charts/core/use-index-navigation.ts +70 -11
- package/src/charts/donut-chart/donut-chart.tsx +53 -3
- package/src/charts/donut-chart/slice-labels.ts +39 -0
- package/src/charts/dumbbell-chart/dumbbell-chart.tsx +8 -3
- package/src/charts/fill-gauge-chart/fill-gauge-chart.tsx +1 -0
- package/src/charts/funnel-chart/funnel-chart.tsx +2 -1
- package/src/charts/gauge-chart/gauge-chart.tsx +2 -1
- package/src/charts/heatmap-chart/heatmap-chart.tsx +5 -0
- package/src/charts/heatmap-chart/heatmap-grid.tsx +5 -1
- package/src/charts/hex-tile-map/hex-tile-map.tsx +6 -1
- package/src/charts/hierarchy-morph/hierarchy-morph.tsx +2 -1
- package/src/charts/icicle-chart/icicle-chart.tsx +8 -9
- package/src/charts/lollipop-chart/lollipop-chart.tsx +8 -3
- package/src/charts/maps/geo/map-viewport.tsx +1 -1
- package/src/charts/polar-area-chart/polar-area-chart.tsx +37 -12
- package/src/charts/progress-units/progress-units.tsx +1 -0
- package/src/charts/radar-chart/radar-chart.tsx +1 -1
- package/src/charts/radial-bar-chart/radial-bar-chart.tsx +2 -1
- package/src/charts/range-area-chart/range-area-chart.tsx +3 -2
- package/src/charts/sankey-chart/sankey-chart.tsx +12 -4
- package/src/charts/tree-chart/tree-chart.tsx +1 -0
- package/src/charts/treemap-chart/treemap-chart.tsx +2 -7
- package/src/charts/waterfall-chart/waterfall-chart.tsx +8 -3
- package/src/containers/action-bar/action-bar.tsx +13 -2
- package/src/containers/card/card.tsx +43 -4
- package/src/containers/grid/grid.tsx +37 -0
- package/src/containers/grid/index.ts +1 -0
- package/src/containers/index.ts +3 -0
- package/src/containers/kpi/kpi.tsx +116 -22
- package/src/containers/kpi-group/index.ts +7 -1
- package/src/containers/kpi-group/kpi-group.tsx +26 -1
- package/src/containers/page/index.ts +1 -0
- package/src/containers/page/page.tsx +17 -0
- package/src/containers/page-header/page-header.tsx +38 -8
- package/src/containers/responsive-list/responsive-list.tsx +7 -4
- package/src/containers/stack/index.ts +7 -0
- package/src/containers/stack/stack.tsx +55 -0
- package/src/forms/copy-field/copy-field.tsx +88 -0
- package/src/forms/copy-field/index.ts +1 -0
- package/src/forms/emoji-picker/emoji-picker.tsx +1 -1
- package/src/forms/form/form.tsx +46 -0
- package/src/forms/form/index.ts +8 -0
- package/src/forms/index.ts +2 -0
- package/src/forms/input/index.ts +1 -1
- package/src/forms/input/input.tsx +14 -3
- package/src/glass/crystal-map.ts +150 -0
- package/src/glass/displacement-map.ts +317 -0
- package/src/glass/index.ts +43 -0
- package/src/glass/lens-crystal.ts +226 -0
- package/src/glass/lens-dispersion.ts +34 -0
- package/src/glass/liquid-glass.tsx +371 -0
- package/src/glass/liquid-motion.ts +395 -0
- package/src/glass/liquid-options.ts +306 -0
- package/src/glass/refraction.ts +1010 -0
- package/src/glass/specular-map.ts +95 -0
- package/src/glass/spring.ts +98 -0
- package/src/glass/support.ts +27 -0
- package/src/glass/use-glass-refraction.ts +21 -0
- package/src/i18n/strings.ts +24 -0
- package/src/icons/index.ts +2 -0
- package/src/icons/key.tsx +13 -0
- package/src/icons/webhook.tsx +13 -0
- package/src/liquid/index.ts +24 -0
- package/src/navigation/breadcrumbs/breadcrumbs.tsx +103 -0
- package/src/navigation/breadcrumbs/index.ts +8 -0
- package/src/navigation/index.ts +1 -0
- package/src/navigation/segmented/index.ts +1 -0
- package/src/navigation/segmented/model.ts +11 -0
- package/src/navigation/segmented/segmented.tsx +45 -6
- package/src/overlays/context-menu/context-menu.tsx +11 -1
- package/src/overlays/dialog/dialog.tsx +10 -0
- package/src/overlays/drawer/drawer.tsx +10 -0
- package/src/overlays/dropdown-menu/dropdown-menu.tsx +10 -1
- package/src/overlays/hover-card/hover-card.tsx +12 -1
- package/src/overlays/popover/popover.tsx +10 -0
- package/src/palette/command-palette/command-palette.tsx +15 -1
- package/src/primitives/command/command.tsx +4 -0
- package/src/primitives/menu/menu.tsx +1 -1
- package/src/primitives/popper/popper.tsx +10 -0
- package/src/rich-text/rich-text-editor.tsx +116 -13
- package/src/rich-text/sanitize.ts +94 -23
- package/src/shell/app-shell/app-shell.tsx +60 -4
- package/src/shell/bottom-nav/bottom-nav.tsx +187 -0
- package/src/shell/bottom-nav/index.ts +8 -0
- package/src/shell/bottom-nav/split.ts +20 -0
- package/src/shell/sidebar/sidebar.tsx +51 -5
- package/src/shell/topbar/topbar.tsx +81 -58
- package/src/states/empty-state/empty-state.tsx +11 -1
- package/src/states/error-state/error-state.tsx +4 -0
- package/src/states/index.ts +1 -0
- package/src/states/live-status-bar/index.ts +6 -0
- package/src/states/live-status-bar/live-status-bar.tsx +62 -0
- package/src/states/offline-banner/offline-banner.tsx +13 -5
- package/src/utils/class-groups.ts +17 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/material.ts +16 -0
- package/src/utils/tone.ts +29 -0
- package/src/utils/use-copy.ts +38 -0
- package/styles/Theme.kt +64 -3
- package/styles/base.css +51 -0
- package/styles/tailwind.css +833 -0
- package/styles/theme.css +546 -4
- package/styles/tokens.css +788 -15
- package/tokens/default.json +918 -29
- package/scripts/build-theme.d.ts +0 -18
|
@@ -1,49 +1,111 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { customToneStyle, isCustomTone } from "../../utils/tone.js";
|
|
4
|
+
const valueToneClasses = {
|
|
5
|
+
neutral: "text-ink",
|
|
6
|
+
accent: "text-accent-ink",
|
|
7
|
+
success: "text-success",
|
|
8
|
+
warning: "text-warning",
|
|
9
|
+
danger: "text-danger",
|
|
10
|
+
info: "text-info"
|
|
11
|
+
};
|
|
12
|
+
const dotToneClasses = {
|
|
13
|
+
neutral: "bg-ink-3",
|
|
14
|
+
accent: "bg-accent",
|
|
15
|
+
success: "bg-success",
|
|
16
|
+
warning: "bg-warning",
|
|
17
|
+
danger: "bg-danger",
|
|
18
|
+
info: "bg-info"
|
|
19
|
+
};
|
|
20
|
+
const builtinTones = new Set(Object.keys(valueToneClasses));
|
|
3
21
|
function Kpi({
|
|
4
22
|
label,
|
|
5
23
|
value,
|
|
6
24
|
suffix,
|
|
7
25
|
description,
|
|
8
26
|
variant = "default",
|
|
27
|
+
tone: toneProp,
|
|
28
|
+
dot,
|
|
29
|
+
icon,
|
|
30
|
+
trend,
|
|
9
31
|
className,
|
|
10
32
|
classNames,
|
|
33
|
+
style,
|
|
11
34
|
...props
|
|
12
35
|
}) {
|
|
36
|
+
const tone = toneProp ?? (variant === "danger" ? "danger" : "neutral");
|
|
37
|
+
const custom = isCustomTone(tone, builtinTones);
|
|
38
|
+
const valueTone = custom ? "text-(--tone-c-ink)" : valueToneClasses[tone] ?? valueToneClasses.neutral;
|
|
39
|
+
const dotTone = custom ? "bg-(--tone-c)" : dotToneClasses[tone] ?? dotToneClasses.neutral;
|
|
40
|
+
const labelNode = /* @__PURE__ */ jsxs(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
className: cn(
|
|
44
|
+
"break-words font-semibold text-fs-120 text-ink-2",
|
|
45
|
+
dot && "inline-flex items-center gap-1.5",
|
|
46
|
+
classNames?.label
|
|
47
|
+
),
|
|
48
|
+
children: [
|
|
49
|
+
dot ? /* @__PURE__ */ jsx(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
className: cn("size-1.5 shrink-0 rounded-pill", dotTone, classNames?.dot)
|
|
54
|
+
}
|
|
55
|
+
) : null,
|
|
56
|
+
label
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
const valueNode = /* @__PURE__ */ jsxs(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: cn(
|
|
64
|
+
"break-words text-kpi-number tabular-nums @max-[9rem]/kpi:text-fs-220",
|
|
65
|
+
valueTone,
|
|
66
|
+
classNames?.value
|
|
67
|
+
),
|
|
68
|
+
children: [
|
|
69
|
+
value,
|
|
70
|
+
suffix ? /* @__PURE__ */ jsx(
|
|
71
|
+
"small",
|
|
72
|
+
{
|
|
73
|
+
className: cn(
|
|
74
|
+
"ml-1 font-semibold text-fs-140 text-ink-3 tracking-normal",
|
|
75
|
+
classNames?.suffix
|
|
76
|
+
),
|
|
77
|
+
children: suffix
|
|
78
|
+
}
|
|
79
|
+
) : null
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
);
|
|
13
83
|
return /* @__PURE__ */ jsxs(
|
|
14
84
|
"div",
|
|
15
85
|
{
|
|
16
86
|
...props,
|
|
87
|
+
style: customToneStyle(tone, builtinTones, style),
|
|
17
88
|
className: cn(
|
|
18
89
|
"@container/kpi flex min-w-0 flex-col gap-0.5 bg-surface px-4.5 py-3.5",
|
|
19
90
|
classNames?.root,
|
|
20
91
|
className
|
|
21
92
|
),
|
|
22
93
|
children: [
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"ml-1 font-semibold text-fs-140 text-ink-3 tracking-normal",
|
|
39
|
-
classNames?.suffix
|
|
40
|
-
),
|
|
41
|
-
children: suffix
|
|
42
|
-
}
|
|
43
|
-
) : null
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
),
|
|
94
|
+
icon ? /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-2", classNames?.header), children: [
|
|
95
|
+
labelNode,
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
"aria-hidden": "true",
|
|
100
|
+
className: cn("shrink-0 text-ink-3 [&_svg]:size-4", classNames?.icon),
|
|
101
|
+
children: icon
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] }) : labelNode,
|
|
105
|
+
trend ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
106
|
+
valueNode,
|
|
107
|
+
/* @__PURE__ */ jsx("span", { className: cn("shrink-0", classNames?.trend), children: trend })
|
|
108
|
+
] }) : valueNode,
|
|
47
109
|
description ? /* @__PURE__ */ jsx("span", { className: cn("break-words text-fs-120 text-ink-3", classNames?.description), children: description }) : null
|
|
48
110
|
]
|
|
49
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { KpiGroup, type KpiGroupItem, type KpiGroupPart, type KpiGroupProps } from "./kpi-group.js";
|
|
1
|
+
export { KpiGroup, type KpiGroupItem, type KpiGroupLayout, type KpiGroupPart, type KpiGroupProps, } from "./kpi-group.js";
|
|
@@ -14,9 +14,17 @@ export interface KpiGroupItem {
|
|
|
14
14
|
invertTrend?: boolean;
|
|
15
15
|
description?: ReactNode;
|
|
16
16
|
}
|
|
17
|
+
export type KpiGroupLayout = "divided" | "auto-fit";
|
|
17
18
|
export type KpiGroupPart = "root" | "list" | "item" | "label" | "value" | "trend" | "description";
|
|
18
19
|
export interface KpiGroupProps extends Omit<ComponentPropsWithoutRef<"dl">, "children"> {
|
|
19
20
|
items: KpiGroupItem[];
|
|
21
|
+
/**
|
|
22
|
+
* `divided` (default): one card, 1, 2 or 4 columns by container width. `auto-fit`: separate
|
|
23
|
+
* cards in as many columns as fit `minItemWidth`.
|
|
24
|
+
*/
|
|
25
|
+
layout?: KpiGroupLayout;
|
|
26
|
+
/** Minimum tile width in px for `layout="auto-fit"`. */
|
|
27
|
+
minItemWidth?: number;
|
|
20
28
|
/** Animate numeric values counting up. */
|
|
21
29
|
animate?: boolean;
|
|
22
30
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root wrapper and is merged last. */
|
|
@@ -26,4 +34,4 @@ export interface KpiGroupProps extends Omit<ComponentPropsWithoutRef<"dl">, "chi
|
|
|
26
34
|
* Metrics that belong together in one card, divided by hairlines. Columns follow the
|
|
27
35
|
* container width: 1, 2 or 4 across.
|
|
28
36
|
*/
|
|
29
|
-
export declare function KpiGroup({ items, animate, className, classNames, ...props }: KpiGroupProps): import("react").JSX.Element;
|
|
37
|
+
export declare function KpiGroup({ items, layout, minItemWidth, animate, className, classNames, style, ...props }: KpiGroupProps): import("react").JSX.Element;
|
|
@@ -4,17 +4,26 @@ import { TrendChip } from "../../atoms/trend-chip/trend-chip.js";
|
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
5
|
function KpiGroup({
|
|
6
6
|
items,
|
|
7
|
+
layout = "divided",
|
|
8
|
+
minItemWidth = 150,
|
|
7
9
|
animate = true,
|
|
8
10
|
className,
|
|
9
11
|
classNames,
|
|
12
|
+
style,
|
|
10
13
|
...props
|
|
11
14
|
}) {
|
|
15
|
+
const autoFit = layout === "auto-fit";
|
|
12
16
|
return /* @__PURE__ */ jsx("div", { className: cn("@container/kpi-group min-w-0", classNames?.root, className), children: /* @__PURE__ */ jsx(
|
|
13
17
|
"dl",
|
|
14
18
|
{
|
|
15
19
|
...props,
|
|
20
|
+
style: autoFit ? {
|
|
21
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(min(100%, ${minItemWidth}px), 1fr))`,
|
|
22
|
+
...style
|
|
23
|
+
} : style,
|
|
16
24
|
className: cn(
|
|
17
|
-
"m-0 grid
|
|
25
|
+
"m-0 grid",
|
|
26
|
+
autoFit ? "gap-density" : "grid-cols-1 gap-px overflow-hidden rounded-card border-card bg-divider shadow-card @sm/kpi-group:grid-cols-2 @3xl/kpi-group:grid-cols-4",
|
|
18
27
|
classNames?.list
|
|
19
28
|
),
|
|
20
29
|
children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
@@ -22,6 +31,7 @@ function KpiGroup({
|
|
|
22
31
|
{
|
|
23
32
|
className: cn(
|
|
24
33
|
"surface-card flex min-w-0 flex-col gap-density-sm p-card",
|
|
34
|
+
autoFit && "rounded-card border-card shadow-card",
|
|
25
35
|
classNames?.item
|
|
26
36
|
),
|
|
27
37
|
children: [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Page, type PageProps } from "./page.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
export type PageProps = ComponentPropsWithoutRef<"div">;
|
|
3
|
+
/**
|
|
4
|
+
* Vertical flow of page sections. It is the `page` container, so `Cols` and `SettingsLayout`
|
|
5
|
+
* inside it react to the page width instead of the viewport.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Page({ className, ...props }: PageProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
function Page({ className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: cn("@container/page flex w-full min-w-0 flex-col gap-6", className),
|
|
8
|
+
...props
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
Page
|
|
14
|
+
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
export
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
export interface PageHeaderProps extends ComponentPropsWithoutRef<"header"> {
|
|
3
|
+
/** Trail shown on its own row above the title, usually a `Breadcrumbs`. */
|
|
4
|
+
breadcrumbs?: ReactNode;
|
|
5
|
+
/** Tighter, centred header with a smaller title and a body-size lede. */
|
|
6
|
+
compact?: boolean;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* Page header. No required parts: compose an eyebrow / title / lede block in
|
|
5
10
|
* a plain `<div>` and, when the view has buttons, `PageHeaderActions` as the
|
|
6
11
|
* second child. Actions wrap under the title when the container is too narrow.
|
|
7
12
|
*/
|
|
8
|
-
export declare function PageHeader({ className, ...props }: PageHeaderProps): import("react").JSX.Element;
|
|
13
|
+
export declare function PageHeader({ breadcrumbs, className, compact, children, ...props }: PageHeaderProps): import("react").JSX.Element;
|
|
9
14
|
export type PageHeaderEyebrowProps = ComponentPropsWithoutRef<"div">;
|
|
10
15
|
export declare function PageHeaderEyebrow({ className, ...props }: PageHeaderEyebrowProps): import("react").JSX.Element;
|
|
11
16
|
export type PageHeaderTitleProps = ComponentPropsWithoutRef<"h1">;
|
|
@@ -1,22 +1,46 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
|
-
function PageHeader({
|
|
4
|
-
|
|
3
|
+
function PageHeader({
|
|
4
|
+
breadcrumbs,
|
|
5
|
+
className,
|
|
6
|
+
compact,
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsxs(
|
|
5
11
|
"header",
|
|
6
12
|
{
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
"data-compact": compact ? "" : void 0,
|
|
14
|
+
className: cn(
|
|
15
|
+
"flex flex-wrap items-end justify-between gap-x-6 gap-y-3.5",
|
|
16
|
+
compact && "flex-col items-center justify-center gap-y-2 text-center",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props,
|
|
20
|
+
children: [
|
|
21
|
+
breadcrumbs ? /* @__PURE__ */ jsx("div", { className: "basis-full", children: breadcrumbs }) : null,
|
|
22
|
+
children
|
|
23
|
+
]
|
|
9
24
|
}
|
|
10
25
|
);
|
|
11
26
|
}
|
|
12
27
|
function PageHeaderEyebrow({ className, ...props }) {
|
|
13
|
-
return /* @__PURE__ */ jsx(
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: cn("mb-1 font-semibold text-fs-120 text-ink-3 in-data-compact:mb-0.5", className),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
);
|
|
14
35
|
}
|
|
15
36
|
function PageHeaderTitle({ className, ...props }) {
|
|
16
37
|
return /* @__PURE__ */ jsx(
|
|
17
38
|
"h1",
|
|
18
39
|
{
|
|
19
|
-
className: cn(
|
|
40
|
+
className: cn(
|
|
41
|
+
"m-0 break-words text-page-title [text-wrap:balance] in-data-compact:text-fs-220",
|
|
42
|
+
className
|
|
43
|
+
),
|
|
20
44
|
...props
|
|
21
45
|
}
|
|
22
46
|
);
|
|
@@ -25,7 +49,10 @@ function PageHeaderLede({ className, ...props }) {
|
|
|
25
49
|
return /* @__PURE__ */ jsx(
|
|
26
50
|
"p",
|
|
27
51
|
{
|
|
28
|
-
className: cn(
|
|
52
|
+
className: cn(
|
|
53
|
+
"mt-1.25 max-w-[68ch] break-words text-lede text-ink-2 in-data-compact:mt-0.5 in-data-compact:text-body",
|
|
54
|
+
className
|
|
55
|
+
),
|
|
29
56
|
...props
|
|
30
57
|
}
|
|
31
58
|
);
|
|
@@ -24,5 +24,5 @@ export interface ResponsiveListProps<T> {
|
|
|
24
24
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
25
25
|
classNames?: ClassNames<ResponsiveListPart>;
|
|
26
26
|
}
|
|
27
|
-
/** A table
|
|
27
|
+
/** A table once its own container is 42rem wide and a stack of cards below that, from one column definition. */
|
|
28
28
|
export declare function ResponsiveList<T>({ caption, items, columns, rowKey, renderActions, actionsHeader, rowClassName, className, classNames, }: ResponsiveListProps<T>): import("react").JSX.Element;
|
|
@@ -24,12 +24,12 @@ function ResponsiveList({
|
|
|
24
24
|
const strings = useUiStrings();
|
|
25
25
|
const primary = columns.find((column) => column.primary) ?? columns[0];
|
|
26
26
|
const details = columns.filter((column) => column !== primary);
|
|
27
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("min-w-0", classNames?.root, className), children: [
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("@container/responsive-list min-w-0", classNames?.root, className), children: [
|
|
28
28
|
/* @__PURE__ */ jsx(
|
|
29
29
|
"div",
|
|
30
30
|
{
|
|
31
31
|
className: cn(
|
|
32
|
-
"hidden rounded-card border-card shadow-card surface-card
|
|
32
|
+
"hidden rounded-card border-card shadow-card surface-card @min-[42rem]/responsive-list:block",
|
|
33
33
|
classNames?.tableWrapper
|
|
34
34
|
),
|
|
35
35
|
children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
@@ -57,7 +57,10 @@ function ResponsiveList({
|
|
|
57
57
|
"ul",
|
|
58
58
|
{
|
|
59
59
|
"aria-label": caption,
|
|
60
|
-
className: cn(
|
|
60
|
+
className: cn(
|
|
61
|
+
"m-0 flex list-none flex-col gap-density p-0 @min-[42rem]/responsive-list:hidden",
|
|
62
|
+
classNames?.cards
|
|
63
|
+
),
|
|
61
64
|
children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
62
65
|
"li",
|
|
63
66
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stack, type StackAlign, type StackDirection, type StackGap, type StackProps, } from "./stack.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
export type StackDirection = "column" | "row";
|
|
3
|
+
export type StackGap = "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
+
export type StackAlign = "start" | "center" | "end" | "stretch" | "baseline";
|
|
5
|
+
export declare const stackGapClasses: Record<StackGap, string>;
|
|
6
|
+
export interface StackProps extends ComponentPropsWithoutRef<"div"> {
|
|
7
|
+
/** `column` stacks children vertically, `row` lays them out inline and wraps. Defaults to `column`. */
|
|
8
|
+
direction?: StackDirection;
|
|
9
|
+
/** Space between children. Defaults to `md`. */
|
|
10
|
+
gap?: StackGap;
|
|
11
|
+
/** Cross-axis alignment. Defaults to `stretch` for a column and `center` for a row. */
|
|
12
|
+
align?: StackAlign;
|
|
13
|
+
}
|
|
14
|
+
/** One-axis flex layout with token gaps. A row wraps instead of overflowing. */
|
|
15
|
+
export declare function Stack({ direction, gap, align, className, ...props }: StackProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
const stackGapClasses = {
|
|
4
|
+
none: "gap-0",
|
|
5
|
+
xs: "gap-1",
|
|
6
|
+
sm: "gap-2",
|
|
7
|
+
md: "gap-4",
|
|
8
|
+
lg: "gap-6",
|
|
9
|
+
xl: "gap-8"
|
|
10
|
+
};
|
|
11
|
+
const alignClasses = {
|
|
12
|
+
start: "items-start",
|
|
13
|
+
center: "items-center",
|
|
14
|
+
end: "items-end",
|
|
15
|
+
stretch: "items-stretch",
|
|
16
|
+
baseline: "items-baseline"
|
|
17
|
+
};
|
|
18
|
+
function Stack({
|
|
19
|
+
direction = "column",
|
|
20
|
+
gap = "md",
|
|
21
|
+
align,
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
const row = direction === "row";
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: cn(
|
|
30
|
+
"flex min-w-0",
|
|
31
|
+
row ? "flex-row flex-wrap" : "flex-col",
|
|
32
|
+
alignClasses[align ?? (row ? "center" : "stretch")],
|
|
33
|
+
stackGapClasses[gap],
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
Stack,
|
|
42
|
+
stackGapClasses
|
|
43
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
import type { ClassNames } from "../../utils/class-names.js";
|
|
3
|
+
export type CopyFieldPart = "root" | "label" | "box" | "value" | "button";
|
|
4
|
+
export interface CopyFieldProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "onCopy"> {
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
/** Text shown in monospace and written to the clipboard. */
|
|
7
|
+
value: string;
|
|
8
|
+
/** Called after the value was copied. */
|
|
9
|
+
onCopy?: (value: string) => void;
|
|
10
|
+
/** Accessible name of the button; defaults to the UI string `copy`. */
|
|
11
|
+
copyLabel?: string;
|
|
12
|
+
/** Announced and shown on the button after copying; defaults to the UI string `copied`. */
|
|
13
|
+
copiedLabel?: string;
|
|
14
|
+
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
15
|
+
classNames?: ClassNames<CopyFieldPart>;
|
|
16
|
+
}
|
|
17
|
+
export declare function CopyField({ label, value, onCopy, copyLabel, copiedLabel, className, classNames, ...props }: CopyFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { useUiStrings } from "../../i18n/index.js";
|
|
5
|
+
import { Check, Copy } from "../../icons/index.js";
|
|
6
|
+
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { useCopy } from "../../utils/use-copy.js";
|
|
8
|
+
function CopyField({
|
|
9
|
+
label,
|
|
10
|
+
value,
|
|
11
|
+
onCopy,
|
|
12
|
+
copyLabel,
|
|
13
|
+
copiedLabel,
|
|
14
|
+
className,
|
|
15
|
+
classNames,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
const strings = useUiStrings();
|
|
19
|
+
const id = useId();
|
|
20
|
+
const { copied, copy } = useCopy(1500);
|
|
21
|
+
const buttonLabel = copied ? copiedLabel ?? strings.copied : copyLabel ?? strings.copy;
|
|
22
|
+
return /* @__PURE__ */ jsxs("div", { ...props, className: cn("flex min-w-0 flex-col gap-1.5", classNames?.root, className), children: [
|
|
23
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, className: cn("font-semibold text-ink-2 text-meta", classNames?.label), children: label }),
|
|
24
|
+
/* @__PURE__ */ jsxs(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: cn(
|
|
28
|
+
"flex min-w-0 items-center gap-2 rounded-input border-control bg-surface-control pr-1 pl-3",
|
|
29
|
+
classNames?.box
|
|
30
|
+
),
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"input",
|
|
34
|
+
{
|
|
35
|
+
id,
|
|
36
|
+
readOnly: true,
|
|
37
|
+
value,
|
|
38
|
+
onFocus: (event) => event.currentTarget.select(),
|
|
39
|
+
className: cn(
|
|
40
|
+
"h-input min-w-0 flex-1 truncate bg-transparent font-mono text-control text-ink focus:outline-none",
|
|
41
|
+
classNames?.value
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ jsxs(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
onClick: () => {
|
|
50
|
+
void copy(value);
|
|
51
|
+
onCopy?.(value);
|
|
52
|
+
},
|
|
53
|
+
className: cn(
|
|
54
|
+
"inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1.5 rounded-button px-2.5 font-semibold text-ink-2 text-meta hover:bg-surface-2 hover:text-ink focus-visible:focus-ring in-data-[density=touch]:h-11",
|
|
55
|
+
copied && "text-success",
|
|
56
|
+
classNames?.button
|
|
57
|
+
),
|
|
58
|
+
children: [
|
|
59
|
+
copied ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "size-4" }) : /* @__PURE__ */ jsx(Copy, { "aria-hidden": "true", className: "size-4" }),
|
|
60
|
+
/* @__PURE__ */ jsx("span", { children: buttonLabel })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ jsx("span", { role: "status", className: "sr-only", children: copied ? copiedLabel ?? strings.copied : null })
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
CopyField
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CopyField, type CopyFieldPart, type CopyFieldProps } from "./copy-field.js";
|
|
@@ -44,7 +44,7 @@ function EmojiPicker({
|
|
|
44
44
|
"div",
|
|
45
45
|
{
|
|
46
46
|
className: cn(
|
|
47
|
-
"@container/emoji flex w-full max-w-xs min-w-0 flex-col gap-density-sm rounded-popover border-card
|
|
47
|
+
"@container/emoji flex w-full max-w-xs min-w-0 flex-col gap-density-sm rounded-popover border-card surface-overlay p-card text-ink",
|
|
48
48
|
classNames?.root,
|
|
49
49
|
className
|
|
50
50
|
),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
export type FormProps = ComponentPropsWithoutRef<"form">;
|
|
3
|
+
/** Vertical form layout; every `<form>` attribute and handler passes through. */
|
|
4
|
+
export declare function Form({ className, ...props }: FormProps): import("react").JSX.Element;
|
|
5
|
+
interface FormMessageProps extends Omit<ComponentPropsWithoutRef<"p">, "role" | "children"> {
|
|
6
|
+
/** Message text; `null`, `undefined` and an empty string render nothing. */
|
|
7
|
+
message: ReactNode | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
export type FormErrorProps = FormMessageProps;
|
|
10
|
+
/** Submit-level error. `role="alert"`, so assistive tech announces it as soon as it appears. */
|
|
11
|
+
export declare function FormError({ message, className, ...props }: FormErrorProps): import("react").JSX.Element | null;
|
|
12
|
+
export type FormStatusProps = FormMessageProps;
|
|
13
|
+
/** Submit-level confirmation. `role="status"`, a polite live region that does not interrupt. */
|
|
14
|
+
export declare function FormStatus({ message, className, ...props }: FormStatusProps): import("react").JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
function Form({ className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("form", { className: cn("flex min-w-0 flex-col gap-4", className), ...props });
|
|
5
|
+
}
|
|
6
|
+
function hasMessage(message) {
|
|
7
|
+
return message !== null && message !== void 0 && message !== false && message !== "";
|
|
8
|
+
}
|
|
9
|
+
function FormError({ message, className, ...props }) {
|
|
10
|
+
if (!hasMessage(message)) return null;
|
|
11
|
+
return /* @__PURE__ */ jsx("p", { role: "alert", className: cn("m-0 font-semibold text-danger text-meta", className), ...props, children: message });
|
|
12
|
+
}
|
|
13
|
+
function FormStatus({ message, className, ...props }) {
|
|
14
|
+
if (!hasMessage(message)) return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"p",
|
|
17
|
+
{
|
|
18
|
+
role: "status",
|
|
19
|
+
className: cn("m-0 font-semibold text-meta text-success", className),
|
|
20
|
+
...props,
|
|
21
|
+
children: message
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
Form,
|
|
27
|
+
FormError,
|
|
28
|
+
FormStatus
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Form, FormError, type FormErrorProps, type FormProps, FormStatus, type FormStatusProps, } from "./form.js";
|
package/dist/forms/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./accent-picker/index.js";
|
|
2
2
|
export * from "./checkbox-button-group/index.js";
|
|
3
|
+
export * from "./copy-field/index.js";
|
|
3
4
|
export * from "./dropzone/index.js";
|
|
4
5
|
export * from "./emoji-picker/index.js";
|
|
5
6
|
export * from "./emoji-reaction-button/index.js";
|
|
6
7
|
export * from "./field/index.js";
|
|
8
|
+
export * from "./form/index.js";
|
|
7
9
|
export * from "./form-grid/index.js";
|
|
8
10
|
export * from "./inline-select/index.js";
|
|
9
11
|
export * from "./input/index.js";
|
package/dist/forms/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./accent-picker/index.js";
|
|
2
2
|
export * from "./checkbox-button-group/index.js";
|
|
3
|
+
export * from "./copy-field/index.js";
|
|
3
4
|
export * from "./dropzone/index.js";
|
|
4
5
|
export * from "./emoji-picker/index.js";
|
|
5
6
|
export * from "./emoji-reaction-button/index.js";
|
|
6
7
|
export * from "./field/index.js";
|
|
8
|
+
export * from "./form/index.js";
|
|
7
9
|
export * from "./form-grid/index.js";
|
|
8
10
|
export * from "./inline-select/index.js";
|
|
9
11
|
export * from "./input/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Input, type InputProps } from "./input.js";
|
|
1
|
+
export { Input, type InputProps, type InputSize, inputSizeClasses } from "./input.js";
|