@fluentui/react-utilities 9.7.1 → 9.7.2

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 (216) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +34 -1
  3. package/CHANGELOG.md +14 -2
  4. package/dist/index.d.ts +15 -3
  5. package/lib/compose/getSlots.js +3 -3
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.js.map +1 -1
  8. package/lib/compose/isResolvedShorthand.js.map +1 -1
  9. package/lib/compose/resolveShorthand.js.map +1 -1
  10. package/lib/compose/types.js +1 -1
  11. package/lib/compose/types.js.map +1 -1
  12. package/lib/events/index.js.map +1 -1
  13. package/lib/events/mouseTouchHelpers.js +1 -0
  14. package/lib/events/mouseTouchHelpers.js.map +1 -1
  15. package/lib/hooks/index.js.map +1 -1
  16. package/lib/hooks/useControllableState.js.map +1 -1
  17. package/lib/hooks/useEventCallback.js.map +1 -1
  18. package/lib/hooks/useFirstMount.js.map +1 -1
  19. package/lib/hooks/useForceUpdate.js.map +1 -1
  20. package/lib/hooks/useId.js.map +1 -1
  21. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -2
  22. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  23. package/lib/hooks/useMergedRefs.js.map +1 -1
  24. package/lib/hooks/useOnClickOutside.js +16 -9
  25. package/lib/hooks/useOnClickOutside.js.map +1 -1
  26. package/lib/hooks/useOnScrollOutside.js +3 -1
  27. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  28. package/lib/hooks/usePrevious.js.map +1 -1
  29. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  30. package/lib/hooks/useTimeout.js.map +1 -1
  31. package/lib/index.js.map +1 -1
  32. package/lib/ssr/SSRContext.js +2 -2
  33. package/lib/ssr/SSRContext.js.map +1 -1
  34. package/lib/ssr/canUseDOM.js +1 -2
  35. package/lib/ssr/canUseDOM.js.map +1 -1
  36. package/lib/ssr/index.js.map +1 -1
  37. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  38. package/lib/trigger/getTriggerChild.js.map +1 -1
  39. package/lib/trigger/index.js.map +1 -1
  40. package/lib/trigger/isFluentTrigger.js +1 -0
  41. package/lib/trigger/isFluentTrigger.js.map +1 -1
  42. package/lib/trigger/types.js +1 -1
  43. package/lib/trigger/types.js.map +1 -1
  44. package/lib/utils/clamp.js +1 -2
  45. package/lib/utils/clamp.js.map +1 -1
  46. package/lib/utils/getNativeElementProps.js +2 -2
  47. package/lib/utils/getNativeElementProps.js.map +1 -1
  48. package/lib/utils/getRTLSafeKey.js +1 -2
  49. package/lib/utils/getRTLSafeKey.js.map +1 -1
  50. package/lib/utils/getReactCallbackName.js +1 -0
  51. package/lib/utils/getReactCallbackName.js.map +1 -1
  52. package/lib/utils/index.js.map +1 -1
  53. package/lib/utils/isHTMLElement.js +12 -7
  54. package/lib/utils/isHTMLElement.js.map +1 -1
  55. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  56. package/lib/utils/mergeCallbacks.js +1 -2
  57. package/lib/utils/mergeCallbacks.js.map +1 -1
  58. package/lib/utils/omit.js +1 -2
  59. package/lib/utils/omit.js.map +1 -1
  60. package/lib/utils/properties.js +24 -51
  61. package/lib/utils/properties.js.map +1 -1
  62. package/lib-commonjs/compose/getSlots.js +48 -55
  63. package/lib-commonjs/compose/getSlots.js.map +1 -1
  64. package/lib-commonjs/compose/index.js +8 -7
  65. package/lib-commonjs/compose/index.js.map +1 -1
  66. package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
  67. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  68. package/lib-commonjs/compose/resolveShorthand.js +25 -32
  69. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  70. package/lib-commonjs/compose/types.js +5 -2
  71. package/lib-commonjs/compose/types.js.map +1 -1
  72. package/lib-commonjs/events/index.js +5 -4
  73. package/lib-commonjs/events/index.js.map +1 -1
  74. package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
  75. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  76. package/lib-commonjs/hooks/index.js +16 -15
  77. package/lib-commonjs/hooks/index.js.map +1 -1
  78. package/lib-commonjs/hooks/useControllableState.js +63 -64
  79. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  80. package/lib-commonjs/hooks/useEventCallback.js +25 -31
  81. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  82. package/lib-commonjs/hooks/useFirstMount.js +15 -23
  83. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  84. package/lib-commonjs/hooks/useForceUpdate.js +9 -11
  85. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  86. package/lib-commonjs/hooks/useId.js +47 -46
  87. package/lib-commonjs/hooks/useId.js.map +1 -1
  88. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
  89. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  90. package/lib-commonjs/hooks/useMergedRefs.js +25 -27
  91. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  92. package/lib-commonjs/hooks/useOnClickOutside.js +118 -114
  93. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  94. package/lib-commonjs/hooks/useOnScrollOutside.js +35 -36
  95. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  96. package/lib-commonjs/hooks/usePrevious.js +17 -15
  97. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  98. package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
  99. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  100. package/lib-commonjs/hooks/useTimeout.js +30 -30
  101. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  102. package/lib-commonjs/index.js +52 -214
  103. package/lib-commonjs/index.js.map +1 -1
  104. package/lib-commonjs/ssr/SSRContext.js +57 -59
  105. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  106. package/lib-commonjs/ssr/canUseDOM.js +12 -12
  107. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  108. package/lib-commonjs/ssr/index.js +6 -5
  109. package/lib-commonjs/ssr/index.js.map +1 -1
  110. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
  111. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  112. package/lib-commonjs/trigger/getTriggerChild.js +16 -36
  113. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  114. package/lib-commonjs/trigger/index.js +8 -7
  115. package/lib-commonjs/trigger/index.js.map +1 -1
  116. package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
  117. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  118. package/lib-commonjs/trigger/types.js +5 -2
  119. package/lib-commonjs/trigger/types.js.map +1 -1
  120. package/lib-commonjs/utils/clamp.js +10 -9
  121. package/lib-commonjs/utils/clamp.js.map +1 -1
  122. package/lib-commonjs/utils/getNativeElementProps.js +54 -61
  123. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  124. package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
  125. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  126. package/lib-commonjs/utils/getReactCallbackName.js +24 -24
  127. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  128. package/lib-commonjs/utils/index.js +12 -11
  129. package/lib-commonjs/utils/index.js.map +1 -1
  130. package/lib-commonjs/utils/isHTMLElement.js +22 -15
  131. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  132. package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
  133. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  134. package/lib-commonjs/utils/mergeCallbacks.js +14 -13
  135. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  136. package/lib-commonjs/utils/omit.js +18 -17
  137. package/lib-commonjs/utils/omit.js.map +1 -1
  138. package/lib-commonjs/utils/properties.js +327 -223
  139. package/lib-commonjs/utils/properties.js.map +1 -1
  140. package/package.json +5 -4
  141. package/lib-amd/compose/getSlots.js +0 -58
  142. package/lib-amd/compose/getSlots.js.map +0 -1
  143. package/lib-amd/compose/index.js +0 -9
  144. package/lib-amd/compose/index.js.map +0 -1
  145. package/lib-amd/compose/isResolvedShorthand.js +0 -40
  146. package/lib-amd/compose/isResolvedShorthand.js.map +0 -1
  147. package/lib-amd/compose/resolveShorthand.js +0 -27
  148. package/lib-amd/compose/resolveShorthand.js.map +0 -1
  149. package/lib-amd/compose/types.js +0 -5
  150. package/lib-amd/compose/types.js.map +0 -1
  151. package/lib-amd/events/index.js +0 -6
  152. package/lib-amd/events/index.js.map +0 -1
  153. package/lib-amd/events/mouseTouchHelpers.js +0 -39
  154. package/lib-amd/events/mouseTouchHelpers.js.map +0 -1
  155. package/lib-amd/hooks/index.js +0 -17
  156. package/lib-amd/hooks/index.js.map +0 -1
  157. package/lib-amd/hooks/useControllableState.js +0 -81
  158. package/lib-amd/hooks/useControllableState.js.map +0 -1
  159. package/lib-amd/hooks/useEventCallback.js +0 -36
  160. package/lib-amd/hooks/useEventCallback.js.map +0 -1
  161. package/lib-amd/hooks/useFirstMount.js +0 -26
  162. package/lib-amd/hooks/useFirstMount.js.map +0 -1
  163. package/lib-amd/hooks/useForceUpdate.js +0 -14
  164. package/lib-amd/hooks/useForceUpdate.js.map +0 -1
  165. package/lib-amd/hooks/useId.js +0 -54
  166. package/lib-amd/hooks/useId.js.map +0 -1
  167. package/lib-amd/hooks/useIsomorphicLayoutEffect.js +0 -17
  168. package/lib-amd/hooks/useIsomorphicLayoutEffect.js.map +0 -1
  169. package/lib-amd/hooks/useMergedRefs.js +0 -34
  170. package/lib-amd/hooks/useMergedRefs.js.map +0 -1
  171. package/lib-amd/hooks/useOnClickOutside.js +0 -114
  172. package/lib-amd/hooks/useOnClickOutside.js.map +0 -1
  173. package/lib-amd/hooks/useOnScrollOutside.js +0 -31
  174. package/lib-amd/hooks/useOnScrollOutside.js.map +0 -1
  175. package/lib-amd/hooks/usePrevious.js +0 -17
  176. package/lib-amd/hooks/usePrevious.js.map +0 -1
  177. package/lib-amd/hooks/useScrollbarWidth.js +0 -32
  178. package/lib-amd/hooks/useScrollbarWidth.js.map +0 -1
  179. package/lib-amd/hooks/useTimeout.js +0 -33
  180. package/lib-amd/hooks/useTimeout.js.map +0 -1
  181. package/lib-amd/index.js +0 -40
  182. package/lib-amd/index.js.map +0 -1
  183. package/lib-amd/ssr/SSRContext.js +0 -69
  184. package/lib-amd/ssr/SSRContext.js.map +0 -1
  185. package/lib-amd/ssr/canUseDOM.js +0 -16
  186. package/lib-amd/ssr/canUseDOM.js.map +0 -1
  187. package/lib-amd/ssr/index.js +0 -7
  188. package/lib-amd/ssr/index.js.map +0 -1
  189. package/lib-amd/trigger/applyTriggerPropsToChildren.js +0 -40
  190. package/lib-amd/trigger/applyTriggerPropsToChildren.js.map +0 -1
  191. package/lib-amd/trigger/getTriggerChild.js +0 -40
  192. package/lib-amd/trigger/getTriggerChild.js.map +0 -1
  193. package/lib-amd/trigger/index.js +0 -9
  194. package/lib-amd/trigger/index.js.map +0 -1
  195. package/lib-amd/trigger/isFluentTrigger.js +0 -15
  196. package/lib-amd/trigger/isFluentTrigger.js.map +0 -1
  197. package/lib-amd/trigger/types.js +0 -5
  198. package/lib-amd/trigger/types.js.map +0 -1
  199. package/lib-amd/utils/clamp.js +0 -16
  200. package/lib-amd/utils/clamp.js.map +0 -1
  201. package/lib-amd/utils/getNativeElementProps.js +0 -64
  202. package/lib-amd/utils/getNativeElementProps.js.map +0 -1
  203. package/lib-amd/utils/getRTLSafeKey.js +0 -24
  204. package/lib-amd/utils/getRTLSafeKey.js.map +0 -1
  205. package/lib-amd/utils/index.js +0 -13
  206. package/lib-amd/utils/index.js.map +0 -1
  207. package/lib-amd/utils/isHTMLElement.js +0 -22
  208. package/lib-amd/utils/isHTMLElement.js.map +0 -1
  209. package/lib-amd/utils/isInteractiveHTMLElement.js +0 -25
  210. package/lib-amd/utils/isInteractiveHTMLElement.js.map +0 -1
  211. package/lib-amd/utils/mergeCallbacks.js +0 -40
  212. package/lib-amd/utils/mergeCallbacks.js.map +0 -1
  213. package/lib-amd/utils/omit.js +0 -31
  214. package/lib-amd/utils/omit.js.map +0 -1
  215. package/lib-amd/utils/properties.js +0 -450
  216. package/lib-amd/utils/properties.js.map +0 -1
