@webiny/admin-ui 6.0.0-alpha.0 → 6.0.0-alpha.1

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 (400) hide show
  1. package/Accordion/Accordion.d.ts +1 -20
  2. package/Accordion/Accordion.js.map +1 -1
  3. package/Accordion/Accordion.mdx +11 -4
  4. package/Accordion/Accordion.stories.d.ts +1 -1
  5. package/Accordion/Accordion.stories.js +15 -9
  6. package/Accordion/Accordion.stories.js.map +1 -1
  7. package/Accordion/components/AccordionContent.js +1 -1
  8. package/Accordion/components/AccordionContent.js.map +1 -1
  9. package/Accordion/components/AccordionItem.d.ts +1 -19
  10. package/Accordion/components/AccordionItem.js +3 -7
  11. package/Accordion/components/AccordionItem.js.map +1 -1
  12. package/Accordion/components/AccordionItemAction.d.ts +1 -1
  13. package/Accordion/components/AccordionItemAction.js.map +1 -1
  14. package/Accordion/components/AccordionItemDragHandle.d.ts +8 -0
  15. package/Accordion/components/AccordionItemDragHandle.js +36 -0
  16. package/Accordion/components/AccordionItemDragHandle.js.map +1 -0
  17. package/Accordion/components/AccordionItemIcon.d.ts +1 -1
  18. package/Accordion/components/AccordionItemIcon.js.map +1 -1
  19. package/Accordion/components/AccordionTrigger.d.ts +2 -2
  20. package/Accordion/components/AccordionTrigger.js +5 -4
  21. package/Accordion/components/AccordionTrigger.js.map +1 -1
  22. package/AutoComplete/AutoComplete.d.ts +2 -2
  23. package/AutoComplete/AutoComplete.js.map +1 -1
  24. package/AutoComplete/domains/AutoCompleteOption.d.ts +1 -1
  25. package/AutoComplete/domains/AutoCompleteOption.js.map +1 -1
  26. package/AutoComplete/domains/AutoCompleteOptionDto.d.ts +1 -1
  27. package/AutoComplete/domains/AutoCompleteOptionDto.js.map +1 -1
  28. package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +3 -6
  29. package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
  30. package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
  31. package/AutoComplete/primitives/AutoCompletePrimitive.stories.d.ts +3 -0
  32. package/AutoComplete/primitives/AutoCompletePrimitive.stories.js +30 -0
  33. package/AutoComplete/primitives/AutoCompletePrimitive.stories.js.map +1 -1
  34. package/AutoComplete/primitives/components/AutoCompleteInputIcons.d.ts +1 -0
  35. package/AutoComplete/primitives/components/AutoCompleteInputIcons.js +3 -2
  36. package/AutoComplete/primitives/components/AutoCompleteInputIcons.js.map +1 -1
  37. package/AutoComplete/primitives/components/AutoCompleteList.d.ts +1 -1
  38. package/AutoComplete/primitives/components/AutoCompleteList.js.map +1 -1
  39. package/AutoComplete/primitives/presenters/AutoCompleteListOptionsPresenter.d.ts +2 -2
  40. package/AutoComplete/primitives/presenters/AutoCompleteListOptionsPresenter.js.map +1 -1
  41. package/AutoComplete/primitives/presenters/AutoCompletePresenter.d.ts +3 -3
  42. package/AutoComplete/primitives/presenters/AutoCompletePresenter.js.map +1 -1
  43. package/AutoComplete/primitives/useAutoComplete.d.ts +1 -1
  44. package/AutoComplete/primitives/useAutoComplete.js.map +1 -1
  45. package/Button/Button.js +2 -2
  46. package/Button/Button.js.map +1 -1
  47. package/Button/CopyButton.d.ts +2 -3
  48. package/Button/CopyButton.js.map +1 -1
  49. package/Button/IconButton.js +2 -2
  50. package/Button/IconButton.js.map +1 -1
  51. package/Card/Card.d.ts +2 -1
  52. package/Card/Card.js.map +1 -1
  53. package/Card/components/CardFooter.d.ts +1 -1
  54. package/Card/components/CardFooter.js.map +1 -1
  55. package/Card/components/CardHeader.d.ts +1 -1
  56. package/Card/components/CardHeader.js.map +1 -1
  57. package/Card/components/CardRoot.d.ts +1 -1
  58. package/Card/components/CardRoot.js.map +1 -1
  59. package/Checkbox/Checkbox.d.ts +2 -2
  60. package/Checkbox/Checkbox.js.map +1 -1
  61. package/Checkbox/domains/CheckboxItem.d.ts +1 -1
  62. package/Checkbox/domains/CheckboxItem.js.map +1 -1
  63. package/Checkbox/domains/CheckboxItemDto.d.ts +1 -1
  64. package/Checkbox/domains/CheckboxItemDto.js.map +1 -1
  65. package/Checkbox/domains/CheckboxItemFormatted.d.ts +1 -1
  66. package/Checkbox/domains/CheckboxItemFormatted.js.map +1 -1
  67. package/Checkbox/domains/CheckboxItemMapper.d.ts +2 -2
  68. package/Checkbox/domains/CheckboxItemMapper.js.map +1 -1
  69. package/Checkbox/primitives/CheckboxPrimitive.d.ts +6 -0
  70. package/Checkbox/primitives/presenters/CheckboxPresenter.d.ts +1 -1
  71. package/Checkbox/primitives/presenters/CheckboxPresenter.js.map +1 -1
  72. package/Checkbox/primitives/useCheckbox.d.ts +1 -1
  73. package/Checkbox/primitives/useCheckbox.js.map +1 -1
  74. package/CheckboxGroup/CheckboxGroup.d.ts +2 -2
  75. package/CheckboxGroup/CheckboxGroup.js.map +1 -1
  76. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +1 -1
  77. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js.map +1 -1
  78. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.d.ts +1 -1
  79. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js.map +1 -1
  80. package/CheckboxGroup/primitives/useCheckboxGroup.d.ts +1 -1
  81. package/CheckboxGroup/primitives/useCheckboxGroup.js.map +1 -1
  82. package/CodeEditor/CodeEditor.d.ts +2 -2
  83. package/CodeEditor/CodeEditor.js.map +1 -1
  84. package/CodeEditor/CodeEditorPrimitive.d.ts +1 -3
  85. package/CodeEditor/CodeEditorPrimitive.js +1 -2
  86. package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
  87. package/ColorPicker/ColorPicker.d.ts +2 -2
  88. package/ColorPicker/ColorPicker.js.map +1 -1
  89. package/ColorPicker/primitives/presenters/ColorPickerPresenter.d.ts +1 -1
  90. package/ColorPicker/primitives/presenters/ColorPickerPresenter.js.map +1 -1
  91. package/ColorPicker/primitives/presenters/ColorPickerPresenter.test.js.map +1 -1
  92. package/ColorPicker/primitives/useColorPicker.d.ts +1 -1
  93. package/ColorPicker/primitives/useColorPicker.js.map +1 -1
  94. package/Command/components/Input.d.ts +1 -1
  95. package/Command/components/Input.js.map +1 -1
  96. package/Command/domain/CommandOption.d.ts +1 -1
  97. package/Command/domain/CommandOption.js.map +1 -1
  98. package/Command/domain/CommandOptionFormatter.d.ts +2 -2
  99. package/Command/domain/CommandOptionFormatter.js.map +1 -1
  100. package/DataList/DataList.d.ts +1 -1
  101. package/DataList/DataList.js.map +1 -1
  102. package/DataList/DataListIcons.d.ts +1 -1
  103. package/DataList/DataListIcons.js.map +1 -1
  104. package/DataList/DataListWithSections.d.ts +1 -1
  105. package/DataList/DataListWithSections.js.map +1 -1
  106. package/DataList/components/Filters.d.ts +1 -1
  107. package/DataList/components/Filters.js.map +1 -1
  108. package/DataList/components/Loader.d.ts +1 -1
  109. package/DataList/components/Loader.js.map +1 -1
  110. package/DataList/components/MultiSelectActions.d.ts +1 -1
  111. package/DataList/components/MultiSelectActions.js.map +1 -1
  112. package/DataList/components/MultiSelectAll.d.ts +1 -1
  113. package/DataList/components/MultiSelectAll.js.map +1 -1
  114. package/DataList/components/Pagination.d.ts +1 -1
  115. package/DataList/components/Pagination.js.map +1 -1
  116. package/DataList/components/RefreshButton.d.ts +1 -1
  117. package/DataList/components/RefreshButton.js.map +1 -1
  118. package/DataList/components/Sorters.d.ts +1 -1
  119. package/DataList/components/Sorters.js.map +1 -1
  120. package/DataTable/DataTable.d.ts +1 -1
  121. package/DataTable/DataTable.js.map +1 -1
  122. package/DataTable/DataTable.stories.d.ts +2 -1
  123. package/DataTable/DataTable.stories.js.map +1 -1
  124. package/DataTable/components/ColumnsVisibility.d.ts +1 -1
  125. package/DataTable/components/ColumnsVisibility.js.map +1 -1
  126. package/Dialog/components/CancelButton.d.ts +1 -1
  127. package/Dialog/components/CancelButton.js.map +1 -1
  128. package/Dialog/components/ConfirmButton.d.ts +1 -1
  129. package/Dialog/components/ConfirmButton.js.map +1 -1
  130. package/Dialog/components/Icon.d.ts +1 -1
  131. package/Dialog/components/Icon.js.map +1 -1
  132. package/Drawer/components/CancelButton.d.ts +1 -1
  133. package/Drawer/components/CancelButton.js.map +1 -1
  134. package/Drawer/components/ConfirmButton.d.ts +1 -1
  135. package/Drawer/components/ConfirmButton.js.map +1 -1
  136. package/Drawer/components/Icon.d.ts +1 -1
  137. package/Drawer/components/Icon.js.map +1 -1
  138. package/DropdownMenu/components/DropdownMenuItem.d.ts +1 -1
  139. package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
  140. package/FilePicker/FilePicker.js +9 -13
  141. package/FilePicker/FilePicker.js.map +1 -1
  142. package/FilePicker/domains/FileItemFormatter.d.ts +1 -1
  143. package/FilePicker/domains/FileItemFormatter.js.map +1 -1
  144. package/FilePicker/primitives/FilePickerPrimitive.d.ts +12 -8
  145. package/FilePicker/primitives/FilePickerPrimitive.js +15 -5
  146. package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
  147. package/FilePicker/primitives/components/Description.d.ts +8 -0
  148. package/FilePicker/primitives/components/Description.js +19 -0
  149. package/FilePicker/primitives/components/Description.js.map +1 -0
  150. package/FilePicker/primitives/components/Label.d.ts +3 -3
  151. package/FilePicker/primitives/components/Label.js +8 -9
  152. package/FilePicker/primitives/components/Label.js.map +1 -1
  153. package/FilePicker/primitives/components/Trigger.js +22 -16
  154. package/FilePicker/primitives/components/Trigger.js.map +1 -1
  155. package/FilePicker/primitives/components/index.d.ts +1 -0
  156. package/FilePicker/primitives/components/index.js +1 -0
  157. package/FilePicker/primitives/components/index.js.map +1 -1
  158. package/FilePicker/primitives/components/previews/FilePreview.d.ts +2 -2
  159. package/FilePicker/primitives/components/previews/FilePreview.js.map +1 -1
  160. package/FilePicker/primitives/components/types.d.ts +2 -2
  161. package/FilePicker/primitives/components/types.js.map +1 -1
  162. package/FormComponent/FormComponent.d.ts +2 -2
  163. package/FormComponent/FormComponent.js.map +1 -1
  164. package/FormComponent/Label.js.map +1 -1
  165. package/IconPicker/IconPicker.d.ts +2 -2
  166. package/IconPicker/IconPicker.js.map +1 -1
  167. package/IconPicker/domains/IconPickerFontAwesome.d.ts +1 -1
  168. package/IconPicker/domains/IconPickerFontAwesome.js.map +1 -1
  169. package/IconPicker/domains/IconPickerIcon.d.ts +1 -1
  170. package/IconPicker/domains/IconPickerIcon.js.map +1 -1
  171. package/IconPicker/domains/IconPickerIconFormatter.d.ts +2 -2
  172. package/IconPicker/domains/IconPickerIconFormatter.js.map +1 -1
  173. package/IconPicker/primitives/IconPickerPrimitive.d.ts +2 -2
  174. package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
  175. package/IconPicker/primitives/components/IconPickerGrid.d.ts +1 -1
  176. package/IconPicker/primitives/components/IconPickerGrid.js.map +1 -1
  177. package/IconPicker/primitives/components/IconPickerIcon.d.ts +1 -1
  178. package/IconPicker/primitives/components/IconPickerIcon.js.map +1 -1
  179. package/IconPicker/primitives/components/IconPickerInput.js.map +1 -1
  180. package/IconPicker/primitives/presenters/IconPickerPresenter.d.ts +1 -1
  181. package/IconPicker/primitives/presenters/IconPickerPresenter.js.map +1 -1
  182. package/IconPicker/primitives/useIconPicker.d.ts +1 -1
  183. package/IconPicker/primitives/useIconPicker.js.map +1 -1
  184. package/Input/InputPrimitive.d.ts +5 -14
  185. package/Input/InputPrimitive.js +15 -124
  186. package/Input/InputPrimitive.js.map +1 -1
  187. package/Input/InputPrimitive.stories.js +19 -4
  188. package/Input/InputPrimitive.stories.js.map +1 -1
  189. package/List/components/ListItemAction.d.ts +1 -1
  190. package/List/components/ListItemAction.js.map +1 -1
  191. package/List/components/ListItemHandle.d.ts +1 -1
  192. package/List/components/ListItemHandle.js.map +1 -1
  193. package/List/components/ListItemIcon.d.ts +1 -1
  194. package/List/components/ListItemIcon.js.map +1 -1
  195. package/Loader/OverlayLoader.d.ts +1 -1
  196. package/Loader/OverlayLoader.js.map +1 -1
  197. package/MultiAutoComplete/MultiAutoComplete.d.ts +2 -2
  198. package/MultiAutoComplete/MultiAutoComplete.js.map +1 -1
  199. package/MultiAutoComplete/domains/MultiAutoCompleteOption.d.ts +1 -1
  200. package/MultiAutoComplete/domains/MultiAutoCompleteOption.js.map +1 -1
  201. package/MultiAutoComplete/domains/MultiAutoCompleteOptionDto.d.ts +1 -1
  202. package/MultiAutoComplete/domains/MultiAutoCompleteOptionDto.js.map +1 -1
  203. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +3 -3
  204. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
  205. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
  206. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.stories.d.ts +3 -0
  207. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.stories.js +78 -4
  208. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.stories.js.map +1 -1
  209. package/MultiAutoComplete/primitives/components/MultiAutoCompleteInput.d.ts +2 -2
  210. package/MultiAutoComplete/primitives/components/MultiAutoCompleteInput.js +7 -13
  211. package/MultiAutoComplete/primitives/components/MultiAutoCompleteInput.js.map +1 -1
  212. package/MultiAutoComplete/primitives/components/MultiAutoCompleteInputIcons.d.ts +1 -0
  213. package/MultiAutoComplete/primitives/components/MultiAutoCompleteInputIcons.js +3 -2
  214. package/MultiAutoComplete/primitives/components/MultiAutoCompleteInputIcons.js.map +1 -1
  215. package/MultiAutoComplete/primitives/components/MultiAutoCompleteList.d.ts +1 -1
  216. package/MultiAutoComplete/primitives/components/MultiAutoCompleteList.js.map +1 -1
  217. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteListOptionsPresenter.d.ts +2 -2
  218. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteListOptionsPresenter.js.map +1 -1
  219. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteListOptionsPresenterWithUniqueValues.d.ts +2 -2
  220. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteListOptionsPresenterWithUniqueValues.js.map +1 -1
  221. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.d.ts +5 -5
  222. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.js +4 -1
  223. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.js.map +1 -1
  224. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
  225. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenterWithFreeInput.d.ts +2 -2
  226. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenterWithFreeInput.js.map +1 -1
  227. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenterWithFreeInput.test.js.map +1 -1
  228. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteSelectedOptionsPresenter.d.ts +2 -2
  229. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteSelectedOptionsPresenter.js +4 -1
  230. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteSelectedOptionsPresenter.js.map +1 -1
  231. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteTemporaryOptionPresenter.d.ts +1 -1
  232. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteTemporaryOptionPresenter.js.map +1 -1
  233. package/MultiAutoComplete/primitives/useMultiAutoComplete.d.ts +1 -1
  234. package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
  235. package/MultiFilePicker/MultiFilePicker.js +8 -12
  236. package/MultiFilePicker/MultiFilePicker.js.map +1 -1
  237. package/MultiFilePicker/primitives/MultiFilePickerPrimitive.d.ts +18 -10
  238. package/MultiFilePicker/primitives/MultiFilePickerPrimitive.js +16 -6
  239. package/MultiFilePicker/primitives/MultiFilePickerPrimitive.js.map +1 -1
  240. package/RadioGroup/RadioGroup.d.ts +2 -2
  241. package/RadioGroup/RadioGroup.js.map +1 -1
  242. package/RadioGroup/domains/RadioItem.d.ts +1 -1
  243. package/RadioGroup/domains/RadioItem.js.map +1 -1
  244. package/RadioGroup/domains/RadioItemFormatted.d.ts +1 -1
  245. package/RadioGroup/domains/RadioItemFormatted.js.map +1 -1
  246. package/RadioGroup/domains/RadioItemFormatter.d.ts +2 -2
  247. package/RadioGroup/domains/RadioItemFormatter.js.map +1 -1
  248. package/RadioGroup/domains/RadioItemParams.d.ts +1 -1
  249. package/RadioGroup/domains/RadioItemParams.js.map +1 -1
  250. package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +1 -1
  251. package/RadioGroup/primitives/RadioGroupPrimitive.js +1 -1
  252. package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
  253. package/RadioGroup/primitives/presenters/RadioGroupPresenter.d.ts +2 -2
  254. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js.map +1 -1
  255. package/RadioGroup/primitives/useRadioGroup.d.ts +1 -1
  256. package/RadioGroup/primitives/useRadioGroup.js.map +1 -1
  257. package/RangeSlider/RangeSlider.d.ts +2 -2
  258. package/RangeSlider/RangeSlider.js.map +1 -1
  259. package/RangeSlider/primitives/RangeSliderPrimitive.d.ts +1 -1
  260. package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
  261. package/RangeSlider/primitives/presenters/RangeSliderPresenter.d.ts +1 -1
  262. package/RangeSlider/primitives/presenters/RangeSliderPresenter.js.map +1 -1
  263. package/RangeSlider/primitives/useRangeSlider.d.ts +1 -1
  264. package/RangeSlider/primitives/useRangeSlider.js.map +1 -1
  265. package/RichTextEditor/RichTextEditor.d.ts +2 -2
  266. package/RichTextEditor/RichTextEditor.js.map +1 -1
  267. package/RichTextEditor/RichTextEditorPrimitive.d.ts +1 -1
  268. package/RichTextEditor/RichTextEditorPrimitive.js.map +1 -1
  269. package/RichTextEditor/createPropsFromConfig.d.ts +1 -1
  270. package/RichTextEditor/createPropsFromConfig.js.map +1 -1
  271. package/Select/Select.d.ts +2 -2
  272. package/Select/Select.js.map +1 -1
  273. package/Select/domains/SelectOption.d.ts +1 -1
  274. package/Select/domains/SelectOption.js.map +1 -1
  275. package/Select/domains/SelectOptionMapper.d.ts +2 -2
  276. package/Select/domains/SelectOptionMapper.js.map +1 -1
  277. package/Select/primitives/SelectPrimitive.d.ts +2 -2
  278. package/Select/primitives/SelectPrimitive.js +4 -3
  279. package/Select/primitives/SelectPrimitive.js.map +1 -1
  280. package/Select/primitives/SelectPrimitive.stories.d.ts +3 -0
  281. package/Select/primitives/SelectPrimitive.stories.js +28 -0
  282. package/Select/primitives/SelectPrimitive.stories.js.map +1 -1
  283. package/Select/primitives/components/SelectTrigger.d.ts +1 -1
  284. package/Select/primitives/components/SelectTrigger.js +6 -1
  285. package/Select/primitives/components/SelectTrigger.js.map +1 -1
  286. package/Select/primitives/presenters/SelectPresenter.d.ts +2 -1
  287. package/Select/primitives/presenters/SelectPresenter.js.map +1 -1
  288. package/Select/primitives/useSelect.d.ts +1 -1
  289. package/Select/primitives/useSelect.js.map +1 -1
  290. package/Sidebar/components/SidebarRoot.js +1 -4
  291. package/Sidebar/components/SidebarRoot.js.map +1 -1
  292. package/Sidebar/components/items/SidebarMenuItem.d.ts +1 -1
  293. package/Sidebar/components/items/SidebarMenuItem.js.map +1 -1
  294. package/Slider/Slider.d.ts +2 -2
  295. package/Slider/Slider.js.map +1 -1
  296. package/Slider/primitives/SliderPrimitive.d.ts +1 -1
  297. package/Slider/primitives/SliderPrimitive.js.map +1 -1
  298. package/Slider/primitives/components/SliderThumb.d.ts +1 -1
  299. package/Slider/primitives/components/SliderThumb.js.map +1 -1
  300. package/Slider/primitives/presenters/SliderPresenter.d.ts +1 -1
  301. package/Slider/primitives/presenters/SliderPresenter.js.map +1 -1
  302. package/Slider/primitives/useSlider.d.ts +1 -1
  303. package/Slider/primitives/useSlider.js.map +1 -1
  304. package/Switch/Switch.d.ts +2 -2
  305. package/Switch/Switch.js.map +1 -1
  306. package/Switch/domains/SwitchItem.d.ts +1 -1
  307. package/Switch/domains/SwitchItem.js.map +1 -1
  308. package/Switch/domains/SwitchItemDto.d.ts +1 -1
  309. package/Switch/domains/SwitchItemDto.js.map +1 -1
  310. package/Switch/domains/SwitchItemFormatted.d.ts +1 -1
  311. package/Switch/domains/SwitchItemFormatted.js.map +1 -1
  312. package/Switch/domains/SwitchItemMapper.d.ts +2 -2
  313. package/Switch/domains/SwitchItemMapper.js.map +1 -1
  314. package/Switch/primitives/SwitchPrimitive.d.ts +1 -1
  315. package/Switch/primitives/SwitchPrimitive.js.map +1 -1
  316. package/Switch/primitives/presenters/SwitchPresenter.d.ts +2 -2
  317. package/Switch/primitives/presenters/SwitchPresenter.js.map +1 -1
  318. package/Switch/primitives/useSwitch.d.ts +1 -1
  319. package/Switch/primitives/useSwitch.js.map +1 -1
  320. package/Tabs/Tabs.d.ts +1 -1
  321. package/Tabs/Tabs.js.map +1 -1
  322. package/Tabs/components/Context.d.ts +1 -1
  323. package/Tabs/components/Context.js.map +1 -1
  324. package/Tabs/components/Tab.d.ts +2 -2
  325. package/Tabs/components/Tab.js.map +1 -1
  326. package/Tag/Tag.js.map +1 -1
  327. package/Tags/Tags.d.ts +24 -0
  328. package/Tags/Tags.js +59 -0
  329. package/Tags/Tags.js.map +1 -0
  330. package/Tags/Tags.stories.d.ts +13 -0
  331. package/Tags/Tags.stories.js +92 -0
  332. package/Tags/Tags.stories.js.map +1 -0
  333. package/Tags/domain/TagItem.d.ts +18 -0
  334. package/Tags/domain/TagItem.js +26 -0
  335. package/Tags/domain/TagItem.js.map +1 -0
  336. package/Tags/domain/TagItemDto.d.ts +5 -0
  337. package/Tags/domain/TagItemDto.js +3 -0
  338. package/Tags/domain/TagItemDto.js.map +1 -0
  339. package/Tags/domain/TagItemFormatted.d.ts +5 -0
  340. package/Tags/domain/TagItemFormatted.js +3 -0
  341. package/Tags/domain/TagItemFormatted.js.map +1 -0
  342. package/Tags/domain/TagItemMapper.d.ts +5 -0
  343. package/Tags/domain/TagItemMapper.js +11 -0
  344. package/Tags/domain/TagItemMapper.js.map +1 -0
  345. package/Tags/domain/index.d.ts +4 -0
  346. package/Tags/domain/index.js +6 -0
  347. package/Tags/domain/index.js.map +1 -0
  348. package/Tags/index.d.ts +1 -0
  349. package/Tags/index.js +3 -0
  350. package/Tags/index.js.map +1 -0
  351. package/Tags/primitives/TagsPrimitive.d.ts +81 -0
  352. package/Tags/primitives/TagsPrimitive.js +54 -0
  353. package/Tags/primitives/TagsPrimitive.js.map +1 -0
  354. package/Tags/primitives/TagsPrimitive.stories.d.ts +26 -0
  355. package/Tags/primitives/TagsPrimitive.stories.js +185 -0
  356. package/Tags/primitives/TagsPrimitive.stories.js.map +1 -0
  357. package/Tags/primitives/index.d.ts +1 -0
  358. package/Tags/primitives/index.js +3 -0
  359. package/Tags/primitives/index.js.map +1 -0
  360. package/Tags/primitives/presenters/TagsInputPresenter.d.ts +22 -0
  361. package/Tags/primitives/presenters/TagsInputPresenter.js +22 -0
  362. package/Tags/primitives/presenters/TagsInputPresenter.js.map +1 -0
  363. package/Tags/primitives/presenters/TagsPresenter.d.ts +42 -0
  364. package/Tags/primitives/presenters/TagsPresenter.js +68 -0
  365. package/Tags/primitives/presenters/TagsPresenter.js.map +1 -0
  366. package/Tags/primitives/presenters/TagsPresenter.test.d.ts +1 -0
  367. package/Tags/primitives/presenters/TagsPresenter.test.js +220 -0
  368. package/Tags/primitives/presenters/TagsPresenter.test.js.map +1 -0
  369. package/Tags/primitives/presenters/TagsValuesPresenter.d.ts +28 -0
  370. package/Tags/primitives/presenters/TagsValuesPresenter.js +41 -0
  371. package/Tags/primitives/presenters/TagsValuesPresenter.js.map +1 -0
  372. package/Tags/primitives/presenters/index.d.ts +3 -0
  373. package/Tags/primitives/presenters/index.js +5 -0
  374. package/Tags/primitives/presenters/index.js.map +1 -0
  375. package/Tags/primitives/useTags.d.ts +15 -0
  376. package/Tags/primitives/useTags.js +36 -0
  377. package/Tags/primitives/useTags.js.map +1 -0
  378. package/Textarea/Textarea.d.ts +2 -2
  379. package/Textarea/Textarea.js.map +1 -1
  380. package/Toast/Toast.d.ts +1 -1
  381. package/Toast/Toast.js.map +1 -1
  382. package/Toast/useToast.js +8 -2
  383. package/Toast/useToast.js.map +1 -1
  384. package/Tooltip/Tooltip.d.ts +1 -1
  385. package/Tooltip/Tooltip.js.map +1 -1
  386. package/Tree/components/ItemDragHandle.d.ts +2 -1
  387. package/Tree/components/ItemDragHandle.js.map +1 -1
  388. package/Tree/domains/NodeFormatter.d.ts +1 -1
  389. package/Tree/domains/NodeFormatter.js.map +1 -1
  390. package/Tree/useTree.d.ts +1 -1
  391. package/Tree/useTree.js.map +1 -1
  392. package/index.d.ts +1 -0
  393. package/index.js +1 -0
  394. package/index.js.map +1 -1
  395. package/package.json +9 -8
  396. package/utils.d.ts +1 -1
  397. package/utils.js.map +1 -1
  398. package/Accordion/components/AccordionItemHandle.d.ts +0 -26
  399. package/Accordion/components/AccordionItemHandle.js +0 -29
  400. package/Accordion/components/AccordionItemHandle.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import React from "react";
