@decisiv/ui-components 2.0.1-alpha.15 → 2.0.1-alpha.150

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 (362) hide show
  1. package/lib/atoms/BaseButton/index.d.ts.map +1 -1
  2. package/lib/atoms/BaseButton/index.js +1 -1
  3. package/lib/atoms/BooleanInput/elements.d.ts.map +1 -1
  4. package/lib/atoms/BooleanInput/elements.js +8 -3
  5. package/lib/atoms/BooleanInput/index.d.ts.map +1 -1
  6. package/lib/atoms/BooleanInput/index.js +26 -5
  7. package/lib/atoms/BooleanInput/index.test.js +17 -6
  8. package/lib/atoms/BooleanInput/types.d.ts +4 -0
  9. package/lib/atoms/BooleanInput/types.d.ts.map +1 -1
  10. package/lib/atoms/BooleanInput/types.js +5 -1
  11. package/lib/atoms/Calendar/hooks/useCalendar/index.d.ts.map +1 -1
  12. package/lib/atoms/Calendar/hooks/useCalendar/index.js +2 -1
  13. package/lib/atoms/Calendar/hooks/useCalendar/index.test.js +5 -6
  14. package/lib/atoms/Calendar/index.d.ts.map +1 -1
  15. package/lib/atoms/Calendar/index.js +46 -6
  16. package/lib/atoms/Calendar/index.test.js +68 -38
  17. package/lib/atoms/Calendar/types.d.ts +1 -1
  18. package/lib/atoms/Calendar/types.d.ts.map +1 -1
  19. package/lib/atoms/Calendar/types.js +5 -1
  20. package/lib/atoms/InputField/Containers.d.ts +12 -6
  21. package/lib/atoms/InputField/Containers.d.ts.map +1 -1
  22. package/lib/atoms/InputField/Containers.js +8 -6
  23. package/lib/atoms/InputField/InputLabel.d.ts +1 -0
  24. package/lib/atoms/InputField/InputLabel.d.ts.map +1 -1
  25. package/lib/atoms/InputField/InputLabel.js +2 -1
  26. package/lib/atoms/InputField/index.d.ts +6 -0
  27. package/lib/atoms/InputField/index.d.ts.map +1 -1
  28. package/lib/atoms/InputField/index.js +25 -8
  29. package/lib/atoms/InputField/index.test.js +91 -0
  30. package/lib/atoms/InputField/schema.d.ts.map +1 -1
  31. package/lib/atoms/InputField/schema.js +1 -0
  32. package/lib/atoms/OptionsList/Category.d.ts +1 -1
  33. package/lib/atoms/OptionsList/Category.d.ts.map +1 -1
  34. package/lib/atoms/OptionsList/Category.js +4 -2
  35. package/lib/atoms/OptionsList/Footer.d.ts +8 -0
  36. package/lib/atoms/OptionsList/Footer.d.ts.map +1 -0
  37. package/lib/atoms/OptionsList/Footer.js +72 -0
  38. package/lib/atoms/OptionsList/Option.d.ts.map +1 -1
  39. package/lib/atoms/OptionsList/Option.js +24 -9
  40. package/lib/atoms/OptionsList/index.d.ts.map +1 -1
  41. package/lib/atoms/OptionsList/index.js +44 -17
  42. package/lib/atoms/OptionsList/index.test.js +127 -17
  43. package/lib/atoms/OptionsList/schema.d.ts.map +1 -1
  44. package/lib/atoms/OptionsList/schema.js +5 -0
  45. package/lib/atoms/OptionsList/types.d.ts +15 -0
  46. package/lib/atoms/OptionsList/types.d.ts.map +1 -1
  47. package/lib/atoms/OptionsList/types.js +5 -1
  48. package/lib/atoms/RequiredIcon.d.ts +9 -0
  49. package/lib/atoms/RequiredIcon.d.ts.map +1 -0
  50. package/lib/atoms/{InputField/RequiredIcon.js → RequiredIcon.js} +7 -3
  51. package/lib/components/Accordion/types.js +5 -1
  52. package/lib/components/Accordion/useAccordion/types.js +5 -1
  53. package/lib/components/Alert/Container.d.ts +201 -0
  54. package/lib/components/Alert/Container.d.ts.map +1 -0
  55. package/lib/components/Alert/Container.js +26 -0
  56. package/lib/components/Alert/StyledButton.d.ts +5 -0
  57. package/lib/components/Alert/StyledButton.d.ts.map +1 -0
  58. package/lib/components/Alert/StyledButton.js +23 -0
  59. package/lib/components/Alert/index.d.ts +27 -0
  60. package/lib/components/Alert/index.d.ts.map +1 -0
  61. package/lib/components/Alert/index.js +112 -0
  62. package/lib/components/Alert/index.test.js +79 -0
  63. package/lib/components/Alert/intents.d.ts +13 -0
  64. package/lib/components/Alert/intents.d.ts.map +1 -0
  65. package/lib/components/Alert/intents.js +72 -0
  66. package/lib/components/Alert/schema.d.ts +3 -0
  67. package/lib/components/Alert/schema.d.ts.map +1 -0
  68. package/lib/components/Alert/schema.js +25 -0
  69. package/lib/components/Alert/types.d.ts +36 -0
  70. package/lib/components/Alert/types.d.ts.map +1 -0
  71. package/lib/components/Alert/types.js +32 -0
  72. package/lib/components/Avatar/types.js +5 -1
  73. package/lib/components/Badge/constants.d.ts +2 -0
  74. package/lib/components/Badge/constants.d.ts.map +1 -0
  75. package/lib/components/Badge/constants.js +29 -0
  76. package/lib/components/Badge/index.d.ts.map +1 -1
  77. package/lib/components/Badge/index.js +12 -23
  78. package/lib/components/Badge/index.test.js +51 -8
  79. package/lib/components/Badge/schema.js +1 -1
  80. package/lib/components/Badge/types.d.ts +1 -1
  81. package/lib/components/Badge/types.d.ts.map +1 -1
  82. package/lib/components/Badge/types.js +7 -3
  83. package/lib/components/Breadcrumbs/types.js +5 -1
  84. package/lib/components/Button/StyledButton.d.ts +3 -2
  85. package/lib/components/Button/StyledButton.d.ts.map +1 -1
  86. package/lib/components/Button/StyledButton.js +21 -7
  87. package/lib/components/Button/index.d.ts.map +1 -1
  88. package/lib/components/Button/index.js +19 -9
  89. package/lib/components/Button/index.test.js +24 -8
  90. package/lib/components/Button/schema.d.ts +6 -1
  91. package/lib/components/Button/schema.d.ts.map +1 -1
  92. package/lib/components/Button/schema.js +11 -5
  93. package/lib/components/Button/types.d.ts +2 -1
  94. package/lib/components/Button/types.d.ts.map +1 -1
  95. package/lib/components/Button/types.js +5 -1
  96. package/lib/components/Checkbox/index.d.ts.map +1 -1
  97. package/lib/components/Checkbox/index.js +3 -1
  98. package/lib/components/Checkbox/schema.d.ts.map +1 -1
  99. package/lib/components/Checkbox/schema.js +2 -0
  100. package/lib/components/Combobox/Target.d.ts.map +1 -1
  101. package/lib/components/Combobox/Target.js +51 -14
  102. package/lib/components/Combobox/index.d.ts.map +1 -1
  103. package/lib/components/Combobox/index.js +196 -66
  104. package/lib/components/Combobox/index.test.js +369 -146
  105. package/lib/components/Combobox/schema.d.ts.map +1 -1
  106. package/lib/components/Combobox/schema.js +10 -2
  107. package/lib/components/Combobox/types.d.ts +12 -3
  108. package/lib/components/Combobox/types.d.ts.map +1 -1
  109. package/lib/components/Combobox/types.js +5 -1
  110. package/lib/components/DropdownList/index.d.ts +4 -0
  111. package/lib/components/DropdownList/index.d.ts.map +1 -1
  112. package/lib/components/DropdownList/index.js +76 -11
  113. package/lib/components/DropdownList/propTypes.d.ts +4 -0
  114. package/lib/components/DropdownList/propTypes.d.ts.map +1 -0
  115. package/lib/components/DropdownList/propTypes.js +42 -0
  116. package/lib/components/DropdownList/schema.d.ts.map +1 -1
  117. package/lib/components/DropdownList/schema.js +5 -0
  118. package/lib/components/DropdownList/types.d.ts +4 -1
  119. package/lib/components/DropdownList/types.d.ts.map +1 -1
  120. package/lib/components/Filter/IconWrapper/index.d.ts +197 -0
  121. package/lib/components/Filter/IconWrapper/index.d.ts.map +1 -0
  122. package/lib/components/Filter/IconWrapper/index.js +35 -0
  123. package/lib/components/Filter/SimplePrimary/index.d.ts +31 -0
  124. package/lib/components/Filter/SimplePrimary/index.d.ts.map +1 -0
  125. package/lib/components/Filter/SimplePrimary/index.js +58 -0
  126. package/lib/components/Filter/SimplePrimary/index.test.js +34 -0
  127. package/lib/components/Filter/StyledFilter.d.ts +4 -0
  128. package/lib/components/Filter/StyledFilter.d.ts.map +1 -0
  129. package/lib/components/Filter/StyledFilter.js +41 -0
  130. package/lib/components/Filter/StyledLabel/index.d.ts +8 -0
  131. package/lib/components/Filter/StyledLabel/index.d.ts.map +1 -0
  132. package/lib/components/Filter/StyledLabel/index.js +30 -0
  133. package/lib/components/Filter/index.d.ts +5 -0
  134. package/lib/components/Filter/index.d.ts.map +1 -0
  135. package/lib/components/Filter/index.js +107 -0
  136. package/lib/components/Filter/index.test.js +60 -0
  137. package/lib/components/Filter/kind.d.ts +6 -0
  138. package/lib/components/Filter/kind.d.ts.map +1 -0
  139. package/lib/components/Filter/kind.js +45 -0
  140. package/lib/components/Filter/schema.d.ts +9 -0
  141. package/lib/components/Filter/schema.d.ts.map +1 -0
  142. package/lib/components/Filter/schema.js +33 -0
  143. package/lib/components/Filter/types.d.ts +18 -0
  144. package/lib/components/Filter/types.d.ts.map +1 -0
  145. package/lib/components/Filter/types.js +5 -0
  146. package/lib/components/JumpTo/JumpToMenu.d.ts +2 -2
  147. package/lib/components/JumpTo/JumpToMenu.d.ts.map +1 -1
  148. package/lib/components/JumpTo/JumpToMenu.js +3 -3
  149. package/lib/components/JumpTo/types.js +5 -1
  150. package/lib/components/LeftNav/Item/ClickArea.d.ts.map +1 -1
  151. package/lib/components/LeftNav/Item/ClickArea.js +2 -2
  152. package/lib/components/LeftNav/Item/ItemWrapper.d.ts.map +1 -1
  153. package/lib/components/LeftNav/Item/ItemWrapper.js +3 -3
  154. package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts +7 -0
  155. package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts.map +1 -0
  156. package/lib/components/LeftNav/Item/MenuItemWrapper.js +20 -0
  157. package/lib/components/LeftNav/Item/NavCollapsedXItem/index.d.ts.map +1 -1
  158. package/lib/components/LeftNav/Item/NavCollapsedXItem/index.js +7 -5
  159. package/lib/components/LeftNav/Item/NavExpandedItem/index.d.ts.map +1 -1
  160. package/lib/components/LeftNav/Item/NavExpandedItem/index.js +24 -13
  161. package/lib/components/LeftNav/Item/types.d.ts +1 -1
  162. package/lib/components/LeftNav/Item/types.d.ts.map +1 -1
  163. package/lib/components/LeftNav/Item/types.js +5 -1
  164. package/lib/components/LeftNav/index.test.js +13 -3
  165. package/lib/components/LeftNav/schema.d.ts.map +1 -1
  166. package/lib/components/LeftNav/schema.js +2 -0
  167. package/lib/components/LeftNav/types.d.ts +1 -0
  168. package/lib/components/LeftNav/types.d.ts.map +1 -1
  169. package/lib/components/LeftNav/types.js +5 -1
  170. package/lib/components/Link/DisabledLink.d.ts +7 -0
  171. package/lib/components/Link/DisabledLink.d.ts.map +1 -0
  172. package/lib/components/Link/DisabledLink.js +46 -0
  173. package/lib/components/Link/Link.d.ts +4 -0
  174. package/lib/components/Link/Link.d.ts.map +1 -0
  175. package/lib/components/Link/Link.js +67 -0
  176. package/lib/components/Link/index.d.ts +4 -23
  177. package/lib/components/Link/index.d.ts.map +1 -1
  178. package/lib/components/Link/index.js +20 -158
  179. package/lib/components/Link/index.test.js +63 -42
  180. package/lib/components/Link/schema.d.ts.map +1 -1
  181. package/lib/components/Link/schema.js +2 -1
  182. package/lib/components/Link/styles.d.ts +20 -0
  183. package/lib/components/Link/styles.d.ts.map +1 -0
  184. package/lib/components/Link/styles.js +131 -0
  185. package/lib/components/Link/types.d.ts +28 -0
  186. package/lib/components/Link/types.d.ts.map +1 -0
  187. package/lib/components/Link/types.js +5 -0
  188. package/lib/components/Menu/index.d.ts.map +1 -1
  189. package/lib/components/Menu/index.js +3 -1
  190. package/lib/components/Menu/types.d.ts +2 -0
  191. package/lib/components/Menu/types.d.ts.map +1 -1
  192. package/lib/components/Menu/types.js +5 -1
  193. package/lib/components/Modal/components.d.ts +2 -2
  194. package/lib/components/Modal/types.js +5 -1
  195. package/lib/components/Notifications/Notification/components.d.ts +3 -3
  196. package/lib/components/Notifications/Notification/components.d.ts.map +1 -1
  197. package/lib/components/Notifications/Notification/components.js +12 -6
  198. package/lib/components/Notifications/Notification/index.d.ts +3 -6
  199. package/lib/components/Notifications/Notification/index.d.ts.map +1 -1
  200. package/lib/components/Notifications/Notification/index.js +19 -12
  201. package/lib/components/Notifications/Notification/index.test.js +38 -19
  202. package/lib/components/Notifications/NotificationsPanel/index.d.ts +2 -1
  203. package/lib/components/Notifications/NotificationsPanel/index.d.ts.map +1 -1
  204. package/lib/components/Notifications/NotificationsPanel/index.js +44 -21
  205. package/lib/components/Notifications/NotificationsPanel/schema.js +1 -1
  206. package/lib/components/Notifications/Notifier.test.js +79 -10
  207. package/lib/components/Notifications/constants.d.ts +2 -0
  208. package/lib/components/Notifications/constants.d.ts.map +1 -0
  209. package/lib/components/Notifications/constants.js +16 -0
  210. package/lib/components/Notifications/schema.d.ts.map +1 -1
  211. package/lib/components/Notifications/schema.js +2 -1
  212. package/lib/components/Notifications/useNotifications.d.ts +1 -0
  213. package/lib/components/Notifications/useNotifications.d.ts.map +1 -1
  214. package/lib/components/Notifications/useNotifications.test.js +7 -4
  215. package/lib/components/Pagination/Pagination.d.ts +1 -1
  216. package/lib/components/Pagination/Pagination.d.ts.map +1 -1
  217. package/lib/components/Pagination/Pagination.js +1 -0
  218. package/lib/components/Pagination/Pagination.test.js +9 -0
  219. package/lib/components/Pagination/types.js +5 -1
  220. package/lib/components/PasswordField/IconWrapper.d.ts +198 -0
  221. package/lib/components/PasswordField/IconWrapper.d.ts.map +1 -0
  222. package/lib/components/PasswordField/IconWrapper.js +32 -0
  223. package/lib/components/PasswordField/Input.d.ts +6 -0
  224. package/lib/components/PasswordField/Input.d.ts.map +1 -0
  225. package/lib/components/PasswordField/Input.js +28 -0
  226. package/lib/components/PasswordField/ShowPasswordButton.d.ts +8 -0
  227. package/lib/components/PasswordField/ShowPasswordButton.d.ts.map +1 -0
  228. package/lib/components/PasswordField/ShowPasswordButton.js +48 -0
  229. package/lib/components/PasswordField/index.d.ts +14 -0
  230. package/lib/components/PasswordField/index.d.ts.map +1 -0
  231. package/lib/components/PasswordField/index.js +113 -0
  232. package/lib/components/PasswordField/index.test.js +217 -0
  233. package/lib/components/PasswordField/schema.d.ts +3 -0
  234. package/lib/components/PasswordField/schema.d.ts.map +1 -0
  235. package/lib/components/PasswordField/schema.js +27 -0
  236. package/lib/components/Popover/index.d.ts.map +1 -1
  237. package/lib/components/Popover/index.js +6 -3
  238. package/lib/components/Popover/schema.d.ts.map +1 -1
  239. package/lib/components/Popover/schema.js +27 -20
  240. package/lib/components/Popover/types.d.ts +1 -0
  241. package/lib/components/Popover/types.d.ts.map +1 -1
  242. package/lib/components/Popover/utils.d.ts +1 -1
  243. package/lib/components/SearchInput/index.d.ts +11 -0
  244. package/lib/components/SearchInput/index.d.ts.map +1 -0
  245. package/lib/components/SearchInput/index.js +190 -0
  246. package/lib/components/SearchInput/index.test.js +417 -0
  247. package/lib/components/SearchInput/schema.d.ts +3 -0
  248. package/lib/components/SearchInput/schema.d.ts.map +1 -0
  249. package/lib/components/SearchInput/schema.js +24 -0
  250. package/lib/components/SearchInput/types.d.ts +28 -0
  251. package/lib/components/SearchInput/types.d.ts.map +1 -0
  252. package/lib/components/SearchInput/types.js +5 -0
  253. package/lib/components/Select/Target.d.ts.map +1 -1
  254. package/lib/components/Select/Target.js +6 -2
  255. package/lib/components/Select/index.d.ts.map +1 -1
  256. package/lib/components/Select/index.js +41 -3
  257. package/lib/components/Select/index.test.js +82 -23
  258. package/lib/components/Select/schema.d.ts.map +1 -1
  259. package/lib/components/Select/schema.js +8 -0
  260. package/lib/components/Select/types.d.ts +5 -1
  261. package/lib/components/Select/types.d.ts.map +1 -1
  262. package/lib/components/Select/types.js +5 -1
  263. package/lib/components/SelectDate/Target.d.ts.map +1 -1
  264. package/lib/components/SelectDate/Target.js +6 -2
  265. package/lib/components/SelectDate/index.d.ts.map +1 -1
  266. package/lib/components/SelectDate/index.js +32 -3
  267. package/lib/components/SelectDate/index.test.js +108 -51
  268. package/lib/components/SelectDate/schema.d.ts.map +1 -1
  269. package/lib/components/SelectDate/schema.js +3 -0
  270. package/lib/components/SelectDate/types.d.ts +3 -0
  271. package/lib/components/SelectDate/types.d.ts.map +1 -1
  272. package/lib/components/SelectDate/types.js +5 -1
  273. package/lib/components/SelectDateRange/index.d.ts.map +1 -1
  274. package/lib/components/SelectDateRange/index.js +31 -2
  275. package/lib/components/SelectDateRange/index.test.js +115 -58
  276. package/lib/components/SelectDateRange/schema.d.ts.map +1 -1
  277. package/lib/components/SelectDateRange/schema.js +3 -0
  278. package/lib/components/SelectDateRange/types.js +5 -1
  279. package/lib/components/SelectMenu/index.d.ts +5 -0
  280. package/lib/components/SelectMenu/index.d.ts.map +1 -1
  281. package/lib/components/SelectMenu/index.js +27 -3
  282. package/lib/components/SelectMenu/schema.d.ts.map +1 -1
  283. package/lib/components/SelectMenu/schema.js +4 -0
  284. package/lib/components/Table/Body.d.ts.map +1 -1
  285. package/lib/components/Table/Body.js +28 -17
  286. package/lib/components/Table/Container.d.ts.map +1 -1
  287. package/lib/components/Table/Container.js +6 -1
  288. package/lib/components/Table/DataRow.d.ts.map +1 -1
  289. package/lib/components/Table/DataRow.js +26 -18
  290. package/lib/components/Table/Head.d.ts +1 -1
  291. package/lib/components/Table/Head.d.ts.map +1 -1
  292. package/lib/components/Table/Head.js +10 -5
  293. package/lib/components/Table/HeaderCell/index.d.ts.map +1 -1
  294. package/lib/components/Table/HeaderCell/index.js +19 -6
  295. package/lib/components/Table/HeaderCell/types.d.ts +6 -1
  296. package/lib/components/Table/HeaderCell/types.d.ts.map +1 -1
  297. package/lib/components/Table/HeaderCell/types.js +5 -1
  298. package/lib/components/Table/Provider.d.ts +5 -5
  299. package/lib/components/Table/Provider.d.ts.map +1 -1
  300. package/lib/components/Table/Provider.js +10 -11
  301. package/lib/components/Table/index.d.ts.map +1 -1
  302. package/lib/components/Table/index.js +109 -19
  303. package/lib/components/Table/index.test.js +80 -33
  304. package/lib/components/Table/schema.columns.d.ts.map +1 -1
  305. package/lib/components/Table/schema.columns.js +6 -4
  306. package/lib/components/Table/schema.d.ts.map +1 -1
  307. package/lib/components/Table/schema.js +7 -6
  308. package/lib/components/Table/types.d.ts +19 -4
  309. package/lib/components/Table/types.d.ts.map +1 -1
  310. package/lib/components/Table/utils.d.ts +2 -8
  311. package/lib/components/Table/utils.d.ts.map +1 -1
  312. package/lib/components/Table/utils.js +21 -20
  313. package/lib/components/Tabs/types.js +5 -1
  314. package/lib/components/Tag/types.d.ts +1 -1
  315. package/lib/components/Tag/types.d.ts.map +1 -1
  316. package/lib/components/Tag/types.js +5 -1
  317. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  318. package/lib/components/TextArea/TextArea.js +1 -1
  319. package/lib/components/TextArea/index.js +1 -0
  320. package/lib/components/TextArea/index.test.js +5 -0
  321. package/lib/components/TextField/Input.js +1 -1
  322. package/lib/components/TextField/index.test.js +5 -0
  323. package/lib/components/Toggle/index.d.ts.map +1 -1
  324. package/lib/components/Toggle/index.js +4 -0
  325. package/lib/components/Toggle/index.test.js +39 -10
  326. package/lib/components/Toggle/types.js +5 -1
  327. package/lib/components/Tooltip/index.d.ts.map +1 -1
  328. package/lib/components/Tooltip/index.js +3 -13
  329. package/lib/components/Tooltip/schema.d.ts +3 -0
  330. package/lib/components/Tooltip/schema.d.ts.map +1 -0
  331. package/lib/components/Tooltip/schema.js +29 -0
  332. package/lib/components/index.d.ts +4 -0
  333. package/lib/components/index.d.ts.map +1 -1
  334. package/lib/components/index.js +50 -0
  335. package/lib/modifiers/spacingSchema.d.ts.map +1 -1
  336. package/lib/modifiers/spacingSchema.js +29 -16
  337. package/lib/providers/ConfigProvider/index.d.ts.map +1 -1
  338. package/lib/providers/ConfigProvider/index.js +5 -1
  339. package/lib/providers/ConfigProvider/utils/context.d.ts +1 -1
  340. package/lib/providers/ConfigProvider/utils/context.d.ts.map +1 -1
  341. package/lib/providers/ConfigProvider/utils/normalizer.d.ts.map +1 -1
  342. package/lib/providers/ConfigProvider/utils/normalizer.js +1 -1
  343. package/lib/providers/ConfigProvider/utils/translations.d.ts +14 -0
  344. package/lib/providers/ConfigProvider/utils/translations.d.ts.map +1 -1
  345. package/lib/providers/ConfigProvider/utils/translations.js +14 -0
  346. package/lib/providers/NotificationsProvider/index.d.ts +6 -5
  347. package/lib/providers/NotificationsProvider/index.d.ts.map +1 -1
  348. package/lib/providers/NotificationsProvider/index.js +47 -28
  349. package/lib/providers/NotificationsProvider/types.d.ts +4 -1
  350. package/lib/providers/NotificationsProvider/types.d.ts.map +1 -1
  351. package/lib/utils/joinClassnames.d.ts +3 -0
  352. package/lib/utils/joinClassnames.d.ts.map +1 -0
  353. package/lib/utils/joinClassnames.js +26 -0
  354. package/lib/utils/useFirstMount.d.ts +2 -0
  355. package/lib/utils/useFirstMount.d.ts.map +1 -0
  356. package/lib/utils/useFirstMount.js +19 -0
  357. package/lib/utils/useUpdateEffect.d.ts +4 -0
  358. package/lib/utils/useUpdateEffect.d.ts.map +1 -0
  359. package/lib/utils/useUpdateEffect.js +28 -0
  360. package/package.json +2 -2
  361. package/lib/atoms/InputField/RequiredIcon.d.ts +0 -4
  362. package/lib/atoms/InputField/RequiredIcon.d.ts.map +0 -1
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ import { AlertProps } from './types';
3
+ export { AlertProps };
4
+ declare function Alert({ 'aria-label': ariaLabel, children, description, dismissable, icon, intent, onDismissClick, title, tooltipText, }: AlertProps): JSX.Element;
5
+ declare namespace Alert {
6
+ var propTypes: {
7
+ 'aria-label': import("prop-types").Requireable<string>;
8
+ description: import("prop-types").Requireable<string>;
9
+ dismissable: import("prop-types").Requireable<boolean>;
10
+ icon: import("prop-types").Requireable<import("prop-types").ReactElementLike>;
11
+ intent: import("prop-types").Requireable<string>;
12
+ title: import("prop-types").Validator<string>;
13
+ onDismissClick: import("prop-types").Requireable<(...args: any[]) => any>;
14
+ tooltipText: import("prop-types").Requireable<string>;
15
+ };
16
+ var defaultProps: {
17
+ 'aria-label': undefined;
18
+ description: undefined;
19
+ dismissable: boolean;
20
+ icon: undefined;
21
+ intent: string;
22
+ onDismissClick: undefined;
23
+ tooltipText: undefined;
24
+ };
25
+ }
26
+ export default Alert;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Alert/index.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,UAAU,EAA2B,MAAM,SAAS,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,iBAAwB,KAAK,CAAC,EAC5B,YAAY,EAAE,SAAS,EACvB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,IAAI,EACJ,MAAsB,EACtB,cAAc,EACd,KAAK,EACL,WAAW,GACZ,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAwD1B;kBAlEuB,KAAK;;;;;;;;;;;;;;;;;;;;;eAAL,KAAK"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Alert;
7
+ Object.defineProperty(exports, "AlertProps", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _types.AlertProps;
11
+ }
12
+ });
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _toColorString = _interopRequireDefault(require("polished/lib/color/toColorString"));
17
+
18
+ var _Times = _interopRequireDefault(require("@decisiv/iconix/lib/components/Times"));
19
+
20
+ var _useTranslations = _interopRequireDefault(require("../../utils/useTranslations"));
21
+
22
+ var _StyledButton = _interopRequireDefault(require("./StyledButton"));
23
+
24
+ var _Container = _interopRequireDefault(require("./Container"));
25
+
26
+ var _Flex = _interopRequireDefault(require("../Flex"));
27
+
28
+ var _Tooltip = _interopRequireDefault(require("../Tooltip"));
29
+
30
+ var _Typography = require("../Typography");
31
+
32
+ var _intents = _interopRequireDefault(require("./intents"));
33
+
34
+ var _types = require("./types");
35
+
36
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+
38
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
39
+
40
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
41
+
42
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
43
+
44
+ function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
45
+
46
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
47
+
48
+ function Alert(_ref) {
49
+ var ariaLabel = _ref['aria-label'],
50
+ children = _ref.children,
51
+ description = _ref.description,
52
+ dismissable = _ref.dismissable,
53
+ icon = _ref.icon,
54
+ _ref$intent = _ref.intent,
55
+ intent = _ref$intent === void 0 ? 'information' : _ref$intent,
56
+ onDismissClick = _ref.onDismissClick,
57
+ title = _ref.title,
58
+ tooltipText = _ref.tooltipText;
59
+
60
+ var _useState = (0, _react.useState)(true),
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ open = _useState2[0],
63
+ setOpen = _useState2[1];
64
+
65
+ var translate = (0, _useTranslations.default)();
66
+ var borderColor = (0, _toColorString.default)(_intents.default[intent].borderColor);
67
+ var Icon = icon || _intents.default[intent].icon;
68
+
69
+ var handleClick = function handleClick() {
70
+ setOpen(false);
71
+ if (onDismissClick) onDismissClick();
72
+ };
73
+
74
+ if (!open) {
75
+ return _react.default.createElement(_react.default.Fragment, null);
76
+ }
77
+
78
+ return _react.default.createElement(_Container.default, {
79
+ flex: 1,
80
+ paddingLeft: 1.5,
81
+ paddingRight: 1.6,
82
+ paddingTop: 1.3,
83
+ paddingBottom: 1.1,
84
+ intent: intent
85
+ }, _react.default.createElement(Icon, {
86
+ color: borderColor
87
+ }), _react.default.createElement(_Flex.default, {
88
+ flexDirection: "column",
89
+ marginLeft: 1,
90
+ flex: 1
91
+ }, _react.default.createElement(_Flex.default, {
92
+ alignItems: "center",
93
+ flex: 1
94
+ }, _react.default.createElement(_Typography.P, {
95
+ weight: "semibold",
96
+ marginRight: 1
97
+ }, title), dismissable && _react.default.createElement(_Tooltip.default, {
98
+ placement: "auto",
99
+ target: // eslint-disable-next-line react/jsx-wrap-multilines
100
+ _react.default.createElement(_StyledButton.default, {
101
+ variant: "ghost",
102
+ icon: _Times.default,
103
+ onClick: handleClick,
104
+ "aria-label": translate(ariaLabel, 'alert.closeAlert')
105
+ })
106
+ }, translate(tooltipText, 'alert.close'))), _react.default.createElement(_Typography.P, {
107
+ size: "small"
108
+ }, children || description)));
109
+ }
110
+
111
+ Alert.propTypes = _types.propTypes;
112
+ Alert.defaultProps = _types.defaultProps;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ var _react = _interopRequireDefault(require("react"));
4
+
5
+ var _react2 = require("@testing-library/react");
6
+
7
+ var _ = _interopRequireDefault(require("."));
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
11
+ describe('Alert', function () {
12
+ it('renders Title', function () {
13
+ var _render = (0, _react2.render)(_react.default.createElement(_.default, {
14
+ title: "Alert Title"
15
+ })),
16
+ getByText = _render.getByText;
17
+
18
+ expect(getByText(/alert title/i)).toBeInTheDocument();
19
+ });
20
+ describe('when has description', function () {
21
+ it('renders description', function () {
22
+ var _render2 = (0, _react2.render)(_react.default.createElement(_.default, {
23
+ title: "Alert Title",
24
+ description: "Alert Description"
25
+ })),
26
+ getByText = _render2.getByText;
27
+
28
+ expect(getByText(/alert description/i)).toBeInTheDocument();
29
+ });
30
+ it('renders children as description', function () {
31
+ var _render3 = (0, _react2.render)(_react.default.createElement(_.default, {
32
+ title: "Alert Title"
33
+ }, "Alert Description")),
34
+ getByText = _render3.getByText;
35
+
36
+ expect(getByText(/alert description/i)).toBeInTheDocument();
37
+ });
38
+ });
39
+ describe('when it is dismissable', function () {
40
+ it('renders close button', function () {
41
+ var _render4 = (0, _react2.render)(_react.default.createElement(_.default, {
42
+ title: "Alert Title",
43
+ dismissable: true,
44
+ "aria-label": "Close Alert"
45
+ })),
46
+ getByLabelText = _render4.getByLabelText;
47
+
48
+ expect(getByLabelText(/close alert/i)).toBeInTheDocument();
49
+ });
50
+ it('closes alert when clicking on dismiss button', function () {
51
+ var _render5 = (0, _react2.render)(_react.default.createElement(_.default, {
52
+ title: "Alert Title",
53
+ dismissable: true,
54
+ "aria-label": "Close Alert"
55
+ })),
56
+ getByLabelText = _render5.getByLabelText,
57
+ queryByText = _render5.queryByText;
58
+
59
+ _react2.fireEvent.click(getByLabelText(/close alert/i));
60
+
61
+ expect(queryByText(/alert title/i)).not.toBeInTheDocument();
62
+ });
63
+ it('triggers onDismissClick when clicking on dismiss button', function () {
64
+ var onDismissClick = jest.fn();
65
+
66
+ var _render6 = (0, _react2.render)(_react.default.createElement(_.default, {
67
+ title: "Alert Title",
68
+ dismissable: true,
69
+ "aria-label": "Close Alert",
70
+ onDismissClick: onDismissClick
71
+ })),
72
+ getByLabelText = _render6.getByLabelText;
73
+
74
+ _react2.fireEvent.click(getByLabelText(/close alert/i));
75
+
76
+ expect(onDismissClick).toHaveBeenCalled();
77
+ });
78
+ });
79
+ });
@@ -0,0 +1,13 @@
1
+ import theme from 'styled-theming';
2
+ import { Color } from '@decisiv/design-tokens/lib/color';
3
+ import InfoCircle from '@decisiv/iconix/lib/components/InfoCircle';
4
+ interface IntentRecord {
5
+ color: Color;
6
+ borderColor: Color;
7
+ icon: typeof InfoCircle;
8
+ }
9
+ declare type IntentType = Record<string, IntentRecord>;
10
+ declare const intents: IntentType;
11
+ export declare const intentStyle: theme.VariantSet;
12
+ export default intents;
13
+ //# sourceMappingURL=intents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../../src/components/Alert/intents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AAGnC,OAAc,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAKhE,OAAO,UAAU,MAAM,2CAA2C,CAAC;AAKnE,UAAU,YAAY;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,KAAK,CAAC;IACnB,IAAI,EAAE,OAAO,UAAU,CAAC;CACzB;AAED,aAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAE/C,QAAA,MAAM,OAAO,EAAE,UAqBd,CAAC;AAEF,eAAO,MAAM,WAAW,kBAyCtB,CAAC;AAEH,eAAe,OAAO,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.intentStyle = void 0;
7
+
8
+ var _styledTheming = _interopRequireDefault(require("styled-theming"));
9
+
10
+ var _styledComponents = require("styled-components");
11
+
12
+ var _color = _interopRequireDefault(require("@decisiv/design-tokens/lib/color"));
13
+
14
+ var _CheckCircle = _interopRequireDefault(require("@decisiv/iconix/lib/components/CheckCircle"));
15
+
16
+ var _ExclamationCircle = _interopRequireDefault(require("@decisiv/iconix/lib/components/ExclamationCircle"));
17
+
18
+ var _ExclamationTriangle = _interopRequireDefault(require("@decisiv/iconix/lib/components/ExclamationTriangle"));
19
+
20
+ var _InfoCircle = _interopRequireDefault(require("@decisiv/iconix/lib/components/InfoCircle"));
21
+
22
+ var _polished = require("polished");
23
+
24
+ var _ConfigProvider = require("../../providers/ConfigProvider");
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ var intents = {
29
+ information: {
30
+ color: _color.default.status.information.light,
31
+ borderColor: _color.default.status.information.medium,
32
+ icon: _InfoCircle.default
33
+ },
34
+ success: {
35
+ color: _color.default.status.success.light,
36
+ borderColor: _color.default.status.success.medium,
37
+ icon: _CheckCircle.default
38
+ },
39
+ warning: {
40
+ color: _color.default.status.warning.light,
41
+ borderColor: _color.default.status.warning.medium,
42
+ icon: _ExclamationCircle.default
43
+ },
44
+ danger: {
45
+ color: _color.default.status.danger.light,
46
+ borderColor: _color.default.status.danger.medium,
47
+ icon: _ExclamationTriangle.default
48
+ }
49
+ };
50
+
51
+ var intentStyle = _styledTheming.default.variants(_ConfigProvider.themeKeys.mode, 'intent', {
52
+ information: {
53
+ light: (0, _styledComponents.css)(["background-color:", ";border-left-color:", ";"], (0, _polished.toColorString)(intents.information.color), (0, _polished.toColorString)(intents.information.borderColor)),
54
+ dark: (0, _styledComponents.css)(["background-color:", ";border-left-color:", ";"], (0, _polished.toColorString)(intents.information.color), (0, _polished.toColorString)(intents.information.borderColor))
55
+ },
56
+ success: {
57
+ light: (0, _styledComponents.css)(["background-color:", ";border-left-color:", ";"], (0, _polished.toColorString)(intents.success.color), (0, _polished.toColorString)(intents.success.borderColor)),
58
+ dark: (0, _styledComponents.css)(["background-color:", ";border-left-color:", ";"], (0, _polished.toColorString)(intents.success.color), (0, _polished.toColorString)(intents.success.borderColor))
59
+ },
60
+ warning: {
61
+ light: (0, _styledComponents.css)(["background-color:", ";border-left-color:", ";"], (0, _polished.toColorString)(intents.warning.color), (0, _polished.toColorString)(intents.warning.borderColor)),
62
+ dark: (0, _styledComponents.css)(["background-color:", ";border-left-color:", ";"], (0, _polished.toColorString)(intents.warning.color), (0, _polished.toColorString)(intents.warning.borderColor))
63
+ },
64
+ danger: {
65
+ light: (0, _styledComponents.css)(["background-color:", ";border-left-color:", ";"], (0, _polished.toColorString)(intents.danger.color), (0, _polished.toColorString)(intents.danger.borderColor)),
66
+ dark: (0, _styledComponents.css)(["background-color:", ";border-left-color:", ";"], (0, _polished.toColorString)(intents.danger.color), (0, _polished.toColorString)(intents.danger.borderColor))
67
+ }
68
+ });
69
+
70
+ exports.intentStyle = intentStyle;
71
+ var _default = intents;
72
+ exports.default = _default;
@@ -0,0 +1,3 @@
1
+ declare const schema: any;
2
+ export default schema;
3
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Alert/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAqC,CAAC;AAyBlD,eAAe,MAAM,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _reactDesc = require("react-desc");
9
+
10
+ // @ts-ignore no module typings
11
+ var schema = (0, _reactDesc.describe)({
12
+ displayName: 'Alert'
13
+ });
14
+ schema.propTypes = {
15
+ 'aria-label': _reactDesc.PropTypes.string.description('Descriptive text for accessibility purposes'),
16
+ description: _reactDesc.PropTypes.string.description('Text to show as description'),
17
+ dismissable: _reactDesc.PropTypes.bool.description('Sets if the alert is dismissable').defaultValue('false'),
18
+ icon: _reactDesc.PropTypes.element.description('Must be an icon component from `@decisiv/iconix`'),
19
+ intent: _reactDesc.PropTypes.oneOf(['information', 'success', 'warning', 'danger']).description('Shortcuts to the most common combinations of icon and color.').defaultValue('information'),
20
+ title: _reactDesc.PropTypes.string.description('Text to show as title').isRequired,
21
+ onDismissClick: _reactDesc.PropTypes.func.description('A callback when dismissing the alert').defaultValue('undefined'),
22
+ tooltipText: _reactDesc.PropTypes.string.description('The text for dismiss tooltip').defaultValue('Close')
23
+ };
24
+ var _default = schema;
25
+ exports.default = _default;
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import PropTypes from 'prop-types';
3
+ import { IconProps } from '@decisiv/iconix';
4
+ import intents from './intents';
5
+ export declare type IconComponent = (props: IconProps) => JSX.Element;
6
+ export interface AlertProps {
7
+ 'aria-label'?: string;
8
+ children?: React.ReactNode;
9
+ description?: string;
10
+ dismissable?: boolean;
11
+ icon?: IconComponent;
12
+ intent?: keyof typeof intents;
13
+ onDismissClick?: () => void;
14
+ title: string;
15
+ tooltipText?: string;
16
+ }
17
+ export declare const propTypes: {
18
+ 'aria-label': PropTypes.Requireable<string>;
19
+ description: PropTypes.Requireable<string>;
20
+ dismissable: PropTypes.Requireable<boolean>;
21
+ icon: PropTypes.Requireable<PropTypes.ReactElementLike>;
22
+ intent: PropTypes.Requireable<string>;
23
+ title: PropTypes.Validator<string>;
24
+ onDismissClick: PropTypes.Requireable<(...args: any[]) => any>;
25
+ tooltipText: PropTypes.Requireable<string>;
26
+ };
27
+ export declare const defaultProps: {
28
+ 'aria-label': undefined;
29
+ description: undefined;
30
+ dismissable: boolean;
31
+ icon: undefined;
32
+ intent: string;
33
+ onDismissClick: undefined;
34
+ tooltipText: undefined;
35
+ };
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Alert/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,oBAAY,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,GAAG,CAAC,OAAO,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,OAAO,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,SAAS;;;;;;;;;CASrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;CAQxB,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defaultProps = exports.propTypes = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var propTypes = {
13
+ 'aria-label': _propTypes.default.string,
14
+ description: _propTypes.default.string,
15
+ dismissable: _propTypes.default.bool,
16
+ icon: _propTypes.default.element,
17
+ intent: _propTypes.default.oneOf(['information', 'success', 'warning', 'danger']),
18
+ title: _propTypes.default.string.isRequired,
19
+ onDismissClick: _propTypes.default.func,
20
+ tooltipText: _propTypes.default.string
21
+ };
22
+ exports.propTypes = propTypes;
23
+ var defaultProps = {
24
+ 'aria-label': undefined,
25
+ description: undefined,
26
+ dismissable: false,
27
+ icon: undefined,
28
+ intent: 'information',
29
+ onDismissClick: undefined,
30
+ tooltipText: undefined
31
+ };
32
+ exports.defaultProps = defaultProps;
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,2 @@
1
+ export declare const sizeStyles: Record<string, {}>;
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/constants.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAKzC,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.sizeStyles = void 0;
7
+
8
+ var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /* eslint-disable import/prefer-default-export */
13
+ var makeSizeStyles = function makeSizeStyles(size) {
14
+ var value = (0, _rem.default)(size);
15
+ return {
16
+ width: value,
17
+ minWidth: value,
18
+ height: value,
19
+ minHeight: value
20
+ };
21
+ };
22
+
23
+ var sizeStyles = {
24
+ 'small.square': makeSizeStyles(20),
25
+ 'medium.round': makeSizeStyles(36),
26
+ 'medium.square': makeSizeStyles(30),
27
+ 'large.round': makeSizeStyles(60)
28
+ };
29
+ exports.sizeStyles = sizeStyles;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AACA,OAAc,EAAmB,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAOvE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAA2B,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAkEhC,QAAA,MAAM,YAAY,EAAE,sBAAsB,CAAC,QAAQ,EAAE,UAAU,CAE9D,CAAC;AAQF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAmB,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAQvE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAA2B,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAsDhC,QAAA,MAAM,YAAY,EAAE,sBAAsB,CAAC,QAAQ,EAAE,UAAU,CAE9D,CAAC;AAQF,eAAe,YAAY,CAAC"}
@@ -17,8 +17,6 @@ Object.defineProperty(exports, "BadgeProps", {
17
17
  });
