@fluentui/react-utilities 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230322-0439.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/.swcrc +2 -11
  2. package/CHANGELOG.json +38 -5
  3. package/CHANGELOG.md +17 -5
  4. package/lib/compose/getSlots.js +7 -6
  5. package/lib/compose/getSlots.js.map +1 -1
  6. package/lib/compose/index.js +4 -4
  7. package/lib/compose/isResolvedShorthand.js +2 -2
  8. package/lib/compose/resolveShorthand.js +3 -3
  9. package/lib/compose/types.js +1 -1
  10. package/lib/events/index.js +1 -1
  11. package/lib/events/mouseTouchHelpers.js +5 -5
  12. package/lib/hooks/index.js +12 -12
  13. package/lib/hooks/useControllableState.js +7 -7
  14. package/lib/hooks/useEventCallback.js +3 -3
  15. package/lib/hooks/useFirstMount.js +1 -1
  16. package/lib/hooks/useForceUpdate.js +1 -1
  17. package/lib/hooks/useId.js +6 -6
  18. package/lib/hooks/useIsomorphicLayoutEffect.js +2 -2
  19. package/lib/hooks/useMergedRefs.js +2 -2
  20. package/lib/hooks/useOnClickOutside.js +30 -20
  21. package/lib/hooks/useOnClickOutside.js.map +1 -1
  22. package/lib/hooks/useOnScrollOutside.js +9 -7
  23. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  24. package/lib/hooks/usePrevious.js +1 -1
  25. package/lib/hooks/useScrollbarWidth.js +5 -5
  26. package/lib/hooks/useTimeout.js +1 -1
  27. package/lib/index.js +6 -6
  28. package/lib/ssr/SSRContext.js +6 -5
  29. package/lib/ssr/SSRContext.js.map +1 -1
  30. package/lib/ssr/canUseDOM.js +1 -1
  31. package/lib/ssr/index.js +2 -2
  32. package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
  33. package/lib/trigger/getTriggerChild.js +2 -2
  34. package/lib/trigger/index.js +4 -4
  35. package/lib/trigger/isFluentTrigger.js +1 -1
  36. package/lib/trigger/types.js +1 -1
  37. package/lib/utils/getNativeElementProps.js +3 -3
  38. package/lib/utils/getRTLSafeKey.js +5 -5
  39. package/lib/utils/getReactCallbackName.js +3 -3
  40. package/lib/utils/index.js +8 -8
  41. package/lib/utils/isHTMLElement.js +3 -1
  42. package/lib/utils/isHTMLElement.js.map +1 -1
  43. package/lib/utils/isInteractiveHTMLElement.js +5 -5
  44. package/lib/utils/mergeCallbacks.js +2 -2
  45. package/lib/utils/mergeCallbacks.js.map +1 -1
  46. package/lib/utils/properties.js +27 -27
  47. package/lib/utils/properties.js.map +1 -1
  48. package/lib-commonjs/compose/getSlots.js +5 -4
  49. package/lib-commonjs/compose/getSlots.js.map +1 -1
  50. package/lib-commonjs/compose/index.js.map +1 -1
  51. package/lib-commonjs/compose/isResolvedShorthand.js +1 -1
  52. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  53. package/lib-commonjs/compose/resolveShorthand.js +2 -2
  54. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  55. package/lib-commonjs/compose/types.js.map +1 -1
  56. package/lib-commonjs/events/index.js.map +1 -1
  57. package/lib-commonjs/events/mouseTouchHelpers.js +7 -7
  58. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  59. package/lib-commonjs/hooks/index.js.map +1 -1
  60. package/lib-commonjs/hooks/useControllableState.js +10 -10
  61. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  62. package/lib-commonjs/hooks/useEventCallback.js +1 -1
  63. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  64. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  65. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  66. package/lib-commonjs/hooks/useId.js +4 -4
  67. package/lib-commonjs/hooks/useId.js.map +1 -1
  68. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  69. package/lib-commonjs/hooks/useMergedRefs.js +1 -1
  70. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  71. package/lib-commonjs/hooks/useOnClickOutside.js +28 -18
  72. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  73. package/lib-commonjs/hooks/useOnScrollOutside.js +7 -5
  74. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  75. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  76. package/lib-commonjs/hooks/useScrollbarWidth.js +4 -4
  77. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  78. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  79. package/lib-commonjs/index.js.map +1 -1
  80. package/lib-commonjs/ssr/SSRContext.js +9 -8
  81. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  82. package/lib-commonjs/ssr/canUseDOM.js +1 -1
  83. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  84. package/lib-commonjs/ssr/index.js.map +1 -1
  85. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +2 -2
  86. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  87. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  88. package/lib-commonjs/trigger/index.js.map +1 -1
  89. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  90. package/lib-commonjs/trigger/types.js.map +1 -1
  91. package/lib-commonjs/utils/getNativeElementProps.js +2 -2
  92. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  93. package/lib-commonjs/utils/getRTLSafeKey.js +5 -5
  94. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  95. package/lib-commonjs/utils/getReactCallbackName.js +2 -2
  96. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  97. package/lib-commonjs/utils/index.js.map +1 -1
  98. package/lib-commonjs/utils/isHTMLElement.js +3 -1
  99. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  100. package/lib-commonjs/utils/isInteractiveHTMLElement.js +4 -4
  101. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  102. package/lib-commonjs/utils/mergeCallbacks.js +2 -2
  103. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  104. package/lib-commonjs/utils/properties.js +214 -214
  105. package/lib-commonjs/utils/properties.js.map +1 -1
  106. package/package.json +3 -2
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { useEventCallback } from "./useEventCallback";
1
+ import * as React from 'react';
2
+ import { useEventCallback } from './useEventCallback';
3
3
  /**
4
4
  * @internal
5
5
  * Utility to perform checks where a click/touch event was made outside a component
@@ -13,7 +13,9 @@ export const useOnScrollOutside = options => {
13
13
  contains: containsProp
14
14
  } = options;
15
15
  const listener = useEventCallback(ev => {
16
- const contains = containsProp || ((parent, child) => !!parent?.contains(child));
16
+ const contains = containsProp || ((parent, child) => {
17
+ return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
18
+ });
17
19
  const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));
18
20
  if (isOutside && !disabled) {
19
21
  callback(ev);
@@ -21,12 +23,12 @@ export const useOnScrollOutside = options => {
21
23
  });
22
24
  React.useEffect(() => {
23
25
  if (!disabled) {
24
- element?.addEventListener("wheel", listener);
25
- element?.addEventListener("touchmove", listener);
26
+ element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);
27
+ element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);
26
28
  }
27
29
  return () => {
28
- element?.removeEventListener("wheel", listener);
29
- element?.removeEventListener("touchmove", listener);
30
+ element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);
31
+ element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);
30
32
  };
31
33
  }, [listener, element, disabled]);
32
34
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEventCallback","useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","ev","parent","child","isOutside","every","ref","current","target","useEffect","addEventListener","removeEventListener"],"sources":["../../src/hooks/useOnScrollOutside.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n if (!disabled) {\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n }\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AAGjC;;;;AAIA,OAAO,MAAMC,kBAAA,GAAsBC,OAAA,IAA8C;EAC/E,MAAM;IAAEC,IAAA;IAAMC,QAAA;IAAUC,OAAA;IAASC,QAAA;IAAUC,QAAA,EAAUC;EAAY,CAAE,GAAGN,OAAA;EAEtE,MAAMO,QAAA,GAAWT,gBAAA,CAAkBU,EAAA,IAAgC;IACjE,MAAMH,QAAA,GACJC,YAAA,KAAiB,CAACG,MAAA,EAAQC,KAAA,KAAU,CAAC,CAACD,MAAA,EAAQJ,QAAA,CAASK,KAAA,CAAK;IAE9D,MAAMC,SAAA,GAAYV,IAAA,CAAKW,KAAK,CAACC,GAAA,IAAO,CAACR,QAAA,CAASQ,GAAA,CAAIC,OAAO,IAAI,IAAI,EAAEN,EAAA,CAAGO,MAAM;IAC5E,IAAIJ,SAAA,IAAa,CAACP,QAAA,EAAU;MAC1BF,QAAA,CAASM,EAAA;IACX;EACF;EAEAX,KAAA,CAAMmB,SAAS,CAAC,MAAM;IACpB,IAAI,CAACZ,QAAA,EAAU;MACbD,OAAA,EAASc,gBAAA,CAAiB,SAASV,QAAA;MACnCJ,OAAA,EAASc,gBAAA,CAAiB,aAAaV,QAAA;IACzC;IAEA,OAAO,MAAM;MACXJ,OAAA,EAASe,mBAAA,CAAoB,SAASX,QAAA;MACtCJ,OAAA,EAASe,mBAAA,CAAoB,aAAaX,QAAA;IAC5C;EACF,GAAG,CAACA,QAAA,EAAUJ,OAAA,EAASC,QAAA,CAAS;AAClC"}
1
+ {"version":3,"names":["React","useEventCallback","useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","ev","parent","child","isOutside","every","ref","current","target","useEffect","addEventListener","removeEventListener"],"sources":["../../src/hooks/useOnScrollOutside.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n if (!disabled) {\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n }\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AAGjC;;;;AAIA,OAAO,MAAMC,kBAAA,GAAsBC,OAAA,IAA8C;EAC/E,MAAM;IAAEC,IAAA;IAAMC,QAAA;IAAUC,OAAA;IAASC,QAAA;IAAUC,QAAA,EAAUC;EAAY,CAAE,GAAGN,OAAA;EAEtE,MAAMO,QAAA,GAAWT,gBAAA,CAAkBU,EAAA,IAAgC;IACjE,MAAMH,QAAA,GACJC,YAAA,KAAiB,CAACG,MAAA,EAAQC,KAAA;MAAU,QAAC,EAACD,MAAA,aAAAA,MAAA,uBAAAA,MAAA,CAAQJ,QAAQ,CAACK,KAAA;KAAK;IAE9D,MAAMC,SAAA,GAAYV,IAAA,CAAKW,KAAK,CAACC,GAAA,IAAO,CAACR,QAAA,CAASQ,GAAA,CAAIC,OAAO,IAAI,IAAI,EAAEN,EAAA,CAAGO,MAAM;IAC5E,IAAIJ,SAAA,IAAa,CAACP,QAAA,EAAU;MAC1BF,QAAA,CAASM,EAAA;IACX;EACF;EAEAX,KAAA,CAAMmB,SAAS,CAAC,MAAM;IACpB,IAAI,CAACZ,QAAA,EAAU;MACbD,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASc,gBAAgB,CAAC,SAASV,QAAA;MACnCJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASc,gBAAgB,CAAC,aAAaV,QAAA;IACzC;IAEA,OAAO,MAAM;MACXJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASe,mBAAmB,CAAC,SAASX,QAAA;MACtCJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASe,mBAAmB,CAAC,aAAaX,QAAA;IAC5C;EACF,GAAG,CAACA,QAAA,EAAUJ,OAAA,EAASC,QAAA,CAAS;AAClC"}
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  /**
3
3
  * @internal
4
4
  */
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  const cache = /*#__PURE__*/new WeakMap();
3
3
  /**
4
4
  * @returns The width in pixels of the scrollbar in the user agent
@@ -15,10 +15,10 @@ export function useScrollbarWidth(options) {
15
15
  if (!force && cache.has(targetDocument)) {
16
16
  return cache.get(targetDocument);
17
17
  }
18
- const outer = targetDocument.createElement("div");
19
- outer.style.visibility = "hidden";
20
- outer.style.overflow = "scroll";
21
- const inner = targetDocument.createElement("div");
18
+ const outer = targetDocument.createElement('div');
19
+ outer.style.visibility = 'hidden';
20
+ outer.style.overflow = 'scroll';
21
+ const inner = targetDocument.createElement('div');
22
22
  outer.appendChild(inner);
23
23
  targetDocument.body.appendChild(outer);
24
24
  const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  /**
3
3
  * @internal
4
4
  * Helper to manage a browser timeout.
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export { getSlots, resolveShorthand, isResolvedShorthand } from "./compose/index";
2
- export { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from "./hooks/index";
3
- export { canUseDOM, useIsSSR, SSRProvider } from "./ssr/index";
4
- export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit } from "./utils/index";
5
- export { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from "./trigger/index";
6
- export { isTouchEvent, isMouseEvent, getEventClientCoords } from "./events/index";
1
+ export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';
2
+ export { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';
3
+ export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
4
+ export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit } from './utils/index';
5
+ export { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';
6
+ export { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';
7
7
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { canUseDOM } from "./canUseDOM";
1
+ import * as React from 'react';
2
+ import { canUseDOM } from './canUseDOM';
3
3
  /**
4
4
  * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.
5
5
  *
@@ -13,7 +13,8 @@ export const SSRContext = /*#__PURE__*/React.createContext(undefined);
13
13
  * @internal
