@agility/plenum-ui 1.3.48 → 2.0.0-rc1

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 (332) hide show
  1. package/.eslintrc.json +6 -0
  2. package/.prettierrc +12 -12
  3. package/.storybook/Layout.jsx +9 -6
  4. package/.storybook/head.tsx +4 -0
  5. package/.storybook/main.ts +18 -0
  6. package/.storybook/manager-head.html +1 -0
  7. package/.storybook/manager.ts +25 -0
  8. package/.storybook/plenumTheme.ts +8 -0
  9. package/.storybook/preview-head.html +4 -0
  10. package/.storybook/preview.tsx +28 -0
  11. package/.vscode/settings.json +4 -0
  12. package/.yarnrc.yml +1 -0
  13. package/README.md +165 -53
  14. package/app/globals.css +99 -0
  15. package/app/head.tsx +59 -0
  16. package/app/layout.tsx +28 -0
  17. package/app/page.tsx +7 -0
  18. package/build.js +33 -0
  19. package/dist/index.js +5936 -0
  20. package/dist/index.js.map +7 -0
  21. package/{lib/components → dist/types/stories/atoms}/Avatar/Avatar.d.ts +28 -27
  22. package/dist/types/stories/atoms/Avatar/index.d.ts +3 -0
  23. package/dist/types/stories/atoms/badges/Badge.d.ts +21 -0
  24. package/dist/types/stories/atoms/badges/index.d.ts +3 -0
  25. package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +13 -0
  26. package/dist/types/stories/atoms/buttons/Button/Button.d.ts +33 -0
  27. package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +13 -0
  28. package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +13 -0
  29. package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +13 -0
  30. package/dist/types/stories/atoms/buttons/Button/defaultArgs.d.ts +3 -0
  31. package/dist/types/stories/atoms/buttons/Button/index.d.ts +3 -0
  32. package/dist/types/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.d.ts +6 -0
  33. package/dist/types/stories/atoms/buttons/Capsule/Capsule.d.ts +27 -0
  34. package/dist/types/stories/atoms/buttons/Capsule/Danger/Danger.stories.d.ts +6 -0
  35. package/dist/types/stories/atoms/buttons/Capsule/Primary/Primary.stories.d.ts +6 -0
  36. package/dist/types/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.d.ts +6 -0
  37. package/dist/types/stories/atoms/buttons/Capsule/index.d.ts +3 -0
  38. package/dist/types/stories/atoms/buttons/index.d.ts +4 -0
  39. package/{lib/components/DynamicIcons/DynamicIcons.d.ts → dist/types/stories/atoms/icons/DynamicIcon.d.ts} +20 -17
  40. package/dist/types/stories/atoms/icons/DynamicIcon.stories.d.ts +10 -0
  41. package/dist/types/stories/atoms/icons/IconWithShadow.d.ts +6 -0
  42. package/dist/types/stories/atoms/icons/IconWithShadow.stories.d.ts +10 -0
  43. package/{lib/components/DynamicIcons → dist/types/stories/atoms/icons}/TablerIcon.d.ts +9 -9
  44. package/dist/types/stories/atoms/icons/index.d.ts +4 -0
  45. package/dist/types/stories/atoms/icons/tablerIconNames.d.ts +2 -0
  46. package/dist/types/stories/atoms/index.d.ts +7 -0
  47. package/dist/types/stories/atoms/loaders/Loader.d.ts +6 -0
  48. package/dist/types/stories/atoms/loaders/Loader.stories.d.ts +6 -0
  49. package/dist/types/stories/atoms/loaders/NProgress/RadialProgress.d.ts +11 -0
  50. package/dist/types/stories/atoms/loaders/NProgress/index.d.ts +3 -0
  51. package/dist/types/stories/atoms/loaders/index.d.ts +4 -0
  52. package/dist/types/stories/index.d.ts +5 -0
  53. package/dist/types/stories/layouts/index.d.ts +0 -0
  54. package/dist/types/stories/molecules/index.d.ts +3 -0
  55. package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +28 -0
  56. package/dist/types/stories/molecules/inputs/InputField/index.d.ts +3 -0
  57. package/{lib/components/Forms → dist/types/stories/molecules/inputs}/InputLabel/InputLabel.d.ts +15 -14
  58. package/dist/types/stories/molecules/inputs/InputLabel/index.d.ts +3 -0
  59. package/dist/types/stories/molecules/inputs/NestedInputButton/NestedInputButton.d.ts +17 -0
  60. package/dist/types/stories/molecules/inputs/NestedInputButton/index.d.ts +3 -0
  61. package/{lib/components/Forms/Checkbox → dist/types/stories/molecules/inputs/checkbox}/Checkbox.d.ts +28 -27
  62. package/dist/types/stories/molecules/inputs/checkbox/Checkbox.stories.d.ts +6 -0
  63. package/dist/types/stories/molecules/inputs/checkbox/index.d.ts +3 -0
  64. package/{lib/components/Combobox/Combobox.d.ts → dist/types/stories/molecules/inputs/combobox/ComboBox.d.ts} +34 -34
  65. package/dist/types/stories/molecules/inputs/combobox/ComboBox.stories.d.ts +6 -0
  66. package/dist/types/stories/molecules/inputs/combobox/index.d.ts +3 -0
  67. package/dist/types/stories/molecules/inputs/index.d.ts +11 -0
  68. package/{lib/components/Forms/Radio → dist/types/stories/molecules/inputs/radio}/Radio.d.ts +27 -27
  69. package/dist/types/stories/molecules/inputs/radio/Radio.stories.d.ts +6 -0
  70. package/dist/types/stories/molecules/inputs/radio/index.d.ts +3 -0
  71. package/{lib/components/Forms/Select → dist/types/stories/molecules/inputs/select}/Select.d.ts +27 -27
  72. package/dist/types/stories/molecules/inputs/select/Select.stories.d.ts +6 -0
  73. package/dist/types/stories/molecules/inputs/select/index.d.ts +3 -0
  74. package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +26 -0
  75. package/dist/types/stories/molecules/inputs/textArea/TextArea.stories.d.ts +6 -0
  76. package/dist/types/stories/molecules/inputs/textArea/index.d.ts +3 -0
  77. package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +18 -0
  78. package/dist/types/stories/molecules/inputs/toggleSwitch/index.d.ts +3 -0
  79. package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +18 -0
  80. package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +3 -0
  81. package/dist/types/stories/organisms/ButtonDropdown/ButtonDropdown.d.ts +14 -0
  82. package/dist/types/stories/organisms/ButtonDropdown/index.d.ts +3 -0
  83. package/{lib/components/Dropdown/Dropdown.d.ts → dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts} +40 -39
  84. package/dist/types/stories/organisms/DropdownComponent/dropdownItems.d.ts +3 -0
  85. package/dist/types/stories/organisms/DropdownComponent/index.d.ts +4 -0
  86. package/dist/types/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.d.ts +19 -0
  87. package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +3 -0
  88. package/dist/types/stories/organisms/FormInputWithAddons/FormInputWithAddons.d.ts +21 -0
  89. package/dist/types/stories/organisms/FormInputWithAddons/index.d.ts +3 -0
  90. package/dist/types/stories/organisms/index.d.ts +7 -0
  91. package/dist/types/utils/types.d.ts +2 -0
  92. package/dist/types/utils/useId.d.ts +1 -0
  93. package/next.config.js +8 -0
  94. package/package.json +53 -77
  95. package/pages/api/hello.ts +13 -0
  96. package/postcss.config.js +5 -6
  97. package/public/next.svg +1 -0
  98. package/public/thirteen.svg +1 -0
  99. package/public/vercel.svg +1 -0
  100. package/scripts/create-component.js +97 -0
  101. package/stories/Introduction.mdx +314 -0
  102. package/stories/assets/code-brackets.svg +1 -0
  103. package/stories/assets/colors.svg +1 -0
  104. package/stories/assets/comments.svg +1 -0
  105. package/stories/assets/direction.svg +1 -0
  106. package/stories/assets/flow.svg +1 -0
  107. package/stories/assets/plugin.svg +1 -0
  108. package/stories/assets/repo.svg +1 -0
  109. package/stories/assets/stackalt.svg +1 -0
  110. package/stories/atoms/Avatar/Avatar.stories.tsx +96 -0
  111. package/stories/atoms/Avatar/Avatar.tsx +123 -0
  112. package/stories/atoms/Avatar/index.ts +3 -0
  113. package/stories/atoms/badges/Badge.tsx +127 -0
  114. package/stories/atoms/badges/Pill/Pill.stories.tsx +75 -0
  115. package/stories/atoms/badges/Rounded/Rounded.stories.tsx +75 -0
  116. package/stories/atoms/badges/index.ts +3 -0
  117. package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +69 -0
  118. package/stories/atoms/buttons/Button/Button.tsx +123 -0
  119. package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +71 -0
  120. package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +78 -0
  121. package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +74 -0
  122. package/stories/atoms/buttons/Button/defaultArgs.ts +9 -0
  123. package/stories/atoms/buttons/Button/index.ts +3 -0
  124. package/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.ts +27 -0
  125. package/stories/atoms/buttons/Capsule/Capsule.tsx +87 -0
  126. package/stories/atoms/buttons/Capsule/Danger/Danger.stories.ts +27 -0
  127. package/stories/atoms/buttons/Capsule/Primary/Primary.stories.ts +27 -0
  128. package/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.ts +27 -0
  129. package/stories/atoms/buttons/Capsule/index.ts +3 -0
  130. package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.stories.tsx +15 -0
  131. package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.tsx +22 -0
  132. package/stories/atoms/buttons/FloatingActionButton/index.tsx +3 -0
  133. package/stories/atoms/buttons/index.ts +4 -0
  134. package/stories/atoms/crumb/Crumb.stories.tsx +18 -0
  135. package/stories/atoms/crumb/Crumb.tsx +22 -0
  136. package/stories/atoms/crumb/index.tsx +3 -0
  137. package/stories/atoms/icons/DynamicIcon.stories.ts +43 -0
  138. package/stories/atoms/icons/DynamicIcon.tsx +90 -0
  139. package/stories/atoms/icons/IconWithShadow.stories.ts +43 -0
  140. package/stories/atoms/icons/IconWithShadow.tsx +16 -0
  141. package/stories/atoms/icons/TablerIcon.tsx +22 -0
  142. package/stories/atoms/icons/index.tsx +14 -0
  143. package/stories/atoms/icons/tablerIconNames.ts +4336 -0
  144. package/stories/atoms/index.ts +46 -0
  145. package/stories/atoms/loaders/Loader.stories.ts +15 -0
  146. package/stories/atoms/loaders/Loader.tsx +15 -0
  147. package/stories/atoms/loaders/NProgress/RadialProgress.stories.tsx +19 -0
  148. package/stories/atoms/loaders/NProgress/RadialProgress.tsx +76 -0
  149. package/stories/atoms/loaders/NProgress/index.ts +3 -0
  150. package/stories/atoms/loaders/index.ts +4 -0
  151. package/stories/index.ts +124 -0
  152. package/stories/layouts/CardLayout/CardLayout.stories.tsx +18 -0
  153. package/stories/layouts/CardLayout/CardLayout.tsx +22 -0
  154. package/stories/layouts/CardLayout/index.tsx +3 -0
  155. package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +18 -0
  156. package/stories/layouts/ModalLayout/ModalLayout.tsx +22 -0
  157. package/stories/layouts/ModalLayout/index.tsx +3 -0
  158. package/stories/layouts/index.ts +0 -0
  159. package/stories/molecules/index.ts +35 -0
  160. package/stories/molecules/inputs/InputField/InputField.stories.tsx +29 -0
  161. package/stories/molecules/inputs/InputField/InputField.tsx +88 -0
  162. package/stories/molecules/inputs/InputField/index.tsx +3 -0
  163. package/stories/molecules/inputs/InputLabel/InputLabel.stories.tsx +19 -0
  164. package/stories/molecules/inputs/InputLabel/InputLabel.tsx +45 -0
  165. package/stories/molecules/inputs/InputLabel/index.tsx +3 -0
  166. package/stories/molecules/inputs/NestedInputButton/NestedInputButton.stories.tsx +52 -0
  167. package/stories/molecules/inputs/NestedInputButton/NestedInputButton.tsx +64 -0
  168. package/stories/molecules/inputs/NestedInputButton/index.tsx +3 -0
  169. package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +23 -0
  170. package/stories/molecules/inputs/checkbox/Checkbox.tsx +99 -0
  171. package/stories/molecules/inputs/checkbox/index.ts +3 -0
  172. package/stories/molecules/inputs/combobox/ComboBox.stories.ts +41 -0
  173. package/stories/molecules/inputs/combobox/ComboBox.tsx +194 -0
  174. package/stories/molecules/inputs/combobox/index.ts +3 -0
  175. package/stories/molecules/inputs/index.ts +24 -0
  176. package/stories/molecules/inputs/radio/Radio.stories.ts +27 -0
  177. package/stories/molecules/inputs/radio/Radio.tsx +92 -0
  178. package/stories/molecules/inputs/radio/index.ts +3 -0
  179. package/stories/molecules/inputs/select/Select.stories.ts +23 -0
  180. package/stories/molecules/inputs/select/Select.tsx +100 -0
  181. package/stories/molecules/inputs/select/index.ts +3 -0
  182. package/stories/molecules/inputs/textArea/TextArea.stories.ts +20 -0
  183. package/stories/molecules/inputs/textArea/TextArea.tsx +67 -0
  184. package/stories/molecules/inputs/textArea/index.ts +3 -0
  185. package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +119 -0
  186. package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +75 -0
  187. package/stories/molecules/inputs/toggleSwitch/index.ts +3 -0
  188. package/stories/molecules/tabs/Tabs.stories.tsx +18 -0
  189. package/stories/molecules/tabs/Tabs.tsx +22 -0
  190. package/stories/molecules/tabs/index.tsx +3 -0
  191. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +21 -0
  192. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +60 -0
  193. package/stories/organisms/AnimatedLabelInput/index.tsx +3 -0
  194. package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +118 -0
  195. package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +81 -0
  196. package/stories/organisms/ButtonDropdown/index.tsx +3 -0
  197. package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +49 -0
  198. package/stories/organisms/DropdownComponent/Dropdown.test.tsx +0 -0
  199. package/stories/organisms/DropdownComponent/DropdownComponent.tsx +269 -0
  200. package/stories/organisms/DropdownComponent/dropdownItems.ts +101 -0
  201. package/stories/organisms/DropdownComponent/index.ts +4 -0
  202. package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +76 -0
  203. package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.tsx +52 -0
  204. package/stories/organisms/EmptySectionPlaceholder/index.tsx +3 -0
  205. package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +29 -0
  206. package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +140 -0
  207. package/stories/organisms/FormInputWithAddons/index.tsx +3 -0
  208. package/stories/organisms/index.ts +16 -0
  209. package/tailwind.config.js +165 -36
  210. package/tsconfig.json +27 -21
  211. package/tsconfig.lib.json +19 -0
  212. package/utils/types.d.ts +2 -0
  213. package/utils/types.ts +3 -0
  214. package/utils/useId.d.ts +1 -0
  215. package/utils/useId.tsx +16 -0
  216. package/.babelrc +0 -14
  217. package/.editorconfig +0 -9
  218. package/.eslintrc +0 -13
  219. package/.github/workflows/test.yml +0 -27
  220. package/.storybook/main.js +0 -17
  221. package/.storybook/manager.js +0 -6
  222. package/.storybook/plenumTheme.js +0 -8
  223. package/.storybook/preview.js +0 -44
  224. package/_templates/component/new/component.ejs.t +0 -18
  225. package/_templates/component/new/component.stories.ejs.t +0 -21
  226. package/_templates/component/new/component.test.ejs.t +0 -15
  227. package/_templates/component/new/index.ejs.t +0 -6
  228. package/_templates/component/new/prompt.js +0 -7
  229. package/jest.config.js +0 -8
  230. package/lib/common/brandCfg.d.ts +0 -3
  231. package/lib/common/index.d.ts +0 -3
  232. package/lib/common/storyCfg.d.ts +0 -5
  233. package/lib/components/Avatar/Avatar.stories.d.ts +0 -6
  234. package/lib/components/Avatar/Avatar.test.d.ts +0 -1
  235. package/lib/components/Avatar/index.d.ts +0 -1
  236. package/lib/components/Button/Button.d.ts +0 -55
  237. package/lib/components/Button/Button.stories.d.ts +0 -11
  238. package/lib/components/Button/Button.test.d.ts +0 -1
  239. package/lib/components/Button/index.d.ts +0 -1
  240. package/lib/components/ButtonDropdown/ButtonDropdown.d.ts +0 -12
  241. package/lib/components/ButtonDropdown/ButtonDropdown.stories.d.ts +0 -9
  242. package/lib/components/ButtonDropdown/index.d.ts +0 -1
  243. package/lib/components/Combobox/Combobox.stories.d.ts +0 -14
  244. package/lib/components/Combobox/Combobox.test.d.ts +0 -1
  245. package/lib/components/Combobox/index.d.ts +0 -1
  246. package/lib/components/Dropdown/Dropdown.stories.d.ts +0 -8
  247. package/lib/components/Dropdown/Dropdown.test.d.ts +0 -1
  248. package/lib/components/Dropdown/data.d.ts +0 -3
  249. package/lib/components/Dropdown/index.d.ts +0 -1
  250. package/lib/components/DynamicIcons/DynamicIcons.stories.d.ts +0 -9
  251. package/lib/components/DynamicIcons/index.d.ts +0 -3
  252. package/lib/components/DynamicIcons/tablerIconNames.d.ts +0 -2
  253. package/lib/components/Forms/BaseField/BaseField.d.ts +0 -34
  254. package/lib/components/Forms/BaseField/BaseField.stories.d.ts +0 -6
  255. package/lib/components/Forms/BaseField/BaseField.test.d.ts +0 -1
  256. package/lib/components/Forms/BaseField/index.d.ts +0 -1
  257. package/lib/components/Forms/Checkbox/Checkbox.stories.d.ts +0 -14
  258. package/lib/components/Forms/Checkbox/Checkbox.test.d.ts +0 -1
  259. package/lib/components/Forms/Checkbox/index.d.ts +0 -1
  260. package/lib/components/Forms/InputCounter/InputCounter.d.ts +0 -9
  261. package/lib/components/Forms/InputCounter/InputCounter.stories.d.ts +0 -6
  262. package/lib/components/Forms/InputCounter/InputCounter.test.d.ts +0 -1
  263. package/lib/components/Forms/InputCounter/index.d.ts +0 -1
  264. package/lib/components/Forms/InputLabel/InputLabel.stories.d.ts +0 -6
  265. package/lib/components/Forms/InputLabel/InputLabel.test.d.ts +0 -1
  266. package/lib/components/Forms/InputLabel/index.d.ts +0 -1
  267. package/lib/components/Forms/Radio/Radio.stories.d.ts +0 -12
  268. package/lib/components/Forms/Radio/Radio.test.d.ts +0 -1
  269. package/lib/components/Forms/Radio/index.d.ts +0 -1
  270. package/lib/components/Forms/Select/Select.stories.d.ts +0 -11
  271. package/lib/components/Forms/Select/Select.test.d.ts +0 -1
  272. package/lib/components/Forms/Select/index.d.ts +0 -1
  273. package/lib/components/Forms/TextInput/TextInput.d.ts +0 -39
  274. package/lib/components/Forms/TextInput/TextInput.stories.d.ts +0 -12
  275. package/lib/components/Forms/TextInput/index.d.ts +0 -1
  276. package/lib/components/Forms/TextInputAddon/InputCta/InputCta.d.ts +0 -16
  277. package/lib/components/Forms/TextInputAddon/InputCta/InputCta.stories.d.ts +0 -6
  278. package/lib/components/Forms/TextInputAddon/InputCta/InputCta.test.d.ts +0 -1
  279. package/lib/components/Forms/TextInputAddon/InputCta/index.d.ts +0 -1
  280. package/lib/components/Forms/TextInputAddon/TextInputAddon.d.ts +0 -54
  281. package/lib/components/Forms/TextInputAddon/TextInputAddon.stories.d.ts +0 -13
  282. package/lib/components/Forms/TextInputAddon/index.d.ts +0 -1
  283. package/lib/components/Forms/TextInputSelect/InputSelect/InputSelect.d.ts +0 -13
  284. package/lib/components/Forms/TextInputSelect/InputSelect/InputSelect.stories.d.ts +0 -6
  285. package/lib/components/Forms/TextInputSelect/InputSelect/InputSelect.test.d.ts +0 -1
  286. package/lib/components/Forms/TextInputSelect/InputSelect/index.d.ts +0 -1
  287. package/lib/components/Forms/TextInputSelect/TextInputSelect.d.ts +0 -48
  288. package/lib/components/Forms/TextInputSelect/TextInputSelect.stories.d.ts +0 -8
  289. package/lib/components/Forms/TextInputSelect/index.d.ts +0 -1
  290. package/lib/components/Forms/Textarea/Textarea.d.ts +0 -32
  291. package/lib/components/Forms/Textarea/Textarea.stories.d.ts +0 -12
  292. package/lib/components/Forms/Textarea/Textarea.test.d.ts +0 -1
  293. package/lib/components/Forms/Textarea/index.d.ts +0 -1
  294. package/lib/components/ToggleSwitch/ToggleSwitch.d.ts +0 -28
  295. package/lib/components/ToggleSwitch/ToggleSwitch.stories.d.ts +0 -21
  296. package/lib/components/ToggleSwitch/ToggleSwitch.test.d.ts +0 -1
  297. package/lib/components/ToggleSwitch/index.d.ts +0 -1
  298. package/lib/components/TreeView/TreeView.d.ts +0 -36
  299. package/lib/components/TreeView/TreeView.stories.d.ts +0 -6
  300. package/lib/components/TreeView/TreeView.test.d.ts +0 -1
  301. package/lib/components/TreeView/index.d.ts +0 -1
  302. package/lib/components/TreeView V1/TreeItem/TreeItem.d.ts +0 -16
  303. package/lib/components/TreeView V1/TreeItem/TreeItem.stories.d.ts +0 -9
  304. package/lib/components/TreeView V1/TreeItem/TreeItem.test.d.ts +0 -1
  305. package/lib/components/TreeView V1/TreeItem/index.d.ts +0 -1
  306. package/lib/components/TreeView V1/TreeView.d.ts +0 -6
  307. package/lib/components/TreeView V1/TreeView.stories.d.ts +0 -6
  308. package/lib/components/TreeView V1/TreeView.test.d.ts +0 -1
  309. package/lib/components/TreeView V1/context.d.ts +0 -9
  310. package/lib/components/TreeView V1/index.d.ts +0 -1
  311. package/lib/components/TreeView V1/sampleData.d.ts +0 -71
  312. package/lib/components/TreeView V1/types/tree.types.d.ts +0 -21
  313. package/lib/index.d.ts +0 -13
  314. package/lib/index.esm.js +0 -105874
  315. package/lib/index.esm.js.map +0 -1
  316. package/lib/index.js +0 -105913
  317. package/lib/index.js.map +0 -1
  318. package/lib/page/TreeNavigation/CustomNode/CustomNode.d.ts +0 -3
  319. package/lib/page/TreeNavigation/CustomNode/CustomNode.test.d.ts +0 -1
  320. package/lib/page/TreeNavigation/CustomNode/index.d.ts +0 -1
  321. package/lib/page/TreeNavigation/TreeNavigation.d.ts +0 -8
  322. package/lib/page/TreeNavigation/TreeNavigation.stories.d.ts +0 -6
  323. package/lib/page/TreeNavigation/hooks/useFetch.d.ts +0 -14
  324. package/lib/page/TreeNavigation/index.d.ts +0 -1
  325. package/lib/tailwind.css +0 -2023
  326. package/lib/util/DynamicIcons.d.ts +0 -10
  327. package/lib/util/Loader.d.ts +0 -5
  328. package/lib/util/types.d.ts +0 -2
  329. package/lib/util/useID.d.ts +0 -1
  330. package/rollup.config.js +0 -37
  331. package/setupTests.js +0 -6
  332. package/styleMock.js +0 -2
