@box-kite/react 2.2.7 → 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.
- package/BOX_AI_CONTEXT.md +76 -0
- package/BOX_KITE_AI_CONTEXT.md +76 -0
- package/analytics.cjs +1 -0
- package/analytics.d.ts +10 -0
- package/analytics.mjs +121 -0
- package/behavior.cjs +1 -1
- package/behavior.mjs +42 -38
- package/box.cjs +1 -1
- package/box.d.ts +9 -0
- package/box.mjs +17 -16
- package/catalog.cjs +1 -1
- package/catalog.mjs +8 -0
- package/client.cjs +1 -1
- package/client.mjs +120 -120
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +19 -10
- package/components/agent.cjs +1 -1
- package/components/agent.mjs +21 -8
- package/components/calendar.cjs +1 -1
- package/components/calendar.d.ts +3 -1
- package/components/calendar.mjs +154 -142
- package/components/combobox.cjs +1 -1
- package/components/combobox.mjs +184 -174
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +183 -170
- package/components/dataGrid/models/columnModel.d.ts +1 -0
- package/components/dataGrid/models/gridModel.d.ts +18 -0
- package/components/dataGrid/models/rangeModel.d.ts +3 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +987 -896
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +165 -159
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +198 -183
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +38 -33
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.mjs +107 -93
- package/components/form.cjs +1 -1
- package/components/form.mjs +22 -18
- package/components/menu.cjs +1 -1
- package/components/menu.d.ts +2 -0
- package/components/menu.mjs +196 -175
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +7 -7
- package/components/popover.cjs +1 -1
- package/components/popover.mjs +4 -0
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +10 -5
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +84 -83
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +158 -150
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +92 -84
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +10 -5
- package/components/timeZoneSelect.cjs +1 -1
- package/components/timeZoneSelect.mjs +40 -35
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +151 -113
- package/dataGridDateParts.cjs +1 -1
- package/dataGridDateParts.mjs +56 -55
- package/dataGridList.cjs +1 -1
- package/dataGridList.mjs +430 -429
- package/effects.cjs +1 -1
- package/effects.mjs +1 -1
- package/interactionListening.cjs +1 -0
- package/interactionListening.mjs +117 -0
- package/interactions.cjs +1 -0
- package/interactions.mjs +25 -0
- package/layer.cjs +1 -1
- package/layer.mjs +68 -66
- package/package.json +132 -68
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +44 -25
- package/react/interactions/interactions.d.ts +30 -0
- package/react/popover/usePopoverLayer.d.ts +3 -0
- package/react/useStyles.d.ts +8 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +49 -48
- package/reporting.cjs +1 -0
- package/reporting.mjs +51 -0
- package/scrolling.cjs +1 -1
- package/scrolling.mjs +1 -1
- package/supabase/functions/collect/index.d.ts +30 -0
- package/supabase/functions/collect/index.test.d.ts +1 -0
- package/utils/analytics/analytics.d.ts +72 -0
- package/utils/analytics/analyticsIdentity.d.ts +13 -0
- package/utils/interactions/componentAttribute.d.ts +6 -0
- package/utils/interactions/interactionChannel.d.ts +35 -0
- package/utils/interactions/interactionJson.d.ts +6 -0
- package/utils/interactions/interactionListening.d.ts +6 -0
- package/utils/interactions/interactionTypes.d.ts +224 -0
|
@@ -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 {};
|