14
14
  */
15
15
  export function useSSRContext() {
16
- return React.useContext(SSRContext) ?? defaultSSRContextValue;
16
+ var _React_useContext;
17
+ return (_React_useContext = React.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;
17
18
  }
18
19
  /**
19
20
  * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids
@@ -38,10 +39,10 @@ export function useIsSSR() {
38
39
  const [isSSR, setIsSSR] = React.useState(isInSSRContext);
39
40
  // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
40
41
  // developer to add one.
41
- if (process.env.NODE_ENV !== "production") {
42
+ if (process.env.NODE_ENV !== 'production') {
42
43
  if (!isInSSRContext && !canUseDOM()) {
43
44
  // eslint-disable-next-line no-console
44
- console.error(["@fluentui/react-components: ", "When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are " + "generated between the client and server.", "\n", "\n", "Check documentation at https://aka.ms/fluentui-ssr"].join(""));
45
+ console.error(['@fluentui/react-components: ', 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.', '\n', '\n', 'Check documentation at https://aka.ms/fluentui-ssr'].join(''));
45
46
  }
46
47
  }
47
48
  // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
@@ -1 +1 @@
1
- {"version":3,"names":["React","canUseDOM","defaultSSRContextValue","current","SSRContext","createContext","undefined","useSSRContext","useContext","SSRProvider","props","value","useState","createElement","Provider","children","useIsSSR","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","console","error","join","useLayoutEffect"],"sources":["../../src/ssr/SSRContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue | undefined>(undefined) as React.Context<SSRContextValue>;\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext) ?? defaultSSRContextValue;\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC<{ children: React.ReactNode }> = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(\n [\n '@fluentui/react-components: ',\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' +\n 'generated between the client and server.',\n '\\n',\n '\\n',\n 'Check documentation at https://aka.ms/fluentui-ssr',\n ].join(''),\n );\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,QAAQ;AAY1B;;;;;AAKA,OAAO,MAAMC,sBAAA,GAA0C;EACrDC,OAAA,EAAS;AACX;AAEA,OAAO,MAAMC,UAAA,gBAAaJ,KAAA,CAAMK,aAAa,CAA8BC,SAAA;AAE3E;;;AAGA,OAAO,SAASC,cAAA,EAAiC;EAC/C,OAAOP,KAAA,CAAMQ,UAAU,CAACJ,UAAA,KAAeF,sBAAA;AACzC;AAEA;;;;;;AAMA,OAAO,MAAMO,WAAA,GAAuDC,KAAA,IAAS;EAC3E,MAAM,CAACC,KAAA,CAAM,GAAGX,KAAA,CAAMY,QAAQ,CAAkB,OAAO;IAAET,OAAA,EAAS;EAAE;EAEpE,oBAAOH,KAAA,CAAAa,aAAA,CAACT,UAAA,CAAWU,QAAQ;IAACH,KAAA,EAAOA;KAAQD,KAAA,CAAMK,QAAQ;AAC3D;AAEA;;;;AAIA,OAAO,SAASC,SAAA,EAAoB;EAClC,MAAMC,cAAA,GAAiBV,aAAA,OAAoBL,sBAAA;EAC3C,MAAM,CAACgB,KAAA,EAAOC,QAAA,CAAS,GAAGnB,KAAA,CAAMY,QAAQ,CAACK,cAAA;EAEzC;EACA;EACA,IAAIG,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC,IAAI,CAACL,cAAA,IAAkB,CAAChB,SAAA,IAAa;MACnC;MACAsB,OAAA,CAAQC,KAAK,CACX,CACE,gCACA,4GACE,4CACF,MACA,MACA,qDACD,CAACC,IAAI,CAAC;IAEX;EACF;EAEA;EACA;EACA,IAAIxB,SAAA,MAAegB,cAAA,EAAgB;IACjC;IACA;IACA;IACAjB,KAAA,CAAM0B,eAAe,CAAC,MAAM;MAC1BP,QAAA,CAAS,KAAK;IAChB,GAAG,EAAE;EACP;EAEA,OAAOD,KAAA;AACT"}
1
+ {"version":3,"names":["React","canUseDOM","defaultSSRContextValue","current","SSRContext","createContext","undefined","useSSRContext","_React_useContext","useContext","SSRProvider","props","value","useState","createElement","Provider","children","useIsSSR","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","console","error","join","useLayoutEffect"],"sources":["../../src/ssr/SSRContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue | undefined>(undefined) as React.Context<SSRContextValue>;\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext) ?? defaultSSRContextValue;\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC<{ children: React.ReactNode }> = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(\n [\n '@fluentui/react-components: ',\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' +\n 'generated between the client and server.',\n '\\n',\n '\\n',\n 'Check documentation at https://aka.ms/fluentui-ssr',\n ].join(''),\n );\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,QAAQ;AAY1B;;;;;AAKA,OAAO,MAAMC,sBAAA,GAA0C;EACrDC,OAAA,EAAS;AACX;AAEA,OAAO,MAAMC,UAAA,gBAAaJ,KAAA,CAAMK,aAAa,CAA8BC,SAAA;AAE3E;;;AAGA,OAAO,SAASC,cAAA,EAAiC;MACxCC,iBAAA;EAAP,OAAO,CAAAA,iBAAA,GAAAR,KAAA,CAAMS,UAAU,CAACL,UAAA,eAAjBI,iBAAA,cAAAA,iBAAA,GAAgCN,sBAAsB;AAC/D;AAEA;;;;;;AAMA,OAAO,MAAMQ,WAAA,GAAuDC,KAAA,IAAS;EAC3E,MAAM,CAACC,KAAA,CAAM,GAAGZ,KAAA,CAAMa,QAAQ,CAAkB,OAAO;IAAEV,OAAA,EAAS;EAAE;EAEpE,oBAAOH,KAAA,CAAAc,aAAA,CAACV,UAAA,CAAWW,QAAQ;IAACH,KAAA,EAAOA;KAAQD,KAAA,CAAMK,QAAQ;AAC3D;AAEA;;;;AAIA,OAAO,SAASC,SAAA,EAAoB;EAClC,MAAMC,cAAA,GAAiBX,aAAA,OAAoBL,sBAAA;EAC3C,MAAM,CAACiB,KAAA,EAAOC,QAAA,CAAS,GAAGpB,KAAA,CAAMa,QAAQ,CAACK,cAAA;EAEzC;EACA;EACA,IAAIG,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC,IAAI,CAACL,cAAA,IAAkB,CAACjB,SAAA,IAAa;MACnC;MACAuB,OAAA,CAAQC,KAAK,CACX,CACE,gCACA,4GACE,4CACF,MACA,MACA,qDACD,CAACC,IAAI,CAAC;IAEX;EACF;EAEA;EACA;EACA,IAAIzB,SAAA,MAAeiB,cAAA,EAAgB;IACjC;IACA;IACA;IACAlB,KAAA,CAAM2B,eAAe,CAAC,MAAM;MAC1BP,QAAA,CAAS,KAAK;IAChB,GAAG,EAAE;EACP;EAEA,OAAOD,KAAA;AACT"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Verifies if an application can use DOM.
3
3
  */export function canUseDOM() {
4
- return typeof window !== "undefined" && !!(window.document &&
4
+ return typeof window !== 'undefined' && !!(window.document &&
5
5
  // eslint-disable-next-line deprecation/deprecation
6
6
  window.document.createElement);
7
7
  }
package/lib/ssr/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./canUseDOM";
2
- export * from "./SSRContext";
1
+ export * from './canUseDOM';
2
+ export * from './SSRContext';
3
3
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
- import * as React from "react";
2
- import { isFluentTrigger } from "./isFluentTrigger";
1
+ import * as React from 'react';
2
+ import { isFluentTrigger } from './isFluentTrigger';
3
3
  /**
4
4
  * @internal
5
5
  * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.
6
6
  */
7
7
  export function applyTriggerPropsToChildren(children, triggerChildProps) {
8
- if (typeof children === "function") {
8
+ if (typeof children === 'function') {
9
9
  return children(triggerChildProps);
10
10
  } else if (children) {
11
11
  return cloneTriggerTree(children, triggerChildProps);
@@ -21,7 +21,7 @@ export function applyTriggerPropsToChildren(children, triggerChildProps) {
21
21
  */
22
22
  function cloneTriggerTree(child, triggerProps) {
23
23
  if (! /*#__PURE__*/React.isValidElement(child) || child.type === React.Fragment) {
24
- throw new Error("A trigger element must be a single element for this component. " + "Please ensure that you're not using React Fragments.");
24
+ throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
25
25
  }
26
26
  if (isFluentTrigger(child)) {
27
27
  const grandchild = cloneTriggerTree(child.props.children, triggerProps);
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { isFluentTrigger } from "./isFluentTrigger";
1
+ import * as React from 'react';
2
+ import { isFluentTrigger } from './isFluentTrigger';
3
3
  /**
4
4
  * @internal
5
5
  * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
@@ -1,5 +1,5 @@
1
- export * from "./applyTriggerPropsToChildren";
2
- export * from "./getTriggerChild";
3
- export * from "./isFluentTrigger";
4
- export * from "./types";
1
+ export * from './applyTriggerPropsToChildren';
2
+ export * from './getTriggerChild';
3
+ export * from './isFluentTrigger';
4
+ export * from './types';
5
5
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  /**
3
3
  * @internal
4
4
  * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
@@ -1,2 +1,2 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  //# sourceMappingURL=types.js.map
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, fieldsetProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps, timeProperties, dialogProperties } from "./properties";
1
+ import * as React from 'react';
2
+ import { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, fieldsetProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps, timeProperties, dialogProperties } from './properties';
3
3
  const nativeElementMap = {
4
4
  label: labelProperties,
5
5
  audio: audioProperties,
@@ -55,7 +55,7 @@ export const getPartitionedNativeProps = ({
55
55
  style: props.style,
56
56
  className: props.className
57
57
  },
58
- primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), "style", "className"])
58
+ primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
59
59
  };
60
60
  };
61
61
  //# sourceMappingURL=getNativeElementProps.js.map
@@ -2,15 +2,15 @@
2
2
  * @internal
3
3
  * Finds and swaps a provided key for it's right to left format.
4
4
  */export const getRTLSafeKey = (key, dir) => {
5
- if (dir === "rtl") {
5
+ if (dir === 'rtl') {
6
6
  switch (key) {
7
- case "ArrowLeft":
7
+ case 'ArrowLeft':
8
8
  {
9
- return "ArrowRight";
9
+ return 'ArrowRight';
10
10
  }
11
- case "ArrowRight":
11
+ case 'ArrowRight':
12
12
  {
13
- return "ArrowLeft";
13
+ return 'ArrowLeft';
14
14
  }
15
15
  }
16
16
  }
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  /**
3
3
  * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.
4
4
  *
@@ -16,9 +16,9 @@ export function getReactCallbackName(event) {
16
16
  }
17
17
  return event.dispatchConfig.phasedRegistrationNames.bubbled;
18
18
  }
19
- if (process.env.NODE_ENV !== "production") {
19
+ if (process.env.NODE_ENV !== 'production') {
20
20
  // eslint-disable-next-line no-console
21
- console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', "This should not happen, please report it to https://github.com/microsoft/fluentui"]);
21
+ console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', 'This should not happen, please report it to https://github.com/microsoft/fluentui']);
22
22
  }
23
23
  }
24
24
  //# sourceMappingURL=getReactCallbackName.js.map
@@ -1,9 +1,9 @@
1
- export * from "./clamp";
2
- export * from "./getNativeElementProps";
3
- export * from "./getRTLSafeKey";
4
- export * from "./mergeCallbacks";
5
- export * from "./omit";
6
- export * from "./properties";
7
- export * from "./isHTMLElement";
8
- export * from "./isInteractiveHTMLElement";
1
+ export * from './clamp';
2
+ export * from './getNativeElementProps';
3
+ export * from './getRTLSafeKey';
4
+ export * from './mergeCallbacks';
5
+ export * from './omit';
6
+ export * from './properties';
7
+ export * from './isHTMLElement';
8
+ export * from './isInteractiveHTMLElement';
9
9
  //# sourceMappingURL=index.js.map
@@ -12,7 +12,9 @@
12
12
  * ```
13
13
  *
14
14
  */export function isHTMLElement(element, options) {
15
+ var _typedElement_ownerDocument;
15
16
  const typedElement = element;
16
- return Boolean(typedElement?.ownerDocument?.defaultView && typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? "HTMLElement"]);
17
+ var _options_constructorName;
18
+ 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']);
17
19
  }
18
20
  //# sourceMappingURL=isHTMLElement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isHTMLElement","element","options","typedElement","Boolean","ownerDocument","defaultView","constructorName"],"sources":["../../src/utils/isHTMLElement.ts"],"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 */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: {\n /**\n * Can be used to provide a custom constructor instead of `HTMLElement`,\n * Like `HTMLInputElement` for example.\n */\n constructorName?: ConstructorName;\n },\n): element is InstanceType<(typeof globalThis)[ConstructorName]> {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? 'HTMLElement'],\n );\n}\n\n/**\n * @internal\n */\nexport type HTMLElementConstructorName =\n | 'HTMLElement'\n | 'HTMLAnchorElement'\n | 'HTMLAreaElement'\n | 'HTMLAudioElement'\n | 'HTMLBaseElement'\n | 'HTMLBodyElement'\n | 'HTMLBRElement'\n | 'HTMLButtonElement'\n | 'HTMLCanvasElement'\n | 'HTMLDataElement'\n | 'HTMLDataListElement'\n | 'HTMLDetailsElement'\n | 'HTMLDialogElement'\n | 'HTMLDivElement'\n | 'HTMLDListElement'\n | 'HTMLEmbedElement'\n | 'HTMLFieldSetElement'\n | 'HTMLFormElement'\n | 'HTMLHeadingElement'\n | 'HTMLHeadElement'\n | 'HTMLHRElement'\n | 'HTMLHtmlElement'\n | 'HTMLIFrameElement'\n | 'HTMLImageElement'\n | 'HTMLInputElement'\n | 'HTMLModElement'\n | 'HTMLLabelElement'\n | 'HTMLLegendElement'\n | 'HTMLLIElement'\n | 'HTMLLinkElement'\n | 'HTMLMapElement'\n | 'HTMLMetaElement'\n | 'HTMLMeterElement'\n | 'HTMLObjectElement'\n | 'HTMLOListElement'\n | 'HTMLOptGroupElement'\n | 'HTMLOptionElement'\n | 'HTMLOutputElement'\n | 'HTMLParagraphElement'\n | 'HTMLParamElement'\n | 'HTMLPreElement'\n | 'HTMLProgressElement'\n | 'HTMLQuoteElement'\n | 'HTMLSlotElement'\n | 'HTMLScriptElement'\n | 'HTMLSelectElement'\n | 'HTMLSourceElement'\n | 'HTMLSpanElement'\n | 'HTMLStyleElement'\n | 'HTMLTableElement'\n | 'HTMLTableColElement'\n | 'HTMLTableRowElement'\n | 'HTMLTableSectionElement'\n | 'HTMLTemplateElement'\n | 'HTMLTextAreaElement'\n | 'HTMLTimeElement'\n | 'HTMLTitleElement'\n | 'HTMLTrackElement'\n | 'HTMLUListElement'\n | 'HTMLVideoElement';\n"],"mappings":"AAAA;;;;;;;;;;;;;GAcA,OAAO,SAASA,cACdC,OAAiB,EACjBC,OAMC,EAC8D;EAC/D,MAAMC,YAAA,GAAeF,OAAA;EACrB,OAAOG,OAAA,CACLD,YAAA,EAAcE,aAAA,EAAeC,WAAA,IAC3BH,YAAA,YAAwBA,YAAA,CAAaE,aAAa,CAACC,WAAW,CAACJ,OAAA,EAASK,eAAA,IAAmB,cAAc;AAE/G"}
1
+ {"version":3,"names":["isHTMLElement","element","options","_typedElement_ownerDocument","typedElement","_options_constructorName","Boolean","ownerDocument","defaultView","constructorName"],"sources":["../../src/utils/isHTMLElement.ts"],"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 */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: {\n /**\n * Can be used to provide a custom constructor instead of `HTMLElement`,\n * Like `HTMLInputElement` for example.\n */\n constructorName?: ConstructorName;\n },\n): element is InstanceType<(typeof globalThis)[ConstructorName]> {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? 'HTMLElement'],\n );\n}\n\n/**\n * @internal\n */\nexport type HTMLElementConstructorName =\n | 'HTMLElement'\n | 'HTMLAnchorElement'\n | 'HTMLAreaElement'\n | 'HTMLAudioElement'\n | 'HTMLBaseElement'\n | 'HTMLBodyElement'\n | 'HTMLBRElement'\n | 'HTMLButtonElement'\n | 'HTMLCanvasElement'\n | 'HTMLDataElement'\n | 'HTMLDataListElement'\n | 'HTMLDetailsElement'\n | 'HTMLDialogElement'\n | 'HTMLDivElement'\n | 'HTMLDListElement'\n | 'HTMLEmbedElement'\n | 'HTMLFieldSetElement'\n | 'HTMLFormElement'\n | 'HTMLHeadingElement'\n | 'HTMLHeadElement'\n | 'HTMLHRElement'\n | 'HTMLHtmlElement'\n | 'HTMLIFrameElement'\n | 'HTMLImageElement'\n | 'HTMLInputElement'\n | 'HTMLModElement'\n | 'HTMLLabelElement'\n | 'HTMLLegendElement'\n | 'HTMLLIElement'\n | 'HTMLLinkElement'\n | 'HTMLMapElement'\n | 'HTMLMetaElement'\n | 'HTMLMeterElement'\n | 'HTMLObjectElement'\n | 'HTMLOListElement'\n | 'HTMLOptGroupElement'\n | 'HTMLOptionElement'\n | 'HTMLOutputElement'\n | 'HTMLParagraphElement'\n | 'HTMLParamElement'\n | 'HTMLPreElement'\n | 'HTMLProgressElement'\n | 'HTMLQuoteElement'\n | 'HTMLSlotElement'\n | 'HTMLScriptElement'\n | 'HTMLSelectElement'\n | 'HTMLSourceElement'\n | 'HTMLSpanElement'\n | 'HTMLStyleElement'\n | 'HTMLTableElement'\n | 'HTMLTableColElement'\n | 'HTMLTableRowElement'\n | 'HTMLTableSectionElement'\n | 'HTMLTemplateElement'\n | 'HTMLTextAreaElement'\n | 'HTMLTimeElement'\n | 'HTMLTitleElement'\n | 'HTMLTrackElement'\n | 'HTMLUListElement'\n | 'HTMLVideoElement';\n"],"mappings":"AAAA;;;;;;;;;;;;;GAcA,OAAO,SAASA,cACdC,OAAiB,EACjBC,OAMC,EAC8D;MAG7DC,2BAAA;EAFF,MAAMC,YAAA,GAAeH,OAAA;MAG8CI,wBAAA;EAFnE,OAAOC,OAAA,CACL,CAAAF,YAAA,aAAAA,YAAA,wBAAAD,2BAAA,GAAAC,YAAA,CAAcG,aAAa,cAA3BJ,2BAAA,uBAAAA,2BAAA,CAA6BK,WAAF,KACzBJ,YAAA,YAAwBA,YAAA,CAAaG,aAAa,CAACC,WAAW,CAAC,CAAAH,wBAAA,GAAAH,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASO,eAAe,cAAxBJ,wBAAA,cAAAA,wBAAA,GAA4B,aAAa,CAAC;AAE/G"}
@@ -1,4 +1,4 @@
1
- import { isHTMLElement } from "./isHTMLElement";
1
+ import { isHTMLElement } from './isHTMLElement';
2
2
  /**
3
3
  * @internal
4
4
  * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
@@ -11,10 +11,10 @@ export function isInteractiveHTMLElement(element) {
11
11
  tagName
12
12
  } = element;
13
13
  switch (tagName) {
14
- case "BUTTON":
15
- case "A":
16
- case "INPUT":
17
- case "TEXTAREA":
14
+ case 'BUTTON':
15
+ case 'A':
16
+ case 'INPUT':
17
+ case 'TEXTAREA':
18
18
  return true;
19
19
  }
20
20
  return element.isContentEditable;
@@ -22,8 +22,8 @@
22
22
  * @returns A function that that calls the provided functions in order
23
23
  */export function mergeCallbacks(callback1, callback2) {
24
24
  return (...args) => {
25
- callback1?.(...args);
26
- callback2?.(...args);
25
+ callback1 === null || callback1 === void 0 ? void 0 : callback1(...args);
26
+ callback2 === null || callback2 === void 0 ? void 0 : callback2(...args);
27
27
  };
28
28
  }
29
29
  //# sourceMappingURL=mergeCallbacks.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["mergeCallbacks","callback1","callback2","args"],"sources":["../../src/utils/mergeCallbacks.ts"],"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 */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAuBA,OAAO,SAASA,eACdC,SAAgD,EAChDC,SAAgD,EAChD;EACA,OAAO,CAAC,GAAGC,IAAA,KAAe;IACxBF,SAAA,MAAeE,IAAA;IACfD,SAAA,MAAeC,IAAA;EACjB;AACF"}
1
+ {"version":3,"names":["mergeCallbacks","callback1","callback2","args"],"sources":["../../src/utils/mergeCallbacks.ts"],"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 */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAuBA,OAAO,SAASA,eACdC,SAAgD,EAChDC,SAAgD,EAChD;EACA,OAAO,CAAC,GAAGC,IAAA,KAAe;IACxBF,SAAA,aAAAA,SAAA,uBAAAA,SAAA,IAAeE,IAAA;IACfD,SAAA,aAAAA,SAAA,uBAAAA,SAAA,IAAeC,IAAA;EACjB;AACF"}
@@ -13,19 +13,19 @@ const toObjectMap = (...items) => {
13
13
  *
14
14
  * @public
15
15
  */
16
- export const baseElementEvents = /*#__PURE__*/toObjectMap(["onAuxClick", "onCopy", "onCut", "onPaste", "onCompositionEnd", "onCompositionStart", "onCompositionUpdate", "onFocus", "onFocusCapture", "onBlur", "onBlurCapture", "onChange", "onInput", "onSubmit", "onLoad", "onError", "onKeyDown", "onKeyDownCapture", "onKeyPress", "onKeyUp", "onAbort", "onCanPlay", "onCanPlayThrough", "onDurationChange", "onEmptied", "onEncrypted", "onEnded", "onLoadedData", "onLoadedMetadata", "onLoadStart", "onPause", "onPlay", "onPlaying", "onProgress", "onRateChange", "onSeeked", "onSeeking", "onStalled", "onSuspend", "onTimeUpdate", "onVolumeChange", "onWaiting", "onClick", "onClickCapture", "onContextMenu", "onDoubleClick", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop", "onMouseDown", "onMouseDownCapture", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp", "onMouseUpCapture", "onSelect", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onScroll", "onWheel", "onPointerCancel", "onPointerDown", "onPointerEnter", "onPointerLeave", "onPointerMove", "onPointerOut", "onPointerOver", "onPointerUp", "onGotPointerCapture", "onLostPointerCapture"]);
16
+ export const baseElementEvents = /*#__PURE__*/toObjectMap(['onAuxClick', 'onCopy', 'onCut', 'onPaste', 'onCompositionEnd', 'onCompositionStart', 'onCompositionUpdate', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onInput', 'onSubmit', 'onLoad', 'onError', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyUp', 'onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onClick', 'onClickCapture', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart', 'onScroll', 'onWheel', 'onPointerCancel', 'onPointerDown', 'onPointerEnter', 'onPointerLeave', 'onPointerMove', 'onPointerOut', 'onPointerOver', 'onPointerUp', 'onGotPointerCapture', 'onLostPointerCapture']);
17
17
  /**
18
18
  * An array of element attributes which are allowed on every html element type.
19
19
  *
20
20
  * @public
21
21
  */
22
- export const baseElementProperties = /*#__PURE__*/toObjectMap(["accessKey", "children", "className", "contentEditable", "dir", "draggable", "hidden", "htmlFor", "id", "lang", "ref", "role", "style", "tabIndex", "title", "translate", "spellCheck", "name"]);
22
+ export const baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name']);
23
23
  /**
24
24
  * An array of microdata attributes that are allowed on every html element type.
25
25
  *
26
26
  * @public
27
27
  */
28
- export const microdataProperties = /*#__PURE__*/toObjectMap(["itemID", "itemProp", "itemRef", "itemScope", "itemType"]);
28
+ export const microdataProperties = /*#__PURE__*/toObjectMap(['itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType']);
29
29
  /**
30
30
  * An array of HTML element properties and events.
31
31
  *
@@ -37,74 +37,74 @@ export const htmlElementProperties = /*#__PURE__*/toObjectMap(baseElementPropert
37
37
  *
38
38
  * @public
39
39
  */
40
- export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["form"]);
40
+ export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['form']);
41
41
  /**
42
42
  * An array of AUDIO tag properties and events.
43
43
 
44
44
  * @public
45
45
  */
46
- export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["height", "loop", "muted", "preload", "src", "width"]);
46
+ export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width']);
47
47
  /**
48
48
  * An array of VIDEO tag properties and events.
49
49
  *
50
50
  * @public
51
51
  */
52
- export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ["poster"]);
52
+ export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ['poster']);
53
53
  /**
54
54
  * An array of OL tag properties and events.
55
55
  *
56
56
  * @public
57
57
  */
58
- export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["start"]);
58
+ export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['start']);
59
59
  /**
60
60
  * An array of LI tag properties and events.
61
61
  *
62
62
  * @public
63
63
  */
64
- export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["value"]);
64
+ export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['value']);
65
65
  /**
66
66
  * An array of A tag properties and events.
67
67
  *
68
68
  * @public
69
69
  */
70
- export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["download", "href", "hrefLang", "media", "rel", "target", "type"]);
70
+ export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type']);
71
71
  /**
72
72
  * An array of TIME tag properties and events.
73
73
  *
74
74
  * @public
75
75
  */
76
- export const timeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["dateTime"]);
76
+ export const timeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['dateTime']);
77
77
  /**
78
78
  * An array of BUTTON tag properties and events.
79
79
  *
80
80
  * @public
81
81
  */
82
- export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["autoFocus", "disabled", "form", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "type", "value"]);
82
+ export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value']);
83
83
  /**
84
84
  * An array of INPUT tag properties and events.
85
85
  *
86
86
  * @public
87
87
  */
88
- export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ["accept", "alt", "autoCapitalize", "autoComplete", "checked", "dirname", "form", "height", "inputMode", "list", "max", "maxLength", "min", "multiple", "pattern", "placeholder", "readOnly", "required", "src", "step", "size", "type", "value", "width"]);
88
+ export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width']);
89
89
  /**
90
90
  * An array of TEXTAREA tag properties and events.
91
91
  *
92
92
  * @public
93
93
  */
