@doist/reactist 28.7.2 → 28.7.3

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 (467) hide show
  1. package/dist/reactist.cjs.development.js +2091 -3811
  2. package/dist/reactist.cjs.development.js.map +1 -1
  3. package/dist/reactist.cjs.production.min.js +1 -1
  4. package/dist/reactist.cjs.production.min.js.map +1 -1
  5. package/es/avatar/avatar.js +35 -30
  6. package/es/avatar/avatar.js.map +1 -1
  7. package/es/avatar/utils.js +19 -22
  8. package/es/avatar/utils.js.map +1 -1
  9. package/es/badge/badge.js +5 -16
  10. package/es/badge/badge.js.map +1 -1
  11. package/es/banner/banner.js +39 -115
  12. package/es/banner/banner.js.map +1 -1
  13. package/es/banner/banner.module.css.js +1 -1
  14. package/es/base-field/base-field.js +80 -162
  15. package/es/base-field/base-field.js.map +1 -1
  16. package/es/base-field/base-field.module.css.js +1 -1
  17. package/es/box/box.js +61 -137
  18. package/es/box/box.js.map +1 -1
  19. package/es/button/button.js +42 -95
  20. package/es/button/button.js.map +1 -1
  21. package/es/checkbox-field/checkbox-field.js +46 -73
  22. package/es/checkbox-field/checkbox-field.js.map +1 -1
  23. package/es/checkbox-field/checkbox-field.module.css.js +1 -1
  24. package/es/checkbox-field/checkbox-icon.js +28 -55
  25. package/es/checkbox-field/checkbox-icon.js.map +1 -1
  26. package/es/checkbox-field/use-fork-ref.js +29 -25
  27. package/es/checkbox-field/use-fork-ref.js.map +1 -1
  28. package/es/columns/columns.js +22 -46
  29. package/es/columns/columns.js.map +1 -1
  30. package/es/columns/columns.module.css.js +1 -1
  31. package/es/components/color-picker/color-picker.js +45 -66
  32. package/es/components/color-picker/color-picker.js.map +1 -1
  33. package/es/components/deprecated-button/deprecated-button.js +11 -34
  34. package/es/components/deprecated-button/deprecated-button.js.map +1 -1
  35. package/es/components/deprecated-dropdown/dropdown.js +136 -197
  36. package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
  37. package/es/components/deprecated-input/input.js +6 -10
  38. package/es/components/deprecated-input/input.js.map +1 -1
  39. package/es/components/deprecated-select/select.js +7 -31
  40. package/es/components/deprecated-select/select.js.map +1 -1
  41. package/es/components/key-capturer/key-capturer.js +130 -171
  42. package/es/components/key-capturer/key-capturer.js.map +1 -1
  43. package/es/components/keyboard-shortcut/keyboard-shortcut.js +48 -79
  44. package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  45. package/es/components/progress-bar/progress-bar.js +8 -20
  46. package/es/components/progress-bar/progress-bar.js.map +1 -1
  47. package/es/components/time/time-utils.js +52 -64
  48. package/es/components/time/time-utils.js.map +1 -1
  49. package/es/components/time/time.js +90 -114
  50. package/es/components/time/time.js.map +1 -1
  51. package/es/divider/divider.js +4 -13
  52. package/es/divider/divider.js.map +1 -1
  53. package/es/heading/heading.js +19 -28
  54. package/es/heading/heading.js.map +1 -1
  55. package/es/hidden/hidden.js +36 -45
  56. package/es/hidden/hidden.js.map +1 -1
  57. package/es/hidden-visually/hidden-visually.js +7 -13
  58. package/es/hidden-visually/hidden-visually.js.map +1 -1
  59. package/es/icons/alert-icon.js +18 -64
  60. package/es/icons/alert-icon.js.map +1 -1
  61. package/es/icons/banner-icon.js +25 -97
  62. package/es/icons/banner-icon.js.map +1 -1
  63. package/es/icons/close-icon.js +3 -9
  64. package/es/icons/close-icon.js.map +1 -1
  65. package/es/icons/password-hidden-icon.js +6 -23
  66. package/es/icons/password-hidden-icon.js.map +1 -1
  67. package/es/icons/password-visible-icon.js +5 -16
  68. package/es/icons/password-visible-icon.js.map +1 -1
  69. package/es/inline/inline.js +8 -23
  70. package/es/inline/inline.js.map +1 -1
  71. package/es/loading/loading.js +17 -28
  72. package/es/loading/loading.js.map +1 -1
  73. package/es/menu/menu.js +127 -260
  74. package/es/menu/menu.js.map +1 -1
  75. package/es/modal/modal.js +143 -272
  76. package/es/modal/modal.js.map +1 -1
  77. package/es/modal/modal.module.css.js +1 -1
  78. package/es/notice/notice.js +8 -21
  79. package/es/notice/notice.js.map +1 -1
  80. package/es/notice/notice.module.css.js +1 -1
  81. package/es/password-field/password-field.js +10 -24
  82. package/es/password-field/password-field.js.map +1 -1
  83. package/es/prose/prose.js +10 -15
  84. package/es/prose/prose.js.map +1 -1
  85. package/es/select-field/select-field.js +14 -51
  86. package/es/select-field/select-field.js.map +1 -1
  87. package/es/spinner/spinner.js +6 -20
  88. package/es/spinner/spinner.js.map +1 -1
  89. package/es/stack/stack.js +15 -27
  90. package/es/stack/stack.js.map +1 -1
  91. package/es/switch-field/switch-field.js +38 -73
  92. package/es/switch-field/switch-field.js.map +1 -1
  93. package/es/switch-field/switch-field.module.css.js +1 -1
  94. package/es/tabs/tabs.js +120 -207
  95. package/es/tabs/tabs.js.map +1 -1
  96. package/es/text/text.js +16 -25
  97. package/es/text/text.js.map +1 -1
  98. package/es/text-area/text-area.js +54 -111
  99. package/es/text-area/text-area.js.map +1 -1
  100. package/es/text-field/text-field.js +30 -84
  101. package/es/text-field/text-field.js.map +1 -1
  102. package/es/text-link/text-link.js +9 -20
  103. package/es/text-link/text-link.js.map +1 -1
  104. package/es/text-link/text-link.module.css.js +1 -1
  105. package/es/toast/static-toast.js +35 -70
  106. package/es/toast/static-toast.js.map +1 -1
  107. package/es/toast/toast-animation.js +121 -159
  108. package/es/toast/toast-animation.js.map +1 -1
  109. package/es/toast/use-toasts.js +134 -197
  110. package/es/toast/use-toasts.js.map +1 -1
  111. package/es/tooltip/tooltip.js +31 -69
  112. package/es/tooltip/tooltip.js.map +1 -1
  113. package/es/utils/common-helpers.js +9 -13
  114. package/es/utils/common-helpers.js.map +1 -1
  115. package/es/utils/polymorphism.js +7 -8
  116. package/es/utils/polymorphism.js.map +1 -1
  117. package/es/utils/responsive-props.js +57 -66
  118. package/es/utils/responsive-props.js.map +1 -1
  119. package/lib/avatar/avatar.d.ts +21 -21
  120. package/lib/avatar/avatar.js +69 -1
  121. package/lib/avatar/avatar.js.map +1 -1
  122. package/lib/avatar/avatar.module.css.js +7 -1
  123. package/lib/avatar/avatar.module.css.js.map +1 -1
  124. package/lib/avatar/index.d.ts +1 -1
  125. package/lib/avatar/utils.d.ts +3 -3
  126. package/lib/avatar/utils.js +30 -1
  127. package/lib/avatar/utils.js.map +1 -1
  128. package/lib/badge/badge.d.ts +15 -15
  129. package/lib/badge/badge.js +36 -1
  130. package/lib/badge/badge.js.map +1 -1
  131. package/lib/badge/badge.module.css.js +7 -1
  132. package/lib/badge/badge.module.css.js.map +1 -1
  133. package/lib/badge/index.d.ts +1 -1
  134. package/lib/banner/banner.d.ts +87 -87
  135. package/lib/banner/banner.js +79 -1
  136. package/lib/banner/banner.js.map +1 -1
  137. package/lib/banner/banner.module.css.js +7 -1
  138. package/lib/banner/banner.module.css.js.map +1 -1
  139. package/lib/banner/index.d.ts +2 -2
  140. package/lib/banner/story-promo-image.d.ts +4 -4
  141. package/lib/base-field/base-field.d.ts +139 -139
  142. package/lib/base-field/base-field.js +127 -1
  143. package/lib/base-field/base-field.js.map +1 -1
  144. package/lib/base-field/base-field.module.css.js +7 -1
  145. package/lib/base-field/base-field.module.css.js.map +1 -1
  146. package/lib/base-field/index.d.ts +1 -1
  147. package/lib/box/box.d.ts +73 -73
  148. package/lib/box/box.js +103 -1
  149. package/lib/box/box.js.map +1 -1
  150. package/lib/box/box.module.css.js +7 -1
  151. package/lib/box/box.module.css.js.map +1 -1
  152. package/lib/box/gap.module.css.js +7 -1
  153. package/lib/box/gap.module.css.js.map +1 -1
  154. package/lib/box/index.d.ts +1 -1
  155. package/lib/box/margin.module.css.js +7 -1
  156. package/lib/box/margin.module.css.js.map +1 -1
  157. package/lib/box/padding.module.css.js +7 -1
  158. package/lib/box/padding.module.css.js.map +1 -1
  159. package/lib/box/width.module.css.js +7 -1
  160. package/lib/box/width.module.css.js.map +1 -1
  161. package/lib/button/button.d.ts +127 -127
  162. package/lib/button/button.js +86 -1
  163. package/lib/button/button.js.map +1 -1
  164. package/lib/button/button.module.css.js +7 -1
  165. package/lib/button/button.module.css.js.map +1 -1
  166. package/lib/button/index.d.ts +1 -1
  167. package/lib/checkbox-field/checkbox-field.d.ts +40 -40
  168. package/lib/checkbox-field/checkbox-field.js +82 -1
  169. package/lib/checkbox-field/checkbox-field.js.map +1 -1
  170. package/lib/checkbox-field/checkbox-field.module.css.js +7 -1
  171. package/lib/checkbox-field/checkbox-field.module.css.js.map +1 -1
  172. package/lib/checkbox-field/checkbox-icon.d.ts +8 -8
  173. package/lib/checkbox-field/checkbox-icon.js +59 -1
  174. package/lib/checkbox-field/checkbox-icon.js.map +1 -1
  175. package/lib/checkbox-field/index.d.ts +1 -1
  176. package/lib/checkbox-field/use-fork-ref.d.ts +11 -11
  177. package/lib/checkbox-field/use-fork-ref.js +42 -1
  178. package/lib/checkbox-field/use-fork-ref.js.map +1 -1
  179. package/lib/columns/columns.d.ts +20 -20
  180. package/lib/columns/columns.js +57 -1
  181. package/lib/columns/columns.js.map +1 -1
  182. package/lib/columns/columns.module.css.js +7 -1
  183. package/lib/columns/columns.module.css.js.map +1 -1
  184. package/lib/columns/index.d.ts +1 -1
  185. package/lib/components/color-picker/color-picker.d.ts +29 -29
  186. package/lib/components/color-picker/color-picker.js +86 -1
  187. package/lib/components/color-picker/color-picker.js.map +1 -1
  188. package/lib/components/color-picker/index.d.ts +3 -3
  189. package/lib/components/color-picker/index.js +11 -1
  190. package/lib/components/color-picker/index.js.map +1 -1
  191. package/lib/components/deprecated-button/deprecated-button.d.ts +54 -54
  192. package/lib/components/deprecated-button/deprecated-button.js +49 -1
  193. package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
  194. package/lib/components/deprecated-button/index.d.ts +4 -4
  195. package/lib/components/deprecated-button/index.js +9 -1
  196. package/lib/components/deprecated-button/index.js.map +1 -1
  197. package/lib/components/deprecated-dropdown/dropdown.d.ts +55 -55
  198. package/lib/components/deprecated-dropdown/dropdown.js +182 -1
  199. package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
  200. package/lib/components/deprecated-dropdown/index.d.ts +2 -2
  201. package/lib/components/deprecated-dropdown/index.js +9 -1
  202. package/lib/components/deprecated-dropdown/index.js.map +1 -1
  203. package/lib/components/deprecated-input/index.d.ts +2 -2
  204. package/lib/components/deprecated-input/index.js +9 -1
  205. package/lib/components/deprecated-input/index.js.map +1 -1
  206. package/lib/components/deprecated-input/input.d.ts +10 -10
  207. package/lib/components/deprecated-input/input.js +41 -1
  208. package/lib/components/deprecated-input/input.js.map +1 -1
  209. package/lib/components/deprecated-select/index.d.ts +2 -2
  210. package/lib/components/deprecated-select/index.js +9 -1
  211. package/lib/components/deprecated-select/index.js.map +1 -1
  212. package/lib/components/deprecated-select/select.d.ts +33 -33
  213. package/lib/components/deprecated-select/select.js +43 -1
  214. package/lib/components/deprecated-select/select.js.map +1 -1
  215. package/lib/components/icons/CloseIcon.svg.d.ts +3 -3
  216. package/lib/components/icons/ThinQuestionMarkIcon.svg.d.ts +3 -3
  217. package/lib/components/icons/ThreeDotsIcon.svg.d.ts +12 -12
  218. package/lib/components/key-capturer/index.d.ts +3 -3
  219. package/lib/components/key-capturer/index.js +11 -1
  220. package/lib/components/key-capturer/index.js.map +1 -1
  221. package/lib/components/key-capturer/key-capturer.d.ts +40 -40
  222. package/lib/components/key-capturer/key-capturer.js +171 -1
  223. package/lib/components/key-capturer/key-capturer.js.map +1 -1
  224. package/lib/components/keyboard-shortcut/index.d.ts +2 -2
  225. package/lib/components/keyboard-shortcut/index.js +9 -1
  226. package/lib/components/keyboard-shortcut/index.js.map +1 -1
  227. package/lib/components/keyboard-shortcut/keyboard-shortcut.d.ts +44 -44
  228. package/lib/components/keyboard-shortcut/keyboard-shortcut.js +97 -1
  229. package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  230. package/lib/components/progress-bar/index.d.ts +2 -2
  231. package/lib/components/progress-bar/index.js +9 -1
  232. package/lib/components/progress-bar/index.js.map +1 -1
  233. package/lib/components/progress-bar/progress-bar.d.ts +14 -14
  234. package/lib/components/progress-bar/progress-bar.js +44 -1
  235. package/lib/components/progress-bar/progress-bar.js.map +1 -1
  236. package/lib/components/progress-bar/progress-bar.module.css.js +7 -1
  237. package/lib/components/progress-bar/progress-bar.module.css.js.map +1 -1
  238. package/lib/components/time/index.d.ts +2 -2
  239. package/lib/components/time/index.js +9 -1
  240. package/lib/components/time/index.js.map +1 -1
  241. package/lib/components/time/time-utils.d.ts +19 -19
  242. package/lib/components/time/time-utils.js +69 -1
  243. package/lib/components/time/time-utils.js.map +1 -1
  244. package/lib/components/time/time.d.ts +39 -39
  245. package/lib/components/time/time.js +124 -1
  246. package/lib/components/time/time.js.map +1 -1
  247. package/lib/divider/divider.d.ts +8 -8
  248. package/lib/divider/divider.js +36 -1
  249. package/lib/divider/divider.js.map +1 -1
  250. package/lib/divider/divider.module.css.js +7 -1
  251. package/lib/divider/divider.module.css.js.map +1 -1
  252. package/lib/divider/index.d.ts +1 -1
  253. package/lib/heading/heading.d.ts +112 -112
  254. package/lib/heading/heading.js +51 -1
  255. package/lib/heading/heading.js.map +1 -1
  256. package/lib/heading/heading.module.css.js +7 -1
  257. package/lib/heading/heading.module.css.js.map +1 -1
  258. package/lib/heading/index.d.ts +1 -1
  259. package/lib/hidden/hidden.d.ts +49 -49
  260. package/lib/hidden/hidden.js +70 -1
  261. package/lib/hidden/hidden.js.map +1 -1
  262. package/lib/hidden/hidden.module.css.js +7 -1
  263. package/lib/hidden/hidden.module.css.js.map +1 -1
  264. package/lib/hidden/index.d.ts +1 -1
  265. package/lib/hidden-visually/hidden-visually.d.ts +11 -11
  266. package/lib/hidden-visually/hidden-visually.js +40 -1
  267. package/lib/hidden-visually/hidden-visually.js.map +1 -1
  268. package/lib/hidden-visually/hidden-visually.module.css.js +7 -1
  269. package/lib/hidden-visually/hidden-visually.module.css.js.map +1 -1
  270. package/lib/hidden-visually/index.d.ts +1 -1
  271. package/lib/hooks/use-previous/index.d.ts +1 -1
  272. package/lib/hooks/use-previous/use-previous.d.ts +15 -15
  273. package/lib/icons/alert-icon.d.ts +6 -6
  274. package/lib/icons/alert-icon.js +56 -1
  275. package/lib/icons/alert-icon.js.map +1 -1
  276. package/lib/icons/banner-icon.d.ts +6 -6
  277. package/lib/icons/banner-icon.js +68 -1
  278. package/lib/icons/banner-icon.js.map +1 -1
  279. package/lib/icons/banner-icon.module.css.js +7 -1
  280. package/lib/icons/banner-icon.module.css.js.map +1 -1
  281. package/lib/icons/close-icon.d.ts +3 -3
  282. package/lib/icons/close-icon.js +33 -1
  283. package/lib/icons/close-icon.js.map +1 -1
  284. package/lib/icons/password-hidden-icon.d.ts +3 -3
  285. package/lib/icons/password-hidden-icon.js +36 -1
  286. package/lib/icons/password-hidden-icon.js.map +1 -1
  287. package/lib/icons/password-visible-icon.d.ts +3 -3
  288. package/lib/icons/password-visible-icon.js +35 -1
  289. package/lib/icons/password-visible-icon.js.map +1 -1
  290. package/lib/index.d.ts +38 -38
  291. package/lib/index.js +106 -1
  292. package/lib/index.js.map +1 -1
  293. package/lib/inline/index.d.ts +1 -1
  294. package/lib/inline/inline.d.ts +12 -12
  295. package/lib/inline/inline.js +40 -1
  296. package/lib/inline/inline.js.map +1 -1
  297. package/lib/loading/index.d.ts +1 -1
  298. package/lib/loading/loading.d.ts +26 -26
  299. package/lib/loading/loading.js +49 -1
  300. package/lib/loading/loading.js.map +1 -1
  301. package/lib/menu/index.d.ts +2 -2
  302. package/lib/menu/menu.d.ts +128 -128
  303. package/lib/menu/menu.js +179 -1
  304. package/lib/menu/menu.js.map +1 -1
  305. package/lib/modal/index.d.ts +1 -1
  306. package/lib/modal/modal-stories-components.d.ts +47 -47
  307. package/lib/modal/modal.d.ts +185 -185
  308. package/lib/modal/modal.js +209 -1
  309. package/lib/modal/modal.js.map +1 -1
  310. package/lib/modal/modal.module.css.js +7 -1
  311. package/lib/modal/modal.module.css.js.map +1 -1
  312. package/lib/notice/index.d.ts +1 -1
  313. package/lib/notice/notice.d.ts +10 -10
  314. package/lib/notice/notice.js +42 -1
  315. package/lib/notice/notice.js.map +1 -1
  316. package/lib/notice/notice.module.css.js +7 -1
  317. package/lib/notice/notice.module.css.js.map +1 -1
  318. package/lib/password-field/index.d.ts +1 -1
  319. package/lib/password-field/password-field.d.ts +10 -10
  320. package/lib/password-field/password-field.js +43 -1
  321. package/lib/password-field/password-field.js.map +1 -1
  322. package/lib/prose/index.d.ts +2 -2
  323. package/lib/prose/prose-example.d.ts +1 -1
  324. package/lib/prose/prose.d.ts +44 -44
  325. package/lib/prose/prose.js +42 -1
  326. package/lib/prose/prose.js.map +1 -1
  327. package/lib/prose/prose.module.css.js +7 -1
  328. package/lib/prose/prose.module.css.js.map +1 -1
  329. package/lib/select-field/index.d.ts +1 -1
  330. package/lib/select-field/select-field.d.ts +7 -7
  331. package/lib/select-field/select-field.js +48 -1
  332. package/lib/select-field/select-field.js.map +1 -1
  333. package/lib/select-field/select-field.module.css.js +7 -1
  334. package/lib/select-field/select-field.module.css.js.map +1 -1
  335. package/lib/spinner/index.d.ts +1 -1
  336. package/lib/spinner/spinner.d.ts +5 -5
  337. package/lib/spinner/spinner.js +36 -1
  338. package/lib/spinner/spinner.js.map +1 -1
  339. package/lib/spinner/spinner.module.css.js +7 -1
  340. package/lib/spinner/spinner.module.css.js.map +1 -1
  341. package/lib/stack/index.d.ts +1 -1
  342. package/lib/stack/stack.d.ts +15 -15
  343. package/lib/stack/stack.js +52 -1
  344. package/lib/stack/stack.js.map +1 -1
  345. package/lib/switch-field/index.d.ts +1 -1
  346. package/lib/switch-field/switch-field.d.ts +19 -19
  347. package/lib/switch-field/switch-field.js +74 -1
  348. package/lib/switch-field/switch-field.js.map +1 -1
  349. package/lib/switch-field/switch-field.module.css.js +7 -1
  350. package/lib/switch-field/switch-field.module.css.js.map +1 -1
  351. package/lib/tabs/index.d.ts +1 -1
  352. package/lib/tabs/tabs.d.ts +125 -125
  353. package/lib/tabs/tabs.js +177 -1
  354. package/lib/tabs/tabs.js.map +1 -1
  355. package/lib/tabs/tabs.module.css.js +7 -1
  356. package/lib/tabs/tabs.module.css.js.map +1 -1
  357. package/lib/text/index.d.ts +1 -1
  358. package/lib/text/text.d.ts +47 -47
  359. package/lib/text/text.js +49 -1
  360. package/lib/text/text.js.map +1 -1
  361. package/lib/text/text.module.css.js +7 -1
  362. package/lib/text/text.module.css.js.map +1 -1
  363. package/lib/text-area/index.d.ts +1 -1
  364. package/lib/text-area/text-area.d.ts +39 -39
  365. package/lib/text-area/text-area.js +92 -1
  366. package/lib/text-area/text-area.js.map +1 -1
  367. package/lib/text-area/text-area.module.css.js +7 -1
  368. package/lib/text-area/text-area.module.css.js.map +1 -1
  369. package/lib/text-field/index.d.ts +1 -1
  370. package/lib/text-field/text-field.d.ts +18 -18
  371. package/lib/text-field/text-field.js +63 -1
  372. package/lib/text-field/text-field.js.map +1 -1
  373. package/lib/text-field/text-field.module.css.js +7 -1
  374. package/lib/text-field/text-field.module.css.js.map +1 -1
  375. package/lib/text-link/index.d.ts +1 -1
  376. package/lib/text-link/text-link.d.ts +9 -9
  377. package/lib/text-link/text-link.js +41 -1
  378. package/lib/text-link/text-link.js.map +1 -1
  379. package/lib/text-link/text-link.module.css.js +7 -1
  380. package/lib/text-link/text-link.module.css.js.map +1 -1
  381. package/lib/toast/index.d.ts +4 -4
  382. package/lib/toast/static-toast.d.ts +63 -63
  383. package/lib/toast/static-toast.js +59 -1
  384. package/lib/toast/static-toast.js.map +1 -1
  385. package/lib/toast/toast-animation.d.ts +50 -50
  386. package/lib/toast/toast-animation.js +141 -1
  387. package/lib/toast/toast-animation.js.map +1 -1
  388. package/lib/toast/toast.module.css.js +7 -1
  389. package/lib/toast/toast.module.css.js.map +1 -1
  390. package/lib/toast/use-toasts.d.ts +132 -132
  391. package/lib/toast/use-toasts.js +166 -1
  392. package/lib/toast/use-toasts.js.map +1 -1
  393. package/lib/tooltip/index.d.ts +2 -2
  394. package/lib/tooltip/tooltip.d.ts +72 -72
  395. package/lib/tooltip/tooltip.js +67 -1
  396. package/lib/tooltip/tooltip.js.map +1 -1
  397. package/lib/tooltip/tooltip.module.css.js +7 -1
  398. package/lib/tooltip/tooltip.module.css.js.map +1 -1
  399. package/lib/utils/common-helpers.d.ts +2 -2
  400. package/lib/utils/common-helpers.js +44 -1
  401. package/lib/utils/common-helpers.js.map +1 -1
  402. package/lib/utils/common-types.d.ts +42 -42
  403. package/lib/utils/polymorphism.d.ts +135 -135
  404. package/lib/utils/polymorphism.js +39 -1
  405. package/lib/utils/polymorphism.js.map +1 -1
  406. package/lib/utils/responsive-props.d.ts +44 -44
  407. package/lib/utils/responsive-props.js +70 -1
  408. package/lib/utils/responsive-props.js.map +1 -1
  409. package/lib/utils/storybook-helper.d.ts +55 -0
  410. package/lib/utils/test-helpers.d.ts +22 -22
  411. package/package.json +14 -18
  412. package/styles/avatar.css +2 -2
  413. package/styles/avatar.module.css.css +1 -1
  414. package/styles/badge.css +2 -2
  415. package/styles/badge.module.css.css +1 -1
  416. package/styles/banner.css +6 -6
  417. package/styles/banner.module.css.css +1 -1
  418. package/styles/base-field.css +4 -4
  419. package/styles/base-field.module.css.css +1 -1
  420. package/styles/box.css +1 -1
  421. package/styles/box.module.css.css +1 -1
  422. package/styles/button.css +4 -4
  423. package/styles/button.module.css.css +1 -1
  424. package/styles/checkbox-field.css +3 -3
  425. package/styles/checkbox-field.module.css.css +1 -1
  426. package/styles/columns.css +1 -1
  427. package/styles/divider.css +1 -1
  428. package/styles/heading.css +2 -2
  429. package/styles/heading.module.css.css +1 -1
  430. package/styles/hidden-visually.css +2 -2
  431. package/styles/hidden-visually.module.css.css +1 -1
  432. package/styles/hidden.css +1 -1
  433. package/styles/index.css +4 -4
  434. package/styles/loading.css +2 -2
  435. package/styles/menu.css +1 -1
  436. package/styles/modal.css +5 -5
  437. package/styles/modal.module.css.css +1 -1
  438. package/styles/notice.css +1 -1
  439. package/styles/password-field.css +7 -7
  440. package/styles/progress-bar.module.css.css +1 -1
  441. package/styles/prose.css +2 -2
  442. package/styles/prose.module.css.css +1 -1
  443. package/styles/reactist.css +30 -30
  444. package/styles/select-field.css +5 -5
  445. package/styles/select-field.module.css.css +1 -1
  446. package/styles/spinner.css +1 -1
  447. package/styles/static-toast.css +6 -6
  448. package/styles/switch-field.css +6 -6
  449. package/styles/switch-field.module.css.css +1 -1
  450. package/styles/tabs.css +2 -2
  451. package/styles/tabs.module.css.css +1 -1
  452. package/styles/text-area.css +5 -5
  453. package/styles/text-area.module.css.css +1 -1
  454. package/styles/text-field.css +5 -5
  455. package/styles/text-field.module.css.css +1 -1
  456. package/styles/text-link.css +2 -2
  457. package/styles/text-link.module.css.css +1 -1
  458. package/styles/text.css +2 -2
  459. package/styles/text.module.css.css +1 -1
  460. package/styles/toast.module.css.css +1 -1
  461. package/styles/tooltip.css +2 -2
  462. package/styles/tooltip.module.css.css +1 -1
  463. package/styles/use-toasts.css +6 -6
  464. package/es/_virtual/_rollupPluginBabelHelpers.js +0 -91
  465. package/es/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  466. package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -2
  467. package/lib/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
