@fluentui/react-utilities 9.0.0-nightly.f81b28ceb3.1 → 9.0.0-rc.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 (206) hide show
  1. package/CHANGELOG.json +167 -8
  2. package/CHANGELOG.md +44 -6
  3. package/dist/react-utilities.d.ts +218 -198
  4. package/lib/compose/getSlots.d.ts +11 -10
  5. package/lib/compose/getSlots.js +21 -30
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.d.ts +0 -5
  8. package/lib/compose/index.js +0 -5
  9. package/lib/compose/index.js.map +1 -1
  10. package/lib/compose/resolveShorthand.d.ts +10 -6
  11. package/lib/compose/resolveShorthand.js +13 -12
  12. package/lib/compose/resolveShorthand.js.map +1 -1
  13. package/lib/compose/types.d.ts +86 -76
  14. package/lib/compose/types.js +5 -1
  15. package/lib/compose/types.js.map +1 -1
  16. package/lib/hooks/index.d.ts +1 -1
  17. package/lib/hooks/index.js +1 -1
  18. package/lib/hooks/index.js.map +1 -1
  19. package/lib/hooks/useBoolean.js +10 -21
  20. package/lib/hooks/useBoolean.js.map +1 -1
  21. package/lib/hooks/useConst.js +1 -1
  22. package/lib/hooks/useConst.js.map +1 -1
  23. package/lib/hooks/useControllableState.d.ts +16 -6
  24. package/lib/hooks/useControllableState.js +26 -25
  25. package/lib/hooks/useControllableState.js.map +1 -1
  26. package/lib/hooks/useEventCallback.js +6 -12
  27. package/lib/hooks/useEventCallback.js.map +1 -1
  28. package/lib/hooks/useFirstMount.js +1 -1
  29. package/lib/hooks/useFirstMount.js.map +1 -1
  30. package/lib/hooks/useForceUpdate.js +1 -3
  31. package/lib/hooks/useForceUpdate.js.map +1 -1
  32. package/lib/hooks/useId.js +2 -4
  33. package/lib/hooks/useId.js.map +1 -1
  34. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -1
  35. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  36. package/lib/hooks/useMergedEventCallbacks.d.ts +18 -0
  37. package/lib/hooks/useMergedEventCallbacks.js +26 -0
  38. package/lib/hooks/useMergedEventCallbacks.js.map +1 -0
  39. package/lib/hooks/useMergedRefs.js +5 -13
  40. package/lib/hooks/useMergedRefs.js.map +1 -1
  41. package/lib/hooks/useMount.js +3 -3
  42. package/lib/hooks/useMount.js.map +1 -1
  43. package/lib/hooks/useOnClickOutside.js +30 -36
  44. package/lib/hooks/useOnClickOutside.js.map +1 -1
  45. package/lib/hooks/useOnScrollOutside.js +13 -15
  46. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  47. package/lib/hooks/usePrevious.js +3 -3
  48. package/lib/hooks/usePrevious.js.map +1 -1
  49. package/lib/hooks/useTimeout.js +13 -17
  50. package/lib/hooks/useTimeout.js.map +1 -1
  51. package/lib/hooks/useUnmount.js +5 -7
  52. package/lib/hooks/useUnmount.js.map +1 -1
  53. package/lib/ssr/SSRContext.js +9 -15
  54. package/lib/ssr/SSRContext.js.map +1 -1
  55. package/lib/utils/applyTriggerPropsToChildren.d.ts +1 -1
  56. package/lib/utils/applyTriggerPropsToChildren.js +24 -4
  57. package/lib/utils/applyTriggerPropsToChildren.js.map +1 -1
  58. package/lib/utils/clamp.js +1 -3
  59. package/lib/utils/clamp.js.map +1 -1
  60. package/lib/utils/getNativeElementProps.d.ts +22 -0
  61. package/lib/utils/getNativeElementProps.js +24 -2
  62. package/lib/utils/getNativeElementProps.js.map +1 -1
  63. package/lib/utils/getRTLSafeKey.js +1 -1
  64. package/lib/utils/getRTLSafeKey.js.map +1 -1
  65. package/lib/utils/getReactCallbackName.d.ts +25 -0
  66. package/lib/utils/getReactCallbackName.js +26 -0
  67. package/lib/utils/getReactCallbackName.js.map +1 -0
  68. package/lib/utils/getTriggerChild.d.ts +22 -0
  69. package/lib/utils/getTriggerChild.js +26 -0
  70. package/lib/utils/getTriggerChild.js.map +1 -0
  71. package/lib/utils/index.d.ts +2 -1
  72. package/lib/utils/index.js +2 -1
  73. package/lib/utils/index.js.map +1 -1
  74. package/lib/utils/isFluentTrigger.d.ts +22 -0
  75. package/lib/utils/isFluentTrigger.js +8 -0
  76. package/lib/utils/isFluentTrigger.js.map +1 -0
  77. package/lib/utils/omit.js +2 -2
  78. package/lib/utils/omit.js.map +1 -1
  79. package/lib/utils/properties.js +55 -44
  80. package/lib/utils/properties.js.map +1 -1
  81. package/lib/utils/shouldPreventDefaultOnKeyDown.js +4 -4
  82. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  83. package/lib-commonjs/compose/getSlots.d.ts +11 -10
  84. package/lib-commonjs/compose/getSlots.js +23 -34
  85. package/lib-commonjs/compose/getSlots.js.map +1 -1
  86. package/lib-commonjs/compose/index.d.ts +0 -5
  87. package/lib-commonjs/compose/index.js +1 -11
  88. package/lib-commonjs/compose/index.js.map +1 -1
  89. package/lib-commonjs/compose/resolveShorthand.d.ts +10 -6
  90. package/lib-commonjs/compose/resolveShorthand.js +14 -14
  91. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  92. package/lib-commonjs/compose/types.d.ts +86 -76
  93. package/lib-commonjs/compose/types.js +5 -1
  94. package/lib-commonjs/compose/types.js.map +1 -1
  95. package/lib-commonjs/hooks/index.d.ts +1 -1
  96. package/lib-commonjs/hooks/index.js +3 -3
  97. package/lib-commonjs/hooks/index.js.map +1 -1
  98. package/lib-commonjs/hooks/useBoolean.js +12 -23
  99. package/lib-commonjs/hooks/useBoolean.js.map +1 -1
  100. package/lib-commonjs/hooks/useConst.js +2 -2
  101. package/lib-commonjs/hooks/useConst.js.map +1 -1
  102. package/lib-commonjs/hooks/useControllableState.d.ts +16 -6
  103. package/lib-commonjs/hooks/useControllableState.js +28 -27
  104. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  105. package/lib-commonjs/hooks/useEventCallback.js +8 -14
  106. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  107. package/lib-commonjs/hooks/useFirstMount.js +2 -2
  108. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  109. package/lib-commonjs/hooks/useForceUpdate.js +2 -4
  110. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  111. package/lib-commonjs/hooks/useId.js +4 -6
  112. package/lib-commonjs/hooks/useId.js.map +1 -1
  113. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +2 -2
  114. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  115. package/lib-commonjs/hooks/useMergedEventCallbacks.d.ts +18 -0
  116. package/lib-commonjs/hooks/useMergedEventCallbacks.js +36 -0
  117. package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -0
  118. package/lib-commonjs/hooks/useMergedRefs.js +6 -15
  119. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  120. package/lib-commonjs/hooks/useMount.js +4 -4
  121. package/lib-commonjs/hooks/useMount.js.map +1 -1
  122. package/lib-commonjs/hooks/useOnClickOutside.js +32 -38
  123. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  124. package/lib-commonjs/hooks/useOnScrollOutside.js +15 -17
  125. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  126. package/lib-commonjs/hooks/usePrevious.js +4 -4
  127. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  128. package/lib-commonjs/hooks/useTimeout.js +15 -19
  129. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  130. package/lib-commonjs/hooks/useUnmount.js +6 -8
  131. package/lib-commonjs/hooks/useUnmount.js.map +1 -1
  132. package/lib-commonjs/index.js +1 -1
  133. package/lib-commonjs/ssr/SSRContext.js +9 -15
  134. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  135. package/lib-commonjs/ssr/index.js +1 -1
  136. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +1 -1
  137. package/lib-commonjs/utils/applyTriggerPropsToChildren.js +26 -6
  138. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -1
  139. package/lib-commonjs/utils/clamp.js +1 -3
  140. package/lib-commonjs/utils/clamp.js.map +1 -1
  141. package/lib-commonjs/utils/getNativeElementProps.d.ts +22 -0
  142. package/lib-commonjs/utils/getNativeElementProps.js +28 -4
  143. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  144. package/lib-commonjs/utils/getRTLSafeKey.js +1 -1
  145. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  146. package/lib-commonjs/utils/getReactCallbackName.d.ts +25 -0
  147. package/lib-commonjs/utils/getReactCallbackName.js +35 -0
  148. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -0
  149. package/lib-commonjs/utils/getTriggerChild.d.ts +22 -0
  150. package/lib-commonjs/utils/getTriggerChild.js +37 -0
  151. package/lib-commonjs/utils/getTriggerChild.js.map +1 -0
  152. package/lib-commonjs/utils/index.d.ts +2 -1
  153. package/lib-commonjs/utils/index.js +5 -3
  154. package/lib-commonjs/utils/index.js.map +1 -1
  155. package/lib-commonjs/utils/isFluentTrigger.d.ts +22 -0
  156. package/lib-commonjs/utils/isFluentTrigger.js +17 -0
  157. package/lib-commonjs/utils/isFluentTrigger.js.map +1 -0
  158. package/lib-commonjs/utils/omit.js +2 -2
  159. package/lib-commonjs/utils/omit.js.map +1 -1
  160. package/lib-commonjs/utils/properties.js +51 -40
  161. package/lib-commonjs/utils/properties.js.map +1 -1
  162. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +5 -5
  163. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  164. package/package.json +6 -11
  165. package/lib/compose/getSlotsCompat.d.ts +0 -22
  166. package/lib/compose/getSlotsCompat.js +0 -56
  167. package/lib/compose/getSlotsCompat.js.map +0 -1
  168. package/lib/compose/makeMergeProps.d.ts +0 -15
  169. package/lib/compose/makeMergeProps.js +0 -106
  170. package/lib/compose/makeMergeProps.js.map +0 -1
  171. package/lib/compose/makeMergePropsCompat.d.ts +0 -9
  172. package/lib/compose/makeMergePropsCompat.js +0 -9
  173. package/lib/compose/makeMergePropsCompat.js.map +0 -1
  174. package/lib/compose/nullRender.d.ts +0 -4
  175. package/lib/compose/nullRender.js +0 -7
  176. package/lib/compose/nullRender.js.map +0 -1
  177. package/lib/compose/resolveShorthandProps.d.ts +0 -8
  178. package/lib/compose/resolveShorthandProps.js +0 -30
  179. package/lib/compose/resolveShorthandProps.js.map +0 -1
  180. package/lib/hooks/useControllableValue.d.ts +0 -20
  181. package/lib/hooks/useControllableValue.js +0 -62
  182. package/lib/hooks/useControllableValue.js.map +0 -1
  183. package/lib/utils/onlyChild.d.ts +0 -5
  184. package/lib/utils/onlyChild.js +0 -13
  185. package/lib/utils/onlyChild.js.map +0 -1
  186. package/lib-commonjs/compose/getSlotsCompat.d.ts +0 -22
  187. package/lib-commonjs/compose/getSlotsCompat.js +0 -68
  188. package/lib-commonjs/compose/getSlotsCompat.js.map +0 -1
  189. package/lib-commonjs/compose/makeMergeProps.d.ts +0 -15
  190. package/lib-commonjs/compose/makeMergeProps.js +0 -117
  191. package/lib-commonjs/compose/makeMergeProps.js.map +0 -1
  192. package/lib-commonjs/compose/makeMergePropsCompat.d.ts +0 -9
  193. package/lib-commonjs/compose/makeMergePropsCompat.js +0 -17
  194. package/lib-commonjs/compose/makeMergePropsCompat.js.map +0 -1
  195. package/lib-commonjs/compose/nullRender.d.ts +0 -4
  196. package/lib-commonjs/compose/nullRender.js +0 -16
  197. package/lib-commonjs/compose/nullRender.js.map +0 -1
  198. package/lib-commonjs/compose/resolveShorthandProps.d.ts +0 -8
  199. package/lib-commonjs/compose/resolveShorthandProps.js +0 -41
  200. package/lib-commonjs/compose/resolveShorthandProps.js.map +0 -1
  201. package/lib-commonjs/hooks/useControllableValue.d.ts +0 -20
  202. package/lib-commonjs/hooks/useControllableValue.js +0 -73
  203. package/lib-commonjs/hooks/useControllableValue.js.map +0 -1
  204. package/lib-commonjs/utils/onlyChild.d.ts +0 -5
  205. package/lib-commonjs/utils/onlyChild.js +0 -23
  206. package/lib-commonjs/utils/onlyChild.js.map +0 -1
