@sprinklrjs/spaceweb 11.0.0 → 12.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (648) hide show
  1. package/allComponentsAndUtilities.d.ts +1 -0
  2. package/allComponentsAndUtilities.js +2 -1
  3. package/asyncSelect/asyncSelect.d.ts +4 -2
  4. package/asyncSelect/asyncSelect.js +43 -108
  5. package/asyncSelect/groupedAsyncSelect.d.ts +5 -0
  6. package/asyncSelect/groupedAsyncSelect.js +41 -0
  7. package/asyncSelect/helpers.d.ts +8 -2
  8. package/asyncSelect/helpers.js +35 -4
  9. package/asyncSelect/hooks/useAsyncOptionHandlers.d.ts +16 -11
  10. package/asyncSelect/hooks/useAsyncOptionHandlers.js +73 -26
  11. package/asyncSelect/hooks/useAsyncSelect.d.ts +10 -0
  12. package/asyncSelect/hooks/useAsyncSelect.js +182 -0
  13. package/asyncSelect/hooks/useResolveSelectedOptions.d.ts +10 -7
  14. package/asyncSelect/hooks/useResolveSelectedOptions.js +59 -47
  15. package/asyncSelect/index.d.ts +4 -1
  16. package/asyncSelect/index.js +8 -0
  17. package/asyncSelect/types.d.ts +61 -9
  18. package/avatar/avatar.js +12 -2
  19. package/avatar/styled-component.js +7 -22
  20. package/badge/styled-component.js +10 -8
  21. package/banner/banner.js +1 -1
  22. package/breadcrumb/breadcrumb-item.d.ts +7 -0
  23. package/breadcrumb/breadcrumb-item.js +41 -0
  24. package/breadcrumb/breadcrumb.d.ts +7 -0
  25. package/breadcrumb/breadcrumb.js +29 -0
  26. package/breadcrumb/index.d.ts +4 -0
  27. package/breadcrumb/index.js +17 -0
  28. package/breadcrumb/package.json +4 -0
  29. package/breadcrumb/styled-components.d.ts +7 -0
  30. package/breadcrumb/styled-components.js +19 -0
  31. package/breadcrumb/types.d.ts +38 -0
  32. package/breadcrumb/types.js +2 -0
  33. package/button/Button.d.ts +2 -0
  34. package/button/Button.js +13 -1
  35. package/button/IconButton/IconButton.d.ts +2 -4
  36. package/button/IconButton/IconButton.js +5 -2
  37. package/button/IconButton/types.d.ts +10 -1
  38. package/button/basewebAdapter.d.ts +3 -1
  39. package/button/styled-components.js +30 -25
  40. package/button/types.d.ts +3 -0
  41. package/button-group/ButtonGroup.d.ts +1 -0
  42. package/button-group/ButtonGroup.js +9 -5
  43. package/button-group/StatefulButtonGroup.d.ts +1 -0
  44. package/button-group/styled-components.d.ts +34 -0
  45. package/button-group/styled-components.js +57 -9
  46. package/button-group/types.d.ts +2 -0
  47. package/checkbox/basewebAdapters.js +6 -1
  48. package/color-picker/ColorPalette.d.ts +9 -0
  49. package/color-picker/ColorPalette.js +26 -0
  50. package/color-picker/ColorPicker.d.ts +3 -0
  51. package/color-picker/ColorPicker.js +35 -0
  52. package/color-picker/Swatch.d.ts +12 -0
  53. package/color-picker/Swatch.js +40 -0
  54. package/color-picker/colors.d.ts +1 -0
  55. package/color-picker/colors.js +109 -0
  56. package/color-picker/getContrastRatio.d.ts +1 -0
  57. package/color-picker/getContrastRatio.js +23 -0
  58. package/color-picker/index.d.ts +3 -0
  59. package/color-picker/index.js +7 -0
  60. package/color-picker/locale.d.ts +3 -0
  61. package/color-picker/locale.js +2 -0
  62. package/color-picker/package.json +4 -0
  63. package/color-picker/styled-component.d.ts +1 -0
  64. package/color-picker/styled-component.js +5 -0
  65. package/color-picker/types.d.ts +15 -0
  66. package/color-picker/types.js +2 -0
  67. package/currency/Currency.d.ts +3 -0
  68. package/currency/Currency.js +14 -0
  69. package/currency/constants.d.ts +3 -0
  70. package/currency/constants.js +8 -0
  71. package/currency/index.d.ts +5 -0
  72. package/currency/index.js +12 -0
  73. package/currency/package.json +4 -0
  74. package/currency/types.d.ts +7 -0
  75. package/currency/types.js +2 -0
  76. package/currency/useCurrency.d.ts +2 -0
  77. package/currency/useCurrency.js +12 -0
  78. package/currency/utils.d.ts +8 -0
  79. package/currency/utils.js +11 -0
  80. package/date-input/Before.d.ts +4 -2
  81. package/date-input/Before.js +4 -4
  82. package/date-input/CalendarIconButton.js +7 -1
  83. package/date-input/DateInput.d.ts +1 -1
  84. package/date-input/DateInput.js +46 -25
  85. package/date-input/styled-components.d.ts +2 -2
  86. package/date-input/styled-components.js +10 -8
  87. package/date-input/types.d.ts +4 -2
  88. package/date-picker/Calendar.js +5 -3
  89. package/date-picker/DateInput.js +16 -14
  90. package/date-picker/DatePickerContent.d.ts +9 -3
  91. package/date-picker/DatePickerContent.js +59 -8
  92. package/date-picker/DatePickerInput.js +9 -6
  93. package/date-picker/StatelessDatePicker.js +35 -16
  94. package/date-picker/locale.d.ts +2 -0
  95. package/date-picker/stateful-container.js +11 -8
  96. package/date-picker/styled-components.js +53 -3
  97. package/date-picker/types.d.ts +10 -1
  98. package/date-picker/utils.d.ts +3 -1
  99. package/date-picker/utils.js +8 -3
  100. package/date-time/DateTime.d.ts +3 -0
  101. package/date-time/DateTime.js +12 -0
  102. package/date-time/index.d.ts +3 -0
  103. package/date-time/index.js +9 -0
  104. package/date-time/package.json +4 -0
  105. package/date-time/types.d.ts +21 -0
  106. package/date-time/types.js +18 -0
  107. package/date-time/useDateTime.d.ts +2 -0
  108. package/date-time/useDateTime.js +13 -0
  109. package/date-time/variants.d.ts +4 -0
  110. package/date-time/variants.js +87 -0
  111. package/esm/allComponentsAndUtilities.d.ts +1 -0
  112. package/esm/allComponentsAndUtilities.js +2 -0
  113. package/esm/asyncSelect/asyncSelect.d.ts +4 -2
  114. package/esm/asyncSelect/asyncSelect.js +46 -111
  115. package/esm/asyncSelect/groupedAsyncSelect.d.ts +5 -0
  116. package/esm/asyncSelect/groupedAsyncSelect.js +37 -0
  117. package/esm/asyncSelect/helpers.d.ts +8 -2
  118. package/esm/asyncSelect/helpers.js +31 -3
  119. package/esm/asyncSelect/hooks/useAsyncOptionHandlers.d.ts +16 -11
  120. package/esm/asyncSelect/hooks/useAsyncOptionHandlers.js +76 -29
  121. package/esm/asyncSelect/hooks/useAsyncSelect.d.ts +10 -0
  122. package/esm/asyncSelect/hooks/useAsyncSelect.js +178 -0
  123. package/esm/asyncSelect/hooks/useResolveSelectedOptions.d.ts +10 -7
  124. package/esm/asyncSelect/hooks/useResolveSelectedOptions.js +62 -50
  125. package/esm/asyncSelect/index.d.ts +4 -1
  126. package/esm/asyncSelect/index.js +3 -0
  127. package/esm/asyncSelect/types.d.ts +61 -9
  128. package/esm/avatar/avatar.js +12 -2
  129. package/esm/avatar/styled-component.js +7 -22
  130. package/esm/badge/styled-component.js +10 -8
  131. package/esm/banner/banner.js +1 -1
  132. package/esm/breadcrumb/breadcrumb-item.d.ts +7 -0
  133. package/esm/breadcrumb/breadcrumb-item.js +39 -0
  134. package/esm/breadcrumb/breadcrumb.d.ts +7 -0
  135. package/esm/breadcrumb/breadcrumb.js +27 -0
  136. package/esm/breadcrumb/index.d.ts +4 -0
  137. package/esm/breadcrumb/index.js +3 -0
  138. package/esm/breadcrumb/styled-components.d.ts +7 -0
  139. package/esm/breadcrumb/styled-components.js +15 -0
  140. package/esm/breadcrumb/types.d.ts +38 -0
  141. package/esm/breadcrumb/types.js +1 -0
  142. package/esm/button/Button.d.ts +2 -0
  143. package/esm/button/Button.js +13 -1
  144. package/esm/button/IconButton/IconButton.d.ts +2 -4
  145. package/esm/button/IconButton/IconButton.js +5 -2
  146. package/esm/button/IconButton/types.d.ts +10 -1
  147. package/esm/button/basewebAdapter.d.ts +3 -1
  148. package/esm/button/styled-components.js +30 -25
  149. package/esm/button/types.d.ts +3 -0
  150. package/esm/button-group/ButtonGroup.d.ts +1 -0
  151. package/esm/button-group/ButtonGroup.js +9 -5
  152. package/esm/button-group/StatefulButtonGroup.d.ts +1 -0
  153. package/esm/button-group/styled-components.d.ts +34 -0
  154. package/esm/button-group/styled-components.js +55 -8
  155. package/esm/button-group/types.d.ts +2 -0
  156. package/esm/checkbox/basewebAdapters.js +6 -1
  157. package/esm/color-picker/ColorPalette.d.ts +9 -0
  158. package/esm/color-picker/ColorPalette.js +22 -0
  159. package/esm/color-picker/ColorPicker.d.ts +3 -0
  160. package/esm/color-picker/ColorPicker.js +31 -0
  161. package/esm/color-picker/Swatch.d.ts +12 -0
  162. package/esm/color-picker/Swatch.js +37 -0
  163. package/esm/color-picker/colors.d.ts +1 -0
  164. package/esm/color-picker/colors.js +106 -0
  165. package/esm/color-picker/getContrastRatio.d.ts +1 -0
  166. package/esm/color-picker/getContrastRatio.js +19 -0
  167. package/esm/color-picker/index.d.ts +3 -0
  168. package/esm/color-picker/index.js +2 -0
  169. package/esm/color-picker/locale.d.ts +3 -0
  170. package/esm/color-picker/locale.js +1 -0
  171. package/esm/color-picker/styled-component.d.ts +1 -0
  172. package/esm/color-picker/styled-component.js +2 -0
  173. package/esm/color-picker/types.d.ts +15 -0
  174. package/esm/color-picker/types.js +1 -0
  175. package/esm/currency/Currency.d.ts +3 -0
  176. package/esm/currency/Currency.js +10 -0
  177. package/esm/currency/constants.d.ts +3 -0
  178. package/esm/currency/constants.js +5 -0
  179. package/esm/currency/index.d.ts +5 -0
  180. package/esm/currency/index.js +5 -0
  181. package/esm/currency/types.d.ts +7 -0
  182. package/esm/currency/types.js +1 -0
  183. package/esm/currency/useCurrency.d.ts +2 -0
  184. package/esm/currency/useCurrency.js +8 -0
  185. package/esm/currency/utils.d.ts +8 -0
  186. package/esm/currency/utils.js +7 -0
  187. package/esm/date-input/Before.d.ts +4 -2
  188. package/esm/date-input/Before.js +4 -4
  189. package/esm/date-input/CalendarIconButton.js +7 -1
  190. package/esm/date-input/DateInput.d.ts +1 -1
  191. package/esm/date-input/DateInput.js +47 -26
  192. package/esm/date-input/styled-components.d.ts +2 -2
  193. package/esm/date-input/styled-components.js +10 -7
  194. package/esm/date-input/types.d.ts +4 -2
  195. package/esm/date-picker/Calendar.js +5 -3
  196. package/esm/date-picker/DateInput.js +17 -15
  197. package/esm/date-picker/DatePickerContent.d.ts +9 -3
  198. package/esm/date-picker/DatePickerContent.js +60 -9
  199. package/esm/date-picker/DatePickerInput.js +9 -6
  200. package/esm/date-picker/StatelessDatePicker.js +35 -16
  201. package/esm/date-picker/locale.d.ts +2 -0
  202. package/esm/date-picker/stateful-container.js +11 -8
  203. package/esm/date-picker/styled-components.js +53 -3
  204. package/esm/date-picker/types.d.ts +10 -1
  205. package/esm/date-picker/utils.d.ts +3 -1
  206. package/esm/date-picker/utils.js +9 -4
  207. package/esm/date-time/DateTime.d.ts +3 -0
  208. package/esm/date-time/DateTime.js +8 -0
  209. package/esm/date-time/index.d.ts +3 -0
  210. package/esm/date-time/index.js +3 -0
  211. package/esm/date-time/types.d.ts +21 -0
  212. package/esm/date-time/types.js +15 -0
  213. package/esm/date-time/useDateTime.d.ts +2 -0
  214. package/esm/date-time/useDateTime.js +9 -0
  215. package/esm/date-time/variants.d.ts +4 -0
  216. package/esm/date-time/variants.js +84 -0
  217. package/esm/form-control/form-control.d.ts +1 -1
  218. package/esm/form-control/form-control.js +17 -12
  219. package/esm/form-control/styled-component.js +17 -6
  220. package/esm/helpers/ClearIconButton.js +3 -1
  221. package/esm/helpers/StyledTombstone.d.ts +1 -0
  222. package/esm/helpers/StyledTombstone.js +17 -0
  223. package/esm/helpers/baseui/useConvertOverrides.js +6 -1
  224. package/esm/helpers/commonStyles.js +3 -6
  225. package/esm/helpers/index.d.ts +1 -0
  226. package/esm/helpers/index.js +8 -0
  227. package/esm/helpers/themeHelpers.d.ts +1 -0
  228. package/esm/helpers/themeHelpers.js +13 -0
  229. package/esm/hooks/useAutoFocus.js +6 -0
  230. package/esm/hooks/useMatchMedia.js +13 -2
  231. package/esm/icon/components/alert-solid.js +2 -0
  232. package/esm/icon/components/alert.js +2 -0
  233. package/esm/icon/components/calendar-solid.js +2 -0
  234. package/esm/icon/components/chevron-down.js +2 -0
  235. package/esm/icon/components/chevron-left.d.ts +3 -0
  236. package/esm/icon/components/chevron-left.js +8 -0
  237. package/esm/icon/components/chevron-right.d.ts +3 -0
  238. package/esm/icon/components/chevron-right.js +8 -0
  239. package/esm/icon/components/close.js +2 -0
  240. package/esm/icon/components/error-clr.js +2 -0
  241. package/esm/icon/components/error-solid.js +2 -0
  242. package/esm/icon/components/error.js +2 -0
  243. package/esm/icon/components/imagePreview.js +2 -0
  244. package/esm/icon/components/info.js +2 -0
  245. package/esm/icon/components/play-video.js +2 -0
  246. package/esm/icon/components/reset-color.d.ts +3 -0
  247. package/esm/icon/components/reset-color.js +8 -0
  248. package/esm/icon/components/search.js +2 -0
  249. package/esm/icon/components/tick.js +2 -0
  250. package/esm/icon/components/tickCircle-solid.js +2 -0
  251. package/esm/icon/components/user.js +2 -0
  252. package/esm/icon/components/video-non-playable.js +2 -0
  253. package/esm/index.d.ts +2 -0
  254. package/esm/index.js +2 -0
  255. package/esm/input/basewebAdapters.js +18 -3
  256. package/esm/input/styled-components.js +8 -6
  257. package/esm/input/types.d.ts +4 -1
  258. package/esm/layer/useLayersContextValue.js +3 -2
  259. package/esm/list/avatar-list-item.d.ts +12 -22
  260. package/esm/list/avatar-list-item.js +6 -4
  261. package/esm/list/index.d.ts +1 -1
  262. package/esm/list/index.js +1 -1
  263. package/esm/list/list-item.d.ts +3 -1
  264. package/esm/list/list-item.js +9 -6
  265. package/esm/list/styled-component.d.ts +1 -0
  266. package/esm/list/styled-component.js +23 -15
  267. package/esm/list/types.d.ts +3 -0
  268. package/esm/locale/en_US.js +26 -0
  269. package/esm/locale/types.d.ts +19 -0
  270. package/esm/menu/MenuContext.d.ts +2 -1
  271. package/esm/menu/MenuContext.js +1 -0
  272. package/esm/menu/menu-item.d.ts +4 -1
  273. package/esm/menu/menu-item.js +11 -11
  274. package/esm/menu/menu.d.ts +1 -0
  275. package/esm/menu/menu.js +11 -11
  276. package/esm/menu/types.d.ts +1 -0
  277. package/esm/menu/useKeyboardNavigation.d.ts +6 -3
  278. package/esm/menu/useKeyboardNavigation.js +21 -14
  279. package/esm/menu/useStatefulMenu.d.ts +5 -2
  280. package/esm/menu/useStatefulMenu.js +14 -8
  281. package/esm/modal/modal.js +3 -1
  282. package/esm/modal/overrides.d.ts +2 -2
  283. package/esm/modal/overrides.js +6 -7
  284. package/esm/modal/styled-components.js +7 -7
  285. package/esm/number/Number.d.ts +3 -0
  286. package/esm/number/Number.js +10 -0
  287. package/esm/number/constants.d.ts +2 -0
  288. package/esm/number/constants.js +4 -0
  289. package/esm/number/index.d.ts +5 -0
  290. package/esm/number/index.js +5 -0
  291. package/esm/number/types.d.ts +6 -0
  292. package/esm/number/types.js +1 -0
  293. package/esm/number/useNumber.d.ts +2 -0
  294. package/esm/number/useNumber.js +8 -0
  295. package/esm/overrides/index.d.ts +1 -1
  296. package/esm/overrides/index.js +1 -1
  297. package/esm/overrides/mergeOverrides.d.ts +3 -2
  298. package/esm/overrides/mergeOverrides.js +1 -1
  299. package/esm/payment-card/basewebAdapters.d.ts +2 -0
  300. package/esm/payment-card/basewebAdapters.js +23 -1
  301. package/esm/payment-card/styled-components.js +25 -6
  302. package/esm/phone-input/country-select-container.js +1 -1
  303. package/esm/phone-input/country-select.js +3 -3
  304. package/esm/phone-input/default-props.d.ts +5 -5
  305. package/esm/phone-input/default-props.js +7 -7
  306. package/esm/phone-input/flag-container.js +1 -1
  307. package/esm/phone-input/phone-input.d.ts +0 -4
  308. package/esm/phone-input/phone-input.js +20 -12
  309. package/esm/phone-input/stateful-phone-input-container.js +4 -3
  310. package/esm/phone-input/stateful-phone-input.d.ts +0 -4
  311. package/esm/phone-input/styled-components.d.ts +9 -1
  312. package/esm/phone-input/styled-components.js +21 -7
  313. package/esm/phone-input/types.d.ts +2 -1
  314. package/esm/phone-input/utils.d.ts +5 -1
  315. package/esm/phone-input/utils.js +6 -1
  316. package/esm/popover/adapter.d.ts +1 -0
  317. package/esm/popover/adapter.js +15 -0
  318. package/esm/popover/overrides.js +8 -19
  319. package/esm/popover/popover.d.ts +1 -0
  320. package/esm/popover/popover.js +9 -4
  321. package/esm/popover/stateful-popover.js +2 -2
  322. package/esm/popover/types.d.ts +3 -0
  323. package/esm/popover/utils.d.ts +12 -0
  324. package/esm/popover/utils.js +9 -0
  325. package/esm/progress/linear/styled-component.d.ts +1 -1
  326. package/esm/progress/linear/styled-component.js +5 -5
  327. package/esm/radio/styled-components.js +5 -5
  328. package/esm/search/index.d.ts +1 -0
  329. package/esm/search/index.js +1 -0
  330. package/esm/search/search.d.ts +1 -1
  331. package/esm/search/search.js +15 -6
  332. package/esm/search/stateful-search.d.ts +3 -0
  333. package/esm/search/stateful-search.js +15 -0
  334. package/esm/search/styled-components.d.ts +1 -10
  335. package/esm/search/styled-components.js +54 -24
  336. package/esm/search/types.d.ts +8 -2
  337. package/esm/select/base-select.d.ts +22 -5
  338. package/esm/select/base-select.js +174 -82
  339. package/esm/select/constants.d.ts +3 -0
  340. package/esm/select/constants.js +3 -1
  341. package/esm/select/default-props.d.ts +1 -0
  342. package/esm/select/default-props.js +3 -0
  343. package/esm/select/index.d.ts +2 -2
  344. package/esm/select/index.js +2 -2
  345. package/esm/select/locale.d.ts +4 -0
  346. package/esm/select/mobileSelect/MobileSheet.js +3 -1
  347. package/esm/select/multi-value.js +22 -12
  348. package/esm/select/overlaySelect/OverlaySelect.js +1 -0
  349. package/esm/select/overlaySelect/hooks/useOverlaySelectOverrides.d.ts +2 -1
  350. package/esm/select/overlaySelect/hooks/useOverlaySelectOverrides.js +13 -16
  351. package/esm/select/overrides.d.ts +3 -0
  352. package/esm/select/overrides.js +19 -6
  353. package/esm/select/select.d.ts +1 -0
  354. package/esm/select/select.js +9 -3
  355. package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.d.ts +118 -0
  356. package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.js +70 -0
  357. package/esm/select/selectMenuAdapter/SelectMenuAdapter.d.ts +2 -34
  358. package/esm/select/selectMenuAdapter/SelectMenuAdapter.js +3 -3
  359. package/esm/select/selectMenuAdapter/SelectMenuItem.d.ts +4 -1
  360. package/esm/select/selectMenuAdapter/hooks/useGetExpandedGroup.d.ts +6 -0
  361. package/esm/select/selectMenuAdapter/hooks/useGetExpandedGroup.js +16 -0
  362. package/esm/select/selectMenuAdapter/types.d.ts +42 -0
  363. package/esm/select/selectMenuAdapter/types.js +1 -0
  364. package/esm/select/stateful-select.d.ts +1 -0
  365. package/esm/select/styled-component.d.ts +10 -1
  366. package/esm/select/styled-component.js +39 -15
  367. package/esm/select/types.d.ts +23 -1
  368. package/esm/select/types.js +1 -0
  369. package/esm/select/utils/default-filter-options.d.ts +2 -1
  370. package/esm/select/utils/default-filter-options.js +5 -1
  371. package/esm/select/utils/hidden-element.d.ts +6 -0
  372. package/esm/select/utils/hidden-element.js +16 -0
  373. package/esm/select/utils/merge-options.d.ts +2 -0
  374. package/esm/select/utils/merge-options.js +18 -0
  375. package/esm/select/utils/test-utils.d.ts +1 -0
  376. package/esm/select/utils/test-utils.js +7 -0
  377. package/esm/slider/styled-components.js +4 -4
  378. package/esm/snackbar/Snackbar.js +12 -12
  379. package/esm/snackbar/styled-component.js +9 -6
  380. package/esm/spacewebProvider/SpacewebProvider.d.ts +2 -0
  381. package/esm/spacewebProvider/SpacewebProvider.js +9 -9
  382. package/esm/stack/stack.js +6 -13
  383. package/esm/style/_buildUtils.d.ts +1 -1
  384. package/esm/style/_buildUtils.js +3 -1
  385. package/esm/style/_parseStyle.js +7 -2
  386. package/esm/style/useMemoizedStyletron.js +6 -1
  387. package/esm/switch/styled-components.js +3 -3
  388. package/esm/tag/avatar-tag.js +23 -16
  389. package/esm/tag/styled-components.js +32 -27
  390. package/esm/tag/tag.js +20 -12
  391. package/esm/tag/types.d.ts +2 -2
  392. package/esm/tag/utils.d.ts +50 -0
  393. package/esm/tag/utils.js +64 -0
  394. package/esm/textarea/basewebAdapters.js +3 -3
  395. package/esm/textarea/textarea.js +3 -3
  396. package/esm/textarea/types.d.ts +2 -2
  397. package/esm/theme/Provider.d.ts +10 -0
  398. package/esm/theme/Provider.js +61 -0
  399. package/esm/theme/context.d.ts +1 -10
  400. package/esm/theme/context.js +1 -61
  401. package/esm/theme/index.d.ts +1 -0
  402. package/esm/theme/index.js +1 -0
  403. package/esm/time-picker/TimePicker.js +4 -1
  404. package/esm/time-range-picker/RangeSelectorContainer.js +1 -1
  405. package/esm/time-range-picker/TimeRangePicker.js +20 -12
  406. package/esm/time-range-picker/index.d.ts +1 -1
  407. package/esm/time-range-picker/index.js +1 -1
  408. package/esm/time-range-picker/types.d.ts +1 -2
  409. package/esm/time-range-picker/utils.d.ts +33 -4
  410. package/esm/time-range-picker/utils.js +49 -15
  411. package/esm/time-zone-picker/types.d.ts +2 -0
  412. package/esm/tooltip/overrides.js +0 -1
  413. package/esm/tooltip/stateful-tooltip.js +2 -2
  414. package/esm/tooltip/tooltip.d.ts +1 -1
  415. package/esm/tooltip/tooltip.js +5 -2
  416. package/esm/tooltip/types.d.ts +2 -0
  417. package/esm/types.d.ts +2 -1
  418. package/esm/typography/Typography.js +14 -1
  419. package/esm/typography/constants.d.ts +56 -0
  420. package/esm/typography/constants.js +56 -0
  421. package/esm/typography/index.d.ts +1 -0
  422. package/esm/typography/index.js +1 -0
  423. package/esm/typography/styled-components.js +12 -4
  424. package/esm/typography/types.d.ts +1 -1
  425. package/esm/utils/intlNumberFormatUtils/index.d.ts +7 -0
  426. package/esm/utils/intlNumberFormatUtils/index.js +36 -0
  427. package/esm/utils/intlNumberFormatUtils/types.d.ts +21 -0
  428. package/esm/utils/intlNumberFormatUtils/types.js +6 -0
  429. package/form-control/form-control.d.ts +1 -1
  430. package/form-control/form-control.js +16 -11
  431. package/form-control/styled-component.js +17 -6
  432. package/helpers/ClearIconButton.js +3 -1
  433. package/helpers/StyledTombstone.d.ts +1 -0
  434. package/helpers/StyledTombstone.js +21 -0
  435. package/helpers/baseui/useConvertOverrides.js +6 -1
  436. package/helpers/commonStyles.js +3 -6
  437. package/helpers/index.d.ts +1 -0
  438. package/helpers/index.js +10 -1
  439. package/helpers/themeHelpers.d.ts +1 -0
  440. package/helpers/themeHelpers.js +15 -1
  441. package/hooks/useAutoFocus.js +6 -0
  442. package/hooks/useMatchMedia.js +13 -2
  443. package/icon/components/alert-solid.js +2 -0
  444. package/icon/components/alert.js +2 -0
  445. package/icon/components/calendar-solid.js +2 -0
  446. package/icon/components/chevron-down.js +2 -0
  447. package/icon/components/chevron-left.d.ts +3 -0
  448. package/icon/components/chevron-left.js +11 -0
  449. package/icon/components/chevron-right.d.ts +3 -0
  450. package/icon/components/chevron-right.js +11 -0
  451. package/icon/components/close.js +2 -0
  452. package/icon/components/error-clr.js +2 -0
  453. package/icon/components/error-solid.js +2 -0
  454. package/icon/components/error.js +2 -0
  455. package/icon/components/imagePreview.js +2 -0
  456. package/icon/components/info.js +2 -0
  457. package/icon/components/play-video.js +2 -0
  458. package/icon/components/reset-color.d.ts +3 -0
  459. package/icon/components/reset-color.js +11 -0
  460. package/icon/components/search.js +2 -0
  461. package/icon/components/tick.js +2 -0
  462. package/icon/components/tickCircle-solid.js +2 -0
  463. package/icon/components/user.js +2 -0
  464. package/icon/components/video-non-playable.js +2 -0
  465. package/index.d.ts +2 -0
  466. package/index.js +3 -0
  467. package/input/basewebAdapters.js +18 -3
  468. package/input/styled-components.js +7 -5
  469. package/input/types.d.ts +4 -1
  470. package/layer/useLayersContextValue.js +2 -1
  471. package/list/avatar-list-item.d.ts +12 -22
  472. package/list/avatar-list-item.js +5 -3
  473. package/list/index.d.ts +1 -1
  474. package/list/index.js +2 -1
  475. package/list/list-item.d.ts +3 -1
  476. package/list/list-item.js +9 -6
  477. package/list/styled-component.d.ts +1 -0
  478. package/list/styled-component.js +24 -16
  479. package/list/types.d.ts +3 -0
  480. package/locale/en_US.js +26 -0
  481. package/locale/types.d.ts +19 -0
  482. package/menu/MenuContext.d.ts +2 -1
  483. package/menu/MenuContext.js +1 -0
  484. package/menu/menu-item.d.ts +4 -1
  485. package/menu/menu-item.js +11 -11
  486. package/menu/menu.d.ts +1 -0
  487. package/menu/menu.js +11 -11
  488. package/menu/types.d.ts +1 -0
  489. package/menu/useKeyboardNavigation.d.ts +6 -3
  490. package/menu/useKeyboardNavigation.js +21 -14
  491. package/menu/useStatefulMenu.d.ts +5 -2
  492. package/menu/useStatefulMenu.js +14 -8
  493. package/modal/modal.js +3 -1
  494. package/modal/overrides.d.ts +2 -2
  495. package/modal/overrides.js +6 -7
  496. package/modal/styled-components.js +7 -7
  497. package/number/Number.d.ts +3 -0
  498. package/number/Number.js +14 -0
  499. package/number/constants.d.ts +2 -0
  500. package/number/constants.js +7 -0
  501. package/number/index.d.ts +5 -0
  502. package/number/index.js +12 -0
  503. package/number/package.json +4 -0
  504. package/number/types.d.ts +6 -0
  505. package/number/types.js +2 -0
  506. package/number/useNumber.d.ts +2 -0
  507. package/number/useNumber.js +12 -0
  508. package/overrides/index.d.ts +1 -1
  509. package/overrides/index.js +2 -1
  510. package/overrides/mergeOverrides.d.ts +3 -2
  511. package/overrides/mergeOverrides.js +2 -1
  512. package/package.json +8 -5
  513. package/payment-card/basewebAdapters.d.ts +2 -0
  514. package/payment-card/basewebAdapters.js +23 -1
  515. package/payment-card/styled-components.js +24 -5
  516. package/phone-input/country-select-container.js +1 -1
  517. package/phone-input/country-select.js +3 -3
  518. package/phone-input/default-props.d.ts +5 -5
  519. package/phone-input/default-props.js +8 -7
  520. package/phone-input/flag-container.js +1 -1
  521. package/phone-input/phone-input.d.ts +0 -4
  522. package/phone-input/phone-input.js +19 -11
  523. package/phone-input/stateful-phone-input-container.js +4 -3
  524. package/phone-input/stateful-phone-input.d.ts +0 -4
  525. package/phone-input/styled-components.d.ts +9 -1
  526. package/phone-input/styled-components.js +22 -7
  527. package/phone-input/types.d.ts +2 -1
  528. package/phone-input/utils.d.ts +5 -1
  529. package/phone-input/utils.js +7 -1
  530. package/popover/adapter.d.ts +1 -0
  531. package/popover/adapter.js +16 -1
  532. package/popover/overrides.js +8 -19
  533. package/popover/popover.d.ts +1 -0
  534. package/popover/popover.js +8 -3
  535. package/popover/stateful-popover.js +2 -2
  536. package/popover/types.d.ts +3 -0
  537. package/popover/utils.d.ts +12 -0
  538. package/popover/utils.js +11 -1
  539. package/progress/linear/styled-component.d.ts +1 -1
  540. package/progress/linear/styled-component.js +5 -5
  541. package/radio/styled-components.js +5 -5
  542. package/search/index.d.ts +1 -0
  543. package/search/index.js +3 -1
  544. package/search/search.d.ts +1 -1
  545. package/search/search.js +14 -5
  546. package/search/stateful-search.d.ts +3 -0
  547. package/search/stateful-search.js +19 -0
  548. package/search/styled-components.d.ts +1 -10
  549. package/search/styled-components.js +56 -25
  550. package/search/types.d.ts +8 -2
  551. package/select/base-select.d.ts +22 -5
  552. package/select/base-select.js +172 -80
  553. package/select/constants.d.ts +3 -0
  554. package/select/constants.js +4 -2
  555. package/select/default-props.d.ts +1 -0
  556. package/select/default-props.js +3 -0
  557. package/select/index.d.ts +2 -2
  558. package/select/index.js +4 -1
  559. package/select/locale.d.ts +4 -0
  560. package/select/mobileSelect/MobileSheet.js +3 -1
  561. package/select/multi-value.js +21 -11
  562. package/select/overlaySelect/OverlaySelect.js +1 -0
  563. package/select/overlaySelect/hooks/useOverlaySelectOverrides.d.ts +2 -1
  564. package/select/overlaySelect/hooks/useOverlaySelectOverrides.js +13 -16
  565. package/select/overrides.d.ts +3 -0
  566. package/select/overrides.js +20 -6
  567. package/select/select.d.ts +1 -0
  568. package/select/select.js +9 -3
  569. package/select/selectMenuAdapter/CollapsibleSelectMenu.d.ts +118 -0
  570. package/select/selectMenuAdapter/CollapsibleSelectMenu.js +74 -0
  571. package/select/selectMenuAdapter/SelectMenuAdapter.d.ts +2 -34
  572. package/select/selectMenuAdapter/SelectMenuAdapter.js +3 -3
  573. package/select/selectMenuAdapter/SelectMenuItem.d.ts +4 -1
  574. package/select/selectMenuAdapter/hooks/useGetExpandedGroup.d.ts +6 -0
  575. package/select/selectMenuAdapter/hooks/useGetExpandedGroup.js +20 -0
  576. package/select/selectMenuAdapter/types.d.ts +42 -0
  577. package/select/selectMenuAdapter/types.js +2 -0
  578. package/select/stateful-select.d.ts +1 -0
  579. package/select/styled-component.d.ts +10 -1
  580. package/select/styled-component.js +38 -14
  581. package/select/types.d.ts +23 -1
  582. package/select/types.js +2 -1
  583. package/select/utils/default-filter-options.d.ts +2 -1
  584. package/select/utils/default-filter-options.js +6 -5
  585. package/select/utils/hidden-element.d.ts +6 -0
  586. package/select/utils/hidden-element.js +19 -0
  587. package/select/utils/merge-options.d.ts +2 -0
  588. package/select/utils/merge-options.js +22 -0
  589. package/select/utils/test-utils.d.ts +1 -0
  590. package/select/utils/test-utils.js +11 -0
  591. package/slider/styled-components.js +4 -4
  592. package/snackbar/Snackbar.js +12 -12
  593. package/snackbar/styled-component.js +9 -6
  594. package/spacewebProvider/SpacewebProvider.d.ts +2 -0
  595. package/spacewebProvider/SpacewebProvider.js +8 -8
  596. package/stack/stack.js +6 -13
  597. package/style/_buildUtils.d.ts +1 -1
  598. package/style/_buildUtils.js +3 -1
  599. package/style/_parseStyle.js +7 -2
  600. package/style/useMemoizedStyletron.js +6 -1
  601. package/switch/styled-components.js +3 -3
  602. package/tag/avatar-tag.js +23 -16
  603. package/tag/styled-components.js +32 -27
  604. package/tag/tag.js +19 -11
  605. package/tag/types.d.ts +2 -2
  606. package/tag/utils.d.ts +50 -0
  607. package/tag/utils.js +67 -1
  608. package/textarea/basewebAdapters.js +2 -2
  609. package/textarea/textarea.js +2 -2
  610. package/textarea/types.d.ts +2 -2
  611. package/theme/Provider.d.ts +10 -0
  612. package/theme/Provider.js +65 -0
  613. package/theme/context.d.ts +1 -10
  614. package/theme/context.js +1 -61
  615. package/theme/index.d.ts +1 -0
  616. package/theme/index.js +1 -0
  617. package/time-picker/TimePicker.js +4 -1
  618. package/time-range-picker/RangeSelectorContainer.js +1 -1
  619. package/time-range-picker/TimeRangePicker.js +19 -11
  620. package/time-range-picker/index.d.ts +1 -1
  621. package/time-range-picker/index.js +4 -1
  622. package/time-range-picker/types.d.ts +1 -2
  623. package/time-range-picker/utils.d.ts +33 -4
  624. package/time-range-picker/utils.js +53 -17
  625. package/time-zone-picker/types.d.ts +2 -0
  626. package/tooltip/overrides.js +0 -1
  627. package/tooltip/stateful-tooltip.js +2 -2
  628. package/tooltip/tooltip.d.ts +1 -1
  629. package/tooltip/tooltip.js +5 -2
  630. package/tooltip/types.d.ts +2 -0
  631. package/tsconfig.tsbuildinfo +1 -1
  632. package/types.d.ts +2 -1
  633. package/typography/Typography.js +14 -1
  634. package/typography/constants.d.ts +56 -0
  635. package/typography/constants.js +57 -1
  636. package/typography/index.d.ts +1 -0
  637. package/typography/index.js +3 -1
  638. package/typography/styled-components.js +11 -3
  639. package/typography/types.d.ts +1 -1
  640. package/utils/intlNumberFormatUtils/index.d.ts +7 -0
  641. package/utils/intlNumberFormatUtils/index.js +40 -0
  642. package/utils/intlNumberFormatUtils/types.d.ts +21 -0
  643. package/utils/intlNumberFormatUtils/types.js +9 -0
  644. package/utils/package.json +4 -0
  645. package/esm/icon/components/chevron-right-solid.d.ts +0 -3
  646. package/esm/icon/components/chevron-right-solid.js +0 -6
  647. package/icon/components/chevron-right-solid.d.ts +0 -3
  648. package/icon/components/chevron-right-solid.js +0 -9
