@doist/reactist 9.2.0-beta.8 → 10.0.0-beta.12

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 (416) hide show
  1. package/README.md +12 -2
  2. package/dist/reactist.cjs.development.js +1499 -866
  3. package/dist/reactist.cjs.development.js.map +1 -1
  4. package/dist/reactist.cjs.production.min.js +1 -1
  5. package/dist/reactist.cjs.production.min.js.map +1 -1
  6. package/es/_virtual/_rollupPluginBabelHelpers.js +34 -20
  7. package/es/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  8. package/es/components/color-picker/color-picker.js +1 -1
  9. package/es/components/color-picker/color-picker.js.map +1 -1
  10. package/es/components/{button/button.js → deprecated-button/deprecated-button.js} +9 -4
  11. package/es/components/deprecated-button/deprecated-button.js.map +1 -0
  12. package/es/components/{button → deprecated-button}/index.js +1 -1
  13. package/es/components/{button → deprecated-button}/index.js.map +0 -0
  14. package/es/components/{loading/loading.js → deprecated-loading/deprecated-loading.js} +3 -1
  15. package/es/components/deprecated-loading/deprecated-loading.js.map +1 -0
  16. package/es/components/{modal/modal.js → deprecated-modal/deprecated-modal.js} +9 -2
  17. package/es/components/deprecated-modal/deprecated-modal.js.map +1 -0
  18. package/es/components/{modal → deprecated-modal}/index.js +1 -1
  19. package/es/components/deprecated-modal/index.js.map +1 -0
  20. package/es/components/dropdown/dropdown.js +8 -4
  21. package/es/components/dropdown/dropdown.js.map +1 -1
  22. package/es/components/error-message/error-message.js +4 -2
  23. package/es/components/error-message/error-message.js.map +1 -1
  24. package/es/components/icon/icon.js.map +1 -1
  25. package/es/components/key-capturer/key-capturer.js.map +1 -1
  26. package/es/components/keyboard-shortcut/keyboard-shortcut.js +6 -3
  27. package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  28. package/es/components/menu/menu.js +40 -27
  29. package/es/components/menu/menu.js.map +1 -1
  30. package/es/components/notification/notification.js +3 -1
  31. package/es/components/notification/notification.js.map +1 -1
  32. package/es/components/popover/popover.js.map +1 -1
  33. package/es/components/popover/positioning-utils.js.map +1 -1
  34. package/es/components/range-input/range-input.js +1 -1
  35. package/es/components/range-input/range-input.js.map +1 -1
  36. package/es/components/select/select.js +4 -2
  37. package/es/components/select/select.js.map +1 -1
  38. package/es/components/time/time-utils.js.map +1 -1
  39. package/es/components/time/time.js.map +1 -1
  40. package/es/components/tooltip/tooltip.js +3 -1
  41. package/es/components/tooltip/tooltip.js.map +1 -1
  42. package/es/hooks/use-previous/use-previous.js +26 -0
  43. package/es/hooks/use-previous/use-previous.js.map +1 -0
  44. package/es/index.js +11 -6
  45. package/es/index.js.map +1 -1
  46. package/es/new-components/base-button/base-button.js +72 -0
  47. package/es/new-components/base-button/base-button.js.map +1 -0
  48. package/es/new-components/base-button/base-button.module.css.js +4 -0
  49. package/es/new-components/base-button/base-button.module.css.js.map +1 -0
  50. package/es/new-components/base-field/base-field.js +29 -29
  51. package/es/new-components/base-field/base-field.js.map +1 -1
  52. package/es/new-components/base-field/base-field.module.css.js +1 -1
  53. package/es/new-components/box/box.js +29 -10
  54. package/es/new-components/box/box.js.map +1 -1
  55. package/es/new-components/box/box.module.css.js +1 -1
  56. package/es/new-components/box/margin.module.css.js +4 -0
  57. package/es/new-components/box/margin.module.css.js.map +1 -0
  58. package/es/new-components/box/padding.module.css.js +4 -0
  59. package/es/new-components/box/padding.module.css.js.map +1 -0
  60. package/es/new-components/button/button.js +41 -0
  61. package/es/new-components/button/button.js.map +1 -0
  62. package/es/new-components/button-link/button-link.js +26 -14
  63. package/es/new-components/button-link/button-link.js.map +1 -1
  64. package/es/new-components/checkbox-field/checkbox-field.js +46 -23
  65. package/es/new-components/checkbox-field/checkbox-field.js.map +1 -1
  66. package/es/new-components/checkbox-field/checkbox-field.module.css.js +1 -1
  67. package/es/new-components/checkbox-field/checkbox-icon.js +2 -1
  68. package/es/new-components/checkbox-field/checkbox-icon.js.map +1 -1
  69. package/es/new-components/columns/columns.js +28 -14
  70. package/es/new-components/columns/columns.js.map +1 -1
  71. package/es/new-components/columns/columns.module.css.js +1 -1
  72. package/es/new-components/divider/divider.js +6 -4
  73. package/es/new-components/divider/divider.js.map +1 -1
  74. package/es/new-components/divider/divider.module.css.js +1 -1
  75. package/es/new-components/heading/heading.js +10 -3
  76. package/es/new-components/heading/heading.js.map +1 -1
  77. package/es/new-components/heading/heading.module.css.js +1 -1
  78. package/es/new-components/hidden/hidden.js +55 -0
  79. package/es/new-components/hidden/hidden.js.map +1 -0
  80. package/es/new-components/hidden/hidden.module.css.js +4 -0
  81. package/es/new-components/hidden/hidden.module.css.js.map +1 -0
  82. package/es/new-components/hidden-visually/hidden-visually.js +22 -0
  83. package/es/new-components/hidden-visually/hidden-visually.js.map +1 -0
  84. package/es/new-components/hidden-visually/hidden-visually.module.css.js +4 -0
  85. package/es/new-components/hidden-visually/hidden-visually.module.css.js.map +1 -0
  86. package/es/new-components/icons/alert-icon.js +2 -1
  87. package/es/new-components/icons/alert-icon.js.map +1 -1
  88. package/es/new-components/inline/inline.js +10 -8
  89. package/es/new-components/inline/inline.js.map +1 -1
  90. package/es/new-components/loading/loading.js +34 -0
  91. package/es/new-components/loading/loading.js.map +1 -0
  92. package/es/new-components/modal/modal.js +206 -0
  93. package/es/new-components/modal/modal.js.map +1 -0
  94. package/es/new-components/modal/modal.module.css.js +4 -0
  95. package/es/new-components/modal/modal.module.css.js.map +1 -0
  96. package/es/new-components/password-field/password-field.js +8 -4
  97. package/es/new-components/password-field/password-field.js.map +1 -1
  98. package/es/new-components/responsive-props.js +21 -11
  99. package/es/new-components/responsive-props.js.map +1 -1
  100. package/es/new-components/select-field/select-field.js +13 -6
  101. package/es/new-components/select-field/select-field.js.map +1 -1
  102. package/es/new-components/select-field/select-field.module.css.js +1 -1
  103. package/es/new-components/spinner/spinner.js +26 -0
  104. package/es/new-components/spinner/spinner.js.map +1 -0
  105. package/es/new-components/spinner/spinner.module.css.js +4 -0
  106. package/es/new-components/spinner/spinner.module.css.js.map +1 -0
  107. package/es/new-components/stack/stack.js +23 -12
  108. package/es/new-components/stack/stack.js.map +1 -1
  109. package/es/new-components/switch-field/switch-field.js +48 -28
  110. package/es/new-components/switch-field/switch-field.js.map +1 -1
  111. package/es/new-components/switch-field/switch-field.module.css.js +1 -1
  112. package/es/new-components/tabs/tabs.js +147 -0
  113. package/es/new-components/tabs/tabs.js.map +1 -0
  114. package/es/new-components/tabs/tabs.module.css.js +4 -0
  115. package/es/new-components/tabs/tabs.module.css.js.map +1 -0
  116. package/es/new-components/text/text.js +16 -10
  117. package/es/new-components/text/text.js.map +1 -1
  118. package/es/new-components/text/text.module.css.js +1 -1
  119. package/es/new-components/text-area/text-area.js +3 -1
  120. package/es/new-components/text-area/text-area.js.map +1 -1
  121. package/es/new-components/text-area/text-area.module.css.js +1 -1
  122. package/es/new-components/text-field/text-field.js +5 -2
  123. package/es/new-components/text-field/text-field.js.map +1 -1
  124. package/es/new-components/text-field/text-field.module.css.js +1 -1
  125. package/es/new-components/text-link/text-link.js +9 -7
  126. package/es/new-components/text-link/text-link.js.map +1 -1
  127. package/es/utils/polymorphism.js +17 -0
  128. package/es/utils/polymorphism.js.map +1 -0
  129. package/lib/_virtual/_rollupPluginBabelHelpers.js +1 -1
  130. package/lib/components/color-picker/color-picker.js +1 -1
  131. package/lib/components/color-picker/color-picker.js.map +1 -1
  132. package/lib/components/{button/button.d.ts → deprecated-button/deprecated-button.d.ts} +7 -1
  133. package/lib/components/deprecated-button/deprecated-button.js +2 -0
  134. package/lib/components/deprecated-button/deprecated-button.js.map +1 -0
  135. package/lib/components/{button/button.test.d.ts → deprecated-button/deprecated-button.test.d.ts} +0 -0
  136. package/lib/components/deprecated-button/index.d.ts +4 -0
  137. package/lib/components/{loading → deprecated-button}/index.js +1 -1
  138. package/lib/components/{button → deprecated-button}/index.js.map +0 -0
  139. package/lib/components/{loading/loading.d.ts → deprecated-loading/deprecated-loading.d.ts} +2 -1
  140. package/lib/components/{loading/loading.js → deprecated-loading/deprecated-loading.js} +1 -1
  141. package/lib/components/deprecated-loading/deprecated-loading.js.map +1 -0
  142. package/lib/components/{loading/Loading.test.d.ts → deprecated-loading/deprecated-loading.test.d.ts} +0 -0
  143. package/lib/components/deprecated-loading/index.d.ts +1 -0
  144. package/lib/components/{modal/modal.d.ts → deprecated-modal/deprecated-modal.d.ts} +6 -1
  145. package/lib/components/{modal/modal.js → deprecated-modal/deprecated-modal.js} +2 -2
  146. package/lib/components/deprecated-modal/deprecated-modal.js.map +1 -0
  147. package/lib/components/{modal/modal.test.d.ts → deprecated-modal/deprecated-modal.test.d.ts} +0 -0
  148. package/lib/components/{modal → deprecated-modal}/index.d.ts +3 -3
  149. package/lib/components/deprecated-modal/index.js +2 -0
  150. package/lib/components/deprecated-modal/index.js.map +1 -0
  151. package/lib/components/dropdown/dropdown.js +1 -1
  152. package/lib/components/dropdown/dropdown.js.map +1 -1
  153. package/lib/components/error-message/error-message.js +1 -1
  154. package/lib/components/error-message/error-message.js.map +1 -1
  155. package/lib/components/keyboard-shortcut/keyboard-shortcut.js +1 -1
  156. package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
  157. package/lib/components/menu/index.d.ts +1 -1
  158. package/lib/components/menu/menu.d.ts +8 -10
  159. package/lib/components/menu/menu.js +1 -1
  160. package/lib/components/menu/menu.js.map +1 -1
  161. package/lib/components/notification/notification.js +1 -1
  162. package/lib/components/notification/notification.js.map +1 -1
  163. package/lib/components/range-input/range-input.js +1 -1
  164. package/lib/components/range-input/range-input.js.map +1 -1
  165. package/lib/components/select/select.js +1 -1
  166. package/lib/components/select/select.js.map +1 -1
  167. package/lib/components/tooltip/index.d.ts +1 -1
  168. package/lib/components/tooltip/tooltip.js +1 -1
  169. package/lib/components/tooltip/tooltip.js.map +1 -1
  170. package/lib/hooks/use-previous/index.d.ts +1 -0
  171. package/lib/hooks/use-previous/use-previous.d.ts +15 -0
  172. package/lib/hooks/use-previous/use-previous.js +2 -0
  173. package/lib/hooks/use-previous/use-previous.js.map +1 -0
  174. package/lib/index.d.ts +10 -5
  175. package/lib/index.js +1 -1
  176. package/lib/new-components/base-button/base-button.d.ts +65 -0
  177. package/lib/new-components/base-button/base-button.js +2 -0
  178. package/lib/new-components/base-button/base-button.js.map +1 -0
  179. package/lib/new-components/base-button/base-button.module.css.js +2 -0
  180. package/lib/new-components/base-button/base-button.module.css.js.map +1 -0
  181. package/lib/new-components/base-button/index.d.ts +1 -0
  182. package/lib/new-components/base-field/base-field.d.ts +53 -13
  183. package/lib/new-components/base-field/base-field.js +1 -1
  184. package/lib/new-components/base-field/base-field.js.map +1 -1
  185. package/lib/new-components/base-field/base-field.module.css.js +1 -1
  186. package/lib/new-components/box/box.d.ts +24 -13
  187. package/lib/new-components/box/box.js +1 -1
  188. package/lib/new-components/box/box.js.map +1 -1
  189. package/lib/new-components/box/box.module.css.js +1 -1
  190. package/lib/{components/tabs/tabs.test.d.ts → new-components/box/box.test.d.ts} +0 -0
  191. package/lib/new-components/box/margin.module.css.js +2 -0
  192. package/lib/new-components/box/margin.module.css.js.map +1 -0
  193. package/lib/new-components/box/padding.module.css.js +2 -0
  194. package/lib/new-components/box/padding.module.css.js.map +1 -0
  195. package/lib/new-components/button/button.d.ts +48 -0
  196. package/lib/new-components/button/button.js +2 -0
  197. package/lib/new-components/button/button.js.map +1 -0
  198. package/lib/new-components/button/button.test.d.ts +1 -0
  199. package/lib/new-components/button/index.d.ts +1 -0
  200. package/lib/new-components/button-link/button-link-story-wrapper.d.ts +7 -0
  201. package/lib/new-components/button-link/button-link.d.ts +14 -8
  202. package/lib/new-components/button-link/button-link.js +1 -1
  203. package/lib/new-components/button-link/button-link.js.map +1 -1
  204. package/lib/new-components/button-link/button-link.test.d.ts +1 -0
  205. package/lib/new-components/checkbox-field/checkbox-field.d.ts +3 -3
  206. package/lib/new-components/checkbox-field/checkbox-field.js +1 -1
  207. package/lib/new-components/checkbox-field/checkbox-field.js.map +1 -1
  208. package/lib/new-components/checkbox-field/checkbox-field.module.css.js +1 -1
  209. package/lib/new-components/checkbox-field/checkbox-field.test.d.ts +1 -0
  210. package/lib/new-components/checkbox-field/checkbox-icon.js +1 -1
  211. package/lib/new-components/checkbox-field/checkbox-icon.js.map +1 -1
  212. package/lib/new-components/columns/columns.d.ts +4 -5
  213. package/lib/new-components/columns/columns.js +1 -1
  214. package/lib/new-components/columns/columns.js.map +1 -1
  215. package/lib/new-components/columns/columns.module.css.js +1 -1
  216. package/lib/new-components/columns/columns.test.d.ts +1 -0
  217. package/lib/new-components/common-types.d.ts +2 -0
  218. package/lib/new-components/divider/divider.d.ts +2 -2
  219. package/lib/new-components/divider/divider.js +1 -1
  220. package/lib/new-components/divider/divider.js.map +1 -1
  221. package/lib/new-components/divider/divider.module.css.js +1 -1
  222. package/lib/new-components/heading/heading.d.ts +101 -2
  223. package/lib/new-components/heading/heading.js +1 -1
  224. package/lib/new-components/heading/heading.js.map +1 -1
  225. package/lib/new-components/heading/heading.module.css.js +1 -1
  226. package/lib/new-components/heading/heading.test.d.ts +1 -0
  227. package/lib/new-components/hidden/hidden.d.ts +49 -0
  228. package/lib/new-components/hidden/hidden.js +2 -0
  229. package/lib/new-components/hidden/hidden.js.map +1 -0
  230. package/lib/new-components/hidden/hidden.module.css.js +2 -0
  231. package/lib/new-components/hidden/hidden.module.css.js.map +1 -0
  232. package/lib/new-components/hidden/hidden.test.d.ts +1 -0
  233. package/lib/new-components/hidden/index.d.ts +1 -0
  234. package/lib/new-components/hidden-visually/hidden-visually.d.ts +11 -0
  235. package/lib/new-components/hidden-visually/hidden-visually.js +2 -0
  236. package/lib/new-components/hidden-visually/hidden-visually.js.map +1 -0
  237. package/lib/new-components/hidden-visually/hidden-visually.module.css.js +2 -0
  238. package/lib/new-components/hidden-visually/hidden-visually.module.css.js.map +1 -0
  239. package/lib/new-components/hidden-visually/hidden-visually.test.d.ts +1 -0
  240. package/lib/new-components/hidden-visually/index.d.ts +1 -0
  241. package/lib/new-components/icons/alert-icon.js +1 -1
  242. package/lib/new-components/icons/alert-icon.js.map +1 -1
  243. package/lib/new-components/inline/inline.d.ts +1 -2
  244. package/lib/new-components/inline/inline.js +1 -1
  245. package/lib/new-components/inline/inline.js.map +1 -1
  246. package/lib/new-components/inline/inline.test.d.ts +1 -0
  247. package/lib/new-components/loading/index.d.ts +1 -0
  248. package/lib/new-components/loading/loading.d.ts +26 -0
  249. package/lib/new-components/loading/loading.js +2 -0
  250. package/lib/new-components/loading/loading.js.map +1 -0
  251. package/lib/new-components/loading/loading.test.d.ts +1 -0
  252. package/lib/new-components/modal/index.d.ts +1 -0
  253. package/lib/new-components/modal/modal-stories-components.d.ts +35 -0
  254. package/lib/new-components/modal/modal.d.ts +151 -0
  255. package/lib/new-components/modal/modal.js +2 -0
  256. package/lib/new-components/modal/modal.js.map +1 -0
  257. package/lib/new-components/modal/modal.module.css.js +2 -0
  258. package/lib/new-components/modal/modal.module.css.js.map +1 -0
  259. package/lib/new-components/modal/modal.test.d.ts +1 -0
  260. package/lib/new-components/password-field/password-field.d.ts +2 -2
  261. package/lib/new-components/password-field/password-field.js +1 -1
  262. package/lib/new-components/password-field/password-field.js.map +1 -1
  263. package/lib/new-components/password-field/password-field.test.d.ts +1 -0
  264. package/lib/new-components/responsive-props.d.ts +12 -14
  265. package/lib/new-components/responsive-props.js +1 -1
  266. package/lib/new-components/responsive-props.js.map +1 -1
  267. package/lib/new-components/select-field/select-field.d.ts +4 -4
  268. package/lib/new-components/select-field/select-field.js +1 -1
  269. package/lib/new-components/select-field/select-field.js.map +1 -1
  270. package/lib/new-components/select-field/select-field.module.css.js +1 -1
  271. package/lib/new-components/select-field/select-field.test.d.ts +1 -0
  272. package/lib/new-components/spinner/index.d.ts +1 -0
  273. package/lib/new-components/spinner/spinner.d.ts +5 -0
  274. package/lib/new-components/spinner/spinner.js +2 -0
  275. package/lib/new-components/spinner/spinner.js.map +1 -0
  276. package/lib/new-components/spinner/spinner.module.css.js +2 -0
  277. package/lib/new-components/spinner/spinner.module.css.js.map +1 -0
  278. package/lib/new-components/stack/stack.d.ts +8 -5
  279. package/lib/new-components/stack/stack.js +1 -1
  280. package/lib/new-components/stack/stack.js.map +1 -1
  281. package/lib/new-components/stack/stack.test.d.ts +1 -0
  282. package/lib/new-components/switch-field/switch-field.d.ts +4 -4
  283. package/lib/new-components/switch-field/switch-field.js +1 -1
  284. package/lib/new-components/switch-field/switch-field.js.map +1 -1
  285. package/lib/new-components/switch-field/switch-field.module.css.js +1 -1
  286. package/lib/new-components/switch-field/switch-field.test.d.ts +1 -0
  287. package/lib/new-components/tabs/index.d.ts +1 -0
  288. package/lib/new-components/tabs/tabs.d.ts +92 -0
  289. package/lib/new-components/tabs/tabs.js +2 -0
  290. package/lib/new-components/tabs/tabs.js.map +1 -0
  291. package/lib/new-components/tabs/tabs.module.css.js +2 -0
  292. package/lib/new-components/tabs/tabs.module.css.js.map +1 -0
  293. package/lib/new-components/tabs/tabs.test.d.ts +1 -0
  294. package/lib/new-components/test-helpers.d.ts +9 -0
  295. package/lib/new-components/text/text.d.ts +38 -5
  296. package/lib/new-components/text/text.js +1 -1
  297. package/lib/new-components/text/text.js.map +1 -1
  298. package/lib/new-components/text/text.module.css.js +1 -1
  299. package/lib/new-components/text/text.test.d.ts +1 -0
  300. package/lib/new-components/text-area/text-area.d.ts +2 -2
  301. package/lib/new-components/text-area/text-area.js +1 -1
  302. package/lib/new-components/text-area/text-area.js.map +1 -1
  303. package/lib/new-components/text-area/text-area.module.css.js +1 -1
  304. package/lib/new-components/text-field/text-field.d.ts +7 -4
  305. package/lib/new-components/text-field/text-field.js +1 -1
  306. package/lib/new-components/text-field/text-field.js.map +1 -1
  307. package/lib/new-components/text-field/text-field.module.css.js +1 -1
  308. package/lib/new-components/text-field/text-field.test.d.ts +1 -0
  309. package/lib/new-components/text-link/text-link.d.ts +1 -2
  310. package/lib/new-components/text-link/text-link.js +1 -1
  311. package/lib/new-components/text-link/text-link.js.map +1 -1
  312. package/lib/utils/polymorphism.d.ts +151 -0
  313. package/lib/utils/polymorphism.js +2 -0
  314. package/lib/utils/polymorphism.js.map +1 -0
  315. package/package.json +27 -23
  316. package/styles/alert.css +4 -2
  317. package/styles/base-button.css +6 -0
  318. package/styles/base-button.module.css.css +1 -0
  319. package/styles/base-field.css +7 -3
  320. package/styles/base-field.module.css.css +1 -1
  321. package/styles/box.css +3 -0
  322. package/styles/box.module.css.css +1 -1
  323. package/styles/checkbox-field.css +6 -2
  324. package/styles/checkbox-field.module.css.css +1 -1
  325. package/styles/color-picker.css +1 -1
  326. package/styles/columns.css +4 -2
  327. package/styles/columns.module.css.css +1 -1
  328. package/styles/deprecated-button.css +2 -0
  329. package/styles/deprecated-loading.css +1 -0
  330. package/styles/deprecated-modal.css +1 -0
  331. package/styles/divider.css +4 -2
  332. package/styles/divider.module.css.css +1 -1
  333. package/styles/dropdown.css +1 -1
  334. package/styles/heading.css +4 -2
  335. package/styles/heading.module.css.css +1 -1
  336. package/styles/hidden-visually.css +4 -0
  337. package/styles/hidden-visually.module.css.css +1 -0
  338. package/styles/hidden.css +4 -0
  339. package/styles/hidden.module.css.css +1 -0
  340. package/styles/inline.css +3 -1
  341. package/styles/loading.css +4 -1
  342. package/styles/margin.module.css.css +1 -0
  343. package/styles/menu.css +1 -1
  344. package/styles/modal.css +10 -1
  345. package/styles/modal.module.css.css +1 -0
  346. package/styles/notice.css +4 -2
  347. package/styles/padding.module.css.css +1 -0
  348. package/styles/password-field.css +8 -4
  349. package/styles/reactist.css +24 -19
  350. package/styles/select-field.css +8 -4
  351. package/styles/select-field.module.css.css +1 -1
  352. package/styles/spinner.module.css.css +1 -0
  353. package/styles/stack.css +4 -2
  354. package/styles/switch-field.css +9 -4
  355. package/styles/switch-field.module.css.css +1 -1
  356. package/styles/tabs.css +5 -1
  357. package/styles/tabs.module.css.css +1 -0
  358. package/styles/text-area.css +8 -4
  359. package/styles/text-area.module.css.css +1 -1
  360. package/styles/text-field.css +8 -4
  361. package/styles/text-field.module.css.css +1 -1
  362. package/styles/text-link.css +3 -1
  363. package/styles/text.css +4 -2
  364. package/styles/text.module.css.css +1 -1
  365. package/styles/tip.css +1 -1
  366. package/CHANGELOG.md +0 -496
  367. package/es/components/button/button.js.map +0 -1
  368. package/es/components/loading/index.js +0 -6
  369. package/es/components/loading/index.js.map +0 -1
  370. package/es/components/loading/loading.js.map +0 -1
  371. package/es/components/menu/type-helpers.js +0 -9
  372. package/es/components/menu/type-helpers.js.map +0 -1
  373. package/es/components/modal/index.js.map +0 -1
  374. package/es/components/modal/modal.js.map +0 -1
  375. package/es/components/tabs/tabs.js +0 -123
  376. package/es/components/tabs/tabs.js.map +0 -1
  377. package/es/new-components/button-link/button-link.module.css.js +0 -4
  378. package/es/new-components/button-link/button-link.module.css.js.map +0 -1
  379. package/es/new-components/loading-spinner/loading-spinner.js +0 -37
  380. package/es/new-components/loading-spinner/loading-spinner.js.map +0 -1
  381. package/es/new-components/loading-spinner/loading-spinner.module.css.js +0 -4
  382. package/es/new-components/loading-spinner/loading-spinner.module.css.js.map +0 -1
  383. package/es/new-components/type-helpers.js +0 -10
  384. package/es/new-components/type-helpers.js.map +0 -1
  385. package/lib/components/button/button.js +0 -2
  386. package/lib/components/button/button.js.map +0 -1
  387. package/lib/components/button/index.d.ts +0 -4
  388. package/lib/components/button/index.js +0 -2
  389. package/lib/components/loading/index.d.ts +0 -2
  390. package/lib/components/loading/index.js.map +0 -1
  391. package/lib/components/loading/loading.js.map +0 -1
  392. package/lib/components/menu/type-helpers.d.ts +0 -25
  393. package/lib/components/menu/type-helpers.js +0 -2
  394. package/lib/components/menu/type-helpers.js.map +0 -1
  395. package/lib/components/modal/index.js +0 -2
  396. package/lib/components/modal/index.js.map +0 -1
  397. package/lib/components/modal/modal.js.map +0 -1
  398. package/lib/components/tabs/index.d.ts +0 -1
  399. package/lib/components/tabs/tabs.d.ts +0 -33
  400. package/lib/components/tabs/tabs.js +0 -2
  401. package/lib/components/tabs/tabs.js.map +0 -1
  402. package/lib/new-components/button-link/button-link.module.css.js +0 -2
  403. package/lib/new-components/button-link/button-link.module.css.js.map +0 -1
  404. package/lib/new-components/loading-spinner/index.d.ts +0 -1
  405. package/lib/new-components/loading-spinner/loading-spinner.d.ts +0 -8
  406. package/lib/new-components/loading-spinner/loading-spinner.js +0 -2
  407. package/lib/new-components/loading-spinner/loading-spinner.js.map +0 -1
  408. package/lib/new-components/loading-spinner/loading-spinner.module.css.js +0 -2
  409. package/lib/new-components/loading-spinner/loading-spinner.module.css.js.map +0 -1
  410. package/lib/new-components/type-helpers.d.ts +0 -26
  411. package/lib/new-components/type-helpers.js +0 -2
  412. package/lib/new-components/type-helpers.js.map +0 -1
  413. package/styles/button-link.css +0 -2
  414. package/styles/button-link.module.css.css +0 -1
  415. package/styles/button.css +0 -2
  416. package/styles/loading-spinner.module.css.css +0 -1