@@ -1,16 +1,15 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
4
- /**
5
- * A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a
6
- * convenience over merely using React.forwardRef directly, and then manually forcing the resulting
7
- * value to be typed using `as PolymorphicComponent<…>`.
8
- *
9
- * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
4
+ /**
5
+ * A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a
6
+ * convenience over merely using React.forwardRef directly, and then manually forcing the resulting
7
+ * value to be typed using `as PolymorphicComponent<…>`.
8
+ *
9
+ * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
10
10
  */
11
-
12
11
  function polymorphicComponent(render) {
13
- return /*#__PURE__*/React.forwardRef(render);
12
+ return React.forwardRef(render);
14
13
  }
15
14
 
16
15
  export { polymorphicComponent };
@@ -1 +1 @@
1
- {"version":3,"file":"polymorphism.js","sources":["../../src/utils/polymorphism.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport * as React from 'react'\nimport type { ObfuscatedClassName } from './common-types'\n\ntype Merge<P1, P2> = Omit<P1, keyof P2> & P2\n\ntype EmptyObject = {\n [K in any]: never\n}\n\ntype ObfuscateClassNameMode = 'keepClassName' | 'obfuscateClassName' | 'omitClassName'\n\n/**\n * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`\n * prop instead.\n *\n * This can be customized via the second generic parameter, as there are cases where it may be\n * needed to omit this behaviour and keep the `className`. You can also instruct it to remove the\n * `className` prop while not replacing it with the `exceptionallySetClassName` one.\n *\n * @see ObfuscatedClassName['exceptionallySetClassName'] for details about this prop\n * @see PolymorphicComponent for details about this feature\n */\ntype WithObfuscatedClassName<\n Props,\n ShouldObfuscateClassName extends ObfuscateClassNameMode\n> = 'className' extends keyof Props\n ? ShouldObfuscateClassName extends 'obfuscateClassName'\n ? Omit<Props, 'className'> & ObfuscatedClassName\n : ShouldObfuscateClassName extends 'omitClassName'\n ? Omit<Props, 'className'>\n : ShouldObfuscateClassName extends 'keepClassName'\n ? Props\n : never\n : Props\n\ntype PolymorphicProp<ComponentType extends React.ElementType> = {\n /**\n * Used to instruct this component what React element to render as. It can be both a string\n * representing a HTML tag name, or a React component.\n *\n * When using this prop, the component you apply it to will also recognize in its props types\n * all the props from the component or HTML element you are rendering it as.\n *\n * Some uses for this feature:\n *\n * - Using some of our layout components, while at the same time being able to set them to use\n * semantic HTML elements needed for accessibility purposes (e.g. `nav`, `main`, etc).\n * - Using a design system link component, but have it internally use a client-side router link\n * implemented via a React component (e.g. react-router's `Link`).\n *\n * Keep in mind that not all compositions of this kind may work well, especially when composing\n * with another React component and not with a HTML tag name. In particular, if the components\n * being composed have opposing concerns of clashing features (e.g. they have contradicting\n * styles applied to them) things may not go well. In those cases prefer to nest them instead.\n *\n * @see PolymorphicComponent\n */\n as?: ComponentType\n}\n\n/**\n * Given a component or element type, and a set of additional props, this builds the entire set of\n * props for a polymorphic component.\n *\n * It does three things:\n *\n * 1. it merges the element type props with the `OwnProps`\n * 2. it adds the `as` prop to allow for polymorphism to happen\n * 3. it optionally obfuscates or omits the className prop if present\n *\n * @see PolymorphicProp\n * @see WithObfuscatedClassName\n */\ntype PolymorphicComponentProps<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode\n> = Merge<\n WithObfuscatedClassName<React.ComponentProps<ComponentType>, ShouldObfuscateClassName>,\n OwnProps & PolymorphicProp<ComponentType>\n>\n\ntype ElementTagNameMap = HTMLElementTagNameMap &\n Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>\n\ntype ElementByTag<TagName extends keyof ElementTagNameMap> = ElementTagNameMap[TagName]\n\ntype ElementByTagOrAny<\n ComponentType extends React.ElementType\n> = ComponentType extends keyof ElementTagNameMap ? ElementByTag<ComponentType> : any\n\n/**\n * The function passed to React.forwardRef, but typed in a way that's prepared for polymorphism via\n * the `as` prop. It also allows to specify if the `className` prop should be obfuscated or omitted.\n *\n * @see PolymorphicComponentProps\n * @see WithObfuscatedClassName\n */\ninterface ForwardRefFunction<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode\n> {\n (\n props: PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>,\n ref:\n | ((instance: ElementByTagOrAny<ComponentType> | null) => void)\n | React.MutableRefObject<ElementByTagOrAny<ComponentType> | null>\n | null,\n ): React.ReactElement | null\n displayName?: string\n}\n\n/**\n * A component that can customize the React element type that it renders (a.k.a. a polymorphic\n * component). This is achieved by passing a prop `as={ElementType}` or `as=\"html-tag-name\"`.\n *\n * It transparently takes care of forwarding refs, and properly sets the ref type depending on the\n * element type.\n *\n * ## Recognizing props based on the polymorphic type\n *\n * The `ComponentType` argument sets the default type for the `as` prop. Whatever the `as` prop\n * component or HTML element is, the type system will automatically allow you to pass props that are\n * not explicitly defined by you, but that are recognized as valid props to be passed to the\n * component you are rendering.\n *\n * For instance, see the following example:\n *\n * ```jsx\n * <Box as=\"label\" htmlFor=\"field-id\">Hello</Box>\n * ```\n *\n * The `htmlFor` prop is exclusive to label elements. If you omit the `as=\"label\"` prop, the type\n * system will consider the `htmlFor` prop to be an error. The same happens if you pass a value of\n * an incorrect type to such prop. For instance, the example below will issue a type error:\n *\n * ```jsx\n * <Box as=\"label\" htmlFor={123}>Hello</Box>\n * ```\n *\n * ## Omitting or obfuscating the `className` prop\n *\n * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`\n * prop instead.\n *\n * This is to discourage customizing design system components via custom styling, while still\n * leaving the door open to do it as an escape hatch when the design system still has shortcomings\n * with respect to the product designs we want to achieve.\n *\n * The cumbersome name also serves the purpose of aiding in easily searching for the places in the\n * code where this escape hatch was needed, in order to identify areas where the design system\n * components need to improve to better match our needs.\n *\n * This behaviour can be customized via an optional second generic argument that allows to disable\n * this feature, or to omit the `className` altogether without replacing it with the obfuscated prop\n * name.\n *\n * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)\n */\ninterface PolymorphicComponent<\n ComponentType extends React.ElementType,\n OwnProps,\n ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName'\n> {\n <TT extends React.ElementType = ComponentType>(\n props: PolymorphicComponentProps<TT, OwnProps, ShouldObfuscateClassName>,\n ): React.ReactElement | null\n readonly $$typeof: symbol\n defaultProps?: Partial<\n PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>\n >\n propTypes?: React.WeakValidationMap<\n PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>\n >\n displayName?: string\n}\n\n/**\n * A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a\n * convenience over merely using React.forwardRef directly, and then manually forcing the resulting\n * value to be typed using `as PolymorphicComponent<…>`.\n *\n * @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)\n */\nfunction polymorphicComponent<\n ComponentType extends React.ElementType = 'div',\n OwnProps = EmptyObject,\n ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName'\n>(render: ForwardRefFunction<ComponentType, OwnProps, ShouldObfuscateClassName>) {\n return React.forwardRef(render) as PolymorphicComponent<\n ComponentType,\n OwnProps,\n ShouldObfuscateClassName\n >\n}\n\nexport type { PolymorphicComponent }\nexport { polymorphicComponent }\n"],"names":["polymorphicComponent","render","React","forwardRef"],"mappings":";;AAAA;AAoLA;;;;;;AAMG;;AACH,SAASA,oBAAT,CAIEC,MAJF,EAI+E;AAC3E,EAAA,oBAAOC,KAAK,CAACC,UAAN,CAAiBF,MAAjB,CAAP,CAAA;AAKH;;;;"}
1
+ {"version":3,"file":"polymorphism.js","sources":["../../src/utils/polymorphism.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAoLA;;;;;;AAMG;AACH,SAAS,oBAAoB,CAI3B,MAA6E,EAAA;AAC3E,IAAA,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAI7B,CAAA;AACL;;;;"}
@@ -1,74 +1,65 @@
1
- const DEBUG = process.env.NODE_ENV === 'development';
2
- /**
3
- * Builds a css module class name for a given prop + prop-value combination.
4
- *
5
- * We have a convention of building the internal utility-based class names system in a way that
6
- * resembles the prop for which it is used and the value of the prop. For instance, in a component
7
- * with a prop `width` with possible values `narrow` and `wide`, we encode the styles for each of
8
- * these alternatives in the class-names `.width-narrow` and `.width-wide`.
9
- *
10
- * Furthermore, this helper is aware of responsive prop values. For instance, if you provide the
11
- * `width` prop above with the value `['narrow', 'wide']` this returns `['narrow', 'tablet-wide']`.
12
- * That is, it returns an array of class names, following the same convention above, but also
13
- * prefixing by the viewport width variant (`tablet-` or `desktop-`).
14
- *
15
- * @param styles the class names mapping imported from a css module
16
- * @param property the prop name
17
- * @param value the given prop's value
1
+ var DEBUG = process.env.NODE_ENV === 'development';
2
+ /**
3
+ * Builds a css module class name for a given prop + prop-value combination.
4
+ *
5
+ * We have a convention of building the internal utility-based class names system in a way that
6
+ * resembles the prop for which it is used and the value of the prop. For instance, in a component
7
+ * with a prop `width` with possible values `narrow` and `wide`, we encode the styles for each of
8
+ * these alternatives in the class-names `.width-narrow` and `.width-wide`.
9
+ *
10
+ * Furthermore, this helper is aware of responsive prop values. For instance, if you provide the
11
+ * `width` prop above with the value `['narrow', 'wide']` this returns `['narrow', 'tablet-wide']`.
12
+ * That is, it returns an array of class names, following the same convention above, but also
13
+ * prefixing by the viewport width variant (`tablet-` or `desktop-`).
14
+ *
15
+ * @param styles the class names mapping imported from a css module
16
+ * @param property the prop name
17
+ * @param value the given prop's value
18
18
  */
19
-
20
19
  function getClassNames(styles, property, value) {
21
- if (!value) {
22
- return null;
23
- }
24
-
25
- const classList = [];
26
-
27
- if (typeof value === 'string') {
28
- classList.push(styles[`${property}-${value}`]);
29
- } else {
30
- if (value.mobile) classList.push(styles[`${property}-${value.mobile}`]);
31
- if (value.tablet) classList.push(styles[`tablet-${property}-${value.tablet}`]);
32
- if (value.desktop) classList.push(styles[`desktop-${property}-${value.desktop}`]);
33
- }
34
-
35
- if (DEBUG && !classList.every(Boolean)) {
36
- // eslint-disable-next-line no-console
37
- console.warn('Not all generated class names were found', {
38
- property,
39
- value,
40
- classList
41
- });
42
- }
43
-
44
- return classList;
20
+ if (!value) {
21
+ return null;
22
+ }
23
+ var classList = [];
24
+ if (typeof value === 'string') {
25
+ classList.push(styles["".concat(property, "-").concat(value)]);
26
+ }
27
+ else {
28
+ if (value.mobile)
29
+ classList.push(styles["".concat(property, "-").concat(value.mobile)]);
30
+ if (value.tablet)
31
+ classList.push(styles["tablet-".concat(property, "-").concat(value.tablet)]);
32
+ if (value.desktop)
33
+ classList.push(styles["desktop-".concat(property, "-").concat(value.desktop)]);
34
+ }
35
+ if (DEBUG && !classList.every(Boolean)) {
36
+ // eslint-disable-next-line no-console
37
+ console.warn('Not all generated class names were found', { property: property, value: value, classList: classList });
38
+ }
39
+ return classList;
45
40
  }
46
- /**
47
- * A mapping over a responsive prop value.
48
- *
49
- * Since response values can be an object but also a scalar value, this helper makes it easier to
50
- * to map the values when it's an object but keeps it consistent for the case when it is a scalar
51
- * value as well.
52
- *
53
- * @param fromValue the responsive prop value
54
- * @param mapper the mapping function
41
+ /**
42
+ * A mapping over a responsive prop value.
43
+ *
44
+ * Since response values can be an object but also a scalar value, this helper makes it easier to
45
+ * to map the values when it's an object but keeps it consistent for the case when it is a scalar
46
+ * value as well.
47
+ *
48
+ * @param fromValue the responsive prop value
49
+ * @param mapper the mapping function
55
50
  */
56
-
57
-
58
51
  function mapResponsiveProp(fromValue, mapper) {
59
- if (!fromValue) {
60
- return undefined;
61
- }
62
-
63
- if (typeof fromValue !== 'object') {
64
- return mapper(fromValue);
65
- }
66
-
67
- return {
68
- mobile: fromValue.mobile ? mapper(fromValue.mobile) : undefined,
69
- tablet: fromValue.tablet ? mapper(fromValue.tablet) : undefined,
70
- desktop: fromValue.desktop ? mapper(fromValue.desktop) : undefined
71
- };
52
+ if (!fromValue) {
53
+ return undefined;
54
+ }
55
+ if (typeof fromValue !== 'object') {
56
+ return mapper(fromValue);
57
+ }
58
+ return {
59
+ mobile: fromValue.mobile ? mapper(fromValue.mobile) : undefined,
60
+ tablet: fromValue.tablet ? mapper(fromValue.tablet) : undefined,
61
+ desktop: fromValue.desktop ? mapper(fromValue.desktop) : undefined
62
+ };
72
63
  }
73
64
 
74
65
  export { getClassNames, mapResponsiveProp };
@@ -1 +1 @@
1
- {"version":3,"file":"responsive-props.js","sources":["../../src/utils/responsive-props.ts"],"sourcesContent":["type ResponsiveBreakpoints = 'mobile' | 'tablet' | 'desktop'\n\ntype Atom = string | number | boolean\n\n/**\n * A responsive prop supports receiving values of its given base type, or an object mapping a\n * responsive breakpoint name to a value from the prop's base type.\n *\n * Some examples:\n *\n * - `align={{ mobile: 'left', tablet: 'center', desktop: 'right' }}`\n */\ntype ResponsiveProp<AtomType extends Atom> =\n | AtomType\n | Readonly<{ [key in ResponsiveBreakpoints]?: AtomType }>\n\nconst DEBUG = process.env.NODE_ENV === 'development'\n\n/**\n * Builds a css module class name for a given prop + prop-value combination.\n *\n * We have a convention of building the internal utility-based class names system in a way that\n * resembles the prop for which it is used and the value of the prop. For instance, in a component\n * with a prop `width` with possible values `narrow` and `wide`, we encode the styles for each of\n * these alternatives in the class-names `.width-narrow` and `.width-wide`.\n *\n * Furthermore, this helper is aware of responsive prop values. For instance, if you provide the\n * `width` prop above with the value `['narrow', 'wide']` this returns `['narrow', 'tablet-wide']`.\n * That is, it returns an array of class names, following the same convention above, but also\n * prefixing by the viewport width variant (`tablet-` or `desktop-`).\n *\n * @param styles the class names mapping imported from a css module\n * @param property the prop name\n * @param value the given prop's value\n */\nfunction getClassNames(\n styles: Record<string, string>,\n property: string,\n value: ResponsiveProp<string> | null | undefined,\n): Array<string | undefined> | null {\n if (!value) {\n return null\n }\n\n const classList: Array<string | undefined> = []\n\n if (typeof value === 'string') {\n classList.push(styles[`${property}-${value}`])\n } else {\n if (value.mobile) classList.push(styles[`${property}-${value.mobile}`])\n if (value.tablet) classList.push(styles[`tablet-${property}-${value.tablet}`])\n if (value.desktop) classList.push(styles[`desktop-${property}-${value.desktop}`])\n }\n\n if (DEBUG && !classList.every(Boolean)) {\n // eslint-disable-next-line no-console\n console.warn('Not all generated class names were found', { property, value, classList })\n }\n\n return classList\n}\n\n/**\n * A mapping over a responsive prop value.\n *\n * Since response values can be an object but also a scalar value, this helper makes it easier to\n * to map the values when it's an object but keeps it consistent for the case when it is a scalar\n * value as well.\n *\n * @param fromValue the responsive prop value\n * @param mapper the mapping function\n */\nfunction mapResponsiveProp<From extends Atom, To extends Atom>(\n fromValue: ResponsiveProp<From> | undefined,\n mapper: (from: From) => To,\n): ResponsiveProp<To> | undefined {\n if (!fromValue) {\n return undefined\n }\n\n if (typeof fromValue !== 'object') {\n return mapper(fromValue)\n }\n\n return {\n mobile: fromValue.mobile ? mapper(fromValue.mobile) : undefined,\n tablet: fromValue.tablet ? mapper(fromValue.tablet) : undefined,\n desktop: fromValue.desktop ? mapper(fromValue.desktop) : undefined,\n }\n}\n\nexport type { ResponsiveProp, ResponsiveBreakpoints }\nexport { getClassNames, mapResponsiveProp }\n"],"names":["DEBUG","process","env","NODE_ENV","getClassNames","styles","property","value","classList","push","mobile","tablet","desktop","every","Boolean","console","warn","mapResponsiveProp","fromValue","mapper","undefined"],"mappings":"AAgBA,MAAMA,KAAK,GAAGC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAAvC,CAAA;AAEA;;;;;;;;;;;;;;;;AAgBG;;AACH,SAASC,aAAT,CACIC,MADJ,EAEIC,QAFJ,EAGIC,KAHJ,EAGoD;EAEhD,IAAI,CAACA,KAAL,EAAY;AACR,IAAA,OAAO,IAAP,CAAA;AACH,GAAA;;EAED,MAAMC,SAAS,GAA8B,EAA7C,CAAA;;AAEA,EAAA,IAAI,OAAOD,KAAP,KAAiB,QAArB,EAA+B;IAC3BC,SAAS,CAACC,IAAV,CAAeJ,MAAM,CAAC,GAAGC,QAAQ,CAAA,CAAA,EAAIC,KAAK,CAAA,CAArB,CAArB,CAAA,CAAA;AACH,GAFD,MAEO;AACH,IAAA,IAAIA,KAAK,CAACG,MAAV,EAAkBF,SAAS,CAACC,IAAV,CAAeJ,MAAM,CAAI,GAAAC,QAAY,CAAA,CAAA,EAAAC,KAAK,CAACG,MAAQ,EAA9B,CAArB,CAAA,CAAA;AAClB,IAAA,IAAIH,KAAK,CAACI,MAAV,EAAkBH,SAAS,CAACC,IAAV,CAAeJ,MAAM,CAAW,UAAAC,QAAY,CAAA,CAAA,EAAAC,KAAK,CAACI,MAAQ,EAArC,CAArB,CAAA,CAAA;AAClB,IAAA,IAAIJ,KAAK,CAACK,OAAV,EAAmBJ,SAAS,CAACC,IAAV,CAAeJ,MAAM,CAAY,WAAAC,QAAY,CAAA,CAAA,EAAAC,KAAK,CAACK,OAAS,EAAvC,CAArB,CAAA,CAAA;AACtB,GAAA;;EAED,IAAIZ,KAAK,IAAI,CAACQ,SAAS,CAACK,KAAV,CAAgBC,OAAhB,CAAd,EAAwC;AACpC;AACAC,IAAAA,OAAO,CAACC,IAAR,CAAa,0CAAb,EAAyD;MAAEV,QAAF;MAAYC,KAAZ;AAAmBC,MAAAA,SAAAA;KAA5E,CAAA,CAAA;AACH,GAAA;;AAED,EAAA,OAAOA,SAAP,CAAA;AACH,CAAA;AAED;;;;;;;;;AASG;;;AACH,SAASS,iBAAT,CACIC,SADJ,EAEIC,MAFJ,EAE8B;EAE1B,IAAI,CAACD,SAAL,EAAgB;AACZ,IAAA,OAAOE,SAAP,CAAA;AACH,GAAA;;AAED,EAAA,IAAI,OAAOF,SAAP,KAAqB,QAAzB,EAAmC;IAC/B,OAAOC,MAAM,CAACD,SAAD,CAAb,CAAA;AACH,GAAA;;EAED,OAAO;AACHR,IAAAA,MAAM,EAAEQ,SAAS,CAACR,MAAV,GAAmBS,MAAM,CAACD,SAAS,CAACR,MAAX,CAAzB,GAA8CU,SADnD;AAEHT,IAAAA,MAAM,EAAEO,SAAS,CAACP,MAAV,GAAmBQ,MAAM,CAACD,SAAS,CAACP,MAAX,CAAzB,GAA8CS,SAFnD;IAGHR,OAAO,EAAEM,SAAS,CAACN,OAAV,GAAoBO,MAAM,CAACD,SAAS,CAACN,OAAX,CAA1B,GAAgDQ,SAAAA;GAH7D,CAAA;AAKH;;;;"}
1
+ {"version":3,"file":"responsive-props.js","sources":["../../src/utils/responsive-props.ts"],"sourcesContent":[null],"names":[],"mappings":"AAgBA,IAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAA;AAEpD;;;;;;;;;;;;;;;;AAgBG;AACH,SAAS,aAAa,CAClB,MAA8B,EAC9B,QAAgB,EAChB,KAAgD,EAAA;IAEhD,IAAI,CAAC,KAAK,EAAE;AACR,QAAA,OAAO,IAAI,CAAA;AACd,KAAA;IAED,IAAM,SAAS,GAA8B,EAAE,CAAA;AAE/C,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC3B,QAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAA,CAAA,MAAA,CAAG,QAAQ,EAAA,GAAA,CAAA,CAAA,MAAA,CAAI,KAAK,CAAE,CAAC,CAAC,CAAA;AACjD,KAAA;AAAM,SAAA;QACH,IAAI,KAAK,CAAC,MAAM;AAAE,YAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAG,CAAA,MAAA,CAAA,QAAQ,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,KAAK,CAAC,MAAM,CAAE,CAAC,CAAC,CAAA;QACvE,IAAI,KAAK,CAAC,MAAM;AAAE,YAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,SAAU,CAAA,MAAA,CAAA,QAAQ,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,KAAK,CAAC,MAAM,CAAE,CAAC,CAAC,CAAA;QAC9E,IAAI,KAAK,CAAC,OAAO;AAAE,YAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAW,CAAA,MAAA,CAAA,QAAQ,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC,CAAA;AACpF,KAAA;IAED,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;;AAEpC,QAAA,OAAO,CAAC,IAAI,CAAC,0CAA0C,EAAE,EAAE,QAAQ,EAAA,QAAA,EAAE,KAAK,OAAA,EAAE,SAAS,EAAA,SAAA,EAAE,CAAC,CAAA;AAC3F,KAAA;AAED,IAAA,OAAO,SAAS,CAAA;AACpB,CAAC;AAED;;;;;;;;;AASG;AACH,SAAS,iBAAiB,CACtB,SAA2C,EAC3C,MAA0B,EAAA;IAE1B,IAAI,CAAC,SAAS,EAAE;AACZ,QAAA,OAAO,SAAS,CAAA;AACnB,KAAA;AAED,IAAA,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AAC/B,QAAA,OAAO,MAAM,CAAC,SAAS,CAAC,CAAA;AAC3B,KAAA;IAED,OAAO;AACH,QAAA,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS;AAC/D,QAAA,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS;AAC/D,QAAA,OAAO,EAAE,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS;KACrE,CAAA;AACL;;;;"}
@@ -1,21 +1,21 @@
1
- import * as React from 'react';
2
- import { ResponsiveProp } from '../utils/responsive-props';
3
- import type { ObfuscatedClassName } from '../utils/common-types';
4
- type AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';
5
- type Props = ObfuscatedClassName & {
6
- /** @deprecated Please use `exceptionallySetClassName` */
7
- className?: string;
8
- /** @deprecated */
9
- colorList?: string[];
10
- size?: ResponsiveProp<AvatarSize>;
11
- avatarUrl?: string;
12
- user: {
13
- name?: string;
14
- email: string;
15
- };
16
- };
17
- declare function Avatar({ user, avatarUrl, size, className, colorList, exceptionallySetClassName, ...props }: Props): React.JSX.Element;
18
- declare namespace Avatar {
19
- var displayName: string;
20
- }
21
- export { Avatar };
1
+ import * as React from 'react';
2
+ import { ResponsiveProp } from '../utils/responsive-props';
3
+ import type { ObfuscatedClassName } from '../utils/common-types';
4
+ type AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';
5
+ type Props = ObfuscatedClassName & {
6
+ /** @deprecated Please use `exceptionallySetClassName` */
7
+ className?: string;
8
+ /** @deprecated */
9
+ colorList?: string[];
10
+ size?: ResponsiveProp<AvatarSize>;
11
+ avatarUrl?: string;
12
+ user: {
13
+ name?: string;
14
+ email: string;
15
+ };
16
+ };
17
+ declare function Avatar({ user, avatarUrl, size, className, colorList, exceptionallySetClassName, ...props }: Props): React.JSX.Element;
18
+ declare namespace Avatar {
19
+ var displayName: string;
20
+ }
21
+ export { Avatar };
@@ -1,2 +1,70 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),a=require("react"),t=require("./utils.js"),r=require("../utils/responsive-props.js"),s=require("./avatar.module.css.js"),l=require("../box/box.js");function i(e){if(e&&e.__esModule)return e;var a=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),a.default=e,a}var c=i(a);const o=["user","avatarUrl","size","className","colorList","exceptionallySetClassName"],u=["#fcc652","#e9952c","#e16b2d","#d84b40","#e8435a","#e5198a","#ad3889","#86389c","#a8a8a8","#98be2f","#5d9d50","#5f9f85","#5bbcb6","#32a3bf","#2bafeb","#2d88c3","#3863cc","#5e5e5e"];function n(a){let{user:i,avatarUrl:n,size:b="l",className:d,colorList:f=u,exceptionallySetClassName:p}=a,m=e.objectWithoutProperties(a,o);const v=t.getInitials(i.name)||t.getInitials(i.email),j=b||"l",g=n?{backgroundImage:`url(${n})`,textIndent:"-9999px"}:{backgroundColor:f[t.emailToIndex(i.email,f.length)]},x=r.getClassNames(s.default,"size",j);return c.createElement(l.Box,e.objectSpread2({className:[d,s.default.avatar,x,p],style:g},m),v)}n.displayName="Avatar",exports.Avatar=n;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+ var utils = require('./utils.js');
8
+ var responsiveProps = require('../utils/responsive-props.js');
9
+ var avatar_module = require('./avatar.module.css.js');
10
+ var box = require('../box/box.js');
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n["default"] = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
31
+
32
+ var AVATAR_COLORS = [
33
+ '#fcc652',
34
+ '#e9952c',
35
+ '#e16b2d',
36
+ '#d84b40',
37
+ '#e8435a',
38
+ '#e5198a',
39
+ '#ad3889',
40
+ '#86389c',
41
+ '#a8a8a8',
42
+ '#98be2f',
43
+ '#5d9d50',
44
+ '#5f9f85',
45
+ '#5bbcb6',
46
+ '#32a3bf',
47
+ '#2bafeb',
48
+ '#2d88c3',
49
+ '#3863cc',
50
+ '#5e5e5e',
51
+ ];
52
+ function Avatar(_a) {
53
+ var user = _a.user, avatarUrl = _a.avatarUrl, _b = _a.size, size = _b === void 0 ? 'l' : _b, className = _a.className, _c = _a.colorList, colorList = _c === void 0 ? AVATAR_COLORS : _c, exceptionallySetClassName = _a.exceptionallySetClassName, props = tslib.__rest(_a, ["user", "avatarUrl", "size", "className", "colorList", "exceptionallySetClassName"]);
54
+ var userInitials = utils.getInitials(user.name) || utils.getInitials(user.email);
55
+ var avatarSize = size ? size : 'l';
56
+ var style = avatarUrl
57
+ ? {
58
+ backgroundImage: "url(".concat(avatarUrl, ")"),
59
+ textIndent: '-9999px'
60
+ }
61
+ : {
62
+ backgroundColor: colorList[utils.emailToIndex(user.email, colorList.length)]
63
+ };
64
+ var sizeClassName = responsiveProps.getClassNames(avatar_module["default"], 'size', avatarSize);
65
+ return (React__namespace.createElement(box.Box, tslib.__assign({ className: [className, avatar_module["default"].avatar, sizeClassName, exceptionallySetClassName], style: style }, props), userInitials));
66
+ }
67
+ Avatar.displayName = 'Avatar';
68
+
69
+ exports.Avatar = Avatar;
2
70
  //# sourceMappingURL=avatar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.js","sources":["../../src/avatar/avatar.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { getInitials, emailToIndex } from './utils'\n\nimport { getClassNames, ResponsiveProp } from '../utils/responsive-props'\nimport styles from './avatar.module.css'\nimport { Box } from '../box'\nimport type { ObfuscatedClassName } from '../utils/common-types'\n\nconst AVATAR_COLORS = [\n '#fcc652',\n '#e9952c',\n '#e16b2d',\n '#d84b40',\n '#e8435a',\n '#e5198a',\n '#ad3889',\n '#86389c',\n '#a8a8a8',\n '#98be2f',\n '#5d9d50',\n '#5f9f85',\n '#5bbcb6',\n '#32a3bf',\n '#2bafeb',\n '#2d88c3',\n '#3863cc',\n '#5e5e5e',\n]\n\ntype AvatarSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'\n\ntype Props = ObfuscatedClassName & {\n /** @deprecated Please use `exceptionallySetClassName` */\n className?: string\n /** @deprecated */\n colorList?: string[]\n size?: ResponsiveProp<AvatarSize>\n avatarUrl?: string\n user: { name?: string; email: string }\n}\n\nfunction Avatar({\n user,\n avatarUrl,\n size = 'l',\n className,\n colorList = AVATAR_COLORS,\n exceptionallySetClassName,\n ...props\n}: Props) {\n const userInitials = getInitials(user.name) || getInitials(user.email)\n const avatarSize = size ? size : 'l'\n\n const style = avatarUrl\n ? {\n backgroundImage: `url(${avatarUrl})`,\n textIndent: '-9999px', // hide the initials\n }\n : {\n backgroundColor: colorList[emailToIndex(user.email, colorList.length)],\n }\n\n const sizeClassName = getClassNames(styles, 'size', avatarSize)\n\n return (\n <Box\n className={[className, styles.avatar, sizeClassName, exceptionallySetClassName]}\n style={style}\n {...props}\n >\n {userInitials}\n </Box>\n )\n}\nAvatar.displayName = 'Avatar'\n\nexport { Avatar }\n"],"names":["AVATAR_COLORS","Avatar","_ref","user","avatarUrl","size","className","colorList","exceptionallySetClassName","props","_objectWithoutProperties","objectWithoutProperties","_excluded","userInitials","getInitials","name","email","avatarSize","style","backgroundImage","textIndent","backgroundColor","emailToIndex","length","sizeClassName","getClassNames","styles","React","createElement","Box","_objectSpread","avatar","displayName"],"mappings":"qoBASMA,EAAgB,CAClB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAeJ,SAASC,EAQDC,GAAA,IARQC,KACZA,EADYC,UAEZA,EAFYC,KAGZA,EAAO,IAHKC,UAIZA,EAJYC,UAKZA,EAAYP,EALAQ,0BAMZA,GAEIN,EADDO,EACCC,EAAAC,wBAAAT,EAAAU,GACJ,MAAMC,EAAeC,EAAWA,YAACX,EAAKY,OAASD,cAAYX,EAAKa,OAC1DC,EAAaZ,GAAc,IAE3Ba,EAAQd,EACR,CACIe,gBAAwB,OAAAf,KACxBgB,WAAY,WAEhB,CACIC,gBAAiBd,EAAUe,eAAanB,EAAKa,MAAOT,EAAUgB,UAGlEC,EAAgBC,EAAaA,cAACC,EAAD,QAAS,OAAQT,GAEpD,OACIU,EAACC,cAAAC,EAADA,IAAAC,gBAAA,CACIxB,UAAW,CAACA,EAAWoB,EAAAA,QAAOK,OAAQP,EAAehB,GACrDU,MAAOA,GACHT,GAEHI,GAIbZ,EAAO+B,YAAc"}
