@fluentui/react-utilities 9.13.2 → 9.13.4

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.
Files changed (39) hide show
  1. package/CHANGELOG.json +37 -1
  2. package/CHANGELOG.md +21 -2
  3. package/lib/compose/isSlot.js +1 -2
  4. package/lib/compose/isSlot.js.map +1 -1
  5. package/lib/compose/resolveShorthand.js +2 -5
  6. package/lib/compose/resolveShorthand.js.map +1 -1
  7. package/lib/compose/slot.js +1 -2
  8. package/lib/compose/slot.js.map +1 -1
  9. package/lib/hooks/useOnClickOutside.js +18 -24
  10. package/lib/hooks/useOnClickOutside.js.map +1 -1
  11. package/lib/hooks/useOnScrollOutside.js +8 -13
  12. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  13. package/lib/selection/useSelection.js +6 -4
  14. package/lib/selection/useSelection.js.map +1 -1
  15. package/lib/utils/isHTMLElement.js +2 -2
  16. package/lib/utils/isHTMLElement.js.map +1 -1
  17. package/lib/utils/mergeCallbacks.js +2 -3
  18. package/lib/utils/mergeCallbacks.js.map +1 -1
  19. package/lib/utils/properties.js +1 -2
  20. package/lib/utils/properties.js.map +1 -1
  21. package/lib-commonjs/compose/isSlot.js +1 -2
  22. package/lib-commonjs/compose/isSlot.js.map +1 -1
  23. package/lib-commonjs/compose/resolveShorthand.js +2 -5
  24. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  25. package/lib-commonjs/compose/slot.js +1 -2
  26. package/lib-commonjs/compose/slot.js.map +1 -1
  27. package/lib-commonjs/hooks/useOnClickOutside.js +18 -23
  28. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  29. package/lib-commonjs/hooks/useOnScrollOutside.js +8 -12
  30. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  31. package/lib-commonjs/selection/useSelection.js +6 -4
  32. package/lib-commonjs/selection/useSelection.js.map +1 -1
  33. package/lib-commonjs/utils/isHTMLElement.js +2 -2
  34. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  35. package/lib-commonjs/utils/mergeCallbacks.js +2 -3
  36. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  37. package/lib-commonjs/utils/properties.js +1 -2
  38. package/lib-commonjs/utils/properties.js.map +1 -1
  39. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["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 'onAnimationEnd',\n 'onAnimationStart',\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"],"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"],"mappings":"AAAA,MAAMA,cAAc,CAAC,GAAGC;IACtB,MAAMC,SAAiC,CAAC;IAExC,KAAK,MAAMC,QAAQF,MAAO;QACxB,MAAMG,OAAOC,MAAMC,OAAO,CAACH,QAAQA,OAAOI,OAAOH,IAAI,CAACD;QAEtD,KAAK,MAAMK,OAAOJ,KAAM;YACtBF,MAAM,CAACM,IAAI,GAAG;QAChB;IACF;IAEA,OAAON;AACT;AAEA;;;;CAIC,GACD,OAAO,MAAMO,oBAAoBT,YAAY;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMU,wBAAwBV,YAAY;IAC/C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMW,sBAAsBX,YAAY;IAC7C;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMY,wBAAwBZ,YAAYU,uBAAuBD,mBAAmBE,qBAAqB;AAEhH;;;;CAIC,GACD,OAAO,MAAME,kBAAkBb,YAAYY,uBAAuB;IAChE;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAME,kBAAkBd,YAAYY,uBAAuB;IAChE;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMG,kBAAkBf,YAAYc,iBAAiB;IAC1D;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAME,eAAehB,YAAYY,uBAAuB;IAC7D;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO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AAAA,yCAAAA,mBAAmBE,OAAO,CAAClC,UAAS,CAAC,CAAA,GAAI;YAClF,8DAA8D;YAC9DN,MAAM,CAACM,IAAI,GAAG8B,KAAM,CAAC9B,IAAI;QAC3B;IACF;IAEA,OAAON;AACT"}
1
+ {"version":3,"sources":["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 'onAnimationEnd',\n 'onAnimationStart',\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"],"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"],"mappings":"AAAA,MAAMA,cAAc,CAAC,GAAGC;IACtB,MAAMC,SAAiC,CAAC;IAExC,KAAK,MAAMC,QAAQF,MAAO;QACxB,MAAMG,OAAOC,MAAMC,OAAO,CAACH,QAAQA,OAAOI,OAAOH,IAAI,CAACD;QAEtD,KAAK,MAAMK,OAAOJ,KAAM;YACtBF,MAAM,CAACM,IAAI,GAAG;QAChB;IACF;IAEA,OAAON;AACT;AAEA;;;;CAIC,GACD,OAAO,MAAMO,oBAAoBT,YAAY;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMU,wBAAwBV,YAAY;IAC/C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMW,sBAAsBX,YAAY;IAC7C;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMY,wBAAwBZ,YAAYU,uBAAuBD,mBAAmBE,qBAAqB;AAEhH;;;;CAIC,GACD,OAAO,MAAME,kBAAkBb,YAAYY,uBAAuB;IAChE;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAME,kBAAkBd,YAAYY,uBAAuB;IAChE;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMG,kBAAkBf,YAAYc,iBAAiB;IAC1D;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAME,eAAehB,YAAYY,uBAAuB;IAC7D;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMK,eAAejB,YAAYY,uBAAuB;IAC7D;CAC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I;YAClF,8DAA8D;YAC9DN,MAAM,CAACM,IAAI,GAAG8B,KAAM,CAAC9B,IAAI;QAC3B;IACF;IAEA,OAAON;AACT"}
@@ -10,6 +10,5 @@ Object.defineProperty(exports, "isSlot", {
10
10
  });
11
11
  const _constants = require("./constants");
12
12
  function isSlot(element) {
13
- var _element;
14
- return Boolean((_element = element) === null || _element === void 0 ? void 0 : _element.hasOwnProperty(_constants.SLOT_ELEMENT_TYPE_SYMBOL));
13
+ return Boolean(element === null || element === void 0 ? void 0 : element.hasOwnProperty(_constants.SLOT_ELEMENT_TYPE_SYMBOL));
15
14
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["isSlot.js"],"sourcesContent":["import { SLOT_ELEMENT_TYPE_SYMBOL } from './constants';\n/**\n * Guard method to ensure a given element is a slot.\n * This is mainly used internally to ensure a slot is being used as a component.\n */ export function isSlot(element) {\n var _element;\n return Boolean((_element = element) === null || _element === void 0 ? void 0 : _element.hasOwnProperty(SLOT_ELEMENT_TYPE_SYMBOL));\n}\n"],"names":["isSlot","element","_element","Boolean","hasOwnProperty","SLOT_ELEMENT_TYPE_SYMBOL"],"mappings":";;;;+BAIoBA;;;eAAAA;;;2BAJqB;AAI9B,SAASA,OAAOC,OAAO;IAC9B,IAAIC;IACJ,OAAOC,QAAQ,AAACD,CAAAA,WAAWD,OAAM,MAAO,QAAQC,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASE,cAAc,CAACC,mCAAwB;AACnI"}
1
+ {"version":3,"sources":["isSlot.js"],"sourcesContent":["import { SLOT_ELEMENT_TYPE_SYMBOL } from './constants';\n/**\n * Guard method to ensure a given element is a slot.\n * This is mainly used internally to ensure a slot is being used as a component.\n */ export function isSlot(element) {\n return Boolean(element === null || element === void 0 ? void 0 : element.hasOwnProperty(SLOT_ELEMENT_TYPE_SYMBOL));\n}\n"],"names":["isSlot","element","Boolean","hasOwnProperty","SLOT_ELEMENT_TYPE_SYMBOL"],"mappings":";;;;+BAIoBA;;;eAAAA;;;2BAJqB;AAI9B,SAASA,OAAOC,OAAO;IAC9B,OAAOC,QAAQD,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQE,cAAc,CAACC,mCAAwB;AACpH"}
@@ -10,13 +10,10 @@ Object.defineProperty(exports, "resolveShorthand", {
10
10
  });
11
11
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
12
  const _slot = /*#__PURE__*/ _interop_require_wildcard._(require("./slot"));