@@ -19,15 +19,13 @@ export const baseElementEvents = /*#__PURE__*/toObjectMap(['onAuxClick', 'onCopy
19
19
  *
20
20
  * @public
21
21
  */
22
- export const baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name' // global
23
- ]);
22
+ export const baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name']);
24
23
  /**
25
24
  * An array of microdata attributes that are allowed on every html element type.
26
25
  *
27
26
  * @public
28
27
  */
29
- export const microdataProperties = /*#__PURE__*/toObjectMap(['itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType' // global
30
- ]);
28
+ export const microdataProperties = /*#__PURE__*/toObjectMap(['itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType']);
31
29
  /**
32
30
  * An array of HTML element properties and events.
33
31
  *
@@ -39,88 +37,74 @@ export const htmlElementProperties = /*#__PURE__*/toObjectMap(baseElementPropert
39
37
  *
40
38
  * @public
41
39
  */
42
- export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['form' // button, fieldset, input, label, meter, object, output, select, textarea
43
- ]);
40
+ export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['form']);
44
41
  /**
45
42
  * An array of AUDIO tag properties and events.
46
43
 
47
44
  * @public
48
45
  */
49
- export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width' // canvas, embed, iframe, img, input, object, video
50
- ]);
46
+ export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width']);
51
47
  /**
52
48
  * An array of VIDEO tag properties and events.
53
49
  *
54
50
  * @public
55
51
  */
56
- export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ['poster' // video
57
- ]);
52
+ export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ['poster']);
58
53
  /**
59
54
  * An array of OL tag properties and events.
60
55
  *
61
56
  * @public
62
57
  */
63
- export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['start' // ol
64
- ]);
58
+ export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['start']);
65
59
  /**
66
60
  * An array of LI tag properties and events.
67
61
  *
68
62
  * @public
69
63
  */
70
- export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['value' // button, input, li, option, meter, progress, param
71
- ]);
64
+ export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['value']);
72
65
  /**
73
66
  * An array of A tag properties and events.
74
67
  *
75
68
  * @public
76
69
  */
77
- export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type' // a, button, input, link, menu, object, script, source, style
78
- ]);
70
+ export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type']);
79
71
  /**
80
72
  * An array of TIME tag properties and events.
81
73
  *
82
74
  * @public
83
75
  */
84
- export const timeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['dateTime' // time
85
- ]);
76
+ export const timeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['dateTime']);
86
77
  /**
87
78
  * An array of BUTTON tag properties and events.
88
79
  *
89
80
  * @public
90
81
  */
91
- export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value' // button, input, li, option, meter, progress, param,
92
- ]);
82
+ export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value']);
93
83
  /**
94
84
  * An array of INPUT tag properties and events.
95
85
  *
96
86
  * @public
97
87
  */
98
- export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width' // canvas, embed, iframe, img, input, object, video
99
- ]);
88
+ export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width']);
100
89
  /**
101
90
  * An array of TEXTAREA tag properties and events.
102
91
  *
103
92
  * @public
104
93
  */
105
- export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap' // textarea
106
- ]);
94
+ export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap']);
107
95
  /**
108
96
  * An array of SELECT tag properties and events.
109
97
  *
110
98
  * @public
111
99
  */
112
- export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['form', 'multiple', 'required' // input, select, textarea
113
- ]);
114
-
115
- export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value' // button, input, li, option, meter, progress, param
116
- ]);
100
+ export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['form', 'multiple', 'required']);
101
+ export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value']);
117
102
  /**
118
103
  * An array of TABLE tag properties and events.
119
104
  *
120
105
  * @public
121
106
  */