94
- export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ["autoCapitalize", "cols", "dirname", "form", "maxLength", "placeholder", "readOnly", "required", "rows", "wrap"]);
94
+ export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap']);
95
95
  /**
96
96
  * An array of SELECT tag properties and events.
97
97
  *
98
98
  * @public
99
99
  */
100
- export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ["form", "multiple", "required"]);
101
- export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["selected", "value"]);
100
+ export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['form', 'multiple', 'required']);
101
+ export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value']);
102
102
  /**
103
103
  * An array of TABLE tag properties and events.
104
104
  *
105
105
  * @public
106
106
  */
107
- export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["cellPadding", "cellSpacing"]);
107
+ export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['cellPadding', 'cellSpacing']);
108
108
  /**
109
109
  * An array of TR tag properties and events.
110
110
  *
@@ -116,45 +116,45 @@ export const trProperties = htmlElementProperties;
116
116
  *
117
117
  * @public
118
118
  */
119
- export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["colSpan", "rowSpan", "scope"]);
119
+ export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'rowSpan', 'scope']);
120
120
  /**
121
121
  * An array of TD tag properties and events.
122
122
  *
123
123
  * @public
124
124
  */
125
- export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["colSpan", "headers", "rowSpan", "scope"]);
126
- export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["span"]);
127
- export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["span"]);
125
+ export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope']);
126
+ export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
127
+ export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
128
128
  /**
129
129
  * An array of FIELDSET tag properties and events.
130
130
  *
131
131
  * @public
132
132
  */
