@fluentui/react-utilities 0.0.0-nightly-20230317-0436.1 → 0.0.0-nightly-20230317-1454.1
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/.swcrc +39 -0
- package/CHANGELOG.json +5 -5
- package/CHANGELOG.md +5 -5
- package/lib/compose/getSlots.js +6 -7
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.js +4 -4
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js +2 -2
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- package/lib/compose/resolveShorthand.js +3 -3
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/types.js +1 -1
- package/lib/compose/types.js.map +1 -1
- package/lib/events/index.js +1 -1
- package/lib/events/index.js.map +1 -1
- package/lib/events/mouseTouchHelpers.js +5 -4
- package/lib/events/mouseTouchHelpers.js.map +1 -1
- package/lib/hooks/index.js +12 -12
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableState.js +7 -7
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js +3 -3
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +1 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js +6 -6
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +3 -4
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js +2 -2
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +20 -23
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +7 -7
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useScrollbarWidth.js +5 -5
- package/lib/hooks/useScrollbarWidth.js.map +1 -1
- package/lib/hooks/useTimeout.js +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/ssr/SSRContext.js +5 -6
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js +2 -3
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/ssr/index.js +2 -2
- package/lib/ssr/index.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js +2 -2
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/index.js +4 -4
- package/lib/trigger/index.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js +1 -0
- package/lib/trigger/isFluentTrigger.js.map +1 -1
- package/lib/trigger/types.js +1 -1
- package/lib/trigger/types.js.map +1 -1
- package/lib/utils/clamp.js +1 -2
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +4 -4
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +6 -7
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js +3 -2
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/index.js +8 -8
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isHTMLElement.js +2 -4
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js +5 -5
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/mergeCallbacks.js +3 -4
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js +1 -2
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +28 -55
- package/lib/utils/properties.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js +47 -55
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.js +8 -7
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
- package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js +25 -32
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.js +5 -2
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/events/index.js +5 -4
- package/lib-commonjs/events/index.js.map +1 -1
- package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
- package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
- package/lib-commonjs/hooks/index.js +16 -15
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +63 -64
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +25 -31
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +15 -23
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +9 -11
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +48 -47
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +25 -27
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +109 -115
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +33 -36
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +17 -15
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
- package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +30 -30
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +52 -214
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js +56 -59
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js +12 -12
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js +6 -5
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.js +16 -36
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
- package/lib-commonjs/trigger/index.js +8 -7
- package/lib-commonjs/trigger/index.js.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
- package/lib-commonjs/trigger/types.js +5 -2
- package/lib-commonjs/trigger/types.js.map +1 -1
- package/lib-commonjs/utils/clamp.js +10 -9
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +54 -61
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js +24 -24
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +12 -11
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js +12 -12
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.js +14 -13
- package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
- package/lib-commonjs/utils/omit.js +18 -17
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +327 -223
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/package.json +4 -4
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["toObjectMap","items","result","item","keys","Array","isArray","Object","key","baseElementEvents","baseElementProperties","microdataProperties","htmlElementProperties","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","timeProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","dialogProperties","divProperties","getNativeProps","props","allowedPropNames","excludedPropNames","isNativeProp","indexOf"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/properties.ts"],"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 microdata attributes that are allowed on every html element type.\n *\n * @public\n */\nexport const microdataProperties = toObjectMap([\n 'itemID', // global\n 'itemProp', // global\n 'itemRef', // global\n 'itemScope', // global\n 'itemType', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);\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 'colSpan', // td, th\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 DIALOG tag properties and events.\n *\n * @public\n */\nexport const dialogProperties = toObjectMap(htmlElementProperties, ['open', 'onCancel', 'onClose']);\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"],"mappings":"AAAA,MAAMA,WAAW,GAAGA,CAAC,GAAGC,KAA4C,KAAI;E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AG,CAAQ;;;EAIpC,OAAON,MAAW;AACpB"}
|
1
|
+
{"version":3,"names":["toObjectMap","items","result","item","keys","Array","isArray","Object","key","baseElementEvents","baseElementProperties","microdataProperties","htmlElementProperties","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","timeProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","dialogProperties","divProperties","getNativeProps","props","allowedPropNames","excludedPropNames","isNativeProp","indexOf"],"sources":["../../src/utils/properties.ts"],"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 microdata attributes that are allowed on every html element type.\n *\n * @public\n */\nexport const microdataProperties = toObjectMap([\n 'itemID', // global\n 'itemProp', // global\n 'itemRef', // global\n 'itemScope', // global\n 'itemType', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);\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 'colSpan', // td, th\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 DIALOG tag properties and events.\n *\n * @public\n */\nexport const dialogProperties = toObjectMap(htmlElementProperties, ['open', 'onCancel', 'onClose']);\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"],"mappings":"AAAA,MAAMA,WAAA,GAAcA,CAAC,GAAGC,KAAA,KAAiD;EACvE,MAAMC,MAAA,GAAiC,CAAC;EAExC,KAAK,MAAMC,IAAA,IAAQF,KAAA,EAAO;IACxB,MAAMG,IAAA,GAAOC,KAAA,CAAMC,OAAO,CAACH,IAAA,IAAQA,IAAA,GAAOI,MAAA,CAAOH,IAAI,CAACD,IAAA,CAAK;IAE3D,KAAK,MAAMK,GAAA,IAAOJ,IAAA,EAAM;MACtBF,MAAM,CAACM,GAAA,CAAI,GAAG;IAChB;EACF;EAEA,OAAON,MAAA;AACT;AAEA;;;;;AAKA,OAAO,MAAMO,iBAAA,gBAAoBT,WAAA,CAAY,CAC3C,cACA,UACA,SACA,WACA,oBACA,sBACA,uBACA,WACA,kBACA,UACA,iBACA,YACA,WACA,YACA,UACA,WACA,aACA,oBACA,cACA,WACA,WACA,aACA,oBACA,oBACA,aACA,eACA,WACA,gBACA,oBACA,eACA,WACA,UACA,aACA,cACA,gBACA,YACA,aACA,aACA,aACA,gBACA,kBACA,aACA,WACA,kBACA,iBACA,iBACA,UACA,aACA,eACA,cACA,eACA,cACA,eACA,UACA,eACA,sBACA,gBACA,gBACA,eACA,cACA,eACA,aACA,oBACA,YACA,iBACA,cACA,eACA,gBACA,YACA,WACA,mBACA,iBACA,kBACA,kBACA,iBACA,gBACA,iBACA,eACA,uBACA,uBACD;AAED;;;;;AAKA,OAAO,MAAMU,qBAAA,gBAAwBV,WAAA,CAAY,CAC/C,aACA,YACA,aACA,mBACA,OACA,aACA,UACA,WACA,MACA,QACA,OACA,QACA,SACA,YACA,SACA,aACA,cACA,OACD;AAED;;;;;AAKA,OAAO,MAAMW,mBAAA,gBAAsBX,WAAA,CAAY,CAC7C,UACA,YACA,WACA,aACA,WACD;AAED;;;;;AAKA,OAAO,MAAMY,qBAAA,gBAAwBZ,WAAA,CAAYU,qBAAA,EAAuBD,iBAAA,EAAmBE,mBAAA;AAE3F;;;;;AAKA,OAAO,MAAME,eAAA,gBAAkBb,WAAA,CAAYY,qBAAA,EAAuB,CAChE,OACD;AAED;;;;;AAKA,OAAO,MAAME,eAAA,gBAAkBd,WAAA,CAAYY,qBAAA,EAAuB,CAChE,UACA,QACA,SACA,WACA,OACA,QACD;AAED;;;;;AAKA,OAAO,MAAMG,eAAA,gBAAkBf,WAAA,CAAYc,eAAA,EAAiB,CAC1D,SACD;AAED;;;;;AAKA,OAAO,MAAME,YAAA,gBAAehB,WAAA,CAAYY,qBAAA,EAAuB,CAC7D,QACD;AAED;;;;;AAK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,CAA8BG,OAAO,CAAClC,GAAA,KAAQ,KAC3DA,GAAA,CAAIkC,OAAO,CAAC,aAAa,KACzBlC,GAAA,CAAIkC,OAAO,CAAC,aAAa;IAE3B,IAAID,YAAA,KAAiB,CAACD,iBAAA,IAAqBA,iBAAA,EAAmBE,OAAA,CAAQlC,GAAA,MAAS,CAAC,IAAI;MAClF;MACAN,MAAM,CAACM,GAAA,CAAI,GAAG8B,KAAM,CAAC9B,GAAA,CAAI;IAC3B;EACF;EAEA,OAAON,MAAA;AACT"}
|
@@ -1,62 +1,54 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getSlots", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>getSlots
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
/**
|
10
|
-
* Given the state and an array of slot names, will break out `slots` and `slotProps`
|
11
|
-
* collections.
|
12
|
-
*
|
13
|
-
* The root is derived from a mix of `components` props and `as` prop.
|
14
|
-
*
|
15
|
-
* Slots will render as null if they are rendered as primitives with undefined children.
|
16
|
-
*
|
17
|
-
* The slotProps will always omit the `as` prop within them, and for slots that are string
|
18
|
-
* primitives, the props will be filtered according to the slot type by the type system.
|
19
|
-
* For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
|
20
|
-
* anchor props. Note that this is only enforced at build time by Typescript -- there is no
|
21
|
-
* runtime code filtering props in this function.
|
22
|
-
*
|
23
|
-
* @param state - State including slot definitions
|
24
|
-
* @returns An object containing the `slots` map and `slotProps` map.
|
25
|
-
*/
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _omit = require("../utils/omit");
|
26
12
|
function getSlots(state) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
13
|
+
const slots = {};
|
14
|
+
const slotProps = {};
|
15
|
+
const slotNames = Object.keys(state.components);
|
16
|
+
for (const slotName of slotNames){
|
17
|
+
const [slot, props] = getSlot(state, slotName);
|
18
|
+
slots[slotName] = slot;
|
19
|
+
slotProps[slotName] = props;
|
20
|
+
}
|
21
|
+
return {
|
22
|
+
slots,
|
23
|
+
slotProps: slotProps
|
24
|
+
};
|
39
25
|
}
|
40
|
-
exports.getSlots = getSlots;
|
41
26
|
function getSlot(state, slotName) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
as: asProp,
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
27
|
+
if (state[slotName] === undefined) {
|
28
|
+
return [
|
29
|
+
null,
|
30
|
+
undefined
|
31
|
+
];
|
32
|
+
}
|
33
|
+
const { children , as: asProp , ...rest } = state[slotName];
|
34
|
+
const slot = state.components?.[slotName] === undefined || typeof state.components[slotName] === "string" ? asProp || state.components?.[slotName] || "div" : state.components[slotName];
|
35
|
+
if (typeof children === "function") {
|
36
|
+
const render = children;
|
37
|
+
return [
|
38
|
+
_react.Fragment,
|
39
|
+
{
|
40
|
+
children: render(slot, rest)
|
41
|
+
}
|
42
|
+
];
|
43
|
+
}
|
44
|
+
const shouldOmitAsProp = typeof slot === "string" && state[slotName]?.as;
|
45
|
+
const slotProps = shouldOmitAsProp ? (0, _omit.omit)(state[slotName], [
|
46
|
+
"as"
|
47
|
+
]) : state[slotName];
|
48
|
+
return [
|
49
|
+
slot,
|
50
|
+
slotProps
|
51
|
+
];
|
52
|
+
} //# sourceMappingURL=getSlots.js.map
|
53
|
+
|
62
54
|
//# sourceMappingURL=getSlots.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/compose/getSlots.js"],"sourcesContent":["import * as React from \"react\";\nimport { omit } from \"../utils/omit\";\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(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlot(state, slotName) {\n if (state[slotName] === undefined) {\n return [null, undefined];\n }\n const {\n children,\n as: asProp,\n ...rest\n } = state[slotName];\n const slot = state.components?.[slotName] === undefined || typeof state.components[slotName] === \"string\" ? asProp || state.components?.[slotName] || \"div\" : state.components[slotName];\n if (typeof children === \"function\") {\n const render = children;\n return [React.Fragment, {\n children: render(slot, rest)\n }];\n }\n const shouldOmitAsProp = typeof slot === \"string\" && state[slotName]?.as;\n const slotProps = shouldOmitAsProp ? omit(state[slotName], [\"as\"]) : state[slotName];\n return [slot, slotProps];\n}\n//# sourceMappingURL=getSlots.js.map"],"names":["getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","undefined","children","as","asProp","rest","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAmBgBA;;aAAAA;;;6DAnBO;sBACF;AAkBd,SAASA,SAASC,KAAK,EAAE;IAC9B,MAAMC,QAAQ,CAAC;IACf,MA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
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./getSlots"), exports);
|
7
|
+
_exportStar(require("./resolveShorthand"), exports);
|
8
|
+
_exportStar(require("./types"), exports);
|
9
|
+
_exportStar(require("./isResolvedShorthand"), exports);
|
10
|
+
//# sourceMappingURL=index.js.map
|
11
|
+
|
11
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/compose/index.js"],"sourcesContent":["export * from \"./getSlots\";\nexport * from \"./resolveShorthand\";\nexport * from \"./types\";\nexport * from \"./isResolvedShorthand\";\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;CACd,iCAAiC"}
|
@@ -1,42 +1,14 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "isResolvedShorthand", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>isResolvedShorthand
|
5
8
|
});
|
6
|
-
|
7
|
-
const react_1 = /*#__PURE__*/require("react");
|
8
|
-
/**
|
9
|
-
* Guard method that validates if a shorthand is a slot
|
10
|
-
* can be used to extends properties provided by a slot
|
11
|
-
*
|
12
|
-
* @example
|
13
|
-
* ```
|
14
|
-
* const backdropSlot = resolveShorthand(backdrop, {
|
15
|
-
* defaultProps: {
|
16
|
-
* onClick: useEventCallback(event => {
|
17
|
-
* if (isResolvedShorthand(backdrop)) {
|
18
|
-
* backdrop.onClick?.(event)
|
19
|
-
* }
|
20
|
-
* // do something after passing click down the line
|
21
|
-
* }),
|
22
|
-
* },
|
23
|
-
* })
|
24
|
-
* ```
|
25
|
-
* @example
|
26
|
-
* ```
|
27
|
-
* const handleBackDropClick = (event) => {
|
28
|
-
* // do your thing
|
29
|
-
* }
|
30
|
-
* const backdropSlot = resolveShorthand(backdrop, {
|
31
|
-
* defaultProps: {
|
32
|
-
* onClick: useEventCallback(
|
33
|
-
* mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)
|
34
|
-
* )
|
35
|
-
* })
|
36
|
-
* ```
|
37
|
-
*/
|
9
|
+
const _react = require("react");
|
38
10
|
function isResolvedShorthand(shorthand) {
|
39
|
-
|
40
|
-
}
|
41
|
-
|
11
|
+
return shorthand !== null && typeof shorthand === "object" && !Array.isArray(shorthand) && !/*#__PURE__*/ (0, _react.isValidElement)(shorthand);
|
12
|
+
} //# sourceMappingURL=isResolvedShorthand.js.map
|
13
|
+
|
42
14
|
//# sourceMappingURL=isResolvedShorthand.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/compose/isResolvedShorthand.js"],"sourcesContent":["import { isValidElement } from \"react\";\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */\nexport function isResolvedShorthand(shorthand) {\n return shorthand !== null && typeof shorthand === \"object\" && !Array.isArray(shorthand) && ! /*#__PURE__*/isValidElement(shorthand);\n}\n//# sourceMappingURL=isResolvedShorthand.js.map"],"names":["isResolvedShorthand","shorthand","Array","isArray","isValidElement"],"mappings":";;;;+BA+BgBA;;aAAAA;;uBA/Be;AA+BxB,SAASA,oBAAoBC,SAAS,EAAE;IAC7C,OAAOA,cAAc,IAAI,IAAI,OAAOA,cAAc,YAAY,CAACC,MAAMC,OAAO,CAACF,cAAc,CAAE,WAAW,GAAEG,IAAAA,qBAAc,EAACH;AAC3H,EACA,+CAA+C"}
|
@@ -1,36 +1,29 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "resolveShorthand", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>resolveShorthand
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
*/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
return
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
resolvedShorthand = {
|
27
|
-
...value
|
28
|
-
};
|
29
|
-
}
|
30
|
-
return defaultProps ? {
|
31
|
-
...defaultProps,
|
32
|
-
...resolvedShorthand
|
33
|
-
} : resolvedShorthand;
|
34
|
-
};
|
35
|
-
exports.resolveShorthand = resolveShorthand;
|
9
|
+
const _react = require("react");
|
10
|
+
const resolveShorthand = (value, options)=>{
|
11
|
+
const { required =false , defaultProps } = options || {};
|
12
|
+
if (value === null || value === undefined && !required) {
|
13
|
+
return undefined;
|
14
|
+
}
|
15
|
+
let resolvedShorthand = {};
|
16
|
+
if (typeof value === "string" || typeof value === "number" || Array.isArray(value) || /*#__PURE__*/ (0, _react.isValidElement)(value)) {
|
17
|
+
resolvedShorthand.children = value;
|
18
|
+
} else if (typeof value === "object") {
|
19
|
+
resolvedShorthand = {
|
20
|
+
...value
|
21
|
+
};
|
22
|
+
}
|
23
|
+
return defaultProps ? {
|
24
|
+
...defaultProps,
|
25
|
+
...resolvedShorthand
|
26
|
+
} : resolvedShorthand;
|
27
|
+
}; //# sourceMappingURL=resolveShorthand.js.map
|
28
|
+
|
36
29
|
//# sourceMappingURL=resolveShorthand.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/compose/resolveShorthand.js"],"sourcesContent":["import { isValidElement } from \"react\";\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 = (value, options) => {\n const {\n required = false,\n defaultProps\n } = options || {};\n if (value === null || value === undefined && !required) {\n return undefined;\n }\n let resolvedShorthand = {};\n if (typeof value === \"string\" || typeof value === \"number\" || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === \"object\") {\n resolvedShorthand = {\n ...value\n };\n }\n return defaultProps ? {\n ...defaultProps,\n ...resolvedShorthand\n } : resolvedShorthand;\n};\n//# sourceMappingURL=resolveShorthand.js.map"],"names":["resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","isValidElement","children"],"mappings":";;;;+BAOaA;;aAAAA;;uBAPkB;AAOxB,MAAMA,mBAAmB,CAACC,OAAOC,UAAY;IAClD,MAAM,EACJC,UAAW,KAAK,CAAA,EAChBC,aAAY,EACb,GAAGF,WAAW,CAAC;IAChB,IAAID,UAAU,IAAI,IAAIA,UAAUI,aAAa,CAACF,UAAU;QACtD,OAAOE;IACT,CAAC;IACD,IAAIC,oBAAoB,CAAC;IACzB,IAAI,OAAOL,UAAU,YAAY,OAAOA,UAAU,YAAYM,MAAMC,OAAO,CAACP,UAAU,WAAW,GAAEQ,IAAAA,qBAAc,EAACR,QAAQ;QACxHK,kBAAkBI,QAAQ,GAAGT;IAC/B,OAAO,IAAI,OAAOA,UAAU,UAAU;QACpCK,oBAAoB;YAClB,GAAGL,KAAK;QACV;IACF,CAAC;IACD,OAAOG,eAAe;QACpB,GAAGA,YAAY;QACf,GAAGE,iBAAiB;IACtB,IAAIA,iBAAiB;AACvB,GACA,4CAA4C"}
|
@@ -1,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
5
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
6
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
7
|
+
//# sourceMappingURL=types.js.map
|
8
|
+
|
6
9
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/compose/types.js"],"sourcesContent":["import * as React from \"react\";\n//# sourceMappingURL=types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,iCAAiC"}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./mouseTouchHelpers"), exports);
|
7
|
+
//# sourceMappingURL=index.js.map
|
8
|
+
|
8
9
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/events/index.js"],"sourcesContent":["export * from \"./mouseTouchHelpers\";\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,iCAAiC"}
|
@@ -1,47 +1,50 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
isTouchEvent: ()=>isTouchEvent,
|
13
|
+
isMouseEvent: ()=>isMouseEvent,
|
14
|
+
getEventClientCoords: ()=>getEventClientCoords
|
5
15
|
});
|
6
|
-
|
7
|
-
|
8
|
-
* Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.
|
9
|
-
*/
|
16
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
17
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
10
18
|
function isTouchEvent(event) {
|
11
|
-
|
19
|
+
return event.type.startsWith("touch");
|
12
20
|
}
|
13
|
-
exports.isTouchEvent = isTouchEvent;
|
14
|
-
/**
|
15
|
-
* Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.
|
16
|
-
*/
|
17
21
|
function isMouseEvent(event) {
|
18
|
-
|
22
|
+
return event.type.startsWith("mouse") || [
|
23
|
+
"click",
|
24
|
+
"contextmenu",
|
25
|
+
"dblclick"
|
26
|
+
].indexOf(event.type) > -1;
|
19
27
|
}
|
20
|
-
exports.isMouseEvent = isMouseEvent;
|
21
|
-
/**
|
22
|
-
* Returns an object with clientX, clientY for TouchOrMouseEvent.
|
23
|
-
* Returns zeros in case the event is not a mouse or a touch event.
|
24
|
-
*/
|
25
28
|
function getEventClientCoords(event) {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
29
|
+
if (isMouseEvent(event)) {
|
30
|
+
return {
|
31
|
+
clientX: event.clientX,
|
32
|
+
clientY: event.clientY
|
33
|
+
};
|
34
|
+
} else if (isTouchEvent(event)) {
|
35
|
+
return {
|
36
|
+
clientX: event.touches[0].clientX,
|
37
|
+
clientY: event.touches[0].clientY
|
38
|
+
};
|
39
|
+
} else {
|
40
|
+
if (process.env.NODE_ENV !== "production") {
|
41
|
+
throw new Error("@fluentui/react-utilities]: Unable to get clientX. Unknown event type.");
|
42
|
+
}
|
43
|
+
return {
|
44
|
+
clientX: 0,
|
45
|
+
clientY: 0
|
46
|
+
};
|
39
47
|
}
|
40
|
-
|
41
|
-
|
42
|
-
clientY: 0
|
43
|
-
};
|
44
|
-
}
|
45
|
-
}
|
46
|
-
exports.getEventClientCoords = getEventClientCoords;
|
48
|
+
} //# sourceMappingURL=mouseTouchHelpers.js.map
|
49
|
+
|
47
50
|
//# sourceMappingURL=mouseTouchHelpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/events/mouseTouchHelpers.js"],"sourcesContent":["import * as React from \"react\";\n/**\n * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.\n */\nexport function isTouchEvent(event) {\n return event.type.startsWith(\"touch\");\n}\n/**\n * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.\n */\nexport function isMouseEvent(event) {\n return event.type.startsWith(\"mouse\") || [\"click\", \"contextmenu\", \"dblclick\"].indexOf(event.type) > -1;\n}\n/**\n * Returns an object with clientX, clientY for TouchOrMouseEvent.\n * Returns zeros in case the event is not a mouse or a touch event.\n */\nexport function getEventClientCoords(event) {\n if (isMouseEvent(event)) {\n return {\n clientX: event.clientX,\n clientY: event.clientY\n };\n } else if (isTouchEvent(event)) {\n return {\n clientX: event.touches[0].clientX,\n clientY: event.touches[0].clientY\n };\n } else {\n if (process.env.NODE_ENV !== \"production\") {\n throw new Error(\"@fluentui/react-utilities]: Unable to get clientX. Unknown event type.\");\n }\n return {\n clientX: 0,\n clientY: 0\n };\n }\n}\n//# sourceMappingURL=mouseTouchHelpers.js.map"],"names":["isTouchEvent","isMouseEvent","getEventClientCoords","event","type","startsWith","indexOf","clientX","clientY","touches","process","env","NODE_ENV","Error"],"mappings":";;;;;;;;;;;IAIgBA,YAAY,MAAZA;IAMAC,YAAY,MAAZA;IAOAC,oBAAoB,MAApBA;;;6DAjBO;AAIhB,SAASF,aAAaG,KAAK,EAAE;IAClC,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC;AAC/B;AAIO,SAASJ,aAAaE,KAAK,EAAE;IAClC,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC,YAAY;QAAC;QAAS;QAAe;KAAW,CAACC,OAAO,CAACH,MAAMC,IAAI,IAAI,CAAC;AACvG;AAKO,SAASF,qBAAqBC,KAAK,EAAE;IAC1C,IAAIF,aAAaE,QAAQ;QACvB,OAAO;YACLI,SAASJ,MAAMI,OAAO;YACtBC,SAASL,MAAMK,OAAO;QACxB;IACF,OAAO,IAAIR,aAAaG,QAAQ;QAC9B,OAAO;YACLI,SAASJ,MAAMM,OAAO,CAAC,EAAE,CAACF,OAAO;YACjCC,SAASL,MAAMM,OAAO,CAAC,EAAE,CAACD,OAAO;QACnC;IACF,OAAO;QACL,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,MAAM,IAAIC,MAAM,0EAA0E;QAC5F,CAAC;QACD,OAAO;YACLN,SAAS;YACTC,SAAS;QACX;IACF,CAAC;AACH,EACA,6CAA6C"}
|