122
- export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['cellPadding', 'cellSpacing' // table
123
- ]);
107
+ export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['cellPadding', 'cellSpacing']);
124
108
  /**
125
109
  * An array of TR tag properties and events.
126
110
  *
@@ -132,49 +116,39 @@ export const trProperties = htmlElementProperties;
132
116
  *
133
117
  * @public
134
118
  */
135
- export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'rowSpan', 'scope' // th
136
- ]);
119
+ export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'rowSpan', 'scope']);
137
120
  /**
138
121
  * An array of TD tag properties and events.
139
122
  *
140
123
  * @public
141
124
  */
142
- export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope' // th
143
- ]);
144
-
145
- export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
146
- ]);
147
-
148
- export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
149
- ]);
125
+ export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope']);
126
+ export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
127
+ export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
150
128
  /**
151
129
  * An array of FIELDSET tag properties and events.
152
130
  *
153
131
  * @public
154
132
  */
155
- export const fieldsetProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['disabled', 'form' // button, fieldset, input, label, meter, object, output, select, textarea
156
- ]);
133
+ export const fieldsetProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['disabled', 'form']);
157
134
  /**
158
135
  * An array of FORM tag properties and events.
159
136
  *
160
137
  * @public
161
138
  */
162
- export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target' // form
163
- ]);
139
+ export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target']);
164
140
  /**
165
141
  * An array of IFRAME tag properties and events.
166
142
  *
167
143
  * @public
168
144
  */
169
- export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width' // canvas, embed, iframe, img, input, object, video,
170
- ]);
145
+ export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width']);
171
146
  /**
172
147
  * An array of IMAGE tag properties and events.
173
148
  *
174
149
  * @public
175
150
  */
