@jsb188/react 1.1.10 → 1.1.12

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.
@@ -1,180 +1,393 @@
1
1
  import type { ColorEnum } from '@jsb188/app/types/app.d.ts';
2
- import type { CSSProperties, ElementType } from 'react';
2
+ import type { AriaAttributes, CSSProperties, ElementType, FocusEvent, KeyboardEvent, MouseEvent, ReactNode } from 'react';
3
3
 
4
4
  /**
5
5
  * Utility types
6
6
  */
7
7
 
8
8
  export interface ClientRectValues {
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 = 'top' | 'left' | 'right' | 'bottom' | 'bottom_left' | 'bottom_right';
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';
20
28
  export type AbsolutePosition = Pick<CSSProperties, 'left' | 'right' | 'top' | 'bottom'>;
21
29
 
22
30
  export type POItemValue = string | number | boolean | null;
23
- export type POStateValue = any;
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;
24
36
  export type POFormState = Record<string, POStateValue>;
25
- export type POListItemClickFn = (
26
- name: string | null,
27
- value?: POStateValue,
28
- notEventBased?: boolean,
29
- dismissOnClick?: boolean,
30
- ) => void;
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;
47
+ }
31
48
 
32
49
  /**
33
50
  * Pop over list items
34
51
  */
35
52
 
36
53
  export interface POItemBase {
37
- __type: string;
38
- hidden?: boolean;
54
+ __type: string;
55
+ id?: string;
56
+ hidden?: boolean;
39
57
  }
40
58
 
41
59
  export interface POListSubtitleObj extends POItemBase {
42
- __type: 'LIST_SUBTITLE';
43
- text: string;
44
- textClassName?: string;
45
- colorIndicator?: ColorEnum;
60
+ __type: 'LIST_SUBTITLE';
61
+ text: string;
62
+ textClassName?: string;
63
+ colorIndicator?: ColorEnum;
46
64
  }
47
65
 
48
66
  export type PONListSubtitleObj = POListSubtitleObj;
49
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
+
50
88
  export interface POListBreakObj extends POItemBase {
51
- __type: 'BREAK';
89
+ __type: 'BREAK';
52
90
  }
53
91
 
54
92
  export interface POActionListItemBase extends POItemBase {
55
- name?: string;
56
- value?: POItemValue;
57
- text: string;
58
- description?: string | null;
59
- className?: string;
60
- textClassName?: string;
61
- colorIndicator?: ColorEnum;
62
- avatarDisplayName?: string;
63
- photoUri?: string | null;
64
- LinkComponent?: ElementType;
65
- allowDisabledOnClick?: boolean;
66
- iconName?: string;
67
- rightIconName?: string;
68
- rightIconClassName?: string;
69
- selected?: boolean;
70
- disabled?: boolean;
71
- onClick?: POListItemClickFn;
72
- preset?: 'small' | 'default';
73
- to?: string;
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;
74
121
  }
75
122
 
76
123
  export interface POListItemObj extends POActionListItemBase {
77
- __type: 'LIST_ITEM' | 'LIST_ITEM_COPY';
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;
78
128
  }
79
129
 