@@ -1,14 +1,47 @@
1
1
  import * as React from 'react';
2
- import { ComponentTypes } from '../type-helpers';
3
2
  import type { Tone } from '../common-types';
3
+ import type { BoxProps } from '../box';
4
4
  declare type TextProps = {
5
- component?: ComponentTypes;
6
5
  children: React.ReactNode;
7
- size?: 'xsmall' | 'small' | 'standard' | 'large' | 'xlarge';
8
- weight?: 'regular' | 'medium' | 'strong';
6
+ /**
7
+ * The size of the text.
8
+ *
9
+ * The supported values, from smaller size to larger size, are:
10
+ * 'caption', 'copy', 'body', and 'subtitle'
11
+ *
12
+ * @default 'body'
13
+ */
14
+ size?: 'caption' | 'copy' | 'body' | 'subtitle';
15
+ /**
16
+ * The weight of the text font.
17
+ *
18
+ * @default 'regular'
19
+ */
20
+ weight?: 'regular' | 'semibold' | 'bold';
21
+ /**
22
+ * The tone (semantic color) of the text.
23
+ *
24
+ * @default 'normal'
25
+ */
9
26
  tone?: Tone;
27
+ /**
28
+ * Used to truncate the text to a given number of lines.
29
+ *
30
+ * It will add an ellipsis (`…`) to the text at the end of the last line, only if the text was
31
+ * truncated. If the text fits without it being truncated, no ellipsis is added.
32
+ *
33
+ * By default, the text is not truncated at all, no matter how many lines it takes to render it.
34
+ *
35
+ * @default undefined
36
+ */
10
37
  lineClamp?: 1 | 2 | 3 | 4 | 5 | '1' | '2' | '3' | '4' | '5';
38
+ /**
39
+ * How to align the text horizontally.
40
+ *
41
+ * @default 'start'
42
+ */
43
+ align?: BoxProps['textAlign'];
11
44
  };