13
- const resolveShorthand = (value, options)=>{
14
- var _options;
15
- return _slot.optional(value, {
13
+ const resolveShorthand = (value, options)=>_slot.optional(value, {
16
14
  ...options,
17
- renderByDefault: (_options = options) === null || _options === void 0 ? void 0 : _options.required,
15
+ renderByDefault: options === null || options === void 0 ? void 0 : options.required,
18
16
  // elementType as undefined is the way to identify between a slot and a resolveShorthand call
19
17
  // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.
20
18
  elementType: undefined
21
19
  });
22
- };
@@ -1 +1 @@
1
- {"version":3,"sources":["resolveShorthand.js"],"sourcesContent":["import * as slot from './slot';\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 */ export const resolveShorthand = (value, options)=>{\n var _options;\n return slot.optional(value, {\n ...options,\n renderByDefault: (_options = options) === null || _options === void 0 ? void 0 : _options.required,\n // elementType as undefined is the way to identify between a slot and a resolveShorthand call\n // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.\n elementType: undefined\n });\n};\n"],"names":["resolveShorthand","value","options","_options","slot","optional","renderByDefault","required","elementType","undefined"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;gEANK;AAMX,MAAMA,mBAAmB,CAACC,OAAOC;IACxC,IAAIC;IACJ,OAAOC,MAAKC,QAAQ,CAACJ,OAAO;QACxB,GAAGC,OAAO;QACVI,iBAAiB,AAACH,CAAAA,WAAWD,OAAM,MAAO,QAAQC,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASI,QAAQ;QAClG,6FAA6F;QAC7F,yGAAyG;QACzGC,aAAaC;IACjB;AACJ"}
1
+ {"version":3,"sources":["resolveShorthand.js"],"sourcesContent":["import * as slot from './slot';\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 */ export const resolveShorthand = (value, options)=>slot.optional(value, {\n ...options,\n renderByDefault: options === null || options === void 0 ? void 0 : options.required,\n // elementType as undefined is the way to identify between a slot and a resolveShorthand call\n // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.\n elementType: undefined\n });\n"],"names":["resolveShorthand","value","options","slot","optional","renderByDefault","required","elementType","undefined"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;gEANK;AAMX,MAAMA,mBAAmB,CAACC,OAAOC,UAAUC,MAAKC,QAAQ,CAACH,OAAO;QACnE,GAAGC,OAAO;QACVG,iBAAiBH,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQI,QAAQ;QACnF,6FAA6F;QAC7F,yGAAyG;QACzGC,aAAaC;IACjB"}
@@ -36,9 +36,8 @@ function always(value, options) {
36
36
  [_constants.SLOT_ELEMENT_TYPE_SYMBOL]: elementType
37
37
  };
38
38
  if (props && typeof props.children === 'function') {
39
- var _defaultProps;
40
39
  propsWithMetadata[_constants.SLOT_RENDER_FUNCTION_SYMBOL] = props.children;
41
- propsWithMetadata.children = (_defaultProps = defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps.children;
40
+ propsWithMetadata.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;
42
41
  }
43
42
  return propsWithMetadata;
44
43
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["slot.js"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Creates a slot from a slot shorthand or properties (`props.SLOT_NAME` or `props` itself)\n * @param value - the value of the slot, it can be a slot shorthand, a slot component or a slot properties\n * @param options - values you can pass to alter the signature of a slot, those values are:\n *\n * * `elementType` - the base element type of a slot, defaults to `'div'`\n * * `defaultProps` - similar to a React component declaration, you can provide a slot default properties to be merged with the shorthand/properties provided.\n */ export function always(value, options) {\n const { defaultProps, elementType } = options;\n const props = resolveShorthand(value);\n /**\n * Casting is required here as SlotComponentType is a function, not an object.\n * Although SlotComponentType has a function signature, it is still just an object.\n * This is required to make a slot callable (JSX compatible), this is the exact same approach\n * that is used on `@types/react` components\n */ const propsWithMetadata = {\n ...defaultProps,\n ...props,\n [SLOT_ELEMENT_TYPE_SYMBOL]: elementType\n };\n if (props && typeof props.children === 'function') {\n var _defaultProps;\n propsWithMetadata[SLOT_RENDER_FUNCTION_SYMBOL] = props.children;\n propsWithMetadata.children = (_defaultProps = defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps.children;\n }\n return propsWithMetadata;\n}\n/**\n * Creates a slot from a slot shorthand or properties (`props.SLOT_NAME` or `props` itself)\n * @param value - the value of the slot, it can be a slot shorthand, a slot component or a slot properties\n * @param options - values you can pass to alter the signature of a slot, those values are:\n *\n * * `elementType` - the base element type of a slot, defaults to `'div'`\n * * `defaultProps` - similar to a React component declaration, you can provide a slot default properties to be merged with the shorthand/properties provided\n * * `renderByDefault` - a boolean that indicates if a slot will be rendered even if it's base value is `undefined`.\n * By default if `props.SLOT_NAME` is `undefined` then `state.SLOT_NAME` becomes `undefined`\n * and nothing will be rendered, but if `renderByDefault = true` then `state.SLOT_NAME` becomes an object\n * with the values provided by `options.defaultProps` (or `{}`). This is useful for cases such as providing a default content\n * in case no shorthand is provided, like the case of the `expandIcon` slot for the `AccordionHeader`\n */ export function optional(value, options) {\n if (value === null || value === undefined && !options.renderByDefault) {\n return undefined;\n }\n return always(value, options);\n}\n/**\n * Helper function that converts a slot shorthand or properties to a slot properties object\n * The main difference between this function and `slot` is that this function does not return the metadata required for a slot to be considered a properly renderable slot, it only converts the value to a slot properties object\n * @param value - the value of the slot, it can be a slot shorthand or a slot properties object\n */ export function resolveShorthand(value) {\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any\n React.isValidElement(value)) {\n return {\n children: value\n };\n }\n if (value && typeof value !== 'object' && process.env.NODE_ENV !== 'production') {\n // TODO: would be nice to have a link to slot documentation in this error message\n // eslint-disable-next-line no-console\n console.error(`@fluentui/react-utilities [slot.${resolveShorthand.name}]:\nA slot got an invalid value \"${value}\" (${typeof value}).\nA valid value for a slot is a slot shorthand or slot properties object.\nSlot shorthands can be strings, numbers, arrays or JSX elements`);\n }\n return value;\n}\n"],"names":["always","optional","resolveShorthand","value","options","defaultProps","elementType","props","propsWithMetadata","SLOT_ELEMENT_TYPE_SYMBOL","children","_defaultProps","SLOT_RENDER_FUNCTION_SYMBOL","undefined","renderByDefault","Array","isArray","React","isValidElement","process","env","NODE_ENV","console","error","name"],"mappings":";;;;;;;;;;;IASoBA,MAAM;eAANA;;IAgCAC,QAAQ;eAARA;;IAUAC,gBAAgB;eAAhBA;;;;iEAnDG;2BAC+C;AAQ3D,SAASF,OAAOG,KAAK,EAAEC,OAAO;IACrC,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAE,GAAGF;IACtC,MAAMG,QAAQL,iBAAiBC;IAC/B;;;;;GAKD,GAAG,MAAMK,oBAAoB;QACxB,GAAGH,YAAY;QACf,GAAGE,KAAK;QACR,CAACE,mCAAwB,CAAC,EAAEH;IAChC;IACA,IAAIC,SAAS,OAAOA,MAAMG,QAAQ,KAAK,YAAY;QAC/C,IAAIC;QACJH,iBAAiB,CAACI,sCAA2B,CAAC,GAAGL,MAAMG,QAAQ;QAC/DF,kBAAkBE,QAAQ,GAAG,AAACC,CAAAA,gBAAgBN,YAAW,MAAO,QAAQM,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcD,QAAQ;IACtI;IACA,OAAOF;AACX;AAaW,SAASP,SAASE,KAAK,EAAEC,OAAO;IACvC,IAAID,UAAU,QAAQA,UAAUU,aAAa,CAACT,QAAQU,eAAe,EAAE;QACnE,OAAOD;IACX;IACA,OAAOb,OAAOG,OAAOC;AACzB;AAKW,SAASF,iBAAiBC,KAAK;IACtC,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,YAAYY,MAAMC,OAAO,CAACb,UAAU,8DAA8D;kBACpJc,OAAMC,cAAc,CAACf,QAAQ;QACzB,OAAO;YACHO,UAAUP;QACd;IACJ;IACA,IAAIA,SAAS,OAAOA,UAAU,YAAYgB,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QAC7E,iFAAiF;QACjF,sCAAsC;QACtCC,QAAQC,KAAK,CAAC,CAAC,gCAAgC,EAAErB,iBAAiBsB,IAAI,CAAC;6BAClD,EAAErB,MAAM,GAAG,EAAE,OAAOA,MAAM;;+DAEQ,CAAC;IAC5D;IACA,OAAOA;AACX"}
1
+ {"version":3,"sources":["slot.js"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Creates a slot from a slot shorthand or properties (`props.SLOT_NAME` or `props` itself)\n * @param value - the value of the slot, it can be a slot shorthand, a slot component or a slot properties\n * @param options - values you can pass to alter the signature of a slot, those values are:\n *\n * * `elementType` - the base element type of a slot, defaults to `'div'`\n * * `defaultProps` - similar to a React component declaration, you can provide a slot default properties to be merged with the shorthand/properties provided.\n */ export function always(value, options) {\n const { defaultProps, elementType } = options;\n const props = resolveShorthand(value);\n /**\n * Casting is required here as SlotComponentType is a function, not an object.\n * Although SlotComponentType has a function signature, it is still just an object.\n * This is required to make a slot callable (JSX compatible), this is the exact same approach\n * that is used on `@types/react` components\n */ const propsWithMetadata = {\n ...defaultProps,\n ...props,\n [SLOT_ELEMENT_TYPE_SYMBOL]: elementType\n };\n if (props && typeof props.children === 'function') {\n propsWithMetadata[SLOT_RENDER_FUNCTION_SYMBOL] = props.children;\n propsWithMetadata.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;\n }\n return propsWithMetadata;\n}\n/**\n * Creates a slot from a slot shorthand or properties (`props.SLOT_NAME` or `props` itself)\n * @param value - the value of the slot, it can be a slot shorthand, a slot component or a slot properties\n * @param options - values you can pass to alter the signature of a slot, those values are:\n *\n * * `elementType` - the base element type of a slot, defaults to `'div'`\n * * `defaultProps` - similar to a React component declaration, you can provide a slot default properties to be merged with the shorthand/properties provided\n * * `renderByDefault` - a boolean that indicates if a slot will be rendered even if it's base value is `undefined`.\n * By default if `props.SLOT_NAME` is `undefined` then `state.SLOT_NAME` becomes `undefined`\n * and nothing will be rendered, but if `renderByDefault = true` then `state.SLOT_NAME` becomes an object\n * with the values provided by `options.defaultProps` (or `{}`). This is useful for cases such as providing a default content\n * in case no shorthand is provided, like the case of the `expandIcon` slot for the `AccordionHeader`\n */ export function optional(value, options) {\n if (value === null || value === undefined && !options.renderByDefault) {\n return undefined;\n }\n return always(value, options);\n}\n/**\n * Helper function that converts a slot shorthand or properties to a slot properties object\n * The main difference between this function and `slot` is that this function does not return the metadata required for a slot to be considered a properly renderable slot, it only converts the value to a slot properties object\n * @param value - the value of the slot, it can be a slot shorthand or a slot properties object\n */ export function resolveShorthand(value) {\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any\n React.isValidElement(value)) {\n return {\n children: value\n };\n }\n if (value && typeof value !== 'object' && process.env.NODE_ENV !== 'production') {\n // TODO: would be nice to have a link to slot documentation in this error message\n // eslint-disable-next-line no-console\n console.error(`@fluentui/react-utilities [slot.${resolveShorthand.name}]:\nA slot got an invalid value \"${value}\" (${typeof value}).\nA valid value for a slot is a slot shorthand or slot properties object.\nSlot shorthands can be strings, numbers, arrays or JSX elements`);\n }\n return value;\n}\n"],"names":["always","optional","resolveShorthand","value","options","defaultProps","elementType","props","propsWithMetadata","SLOT_ELEMENT_TYPE_SYMBOL","children","SLOT_RENDER_FUNCTION_SYMBOL","undefined","renderByDefault","Array","isArray","React","isValidElement","process","env","NODE_ENV","console","error","name"],"mappings":";;;;;;;;;;;IASoBA,MAAM;eAANA;;IA+BAC,QAAQ;eAARA;;IAUAC,gBAAgB;eAAhBA;;;;iEAlDG;2BAC+C;AAQ3D,SAASF,OAAOG,KAAK,EAAEC,OAAO;IACrC,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAE,GAAGF;IACtC,MAAMG,QAAQL,iBAAiBC;IAC/B;;;;;GAKD,GAAG,MAAMK,oBAAoB;QACxB,GAAGH,YAAY;QACf,GAAGE,KAAK;QACR,CAACE,mCAAwB,CAAC,EAAEH;IAChC;IACA,IAAIC,SAAS,OAAOA,MAAMG,QAAQ,KAAK,YAAY;QAC/CF,iBAAiB,CAACG,sCAA2B,CAAC,GAAGJ,MAAMG,QAAQ;QAC/DF,kBAAkBE,QAAQ,GAAGL,iBAAiB,QAAQA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAaK,QAAQ;IAClH;IACA,OAAOF;AACX;AAaW,SAASP,SAASE,KAAK,EAAEC,OAAO;IACvC,IAAID,UAAU,QAAQA,UAAUS,aAAa,CAACR,QAAQS,eAAe,EAAE;QACnE,OAAOD;IACX;IACA,OAAOZ,OAAOG,OAAOC;AACzB;AAKW,SAASF,iBAAiBC,KAAK;IACtC,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,YAAYW,MAAMC,OAAO,CAACZ,UAAU,8DAA8D;kBACpJa,OAAMC,cAAc,CAACd,QAAQ;QACzB,OAAO;YACHO,UAAUP;QACd;IACJ;IACA,IAAIA,SAAS,OAAOA,UAAU,YAAYe,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QAC7E,iFAAiF;QACjF,sCAAsC;QACtCC,QAAQC,KAAK,CAAC,CAAC,gCAAgC,EAAEpB,iBAAiBqB,IAAI,CAAC;6BAClD,EAAEpB,MAAM,GAAG,EAAE,OAAOA,MAAM;;+DAEQ,CAAC;IAC5D;IACA,OAAOA;AACX"}
@@ -11,10 +11,7 @@ Object.defineProperty(exports, "useOnClickOutside", {
11
11
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
12
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _useEventCallback = require("./useEventCallback");
14
- const DEFAULT_CONTAINS = (parent, child)=>{
15
- var _parent;
16
- return !!((_parent = parent) === null || _parent === void 0 ? void 0 : _parent.contains(child));
17
- };
14
+ const DEFAULT_CONTAINS = (parent, child)=>!!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
18
15
  const useOnClickOutside = (options)=>{
19
16
  const { refs, callback, element, disabled, disabledFocusOnIframe, contains = DEFAULT_CONTAINS } = options;
20
17
  const timeoutId = _react.useRef(undefined);
@@ -44,7 +41,6 @@ const useOnClickOutside = (options)=>{
44
41
  isMouseDownInsideRef.current = refs.some((ref)=>contains(ref.current || null, ev.target));
45
42
  });
46
43
  _react.useEffect(()=>{
47
- var _element, _element1, _element2;
48
44
  if (disabled) {
49
45
  return;
50
46
  }
@@ -60,18 +56,20 @@ const useOnClickOutside = (options)=>{
60
56
  }
61
57
  listener(event);
62
58
  };
63
- (_element = element) === null || _element === void 0 ? void 0 : _element.addEventListener('touchstart', conditionalHandler, true);
64
- (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.addEventListener('mouseup', conditionalHandler, true);
65
- (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.addEventListener('mousedown', handleMouseDown, true);
59
+ // use capture phase because React can update DOM before the event bubbles to the document
60
+ element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);
61
+ element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);
62
+ element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);
63
+ element === null || element === void 0 ? void 0 : element.addEventListener('mousedown', handleMouseDown, true);
66
64
  // Garbage collect this event after it's no longer useful to avoid memory leaks
67
65
  timeoutId.current = window.setTimeout(()=>{
68
66
  currentEvent = undefined;
69
67
  }, 1);
70
68
  return ()=>{
71
- var _element, _element1, _element2;
72
- (_element = element) === null || _element === void 0 ? void 0 : _element.removeEventListener('touchstart', conditionalHandler, true);
73
- (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.removeEventListener('mouseup', conditionalHandler, true);
74
- (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.removeEventListener('mousedown', handleMouseDown, true);
69
+ element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);
70
+ element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);
71
+ element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);
72
+ element === null || element === void 0 ? void 0 : element.removeEventListener('mousedown', handleMouseDown, true);
75
73
  clearTimeout(timeoutId.current);
76
74
  currentEvent = undefined;
77
75
  };
@@ -116,14 +114,12 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
116
114
  });
117
115
  // Adds listener to the custom iframe focus event
118
116
  _react.useEffect(()=>{
119
- var _targetDocument;
120
117
  if (disabled) {
121
118
  return;
122
119
  }
123
- (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
120
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
124
121
  return ()=>{
125
- var _targetDocument;
126
- (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
122
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
127
123
  };
128
124
  }, [
129
125
  targetDocument,
@@ -132,14 +128,13 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
132
128
  ]);
133
129
  // Starts polling for the active element
134
130
  _react.useEffect(()=>{
135
- var _targetDocument_defaultView, _targetDocument;
131
+ var _targetDocument_defaultView;
136
132
  if (disabled) {
137
133
  return;
138
134
  }
139
- timeoutRef.current = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = _targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{
140
- var _targetDocument, _activeElement, _activeElement1;
141
- const activeElement = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.activeElement;
142
- if (((_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.tagName) === 'IFRAME' || ((_activeElement1 = activeElement) === null || _activeElement1 === void 0 ? void 0 : _activeElement1.tagName) === 'WEBVIEW') {
135
+ timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{
136
+ const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
137
+ if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
143
138
  const event = new CustomEvent(FUI_FRAME_EVENT, {
144
139
  bubbles: true
145
140
  });
@@ -147,8 +142,8 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
147
142
  }
148
143
  }, pollDuration);
149
144
  return ()=>{
150
- var _targetDocument_defaultView, _targetDocument;
151
- (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = _targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);
145
+ var _targetDocument_defaultView;
146
+ targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);
152
147
  };
153
148
  }, [
154
149
  targetDocument,
@@ -1 +1 @@
1
- {"version":3,"sources":["useOnClickOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nconst DEFAULT_CONTAINS = (parent, child)=>{\n var _parent;\n return !!((_parent = parent) === null || _parent === void 0 ? void 0 : _parent.contains(child));\n};\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */ export const useOnClickOutside = (options)=>{\n const { refs, callback, element, disabled, disabledFocusOnIframe, contains = DEFAULT_CONTAINS } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus({\n element,\n disabled: disabledFocusOnIframe || disabled,\n callback,\n refs,\n contains\n });\n const isMouseDownInsideRef = React.useRef(false);\n const listener = useEventCallback((ev)=>{\n if (isMouseDownInsideRef.current) {\n isMouseDownInsideRef.current = false;\n return;\n }\n const target = ev.composedPath()[0];\n const isOutside = refs.every((ref)=>!contains(ref.current || null, target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n const handleMouseDown = useEventCallback((ev)=>{\n // Selecting text from inside to outside will rigger click event.\n // In this case click event target is outside but mouse down event target is inside.\n // And this click event should be considered as inside click.\n isMouseDownInsideRef.current = refs.some((ref)=>contains(ref.current || null, ev.target));\n });\n React.useEffect(()=>{\n var // use capture phase because React can update DOM before the event bubbles to the document\n _element, _element1, _element2;\n if (disabled) {\n return;\n }\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 const conditionalHandler = (event)=>{\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 listener(event);\n };\n (_element = element) === null || _element === void 0 ? void 0 : _element.addEventListener('touchstart', conditionalHandler, true);\n (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.addEventListener('mouseup', conditionalHandler, true);\n (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.addEventListener('mousedown', handleMouseDown, true);\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 return ()=>{\n var _element, _element1, _element2;\n (_element = element) === null || _element === void 0 ? void 0 : _element.removeEventListener('touchstart', conditionalHandler, true);\n (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.removeEventListener('mouseup', conditionalHandler, true);\n (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.removeEventListener('mousedown', handleMouseDown, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [\n listener,\n element,\n disabled,\n handleMouseDown\n ]);\n};\nconst getWindowEvent = (target)=>{\n if (target) {\n var _target_ownerDocument_defaultView, _target_ownerDocument;\n if (typeof target.window === 'object' && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n var _target_ownerDocument_defaultView_event;\n // eslint-disable-next-line deprecation/deprecation\n return (_target_ownerDocument_defaultView_event = (_target_ownerDocument = target.ownerDocument) === null || _target_ownerDocument === void 0 ? void 0 : (_target_ownerDocument_defaultView = _target_ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.event) !== null && _target_ownerDocument_defaultView_event !== void 0 ? _target_ownerDocument_defaultView_event : undefined;\n }\n return undefined;\n};\nconst FUI_FRAME_EVENT = 'fuiframefocus';\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 */ const useIFrameFocus = (options)=>{\n const { disabled, element: targetDocument, callback, contains = DEFAULT_CONTAINS, pollDuration = 1000, refs } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback((e)=>{\n const isOutside = refs.every((ref)=>!contains(ref.current || null, e.target));\n if (isOutside && !disabled) {\n callback(e);\n }\n });\n // Adds listener to the custom iframe focus event\n React.useEffect(()=>{\n var _targetDocument;\n if (disabled) {\n return;\n }\n (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);\n return ()=>{\n var _targetDocument;\n (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [\n targetDocument,\n disabled,\n listener\n ]);\n // Starts polling for the active element\n React.useEffect(()=>{\n var _targetDocument_defaultView, _targetDocument;\n if (disabled) {\n return;\n }\n timeoutRef.current = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = _targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{\n var _targetDocument, _activeElement, _activeElement1;\n const activeElement = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.activeElement;\n if (((_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.tagName) === 'IFRAME' || ((_activeElement1 = activeElement) === null || _activeElement1 === void 0 ? void 0 : _activeElement1.tagName) === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n return ()=>{\n var _targetDocument_defaultView, _targetDocument;\n (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = _targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);\n };\n }, [\n targetDocument,\n disabled,\n pollDuration\n ]);\n};\n"],"names":["useOnClickOutside","DEFAULT_CONTAINS","parent","child","_parent","contains","options","refs","callback","element","disabled","disabledFocusOnIframe","timeoutId","React","useRef","undefined","useIFrameFocus","isMouseDownInsideRef","listener","useEventCallback","ev","current","target","composedPath","isOutside","every","ref","handleMouseDown","some","useEffect","_element","_element1","_element2","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument_defaultView","_target_ownerDocument","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument","_targetDocument_defaultView","setInterval","_activeElement","_activeElement1","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BASiBA;;;eAAAA;;;;iEATM;kCACU;AACjC,MAAMC,mBAAmB,CAACC,QAAQC;IAC9B,IAAIC;IACJ,OAAO,CAAC,CAAE,CAAA,AAACA,CAAAA,UAAUF,MAAK,MAAO,QAAQE,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQC,QAAQ,CAACF,MAAK;AACjG;AAIW,MAAMH,oBAAoB,CAACM;IAClC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,qBAAqB,EAAEN,WAAWJ,gBAAgB,EAAE,GAAGK;IAClG,MAAMM,YAAYC,OAAMC,MAAM,CAACC;IAC/BC,eAAe;QACXP;QACAC,UAAUC,yBAAyBD;QACnCF;QACAD;QACAF;IACJ;IACA,MAAMY,uBAAuBJ,OAAMC,MAAM,CAAC;IAC1C,MAAMI,WAAWC,IAAAA,kCAAgB,EAAC,CAACC;QAC/B,IAAIH,qBAAqBI,OAAO,EAAE;YAC9BJ,qBAAqBI,OAAO,GAAG;YAC/B;QACJ;QACA,MAAMC,SAASF,GAAGG,YAAY,EAAE,CAAC,EAAE;QACnC,MAAMC,YAAYjB,KAAKkB,KAAK,CAAC,CAACC,MAAM,CAACrB,SAASqB,IAAIL,OAAO,IAAI,MAAMC;QACnE,IAAIE,aAAa,CAACd,UAAU;YACxBF,SAASY;QACb;IACJ;IACA,MAAMO,kBAAkBR,IAAAA,kCAAgB,EAAC,CAACC;QACtC,iEAAiE;QACjE,oFAAoF;QACpF,6DAA6D;QAC7DH,qBAAqB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,IAAIA,4BAA4BZ,YAAY,CAACS,WAAW7B,OAAO;QAC9Q;IACJ,GAAG;QACC2B;QACAtC;QACAuC;KACH;AACL"}
1
+ {"version":3,"sources":["useOnClickOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nconst DEFAULT_CONTAINS = (parent, child)=>!!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */ export const useOnClickOutside = (options)=>{\n const { refs, callback, element, disabled, disabledFocusOnIframe, contains = DEFAULT_CONTAINS } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus({\n element,\n disabled: disabledFocusOnIframe || disabled,\n callback,\n refs,\n contains\n });\n const isMouseDownInsideRef = React.useRef(false);\n const listener = useEventCallback((ev)=>{\n if (isMouseDownInsideRef.current) {\n isMouseDownInsideRef.current = false;\n return;\n }\n const target = ev.composedPath()[0];\n const isOutside = refs.every((ref)=>!contains(ref.current || null, target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n const handleMouseDown = useEventCallback((ev)=>{\n // Selecting text from inside to outside will rigger click event.\n // In this case click event target is outside but mouse down event target is inside.\n // And this click event should be considered as inside click.\n isMouseDownInsideRef.current = refs.some((ref)=>contains(ref.current || null, ev.target));\n });\n React.useEffect(()=>{\n if (disabled) {\n return;\n }\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 const conditionalHandler = (event)=>{\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 listener(event);\n };\n // use capture phase because React can update DOM before the event bubbles to the document\n element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('mousedown', handleMouseDown, true);\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 return ()=>{\n element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('mousedown', handleMouseDown, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [\n listener,\n element,\n disabled,\n handleMouseDown\n ]);\n};\nconst getWindowEvent = (target)=>{\n if (target) {\n var _target_ownerDocument_defaultView, _target_ownerDocument;\n if (typeof target.window === 'object' && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n var _target_ownerDocument_defaultView_event;\n // eslint-disable-next-line deprecation/deprecation\n return (_target_ownerDocument_defaultView_event = (_target_ownerDocument = target.ownerDocument) === null || _target_ownerDocument === void 0 ? void 0 : (_target_ownerDocument_defaultView = _target_ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.event) !== null && _target_ownerDocument_defaultView_event !== void 0 ? _target_ownerDocument_defaultView_event : undefined;\n }\n return undefined;\n};\nconst FUI_FRAME_EVENT = 'fuiframefocus';\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 */ const useIFrameFocus = (options)=>{\n const { disabled, element: targetDocument, callback, contains = DEFAULT_CONTAINS, pollDuration = 1000, refs } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback((e)=>{\n const isOutside = refs.every((ref)=>!contains(ref.current || null, e.target));\n if (isOutside && !disabled) {\n callback(e);\n }\n });\n // Adds listener to the custom iframe focus event\n React.useEffect(()=>{\n if (disabled) {\n return;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);\n return ()=>{\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [\n targetDocument,\n disabled,\n listener\n ]);\n // Starts polling for the active element\n React.useEffect(()=>{\n var _targetDocument_defaultView;\n if (disabled) {\n return;\n }\n timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n return ()=>{\n var _targetDocument_defaultView;\n targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);\n };\n }, [\n targetDocument,\n disabled,\n pollDuration\n ]);\n};\n"],"names":["useOnClickOutside","DEFAULT_CONTAINS","parent","child","contains","options","refs","callback","element","disabled","disabledFocusOnIframe","timeoutId","React","useRef","undefined","useIFrameFocus","isMouseDownInsideRef","listener","useEventCallback","ev","current","target","composedPath","isOutside","every","ref","handleMouseDown","some","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument_defaultView","_target_ownerDocument","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument_defaultView","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;iEANM;kCACU;AACjC,MAAMC,mBAAmB,CAACC,QAAQC,QAAQ,CAAC,CAAED,CAAAA,WAAW,QAAQA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOE,QAAQ,CAACD,MAAK;AAIvG,MAAMH,oBAAoB,CAACK;IAClC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,qBAAqB,EAAEN,WAAWH,gBAAgB,EAAE,GAAGI;IAClG,MAAMM,YAAYC,OAAMC,MAAM,CAACC;IAC/BC,eAAe;QACXP;QACAC,UAAUC,yBAAyBD;QACnCF;QACAD;QACAF;IACJ;IACA,MAAMY,uBAAuBJ,OAAMC,MAAM,CAAC;IAC1C,MAAMI,WAAWC,IAAAA,kCAAgB,EAAC,CAACC;QAC/B,IAAIH,qBAAqBI,OAAO,EAAE;YAC9BJ,qBAAqBI,OAAO,GAAG;YAC/B;QACJ;QACA,MAAMC,SAASF,GAAGG,YAAY,EAAE,CAAC,EAAE;QACnC,MAAMC,YAAYjB,KAAKkB,KAAK,CAAC,CAACC,MAAM,CAACrB,SAASqB,IAAIL,OAAO,IAAI,MAAMC;QACnE,IAAIE,aAAa,CAACd,UAAU;YACxBF,SAASY;QACb;IACJ;IACA,MAAMO,kBAAkBR,IAAAA,kCAAgB,EAAC,CAACC;QACtC,iEAAiE;QACjE,oFAAoF;QACpF,6DAA6D;QAC7DH,qBAAqBI,OAAO,GAAGd,KAAKqB,IAAI,CAAC,CAACF,MAAMrB,SAASqB,IAAIL,OAAO,IAAI,MAAMD,GAAGE,MAAM;IAC3F;IACAT,OAAMgB,SAAS,CAAC;QACZ,IAAInB,UAAU;YACV;QACJ;QACA,mEAAmE;QACnE,2FAA2F;QAC3F,iDAAiD;QACjD,IAAIoB,eAAeC,eAAeC;Q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ACAqC,WAAW1B,OAAO,GAAGwB,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAI,AAACI,CAAAA,8BAA8BJ,eAAeF,WAAW,AAAD,MAAO,QAAQM,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BC,WAAW,CAAC;YAClP,MAAMC,gBAAgBN,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeM,aAAa;YAClH,IAAI,AAACA,CAAAA,kBAAkB,QAAQA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcC,OAAO,AAAD,MAAO,YAAY,AAACD,CAAAA,kBAAkB,QAAQA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcC,OAAO,AAAD,MAAO,WAAW;gBAC3M,MAAMlB,QAAQ,IAAImB,YAAYT,iBAAiB;oBAC3CU,SAAS;gBACb;gBACAH,cAAcI,aAAa,CAACrB;YAChC;QACJ,GAAGY;QACH,OAAO;YACH,IAAIG;YACJJ,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAI,AAACI,CAAAA,8BAA8BJ,eAAeF,WAAW,AAAD,MAAO,QAAQM,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BX,YAAY,CAACS,WAAW1B,OAAO;QACxP;IACJ,GAAG;QACCwB;QACAnC;QACAoC;KACH;AACL"}
@@ -14,10 +14,7 @@ const _useEventCallback = require("./useEventCallback");
14
14
  const useOnScrollOutside = (options)=>{
15
15
  const { refs, callback, element, disabled, contains: containsProp } = options;
16
16
  const listener = (0, _useEventCallback.useEventCallback)((ev)=>{
17
- const contains = containsProp || ((parent, child)=>{
18
- var _parent;
19
- return !!((_parent = parent) === null || _parent === void 0 ? void 0 : _parent.contains(child));
20
- });
17
+ const contains = containsProp || ((parent, child)=>!!(parent === null || parent === void 0 ? void 0 : parent.contains(child)));
21
18
  const target = ev.composedPath()[0];
22
19
  const isOutside = refs.every((ref)=>!contains(ref.current || null, target));
23
20
  if (isOutside && !disabled) {
@@ -25,18 +22,17 @@ const useOnScrollOutside = (options)=>{
25
22
  }
26
23
  });
27
24
  _react.useEffect(()=>{
28
- var _element, _element1, _element2;
29
25
  if (disabled) {
30
26
  return;
31
27
  }
32
- (_element = element) === null || _element === void 0 ? void 0 : _element.addEventListener('wheel', listener);
33
- (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.addEventListener('touchmove', listener);
34
- (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.addEventListener('scroll', listener, true);
28
+ element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);
29
+ element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);
30
+ // use capture phase because scroll does not bubble
31
+ element === null || element === void 0 ? void 0 : element.addEventListener('scroll', listener, true);
35
32
  return ()=>{
36
- var _element, _element1, _element2;
37
- (_element = element) === null || _element === void 0 ? void 0 : _element.removeEventListener('wheel', listener);
38
- (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.removeEventListener('touchmove', listener);
39
- (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.removeEventListener('scroll', listener, true);
33
+ element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);
34
+ element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);
35
+ element === null || element === void 0 ? void 0 : element.removeEventListener('scroll', listener, true);
40
36
  };
41
37
  }, [
42
38
  listener,
@@ -1 +1 @@
1
- {"version":3,"sources":["useOnScrollOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */ export const useOnScrollOutside = (options)=>{\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const listener = useEventCallback((ev)=>{\n const contains = containsProp || ((parent, child)=>{\n var _parent;\n return !!((_parent = parent) === null || _parent === void 0 ? void 0 : _parent.contains(child));\n });\n const target = ev.composedPath()[0];\n const isOutside = refs.every((ref)=>!contains(ref.current || null, target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(()=>{\n var _element, _element1, // use capture phase because scroll does not bubble\n _element2;\n if (disabled) {\n return;\n }\n (_element = element) === null || _element === void 0 ? void 0 : _element.addEventListener('wheel', listener);\n (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.addEventListener('touchmove', listener);\n (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.addEventListener('scroll', listener, true);\n return ()=>{\n var _element, _element1, _element2;\n (_element = element) === null || _element === void 0 ? void 0 : _element.removeEventListener('wheel', listener);\n (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.removeEventListener('touchmove', listener);\n (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.removeEventListener('scroll', listener, true);\n };\n }, [\n listener,\n element,\n disabled\n ]);\n};\n"],"names":["useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","useEventCallback","ev","parent","child","_parent","target","composedPath","isOutside","every","ref","current","React","useEffect","_element","_element1","_element2","addEventListener","removeEventListener"],"mappings":";;;;+BAKiBA;;;eAAAA;;;;iEALM;kCACU;AAItB,MAAMA,qBAAqB,CAACC;IACnC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,UAAUC,YAAY,EAAE,GAAGN;IACtE,MAAMO,WAAWC,IAAAA,kCAAgB,EAAC,CAACC;QAC/B,MAAMJ,WAAWC,gBAAiB,CAAA,CAACI,QAAQC;YACvC,IAAIC;YACJ,OAAO,CAAC,CAAE,CAAA,AAACA,CAAAA,UAAUF,MAAK,MAAO,QAAQE,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQP,QAAQ,CAACM,MAAK;QACjG,CAAA;QACA,MAAME,SAASJ,GAAGK,YAAY,EAAE,CAAC,EAAE;QACnC,MAAMC,YAAYd,KAAKe,KAAK,CAAC,CAACC,MAAM,CAACZ,SAASY,IAAIC,OAAO,IAAI,MAAML;QACnE,IAAIE,aAAa,CAACX,UAAU;YACxBF,SAASO;QACb;IACJ;IACAU,OAAMC,SAAS,CAAC;QACZ,IAAIC,UAAUC,WACdC;QACA,IAAInB,UAAU;YACV;QACJ;QACCiB,CAAAA,WAAWlB,OAAM,MAAO,QAAQkB,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASG,gBAAgB,CAAC,SAASjB;QAClGe,CAAAA,YAAYnB,OAAM,MAAO,QAAQmB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUE,gBAAgB,CAAC,aAAajB;QACzGgB,CAAAA,YAAYpB,OAAM,MAAO,QAAQoB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUC,gBAAgB,CAAC,UAAUjB,UAAU;QACjH,OAAO;YACH,IAAIc,UAAUC,WAAWC;YACxBF,CAAAA,WAAWlB,OAAM,MAAO,QAAQkB,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASI,mBAAmB,CAAC,SAASlB;YACrGe,CAAAA,YAAYnB,OAAM,MAAO,QAAQmB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUG,mBAAmB,CAAC,aAAalB;YAC5GgB,CAAAA,YAAYpB,OAAM,MAAO,QAAQoB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUE,mBAAmB,CAAC,UAAUlB,UAAU;QACxH;IACJ,GAAG;QACCA;QACAJ;QACAC;KACH;AACL"}
1
+ {"version":3,"sources":["useOnScrollOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */ export const useOnScrollOutside = (options)=>{\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const listener = useEventCallback((ev)=>{\n const contains = containsProp || ((parent, child)=>!!(parent === null || parent === void 0 ? void 0 : parent.contains(child)));\n const target = ev.composedPath()[0];\n const isOutside = refs.every((ref)=>!contains(ref.current || null, target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(()=>{\n if (disabled) {\n return;\n }\n element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);\n // use capture phase because scroll does not bubble\n element === null || element === void 0 ? void 0 : element.addEventListener('scroll', listener, true);\n return ()=>{\n element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);\n element === null || element === void 0 ? void 0 : element.removeEventListener('scroll', listener, true);\n };\n }, [\n listener,\n element,\n disabled\n ]);\n};\n"],"names":["useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","useEventCallback","ev","parent","child","target","composedPath","isOutside","every","ref","current","React","useEffect","addEventListener","removeEventListener"],"mappings":";;;;+BAKiBA;;;eAAAA;;;;iEALM;kCACU;AAItB,MAAMA,qBAAqB,CAACC;IACnC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,UAAUC,YAAY,EAAE,GAAGN;IACtE,MAAMO,WAAWC,IAAAA,kCAAgB,EAAC,CAACC;QAC/B,MAAMJ,WAAWC,gBAAiB,CAAA,CAACI,QAAQC,QAAQ,CAAC,CAAED,CAAAA,WAAW,QAAQA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOL,QAAQ,CAACM,MAAK,CAAC;QAC5H,MAAMC,SAASH,GAAGI,YAAY,EAAE,CAAC,EAAE;QACnC,MAAMC,YAAYb,KAAKc,KAAK,CAAC,CAACC,MAAM,CAACX,SAASW,IAAIC,OAAO,IAAI,MAAML;QACnE,IAAIE,aAAa,CAACV,UAAU;YACxBF,SAASO;QACb;IACJ;IACAS,OAAMC,SAAS,CAAC;QACZ,IAAIf,UAAU;YACV;QACJ;QACAD,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,gBAAgB,CAAC,SAASb;QACpFJ,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,gBAAgB,CAAC,aAAab;QACxF,mDAAmD;QACnDJ,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,gBAAgB,CAAC,UAAUb,UAAU;QAC/F,OAAO;YACHJ,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQkB,mBAAmB,CAAC,SAASd;YACvFJ,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQkB,mBAAmB,CAAC,aAAad;YAC3FJ,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQkB,mBAAmB,CAAC,UAAUd,UAAU;QACtG;IACJ,GAAG;QACCA;QACAJ;QACAC;KACH;AACL"}
@@ -23,8 +23,8 @@ function useSelectionState(params) {
23
23
  ])
24
24
  });
25
25
  const changeSelection = (event, nextSelectedItems)=>{
26
- var _params_onSelectionChange, _params;
27
- (_params_onSelectionChange = (_params = params).onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(_params, event, {
26
+ var _params_onSelectionChange;
27
+ (_params_onSelectionChange = params.onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(params, event, {
28
28
  selectedItems: nextSelectedItems
29
29
  });
30
30
  setSelected(nextSelectedItems);
@@ -36,7 +36,6 @@ function useSelectionState(params) {
36
36
  }
37
37
  function useSingleSelection(params) {
38
38
  const [selected, changeSelection] = useSelectionState(params);
39
- var _selected_has;
40
39
  const methods = {
41
40
  deselectItem: (event)=>changeSelection(event, new Set()),
42
41
  selectItem: (event, itemId)=>changeSelection(event, new Set([
@@ -51,7 +50,10 @@ function useSingleSelection(params) {
51
50
  itemId
52
51
  ])),
53
52
  clearItems: (event)=>changeSelection(event, new Set()),
54
- isSelected: (itemId)=>(_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false
53
+ isSelected: (itemId)=>{
54
+ var _selected_has;
55
+ return (_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false;
56
+ }
55
57
  };
56
58
  return [
57
59
  selected,
@@ -1 +1 @@
1
- {"version":3,"sources":["useSelection.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState } from '../hooks/useControllableState';\nimport { createSetFromIterable } from '../utils/createSetFromIterable';\nfunction useSelectionState(params) {\n const [selected, setSelected] = useControllableState({\n initialState: new Set(),\n defaultState: React.useMemo(()=>params.defaultSelectedItems && createSetFromIterable(params.defaultSelectedItems), [\n params.defaultSelectedItems\n ]),\n state: React.useMemo(()=>params.selectedItems && createSetFromIterable(params.selectedItems), [\n params.selectedItems\n ])\n });\n const changeSelection = (event, nextSelectedItems)=>{\n var _params_onSelectionChange, _params;\n (_params_onSelectionChange = (_params = params).onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(_params, event, {\n selectedItems: nextSelectedItems\n });\n setSelected(nextSelectedItems);\n };\n return [\n selected,\n changeSelection\n ];\n}\nfunction useSingleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n var _selected_has;\n const methods = {\n deselectItem: (event)=>changeSelection(event, new Set()),\n selectItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n toggleAllItems: ()=>{\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');\n }\n },\n toggleItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n clearItems: (event)=>changeSelection(event, new Set()),\n isSelected: (itemId)=>(_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false\n };\n return [\n selected,\n methods\n ];\n}\nfunction useMultipleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods = {\n toggleItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n if (selected.has(itemId)) {\n nextSelectedItems.delete(itemId);\n } else {\n nextSelectedItems.add(itemId);\n }\n changeSelection(event, nextSelectedItems);\n },\n selectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.add(itemId);\n changeSelection(event, nextSelectedItems);\n },\n deselectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.delete(itemId);\n changeSelection(event, nextSelectedItems);\n },\n clearItems: (event)=>{\n changeSelection(event, new Set());\n },\n isSelected: (itemId)=>selected.has(itemId),\n toggleAllItems: (event, itemIds)=>{\n const allItemsSelected = itemIds.every((itemId)=>selected.has(itemId));\n const nextSelectedItems = new Set(selected);\n if (allItemsSelected) {\n nextSelectedItems.clear();\n } else {\n itemIds.forEach((itemId)=>nextSelectedItems.add(itemId));\n }\n changeSelection(event, nextSelectedItems);\n }\n };\n return [\n selected,\n methods\n ];\n}\nexport function useSelection(params) {\n if (params.selectionMode === 'multiselect') {\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMultipleSelection(params);\n }\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSingleSelection(params);\n}\n"],"names":["useSelection","useSelectionState","params","selected","setSelected","useControllableState","initialState","Set","defaultState","React","useMemo","defaultSelectedItems","createSetFromIterable","state","selectedItems","changeSelection","event","nextSelectedItems","_params_onSelectionChange","_params","onSelectionChange","call","useSingleSelection","_selected_has","methods","deselectItem","selectItem","itemId","toggleAllItems","process","env","NODE_ENV","Error","toggleItem","clearItems","isSelected","has","useMultipleSelection","delete","add","itemIds","allItemsSelected","every","clear","forEach","selectionMode"],"mappings":";;;;+BA2FgBA;;;eAAAA;;;;iEA3FO;sCACc;uCACC;AACtC,SAASC,kBAAkBC,MAAM;IAC7B,MAAM,CAACC,UAAUC,YAAY,GAAGC,IAAAA,0CAAoB,EAAC;QACjDC,cAAc,IAAIC;QAClBC,cAAcC,OAAMC,OAAO,CAAC,IAAIR,OAAOS,oBAAoB,IAAIC,IAAAA,4CAAqB,EAACV,OAAOS,oBAAoB,GAAG;YAC/GT,OAAOS,oBAAoB;SAC9B;QACDE,OAAOJ,OAAMC,OAAO,CAAC,IAAIR,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B,MAAM,CAACX;YAC7B,OAAO;gBACHV,kBAAkBsB,GAAG,CAACZ;YAC1B;YACAZ,gBAAgBC,OAAOC;QAC3B;QACAS,YAAY,CAACV,OAAOW;YAChB,MAAMV,oBAAoB,IAAIV,IAAIJ;YAClCc,kBAAkBsB,GAAG,CAACZ;YACtBZ,gBAAgBC,OAAOC;QAC3B;QACAQ,cAAc,CAACT,OAAOW;YAClB,MAAMV,oBAAoB,IAAIV,IAAIJ;YAClCc,kBAAkBqB,MAAM,CAACX;YACzBZ,gBAAgBC,OAAOC;QAC3B;QACAiB,YAAY,CAAClB;YACTD,gBAAgBC,OAAO,IAAIT;QAC/B;QACA4B,YAAY,CAACR,SAASxB,SAASiC,GAAG,CAACT;QACnCC,gBAAgB,CAACZ,OAAOwB;YACpB,MAAMC,mBAAmBD,QAAQE,KAAK,CAAC,CAACf,SAASxB,SAASiC,GAAG,CAACT;YAC9D,MAAMV,oBAAoB,IAAIV,IAAIJ;YAClC,IAAIsC,kBAAkB;gBAClBxB,kBAAkB0B,KAAK;YAC3B,OAAO;gBACHH,QAAQI,OAAO,CAAC,CAACjB,SAASV,kBAAkBsB,GAAG,CAACZ;YACpD;YACAZ,gBAAgBC,OAAOC;QAC3B;IACJ;IACA,OAAO;QACHd;QACAqB;KACH;AACL;AACO,SAASxB,aAAaE,MAAM;IAC/B,IAAIA,OAAO2C,aAAa,KAAK,eAAe;QACxC,0EAA0E;QAC1E,sDAAsD;QACtD,OAAOR,qBAAqBnC;IAChC;IACA,0EAA0E;IAC1E,sDAAsD;IACtD,OAAOoB,mBAAmBpB;AAC9B"}
1
+ {"version":3,"sources":["useSelection.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState } from '../hooks/useControllableState';\nimport { createSetFromIterable } from '../utils/createSetFromIterable';\nfunction useSelectionState(params) {\n const [selected, setSelected] = useControllableState({\n initialState: new Set(),\n defaultState: React.useMemo(()=>params.defaultSelectedItems && createSetFromIterable(params.defaultSelectedItems), [\n params.defaultSelectedItems\n ]),\n state: React.useMemo(()=>params.selectedItems && createSetFromIterable(params.selectedItems), [\n params.selectedItems\n ])\n });\n const changeSelection = (event, nextSelectedItems)=>{\n var _params_onSelectionChange;\n (_params_onSelectionChange = params.onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(params, event, {\n selectedItems: nextSelectedItems\n });\n setSelected(nextSelectedItems);\n };\n return [\n selected,\n changeSelection\n ];\n}\nfunction useSingleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods = {\n deselectItem: (event)=>changeSelection(event, new Set()),\n selectItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n toggleAllItems: ()=>{\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');\n }\n },\n toggleItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n clearItems: (event)=>changeSelection(event, new Set()),\n isSelected: (itemId)=>{\n var _selected_has;\n return (_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false;\n }\n };\n return [\n selected,\n methods\n ];\n}\nfunction useMultipleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods = {\n toggleItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n if (selected.has(itemId)) {\n nextSelectedItems.delete(itemId);\n } else {\n nextSelectedItems.add(itemId);\n }\n changeSelection(event, nextSelectedItems);\n },\n selectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.add(itemId);\n changeSelection(event, nextSelectedItems);\n },\n deselectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.delete(itemId);\n changeSelection(event, nextSelectedItems);\n },\n clearItems: (event)=>{\n changeSelection(event, new Set());\n },\n isSelected: (itemId)=>selected.has(itemId),\n toggleAllItems: (event, itemIds)=>{\n const allItemsSelected = itemIds.every((itemId)=>selected.has(itemId));\n const nextSelectedItems = new Set(selected);\n if (allItemsSelected) {\n nextSelectedItems.clear();\n } else {\n itemIds.forEach((itemId)=>nextSelectedItems.add(itemId));\n }\n changeSelection(event, nextSelectedItems);\n }\n };\n return [\n selected,\n methods\n ];\n}\nexport function useSelection(params) {\n if (params.selectionMode === 'multiselect') {\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMultipleSelection(params);\n }\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSingleSelection(params);\n}\n"],"names":["useSelection","useSelectionState","params","selected","setSelected","useControllableState","initialState","Set","defaultState","React","useMemo","defaultSelectedItems","createSetFromIterable","state","selectedItems","changeSelection","event","nextSelectedItems","_params_onSelectionChange","onSelectionChange","call","useSingleSelection","methods","deselectItem","selectItem","itemId","toggleAllItems","process","env","NODE_ENV","Error","toggleItem","clearItems","isSelected","_selected_has","has","useMultipleSelection","delete","add","itemIds","allItemsSelected","every","clear","forEach","selectionMode"],"mappings":";;;;+BA6FgBA;;;eAAAA;;;;iEA7FO;sCACc;uCACC;AACtC,SAASC,kBAAkBC,MAAM;IAC7B,MAAM,CAACC,UAAUC,YAAY,GAAGC,IAAAA,0CAAoB,EAAC;QACjDC,cAAc,IAAIC;QAClBC,cAAcC,OAAMC,OAAO,CAAC,IAAIR,OAAOS,oBAAoB,IAAIC,IAAAA,4CAAqB,EAACV,OAAOS,oBAAoB,GAAG;YAC/GT,OAAOS,oBAAoB;SAC9B;QACDE,OAAOJ,OAAMC,OAAO,CAAC,IAAIR,OAAOY,aAAa,IAAIF,IAAAA,4CAAqB,EAACV,OAAOY,aAAa,GAAG;YAC1FZ,OAAOY,aAAa;SACvB;IACL;IACA,MAAMC,kBAAkB,CAACC,OAAOC;QAC5B,IAAIC;QACHA,CAAAA,4BAA4BhB,OAAOiB,iBAAiB,AAAD,MAAO,QAAQD,8BAA8B,KAAK,IAAI,KAAK,IAAIA,0BAA0BE,IAAI,CAAClB,Q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AAkBoB,MAAM,CAACZ;YACzBV,gBAAgBC,OAAOC;QAC3B;QACAe,YAAY,CAAChB;YACTD,gBAAgBC,OAAO,IAAIT;QAC/B;QACA0B,YAAY,CAACR,SAAStB,SAASgC,GAAG,CAACV;QACnCC,gBAAgB,CAACV,OAAOuB;YACpB,MAAMC,mBAAmBD,QAAQE,KAAK,CAAC,CAAChB,SAAStB,SAASgC,GAAG,CAACV;YAC9D,MAAMR,oBAAoB,IAAIV,IAAIJ;YAClC,IAAIqC,kBAAkB;gBAClBvB,kBAAkByB,KAAK;YAC3B,OAAO;gBACHH,QAAQI,OAAO,CAAC,CAAClB,SAASR,kBAAkBqB,GAAG,CAACb;YACpD;YACAV,gBAAgBC,OAAOC;QAC3B;IACJ;IACA,OAAO;QACHd;QACAmB;KACH;AACL;AACO,SAAStB,aAAaE,MAAM;IAC/B,IAAIA,OAAO0C,aAAa,KAAK,eAAe;QACxC,0EAA0E;QAC1E,sDAAsD;QACtD,OAAOR,qBAAqBlC;IAChC;IACA,0EAA0E;IAC1E,sDAAsD;IACtD,OAAOmB,mBAAmBnB;AAC9B"}
@@ -22,8 +22,8 @@ Object.defineProperty(exports, "isHTMLElement", {
22
22
  }
23
23
  });
24
24
  function isHTMLElement(element, options) {
25
- var _typedElement_ownerDocument, _typedElement, _options;
25
+ var _typedElement_ownerDocument;
26
26
  const typedElement = element;
27
27
  var _options_constructorName;
28
- return Boolean(((_typedElement = typedElement) === null || _typedElement === void 0 ? void 0 : (_typedElement_ownerDocument = _typedElement.ownerDocument) === null || _typedElement_ownerDocument === void 0 ? void 0 : _typedElement_ownerDocument.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_options_constructorName = (_options = options) === null || _options === void 0 ? void 0 : _options.constructorName) !== null && _options_constructorName !== void 0 ? _options_constructorName : 'HTMLElement']);
28
+ return Boolean((typedElement === null || typedElement === void 0 ? void 0 : (_typedElement_ownerDocument = typedElement.ownerDocument) === null || _typedElement_ownerDocument === void 0 ? void 0 : _typedElement_ownerDocument.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_options_constructorName = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _options_constructorName !== void 0 ? _options_constructorName : 'HTMLElement']);
29
29
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["isHTMLElement.js"],"sourcesContent":["/**\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is preferred over simply using `instanceof`.\n * Since `instanceof` might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n * @example\n * ```ts\n * isHTMLElement(event.target) && event.target.focus()\n * isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value\n * ```\n *\n */ export function isHTMLElement(element, options) {\n var _typedElement_ownerDocument, _typedElement, _options;\n const typedElement = element;\n var _options_constructorName;\n return Boolean(((_typedElement = typedElement) === null || _typedElement === void 0 ? void 0 : (_typedElement_ownerDocument = _typedElement.ownerDocument) === null || _typedElement_ownerDocument === void 0 ? void 0 : _typedElement_ownerDocument.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_options_constructorName = (_options = options) === null || _options === void 0 ? void 0 : _options.constructorName) !== null && _options_constructorName !== void 0 ? _options_constructorName : 'HTMLElement']);\n}\n"],"names":["isHTMLElement","element","options","_typedElement_ownerDocument","_typedElement","_options","typedElement","_options_constructorName","Boolean","ownerDocument","defaultView","constructorName"],"mappings":"AAAA;;;;;;;;;;;;;CAaC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,cAAcC,OAAO,EAAEC,OAAO;IAC9C,IAAIC,6BAA6BC,eAAeC;IAChD,MAAMC,eAAeL;IACrB,IAAIM;IACJ,OAAOC,QAAQ,AAAC,CAAA,AAACJ,CAAAA,gBAAgBE,YAAW,MAAO,QAAQF,kBAAkB,KAAK,IAAI,KAAK,IAAI,AAACD,CAAAA,8BAA8BC,cAAcK,aAAa,AAAD,MAAO,QAAQN,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BO,WAAW,AAAD,KAAMJ,wBAAwBA,aAAaG,aAAa,CAACC,WAAW,CAAC,AAACH,CAAAA,2BAA2B,AAACF,CAAAA,WAAWH,OAAM,MAAO,QAAQG,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASM,eAAe,AAAD,MAAO,QAAQJ,6BAA6B,KAAK,IAAIA,2BAA2B,cAAc;AACzhB"}
1
+ {"version":3,"sources":["isHTMLElement.js"],"sourcesContent":["/**\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is preferred over simply using `instanceof`.\n * Since `instanceof` might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n * @example\n * ```ts\n * isHTMLElement(event.target) && event.target.focus()\n * isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value\n * ```\n *\n */ export function isHTMLElement(element, options) {\n var _typedElement_ownerDocument;\n const typedElement = element;\n var _options_constructorName;\n return Boolean((typedElement === null || typedElement === void 0 ? void 0 : (_typedElement_ownerDocument = typedElement.ownerDocument) === null || _typedElement_ownerDocument === void 0 ? void 0 : _typedElement_ownerDocument.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_options_constructorName = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _options_constructorName !== void 0 ? _options_constructorName : 'HTMLElement']);\n}\n"],"names":["isHTMLElement","element","options","_typedElement_ownerDocument","typedElement","_options_constructorName","Boolean","ownerDocument","defaultView","constructorName"],"mappings":"AAAA;;;;;;;;;;;;;CAaC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,cAAcC,OAAO,EAAEC,OAAO;IAC9C,IAAIC;IACJ,MAAMC,eAAeH;IACrB,IAAII;IACJ,OAAOC,QAAQ,AAACF,CAAAA,iBAAiB,QAAQA,iBAAiB,KAAK,IAAI,KAAK,IAAI,AAACD,CAAAA,8BAA8BC,aAAaG,aAAa,AAAD,MAAO,QAAQJ,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BK,WAAW,AAAD,KAAMJ,wBAAwBA,aAAaG,aAAa,CAACC,WAAW,CAAC,AAACH,CAAAA,2BAA2BH,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQO,eAAe,AAAD,MAAO,QAAQJ,6BAA6B,KAAK,IAAIA,2BAA2B,cAAc;AACtf"}
@@ -32,8 +32,7 @@ Object.defineProperty(exports, "mergeCallbacks", {
32
32
  });
33
33
  function mergeCallbacks(callback1, callback2) {
34
34
  return (...args)=>{
35
- var _callback1, _callback2;
36
- (_callback1 = callback1) === null || _callback1 === void 0 ? void 0 : _callback1(...args);
37
- (_callback2 = callback2) === null || _callback2 === void 0 ? void 0 : _callback2(...args);
35
+ callback1 === null || callback1 === void 0 ? void 0 : callback1(...args);
36
+ callback2 === null || callback2 === void 0 ? void 0 : callback2(...args);
38
37
  };
39
38
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["mergeCallbacks.js"],"sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */ export function mergeCallbacks(callback1, callback2) {\n return (...args)=>{\n var _callback1, _callback2;\n (_callback1 = callback1) === null || _callback1 === void 0 ? void 0 : _callback1(...args);\n (_callback2 = callback2) === null || _callback2 === void 0 ? void 0 : _callback2(...args);\n };\n}\n"],"names":["mergeCallbacks","callback1","callback2","args","_callback1","_callback2"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;CAsBC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,eAAeC,SAAS,EAAEC,SAAS;IACnD,OAAO,CAAC,GAAGC;QACP,IAAIC,YAAYC;QACfD,CAAAA,aAAaH,SAAQ,MAAO,QAAQG,eAAe,KAAK,IAAI,KAAK,IAAIA,cAAcD;QACnFE,CAAAA,aAAaH,SAAQ,MAAO,QAAQG,eAAe,KAAK,IAAI,KAAK,IAAIA,cAAcF;IACxF;AACJ"}
1
+ {"version":3,"sources":["mergeCallbacks.js"],"sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */ export function mergeCallbacks(callback1, callback2) {\n return (...args)=>{\n callback1 === null || callback1 === void 0 ? void 0 : callback1(...args);\n callback2 === null || callback2 === void 0 ? void 0 : callback2(...args);\n };\n}\n"],"names":["mergeCallbacks","callback1","callback2","args"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;CAsBC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,eAAeC,SAAS,EAAEC,SAAS;IACnD,OAAO,CAAC,GAAGC;QACPF,cAAc,QAAQA,cAAc,KAAK,IAAI,KAAK,IAAIA,aAAaE;QACnED,cAAc,QAAQA,cAAc,KAAK,IAAI,KAAK,IAAIA,aAAaC;IACvE;AACJ"}
@@ -385,9 +385,8 @@ function getNativeProps(props, allowedPropNames, excludedPropNames) {
385
385
  const result = {};
386
386
  const keys = Object.keys(props);
387
387
  for (const key of keys){
388
- var _excludedPropNames;
389
388
  const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
390
- if (isNativeProp && (!excludedPropNames || ((_excludedPropNames = excludedPropNames) === null || _excludedPropNames === void 0 ? void 0 : _excludedPropNames.indexOf(key)) === -1)) {
389
+ if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
391
390
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
392
391
  result[key] = props[key];
393
392
  }