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