@epilot/spark-ui 0.20.1 → 0.20.2
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/attachment.d.cts +2 -2
- package/dist/components/attachment.d.ts +2 -2
- 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 +3 -3
- package/dist/components/bar-chart.cjs.map +1 -1
- 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 +3 -3
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +11 -10
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +4 -3
- 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/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-date.cjs +4 -3
- package/dist/components/input-date.cjs.map +1 -1
- package/dist/components/input-date.d.cts +3 -1
- package/dist/components/input-date.d.ts +3 -1
- package/dist/components/input-date.js +2 -1
- 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-group.d.cts +1 -1
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/input-otp.cjs +3 -3
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input.cjs +3 -3
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.js +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 +6 -6
- package/dist/components/line-chart.cjs.map +1 -1
- package/dist/components/line-chart.js +3 -3
- 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 +7 -2
- package/dist/components/list.d.ts +7 -2
- 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 +7 -7
- 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 +3 -3
- package/dist/components/power-history-chart.cjs.map +1 -1
- package/dist/components/power-history-chart.js +1 -1
- 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/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 +2 -16
- package/dist/components/segmented-control.d.ts +2 -16
- package/dist/components/segmented-control.js +5 -5
- package/dist/components/segmented-control.js.map +1 -1
- package/dist/components/select.cjs +12 -12
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +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/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 +1 -8
- package/dist/components/tabs.d.ts +1 -8
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +3 -3
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +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 +39 -14
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.d.cts +15 -2
- package/dist/components/toast.d.ts +15 -2
- package/dist/components/toast.js +32 -7
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.cjs +40 -0
- package/dist/components/toggle-group.cjs.map +1 -0
- package/dist/components/toggle-group.d.cts +28 -0
- package/dist/components/toggle-group.d.ts +28 -0
- package/dist/components/toggle-group.js +37 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.cjs +69 -0
- package/dist/components/toggle.cjs.map +1 -0
- package/dist/components/toggle.d.cts +23 -0
- package/dist/components/toggle.d.ts +23 -0
- package/dist/components/toggle.js +66 -0
- package/dist/components/toggle.js.map +1 -0
- 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/lib/toggle-group-context.cjs +12 -0
- package/dist/lib/toggle-group-context.cjs.map +1 -0
- package/dist/lib/toggle-group-context.d.cts +17 -0
- package/dist/lib/toggle-group-context.d.ts +17 -0
- package/dist/lib/toggle-group-context.js +9 -0
- package/dist/lib/toggle-group-context.js.map +1 -0
- package/dist/styles/spark-default.css +11 -0
- package/dist/styles/theme.css +15 -4
- 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 +1 -0
- package/dist/utils/format.cjs.map +1 -1
- package/dist/utils/format.d.cts +2 -1
- package/dist/utils/format.d.ts +2 -1
- package/dist/utils/format.js +1 -1
- package/dist/utils/format.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 class_variance_authority = require("class-variance-authority");
|
|
8
|
-
let
|
|
8
|
+
let cn = require("cn");
|
|
9
9
|
//#region src/components/info-block.tsx
|
|
10
10
|
const infoBlockVariants = (0, class_variance_authority.cva)("flex items-center gap-3", {
|
|
11
11
|
variants: { variant: {
|
|
@@ -15,49 +15,49 @@ const infoBlockVariants = (0, class_variance_authority.cva)("flex items-center g
|
|
|
15
15
|
defaultVariants: { variant: "default" }
|
|
16
16
|
});
|
|
17
17
|
const InfoBlock = react.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
18
|
-
className: (0,
|
|
18
|
+
className: (0, cn.cn)(infoBlockVariants({ variant }), className),
|
|
19
19
|
ref,
|
|
20
20
|
...props
|
|
21
21
|
}));
|
|
22
22
|
InfoBlock.displayName = "InfoBlock";
|
|
23
23
|
const InfoBlockIcon = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24
|
-
className: (0,
|
|
24
|
+
className: (0, cn.cn)("flex size-10 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]", className),
|
|
25
25
|
ref,
|
|
26
26
|
...props
|
|
27
27
|
}));
|
|
28
28
|
InfoBlockIcon.displayName = "InfoBlockIcon";
|
|
29
29
|
const InfoBlockContent = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
30
|
-
className: (0,
|
|
30
|
+
className: (0, cn.cn)("flex min-w-0 flex-1 flex-col gap-2", className),
|
|
31
31
|
ref,
|
|
32
32
|
...props
|
|
33
33
|
}));
|
|
34
34
|
InfoBlockContent.displayName = "InfoBlockContent";
|
|
35
35
|
const InfoBlockHeader = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
36
|
-
className: (0,
|
|
36
|
+
className: (0, cn.cn)("flex items-center justify-between gap-2", className),
|
|
37
37
|
ref,
|
|
38
38
|
...props
|
|
39
39
|
}));
|
|
40
40
|
InfoBlockHeader.displayName = "InfoBlockHeader";
|
|
41
41
|
const InfoBlockTitle = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
42
|
-
className: (0,
|
|
42
|
+
className: (0, cn.cn)("text-sm font-medium text-gray", className),
|
|
43
43
|
ref,
|
|
44
44
|
...props
|
|
45
45
|
}));
|
|
46
46
|
InfoBlockTitle.displayName = "InfoBlockTitle";
|
|
47
47
|
const InfoBlockLabel = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
48
|
-
className: (0,
|
|
48
|
+
className: (0, cn.cn)("text-xs font-medium text-gray-light", className),
|
|
49
49
|
ref,
|
|
50
50
|
...props
|
|
51
51
|
}));
|
|
52
52
|
InfoBlockLabel.displayName = "InfoBlockLabel";
|
|
53
53
|
const InfoBlockDescription = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
54
|
-
className: (0,
|
|
54
|
+
className: (0, cn.cn)("text-xs text-gray-light", className),
|
|
55
55
|
ref,
|
|
56
56
|
...props
|
|
57
57
|
}));
|
|
58
58
|
InfoBlockDescription.displayName = "InfoBlockDescription";
|
|
59
59
|
const InfoBlockValue = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
60
|
-
className: (0,
|
|
60
|
+
className: (0, cn.cn)("text-lg font-bold text-gray tabular-nums", className),
|
|
61
61
|
ref,
|
|
62
62
|
...props
|
|
63
63
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-block.cjs","names":["React"],"sources":["../../src/components/info-block.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\nconst infoBlockVariants = cva('flex items-center gap-3', {\n variants: {\n variant: {\n default: 'rounded-lg border border-gray p-4',\n bare: 'rounded-none border-none',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n})\n\nconst InfoBlock = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof infoBlockVariants>\n>(({ className, variant, ...props }, ref) => (\n <div\n className={cn(infoBlockVariants({ variant }), className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlock.displayName = 'InfoBlock'\n\nconst InfoBlockIcon = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-10 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockIcon.displayName = 'InfoBlockIcon'\n\nconst InfoBlockContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-2', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockContent.displayName = 'InfoBlockContent'\n\nconst InfoBlockHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockHeader.displayName = 'InfoBlockHeader'\n\nconst InfoBlockTitle = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n className={cn('text-sm font-medium text-gray', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockTitle.displayName = 'InfoBlockTitle'\n\nconst InfoBlockLabel = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n className={cn('text-xs font-medium text-gray-light', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockLabel.displayName = 'InfoBlockLabel'\n\nconst InfoBlockDescription = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n className={cn('text-xs text-gray-light', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockDescription.displayName = 'InfoBlockDescription'\n\nconst InfoBlockValue = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n className={cn('text-lg font-bold text-gray tabular-nums', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockValue.displayName = 'InfoBlockValue'\n\nexport {\n InfoBlock,\n InfoBlockContent,\n InfoBlockDescription,\n InfoBlockHeader,\n InfoBlockIcon,\n InfoBlockLabel,\n InfoBlockTitle,\n InfoBlockValue,\n}\n"],"mappings":";;;;;;;;;AAIA,MAAM,qBAAA,GAAA,yBAAA,KAAwB,2BAA2B;CACvD,UAAU,EACR,SAAS;EACP,SAAS;EACT,MAAM;CACR,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CAAC;AAED,MAAM,YAAYA,MAAM,YAGrB,EAAE,WAAW,SAAS,GAAG,SAAS,QACnC,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"info-block.cjs","names":["React"],"sources":["../../src/components/info-block.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\nconst infoBlockVariants = cva('flex items-center gap-3', {\n variants: {\n variant: {\n default: 'rounded-lg border border-gray p-4',\n bare: 'rounded-none border-none',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n})\n\nconst InfoBlock = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof infoBlockVariants>\n>(({ className, variant, ...props }, ref) => (\n <div\n className={cn(infoBlockVariants({ variant }), className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlock.displayName = 'InfoBlock'\n\nconst InfoBlockIcon = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n // max() pill escape (matches Icon): a tile stays rounded-md at low Roundness but\n // becomes a circle at large/full, same as it did pre-harmonization via clamping.\n 'flex size-10 shrink-0 items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))]',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockIcon.displayName = 'InfoBlockIcon'\n\nconst InfoBlockContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn('flex min-w-0 flex-1 flex-col gap-2', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockContent.displayName = 'InfoBlockContent'\n\nconst InfoBlockHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockHeader.displayName = 'InfoBlockHeader'\n\nconst InfoBlockTitle = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n className={cn('text-sm font-medium text-gray', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockTitle.displayName = 'InfoBlockTitle'\n\nconst InfoBlockLabel = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n className={cn('text-xs font-medium text-gray-light', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockLabel.displayName = 'InfoBlockLabel'\n\nconst InfoBlockDescription = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n className={cn('text-xs text-gray-light', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockDescription.displayName = 'InfoBlockDescription'\n\nconst InfoBlockValue = React.forwardRef<\n HTMLSpanElement,\n React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n <span\n className={cn('text-lg font-bold text-gray tabular-nums', className)}\n ref={ref}\n {...props}\n />\n))\n\nInfoBlockValue.displayName = 'InfoBlockValue'\n\nexport {\n InfoBlock,\n InfoBlockContent,\n InfoBlockDescription,\n InfoBlockHeader,\n InfoBlockIcon,\n InfoBlockLabel,\n InfoBlockTitle,\n InfoBlockValue,\n}\n"],"mappings":";;;;;;;;;AAIA,MAAM,qBAAA,GAAA,yBAAA,KAAwB,2BAA2B;CACvD,UAAU,EACR,SAAS;EACP,SAAS;EACT,MAAM;CACR,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CAAC;AAED,MAAM,YAAYA,MAAM,YAGrB,EAAE,WAAW,SAAS,GAAG,SAAS,QACnC,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IAAc,kBAAkB,EAAE,QAAQ,CAAC,GAAG,SAAS;CAClD;CACL,GAAI;AACL,CAAA,CACF;AAED,UAAU,cAAc;AAExB,MAAM,gBAAgBA,MAAM,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IAGE,sHACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,cAAc,cAAc;AAE5B,MAAM,mBAAmBA,MAAM,YAG5B,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IAAc,sCAAsC,SAAS;CACxD;CACL,GAAI;AACL,CAAA,CACF;AAED,iBAAiB,cAAc;AAE/B,MAAM,kBAAkBA,MAAM,YAG3B,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IAAc,2CAA2C,SAAS;CAC7D;CACL,GAAI;AACL,CAAA,CACF;AAED,gBAAgB,cAAc;AAE9B,MAAM,iBAAiBA,MAAM,YAG1B,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,YAAA,GAAA,GAAA,IAAc,iCAAiC,SAAS;CACnD;CACL,GAAI;AACL,CAAA,CACF;AAED,eAAe,cAAc;AAE7B,MAAM,iBAAiBA,MAAM,YAG1B,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,YAAA,GAAA,GAAA,IAAc,uCAAuC,SAAS;CACzD;CACL,GAAI;AACL,CAAA,CACF;AAED,eAAe,cAAc;AAE7B,MAAM,uBAAuBA,MAAM,YAGhC,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,YAAA,GAAA,GAAA,IAAc,2BAA2B,SAAS;CAC7C;CACL,GAAI;AACL,CAAA,CACF;AAED,qBAAqB,cAAc;AAEnC,MAAM,iBAAiBA,MAAM,YAG1B,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,QAAD;CACE,YAAA,GAAA,GAAA,IAAc,4CAA4C,SAAS;CAC9D;CACL,GAAI;AACL,CAAA,CACF;AAED,eAAe,cAAc"}
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/info-block.d.ts
|
|
7
7
|
declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "default" | "bare" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/info-block.d.ts
|
|
7
7
|
declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "default" | "bare" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
11
11
|
declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -11,7 +11,7 @@ react = require_chunk.__toESM(react);
|
|
|
11
11
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
12
12
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
13
|
let ictus = require("ictus");
|
|
14
|
-
let
|
|
14
|
+
let cn = require("cn");
|
|
15
15
|
//#region src/components/input-date.tsx
|
|
16
16
|
function useControllableState({ defaultProp, onChange, prop }) {
|
|
17
17
|
const [uncontrolled, setUncontrolled] = react.useState(defaultProp);
|
|
@@ -21,7 +21,7 @@ function useControllableState({ defaultProp, onChange, prop }) {
|
|
|
21
21
|
onChange?.(next);
|
|
22
22
|
}, [isControlled, onChange])];
|
|
23
23
|
}
|
|
24
|
-
const InputDate = react.forwardRef(function InputDate({ calendarLabel, calendarProps, className, defaultOpen = false, defaultValue = "", disabled, id, onDateChange, onKeyDown, onOpenChange, onValueChange, open: openProp, pickerOnly = false, placeholder, separator = ".", value: valueProp, ...props }, ref) {
|
|
24
|
+
const InputDate = react.forwardRef(function InputDate({ calendarLabel, calendarProps, className, container, defaultOpen = false, defaultValue = "", disabled, id, onDateChange, onKeyDown, onOpenChange, onValueChange, open: openProp, pickerOnly = false, placeholder, separator = ".", value: valueProp, ...props }, ref) {
|
|
25
25
|
const inputRef = react.useRef(null);
|
|
26
26
|
const [text, setText] = useControllableState({
|
|
27
27
|
defaultProp: defaultValue,
|
|
@@ -65,7 +65,7 @@ const InputDate = react.forwardRef(function InputDate({ calendarLabel, calendarP
|
|
|
65
65
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_input_group.InputGroupInput, {
|
|
66
66
|
autoComplete: "off",
|
|
67
67
|
...props,
|
|
68
|
-
className: (0,
|
|
68
|
+
className: (0, cn.cn)(pickerOnly && "cursor-pointer"),
|
|
69
69
|
disabled,
|
|
70
70
|
id,
|
|
71
71
|
inputMode: pickerOnly ? void 0 : "numeric",
|
|
@@ -118,6 +118,7 @@ const InputDate = react.forwardRef(function InputDate({ calendarLabel, calendarP
|
|
|
118
118
|
align: "start",
|
|
119
119
|
"aria-label": calendarLabel,
|
|
120
120
|
className: "w-auto p-0",
|
|
121
|
+
container,
|
|
121
122
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_calendar.Calendar, {
|
|
122
123
|
...calendarProps,
|
|
123
124
|
mode: "single",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-date.cjs","names":["React","Popover","PopoverAnchor","InputGroup","InputGroupInput","InputGroupAddon","PopoverTrigger","Button","CalendarMonth","PopoverContent","Calendar"],"sources":["../../src/components/input-date.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport { apply, formatDate, isDateMaskKey, parseDate } from 'ictus'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\nimport { Calendar, type CalendarProps } from './calendar'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\nfunction useControllableState<T>({\n defaultProp,\n onChange,\n prop,\n}: {\n defaultProp: T\n onChange?: (value: T) => void\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? prop : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return [value, setValue] as const\n}\n\nexport type InputDateProps = Omit<\n React.ComponentProps<'input'>,\n 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'\n> & {\n calendarLabel: string\n calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>\n defaultOpen?: boolean\n defaultValue?: string\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n pickerOnly?: boolean\n separator?: string\n value?: string\n}\n\nconst InputDate = React.forwardRef<HTMLInputElement, InputDateProps>(\n function InputDate(\n {\n calendarLabel,\n calendarProps,\n className,\n defaultOpen = false,\n defaultValue = '',\n disabled,\n id,\n onDateChange,\n onKeyDown,\n onOpenChange,\n onValueChange,\n open: openProp,\n pickerOnly = false,\n placeholder,\n separator = '.',\n value: valueProp,\n ...props\n },\n ref,\n ) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n onChange: onValueChange,\n prop: valueProp,\n })\n const [open, setOpenState] = useControllableState({\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n prop: openProp,\n })\n const selected = parseDate(text)\n const [month, setMonth] = React.useState<Date | undefined>(\n () => selected ?? calendarProps?.month,\n )\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && calendarProps?.month === undefined) {\n setMonth(parseDate(text) ?? new Date())\n }\n setOpenState(next)\n },\n [calendarProps?.month, setOpenState, text],\n )\n\n const commit = React.useCallback(\n (next: string) => {\n if (next === text) return\n setText(next)\n onDateChange?.(parseDate(next))\n },\n [onDateChange, setText, text],\n )\n\n const setInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n return (\n <Popover onOpenChange={setOpen} open={open}>\n <PopoverAnchor render={<InputGroup className={className} />}>\n <InputGroupInput\n autoComplete=\"off\"\n {...props}\n className={cn(pickerOnly && 'cursor-pointer')}\n disabled={disabled}\n id={id}\n inputMode={pickerOnly ? undefined : 'numeric'}\n onChange={() => {}}\n onClick={\n pickerOnly && !disabled\n ? (event) => {\n props.onClick?.(event)\n if (!event.defaultPrevented) setOpen(true)\n }\n : props.onClick\n }\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n setOpen(true)\n return\n }\n if (pickerOnly || !isDateMaskKey(event.key)) return\n event.preventDefault()\n const next = apply({\n caret: event.currentTarget.selectionStart ?? 0,\n key: event.key,\n selectionEnd: event.currentTarget.selectionEnd ?? undefined,\n separator,\n value: event.currentTarget.value,\n })\n commit(next.value)\n const caret = next.caret\n const input = inputRef.current\n requestAnimationFrame(() => {\n input?.setSelectionRange(caret, caret)\n })\n }}\n placeholder={placeholder ?? `DD${separator}MM${separator}YYYY`}\n readOnly={pickerOnly}\n ref={setInputRef}\n spellCheck={false}\n value={text}\n />\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n render={\n <Button\n aria-label={calendarLabel}\n color=\"neutral\"\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n >\n <CalendarMonth />\n </Button>\n }\n />\n </InputGroupAddon>\n </PopoverAnchor>\n <PopoverContent\n align=\"start\"\n aria-label={calendarLabel}\n className=\"w-auto p-0\"\n >\n <Calendar\n {...calendarProps}\n mode=\"single\"\n month={calendarProps?.month ?? month}\n onMonthChange={(next) => {\n calendarProps?.onMonthChange?.(next)\n if (calendarProps?.month === undefined) setMonth(next)\n }}\n onSelect={(next) => {\n commit(next ? formatDate(next, separator) : '')\n setOpen(false)\n }}\n selected={selected}\n />\n </PopoverContent>\n </Popover>\n )\n },\n)\n\nexport { InputDate }\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,SAAS,qBAAwB,EAC/B,aACA,UACA,QAKC;CACD,MAAM,CAAC,cAAc,mBAAmBA,MAAM,SAAS,WAAW;CAClE,MAAM,eAAe,SAAS,KAAA;CAW9B,OAAO,CAVO,eAAe,OAAO,cAEnBA,MAAM,aACpB,SAAY;EACX,IAAI,CAAC,cAAc,gBAAgB,IAAI;EACvC,WAAW,IAAI;CACjB,GACA,CAAC,cAAc,QAAQ,CAGH,CAAC;AACzB;
|
|
1
|
+
{"version":3,"file":"input-date.cjs","names":["React","Popover","PopoverAnchor","InputGroup","InputGroupInput","InputGroupAddon","PopoverTrigger","Button","CalendarMonth","PopoverContent","Calendar"],"sources":["../../src/components/input-date.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport { apply, formatDate, isDateMaskKey, parseDate } from 'ictus'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\nimport { Calendar, type CalendarProps } from './calendar'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\nfunction useControllableState<T>({\n defaultProp,\n onChange,\n prop,\n}: {\n defaultProp: T\n onChange?: (value: T) => void\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? prop : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return [value, setValue] as const\n}\n\nexport type InputDateProps = Omit<\n React.ComponentProps<'input'>,\n 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'\n> & {\n calendarLabel: string\n calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>\n /** Element the calendar popup mounts into, e.g. the drawer it sits in. */\n container?: React.ComponentProps<typeof PopoverContent>['container']\n defaultOpen?: boolean\n defaultValue?: string\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n pickerOnly?: boolean\n separator?: string\n value?: string\n}\n\nconst InputDate = React.forwardRef<HTMLInputElement, InputDateProps>(\n function InputDate(\n {\n calendarLabel,\n calendarProps,\n className,\n container,\n defaultOpen = false,\n defaultValue = '',\n disabled,\n id,\n onDateChange,\n onKeyDown,\n onOpenChange,\n onValueChange,\n open: openProp,\n pickerOnly = false,\n placeholder,\n separator = '.',\n value: valueProp,\n ...props\n },\n ref,\n ) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n onChange: onValueChange,\n prop: valueProp,\n })\n const [open, setOpenState] = useControllableState({\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n prop: openProp,\n })\n const selected = parseDate(text)\n const [month, setMonth] = React.useState<Date | undefined>(\n () => selected ?? calendarProps?.month,\n )\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && calendarProps?.month === undefined) {\n setMonth(parseDate(text) ?? new Date())\n }\n setOpenState(next)\n },\n [calendarProps?.month, setOpenState, text],\n )\n\n const commit = React.useCallback(\n (next: string) => {\n if (next === text) return\n setText(next)\n onDateChange?.(parseDate(next))\n },\n [onDateChange, setText, text],\n )\n\n const setInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n return (\n <Popover onOpenChange={setOpen} open={open}>\n <PopoverAnchor render={<InputGroup className={className} />}>\n <InputGroupInput\n autoComplete=\"off\"\n {...props}\n className={cn(pickerOnly && 'cursor-pointer')}\n disabled={disabled}\n id={id}\n inputMode={pickerOnly ? undefined : 'numeric'}\n onChange={() => {}}\n onClick={\n pickerOnly && !disabled\n ? (event) => {\n props.onClick?.(event)\n if (!event.defaultPrevented) setOpen(true)\n }\n : props.onClick\n }\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n setOpen(true)\n return\n }\n if (pickerOnly || !isDateMaskKey(event.key)) return\n event.preventDefault()\n const next = apply({\n caret: event.currentTarget.selectionStart ?? 0,\n key: event.key,\n selectionEnd: event.currentTarget.selectionEnd ?? undefined,\n separator,\n value: event.currentTarget.value,\n })\n commit(next.value)\n const caret = next.caret\n const input = inputRef.current\n requestAnimationFrame(() => {\n input?.setSelectionRange(caret, caret)\n })\n }}\n placeholder={placeholder ?? `DD${separator}MM${separator}YYYY`}\n readOnly={pickerOnly}\n ref={setInputRef}\n spellCheck={false}\n value={text}\n />\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n render={\n <Button\n aria-label={calendarLabel}\n color=\"neutral\"\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n >\n <CalendarMonth />\n </Button>\n }\n />\n </InputGroupAddon>\n </PopoverAnchor>\n <PopoverContent\n align=\"start\"\n aria-label={calendarLabel}\n className=\"w-auto p-0\"\n container={container}\n >\n <Calendar\n {...calendarProps}\n mode=\"single\"\n month={calendarProps?.month ?? month}\n onMonthChange={(next) => {\n calendarProps?.onMonthChange?.(next)\n if (calendarProps?.month === undefined) setMonth(next)\n }}\n onSelect={(next) => {\n commit(next ? formatDate(next, separator) : '')\n setOpen(false)\n }}\n selected={selected}\n />\n </PopoverContent>\n </Popover>\n )\n },\n)\n\nexport { InputDate }\n"],"mappings":";;;;;;;;;;;;;;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ACC,+BAAAA,iBAAD;IAAiB,OAAM;cACrB,iBAAA,GAAA,kBAAA,KAACC,2BAAAA,gBAAD,EACE,QACE,iBAAA,GAAA,kBAAA,KAACC,0BAAAA,QAAD;KACE,cAAY;KACZ,OAAM;KACI;KACV,MAAK;KACL,cAAa;eAEb,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,eAAD,CAAgB,CAAA;IACV,CAAA,EAEX,CAAA;GACc,CAAA,CACJ;MACf,iBAAA,GAAA,kBAAA,KAACC,2BAAAA,gBAAD;GACE,OAAM;GACN,cAAY;GACZ,WAAU;GACC;aAEX,iBAAA,GAAA,kBAAA,KAACC,4BAAAA,UAAD;IACE,GAAI;IACJ,MAAK;IACL,OAAO,eAAe,SAAS;IAC/B,gBAAgB,SAAS;KACvB,eAAe,gBAAgB,IAAI;KACnC,IAAI,eAAe,UAAU,KAAA,GAAW,SAAS,IAAI;IACvD;IACA,WAAW,SAAS;KAClB,OAAO,QAAA,GAAA,MAAA,YAAkB,MAAM,SAAS,IAAI,EAAE;KAC9C,QAAQ,KAAK;IACf;IACU;GACX,CAAA;EACa,CAAA,CACT;;AAEb,CACF"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { CalendarProps } from "./calendar.cjs";
|
|
4
|
+
import { PopoverContent } from "./popover.cjs";
|
|
4
5
|
import * as React$1 from "react";
|
|
5
6
|
|
|
6
7
|
//#region src/components/input-date.d.ts
|
|
7
8
|
type InputDateProps = Omit<React$1.ComponentProps<'input'>, 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'> & {
|
|
8
9
|
calendarLabel: string;
|
|
9
|
-
calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>;
|
|
10
|
+
calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>; /** Element the calendar popup mounts into, e.g. the drawer it sits in. */
|
|
11
|
+
container?: React$1.ComponentProps<typeof PopoverContent>['container'];
|
|
10
12
|
defaultOpen?: boolean;
|
|
11
13
|
defaultValue?: string;
|
|
12
14
|
onDateChange?: (date: Date | undefined) => void;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { CalendarProps } from "./calendar.js";
|
|
4
|
+
import { PopoverContent } from "./popover.js";
|
|
4
5
|
import * as React$1 from "react";
|
|
5
6
|
|
|
6
7
|
//#region src/components/input-date.d.ts
|
|
7
8
|
type InputDateProps = Omit<React$1.ComponentProps<'input'>, 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'> & {
|
|
8
9
|
calendarLabel: string;
|
|
9
|
-
calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>;
|
|
10
|
+
calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>; /** Element the calendar popup mounts into, e.g. the drawer it sits in. */
|
|
11
|
+
container?: React$1.ComponentProps<typeof PopoverContent>['container'];
|
|
10
12
|
defaultOpen?: boolean;
|
|
11
13
|
defaultValue?: string;
|
|
12
14
|
onDateChange?: (date: Date | undefined) => void;
|
|
@@ -18,7 +18,7 @@ function useControllableState({ defaultProp, onChange, prop }) {
|
|
|
18
18
|
onChange?.(next);
|
|
19
19
|
}, [isControlled, onChange])];
|
|
20
20
|
}
|
|
21
|
-
const InputDate = React$1.forwardRef(function InputDate({ calendarLabel, calendarProps, className, defaultOpen = false, defaultValue = "", disabled, id, onDateChange, onKeyDown, onOpenChange, onValueChange, open: openProp, pickerOnly = false, placeholder, separator = ".", value: valueProp, ...props }, ref) {
|
|
21
|
+
const InputDate = React$1.forwardRef(function InputDate({ calendarLabel, calendarProps, className, container, defaultOpen = false, defaultValue = "", disabled, id, onDateChange, onKeyDown, onOpenChange, onValueChange, open: openProp, pickerOnly = false, placeholder, separator = ".", value: valueProp, ...props }, ref) {
|
|
22
22
|
const inputRef = React$1.useRef(null);
|
|
23
23
|
const [text, setText] = useControllableState({
|
|
24
24
|
defaultProp: defaultValue,
|
|
@@ -115,6 +115,7 @@ const InputDate = React$1.forwardRef(function InputDate({ calendarLabel, calenda
|
|
|
115
115
|
align: "start",
|
|
116
116
|
"aria-label": calendarLabel,
|
|
117
117
|
className: "w-auto p-0",
|
|
118
|
+
container,
|
|
118
119
|
children: /* @__PURE__ */ jsx(Calendar, {
|
|
119
120
|
...calendarProps,
|
|
120
121
|
mode: "single",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-date.js","names":["React"],"sources":["../../src/components/input-date.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport { apply, formatDate, isDateMaskKey, parseDate } from 'ictus'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\nimport { Calendar, type CalendarProps } from './calendar'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\nfunction useControllableState<T>({\n defaultProp,\n onChange,\n prop,\n}: {\n defaultProp: T\n onChange?: (value: T) => void\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? prop : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return [value, setValue] as const\n}\n\nexport type InputDateProps = Omit<\n React.ComponentProps<'input'>,\n 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'\n> & {\n calendarLabel: string\n calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>\n defaultOpen?: boolean\n defaultValue?: string\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n pickerOnly?: boolean\n separator?: string\n value?: string\n}\n\nconst InputDate = React.forwardRef<HTMLInputElement, InputDateProps>(\n function InputDate(\n {\n calendarLabel,\n calendarProps,\n className,\n defaultOpen = false,\n defaultValue = '',\n disabled,\n id,\n onDateChange,\n onKeyDown,\n onOpenChange,\n onValueChange,\n open: openProp,\n pickerOnly = false,\n placeholder,\n separator = '.',\n value: valueProp,\n ...props\n },\n ref,\n ) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n onChange: onValueChange,\n prop: valueProp,\n })\n const [open, setOpenState] = useControllableState({\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n prop: openProp,\n })\n const selected = parseDate(text)\n const [month, setMonth] = React.useState<Date | undefined>(\n () => selected ?? calendarProps?.month,\n )\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && calendarProps?.month === undefined) {\n setMonth(parseDate(text) ?? new Date())\n }\n setOpenState(next)\n },\n [calendarProps?.month, setOpenState, text],\n )\n\n const commit = React.useCallback(\n (next: string) => {\n if (next === text) return\n setText(next)\n onDateChange?.(parseDate(next))\n },\n [onDateChange, setText, text],\n )\n\n const setInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n return (\n <Popover onOpenChange={setOpen} open={open}>\n <PopoverAnchor render={<InputGroup className={className} />}>\n <InputGroupInput\n autoComplete=\"off\"\n {...props}\n className={cn(pickerOnly && 'cursor-pointer')}\n disabled={disabled}\n id={id}\n inputMode={pickerOnly ? undefined : 'numeric'}\n onChange={() => {}}\n onClick={\n pickerOnly && !disabled\n ? (event) => {\n props.onClick?.(event)\n if (!event.defaultPrevented) setOpen(true)\n }\n : props.onClick\n }\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n setOpen(true)\n return\n }\n if (pickerOnly || !isDateMaskKey(event.key)) return\n event.preventDefault()\n const next = apply({\n caret: event.currentTarget.selectionStart ?? 0,\n key: event.key,\n selectionEnd: event.currentTarget.selectionEnd ?? undefined,\n separator,\n value: event.currentTarget.value,\n })\n commit(next.value)\n const caret = next.caret\n const input = inputRef.current\n requestAnimationFrame(() => {\n input?.setSelectionRange(caret, caret)\n })\n }}\n placeholder={placeholder ?? `DD${separator}MM${separator}YYYY`}\n readOnly={pickerOnly}\n ref={setInputRef}\n spellCheck={false}\n value={text}\n />\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n render={\n <Button\n aria-label={calendarLabel}\n color=\"neutral\"\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n >\n <CalendarMonth />\n </Button>\n }\n />\n </InputGroupAddon>\n </PopoverAnchor>\n <PopoverContent\n align=\"start\"\n aria-label={calendarLabel}\n className=\"w-auto p-0\"\n >\n <Calendar\n {...calendarProps}\n mode=\"single\"\n month={calendarProps?.month ?? month}\n onMonthChange={(next) => {\n calendarProps?.onMonthChange?.(next)\n if (calendarProps?.month === undefined) setMonth(next)\n }}\n onSelect={(next) => {\n commit(next ? formatDate(next, separator) : '')\n setOpen(false)\n }}\n selected={selected}\n />\n </PopoverContent>\n </Popover>\n )\n },\n)\n\nexport { InputDate }\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAS,qBAAwB,EAC/B,aACA,UACA,QAKC;CACD,MAAM,CAAC,cAAc,mBAAmBA,QAAM,SAAS,WAAW;CAClE,MAAM,eAAe,SAAS,KAAA;CAW9B,OAAO,CAVO,eAAe,OAAO,cAEnBA,QAAM,aACpB,SAAY;EACX,IAAI,CAAC,cAAc,gBAAgB,IAAI;EACvC,WAAW,IAAI;CACjB,GACA,CAAC,cAAc,QAAQ,CAGH,CAAC;AACzB;
|
|
1
|
+
{"version":3,"file":"input-date.js","names":["React"],"sources":["../../src/components/input-date.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport { apply, formatDate, isDateMaskKey, parseDate } from 'ictus'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\nimport { Calendar, type CalendarProps } from './calendar'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\nfunction useControllableState<T>({\n defaultProp,\n onChange,\n prop,\n}: {\n defaultProp: T\n onChange?: (value: T) => void\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? prop : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return [value, setValue] as const\n}\n\nexport type InputDateProps = Omit<\n React.ComponentProps<'input'>,\n 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'\n> & {\n calendarLabel: string\n calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>\n /** Element the calendar popup mounts into, e.g. the drawer it sits in. */\n container?: React.ComponentProps<typeof PopoverContent>['container']\n defaultOpen?: boolean\n defaultValue?: string\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n pickerOnly?: boolean\n separator?: string\n value?: string\n}\n\nconst InputDate = React.forwardRef<HTMLInputElement, InputDateProps>(\n function InputDate(\n {\n calendarLabel,\n calendarProps,\n className,\n container,\n defaultOpen = false,\n defaultValue = '',\n disabled,\n id,\n onDateChange,\n onKeyDown,\n onOpenChange,\n onValueChange,\n open: openProp,\n pickerOnly = false,\n placeholder,\n separator = '.',\n value: valueProp,\n ...props\n },\n ref,\n ) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n onChange: onValueChange,\n prop: valueProp,\n })\n const [open, setOpenState] = useControllableState({\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n prop: openProp,\n })\n const selected = parseDate(text)\n const [month, setMonth] = React.useState<Date | undefined>(\n () => selected ?? calendarProps?.month,\n )\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && calendarProps?.month === undefined) {\n setMonth(parseDate(text) ?? new Date())\n }\n setOpenState(next)\n },\n [calendarProps?.month, setOpenState, text],\n )\n\n const commit = React.useCallback(\n (next: string) => {\n if (next === text) return\n setText(next)\n onDateChange?.(parseDate(next))\n },\n [onDateChange, setText, text],\n )\n\n const setInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n return (\n <Popover onOpenChange={setOpen} open={open}>\n <PopoverAnchor render={<InputGroup className={className} />}>\n <InputGroupInput\n autoComplete=\"off\"\n {...props}\n className={cn(pickerOnly && 'cursor-pointer')}\n disabled={disabled}\n id={id}\n inputMode={pickerOnly ? undefined : 'numeric'}\n onChange={() => {}}\n onClick={\n pickerOnly && !disabled\n ? (event) => {\n props.onClick?.(event)\n if (!event.defaultPrevented) setOpen(true)\n }\n : props.onClick\n }\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n setOpen(true)\n return\n }\n if (pickerOnly || !isDateMaskKey(event.key)) return\n event.preventDefault()\n const next = apply({\n caret: event.currentTarget.selectionStart ?? 0,\n key: event.key,\n selectionEnd: event.currentTarget.selectionEnd ?? undefined,\n separator,\n value: event.currentTarget.value,\n })\n commit(next.value)\n const caret = next.caret\n const input = inputRef.current\n requestAnimationFrame(() => {\n input?.setSelectionRange(caret, caret)\n })\n }}\n placeholder={placeholder ?? `DD${separator}MM${separator}YYYY`}\n readOnly={pickerOnly}\n ref={setInputRef}\n spellCheck={false}\n value={text}\n />\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n render={\n <Button\n aria-label={calendarLabel}\n color=\"neutral\"\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n >\n <CalendarMonth />\n </Button>\n }\n />\n </InputGroupAddon>\n </PopoverAnchor>\n <PopoverContent\n align=\"start\"\n aria-label={calendarLabel}\n className=\"w-auto p-0\"\n container={container}\n >\n <Calendar\n {...calendarProps}\n mode=\"single\"\n month={calendarProps?.month ?? month}\n onMonthChange={(next) => {\n calendarProps?.onMonthChange?.(next)\n if (calendarProps?.month === undefined) setMonth(next)\n }}\n onSelect={(next) => {\n commit(next ? formatDate(next, separator) : '')\n setOpen(false)\n }}\n selected={selected}\n />\n </PopoverContent>\n </Popover>\n )\n },\n)\n\nexport { InputDate }\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAS,qBAAwB,EAC/B,aACA,UACA,QAKC;CACD,MAAM,CAAC,cAAc,mBAAmBA,QAAM,SAAS,WAAW;CAClE,MAAM,eAAe,SAAS,KAAA;CAW9B,OAAO,CAVO,eAAe,OAAO,cAEnBA,QAAM,aACpB,SAAY;EACX,IAAI,CAAC,cAAc,gBAAgB,IAAI;EACvC,WAAW,IAAI;CACjB,GACA,CAAC,cAAc,QAAQ,CAGH,CAAC;AACzB;AAqBA,MAAM,YAAYA,QAAM,WACtB,SAAS,UACP,EACE,eACA,eACA,WACA,WACA,cAAc,OACd,eAAe,IACf,UACA,IACA,cACA,WACA,cACA,eACA,MAAM,UACN,aAAa,OACb,aACA,YAAY,KACZ,OAAO,WACP,GAAG,SAEL,KACA;CACA,MAAM,WAAWA,QAAM,OAAyB,IAAI;CACpD,MAAM,CAAC,MAAM,WAAW,qBAAqB;EAC3C,aAAa;EACb,UAAU;EACV,MAAM;CACR,CAAC;CACD,MAAM,CAAC,MAAM,gBAAgB,qBAAqB;EAChD,aAAa;EACb,UAAU;EACV,MAAM;CACR,CAAC;CACD,MAAM,WAAW,UAAU,IAAI;CAC/B,MAAM,CAAC,OAAO,YAAYA,QAAM,eACxB,YAAY,eAAe,KACnC;CACA,MAAM,UAAUA,QAAM,aACnB,SAAkB;EACjB,IAAI,QAAQ,eAAe,UAAU,KAAA,GACnC,SAAS,UAAU,IAAI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B;MAC1B,OAAO,kBAAkB,OAAO,KAAK;KACvC,CAAC;IACH;IACA,aAAa,eAAe,KAAK,UAAU,IAAI,UAAU;IACzD,UAAU;IACV,KAAK;IACL,YAAY;IACZ,OAAO;GACR,CAAA,GACD,oBAAC,iBAAD;IAAiB,OAAM;cACrB,oBAAC,gBAAD,EACE,QACE,oBAAC,QAAD;KACE,cAAY;KACZ,OAAM;KACI;KACV,MAAK;KACL,cAAa;eAEb,oBAAC,eAAD,CAAgB,CAAA;IACV,CAAA,EAEX,CAAA;GACc,CAAA,CACJ;MACf,oBAAC,gBAAD;GACE,OAAM;GACN,cAAY;GACZ,WAAU;GACC;aAEX,oBAAC,UAAD;IACE,GAAI;IACJ,MAAK;IACL,OAAO,eAAe,SAAS;IAC/B,gBAAgB,SAAS;KACvB,eAAe,gBAAgB,IAAI;KACnC,IAAI,eAAe,UAAU,KAAA,GAAW,SAAS,IAAI;IACvD;IACA,WAAW,SAAS;KAClB,OAAO,OAAO,WAAW,MAAM,SAAS,IAAI,EAAE;KAC9C,QAAQ,KAAK;IACf;IACU;GACX,CAAA;EACa,CAAA,CACT;;AAEb,CACF"}
|
|
@@ -9,7 +9,7 @@ let react = require("react");
|
|
|
9
9
|
react = require_chunk.__toESM(react);
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
11
|
let class_variance_authority = require("class-variance-authority");
|
|
12
|
-
let
|
|
12
|
+
let cn = require("cn");
|
|
13
13
|
//#region src/components/input-group.tsx
|
|
14
14
|
const GHOST = "rounded-none border-0 border-b-2 px-0 focus-within:border-b-input-active has-[[data-slot=input][aria-invalid=true]]:border-b-input-invalid has-[[data-slot=input][aria-invalid=true]]:focus-within:border-b-red-a8! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus-within:border-b-red-a8!";
|
|
15
15
|
const inputGroupVariants = (0, class_variance_authority.cva)("group/input-group relative flex h-10 w-full min-w-0 items-center gap-2 bg-transparent transition-[color,border-color] outline-none motion-reduce:transition-none", {
|
|
@@ -113,7 +113,7 @@ function InputGroup({ className, ...props }) {
|
|
|
113
113
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
114
114
|
"data-slot": "input-group",
|
|
115
115
|
role: "group",
|
|
116
|
-
className: (0,
|
|
116
|
+
className: (0, cn.cn)(inputGroupVariants({
|
|
117
117
|
chrome: field?.labelPosition === "inset" ? "inset" : "box",
|
|
118
118
|
inputStyle,
|
|
119
119
|
inputColor
|
|
@@ -133,7 +133,7 @@ function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
|
133
133
|
role: "presentation",
|
|
134
134
|
"data-slot": "input-group-addon",
|
|
135
135
|
"data-align": align,
|
|
136
|
-
className: (0,
|
|
136
|
+
className: (0, cn.cn)(inputGroupAddonVariants({ align }), className),
|
|
137
137
|
onClick: (event) => {
|
|
138
138
|
if (event.target.closest("button")) return;
|
|
139
139
|
event.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
@@ -143,7 +143,7 @@ function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
|
143
143
|
}
|
|
144
144
|
function InputGroupText({ className, ...props }) {
|
|
145
145
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
146
|
-
className: (0,
|
|
146
|
+
className: (0, cn.cn)("flex items-center gap-2 text-xs text-gray-light [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4", className),
|
|
147
147
|
...props
|
|
148
148
|
});
|
|
149
149
|
}
|
|
@@ -151,7 +151,7 @@ const InputGroupInput = react.forwardRef(function InputGroupInput({ className, .
|
|
|
151
151
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_input.Input, {
|
|
152
152
|
"data-slot": "input",
|
|
153
153
|
variant: "none",
|
|
154
|
-
className: (0,
|
|
154
|
+
className: (0, cn.cn)("flex-1", className),
|
|
155
155
|
ref,
|
|
156
156
|
...props
|
|
157
157
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group.cjs","names":["useFieldContext","useTheme","React","Input"],"sources":["../../src/components/input-group.tsx"],"sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { useFieldContext } from './field'\nimport { Input, type InputProps } from './input'\nimport { useTheme } from './theme'\n\nconst GHOST =\n 'rounded-none border-0 border-b-2 px-0 focus-within:border-b-input-active has-[[data-slot=input][aria-invalid=true]]:border-b-input-invalid has-[[data-slot=input][aria-invalid=true]]:focus-within:border-b-red-a8! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus-within:border-b-red-a8!'\n\nconst inputGroupVariants = cva(\n 'group/input-group relative flex h-10 w-full min-w-0 items-center gap-2 bg-transparent transition-[color,border-color] outline-none motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n // inside an inset field the shell is the box; the group keeps the\n // classic underline (inputs inside stay chrome-less)\n inset: GHOST,\n // h-11 matches the standalone Input box\n box: 'h-11 rounded-md px-3 transition-all motion-reduce:transition-none',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n // invalid hover deepens the error tint instead of the accent hover\n class:\n 'group-data-[invalid=true]/field:bg-base-error-soft focus-within:ring-2 focus-within:ring-offset-2 group-data-[invalid=true]/field:focus-within:ring-red-a8 has-[[data-slot=input][aria-invalid=true]]:bg-base-error-soft has-[[data-slot=input][aria-invalid=true]]:focus-within:ring-red-a8 has-[[data-slot=input][aria-invalid=true]:not(:disabled)]:hover:bg-red-a4 group-data-[invalid=true]/field:has-[input:not(:disabled)]:hover:bg-red-a4',\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class:\n 'bg-input-base focus-within:ring-input-active has-[input:not(:disabled)]:hover:bg-input-base-hover',\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class:\n 'bg-base-gray-soft focus-within:ring-gray-a8 has-[input:not(:disabled)]:hover:bg-gray-a4',\n },\n {\n chrome: 'box',\n inputStyle: ['surface', 'outlined'],\n class:\n 'border group-data-[invalid=true]/field:border-input-invalid focus-within:ring-1 group-data-[invalid=true]/field:focus-within:border-input-invalid! group-data-[invalid=true]/field:focus-within:ring-red-a4! has-[[data-slot=input][aria-invalid=true]]:border-input-invalid has-[[data-slot=input][aria-invalid=true]]:focus-within:border-input-invalid! has-[[data-slot=input][aria-invalid=true]]:focus-within:ring-red-a4!',\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class:\n 'border-input bg-base-accent-surface focus-within:border-input-active focus-within:ring-spark-a4',\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class:\n 'border-input-gray bg-base-gray-surface focus-within:border-gray-a8 focus-within:ring-gray-a4',\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class:\n 'border-input focus-within:border-input-active focus-within:ring-spark-a4',\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class:\n 'border-input-gray focus-within:border-gray-a8 focus-within:ring-gray-a4',\n },\n { chrome: 'box', inputStyle: 'ghost', class: GHOST },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: 'border-b-input',\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: 'border-b-input-gray',\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\n// The group carries the box + focus/invalid states; inputs inside are\n// chrome-less (variant=\"none\"). Style follows the enclosing Field's knobs,\n// else the <Theme> input-style/input-color knobs.\nfunction InputGroup({ className, ...props }: React.ComponentProps<'div'>) {\n const field = useFieldContext()\n const theme = useTheme()\n const inputStyle = field?.inputStyle ?? theme.inputStyle ?? 'soft'\n const inputColor = field?.inputColor ?? theme.inputColor ?? 'brand'\n const chrome = field?.labelPosition === 'inset' ? 'inset' : 'box'\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n inputGroupVariants({ chrome, inputStyle, inputColor }),\n className,\n )}\n {...props}\n />\n )\n}\n\nconst inputGroupAddonVariants = cva(\n 'flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-medium text-gray-light select-none [&_svg:not([class*=size-])]:size-4',\n {\n variants: {\n align: {\n // button addons bring their own inner padding — pull them halfway\n // into the group's px so the visual gap matches the text side\n 'inline-start': 'order-first has-[>button]:-ml-2',\n 'inline-end': 'order-last has-[>button]:-mr-2',\n },\n },\n defaultVariants: {\n align: 'inline-start',\n },\n },\n)\n\nfunction InputGroupAddon({\n className,\n align = 'inline-start',\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n // chrome, not a control: the click only forwards focus to the input the\n // way a label would, and Tab already reaches that input directly\n role=\"presentation\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(event) => {\n if ((event.target as HTMLElement).closest('button')) return\n event.currentTarget.parentElement?.querySelector('input')?.focus()\n }}\n {...props}\n />\n )\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n className={cn(\n 'flex items-center gap-2 text-xs text-gray-light [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst InputGroupInput = React.forwardRef<HTMLInputElement, InputProps>(\n function InputGroupInput({ className, ...props }, ref) {\n return (\n <Input\n data-slot=\"input\"\n variant=\"none\"\n className={cn('flex-1', className)}\n ref={ref}\n {...props}\n />\n )\n },\n)\n\nexport { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText }\n"],"mappings":";;;;;;;;;;;;;AASA,MAAM,QACJ;AAEF,MAAM,sBAAA,GAAA,yBAAA,KACJ,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":["useFieldContext","useTheme","React","Input"],"sources":["../../src/components/input-group.tsx"],"sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { useFieldContext } from './field'\nimport { Input, type InputProps } from './input'\nimport { useTheme } from './theme'\n\nconst GHOST =\n 'rounded-none border-0 border-b-2 px-0 focus-within:border-b-input-active has-[[data-slot=input][aria-invalid=true]]:border-b-input-invalid has-[[data-slot=input][aria-invalid=true]]:focus-within:border-b-red-a8! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:focus-within:border-b-red-a8!'\n\nconst inputGroupVariants = cva(\n 'group/input-group relative flex h-10 w-full min-w-0 items-center gap-2 bg-transparent transition-[color,border-color] outline-none motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n // inside an inset field the shell is the box; the group keeps the\n // classic underline (inputs inside stay chrome-less)\n inset: GHOST,\n // h-11 matches the standalone Input box\n box: 'h-11 rounded-md px-3 transition-all motion-reduce:transition-none',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n // invalid hover deepens the error tint instead of the accent hover\n class:\n 'group-data-[invalid=true]/field:bg-base-error-soft focus-within:ring-2 focus-within:ring-offset-2 group-data-[invalid=true]/field:focus-within:ring-red-a8 has-[[data-slot=input][aria-invalid=true]]:bg-base-error-soft has-[[data-slot=input][aria-invalid=true]]:focus-within:ring-red-a8 has-[[data-slot=input][aria-invalid=true]:not(:disabled)]:hover:bg-red-a4 group-data-[invalid=true]/field:has-[input:not(:disabled)]:hover:bg-red-a4',\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class:\n 'bg-input-base focus-within:ring-input-active has-[input:not(:disabled)]:hover:bg-input-base-hover',\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class:\n 'bg-base-gray-soft focus-within:ring-gray-a8 has-[input:not(:disabled)]:hover:bg-gray-a4',\n },\n {\n chrome: 'box',\n inputStyle: ['surface', 'outlined'],\n class:\n 'border group-data-[invalid=true]/field:border-input-invalid focus-within:ring-1 group-data-[invalid=true]/field:focus-within:border-input-invalid! group-data-[invalid=true]/field:focus-within:ring-red-a4! has-[[data-slot=input][aria-invalid=true]]:border-input-invalid has-[[data-slot=input][aria-invalid=true]]:focus-within:border-input-invalid! has-[[data-slot=input][aria-invalid=true]]:focus-within:ring-red-a4!',\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class:\n 'border-input bg-base-accent-surface focus-within:border-input-active focus-within:ring-spark-a4',\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class:\n 'border-input-gray bg-base-gray-surface focus-within:border-gray-a8 focus-within:ring-gray-a4',\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class:\n 'border-input focus-within:border-input-active focus-within:ring-spark-a4',\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class:\n 'border-input-gray focus-within:border-gray-a8 focus-within:ring-gray-a4',\n },\n { chrome: 'box', inputStyle: 'ghost', class: GHOST },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: 'border-b-input',\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: 'border-b-input-gray',\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\n// The group carries the box + focus/invalid states; inputs inside are\n// chrome-less (variant=\"none\"). Style follows the enclosing Field's knobs,\n// else the <Theme> input-style/input-color knobs.\nfunction InputGroup({ className, ...props }: React.ComponentProps<'div'>) {\n const field = useFieldContext()\n const theme = useTheme()\n const inputStyle = field?.inputStyle ?? theme.inputStyle ?? 'soft'\n const inputColor = field?.inputColor ?? theme.inputColor ?? 'brand'\n const chrome = field?.labelPosition === 'inset' ? 'inset' : 'box'\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n inputGroupVariants({ chrome, inputStyle, inputColor }),\n className,\n )}\n {...props}\n />\n )\n}\n\nconst inputGroupAddonVariants = cva(\n 'flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-medium text-gray-light select-none [&_svg:not([class*=size-])]:size-4',\n {\n variants: {\n align: {\n // button addons bring their own inner padding — pull them halfway\n // into the group's px so the visual gap matches the text side\n 'inline-start': 'order-first has-[>button]:-ml-2',\n 'inline-end': 'order-last has-[>button]:-mr-2',\n },\n },\n defaultVariants: {\n align: 'inline-start',\n },\n },\n)\n\nfunction InputGroupAddon({\n className,\n align = 'inline-start',\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n // chrome, not a control: the click only forwards focus to the input the\n // way a label would, and Tab already reaches that input directly\n role=\"presentation\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(event) => {\n if ((event.target as HTMLElement).closest('button')) return\n event.currentTarget.parentElement?.querySelector('input')?.focus()\n }}\n {...props}\n />\n )\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n className={cn(\n 'flex items-center gap-2 text-xs text-gray-light [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst InputGroupInput = React.forwardRef<HTMLInputElement, InputProps>(\n function InputGroupInput({ className, ...props }, ref) {\n return (\n <Input\n data-slot=\"input\"\n variant=\"none\"\n className={cn('flex-1', className)}\n ref={ref}\n {...props}\n />\n )\n },\n)\n\nexport { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText }\n"],"mappings":";;;;;;;;;;;;;AASA,MAAM,QACJ;AAEF,MAAM,sBAAA,GAAA,yBAAA,KACJ,oKACA;CACE,UAAU;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AAU;GAMzB;GAAY;EAAW,CAAC,GACrD,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,2BAAA,GAAA,yBAAA,KACJ,qJACA;CACE,UAAU,EACR,OAAO;EAGL,gBAAgB;EAChB,cAAc;CAChB,EACF;CACA,iBAAiB,EACf,OAAO,eACT;AACF,CACF;AAEA,SAAS,gBAAgB,EACvB,WACA,QAAQ,gBACR,GAAG,SAC0E;CAC7E,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAGE,MAAK;EACL,aAAU;EACV,cAAY;EACZ,YAAA,GAAA,GAAA,IAAc,wBAAwB,EAAE,MAAM,CAAC,GAAG,SAAS;EAC3D,UAAU,UAAU;GAClB,IAAK,MAAM,OAAuB,QAAQ,QAAQ,GAAG;GACrD,MAAM,cAAc,eAAe,cAAc,OAAO,GAAG,MAAM;EACnE;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,eAAe,EAAE,WAAW,GAAG,SAAuC;CAC7E,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,YAAA,GAAA,GAAA,IACE,kHACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,MAAM,kBAAkBC,MAAM,WAC5B,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAS,KAAK;CACrD,OACE,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,OAAD;EACE,aAAU;EACV,SAAQ;EACR,YAAA,GAAA,GAAA,IAAc,UAAU,SAAS;EAC5B;EACL,GAAI;CACL,CAAA;AAEL,CACF"}
|
|
@@ -10,7 +10,7 @@ declare function InputGroup({
|
|
|
10
10
|
...props
|
|
11
11
|
}: React$1.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare const inputGroupAddonVariants: (props?: ({
|
|
13
|
-
align?: "inline-
|
|
13
|
+
align?: "inline-start" | "inline-end" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function InputGroupAddon({
|
|
16
16
|
className,
|
|
@@ -10,7 +10,7 @@ declare function InputGroup({
|
|
|
10
10
|
...props
|
|
11
11
|
}: React$1.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare const inputGroupAddonVariants: (props?: ({
|
|
13
|
-
align?: "inline-
|
|
13
|
+
align?: "inline-start" | "inline-end" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function InputGroupAddon({
|
|
16
16
|
className,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_components_field = require("./field.cjs");
|
|
4
3
|
const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
|
|
4
|
+
const require_components_field = require("./field.cjs");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
let class_variance_authority = require("class-variance-authority");
|
|
7
7
|
let _base_ui_react_otp_field = require("@base-ui/react/otp-field");
|
|
8
|
-
let
|
|
8
|
+
let cn = require("cn");
|
|
9
9
|
//#region src/components/input-otp.tsx
|
|
10
10
|
const slotVariants = (0, class_variance_authority.cva)("flex w-11 min-w-0 items-center justify-center bg-transparent text-center text-base font-medium text-gray tabular-nums outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none", {
|
|
11
11
|
variants: {
|
|
@@ -94,7 +94,7 @@ function InputOtp({ length = 6, className, id: idProp, onComplete, slotAriaLabel
|
|
|
94
94
|
id,
|
|
95
95
|
validationType,
|
|
96
96
|
onValueComplete: onComplete,
|
|
97
|
-
className: (0,
|
|
97
|
+
className: (0, cn.cn)("flex items-center gap-2", className),
|
|
98
98
|
...props,
|
|
99
99
|
children: Array.from({ length }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_otp_field.OTPField.Input, {
|
|
100
100
|
"aria-label": index === 0 ? void 0 : slotAriaLabel(index),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-otp.cjs","names":["GHOST_UNDERLINE","boxChrome","useFieldControl","OTPField"],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["import { OTPField, type OTPFieldRootProps } from '@base-ui/react/otp-field'\nimport { cva } from 'class-variance-authority'\nimport { boxChrome, GHOST_UNDERLINE } from '../lib/input-box-variants'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\n// One code box per slot. Mirrors Input's box/underline carrier model so the\n// slots read like the rest of the input family across every style/color knob.\nconst slotVariants = cva(\n 'flex w-11 min-w-0 items-center justify-center bg-transparent text-center text-base font-medium text-gray tabular-nums outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n // inside an inset field the shell is the box; slots keep the classic\n // underline (the pre-knob default look)\n inset: GHOST_UNDERLINE,\n box: 'h-11 rounded-md',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\ninterface InputOtpProps extends Pick<\n OTPFieldRootProps,\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'disabled'\n | 'className'\n | 'id'\n | 'validationType'\n> {\n /** Number of code slots. */\n length?: number\n /** Fired when every slot is filled. */\n onComplete?: OTPFieldRootProps['onValueComplete']\n /** Accessible name per slot (for localization). */\n slotAriaLabel?: (index: number) => string\n}\n\nfunction InputOtp({\n length = 6,\n className,\n id: idProp,\n onComplete,\n slotAriaLabel = (index) => `Character ${index + 1}`,\n validationType = 'alphanumeric',\n ...props\n}: InputOtpProps) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({ id: idProp })\n const chrome = field?.labelPosition === 'inset' ? 'inset' : 'box'\n\n return (\n <OTPField.Root\n data-slot=\"input-otp\"\n length={length}\n id={id}\n validationType={validationType}\n onValueComplete={onComplete}\n className={cn('flex items-center gap-2', className)}\n {...props}\n >\n {Array.from({ length }, (_, index) => (\n <OTPField.Input\n key={index}\n // the first slot is named by the Field label (Base UI ignores\n // aria-label there); the rest get a positional name for a11y\n aria-label={index === 0 ? undefined : slotAriaLabel(index)}\n aria-describedby={index === 0 ? ariaDescribedBy : undefined}\n aria-invalid={index === 0 ? ariaInvalid : undefined}\n className={slotVariants({ chrome, inputStyle, inputColor })}\n />\n ))}\n </OTPField.Root>\n )\n}\n\nexport { InputOtp }\nexport type { InputOtpProps }\n"],"mappings":";;;;;;;;;AAQA,MAAM,gBAAA,GAAA,yBAAA,KACJ,0XACA;CACE,UAAU;EACR,QAAQ;GAGN,OAAOA,+BAAAA;GACP,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ACF;EACJ;EACY;EAChB,iBAAiB;EACjB,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"input-otp.cjs","names":["GHOST_UNDERLINE","boxChrome","useFieldControl","OTPField"],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["import { OTPField, type OTPFieldRootProps } from '@base-ui/react/otp-field'\nimport { cva } from 'class-variance-authority'\nimport { boxChrome, GHOST_UNDERLINE } from '../lib/input-box-variants'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\n// One code box per slot. Mirrors Input's box/underline carrier model so the\n// slots read like the rest of the input family across every style/color knob.\nconst slotVariants = cva(\n 'flex w-11 min-w-0 items-center justify-center bg-transparent text-center text-base font-medium text-gray tabular-nums outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n // inside an inset field the shell is the box; slots keep the classic\n // underline (the pre-knob default look)\n inset: GHOST_UNDERLINE,\n box: 'h-11 rounded-md',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\ninterface InputOtpProps extends Pick<\n OTPFieldRootProps,\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'disabled'\n | 'className'\n | 'id'\n | 'validationType'\n> {\n /** Number of code slots. */\n length?: number\n /** Fired when every slot is filled. */\n onComplete?: OTPFieldRootProps['onValueComplete']\n /** Accessible name per slot (for localization). */\n slotAriaLabel?: (index: number) => string\n}\n\nfunction InputOtp({\n length = 6,\n className,\n id: idProp,\n onComplete,\n slotAriaLabel = (index) => `Character ${index + 1}`,\n validationType = 'alphanumeric',\n ...props\n}: InputOtpProps) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({ id: idProp })\n const chrome = field?.labelPosition === 'inset' ? 'inset' : 'box'\n\n return (\n <OTPField.Root\n data-slot=\"input-otp\"\n length={length}\n id={id}\n validationType={validationType}\n onValueComplete={onComplete}\n className={cn('flex items-center gap-2', className)}\n {...props}\n >\n {Array.from({ length }, (_, index) => (\n <OTPField.Input\n key={index}\n // the first slot is named by the Field label (Base UI ignores\n // aria-label there); the rest get a positional name for a11y\n aria-label={index === 0 ? undefined : slotAriaLabel(index)}\n aria-describedby={index === 0 ? ariaDescribedBy : undefined}\n aria-invalid={index === 0 ? ariaInvalid : undefined}\n className={slotVariants({ chrome, inputStyle, inputColor })}\n />\n ))}\n </OTPField.Root>\n )\n}\n\nexport { InputOtp }\nexport type { InputOtpProps }\n"],"mappings":";;;;;;;;;AAQA,MAAM,gBAAA,GAAA,yBAAA,KACJ,0XACA;CACE,UAAU;EACR,QAAQ;GAGN,OAAOA,+BAAAA;GACP,KAAK;EACP;EACA,YAAY;GAAE,MAAM;GAAI,SAAS;GAAI,UAAU;GAAI,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2B,SAAS;EAClD,GAAI;YAEH,MAAM,KAAK,EAAE,OAAO,IAAI,GAAG,UAC1B,iBAAA,GAAA,kBAAA,KAACA,yBAAAA,SAAS,OAAV;GAIE,cAAY,UAAU,IAAI,KAAA,IAAY,cAAc,KAAK;GACzD,oBAAkB,UAAU,IAAI,kBAAkB,KAAA;GAClD,gBAAc,UAAU,IAAI,cAAc,KAAA;GAC1C,WAAW,aAAa;IAAE;IAAQ;IAAY;GAAW,CAAC;EAC3D,GAPM,KAON,CACF;CACY,CAAA;AAEnB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { useFieldControl } from "./field.js";
|
|
4
3
|
import { GHOST_UNDERLINE, boxChrome } from "../lib/input-box-variants.js";
|
|
4
|
+
import { useFieldControl } from "./field.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
import { OTPField } from "@base-ui/react/otp-field";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
-
const require_components_field = require("./field.cjs");
|
|
5
4
|
const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
|
|
5
|
+
const require_components_field = require("./field.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_chunk.__toESM(react);
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let class_variance_authority = require("class-variance-authority");
|
|
10
|
-
let
|
|
10
|
+
let cn = require("cn");
|
|
11
11
|
//#region src/components/input.tsx
|
|
12
12
|
const inputVariants = (0, class_variance_authority.cva)("flex h-10 w-full min-w-0 [appearance:textfield] bg-transparent text-gray outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", {
|
|
13
13
|
variants: {
|
|
@@ -96,7 +96,7 @@ const Input = react.forwardRef(function Input({ variant, className, id: idProp,
|
|
|
96
96
|
});
|
|
97
97
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
98
98
|
"data-slot": "input",
|
|
99
|
-
className: (0,
|
|
99
|
+
className: (0, cn.cn)(inputVariants({
|
|
100
100
|
chrome: variant === "none" ? "none" : !variant && field?.labelPosition === "inset" ? "inset" : "box",
|
|
101
101
|
inputStyle,
|
|
102
102
|
inputColor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.cjs","names":["GHOST_UNDERLINE","boxChrome","React","useFieldControl"],"sources":["../../src/components/input.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { boxChrome, GHOST_UNDERLINE } from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\ntype InputVariant = SparkInputStyle | 'none'\n\nconst inputVariants = cva(\n 'flex h-10 w-full min-w-0 [appearance:textfield] bg-transparent text-gray outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none',\n {\n variants: {\n chrome: {\n none: 'border-0 px-0',\n // inside an inset field the shell is the box; the input keeps the\n // classic underline (the pre-knob default look)\n inset: GHOST_UNDERLINE,\n box: 'h-11 rounded-md px-3 py-1 text-base transition-all motion-reduce:transition-none',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\ninterface InputProps extends React.ComponentProps<'input'> {\n variant?: InputVariant\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n variant,\n className,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n },\n ref,\n) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant: variant !== 'none' ? variant : undefined,\n })\n // an explicit variant prop keeps the box even inside an inset field\n const chrome =\n variant === 'none'\n ? 'none'\n : !variant && field?.labelPosition === 'inset'\n ? 'inset'\n : 'box'\n\n return (\n <input\n data-slot=\"input\"\n className={cn(\n inputVariants({ chrome, inputStyle, inputColor }),\n className,\n )}\n id={id}\n ref={ref}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n />\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A,gBAAgB;EACd,IAAI;EACJ,iBAAiB;EACjB,SAAS,YAAY,SAAS,UAAU,KAAA;CAC1C,CAAC;CASH,OACE,iBAAA,GAAA,kBAAA,KAAC,SAAD;EACE,aAAU;EACV,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"input.cjs","names":["GHOST_UNDERLINE","boxChrome","React","useFieldControl"],"sources":["../../src/components/input.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { boxChrome, GHOST_UNDERLINE } from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\ntype InputVariant = SparkInputStyle | 'none'\n\nconst inputVariants = cva(\n 'flex h-10 w-full min-w-0 [appearance:textfield] bg-transparent text-gray outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none',\n {\n variants: {\n chrome: {\n none: 'border-0 px-0',\n // inside an inset field the shell is the box; the input keeps the\n // classic underline (the pre-knob default look)\n inset: GHOST_UNDERLINE,\n box: 'h-11 rounded-md px-3 py-1 text-base transition-all motion-reduce:transition-none',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n ],\n },\n)\n\ninterface InputProps extends React.ComponentProps<'input'> {\n variant?: InputVariant\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n variant,\n className,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n },\n ref,\n) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant: variant !== 'none' ? variant : undefined,\n })\n // an explicit variant prop keeps the box even inside an inset field\n const chrome =\n variant === 'none'\n ? 'none'\n : !variant && field?.labelPosition === 'inset'\n ? 'inset'\n : 'box'\n\n return (\n <input\n data-slot=\"input\"\n className={cn(\n inputVariants({ chrome, inputStyle, inputColor }),\n className,\n )}\n id={id}\n ref={ref}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n />\n )\n})\n\nexport { Input }\nexport type { InputProps, InputVariant }\n"],"mappings":";;;;;;;;;;;AASA,MAAM,iBAAA,GAAA,yBAAA,KACJ,2aACA;CACE,UAAU;EACR,QAAQ;GACN,MAAM;GAGN,OAAOA,+BAAAA;GACP,KAAK;EACP;EACA,YAAY;GAAE,MAAM;GAAI,SAAS;GAAI,UAAU;GAAI,OAAO;EAAG;EAC7D,YAAY;GAAE,OAAO;GAAI,MAAM;EAAG;CACpC;CACA,kBAAkB;EAChB;GACE,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AAkB;CACnB,CAAA;AAEL,CAAC"}
|
package/dist/components/input.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { useFieldControl } from "./field.js";
|
|
4
3
|
import { GHOST_UNDERLINE, boxChrome } from "../lib/input-box-variants.js";
|
|
4
|
+
import { useFieldControl } from "./field.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
@@ -4,10 +4,10 @@ const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_chunk.__toESM(react);
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
let
|
|
7
|
+
let cn = require("cn");
|
|
8
8
|
//#region src/components/label.tsx
|
|
9
9
|
const Label = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
10
|
-
className: (0,
|
|
10
|
+
className: (0, cn.cn)("text-sm leading-5 font-normal text-gray", className),
|
|
11
11
|
ref,
|
|
12
12
|
...props
|
|
13
13
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.cjs","names":["React"],"sources":["../../src/components/label.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {}\n\nconst Label = React.forwardRef<HTMLLabelElement, LabelProps>(\n ({ className, ...props }, ref) => (\n <label\n className={cn('text-sm leading-5 font-normal text-gray', className)}\n ref={ref}\n {...props}\n />\n ),\n)\n\nLabel.displayName = 'Label'\n\nexport { Label }\nexport type { LabelProps }\n"],"mappings":";;;;;;;;AAKA,MAAM,QAAQA,MAAM,YACjB,EAAE,WAAW,GAAG,SAAS,QACxB,iBAAA,GAAA,kBAAA,KAAC,SAAD;CACE,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"label.cjs","names":["React"],"sources":["../../src/components/label.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {}\n\nconst Label = React.forwardRef<HTMLLabelElement, LabelProps>(\n ({ className, ...props }, ref) => (\n <label\n className={cn('text-sm leading-5 font-normal text-gray', className)}\n ref={ref}\n {...props}\n />\n ),\n)\n\nLabel.displayName = 'Label'\n\nexport { Label }\nexport type { LabelProps }\n"],"mappings":";;;;;;;;AAKA,MAAM,QAAQA,MAAM,YACjB,EAAE,WAAW,GAAG,SAAS,QACxB,iBAAA,GAAA,kBAAA,KAAC,SAAD;CACE,YAAA,GAAA,GAAA,IAAc,2CAA2C,SAAS;CAC7D;CACL,GAAI;AACL,CAAA,CAEL;AAEA,MAAM,cAAc"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
|
-
let
|
|
3
|
+
let cn = require("cn");
|
|
4
4
|
//#region src/components/layout.tsx
|
|
5
5
|
const PageContainer = ({ className, gap = 4, style, ...rest }) => {
|
|
6
6
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
7
|
-
className: (0,
|
|
7
|
+
className: (0, cn.cn)("mx-auto flex w-full flex-col gap-[calc(var(--spark-layout-gap)*var(--page-container-gap-steps,4))] md:max-w-152", className),
|
|
8
8
|
style: {
|
|
9
9
|
"--page-container-gap-steps": gap,
|
|
10
10
|
...style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.cjs","names":[],"sources":["../../src/components/layout.tsx"],"sourcesContent":["import type React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface PageContainerProps extends React.ComponentProps<'div'> {\n /** How many `--spark-layout-gap` units apart each section sits. */\n gap?: number\n}\n\nconst PageContainer = ({\n className,\n gap = 4,\n style,\n ...rest\n}: PageContainerProps) => {\n return (\n <div\n className={cn(\n 'mx-auto flex w-full flex-col gap-[calc(var(--spark-layout-gap)*var(--page-container-gap-steps,4))] md:max-w-152',\n className,\n )}\n style={\n {\n '--page-container-gap-steps': gap,\n ...style,\n } as React.CSSProperties\n }\n {...rest}\n />\n )\n}\n\nexport default PageContainer\nexport type { PageContainerProps }\n"],"mappings":";;;;AAQA,MAAM,iBAAiB,EACrB,WACA,MAAM,GACN,OACA,GAAG,WACqB;CACxB,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,YAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"layout.cjs","names":[],"sources":["../../src/components/layout.tsx"],"sourcesContent":["import type React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface PageContainerProps extends React.ComponentProps<'div'> {\n /** How many `--spark-layout-gap` units apart each section sits. */\n gap?: number\n}\n\nconst PageContainer = ({\n className,\n gap = 4,\n style,\n ...rest\n}: PageContainerProps) => {\n return (\n <div\n className={cn(\n 'mx-auto flex w-full flex-col gap-[calc(var(--spark-layout-gap)*var(--page-container-gap-steps,4))] md:max-w-152',\n className,\n )}\n style={\n {\n '--page-container-gap-steps': gap,\n ...style,\n } as React.CSSProperties\n }\n {...rest}\n />\n )\n}\n\nexport default PageContainer\nexport type { PageContainerProps }\n"],"mappings":";;;;AAQA,MAAM,iBAAiB,EACrB,WACA,MAAM,GACN,OACA,GAAG,WACqB;CACxB,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,YAAA,GAAA,GAAA,IACE,mHACA,SACF;EACA,OACE;GACE,8BAA8B;GAC9B,GAAG;EACL;EAEF,GAAI;CACL,CAAA;AAEL"}
|