@jfrader/ui 0.1.2 → 0.2.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.
Files changed (144) hide show
  1. package/README.md +1 -1
  2. package/dist/accordion-CkOZ-tvs.js +178 -0
  3. package/dist/accordion.js +1 -1
  4. package/dist/alert-Dsjx14UW.js +131 -0
  5. package/dist/alert.js +1 -1
  6. package/dist/avatar-BRGKkoSr.js +127 -0
  7. package/dist/avatar.js +1 -1
  8. package/dist/badge-DLxUMsCx.js +104 -0
  9. package/dist/badge.js +1 -1
  10. package/dist/breadcrumbs-694hF_hm.js +131 -0
  11. package/dist/breadcrumbs.js +1 -1
  12. package/dist/button-CoaIcykB.js +190 -0
  13. package/dist/button.js +1 -1
  14. package/dist/calendar-Doj7PTdG.js +379 -0
  15. package/dist/calendar.js +1 -1
  16. package/dist/card-2IM71XZj.js +134 -0
  17. package/dist/card.js +1 -1
  18. package/dist/checkbox-B7xGNFzp.js +136 -0
  19. package/dist/checkbox.js +1 -1
  20. package/dist/combobox-Bjhxv5U3.js +311 -0
  21. package/dist/combobox.js +1 -1
  22. package/dist/{command-palette-6c158eH1.js → command-palette-BhJwm6cS.js} +144 -129
  23. package/dist/command-palette.js +1 -1
  24. package/dist/container-BhnrGPu-.js +36 -0
  25. package/dist/container.js +1 -1
  26. package/dist/date-picker-Jk8SpoiO.js +245 -0
  27. package/dist/date-picker.js +1 -1
  28. package/dist/dialog-fhS07G41.js +187 -0
  29. package/dist/dialog.js +1 -1
  30. package/dist/divider-v_78HYF5.js +79 -0
  31. package/dist/divider.js +1 -1
  32. package/dist/flex-COZzFqI8.js +22 -0
  33. package/dist/flex.js +1 -1
  34. package/dist/index.js +36 -36
  35. package/dist/kbd-CeP8Kfvp.js +61 -0
  36. package/dist/kbd.js +1 -1
  37. package/dist/menu-B6KCbLCr.js +196 -0
  38. package/dist/menu.js +1 -1
  39. package/dist/navigation-BDht6S2-.js +182 -0
  40. package/dist/navigation.js +1 -1
  41. package/dist/{pagination-BIKYsxK1.js → pagination-B50PCaDU.js} +58 -56
  42. package/dist/pagination.js +1 -1
  43. package/dist/pill-2_XzBdkD.js +51 -0
  44. package/dist/pill.js +1 -1
  45. package/dist/popover-DRHbeIVq.js +103 -0
  46. package/dist/popover.js +1 -1
  47. package/dist/{progress-C8bgujFI.js → progress-CpsskKTD.js} +37 -36
  48. package/dist/progress.js +1 -1
  49. package/dist/radio-group-DPI5KUCj.js +136 -0
  50. package/dist/radio-group.js +1 -1
  51. package/dist/select-C1xGrOhT.js +266 -0
  52. package/dist/select.js +1 -1
  53. package/dist/skeleton-DitdP-yz.js +49 -0
  54. package/dist/skeleton.js +1 -1
  55. package/dist/{spinner-CSFiP0Oi.js → spinner-CFq5HPoo.js} +24 -23
  56. package/dist/spinner.js +1 -1
  57. package/dist/stack-D_g6NJzo.js +21 -0
  58. package/dist/stack.js +1 -1
  59. package/dist/switch-B5TTU-oJ.js +138 -0
  60. package/dist/switch.js +1 -1
  61. package/dist/tabs-C26PWl2c.js +183 -0
  62. package/dist/tabs.js +1 -1
  63. package/dist/text-field-8PQAqRpM.js +75 -0
  64. package/dist/text-field.js +1 -1
  65. package/dist/textarea-CcGWuntL.js +85 -0
  66. package/dist/textarea.js +1 -1
  67. package/dist/theme-root-BRLIA4eb.js +22 -0
  68. package/dist/theme-root.js +1 -1
  69. package/dist/toast-B1PXuwZ4.js +277 -0
  70. package/dist/toast.js +1 -1
  71. package/dist/toggle-group-N_owicT0.js +156 -0
  72. package/dist/toggle-group.js +1 -1
  73. package/dist/tooltip-BJPisf60.js +98 -0
  74. package/dist/tooltip.js +1 -1
  75. package/dist/types/components/accordion/accordion.d.ts +13 -9
  76. package/dist/types/components/alert/alert.d.ts +6 -3
  77. package/dist/types/components/avatar/avatar.d.ts +6 -3
  78. package/dist/types/components/badge/badge.d.ts +6 -3
  79. package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +8 -5
  80. package/dist/types/components/button/button.d.ts +6 -3
  81. package/dist/types/components/calendar/calendar.d.ts +11 -7
  82. package/dist/types/components/card/card.d.ts +20 -13
  83. package/dist/types/components/checkbox/checkbox.d.ts +6 -3
  84. package/dist/types/components/combobox/combobox.d.ts +12 -8
  85. package/dist/types/components/command-palette/command-palette.d.ts +22 -15
  86. package/dist/types/components/container/container.d.ts +6 -3
  87. package/dist/types/components/date-picker/date-picker.d.ts +6 -4
  88. package/dist/types/components/dialog/dialog.d.ts +16 -11
  89. package/dist/types/components/divider/divider.d.ts +6 -3
  90. package/dist/types/components/flex/flex.d.ts +6 -3
  91. package/dist/types/components/kbd/kbd.d.ts +8 -5
  92. package/dist/types/components/menu/menu.d.ts +13 -9
  93. package/dist/types/components/navigation/navigation.d.ts +11 -7
  94. package/dist/types/components/pagination/pagination.d.ts +6 -3
  95. package/dist/types/components/pill/pill.d.ts +6 -3
  96. package/dist/types/components/popover/popover.d.ts +7 -5
  97. package/dist/types/components/progress/progress.d.ts +6 -3
  98. package/dist/types/components/radio-group/radio-group.d.ts +8 -5
  99. package/dist/types/components/select/select.d.ts +13 -9
  100. package/dist/types/components/skeleton/skeleton.d.ts +6 -3
  101. package/dist/types/components/spinner/spinner.d.ts +6 -3
  102. package/dist/types/components/stack/stack.d.ts +4 -1
  103. package/dist/types/components/switch/switch.d.ts +6 -3
  104. package/dist/types/components/tabs/tabs.d.ts +14 -9
  105. package/dist/types/components/text-field/text-field.d.ts +6 -3
  106. package/dist/types/components/textarea/textarea.d.ts +6 -3
  107. package/dist/types/components/theme-root/theme-root.d.ts +6 -3
  108. package/dist/types/components/toast/toast.d.ts +6 -4
  109. package/dist/types/components/toggle-group/toggle-group.d.ts +7 -5
  110. package/dist/types/components/tooltip/tooltip.d.ts +7 -5
  111. package/dist/types/overlay/use-native-dialog.d.ts +2 -2
  112. package/package.json +4 -4
  113. package/dist/accordion-C3YbYFBi.js +0 -169
  114. package/dist/alert-CA9ZlIZp.js +0 -130
  115. package/dist/avatar-IUW4yJl0.js +0 -125
  116. package/dist/badge-Bru30HEn.js +0 -103
  117. package/dist/breadcrumbs-CQaviWRc.js +0 -126
  118. package/dist/button-Cmixur4Q.js +0 -188
  119. package/dist/calendar-DUgS0xmp.js +0 -373
  120. package/dist/card-D9CHtouU.js +0 -121
  121. package/dist/checkbox-DKa5BCdy.js +0 -135
  122. package/dist/combobox-Dq3V88Zt.js +0 -302
  123. package/dist/container-xUEIoZzj.js +0 -35
  124. package/dist/date-picker-DrHJMt2p.js +0 -240
  125. package/dist/dialog-C2NSOOP-.js +0 -176
  126. package/dist/divider-yF5EmhhT.js +0 -77
  127. package/dist/flex-5-NI5SSy.js +0 -22
  128. package/dist/kbd-B03_qIwQ.js +0 -56
  129. package/dist/menu-bvKRJOhJ.js +0 -187
  130. package/dist/navigation-xPoqh_Iz.js +0 -175
  131. package/dist/pill-CrVqffKM.js +0 -50
  132. package/dist/popover-CVAZ_C1a.js +0 -98
  133. package/dist/radio-group-CvQ4x8ii.js +0 -131
  134. package/dist/select-CNNiUhKB.js +0 -257
  135. package/dist/skeleton-gJ4ImO5u.js +0 -48
  136. package/dist/stack-mEAryjKz.js +0 -21
  137. package/dist/switch-2hm2WnWt.js +0 -136
  138. package/dist/tabs-GBppQabg.js +0 -174
  139. package/dist/text-field-DDPqQu29.js +0 -74
  140. package/dist/textarea-OP8_3IUR.js +0 -84
  141. package/dist/theme-root-eLka0ZP1.js +0 -21
  142. package/dist/toast-D3Y6OAsg.js +0 -271
  143. package/dist/toggle-group-BxzJ-6Cp.js +0 -151
  144. package/dist/tooltip-CVl8HS4S.js +0 -93
