@box-kite/react 1.0.0 → 2.0.1

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 (179) hide show
  1. package/.claude/rules/box-kite-rules.md +23 -1
  2. package/.claude/skills/box-kite/SKILL.md +134 -427
  3. package/.claude/skills/box-kite/references/components.md +235 -0
  4. package/.claude/skills/box-kite/references/extending.md +42 -0
  5. package/.claude/skills/box-kite/references/patterns.md +27 -0
  6. package/.claude/skills/box-kite/references/styling.md +222 -0
  7. package/.cursor/rules/box-kite.mdc +73 -0
  8. package/AGENTS.md +102 -0
  9. package/BOX_AI_CONTEXT.md +1124 -153
  10. package/BOX_KITE_AI_CONTEXT.md +1124 -153
  11. package/README.md +36 -2
  12. package/a11y.cjs +1 -1
  13. package/a11y.d.ts +1 -1
  14. package/a11y.mjs +3 -2
  15. package/anchor.cjs +1 -0
  16. package/anchor.d.ts +14 -0
  17. package/anchor.mjs +3 -0
  18. package/behavior.cjs +1 -1
  19. package/behavior.mjs +118 -136
  20. package/box.cjs +1 -1
  21. package/box.mjs +1 -1
  22. package/client.cjs +1 -1
  23. package/client.mjs +15 -14
  24. package/components/accordion.cjs +1 -0
  25. package/components/accordion.d.ts +114 -0
  26. package/components/accordion.mjs +251 -0
  27. package/components/button.cjs +1 -1
  28. package/components/button.d.ts +3 -0
  29. package/components/button.mjs +1 -1
  30. package/components/chart.cjs +1 -1
  31. package/components/chart.d.ts +2 -1
  32. package/components/chart.mjs +159 -184
  33. package/components/checkbox.cjs +1 -1
  34. package/components/checkbox.d.ts +8 -0
  35. package/components/checkbox.mjs +1 -1
  36. package/components/combobox/comboboxChips.d.ts +21 -0
  37. package/components/combobox/comboboxListbox.d.ts +47 -0
  38. package/components/combobox.cjs +1 -0
  39. package/components/combobox.d.ts +121 -0
  40. package/components/combobox.mjs +563 -0
  41. package/components/dataGrid/components/dataGridAggregateValue.d.ts +10 -0
  42. package/components/dataGrid/components/dataGridCell.d.ts +2 -1
  43. package/components/dataGrid/components/dataGridCellEditor.d.ts +15 -0
  44. package/components/dataGrid/components/dataGridCellPlaceholder.d.ts +14 -0
  45. package/components/dataGrid/components/dataGridCellTree.d.ts +16 -0
  46. package/components/dataGrid/components/dataGridDataSourceError.d.ts +12 -0
  47. package/components/dataGrid/components/dataGridExport.d.ts +10 -0
  48. package/components/dataGrid/components/dataGridFooter.d.ts +11 -0
  49. package/components/dataGrid/contracts/dataGridContract.d.ts +474 -16
  50. package/components/dataGrid/export/gridExport.d.ts +10 -0
  51. package/components/dataGrid/gridNavigationContext.d.ts +9 -1
  52. package/components/dataGrid/models/aggregateCellModel.d.ts +34 -0
  53. package/components/dataGrid/models/aggregationModel.d.ts +32 -0
  54. package/components/dataGrid/models/cellKeys.d.ts +11 -0
  55. package/components/dataGrid/models/cellModel.d.ts +27 -1
  56. package/components/dataGrid/models/columnModel.d.ts +12 -2
  57. package/components/dataGrid/models/dataSourceModel.d.ts +177 -0
  58. package/components/dataGrid/models/editModel.d.ts +77 -0
  59. package/components/dataGrid/models/exportModel.d.ts +51 -0
  60. package/components/dataGrid/models/gridModel.d.ts +108 -21
  61. package/components/dataGrid/models/groupRowCellModel.d.ts +11 -3
  62. package/components/dataGrid/models/groupRowModel.d.ts +22 -2
  63. package/components/dataGrid/models/rowModel.d.ts +13 -1
  64. package/components/dataGrid/models/sourceGroupRowModel.d.ts +45 -0
  65. package/components/dataGrid/models/sourceLevel.d.ts +71 -0
  66. package/components/dataGrid/models/sourceRowModel.d.ts +29 -0
  67. package/components/dataGrid/models/sourceTreeRowModel.d.ts +23 -0
  68. package/components/dataGrid/models/treeModel.d.ts +94 -0
  69. package/components/dataGrid/models/treeRow.d.ts +22 -0
  70. package/components/dataGrid/models/treeRowModel.d.ts +50 -0
  71. package/components/dataGrid.cjs +1 -1
  72. package/components/dataGrid.d.ts +4 -2
  73. package/components/dataGrid.mjs +4484 -2755
  74. package/components/dialog.cjs +1 -0
  75. package/components/dialog.d.ts +151 -0
  76. package/components/dialog.mjs +223 -0
  77. package/components/dropdown.cjs +1 -1
  78. package/components/dropdown.d.ts +30 -0
  79. package/components/dropdown.mjs +256 -244
  80. package/components/icon.cjs +1 -1
  81. package/components/icon.d.ts +2 -1
  82. package/components/icon.mjs +3 -3
  83. package/components/menu.cjs +1 -0
  84. package/components/menu.d.ts +234 -0
  85. package/components/menu.mjs +422 -0
  86. package/components/overlay.cjs +1 -1
  87. package/components/overlay.d.ts +30 -26
  88. package/components/overlay.mjs +45 -75
  89. package/components/popover.cjs +1 -0
  90. package/components/popover.d.ts +100 -0
  91. package/components/popover.mjs +69 -0
  92. package/components/presence.d.ts +6 -0
  93. package/components/progress.cjs +1 -0
  94. package/components/progress.d.ts +47 -0
  95. package/components/progress.mjs +28 -0
  96. package/components/radioButton.cjs +1 -1
  97. package/components/radioButton.d.ts +8 -0
  98. package/components/radioButton.mjs +1 -1
  99. package/components/radioGroup.cjs +1 -1
  100. package/components/radioGroup.d.ts +15 -2
  101. package/components/radioGroup.mjs +34 -30
  102. package/components/select.d.ts +9 -0
  103. package/components/semantics.cjs +1 -1
  104. package/components/semantics.d.ts +33 -28
  105. package/components/semantics.mjs +3 -3
  106. package/components/slider.cjs +1 -0
  107. package/components/slider.d.ts +98 -0
  108. package/components/slider.mjs +250 -0
  109. package/components/svg.cjs +1 -1
  110. package/components/svg.d.ts +25 -23
  111. package/components/svg.mjs +3 -3
  112. package/components/switch.cjs +1 -1
  113. package/components/switch.d.ts +9 -0
  114. package/components/switch.mjs +1 -1
  115. package/components/tabs.cjs +1 -0
  116. package/components/tabs.d.ts +87 -0
  117. package/components/tabs.mjs +324 -0
  118. package/components/textarea.cjs +1 -1
  119. package/components/textarea.d.ts +14 -0
  120. package/components/textarea.mjs +1 -1
  121. package/components/textbox.cjs +1 -1
  122. package/components/textbox.d.ts +12 -0
  123. package/components/textbox.mjs +1 -1
  124. package/components/toaster.cjs +1 -0
  125. package/components/toaster.d.ts +106 -0
  126. package/components/toaster.mjs +295 -0
  127. package/components/tooltip.cjs +1 -1
  128. package/components/tooltip.d.ts +39 -4
  129. package/components/tooltip.mjs +56 -54
  130. package/docs/a11y.md +199 -0
  131. package/docs/anchor.md +139 -0
  132. package/docs/components.md +48 -0
  133. package/docs/index.md +11 -0
  134. package/docs/props.md +1777 -0
  135. package/effects.cjs +1 -1
  136. package/effects.mjs +1 -1
  137. package/gridExport.cjs +2 -0
  138. package/gridExport.mjs +244 -0
  139. package/identity.cjs +1 -0
  140. package/identity.mjs +12 -0
  141. package/keyboard.cjs +1 -0
  142. package/keyboard.mjs +30 -0
  143. package/layer.cjs +1 -0
  144. package/layer.mjs +127 -0
  145. package/motion.cjs +1 -1
  146. package/motion.mjs +1 -1
  147. package/package.json +134 -10
  148. package/placement.cjs +1 -0
  149. package/placement.mjs +180 -0
  150. package/platform.cjs +1 -1
  151. package/platform.mjs +18 -5
  152. package/react/anchor/useAnchorPosition.d.ts +79 -0
  153. package/react/dialog/useScrollLock.d.ts +12 -0
  154. package/react/hooks/usePortalContainer.d.ts +6 -1
  155. package/react/hooks/useVirtualization.d.ts +24 -35
  156. package/react/popover/usePopoverLayer.d.ts +87 -0
  157. package/react-shared.cjs +1 -1
  158. package/react-shared.mjs +19 -2
  159. package/rsc.cjs +1 -1
  160. package/rsc.mjs +1 -1
  161. package/utils/accordion/accordionUtils.d.ts +48 -0
  162. package/utils/anchor/anchorUtils.d.ts +79 -0
  163. package/utils/array/lazyList.d.ts +10 -0
  164. package/utils/chart/chartPalette.d.ts +15 -0
  165. package/utils/chart/chartUtils.d.ts +2 -8
  166. package/utils/combobox/comboboxUtils.d.ts +89 -0
  167. package/utils/dom/domUtils.d.ts +6 -0
  168. package/utils/environment/environmentUtils.d.ts +10 -0
  169. package/utils/export/csvUtils.d.ts +23 -0
  170. package/utils/export/downloadUtils.d.ts +12 -0
  171. package/utils/export/xlsxUtils.d.ts +56 -0
  172. package/utils/export/zipUtils.d.ts +26 -0
  173. package/utils/keyboard/typeaheadUtils.d.ts +31 -0
  174. package/utils/menu/menuUtils.d.ts +25 -0
  175. package/utils/slider/sliderUtils.d.ts +67 -0
  176. package/utils/tabs/tabsUtils.d.ts +75 -0
  177. package/utils/toast/toastStore.d.ts +73 -0
  178. package/utils/virtual/virtualUtils.d.ts +47 -0
  179. /package/react/{a11y → identity}/useIdentifier.d.ts +0 -0
