@agility/plenum-ui 1.3.50 → 2.0.0-rc10

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 (346) 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 +41 -0
  19. package/dist/index.d.ts +1117 -0
  20. package/dist/index.js +6296 -0
  21. package/dist/index.js.map +7 -0
  22. package/dist/lib/tailwind.css +63535 -0
  23. package/{lib/components → dist/types/stories/atoms}/Avatar/Avatar.d.ts +28 -27
  24. package/dist/types/stories/atoms/Avatar/index.d.ts +3 -0
  25. package/dist/types/stories/atoms/badges/Badge.d.ts +21 -0
  26. package/dist/types/stories/atoms/badges/index.d.ts +3 -0
  27. package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +14 -0
  28. package/dist/types/stories/atoms/buttons/Button/Button.d.ts +35 -0
  29. package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +14 -0
  30. package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +14 -0
  31. package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +14 -0
  32. package/dist/types/stories/atoms/buttons/Button/defaultArgs.d.ts +3 -0
  33. package/dist/types/stories/atoms/buttons/Button/index.d.ts +3 -0
  34. package/dist/types/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.d.ts +6 -0
  35. package/dist/types/stories/atoms/buttons/Capsule/Capsule.d.ts +27 -0
  36. package/dist/types/stories/atoms/buttons/Capsule/Danger/Danger.stories.d.ts +6 -0
  37. package/dist/types/stories/atoms/buttons/Capsule/Primary/Primary.stories.d.ts +6 -0
  38. package/dist/types/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.d.ts +6 -0
  39. package/dist/types/stories/atoms/buttons/Capsule/index.d.ts +3 -0
  40. package/dist/types/stories/atoms/buttons/index.d.ts +4 -0
  41. package/{lib/components/DynamicIcons/DynamicIcons.d.ts → dist/types/stories/atoms/icons/DynamicIcon.d.ts} +20 -18
  42. package/dist/types/stories/atoms/icons/DynamicIcon.stories.d.ts +10 -0
  43. package/dist/types/stories/atoms/icons/IconWithShadow.d.ts +6 -0
  44. package/dist/types/stories/atoms/icons/IconWithShadow.stories.d.ts +10 -0
  45. package/{lib/components/DynamicIcons → dist/types/stories/atoms/icons}/TablerIcon.d.ts +9 -9
  46. package/dist/types/stories/atoms/icons/index.d.ts +4 -0
  47. package/dist/types/stories/atoms/icons/tablerIconNames.d.ts +2 -0
  48. package/dist/types/stories/atoms/index.d.ts +7 -0
  49. package/dist/types/stories/atoms/loaders/Loader.d.ts +6 -0
  50. package/dist/types/stories/atoms/loaders/Loader.stories.d.ts +6 -0
  51. package/dist/types/stories/atoms/loaders/NProgress/RadialProgress.d.ts +11 -0
  52. package/dist/types/stories/atoms/loaders/NProgress/index.d.ts +3 -0
  53. package/dist/types/stories/atoms/loaders/index.d.ts +4 -0
  54. package/dist/types/stories/index.d.ts +5 -0
  55. package/dist/types/stories/layouts/index.d.ts +0 -0
  56. package/dist/types/stories/molecules/index.d.ts +3 -0
  57. package/{lib/components/Forms → dist/types/stories/molecules/inputs}/InputCounter/InputCounter.d.ts +10 -9
  58. package/dist/types/stories/molecules/inputs/InputCounter/index.d.ts +2 -0
  59. package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +30 -0
  60. package/dist/types/stories/molecules/inputs/InputField/index.d.ts +3 -0
  61. package/{lib/components/Forms → dist/types/stories/molecules/inputs}/InputLabel/InputLabel.d.ts +15 -14
  62. package/dist/types/stories/molecules/inputs/InputLabel/index.d.ts +3 -0
  63. package/dist/types/stories/molecules/inputs/NestedInputButton/NestedInputButton.d.ts +17 -0
  64. package/dist/types/stories/molecules/inputs/NestedInputButton/index.d.ts +3 -0
  65. package/{lib/components/Forms → dist/types/stories/molecules/inputs}/TextInput/TextInput.d.ts +39 -39
  66. package/dist/types/stories/molecules/inputs/TextInput/index.d.ts +4 -0
  67. package/{lib/components/Forms/Checkbox → dist/types/stories/molecules/inputs/checkbox}/Checkbox.d.ts +28 -27
  68. package/dist/types/stories/molecules/inputs/checkbox/Checkbox.stories.d.ts +6 -0
  69. package/dist/types/stories/molecules/inputs/checkbox/index.d.ts +3 -0
  70. package/{lib/components/Combobox/Combobox.d.ts → dist/types/stories/molecules/inputs/combobox/ComboBox.d.ts} +34 -34
  71. package/dist/types/stories/molecules/inputs/combobox/ComboBox.stories.d.ts +6 -0
  72. package/dist/types/stories/molecules/inputs/combobox/index.d.ts +3 -0
  73. package/dist/types/stories/molecules/inputs/index.d.ts +12 -0
  74. package/{lib/components/Forms/Radio → dist/types/stories/molecules/inputs/radio}/Radio.d.ts +27 -27
  75. package/dist/types/stories/molecules/inputs/radio/Radio.stories.d.ts +6 -0
  76. package/dist/types/stories/molecules/inputs/radio/index.d.ts +3 -0
  77. package/{lib/components/Forms/Select → dist/types/stories/molecules/inputs/select}/Select.d.ts +27 -27
  78. package/dist/types/stories/molecules/inputs/select/Select.stories.d.ts +6 -0
  79. package/dist/types/stories/molecules/inputs/select/index.d.ts +3 -0
  80. package/{lib/components/Forms/Textarea/Textarea.d.ts → dist/types/stories/molecules/inputs/textArea/TextArea.d.ts} +35 -32
  81. package/dist/types/stories/molecules/inputs/textArea/TextArea.stories.d.ts +6 -0
  82. package/dist/types/stories/molecules/inputs/textArea/index.d.ts +3 -0
  83. package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +18 -0
  84. package/dist/types/stories/molecules/inputs/toggleSwitch/index.d.ts +3 -0
  85. package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +18 -0
  86. package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +3 -0
  87. package/dist/types/stories/organisms/ButtonDropdown/ButtonDropdown.d.ts +14 -0
  88. package/dist/types/stories/organisms/ButtonDropdown/index.d.ts +3 -0
  89. package/{lib/components/Dropdown/Dropdown.d.ts → dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts} +36 -39
  90. package/dist/types/stories/organisms/DropdownComponent/dropdownItems.d.ts +3 -0
  91. package/dist/types/stories/organisms/DropdownComponent/index.d.ts +4 -0
  92. package/dist/types/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.d.ts +19 -0
  93. package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +3 -0
  94. package/dist/types/stories/organisms/FormInputWithAddons/FormInputWithAddons.d.ts +21 -0
  95. package/dist/types/stories/organisms/FormInputWithAddons/index.d.ts +3 -0
  96. package/{lib/components/Forms/TextInputSelect/InputSelect → dist/types/stories/organisms/TextInputSelect}/InputSelect.d.ts +16 -13
  97. package/{lib/components/Forms → dist/types/stories/organisms}/TextInputSelect/TextInputSelect.d.ts +48 -48
  98. package/dist/types/stories/organisms/TextInputSelect/index.d.ts +3 -0
  99. package/dist/types/stories/organisms/index.d.ts +8 -0
  100. package/dist/types/utils/types.d.ts +2 -0
  101. package/dist/types/utils/useId.d.ts +1 -0
  102. package/next.config.js +8 -0
  103. package/package.json +55 -78
  104. package/pages/api/hello.ts +13 -0
  105. package/postcss.config.js +5 -6
  106. package/public/next.svg +1 -0
  107. package/public/thirteen.svg +1 -0
  108. package/public/vercel.svg +1 -0
  109. package/scripts/create-component.js +97 -0
  110. package/stories/Introduction.mdx +314 -0
  111. package/stories/assets/code-brackets.svg +1 -0
  112. package/stories/assets/colors.svg +1 -0
  113. package/stories/assets/comments.svg +1 -0
  114. package/stories/assets/direction.svg +1 -0
  115. package/stories/assets/flow.svg +1 -0
  116. package/stories/assets/plugin.svg +1 -0
  117. package/stories/assets/repo.svg +1 -0
  118. package/stories/assets/stackalt.svg +1 -0
  119. package/stories/atoms/Avatar/Avatar.stories.tsx +96 -0
  120. package/stories/atoms/Avatar/Avatar.tsx +123 -0
  121. package/stories/atoms/Avatar/index.ts +3 -0
  122. package/stories/atoms/badges/Badge.tsx +127 -0
  123. package/stories/atoms/badges/Pill/Pill.stories.tsx +75 -0
  124. package/stories/atoms/badges/Rounded/Rounded.stories.tsx +75 -0
  125. package/stories/atoms/badges/index.ts +3 -0
  126. package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +76 -0
  127. package/stories/atoms/buttons/Button/Button.tsx +146 -0
  128. package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +78 -0
  129. package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +85 -0
  130. package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +81 -0
  131. package/stories/atoms/buttons/Button/defaultArgs.ts +9 -0
  132. package/stories/atoms/buttons/Button/index.ts +3 -0
  133. package/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.ts +27 -0
  134. package/stories/atoms/buttons/Capsule/Capsule.tsx +87 -0
  135. package/stories/atoms/buttons/Capsule/Danger/Danger.stories.ts +27 -0
  136. package/stories/atoms/buttons/Capsule/Primary/Primary.stories.ts +27 -0
  137. package/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.ts +27 -0
  138. package/stories/atoms/buttons/Capsule/index.ts +3 -0
  139. package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.stories.tsx +15 -0
  140. package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.tsx +22 -0
  141. package/stories/atoms/buttons/FloatingActionButton/index.tsx +3 -0
  142. package/stories/atoms/buttons/index.ts +4 -0
  143. package/stories/atoms/crumb/Crumb.stories.tsx +18 -0
  144. package/stories/atoms/crumb/Crumb.tsx +22 -0
  145. package/stories/atoms/crumb/index.tsx +3 -0
  146. package/stories/atoms/icons/DynamicIcon.stories.ts +43 -0
  147. package/stories/atoms/icons/DynamicIcon.tsx +90 -0
  148. package/stories/atoms/icons/IconWithShadow.stories.ts +43 -0
  149. package/stories/atoms/icons/IconWithShadow.tsx +16 -0
  150. package/stories/atoms/icons/TablerIcon.tsx +22 -0
  151. package/stories/atoms/icons/index.tsx +14 -0
  152. package/stories/atoms/icons/tablerIconNames.ts +4336 -0
  153. package/stories/atoms/index.ts +46 -0
  154. package/stories/atoms/loaders/Loader.stories.ts +15 -0
  155. package/stories/atoms/loaders/Loader.tsx +15 -0
  156. package/stories/atoms/loaders/NProgress/RadialProgress.stories.tsx +19 -0
  157. package/stories/atoms/loaders/NProgress/RadialProgress.tsx +76 -0
  158. package/stories/atoms/loaders/NProgress/index.ts +3 -0
  159. package/stories/atoms/loaders/index.ts +4 -0
  160. package/stories/index.ts +134 -0
  161. package/stories/layouts/CardLayout/CardLayout.stories.tsx +18 -0
  162. package/stories/layouts/CardLayout/CardLayout.tsx +22 -0
  163. package/stories/layouts/CardLayout/index.tsx +3 -0
  164. package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +18 -0
  165. package/stories/layouts/ModalLayout/ModalLayout.tsx +22 -0
  166. package/stories/layouts/ModalLayout/index.tsx +3 -0
  167. package/stories/layouts/index.ts +0 -0
  168. package/stories/molecules/index.ts +51 -0
  169. package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -0
  170. package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -0
  171. package/stories/molecules/inputs/InputCounter/index.tsx +3 -0
  172. package/stories/molecules/inputs/InputField/InputField.stories.tsx +29 -0
  173. package/stories/molecules/inputs/InputField/InputField.tsx +94 -0
  174. package/stories/molecules/inputs/InputField/index.tsx +3 -0
  175. package/stories/molecules/inputs/InputLabel/InputLabel.stories.tsx +19 -0
  176. package/stories/molecules/inputs/InputLabel/InputLabel.tsx +45 -0
  177. package/stories/molecules/inputs/InputLabel/index.tsx +3 -0
  178. package/stories/molecules/inputs/NestedInputButton/NestedInputButton.stories.tsx +52 -0
  179. package/stories/molecules/inputs/NestedInputButton/NestedInputButton.tsx +64 -0
  180. package/stories/molecules/inputs/NestedInputButton/index.tsx +3 -0
  181. package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -0
  182. package/stories/molecules/inputs/TextInput/TextInput.tsx +162 -0
  183. package/stories/molecules/inputs/TextInput/index.tsx +5 -0
  184. package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +23 -0
  185. package/stories/molecules/inputs/checkbox/Checkbox.tsx +99 -0
  186. package/stories/molecules/inputs/checkbox/index.ts +3 -0
  187. package/stories/molecules/inputs/combobox/ComboBox.stories.ts +41 -0
  188. package/stories/molecules/inputs/combobox/ComboBox.tsx +194 -0
  189. package/stories/molecules/inputs/combobox/index.ts +3 -0
  190. package/stories/molecules/inputs/index.ts +38 -0
  191. package/stories/molecules/inputs/radio/Radio.stories.ts +27 -0
  192. package/stories/molecules/inputs/radio/Radio.tsx +92 -0
  193. package/stories/molecules/inputs/radio/index.ts +3 -0
  194. package/stories/molecules/inputs/select/Select.stories.ts +23 -0
  195. package/stories/molecules/inputs/select/Select.tsx +100 -0
  196. package/stories/molecules/inputs/select/index.ts +3 -0
  197. package/stories/molecules/inputs/textArea/TextArea.stories.ts +22 -0
  198. package/stories/molecules/inputs/textArea/TextArea.tsx +128 -0
  199. package/stories/molecules/inputs/textArea/index.ts +3 -0
  200. package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +119 -0
  201. package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +75 -0
  202. package/stories/molecules/inputs/toggleSwitch/index.ts +3 -0
  203. package/stories/molecules/tabs/Tabs.stories.tsx +18 -0
  204. package/stories/molecules/tabs/Tabs.tsx +22 -0
  205. package/stories/molecules/tabs/index.tsx +3 -0
  206. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +21 -0
  207. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +60 -0
  208. package/stories/organisms/AnimatedLabelInput/index.tsx +3 -0
  209. package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +118 -0
  210. package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +81 -0
  211. package/stories/organisms/ButtonDropdown/index.tsx +3 -0
  212. package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +49 -0
  213. package/stories/organisms/DropdownComponent/Dropdown.test.tsx +0 -0
  214. package/stories/organisms/DropdownComponent/DropdownComponent.tsx +300 -0
  215. package/stories/organisms/DropdownComponent/dropdownItems.ts +101 -0
  216. package/stories/organisms/DropdownComponent/index.ts +4 -0
  217. package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +76 -0
  218. package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.tsx +52 -0
  219. package/stories/organisms/EmptySectionPlaceholder/index.tsx +3 -0
  220. package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +29 -0
  221. package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +140 -0
  222. package/stories/organisms/FormInputWithAddons/index.tsx +3 -0
  223. package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -0
  224. package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -0
  225. package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -0
  226. package/stories/organisms/TextInputSelect/index.tsx +3 -0
  227. package/stories/organisms/index.ts +18 -0
  228. package/tailwind.config.js +165 -36
  229. package/tsconfig.json +27 -21
  230. package/tsconfig.lib.json +19 -0
  231. package/utils/types.d.ts +2 -0
  232. package/utils/types.ts +3 -0
  233. package/utils/useId.d.ts +1 -0
  234. package/utils/useId.tsx +16 -0
  235. package/.babelrc +0 -14
  236. package/.editorconfig +0 -9
  237. package/.eslintrc +0 -13
  238. package/.github/workflows/test.yml +0 -27
  239. package/.storybook/main.js +0 -17
  240. package/.storybook/manager.js +0 -6
  241. package/.storybook/plenumTheme.js +0 -8
  242. package/.storybook/preview.js +0 -44
  243. package/_templates/component/new/component.ejs.t +0 -18
  244. package/_templates/component/new/component.stories.ejs.t +0 -21
  245. package/_templates/component/new/component.test.ejs.t +0 -15
  246. package/_templates/component/new/index.ejs.t +0 -6
  247. package/_templates/component/new/prompt.js +0 -7
  248. package/jest.config.js +0 -8
  249. package/lib/common/brandCfg.d.ts +0 -3
  250. package/lib/common/index.d.ts +0 -3
  251. package/lib/common/storyCfg.d.ts +0 -5
  252. package/lib/components/Avatar/Avatar.stories.d.ts +0 -6
  253. package/lib/components/Avatar/Avatar.test.d.ts +0 -1
  254. package/lib/components/Avatar/index.d.ts +0 -1
  255. package/lib/components/Button/Button.d.ts +0 -55
  256. package/lib/components/Button/Button.stories.d.ts +0 -12
  257. package/lib/components/Button/Button.test.d.ts +0 -1
  258. package/lib/components/Button/index.d.ts +0 -1
  259. package/lib/components/ButtonDropdown/ButtonDropdown.d.ts +0 -12
  260. package/lib/components/ButtonDropdown/ButtonDropdown.stories.d.ts +0 -9
  261. package/lib/components/ButtonDropdown/index.d.ts +0 -1
  262. package/lib/components/Combobox/Combobox.stories.d.ts +0 -14
  263. package/lib/components/Combobox/Combobox.test.d.ts +0 -1
  264. package/lib/components/Combobox/index.d.ts +0 -1
  265. package/lib/components/Dropdown/Dropdown.stories.d.ts +0 -8
  266. package/lib/components/Dropdown/Dropdown.test.d.ts +0 -1
  267. package/lib/components/Dropdown/data.d.ts +0 -3
  268. package/lib/components/Dropdown/index.d.ts +0 -1
  269. package/lib/components/DynamicIcons/DynamicIcons.stories.d.ts +0 -9
  270. package/lib/components/DynamicIcons/index.d.ts +0 -3
  271. package/lib/components/DynamicIcons/tablerIconNames.d.ts +0 -2
  272. package/lib/components/Forms/BaseField/BaseField.d.ts +0 -34
  273. package/lib/components/Forms/BaseField/BaseField.stories.d.ts +0 -6
  274. package/lib/components/Forms/BaseField/BaseField.test.d.ts +0 -1
  275. package/lib/components/Forms/BaseField/index.d.ts +0 -1
  276. package/lib/components/Forms/Checkbox/Checkbox.stories.d.ts +0 -14
  277. package/lib/components/Forms/Checkbox/Checkbox.test.d.ts +0 -1
  278. package/lib/components/Forms/Checkbox/index.d.ts +0 -1
  279. package/lib/components/Forms/InputCounter/InputCounter.stories.d.ts +0 -6
  280. package/lib/components/Forms/InputCounter/InputCounter.test.d.ts +0 -1
  281. package/lib/components/Forms/InputCounter/index.d.ts +0 -1
  282. package/lib/components/Forms/InputLabel/InputLabel.stories.d.ts +0 -6
  283. package/lib/components/Forms/InputLabel/InputLabel.test.d.ts +0 -1
  284. package/lib/components/Forms/InputLabel/index.d.ts +0 -1
  285. package/lib/components/Forms/Radio/Radio.stories.d.ts +0 -12
  286. package/lib/components/Forms/Radio/Radio.test.d.ts +0 -1
  287. package/lib/components/Forms/Radio/index.d.ts +0 -1
  288. package/lib/components/Forms/Select/Select.stories.d.ts +0 -11
  289. package/lib/components/Forms/Select/Select.test.d.ts +0 -1
  290. package/lib/components/Forms/Select/index.d.ts +0 -1
  291. package/lib/components/Forms/TextInput/TextInput.stories.d.ts +0 -12
  292. package/lib/components/Forms/TextInput/index.d.ts +0 -1
  293. package/lib/components/Forms/TextInputAddon/InputCta/InputCta.d.ts +0 -16
  294. package/lib/components/Forms/TextInputAddon/InputCta/InputCta.stories.d.ts +0 -6
  295. package/lib/components/Forms/TextInputAddon/InputCta/InputCta.test.d.ts +0 -1
  296. package/lib/components/Forms/TextInputAddon/InputCta/index.d.ts +0 -1
  297. package/lib/components/Forms/TextInputAddon/TextInputAddon.d.ts +0 -54
  298. package/lib/components/Forms/TextInputAddon/TextInputAddon.stories.d.ts +0 -13
  299. package/lib/components/Forms/TextInputAddon/index.d.ts +0 -1
  300. package/lib/components/Forms/TextInputSelect/InputSelect/InputSelect.stories.d.ts +0 -6
  301. package/lib/components/Forms/TextInputSelect/InputSelect/InputSelect.test.d.ts +0 -1
  302. package/lib/components/Forms/TextInputSelect/InputSelect/index.d.ts +0 -1
  303. package/lib/components/Forms/TextInputSelect/TextInputSelect.stories.d.ts +0 -8
  304. package/lib/components/Forms/TextInputSelect/index.d.ts +0 -1
  305. package/lib/components/Forms/Textarea/Textarea.stories.d.ts +0 -12
  306. package/lib/components/Forms/Textarea/Textarea.test.d.ts +0 -1
  307. package/lib/components/Forms/Textarea/index.d.ts +0 -1
  308. package/lib/components/ToggleSwitch/ToggleSwitch.d.ts +0 -28
  309. package/lib/components/ToggleSwitch/ToggleSwitch.stories.d.ts +0 -21
  310. package/lib/components/ToggleSwitch/ToggleSwitch.test.d.ts +0 -1
  311. package/lib/components/ToggleSwitch/index.d.ts +0 -1
  312. package/lib/components/TreeView/TreeView.d.ts +0 -36
  313. package/lib/components/TreeView/TreeView.stories.d.ts +0 -6
  314. package/lib/components/TreeView/TreeView.test.d.ts +0 -1
  315. package/lib/components/TreeView/index.d.ts +0 -1
  316. package/lib/components/TreeView V1/TreeItem/TreeItem.d.ts +0 -16
  317. package/lib/components/TreeView V1/TreeItem/TreeItem.stories.d.ts +0 -9
  318. package/lib/components/TreeView V1/TreeItem/TreeItem.test.d.ts +0 -1
  319. package/lib/components/TreeView V1/TreeItem/index.d.ts +0 -1
  320. package/lib/components/TreeView V1/TreeView.d.ts +0 -6
  321. package/lib/components/TreeView V1/TreeView.stories.d.ts +0 -6
  322. package/lib/components/TreeView V1/TreeView.test.d.ts +0 -1
  323. package/lib/components/TreeView V1/context.d.ts +0 -9
  324. package/lib/components/TreeView V1/index.d.ts +0 -1
  325. package/lib/components/TreeView V1/sampleData.d.ts +0 -71
  326. package/lib/components/TreeView V1/types/tree.types.d.ts +0 -21
  327. package/lib/index.d.ts +0 -13
  328. package/lib/index.esm.js +0 -105883
  329. package/lib/index.esm.js.map +0 -1
  330. package/lib/index.js +0 -105922
  331. package/lib/index.js.map +0 -1
  332. package/lib/page/TreeNavigation/CustomNode/CustomNode.d.ts +0 -3
  333. package/lib/page/TreeNavigation/CustomNode/CustomNode.test.d.ts +0 -1
  334. package/lib/page/TreeNavigation/CustomNode/index.d.ts +0 -1
  335. package/lib/page/TreeNavigation/TreeNavigation.d.ts +0 -8
  336. package/lib/page/TreeNavigation/TreeNavigation.stories.d.ts +0 -6
  337. package/lib/page/TreeNavigation/hooks/useFetch.d.ts +0 -14
  338. package/lib/page/TreeNavigation/index.d.ts +0 -1
  339. package/lib/tailwind.css +0 -2023
  340. package/lib/util/DynamicIcons.d.ts +0 -10
  341. package/lib/util/Loader.d.ts +0 -5
  342. package/lib/util/types.d.ts +0 -2
  343. package/lib/util/useID.d.ts +0 -1
  344. package/rollup.config.js +0 -37
  345. package/setupTests.js +0 -6
  346. package/styleMock.js +0 -2
