@kanzo-tech/ui 0.11.0 → 0.13.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/dist/analytics.d.ts +1 -0
- package/dist/analytics.d.ts.map +1 -1
- package/dist/charts/chart-inputs.d.ts +6 -5
- package/dist/charts/chart-inputs.d.ts.map +1 -1
- package/dist/charts/chart-inputs.js +78 -77
- package/dist/charts/chart-inputs.js.map +1 -1
- package/dist/charts/chart-marks.d.ts +2 -1
- package/dist/charts/chart-marks.d.ts.map +1 -1
- package/dist/charts/chart-marks.js.map +1 -1
- package/dist/charts/chart-root.d.ts +8 -3
- package/dist/charts/chart-root.d.ts.map +1 -1
- package/dist/charts/chart-root.js +60 -60
- package/dist/charts/chart-root.js.map +1 -1
- package/dist/charts/chart-spec.d.ts +11 -4
- package/dist/charts/chart-spec.d.ts.map +1 -1
- package/dist/charts/chart-spec.js +44 -40
- package/dist/charts/chart-spec.js.map +1 -1
- package/dist/charts/chart-stat.d.ts +3 -2
- package/dist/charts/chart-stat.d.ts.map +1 -1
- package/dist/charts/chart-stat.js +10 -9
- package/dist/charts/chart-stat.js.map +1 -1
- package/dist/composites/language-picker.d.ts +51 -0
- package/dist/composites/language-picker.d.ts.map +1 -0
- package/dist/composites/language-picker.js +165 -0
- package/dist/composites/language-picker.js.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +687 -677
- package/dist/index.js.map +1 -1
- package/dist/lib/control-size.d.ts +26 -0
- package/dist/lib/control-size.d.ts.map +1 -0
- package/dist/lib/control-size.js +11 -0
- package/dist/lib/control-size.js.map +1 -0
- package/dist/lib/use-async-collection.d.ts +57 -0
- package/dist/lib/use-async-collection.d.ts.map +1 -0
- package/dist/lib/use-async-collection.js +43 -0
- package/dist/lib/use-async-collection.js.map +1 -0
- package/dist/lib/use-debounced-commit.d.ts +28 -0
- package/dist/lib/use-debounced-commit.d.ts.map +1 -0
- package/dist/lib/use-debounced-commit.js +26 -0
- package/dist/lib/use-debounced-commit.js.map +1 -0
- package/dist/shark-parity.divergences.d.ts.map +1 -1
- package/dist/simples/button.d.ts.map +1 -1
- package/dist/simples/button.js +34 -33
- package/dist/simples/button.js.map +1 -1
- package/dist/simples/checkbox.d.ts.map +1 -1
- package/dist/simples/checkbox.js +42 -42
- package/dist/simples/checkbox.js.map +1 -1
- package/dist/simples/combobox.d.ts.map +1 -1
- package/dist/simples/combobox.js +48 -49
- package/dist/simples/combobox.js.map +1 -1
- package/dist/simples/date-picker.d.ts +58 -2
- package/dist/simples/date-picker.d.ts.map +1 -1
- package/dist/simples/date-picker.js +210 -73
- package/dist/simples/date-picker.js.map +1 -1
- package/dist/simples/field.d.ts +35 -2
- package/dist/simples/field.d.ts.map +1 -1
- package/dist/simples/field.js +146 -116
- package/dist/simples/field.js.map +1 -1
- package/dist/simples/input-group.d.ts +9 -9
- package/dist/simples/input-group.d.ts.map +1 -1
- package/dist/simples/input-group.js +68 -78
- package/dist/simples/input-group.js.map +1 -1
- package/dist/simples/input.d.ts +9 -9
- package/dist/simples/input.d.ts.map +1 -1
- package/dist/simples/input.js +13 -14
- package/dist/simples/input.js.map +1 -1
- package/dist/simples/locale.d.ts +4 -0
- package/dist/simples/locale.d.ts.map +1 -0
- package/dist/simples/locale.js +8 -0
- package/dist/simples/locale.js.map +1 -0
- package/dist/simples/native-select.d.ts +9 -9
- package/dist/simples/native-select.d.ts.map +1 -1
- package/dist/simples/native-select.js +29 -28
- package/dist/simples/native-select.js.map +1 -1
- package/dist/simples/number-input.d.ts +9 -9
- package/dist/simples/number-input.d.ts.map +1 -1
- package/dist/simples/number-input.js +27 -27
- package/dist/simples/number-input.js.map +1 -1
- package/dist/simples/password-input.d.ts.map +1 -1
- package/dist/simples/password-input.js +24 -20
- package/dist/simples/password-input.js.map +1 -1
- package/dist/simples/pin-input.d.ts +9 -9
- package/dist/simples/pin-input.d.ts.map +1 -1
- package/dist/simples/pin-input.js +30 -29
- package/dist/simples/pin-input.js.map +1 -1
- package/dist/simples/radio-group.d.ts.map +1 -1
- package/dist/simples/radio-group.js +44 -43
- package/dist/simples/radio-group.js.map +1 -1
- package/dist/simples/segment-group.d.ts +8 -0
- package/dist/simples/segment-group.d.ts.map +1 -1
- package/dist/simples/segment-group.js +66 -52
- package/dist/simples/segment-group.js.map +1 -1
- package/dist/simples/switch.d.ts.map +1 -1
- package/dist/simples/switch.js +18 -12
- package/dist/simples/switch.js.map +1 -1
- package/dist/simples/tags-input.d.ts.map +1 -1
- package/dist/simples/tags-input.js +44 -39
- package/dist/simples/tags-input.js.map +1 -1
- package/dist/simples/toggle.d.ts +9 -9
- package/dist/simples/toggle.d.ts.map +1 -1
- package/dist/simples/toggle.js +24 -23
- package/dist/simples/toggle.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sources":["../../src/simples/checkbox.tsx"],"sourcesContent":["import {\n Checkbox as ArkCheckbox,\n useCheckboxContext,\n} from \"@ark-ui/react/checkbox\";\nimport { CheckIcon, MinusIcon } from \"lucide-react\";\nimport type React from \"react\";\nimport { tv } from \"tailwind-variants\";\nimport { cn } from \"../lib/cn\";\n\nexport const useCheckbox = useCheckboxContext;\n\nexport const CheckboxGroup = (\n props: React.ComponentProps<typeof ArkCheckbox.Group>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCheckbox.Group\n className={cn(\"flex flex-col gap-2\", className)}\n {...rest}\n data-slot={slot ?? \"checkbox-group\"}\n />\n );\n};\n\nexport const checkboxVariants = tv({\n base: [\n \"relative\",\n \"inline-flex shrink-0 items-center justify-center\",\n \"bg-transparent\",\n \"rounded-selector border border-input shadow-xs/5\",\n \"transition-shadow\",\n \"data-focus-visible:border-primary data-focus-visible:ring-[3px] data-focus-visible:ring-ring data-focus-visible:ring-offset-1 data-focus-visible:ring-offset-background\",\n \"dark:data-focus-visible:data-invalid:border-destructive-foreground/64 dark:data-focus-visible:data-invalid:ring-destructive-foreground/48\",\n \"data-disabled:opacity-64\",\n \"[[data-disabled],[data-checked],[data-invalid]]:shadow-none\",\n \"data-invalid:border-destructive data-invalid:ring-[3px] data-invalid:ring-destructive/24\",\n \"dark:data-invalid:text-destructive-foreground\",\n \"dark:not-data-checked:bg-field\",\n \"motion-reduce:transition-none!\",\n ],\n});\n\n/**\n * Two defects this component carried for as long as it existed, both found by a composite trying to\n * use it and both measured before the fix.\n *\n * The box styling sat on the **root**, so the root was the box and there was nowhere for a label to\n * go: `children` arrived through `...rest` above hardcoded JSX children, JSX children win, and\n * `<Checkbox>Sealed orders</Checkbox>` rendered `textContent: \"\"`. Four docs examples are written\n * that way, the default one included, so the Checkbox page shipped unlabelled boxes\n *. `RadioGroupItem` one file over already had\n * the right shape — box on the control, root as the row, children beside it — and this now matches\n * it. `checkboxVariants` still names the box; what changed is which element wears it.\n *\n * And `role=\"checkbox\"` sat on that root, which is Ark's `<label>`, while `HiddenInput` renders a\n * real `<input type=\"checkbox\">` underneath. Two elements answered to the role, the outer carrying\n * the name and the inner the focus. Ark declares no role there on purpose: the input is the\n * control, and the label names it through the `htmlFor` Ark already sets.\n */\nexport const Checkbox = (\n props: React.ComponentProps<typeof ArkCheckbox.Root>\n) => {\n const {\n className,\n tabIndex,\n slot,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n } = props;\n\n return (\n <ArkCheckbox.Root\n className={cn(
|
|
1
|
+
{"version":3,"file":"checkbox.js","sources":["../../src/simples/checkbox.tsx"],"sourcesContent":["import {\n Checkbox as ArkCheckbox,\n useCheckboxContext,\n} from \"@ark-ui/react/checkbox\";\nimport { CheckIcon, MinusIcon } from \"lucide-react\";\nimport type React from \"react\";\nimport { tv } from \"tailwind-variants\";\nimport { cn } from \"../lib/cn\";\nimport { controlMinHeight, controlSizes } from \"../lib/control-size\";\n\nexport const useCheckbox = useCheckboxContext;\n\nexport const CheckboxGroup = (\n props: React.ComponentProps<typeof ArkCheckbox.Group>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCheckbox.Group\n className={cn(\"flex flex-col gap-2\", className)}\n {...rest}\n data-slot={slot ?? \"checkbox-group\"}\n />\n );\n};\n\n/**\n * The row an indicator and its label sit in. **Labelled, it is one control tall** — the shared\n * height, centred — so a switch, a checkbox or a radio lines up with an input beside it and with the\n * rows above and below in a form. Alone (no children: a cell in a table) it is the indicator and\n * nothing else, and the height is not asked of it.\n */\nconst checkboxRowVariants = tv({\n base: [\"inline-flex items-center gap-2\", \"text-sm\", \"data-disabled:opacity-64\"],\n variants: { labelled: { true: [controlSizes.md, controlMinHeight] } },\n});\n\nexport const checkboxVariants = tv({\n base: [\n \"relative\",\n \"inline-flex shrink-0 items-center justify-center\",\n \"bg-transparent\",\n \"rounded-selector border border-input shadow-xs/5\",\n \"transition-shadow\",\n \"data-focus-visible:border-primary data-focus-visible:ring-[3px] data-focus-visible:ring-ring data-focus-visible:ring-offset-1 data-focus-visible:ring-offset-background\",\n \"dark:data-focus-visible:data-invalid:border-destructive-foreground/64 dark:data-focus-visible:data-invalid:ring-destructive-foreground/48\",\n \"data-disabled:opacity-64\",\n \"[[data-disabled],[data-checked],[data-invalid]]:shadow-none\",\n \"data-invalid:border-destructive data-invalid:ring-[3px] data-invalid:ring-destructive/24\",\n \"dark:data-invalid:text-destructive-foreground\",\n \"dark:not-data-checked:bg-field\",\n \"motion-reduce:transition-none!\",\n ],\n});\n\n/**\n * Two defects this component carried for as long as it existed, both found by a composite trying to\n * use it and both measured before the fix.\n *\n * The box styling sat on the **root**, so the root was the box and there was nowhere for a label to\n * go: `children` arrived through `...rest` above hardcoded JSX children, JSX children win, and\n * `<Checkbox>Sealed orders</Checkbox>` rendered `textContent: \"\"`. Four docs examples are written\n * that way, the default one included, so the Checkbox page shipped unlabelled boxes\n *. `RadioGroupItem` one file over already had\n * the right shape — box on the control, root as the row, children beside it — and this now matches\n * it. `checkboxVariants` still names the box; what changed is which element wears it.\n *\n * And `role=\"checkbox\"` sat on that root, which is Ark's `<label>`, while `HiddenInput` renders a\n * real `<input type=\"checkbox\">` underneath. Two elements answered to the role, the outer carrying\n * the name and the inner the focus. Ark declares no role there on purpose: the input is the\n * control, and the label names it through the `htmlFor` Ark already sets.\n */\nexport const Checkbox = (\n props: React.ComponentProps<typeof ArkCheckbox.Root>\n) => {\n const {\n className,\n tabIndex,\n slot,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n } = props;\n\n return (\n <ArkCheckbox.Root\n className={cn(checkboxRowVariants({ labelled: children != null }), className)}\n {...rest}\n data-slot={slot ?? \"checkbox\"}\n >\n <ArkCheckbox.Control\n className={checkboxVariants()}\n data-slot=\"checkbox-control\"\n >\n <CheckboxIndicator>\n <CheckIcon />\n </CheckboxIndicator>\n\n <CheckboxIndicator indeterminate>\n <MinusIcon />\n </CheckboxIndicator>\n </ArkCheckbox.Control>\n\n {children}\n\n {/* The name belongs to the control, and the control is this input. Ark's root is a\n `<label htmlFor>`, so visible children name it for free — but an `aria-label` on a\n `<label>` names nothing, which is why the two naming props are forwarded here. */}\n <ArkCheckbox.HiddenInput\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n tabIndex={tabIndex}\n />\n </ArkCheckbox.Root>\n );\n};\n\nexport const CheckboxIndicator = (\n props: React.ComponentProps<typeof ArkCheckbox.Indicator>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCheckbox.Indicator\n className={cn(\n \"absolute -inset-px\",\n \"flex items-center justify-center\",\n \"rounded-selector\",\n \"text-primary-foreground\",\n \"data-[state=checked]:bg-primary\",\n \"data-[state=unchecked]:hidden\",\n \"data-[state=indeterminate]:text-foreground\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"checkbox-indicator\"}\n />\n );\n};\n"],"names":["useCheckbox","useCheckboxContext","CheckboxGroup","props","className","slot","rest","jsx","ArkCheckbox","cn","checkboxRowVariants","tv","controlSizes","controlMinHeight","checkboxVariants","Checkbox","tabIndex","children","ariaLabel","ariaLabelledBy","jsxs","CheckboxIndicator","CheckIcon","MinusIcon"],"mappings":";;;;;;AAUO,MAAMA,IAAcC,GAEdC,IAAgB,CAC3BC,MACG;AACH,QAAM,EAAE,WAAAC,GAAW,MAAAC,GAAM,GAAGC,MAASH;AAErC,SACE,gBAAAI;AAAA,IAACC,EAAY;AAAA,IAAZ;AAAA,MACC,WAAWC,EAAG,uBAAuBL,CAAS;AAAA,MAC7C,GAAGE;AAAA,MACJ,aAAWD,KAAQ;AAAA,IAAA;AAAA,EAAA;AAGzB,GAQMK,IAAsBC,EAAG;AAAA,EAC7B,MAAM,CAAC,kCAAkC,WAAW,0BAA0B;AAAA,EAC9E,UAAU,EAAE,UAAU,EAAE,MAAM,CAACC,EAAa,IAAIC,CAAgB,EAAA,EAAE;AACpE,CAAC,GAEYC,IAAmBH,EAAG;AAAA,EACjC,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ,CAAC,GAmBYI,IAAW,CACtBZ,MACG;AACH,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,UAAAY;AAAA,IACA,MAAAX;AAAA,IACA,UAAAY;AAAA,IACA,cAAcC;AAAA,IACd,mBAAmBC;AAAA,IACnB,GAAGb;AAAA,EAAA,IACDH;AAEJ,SACE,gBAAAiB;AAAA,IAACZ,EAAY;AAAA,IAAZ;AAAA,MACC,WAAWC,EAAGC,EAAoB,EAAE,UAAUO,KAAY,KAAA,CAAM,GAAGb,CAAS;AAAA,MAC3E,GAAGE;AAAA,MACJ,aAAWD,KAAQ;AAAA,MAEnB,UAAA;AAAA,QAAA,gBAAAe;AAAA,UAACZ,EAAY;AAAA,UAAZ;AAAA,YACC,WAAWM,EAAA;AAAA,YACX,aAAU;AAAA,YA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YAAY,GAAI,OAAO,iBAAiB,sBAqBpD,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,OAAO,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,KAAK,CAAC,sBAiBtD,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,OAAO,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,sBAWpD,CAAC"}
|
package/dist/simples/combobox.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
3
|
-
import { Combobox as a, useComboboxContext as
|
|
4
|
-
import { Portal as
|
|
5
|
-
import {
|
|
3
|
+
import { Combobox as a, useComboboxContext as p } from "@ark-ui/react/combobox";
|
|
4
|
+
import { Portal as x } from "@ark-ui/react/portal";
|
|
5
|
+
import { ChevronsUpDownIcon as d, XIcon as h, CheckIcon as g } from "lucide-react";
|
|
6
6
|
import { tv as f } from "tailwind-variants";
|
|
7
7
|
import { cn as c } from "../lib/cn.js";
|
|
8
8
|
import { Button as C } from "./button.js";
|
|
9
9
|
import { InputGroup as I, InputGroupInput as N, InputGroupAddon as v, InputGroupButton as m } from "./input-group.js";
|
|
10
|
-
const z =
|
|
10
|
+
const z = p, A = a.Context, D = (e) => {
|
|
11
11
|
const {
|
|
12
12
|
openOnClick: o = !0,
|
|
13
|
-
lazyMount:
|
|
14
|
-
unmountOnExit:
|
|
13
|
+
lazyMount: n = !0,
|
|
14
|
+
unmountOnExit: s = !0,
|
|
15
15
|
slot: r,
|
|
16
16
|
...l
|
|
17
17
|
} = e;
|
|
18
18
|
return /* @__PURE__ */ t(
|
|
19
19
|
a.Root,
|
|
20
20
|
{
|
|
21
|
-
lazyMount:
|
|
21
|
+
lazyMount: n,
|
|
22
22
|
openOnClick: o,
|
|
23
|
-
unmountOnExit:
|
|
23
|
+
unmountOnExit: s,
|
|
24
24
|
...l,
|
|
25
25
|
"data-slot": r ?? "combobox"
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
}, w = (e) => {
|
|
29
|
-
const { className: o, slot:
|
|
29
|
+
const { className: o, slot: n, ...s } = e;
|
|
30
30
|
return /* @__PURE__ */ t(
|
|
31
31
|
a.Control,
|
|
32
32
|
{
|
|
@@ -35,58 +35,57 @@ const z = u, A = a.Context, D = (e) => {
|
|
|
35
35
|
"relative flex flex-wrap items-center gap-1",
|
|
36
36
|
o
|
|
37
37
|
),
|
|
38
|
-
...
|
|
39
|
-
"data-slot":
|
|
38
|
+
...s,
|
|
39
|
+
"data-slot": n ?? "combobox-control"
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
42
|
}, M = (e) => {
|
|
43
43
|
const {
|
|
44
44
|
size: o = "md",
|
|
45
|
-
showTrigger:
|
|
46
|
-
showClear:
|
|
45
|
+
showTrigger: n = !0,
|
|
46
|
+
showClear: s = !1,
|
|
47
47
|
className: r,
|
|
48
48
|
children: l,
|
|
49
|
-
...
|
|
50
|
-
} = e, { inputValue:
|
|
49
|
+
...b
|
|
50
|
+
} = e, { inputValue: u } = z();
|
|
51
51
|
return /* @__PURE__ */ t(w, { "data-size": o, children: /* @__PURE__ */ i(I, { className: c(r), size: o, children: [
|
|
52
52
|
l,
|
|
53
|
-
/* @__PURE__ */ t(a.Input, { asChild: !0, children: /* @__PURE__ */ t(N, { ...
|
|
53
|
+
/* @__PURE__ */ t(a.Input, { asChild: !0, children: /* @__PURE__ */ t(N, { ...b }) }),
|
|
54
54
|
/* @__PURE__ */ i(v, { align: "inline-end", children: [
|
|
55
|
-
|
|
55
|
+
n && /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t(
|
|
56
56
|
m,
|
|
57
57
|
{
|
|
58
|
-
asChild: !0,
|
|
59
58
|
className: "group-has-data-[slot=combobox-clear]/input-group:hidden",
|
|
60
59
|
size: "icon-sm",
|
|
60
|
+
slot: "combobox-trigger",
|
|
61
61
|
variant: "ghost",
|
|
62
|
-
children: /* @__PURE__ */ t(
|
|
62
|
+
children: /* @__PURE__ */ t(d, {})
|
|
63
63
|
}
|
|
64
|
-
),
|
|
65
|
-
|
|
64
|
+
) }),
|
|
65
|
+
s && u && /* @__PURE__ */ t(G, { asChild: !0, children: /* @__PURE__ */ t(
|
|
66
66
|
m,
|
|
67
67
|
{
|
|
68
68
|
size: "icon-sm",
|
|
69
69
|
slot: "combobox-clear",
|
|
70
70
|
variant: "ghost",
|
|
71
|
-
children: /* @__PURE__ */ t(
|
|
71
|
+
children: /* @__PURE__ */ t(h, {})
|
|
72
72
|
}
|
|
73
73
|
) })
|
|
74
74
|
] })
|
|
75
75
|
] }) });
|
|
76
76
|
}, y = (e) => {
|
|
77
|
-
const { className: o, children:
|
|
77
|
+
const { className: o, children: n, ...s } = e;
|
|
78
78
|
return /* @__PURE__ */ t(
|
|
79
79
|
a.Trigger,
|
|
80
80
|
{
|
|
81
81
|
className: c(o),
|
|
82
|
-
...
|
|
82
|
+
...s,
|
|
83
83
|
asChild: !0,
|
|
84
|
-
children:
|
|
84
|
+
children: n ?? // **`icon-sm`, and it was `size-4`.** Measured 16×16 on `/docs/forms/combobox` — two thirds
|
|
85
85
|
// under the 24px WCAG 2.5.8 floor, and it only ever passed `pressable-floor.test.ts`
|
|
86
|
-
// because that guard grades a target by the last `size-*` it can see in source order.
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
/* @__PURE__ */ t(C, { className: "size-8", slot: "combobox-trigger", variant: "ghost", children: /* @__PURE__ */ t(g, {}) })
|
|
86
|
+
// because that guard grades a target by the last `size-*` it can see in source order. A
|
|
87
|
+
// size token rather than a literal, so it follows the control height with the rest.
|
|
88
|
+
/* @__PURE__ */ t(C, { size: "icon-sm", slot: "combobox-trigger", variant: "ghost", children: /* @__PURE__ */ t(d, {}) })
|
|
90
89
|
}
|
|
91
90
|
);
|
|
92
91
|
}, G = ({
|
|
@@ -96,8 +95,8 @@ const z = u, A = a.Context, D = (e) => {
|
|
|
96
95
|
slot: e,
|
|
97
96
|
...o
|
|
98
97
|
}) => /* @__PURE__ */ t(a.Positioner, { ...o, "data-slot": e ?? "combobox-positioner" }), U = (e) => {
|
|
99
|
-
const { className: o, children:
|
|
100
|
-
return /* @__PURE__ */ t(
|
|
98
|
+
const { className: o, children: n, slot: s, ...r } = e;
|
|
99
|
+
return /* @__PURE__ */ t(x, { children: /* @__PURE__ */ t(k, { children: /* @__PURE__ */ t(
|
|
101
100
|
a.Content,
|
|
102
101
|
{
|
|
103
102
|
className: c(
|
|
@@ -121,18 +120,18 @@ const z = u, A = a.Context, D = (e) => {
|
|
|
121
120
|
o
|
|
122
121
|
),
|
|
123
122
|
...r,
|
|
124
|
-
"data-slot":
|
|
125
|
-
children:
|
|
123
|
+
"data-slot": s ?? "combobox-content",
|
|
124
|
+
children: n
|
|
126
125
|
}
|
|
127
126
|
) }) });
|
|
128
127
|
}, X = (e) => {
|
|
129
|
-
const { heading: o, children:
|
|
130
|
-
return /* @__PURE__ */ i(a.ItemGroup, { ...r, "data-slot":
|
|
128
|
+
const { heading: o, children: n, slot: s, ...r } = e;
|
|
129
|
+
return /* @__PURE__ */ i(a.ItemGroup, { ...r, "data-slot": s ?? "combobox-group", children: [
|
|
131
130
|
!!o && /* @__PURE__ */ t(L, { children: o }),
|
|
132
|
-
|
|
131
|
+
n
|
|
133
132
|
] });
|
|
134
133
|
}, L = (e) => {
|
|
135
|
-
const { className: o, slot:
|
|
134
|
+
const { className: o, slot: n, ...s } = e;
|
|
136
135
|
return /* @__PURE__ */ t(
|
|
137
136
|
a.ItemGroupLabel,
|
|
138
137
|
{
|
|
@@ -140,8 +139,8 @@ const z = u, A = a.Context, D = (e) => {
|
|
|
140
139
|
"px-2 py-1.5 font-semibold text-muted-foreground text-xs",
|
|
141
140
|
o
|
|
142
141
|
),
|
|
143
|
-
...
|
|
144
|
-
"data-slot":
|
|
142
|
+
...s,
|
|
143
|
+
"data-slot": n ?? "combobox-group-label"
|
|
145
144
|
}
|
|
146
145
|
);
|
|
147
146
|
}, T = f({
|
|
@@ -169,22 +168,22 @@ const z = u, A = a.Context, D = (e) => {
|
|
|
169
168
|
showIndicator: !0
|
|
170
169
|
}
|
|
171
170
|
}), $ = (e) => {
|
|
172
|
-
const { showIndicator: o = !0, className:
|
|
171
|
+
const { showIndicator: o = !0, className: n, children: s, slot: r, ...l } = e;
|
|
173
172
|
return /* @__PURE__ */ i(
|
|
174
173
|
a.Item,
|
|
175
174
|
{
|
|
176
|
-
className: c(T({ showIndicator: o }),
|
|
175
|
+
className: c(T({ showIndicator: o }), n),
|
|
177
176
|
persistFocus: !0,
|
|
178
177
|
...l,
|
|
179
178
|
"data-slot": r ?? "combobox-item",
|
|
180
179
|
children: [
|
|
181
|
-
|
|
182
|
-
o ? /* @__PURE__ */ t("span", { className: "absolute inset-e-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ t(a.ItemIndicator, { "data-slot": "combobox-item-indicator", children: /* @__PURE__ */ t(
|
|
180
|
+
s,
|
|
181
|
+
o ? /* @__PURE__ */ t("span", { className: "absolute inset-e-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ t(a.ItemIndicator, { "data-slot": "combobox-item-indicator", children: /* @__PURE__ */ t(g, {}) }) }) : null
|
|
183
182
|
]
|
|
184
183
|
}
|
|
185
184
|
);
|
|
186
185
|
}, q = (e) => {
|
|
187
|
-
const { className: o, children:
|
|
186
|
+
const { className: o, children: n, slot: s, ...r } = e;
|
|
188
187
|
return /* @__PURE__ */ t(
|
|
189
188
|
a.Empty,
|
|
190
189
|
{
|
|
@@ -194,18 +193,18 @@ const z = u, A = a.Context, D = (e) => {
|
|
|
194
193
|
o
|
|
195
194
|
),
|
|
196
195
|
...r,
|
|
197
|
-
"data-slot":
|
|
198
|
-
children:
|
|
196
|
+
"data-slot": s ?? "combobox-empty",
|
|
197
|
+
children: n || "No results found."
|
|
199
198
|
}
|
|
200
199
|
);
|
|
201
200
|
}, H = (e) => {
|
|
202
|
-
const { className: o, slot:
|
|
201
|
+
const { className: o, slot: n, ...s } = e;
|
|
203
202
|
return /* @__PURE__ */ t(
|
|
204
203
|
a.List,
|
|
205
204
|
{
|
|
206
205
|
className: c("flex flex-col", o),
|
|
207
|
-
...
|
|
208
|
-
"data-slot":
|
|
206
|
+
...s,
|
|
207
|
+
"data-slot": n ?? "combobox-list"
|
|
209
208
|
}
|
|
210
209
|
);
|
|
211
210
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","sources":["../../src/simples/combobox.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Combobox as ArkCombobox,\n type ComboboxList as ArkComboboxList,\n useComboboxContext as useArkComboboxContext,\n} from \"@ark-ui/react/combobox\";\nimport { Portal } from \"@ark-ui/react/portal\";\nimport { CheckIcon, ChevronsUpDownIcon, XIcon } from \"lucide-react\";\nimport type React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\nimport { cn } from \"../lib/cn\";\nimport { Button } from \"./button\";\nimport type { inputVariants } from \"./input\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"./input-group\";\n\nexport const useCombobox = useArkComboboxContext;\n\nexport const ComboboxContext = ArkCombobox.Context;\n\nexport const Combobox: ArkCombobox.RootComponent = (props) => {\n const {\n openOnClick = true,\n lazyMount = true,\n unmountOnExit = true,\n slot,\n ...rest\n } = props;\n\n return (\n <ArkCombobox.Root\n lazyMount={lazyMount}\n openOnClick={openOnClick}\n unmountOnExit={unmountOnExit}\n {...rest}\n data-slot={slot ?? \"combobox\"}\n />\n );\n};\n\nexport const ComboboxControl = (\n props: React.ComponentProps<typeof ArkCombobox.Control>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCombobox.Control\n className={cn(\n \"group/combobox-control\",\n \"relative flex flex-wrap items-center gap-1\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"combobox-control\"}\n />\n );\n};\n\ninterface ComboboxInputProps\n extends Omit<React.ComponentProps<typeof ArkCombobox.Input>, \"size\">,\n VariantProps<typeof inputVariants> {\n /**\n * Whether the control is disabled.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Whether to show the clear button.\n *\n * @default false\n */\n showClear?: boolean;\n /**\n * Whether to show the trigger button.\n *\n * @default true\n */\n showTrigger?: boolean;\n}\n\nexport const ComboboxInput = (props: ComboboxInputProps) => {\n const {\n size = \"md\",\n showTrigger = true,\n showClear = false,\n className,\n children,\n ...rest\n } = props;\n\n const { inputValue } = useCombobox();\n\n return (\n <ComboboxControl data-size={size}>\n <InputGroup className={cn(className)} size={size}>\n {children}\n <ArkCombobox.Input asChild>\n <InputGroupInput {...rest} />\n </ArkCombobox.Input>\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n asChild\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden\"\n size=\"icon-sm\"\n variant=\"ghost\"\n >\n <ComboboxTrigger />\n </InputGroupButton>\n )}\n {showClear && inputValue && (\n <ComboboxClear asChild>\n <InputGroupButton\n size=\"icon-sm\"\n slot=\"combobox-clear\"\n variant=\"ghost\"\n >\n <XIcon />\n </InputGroupButton>\n </ComboboxClear>\n )}\n </InputGroupAddon>\n </InputGroup>\n </ComboboxControl>\n );\n};\n\nexport const ComboboxTrigger = (\n props: React.ComponentProps<typeof ArkCombobox.Trigger>\n) => {\n const { className, children, ...rest } = props;\n\n return (\n <ArkCombobox.Trigger\n // **No positioning of its own, and the `absolute inset-e-1 inset-y-0` it carried was inert.**\n // Both compositions lay it out already: `Combobox` puts it in an `InputGroupAddon`, and a\n // caller composing by hand drops it into `ComboboxControl`, which is a `flex items-center`\n // row. In the first, the `asChild` collapse merges it with `InputGroupButton`, whose base\n // declares `relative` and wins — so the offsets resolved against nothing and the part was\n // laid out as the flex child it looks like. Keeping a rule that only bites when a later merge\n // stops overriding it is how a component acquires a bug it never had.\n className={cn(className)}\n {...rest}\n asChild\n >\n {children ?? (\n // **`size-8`, and it was `size-4`.** Measured 16×16 on `/docs/forms/combobox` — two thirds\n // under the 24px WCAG 2.5.8 floor, and it only ever passed `pressable-floor.test.ts`\n // because that guard grades a target by the last `size-*` it can see in source order. It\n // also read as a different class of control beside the 32px marks every other in-group\n // button is: `icon-sm` is the one size a control inside a group has.\n <Button className=\"size-8\" slot=\"combobox-trigger\" variant=\"ghost\">\n <ChevronsUpDownIcon />\n </Button>\n )}\n </ArkCombobox.Trigger>\n );\n};\n\nexport const ComboboxClear = ({\n slot,\n ...rest\n}: React.ComponentProps<typeof ArkCombobox.ClearTrigger>) => (\n <ArkCombobox.ClearTrigger {...rest} data-slot={slot ?? \"combobox-clear\"} />\n);\n\n/** Composable combobox input for custom controls (e.g. Tags Input). */\nexport const ComboboxFieldInput = (\n { slot, ...rest }: React.ComponentProps<typeof ArkCombobox.Input>\n) => <ArkCombobox.Input {...rest} data-slot={slot ?? \"combobox-field-input\"} />;\n\nexport const ComboboxPositioner = ({\n slot,\n ...rest\n}: React.ComponentProps<typeof ArkCombobox.Positioner>) => (\n <ArkCombobox.Positioner {...rest} data-slot={slot ?? \"combobox-positioner\"} />\n);\n\nexport const ComboboxContent = (\n props: React.ComponentProps<typeof ArkCombobox.Content>\n) => {\n const { className, children, slot, ...rest } = props;\n\n return (\n <Portal>\n <ComboboxPositioner>\n <ArkCombobox.Content\n className={cn(\n \"relative z-50\",\n \"max-h-96 min-w-48\",\n \"origin-(--transform-origin)\",\n \"p-1\",\n \"bg-popover\",\n \"text-popover-foreground\",\n \"rounded-box border shadow-lg/5\",\n \"overflow-y-auto\",\n \"outline-none\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=open]:zoom-in-[98%] data-[state=closed]:zoom-out-[98%]\",\n \"data-[placement=top]:slide-in-from-bottom-2\",\n \"data-[placement=bottom]:slide-in-from-top-2\",\n \"data-[placement=right]:slide-in-from-start-2\",\n \"data-[placement=left]:slide-in-from-end-2\",\n \"motion-reduce:animate-none!\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"combobox-content\"}\n >\n {children}\n </ArkCombobox.Content>\n </ComboboxPositioner>\n </Portal>\n );\n};\n\ninterface ComboboxGroupProps\n extends React.ComponentProps<typeof ArkCombobox.ItemGroup> {\n /**\n * The heading of the group\n */\n heading?: string | React.ReactNode;\n}\n\nexport const ComboboxGroup = (props: ComboboxGroupProps) => {\n const { heading, children, slot, ...rest } = props;\n\n return (\n <ArkCombobox.ItemGroup {...rest} data-slot={slot ?? \"combobox-group\"}>\n {!!heading && <ComboboxGroupLabel>{heading}</ComboboxGroupLabel>}\n\n {children}\n </ArkCombobox.ItemGroup>\n );\n};\n\nexport const ComboboxGroupLabel = (\n props: React.ComponentProps<typeof ArkCombobox.ItemGroupLabel>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCombobox.ItemGroupLabel\n className={cn(\n \"px-2 py-1.5 font-semibold text-muted-foreground text-xs\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"combobox-group-label\"}\n />\n );\n};\n\nexport const comboboxItemVariants = tv({\n base: [\n \"relative\",\n \"py-1.5 ps-2\",\n \"text-sm\",\n \"flex w-full items-center gap-2\",\n \"rounded-box\",\n \"select-none\",\n \"cursor-default\",\n \"outline-hidden\",\n \"data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground\",\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground\",\n \"data-disabled:pointer-events-none data-disabled:opacity-64\",\n \"[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n ],\n variants: {\n showIndicator: {\n true: \"pe-8\",\n false: \"pe-2\",\n },\n },\n defaultVariants: {\n showIndicator: true,\n },\n});\n\ninterface ComboboxItemProps\n extends React.ComponentProps<typeof ArkCombobox.Item>,\n VariantProps<typeof comboboxItemVariants> {}\n\nexport const ComboboxItem = (props: ComboboxItemProps) => {\n const { showIndicator = true, className, children, slot, ...rest } = props;\n\n return (\n <ArkCombobox.Item\n className={cn(comboboxItemVariants({ showIndicator }), className)}\n persistFocus\n {...rest}\n data-slot={slot ?? \"combobox-item\"}\n >\n {children}\n\n {showIndicator ? (\n <span className=\"absolute inset-e-2 flex size-3.5 items-center justify-center\">\n <ArkCombobox.ItemIndicator data-slot=\"combobox-item-indicator\">\n <CheckIcon />\n </ArkCombobox.ItemIndicator>\n </span>\n ) : null}\n </ArkCombobox.Item>\n );\n};\n\nexport const ComboboxEmpty = (\n props: React.ComponentProps<typeof ArkCombobox.Empty>\n) => {\n const { className, children, slot, ...rest } = props;\n\n return (\n <ArkCombobox.Empty\n className={cn(\n \"px-2 py-1.5\",\n \"text-center text-muted-foreground text-sm\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"combobox-empty\"}\n >\n {children || \"No results found.\"}\n </ArkCombobox.Empty>\n );\n};\n\nexport const ComboboxList = (\n props: React.ComponentProps<typeof ArkComboboxList>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCombobox.List\n className={cn(\"flex flex-col\", className)}\n {...rest}\n data-slot={slot ?? \"combobox-list\"}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAqBO;AAKL;AAAM;AACU;AACF;AACI;AAChB;AACG;AAGL;AACE;AAAa;AAAZ;AACC;AACA;AACA;AACI;AACe;AAAA;AAGzB;AAKE;AAEA;AACE;AAAa;AAAZ;AACY;AACT;AACA;AACA;AAAA;AAEE;AACe;AAAA;AAGzB;AA2BE;AAAM;AACG;AACO;AACF;AACZ;AACA;AACG;AAKL;AAGO;AAAA;AAGD;AAEG;AACC;AAAC;AAAA;AACQ;AACG;AACL;AACG;AAES;AAAA;AAAA;AAKjB;AAAC;AAAA;AACM;AACA;AACG;AAED;AAAA;AAEX;AAEJ;AAIR;AAKE;AAEA;AACE;AAAa;AAAZ;AAQwB;AACnB;AACG;AAEN;AAAA;AAAA;AAAA;AAAA;AAQC;AAAA;AAIR;AAE8B;AAC5B;AAEF;AASmC;AACjC;AAEF;AAOE;AAEA;AAGM;AAAa;AAAZ;AACY;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEE;AACe;AAElB;AAAA;AAKX;AAWE;AAEA;AAEK;AAA0C;AAE1C;AAGP;AAKE;AAEA;AACE;AAAa;AAAZ;AACY;AACT;AACA;AAAA;AAEE;AACe;AAAA;AAGzB;AAEuC;AAC/B;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEQ;AACO;AACP;AACC;AAAA;AACT;AAEe;AACA;AAEnB;AAOE;AAEA;AACE;AAAa;AAAZ;AACiE;AACpD;AACR;AACe;AAElB;AAAA;AAQG;AAAA;AAAA;AAGV;AAKE;AAEA;AACE;AAAa;AAAZ;AACY;AACT;AACA;AACA;AAAA;AAEE;AACe;AAEN;AAAA;AAGnB;AAKE;AAEA;AACE;AAAa;AAAZ;AACyC;AACpC;AACe;AAAA;AAGzB;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"combobox.js","sources":["../../src/simples/combobox.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Combobox as ArkCombobox,\n type ComboboxList as ArkComboboxList,\n useComboboxContext as useArkComboboxContext,\n} from \"@ark-ui/react/combobox\";\nimport { Portal } from \"@ark-ui/react/portal\";\nimport { CheckIcon, ChevronsUpDownIcon, XIcon } from \"lucide-react\";\nimport type React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\nimport { cn } from \"../lib/cn\";\nimport { Button } from \"./button\";\nimport type { inputVariants } from \"./input\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"./input-group\";\n\nexport const useCombobox = useArkComboboxContext;\n\nexport const ComboboxContext = ArkCombobox.Context;\n\nexport const Combobox: ArkCombobox.RootComponent = (props) => {\n const {\n openOnClick = true,\n lazyMount = true,\n unmountOnExit = true,\n slot,\n ...rest\n } = props;\n\n return (\n <ArkCombobox.Root\n lazyMount={lazyMount}\n openOnClick={openOnClick}\n unmountOnExit={unmountOnExit}\n {...rest}\n data-slot={slot ?? \"combobox\"}\n />\n );\n};\n\nexport const ComboboxControl = (\n props: React.ComponentProps<typeof ArkCombobox.Control>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCombobox.Control\n className={cn(\n \"group/combobox-control\",\n \"relative flex flex-wrap items-center gap-1\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"combobox-control\"}\n />\n );\n};\n\ninterface ComboboxInputProps\n extends Omit<React.ComponentProps<typeof ArkCombobox.Input>, \"size\">,\n VariantProps<typeof inputVariants> {\n /**\n * Whether the control is disabled.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Whether to show the clear button.\n *\n * @default false\n */\n showClear?: boolean;\n /**\n * Whether to show the trigger button.\n *\n * @default true\n */\n showTrigger?: boolean;\n}\n\nexport const ComboboxInput = (props: ComboboxInputProps) => {\n const {\n size = \"md\",\n showTrigger = true,\n showClear = false,\n className,\n children,\n ...rest\n } = props;\n\n const { inputValue } = useCombobox();\n\n return (\n <ComboboxControl data-size={size}>\n <InputGroup className={cn(className)} size={size}>\n {children}\n <ArkCombobox.Input asChild>\n <InputGroupInput {...rest} />\n </ArkCombobox.Input>\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <ComboboxTrigger>\n <InputGroupButton\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden\"\n size=\"icon-sm\"\n slot=\"combobox-trigger\"\n variant=\"ghost\"\n >\n <ChevronsUpDownIcon />\n </InputGroupButton>\n </ComboboxTrigger>\n )}\n {showClear && inputValue && (\n <ComboboxClear asChild>\n <InputGroupButton\n size=\"icon-sm\"\n slot=\"combobox-clear\"\n variant=\"ghost\"\n >\n <XIcon />\n </InputGroupButton>\n </ComboboxClear>\n )}\n </InputGroupAddon>\n </InputGroup>\n </ComboboxControl>\n );\n};\n\nexport const ComboboxTrigger = (\n props: React.ComponentProps<typeof ArkCombobox.Trigger>\n) => {\n const { className, children, ...rest } = props;\n\n return (\n <ArkCombobox.Trigger\n // **No positioning of its own, and the `absolute inset-e-1 inset-y-0` it carried was inert.**\n // Both compositions lay it out already: `Combobox` puts it in an `InputGroupAddon`, and a\n // caller composing by hand drops it into `ComboboxControl`, which is a `flex items-center`\n // row. In the first, the `asChild` collapse merges it with `InputGroupButton`, whose base\n // declares `relative` and wins — so the offsets resolved against nothing and the part was\n // laid out as the flex child it looks like. Keeping a rule that only bites when a later merge\n // stops overriding it is how a component acquires a bug it never had.\n className={cn(className)}\n {...rest}\n asChild\n >\n {children ?? (\n // **`icon-sm`, and it was `size-4`.** Measured 16×16 on `/docs/forms/combobox` — two thirds\n // under the 24px WCAG 2.5.8 floor, and it only ever passed `pressable-floor.test.ts`\n // because that guard grades a target by the last `size-*` it can see in source order. A\n // size token rather than a literal, so it follows the control height with the rest.\n <Button size=\"icon-sm\" slot=\"combobox-trigger\" variant=\"ghost\">\n <ChevronsUpDownIcon />\n </Button>\n )}\n </ArkCombobox.Trigger>\n );\n};\n\nexport const ComboboxClear = ({\n slot,\n ...rest\n}: React.ComponentProps<typeof ArkCombobox.ClearTrigger>) => (\n <ArkCombobox.ClearTrigger {...rest} data-slot={slot ?? \"combobox-clear\"} />\n);\n\n/** Composable combobox input for custom controls (e.g. Tags Input). */\nexport const ComboboxFieldInput = (\n { slot, ...rest }: React.ComponentProps<typeof ArkCombobox.Input>\n) => <ArkCombobox.Input {...rest} data-slot={slot ?? \"combobox-field-input\"} />;\n\nexport const ComboboxPositioner = ({\n slot,\n ...rest\n}: React.ComponentProps<typeof ArkCombobox.Positioner>) => (\n <ArkCombobox.Positioner {...rest} data-slot={slot ?? \"combobox-positioner\"} />\n);\n\nexport const ComboboxContent = (\n props: React.ComponentProps<typeof ArkCombobox.Content>\n) => {\n const { className, children, slot, ...rest } = props;\n\n return (\n <Portal>\n <ComboboxPositioner>\n <ArkCombobox.Content\n className={cn(\n \"relative z-50\",\n \"max-h-96 min-w-48\",\n \"origin-(--transform-origin)\",\n \"p-1\",\n \"bg-popover\",\n \"text-popover-foreground\",\n \"rounded-box border shadow-lg/5\",\n \"overflow-y-auto\",\n \"outline-none\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=open]:zoom-in-[98%] data-[state=closed]:zoom-out-[98%]\",\n \"data-[placement=top]:slide-in-from-bottom-2\",\n \"data-[placement=bottom]:slide-in-from-top-2\",\n \"data-[placement=right]:slide-in-from-start-2\",\n \"data-[placement=left]:slide-in-from-end-2\",\n \"motion-reduce:animate-none!\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"combobox-content\"}\n >\n {children}\n </ArkCombobox.Content>\n </ComboboxPositioner>\n </Portal>\n );\n};\n\ninterface ComboboxGroupProps\n extends React.ComponentProps<typeof ArkCombobox.ItemGroup> {\n /**\n * The heading of the group\n */\n heading?: string | React.ReactNode;\n}\n\nexport const ComboboxGroup = (props: ComboboxGroupProps) => {\n const { heading, children, slot, ...rest } = props;\n\n return (\n <ArkCombobox.ItemGroup {...rest} data-slot={slot ?? \"combobox-group\"}>\n {!!heading && <ComboboxGroupLabel>{heading}</ComboboxGroupLabel>}\n\n {children}\n </ArkCombobox.ItemGroup>\n );\n};\n\nexport const ComboboxGroupLabel = (\n props: React.ComponentProps<typeof ArkCombobox.ItemGroupLabel>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCombobox.ItemGroupLabel\n className={cn(\n \"px-2 py-1.5 font-semibold text-muted-foreground text-xs\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"combobox-group-label\"}\n />\n );\n};\n\nexport const comboboxItemVariants = tv({\n base: [\n \"relative\",\n \"py-1.5 ps-2\",\n \"text-sm\",\n \"flex w-full items-center gap-2\",\n \"rounded-box\",\n \"select-none\",\n \"cursor-default\",\n \"outline-hidden\",\n \"data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground\",\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground\",\n \"data-disabled:pointer-events-none data-disabled:opacity-64\",\n \"[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n ],\n variants: {\n showIndicator: {\n true: \"pe-8\",\n false: \"pe-2\",\n },\n },\n defaultVariants: {\n showIndicator: true,\n },\n});\n\ninterface ComboboxItemProps\n extends React.ComponentProps<typeof ArkCombobox.Item>,\n VariantProps<typeof comboboxItemVariants> {}\n\nexport const ComboboxItem = (props: ComboboxItemProps) => {\n const { showIndicator = true, className, children, slot, ...rest } = props;\n\n return (\n <ArkCombobox.Item\n className={cn(comboboxItemVariants({ showIndicator }), className)}\n persistFocus\n {...rest}\n data-slot={slot ?? \"combobox-item\"}\n >\n {children}\n\n {showIndicator ? (\n <span className=\"absolute inset-e-2 flex size-3.5 items-center justify-center\">\n <ArkCombobox.ItemIndicator data-slot=\"combobox-item-indicator\">\n <CheckIcon />\n </ArkCombobox.ItemIndicator>\n </span>\n ) : null}\n </ArkCombobox.Item>\n );\n};\n\nexport const ComboboxEmpty = (\n props: React.ComponentProps<typeof ArkCombobox.Empty>\n) => {\n const { className, children, slot, ...rest } = props;\n\n return (\n <ArkCombobox.Empty\n className={cn(\n \"px-2 py-1.5\",\n \"text-center text-muted-foreground text-sm\",\n className\n )}\n {...rest}\n data-slot={slot ?? \"combobox-empty\"}\n >\n {children || \"No results found.\"}\n </ArkCombobox.Empty>\n );\n};\n\nexport const ComboboxList = (\n props: React.ComponentProps<typeof ArkComboboxList>\n) => {\n const { className, slot, ...rest } = props;\n\n return (\n <ArkCombobox.List\n className={cn(\"flex flex-col\", className)}\n {...rest}\n data-slot={slot ?? \"combobox-list\"}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAqBO;AAKL;AAAM;AACU;AACF;AACI;AAChB;AACG;AAGL;AACE;AAAa;AAAZ;AACC;AACA;AACA;AACI;AACe;AAAA;AAGzB;AAKE;AAEA;AACE;AAAa;AAAZ;AACY;AACT;AACA;AACA;AAAA;AAEE;AACe;AAAA;AAGzB;AA2BE;AAAM;AACG;AACO;AACF;AACZ;AACA;AACG;AAKL;AAGO;AAAA;AAGD;AAEG;AAEG;AAAC;AAAA;AACW;AACL;AACA;AACG;AAEY;AAAA;AAExB;AAIE;AAAC;AAAA;AACM;AACA;AACG;AAED;AAAA;AAEX;AAEJ;AAIR;AAKE;AAEA;AACE;AAAa;AAAZ;AAQwB;AACnB;AACG;AAEN;AAAA;AAAA;AAAA;AAOC;AAAA;AAIR;AAE8B;AAC5B;AAEF;AASmC;AACjC;AAEF;AAOE;AAEA;AAGM;AAAa;AAAZ;AACY;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEE;AACe;AAElB;AAAA;AAKX;AAWE;AAEA;AAEK;AAA0C;AAE1C;AAGP;AAKE;AAEA;AACE;AAAa;AAAZ;AACY;AACT;AACA;AAAA;AAEE;AACe;AAAA;AAGzB;AAEuC;AAC/B;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEQ;AACO;AACP;AACC;AAAA;AACT;AAEe;AACA;AAEnB;AAOE;AAEA;AACE;AAAa;AAAZ;AACiE;AACpD;AACR;AACe;AAElB;AAAA;AAQG;AAAA;AAAA;AAGV;AAKE;AAEA;AACE;AAAa;AAAZ;AACY;AACT;AACA;AACA;AAAA;AAEE;AACe;AAEN;AAAA;AAGnB;AAKE;AAEA;AACE;AAAa;AAAZ;AACyC;AACpC;AACe;AAAA;AAGzB;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,12 +3,68 @@ import { default as React } from 'react';
|
|
|
3
3
|
import { Calendar } from './calendar';
|
|
4
4
|
import { Input, InputProps } from './input';
|
|
5
5
|
export declare const useDatePicker: () => import('@ark-ui/react').UseDatePickerContext;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* What the picker holds. `"day"` is a date; `"minute"` and `"second"` are a date **and** a time —
|
|
8
|
+
* one value, one input, one popover.
|
|
9
|
+
*/
|
|
10
|
+
export type DatePickerGranularity = "day" | "minute" | "second";
|
|
11
|
+
export interface DatePickerProps extends React.ComponentProps<typeof Calendar> {
|
|
12
|
+
/**
|
|
13
|
+
* What the picker holds. With `"minute"` or `"second"` the value is a date **and** a time: the
|
|
14
|
+
* input is segmented — day, month, year, hour, minute in the locale's order and clock — so both can
|
|
15
|
+
* be typed from empty, picking a day keeps the time, a
|
|
16
|
+
* `DatePickerTimer` in the popover sets the time, and the popover stays open after a day is
|
|
17
|
+
* picked so the time can be set. The value is then a `CalendarDateTime` — build one with
|
|
18
|
+
* `parseDateTime` — and a day picked while there is none arrives at midnight.
|
|
19
|
+
*
|
|
20
|
+
* @default "day"
|
|
21
|
+
*/
|
|
22
|
+
granularity?: DatePickerGranularity;
|
|
23
|
+
}
|
|
24
|
+
export declare const DatePicker: (props: DatePickerProps) => React.JSX.Element;
|
|
7
25
|
export declare const DatePickerTrigger: (props: React.ComponentProps<typeof ArkDatePicker.Trigger>) => React.JSX.Element;
|
|
8
26
|
interface DatePickerInputProps extends Omit<React.ComponentProps<typeof ArkDatePicker.Input>, "size">, InputProps {
|
|
9
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The picker's field, and the calendar button beside it.
|
|
30
|
+
*
|
|
31
|
+
* In a date picker it is a text input that reads what is typed in the locale's date format. In one
|
|
32
|
+
* with a `granularity` it is **segmented** — day, month, year, hour, minute and, in a 12-hour
|
|
33
|
+
* locale, AM/PM, each its own editable part in the locale's order — because a date and a time cannot
|
|
34
|
+
* be typed as one string: Ark's date input admits only digits and the date separator, so a `:` or
|
|
35
|
+
* `PM` never gets in. The segments are Ark's `DateInput`, bound to the picker's value both ways.
|
|
36
|
+
*/
|
|
10
37
|
export declare const DatePickerInput: (props: DatePickerInputProps) => React.JSX.Element;
|
|
11
|
-
export
|
|
38
|
+
export interface DatePickerTimerProps extends Omit<React.ComponentProps<typeof Input>, "size" | "step" | "type"> {
|
|
39
|
+
/**
|
|
40
|
+
* The control height, one of the shared sizes.
|
|
41
|
+
*
|
|
42
|
+
* @default "md"
|
|
43
|
+
*/
|
|
44
|
+
size?: "sm" | "md" | "lg";
|
|
45
|
+
/**
|
|
46
|
+
* The step of the time input **in seconds**, as on `<input type="time">`: `60` shows hours and
|
|
47
|
+
* minutes, `1` adds seconds. Inside a `DatePicker` it follows the picker's `granularity`.
|
|
48
|
+
*
|
|
49
|
+
* @default 60
|
|
50
|
+
*/
|
|
51
|
+
step?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A time field: an `InputGroup` around `<input type="time">` with a clock addon.
|
|
55
|
+
*
|
|
56
|
+
* **Inside a `DatePicker`'s `DatePickerContent` it is the picker's time**, and the picker is one
|
|
57
|
+
* date-and-time field: the timer shows the hour and minute of the picker's value and setting it
|
|
58
|
+
* sets the picker's value, so the input above and the calendar beside it follow. Choosing a time
|
|
59
|
+
* before any date takes the day the calendar is showing. **Anywhere else it is a plain time input**
|
|
60
|
+
* you control with `value` and `onChange`.
|
|
61
|
+
*
|
|
62
|
+
* Props go where they read naturally: `size` and the field state (`disabled`, `invalid`, `readOnly`,
|
|
63
|
+
* `required`, taken from an ancestor `Field` unless given) apply to the field, `className` and every
|
|
64
|
+
* other prop go to the `<input>` itself — so `aria-label`, `name` and `onChange` do what they say.
|
|
65
|
+
* The group around it is `w-full`; size it with the element you put it in.
|
|
66
|
+
*/
|
|
67
|
+
export declare const DatePickerTimer: (props: DatePickerTimerProps) => React.JSX.Element;
|
|
12
68
|
export declare const DatePickerContent: (props: React.ComponentProps<typeof ArkDatePicker.Content>) => React.JSX.Element;
|
|
13
69
|
export declare const DatePickerValue: (props: React.ComponentProps<typeof ArkDatePicker.ValueText>) => React.JSX.Element;
|
|
14
70
|
export declare const DatePickerPresetTrigger: ({ slot, ...rest }: React.ComponentProps<typeof ArkDatePicker.PresetTrigger>) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/simples/date-picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/simples/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,IAAI,aAAa,EAE5B,MAAM,2BAA2B,CAAC;AAcnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,QAAQ,EAET,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAQjD,eAAO,MAAM,aAAa,oDAAuB,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA6DhE,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC;IAC5E;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC;AAMD,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,sBAyDhD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,OAAO,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,OAAO,CAAC,sBAqB1D,CAAC;AAEF,UAAU,oBACR,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,EACpE,UAAU;CAAG;AAEjB;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,sBAG1D,CAAC;AAkGF,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GA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