176
- export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width' // canvas, embed, iframe, img, input, object, video
177
- ]);
151
+ export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width']);
178
152
  /**
179
153
  * An array of DIALOG tag properties and events.
180
154
  *
@@ -201,8 +175,7 @@ export const divProperties = htmlElementProperties;
201
175
  * @param allowedPropNames - The array or record of allowed prop names.
202
176
  * @param excludedPropNames
203
177
  * @returns The filtered props
204
- */
205
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
178
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
206
179
  export function getNativeProps(
207
180
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
208
181
  props, allowedPropNames, excludedPropNames) {
@@ -1 +1 @@
1
- {"version":3,"names":["toObjectMap","items","result","item","keys","Array","isArray","Object","key","baseElementEvents","baseElementProperties","microdataProperties","htmlElementProperties","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","timeProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","dialogProperties","divProperties","getNativeProps","props","allowedPropNames","excludedPropNames","isNativeProp","indexOf"],"sources":["../src/packages/react-components/react-utilities/src/utils/properties.ts"],"sourcesContent":["const toObjectMap = (...items: (string[] | Record<string, number>)[]) => {\n const result: Record<string, number> = {};\n\n for (const item of items) {\n const keys = Array.isArray(item) ? item : Object.keys(item);\n\n for (const key of keys) {\n result[key] = 1;\n }\n }\n\n return result;\n};\n\n/**\n * An array of events that are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementEvents = toObjectMap([\n 'onAuxClick',\n 'onCopy',\n 'onCut',\n 'onPaste',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCompositionUpdate',\n 'onFocus',\n 'onFocusCapture',\n 'onBlur',\n 'onBlurCapture',\n 'onChange',\n 'onInput',\n 'onSubmit',\n 'onLoad',\n 'onError',\n 'onKeyDown',\n 'onKeyDownCapture',\n 'onKeyPress',\n 'onKeyUp',\n 'onAbort',\n 'onCanPlay',\n 'onCanPlayThrough',\n 'onDurationChange',\n 'onEmptied',\n 'onEncrypted',\n 'onEnded',\n 'onLoadedData',\n 'onLoadedMetadata',\n 'onLoadStart',\n 'onPause',\n 'onPlay',\n 'onPlaying',\n 'onProgress',\n 'onRateChange',\n 'onSeeked',\n 'onSeeking',\n 'onStalled',\n 'onSuspend',\n 'onTimeUpdate',\n 'onVolumeChange',\n 'onWaiting',\n 'onClick',\n 'onClickCapture',\n 'onContextMenu',\n 'onDoubleClick',\n 'onDrag',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragExit',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onMouseDown',\n 'onMouseDownCapture',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onMouseUpCapture',\n 'onSelect',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onScroll',\n 'onWheel',\n 'onPointerCancel',\n 'onPointerDown',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerMove',\n 'onPointerOut',\n 'onPointerOver',\n 'onPointerUp',\n 'onGotPointerCapture',\n 'onLostPointerCapture',\n]);\n\n/**\n * An array of element attributes which are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementProperties = toObjectMap([\n 'accessKey', // global\n 'children', // global\n 'className', // global\n 'contentEditable', // global\n 'dir', // global\n 'draggable', // global\n 'hidden', // global\n 'htmlFor', // global\n 'id', // global\n 'lang', // global\n 'ref', // global\n 'role', // global\n 'style', // global\n 'tabIndex', // global\n 'title', // global\n 'translate', // global\n 'spellCheck', // global\n 'name', // global\n]);\n\n/**\n * An array of microdata attributes that are allowed on every html element type.\n *\n * @public\n */\nexport const microdataProperties = toObjectMap([\n 'itemID', // global\n 'itemProp', // global\n 'itemRef', // global\n 'itemScope', // global\n 'itemType', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);\n\n/**\n * An array of LABEL tag properties and events.\n *\n * @public\n */\nexport const labelProperties = toObjectMap(htmlElementProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of AUDIO tag properties and events.\n\n * @public\n */\nexport const audioProperties = toObjectMap(htmlElementProperties, [\n 'height', // canvas, embed, iframe, img, input, object, video\n 'loop', // audio, video\n 'muted', // audio, video\n 'preload', // audio, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of VIDEO tag properties and events.\n *\n * @public\n */\nexport const videoProperties = toObjectMap(audioProperties, [\n 'poster', // video\n]);\n\n/**\n * An array of OL tag properties and events.\n *\n * @public\n */\nexport const olProperties = toObjectMap(htmlElementProperties, [\n 'start', // ol\n]);\n\n/**\n * An array of LI tag properties and events.\n *\n * @public\n */\nexport const liProperties = toObjectMap(htmlElementProperties, [\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of A tag properties and events.\n *\n * @public\n */\nexport const anchorProperties = toObjectMap(htmlElementProperties, [\n 'download', // a, area\n 'href', // a, area, base, link\n 'hrefLang', // a, area, link\n 'media', // a, area, link, source, style\n 'rel', // a, area, link\n 'target', // a, area, base, form\n 'type', // a, button, input, link, menu, object, script, source, style\n]);\n\n/**\n * An array of TIME tag properties and events.\n *\n * @public\n */\nexport const timeProperties = toObjectMap(htmlElementProperties, [\n 'dateTime', // time\n]);\n\n/**\n * An array of BUTTON tag properties and events.\n *\n * @public\n */\nexport const buttonProperties = toObjectMap(htmlElementProperties, [\n 'autoFocus', // button, input, select, textarea\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'formAction', // input, button\n 'formEncType', // input, button\n 'formMethod', // input, button\n 'formNoValidate', // input, button\n 'formTarget', // input, button\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param,\n]);\n\n/**\n * An array of INPUT tag properties and events.\n *\n * @public\n */\nexport const inputProperties = toObjectMap(buttonProperties, [\n 'accept', // input\n 'alt', // area, img, input\n 'autoCapitalize', // input, textarea\n 'autoComplete', // form, input\n 'checked', // input\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'height', // canvas, embed, iframe, img, input, object, video\n 'inputMode', // input\n 'list', // input\n 'max', // input, meter\n 'maxLength', // input, textarea\n 'min', // input, meter\n 'multiple', // input, select\n 'pattern', // input\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'step', // input\n 'size', // input\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of TEXTAREA tag properties and events.\n *\n * @public\n */\nexport const textAreaProperties = toObjectMap(buttonProperties, [\n 'autoCapitalize', // input, textarea\n 'cols', // textarea\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'maxLength', // input, textarea\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'rows', // textarea\n 'wrap', // textarea\n]);\n\n/**\n * An array of SELECT tag properties and events.\n *\n * @public\n */\nexport const selectProperties = toObjectMap(buttonProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'multiple', // input, select\n 'required', // input, select, textarea\n]);\n\nexport const optionProperties = toObjectMap(htmlElementProperties, [\n 'selected', // option\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of TABLE tag properties and events.\n *\n * @public\n */\nexport const tableProperties = toObjectMap(htmlElementProperties, [\n 'cellPadding', // table\n 'cellSpacing', // table\n]);\n\n/**\n * An array of TR tag properties and events.\n *\n * @public\n */\nexport const trProperties = htmlElementProperties;\n\n/**\n * An array of TH tag properties and events.\n *\n * @public\n */\nexport const thProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td, th\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\n/**\n * An array of TD tag properties and events.\n *\n * @public\n */\nexport const tdProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td\n 'headers', // td\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\nexport const colGroupProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\nexport const colProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\n/**\n * An array of FIELDSET tag properties and events.\n *\n * @public\n */\nexport const fieldsetProperties = toObjectMap(htmlElementProperties, [\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of FORM tag properties and events.\n *\n * @public\n */\nexport const formProperties = toObjectMap(htmlElementProperties, [\n 'acceptCharset', // form\n 'action', // form\n 'encType', // form\n 'encType', // form\n 'method', // form\n 'noValidate', // form\n 'target', // form\n]);\n\n/**\n * An array of IFRAME tag properties and events.\n *\n * @public\n */\nexport const iframeProperties = toObjectMap(htmlElementProperties, [\n 'allow', // iframe\n 'allowFullScreen', // iframe\n 'allowPaymentRequest', // iframe\n 'allowTransparency', // iframe\n 'csp', // iframe\n 'height', // canvas, embed, iframe, img, input, object, video\n 'importance', // iframe\n 'referrerPolicy', // iframe\n 'sandbox', // iframe\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcDoc', // iframe\n 'width', // canvas, embed, iframe, img, input, object, video,\n]);\n\n/**\n * An array of IMAGE tag properties and events.\n *\n * @public\n */\nexport const imgProperties = toObjectMap(htmlElementProperties, [\n 'alt', // area, img, input\n 'crossOrigin', // img\n 'height', // canvas, embed, iframe, img, input, object, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcSet', // img, source\n 'useMap', // img, object,\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of DIALOG tag properties and events.\n *\n * @public\n */\nexport const dialogProperties = toObjectMap(htmlElementProperties, ['open', 'onCancel', 'onClose']);\n\n/**\n * An array of DIV tag properties and events.\n *\n * @public\n */\nexport const divProperties = htmlElementProperties;\n\n/**\n * Gets native supported props for an html element provided the allowance set. Use one of the property\n * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given\n * props set. Note that all data- and aria- prefixed attributes will be allowed.\n * NOTE: getNativeProps should always be applied first when adding props to a react component. The\n * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.\n * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to\n * the component after an onClick function is added, then the getNativeProps onClick will override it.\n *\n * @public\n * @param props - The unfiltered input props\n * @param allowedPropNames - The array or record of allowed prop names.\n * @param excludedPropNames\n * @returns The filtered props\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeProps<T extends Record<string, any>>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>,\n allowedPropNames: string[] | Record<string, number>,\n excludedPropNames?: string[],\n): T {\n // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for\n // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.\n // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then\n // return native props.\n // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797\n\n const isArray = Array.isArray(allowedPropNames);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n const keys = Object.keys(props);\n\n for (const key of keys) {\n const isNativeProp =\n (!isArray && (allowedPropNames as Record<string, number>)[key]) ||\n (isArray && (allowedPropNames as string[]).indexOf(key) >= 0) ||\n key.indexOf('data-') === 0 ||\n key.indexOf('aria-') === 0;\n\n if (isNativeProp && (!excludedPropNames || excludedPropNames?.indexOf(key) === -1)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result[key] = props![key] as any;\n }\n }\n\n return result as T;\n}\n"],"mappings":"AAAA,MAAMA,WAAW,GAAGA,CAAC,GAAGC,KAA4C,KAAI;EACtE,MAAMC,MAAM,GAA2B,EAAE;EAEzC,KAAK,MAAMC,IAAI,IAAIF,KAAK,EAAE;IACxB,MAAMG,IAAI,GAAGC,KAAK,CAACC,OAAO,CAACH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aAAa,EACb,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,CAAE;AAAA,CACV,CAAC;AAEF;;;;;AAKA,OAAO,MAAMuB,gBAAgB,gBAAGnC,WAAW,CAACY,qBAAqB,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAEnG;;;;;AAKA,OAAO,MAAMwB,aAAa,GAAGxB,qBAAqB;AAElD;;;;;;;;;;;;;;;AAeA;AACA,OAAM,SAAUyB,cAAcA;AAC5B;AACAC,KAA0B,EAC1BC,gBAAmD,EACnDC,iBAA4B;EAE5B;EACA;EACA;EACA;EACA;EAEA,MAAMlC,OAAO,GAAGD,KAAK,CAACC,OAAO,CAACiC,gBAAgB,CAAC;EAC/C;EACA,MAAMrC,MAAM,GAAwB,EAAE;EACtC,MAAME,IAAI,GAAGG,MAAM,CAACH,IAAI,CAACkC,KAAK,CAAC;EAE/B,KAAK,MAAM9B,GAAG,IAAIJ,IAAI,EAAE;IACtB,MAAMqC,YAAY,GACf,CAACnC,OAAO,IAAKiC,gBAA2C,CAAC/B,GAAG,CAAC,IAC7DF,OAAO,IAAKiC,gBAA6B,CAACG,OAAO,CAAClC,GAAG,CAAC,IAAI,CAAE,IAC7DA,GAAG,CAACkC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAC1BlC,GAAG,CAACkC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;IAE5B,IAAID,YAAY,KAAK,CAACD,iBAAiB,IAAI,CAAAA,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAAEE,OAAO,CAAClC,GAAG,CAAC,MAAK,CAAC,CAAC,CAAC,EAAE;MAClF;MACAN,MAAM,CAACM,GAAG,CAAC,GAAG8B,KAAM,CAAC9B,GAAG,CAAQ;;;EAIpC,OAAON,MAAW;AACpB"}
1
+ {"version":3,"names":["toObjectMap","items","result","item","keys","Array","isArray","Object","key","baseElementEvents","baseElementProperties","microdataProperties","htmlElementProperties","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","timeProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","dialogProperties","divProperties","getNativeProps","props","allowedPropNames","excludedPropNames","isNativeProp","indexOf"],"sources":["../../src/utils/properties.ts"],"sourcesContent":["const toObjectMap = (...items: (string[] | Record<string, number>)[]) => {\n const result: Record<string, number> = {};\n\n for (const item of items) {\n const keys = Array.isArray(item) ? item : Object.keys(item);\n\n for (const key of keys) {\n result[key] = 1;\n }\n }\n\n return result;\n};\n\n/**\n * An array of events that are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementEvents = toObjectMap([\n 'onAuxClick',\n 'onCopy',\n 'onCut',\n 'onPaste',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCompositionUpdate',\n 'onFocus',\n 'onFocusCapture',\n 'onBlur',\n 'onBlurCapture',\n 'onChange',\n 'onInput',\n 'onSubmit',\n 'onLoad',\n 'onError',\n 'onKeyDown',\n 'onKeyDownCapture',\n 'onKeyPress',\n 'onKeyUp',\n 'onAbort',\n 'onCanPlay',\n 'onCanPlayThrough',\n 'onDurationChange',\n 'onEmptied',\n 'onEncrypted',\n 'onEnded',\n 'onLoadedData',\n 'onLoadedMetadata',\n 'onLoadStart',\n 'onPause',\n 'onPlay',\n 'onPlaying',\n 'onProgress',\n 'onRateChange',\n 'onSeeked',\n 'onSeeking',\n 'onStalled',\n 'onSuspend',\n 'onTimeUpdate',\n 'onVolumeChange',\n 'onWaiting',\n 'onClick',\n 'onClickCapture',\n 'onContextMenu',\n 'onDoubleClick',\n 'onDrag',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragExit',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onMouseDown',\n 'onMouseDownCapture',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onMouseUpCapture',\n 'onSelect',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onScroll',\n 'onWheel',\n 'onPointerCancel',\n 'onPointerDown',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerMove',\n 'onPointerOut',\n 'onPointerOver',\n 'onPointerUp',\n 'onGotPointerCapture',\n 'onLostPointerCapture',\n]);\n\n/**\n * An array of element attributes which are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementProperties = toObjectMap([\n 'accessKey', // global\n 'children', // global\n 'className', // global\n 'contentEditable', // global\n 'dir', // global\n 'draggable', // global\n 'hidden', // global\n 'htmlFor', // global\n 'id', // global\n 'lang', // global\n 'ref', // global\n 'role', // global\n 'style', // global\n 'tabIndex', // global\n 'title', // global\n 'translate', // global\n 'spellCheck', // global\n 'name', // global\n]);\n\n/**\n * An array of microdata attributes that are allowed on every html element type.\n *\n * @public\n */\nexport const microdataProperties = toObjectMap([\n 'itemID', // global\n 'itemProp', // global\n 'itemRef', // global\n 'itemScope', // global\n 'itemType', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);\n\n/**\n * An array of LABEL tag properties and events.\n *\n * @public\n */\nexport const labelProperties = toObjectMap(htmlElementProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of AUDIO tag properties and events.\n\n * @public\n */\nexport const audioProperties = toObjectMap(htmlElementProperties, [\n 'height', // canvas, embed, iframe, img, input, object, video\n 'loop', // audio, video\n 'muted', // audio, video\n 'preload', // audio, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of VIDEO tag properties and events.\n *\n * @public\n */\nexport const videoProperties = toObjectMap(audioProperties, [\n 'poster', // video\n]);\n\n/**\n * An array of OL tag properties and events.\n *\n * @public\n */\nexport const olProperties = toObjectMap(htmlElementProperties, [\n 'start', // ol\n]);\n\n/**\n * An array of LI tag properties and events.\n *\n * @public\n */\nexport const liProperties = toObjectMap(htmlElementProperties, [\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of A tag properties and events.\n *\n * @public\n */\nexport const anchorProperties = toObjectMap(htmlElementProperties, [\n 'download', // a, area\n 'href', // a, area, base, link\n 'hrefLang', // a, area, link\n 'media', // a, area, link, source, style\n 'rel', // a, area, link\n 'target', // a, area, base, form\n 'type', // a, button, input, link, menu, object, script, source, style\n]);\n\n/**\n * An array of TIME tag properties and events.\n *\n * @public\n */\nexport const timeProperties = toObjectMap(htmlElementProperties, [\n 'dateTime', // time\n]);\n\n/**\n * An array of BUTTON tag properties and events.\n *\n * @public\n */\nexport const buttonProperties = toObjectMap(htmlElementProperties, [\n 'autoFocus', // button, input, select, textarea\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'formAction', // input, button\n 'formEncType', // input, button\n 'formMethod', // input, button\n 'formNoValidate', // input, button\n 'formTarget', // input, button\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param,\n]);\n\n/**\n * An array of INPUT tag properties and events.\n *\n * @public\n */\nexport const inputProperties = toObjectMap(buttonProperties, [\n 'accept', // input\n 'alt', // area, img, input\n 'autoCapitalize', // input, textarea\n 'autoComplete', // form, input\n 'checked', // input\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'height', // canvas, embed, iframe, img, input, object, video\n 'inputMode', // input\n 'list', // input\n 'max', // input, meter\n 'maxLength', // input, textarea\n 'min', // input, meter\n 'multiple', // input, select\n 'pattern', // input\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'step', // input\n 'size', // input\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of TEXTAREA tag properties and events.\n *\n * @public\n */\nexport const textAreaProperties = toObjectMap(buttonProperties, [\n 'autoCapitalize', // input, textarea\n 'cols', // textarea\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'maxLength', // input, textarea\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'rows', // textarea\n 'wrap', // textarea\n]);\n\n/**\n * An array of SELECT tag properties and events.\n *\n * @public\n */\nexport const selectProperties = toObjectMap(buttonProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'multiple', // input, select\n 'required', // input, select, textarea\n]);\n\nexport const optionProperties = toObjectMap(htmlElementProperties, [\n 'selected', // option\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of TABLE tag properties and events.\n *\n * @public\n */\nexport const tableProperties = toObjectMap(htmlElementProperties, [\n 'cellPadding', // table\n 'cellSpacing', // table\n]);\n\n/**\n * An array of TR tag properties and events.\n *\n * @public\n */\nexport const trProperties = htmlElementProperties;\n\n/**\n * An array of TH tag properties and events.\n *\n * @public\n */\nexport const thProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td, th\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\n/**\n * An array of TD tag properties and events.\n *\n * @public\n */\nexport const tdProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td\n 'headers', // td\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\nexport const colGroupProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\nexport const colProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\n/**\n * An array of FIELDSET tag properties and events.\n *\n * @public\n */\nexport const fieldsetProperties = toObjectMap(htmlElementProperties, [\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of FORM tag properties and events.\n *\n * @public\n */\nexport const formProperties = toObjectMap(htmlElementProperties, [\n 'acceptCharset', // form\n 'action', // form\n 'encType', // form\n 'encType', // form\n 'method', // form\n 'noValidate', // form\n 'target', // form\n]);\n\n/**\n * An array of IFRAME tag properties and events.\n *\n * @public\n */\nexport const iframeProperties = toObjectMap(htmlElementProperties, [\n 'allow', // iframe\n 'allowFullScreen', // iframe\n 'allowPaymentRequest', // iframe\n 'allowTransparency', // iframe\n 'csp', // iframe\n 'height', // canvas, embed, iframe, img, input, object, video\n 'importance', // iframe\n 'referrerPolicy', // iframe\n 'sandbox', // iframe\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcDoc', // iframe\n 'width', // canvas, embed, iframe, img, input, object, video,\n]);\n\n/**\n * An array of IMAGE tag properties and events.\n *\n * @public\n */\nexport const imgProperties = toObjectMap(htmlElementProperties, [\n 'alt', // area, img, input\n 'crossOrigin', // img\n 'height', // canvas, embed, iframe, img, input, object, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcSet', // img, source\n 'useMap', // img, object,\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of DIALOG tag properties and events.\n *\n * @public\n */\nexport const dialogProperties = toObjectMap(htmlElementProperties, ['open', 'onCancel', 'onClose']);\n\n/**\n * An array of DIV tag properties and events.\n *\n * @public\n */\nexport const divProperties = htmlElementProperties;\n\n/**\n * Gets native supported props for an html element provided the allowance set. Use one of the property\n * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given\n * props set. Note that all data- and aria- prefixed attributes will be allowed.\n * NOTE: getNativeProps should always be applied first when adding props to a react component. The\n * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.\n * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to\n * the component after an onClick function is added, then the getNativeProps onClick will override it.\n *\n * @public\n * @param props - The unfiltered input props\n * @param allowedPropNames - The array or record of allowed prop names.\n * @param excludedPropNames\n * @returns The filtered props\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeProps<T extends Record<string, any>>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>,\n allowedPropNames: string[] | Record<string, number>,\n excludedPropNames?: string[],\n): T {\n // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for\n // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.\n // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then\n // return native props.\n // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797\n\n const isArray = Array.isArray(allowedPropNames);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n const keys = Object.keys(props);\n\n for (const key of keys) {\n const isNativeProp =\n (!isArray && (allowedPropNames as Record<string, number>)[key]) ||\n (isArray && (allowedPropNames as string[]).indexOf(key) >= 0) ||\n key.indexOf('data-') === 0 ||\n key.indexOf('aria-') === 0;\n\n if (isNativeProp && (!excludedPropNames || excludedPropNames?.indexOf(key) === -1)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result[key] = props![key] as any;\n }\n }\n\n return result as T;\n}\n"],"mappings":"AAAA,MAAMA,WAAA,GAAcA,CAAC,GAAGC,KAAA,KAAiD;EACvE,MAAMC,MAAA,GAAiC,CAAC;EAExC,KAAK,MAAMC,IAAA,IAAQF,KAAA,EAAO;IACxB,MAAMG,IAAA,GAAOC,KAAA,CAAMC,OAAO,CAACH,IAAA,IAAQA,IAAA,GAAOI,MAAA,CAAOH,IAAI,CAACD,IAAA,CAAK;IAE3D,KAAK,MAAMK,GAAA,IAAOJ,IAAA,EAAM;MACtBF,MAAM,CAACM,GAAA,CAAI,GAAG;IAChB;EACF;EAEA,OAAON,MAAA;AACT;AAEA;;;;;AAKA,OAAO,MAAMO,iBAAA,gBAAoBT,WAAA,CAAY,CAC3C,cACA,UACA,SACA,WACA,oBACA,sBACA,uBACA,WACA,kBACA,UACA,iBACA,YACA,WACA,YACA,UACA,WACA,aACA,oBACA,cACA,WACA,WACA,aACA,oBACA,oBACA,aACA,eACA,WACA,gBACA,oBACA,eACA,WACA,UACA,aACA,cACA,gBACA,YACA,aACA,aACA,aACA,gBACA,kBACA,aACA,WACA,kBACA,iBACA,iBACA,UACA,aACA,eACA,cACA,eACA,cACA,eACA,UACA,eACA,sBACA,gBACA,gBACA,eACA,cACA,eACA,aACA,oBACA,YACA,iBACA,cACA,eACA,gBACA,YACA,WACA,mBACA,iBACA,kBACA,kBACA,iBACA,gBACA,iBACA,eACA,uBACA,uBACD;AAED;;;;;AAKA,OAAO,MAAMU,qBAAA,gBAAwBV,WAAA,CAAY,CAC/C,aACA,YACA,aACA,mBACA,OACA,aACA,UACA,WACA,MACA,QACA,OACA,QACA,SACA,YACA,SACA,aACA,cACA,OACD;AAED;;;;;AAKA,OAAO,MAAMW,mBAAA,gBAAsBX,WAAA,CAAY,CAC7C,UACA,YACA,WACA,aACA,WACD;AAED;;;;;AAKA,OAAO,MAAMY,qBAAA,gBAAwBZ,WAAA,CAAYU,qBAAA,EAAuBD,iBAAA,EAAmBE,mBAAA;AAE3F;;;;;AAKA,OAAO,MAAME,eAAA,gBAAkBb,WAAA,CAAYY,qBAAA,EAAuB,CAChE,OACD;AAED;;;;;AAKA,OAAO,MAAME,eAAA,gBAAkBd,WAAA,CAAYY,qBAAA,EAAuB,CAChE,UACA,QACA,SACA,WACA,OACA,QACD;AAED;;;;;AAKA,OAAO,MAAMG,eAAA,gBAAkBf,WAAA,CAAYc,eAAA,EAAiB,CAC1D,SACD;AAED;;;;;AAKA,OAAO,MAAME,YAAA,gBAAehB,WAAA,CAAYY,qBAAA,EAAuB,CAC7D,QACD;AAED;;;;;AAKA,OAAO,MAAMK,YAAA,gBAAejB,WAAA,CAAYY,qBAAA,EAAuB,CAC7D,QACD;AAED;;;;;AAKA,OAAO,MAAMM,gBAAA,gBAAmBlB,WAAA,CAAYY,q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YAAA,KAAiB,CAACD,iBAAA,IAAqB,CAAAA,iBAAA,aAAAA,iBAAA,uBAAAA,iBAAA,CAAmBE,OAAO,CAAClC,GAAA,OAAS,CAAC,IAAI;MAClF;MACAN,MAAM,CAACM,GAAA,CAAI,GAAG8B,KAAM,CAAC9B,GAAA,CAAI;IAC3B;EACF;EAEA,OAAON,MAAA;AACT"}
@@ -1,62 +1,55 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getSlots", {
6
+ enumerable: true,
7
+ get: ()=>getSlots
5
8
  });
