@box-kite/react 1.0.0 → 2.0.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 (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
@@ -0,0 +1,114 @@
1
+ import { BoxProps } from '../box';
2
+ import { ChangeHandler } from '../react/a11y/useControllableState';
3
+ import { ComponentsAndVariants } from '@box-kite/core/types';
4
+ /**
5
+ * Why a panel opened or closed. One reason today — a press on the header, which is also what Enter and
6
+ * Space on it produce — and the shape every other component in the library reports through.
7
+ */
8
+ export type DisclosureReason = 'trigger';
9
+ /** Which heading the header sits in. It says where the section sits in the document outline, nothing more. */
10
+ export type AccordionLevel = 1 | 2 | 3 | 4 | 5 | 6;
11
+ type AccordionBoxProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'div', TKey>, 'onChange'>;
12
+ export interface AccordionProps<TKey extends keyof ComponentsAndVariants = 'accordion'> extends AccordionBoxProps<TKey> {
13
+ /** The sections: one `Accordion.Item` each, holding an `Accordion.Trigger` and an `Accordion.Panel`. */
14
+ children?: React.ReactNode;
15
+ /** Controlled: the values of every panel standing open. Leave it out and the widget owns them. */
16
+ value?: string[];
17
+ /** Which panels start open. Left out, all of them are closed. */
18
+ defaultValue?: string[];
19
+ /** Fires with the panels now open, in the order they were opened. */
20
+ onValueChange?: ChangeHandler<string[], DisclosureReason>;
21
+ /** Whether several panels may stand open at once. Default `false`, so opening one closes the last. */
22
+ multiple?: boolean;
23
+ /** Whether Down and Up wrap around at the ends. Default `true`. */
24
+ loop?: boolean;
25
+ /**
26
+ * Which heading each header sits in. Default `3`. It has to fit the page around it — a heading level
27
+ * is the document's outline, and a screen reader navigates by it.
28
+ */
29
+ level?: AccordionLevel;
30
+ }
31
+ export interface AccordionItemProps<TKey extends keyof ComponentsAndVariants = 'accordion.item'> extends BoxProps<'div', TKey> {
32
+ /** What this section stands for, and what the widget reports when it is open. */
33
+ value: string;
34
+ /** The header and the panel. */
35
+ children?: React.ReactNode;
36
+ /**
37
+ * Not openable, and stepped over by Down and Up. It is the `disabled` attribute, so the browser has
38
+ * already taken the header out of the tab sequence — arrows that still stopped there would be
39
+ * reaching what Tab cannot.
40
+ */
41
+ disabled?: boolean;
42
+ }
43
+ /** Every Box prop, on the `<button>` inside the heading. */
44
+ export interface AccordionTriggerProps<TKey extends keyof ComponentsAndVariants = 'accordion.trigger'> extends Omit<BoxProps<'button', TKey>, 'disabled'> {
45
+ /** The header's label. */
46
+ children?: React.ReactNode;
47
+ /** This header's heading level, when it differs from the one the accordion sets. */
48
+ level?: AccordionLevel;
49
+ /** Whether to draw the chevron. Turn it off to supply an affordance of your own. Default `true`. */
50
+ arrow?: boolean;
51
+ }
52
+ export interface AccordionPanelProps<TKey extends keyof ComponentsAndVariants = 'accordion.panel'> extends BoxProps<'div', TKey> {
53
+ /** The section's content. */
54
+ children?: React.ReactNode;
55
+ }
56
+ interface AccordionType {
57
+ <TKey extends keyof ComponentsAndVariants = 'accordion'>(props: AccordionProps<TKey>): React.ReactNode;
58
+ Item: <TKey extends keyof ComponentsAndVariants = 'accordion.item'>(props: AccordionItemProps<TKey>) => React.ReactNode;
59
+ Trigger: <TKey extends keyof ComponentsAndVariants = 'accordion.trigger'>(props: AccordionTriggerProps<TKey>) => React.ReactNode;
60
+ Panel: <TKey extends keyof ComponentsAndVariants = 'accordion.panel'>(props: AccordionPanelProps<TKey>) => React.ReactNode;
61
+ displayName?: string;
62
+ }
63
+ /** The DOM attributes a collapsible's trigger has to carry. */
64
+ export interface CollapsibleTriggerAttributes {
65
+ id: string;
66
+ type: 'button';
67
+ 'aria-expanded': boolean;
68
+ 'aria-controls': string;
69
+ onClick(event: React.MouseEvent): void;
70
+ }
71
+ /**
72
+ * What the trigger has to carry: spread it onto the control itself, not a wrapper.
73
+ *
74
+ * ```tsx
75
+ * {(trigger) => <Button {...trigger}>Details</Button>}
76
+ * {(trigger) => <button {...trigger.props}>Details</button>}
77
+ * ```
78
+ */
79
+ export interface CollapsibleTrigger {
80
+ props: CollapsibleTriggerAttributes;
81
+ }
82
+ export interface CollapsibleProps<TKey extends keyof ComponentsAndVariants = 'collapsible'> extends Omit<BoxProps<'div', TKey>, 'open'> {
83
+ /** The content the trigger reveals. */
84
+ children?: React.ReactNode;
85
+ /** The control that opens it, handed the props that wire it to the panel. It has to be a button. */
86
+ trigger: (trigger: CollapsibleTrigger) => React.ReactNode;
87
+ /** Controlled open state. Leave it out and the widget owns it. */
88
+ open?: boolean;
89
+ /** Whether it starts open. Default `false`. */
90
+ defaultOpen?: boolean;
91
+ /** Fires with the new state and why it changed. */
92
+ onOpenChange?: ChangeHandler<boolean, DisclosureReason>;
93
+ }
94
+ /**
95
+ * One disclosure: a trigger, and the content it reveals.
96
+ *
97
+ * ```tsx
98
+ * <Collapsible trigger={(trigger) => <Button {...trigger}>What is in the box?</Button>}>
99
+ * <P>A kite.</P>
100
+ * </Collapsible>
101
+ * ```
102
+ *
103
+ * The same one-row grid an `Accordion` panel opens in, with no heading, no group and no arrow keys — a
104
+ * lone button needs none of them. Reach for it for a "show more", a filter drawer or a sidebar section;
105
+ * reach for `Accordion` when several sections know about each other.
106
+ *
107
+ * @a11y The trigger carries `aria-expanded` and `aria-controls`; the content has no role of its own,
108
+ * because a region wants a name and a trigger is not a heading. Use an `Accordion` where the sections
109
+ * are document structure.
110
+ */
111
+ declare function Collapsible<TKey extends keyof ComponentsAndVariants = 'collapsible'>(props: CollapsibleProps<TKey>): import("react").JSX.Element;
112
+ export { Collapsible };
113
+ declare const Accordion: AccordionType;
114
+ export default Accordion;
@@ -0,0 +1,251 @@
1
+ "use client";
2
+ import e from "../box.mjs";
3
+ import { a as t, i as n } from "../behavior.mjs";
4
+ import { t as r } from "../identity.mjs";
5
+ import { createContext as i, useContext as a, useMemo as o, useRef as s } from "react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ //#region src/utils/accordion/accordionUtils.ts
8
+ var u;
9
+ (function(e) {
10
+ e.ROOT_ATTRIBUTE = "data-accordion", e.TRIGGER_ATTRIBUTE = "data-accordion-trigger";
11
+ let t = e.ROOT_SELECTOR = "[data-accordion]", n = e.TRIGGER_SELECTOR = "[data-accordion-trigger]";
12
+ function r(e, n) {
13
+ return n instanceof Element && n.closest(t) === e;
14
+ }
15
+ e.owns = r;
16
+ function i(e) {
17
+ return e ? [...e.querySelectorAll(n)].filter((t) => r(e, t)) : [];
18
+ }
19
+ e.triggers = i;
20
+ function a(e) {
21
+ return e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true";
22
+ }
23
+ e.isDisabled = a;
24
+ function o(e, t, n, r) {
25
+ let i = e.length;
26
+ if (i === 0) return;
27
+ let o = t < 0 || t >= i ? n > 0 ? -1 : i : t;
28
+ for (let t = 0; t < i; t++) {
29
+ if (o += n, o < 0 || o >= i) {
30
+ if (!r) return;
31
+ o = (o % i + i) % i;
32
+ }
33
+ if (!a(e[o])) return e[o];
34
+ }
35
+ }
36
+ e.step = o;
37
+ function s(e, t) {
38
+ return o(e, t === 1 ? -1 : e.length, t, !1);
39
+ }
40
+ e.edge = s;
41
+ function c(e, t) {
42
+ return t instanceof HTMLElement ? e.indexOf(t) : -1;
43
+ }
44
+ e.indexOf = c;
45
+ function l(e) {
46
+ if (e === "ArrowDown") return {
47
+ kind: "step",
48
+ delta: 1
49
+ };
50
+ if (e === "ArrowUp") return {
51
+ kind: "step",
52
+ delta: -1
53
+ };
54
+ if (e === "Home") return {
55
+ kind: "edge",
56
+ delta: 1
57
+ };
58
+ if (e === "End") return {
59
+ kind: "edge",
60
+ delta: -1
61
+ };
62
+ }
63
+ e.moveFor = l;
64
+ function u(e, t, n, r) {
65
+ return n.kind === "edge" ? s(e, n.delta) : o(e, t, n.delta, r);
66
+ }
67
+ e.target = u;
68
+ function d(e, t, n) {
69
+ return e.includes(t) ? e.filter((e) => e !== t) : n ? [...e, t] : [t];
70
+ }
71
+ e.toggle = d;
72
+ })(u ||= {});
73
+ var d = u, f = [
74
+ "h1",
75
+ "h2",
76
+ "h3",
77
+ "h4",
78
+ "h5",
79
+ "h6"
80
+ ], p = i(null), m = i(null);
81
+ function h(e) {
82
+ let t = a(p);
83
+ if (!t) throw Error(`<${e}> has to be rendered inside an <Accordion>.`);
84
+ return t;
85
+ }
86
+ function g(e) {
87
+ let t = a(m);
88
+ if (!t) throw Error(`<${e}> has to be rendered inside an <Accordion.Item>.`);
89
+ return t;
90
+ }
91
+ function _(r) {
92
+ let { children: i, value: a, defaultValue: l, onValueChange: u, multiple: f = !1, loop: m = !0, level: h = 3, props: g, ..._ } = r, v = s(null), [y, b] = n({
93
+ value: a,
94
+ defaultValue: l ?? [],
95
+ onChange: u
96
+ }), x = t((e, t) => {
97
+ b((t) => d.toggle(t, e, f), t);
98
+ }), S = t((e) => {
99
+ let t = v.current;
100
+ if (!t || e.defaultPrevented || !d.owns(t, e.target)) return;
101
+ let n = d.triggers(t), r = d.indexOf(n, e.target);
102
+ if (r === -1) return;
103
+ let i = d.moveFor(e.key);
104
+ if (!i) return;
105
+ let a = d.target(n, r, i, m);
106
+ a && (e.preventDefault(), a.focus());
107
+ }), C = o(() => ({
108
+ open: y,
109
+ level: h,
110
+ toggle: x
111
+ }), [
112
+ y,
113
+ h,
114
+ x
115
+ ]);
116
+ return /* @__PURE__ */ c(p.Provider, {
117
+ value: C,
118
+ children: /* @__PURE__ */ c(e, {
119
+ ref: v,
120
+ component: "accordion",
121
+ ..._,
122
+ props: {
123
+ [d.ROOT_ATTRIBUTE]: "",
124
+ ...g,
125
+ onKeyDown: S
126
+ },
127
+ children: i
128
+ })
129
+ });
130
+ }
131
+ function v(t) {
132
+ let { value: n, children: i, disabled: a = !1, props: s, ...l } = t, { open: u } = h("Accordion.Item"), d = r("accordion"), f = u.includes(n), p = o(() => ({
133
+ value: n,
134
+ open: f,
135
+ disabled: a,
136
+ triggerId: `${d}-trigger`,
137
+ panelId: `${d}-panel`
138
+ }), [
139
+ n,
140
+ f,
141
+ a,
142
+ d
143
+ ]);
144
+ return /* @__PURE__ */ c(m.Provider, {
145
+ value: p,
146
+ children: /* @__PURE__ */ c(e, {
147
+ component: "accordion.item",
148
+ ...l,
149
+ props: s,
150
+ children: i
151
+ })
152
+ });
153
+ }
154
+ v.displayName = "Accordion.Item";
155
+ function y(n) {
156
+ let { children: r, level: i, arrow: a = !0, props: o, ...s } = n, { level: u, toggle: p } = h("Accordion.Trigger"), { value: m, open: _, disabled: v, triggerId: y, panelId: b } = g("Accordion.Trigger"), x = t((e) => p(m, {
157
+ reason: "trigger",
158
+ event: e
159
+ }));
160
+ return /* @__PURE__ */ c(e, {
161
+ tag: f[(i ?? u) - 1],
162
+ component: "accordion.heading",
163
+ children: /* @__PURE__ */ l(e, {
164
+ tag: "button",
165
+ component: "accordion.trigger",
166
+ ...s,
167
+ disabled: v,
168
+ id: y,
169
+ props: {
170
+ type: "button",
171
+ "aria-expanded": _,
172
+ "aria-controls": b,
173
+ [d.TRIGGER_ATTRIBUTE]: "",
174
+ ...o,
175
+ onClick: x
176
+ },
177
+ children: [r, a && /* @__PURE__ */ c(e, {
178
+ tag: "span",
179
+ component: "accordion.arrow",
180
+ variant: { open: _ },
181
+ props: { "aria-hidden": !0 }
182
+ })]
183
+ })
184
+ });
185
+ }
186
+ y.displayName = "Accordion.Trigger";
187
+ function b(t) {
188
+ let { children: n, props: r, ...i } = t, { open: a, triggerId: o, panelId: s } = g("Accordion.Panel");
189
+ return /* @__PURE__ */ c(e, {
190
+ component: "accordion.track",
191
+ variant: { closed: !a },
192
+ children: /* @__PURE__ */ c(e, {
193
+ component: "accordion.clip",
194
+ children: /* @__PURE__ */ c(e, {
195
+ component: "accordion.panel",
196
+ ...i,
197
+ id: s,
198
+ props: {
199
+ role: "region",
200
+ "aria-labelledby": o,
201
+ ...r
202
+ },
203
+ children: n
204
+ })
205
+ })
206
+ });
207
+ }
208
+ b.displayName = "Accordion.Panel";
209
+ function x(i) {
210
+ let { children: a, trigger: s, open: u, defaultOpen: d = !1, onOpenChange: f, props: p, ...m } = i, h = r("collapsible"), g = `${h}-trigger`, _ = `${h}-panel`, [v, y] = n({
211
+ value: u,
212
+ defaultValue: d,
213
+ onChange: f
214
+ }), b = t((e) => y((e) => !e, {
215
+ reason: "trigger",
216
+ event: e
217
+ })), x = o(() => ({ props: {
218
+ id: g,
219
+ type: "button",
220
+ "aria-expanded": v,
221
+ "aria-controls": _,
222
+ onClick: b
223
+ } }), [
224
+ g,
225
+ _,
226
+ v,
227
+ b
228
+ ]);
229
+ return /* @__PURE__ */ l(e, {
230
+ component: "collapsible",
231
+ ...m,
232
+ props: p,
233
+ children: [s(x), /* @__PURE__ */ c(e, {
234
+ component: "collapsible.track",
235
+ variant: { closed: !v },
236
+ children: /* @__PURE__ */ c(e, {
237
+ component: "collapsible.clip",
238
+ children: /* @__PURE__ */ c(e, {
239
+ component: "collapsible.panel",
240
+ id: _,
241
+ children: a
242
+ })
243
+ })
244
+ })]
245
+ });
246
+ }
247
+ x.displayName = "Collapsible";
248
+ var S = _;
249
+ S.Item = v, S.Trigger = y, S.Panel = b, S.displayName = "Accordion";
250
+ //#endregion
251
+ export { x as Collapsible, S as default };
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../rolldown-runtime.cjs"),t=require("../react-shared.cjs");let n=require("react"),r=require("react/jsx-runtime"),i=require("@box-kite/react");i=e.t(i,1);var a=[`type`,`onClick`];function o(e,n){let o=t.t.buildProps(e,a);return(0,r.jsx)(i.default,{ref:n,tag:`button`,component:`button`,...o})}var s=(0,n.forwardRef)(o);s.displayName=`Button`,exports.default=s;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../rolldown-runtime.cjs"),t=require("../react-shared.cjs");let n=require("react"),r=require("react/jsx-runtime"),i=require("@box-kite/react");i=e.t(i,1);var a=[`type`,`onClick`];function o(e,n){let o=t.i.buildProps(e,a);return(0,r.jsx)(i.default,{ref:n,tag:`button`,component:`button`,...o})}var s=(0,n.forwardRef)(o);s.displayName=`Button`,exports.default=s;
@@ -8,8 +8,11 @@ type ButtonProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'butt
8
8
  type ButtonTagProps = OmitTagProps<BoxTagProps<'button'>, TagPropsType>;