@@ -0,0 +1,300 @@
1
+ import React, { Fragment, HTMLAttributes, useState } from "react"
2
+ import { Transition } from "@headlessui/react"
3
+ import { default as cn } from "classnames"
4
+ import {
5
+ useFloating,
6
+ autoUpdate,
7
+ offset,
8
+ useDismiss,
9
+ useRole,
10
+ useClick,
11
+ useInteractions,
12
+ FloatingFocusManager,
13
+ autoPlacement,
14
+ shift,
15
+ FloatingPortal,
16
+ useTransitionStyles,
17
+ Placement
18
+ } from "@floating-ui/react"
19
+
20
+ import { ClassNameWithAutocomplete } from "utils/types"
21
+ import { DynamicIcon, IDynamicIconProps, UnifiedIconName } from "@/stories/atoms/icons"
22
+
23
+ export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
24
+ icon?: IDynamicIconProps | UnifiedIconName
25
+ iconPosition?: "trailing" | "leading"
26
+ label: string
27
+ onClick?(): void
28
+ isEmphasized?: boolean
29
+ key: React.Key
30
+ }
31
+ export interface IDropdownClassnames {
32
+ groupClassname?: ClassNameWithAutocomplete
33
+ itemsClassname?: ClassNameWithAutocomplete
34
+ itemClassname?: ClassNameWithAutocomplete
35
+ activeItemClassname?: ClassNameWithAutocomplete
36
+ buttonClassname?: ClassNameWithAutocomplete
37
+ }
38
+ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
39
+ items: IItemProp[][]
40
+ label: string
41
+ CustomDropdownTrigger?: React.ReactNode
42
+ id: string
43
+ classNames?: IDropdownClassnames
44
+ placement?: Placement
45
+ offsetOptions?: Partial<{
46
+ mainAxis: number
47
+ crossAxis: number
48
+ alignmentAxis: number | null
49
+ }>
50
+ }
51
+ export const defaultClassNames: IDropdownClassnames = {
52
+ groupClassname: "flex inline-block text-left",
53
+ itemsClassname:
54
+ "mt-2 origin-bottom-right rounded bg-white shadow-lg z-20 divide-y divide-gray-100 border border-gray-300 ",
55
+ itemClassname:
56
+ "group flex font-muli cursor-pointer items-center px-4 py-2 text-sm transition-all hover:bg-gray-100 hover:text-gray-900 justify-between gap-4 ",
57
+ activeItemClassname: "block px-4 py-2 text-sm text-gray-700 bg-gray-100 hover:bg-gray-200 hover:text-gray-900",
58
+ buttonClassname:
59
+ "py-[2px] z-20 flex items-center rounded outline-purple-500 transition-all text-gray-400 hover:text-gray-600 "
60
+ }
61
+
62
+ /** Comment */
63
+ const Dropdown: React.FC<IDropdownProps> = ({
64
+ items,
65
+ id,
66
+ label,
67
+ classNames = defaultClassNames,
68
+ CustomDropdownTrigger,
69
+ placement = "bottom-start",
70
+ offsetOptions,
71
+ ...props
72
+ }: IDropdownProps): JSX.Element | null => {
73
+ const [isOpen, setIsOpen] = useState(false)
74
+ const [activeItem, setActiveItem] = useState<React.Key | null>(null)
75
+
76
+ // Floating UI logic
77
+ const { refs, floatingStyles, context } = useFloating({
78
+ open: isOpen,
79
+ onOpenChange: setIsOpen,
80
+ placement,
81
+ middleware: [
82
+ offset(offsetOptions ?? 10),
83
+ autoPlacement({
84
+ allowedPlacements: [placement, "bottom-start", "bottom-end", "bottom"]
85
+ }),
86
+ shift({ rootBoundary: "document" })
87
+ ],
88
+ whileElementsMounted: autoUpdate
89
+ })
90
+ const click = useClick(context)
91
+ const dismiss = useDismiss(context)
92
+ const role = useRole(context)
93
+ const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role])
94
+ const { isMounted, styles: transitionStyles } = useTransitionStyles(context, {
95
+ duration: {
96
+ open: 200,
97
+ close: 200
98
+ },
99
+ initial: {
100
+ opacity: 0
101
+ },
102
+ open: {
103
+ opacity: 1
104
+ }
105
+ })
106
+
107
+ const { groupClassname, buttonClassname, itemsClassname, itemClassname, activeItemClassname } = classNames
108
+
109
+ return (
110
+ <div
111
+ {...{
112
+ className: groupClassname,
113
+ role: "combobox",
114
+ "aria-owns": `${id}-list`,
115
+ "aria-expanded": isOpen,
116
+ "aria-haspopup": "listbox",
117
+ ...props
118
+ }}
119
+ >
120
+ <button
121
+ {...{
122
+ ref: refs.setReference,
123
+ className: buttonClassname,
124
+ onClick: () => {
125
+ setIsOpen(!isOpen)
126
+ },
127
+ ...getReferenceProps()
128
+ }}
129
+ >
130
+ {CustomDropdownTrigger ? (
131
+ <span className="">{CustomDropdownTrigger}</span>
132
+ ) : (
133
+ <>
134
+ <span className="pl-1">{label}</span>
135
+ <DynamicIcon icon="ChevronDownIcon" className="ml-1 h-5 w-6 " />
136
+ </>
137
+ )}
138
+ </button>
139
+
140
+ {isMounted && items.length > 0 && isOpen && (
141
+ <FloatingPortal>
142
+ <FloatingFocusManager context={context} modal={true}>
143
+ <Transition
144
+ as={Fragment}
145
+ show={isOpen}
146
+ enter="transition ease-out duration-100"
147
+ enterFrom="transform opacity-0 scale-95"
148
+ enterTo="transform opacity-100 scale-100"
149
+ leave="transition ease-in duration-75"
150
+ leaveFrom="transform opacity-100 scale-100"
151
+ leaveTo="transform opacity-0 scale-95"
152
+ >
153
+ <ul
154
+ {...{
155
+ ...getFloatingProps(),
156
+ className: itemsClassname,
157
+ ref: refs.setFloating,
158
+ // style: floatingStyles,
159
+ "aria-labelledby": label,
160
+ id: `${id}-list`,
161
+ role: "listbox",
162
+ style: {
163
+ position: context.strategy,
164
+ top: Math.round(context.y ?? 0),
165
+ left: Math.round(context.x ?? 0),
166
+ width: "max-content",
167
+ maxWidth: "min(calc(100vw - 10px), 25rem)",
168
+ ...floatingStyles
169
+ }
170
+ }}
171
+ className={itemsClassname}
172
+ ref={refs.setFloating}
173
+ aria-labelledby={label}
174
+ {...getFloatingProps()}
175
+ >
176
+ {items.map((itemStack, idx) => {
177
+ return (
178
+ <React.Fragment key={`${idx}-list-${id}`}>
179
+ {itemStack.map(
180
+ ({
181
+ onClick,
182
+ label,
183
+ key,
184
+ isEmphasized,
185
+ icon,
186
+ iconPosition,
187
+ ...rest
188
+ }) => {
189
+ const active = activeItem && activeItem === key
190
+ const itemClass = cn(
191
+ itemClassname,
192
+ "group flex cursor-pointer items-center px-4 py-2 text-sm transition-all",
193
+ {
194
+ "text-red-500": isEmphasized
195
+ },
196
+ {
197
+ "text-gray-900": !isEmphasized
198
+ },
199
+ {
200
+ "bg-gray-100 text-gray-900": active
201
+ },
202
+ active ? activeItemClassname : "",
203
+ {
204
+ "bg-gray-100 text-red-500 hover:text-red-500":
205
+ active && isEmphasized
206
+ },
207
+ itemClassname
208
+ )
209
+
210
+ return (
211
+ <li key={key}>
212
+ <button
213
+ {...{
214
+ onClick: () => {
215
+ setActiveItem(key)
216
+ onClick && onClick()
217
+ },
218
+ key,
219
+ className: cn(itemClass, "w-full"),
220
+ ...rest
221
+ }}
222
+ >
223
+ <div className="flex items-center gap-x-4">
224
+ {icon &&
225
+ (iconPosition === "leading" ||
226
+ iconPosition === undefined) &&
227
+ (typeof icon === "string" ? (
228
+ <DynamicIcon
229
+ {...{
230
+ icon: icon,
231
+ className: cn(
232
+ {
233
+ "text-red-500": isEmphasized
234
+ },
235
+ "opacity-60 group"
236
+ )
237
+ }}
238
+ />
239
+ ) : (
240
+ <DynamicIcon
241
+ {...{
242
+ ...icon,
243
+ className: cn(
244
+ icon.className,
245
+ {
246
+ "text-red-500": isEmphasized
247
+ },
248
+ "opacity-60 group"
249
+ )
250
+ }}
251
+ />
252
+ ))}
253
+ <div className="whitespace-nowrap">{label}</div>
254
+ {icon &&
255
+ iconPosition === "trailing" &&
256
+ (typeof icon === "string" ? (
257
+ <DynamicIcon
258
+ {...{
259
+ icon: icon,
260
+ className: cn(
261
+ {
262
+ "text-red-500": isEmphasized
263
+ },
264
+ "opacity-60 group"
265
+ )
266
+ }}
267
+ />
268
+ ) : (
269
+ <DynamicIcon
270
+ {...{
271
+ ...icon,
272
+ className: cn(
273
+ icon.className,
274
+ {
275
+ "text-red-500": isEmphasized
276
+ },
277
+ "opacity-60 group"
278
+ )
279
+ }}
280
+ />
281
+ ))}
282
+ </div>
283
+ </button>
284
+ </li>
285
+ )
286
+ }
287
+ )}
288
+ </React.Fragment>
289
+ )
290
+ })}
291
+ </ul>
292
+ </Transition>
293
+ </FloatingFocusManager>
294
+ </FloatingPortal>
295
+ )}
296
+ </div>
297
+ )
298
+ }
299
+
300
+ export default Dropdown
@@ -0,0 +1,101 @@
1
+ import { IItemProp } from "./DropdownComponent"
2
+
3
+ export const dropdownDataBase: IItemProp[][] = [
4
+ [
5
+ {
6
+ key: "Copy",
7
+ label: "Copy",
8
+ onClick: () => {
9
+ console.log("Copy action")
10
+ }
11
+ }
12
+ ],
13
+ [
14
+ {
15
+ key: "Add to Batch",
16
+ label: "Add to Batch",
17
+ onClick: () => {
18
+ console.log("Add to Batch action")
19
+ }
20
+ },
21
+ {
22
+ key: "View Batch",
23
+ label: "View Batch",
24
+ onClick: () => {
25
+ console.log("View Batch action")
26
+ }
27
+ }
28
+ ],
29
+ [
30
+ {
31
+ label: "Delete",
32
+ onClick: () => {
33
+ console.log("Delete action")
34
+ },
35
+ isEmphasized: true,
36
+ key: "Delete"
37
+ }
38
+ ]
39
+ ]
40
+
41
+ export const dropdownDataWithIcons: IItemProp[][] = [
42
+ [
43
+ {
44
+ icon: {
45
+ icon: "IconClipboardCopy",
46
+ className: "h-5 w-5",
47
+ outline: false
48
+ },
49
+ iconPosition: "leading",
50
+ key: "Copy",
51
+ label: "Copy",
52
+ onClick: () => {
53
+ console.log("Copy action")
54
+ }
55
+ }
56
+ ],
57
+ [
58
+ {
59
+ icon: {
60
+ icon: "IconFolderPlus",
61
+ className: "h-5 w-5",
62
+ outline: false
63
+ },
64
+ iconPosition: "leading",
65
+ key: "Add to Batch",
66
+ label: "Add to Batch",
67
+ onClick: () => {
68
+ console.log("Add to Batch action")
69
+ }
70
+ },
71
+ {
72
+ icon: {
73
+ icon: "IconEye",
74
+ className: "h-5 w-5",
75
+ outline: false
76
+ },
77
+ iconPosition: "leading",
78
+ key: "View Batch",
79
+ label: "View Batch",
80
+ onClick: () => {
81
+ console.log("View Batch action")
82
+ }
83
+ }
84
+ ],
85
+ [
86
+ {
87
+ icon: {
88
+ icon: "IconTrash",
89
+ className: "h-5 w-5",
90
+ outline: false
91
+ },
92
+ iconPosition: "leading",
93
+ key: "Delete",
94
+ label: "Delete",
95
+ onClick: () => {
96
+ console.log("Delete action")
97
+ },
98
+ isEmphasized: true
99
+ }
100
+ ]
101
+ ]
@@ -0,0 +1,4 @@
1
+ import Dropdown, { IItemProp, IDropdownClassnames, IDropdownProps, defaultClassNames } from "./DropdownComponent"
2
+ export type { IItemProp, IDropdownClassnames, IDropdownProps }
3
+ export { defaultClassNames }
4
+ export default Dropdown
@@ -0,0 +1,76 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder"
3
+ import { useRef } from "react"
4
+
5
+ const meta: Meta<typeof EmptySectionPlaceholder> = {
6
+ title: "Design System/Organisms/Empty Section Placeholder",
7
+ component: EmptySectionPlaceholder,
8
+ tags: ["autodocs"],
9
+ argTypes: {}
10
+ }
11
+
12
+ export default meta
13
+ type Story = StoryObj<typeof EmptySectionPlaceholder>
14
+
15
+ const MissingAttachmentCTA = () => {
16
+ const fileInputRef = useRef<HTMLInputElement>(null)
17
+ return (
18
+ <div className="mb-2 block text-sm font-medium text-gray-600">
19
+ <input type="file" className="hidden" ref={fileInputRef} />
20
+ <button
21
+ className="hover:underline hover:text-gray-700 transition-all"
22
+ onClick={() => {
23
+ fileInputRef?.current && fileInputRef.current.click()
24
+ }}
25
+ >
26
+ Upload
27
+ </button>{" "}
28
+ <span>OR drag and drop a file</span>
29
+ </div>
30
+ )
31
+ }
32
+
33
+ export const CallsToAction: Story = {
34
+ args: {
35
+ icon: { icon: "IconPaperclip" },
36
+ mutedText: "No File is attached yet",
37
+ CallToActionComponent: <MissingAttachmentCTA />,
38
+ actions: [
39
+ {
40
+ actionType: "alternative",
41
+ icon: {
42
+ icon: "UploadIcon",
43
+ outline: true
44
+ },
45
+ iconPosition: "leading",
46
+ label: "Upload",
47
+ onClick: () => window.alert("Clicked")
48
+ },
49
+ {
50
+ actionType: "alternative",
51
+ icon: {
52
+ icon: "ViewGridIcon",
53
+ outline: true
54
+ },
55
+ size: "lg",
56
+ iconPosition: "leading",
57
+ label: "Browse",
58
+ onClick: () => window.alert("Clicked")
59
+ }
60
+ ],
61
+ isWide: true
62
+ }
63
+ }
64
+ export const NoActions: Story = {
65
+ args: {
66
+ icon: {
67
+ icon: "PencilAltIcon",
68
+ className: "h-5 w-5 text-gray-400 ",
69
+ outline: true
70
+ },
71
+ mutedText: "No Recent Changes",
72
+ primaryMessage: "There haven't been any recent changes\nto the content in this of this instance.",
73
+ actions: [],
74
+ isWide: true
75
+ }
76
+ }
@@ -0,0 +1,52 @@
1
+ import React from "react"
2
+ import Button, { IButtonProps } from "@/stories/atoms/buttons/Button"
3
+ import { IDynamicIconProps } from "@/stories/atoms/icons"
4
+ import IconWithShadow from "@/stories/atoms/icons/IconWithShadow"
5
+ import { default as cn } from "classnames"
6
+
7
+ export interface IEmptySectionPlaceholderProps {
8
+ /** the primary icon to display at top of component */
9
+ icon: IDynamicIconProps
10
+ /** the muted text to display below the icon */
11
+ mutedText?: string
12
+ /** the primary message to display below the muted text */
13
+ primaryMessage: string
14
+ /** the call to action component that if provided will be used instead of primaryMessage */
15
+ CallToActionComponent?: React.ReactNode
16
+ /** the actions to display below the primary call to action or message */
17
+ actions: IButtonProps[]
18
+ /** whether to display the component in a wide or narrow format */
19
+ isWide?: boolean
20
+ }
21
+
22
+ const EmptySectionPlaceholder: React.FC<IEmptySectionPlaceholderProps> = ({
23
+ icon,
24
+ mutedText,
25
+ primaryMessage,
26
+ CallToActionComponent,
27
+ actions,
28
+ isWide
29
+ }) => {
30
+ return (
31
+ <div className="flex h-full w-full flex-col items-center justify-center border-2 border-dashed border-gray-300 p-5">
32
+ <IconWithShadow {...icon} />
33
+ {mutedText && <p className="my-2 block text-xs text-gray-500">{mutedText}</p>}
34
+ {CallToActionComponent ? (
35
+ CallToActionComponent
36
+ ) : (
37
+ <p className="mb-2 block text-sm font-medium text-gray-600">{primaryMessage}</p>
38
+ )}
39
+ {actions.length > 0 ? (
40
+ <div className={cn("mt-2 flex gap-2", isWide ? "" : "flex-col items-center")}>
41
+ {actions.map((action, index) => (
42
+ <Button {...{ ...action }} key={action.label.replaceAll(" ", "-")} />
43
+ ))}
44
+ </div>
45
+ ) : (
46
+ <></>
47
+ )}
48
+ </div>
49
+ )
50
+ }
51
+
52
+ export default EmptySectionPlaceholder
@@ -0,0 +1,3 @@
1
+ import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder"
2
+ export default EmptySectionPlaceholder
3
+ export type { IEmptySectionPlaceholderProps }
@@ -0,0 +1,29 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import FormInputWithAddons, { IFormInputWithAddonsProps } from "./FormInputWithAddons"
3
+
4
+ const meta: Meta<typeof FormInputWithAddons> = {
5
+ title: "Design System/organisms/Form Input With Addons",
6
+ component: FormInputWithAddons,
7
+ tags: ["autodocs"],
8
+ argTypes: {},
9
+ parameters: {
10
+ design: {
11
+ type: "figma",
12
+ url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=85-1269&mode=design"
13
+ }
14
+ }
15
+ }
16
+
17
+ export default meta
18
+ type Story = StoryObj<typeof FormInputWithAddons>
19
+
20
+ export const DefaultFormInputWithAddons: Story = {
21
+ args: {
22
+ id: "appSearch",
23
+ name: "appSearch",
24
+ leadLabel: "Search",
25
+ addonOffset: 60,
26
+ labelClass: "text-gray-900",
27
+ trailIcon: { icon: "SearchIcon" }
28
+ }
29
+ }
@@ -0,0 +1,140 @@
1
+ import { DynamicIcon, IDynamicIconProps } from "@/stories/atoms/icons"
2
+ import React, { useLayoutEffect, useRef, useState } from "react"
3
+ import { default as cn } from "classnames"
4
+ import InputField, { IInputFieldProps, AcceptedInputTypes } from "@/stories/molecules/inputs/InputField"
5
+
6
+ export interface IFormInputWithAddonsProps extends Omit<IInputFieldProps, "type"> {
7
+ leadIcon?: IDynamicIconProps
8
+ leadLabel?: string
9
+ trailIcon?: IDynamicIconProps
10
+ trailLabel?: string
11
+ iconOutlined?: boolean
12
+ /** @param addonOffset An extra buffer zone in pixels between the trailing/leading icon or label and search input -- Default is 24 */
13
+ addonOffset?: number
14
+ topLabel?: string
15
+ labelClass?: string
16
+ containerClassName?: string
17
+ description?: string
18
+ leadIconClassNames?: string
19
+ customIconClass?: string
20
+ type: AcceptedInputTypes
21
+ }
22
+
23
+ const FormInputWithAddons: React.FC<IFormInputWithAddonsProps> = ({
24
+ handleChange,
25
+ value,
26
+ name,
27
+ id,
28
+ placeholder,
29
+ className,
30
+ containerClassName,
31
+ leadIcon,
32
+ leadLabel,
33
+ trailIcon,
34
+ trailLabel,
35
+ topLabel,
36
+ labelClass,
37
+ isDisabled,
38
+ isReadonly,
39
+ isError,
40
+ addonOffset = 24,
41
+ iconOutlined = false,
42
+ description,
43
+ leadIconClassNames,
44
+ customIconClass,
45
+ type,
46
+ ...rest
47
+ }) => {
48
+ // #region logic to determine the width of the lead and or trailing labels in order to offset the input padding by the appropriate amount.
49
+ const leadLabelRef = useRef<HTMLLabelElement>(null)
50
+ const trailLabelRef = useRef<HTMLLabelElement>(null)
51
+ const [leadLabelWidth, setLeadLabelWidth] = useState<number>(0)
52
+ const [trailLabelWidth, setTrailLabelWidth] = useState<number>(0)
53
+ useLayoutEffect(() => {
54
+ setLeadLabelWidth(leadLabelRef.current?.clientWidth || 0)
55
+ setTrailLabelWidth(trailLabelRef.current?.clientWidth || 0)
56
+ }, [])
57
+ // #endregion
58
+
59
+ return (
60
+ <div className={cn("group flex flex-col", containerClassName)}>
61
+ {!leadLabel && !trailLabel && topLabel && (
62
+ <label htmlFor={id} className={cn("flex items-center text-sm font-medium text-gray-600", labelClass)}>
63
+ {topLabel}
64
+ </label>
65
+ )}
66
+ {description && <div className="mb-2 text-sm text-gray-500">{description}</div>}
67
+ <div className="relative flex-grow">
68
+ {(leadLabel || leadIcon) && (
69
+ <label
70
+ ref={leadLabelRef}
71
+ htmlFor={id}
72
+ className={cn(
73
+ "absolute top-0 bottom-0 left-3 flex items-center justify-center text-sm text-gray-500",
74
+ labelClass
75
+ )}
76
+ >
77
+ {leadIcon && (
78
+ <span>
79
+ <DynamicIcon
80
+ {...{
81
+ ...leadIcon,
82
+ className: cn("h-5 w-5 text-gray-400", leadIconClassNames, customIconClass),
83
+ outline: iconOutlined
84
+ }}
85
+ />
86
+ </span>
87
+ )}
88
+ {leadLabel && leadLabel}
89
+ </label>
90
+ )}
91
+ <InputField
92
+ {...{
93
+ ...rest,
94
+ handleChange,
95
+ value,
96
+ id,
97
+ name,
98
+ type,
99
+ autoComplete: "off",
100
+ disabled: isDisabled,
101
+ placeholder: placeholder || "",
102
+ isReadonly,
103
+ isError,
104
+ className,
105
+ // add padding to accomodate inner labels and icons
106
+ style: {
107
+ paddingRight: `${trailLabelWidth + addonOffset}px`,
108
+ paddingLeft: `${leadLabelWidth + addonOffset}px`
109
+ }
110
+ }}
111
+ />
112
+ {(trailLabel || trailIcon) && (
113
+ <label
114
+ ref={trailLabelRef}
115
+ htmlFor={id}
116
+ className={cn(
117
+ "right absolute top-0 bottom-0 right-3 flex items-center justify-center text-sm !text-gray-500 ",
118
+ labelClass
119
+ )}
120
+ >
121
+ {trailIcon && (
122
+ <span>
123
+ <DynamicIcon
124
+ {...{
125
+ ...trailIcon,
126
+ className: cn("h-5 w-5 text-gray-400", customIconClass),
127
+ outline: iconOutlined
128
+ }}
129
+ />
130
+ </span>
131
+ )}
132
+ {trailLabel && trailLabel}
133
+ </label>
134
+ )}
135
+ </div>
136
+ </div>
137
+ )
138
+ }
139
+
140
+ export default FormInputWithAddons