6
- exports.getSlots = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const omit_1 = /*#__PURE__*/require("../utils/omit");
9
- /**
10
- * Given the state and an array of slot names, will break out `slots` and `slotProps`
11
- * collections.
12
- *
13
- * The root is derived from a mix of `components` props and `as` prop.
14
- *
15
- * Slots will render as null if they are rendered as primitives with undefined children.
16
- *
17
- * The slotProps will always omit the `as` prop within them, and for slots that are string
18
- * primitives, the props will be filtered according to the slot type by the type system.
19
- * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable
20
- * anchor props. Note that this is only enforced at build time by Typescript -- there is no
21
- * runtime code filtering props in this function.
22
- *
23
- * @param state - State including slot definitions
24
- * @returns An object containing the `slots` map and `slotProps` map.
25
- */
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _omit = require("../utils/omit");
26
12
  function getSlots(state) {
27
- const slots = {};
28
- const slotProps = {};
29
- const slotNames = Object.keys(state.components);
30
- for (const slotName of slotNames) {
31
- const [slot, props] = getSlot(state, slotName);
32
- slots[slotName] = slot;
33
- slotProps[slotName] = props;
34
- }
35
- return {
36
- slots,
37
- slotProps: slotProps
38
- };
13
+ const slots = {};
14
+ const slotProps = {};
15
+ const slotNames = Object.keys(state.components);
16
+ for (const slotName of slotNames){
17
+ const [slot, props] = getSlot(state, slotName);
18
+ slots[slotName] = slot;
19
+ slotProps[slotName] = props;
20
+ }
21
+ return {
22
+ slots,
23
+ slotProps: slotProps
24
+ };
39
25
  }
