@devalok/shilp-sutra 0.56.0 → 0.59.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/MIGRATION.md +198 -0
- package/dist/_chunks/badge-group.js +75 -174
- package/dist/_chunks/badge-group.js.map +1 -1
- package/dist/_chunks/chat.js +270 -253
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/document-preview.js +1 -1
- package/dist/_chunks/document-preview.js.map +1 -1
- package/dist/_chunks/emoji-suggestion.js +1 -1
- package/dist/_chunks/emoji-suggestion.js.map +1 -1
- package/dist/_chunks/image-preview.js +71 -70
- package/dist/_chunks/image-preview.js.map +1 -1
- package/dist/_chunks/mention-suggestion.js +2 -2
- package/dist/_chunks/mention-suggestion.js.map +1 -1
- package/dist/_chunks/motion-preference.js +15 -0
- package/dist/_chunks/motion-preference.js.map +1 -0
- package/dist/_chunks/motion-provider.js +1 -1
- package/dist/_chunks/motion-provider.js.map +1 -1
- package/dist/_chunks/oauth-button.js +1 -1
- package/dist/_chunks/oauth-button.js.map +1 -1
- package/dist/_chunks/popover.js +50 -49
- package/dist/_chunks/popover.js.map +1 -1
- package/dist/_chunks/primitives-internal.js +29 -29
- package/dist/_chunks/primitives-internal.js.map +1 -1
- package/dist/_chunks/shared.js +48 -47
- package/dist/_chunks/shared.js.map +1 -1
- package/dist/_chunks/success.js +36 -36
- package/dist/_chunks/success.js.map +1 -1
- package/dist/_chunks/tree-view.js +1 -1
- package/dist/_chunks/tree-view.js.map +1 -1
- package/dist/_chunks/use-calendar.js +4 -4
- package/dist/_chunks/use-calendar.js.map +1 -1
- package/dist/ai/block-renderer.js +8 -8
- package/dist/ai/blocks/text.js +1 -1
- package/dist/ai/blocks/text.js.map +1 -1
- package/dist/ai/command-bar.js +67 -67
- package/dist/ai/command-bar.js.map +1 -1
- package/dist/ai/conversation.js +35 -35
- package/dist/ai/conversation.js.map +1 -1
- package/dist/ai/index.js +4 -4
- package/dist/composed/activity-feed.d.ts.map +1 -1
- package/dist/composed/activity-feed.js +109 -108
- package/dist/composed/activity-feed.js.map +1 -1
- package/dist/composed/avatar-group.d.ts +7 -2
- package/dist/composed/avatar-group.d.ts.map +1 -1
- package/dist/composed/avatar-group.js +3 -3
- package/dist/composed/avatar-group.js.map +1 -1
- package/dist/composed/command-palette.js +137 -137
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/content-card.js +2 -2
- package/dist/composed/content-card.js.map +1 -1
- package/dist/composed/date-picker/index.js +9 -9
- package/dist/composed/date-picker/index.js.map +1 -1
- package/dist/composed/diff.d.ts +23 -2
- package/dist/composed/diff.d.ts.map +1 -1
- package/dist/composed/diff.js +341 -260
- package/dist/composed/diff.js.map +1 -1
- package/dist/composed/emoji-picker.js +3 -3
- package/dist/composed/emoji-picker.js.map +1 -1
- package/dist/composed/empty-state.js +4 -4
- package/dist/composed/error-boundary.js +2 -2
- package/dist/composed/error-boundary.js.map +1 -1
- package/dist/composed/file-preview/image-preview.d.ts.map +1 -1
- package/dist/composed/file-preview/shared.d.ts.map +1 -1
- package/dist/composed/file-preview/video-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.js +152 -151
- package/dist/composed/file-preview.js.map +1 -1
- package/dist/composed/filter-bar.d.ts.map +1 -1
- package/dist/composed/filter-bar.js +53 -52
- package/dist/composed/filter-bar.js.map +1 -1
- package/dist/composed/form-section.d.ts.map +1 -1
- package/dist/composed/form-section.js +38 -37
- package/dist/composed/form-section.js.map +1 -1
- package/dist/composed/inline-edit.js +1 -1
- package/dist/composed/inline-edit.js.map +1 -1
- package/dist/composed/loading-skeleton.js +3 -3
- package/dist/composed/loading-skeleton.js.map +1 -1
- package/dist/composed/master-detail.d.ts.map +1 -1
- package/dist/composed/master-detail.js +1 -1
- package/dist/composed/master-detail.js.map +1 -1
- package/dist/composed/member-picker.js +1 -1
- package/dist/composed/member-picker.js.map +1 -1
- package/dist/composed/multi-select-popover.d.ts.map +1 -1
- package/dist/composed/multi-select-popover.js +109 -108
- package/dist/composed/multi-select-popover.js.map +1 -1
- package/dist/composed/page-skeletons.js +4 -4
- package/dist/composed/page-skeletons.js.map +1 -1
- package/dist/composed/responsive-modal.js +1 -1
- package/dist/composed/responsive-modal.js.map +1 -1
- package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.js +473 -472
- package/dist/composed/rich-chat-input.js.map +1 -1
- package/dist/composed/rich-text-editor.js +6 -6
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/composed/schedule-view.js +5 -5
- package/dist/composed/schedule-view.js.map +1 -1
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +29 -28
- package/dist/composed/status-badge.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +4 -3
- package/dist/hooks/use-container-size.d.ts +18 -0
- package/dist/hooks/use-container-size.d.ts.map +1 -0
- package/dist/hooks/use-container-size.js +28 -0
- package/dist/hooks/use-container-size.js.map +1 -0
- package/dist/motion/index.d.ts +1 -0
- package/dist/motion/index.d.ts.map +1 -1
- package/dist/motion/index.js +2 -15
- package/dist/motion/motion-preference.d.ts +36 -0
- package/dist/motion/motion-preference.d.ts.map +1 -0
- package/dist/motion/motion-provider.d.ts +2 -1
- package/dist/motion/motion-provider.d.ts.map +1 -1
- package/dist/motion/primitives-index.js +103 -102
- package/dist/motion/primitives-index.js.map +1 -1
- package/dist/motion/primitives.d.ts.map +1 -1
- package/dist/shell/app-shell.d.ts +101 -0
- package/dist/shell/app-shell.d.ts.map +1 -0
- package/dist/shell/app-shell.js +76 -0
- package/dist/shell/app-shell.js.map +1 -0
- package/dist/shell/bottom-navbar.js +21 -21
- package/dist/shell/bottom-navbar.js.map +1 -1
- package/dist/shell/index.d.ts +2 -1
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +6 -5
- package/dist/shell/notification-center.d.ts +17 -0
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +110 -105
- package/dist/shell/notification-center.js.map +1 -1
- package/dist/shell/notification-preferences.js +1 -1
- package/dist/shell/notification-preferences.js.map +1 -1
- package/dist/shell/top-bar.js +7 -7
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/tokens/generate-scale.d.ts +49 -0
- package/dist/tokens/generate-scale.d.ts.map +1 -1
- package/dist/tokens/index.css +1 -0
- package/dist/tokens/palettes.css +292 -0
- package/dist/tokens/primitives.css +29 -26
- package/dist/tokens/semantic.css +170 -47
- package/dist/tokens/shilp-sutra.css +1 -0
- package/dist/tokens/utilities.css +10 -7
- package/dist/tokens/variants.css +1 -1
- package/dist/ui/accordion.d.ts.map +1 -1
- package/dist/ui/accordion.js +27 -26
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/alert-dialog.d.ts.map +1 -1
- package/dist/ui/alert-dialog.js +60 -59
- package/dist/ui/alert-dialog.js.map +1 -1
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +55 -113
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/autocomplete.js +80 -80
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +71 -70
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge-indicator.d.ts +4 -8
- package/dist/ui/badge-indicator.d.ts.map +1 -1
- package/dist/ui/badge-indicator.js +3 -8
- package/dist/ui/badge-indicator.js.map +1 -1
- package/dist/ui/badge.d.ts +55 -34
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +43 -41
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/button-group.d.ts.map +1 -1
- package/dist/ui/button-group.js +3 -23
- package/dist/ui/button-group.js.map +1 -1
- package/dist/ui/button.d.ts +10 -1
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +79 -212
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +78 -75
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/charts/radar-chart.d.ts.map +1 -1
- package/dist/ui/charts/radar-chart.js +1 -1
- package/dist/ui/charts/radar-chart.js.map +1 -1
- package/dist/ui/chat/date-separator.d.ts +8 -1
- package/dist/ui/chat/date-separator.d.ts.map +1 -1
- package/dist/ui/chat/message-list.d.ts.map +1 -1
- package/dist/ui/chat/message.d.ts.map +1 -1
- package/dist/ui/chat/typing-indicator.d.ts.map +1 -1
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/checkbox.js.map +1 -1
- package/dist/ui/code.js +2 -2
- package/dist/ui/code.js.map +1 -1
- package/dist/ui/color-input.d.ts.map +1 -1
- package/dist/ui/color-input.js +151 -150
- package/dist/ui/color-input.js.map +1 -1
- package/dist/ui/combobox.d.ts +14 -0
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +156 -152
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/context-menu.d.ts.map +1 -1
- package/dist/ui/context-menu.js +70 -69
- package/dist/ui/context-menu.js.map +1 -1
- package/dist/ui/data-table-body.d.ts +3 -1
- package/dist/ui/data-table-body.d.ts.map +1 -1
- package/dist/ui/data-table-body.js +93 -92
- package/dist/ui/data-table-body.js.map +1 -1
- package/dist/ui/data-table-bulk-actions.d.ts +7 -1
- package/dist/ui/data-table-bulk-actions.d.ts.map +1 -1
- package/dist/ui/data-table-bulk-actions.js +14 -8
- package/dist/ui/data-table-bulk-actions.js.map +1 -1
- package/dist/ui/data-table-card.d.ts.map +1 -1
- package/dist/ui/data-table-card.js +66 -47
- package/dist/ui/data-table-card.js.map +1 -1
- package/dist/ui/data-table-context.d.ts +4 -0
- package/dist/ui/data-table-context.d.ts.map +1 -1
- package/dist/ui/data-table-context.js +2 -2
- package/dist/ui/data-table-context.js.map +1 -1
- package/dist/ui/data-table-header.d.ts.map +1 -1
- package/dist/ui/data-table-header.js +50 -46
- package/dist/ui/data-table-header.js.map +1 -1
- package/dist/ui/data-table-pagination.js +3 -3
- package/dist/ui/data-table-pagination.js.map +1 -1
- package/dist/ui/data-table-toolbar.d.ts +11 -1
- package/dist/ui/data-table-toolbar.d.ts.map +1 -1
- package/dist/ui/data-table-toolbar.js +7 -7
- package/dist/ui/data-table-toolbar.js.map +1 -1
- package/dist/ui/data-table.d.ts +52 -5
- package/dist/ui/data-table.d.ts.map +1 -1
- package/dist/ui/data-table.js +181 -169
- package/dist/ui/data-table.js.map +1 -1
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +62 -61
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/dot.d.ts.map +1 -1
- package/dist/ui/dot.js +10 -41
- package/dist/ui/dot.js.map +1 -1
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +79 -78
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/file-upload.d.ts.map +1 -1
- package/dist/ui/file-upload.js +117 -116
- package/dist/ui/file-upload.js.map +1 -1
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +27 -26
- package/dist/ui/form.js.map +1 -1
- package/dist/ui/hover-card.d.ts.map +1 -1
- package/dist/ui/hover-card.js +26 -25
- package/dist/ui/hover-card.js.map +1 -1
- package/dist/ui/icon.js +7 -7
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +3 -3
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/input-otp.js +1 -1
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/input.js +8 -8
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/menubar.js +73 -72
- package/dist/ui/menubar.js.map +1 -1
- package/dist/ui/navigation-menu.d.ts.map +1 -1
- package/dist/ui/navigation-menu.js +80 -79
- package/dist/ui/navigation-menu.js.map +1 -1
- package/dist/ui/number-input.js +3 -3
- package/dist/ui/number-input.js.map +1 -1
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/pagination.js.map +1 -1
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/progress-ring.js +2 -2
- package/dist/ui/progress-ring.js.map +1 -1
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +82 -74
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +32 -31
- package/dist/ui/radio.js.map +1 -1
- package/dist/ui/search-input.d.ts.map +1 -1
- package/dist/ui/search-input.js +28 -27
- package/dist/ui/search-input.js.map +1 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +67 -66
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sheet.js +1 -1
- package/dist/ui/sheet.js.map +1 -1
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +14 -14
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/slider.d.ts +63 -9
- package/dist/ui/slider.d.ts.map +1 -1
- package/dist/ui/slider.js +75 -33
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/split-button.d.ts +8 -2
- package/dist/ui/split-button.d.ts.map +1 -1
- package/dist/ui/split-button.js +49 -95
- package/dist/ui/split-button.js.map +1 -1
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +89 -88
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/stat-flash.js +16 -16
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +63 -62
- package/dist/ui/stepper.js.map +1 -1
- package/dist/ui/surface.d.ts.map +1 -1
- package/dist/ui/surface.js +2 -2
- package/dist/ui/surface.js.map +1 -1
- package/dist/ui/switch.js +1 -1
- package/dist/ui/switch.js.map +1 -1
- package/dist/ui/table.js +3 -3
- package/dist/ui/table.js.map +1 -1
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +68 -67
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/textarea.js +5 -5
- package/dist/ui/textarea.js.map +1 -1
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +196 -195
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/toggle.d.ts.map +1 -1
- package/dist/ui/toggle.js +26 -24
- package/dist/ui/toggle.js.map +1 -1
- package/dist/ui/tooltip.d.ts.map +1 -1
- package/dist/ui/tooltip.js +37 -36
- package/dist/ui/tooltip.js.map +1 -1
- package/dist/ui/tree-view/tree-item.d.ts.map +1 -1
- package/docs/components/composed/avatar-group.md +4 -4
- package/docs/components/composed/diff.md +10 -2
- package/docs/components/composed/schedule-view.md +1 -1
- package/docs/components/shell/app-shell.md +132 -0
- package/docs/components/ui/avatar.md +1 -1
- package/docs/components/ui/button.md +1 -1
- package/docs/components/ui/chat.md +7 -1
- package/docs/components/ui/color-swatch.md +1 -1
- package/docs/components/ui/data-table-toolbar.md +6 -2
- package/docs/components/ui/data-table.md +41 -7
- package/docs/components/ui/dot.md +1 -1
- package/docs/components/ui/progress.md +1 -0
- package/docs/components/ui/surface.md +3 -3
- package/docs/components/ui/table.md +2 -2
- package/docs/recipes/customize-brand.md +58 -0
- package/docs/recipes/install-astro.md +1 -0
- package/docs/recipes/install-next-app-router.md +1 -0
- package/docs/recipes/install-next-pages.md +22 -1
- package/docs/recipes/install-remix.md +1 -0
- package/docs/recipes/install-tanstack-start.md +1 -0
- package/docs/recipes/install-vite.md +2 -0
- package/docs/recipes/server-components.md +7 -4
- package/docs/recipes/troubleshoot.md +1 -0
- package/llms.txt +2 -1
- package/make-kit/Guidelines.md +2 -2
- package/make-kit/components/button.md +1 -1
- package/make-kit/components/card.md +6 -6
- package/make-kit/components/surface.md +4 -4
- package/make-kit/foundations/color.md +4 -4
- package/make-kit/foundations/dark-mode.md +1 -1
- package/make-kit/foundations/radius.md +1 -1
- package/make-kit/foundations/surfaces.md +9 -9
- package/mcp-manifest.json +358 -35
- package/package.json +8 -4
- package/skill/SKILL.md +12 -6
- package/skill/references/components.md +2 -1
- package/skill/references/customize-brand.md +58 -0
- package/skill/references/server-components.md +7 -4
- package/skill/references/setup-astro.md +1 -0
- package/skill/references/setup-next-app-router.md +1 -0
- package/skill/references/setup-next-pages.md +22 -1
- package/skill/references/setup-remix.md +1 -0
- package/skill/references/setup-tanstack-start.md +1 -0
- package/skill/references/setup-vite.md +2 -0
- package/skill/references/troubleshoot.md +1 -0
- package/dist/motion/check-motion-provider.d.ts +0 -2
- package/dist/motion/check-motion-provider.d.ts.map +0 -1
- package/dist/motion/index.js.map +0 -1
- package/dist/primitives/react-toast.d.ts +0 -120
- package/dist/ui/charts/_internal/scales.d.ts +0 -5
- package/dist/ui/charts/_internal/scales.d.ts.map +0 -1
- package/dist/ui/lib/slot.d.ts +0 -8
- package/dist/ui/lib/slot.d.ts.map +0 -1
package/dist/ui/split-button.js
CHANGED
|
@@ -5,107 +5,60 @@ import * as i from "react";
|
|
|
5
5
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
//#region src/ui/split-button.tsx
|
|
7
7
|
var c = {
|
|
8
|
-
solid:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
success: "bg-success-11/20",
|
|
12
|
-
warning: "bg-warning-11/20",
|
|
13
|
-
info: "bg-info-11/20",
|
|
14
|
-
neutral: "bg-neutral-8/30"
|
|
15
|
-
},
|
|
16
|
-
soft: {
|
|
17
|
-
accent: "bg-accent-6",
|
|
18
|
-
error: "bg-error-6",
|
|
19
|
-
success: "bg-success-6",
|
|
20
|
-
warning: "bg-warning-6",
|
|
21
|
-
info: "bg-info-6",
|
|
22
|
-
neutral: "bg-surface-border"
|
|
23
|
-
},
|
|
24
|
-
outline: {
|
|
25
|
-
accent: "bg-accent-7",
|
|
26
|
-
error: "bg-error-7",
|
|
27
|
-
success: "bg-success-7",
|
|
28
|
-
warning: "bg-warning-7",
|
|
29
|
-
info: "bg-info-7",
|
|
30
|
-
neutral: "bg-surface-border-strong"
|
|
31
|
-
}
|
|
8
|
+
solid: "bg-palette-solid-active/20",
|
|
9
|
+
soft: "bg-palette-border-subtle",
|
|
10
|
+
outline: "bg-palette-border"
|
|
32
11
|
}, l = {
|
|
12
|
+
solid: "bg-neutral-8/30",
|
|
13
|
+
soft: "bg-surface-border"
|
|
14
|
+
}, u = {
|
|
33
15
|
xs: "h-ds-xs-plus",
|
|
34
16
|
sm: "h-ds-sm",
|
|
35
17
|
md: "h-ds-md",
|
|
36
18
|
"icon-xs": "h-ds-xs-plus",
|
|
37
19
|
"icon-sm": "h-ds-sm",
|
|
38
20
|
"icon-md": "h-ds-md"
|
|
39
|
-
},
|
|
21
|
+
}, d = {
|
|
40
22
|
xs: "text-body-sm",
|
|
41
23
|
sm: "text-body-sm",
|
|
42
24
|
md: "text-body-md",
|
|
43
25
|
"icon-xs": "text-body-sm",
|
|
44
26
|
"icon-sm": "text-body-sm",
|
|
45
27
|
"icon-md": "text-body-md"
|
|
46
|
-
},
|
|
28
|
+
}, f = {
|
|
47
29
|
xs: "px-ds-03 gap-1",
|
|
48
30
|
sm: "px-ds-04 gap-1.5",
|
|
49
31
|
md: "px-ds-05 gap-2",
|
|
50
32
|
"icon-xs": "px-ds-02",
|
|
51
33
|
"icon-sm": "px-ds-03",
|
|
52
34
|
"icon-md": "px-ds-04"
|
|
53
|
-
},
|
|
35
|
+
}, p = {
|
|
54
36
|
xs: "px-ds-02",
|
|
55
37
|
sm: "px-ds-02",
|
|
56
38
|
md: "px-ds-03",
|
|
57
39
|
"icon-xs": "px-ds-01",
|
|
58
40
|
"icon-sm": "px-ds-02",
|
|
59
41
|
"icon-md": "px-ds-02"
|
|
60
|
-
},
|
|
42
|
+
}, m = {
|
|
61
43
|
xs: "rounded-control",
|
|
62
44
|
sm: "rounded-control",
|
|
63
45
|
md: "rounded-control",
|
|
64
46
|
"icon-xs": "rounded-control",
|
|
65
47
|
"icon-sm": "rounded-control",
|
|
66
48
|
"icon-md": "rounded-control"
|
|
49
|
+
}, h = {
|
|
50
|
+
solid: "bg-palette-solid text-palette-fg hover:bg-palette-solid-hover active:bg-palette-solid-active",
|
|
51
|
+
soft: "bg-palette-soft text-palette-text hover:bg-palette-soft-hover active:bg-palette-soft-active",
|
|
52
|
+
outline: "bg-transparent text-palette-text hover:bg-palette-soft active:bg-palette-soft-hover"
|
|
67
53
|
};
|
|
68
|
-
function
|
|
69
|
-
let n =
|
|
70
|
-
|
|
71
|
-
accent: "bg-accent-9 text-accent-fg hover:bg-accent-10 active:bg-accent-11",
|
|
72
|
-
error: "bg-error-9 text-error-fg hover:bg-error-10 active:bg-error-11",
|
|
73
|
-
success: "bg-success-9 text-success-fg hover:bg-success-10 active:bg-success-11",
|
|
74
|
-
warning: "bg-warning-9 text-warning-fg hover:bg-warning-10 active:bg-warning-11",
|
|
75
|
-
info: "bg-info-9 text-info-fg hover:bg-info-10 active:bg-info-11",
|
|
76
|
-
neutral: "bg-neutral-5 text-surface-fg hover:bg-neutral-7 active:bg-neutral-8"
|
|
77
|
-
},
|
|
78
|
-
soft: {
|
|
79
|
-
accent: "bg-accent-3 text-accent-11 hover:bg-accent-4 active:bg-accent-5",
|
|
80
|
-
error: "bg-error-3 text-error-11 hover:bg-error-4 active:bg-error-5",
|
|
81
|
-
success: "bg-success-3 text-success-11 hover:bg-success-4 active:bg-success-5",
|
|
82
|
-
warning: "bg-warning-3 text-warning-11 hover:bg-warning-4 active:bg-warning-5",
|
|
83
|
-
info: "bg-info-3 text-info-11 hover:bg-info-4 active:bg-info-5",
|
|
84
|
-
neutral: "bg-surface-raised-hover text-surface-fg-muted hover:bg-surface-raised-active active:bg-neutral-5"
|
|
85
|
-
},
|
|
86
|
-
outline: {
|
|
87
|
-
accent: "bg-transparent text-accent-11 hover:bg-accent-3 active:bg-accent-4",
|
|
88
|
-
error: "bg-transparent text-error-11 hover:bg-error-3 active:bg-error-4",
|
|
89
|
-
success: "bg-transparent text-success-11 hover:bg-success-3 active:bg-success-4",
|
|
90
|
-
warning: "bg-transparent text-warning-11 hover:bg-warning-3 active:bg-warning-4",
|
|
91
|
-
info: "bg-transparent text-info-11 hover:bg-info-3 active:bg-info-4",
|
|
92
|
-
neutral: "bg-transparent text-surface-fg hover:bg-surface-raised-hover active:bg-surface-raised-active"
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
return n[e][t] ?? n[e].accent;
|
|
54
|
+
function g(e, t) {
|
|
55
|
+
let n = e === "outline" && t === "neutral" ? " text-surface-fg" : "";
|
|
56
|
+
return h[e] + n;
|
|
96
57
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
accent: "border-accent-7",
|
|
100
|
-
error: "border-error-7",
|
|
101
|
-
success: "border-success-7",
|
|
102
|
-
warning: "border-warning-7",
|
|
103
|
-
info: "border-info-7",
|
|
104
|
-
neutral: "border-surface-border-strong"
|
|
105
|
-
};
|
|
106
|
-
return t[e] ?? t.accent;
|
|
58
|
+
function _(e) {
|
|
59
|
+
return e === "neutral" ? "border-surface-border-interactive" : "border-palette-border";
|
|
107
60
|
}
|
|
108
|
-
function
|
|
61
|
+
function v({ className: e }) {
|
|
109
62
|
return /* @__PURE__ */ o("svg", {
|
|
110
63
|
width: "12",
|
|
111
64
|
height: "12",
|
|
@@ -122,53 +75,54 @@ function g({ className: e }) {
|
|
|
122
75
|
})
|
|
123
76
|
});
|
|
124
77
|
}
|
|
125
|
-
var
|
|
126
|
-
let [
|
|
127
|
-
let [e, t] =
|
|
78
|
+
var y = i.forwardRef(function({ children: h, onClick: y, dropdownContent: b, open: x, onOpenChange: S, variant: C = "solid", color: w = "accent", size: T = "md", disabled: E = !1, "aria-label": D, dropdownLabel: O = "More options", dropdownIcon: k, triggerSide: A = "right", placement: j = "top-end", triggerWidth: M, className: N }, P) {
|
|
79
|
+
let [F, I] = i.useMemo(() => {
|
|
80
|
+
let [e, t] = j.split("-");
|
|
128
81
|
return [e, t === "start" ? "start" : t === "end" ? "end" : "center"];
|
|
129
|
-
}, [
|
|
82
|
+
}, [j]), L = g(C, w), R = (w === "neutral" ? l[C] : void 0) ?? c[C], z = M == null ? void 0 : { width: typeof M == "number" ? `${M}px` : M }, B = /* @__PURE__ */ o(r, {
|
|
130
83
|
asChild: !0,
|
|
131
84
|
children: /* @__PURE__ */ o("button", {
|
|
132
85
|
type: "button",
|
|
133
|
-
disabled:
|
|
134
|
-
"aria-label":
|
|
135
|
-
className: e("inline-flex items-center justify-center select-none", "transition-colors duration-fast-01 ease-productive-standard", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset", "disabled:pointer-events-none disabled:opacity-action-disabled",
|
|
136
|
-
style:
|
|
137
|
-
children:
|
|
86
|
+
disabled: E,
|
|
87
|
+
"aria-label": O,
|
|
88
|
+
className: e("inline-flex items-center justify-center select-none", "transition-colors duration-fast-01 ease-productive-standard", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset", "disabled:pointer-events-none disabled:opacity-action-disabled", L, u[T], p[T]),
|
|
89
|
+
style: z,
|
|
90
|
+
children: k ?? /* @__PURE__ */ o(v, {})
|
|
138
91
|
})
|
|
139
92
|
});
|
|
140
93
|
return /* @__PURE__ */ s(t, {
|
|
141
|
-
open:
|
|
142
|
-
onOpenChange:
|
|
94
|
+
open: x,
|
|
95
|
+
onOpenChange: S,
|
|
143
96
|
children: [/* @__PURE__ */ o("div", {
|
|
144
|
-
ref:
|
|
97
|
+
ref: P,
|
|
145
98
|
role: "group",
|
|
146
|
-
"aria-label":
|
|
147
|
-
|
|
99
|
+
"aria-label": D ?? void 0,
|
|
100
|
+
"data-palette": w,
|
|
101
|
+
className: e("relative inline-flex", N),
|
|
148
102
|
children: /* @__PURE__ */ s("div", {
|
|
149
|
-
className: e("inline-flex items-stretch overflow-hidden",
|
|
103
|
+
className: e("inline-flex items-stretch overflow-hidden", m[T], C === "solid" && "shadow-raised", C === "outline" && `border ${_(w)}`),
|
|
150
104
|
children: [
|
|
151
|
-
|
|
105
|
+
A === "left" && /* @__PURE__ */ s(a, { children: [B, /* @__PURE__ */ o("div", { className: e("w-px self-stretch", R) })] }),
|
|
152
106
|
/* @__PURE__ */ o("button", {
|
|
153
107
|
type: "button",
|
|
154
|
-
onClick:
|
|
155
|
-
disabled:
|
|
156
|
-
"aria-label":
|
|
157
|
-
className: e("inline-flex items-center justify-center font-semibold select-none whitespace-nowrap", "transition-[colors,transform] duration-fast-01 ease-productive-standard", "active:scale-[0.97]", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset", "disabled:pointer-events-none disabled:opacity-action-disabled",
|
|
158
|
-
children:
|
|
108
|
+
onClick: y,
|
|
109
|
+
disabled: E,
|
|
110
|
+
"aria-label": D,
|
|
111
|
+
className: e("inline-flex items-center justify-center font-semibold select-none whitespace-nowrap", "transition-[colors,transform] duration-fast-01 ease-productive-standard", "active:scale-[0.97]", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset", "disabled:pointer-events-none disabled:opacity-action-disabled", L, u[T], d[T], f[T]),
|
|
112
|
+
children: h
|
|
159
113
|
}),
|
|
160
|
-
|
|
114
|
+
A === "right" && /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("div", { className: e("w-px self-stretch", R) }), B] })
|
|
161
115
|
]
|
|
162
116
|
})
|
|
163
|
-
}),
|
|
164
|
-
side:
|
|
165
|
-
align:
|
|
117
|
+
}), b && /* @__PURE__ */ o(n, {
|
|
118
|
+
side: F,
|
|
119
|
+
align: I,
|
|
166
120
|
sideOffset: 8,
|
|
167
121
|
className: "w-auto min-w-[10rem] p-ds-01",
|
|
168
|
-
children:
|
|
122
|
+
children: b
|
|
169
123
|
})]
|
|
170
124
|
});
|
|
171
125
|
});
|
|
172
|
-
|
|
126
|
+
y.displayName = "SplitButton";
|
|
173
127
|
//#endregion
|
|
174
|
-
export {
|
|
128
|
+
export { y as SplitButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.js","names":[],"sources":["../../src/ui/split-button.tsx"],"sourcesContent":["'use client'\n\nimport { type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { buttonVariants } from './button'\nimport { cn } from './lib/utils'\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\n\n// ── Types ───────────────────────────────────────────────────────\n\n/**\n * Placement of the dropdown panel, in floating-ui's vocabulary.\n *\n * Declared here rather than imported from `@floating-ui/dom`: that package is\n * bundled into dist at runtime but is NOT a consumer dependency, so a type\n * import leaks an unresolvable specifier into the published .d.ts —\n * `error TS2307: Cannot find module '@floating-ui/dom'` for anyone type-checking\n * declarations. The union is stable and two lines; borrowing it is not worth an\n * install. (This component no longer calls floating-ui at all — see the Radix\n * Popover mapping below.)\n */\nexport type SplitButtonPlacement =\n | 'top' | 'right' | 'bottom' | 'left'\n | 'top-start' | 'top-end'\n | 'right-start' | 'right-end'\n | 'bottom-start' | 'bottom-end'\n | 'left-start' | 'left-end'\n\ntype SplitButtonVariant = 'solid' | 'soft' | 'outline'\ntype SplitButtonColor = NonNullable<VariantProps<typeof buttonVariants>['color']>\ntype SplitButtonSize = 'xs' | 'sm' | 'md' | 'icon-xs' | 'icon-sm' | 'icon-md'\n\nexport interface SplitButtonProps {\n /** Primary action content (left side). */\n children: React.ReactNode\n /** Primary click handler (left side). */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void\n /** Content rendered inside the floating dropdown panel. */\n dropdownContent?: React.ReactNode\n /** Controlled open state. */\n open?: boolean\n /** Called when open state changes. Uncontrolled if omitted. */\n onOpenChange?: (open: boolean) => void\n /** @default 'solid' */\n variant?: SplitButtonVariant\n /** @default 'accent' */\n color?: SplitButtonColor\n /** @default 'md' */\n size?: SplitButtonSize\n /** Disable both halves. */\n disabled?: boolean\n /** aria-label for the primary button. */\n 'aria-label'?: string\n /** aria-label for the dropdown trigger. @default 'More options' */\n dropdownLabel?: string\n /** Custom icon for the dropdown trigger. Defaults to chevron-down. */\n dropdownIcon?: React.ReactNode\n /** Which side the dropdown trigger sits on. @default 'right' */\n triggerSide?: 'left' | 'right'\n /** Preferred placement for the dropdown panel. @default 'top-end' */\n placement?: SplitButtonPlacement\n /** Width of the trigger (chevron) half. @default 'auto' */\n triggerWidth?: number | string\n className?: string\n}\n\n// ── Styling maps ────────────────────────────────────────────────\n\nconst dividerColor: Record<SplitButtonVariant, Record<string, string>> = {\n solid: {\n accent: 'bg-accent-11/20', error: 'bg-error-11/20', success: 'bg-success-11/20',\n warning: 'bg-warning-11/20', info: 'bg-info-11/20', neutral: 'bg-neutral-8/30',\n },\n soft: {\n accent: 'bg-accent-6', error: 'bg-error-6', success: 'bg-success-6',\n warning: 'bg-warning-6', info: 'bg-info-6', neutral: 'bg-surface-border',\n },\n outline: {\n accent: 'bg-accent-7', error: 'bg-error-7', success: 'bg-success-7',\n warning: 'bg-warning-7', info: 'bg-info-7', neutral: 'bg-surface-border-strong',\n },\n}\n\nconst heightClass: Record<SplitButtonSize, string> = {\n xs: 'h-ds-xs-plus', sm: 'h-ds-sm', md: 'h-ds-md',\n 'icon-xs': 'h-ds-xs-plus', 'icon-sm': 'h-ds-sm', 'icon-md': 'h-ds-md',\n}\n\nconst textClass: Record<SplitButtonSize, string> = {\n xs: 'text-body-sm', sm: 'text-body-sm', md: 'text-body-md',\n 'icon-xs': 'text-body-sm', 'icon-sm': 'text-body-sm', 'icon-md': 'text-body-md',\n}\n\nconst primaryPadding: Record<SplitButtonSize, string> = {\n xs: 'px-ds-03 gap-1', sm: 'px-ds-04 gap-1.5', md: 'px-ds-05 gap-2',\n 'icon-xs': 'px-ds-02', 'icon-sm': 'px-ds-03', 'icon-md': 'px-ds-04',\n}\n\nconst triggerPadding: Record<SplitButtonSize, string> = {\n xs: 'px-ds-02', sm: 'px-ds-02', md: 'px-ds-03',\n 'icon-xs': 'px-ds-01', 'icon-sm': 'px-ds-02', 'icon-md': 'px-ds-02',\n}\n\nconst radiusClass: Record<SplitButtonSize, string> = {\n xs: 'rounded-control', sm: 'rounded-control', md: 'rounded-control',\n 'icon-xs': 'rounded-control', 'icon-sm': 'rounded-control', 'icon-md': 'rounded-control',\n}\n\nfunction getHalfClasses(variant: SplitButtonVariant, color: string): string {\n const map: Record<SplitButtonVariant, Record<string, string>> = {\n solid: {\n accent: 'bg-accent-9 text-accent-fg hover:bg-accent-10 active:bg-accent-11',\n error: 'bg-error-9 text-error-fg hover:bg-error-10 active:bg-error-11',\n success: 'bg-success-9 text-success-fg hover:bg-success-10 active:bg-success-11',\n warning: 'bg-warning-9 text-warning-fg hover:bg-warning-10 active:bg-warning-11',\n info: 'bg-info-9 text-info-fg hover:bg-info-10 active:bg-info-11',\n neutral: 'bg-neutral-5 text-surface-fg hover:bg-neutral-7 active:bg-neutral-8',\n },\n soft: {\n accent: 'bg-accent-3 text-accent-11 hover:bg-accent-4 active:bg-accent-5',\n error: 'bg-error-3 text-error-11 hover:bg-error-4 active:bg-error-5',\n success: 'bg-success-3 text-success-11 hover:bg-success-4 active:bg-success-5',\n warning: 'bg-warning-3 text-warning-11 hover:bg-warning-4 active:bg-warning-5',\n info: 'bg-info-3 text-info-11 hover:bg-info-4 active:bg-info-5',\n neutral: 'bg-surface-raised-hover text-surface-fg-muted hover:bg-surface-raised-active active:bg-neutral-5',\n },\n outline: {\n accent: 'bg-transparent text-accent-11 hover:bg-accent-3 active:bg-accent-4',\n error: 'bg-transparent text-error-11 hover:bg-error-3 active:bg-error-4',\n success: 'bg-transparent text-success-11 hover:bg-success-3 active:bg-success-4',\n warning: 'bg-transparent text-warning-11 hover:bg-warning-3 active:bg-warning-4',\n info: 'bg-transparent text-info-11 hover:bg-info-3 active:bg-info-4',\n neutral: 'bg-transparent text-surface-fg hover:bg-surface-raised-hover active:bg-surface-raised-active',\n },\n }\n return map[variant][color] ?? map[variant].accent\n}\n\nfunction getOutlineBorderColor(color: string): string {\n const map: Record<string, string> = {\n accent: 'border-accent-7', error: 'border-error-7', success: 'border-success-7',\n warning: 'border-warning-7', info: 'border-info-7', neutral: 'border-surface-border-strong',\n }\n return map[color] ?? map.accent\n}\n\n// ── Chevron SVG ─────────────────────────────────────────────────\n\nfunction ChevronDown({ className }: { className?: string }) {\n return (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" className={className} aria-hidden=\"true\">\n <path d=\"M3 4.5L6 7.5L9 4.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )\n}\n\n// ── Component ───────────────────────────────────────────────────\n\nconst SplitButton = React.forwardRef<HTMLDivElement, SplitButtonProps>(\n function SplitButton(\n {\n children,\n onClick,\n dropdownContent,\n open: openProp,\n onOpenChange,\n variant = 'solid',\n color = 'accent',\n size = 'md',\n disabled = false,\n 'aria-label': ariaLabel,\n dropdownLabel = 'More options',\n dropdownIcon,\n triggerSide = 'right',\n placement: placementProp = 'top-end',\n triggerWidth,\n className,\n },\n ref,\n ) {\n // Map the floating-ui `placement` (e.g. 'top-end') to Radix side + align.\n // Positioning, focus-in/return, outside-click, and Escape all come from the\n // Popover primitive now — no hand-rolled floating-ui / listeners.\n const [side, align] = React.useMemo(() => {\n const [s, a] = placementProp.split('-')\n return [\n s as 'top' | 'right' | 'bottom' | 'left',\n (a === 'start' ? 'start' : a === 'end' ? 'end' : 'center') as\n | 'start'\n | 'center'\n | 'end',\n ]\n }, [placementProp])\n\n const halfClasses = getHalfClasses(variant, color)\n const divider = dividerColor[variant][color] ?? dividerColor[variant].accent\n\n const triggerStyle = triggerWidth != null\n ? { width: typeof triggerWidth === 'number' ? `${triggerWidth}px` : triggerWidth }\n : undefined\n\n // Dropdown trigger (the chevron half). PopoverTrigger wires aria-haspopup /\n // aria-expanded / focus-return for us.\n const dropdownTrigger = (\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={dropdownLabel}\n className={cn(\n 'inline-flex items-center justify-center select-none',\n 'transition-colors duration-fast-01 ease-productive-standard',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset',\n 'disabled:pointer-events-none disabled:opacity-action-disabled',\n halfClasses,\n heightClass[size],\n triggerPadding[size],\n )}\n style={triggerStyle}\n >\n {dropdownIcon ?? <ChevronDown />}\n </button>\n </PopoverTrigger>\n )\n\n return (\n <Popover open={openProp} onOpenChange={onOpenChange}>\n {/* Button group */}\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel ?? undefined}\n className={cn('relative inline-flex', className)}\n >\n <div\n className={cn(\n 'inline-flex items-stretch overflow-hidden',\n radiusClass[size],\n variant === 'solid' && 'shadow-raised',\n variant === 'outline' && `border ${getOutlineBorderColor(color)}`,\n )}\n >\n {triggerSide === 'left' && (\n <>\n {dropdownTrigger}\n <div className={cn('w-px self-stretch', divider)} />\n </>\n )}\n\n {/* Primary action */}\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n aria-label={ariaLabel}\n className={cn(\n 'inline-flex items-center justify-center font-semibold select-none whitespace-nowrap',\n 'transition-[colors,transform] duration-fast-01 ease-productive-standard',\n 'active:scale-[0.97]',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset',\n 'disabled:pointer-events-none disabled:opacity-action-disabled',\n halfClasses,\n heightClass[size],\n textClass[size],\n primaryPadding[size],\n )}\n >\n {children}\n </button>\n\n {triggerSide === 'right' && (\n <>\n <div className={cn('w-px self-stretch', divider)} />\n {dropdownTrigger}\n </>\n )}\n </div>\n </div>\n\n {/* Dropdown panel — Popover handles focus, Escape, outside-click, return */}\n {dropdownContent && (\n <PopoverContent\n side={side}\n align={align}\n sideOffset={8}\n className=\"w-auto min-w-[10rem] p-ds-01\"\n >\n {dropdownContent}\n </PopoverContent>\n )}\n </Popover>\n )\n },\n)\n\nSplitButton.displayName = 'SplitButton'\n\nexport { SplitButton }\nexport type { SplitButtonColor, SplitButtonSize,SplitButtonVariant }\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"split-button.js","names":[],"sources":["../../src/ui/split-button.tsx"],"sourcesContent":["'use client'\n\nimport { type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { buttonVariants } from './button'\nimport { cn } from './lib/utils'\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\n\n// ── Types ───────────────────────────────────────────────────────\n\n/**\n * Placement of the dropdown panel, in floating-ui's vocabulary.\n *\n * Declared here rather than imported from `@floating-ui/dom`: that package is\n * bundled into dist at runtime but is NOT a consumer dependency, so a type\n * import leaks an unresolvable specifier into the published .d.ts —\n * `error TS2307: Cannot find module '@floating-ui/dom'` for anyone type-checking\n * declarations. The union is stable and two lines; borrowing it is not worth an\n * install. (This component no longer calls floating-ui at all — see the Radix\n * Popover mapping below.)\n */\nexport type SplitButtonPlacement =\n | 'top' | 'right' | 'bottom' | 'left'\n | 'top-start' | 'top-end'\n | 'right-start' | 'right-end'\n | 'bottom-start' | 'bottom-end'\n | 'left-start' | 'left-end'\n\ntype SplitButtonVariant = 'solid' | 'soft' | 'outline'\ntype SplitButtonColor = NonNullable<VariantProps<typeof buttonVariants>['color']>\ntype SplitButtonSize = 'xs' | 'sm' | 'md' | 'icon-xs' | 'icon-sm' | 'icon-md'\n\nexport interface SplitButtonProps {\n /** Primary action content (left side). */\n children: React.ReactNode\n /** Primary click handler (left side). */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void\n /** Content rendered inside the floating dropdown panel. */\n dropdownContent?: React.ReactNode\n /** Controlled open state. */\n open?: boolean\n /** Called when open state changes. Uncontrolled if omitted. */\n onOpenChange?: (open: boolean) => void\n /** @default 'solid' */\n variant?: SplitButtonVariant\n /**\n * Palette name. The six built-ins are unchanged; any palette registered in\n * CSS (`[data-palette='…']`) now works too. Widened from a closed union, so\n * every existing value still type-checks.\n *\n * @default 'accent'\n */\n color?: SplitButtonColor | (string & {})\n /** @default 'md' */\n size?: SplitButtonSize\n /** Disable both halves. */\n disabled?: boolean\n /** aria-label for the primary button. */\n 'aria-label'?: string\n /** aria-label for the dropdown trigger. @default 'More options' */\n dropdownLabel?: string\n /** Custom icon for the dropdown trigger. Defaults to chevron-down. */\n dropdownIcon?: React.ReactNode\n /** Which side the dropdown trigger sits on. @default 'right' */\n triggerSide?: 'left' | 'right'\n /** Preferred placement for the dropdown panel. @default 'top-end' */\n placement?: SplitButtonPlacement\n /** Width of the trigger (chevron) half. @default 'auto' */\n triggerWidth?: number | string\n className?: string\n}\n\n// ── Styling maps ────────────────────────────────────────────────\n\n// The hairline between the two halves. One line per variant instead of one\n// per variant × colour — the hue arrives via `data-palette` on the group.\nconst dividerColor: Record<SplitButtonVariant, string> = {\n solid: 'bg-palette-solid-active/20',\n soft: 'bg-palette-border-subtle',\n outline: 'bg-palette-border',\n}\n\n// `neutral` diverges from the roles here, and both cases predate this work:\n// its solid divider is 30% rather than 20% (a flat grey needs more presence\n// than a saturated one to read at 1px), and its soft divider sits on\n// `surface-border` rather than the subtle tier the role resolves to.\nconst neutralDivider: Partial<Record<SplitButtonVariant, string>> = {\n solid: 'bg-neutral-8/30',\n soft: 'bg-surface-border',\n}\n\nconst heightClass: Record<SplitButtonSize, string> = {\n xs: 'h-ds-xs-plus', sm: 'h-ds-sm', md: 'h-ds-md',\n 'icon-xs': 'h-ds-xs-plus', 'icon-sm': 'h-ds-sm', 'icon-md': 'h-ds-md',\n}\n\nconst textClass: Record<SplitButtonSize, string> = {\n xs: 'text-body-sm', sm: 'text-body-sm', md: 'text-body-md',\n 'icon-xs': 'text-body-sm', 'icon-sm': 'text-body-sm', 'icon-md': 'text-body-md',\n}\n\nconst primaryPadding: Record<SplitButtonSize, string> = {\n xs: 'px-ds-03 gap-1', sm: 'px-ds-04 gap-1.5', md: 'px-ds-05 gap-2',\n 'icon-xs': 'px-ds-02', 'icon-sm': 'px-ds-03', 'icon-md': 'px-ds-04',\n}\n\nconst triggerPadding: Record<SplitButtonSize, string> = {\n xs: 'px-ds-02', sm: 'px-ds-02', md: 'px-ds-03',\n 'icon-xs': 'px-ds-01', 'icon-sm': 'px-ds-02', 'icon-md': 'px-ds-02',\n}\n\nconst radiusClass: Record<SplitButtonSize, string> = {\n xs: 'rounded-control', sm: 'rounded-control', md: 'rounded-control',\n 'icon-xs': 'rounded-control', 'icon-sm': 'rounded-control', 'icon-md': 'rounded-control',\n}\n\n// Three lines, not eighteen. Colour comes from `data-palette`.\nconst halfClasses: Record<SplitButtonVariant, string> = {\n solid:\n 'bg-palette-solid text-palette-fg hover:bg-palette-solid-hover active:bg-palette-solid-active',\n soft: 'bg-palette-soft text-palette-text hover:bg-palette-soft-hover active:bg-palette-soft-active',\n outline:\n 'bg-transparent text-palette-text hover:bg-palette-soft active:bg-palette-soft-hover',\n}\n\nfunction getHalfClasses(variant: SplitButtonVariant, color: string): string {\n // Same exception Button carries: on neutral, an outlined control's label\n // wants full contrast rather than the muted text role.\n const neutralOutline = variant === 'outline' && color === 'neutral' ? ' text-surface-fg' : ''\n return halfClasses[variant] + neutralOutline\n}\n\nfunction getOutlineBorderColor(color: string): string {\n // An outlined control's edge owes WCAG 1.4.11, so neutral takes the\n // interactive border tier rather than the decorative one the role resolves\n // to. The chromatic palettes already satisfy it from their own ramp.\n return color === 'neutral' ? 'border-surface-border-interactive' : 'border-palette-border'\n}\n\n// ── Chevron SVG ─────────────────────────────────────────────────\n\nfunction ChevronDown({ className }: { className?: string }) {\n return (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" className={className} aria-hidden=\"true\">\n <path d=\"M3 4.5L6 7.5L9 4.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )\n}\n\n// ── Component ───────────────────────────────────────────────────\n\nconst SplitButton = React.forwardRef<HTMLDivElement, SplitButtonProps>(\n function SplitButton(\n {\n children,\n onClick,\n dropdownContent,\n open: openProp,\n onOpenChange,\n variant = 'solid',\n color = 'accent',\n size = 'md',\n disabled = false,\n 'aria-label': ariaLabel,\n dropdownLabel = 'More options',\n dropdownIcon,\n triggerSide = 'right',\n placement: placementProp = 'top-end',\n triggerWidth,\n className,\n },\n ref,\n ) {\n // Map the floating-ui `placement` (e.g. 'top-end') to Radix side + align.\n // Positioning, focus-in/return, outside-click, and Escape all come from the\n // Popover primitive now — no hand-rolled floating-ui / listeners.\n const [side, align] = React.useMemo(() => {\n const [s, a] = placementProp.split('-')\n return [\n s as 'top' | 'right' | 'bottom' | 'left',\n (a === 'start' ? 'start' : a === 'end' ? 'end' : 'center') as\n | 'start'\n | 'center'\n | 'end',\n ]\n }, [placementProp])\n\n const halfClassNames = getHalfClasses(variant, color)\n const divider =\n (color === 'neutral' ? neutralDivider[variant] : undefined) ?? dividerColor[variant]\n\n const triggerStyle = triggerWidth != null\n ? { width: typeof triggerWidth === 'number' ? `${triggerWidth}px` : triggerWidth }\n : undefined\n\n // Dropdown trigger (the chevron half). PopoverTrigger wires aria-haspopup /\n // aria-expanded / focus-return for us.\n const dropdownTrigger = (\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={dropdownLabel}\n className={cn(\n 'inline-flex items-center justify-center select-none',\n 'transition-colors duration-fast-01 ease-productive-standard',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset',\n 'disabled:pointer-events-none disabled:opacity-action-disabled',\n halfClassNames,\n heightClass[size],\n triggerPadding[size],\n )}\n style={triggerStyle}\n >\n {dropdownIcon ?? <ChevronDown />}\n </button>\n </PopoverTrigger>\n )\n\n return (\n <Popover open={openProp} onOpenChange={onOpenChange}>\n {/* Button group */}\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel ?? undefined}\n // One palette for the whole group: both halves and the hairline\n // between them inherit it, so they can never disagree.\n data-palette={color}\n className={cn('relative inline-flex', className)}\n >\n <div\n className={cn(\n 'inline-flex items-stretch overflow-hidden',\n radiusClass[size],\n variant === 'solid' && 'shadow-raised',\n variant === 'outline' && `border ${getOutlineBorderColor(color)}`,\n )}\n >\n {triggerSide === 'left' && (\n <>\n {dropdownTrigger}\n <div className={cn('w-px self-stretch', divider)} />\n </>\n )}\n\n {/* Primary action */}\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n aria-label={ariaLabel}\n className={cn(\n 'inline-flex items-center justify-center font-semibold select-none whitespace-nowrap',\n 'transition-[colors,transform] duration-fast-01 ease-productive-standard',\n 'active:scale-[0.97]',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-inset',\n 'disabled:pointer-events-none disabled:opacity-action-disabled',\n halfClassNames,\n heightClass[size],\n textClass[size],\n primaryPadding[size],\n )}\n >\n {children}\n </button>\n\n {triggerSide === 'right' && (\n <>\n <div className={cn('w-px self-stretch', divider)} />\n {dropdownTrigger}\n </>\n )}\n </div>\n </div>\n\n {/* Dropdown panel — Popover handles focus, Escape, outside-click, return */}\n {dropdownContent && (\n <PopoverContent\n side={side}\n align={align}\n sideOffset={8}\n className=\"w-auto min-w-[10rem] p-ds-01\"\n >\n {dropdownContent}\n </PopoverContent>\n )}\n </Popover>\n )\n },\n)\n\nSplitButton.displayName = 'SplitButton'\n\nexport { SplitButton }\nexport type { SplitButtonColor, SplitButtonSize,SplitButtonVariant }\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-card.d.ts","sourceRoot":"","sources":["../../src/ui/stat-card.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"stat-card.d.ts","sourceRoot":"","sources":["../../src/ui/stat-card.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAOjD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAY,MAAM,cAAc,CAAA;AAE1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IACxF,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAA;QACb,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAA;KACrC,CAAA;IACD,kJAAkJ;IAClJ,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IACnC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,0KAA0K;IAC1K,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAA;IACrD;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,yJAAyJ;IACzJ,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IACtC,6HAA6H;IAC7H,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3B;;;;OAIG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,iFAAiF;IACjF,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACzB;AAgGD,QAAA,MAAM,QAAQ,sFA0Qb,CAAA;AAID,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
package/dist/ui/stat-card.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { springs as e, tweens as t } from "./lib/motion.js";
|
|
3
|
+
import { MotionPreference as n } from "../_chunks/motion-preference.js";
|
|
4
|
+
import { IconProvider as r } from "./icon-context.js";
|
|
5
|
+
import { cn as i } from "./lib/utils.js";
|
|
6
|
+
import { Icon as a } from "./icon.js";
|
|
7
|
+
import { Skeleton as o } from "./skeleton.js";
|
|
8
|
+
import { normalizeIcon as s } from "../_chunks/normalize-icon.js";
|
|
9
|
+
import { Card as c, CardContent as l, CardFooter as ee } from "./card.js";
|
|
9
10
|
import { Progress as u } from "./progress.js";
|
|
10
11
|
import { useLink as d } from "../_chunks/link-context.js";
|
|
11
12
|
import { StatFlash as f } from "./stat-flash.js";
|
|
12
13
|
import * as p from "react";
|
|
13
14
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
14
|
-
import { IconMinus as
|
|
15
|
-
import { motion as
|
|
15
|
+
import { IconMinus as te, IconTrendingDown as _, IconTrendingUp as v } from "@tabler/icons-react";
|
|
16
|
+
import { motion as y } from "framer-motion";
|
|
16
17
|
//#region src/ui/stat-card.tsx
|
|
17
|
-
function
|
|
18
|
+
function b(e, t, n) {
|
|
18
19
|
let r = e.filter((e) => Number.isFinite(e));
|
|
19
20
|
if (r.length < 2) return "";
|
|
20
21
|
let i = Math.min(...r), a = Math.max(...r) - i || 1, o = t / (r.length - 1);
|
|
@@ -23,14 +24,14 @@ function y(e, t, n) {
|
|
|
23
24
|
return `${t === 0 ? "M" : "L"}${r.toFixed(1)},${s.toFixed(1)}`;
|
|
24
25
|
}).join(" ");
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
let n = p.useId(),
|
|
27
|
+
function x({ data: e, colorClass: t }) {
|
|
28
|
+
let n = p.useId(), r = p.useRef(null), [a, o] = p.useState(0), s = b(e, 80, 32);
|
|
28
29
|
if (p.useEffect(() => {
|
|
29
|
-
|
|
30
|
+
r.current && o(r.current.getTotalLength());
|
|
30
31
|
}, [s]), !s) return null;
|
|
31
32
|
let c = `${s} L${80 .toFixed(1)},${32 .toFixed(1)} L0,${32 .toFixed(1)} Z`;
|
|
32
33
|
return /* @__PURE__ */ g("div", {
|
|
33
|
-
className:
|
|
34
|
+
className: i("w-20 h-8", t),
|
|
34
35
|
"aria-hidden": "true",
|
|
35
36
|
children: [/* @__PURE__ */ g("svg", {
|
|
36
37
|
viewBox: "0 0 80 32",
|
|
@@ -58,7 +59,7 @@ function b({ data: e, colorClass: t }) {
|
|
|
58
59
|
fill: `url(#sparkline-fill-${n})`
|
|
59
60
|
}),
|
|
60
61
|
/* @__PURE__ */ h("path", {
|
|
61
|
-
ref:
|
|
62
|
+
ref: r,
|
|
62
63
|
d: s,
|
|
63
64
|
fill: "none",
|
|
64
65
|
stroke: "currentColor",
|
|
@@ -76,7 +77,7 @@ function b({ data: e, colorClass: t }) {
|
|
|
76
77
|
}), a > 0 && /* @__PURE__ */ h("style", { children: `@keyframes sparkline-draw-${n.replace(/:/g, "")} { to { stroke-dashoffset: 0; } }` })]
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
+
function S({ progress: e, label: t }) {
|
|
80
81
|
let n = Math.max(0, Math.min(100, e)), r = n >= 90 ? "success" : n >= 70 ? "warning" : "accent";
|
|
81
82
|
return /* @__PURE__ */ h(u.Root, {
|
|
82
83
|
value: n,
|
|
@@ -87,26 +88,26 @@ function x({ progress: e, label: t }) {
|
|
|
87
88
|
})
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
|
-
var
|
|
91
|
-
let W = d(), G =
|
|
92
|
-
if (
|
|
91
|
+
var C = p.forwardRef(({ className: u, label: p, title: b, value: C, prefix: w, suffix: T, delta: E, deltaPlacement: D = "block", icon: O, loading: k, comparisonLabel: A, secondaryLabel: j, progress: M, variant: N = "default", size: P = "md", accentStyle: F = "none", reveal: ne = !1, iconFill: I = "soft", flash: L, flashSpeed: re, sparkline: R, onClick: z, href: B, footer: V, ...H }, U) => {
|
|
92
|
+
let W = d(), G = b ?? p ?? "", K = (z || B) && !H["aria-label"] ? `View ${G}` : H["aria-label"];
|
|
93
|
+
if (k) return /* @__PURE__ */ h(c, {
|
|
93
94
|
ref: U,
|
|
94
|
-
variant:
|
|
95
|
-
size:
|
|
95
|
+
variant: N,
|
|
96
|
+
size: P,
|
|
96
97
|
className: u,
|
|
97
98
|
"aria-busy": "true",
|
|
98
99
|
...H,
|
|
99
|
-
children: /* @__PURE__ */ g(
|
|
100
|
+
children: /* @__PURE__ */ g(l, {
|
|
100
101
|
className: "flex flex-col gap-ds-03",
|
|
101
102
|
children: [
|
|
102
|
-
/* @__PURE__ */ h(
|
|
103
|
-
/* @__PURE__ */ h(
|
|
104
|
-
/* @__PURE__ */ h(
|
|
103
|
+
/* @__PURE__ */ h(o, { className: "h-ds-04 w-24 rounded-control-inner" }),
|
|
104
|
+
/* @__PURE__ */ h(o, { className: "h-ds-sm w-32" }),
|
|
105
|
+
/* @__PURE__ */ h(o, { className: "h-3 w-16 rounded-control-inner" })
|
|
105
106
|
]
|
|
106
107
|
})
|
|
107
108
|
});
|
|
108
|
-
let q =
|
|
109
|
-
className:
|
|
109
|
+
let q = E?.direction === "up" ? v : E?.direction === "down" ? _ : te, J = E?.direction === "up" ? "text-success-11" : E?.direction === "down" ? "text-error-11" : "text-surface-fg-muted", Y = E?.direction === "up" ? "text-success-11" : E?.direction === "down" ? "text-error-11" : "text-accent-11", X = E ? /* @__PURE__ */ g(y.div, {
|
|
110
|
+
className: i("flex items-center gap-ds-02 text-body-sm font-medium", J),
|
|
110
111
|
initial: {
|
|
111
112
|
opacity: 0,
|
|
112
113
|
y: 8
|
|
@@ -116,11 +117,11 @@ var S = p.forwardRef(({ className: u, label: p, title: y, value: S, prefix: C, s
|
|
|
116
117
|
y: 0
|
|
117
118
|
},
|
|
118
119
|
transition: {
|
|
119
|
-
...
|
|
120
|
+
...e.smooth,
|
|
120
121
|
delay: .2
|
|
121
122
|
},
|
|
122
123
|
children: [
|
|
123
|
-
/* @__PURE__ */ h(
|
|
124
|
+
/* @__PURE__ */ h(y.span, {
|
|
124
125
|
className: "inline-flex",
|
|
125
126
|
initial: {
|
|
126
127
|
opacity: .5,
|
|
@@ -130,54 +131,54 @@ var S = p.forwardRef(({ className: u, label: p, title: y, value: S, prefix: C, s
|
|
|
130
131
|
opacity: 1,
|
|
131
132
|
scale: 1
|
|
132
133
|
},
|
|
133
|
-
transition:
|
|
134
|
-
children: /* @__PURE__ */ h(
|
|
134
|
+
transition: e.smooth,
|
|
135
|
+
children: /* @__PURE__ */ h(a, {
|
|
135
136
|
icon: q,
|
|
136
137
|
size: "sm"
|
|
137
138
|
})
|
|
138
139
|
}),
|
|
139
|
-
/* @__PURE__ */ h("span", { children:
|
|
140
|
-
|
|
140
|
+
/* @__PURE__ */ h("span", { children: E.value }),
|
|
141
|
+
A && /* @__PURE__ */ h("span", {
|
|
141
142
|
className: "text-surface-fg-subtle font-normal",
|
|
142
|
-
children:
|
|
143
|
+
children: A
|
|
143
144
|
})
|
|
144
145
|
]
|
|
145
|
-
}) : null, Z =
|
|
146
|
+
}) : null, Z = ne ? {
|
|
146
147
|
initial: { y: 8 },
|
|
147
148
|
animate: { y: 0 },
|
|
148
|
-
transition:
|
|
149
|
-
} : { initial: !1 },
|
|
149
|
+
transition: e.smooth
|
|
150
|
+
} : { initial: !1 }, ie = /* @__PURE__ */ g(m, { children: [
|
|
150
151
|
/* @__PURE__ */ g("div", {
|
|
151
152
|
className: "flex items-center justify-between",
|
|
152
|
-
children: [/* @__PURE__ */ h(
|
|
153
|
+
children: [/* @__PURE__ */ h(y.p, {
|
|
153
154
|
className: "text-body-md font-medium text-surface-fg-muted",
|
|
154
155
|
...Z,
|
|
155
156
|
children: G
|
|
156
157
|
}), /* @__PURE__ */ g("div", {
|
|
157
158
|
className: "flex items-center gap-ds-03",
|
|
158
|
-
children: [R && R.length >= 2 && /* @__PURE__ */ h(
|
|
159
|
+
children: [R && R.length >= 2 && /* @__PURE__ */ h(x, {
|
|
159
160
|
data: R,
|
|
160
161
|
colorClass: Y
|
|
161
|
-
}),
|
|
162
|
-
icon:
|
|
163
|
-
flash:
|
|
164
|
-
fill:
|
|
165
|
-
speed:
|
|
166
|
-
}) :
|
|
167
|
-
className:
|
|
162
|
+
}), O && L ? /* @__PURE__ */ h(f, {
|
|
163
|
+
icon: O,
|
|
164
|
+
flash: L,
|
|
165
|
+
fill: I,
|
|
166
|
+
speed: re
|
|
167
|
+
}) : O ? F === "icon" ? /* @__PURE__ */ h(y.span, {
|
|
168
|
+
className: i("inline-flex items-center justify-center rounded-control p-ds-02", I === "solid" ? "bg-accent-9 text-accent-fg" : "bg-accent-3 text-accent-11"),
|
|
168
169
|
...Z,
|
|
169
170
|
"aria-hidden": "true",
|
|
170
|
-
children: /* @__PURE__ */ h(
|
|
171
|
+
children: /* @__PURE__ */ h(r, {
|
|
171
172
|
size: "md",
|
|
172
|
-
children:
|
|
173
|
+
children: s(O, "md")
|
|
173
174
|
})
|
|
174
|
-
}) : /* @__PURE__ */ h(
|
|
175
|
+
}) : /* @__PURE__ */ h(y.span, {
|
|
175
176
|
className: "text-surface-fg-muted",
|
|
176
177
|
...Z,
|
|
177
178
|
"aria-hidden": "true",
|
|
178
|
-
children: /* @__PURE__ */ h(
|
|
179
|
+
children: /* @__PURE__ */ h(r, {
|
|
179
180
|
size: "lg",
|
|
180
|
-
children:
|
|
181
|
+
children: s(O, "lg")
|
|
181
182
|
})
|
|
182
183
|
}) : null]
|
|
183
184
|
})]
|
|
@@ -185,81 +186,81 @@ var S = p.forwardRef(({ className: u, label: p, title: y, value: S, prefix: C, s
|
|
|
185
186
|
/* @__PURE__ */ g("div", {
|
|
186
187
|
className: "flex flex-col gap-ds-01",
|
|
187
188
|
children: [/* @__PURE__ */ g("div", {
|
|
188
|
-
className:
|
|
189
|
+
className: i(D === "inline" && E && "flex items-baseline gap-ds-03"),
|
|
189
190
|
children: [/* @__PURE__ */ h("div", {
|
|
190
191
|
className: "overflow-hidden",
|
|
191
|
-
children: /* @__PURE__ */ g(
|
|
192
|
-
className:
|
|
192
|
+
children: /* @__PURE__ */ g(y.p, {
|
|
193
|
+
className: i("inline-block font-semibold", P === "sm" ? "text-heading-md" : "text-heading-lg", F === "tint" ? "text-accent-11" : "text-surface-fg"),
|
|
193
194
|
...Z,
|
|
194
195
|
children: [
|
|
195
|
-
|
|
196
|
-
className:
|
|
197
|
-
children:
|
|
196
|
+
w && /* @__PURE__ */ h("span", {
|
|
197
|
+
className: i("text-surface-fg-muted", P === "sm" ? "text-body-md" : "text-heading-xs"),
|
|
198
|
+
children: w
|
|
198
199
|
}),
|
|
199
200
|
/* @__PURE__ */ h("span", {
|
|
200
201
|
className: "tabular-nums",
|
|
201
|
-
children:
|
|
202
|
+
children: C
|
|
202
203
|
}),
|
|
203
|
-
|
|
204
|
-
className:
|
|
205
|
-
children:
|
|
204
|
+
T && /* @__PURE__ */ h("span", {
|
|
205
|
+
className: i("text-surface-fg-muted", P === "sm" ? "text-body-md" : "text-heading-xs"),
|
|
206
|
+
children: T
|
|
206
207
|
})
|
|
207
208
|
]
|
|
208
209
|
})
|
|
209
|
-
}),
|
|
210
|
-
}),
|
|
210
|
+
}), D === "inline" && X]
|
|
211
|
+
}), j && /* @__PURE__ */ h(y.p, {
|
|
211
212
|
className: "text-body-sm text-surface-fg-subtle",
|
|
212
213
|
...Z,
|
|
213
|
-
children:
|
|
214
|
+
children: j
|
|
214
215
|
})]
|
|
215
216
|
}),
|
|
216
|
-
|
|
217
|
+
M != null && /* @__PURE__ */ h(y.div, {
|
|
217
218
|
...Z,
|
|
218
|
-
children: /* @__PURE__ */ h(
|
|
219
|
-
progress:
|
|
219
|
+
children: /* @__PURE__ */ h(S, {
|
|
220
|
+
progress: M,
|
|
220
221
|
label: G
|
|
221
222
|
})
|
|
222
223
|
}),
|
|
223
|
-
|
|
224
|
-
] }), Q =
|
|
224
|
+
D === "block" && X
|
|
225
|
+
] }), Q = F === "tint" ? "bg-linear-to-t from-accent-2 to-surface-panel" : void 0, $ = /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(l, {
|
|
225
226
|
className: "flex flex-col gap-ds-03",
|
|
226
|
-
children:
|
|
227
|
+
children: ie
|
|
227
228
|
}), V && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
|
|
228
229
|
"aria-hidden": "true",
|
|
229
230
|
className: "h-px w-full bg-surface-border-subtle"
|
|
230
|
-
}), /* @__PURE__ */ h(
|
|
231
|
+
}), /* @__PURE__ */ h(ee, {
|
|
231
232
|
className: "text-body-sm",
|
|
232
|
-
children: /* @__PURE__ */ h(
|
|
233
|
+
children: /* @__PURE__ */ h(y.div, {
|
|
233
234
|
className: "w-full",
|
|
234
235
|
initial: !1,
|
|
235
236
|
animate: { opacity: 1 },
|
|
236
237
|
transition: {
|
|
237
|
-
...
|
|
238
|
+
...t.fade,
|
|
238
239
|
delay: .25
|
|
239
240
|
},
|
|
240
241
|
children: V
|
|
241
242
|
})
|
|
242
243
|
})] })] });
|
|
243
|
-
return B ? /* @__PURE__ */ h(W, {
|
|
244
|
+
return B ? /* @__PURE__ */ h(n, { children: /* @__PURE__ */ h(W, {
|
|
244
245
|
ref: U,
|
|
245
246
|
href: B,
|
|
246
247
|
onClick: z,
|
|
247
248
|
className: "block no-underline",
|
|
248
249
|
"aria-label": K,
|
|
249
250
|
...H,
|
|
250
|
-
children: /* @__PURE__ */ h(
|
|
251
|
-
variant:
|
|
252
|
-
size:
|
|
251
|
+
children: /* @__PURE__ */ h(c, {
|
|
252
|
+
variant: N,
|
|
253
|
+
size: P,
|
|
253
254
|
interactive: !0,
|
|
254
255
|
className: Q,
|
|
255
256
|
children: $
|
|
256
257
|
})
|
|
257
|
-
}) : z ? /* @__PURE__ */ h(
|
|
258
|
+
}) }) : z ? /* @__PURE__ */ h(n, { children: /* @__PURE__ */ h(c, {
|
|
258
259
|
ref: U,
|
|
259
|
-
variant:
|
|
260
|
-
size:
|
|
260
|
+
variant: N,
|
|
261
|
+
size: P,
|
|
261
262
|
interactive: !0,
|
|
262
|
-
className:
|
|
263
|
+
className: i(Q, u),
|
|
263
264
|
role: "button",
|
|
264
265
|
tabIndex: 0,
|
|
265
266
|
"aria-label": K,
|
|
@@ -269,15 +270,15 @@ var S = p.forwardRef(({ className: u, label: p, title: y, value: S, prefix: C, s
|
|
|
269
270
|
},
|
|
270
271
|
...H,
|
|
271
272
|
children: $
|
|
272
|
-
}) : /* @__PURE__ */ h(
|
|
273
|
+
}) }) : /* @__PURE__ */ h(n, { children: /* @__PURE__ */ h(c, {
|
|
273
274
|
ref: U,
|
|
274
|
-
variant:
|
|
275
|
-
size:
|
|
276
|
-
className:
|
|
275
|
+
variant: N,
|
|
276
|
+
size: P,
|
|
277
|
+
className: i(Q, u),
|
|
277
278
|
...H,
|
|
278
279
|
children: $
|
|
279
|
-
});
|
|
280
|
+
}) });
|
|
280
281
|
});
|
|
281
|
-
|
|
282
|
+
C.displayName = "StatCard";
|
|
282
283
|
//#endregion
|
|
283
|
-
export {
|
|
284
|
+
export { C as StatCard };
|