@fluentui/react-utilities 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.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 +29 -7
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/lib/compose/assertSlots.js.map +1 -1
- package/lib/compose/constants.js.map +1 -1
- package/lib/compose/deprecated/getSlots.js.map +1 -1
- package/lib/compose/deprecated/getSlotsNext.js.map +1 -1
- package/lib/compose/deprecated/resolveShorthand.js.map +1 -1
- package/lib/compose/getIntrinsicElementProps.js.map +1 -1
- package/lib/compose/getSlotClassNameProp.js.map +1 -1
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- package/lib/compose/isSlot.js.map +1 -1
- package/lib/compose/slot.js.map +1 -1
- package/lib/compose/types.js.map +1 -1
- package/lib/events/index.js.map +1 -1
- package/lib/events/mouseTouchHelpers.js.map +1 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useAnimationFrame.js.map +1 -1
- package/lib/hooks/useApplyScrollbarWidth.js.map +1 -1
- package/lib/hooks/useBrowserTimer.js.map +1 -1
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +2 -2
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useScrollbarWidth.js.map +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/selection/index.js.map +1 -1
- package/lib/selection/types.js.map +1 -1
- package/lib/selection/useSelection.js.map +1 -1
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/ssr/index.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/index.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js.map +1 -1
- package/lib/trigger/types.js.map +1 -1
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/createSetFromIterable.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +1 -1
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getPercentInRange.js +11 -0
- package/lib/utils/getPercentInRange.js.map +1 -0
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/getReactElementRef.js.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isHTMLElement.js +2 -2
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/measureScrollBarWidth.js.map +1 -1
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/priorityQueue.js.map +1 -1
- package/lib/utils/properties.js +2 -2
- package/lib/utils/properties.js.map +1 -1
- package/lib/utils/types.js.map +1 -1
- package/lib/virtualParent/elementContains.js.map +1 -1
- package/lib/virtualParent/getParent.js.map +1 -1
- package/lib/virtualParent/index.js.map +1 -1
- package/lib/virtualParent/isVirtualElement.js.map +1 -1
- package/lib/virtualParent/setVirtualParent.js.map +1 -1
- package/lib/virtualParent/types.js.map +1 -1
- package/lib-commonjs/compose/assertSlots.cjs.map +1 -1
- package/lib-commonjs/compose/constants.cjs +4 -4
- package/lib-commonjs/compose/constants.cjs.map +1 -1
- package/lib-commonjs/compose/deprecated/getSlots.cjs.map +1 -1
- package/lib-commonjs/compose/deprecated/getSlotsNext.cjs.map +1 -1
- package/lib-commonjs/compose/deprecated/resolveShorthand.cjs.map +1 -1
- package/lib-commonjs/compose/getIntrinsicElementProps.cjs.map +1 -1
- package/lib-commonjs/compose/getSlotClassNameProp.cjs.map +1 -1
- package/lib-commonjs/compose/index.cjs +13 -13
- package/lib-commonjs/compose/index.cjs.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.cjs.map +1 -1
- package/lib-commonjs/compose/isSlot.cjs.map +1 -1
- package/lib-commonjs/compose/slot.cjs +4 -4
- package/lib-commonjs/compose/slot.cjs.map +1 -1
- package/lib-commonjs/events/index.cjs +4 -4
- package/lib-commonjs/events/index.cjs.map +1 -1
- package/lib-commonjs/events/mouseTouchHelpers.cjs +4 -4
- package/lib-commonjs/events/mouseTouchHelpers.cjs.map +1 -1
- package/lib-commonjs/hooks/index.cjs +17 -17
- package/lib-commonjs/hooks/index.cjs.map +1 -1
- package/lib-commonjs/hooks/useAnimationFrame.cjs.map +1 -1
- package/lib-commonjs/hooks/useApplyScrollbarWidth.cjs.map +1 -1
- package/lib-commonjs/hooks/useBrowserTimer.cjs.map +1 -1
- package/lib-commonjs/hooks/useControllableState.cjs.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.cjs.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.cjs.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.cjs.map +1 -1
- package/lib-commonjs/hooks/useId.cjs +4 -4
- package/lib-commonjs/hooks/useId.cjs.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.cjs.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.cjs.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.cjs +2 -2
- package/lib-commonjs/hooks/useOnClickOutside.cjs.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.cjs.map +1 -1
- package/lib-commonjs/hooks/usePrevious.cjs.map +1 -1
- package/lib-commonjs/hooks/useScrollbarWidth.cjs.map +1 -1
- package/lib-commonjs/hooks/useTimeout.cjs.map +1 -1
- package/lib-commonjs/index.cjs +59 -56
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/selection/index.cjs.map +1 -1
- package/lib-commonjs/selection/useSelection.cjs.map +1 -1
- package/lib-commonjs/ssr/SSRContext.cjs +6 -6
- package/lib-commonjs/ssr/SSRContext.cjs.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.cjs.map +1 -1
- package/lib-commonjs/ssr/index.cjs +7 -7
- package/lib-commonjs/ssr/index.cjs.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.cjs.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.cjs.map +1 -1
- package/lib-commonjs/trigger/index.cjs +4 -4
- package/lib-commonjs/trigger/index.cjs.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.cjs.map +1 -1
- package/lib-commonjs/utils/clamp.cjs.map +1 -1
- package/lib-commonjs/utils/createSetFromIterable.cjs.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.cjs +4 -4
- package/lib-commonjs/utils/getNativeElementProps.cjs.map +1 -1
- package/lib-commonjs/utils/getPercentInRange.cjs +21 -0
- package/lib-commonjs/utils/getPercentInRange.cjs.map +1 -0
- package/lib-commonjs/utils/getRTLSafeKey.cjs.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.cjs.map +1 -1
- package/lib-commonjs/utils/getReactElementRef.cjs.map +1 -1
- package/lib-commonjs/utils/index.cjs +46 -42
- package/lib-commonjs/utils/index.cjs.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.cjs +2 -2
- package/lib-commonjs/utils/isHTMLElement.cjs.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.cjs.map +1 -1
- package/lib-commonjs/utils/measureScrollBarWidth.cjs.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.cjs.map +1 -1
- package/lib-commonjs/utils/omit.cjs.map +1 -1
- package/lib-commonjs/utils/priorityQueue.cjs.map +1 -1
- package/lib-commonjs/utils/properties.cjs +32 -32
- package/lib-commonjs/utils/properties.cjs.map +1 -1
- package/lib-commonjs/virtualParent/elementContains.cjs.map +1 -1
- package/lib-commonjs/virtualParent/getParent.cjs.map +1 -1
- package/lib-commonjs/virtualParent/index.cjs +4 -4
- package/lib-commonjs/virtualParent/index.cjs.map +1 -1
- package/lib-commonjs/virtualParent/isVirtualElement.cjs.map +1 -1
- package/lib-commonjs/virtualParent/setVirtualParent.cjs.map +1 -1
- package/package.json +5 -8
- package/dist/metadata/api/api-root.json +0 -1
- package/dist/metadata/index.json +0 -1
package/lib-commonjs/index.cjs
CHANGED
|
@@ -5,165 +5,168 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
IdPrefixProvider
|
|
12
|
+
get IdPrefixProvider () {
|
|
13
13
|
return _index1.IdPrefixProvider;
|
|
14
14
|
},
|
|
15
|
-
SLOT_CLASS_NAME_PROP_SYMBOL
|
|
15
|
+
get SLOT_CLASS_NAME_PROP_SYMBOL () {
|
|
16
16
|
return _index.SLOT_CLASS_NAME_PROP_SYMBOL;
|
|
17
17
|
},
|
|
18
|
-
SLOT_ELEMENT_TYPE_SYMBOL
|
|
18
|
+
get SLOT_ELEMENT_TYPE_SYMBOL () {
|
|
19
19
|
return _index.SLOT_ELEMENT_TYPE_SYMBOL;
|
|
20
20
|
},
|
|
21
|
-
SLOT_RENDER_FUNCTION_SYMBOL
|
|
21
|
+
get SLOT_RENDER_FUNCTION_SYMBOL () {
|
|
22
22
|
return _index.SLOT_RENDER_FUNCTION_SYMBOL;
|
|
23
23
|
},
|
|
24
|
-
SSRProvider
|
|
24
|
+
get SSRProvider () {
|
|
25
25
|
return _index2.SSRProvider;
|
|
26
26
|
},
|
|
27
|
-
applyTriggerPropsToChildren
|
|
27
|
+
get applyTriggerPropsToChildren () {
|
|
28
28
|
return _index4.applyTriggerPropsToChildren;
|
|
29
29
|
},
|
|
30
|
-
assertSlots
|
|
30
|
+
get assertSlots () {
|
|
31
31
|
return _index.assertSlots;
|
|
32
32
|
},
|
|
33
|
-
canUseDOM
|
|
33
|
+
get canUseDOM () {
|
|
34
34
|
return _index2.canUseDOM;
|
|
35
35
|
},
|
|
36
|
-
clamp
|
|
36
|
+
get clamp () {
|
|
37
37
|
return _index3.clamp;
|
|
38
38
|
},
|
|
39
|
-
createPriorityQueue
|
|
39
|
+
get createPriorityQueue () {
|
|
40
40
|
return _index3.createPriorityQueue;
|
|
41
41
|
},
|
|
42
|
-
elementContains
|
|
42
|
+
get elementContains () {
|
|
43
43
|
return _index7.elementContains;
|
|
44
44
|
},
|
|
45
|
-
getEventClientCoords
|
|
45
|
+
get getEventClientCoords () {
|
|
46
46
|
return _index5.getEventClientCoords;
|
|
47
47
|
},
|
|
48
|
-
getIntrinsicElementProps
|
|
48
|
+
get getIntrinsicElementProps () {
|
|
49
49
|
return _index.getIntrinsicElementProps;
|
|
50
50
|
},
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
52
|
-
getNativeElementProps
|
|
51
|
+
get // eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
52
|
+
getNativeElementProps () {
|
|
53
53
|
return _index3.getNativeElementProps;
|
|
54
54
|
},
|
|
55
|
-
getParent
|
|
55
|
+
get getParent () {
|
|
56
56
|
return _index7.getParent;
|
|
57
57
|
},
|
|
58
|
-
getPartitionedNativeProps
|
|
58
|
+
get getPartitionedNativeProps () {
|
|
59
59
|
return _index3.getPartitionedNativeProps;
|
|
60
60
|
},
|
|
61
|
-
|
|
61
|
+
get getPercentInRange () {
|
|
62
|
+
return _index3.getPercentInRange;
|
|
63
|
+
},
|
|
64
|
+
get getRTLSafeKey () {
|
|
62
65
|
return _index3.getRTLSafeKey;
|
|
63
66
|
},
|
|
64
|
-
getReactElementRef
|
|
67
|
+
get getReactElementRef () {
|
|
65
68
|
return _index3.getReactElementRef;
|
|
66
69
|
},
|
|
67
|
-
getSlotClassNameProp_unstable
|
|
70
|
+
get getSlotClassNameProp_unstable () {
|
|
68
71
|
return _index.getSlotClassNameProp_unstable;
|
|
69
72
|
},
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
71
|
-
getSlots
|
|
73
|
+
get // eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
74
|
+
getSlots () {
|
|
72
75
|
return _index.getSlots;
|
|
73
76
|
},
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
75
|
-
getSlotsNext
|
|
77
|
+
get // eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
78
|
+
getSlotsNext () {
|
|
76
79
|
return _index.getSlotsNext;
|
|
77
80
|
},
|
|
78
|
-
getTriggerChild
|
|
81
|
+
get getTriggerChild () {
|
|
79
82
|
return _index4.getTriggerChild;
|
|
80
83
|
},
|
|
81
|
-
isFluentTrigger
|
|
84
|
+
get isFluentTrigger () {
|
|
82
85
|
return _index4.isFluentTrigger;
|
|
83
86
|
},
|
|
84
|
-
isHTMLElement
|
|
87
|
+
get isHTMLElement () {
|
|
85
88
|
return _index3.isHTMLElement;
|
|
86
89
|
},
|
|
87
|
-
isInteractiveHTMLElement
|
|
90
|
+
get isInteractiveHTMLElement () {
|
|
88
91
|
return _index3.isInteractiveHTMLElement;
|
|
89
92
|
},
|
|
90
|
-
isMouseEvent
|
|
93
|
+
get isMouseEvent () {
|
|
91
94
|
return _index5.isMouseEvent;
|
|
92
95
|
},
|
|
93
|
-
isResolvedShorthand
|
|
96
|
+
get isResolvedShorthand () {
|
|
94
97
|
return _index.isResolvedShorthand;
|
|
95
98
|
},
|
|
96
|
-
isSlot
|
|
99
|
+
get isSlot () {
|
|
97
100
|
return _index.isSlot;
|
|
98
101
|
},
|
|
99
|
-
isTouchEvent
|
|
102
|
+
get isTouchEvent () {
|
|
100
103
|
return _index5.isTouchEvent;
|
|
101
104
|
},
|
|
102
|
-
mergeCallbacks
|
|
105
|
+
get mergeCallbacks () {
|
|
103
106
|
return _index3.mergeCallbacks;
|
|
104
107
|
},
|
|
105
|
-
omit
|
|
108
|
+
get omit () {
|
|
106
109
|
return _index3.omit;
|
|
107
110
|
},
|
|
108
|
-
resetIdsForTests
|
|
111
|
+
get resetIdsForTests () {
|
|
109
112
|
return _index1.resetIdsForTests;
|
|
110
113
|
},
|
|
111
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
112
|
-
resolveShorthand
|
|
114
|
+
get // eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
115
|
+
resolveShorthand () {
|
|
113
116
|
return _index.resolveShorthand;
|
|
114
117
|
},
|
|
115
|
-
setVirtualParent
|
|
118
|
+
get setVirtualParent () {
|
|
116
119
|
return _index7.setVirtualParent;
|
|
117
120
|
},
|
|
118
|
-
slot
|
|
121
|
+
get slot () {
|
|
119
122
|
return _index.slot;
|
|
120
123
|
},
|
|
121
|
-
useAnimationFrame
|
|
124
|
+
get useAnimationFrame () {
|
|
122
125
|
return _index1.useAnimationFrame;
|
|
123
126
|
},
|
|
124
|
-
useApplyScrollbarWidth
|
|
127
|
+
get useApplyScrollbarWidth () {
|
|
125
128
|
return _index1.useApplyScrollbarWidth;
|
|
126
129
|
},
|
|
127
|
-
useControllableState
|
|
130
|
+
get useControllableState () {
|
|
128
131
|
return _index1.useControllableState;
|
|
129
132
|
},
|
|
130
|
-
useEventCallback
|
|
133
|
+
get useEventCallback () {
|
|
131
134
|
return _index1.useEventCallback;
|
|
132
135
|
},
|
|
133
|
-
useFirstMount
|
|
136
|
+
get useFirstMount () {
|
|
134
137
|
return _index1.useFirstMount;
|
|
135
138
|
},
|
|
136
|
-
useForceUpdate
|
|
139
|
+
get useForceUpdate () {
|
|
137
140
|
return _index1.useForceUpdate;
|
|
138
141
|
},
|
|
139
|
-
useId
|
|
142
|
+
get useId () {
|
|
140
143
|
return _index1.useId;
|
|
141
144
|
},
|
|
142
|
-
useIsSSR
|
|
145
|
+
get useIsSSR () {
|
|
143
146
|
return _index2.useIsSSR;
|
|
144
147
|
},
|
|
145
|
-
useIsomorphicLayoutEffect
|
|
148
|
+
get useIsomorphicLayoutEffect () {
|
|
146
149
|
return _index1.useIsomorphicLayoutEffect;
|
|
147
150
|
},
|
|
148
|
-
useMergedRefs
|
|
151
|
+
get useMergedRefs () {
|
|
149
152
|
return _index1.useMergedRefs;
|
|
150
153
|
},
|
|
151
|
-
useOnClickOutside
|
|
154
|
+
get useOnClickOutside () {
|
|
152
155
|
return _index1.useOnClickOutside;
|
|
153
156
|
},
|
|
154
|
-
useOnScrollOutside
|
|
157
|
+
get useOnScrollOutside () {
|
|
155
158
|
return _index1.useOnScrollOutside;
|
|
156
159
|
},
|
|
157
|
-
usePrevious
|
|
160
|
+
get usePrevious () {
|
|
158
161
|
return _index1.usePrevious;
|
|
159
162
|
},
|
|
160
|
-
useScrollbarWidth
|
|
163
|
+
get useScrollbarWidth () {
|
|
161
164
|
return _index1.useScrollbarWidth;
|
|
162
165
|
},
|
|
163
|
-
useSelection
|
|
166
|
+
get useSelection () {
|
|
164
167
|
return _index6.useSelection;
|
|
165
168
|
},
|
|
166
|
-
useTimeout
|
|
169
|
+
get useTimeout () {
|
|
167
170
|
return _index1.useTimeout;
|
|
168
171
|
}
|
|
169
172
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlotsNext,\n assertSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n getSlotClassNameProp_unstable,\n SLOT_CLASS_NAME_PROP_SYMBOL,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n RefAttributes,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandFunction,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandOptions,\n Slot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n EventData,\n EventHandler,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useApplyScrollbarWidth,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n getReactElementRef,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type {\n DistributiveOmit,\n UnionToIntersection,\n JSXElement,\n JSXIntrinsicElement,\n JSXIntrinsicElementKeys,\n} from './utils/types';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["IdPrefixProvider","SLOT_CLASS_NAME_PROP_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","SSRProvider","applyTriggerPropsToChildren","assertSlots","canUseDOM","clamp","createPriorityQueue","elementContains","getEventClientCoords","getIntrinsicElementProps","getNativeElementProps","getParent","getPartitionedNativeProps","getRTLSafeKey","getReactElementRef","getSlotClassNameProp_unstable","getSlots","getSlotsNext","getTriggerChild","isFluentTrigger","isHTMLElement","isInteractiveHTMLElement","isMouseEvent","isResolvedShorthand","isSlot","isTouchEvent","mergeCallbacks","omit","resetIdsForTests","resolveShorthand","setVirtualParent","slot","useAnimationFrame","useApplyScrollbarWidth","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsSSR","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useSelection","useTimeout"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlotsNext,\n assertSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n getSlotClassNameProp_unstable,\n SLOT_CLASS_NAME_PROP_SYMBOL,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n RefAttributes,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandFunction,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandOptions,\n Slot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n EventData,\n EventHandler,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useApplyScrollbarWidth,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getPercentInRange,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n getReactElementRef,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type {\n DistributiveOmit,\n UnionToIntersection,\n JSXElement,\n JSXIntrinsicElement,\n JSXIntrinsicElementKeys,\n} from './utils/types';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["IdPrefixProvider","SLOT_CLASS_NAME_PROP_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","SSRProvider","applyTriggerPropsToChildren","assertSlots","canUseDOM","clamp","createPriorityQueue","elementContains","getEventClientCoords","getIntrinsicElementProps","getNativeElementProps","getParent","getPartitionedNativeProps","getPercentInRange","getRTLSafeKey","getReactElementRef","getSlotClassNameProp_unstable","getSlots","getSlotsNext","getTriggerChild","isFluentTrigger","isHTMLElement","isInteractiveHTMLElement","isMouseEvent","isResolvedShorthand","isSlot","isTouchEvent","mergeCallbacks","omit","resetIdsForTests","resolveShorthand","setVirtualParent","slot","useAnimationFrame","useApplyScrollbarWidth","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsSSR","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useSelection","useTimeout"],"mappings":";;;;;;;;;;;QA2CEA;eAAAA,wBAAgB;;QA9BhBC;eAAAA,kCAA2B;;QAC3BC;eAAAA,+BAAwB;;QACxBC;eAAAA,kCAA2B;;QA+CCC;eAAAA,mBAAW;;QA2BhCC;eAAAA,mCAA2B;;QAlFlCC;eAAAA,kBAAW;;QAuDJC;eAAAA,iBAAS;;QAGhBC;eAAAA,aAAK;;QAWLC;eAAAA,2BAAmB;;QAiCZC;eAAAA,uBAAe;;QAZaC;eAAAA,4BAAoB;;QAtFvDC;eAAAA,+BAAwB;;QAwDxB,4DAA4D;IAC5DC;eAAAA,6BAAqB;;QAyCqBC;eAAAA,iBAAS;;QAxCnDC;eAAAA,iCAAyB;;QAHzBC;eAAAA,yBAAiB;;QAKjBC;eAAAA,qBAAa;;QADbC;eAAAA,0BAAkB;;QA1DlBC;eAAAA,oCAA6B;;QAT7B,4DAA4D;IAC5DC;eAAAA,eAAQ;;QACR,4DAA4D;IAC5DC;eAAAA,mBAAY;;QAmFwBC;eAAAA,uBAAe;;QAAEC;eAAAA,uBAAe;;QAhBpEC;eAAAA,qBAAa;;QACbC;eAAAA,gCAAwB;;QAuBHC;eAAAA,oBAAY;;QAvFjCC;eAAAA,0BAAmB;;QARnBC;eAAAA,aAAM;;QA+FCC;eAAAA,oBAAY;;QAzBnBC;eAAAA,sBAAc;;QAGdC;eAAAA,YAAI;;QA/BJC;eAAAA,wBAAgB;;QApChB,4DAA4D;IAC5DC;eAAAA,uBAAgB;;QAoGQC;eAAAA,wBAAgB;;QA5GxCC;eAAAA,WAAI;;QA4CJC;eAAAA,yBAAiB;;QACjBC;eAAAA,8BAAsB;;QACtBC;eAAAA,4BAAoB;;QACpBC;eAAAA,wBAAgB;;QAChBC;eAAAA,qBAAa;;QACbC;eAAAA,sBAAc;;QACdC;eAAAA,aAAK;;QAWaC;eAAAA,gBAAQ;;QAV1BC;eAAAA,iCAAyB;;QACzBC;eAAAA,qBAAa;;QACbC;eAAAA,yBAAiB;;QACjBC;eAAAA,0BAAkB;;QAClBC;eAAAA,mBAAW;;QACXC;eAAAA,yBAAiB;;QAkDVC;eAAAA,oBAAY;;QAjDnBC;eAAAA,kBAAU;;;uBA1CL;wBA2CA;wBAG0C;wBAe1C;wBAYuE;wBAQb;wBAUpC;wBAEgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/selection/index.ts"],"sourcesContent":["export type {\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionHookParams,\n SelectionItemId,\n SelectionMethods,\n SelectionMode,\n} from './types';\nexport { useSelection } from './useSelection';\n"],"names":["useSelection"],"mappings":";;;;+BAQSA;;;eAAAA,0BAAY;;;8BAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/selection/useSelection.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { SelectionHookParams, SelectionItemId, SelectionMethods } from './types';\nimport { useControllableState } from '../hooks/useControllableState';\nimport { createSetFromIterable } from '../utils/createSetFromIterable';\n\nfunction useSelectionState(params: Omit<SelectionHookParams, 'selectionMode'>) {\n const [selected, setSelected] = useControllableState<Set<SelectionItemId>>({\n initialState: new Set(),\n defaultState: React.useMemo(\n () => params.defaultSelectedItems && createSetFromIterable(params.defaultSelectedItems),\n [params.defaultSelectedItems],\n ),\n state: React.useMemo(\n () => params.selectedItems && createSetFromIterable(params.selectedItems),\n [params.selectedItems],\n ),\n });\n const changeSelection = (event: React.SyntheticEvent, nextSelectedItems: Set<SelectionItemId>) => {\n params.onSelectionChange?.(event, { selectedItems: nextSelectedItems });\n setSelected(nextSelectedItems);\n };\n return [selected, changeSelection] as const;\n}\n\nfunction useSingleSelection(params: Omit<SelectionHookParams, 'selectionMode'>) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods: SelectionMethods = {\n deselectItem: event => changeSelection(event, new Set()),\n selectItem: (event, itemId) => changeSelection(event, new Set([itemId])),\n toggleAllItems: () => {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');\n }\n },\n toggleItem: (event, itemId) => changeSelection(event, new Set([itemId])),\n clearItems: event => changeSelection(event, new Set()),\n isSelected: itemId => selected.has(itemId) ?? false,\n };\n return [selected, methods] as const;\n}\n\nfunction useMultipleSelection(params: Omit<SelectionHookParams, 'selectionMode'>) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods: SelectionMethods = {\n toggleItem: (event, itemId) => {\n const nextSelectedItems = new Set(selected);\n if (selected.has(itemId)) {\n nextSelectedItems.delete(itemId);\n } else {\n nextSelectedItems.add(itemId);\n }\n changeSelection(event, nextSelectedItems);\n },\n selectItem: (event, itemId) => {\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.add(itemId);\n changeSelection(event, nextSelectedItems);\n },\n deselectItem: (event, itemId) => {\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.delete(itemId);\n changeSelection(event, nextSelectedItems);\n },\n clearItems: event => {\n changeSelection(event, new Set());\n },\n isSelected: itemId => selected.has(itemId),\n toggleAllItems: (event, itemIds) => {\n const allItemsSelected = itemIds.every(itemId => selected.has(itemId));\n const nextSelectedItems = new Set(selected);\n if (allItemsSelected) {\n nextSelectedItems.clear();\n } else {\n itemIds.forEach(itemId => nextSelectedItems.add(itemId));\n }\n changeSelection(event, nextSelectedItems);\n },\n };\n return [selected, methods] as const;\n}\n\nexport function useSelection(params: SelectionHookParams): readonly [Set<SelectionItemId>, SelectionMethods] {\n if (params.selectionMode === 'multiselect') {\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMultipleSelection(params);\n }\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSingleSelection(params);\n}\n"],"names":["useSelection","useSelectionState","params","selected","setSelected","useControllableState","initialState","Set","defaultState","React","useMemo","defaultSelectedItems","createSetFromIterable","state","selectedItems","changeSelection","event","nextSelectedItems","onSelectionChange","useSingleSelection","methods","deselectItem","selectItem","itemId","toggleAllItems","process","env","NODE_ENV","Error","toggleItem","clearItems","isSelected","has","useMultipleSelection","delete","add","itemIds","allItemsSelected","every","clear","forEach","selectionMode"],"mappings":"AAAA;;;;;+BAmFgBA;;;eAAAA;;;;iEAjFO;sCAEc;uCACC;AAEtC,SAASC,kBAAkBC,MAAkD;IAC3E,MAAM,CAACC,UAAUC,YAAY,GAAGC,IAAAA,0CAAoB,EAAuB;QACzEC,cAAc,IAAIC;QAClBC,cAAcC,OAAMC,OAAO,CACzB,IAAMR,OAAOS,oBAAoB,IAAIC,IAAAA,4CAAqB,EAACV,OAAOS,oBAAoB,GACtF;YAACT,OAAOS,oBAAoB;SAAC;QAE/BE,OAAOJ,OAAMC,OAAO,CAClB,IAAMR,OAAOY,aAAa,IAAIF,IAAAA,4CAAqB,EAACV,OAAOY,aAAa,GACxE;YAACZ,OAAOY,aAAa;SAAC;IAE1B;IACA,MAAMC,kBAAkB,CAACC,OAA6BC;YACpDf;SAAAA,4BAAAA,OAAOgB,iBAAiB,cAAxBhB,gDAAAA,+BAAAA,QAA2Bc,OAAO;YAAEF,eAAeG;QAAkB;QACrEb,YAAYa;IACd;IACA,OAAO;QAACd;QAAUY;KAAgB;AACpC;AAEA,SAASI,mBAAmBjB,MAAkD;IAC5E,MAAM,CAACC,UAAUY,gBAAgB,GAAGd,kBAAkBC;IACtD,MAAMkB,UAA4B;QAChCC,cAAcL,CAAAA,QAASD,gBAAgBC,OAAO,IAAIT;QAClDe,YAAY,CAACN,OAAOO,SAAWR,gBAAgBC,OAAO,IAAIT,IAAI;gBAACgB;aAAO;QACtEC,gBAAgB;YACd,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,MAAM,IAAIC,MAAM;YAClB;QACF;QACAC,YAAY,CAACb,OAAOO,SAAWR,gBAAgBC,OAAO,IAAIT,IAAI;gBAACgB;aAAO;QACtEO,YAAYd,CAAAA,QAASD,gBAAgBC,OAAO,IAAIT;QAChDwB,YAAYR,CAAAA;gBAAUpB;oBAAAA,gBAAAA,SAAS6B,GAAG,CAACT,qBAAbpB,2BAAAA,gBAAwB;;IAChD;IACA,OAAO;QAACA;QAAUiB;KAAQ;AAC5B;AAEA,SAASa,qBAAqB/B,MAAkD;IAC9E,MAAM,CAACC,UAAUY,gBAAgB,GAAGd,kBAAkBC;IACtD,MAAMkB,UAA4B;QAChCS,YAAY,CAACb,OAAOO;YAClB,MAAMN,oBAAoB,IAAIV,IAAIJ;YAClC,IAAIA,SAAS6B,GAAG,CAACT,SAAS;gBACxBN,kBAAkBiB,MAAM,CAACX;YAC3B,OAAO;gBACLN,kBAAkBkB,GAAG,CAACZ;YACxB;YACAR,gBAAgBC,OAAOC;QACzB;QACAK,YAAY,CAACN,OAAOO;YAClB,MAAMN,oBAAoB,IAAIV,IAAIJ;YAClCc,kBAAkBkB,GAAG,CAACZ;YACtBR,gBAAgBC,OAAOC;QACzB;QACAI,cAAc,CAACL,OAAOO;YACpB,MAAMN,oBAAoB,IAAIV,IAAIJ;YAClCc,kBAAkBiB,MAAM,CAACX;YACzBR,gBAAgBC,OAAOC;QACzB;QACAa,YAAYd,CAAAA;YACVD,gBAAgBC,OAAO,IAAIT;QAC7B;QACAwB,YAAYR,CAAAA,SAAUpB,SAAS6B,GAAG,CAACT;QACnCC,gBAAgB,CAACR,OAAOoB;YACtB,MAAMC,mBAAmBD,QAAQE,KAAK,CAACf,CAAAA,SAAUpB,SAAS6B,GAAG,CAACT;YAC9D,MAAMN,oBAAoB,IAAIV,IAAIJ;YAClC,IAAIkC,kBAAkB;gBACpBpB,kBAAkBsB,KAAK;YACzB,OAAO;gBACLH,QAAQI,OAAO,CAACjB,CAAAA,SAAUN,kBAAkBkB,GAAG,CAACZ;YAClD;YACAR,gBAAgBC,OAAOC;QACzB;IACF;IACA,OAAO;QAACd;QAAUiB;KAAQ;AAC5B;AAEO,SAASpB,aAAaE,MAA2B;IACtD,IAAIA,OAAOuC,aAAa,KAAK,eAAe;QAC1C,0EAA0E;QAC1E,sDAAsD;QACtD,OAAOR,qBAAqB/B;IAC9B;IACA,0EAA0E;IAC1E,sDAAsD;IACtD,OAAOiB,mBAAmBjB;AAC5B"}
|
|
@@ -6,23 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
SSRContext
|
|
13
|
+
get SSRContext () {
|
|
14
14
|
return SSRContext;
|
|
15
15
|
},
|
|
16
|
-
SSRProvider
|
|
16
|
+
get SSRProvider () {
|
|
17
17
|
return SSRProvider;
|
|
18
18
|
},
|
|
19
|
-
defaultSSRContextValue
|
|
19
|
+
get defaultSSRContextValue () {
|
|
20
20
|
return defaultSSRContextValue;
|
|
21
21
|
},
|
|
22
|
-
useIsSSR
|
|
22
|
+
get useIsSSR () {
|
|
23
23
|
return useIsSSR;
|
|
24
24
|
},
|
|
25
|
-
useSSRContext
|
|
25
|
+
get useSSRContext () {
|
|
26
26
|
return useSSRContext;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/ssr/SSRContext.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue | undefined>(undefined) as React.Context<SSRContextValue>;\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext) ?? defaultSSRContextValue;\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC<{ children: React.ReactNode }> = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(/** #__DE-INDENT__ */ `\n @fluentui/react-components [${useIsSSR.name}]:\n When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.\n\n\n Check documentation at https://aka.ms/fluentui-ssr.\n `);\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"names":["SSRContext","SSRProvider","defaultSSRContextValue","useIsSSR","useSSRContext","current","React","createContext","undefined","useContext","props","value","useState","Provider","children","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","name","useLayoutEffect"],"mappings":"AAAA;;;;;;;;;;;;QAwBaA;eAAAA;;QAeAC;eAAAA;;QAnBAC;eAAAA;;QA6BGC;eAAAA;;QApBAC;eAAAA;;;;iEA3BO;2BACG;AAiBnB,MAAMF,yBAA0C;IACrDG,SAAS;AACX;AAEO,MAAML,2BAAaM,OAAMC,aAAa,CAA8BC;AAKpE,SAASJ;QACPE;IAAP,QAAOA,oBAAAA,OAAMG,UAAU,CAACT,yBAAjBM,+BAAAA,oBAAgCJ;AACzC;AAQO,MAAMD,cAAuDS,CAAAA;IAClE,MAAM,CAACC,MAAM,GAAGL,OAAMM,QAAQ,CAAkB,IAAO,CAAA;YAAEP,SAAS;QAAE,CAAA;IAEpE,qBAAO,qBAACL,WAAWa,QAAQ;QAACF,OAAOA;OAAQD,MAAMI,QAAQ;AAC3D;AAMO,SAASX;IACd,MAAMY,iBAAiBX,oBAAoBF;IAC3C,MAAM,CAACc,OAAOC,SAAS,GAAGX,OAAMM,QAAQ,CAACG;IAEzC,6GAA6G;IAC7G,wBAAwB;IACxB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,CAACL,kBAAkB,CAACM,IAAAA,oBAAS,KAAI;YACnC,sCAAsC;YACtCC,QAAQC,KAAK,CAAuB,CAAC,4BACP,EAAEpB,SAASqB,IAAI,CAAC;;;;mDAK9C,CAAC;QACH;IACF;IAEA,iHAAiH;IACjH,6BAA6B;IAC7B,IAAIH,IAAAA,oBAAS,OAAMN,gBAAgB;QACjC,iHAAiH;QACjH,YAAY;QACZ,2BAA2B;QAC3BT,OAAMmB,eAAe,CAAC;YACpB,2DAA2D;YAC3DR,SAAS;QACX,GAAG,EAAE;IACP;IAEA,OAAOD;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/ssr/canUseDOM.ts"],"sourcesContent":["'use client';\n\n/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n /* eslint-disable @nx/workspace-no-restricted-globals -- expected ignore ( SSR friendly acquisition of globals )*/\n typeof window !== 'undefined' &&\n !!(\n window.document &&\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n window.document.createElement\n )\n /* eslint-enable @nx/workspace-no-restricted-globals */\n );\n}\n"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;;;;+BAKgBA;;;eAAAA;;;AAAT,SAASA;IACd,OACE,gHAAgH,GAChH,OAAOC,WAAW,eAClB,CAAC,CACCA,CAAAA,OAAOC,QAAQ,IACf,4DAA4D;IAC5DD,OAAOC,QAAQ,CAACC,aAAa,AAAD;AAIlC"}
|
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
SSRContext
|
|
12
|
+
get SSRContext () {
|
|
13
13
|
return _SSRContext.SSRContext;
|
|
14
14
|
},
|
|
15
|
-
SSRProvider
|
|
15
|
+
get SSRProvider () {
|
|
16
16
|
return _SSRContext.SSRProvider;
|
|
17
17
|
},
|
|
18
|
-
canUseDOM
|
|
18
|
+
get canUseDOM () {
|
|
19
19
|
return _canUseDOM.canUseDOM;
|
|
20
20
|
},
|
|
21
|
-
defaultSSRContextValue
|
|
21
|
+
get defaultSSRContextValue () {
|
|
22
22
|
return _SSRContext.defaultSSRContextValue;
|
|
23
23
|
},
|
|
24
|
-
useIsSSR
|
|
24
|
+
get useIsSSR () {
|
|
25
25
|
return _SSRContext.useIsSSR;
|
|
26
26
|
},
|
|
27
|
-
useSSRContext
|
|
27
|
+
get useSSRContext () {
|
|
28
28
|
return _SSRContext.useSSRContext;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/ssr/index.ts"],"sourcesContent":["export { canUseDOM } from './canUseDOM';\nexport type { SSRContextValue } from './SSRContext';\nexport { SSRContext, SSRProvider, defaultSSRContextValue, useIsSSR, useSSRContext } from './SSRContext';\n"],"names":["SSRContext","SSRProvider","canUseDOM","defaultSSRContextValue","useIsSSR","useSSRContext"],"mappings":";;;;;;;;;;;QAESA;eAAAA,sBAAU;;QAAEC;eAAAA,uBAAW;;QAFvBC;eAAAA,oBAAS;;QAEgBC;eAAAA,kCAAsB;;QAAEC;eAAAA,oBAAQ;;QAAEC;eAAAA,yBAAa;;;2BAFvD;4BAE+D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/trigger/applyTriggerPropsToChildren.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n *\n * @internal\n */\nexport function applyTriggerPropsToChildren<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n triggerChildProps: TriggerChildProps,\n): React.ReactElement | null {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\n }\n\n // Components in React should return either JSX elements or \"null\", otherwise React will throw:\n // Nothing was returned from render.\n // This usually means a return statement is missing. Or, to render nothing, return null.\n return children || null;\n}\n\n/**\n * Clones a React element tree, and applies the given props to the first grandchild that is not\n * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).\n */\nfunction cloneTriggerTree<TriggerChildProps>(\n child: TriggerProps['children'],\n triggerProps: TriggerChildProps,\n): React.ReactElement {\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error(\n 'A trigger element must be a single element for this component. ' +\n \"Please ensure that you're not using React Fragments.\",\n );\n }\n\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return React.cloneElement(child, undefined, grandchild);\n } else {\n return React.cloneElement(child, triggerProps as TriggerChildProps & React.Attributes);\n }\n}\n"],"names":["applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","React","isValidElement","type","Fragment","Error","isFluentTrigger","grandchild","props","cloneElement","undefined"],"mappings":";;;;+BASgBA;;;eAAAA;;;;iEATO;iCACS;AAQzB,SAASA,4BACdC,QAAqD,EACrDC,iBAAoC;IAEpC,IAAI,OAAOD,aAAa,YAAY;QAClC,OAAOA,SAASC;IAClB,OAAO,IAAID,UAAU;QACnB,OAAOE,iBAAiBF,UAAUC;IACpC;IAEA,+FAA+F;IAC/F,sCAAsC;IACtC,0FAA0F;IAC1F,OAAOD,YAAY;AACrB;AAEA;;;CAGC,GACD,SAASE,iBACPC,KAA+B,EAC/BC,YAA+B;IAE/B,IAAI,CAACC,OAAMC,cAAc,CAACH,UAAUA,MAAMI,IAAI,KAAKF,OAAMG,QAAQ,EAAE;QACjE,MAAM,IAAIC,MACR,oEACE;IAEN;IAEA,IAAIC,IAAAA,gCAAe,EAACP,QAAQ;QAC1B,MAAMQ,aAAaT,iBAAiBC,MAAMS,KAAK,CAACZ,QAAQ,EAAEI;QAC1D,OAAOC,OAAMQ,YAAY,CAACV,OAAOW,WAAWH;IAC9C,OAAO;QACL,OAAON,OAAMQ,YAAY,CAACV,OAAOC;IACnC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/trigger/getTriggerChild.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).\n *\n * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,\n * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.\n * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.\n *\n * For example, the following returns `<div id=\"child\" />`:\n * ```jsx\n * getTriggerChild(\n * <Tooltip>\n * <MenuTrigger>\n * <div id=\"child\" />\n * </MenuTrigger>\n * </Tooltip>\n * );\n * ```\n *\n * In the case where the immediate child is not a valid element,\n * null is returned\n *\n * @internal\n */\nexport function getTriggerChild<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (React.ReactElement<Partial<TriggerChildProps>> & { ref?: React.Ref<any> }) | null {\n if (!React.isValidElement<TriggerChildProps>(children)) {\n return null;\n }\n return isFluentTrigger(children)\n ? getTriggerChild(\n // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,\n // but for some reason it's failing on build\n (children.props as TriggerProps).children,\n )\n : children;\n}\n"],"names":["getTriggerChild","children","React","isValidElement","isFluentTrigger","props"],"mappings":";;;;+BA2BgBA;;;eAAAA;;;;iEA3BO;iCACS;AA0BzB,SAASA,gBACdC,QAAqD;IAGrD,IAAI,CAACC,OAAMC,cAAc,CAAoBF,WAAW;QACtD,OAAO;IACT;IACA,OAAOG,IAAAA,gCAAe,EAACH,YACnBD,gBAGE,AAFA,uFAAuF;IACvF,4CAA4C;IAC3CC,SAASI,KAAK,CAAkBJ,QAAQ,IAE3CA;AACN"}
|
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
applyTriggerPropsToChildren
|
|
12
|
+
get applyTriggerPropsToChildren () {
|
|
13
13
|
return _applyTriggerPropsToChildren.applyTriggerPropsToChildren;
|
|
14
14
|
},
|
|
15
|
-
getTriggerChild
|
|
15
|
+
get getTriggerChild () {
|
|
16
16
|
return _getTriggerChild.getTriggerChild;
|
|
17
17
|
},
|
|
18
|
-
isFluentTrigger
|
|
18
|
+
get isFluentTrigger () {
|
|
19
19
|
return _isFluentTrigger.isFluentTrigger;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/trigger/index.ts"],"sourcesContent":["export { applyTriggerPropsToChildren } from './applyTriggerPropsToChildren';\nexport { getTriggerChild } from './getTriggerChild';\nexport { isFluentTrigger } from './isFluentTrigger';\nexport type { FluentTriggerComponent, TriggerProps } from './types';\n"],"names":["applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger"],"mappings":";;;;;;;;;;;QAASA;eAAAA,wDAA2B;;QAC3BC;eAAAA,gCAAe;;QACfC;eAAAA,gCAAe;;;6CAFoB;iCACZ;iCACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/trigger/isFluentTrigger.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { FluentTriggerComponent, TriggerProps } from './types';\n\n/**\n * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).\n * See the {@link FluentTriggerComponent} type for more info.\n *\n * @internal\n */\nexport function isFluentTrigger(element: React.ReactElement): element is React.ReactElement<TriggerProps> {\n return Boolean((element.type as FluentTriggerComponent).isFluentTriggerComponent);\n}\n"],"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"mappings":";;;;+BASgBA;;;eAAAA;;;AAAT,SAASA,gBAAgBC,OAA2B;IACzD,OAAOC,QAAQ,AAACD,QAAQE,IAAI,CAA4BC,wBAAwB;AAClF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/clamp.ts"],"sourcesContent":["/**\n * Clamps `value` to a number between the min and max.\n *\n * @internal\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"],"names":["clamp","value","min","max","Math"],"mappings":"AAAA;;;;;;;CAOC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,QAAQ,CAACC,OAAeC,KAAaC,MAAwBC,KAAKD,GAAG,CAACD,KAAKE,KAAKF,GAAG,CAACC,KAAKF,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/createSetFromIterable.ts"],"sourcesContent":["/**\n * Creates a set from a given iterable, in case the iterable is a set itself, returns the given set instead.\n */\nexport function createSetFromIterable<V>(iterable: Iterable<V>): Set<V> {\n return iterable instanceof Set ? iterable : new Set(iterable);\n}\n"],"names":["createSetFromIterable","iterable","Set"],"mappings":"AAAA;;CAEC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,sBAAyBC,QAAqB;IAC5D,OAAOA,oBAAoBC,MAAMD,WAAW,IAAIC,IAAID;AACtD"}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getNativeElementProps
|
|
12
|
+
get getNativeElementProps () {
|
|
13
13
|
return getNativeElementProps;
|
|
14
14
|
},
|
|
15
|
-
getPartitionedNativeProps
|
|
15
|
+
get getPartitionedNativeProps () {
|
|
16
16
|
return getPartitionedNativeProps;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -43,7 +43,7 @@ const nativeElementMap = {
|
|
|
43
43
|
dialog: _properties.dialogProperties
|
|
44
44
|
};
|
|
45
45
|
function getNativeElementProps(tagName, props, excludedPropNames) {
|
|
46
|
-
const allowedPropNames = tagName && nativeElementMap[tagName]
|
|
46
|
+
const allowedPropNames = tagName && Object.prototype.hasOwnProperty.call(nativeElementMap, tagName) ? nativeElementMap[tagName] : _properties.htmlElementProperties;
|
|
47
47
|
allowedPropNames.as = 1;
|
|
48
48
|
return (0, _properties.getNativeProps)(props, allowedPropNames, excludedPropNames);
|
|
49
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getNativeElementProps.ts"],"sourcesContent":["import type * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n fieldsetProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n timeProperties,\n dialogProperties,\n} from './properties';\nimport type { JSXIntrinsicElementKeys } from './types';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n time: timeProperties,\n dialog: dialogProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n *\n * @deprecated use getIntrinsicElementProps instead, it is a type-safe version of this method\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames =\n tagName && Object.prototype.hasOwnProperty.call(nativeElementMap, tagName)\n ? nativeElementMap[tagName]\n : htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never,\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: JSXIntrinsicElementKeys;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}): {\n root: {\n style: React.CSSProperties | undefined;\n className: string | undefined;\n };\n primary: Omit<Props, ExcludedPropKeys>;\n} => {\n return {\n root: { style: props.style, className: props.className },\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"],"names":["getNativeElementProps","getPartitionedNativeProps","nativeElementMap","label","labelProperties","audio","audioProperties","video","videoProperties","ol","olProperties","li","liProperties","a","anchorProperties","button","buttonProperties","input","inputProperties","textarea","textAreaProperties","select","selectProperties","option","optionProperties","table","tableProperties","tr","trProperties","th","thProperties","td","tdProperties","colGroup","colGroupProperties","col","colProperties","fieldset","fieldsetProperties","form","formProperties","iframe","iframeProperties","img","imgProperties","time","timeProperties","dialog","dialogProperties","tagName","props","excludedPropNames","allowedPropNames","Object","prototype","hasOwnProperty","call","htmlElementProperties","as","getNativeProps","primarySlotTagName","root","style","className","primary"],"mappings":";;;;;;;;;;;QAkEgBA;eAAAA;;QAsBHC;eAAAA;;;4BA7DN;AAGP,MAAMC,mBAA2D;IAC/DC,OAAOC,2BAAe;IACtBC,OAAOC,2BAAe;IACtBC,OAAOC,2BAAe;IACtBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,GAAGC,4BAAgB;IACnBC,QAAQC,4BAAgB;IACxBC,OAAOC,2BAAe;IACtBC,UAAUC,8BAAkB;IAC5BC,QAAQC,4BAAgB;IACxBC,QAAQC,4BAAgB;IACxBC,OAAOC,2BAAe;IACtBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,UAAUC,8BAAkB;IAC5BC,KAAKC,yBAAa;IAClBC,UAAUC,8BAAkB;IAC5BC,MAAMC,0BAAc;IACpBC,QAAQC,4BAAgB;IACxBC,KAAKC,yBAAa;IAClBC,MAAMC,0BAAc;IACpBC,QAAQC,4BAAgB;AAC1B;AAYO,SAAShD,sBACdiD,OAAe,EACfC,KAAS,EACTC,iBAA4B;IAE5B,MAAMC,mBACJH,WAAWI,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACtD,kBAAkB+C,WAC9D/C,gBAAgB,CAAC+C,QAAQ,GACzBQ,iCAAqB;IAC3BL,iBAAiBM,EAAE,GAAG;IAEtB,OAAOC,IAAAA,0BAAc,EAACT,OAAOE,kBAAkBD;AACjD;AAUO,MAAMlD,4BAA4B,CAGvC,EACA2D,kBAAkB,EAClBV,KAAK,EACLC,iBAAiB,EAUlB;IAOC,OAAO;QACLU,MAAM;YAAEC,OAAOZ,MAAMY,KAAK;YAAEC,WAAWb,MAAMa,SAAS;QAAC;QACvD,4DAA4D;QAC5DC,SAAShE,sBAAqD4D,oBAAoBV,OAAO;eACnFC,qBAAqB,EAAE;YAC3B;YACA;SACD;IACH;AACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the percentage of a value within a given range.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The value to be converted to a percentage.
|
|
5
|
+
* @param min - The minimum value of the range.
|
|
6
|
+
* @param max - The maximum value of the range.
|
|
7
|
+
* @returns The percentage representation of the value within the range [min, max].
|
|
8
|
+
* Returns 0 if `min` is equal to `max`.
|
|
9
|
+
*/ "use strict";
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "getPercentInRange", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
return getPercentInRange;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const getPercentInRange = (value, min, max)=>{
|
|
20
|
+
return max === min ? 0 : (value - min) / (max - min) * 100;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getPercentInRange.ts"],"sourcesContent":["/**\n * Calculates the percentage of a value within a given range.\n *\n * @param value - The value to be converted to a percentage.\n * @param min - The minimum value of the range.\n * @param max - The maximum value of the range.\n * @returns The percentage representation of the value within the range [min, max].\n * Returns 0 if `min` is equal to `max`.\n */\nexport const getPercentInRange = (value: number, min: number, max: number): number => {\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n};\n"],"names":["getPercentInRange","value","min","max"],"mappings":"AAAA;;;;;;;;CAQC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,oBAAoB,CAACC,OAAeC,KAAaC;IAC5D,OAAOA,QAAQD,MAAM,IAAI,AAAED,CAAAA,QAAQC,GAAE,IAAMC,CAAAA,MAAMD,GAAE,IAAM;AAC3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getRTLSafeKey.ts"],"sourcesContent":["/**\n * Finds and swaps a provided key for it's right to left format.\n *\n * @internal\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl'): string => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"],"names":["getRTLSafeKey","key","dir"],"mappings":"AAAA;;;;CAIC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,gBAAgB,CAACC,KAAaC;IACzC,IAAIA,QAAQ,OAAO;QACjB,OAAQD;YACN,KAAK;gBAAa;oBAChB,OAAO;gBACT;YAEA,KAAK;gBAAc;oBACjB,OAAO;gBACT;QACF;IACF;IAEA,OAAOA;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getReactCallbackName.ts"],"sourcesContent":["import type * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(/** #__DE-INDENT__ */ `\n @fluentui/react-utilities [${getReactCallbackName.name}]:\n Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\". This should not happen, please report it to https://github.com/microsoft/fluentui.\n `);\n }\n}\n"],"names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error","name"],"mappings":";;;;+BA+BgBA;;;eAAAA;;;AAAT,SAASA,qBAAqBC,KAA0B;IAC7D,IAAIA,MAAMC,UAAU,EAAE;QACpB,OAAOD,MAAMC,UAAU;IACzB;IAEA,IAAID,MAAME,cAAc,EAAE;QACxB,IAAIF,MAAME,cAAc,CAACC,gBAAgB,EAAE;YACzC,OAAOH,MAAME,cAAc,CAACC,gBAAgB;QAC9C;QAEA,OAAOH,MAAME,cAAc,CAACE,uBAAuB,CAACC,OAAO;IAC7D;IAEA,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,sCAAsC;QACtCC,QAAQC,KAAK,CAAuB,CAAC,2BACR,EAAEX,qBAAqBY,IAAI,CAAC;mKAEzD,CAAC;IACH;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/getReactElementRef.ts"],"sourcesContent":["import * as React from 'react';\n\nconst IS_REACT_19_OR_HIGHER = parseInt(React.version, 10) >= 19;\n\n/**\n * Returns a ref for the React element in a backwards-compatible way.\n *\n * @param element - The element to get the ref for.\n * @returns The ref for the element.\n */\nexport function getReactElementRef<T>(element: React.ReactElement | null | undefined): React.Ref<T> | undefined {\n if (!element) {\n return undefined;\n }\n\n if (IS_REACT_19_OR_HIGHER) {\n return (element as React.ReactElement<{ ref?: React.Ref<T> }>).props.ref;\n }\n\n return (element as React.ReactElement & { ref: React.Ref<T> | undefined }).ref;\n}\n"],"names":["getReactElementRef","IS_REACT_19_OR_HIGHER","parseInt","React","version","element","undefined","props","ref"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;iEAVO;AAEvB,MAAMC,wBAAwBC,SAASC,OAAMC,OAAO,EAAE,OAAO;AAQtD,SAASJ,mBAAsBK,OAA8C;IAClF,IAAI,CAACA,SAAS;QACZ,OAAOC;IACT;IAEA,IAAIL,uBAAuB;QACzB,OAAO,AAACI,QAAuDE,KAAK,CAACC,GAAG;IAC1E;IAEA,OAAO,AAACH,QAAmEG,GAAG;AAChF"}
|