12
- declare const Text: import("../type-helpers").ForwardRefComponentWithAs<TextProps, React.ElementType<any>>;
45
+ declare const Text: import("../../utils/polymorphism").PolymorphicComponent<"div", TextProps, "obfuscateClassName">;
13
46
  export type { TextProps };
14
47
  export { Text };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),r=require("../type-helpers.js"),l=require("../responsive-props.js"),s=require("../box/box.js"),a=require("./text.module.css.js");exports.Text=r.forwardRefWithAs((function(r,n){var o=r.component,i=void 0===o?"span":o,u=r.size,p=void 0===u?"standard":u,d=r.weight,m=void 0===d?"regular":d,c=r.tone,g=void 0===c?"normal":c,f=r.children,v=r.lineClamp,h=e.objectWithoutPropertiesLoose(r,["component","size","weight","tone","children","lineClamp"]),j="string"==typeof v?parseInt(v,10)>1:(v||0)>1;return t.createElement(s.Box,Object.assign({},h,{component:i,className:[a.default.text,"standard"!==p?l.getClassNames(a.default,"size",p):null,"regular"!==m?l.getClassNames(a.default,"weight",m):null,"normal"!==g?l.getClassNames(a.default,"tone",g):null,j?a.default.lineClamp:null,v?l.getClassNames(a.default,"line-clamp",v.toString()):null],ref:n}),f)}));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),l=require("react"),t=require("../../utils/polymorphism.js"),s=require("../responsive-props.js"),a=require("../box/box.js"),i=require("./text.module.css.js"),r=["as","size","weight","tone","align","children","lineClamp","exceptionallySetClassName"];exports.Text=t.polymorphicComponent((function(t,o){var n=t.as,u=t.size,p=void 0===u?"body":u,m=t.weight,d=void 0===m?"regular":m,g=t.tone,c=void 0===g?"normal":g,x=t.align,C=t.children,f=t.lineClamp,b=t.exceptionallySetClassName,h=e.objectWithoutPropertiesLoose(t,r),v="string"==typeof f?Number(f)>1:(null!=f?f:1)>1;return l.createElement(a.Box,Object.assign({},h,{as:n,className:[b,i.default.text,"body"!==p?s.getClassNames(i.default,"size",p):null,"regular"!==d?s.getClassNames(i.default,"weight",d):null,"normal"!==c?s.getClassNames(i.default,"tone",c):null,v?i.default.lineClampMultipleLines:null,f?s.getClassNames(i.default,"lineClamp",f.toString()):null],textAlign:x,paddingRight:f?"xsmall":void 0,ref:o}),C)}));