1
+ import type React from "react";
2
2
  import { type VariantProps } from "../../utils";
3
- import { tabListVariants } from "./List";
3
+ import type { tabListVariants } from "./List";
4
4
  interface TabProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "content"> {
5
5
  value: string;
6
6
  trigger: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","useEffect","useRef","makeDecoratable","generateId","TabsContext","DecoratableTab","props","tabsContext","idRef","addTab","id","current","visible","removeTab","Tab"],"sources":["Tab.tsx"],"sourcesContent":["import React, { useContext, useEffect, useRef } from \"react\";\nimport { makeDecoratable, generateId, type VariantProps } from \"~/utils\";\nimport { TabsContext } from \"./Context\";\nimport { tabListVariants } from \"./List\";\n\ninterface TabProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"content\"> {\n value: string;\n trigger: React.ReactNode;\n content: React.ReactNode;\n icon?: React.ReactElement;\n spacing?: VariantProps<typeof tabListVariants>[\"spacing\"];\n disabled?: boolean;\n visible?: boolean;\n \"data-testid\"?: string;\n}\n\ninterface TabItem extends TabProps {\n id: string;\n}\n\nconst DecoratableTab = (props: TabProps) => {\n const tabsContext = useContext(TabsContext);\n const idRef = useRef(generateId());\n\n useEffect(() => {\n tabsContext!.addTab({ ...props, id: idRef.current, visible: props.visible ?? true });\n }, [props]);\n\n useEffect(() => {\n return () => {\n return tabsContext!.removeTab(idRef.current);\n };\n }, []);\n\n return null;\n};\n\nconst Tab = makeDecoratable(\"Tab\", DecoratableTab);\n\nexport { Tab, type TabProps, type TabItem };\n"],"mappings":"AAAA,SAAgBA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC5D,SAASC,eAAe,EAAEC,UAAU;AACpC,SAASC,WAAW;AAkBpB,MAAMC,cAAc,GAAIC,KAAe,IAAK;EACxC,MAAMC,WAAW,GAAGR,UAAU,CAACK,WAAW,CAAC;EAC3C,MAAMI,KAAK,GAAGP,MAAM,CAACE,UAAU,CAAC,CAAC,CAAC;EAElCH,SAAS,CAAC,MAAM;IACZO,WAAW,CAAEE,MAAM,CAAC;MAAE,GAAGH,KAAK;MAAEI,EAAE,EAAEF,KAAK,CAACG,OAAO;MAAEC,OAAO,EAAEN,KAAK,CAACM,OAAO,IAAI;IAAK,CAAC,CAAC;EACxF,CAAC,EAAE,CAACN,KAAK,CAAC,CAAC;EAEXN,SAAS,CAAC,MAAM;IACZ,OAAO,MAAM;MACT,OAAOO,WAAW,CAAEM,SAAS,CAACL,KAAK,CAACG,OAAO,CAAC;IAChD,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAED,MAAMG,GAAG,GAAGZ,eAAe,CAAC,KAAK,EAAEG,cAAc,CAAC;AAElD,SAASS,GAAG","ignoreList":[]}