133
- export const fieldsetProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["disabled", "form"]);
133
+ export const fieldsetProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['disabled', 'form']);
134
134
  /**
135
135
  * An array of FORM tag properties and events.
136
136
  *
137
137
  * @public
138
138
  */
139
- export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["acceptCharset", "action", "encType", "encType", "method", "noValidate", "target"]);
139
+ export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target']);
140
140
  /**
141
141
  * An array of IFRAME tag properties and events.
142
142
  *
143
143
  * @public
144
144
  */
145
- export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["allow", "allowFullScreen", "allowPaymentRequest", "allowTransparency", "csp", "height", "importance", "referrerPolicy", "sandbox", "src", "srcDoc", "width"]);
145
+ export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width']);
146
146
  /**
147
147
  * An array of IMAGE tag properties and events.
148
148
  *
149
149
  * @public
150
150
  */
151
- export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["alt", "crossOrigin", "height", "src", "srcSet", "useMap", "width"]);
151
+ export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width']);
152
152
  /**
153
153
  * An array of DIALOG tag properties and events.
154
154
  *
155
155
  * @public
156
156
  */
157
- export const dialogProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["open", "onCancel", "onClose"]);
157
+ export const dialogProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['open', 'onCancel', 'onClose']);
158
158
  /**
159
159
  * An array of DIV tag properties and events.
160
160
  *
@@ -189,8 +189,8 @@ props, allowedPropNames, excludedPropNames) {
189
189
  const result = {};
190
190
  const keys = Object.keys(props);
191
191
  for (const key of keys) {
192
- const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf("data-") === 0 || key.indexOf("aria-") === 0;
193
- if (isNativeProp && (!excludedPropNames || excludedPropNames?.indexOf(key) === -1)) {
192
+ const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
193
+ if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
194
194
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
195
195
  result[key] = props[key];
196
196
  }