18
18
  exports.default = void 0;
19
19
 
20
- var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
21
-
22
20
  var _react = _interopRequireWildcard(require("react"));
23
21
 
24
22
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
@@ -27,16 +25,18 @@ var _styledComponentsModifiers = require("styled-components-modifiers");
27
25
 
28
26
  var _color = _interopRequireDefault(require("../../modifiers/color"));
29
27
 
28
+ var _constants = require("./constants");
29
+
30
30
  var _commonUIColors = require("../../utils/commonUIColors");
31
31
 
32
32
  var _utils = require("../../utils");
33
33
 
34
34
  var _types = require("./types");
35
35
 
36
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
37
-
38
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
37
 
38
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
39
+
40
40
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
41
41
 
42
42
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -48,32 +48,21 @@ var colorModifiers = (0, _utils.applyDynamicModifiers)('color', function (_ref)
48
48
  return (0, _styledComponents.css)(["", ""], color && color in _commonUIColors.commonUIColors && (0, _color.default)(_commonUIColors.commonUIColors[color]));
49
49
  });
50
50
 
51
- var makeSizeStyles = function makeSizeStyles(size) {
52
- return {
53
- width: (0, _rem.default)(size),
54
- minWidth: (0, _rem.default)(size),
55
- height: (0, _rem.default)(size),
56
- minHeight: (0, _rem.default)(size)
57
- };
58
- };
59
-
60
- var sizeStyles = {
61
- 'medium.round': makeSizeStyles(36),
62
- 'medium.square': makeSizeStyles(30),
63
- 'large.round': makeSizeStyles(60)
64
- };
65
-
66
51
  var getSizeStyles = function getSizeStyles(key) {
67
- return (0, _styledComponents.css)(sizeStyles[key] || '');
52
+ return (0, _styledComponents.css)(_constants.sizeStyles[key] || '');
68
53
  };