40
- exports.getSlots = getSlots;
41
26
  function getSlot(state, slotName) {
42
- var _a, _b, _c;
43
- if (state[slotName] === undefined) {
44
- return [null, undefined];
45
- }
46
- const {
47
- children,
48
- as: asProp,
49
- ...rest
50
- } = state[slotName];
51
- const slot = ((_a = state.components) === null || _a === void 0 ? void 0 : _a[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_b = state.components) === null || _b === void 0 ? void 0 : _b[slotName]) || 'div' : state.components[slotName];
52
- if (typeof children === 'function') {
53
- const render = children;
54
- return [React.Fragment, {
55
- children: render(slot, rest)
56
- }];
57
- }
58
- const shouldOmitAsProp = typeof slot === 'string' && ((_c = state[slotName]) === null || _c === void 0 ? void 0 : _c.as);
59
- const slotProps = shouldOmitAsProp ? omit_1.omit(state[slotName], ['as']) : state[slotName];
60
- return [slot, slotProps];
61
- }
27
+ var _state_components, _state_components1, _state_slotName;
28
+ if (state[slotName] === undefined) {
29
+ return [
30
+ null,
31
+ undefined
32
+ ];
33
+ }
34
+ const { children , as: asProp , ...rest } = state[slotName];
35
+ const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
36
+ if (typeof children === 'function') {
37
+ const render = children;
38
+ return [
39
+ _react.Fragment,
40
+ {
41
+ children: render(slot, rest)
42
+ }
43
+ ];
44
+ }
45
+ const shouldOmitAsProp = typeof slot === 'string' && ((_state_slotName = state[slotName]) === null || _state_slotName === void 0 ? void 0 : _state_slotName.as);
46
+ const slotProps = shouldOmitAsProp ? (0, _omit.omit)(state[slotName], [
47
+ 'as'
48
+ ]) : state[slotName];
49
+ return [
50
+ slot,
51
+ slotProps
52
+ ];
53
+ } //# sourceMappingURL=getSlots.js.map
54
+
62
55
  //# sourceMappingURL=getSlots.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","omit_1","getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","exports","undefined","children","as","asProp","rest","_a","_b","render","Fragment","shouldOmitAsProp","_c","omit"],"sources":["../src/packages/react-components/react-utilities/src/compose/getSlots.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { omit } from '../utils/omit';\nimport type {\n AsIntrinsicElement,\n ComponentState,\n ExtractSlotProps,\n SlotPropsRecord,\n SlotRenderFunction,\n UnionToIntersection,\n} from './types';\n\nexport type Slots<S extends SlotPropsRecord> = {\n [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // for slots with an `as` prop, the slot will be any one of the possible values of `as`\n As\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? React.ElementType<NonNullable<P>>\n : React.ElementType<ExtractSlotProps<S[K]>>;\n};\n\ntype ObjectSlotProps<S extends SlotPropsRecord> = {\n [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // For intrinsic element types, return the intersection of all possible\n // element's props, to be compatible with the As type returned by Slots<>\n UnionToIntersection<JSX.IntrinsicElements[As]> // Slot<'div', 'span'>\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? P // Slot<typeof Button>\n : ExtractSlotProps<S[K]>; // Slot<ButtonProps>\n};\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 derived from a mix of `components` props and `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 to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n if (state[slotName] === undefined) {\n return [null, undefined as R[K]];\n }\n const { children, as: asProp, ...rest } = state[slotName]!;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n if (typeof children === 'function') {\n const render = children as SlotRenderFunction<R[K]>;\n return [\n React.Fragment,\n {\n children: render(slot, rest as Omit<R[K], 'children' | 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && state[slotName]?.as;\n const slotProps = (shouldOmitAsProp ? omit(state[slotName]!, ['as']) : state[slotName]) as R[K];\n\n return [slot, slotProps];\n}\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AAEA,MAAAC,MAAA,gBAAAD,OAAA;AA6BA;;;;;;;;;;;;;;;;;AAiBA,SAAgBE,QAAQA,CACtBC,KAAwB;EAKxB,MAAMC,KAAK,GAAG,EAAc;EAC5B,MAAMC,SAAS,GAAG,EAAO;EAEzB,MAAMC,SAAS,GAAgBC,MAAM,CAACC,IAAI,CAACL,KAAK,CAACM,UAAU,CAAC;EAC5D,KAAK,MAAMC,QAAQ,IAAIJ,SAAS,EAAE;IAChC,M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AAER,EAAE;EACxE,MAAMZ,SAAS,GAAImB,gBAAgB,GAAGvB,MAAA,CAAAyB,IAAI,CAACvB,KAAK,CAACO,QAAQ,CAAE,EAAE,CAAC,IAAI,CAAC,CAAC,GAAGP,KAAK,CAACO,QAAQ,CAAU;EAE/F,OAAO,CAACC,IAAI,EAAEN,SAAS,CAAC;AAC1B"}