2
2
  //# sourceMappingURL=text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sources":["../../../src/new-components/text/text.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../responsive-props'\nimport { Box } from '../box'\n\nimport { ComponentTypes, forwardRefWithAs } from '../type-helpers'\nimport type { Tone } from '../common-types'\n\nimport styles from './text.module.css'\n\ntype TextProps = {\n component?: ComponentTypes\n children: React.ReactNode\n size?: 'xsmall' | 'small' | 'standard' | 'large' | 'xlarge'\n weight?: 'regular' | 'medium' | 'strong'\n tone?: Tone\n lineClamp?: 1 | 2 | 3 | 4 | 5 | '1' | '2' | '3' | '4' | '5'\n}\n\nconst Text = forwardRefWithAs<TextProps>(function Text(\n {\n component = 'span',\n size = 'standard',\n weight = 'regular',\n tone = 'normal',\n children,\n lineClamp,\n ...rest\n },\n ref,\n) {\n const lineClampMultipleLines =\n typeof lineClamp === 'string' ? parseInt(lineClamp, 10) > 1 : (lineClamp || 0) > 1\n\n return (\n <Box\n {...rest}\n component={component}\n className={[\n styles.text,\n size !== 'standard' ? getClassNames(styles, 'size', size) : null,\n weight !== 'regular' ? getClassNames(styles, 'weight', weight) : null,\n tone !== 'normal' ? getClassNames(styles, 'tone', tone) : null,\n lineClampMultipleLines ? styles.lineClamp : null,\n lineClamp ? getClassNames(styles, 'line-clamp', lineClamp.toString()) : null,\n ]}\n ref={ref}\n >\n {children}\n </Box>\n )\n})\n\nexport type { TextProps }\nexport { Text }\n"],"names":["forwardRefWithAs","ref","component","size","weight","tone","children","lineClamp","rest","lineClampMultipleLines","parseInt","React","Box","className","styles","text","getClassNames","toString"],"mappings":"kSAkBaA,oBAA4B,WAUrCC,WARIC,UAAAA,aAAY,aACZC,KAAAA,aAAO,iBACPC,OAAAA,aAAS,gBACTC,KAAAA,aAAO,WACPC,IAAAA,SACAC,IAAAA,UACGC,gGAIDC,EACmB,iBAAdF,EAAyBG,SAASH,EAAW,IAAM,GAAKA,GAAa,GAAK,SAGjFI,gBAACC,uBACOJ,GACJN,UAAWA,EACXW,UAAW,CACPC,UAAOC,KACE,aAATZ,EAAsBa,gBAAcF,UAAQ,OAAQX,GAAQ,KACjD,YAAXC,EAAuBY,gBAAcF,UAAQ,SAAUV,GAAU,KACxD,WAATC,EAAoBW,gBAAcF,UAAQ,OAAQT,GAAQ,KAC1DI,EAAyBK,UAAOP,UAAY,KAC5CA,EAAYS,gBAAcF,UAAQ,aAAcP,EAAUU,YAAc,MAE5EhB,IAAKA,IAEJK"}