@@ -0,0 +1,123 @@
1
+ import React, { FC, useMemo } from "react"
2
+ import { default as cn } from "classnames"
3
+ // import Image from "next/image"
4
+ export interface IAvatarProps {
5
+ /**
6
+ * source url for the avatar
7
+ */
8
+ src?: string
9
+ /**
10
+ * Initials we use as fallback if no src is passed
11
+ */
12
+ initials?: string
13
+ /**
14
+ * optional status
15
+ */
16
+ status?: "offline" | "online" | "busy"
17
+ /**
18
+ * avatar picture size (also affects status indicator)
19
+ */
20
+ size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl"
21
+ /**
22
+ * avatar img alt
23
+ */
24
+ alt?: string
25
+ }
26
+
27
+ /**
28
+ * Avatar component that shows profile image or name initials of the user
29
+ */
30
+ const Avatar: FC<IAvatarProps> = ({ src, status, size = "md", alt = "Avatar image", initials }: IAvatarProps) => {
31
+ const imageStyles = cn("rounded-full", {
32
+ "h-6 w-6": size === "xxs",
33
+ "h-8 w-8": size === "xs",
34
+ "h-10 w-10": size === "sm",
35
+ "h-12 w-12": size === "md",
36
+ "h-14 w-14": size === "lg",
37
+ "h-16 w-16": size === "xl"
38
+ })
39
+ const initialsStyles = cn("inline-flex items-center justify-center rounded-full bg-gray-500", {
40
+ "h-6 w-6": size === "xxs",
41
+ "h-8 w-8": size === "xs",
42
+ "h-10 w-10": size === "sm",
43
+ "h-12 w-12": size === "md",
44
+ "h-14 w-14": size === "lg",
45
+ "h-16 w-16": size === "xl"
46
+ })
47
+ const fontStyles = cn("font-medium leading-none text-white uppercase", {
48
+ "text-xs": size === "xxs" || size === "xs",
49
+ "text-sm": size === "sm",
50
+ "text-base": size === "md",
51
+ "text-lg": size === "lg",
52
+ "text-xl": size === "xl"
53
+ })
54
+ const defaultAvatarStyles = cn("inline-block rounded-full overflow-hidden bg-gray-100", {
55
+ "h-6 w-6": size === "xxs",
56
+ "h-8 w-8": size === "xs",
57
+ "h-10 w-10": size === "sm",
58
+ "h-12 w-12": size === "md",
59
+ "h-14 w-14": size === "lg",
60
+ "h-16 w-16": size === "xl"
61
+ })
62
+
63
+ const statusStyles = cn("absolute top-0 right-0 block rounded-full ring-2 ring-white", {
64
+ "h-1.5 w-1.5": size === "xxs",
65
+ "h-2 w-2": size === "xs",
66
+ "h-2.5 w-2.5": size === "sm",
67
+ "h-3 w-3": size === "md",
68
+ "h-3.5 w-3.5": size === "lg",
69
+ "h-4 w-4": size === "xl",
70
+ "bg-gray-300": status === "offline",
71
+ "bg-red-400": status === "busy",
72
+ "bg-green-400": status === "online"
73
+ })
74
+ const imageSize: number = useMemo(() => {
75
+ let imageSize: number = 0
76
+ switch (size) {
77
+ case "xxs":
78
+ imageSize = 24
79
+ break
80
+ case "xs":
81
+ imageSize = 32
82
+ break
83
+ case "sm":
84
+ imageSize = 40
85
+ break
86
+ case "md":
87
+ imageSize = 48
88
+ break
89
+ case "lg":
90
+ imageSize = 56
91
+ break
92
+ case "xl":
93
+ imageSize = 64
94
+ break
95
+ default:
96
+ imageSize = 48
97
+ break
98
+ }
99
+ return imageSize
100
+ }, [size])
101
+
102
+ return (
103
+ <span className="inline-block relative">
104
+ {src ? (
105
+ // eslint-disable-next-line @next/next/no-img-element
106
+ <img className={imageStyles} width={imageSize} height={imageSize} src={src} alt={alt} loading="eager" />
107
+ ) : initials ? (
108
+ <span className={initialsStyles}>
109
+ <span className={fontStyles}>{initials}</span>
110
+ </span>
111
+ ) : (
112
+ <span className={defaultAvatarStyles}>
113
+ <svg className="h-full w-full text-gray-300" fill="currentColor" viewBox="0 0 24 24">
114
+ <path d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" />
115
+ </svg>
116
+ </span>
117
+ )}
118
+ {status && <span className={statusStyles}></span>}
119
+ </span>
120
+ )
121
+ }
122
+
123
+ export default Avatar
@@ -0,0 +1,3 @@
1
+ import Avatar, { IAvatarProps } from "./Avatar"
2
+ export default Avatar
3
+ export type { IAvatarProps }
@@ -0,0 +1,127 @@
1
+ import React from "react"
2
+ import { default as cn } from "classnames"
3
+ import { ClassNameWithAutocomplete } from "@/utils/types"
4
+ import { DynamicIcon } from "../icons"
5
+ export interface IBadgeProps {
6
+ /** The content scheme of the badge */
7
+ color: "primary" | "secondary" | "danger" | "warning" | "success" | "info" | "basic" | "pink"
8
+ /** Render with slightly rounded corners or as a pill shape */
9
+ variant: "rounded" | "pill"
10
+ /** The text content of the badge */
11
+ label: string
12
+ /** The size of the badge */
13
+ size?: "sm" | "lg"
14
+ /** Render a loader inside the badge */
15
+ loading?: boolean
16
+ /** Render with a small circle in a darker shade of the color chosen*/
17
+ statusDot?: boolean
18
+ /** Render with a button to remove the badge */
19
+ removeButton?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
20
+ /** Render the badge as a clickable button */
21
+ actionButton?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
22
+ }
23
+ const Badge: React.FC<IBadgeProps> = ({
24
+ color,
25
+ variant,
26
+ label,
27
+ size = "sm",
28
+ loading,
29
+ statusDot,
30
+ removeButton,
31
+ actionButton
32
+ }) => {
33
+ const badgeStyles = cn(
34
+ "text-sm flex items-center font-medium py-[2px] focus:ring-1 focus:ring-purple-600 focus:ring-offset-2 focus:ring-offset-white outline-0",
35
+ {
36
+ "rounded-[3px]": variant === "rounded",
37
+ "rounded-full px-[6px]": variant === "pill",
38
+ "rounded-full": variant === "pill" && size === "lg",
39
+ "px-[6px] text-xs": size === "sm",
40
+ "px-[10px]": size === "lg",
41
+ "pl-[10px]": !statusDot && size === "lg",
42
+ "pl-2": !statusDot && size === "sm",
43
+ "pr-3": !removeButton && size === "lg",
44
+ "pr-[10px]": !removeButton && size === "sm",
45
+ "gap-x-[6px]": statusDot || removeButton || loading,
46
+ "bg-purple-100 text-purple-800 ": color === "primary",
47
+ "bg-violet-100 text-violet-800": color === "secondary",
48
+ "bg-pink-100 text-pink-800": color === "pink",
49
+ "bg-red-100 text-red-800": color === "danger",
50
+ "bg-blue-100 text-blue-800": color === "info",
51
+ "bg-green-100 text-green-800": color === "success",
52
+ "bg-yellow-100 text-yellow-800": color === "warning",
53
+ "bg-gray-100 text-gray-800": color === "basic"
54
+ }
55
+ )
56
+ const statusDotStyles = cn("rounded-full h-[6px] p-[1px] w-[6px]", {
57
+ "bg-purple-400 text-purple-400": color === "primary",
58
+ "bg-violet-400 text-violet-400": color === "secondary",
59
+ "bg-pink-400 text-pink-400": color === "pink",
60
+ "bg-red-400 text-red-400": color === "danger",
61
+ "bg-blue-400 text-blue-400": color === "info",
62
+ "bg-green-400 text-green-400": color === "success",
63
+ "bg-yellow-400 text-yellow-400": color === "warning",
64
+ "bg-gray-400 text-gray-400": color === "basic"
65
+ })
66
+ const removeButtonStyles: ClassNameWithAutocomplete = cn(
67
+ "h-4 w-4 group-focus-within:ring-1 group-focus-within:ring-purple-600 rounded-full group-focus-within:ring-offset-[1px] group-focus-within:ring-offset-white outline-0",
68
+ {
69
+ "text-purple-400": color === "primary",
70
+ "text-violet-400": color === "secondary",
71
+ "text-pink-400": color === "pink",
72
+ "text-red-400": color === "danger",
73
+ "text-blue-400": color === "info",
74
+ "text-green-400": color === "success",
75
+ "text-yellow-400": color === "warning",
76
+ "text-gray-400": color === "basic"
77
+ }
78
+ )
79
+
80
+ const loaderStyles = cn("h-4 w-4 rounded-full border-2 animate-spin", {
81
+ "border-purple-400 !border-r-purple-200": color === "primary",
82
+ "border-violet-400 !border-r-violet-200": color === "secondary",
83
+ "border-pink-400 !border-r-pink-200": color === "pink",
84
+ "border-red-400 !border-r-red-200": color === "danger",
85
+ "border-blue-400 !border-r-blue-200": color === "info",
86
+ "border-green-400 !border-r-green-200": color === "success",
87
+ "border-yellow-400 !border-r-yellow-200": color === "warning",
88
+ "border-gray-400 !border-r-gray-200": color === "basic"
89
+ })
90
+
91
+ return actionButton ? (
92
+ <button {...{ ...actionButton, className: badgeStyles }}>
93
+ {statusDot && <div className={statusDotStyles} role="status" />}
94
+ {label}
95
+ {removeButton && (
96
+ <button
97
+ {...{
98
+ removeButton,
99
+ "aria-label": `Remove ${label}`,
100
+ className: `${removeButton?.className || ""} group outline-0 `
101
+ }}
102
+ >
103
+ <DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
104
+ </button>
105
+ )}
106
+ </button>
107
+ ) : (
108
+ <div className={badgeStyles}>
109
+ {loading && <div className={loaderStyles} role="status" />}
110
+ {!loading && statusDot && <div className={statusDotStyles} role="status" />}
111
+ {label}
112
+ {!loading && removeButton && (
113
+ <button
114
+ {...{
115
+ ...removeButton,
116
+ "aria-label": `Remove ${label}`,
117
+ className: `${removeButton?.className || ""} group outline-0 `
118
+ }}
119
+ >
120
+ <DynamicIcon {...{ icon: "XIcon", className: removeButtonStyles }} />
121
+ </button>
122
+ )}
123
+ </div>
124
+ )
125
+ }
126
+
127
+ export default Badge
@@ -0,0 +1,75 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import Badge from "../Badge"
3
+
4
+ const meta: Meta<typeof Badge> = {
5
+ title: "Design System/atoms/Badges/Pill",
6
+ component: Badge,
7
+ tags: ["autodocs"],
8
+ parameters: {
9
+ design: {
10
+ type: "figma",
11
+ url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=12-755&mode=design&t=9hpwa8YStpwXksff-4"
12
+ }
13
+ }
14
+ }
15
+ type Story = StoryObj<typeof Badge>
16
+ export const SmallPrimaryPill: Story = {
17
+ args: {
18
+ variant: "pill",
19
+ label: "Badge",
20
+ color: "primary"
21
+ }
22
+ }
23
+ export const PillAsButton: Story = {
24
+ args: {
25
+ variant: "pill",
26
+ label: "Badge",
27
+ color: "primary",
28
+ actionButton: { onClick: () => window.alert("action button clicked") }
29
+ }
30
+ }
31
+ export const SmallPrimaryPillWithRemoveButton: Story = {
32
+ args: {
33
+ ...SmallPrimaryPill.args,
34
+ removeButton: { onClick: () => window.alert("remove button clicked") }
35
+ }
36
+ }
37
+ export const SmallPrimaryPillWithStatusDot: Story = {
38
+ args: {
39
+ ...SmallPrimaryPill.args,
40
+ statusDot: true
41
+ }
42
+ }
43
+ export const SmallPrimaryPillWithStatusDotAndRemoveButton: Story = {
44
+ args: {
45
+ ...SmallPrimaryPillWithRemoveButton.args,
46
+ ...SmallPrimaryPillWithStatusDot.args
47
+ }
48
+ }
49
+ export const LargePrimaryPill: Story = {
50
+ args: {
51
+ variant: "pill",
52
+ label: "Badge",
53
+ color: "primary",
54
+ size: "lg"
55
+ }
56
+ }
57
+ export const LargePrimaryPillWithRemoveButton: Story = {
58
+ args: {
59
+ ...LargePrimaryPill.args,
60
+ removeButton: { onClick: () => window.alert("remove button clicked") }
61
+ }
62
+ }
63
+ export const LargePrimaryPillWithStatusDot: Story = {
64
+ args: {
65
+ ...LargePrimaryPill.args,
66
+ statusDot: true
67
+ }
68
+ }
69
+ export const LargePrimaryPillWithStatusDotAndRemoveButton: Story = {
70
+ args: {
71
+ ...LargePrimaryPillWithRemoveButton.args,
72
+ ...LargePrimaryPillWithStatusDot.args
73
+ }
74
+ }
75
+ export default meta
@@ -0,0 +1,75 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import Badge from "../Badge"
3
+
4
+ const meta: Meta<typeof Badge> = {
5
+ title: "Design System/atoms/Badges/Rounded",
6
+ component: Badge,
7
+ tags: ["autodocs"],
8
+ parameters: {
9
+ design: {
10
+ type: "figma",
11
+ url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=12-755&mode=design&t=9hpwa8YStpwXksff-4"
12
+ }
13
+ }
14
+ }
15
+ type Story = StoryObj<typeof Badge>
16
+ export const SmallPrimaryRounded: Story = {
17
+ args: {
18
+ variant: "rounded",
19
+ label: "Badge",
20
+ color: "primary"
21
+ }
22
+ }
23
+ export const RoundedAsButton: Story = {
24
+ args: {
25
+ variant: "rounded",
26
+ label: "Badge",
27
+ color: "primary",
28
+ actionButton: { onClick: () => window.alert("action button clicked") }
29
+ }
30
+ }
31
+ export const SmallPrimaryRoundedWithRemoveButton: Story = {
32
+ args: {
33
+ ...SmallPrimaryRounded.args,
34
+ removeButton: { onClick: () => window.alert("remove button clicked") }
35
+ }
36
+ }
37
+ export const SmallPrimaryRoundedWithStatusDot: Story = {
38
+ args: {
39
+ ...SmallPrimaryRounded.args,
40
+ statusDot: true
41
+ }
42
+ }
43
+ export const SmallPrimaryRoundedWithStatusDotAndRemoveButton: Story = {
44
+ args: {
45
+ ...SmallPrimaryRoundedWithRemoveButton.args,
46
+ ...SmallPrimaryRoundedWithStatusDot.args
47
+ }
48
+ }
49
+ export const LargePrimaryRounded: Story = {
50
+ args: {
51
+ variant: "rounded",
52
+ label: "Badge",
53
+ color: "primary",
54
+ size: "lg"
55
+ }
56
+ }
57
+ export const LargePrimaryRoundedWithRemoveButton: Story = {
58
+ args: {
59
+ ...LargePrimaryRounded.args,
60
+ removeButton: { onClick: () => window.alert("remove button clicked") }
61
+ }
62
+ }
63
+ export const LargePrimaryRoundedWithStatusDot: Story = {
64
+ args: {
65
+ ...LargePrimaryRounded.args,
66
+ statusDot: true
67
+ }
68
+ }
69
+ export const LargePrimaryRoundedWithStatusDotAndRemoveButton: Story = {
70
+ args: {
71
+ ...LargePrimaryRoundedWithRemoveButton.args,
72
+ ...LargePrimaryRoundedWithStatusDot.args
73
+ }
74
+ }
75
+ export default meta
@@ -0,0 +1,3 @@
1
+ import Badge, { IBadgeProps } from "./Badge"
2
+ export default Badge
3
+ export type { IBadgeProps }
@@ -0,0 +1,69 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import Button from "../Button"
3
+ import { defaultIcon } from "../defaultArgs"
4
+
5
+ // More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
6
+ const meta: Meta<typeof Button> = {
7
+ title: "Design System/atoms/Buttons/Button/Alternative",
8
+ component: Button,
9
+ tags: ["autodocs"],
10
+ argTypes: {}
11
+ }
12
+
13
+ export default meta
14
+ type Story = StoryObj<typeof Button>
15
+ // #region Alternative Button Stories
16
+ export const Alternative: Story = {
17
+ args: {
18
+ actionType: "alternative",
19
+ label: "Button",
20
+ onClick: () => {
21
+ window.alert("Button clicked!")
22
+ }
23
+ }
24
+ }
25
+ export const AlternativeTrailingIcon: Story = {
26
+ args: {
27
+ ...Alternative.args,
28
+ icon: defaultIcon,
29
+ iconPosition: "trailing"
30
+ }
31
+ }
32
+ export const AlternativeLeadingIcon: Story = {
33
+ args: {
34
+ ...AlternativeTrailingIcon.args,
35
+ iconPosition: "leading"
36
+ }
37
+ }
38
+ export const AlternativeExtraSmall: Story = {
39
+ args: {
40
+ ...Alternative.args,
41
+ size: "sm"
42
+ }
43
+ }
44
+ export const AlternativeSmall: Story = {
45
+ args: {
46
+ ...Alternative.args,
47
+ size: "sm"
48
+ }
49
+ }
50
+ export const AlternativeMedium: Story = {
51
+ args: {
52
+ ...Alternative.args,
53
+ size: "md"
54
+ }
55
+ }
56
+
57
+ export const AlternativeLarge: Story = {
58
+ args: {
59
+ ...Alternative.args,
60
+ size: "lg"
61
+ }
62
+ }
63
+ export const AlternativeExtraLarge: Story = {
64
+ args: {
65
+ ...Alternative.args,
66
+ size: "xl"
67
+ }
68
+ }
69
+ // #endregion
@@ -0,0 +1,123 @@
1
+ import Loader from "stories/atoms/loaders/Loader"
2
+ import { default as cn } from "classnames"
3
+ import { HTMLAttributeAnchorTarget } from "react"
4
+ import { DynamicIcon, UnifiedIconName, IDynamicIconProps } from "../../icons"
5
+
6
+ // import Loader from "../loaders/loader/Loader"
7
+
8
+ export type BTNActionType = "primary" | "secondary" | "alternative" | "danger"
9
+ export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
10
+ /** Is the button a Primary CTA, alternative or danger button? */
11
+ actionType: BTNActionType
12
+ /** How lg should the button be? - Defaults to 'base'. */
13
+ size?: "xs" | "sm" | "md" | "lg" | "xl"
14
+ /** The Button's text content. */
15
+ label: string
16
+ /** The Icon to be displayed inside the button. */
17
+ icon?: IDynamicIconProps
18
+ /** Does the button width grow to fill it's container? */
19
+ fullWidth?: boolean
20
+ /** Optionally render as anchor tag */
21
+ asLink?: {
22
+ href: string
23
+ target: HTMLAttributeAnchorTarget
24
+ title?: string
25
+ }
26
+ /** The placement of the icon relative to the text content. */
27
+ iconPosition?: "trailing" | "leading"
28
+ /** Use an custom svg element */
29
+ CustomSVGIcon?: JSX.Element
30
+ /** Is the associated content loading? */
31
+ isLoading?: boolean
32
+ className?: string
33
+ }
34
+ /**
35
+ * Primary UI component for user interaction
36
+ */
37
+ const Button = ({
38
+ actionType = "primary",
39
+ size = "sm",
40
+ label,
41
+ icon,
42
+ CustomSVGIcon,
43
+ fullWidth = false,
44
+ iconPosition = "trailing",
45
+ asLink,
46
+ isLoading = false,
47
+ className,
48
+ ...props
49
+ }: IButtonProps) => {
50
+ const iconStyles = cn(
51
+ { "text-white h-5 w-5": actionType === "primary" || actionType === "danger" },
52
+ { "text-purple-700 h-5 w-5 ": actionType === "secondary" },
53
+ { "text-gray-700 h-5 w-5": actionType === "alternative" }
54
+ )
55
+ const loaderColors = cn(
56
+ { "border-r-white": actionType === "primary" },
57
+ { "border-purple-200 border-r-purple-700": actionType === "secondary" },
58
+ { "border-gray-200 border-r-gray-700": actionType === "alternative" },
59
+ { "border-red-800 border-r-white": actionType === "danger" }
60
+ )
61
+ const loaderSize = cn({ "h-4 w-4": size === "sm" }, { "h-5 w-5": size === "md" }, { "h-6 w-6 ": size === "lg" })
62
+
63
+ return (
64
+ <button
65
+ type="button"
66
+ className={cn(
67
+ "inline-flex items-center justify-center gap-x-2 font-medium p-2 rounded-[3px] !ring-offset-white outline-none focus-visible:ring-2 focus-visible:ring-purple-600 focus-visible:ring-offset-2 focus-within:ring-2 focus-within:ring-purple-600 focus-within:ring-offset-2 focus:ring-2 focus:ring-purple-600 focus:ring-offset-2 active:ring-2 active:ring-purple-600 active:ring-offset-2 transition-all",
68
+ { "w-full": fullWidth },
69
+ { "px-[11px] py-[7px] text-xs": size === "xs" },
70
+ { "px-[13px] py-[9px] text-sm": size === "sm" },
71
+ { "px-[17px] py-[9px] text-sm": size === "md" },
72
+ { "px-[17px] py-[9px] text-base": size === "lg" },
73
+ { "px-[25px] py-[13px] text-base": size === "xl" },
74
+ {
75
+ "bg-purple-600 text-white hover:border-purple-700 hover:bg-purple-700 ": actionType === "primary"
76
+ },
77
+ {
78
+ " bg-purple-50 text-purple-700 hover:bg-purple-200 focus-within:bg-purple-100 focus-visible:bg-purple-100 focus:bg-purple-100 active:bg-purple-100":
79
+ actionType === "secondary"
80
+ },
81
+ {
82
+ "border-gray-300 bg-white border text-gray-700 hover:bg-gray-50 focus-visible:!border-gray-300 focus-within:!border-gray-300 focus:!border-gray-300 active:!border-gray-300":
83
+ actionType === "alternative"
84
+ },
85
+ {
86
+ " bg-red-600 text-white hover:bg-red-700 <focus-visible:!></focus-visible:!>ring-red-500 focus:!ring-red-500 active:!ring-red-500 focus-within:!ring-red-500 ":
87
+ actionType === "danger"
88
+ },
89
+ className ? className : ""
90
+ )}
91
+ {...props}
92
+ >
93
+ {CustomSVGIcon &&
94
+ (isLoading ? (
95
+ <div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
96
+ ) : (
97
+ <i>{CustomSVGIcon}</i>
98
+ ))}
99
+
100
+ {icon &&
101
+ iconPosition === "leading" &&
102
+ (isLoading ? (
103
+ <div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
104
+ ) : (
105
+ <DynamicIcon {...{ ...icon, className: iconStyles }} />
106
+ ))}
107
+
108
+ {!icon && !CustomSVGIcon && isLoading && (
109
+ <div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
110
+ )}
111
+ {label}
112
+ {icon &&
113
+ iconPosition === "trailing" &&
114
+ (isLoading ? (
115
+ <div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
116
+ ) : (
117
+ <DynamicIcon {...{ ...icon, className: iconStyles }} />
118
+ ))}
119
+ </button>
120
+ )
121
+ }
122
+
123
+ export default Button
@@ -0,0 +1,71 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import Button from "../Button"
3
+ import { defaultIcon } from "../defaultArgs"
4
+
5
+ // More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
6
+ const meta: Meta<typeof Button> = {
7
+ title: "Design System/atoms/Buttons/Button/Danger",
8
+ component: Button,
9
+ tags: ["autodocs"],
10
+ argTypes: {}
11
+ }
12
+
13
+ export default meta
14
+ type Story = StoryObj<typeof Button>
15
+ // #region Danger Button Stories
16
+ export const Danger: Story = {
17
+ args: {
18
+ actionType: "danger",
19
+ label: "Danger Zone!",
20
+ onClick: () => {
21
+ window.alert("Button clicked!")
22
+ }
23
+ }
24
+ }
25
+ export const DangerTrailingIcon: Story = {
26
+ args: {
27
+ ...Danger.args,
28
+ icon: {
29
+ ...defaultIcon,
30
+ icon: "TrashIcon"
31
+ },
32
+ iconPosition: "trailing"
33
+ }
34
+ }
35
+ export const DangerLeadingIcon: Story = {
36
+ args: {
37
+ ...DangerTrailingIcon.args,
38
+ iconPosition: "leading"
39
+ }
40
+ }
41
+ export const DangerExtraSmall: Story = {
42
+ args: {
43
+ ...Danger.args,
44
+ size: "sm"
45
+ }
46
+ }
47
+ export const DangerSmall: Story = {
48
+ args: {
49
+ ...Danger.args,
50
+ size: "sm"
51
+ }
52
+ }
53
+ export const DangerMedium: Story = {
54
+ args: {
55
+ ...Danger.args,
56
+ size: "md"
57
+ }
58
+ }
59
+ export const DangerLarge: Story = {
60
+ args: {
61
+ ...Danger.args,
62
+ size: "lg"
63
+ }
64
+ }
65
+ export const DangerExtraLarge: Story = {
66
+ args: {
67
+ ...Danger.args,
68
+ size: "xl"
69
+ }
70
+ }
71
+ // #endregion