@box-kite/react 2.2.6 → 2.2.8

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 (122) hide show
  1. package/.claude/rules/box-kite-rules.md +2 -0
  2. package/.claude/skills/box-kite/SKILL.md +2 -0
  3. package/.claude/skills/box-kite/references/extending.md +10 -0
  4. package/.claude/skills/box-kite/references/styling.md +3 -2
  5. package/.cursor/rules/box-kite.mdc +2 -0
  6. package/AGENTS.md +2 -0
  7. package/BOX_AI_CONTEXT.md +128 -2
  8. package/BOX_KITE_AI_CONTEXT.md +128 -2
  9. package/analytics.cjs +1 -0
  10. package/analytics.d.ts +10 -0
  11. package/analytics.mjs +121 -0
  12. package/behavior.cjs +1 -1
  13. package/behavior.mjs +42 -38
  14. package/box.cjs +1 -1
  15. package/box.d.ts +14 -0
  16. package/box.mjs +17 -16
  17. package/catalog.cjs +1 -1
  18. package/catalog.mjs +8 -0
  19. package/client.cjs +1 -1
  20. package/client.mjs +144 -113
  21. package/components/accordion.cjs +1 -1
  22. package/components/accordion.mjs +19 -10
  23. package/components/agent.cjs +1 -1
  24. package/components/agent.mjs +21 -8
  25. package/components/calendar.cjs +1 -1
  26. package/components/calendar.d.ts +3 -1
  27. package/components/calendar.mjs +154 -142
  28. package/components/combobox.cjs +1 -1
  29. package/components/combobox.mjs +184 -174
  30. package/components/dashboard.cjs +1 -1
  31. package/components/dashboard.mjs +183 -170
  32. package/components/dataGrid/models/columnModel.d.ts +1 -0
  33. package/components/dataGrid/models/gridModel.d.ts +18 -0
  34. package/components/dataGrid/models/headerCellModel.d.ts +1 -0
  35. package/components/dataGrid/models/rangeModel.d.ts +3 -0
  36. package/components/dataGrid.cjs +3 -3
  37. package/components/dataGrid.mjs +1015 -923
  38. package/components/dateField.cjs +1 -1
  39. package/components/dateField.mjs +165 -159
  40. package/components/datePicker.cjs +1 -1
  41. package/components/datePicker.mjs +198 -183
  42. package/components/dialog.cjs +1 -1
  43. package/components/dialog.mjs +38 -33
  44. package/components/dropdown.cjs +1 -1
  45. package/components/dropdown.mjs +107 -93
  46. package/components/form.cjs +1 -1
  47. package/components/form.mjs +22 -18
  48. package/components/menu.cjs +1 -1
  49. package/components/menu.d.ts +2 -0
  50. package/components/menu.mjs +196 -175
  51. package/components/overlay.cjs +1 -1
  52. package/components/overlay.mjs +7 -7
  53. package/components/popover.cjs +1 -1
  54. package/components/popover.mjs +4 -0
  55. package/components/radioGroup.cjs +1 -1
  56. package/components/radioGroup.mjs +10 -5
  57. package/components/semantics.d.ts +29 -29
  58. package/components/slider.cjs +1 -1
  59. package/components/slider.mjs +84 -83
  60. package/components/sortableList.cjs +1 -1
  61. package/components/sortableList.mjs +158 -150
  62. package/components/swipeItem.cjs +1 -1
  63. package/components/swipeItem.mjs +92 -84
  64. package/components/tabs.cjs +1 -1
  65. package/components/tabs.mjs +10 -5
  66. package/components/timeZoneSelect.cjs +1 -1
  67. package/components/timeZoneSelect.mjs +40 -35
  68. package/components/toaster.cjs +1 -1
  69. package/components/toaster.mjs +151 -113
  70. package/create/src/index.d.ts +1 -0
  71. package/create/src/options.d.ts +27 -0
  72. package/create/src/options.test.d.ts +1 -0
  73. package/create/src/packageManager.d.ts +5 -0
  74. package/create/src/project.d.ts +25 -0
  75. package/create/src/project.test.d.ts +1 -0
  76. package/create/templates/ts/designs/azure.d.ts +5 -0
  77. package/create/templates/ts/designs/ember.d.ts +5 -0
  78. package/create/templates/ts/designs/mono.d.ts +5 -0
  79. package/create/templates/ts/src/App.d.ts +2 -0
  80. package/create/templates/ts/src/design.d.ts +5 -0
  81. package/create/templates/ts/src/main.d.ts +0 -0
  82. package/dataGridDateParts.cjs +1 -1
  83. package/dataGridDateParts.mjs +56 -55
  84. package/dataGridList.cjs +1 -1
  85. package/dataGridList.mjs +437 -436
  86. package/docs/props.md +19 -19
  87. package/effects.cjs +1 -1
  88. package/effects.mjs +1 -1
  89. package/interactionListening.cjs +1 -0
  90. package/interactionListening.mjs +117 -0
  91. package/interactions.cjs +1 -0
  92. package/interactions.mjs +25 -0
  93. package/layer.cjs +1 -1
  94. package/layer.mjs +68 -66
  95. package/package.json +139 -70
  96. package/placement.cjs +1 -1
  97. package/placement.mjs +10 -10
  98. package/platform.cjs +1 -1
  99. package/platform.mjs +44 -25
  100. package/react/interactions/interactions.d.ts +30 -0
  101. package/react/popover/usePopoverLayer.d.ts +3 -0
  102. package/react/theme/theme.d.ts +9 -0
  103. package/react/theme/themeContext.d.ts +2 -0
  104. package/react/useStyles.d.ts +8 -1
  105. package/react-shared.cjs +1 -1
  106. package/react-shared.mjs +49 -48
  107. package/reporting.cjs +1 -0
  108. package/reporting.mjs +51 -0
  109. package/rsc.cjs +1 -1
  110. package/rsc.d.ts +3 -0
  111. package/rsc.mjs +1 -1
  112. package/scrolling.cjs +1 -1
  113. package/scrolling.mjs +1 -1
  114. package/supabase/functions/collect/index.d.ts +30 -0
  115. package/supabase/functions/collect/index.test.d.ts +1 -0
  116. package/utils/analytics/analytics.d.ts +72 -0
  117. package/utils/analytics/analyticsIdentity.d.ts +13 -0
  118. package/utils/interactions/componentAttribute.d.ts +6 -0
  119. package/utils/interactions/interactionChannel.d.ts +35 -0
  120. package/utils/interactions/interactionJson.d.ts +6 -0
  121. package/utils/interactions/interactionListening.d.ts +6 -0
  122. package/utils/interactions/interactionTypes.d.ts +224 -0