@@ -0,0 +1,134 @@
1
+ 'use client';
2
+ import { t as e } from "./css-Cgj6sCHn.js";
3
+ import { createContext as t, useContext as n } from "react";
4
+ import { vars as r } from "@jfrader/tokens/vars";
5
+ import { jsx as i } from "@emotion/react/jsx-runtime";
6
+ //#region src/components/card/card.tsx
7
+ var a = t(void 0);
8
+ function o(...e) {
9
+ return e.filter(Boolean).join(" ") || void 0;
10
+ }
11
+ var s = e({
12
+ boxSizing: "border-box",
13
+ minInlineSize: 0,
14
+ backgroundColor: r.color.surfaceRaised,
15
+ border: `1px solid ${r.color.border}`,
16
+ borderRadius: r.radius.lg,
17
+ paddingBlock: r.space[4],
18
+ paddingInline: r.space[5],
19
+ fontFamily: r.font.sans,
20
+ lineHeight: r.lineHeight.base,
21
+ color: r.color.text
22
+ }), c = {
23
+ flat: e({ boxShadow: "none" }),
24
+ raised: e({ boxShadow: r.shadow.raised })
25
+ }, l = e({
26
+ display: "grid",
27
+ gap: r.space[1],
28
+ marginBlockEnd: r.space[4]
29
+ }), u = e({
30
+ margin: 0,
31
+ fontSize: r.textSize.md,
32
+ fontWeight: r.fontWeight.semibold,
33
+ lineHeight: r.lineHeight.tight,
34
+ color: r.color.text
35
+ }), d = e({
36
+ margin: 0,
37
+ fontSize: r.textSize.sm,
38
+ color: r.color.textMuted
39
+ }), f = e({
40
+ fontSize: r.textSize.sm,
41
+ color: r.color.text
42
+ }), p = e({
43
+ display: "flex",
44
+ flexWrap: "wrap",
45
+ alignItems: "center",
46
+ justifyContent: "space-between",
47
+ gap: r.space[2],
48
+ marginBlockStart: r.space[4],
49
+ paddingBlockStart: r.space[4],
50
+ borderBlockStart: `1px solid ${r.color.borderSubtle}`,
51
+ "& > :only-child": { marginInlineStart: "auto" }
52
+ });
53
+ function m({ ref: e, variant: t = "raised", slotProps: n, className: r, ...l }) {
54
+ return /* @__PURE__ */ i(a.Provider, {
55
+ value: n,
56
+ children: /* @__PURE__ */ i("div", {
57
+ ...l,
58
+ ref: e,
59
+ "data-ui": "card",
60
+ "data-variant": t,
61
+ className: o(n?.root?.className, r),
62
+ css: [
63
+ s,
64
+ c[t],
65
+ n?.root?.css
66
+ ]
67
+ })
68
+ });
69
+ }
70
+ m.displayName = "Card";
71
+ function h({ ref: e, className: t, ...r }) {
72
+ let s = n(a)?.header;
73
+ return /* @__PURE__ */ i("div", {
74
+ ...r,
75
+ ref: e,
76
+ "data-ui": "card-header",
77
+ className: o(s?.className, t),
78
+ css: [l, s?.css]
79
+ });
80
+ }
81
+ h.displayName = "Card.Header";
82
+ function g({ ref: e, level: t = 3, className: r, ...s }) {
83
+ let c = n(a)?.title, l = `h${t}`;
84
+ return /* @__PURE__ */ i(l, {
85
+ ...s,
86
+ ref: e,
87
+ "data-ui": "card-title",
88
+ className: o(c?.className, r),
89
+ css: [u, c?.css]
90
+ });
91
+ }
92
+ g.displayName = "Card.Title";
93
+ function _({ ref: e, className: t, ...r }) {
94
+ let s = n(a)?.description;
95
+ return /* @__PURE__ */ i("p", {
96
+ ...r,
97
+ ref: e,
98
+ "data-ui": "card-description",
99
+ className: o(s?.className, t),
100
+ css: [d, s?.css]
101
+ });
102
+ }
103
+ _.displayName = "Card.Description";
104
+ function v({ ref: e, className: t, ...r }) {
105
+ let s = n(a)?.content;
106
+ return /* @__PURE__ */ i("div", {
107
+ ...r,
108
+ ref: e,
109
+ "data-ui": "card-content",
110
+ className: o(s?.className, t),
111
+ css: [f, s?.css]
112
+ });
113
+ }
114
+ v.displayName = "Card.Content";
115
+ function y({ ref: e, className: t, ...r }) {
116
+ let s = n(a)?.footer;
117
+ return /* @__PURE__ */ i("div", {
118
+ ...r,
119
+ ref: e,
120
+ "data-ui": "card-footer",
121
+ className: o(s?.className, t),
122
+ css: [p, s?.css]
123
+ });
124
+ }
125
+ y.displayName = "Card.Footer";
126
+ var b = Object.assign(m, {
127
+ Header: h,
128
+ Title: g,
129
+ Description: _,
130
+ Content: v,
131
+ Footer: y
132
+ });
133
+ //#endregion
134
+ export { b as t };
package/dist/card.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Card } from "./card-D9CHtouU.js";
2
+ export { t as Card } from "./card-2IM71XZj.js";
@@ -0,0 +1,136 @@
1
+ 'use client';
2
+ import { t as e } from "./css-Cgj6sCHn.js";
3
+ import { n as t } from "./media-D_eA_I-e.js";
4
+ import { t as n } from "./renderable-DzcIj1Lo.js";
5
+ import { i as r, n as i, r as a, t as o } from "./choice-control-ByFogYcT.js";
6
+ import { useEffect as s, useId as c, useImperativeHandle as l, useRef as u } from "react";
7
+ import { vars as d } from "@jfrader/tokens/vars";
8
+ import { jsx as f, jsxs as p } from "@emotion/react/jsx-runtime";
9
+ //#region src/components/checkbox/checkbox.tsx
10
+ var m = {
11
+ sm: "16px",
12
+ md: "20px"
13
+ }, h = e({
14
+ "input:checked + span svg": { opacity: 1 },
15
+ "&[data-indeterminate] input + span": {
16
+ backgroundColor: d.color.accent,
17
+ borderColor: d.color.accent
18
+ },
19
+ "&[data-indeterminate] input + span svg": { opacity: 1 }
20
+ }), g = e({
21
+ display: "inline-flex",
22
+ alignItems: "center",
23
+ justifyContent: "center",
24
+ flexShrink: 0,
25
+ boxSizing: "border-box",
26
+ border: `1px solid ${d.color.borderControl}`,
27
+ borderRadius: d.radius.sm,
28
+ backgroundColor: d.color.surfaceRaised,
29
+ color: d.color.accentContrast,
30
+ transitionProperty: "background-color, border-color",
31
+ transitionDuration: d.motion.duration.fast,
32
+ transitionTimingFunction: d.motion.easeStandard,
33
+ "& svg": {
34
+ inlineSize: "75%",
35
+ blockSize: "75%",
36
+ opacity: 0
37
+ },
38
+ [t]: { transitionDuration: "0s" }
39
+ }), _ = {
40
+ sm: e({
41
+ inlineSize: m.sm,
42
+ blockSize: m.sm
43
+ }),
44
+ md: e({
45
+ inlineSize: m.md,
46
+ blockSize: m.md
47
+ })
48
+ }, v = {
49
+ sm: e({ fontSize: d.textSize.sm }),
50
+ md: e({ fontSize: d.textSize.md })
51
+ }, y = e({
52
+ fontSize: d.textSize.sm,
53
+ color: d.color.textMuted
54
+ }), b = {
55
+ sm: e({ marginInlineStart: `calc(${m.sm} + ${d.space[2]})` }),
56
+ md: e({ marginInlineStart: `calc(${m.md} + ${d.space[2]})` })
57
+ };
58
+ function x({ indeterminate: e }) {
59
+ return /* @__PURE__ */ f("svg", {
60
+ viewBox: "0 0 16 16",
61
+ fill: "none",
62
+ stroke: "currentColor",
63
+ strokeWidth: "2",
64
+ strokeLinecap: "round",
65
+ strokeLinejoin: "round",
66
+ children: e ? /* @__PURE__ */ f("line", {
67
+ x1: "4",
68
+ y1: "8",
69
+ x2: "12",
70
+ y2: "8"
71
+ }) : /* @__PURE__ */ f("polyline", { points: "3.5 8.5 6.5 11.5 12.5 4.5" })
72
+ });
73
+ }
74
+ function S({ ref: e, label: t, description: d, indeterminate: m = !1, size: S = "md", onChange: C, onCheckedChange: w, slotProps: T, className: E, "aria-labelledby": D, "aria-describedby": O, ...k }) {
75
+ let A = u(null);
76
+ l(e, () => A.current, []), s(() => {
77
+ A.current && (A.current.indeterminate = m);
78
+ }, [m]);
79
+ let j = c(), M = `${j}-label`, N = `${j}-description`, P = n(t), F = n(d), I = [D, P && M].filter(Boolean).join(" ") || void 0, L = [O, F && N].filter(Boolean).join(" ") || void 0, R = [E, T?.root?.className].filter(Boolean).join(" ") || void 0, z = (e) => {
80
+ m && (e.currentTarget.indeterminate = !0), C?.(e), w?.(e.currentTarget.checked);
81
+ };
82
+ return /* @__PURE__ */ p("label", {
83
+ "data-ui": "checkbox",
84
+ "data-indeterminate": m || void 0,
85
+ className: R,
86
+ css: [
87
+ a,
88
+ h,
89
+ i,
90
+ T?.root?.css
91
+ ],
92
+ children: [/* @__PURE__ */ p("span", {
93
+ css: r,
94
+ children: [
95
+ /* @__PURE__ */ f("input", {
96
+ ...k,
97
+ ref: A,
98
+ type: "checkbox",
99
+ "aria-labelledby": I,
100
+ "aria-describedby": L,
101
+ "aria-checked": m ? "mixed" : void 0,
102
+ onChange: z,
103
+ css: o
104
+ }),
105
+ /* @__PURE__ */ f("span", {
106
+ "aria-hidden": "true",
107
+ className: T?.control?.className,
108
+ css: [
109
+ g,
110
+ _[S],
111
+ T?.control?.css
112
+ ],
113
+ children: /* @__PURE__ */ f(x, { indeterminate: m })
114
+ }),
115
+ P && /* @__PURE__ */ f("span", {
116
+ id: M,
117
+ className: T?.label?.className,
118
+ css: [v[S], T?.label?.css],
119
+ children: t
120
+ })
121
+ ]
122
+ }), F && /* @__PURE__ */ f("span", {
123
+ id: N,
124
+ className: T?.description?.className,
125
+ css: [
126
+ y,
127
+ b[S],
128
+ T?.description?.css
129
+ ],
130
+ children: d
131
+ })]
132
+ });
133
+ }
134
+ S.displayName = "Checkbox";
135
+ //#endregion
136
+ export { S as t };
package/dist/checkbox.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Checkbox } from "./checkbox-DKa5BCdy.js";
2
+ export { t as Checkbox } from "./checkbox-B7xGNFzp.js";
@@ -0,0 +1,311 @@
1
+ 'use client';
2
+ import { t as e } from "./css-Cgj6sCHn.js";
3
+ import { n as t, t as n } from "./use-controlled-state-CVXDa-qM.js";
4
+ import { t as r } from "./renderable-DzcIj1Lo.js";
5
+ import { a as i, c as a, d as o, f as s, l as c, o as l, r as u, s as d, t as f, u as p } from "./collection-registry-1l9f3XJZ.js";
6
+ import { t as m } from "./use-overlay-floating-efeqppiw.js";
7
+ import { t as h } from "./text-field-8PQAqRpM.js";
8
+ import { createContext as g, useCallback as _, useContext as v, useId as y, useLayoutEffect as b, useMemo as x, useRef as S, useState as C } from "react";
9
+ import { vars as w } from "@jfrader/tokens/vars";
10
+ import { jsx as T, jsxs as E } from "@emotion/react/jsx-runtime";
11
+ import { FloatingList as D, FloatingPortal as O, useDismiss as k, useInteractions as ee, useListNavigation as A, useMergeRefs as j } from "@floating-ui/react";
12
+ //#region src/components/combobox/combobox.tsx
13
+ var M = "bottom-start", N = "✓", P = "No results", te = (e, t) => e.toLocaleLowerCase().includes(t.toLocaleLowerCase()), F = g(null), I = g(!1);
14
+ function L(e) {
15
+ let t = v(F);
16
+ if (!t) throw Error(`Combobox.${e} must be rendered inside <Combobox>.`);
17
+ return t;
18
+ }
19
+ function R(e) {
20
+ let t = L(e);
21
+ if (!v(I)) throw Error(`Combobox.${e} must be rendered inside <Combobox.List>.`);
22
+ return t;
23
+ }
24
+ var z = e({ "&[hidden]": { display: "none" } }), B = e({
25
+ paddingBlock: w.space[1],
26
+ paddingInline: w.space[2],
27
+ fontSize: w.textSize.sm,
28
+ color: w.color.textMuted
29
+ });
30
+ function V({ value: e, defaultValue: r, onValueChange: a, open: o, defaultOpen: s = !1, onOpenChange: c, name: l, filter: u = te, onInputChange: d, children: f }) {
31
+ let p = y(), [h, g] = C(`${p}-listbox`), [v, b] = C(!1), [w = null, D] = n(e, r ?? null, a), [O = !1, j] = n(o, s, c), [N, P] = C(null), [I, L] = C(""), [R, z] = i(), [B, V] = C(null), H = S([]), U = S(null), W = t(d), G = _((e, t) => t === "" || u(e, t), [u]), { valuesByIndex: K, skippedIndices: q, matchCount: J } = x(() => {
32
+ let e = [], t = /* @__PURE__ */ new Set(), n = 0;
33
+ return R.forEach((r, i) => {
34
+ if (r.index === -1) return;
35
+ e[r.index] = i;
36
+ let a = G(r.label, I);
37
+ a && (n += 1), (r.disabled || !a) && t.add(r.index);
38
+ }), {
39
+ valuesByIndex: e,
40
+ skippedIndices: t,
41
+ matchCount: n
42
+ };
43
+ }, [
44
+ R,
45
+ I,
46
+ G
47
+ ]), { refs: Y, floatingStyles: X, context: Z } = m({
48
+ open: O,
49
+ placement: M,
50
+ onOpenChange: (e) => j(e)
51
+ }), ne = k(Z, {
52
+ escapeKey: !0,
53
+ outsidePress: !0
54
+ }), re = A(Z, {
55
+ listRef: H,
56
+ activeIndex: N,
57
+ onNavigate: P,
58
+ virtual: !0,
59
+ loop: !0,
60
+ disabledIndices: (e) => q.has(e)
61
+ }), { getReferenceProps: Q, getFloatingProps: $, getItemProps: ie } = ee([ne, re]), ae = x(() => {
62
+ let e = (e) => {
63
+ D(e), j(!1), U.current?.commitLabel(R.get(e)?.label ?? "");
64
+ };
65
+ return {
66
+ baseId: p,
67
+ listId: h,
68
+ setListId: g,
69
+ setInputDisabled: b,
70
+ open: O,
71
+ selectedValue: w,
72
+ activeIndex: N,
73
+ options: R,
74
+ matchCount: J,
75
+ inputLabelling: B,
76
+ inputHandleRef: U,
77
+ refs: Y,
78
+ floatingStyles: X,
79
+ elementsRef: H,
80
+ getReferenceProps: Q,
81
+ getFloatingProps: $,
82
+ getItemProps: ie,
83
+ onInputChange: W,
84
+ isVisible: (e) => G(e, I),
85
+ findMatches: (e) => {
86
+ let t = 0, n = null, r = null;
87
+ return R.forEach((i) => {
88
+ i.index !== -1 && G(i.label, e) && (t += 1, !i.disabled && ((n === null || i.index < n) && (n = i.index), (r === null || i.index > r) && (r = i.index)));
89
+ }), {
90
+ count: t,
91
+ first: n,
92
+ last: r
93
+ };
94
+ },
95
+ setQuery: L,
96
+ setActiveIndex: P,
97
+ selectValue: e,
98
+ selectIndex: (t) => {
99
+ let n = K[t];
100
+ n === void 0 || q.has(t) || e(n);
101
+ },
102
+ clearValue: () => D(null),
103
+ requestOpenChange: j,
104
+ registration: z,
105
+ setInputLabelling: V
106
+ };
107
+ }, [
108
+ p,
109
+ h,
110
+ O,
111
+ w,
112
+ N,
113
+ R,
114
+ I,
115
+ J,
116
+ B,
117
+ Y,
118
+ X,
119
+ Q,
120
+ $,
121
+ ie,
122
+ W,
123
+ G,
124
+ K,
125
+ q,
126
+ D,
127
+ j,
128
+ z
129
+ ]);
130
+ return /* @__PURE__ */ E(F.Provider, {
131
+ value: ae,
132
+ children: [f, l !== void 0 && /* @__PURE__ */ T("input", {
133
+ type: "hidden",
134
+ name: l,
135
+ value: w ?? "",
136
+ disabled: v
137
+ })]
138
+ });
139
+ }
140
+ V.displayName = "Combobox";
141
+ function H({ ref: e, inputValue: t, defaultInputValue: i, label: a, description: o, error: s, size: c, slotProps: l, className: u, id: d, onChange: f, onKeyDown: p, onBlur: m, disabled: g = !1, ..._ }) {
142
+ let { listId: v, open: x, selectedValue: S, activeIndex: w, options: E, inputHandleRef: D, refs: O, getReferenceProps: k, onInputChange: ee, findMatches: A, setQuery: M, setActiveIndex: N, selectIndex: P, clearValue: te, requestOpenChange: F, setInputLabelling: I, setInputDisabled: R } = L("Input"), z = j([O.setReference, e]), B = y(), V = d ?? B, H = `${V}-label`, U = r(a), W = _["aria-labelledby"], G = _["aria-label"], [K, q] = C(i), [J, Y] = C(() => (t ?? i) !== void 0), X = S === null ? void 0 : E.get(S)?.label, Z = t ?? (J ? K ?? "" : X ?? K ?? ""), [, ne] = n(Z, void 0, ee), re = (e) => {
143
+ ne(e), t === void 0 && q(e);
144
+ }, Q = t !== void 0 || J ? Z : "", $ = (e) => {
145
+ Y(!1), re(e);
146
+ };
147
+ b(() => {
148
+ M(Q);
149
+ }, [Q, M]), b(() => (R(g), () => R(!1)), [g, R]), b(() => (D.current = { commitLabel: $ }, () => {
150
+ D.current = null;
151
+ })), b(() => (I(W !== void 0 || !U ? {
152
+ labelledBy: W,
153
+ label: G
154
+ } : { labelledBy: H }), () => I(null)), [
155
+ W,
156
+ G,
157
+ U,
158
+ H,
159
+ I
160
+ ]);
161
+ let ie = (e) => {
162
+ f?.(e);
163
+ let n = e.currentTarget.value;
164
+ Y(!0), re(n), n === "" && te();
165
+ let r = t ?? n;
166
+ if (r === "") {
167
+ N(null), F(!1);
168
+ return;
169
+ }
170
+ let i = A(r);
171
+ N(i.first), i.count > 0 && F(!0);
172
+ }, ae = (e) => {
173
+ if (p?.(e), !e.defaultPrevented) {
174
+ if (e.key === "Escape") J && X !== void 0 && $(X);
175
+ else if (x) {
176
+ if (e.key === "Enter" && w !== null) e.preventDefault(), P(w);
177
+ else if (e.key === "Home" || e.key === "End") {
178
+ let t = A(Q), n = e.key === "Home" ? t.first : t.last;
179
+ if (n === null) return;
180
+ e.preventDefault(), N(n);
181
+ }
182
+ }
183
+ }
184
+ }, oe = (e) => {
185
+ m?.(e), x && F(!1);
186
+ };
187
+ return /* @__PURE__ */ T(h, {
188
+ ...k({
189
+ ..._,
190
+ onKeyDown: ae,
191
+ onBlur: oe
192
+ }),
193
+ ref: z,
194
+ id: V,
195
+ label: U ? /* @__PURE__ */ T("span", {
196
+ id: H,
197
+ children: a
198
+ }) : a,
199
+ description: o,
200
+ error: s,
201
+ size: c,
202
+ slotProps: l,
203
+ className: u,
204
+ value: Z,
205
+ disabled: g,
206
+ onChange: ie,
207
+ role: "combobox",
208
+ autoComplete: "off",
209
+ "aria-autocomplete": "list",
210
+ "aria-expanded": x,
211
+ "aria-controls": x ? v : void 0,
212
+ "data-state": x ? "open" : "closed",
213
+ "data-ui": "combobox-input"
214
+ });
215
+ }
216
+ H.displayName = "Combobox.Input";
217
+ function U({ ref: e, id: t, style: n, onMouseDown: r, children: i, ...a }) {
218
+ let { baseId: c, setListId: l, open: u, inputLabelling: d, refs: f, floatingStyles: p, elementsRef: m, getFloatingProps: h } = L("List"), g = t ?? `${c}-listbox`;
219
+ b(() => (l(g), () => l(`${c}-listbox`)), [
220
+ c,
221
+ g,
222
+ l
223
+ ]);
224
+ let _ = j([u ? f.setFloating : null, e]), v = a["aria-labelledby"] !== void 0 || a["aria-label"] !== void 0 ? {} : d?.labelledBy === void 0 ? { "aria-label": d?.label } : { "aria-labelledby": d.labelledBy }, y = (e) => {
225
+ r?.(e), e.preventDefault();
226
+ };
227
+ return /* @__PURE__ */ T(O, { children: /* @__PURE__ */ T("div", {
228
+ ...h({
229
+ id: g,
230
+ ...v,
231
+ ...a,
232
+ onMouseDown: y
233
+ }),
234
+ ref: _,
235
+ role: "listbox",
236
+ hidden: !u,
237
+ "data-state": u ? "open" : "closed",
238
+ "data-ui": "combobox-list",
239
+ style: {
240
+ ...n,
241
+ ...p
242
+ },
243
+ css: [s, o],
244
+ children: /* @__PURE__ */ T(D, {
245
+ elementsRef: m,
246
+ children: /* @__PURE__ */ T(I.Provider, {
247
+ value: !0,
248
+ children: i
249
+ })
250
+ })
251
+ }) });
252
+ }
253
+ U.displayName = "Combobox.List";
254
+ function W({ ref: e, value: t, disabled: n = !1, onClick: r, children: i, ...o }) {
255
+ let { baseId: s, selectedValue: m, activeIndex: h, options: g, isVisible: _, getItemProps: v, selectValue: y, registration: b } = R("Item"), x = S(null), { ref: C, index: w } = u(t, b, x, (e, t) => ({
256
+ index: e,
257
+ label: t,
258
+ disabled: n
259
+ })), D = j([C, e]), O = g.get(t)?.label, k = O !== void 0 && !_(O), ee = w !== -1 && h === w, A = m === t, M = (e) => {
260
+ r?.(e), !(n || e.defaultPrevented) && y(t);
261
+ };
262
+ return /* @__PURE__ */ E("div", {
263
+ ...v({
264
+ id: f(s, t),
265
+ ...o,
266
+ onClick: M
267
+ }),
268
+ ref: D,
269
+ role: "option",
270
+ hidden: k,
271
+ "aria-selected": A,
272
+ "aria-disabled": n || void 0,
273
+ "data-active": ee || void 0,
274
+ "data-ui": "combobox-item",
275
+ css: [
276
+ d,
277
+ l,
278
+ c,
279
+ z
280
+ ],
281
+ children: [/* @__PURE__ */ T("span", {
282
+ ref: x,
283
+ css: p,
284
+ children: i
285
+ }), A && /* @__PURE__ */ T("span", {
286
+ "aria-hidden": "true",
287
+ css: a,
288
+ children: N
289
+ })]
290
+ });
291
+ }
292
+ W.displayName = "Combobox.Item";
293
+ function G({ ref: e, children: t, ...n }) {
294
+ let { matchCount: i } = R("Empty");
295
+ return i > 0 ? null : /* @__PURE__ */ T("div", {
296
+ ...n,
297
+ ref: e,
298
+ "data-ui": "combobox-empty",
299
+ css: B,
300
+ children: r(t) ? t : P
301
+ });
302
+ }
303
+ G.displayName = "Combobox.Empty";
304
+ var K = Object.assign(V, {
305
+ Input: H,
306
+ List: U,
307
+ Item: W,
308
+ Empty: G
309
+ });
310
+ //#endregion
311
+ export { K as t };
package/dist/combobox.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Combobox } from "./combobox-Dq3V88Zt.js";
2
+ export { t as Combobox } from "./combobox-Bjhxv5U3.js";