9
9
  type ButtonType = Required<React.ComponentProps<'button'>>['type'];
10
10
  interface Props<TKey extends keyof ComponentsAndVariants> extends ButtonProps<TKey> {
11
+ /** Attributes for the `<button>` itself — `disabled`, `aria-label`, `form`, `value`. */
11
12
  props?: ButtonTagProps;
13
+ /** `button` unless you say otherwise. Inside a form a `<button>` with no type submits it. */
12
14
  type?: ButtonType;
15
+ /** Fires on a click, and on Enter or Space, which the browser turns into one. */
13
16
  onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
14
17
  }
15
18
  declare const _default: <TKey extends keyof ComponentsAndVariants = "button">(props: Props<TKey> & RefAttributes<HTMLButtonElement>) => React.ReactNode;
@@ -1,4 +1,4 @@
1
- import { t as e } from "../react-shared.mjs";
1
+ import { i as e } from "../react-shared.mjs";
2
2
  import { forwardRef as t } from "react";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  import r from "@box-kite/react";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime.cjs"),t=require("./svg.cjs");let n=require("react"),r=require("@box-kite/core"),i=require("react/jsx-runtime"),a=require("@box-kite/react");a=e.t(a,1);var o;(function(e){let t=e.VIEW=100,n=e.CENTRE=t/2,r=e.FRACTION_STEP=.005;function i(e){return Math.round(e*100)/100}function a(e){return Math.round(Math.min(Math.max(e,0),1)/r)*r}e.fraction=a;function o(e,r={}){if(e.length===0)return[];let a=r.min??Math.min(...e),o=(r.max??Math.max(...e))-a,s=e=>i(o===0?n:t-(e-a)/o*t);if(e.length===1)return[{x:0,y:s(e[0])},{x:t,y:s(e[0])}];let c=t/(e.length-1);return e.map((e,t)=>({x:i(t*c),y:s(e)}))}e.points=o;function s(e){return e.length===0?``:e.map((e,t)=>`${t===0?`M`:`L`}${e.x} ${e.y}`).join(``)}e.linePath=s;function c(e){if(e.length===0)return``;let n=e[e.length-1];return`${s(e)}L${n.x} ${t}L${e[0].x} ${t}Z`}e.areaPath=c;function l(e,n={},r=.25){if(e.length===0)return``;let a=t/e.length,s=i(a*(1-r)),c=i((a-s)/2);return o(e,n).map((e,n)=>{let r=Math.min(e.y,t-1);return`M${i(n*a+c)} ${r}h${s}v${i(t-r)}h${-s}Z`}).join(``)}e.barsPath=l;function u(e){return i(n-e/2)}e.radius=u;function d(e){return i(2*Math.PI*e)}e.circumference=d;function f(e,t){return{strokeDasharray:i(e),strokeDashoffset:i(e*(1-a(t)))}}e.dash=f;function p(e,t){let r=(t-90)*Math.PI/180;return{x:i(n+e*Math.cos(r)),y:i(n+e*Math.sin(r))}}function m(e,t){return i(d(e)*(Math.min(Math.abs(t),360)/360))}e.arcLength=m;function h(e,t,n){if(Math.abs(n)>=360){let n=p(e,t),r=p(e,t+180);return`M${n.x} ${n.y}A${e} ${e} 0 0 1 ${r.x} ${r.y}A${e} ${e} 0 0 1 ${n.x} ${n.y}`}let r=p(e,t),i=p(e,t+n),a=+(Math.abs(n)>180),o=n<0?0:1;return`M${r.x} ${r.y}A${e} ${e} 0 ${a} ${o} ${i.x} ${i.y}`}e.arcPath=h;function g(e,t){let n=e.reduce((e,t)=>e+Math.max(t,0),0);if(n<=0)return[];let r=0;return e.map((e,o)=>{let s=a(Math.max(e,0)/n),c=i(t*s),l=i(r*360);return r+=s,{strokeDasharray:`${c} ${i(t-c)}`,rotate:l,value:e,index:o}})}e.donutSegments=g;let _=e.PALETTE=[`sky-500`,`emerald-500`,`amber-500`,`violet-500`,`rose-500`,`cyan-500`];e.DARK_PALETTE=[`sky-400`,`emerald-400`,`amber-400`,`violet-400`,`rose-400`,`cyan-400`];function v(e){return e.reduce((e,t,n)=>(e[`chart-${n+1}`]=t,e),{})}e.paletteVariables=v;function y(e,t=_.length){return(Array.isArray(e)?e.map((e,n)=>[e,`var(--chart-${n%t+1})`]):Object.entries(e)).reduce((e,[t,n])=>(e[`color-${t}`]=n,e),{})}e.seriesVariables=y})(o||={});var s=o,c=`0 0 ${s.VIEW} ${s.VIEW}`,l=s.PALETTE;function u(e,n){let{data:r,variant:a=`line`,min:o,max:l,children:u,...d}=e,f={min:o,max:l},p=s.points(r,f);return(0,i.jsxs)(t.Svg,{viewBox:c,preserveAspectRatio:`none`,vectorEffect:`non-scaling-stroke`,width:`100%`,height:`1.5rem`,overflow:`visible`,stroke:`currentColor`,fill:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,ref:n,...d,children:[a===`bar`?(0,i.jsx)(t.Path,{d:s.barsPath(r,f),stroke:`none`}):(0,i.jsxs)(i.Fragment,{children:[a===`area`&&(0,i.jsx)(t.Path,{d:s.areaPath(p),stroke:`none`,fillOpacity:.2}),(0,i.jsx)(t.Path,{d:s.linePath(p),fill:`none`})]}),u]})}var d=(0,n.forwardRef)(u);d.displayName=`Sparkline`;function f(e,n){let{value:r,thickness:a=10,trackOpacity:o=.2,children:l,...u}=e,d=s.radius(a),f=s.circumference(d);return(0,i.jsxs)(t.Svg,{viewBox:c,width:`3rem`,height:`3rem`,stroke:`currentColor`,fill:`none`,strokeWidth:a,strokeLinecap:`round`,ref:n,...u,children:[(0,i.jsx)(t.Circle,{cx:s.CENTRE,cy:s.CENTRE,r:d,strokeOpacity:o}),(0,i.jsx)(t.Circle,{cx:s.CENTRE,cy:s.CENTRE,r:d,transform:`rotate(-90 ${s.CENTRE} ${s.CENTRE})`,...s.dash(f,r)}),l]})}var p=(0,n.forwardRef)(f);p.displayName=`ProgressRing`;function m(e,n){let{value:r,thickness:a=10,trackOpacity:o=.2,sweep:l=270,start:u=225,children:d,...f}=e,p=s.radius(a),m=s.arcLength(p,l),h=s.arcPath(p,u,l);return(0,i.jsxs)(t.Svg,{viewBox:c,width:`4rem`,height:`4rem`,stroke:`currentColor`,fill:`none`,strokeWidth:a,strokeLinecap:`round`,ref:n,...f,children:[(0,i.jsx)(t.Path,{d:h,strokeOpacity:o}),(0,i.jsx)(t.Path,{d:h,...s.dash(m,r)}),d]})}var h=(0,n.forwardRef)(m);h.displayName=`Gauge`;function g(e,n){let{data:r,colors:a=l,thickness:o=20,children:u,...d}=e,f=s.radius(o),p=s.circumference(f);return(0,i.jsxs)(t.Svg,{viewBox:c,width:`3rem`,height:`3rem`,fill:`none`,strokeWidth:o,ref:n,...d,children:[s.donutSegments(r,p).map(e=>(0,i.jsx)(t.Circle,{cx:s.CENTRE,cy:s.CENTRE,r:f,stroke:a[e.index%a.length],strokeDasharray:e.strokeDasharray,transform:`rotate(${e.rotate-90} ${s.CENTRE} ${s.CENTRE})`},e.index)),u]})}var _=(0,n.forwardRef)(g);_.displayName=`MiniDonut`;function v(e,t){let{series:n,vars:o,theme:c,...l}=e,u={...s.paletteVariables(s.PALETTE),...n?s.seriesVariables(n):{},...o},d=(0,r.mergeDeep)({dark:{vars:s.paletteVariables(s.DARK_PALETTE)}},c??{});return(0,i.jsx)(a.default,{ref:t,vars:u,theme:d,...l})}var y=(0,n.forwardRef)(v);y.displayName=`ChartContainer`;var b=y;exports.ChartContainer=b,exports.Gauge=h,exports.MiniDonut=_,exports.ProgressRing=p,exports.Sparkline=d;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime.cjs"),t=require("../react-shared.cjs"),n=require("./svg.cjs");let r=require("react"),i=require("react/jsx-runtime"),a=require("@box-kite/react");a=e.t(a,1);var o;(function(e){let n=e.VIEW=100,r=e.CENTRE=n/2,i=e.FRACTION_STEP=.005;function a(e){return Math.round(e*100)/100}function o(e){return Math.round(Math.min(Math.max(e,0),1)/i)*i}e.fraction=o;function s(e,t={}){if(e.length===0)return[];let i=t.min??Math.min(...e),o=(t.max??Math.max(...e))-i,s=e=>a(o===0?r:n-(e-i)/o*n);if(e.length===1)return[{x:0,y:s(e[0])},{x:n,y:s(e[0])}];let c=n/(e.length-1);return e.map((e,t)=>({x:a(t*c),y:s(e)}))}e.points=s;function c(e){return e.length===0?``:e.map((e,t)=>`${t===0?`M`:`L`}${e.x} ${e.y}`).join(``)}e.linePath=c;function l(e){if(e.length===0)return``;let t=e[e.length-1];return`${c(e)}L${t.x} ${n}L${e[0].x} ${n}Z`}e.areaPath=l;function u(e,t={},r=.25){if(e.length===0)return``;let i=n/e.length,o=a(i*(1-r)),c=a((i-o)/2);return s(e,t).map((e,t)=>{let r=Math.min(e.y,n-1);return`M${a(t*i+c)} ${r}h${o}v${a(n-r)}h${-o}Z`}).join(``)}e.barsPath=u;function d(e){return a(r-e/2)}e.radius=d;function f(e){return a(2*Math.PI*e)}e.circumference=f;function p(e,t){return{strokeDasharray:a(e),strokeDashoffset:a(e*(1-o(t)))}}e.dash=p;function m(e,t){let n=(t-90)*Math.PI/180;return{x:a(r+e*Math.cos(n)),y:a(r+e*Math.sin(n))}}function h(e,t){return a(f(e)*(Math.min(Math.abs(t),360)/360))}e.arcLength=h;function g(e,t,n){if(Math.abs(n)>=360){let n=m(e,t),r=m(e,t+180);return`M${n.x} ${n.y}A${e} ${e} 0 0 1 ${r.x} ${r.y}A${e} ${e} 0 0 1 ${n.x} ${n.y}`}let r=m(e,t),i=m(e,t+n),a=+(Math.abs(n)>180),o=n<0?0:1;return`M${r.x} ${r.y}A${e} ${e} 0 ${a} ${o} ${i.x} ${i.y}`}e.arcPath=g;function _(e,t){let n=e.reduce((e,t)=>e+Math.max(t,0),0);if(n<=0)return[];let r=0;return e.map((e,i)=>{let s=o(Math.max(e,0)/n),c=a(t*s),l=a(r*360);return r+=s,{strokeDasharray:`${c} ${a(t-c)}`,rotate:l,value:e,index:i}})}e.donutSegments=_;let v=e.PALETTE=t.n;e.DARK_PALETTE=t.t,e.paletteVariables=t.r;function y(e,t=v.length){return(Array.isArray(e)?e.map((e,n)=>[e,`var(--chart-${n%t+1})`]):Object.entries(e)).reduce((e,[t,n])=>(e[`color-${t}`]=n,e),{})}e.seriesVariables=y})(o||={});var s=o,c=`0 0 ${s.VIEW} ${s.VIEW}`,l=s.PALETTE;function u(e,t){let{data:r,variant:a=`line`,min:o,max:l,children:u,...d}=e,f={min:o,max:l},p=s.points(r,f);return(0,i.jsxs)(n.Svg,{viewBox:c,component:`sparkline`,preserveAspectRatio:`none`,width:`100%`,height:`1.5rem`,ref:t,...d,children:[a===`bar`?(0,i.jsx)(n.Path,{component:`sparkline.bar`,d:s.barsPath(r,f)}):(0,i.jsxs)(i.Fragment,{children:[a===`area`&&(0,i.jsx)(n.Path,{component:`sparkline.area`,d:s.areaPath(p)}),(0,i.jsx)(n.Path,{component:`sparkline.line`,d:s.linePath(p)})]}),u]})}var d=(0,r.forwardRef)(u);d.displayName=`Sparkline`;function f(e,t){let{value:r,thickness:a=10,trackOpacity:o,children:l,...u}=e,d=s.radius(a),f=s.circumference(d);return(0,i.jsxs)(n.Svg,{viewBox:c,component:`progressRing`,width:`3rem`,height:`3rem`,strokeWidth:a,ref:t,...u,children:[(0,i.jsx)(n.Circle,{component:`progressRing.track`,cx:s.CENTRE,cy:s.CENTRE,r:d,strokeOpacity:o}),(0,i.jsx)(n.Circle,{component:`progressRing.arc`,cx:s.CENTRE,cy:s.CENTRE,r:d,transform:`rotate(-90 ${s.CENTRE} ${s.CENTRE})`,...s.dash(f,r)}),l]})}var p=(0,r.forwardRef)(f);p.displayName=`ProgressRing`;function m(e,t){let{value:r,thickness:a=10,trackOpacity:o,sweep:l=270,start:u=225,children:d,...f}=e,p=s.radius(a),m=s.arcLength(p,l),h=s.arcPath(p,u,l);return(0,i.jsxs)(n.Svg,{viewBox:c,component:`gauge`,width:`4rem`,height:`4rem`,strokeWidth:a,ref:t,...f,children:[(0,i.jsx)(n.Path,{component:`gauge.track`,d:h,strokeOpacity:o}),(0,i.jsx)(n.Path,{component:`gauge.arc`,d:h,...s.dash(m,r)}),d]})}var h=(0,r.forwardRef)(m);h.displayName=`Gauge`;function g(e,t){let{data:r,colors:a=l,thickness:o=20,children:u,...d}=e,f=s.radius(o),p=s.circumference(f);return(0,i.jsxs)(n.Svg,{viewBox:c,component:`miniDonut`,width:`3rem`,height:`3rem`,strokeWidth:o,ref:t,...d,children:[s.donutSegments(r,p).map(e=>(0,i.jsx)(n.Circle,{component:`miniDonut.segment`,cx:s.CENTRE,cy:s.CENTRE,r:f,stroke:a[e.index%a.length],strokeDasharray:e.strokeDasharray,transform:`rotate(${e.rotate-90} ${s.CENTRE} ${s.CENTRE})`},e.index)),u]})}var _=(0,r.forwardRef)(g);_.displayName=`MiniDonut`;function v(e,t){let{series:n,vars:r,...o}=e,c={...n?s.seriesVariables(n):{},...r};return(0,i.jsx)(a.default,{ref:t,component:`chartContainer`,vars:c,...o})}var y=(0,r.forwardRef)(v);y.displayName=`ChartContainer`;var b=y;exports.ChartContainer=b,exports.Gauge=h,exports.MiniDonut=_,exports.ProgressRing=p,exports.Sparkline=d;
@@ -29,6 +29,7 @@ export interface SparklineProps extends ChartProps {
29
29
  * every row of a table is scaled to itself; with them a column of sparklines is comparable.
30
30
  */
31
31
  min?: number;
32
+ /** The top of the value axis — see `min`, which it is written beside. */
32
33
  max?: number;
33
34
  }
34
35
  /** A line, area or bar chart small enough to sit inside a line of text or a table cell. */
@@ -39,7 +40,7 @@ export interface ProgressRingProps extends ChartProps {
39
40
  value: number;
40
41
  /** The width of the ring in view units, out of the 100 the box is wide. */
41
42
  thickness?: number;
42
- /** The unfilled part of the ring, as the same colour faded — so the track follows the theme too. */
43
+ /** The unfilled part of the ring, as the same colour faded — so the track follows the theme too. Default `0.2`, from the style node. */
43
44
  trackOpacity?: NonNullable<BoxStyleProps['strokeOpacity']>;
44
45
  }
45
46
  /** A full circle filled to `value`, starting at twelve o'clock — the percentage-complete ring. */