@fluentui/react-utilities 0.0.0-nightly050f89bf0020211102.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 (217) hide show
  1. package/CHANGELOG.json +1637 -0
  2. package/CHANGELOG.md +677 -0
  3. package/LICENSE +15 -0
  4. package/README.md +5 -0
  5. package/dist/react-utilities.d.ts +648 -0
  6. package/lib/compose/getSlots.d.ts +29 -0
  7. package/lib/compose/getSlots.js +72 -0
  8. package/lib/compose/getSlots.js.map +1 -0
  9. package/lib/compose/index.d.ts +4 -0
  10. package/lib/compose/index.js +5 -0
  11. package/lib/compose/index.js.map +1 -0
  12. package/lib/compose/nullRender.d.ts +4 -0
  13. package/lib/compose/nullRender.js +7 -0
  14. package/lib/compose/nullRender.js.map +1 -0
  15. package/lib/compose/resolveShorthand.d.ts +12 -0
  16. package/lib/compose/resolveShorthand.js +30 -0
  17. package/lib/compose/resolveShorthand.js.map +1 -0
  18. package/lib/compose/types.d.ts +104 -0
  19. package/lib/compose/types.js +6 -0
  20. package/lib/compose/types.js.map +1 -0
  21. package/lib/hooks/index.d.ts +16 -0
  22. package/lib/hooks/index.js +17 -0
  23. package/lib/hooks/index.js.map +1 -0
  24. package/lib/hooks/useBoolean.d.ts +17 -0
  25. package/lib/hooks/useBoolean.js +39 -0
  26. package/lib/hooks/useBoolean.js.map +1 -0
  27. package/lib/hooks/useConst.d.ts +12 -0
  28. package/lib/hooks/useConst.js +30 -0
  29. package/lib/hooks/useConst.js.map +1 -0
  30. package/lib/hooks/useControllableState.d.ts +21 -0
  31. package/lib/hooks/useControllableState.js +72 -0
  32. package/lib/hooks/useControllableState.js.map +1 -0
  33. package/lib/hooks/useControllableValue.d.ts +20 -0
  34. package/lib/hooks/useControllableValue.js +62 -0
  35. package/lib/hooks/useControllableValue.js.map +1 -0
  36. package/lib/hooks/useEventCallback.d.ts +13 -0
  37. package/lib/hooks/useEventCallback.js +34 -0
  38. package/lib/hooks/useEventCallback.js.map +1 -0
  39. package/lib/hooks/useFirstMount.d.ts +11 -0
  40. package/lib/hooks/useFirstMount.js +23 -0
  41. package/lib/hooks/useFirstMount.js.map +1 -0
  42. package/lib/hooks/useForceUpdate.d.ts +4 -0
  43. package/lib/hooks/useForceUpdate.js +11 -0
  44. package/lib/hooks/useForceUpdate.js.map +1 -0
  45. package/lib/hooks/useId.d.ts +15 -0
  46. package/lib/hooks/useId.js +27 -0
  47. package/lib/hooks/useId.js.map +1 -0
  48. package/lib/hooks/useIsomorphicLayoutEffect.d.ts +11 -0
  49. package/lib/hooks/useIsomorphicLayoutEffect.js +15 -0
  50. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -0
  51. package/lib/hooks/useMergedRefs.d.ts +13 -0
  52. package/lib/hooks/useMergedRefs.js +34 -0
  53. package/lib/hooks/useMergedRefs.js.map +1 -0
  54. package/lib/hooks/useMount.d.ts +6 -0
  55. package/lib/hooks/useMount.js +17 -0
  56. package/lib/hooks/useMount.js.map +1 -0
  57. package/lib/hooks/useOnClickOutside.d.ts +29 -0
  58. package/lib/hooks/useOnClickOutside.js +142 -0
  59. package/lib/hooks/useOnClickOutside.js.map +1 -0
  60. package/lib/hooks/useOnScrollOutside.d.ts +5 -0
  61. package/lib/hooks/useOnScrollOutside.js +38 -0
  62. package/lib/hooks/useOnScrollOutside.js.map +1 -0
  63. package/lib/hooks/usePrevious.d.ts +1 -0
  64. package/lib/hooks/usePrevious.js +9 -0
  65. package/lib/hooks/usePrevious.js.map +1 -0
  66. package/lib/hooks/useTimeout.d.ts +8 -0
  67. package/lib/hooks/useTimeout.js +33 -0
  68. package/lib/hooks/useTimeout.js.map +1 -0
  69. package/lib/hooks/useUnmount.d.ts +6 -0
  70. package/lib/hooks/useUnmount.js +19 -0
  71. package/lib/hooks/useUnmount.js.map +1 -0
  72. package/lib/index.d.ts +4 -0
  73. package/lib/index.js +5 -0
  74. package/lib/index.js.map +1 -0
  75. package/lib/ssr/SSRContext.d.ts +33 -0
  76. package/lib/ssr/SSRContext.js +71 -0
  77. package/lib/ssr/SSRContext.js.map +1 -0
  78. package/lib/ssr/canUseDOM.d.ts +4 -0
  79. package/lib/ssr/canUseDOM.js +8 -0
  80. package/lib/ssr/canUseDOM.js.map +1 -0
  81. package/lib/ssr/index.d.ts +2 -0
  82. package/lib/ssr/index.js +3 -0
  83. package/lib/ssr/index.js.map +1 -0
  84. package/lib/tsdoc-metadata.json +11 -0
  85. package/lib/utils/applyTriggerPropsToChildren.d.ts +5 -0
  86. package/lib/utils/applyTriggerPropsToChildren.js +16 -0
  87. package/lib/utils/applyTriggerPropsToChildren.js.map +1 -0
  88. package/lib/utils/clamp.d.ts +8 -0
  89. package/lib/utils/clamp.js +11 -0
  90. package/lib/utils/clamp.js.map +1 -0
  91. package/lib/utils/getNativeElementProps.d.ts +9 -0
  92. package/lib/utils/getNativeElementProps.js +38 -0
  93. package/lib/utils/getNativeElementProps.js.map +1 -0
  94. package/lib/utils/getRTLSafeKey.d.ts +4 -0
  95. package/lib/utils/getRTLSafeKey.js +21 -0
  96. package/lib/utils/getRTLSafeKey.js.map +1 -0
  97. package/lib/utils/index.d.ts +8 -0
  98. package/lib/utils/index.js +9 -0
  99. package/lib/utils/index.js.map +1 -0
  100. package/lib/utils/omit.d.ts +14 -0
  101. package/lib/utils/omit.js +27 -0
  102. package/lib/utils/omit.js.map +1 -0
  103. package/lib/utils/onlyChild.d.ts +5 -0
  104. package/lib/utils/onlyChild.js +13 -0
  105. package/lib/utils/onlyChild.js.map +1 -0
  106. package/lib/utils/properties.d.ts +148 -0
  107. package/lib/utils/properties.js +218 -0
  108. package/lib/utils/properties.js.map +1 -0
  109. package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +7 -0
  110. package/lib/utils/shouldPreventDefaultOnKeyDown.js +20 -0
  111. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -0
  112. package/lib-commonjs/compose/getSlots.d.ts +29 -0
  113. package/lib-commonjs/compose/getSlots.js +85 -0
  114. package/lib-commonjs/compose/getSlots.js.map +1 -0
  115. package/lib-commonjs/compose/index.d.ts +4 -0
  116. package/lib-commonjs/compose/index.js +16 -0
  117. package/lib-commonjs/compose/index.js.map +1 -0
  118. package/lib-commonjs/compose/nullRender.d.ts +4 -0
  119. package/lib-commonjs/compose/nullRender.js +16 -0
  120. package/lib-commonjs/compose/nullRender.js.map +1 -0
  121. package/lib-commonjs/compose/resolveShorthand.d.ts +12 -0
  122. package/lib-commonjs/compose/resolveShorthand.js +41 -0
  123. package/lib-commonjs/compose/resolveShorthand.js.map +1 -0
  124. package/lib-commonjs/compose/types.d.ts +104 -0
  125. package/lib-commonjs/compose/types.js +10 -0
  126. package/lib-commonjs/compose/types.js.map +1 -0
  127. package/lib-commonjs/hooks/index.d.ts +16 -0
  128. package/lib-commonjs/hooks/index.js +40 -0
  129. package/lib-commonjs/hooks/index.js.map +1 -0
  130. package/lib-commonjs/hooks/useBoolean.d.ts +17 -0
  131. package/lib-commonjs/hooks/useBoolean.js +50 -0
  132. package/lib-commonjs/hooks/useBoolean.js.map +1 -0
  133. package/lib-commonjs/hooks/useConst.d.ts +12 -0
  134. package/lib-commonjs/hooks/useConst.js +40 -0
  135. package/lib-commonjs/hooks/useConst.js.map +1 -0
  136. package/lib-commonjs/hooks/useControllableState.d.ts +21 -0
  137. package/lib-commonjs/hooks/useControllableState.js +82 -0
  138. package/lib-commonjs/hooks/useControllableState.js.map +1 -0
  139. package/lib-commonjs/hooks/useControllableValue.d.ts +20 -0
  140. package/lib-commonjs/hooks/useControllableValue.js +73 -0
  141. package/lib-commonjs/hooks/useControllableValue.js.map +1 -0
  142. package/lib-commonjs/hooks/useEventCallback.d.ts +13 -0
  143. package/lib-commonjs/hooks/useEventCallback.js +45 -0
  144. package/lib-commonjs/hooks/useEventCallback.js.map +1 -0
  145. package/lib-commonjs/hooks/useFirstMount.d.ts +11 -0
  146. package/lib-commonjs/hooks/useFirstMount.js +33 -0
  147. package/lib-commonjs/hooks/useFirstMount.js.map +1 -0
  148. package/lib-commonjs/hooks/useForceUpdate.d.ts +4 -0
  149. package/lib-commonjs/hooks/useForceUpdate.js +21 -0
  150. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -0
  151. package/lib-commonjs/hooks/useId.d.ts +15 -0
  152. package/lib-commonjs/hooks/useId.js +40 -0
  153. package/lib-commonjs/hooks/useId.js.map +1 -0
  154. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +11 -0
  155. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +24 -0
  156. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -0
  157. package/lib-commonjs/hooks/useMergedRefs.d.ts +13 -0
  158. package/lib-commonjs/hooks/useMergedRefs.js +45 -0
  159. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -0
  160. package/lib-commonjs/hooks/useMount.d.ts +6 -0
  161. package/lib-commonjs/hooks/useMount.js +27 -0
  162. package/lib-commonjs/hooks/useMount.js.map +1 -0
  163. package/lib-commonjs/hooks/useOnClickOutside.d.ts +29 -0
  164. package/lib-commonjs/hooks/useOnClickOutside.js +153 -0
  165. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -0
  166. package/lib-commonjs/hooks/useOnScrollOutside.d.ts +5 -0
  167. package/lib-commonjs/hooks/useOnScrollOutside.js +49 -0
  168. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -0
  169. package/lib-commonjs/hooks/usePrevious.d.ts +1 -0
  170. package/lib-commonjs/hooks/usePrevious.js +19 -0
  171. package/lib-commonjs/hooks/usePrevious.js.map +1 -0
  172. package/lib-commonjs/hooks/useTimeout.d.ts +8 -0
  173. package/lib-commonjs/hooks/useTimeout.js +44 -0
  174. package/lib-commonjs/hooks/useTimeout.js.map +1 -0
  175. package/lib-commonjs/hooks/useUnmount.d.ts +6 -0
  176. package/lib-commonjs/hooks/useUnmount.js +29 -0
  177. package/lib-commonjs/hooks/useUnmount.js.map +1 -0
  178. package/lib-commonjs/index.d.ts +4 -0
  179. package/lib-commonjs/index.js +16 -0
  180. package/lib-commonjs/index.js.map +1 -0
  181. package/lib-commonjs/ssr/SSRContext.d.ts +33 -0
  182. package/lib-commonjs/ssr/SSRContext.js +86 -0
  183. package/lib-commonjs/ssr/SSRContext.js.map +1 -0
  184. package/lib-commonjs/ssr/canUseDOM.d.ts +4 -0
  185. package/lib-commonjs/ssr/canUseDOM.js +17 -0
  186. package/lib-commonjs/ssr/canUseDOM.js.map +1 -0
  187. package/lib-commonjs/ssr/index.d.ts +2 -0
  188. package/lib-commonjs/ssr/index.js +12 -0
  189. package/lib-commonjs/ssr/index.js.map +1 -0
  190. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +5 -0
  191. package/lib-commonjs/utils/applyTriggerPropsToChildren.js +27 -0
  192. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -0
  193. package/lib-commonjs/utils/clamp.d.ts +8 -0
  194. package/lib-commonjs/utils/clamp.js +20 -0
  195. package/lib-commonjs/utils/clamp.js.map +1 -0
  196. package/lib-commonjs/utils/getNativeElementProps.d.ts +9 -0
  197. package/lib-commonjs/utils/getNativeElementProps.js +48 -0
  198. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -0
  199. package/lib-commonjs/utils/getRTLSafeKey.d.ts +4 -0
  200. package/lib-commonjs/utils/getRTLSafeKey.js +30 -0
  201. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -0
  202. package/lib-commonjs/utils/index.d.ts +8 -0
  203. package/lib-commonjs/utils/index.js +24 -0
  204. package/lib-commonjs/utils/index.js.map +1 -0
  205. package/lib-commonjs/utils/omit.d.ts +14 -0
  206. package/lib-commonjs/utils/omit.js +36 -0
  207. package/lib-commonjs/utils/omit.js.map +1 -0
  208. package/lib-commonjs/utils/onlyChild.d.ts +5 -0
  209. package/lib-commonjs/utils/onlyChild.js +23 -0
  210. package/lib-commonjs/utils/onlyChild.js.map +1 -0
  211. package/lib-commonjs/utils/properties.d.ts +148 -0
  212. package/lib-commonjs/utils/properties.js +227 -0
  213. package/lib-commonjs/utils/properties.js.map +1 -0
  214. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +7 -0
  215. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +30 -0
  216. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -0
  217. package/package.json +55 -0
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.canUseDOM = void 0;
7
+ /**
8
+ * Verifies if an application can use DOM.
9
+ */
10
+
11
+ function canUseDOM() {
12
+ return typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line deprecation/deprecation
13
+ window.document.createElement);
14
+ }
15
+
16
+ exports.canUseDOM = canUseDOM;
17
+ //# sourceMappingURL=canUseDOM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ssr/canUseDOM.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACH,SAAgB,SAAhB,GAAyB;AACvB,SACE,OAAO,MAAP,KAAkB,WAAlB,IACA,CAAC,EACC,MAAM,CAAC,QAAP,IACA;AACA,EAAA,MAAM,CAAC,QAAP,CAAgB,aAHjB,CAFH;AAQD;;AATD,OAAA,CAAA,SAAA,GAAA,SAAA","sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ export * from './canUseDOM';
2
+ export * from './SSRContext';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./canUseDOM"), exports);
10
+
11
+ tslib_1.__exportStar(require("./SSRContext"), exports);
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ssr/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
4
+ */
5
+ export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | ((props: TTriggerProps) => React.ReactNode) | null | undefined, triggerProps: TTriggerProps) => React.ReactNode;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.applyTriggerPropsToChildren = void 0;
7
+
8
+ var React = /*#__PURE__*/require("react");
9
+
10
+ var onlyChild_1 = /*#__PURE__*/require("./onlyChild");
11
+ /**
12
+ * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
13
+ */
14
+
15
+
16
+ var applyTriggerPropsToChildren = function (children, triggerProps) {
17
+ if (typeof children === 'function') {
18
+ return children(triggerProps);
19
+ } else if (children) {
20
+ return React.cloneElement(onlyChild_1.onlyChild(children), triggerProps);
21
+ }
22
+
23
+ return children;
24
+ };
25
+
26
+ exports.applyTriggerPropsToChildren = applyTriggerPropsToChildren;
27
+ //# sourceMappingURL=applyTriggerPropsToChildren.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/applyTriggerPropsToChildren.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAEA;;AAEG;;;AACI,IAAM,2BAA2B,GAAG,UACzC,QADyC,EAEzC,YAFyC,EAEd;AAE3B,MAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;AAClC,WAAO,QAAQ,CAAC,YAAD,CAAf;AACD,GAFD,MAEO,IAAI,QAAJ,EAAc;AACnB,WAAO,KAAK,CAAC,YAAN,CAAmB,WAAA,CAAA,SAAA,CAAU,QAAV,CAAnB,EAAwC,YAAxC,CAAP;AACD;;AAED,SAAO,QAAP;AACD,CAXM;;AAAM,OAAA,CAAA,2BAAA,GAA2B,2BAA3B","sourceRoot":""}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Clamps `value` to a number between the min and max.
3
+ *
4
+ * @param value - the value to be clamped
5
+ * @param min - the lowest valid value
6
+ * @param max - the highest valid value
7
+ */
8
+ export declare const clamp: (value: number, min: number, max: number) => number;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clamp = void 0;
7
+ /**
8
+ * Clamps `value` to a number between the min and max.
9
+ *
10
+ * @param value - the value to be clamped
11
+ * @param min - the lowest valid value
12
+ * @param max - the highest valid value
13
+ */
14
+
15
+ var clamp = function (value, min, max) {
16
+ return Math.max(min, Math.min(max, value || 0));
17
+ };
18
+
19
+ exports.clamp = clamp;
20
+ //# sourceMappingURL=clamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/clamp.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;;AACI,IAAM,KAAK,GAAG,UAAC,KAAD,EAAgB,GAAhB,EAA6B,GAA7B,EAAwC;AAAa,SAAA,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,KAAK,IAAjC,CAAc,CAAd,CAAA;AAAwC,CAA3G;;AAAM,OAAA,CAAA,KAAA,GAAK,KAAL","sourceRoot":""}
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Given an element tagname and user props, filters the props to only allowed props for the given
4
+ * element type.
5
+ * @param tagName - Tag name (e.g. "div")
6
+ * @param props - Props object
7
+ * @param excludedPropNames - List of props to disallow
8
+ */
9
+ export declare function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getNativeElementProps = void 0;
7
+
8
+ var properties_1 = /*#__PURE__*/require("./properties");
9
+
10
+ var nativeElementMap = {
11
+ label: properties_1.labelProperties,
12
+ audio: properties_1.audioProperties,
13
+ video: properties_1.videoProperties,
14
+ ol: properties_1.olProperties,
15
+ li: properties_1.liProperties,
16
+ a: properties_1.anchorProperties,
17
+ button: properties_1.buttonProperties,
18
+ input: properties_1.inputProperties,
19
+ textarea: properties_1.textAreaProperties,
20
+ select: properties_1.selectProperties,
21
+ option: properties_1.optionProperties,
22
+ table: properties_1.tableProperties,
23
+ tr: properties_1.trProperties,
24
+ th: properties_1.thProperties,
25
+ td: properties_1.tdProperties,
26
+ colGroup: properties_1.colGroupProperties,
27
+ col: properties_1.colProperties,
28
+ form: properties_1.formProperties,
29
+ iframe: properties_1.iframeProperties,
30
+ img: properties_1.imgProperties
31
+ };
32
+ /**
33
+ * Given an element tagname and user props, filters the props to only allowed props for the given
34
+ * element type.
35
+ * @param tagName - Tag name (e.g. "div")
36
+ * @param props - Props object
37
+ * @param excludedPropNames - List of props to disallow
38
+ */
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
+
41
+ function getNativeElementProps(tagName, props, excludedPropNames) {
42
+ var allowedPropNames = tagName && nativeElementMap[tagName] || properties_1.htmlElementProperties;
43
+ allowedPropNames.as = 1;
44
+ return properties_1.getNativeProps(props, allowedPropNames, excludedPropNames);
45
+ }
46
+
47
+ exports.getNativeElementProps = getNativeElementProps;
48
+ //# sourceMappingURL=getNativeElementProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/getNativeElementProps.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AAyBA,IAAM,gBAAgB,GAA2C;AAC/D,EAAA,KAAK,EAAE,YAAA,CAAA,eADwD;AAE/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAFwD;AAG/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAHwD;AAI/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAJ2D;AAK/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAL2D;AAM/D,EAAA,CAAC,EAAE,YAAA,CAAA,gBAN4D;AAO/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAPuD;AAQ/D,EAAA,KAAK,EAAE,YAAA,CAAA,eARwD;AAS/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBATqD;AAU/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAVuD;AAW/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAXuD;AAY/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAZwD;AAa/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAb2D;AAc/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAd2D;AAe/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAf2D;AAgB/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBAhBqD;AAiB/D,EAAA,GAAG,EAAE,YAAA,CAAA,aAjB0D;AAkB/D,EAAA,IAAI,EAAE,YAAA,CAAA,cAlByD;AAmB/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAnBuD;AAoB/D,EAAA,GAAG,EAAE,YAAA,CAAA;AApB0D,CAAjE;AAuBA;;;;;;AAMG;AACH;;AACA,SAAgB,qBAAhB,CACE,OADF,EAEE,KAFF,EAGE,iBAHF,EAG8B;AAE5B,MAAM,gBAAgB,GAAI,OAAO,IAAI,gBAAgB,CAAC,OAAD,CAA5B,IAA0C,YAAA,CAAA,qBAAnE;AACA,EAAA,gBAAgB,CAAC,EAAjB,GAAsB,CAAtB;AAEA,SAAO,YAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,gBAAtB,EAAwC,iBAAxC,CAAP;AACD;;AATD,OAAA,CAAA,qBAAA,GAAA,qBAAA","sourceRoot":""}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Finds and swaps a provided key for it's right to left format.
3
+ */
4
+ export declare const getRTLSafeKey: (key: string, dir: 'ltr' | 'rtl') => string;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getRTLSafeKey = void 0;
7
+ /**
8
+ * Finds and swaps a provided key for it's right to left format.
9
+ */
10
+
11
+ var getRTLSafeKey = function (key, dir) {
12
+ if (dir === 'rtl') {
13
+ switch (key) {
14
+ case 'ArrowLeft':
15
+ {
16
+ return 'ArrowRight';
17
+ }
18
+
19
+ case 'ArrowRight':
20
+ {
21
+ return 'ArrowLeft';
22
+ }
23
+ }
24
+ }
25
+
26
+ return key;
27
+ };
28
+
29
+ exports.getRTLSafeKey = getRTLSafeKey;
30
+ //# sourceMappingURL=getRTLSafeKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/getRTLSafeKey.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACI,IAAM,aAAa,GAAG,UAAC,GAAD,EAAc,GAAd,EAAgC;AAC3D,MAAI,GAAG,KAAK,KAAZ,EAAmB;AACjB,YAAQ,GAAR;AACE,WAAK,WAAL;AAAkB;AAChB,iBAAO,YAAP;AACD;;AAED,WAAK,YAAL;AAAmB;AACjB,iBAAO,WAAP;AACD;AAPH;AASD;;AAED,SAAO,GAAP;AACD,CAdM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourceRoot":""}
@@ -0,0 +1,8 @@
1
+ export * from './applyTriggerPropsToChildren';
2
+ export * from './clamp';
3
+ export * from './getNativeElementProps';
4
+ export * from './getRTLSafeKey';
5
+ export * from './omit';
6
+ export * from './onlyChild';
7
+ export * from './properties';
8
+ export * from './shouldPreventDefaultOnKeyDown';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./applyTriggerPropsToChildren"), exports);
10
+
11
+ tslib_1.__exportStar(require("./clamp"), exports);
12
+
13
+ tslib_1.__exportStar(require("./getNativeElementProps"), exports);
14
+
15
+ tslib_1.__exportStar(require("./getRTLSafeKey"), exports);
16
+
17
+ tslib_1.__exportStar(require("./omit"), exports);
18
+
19
+ tslib_1.__exportStar(require("./onlyChild"), exports);
20
+
21
+ tslib_1.__exportStar(require("./properties"), exports);
22
+
23
+ tslib_1.__exportStar(require("./shouldPreventDefaultOnKeyDown"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Tiny helper to do the minimal amount of work in duplicating an object but omitting some
3
+ * props. This ends up faster than using object ...rest or reduce to filter.
4
+ *
5
+ * This behaves very much like filteredAssign, but does not merge many objects together,
6
+ * uses an exclusion object map, and avoids spreads all for optimal performance.
7
+ *
8
+ * See perf test for background:
9
+ * https://jsperf.com/omit-vs-rest-vs-reduce/1
10
+ *
11
+ * @param obj - The object to clone
12
+ * @param exclusions - The array of keys to exclude
13
+ */
14
+ export declare function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(obj: TObj, exclusions: Exclusions): Omit<TObj, Exclusions[number]>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.omit = void 0;
7
+ /**
8
+ * Tiny helper to do the minimal amount of work in duplicating an object but omitting some
9
+ * props. This ends up faster than using object ...rest or reduce to filter.
10
+ *
11
+ * This behaves very much like filteredAssign, but does not merge many objects together,
12
+ * uses an exclusion object map, and avoids spreads all for optimal performance.
13
+ *
14
+ * See perf test for background:
15
+ * https://jsperf.com/omit-vs-rest-vs-reduce/1
16
+ *
17
+ * @param obj - The object to clone
18
+ * @param exclusions - The array of keys to exclude
19
+ */
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+
22
+ function omit(obj, exclusions) {
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ var result = {};
25
+
26
+ for (var key in obj) {
27
+ if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {
28
+ result[key] = obj[key];
29
+ }
30
+ }
31
+
32
+ return result;
33
+ }
34
+
35
+ exports.omit = omit;
36
+ //# sourceMappingURL=omit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/omit.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;AAYG;AACH;;AACA,SAAgB,IAAhB,CACE,GADF,EAEE,UAFF,EAEwB;AAEtB;AACA,MAAM,MAAM,GAAwB,EAApC;;AAEA,OAAK,IAAM,GAAX,IAAkB,GAAlB,EAAuB;AACrB,QAAI,UAAU,CAAC,OAAX,CAAmB,GAAnB,MAA4B,CAAC,CAA7B,IAAkC,GAAG,CAAC,cAAJ,CAAmB,GAAnB,CAAtC,EAA+D;AAC7D,MAAA,MAAM,CAAC,GAAD,CAAN,GAAc,GAAG,CAAC,GAAD,CAAjB;AACD;AACF;;AAED,SAAO,MAAP;AACD;;AAdD,OAAA,CAAA,IAAA,GAAA,IAAA","sourceRoot":""}
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Similar to React.Children.only, but drills into fragments rather than treating them as a single child
4
+ */
5
+ export declare const onlyChild: <P>(child: string | number | boolean | {} | React.ReactNodeArray | React.ReactPortal | React.ReactElement<P, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null | undefined) => React.ReactElement<P, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.onlyChild = void 0;
7
+
8
+ var React = /*#__PURE__*/require("react");
9
+ /**
10
+ * Similar to React.Children.only, but drills into fragments rather than treating them as a single child
11
+ */
12
+
13
+
14
+ var onlyChild = function (child) {
15
+ if (!React.isValidElement(child)) {
16
+ throw new Error("Component's child must be a single element");
17
+ }
18
+
19
+ return child.type === React.Fragment ? exports.onlyChild(child.props.children) : child;
20
+ };
21
+
22
+ exports.onlyChild = onlyChild;
23
+ //# sourceMappingURL=onlyChild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/onlyChild.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAEA;;AAEG;;;AACI,IAAM,SAAS,GAAG,UACvB,KADuB,EAC8F;AAErH,MAAI,CAAC,KAAK,CAAC,cAAN,CAAqB,KAArB,CAAL,EAAkC;AAChC,UAAM,IAAI,KAAJ,CAAU,4CAAV,CAAN;AACD;;AAED,SAAO,KAAK,CAAC,IAAN,KAAe,KAAK,CAAC,QAArB,GAAgC,OAAA,CAAA,SAAA,CAAU,KAAK,CAAC,KAAN,CAAY,QAAtB,CAAhC,GAAkE,KAAzE;AACD,CARM;;AAAM,OAAA,CAAA,SAAA,GAAS,SAAT","sourceRoot":""}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * An array of events that are allowed on every html element type.
3
+ *
4
+ * @public
5
+ */
6
+ export declare const baseElementEvents: Record<string, number>;
7
+ /**
8
+ * An array of element attributes which are allowed on every html element type.
9
+ *
10
+ * @public
11
+ */
12
+ export declare const baseElementProperties: Record<string, number>;
13
+ /**
14
+ * An array of HTML element properties and events.
15
+ *
16
+ * @public
17
+ */
18
+ export declare const htmlElementProperties: Record<string, number>;
19
+ /**
20
+ * An array of LABEL tag properties and events.
21
+ *
22
+ * @public
23
+ */
24
+ export declare const labelProperties: Record<string, number>;
25
+ /**
26
+ * An array of AUDIO tag properties and events.
27
+
28
+ * @public
29
+ */
30
+ export declare const audioProperties: Record<string, number>;
31
+ /**
32
+ * An array of VIDEO tag properties and events.
33
+ *
34
+ * @public
35
+ */
36
+ export declare const videoProperties: Record<string, number>;
37
+ /**
38
+ * An array of OL tag properties and events.
39
+ *
40
+ * @public
41
+ */
42
+ export declare const olProperties: Record<string, number>;
43
+ /**
44
+ * An array of LI tag properties and events.
45
+ *
46
+ * @public
47
+ */
48
+ export declare const liProperties: Record<string, number>;
49
+ /**
50
+ * An array of A tag properties and events.
51
+ *
52
+ * @public
53
+ */
54
+ export declare const anchorProperties: Record<string, number>;
55
+ /**
56
+ * An array of BUTTON tag properties and events.
57
+ *
58
+ * @public
59
+ */
60
+ export declare const buttonProperties: Record<string, number>;
61
+ /**
62
+ * An array of INPUT tag properties and events.
63
+ *
64
+ * @public
65
+ */
66
+ export declare const inputProperties: Record<string, number>;
67
+ /**
68
+ * An array of TEXTAREA tag properties and events.
69
+ *
70
+ * @public
71
+ */
72
+ export declare const textAreaProperties: Record<string, number>;
73
+ /**
74
+ * An array of SELECT tag properties and events.
75
+ *
76
+ * @public
77
+ */
78
+ export declare const selectProperties: Record<string, number>;
79
+ export declare const optionProperties: Record<string, number>;
80
+ /**
81
+ * An array of TABLE tag properties and events.
82
+ *
83
+ * @public
84
+ */
85
+ export declare const tableProperties: Record<string, number>;
86
+ /**
87
+ * An array of TR tag properties and events.
88
+ *
89
+ * @public
90
+ */
91
+ export declare const trProperties: Record<string, number>;
92
+ /**
93
+ * An array of TH tag properties and events.
94
+ *
95
+ * @public
96
+ */
97
+ export declare const thProperties: Record<string, number>;
98
+ /**
99
+ * An array of TD tag properties and events.
100
+ *
101
+ * @public
102
+ */
103
+ export declare const tdProperties: Record<string, number>;
104
+ export declare const colGroupProperties: Record<string, number>;
105
+ export declare const colProperties: Record<string, number>;
106
+ /**
107
+ * An array of FORM tag properties and events.
108
+ *
109
+ * @public
110
+ */
111
+ export declare const formProperties: Record<string, number>;
112
+ /**
113
+ * An array of IFRAME tag properties and events.
114
+ *
115
+ * @public
116
+ */
117
+ export declare const iframeProperties: Record<string, number>;
118
+ /**
119
+ * An array of IMAGE tag properties and events.
120
+ *
121
+ * @public
122
+ */
123
+ export declare const imgProperties: Record<string, number>;
124
+ /**
125
+ * @deprecated Use imgProperties for img elements.
126
+ */
127
+ export declare const imageProperties: Record<string, number>;
128
+ /**
129
+ * An array of DIV tag properties and events.
130
+ *
131
+ * @public
132
+ */
133
+ export declare const divProperties: Record<string, number>;
134
+ /**
135
+ * Gets native supported props for an html element provided the allowance set. Use one of the property
136
+ * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given
137
+ * props set. Note that all data- and aria- prefixed attributes will be allowed.
138
+ * NOTE: getNativeProps should always be applied first when adding props to a react component. The
139
+ * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.
140
+ * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to
141
+ * the component after an onClick function is added, then the getNativeProps onClick will override it.
142
+ *
143
+ * @public
144
+ * @param props - The unfiltered input props
145
+ * @param allowedPropsNames - The array or record of allowed prop names.
146
+ * @returns The filtered props
147
+ */
148
+ export declare function getNativeProps<T extends Record<string, any>>(props: Record<string, any>, allowedPropNames: string[] | Record<string, number>, excludedPropNames?: string[]): T;