69
54
 
70
55
  var sizeModifiers = (0, _styledComponentsModifiers.applyStyleModifiers)({
71
- medium: function medium(_ref2) {
56
+ small: function small(_ref2) {
72
57
  var v = _ref2.variant;
73
- return getSizeStyles("medium.".concat(v));
58
+ return getSizeStyles("small.".concat(v));
74
59
  },
75
- large: function large(_ref3) {
60
+ medium: function medium(_ref3) {
76
61
  var v = _ref3.variant;
62
+ return getSizeStyles("medium.".concat(v));
63
+ },
64
+ large: function large(_ref4) {
65
+ var v = _ref4.variant;
77
66
  return getSizeStyles("large.".concat(v));
78
67
  }
79
68
  }, 'size');
@@ -10,6 +10,8 @@ var _Home = _interopRequireDefault(require("@decisiv/iconix/lib/components/Home"
10
10
 
11
11
  var _ = _interopRequireDefault(require("."));
12
12
 
13
+ var _constants = require("./constants");
14
+
13
15
  var _commonUIColors = require("../../utils/commonUIColors");
14
16
 
15
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -53,16 +55,25 @@ describe('Badge', function () {
53
55
  expect(container).toMatchSnapshot();
54
56
  });
55
57
  });
58
+ it("renders correctly with size=\"small\" and variant=\"square\"", function () {
59
+ var _renderBadge3 = renderBadge({
60
+ size: 'small',
61
+ variant: 'square'
62
+ }),
63
+ container = _renderBadge3.container;
64
+
65
+ expect(container).toMatchSnapshot();
66
+ });
56
67
  it('renders correctly in any of the common UI colors', function () {
57
68
  Object.entries(_commonUIColors.commonUIColors).forEach(function (_ref) {
58
69
  var _ref2 = _slicedToArray(_ref, 2),
59
70
  key = _ref2[0],
60
71
  value = _ref2[1];
61
72
 
62
- var _renderBadge3 = renderBadge({
73
+ var _renderBadge4 = renderBadge({
63
74
  color: key
64
75
  }),
65
- container = _renderBadge3.container;
76
+ container = _renderBadge4.container;
66
77
 
67
78
  expect(container.firstChild).toHaveStyleRule('background-color', (0, _toColorString.default)(value));
68
79
  });
@@ -75,12 +86,44 @@ describe('Badge', function () {
75
86
  // @ts-ignore
76
87
  console.error.mockRestore();
77
88
  });
78
- it('warns if variant="square" and size="large"', function () {
79
- renderBadge({
80
- size: 'large',
81
- variant: 'square'
82
- });
83
- expect(console.error).toHaveBeenCalledWith("Warning: Failed prop type: The prop 'variant' can not be 'square' if the 'size' prop is 'large'.\n in Badge");
89
+ it('warns for invalid size/variant combinations', function () {
90
+ var sizes = ['small', 'medium', 'large'];
91
+ var variants = ['round', 'square'];
92
+ var validCombinations = Object.keys(_constants.sizeStyles);
93
+
94
+ for (var _i2 = 0, _sizes = sizes; _i2 < _sizes.length; _i2++) {
95
+ var size = _sizes[_i2];
96
+ var _iteratorNormalCompletion = true;
97
+ var _didIteratorError = false;
98
+ var _iteratorError = undefined;
99
+
100
+ try {
101
+ for (var _iterator = variants[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
102
+ var variant = _step.value;
103
+
104
+ if (!validCombinations.includes("".concat(size, ".").concat(variant))) {
105
+ renderBadge({
106
+ size: size,
107
+ variant: variant
108
+ });
109
+ expect(console.error).toHaveBeenCalledWith("Warning: Failed prop type: The Badge component does not support the '".concat(size, "' size and '").concat(variant, "' variant props combination.\n in Badge"));
110
+ }
111
+ }
112
+ } catch (err) {
113
+ _didIteratorError = true;
114
+ _iteratorError = err;
115
+ } finally {
116
+ try {
117
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
118
+ _iterator.return();
119
+ }
120
+ } finally {
121
+ if (_didIteratorError) {
122
+ throw _iteratorError;
123
+ }
124
+ }
125
+ }
126
+ }
84
127
  });
85
128
  });
86
129
  });
@@ -15,7 +15,7 @@ schema.propTypes = {
15
15
  'aria-label': _reactDesc.PropTypes.string.description('Descriptive text for accessibility purposes').isRequired,
16
16
  color: _reactDesc.PropTypes.string.description('(See note) Sets the color for the background and the icon').defaultValue('information'),
17
17
  icon: _reactDesc.PropTypes.element.description('Must be an icon component from `@decisiv/iconix`').isRequired,
18
- size: _reactDesc.PropTypes.oneOf(['medium', 'large']).description('(See note) Sets the size of the badge').defaultValue('medium'),
18
+ size: _reactDesc.PropTypes.oneOf(['small', 'medium', 'large']).description('(See note) Sets the size of the badge').defaultValue('medium'),
19
19
  variant: _reactDesc.PropTypes.oneOf(['round', 'square']).description('(See note) Controls primary style variations of the badge').defaultValue('round')
20
20
  };
21
21
  var _default = schema;
@@ -8,7 +8,7 @@ export interface BadgeProps {
8
8
  'aria-label': string;
9
9
  color?: CommonUIColorKeys;
10
10
  icon: IconComponent;
11
- size?: 'medium' | 'large';
11
+ size?: 'small' | 'medium' | 'large';
12
12
  variant?: 'round' | 'square';
13
13
  }
14
14
  declare function variantValidator(props: BadgeProps, propName: 'variant', componentName: 'Badge'): Error | null;