1
+ {"version":3,"file":"text.js","sources":["../../../src/new-components/text/text.tsx"],"sourcesContent":["import * as React from 'react'\nimport { getClassNames } from '../responsive-props'\nimport { Box } from '../box'\nimport { polymorphicComponent } from '../../utils/polymorphism'\n\nimport type { Tone } from '../common-types'\nimport type { BoxProps } from '../box'\n\nimport styles from './text.module.css'\n\ntype TextProps = {\n children: React.ReactNode\n /**\n * The size of the text.\n *\n * The supported values, from smaller size to larger size, are:\n * 'caption', 'copy', 'body', and 'subtitle'\n *\n * @default 'body'\n */\n size?: 'caption' | 'copy' | 'body' | 'subtitle'\n /**\n * The weight of the text font.\n *\n * @default 'regular'\n */\n weight?: 'regular' | 'semibold' | 'bold'\n /**\n * The tone (semantic color) of the text.\n *\n * @default 'normal'\n */\n tone?: Tone\n /**\n * Used to truncate the text to a given number of lines.\n *\n * It will add an ellipsis (`…`) to the text at the end of the last line, only if the text was\n * truncated. If the text fits without it being truncated, no ellipsis is added.\n *\n * By default, the text is not truncated at all, no matter how many lines it takes to render it.\n *\n * @default undefined\n */\n lineClamp?: 1 | 2 | 3 | 4 | 5 | '1' | '2' | '3' | '4' | '5'\n /**\n * How to align the text horizontally.\n *\n * @default 'start'\n */\n align?: BoxProps['textAlign']\n}\n\nconst Text = polymorphicComponent<'div', TextProps>(function Text(\n {\n as,\n size = 'body',\n weight = 'regular',\n tone = 'normal',\n align,\n children,\n lineClamp,\n exceptionallySetClassName,\n ...props\n },\n ref,\n) {\n const lineClampMultipleLines =\n typeof lineClamp === 'string' ? Number(lineClamp) > 1 : (lineClamp ?? 1) > 1\n\n return (\n <Box\n {...props}\n as={as}\n className={[\n exceptionallySetClassName,\n styles.text,\n size !== 'body' ? getClassNames(styles, 'size', size) : null,\n weight !== 'regular' ? getClassNames(styles, 'weight', weight) : null,\n tone !== 'normal' ? getClassNames(styles, 'tone', tone) : null,\n lineClampMultipleLines ? styles.lineClampMultipleLines : null,\n lineClamp ? getClassNames(styles, 'lineClamp', lineClamp.toString()) : null,\n ]}\n textAlign={align}\n // Prevents emojis from being cut-off\n // See https://github.com/Doist/reactist/pull/528\n paddingRight={lineClamp ? 'xsmall' : undefined}\n ref={ref}\n >\n {children}\n </Box>\n )\n})\n\nexport type { TextProps }\nexport { Text }\n"],"names":["polymorphicComponent","ref","as","size","weight","tone","align","children","lineClamp","exceptionallySetClassName","props","lineClampMultipleLines","Number","React","Box","className","styles","text","getClassNames","toString","textAlign","paddingRight","undefined"],"mappings":"sYAoDaA,wBAAuC,WAYhDC,OAVIC,IAAAA,OACAC,KAAAA,aAAO,aACPC,OAAAA,aAAS,gBACTC,KAAAA,aAAO,WACPC,IAAAA,MACAC,IAAAA,SACAC,IAAAA,UACAC,IAAAA,0BACGC,sCAIDC,EACmB,iBAAdH,EAAyBI,OAAOJ,GAAa,GAAKA,MAAAA,EAAAA,EAAa,GAAK,SAG3EK,gBAACC,uBACOJ,GACJR,GAAIA,EACJa,UAAW,CACPN,EACAO,UAAOC,KACE,SAATd,EAAkBe,gBAAcF,UAAQ,OAAQb,GAAQ,KAC7C,YAAXC,EAAuBc,gBAAcF,UAAQ,SAAUZ,GAAU,KACxD,WAATC,EAAoBa,gBAAcF,UAAQ,OAAQX,GAAQ,KAC1DM,EAAyBK,UAAOL,uBAAyB,KACzDH,EAAYU,gBAAcF,UAAQ,YAAaR,EAAUW,YAAc,MAE3EC,UAAWd,EAGXe,aAAcb,EAAY,cAAWc,EACrCrB,IAAKA,IAEJM"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={text:"e25b6eac","size-xsmall":"_7be564c9","size-small":"_0b65f3be","size-large":"_148c266b","size-xlarge":"efa6a189","weight-medium":"a1ce91c1","weight-strong":"_615a6cf6","tone-secondary":"e1348c0a","tone-danger":"f2471c06","line-clamp-1":"_8f257fa0",lineClamp:"b219e836","line-clamp-2":"d1379189","line-clamp-3":"edc9a040","line-clamp-4":"d463b64b","line-clamp-5":"_4feee537"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={text:"c12d1277","size-caption":"c88e1204","size-copy":"_426d67ec","size-subtitle":"f978d6c7","weight-semibold":"_0c31eccd","weight-bold":"aba17bdd","tone-secondary":"_2767b43d","tone-danger":"e8ae531e",lineClampMultipleLines:"dc839422","lineClamp-1":"e2d23135","lineClamp-2":"_7c778b7e","lineClamp-3":"_5ff41166","lineClamp-4":"b7a4998e","lineClamp-5":"_6a7f8803"};
2
2
  //# sourceMappingURL=text.module.css.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { BaseFieldProps } from '../base-field';
3
- declare type TextAreaProps = BaseFieldProps<HTMLTextAreaElement>;
2
+ import { FieldComponentProps } from '../base-field';
3
+ declare type TextAreaProps = FieldComponentProps<HTMLTextAreaElement>;
4
4
  declare function TextArea({ id, label, secondaryLabel, auxiliaryLabel, hint, maxWidth, ...props }: TextAreaProps): JSX.Element;
5
5
  export { TextArea };
6
6
  export type { TextAreaProps };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),a=require("react"),r=require("../box/box.js"),t=require("../base-field/base-field.js"),i=require("./text-area.module.css.js");exports.TextArea=function(l){var s=l.id,u=l.label,n=l.secondaryLabel,o=l.auxiliaryLabel,b=l.hint,d=l.maxWidth,c=e.objectWithoutPropertiesLoose(l,["id","label","secondaryLabel","auxiliaryLabel","hint","maxWidth"]);return a.createElement(t.BaseField,{id:s,label:u,secondaryLabel:n,auxiliaryLabel:o,hint:b,className:i.default.container,maxWidth:d},(function(e){return a.createElement(r.Box,{width:"full"},a.createElement("textarea",Object.assign({},c,e)))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),a=require("react"),r=require("../box/box.js"),t=require("../base-field/base-field.js"),i=require("./text-area.module.css.js"),l=["id","label","secondaryLabel","auxiliaryLabel","hint","maxWidth"];exports.TextArea=function(s){var u=s.id,n=s.label,o=s.secondaryLabel,b=s.auxiliaryLabel,d=s.hint,c=s.maxWidth,x=e.objectWithoutPropertiesLoose(s,l);return a.createElement(t.BaseField,{id:u,label:n,secondaryLabel:o,auxiliaryLabel:b,hint:d,className:i.default.container,maxWidth:c},(function(e){return a.createElement(r.Box,{width:"full"},a.createElement("textarea",Object.assign({},x,e)))}))};
2
2
  //# sourceMappingURL=text-area.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-area.js","sources":["../../../src/new-components/text-area/text-area.tsx"],"sourcesContent":["import * as React from 'react'\nimport { BaseField, BaseFieldProps } from '../base-field'\nimport { Box } from '../box'\nimport styles from './text-area.module.css'\n\ntype TextAreaProps = BaseFieldProps<HTMLTextAreaElement>\n\nfunction TextArea({\n id,\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n maxWidth,\n ...props\n}: TextAreaProps) {\n return (\n <BaseField\n id={id}\n label={label}\n secondaryLabel={secondaryLabel}\n auxiliaryLabel={auxiliaryLabel}\n hint={hint}\n className={styles.container}\n maxWidth={maxWidth}\n >\n {(extraProps) => (\n <Box width=\"full\">\n <textarea {...props} {...extraProps} />\n </Box>\n )}\n </BaseField>\n )\n}\n\nexport { TextArea }\nexport type { TextAreaProps }\n"],"names":["id","label","secondaryLabel","auxiliaryLabel","hint","maxWidth","props","React","BaseField","className","styles","container","extraProps","Box","width"],"mappings":"gRAOA,gBACIA,IAAAA,GACAC,IAAAA,MACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,KACAC,IAAAA,SACGC,8GAGCC,gBAACC,aACGR,GAAIA,EACJC,MAAOA,EACPC,eAAgBA,EAChBC,eAAgBA,EAChBC,KAAMA,EACNK,UAAWC,UAAOC,UAClBN,SAAUA,IAET,SAACO,UACEL,gBAACM,OAAIC,MAAM,QACPP,4CAAcD,EAAWM"}
1
+ {"version":3,"file":"text-area.js","sources":["../../../src/new-components/text-area/text-area.tsx"],"sourcesContent":["import * as React from 'react'\nimport { BaseField, FieldComponentProps } from '../base-field'\nimport { Box } from '../box'\nimport styles from './text-area.module.css'\n\ntype TextAreaProps = FieldComponentProps<HTMLTextAreaElement>\n\nfunction TextArea({\n id,\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n maxWidth,\n ...props\n}: TextAreaProps) {\n return (\n <BaseField\n id={id}\n label={label}\n secondaryLabel={secondaryLabel}\n auxiliaryLabel={auxiliaryLabel}\n hint={hint}\n className={styles.container}\n maxWidth={maxWidth}\n >\n {(extraProps) => (\n <Box width=\"full\">\n <textarea {...props} {...extraProps} />\n </Box>\n )}\n </BaseField>\n )\n}\n\nexport { TextArea }\nexport type { TextAreaProps }\n"],"names":["id","label","secondaryLabel","auxiliaryLabel","hint","maxWidth","props","React","BaseField","className","styles","container","extraProps","Box","width"],"mappings":"qVAOA,gBACIA,IAAAA,GACAC,IAAAA,MACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,KACAC,IAAAA,SACGC,6CAGCC,gBAACC,aACGR,GAAIA,EACJC,MAAOA,EACPC,eAAgBA,EAChBC,eAAgBA,EAChBC,KAAMA,EACNK,UAAWC,UAAOC,UAClBN,SAAUA,IAET,SAACO,UACEL,gBAACM,OAAIC,MAAM,QACPP,4CAAcD,EAAWM"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={container:"b2fe9429"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={container:"_5a579f96"};
2
2
  //# sourceMappingURL=text-area.module.css.js.map
@@ -1,6 +1,9 @@
1
1
  import * as React from 'react';
2
- import { BaseFieldProps } from '../base-field';
3
- declare type TextFieldProps = BaseFieldProps<HTMLInputElement>;
4
- declare const TextField: React.ForwardRefExoticComponent<Pick<TextFieldProps, "id" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "size" | "src" | "step" | "type" | "value" | "width" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "secondaryLabel" | "auxiliaryLabel" | "hint" | "maxWidth"> & React.RefAttributes<HTMLInputElement>>;
2
+ import type { FieldComponentProps } from '../base-field';
3
+ declare type TextFieldType = 'email' | 'search' | 'tel' | 'text' | 'url';
4
+ declare type TextFieldProps = Omit<FieldComponentProps<HTMLInputElement>, 'type'> & {
5
+ type?: TextFieldType;
6
+ };
7
+ declare const TextField: React.ForwardRefExoticComponent<Pick<TextFieldProps, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "secondaryLabel" | "auxiliaryLabel" | "hint" | "maxWidth" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "readOnly" | "required" | "size" | "src" | "step" | "type" | "value" | "width"> & React.RefAttributes<HTMLInputElement>>;
5
8
  export { TextField };
6
- export type { TextFieldProps };
9
+ export type { TextFieldProps, TextFieldType };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),i=require("../box/box.js"),t=require("../base-field/base-field.js"),a=require("./text-field.module.css.js");exports.TextField=r.forwardRef((function(l,d){var s=l.id,n=l.label,u=l.secondaryLabel,o=l.auxiliaryLabel,b=l.hint,c=l.type,x=void 0===c?"text":c,p=l.maxWidth,f=l.hidden,h=e.objectWithoutPropertiesLoose(l,["id","label","secondaryLabel","auxiliaryLabel","hint","type","maxWidth","hidden"]);return r.createElement(t.BaseField,{id:s,label:n,secondaryLabel:u,auxiliaryLabel:o,hint:b,maxWidth:p,hidden:f},(function(e){return r.createElement(i.Box,{className:a.default.inputWrapper},r.createElement("input",Object.assign({},h,e,{type:x,ref:d})))}))}));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),i=require("../box/box.js"),a=require("../base-field/base-field.js"),t=require("./text-field.module.css.js"),l=["id","label","secondaryLabel","auxiliaryLabel","hint","type","maxWidth","hidden","aria-describedby"];exports.TextField=r.forwardRef((function(d,s){var b=d.id,n=d.label,u=d.secondaryLabel,o=d.auxiliaryLabel,c=d.hint,x=d.type,p=void 0===x?"text":x,y=d.maxWidth,f=d.hidden,h=d["aria-describedby"],m=e.objectWithoutPropertiesLoose(d,l);return r.createElement(a.BaseField,{id:b,label:n,secondaryLabel:u,auxiliaryLabel:o,hint:c,maxWidth:y,hidden:f,"aria-describedby":h},(function(e){return r.createElement(i.Box,{className:t.default.inputWrapper},r.createElement("input",Object.assign({},m,e,{type:p,ref:s})))}))}));
2
2
  //# sourceMappingURL=text-field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-field.js","sources":["../../../src/new-components/text-field/text-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { BaseField, BaseFieldProps } from '../base-field'\nimport { Box } from '../box'\nimport styles from './text-field.module.css'\n\ntype TextFieldProps = BaseFieldProps<HTMLInputElement>\n\nconst TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(function TextField(\n { id, label, secondaryLabel, auxiliaryLabel, hint, type = 'text', maxWidth, hidden, ...props },\n ref,\n) {\n return (\n <BaseField\n id={id}\n label={label}\n secondaryLabel={secondaryLabel}\n auxiliaryLabel={auxiliaryLabel}\n hint={hint}\n maxWidth={maxWidth}\n hidden={hidden}\n >\n {(extraProps) => (\n <Box className={styles.inputWrapper}>\n <input {...props} {...extraProps} type={type} ref={ref} />\n </Box>\n )}\n </BaseField>\n )\n})\n\nexport { TextField }\nexport type { TextFieldProps }\n"],"names":["React","ref","id","label","secondaryLabel","auxiliaryLabel","hint","type","maxWidth","hidden","props","BaseField","extraProps","Box","className","styles","inputWrapper"],"mappings":"kRAOkBA,cAAmD,WAEjEC,OADEC,IAAAA,GAAIC,IAAAA,MAAOC,IAAAA,eAAgBC,IAAAA,eAAgBC,IAAAA,SAAMC,KAAAA,aAAO,SAAQC,IAAAA,SAAUC,IAAAA,OAAWC,8HAInFV,gBAACW,aACGT,GAAIA,EACJC,MAAOA,EACPC,eAAgBA,EAChBC,eAAgBA,EAChBC,KAAMA,EACNE,SAAUA,EACVC,OAAQA,IAEP,SAACG,UACEZ,gBAACa,OAAIC,UAAWC,UAAOC,cACnBhB,yCAAWU,EAAWE,GAAYL,KAAMA,EAAMN,IAAKA"}
1
+ {"version":3,"file":"text-field.js","sources":["../../../src/new-components/text-field/text-field.tsx"],"sourcesContent":["import * as React from 'react'\nimport { BaseField } from '../base-field'\nimport { Box } from '../box'\nimport styles from './text-field.module.css'\nimport type { FieldComponentProps } from '../base-field'\n\ntype TextFieldType = 'email' | 'search' | 'tel' | 'text' | 'url'\n\ntype TextFieldProps = Omit<FieldComponentProps<HTMLInputElement>, 'type'> & {\n type?: TextFieldType\n}\n\nconst TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(function TextField(\n {\n id,\n label,\n secondaryLabel,\n auxiliaryLabel,\n hint,\n type = 'text',\n maxWidth,\n hidden,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref,\n) {\n return (\n <BaseField\n id={id}\n label={label}\n secondaryLabel={secondaryLabel}\n auxiliaryLabel={auxiliaryLabel}\n hint={hint}\n maxWidth={maxWidth}\n hidden={hidden}\n aria-describedby={ariaDescribedBy}\n >\n {(extraProps) => (\n <Box className={styles.inputWrapper}>\n <input {...props} {...extraProps} type={type} ref={ref} />\n </Box>\n )}\n </BaseField>\n )\n})\n\nexport { TextField }\nexport type { TextFieldProps, TextFieldType }\n"],"names":["React","ref","id","label","secondaryLabel","auxiliaryLabel","hint","type","maxWidth","hidden","ariaDescribedBy","props","BaseField","extraProps","Box","className","styles","inputWrapper"],"mappings":"0XAYkBA,cAAmD,WAajEC,OAXIC,IAAAA,GACAC,IAAAA,MACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,SACAC,KAAAA,aAAO,SACPC,IAAAA,SACAC,IAAAA,OACoBC,IAApB,oBACGC,6CAKHX,gBAACY,aACGV,GAAIA,EACJC,MAAOA,EACPC,eAAgBA,EAChBC,eAAgBA,EAChBC,KAAMA,EACNE,SAAUA,EACVC,OAAQA,qBACUC,IAEjB,SAACG,UACEb,gBAACc,OAAIC,UAAWC,UAAOC,cACnBjB,yCAAWW,EAAWE,GAAYN,KAAMA,EAAMN,IAAKA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={inputWrapper:"_509cf6b5"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={inputWrapper:"dd9ffeab"};
2
2
  //# sourceMappingURL=text-field.module.css.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,5 @@
1
- import * as React from 'react';
2
1
  import type { OpenInNewTab } from '../common-types';
3
2
  declare type TextLinkProps = OpenInNewTab;
4
- declare const TextLink: import("../type-helpers").ForwardRefComponentWithAs<OpenInNewTab, React.ElementType<any>>;
3
+ declare const TextLink: import("../../utils/polymorphism").PolymorphicComponent<"a", OpenInNewTab, "obfuscateClassName">;
5
4
  export { TextLink };
6
5
  export type { TextLinkProps };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),o=require("../type-helpers.js"),t=require("../box/box.js"),n=require("./text-link.module.css.js");exports.TextLink=o.forwardRefWithAs((function(o,i){var s=o.component,a=void 0===s?"a":s,l=o.openInNewTab,u=void 0!==l&&l,p=e.objectWithoutPropertiesLoose(o,["component","tone","openInNewTab"]);return r.createElement(t.Box,Object.assign({},p,{component:a,display:"inline",className:n.default.container,ref:i,target:u?"_blank":void 0,rel:u?"noopener noreferrer":void 0}))}));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),o=require("../../utils/polymorphism.js"),t=require("../box/box.js"),i=require("./text-link.module.css.js"),s=["as","openInNewTab","exceptionallySetClassName"];exports.TextLink=o.polymorphicComponent((function(o,a){var l=o.as,n=void 0===l?"a":l,p=o.openInNewTab,u=void 0!==p&&p,c=o.exceptionallySetClassName,b=e.objectWithoutPropertiesLoose(o,s);return r.createElement(t.Box,Object.assign({},b,{as:n,display:"inline",className:[c,i.default.container],ref:a,target:u?"_blank":void 0,rel:u?"noopener noreferrer":void 0}))}));
2
2
  //# sourceMappingURL=text-link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-link.js","sources":["../../../src/new-components/text-link/text-link.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { forwardRefWithAs } from '../type-helpers'\nimport styles from './text-link.module.css'\nimport type { OpenInNewTab } from '../common-types'\n\ntype TextLinkProps = OpenInNewTab\n\nconst TextLink = forwardRefWithAs<TextLinkProps>(function TextLink(\n { component = 'a', tone = 'normal', openInNewTab = false, ...props },\n ref,\n) {\n return (\n <Box\n {...props}\n component={component}\n display=\"inline\"\n className={styles.container}\n ref={ref}\n target={openInNewTab ? '_blank' : undefined}\n rel={openInNewTab ? 'noopener noreferrer' : undefined}\n />\n )\n})\n\nexport { TextLink }\nexport type { TextLinkProps }\n"],"names":["forwardRefWithAs","ref","component","openInNewTab","props","React","Box","display","className","styles","container","target","undefined","rel"],"mappings":"uQAQiBA,oBAAgC,WAE7CC,WADEC,UAAAA,aAAY,UAAsBC,aAAAA,gBAAyBC,+EAIzDC,gBAACC,uBACOF,GACJF,UAAWA,EACXK,QAAQ,SACRC,UAAWC,UAAOC,UAClBT,IAAKA,EACLU,OAAQR,EAAe,cAAWS,EAClCC,IAAKV,EAAe,2BAAwBS"}
1
+ {"version":3,"file":"text-link.js","sources":["../../../src/new-components/text-link/text-link.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Box } from '../box'\nimport { polymorphicComponent } from '../../utils/polymorphism'\nimport styles from './text-link.module.css'\nimport type { OpenInNewTab } from '../common-types'\n\ntype TextLinkProps = OpenInNewTab\n\nconst TextLink = polymorphicComponent<'a', TextLinkProps>(function TextLink(\n { as = 'a', openInNewTab = false, exceptionallySetClassName, ...props },\n ref,\n) {\n return (\n <Box\n {...props}\n as={as}\n display=\"inline\"\n className={[exceptionallySetClassName, styles.container]}\n ref={ref}\n target={openInNewTab ? '_blank' : undefined}\n rel={openInNewTab ? 'noopener noreferrer' : undefined}\n />\n )\n})\n\nexport { TextLink }\nexport type { TextLinkProps }\n"],"names":["polymorphicComponent","ref","as","openInNewTab","exceptionallySetClassName","props","React","Box","display","className","styles","container","target","undefined","rel"],"mappings":"oUAQiBA,wBAAyC,WAEtDC,WADEC,GAAAA,aAAK,UAAKC,aAAAA,gBAAsBC,IAAAA,0BAA8BC,6CAI5DC,gBAACC,uBACOF,GACJH,GAAIA,EACJM,QAAQ,SACRC,UAAW,CAACL,EAA2BM,UAAOC,WAC9CV,IAAKA,EACLW,OAAQT,EAAe,cAAWU,EAClCC,IAAKX,EAAe,2BAAwBU"}
@@ -0,0 +1,151 @@
1
+ import * as React from 'react';
2
+ declare type Merge<P1, P2> = Omit<P1, keyof P2> & P2;
3
+ declare type EmptyObject = {
4
+ [K in any]: never;
5
+ };
6
+ declare type ObfuscateClassNameMode = 'keepClassName' | 'obfuscateClassName' | 'omitClassName';
7
+ declare type ObfuscatedClassName = {
8
+ /**
9
+ * Used internally to set the `className` prop of the main container element for this component.
10
+ *
11
+ * Aside from the different name, the prop behaves the same as the native `className`. The only
12
+ * reason for the name change is to discourage applying custom CSS to the design system
13
+ * components, which are supposed to _eventually_ provide all the styling features we may need.
14
+ *
15
+ * This prop is meant to be used only in certain circumstances, when you really need a escape
16
+ * hatch to apply custom styles to a component. Before reaching for this feature, try harder to
17
+ * see if you can solve your needs with what the design system provides.
18
+ *
19
+ * For instance, instead of applying layout-related styles to a non-layout component, consider
20
+ * wrapping it inside a layout component.
21
+ *
22
+ * @see PolymorphicComponent
23
+ */
24
+ exceptionallySetClassName?: string;
25
+ };
26
+ /**
27
+ * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`
28
+ * prop instead.
29
+ *
30
+ * This can be customized via the second generic parameter, as there are cases where it may be
31
+ * needed to omit this behaviour and keep the `className`. You can also instruct it to remove the
32
+ * `className` prop while not replacing it with the `exceptionallySetClassName` one.
33
+ *
34
+ * @see ObfuscatedClassName['exceptionallySetClassName'] for details about this prop
35
+ * @see PolymorphicComponent for details about this feature
36
+ */
37
+ declare type WithObfuscatedClassName<Props, ShouldObfuscateClassName extends ObfuscateClassNameMode> = 'className' extends keyof Props ? ShouldObfuscateClassName extends 'obfuscateClassName' ? Omit<Props, 'className'> & ObfuscatedClassName : ShouldObfuscateClassName extends 'omitClassName' ? Omit<Props, 'className'> : ShouldObfuscateClassName extends 'keepClassName' ? Props : never : Props;
38
+ declare type PolymorphicProp<ComponentType extends React.ElementType> = {
39
+ /**
40
+ * Used to instruct this component what React element to render as. It can be both a string
41
+ * representing a HTML tag name, or a React component.
42
+ *
43
+ * When using this prop, the component you apply it to will also recognize in its props types
44
+ * all the props from the component or HTML element you are rendering it as.
45
+ *
46
+ * Some uses for this feature:
47
+ *
48
+ * - Using some of our layout components, while at the same time being able to set them to use
49
+ * semantic HTML elements needed for accessibility purposes (e.g. `nav`, `main`, etc).
50
+ * - Using a design system link component, but have it internally use a client-side router link
51
+ * implemented via a React component (e.g. react-router's `Link`).
52
+ *
53
+ * Keep in mind that not all compositions of this kind may work well, especially when composing
54
+ * with another React component and not with a HTML tag name. In particular, if the components
55
+ * being composed have opposing concerns of clashing features (e.g. they have contradicting
56
+ * styles applied to them) things may not go well. In those cases prefer to nest them instead.
57
+ *
58
+ * @see PolymorphicComponent
59
+ */
60
+ as?: ComponentType;
61
+ };
62
+ /**
63
+ * Given a component or element type, and a set of additional props, this builds the entire set of
64
+ * props for a polymorphic component.
65
+ *
66
+ * It does three things:
67
+ *
68
+ * 1. it merges the element type props with the `OwnProps`
69
+ * 2. it adds the `as` prop to allow for polymorphism to happen
70
+ * 3. it optionally obfuscates or omits the className prop if present
71
+ *
72
+ * @see PolymorphicProp
73
+ * @see WithObfuscatedClassName
74
+ */
75
+ declare type PolymorphicComponentProps<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode> = Merge<WithObfuscatedClassName<React.ComponentProps<ComponentType>, ShouldObfuscateClassName>, OwnProps & PolymorphicProp<ComponentType>>;
76
+ declare type ElementTagNameMap = HTMLElementTagNameMap & Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>;
77
+ declare type ElementByTag<TagName extends keyof ElementTagNameMap> = ElementTagNameMap[TagName];
78
+ declare type ElementByTagOrAny<ComponentType extends React.ElementType> = ComponentType extends keyof ElementTagNameMap ? ElementByTag<ComponentType> : any;
79
+ /**
80
+ * The function passed to React.forwardRef, but typed in a way that's prepared for polymorphism via
81
+ * the `as` prop. It also allows to specify if the `className` prop should be obfuscated or omitted.
82
+ *
83
+ * @see PolymorphicComponentProps
84
+ * @see WithObfuscatedClassName
85
+ */
86
+ interface ForwardRefFunction<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode> {
87
+ (props: PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>, ref: ((instance: ElementByTagOrAny<ComponentType> | null) => void) | React.MutableRefObject<ElementByTagOrAny<ComponentType> | null> | null): React.ReactElement | null;
88
+ displayName?: string;
89
+ }
90
+ /**
91
+ * A component that can customize the React element type that it renders (a.k.a. a polymorphic
92
+ * component). This is achieved by passing a prop `as={ElementType}` or `as="html-tag-name"`.
93
+ *
94
+ * It transparently takes care of forwarding refs, and properly sets the ref type depending on the
95
+ * element type.
96
+ *
97
+ * ## Recognizing props based on the polymorphic type
98
+ *
99
+ * The `ComponentType` argument sets the default type for the `as` prop. Whatever the `as` prop
100
+ * component or HTML element is, the type system will automatically allow you to pass props that are
101
+ * not explicitly defined by you, but that are recognized as valid props to be passed to the
102
+ * component you are rendering.
103
+ *
104
+ * For instance, see the following example:
105
+ *
106
+ * ```jsx
107
+ * <Box as="label" htmlFor="field-id">Hello</Box>
108
+ * ```
109
+ *
110
+ * The `htmlFor` prop is exclusive to label elements. If you omit the `as="label"` prop, the type
111
+ * system will consider the `htmlFor` prop to be an error. The same happens if you pass a value of
112
+ * an incorrect type to such prop. For instance, the example below will issue a type error:
113
+ *
114
+ * ```jsx
115
+ * <Box as="label" htmlFor={123}>Hello</Box>
116
+ * ```
117
+ *
118
+ * ## Omitting or obfuscating the `className` prop
119
+ *
120
+ * If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`
121
+ * prop instead.
122
+ *
123
+ * This is to discourage customizing design system components via custom styling, while still
124
+ * leaving the door open to do it as an escape hatch when the design system still has shortcomings
125
+ * with respect to the product designs we want to achieve.
126
+ *
127
+ * The cumbersome name also serves the purpose of aiding in easily searching for the places in the
128
+ * code where this escape hatch was needed, in order to identify areas where the design system
129
+ * components need to improve to better match our needs.
130
+ *
131
+ * This behaviour can be customized via an optional second generic argument that allows to disable
132
+ * this feature, or to omit the `className` altogether without replacing it with the obfuscated prop
133
+ * name.
134
+ */
135
+ interface PolymorphicComponent<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName'> {
136
+ <TT extends React.ElementType = ComponentType>(props: PolymorphicComponentProps<TT, OwnProps, ShouldObfuscateClassName>): React.ReactElement | null;
137
+ readonly $$typeof: symbol;
138
+ defaultProps?: Partial<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>;
139
+ propTypes?: React.WeakValidationMap<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>;
140
+ displayName?: string;
141
+ }
142
+ /**
143
+ * A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a
144
+ * convenience over merely using React.forwardRef directly, and then manually forcing the resulting
145
+ * value to be typed using `as PolymorphicComponent<…>`.
146
+ *
147
+ * @see PolymorphicComponent for details about what this type does
148
+ */
149
+ declare function polymorphicComponent<ComponentType extends React.ElementType = 'div', OwnProps = EmptyObject, ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName'>(render: ForwardRefFunction<ComponentType, OwnProps, ShouldObfuscateClassName>): PolymorphicComponent<ComponentType, OwnProps, ShouldObfuscateClassName>;
150
+ export type { PolymorphicComponent, ObfuscatedClassName };
151
+ export { polymorphicComponent };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.polymorphicComponent=function(r){return e.forwardRef(r)};
2
+ //# sourceMappingURL=polymorphism.js.map
@@ -0,0 +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'\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\ntype ObfuscatedClassName = {\n /**\n * Used internally to set the `className` prop of the main container element for this component.\n *\n * Aside from the different name, the prop behaves the same as the native `className`. The only\n * reason for the name change is to discourage applying custom CSS to the design system\n * components, which are supposed to _eventually_ provide all the styling features we may need.\n *\n * This prop is meant to be used only in certain circumstances, when you really need a escape\n * hatch to apply custom styles to a component. Before reaching for this feature, try harder to\n * see if you can solve your needs with what the design system provides.\n *\n * For instance, instead of applying layout-related styles to a non-layout component, consider\n * wrapping it inside a layout component.\n *\n * @see PolymorphicComponent\n */\n exceptionallySetClassName?: string\n}\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 */\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 * @see PolymorphicComponent for details about what this type does\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, ObfuscatedClassName }\nexport { polymorphicComponent }\n"],"names":["render","React"],"mappings":"wHA4MA,SAIEA,UACSC,aAAiBD"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@doist/reactist",
3
3
  "description": "Open source React components by Doist",
4
4
  "author": "Henning Muszynski <henning@doist.com> (http://doist.com)",
5
- "version": "9.2.0-beta.8",
5
+ "version": "10.0.0-beta.12",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/Doist/reactist#readme",
8
8
  "repository": "git+https://github.com/Doist/reactist.git",
@@ -21,8 +21,8 @@
21
21
  "styles"
22
22
  ],
23
23
  "engines": {
24
- "node": "^14.5.5",
25
- "npm": "^6.14.11"
24
+ "node": "<=16.10.0",
25
+ "npm": "^7.0.0"
26
26
  },
27
27
  "scripts": {
28
28
  "postinstall": "patch-package",
@@ -39,13 +39,13 @@
39
39
  "type-check": "tsc --noEmit -p ./tsconfig.json",
40
40
  "lint": "tsdx lint src stories",
41
41
  "storybook": "start-storybook -p 6006",
42
- "prettify": "prettier --write \"./**/*.{js,jsx,ts,tsx,json,css,scss,less,md}\""
42
+ "prettify": "prettier --write \"./**/*.{js,jsx,ts,tsx,json,css,scss,less,md,mdx}\""
43
43
  },
44
44
  "peerDependencies": {
45
45
  "classnames": "^2.2.5",
46
+ "prop-types": "^15.6.2",
46
47
  "react": "^15.5.4 || ^16.2.0",
47
- "react-dom": "^15.5.4 || ^16.2.0",
48
- "prop-types": "^15.6.2"
48
+ "react-dom": "^15.5.4 || ^16.2.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@babel/core": "^7.9.6",
@@ -59,27 +59,28 @@
59
59
  "@babel/preset-react": "^7.0.0",
60
60
  "@babel/preset-typescript": "^7.10.1",
61
61
  "@babel/register": "^7.0.0",
62
- "@doist/eslint-config": "^3.0.0",
62
+ "@doist/eslint-config": "^6.0.2",
63
63
  "@doist/prettier-config": "^3.0.5",
64
- "@storybook/addon-actions": "^5.3.18",
65
- "@storybook/addon-docs": "^5.3.18",
66
- "@storybook/addon-info": "^5.3.18",
67
- "@storybook/addon-knobs": "^5.3.18",
68
- "@storybook/addon-links": "^5.3.18",
69
- "@storybook/addon-options": "^5.3.18",
70
- "@storybook/addons": "^5.3.18",
71
- "@storybook/react": "^5.3.18",
72
- "@testing-library/jest-dom": "^5.11.4",
73
- "@testing-library/react": "^11.0.4",
74
- "@testing-library/user-event": "^12.1.7",
64
+ "@storybook/addon-actions": "^6.3.10",
65
+ "@storybook/addon-controls": "^6.3.10",
66
+ "@storybook/addon-docs": "^6.3.10",
67
+ "@storybook/addon-knobs": "^6.3.1",
68
+ "@storybook/addon-links": "^6.3.10",
69
+ "@storybook/addon-options": "^5.3.21",
70
+ "@storybook/addon-postcss": "^2.0.0",
71
+ "@storybook/addons": "^6.3.10",
72
+ "@storybook/react": "^6.3.10",
73
+ "@testing-library/jest-dom": "^5.14.1",
74
+ "@testing-library/react": "^12.0.0",
75
+ "@testing-library/user-event": "^13.2.1",
75
76
  "@types/cheerio": "^0.22.22",
76
77
  "@types/classnames": "^2.2.10",
77
78
  "@types/enzyme": "^3.10.7",
78
79
  "@types/enzyme-adapter-react-16": "^1.0.6",
79
80
  "@types/react": "^16.9.52",
80
81
  "@types/react-dom": "^16.9.8",
81
- "@typescript-eslint/eslint-plugin": "^4.4.1",
82
- "@typescript-eslint/parser": "^4.4.1",
82
+ "@typescript-eslint/eslint-plugin": "^4.22.1",
83
+ "@typescript-eslint/parser": "^4.22.1",
83
84
  "autoprefixer": "^9.8.0",
84
85
  "babel-core": "^7.0.0-bridge.0",
85
86
  "babel-loader": "^8.1.0",
@@ -89,11 +90,11 @@
89
90
  "enzyme": "^3.11.0",
90
91
  "enzyme-adapter-react-16": "^1.15.5",
91
92
  "enzyme-to-json": "^3.6.1",
92
- "eslint": "^7.11.0",
93
+ "eslint": "^7.25.0",
93
94
  "eslint-config-prettier": "^6.12.0",
94
95
  "eslint-plugin-jest": "^24.1.0",
95
96
  "eslint-plugin-prettier": "^3.1.4",
96
- "eslint-plugin-react": "^7.21.4",
97
+ "eslint-plugin-react": "^7.23.2",
97
98
  "husky": "^4.3.0",
98
99
  "jest": "^24.7.1",
99
100
  "jest-environment-jsdom-sixteen": "^1.0.3",
@@ -110,7 +111,6 @@
110
111
  "react-docgen-typescript-loader": "^3.7.2",
111
112
  "react-dom": "^16.13.1",
112
113
  "react-is": "^16.13.1",
113
- "react-storybook-addon-chapters": "^3.1.7",
114
114
  "react-svg-loader": "^3.0.3",
115
115
  "react-test-renderer": "^16.13.1",
116
116
  "rimraf": "^3.0.2",
@@ -125,9 +125,13 @@
125
125
  "webpack": "^4.43.0"
126
126
  },
127
127
  "dependencies": {
128
+ "@reach/dialog": "^0.16.0",
129
+ "@types/testing-library__jest-dom": "^5.14.1",
128
130
  "dayjs": "^1.8.10",
129
131
  "patch-package": "^6.4.6",
132
+ "react-focus-lock": "^2.5.2",
130
133
  "react-keyed-flatten-children": "^1.3.0",
134
+ "react-markdown": "^5.0.3",
131
135
  "reakit": "1.3.0"
132
136
  }
133
137
  }