1
+ {"version":3,"names":["useContext","useEffect","useRef","makeDecoratable","generateId","TabsContext","DecoratableTab","props","tabsContext","idRef","addTab","id","current","visible","removeTab","Tab"],"sources":["Tab.tsx"],"sourcesContent":["import type React from \"react\";\nimport { useContext, useEffect, useRef } from \"react\";\nimport { makeDecoratable, generateId, type VariantProps } from \"~/utils\";\nimport { TabsContext } from \"./Context\";\nimport type { tabListVariants } from \"./List\";\n\ninterface TabProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"content\"> {\n value: string;\n trigger: React.ReactNode;\n content: React.ReactNode;\n icon?: React.ReactElement;\n spacing?: VariantProps<typeof tabListVariants>[\"spacing\"];\n disabled?: boolean;\n visible?: boolean;\n \"data-testid\"?: string;\n}\n\ninterface TabItem extends TabProps {\n id: string;\n}\n\nconst DecoratableTab = (props: TabProps) => {\n const tabsContext = useContext(TabsContext);\n const idRef = useRef(generateId());\n\n useEffect(() => {\n tabsContext!.addTab({ ...props, id: idRef.current, visible: props.visible ?? true });\n }, [props]);\n\n useEffect(() => {\n return () => {\n return tabsContext!.removeTab(idRef.current);\n };\n }, []);\n\n return null;\n};\n\nconst Tab = makeDecoratable(\"Tab\", DecoratableTab);\n\nexport { Tab, type TabProps, type TabItem };\n"],"mappings":"AACA,SAASA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACrD,SAASC,eAAe,EAAEC,UAAU;AACpC,SAASC,WAAW;AAkBpB,MAAMC,cAAc,GAAIC,KAAe,IAAK;EACxC,MAAMC,WAAW,GAAGR,UAAU,CAACK,WAAW,CAAC;EAC3C,MAAMI,KAAK,GAAGP,MAAM,CAACE,UAAU,CAAC,CAAC,CAAC;EAElCH,SAAS,CAAC,MAAM;IACZO,WAAW,CAAEE,MAAM,CAAC;MAAE,GAAGH,KAAK;MAAEI,EAAE,EAAEF,KAAK,CAACG,OAAO;MAAEC,OAAO,EAAEN,KAAK,CAACM,OAAO,IAAI;IAAK,CAAC,CAAC;EACxF,CAAC,EAAE,CAACN,KAAK,CAAC,CAAC;EAEXN,SAAS,CAAC,MAAM;IACZ,OAAO,MAAM;MACT,OAAOO,WAAW,CAAEM,SAAS,CAACL,KAAK,CAACG,OAAO,CAAC;IAChD,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAED,MAAMG,GAAG,GAAGZ,eAAe,CAAC,KAAK,EAAEG,cAAc,CAAC;AAElD,SAASS,GAAG","ignoreList":[]}
package/Tag/Tag.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["React","ReactComponent","Close","cn","cva","makeDecoratable","Icon","IconButton","tagVariants","variants","isInteractive","true","isDismissible","false","isDisabled","variant","accent","success","warning","destructive","defaultVariants","DecoratableTag","className","content","onClick","onDismiss","dismissIconElement","createElement","dismissIconLabel","disabled","props","dismissButtonVariant","useMemo","includes","dismissIconColor","Object","assign","Boolean","icon","label","color","size","event","stopPropagation","Tag"],"sources":["Tag.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as Close } from \"@webiny/icons/close.svg\";\nimport { cn, cva, makeDecoratable, type VariantProps } from \"~/utils\";\nimport { Icon, type IconProps } from \"~/Icon\";\nimport { IconButton, iconButtonVariants } from \"~/Button\";\n\nconst tagVariants = cva(\n [\n \"wby-inline-flex wby-items-center wby-gap-xxs wby-rounded-sm wby-text-sm wby-text-regular wby-transition-colors wby-overflow-hidden\",\n \"focus:outline-none\"\n ],\n {\n variants: {\n isInteractive: {\n true: \"wby-cursor-pointer\"\n },\n isDismissible: {\n true: \"wby-pl-xs-plus wby-pt-xxs wby-pb-xxs wby-pr-xs\",\n false: \"wby-px-xs-plus wby-py-xxs\"\n },\n isDisabled: {\n true: \"wby-cursor-not-allowed wby-pointer-events-none\"\n },\n variant: {\n \"neutral-base\": [\n \"wby-bg-transparent wby-text-neutral-primary\",\n \"hover:wby-bg-neutral-light\",\n \"aria-disabled:wby-bg-transparent aria-disabled:wby-text-neutral-disabled\"\n ],\n \"neutral-base-outline\": [\n \"wby-border-sm wby-border-solid wby-px-[calc(theme(padding.xs-plus)-theme(borderWidth.sm))] wby-py-[calc(theme(padding.xxs)-theme(borderWidth.sm))]\",\n \"wby-bg-transparent wby-border-neutral-muted wby-text-neutral-primary\",\n \"hover:wby-bg-neutral-light\",\n \"aria-disabled:wby-bg-transparent aria-disabled:wby-border-neutral-dimmed aria-disabled:wby-text-neutral-disabled\"\n ],\n \"neutral-light\": [\n \"wby-bg-neutral-light wby-text-neutral-primary\",\n \"hover:wby-bg-neutral-muted\",\n \"aria-disabled:wby-bg-neutral-light aria-disabled:wby-text-neutral-muted\"\n ],\n \"neutral-muted\": [\n \"wby-bg-neutral-muted wby-text-neutral-primary\",\n \"hover:wby-bg-neutral-strong\",\n \"aria-disabled:wby-bg-neutral-muted aria-disabled:wby-text-neutral-muted\"\n ],\n \"neutral-strong\": [\n \"wby-bg-neutral-strong wby-text-neutral-light\",\n \"hover:wby-bg-neutral-xstrong\",\n \"aria-disabled:wby-bg-neutral-muted\"\n ],\n \"neutral-xstrong\": [\n \"wby-bg-neutral-xstrong wby-text-neutral-light\",\n \"hover:wby-bg-neutral-dark\",\n \"aria-disabled:wby-bg-neutral-strong\"\n ],\n \"neutral-dark\": [\n \"wby-bg-neutral-dark wby-text-neutral-light\",\n \"hover:wby-bg-neutral-xstrong\",\n \"aria-disabled:wby-bg-neutral-strong\"\n ],\n accent: [\n \"wby-bg-primary-default wby-text-neutral-light\",\n \"hover:wby-bg-primary-strong\",\n \"aria-disabled:wby-bg-primary-disabled\"\n ],\n \"accent-light\": [\n \"wby-bg-primary-subtle wby-text-neutral-primary\",\n \"hover:wby-bg-primary-muted\",\n \"aria-disabled:wby-bg-primary-subtle aria-disabled:wby-text-neutral-muted\"\n ],\n success: [\n \"wby-bg-success-default wby-text-neutral-light\",\n \"hover:wby-bg-success-strong\",\n \"aria-disabled:wby-bg-success-disabled\"\n ],\n \"success-light\": [\n \"wby-bg-success-subtle wby-text-neutral-primary\",\n \"hover:wby-bg-success-muted\",\n \"aria-disabled:wby-bg-success-subtle aria-disabled:wby-text-neutral-muted\"\n ],\n warning: [\n \"wby-bg-warning-muted wby-text-neutral-primary\",\n \"hover:wby-bg-warning-default\",\n \"aria-disabled:wby-bg-warning-disabled aria-disabled:wby-text-neutral-disabled\"\n ],\n destructive: [\n \"wby-bg-destructive-default wby-text-neutral-light\",\n \"hover:wby-bg-destructive-strong\",\n \"aria-disabled:wby-bg-destructive-disabled\"\n ]\n }\n },\n defaultVariants: {\n variant: \"neutral-base\"\n }\n }\n);\n\nexport interface TagProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\" | \"content\">,\n VariantProps<typeof tagVariants> {\n content: React.ReactNode;\n onDismiss?: (event: React.SyntheticEvent<HTMLSpanElement>) => void;\n dismissIconElement?: React.ReactElement;\n dismissIconLabel?: string;\n disabled?: boolean;\n}\n\nconst DecoratableTag = ({\n className,\n variant,\n content,\n onClick,\n onDismiss,\n dismissIconElement = <Close />,\n dismissIconLabel = \"Close\",\n disabled,\n ...props\n}: TagProps) => {\n const dismissButtonVariant = React.useMemo((): VariantProps<\n typeof iconButtonVariants\n >[\"variant\"] => {\n if (\n variant &&\n [\n \"neutral-strong\",\n \"neutral-xstrong\",\n \"neutral-dark\",\n \"success\",\n \"accent\",\n \"destructive\"\n ].includes(variant)\n ) {\n return \"ghost-negative\";\n }\n\n return \"ghost\";\n }, [variant]);\n\n const dismissIconColor: IconProps[\"color\"] = React.useMemo(() => {\n if (\n variant &&\n [\n \"neutral-strong\",\n \"neutral-xstrong\",\n \"neutral-dark\",\n \"accent\",\n \"success\",\n \"destructive\"\n ].includes(variant)\n ) {\n return \"neutral-negative\";\n }\n\n if (variant && [\"warning\"].includes(variant)) {\n return \"neutral-strong\";\n }\n\n return \"neutral-strong-transparent\";\n }, [variant]);\n\n return (\n <span\n {...props}\n onClick={onClick}\n className={cn(\n tagVariants({\n variant,\n isDismissible: Boolean(onDismiss),\n isInteractive: Boolean(onClick),\n isDisabled: Boolean(disabled)\n }),\n className\n )}\n aria-disabled={disabled}\n >\n <span className={\"wby-overflow-hidden wby-truncate wby-whitespace-nowrap\"}>\n {content}\n </span>\n {onDismiss && (\n <IconButton\n icon={\n <Icon\n icon={dismissIconElement}\n label={dismissIconLabel}\n color={dismissIconColor}\n size={\"sm\"}\n />\n }\n size={\"xxs\"}\n variant={dismissButtonVariant}\n disabled={disabled}\n onClick={event => {\n event.stopPropagation();\n onDismiss(event);\n }}\n />\n )}\n </span>\n );\n};\nconst Tag = makeDecoratable(\"Tag\", DecoratableTag);\n\nexport { Tag };\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"names":["React","ReactComponent","Close","cn","cva","makeDecoratable","Icon","IconButton","tagVariants","variants","isInteractive","true","isDismissible","false","isDisabled","variant","accent","success","warning","destructive","defaultVariants","DecoratableTag","className","content","onClick","onDismiss","dismissIconElement","createElement","dismissIconLabel","disabled","props","dismissButtonVariant","useMemo","includes","dismissIconColor","Object","assign","Boolean","icon","label","color","size","event","stopPropagation","Tag"],"sources":["Tag.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as Close } from \"@webiny/icons/close.svg\";\nimport { cn, cva, makeDecoratable, type VariantProps } from \"~/utils\";\nimport { Icon, type IconProps } from \"~/Icon\";\nimport type { iconButtonVariants } from \"~/Button\";\nimport { IconButton } from \"~/Button\";\n\nconst tagVariants = cva(\n [\n \"wby-inline-flex wby-items-center wby-gap-xxs wby-rounded-sm wby-text-sm wby-text-regular wby-transition-colors wby-overflow-hidden\",\n \"focus:outline-none\"\n ],\n {\n variants: {\n isInteractive: {\n true: \"wby-cursor-pointer\"\n },\n isDismissible: {\n true: \"wby-pl-xs-plus wby-pt-xxs wby-pb-xxs wby-pr-xs\",\n false: \"wby-px-xs-plus wby-py-xxs\"\n },\n isDisabled: {\n true: \"wby-cursor-not-allowed wby-pointer-events-none\"\n },\n variant: {\n \"neutral-base\": [\n \"wby-bg-transparent wby-text-neutral-primary\",\n \"hover:wby-bg-neutral-light\",\n \"aria-disabled:wby-bg-transparent aria-disabled:wby-text-neutral-disabled\"\n ],\n \"neutral-base-outline\": [\n \"wby-border-sm wby-border-solid wby-px-[calc(theme(padding.xs-plus)-theme(borderWidth.sm))] wby-py-[calc(theme(padding.xxs)-theme(borderWidth.sm))]\",\n \"wby-bg-transparent wby-border-neutral-muted wby-text-neutral-primary\",\n \"hover:wby-bg-neutral-light\",\n \"aria-disabled:wby-bg-transparent aria-disabled:wby-border-neutral-dimmed aria-disabled:wby-text-neutral-disabled\"\n ],\n \"neutral-light\": [\n \"wby-bg-neutral-light wby-text-neutral-primary\",\n \"hover:wby-bg-neutral-muted\",\n \"aria-disabled:wby-bg-neutral-light aria-disabled:wby-text-neutral-muted\"\n ],\n \"neutral-muted\": [\n \"wby-bg-neutral-muted wby-text-neutral-primary\",\n \"hover:wby-bg-neutral-strong\",\n \"aria-disabled:wby-bg-neutral-muted aria-disabled:wby-text-neutral-muted\"\n ],\n \"neutral-strong\": [\n \"wby-bg-neutral-strong wby-text-neutral-light\",\n \"hover:wby-bg-neutral-xstrong\",\n \"aria-disabled:wby-bg-neutral-muted\"\n ],\n \"neutral-xstrong\": [\n \"wby-bg-neutral-xstrong wby-text-neutral-light\",\n \"hover:wby-bg-neutral-dark\",\n \"aria-disabled:wby-bg-neutral-strong\"\n ],\n \"neutral-dark\": [\n \"wby-bg-neutral-dark wby-text-neutral-light\",\n \"hover:wby-bg-neutral-xstrong\",\n \"aria-disabled:wby-bg-neutral-strong\"\n ],\n accent: [\n \"wby-bg-primary-default wby-text-neutral-light\",\n \"hover:wby-bg-primary-strong\",\n \"aria-disabled:wby-bg-primary-disabled\"\n ],\n \"accent-light\": [\n \"wby-bg-primary-subtle wby-text-neutral-primary\",\n \"hover:wby-bg-primary-muted\",\n \"aria-disabled:wby-bg-primary-subtle aria-disabled:wby-text-neutral-muted\"\n ],\n success: [\n \"wby-bg-success-default wby-text-neutral-light\",\n \"hover:wby-bg-success-strong\",\n \"aria-disabled:wby-bg-success-disabled\"\n ],\n \"success-light\": [\n \"wby-bg-success-subtle wby-text-neutral-primary\",\n \"hover:wby-bg-success-muted\",\n \"aria-disabled:wby-bg-success-subtle aria-disabled:wby-text-neutral-muted\"\n ],\n warning: [\n \"wby-bg-warning-muted wby-text-neutral-primary\",\n \"hover:wby-bg-warning-default\",\n \"aria-disabled:wby-bg-warning-disabled aria-disabled:wby-text-neutral-disabled\"\n ],\n destructive: [\n \"wby-bg-destructive-default wby-text-neutral-light\",\n \"hover:wby-bg-destructive-strong\",\n \"aria-disabled:wby-bg-destructive-disabled\"\n ]\n }\n },\n defaultVariants: {\n variant: \"neutral-base\"\n }\n }\n);\n\nexport interface TagProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\" | \"content\">,\n VariantProps<typeof tagVariants> {\n content: React.ReactNode;\n onDismiss?: (event: React.SyntheticEvent<HTMLSpanElement>) => void;\n dismissIconElement?: React.ReactElement;\n dismissIconLabel?: string;\n disabled?: boolean;\n}\n\nconst DecoratableTag = ({\n className,\n variant,\n content,\n onClick,\n onDismiss,\n dismissIconElement = <Close />,\n dismissIconLabel = \"Close\",\n disabled,\n ...props\n}: TagProps) => {\n const dismissButtonVariant = React.useMemo((): VariantProps<\n typeof iconButtonVariants\n >[\"variant\"] => {\n if (\n variant &&\n [\n \"neutral-strong\",\n \"neutral-xstrong\",\n \"neutral-dark\",\n \"success\",\n \"accent\",\n \"destructive\"\n ].includes(variant)\n ) {\n return \"ghost-negative\";\n }\n\n return \"ghost\";\n }, [variant]);\n\n const dismissIconColor: IconProps[\"color\"] = React.useMemo(() => {\n if (\n variant &&\n [\n \"neutral-strong\",\n \"neutral-xstrong\",\n \"neutral-dark\",\n \"accent\",\n \"success\",\n \"destructive\"\n ].includes(variant)\n ) {\n return \"neutral-negative\";\n }\n\n if (variant && [\"warning\"].includes(variant)) {\n return \"neutral-strong\";\n }\n\n return \"neutral-strong-transparent\";\n }, [variant]);\n\n return (\n <span\n {...props}\n onClick={onClick}\n className={cn(\n tagVariants({\n variant,\n isDismissible: Boolean(onDismiss),\n isInteractive: Boolean(onClick),\n isDisabled: Boolean(disabled)\n }),\n className\n )}\n aria-disabled={disabled}\n >\n <span className={\"wby-overflow-hidden wby-truncate wby-whitespace-nowrap\"}>\n {content}\n </span>\n {onDismiss && (\n <IconButton\n icon={\n <Icon\n icon={dismissIconElement}\n label={dismissIconLabel}\n color={dismissIconColor}\n size={\"sm\"}\n />\n }\n size={\"xxs\"}\n variant={dismissButtonVariant}\n disabled={disabled}\n onClick={event => {\n event.stopPropagation();\n onDismiss(event);\n }}\n />\n )}\n </span>\n );\n};\nconst Tag = makeDecoratable(\"Tag\", DecoratableTag);\n\nexport { Tag };\n"],"mappings":"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","ignoreList":[]}
package/Tags/Tags.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { type TagsPrimitiveProps } from "./primitives";
3
+ import { type FormComponentProps } from "../FormComponent";
4
+ type TagsProps = TagsPrimitiveProps & FormComponentProps;
5
+ declare const Tags: (({ label, description, note, required, disabled, validation, validate, onBlur: originalOnBlur, ...props }: TagsProps) => React.JSX.Element) & {
6
+ original: ({ label, description, note, required, disabled, validation, validate, onBlur: originalOnBlur, ...props }: TagsProps) => React.JSX.Element;
7
+ originalName: string;
8
+ displayName: string;
9
+ } & {
10
+ original: (({ label, description, note, required, disabled, validation, validate, onBlur: originalOnBlur, ...props }: TagsProps) => React.JSX.Element) & {
11
+ original: ({ label, description, note, required, disabled, validation, validate, onBlur: originalOnBlur, ...props }: TagsProps) => React.JSX.Element;
12
+ originalName: string;
13
+ displayName: string;
14
+ };
15
+ originalName: string;
16
+ displayName: string;
17
+ } & {
18
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ label, description, note, required, disabled, validation, validate, onBlur: originalOnBlur, ...props }: TagsProps) => React.JSX.Element) & {
19
+ original: ({ label, description, note, required, disabled, validation, validate, onBlur: originalOnBlur, ...props }: TagsProps) => React.JSX.Element;
20
+ originalName: string;
21
+ displayName: string;
22
+ }>) => (props: unknown) => React.JSX.Element;
23
+ };
24
+ export { Tags, type TagsProps };
package/Tags/Tags.js ADDED
@@ -0,0 +1,59 @@
1
+ import React, { useCallback, useMemo } from "react";
2
+ import { makeDecoratable, generateId } from "../utils";
3
+ import { TagsPrimitive } from "./primitives";
4
+ import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent";
5
+ const DecoratableTags = ({
6
+ label,
7
+ description,
8
+ note,
9
+ required,
10
+ disabled,
11
+ validation,
12
+ validate,
13
+ onBlur: originalOnBlur,
14
+ ...props
15
+ }) => {
16
+ const {
17
+ isValid: validationIsValid,
18
+ message: validationMessage
19
+ } = validation || {};
20
+ const id = useMemo(() => generateId(props.id), [props.id]);
21
+ const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);
22
+ const onBlur = useCallback(async e => {
23
+ if (validate) {
24
+ // Since we are accessing event in an async operation, we need to persist it.
25
+ // See https://reactjs.org/docs/events.html#event-pooling.
26
+ e.persist();
27
+ await validate();
28
+ }
29
+ originalOnBlur && originalOnBlur(e);
30
+ }, [validate, originalOnBlur]);
31
+ return /*#__PURE__*/React.createElement("div", {
32
+ className: "wby-w-full"
33
+ }, /*#__PURE__*/React.createElement(FormComponentLabel, {
34
+ htmlFor: id,
35
+ text: label,
36
+ required: required,
37
+ disabled: disabled,
38
+ invalid: invalid
39
+ }), /*#__PURE__*/React.createElement(FormComponentDescription, {
40
+ text: description,
41
+ disabled: disabled
42
+ }), /*#__PURE__*/React.createElement(TagsPrimitive, Object.assign({}, props, {
43
+ id: id,
44
+ disabled: disabled,
45
+ invalid: invalid,
46
+ onBlur: onBlur
47
+ })), /*#__PURE__*/React.createElement(FormComponentErrorMessage, {
48
+ text: validationMessage,
49
+ invalid: invalid,
50
+ disabled: disabled
51
+ }), /*#__PURE__*/React.createElement(FormComponentNote, {
52
+ text: note,
53
+ disabled: disabled
54
+ }));
55
+ };
56
+ const Tags = makeDecoratable("Tags", DecoratableTags);
57
+ export { Tags };
58
+
59
+ //# sourceMappingURL=Tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useMemo","makeDecoratable","generateId","TagsPrimitive","FormComponentDescription","FormComponentErrorMessage","FormComponentLabel","FormComponentNote","DecoratableTags","label","description","note","required","disabled","validation","validate","onBlur","originalOnBlur","props","isValid","validationIsValid","message","validationMessage","id","invalid","e","persist","createElement","className","htmlFor","text","Object","assign","Tags"],"sources":["Tags.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { makeDecoratable, generateId } from \"~/utils\";\nimport { TagsPrimitive, type TagsPrimitiveProps } from \"./primitives\";\n\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote,\n type FormComponentProps\n} from \"~/FormComponent\";\n\ntype TagsProps = TagsPrimitiveProps & FormComponentProps;\n\nconst DecoratableTags = ({\n label,\n description,\n note,\n required,\n disabled,\n validation,\n validate,\n onBlur: originalOnBlur,\n ...props\n}: TagsProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const id = useMemo(() => generateId(props.id), [props.id]);\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n const onBlur = useCallback(\n async (e: React.FocusEvent<HTMLInputElement>) => {\n if (validate) {\n // Since we are accessing event in an async operation, we need to persist it.\n // See https://reactjs.org/docs/events.html#event-pooling.\n e.persist();\n await validate();\n }\n originalOnBlur && originalOnBlur(e);\n },\n [validate, originalOnBlur]\n );\n\n return (\n <div className={\"wby-w-full\"}>\n <FormComponentLabel\n htmlFor={id}\n text={label}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={disabled} />\n <TagsPrimitive\n {...props}\n id={id}\n disabled={disabled}\n invalid={invalid}\n onBlur={onBlur}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\n\nconst Tags = makeDecoratable(\"Tags\", DecoratableTags);\n\nexport { Tags, type TagsProps };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,eAAe,EAAEC,UAAU;AACpC,SAASC,aAAa;AAEtB,SACIC,wBAAwB,EACxBC,yBAAyB,EACzBC,kBAAkB,EAClBC,iBAAiB;AAMrB,MAAMC,eAAe,GAAGA,CAAC;EACrBC,KAAK;EACLC,WAAW;EACXC,IAAI;EACJC,QAAQ;EACRC,QAAQ;EACRC,UAAU;EACVC,QAAQ;EACRC,MAAM,EAAEC,cAAc;EACtB,GAAGC;AACI,CAAC,KAAK;EACb,MAAM;IAAEC,OAAO,EAAEC,iBAAiB;IAAEC,OAAO,EAAEC;EAAkB,CAAC,GAAGR,UAAU,IAAI,CAAC,CAAC;EACnF,MAAMS,EAAE,GAAGvB,OAAO,CAAC,MAAME,UAAU,CAACgB,KAAK,CAACK,EAAE,CAAC,EAAE,CAACL,KAAK,CAACK,EAAE,CAAC,CAAC;EAC1D,MAAMC,OAAO,GAAGxB,OAAO,CAAC,MAAMoB,iBAAiB,KAAK,KAAK,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAE/E,MAAMJ,MAAM,GAAGjB,WAAW,CACtB,MAAO0B,CAAqC,IAAK;IAC7C,IAAIV,QAAQ,EAAE;MACV;MACA;MACAU,CAAC,CAACC,OAAO,CAAC,CAAC;MACX,MAAMX,QAAQ,CAAC,CAAC;IACpB;IACAE,cAAc,IAAIA,cAAc,CAACQ,CAAC,CAAC;EACvC,CAAC,EACD,CAACV,QAAQ,EAAEE,cAAc,CAC7B,CAAC;EAED,oBACInB,KAAA,CAAA6B,aAAA;IAAKC,SAAS,EAAE;EAAa,gBACzB9B,KAAA,CAAA6B,aAAA,CAACrB,kBAAkB;IACfuB,OAAO,EAAEN,EAAG;IACZO,IAAI,EAAErB,KAAM;IACZG,QAAQ,EAAEA,QAAS;IACnBC,QAAQ,EAAEA,QAAS;IACnBW,OAAO,EAAEA;EAAQ,CACpB,CAAC,eACF1B,KAAA,CAAA6B,aAAA,CAACvB,wBAAwB;IAAC0B,IAAI,EAAEpB,WAAY;IAACG,QAAQ,EAAEA;EAAS,CAAE,CAAC,eACnEf,KAAA,CAAA6B,aAAA,CAACxB,aAAa,EAAA4B,MAAA,CAAAC,MAAA,KACNd,KAAK;IACTK,EAAE,EAAEA,EAAG;IACPV,QAAQ,EAAEA,QAAS;IACnBW,OAAO,EAAEA,OAAQ;IACjBR,MAAM,EAAEA;EAAO,EAClB,CAAC,eACFlB,KAAA,CAAA6B,aAAA,CAACtB,yBAAyB;IACtByB,IAAI,EAAER,iBAAkB;IACxBE,OAAO,EAAEA,OAAQ;IACjBX,QAAQ,EAAEA;EAAS,CACtB,CAAC,eACFf,KAAA,CAAA6B,aAAA,CAACpB,iBAAiB;IAACuB,IAAI,EAAEnB,IAAK;IAACE,QAAQ,EAAEA;EAAS,CAAE,CACnD,CAAC;AAEd,CAAC;AAED,MAAMoB,IAAI,GAAGhC,eAAe,CAAC,MAAM,EAAEO,eAAe,CAAC;AAErD,SAASyB,IAAI","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Tags } from "./Tags";
3
+ declare const meta: Meta<typeof Tags>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Tags>;
6
+ export declare const Default: Story;
7
+ export declare const WithLabel: Story;
8
+ export declare const WithRequiredLabel: Story;
9
+ export declare const WithDescription: Story;
10
+ export declare const WithNotes: Story;
11
+ export declare const WithErrors: Story;
12
+ export declare const Disabled: Story;
13
+ export declare const FullExample: Story;
@@ -0,0 +1,92 @@
1
+ import React, { useState } from "react";
2
+ import { Tags } from "./Tags";
3
+ const meta = {
4
+ title: "Components/Form/Tags",
5
+ component: Tags,
6
+ argTypes: {
7
+ onChange: {
8
+ action: "onChange"
9
+ },
10
+ onValueInput: {
11
+ action: "onValueInput"
12
+ },
13
+ onValueAdd: {
14
+ action: "onValueAdd"
15
+ },
16
+ onValueRemove: {
17
+ action: "onValueRemove"
18
+ },
19
+ disabled: {
20
+ control: "boolean",
21
+ defaultValue: false
22
+ }
23
+ },
24
+ parameters: {
25
+ layout: "padded"
26
+ },
27
+ render: args => {
28
+ const [values, setValues] = useState(args.value);
29
+ return /*#__PURE__*/React.createElement(Tags, Object.assign({}, args, {
30
+ value: values,
31
+ onChange: setValues
32
+ }));
33
+ }
34
+ };
35
+ export default meta;
36
+ export const Default = {};
37
+ export const WithLabel = {
38
+ args: {
39
+ ...Default.args,
40
+ label: "Any field label"
41
+ }
42
+ };
43
+ export const WithRequiredLabel = {
44
+ args: {
45
+ ...Default.args,
46
+ label: "Any field label",
47
+ required: true
48
+ }
49
+ };
50
+ export const WithDescription = {
51
+ args: {
52
+ ...Default.args,
53
+ description: "Provide the required information for processing your request."
54
+ }
55
+ };
56
+ export const WithNotes = {
57
+ args: {
58
+ ...Default.args,
59
+ note: "Note: Ensure your selection or input is accurate before proceeding."
60
+ }
61
+ };
62
+ export const WithErrors = {
63
+ args: {
64
+ ...Default.args,
65
+ validation: {
66
+ isValid: false,
67
+ message: "This field is required."
68
+ }
69
+ }
70
+ };
71
+ export const Disabled = {
72
+ args: {
73
+ ...Default.args,
74
+ label: "Any field label",
75
+ disabled: true
76
+ }
77
+ };
78
+ export const FullExample = {
79
+ args: {
80
+ ...Default.args,
81
+ label: "Any field label",
82
+ required: true,
83
+ description: "Provide the required information for processing your request.",
84
+ note: "Note: Ensure your selection or input is accurate before proceeding.",
85
+ validation: {
86
+ isValid: false,
87
+ message: "This field is required."
88
+ }
89
+ }
90
+ };
91
+
92
+ //# sourceMappingURL=Tags.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","Tags","meta","title","component","argTypes","onChange","action","onValueInput","onValueAdd","onValueRemove","disabled","control","defaultValue","parameters","layout","render","args","values","setValues","value","createElement","Object","assign","Default","WithLabel","label","WithRequiredLabel","required","WithDescription","description","WithNotes","note","WithErrors","validation","isValid","message","Disabled","FullExample"],"sources":["Tags.stories.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { Tags } from \"./Tags\";\n\nconst meta: Meta<typeof Tags> = {\n title: \"Components/Form/Tags\",\n component: Tags,\n argTypes: {\n onChange: { action: \"onChange\" },\n onValueInput: { action: \"onValueInput\" },\n onValueAdd: { action: \"onValueAdd\" },\n onValueRemove: { action: \"onValueRemove\" },\n disabled: {\n control: \"boolean\",\n defaultValue: false\n }\n },\n parameters: {\n layout: \"padded\"\n },\n render: args => {\n const [values, setValues] = useState(args.value);\n return <Tags {...args} value={values} onChange={setValues} />;\n }\n};\n\nexport default meta;\ntype Story = StoryObj<typeof Tags>;\n\nexport const Default: Story = {};\n\nexport const WithLabel: Story = {\n args: {\n ...Default.args,\n label: \"Any field label\"\n }\n};\n\nexport const WithRequiredLabel: Story = {\n args: {\n ...Default.args,\n label: \"Any field label\",\n required: true\n }\n};\n\nexport const WithDescription: Story = {\n args: {\n ...Default.args,\n description: \"Provide the required information for processing your request.\"\n }\n};\n\nexport const WithNotes: Story = {\n args: {\n ...Default.args,\n note: \"Note: Ensure your selection or input is accurate before proceeding.\"\n }\n};\n\nexport const WithErrors: Story = {\n args: {\n ...Default.args,\n validation: {\n isValid: false,\n message: \"This field is required.\"\n }\n }\n};\n\nexport const Disabled: Story = {\n args: {\n ...Default.args,\n label: \"Any field label\",\n disabled: true\n }\n};\n\nexport const FullExample: Story = {\n args: {\n ...Default.args,\n label: \"Any field label\",\n required: true,\n description: \"Provide the required information for processing your request.\",\n note: \"Note: Ensure your selection or input is accurate before proceeding.\",\n validation: {\n isValid: false,\n message: \"This field is required.\"\n }\n }\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAEvC,SAASC,IAAI;AAEb,MAAMC,IAAuB,GAAG;EAC5BC,KAAK,EAAE,sBAAsB;EAC7BC,SAAS,EAAEH,IAAI;EACfI,QAAQ,EAAE;IACNC,QAAQ,EAAE;MAAEC,MAAM,EAAE;IAAW,CAAC;IAChCC,YAAY,EAAE;MAAED,MAAM,EAAE;IAAe,CAAC;IACxCE,UAAU,EAAE;MAAEF,MAAM,EAAE;IAAa,CAAC;IACpCG,aAAa,EAAE;MAAEH,MAAM,EAAE;IAAgB,CAAC;IAC1CI,QAAQ,EAAE;MACNC,OAAO,EAAE,SAAS;MAClBC,YAAY,EAAE;IAClB;EACJ,CAAC;EACDC,UAAU,EAAE;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,MAAM,EAAEC,IAAI,IAAI;IACZ,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGnB,QAAQ,CAACiB,IAAI,CAACG,KAAK,CAAC;IAChD,oBAAOrB,KAAA,CAAAsB,aAAA,CAACpB,IAAI,EAAAqB,MAAA,CAAAC,MAAA,KAAKN,IAAI;MAAEG,KAAK,EAAEF,MAAO;MAACZ,QAAQ,EAAEa;IAAU,EAAE,CAAC;EACjE;AACJ,CAAC;AAED,eAAejB,IAAI;AAGnB,OAAO,MAAMsB,OAAc,GAAG,CAAC,CAAC;AAEhC,OAAO,MAAMC,SAAgB,GAAG;EAC5BR,IAAI,EAAE;IACF,GAAGO,OAAO,CAACP,IAAI;IACfS,KAAK,EAAE;EACX;AACJ,CAAC;AAED,OAAO,MAAMC,iBAAwB,GAAG;EACpCV,IAAI,EAAE;IACF,GAAGO,OAAO,CAACP,IAAI;IACfS,KAAK,EAAE,iBAAiB;IACxBE,QAAQ,EAAE;EACd;AACJ,CAAC;AAED,OAAO,MAAMC,eAAsB,GAAG;EAClCZ,IAAI,EAAE;IACF,GAAGO,OAAO,CAACP,IAAI;IACfa,WAAW,EAAE;EACjB;AACJ,CAAC;AAED,OAAO,MAAMC,SAAgB,GAAG;EAC5Bd,IAAI,EAAE;IACF,GAAGO,OAAO,CAACP,IAAI;IACfe,IAAI,EAAE;EACV;AACJ,CAAC;AAED,OAAO,MAAMC,UAAiB,GAAG;EAC7BhB,IAAI,EAAE;IACF,GAAGO,OAAO,CAACP,IAAI;IACfiB,UAAU,EAAE;MACRC,OAAO,EAAE,KAAK;MACdC,OAAO,EAAE;IACb;EACJ;AACJ,CAAC;AAED,OAAO,MAAMC,QAAe,GAAG;EAC3BpB,IAAI,EAAE;IACF,GAAGO,OAAO,CAACP,IAAI;IACfS,KAAK,EAAE,iBAAiB;IACxBf,QAAQ,EAAE;EACd;AACJ,CAAC;AAED,OAAO,MAAM2B,WAAkB,GAAG;EAC9BrB,IAAI,EAAE;IACF,GAAGO,OAAO,CAACP,IAAI;IACfS,KAAK,EAAE,iBAAiB;IACxBE,QAAQ,EAAE,IAAI;IACdE,WAAW,EAAE,+DAA+D;IAC5EE,IAAI,EAAE,qEAAqE;IAC3EE,UAAU,EAAE;MACRC,OAAO,EAAE,KAAK;MACdC,OAAO,EAAE;IACb;EACJ;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ export declare class TagItem {
2
+ private readonly _id;
3
+ private readonly _label;
4
+ protected _protected: boolean;
5
+ protected constructor(data: {
6
+ id: string;
7
+ label: string;
8
+ protected: boolean;
9
+ });
10
+ static create(data: {
11
+ id?: string;
12
+ label: string;
13
+ protected?: boolean;
14
+ }): TagItem;
15
+ get id(): string;
16
+ get label(): string;
17
+ get protected(): boolean;
18
+ }
@@ -0,0 +1,26 @@
1
+ import { generateId } from "../../utils";
2
+ export class TagItem {
3
+ constructor(data) {
4
+ this._id = data.id;
5
+ this._label = data.label;
6
+ this._protected = data.protected;
7
+ }
8
+ static create(data) {
9
+ return new TagItem({
10
+ id: generateId(data.id),
11
+ label: data.label,
12
+ protected: data.protected || false
13
+ });
14
+ }
15
+ get id() {
16
+ return this._id;
17
+ }
18
+ get label() {
19
+ return this._label;
20
+ }
21
+ get protected() {
22
+ return this._protected;
23
+ }
24
+ }
25
+
26
+ //# sourceMappingURL=TagItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["generateId","TagItem","constructor","data","_id","id","_label","label","_protected","protected","create"],"sources":["TagItem.ts"],"sourcesContent":["import { generateId } from \"~/utils\";\n\nexport class TagItem {\n private readonly _id: string;\n private readonly _label: string;\n protected _protected: boolean;\n\n protected constructor(data: { id: string; label: string; protected: boolean }) {\n this._id = data.id;\n this._label = data.label;\n this._protected = data.protected;\n }\n\n static create(data: { id?: string; label: string; protected?: boolean }): TagItem {\n return new TagItem({\n id: generateId(data.id),\n label: data.label,\n protected: data.protected || false\n });\n }\n\n get id() {\n return this._id;\n }\n\n get label() {\n return this._label;\n }\n\n get protected() {\n return this._protected;\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU;AAEnB,OAAO,MAAMC,OAAO,CAAC;EAKPC,WAAWA,CAACC,IAAuD,EAAE;IAC3E,IAAI,CAACC,GAAG,GAAGD,IAAI,CAACE,EAAE;IAClB,IAAI,CAACC,MAAM,GAAGH,IAAI,CAACI,KAAK;IACxB,IAAI,CAACC,UAAU,GAAGL,IAAI,CAACM,SAAS;EACpC;EAEA,OAAOC,MAAMA,CAACP,IAAyD,EAAW;IAC9E,OAAO,IAAIF,OAAO,CAAC;MACfI,EAAE,EAAEL,UAAU,CAACG,IAAI,CAACE,EAAE,CAAC;MACvBE,KAAK,EAAEJ,IAAI,CAACI,KAAK;MACjBE,SAAS,EAAEN,IAAI,CAACM,SAAS,IAAI;IACjC,CAAC,CAAC;EACN;EAEA,IAAIJ,EAAEA,CAAA,EAAG;IACL,OAAO,IAAI,CAACD,GAAG;EACnB;EAEA,IAAIG,KAAKA,CAAA,EAAG;IACR,OAAO,IAAI,CAACD,MAAM;EACtB;EAEA,IAAIG,SAASA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACD,UAAU;EAC1B;AACJ","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export interface TagItemDto {
2
+ id?: string;
3
+ label: string;
4
+ protected?: boolean;
5
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=TagItemDto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["TagItemDto.ts"],"sourcesContent":["export interface TagItemDto {\n id?: string;\n label: string;\n protected?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export interface TagItemFormatted {
2
+ id: string;
3
+ label: string;
4
+ protected: boolean;
5
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=TagItemFormatted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["TagItemFormatted.ts"],"sourcesContent":["export interface TagItemFormatted {\n id: string;\n label: string;\n protected: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import type { TagItem } from "./TagItem";
2
+ import type { TagItemFormatted } from "./TagItemFormatted";
3
+ export declare class TagItemMapper {
4
+ static toFormatted(item: TagItem): TagItemFormatted;
5
+ }
@@ -0,0 +1,11 @@
1
+ export class TagItemMapper {
2
+ static toFormatted(item) {
3
+ return {
4
+ id: item.id,
5
+ label: item.label,
6
+ protected: item.protected
7
+ };
8
+ }
9
+ }
10
+
11
+ //# sourceMappingURL=TagItemMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TagItemMapper","toFormatted","item","id","label","protected"],"sources":["TagItemMapper.ts"],"sourcesContent":["import type { TagItem } from \"./TagItem\";\nimport type { TagItemFormatted } from \"./TagItemFormatted\";\n\nexport class TagItemMapper {\n static toFormatted(item: TagItem): TagItemFormatted {\n return {\n id: item.id,\n label: item.label,\n protected: item.protected\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,aAAa,CAAC;EACvB,OAAOC,WAAWA,CAACC,IAAa,EAAoB;IAChD,OAAO;MACHC,EAAE,EAAED,IAAI,CAACC,EAAE;MACXC,KAAK,EAAEF,IAAI,CAACE,KAAK;MACjBC,SAAS,EAAEH,IAAI,CAACG;IACpB,CAAC;EACL;AACJ","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export * from "./TagItem";
2
+ export * from "./TagItemDto";
3
+ export * from "./TagItemFormatted";
4
+ export * from "./TagItemMapper";
@@ -0,0 +1,6 @@
1
+ export * from "./TagItem";
2
+ export * from "./TagItemDto";
3
+ export * from "./TagItemFormatted";
4
+ export * from "./TagItemMapper";
5
+
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./TagItem\";\nexport * from \"./TagItemDto\";\nexport * from \"./TagItemFormatted\";\nexport * from \"./TagItemMapper\";\n"],"mappings":"AAAA;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export * from "./Tags";
package/Tags/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./Tags";
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Tags\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ import React from "react";
2
+ import { type InputPrimitiveProps } from "../../Input";
3
+ import type { Icon } from "../../Icon";
4
+ interface TagsPrimitiveProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
5
+ /**
6
+ * Indicates if the field is disabled.
7
+ */
8
+ disabled?: boolean;
9
+ /**
10
+ * Reference to the input element.
11
+ */
12
+ inputRef?: React.Ref<HTMLInputElement>;
13
+ /**
14
+ * Indicates if the input field is invalid.
15
+ */
16
+ invalid?: boolean;
17
+ /**
18
+ * Callback triggered when a tag is added or removed.
19
+ */
20
+ onChange?: (values: string[]) => void;
21
+ /**
22
+ * Callback triggered when the input value changes.
23
+ */
24
+ onValueInput?: (value: string) => void;
25
+ /**
26
+ * Callback triggered when the value is added to the list.
27
+ */
28
+ onValueAdd?: (value: string) => void;
29
+ /**
30
+ * Callback triggered when a tag is removed.
31
+ */
32
+ onValueRemove?: (value: string) => void;
33
+ /**
34
+ * Placeholder text for the input field.
35
+ */
36
+ placeholder?: string;
37
+ /**
38
+ * Size of the input field.
39
+ * Refer to `InputPrimitiveProps["size"]` for possible values.
40
+ */
41
+ size?: InputPrimitiveProps["size"];
42
+ /**
43
+ * Icon to be displayed at the start of the input field.
44
+ */
45
+ startIcon?: React.ReactElement<typeof Icon> | React.ReactElement;
46
+ /**
47
+ * Variant of the input field.
48
+ * Refer to `InputPrimitiveProps["variant"]` for possible values.
49
+ */
50
+ variant?: InputPrimitiveProps["variant"];
51
+ /**
52
+ * Optional selected item.
53
+ */
54
+ value?: string[];
55
+ /**
56
+ * Protected values cannot be removed by the user, these can be simple strings or regex patterns.
57
+ */
58
+ protectedValues?: string[];
59
+ }
60
+ declare const TagsPrimitive: ((props: TagsPrimitiveProps) => React.JSX.Element) & {
61
+ original: (props: TagsPrimitiveProps) => React.JSX.Element;
62
+ originalName: string;
63
+ displayName: string;
64
+ } & {
65
+ original: ((props: TagsPrimitiveProps) => React.JSX.Element) & {
66
+ original: (props: TagsPrimitiveProps) => React.JSX.Element;
67
+ originalName: string;
68
+ displayName: string;
69
+ };
70
+ originalName: string;
71
+ displayName: string;
72
+ } & {
73
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<((props: TagsPrimitiveProps) => React.JSX.Element) & {
74
+ original: (props: TagsPrimitiveProps) => React.JSX.Element;
75
+ originalName: string; /**
76
+ * Indicates if the input field is invalid.
77
+ */
78
+ displayName: string;
79
+ }>) => (props: unknown) => React.JSX.Element;
80
+ };
81
+ export { TagsPrimitive, type TagsPrimitiveProps };
@@ -0,0 +1,54 @@
1
+ import React, { useMemo } from "react";
2
+ import { ReactComponent as AddIcon } from "@webiny/icons/add.svg";
3
+ import { makeDecoratable } from "../../utils";
4
+ import { useTags } from "./useTags";
5
+ import { InputPrimitive } from "../../Input";
6
+ import { Tag } from "../../Tag";
7
+ import { IconButton } from "../../Button";
8
+ const DecoratableTagsPrimitive = props => {
9
+ const {
10
+ vm,
11
+ inputValue,
12
+ addValue,
13
+ removeValue
14
+ } = useTags(props);
15
+ const inputProps = useMemo(() => ({
16
+ disabled: props.disabled,
17
+ inputRef: props.inputRef,
18
+ invalid: props.invalid,
19
+ onChange: inputValue,
20
+ placeholder: props.placeholder,
21
+ size: props.size,
22
+ variant: props.variant
23
+ }), [props]);
24
+
25
+ // When user press Enter, add the current input value as a tag
26
+ const handleKeyDown = event => {
27
+ if (event.key === "Enter" && event.target) {
28
+ event.preventDefault();
29
+ addValue();
30
+ }
31
+ };
32
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(InputPrimitive, Object.assign({}, inputProps, vm.inputVm, {
33
+ onChange: inputValue,
34
+ onKeyDown: handleKeyDown,
35
+ startIcon: props.startIcon,
36
+ endIcon: /*#__PURE__*/React.createElement(IconButton, {
37
+ onClick: addValue,
38
+ icon: /*#__PURE__*/React.createElement(AddIcon, null),
39
+ variant: "ghost",
40
+ disabled: inputProps.disabled
41
+ })
42
+ })), vm.valuesVm.values.length > 0 && /*#__PURE__*/React.createElement("div", {
43
+ className: "wby-mt-sm wby-flex wby-flex-wrap wby-gap-xs"
44
+ }, vm.valuesVm.values.map(tag => /*#__PURE__*/React.createElement(Tag, {
45
+ key: tag.id,
46
+ content: tag.label,
47
+ onDismiss: !tag.protected ? () => removeValue(tag.label) : undefined,
48
+ variant: "neutral-muted"
49
+ }))));
50
+ };
51
+ const TagsPrimitive = makeDecoratable("TagsPrimitive", DecoratableTagsPrimitive);
52
+ export { TagsPrimitive };
53
+
54
+ //# sourceMappingURL=TagsPrimitive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useMemo","ReactComponent","AddIcon","makeDecoratable","useTags","InputPrimitive","Tag","IconButton","DecoratableTagsPrimitive","props","vm","inputValue","addValue","removeValue","inputProps","disabled","inputRef","invalid","onChange","placeholder","size","variant","handleKeyDown","event","key","target","preventDefault","createElement","Object","assign","inputVm","onKeyDown","startIcon","endIcon","onClick","icon","valuesVm","values","length","className","map","tag","id","content","label","onDismiss","protected","undefined","TagsPrimitive"],"sources":["TagsPrimitive.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { ReactComponent as AddIcon } from \"@webiny/icons/add.svg\";\nimport { makeDecoratable } from \"~/utils\";\nimport { useTags } from \"./useTags\";\nimport { InputPrimitive, type InputPrimitiveProps } from \"~/Input\";\nimport { Tag } from \"~/Tag\";\nimport { IconButton } from \"~/Button\";\nimport type { Icon } from \"~/Icon\";\n\ninterface TagsPrimitiveProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"onChange\"> {\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Indicates if the input field is invalid.\n */\n invalid?: boolean;\n /**\n * Callback triggered when a tag is added or removed.\n */\n onChange?: (values: string[]) => void;\n /**\n * Callback triggered when the input value changes.\n */\n onValueInput?: (value: string) => void;\n /**\n * Callback triggered when the value is added to the list.\n */\n onValueAdd?: (value: string) => void;\n /**\n * Callback triggered when a tag is removed.\n */\n onValueRemove?: (value: string) => void;\n /**\n * Placeholder text for the input field.\n */\n placeholder?: string;\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: React.ReactElement<typeof Icon> | React.ReactElement;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Optional selected item.\n */\n value?: string[];\n /**\n * Protected values cannot be removed by the user, these can be simple strings or regex patterns.\n */\n protectedValues?: string[];\n}\n\nconst DecoratableTagsPrimitive = (props: TagsPrimitiveProps) => {\n const { vm, inputValue, addValue, removeValue } = useTags(props);\n\n const inputProps: InputPrimitiveProps = useMemo(\n () => ({\n disabled: props.disabled,\n inputRef: props.inputRef,\n invalid: props.invalid,\n onChange: inputValue,\n placeholder: props.placeholder,\n size: props.size,\n variant: props.variant\n }),\n [props]\n );\n\n // When user press Enter, add the current input value as a tag\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\" && event.target) {\n event.preventDefault();\n addValue();\n }\n };\n\n return (\n <div>\n <InputPrimitive\n {...inputProps}\n {...vm.inputVm}\n onChange={inputValue}\n onKeyDown={handleKeyDown}\n startIcon={props.startIcon}\n endIcon={\n <IconButton\n onClick={addValue}\n icon={<AddIcon />}\n variant={\"ghost\"}\n disabled={inputProps.disabled}\n />\n }\n />\n\n {vm.valuesVm.values.length > 0 && (\n <div className={\"wby-mt-sm wby-flex wby-flex-wrap wby-gap-xs\"}>\n {vm.valuesVm.values.map(tag => (\n <Tag\n key={tag.id}\n content={tag.label}\n onDismiss={!tag.protected ? () => removeValue(tag.label) : undefined}\n variant={\"neutral-muted\"}\n />\n ))}\n </div>\n )}\n </div>\n );\n};\n\nconst TagsPrimitive = makeDecoratable(\"TagsPrimitive\", DecoratableTagsPrimitive);\n\nexport { TagsPrimitive, type TagsPrimitiveProps };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,cAAc,IAAIC,OAAO,QAAQ,uBAAuB;AACjE,SAASC,eAAe;AACxB,SAASC,OAAO;AAChB,SAASC,cAAc;AACvB,SAASC,GAAG;AACZ,SAASC,UAAU;AA6DnB,MAAMC,wBAAwB,GAAIC,KAAyB,IAAK;EAC5D,MAAM;IAAEC,EAAE;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAY,CAAC,GAAGT,OAAO,CAACK,KAAK,CAAC;EAEhE,MAAMK,UAA+B,GAAGd,OAAO,CAC3C,OAAO;IACHe,QAAQ,EAAEN,KAAK,CAACM,QAAQ;IACxBC,QAAQ,EAAEP,KAAK,CAACO,QAAQ;IACxBC,OAAO,EAAER,KAAK,CAACQ,OAAO;IACtBC,QAAQ,EAAEP,UAAU;IACpBQ,WAAW,EAAEV,KAAK,CAACU,WAAW;IAC9BC,IAAI,EAAEX,KAAK,CAACW,IAAI;IAChBC,OAAO,EAAEZ,KAAK,CAACY;EACnB,CAAC,CAAC,EACF,CAACZ,KAAK,CACV,CAAC;;EAED;EACA,MAAMa,aAAa,GAAIC,KAA4C,IAAK;IACpE,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,IAAID,KAAK,CAACE,MAAM,EAAE;MACvCF,KAAK,CAACG,cAAc,CAAC,CAAC;MACtBd,QAAQ,CAAC,CAAC;IACd;EACJ,CAAC;EAED,oBACIb,KAAA,CAAA4B,aAAA,2BACI5B,KAAA,CAAA4B,aAAA,CAACtB,cAAc,EAAAuB,MAAA,CAAAC,MAAA,KACPf,UAAU,EACVJ,EAAE,CAACoB,OAAO;IACdZ,QAAQ,EAAEP,UAAW;IACrBoB,SAAS,EAAET,aAAc;IACzBU,SAAS,EAAEvB,KAAK,CAACuB,SAAU;IAC3BC,OAAO,eACHlC,KAAA,CAAA4B,aAAA,CAACpB,UAAU;MACP2B,OAAO,EAAEtB,QAAS;MAClBuB,IAAI,eAAEpC,KAAA,CAAA4B,aAAA,CAACzB,OAAO,MAAE,CAAE;MAClBmB,OAAO,EAAE,OAAQ;MACjBN,QAAQ,EAAED,UAAU,CAACC;IAAS,CACjC;EACJ,EACJ,CAAC,EAEDL,EAAE,CAAC0B,QAAQ,CAACC,MAAM,CAACC,MAAM,GAAG,CAAC,iBAC1BvC,KAAA,CAAA4B,aAAA;IAAKY,SAAS,EAAE;EAA8C,GACzD7B,EAAE,CAAC0B,QAAQ,CAACC,MAAM,CAACG,GAAG,CAACC,GAAG,iBACvB1C,KAAA,CAAA4B,aAAA,CAACrB,GAAG;IACAkB,GAAG,EAAEiB,GAAG,CAACC,EAAG;IACZC,OAAO,EAAEF,GAAG,CAACG,KAAM;IACnBC,SAAS,EAAE,CAACJ,GAAG,CAACK,SAAS,GAAG,MAAMjC,WAAW,CAAC4B,GAAG,CAACG,KAAK,CAAC,GAAGG,SAAU;IACrE1B,OAAO,EAAE;EAAgB,CAC5B,CACJ,CACA,CAER,CAAC;AAEd,CAAC;AAED,MAAM2B,aAAa,GAAG7C,eAAe,CAAC,eAAe,EAAEK,wBAAwB,CAAC;AAEhF,SAASwC,aAAa","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { TagsPrimitive } from "./TagsPrimitive";
3
+ declare const meta: Meta<typeof TagsPrimitive>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TagsPrimitive>;
6
+ export declare const Default: Story;
7
+ export declare const MediumSize: Story;
8
+ export declare const LargeSize: Story;
9
+ export declare const ExtraLargeSize: Story;
10
+ export declare const PrimaryVariant: Story;
11
+ export declare const PrimaryVariantDisabled: Story;
12
+ export declare const PrimaryVariantInvalid: Story;
13
+ export declare const SecondaryVariant: Story;
14
+ export declare const SecondaryVariantDisabled: Story;
15
+ export declare const SecondaryVariantInvalid: Story;
16
+ export declare const GhostVariant: Story;
17
+ export declare const GhostVariantDisabled: Story;
18
+ export declare const GhostVariantInvalid: Story;
19
+ export declare const GhostNegativeVariant: Story;
20
+ export declare const GhostNegativeVariantDisabled: Story;
21
+ export declare const GhostNegativeVariantInvalid: Story;
22
+ export declare const WithCustomPlaceholder: Story;
23
+ export declare const WithStartIcon: Story;
24
+ export declare const WithInitialValues: Story;
25
+ export declare const WithProtectedValues: Story;
26
+ export declare const WithExternalValueControl: Story;