@@ -1,5 +1,5 @@
1
1
  import { __assign, __rest } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Select as BaseSelect } from 'baseui/select';
4
4
  import * as React from 'react';
5
5
  import withThemeOverride from '../helpers/baseui/withThemeOverride';
@@ -8,6 +8,10 @@ import { useLocale } from '../locale';
8
8
  import MenuItem from '../menu/menu-item';
9
9
  import { styled } from '../style';
10
10
  import { getComponentSizeTheme } from '../helpers/themeHelpers';
11
+ import _omit from 'lodash/omit';
12
+ import { useUID } from 'react-uid';
13
+ import { HiddenElement } from './utils/hidden-element';
14
+ import getInterpolatedString from 'baseui/helpers/i18n-interpolation';
11
15
  var StyledSelect = withThemeOverride(BaseSelect, function (theme) { return ({
12
16
  borders: {
13
17
  inputBorderRadius: theme.input.borderRadius,
@@ -50,16 +54,10 @@ export var StyledInputContainer = styled('div', 'relative inline-block bg-transp
50
54
  };
51
55
  });
52
56
  export var StyledInput = styled('input', 'bg-transparent border-none inline-block m-0 p-0 max-w-full box-content outline-none', function (_, props) {
53
- var $searchable = props.$searchable, $width = props.$width;
54
- return {
55
- color: 'inherit',
56
- lineHeight: 'inherit',
57
- fontSize: 'inherit',
58
- fontWeight: 'inherit',
59
- letterSpacing: 'normal',
60
- width: !$searchable ? '1px' : $width || '100%',
61
- boxShadow: 'none',
62
- };
57
+ var $searchable = props.$searchable, $width = props.$width, $disabled = props.$disabled;
58
+ return __assign({ color: 'inherit', lineHeight: 'inherit', fontSize: 'inherit', fontWeight: 'inherit', letterSpacing: 'normal', width: !$searchable ? '1px' : $width || '100%', boxShadow: 'none', '::placeholder': {
59
+ color: 'transparent',
60
+ } }, ($disabled ? { '-webkit-text-fill-color': 'transparent' } : {}));
63
61
  });
64
62
  var DEFAULT_OVERLAY_WIDTH = '300px';
65
63
  var StyledOverlayContentContainer = styled('div', 'overflow-auto', function (_a, _b) {
@@ -67,13 +65,39 @@ var StyledOverlayContentContainer = styled('div', 'overflow-auto', function (_a,
67
65
  var $overlayWidth = _b.$overlayWidth;
68
66
  return (__assign({ width: $overlayWidth || DEFAULT_OVERLAY_WIDTH }, borderRadius('inherit')));
69
67
  });
68
+ var getCommaSeparatedValues = function (value, labelKey, locale) {
69
+ var commaSeparatedValues = value === null || value === void 0 ? void 0 : value.map(function (val) { return val[labelKey]; }).join(',');
70
+ return value && value.length > 0
71
+ ? "".concat(getInterpolatedString(locale.select.selectedValuesPrefix, { values: commaSeparatedValues }))
72
+ : '';
73
+ };
70
74
  var InputContainer = function (_a) {
71
- var menuId = _a.menuId, size = _a.size, props = __rest(_a, ["menuId", "size"]);
72
- return (_jsx(StyledInputContainer, __assign({}, props, { "$selectSize": size, role: props.$searchable ? undefined : 'combobox', "aria-haspopup": props.$searchable ? null : 'listbox', "aria-owns": !props.$searchable && props.$isOpen ? menuId : null }), void 0));
75
+ var _b;
76
+ var menuId = _a.menuId, size = _a.size, $value = _a.$value, $labelKey = _a.$labelKey, placeholder = _a.placeholder, props = __rest(_a, ["menuId", "size", "$value", "$labelKey", "placeholder"]);
77
+ var locale = useLocale();
78
+ var commaSeparatedValues = getCommaSeparatedValues($value, $labelKey, locale);
79
+ var baseAriaDescribedBy = (_b = props['aria-describedby']) !== null && _b !== void 0 ? _b : '';
80
+ var selectedValuesId = useUID();
81
+ var ariaDescribedBy = commaSeparatedValues ? "".concat(selectedValuesId, " ").concat(baseAriaDescribedBy) : baseAriaDescribedBy;
82
+ var containerRef = React.useRef(null);
83
+ if (!props.$searchable) {
84
+ return (_jsxs(_Fragment, { children: [commaSeparatedValues ? _jsx(HiddenElement, __assign({ id: selectedValuesId }, { children: commaSeparatedValues }), void 0) : null, _jsx(StyledInputContainer, __assign({}, props, { "$selectSize": size, "aria-owns": props.$isOpen ? menuId : null, "aria-describedby": ariaDescribedBy, "aria-expanded": props.$isOpen, role: "combobox", ref: containerRef, "aria-placeholder": placeholder !== null && placeholder !== void 0 ? placeholder : locale.select.selectPlaceholder, "aria-haspopup": "listbox" }, { children: props.children
85
+ ? React.cloneElement(React.Children.only(props.children), { onFocus: function () { var _a; return (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } })
86
+ : null }), void 0)] }, void 0));
87
+ }
88
+ else {
89
+ return _jsx(StyledInputContainer, __assign({}, props, { "$selectSize": size }), void 0);
90
+ }
73
91
  };
74
92
  var Input = React.forwardRef(function (_a, ref) {
75
- var id = _a.id, menuId = _a.menuId, props = __rest(_a, ["id", "menuId"]);
76
- return (_jsx(StyledInput, __assign({}, props, { id: id, "aria-controls": props.$searchable && props.$isOpen ? menuId : null, ref: ref }), void 0));
93
+ var _b;
94
+ var id = _a.id, menuId = _a.menuId, placeholder = _a.placeholder, $value = _a.$value, $labelKey = _a.$labelKey, props = __rest(_a, ["id", "menuId", "placeholder", "$value", "$labelKey"]);
95
+ var locale = useLocale();
96
+ var commaSeparatedValues = getCommaSeparatedValues($value, $labelKey, locale);
97
+ var baseAriaDescribedBy = (_b = props['aria-describedby']) !== null && _b !== void 0 ? _b : '';
98
+ var selectedValuesId = useUID();
99
+ var ariaDescribedBy = commaSeparatedValues || props['aria-label'] ? "".concat(selectedValuesId, " ").concat(baseAriaDescribedBy) : baseAriaDescribedBy;
100
+ return (_jsxs(_Fragment, { children: [commaSeparatedValues || props['aria-label'] ? (_jsx(HiddenElement, __assign({ id: selectedValuesId }, { children: "".concat(commaSeparatedValues, " ").concat(props['aria-label'] || '') }), void 0)) : null, _jsx(StyledInput, __assign({}, _omit(props, 'aria-label'), { id: id, "aria-controls": props.$searchable && props.$isOpen ? menuId : null, ref: ref, "aria-describedby": ariaDescribedBy, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : locale.select.selectPlaceholder }), void 0)] }, void 0));
77
101
  });
78
102
  export { StyledRoot, StyledClearIcon, StyledControlContainer, StyledDropdownContainer, StyledIconsContainer, StyledInputSizer, StyledPlaceholder, StyledSearchIconContainer, StyledSelectArrow, StyledSingleValue, StyledValueContainer, } from 'baseui/select';
79
103
  export { StyledSelect, NoResults, StyledOverlayContentContainer, InputContainer, Input };
@@ -7,7 +7,10 @@ import { Intent, SpacewebComponentProps } from '../types';
7
7
  import { PopoverProps } from '../popover/types';
8
8
  import { ValueOf } from '../utility-types';
9
9
  import { Value } from 'baseui/select/types';
10
- export declare type Size = 'sm' | 'md' | 'lg';
10
+ /**
11
+ * lg size is deprecated. Please use md.
12
+ */
13
+ export declare type Size = 'xxxs' | 'xs' | 'sm' | 'md' | 'lg';
11
14
  export declare type Type = 'select' | 'search';
12
15
  declare type OverridableComponent = keyof Omit<BaseuiSelectOverrides, 'Dropdown' | 'DropdownListItem' | 'DropdownOption'> | 'Menu' | 'MenuItem' | 'NoResults' | 'Divider' | 'ListItemText' | 'OverlayContentContainer';
13
16
  export declare type SelectActions = {
@@ -34,12 +37,27 @@ export declare type BaseSelectProps = SpacewebComponentProps<Omit<BaseuiSelectPr
34
37
  onPaste?: (event: React.ClipboardEvent) => Options | undefined;
35
38
  virtual?: boolean;
36
39
  ignoreBoundary?: boolean;
40
+ delimiter?: string;
41
+ clearAsOption?: boolean;
42
+ clearAsOptionLabel?: string;
43
+ selectOnTab?: boolean;
44
+ /**
45
+ * This is an internal prop being used in AsyncSelect. Not meant for consumer.
46
+ * If true, selectAll event won't return all options in values.
47
+ */
48
+ __selectAllShouldReturnAllOptions?: boolean;
49
+ /**
50
+ * This is an internal prop being used in AsyncSelect.
51
+ * Selected state of SelectAll option will be decided based on this prop if __selectAllShouldReturnAllOptions is true.
52
+ */
53
+ __selectAllSelected?: boolean;
37
54
  };
38
55
  declare type Merge<A, B> = Omit<A, keyof B> & B;
39
56
  export declare type OverlaySelectProps = Merge<BaseSelectProps, {
40
57
  type: 'overlay';
41
58
  overlayWidth?: string;
42
59
  children: PopoverProps['children'];
60
+ scrollContainer?: 'overlayContainer' | 'menuContainer';
43
61
  }>;
44
62
  export declare type MobileSelectProps = Merge<OverlaySelectProps, {
45
63
  type: 'mobile';
@@ -79,8 +97,12 @@ export declare type DropdownProps = Omit<BaseDropdownProps, 'overrides' | 'size'
79
97
  type?: Type;
80
98
  };
81
99
  export declare const SELECT_ALL_ID = "__selectAll";
100
+ export declare const CLEAR_OPTION_ID = "__clear";
82
101
  declare type RemoveValue = () => void;
83
102
  export declare type MultiValueProps = Omit<TagProps, 'overrides'> & SharedProps & {
103
+ $isContainerFocused?: boolean;
104
+ $valueByIdMap: Record<string, Option>;
105
+ $valueKey: string;
84
106
  value: Option;
85
107
  removeValue: RemoveValue;
86
108
  selectSize: Size;
@@ -1 +1,2 @@
1
1
  export var SELECT_ALL_ID = '__selectAll';
2
+ export var CLEAR_OPTION_ID = '__clear';
@@ -1 +1,2 @@
1
- export { default as filterOptions } from 'baseui/select/utils/default-filter-options';
1
+ import defaultFilterOptions from 'baseui/select/utils/default-filter-options';
2
+ export declare const filterOptions: typeof defaultFilterOptions;
@@ -1,2 +1,6 @@
1
+ import { __assign } from "tslib";
1
2
  // todo: no deep import
2
- export { default as filterOptions } from 'baseui/select/utils/default-filter-options';
3
+ import defaultFilterOptions from 'baseui/select/utils/default-filter-options';
4
+ export var filterOptions = function (options, filterValue, excludeOptions, newProps) {
5
+ return defaultFilterOptions(options, filterValue, excludeOptions, __assign({ matchProp: 'label' }, newProps));
6
+ };
@@ -0,0 +1,6 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ declare const HiddenElement: ({ id, children }: {
3
+ id: string;
4
+ children?: ReactNode;
5
+ }) => ReactElement;
6
+ export { HiddenElement };
@@ -0,0 +1,16 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ var HiddenElement = function (_a) {
4
+ var id = _a.id, children = _a.children;
5
+ return (_jsx("div", __assign({ id: id, style: {
6
+ border: 0,
7
+ clip: 'rect(0 0 0 0)',
8
+ height: '0px',
9
+ margin: '-1px',
10
+ overflow: 'hidden',
11
+ padding: 0,
12
+ position: 'absolute',
13
+ width: '0px',
14
+ } }, { children: children }), void 0));
15
+ };
16
+ export { HiddenElement };
@@ -0,0 +1,2 @@
1
+ import { Options, Value } from '../types';
2
+ export declare function mergeOptions(valueKey: string, options1?: Options, options2?: Options): Value;
@@ -0,0 +1,18 @@
1
+ import { __read, __spreadArray } from "tslib";
2
+ import { normalizeOptions } from 'baseui/select/utils';
3
+ import { UNGROUPED_ID } from '../constants';
4
+ function removeDuplicates(valueKey, options) {
5
+ var keySet = new Set();
6
+ return options.filter(function (opt) {
7
+ var key = (opt.__optgroup || UNGROUPED_ID) + opt[valueKey];
8
+ var shouldAdd = !keySet.has(key);
9
+ keySet.add(key);
10
+ return shouldAdd;
11
+ });
12
+ }
13
+ export function mergeOptions(valueKey, options1, options2) {
14
+ if (options1 === void 0) { options1 = []; }
15
+ if (options2 === void 0) { options2 = []; }
16
+ var optArr1 = normalizeOptions(options1), optArr2 = normalizeOptions(options2);
17
+ return removeDuplicates(valueKey, __spreadArray(__spreadArray([], __read(optArr1), false), __read(optArr2), false));
18
+ }
@@ -0,0 +1 @@
1
+ export declare const getSelectedOptions: (container?: HTMLElement | undefined) => (string | null)[];
@@ -0,0 +1,7 @@
1
+ import { getAllByTestId, screen } from '@testing-library/react';
2
+ export var getSelectedOptions = function (container) {
3
+ var elements = container
4
+ ? getAllByTestId(container, 'combobox-selected-value')
5
+ : screen.getAllByTestId('combobox-selected-value');
6
+ return elements.map(function (item) { return item.textContent; });
7
+ };
@@ -4,7 +4,7 @@ import { borderRadius, borderColor } from '../helpers/longHandHelpers';
4
4
  import { intentColor } from '../helpers/intentHelper';
5
5
  import { hex2rgb } from '../helpers';
6
6
  var addOpacity = function (token, opacity) {
7
- return token.includes('rgb') ? token.split(')')[0] + opacity + ')' : hex2rgb(token, opacity);
7
+ return token.includes('rgb') ? "".concat(token.split(')')[0] + opacity, ")") : hex2rgb(token, opacity);
8
8
  };
9
9
  var secondaryIntentColor = function (_a, _b) {
10
10
  var theme = _a.theme;
@@ -23,13 +23,13 @@ var secondaryIntentColor = function (_a, _b) {
23
23
  export var getInnerTrackStyles = [
24
24
  'w-full self-center',
25
25
  function (_a, _b) {
26
- var theme = _a.theme, direction = _a.direction, px2rem = _a.px2rem;
26
+ var theme = _a.theme, px2rem = _a.px2rem;
27
27
  var $disabled = _b.$disabled, $value = _b.$value, $min = _b.$min, $max = _b.$max, $intent = _b.$intent;
28
28
  var intentPrimary = intentColor({ theme: theme }, { $intent: $intent });
29
29
  var intentSecondary = secondaryIntentColor({ theme: theme }, { $intent: $intent });
30
30
  var scaledValue = $value.map(function (value) { return ((value - $min) / ($max - $min)) * 100; });
31
- var gradientDirection = direction === 'rtl' ? 'to left' : 'to right';
32
- return __assign({ background: scaledValue.length == 1
31
+ var gradientDirection = 'to right';
32
+ return __assign({ background: scaledValue.length === 1
33
33
  ? "linear-gradient(".concat(gradientDirection, ", \n ").concat(intentPrimary, " ").concat(scaledValue[0], "%, \n ").concat(intentSecondary, " ").concat(scaledValue[0], "%)")
34
34
  : "linear-gradient(".concat(gradientDirection, ", \n ").concat(intentSecondary, " ").concat(scaledValue[0], "%,\n ").concat(intentPrimary, " ").concat(scaledValue[0], "% ").concat(scaledValue[1], "%, \n ").concat(intentSecondary, " ").concat(scaledValue[1], "%)"), opacity: $disabled ? '0.6' : '1', height: px2rem('6px'), cursor: $disabled ? 'not-allowed' : 'inherit' }, borderRadius('6px'));
35
35
  },
@@ -11,6 +11,7 @@ import { INTENT_TO_ICON, TYPE_TO_HIDE_DURATION } from './constants';
11
11
  import { LayersManager, Z_INDEX } from '../layer';
12
12
  import { StyledContentContainer, StyledIconsContainer, StyledMessage, StyledPlacementContainer, StyledSnackbarContainer, getIconStyles, } from './styled-component';
13
13
  import useSnackbar from './useSnackbar';
14
+ import { useLocale } from '../locale';
14
15
  var Snackbar = function (_a) {
15
16
  var _b = _a.intent, _intent = _b === void 0 ? 'success' : _b, _message = _a.message, _c = _a.disableManualClose, disableManualClose = _c === void 0 ? false : _c, _d = _a.placement, placement = _d === void 0 ? 'bottom' : _d, _e = _a.autoHide, autoHide = _e === void 0 ? true : _e, _f = _a.autoHideDuration, autoHideDuration = _f === void 0 ? TYPE_TO_HIDE_DURATION[_intent] : _f, _g = _a.hideOnClickAway, hideOnClickAway = _g === void 0 ? true : _g, overrides = _a.overrides, _h = _a.onClose, onClose = _h === void 0 ? _noop : _h;
16
17
  var _j = useSnackbar({
@@ -40,18 +41,17 @@ var Snackbar = function (_a) {
40
41
  var _r = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.IntentIcon, IntentIconComponent), 2), IntentIcon = _r[0], intentIconProps = _r[1];
41
42
  var _s = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.CloseIcon, CloseIcon), 2), Close = _s[0], closeProps = _s[1];
42
43
  var _t = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.CloseIconButton, IconButton)), CloseIconButton = _t[0], closeIconButtonProps = _t.slice(1);
43
- return shouldRender ? (_jsx(LayersManager, __assign({ zIndex: Z_INDEX.SNACKBAR }, { children: _jsx(Layer, __assign({}, sharedProps, layerProps, { children: _jsx(PlacementContainer, __assign({ "data-spaceweb": "snackbar", "data-testid": "snackbar" }, sharedProps, placementContainerProps, { children: _jsxs(SnackbarContainer, __assign({}, snackbarContainerProps, { ref: snackbarContainerRef, role: "alert" }, sharedProps, snackbarContainerOverrideProps, { children: [_jsxs(ContentContainer, __assign({}, sharedProps, contentContainerProps, { children: [_jsx(IconsContainer, __assign({}, sharedProps, iconsContainerProps, { children: _jsx(IntentIcon, __assign({ size: 30, className: getIconStyles }, sharedProps, intentIconProps), void 0) }), void 0), _jsx(Message, __assign({ "aria-atomic": true, "aria-live": "assertive" }, sharedProps, messageProps, { children: isValidElement(message) ? cloneElement(message) : message }), void 0)] }), void 0), !disableManualClose && (_jsx(CloseIconButton, __assign({ shape: "square", className: [
44
- 'cursor-pointer absolute h-4 w-4 rounded-2 min-w-0 border-0',
45
- {
46
- top: '1rem',
47
- right: '1rem',
48
- ':focus': {
49
- backgroundColor: '#48484C',
44
+ var locale = useLocale();
45
+ return shouldRender ? (_jsx(LayersManager, __assign({ zIndex: Z_INDEX.SNACKBAR }, { children: _jsx(Layer, __assign({}, sharedProps, layerProps, { children: _jsx(PlacementContainer, __assign({ "data-spaceweb": "snackbar", "data-testid": "snackbar" }, sharedProps, placementContainerProps, { children: _jsx(SnackbarContainer, __assign({}, snackbarContainerProps, { ref: snackbarContainerRef, role: "alert" }, sharedProps, snackbarContainerOverrideProps, { children: _jsxs(ContentContainer, __assign({}, sharedProps, contentContainerProps, { children: [_jsx(IconsContainer, __assign({}, sharedProps, iconsContainerProps, { children: _jsx(IntentIcon, __assign({ size: 14, className: getIconStyles }, sharedProps, intentIconProps), void 0) }), void 0), _jsx(Message, __assign({ "aria-atomic": true, "aria-live": "assertive" }, sharedProps, messageProps, { children: isValidElement(message) ? cloneElement(message) : message }), void 0), !disableManualClose && (_jsx(CloseIconButton, __assign({ shape: "square", className: [
46
+ 'cursor-pointer h-4 w-4 ml-3 rounded-2 min-w-0 border-0 flex-shrink-0',
47
+ {
48
+ ':focus': {
49
+ backgroundColor: '#48484C',
50
+ },
51
+ ':hover': {
52
+ backgroundColor: '#48484C',
53
+ },
50
54
  },
51
- ':hover': {
52
- backgroundColor: '#48484C',
53
- },
54
- },
55
- ], onClick: function () { return handleClose('manualClose'); } }, sharedProps, closeIconButtonProps, { children: _jsx(Close, __assign({ "data-testid": "snackbar-close", size: 10, className: { fill: '#A0A0A8' } }, sharedProps, closeProps), void 0) }), void 0))] }), void 0) }), void 0) }), void 0) }), void 0)) : null;
55
+ ], onClick: function () { return handleClose('manualClose'); }, "aria-label": locale.snackbar.closeAriaLabel }, sharedProps, closeIconButtonProps, { children: _jsx(Close, __assign({ "data-testid": "snackbar-close", size: 10, className: { fill: '#A0A0A8' } }, sharedProps, closeProps), void 0) }), void 0))] }), void 0) }), void 0) }), void 0) }), void 0) }), void 0)) : null;
56
56
  };
57
57
  export default Snackbar;
@@ -56,25 +56,28 @@ export var StyledPlacementContainer = styled('div', 'flex flex-col fixed right-0
56
56
  export var StyledSnackbarContainer = styled('div', 'pointer-events-auto flex spr-shadow-01 overflow-hidden rounded-8 relative', function (_a) {
57
57
  var px2rem = _a.px2rem;
58
58
  return ({
59
- minHeight: px2rem(80),
59
+ minHeight: px2rem(52),
60
60
  maxWidth: px2rem(432),
61
61
  minWidth: px2rem(250),
62
62
  });
63
63
  });
64
- export var StyledIconsContainer = styled('div', 'flex items-center justify-center rounded-full', function (_a) {
64
+ export var StyledIconsContainer = styled('div', 'flex items-center justify-center rounded-8', function (_a) {
65
65
  var px2rem = _a.px2rem;
66
66
  return ({
67
- width: px2rem(30),
68
- height: px2rem(30),
67
+ width: px2rem(14),
68
+ height: px2rem(14),
69
69
  });
70
70
  });
71
- export var StyledContentContainer = styled('div', 'py-6 px-8 overflow-hidden flex items-center flex-1', function (_a) {
71
+ export var StyledContentContainer = styled('div', 'py-2 px-3 overflow-hidden flex items-center flex-1', function (_a) {
72
72
  var theme = _a.theme;
73
73
  return ({
74
74
  backgroundColor: theme.name.includes('dark') ? theme.spr.ui05 : '#212123',
75
75
  });
76
76
  });
77
- export var StyledMessage = styled('div', 'typography-bs1 ml-3 flex-1 flex items-center spr-text-05');
77
+ export var StyledMessage = styled('div', 'font-500 text-14 ml-3 flex-1 flex items-center spr-text-05', {
78
+ lineHeight: '18px',
79
+ wordBreak: 'break-word',
80
+ });
78
81
  export var getIconStyles = function (utils, props) { return ({
79
82
  fill: intentColor(utils, props, utils.theme.supportSuccess),
80
83
  }); };
@@ -8,6 +8,7 @@ export declare type Props = {
8
8
  children: ReactNode;
9
9
  debug?: boolean;
10
10
  direction?: Direction;
11
+ langCode?: string;
11
12
  styleEngine?: StandardEngine;
12
13
  layersZIndex?: number;
13
14
  overrides?: {
@@ -17,6 +18,7 @@ export declare type Props = {
17
18
  theme: ThemeModule;
18
19
  locale?: React.ComponentProps<typeof LocaleProvider>['locale'];
19
20
  ownerDocument?: Document;
21
+ density?: 'COMPACT' | 'COMFORTABLE' | 'SPACIOUS' | 'DEFAULT' | undefined;
20
22
  };
21
23
  declare function SpacewebProviderWithDoc({ ownerDocument, children, ...rest }: Props): ReactElement;
22
24
  export default SpacewebProviderWithDoc;
@@ -6,26 +6,26 @@ import { initFocusVisible, teardown } from 'baseui/utils/focusVisible';
6
6
  import { DocumentProvider, useDocument } from './DocumentProvider';
7
7
  import { StyleProvider, getStyleEngine } from '../styleEngine';
8
8
  import BASEWEB_THEMES from '../themes';
9
- import { isServer } from './utils';
10
9
  import { LocaleProvider } from '../locale';
11
10
  import { LAYERS_DEFAULT_ZINDEX, LayersManager } from '../layer';
12
- import { ThemeProvider } from '../theme';
11
+ import { ThemeProvider, useTheme } from '../theme';
13
12
  function SpacewebProvider(props) {
14
- var children = props.children, _a = props.direction, direction = _a === void 0 ? 'ltr' : _a, _b = props.layersZIndex, layersZIndex = _b === void 0 ? LAYERS_DEFAULT_ZINDEX : _b, overrides = props.overrides, theme = props.theme, locale = props.locale, _c = props.debug, debug = _c === void 0 ? false : _c;
13
+ var children = props.children, _a = props.layersZIndex, layersZIndex = _a === void 0 ? LAYERS_DEFAULT_ZINDEX : _a, overrides = props.overrides, theme = props.theme, locale = props.locale, _b = props.debug, debug = _b === void 0 ? false : _b, density = props.density, langCode = props.langCode;
15
14
  var doc = useDocument();
16
15
  var styleEngine = props.styleEngine || getStyleEngine(doc);
17
16
  // TODO: This must be removed once baseui code exposes focusVisible from utils/index
18
17
  // https://github.com/uber/baseweb/issues/3322
19
18
  useEffect(function () {
20
- if (!isServer) {
21
- initFocusVisible({ ownerDocument: doc });
22
- return function () { return teardown(doc); };
23
- }
24
- return undefined;
19
+ initFocusVisible({ ownerDocument: doc });
20
+ return function () { return teardown(doc); };
21
+ // eslint-disable-next-line react-hooks/exhaustive-deps
25
22
  }, []);
23
+ var outerTheme = useTheme();
24
+ var direction = props.direction || outerTheme.direction || 'ltr';
25
+ var localeValue = useMemo(function () { return (__assign(__assign({}, locale), { langCode: langCode })); }, [locale, langCode]);
26
26
  var themeValue = useMemo(function () { return (__assign(__assign({}, theme), { direction: direction })); }, [theme, direction]);
27
27
  var baseProviderTheme = useMemo(function () { return (__assign(__assign({}, BASEWEB_THEMES[theme.theme.name]), { direction: direction })); }, [direction, theme]);
28
- return (_jsx(StyleProvider, __assign({ debug: debug, styleEngine: styleEngine }, { children: _jsx(ThemeProvider, __assign({ theme: themeValue, containerElement: doc === null || doc === void 0 ? void 0 : doc.documentElement }, { children: _jsx(LocaleProvider, __assign({ locale: locale }, { children: _jsx(CustomBaseProvider, __assign({ overrides: overrides, theme: baseProviderTheme }, { children: _jsx(LayersManager, __assign({ zIndex: layersZIndex, host: doc === null || doc === void 0 ? void 0 : doc.body }, { children: children }), void 0) }), void 0) }), void 0) }), void 0) }), void 0));
28
+ return (_jsx(StyleProvider, __assign({ debug: debug, styleEngine: styleEngine }, { children: _jsx(ThemeProvider, __assign({ theme: themeValue, containerElement: doc === null || doc === void 0 ? void 0 : doc.documentElement, density: density }, { children: _jsx(LocaleProvider, __assign({ locale: localeValue }, { children: _jsx(CustomBaseProvider, __assign({ overrides: overrides, theme: baseProviderTheme }, { children: _jsx(LayersManager, __assign({ zIndex: layersZIndex, host: doc === null || doc === void 0 ? void 0 : doc.body }, { children: children }), void 0) }), void 0) }), void 0) }), void 0) }), void 0));
29
29
  }
30
30
  function SpacewebProviderWithDoc(_a) {
31
31
  var ownerDocument = _a.ownerDocument, children = _a.children, rest = __rest(_a, ["ownerDocument", "children"]);
@@ -22,23 +22,16 @@ var getStackClassNames = function (props) {
22
22
  var direction = props.direction, gap = props.gap;
23
23
  var _a = modifyGapParam(gap), prefix = _a.prefix, gapVal = _a.gapVal;
24
24
  var stackClassName = [direction === 'horizontal' ? 'flex flex-row' : 'flex flex-col'];
25
- var stackItemClassName = [
26
- function (_a) {
27
- var themeDirection = _a.direction;
28
- var marginDir = themeDirection === 'rtl' ? 'mr' : 'ml';
29
- return direction === 'horizontal' ? "".concat(prefix).concat(marginDir, "-").concat(gapVal) : "".concat(prefix, "mt-").concat(gapVal);
30
- },
31
- ];
25
+ var stackItemClassName = [direction === 'horizontal' ? "".concat(prefix, "ml-").concat(gapVal) : "".concat(prefix, "mt-").concat(gapVal)];
32
26
  BREAKPOINTS.forEach(function (bp) {
33
27
  if (props[bp]) {
34
28
  stackClassName.push(props[bp].direction === 'horizontal' ? "".concat(bp, ":flex ").concat(bp, ":flex-row") : "".concat(bp, ":flex ").concat(bp, ":flex-col"));
35
- var _a = modifyGapParam(props[bp].gap), prefix_1 = _a.prefix, gapVal_1 = _a.gapVal;
36
- stackItemClassName.push(function (_a) {
37
- var themeDirection = _a.direction;
38
- var marginDir = themeDirection === 'rtl' ? 'mr' : 'ml';
29
+ var _a = modifyGapParam(props[bp].gap), prefixBp_1 = _a.prefix, gapValBp_1 = _a.gapVal;
30
+ stackItemClassName.push(function () {
31
+ var marginDir = 'ml';
39
32
  return props[bp].direction === 'horizontal'
40
- ? "".concat(bp, ":").concat(prefix_1).concat(marginDir, "-").concat(gapVal_1, " ").concat(bp, ":mt-0")
41
- : "".concat(bp, ":").concat(prefix_1, "mt-").concat(gapVal_1, " ").concat(bp, ":").concat(marginDir, "-0");
33
+ ? "".concat(bp, ":").concat(prefixBp_1).concat(marginDir, "-").concat(gapValBp_1, " ").concat(bp, ":mt-0")
34
+ : "".concat(bp, ":").concat(prefixBp_1, "mt-").concat(gapValBp_1, " ").concat(bp, ":").concat(marginDir, "-0");
42
35
  });
43
36
  }
44
37
  });
@@ -1,4 +1,4 @@
1
1
  import { StyleUtils, ThemeContext, StyleObject } from '../types';
2
2
  declare type StyletronCSS = (arg: StyleObject) => string;
3
- declare const _default: (ctx: ThemeContext, styletronCSS: StyletronCSS) => StyleUtils;
3
+ declare const _default: (_ctx: ThemeContext, styletronCSS: StyletronCSS) => StyleUtils;
4
4
  export default _default;
@@ -2,7 +2,9 @@ import { __assign } from "tslib";
2
2
  import _getStyle from './_getStyle';
3
3
  import _css from './_css';
4
4
  import _px2rem from './_px2rem';
5
- export default (function (ctx, styletronCSS) {
5
+ export default (function (_ctx, styletronCSS) {
6
+ // console.log('theme', _ctx.theme);
7
+ var ctx = __assign(__assign({}, _ctx), { isRTL: _ctx.direction === 'rtl' });
6
8
  var css = _css.bind(null, ctx, styletronCSS);
7
9
  var getStyle = _getStyle.bind(null, ctx);
8
10
  var px2rem = _px2rem.bind(null, ctx);
@@ -25,7 +25,7 @@ var _parseStyle = function (utils, props) {
25
25
  for (var _i = 2; _i < arguments.length; _i++) {
26
26
  args[_i - 2] = arguments[_i];
27
27
  }
28
- var invalidArgs = [];
28
+ var invalidArgs = [], directionStyleObject;
29
29
  if (!args.length)
30
30
  return [{}, invalidArgs];
31
31
  var styleObject = flattenDeep(args).reduce(function (mergedStyleObject, arg) {
@@ -63,6 +63,11 @@ var _parseStyle = function (utils, props) {
63
63
  }
64
64
  return _merge(mergedStyleObject, arg);
65
65
  }, {});
66
- return [styleObject, invalidArgs];
66
+ /**
67
+ * merging directionStyles at last to make sure priority of styles with ltr/rtl pseudo selector is more.
68
+ * e.g. `rtl:ml-2 ml-3` -> ml-2 should be applied when direction is rtl
69
+ */
70
+ var styleObjectWithRtlStyles = directionStyleObject ? _merge(styleObject, directionStyleObject) : styleObject;
71
+ return [styleObjectWithRtlStyles, invalidArgs];
67
72
  };
68
73
  export default _parseStyle;
@@ -1,14 +1,19 @@
1
1
  import { __read } from "tslib";
2
2
  import { useStyletron } from 'baseui';
3
3
  import { useCallback } from 'react';
4
+ import rtlCSSJS from 'rtl-css-js';
4
5
  import { useLatest } from '../hooks/useLatest';
6
+ import { useTheme } from '../theme/context';
7
+ var identity = function (x) { return x; };
5
8
  /**
6
9
  * styletron returns new `styletronCSS` function each time the hook is called. This hook memorizes the css function and returns same reference every time.
7
10
  */
8
11
  var useMemoizedStyletron = function () {
9
12
  var _a = __read(useStyletron(), 2), styletronCSS = _a[0], theme = _a[1];
13
+ var ctx = useTheme();
10
14
  var cssRef = useLatest(styletronCSS);
11
- var css = useCallback(function (arg) { return cssRef.current(arg); }, [cssRef]);
15
+ var decorator = ctx.direction === 'rtl' ? rtlCSSJS : identity;
16
+ var css = useCallback(function (arg) { return cssRef.current(decorator(arg)); }, [cssRef, decorator]);
12
17
  return [css, theme];
13
18
  };
14
19
  export default useMemoizedStyletron;
@@ -33,16 +33,16 @@ export var getToggleTrackOverrides = function (utils, props) {
33
33
  break;
34
34
  }
35
35
  return getStyle([
36
- 'box-border border-1 m-0 border-transparent border-solid',
36
+ 'box-border border-1 m-0 border-transparent border-solid flex-none',
37
37
  ($isHovered || $isFocusVisible) && !$checked && !$disabled ? 'spr-border-06' : '',
38
38
  $isFocusVisible ? 'outline-01' : '',
39
39
  styles,
40
40
  ]);
41
41
  };
42
42
  export var getToggleOverrides = function (utils, props) {
43
- var px2rem = utils.px2rem, direction = utils.direction, theme = utils.theme, getStyle = utils.getStyle;
43
+ var px2rem = utils.px2rem, theme = utils.theme, getStyle = utils.getStyle;
44
44
  var $size = props.$size, $checked = props.$checked, $disabled = props.$disabled, $isFocusVisible = props.$isFocusVisible;
45
- var styles = __assign(__assign(__assign({ backgroundColor: $disabled ? theme.spr.ui03 : theme.spr.ui01, height: px2rem(12), width: px2rem(12) }, margin(px2rem(1))), borderRadius('50%')), { transform: $checked ? "translateX(".concat(direction === 'rtl' ? '-100%' : '100%', ")") : '', transition: 'transform 200ms', boxShadow: 'none' });
45
+ var styles = __assign(__assign(__assign({ backgroundColor: $disabled ? theme.spr.ui03 : theme.spr.ui01, height: px2rem(12), width: px2rem(12) }, margin(px2rem(1))), borderRadius('50%')), { transform: $checked ? 'translateX(100%)' : '', transition: 'transform 200ms', boxShadow: 'none' });
46
46
  switch ($size) {
47
47
  case 'lg':
48
48
  styles.height = styles.width = px2rem(16);
@@ -2,23 +2,30 @@ import { __assign, __rest } from "tslib";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useCallback, useMemo } from 'react';
4
4
  import { Avatar } from '../avatar';
5
- import { borderRadius } from '../helpers/longHandHelpers';
6
- import { getComponentTheme } from '../helpers/themeHelpers';
7
5
  import Tag from './tag';
8
- var tagRootStyles = function (_a) {
9
- var theme = _a.theme, px2rem = _a.px2rem;
10
- var tagBorderRadius = getComponentTheme(theme, 'multiSelect').tagBorderRadius;
11
- return __assign(__assign({}, (tagBorderRadius && borderRadius(tagBorderRadius))), { marginLeft: px2rem(4) });
12
- };
13
- var avatarRootStyles = function (_a) {
14
- var theme = _a.theme;
15
- var avatarMarginLeft = getComponentTheme(theme, 'tag').avatarMarginLeft;
16
- return { marginLeft: avatarMarginLeft };
17
- };
6
+ import { useStyle } from '../style';
7
+ import { getDefaultTagSize, getTagSizeTheme } from './utils';
18
8
  var AvatarTag = function (props) {
19
- var avatarProps = props.avatarProps, startEnhancer = props.startEnhancer, className = props.className, tagProps = __rest(props, ["avatarProps", "startEnhancer", "className"]);
20
- var startEnhancerOverride = useCallback(function (sharedProps) { return (_jsxs(_Fragment, { children: [typeof startEnhancer === 'function' ? startEnhancer(sharedProps) : startEnhancer, _jsx(Avatar, __assign({ size: "sm" }, avatarProps, { className: [avatarRootStyles, avatarProps === null || avatarProps === void 0 ? void 0 : avatarProps.className] }), void 0)] }, void 0)); }, [avatarProps, startEnhancer]);
21
- var mergedClassName = useMemo(function () { return [tagRootStyles, className]; }, [className]);
22
- return _jsx(Tag, __assign({ size: "lg", startEnhancer: startEnhancerOverride, className: mergedClassName }, tagProps), void 0);
9
+ var avatarProps = props.avatarProps, startEnhancer = props.startEnhancer, className = props.className, _size = props.size, tagProps = __rest(props, ["avatarProps", "startEnhancer", "className", "size"]);
10
+ var theme = useStyle().theme;
11
+ var size = _size !== null && _size !== void 0 ? _size : getDefaultTagSize(theme);
12
+ var avatarIconSize = getTagSizeTheme(theme, size).avatarIconSize;
13
+ var customTagOverrides = {
14
+ StartEnhancer: {
15
+ style: function (_a, _b) {
16
+ var $size = _b.$size;
17
+ return ($size === 'lg' ? { marginLeft: '8px' } : {});
18
+ },
19
+ },
20
+ Action: {
21
+ style: function (_a, _b) {
22
+ var $size = _b.$size;
23
+ return ($size === 'lg' ? { marginRight: '4px' } : {});
24
+ },
25
+ },
26
+ };
27
+ var startEnhancerOverride = useCallback(function (sharedProps) { return (_jsxs(_Fragment, { children: [typeof startEnhancer === 'function' ? startEnhancer(sharedProps) : startEnhancer, _jsx(Avatar, __assign({ size: avatarIconSize }, avatarProps, { className: [avatarProps === null || avatarProps === void 0 ? void 0 : avatarProps.className] }), void 0)] }, void 0)); }, [avatarProps, startEnhancer, avatarIconSize]);
28
+ var mergedClassName = useMemo(function () { return [className]; }, [className]);
29
+ return (_jsx(Tag, __assign({ overrides: customTagOverrides, size: size, startEnhancer: startEnhancerOverride, className: mergedClassName }, tagProps), void 0));
23
30
  };
24
31
  export default AvatarTag;