@uisatin/ui 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +20 -3
- package/chunk-3DHJXU45.js +147 -0
- package/{chunk-6YXUBP27.js → chunk-5725MFGQ.js} +72 -67
- package/{chunk-BKZBWPUH.js → chunk-57QEOCDZ.js} +9 -11
- package/{chunk-RTJ76X5U.js → chunk-5KTBSMQU.js} +2 -4
- package/{chunk-B2K45IUR.js → chunk-5XTUFBZI.js} +5 -7
- package/{chunk-LW3TRU5W.js → chunk-674SRBZK.js} +28 -16
- package/{chunk-XZNHT6MO.js → chunk-6VKV36OK.js} +115 -61
- package/{chunk-GICKPMJU.js → chunk-73Z7NMQQ.js} +31 -31
- package/chunk-7Q76HLRQ.js +128 -0
- package/{chunk-JPNWHWAQ.js → chunk-AIMQNLPY.js} +38 -35
- package/chunk-BN7FDKCJ.js +164 -0
- package/{chunk-3DINAQLL.js → chunk-BR2B4OIT.js} +33 -29
- package/{chunk-2HKBZFIK.js → chunk-CGOH5IYX.js} +31 -31
- package/chunk-CVNRZ2YV.js +112 -0
- package/{chunk-QUF2IPOZ.js → chunk-DPYIBFQD.js} +12 -14
- package/chunk-EF5GT4OG.js +87 -0
- package/chunk-FAJ3OVL4.js +37 -0
- package/{chunk-L6NCCSIP.js → chunk-FB5HTCO2.js} +36 -29
- package/chunk-GI2SMFZL.js +55 -0
- package/{chunk-B6V4VSGH.js → chunk-GMETYACH.js} +14 -15
- package/chunk-HK6WINL6.js +95 -0
- package/{chunk-HL42K2NH.js → chunk-IKO3GQFE.js} +17 -17
- package/{chunk-DO3TBNSC.js → chunk-ISYKZCPJ.js} +15 -17
- package/{chunk-YG7JOOLJ.js → chunk-J7RMFN54.js} +5 -7
- package/{chunk-SHDFUXYV.js → chunk-JBKBRAC4.js} +16 -18
- package/{chunk-LZMKSFCF.js → chunk-JCXI7VQL.js} +10 -12
- package/{chunk-NN6PKJWS.js → chunk-JYOZUQNU.js} +7 -9
- package/{chunk-LLHTVIM3.js → chunk-LB37KTJH.js} +7 -9
- package/{chunk-NSRTTYQ4.js → chunk-LB7Z6BSK.js} +42 -35
- package/{chunk-BNZVTLHV.js → chunk-LFGUJHFF.js} +25 -21
- package/{chunk-7TXHCRAG.js → chunk-M2HEVFQ3.js} +8 -10
- package/{chunk-SH6NG6VN.js → chunk-NH3EHMIL.js} +6 -8
- package/chunk-NL574STL.js +88 -0
- package/chunk-NQL6SIIB.js +168 -0
- package/chunk-O46O6LFQ.js +25 -0
- package/{chunk-YPNKBE5X.js → chunk-OURZQM27.js} +5 -7
- package/{chunk-XL75JRUA.js → chunk-OVKPPXK5.js} +42 -22
- package/chunk-PD6YPFYN.js +42 -0
- package/{chunk-XILQ7GXE.js → chunk-PHNR6ZQ7.js} +11 -13
- package/{chunk-BNTPPZCK.js → chunk-PUWSL5XW.js} +37 -39
- package/{chunk-A5XEM3GF.js → chunk-RHQHDYTE.js} +34 -36
- package/chunk-S7QHBVPX.js +45 -0
- package/{chunk-TX3H3QMA.js → chunk-SAYNV7B3.js} +71 -70
- package/{chunk-6QMSWITQ.js → chunk-SDOTDMYG.js} +24 -26
- package/{chunk-UGRSWP6U.js → chunk-SPGUZMCC.js} +10 -12
- package/chunk-SSOFFQ5T.js +74 -0
- package/{chunk-AN2RNJLR.js → chunk-SZJIVBOD.js} +16 -16
- package/chunk-T6L32XXH.js +107 -0
- package/{chunk-QS4N4MNP.js → chunk-TT2N5752.js} +18 -20
- package/{chunk-72OCFAPT.js → chunk-UCCNXGLG.js} +22 -21
- package/{chunk-KNUWZNFV.js → chunk-UGIVCXGN.js} +4 -6
- package/{chunk-H4NU7NPO.js → chunk-UUCVRIVP.js} +62 -61
- package/{chunk-P4O6TGDR.js → chunk-UZ4DXU6W.js} +28 -26
- package/{chunk-UBNHSZSE.js → chunk-VUOAPWTF.js} +10 -12
- package/{chunk-VAGIAREV.js → chunk-W472DBMT.js} +29 -26
- package/{chunk-X3PQANZO.js → chunk-W4RDTP6W.js} +47 -46
- package/{chunk-CL2II6BX.js → chunk-WLQD5BN2.js} +11 -13
- package/{chunk-FDKIX4DC.js → chunk-X2GNMNZQ.js} +7 -9
- package/{chunk-PF3YBUKT.js → chunk-X66KTATQ.js} +16 -15
- package/{chunk-J3NSDRVH.js → chunk-XETMIETJ.js} +0 -2
- package/chunk-XH56JGYC.js +71 -0
- package/{chunk-O7F3CIDV.js → chunk-XUOSJMEJ.js} +10 -12
- package/chunk-YJK4MGSI.js +86 -0
- package/{chunk-YX5VNRJX.js → chunk-YYFAZQ25.js} +0 -2
- package/chunk-Z7S2KQZS.js +177 -0
- package/chunk-ZBZ3ZQRB.js +195 -0
- package/{chunk-Y5AYU7PK.js → chunk-ZHFIWDGF.js} +0 -2
- package/components/accordion.js +2 -4
- package/components/agent-loading.d.ts +2 -0
- package/components/agent-loading.js +2 -4
- package/components/agent-picker.js +4 -5
- package/components/agent-suggestion.js +5 -6
- package/components/announcement-bar.js +6 -7
- package/components/attachment.js +4 -5
- package/components/avatar.d.ts +16 -0
- package/components/avatar.js +4 -6
- package/components/badge.js +2 -4
- package/components/banner-mesh.js +1 -3
- package/components/banner.js +4 -6
- package/components/bar-chart.js +10 -11
- package/components/breadcrumb.js +5 -6
- package/components/button.js +2 -4
- package/components/card.js +3 -5
- package/components/channel-chart.js +10 -11
- package/components/chart.js +9 -10
- package/components/checkbox.js +2 -4
- package/components/chip.js +2 -4
- package/components/citations.d.ts +6 -4
- package/components/citations.js +4 -5
- package/components/code-block.js +3 -5
- package/components/combobox.d.ts +12 -3
- package/components/combobox.js +9 -10
- package/components/command-menu.d.ts +6 -2
- package/components/command-menu.js +5 -6
- package/components/context-menu.d.ts +12 -5
- package/components/context-menu.js +5 -6
- package/components/cookie-consent.js +3 -5
- package/components/date-picker.d.ts +26 -14
- package/components/date-picker.js +8 -9
- package/components/decision-card.js +6 -7
- package/components/dialog.d.ts +5 -2
- package/components/dialog.js +4 -5
- package/components/donut-chart.js +10 -11
- package/components/dot.js +2 -4
- package/components/dropdown.d.ts +6 -1
- package/components/dropdown.js +4 -5
- package/components/empty-state.js +2 -4
- package/components/file-upload.js +6 -7
- package/components/floating.js +1 -3
- package/components/form-field.js +2 -4
- package/components/hover-card.d.ts +5 -2
- package/components/hover-card.js +2 -4
- package/components/input-otp.d.ts +4 -2
- package/components/input-otp.js +7 -8
- package/components/input.js +3 -5
- package/components/kbd.js +2 -4
- package/components/labels.d.ts +79 -0
- package/components/labels.js +1 -0
- package/components/line-chart.js +11 -12
- package/components/message-actions.js +4 -5
- package/components/message.js +7 -8
- package/components/number-input.d.ts +4 -2
- package/components/number-input.js +7 -8
- package/components/pagination.js +4 -6
- package/components/popover.d.ts +11 -5
- package/components/popover.js +3 -4
- package/components/progress.js +2 -4
- package/components/prompt-bar.js +5 -6
- package/components/radio.js +2 -4
- package/components/search-bar.js +3 -5
- package/components/segmented-control.d.ts +4 -2
- package/components/segmented-control.js +3 -5
- package/components/select.d.ts +10 -2
- package/components/select.js +6 -7
- package/components/sheet.d.ts +4 -2
- package/components/sheet.js +5 -6
- package/components/sidebar.js +2 -4
- package/components/skeleton.js +2 -4
- package/components/slider.d.ts +6 -2
- package/components/slider.js +7 -8
- package/components/sliding-indicator.js +1 -3
- package/components/streaming-text.js +2 -4
- package/components/switch.js +2 -4
- package/components/table.d.ts +16 -5
- package/components/table.js +4 -5
- package/components/tabs.d.ts +4 -2
- package/components/tabs.js +3 -5
- package/components/textarea.js +3 -5
- package/components/thinking.js +3 -5
- package/components/toast.js +4 -5
- package/components/toggle.js +2 -4
- package/components/tooltip.d.ts +5 -2
- package/components/tooltip.js +3 -5
- package/index.d.ts +1 -0
- package/index.js +67 -231
- package/lib/utils.d.ts +8 -1
- package/lib/utils.js +1 -3
- package/package.json +22 -1
- package/styles.css +1 -1
- package/theme/create-theme.d.ts +6 -2
- package/theme/index.js +1 -0
- package/chunk-2HKBZFIK.js.map +0 -1
- package/chunk-3DINAQLL.js.map +0 -1
- package/chunk-3ERGAHKA.js +0 -179
- package/chunk-3ERGAHKA.js.map +0 -1
- package/chunk-6C7CGJX2.js +0 -86
- package/chunk-6C7CGJX2.js.map +0 -1
- package/chunk-6QMSWITQ.js.map +0 -1
- package/chunk-6YXUBP27.js.map +0 -1
- package/chunk-72OCFAPT.js.map +0 -1
- package/chunk-7TXHCRAG.js.map +0 -1
- package/chunk-A5XEM3GF.js.map +0 -1
- package/chunk-AN2RNJLR.js.map +0 -1
- package/chunk-B2K45IUR.js.map +0 -1
- package/chunk-B6V4VSGH.js.map +0 -1
- package/chunk-BKZBWPUH.js.map +0 -1
- package/chunk-BNTPPZCK.js.map +0 -1
- package/chunk-BNZVTLHV.js.map +0 -1
- package/chunk-CL2II6BX.js.map +0 -1
- package/chunk-D7RZNTFC.js +0 -95
- package/chunk-D7RZNTFC.js.map +0 -1
- package/chunk-DETGJAIC.js +0 -147
- package/chunk-DETGJAIC.js.map +0 -1
- package/chunk-DO3TBNSC.js.map +0 -1
- package/chunk-ESC5JCVQ.js +0 -90
- package/chunk-ESC5JCVQ.js.map +0 -1
- package/chunk-FDKIX4DC.js.map +0 -1
- package/chunk-GICKPMJU.js.map +0 -1
- package/chunk-GQA24FYG.js +0 -57
- package/chunk-GQA24FYG.js.map +0 -1
- package/chunk-H4NU7NPO.js.map +0 -1
- package/chunk-H63FYCMY.js +0 -11
- package/chunk-H63FYCMY.js.map +0 -1
- package/chunk-HL42K2NH.js.map +0 -1
- package/chunk-HNQUX43Z.js +0 -109
- package/chunk-HNQUX43Z.js.map +0 -1
- package/chunk-HRKPV66B.js +0 -32
- package/chunk-HRKPV66B.js.map +0 -1
- package/chunk-J3NSDRVH.js.map +0 -1
- package/chunk-JPNWHWAQ.js.map +0 -1
- package/chunk-KNUWZNFV.js.map +0 -1
- package/chunk-L6NCCSIP.js.map +0 -1
- package/chunk-LLHTVIM3.js.map +0 -1
- package/chunk-LW3TRU5W.js.map +0 -1
- package/chunk-LZMKSFCF.js.map +0 -1
- package/chunk-MR3JDI7E.js +0 -122
- package/chunk-MR3JDI7E.js.map +0 -1
- package/chunk-NN6PKJWS.js.map +0 -1
- package/chunk-NSRTTYQ4.js.map +0 -1
- package/chunk-O7F3CIDV.js.map +0 -1
- package/chunk-P4O6TGDR.js.map +0 -1
- package/chunk-PF3YBUKT.js.map +0 -1
- package/chunk-PVOLDO4G.js +0 -47
- package/chunk-PVOLDO4G.js.map +0 -1
- package/chunk-QS4N4MNP.js.map +0 -1
- package/chunk-QUF2IPOZ.js.map +0 -1
- package/chunk-RTJ76X5U.js.map +0 -1
- package/chunk-SH6NG6VN.js.map +0 -1
- package/chunk-SHDFUXYV.js.map +0 -1
- package/chunk-TKO44NDI.js +0 -84
- package/chunk-TKO44NDI.js.map +0 -1
- package/chunk-TVLGZGYN.js +0 -59
- package/chunk-TVLGZGYN.js.map +0 -1
- package/chunk-TX3H3QMA.js.map +0 -1
- package/chunk-UBNHSZSE.js.map +0 -1
- package/chunk-UC3ZJWOD.js +0 -73
- package/chunk-UC3ZJWOD.js.map +0 -1
- package/chunk-UGRSWP6U.js.map +0 -1
- package/chunk-VAGIAREV.js.map +0 -1
- package/chunk-WTMZT3IT.js +0 -105
- package/chunk-WTMZT3IT.js.map +0 -1
- package/chunk-WX6BP5ZP.js +0 -39
- package/chunk-WX6BP5ZP.js.map +0 -1
- package/chunk-X3PQANZO.js.map +0 -1
- package/chunk-XILQ7GXE.js.map +0 -1
- package/chunk-XL75JRUA.js.map +0 -1
- package/chunk-XZNHT6MO.js.map +0 -1
- package/chunk-Y5AYU7PK.js.map +0 -1
- package/chunk-YG7JOOLJ.js.map +0 -1
- package/chunk-YPJYW624.js +0 -195
- package/chunk-YPJYW624.js.map +0 -1
- package/chunk-YPNKBE5X.js.map +0 -1
- package/chunk-YX5VNRJX.js.map +0 -1
- package/components/accordion.js.map +0 -1
- package/components/agent-loading.js.map +0 -1
- package/components/agent-picker.js.map +0 -1
- package/components/agent-suggestion.js.map +0 -1
- package/components/announcement-bar.js.map +0 -1
- package/components/attachment.js.map +0 -1
- package/components/avatar.js.map +0 -1
- package/components/badge.js.map +0 -1
- package/components/banner-mesh.js.map +0 -1
- package/components/banner.js.map +0 -1
- package/components/bar-chart.js.map +0 -1
- package/components/breadcrumb.js.map +0 -1
- package/components/button.js.map +0 -1
- package/components/card.js.map +0 -1
- package/components/channel-chart.js.map +0 -1
- package/components/chart.js.map +0 -1
- package/components/checkbox.js.map +0 -1
- package/components/chip.js.map +0 -1
- package/components/citations.js.map +0 -1
- package/components/code-block.js.map +0 -1
- package/components/combobox.js.map +0 -1
- package/components/command-menu.js.map +0 -1
- package/components/context-menu.js.map +0 -1
- package/components/cookie-consent.js.map +0 -1
- package/components/date-picker.js.map +0 -1
- package/components/decision-card.js.map +0 -1
- package/components/dialog.js.map +0 -1
- package/components/donut-chart.js.map +0 -1
- package/components/dot.js.map +0 -1
- package/components/dropdown.js.map +0 -1
- package/components/empty-state.js.map +0 -1
- package/components/file-upload.js.map +0 -1
- package/components/floating.js.map +0 -1
- package/components/form-field.js.map +0 -1
- package/components/hover-card.js.map +0 -1
- package/components/input-otp.js.map +0 -1
- package/components/input.js.map +0 -1
- package/components/kbd.js.map +0 -1
- package/components/line-chart.js.map +0 -1
- package/components/message-actions.js.map +0 -1
- package/components/message.js.map +0 -1
- package/components/number-input.js.map +0 -1
- package/components/pagination.js.map +0 -1
- package/components/popover.js.map +0 -1
- package/components/progress.js.map +0 -1
- package/components/prompt-bar.js.map +0 -1
- package/components/radio.js.map +0 -1
- package/components/search-bar.js.map +0 -1
- package/components/segmented-control.js.map +0 -1
- package/components/select.js.map +0 -1
- package/components/sheet.js.map +0 -1
- package/components/sidebar.js.map +0 -1
- package/components/skeleton.js.map +0 -1
- package/components/slider.js.map +0 -1
- package/components/sliding-indicator.js.map +0 -1
- package/components/streaming-text.js.map +0 -1
- package/components/switch.js.map +0 -1
- package/components/table.js.map +0 -1
- package/components/tabs.js.map +0 -1
- package/components/textarea.js.map +0 -1
- package/components/thinking.js.map +0 -1
- package/components/toast.js.map +0 -1
- package/components/toggle.js.map +0 -1
- package/components/tooltip.js.map +0 -1
- package/index.js.map +0 -1
- package/lib/utils.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { cn } from './chunk-
|
|
1
|
+
import { cn } from './chunk-O46O6LFQ.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
var dotVariants = cva(
|
|
7
|
-
"block size-2 rounded-full",
|
|
7
|
+
"sa:block sa:size-2 sa:rounded-full",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
|
-
solid: "bg-tone-fg",
|
|
12
|
-
outline: "border border-tone-fg"
|
|
11
|
+
solid: "sa:bg-tone-fg",
|
|
12
|
+
outline: "sa:border sa:border-tone-fg"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
defaultVariants: { variant: "solid" }
|
|
@@ -24,7 +24,7 @@ function Dot({ className, tone = "fuchsia", variant, label, ...props }) {
|
|
|
24
24
|
role: label ? "img" : void 0,
|
|
25
25
|
"aria-label": label,
|
|
26
26
|
"aria-hidden": label ? void 0 : true,
|
|
27
|
-
className: cn("inline-flex size-4 shrink-0 items-center justify-center", className),
|
|
27
|
+
className: cn("sa:inline-flex sa:size-4 sa:shrink-0 sa:items-center sa:justify-center", className),
|
|
28
28
|
...props,
|
|
29
29
|
children: /* @__PURE__ */ jsx("span", { className: dotVariants({ variant }) })
|
|
30
30
|
}
|
|
@@ -32,5 +32,3 @@ function Dot({ className, tone = "fuchsia", variant, label, ...props }) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export { Dot, dotVariants };
|
|
35
|
-
//# sourceMappingURL=chunk-B2K45IUR.js.map
|
|
36
|
-
//# sourceMappingURL=chunk-B2K45IUR.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { useFieldChrome, FieldChrome } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { useFieldChrome, FieldChrome } from './chunk-UCCNXGLG.js';
|
|
2
|
+
import { useSatinLabels } from './chunk-SSOFFQ5T.js';
|
|
3
|
+
import { cn } from './chunk-O46O6LFQ.js';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { Minus, Plus } from 'iconoir-react';
|
|
5
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -22,9 +23,14 @@ function NumberInput({
|
|
|
22
23
|
name,
|
|
23
24
|
wrapperClassName,
|
|
24
25
|
className,
|
|
26
|
+
"aria-describedby": describedBy,
|
|
27
|
+
onChange,
|
|
28
|
+
onBlur,
|
|
29
|
+
onKeyDown,
|
|
25
30
|
...props
|
|
26
31
|
}) {
|
|
27
32
|
const chrome = useFieldChrome({ id, disabled, error, hint });
|
|
33
|
+
const labels = useSatinLabels();
|
|
28
34
|
const [inner, setInner] = React.useState(defaultValue);
|
|
29
35
|
const value = valueProp ?? inner;
|
|
30
36
|
const [draft, setDraft] = React.useState(null);
|
|
@@ -43,10 +49,10 @@ function NumberInput({
|
|
|
43
49
|
const atMin = value <= min;
|
|
44
50
|
const atMax = value >= max;
|
|
45
51
|
const btn = cn(
|
|
46
|
-
"grid size-6 shrink-0 place-items-center rounded-md text-text-muted outline-none",
|
|
47
|
-
"transition-[background-color,color,opacity] duration-(--duration-fast) ease-(--ease-out)",
|
|
48
|
-
"hover:bg-bg-hover hover:text-text-default focus-visible:[box-shadow:0_0_0_2px_var(--action-focus-ring)]",
|
|
49
|
-
"disabled:pointer-events-none disabled:opacity-40 [&_svg]:size-4 [&_svg]:[stroke-width:1.875]"
|
|
52
|
+
"sa:grid sa:size-6 sa:shrink-0 sa:place-items-center sa:rounded-md sa:text-text-muted sa:outline-none",
|
|
53
|
+
"sa:transition-[background-color,color,opacity] sa:duration-(--sa-duration-fast) sa:ease-(--sa-ease-out)",
|
|
54
|
+
"sa:hover:bg-bg-hover sa:hover:text-text-default sa:focus-visible:[box-shadow:0_0_0_2px_var(--action-focus-ring)]",
|
|
55
|
+
"sa:disabled:pointer-events-none sa:disabled:opacity-40 sa:[&_svg]:size-4 sa:[&_svg]:[stroke-width:1.875]"
|
|
50
56
|
);
|
|
51
57
|
return /* @__PURE__ */ jsx(FieldChrome, { label, chrome, className: wrapperClassName, children: /* @__PURE__ */ jsxs(
|
|
52
58
|
"div",
|
|
@@ -56,14 +62,14 @@ function NumberInput({
|
|
|
56
62
|
"data-filled": true,
|
|
57
63
|
"data-invalid": chrome.invalid || void 0,
|
|
58
64
|
"data-disabled": chrome.disabled || void 0,
|
|
59
|
-
className: cn("satin-field gap-1 px-1", className),
|
|
65
|
+
className: cn("satin-field sa:gap-1 sa:px-1", className),
|
|
60
66
|
children: [
|
|
61
67
|
/* @__PURE__ */ jsx(
|
|
62
68
|
"button",
|
|
63
69
|
{
|
|
64
70
|
type: "button",
|
|
65
71
|
tabIndex: -1,
|
|
66
|
-
"aria-label":
|
|
72
|
+
"aria-label": labels.decrease,
|
|
67
73
|
"aria-controls": chrome.controlId,
|
|
68
74
|
disabled: chrome.disabled || atMin,
|
|
69
75
|
onClick: () => by(-1),
|
|
@@ -74,6 +80,7 @@ function NumberInput({
|
|
|
74
80
|
/* @__PURE__ */ jsx(
|
|
75
81
|
"input",
|
|
76
82
|
{
|
|
83
|
+
...props,
|
|
77
84
|
id: chrome.controlId,
|
|
78
85
|
name,
|
|
79
86
|
role: "spinbutton",
|
|
@@ -83,13 +90,20 @@ function NumberInput({
|
|
|
83
90
|
"aria-valuemax": Number.isFinite(max) ? max : void 0,
|
|
84
91
|
"aria-valuetext": formatValue(value),
|
|
85
92
|
"aria-invalid": chrome.invalid || void 0,
|
|
86
|
-
"aria-describedby": chrome.describedBy,
|
|
87
|
-
"aria-label": props["aria-label"],
|
|
93
|
+
"aria-describedby": [describedBy, chrome.describedBy].filter(Boolean).join(" ") || void 0,
|
|
88
94
|
disabled: chrome.disabled,
|
|
89
95
|
value: draft ?? formatValue(value),
|
|
90
|
-
onChange: (e) =>
|
|
91
|
-
|
|
96
|
+
onChange: (e) => {
|
|
97
|
+
onChange?.(e);
|
|
98
|
+
setDraft(e.target.value);
|
|
99
|
+
},
|
|
100
|
+
onBlur: (e) => {
|
|
101
|
+
onBlur?.(e);
|
|
102
|
+
if (draft != null) commit(Number(draft.replace(",", ".").replace(/[^\d.-]/g, "")) || 0);
|
|
103
|
+
},
|
|
92
104
|
onKeyDown: (e) => {
|
|
105
|
+
onKeyDown?.(e);
|
|
106
|
+
if (e.defaultPrevented) return;
|
|
93
107
|
const keys = {
|
|
94
108
|
ArrowUp: () => by(1),
|
|
95
109
|
ArrowDown: () => by(-1),
|
|
@@ -105,7 +119,7 @@ function NumberInput({
|
|
|
105
119
|
keys[e.key]();
|
|
106
120
|
}
|
|
107
121
|
},
|
|
108
|
-
className: "satin-field-input text-center tabular-nums"
|
|
122
|
+
className: "satin-field-input sa:text-center sa:tabular-nums"
|
|
109
123
|
}
|
|
110
124
|
),
|
|
111
125
|
/* @__PURE__ */ jsx(
|
|
@@ -113,7 +127,7 @@ function NumberInput({
|
|
|
113
127
|
{
|
|
114
128
|
type: "button",
|
|
115
129
|
tabIndex: -1,
|
|
116
|
-
"aria-label":
|
|
130
|
+
"aria-label": labels.increase,
|
|
117
131
|
"aria-controls": chrome.controlId,
|
|
118
132
|
disabled: chrome.disabled || atMax,
|
|
119
133
|
onClick: () => by(1),
|
|
@@ -127,5 +141,3 @@ function NumberInput({
|
|
|
127
141
|
}
|
|
128
142
|
|
|
129
143
|
export { NumberInput };
|
|
130
|
-
//# sourceMappingURL=chunk-LW3TRU5W.js.map
|
|
131
|
-
//# sourceMappingURL=chunk-LW3TRU5W.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { useFieldChrome, FieldChrome, Select } from './chunk-
|
|
2
|
-
import { Button } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { useFieldChrome, FieldChrome, Select } from './chunk-UCCNXGLG.js';
|
|
2
|
+
import { Button } from './chunk-T6L32XXH.js';
|
|
3
|
+
import { useSatinLabels } from './chunk-SSOFFQ5T.js';
|
|
4
|
+
import { cn } from './chunk-O46O6LFQ.js';
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { Popover } from 'radix-ui';
|
|
6
7
|
import { Calendar as Calendar$1, NavArrowDown, NavArrowLeft, NavArrowRight } from 'iconoir-react';
|
|
@@ -40,8 +41,12 @@ function Calendar({
|
|
|
40
41
|
min,
|
|
41
42
|
max,
|
|
42
43
|
today: todayProp,
|
|
43
|
-
className
|
|
44
|
+
className,
|
|
45
|
+
ref,
|
|
46
|
+
onPointerLeave,
|
|
47
|
+
...props
|
|
44
48
|
}) {
|
|
49
|
+
const labels = useSatinLabels();
|
|
45
50
|
const today = startOfDay(todayProp ?? /* @__PURE__ */ new Date());
|
|
46
51
|
const anchor = mode === "range" ? range?.from : value;
|
|
47
52
|
const [innerMonth, setInnerMonth] = React.useState(() => addMonths(anchor ?? today, 0));
|
|
@@ -53,6 +58,14 @@ function Calendar({
|
|
|
53
58
|
const [focus, setFocus] = React.useState(() => startOfDay(anchor ?? today));
|
|
54
59
|
const [hover, setHover] = React.useState(null);
|
|
55
60
|
const gridRef = React.useRef(null);
|
|
61
|
+
const setRoot = React.useCallback(
|
|
62
|
+
(node) => {
|
|
63
|
+
gridRef.current = node;
|
|
64
|
+
if (typeof ref === "function") ref(node);
|
|
65
|
+
else if (ref) ref.current = node;
|
|
66
|
+
},
|
|
67
|
+
[ref]
|
|
68
|
+
);
|
|
56
69
|
const disabled = (d) => min && d < startOfDay(min) || max && d > startOfDay(max) || false;
|
|
57
70
|
const picking = mode === "range" && !!range?.from && !range?.to;
|
|
58
71
|
const pick = (d) => {
|
|
@@ -95,46 +108,46 @@ function Calendar({
|
|
|
95
108
|
const lo = range?.from && end ? end < range.from ? end : range.from : null;
|
|
96
109
|
const hi = range?.from && end ? end < range.from ? range.from : end : null;
|
|
97
110
|
const titleId = `cal-${m.getFullYear()}-${m.getMonth()}`;
|
|
98
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex w-[280px] shrink-0 flex-col gap-2", children: [
|
|
99
|
-
header === "picker" && months === 1 ? /* @__PURE__ */ jsxs("div", { className: "flex h-8 items-center gap-1", children: [
|
|
100
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
101
|
-
navBtn(-1,
|
|
102
|
-
/* @__PURE__ */ jsx("span", { id: titleId, className: "min-w-[72px] text-center text-sm leading-5 font-medium text-text-default", children: MONTHS[m.getMonth()] }),
|
|
103
|
-
navBtn(1,
|
|
111
|
+
return /* @__PURE__ */ jsxs("div", { className: "sa:flex sa:w-[280px] sa:shrink-0 sa:flex-col sa:gap-2", children: [
|
|
112
|
+
header === "picker" && months === 1 ? /* @__PURE__ */ jsxs("div", { className: "sa:flex sa:h-8 sa:items-center sa:gap-1", children: [
|
|
113
|
+
/* @__PURE__ */ jsxs("div", { className: "sa:flex sa:items-center sa:gap-1", children: [
|
|
114
|
+
navBtn(-1, labels.previousMonth, () => setMonth(addMonths(month, -1))),
|
|
115
|
+
/* @__PURE__ */ jsx("span", { id: titleId, className: "sa:min-w-[72px] sa:text-center sa:text-sm sa:leading-5 sa:font-medium sa:text-text-default", children: MONTHS[m.getMonth()] }),
|
|
116
|
+
navBtn(1, labels.nextMonth, () => setMonth(addMonths(month, 1)))
|
|
104
117
|
] }),
|
|
105
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1" }),
|
|
118
|
+
/* @__PURE__ */ jsx("span", { className: "sa:flex-1" }),
|
|
106
119
|
/* @__PURE__ */ jsx(
|
|
107
120
|
Select,
|
|
108
121
|
{
|
|
109
122
|
size: "sm",
|
|
110
|
-
"aria-label":
|
|
123
|
+
"aria-label": labels.year,
|
|
111
124
|
value: String(m.getFullYear()),
|
|
112
125
|
onValueChange: (y) => setMonth(new Date(Number(y), m.getMonth(), 1)),
|
|
113
126
|
options: yearOptions(m.getFullYear(), today.getFullYear(), min, max),
|
|
114
|
-
wrapperClassName: "w-auto shrink-0",
|
|
115
|
-
className: "w-[92px]"
|
|
127
|
+
wrapperClassName: "sa:w-auto sa:shrink-0",
|
|
128
|
+
className: "sa:w-[92px]"
|
|
116
129
|
}
|
|
117
130
|
)
|
|
118
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "flex h-8 items-center gap-1", children: [
|
|
119
|
-
months === 2 && (i === 0 ? navBtn(-1,
|
|
120
|
-
/* @__PURE__ */ jsxs("span", { id: titleId, className: cn("flex-1 text-sm leading-5 font-medium text-text-default", months === 2 && "text-center"), children: [
|
|
131
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "sa:flex sa:h-8 sa:items-center sa:gap-1", children: [
|
|
132
|
+
months === 2 && (i === 0 ? navBtn(-1, labels.previousMonth, () => setMonth(addMonths(month, -1))) : /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "sa:size-6 sa:shrink-0" })),
|
|
133
|
+
/* @__PURE__ */ jsxs("span", { id: titleId, className: cn("sa:flex-1 sa:text-sm sa:leading-5 sa:font-medium sa:text-text-default", months === 2 && "sa:text-center"), children: [
|
|
121
134
|
MONTHS[m.getMonth()],
|
|
122
135
|
" ",
|
|
123
136
|
m.getFullYear()
|
|
124
137
|
] }),
|
|
125
|
-
months === 1 && navBtn(-1,
|
|
126
|
-
months === 2 && i === 0 && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "size-6 shrink-0" }),
|
|
127
|
-
(months === 1 || i === 1) && navBtn(1,
|
|
138
|
+
months === 1 && navBtn(-1, labels.previousMonth, () => setMonth(addMonths(month, -1))),
|
|
139
|
+
months === 2 && i === 0 && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "sa:size-6 sa:shrink-0" }),
|
|
140
|
+
(months === 1 || i === 1) && navBtn(1, labels.nextMonth, () => setMonth(addMonths(month, 1)))
|
|
128
141
|
] }),
|
|
129
|
-
/* @__PURE__ */ jsxs("div", { role: "grid", "aria-labelledby": titleId, className: "flex flex-col gap-1", onKeyDown, children: [
|
|
130
|
-
/* @__PURE__ */ jsx("div", { role: "row", className: "flex", children: DOW.map((d, k) => /* @__PURE__ */ jsx("span", { role: "columnheader", "aria-label": DOW_FULL[k], className: "grid h-6 w-10 place-items-center text-xs text-text-muted", children: d }, k)) }),
|
|
131
|
-
weeksOf(m).map((week, w) => /* @__PURE__ */ jsx("div", { role: "row", className: "flex", children: week.map((d) => {
|
|
142
|
+
/* @__PURE__ */ jsxs("div", { role: "grid", "aria-labelledby": titleId, className: "sa:flex sa:flex-col sa:gap-1", onKeyDown, children: [
|
|
143
|
+
/* @__PURE__ */ jsx("div", { role: "row", className: "sa:flex", children: DOW.map((d, k) => /* @__PURE__ */ jsx("span", { role: "columnheader", "aria-label": DOW_FULL[k], className: "sa:grid sa:h-6 sa:w-10 sa:place-items-center sa:text-xs sa:text-text-muted", children: d }, k)) }),
|
|
144
|
+
weeksOf(m).map((week, w) => /* @__PURE__ */ jsx("div", { role: "row", className: "sa:flex", children: week.map((d) => {
|
|
132
145
|
const out = d.getMonth() !== m.getMonth();
|
|
133
146
|
const isSingle = mode === "single" && sameDay(d, value);
|
|
134
147
|
const isEnd = mode === "range" && !out && (sameDay(d, range?.from) || sameDay(d, range?.to));
|
|
135
148
|
const inBand = mode === "range" && !out && lo && hi && !sameDay(lo, hi) && d >= lo && d <= hi;
|
|
136
|
-
const bandFrom = inBand && sameDay(d, lo) ? "left-1/2" : "left-0";
|
|
137
|
-
const bandTo = inBand && sameDay(d, hi) ? "right-1/2" : "right-0";
|
|
149
|
+
const bandFrom = inBand && sameDay(d, lo) ? "sa:left-1/2" : "sa:left-0";
|
|
150
|
+
const bandTo = inBand && sameDay(d, hi) ? "sa:right-1/2" : "sa:right-0";
|
|
138
151
|
const isHoverEnd = picking && !out && sameDay(d, hover) && !isEnd;
|
|
139
152
|
const isToday = sameDay(d, today);
|
|
140
153
|
const off = disabled(d);
|
|
@@ -145,9 +158,9 @@ function Calendar({
|
|
|
145
158
|
role: "gridcell",
|
|
146
159
|
"aria-selected": isSingle || isEnd || void 0,
|
|
147
160
|
onPointerEnter: () => picking && !out && !off && setHover(d),
|
|
148
|
-
className: "relative grid size-10 place-items-center",
|
|
161
|
+
className: "sa:relative sa:grid sa:size-10 sa:place-items-center",
|
|
149
162
|
children: [
|
|
150
|
-
inBand && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("absolute inset-y-0.5 bg-status-brand-bg", bandFrom, bandTo) }),
|
|
163
|
+
inBand && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("sa:absolute sa:inset-y-0.5 sa:bg-status-brand-bg", bandFrom, bandTo) }),
|
|
151
164
|
/* @__PURE__ */ jsxs(
|
|
152
165
|
"button",
|
|
153
166
|
{
|
|
@@ -163,17 +176,17 @@ function Calendar({
|
|
|
163
176
|
},
|
|
164
177
|
onFocus: () => setFocus(d),
|
|
165
178
|
className: cn(
|
|
166
|
-
"relative grid size-9 place-items-center text-sm leading-5 font-medium outline-none",
|
|
179
|
+
"sa:relative sa:grid sa:size-9 sa:place-items-center sa:text-sm sa:leading-5 sa:font-medium sa:outline-none",
|
|
167
180
|
// While the end is being picked the band and the end circle move together,
|
|
168
181
|
// so neither fades: a fade here would trail the pointer.
|
|
169
|
-
!picking && "transition-[background-color,color] duration-(--duration-fast) ease-(--ease-out)",
|
|
170
|
-
"focus-visible:[box-shadow:0_0_0_2px_var(--action-focus-ring)] disabled:pointer-events-none disabled:opacity-40",
|
|
171
|
-
isEnd ? "rounded-md" : "rounded-full",
|
|
172
|
-
isSingle || isEnd ? "bg-action-primary-bg text-text-on-solid" : cn(out ? "text-text-subtle" : "text-text-default", isHoverEnd ? "bg-bg-hover" : !inBand && "hover:bg-bg-hover")
|
|
182
|
+
!picking && "sa:transition-[background-color,color] sa:duration-(--sa-duration-fast) sa:ease-(--sa-ease-out)",
|
|
183
|
+
"sa:focus-visible:[box-shadow:0_0_0_2px_var(--action-focus-ring)] sa:disabled:pointer-events-none sa:disabled:opacity-40",
|
|
184
|
+
isEnd ? "sa:rounded-md" : "sa:rounded-full",
|
|
185
|
+
isSingle || isEnd ? "sa:bg-action-primary-bg sa:text-text-on-solid" : cn(out ? "sa:text-text-subtle" : "sa:text-text-default", isHoverEnd ? "sa:bg-bg-hover" : !inBand && "sa:hover:bg-bg-hover")
|
|
173
186
|
),
|
|
174
187
|
children: [
|
|
175
188
|
d.getDate(),
|
|
176
|
-
isToday && !isSingle && !isEnd && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute bottom-1 left-1/2 h-0.5 w-3
|
|
189
|
+
isToday && !isSingle && !isEnd && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "sa:absolute sa:bottom-1 sa:left-1/2 sa:h-0.5 sa:w-3 sa:-translate-x-1/2 sa:rounded-full sa:bg-action-primary-bg" })
|
|
177
190
|
]
|
|
178
191
|
}
|
|
179
192
|
)
|
|
@@ -185,7 +198,20 @@ function Calendar({
|
|
|
185
198
|
] })
|
|
186
199
|
] }, i);
|
|
187
200
|
};
|
|
188
|
-
return /* @__PURE__ */ jsx(
|
|
201
|
+
return /* @__PURE__ */ jsx(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
...props,
|
|
205
|
+
ref: setRoot,
|
|
206
|
+
"data-slot": "calendar",
|
|
207
|
+
className: cn("sa:flex sa:gap-6", className),
|
|
208
|
+
onPointerLeave: (e) => {
|
|
209
|
+
onPointerLeave?.(e);
|
|
210
|
+
setHover(null);
|
|
211
|
+
},
|
|
212
|
+
children: Array.from({ length: months }, (_, i) => renderMonth(addMonths(month, i), i))
|
|
213
|
+
}
|
|
214
|
+
);
|
|
189
215
|
}
|
|
190
216
|
function yearOptions(shown, thisYear, min, max) {
|
|
191
217
|
const from = min ? min.getFullYear() : Math.min(shown, thisYear - 100);
|
|
@@ -196,12 +222,12 @@ function yearOptions(shown, thisYear, min, max) {
|
|
|
196
222
|
});
|
|
197
223
|
}
|
|
198
224
|
var surfaceClass = cn(
|
|
199
|
-
"rounded-xl border border-border-default bg-bg-popover",
|
|
200
|
-
"[box-shadow:0_4px_6px_-4px_var(--effect-shadow-sm),0_10px_15px_-3px_var(--effect-shadow-sm)]"
|
|
225
|
+
"sa:rounded-xl sa:border sa:border-border-default sa:bg-bg-popover",
|
|
226
|
+
"sa:[box-shadow:0_4px_6px_-4px_var(--effect-shadow-sm),0_10px_15px_-3px_var(--effect-shadow-sm)]"
|
|
201
227
|
);
|
|
202
228
|
var popClass = cn(
|
|
203
|
-
"z-50 outline-none",
|
|
204
|
-
"origin-(--radix-popover-content-transform-origin) data-[state=open]:animate-[satin-enter_var(--duration-base)_var(--ease-out)]"
|
|
229
|
+
"sa:z-50 sa:outline-none",
|
|
230
|
+
"sa:origin-(--radix-popover-content-transform-origin) sa:data-[state=open]:animate-[satin-enter_var(--sa-duration-base)_var(--sa-ease-out)]"
|
|
205
231
|
);
|
|
206
232
|
function Trigger({ text, placeholder, chrome, size, open, className, ...props }) {
|
|
207
233
|
return /* @__PURE__ */ jsxs(
|
|
@@ -218,18 +244,18 @@ function Trigger({ text, placeholder, chrome, size, open, className, ...props })
|
|
|
218
244
|
disabled: chrome.disabled,
|
|
219
245
|
"aria-invalid": chrome.invalid || void 0,
|
|
220
246
|
"aria-describedby": chrome.describedBy,
|
|
221
|
-
className: cn("satin-field cursor-pointer text-left", className),
|
|
247
|
+
className: cn("satin-field sa:cursor-pointer sa:text-left", className),
|
|
222
248
|
...props,
|
|
223
249
|
children: [
|
|
224
250
|
/* @__PURE__ */ jsx("span", { className: "satin-field-icon", "aria-hidden": true, children: /* @__PURE__ */ jsx(Calendar$1, {}) }),
|
|
225
|
-
/* @__PURE__ */ jsx("span", { className: cn("min-w-0 flex-1 truncate", text ? "text-text-default" : "text-text-placeholder"), children: text || placeholder }),
|
|
226
|
-
/* @__PURE__ */ jsx("span", { className: "satin-field-icon", "aria-hidden": true, children: /* @__PURE__ */ jsx(NavArrowDown, { className: cn("transition-transform duration-(--duration-fast) ease-(--ease-out)", open && "rotate-180") }) })
|
|
251
|
+
/* @__PURE__ */ jsx("span", { className: cn("sa:min-w-0 sa:flex-1 sa:truncate", text ? "sa:text-text-default" : "sa:text-text-placeholder"), children: text || placeholder }),
|
|
252
|
+
/* @__PURE__ */ jsx("span", { className: "satin-field-icon", "aria-hidden": true, children: /* @__PURE__ */ jsx(NavArrowDown, { className: cn("sa:transition-transform sa:duration-(--sa-duration-fast) sa:ease-(--sa-ease-out)", open && "sa:rotate-180") }) })
|
|
227
253
|
]
|
|
228
254
|
}
|
|
229
255
|
);
|
|
230
256
|
}
|
|
231
|
-
function DatePickerPanel({ value, onValueChange, min, max, today, className }) {
|
|
232
|
-
return /* @__PURE__ */ jsx("div", { "data-slot": "date-picker-panel", className: cn(surfaceClass, "w-fit p-3", className), children: /* @__PURE__ */ jsx(Calendar, { header: "picker", value, onValueChange, min, max, today }) });
|
|
257
|
+
function DatePickerPanel({ value, onValueChange, min, max, today, className, ...props }) {
|
|
258
|
+
return /* @__PURE__ */ jsx("div", { ...props, "data-slot": "date-picker-panel", className: cn(surfaceClass, "sa:w-fit sa:p-3", className), children: /* @__PURE__ */ jsx(Calendar, { header: "picker", value, onValueChange, min, max, today }) });
|
|
233
259
|
}
|
|
234
260
|
function DatePicker({
|
|
235
261
|
value: valueProp,
|
|
@@ -241,20 +267,34 @@ function DatePicker({
|
|
|
241
267
|
label,
|
|
242
268
|
hint,
|
|
243
269
|
error,
|
|
244
|
-
placeholder
|
|
270
|
+
placeholder,
|
|
245
271
|
disabled,
|
|
246
272
|
id,
|
|
247
273
|
size = "md",
|
|
248
274
|
container,
|
|
249
275
|
wrapperClassName,
|
|
250
|
-
className
|
|
276
|
+
className,
|
|
277
|
+
"aria-describedby": describedBy,
|
|
278
|
+
...props
|
|
251
279
|
}) {
|
|
252
280
|
const chrome = useFieldChrome({ id, disabled, error, hint });
|
|
281
|
+
const labels = useSatinLabels();
|
|
253
282
|
const [inner, setInner] = React.useState(defaultValue);
|
|
254
283
|
const value = valueProp !== void 0 ? valueProp : inner;
|
|
255
284
|
const [open, setOpen] = React.useState(false);
|
|
256
285
|
return /* @__PURE__ */ jsx(FieldChrome, { label, chrome, className: wrapperClassName, children: /* @__PURE__ */ jsxs(Popover.Root, { open, onOpenChange: setOpen, children: [
|
|
257
|
-
/* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
286
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, ...props, children: /* @__PURE__ */ jsx(
|
|
287
|
+
Trigger,
|
|
288
|
+
{
|
|
289
|
+
text: value ? formatDate(value) : "",
|
|
290
|
+
placeholder: placeholder ?? labels.pickDate,
|
|
291
|
+
chrome,
|
|
292
|
+
size,
|
|
293
|
+
open,
|
|
294
|
+
"aria-describedby": [describedBy, chrome.describedBy].filter(Boolean).join(" ") || void 0,
|
|
295
|
+
className
|
|
296
|
+
}
|
|
297
|
+
) }),
|
|
258
298
|
/* @__PURE__ */ jsx(Popover.Portal, { container, children: /* @__PURE__ */ jsx(Popover.Content, { "data-slot": "date-picker", align: "start", sideOffset: 4, collisionPadding: 8, className: popClass, children: /* @__PURE__ */ jsx(
|
|
259
299
|
DatePickerPanel,
|
|
260
300
|
{
|
|
@@ -282,17 +322,20 @@ function DateRangePicker({
|
|
|
282
322
|
label,
|
|
283
323
|
hint,
|
|
284
324
|
error,
|
|
285
|
-
placeholder
|
|
325
|
+
placeholder,
|
|
286
326
|
disabled,
|
|
287
327
|
id,
|
|
288
328
|
size = "md",
|
|
289
|
-
applyLabel
|
|
290
|
-
cancelLabel
|
|
329
|
+
applyLabel,
|
|
330
|
+
cancelLabel,
|
|
291
331
|
container,
|
|
292
332
|
wrapperClassName,
|
|
293
|
-
className
|
|
333
|
+
className,
|
|
334
|
+
"aria-describedby": describedBy,
|
|
335
|
+
...props
|
|
294
336
|
}) {
|
|
295
337
|
const chrome = useFieldChrome({ id, disabled, error, hint });
|
|
338
|
+
const labels = useSatinLabels();
|
|
296
339
|
const [inner, setInner] = React.useState(defaultValue);
|
|
297
340
|
const value = valueProp ?? inner;
|
|
298
341
|
const [open, setOpen] = React.useState(false);
|
|
@@ -302,7 +345,18 @@ function DateRangePicker({
|
|
|
302
345
|
setOpen(false);
|
|
303
346
|
};
|
|
304
347
|
return /* @__PURE__ */ jsx(FieldChrome, { label, chrome, className: wrapperClassName, children: /* @__PURE__ */ jsxs(Popover.Root, { open, onOpenChange: setOpen, children: [
|
|
305
|
-
/* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
348
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, ...props, children: /* @__PURE__ */ jsx(
|
|
349
|
+
Trigger,
|
|
350
|
+
{
|
|
351
|
+
text: formatRange(value),
|
|
352
|
+
placeholder: placeholder ?? labels.pickDates,
|
|
353
|
+
chrome,
|
|
354
|
+
size,
|
|
355
|
+
open,
|
|
356
|
+
"aria-describedby": [describedBy, chrome.describedBy].filter(Boolean).join(" ") || void 0,
|
|
357
|
+
className
|
|
358
|
+
}
|
|
359
|
+
) }),
|
|
306
360
|
/* @__PURE__ */ jsx(Popover.Portal, { container, children: /* @__PURE__ */ jsx(Popover.Content, { "data-slot": "date-range-picker", align: "start", sideOffset: 4, collisionPadding: 8, className: popClass, children: /* @__PURE__ */ jsx(
|
|
307
361
|
DateRangePickerPanel,
|
|
308
362
|
{
|
|
@@ -325,24 +379,24 @@ function DateRangePickerPanel({
|
|
|
325
379
|
min,
|
|
326
380
|
max,
|
|
327
381
|
today,
|
|
328
|
-
applyLabel
|
|
329
|
-
cancelLabel
|
|
330
|
-
className
|
|
382
|
+
applyLabel,
|
|
383
|
+
cancelLabel,
|
|
384
|
+
className,
|
|
385
|
+
...props
|
|
331
386
|
}) {
|
|
387
|
+
const labels = useSatinLabels();
|
|
332
388
|
const [draft, setDraft] = React.useState(value);
|
|
333
389
|
const [month, setMonth] = React.useState(() => addMonths(value.from ?? today ?? todayDate(), 0));
|
|
334
|
-
return /* @__PURE__ */ jsxs("div", { "data-slot": "date-range-picker-panel", className: cn(surfaceClass, "flex w-fit shrink-0 flex-col overflow-hidden", className), children: [
|
|
335
|
-
/* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsx(Calendar, { mode: "range", months: 2, range: draft, onRangeChange: setDraft, month, onMonthChange: setMonth, min, max, today }) }),
|
|
336
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 border-t border-border-subtle px-3 py-2", children: [
|
|
390
|
+
return /* @__PURE__ */ jsxs("div", { ...props, "data-slot": "date-range-picker-panel", className: cn(surfaceClass, "sa:flex sa:w-fit sa:shrink-0 sa:flex-col sa:overflow-hidden", className), children: [
|
|
391
|
+
/* @__PURE__ */ jsx("div", { className: "sa:p-3", children: /* @__PURE__ */ jsx(Calendar, { mode: "range", months: 2, range: draft, onRangeChange: setDraft, month, onMonthChange: setMonth, min, max, today }) }),
|
|
392
|
+
/* @__PURE__ */ jsxs("div", { className: "sa:flex sa:items-center sa:justify-end sa:gap-2 sa:border-t sa:border-border-subtle sa:px-3 sa:py-2", children: [
|
|
337
393
|
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => {
|
|
338
394
|
setDraft(value);
|
|
339
395
|
onCancel?.();
|
|
340
|
-
}, children: cancelLabel }),
|
|
341
|
-
/* @__PURE__ */ jsx(Button, { disabled: !draft.from || !draft.to, onClick: () => onApply?.(draft), children: applyLabel })
|
|
396
|
+
}, children: cancelLabel ?? labels.cancel }),
|
|
397
|
+
/* @__PURE__ */ jsx(Button, { disabled: !draft.from || !draft.to, onClick: () => onApply?.(draft), children: applyLabel ?? labels.apply })
|
|
342
398
|
] })
|
|
343
399
|
] });
|
|
344
400
|
}
|
|
345
401
|
|
|
346
402
|
export { Calendar, DatePicker, DatePickerPanel, DateRangePicker, DateRangePickerPanel, formatDate, formatRange };
|
|
347
|
-
//# sourceMappingURL=chunk-XZNHT6MO.js.map
|
|
348
|
-
//# sourceMappingURL=chunk-XZNHT6MO.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Button } from './chunk-
|
|
4
|
-
import {
|
|
1
|
+
import { FileIcon, Attachment } from './chunk-UUCVRIVP.js';
|
|
2
|
+
import { Progress } from './chunk-M2HEVFQ3.js';
|
|
3
|
+
import { Button } from './chunk-T6L32XXH.js';
|
|
4
|
+
import { useSatinLabels } from './chunk-SSOFFQ5T.js';
|
|
5
|
+
import { cn } from './chunk-O46O6LFQ.js';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { Page, WarningCircle, Xmark } from 'iconoir-react';
|
|
7
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -30,7 +31,7 @@ function fileIconFor(name) {
|
|
|
30
31
|
const e = ext(name);
|
|
31
32
|
if (e === "pdf") return /* @__PURE__ */ jsx(FileIcon, { type: "pdf" });
|
|
32
33
|
if (["xls", "xlsx", "csv", "numbers"].includes(e)) return /* @__PURE__ */ jsx(FileIcon, { type: "xlsx" });
|
|
33
|
-
return /* @__PURE__ */ jsx(Page, { "aria-hidden": true, className: "size-icon-size text-text-muted [stroke-width:1.875]" });
|
|
34
|
+
return /* @__PURE__ */ jsx(Page, { "aria-hidden": true, className: "sa:size-icon-size sa:text-text-muted sa:[stroke-width:1.875]" });
|
|
34
35
|
}
|
|
35
36
|
function FileUpload({
|
|
36
37
|
files = [],
|
|
@@ -51,6 +52,7 @@ function FileUpload({
|
|
|
51
52
|
className,
|
|
52
53
|
...props
|
|
53
54
|
}) {
|
|
55
|
+
const labels = useSatinLabels();
|
|
54
56
|
const inputRef = React.useRef(null);
|
|
55
57
|
const descriptionId = React.useId();
|
|
56
58
|
const [dragging, setDragging] = React.useState(false);
|
|
@@ -71,7 +73,7 @@ function FileUpload({
|
|
|
71
73
|
};
|
|
72
74
|
const rows = files.filter((f) => f.status !== "done");
|
|
73
75
|
const done = files.filter((f) => f.status === "done");
|
|
74
|
-
return /* @__PURE__ */ jsxs("div", { "data-slot": "file-upload", className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
76
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "file-upload", className: cn("sa:flex sa:w-full sa:flex-col sa:gap-2", className), ...props, children: [
|
|
75
77
|
/* @__PURE__ */ jsxs(
|
|
76
78
|
"div",
|
|
77
79
|
{
|
|
@@ -101,16 +103,16 @@ function FileUpload({
|
|
|
101
103
|
take(e.dataTransfer.files);
|
|
102
104
|
},
|
|
103
105
|
className: cn(
|
|
104
|
-
"flex flex-col items-center gap-4 rounded-2xl border border-dashed border-border-default px-6 py-8 text-center",
|
|
105
|
-
"transition-[background-color,border-color] duration-(--duration-fast) ease-(--ease-out)",
|
|
106
|
-
"data-[dragging]:border-status-brand-border data-[dragging]:bg-bg-hover",
|
|
107
|
-
"data-[disabled]:opacity-50"
|
|
106
|
+
"sa:flex sa:flex-col sa:items-center sa:gap-4 sa:rounded-2xl sa:border sa:border-dashed sa:border-border-default sa:px-6 sa:py-8 sa:text-center",
|
|
107
|
+
"sa:transition-[background-color,border-color] sa:duration-(--sa-duration-fast) sa:ease-(--sa-ease-out)",
|
|
108
|
+
"sa:data-[dragging]:border-status-brand-border sa:data-[dragging]:bg-bg-hover",
|
|
109
|
+
"sa:data-[disabled]:opacity-50"
|
|
108
110
|
),
|
|
109
111
|
children: [
|
|
110
112
|
/* @__PURE__ */ jsx(UploadMark, { over }),
|
|
111
|
-
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col items-center gap-1", children: [
|
|
112
|
-
/* @__PURE__ */ jsx("p", { className: "text-base font-medium text-text-default", children: over ? dropTitle : title }),
|
|
113
|
-
description && /* @__PURE__ */ jsx("p", { id: descriptionId, className: "text-sm text-text-muted", children: description })
|
|
113
|
+
/* @__PURE__ */ jsxs("div", { className: "sa:flex sa:w-full sa:flex-col sa:items-center sa:gap-1", children: [
|
|
114
|
+
/* @__PURE__ */ jsx("p", { className: "sa:text-base sa:font-medium sa:text-text-default", children: over ? dropTitle : title }),
|
|
115
|
+
description && /* @__PURE__ */ jsx("p", { id: descriptionId, className: "sa:text-sm sa:text-text-muted", children: description })
|
|
114
116
|
] }),
|
|
115
117
|
/* @__PURE__ */ jsx(
|
|
116
118
|
Button,
|
|
@@ -141,8 +143,8 @@ function FileUpload({
|
|
|
141
143
|
]
|
|
142
144
|
}
|
|
143
145
|
),
|
|
144
|
-
rows.length > 0 && /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2", "aria-label":
|
|
145
|
-
done.length > 0 && /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2", "aria-label":
|
|
146
|
+
rows.length > 0 && /* @__PURE__ */ jsx("ul", { className: "sa:flex sa:flex-col sa:gap-2", "aria-label": labels.files, children: rows.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(FileUploadItem, { file: f, onCancel, onRemove }) }, f.id)) }),
|
|
147
|
+
done.length > 0 && /* @__PURE__ */ jsx("ul", { className: "sa:flex sa:flex-col sa:gap-2", "aria-label": labels.attachedFiles, children: done.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
146
148
|
Attachment,
|
|
147
149
|
{
|
|
148
150
|
name: f.name,
|
|
@@ -150,7 +152,7 @@ function FileUpload({
|
|
|
150
152
|
icon: f.icon ?? fileIconFor(f.name),
|
|
151
153
|
onRemove: onRemove ? () => onRemove(f) : void 0,
|
|
152
154
|
onOpen: onOpen ? () => onOpen(f) : void 0,
|
|
153
|
-
className: "flex w-full [&_[data-attachment-main]]:flex-1 [&_[data-attachment-name]]:max-w-none"
|
|
155
|
+
className: "sa:flex sa:w-full sa:[&_[data-attachment-main]]:flex-1 sa:[&_[data-attachment-name]]:max-w-none"
|
|
154
156
|
}
|
|
155
157
|
) }, f.id)) })
|
|
156
158
|
] });
|
|
@@ -168,11 +170,11 @@ function FileUploadItem({
|
|
|
168
170
|
"data-slot": "file-upload-item",
|
|
169
171
|
"data-status": "error",
|
|
170
172
|
role: "alert",
|
|
171
|
-
className: cn("flex items-center gap-2 rounded-xl border border-status-red-border bg-status-red-bg py-2 pr-2 pl-3 text-sm", className),
|
|
173
|
+
className: cn("sa:flex sa:items-center sa:gap-2 sa:rounded-xl sa:border sa:border-status-red-border sa:bg-status-red-bg sa:py-2 sa:pr-2 sa:pl-3 sa:text-sm", className),
|
|
172
174
|
children: [
|
|
173
|
-
/* @__PURE__ */ jsx(WarningCircle, { "aria-hidden": true, className: "size-icon-size shrink-0 text-status-red-fg [stroke-width:1.875]" }),
|
|
174
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-medium text-text-default", children: file.name }),
|
|
175
|
-
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-status-red-fg", children: file.error ?? "Upload failed" }),
|
|
175
|
+
/* @__PURE__ */ jsx(WarningCircle, { "aria-hidden": true, className: "sa:size-icon-size sa:shrink-0 sa:text-status-red-fg sa:[stroke-width:1.875]" }),
|
|
176
|
+
/* @__PURE__ */ jsx("span", { className: "sa:min-w-0 sa:flex-1 sa:truncate sa:font-medium sa:text-text-default", children: file.name }),
|
|
177
|
+
/* @__PURE__ */ jsx("span", { className: "sa:shrink-0 sa:text-status-red-fg", children: file.error ?? "Upload failed" }),
|
|
176
178
|
onRemove && /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "xs", shape: "rounded", iconOnly: true, "aria-label": `Remove ${file.name}`, onClick: () => onRemove(file), children: /* @__PURE__ */ jsx(Xmark, { "aria-hidden": true }) })
|
|
177
179
|
]
|
|
178
180
|
}
|
|
@@ -186,13 +188,13 @@ function FileUploadItem({
|
|
|
186
188
|
{
|
|
187
189
|
"data-slot": "file-upload-item",
|
|
188
190
|
"data-status": "uploading",
|
|
189
|
-
className: cn("flex items-center gap-2 rounded-xl border border-border-default bg-bg-card p-2 text-sm", className),
|
|
191
|
+
className: cn("sa:flex sa:items-center sa:gap-2 sa:rounded-xl sa:border sa:border-border-default sa:bg-bg-card sa:p-2 sa:text-sm", className),
|
|
190
192
|
children: [
|
|
191
|
-
/* @__PURE__ */ jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-lg bg-bg-muted [&_svg]:size-icon-size", children: file.icon ?? fileIconFor(file.name) }),
|
|
192
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
193
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
194
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-medium text-text-default", children: file.name }),
|
|
195
|
-
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-text-muted tabular-nums", children: meta })
|
|
193
|
+
/* @__PURE__ */ jsx("span", { className: "sa:flex sa:size-9 sa:shrink-0 sa:items-center sa:justify-center sa:rounded-lg sa:bg-bg-muted sa:[&_svg]:size-icon-size", children: file.icon ?? fileIconFor(file.name) }),
|
|
194
|
+
/* @__PURE__ */ jsxs("div", { className: "sa:flex sa:min-w-0 sa:flex-1 sa:flex-col sa:gap-1.5", children: [
|
|
195
|
+
/* @__PURE__ */ jsxs("div", { className: "sa:flex sa:items-center sa:gap-2", children: [
|
|
196
|
+
/* @__PURE__ */ jsx("span", { className: "sa:min-w-0 sa:flex-1 sa:truncate sa:font-medium sa:text-text-default", children: file.name }),
|
|
197
|
+
/* @__PURE__ */ jsx("span", { className: "sa:shrink-0 sa:text-text-muted sa:tabular-nums", children: meta })
|
|
196
198
|
] }),
|
|
197
199
|
/* @__PURE__ */ jsx(Progress, { value: known ? p : void 0, showValue: false, "aria-label": `Uploading ${file.name}` })
|
|
198
200
|
] }),
|
|
@@ -207,10 +209,10 @@ function UploadMark({ over }) {
|
|
|
207
209
|
{
|
|
208
210
|
"aria-hidden": true,
|
|
209
211
|
className: cn(
|
|
210
|
-
"flex size-10 shrink-0 items-center justify-center rounded-xl transition-[background-color] duration-(--duration-fast) ease-(--ease-out)",
|
|
211
|
-
over ? "bg-bg-card" : "bg-bg-muted"
|
|
212
|
+
"sa:flex sa:size-10 sa:shrink-0 sa:items-center sa:justify-center sa:rounded-xl sa:transition-[background-color] sa:duration-(--sa-duration-fast) sa:ease-(--sa-ease-out)",
|
|
213
|
+
over ? "sa:bg-bg-card" : "sa:bg-bg-muted"
|
|
212
214
|
),
|
|
213
|
-
children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", className: "text-text-subtle", children: [
|
|
215
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", className: "sa:text-text-subtle", children: [
|
|
214
216
|
/* @__PURE__ */ jsx(
|
|
215
217
|
"path",
|
|
216
218
|
{
|
|
@@ -235,5 +237,3 @@ function UploadMark({ over }) {
|
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
export { FileUpload, FileUploadItem, fileIconFor, formatBytes };
|
|
238
|
-
//# sourceMappingURL=chunk-GICKPMJU.js.map
|
|
239
|
-
//# sourceMappingURL=chunk-GICKPMJU.js.map
|