80
- export interface POCheckListItemObj extends Omit<POActionListItemBase, 'onClick'> {
81
- __type: 'CHECK_LIST_ITEM' | 'SINGLE_OPTION_LIST_ITEM';
130
+ export interface POCheckListItemObj extends Omit<POActionListItemBase, 'onClick' | 'value'> {
131
+ __type: 'CHECK_LIST_ITEM' | 'SINGLE_OPTION_LIST_ITEM';
132
+ value?: POItemValue;
82
133
  }
83
134
 
84
- export interface POModalItemObj extends Omit<POActionListItemBase, 'onClick'> {
85
- __type: 'LIST_ITEM_POPUP' | 'LIST_ITEM_MODAL';
86
- variables: POStateValue;
87
- useMutationArgs?: POStateValue[];
135
+ export interface POModalVariables {
136
+ name: string;
137
+ preset?: string;
138
+ color?: ColorEnum | null;
139
+ props?: Record<string, POStateValue>;
88
140
  }
89
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
+
90
179
  export interface POListItemPickerOptionObj {
91
- iconName: string;
92
- selectedIconName: string;
93
- className?: string;
94
- value: POItemValue;
180
+ ariaLabel: string;
181
+ iconName: string;
182
+ selectedIconName: string;
183
+ className?: string;
184
+ value: POStateValue;
95
185
  }
96
186
 
97
187
  export interface POListItemPickerObj extends Omit<POActionListItemBase, '__type' | 'text' | 'value' | 'iconName' | 'onClick'> {
98
- __type: 'LIST_ITEM_PICKER';
99
- label: string;
100
- options: POListItemPickerOptionObj[];
101
- selectedValue?: POItemValue;
102
- mutationName: string;
103
- useMutation?: (...args: POStateValue[]) => Record<string, POStateValue>;
104
- useMutationArgs?: POStateValue[];
105
- mutationVariables?: Record<string, POStateValue> | ((value: POStateValue) => Record<string, POStateValue>);
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>;
106
195
  }
107
196
 
108
197
  export interface POListColorsObj extends POItemBase {
109
- __type: 'LIST_COLORS';
110
- name?: string;
111
- colors?: readonly string[];
112
- selectedValue?: string | null;
113
- className?: string;
114
- disabled?: boolean;
115
- }
116
-
117
- export interface POListSubmenuObj extends Pick<POListVariables, 'notReady' | 'designClassName' | 'shadowClassName' | 'className' | 'savingValue'> {
118
- initialState?: POFormState | null;
119
- options: POListIfaceItem[];
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[];
120
290
  }
121
291
 
122
292
  export interface POListSubmenuItemObj extends Omit<POActionListItemBase, '__type' | 'onClick'> {
123
- __type: 'LIST_SUBMENU_ITEM';
124
- submenu: POListSubmenuObj;
293
+ __type: 'LIST_SUBMENU_ITEM';
294
+ /** Stable identity used to reconcile this submenu while its definition changes. */
295
+ id: string;
296
+ submenu: POListSubmenuObj;
125
297
  }
126
298
 
127
299
  export interface PONavAvatarItemObj extends POItemBase {
128
- __type: 'AVATAR_ITEM';
129
- name?: string;
130
- value?: string | null;
131
- text: string;
132
- label: string;
133
- avatarDisplayName?: string;
134
- photoUri?: string | null;
135
- className?: string;
136
- LinkComponent?: ElementType;
137
- allowDisabledOnClick?: boolean;
138
- rightIconName?: string;
139
- square?: boolean;
140
- disabled?: boolean;
141
- to?: string;
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;
142
315
  }
143
316
 
144
317
  export interface PODateItemBase extends POItemBase {
145
- name?: string;
146
- minDate?: Date;
147
- maxDate?: Date;
318
+ name: string;
319
+ minDate?: Date;
320
+ maxDate?: Date;
148
321
  }
149
322
 
150
323
  export interface PODatePickerObj extends PODateItemBase {
151
- __type: 'DATE_PICKER';
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;
152
343
  }
153
344
 
154
345
  export interface PODateRangeObj extends PODateItemBase {
155
- __type: 'DATE_RANGE';
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;
156
360
  }
157
361
 
158
362
  export interface POTextObj extends POItemBase {
159
- __type: 'TEXT';
160
- text: string;
161
- className?: string;
162
- designClassName?: string;
363
+ __type: 'TEXT';
364
+ fontClassName?: string;
365
+ text: string;
366
+ className?: POClassNameValue;
367
+ designClassName?: POClassNameValue;
163
368
  }
164
369
 
165
370
  export type POListIfaceItem =
166
- | PONavAvatarItemObj
167
- | POListSubtitleObj
168
- | POListBreakObj
169
- | POListItemObj
170
- | POCheckListItemObj
171
- | POListItemPickerObj
172
- | POListColorsObj
173
- | POListSubmenuItemObj
174
- | POModalItemObj
175
- | PODatePickerObj
176
- | PODateRangeObj
177
- | POTextObj;
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;
178
391
 
179
392
  export type POCheckListIfaceItem = POListSubtitleObj | POListBreakObj | POCheckListItemObj;
180
393
 
@@ -183,157 +396,273 @@ export type POCheckListIfaceItem = POListSubtitleObj | POListBreakObj | POCheckL
183
396
  */
184
397
 
185
398
  export interface POListVariables {
186
- notReady?: boolean;
187
- designClassName?: string;
188
- shadowClassName?: string;
189
- className?: string;
190
- savingValue?: POItemValue;
191
- iconName?: string;
192
- title?: string;
193
- description?: string;
194
- displayName?: string;
195
- photoUri?: string | null;
196
- initialState?: POFormState | POStateValue[] | POItemValue;
197
- options: POListIfaceItem[];
198
- addFooterButton?: boolean;
199
- footerButtonText?: string;
200
- LinkComponent?: ElementType;
201
- remainingHeight?: number;
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;
202
418
  }
203
419
 
204
420
  export interface POListIface {
205
- name: 'PO_LIST';
206
- variables: POListVariables;
421
+ name: 'PO_LIST';
422
+ variables: POListVariables;
207
423
  }
208
424
 
209
425
  export interface POCheckListVariables extends Omit<POListVariables, 'options' | 'initialState'> {
210
- options: POCheckListIfaceItem[];
211
- initialState?: POItemValue[];
426
+ options: POCheckListIfaceItem[];
427
+ initialState?: POItemValue[];
212
428
  }
213
429
 
214
430
  export interface POCheckListIface {
215
- name: 'PO_CHECK_LIST';
216
- variables: POCheckListVariables;
431
+ name: 'PO_CHECK_LIST';
432
+ variables: POCheckListVariables;
433
+ }
434
+
435
+ export interface POImageVariables {
436
+ imageUri: string;
437
+ alt?: string;
438
+ rect?: ClientRectValues;
217
439
  }
218
440
 
219
441
  export interface POImageIface {
220
- name: 'PO_VIEW_IMAGE';
221
- variables: {
222
- imageUri: string;
223
- alt?: string;
224
- rect?: ClientRectValues;
225
- };
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[];
226
462
  }
227
463
 
228
464
  export interface POLabelsAndValuesIface {
229
- name: 'PO_LABELS_AND_VALUES';
230
- variables: {
231
- name: string;
232
- designClassName?: string;
233
- shadowClassName?: string;
234
- className?: string;
235
- addFooterButton?: boolean;
236
- footerButtonText?: string;
237
- gridLayoutStyle?: string;
238
- notReady?: boolean;
239
- description?: string;
240
- flipInputOrder?: boolean;
241
- forceNumericValues?: boolean;
242
- includeQuantity?: boolean;
243
- includeUnit?: boolean;
244
- labels: string[];
245
- inputs: {
246
- label: string;
247
- value: string;
248
- quantity?: number;
249
- unit?: string;
250
- }[];
251
- };
252
- }
253
-
254
- export type PopOverIface = POListIface | POCheckListIface | POImageIface | POLabelsAndValuesIface;
255
- export type PopOverName = PopOverIface['name'] | (string & {});
256
- export type PopOverVariables = PopOverIface['variables'] | Record<string, POStateValue>;
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'];
257
490
 
258
491
  /**
259
492
  * Pop overs
260
493
  */
261
494
 
262
495
  export interface PopOverPositionProps {
263
- className: string;
264
- position: POPosition;
265
- variables: PopOverVariables;
266
- popOverWidth: number;
267
- popOverHeight: number;
268
- rect: ClientRectValues;
269
- offsetX: number;
270
- offsetY: number;
271
- leftEdgeThreshold: number;
272
- rightEdgeThreshold: number;
273
- leftEdgePosition: number;
274
- rightEdgePosition: number;
275
- hover: boolean;
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;
276
508
  }
277
509
 
278
- export interface PopOverProps extends Partial<PopOverPositionProps> {
279
- id?: string;
280
- name: PopOverName;
281
- closing?: boolean;
282
- zClassName?: string;
283
- animationClassName?: string;
284
- doNotTrackHover?: boolean;
285
- doNotFixToBottom?: boolean;
286
- doNotRemoveOnPageEvents?: boolean;
287
- scrollAreaDOMId?: string | null;
288
- globalState?: PopOverGlobalStateObj | null;
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;
522
+ }
523
+
524
+ export type PopOverProps = PopOverCommonProps & PopOverIface;
525
+
526
+ export interface UpdatePopOverParams {
527
+ iface: PopOverIface;
289
528
  }
290
529
 
291
- export interface UpdatePopOverParams extends Record<string, POStateValue> {
292
- name: PopOverName;
530
+ export interface PopOverEventParams {
531
+ action: 'ITEM' | 'ITEM_AUTO' | 'SUBMIT' | 'MOUNT' | 'UNMOUNT';
532
+ name?: string | null;
533
+ value: POStateValue;
534
+ doNotClosePopOver?: boolean;
293
535
  }
294
536
 
295
- export interface PopOverGlobalStateParams {
296
- action: 'ITEM' | 'ITEM_AUTO' | 'SUBMIT' | 'MOUNT' | 'UNMOUNT';
297
- name?: string | null;
298
- value: POStateValue;
299
- doNotClosePopOver?: boolean;
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;
300
543
  }
301
544
 
302
- export interface PopOverGlobalStateObj extends PopOverGlobalStateParams {
303
- id?: string;
545
+ export interface PopOverEventFilter {
546
+ instanceId?: string | null;
547
+ popOverId?: string | null;
304
548
  }
305
549
 
306
550
  export type OpenPopOverFn = (data: PopOverProps) => void;
307
- export type ClosePopOverFn = (dismissIfName?: string) => void;
551
+ export type ClosePopOverFn = (dismissIf?: string | { id?: string; name?: string }) => void;
308
552
  export type UpdatePopOverFn = (data: UpdatePopOverParams) => void;
309
- export type SetPopOverStateFn = (data: PopOverGlobalStateParams | null) => void;
553
+ export type PublishPopOverEventFn = (data: PopOverEventParams) => void;
554
+ export type AcknowledgePopOverEventFn = (eventId: number) => void;
310
555
 
311
556
  export interface PopOverHandlerProps {
312
- openPopOver: OpenPopOverFn;
313
- closePopOver: ClosePopOverFn;
314
- updatePopOver: UpdatePopOverFn;
315
- setPopOverState: SetPopOverStateFn;
557
+ openPopOver: OpenPopOverFn;
558
+ closePopOver: ClosePopOverFn;
559
+ updatePopOver: UpdatePopOverFn;
560
+ publishPopOverEvent: PublishPopOverEventFn;
316
561
  }
317
562
 
318
563
  export interface PopOverHookProps extends PopOverHandlerProps {
319
- pathname?: string;
320
- popOver: PopOverProps | null;
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;
321
618
  }
322
619
 
323
620
  /**
324
621
  * Tooltips
325
622
  */
326
623
 
327
- export interface TooltipProps extends Partial<Omit<PopOverPositionProps, 'variables'>> {
328
- id?: string;
329
- absolute?: AbsolutePosition;
330
- __html?: string;
331
- title?: string;
332
- message?: string;
333
- tooltipClassName?: string;
334
- fontClassName?: string;
335
- leftIconName?: string;
336
- rightIconName?: string;
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;
337
666
  }
338
667
 
339
668
  export type OpenTooltipFn = (data: TooltipProps) => void;
@@ -341,11 +670,11 @@ export type CloseTooltipFn = (removeId: string) => void;
341
670
  export type UpdateTooltipFn = (data: TooltipProps) => void;
342
671
 
343
672
  export interface TooltipHandlerProps {
344
- openTooltip: OpenTooltipFn;
345
- closeTooltip: CloseTooltipFn;
346
- updateTooltip: UpdateTooltipFn;
673
+ openTooltip: OpenTooltipFn;
674
+ closeTooltip: CloseTooltipFn;
675
+ updateTooltip: UpdateTooltipFn;
347
676
  }
348
677
 
349
678
  export interface TooltipHookProps extends TooltipHandlerProps {
350
- tooltip: TooltipProps | null;
679
+ tooltip: TooltipProps | null;
351
680
  }