@fluentui/react-tag-picker 9.8.7 → 9.9.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.
- package/CHANGELOG.md +34 -2
- package/dist/index.d.ts +73 -7
- package/lib/TagPicker.js +1 -1
- package/lib/TagPicker.js.map +1 -1
- package/lib/TagPickerButton.js +1 -1
- package/lib/TagPickerButton.js.map +1 -1
- package/lib/TagPickerControl.js +1 -1
- package/lib/TagPickerControl.js.map +1 -1
- package/lib/TagPickerInput.js +1 -1
- package/lib/TagPickerInput.js.map +1 -1
- package/lib/components/TagPicker/TagPicker.types.js +4 -1
- package/lib/components/TagPicker/TagPicker.types.js.map +1 -1
- package/lib/components/TagPicker/index.js +1 -1
- package/lib/components/TagPicker/index.js.map +1 -1
- package/lib/components/TagPicker/useTagPicker.js +34 -21
- package/lib/components/TagPicker/useTagPicker.js.map +1 -1
- package/lib/components/TagPickerButton/TagPickerButton.types.js +1 -1
- package/lib/components/TagPickerButton/TagPickerButton.types.js.map +1 -1
- package/lib/components/TagPickerButton/index.js +1 -1
- package/lib/components/TagPickerButton/index.js.map +1 -1
- package/lib/components/TagPickerButton/useTagPickerButton.js +22 -12
- package/lib/components/TagPickerButton/useTagPickerButton.js.map +1 -1
- package/lib/components/TagPickerButton/useTagPickerButtonStyles.styles.js +0 -2
- package/lib/components/TagPickerButton/useTagPickerButtonStyles.styles.js.map +1 -1
- package/lib/components/TagPickerButton/useTagPickerButtonStyles.styles.raw.js +0 -1
- package/lib/components/TagPickerButton/useTagPickerButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/TagPickerControl/TagPickerControl.types.js +1 -1
- package/lib/components/TagPickerControl/TagPickerControl.types.js.map +1 -1
- package/lib/components/TagPickerControl/index.js +1 -1
- package/lib/components/TagPickerControl/index.js.map +1 -1
- package/lib/components/TagPickerControl/useTagPickerControl.js +22 -11
- package/lib/components/TagPickerControl/useTagPickerControl.js.map +1 -1
- package/lib/components/TagPickerControl/useTagPickerControlStyles.styles.js +0 -2
- package/lib/components/TagPickerControl/useTagPickerControlStyles.styles.js.map +1 -1
- package/lib/components/TagPickerControl/useTagPickerControlStyles.styles.raw.js +0 -1
- package/lib/components/TagPickerControl/useTagPickerControlStyles.styles.raw.js.map +1 -1
- package/lib/components/TagPickerGroup/useTagPickerGroupStyles.styles.js +0 -2
- package/lib/components/TagPickerGroup/useTagPickerGroupStyles.styles.js.map +1 -1
- package/lib/components/TagPickerGroup/useTagPickerGroupStyles.styles.raw.js +0 -1
- package/lib/components/TagPickerGroup/useTagPickerGroupStyles.styles.raw.js.map +1 -1
- package/lib/components/TagPickerInput/TagPickerInput.types.js +1 -1
- package/lib/components/TagPickerInput/TagPickerInput.types.js.map +1 -1
- package/lib/components/TagPickerInput/index.js +1 -1
- package/lib/components/TagPickerInput/index.js.map +1 -1
- package/lib/components/TagPickerInput/useTagPickerInput.js +43 -23
- package/lib/components/TagPickerInput/useTagPickerInput.js.map +1 -1
- package/lib/components/TagPickerInput/useTagPickerInputStyles.styles.js +0 -2
- package/lib/components/TagPickerInput/useTagPickerInputStyles.styles.js.map +1 -1
- package/lib/components/TagPickerInput/useTagPickerInputStyles.styles.raw.js +0 -1
- package/lib/components/TagPickerInput/useTagPickerInputStyles.styles.raw.js.map +1 -1
- package/lib/components/TagPickerList/useTagPickerListStyles.styles.js +0 -2
- package/lib/components/TagPickerList/useTagPickerListStyles.styles.js.map +1 -1
- package/lib/components/TagPickerList/useTagPickerListStyles.styles.raw.js +0 -1
- package/lib/components/TagPickerList/useTagPickerListStyles.styles.raw.js.map +1 -1
- package/lib/components/TagPickerOption/useTagPickerOptionStyles.styles.js +0 -2
- package/lib/components/TagPickerOption/useTagPickerOptionStyles.styles.js.map +1 -1
- package/lib/components/TagPickerOption/useTagPickerOptionStyles.styles.raw.js +0 -1
- package/lib/components/TagPickerOption/useTagPickerOptionStyles.styles.raw.js.map +1 -1
- package/lib/components/TagPickerOptionGroup/useTagPickerOptionGroupStyles.styles.js +0 -2
- package/lib/components/TagPickerOptionGroup/useTagPickerOptionGroupStyles.styles.js.map +1 -1
- package/lib/components/TagPickerOptionGroup/useTagPickerOptionGroupStyles.styles.raw.js +0 -1
- package/lib/components/TagPickerOptionGroup/useTagPickerOptionGroupStyles.styles.raw.js.map +1 -1
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib-commonjs/TagPicker.js +3 -0
- package/lib-commonjs/TagPicker.js.map +1 -1
- package/lib-commonjs/TagPickerButton.js +3 -0
- package/lib-commonjs/TagPickerButton.js.map +1 -1
- package/lib-commonjs/TagPickerControl.js +3 -0
- package/lib-commonjs/TagPickerControl.js.map +1 -1
- package/lib-commonjs/TagPickerInput.js +3 -0
- package/lib-commonjs/TagPickerInput.js.map +1 -1
- package/lib-commonjs/components/TagPicker/TagPicker.types.js +4 -1
- package/lib-commonjs/components/TagPicker/TagPicker.types.js.map +1 -1
- package/lib-commonjs/components/TagPicker/index.js +3 -0
- package/lib-commonjs/components/TagPicker/index.js.map +1 -1
- package/lib-commonjs/components/TagPicker/useTagPicker.js +36 -18
- package/lib-commonjs/components/TagPicker/useTagPicker.js.map +1 -1
- package/lib-commonjs/components/TagPickerButton/TagPickerButton.types.js +1 -1
- package/lib-commonjs/components/TagPickerButton/TagPickerButton.types.js.map +1 -1
- package/lib-commonjs/components/TagPickerButton/index.js +3 -0
- package/lib-commonjs/components/TagPickerButton/index.js.map +1 -1
- package/lib-commonjs/components/TagPickerButton/useTagPickerButton.js +22 -9
- package/lib-commonjs/components/TagPickerButton/useTagPickerButton.js.map +1 -1
- package/lib-commonjs/components/TagPickerButton/useTagPickerButtonStyles.styles.js +0 -1
- package/lib-commonjs/components/TagPickerButton/useTagPickerButtonStyles.styles.js.map +1 -1
- package/lib-commonjs/components/TagPickerButton/useTagPickerButtonStyles.styles.raw.js +0 -1
- package/lib-commonjs/components/TagPickerButton/useTagPickerButtonStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/TagPickerControl/TagPickerControl.types.js +1 -1
- package/lib-commonjs/components/TagPickerControl/TagPickerControl.types.js.map +1 -1
- package/lib-commonjs/components/TagPickerControl/index.js +3 -0
- package/lib-commonjs/components/TagPickerControl/index.js.map +1 -1
- package/lib-commonjs/components/TagPickerControl/useTagPickerControl.js +22 -8
- package/lib-commonjs/components/TagPickerControl/useTagPickerControl.js.map +1 -1
- package/lib-commonjs/components/TagPickerControl/useTagPickerControlStyles.styles.js +0 -1
- package/lib-commonjs/components/TagPickerControl/useTagPickerControlStyles.styles.js.map +1 -1
- package/lib-commonjs/components/TagPickerControl/useTagPickerControlStyles.styles.raw.js +0 -1
- package/lib-commonjs/components/TagPickerControl/useTagPickerControlStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/TagPickerGroup/useTagPickerGroupStyles.styles.js +0 -1
- package/lib-commonjs/components/TagPickerGroup/useTagPickerGroupStyles.styles.js.map +1 -1
- package/lib-commonjs/components/TagPickerGroup/useTagPickerGroupStyles.styles.raw.js +0 -1
- package/lib-commonjs/components/TagPickerGroup/useTagPickerGroupStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/TagPickerInput/TagPickerInput.types.js +1 -1
- package/lib-commonjs/components/TagPickerInput/TagPickerInput.types.js.map +1 -1
- package/lib-commonjs/components/TagPickerInput/index.js +3 -0
- package/lib-commonjs/components/TagPickerInput/index.js.map +1 -1
- package/lib-commonjs/components/TagPickerInput/useTagPickerInput.js +41 -20
- package/lib-commonjs/components/TagPickerInput/useTagPickerInput.js.map +1 -1
- package/lib-commonjs/components/TagPickerInput/useTagPickerInputStyles.styles.js +0 -1
- package/lib-commonjs/components/TagPickerInput/useTagPickerInputStyles.styles.js.map +1 -1
- package/lib-commonjs/components/TagPickerInput/useTagPickerInputStyles.styles.raw.js +0 -1
- package/lib-commonjs/components/TagPickerInput/useTagPickerInputStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/TagPickerList/useTagPickerListStyles.styles.js +0 -1
- package/lib-commonjs/components/TagPickerList/useTagPickerListStyles.styles.js.map +1 -1
- package/lib-commonjs/components/TagPickerList/useTagPickerListStyles.styles.raw.js +0 -1
- package/lib-commonjs/components/TagPickerList/useTagPickerListStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/TagPickerOption/useTagPickerOptionStyles.styles.js +0 -1
- package/lib-commonjs/components/TagPickerOption/useTagPickerOptionStyles.styles.js.map +1 -1
- package/lib-commonjs/components/TagPickerOption/useTagPickerOptionStyles.styles.raw.js +0 -1
- package/lib-commonjs/components/TagPickerOption/useTagPickerOptionStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/TagPickerOptionGroup/useTagPickerOptionGroupStyles.styles.js +0 -1
- package/lib-commonjs/components/TagPickerOptionGroup/useTagPickerOptionGroupStyles.styles.js.map +1 -1
- package/lib-commonjs/components/TagPickerOptionGroup/useTagPickerOptionGroupStyles.styles.raw.js +0 -1
- package/lib-commonjs/components/TagPickerOptionGroup/useTagPickerOptionGroupStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +15 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tag-picker
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 24 Jun 2026 11:03:48 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.9.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tag-picker_v9.9.0)
|
|
8
|
+
|
|
9
|
+
Wed, 24 Jun 2026 11:03:48 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tag-picker_v9.8.8..@fluentui/react-tag-picker_v9.9.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: add base hooks/types for headless composition ([PR #36260](https://github.com/microsoft/fluentui/pull/36260) by viktorgenaev@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.4 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
16
|
+
- Bump @fluentui/react-utilities to v9.26.5 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
17
|
+
- Bump @fluentui/react-portal to v9.8.14 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
18
|
+
- Bump @fluentui/react-tabster to v9.26.16 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
19
|
+
- Bump @fluentui/react-aria to v9.17.13 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
20
|
+
- Bump @fluentui/react-combobox to v9.17.3 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
21
|
+
- Bump @fluentui/react-tags to v9.9.2 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
22
|
+
- Bump @fluentui/react-context-selector to v9.2.18 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
23
|
+
- Bump @fluentui/react-positioning to v9.22.3 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
24
|
+
- Bump @fluentui/react-field to v9.5.3 ([commit](https://github.com/microsoft/fluentui/commit/a4b871ca80c1f16f35ab4229def4fe02be7f30ea) by beachball)
|
|
25
|
+
|
|
26
|
+
### Patches
|
|
27
|
+
|
|
28
|
+
- fix: remove redundant use no memo directives, and add justification to valid ones ([PR #36224](https://github.com/microsoft/fluentui/pull/36224) by martinhochel@microsoft.com)
|
|
29
|
+
|
|
30
|
+
## [9.8.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-tag-picker_v9.8.8)
|
|
31
|
+
|
|
32
|
+
Wed, 27 May 2026 11:18:57 GMT
|
|
33
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tag-picker_v9.8.7..@fluentui/react-tag-picker_v9.8.8)
|
|
34
|
+
|
|
35
|
+
### Patches
|
|
36
|
+
|
|
37
|
+
- Bump @fluentui/react-tags to v9.9.1 ([commit](https://github.com/microsoft/fluentui/commit/5e0f816076baa63d07331287402ed4bd6d8e3c60) by beachball)
|
|
38
|
+
|
|
7
39
|
## [9.8.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-tag-picker_v9.8.7)
|
|
8
40
|
|
|
9
|
-
Tue, 26 May 2026 09:
|
|
41
|
+
Tue, 26 May 2026 09:39:08 GMT
|
|
10
42
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tag-picker_v9.8.6..@fluentui/react-tag-picker_v9.8.7)
|
|
11
43
|
|
|
12
44
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { ComboboxState } from '@fluentui/react-combobox';
|
|
|
6
6
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
7
7
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
8
8
|
import type { ContextSelector } from '@fluentui/react-context-selector';
|
|
9
|
+
import type { DistributiveOmit } from '@fluentui/react-utilities';
|
|
9
10
|
import type { DropdownProps } from '@fluentui/react-combobox';
|
|
10
11
|
import type { EventData } from '@fluentui/react-utilities';
|
|
11
12
|
import type { EventHandler } from '@fluentui/react-utilities';
|
|
@@ -69,12 +70,28 @@ export declare const renderTagPickerOptionGroup: (state: TagPickerOptionGroupSta
|
|
|
69
70
|
*/
|
|
70
71
|
export declare const TagPicker: React_2.FC<TagPickerProps>;
|
|
71
72
|
|
|
73
|
+
/**
|
|
74
|
+
* TagPicker Base Props - omits the floating-ui `positioning` prop; the styled wrapper
|
|
75
|
+
* {@link TagPickerProps} re-introduces it via `usePositioning`.
|
|
76
|
+
*/
|
|
77
|
+
export declare type TagPickerBaseProps = DistributiveOmit<TagPickerProps, 'positioning'>;
|
|
78
|
+
|
|
72
79
|
/**
|
|
73
80
|
* TagPickerButton component -
|
|
74
81
|
* A TagPickerButton is an alternative to TagPickerInput that does not include an input field.
|
|
75
82
|
*/
|
|
76
83
|
export declare const TagPickerButton: ForwardRefComponent<TagPickerButtonProps>;
|
|
77
84
|
|
|
85
|
+
/**
|
|
86
|
+
* TagPickerButton Base Props - omits design-only props
|
|
87
|
+
*/
|
|
88
|
+
export declare type TagPickerButtonBaseProps = DistributiveOmit<TagPickerButtonProps, 'size' | 'appearance'>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* TagPickerButton Base State - omits design-only state
|
|
92
|
+
*/
|
|
93
|
+
export declare type TagPickerButtonBaseState = DistributiveOmit<TagPickerButtonState, 'size'>;
|
|
94
|
+
|
|
78
95
|
export declare const tagPickerButtonClassNames: SlotClassNames<TagPickerButtonSlots>;
|
|
79
96
|
|
|
80
97
|
/**
|
|
@@ -95,6 +112,8 @@ export declare type TagPickerButtonState = ComponentState<TagPickerButtonSlots>
|
|
|
95
112
|
hasSelectedOption: boolean;
|
|
96
113
|
};
|
|
97
114
|
|
|
115
|
+
export declare const TagPickerContextProvider: React_2.Provider<TagPickerContextValue | undefined> & React_2.FC<React_2.ProviderProps<TagPickerContextValue | undefined>>;
|
|
116
|
+
|
|
98
117
|
export declare interface TagPickerContextValue extends Pick<ComboboxBaseState, 'open' | 'clearSelection' | 'getOptionById' | 'selectedOptions' | 'selectOption' | 'setHasFocus' | 'setOpen' | 'setValue' | 'value' | 'appearance' | 'disabled'> {
|
|
99
118
|
triggerRef: React_2.RefObject<HTMLInputElement | HTMLButtonElement | null>;
|
|
100
119
|
popoverRef: React_2.RefObject<HTMLDivElement | null>;
|
|
@@ -118,6 +137,11 @@ export declare type TagPickerContextValues = {
|
|
|
118
137
|
*/
|
|
119
138
|
export declare const TagPickerControl: ForwardRefComponent<TagPickerControlProps>;
|
|
120
139
|
|
|
140
|
+
/**
|
|
141
|
+
* TagPickerControl Base State - omits design-only state derived from picker context.
|
|
142
|
+
*/
|
|
143
|
+
export declare type TagPickerControlBaseState = DistributiveOmit<TagPickerControlState, 'size' | 'appearance'>;
|
|
144
|
+
|
|
121
145
|
export declare const tagPickerControlClassNames: SlotClassNames<TagPickerControlSlots & TagPickerControlInternalSlots>;
|
|
122
146
|
|
|
123
147
|
declare type TagPickerControlCSSProperties = React_2.CSSProperties & {
|
|
@@ -179,6 +203,16 @@ export declare type TagPickerGroupState = TagGroupState & {
|
|
|
179
203
|
*/
|
|
180
204
|
export declare const TagPickerInput: ForwardRefComponent<TagPickerInputProps>;
|
|
181
205
|
|
|
206
|
+
/**
|
|
207
|
+
* TagPickerInput Base Props - omits design-only props
|
|
208
|
+
*/
|
|
209
|
+
export declare type TagPickerInputBaseProps = DistributiveOmit<TagPickerInputProps, 'appearance'>;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* TagPickerInput Base State - omits design-only state
|
|
213
|
+
*/
|
|
214
|
+
export declare type TagPickerInputBaseState = DistributiveOmit<TagPickerInputState, 'size'>;
|
|
215
|
+
|
|
182
216
|
export declare const tagPickerInputClassNames: SlotClassNames<TagPickerInputSlots>;
|
|
183
217
|
|
|
184
218
|
/**
|
|
@@ -353,16 +387,30 @@ export declare type TagPickerState = ComponentState<TagPickerSlots> & Pick<Combo
|
|
|
353
387
|
export declare const useTagPicker_unstable: (props: TagPickerProps) => TagPickerState;
|
|
354
388
|
|
|
355
389
|
/**
|
|
356
|
-
* Create the state required to render
|
|
390
|
+
* Create the base state required to render TagPicker, without floating-ui positioning.
|
|
391
|
+
* @param props - props from this instance of TagPicker (without `positioning`)
|
|
392
|
+
*/
|
|
393
|
+
export declare const useTagPickerBase_unstable: (props: TagPickerBaseProps) => TagPickerState;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Create the state required to render TagPickerButton.
|
|
357
397
|
*
|
|
358
|
-
* The returned state can be modified with hooks such as
|
|
359
|
-
* before being passed to
|
|
398
|
+
* The returned state can be modified with hooks such as useTagPickerButtonStyles_unstable,
|
|
399
|
+
* before being passed to renderTagPickerButton_unstable.
|
|
360
400
|
*
|
|
361
|
-
* @param props - props from this instance of
|
|
362
|
-
* @param ref - reference to root
|
|
401
|
+
* @param props - props from this instance of TagPickerButton
|
|
402
|
+
* @param ref - reference to root HTMLButtonElement of TagPickerButton
|
|
363
403
|
*/
|
|
364
404
|
export declare const useTagPickerButton_unstable: (props: TagPickerButtonProps, ref: React_2.Ref<HTMLButtonElement>) => TagPickerButtonState;
|
|
365
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Create the base state required to render TagPickerButton, without design-only props.
|
|
408
|
+
*
|
|
409
|
+
* @param props - props from this instance of TagPickerButton (without size, appearance)
|
|
410
|
+
* @param ref - reference to root HTMLButtonElement of TagPickerButton
|
|
411
|
+
*/
|
|
412
|
+
export declare const useTagPickerButtonBase_unstable: (props: TagPickerButtonBaseProps, ref: React_2.Ref<HTMLButtonElement>) => TagPickerButtonBaseState;
|
|
413
|
+
|
|
366
414
|
/**
|
|
367
415
|
* Apply styling to the PickerButton slots based on the state
|
|
368
416
|
*/
|
|
@@ -381,6 +429,14 @@ export declare const useTagPickerContext_unstable: <T>(selector: ContextSelector
|
|
|
381
429
|
*/
|
|
382
430
|
export declare const useTagPickerControl_unstable: (props: TagPickerControlProps, ref: React_2.Ref<HTMLDivElement>) => TagPickerControlState;
|
|
383
431
|
|
|
432
|
+
/**
|
|
433
|
+
* Create the base state required to render TagPickerControl, without design-only state.
|
|
434
|
+
*
|
|
435
|
+
* @param props - props from this instance of TagPickerControl
|
|
436
|
+
* @param ref - reference to root HTMLDivElement of TagPickerControl
|
|
437
|
+
*/
|
|
438
|
+
export declare const useTagPickerControlBase_unstable: (props: TagPickerControlProps, ref: React_2.Ref<HTMLDivElement>) => TagPickerControlBaseState;
|
|
439
|
+
|
|
384
440
|
/**
|
|
385
441
|
* Apply styling to the PickerControl slots based on the state
|
|
386
442
|
*/
|
|
@@ -425,9 +481,19 @@ export declare const useTagPickerGroupStyles_unstable: (state: TagPickerGroupSta
|
|
|
425
481
|
* before being passed to renderTagPickerInput_unstable.
|
|
426
482
|
*
|
|
427
483
|
* @param props - props from this instance of TagPickerInput
|
|
428
|
-
* @param ref - reference to root
|
|
484
|
+
* @param ref - reference to root HTMLInputElement of TagPickerInput
|
|
485
|
+
*/
|
|
486
|
+
export declare const useTagPickerInput_unstable: (props: TagPickerInputProps, ref: React_2.Ref<HTMLInputElement>) => TagPickerInputState;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Create the base state required to render TagPickerInput, without design-only props.
|
|
490
|
+
* The Base hook omits Tabster-driven focus management; consumers can re-add it via the
|
|
491
|
+
* styled wrapper {@link useTagPickerInput_unstable} or by composing their own keydown handler.
|
|
492
|
+
*
|
|
493
|
+
* @param props - props from this instance of TagPickerInput (without appearance)
|
|
494
|
+
* @param ref - reference to root HTMLInputElement of TagPickerInput
|
|
429
495
|
*/
|
|
430
|
-
export declare const
|
|
496
|
+
export declare const useTagPickerInputBase_unstable: (props: TagPickerInputBaseProps, ref: React_2.Ref<HTMLInputElement>) => TagPickerInputBaseState;
|
|
431
497
|
|
|
432
498
|
/**
|
|
433
499
|
* Apply styling to the TagPickerInput slots based on the state
|
package/lib/TagPicker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TagPicker, renderTagPicker_unstable, useTagPicker_unstable } from './components/TagPicker/index';
|
|
1
|
+
export { TagPicker, renderTagPicker_unstable, useTagPicker_unstable, useTagPickerBase_unstable } from './components/TagPicker/index';
|
package/lib/TagPicker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TagPicker.ts"],"sourcesContent":["export type {\n TagPickerContextValues,\n TagPickerOnOpenChangeData,\n TagPickerOnOptionSelectData,\n TagPickerProps,\n TagPickerSize,\n TagPickerSlots,\n TagPickerState,\n} from './components/TagPicker/index';\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/TagPicker.ts"],"sourcesContent":["export type {\n TagPickerBaseProps,\n TagPickerContextValues,\n TagPickerOnOpenChangeData,\n TagPickerOnOptionSelectData,\n TagPickerProps,\n TagPickerSize,\n TagPickerSlots,\n TagPickerState,\n} from './components/TagPicker/index';\nexport {\n TagPicker,\n renderTagPicker_unstable,\n useTagPicker_unstable,\n useTagPickerBase_unstable,\n} from './components/TagPicker/index';\n"],"names":["TagPicker","renderTagPicker_unstable","useTagPicker_unstable","useTagPickerBase_unstable"],"mappings":"AAUA,SACEA,SAAS,EACTC,wBAAwB,EACxBC,qBAAqB,EACrBC,yBAAyB,QACpB,+BAA+B"}
|
package/lib/TagPickerButton.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TagPickerButton, renderTagPickerButton_unstable, tagPickerButtonClassNames, useTagPickerButtonStyles_unstable, useTagPickerButton_unstable } from './components/TagPickerButton/index';
|
|
1
|
+
export { TagPickerButton, renderTagPickerButton_unstable, tagPickerButtonClassNames, useTagPickerButtonStyles_unstable, useTagPickerButton_unstable, useTagPickerButtonBase_unstable } from './components/TagPickerButton/index';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TagPickerButton.ts"],"sourcesContent":["export type {\n TagPickerButtonProps,\n TagPickerButtonSlots,\n TagPickerButtonState,\n} from './components/TagPickerButton/index';\nexport {\n TagPickerButton,\n renderTagPickerButton_unstable,\n tagPickerButtonClassNames,\n useTagPickerButtonStyles_unstable,\n useTagPickerButton_unstable,\n} from './components/TagPickerButton/index';\n"],"names":["TagPickerButton","renderTagPickerButton_unstable","tagPickerButtonClassNames","useTagPickerButtonStyles_unstable","useTagPickerButton_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/TagPickerButton.ts"],"sourcesContent":["export type {\n TagPickerButtonBaseProps,\n TagPickerButtonBaseState,\n TagPickerButtonProps,\n TagPickerButtonSlots,\n TagPickerButtonState,\n} from './components/TagPickerButton/index';\nexport {\n TagPickerButton,\n renderTagPickerButton_unstable,\n tagPickerButtonClassNames,\n useTagPickerButtonStyles_unstable,\n useTagPickerButton_unstable,\n useTagPickerButtonBase_unstable,\n} from './components/TagPickerButton/index';\n"],"names":["TagPickerButton","renderTagPickerButton_unstable","tagPickerButtonClassNames","useTagPickerButtonStyles_unstable","useTagPickerButton_unstable","useTagPickerButtonBase_unstable"],"mappings":"AAOA,SACEA,eAAe,EACfC,8BAA8B,EAC9BC,yBAAyB,EACzBC,iCAAiC,EACjCC,2BAA2B,EAC3BC,+BAA+B,QAC1B,qCAAqC"}
|
package/lib/TagPickerControl.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TagPickerControl, iconSizes, renderTagPickerControl_unstable, tagPickerControlAsideWidthToken, tagPickerControlClassNames, useTagPickerControlStyles_unstable, useTagPickerControl_unstable } from './components/TagPickerControl/index';
|
|
1
|
+
export { TagPickerControl, iconSizes, renderTagPickerControl_unstable, tagPickerControlAsideWidthToken, tagPickerControlClassNames, useTagPickerControlStyles_unstable, useTagPickerControl_unstable, useTagPickerControlBase_unstable } from './components/TagPickerControl/index';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TagPickerControl.ts"],"sourcesContent":["export type {\n TagPickerControlCSSProperties,\n TagPickerControlInternalSlots,\n TagPickerControlProps,\n TagPickerControlSlots,\n TagPickerControlState,\n} from './components/TagPickerControl/index';\nexport {\n TagPickerControl,\n iconSizes,\n renderTagPickerControl_unstable,\n tagPickerControlAsideWidthToken,\n tagPickerControlClassNames,\n useTagPickerControlStyles_unstable,\n useTagPickerControl_unstable,\n} from './components/TagPickerControl/index';\n"],"names":["TagPickerControl","iconSizes","renderTagPickerControl_unstable","tagPickerControlAsideWidthToken","tagPickerControlClassNames","useTagPickerControlStyles_unstable","useTagPickerControl_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/TagPickerControl.ts"],"sourcesContent":["export type {\n TagPickerControlBaseState,\n TagPickerControlCSSProperties,\n TagPickerControlInternalSlots,\n TagPickerControlProps,\n TagPickerControlSlots,\n TagPickerControlState,\n} from './components/TagPickerControl/index';\nexport {\n TagPickerControl,\n iconSizes,\n renderTagPickerControl_unstable,\n tagPickerControlAsideWidthToken,\n tagPickerControlClassNames,\n useTagPickerControlStyles_unstable,\n useTagPickerControl_unstable,\n useTagPickerControlBase_unstable,\n} from './components/TagPickerControl/index';\n"],"names":["TagPickerControl","iconSizes","renderTagPickerControl_unstable","tagPickerControlAsideWidthToken","tagPickerControlClassNames","useTagPickerControlStyles_unstable","useTagPickerControl_unstable","useTagPickerControlBase_unstable"],"mappings":"AAQA,SACEA,gBAAgB,EAChBC,SAAS,EACTC,+BAA+B,EAC/BC,+BAA+B,EAC/BC,0BAA0B,EAC1BC,kCAAkC,EAClCC,4BAA4B,EAC5BC,gCAAgC,QAC3B,sCAAsC"}
|
package/lib/TagPickerInput.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TagPickerInput, renderTagPickerInput_unstable, tagPickerInputClassNames, useTagPickerInputStyles_unstable, useTagPickerInput_unstable } from './components/TagPickerInput/index';
|
|
1
|
+
export { TagPickerInput, renderTagPickerInput_unstable, tagPickerInputClassNames, useTagPickerInputStyles_unstable, useTagPickerInput_unstable, useTagPickerInputBase_unstable } from './components/TagPickerInput/index';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TagPickerInput.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/TagPickerInput.ts"],"sourcesContent":["export type {\n TagPickerInputBaseProps,\n TagPickerInputBaseState,\n TagPickerInputProps,\n TagPickerInputSlots,\n TagPickerInputState,\n} from './components/TagPickerInput/index';\nexport {\n TagPickerInput,\n renderTagPickerInput_unstable,\n tagPickerInputClassNames,\n useTagPickerInputStyles_unstable,\n useTagPickerInput_unstable,\n useTagPickerInputBase_unstable,\n} from './components/TagPickerInput/index';\n"],"names":["TagPickerInput","renderTagPickerInput_unstable","tagPickerInputClassNames","useTagPickerInputStyles_unstable","useTagPickerInput_unstable","useTagPickerInputBase_unstable"],"mappings":"AAOA,SACEA,cAAc,EACdC,6BAA6B,EAC7BC,wBAAwB,EACxBC,gCAAgC,EAChCC,0BAA0B,EAC1BC,8BAA8B,QACzB,oCAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagPicker/TagPicker.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/TagPicker/TagPicker.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type {\n ComponentProps,\n ComponentState,\n DistributiveOmit,\n EventData,\n EventHandler,\n JSXElement,\n} from '@fluentui/react-utilities';\nimport type { ComboboxProps, ComboboxState, ListboxContextValue } from '@fluentui/react-combobox';\nimport type { TagPickerContextValue } from '../../contexts/TagPickerContext';\nimport type { ActiveDescendantContextValue } from '@fluentui/react-aria';\n\nexport type TagPickerSlots = {};\n\nexport type TagPickerSize = 'medium' | 'large' | 'extra-large';\n\n/**\n * Event data for the `onOptionSelect` event.\n *\n * * value - The value of the selected option that triggered the event\n * * selectedOptions - The list of selected options\n */\nexport type TagPickerOnOptionSelectData = {\n value: string;\n selectedOptions: string[];\n} & (EventData<'click', React.MouseEvent<HTMLDivElement>> | EventData<'keydown', React.KeyboardEvent<HTMLDivElement>>);\n\nexport type TagPickerOnOpenChangeData = { open: boolean } & (\n | EventData<'click', React.MouseEvent<HTMLDivElement>>\n | EventData<'keydown', React.KeyboardEvent<HTMLDivElement>>\n);\n\n/**\n * Picker Props\n */\nexport type TagPickerProps = ComponentProps<TagPickerSlots> &\n Pick<\n ComboboxProps,\n | 'positioning'\n | 'disabled'\n | 'defaultOpen'\n | 'selectedOptions'\n | 'defaultSelectedOptions'\n | 'open'\n | 'disableAutoFocus'\n > &\n Pick<Partial<TagPickerContextValue>, 'size' | 'appearance'> & {\n /**\n * By default, when a single children is provided, the TagPicker will assume that the children\n * is a popover. By setting this prop to true, the children will be treated as a trigger instead.\n *\n * @default false\n */\n noPopover?: boolean;\n onOpenChange?: EventHandler<TagPickerOnOpenChangeData>;\n onOptionSelect?: EventHandler<TagPickerOnOptionSelectData>;\n\n /**\n * Can contain two children including a trigger and a popover\n */\n children: [JSXElement, JSXElement | undefined | false] | JSXElement;\n /**\n * TagPickers are rendered out of DOM order on `document.body` by default,\n * use this to render the popover in DOM order\n *\n * @default false\n */\n inline?: boolean;\n };\n\n/**\n * State used in rendering Picker\n */\nexport type TagPickerState = ComponentState<TagPickerSlots> &\n Pick<\n ComboboxState,\n | 'open'\n | 'activeDescendantController'\n | 'mountNode'\n | 'onOptionClick'\n | 'registerOption'\n | 'selectedOptions'\n | 'selectOption'\n | 'value'\n | 'setValue'\n | 'setOpen'\n | 'setHasFocus'\n | 'appearance'\n | 'clearSelection'\n | 'getOptionById'\n | 'getOptionsMatchingValue'\n | 'disabled'\n > &\n Pick<\n TagPickerContextValue,\n | 'triggerRef'\n | 'secondaryActionRef'\n | 'popoverId'\n | 'popoverRef'\n | 'targetRef'\n | 'tagPickerGroupRef'\n | 'size'\n | 'noPopover'\n > & {\n trigger: React.ReactNode;\n popover?: React.ReactNode;\n inline: boolean;\n };\n\nexport type TagPickerContextValues = {\n picker: TagPickerContextValue;\n activeDescendant: ActiveDescendantContextValue;\n listbox: ListboxContextValue;\n};\n\n/**\n * TagPicker Base Props - omits the floating-ui `positioning` prop; the styled wrapper\n * {@link TagPickerProps} re-introduces it via `usePositioning`.\n */\nexport type TagPickerBaseProps = DistributiveOmit<TagPickerProps, 'positioning'>;\n"],"names":[],"mappings":"AAoHA;;;CAGC,GACD,WAAiF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagPicker/index.ts"],"sourcesContent":["export { TagPicker } from './TagPicker';\nexport type {\n TagPickerContextValues,\n TagPickerOnOpenChangeData,\n TagPickerOnOptionSelectData,\n TagPickerProps,\n TagPickerSize,\n TagPickerSlots,\n TagPickerState,\n} from './TagPicker.types';\nexport { renderTagPicker_unstable } from './renderTagPicker';\nexport { useTagPicker_unstable } from './useTagPicker';\n"],"names":["TagPicker","renderTagPicker_unstable","useTagPicker_unstable"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"sources":["../src/components/TagPicker/index.ts"],"sourcesContent":["export { TagPicker } from './TagPicker';\nexport type {\n TagPickerBaseProps,\n TagPickerContextValues,\n TagPickerOnOpenChangeData,\n TagPickerOnOptionSelectData,\n TagPickerProps,\n TagPickerSize,\n TagPickerSlots,\n TagPickerState,\n} from './TagPicker.types';\nexport { renderTagPicker_unstable } from './renderTagPicker';\nexport { useTagPicker_unstable, useTagPickerBase_unstable } from './useTagPicker';\n"],"names":["TagPicker","renderTagPicker_unstable","useTagPicker_unstable","useTagPickerBase_unstable"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAWxC,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,qBAAqB,EAAEC,yBAAyB,QAAQ,iBAAiB"}
|
|
@@ -14,29 +14,15 @@ const fallbackPositions = [
|
|
|
14
14
|
'before-top'
|
|
15
15
|
];
|
|
16
16
|
/**
|
|
17
|
-
* Create the state required to render
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
* before being passed to renderPicker_unstable.
|
|
21
|
-
*
|
|
22
|
-
* @param props - props from this instance of Picker
|
|
23
|
-
*/ export const useTagPicker_unstable = (props)=>{
|
|
17
|
+
* Create the base state required to render TagPicker, without floating-ui positioning.
|
|
18
|
+
* @param props - props from this instance of TagPicker (without `positioning`)
|
|
19
|
+
*/ export const useTagPickerBase_unstable = (props)=>{
|
|
24
20
|
const popoverId = useId('picker-listbox');
|
|
25
21
|
const triggerInnerRef = React.useRef(null);
|
|
26
22
|
const secondaryActionRef = React.useRef(null);
|
|
27
23
|
const tagPickerGroupRef = React.useRef(null);
|
|
28
|
-
const
|
|
29
|
-
const {
|
|
30
|
-
position: 'below',
|
|
31
|
-
align: 'start',
|
|
32
|
-
offset: {
|
|
33
|
-
crossAxis: 0,
|
|
34
|
-
mainAxis: 2
|
|
35
|
-
},
|
|
36
|
-
fallbackPositions,
|
|
37
|
-
matchTargetSize: 'width',
|
|
38
|
-
...resolvePositioningShorthand(positioning)
|
|
39
|
-
});
|
|
24
|
+
const passiveTargetRef = React.useRef(null);
|
|
25
|
+
const { size = 'medium', inline = false, noPopover = false, disableAutoFocus } = props;
|
|
40
26
|
const { controller: activeDescendantController, activeParentRef, listboxRef } = useActiveDescendant({
|
|
41
27
|
matchOption: (el)=>el.classList.contains(optionClassNames.root)
|
|
42
28
|
});
|
|
@@ -75,10 +61,10 @@ const fallbackPositions = [
|
|
|
75
61
|
noPopover,
|
|
76
62
|
disabled: comboboxState.disabled,
|
|
77
63
|
triggerRef: useMergedRefs(triggerInnerRef, activeParentRef),
|
|
78
|
-
popoverRef: useMergedRefs(listboxRef
|
|
64
|
+
popoverRef: useMergedRefs(listboxRef),
|
|
79
65
|
secondaryActionRef,
|
|
80
66
|
tagPickerGroupRef,
|
|
81
|
-
targetRef,
|
|
67
|
+
targetRef: passiveTargetRef,
|
|
82
68
|
size,
|
|
83
69
|
inline,
|
|
84
70
|
open: comboboxState.open,
|
|
@@ -114,6 +100,33 @@ const fallbackPositions = [
|
|
|
114
100
|
value: comboboxState.value
|
|
115
101
|
};
|
|
116
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* Create the state required to render Picker.
|
|
105
|
+
*
|
|
106
|
+
* The returned state can be modified with hooks such as usePickerStyles_unstable,
|
|
107
|
+
* before being passed to renderPicker_unstable.
|
|
108
|
+
*
|
|
109
|
+
* @param props - props from this instance of Picker
|
|
110
|
+
*/ export const useTagPicker_unstable = (props)=>{
|
|
111
|
+
const { positioning } = props;
|
|
112
|
+
const { targetRef, containerRef } = usePositioning({
|
|
113
|
+
position: 'below',
|
|
114
|
+
align: 'start',
|
|
115
|
+
offset: {
|
|
116
|
+
crossAxis: 0,
|
|
117
|
+
mainAxis: 2
|
|
118
|
+
},
|
|
119
|
+
fallbackPositions,
|
|
120
|
+
matchTargetSize: 'width',
|
|
121
|
+
...resolvePositioningShorthand(positioning)
|
|
122
|
+
});
|
|
123
|
+
const baseState = useTagPickerBase_unstable(props);
|
|
124
|
+
return {
|
|
125
|
+
...baseState,
|
|
126
|
+
targetRef,
|
|
127
|
+
popoverRef: useMergedRefs(baseState.popoverRef, containerRef)
|
|
128
|
+
};
|
|
129
|
+
};
|
|
117
130
|
const childrenToTriggerAndPopover = (children, noPopover)=>{
|
|
118
131
|
const childrenArray = React.Children.toArray(children);
|
|
119
132
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagPicker/useTagPicker.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { elementContains, useEventCallback, useId, useMergedRefs } from '@fluentui/react-utilities';\nimport type {\n TagPickerOnOpenChangeData,\n TagPickerOnOptionSelectData,\n TagPickerProps,\n TagPickerState,\n} from './TagPicker.types';\nimport { optionClassNames } from '@fluentui/react-combobox';\nimport type { PositioningShorthandValue } from '@fluentui/react-positioning';\nimport { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport { useActiveDescendant } from '@fluentui/react-aria';\nimport { useComboboxBaseState } from '@fluentui/react-combobox';\n\n// Set a default set of fallback positions to try if the dropdown does not fit on screen\nconst fallbackPositions: PositioningShorthandValue[] = ['above', 'after', 'after-top', 'before', 'before-top'];\n\n/**\n * Create the state required to render Picker.\n *\n * The returned state can be modified with hooks such as usePickerStyles_unstable,\n * before being passed to renderPicker_unstable.\n *\n * @param props - props from this instance of Picker\n */\nexport const useTagPicker_unstable = (props: TagPickerProps): TagPickerState => {\n const popoverId = useId('picker-listbox');\n const triggerInnerRef = React.useRef<HTMLInputElement | HTMLButtonElement>(null);\n const secondaryActionRef = React.useRef<HTMLSpanElement>(null);\n const tagPickerGroupRef = React.useRef<HTMLDivElement>(null);\n const { positioning, size = 'medium', inline = false, noPopover = false, disableAutoFocus } = props;\n\n const { targetRef, containerRef } = usePositioning({\n position: 'below' as const,\n align: 'start' as const,\n offset: { crossAxis: 0, mainAxis: 2 },\n fallbackPositions,\n matchTargetSize: 'width' as const,\n ...resolvePositioningShorthand(positioning),\n });\n\n const {\n controller: activeDescendantController,\n activeParentRef,\n listboxRef,\n } = useActiveDescendant<HTMLInputElement, HTMLDivElement>({\n matchOption: el => el.classList.contains(optionClassNames.root),\n });\n\n const comboboxState = useComboboxBaseState({\n ...props,\n onOptionSelect: useEventCallback((event, data) =>\n props.onOptionSelect?.(event, {\n selectedOptions: data.selectedOptions,\n value: data.optionValue,\n type: event.type,\n event,\n } as TagPickerOnOptionSelectData),\n ),\n onOpenChange: useEventCallback((event, data) =>\n props.onOpenChange?.(event, {\n ...data,\n type: event.type,\n event,\n } as TagPickerOnOpenChangeData),\n ),\n activeDescendantController,\n disableAutoFocus,\n editable: true,\n multiselect: true,\n size: 'medium',\n });\n\n const { trigger, popover } = childrenToTriggerAndPopover(props.children, noPopover);\n return {\n activeDescendantController,\n components: {},\n trigger,\n popover: comboboxState.open || comboboxState.hasFocus ? popover : undefined,\n popoverId,\n noPopover,\n disabled: comboboxState.disabled,\n triggerRef: useMergedRefs(triggerInnerRef, activeParentRef),\n popoverRef: useMergedRefs(listboxRef, containerRef),\n secondaryActionRef,\n tagPickerGroupRef,\n targetRef,\n size,\n inline,\n open: comboboxState.open,\n mountNode: comboboxState.mountNode,\n onOptionClick: useEventCallback(event => {\n comboboxState.onOptionClick(event);\n comboboxState.setOpen(event, false);\n }),\n appearance: comboboxState.appearance,\n clearSelection: comboboxState.clearSelection,\n getOptionById: comboboxState.getOptionById,\n getOptionsMatchingValue: comboboxState.getOptionsMatchingValue,\n registerOption: comboboxState.registerOption,\n selectedOptions: comboboxState.selectedOptions,\n selectOption: useEventCallback((event, data) => {\n // if the option is already selected, invoke onOptionSelect callback with current selected values\n // the combobox state would unselect the option, which is not the behavior expected\n if (\n comboboxState.selectedOptions.includes(data.value) &&\n !elementContains(tagPickerGroupRef.current, event.target as Node)\n ) {\n props.onOptionSelect?.(event, {\n selectedOptions: comboboxState.selectedOptions,\n value: data.value,\n type: event.type,\n event,\n } as TagPickerOnOptionSelectData);\n return;\n }\n comboboxState.selectOption(event, data);\n }),\n setHasFocus: comboboxState.setHasFocus,\n setOpen: comboboxState.setOpen,\n setValue: comboboxState.setValue,\n value: comboboxState.value,\n };\n};\n\nconst childrenToTriggerAndPopover = (children: React.ReactNode, noPopover: boolean) => {\n const childrenArray = React.Children.toArray(children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (childrenArray.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('TagPicker must contain at least one child');\n }\n\n if (childrenArray.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('TagPicker must contain at most two children');\n }\n }\n\n if (noPopover) {\n return { trigger: childrenArray[0] };\n }\n\n let trigger: React.ReactElement | undefined = undefined;\n let popover: React.ReactElement | undefined = undefined;\n\n if (childrenArray.length === 2) {\n trigger = childrenArray[0];\n popover = childrenArray[1];\n } else if (childrenArray.length === 1) {\n popover = childrenArray[0];\n }\n\n return { trigger, popover };\n};\n"],"names":["React","elementContains","useEventCallback","useId","useMergedRefs","optionClassNames","resolvePositioningShorthand","usePositioning","useActiveDescendant","useComboboxBaseState","fallbackPositions","useTagPicker_unstable","props","popoverId","triggerInnerRef","useRef","secondaryActionRef","tagPickerGroupRef","positioning","size","inline","noPopover","disableAutoFocus","targetRef","containerRef","position","align","offset","crossAxis","mainAxis","matchTargetSize","controller","activeDescendantController","activeParentRef","listboxRef","matchOption","el","classList","contains","root","comboboxState","onOptionSelect","event","data","selectedOptions","value","optionValue","type","onOpenChange","editable","multiselect","trigger","popover","childrenToTriggerAndPopover","children","components","open","hasFocus","undefined","disabled","triggerRef","popoverRef","mountNode","onOptionClick","setOpen","appearance","clearSelection","getOptionById","getOptionsMatchingValue","registerOption","selectOption","includes","current","target","setHasFocus","setValue","childrenArray","Children","toArray","process","env","NODE_ENV","length","console","warn"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,aAAa,QAAQ,4BAA4B;AAOpG,SAASC,gBAAgB,QAAQ,2BAA2B;AAE5D,SAASC,2BAA2B,EAAEC,cAAc,QAAQ,8BAA8B;AAC1F,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,wFAAwF;AACxF,MAAMC,oBAAiD;IAAC;IAAS;IAAS;IAAa;IAAU;CAAa;AAE9G;;;;;;;CAOC,GACD,OAAO,MAAMC,wBAAwB,CAACC;IACpC,MAAMC,YAAYV,MAAM;IACxB,MAAMW,kBAAkBd,MAAMe,MAAM,CAAuC;IAC3E,MAAMC,qBAAqBhB,MAAMe,MAAM,CAAkB;IACzD,MAAME,oBAAoBjB,MAAMe,MAAM,CAAiB;IACvD,MAAM,EAAEG,WAAW,EAAEC,OAAO,QAAQ,EAAEC,SAAS,KAAK,EAAEC,YAAY,KAAK,EAAEC,gBAAgB,EAAE,GAAGV;IAE9F,MAAM,EAAEW,SAAS,EAAEC,YAAY,EAAE,GAAGjB,eAAe;QACjDkB,UAAU;QACVC,OAAO;QACPC,QAAQ;YAAEC,WAAW;YAAGC,UAAU;QAAE;QACpCnB;QACAoB,iBAAiB;QACjB,GAAGxB,4BAA4BY,YAAY;IAC7C;IAEA,MAAM,EACJa,YAAYC,0BAA0B,EACtCC,eAAe,EACfC,UAAU,EACX,GAAG1B,oBAAsD;QACxD2B,aAAaC,CAAAA,KAAMA,GAAGC,SAAS,CAACC,QAAQ,CAACjC,iBAAiBkC,IA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C5B;IAEA,OAAO;QAAEzB;QAASC;IAAQ;AAC5B"}
|
|
1
|
+
{"version":3,"sources":["../src/components/TagPicker/useTagPicker.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { elementContains, useEventCallback, useId, useMergedRefs } from '@fluentui/react-utilities';\nimport type {\n TagPickerBaseProps,\n TagPickerOnOpenChangeData,\n TagPickerOnOptionSelectData,\n TagPickerProps,\n TagPickerState,\n} from './TagPicker.types';\nimport { optionClassNames } from '@fluentui/react-combobox';\nimport type { PositioningShorthandValue } from '@fluentui/react-positioning';\nimport { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport { useActiveDescendant } from '@fluentui/react-aria';\nimport { useComboboxBaseState } from '@fluentui/react-combobox';\n\n// Set a default set of fallback positions to try if the dropdown does not fit on screen\nconst fallbackPositions: PositioningShorthandValue[] = ['above', 'after', 'after-top', 'before', 'before-top'];\n\n/**\n * Create the base state required to render TagPicker, without floating-ui positioning.\n * @param props - props from this instance of TagPicker (without `positioning`)\n */\nexport const useTagPickerBase_unstable = (props: TagPickerBaseProps): TagPickerState => {\n const popoverId = useId('picker-listbox');\n const triggerInnerRef = React.useRef<HTMLInputElement | HTMLButtonElement>(null);\n const secondaryActionRef = React.useRef<HTMLSpanElement>(null);\n const tagPickerGroupRef = React.useRef<HTMLDivElement>(null);\n const passiveTargetRef = React.useRef<HTMLDivElement>(null);\n const { size = 'medium', inline = false, noPopover = false, disableAutoFocus } = props;\n\n const {\n controller: activeDescendantController,\n activeParentRef,\n listboxRef,\n } = useActiveDescendant<HTMLInputElement, HTMLDivElement>({\n matchOption: el => el.classList.contains(optionClassNames.root),\n });\n\n const comboboxState = useComboboxBaseState({\n ...props,\n onOptionSelect: useEventCallback((event, data) =>\n props.onOptionSelect?.(event, {\n selectedOptions: data.selectedOptions,\n value: data.optionValue,\n type: event.type,\n event,\n } as TagPickerOnOptionSelectData),\n ),\n onOpenChange: useEventCallback((event, data) =>\n props.onOpenChange?.(event, {\n ...data,\n type: event.type,\n event,\n } as TagPickerOnOpenChangeData),\n ),\n activeDescendantController,\n disableAutoFocus,\n editable: true,\n multiselect: true,\n size: 'medium',\n });\n\n const { trigger, popover } = childrenToTriggerAndPopover(props.children, noPopover);\n return {\n activeDescendantController,\n components: {},\n trigger,\n popover: comboboxState.open || comboboxState.hasFocus ? popover : undefined,\n popoverId,\n noPopover,\n disabled: comboboxState.disabled,\n triggerRef: useMergedRefs(triggerInnerRef, activeParentRef),\n popoverRef: useMergedRefs(listboxRef),\n secondaryActionRef,\n tagPickerGroupRef,\n targetRef: passiveTargetRef,\n size,\n inline,\n open: comboboxState.open,\n mountNode: comboboxState.mountNode,\n onOptionClick: useEventCallback(event => {\n comboboxState.onOptionClick(event);\n comboboxState.setOpen(event, false);\n }),\n appearance: comboboxState.appearance,\n clearSelection: comboboxState.clearSelection,\n getOptionById: comboboxState.getOptionById,\n getOptionsMatchingValue: comboboxState.getOptionsMatchingValue,\n registerOption: comboboxState.registerOption,\n selectedOptions: comboboxState.selectedOptions,\n selectOption: useEventCallback((event, data) => {\n // if the option is already selected, invoke onOptionSelect callback with current selected values\n // the combobox state would unselect the option, which is not the behavior expected\n if (\n comboboxState.selectedOptions.includes(data.value) &&\n !elementContains(tagPickerGroupRef.current, event.target as Node)\n ) {\n props.onOptionSelect?.(event, {\n selectedOptions: comboboxState.selectedOptions,\n value: data.value,\n type: event.type,\n event,\n } as TagPickerOnOptionSelectData);\n return;\n }\n comboboxState.selectOption(event, data);\n }),\n setHasFocus: comboboxState.setHasFocus,\n setOpen: comboboxState.setOpen,\n setValue: comboboxState.setValue,\n value: comboboxState.value,\n };\n};\n\n/**\n * Create the state required to render Picker.\n *\n * The returned state can be modified with hooks such as usePickerStyles_unstable,\n * before being passed to renderPicker_unstable.\n *\n * @param props - props from this instance of Picker\n */\nexport const useTagPicker_unstable = (props: TagPickerProps): TagPickerState => {\n const { positioning } = props;\n\n const { targetRef, containerRef } = usePositioning({\n position: 'below' as const,\n align: 'start' as const,\n offset: { crossAxis: 0, mainAxis: 2 },\n fallbackPositions,\n matchTargetSize: 'width' as const,\n ...resolvePositioningShorthand(positioning),\n });\n\n const baseState = useTagPickerBase_unstable(props);\n\n return {\n ...baseState,\n targetRef,\n popoverRef: useMergedRefs(baseState.popoverRef, containerRef),\n };\n};\n\nconst childrenToTriggerAndPopover = (children: React.ReactNode, noPopover: boolean) => {\n const childrenArray = React.Children.toArray(children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (childrenArray.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('TagPicker must contain at least one child');\n }\n\n if (childrenArray.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('TagPicker must contain at most two children');\n }\n }\n\n if (noPopover) {\n return { trigger: childrenArray[0] };\n }\n\n let trigger: React.ReactElement | undefined = undefined;\n let popover: React.ReactElement | undefined = undefined;\n\n if (childrenArray.length === 2) {\n trigger = childrenArray[0];\n popover = childrenArray[1];\n } else if (childrenArray.length === 1) {\n popover = childrenArray[0];\n }\n\n return { trigger, popover };\n};\n"],"names":["React","elementContains","useEventCallback","useId","useMergedRefs","optionClassNames","resolvePositioningShorthand","usePositioning","useActiveDescendant","useComboboxBaseState","fallbackPositions","useTagPickerBase_unstable","props","popoverId","triggerInnerRef","useRef","secondaryActionRef","tagPickerGroupRef","passiveTargetRef","size","inline","noPopover","disableAutoFocus","controller","activeDescendantController","activeParentRef","listboxRef","matchOption","el","classList","contains","root","comboboxState","onOptionSelect","event","data","selectedOptions","value","optionValue","type","onOpenChange","editable","multiselect","trigger","popover","childrenToTriggerAndPopover","children","components","open","hasFocus","undefined","disabled","triggerRef","popoverRef","targetRef","mountNode","onOptionClick","setOpen","appearance","clearSelection","getOptionById","getOptionsMatchingValue","registerOption","selectOption","includes","current","target","setHasFocus","setValue","useTagPicker_unstable","positioning","containerRef","position","align","offset","crossAxis","mainAxis","matchTargetSize","baseState","childrenArray","Children","toArray","process","env","NODE_ENV","length","console","warn"],"mappings":"AAA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AG;QACrCzC,UAAUmC,aAAa,CAAC,EAAE;IAC5B;IAEA,OAAO;QAAEpC;QAASC;IAAQ;AAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagPickerButton/TagPickerButton.types.ts"],"sourcesContent":["import type { DropdownProps } from '@fluentui/react-combobox';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { TagPickerContextValue } from '../../contexts/TagPickerContext';\n\nexport type TagPickerButtonSlots = {\n root: Slot<'button'>;\n};\n\n/**\n * PickerButton Props\n */\nexport type TagPickerButtonProps = ComponentProps<TagPickerButtonSlots> &\n Pick<DropdownProps, 'size' | 'appearance'> & {\n disabled?: boolean;\n };\n\n/**\n * State used in rendering PickerButton\n */\nexport type TagPickerButtonState = ComponentState<TagPickerButtonSlots> &\n Pick<TagPickerContextValue, 'size'> & {\n hasSelectedOption: boolean;\n };\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/TagPickerButton/TagPickerButton.types.ts"],"sourcesContent":["import type { DropdownProps } from '@fluentui/react-combobox';\nimport type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';\nimport type { TagPickerContextValue } from '../../contexts/TagPickerContext';\n\nexport type TagPickerButtonSlots = {\n root: Slot<'button'>;\n};\n\n/**\n * PickerButton Props\n */\nexport type TagPickerButtonProps = ComponentProps<TagPickerButtonSlots> &\n Pick<DropdownProps, 'size' | 'appearance'> & {\n disabled?: boolean;\n };\n\n/**\n * State used in rendering PickerButton\n */\nexport type TagPickerButtonState = ComponentState<TagPickerButtonSlots> &\n Pick<TagPickerContextValue, 'size'> & {\n hasSelectedOption: boolean;\n };\n\n/**\n * TagPickerButton Base Props - omits design-only props\n */\nexport type TagPickerButtonBaseProps = DistributiveOmit<TagPickerButtonProps, 'size' | 'appearance'>;\n\n/**\n * TagPickerButton Base State - omits design-only state\n */\nexport type TagPickerButtonBaseState = DistributiveOmit<TagPickerButtonState, 'size'>;\n"],"names":[],"mappings":"AA6BA;;CAEC,GACD,WAAsF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { TagPickerButton } from './TagPickerButton';
|
|
2
2
|
export { renderTagPickerButton_unstable } from './renderTagPickerButton';
|
|
3
|
-
export { useTagPickerButton_unstable } from './useTagPickerButton';
|
|
3
|
+
export { useTagPickerButton_unstable, useTagPickerButtonBase_unstable } from './useTagPickerButton';
|
|
4
4
|
export { tagPickerButtonClassNames, useTagPickerButtonStyles_unstable } from './useTagPickerButtonStyles.styles';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagPickerButton/index.ts"],"sourcesContent":["export { TagPickerButton } from './TagPickerButton';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/TagPickerButton/index.ts"],"sourcesContent":["export { TagPickerButton } from './TagPickerButton';\nexport type {\n TagPickerButtonBaseProps,\n TagPickerButtonBaseState,\n TagPickerButtonProps,\n TagPickerButtonSlots,\n TagPickerButtonState,\n} from './TagPickerButton.types';\nexport { renderTagPickerButton_unstable } from './renderTagPickerButton';\nexport { useTagPickerButton_unstable, useTagPickerButtonBase_unstable } from './useTagPickerButton';\nexport { tagPickerButtonClassNames, useTagPickerButtonStyles_unstable } from './useTagPickerButtonStyles.styles';\n"],"names":["TagPickerButton","renderTagPickerButton_unstable","useTagPickerButton_unstable","useTagPickerButtonBase_unstable","tagPickerButtonClassNames","useTagPickerButtonStyles_unstable"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AAQpD,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,2BAA2B,EAAEC,+BAA+B,QAAQ,uBAAuB;AACpG,SAASC,yBAAyB,EAAEC,iCAAiC,QAAQ,oCAAoC"}
|
|
@@ -3,14 +3,11 @@ import { useActiveDescendantContext } from '@fluentui/react-aria';
|
|
|
3
3
|
import { useTagPickerContext_unstable } from '../../contexts/TagPickerContext';
|
|
4
4
|
import { useButtonTriggerSlot } from '@fluentui/react-combobox';
|
|
5
5
|
/**
|
|
6
|
-
* Create the state required to render
|
|
6
|
+
* Create the base state required to render TagPickerButton, without design-only props.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
* @param props - props from this instance of PickerButton
|
|
12
|
-
* @param ref - reference to root HTMLDivElement of PickerButton
|
|
13
|
-
*/ export const useTagPickerButton_unstable = (props, ref)=>{
|
|
8
|
+
* @param props - props from this instance of TagPickerButton (without size, appearance)
|
|
9
|
+
* @param ref - reference to root HTMLButtonElement of TagPickerButton
|
|
10
|
+
*/ export const useTagPickerButtonBase_unstable = (props, ref)=>{
|
|
14
11
|
const { controller: activeDescendantController } = useActiveDescendantContext();
|
|
15
12
|
const triggerRef = useTagPickerContext_unstable((ctx)=>ctx.triggerRef);
|
|
16
13
|
const open = useTagPickerContext_unstable((ctx)=>ctx.open);
|
|
@@ -28,7 +25,7 @@ import { useButtonTriggerSlot } from '@fluentui/react-combobox';
|
|
|
28
25
|
defaultProps: {
|
|
29
26
|
type: 'button',
|
|
30
27
|
tabIndex: 0,
|
|
31
|
-
children: value || // @ts-expect-error - FIXME: TS2339: Property 'placeholder' does not exist on type '
|
|
28
|
+
children: value || // @ts-expect-error - FIXME: TS2339: Property 'placeholder' does not exist on type 'TagPickerButtonBaseProps'
|
|
32
29
|
props.placeholder,
|
|
33
30
|
'aria-controls': open ? popoverId : undefined,
|
|
34
31
|
ref
|
|
@@ -42,14 +39,27 @@ import { useButtonTriggerSlot } from '@fluentui/react-combobox';
|
|
|
42
39
|
multiselect: true
|
|
43
40
|
}
|
|
44
41
|
});
|
|
45
|
-
|
|
46
|
-
const state = {
|
|
42
|
+
return {
|
|
47
43
|
components: {
|
|
48
44
|
root: 'button'
|
|
49
45
|
},
|
|
50
46
|
root,
|
|
51
|
-
size,
|
|
52
47
|
hasSelectedOption
|
|
53
48
|
};
|
|
54
|
-
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Create the state required to render TagPickerButton.
|
|
52
|
+
*
|
|
53
|
+
* The returned state can be modified with hooks such as useTagPickerButtonStyles_unstable,
|
|
54
|
+
* before being passed to renderTagPickerButton_unstable.
|
|
55
|
+
*
|
|
56
|
+
* @param props - props from this instance of TagPickerButton
|
|
57
|
+
* @param ref - reference to root HTMLButtonElement of TagPickerButton
|
|
58
|
+
*/ export const useTagPickerButton_unstable = (props, ref)=>{
|
|
59
|
+
const baseState = useTagPickerButtonBase_unstable(props, ref);
|
|
60
|
+
const size = useTagPickerContext_unstable((ctx)=>ctx.size);
|
|
61
|
+
return {
|
|
62
|
+
...baseState,
|
|
63
|
+
size
|
|
64
|
+
};
|
|
55
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagPickerButton/useTagPickerButton.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useActiveDescendantContext } from '@fluentui/react-aria';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/TagPickerButton/useTagPickerButton.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useActiveDescendantContext } from '@fluentui/react-aria';\nimport type {\n TagPickerButtonBaseProps,\n TagPickerButtonBaseState,\n TagPickerButtonProps,\n TagPickerButtonState,\n} from './TagPickerButton.types';\nimport { useTagPickerContext_unstable } from '../../contexts/TagPickerContext';\nimport { useButtonTriggerSlot } from '@fluentui/react-combobox';\n\n/**\n * Create the base state required to render TagPickerButton, without design-only props.\n *\n * @param props - props from this instance of TagPickerButton (without size, appearance)\n * @param ref - reference to root HTMLButtonElement of TagPickerButton\n */\nexport const useTagPickerButtonBase_unstable = (\n props: TagPickerButtonBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): TagPickerButtonBaseState => {\n const { controller: activeDescendantController } = useActiveDescendantContext();\n const triggerRef = useTagPickerContext_unstable(ctx => ctx.triggerRef);\n const open = useTagPickerContext_unstable(ctx => ctx.open);\n const value = useTagPickerContext_unstable(ctx => ctx.value);\n const hasSelectedOption = useTagPickerContext_unstable(ctx => ctx.selectedOptions.length > 0);\n const popoverId = useTagPickerContext_unstable(ctx => ctx.popoverId);\n const getOptionById = useTagPickerContext_unstable(ctx => ctx.getOptionById);\n const selectOption = useTagPickerContext_unstable(ctx => ctx.selectOption);\n const setHasFocus = useTagPickerContext_unstable(ctx => ctx.setHasFocus);\n const setOpen = useTagPickerContext_unstable(ctx => ctx.setOpen);\n\n // casting is required here as triggerRef can either be button or input,\n // but in this case we can assure it's a button\n const root = useButtonTriggerSlot(props, triggerRef as React.RefObject<HTMLButtonElement>, {\n activeDescendantController,\n defaultProps: {\n type: 'button',\n tabIndex: 0,\n children:\n value ||\n // @ts-expect-error - FIXME: TS2339: Property 'placeholder' does not exist on type 'TagPickerButtonBaseProps'\n props.placeholder,\n 'aria-controls': open ? popoverId : undefined,\n ref,\n },\n state: {\n getOptionById,\n open,\n selectOption,\n setHasFocus,\n setOpen,\n multiselect: true,\n },\n });\n\n return {\n components: {\n root: 'button',\n },\n root,\n hasSelectedOption,\n };\n};\n\n/**\n * Create the state required to render TagPickerButton.\n *\n * The returned state can be modified with hooks such as useTagPickerButtonStyles_unstable,\n * before being passed to renderTagPickerButton_unstable.\n *\n * @param props - props from this instance of TagPickerButton\n * @param ref - reference to root HTMLButtonElement of TagPickerButton\n */\nexport const useTagPickerButton_unstable = (\n props: TagPickerButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n): TagPickerButtonState => {\n const baseState = useTagPickerButtonBase_unstable(props, ref);\n const size = useTagPickerContext_unstable(ctx => ctx.size);\n\n return {\n ...baseState,\n size,\n };\n};\n"],"names":["useActiveDescendantContext","useTagPickerContext_unstable","useButtonTriggerSlot","useTagPickerButtonBase_unstable","props","ref","controller","activeDescendantController","triggerRef","ctx","open","value","hasSelectedOption","selectedOptions","length","popoverId","getOptionById","selectOption","setHasFocus","setOpen","root","defaultProps","type","tabIndex","children","placeholder","undefined","state","multiselect","components","useTagPickerButton_unstable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AAgCC,OAAOC;IACzD,MAAM2B,OAAO/B,6BAA6BQ,CAAAA,MAAOA,IAAIuB,IAAI;IAEzD,OAAO;QACL,GAAGD,SAAS;QACZC;IACF;AACF,EAAE"}
|
|
@@ -252,8 +252,6 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
252
252
|
* Apply styling to the PickerButton slots based on the state
|
|
253
253
|
*/
|
|
254
254
|
export const useTagPickerButtonStyles_unstable = state => {
|
|
255
|
-
'use no memo';
|
|
256
|
-
|
|
257
255
|
const styles = useStyles();
|
|
258
256
|
// eslint-disable-next-line react-hooks/immutability
|
|
259
257
|
state.root.className = mergeClasses(tagPickerButtonClassNames.root, styles.button, styles[state.size], state.hasSelectedOption && styles.visuallyHidden, state.root.className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","tagPickerButtonClassNames","root","useStyles","button","Bt984gj","sshi5w","De3pzq","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","B7ck84d","sj55zd","i8kkvl","Bceei9c","Bahqtrf","fsow6f","Bh6795r","Brovlpu","placeholder","medium","Be2twd7","Bhrd7zp","Bg96gwp","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","large","outline","outlineInteractive","Bgoe8wy","Bwzppfd","oetu4i","gg5e9n","B6oc9vd","ak43y8","wmxk5l","B50zh58","underline","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","invalid","tvckwq","gk2u95","hhx65j","Bxowmz0","invalidUnderline","disabled","Bcq6wej","Jcjdmf","sc4o1m","Bosien3","disabledText","hidden","mc9l5x","visuallyHidden","Bh84pgu","Bqenvij","jrapky","Frg6f3","t21cq0","B6of3ja","B74szlk","B68tc82","Bmxbyg5","Bpg54ce","a9b677","qhf8xq","d","p","f","h","a","m","useTagPickerButtonStyles_unstable","state","styles","className","size","hasSelectedOption"],"sources":["useTagPickerButtonStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nexport const tagPickerButtonClassNames = {\n root: 'fui-TagPickerButton'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n button: {\n alignItems: 'center',\n minHeight: '32px',\n backgroundColor: tokens.colorTransparentBackground,\n border: 'none',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground1,\n columnGap: tokens.spacingHorizontalXXS,\n cursor: 'pointer',\n fontFamily: tokens.fontFamilyBase,\n textAlign: 'left',\n flexGrow: 1,\n '&:focus': {\n outlineStyle: 'none'\n }\n },\n placeholder: {\n color: tokens.colorNeutralForeground4\n },\n // size variants\n medium: {\n ...typographyStyles.caption1,\n padding: `3px ${tokens.spacingHorizontalSNudge} 3px ${`calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`}`\n },\n large: {\n ...typographyStyles.body1,\n padding: `5px ${tokens.spacingHorizontalMNudge} 5px ${`calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`}`\n },\n 'extra-large': {\n columnGap: tokens.spacingHorizontalSNudge,\n ...typographyStyles.body2,\n padding: `7px ${tokens.spacingHorizontalM} 7px ${`calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`}`\n },\n // appearance variants\n outline: {\n backgroundColor: tokens.colorNeutralBackground1,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderBottomColor: tokens.colorNeutralStrokeAccessible\n },\n outlineInteractive: {\n '&:hover': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessible\n },\n '&:active': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessible\n }\n },\n underline: {\n backgroundColor: tokens.colorTransparentBackground,\n borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n borderRadius: '0'\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n border: `${tokens.strokeWidthThin} solid transparent`\n },\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid transparent`\n },\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2)\n }\n },\n invalidUnderline: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n borderBottomColor: tokens.colorPaletteRedBorder2\n }\n },\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText')\n }\n },\n disabledText: {\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed'\n },\n hidden: {\n display: 'none'\n },\n visuallyHidden: {\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute'\n }\n});\n/**\n * Apply styling to the PickerButton slots based on the state\n */ export const useTagPickerButtonStyles_unstable = (state)=>{\n
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","tagPickerButtonClassNames","root","useStyles","button","Bt984gj","sshi5w","De3pzq","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","B7ck84d","sj55zd","i8kkvl","Bceei9c","Bahqtrf","fsow6f","Bh6795r","Brovlpu","placeholder","medium","Be2twd7","Bhrd7zp","Bg96gwp","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","large","outline","outlineInteractive","Bgoe8wy","Bwzppfd","oetu4i","gg5e9n","B6oc9vd","ak43y8","wmxk5l","B50zh58","underline","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","invalid","tvckwq","gk2u95","hhx65j","Bxowmz0","invalidUnderline","disabled","Bcq6wej","Jcjdmf","sc4o1m","Bosien3","disabledText","hidden","mc9l5x","visuallyHidden","Bh84pgu","Bqenvij","jrapky","Frg6f3","t21cq0","B6of3ja","B74szlk","B68tc82","Bmxbyg5","Bpg54ce","a9b677","qhf8xq","d","p","f","h","a","m","useTagPickerButtonStyles_unstable","state","styles","className","size","hasSelectedOption"],"sources":["useTagPickerButtonStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nexport const tagPickerButtonClassNames = {\n root: 'fui-TagPickerButton'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n button: {\n alignItems: 'center',\n minHeight: '32px',\n backgroundColor: tokens.colorTransparentBackground,\n border: 'none',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground1,\n columnGap: tokens.spacingHorizontalXXS,\n cursor: 'pointer',\n fontFamily: tokens.fontFamilyBase,\n textAlign: 'left',\n flexGrow: 1,\n '&:focus': {\n outlineStyle: 'none'\n }\n },\n placeholder: {\n color: tokens.colorNeutralForeground4\n },\n // size variants\n medium: {\n ...typographyStyles.caption1,\n padding: `3px ${tokens.spacingHorizontalSNudge} 3px ${`calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`}`\n },\n large: {\n ...typographyStyles.body1,\n padding: `5px ${tokens.spacingHorizontalMNudge} 5px ${`calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`}`\n },\n 'extra-large': {\n columnGap: tokens.spacingHorizontalSNudge,\n ...typographyStyles.body2,\n padding: `7px ${tokens.spacingHorizontalM} 7px ${`calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`}`\n },\n // appearance variants\n outline: {\n backgroundColor: tokens.colorNeutralBackground1,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderBottomColor: tokens.colorNeutralStrokeAccessible\n },\n outlineInteractive: {\n '&:hover': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessible\n },\n '&:active': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessible\n }\n },\n underline: {\n backgroundColor: tokens.colorTransparentBackground,\n borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n borderRadius: '0'\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n border: `${tokens.strokeWidthThin} solid transparent`\n },\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid transparent`\n },\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2)\n }\n },\n invalidUnderline: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n borderBottomColor: tokens.colorPaletteRedBorder2\n }\n },\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText')\n }\n },\n disabledText: {\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed'\n },\n hidden: {\n display: 'none'\n },\n visuallyHidden: {\n clip: 'rect(0px, 0px, 0px, 0px)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0px',\n width: '1px',\n position: 'absolute'\n }\n});\n/**\n * Apply styling to the PickerButton slots based on the state\n */ export const useTagPickerButtonStyles_unstable = (state)=>{\n const styles = useStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(tagPickerButtonClassNames.root, styles.button, styles[state.size], state.hasSelectedOption && styles.visuallyHidden, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE,OAAO,MAAMC,yBAAyB,GAAG;EACrCC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGP,QAAA;EAAAQ,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,WAAA;IAAAP,MAAA;EAAA;EAAAQ,MAAA;IAAAL,OAAA;IAAAM,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,KAAA;IAAAd,OAAA;IAAAM,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAA;IAAAf,MAAA;IAAAE,OAAA;IAAAM,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAE,OAAA;IAAArC,MAAA;IAAAC,OAAA;IAAAC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@@ export const tagPickerButtonClassNames = {
|
|
|
107
107
|
/**
|
|
108
108
|
* Apply styling to the PickerButton slots based on the state
|
|
109
109
|
*/ export const useTagPickerButtonStyles_unstable = (state)=>{
|
|
110
|
-
'use no memo';
|
|
111
110
|
const styles = useStyles();
|
|
112
111
|
// eslint-disable-next-line react-hooks/immutability
|
|
113
112
|
state.root.className = mergeClasses(tagPickerButtonClassNames.root, styles.button, styles[state.size], state.hasSelectedOption && styles.visuallyHidden, state.root.className);
|