@@ -0,0 +1,35 @@
1
+ import { InteractionEvent, InteractionListener, InteractionOptions, InteractionReport } from './interactionTypes';
2
+ export type { ComponentInteraction, ComponentInteractions, CustomInteraction, DomInteraction, InteractionComponent, InteractionEvent, InteractionJson, InteractionListener, InteractionOptions, InteractionReport, InteractionSource, InteractionType, } from './interactionTypes';
3
+ /** What happened, as it stood when it happened; everything else is worked out on delivery. */
4
+ export interface Entry {
5
+ kind: InteractionEvent['kind'];
6
+ input: InteractionReport;
7
+ event?: Event;
8
+ /** The element a React handler ran on, read now: `currentTarget` is gone once dispatch ends. */
9
+ handler?: unknown;
10
+ timeStamp: number;
11
+ time: number;
12
+ url: string;
13
+ }
14
+ export interface Channel {
15
+ listeners: Map<InteractionListener, InteractionOptions>;
16
+ queue: Entry[];
17
+ /** The event the browser is dispatching, so a change made inside a handler names it without being told. */
18
+ dispatching?: Event;
19
+ /** Both set by the delivery half when it loads; until then, what happens waits in the queue. */
20
+ schedule?: () => void;
21
+ flush?: () => void;
22
+ loading?: boolean;
23
+ warned?: boolean;
24
+ }
25
+ /**
26
+ * Hear every interaction from here on, until the returned function is called. Delivery is fire and forget: events arrive in order,
27
+ * batched, in a background task after the handler that caused them, and a listener that throws is reported rather than rethrown.
28
+ */
29
+ export declare function subscribeInteractions(listener: InteractionListener, options?: InteractionOptions): () => void;
30
+ /** Deliver whatever is queued, now: what an analytics sender calls on `pagehide` before it sends its batch. */
31
+ export declare const flushInteractions: () => void;
32
+ /** What a component reports, beside the callback it fires for the same change. */
33
+ export declare const emitInteraction: (input: InteractionReport) => void;
34
+ /** A moment of the app's own (a page view, a hover, a wizard step) to the same listeners, fire and forget. */
35
+ export declare const reportInteraction: (input: InteractionReport) => void;
@@ -0,0 +1,6 @@
1
+ import { InteractionJson } from './interactionTypes';
2
+ /**
3
+ * A value as plain JSON, or `undefined` for what has none: a function, a React element, a DOM node, a class instance.
4
+ * A `Date` is its ISO string, a `Set` an array and a `Map` a record; an object met a second time is left out, which cuts a cycle.
5
+ */
6
+ export declare function toInteractionJson(value: unknown): InteractionJson | undefined;
@@ -0,0 +1,6 @@
1
+ import { Channel } from './interactionChannel';
2
+ /**
3
+ * The half of the channel fetched with the first subscription: delivery, which event is being dispatched (so a change made
4
+ * inside a handler names it unasked), and a press on anything a component styled.
5
+ */
6
+ export default function deliver(channel: Channel): void;
@@ -0,0 +1,224 @@
1
+ /**
2
+ * What `Box.onInteraction` hears, as types. Every value and every detail arrives as plain JSON — the channel copies
3
+ * it on the way out — so an event can go to a log, a beacon or `JSON.stringify` as it stands.
4
+ */
5
+ /** A value as it arrives: what `JSON.parse` could have produced. */
6
+ export type InteractionJson = string | number | boolean | null | InteractionJson[] | {
7
+ [key: string]: InteractionJson;
8
+ };
9
+ type Key = string | number;
10
+ type Open = {
11
+ openChange: boolean;
12
+ };
13
+ type CellRange = {
14
+ startRow: number;
15
+ endRow: number;
16
+ columns: Key[];
17
+ };
18
+ /** Every change a component reports, by its namespace and then its type: the value each one carries. */
19
+ export interface ComponentInteractions {
20
+ accordion: {
21
+ valueChange: string[];
22
+ };
23
+ alertDialog: Open;
24
+ approval: {
25
+ decisionChange: 'approved' | 'rejected';
26
+ };
27
+ calendar: {
28
+ valueChange: InteractionJson;
29
+ pageChange: string;
30
+ viewChange: 'day' | 'month' | 'year';
31
+ };
32
+ collapsible: Open;
33
+ combobox: Open & {
34
+ valueChange: InteractionJson;
35
+ };
36
+ dashboard: {
37
+ layoutCommit: InteractionJson;
38
+ grab: string;
39
+ grabCancel: string;
40
+ };
41
+ datagrid: {
42
+ sortingChange: {
43
+ columnKey: Key;
44
+ direction: 'ASC' | 'DESC';
45
+ };
46
+ globalFilterChange: string;
47
+ columnFiltersChange: {
48
+ [columnKey: string]: InteractionJson;
49
+ };
50
+ paginationChange: {
51
+ page: number;
52
+ pageSize: number;
53
+ };
54
+ selectedRowKeysChange: Key[];
55
+ expandedRowKeysChange: Key[];
56
+ expandedTreeKeysChange: Key[];
57
+ rangeChange: CellRange;
58
+ copy: CellRange;
59
+ cellEditStart: InteractionJson;
60
+ cellEdit: InteractionJson;
61
+ cellEditCancel: InteractionJson;
62
+ cellEditReject: InteractionJson;
63
+ /** How many cells took the pasted value: `details.cells`, the values themselves, are content. */
64
+ paste: number;
65
+ columnPinChange: 'START' | 'END';
66
+ columnVisibilityChange: boolean;
67
+ columnResize: number;
68
+ groupingChange: Key[];
69
+ groupExpandedChange: boolean;
70
+ selectionViewChange: boolean;
71
+ export: 'csv' | 'xlsx';
72
+ retry: undefined;
73
+ recordChange: Key | null;
74
+ sheetChange: string | null;
75
+ selectModeChange: boolean;
76
+ showMore: number;
77
+ };
78
+ dateField: {
79
+ valueChange: string | null;
80
+ };
81
+ datePicker: Open & {
82
+ valueChange: string | null;
83
+ };
84
+ dateRangePicker: {
85
+ valueChange: {
86
+ start: string;
87
+ end: string;
88
+ } | null;
89
+ };
90
+ dialog: Open;
91
+ dropdown: Open & {
92
+ valueChange: InteractionJson[];
93
+ };
94
+ form: {
95
+ submit: string[];
96
+ };
97
+ menu: Open;
98
+ 'menu.checkboxItem': {
99
+ checkedChange: boolean;
100
+ };
101
+ 'menu.item': {
102
+ select: string;
103
+ };
104
+ 'menu.radioGroup': {
105
+ valueChange: string;
106
+ };
107
+ 'menu.sub': Open;
108
+ popover: Open;
109
+ radioGroup: {
110
+ valueChange: string;
111
+ };
112
+ reasoning: Open;
113
+ slider: {
114
+ valueCommit: number | number[];
115
+ };
116
+ sortableList: {
117
+ orderChange: string[];
118
+ orderCommit: string[];
119
+ grab: string;
120
+ grabCancel: string;
121
+ };
122
+ swipeItem: {
123
+ openChange: 'start' | 'end' | null;
124
+ fullSwipe: 'start' | 'end';
125
+ };
126
+ tabs: {
127
+ valueChange: string;
128
+ };
129
+ timeZoneSelect: Open & {
130
+ valueChange: string;
131
+ };
132
+ toaster: {
133
+ show: string;
134
+ update: string;
135
+ dismiss: string;
136
+ action: string;
137
+ };
138
+ toolCall: Open;
139
+ widget: {
140
+ refresh: string;
141
+ };
142
+ }
143
+ export type InteractionComponent = keyof ComponentInteractions;
144
+ export type InteractionType<C extends InteractionComponent> = keyof ComponentInteractions[C] & string;
145
+ /** Which component and which of its changes: what a component names about itself. */
146
+ export type InteractionSource = {
147
+ [C in InteractionComponent]: {
148
+ component: C;
149
+ type: InteractionType<C>;
150
+ };
151
+ }[InteractionComponent];
152
+ interface InteractionBase {
153
+ /** Why, in the component's own words: the `reason` its callback is given. */
154
+ reason?: string;
155
+ /** Whatever else the callback is told (`rowKey`, `columnKey`, `oldValue`…), as plain JSON. */
156
+ details?: {
157
+ [key: string]: InteractionJson;
158
+ };
159
+ /** `'app'` when the code did it — a ref call, a timer, a `toast()` — rather than the person on the page. */
160
+ source: 'user' | 'app';
161
+ /** The DOM event behind it, when there was one: passed by the component, or the one being dispatched. */
162
+ event?: Event;
163
+ /** The element it happened on: the control that handled the event, else the component's own. */
164
+ target?: Element;
165
+ /** `performance.now()`, so it lines up with `event.timeStamp`. */
166
+ timeStamp: number;
167
+ /** `Date.now()`: when it happened, for a log on another machine. */
168
+ time: number;
169
+ /** The page it happened on, so an event delivered after a navigation still names its own; no query or hash without `content`. */
170
+ url: string;
171
+ }
172
+ /** A change a component reports — `kind: 'change'`, so `component` and `type` narrow `value`. */
173
+ export type ComponentInteraction = {
174
+ [C in InteractionComponent]: {
175
+ [T in InteractionType<C>]: InteractionBase & {
176
+ kind: 'change';
177
+ component: C;
178
+ type: T;
179
+ value?: ComponentInteractions[C][T];
180
+ };
181
+ }[InteractionType<C>];
182
+ }[InteractionComponent];
183
+ /**
184
+ * A click or a change on anything a component styled, named by its `data-bk` (`Box.configure({ componentAttribute: true })`).
185
+ * `value` is a checkbox's or a radio's `checked`, never what was typed; `details.interactive` says whether a control was hit.
186
+ */
187
+ export interface DomInteraction extends InteractionBase {
188
+ kind: 'dom';
189
+ component: string;
190
+ type: 'click' | 'change';
191
+ value?: boolean;
192
+ }
193
+ /** A moment the app reported itself with `Box.reportInteraction`. */
194
+ export interface CustomInteraction extends InteractionBase {
195
+ kind: 'custom';
196
+ component: string;
197
+ type: string;
198
+ value?: InteractionJson;
199
+ }
200
+ export type InteractionEvent = ComponentInteraction | DomInteraction | CustomInteraction;
201
+ export type InteractionListener = (event: InteractionEvent) => void;
202
+ /** How much a listener is handed. */
203
+ export interface InteractionOptions {
204
+ /**
205
+ * What people typed, pasted or picked as data (a search, a cell, a date), the text a toast showed them, and the URL's query
206
+ * and hash. Left out unless asked for, because a listener is usually a log on somebody else's machine.
207
+ */
208
+ content?: boolean;
209
+ }
210
+ /** What `Box.reportInteraction` takes: `event` may be React's synthetic one, and anything not JSON is dropped on the way out. */
211
+ export interface InteractionReport {
212
+ component: string;
213
+ type: string;
214
+ reason?: string;
215
+ value?: unknown;
216
+ details?: Record<string, unknown>;
217
+ event?: unknown;
218
+ target?: Element;
219
+ /** Default: `'app'` for the reasons `imperative`, `programmatic` and `timeout`, `'user'` otherwise. */
220
+ source?: 'user' | 'app';
221
+ /** Which of `'value'` and the `details` keys are content: a listener that did not ask for content is not handed them. */
222
+ content?: readonly string[];
223
+ }
224
+ export {};