1
+ {"version":3,"sources":["../../lib/compose/getSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../utils/omit';\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `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 to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlot(state, slotName) {\n var _state_components, _state_components1, _state_slotName;\n if (state[slotName] === undefined) {\n return [null, undefined];\n }\n const {\n children,\n as: asProp,\n ...rest\n } = state[slotName];\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n if (typeof children === 'function') {\n const render = children;\n return [React.Fragment, {\n children: render(slot, rest)\n }];\n }\n const shouldOmitAsProp = typeof slot === 'string' && ((_state_slotName = state[slotName]) === null || _state_slotName === void 0 ? void 0 : _state_slotName.as);\n const slotProps = shouldOmitAsProp ? omit(state[slotName], ['as']) : state[slotName];\n return [slot, slotProps];\n}\n//# sourceMappingURL=getSlots.js.map"],"names":["getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","_state_slotName","undefined","children","as","asProp","rest","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAmBgBA;;aAAAA;;;6DAnBO;sBACF;AAkBd,SAASA,SAASC,KAAK,EAAE;IAC9B,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QACLR;QACAC,WAAWA;IACb;AACF;AACA,SAASQ,QAAQV,KAAK,EAAEO,QAAQ,EAAE;IAChC,IAAII,mBAAmBC,oBAAoBC;IAC3C,IAAIb,KAAK,CAACO,SAAS,KAAKO,WAAW;QACjC,OAAO;YAAC,IAAI;YAAEA;SAAU;IAC1B,CAAC;IACD,MAAM,EACJC,SAAQ,EACRC,IAAIC,OAAM,EACV,GAAGC,MACJ,GAAGlB,KAAK,CAACO,SAAS;IACnB,MAAMC,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOO,aAAa,OAAOd,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWU,UAAW,CAAA,AAACL,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,IAAI,OAAOQ,aAAa,YAAY;QAClC,MAAMI,SAASJ;QACf,OAAO;YAACK,OAAMC,QAAQ;YAAE;gBACtBN,UAAUI,OAAOX,MAAMU;YACzB;SAAE;IACJ,CAAC;IACD,MAAMI,mBAAmB,OAAOd,SAAS,YAAa,CAAA,AAACK,CAAAA,kBAAkBb,KAAK,CAACO,SAAS,AAAD,MAAO,IAAI,IAAIM,oBAAoB,KAAK,IAAI,KAAK,IAAIA,gBAAgBG,EAAE,AAAD;IAC7J,MAAMd,YAAYoB,mBAAmBC,IAAAA,UAAI,EAACvB,KAAK,CAACO,SAAS,EAAE;QAAC;KAAK,IAAIP,KAAK,CAACO,SAAS;IACpF,OAAO;QAACC;QAAMN;KAAU;AAC1B,EACA,oCAAoC"}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./getSlots"), exports);
8
- tslib_1.__exportStar(require("./resolveShorthand"), exports);
9
- tslib_1.__exportStar(require("./types"), exports);
10
- tslib_1.__exportStar(require("./isResolvedShorthand"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./getSlots"), exports);
7
+ _exportStar(require("./resolveShorthand"), exports);
8
+ _exportStar(require("./types"), exports);
9
+ _exportStar(require("./isResolvedShorthand"), exports);
10
+ //# sourceMappingURL=index.js.map
11
+
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-utilities/src/compose/index.ts"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,gBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,wBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,aAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,2BAAAC,OAAA"}
1
+ {"version":3,"sources":["../../lib/compose/index.js"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;CACd,iCAAiC"}
@@ -1,42 +1,14 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "isResolvedShorthand", {
6
+ enumerable: true,
7
+ get: ()=>isResolvedShorthand
5
8
  });
6
- exports.isResolvedShorthand = void 0;
7
- const react_1 = /*#__PURE__*/require("react");
8
- /**
9
- * Guard method that validates if a shorthand is a slot
10
- * can be used to extends properties provided by a slot
11
- *
12
- * @example
13
- * ```
14
- * const backdropSlot = resolveShorthand(backdrop, {
15
- * defaultProps: {
16
- * onClick: useEventCallback(event => {
17
- * if (isResolvedShorthand(backdrop)) {
18
- * backdrop.onClick?.(event)
19
- * }
20
- * // do something after passing click down the line
21
- * }),
22
- * },
23
- * })
24
- * ```
25
- * @example
26
- * ```
27
- * const handleBackDropClick = (event) => {
28
- * // do your thing
29
- * }
30
- * const backdropSlot = resolveShorthand(backdrop, {
31
- * defaultProps: {
32
- * onClick: useEventCallback(
33
- * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)
34
- * )
35
- * })
36
- * ```
37
- */
9
+ const _react = require("react");
38
10
  function isResolvedShorthand(shorthand) {
39
- return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !react_1.isValidElement(shorthand);
40
- }
41
- exports.isResolvedShorthand = isResolvedShorthand;
11
+ return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !/*#__PURE__*/ (0, _react.isValidElement)(shorthand);
12
+ } //# sourceMappingURL=isResolvedShorthand.js.map
13
+
42
14
  //# sourceMappingURL=isResolvedShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["react_1","require","isResolvedShorthand","shorthand","Array","isArray","isValidElement","exports"],"sources":["../src/packages/react-components/react-utilities/src/compose/isResolvedShorthand.ts"],"sourcesContent":["import { isValidElement } from 'react';\nimport type { ExtractSlotProps, Slot, UnknownSlotProps } from './types';\n\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */\nexport function isResolvedShorthand<Shorthand extends Slot<UnknownSlotProps>>(\n shorthand?: Shorthand,\n): shorthand is ExtractSlotProps<Shorthand> {\n return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !isValidElement(shorthand);\n}\n"],"mappings":";;;;;;AAAA,MAAAA,OAAA,gBAAAC,OAAA;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgBC,mBAAmBA,CACjCC,SAAqB;EAErB,OAAOA,SAAS,KAAK,IAAI,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,SAAS,CAAC,IAAI,CAACH,OAAA,CAAAM,cAAc,CAACH,SAAS,CAAC;AACvH;AAJAI,OAAA,CAAAL,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"sources":["../../lib/compose/isResolvedShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */\nexport function isResolvedShorthand(shorthand) {\n return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && ! /*#__PURE__*/isValidElement(shorthand);\n}\n//# sourceMappingURL=isResolvedShorthand.js.map"],"names":["isResolvedShorthand","shorthand","Array","isArray","isValidElement"],"mappings":";;;;+BA+BgBA;;aAAAA;;uBA/Be;AA+BxB,SAASA,oBAAoBC,SAAS,EAAE;IAC7C,OAAOA,cAAc,IAAI,IAAI,OAAOA,cAAc,YAAY,CAACC,MAAMC,OAAO,CAACF,cAAc,CAAE,WAAW,GAAEG,IAAAA,qBAAc,EAACH;AAC3H,EACA,+CAA+C"}
@@ -1,36 +1,29 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "resolveShorthand", {
6
+ enumerable: true,
7
+ get: ()=>resolveShorthand
5
8
  });
6
- exports.resolveShorthand = void 0;
7
- const react_1 = /*#__PURE__*/require("react");
8
- /**
9
- * Resolves shorthands into slot props, to ensure normalization of the signature
10
- * being passed down to getSlots method
11
- * @param value - the base shorthand props
12
- * @param options - options to resolve shorthand props
13
- */
14
- const resolveShorthand = (value, options) => {
15
- const {
16
- required = false,
17
- defaultProps
18
- } = options || {};
19
- if (value === null || value === undefined && !required) {
20
- return undefined;
21
- }
22
- let resolvedShorthand = {};
23
- if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || react_1.isValidElement(value)) {
24
- resolvedShorthand.children = value;
25
- } else if (typeof value === 'object') {
26
- resolvedShorthand = {
27
- ...value
28
- };
29
- }
30
- return defaultProps ? {
31
- ...defaultProps,
32
- ...resolvedShorthand
33
- } : resolvedShorthand;
34
- };
35
- exports.resolveShorthand = resolveShorthand;
9
+ const _react = require("react");
10
+ const resolveShorthand = (value, options)=>{
11
+ const { required =false , defaultProps } = options || {};
12
+ if (value === null || value === undefined && !required) {
13
+ return undefined;
14
+ }
15
+ let resolvedShorthand = {};
16
+ if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/ (0, _react.isValidElement)(value)) {
17
+ resolvedShorthand.children = value;
18
+ } else if (typeof value === 'object') {
19
+ resolvedShorthand = {
20
+ ...value
21
+ };
22
+ }
23
+ return defaultProps ? {
24
+ ...defaultProps,
25
+ ...resolvedShorthand
26
+ } : resolvedShorthand;
27
+ }; //# sourceMappingURL=resolveShorthand.js.map
28
+
36
29
  //# sourceMappingURL=resolveShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["react_1","require","resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","isValidElement","children","exports"],"sources":["../src/packages/react-components/react-utilities/src/compose/resolveShorthand.ts"],"sourcesContent":["import { isValidElement } from 'react';\nimport type { SlotShorthandValue, UnknownSlotProps } from './types';\n\nexport type ResolveShorthandOptions<Props, Required extends boolean = false> = Required extends true\n ? { required: true; defaultProps?: Props }\n : { required?: Required; defaultProps?: Props };\n\nexport type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {\n <P extends Props>(value: P | SlotShorthandValue | undefined, options: ResolveShorthandOptions<P, true>): P;\n <P extends Props>(value: P | SlotShorthandValue | null | undefined, options?: ResolveShorthandOptions<P, boolean>):\n | P\n | undefined;\n};\n\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand: ResolveShorthandFunction = (value, options) => {\n const { required = false, defaultProps } = options || {};\n if (value === null || (value === undefined && !required)) {\n return undefined;\n }\n\n let resolvedShorthand = {} as UnknownSlotProps;\n\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = { ...value };\n }\n\n return defaultProps ? { ...defaultProps, ...resolvedShorthand } : resolvedShorthand;\n};\n"],"mappings":";;;;;;AAAA,MAAAA,OAAA,gBAAAC,OAAA;AAcA;;;;;;AAMO,MAAMC,gBAAgB,GAA6BA,CAACC,KAAK,EAAEC,OAAO,KAAI;EAC3E,MAAM;IAAEC,QAAQ,GAAG,KAAK;IAAEC;EAAY,CAAE,GAAGF,OAAO,IAAI,EAAE;EACxD,IAAID,KAAK,KAAK,IAAI,IAAKA,KAAK,KAAKI,SAAS,IAAI,CAACF,QAAS,EAAE;IACxD,OAAOE,SAAS;;EAGlB,IAAIC,iBAAiB,GAAG,EAAsB;EAE9C,IAAI,OAAOL,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIM,KAAK,CAACC,OAAO,CAACP,KAAK,CAAC,IAAIH,OAAA,CAAAW,cAAc,CAACR,KAAK,CAAC,EAAE;IAC3GK,iBAAiB,CAACI,QAAQ,GAAGT,KAAK;GACnC,MAAM,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACpCK,iBAAiB,GAAG;MAAE,GAAGL;IAAK,CAAE;;EAGlC,OAAOG,YAAY,GAAG;IAAE,GAAGA,YAAY;IAAE,GAAGE;EAAiB,CAAE,GAAGA,iBAAiB;AACrF,CAAC;AAfYK,OAAA,CAAAX,gBAAgB,GAAAA,gBAAA"}