@@ -1,126 +1,121 @@
1
1
  "use client";
2
2
  import { n as e } from "../effects.mjs";
3
3
  import t from "../box.mjs";
4
- import { i as n, n as r, o as i, r as a, t as o } from "../behavior.mjs";
5
- import s from "./baseSvg.mjs";
6
- import c from "./button.mjs";
4
+ import { a as n, i as r, n as i, r as a, t as o } from "../behavior.mjs";
5
+ import { t as s } from "../identity.mjs";
6
+ import c from "./baseSvg.mjs";
7
+ import ee from "./button.mjs";
7
8
  import l from "./flex.mjs";
8
9
  import u from "./checkbox.mjs";
9
- import d from "./textbox.mjs";
10
- import ee from "./overlay.mjs";
11
- import f from "./presence.mjs";
12
- import { createContext as p, forwardRef as m, memo as h, useCallback as g, useContext as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
13
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
10
+ import te from "./overlay.mjs";
11
+ import d from "./presence.mjs";
12
+ import f from "./textbox.mjs";
13
+ import { createContext as p, forwardRef as m, memo as h, useCallback as g, useContext as _, useEffect as ne, useMemo as v, useRef as y, useState as re } from "react";
14
+ import { Fragment as ie, jsx as b, jsxs as x } from "react/jsx-runtime";
14
15
  //#region src/components/dropdown/dropdownContext.ts
15
- var te = p(null);
16
- function ne() {
17
- let e = _(te);
16
+ var ae = p(null);
17
+ function S() {
18
+ let e = _(ae);
18
19
  if (!e) throw Error("Dropdown sub-components must be used within Dropdown");
19
20
  return e;
20
21
  }
21
22
  //#endregion
22
23
  //#region src/components/dropdown/dropdownRowRenderer.tsx
23
- var T = {
24
+ var C = {
24
25
  item: "dropdown.item",
25
26
  unselect: "dropdown.unselect",
26
27
  selectAll: "dropdown.selectAll"
27
28
  };
28
- function E({ row: e, index: n }) {
29
- let { valueToUse: r, multiple: i, variant: a, showCheckbox: o, selectRow: s, optionId: c, activeIndex: l, rowRef: d, isRowDisabled: ee } = ne(), f = e.kind === "item", p = ee(n), m = f ? r.includes(e.element.props.value) : e.kind === "unselect" && r.length === 0, { value: h, onClick: g, children: _, ...v } = e.element.props, y = o && i && f;
30
- return /* @__PURE__ */ C(t, {
31
- ref: d(n),
32
- component: T[e.kind],
33
- variant: [a, f ? {
29
+ function oe({ row: e, index: n }) {
30
+ let { valueToUse: r, multiple: i, variant: a, showCheckbox: o, selectRow: s, optionId: c, activeIndex: ee, rowRef: l, isRowDisabled: te } = S(), d = e.kind === "item", f = te(n), p = d ? r.includes(e.element.props.value) : e.kind === "unselect" && r.length === 0, { value: m, onClick: h, children: g, ..._ } = e.element.props, ne = o && i && d;
31
+ return /* @__PURE__ */ b(t, {
32
+ ref: l(n),
33
+ component: C[e.kind],
34
+ variant: [a, d ? {
34
35
  multiple: i,
35
- highlighted: n === l
36
- } : { highlighted: n === l }],
37
- selected: m,
38
- ...v,
36
+ highlighted: n === ee
37
+ } : { highlighted: n === ee }],
38
+ selected: p,
39
+ ..._,
39
40
  id: c(n),
40
- children: y ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(u, {
41
+ children: ne ? /* @__PURE__ */ x(ie, { children: [/* @__PURE__ */ b(u, {
41
42
  readOnly: !0,
42
- checked: m,
43
+ checked: p,
43
44
  me: 2,
44
45
  props: {
45
46
  tabIndex: -1,
46
47
  "aria-hidden": !0
47
48
  }
48
- }), _] }) : _,
49
+ }), g] }) : g,
49
50
  props: {
50
51
  role: "option",
51
- ...p ? { "aria-disabled": !0 } : {},
52
- ...v.props,
53
- onClick: p ? void 0 : (e) => {
54
- g?.(e), s(n, e);
52
+ ...f ? { "aria-disabled": !0 } : {},
53
+ ..._.props,
54
+ onClick: f ? void 0 : (e) => {
55
+ h?.(e), s(n, e);
55
56
  }
56
57
  }
57
58
  });
58
59
  }
59
- var re = h(E, (e, t) => e.row.element === t.row.element && e.index === t.index);
60
+ var w = h(oe, (e, t) => e.row.element === t.row.element && e.index === t.index);
60
61
  //#endregion
61
62
  //#region src/components/dropdown/dropdownItems.tsx
62
- function D(e, t, n) {
63
+ function T(e, t, n) {
63
64
  return e ? {
64
65
  role: "listbox",
65
66
  "aria-labelledby": n,
66
67
  ...t ? { "aria-multiselectable": !0 } : {}
67
68
  } : { role: "status" };
68
69
  }
69
- function ie(e) {
70
- let { presence: n, rows: r, emptyItem: i, triggerRef: a, popupRef: o, listboxId: s, labelledBy: c, itemsProps: l } = e, { present: u, ref: d, props: f } = n, { multiple: p, variant: m } = ne(), [h, _] = x(!1), v = h ? 0 : a.current?.getBoundingClientRect().height ?? 0, y = g((e) => {
71
- let t = e.top - e.windowScrollY > window.innerHeight / 2;
72
- _((e) => e === t ? e : t);
73
- }, []);
74
- return /* @__PURE__ */ C(t, {
75
- position: "absolute",
76
- inset: 0,
77
- children: /* @__PURE__ */ C(ee, {
78
- ref: o,
79
- minWidth: "fit-content",
80
- style: { transform: h ? "translateY(calc(-100% - 2px))" : `translateY(${v}px)` },
81
- onPositionChange: y,
82
- children: /* @__PURE__ */ w(t, {
83
- ref: d,
84
- component: "dropdown.items",
85
- ...l,
86
- variant: [m, {
87
- up: h,
88
- closed: !u && !h,
89
- closedUp: !u && h
90
- }],
91
- id: s,
92
- props: {
93
- ...D(r.length > 0, p, c),
94
- ...f
95
- },
96
- children: [r.map((e, t) => /* @__PURE__ */ C(re, {
97
- row: e,
98
- index: t
99
- }, ae(e, t))), r.length === 0 && i && /* @__PURE__ */ C(t, {
100
- component: "dropdown.emptyItem",
101
- variant: m,
102
- ...i.props
103
- })]
104
- })
70
+ function se(e) {
71
+ let { presence: n, rows: r, emptyItem: i, triggerRef: a, popupRef: o, listboxId: s, labelledBy: c, itemsProps: ee } = e, { present: l, ref: u, props: d } = n, { multiple: f, variant: p } = S(), [m, h] = re(!1), _ = g((e) => h(e === "top"), []);
72
+ return /* @__PURE__ */ b(te, {
73
+ ref: o,
74
+ anchor: a,
75
+ side: "bottom",
76
+ align: "start",
77
+ offset: .5,
78
+ onSideChange: _,
79
+ children: /* @__PURE__ */ x(t, {
80
+ ref: u,
81
+ component: "dropdown.items",
82
+ ...ee,
83
+ variant: [p, {
84
+ closed: !l && !m,
85
+ closedUp: !l && m
86
+ }],
87
+ id: s,
88
+ props: {
89
+ ...T(r.length > 0, f, c),
90
+ ...d
91
+ },
92
+ children: [r.map((e, t) => /* @__PURE__ */ b(w, {
93
+ row: e,
94
+ index: t
95
+ }, ce(e, t))), r.length === 0 && i && /* @__PURE__ */ b(t, {
96
+ component: "dropdown.emptyItem",
97
+ variant: p,
98
+ ...i.props
99
+ })]
105
100
  })
106
101
  });
107
102
  }
108
- function ae(e, t) {
103
+ function ce(e, t) {
109
104
  return e.kind === "item" ? e.element.props.value : `${e.kind}-${t}`;
110
105
  }
111
- ie.displayName = "DropdownItems";
106
+ se.displayName = "DropdownItems";
112
107
  //#endregion
113
108
  //#region src/components/dropdown/dropdownSearch.tsx
114
- function oe({ id: e, value: t, onValueChange: n, placeholder: r, inputRef: i, comboboxProps: a, onOpen: o }) {
109
+ function le({ id: e, value: t, onValueChange: n, placeholder: r, inputRef: i, comboboxProps: a, onOpen: o }) {
115
110
  let s = g((e) => n(e.target.value), [n]), c = g((e) => {
116
111
  e.stopPropagation(), o(e);
117
112
  }, [o]);
118
- return /* @__PURE__ */ C(l, {
113
+ return /* @__PURE__ */ b(l, {
119
114
  ai: "center",
120
115
  position: "absolute",
121
116
  inset: 0,
122
117
  p: 3,
123
- children: /* @__PURE__ */ C(d, {
118
+ children: /* @__PURE__ */ b(f, {
124
119
  clean: !0,
125
120
  id: e,
126
121
  value: t,
@@ -142,59 +137,64 @@ function oe({ id: e, value: t, onValueChange: n, placeholder: r, inputRef: i, co
142
137
  }
143
138
  //#endregion
144
139
  //#region src/components/dropdown/utils.ts
145
- function se(e) {
140
+ function ue(e) {
146
141
  if (e == null) return "";
147
142
  if (typeof e == "object") {
148
143
  let t = e.props?.children;
149
- return t == null ? "" : typeof t == "object" ? (Array.isArray(t) ? t : [t]).map((e) => se(e)).join("") : t.toString();
144
+ return t == null ? "" : typeof t == "object" ? (Array.isArray(t) ? t : [t]).map((e) => ue(e)).join("") : t.toString();
150
145
  }
151
146
  return e.toString();
152
147
  }
153
148
  //#endregion
154
149
  //#region src/components/dropdown.tsx
155
- function ce(e) {
150
+ function de(e) {
151
+ return e == null ? [] : Array.isArray(e) ? e : [e];
152
+ }
153
+ function fe(e) {
156
154
  let t = e?.props?.disabled;
157
155
  return (Array.isArray(t) ? t[0] : t) === !0;
158
156
  }
159
- function le(e) {
157
+ function pe(e) {
160
158
  return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
161
159
  }
162
- var ue = /* @__PURE__ */ new Set([
160
+ var me = /* @__PURE__ */ new Set([
163
161
  " ",
164
162
  "Home",
165
163
  "End",
166
164
  "ArrowLeft",
167
165
  "ArrowRight"
168
166
  ]);
169
- function de(u, ee) {
170
- let { name: p, defaultValue: m, value: h, multiple: _ = !1, isSearchable: S, searchPlaceholder: ne, children: T, hideIcon: E, showCheckbox: re = !1, label: D, labelProps: ae, itemsProps: de, iconProps: O, onChange: k, props: fe, ...A } = u, [pe, j] = x(Array.isArray(m) ? m : m ? [m] : []), me = "value" in u, M = y(() => me ? Array.isArray(h) ? h : h ? [h] : [] : pe, [
171
- me,
172
- h,
173
- pe
174
- ]), [he, ge] = x(null), [N, P] = x(!1), F = b(null), _e = g((e) => {
167
+ function E(u, te) {
168
+ let { name: p, defaultValue: m, value: h, defaultOpen: _, multiple: S = !1, isSearchable: C, searchPlaceholder: oe, children: w, hideIcon: T, showCheckbox: ce = !1, label: E, labelProps: D, itemsProps: O, iconProps: he, onValueChange: ge, onChange: _e, props: ve, ...k } = u, A = y(void 0), ye = n((e, t) => {
169
+ ge?.(S ? e : e[0], t), _e?.(A.current, e);
170
+ }), be = "value" in u, xe = v(() => be ? de(h) : void 0, [be, h]), [j, M] = r({
171
+ value: xe,
172
+ defaultValue: () => de(m),
173
+ onChange: ye
174
+ }), [Se, Ce] = re(null), [N, P] = re(!!_), F = y(null), we = g((e) => {
175
175
  F.current = e;
176
- }, []), ve = b(null), I = b(null), L = r("dropdown"), ye = A.id ?? `${L}-trigger`, be = `${L}-listbox`, xe = `${L}-label`, Se = D != null && D !== !1, Ce = g((e) => `${L}-option-${e}`, [L]), R = i((e = !1) => {
177
- P(!1), e || ge(null);
178
- }), z = y(() => (Array.isArray(T) ? T : [T]).flatMap((e) => e).filter(Boolean), [T]), B = y(() => z.filter((e) => e.type?.displayName === "DropdownItem"), [z]), we = y(() => {
176
+ }, []), Te = y(null), I = y(null), L = s("dropdown"), Ee = k.id ?? `${L}-trigger`, De = `${L}-listbox`, Oe = `${L}-label`, ke = E != null && E !== !1, Ae = g((e) => `${L}-option-${e}`, [L]), R = n((e = !1) => {
177
+ P(!1), e || Ce(null);
178
+ }), z = v(() => (Array.isArray(w) ? w : [w]).flatMap((e) => e).filter(Boolean), [w]), B = v(() => z.filter((e) => e.type?.displayName === "DropdownItem"), [z]), je = v(() => {
179
179
  let e = /* @__PURE__ */ new Map();
180
- for (let t of B) e.set(t, se(t));
180
+ for (let t of B) e.set(t, ue(t));
181
181
  return e;
182
- }, [B]), V = g((e) => we.get(e) ?? se(e), [we]), Te = S ? he ?? "" : "", H = y(() => Te ? B.filter((e) => V(e).toLowerCase().includes(Te.toLowerCase())) : B, [
183
- Te,
182
+ }, [B]), V = g((e) => je.get(e) ?? ue(e), [je]), Me = C ? Se ?? "" : "", H = v(() => Me ? B.filter((e) => V(e).toLowerCase().includes(Me.toLowerCase())) : B, [
183
+ Me,
184
184
  B,
185
185
  V
186
- ]), U = y(() => z.find((e) => e.type?.displayName === "DropdownUnselect"), [z]), W = y(() => z.find((e) => e.type?.displayName === "DropdownSelectAll"), [z]), Ee = y(() => z.find((e) => e.type?.displayName === "DropdownEmptyItem"), [z]), G = y(() => z.find((e) => e.type?.displayName === "DropdownDisplay"), [z]), K = y(() => !S || G ? "" : B.filter((e) => M.includes(e.props.value)).map((e) => V(e)).join(", "), [
187
- S,
186
+ ]), U = v(() => z.find((e) => e.type?.displayName === "DropdownUnselect"), [z]), W = v(() => z.find((e) => e.type?.displayName === "DropdownSelectAll"), [z]), Ne = v(() => z.find((e) => e.type?.displayName === "DropdownEmptyItem"), [z]), G = v(() => z.find((e) => e.type?.displayName === "DropdownDisplay"), [z]), K = v(() => !C || G ? "" : B.filter((e) => j.includes(e.props.value)).map((e) => V(e)).join(", "), [
187
+ C,
188
188
  G,
189
189
  B,
190
- M,
190
+ j,
191
191
  V
192
- ]), De = !!(W && _ && H.length > M.length), Oe = !!(U && H.length > 0 && !De), q = y(() => {
192
+ ]), Pe = !!(W && S && H.length > j.length), Fe = !!(U && H.length > 0 && !Pe), q = v(() => {
193
193
  let e = [];
194
- Oe && U && e.push({
194
+ Fe && U && e.push({
195
195
  kind: "unselect",
196
196
  element: U
197
- }), De && W && e.push({
197
+ }), Pe && W && e.push({
198
198
  kind: "selectAll",
199
199
  element: W
200
200
  });
@@ -204,186 +204,196 @@ function de(u, ee) {
204
204
  });
205
205
  return e;
206
206
  }, [
207
- Oe,
207
+ Fe,
208
208
  U,
209
- De,
209
+ Pe,
210
210
  W,
211
211
  H
212
- ]), J = g((e) => ce(q[e]?.element), [q]), ke = g((e) => {
212
+ ]), J = g((e) => fe(q[e]?.element), [q]), Ie = g((e) => {
213
213
  let t = q[e];
214
214
  return t ? V(t.element) : "";
215
- }, [q, V]), Ae = y(() => {
216
- if (S && (N || K !== "")) return null;
217
- if (G) return typeof G.props.children == "function" ? G.props.children(M, N) : G.props.children;
218
- let e = H.filter((e) => M.includes(e.props.value));
219
- if (_ && e.length > 1) return e.map((e) => V(e)).join(", ");
215
+ }, [q, V]), Le = v(() => {
216
+ if (C && (N || K !== "")) return null;
217
+ if (G) return typeof G.props.children == "function" ? G.props.children(j, N) : G.props.children;
218
+ let e = H.filter((e) => j.includes(e.props.value));
219
+ if (S && e.length > 1) return e.map((e) => V(e)).join(", ");
220
220
  let t = e.at(0);
221
- return t?.props.children ?? t?.props.value ?? (_ ? null : U?.props.children);
221
+ return t?.props.children ?? t?.props.value ?? (S ? null : U?.props.children);
222
222
  }, [
223
- _,
223
+ S,
224
224
  H,
225
- M,
225
+ j,
226
226
  U,
227
227
  N,
228
- S,
228
+ C,
229
229
  K,
230
230
  G,
231
231
  V
232
- ]), je = g((e, ...t) => {
233
- if (t.length === 0) j([]), k?.(void 0, []);
234
- else if (_ && t.length > 1) {
235
- let e = t.map((e) => e.props.value);
236
- j(e), k?.(void 0, e);
237
- } else if (t.length === 1) {
238
- let e = t[0];
239
- if (_) {
240
- let t = M.filter((t) => t !== e.props.value);
241
- t.length === M.length && t.push(e.props.value), j(t), k?.(e.props.value, t);
242
- } else j([e.props.value]), k?.(e.props.value, [e.props.value]);
232
+ ]), Re = g((e, ...t) => {
233
+ if (t.length === 0) A.current = void 0, M([], {
234
+ reason: "clear",
235
+ event: e
236
+ });
237
+ else if (S && t.length > 1) A.current = void 0, M(t.map((e) => e.props.value), {
238
+ reason: "select-all",
239
+ event: e
240
+ });
241
+ else if (t.length === 1) {
242
+ let n = t[0];
243
+ if (A.current = n.props.value, S) {
244
+ let t = j.filter((e) => e !== n.props.value), r = t.length !== j.length;
245
+ r || t.push(n.props.value), M(t, {
246
+ reason: r ? "deselect" : "select",
247
+ event: e
248
+ });
249
+ } else M([n.props.value], {
250
+ reason: "select",
251
+ event: e
252
+ });
243
253
  }
244
- e.stopPropagation(), _ ? S && setTimeout(() => I.current?.focus(), 0) : R();
254
+ e.stopPropagation(), S ? C && setTimeout(() => I.current?.focus(), 0) : R();
245
255
  }, [
246
- _,
247
256
  S,
257
+ C,
258
+ j,
248
259
  M,
249
- k,
250
260
  R
251
- ]), Y = i((e, t) => {
261
+ ]), Y = n((e, t) => {
252
262
  let n = q[e];
253
- !n || J(e) || (n.kind === "unselect" ? je(t) : n.kind === "selectAll" ? je(t, ...B) : je(t, n.element));
254
- }), X = o({
263
+ !n || J(e) || (n.kind === "unselect" ? Re(t) : n.kind === "selectAll" ? Re(t, ...B) : Re(t, n.element));
264
+ }), ze = (e) => {
265
+ let t = e === "first" ? 1 : -1;
266
+ for (let n = e === "first" ? 0 : q.length - 1; n >= 0 && n < q.length; n += t) if (!J(n)) return n;
267
+ return -1;
268
+ }, X = (e) => {
269
+ let t = q.findIndex((e) => e.kind === "item" && j.includes(e.element.props.value));
270
+ return t !== -1 && !J(t) ? t : e === "none" ? -1 : ze(e);
271
+ }, Z = o({
255
272
  count: q.length,
256
273
  focusItems: !1,
257
- defaultActiveIndex: -1,
274
+ defaultActiveIndex: _ ? X("none") : -1,
258
275
  isDisabled: J,
259
- textOf: S ? void 0 : ke,
276
+ textOf: C ? void 0 : Ie,
260
277
  onSelect: Y
261
- }), Me = X.setActiveIndex, Ne = g((e) => Me(-1, {
278
+ }), Be = Z.setActiveIndex, Ve = g((e) => Be(-1, {
262
279
  reason: "programmatic",
263
280
  event: e
264
- }), [Me]);
265
- n({
281
+ }), [Be]);
282
+ a({
266
283
  enabled: N,
267
- inside: [F, ve],
284
+ inside: [F, Te],
268
285
  onDismiss: (e) => R(e === "escape")
269
- }), a({
286
+ }), i({
270
287
  enabled: N,
271
- returnTo: S ? I : F
272
- }), v(() => {
288
+ returnTo: C ? I : F
289
+ }), ne(() => {
273
290
  N && I.current?.focus();
274
291
  }, [N]);
275
- let Z = X.activeIndex, Pe = X.activeItem;
292
+ let Q = Z.activeIndex, He = Z.activeItem;
276
293
  e(() => {
277
- !N || Z === -1 || Pe()?.scrollIntoView?.({ block: "nearest" });
294
+ !N || Q === -1 || He()?.scrollIntoView?.({ block: "nearest" });
278
295
  }, [
279
296
  N,
280
- Z,
281
- Pe
297
+ Q,
298
+ He
282
299
  ]);
283
- let Fe = (e) => {
284
- let t = e === "first" ? 1 : -1;
285
- for (let n = e === "first" ? 0 : q.length - 1; n >= 0 && n < q.length; n += t) if (!J(n)) return n;
286
- return -1;
287
- }, Q = (e) => {
288
- let t = q.findIndex((e) => e.kind === "item" && M.includes(e.element.props.value));
289
- return t !== -1 && !J(t) ? t : e === "none" ? -1 : Fe(e);
290
- }, $ = (e, t) => {
291
- P(!0), X.setActiveIndex(e, {
300
+ let $ = (e, t) => {
301
+ P(!0), Z.setActiveIndex(e, {
292
302
  reason: "programmatic",
293
303
  event: t
294
304
  });
295
- }, Ie = i((e) => {
296
- N ? R() : $(Q("none"), e);
297
- }), Le = i((e) => {
298
- N || $(Q("none"), e);
299
- }), Re = i((e) => {
300
- ge(e), N || P(!0), Ne();
301
- }), ze = (e) => {
305
+ }, Ue = n((e) => {
306
+ N ? R() : $(X("none"), e);
307
+ }), We = n((e) => {
308
+ N || $(X("none"), e);
309
+ }), Ge = n((e) => {
310
+ Ce(e), N || P(!0), Ve();
311
+ }), Ke = (e) => {
302
312
  let { key: t } = e;
303
- if (S) {
313
+ if (C) {
304
314
  if (t === "ArrowDown" || t === "ArrowUp") {
305
- e.preventDefault(), $(Q(t === "ArrowUp" ? "last" : e.altKey ? "none" : "first"), e);
315
+ e.preventDefault(), $(X(t === "ArrowUp" ? "last" : e.altKey ? "none" : "first"), e);
306
316
  return;
307
317
  }
308
- t === "Escape" && ge("");
318
+ t === "Escape" && Ce("");
309
319
  return;
310
320
  }
311
321
  if (t === "ArrowDown" || t === "Enter" || t === " ") {
312
- e.preventDefault(), $(Q(e.altKey ? "none" : "first"), e);
322
+ e.preventDefault(), $(X(e.altKey ? "none" : "first"), e);
313
323
  return;
314
324
  }
315
325
  if (t === "ArrowUp") {
316
- e.preventDefault(), $(Q("last"), e);
326
+ e.preventDefault(), $(X("last"), e);
317
327
  return;
318
328
  }
319
329
  if (t === "Home" || t === "End") {
320
- e.preventDefault(), $(Fe(t === "Home" ? "first" : "last"), e);
330
+ e.preventDefault(), $(ze(t === "Home" ? "first" : "last"), e);
321
331
  return;
322
332
  }
323
- le(e) && (P(!0), X.onKeyDown(e));
324
- }, Be = i((e) => {
325
- if (fe?.onKeyDown?.(e), !e.defaultPrevented) {
333
+ pe(e) && (P(!0), Z.onKeyDown(e));
334
+ }, qe = n((e) => {
335
+ if (ve?.onKeyDown?.(e), !e.defaultPrevented) {
326
336
  if (!N) {
327
- ze(e);
337
+ Ke(e);
328
338
  return;
329
339
  }
330
340
  if (e.key === "Tab") {
331
- !_ && X.activeIndex !== -1 && Y(X.activeIndex, e), R();
341
+ !S && Z.activeIndex !== -1 && Y(Z.activeIndex, e), R();
332
342
  return;
333
343
  }
334
344
  if (e.altKey && e.key === "ArrowUp") {
335
- e.preventDefault(), X.activeIndex !== -1 && Y(X.activeIndex, e), R();
345
+ e.preventDefault(), Z.activeIndex !== -1 && Y(Z.activeIndex, e), R();
336
346
  return;
337
347
  }
338
- if (S && ue.has(e.key)) {
339
- Ne(e);
348
+ if (C && me.has(e.key)) {
349
+ Ve(e);
340
350
  return;
341
351
  }
342
- X.onKeyDown(e);
352
+ Z.onKeyDown(e);
343
353
  }
344
- }), Ve = q.length > 0 || !!Ee, He = N && Z !== -1 && Ve ? Ce(Z) : void 0, Ue = X.itemProps, We = y(() => ({
345
- valueToUse: M,
346
- multiple: _,
347
- variant: A.variant,
348
- showCheckbox: re,
354
+ }), Je = q.length > 0 || !!Ne, Ye = N && Q !== -1 && Je ? Ae(Q) : void 0, Xe = Z.itemProps, Ze = v(() => ({
355
+ valueToUse: j,
356
+ multiple: S,
357
+ variant: k.variant,
358
+ showCheckbox: ce,
349
359
  selectRow: Y,
350
- optionId: Ce,
351
- activeIndex: Z,
352
- rowRef: (e) => Ue(e).ref,
360
+ optionId: Ae,
361
+ activeIndex: Q,
362
+ rowRef: (e) => Xe(e).ref,
353
363
  isRowDisabled: J
354
364
  }), [
355
- M,
356
- _,
357
- A.variant,
358
- re,
365
+ j,
366
+ S,
367
+ k.variant,
368
+ ce,
359
369
  Y,
360
- Ce,
361
- Z,
362
- Ue,
370
+ Ae,
371
+ Q,
372
+ Xe,
363
373
  J
364
- ]), Ge = {
374
+ ]), Qe = {
365
375
  "aria-expanded": N,
366
- "aria-controls": N && Ve ? be : void 0,
367
- "aria-activedescendant": He,
368
- "aria-labelledby": Se ? xe : void 0,
369
- ...fe,
370
- onKeyDown: Be
371
- }, Ke = M.map((e) => {
376
+ "aria-controls": N && Je ? De : void 0,
377
+ "aria-activedescendant": Ye,
378
+ "aria-labelledby": ke ? Oe : void 0,
379
+ ...ve,
380
+ onKeyDown: qe
381
+ }, $e = j.map((e) => {
372
382
  let t = JSON.stringify(e);
373
- return /* @__PURE__ */ C(d, {
374
- ref: ee,
383
+ return /* @__PURE__ */ b(f, {
384
+ ref: te,
375
385
  name: p,
376
386
  type: "hidden",
377
387
  value: t ?? ""
378
388
  }, t);
379
- }), qe = !E && /* @__PURE__ */ C(l, {
389
+ }), et = !T && /* @__PURE__ */ b(l, {
380
390
  component: "dropdown.icon",
381
- ...O,
382
- children: /* @__PURE__ */ C(s, {
391
+ ...he,
392
+ children: /* @__PURE__ */ b(c, {
383
393
  viewBox: "0 0 10 6",
384
394
  width: "0.6rem",
385
395
  rotate: N ? 180 : 0,
386
- children: /* @__PURE__ */ C("path", {
396
+ children: /* @__PURE__ */ b("path", {
387
397
  stroke: "currentColor",
388
398
  strokeLinecap: "round",
389
399
  strokeLinejoin: "round",
@@ -391,89 +401,91 @@ function de(u, ee) {
391
401
  d: "m1 1 4 4 4-4"
392
402
  })
393
403
  })
394
- }), Je = Ve && /* @__PURE__ */ C(f, {
404
+ }), tt = Je && /* @__PURE__ */ b(d, {
395
405
  present: N,
396
- children: (e) => /* @__PURE__ */ C(ie, {
406
+ children: (e) => /* @__PURE__ */ b(se, {
397
407
  presence: e,
398
408
  rows: q,
399
- emptyItem: Ee,
409
+ emptyItem: Ne,
400
410
  triggerRef: F,
401
- popupRef: ve,
402
- listboxId: be,
403
- labelledBy: Se ? xe : ye,
404
- itemsProps: de
411
+ popupRef: Te,
412
+ listboxId: De,
413
+ labelledBy: ke ? Oe : Ee,
414
+ itemsProps: O
405
415
  })
406
- }), Ye = S ? /* @__PURE__ */ w(t, {
407
- ref: _e,
416
+ }), nt = C ? /* @__PURE__ */ x(t, {
417
+ ref: we,
408
418
  component: "dropdown",
409
- props: { onClick: Ie },
419
+ props: { onClick: Ue },
410
420
  position: "relative",
411
- pe: E ? void 0 : 6,
421
+ pe: T ? void 0 : 6,
412
422
  minWidth: N ? 36 : void 0,
413
423
  width: "fit-content",
414
- ...A,
424
+ ...k,
415
425
  id: void 0,
416
426
  children: [
417
- Ke,
418
- /* @__PURE__ */ C(oe, {
419
- id: ye,
420
- value: he ?? K,
421
- onValueChange: Re,
422
- placeholder: N ? ne : void 0,
427
+ $e,
428
+ /* @__PURE__ */ b(le, {
429
+ id: Ee,
430
+ value: Se ?? K,
431
+ onValueChange: Ge,
432
+ placeholder: N ? oe : void 0,
423
433
  inputRef: I,
424
- comboboxProps: Ge,
425
- onOpen: Le
434
+ comboboxProps: Qe,
435
+ onOpen: We
426
436
  }),
427
- Ae ?? /* @__PURE__ */ C(t, {
437
+ Le ?? /* @__PURE__ */ b(t, {
428
438
  tag: "span",
429
439
  visibility: "hidden",
430
440
  children: K || "\xA0"
431
441
  }),
432
- qe,
433
- Je
442
+ et
434
443
  ]
435
- }) : /* @__PURE__ */ w(c, {
436
- ref: _e,
437
- onClick: Ie,
444
+ }) : /* @__PURE__ */ x(ee, {
445
+ ref: we,
446
+ onClick: Ue,
438
447
  component: "dropdown",
439
448
  type: "button",
440
449
  props: {
441
450
  tabIndex: 0,
442
451
  role: "combobox",
443
- ...Ge
452
+ ...Qe
444
453
  },
445
454
  position: "relative",
446
- pe: E ? void 0 : 6,
455
+ pe: T ? void 0 : 6,
447
456
  width: "fit-content",
448
- ...A,
449
- id: ye,
457
+ ...k,
458
+ id: Ee,
450
459
  children: [
451
- Ke,
452
- Ae ?? "\xA0",
453
- qe,
454
- Je
460
+ $e,
461
+ Le ?? "\xA0",
462
+ et
455
463
  ]
456
464
  });
457
- return /* @__PURE__ */ C(te.Provider, {
458
- value: We,
459
- children: Se ? /* @__PURE__ */ w(l, {
465
+ return /* @__PURE__ */ b(ae.Provider, {
466
+ value: Ze,
467
+ children: ke ? /* @__PURE__ */ x(l, {
460
468
  d: "column",
461
469
  gap: 1,
462
470
  width: "fit-content",
463
- ...ae,
464
- children: [/* @__PURE__ */ C(t, {
465
- tag: "span",
466
- id: xe,
467
- children: D
468
- }), Ye]
469
- }) : Ye
471
+ ...D,
472
+ children: [
473
+ /* @__PURE__ */ b(t, {
474
+ tag: "span",
475
+ id: Oe,
476
+ children: E
477
+ }),
478
+ nt,
479
+ tt
480
+ ]
481
+ }) : /* @__PURE__ */ x(ie, { children: [nt, tt] })
470
482
  });
471
483
  }
472
- function O(e) {
484
+ function D(e) {
473
485
  let t = (e) => null;
474
486
  return t.displayName = e, t;
475
487
  }
476
- var k = m(de);
477
- k.Item = O("DropdownItem"), k.Unselect = O("DropdownUnselect"), k.SelectAll = O("DropdownSelectAll"), k.EmptyItem = O("DropdownEmptyItem"), k.Display = O("DropdownDisplay"), k.displayName = "Dropdown";
488
+ var O = m(E);
489
+ O.Item = D("DropdownItem"), O.Unselect = D("DropdownUnselect"), O.SelectAll = D("DropdownSelectAll"), O.EmptyItem = D("DropdownEmptyItem"), O.Display = D("DropdownDisplay"), O.displayName = "Dropdown";
478
490
  //#endregion
479
- export { k as default };
491
+ export { O as default };