@react-spectrum/s2 0.10.0 → 0.11.0

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 (296) hide show
  1. package/dist/Accordion.cjs +2 -2
  2. package/dist/Accordion.css +2 -2
  3. package/dist/Accordion.mjs +2 -2
  4. package/dist/ActionBar.cjs +62 -62
  5. package/dist/ActionBar.css +61 -61
  6. package/dist/ActionBar.mjs +62 -62
  7. package/dist/ActionButton.cjs +202 -202
  8. package/dist/ActionButton.css +138 -138
  9. package/dist/ActionButton.mjs +202 -202
  10. package/dist/ActionButtonGroup.cjs +15 -15
  11. package/dist/ActionButtonGroup.css +9 -9
  12. package/dist/ActionButtonGroup.mjs +15 -15
  13. package/dist/Add.cjs +10 -10
  14. package/dist/Add.css +6 -6
  15. package/dist/Add.mjs +10 -10
  16. package/dist/AlertDialog.cjs +3 -3
  17. package/dist/AlertDialog.css +3 -3
  18. package/dist/AlertDialog.mjs +3 -3
  19. package/dist/Asterisk.cjs +6 -6
  20. package/dist/Asterisk.css +4 -4
  21. package/dist/Asterisk.mjs +6 -6
  22. package/dist/Avatar.cjs +14 -14
  23. package/dist/Avatar.css +14 -14
  24. package/dist/Avatar.mjs +14 -14
  25. package/dist/AvatarGroup.cjs +134 -134
  26. package/dist/AvatarGroup.css +33 -33
  27. package/dist/AvatarGroup.mjs +134 -134
  28. package/dist/Badge.cjs +206 -206
  29. package/dist/Badge.css +127 -127
  30. package/dist/Badge.mjs +206 -206
  31. package/dist/Breadcrumbs.cjs +254 -254
  32. package/dist/Breadcrumbs.css +109 -109
  33. package/dist/Breadcrumbs.mjs +254 -254
  34. package/dist/Button.cjs +341 -341
  35. package/dist/Button.css +177 -177
  36. package/dist/Button.mjs +341 -341
  37. package/dist/ButtonGroup.cjs +20 -20
  38. package/dist/ButtonGroup.css +15 -15
  39. package/dist/ButtonGroup.mjs +20 -20
  40. package/dist/Calendar.cjs +151 -139
  41. package/dist/Calendar.cjs.map +1 -1
  42. package/dist/Calendar.css +134 -134
  43. package/dist/Calendar.css.map +1 -1
  44. package/dist/Calendar.mjs +153 -141
  45. package/dist/Calendar.mjs.map +1 -1
  46. package/dist/Card.cjs +304 -304
  47. package/dist/Card.css +209 -209
  48. package/dist/Card.mjs +304 -304
  49. package/dist/CardView.cjs +16 -16
  50. package/dist/CardView.css +16 -16
  51. package/dist/CardView.mjs +16 -16
  52. package/dist/CenterBaseline.cjs +1 -1
  53. package/dist/CenterBaseline.css +2 -2
  54. package/dist/CenterBaseline.mjs +1 -1
  55. package/dist/Checkbox.cjs +170 -170
  56. package/dist/Checkbox.css +92 -92
  57. package/dist/Checkbox.mjs +170 -170
  58. package/dist/CheckboxGroup.cjs +45 -45
  59. package/dist/CheckboxGroup.css +38 -38
  60. package/dist/CheckboxGroup.mjs +45 -45
  61. package/dist/Checkmark.cjs +12 -12
  62. package/dist/Checkmark.css +8 -8
  63. package/dist/Checkmark.mjs +12 -12
  64. package/dist/Chevron.cjs +12 -12
  65. package/dist/Chevron.css +10 -10
  66. package/dist/Chevron.mjs +12 -12
  67. package/dist/ClearButton.cjs +29 -29
  68. package/dist/ClearButton.css +29 -29
  69. package/dist/ClearButton.mjs +29 -29
  70. package/dist/CloseButton.cjs +54 -54
  71. package/dist/CloseButton.css +46 -46
  72. package/dist/CloseButton.mjs +54 -54
  73. package/dist/ColorArea.cjs +16 -16
  74. package/dist/ColorArea.css +16 -16
  75. package/dist/ColorArea.mjs +16 -16
  76. package/dist/ColorField.cjs +32 -32
  77. package/dist/ColorField.css +28 -28
  78. package/dist/ColorField.mjs +32 -32
  79. package/dist/ColorHandle.cjs +27 -27
  80. package/dist/ColorHandle.css +42 -42
  81. package/dist/ColorHandle.mjs +27 -27
  82. package/dist/ColorSlider.cjs +118 -118
  83. package/dist/ColorSlider.css +54 -54
  84. package/dist/ColorSlider.mjs +118 -118
  85. package/dist/ColorSwatch.cjs +29 -29
  86. package/dist/ColorSwatch.css +29 -29
  87. package/dist/ColorSwatch.mjs +29 -29
  88. package/dist/ColorSwatchPicker.cjs +27 -27
  89. package/dist/ColorSwatchPicker.css +46 -46
  90. package/dist/ColorSwatchPicker.mjs +27 -27
  91. package/dist/ColorWheel.cjs +26 -26
  92. package/dist/ColorWheel.css +17 -17
  93. package/dist/ColorWheel.mjs +26 -26
  94. package/dist/ComboBox.cjs +415 -400
  95. package/dist/ComboBox.cjs.map +1 -1
  96. package/dist/ComboBox.css +181 -181
  97. package/dist/ComboBox.css.map +1 -1
  98. package/dist/ComboBox.mjs +415 -400
  99. package/dist/ComboBox.mjs.map +1 -1
  100. package/dist/ContextualHelp.cjs +5 -5
  101. package/dist/ContextualHelp.css +60 -60
  102. package/dist/ContextualHelp.mjs +5 -5
  103. package/dist/Cross.cjs +14 -14
  104. package/dist/Cross.css +10 -10
  105. package/dist/Cross.mjs +14 -14
  106. package/dist/CustomDialog.cjs +25 -25
  107. package/dist/CustomDialog.css +25 -25
  108. package/dist/CustomDialog.mjs +25 -25
  109. package/dist/Dash.cjs +10 -10
  110. package/dist/Dash.css +6 -6
  111. package/dist/Dash.mjs +10 -10
  112. package/dist/DateField.cjs +73 -73
  113. package/dist/DateField.css +77 -77
  114. package/dist/DateField.mjs +73 -73
  115. package/dist/DatePicker.cjs +182 -185
  116. package/dist/DatePicker.cjs.map +1 -1
  117. package/dist/DatePicker.css +126 -126
  118. package/dist/DatePicker.css.map +1 -1
  119. package/dist/DatePicker.mjs +182 -185
  120. package/dist/DatePicker.mjs.map +1 -1
  121. package/dist/DateRangePicker.cjs +58 -61
  122. package/dist/DateRangePicker.cjs.map +1 -1
  123. package/dist/DateRangePicker.css +60 -60
  124. package/dist/DateRangePicker.css.map +1 -1
  125. package/dist/DateRangePicker.mjs +58 -61
  126. package/dist/DateRangePicker.mjs.map +1 -1
  127. package/dist/Dialog.cjs +17 -17
  128. package/dist/Dialog.css +82 -82
  129. package/dist/Dialog.mjs +17 -17
  130. package/dist/Disclosure.cjs +135 -135
  131. package/dist/Disclosure.css +106 -106
  132. package/dist/Disclosure.mjs +135 -135
  133. package/dist/Divider.cjs +25 -25
  134. package/dist/Divider.css +25 -25
  135. package/dist/Divider.mjs +25 -25
  136. package/dist/DropZone.cjs +62 -62
  137. package/dist/DropZone.css +58 -58
  138. package/dist/DropZone.mjs +62 -62
  139. package/dist/Field.cjs +370 -370
  140. package/dist/Field.cjs.map +1 -1
  141. package/dist/Field.css +142 -142
  142. package/dist/Field.mjs +370 -370
  143. package/dist/Field.mjs.map +1 -1
  144. package/dist/Form.cjs +9 -9
  145. package/dist/Form.css +9 -9
  146. package/dist/Form.mjs +9 -9
  147. package/dist/FullscreenDialog.cjs +5 -5
  148. package/dist/FullscreenDialog.css +91 -91
  149. package/dist/FullscreenDialog.mjs +5 -5
  150. package/dist/IllustratedMessage.cjs +256 -256
  151. package/dist/IllustratedMessage.css +78 -78
  152. package/dist/IllustratedMessage.mjs +256 -256
  153. package/dist/Image.cjs +13 -13
  154. package/dist/Image.css +14 -14
  155. package/dist/Image.mjs +13 -13
  156. package/dist/InlineAlert.cjs +117 -117
  157. package/dist/InlineAlert.css +98 -98
  158. package/dist/InlineAlert.mjs +117 -117
  159. package/dist/Link.cjs +54 -54
  160. package/dist/Link.css +46 -46
  161. package/dist/Link.mjs +54 -54
  162. package/dist/LinkOut.cjs +8 -8
  163. package/dist/LinkOut.css +8 -8
  164. package/dist/LinkOut.mjs +8 -8
  165. package/dist/Menu.cjs +459 -459
  166. package/dist/Menu.css +185 -185
  167. package/dist/Menu.mjs +459 -459
  168. package/dist/Meter.cjs +163 -163
  169. package/dist/Meter.css +93 -93
  170. package/dist/Meter.mjs +163 -163
  171. package/dist/Modal.cjs +58 -58
  172. package/dist/Modal.css +50 -50
  173. package/dist/Modal.mjs +58 -58
  174. package/dist/NotificationBadge.cjs +58 -58
  175. package/dist/NotificationBadge.css +51 -51
  176. package/dist/NotificationBadge.mjs +58 -58
  177. package/dist/NumberField.cjs +115 -115
  178. package/dist/NumberField.css +100 -100
  179. package/dist/NumberField.mjs +115 -115
  180. package/dist/Picker.cjs +283 -283
  181. package/dist/Picker.css +169 -169
  182. package/dist/Picker.mjs +283 -283
  183. package/dist/Popover.cjs +86 -86
  184. package/dist/Popover.css +66 -66
  185. package/dist/Popover.mjs +86 -86
  186. package/dist/ProgressBar.cjs +173 -173
  187. package/dist/ProgressBar.css +101 -101
  188. package/dist/ProgressBar.mjs +173 -173
  189. package/dist/ProgressCircle.cjs +31 -31
  190. package/dist/ProgressCircle.css +24 -24
  191. package/dist/ProgressCircle.mjs +31 -31
  192. package/dist/Provider.cjs +11 -11
  193. package/dist/Provider.css +10 -10
  194. package/dist/Provider.mjs +11 -11
  195. package/dist/Radio.cjs +154 -154
  196. package/dist/Radio.css +79 -79
  197. package/dist/Radio.mjs +154 -154
  198. package/dist/RadioGroup.cjs +42 -42
  199. package/dist/RadioGroup.css +38 -38
  200. package/dist/RadioGroup.mjs +42 -42
  201. package/dist/RangeCalendar.cjs +32 -20
  202. package/dist/RangeCalendar.cjs.map +1 -1
  203. package/dist/RangeCalendar.css +10 -10
  204. package/dist/RangeCalendar.css.map +1 -1
  205. package/dist/RangeCalendar.mjs +34 -22
  206. package/dist/RangeCalendar.mjs.map +1 -1
  207. package/dist/SearchField.cjs +42 -42
  208. package/dist/SearchField.css +46 -46
  209. package/dist/SearchField.mjs +42 -42
  210. package/dist/SegmentedControl.cjs +181 -181
  211. package/dist/SegmentedControl.css +118 -118
  212. package/dist/SegmentedControl.mjs +181 -181
  213. package/dist/SelectBoxGroup.cjs +342 -0
  214. package/dist/SelectBoxGroup.cjs.map +1 -0
  215. package/dist/SelectBoxGroup.css +503 -0
  216. package/dist/SelectBoxGroup.css.map +1 -0
  217. package/dist/SelectBoxGroup.mjs +335 -0
  218. package/dist/SelectBoxGroup.mjs.map +1 -0
  219. package/dist/SkeletonCollection.cjs +6 -1
  220. package/dist/SkeletonCollection.cjs.map +1 -1
  221. package/dist/SkeletonCollection.mjs +7 -2
  222. package/dist/SkeletonCollection.mjs.map +1 -1
  223. package/dist/Slider.cjs +299 -299
  224. package/dist/Slider.css +151 -151
  225. package/dist/Slider.mjs +299 -299
  226. package/dist/StatusLight.cjs +125 -125
  227. package/dist/StatusLight.css +61 -61
  228. package/dist/StatusLight.mjs +125 -125
  229. package/dist/Switch.cjs +162 -162
  230. package/dist/Switch.css +74 -74
  231. package/dist/Switch.mjs +162 -162
  232. package/dist/TableView.cjs +319 -319
  233. package/dist/TableView.css +172 -172
  234. package/dist/TableView.mjs +319 -319
  235. package/dist/Tabs.cjs +213 -188
  236. package/dist/Tabs.cjs.map +1 -1
  237. package/dist/Tabs.css +105 -101
  238. package/dist/Tabs.css.map +1 -1
  239. package/dist/Tabs.mjs +213 -188
  240. package/dist/Tabs.mjs.map +1 -1
  241. package/dist/TabsPicker.cjs +127 -127
  242. package/dist/TabsPicker.css +111 -111
  243. package/dist/TabsPicker.mjs +127 -127
  244. package/dist/TagGroup.cjs +213 -213
  245. package/dist/TagGroup.css +147 -147
  246. package/dist/TagGroup.mjs +213 -213
  247. package/dist/TextField.cjs +59 -59
  248. package/dist/TextField.css +54 -54
  249. package/dist/TextField.mjs +59 -59
  250. package/dist/TimeField.cjs +52 -52
  251. package/dist/TimeField.css +48 -48
  252. package/dist/TimeField.mjs +52 -52
  253. package/dist/Toast.cjs +120 -120
  254. package/dist/Toast.css +107 -107
  255. package/dist/Toast.mjs +120 -120
  256. package/dist/ToggleButton.cjs +3 -3
  257. package/dist/ToggleButton.css +12 -12
  258. package/dist/ToggleButton.mjs +3 -3
  259. package/dist/Tooltip.cjs +83 -83
  260. package/dist/Tooltip.css +70 -70
  261. package/dist/Tooltip.mjs +83 -83
  262. package/dist/TreeView.cjs +146 -146
  263. package/dist/TreeView.css +147 -147
  264. package/dist/TreeView.mjs +146 -146
  265. package/dist/main.cjs +5 -0
  266. package/dist/main.cjs.map +1 -1
  267. package/dist/module.mjs +3 -1
  268. package/dist/module.mjs.map +1 -1
  269. package/dist/types.d.ts +43 -1
  270. package/dist/types.d.ts.map +1 -1
  271. package/icons/Icon.cjs +10 -10
  272. package/icons/Icon.css +9 -9
  273. package/icons/Icon.mjs +10 -10
  274. package/icons/Skeleton.cjs +2 -2
  275. package/icons/Skeleton.cjs.map +1 -1
  276. package/icons/Skeleton.css +6 -6
  277. package/icons/Skeleton.mjs +2 -2
  278. package/icons/Skeleton.mjs.map +1 -1
  279. package/package.json +21 -21
  280. package/src/Calendar.tsx +13 -6
  281. package/src/ComboBox.tsx +20 -5
  282. package/src/DatePicker.tsx +1 -7
  283. package/src/DateRangePicker.tsx +1 -7
  284. package/src/RangeCalendar.tsx +13 -6
  285. package/src/SelectBoxGroup.tsx +408 -0
  286. package/src/SkeletonCollection.tsx +6 -2
  287. package/src/Tabs.tsx +49 -24
  288. package/src/index.ts +2 -0
  289. package/style/__tests__/style-macro.test.js +162 -166
  290. package/style/dist/main.cjs +24 -24
  291. package/style/dist/module.mjs +13 -13
  292. package/style/dist/properties.mjs +3 -3
  293. package/style/dist/spectrum-theme.cjs +219 -219
  294. package/style/dist/spectrum-theme.mjs +210 -210
  295. package/style/dist/style-macro.cjs +80 -80
  296. package/style/dist/style-macro.mjs +75 -75
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUM,SAAS,0CAAoB,WAAoB;IACtD,IAAI,eAAe,CAAA,GAAA,aAAK,EAAoB;IAC5C,IAAI,eAAe,CAAA,GAAA,oBAAY,EAAE;IACjC,OAAO,CAAA,GAAA,kBAAU,EAAE,CAAC;QAClB,IAAI,eAAe,CAAC,aAAa,OAAO,IAAI,WAAW,CAAC,cAAc;YACpE,iEAAiE;YACjE,2EAA2E;YAC3E,aAAa,OAAO,GAAG,QAAQ,OAAO,CACpC;gBACE;oBAAC,oBAAoB;gBAAM;gBAC3B;oBAAC,oBAAoB;gBAAI;aAC1B,EACD;gBACE,UAAU;gBACV,YAAY;gBACZ,QAAQ;YACV;YAEF,aAAa,OAAO,CAAC,SAAS,GAAG;QACn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AAAC,CAAA,SAAS,KAAK,CAAC,SAAS,IAAI,EAAC,IAAK,MAAM;YACpD,6CAA6C;YAC7C,OAAO,CAAA,GAAA,iBAAS,EAAE;QACpB,KAAK;;AAGX;AAGO,SAAS,0CAAgB,MAAmB;IACjD,IAAI,aAAa,CAAA,GAAA,iBAAS,EAAE;IAC5B,IAAI,YACF,OAAO,CAAA,GAAA,yCAAU,sBAA+B;IAElD,OAAO,UAAU;AACnB","sources":["packages/@react-spectrum/s2/src/Skeleton.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {cloneElement, createContext, CSSProperties, ReactElement, ReactNode, Ref, useCallback, useContext, useRef} from 'react';\nimport {color, style} from '../style' with {type: 'macro'};\nimport {inertValue, mergeRefs} from '@react-aria/utils';\nimport {mergeStyles} from '../style/runtime';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {useMediaQuery} from '@react-spectrum/utils';\n\nexport function useLoadingAnimation(isAnimating: boolean): (element: HTMLElement | null) => void {\n let animationRef = useRef<Animation | null>(null);\n let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n return useCallback((element: HTMLElement | null) => {\n if (isAnimating && !animationRef.current && element && !reduceMotion) {\n // Use web animation API instead of CSS animations so that we can\n // synchronize it between all loading elements on the page (via startTime).\n animationRef.current = element.animate(\n [\n {backgroundPosition: '100%'},\n {backgroundPosition: '0%'}\n ],\n {\n duration: 2000,\n iterations: Infinity,\n easing: 'ease-in-out'\n }\n );\n animationRef.current.startTime = 0;\n } else if (!isAnimating && animationRef.current) {\n animationRef.current.cancel();\n animationRef.current = null;\n }\n }, [isAnimating]);\n}\n\nexport type SkeletonElement = ReactElement<{\n children: ReactNode,\n className?: string,\n ref?: Ref<HTMLElement>,\n inert?: boolean | 'true'\n}>;\n\nexport const SkeletonContext = createContext<boolean | null>(null);\nexport function useIsSkeleton(): boolean {\n return useContext(SkeletonContext) || false;\n}\n\nexport interface SkeletonProps {\n children: ReactNode,\n isLoading: boolean\n}\n\n/**\n * A Skeleton wraps around content to render it as a placeholder.\n */\nexport function Skeleton({children, isLoading}: SkeletonProps): ReactNode {\n // Disable all form components inside a skeleton.\n return (\n <SkeletonContext.Provider value={isLoading}>\n {children}\n </SkeletonContext.Provider>\n );\n}\n\nexport const loadingStyle = raw(`\n background-image: linear-gradient(to right, ${color('gray-100')} 33%, light-dark(${color('gray-25')}, ${color('gray-300')}), ${color('gray-100')} 66%);\n background-size: 300%;\n * {\n visibility: hidden;\n }\n`, 'L'); // add to a separate layer so it overrides default style macro styles\n\nexport function useSkeletonText(children: ReactNode, style: CSSProperties | undefined): [ReactNode, CSSProperties | undefined] {\n let isSkeleton = useContext(SkeletonContext);\n if (isSkeleton) {\n children = <SkeletonText>{children}</SkeletonText>;\n style = {\n ...style,\n // This ensures the ellipsis on truncated text is also hidden.\n // -webkit-text-fill-color overrides any `color` property that is also set.\n WebkitTextFillColor: 'transparent'\n };\n }\n return [children, style];\n}\n\n// Rendered inside <Text> to create skeleton line boxes via box-decoration-break.\nexport function SkeletonText({children}: {children: ReactNode}): ReactNode {\n return (\n <span\n // @ts-ignore - compatibility with React < 19\n inert={inertValue(true)}\n ref={useLoadingAnimation(true)}\n className={loadingStyle + style({\n color: 'transparent',\n boxDecorationBreak: 'clone',\n borderRadius: 'sm'\n })}>\n {children}\n </span>\n );\n}\n\n// Clones the child element and displays it with skeleton styling.\nexport function SkeletonWrapper({children}: {children: SkeletonElement}): ReactNode {\n let isLoading = useContext(SkeletonContext);\n let animation = useLoadingAnimation(isLoading || false);\n if (isLoading == null) {\n return children;\n }\n\n let childRef = 'ref' in children && !Object.getOwnPropertyDescriptor(children, 'ref')?.get ? children.ref as any : children.props.ref;\n return (\n <SkeletonContext.Provider value={null}>\n {isLoading ? cloneElement(children, {\n ref: mergeRefs(childRef, animation),\n className: (children.props.className || '') + ' ' + loadingStyle,\n // @ts-ignore - compatibility with React < 19\n inert: inertValue(true)\n }) : children}\n </SkeletonContext.Provider>\n );\n}\n\n// Adds default border radius around icons when displayed in a skeleton.\nexport function useSkeletonIcon(styles: StyleString): StyleString {\n let isSkeleton = useContext(SkeletonContext);\n if (isSkeleton) {\n return mergeStyles(style({borderRadius: 'sm'}), styles);\n }\n return styles || '' as StyleString;\n}\n"],"names":[],"version":3,"file":"Skeleton.mjs.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUM,SAAS,0CAAoB,WAAoB;IACtD,IAAI,eAAe,CAAA,GAAA,aAAK,EAAoB;IAC5C,IAAI,eAAe,CAAA,GAAA,oBAAY,EAAE;IACjC,OAAO,CAAA,GAAA,kBAAU,EAAE,CAAC;QAClB,IAAI,eAAe,CAAC,aAAa,OAAO,IAAI,WAAW,CAAC,cAAc;YACpE,iEAAiE;YACjE,2EAA2E;YAC3E,aAAa,OAAO,GAAG,QAAQ,OAAO,CACpC;gBACE;oBAAC,oBAAoB;gBAAM;gBAC3B;oBAAC,oBAAoB;gBAAI;aAC1B,EACD;gBACE,UAAU;gBACV,YAAY;gBACZ,QAAQ;YACV;YAEF,aAAa,OAAO,CAAC,SAAS,GAAG;QACnC,OAAO,IAAI,CAAC,eAAe,aAAa,OAAO,EAAE;YAC/C,aAAa,OAAO,CAAC,MAAM;YAC3B,aAAa,OAAO,GAAG;QACzB;IACF,GAAG;QAAC;KAAY;AAClB;AASO,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAkB;AACtD,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE,8CAAoB;AACxC;AAUO,SAAS,0CAA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OAAO,UAAU;AACnB","sources":["packages/@react-spectrum/s2/src/Skeleton.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {cloneElement, createContext, CSSProperties, ReactElement, ReactNode, Ref, useCallback, useContext, useRef} from 'react';\nimport {color, style} from '../style' with {type: 'macro'};\nimport {inertValue, mergeRefs} from '@react-aria/utils';\nimport {mergeStyles} from '../style/runtime';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {useMediaQuery} from '@react-spectrum/utils';\n\nexport function useLoadingAnimation(isAnimating: boolean): (element: HTMLElement | null) => void {\n let animationRef = useRef<Animation | null>(null);\n let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n return useCallback((element: HTMLElement | null) => {\n if (isAnimating && !animationRef.current && element && !reduceMotion) {\n // Use web animation API instead of CSS animations so that we can\n // synchronize it between all loading elements on the page (via startTime).\n animationRef.current = element.animate(\n [\n {backgroundPosition: '100%'},\n {backgroundPosition: '0%'}\n ],\n {\n duration: 2000,\n iterations: Infinity,\n easing: 'ease-in-out'\n }\n );\n animationRef.current.startTime = 0;\n } else if (!isAnimating && animationRef.current) {\n animationRef.current.cancel();\n animationRef.current = null;\n }\n }, [isAnimating]);\n}\n\nexport type SkeletonElement = ReactElement<{\n children: ReactNode,\n className?: string,\n ref?: Ref<HTMLElement>,\n inert?: boolean | 'true'\n}>;\n\nexport const SkeletonContext = createContext<boolean | null>(null);\nexport function useIsSkeleton(): boolean {\n return useContext(SkeletonContext) || false;\n}\n\nexport interface SkeletonProps {\n children: ReactNode,\n isLoading: boolean\n}\n\n/**\n * A Skeleton wraps around content to render it as a placeholder.\n */\nexport function Skeleton({children, isLoading}: SkeletonProps): ReactNode {\n // Disable all form components inside a skeleton.\n return (\n <SkeletonContext.Provider value={isLoading}>\n {children}\n </SkeletonContext.Provider>\n );\n}\n\nexport const loadingStyle = raw(`\n background-image: linear-gradient(to right, ${color('gray-100')} 33%, light-dark(${color('gray-25')}, ${color('gray-300')}), ${color('gray-100')} 66%);\n background-size: 300%;\n * {\n visibility: hidden;\n }\n`, 'L'); // add to a separate layer so it overrides default style macro styles\n\nexport function useSkeletonText(children: ReactNode, style: CSSProperties | undefined): [ReactNode, CSSProperties | undefined] {\n let isSkeleton = useContext(SkeletonContext);\n if (isSkeleton) {\n children = <SkeletonText>{children}</SkeletonText>;\n style = {\n ...style,\n // This ensures the ellipsis on truncated text is also hidden.\n // -webkit-text-fill-color overrides any `color` property that is also set.\n WebkitTextFillColor: 'transparent'\n };\n }\n return [children, style];\n}\n\n// Rendered inside <Text> to create skeleton line boxes via box-decoration-break.\nexport function SkeletonText({children}: {children: ReactNode}): ReactNode {\n return (\n <span\n // @ts-ignore - compatibility with React < 19\n inert={inertValue(true)}\n ref={useLoadingAnimation(true)}\n className={loadingStyle + style({\n color: 'transparent',\n boxDecorationBreak: 'clone',\n borderRadius: 'sm'\n })}>\n {children}\n </span>\n );\n}\n\n// Clones the child element and displays it with skeleton styling.\nexport function SkeletonWrapper({children}: {children: SkeletonElement}): ReactNode {\n let isLoading = useContext(SkeletonContext);\n let animation = useLoadingAnimation(isLoading || false);\n if (isLoading == null) {\n return children;\n }\n\n let childRef = 'ref' in children && !Object.getOwnPropertyDescriptor(children, 'ref')?.get ? children.ref as any : children.props.ref;\n return (\n <SkeletonContext.Provider value={null}>\n {isLoading ? cloneElement(children, {\n ref: mergeRefs(childRef, animation),\n className: (children.props.className || '') + ' ' + loadingStyle,\n // @ts-ignore - compatibility with React < 19\n inert: inertValue(true)\n }) : children}\n </SkeletonContext.Provider>\n );\n}\n\n// Adds default border radius around icons when displayed in a skeleton.\nexport function useSkeletonIcon(styles: StyleString): StyleString {\n let isSkeleton = useContext(SkeletonContext);\n if (isSkeleton) {\n return mergeStyles(style({borderRadius: 'sm'}), styles);\n }\n return styles || '' as StyleString;\n}\n"],"names":[],"version":3,"file":"Skeleton.mjs.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/s2",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Spectrum 2 UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -77,28 +77,28 @@
77
77
  "src"
78
78
  ],
79
79
  "dependencies": {
80
- "@internationalized/date": "^3.8.2",
81
- "@internationalized/number": "^3.6.4",
82
- "@react-aria/calendar": "^3.9.0",
83
- "@react-aria/collections": "3.0.0-rc.4",
84
- "@react-aria/focus": "^3.21.0",
85
- "@react-aria/i18n": "^3.12.11",
86
- "@react-aria/interactions": "^3.25.4",
80
+ "@internationalized/date": "^3.9.0",
81
+ "@internationalized/number": "^3.6.5",
82
+ "@react-aria/calendar": "^3.9.1",
83
+ "@react-aria/collections": "3.0.0-rc.5",
84
+ "@react-aria/focus": "^3.21.1",
85
+ "@react-aria/i18n": "^3.12.12",
86
+ "@react-aria/interactions": "^3.25.5",
87
87
  "@react-aria/live-announcer": "^3.4.4",
88
- "@react-aria/utils": "^3.30.0",
89
- "@react-spectrum/utils": "^3.12.7",
90
- "@react-stately/layout": "^4.4.0",
88
+ "@react-aria/utils": "^3.30.1",
89
+ "@react-spectrum/utils": "^3.12.8",
90
+ "@react-stately/layout": "^4.5.0",
91
91
  "@react-stately/utils": "^3.10.8",
92
- "@react-types/dialog": "^3.5.20",
93
- "@react-types/grid": "^3.3.4",
94
- "@react-types/provider": "^3.8.11",
95
- "@react-types/shared": "^3.31.0",
96
- "@react-types/table": "^3.13.2",
97
- "@react-types/textfield": "^3.12.4",
92
+ "@react-types/dialog": "^3.5.21",
93
+ "@react-types/grid": "^3.3.5",
94
+ "@react-types/provider": "^3.8.12",
95
+ "@react-types/shared": "^3.32.0",
96
+ "@react-types/table": "^3.13.3",
97
+ "@react-types/textfield": "^3.12.5",
98
98
  "csstype": "^3.0.2",
99
- "react-aria": "^3.42.0",
100
- "react-aria-components": "^1.11.0",
101
- "react-stately": "^3.40.0"
99
+ "react-aria": "^3.43.0",
100
+ "react-aria-components": "^1.12.0",
101
+ "react-stately": "^3.41.0"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "react": "^18.0.0 || ^19.0.0-rc.1",
@@ -107,5 +107,5 @@
107
107
  "publishConfig": {
108
108
  "access": "public"
109
109
  },
110
- "gitHead": "8b9348ff255e018b2dd9b27e2a45507cadfa1d35"
110
+ "gitHead": "2c58ed3ddd9be9100af9b1d0cfd137fcdc95ba2d"
111
111
  }
package/src/Calendar.tsx CHANGED
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {ActionButton, Header, Heading, pressScale} from './';
13
+ import {ActionButton, Header, HeaderContext, Heading, HeadingContext, pressScale} from './';
14
14
  import {
15
15
  Calendar as AriaCalendar,
16
16
  CalendarCell as AriaCalendarCell,
@@ -27,6 +27,7 @@ import {
27
27
  CalendarStateContext,
28
28
  ContextValue,
29
29
  DateValue,
30
+ Provider,
30
31
  RangeCalendarState,
31
32
  RangeCalendarStateContext,
32
33
  Text
@@ -304,11 +305,17 @@ export const Calendar = /*#__PURE__*/ (forwardRef as forwardRefType)(function Ca
304
305
  {({isInvalid, isDisabled}) => {
305
306
  return (
306
307
  <>
307
- <Header styles={headerStyles}>
308
- <CalendarButton slot="previous"><ChevronLeftIcon /></CalendarButton>
309
- <CalendarHeading />
310
- <CalendarButton slot="next"><ChevronRightIcon /></CalendarButton>
311
- </Header>
308
+ <Provider
309
+ values={[
310
+ [HeaderContext, null],
311
+ [HeadingContext, null]
312
+ ]}>
313
+ <Header styles={headerStyles}>
314
+ <CalendarButton slot="previous"><ChevronLeftIcon /></CalendarButton>
315
+ <CalendarHeading />
316
+ <CalendarButton slot="next"><ChevronRightIcon /></CalendarButton>
317
+ </Header>
318
+ </Provider>
312
319
  <div
313
320
  className={style({
314
321
  display: 'flex',
package/src/ComboBox.tsx CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  Virtualizer
34
34
  } from 'react-aria-components';
35
35
  import {AsyncLoadable, GlobalDOMAttributes, HelpTextProps, LoadingState, SpectrumLabelableProps} from '@react-types/shared';
36
+ import {BaseCollection, CollectionNode, createLeafComponent} from '@react-aria/collections';
36
37
  import {baseColor, edgeToText, focusRing, space, style} from '../style' with {type: 'macro'};
37
38
  import {centerBaseline} from './CenterBaseline';
38
39
  import {centerPadding, control, controlBorderRadius, controlFont, controlSize, field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};
@@ -48,7 +49,6 @@ import CheckmarkIcon from '../ui-icons/Checkmark';
48
49
  import ChevronIcon from '../ui-icons/Chevron';
49
50
  import {createContext, CSSProperties, ForwardedRef, forwardRef, ReactNode, Ref, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react';
50
51
  import {createFocusableRef} from '@react-spectrum/utils';
51
- import {createLeafComponent} from '@react-aria/collections';
52
52
  import {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';
53
53
  import {FormContext, useFormProps} from './Form';
54
54
  import {forwardRefType} from './types';
@@ -209,7 +209,8 @@ export let listbox = style<{size: 'S' | 'M' | 'L' | 'XL'}>({
209
209
  overflowY: 'auto',
210
210
  overflowX: 'hidden',
211
211
  fontFamily: 'sans',
212
- fontSize: controlFont()
212
+ fontSize: controlFont(),
213
+ outlineStyle: 'none'
213
214
  });
214
215
 
215
216
  export let listboxItem = style({
@@ -338,14 +339,13 @@ export const ComboBox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Co
338
339
  labelPosition = 'top',
339
340
  UNSAFE_className = '',
340
341
  UNSAFE_style,
341
- loadingState,
342
342
  ...comboBoxProps
343
343
  } = props;
344
344
 
345
345
  return (
346
346
  <AriaComboBox
347
347
  {...comboBoxProps}
348
- allowsEmptyCollection={loadingState != null}
348
+ allowsEmptyCollection
349
349
  style={UNSAFE_style}
350
350
  className={UNSAFE_className + style(field(), getAllowedOverrides())({
351
351
  isInForm: !!formContext,
@@ -699,7 +699,22 @@ const ComboboxInner = forwardRef(function ComboboxInner(props: ComboBoxProps<any
699
699
  );
700
700
  });
701
701
 
702
- export const Divider = /*#__PURE__*/ createLeafComponent('separator', function Divider({size}: {size?: 'S' | 'M' | 'L' | 'XL'}, ref: ForwardedRef<HTMLDivElement>, node: Node<unknown>) {
702
+ class SeparatorNode extends CollectionNode<any> {
703
+ static readonly type = 'separator';
704
+
705
+ filter(collection: BaseCollection<any>, newCollection: BaseCollection<any>): CollectionNode<any> | null {
706
+ let prevItem = newCollection.getItem(this.prevKey!);
707
+ if (prevItem && prevItem.type !== 'separator') {
708
+ let clone = this.clone();
709
+ newCollection.addDescendants(clone, collection);
710
+ return clone;
711
+ }
712
+
713
+ return null;
714
+ }
715
+ }
716
+
717
+ export const Divider = /*#__PURE__*/ createLeafComponent(SeparatorNode, function Divider({size}: {size?: 'S' | 'M' | 'L' | 'XL'}, ref: ForwardedRef<HTMLDivElement>, node: Node<unknown>) {
703
718
  let listState = useContext(ListStateContext)!;
704
719
 
705
720
  let nextNode = node.nextKey != null && listState.collection.getItem(node.nextKey);
@@ -139,10 +139,7 @@ export const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function
139
139
  styles,
140
140
  placeholderValue,
141
141
  maxVisibleMonths = 1,
142
- firstDayOfWeek,
143
142
  createCalendar,
144
- pageBehavior,
145
- isDateUnavailable,
146
143
  ...dateFieldProps
147
144
  } = props;
148
145
  let formContext = useContext(FormContext);
@@ -206,10 +203,7 @@ export const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function
206
203
  <CalendarPopover>
207
204
  <Calendar
208
205
  visibleMonths={maxVisibleMonths}
209
- createCalendar={createCalendar}
210
- firstDayOfWeek={firstDayOfWeek}
211
- isDateUnavailable={isDateUnavailable}
212
- pageBehavior={pageBehavior} />
206
+ createCalendar={createCalendar} />
213
207
  {showTimeField && (
214
208
  <div className={style({display: 'flex', gap: 16, contain: 'inline-size'})}>
215
209
  <TimeField
@@ -72,10 +72,7 @@ export const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(func
72
72
  styles,
73
73
  placeholderValue,
74
74
  maxVisibleMonths = 1,
75
- firstDayOfWeek,
76
75
  createCalendar,
77
- pageBehavior,
78
- isDateUnavailable,
79
76
  ...dateFieldProps
80
77
  } = props;
81
78
  let formContext = useContext(FormContext);
@@ -145,10 +142,7 @@ export const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(func
145
142
  <CalendarPopover>
146
143
  <RangeCalendar
147
144
  visibleMonths={maxVisibleMonths}
148
- createCalendar={createCalendar}
149
- firstDayOfWeek={firstDayOfWeek}
150
- isDateUnavailable={isDateUnavailable}
151
- pageBehavior={pageBehavior} />
145
+ createCalendar={createCalendar} />
152
146
  {showTimeField && (
153
147
  <div className={style({display: 'flex', gap: 16, contain: 'inline-size', marginTop: 24})}>
154
148
  <TimeField
@@ -15,6 +15,7 @@ import {
15
15
  RangeCalendarProps as AriaRangeCalendarProps,
16
16
  ContextValue,
17
17
  DateValue,
18
+ Provider,
18
19
  Text
19
20
  } from 'react-aria-components';
20
21
  import {CalendarButton, CalendarGrid, CalendarHeading} from './Calendar';
@@ -23,7 +24,7 @@ import ChevronRightIcon from '../s2wf-icons/S2_Icon_ChevronRight_20_N.svg';
23
24
  import {createContext, ForwardedRef, forwardRef, ReactNode} from 'react';
24
25
  import {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';
25
26
  import {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};
26
- import {Header} from './';
27
+ import {Header, HeaderContext, HeadingContext} from './';
27
28
  import {helpTextStyles} from './Field';
28
29
  // @ts-ignore
29
30
  import intlMessages from '../intl/*.json';
@@ -85,11 +86,17 @@ export const RangeCalendar = /*#__PURE__*/ (forwardRef as forwardRefType)(functi
85
86
  {({isInvalid, isDisabled}) => {
86
87
  return (
87
88
  <>
88
- <Header styles={headerStyles}>
89
- <CalendarButton slot="previous"><ChevronLeftIcon /></CalendarButton>
90
- <CalendarHeading />
91
- <CalendarButton slot="next"><ChevronRightIcon /></CalendarButton>
92
- </Header>
89
+ <Provider
90
+ values={[
91
+ [HeaderContext, null],
92
+ [HeadingContext, null]
93
+ ]}>
94
+ <Header styles={headerStyles}>
95
+ <CalendarButton slot="previous"><ChevronLeftIcon /></CalendarButton>
96
+ <CalendarHeading />
97
+ <CalendarButton slot="next"><ChevronRightIcon /></CalendarButton>
98
+ </Header>
99
+ </Provider>
93
100
  <div
94
101
  className={style({
95
102
  display: 'flex',