@fluentui/react-utilities 0.0.0-nightlyfc5cfdc52420220215.1 → 0.0.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.json +232 -7
- package/CHANGELOG.md +159 -73
- package/dist/{react-utilities.d.ts → index.d.ts} +39 -272
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/types.js +1 -5
- package/lib/compose/types.js.map +1 -1
- package/lib/hooks/index.js +1 -5
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableState.js +3 -2
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js +1 -0
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js +1 -0
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +1 -0
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js +9 -5
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +1 -0
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedEventCallbacks.js +1 -0
- package/lib/hooks/useMergedEventCallbacks.js.map +1 -1
- package/lib/hooks/useMergedRefs.js +1 -0
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +2 -1
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +1 -0
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js +4 -0
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useTimeout.js +2 -2
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js +5 -4
- package/lib/index.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/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -0
- package/lib/{utils → trigger}/getTriggerChild.js +2 -0
- package/lib/trigger/getTriggerChild.js.map +1 -0
- package/lib/trigger/index.js +5 -0
- package/lib/trigger/index.js.map +1 -0
- package/lib/{utils → trigger}/isFluentTrigger.js +0 -0
- package/lib/trigger/isFluentTrigger.js.map +1 -0
- package/lib/trigger/types.js +2 -0
- package/lib/trigger/types.js.map +1 -0
- package/lib/utils/clamp.js +1 -0
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +4 -2
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +1 -0
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/index.js +0 -3
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +18 -6
- package/lib/utils/properties.js.map +1 -1
- package/lib/utils/shouldPreventDefaultOnKeyDown.js +5 -0
- package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.js +1 -5
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/hooks/index.js +2 -10
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +3 -3
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +1 -0
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +1 -0
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +1 -0
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +9 -5
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +1 -0
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedEventCallbacks.js +1 -0
- package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +1 -0
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +2 -1
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +1 -0
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +4 -0
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +2 -3
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +161 -5
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -0
- package/lib-commonjs/{utils → trigger}/getTriggerChild.js +2 -0
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -0
- package/lib-commonjs/trigger/index.js +16 -0
- package/lib-commonjs/trigger/index.js.map +1 -0
- package/lib-commonjs/{utils → trigger}/isFluentTrigger.js +0 -0
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -0
- package/lib-commonjs/trigger/types.js +6 -0
- package/lib-commonjs/trigger/types.js.map +1 -0
- package/lib-commonjs/utils/clamp.js +1 -0
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +3 -1
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +1 -0
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +0 -6
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +19 -7
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +5 -0
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
- package/package.json +13 -13
- package/lib/compose/getSlots.d.ts +0 -30
- package/lib/compose/index.d.ts +0 -3
- package/lib/compose/resolveShorthand.d.ts +0 -16
- package/lib/compose/types.d.ts +0 -155
- package/lib/hooks/index.d.ts +0 -16
- package/lib/hooks/useBoolean.d.ts +0 -17
- package/lib/hooks/useBoolean.js +0 -28
- package/lib/hooks/useBoolean.js.map +0 -1
- package/lib/hooks/useConst.d.ts +0 -12
- package/lib/hooks/useConst.js +0 -30
- package/lib/hooks/useConst.js.map +0 -1
- package/lib/hooks/useControllableState.d.ts +0 -31
- package/lib/hooks/useEventCallback.d.ts +0 -13
- package/lib/hooks/useFirstMount.d.ts +0 -11
- package/lib/hooks/useForceUpdate.d.ts +0 -4
- package/lib/hooks/useId.d.ts +0 -15
- package/lib/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
- package/lib/hooks/useMergedEventCallbacks.d.ts +0 -18
- package/lib/hooks/useMergedRefs.d.ts +0 -13
- package/lib/hooks/useMount.d.ts +0 -6
- package/lib/hooks/useMount.js +0 -17
- package/lib/hooks/useMount.js.map +0 -1
- package/lib/hooks/useOnClickOutside.d.ts +0 -29
- package/lib/hooks/useOnScrollOutside.d.ts +0 -5
- package/lib/hooks/usePrevious.d.ts +0 -1
- package/lib/hooks/useTimeout.d.ts +0 -8
- package/lib/hooks/useUnmount.d.ts +0 -6
- package/lib/hooks/useUnmount.js +0 -17
- package/lib/hooks/useUnmount.js.map +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/ssr/SSRContext.d.ts +0 -33
- package/lib/ssr/canUseDOM.d.ts +0 -4
- package/lib/ssr/index.d.ts +0 -2
- package/lib/utils/applyTriggerPropsToChildren.d.ts +0 -5
- package/lib/utils/applyTriggerPropsToChildren.js.map +0 -1
- package/lib/utils/clamp.d.ts +0 -8
- package/lib/utils/getNativeElementProps.d.ts +0 -31
- package/lib/utils/getRTLSafeKey.d.ts +0 -4
- package/lib/utils/getReactCallbackName.d.ts +0 -25
- package/lib/utils/getTriggerChild.d.ts +0 -22
- package/lib/utils/getTriggerChild.js.map +0 -1
- package/lib/utils/index.d.ts +0 -9
- package/lib/utils/isFluentTrigger.d.ts +0 -22
- package/lib/utils/isFluentTrigger.js.map +0 -1
- package/lib/utils/omit.d.ts +0 -14
- package/lib/utils/properties.d.ts +0 -148
- package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
- package/lib-commonjs/compose/getSlots.d.ts +0 -30
- package/lib-commonjs/compose/index.d.ts +0 -3
- package/lib-commonjs/compose/resolveShorthand.d.ts +0 -16
- package/lib-commonjs/compose/types.d.ts +0 -155
- package/lib-commonjs/hooks/index.d.ts +0 -16
- package/lib-commonjs/hooks/useBoolean.d.ts +0 -17
- package/lib-commonjs/hooks/useBoolean.js +0 -39
- package/lib-commonjs/hooks/useBoolean.js.map +0 -1
- package/lib-commonjs/hooks/useConst.d.ts +0 -12
- package/lib-commonjs/hooks/useConst.js +0 -40
- package/lib-commonjs/hooks/useConst.js.map +0 -1
- package/lib-commonjs/hooks/useControllableState.d.ts +0 -31
- package/lib-commonjs/hooks/useEventCallback.d.ts +0 -13
- package/lib-commonjs/hooks/useFirstMount.d.ts +0 -11
- package/lib-commonjs/hooks/useForceUpdate.d.ts +0 -4
- package/lib-commonjs/hooks/useId.d.ts +0 -15
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
- package/lib-commonjs/hooks/useMergedEventCallbacks.d.ts +0 -18
- package/lib-commonjs/hooks/useMergedRefs.d.ts +0 -13
- package/lib-commonjs/hooks/useMount.d.ts +0 -6
- package/lib-commonjs/hooks/useMount.js +0 -27
- package/lib-commonjs/hooks/useMount.js.map +0 -1
- package/lib-commonjs/hooks/useOnClickOutside.d.ts +0 -29
- package/lib-commonjs/hooks/useOnScrollOutside.d.ts +0 -5
- package/lib-commonjs/hooks/usePrevious.d.ts +0 -1
- package/lib-commonjs/hooks/useTimeout.d.ts +0 -8
- package/lib-commonjs/hooks/useUnmount.d.ts +0 -6
- package/lib-commonjs/hooks/useUnmount.js +0 -27
- package/lib-commonjs/hooks/useUnmount.js.map +0 -1
- package/lib-commonjs/index.d.ts +0 -4
- package/lib-commonjs/ssr/SSRContext.d.ts +0 -33
- package/lib-commonjs/ssr/canUseDOM.d.ts +0 -4
- package/lib-commonjs/ssr/index.d.ts +0 -2
- package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +0 -5
- package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +0 -1
- package/lib-commonjs/utils/clamp.d.ts +0 -8
- package/lib-commonjs/utils/getNativeElementProps.d.ts +0 -31
- package/lib-commonjs/utils/getRTLSafeKey.d.ts +0 -4
- package/lib-commonjs/utils/getReactCallbackName.d.ts +0 -25
- package/lib-commonjs/utils/getTriggerChild.d.ts +0 -22
- package/lib-commonjs/utils/getTriggerChild.js.map +0 -1
- package/lib-commonjs/utils/index.d.ts +0 -9
- package/lib-commonjs/utils/isFluentTrigger.d.ts +0 -22
- package/lib-commonjs/utils/isFluentTrigger.js.map +0 -1
- package/lib-commonjs/utils/omit.d.ts +0 -14
- package/lib-commonjs/utils/properties.d.ts +0 -148
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
package/lib/utils/properties.js
CHANGED
@@ -82,6 +82,14 @@ export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['va
|
|
82
82
|
|
83
83
|
export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type' // a, button, input, link, menu, object, script, source, style
|
84
84
|
]);
|
85
|
+
/**
|
86
|
+
* An array of TIME tag properties and events.
|
87
|
+
*
|
88
|
+
* @public
|
89
|
+
*/
|
90
|
+
|
91
|
+
export const timeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['dateTime' // time
|
92
|
+
]);
|
85
93
|
/**
|
86
94
|
* An array of BUTTON tag properties and events.
|
87
95
|
*
|
@@ -151,6 +159,14 @@ export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties
|
|
151
159
|
]);
|
152
160
|
export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
|
153
161
|
]);
|
162
|
+
/**
|
163
|
+
* An array of FIELDSET tag properties and events.
|
164
|
+
*
|
165
|
+
* @public
|
166
|
+
*/
|
167
|
+
|
168
|
+
export const fieldsetProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['disabled', 'form' // button, fieldset, input, label, meter, object, output, select, textarea
|
169
|
+
]);
|
154
170
|
/**
|
155
171
|
* An array of FORM tag properties and events.
|
156
172
|
*
|
@@ -175,11 +191,6 @@ export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties,
|
|
175
191
|
|
176
192
|
export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width' // canvas, embed, iframe, img, input, object, video
|
177
193
|
]);
|
178
|
-
/**
|
179
|
-
* @deprecated Use imgProperties for img elements.
|
180
|
-
*/
|
181
|
-
|
182
|
-
export const imageProperties = imgProperties;
|
183
194
|
/**
|
184
195
|
* An array of DIV tag properties and events.
|
185
196
|
*
|
@@ -198,7 +209,8 @@ export const divProperties = htmlElementProperties;
|
|
198
209
|
*
|
199
210
|
* @public
|
200
211
|
* @param props - The unfiltered input props
|
201
|
-
* @param
|
212
|
+
* @param allowedPropNames - The array or record of allowed prop names.
|
213
|
+
* @param excludedPropNames
|
202
214
|
* @returns The filtered props
|
203
215
|
*/
|
204
216
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utils/properties.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,CAAC,GAAG,KAAJ,KAAoD;AACtE,QAAM,MAAM,GAA2B,EAAvC;;AAEA,OAAK,MAAM,IAAX,IAAmB,KAAnB,EAA0B;AACxB,UAAM,IAAI,GAAG,KAAK,CAAC,OAAN,CAAc,IAAd,IAAsB,IAAtB,GAA6B,MAAM,CAAC,IAAP,CAAY,IAAZ,CAA1C;;AAEA,SAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;AACtB,MAAA,MAAM,CAAC,GAAD,CAAN,GAAc,CAAd;AACD;AACF;;AAED,SAAO,MAAP;AACD,CAZD;AAcA;;;;AAIG;;;AACH,OAAO,MAAM,iBAAiB,gBAAG,WAAW,CAAC,CAC3C,YAD2C,EAE3C,QAF2C,EAG3C,OAH2C,EAI3C,SAJ2C,EAK3C,kBAL2C,EAM3C,oBAN2C,EAO3C,qBAP2C,EAQ3C,SAR2C,EAS3C,gBAT2C,EAU3C,QAV2C,EAW3C,eAX2C,EAY3C,UAZ2C,EAa3C,SAb2C,EAc3C,UAd2C,EAe3C,QAf2C,EAgB3C,SAhB2C,EAiB3C,WAjB2C,EAkB3C,kBAlB2C,EAmB3C,YAnB2C,EAoB3C,SApB2C,EAqB3C,SArB2C,EAsB3C,WAtB2C,EAuB3C,kBAvB2C,EAwB3C,kBAxB2C,EAyB3C,WAzB2C,EA0B3C,aA1B2C,EA2B3C,SA3B2C,EA4B3C,cA5B2C,EA6B3C,kBA7B2C,EA8B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C,OAAJ,CAAY,OAAZ,MAAyB,CAJ3B;;IAMA,IAAI,YAAY,KAAK,CAAC,iBAAD,IAAsB,CAAA,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAE,OAAnB,CAA2B,GAA3B,CAAA,MAAoC,CAAC,CAAhE,CAAhB,EAAoF;MAClF;MACA,MAAM,CAAC,GAAD,CAAN,GAAc,KAAM,CAAC,GAAD,CAApB;IACD;EACF;;EAED,OAAO,MAAP;AACD","sourcesContent":["const toObjectMap = (...items: (string[] | Record<string, number>)[]) => {\n const result: Record<string, number> = {};\n\n for (const item of items) {\n const keys = Array.isArray(item) ? item : Object.keys(item);\n\n for (const key of keys) {\n result[key] = 1;\n }\n }\n\n return result;\n};\n\n/**\n * An array of events that are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementEvents = toObjectMap([\n 'onAuxClick',\n 'onCopy',\n 'onCut',\n 'onPaste',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCompositionUpdate',\n 'onFocus',\n 'onFocusCapture',\n 'onBlur',\n 'onBlurCapture',\n 'onChange',\n 'onInput',\n 'onSubmit',\n 'onLoad',\n 'onError',\n 'onKeyDown',\n 'onKeyDownCapture',\n 'onKeyPress',\n 'onKeyUp',\n 'onAbort',\n 'onCanPlay',\n 'onCanPlayThrough',\n 'onDurationChange',\n 'onEmptied',\n 'onEncrypted',\n 'onEnded',\n 'onLoadedData',\n 'onLoadedMetadata',\n 'onLoadStart',\n 'onPause',\n 'onPlay',\n 'onPlaying',\n 'onProgress',\n 'onRateChange',\n 'onSeeked',\n 'onSeeking',\n 'onStalled',\n 'onSuspend',\n 'onTimeUpdate',\n 'onVolumeChange',\n 'onWaiting',\n 'onClick',\n 'onClickCapture',\n 'onContextMenu',\n 'onDoubleClick',\n 'onDrag',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragExit',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onMouseDown',\n 'onMouseDownCapture',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onMouseUpCapture',\n 'onSelect',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onScroll',\n 'onWheel',\n 'onPointerCancel',\n 'onPointerDown',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerMove',\n 'onPointerOut',\n 'onPointerOver',\n 'onPointerUp',\n 'onGotPointerCapture',\n 'onLostPointerCapture',\n]);\n\n/**\n * An array of element attributes which are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementProperties = toObjectMap([\n 'accessKey', // global\n 'children', // global\n 'className', // global\n 'contentEditable', // global\n 'dir', // global\n 'draggable', // global\n 'hidden', // global\n 'htmlFor', // global\n 'id', // global\n 'lang', // global\n 'ref', // global\n 'role', // global\n 'style', // global\n 'tabIndex', // global\n 'title', // global\n 'translate', // global\n 'spellCheck', // global\n 'name', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents);\n\n/**\n * An array of LABEL tag properties and events.\n *\n * @public\n */\nexport const labelProperties = toObjectMap(htmlElementProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of AUDIO tag properties and events.\n\n * @public\n */\nexport const audioProperties = toObjectMap(htmlElementProperties, [\n 'height', // canvas, embed, iframe, img, input, object, video\n 'loop', // audio, video\n 'muted', // audio, video\n 'preload', // audio, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of VIDEO tag properties and events.\n *\n * @public\n */\nexport const videoProperties = toObjectMap(audioProperties, [\n 'poster', // video\n]);\n\n/**\n * An array of OL tag properties and events.\n *\n * @public\n */\nexport const olProperties = toObjectMap(htmlElementProperties, [\n 'start', // ol\n]);\n\n/**\n * An array of LI tag properties and events.\n *\n * @public\n */\nexport const liProperties = toObjectMap(htmlElementProperties, [\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of A tag properties and events.\n *\n * @public\n */\nexport const anchorProperties = toObjectMap(htmlElementProperties, [\n 'download', // a, area\n 'href', // a, area, base, link\n 'hrefLang', // a, area, link\n 'media', // a, area, link, source, style\n 'rel', // a, area, link\n 'target', // a, area, base, form\n 'type', // a, button, input, link, menu, object, script, source, style\n]);\n\n/**\n * An array of TIME tag properties and events.\n *\n * @public\n */\nexport const timeProperties = toObjectMap(htmlElementProperties, [\n 'dateTime', // time\n]);\n\n/**\n * An array of BUTTON tag properties and events.\n *\n * @public\n */\nexport const buttonProperties = toObjectMap(htmlElementProperties, [\n 'autoFocus', // button, input, select, textarea\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'formAction', // input, button\n 'formEncType', // input, button\n 'formMethod', // input, button\n 'formNoValidate', // input, button\n 'formTarget', // input, button\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param,\n]);\n\n/**\n * An array of INPUT tag properties and events.\n *\n * @public\n */\nexport const inputProperties = toObjectMap(buttonProperties, [\n 'accept', // input\n 'alt', // area, img, input\n 'autoCapitalize', // input, textarea\n 'autoComplete', // form, input\n 'checked', // input\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'height', // canvas, embed, iframe, img, input, object, video\n 'inputMode', // input\n 'list', // input\n 'max', // input, meter\n 'maxLength', // input, textarea\n 'min', // input, meter\n 'multiple', // input, select\n 'pattern', // input\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'step', // input\n 'size', // input\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of TEXTAREA tag properties and events.\n *\n * @public\n */\nexport const textAreaProperties = toObjectMap(buttonProperties, [\n 'autoCapitalize', // input, textarea\n 'cols', // textarea\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'maxLength', // input, textarea\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'rows', // textarea\n 'wrap', // textarea\n]);\n\n/**\n * An array of SELECT tag properties and events.\n *\n * @public\n */\nexport const selectProperties = toObjectMap(buttonProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'multiple', // input, select\n 'required', // input, select, textarea\n]);\n\nexport const optionProperties = toObjectMap(htmlElementProperties, [\n 'selected', // option\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of TABLE tag properties and events.\n *\n * @public\n */\nexport const tableProperties = toObjectMap(htmlElementProperties, [\n 'cellPadding', // table\n 'cellSpacing', // table\n]);\n\n/**\n * An array of TR tag properties and events.\n *\n * @public\n */\nexport const trProperties = htmlElementProperties;\n\n/**\n * An array of TH tag properties and events.\n *\n * @public\n */\nexport const thProperties = toObjectMap(htmlElementProperties, [\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\n/**\n * An array of TD tag properties and events.\n *\n * @public\n */\nexport const tdProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td\n 'headers', // td\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\nexport const colGroupProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\nexport const colProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\n/**\n * An array of FIELDSET tag properties and events.\n *\n * @public\n */\nexport const fieldsetProperties = toObjectMap(htmlElementProperties, [\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of FORM tag properties and events.\n *\n * @public\n */\nexport const formProperties = toObjectMap(htmlElementProperties, [\n 'acceptCharset', // form\n 'action', // form\n 'encType', // form\n 'encType', // form\n 'method', // form\n 'noValidate', // form\n 'target', // form\n]);\n\n/**\n * An array of IFRAME tag properties and events.\n *\n * @public\n */\nexport const iframeProperties = toObjectMap(htmlElementProperties, [\n 'allow', // iframe\n 'allowFullScreen', // iframe\n 'allowPaymentRequest', // iframe\n 'allowTransparency', // iframe\n 'csp', // iframe\n 'height', // canvas, embed, iframe, img, input, object, video\n 'importance', // iframe\n 'referrerPolicy', // iframe\n 'sandbox', // iframe\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcDoc', // iframe\n 'width', // canvas, embed, iframe, img, input, object, video,\n]);\n\n/**\n * An array of IMAGE tag properties and events.\n *\n * @public\n */\nexport const imgProperties = toObjectMap(htmlElementProperties, [\n 'alt', // area, img, input\n 'crossOrigin', // img\n 'height', // canvas, embed, iframe, img, input, object, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcSet', // img, source\n 'useMap', // img, object,\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of DIV tag properties and events.\n *\n * @public\n */\nexport const divProperties = htmlElementProperties;\n\n/**\n * Gets native supported props for an html element provided the allowance set. Use one of the property\n * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given\n * props set. Note that all data- and aria- prefixed attributes will be allowed.\n * NOTE: getNativeProps should always be applied first when adding props to a react component. The\n * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.\n * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to\n * the component after an onClick function is added, then the getNativeProps onClick will override it.\n *\n * @public\n * @param props - The unfiltered input props\n * @param allowedPropNames - The array or record of allowed prop names.\n * @param excludedPropNames\n * @returns The filtered props\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeProps<T extends Record<string, any>>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>,\n allowedPropNames: string[] | Record<string, number>,\n excludedPropNames?: string[],\n): T {\n // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for\n // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.\n // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then\n // return native props.\n // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797\n\n const isArray = Array.isArray(allowedPropNames);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n const keys = Object.keys(props);\n\n for (const key of keys) {\n const isNativeProp =\n (!isArray && (allowedPropNames as Record<string, number>)[key]) ||\n (isArray && (allowedPropNames as string[]).indexOf(key) >= 0) ||\n key.indexOf('data-') === 0 ||\n key.indexOf('aria-') === 0;\n\n if (isNativeProp && (!excludedPropNames || excludedPropNames?.indexOf(key) === -1)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result[key] = props![key] as any;\n }\n }\n\n return result as T;\n}\n"],"sourceRoot":"../src/"}
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import { Space, Enter } from '@fluentui/keyboard-keys';
|
2
2
|
/**
|
3
|
+
* @internal
|
3
4
|
* Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
|
4
5
|
*
|
5
6
|
* Useful for situations where a keydown needs to be transformed to a click event
|
6
7
|
*/
|
7
8
|
|
8
9
|
export function shouldPreventDefaultOnKeyDown(e) {
|
10
|
+
if (e.defaultPrevented) {
|
11
|
+
return false;
|
12
|
+
}
|
13
|
+
|
9
14
|
const key = e.key;
|
10
15
|
const target = e.target;
|
11
16
|
const matchesByKey = key === Space || key === Enter;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["utils/shouldPreventDefaultOnKeyDown.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AAGA;;;;;AAKG;;AACH,OAAM,SAAU,6BAAV,CAAwC,CAAxC,EAA8E;EAClF,IAAI,CAAC,CAAC,gBAAN,EAAwB;IACtB,OAAO,KAAP;EACD;;EAED,MAAM,GAAG,GAAG,CAAC,CAAC,GAAd;EACA,MAAM,MAAM,GAA4B,CAAC,CAAC,MAA1C;EAEA,MAAM,YAAY,GAAG,GAAG,KAAK,KAAR,IAAiB,GAAG,KAAK,KAA9C;;EAEA,IAAI,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,GAAxB,EAA6B;IAC3B,OAAO,GAAG,KAAK,KAAf;EACD;;EAED,MAAM,YAAY,GAChB,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,OAApB,IAA+B,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,UAAnD,IAAiE,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,iBAAR,MAA8B,IADjG;EAGA,OAAO,YAAY,IAAI,CAAC,YAAxB;AACD","sourcesContent":["import { Space, Enter } from '@fluentui/keyboard-keys';\nimport * as React from 'react';\n\n/**\n * @internal\n * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys\n *\n * Useful for situations where a keydown needs to be transformed to a click event\n */\nexport function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React.KeyboardEvent) {\n if (e.defaultPrevented) {\n return false;\n }\n\n const key = e.key;\n const target: HTMLElement | undefined = e.target as HTMLElement;\n\n const matchesByKey = key === Space || key === Enter;\n\n if (target?.tagName === 'A') {\n return key === Space;\n }\n\n const ignoredByTag =\n target?.tagName === 'INPUT' || target?.tagName === 'TEXTAREA' || target?.isContentEditable === true;\n\n return matchesByKey && !ignoredByTag;\n}\n"],"s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AAsC,QAApF,GACV,MAAM,KAAI,CAAA,EAAA,GAAA,KAAK,CAAC,UAAN,MAAgB,IAAhB,IAAgB,EAAA,KAAA,KAAA,CAAhB,GAAgB,KAAA,CAAhB,GAAgB,EAAA,CAAG,QAAH,CAApB,CAAN,IAA0C,KADhC,GAEV,KAAK,CAAC,UAAN,CAAiB,QAAjB,CAFJ;;EAIA,IAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;IAClC,MAAM,MAAM,GAAG,QAAf;IACA,OAAO,CACL,KAAK,CAAC,QADD,EAEJ;MACC,QAAQ,EAAE,MAAM,CAAC,IAAD,EAAO,IAAP;IADjB,CAFI,CAAP;EAMD;;EAED,MAAM,gBAAgB,GAAG,OAAO,IAAP,KAAgB,QAAhB,KAA4B,CAAA,EAAA,GAAA,KAAK,CAAC,QAAD,CAAL,MAAe,IAAf,IAAe,EAAA,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAe,EAAA,CAAE,EAA7C,CAAzB;EACA,MAAM,SAAS,GAAI,gBAAgB,GAAG,MAAA,CAAA,IAAA,CAAK,KAAK,CAAC,QAAD,CAAV,EAAuB,CAAC,IAAD,CAAvB,CAAH,GAAoC,KAAK,CAAC,QAAD,CAA5E;EAEA,OAAO,CAAC,IAAD,EAAO,SAAP,CAAP;AACD","sourcesContent":["import * as React from 'react';\n\nimport { omit } from '../utils/omit';\nimport type {\n AsIntrinsicElement,\n ComponentState,\n ExtractSlotProps,\n SlotPropsRecord,\n SlotRenderFunction,\n UnionToIntersection,\n} from './types';\n\nexport type Slots<S extends SlotPropsRecord> = {\n [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // for slots with an `as` prop, the slot will be any one of the possible values of `as`\n As\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? React.ElementType<NonNullable<P>>\n : React.ElementType<ExtractSlotProps<S[K]>>;\n};\n\ntype ObjectSlotProps<S extends SlotPropsRecord> = {\n [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // For intrinsic element types, return the intersection of all possible\n // element's props, to be compatible with the As type returned by Slots<>\n UnionToIntersection<JSX.IntrinsicElements[As]>\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? P\n : never;\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: (slotProps as unknown) as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n if (state[slotName] === undefined) {\n return [null, undefined as R[K]];\n }\n const { children, as: asProp, ...rest } = state[slotName]!;\n\n const slot = (state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]) as React.ElementType<R[K]>;\n\n if (typeof children === 'function') {\n const render = children as SlotRenderFunction<R[K]>;\n return [\n React.Fragment,\n ({\n children: render(slot, rest as Omit<R[K], 'children' | 'as'>),\n } as unknown) as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && state[slotName]?.as;\n const slotProps = (shouldOmitAsProp ? omit(state[slotName]!, ['as']) : state[slotName]) as R[K];\n\n return [slot, slotProps];\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["compose/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["compose/resolveShorthand.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAkBA;;;;;AAKG;;;AACI,MAAM,gBAAgB,GAA6B,CAAC,KAAD,EAAQ,OAAR,KAAmB;EAC3E,MAAM;IAAE,QAAQ,GAAG,KAAb;IAAoB;EAApB,IAAqC,OAAO,IAAI,EAAtD;;EACA,IAAI,KAAK,KAAK,IAAV,IAAmB,KAAK,KAAK,SAAV,IAAuB,CAAC,QAA/C,EAA0D;IACxD,OAAO,SAAP;EACD;;EAED,IAAI,iBAAiB,GAAG,EAAxB;;EAEA,IAAI,OAAO,KAAP,KAAiB,QAAjB,IAA6B,OAAO,KAAP,KAAiB,QAA9C,IAA0D,KAAK,CAAC,OAAN,CAAc,KAAd,CAA1D,IAAkF,OAAA,CAAA,cAAA,CAAe,KAAf,CAAtF,EAA6G;IAC3G,iBAAiB,CAAC,QAAlB,GAA6B,KAA7B;EACD,CAFD,MAEO,IAAI,OAAO,KAAP,KAAiB,QAArB,EAA+B;IACpC,iBAAiB,GAAG,KAApB;EACD;;EAED,OAAO,YAAY,GAAG,EAAE,GAAG,YAAL;IAAmB,GAAG;EAAtB,CAAH,GAA+C,iBAAlE;AACD,CAfM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import { isValidElement } from 'react';\nimport type { ReplaceNullWithUndefined, SlotShorthandValue, UnknownSlotProps } from './types';\n\nexport type ResolveShorthandOptions<Props, Required extends boolean = false> = {\n required?: Required;\n defaultProps?: Props;\n};\n\nexport type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {\n <P extends Props | null>(\n value: P | SlotShorthandValue | undefined,\n options?: ResolveShorthandOptions<P, true>,\n ): ReplaceNullWithUndefined<P>;\n <P extends Props | null>(value: P | SlotShorthandValue | undefined, options?: ResolveShorthandOptions<P, boolean>):\n | ReplaceNullWithUndefined<P>\n | undefined;\n};\n\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand: ResolveShorthandFunction = (value, options) => {\n const { required = false, defaultProps } = options || {};\n if (value === null || (value === undefined && !required)) {\n return undefined;\n }\n\n let resolvedShorthand = {} as UnknownSlotProps;\n\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = value;\n }\n\n return defaultProps ? { ...defaultProps, ...resolvedShorthand } : resolvedShorthand;\n};\n"],"sourceRoot":"../src/"}
|
@@ -2,9 +2,5 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
|
-
});
|
6
|
-
// the props type with this version (and it's likely much more expensive to evaluate)
|
7
|
-
// export type ForwardRefComponent<Props> = Props extends React.DOMAttributes<infer Element>
|
8
|
-
// ? React.ForwardRefExoticComponent<Props> & React.RefAttributes<Element>
|
9
|
-
// : never;
|
5
|
+
});
|
10
6
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
|
@@ -8,14 +8,12 @@ const tslib_1 = /*#__PURE__*/require("tslib");
|
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./useControllableState"), exports);
|
10
10
|
|
11
|
-
tslib_1.__exportStar(require("./useBoolean"), exports);
|
12
|
-
|
13
|
-
tslib_1.__exportStar(require("./useConst"), exports);
|
14
|
-
|
15
11
|
tslib_1.__exportStar(require("./useEventCallback"), exports);
|
16
12
|
|
17
13
|
tslib_1.__exportStar(require("./useFirstMount"), exports);
|
18
14
|
|
15
|
+
tslib_1.__exportStar(require("./useForceUpdate"), exports);
|
16
|
+
|
19
17
|
tslib_1.__exportStar(require("./useId"), exports);
|
20
18
|
|
21
19
|
tslib_1.__exportStar(require("./useIsomorphicLayoutEffect"), exports);
|
@@ -24,8 +22,6 @@ tslib_1.__exportStar(require("./useMergedEventCallbacks"), exports);
|
|
24
22
|
|
25
23
|
tslib_1.__exportStar(require("./useMergedRefs"), exports);
|
26
24
|
|
27
|
-
tslib_1.__exportStar(require("./useMount"), exports);
|
28
|
-
|
29
25
|
tslib_1.__exportStar(require("./useOnClickOutside"), exports);
|
30
26
|
|
31
27
|
tslib_1.__exportStar(require("./useOnScrollOutside"), exports);
|
@@ -33,8 +29,4 @@ tslib_1.__exportStar(require("./useOnScrollOutside"), exports);
|
|
33
29
|
tslib_1.__exportStar(require("./usePrevious"), exports);
|
34
30
|
|
35
31
|
tslib_1.__exportStar(require("./useTimeout"), exports);
|
36
|
-
|
37
|
-
tslib_1.__exportStar(require("./useUnmount"), exports);
|
38
|
-
|
39
|
-
tslib_1.__exportStar(require("./useForceUpdate"), exports);
|
40
32
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,6BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedEventCallbacks';\nexport * from './useMergedRefs';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useTimeout';\n"],"sourceRoot":"../src/"}
|
@@ -7,12 +7,12 @@ exports.useControllableState = void 0;
|
|
7
7
|
|
8
8
|
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
const useConst_1 = /*#__PURE__*/require("./useConst");
|
11
|
-
|
12
10
|
function isFactoryDispatch(newState) {
|
13
11
|
return typeof newState === 'function';
|
14
12
|
}
|
15
13
|
/**
|
14
|
+
* @internal
|
15
|
+
*
|
16
16
|
* A `useState`-like hook to manage a value that could be either controlled or uncontrolled,
|
17
17
|
* such as a checked state or text input string.
|
18
18
|
*
|
@@ -61,7 +61,7 @@ exports.useControllableState = useControllableState;
|
|
61
61
|
*/
|
62
62
|
|
63
63
|
const useIsControlled = controlledValue => {
|
64
|
-
const isControlled =
|
64
|
+
const [isControlled] = React.useState(() => controlledValue !== undefined);
|
65
65
|
|
66
66
|
if (process.env.NODE_ENV !== 'production') {
|
67
67
|
// We don't want these warnings in production even though it is against native behaviour
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useControllableState.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAqBA,SAAS,iBAAT,CAAkC,QAAlC,EAAuE;EACrE,OAAO,OAAO,QAAP,KAAoB,UAA3B;AACD;AAED;;;;;;;;;;;;;;;AAeG;;;AACI,MAAM,oBAAoB,GAC/B,OADkC,IAEsB;EACxD,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,KAAT,CAApC;EACA,MAAM,YAAY,GAAG,OAAO,OAAO,CAAC,YAAf,KAAgC,WAAhC,GAA8C,OAAO,CAAC,YAAtD,GAAqE,OAAO,CAAC,YAAlG;EACA,MAAM,CAAC,aAAD,EAAgB,gBAAhB,IAAoC,KAAK,CAAC,QAAN,CAAsB,YAAtB,CAA1C;EAEA,MAAM,KAAK,GAAG,YAAY,GAAI,OAAO,CAAC,KAAZ,GAA8B,aAAxD;EAEA,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAN,CAAa,KAAb,CAAjB;EACA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,QAAQ,CAAC,OAAT,GAAmB,KAAnB;EACD,CAFD,EAEG,CAAC,KAAD,CAFH,EARw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react';\n\n/**\n * @internal\n */\nexport type UseControllableStateOptions<State> = {\n /**\n * User-provided default state or initializer, for uncontrolled usage.\n */\n defaultState?: State | (() => State);\n /**\n * User-provided controlled state. `undefined` means internal state will be used.\n */\n state: State | undefined;\n /**\n * Used as the initial state if `state` and `defaultState` are both `undefined`.\n * If `undefined` is the correct initial state, pass that here.\n */\n initialState: State;\n};\n\nfunction isFactoryDispatch<State>(newState: React.SetStateAction<State>): newState is (prevState: State) => State {\n return typeof newState === 'function';\n}\n\n/**\n * @internal\n *\n * A `useState`-like hook to manage a value that could be either controlled or uncontrolled,\n * such as a checked state or text input string.\n *\n * Unlike `setState`, it's okay to call the returned updater (dispatch) function for either a\n * controlled or uncontrolled component. Calls will only be respected if the component is uncontrolled.\n *\n * @returns Same as [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate): an array\n * of the current value and an updater (dispatch) function. The updater function is referentially\n * stable (won't change during the component's lifecycle). It can take either a new value, or a\n * function which is passed the previous value and returns the new value. Unlike `setState`, calls\n * to the updater function will only be respected if the component is uncontrolled.\n * @see https://reactjs.org/docs/uncontrolled-components.html\n */\nexport const useControllableState = <State>(\n options: UseControllableStateOptions<State>,\n): [State, React.Dispatch<React.SetStateAction<State>>] => {\n const isControlled = useIsControlled(options.state);\n const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState;\n const [internalState, setInternalState] = React.useState<State>(initialState);\n\n const state = isControlled ? (options.state as State) : internalState;\n\n const stateRef = React.useRef(state);\n React.useEffect(() => {\n stateRef.current = state;\n }, [state]);\n\n // To match the behavior of the setter returned by React.useState, this callback's identity\n // should never change. This means it MUST NOT directly reference variables that can change.\n const setState = React.useCallback((newState: React.SetStateAction<State>) => {\n // React dispatch can use a factory\n // https://reactjs.org/docs/hooks-reference.html#functional-updates\n if (isFactoryDispatch(newState)) {\n stateRef.current = newState(stateRef.current);\n } else {\n stateRef.current = newState;\n }\n\n setInternalState(stateRef.current);\n }, []);\n\n return [state, setState];\n};\n\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */\nconst useIsControlled = (controlledValue: unknown) => {\n const [isControlled] = React.useState<boolean>(() => controlledValue !== undefined);\n\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n\n const controlWarning = isControlled\n ? 'a controlled value to be uncontrolled'\n : 'an uncontrolled value to be controlled';\n\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n\n // eslint-disable-next-line no-console\n console.error(\n [\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value',\n 'changing from ' + undefinedWarning + ' value, which should not happen.',\n 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.',\n 'More info: https://reactjs.org/link/controlled-components',\n error.stack,\n ].join(' '),\n );\n }\n }, [isControlled, controlledValue]);\n }\n\n return isControlled;\n};\n"],"sourceRoot":"../src/"}
|
@@ -9,6 +9,7 @@ const React = /*#__PURE__*/require("react");
|
|
9
9
|
|
10
10
|
const useIsomorphicLayoutEffect_1 = /*#__PURE__*/require("./useIsomorphicLayoutEffect");
|
11
11
|
/**
|
12
|
+
* @internal
|
12
13
|
* https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback
|
13
14
|
*
|
14
15
|
* Modified `useCallback` that can be used when dependencies change too frequently. Can occur when
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useEventCallback.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,2BAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;;;;;;AAYG;;;AACI,MAAM,gBAAgB,GAAoC,EAAjC,IAAkE;EAChG,MAAM,WAAW,GAAG,KAAK,CAAC,MAAN,CAAwB,MAAK;IAC/C,MAAM,IAAI,KAAJ,CAAU,8CAAV,CAAN;EACD,CAFmB,CAApB;EAIA,2BAAA,CAAA,yBAAA,CAA0B,MAAK;IAC7B,WAAW,CAAC,OAAZ,GAAsB,EAAtB;EACD,CAFD,EAEG,CAAC,EAAD,CAFH;EAIA,OAAO,KAAK,CAAC,WAAN,CACL,CAAC,GAAG,IAAJ,KAAkB;IAChB,MAAM,QAAQ,GAAG,WAAW,CAAC,OAA7B;IACA,OAAO,QAAQ,CAAC,GAAG,IAAJ,CAAf;EACD,CAJI,EAKL,CAAC,WAAD,CALK,CAAP;AAOD,CAhBM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\n/**\n * @internal\n * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n *\n * Modified `useCallback` that can be used when dependencies change too frequently. Can occur when\n * e.g. user props are dependencies which could change on every render\n * e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently\n *\n * This should not be used often, but can be a useful re-render optimization since the callback is a ref and\n * will not be invalidated between re-renders\n *\n * @param fn - The callback function that will be used\n */\nexport const useEventCallback = <Args extends unknown[], Return>(fn: (...args: Args) => Return) => {\n const callbackRef = React.useRef<typeof fn>(() => {\n throw new Error('Cannot call an event handler while rendering');\n });\n\n useIsomorphicLayoutEffect(() => {\n callbackRef.current = fn;\n }, [fn]);\n\n return React.useCallback(\n (...args: Args) => {\n const callback = callbackRef.current;\n return callback(...args);\n },\n [callbackRef],\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -7,6 +7,7 @@ exports.useFirstMount = void 0;
|
|
7
7
|
|
8
8
|
const React = /*#__PURE__*/require("react");
|
9
9
|
/**
|
10
|
+
* @internal
|
10
11
|
* Checks if components was mounted the first time.
|
11
12
|
* Since concurrent mode will be released in the future this needs to be verified
|
12
13
|
* Currently (React 17) will always render the initial mount once
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useFirstMount.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAEA;;;;;;;;;;AAUG;;;AACH,SAAgB,aAAhB,GAA6B;EAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAN,CAAa,IAAb,CAAhB;;EAEA,IAAI,OAAO,CAAC,OAAZ,EAAqB;IACnB,OAAO,CAAC,OAAR,GAAkB,KAAlB;IACA,OAAO,IAAP;EACD;;EAED,OAAO,OAAO,CAAC,OAAf;AACD;;AATD,OAAA,CAAA,aAAA,GAAA,aAAA","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Checks if components was mounted the first time.\n * Since concurrent mode will be released in the future this needs to be verified\n * Currently (React 17) will always render the initial mount once\n * https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx\n * https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx\n *\n * @example\n * const isFirstMount = useFirstMount();\n */\nexport function useFirstMount(): boolean {\n const isFirst = React.useRef(true);\n\n if (isFirst.current) {\n isFirst.current = false;\n return true;\n }\n\n return isFirst.current;\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useForceUpdate.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,cAAhB,GAA8B;EAC5B,OAAO,OAAA,CAAA,UAAA,CAAW,CAAC,IAAI,CAAC,GAAG,CAApB,EAAuB,CAAvB,EAA0B,CAA1B,CAAP;AACD;;AAFD,OAAA,CAAA,cAAA,GAAA,cAAA","sourcesContent":["import { useReducer } from 'react';\n\n/**\n * @internal\n * Forces a re-render, similar to `forceUpdate` in class components.\n */\nexport function useForceUpdate() {\n return useReducer(x => x + 1, 0)[1];\n}\n"],"sourceRoot":"../src/"}
|
@@ -10,8 +10,6 @@ const React = /*#__PURE__*/require("react");
|
|
10
10
|
const index_1 = /*#__PURE__*/require("../ssr/index");
|
11
11
|
/**
|
12
12
|
* Resets generated IDs, should be used only in tests.
|
13
|
-
*
|
14
|
-
* @private
|
15
13
|
*/
|
16
14
|
|
17
15
|
|
@@ -23,15 +21,21 @@ exports.resetIdsForTests = resetIdsForTests;
|
|
23
21
|
/**
|
24
22
|
* Hook to generate a unique ID.
|
25
23
|
*
|
26
|
-
* @param prefix - Optional prefix for the ID
|
24
|
+
* @param prefix - Optional prefix for the ID. Defaults to 'fui-'.
|
27
25
|
* @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,
|
28
26
|
* without conditioning the hook call
|
29
27
|
* @returns The ID
|
30
28
|
*/
|
31
29
|
|
32
|
-
function useId(prefix, providedId) {
|
30
|
+
function useId(prefix = 'fui-', providedId) {
|
33
31
|
const contextValue = index_1.useSSRContext();
|
34
|
-
return React.useMemo(() =>
|
32
|
+
return React.useMemo(() => {
|
33
|
+
if (providedId) {
|
34
|
+
return providedId;
|
35
|
+
}
|
36
|
+
|
37
|
+
return `${prefix}${++contextValue.current}`;
|
38
|
+
}, [prefix, providedId, contextValue]);
|
35
39
|
}
|
36
40
|
|
37
41
|
exports.useId = useId;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useId.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAEA;;AAEG;;;AACH,SAAgB,gBAAhB,GAAgC;EAC9B,OAAA,CAAA,sBAAA,CAAuB,OAAvB,GAAiC,CAAjC;AACD;;AAFD,OAAA,CAAA,gBAAA,GAAA,gBAAA;AAIA;;;;;;;AAOG;;AACH,SAAgB,KAAhB,CAAsB,MAAA,GAAiB,MAAvC,EAA+C,UAA/C,EAAkE;EAChE,MAAM,YAAY,GAAG,OAAA,CAAA,aAAA,EAArB;EAEA,OAAO,KAAK,CAAC,OAAN,CAAc,MAAK;IACxB,IAAI,UAAJ,EAAgB;MACd,OAAO,UAAP;IACD;;IAED,OAAO,GAAG,MAAM,GAAG,EAAE,YAAY,CAAC,OAAO,EAAzC;EACD,CANM,EAMJ,CAAC,MAAD,EAAS,UAAT,EAAqB,YAArB,CANI,CAAP;AAOD;;AAVD,OAAA,CAAA,KAAA,GAAA,KAAA","sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\n\n/**\n * Resets generated IDs, should be used only in tests.\n */\nexport function resetIdsForTests(): void {\n defaultSSRContextValue.current = 0;\n}\n\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix: string = 'fui-', providedId?: string): string {\n const contextValue = useSSRContext();\n\n return React.useMemo(() => {\n if (providedId) {\n return providedId;\n }\n\n return `${prefix}${++contextValue.current}`;\n }, [prefix, providedId, contextValue]);\n}\n"],"sourceRoot":"../src/"}
|
@@ -9,6 +9,7 @@ const React = /*#__PURE__*/require("react");
|
|
9
9
|
|
10
10
|
const index_1 = /*#__PURE__*/require("../ssr/index");
|
11
11
|
/**
|
12
|
+
* @internal
|
12
13
|
* React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally
|
13
14
|
* useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to
|
14
15
|
* ensure we don't get a render flash for certain operations, but we may also need affected components to render on
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAEA;;;;;;;;;AASG;AACH;;;AACa,OAAA,CAAA,yBAAA,GAAoD,aAAA,OAAA,CAAA,SAAA,KAAc,KAAK,CAAC,eAApB,GAAsC,KAAK,CAAC,SAAhG","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../ssr/index';\n\n/**\n * @internal\n * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally\n * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to\n * ensure we don't get a render flash for certain operations, but we may also need affected components to render on\n * the server.\n *\n * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js\n */\n// eslint-disable-next-line no-restricted-properties\nexport const useIsomorphicLayoutEffect: typeof React.useEffect = canUseDOM() ? React.useLayoutEffect : React.useEffect;\n"],"sourceRoot":"../src/"}
|
@@ -7,6 +7,7 @@ exports.useMergedEventCallbacks = void 0;
|
|
7
7
|
|
8
8
|
const useEventCallback_1 = /*#__PURE__*/require("./useEventCallback");
|
9
9
|
/**
|
10
|
+
* @internal
|
10
11
|
* Combine two event callbacks into a single callback function that calls each one in order.
|
11
12
|
*
|
12
13
|
* This is useful to add an event listener to an existing element without overwriting the current listener, if any.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useMergedEventCallbacks.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAEA;;;;;;;;;;;;;;;;;AAiBG;;;AACH,SAAgB,uBAAhB,CACE,SADF,EAEE,SAFF,EAEkD;EAEhD,OAAO,kBAAA,CAAA,gBAAA,CAAiB,CAAC,GAAG,IAAJ,KAAkB;IACxC,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,GAAG,IAAN,CAAT;IACA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,GAAG,IAAN,CAAT;EACD,CAHM,CAAP;AAID;;AARD,OAAA,CAAA,uBAAA,GAAA,uBAAA","sourcesContent":["import { useEventCallback } from './useEventCallback';\n\n/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * This is useful to add an event listener to an existing element without overwriting the current listener, if any.\n *\n * For example:\n * ```ts\n * state.slot.onChange = useMergedCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * @param callback1 - The first callback to be called\n * @param callback2 - The second callback to be called\n *\n * @returns An event callback that calls the callbacks in order, and is stable between renders\n */\nexport function useMergedEventCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return useEventCallback((...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n });\n}\n"],"sourceRoot":"../src/"}
|
@@ -7,6 +7,7 @@ exports.useMergedRefs = void 0;
|
|
7
7
|
|
8
8
|
const React = /*#__PURE__*/require("react");
|
9
9
|
/**
|
10
|
+
* @internal
|
10
11
|
* React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that
|
11
12
|
* updates all provided refs
|
12
13
|
* @param refs - Refs to collectively update with one ref value.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useMergedRefs.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AASA;;;;;;AAMG;;;AACH,SAAgB,aAAhB,CAAiC,GAAG,IAApC,EAAsE;EACpE,MAAM,cAAc,GAA0B,KAAK,CAAC,WAAN,CAC3C,KAAD,IAAa;IACX;IACE,cAAwD,CAAC,OAAzD,GAAmE,KAAnE;;IAEF,KAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;MACtB,IAAI,OAAO,GAAP,KAAe,UAAnB,EAA+B;QAC7B,GAAG,CAAC,KAAD,CAAH;MACD,CAFD,MAEO,IAAI,GAAJ,EAAS;QACd;QACE,GAA6C,CAAC,OAA9C,GAAwD,KAAxD;MACH;IACF;EACF,CAb2C,EAc5C;EACA,CAAC,GAAG,IAAJ,CAf4C,CAA9C;EAkBA,OAAO,cAAP;AACD;;AApBD,OAAA,CAAA,aAAA,GAAA,aAAA","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\n/**\n * @internal\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = (React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n ((mergedCallback as unknown) as React.MutableRefObject<T>).current = value;\n\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n ((ref as unknown) as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown) as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"],"sourceRoot":"../src/"}
|
@@ -9,6 +9,7 @@ const React = /*#__PURE__*/require("react");
|
|
9
9
|
|
10
10
|
const useEventCallback_1 = /*#__PURE__*/require("./useEventCallback");
|
11
11
|
/**
|
12
|
+
* @internal
|
12
13
|
* Utility to perform checks where a click/touch event was made outside a component
|
13
14
|
*/
|
14
15
|
|
@@ -128,7 +129,7 @@ const useIFrameFocus = (enableFrameFocusDispatch, targetDocument, callback, poll
|
|
128
129
|
timeoutRef.current = (_a = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) === null || _a === void 0 ? void 0 : _a.setInterval(() => {
|
129
130
|
const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
|
130
131
|
|
131
|
-
if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME') {
|
132
|
+
if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
|
132
133
|
const event = new CustomEvent(FUI_FRAME_EVENT, {
|
133
134
|
bubbles: true
|
134
135
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useOnClickOutside.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AA8BA;;AAEG;;;AACI,MAAM,iBAAiB,GAAI,OAAD,IAA8C;AAC7E,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA,QAAR;AAAkB,IAAA,OAAlB;AAA2B,IAAA,QAA3B;AAAqC,IAAA,QAAQ,EAAE;AAA/C,MAAgE,OAAtE;AACA,QAAM,SAAS,GAAG,KAAK,CAAC,MAAN,CAAiC,SAAjC,CAAlB;AACA,EAAA,cAAc,CAAC,CAAC,QAAF,EAAY,OAAZ,EAAqB,QAArB,CAAd;AAEA,QAAM,QAAQ,GAAG,kBAAA,CAAA,gBAAA,CAAkB,EAAD,IAAgC;AAChE,UAAM,QAAQ,GACZ,YAAY,KAAK,CAAC,MAAD,EAAS,KAAT,KAAmB,CAAC,EAAC,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GA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d,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,WAAF,CAAc,MAAK;QACjE,MAAM,aAAa,GAAG,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,aAAtC;;QACA,IAAI,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,OAAf,MAA2B,QAA3B,IAAuC,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,OAAf,MAA2B,SAAtE,EAAiF;UAC/E,MAAM,KAAK,GAAG,IAAI,WAAJ,CAAgB,eAAhB,EAAiC;YAAE,OAAO,EAAE;UAAX,CAAjC,CAAd;UACA,aAAa,CAAC,aAAd,CAA4B,KAA5B;QACD;MACF,CAN+C,EAM7C,YAN6C,CAAhD;IAOD;;IACD,OAAO,MAAK;;;MACV,CAAA,EAAA,GAAA,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,YAAF,CAAe,UAAU,CAAC,OAA1B,CAA3B;IACD,CAFD;EAGD,CAbD,EAaG,CAAC,cAAD,EAAiB,wBAAjB,EAA2C,YAA3C,CAbH;AAcD,CAvCD","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n\n/**\n * @internal\n */\nexport type UseOnClickOrScrollOutsideOptions = {\n /**\n * The element to listen for the click event\n */\n element: Document | undefined;\n /**\n * Refs to elements that check if the click is outside\n */\n refs: React.MutableRefObject<HTMLElement | undefined | null>[];\n\n /**\n * By default uses element.contains, but custom contain function can be provided\n * @param parentRef - provided parent ref\n * @param child - event target element\n */\n contains?(parent: HTMLElement | null, child: HTMLElement): boolean;\n\n /**\n * Disables event listeners\n */\n disabled?: boolean;\n\n /**\n * Called if the click is outside the element refs\n */\n callback: (ev: MouseEvent | TouchEvent) => void;\n};\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const timeoutId = React.useRef<number | undefined>(undefined);\n useIFrameFocus(!disabled, element, callback as (e: Event) => void);\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n\n const conditionalHandler = (event: MouseEvent | TouchEvent) => {\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n\n listener(event);\n };\n\n if (!disabled) {\n // use capture phase because React can update DOM before the event bubbles to the document\n element?.addEventListener('click', conditionalHandler, true);\n element?.addEventListener('touchstart', conditionalHandler, true);\n element?.addEventListener('contextmenu', conditionalHandler, true);\n }\n\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(() => {\n currentEvent = undefined;\n }, 1);\n\n return () => {\n element?.removeEventListener('click', conditionalHandler, true);\n element?.removeEventListener('touchstart', conditionalHandler, true);\n element?.removeEventListener('contextmenu', conditionalHandler, true);\n\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\n\nconst getWindowEvent = (target: Node | Window): Event | undefined => {\n if (target) {\n if (typeof (target as Window).window === 'object' && (target as Window).window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return (target as Node).ownerDocument?.defaultView?.event ?? undefined;\n }\n\n return undefined;\n};\n\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n *\n * @param enableFrameFocusDispatch - boolean flag to start dispatching events\n * @param targetDocument - the document to dispatch events and set timeouts\n * @param pollDuration - in milliseconds\n */\nconst useIFrameFocus = (\n enableFrameFocusDispatch: boolean,\n targetDocument: Document | undefined,\n callback: (e: Event) => void,\n pollDuration: number = 1000,\n) => {\n const timeoutRef = React.useRef<number>();\n\n const listener = useEventCallback((e: Event) => {\n if (callback) {\n callback(e);\n }\n });\n\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n }\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [targetDocument, enableFrameFocusDispatch, listener]);\n\n // Starts polling for the active element\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement?.tagName === 'IFRAME' || activeElement?.tagName === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, { bubbles: true });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n }\n return () => {\n targetDocument?.defaultView?.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, enableFrameFocusDispatch, pollDuration]);\n};\n"],"sourceRoot":"../src/"}
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;IAED,OAAO,MAAK;MACV,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,mBAAT,CAA6B,OAA7B,EAAsC,QAAtC,CAAA;MACA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,mBAAT,CAA6B,WAA7B,EAA0C,QAA1C,CAAA;IACD,CAHD;EAID,CAVD,EAUG,CAAC,QAAD,EAAW,OAAX,EAAoB,QAApB,CAVH;AAWD,CAxBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n if (!disabled) {\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n }\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/usePrevious.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,WAAW,GAAyB,KAAtB,IAA0C;EACnE,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAA+B,IAA/B,CAAZ;EACA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,GAAG,CAAC,OAAJ,GAAc,KAAd;EACD,CAFD,EAEG,CAAC,KAAD,CAFH;EAGA,OAAO,GAAG,CAAC,OAAX;AACD,CANM;;AAAM,OAAA,CAAA,WAAA,GAAW,WAAX","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n */\nexport const usePrevious = <ValueType = unknown>(value: ValueType) => {\n const ref = React.useRef<ValueType | null>(null);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n};\n"],"sourceRoot":"../src/"}
|
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.useTimeout = void 0;
|
7
7
|
|
8
8
|
const React = /*#__PURE__*/require("react");
|
9
|
-
|
10
|
-
const useConst_1 = /*#__PURE__*/require("./useConst");
|
11
9
|
/**
|
10
|
+
* @internal
|
12
11
|
* Helper to manage a browser timeout.
|
13
12
|
* Ensures that the timeout isn't set multiple times at once,
|
14
13
|
* and is cleaned up when the component is unloaded.
|
@@ -18,7 +17,7 @@ const useConst_1 = /*#__PURE__*/require("./useConst");
|
|
18
17
|
|
19
18
|
|
20
19
|
function useTimeout() {
|
21
|
-
const timeout =
|
20
|
+
const [timeout] = React.useState(() => ({
|
22
21
|
id: undefined,
|
23
22
|
set: (fn, delay) => {
|
24
23
|
timeout.clear();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["hooks/useTimeout.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAEA;;;;;;;AAOG;;;AACH,SAAgB,UAAhB,GAA0B;EACxB,MAAM,CAAC,OAAD,IAAY,KAAK,CAAC,QAAN,CAAe,OAAO;IACtC,EAAE,EAAE,SADkC;IAEtC,GAAG,EAAE,CAAC,EAAD,EAAiB,KAAjB,KAAkC;MACrC,OAAO,CAAC,KAAR;MACA,OAAO,CAAC,EAAR,GAAa,UAAU,CAAC,EAAD,EAAK,KAAL,CAAvB;IACD,CALqC;IAMtC,KAAK,EAAE,MAAK;MACV,IAAI,OAAO,CAAC,EAAR,KAAe,SAAnB,EAA8B;QAC5B,YAAY,CAAC,OAAO,CAAC,EAAT,CAAZ;QACA,OAAO,CAAC,EAAR,GAAa,SAAb;MACD;IACF;EAXqC,CAAP,CAAf,CAAlB,CADwB,CAexB;;EACA,KAAK,CAAC,SAAN,CAAgB,MAAM,OAAO,CAAC,KAA9B,EAAqC,CAAC,OAAD,CAArC;EAEA,OAAO,CAAC,OAAO,CAAC,GAAT,EAAc,OAAO,CAAC,KAAtB,CAAP;AACD;;AAnBD,OAAA,CAAA,UAAA,GAAA,UAAA","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const [timeout] = React.useState(() => ({\n id: undefined as ReturnType<typeof setTimeout> | undefined,\n set: (fn: () => void, delay: number) => {\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: () => {\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n },\n }));\n\n // Clean up the timeout when the component is unloaded\n React.useEffect(() => timeout.clear, [timeout]);\n\n return [timeout.set, timeout.clear] as const;\n}\n"],"sourceRoot":"../src/"}
|