@jsb188/react 1.1.1 → 1.1.2
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/libs/README.md +75 -0
- package/libs/page-filters.helpers.ts +65 -0
- package/libs/page-filters.ts +223 -0
- package/libs/use-page-filters.ts +147 -0
- package/package.json +24 -19
- package/states/apiData.ts +18 -14
- package/states/appContext.ts +423 -1
- package/states/connected.ts +135 -11
- package/states/index.ts +4 -0
- package/states/keyDown.ts +167 -0
- package/states/keyboardLayer.ts +57 -0
- package/states/modal.ts +403 -239
- package/states/popOver.ts +394 -178
- package/states/reactiveEvents.ts +99 -0
- package/states/uploads.ts +70 -0
- package/types/PopOver.d.ts +636 -88
- package/utils/hooks.ts +406 -234
- package/utils/lazy.ts +183 -0
package/types/PopOver.d.ts
CHANGED
|
@@ -1,120 +1,668 @@
|
|
|
1
|
+
import type { ColorEnum } from '@jsb188/app/types/app.d.ts';
|
|
2
|
+
import type { AriaAttributes, CSSProperties, ElementType, FocusEvent, KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
1
3
|
|
|
2
4
|
/**
|
|
3
5
|
* Utility types
|
|
4
6
|
*/
|
|
5
7
|
|
|
6
8
|
export interface ClientRectValues {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
left: number;
|
|
12
|
+
right: number;
|
|
13
|
+
top: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type POPosition =
|
|
20
|
+
| 'top'
|
|
21
|
+
/** Above the anchor and centered on it, flipping below when the viewport top would clip it; `top` keeps its left-aligned placement. */
|
|
22
|
+
| 'top_center'
|
|
23
|
+
| 'left'
|
|
24
|
+
| 'right'
|
|
25
|
+
| 'bottom'
|
|
26
|
+
| 'bottom_left'
|
|
27
|
+
| 'bottom_right';
|
|
28
|
+
export type AbsolutePosition = Pick<CSSProperties, 'left' | 'right' | 'top' | 'bottom'>;
|
|
29
|
+
|
|
30
|
+
export type POItemValue = string | number | boolean | null;
|
|
31
|
+
export type POPrimitiveStateValue = POItemValue | undefined;
|
|
32
|
+
export interface POStateRecord {
|
|
33
|
+
[key: string]: POStateValue;
|
|
34
|
+
}
|
|
35
|
+
export type POStateValue = POPrimitiveStateValue | Date | readonly POStateValue[] | POStateRecord | object;
|
|
36
|
+
export type POFormState = Record<string, POStateValue>;
|
|
37
|
+
export type POClassNameValue = string | false | null | undefined;
|
|
38
|
+
export type POListItemClickFn = {
|
|
39
|
+
bivarianceHack(name: string | null, value?: POStateValue, notEventBased?: boolean, dismissOnClick?: boolean): void;
|
|
40
|
+
}['bivarianceHack'];
|
|
41
|
+
|
|
42
|
+
export interface POLabelsAndValuesInputObj {
|
|
43
|
+
label: string;
|
|
44
|
+
value: string;
|
|
45
|
+
quantity?: number;
|
|
46
|
+
unit?: string;
|
|
15
47
|
}
|
|
16
48
|
|
|
17
49
|
/**
|
|
18
|
-
* Pop over
|
|
50
|
+
* Pop over list items
|
|
19
51
|
*/
|
|
20
52
|
|
|
21
|
-
export interface
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
export interface POItemBase {
|
|
54
|
+
__type: string;
|
|
55
|
+
id?: string;
|
|
56
|
+
hidden?: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface POListSubtitleObj extends POItemBase {
|
|
60
|
+
__type: 'LIST_SUBTITLE';
|
|
61
|
+
text: string;
|
|
62
|
+
textClassName?: string;
|
|
63
|
+
colorIndicator?: ColorEnum;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type PONListSubtitleObj = POListSubtitleObj;
|
|
67
|
+
|
|
68
|
+
export interface POListBannerActionObj {
|
|
69
|
+
name: string;
|
|
70
|
+
text: string;
|
|
71
|
+
value?: POStateValue;
|
|
72
|
+
designClassName?: POClassNameValue;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
loading?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface POListBannerItemObj extends POItemBase {
|
|
78
|
+
__type: 'LIST_BANNER_ITEM';
|
|
79
|
+
title: string;
|
|
80
|
+
subtitle: string;
|
|
81
|
+
description: string;
|
|
82
|
+
actions?: POListBannerActionObj[];
|
|
83
|
+
bannerClassName?: POClassNameValue;
|
|
84
|
+
bannerDesignClassName?: POClassNameValue;
|
|
85
|
+
titleDotColorClassName?: POClassNameValue;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface POListBreakObj extends POItemBase {
|
|
89
|
+
__type: 'BREAK';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface POActionListItemBase extends POItemBase {
|
|
93
|
+
ariaControls?: string;
|
|
94
|
+
ariaExpanded?: boolean;
|
|
95
|
+
ariaHasPopup?: AriaAttributes['aria-haspopup'];
|
|
96
|
+
name?: string;
|
|
97
|
+
value?: POStateValue;
|
|
98
|
+
text: string;
|
|
99
|
+
secondaryText?: string | null;
|
|
100
|
+
description?: string | null;
|
|
101
|
+
className?: POClassNameValue;
|
|
102
|
+
textClassName?: POClassNameValue;
|
|
103
|
+
colorIndicator?: ColorEnum;
|
|
104
|
+
/** CSS color rendered as an icon-sized square after any leading icon. */
|
|
105
|
+
colorValue?: string | null;
|
|
106
|
+
avatarDisplayName?: string;
|
|
107
|
+
photoUri?: string | null;
|
|
108
|
+
LinkComponent?: ElementType;
|
|
109
|
+
allowDisabledOnClick?: boolean;
|
|
110
|
+
iconName?: string;
|
|
111
|
+
rightIconName?: string;
|
|
112
|
+
rightIconClassName?: POClassNameValue;
|
|
113
|
+
rightText?: ReactNode;
|
|
114
|
+
selected?: boolean;
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
loading?: boolean;
|
|
117
|
+
preserveStyleWhenDisabled?: boolean;
|
|
118
|
+
onClick?: POListItemClickFn;
|
|
119
|
+
preset?: 'delete' | 'delete_hover' | 'small' | 'default';
|
|
120
|
+
to?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface POListItemObj extends POActionListItemBase {
|
|
124
|
+
__type: 'LIST_ITEM' | 'LIST_ITEM_COPY';
|
|
125
|
+
/** Defaults to mt_4; an empty string removes the description's added spacing. */
|
|
126
|
+
descriptionSpacingClassName?: string;
|
|
127
|
+
truncateText?: boolean;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface POCheckListItemObj extends Omit<POActionListItemBase, 'onClick' | 'value'> {
|
|
131
|
+
__type: 'CHECK_LIST_ITEM' | 'SINGLE_OPTION_LIST_ITEM';
|
|
132
|
+
value?: POItemValue;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface POModalVariables {
|
|
136
|
+
name: string;
|
|
137
|
+
preset?: string;
|
|
138
|
+
color?: ColorEnum | null;
|
|
139
|
+
props?: Record<string, POStateValue>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface POModalItemObj extends Omit<POActionListItemBase, 'onClick'> {
|
|
143
|
+
__type: 'LIST_ITEM_POPUP' | 'LIST_ITEM_MODAL';
|
|
144
|
+
variables: POModalVariables;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type POListColorValue = ColorEnum | (string & {}) | null;
|
|
148
|
+
|
|
149
|
+
export interface POLayoutDesignerObj extends POItemBase {
|
|
150
|
+
__type: 'LAYOUT_DESIGNER';
|
|
151
|
+
canvasColor: string;
|
|
152
|
+
contentColor: string;
|
|
153
|
+
contentWidth: number;
|
|
154
|
+
contentWidthMax: number;
|
|
155
|
+
contentWidthMin: number;
|
|
156
|
+
disabled: boolean;
|
|
157
|
+
fontFamily: string;
|
|
158
|
+
linkColor: string;
|
|
159
|
+
onChangeCanvasColor: (value: string) => void;
|
|
160
|
+
onChangeContentColor: (value: string) => void;
|
|
161
|
+
onChangeContentWidth: (value: number) => void;
|
|
162
|
+
onChangePadding: (value: string) => void;
|
|
163
|
+
padding: string;
|
|
164
|
+
textColor: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type POListBorderStyleValue =
|
|
168
|
+
| 'outlineAllCells'
|
|
169
|
+
| 'outlineInnerCells'
|
|
170
|
+
| 'outlineInnerVertical'
|
|
171
|
+
| 'outlineInnerHorizontal'
|
|
172
|
+
| 'outlineAllSides'
|
|
173
|
+
| 'outlineLeft'
|
|
174
|
+
| 'outlineTop'
|
|
175
|
+
| 'outlineRight'
|
|
176
|
+
| 'outlineBottom'
|
|
177
|
+
| 'outlineNone';
|
|
178
|
+
|
|
179
|
+
export interface POListItemPickerOptionObj {
|
|
180
|
+
ariaLabel: string;
|
|
181
|
+
iconName: string;
|
|
182
|
+
selectedIconName: string;
|
|
183
|
+
className?: string;
|
|
184
|
+
value: POStateValue;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface POListItemPickerObj extends Omit<POActionListItemBase, '__type' | 'text' | 'value' | 'iconName' | 'onClick'> {
|
|
188
|
+
__type: 'LIST_ITEM_PICKER';
|
|
189
|
+
label: string;
|
|
190
|
+
options: POListItemPickerOptionObj[];
|
|
191
|
+
selectedValue?: POStateValue;
|
|
192
|
+
allowEdit?: boolean;
|
|
193
|
+
/** Return false or reject to keep the picker open without committing its selection. */
|
|
194
|
+
onSelect: (value: POStateValue) => boolean | undefined | Promise<boolean | undefined>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface POListColorsObj extends POItemBase {
|
|
198
|
+
__type: 'LIST_COLORS';
|
|
199
|
+
name?: string;
|
|
200
|
+
iconName?: string;
|
|
201
|
+
label?: ReactNode;
|
|
202
|
+
onClickCustomize?: POListItemClickFn;
|
|
203
|
+
colors?: readonly POListColorValue[];
|
|
204
|
+
colorsPerRow?: number;
|
|
205
|
+
hideReset?: boolean;
|
|
206
|
+
selectedValue?: POListColorValue | null;
|
|
207
|
+
className?: POClassNameValue;
|
|
208
|
+
disabled?: boolean;
|
|
209
|
+
stretchToFit?: boolean;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface POListBoxItemOptionObj {
|
|
213
|
+
className?: POClassNameValue;
|
|
214
|
+
iconName?: string;
|
|
215
|
+
text: ReactNode;
|
|
216
|
+
value: POItemValue;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface POListBoxItemsObj extends POItemBase {
|
|
220
|
+
__type: 'LIST_BOX_ITEMS';
|
|
221
|
+
boxesPerRow: number;
|
|
222
|
+
name?: string;
|
|
223
|
+
options: readonly POListBoxItemOptionObj[];
|
|
224
|
+
selectedClassName?: POClassNameValue;
|
|
225
|
+
selectedValue?: POItemValue;
|
|
226
|
+
unselectedClassName?: POClassNameValue;
|
|
227
|
+
className?: POClassNameValue;
|
|
228
|
+
disabled?: boolean;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface POListBorderStylesObj extends POItemBase {
|
|
232
|
+
__type: 'LIST_BORDER_STYLES';
|
|
233
|
+
name?: string;
|
|
234
|
+
label?: ReactNode;
|
|
235
|
+
onClickCustomize?: POListItemClickFn;
|
|
236
|
+
selectedValue?: POListBorderStyleValue | null;
|
|
237
|
+
className?: POClassNameValue;
|
|
238
|
+
disabled?: boolean;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface POListTextFormatControlsObj extends POItemBase {
|
|
242
|
+
__type: 'LIST_TEXT_FORMAT_CONTROLS';
|
|
243
|
+
name?: string;
|
|
244
|
+
markdownName?: string;
|
|
245
|
+
textStyleNames?: {
|
|
246
|
+
bold?: string;
|
|
247
|
+
italic?: string;
|
|
248
|
+
underline?: string;
|
|
249
|
+
strikethrough?: string;
|
|
250
|
+
};
|
|
251
|
+
selectedTextStyles?: {
|
|
252
|
+
bold?: boolean | null;
|
|
253
|
+
italic?: boolean | null;
|
|
254
|
+
underline?: boolean | null;
|
|
255
|
+
strikethrough?: boolean | null;
|
|
256
|
+
};
|
|
257
|
+
fontSizeLabel?: ReactNode;
|
|
258
|
+
textStyleLabel?: ReactNode;
|
|
259
|
+
textStyleButtonLabels?: {
|
|
260
|
+
bold: ReactNode;
|
|
261
|
+
italic: ReactNode;
|
|
262
|
+
markdown?: ReactNode;
|
|
263
|
+
underline: ReactNode;
|
|
264
|
+
strikethrough: ReactNode;
|
|
265
|
+
};
|
|
266
|
+
selectedFontSize?: number | null;
|
|
267
|
+
disableMarkdown?: boolean | null;
|
|
268
|
+
minFontSize?: number;
|
|
269
|
+
maxFontSize?: number;
|
|
270
|
+
className?: POClassNameValue;
|
|
271
|
+
disabled?: boolean;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface POListSubmenuObj
|
|
275
|
+
extends Pick<
|
|
276
|
+
POListVariables,
|
|
277
|
+
| 'notReady'
|
|
278
|
+
| 'designClassName'
|
|
279
|
+
| 'fontSizeClassName'
|
|
280
|
+
| 'shadowClassName'
|
|
281
|
+
| 'className'
|
|
282
|
+
| 'savingValue'
|
|
283
|
+
| 'addFooterButton'
|
|
284
|
+
| 'footerButtonText'
|
|
285
|
+
> {
|
|
286
|
+
initialState?: POFormState | null;
|
|
287
|
+
/** `initial` seeds once per mounted submenu; `controlled` adopts later `initialState` changes. */
|
|
288
|
+
stateMode?: 'initial' | 'controlled';
|
|
289
|
+
options: POListIfaceItem[];
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface POListSubmenuItemObj extends Omit<POActionListItemBase, '__type' | 'onClick'> {
|
|
293
|
+
__type: 'LIST_SUBMENU_ITEM';
|
|
294
|
+
/** Stable identity used to reconcile this submenu while its definition changes. */
|
|
295
|
+
id: string;
|
|
296
|
+
submenu: POListSubmenuObj;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface PONavAvatarItemObj extends POItemBase {
|
|
300
|
+
__type: 'AVATAR_ITEM';
|
|
301
|
+
name?: string;
|
|
302
|
+
value?: POStateValue;
|
|
303
|
+
text: string;
|
|
304
|
+
label: string;
|
|
305
|
+
avatarDisplayName?: string;
|
|
306
|
+
photoUri?: string | null;
|
|
307
|
+
className?: POClassNameValue;
|
|
308
|
+
LinkComponent?: ElementType;
|
|
309
|
+
allowDisabledOnClick?: boolean;
|
|
310
|
+
rightIconName?: string;
|
|
311
|
+
square?: boolean;
|
|
312
|
+
disabled?: boolean;
|
|
313
|
+
loading?: boolean;
|
|
314
|
+
to?: string;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export interface PODateItemBase extends POItemBase {
|
|
318
|
+
name: string;
|
|
319
|
+
minDate?: Date;
|
|
320
|
+
maxDate?: Date;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface PODatePickerObj extends PODateItemBase {
|
|
324
|
+
__type: 'DATE_PICKER';
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface POTimePickerObj extends POItemBase {
|
|
328
|
+
__type: 'TIME_PICKER';
|
|
329
|
+
name: string;
|
|
330
|
+
minTime?: string;
|
|
331
|
+
maxTime?: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface PODateTimePickerObj extends PODateItemBase {
|
|
335
|
+
__type: 'DATE_TIME_PICKER';
|
|
336
|
+
disabled?: boolean;
|
|
337
|
+
defaultHour?: number;
|
|
338
|
+
defaultMinute?: number;
|
|
339
|
+
defaultPeriod?: 'AM' | 'PM';
|
|
340
|
+
minTime?: string;
|
|
341
|
+
maxTime?: string;
|
|
342
|
+
submitText?: ReactNode;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface PODateRangeObj extends PODateItemBase {
|
|
346
|
+
__type: 'DATE_RANGE';
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export interface POInputObj extends POItemBase {
|
|
350
|
+
__type: 'INPUT';
|
|
351
|
+
name: string;
|
|
352
|
+
preset?: 'tiny';
|
|
353
|
+
type?: 'text' | 'search' | 'email' | 'url' | 'tel' | 'password';
|
|
354
|
+
label?: string;
|
|
355
|
+
ariaLabel?: string;
|
|
356
|
+
placeholder?: string;
|
|
357
|
+
autoFocus?: boolean;
|
|
358
|
+
disabled?: boolean;
|
|
359
|
+
maxLength?: number;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export interface POTextObj extends POItemBase {
|
|
363
|
+
__type: 'TEXT';
|
|
364
|
+
fontClassName?: string;
|
|
365
|
+
text: string;
|
|
366
|
+
className?: POClassNameValue;
|
|
367
|
+
designClassName?: POClassNameValue;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export type POListIfaceItem =
|
|
371
|
+
| PONavAvatarItemObj
|
|
372
|
+
| POListSubtitleObj
|
|
373
|
+
| POListBannerItemObj
|
|
374
|
+
| POListBreakObj
|
|
375
|
+
| POListItemObj
|
|
376
|
+
| POCheckListItemObj
|
|
377
|
+
| POListItemPickerObj
|
|
378
|
+
| POLayoutDesignerObj
|
|
379
|
+
| POListColorsObj
|
|
380
|
+
| POListBoxItemsObj
|
|
381
|
+
| POListBorderStylesObj
|
|
382
|
+
| POListTextFormatControlsObj
|
|
383
|
+
| POListSubmenuItemObj
|
|
384
|
+
| POModalItemObj
|
|
385
|
+
| PODatePickerObj
|
|
386
|
+
| POTimePickerObj
|
|
387
|
+
| PODateTimePickerObj
|
|
388
|
+
| PODateRangeObj
|
|
389
|
+
| POTextObj
|
|
390
|
+
| POInputObj;
|
|
391
|
+
|
|
392
|
+
export type POCheckListIfaceItem = POListSubtitleObj | POListBreakObj | POCheckListItemObj;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Pop over ifaces
|
|
396
|
+
*/
|
|
397
|
+
|
|
398
|
+
export interface POListVariables {
|
|
399
|
+
fontSizeClassName?: string;
|
|
400
|
+
notReady?: boolean;
|
|
401
|
+
designClassName?: string;
|
|
402
|
+
shadowClassName?: string;
|
|
403
|
+
className?: string;
|
|
404
|
+
savingValue?: POStateValue;
|
|
405
|
+
iconName?: string;
|
|
406
|
+
title?: string;
|
|
407
|
+
description?: string;
|
|
408
|
+
displayName?: string;
|
|
409
|
+
photoUri?: string | null;
|
|
410
|
+
initialState?: POFormState | POStateValue[] | POStateValue;
|
|
411
|
+
/** `initial` seeds once per popover instance; `controlled` adopts later `initialState` changes. */
|
|
412
|
+
stateMode?: 'initial' | 'controlled';
|
|
413
|
+
options: POListIfaceItem[];
|
|
414
|
+
addFooterButton?: boolean;
|
|
415
|
+
footerButtonText?: string;
|
|
416
|
+
LinkComponent?: ElementType;
|
|
417
|
+
remainingHeight?: number;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export interface POListIface {
|
|
421
|
+
name: 'PO_LIST';
|
|
422
|
+
variables: POListVariables;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export interface POCheckListVariables extends Omit<POListVariables, 'options' | 'initialState'> {
|
|
426
|
+
options: POCheckListIfaceItem[];
|
|
427
|
+
initialState?: POItemValue[];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export interface POCheckListIface {
|
|
431
|
+
name: 'PO_CHECK_LIST';
|
|
432
|
+
variables: POCheckListVariables;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface POImageVariables {
|
|
436
|
+
imageUri: string;
|
|
437
|
+
alt?: string;
|
|
438
|
+
rect?: ClientRectValues;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export interface POImageIface {
|
|
442
|
+
name: 'PO_VIEW_IMAGE';
|
|
443
|
+
variables: POImageVariables;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface POLabelsAndValuesVariables {
|
|
447
|
+
name: string;
|
|
448
|
+
designClassName?: string;
|
|
449
|
+
shadowClassName?: string;
|
|
450
|
+
className?: string;
|
|
451
|
+
addFooterButton?: boolean;
|
|
452
|
+
footerButtonText?: string;
|
|
453
|
+
gridLayoutStyle?: string;
|
|
454
|
+
notReady?: boolean;
|
|
455
|
+
description?: string;
|
|
456
|
+
flipInputOrder?: boolean;
|
|
457
|
+
forceNumericValues?: boolean;
|
|
458
|
+
includeQuantity?: boolean;
|
|
459
|
+
includeUnit?: boolean;
|
|
460
|
+
labels: string[];
|
|
461
|
+
inputs: POLabelsAndValuesInputObj[];
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export interface POLabelsAndValuesIface {
|
|
465
|
+
name: 'PO_LABELS_AND_VALUES';
|
|
466
|
+
variables: POLabelsAndValuesVariables;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export interface POReactiveEventsIface {
|
|
470
|
+
name: 'PO_REACTIVE_EVENTS';
|
|
471
|
+
variables: Record<string, never>;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export interface POContentIface {
|
|
475
|
+
name: 'PO_CONTENT';
|
|
476
|
+
variables: {
|
|
477
|
+
children: ReactNode;
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export type PopOverIface =
|
|
482
|
+
| POListIface
|
|
483
|
+
| POCheckListIface
|
|
484
|
+
| POImageIface
|
|
485
|
+
| POLabelsAndValuesIface
|
|
486
|
+
| POReactiveEventsIface
|
|
487
|
+
| POContentIface;
|
|
488
|
+
export type PopOverName = PopOverIface['name'];
|
|
489
|
+
export type PopOverVariables = PopOverIface['variables'];
|
|
68
490
|
|
|
69
491
|
/**
|
|
70
492
|
* Pop overs
|
|
71
493
|
*/
|
|
72
494
|
|
|
73
|
-
export
|
|
495
|
+
export interface PopOverPositionProps {
|
|
496
|
+
className?: string;
|
|
497
|
+
position?: POPosition;
|
|
498
|
+
popOverWidth?: number;
|
|
499
|
+
popOverHeight?: number;
|
|
500
|
+
rect?: ClientRectValues;
|
|
501
|
+
offsetX?: number;
|
|
502
|
+
offsetY?: number;
|
|
503
|
+
leftEdgeThreshold?: number;
|
|
504
|
+
rightEdgeThreshold?: number;
|
|
505
|
+
leftEdgePosition?: number;
|
|
506
|
+
rightEdgePosition?: number;
|
|
507
|
+
hover?: boolean;
|
|
508
|
+
}
|
|
74
509
|
|
|
75
|
-
interface
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
leftEdgePosition: number;
|
|
88
|
-
rightEdgePosition: number;
|
|
89
|
-
hover: boolean;
|
|
510
|
+
export interface PopOverCommonProps extends PopOverPositionProps {
|
|
511
|
+
id?: string;
|
|
512
|
+
instanceId?: string;
|
|
513
|
+
closing?: boolean;
|
|
514
|
+
style?: CSSProperties;
|
|
515
|
+
zClassName?: string;
|
|
516
|
+
animationClassName?: string;
|
|
517
|
+
dismissOnExternalScroll?: boolean;
|
|
518
|
+
doNotTrackHover?: boolean;
|
|
519
|
+
doNotFixToBottom?: boolean;
|
|
520
|
+
doNotRemoveOnPageEvents?: boolean;
|
|
521
|
+
scrollAreaDOMId?: string | null;
|
|
90
522
|
}
|
|
91
523
|
|
|
92
|
-
export
|
|
93
|
-
|
|
94
|
-
|
|
524
|
+
export type PopOverProps = PopOverCommonProps & PopOverIface;
|
|
525
|
+
|
|
526
|
+
export interface UpdatePopOverParams {
|
|
527
|
+
iface: PopOverIface;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export interface PopOverEventParams {
|
|
531
|
+
action: 'ITEM' | 'ITEM_AUTO' | 'SUBMIT' | 'MOUNT' | 'UNMOUNT';
|
|
532
|
+
name?: string | null;
|
|
533
|
+
value: POStateValue;
|
|
534
|
+
doNotClosePopOver?: boolean;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export interface PopOverEventObj extends PopOverEventParams {
|
|
538
|
+
id?: string;
|
|
539
|
+
/** Monotonically increasing identity for deduplicating user events. */
|
|
540
|
+
eventId: number;
|
|
541
|
+
/** Identity of the single open session that emitted this event. */
|
|
542
|
+
instanceId: string;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export interface PopOverEventFilter {
|
|
546
|
+
instanceId?: string | null;
|
|
547
|
+
popOverId?: string | null;
|
|
95
548
|
}
|
|
96
549
|
|
|
97
550
|
export type OpenPopOverFn = (data: PopOverProps) => void;
|
|
98
|
-
export type ClosePopOverFn = (
|
|
99
|
-
export type UpdatePopOverFn = (data:
|
|
551
|
+
export type ClosePopOverFn = (dismissIf?: string | { id?: string; name?: string }) => void;
|
|
552
|
+
export type UpdatePopOverFn = (data: UpdatePopOverParams) => void;
|
|
553
|
+
export type PublishPopOverEventFn = (data: PopOverEventParams) => void;
|
|
554
|
+
export type AcknowledgePopOverEventFn = (eventId: number) => void;
|
|
100
555
|
|
|
101
556
|
export interface PopOverHandlerProps {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
557
|
+
openPopOver: OpenPopOverFn;
|
|
558
|
+
closePopOver: ClosePopOverFn;
|
|
559
|
+
updatePopOver: UpdatePopOverFn;
|
|
560
|
+
publishPopOverEvent: PublishPopOverEventFn;
|
|
105
561
|
}
|
|
106
562
|
|
|
107
563
|
export interface PopOverHookProps extends PopOverHandlerProps {
|
|
108
|
-
|
|
564
|
+
acknowledgePopOverEvent: AcknowledgePopOverEventFn;
|
|
565
|
+
pathname?: string;
|
|
566
|
+
popOver: PopOverProps | null;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export interface PopOverButtonProps extends PopOverPositionProps {
|
|
570
|
+
activeClassName?: string;
|
|
571
|
+
animationClassName?: string;
|
|
572
|
+
ariaLabel?: string;
|
|
573
|
+
as?: ElementType;
|
|
574
|
+
children: ReactNode;
|
|
575
|
+
className?: string;
|
|
576
|
+
disabled?: boolean;
|
|
577
|
+
dismissOnExternalScroll?: boolean;
|
|
578
|
+
doNotFixToBottom?: boolean;
|
|
579
|
+
doNotRemoveOnPageEvents?: boolean;
|
|
580
|
+
doNotTrackHover?: boolean;
|
|
581
|
+
domId?: string;
|
|
582
|
+
id?: string;
|
|
583
|
+
iface: PopOverIface;
|
|
584
|
+
/** Build the interface synchronously only when a closed trigger opens. */
|
|
585
|
+
getOpenIface?: () => PopOverIface;
|
|
586
|
+
leftEdgePosition?: number;
|
|
587
|
+
leftEdgeThreshold?: number;
|
|
588
|
+
linkClassName?: string;
|
|
589
|
+
matchTriggerWidth?: boolean;
|
|
590
|
+
notActiveClassName?: string;
|
|
591
|
+
offsetX?: number;
|
|
592
|
+
offsetY?: number;
|
|
593
|
+
onClick?: (e: MouseEvent) => void;
|
|
594
|
+
popOverClassName?: string;
|
|
595
|
+
position?: POPosition;
|
|
596
|
+
rightEdgePosition?: number;
|
|
597
|
+
rightEdgeThreshold?: number;
|
|
598
|
+
scrollAreaDOMId?: string | null;
|
|
599
|
+
/** Update the active popover when its trigger-owned interface meaningfully changes. */
|
|
600
|
+
syncOpenIface?: boolean;
|
|
601
|
+
/** Stable semantic value that changes when an already-open interface should be synchronized. */
|
|
602
|
+
syncOpenIfaceKey?: unknown;
|
|
603
|
+
tabIndex?: number;
|
|
604
|
+
title?: string;
|
|
605
|
+
zClassName?: string;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export interface PopOverMoreButtonProps {
|
|
609
|
+
allowActiveTransform?: boolean;
|
|
610
|
+
id?: string;
|
|
611
|
+
size?: 'xxs' | 'xs' | 'sm';
|
|
612
|
+
disabled?: boolean;
|
|
613
|
+
editOptions: POListIfaceItem[];
|
|
614
|
+
zClassName?: string;
|
|
615
|
+
borderClassName?: string;
|
|
616
|
+
syncOpenIface?: boolean;
|
|
617
|
+
syncOpenIfaceKey?: unknown;
|
|
109
618
|
}
|
|
110
619
|
|
|
111
620
|
/**
|
|
112
621
|
* Tooltips
|
|
113
622
|
*/
|
|
114
623
|
|
|
115
|
-
export interface TooltipProps extends
|
|
116
|
-
|
|
117
|
-
|
|
624
|
+
export interface TooltipProps extends Omit<PopOverPositionProps, 'variables'> {
|
|
625
|
+
id?: string;
|
|
626
|
+
absolute?: AbsolutePosition;
|
|
627
|
+
__html?: string;
|
|
628
|
+
title?: string;
|
|
629
|
+
message?: string;
|
|
630
|
+
tooltipClassName?: string;
|
|
631
|
+
fontClassName?: string;
|
|
632
|
+
leftIconName?: string;
|
|
633
|
+
rightIconName?: string;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
export interface TooltipButtonProps {
|
|
637
|
+
type?: 'button' | 'submit' | 'reset';
|
|
638
|
+
__html?: string;
|
|
639
|
+
absolute?: AbsolutePosition;
|
|
640
|
+
ariaLabel?: string;
|
|
641
|
+
as?: ElementType;
|
|
642
|
+
children: ReactNode;
|
|
643
|
+
className?: string;
|
|
644
|
+
closeWhilePointerDown?: boolean;
|
|
645
|
+
disabled?: boolean;
|
|
646
|
+
fontClassName?: string;
|
|
647
|
+
hideDelayMs?: number;
|
|
648
|
+
leftIconName?: string;
|
|
649
|
+
message?: string;
|
|
650
|
+
messageAfterClick?: string;
|
|
651
|
+
offsetX?: number;
|
|
652
|
+
offsetY?: number;
|
|
653
|
+
onBlur?: (e: FocusEvent<HTMLElement>) => void;
|
|
654
|
+
onClick?: (e: MouseEvent) => void;
|
|
655
|
+
onFocus?: (e: FocusEvent<HTMLElement>) => void;
|
|
656
|
+
onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
|
|
657
|
+
onMouseEnter?: (e: MouseEvent) => void;
|
|
658
|
+
position?: POPosition;
|
|
659
|
+
reopenAfterPointerUp?: boolean;
|
|
660
|
+
rightIconName?: string;
|
|
661
|
+
showDelayMs?: number;
|
|
662
|
+
showTooltipWhenDisabled?: boolean;
|
|
663
|
+
style?: CSSProperties;
|
|
664
|
+
title?: string;
|
|
665
|
+
tooltipClassName?: string;
|
|
118
666
|
}
|
|
119
667
|
|
|
120
668
|
export type OpenTooltipFn = (data: TooltipProps) => void;
|
|
@@ -122,11 +670,11 @@ export type CloseTooltipFn = (removeId: string) => void;
|
|
|
122
670
|
export type UpdateTooltipFn = (data: TooltipProps) => void;
|
|
123
671
|
|
|
124
672
|
export interface TooltipHandlerProps {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
673
|
+
openTooltip: OpenTooltipFn;
|
|
674
|
+
closeTooltip: CloseTooltipFn;
|
|
675
|
+
updateTooltip: UpdateTooltipFn;
|
|
128
676
|
}
|
|
129
677
|
|
|
130
678
|
export interface TooltipHookProps extends TooltipHandlerProps {
|
|
131
|
-
|
|
679
|
+
tooltip: TooltipProps | null;
|
|
132
680
|
}
|