@@ -1,30 +0,0 @@
1
- import { __assign } from "tslib";
2
- import * as React from 'react';
3
- /**
4
- * Ensures that the given slots are represented using object syntax. This ensures that
5
- * the object can be merged along with other objects.
6
- * @param props - The incoming props
7
- * @param shorthandPropNames - An array of prop names to apply simplification to
8
- */
9
-
10
- export var resolveShorthandProps = function (props, shorthandPropNames) {
11
- var newProps = props;
12
-
13
- for (var _i = 0, shorthandPropNames_1 = shorthandPropNames; _i < shorthandPropNames_1.length; _i++) {
14
- var propName = shorthandPropNames_1[_i];
15
- var propValue = props[propName];
16
-
17
- if (propValue !== undefined && (typeof propValue !== 'object' || /*#__PURE__*/React.isValidElement(propValue))) {
18
- if (newProps === props) {
19
- newProps = __assign({}, props); // Copy props before modifying
20
- }
21
-
22
- newProps[propName] = {
23
- children: propValue
24
- };
25
- }
26
- }
27
-
28
- return newProps;
29
- };
30
- //# sourceMappingURL=resolveShorthandProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/compose/resolveShorthandProps.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA;;;;;AAKG;;AACH,OAAO,IAAM,qBAAqB,GAAG,UACnC,KADmC,EAEnC,kBAFmC,EAEe;AAElD,MAAI,QAAQ,GAAG,KAAf;;AAEA,OAAuB,IAAA,EAAA,GAAA,CAAA,EAAA,oBAAA,GAAA,kBAAvB,EAAuB,EAAA,GAAA,oBAAA,CAAA,MAAvB,EAAuB,EAAA,EAAvB,EAA2C;AAAtC,QAAM,QAAQ,GAAA,oBAAA,CAAA,EAAA,CAAd;AACH,QAAM,SAAS,GAAG,KAAK,CAAC,QAAD,CAAvB;;AACA,QAAI,SAAS,KAAK,SAAd,KAA4B,OAAO,SAAP,KAAqB,QAArB,iBAAiC,KAAK,CAAC,cAAN,CAAqB,SAArB,CAA7D,CAAJ,EAAmG;AACjG,UAAI,QAAQ,KAAK,KAAjB,EAAwB;AACtB,QAAA,QAAQ,GAAA,QAAA,CAAA,EAAA,EAAQ,KAAR,CAAR,CADsB,CACG;AAC1B;;AAEA,MAAA,QAAQ,CAAC,QAAD,CAAR,GAAoD;AAAE,QAAA,QAAQ,EAAE;AAAZ,OAApD;AACF;AACF;;AAED,SAAQ,QAAR;AACD,CAlBM","sourceRoot":""}
@@ -1,20 +0,0 @@
1
- import * as React from 'react';
2
- export declare type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void;
3
- /**
4
- * Default value can be a value or an initializer
5
- */
6
- declare type DefaultValue<TValue> = TValue | (() => TValue);
7
- /**
8
- * Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or
9
- * text box string.
10
- * @param controlledValue - The controlled value passed in the props. This value will always be used if provided,
11
- * and the internal state will be updated to reflect it.
12
- * @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.
13
- * @returns An array of the current value and an updater callback. Like `React.useState`, the updater
14
- * callback always has the same identity, and it can take either a new value, or a function which
15
- * is passed the previous value and returns the new value.
16
- * @see https://reactjs.org/docs/uncontrolled-components.html
17
- */
18
- export declare function useControllableValue<TValue, TElement extends HTMLElement>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>): Readonly<[TValue, (update: React.SetStateAction<TValue>) => void]>;
19
- export declare function useControllableValue<TValue, TElement extends HTMLElement, TEvent extends React.SyntheticEvent<TElement> | undefined>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>, onChange: ChangeCallback<TElement, TValue, TEvent>): Readonly<[TValue, (update: React.SetStateAction<TValue>, ev?: React.FormEvent<TElement>) => void]>;
20
- export {};
@@ -1,62 +0,0 @@
1
- import * as React from 'react';
2
- import { useConst } from './useConst';
3
- export function useControllableValue(controlledValue, defaultUncontrolledValue, onChange) {
4
- var _a = React.useState(defaultUncontrolledValue),
5
- value = _a[0],
6
- setValue = _a[1];
7
-
8
- var isControlled = useIsControlled(controlledValue);
9
- var currentValue = isControlled ? controlledValue : value; // Duplicate the current value and onChange in refs so they're accessible from
10
- // setValueOrCallOnChange without creating a new callback every time
11
-
12
- var valueRef = React.useRef(currentValue);
13
- var onChangeRef = React.useRef(onChange);
14
- React.useEffect(function () {
15
- valueRef.current = currentValue;
16
- onChangeRef.current = onChange;
17
- }); // To match the behavior of the setter returned by React.useState, this callback's identity
18
- // should never change. This means it MUST NOT directly reference variables that can change.
19
-
20
- var setValueOrCallOnChange = useConst(function () {
21
- return function (update, ev) {
22
- // Assuming here that TValue is not a function, because a controllable value will typically
23
- // be something a user can enter as input
24
- var newValue = typeof update === 'function' ? update(valueRef.current) : update;
25
-
26
- if (onChangeRef.current) {
27
- onChangeRef.current(ev, newValue);
28
- }
29
-
30
- if (!isControlled) {
31
- setValue(newValue);
32
- }
33
- };
34
- });
35
- return [currentValue, setValueOrCallOnChange];
36
- }
37
- /**
38
- * Helper hook to handle previous comparison of controlled/uncontrolled
39
- * Prints an error when isControlled value switches between subsequent renders
40
- */
41
-
42
- var useIsControlled = function (controlledValue) {
43
- var isControlled = useConst(controlledValue !== undefined);
44
-
45
- if (process.env.NODE_ENV !== 'production') {
46
- // We don't want these warnings in production even though it is against native behaviour
47
- // eslint-disable-next-line react-hooks/rules-of-hooks
48
- React.useEffect(function () {
49
- if (isControlled !== (controlledValue !== undefined)) {
50
- var error = new Error();
51
- var controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';
52
- var undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined'; // eslint-disable-next-line no-console
53
-
54
- console.error([// Default react error
55
- 'A component is changing ' + controlWarning + '. This is likely caused by the value', 'changing from ' + undefinedWarning + ' value, which should not happen.', 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.', 'More info: https://reactjs.org/link/controlled-components', error.stack].join(' '));
56
- }
57
- }, [isControlled, controlledValue]);
58
- }
59
-
60
- return isControlled;
61
- };
62
- //# sourceMappingURL=useControllableValue.js.map
@@ -1 +0,0 @@
1
-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;AACD;AAED;;;AAGG;;AACH,IAAM,eAAe,GAAG,UAAS,eAAT,EAAgC;AACtD,MAAM,YAAY,GAAG,QAAQ,CAAU,eAAe,KAAK,SAA9B,CAA7B;;AAEA,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC;AACA;AACA,IAAA,KAAK,CAAC,SAAN,CAAgB,YAAA;AACd,UAAI,YAAY,MAAM,eAAe,KAAK,SAA1B,CAAhB,EAAsD;AACpD,YAAM,KAAK,GAAG,IAAI,KAAJ,EAAd;AAEA,YAAM,cAAc,GAAG,YAAY,GAC/B,uCAD+B,GAE/B,wCAFJ;AAIA,YAAM,gBAAgB,GAAG,YAAY,GAAG,yBAAH,GAA+B,wBAApE,CAPoD,CASpD;;AACA,QAAA,OAAO,CAAC,KAAR,CACE,CACE;AACA,qCAA6B,cAA7B,GAA8C,sCAFhD,EAGE,mBAAmB,gBAAnB,GAAsC,kCAHxC,EAIE,oGAJF,EAKE,2DALF,EAME,KAAK,CAAC,KANR,EAOE,IAPF,CAOO,GAPP,CADF;AAUD;AACF,KAtBD,EAsBG,CAAC,YAAD,EAAe,eAAf,CAtBH;AAuBD;;AAED,SAAO,YAAP;AACD,CAhCD","sourceRoot":""}
@@ -1,5 +0,0 @@
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>)>;
@@ -1,13 +0,0 @@
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
-
6
- export var onlyChild = function (child) {
7
- if (! /*#__PURE__*/React.isValidElement(child)) {
8
- throw new Error("Component's child must be a single element");
9
- }
10
-
11
- return child.type === React.Fragment ? onlyChild(child.props.children) : child;
12
- };
13
- //# sourceMappingURL=onlyChild.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/onlyChild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA;;AAEG;;AACH,OAAO,IAAM,SAAS,GAAG,UACvB,KADuB,EAC8F;AAErH,MAAI,eAAC,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,SAAS,CAAC,KAAK,CAAC,KAAN,CAAY,QAAb,CAAzC,GAAkE,KAAzE;AACD,CARM","sourceRoot":""}
@@ -1,22 +0,0 @@
1
- declare type GenericDictionary = Record<string, any>;
2
- /**
3
- * Given the state and an array of slot names, will break out `slots` and `slotProps`
4
- * collections.
5
- *
6
- * The root is always derived from the `as` prop.
7
- *
8
- * Slots will render as null if they are rendered as primitives with undefined children.
9
- *
10
- * The slotProps will always omit the `as` prop within them, and for slots that are string
11
- * primitives, the props will be filtered according the the slot type. For example, if the
12
- * slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
13
- *
14
- * @param state - State including slot definitions
15
- * @param slotNames - Name of which props are slots
16
- * @returns An object containing the `slots` map and `slotProps` map.
17
- */
18
- export declare const getSlotsCompat: (state: GenericDictionary, slotNames?: readonly string[] | undefined) => {
19
- slots: Record<string, any>;
20
- slotProps: Record<string, any>;
21
- };
22
- export {};
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getSlotsCompat = void 0;
7
-
8
- var React = /*#__PURE__*/require("react");
9
-
10
- var nullRender_1 = /*#__PURE__*/require("./nullRender");
11
-
12
- var index_1 = /*#__PURE__*/require("../utils/index");
13
- /**
14
- * Given the state and an array of slot names, will break out `slots` and `slotProps`
15
- * collections.
16
- *
17
- * The root is always derived from the `as` prop.
18
- *
19
- * Slots will render as null if they are rendered as primitives with undefined children.
20
- *
21
- * The slotProps will always omit the `as` prop within them, and for slots that are string
22
- * primitives, the props will be filtered according the the slot type. For example, if the
23
- * slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
24
- *
25
- * @param state - State including slot definitions
26
- * @param slotNames - Name of which props are slots
27
- * @returns An object containing the `slots` map and `slotProps` map.
28
- */
29
-
30
-
31
- var getSlotsCompat = function (state, slotNames) {
32
- var slots = {
33
- root: state.as || 'div'
34
- };
35
- var slotProps = {
36
- root: typeof slots.root === 'string' ? index_1.getNativeElementProps(slots.root, state, ['as']) : index_1.omit(state, ['as'])
37
- };
38
-
39
- if (slotNames) {
40
- for (var _i = 0, slotNames_1 = slotNames; _i < slotNames_1.length; _i++) {
41
- var name_1 = slotNames_1[_i];
42
- var slotDefinition = state[name_1] || {};
43
- var _a = slotDefinition.as,
44
- slotAs = _a === void 0 ? 'span' : _a,
45
- children = slotDefinition.children;
46
- var isSlotPrimitive = typeof slotAs === 'string';
47
- var isSlotEmpty = isSlotPrimitive && slotDefinition.children === undefined;
48
- slots[name_1] = isSlotEmpty ? nullRender_1.nullRender : slotAs;
49
-
50
- if (typeof children === 'function') {
51
- slotProps[name_1] = {
52
- children: children(slots[name_1], index_1.omit(slotDefinition, ['as', 'children']))
53
- };
54
- slots[name_1] = React.Fragment;
55
- } else if (slots[name_1] !== nullRender_1.nullRender) {
56
- slotProps[name_1] = isSlotPrimitive ? index_1.getNativeElementProps(slotAs, slotDefinition, ['as']) : index_1.omit(slotDefinition, ['as']);
57
- }
58
- }
59
- }
60
-
61
- return {
62
- slots: slots,
63
- slotProps: slotProps
64
- };
65
- };
66
-
67
- exports.getSlotsCompat = getSlotsCompat;
68
- //# sourceMappingURL=getSlotsCompat.js.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,CAAC,MAAD,CAAL,GAAc,WAAW,GAAG,YAAA,CAAA,UAAH,GAAgB,MAAzC;;AAEA,UAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;AAClC,QAAA,SAAS,CAAC,MAAD,CAAT,GAAkB;AAChB,UAAA,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAD,CAAN,EAAc,OAAA,CAAA,IAAA,CAAK,cAAL,EAAqB,CAAC,IAAD,EAAO,UAAP,CAArB,CAAd;AADF,SAAlB;AAGA,QAAA,KAAK,CAAC,MAAD,CAAL,GAAc,KAAK,CAAC,QAApB;AACD,OALD,MAKO,IAAI,KAAK,CAAC,MAAD,CAAL,KAAgB,YAAA,CAAA,UAApB,EAAgC;AACrC,QAAA,SAAS,CAAC,MAAD,CAAT,GAAkB,eAAe,GAC7B,OAAA,CAAA,qBAAA,CAAsB,MAAtB,EAA8B,cAA9B,EAA8C,CAAC,IAAD,CAA9C,CAD6B,GAE7B,OAAA,CAAA,IAAA,CAAK,cAAL,EAAqB,CAAC,IAAD,CAArB,CAFJ;AAGD;AACF;AACF;;AAED,SAAO;AAAE,IAAA,KAAK,EAAA,KAAP;AAAS,IAAA,SAAS,EAAA;AAAlB,GAAP;AACD,CAhCM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourceRoot":""}
@@ -1,15 +0,0 @@
1
- export declare type MergePropsOptions<TState> = {
2
- /**
3
- * A list of props to deep merge. By default, `style` will
4
- * always be deep merged so it's not required to be provided.
5
- */
6
- deepMerge?: readonly (keyof TState)[];
7
- };
8
- /**
9
- * Helper which deep clones props, but respectively assigns JSX, object refs, and class names
10
- * appropriately.
11
- *
12
- * @param target - the target object to merge onto.
13
- * @param propSets - one or more prop sets to deep merge onto the target.
14
- */
15
- export declare const makeMergeProps: <TState>(options?: MergePropsOptions<TState>) => (target: TState, ...propSets: (Partial<TState> | undefined)[]) => TState;
@@ -1,117 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.makeMergeProps = void 0;
7
-
8
- var tslib_1 = /*#__PURE__*/require("tslib");
9
-
10
- var React = /*#__PURE__*/require("react");
11
- /**
12
- * Concatenation helper, which can merge class names together. Skips over falsey values.
13
- *
14
- * @public
15
- */
16
-
17
-
18
- function css() {
19
- var args = [];
20
-
21
- for (var _i = 0; _i < arguments.length; _i++) {
22
- args[_i] = arguments[_i];
23
- }
24
-
25
- var classes = [];
26
-
27
- for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
28
- var arg = args_1[_a];
29
-
30
- if (arg) {
31
- if (typeof arg === 'string') {
32
- classes.push(arg);
33
- } else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {
34
- classes.push(arg.toString());
35
- } else {
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- for (var key in arg) {
38
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- if (arg[key]) {
40
- classes.push(key);
41
- }
42
- }
43
- }
44
- }
45
- }
46
-
47
- return classes.join(' ');
48
- }
49
- /**
50
- * Helper which deep clones props, but respectively assigns JSX, object refs, and class names
51
- * appropriately.
52
- *
53
- * @param target - the target object to merge onto.
54
- * @param propSets - one or more prop sets to deep merge onto the target.
55
- */
56
-
57
-
58
- var makeMergeProps = function (options) {
59
- if (options === void 0) {
60
- options = {};
61
- }
62
-
63
- var deepMerge = tslib_1.__spreadArrays(options.deepMerge || [], ['style']);
64
-
65
- var mergeProps = function (target) {
66
- var propSets = [];
67
-
68
- for (var _i = 1; _i < arguments.length; _i++) {
69
- propSets[_i - 1] = arguments[_i];
70
- }
71
-
72
- for (var _a = 0, propSets_1 = propSets; _a < propSets_1.length; _a++) {
73
- var props = propSets_1[_a];
74
-
75
- if (props) {
76
- for (var _b = 0, _c = Object.keys(props); _b < _c.length; _b++) {
77
- var propName = _c[_b];
78
- var propValue = props[propName];
79
- var propValueType = typeof propValue;
80
-
81
- if (propValue !== undefined) {
82
- if (propValue && propValueType === 'object') {
83
- if (Array.isArray(propValue)) {
84
- // for arrays, replace.
85
- target[propName] = propValue;
86
- } else {
87
- target[propName] = target[propName] || {};
88
-
89
- if (typeof target[propName] !== 'object' || React.isValidElement(propValue) || propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current') || deepMerge.indexOf(propName) === -1) {
90
- // if target is not an object, or value is JSX, or a ref object, replace
91
- target[propName] = propValue;
92
- } else {
93
- // else deep merge.
94
- mergeProps(target[propName], propValue);
95
- }
96
- }
97
- } else if (propName === 'className') {
98
- if (propValue) {
99
- // for classnames, append
100
- target[propName] = css(target[propName], propValue);
101
- }
102
- } else {
103
- target[propName] = propValue;
104
- }
105
- }
106
- }
107
- }
108
- }
109
-
110
- return target;
111
- };
112
-
113
- return mergeProps;
114
- };
115
-
116
- exports.makeMergeProps = makeMergeProps;
117
- //# sourceMappingURL=makeMergeProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/compose/makeMergeProps.ts"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAkCA;;;;AAIG;;;AACH,SAAS,GAAT,GAAY;AAAC,MAAA,IAAA,GAAA,EAAA;;OAAA,IAAA,EAAA,GAAA,C,EAAA,EAAA,GAAA,SAAA,CAAA,M,EAAA,EAAA,E,EAAmB;AAAnB,IAAA,IAAA,CAAA,EAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA;;;AACX,MAAM,OAAO,GAAG,EAAhB;;AAEA,OAAkB,IAAA,EAAA,GAAA,CAAA,EAAA,MAAA,GAAA,IAAlB,EAAkB,EAAA,GAAA,MAAA,CAAA,MAAlB,EAAkB,EAAA,EAAlB,EAAwB;AAAnB,QAAM,GAAG,GAAA,MAAA,CAAA,EAAA,CAAT;;AACH,QAAI,GAAJ,EAAS;AACP,UAAI,OAAO,GAAP,KAAe,QAAnB,EAA6B;AAC3B,QAAA,OAAO,CAAC,IAAR,CAAa,GAAb;AACD,OAFD,MAEO,IAAI,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Ac,cAAd","sourceRoot":""}
@@ -1,9 +0,0 @@
1
- import type { MergePropsOptions } from './makeMergeProps';
2
- declare type GenericDictionary = Record<string, any>;
3
- /**
4
- * Backwards-compatible version of makeMergeProps that has less restrictive type checking
5
- *
6
- * @deprecated Use makeMergeProps instead
7
- */
8
- export declare const makeMergePropsCompat: <TState = Record<string, any>>(options?: MergePropsOptions<Record<string, any>> | undefined) => (target: GenericDictionary, ...propSets: (GenericDictionary | undefined)[]) => TState;
9
- export {};
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.makeMergePropsCompat = void 0;
7
-
8
- var makeMergeProps_1 = /*#__PURE__*/require("./makeMergeProps");
9
- /**
10
- * Backwards-compatible version of makeMergeProps that has less restrictive type checking
11
- *
12
- * @deprecated Use makeMergeProps instead
13
- */
14
-
15
-
16
- exports.makeMergePropsCompat = makeMergeProps_1.makeMergeProps;
17
- //# sourceMappingURL=makeMergePropsCompat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/compose/makeMergePropsCompat.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAMA;;;;AAIG;;;AACU,OAAA,CAAA,oBAAA,GAAuB,gBAAA,CAAA,cAAvB","sourceRoot":""}
@@ -1,4 +0,0 @@
1
- /**
2
- * Simple constant function for returning null, used to render empty templates in JSX.
3
- */
4
- export declare const nullRender: () => null;
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.nullRender = void 0;
7
- /**
8
- * Simple constant function for returning null, used to render empty templates in JSX.
9
- */
10
-
11
- var nullRender = function () {
12
- return null;
13
- };
14
-
15
- exports.nullRender = nullRender;
16
- //# sourceMappingURL=nullRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/compose/nullRender.tsx"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACI,IAAM,UAAU,GAAG,YAAA;AAAM,SAAA,IAAA;AAAI,CAA7B;;AAAM,OAAA,CAAA,UAAA,GAAU,UAAV","sourceRoot":""}
@@ -1,8 +0,0 @@
1
- import type { ResolvedShorthandPropsCompat } from './types';
2
- /**
3
- * Ensures that the given slots are represented using object syntax. This ensures that
4
- * the object can be merged along with other objects.
5
- * @param props - The incoming props
6
- * @param shorthandPropNames - An array of prop names to apply simplification to
7
- */
8
- export declare const resolveShorthandProps: <TProps, TShorthandPropNames extends keyof TProps>(props: TProps, shorthandPropNames: readonly TShorthandPropNames[]) => ResolvedShorthandPropsCompat<TProps, TShorthandPropNames>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.resolveShorthandProps = void 0;
7
-
8
- var tslib_1 = /*#__PURE__*/require("tslib");
9
-
10
- var React = /*#__PURE__*/require("react");
11
- /**
12
- * Ensures that the given slots are represented using object syntax. This ensures that
13
- * the object can be merged along with other objects.
14
- * @param props - The incoming props
15
- * @param shorthandPropNames - An array of prop names to apply simplification to
16
- */
17
-
18
-
19
- var resolveShorthandProps = function (props, shorthandPropNames) {
20
- var newProps = props;
21
-
22
- for (var _i = 0, shorthandPropNames_1 = shorthandPropNames; _i < shorthandPropNames_1.length; _i++) {
23
- var propName = shorthandPropNames_1[_i];
24
- var propValue = props[propName];
25
-
26
- if (propValue !== undefined && (typeof propValue !== 'object' || React.isValidElement(propValue))) {
27
- if (newProps === props) {
28
- newProps = tslib_1.__assign({}, props); // Copy props before modifying
29
- }
30
-
31
- newProps[propName] = {
32
- children: propValue
33
- };
34
- }
35
- }
36
-
37
- return newProps;
38
- };
39
-
40
- exports.resolveShorthandProps = resolveShorthandProps;
41
- //# sourceMappingURL=resolveShorthandProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/compose/resolveShorthandProps.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAGA;;;;;AAKG;;;AACI,IAAM,qBAAqB,GAAG,UACnC,KADmC,EAEnC,kBAFmC,EAEe;AAElD,MAAI,QAAQ,GAAG,KAAf;;AAEA,OAAuB,IAAA,EAAA,GAAA,CAAA,EAAA,oBAAA,GAAA,kBAAvB,EAAuB,EAAA,GAAA,oBAAA,CAAA,MAAvB,EAAuB,EAAA,EAAvB,EAA2C;AAAtC,QAAM,QAAQ,GAAA,oBAAA,CAAA,EAAA,CAAd;AACH,QAAM,SAAS,GAAG,KAAK,CAAC,QAAD,CAAvB;;AACA,QAAI,SAAS,KAAK,SAAd,KAA4B,OAAO,SAAP,KAAqB,QAArB,IAAiC,KAAK,CAAC,cAAN,CAAqB,SAArB,CAA7D,CAAJ,EAAmG;AACjG,UAAI,QAAQ,KAAK,KAAjB,EAAwB;AACtB,QAAA,QAAQ,GAAA,OAAA,CAAA,QAAA,CAAA,EAAA,EAAQ,KAAR,CAAR,CADsB,CACG;AAC1B;;AAEA,MAAA,QAAQ,CAAC,QAAD,CAAR,GAAoD;AAAE,QAAA,QAAQ,EAAE;AAAZ,OAApD;AACF;AACF;;AAED,SAAQ,QAAR;AACD,CAlBM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourceRoot":""}
@@ -1,20 +0,0 @@
1
- import * as React from 'react';
2
- export declare type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void;
3
- /**
4
- * Default value can be a value or an initializer
5
- */
6
- declare type DefaultValue<TValue> = TValue | (() => TValue);
7
- /**
8
- * Hook to manage a value that could be either controlled or uncontrolled, such as a checked state or
9
- * text box string.
10
- * @param controlledValue - The controlled value passed in the props. This value will always be used if provided,
11
- * and the internal state will be updated to reflect it.
12
- * @param defaultUncontrolledValue - Initial value for the internal state in the uncontrolled case.
13
- * @returns An array of the current value and an updater callback. Like `React.useState`, the updater
14
- * callback always has the same identity, and it can take either a new value, or a function which
15
- * is passed the previous value and returns the new value.
16
- * @see https://reactjs.org/docs/uncontrolled-components.html
17
- */
18
- export declare function useControllableValue<TValue, TElement extends HTMLElement>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>): Readonly<[TValue, (update: React.SetStateAction<TValue>) => void]>;
19
- export declare function useControllableValue<TValue, TElement extends HTMLElement, TEvent extends React.SyntheticEvent<TElement> | undefined>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>, onChange: ChangeCallback<TElement, TValue, TEvent>): Readonly<[TValue, (update: React.SetStateAction<TValue>, ev?: React.FormEvent<TElement>) => void]>;
20
- export {};
@@ -1,73 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useControllableValue = void 0;
7
-
8
- var React = /*#__PURE__*/require("react");
9
-
10
- var useConst_1 = /*#__PURE__*/require("./useConst");
11
-
12
- function useControllableValue(controlledValue, defaultUncontrolledValue, onChange) {
13
- var _a = React.useState(defaultUncontrolledValue),
14
- value = _a[0],
15
- setValue = _a[1];
16
-
17
- var isControlled = useIsControlled(controlledValue);
18
- var currentValue = isControlled ? controlledValue : value; // Duplicate the current value and onChange in refs so they're accessible from
19
- // setValueOrCallOnChange without creating a new callback every time
20
-
21
- var valueRef = React.useRef(currentValue);
22
- var onChangeRef = React.useRef(onChange);
23
- React.useEffect(function () {
24
- valueRef.current = currentValue;
25
- onChangeRef.current = onChange;
26
- }); // To match the behavior of the setter returned by React.useState, this callback's identity
27
- // should never change. This means it MUST NOT directly reference variables that can change.
28
-
29
- var setValueOrCallOnChange = useConst_1.useConst(function () {
30
- return function (update, ev) {
31
- // Assuming here that TValue is not a function, because a controllable value will typically
32
- // be something a user can enter as input
33
- var newValue = typeof update === 'function' ? update(valueRef.current) : update;
34
-
35
- if (onChangeRef.current) {
36
- onChangeRef.current(ev, newValue);
37
- }
38
-
39
- if (!isControlled) {
40
- setValue(newValue);
41
- }
42
- };
43
- });
44
- return [currentValue, setValueOrCallOnChange];
45
- }
46
-
47
- exports.useControllableValue = useControllableValue;
48
- /**
49
- * Helper hook to handle previous comparison of controlled/uncontrolled
50
- * Prints an error when isControlled value switches between subsequent renders
51
- */
52
-
53
- var useIsControlled = function (controlledValue) {
54
- var isControlled = useConst_1.useConst(controlledValue !== undefined);
55
-
56
- if (process.env.NODE_ENV !== 'production') {
57
- // We don't want these warnings in production even though it is against native behaviour
58
- // eslint-disable-next-line react-hooks/rules-of-hooks
59
- React.useEffect(function () {
60
- if (isControlled !== (controlledValue !== undefined)) {
61
- var error = new Error();
62
- var controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';
63
- var undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined'; // eslint-disable-next-line no-console
64
-
65
- console.error([// Default react error
66
- 'A component is changing ' + controlWarning + '. This is likely caused by the value', 'changing from ' + undefinedWarning + ' value, which should not happen.', 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.', 'More info: https://reactjs.org/link/controlled-components', error.stack].join(' '));
67
- }
68
- }, [isControlled, controlledValue]);
69
- }
70
-
71
- return isControlled;
72
- };
73
- //# sourceMappingURL=useControllableValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/hooks/useControllableValue.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;;AAqCA,SAAgB,oBAAhB,CAKE,eALF,EAME,wBANF,EAOE,QAPF,EAOqD;AAE7C,MAAA,EAAA,GAAoB,KAAK,CAAC,QAAN,CAAmC,wBAAnC,CAApB;AAAA,MAAC,KAAK,GAAA,EAAA,CAAA,CAAA,CAAN;AAAA,MAAQ,QAAQ,GAAA,EAAA,CAAA,CAAA,CAAhB;;AACN,MAAM,YAAY,GAAG,eAAe,CAAC,eAAD,CAApC;AACA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;AAEA,YAAM,cAAc,GAAG,YAAY,GAC/B,uCAD+B,GAE/B,wCAFJ;AAIA,YAAM,gBAAgB,GAAG,YAAY,GAAG,yBAAH,GAA+B,wBAApE,CAPoD,CASpD;;AACA,QAAA,OAAO,CAAC,KAAR,CACE,CACE;AACA,qCAA6B,cAA7B,GAA8C,sCAFhD,EAGE,mBAAmB,gBAAnB,GAAsC,kCAHxC,EAIE,oGAJF,EAKE,2DALF,EAME,KAAK,CAAC,KANR,EAOE,IAPF,CAOO,GAPP,CADF;AAUD;AACF,KAtBD,EAsBG,CAAC,YAAD,EAAe,eAAf,CAtBH;AAuBD;;AAED,SAAO,YAAP;AACD,CAhCD","sourceRoot":""}
@@ -1,5 +0,0 @@
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>)>;
@@ -1,23 +0,0 @@
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
@@ -1 +0,0 @@
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":""}