@fluentui/react-utilities 9.0.0-alpha.9 → 9.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/CHANGELOG.json +1132 -1
  2. package/CHANGELOG.md +492 -2
  3. package/dist/react-utilities.d.ts +335 -67
  4. package/lib/compose/getSlots.d.ts +13 -4
  5. package/lib/compose/getSlots.js +44 -32
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.d.ts +1 -2
  8. package/lib/compose/index.js +2 -2
  9. package/lib/compose/index.js.map +1 -1
  10. package/lib/compose/nullRender.js +1 -1
  11. package/lib/compose/nullRender.js.map +1 -1
  12. package/lib/compose/resolveShorthand.d.ts +12 -0
  13. package/lib/compose/resolveShorthand.js +31 -0
  14. package/lib/compose/resolveShorthand.js.map +1 -0
  15. package/lib/compose/types.d.ts +95 -21
  16. package/lib/compose/types.js +5 -0
  17. package/lib/compose/types.js.map +1 -1
  18. package/lib/hooks/index.d.ts +9 -1
  19. package/lib/hooks/index.js +9 -1
  20. package/lib/hooks/index.js.map +1 -1
  21. package/lib/hooks/useBoolean.d.ts +2 -2
  22. package/lib/hooks/useBoolean.js +16 -11
  23. package/lib/hooks/useBoolean.js.map +1 -1
  24. package/lib/hooks/useConst.js +15 -12
  25. package/lib/hooks/useConst.js.map +1 -1
  26. package/lib/hooks/useControllableState.d.ts +21 -0
  27. package/lib/hooks/useControllableState.js +68 -0
  28. package/lib/hooks/useControllableState.js.map +1 -0
  29. package/lib/hooks/useControllableValue.js +47 -50
  30. package/lib/hooks/useControllableValue.js.map +1 -1
  31. package/lib/hooks/useEventCallback.d.ts +2 -2
  32. package/lib/hooks/useEventCallback.js +14 -17
  33. package/lib/hooks/useEventCallback.js.map +1 -1
  34. package/lib/hooks/useFirstMount.d.ts +11 -0
  35. package/lib/hooks/useFirstMount.js +23 -0
  36. package/lib/hooks/useFirstMount.js.map +1 -0
  37. package/lib/hooks/useForceUpdate.d.ts +4 -0
  38. package/lib/hooks/useForceUpdate.js +9 -0
  39. package/lib/hooks/useForceUpdate.js.map +1 -0
  40. package/lib/hooks/useId.d.ts +7 -3
  41. package/lib/hooks/useId.js +13 -17
  42. package/lib/hooks/useId.js.map +1 -1
  43. package/lib/hooks/useIsomorphicLayoutEffect.d.ts +9 -0
  44. package/lib/hooks/useIsomorphicLayoutEffect.js +13 -4
  45. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  46. package/lib/hooks/useMergedRefs.js +16 -20
  47. package/lib/hooks/useMergedRefs.js.map +1 -1
  48. package/lib/hooks/useMount.d.ts +6 -0
  49. package/lib/hooks/useMount.js +17 -0
  50. package/lib/hooks/useMount.js.map +1 -0
  51. package/lib/hooks/useOnClickOutside.d.ts +14 -4
  52. package/lib/hooks/useOnClickOutside.js +129 -18
  53. package/lib/hooks/useOnClickOutside.js.map +1 -1
  54. package/lib/hooks/useOnScrollOutside.d.ts +5 -0
  55. package/lib/hooks/useOnScrollOutside.js +36 -0
  56. package/lib/hooks/useOnScrollOutside.js.map +1 -0
  57. package/lib/hooks/usePrevious.d.ts +1 -0
  58. package/lib/hooks/usePrevious.js +9 -0
  59. package/lib/hooks/usePrevious.js.map +1 -0
  60. package/lib/hooks/useTimeout.d.ts +8 -0
  61. package/lib/hooks/useTimeout.js +29 -0
  62. package/lib/hooks/useTimeout.js.map +1 -0
  63. package/lib/hooks/useUnmount.d.ts +6 -0
  64. package/lib/hooks/useUnmount.js +17 -0
  65. package/lib/hooks/useUnmount.js.map +1 -0
  66. package/lib/index.d.ts +1 -0
  67. package/lib/index.js +1 -0
  68. package/lib/index.js.map +1 -1
  69. package/lib/ssr/SSRContext.d.ts +33 -0
  70. package/lib/ssr/SSRContext.js +65 -0
  71. package/lib/ssr/SSRContext.js.map +1 -0
  72. package/lib/ssr/canUseDOM.d.ts +4 -0
  73. package/lib/ssr/canUseDOM.js +8 -0
  74. package/lib/ssr/canUseDOM.js.map +1 -0
  75. package/lib/ssr/index.d.ts +2 -0
  76. package/lib/ssr/index.js +3 -0
  77. package/lib/ssr/index.js.map +1 -0
  78. package/lib/tsdoc-metadata.json +1 -1
  79. package/lib/utils/applyTriggerPropsToChildren.d.ts +5 -0
  80. package/lib/utils/applyTriggerPropsToChildren.js +16 -0
  81. package/lib/utils/applyTriggerPropsToChildren.js.map +1 -0
  82. package/lib/utils/clamp.d.ts +8 -0
  83. package/lib/utils/clamp.js +9 -0
  84. package/lib/utils/clamp.js.map +1 -0
  85. package/lib/utils/getNativeElementProps.d.ts +22 -0
  86. package/lib/utils/getNativeElementProps.js +48 -24
  87. package/lib/utils/getNativeElementProps.js.map +1 -1
  88. package/lib/utils/getRTLSafeKey.d.ts +4 -0
  89. package/lib/utils/getRTLSafeKey.js +21 -0
  90. package/lib/utils/getRTLSafeKey.js.map +1 -0
  91. package/lib/utils/index.d.ts +5 -0
  92. package/lib/utils/index.js +5 -0
  93. package/lib/utils/index.js.map +1 -1
  94. package/lib/utils/omit.d.ts +1 -1
  95. package/lib/utils/omit.js +9 -7
  96. package/lib/utils/omit.js.map +1 -1
  97. package/lib/utils/onlyChild.d.ts +5 -0
  98. package/lib/utils/onlyChild.js +13 -0
  99. package/lib/utils/onlyChild.js.map +1 -0
  100. package/lib/utils/properties.js +80 -282
  101. package/lib/utils/properties.js.map +1 -1
  102. package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +7 -0
  103. package/lib/utils/shouldPreventDefaultOnKeyDown.js +20 -0
  104. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -0
  105. package/lib-commonjs/compose/getSlots.d.ts +13 -4
  106. package/lib-commonjs/compose/getSlots.js +57 -35
  107. package/lib-commonjs/compose/getSlots.js.map +1 -1
  108. package/lib-commonjs/compose/index.d.ts +1 -2
  109. package/lib-commonjs/compose/index.js +12 -4
  110. package/lib-commonjs/compose/index.js.map +1 -1
  111. package/lib-commonjs/compose/nullRender.js +9 -2
  112. package/lib-commonjs/compose/nullRender.js.map +1 -1
  113. package/lib-commonjs/compose/resolveShorthand.d.ts +12 -0
  114. package/lib-commonjs/compose/resolveShorthand.js +41 -0
  115. package/lib-commonjs/compose/resolveShorthand.js.map +1 -0
  116. package/lib-commonjs/compose/types.d.ts +95 -21
  117. package/lib-commonjs/compose/types.js +8 -1
  118. package/lib-commonjs/compose/types.js.map +1 -1
  119. package/lib-commonjs/hooks/index.d.ts +9 -1
  120. package/lib-commonjs/hooks/index.js +31 -4
  121. package/lib-commonjs/hooks/index.js.map +1 -1
  122. package/lib-commonjs/hooks/useBoolean.d.ts +2 -2
  123. package/lib-commonjs/hooks/useBoolean.js +27 -14
  124. package/lib-commonjs/hooks/useBoolean.js.map +1 -1
  125. package/lib-commonjs/hooks/useConst.js +24 -14
  126. package/lib-commonjs/hooks/useConst.js.map +1 -1
  127. package/lib-commonjs/hooks/useControllableState.d.ts +21 -0
  128. package/lib-commonjs/hooks/useControllableState.js +78 -0
  129. package/lib-commonjs/hooks/useControllableState.js.map +1 -0
  130. package/lib-commonjs/hooks/useControllableValue.js +58 -53
  131. package/lib-commonjs/hooks/useControllableValue.js.map +1 -1
  132. package/lib-commonjs/hooks/useEventCallback.d.ts +2 -2
  133. package/lib-commonjs/hooks/useEventCallback.js +26 -20
  134. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  135. package/lib-commonjs/hooks/useFirstMount.d.ts +11 -0
  136. package/lib-commonjs/hooks/useFirstMount.js +33 -0
  137. package/lib-commonjs/hooks/useFirstMount.js.map +1 -0
  138. package/lib-commonjs/hooks/useForceUpdate.d.ts +4 -0
  139. package/lib-commonjs/hooks/useForceUpdate.js +19 -0
  140. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -0
  141. package/lib-commonjs/hooks/useId.d.ts +7 -3
  142. package/lib-commonjs/hooks/useId.js +25 -21
  143. package/lib-commonjs/hooks/useId.js.map +1 -1
  144. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +9 -0
  145. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +22 -6
  146. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  147. package/lib-commonjs/hooks/useMergedRefs.js +25 -22
  148. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  149. package/lib-commonjs/hooks/useMount.d.ts +6 -0
  150. package/lib-commonjs/hooks/useMount.js +27 -0
  151. package/lib-commonjs/hooks/useMount.js.map +1 -0
  152. package/lib-commonjs/hooks/useOnClickOutside.d.ts +14 -4
  153. package/lib-commonjs/hooks/useOnClickOutside.js +141 -21
  154. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  155. package/lib-commonjs/hooks/useOnScrollOutside.d.ts +5 -0
  156. package/lib-commonjs/hooks/useOnScrollOutside.js +47 -0
  157. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -0
  158. package/lib-commonjs/hooks/usePrevious.d.ts +1 -0
  159. package/lib-commonjs/hooks/usePrevious.js +19 -0
  160. package/lib-commonjs/hooks/usePrevious.js.map +1 -0
  161. package/lib-commonjs/hooks/useTimeout.d.ts +8 -0
  162. package/lib-commonjs/hooks/useTimeout.js +40 -0
  163. package/lib-commonjs/hooks/useTimeout.js.map +1 -0
  164. package/lib-commonjs/hooks/useUnmount.d.ts +6 -0
  165. package/lib-commonjs/hooks/useUnmount.js +27 -0
  166. package/lib-commonjs/hooks/useUnmount.js.map +1 -0
  167. package/lib-commonjs/index.d.ts +1 -0
  168. package/lib-commonjs/index.js +11 -2
  169. package/lib-commonjs/index.js.map +1 -1
  170. package/lib-commonjs/ssr/SSRContext.d.ts +33 -0
  171. package/lib-commonjs/ssr/SSRContext.js +80 -0
  172. package/lib-commonjs/ssr/SSRContext.js.map +1 -0
  173. package/lib-commonjs/ssr/canUseDOM.d.ts +4 -0
  174. package/lib-commonjs/ssr/canUseDOM.js +17 -0
  175. package/lib-commonjs/ssr/canUseDOM.js.map +1 -0
  176. package/lib-commonjs/ssr/index.d.ts +2 -0
  177. package/lib-commonjs/ssr/index.js +12 -0
  178. package/lib-commonjs/ssr/index.js.map +1 -0
  179. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +5 -0
  180. package/lib-commonjs/utils/applyTriggerPropsToChildren.js +27 -0
  181. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -0
  182. package/lib-commonjs/utils/clamp.d.ts +8 -0
  183. package/lib-commonjs/utils/clamp.js +18 -0
  184. package/lib-commonjs/utils/clamp.js.map +1 -0
  185. package/lib-commonjs/utils/getNativeElementProps.d.ts +22 -0
  186. package/lib-commonjs/utils/getNativeElementProps.js +58 -25
  187. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  188. package/lib-commonjs/utils/getRTLSafeKey.d.ts +4 -0
  189. package/lib-commonjs/utils/getRTLSafeKey.js +30 -0
  190. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -0
  191. package/lib-commonjs/utils/index.d.ts +5 -0
  192. package/lib-commonjs/utils/index.js +19 -2
  193. package/lib-commonjs/utils/index.js.map +1 -1
  194. package/lib-commonjs/utils/omit.d.ts +1 -1
  195. package/lib-commonjs/utils/omit.js +16 -8
  196. package/lib-commonjs/utils/omit.js.map +1 -1
  197. package/lib-commonjs/utils/onlyChild.d.ts +5 -0
  198. package/lib-commonjs/utils/onlyChild.js +23 -0
  199. package/lib-commonjs/utils/onlyChild.js.map +1 -0
  200. package/lib-commonjs/utils/properties.js +84 -280
  201. package/lib-commonjs/utils/properties.js.map +1 -1
  202. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +7 -0
  203. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +30 -0
  204. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -0
  205. package/package.json +11 -9
  206. package/NOTICE.txt +0 -0
  207. package/config/api-extractor.json +0 -3
  208. package/config/tests.js +0 -7
  209. package/etc/react-utilities.api.md +0 -207
  210. package/just.config.ts +0 -3
  211. package/lib/compose/makeMergeProps.d.ts +0 -15
  212. package/lib/compose/makeMergeProps.js +0 -96
  213. package/lib/compose/makeMergeProps.js.map +0 -1
  214. package/lib/compose/resolveShorthandProps.d.ts +0 -7
  215. package/lib/compose/resolveShorthandProps.js +0 -27
  216. package/lib/compose/resolveShorthandProps.js.map +0 -1
  217. package/lib-amd/compose/getSlots.d.ts +0 -20
  218. package/lib-amd/compose/getSlots.js +0 -51
  219. package/lib-amd/compose/getSlots.js.map +0 -1
  220. package/lib-amd/compose/index.d.ts +0 -5
  221. package/lib-amd/compose/index.js +0 -9
  222. package/lib-amd/compose/index.js.map +0 -1
  223. package/lib-amd/compose/makeMergeProps.d.ts +0 -15
  224. package/lib-amd/compose/makeMergeProps.js +0 -98
  225. package/lib-amd/compose/makeMergeProps.js.map +0 -1
  226. package/lib-amd/compose/nullRender.d.ts +0 -4
  227. package/lib-amd/compose/nullRender.js +0 -9
  228. package/lib-amd/compose/nullRender.js.map +0 -1
  229. package/lib-amd/compose/resolveShorthandProps.d.ts +0 -7
  230. package/lib-amd/compose/resolveShorthandProps.js +0 -29
  231. package/lib-amd/compose/resolveShorthandProps.js.map +0 -1
  232. package/lib-amd/compose/types.d.ts +0 -29
  233. package/lib-amd/compose/types.js +0 -5
  234. package/lib-amd/compose/types.js.map +0 -1
  235. package/lib-amd/hooks/index.d.ts +0 -8
  236. package/lib-amd/hooks/index.js +0 -13
  237. package/lib-amd/hooks/index.js.map +0 -1
  238. package/lib-amd/hooks/useBoolean.d.ts +0 -17
  239. package/lib-amd/hooks/useBoolean.js +0 -26
  240. package/lib-amd/hooks/useBoolean.js.map +0 -1
  241. package/lib-amd/hooks/useConst.d.ts +0 -12
  242. package/lib-amd/hooks/useConst.js +0 -31
  243. package/lib-amd/hooks/useConst.js.map +0 -1
  244. package/lib-amd/hooks/useControllableValue.d.ts +0 -20
  245. package/lib-amd/hooks/useControllableValue.js +0 -42
  246. package/lib-amd/hooks/useControllableValue.js.map +0 -1
  247. package/lib-amd/hooks/useEventCallback.d.ts +0 -13
  248. package/lib-amd/hooks/useEventCallback.js +0 -33
  249. package/lib-amd/hooks/useEventCallback.js.map +0 -1
  250. package/lib-amd/hooks/useId.d.ts +0 -11
  251. package/lib-amd/hooks/useId.js +0 -35
  252. package/lib-amd/hooks/useId.js.map +0 -1
  253. package/lib-amd/hooks/useIsomorphicLayoutEffect.d.ts +0 -2
  254. package/lib-amd/hooks/useIsomorphicLayoutEffect.js +0 -9
  255. package/lib-amd/hooks/useIsomorphicLayoutEffect.js.map +0 -1
  256. package/lib-amd/hooks/useMergedRefs.d.ts +0 -13
  257. package/lib-amd/hooks/useMergedRefs.js +0 -33
  258. package/lib-amd/hooks/useMergedRefs.js.map +0 -1
  259. package/lib-amd/hooks/useOnClickOutside.d.ts +0 -19
  260. package/lib-amd/hooks/useOnClickOutside.js +0 -27
  261. package/lib-amd/hooks/useOnClickOutside.js.map +0 -1
  262. package/lib-amd/index.d.ts +0 -3
  263. package/lib-amd/index.js +0 -8
  264. package/lib-amd/index.js.map +0 -1
  265. package/lib-amd/utils/getNativeElementProps.d.ts +0 -9
  266. package/lib-amd/utils/getNativeElementProps.js +0 -40
  267. package/lib-amd/utils/getNativeElementProps.js.map +0 -1
  268. package/lib-amd/utils/index.d.ts +0 -3
  269. package/lib-amd/utils/index.js +0 -8
  270. package/lib-amd/utils/index.js.map +0 -1
  271. package/lib-amd/utils/omit.d.ts +0 -14
  272. package/lib-amd/utils/omit.js +0 -30
  273. package/lib-amd/utils/omit.js.map +0 -1
  274. package/lib-amd/utils/properties.d.ts +0 -148
  275. package/lib-amd/utils/properties.js +0 -416
  276. package/lib-amd/utils/properties.js.map +0 -1
  277. package/lib-commonjs/compose/makeMergeProps.d.ts +0 -15
  278. package/lib-commonjs/compose/makeMergeProps.js +0 -98
  279. package/lib-commonjs/compose/makeMergeProps.js.map +0 -1
  280. package/lib-commonjs/compose/resolveShorthandProps.d.ts +0 -7
  281. package/lib-commonjs/compose/resolveShorthandProps.js +0 -29
  282. package/lib-commonjs/compose/resolveShorthandProps.js.map +0 -1
  283. package/src/compose/README.md +0 -279
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "@fluentui/scripts/api-extractor/api-extractor.common.json"
3
- }
package/config/tests.js DELETED
@@ -1,7 +0,0 @@
1
- /** Jest test setup file. */
2
-
3
- const { configure } = require('enzyme');
4
- const Adapter = require('enzyme-adapter-react-16');
5
-
6
- // Configure enzyme.
7
- configure({ adapter: new Adapter() });
@@ -1,207 +0,0 @@
1
- ## API Report File for "@fluentui/react-utilities"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import * as React from 'react';
8
-
9
- // @public
10
- export const anchorProperties: Record<string, number>;
11
-
12
- // @public
13
- export const audioProperties: Record<string, number>;
14
-
15
- // @public
16
- export const baseElementEvents: Record<string, number>;
17
-
18
- // @public
19
- export const baseElementProperties: Record<string, number>;
20
-
21
- // @public (undocumented)
22
- export interface BaseSlots {
23
- // (undocumented)
24
- root: React.ElementType;
25
- }
26
-
27
- // @public
28
- export const buttonProperties: Record<string, number>;
29
-
30
- // @public (undocumented)
31
- export type ChangeCallback<TElement extends HTMLElement, TValue, TEvent extends React.SyntheticEvent<TElement> | undefined> = (ev: TEvent, newValue: TValue | undefined) => void;
32
-
33
- // @public
34
- export type ClassDictionary = Record<string, string>;
35
-
36
- // @public (undocumented)
37
- export const colGroupProperties: Record<string, number>;
38
-
39
- // @public (undocumented)
40
- export const colProperties: Record<string, number>;
41
-
42
- // @public (undocumented)
43
- export interface ComponentProps {
44
- // (undocumented)
45
- as?: React.ElementType;
46
- // (undocumented)
47
- children?: React.ReactNode;
48
- // (undocumented)
49
- className?: string;
50
- }
51
-
52
- // @public
53
- export const divProperties: Record<string, number>;
54
-
55
- // @public
56
- export const formProperties: Record<string, number>;
57
-
58
- // @public
59
- export type GenericDictionary = Record<string, any>;
60
-
61
- // @public
62
- export function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
63
-
64
- // @public
65
- export function getNativeProps<T extends Record<string, any>>(props: Record<string, any>, allowedPropNames: string[] | Record<string, number>, excludedPropNames?: string[]): T;
66
-
67
- // @public
68
- export const getSlots: (state: Record<string, any>, slotNames?: string[] | undefined) => {
69
- slots: Record<string, any>;
70
- slotProps: Record<string, any>;
71
- };
72
-
73
- // @public
74
- export const htmlElementProperties: Record<string, number>;
75
-
76
- // @public
77
- export const iframeProperties: Record<string, number>;
78
-
79
- // @public @deprecated (undocumented)
80
- export const imageProperties: Record<string, number>;
81
-
82
- // @public
83
- export const imgProperties: Record<string, number>;
84
-
85
- // @public
86
- export const inputProperties: Record<string, number>;
87
-
88
- // @public
89
- export const labelProperties: Record<string, number>;
90
-
91
- // @public
92
- export const liProperties: Record<string, number>;
93
-
94
- // @public
95
- export const makeMergeProps: <TState = Record<string, any>>(options?: MergePropsOptions) => (target: Record<string, any>, ...propSets: (Record<string, any> | undefined)[]) => TState;
96
-
97
- // @public (undocumented)
98
- export type MergePropsOptions = {
99
- deepMerge?: string[];
100
- };
101
-
102
- // @public
103
- export const nullRender: () => null;
104
-
105
- // @public (undocumented)
106
- export type ObjectShorthandProps<TProps extends ComponentProps = {}> = TProps & {
107
- children?: TProps['children'] | ShorthandRenderFunction<TProps>;
108
- };
109
-
110
- // @public
111
- export const olProperties: Record<string, number>;
112
-
113
- // @public
114
- export function omit<TObj extends Record<string, any>>(obj: TObj, exclusions: (keyof TObj)[]): TObj;
115
-
116
- // @public (undocumented)
117
- export const optionProperties: Record<string, number>;
118
-
119
- // @public
120
- export type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);
121
-
122
- // @public
123
- export const resolveShorthandProps: <TProps>(props: TProps, shorthandPropNames: string[]) => TProps;
124
-
125
- // @public
126
- export const selectProperties: Record<string, number>;
127
-
128
- // @public (undocumented)
129
- export type ShorthandProps<TProps extends ComponentProps = {}> = React.ReactChild | React.ReactNodeArray | React.ReactPortal | boolean | number | null | undefined | (TProps & ComponentProps & {
130
- children?: TProps['children'] | ShorthandRenderFunction<TProps>;
131
- });
132
-
133
- // @public (undocumented)
134
- export type ShorthandRenderFunction<TProps> = (Component: React.ElementType<TProps>, props: TProps) => React.ReactNode;
135
-
136
- // @public (undocumented)
137
- export type SlotProps<TSlots extends BaseSlots, TProps, TRootProps extends React.HTMLAttributes<HTMLElement>> = {
138
- [key in keyof Omit<TSlots, 'root'>]: key extends keyof TProps ? TProps[key] : any;
139
- } & {
140
- root: TRootProps;
141
- };
142
-
143
- // @public
144
- export const tableProperties: Record<string, number>;
145
-
146
- // @public
147
- export const tdProperties: Record<string, number>;
148
-
149
- // @public
150
- export const textAreaProperties: Record<string, number>;
151
-
152
- // @public
153
- export const thProperties: Record<string, number>;
154
-
155
- // @public
156
- export const trProperties: Record<string, number>;
157
-
158
- // @public
159
- export function useBoolean(initialState: boolean): [boolean, UseBooleanCallbacks];
160
-
161
- // @public
162
- export interface UseBooleanCallbacks {
163
- setFalse: () => void;
164
- setTrue: () => void;
165
- toggle: () => void;
166
- }
167
-
168
- // @public
169
- export function useConst<T>(initialValue: T | (() => T)): T;
170
-
171
- // Warning: (ae-forgotten-export) The symbol "DefaultValue" needs to be exported by the entry point index.d.ts
172
- //
173
- // @public
174
- export function useControllableValue<TValue, TElement extends HTMLElement>(controlledValue: TValue, defaultUncontrolledValue: DefaultValue<TValue>): Readonly<[TValue, (update: React.SetStateAction<TValue>) => void]>;
175
-
176
- // @public (undocumented)
177
- export 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]>;
178
-
179
- // @public
180
- export const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return;
181
-
182
- // @public
183
- export function useId(prefix?: string, providedId?: string): string;
184
-
185
- // @public (undocumented)
186
- export const useIsomorphicLayoutEffect: typeof React.useEffect;
187
-
188
- // @public
189
- export function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T>;
190
-
191
- // @public
192
- export const useOnClickOutside: (options: UseOnClickOutsideOptions) => void;
193
-
194
- // @public (undocumented)
195
- export type UseOnClickOutsideOptions = {
196
- element?: Document;
197
- refs: React.MutableRefObject<HTMLElement | undefined | null>[];
198
- callback: (ev: MouseEvent | TouchEvent) => void;
199
- };
200
-
201
- // @public
202
- export const videoProperties: Record<string, number>;
203
-
204
-
205
- // (No @packageDocumentation comment for this package)
206
-
207
- ```
package/just.config.ts DELETED
@@ -1,3 +0,0 @@
1
- import { preset } from '@fluentui/scripts';
2
-
3
- preset();
@@ -1,15 +0,0 @@
1
- export declare type MergePropsOptions = {
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?: string[];
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 = Record<string, any>>(options?: MergePropsOptions) => (target: Record<string, any>, ...propSets: (Record<string, any> | undefined)[]) => TState;
@@ -1,96 +0,0 @@
1
- import { __spreadArrays } from "tslib";
2
- import * as React from 'react';
3
- /**
4
- * Concatination helper, which can merge class names together. Skips over falsey values.
5
- *
6
- * @public
7
- */
8
- function css() {
9
- var args = [];
10
- for (var _i = 0; _i < arguments.length; _i++) {
11
- args[_i] = arguments[_i];
12
- }
13
- var classes = [];
14
- for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
15
- var arg = args_1[_a];
16
- if (arg) {
17
- if (typeof arg === 'string') {
18
- classes.push(arg);
19
- }
20
- else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {
21
- classes.push(arg.toString());
22
- }
23
- else {
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- for (var key in arg) {
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- if (arg[key]) {
28
- classes.push(key);
29
- }
30
- }
31
- }
32
- }
33
- }
34
- return classes.join(' ');
35
- }
36
- /**
37
- * Helper which deep clones props, but respectively assigns JSX, object refs, and class names
38
- * appropriately.
39
- *
40
- * @param target - the target object to merge onto.
41
- * @param propSets - one or more prop sets to deep merge onto the target.
42
- */
43
- export var makeMergeProps = function (options) {
44
- if (options === void 0) { options = {}; }
45
- var deepMerge = __spreadArrays((options.deepMerge || []), ['style']);
46
- var mergeProps = function (target) {
47
- var propSets = [];
48
- for (var _i = 1; _i < arguments.length; _i++) {
49
- propSets[_i - 1] = arguments[_i];
50
- }
51
- for (var _a = 0, propSets_1 = propSets; _a < propSets_1.length; _a++) {
52
- var props = propSets_1[_a];
53
- if (props) {
54
- for (var _b = 0, _c = Object.keys(props); _b < _c.length; _b++) {
55
- var propName = _c[_b];
56
- var propValue = props[propName];
57
- var propValueType = typeof propValue;
58
- if (propValue !== undefined) {
59
- if (propValue && propValueType === 'object') {
60
- if (Array.isArray(propValue)) {
61
- // for arrays, replace.
62
- target[propName] = propValue;
63
- }
64
- else {
65
- target[propName] = target[propName] || {};
66
- if (typeof target[propName] !== 'object' ||
67
- React.isValidElement(propValue) ||
68
- (propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current')) ||
69
- deepMerge.indexOf(propName) === -1) {
70
- // if target is not an object, or value is JSX, or a ref object, replace
71
- target[propName] = propValue;
72
- }
73
- else {
74
- // else deep merge.
75
- mergeProps(target[propName], propValue);
76
- }
77
- }
78
- }
79
- else if (propName === 'className') {
80
- if (propValue) {
81
- // for classnames, append
82
- target[propName] = css(target[propName], propValue);
83
- }
84
- }
85
- else {
86
- target[propName] = propValue;
87
- }
88
- }
89
- }
90
- }
91
- }
92
- return target;
93
- };
94
- return mergeProps;
95
- };
96
- //# sourceMappingURL=makeMergeProps.js.map
@@ -1 +0,0 @@
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G,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;6BACrD;yBACF;6BAAM;4BACL,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;yBAC9B;qBACF;iBACF;aACF;SACF;QACD,OAAO,MAAgB,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { GenericDictionary } from './types';\n\n// TODO\n// css() function is temporary there, ax() should be used instead, but it's not possible now due possible\n// circular dependencies\n\n/**\n * Dictionary of booleans.\n *\n * @internal\n */\ninterface Dictionary {\n [className: string]: boolean;\n}\n\n/**\n * Serializable object.\n *\n * @internal\n */\ninterface SerializableObject {\n toString?: () => string;\n}\n\n/**\n * css input type.\n *\n * @internal\n */\ntype CssInput = string | SerializableObject | Dictionary | null | undefined | boolean;\n\n/**\n * Concatination helper, which can merge class names together. Skips over falsey values.\n *\n * @public\n */\nfunction css(...args: CssInput[]): string {\n const classes = [];\n\n for (const arg of args) {\n if (arg) {\n if (typeof arg === 'string') {\n classes.push(arg);\n } else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {\n classes.push(arg.toString());\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const key in arg as any) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((arg as any)[key]) {\n classes.push(key);\n }\n }\n }\n }\n }\n\n return classes.join(' ');\n}\n\nexport type MergePropsOptions = {\n /**\n * A list of props to deep merge. By default, `style` will\n * always be deep merged so it's not required to be provided.\n */\n deepMerge?: string[];\n};\n\n/**\n * Helper which deep clones props, but respectively assigns JSX, object refs, and class names\n * appropriately.\n *\n * @param target - the target object to merge onto.\n * @param propSets - one or more prop sets to deep merge onto the target.\n */\nexport const makeMergeProps = <TState = GenericDictionary>(options: MergePropsOptions = {}) => {\n const deepMerge = [...(options.deepMerge || []), 'style'];\n\n const mergeProps = (target: GenericDictionary, ...propSets: (GenericDictionary | undefined)[]): TState => {\n for (const props of propSets) {\n if (props) {\n for (const propName of Object.keys(props)) {\n const propValue = props[propName];\n const propValueType = typeof propValue;\n\n if (propValue !== undefined) {\n if (propValue && propValueType === 'object') {\n if (Array.isArray(propValue)) {\n // for arrays, replace.\n target[propName] = propValue;\n } else {\n target[propName] = target[propName] || {};\n\n if (\n typeof target[propName] !== 'object' ||\n React.isValidElement(propValue) ||\n (propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current')) ||\n deepMerge.indexOf(propName) === -1\n ) {\n // if target is not an object, or value is JSX, or a ref object, replace\n target[propName] = propValue;\n } else {\n // else deep merge.\n mergeProps(target[propName], propValue);\n }\n }\n } else if (propName === 'className') {\n if (propValue) {\n // for classnames, append\n target[propName] = css(target[propName], propValue);\n }\n } else {\n target[propName] = propValue;\n }\n }\n }\n }\n }\n return target as TState;\n };\n\n return mergeProps;\n};\n"]}
@@ -1,7 +0,0 @@
1
- /**
2
- * Ensures that the given slots are represented using object syntax. This ensures that
3
- * the object can be merged along with other objects.
4
- * @param props - The incoming props
5
- * @param shorthandPropNames - An array of prop names to apply simplification to
6
- */
7
- export declare const resolveShorthandProps: <TProps>(props: TProps, shorthandPropNames: string[]) => TProps;
@@ -1,27 +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
- export var resolveShorthandProps = function (props, shorthandPropNames) {
10
- var newProps = props;
11
- if (shorthandPropNames && shorthandPropNames.length) {
12
- newProps = __assign({}, props);
13
- for (var _i = 0, shorthandPropNames_1 = shorthandPropNames; _i < shorthandPropNames_1.length; _i++) {
14
- var propName = shorthandPropNames_1[_i];
15
- // TODO find clean way of guaranteeing only shorthand props are typechecked
16
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
- // @ts-ignore
18
- var propValue = props[propName];
19
- if (propValue !== undefined && (typeof propValue !== 'object' || React.isValidElement(propValue))) {
20
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
- newProps[propName] = { children: propValue };
22
- }
23
- }
24
- }
25
- return newProps;
26
- };
27
- //# sourceMappingURL=resolveShorthandProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveShorthandProps.js","sourceRoot":"../src/","sources":["compose/resolveShorthandProps.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAU,KAAa,EAAE,kBAA4B;IACxF,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,EAAE;QACnD,QAAQ,gBACH,KAAK,CACT,CAAC;QACF,KAAuB,UAAkB,EAAlB,yCAAkB,EAAlB,gCAAkB,EAAlB,IAAkB,EAAE;YAAtC,IAAM,QAAQ,2BAAA;YACjB,2EAA2E;YAC3E,6DAA6D;YAC7D,aAAa;YACb,IAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;YAElC,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,OAAO,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE;gBACjG,8DAA8D;gBAC7D,QAAgB,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;aACvD;SACF;KACF;IAED,OAAO,QAAkB,CAAC;AAC5B,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * Ensures that the given slots are represented using object syntax. This ensures that\n * the object can be merged along with other objects.\n * @param props - The incoming props\n * @param shorthandPropNames - An array of prop names to apply simplification to\n */\nexport const resolveShorthandProps = <TProps,>(props: TProps, shorthandPropNames: string[]) => {\n let newProps = props;\n\n if (shorthandPropNames && shorthandPropNames.length) {\n newProps = {\n ...props,\n };\n for (const propName of shorthandPropNames) {\n // TODO find clean way of guaranteeing only shorthand props are typechecked\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const propValue = props[propName];\n\n if (propValue !== undefined && (typeof propValue !== 'object' || React.isValidElement(propValue))) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (newProps as any)[propName] = { children: propValue };\n }\n }\n }\n\n return newProps as TProps;\n};\n"]}
@@ -1,20 +0,0 @@
1
- /**
2
- * Given the state and an array of slot names, will break out `slots` and `slotProps`
3
- * collections.
4
- *
5
- * The root is always derived from the `as` prop.
6
- *
7
- * Slots will render as null if they are rendered as primitives with undefined children.
8
- *
9
- * The slotProps will always omit the `as` prop within them, and for slots that are string
10
- * primitives, the props will be filtered according the the slot type. For example, if the
11
- * slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
12
- *
13
- * @param state - State including slot definitions
14
- * @param slotNames - Name of which props are slots
15
- * @returns An object containing the `slots` map and `slotProps` map.
16
- */
17
- export declare const getSlots: (state: Record<string, any>, slotNames?: string[] | undefined) => {
18
- slots: Record<string, any>;
19
- slotProps: Record<string, any>;
20
- };
@@ -1,51 +0,0 @@
1
- define(["require", "exports", "react", "../utils/index", "./nullRender"], function (require, exports, React, index_1, nullRender_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * Given the state and an array of slot names, will break out `slots` and `slotProps`
6
- * collections.
7
- *
8
- * The root is always derived from the `as` prop.
9
- *
10
- * Slots will render as null if they are rendered as primitives with undefined children.
11
- *
12
- * The slotProps will always omit the `as` prop within them, and for slots that are string
13
- * primitives, the props will be filtered according the the slot type. For example, if the
14
- * slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.
15
- *
16
- * @param state - State including slot definitions
17
- * @param slotNames - Name of which props are slots
18
- * @returns An object containing the `slots` map and `slotProps` map.
19
- */
20
- exports.getSlots = function (state, slotNames) {
21
- var slots = {
22
- root: state.as || 'div',
23
- };
24
- var slotProps = {
25
- root: typeof slots.root === 'string' ? index_1.getNativeElementProps(slots.root, state) : index_1.omit(state, ['as']),
26
- };
27
- if (slotNames) {
28
- for (var _i = 0, slotNames_1 = slotNames; _i < slotNames_1.length; _i++) {
29
- var name_1 = slotNames_1[_i];
30
- var slotDefinition = state[name_1] || {};
31
- var _a = slotDefinition.as, slotAs = _a === void 0 ? 'span' : _a, children = slotDefinition.children;
32
- var isSlotPrimitive = typeof slotAs === 'string';
33
- var isSlotEmpty = isSlotPrimitive && slotDefinition.children === undefined;
34
- slots[name_1] = isSlotEmpty ? nullRender_1.nullRender : slotAs;
35
- if (typeof children === 'function') {
36
- slotProps[name_1] = {
37
- children: children(slots[name_1], index_1.omit(slotDefinition, ['as', 'children'])),
38
- };
39
- slots[name_1] = React.Fragment;
40
- }
41
- else if (slots[name_1] !== nullRender_1.nullRender) {
42
- slotProps[name_1] = isSlotPrimitive
43
- ? index_1.getNativeElementProps(slotAs, slotDefinition)
44
- : index_1.omit(slotDefinition, ['as']);
45
- }
46
- }
47
- }
48
- return { slots: slots, slotProps: slotProps };
49
- };
50
- });
51
- //# sourceMappingURL=getSlots.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getSlots.js","sourceRoot":"../src/","sources":["compose/getSlots.ts"],"names":[],"mappings":";;;IAMA;;;;;;;;;;;;;;;OAeG;IACU,QAAA,QAAQ,GAAG,UAAC,KAAwB,EAAE,SAAgC;QACjF,IAAM,KAAK,GAAsB;YAC/B,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,KAAK;SACxB,CAAC;QAEF,IAAM,SAAS,GAAsB;YACnC,IAAI,EAAE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,6BAAqB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,YAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC;SACtG,CAAC;QAEF,IAAI,SAAS,EAAE;YACb,KAAmB,UAAS,EAAT,uBAAS,EAAT,uBAAS,EAAT,IAAS,EAAE;gBAAzB,IAAM,MAAI,kBAAA;gBACb,IAAM,cAAc,GAAG,KAAK,CAAC,MAAI,CAAC,IAAI,EAAE,CAAC;gBACjC,IAAA,sBAAmB,EAAnB,oCAAmB,EAAE,kCAAQ,CAAoB;gBACzD,IAAM,eAAe,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC;gBACnD,IAAM,WAAW,GAAG,eAAe,IAAI,cAAc,CAAC,QAAQ,KAAK,SAAS,CAAC;gBAE7E,KAAK,CAAC,MAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,uBAAU,CAAC,CAAC,CAAC,MAAM,CAAC;gBAEhD,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;oBAClC,SAAS,CAAC,MAAI,CAAC,GAAG;wBAChB,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAI,CAAC,EAAE,YAAI,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;qBAC1E,CAAC;oBACF,KAAK,CAAC,MAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;iBAC9B;qBAAM,IAAI,KAAK,CAAC,MAAI,CAAC,KAAK,uBAAU,EAAE;oBACrC,SAAS,CAAC,MAAI,CAAC,GAAG,eAAe;wBAC/B,CAAC,CAAC,6BAAqB,CAAC,MAAM,EAAE,cAAc,CAAC;wBAC/C,CAAC,CAAC,YAAI,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;iBAClC;aACF;SACF;QAED,OAAO,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC;IAC9B,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { getNativeElementProps, omit } from '../utils/index';\nimport { GenericDictionary } from './types';\nimport { nullRender } from './nullRender';\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is always derived from the `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according the the slot type. For example, if the\n * slot is rendered `as: 'a'`, the props will be filtered for acceptable anchor props.\n *\n * @param state - State including slot definitions\n * @param slotNames - Name of which props are slots\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport const getSlots = (state: GenericDictionary, slotNames?: string[] | undefined) => {\n const slots: GenericDictionary = {\n root: state.as || 'div',\n };\n\n const slotProps: GenericDictionary = {\n root: typeof slots.root === 'string' ? getNativeElementProps(slots.root, state) : omit(state, ['as']),\n };\n\n if (slotNames) {\n for (const name of slotNames) {\n const slotDefinition = state[name] || {};\n const { as: slotAs = 'span', children } = slotDefinition;\n const isSlotPrimitive = typeof slotAs === 'string';\n const isSlotEmpty = isSlotPrimitive && slotDefinition.children === undefined;\n\n slots[name] = isSlotEmpty ? nullRender : slotAs;\n\n if (typeof children === 'function') {\n slotProps[name] = {\n children: children(slots[name], omit(slotDefinition, ['as', 'children'])),\n };\n slots[name] = React.Fragment;\n } else if (slots[name] !== nullRender) {\n slotProps[name] = isSlotPrimitive\n ? getNativeElementProps(slotAs, slotDefinition)\n : omit(slotDefinition, ['as']);\n }\n }\n }\n\n return { slots, slotProps };\n};\n"]}
@@ -1,5 +0,0 @@
1
- export * from './getSlots';
2
- export * from './makeMergeProps';
3
- export * from './nullRender';
4
- export * from './resolveShorthandProps';
5
- export * from './types';
@@ -1,9 +0,0 @@
1
- define(["require", "exports", "tslib", "./getSlots", "./makeMergeProps", "./nullRender", "./resolveShorthandProps"], function (require, exports, tslib_1, getSlots_1, makeMergeProps_1, nullRender_1, resolveShorthandProps_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(getSlots_1, exports);
5
- tslib_1.__exportStar(makeMergeProps_1, exports);
6
- tslib_1.__exportStar(nullRender_1, exports);
7
- tslib_1.__exportStar(resolveShorthandProps_1, exports);
8
- });
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["compose/index.ts"],"names":[],"mappings":";;;IAAA,0CAA2B;IAC3B,gDAAiC;IACjC,4CAA6B;IAC7B,uDAAwC","sourcesContent":["export * from './getSlots';\nexport * from './makeMergeProps';\nexport * from './nullRender';\nexport * from './resolveShorthandProps';\nexport * from './types';\n"]}
@@ -1,15 +0,0 @@
1
- export declare type MergePropsOptions = {
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?: string[];
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 = Record<string, any>>(options?: MergePropsOptions) => (target: Record<string, any>, ...propSets: (Record<string, any> | undefined)[]) => TState;
@@ -1,98 +0,0 @@
1
- define(["require", "exports", "tslib", "react"], function (require, exports, tslib_1, React) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * Concatination helper, which can merge class names together. Skips over falsey values.
6
- *
7
- * @public
8
- */
9
- function css() {
10
- var args = [];
11
- for (var _i = 0; _i < arguments.length; _i++) {
12
- args[_i] = arguments[_i];
13
- }
14
- var classes = [];
15
- for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
16
- var arg = args_1[_a];
17
- if (arg) {
18
- if (typeof arg === 'string') {
19
- classes.push(arg);
20
- }
21
- else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {
22
- classes.push(arg.toString());
23
- }
24
- else {
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- for (var key in arg) {
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
- if (arg[key]) {
29
- classes.push(key);
30
- }
31
- }
32
- }
33
- }
34
- }
35
- return classes.join(' ');
36
- }
37
- /**
38
- * Helper which deep clones props, but respectively assigns JSX, object refs, and class names
39
- * appropriately.
40
- *
41
- * @param target - the target object to merge onto.
42
- * @param propSets - one or more prop sets to deep merge onto the target.
43
- */
44
- exports.makeMergeProps = function (options) {
45
- if (options === void 0) { options = {}; }
46
- var deepMerge = tslib_1.__spreadArrays((options.deepMerge || []), ['style']);
47
- var mergeProps = function (target) {
48
- var propSets = [];
49
- for (var _i = 1; _i < arguments.length; _i++) {
50
- propSets[_i - 1] = arguments[_i];
51
- }
52
- for (var _a = 0, propSets_1 = propSets; _a < propSets_1.length; _a++) {
53
- var props = propSets_1[_a];
54
- if (props) {
55
- for (var _b = 0, _c = Object.keys(props); _b < _c.length; _b++) {
56
- var propName = _c[_b];
57
- var propValue = props[propName];
58
- var propValueType = typeof propValue;
59
- if (propValue !== undefined) {
60
- if (propValue && propValueType === 'object') {
61
- if (Array.isArray(propValue)) {
62
- // for arrays, replace.
63
- target[propName] = propValue;
64
- }
65
- else {
66
- target[propName] = target[propName] || {};
67
- if (typeof target[propName] !== 'object' ||
68
- React.isValidElement(propValue) ||
69
- (propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current')) ||
70
- deepMerge.indexOf(propName) === -1) {
71
- // if target is not an object, or value is JSX, or a ref object, replace
72
- target[propName] = propValue;
73
- }
74
- else {
75
- // else deep merge.
76
- mergeProps(target[propName], propValue);
77
- }
78
- }
79
- }
80
- else if (propName === 'className') {
81
- if (propValue) {
82
- // for classnames, append
83
- target[propName] = css(target[propName], propValue);
84
- }
85
- }
86
- else {
87
- target[propName] = propValue;
88
- }
89
- }
90
- }
91
- }
92
- }
93
- return target;
94
- };
95
- return mergeProps;
96
- };
97
- });
98
- //# sourceMappingURL=makeMergeProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"makeMergeProps.js","sourceRoot":"../src/","sources":["compose/makeMergeProps.ts"],"names":[],"mappings":";;;IAiCA;;;;OAIG;IACH,SAAS,GAAG;QAAC,cAAmB;aAAnB,UAA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;QAC1B,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { GenericDictionary } from './types';\n\n// TODO\n// css() function is temporary there, ax() should be used instead, but it's not possible now due possible\n// circular dependencies\n\n/**\n * Dictionary of booleans.\n *\n * @internal\n */\ninterface Dictionary {\n [className: string]: boolean;\n}\n\n/**\n * Serializable object.\n *\n * @internal\n */\ninterface SerializableObject {\n toString?: () => string;\n}\n\n/**\n * css input type.\n *\n * @internal\n */\ntype CssInput = string | SerializableObject | Dictionary | null | undefined | boolean;\n\n/**\n * Concatination helper, which can merge class names together. Skips over falsey values.\n *\n * @public\n */\nfunction css(...args: CssInput[]): string {\n const classes = [];\n\n for (const arg of args) {\n if (arg) {\n if (typeof arg === 'string') {\n classes.push(arg);\n } else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') {\n classes.push(arg.toString());\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const key in arg as any) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((arg as any)[key]) {\n classes.push(key);\n }\n }\n }\n }\n }\n\n return classes.join(' ');\n}\n\nexport type MergePropsOptions = {\n /**\n * A list of props to deep merge. By default, `style` will\n * always be deep merged so it's not required to be provided.\n */\n deepMerge?: string[];\n};\n\n/**\n * Helper which deep clones props, but respectively assigns JSX, object refs, and class names\n * appropriately.\n *\n * @param target - the target object to merge onto.\n * @param propSets - one or more prop sets to deep merge onto the target.\n */\nexport const makeMergeProps = <TState = GenericDictionary>(options: MergePropsOptions = {}) => {\n const deepMerge = [...(options.deepMerge || []), 'style'];\n\n const mergeProps = (target: GenericDictionary, ...propSets: (GenericDictionary | undefined)[]): TState => {\n for (const props of propSets) {\n if (props) {\n for (const propName of Object.keys(props)) {\n const propValue = props[propName];\n const propValueType = typeof propValue;\n\n if (propValue !== undefined) {\n if (propValue && propValueType === 'object') {\n if (Array.isArray(propValue)) {\n // for arrays, replace.\n target[propName] = propValue;\n } else {\n target[propName] = target[propName] || {};\n\n if (\n typeof target[propName] !== 'object' ||\n React.isValidElement(propValue) ||\n (propValue && typeof propValue === 'object' && propValue.hasOwnProperty('current')) ||\n deepMerge.indexOf(propName) === -1\n ) {\n // if target is not an object, or value is JSX, or a ref object, replace\n target[propName] = propValue;\n } else {\n // else deep merge.\n mergeProps(target[propName], propValue);\n }\n }\n } else if (propName === 'className') {\n if (propValue) {\n // for classnames, append\n target[propName] = css(target[propName], propValue);\n }\n } else {\n target[propName] = propValue;\n }\n }\n }\n }\n }\n return target as TState;\n };\n\n return mergeProps;\n};\n"]}
@@ -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,9 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * Simple constant function for returning null, used to render empty templates in JSX.
6
- */
7
- exports.nullRender = function () { return null; };
8
- });
9
- //# sourceMappingURL=nullRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nullRender.js","sourceRoot":"../src/","sources":["compose/nullRender.tsx"],"names":[],"mappings":";;;IAAA;;OAEG;IACU,QAAA,UAAU,GAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC","sourcesContent":["/**\n * Simple constant function for returning null, used to render empty templates in JSX.\n */\nexport const nullRender = () => null;\n"]}