@epilot/spark-ui 0.20.2 → 0.20.3
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/dist/components/accordion.cjs +5 -5
- package/dist/components/accordion.cjs.map +1 -1
- package/dist/components/alert-dialog.cjs +9 -9
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/attachment.cjs +10 -10
- package/dist/components/attachment.cjs.map +1 -1
- package/dist/components/autocomplete.cjs +12 -12
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/avatar.cjs +2 -2
- package/dist/components/avatar.cjs.map +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.cjs +2 -2
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.js +2 -2
- package/dist/components/badge.js.map +1 -1
- package/dist/components/bar-chart.cjs +4 -4
- package/dist/components/bar-chart.cjs.map +1 -1
- package/dist/components/bar-chart.js +2 -2
- package/dist/components/bar-chart.js.map +1 -1
- package/dist/components/box.cjs +2 -2
- package/dist/components/box.cjs.map +1 -1
- package/dist/components/box.js +1 -1
- package/dist/components/breadcrumbs.cjs +7 -7
- package/dist/components/breadcrumbs.cjs.map +1 -1
- package/dist/components/bubble.cjs +5 -5
- package/dist/components/bubble.cjs.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button-group.cjs +5 -5
- package/dist/components/button-group.cjs.map +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.cjs +2 -2
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +10 -11
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +3 -4
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/callout.cjs +7 -7
- package/dist/components/callout.cjs.map +1 -1
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/card.cjs +16 -16
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.js +2 -2
- package/dist/components/card.js.map +1 -1
- package/dist/components/chart.cjs +2 -2
- package/dist/components/chart.cjs.map +1 -1
- package/dist/components/checkbox.cjs +2 -2
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/circular-gauge.cjs +3 -3
- package/dist/components/circular-gauge.cjs.map +1 -1
- package/dist/components/circular-gauge.js +1 -1
- package/dist/components/circular-gauge.js.map +1 -1
- package/dist/components/day-of-week-picker.cjs +4 -4
- package/dist/components/day-of-week-picker.cjs.map +1 -1
- package/dist/components/dialog.cjs +8 -8
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/donut-chart.cjs.map +1 -1
- package/dist/components/donut-chart.js.map +1 -1
- package/dist/components/drawer.cjs +8 -8
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/drawer.js +2 -2
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +10 -10
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/energy-breakdown.cjs +1 -1
- package/dist/components/energy-breakdown.cjs.map +1 -1
- package/dist/components/energy-breakdown.js +1 -1
- package/dist/components/energy-breakdown.js.map +1 -1
- package/dist/components/entity-card.cjs +11 -11
- package/dist/components/entity-card.cjs.map +1 -1
- package/dist/components/field.cjs +16 -16
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/hero-metric.cjs +4 -4
- package/dist/components/hero-metric.cjs.map +1 -1
- package/dist/components/icon.cjs +6 -6
- package/dist/components/icon.cjs.map +1 -1
- package/dist/components/icon.js +5 -5
- package/dist/components/icon.js.map +1 -1
- package/dist/components/info-block.cjs +9 -9
- package/dist/components/info-block.cjs.map +1 -1
- package/dist/components/input-date.cjs +3 -4
- package/dist/components/input-date.cjs.map +1 -1
- package/dist/components/input-date.d.cts +1 -3
- package/dist/components/input-date.d.ts +1 -3
- package/dist/components/input-date.js +1 -2
- package/dist/components/input-date.js.map +1 -1
- package/dist/components/input-group.cjs +5 -5
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-otp.cjs +2 -2
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input.cjs +2 -2
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/label.cjs +2 -2
- package/dist/components/label.cjs.map +1 -1
- package/dist/components/layout.cjs +2 -2
- package/dist/components/layout.cjs.map +1 -1
- package/dist/components/line-chart.cjs +7 -7
- package/dist/components/line-chart.cjs.map +1 -1
- package/dist/components/line-chart.js +5 -5
- package/dist/components/line-chart.js.map +1 -1
- package/dist/components/list.cjs +11 -11
- package/dist/components/list.cjs.map +1 -1
- package/dist/components/list.d.cts +2 -7
- package/dist/components/list.d.ts +2 -7
- package/dist/components/list.js +2 -2
- package/dist/components/list.js.map +1 -1
- package/dist/components/marker.cjs +4 -4
- package/dist/components/marker.cjs.map +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/message-scroller.cjs +6 -6
- package/dist/components/message-scroller.cjs.map +1 -1
- package/dist/components/message-scroller.js +2 -2
- package/dist/components/message-scroller.js.map +1 -1
- package/dist/components/message.cjs +7 -7
- package/dist/components/message.cjs.map +1 -1
- package/dist/components/page-header.cjs +5 -5
- package/dist/components/page-header.cjs.map +1 -1
- package/dist/components/period-tabs.cjs +6 -6
- package/dist/components/period-tabs.cjs.map +1 -1
- package/dist/components/pill.cjs +3 -3
- package/dist/components/pill.cjs.map +1 -1
- package/dist/components/pill.js +3 -3
- package/dist/components/pill.js.map +1 -1
- package/dist/components/popover.cjs +2 -2
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/power-history-chart.cjs +4 -4
- package/dist/components/power-history-chart.cjs.map +1 -1
- package/dist/components/power-history-chart.js +3 -3
- package/dist/components/power-history-chart.js.map +1 -1
- package/dist/components/power-network.cjs +9 -9
- package/dist/components/power-network.cjs.map +1 -1
- package/dist/components/power-network.js +1 -1
- package/dist/components/progress.cjs +3 -3
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-card-group.cjs +3 -3
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio.cjs +3 -3
- package/dist/components/radio.cjs.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/sankey-chart.cjs +4 -4
- package/dist/components/sankey-chart.cjs.map +1 -1
- package/dist/components/sankey-chart.js +2 -2
- package/dist/components/sankey-chart.js.map +1 -1
- package/dist/components/schedule-editor.cjs +9 -9
- package/dist/components/schedule-editor.cjs.map +1 -1
- package/dist/components/schedule-list.cjs +10 -10
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/scroll-area.cjs +3 -3
- package/dist/components/scroll-area.cjs.map +1 -1
- package/dist/components/segmented-control.cjs +8 -8
- package/dist/components/segmented-control.cjs.map +1 -1
- package/dist/components/segmented-control.d.cts +16 -2
- package/dist/components/segmented-control.d.ts +16 -2
- package/dist/components/segmented-control.js +5 -5
- package/dist/components/segmented-control.js.map +1 -1
- package/dist/components/select.cjs +11 -11
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/separator.cjs +3 -3
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/series-legend.cjs +4 -4
- package/dist/components/series-legend.cjs.map +1 -1
- package/dist/components/sheet.cjs +8 -8
- package/dist/components/sheet.cjs.map +1 -1
- package/dist/components/skeleton.cjs +3 -3
- package/dist/components/skeleton.cjs.map +1 -1
- package/dist/components/slider.cjs +11 -11
- package/dist/components/slider.cjs.map +1 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/solar-forecast-chart.cjs +2 -2
- package/dist/components/solar-forecast-chart.cjs.map +1 -1
- package/dist/components/solar-forecast-chart.js +1 -1
- package/dist/components/sortable-list.cjs +3 -3
- package/dist/components/sortable-list.cjs.map +1 -1
- package/dist/components/spinner.cjs +2 -2
- package/dist/components/spinner.cjs.map +1 -1
- package/dist/components/stat-card.cjs +8 -8
- package/dist/components/stat-card.cjs.map +1 -1
- package/dist/components/stepper.cjs +2 -2
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/switch.cjs +3 -3
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.js +2 -2
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +8 -8
- package/dist/components/table.cjs.map +1 -1
- package/dist/components/tabs.cjs +9 -9
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +8 -1
- package/dist/components/tabs.d.ts +8 -1
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +2 -2
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/theme.cjs +2 -2
- package/dist/components/theme.cjs.map +1 -1
- package/dist/components/theme.js +1 -1
- package/dist/components/thumbnail.cjs +3 -3
- package/dist/components/thumbnail.cjs.map +1 -1
- package/dist/components/time-picker.cjs +3 -3
- package/dist/components/time-picker.cjs.map +1 -1
- package/dist/components/toast.cjs +14 -39
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.d.cts +2 -15
- package/dist/components/toast.d.ts +2 -15
- package/dist/components/toast.js +7 -32
- package/dist/components/toast.js.map +1 -1
- package/dist/components/tooltip.cjs +3 -3
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typography.cjs +6 -6
- package/dist/components/typography.cjs.map +1 -1
- package/dist/components/wizard-layout.cjs +8 -8
- package/dist/components/wizard-layout.cjs.map +1 -1
- package/dist/lib/generate-radix-colors.cjs +1 -1
- package/dist/lib/generate-radix-colors.cjs.map +1 -1
- package/dist/lib/generate-radix-colors.js +1 -1
- package/dist/lib/generate-radix-colors.js.map +1 -1
- package/dist/lib/input-box-variants.cjs +9 -9
- package/dist/lib/input-box-variants.cjs.map +1 -1
- package/dist/styles/spark-default.css +0 -11
- package/dist/utils/cn.cjs +2 -2
- package/dist/utils/cn.d.cts +1 -1
- package/dist/utils/cn.d.ts +1 -1
- package/dist/utils/cn.js +1 -1
- package/dist/utils/format.cjs +0 -1
- package/dist/utils/format.cjs.map +1 -1
- package/dist/utils/format.d.cts +1 -2
- package/dist/utils/format.d.ts +1 -2
- package/dist/utils/format.js +1 -1
- package/dist/utils/format.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/toggle-group.cjs +0 -40
- package/dist/components/toggle-group.cjs.map +0 -1
- package/dist/components/toggle-group.d.cts +0 -28
- package/dist/components/toggle-group.d.ts +0 -28
- package/dist/components/toggle-group.js +0 -37
- package/dist/components/toggle-group.js.map +0 -1
- package/dist/components/toggle.cjs +0 -69
- package/dist/components/toggle.cjs.map +0 -1
- package/dist/components/toggle.d.cts +0 -23
- package/dist/components/toggle.d.ts +0 -23
- package/dist/components/toggle.js +0 -66
- package/dist/components/toggle.js.map +0 -1
- package/dist/lib/toggle-group-context.cjs +0 -12
- package/dist/lib/toggle-group-context.cjs.map +0 -1
- package/dist/lib/toggle-group-context.d.cts +0 -17
- package/dist/lib/toggle-group-context.d.ts +0 -17
- package/dist/lib/toggle-group-context.js +0 -9
- package/dist/lib/toggle-group-context.js.map +0 -1
|
@@ -7,7 +7,7 @@ react = require_chunk.__toESM(react);
|
|
|
7
7
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let _base_ui_react_dialog = require("@base-ui/react/dialog");
|
|
10
|
-
let
|
|
10
|
+
let cnfast = require("cnfast");
|
|
11
11
|
//#region src/components/dialog.tsx
|
|
12
12
|
function isBackdropPress(event) {
|
|
13
13
|
const target = event?.target;
|
|
@@ -46,7 +46,7 @@ function DialogClose({ className, children, ...props }) {
|
|
|
46
46
|
});
|
|
47
47
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_dialog.Dialog.Close, {
|
|
48
48
|
"data-slot": "dialog-close",
|
|
49
|
-
className: (0,
|
|
49
|
+
className: (0, cnfast.cn)(require_components_button.buttonVariants({
|
|
50
50
|
size: "icon",
|
|
51
51
|
variant: "tertiary"
|
|
52
52
|
}), "absolute top-2.5 right-3 rounded-full", className),
|
|
@@ -57,7 +57,7 @@ function DialogClose({ className, children, ...props }) {
|
|
|
57
57
|
function DialogOverlay({ className, ...props }) {
|
|
58
58
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_dialog.Dialog.Backdrop, {
|
|
59
59
|
"data-slot": "dialog-overlay",
|
|
60
|
-
className: (0,
|
|
60
|
+
className: (0, cnfast.cn)("fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs motion-reduce:transition-none", className),
|
|
61
61
|
"data-overlay": "true",
|
|
62
62
|
...props
|
|
63
63
|
});
|
|
@@ -65,35 +65,35 @@ function DialogOverlay({ className, ...props }) {
|
|
|
65
65
|
function DialogContent({ className, ...props }) {
|
|
66
66
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_dialog.Dialog.Popup, {
|
|
67
67
|
"data-slot": "dialog-content",
|
|
68
|
-
className: (0,
|
|
68
|
+
className: (0, cnfast.cn)("fixed top-(--spark-viewport-center-y,50%) left-[50%] z-50 grid w-[90%] max-w-lg min-w-80 translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg bg-gray-1 p-4 text-gray shadow-lg transition-[top,opacity,translate,scale] duration-200 motion-reduce:transition-none sm:w-1/2", "data-starting-style:translate-y-[-52%] data-starting-style:scale-95 data-starting-style:opacity-0", "data-ending-style:translate-y-[-52%] data-ending-style:scale-95 data-ending-style:opacity-0", className),
|
|
69
69
|
...props
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
function DialogHeader({ className, ...props }) {
|
|
73
73
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
74
74
|
"data-slot": "dialog-header",
|
|
75
|
-
className: (0,
|
|
75
|
+
className: (0, cnfast.cn)("flex flex-col gap-1", className),
|
|
76
76
|
...props
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
function DialogFooter({ className, ...props }) {
|
|
80
80
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
81
81
|
"data-slot": "dialog-footer",
|
|
82
|
-
className: (0,
|
|
82
|
+
className: (0, cnfast.cn)("flex flex-col-reverse gap-4 sm:flex-row sm:justify-end", className),
|
|
83
83
|
...props
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
function DialogTitle({ className, ...props }) {
|
|
87
87
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_dialog.Dialog.Title, {
|
|
88
88
|
"data-slot": "dialog-title",
|
|
89
|
-
className: (0,
|
|
89
|
+
className: (0, cnfast.cn)("text-lg font-bold text-gray", className),
|
|
90
90
|
...props
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
function DialogDescription({ className, ...props }) {
|
|
94
94
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_dialog.Dialog.Description, {
|
|
95
95
|
"data-slot": "dialog-description",
|
|
96
|
-
className: (0,
|
|
96
|
+
className: (0, cnfast.cn)("text-sm text-gray-light", className),
|
|
97
97
|
...props
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.cjs","names":["DialogPrimitive","buttonVariants","Close"],"sources":["../../src/components/dialog.tsx"],"sourcesContent":["import { Dialog as DialogPrimitive } from '@base-ui/react/dialog'\nimport { Close } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\n// Our dialogs contain interactive elements that are mounted outside of the dialog\n// Browser extensions like password managers or grammar checkers are also mounted outside\n// We still dismiss on a click/tap outside: a genuine outside press lands on a\n// backdrop (our styled one, or Base UI's internal inert backdrop when modal)\nfunction isBackdropPress(event: Event | undefined) {\n const target = event?.target\n return (\n target instanceof HTMLElement &&\n (target.dataset.overlay === 'true' ||\n target.hasAttribute('data-base-ui-inert'))\n )\n}\n\nfunction Dialog({\n onOpenChange,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return (\n <DialogPrimitive.Root\n {...props}\n onOpenChange={(open, eventDetails) => {\n if (\n !open &&\n eventDetails.reason === 'outside-press' &&\n !isBackdropPress(eventDetails.event)\n ) {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n />\n )\n}\n\nfunction DialogTrigger(\n props: React.ComponentProps<typeof DialogPrimitive.Trigger>,\n) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal(\n props: React.ComponentProps<typeof DialogPrimitive.Portal>,\n) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\n// bare = the ready-made corner X (label is the consumer's, via aria-label);\n// with children or a render prop it stays the bare primitive (footer buttons, custom closes)\nfunction DialogClose({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n if (children || props.render) {\n return (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className={className}\n {...props}\n >\n {children}\n </DialogPrimitive.Close>\n )\n }\n\n return (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className={cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-2.5 right-3 rounded-full',\n className,\n )}\n {...props}\n >\n <Close className=\"[--spark-icon-size:calc(20px*var(--spark-scaling,1))]\" />\n </DialogPrimitive.Close>\n )\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Backdrop>) {\n return (\n <DialogPrimitive.Backdrop\n data-slot=\"dialog-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs motion-reduce:transition-none',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\nfunction DialogContent({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Popup>) {\n return (\n <DialogPrimitive.Popup\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-(--spark-viewport-center-y,50%) left-[50%] z-50 grid w-[90%] max-w-lg min-w-80 translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg bg-gray-1 p-4 text-gray shadow-lg transition-[top,opacity,translate,scale] duration-200 motion-reduce:transition-none sm:w-1/2',\n // enter/exit: fade + zoom + a slight upward offset (was animate-in/out)\n 'data-starting-style:translate-y-[-52%] data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:translate-y-[-52%] data-ending-style:scale-95 data-ending-style:opacity-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex flex-col gap-1', className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-4 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-lg font-bold text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-sm text-gray-light', className)}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAS,gBAAgB,OAA0B;CACjD,MAAM,SAAS,OAAO;CACtB,OACE,kBAAkB,gBACjB,OAAO,QAAQ,YAAY,UAC1B,OAAO,aAAa,oBAAoB;AAE9C;AAEA,SAAS,OAAO,EACd,cACA,GAAG,SACiD;CACpD,OACE,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,MAAjB;EACE,GAAI;EACJ,eAAe,MAAM,iBAAiB;GACpC,IACE,CAAC,QACD,aAAa,WAAW,mBACxB,CAAC,gBAAgB,aAAa,KAAK,GACnC;IACA,aAAa,OAAO;IACpB;GACF;GACA,eAAe,MAAM,YAAY;EACnC;CACD,CAAA;AAEL;AAEA,SAAS,cACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,SAAjB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,aACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,QAAjB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAIA,SAAS,YAAY,EACnB,WACA,UACA,GAAG,SACkD;CACrD,IAAI,YAAY,MAAM,QACpB,OACE,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,OAAjB;EACE,aAAU;EACC;EACX,GAAI;EAEH;CACoB,CAAA;CAI3B,OACE,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,OAAjB;EACE,aAAU;EACV,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"dialog.cjs","names":["DialogPrimitive","buttonVariants","Close"],"sources":["../../src/components/dialog.tsx"],"sourcesContent":["import { Dialog as DialogPrimitive } from '@base-ui/react/dialog'\nimport { Close } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\n// Our dialogs contain interactive elements that are mounted outside of the dialog\n// Browser extensions like password managers or grammar checkers are also mounted outside\n// We still dismiss on a click/tap outside: a genuine outside press lands on a\n// backdrop (our styled one, or Base UI's internal inert backdrop when modal)\nfunction isBackdropPress(event: Event | undefined) {\n const target = event?.target\n return (\n target instanceof HTMLElement &&\n (target.dataset.overlay === 'true' ||\n target.hasAttribute('data-base-ui-inert'))\n )\n}\n\nfunction Dialog({\n onOpenChange,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return (\n <DialogPrimitive.Root\n {...props}\n onOpenChange={(open, eventDetails) => {\n if (\n !open &&\n eventDetails.reason === 'outside-press' &&\n !isBackdropPress(eventDetails.event)\n ) {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n />\n )\n}\n\nfunction DialogTrigger(\n props: React.ComponentProps<typeof DialogPrimitive.Trigger>,\n) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal(\n props: React.ComponentProps<typeof DialogPrimitive.Portal>,\n) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\n// bare = the ready-made corner X (label is the consumer's, via aria-label);\n// with children or a render prop it stays the bare primitive (footer buttons, custom closes)\nfunction DialogClose({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n if (children || props.render) {\n return (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className={className}\n {...props}\n >\n {children}\n </DialogPrimitive.Close>\n )\n }\n\n return (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className={cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-2.5 right-3 rounded-full',\n className,\n )}\n {...props}\n >\n <Close className=\"[--spark-icon-size:calc(20px*var(--spark-scaling,1))]\" />\n </DialogPrimitive.Close>\n )\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Backdrop>) {\n return (\n <DialogPrimitive.Backdrop\n data-slot=\"dialog-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs motion-reduce:transition-none',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\nfunction DialogContent({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Popup>) {\n return (\n <DialogPrimitive.Popup\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-(--spark-viewport-center-y,50%) left-[50%] z-50 grid w-[90%] max-w-lg min-w-80 translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg bg-gray-1 p-4 text-gray shadow-lg transition-[top,opacity,translate,scale] duration-200 motion-reduce:transition-none sm:w-1/2',\n // enter/exit: fade + zoom + a slight upward offset (was animate-in/out)\n 'data-starting-style:translate-y-[-52%] data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:translate-y-[-52%] data-ending-style:scale-95 data-ending-style:opacity-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex flex-col gap-1', className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-4 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-lg font-bold text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-sm text-gray-light', className)}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAS,gBAAgB,OAA0B;CACjD,MAAM,SAAS,OAAO;CACtB,OACE,kBAAkB,gBACjB,OAAO,QAAQ,YAAY,UAC1B,OAAO,aAAa,oBAAoB;AAE9C;AAEA,SAAS,OAAO,EACd,cACA,GAAG,SACiD;CACpD,OACE,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,MAAjB;EACE,GAAI;EACJ,eAAe,MAAM,iBAAiB;GACpC,IACE,CAAC,QACD,aAAa,WAAW,mBACxB,CAAC,gBAAgB,aAAa,KAAK,GACnC;IACA,aAAa,OAAO;IACpB;GACF;GACA,eAAe,MAAM,YAAY;EACnC;CACD,CAAA;AAEL;AAEA,SAAS,cACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,SAAjB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,aACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,QAAjB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAIA,SAAS,YAAY,EACnB,WACA,UACA,GAAG,SACkD;CACrD,IAAI,YAAY,MAAM,QACpB,OACE,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,OAAgB,OAAjB;EACE,aAAU;EACC;EACX,GAAI;EAEH;CACoB,CAAA;CAI3B,OACE,iBAAA,GAAA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A,sBAAAA,OAAgB,aAAjB;EACE,aAAU;EACV,YAAA,GAAA,OAAA,IAAc,2BAA2B,SAAS;EAClD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donut-chart.cjs","names":[],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["interface DonutSegment {\n value: number\n color: string\n}\n\ninterface DonutChartProps {\n segments: DonutSegment[]\n centerLabel: string\n centerSub: string\n}\n\nconst RADIUS = 66\nconst STROKE = 14\nconst SIZE = 180\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nexport function DonutChart({\n centerLabel,\n centerSub,\n segments,\n}: DonutChartProps) {\n const total = segments.reduce((sum, seg) => sum + seg.value, 0)\n\n let offset = 0\n const arcs = segments.map((seg) => {\n const dash = total > 0 ? (seg.value / total) * CIRCUMFERENCE : 0\n const arc = {\n color: seg.color,\n dash,\n gap: CIRCUMFERENCE - dash,\n offset,\n }\n offset += dash\n return arc\n })\n\n return (\n <svg width={SIZE} height={SIZE} viewBox={`0 0 ${SIZE} ${SIZE}`}>\n <circle\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke=\"var(--neutral-a3)\"\n strokeWidth={STROKE}\n />\n {arcs.map((arc, i) => (\n <circle\n
|
|
1
|
+
{"version":3,"file":"donut-chart.cjs","names":[],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["interface DonutSegment {\n value: number\n color: string\n}\n\ninterface DonutChartProps {\n segments: DonutSegment[]\n centerLabel: string\n centerSub: string\n}\n\nconst RADIUS = 66\nconst STROKE = 14\nconst SIZE = 180\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nexport function DonutChart({\n centerLabel,\n centerSub,\n segments,\n}: DonutChartProps) {\n const total = segments.reduce((sum, seg) => sum + seg.value, 0)\n\n let offset = 0\n const arcs = segments.map((seg) => {\n const dash = total > 0 ? (seg.value / total) * CIRCUMFERENCE : 0\n const arc = {\n color: seg.color,\n dash,\n gap: CIRCUMFERENCE - dash,\n offset,\n }\n offset += dash\n return arc\n })\n\n return (\n <svg width={SIZE} height={SIZE} viewBox={`0 0 ${SIZE} ${SIZE}`}>\n <circle\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke=\"var(--neutral-a3)\"\n strokeWidth={STROKE}\n />\n {arcs.map((arc, i) => (\n <circle\n key={i}\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke={arc.color}\n strokeWidth={STROKE}\n strokeDasharray={`${arc.dash} ${arc.gap}`}\n strokeDashoffset={CIRCUMFERENCE / 4 - arc.offset}\n strokeLinecap=\"butt\"\n />\n ))}\n <text\n x={SIZE / 2}\n y={SIZE / 2 - 5}\n textAnchor=\"middle\"\n fontSize={20}\n fontWeight={700}\n fill=\"var(--neutral-12)\"\n >\n {centerLabel}\n </text>\n <text\n x={SIZE / 2}\n y={SIZE / 2 + 14}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--neutral-a11)\"\n >\n {centerSub}\n </text>\n </svg>\n )\n}\n"],"mappings":";;;;AAWA,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAM,gBAAgB,IAAI,KAAK,KAAK;AAEpC,SAAgB,WAAW,EACzB,aACA,WACA,YACkB;CAClB,MAAM,QAAQ,SAAS,QAAQ,KAAK,QAAQ,MAAM,IAAI,OAAO,CAAC;CAE9D,IAAI,SAAS;CACb,MAAM,OAAO,SAAS,KAAK,QAAQ;EACjC,MAAM,OAAO,QAAQ,IAAK,IAAI,QAAQ,QAAS,gBAAgB;EAC/D,MAAM,MAAM;GACV,OAAO,IAAI;GACX;GACA,KAAK,gBAAgB;GACrB;EACF;EACA,UAAU;EACV,OAAO;CACT,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,OAAO;EAAM,QAAQ;EAAM,SAAS,OAAO,KAAK,GAAG;YAAxD;GACE,iBAAA,GAAA,kBAAA,KAAC,UAAD;IACE,IAAI,OAAO;IACX,IAAI,OAAO;IACX,GAAG;IACH,MAAK;IACL,QAAO;IACP,aAAa;GACd,CAAA;GACA,KAAK,KAAK,KAAK,MACd,iBAAA,GAAA,kBAAA,KAAC,UAAD;IAEE,IAAI,OAAO;IACX,IAAI,OAAO;IACX,GAAG;IACH,MAAK;IACL,QAAQ,IAAI;IACZ,aAAa;IACb,iBAAiB,GAAG,IAAI,KAAK,GAAG,IAAI;IACpC,kBAAkB,gBAAgB,IAAI,IAAI;IAC1C,eAAc;GACf,GAVM,CAUN,CACF;GACD,iBAAA,GAAA,kBAAA,KAAC,QAAD;IACE,GAAG,OAAO;IACV,GAAG,OAAO,IAAI;IACd,YAAW;IACX,UAAU;IACV,YAAY;IACZ,MAAK;cAEJ;GACG,CAAA;GACN,iBAAA,GAAA,kBAAA,KAAC,QAAD;IACE,GAAG,OAAO;IACV,GAAG;IACH,YAAW;IACX,UAAU;IACV,MAAK;cAEJ;GACG,CAAA;EACH;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donut-chart.js","names":[],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["interface DonutSegment {\n value: number\n color: string\n}\n\ninterface DonutChartProps {\n segments: DonutSegment[]\n centerLabel: string\n centerSub: string\n}\n\nconst RADIUS = 66\nconst STROKE = 14\nconst SIZE = 180\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nexport function DonutChart({\n centerLabel,\n centerSub,\n segments,\n}: DonutChartProps) {\n const total = segments.reduce((sum, seg) => sum + seg.value, 0)\n\n let offset = 0\n const arcs = segments.map((seg) => {\n const dash = total > 0 ? (seg.value / total) * CIRCUMFERENCE : 0\n const arc = {\n color: seg.color,\n dash,\n gap: CIRCUMFERENCE - dash,\n offset,\n }\n offset += dash\n return arc\n })\n\n return (\n <svg width={SIZE} height={SIZE} viewBox={`0 0 ${SIZE} ${SIZE}`}>\n <circle\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke=\"var(--neutral-a3)\"\n strokeWidth={STROKE}\n />\n {arcs.map((arc, i) => (\n <circle\n
|
|
1
|
+
{"version":3,"file":"donut-chart.js","names":[],"sources":["../../src/components/donut-chart.tsx"],"sourcesContent":["interface DonutSegment {\n value: number\n color: string\n}\n\ninterface DonutChartProps {\n segments: DonutSegment[]\n centerLabel: string\n centerSub: string\n}\n\nconst RADIUS = 66\nconst STROKE = 14\nconst SIZE = 180\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nexport function DonutChart({\n centerLabel,\n centerSub,\n segments,\n}: DonutChartProps) {\n const total = segments.reduce((sum, seg) => sum + seg.value, 0)\n\n let offset = 0\n const arcs = segments.map((seg) => {\n const dash = total > 0 ? (seg.value / total) * CIRCUMFERENCE : 0\n const arc = {\n color: seg.color,\n dash,\n gap: CIRCUMFERENCE - dash,\n offset,\n }\n offset += dash\n return arc\n })\n\n return (\n <svg width={SIZE} height={SIZE} viewBox={`0 0 ${SIZE} ${SIZE}`}>\n <circle\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke=\"var(--neutral-a3)\"\n strokeWidth={STROKE}\n />\n {arcs.map((arc, i) => (\n <circle\n key={i}\n cx={SIZE / 2}\n cy={SIZE / 2}\n r={RADIUS}\n fill=\"none\"\n stroke={arc.color}\n strokeWidth={STROKE}\n strokeDasharray={`${arc.dash} ${arc.gap}`}\n strokeDashoffset={CIRCUMFERENCE / 4 - arc.offset}\n strokeLinecap=\"butt\"\n />\n ))}\n <text\n x={SIZE / 2}\n y={SIZE / 2 - 5}\n textAnchor=\"middle\"\n fontSize={20}\n fontWeight={700}\n fill=\"var(--neutral-12)\"\n >\n {centerLabel}\n </text>\n <text\n x={SIZE / 2}\n y={SIZE / 2 + 14}\n textAnchor=\"middle\"\n fontSize={12}\n fill=\"var(--neutral-a11)\"\n >\n {centerSub}\n </text>\n </svg>\n )\n}\n"],"mappings":";;;AAWA,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAM,gBAAgB,IAAI,KAAK,KAAK;AAEpC,SAAgB,WAAW,EACzB,aACA,WACA,YACkB;CAClB,MAAM,QAAQ,SAAS,QAAQ,KAAK,QAAQ,MAAM,IAAI,OAAO,CAAC;CAE9D,IAAI,SAAS;CACb,MAAM,OAAO,SAAS,KAAK,QAAQ;EACjC,MAAM,OAAO,QAAQ,IAAK,IAAI,QAAQ,QAAS,gBAAgB;EAC/D,MAAM,MAAM;GACV,OAAO,IAAI;GACX;GACA,KAAK,gBAAgB;GACrB;EACF;EACA,UAAU;EACV,OAAO;CACT,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,OAAO;EAAM,QAAQ;EAAM,SAAS,OAAO,KAAK,GAAG;YAAxD;GACE,oBAAC,UAAD;IACE,IAAI,OAAO;IACX,IAAI,OAAO;IACX,GAAG;IACH,MAAK;IACL,QAAO;IACP,aAAa;GACd,CAAA;GACA,KAAK,KAAK,KAAK,MACd,oBAAC,UAAD;IAEE,IAAI,OAAO;IACX,IAAI,OAAO;IACX,GAAG;IACH,MAAK;IACL,QAAQ,IAAI;IACZ,aAAa;IACb,iBAAiB,GAAG,IAAI,KAAK,GAAG,IAAI;IACpC,kBAAkB,gBAAgB,IAAI,IAAI;IAC1C,eAAc;GACf,GAVM,CAUN,CACF;GACD,oBAAC,QAAD;IACE,GAAG,OAAO;IACV,GAAG,OAAO,IAAI;IACd,YAAW;IACX,UAAU;IACV,YAAY;IACZ,MAAK;cAEJ;GACG,CAAA;GACN,oBAAC,QAAD;IACE,GAAG,OAAO;IACV,GAAG;IACH,YAAW;IACX,UAAU;IACV,MAAK;cAEJ;GACG,CAAA;EACH;;AAET"}
|
|
@@ -5,7 +5,7 @@ let react = require("react");
|
|
|
5
5
|
react = require_chunk.__toESM(react);
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
let vaul = require("vaul");
|
|
8
|
-
let
|
|
8
|
+
let cnfast = require("cnfast");
|
|
9
9
|
//#region src/components/drawer.tsx
|
|
10
10
|
function Drawer({ shouldScaleBackground = true, ...props }) {
|
|
11
11
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(vaul.Drawer.Root, {
|
|
@@ -35,7 +35,7 @@ function DrawerClose(props) {
|
|
|
35
35
|
function DrawerOverlay({ className, ...props }) {
|
|
36
36
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(vaul.Drawer.Overlay, {
|
|
37
37
|
"data-slot": "drawer-overlay",
|
|
38
|
-
className: (0,
|
|
38
|
+
className: (0, cnfast.cn)("fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs", className),
|
|
39
39
|
"data-overlay": "true",
|
|
40
40
|
...props
|
|
41
41
|
});
|
|
@@ -46,37 +46,37 @@ const onInteractOutsideHandler = (event) => {
|
|
|
46
46
|
function DrawerContent({ className, pillClassName, children, ...props }) {
|
|
47
47
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(vaul.Drawer.Content, {
|
|
48
48
|
"data-slot": "drawer-content",
|
|
49
|
-
className: (0,
|
|
49
|
+
className: (0, cnfast.cn)("group/drawer-content fixed z-50 flex h-auto flex-col bg-gray-2 text-gray", "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-(--spark-viewport-bottom-offset,0) data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg", "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg", "data-[vaul-drawer-direction=left]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:border-gray-a1 data-[vaul-drawer-direction=left]:sm:max-w-sm", "data-[vaul-drawer-direction=right]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:border-gray-a1 data-[vaul-drawer-direction=right]:sm:max-w-sm", className),
|
|
50
50
|
onInteractOutside: onInteractOutsideHandler,
|
|
51
51
|
...props,
|
|
52
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0,
|
|
52
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, cnfast.cn)("mx-auto mt-2.5 hidden h-1.5 w-16 shrink-0 rounded-full bg-base-gray-soft group-data-[vaul-drawer-direction=bottom]/drawer-content:block", pillClassName) }), children]
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
function DrawerHeader({ className, ...props }) {
|
|
56
56
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
57
|
"data-slot": "drawer-header",
|
|
58
|
-
className: (0,
|
|
58
|
+
className: (0, cnfast.cn)("flex flex-col gap-1 px-6 py-3", className),
|
|
59
59
|
...props
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
function DrawerFooter({ className, ...props }) {
|
|
63
63
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
64
64
|
"data-slot": "drawer-footer",
|
|
65
|
-
className: (0,
|
|
65
|
+
className: (0, cnfast.cn)("mt-auto flex flex-col gap-2 text-gray", className),
|
|
66
66
|
...props
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
function DrawerTitle({ className, ...props }) {
|
|
70
70
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(vaul.Drawer.Title, {
|
|
71
71
|
"data-slot": "drawer-title",
|
|
72
|
-
className: (0,
|
|
72
|
+
className: (0, cnfast.cn)("text-lg font-bold text-gray", className),
|
|
73
73
|
...props
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
function DrawerDescription({ className, ...props }) {
|
|
77
77
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(vaul.Drawer.Description, {
|
|
78
78
|
"data-slot": "drawer-description",
|
|
79
|
-
className: (0,
|
|
79
|
+
className: (0, cnfast.cn)("text-sm text-gray-light", className),
|
|
80
80
|
...props
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.cjs","names":["DrawerPrimitive"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\nimport { cn } from '../utils/cn'\n\nfunction Drawer({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n />\n )\n}\n\nfunction DrawerTrigger(\n props: React.ComponentProps<typeof DrawerPrimitive.Trigger>,\n) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal(\n props: React.ComponentProps<typeof DrawerPrimitive.Portal>,\n) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose(\n props: React.ComponentProps<typeof DrawerPrimitive.Close>,\n) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs
|
|
1
|
+
{"version":3,"file":"drawer.cjs","names":["DrawerPrimitive"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\nimport { cn } from '../utils/cn'\n\nfunction Drawer({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n />\n )\n}\n\nfunction DrawerTrigger(\n props: React.ComponentProps<typeof DrawerPrimitive.Trigger>,\n) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal(\n props: React.ComponentProps<typeof DrawerPrimitive.Portal>,\n) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose(\n props: React.ComponentProps<typeof DrawerPrimitive.Close>,\n) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\ninterface DrawerContentProps extends React.ComponentProps<\n typeof DrawerPrimitive.Content\n> {\n pillClassName?: string\n}\n\nconst onInteractOutsideHandler = (event: CustomEvent) => {\n const target = event.target as HTMLElement\n const isOverlay = target.dataset.overlay === 'true'\n\n // Our drawers contain interactive elements that are mounted outside of the drawer\n // Browser extensions like password managers or grammar checkers are also mounted outside\n // We still dismiss on a click/tap outside\n if (!isOverlay) event.preventDefault()\n}\n\nfunction DrawerContent({\n className,\n pillClassName,\n children,\n ...props\n}: DrawerContentProps) {\n return (\n <DrawerPrimitive.Content\n data-slot=\"drawer-content\"\n className={cn(\n 'group/drawer-content fixed z-50 flex h-auto flex-col bg-gray-2 text-gray',\n 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-(--spark-viewport-bottom-offset,0) data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg',\n 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg',\n 'data-[vaul-drawer-direction=left]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:border-gray-a1 data-[vaul-drawer-direction=left]:sm:max-w-sm',\n 'data-[vaul-drawer-direction=right]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:border-gray-a1 data-[vaul-drawer-direction=right]:sm:max-w-sm',\n className,\n )}\n onInteractOutside={onInteractOutsideHandler}\n {...props}\n >\n <div\n className={cn(\n 'mx-auto mt-2.5 hidden h-1.5 w-16 shrink-0 rounded-full bg-base-gray-soft group-data-[vaul-drawer-direction=bottom]/drawer-content:block',\n pillClassName,\n )}\n />\n {children}\n </DrawerPrimitive.Content>\n )\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn('flex flex-col gap-1 px-6 py-3', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('mt-auto flex flex-col gap-2 text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={cn('text-lg font-bold text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={cn('text-sm text-gray-light', className)}\n {...props}\n />\n )\n}\n\nexport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n}\nexport type { DrawerContentProps }\n"],"mappings":";;;;;;;;;AAIA,SAAS,OAAO,EACd,wBAAwB,MACxB,GAAG,SACiD;CACpD,OACE,iBAAA,GAAA,kBAAA,KAACA,KAAAA,OAAgB,MAAjB;EACE,aAAU;EACa;EACvB,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,KAAAA,OAAgB,SAAjB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,aACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,KAAAA,OAAgB,QAAjB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,YACP,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,KAACA,KAAAA,OAAgB,OAAjB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,cAAc,E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AA,GAAA,OAAA,IAAc,2BAA2B,SAAS;EAClD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -32,7 +32,7 @@ function DrawerClose(props) {
|
|
|
32
32
|
function DrawerOverlay({ className, ...props }) {
|
|
33
33
|
return /* @__PURE__ */ jsx(Drawer$1.Overlay, {
|
|
34
34
|
"data-slot": "drawer-overlay",
|
|
35
|
-
className: cn("fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs
|
|
35
|
+
className: cn("fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs", className),
|
|
36
36
|
"data-overlay": "true",
|
|
37
37
|
...props
|
|
38
38
|
});
|
|
@@ -43,7 +43,7 @@ const onInteractOutsideHandler = (event) => {
|
|
|
43
43
|
function DrawerContent({ className, pillClassName, children, ...props }) {
|
|
44
44
|
return /* @__PURE__ */ jsxs(Drawer$1.Content, {
|
|
45
45
|
"data-slot": "drawer-content",
|
|
46
|
-
className: cn("group/drawer-content fixed z-50 flex h-auto flex-col bg-gray-2 text-gray
|
|
46
|
+
className: cn("group/drawer-content fixed z-50 flex h-auto flex-col bg-gray-2 text-gray", "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-(--spark-viewport-bottom-offset,0) data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg", "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg", "data-[vaul-drawer-direction=left]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:border-gray-a1 data-[vaul-drawer-direction=left]:sm:max-w-sm", "data-[vaul-drawer-direction=right]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:border-gray-a1 data-[vaul-drawer-direction=right]:sm:max-w-sm", className),
|
|
47
47
|
onInteractOutside: onInteractOutsideHandler,
|
|
48
48
|
...props,
|
|
49
49
|
children: [/* @__PURE__ */ jsx("div", { className: cn("mx-auto mt-2.5 hidden h-1.5 w-16 shrink-0 rounded-full bg-base-gray-soft group-data-[vaul-drawer-direction=bottom]/drawer-content:block", pillClassName) }), children]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","names":["DrawerPrimitive"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\nimport { cn } from '../utils/cn'\n\nfunction Drawer({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n />\n )\n}\n\nfunction DrawerTrigger(\n props: React.ComponentProps<typeof DrawerPrimitive.Trigger>,\n) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal(\n props: React.ComponentProps<typeof DrawerPrimitive.Portal>,\n) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose(\n props: React.ComponentProps<typeof DrawerPrimitive.Close>,\n) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs
|
|
1
|
+
{"version":3,"file":"drawer.js","names":["DrawerPrimitive"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\nimport { cn } from '../utils/cn'\n\nfunction Drawer({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n />\n )\n}\n\nfunction DrawerTrigger(\n props: React.ComponentProps<typeof DrawerPrimitive.Trigger>,\n) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal(\n props: React.ComponentProps<typeof DrawerPrimitive.Portal>,\n) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose(\n props: React.ComponentProps<typeof DrawerPrimitive.Close>,\n) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\ninterface DrawerContentProps extends React.ComponentProps<\n typeof DrawerPrimitive.Content\n> {\n pillClassName?: string\n}\n\nconst onInteractOutsideHandler = (event: CustomEvent) => {\n const target = event.target as HTMLElement\n const isOverlay = target.dataset.overlay === 'true'\n\n // Our drawers contain interactive elements that are mounted outside of the drawer\n // Browser extensions like password managers or grammar checkers are also mounted outside\n // We still dismiss on a click/tap outside\n if (!isOverlay) event.preventDefault()\n}\n\nfunction DrawerContent({\n className,\n pillClassName,\n children,\n ...props\n}: DrawerContentProps) {\n return (\n <DrawerPrimitive.Content\n data-slot=\"drawer-content\"\n className={cn(\n 'group/drawer-content fixed z-50 flex h-auto flex-col bg-gray-2 text-gray',\n 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-(--spark-viewport-bottom-offset,0) data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg',\n 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg',\n 'data-[vaul-drawer-direction=left]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:border-gray-a1 data-[vaul-drawer-direction=left]:sm:max-w-sm',\n 'data-[vaul-drawer-direction=right]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:border-gray-a1 data-[vaul-drawer-direction=right]:sm:max-w-sm',\n className,\n )}\n onInteractOutside={onInteractOutsideHandler}\n {...props}\n >\n <div\n className={cn(\n 'mx-auto mt-2.5 hidden h-1.5 w-16 shrink-0 rounded-full bg-base-gray-soft group-data-[vaul-drawer-direction=bottom]/drawer-content:block',\n pillClassName,\n )}\n />\n {children}\n </DrawerPrimitive.Content>\n )\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn('flex flex-col gap-1 px-6 py-3', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('mt-auto flex flex-col gap-2 text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={cn('text-lg font-bold text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={cn('text-sm text-gray-light', className)}\n {...props}\n />\n )\n}\n\nexport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n}\nexport type { DrawerContentProps }\n"],"mappings":";;;;;;AAIA,SAAS,OAAO,EACd,wBAAwB,MACxB,GAAG,SACiD;CACpD,OACE,oBAACA,SAAgB,MAAjB;EACE,aAAU;EACa;EACvB,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cACP,OACA;CACA,OAAO,oBAACA,SAAgB,SAAjB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,aACP,OACA;CACA,OAAO,oBAACA,SAAgB,QAAjB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,YACP,OACA;CACA,OAAO,oBAACA,SAAgB,OAAjB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,oBAACA,SAAgB,SAAjB;EACE,aAAU;EACV,WAAW,GACT,0JACA,SACF;EACA,gBAAa;EACb,GAAI;CACL,CAAA;AAEL;AAQA,MAAM,4BAA4B,UAAuB;CAOvD,IAAI,EANW,MAAM,OACI,QAAQ,YAAY,SAK7B,MAAM,eAAe;AACvC;AAEA,SAAS,cAAc,EACrB,WACA,eACA,UACA,GAAG,SACkB;CACrB,OACE,qBAACA,SAAgB,SAAjB;EACE,aAAU;EACV,WAAW,GACT,4EACA,2QACA,+OACA,gWACA,wWACA,SACF;EACA,mBAAmB;EACnB,GAAI;YAXN,CAaE,oBAAC,OAAD,EACE,WAAW,GACT,2IACA,aACF,EACD,CAAA,GACA,QACsB;;AAE7B;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,yCAAyC,SAAS;EAChE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAACA,SAAgB,OAAjB;EACE,aAAU;EACV,WAAW,GAAG,+BAA+B,SAAS;EACtD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;CAC3D,OACE,oBAACA,SAAgB,aAAjB;EACE,aAAU;EACV,WAAW,GAAG,2BAA2B,SAAS;EAClD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -6,7 +6,7 @@ react = require_chunk.__toESM(react);
|
|
|
6
6
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
let _base_ui_react_menu = require("@base-ui/react/menu");
|
|
9
|
-
let
|
|
9
|
+
let cnfast = require("cnfast");
|
|
10
10
|
//#region src/components/dropdown-menu.tsx
|
|
11
11
|
function DropdownMenu({ ...props }) {
|
|
12
12
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_menu.Menu.Root, { ...props });
|
|
@@ -34,7 +34,7 @@ function DropdownMenuContent({ className, align = "start", alignOffset, side, si
|
|
|
34
34
|
sideOffset,
|
|
35
35
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_menu.Menu.Popup, {
|
|
36
36
|
"data-slot": "dropdown-menu-content",
|
|
37
|
-
className: (0,
|
|
37
|
+
className: (0, cnfast.cn)("z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none [[data-high-contrast]_&]:border-gray-a11", "transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none", "data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2", className),
|
|
38
38
|
...props
|
|
39
39
|
})
|
|
40
40
|
})
|
|
@@ -51,7 +51,7 @@ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
|
51
51
|
"data-slot": "dropdown-menu-item",
|
|
52
52
|
"data-inset": inset,
|
|
53
53
|
"data-variant": variant,
|
|
54
|
-
className: (0,
|
|
54
|
+
className: (0, cnfast.cn)("group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4", className),
|
|
55
55
|
...props
|
|
56
56
|
});
|
|
57
57
|
}
|
|
@@ -59,7 +59,7 @@ function DropdownMenuCheckboxItem({ className, children, checked, inset, ...prop
|
|
|
59
59
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_menu.Menu.CheckboxItem, {
|
|
60
60
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
61
61
|
"data-inset": inset,
|
|
62
|
-
className: (0,
|
|
62
|
+
className: (0, cnfast.cn)("relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4", className),
|
|
63
63
|
checked,
|
|
64
64
|
...props,
|
|
65
65
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -79,7 +79,7 @@ function DropdownMenuRadioItem({ className, children, inset, ...props }) {
|
|
|
79
79
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_menu.Menu.RadioItem, {
|
|
80
80
|
"data-slot": "dropdown-menu-radio-item",
|
|
81
81
|
"data-inset": inset,
|
|
82
|
-
className: (0,
|
|
82
|
+
className: (0, cnfast.cn)("relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4", className),
|
|
83
83
|
...props,
|
|
84
84
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
85
85
|
className: "pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center",
|
|
@@ -92,21 +92,21 @@ function DropdownMenuLabel({ className, inset, ...props }) {
|
|
|
92
92
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
93
93
|
"data-slot": "dropdown-menu-label",
|
|
94
94
|
"data-inset": inset,
|
|
95
|
-
className: (0,
|
|
95
|
+
className: (0, cnfast.cn)("px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12", className),
|
|
96
96
|
...props
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
function DropdownMenuSeparator({ className, ...props }) {
|
|
100
100
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_menu.Menu.Separator, {
|
|
101
101
|
"data-slot": "dropdown-menu-separator",
|
|
102
|
-
className: (0,
|
|
102
|
+
className: (0, cnfast.cn)("-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6", className),
|
|
103
103
|
...props
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
function DropdownMenuShortcut({ className, ...props }) {
|
|
107
107
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
108
108
|
"data-slot": "dropdown-menu-shortcut",
|
|
109
|
-
className: (0,
|
|
109
|
+
className: (0, cnfast.cn)("ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12", className),
|
|
110
110
|
...props
|
|
111
111
|
});
|
|
112
112
|
}
|
|
@@ -120,7 +120,7 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
120
120
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_menu.Menu.SubmenuTrigger, {
|
|
121
121
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
122
122
|
"data-inset": inset,
|
|
123
|
-
className: (0,
|
|
123
|
+
className: (0, cnfast.cn)("flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4", className),
|
|
124
124
|
...props,
|
|
125
125
|
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_epilot_spark_icons.ChevronRight, { className: "ml-auto text-sm text-gray-light" })]
|
|
126
126
|
});
|
|
@@ -132,7 +132,7 @@ function DropdownMenuSubContent({ className, ...props }) {
|
|
|
132
132
|
alignOffset: -3,
|
|
133
133
|
side: "right",
|
|
134
134
|
sideOffset: 0,
|
|
135
|
-
className: (0,
|
|
135
|
+
className: (0, cnfast.cn)("w-auto min-w-32", className),
|
|
136
136
|
...props
|
|
137
137
|
});
|
|
138
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.cjs","names":["MenuPrimitive","Check","ChevronRight"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;;;;AAKA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA,SAAS,mBAAmB,EAC1B,GAAG,SACiD;CACpD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,QAAf;EAAsB,aAAU;EAAuB,GAAI;CAAQ,CAAA;AAC5E;AAEA,SAAS,oBAAoB,EAC3B,GAAG,SACkD;CAC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Ac,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ,CAAA;AAC9E;AAEA,SAAS,uBAAuB,EAC9B,WACA,OACA,UACA,GAAG,SAGF;CACD,OACE,iBAAA,GAAA,kBAAA,MAACA,oBAAAA,KAAc,gBAAf;EACE,aAAU;EACV,cAAY;EACZ,YAAA,GAAA,GAAA,IACE,2UACA,SACF;EACA,GAAI;YAPN,CASG,UACD,iBAAA,GAAA,kBAAA,KAACE,oBAAAA,cAAD,EAAc,WAAU,kCAAmC,CAAA,CAC/B;;AAElC;AAIA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SACwB;CAC3B,OACE,iBAAA,GAAA,kBAAA,KAAC,qBAAD;EACE,aAAU;EACV,OAAM;EACN,aAAa;EACb,MAAK;EACL,YAAY;EACZ,YAAA,GAAA,GAAA,IAAc,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.cjs","names":["MenuPrimitive","Check","ChevronRight"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;;;;AAKA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA,SAAS,mBAAmB,EAC1B,GAAG,SACiD;CACpD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,QAAf;EAAsB,aAAU;EAAuB,GAAI;CAAQ,CAAA;AAC5E;AAEA,SAAS,oBAAoB,EAC3B,GAAG,S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AAA,KAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ,CAAA;AAC9E;AAEA,SAAS,uBAAuB,EAC9B,WACA,OACA,UACA,GAAG,SAGF;CACD,OACE,iBAAA,GAAA,kBAAA,MAACA,oBAAAA,KAAc,gBAAf;EACE,aAAU;EACV,cAAY;EACZ,YAAA,GAAA,OAAA,IACE,2UACA,SACF;EACA,GAAI;YAPN,CASG,UACD,iBAAA,GAAA,kBAAA,KAACE,oBAAAA,cAAD,EAAc,WAAU,kCAAmC,CAAA,CAC/B;;AAElC;AAIA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SACwB;CAC3B,OACE,iBAAA,GAAA,kBAAA,KAAC,qBAAD;EACE,aAAU;EACV,OAAM;EACN,aAAa;EACb,MAAK;EACL,YAAY;EACZ,YAAA,GAAA,OAAA,IAAc,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -13,7 +13,7 @@ function formatBreakdownCenter(v) {
|
|
|
13
13
|
return require_utils_format.twoDecimalFormat.format(v);
|
|
14
14
|
}
|
|
15
15
|
function EnergyBreakdown({ title, subtitle, items, centerSub = "kWh" }) {
|
|
16
|
-
const sortedItems = (0, react.useMemo)(() => items.
|
|
16
|
+
const sortedItems = (0, react.useMemo)(() => [...items].sort((a, b) => b.value - a.value), [items]);
|
|
17
17
|
const total = items.reduce((s, i) => s + i.value, 0);
|
|
18
18
|
const centerTotal = items.filter((i) => !i.excludeFromCenterTotal).reduce((s, i) => s + i.value, 0);
|
|
19
19
|
if (total === 0) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-breakdown.cjs","names":["formatThousands","integerFormat","oneDecimalFormat","twoDecimalFormat","DonutChart","formatEnergy"],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => items.
|
|
1
|
+
{"version":3,"file":"energy-breakdown.cjs","names":["formatThousands","integerFormat","oneDecimalFormat","twoDecimalFormat","DonutChart","formatEnergy"],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => [...items].sort((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-sm font-semibold text-gray\">{title}</span>\n <span className=\"text-xs text-gray-light\">{subtitle}</span>\n </div>\n\n <div className=\"flex items-center gap-6\">\n <DonutChart\n centerLabel={formatBreakdownCenter(centerTotal)}\n centerSub={centerSub}\n segments={sortedItems.map(({ value, color }) => ({ value, color }))}\n />\n\n <div className=\"flex flex-1 flex-col gap-3\">\n {sortedItems.map(({ label, value, color }) => {\n const pct = (value / total) * 100\n return (\n <div key={label} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"min-w-0 truncate text-sm font-medium text-gray\">\n {label}\n </span>\n <span className=\"flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums\">\n <span className=\"text-gray-light\">\n {formatEnergy(value)}\n </span>\n <span className=\"font-semibold text-gray\">\n {`${integerFormat.format(pct)}${NARROW_NBSP}%`}\n </span>\n </span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-gray-a4\">\n <div\n className=\"h-full rounded-full\"\n style={{ width: `${pct}%`, background: color }}\n />\n </div>\n </div>\n )\n })}\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAyBA,SAAS,sBAAsB,GAAW;CACxC,IAAI,KAAK,KAAM,OAAOA,qBAAAA,gBAAgB,CAAC;CACvC,IAAI,KAAK,KAAK,OAAOC,qBAAAA,cAAc,OAAO,CAAC;CAC3C,IAAI,KAAK,IAAI,OAAOC,qBAAAA,iBAAiB,OAAO,CAAC;CAC7C,OAAOC,qBAAAA,iBAAiB,OAAO,CAAC;AAClC;AAEA,SAAgB,gBAAgB,EAC9B,OACA,UACA,OACA,YAAY,SACW;CACvB,MAAM,eAAA,GAAA,MAAA,eACE,CAAC,GAAG,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,GACjD,CAAC,KAAK,CACR;CAEA,MAAM,QAAQ,MAAM,QAAQ,GAAG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,kBAAA,KAAC,OAAD;OAAK,WAAU;iBACb,iBAAA,GAAA,kBAAA,KAAC,OAAD;QACE,WAAU;QACV,OAAO;SAAE,OAAO,GAAG,IAAI;SAAI,YAAY;QAAM;OAC9C,CAAA;MACE,CAAA,CACF;QApBK,KAoBL;IAET,CAAC;GACE,CAAA,CACF;IACF;;AAET"}
|
|
@@ -12,7 +12,7 @@ function formatBreakdownCenter(v) {
|
|
|
12
12
|
return twoDecimalFormat.format(v);
|
|
13
13
|
}
|
|
14
14
|
function EnergyBreakdown({ title, subtitle, items, centerSub = "kWh" }) {
|
|
15
|
-
const sortedItems = useMemo(() => items.
|
|
15
|
+
const sortedItems = useMemo(() => [...items].sort((a, b) => b.value - a.value), [items]);
|
|
16
16
|
const total = items.reduce((s, i) => s + i.value, 0);
|
|
17
17
|
const centerTotal = items.filter((i) => !i.excludeFromCenterTotal).reduce((s, i) => s + i.value, 0);
|
|
18
18
|
if (total === 0) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy-breakdown.js","names":[],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => items.
|
|
1
|
+
{"version":3,"file":"energy-breakdown.js","names":[],"sources":["../../src/components/energy-breakdown.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NARROW_NBSP } from '../utils/chars'\nimport {\n formatEnergy,\n formatThousands,\n integerFormat,\n oneDecimalFormat,\n twoDecimalFormat,\n} from '../utils/format'\nimport { DonutChart } from './donut-chart'\n\nexport type BreakdownItem = {\n label: string\n value: number\n color: string\n excludeFromCenterTotal?: boolean\n}\n\nexport type EnergyBreakdownProps = {\n title: string\n subtitle: string\n items: BreakdownItem[]\n centerSub?: string\n}\n\nfunction formatBreakdownCenter(v: number) {\n if (v >= 1000) return formatThousands(v)\n if (v >= 100) return integerFormat.format(v)\n if (v >= 10) return oneDecimalFormat.format(v)\n return twoDecimalFormat.format(v)\n}\n\nexport function EnergyBreakdown({\n title,\n subtitle,\n items,\n centerSub = 'kWh',\n}: EnergyBreakdownProps) {\n const sortedItems = useMemo(\n () => [...items].sort((a, b) => b.value - a.value),\n [items],\n )\n\n const total = items.reduce((s, i) => s + i.value, 0)\n const centerTotal = items\n .filter((i) => !i.excludeFromCenterTotal)\n .reduce((s, i) => s + i.value, 0)\n\n const dataEmpty = total === 0\n\n if (dataEmpty) return null\n\n return (\n <div className=\"flex flex-col gap-4 pt-3 pb-5\">\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-sm font-semibold text-gray\">{title}</span>\n <span className=\"text-xs text-gray-light\">{subtitle}</span>\n </div>\n\n <div className=\"flex items-center gap-6\">\n <DonutChart\n centerLabel={formatBreakdownCenter(centerTotal)}\n centerSub={centerSub}\n segments={sortedItems.map(({ value, color }) => ({ value, color }))}\n />\n\n <div className=\"flex flex-1 flex-col gap-3\">\n {sortedItems.map(({ label, value, color }) => {\n const pct = (value / total) * 100\n return (\n <div key={label} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <span className=\"min-w-0 truncate text-sm font-medium text-gray\">\n {label}\n </span>\n <span className=\"flex shrink-0 items-baseline gap-1.5 text-xs tabular-nums\">\n <span className=\"text-gray-light\">\n {formatEnergy(value)}\n </span>\n <span className=\"font-semibold text-gray\">\n {`${integerFormat.format(pct)}${NARROW_NBSP}%`}\n </span>\n </span>\n </div>\n <div className=\"h-1 w-full overflow-hidden rounded-full bg-gray-a4\">\n <div\n className=\"h-full rounded-full\"\n style={{ width: `${pct}%`, background: color }}\n />\n </div>\n </div>\n )\n })}\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;AAyBA,SAAS,sBAAsB,GAAW;CACxC,IAAI,KAAK,KAAM,OAAO,gBAAgB,CAAC;CACvC,IAAI,KAAK,KAAK,OAAO,cAAc,OAAO,CAAC;CAC3C,IAAI,KAAK,IAAI,OAAO,iBAAiB,OAAO,CAAC;CAC7C,OAAO,iBAAiB,OAAO,CAAC;AAClC;AAEA,SAAgB,gBAAgB,EAC9B,OACA,UACA,OACA,YAAY,SACW;CACvB,MAAM,cAAc,cACZ,CAAC,GAAG,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,GACjD,CAAC,KAAK,CACR;CAEA,MAAM,QAAQ,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;CACnD,MAAM,cAAc,MACjB,QAAQ,MAAM,CAAC,EAAE,sBAAsB,EACvC,QAAQ,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;CAIlC,IAFkB,UAAU,GAEb,OAAO;CAEtB,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,QAAD;IAAM,WAAU;cAAmC;GAAY,CAAA,GAC/D,oBAAC,QAAD;IAAM,WAAU;cAA2B;GAAe,CAAA,CACvD;MAEL,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,YAAD;IACE,aAAa,sBAAsB,WAAW;IACnC;IACX,UAAU,YAAY,KAAK,EAAE,OAAO,aAAa;KAAE;KAAO;IAAM,EAAE;GACnE,CAAA,GAED,oBAAC,OAA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