1
+ {"version":3,"sources":["../../lib/compose/resolveShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand = (value, options) => {\n const {\n required = false,\n defaultProps\n } = options || {};\n if (value === null || value === undefined && !required) {\n return undefined;\n }\n let resolvedShorthand = {};\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = {\n ...value\n };\n }\n return defaultProps ? {\n ...defaultProps,\n ...resolvedShorthand\n } : resolvedShorthand;\n};\n//# sourceMappingURL=resolveShorthand.js.map"],"names":["resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","isValidElement","children"],"mappings":";;;;+BAOaA;;aAAAA;;uBAPkB;AAOxB,MAAMA,mBAAmB,CAACC,OAAOC,UAAY;IAClD,MAAM,EACJC,UAAW,KAAK,CAAA,EAChBC,aAAY,EACb,GAAGF,WAAW,CAAC;IAChB,IAAID,UAAU,IAAI,IAAIA,UAAUI,aAAa,CAACF,UAAU;QACtD,OAAOE;IACT,CAAC;IACD,IAAIC,oBAAoB,CAAC;IACzB,IAAI,OAAOL,UAAU,YAAY,OAAOA,UAAU,YAAYM,MAAMC,OAAO,CAACP,UAAU,WAAW,GAAEQ,IAAAA,qBAAc,EAACR,QAAQ;QACxHK,kBAAkBI,QAAQ,GAAGT;IAC/B,OAAO,IAAI,OAAOA,UAAU,UAAU;QACpCK,oBAAoB;YAClB,GAAGL,KAAK;QACV;IACF,CAAC;IACD,OAAOG,eAAe;QACpB,GAAGA,YAAY;QACf,GAAGE,iBAAiB;IACtB,IAAIA,iBAAiB;AACvB,GACA,4CAA4C"}