1
+ {"version":3,"file":"avatar.js","sources":["../../src/avatar/avatar.tsx"],"sourcesContent":[null],"names":["__rest","getInitials","emailToIndex","getClassNames","styles","React","Box","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAM,aAAa,GAAG;IAClB,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACZ,CAAA;AAcD,SAAS,MAAM,CAAC,EAQR,EAAA;AAPJ,IAAA,IAAA,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,EAAU,GAAA,EAAA,CAAA,IAAA,EAAV,IAAI,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,GAAG,GAAA,EAAA,EACV,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,EAAyB,GAAA,EAAA,CAAA,SAAA,EAAzB,SAAS,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,aAAa,GAAA,EAAA,EACzB,yBAAyB,GAAA,EAAA,CAAA,yBAAA,EACtB,KAAK,GAAAA,YAAA,CAAA,EAAA,EAPI,oFAQf,CADW,CAAA;AAER,IAAA,IAAM,YAAY,GAAGC,iBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAIA,iBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACtE,IAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,CAAA;IAEpC,IAAM,KAAK,GAAG,SAAS;AACnB,UAAE;YACI,eAAe,EAAE,MAAO,CAAA,MAAA,CAAA,SAAS,EAAG,GAAA,CAAA;AACpC,YAAA,UAAU,EAAE,SAAS;AACxB,SAAA;AACH,UAAE;AACI,YAAA,eAAe,EAAE,SAAS,CAACC,kBAAY,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;SACzE,CAAA;IAEP,IAAM,aAAa,GAAGC,6BAAa,CAACC,wBAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAA;IAE/D,QACIC,gBAAC,CAAA,aAAA,CAAAC,OAAG,EACAC,cAAA,CAAA,EAAA,SAAS,EAAE,CAAC,SAAS,EAAEH,wBAAM,CAAC,MAAM,EAAE,aAAa,EAAE,yBAAyB,CAAC,EAC/E,KAAK,EAAE,KAAK,EACR,EAAA,KAAK,CAER,EAAA,YAAY,CACX,EACT;AACL,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;"}
@@ -1,2 +1,8 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={avatar:"_38a1be89","size-xxs":"d32e92ae","size-xs":"_0667d719","size-s":"cf529fcf","size-m":"_6e268eab","size-l":"d64c62cf","size-xl":"_44fb77de","size-xxl":"_01f85e0e","size-xxxl":"_41a5fe19","tablet-size-xxs":"_6ab1577d","tablet-size-xs":"b52a4963","tablet-size-s":"_714a8419","tablet-size-m":"_81cd4d51","tablet-size-l":"bf0a4edb","tablet-size-xl":"e4f0dabd","tablet-size-xxl":"_67ea065d","tablet-size-xxxl":"_2af7f76f","desktop-size-xxs":"_759081dc","desktop-size-xs":"_8290d1c1","desktop-size-s":"_48ea172d","desktop-size-m":"_758f6641","desktop-size-l":"f9ada088","desktop-size-xl":"d3bb7470","desktop-size-xxl":"_9a312ee3","desktop-size-xxxl":"a1d30c23"};
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var modules_08f3eeac = {"avatar":"_38a1be89","size-xxs":"d32e92ae","size-xs":"_0667d719","size-s":"cf529fcf","size-m":"_6e268eab","size-l":"d64c62cf","size-xl":"_44fb77de","size-xxl":"_01f85e0e","size-xxxl":"_41a5fe19","tablet-size-xxs":"_6ab1577d","tablet-size-xs":"b52a4963","tablet-size-s":"_714a8419","tablet-size-m":"_81cd4d51","tablet-size-l":"bf0a4edb","tablet-size-xl":"e4f0dabd","tablet-size-xxl":"_67ea065d","tablet-size-xxxl":"_2af7f76f","desktop-size-xxs":"_759081dc","desktop-size-xs":"_8290d1c1","desktop-size-s":"_48ea172d","desktop-size-m":"_758f6641","desktop-size-l":"f9ada088","desktop-size-xl":"d3bb7470","desktop-size-xxl":"_9a312ee3","desktop-size-xxxl":"a1d30c23"};
6
+
7
+ exports["default"] = modules_08f3eeac;
2
8
  //# sourceMappingURL=avatar.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"avatar.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +1 @@
1
- export * from './avatar';
1
+ export * from './avatar';
@@ -1,3 +1,3 @@
1
- declare function getInitials(name?: string): string | undefined;
2
- declare function emailToIndex(email: string, maxIndex: number): number;
3
- export { getInitials, emailToIndex };
1
+ declare function getInitials(name?: string): string | undefined;
2
+ declare function emailToIndex(email: string, maxIndex: number): number;
3
+ export { getInitials, emailToIndex };
@@ -1,2 +1,31 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.emailToIndex=function(t,e){const l=t.split("@")[0];return(l&&l.charCodeAt(0)+l.charCodeAt(l.length-1)||0)%e},exports.getInitials=function(t){var e;if(!t)return"";const l=t.trim().split(" "),n=l[0],r=l[l.length-1];let o=null==n?void 0:n[0];return null!=n&&null!=r&&null!=o&&n[0]!==r[0]&&(o+=r[0]),null==(e=o)?void 0:e.toUpperCase()};
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function getInitials(name) {
6
+ if (!name) {
7
+ return '';
8
+ }
9
+ var seed = name.trim().split(' ');
10
+ var firstInitial = seed[0];
11
+ var lastInitial = seed[seed.length - 1];
12
+ var initials = firstInitial === null || firstInitial === void 0 ? void 0 : firstInitial[0];
13
+ if (firstInitial != null &&
14
+ lastInitial != null &&
15
+ initials != null &&
16
+ // Better readable this way.
17
+ // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
18
+ firstInitial[0] !== lastInitial[0]) {
19
+ initials += lastInitial[0];
20
+ }
21
+ return initials === null || initials === void 0 ? void 0 : initials.toUpperCase();
22
+ }
23
+ function emailToIndex(email, maxIndex) {
24
+ var seed = email.split('@')[0];
25
+ var hash = seed ? seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0 : 0;
26
+ return hash % maxIndex;
27
+ }
28
+
29
+ exports.emailToIndex = emailToIndex;
30
+ exports.getInitials = getInitials;
2
31
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/avatar/utils.ts"],"sourcesContent":["function getInitials(name?: string) {\n if (!name) {\n return ''\n }\n\n const seed = name.trim().split(' ')\n const firstInitial = seed[0]\n const lastInitial = seed[seed.length - 1]\n\n let initials = firstInitial?.[0]\n if (\n firstInitial != null &&\n lastInitial != null &&\n initials != null &&\n // Better readable this way.\n // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with\n firstInitial[0] !== lastInitial[0]\n ) {\n initials += lastInitial[0]\n }\n return initials?.toUpperCase()\n}\n\nfunction emailToIndex(email: string, maxIndex: number) {\n const seed = email.split('@')[0]\n const hash = seed ? seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0 : 0\n return hash % maxIndex\n}\n\nexport { getInitials, emailToIndex }\n"],"names":["email","maxIndex","seed","split","charCodeAt","length","name","_initials","trim","firstInitial","lastInitial","initials","toUpperCase"],"mappings":"yFAuBA,SAAsBA,EAAeC,GACjC,MAAMC,EAAOF,EAAMG,MAAM,KAAK,GAE9B,OADaD,GAAOA,EAAKE,WAAW,GAAKF,EAAKE,WAAWF,EAAKG,OAAS,IAAU,GACnEJ,uBA1BlB,SAAqBK,GAAa,IAAAC,EAC9B,IAAKD,EACD,MAAO,GAGX,MAAMJ,EAAOI,EAAKE,OAAOL,MAAM,KACzBM,EAAeP,EAAK,GACpBQ,EAAcR,EAAKA,EAAKG,OAAS,GAEvC,IAAIM,QAAWF,SAAAA,EAAe,GAW9B,OAToB,MAAhBA,GACe,MAAfC,GACY,MAAZC,GAGAF,EAAa,KAAOC,EAAY,KAEhCC,GAAYD,EAAY,IAE5B,OAAAH,EAAOI,QAAP,EAAOJ,EAAUK"}
1
+ {"version":3,"file":"utils.js","sources":["../../src/avatar/utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA,SAAS,WAAW,CAAC,IAAa,EAAA;IAC9B,IAAI,CAAC,IAAI,EAAE;AACP,QAAA,OAAO,EAAE,CAAA;AACZ,KAAA;IAED,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACnC,IAAA,IAAM,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IAC5B,IAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAEzC,IAAI,QAAQ,GAAG,YAAY,KAAZ,IAAA,IAAA,YAAY,uBAAZ,YAAY,CAAG,CAAC,CAAC,CAAA;IAChC,IACI,YAAY,IAAI,IAAI;AACpB,QAAA,WAAW,IAAI,IAAI;AACnB,QAAA,QAAQ,IAAI,IAAI;;;QAGhB,YAAY,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,EACpC;AACE,QAAA,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,CAAA;AAC7B,KAAA;IACD,OAAO,QAAQ,aAAR,QAAQ,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAR,QAAQ,CAAE,WAAW,EAAE,CAAA;AAClC,CAAC;AAED,SAAS,YAAY,CAAC,KAAa,EAAE,QAAgB,EAAA;IACjD,IAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AAChC,IAAA,IAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAClF,OAAO,IAAI,GAAG,QAAQ,CAAA;AAC1B;;;;;"}
@@ -1,15 +1,15 @@
1
- import * as React from 'react';
2
- type BadgeTone = 'info' | 'positive' | 'promote' | 'attention' | 'warning';
3
- type BadgeProps = {
4
- /**
5
- * The label to show inside the badge element.
6
- */
7
- label: string;
8
- /**
9
- * The tone of the badge.
10
- */
11
- tone: BadgeTone;
12
- };
13
- declare function Badge({ tone, label, ...props }: BadgeProps): React.JSX.Element;
14
- export { Badge };
15
- export type { BadgeProps };
1
+ import * as React from 'react';
2
+ type BadgeTone = 'info' | 'positive' | 'promote' | 'attention' | 'warning';
3
+ type BadgeProps = {
4
+ /**
5
+ * The label to show inside the badge element.
6
+ */
7
+ label: string;
8
+ /**
9
+ * The tone of the badge.
10
+ */
11
+ tone: BadgeTone;
12
+ };
13
+ declare function Badge({ tone, label, ...props }: BadgeProps): React.JSX.Element;
14
+ export { Badge };
15
+ export type { BadgeProps };
@@ -1,2 +1,37 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../box/box.js"),a=require("./badge.module.css.js");function u(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,r}var l=u(r);const o=["tone","label"];exports.Badge=function(r){let{tone:u,label:n}=r,c=e.objectWithoutProperties(r,o);return l.createElement(t.Box,e.objectSpread2(e.objectSpread2({},c),{},{as:"span",display:"inline",className:[a.default.badge,a.default["badge-"+u]]}),n)};
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+ var box = require('../box/box.js');
8
+ var badge_module = require('./badge.module.css.js');
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n["default"] = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
+
30
+ function Badge(_a) {
31
+ var tone = _a.tone, label = _a.label, props = tslib.__rest(_a, ["tone", "label"]);
32
+ return (React__namespace.createElement(box.Box, tslib.__assign({}, props, { as: "span" // It enables putting the badge inside a button (https://stackoverflow.com/a/12982334)
33
+ , display: "inline", className: [badge_module["default"].badge, badge_module["default"]["badge-".concat(tone)]] }), label));
34
+ }
35
+
36
+ exports.Badge = Badge;
2
37
  //# sourceMappingURL=badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","sources":["../../src/badge/badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Box } from '../box'\n\nimport styles from './badge.module.css'\n\ntype BadgeTone = 'info' | 'positive' | 'promote' | 'attention' | 'warning'\n\ntype BadgeProps = {\n /**\n * The label to show inside the badge element.\n */\n label: string\n /**\n * The tone of the badge.\n */\n tone: BadgeTone\n}\n\nfunction Badge({ tone, label, ...props }: BadgeProps) {\n return (\n <Box\n {...props}\n as=\"span\" // It enables putting the badge inside a button (https://stackoverflow.com/a/12982334)\n display=\"inline\"\n className={[styles.badge, styles[`badge-${tone}`]]}\n >\n {label}\n </Box>\n )\n}\n\nexport { Badge }\nexport type { BadgeProps }\n"],"names":["_ref","tone","label","props","_objectWithoutProperties","objectWithoutProperties","_excluded","React","createElement","Box","as","display","className","styles","badge"],"mappings":"ihBAmBA,SAAoDA,GAAA,IAArCC,KAAEA,EAAFC,MAAQA,GAA6BF,EAAnBG,EAAmBC,EAAAC,wBAAAL,EAAAM,GAChD,OACIC,EAACC,cAAAC,yCACON,GADR,GAAA,CAEIO,GAAG,OACHC,QAAQ,SACRC,UAAW,CAACC,EAAM,QAACC,MAAOD,EAAAA,QAAO,SAASZ,MAEzCC"}
1
+ {"version":3,"file":"badge.js","sources":["../../src/badge/badge.tsx"],"sourcesContent":[null],"names":["__rest","React","Box","__assign","styles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,SAAS,KAAK,CAAC,EAAqC,EAAA;IAAnC,IAAA,IAAI,UAAA,EAAE,KAAK,WAAA,EAAK,KAAK,GAAvBA,YAAA,CAAA,EAAA,EAAA,CAAA,MAAA,EAAA,OAAA,CAAyB,CAAF,CAAA;IAClC,QACIC,gBAAC,CAAA,aAAA,CAAAC,OAAG,EACIC,cAAA,CAAA,EAAA,EAAA,KAAK,IACT,EAAE,EAAC,MAAM;UACT,OAAO,EAAC,QAAQ,EAChB,SAAS,EAAE,CAACC,uBAAM,CAAC,KAAK,EAAEA,uBAAM,CAAC,QAAA,CAAA,MAAA,CAAS,IAAI,CAAE,CAAC,CAAC,EAEjD,CAAA,EAAA,KAAK,CACJ,EACT;AACL;;;;"}
@@ -1,2 +1,8 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={badge:"_2714fc40","badge-info":"_3397e001","badge-positive":"b7b8944a","badge-promote":"bfc2b0e9","badge-attention":"d45e594f","badge-warning":"_1e30e9b3"};
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var modules_33c7c985 = {"badge":"_2714fc40","badge-info":"_3397e001","badge-positive":"b7b8944a","badge-promote":"bfc2b0e9","badge-attention":"d45e594f","badge-warning":"_1e30e9b3"};
6
+
7
+ exports["default"] = modules_33c7c985;
2
8
  //# sourceMappingURL=badge.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"badge.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"badge.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1 +1 @@
1
- export { Badge } from './badge';
1
+ export { Badge } from './badge';