@economic/taco 2.19.0 → 2.20.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (329) hide show
  1. package/dist/components/Provider/Localization.d.ts +18 -0
  2. package/dist/components/Report/components/Body/Body.d.ts +8 -0
  3. package/dist/components/Report/components/Cell/Cell.d.ts +3 -0
  4. package/dist/components/Report/components/Cell/DisplayCell.d.ts +7 -0
  5. package/dist/components/Report/components/Cell/GroupedCell.d.ts +7 -0
  6. package/dist/components/Report/components/Cell/util.d.ts +18 -0
  7. package/dist/components/Report/components/Footer/Footer.d.ts +6 -0
  8. package/dist/components/Report/components/Footer/Summary.d.ts +7 -0
  9. package/dist/components/Report/components/Header/Header.d.ts +37 -0
  10. package/dist/components/Report/components/Header/components/Goto.d.ts +6 -0
  11. package/dist/components/Report/components/Header/components/Menu.d.ts +17 -0
  12. package/dist/components/Report/components/Header/components/Resizer.d.ts +12 -0
  13. package/dist/components/Report/components/Header/components/SortIndicator.d.ts +15 -0
  14. package/dist/components/Report/components/Header/util.d.ts +4 -0
  15. package/dist/components/Report/components/Internal/Actions.d.ts +13 -0
  16. package/dist/components/Report/components/Internal/Expansion.d.ts +4 -0
  17. package/dist/components/Report/components/Internal/Selection.d.ts +4 -0
  18. package/dist/components/Report/components/Row/DisplayRow.d.ts +16 -0
  19. package/dist/components/Report/components/Row/Row.d.ts +8 -0
  20. package/dist/components/Report/components/Row/RowContext.d.ts +9 -0
  21. package/dist/components/Report/components/Row/SkeletonRow.d.ts +10 -0
  22. package/dist/components/Report/components/Toolbar/Toolbar.d.ts +15 -0
  23. package/dist/components/Report/components/Toolbar/components/Filters/Filters.d.ts +7 -0
  24. package/dist/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +7 -0
  25. package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +12 -0
  26. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +9 -0
  27. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterComparator.d.ts +7 -0
  28. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterValue.d.ts +10 -0
  29. package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +12 -0
  30. package/dist/components/Report/components/Toolbar/components/Filters/util.d.ts +2 -0
  31. package/dist/components/Report/components/Toolbar/components/Print/Print.d.ts +9 -0
  32. package/dist/components/Report/components/Toolbar/components/Print/PrintDialog.d.ts +17 -0
  33. package/dist/components/Report/components/Toolbar/components/Search/Search.d.ts +8 -0
  34. package/dist/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +7 -0
  35. package/dist/components/Report/components/Toolbar/components/Settings/Settings.d.ts +8 -0
  36. package/dist/components/Report/features/useReportExport.d.ts +3 -0
  37. package/dist/components/Report/styles/useColumnPinningStylesheet.d.ts +2 -0
  38. package/dist/components/Report/styles/useCssGridStylesheet.d.ts +3 -0
  39. package/dist/components/Report/styles/useStylesheet.d.ts +3 -0
  40. package/dist/components/Report/styles/util.d.ts +3 -0
  41. package/dist/components/Report/types.d.ts +20 -0
  42. package/dist/components/Report/useReport.d.ts +14 -0
  43. package/dist/components/Report/util/rows.d.ts +7 -0
  44. package/dist/components/Report/util/useTableGlobalShortcuts.d.ts +4 -0
  45. package/dist/components/Report/util/useTableRenderer.d.ts +9 -0
  46. package/dist/components/Table3/components/rows/Row.d.ts +1 -1
  47. package/dist/components/Table3/hooks/features/usePrinting.d.ts +7 -0
  48. package/dist/components/Table3/hooks/useTable.d.ts +5 -5
  49. package/dist/components/Table3/types.d.ts +21 -3
  50. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +1 -1
  51. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Alert/Alert.js +1 -1
  53. package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +1 -1
  55. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +2 -2
  57. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Badge/Badge.js +1 -1
  59. package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js +1 -1
  61. package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
  63. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Button/Button.js +1 -1
  65. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +1 -1
  67. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
  69. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +1 -1
  71. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +1 -1
  73. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +1 -1
  75. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +5 -5
  77. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js +1 -1
  79. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js +1 -1
  81. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +1 -1
  83. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +1 -1
  85. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Drawer/util.js +1 -1
  87. package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Field/Field.js +1 -1
  89. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Form/Form.js +1 -1
  91. package/dist/esm/packages/taco/src/components/Form/Form.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
  93. package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +2 -2
  95. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Header/Header.js +1 -1
  97. package/dist/esm/packages/taco/src/components/Header/Header.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js +1 -1
  99. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js +2 -2
  101. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +2 -2
  103. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Header/components/Button.js +1 -1
  105. package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Header/components/Link.js +1 -1
  107. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Header/components/Logo.js +1 -1
  109. package/dist/esm/packages/taco/src/components/Header/components/Logo.js.map +1 -1
  110. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +1 -1
  111. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +1 -1
  113. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js +1 -1
  117. package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Icon/Icon.js +1 -1
  119. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js +1 -1
  121. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
  123. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
  125. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Layout/Layout.js +2 -2
  127. package/dist/esm/packages/taco/src/components/Layout/Layout.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Layout/components/Content.js +2 -2
  129. package/dist/esm/packages/taco/src/components/Layout/components/Content.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Layout/components/Page.js +2 -2
  131. package/dist/esm/packages/taco/src/components/Layout/components/Page.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +2 -2
  133. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Listbox/Listbox.js +1 -1
  135. package/dist/esm/packages/taco/src/components/Listbox/Listbox.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
  137. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
  139. package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
  141. package/dist/esm/packages/taco/src/components/Menu/components/Header.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
  143. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  144. package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js +1 -1
  145. package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js.map +1 -1
  146. package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js +1 -1
  147. package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js.map +1 -1
  148. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +1 -1
  149. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  150. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +1 -1
  151. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  152. package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js +1 -1
  153. package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js.map +1 -1
  154. package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js +1 -1
  155. package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js.map +1 -1
  156. package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js +1 -1
  157. package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js.map +1 -1
  158. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +2 -2
  159. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  160. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +1 -1
  161. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  162. package/dist/esm/packages/taco/src/components/Navigation2/components/util.js +1 -1
  163. package/dist/esm/packages/taco/src/components/Navigation2/components/util.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
  165. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +1 -1
  167. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  168. package/dist/esm/packages/taco/src/components/Popover/Popover.js +1 -1
  169. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  170. package/dist/esm/packages/taco/src/components/Progress/Progress.js +1 -1
  171. package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
  172. package/dist/esm/packages/taco/src/components/Provider/Localization.js +18 -0
  173. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  174. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +1 -1
  175. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  176. package/dist/esm/packages/taco/src/components/RadioGroup/util.js +1 -1
  177. package/dist/esm/packages/taco/src/components/RadioGroup/util.js.map +1 -1
  178. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +1 -1
  179. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  180. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +3 -3
  181. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  182. package/dist/esm/packages/taco/src/components/Select/Select.js +1 -1
  183. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  184. package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
  185. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  186. package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
  187. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  188. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +1 -1
  189. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  190. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  191. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  192. package/dist/esm/packages/taco/src/components/Select2/components/Group.js +1 -1
  193. package/dist/esm/packages/taco/src/components/Select2/components/Group.js.map +1 -1
  194. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
  195. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  196. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +1 -1
  197. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  198. package/dist/esm/packages/taco/src/components/Select2/components/Title.js +1 -1
  199. package/dist/esm/packages/taco/src/components/Select2/components/Title.js.map +1 -1
  200. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +2 -2
  201. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  202. package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
  203. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  204. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
  205. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  206. package/dist/esm/packages/taco/src/components/Spinner/Spinner.js +1 -1
  207. package/dist/esm/packages/taco/src/components/Spinner/Spinner.js.map +1 -1
  208. package/dist/esm/packages/taco/src/components/Switch/Switch.js +1 -1
  209. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  210. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +2 -2
  211. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  212. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
  213. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  214. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +1 -1
  215. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  216. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +1 -1
  217. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
  218. package/dist/esm/packages/taco/src/components/Table3/Table3.js +1 -6
  219. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  220. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +1 -1
  221. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  222. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +4 -2
  223. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  224. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -1
  225. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  226. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +2 -2
  227. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -1
  228. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js +1 -1
  229. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js.map +1 -1
  230. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +2 -2
  231. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  232. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +1 -1
  233. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
  234. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
  235. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  236. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +5 -2
  237. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  238. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +1 -1
  239. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  240. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js +1 -1
  241. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js.map +1 -1
  242. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -1
  243. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  244. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +1 -1
  245. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  246. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +1 -1
  247. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  248. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +1 -1
  249. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  250. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +1 -1
  251. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  252. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +2 -2
  253. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  254. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +1 -1
  255. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  256. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +1 -1
  257. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
  258. package/dist/esm/packages/taco/src/{primitives/Table/useTable/features/useTablePrinting.js → components/Table3/hooks/features/usePrinting.js} +3 -3
  259. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +1 -0
  260. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +4 -3
  261. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  262. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  263. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +1 -1
  264. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  265. package/dist/esm/packages/taco/src/components/Tag/Tag.js +2 -2
  266. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  267. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +1 -1
  268. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
  269. package/dist/esm/packages/taco/src/components/Toast/Toast.js +2 -2
  270. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  271. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +2 -2
  272. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  273. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +1 -1
  274. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  275. package/dist/esm/packages/taco/src/primitives/Table/types.js +27 -0
  276. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
  277. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +1 -1
  278. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -1
  279. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +11 -21
  280. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -1
  281. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -1
  282. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +1 -1
  283. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -1
  284. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +1 -0
  285. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -1
  286. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +42 -2
  287. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -1
  288. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +10 -8
  289. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
  290. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +7 -0
  291. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -0
  292. package/dist/esm/packages/taco/src/utils/dom.js +10 -1
  293. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  294. package/dist/primitives/Table/types.d.ts +187 -2
  295. package/dist/primitives/Table/useTable/features/useTableColumnFreezing.d.ts +6 -0
  296. package/dist/primitives/Table/useTable/features/useTableFooter.d.ts +3 -0
  297. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +1 -0
  298. package/dist/primitives/Table/useTable/features/useTableRef.d.ts +4 -0
  299. package/dist/primitives/Table/useTable/features/useTableRowActions.d.ts +6 -0
  300. package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +0 -1
  301. package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +1 -1
  302. package/dist/primitives/Table/useTable/features/useTableRowExpansion.d.ts +5 -0
  303. package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +1 -1
  304. package/dist/primitives/Table/useTable/features/useTableRowGroups.d.ts +5 -0
  305. package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +1 -0
  306. package/dist/primitives/Table/useTable/features/useTableSearch.d.ts +11 -0
  307. package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +5 -2
  308. package/dist/primitives/Table/useTable/features/useTableSettings.d.ts +3 -0
  309. package/dist/primitives/Table/useTable/listeners/useTableRowHeightListener.d.ts +2 -0
  310. package/dist/primitives/Table/useTable/listeners/useTableSearchListener.d.ts +2 -0
  311. package/dist/primitives/Table/useTable/listeners/useTableSettingsListener.d.ts +3 -0
  312. package/dist/primitives/Table/useTable/useTable.d.ts +57 -0
  313. package/dist/primitives/Table/useTable/util/columns.d.ts +7 -1
  314. package/dist/primitives/Table/useTable/util/columns.spec.d.ts +1 -0
  315. package/dist/primitives/Table/useTable/util/filtering.d.ts +7 -0
  316. package/dist/primitives/Table/useTable/util/presets.d.ts +2 -0
  317. package/dist/primitives/Table/useTable/util/search.d.ts +2 -0
  318. package/dist/primitives/Table/useTable/util/settings.d.ts +13 -0
  319. package/dist/primitives/Table/useTable/util/setup.d.ts +14 -0
  320. package/dist/primitives/Table/useTable/util/sorting.d.ts +2 -0
  321. package/dist/primitives/Table/useTableDataLoader.d.ts +23 -0
  322. package/dist/taco.cjs.development.js +149 -68
  323. package/dist/taco.cjs.development.js.map +1 -1
  324. package/dist/taco.cjs.production.min.js +1 -1
  325. package/dist/taco.cjs.production.min.js.map +1 -1
  326. package/dist/utils/dom.d.ts +1 -0
  327. package/package.json +4 -3
  328. package/types.json +20882 -7749
  329. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { useState, useMemo, useRef, useEffect, createElement, Fragment, cloneElement } from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { useMergedRef } from '../../hooks/useMergedRef.js';
4
4
  import { useLocalization } from '../Provider/Localization.js';
5
5
  import { v4 } from 'uuid';
@@ -1 +1 @@
1
- {"version":3,"file":"useSelect.js","sources":["../../../../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useLocalization } from '../Provider/Localization';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick,\n onChange,\n readOnly,\n tabIndex,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useMergedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n } else {\n if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.key) {\n case 'Escape': {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n disabled: disabled || readOnly,\n id: buttonId,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n tabIndex,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: open => {\n if (!open && onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n setOpen(open);\n },\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","id","nativeId","multiselect","onBlur","onClick","onChange","readOnly","tabIndex","value","otherProps","ref","texts","useLocalization","flattenedData","useFlattenedData","listboxInputRef","useMergedRef","open","setOpen","React","uuid","inputRef","buttonId","lastValue","setLastValue","undefined","findByValue","setInputValueByRef","current","length","handleButtonKeyDown","event","key","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","createCustomEvent","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","_findByValue$text","_findByValue","icon","className","cn","props","handleInputChange","persist","_item$path$split","_item$path","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","input","String","popover","onOpenChange"],"mappings":";;;;;;;;MAyBaA,SAAS,GAAGA,CACrB;EACI,YAAY,EAAEC,SAAS;EACvB,iBAAiB,EAAEC,cAAc;EACjCC,IAAI,GAAG,EAAE;EACTC,YAAY;EACZC,QAAQ;EACRC,UAAU;EACVC,EAAE,EAAEC,QAAQ;EACZC,WAAW;EACXC,MAAM;EACNC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,KAAK;EACL,GAAGC;CACO,EACdC,GAAgC;EAEhC,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,aAAa,GAAGC,gBAAgB,CAAClB,IAAI,CAAC;EAC5C,MAAMmB,eAAe,GAAGC,YAAY,CAAmBN,GAAG,CAAC;EAC3D,MAAM,CAACO,IAAI,EAAEC,OAAO,CAAC,GAAGC,QAAc,CAAC,KAAK,CAAC;EAC7C,MAAMnB,EAAE,GAAGmB,OAAa,CAAC,MAAMlB,QAAQ,cAAcmB,EAAI,IAAI,EAAE,CAACnB,QAAQ,CAAC,CAAC;EAC1E,MAAMoB,QAAQ,GAAGF,MAAY,CAAmB,IAAI,CAAC;EACrD,MAAMG,QAAQ,MAAMtB,WAAW;;EAE/B,MAAM,CAACuB,SAAS,EAAEC,YAAY,CAAC,GAAGL,QAAc,CAAsCX,KAAK,CAAC;EAE5FW,SAAe,CAAC;IACZK,YAAY,CAAChB,KAAK,CAAC;GACtB,EAAE,CAACS,IAAI,CAAC,CAAC;EAEVE,SAAe,CAAC;IACZ,IAAIX,KAAK,KAAKiB,SAAS,EAAE;MACrB,IAAI5B,YAAY,KAAK4B,SAAS,IAAIC,WAAW,CAACb,aAAa,EAAEhB,YAAY,CAAC,EAAE;QACxE8B,kBAAk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3,"file":"useSelect.js","sources":["../../../../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { v4 as uuid } from 'uuid';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useLocalization } from '../Provider/Localization';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick,\n onChange,\n readOnly,\n tabIndex,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useMergedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n } else {\n if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.key) {\n case 'Escape': {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n disabled: disabled || readOnly,\n id: buttonId,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n tabIndex,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: open => {\n if (!open && onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n setOpen(open);\n },\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","id","nativeId","multiselect","onBlur","onClick","onChange","readOnly","tabIndex","value","otherProps","ref","texts","useLocalization","flattenedData","useFlattenedData","listboxInputRef","useMergedRef","open","setOpen","React","uuid","inputRef","buttonId","lastValue","setLastValue","undefined","findByValue","setInputValueByRef","current","length","handleButtonKeyDown","event","key","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","createCustomEvent","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","_findByValue$text","_findByValue","icon","className","cn","props","handleInputChange","persist","_item$path$split","_item$path","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","input","String","popover","onOpenChange"],"mappings":";;;;;;;;MAyBaA,SAAS,GAAGA,CACrB;EACI,YAAY,EAAEC,SAAS;EACvB,iBAAiB,EAAEC,cAAc;EACjCC,IAAI,GAAG,EAAE;EACTC,YAAY;EACZC,QAAQ;EACRC,UAAU;EACVC,EAAE,EAAEC,QAAQ;EACZC,WAAW;EACXC,MAAM;EACNC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,KAAK;EACL,GAAGC;CACO,EACdC,GAAgC;EAEhC,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,aAAa,GAAGC,gBAAgB,CAAClB,IAAI,CAAC;EAC5C,MAAMmB,eAAe,GAAGC,YAAY,CAAmBN,GAAG,CAAC;EAC3D,MAAM,CAACO,IAAI,EAAEC,OAAO,CAAC,GAAGC,QAAc,CAAC,KAAK,CAAC;EAC7C,MAAMnB,EAAE,GAAGmB,OAAa,CAAC,MAAMlB,QAAQ,cAAcmB,EAAI,IAAI,EAAE,CAACnB,QAAQ,CAAC,CAAC;EAC1E,MAAMoB,QAAQ,GAAGF,MAAY,CAAmB,IAAI,CAAC;EACrD,MAAMG,QAAQ,MAAMtB,WAAW;;EAE/B,MAAM,CAACuB,SAAS,EAAEC,YAAY,CAAC,GAAGL,QAAc,CAAsCX,KAAK,CAAC;EAE5FW,SAAe,CAAC;IACZK,YAAY,CAAChB,KAAK,CAAC;GACtB,EAAE,CAACS,IAAI,CAAC,CAAC;EAEVE,SAAe,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EAAE;UACjBA,MAAM,CAACkC,iBAAiB,CAAC,MAAM,CAAC,CAAC;;QAErCnB,OAAO,CAACD,IAAI,CAAC;;KAEpB;IACDqB,IAAI;IACJC;GACH;AACL;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { useMergedRef } from '../../hooks/useMergedRef.js';
4
4
  import { useLocalization } from '../Provider/Localization.js';
5
5
  import { Root, Trigger, Portal, Content } from '@radix-ui/react-popover';
@@ -1 +1 @@
1
- {"version":3,"file":"Select2.js","sources":["../../../../../../../src/components/Select2/Select2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as ListboxPrimitive from '../../primitives/Listbox2/Listbox2';\nimport {\n Select2Children,\n Select2CreateHandler,\n Select2DeleteHandler,\n Select2EditHandler,\n Select2OptionValue,\n Select2Value,\n} from './types';\nimport { Option, Select2OptionProps } from './components/Option';\nimport { Group, Select2GroupProps } from './components/Group';\nimport { Select2TitleProps, Title } from './components/Title';\nimport { Select2Context } from './components/Context';\nimport { createCollectionClassName } from './utilities';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { Trigger } from './components/Trigger';\nimport { useIsFormControl } from '../../hooks/useIsFormControl';\nimport { BubbleSelect } from '../../primitives/BubbleSelect';\nimport { Search } from './components/Search';\nimport { useChildren } from './hooks/useChildren';\n\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\nimport { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused';\nimport { isAriaDirectionKey } from '../../utils/aria';\nimport { getNextFocussableElement } from '../../utils/dom';\nimport { FontSize } from '../../types';\n\ntype Select2Texts = {\n allSelect: string;\n allDeselect: string;\n cancel: string;\n chooseColor: string;\n create: string;\n delete: string;\n save: string;\n search: string;\n searchOrCreate: string;\n};\n\ntype Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n autoFocus?: boolean;\n children: Select2Children;\n defaultValue?: Select2Value;\n emptyValue?: Select2OptionValue;\n disabled?: boolean;\n highlighted?: boolean;\n invalid?: boolean;\n multiple?: boolean;\n name?: string;\n onChange?: (value: Select2Value) => void;\n onCreate?: Select2CreateHandler;\n onDelete?: Select2DeleteHandler;\n onEdit?: Select2EditHandler;\n readOnly?: boolean;\n required?: boolean;\n tags?: boolean;\n value?: Select2Value;\n fontSize?: FontSize;\n placeholder?: string;\n};\ntype Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {\n Option: React.ForwardRefExoticComponent<Select2OptionProps>;\n Group: React.ForwardRefExoticComponent<Select2GroupProps>;\n Title: React.ForwardRefExoticComponent<Select2TitleProps>;\n};\n\nconst Select2 = React.forwardRef<HTMLButtonElement, Select2Props>(function Select2(props, ref) {\n const {\n children: initChildren,\n defaultValue: defaultProp,\n disabled = false,\n emptyValue = undefined,\n placeholder,\n highlighted = false,\n invalid = false,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n readOnly = false,\n tags = false,\n value: prop,\n fontSize,\n ...otherProps\n } = props;\n\n const emptyOption: React.ReactElement<Select2OptionProps> | undefined = React.useMemo(() => {\n if (emptyValue !== undefined && !multiple) {\n // Empty option has 0px height, because it's empty, so need to apply height manually\n return <Option key=\"__empty\" children=\"\" value={emptyValue} className=\"h-8\" />;\n }\n return;\n }, [emptyValue, multiple]);\n\n const initialChildren = React.useMemo(() => {\n if (emptyOption) {\n return [emptyOption, ...initChildren] as Select2Children;\n }\n return initChildren;\n }, [emptyOption, initChildren]);\n\n // refs\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const listboxRef = React.useRef<CollectionRef>(null);\n const searchRef = React.useRef<HTMLInputElement>(null);\n const { texts } = useLocalization();\n // align the listbox min width with the width of the input - it should never be smaller\n const dimensions = useBoundingClientRectListener(internalRef);\n\n // state\n const [tabTriggeredClose, setTabTriggeredClose] = React.useState(false);\n const [open, setOpen] = React.useState(false);\n const [value, _setValue] = useControllableState<Select2Value>({\n // uncontrolled\n defaultProp,\n // controlled\n onChange,\n prop,\n });\n const setValue = ListboxPrimitive.createListboxValueSetter(multiple, _setValue);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n const [shouldPauseHoverState, setShouldPauseHoverState] = useIsHoverStatePaused();\n\n const { flattenedChildren, filteredChildren, searchQuery, setSearchQuery } = useChildren({\n children: initialChildren,\n emptyValue,\n multiple,\n open,\n setValue,\n value,\n });\n\n // context\n const context = {\n disabled,\n highlighted,\n invalid,\n listboxRef,\n multiple,\n onCreate,\n onDelete,\n onEdit,\n open,\n readOnly,\n ref: internalRef,\n searchQuery,\n searchRef,\n setOpen,\n setSearchQuery,\n setValidationError,\n setValue,\n shouldPauseHoverState,\n setShouldPauseHoverState,\n tags,\n fontSize,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {\n setOpen(true);\n }\n\n // the focus should always remain on the input, so we forward events on to the listbox\n listboxRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n };\n\n let handleBlur;\n\n if (otherProps.onBlur) {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n const elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {\n otherProps.onBlur?.(event);\n }\n };\n }\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (isAriaDirectionKey(event)) {\n setShouldPauseHoverState(true);\n }\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (tabTriggeredClose) {\n const nextFocussableElement = getNextFocussableElement(internalRef.current);\n\n if (nextFocussableElement) {\n // UX requirement: move focus to the next focussable element when tab key is pressed to select the value\n nextFocussableElement.focus();\n // Reset the tabTriggeredClose state\n setTabTriggeredClose(false);\n }\n } else {\n internalRef.current?.focus();\n }\n };\n\n const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none', createCollectionClassName());\n\n return (\n <Select2Context.Provider value={context}>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <ControlledHiddenField\n emptyValue={emptyValue}\n multiple={multiple || tags}\n name={name}\n options={flattenedChildren.map(child => child.props.value)}\n parentRef={internalRef}\n setValue={setValue}\n value={value}\n />\n <PopoverPrimitive.Trigger asChild data-taco=\"Select2\">\n <Trigger\n {...otherProps}\n aria-haspopup=\"listbox\"\n emptyValue={emptyValue}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n ref={internalRef}\n placeholder={placeholder}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={() => {\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={handleCloseAutoFocus}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {flattenedChildren.length > 0 || onCreate ? (\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n onTabKeyPress={() => setTabTriggeredClose(true)}\n />\n ) : null}\n {flattenedChildren.length <= 0 ? (\n <div className=\"text-grey-700 -mt-0.5 flex h-8 items-center px-2\" role=\"presentation\">\n No results found...\n </div>\n ) : (\n <ListboxPrimitive.Root\n className=\"flex flex-col gap-0.5\"\n customSelector=\":scope > button\"\n disabled={disabled}\n multiple={multiple}\n onKeyDown={handleListboxKeyDown}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {searchQuery === '' ? (\n <Collection>{initialChildren}</Collection>\n ) : (\n <Collection>{filteredChildren}</Collection>\n )}\n {onCreate ? <Create onCreate={onCreate} options={flattenedChildren} /> : null}\n </ListboxPrimitive.Root>\n )}\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </Select2Context.Provider>\n );\n}) as Select2PropsWithStatics;\nSelect2.Option = Option;\nSelect2.Group = Group;\nSelect2.Title = Title;\n\nconst ControlledHiddenField = props => {\n const { emptyValue, multiple, name, options, parentRef, value, setValue } = props;\n const isFormControl = useIsFormControl(parentRef, () => setValue(multiple ? [] : undefined));\n\n let bubbleValue;\n\n if (isFormControl) {\n if (value !== undefined) {\n if (multiple) {\n bubbleValue = Array.isArray(value) ? value.map(String) : [value === null ? '' : String(value)];\n } else {\n bubbleValue = value === null ? '' : String(value);\n }\n }\n\n return (\n <BubbleSelect aria-hidden key={String(bubbleValue)} multiple={multiple} name={name} value={bubbleValue}>\n {emptyValue !== undefined ? <option value={emptyValue} /> : null}\n {options.map(option => (\n <option key={String(option)} value={String(option)} />\n ))}\n </BubbleSelect>\n );\n }\n\n return null;\n};\nSelect2.displayName = 'Select2';\n\nexport { Select2 };\n\nexport type {\n Select2Texts,\n Select2GroupProps,\n Select2OptionProps,\n Select2OptionValue,\n Select2Value,\n Select2Props,\n Select2TitleProps,\n};\n"],"names":["Select2","React","forwardRef","props","ref","children","initChildren","defaultValue","defaultProp","disabled","emptyValue","undefined","placeholder","highlighted","invalid","multiple","name","onChange","onCreate","onDelete","onEdit","readOnly","tags","value","prop","fontSize","otherProps","emptyOption","useMemo","Option","key","className","initialChildren","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","tabTriggeredClose","setTabTriggeredClose","useState","open","setOpen","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","shouldPauseHoverState","setShouldPauseHoverState","useIsHoverStatePaused","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","ctrlKey","metaKey","test","_listboxRef$current","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","_elementGainingFocus$","closest","id","currentTarget","getAttribute","_otherProps$onBlur","call","handleListboxKeyDown","isAriaDirectionKey","handleCloseAutoFocus","stopPropagation","nextFocussableElement","getNextFocussableElement","focus","_internalRef$current","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","ControlledHiddenField","options","map","child","parentRef","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","_internalRef$current2","onCloseAutoFocus","sideOffset","tabIndex","style","minWidth","width","length","Search","select2","searchOrCreate","search","onTabKeyPress","role","customSelector","Collection","Create","Group","Title","isFormControl","useIsFormControl","bubbleValue","Array","isArray","String","BubbleSelect","option","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2EMA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAkC,SAASF,OAAOA,CAACG,KAAK,EAAEC,GAAG;EACzF,MAAM;IACFC,QAAQ,EAAEC,YAAY;IACtBC,YAAY,EAAEC,WAAW;IACzBC,QAAQ,GAAG,KAAK;IAChBC,UAAU,GAAGC,SAAS;IACtBC,WAAW;IACXC,WAAW,GAAG,KAAK;IACnBC,OAAO,GAAG,KAAK;IACfC,QAAQ,GAAG,KAAK;IAChBC,IAAI;IACJC,QAAQ;IACRC,QAAQ;IACRC,QAAQ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E,KAAK;IAAE0B;GAAU,GAAG9C,KAAK;EACjF,MAAM4H,aAAa,GAAGC,gBAAgB,CAAC1B,SAAS,EAAE,MAAMrD,QAAQ,CAAClC,QAAQ,GAAG,EAAE,GAAGJ,SAAS,CAAC,CAAC;EAE5F,IAAIsH,WAAW;EAEf,IAAIF,aAAa,EAAE;IACf,IAAIxG,KAAK,KAAKZ,SAAS,EAAE;MACrB,IAAII,QAAQ,EAAE;QACVkH,WAAW,GAAGC,KAAK,CAACC,OAAO,CAAC5G,KAAK,CAAC,GAAGA,KAAK,CAAC6E,GAAG,CAACgC,MAAM,CAAC,GAAG,CAAC7G,KAAK,KAAK,IAAI,GAAG,EAAE,GAAG6G,MAAM,CAAC7G,KAAK,CAAC,CAAC;OACjG,MAAM;QACH0G,WAAW,GAAG1G,KAAK,KAAK,IAAI,GAAG,EAAE,GAAG6G,MAAM,CAAC7G,KAAK,CAAC;;;IAIzD,oBACItB,6BAACoI,YAAY;;MAAavG,GAAG,EAAEsG,MAAM,CAACH,WAAW,CAAC;MAAElH,QAAQ,EAAEA,QAAQ;MAAEC,IAAI,EAAEA,IAAI;MAAEO,KAAK,EAAE0G;OACtFvH,UAAU,KAAKC,SAAS,gBAAGV;MAAQsB,KAAK,EAAEb;MAAc,GAAG,IAAI,EAC/DyF,OAAO,CAACC,GAAG,CAACkC,MAAM,mBACfrI;MAAQ6B,GAAG,EAAEsG,MAAM,CAACE,MAAM,CAAC;MAAE/G,KAAK,EAAE6G,MAAM,CAACE,MAAM;MAAK,CACzD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACDtI,OAAO,CAACuI,WAAW,GAAG,SAAS;;;;"}
1
+ {"version":3,"file":"Select2.js","sources":["../../../../../../../src/components/Select2/Select2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as ListboxPrimitive from '../../primitives/Listbox2/Listbox2';\nimport {\n Select2Children,\n Select2CreateHandler,\n Select2DeleteHandler,\n Select2EditHandler,\n Select2OptionValue,\n Select2Value,\n} from './types';\nimport { Option, Select2OptionProps } from './components/Option';\nimport { Group, Select2GroupProps } from './components/Group';\nimport { Select2TitleProps, Title } from './components/Title';\nimport { Select2Context } from './components/Context';\nimport { createCollectionClassName } from './utilities';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { Trigger } from './components/Trigger';\nimport { useIsFormControl } from '../../hooks/useIsFormControl';\nimport { BubbleSelect } from '../../primitives/BubbleSelect';\nimport { Search } from './components/Search';\nimport { useChildren } from './hooks/useChildren';\n\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\nimport { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused';\nimport { isAriaDirectionKey } from '../../utils/aria';\nimport { getNextFocussableElement } from '../../utils/dom';\nimport { FontSize } from '../../types';\n\ntype Select2Texts = {\n allSelect: string;\n allDeselect: string;\n cancel: string;\n chooseColor: string;\n create: string;\n delete: string;\n save: string;\n search: string;\n searchOrCreate: string;\n};\n\ntype Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n autoFocus?: boolean;\n children: Select2Children;\n defaultValue?: Select2Value;\n emptyValue?: Select2OptionValue;\n disabled?: boolean;\n highlighted?: boolean;\n invalid?: boolean;\n multiple?: boolean;\n name?: string;\n onChange?: (value: Select2Value) => void;\n onCreate?: Select2CreateHandler;\n onDelete?: Select2DeleteHandler;\n onEdit?: Select2EditHandler;\n readOnly?: boolean;\n required?: boolean;\n tags?: boolean;\n value?: Select2Value;\n fontSize?: FontSize;\n placeholder?: string;\n};\ntype Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {\n Option: React.ForwardRefExoticComponent<Select2OptionProps>;\n Group: React.ForwardRefExoticComponent<Select2GroupProps>;\n Title: React.ForwardRefExoticComponent<Select2TitleProps>;\n};\n\nconst Select2 = React.forwardRef<HTMLButtonElement, Select2Props>(function Select2(props, ref) {\n const {\n children: initChildren,\n defaultValue: defaultProp,\n disabled = false,\n emptyValue = undefined,\n placeholder,\n highlighted = false,\n invalid = false,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n readOnly = false,\n tags = false,\n value: prop,\n fontSize,\n ...otherProps\n } = props;\n\n const emptyOption: React.ReactElement<Select2OptionProps> | undefined = React.useMemo(() => {\n if (emptyValue !== undefined && !multiple) {\n // Empty option has 0px height, because it's empty, so need to apply height manually\n return <Option key=\"__empty\" children=\"\" value={emptyValue} className=\"h-8\" />;\n }\n return;\n }, [emptyValue, multiple]);\n\n const initialChildren = React.useMemo(() => {\n if (emptyOption) {\n return [emptyOption, ...initChildren] as Select2Children;\n }\n return initChildren;\n }, [emptyOption, initChildren]);\n\n // refs\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const listboxRef = React.useRef<CollectionRef>(null);\n const searchRef = React.useRef<HTMLInputElement>(null);\n const { texts } = useLocalization();\n // align the listbox min width with the width of the input - it should never be smaller\n const dimensions = useBoundingClientRectListener(internalRef);\n\n // state\n const [tabTriggeredClose, setTabTriggeredClose] = React.useState(false);\n const [open, setOpen] = React.useState(false);\n const [value, _setValue] = useControllableState<Select2Value>({\n // uncontrolled\n defaultProp,\n // controlled\n onChange,\n prop,\n });\n const setValue = ListboxPrimitive.createListboxValueSetter(multiple, _setValue);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n const [shouldPauseHoverState, setShouldPauseHoverState] = useIsHoverStatePaused();\n\n const { flattenedChildren, filteredChildren, searchQuery, setSearchQuery } = useChildren({\n children: initialChildren,\n emptyValue,\n multiple,\n open,\n setValue,\n value,\n });\n\n // context\n const context = {\n disabled,\n highlighted,\n invalid,\n listboxRef,\n multiple,\n onCreate,\n onDelete,\n onEdit,\n open,\n readOnly,\n ref: internalRef,\n searchQuery,\n searchRef,\n setOpen,\n setSearchQuery,\n setValidationError,\n setValue,\n shouldPauseHoverState,\n setShouldPauseHoverState,\n tags,\n fontSize,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {\n setOpen(true);\n }\n\n // the focus should always remain on the input, so we forward events on to the listbox\n listboxRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n };\n\n let handleBlur;\n\n if (otherProps.onBlur) {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n const elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {\n otherProps.onBlur?.(event);\n }\n };\n }\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (isAriaDirectionKey(event)) {\n setShouldPauseHoverState(true);\n }\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (tabTriggeredClose) {\n const nextFocussableElement = getNextFocussableElement(internalRef.current);\n\n if (nextFocussableElement) {\n // UX requirement: move focus to the next focussable element when tab key is pressed to select the value\n nextFocussableElement.focus();\n // Reset the tabTriggeredClose state\n setTabTriggeredClose(false);\n }\n } else {\n internalRef.current?.focus();\n }\n };\n\n const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none', createCollectionClassName());\n\n return (\n <Select2Context.Provider value={context}>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <ControlledHiddenField\n emptyValue={emptyValue}\n multiple={multiple || tags}\n name={name}\n options={flattenedChildren.map(child => child.props.value)}\n parentRef={internalRef}\n setValue={setValue}\n value={value}\n />\n <PopoverPrimitive.Trigger asChild data-taco=\"Select2\">\n <Trigger\n {...otherProps}\n aria-haspopup=\"listbox\"\n emptyValue={emptyValue}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n ref={internalRef}\n placeholder={placeholder}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={() => {\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={handleCloseAutoFocus}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {flattenedChildren.length > 0 || onCreate ? (\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n onTabKeyPress={() => setTabTriggeredClose(true)}\n />\n ) : null}\n {flattenedChildren.length <= 0 ? (\n <div className=\"text-grey-700 -mt-0.5 flex h-8 items-center px-2\" role=\"presentation\">\n No results found...\n </div>\n ) : (\n <ListboxPrimitive.Root\n className=\"flex flex-col gap-0.5\"\n customSelector=\":scope > button\"\n disabled={disabled}\n multiple={multiple}\n onKeyDown={handleListboxKeyDown}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {searchQuery === '' ? (\n <Collection>{initialChildren}</Collection>\n ) : (\n <Collection>{filteredChildren}</Collection>\n )}\n {onCreate ? <Create onCreate={onCreate} options={flattenedChildren} /> : null}\n </ListboxPrimitive.Root>\n )}\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </Select2Context.Provider>\n );\n}) as Select2PropsWithStatics;\nSelect2.Option = Option;\nSelect2.Group = Group;\nSelect2.Title = Title;\n\nconst ControlledHiddenField = props => {\n const { emptyValue, multiple, name, options, parentRef, value, setValue } = props;\n const isFormControl = useIsFormControl(parentRef, () => setValue(multiple ? [] : undefined));\n\n let bubbleValue;\n\n if (isFormControl) {\n if (value !== undefined) {\n if (multiple) {\n bubbleValue = Array.isArray(value) ? value.map(String) : [value === null ? '' : String(value)];\n } else {\n bubbleValue = value === null ? '' : String(value);\n }\n }\n\n return (\n <BubbleSelect aria-hidden key={String(bubbleValue)} multiple={multiple} name={name} value={bubbleValue}>\n {emptyValue !== undefined ? <option value={emptyValue} /> : null}\n {options.map(option => (\n <option key={String(option)} value={String(option)} />\n ))}\n </BubbleSelect>\n );\n }\n\n return null;\n};\nSelect2.displayName = 'Select2';\n\nexport { Select2 };\n\nexport type {\n Select2Texts,\n Select2GroupProps,\n Select2OptionProps,\n Select2OptionValue,\n Select2Value,\n Select2Props,\n Select2TitleProps,\n};\n"],"names":["Select2","React","forwardRef","props","ref","children","initChildren","defaultValue","defaultProp","disabled","emptyValue","undefined","placeholder","highlighted","invalid","multiple","name","onChange","onCreate","onDelete","onEdit","readOnly","tags","value","prop","fontSize","otherProps","emptyOption","useMemo","Option","key","className","initialChildren","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","tabTriggeredClose","setTabTriggeredClose","useState","open","setOpen","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","shouldPauseHoverState","setShouldPauseHoverState","useIsHoverStatePaused","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","ctrlKey","metaKey","test","_listboxRef$current","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","_elementGainingFocus$","closest","id","currentTarget","getAttribute","_otherProps$onBlur","call","handleListboxKeyDown","isAriaDirectionKey","handleCloseAutoFocus","stopPropagation","nextFocussableElement","getNextFocussableElement","focus","_internalRef$current","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","ControlledHiddenField","options","map","child","parentRef","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","_internalRef$current2","onCloseAutoFocus","sideOffset","tabIndex","style","minWidth","width","length","Search","select2","searchOrCreate","search","onTabKeyPress","role","customSelector","Collection","Create","Group","Title","isFormControl","useIsFormControl","bubbleValue","Array","isArray","String","BubbleSelect","option","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2EMA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAkC,SAASF,OAAOA,CAACG,KAAK,EAAEC,GAAG;EACzF,MAAM;IACFC,QAAQ,EAAEC,YAAY;IACtBC,YAAY,EAAEC,WAAW;IACzBC,QAAQ,GAAG,KAAK;IAChBC,UAAU,GAAGC,SAAS;IACtBC,WAAW;IACXC,WAAW,GAAG,KAAK;IACnBC,OAAO,GAAG,KAAK;IACfC,QAAQ,GAAG,KAAK;IAChBC,IAAI;IACJC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;IACRC,MAAM;IACNC,QAAQ,GAAG,KAAK;IAChBC,IAAI,GAAG,KAAK;IACZC,KAAK,EAAEC,IAAI;IACXC,QAAQ;IACR,GAAGC;GACN,GAAGvB,KAAK;EAET,MAAMwB,WAAW,GAAuD1B,cAAK,CAAC2B,OAAO,CAAC;IAClF,IAAIlB,UAAU,KAAKC,SAAS,IAAI,CAACI,QAAQ,EAAE;;MAEvC,oBAAOd,6BAAC4B,MAAM;QAACC,GAAG,EAAC,SAAS;QAACzB,QAAQ,EAAC,EAAE;QAACkB,KAAK,EAAEb,UAAU;QAAEqB,SAAS,EAAC;QAAQ;;IAElF;GACH,EAAE,CAACrB,UAAU,EAAEK,QAAQ,CAAC,CAAC;EAE1B,MAAMiB,eAAe,GAAG/B,cAAK,CAAC2B,OAAO,CAAC;IAClC,IAAID,WAAW,EAAE;MACb,OAAO,CA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,MAAM,CAAC7G,KAAK,CAAC;;;IAIzD,oBACItB,6BAACoI,YAAY;;MAAavG,GAAG,EAAEsG,MAAM,CAACH,WAAW,CAAC;MAAElH,QAAQ,EAAEA,QAAQ;MAAEC,IAAI,EAAEA,IAAI;MAAEO,KAAK,EAAE0G;OACtFvH,UAAU,KAAKC,SAAS,gBAAGV;MAAQsB,KAAK,EAAEb;MAAc,GAAG,IAAI,EAC/DyF,OAAO,CAACC,GAAG,CAACkC,MAAM,mBACfrI;MAAQ6B,GAAG,EAAEsG,MAAM,CAACE,MAAM,CAAC;MAAE/G,KAAK,EAAE6G,MAAM,CAACE,MAAM;MAAK,CACzD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACDtI,OAAO,CAACuI,WAAW,GAAG,SAAS;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { AVAILABLE_COLORS } from '../../../utils/tailwind.js';
4
4
  import { useLocalization } from '../../Provider/Localization.js';
5
5
  import { isAriaSelectionKey } from '../../../utils/aria.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Create.js","sources":["../../../../../../../../src/components/Select2/components/Create.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { isAriaSelectionKey } from '../../../utils/aria';\nimport { Tag } from '../../Tag/Tag';\nimport { createOptionClassName } from '../utilities';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Color } from '../../../types';\nimport { AVAILABLE_COLORS } from '../../../utils/tailwind';\nimport { Select2CreateHandler } from '../types';\n\nexport type CreateProps = {\n onCreate: Select2CreateHandler;\n options: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const getNextColor = (options: React.ReactElement<Select2OptionProps>[]): Color | undefined => {\n let occurrences = {};\n AVAILABLE_COLORS.filter(color => color !== 'transparent').forEach((color: Color) => {\n occurrences = { ...occurrences, [color]: 0 };\n });\n\n options.reduce((occurrences, option) => {\n if (option.props.color) {\n occurrences[option.props.color] = occurrences[option.props.color] ? occurrences[option.props.color] + 1 : 1;\n }\n return occurrences;\n }, occurrences);\n\n const colors = Object.keys(occurrences);\n\n if (colors.length) {\n return colors.sort((a, b) => occurrences[a] - occurrences[b])[0] as Color;\n }\n\n return undefined;\n};\n\nexport const Create = (props: CreateProps) => {\n const { onCreate: handleCreate, options } = props;\n const { multiple, searchQuery, setOpen, setSearchQuery, setValidationError, setValue } = useSelect2Context();\n const { texts } = useLocalization();\n\n // determine what the next color tag should be based on color occurences\n const nextColor = React.useMemo(() => getNextColor(options), [options]);\n\n if (!searchQuery) {\n return null;\n }\n\n const handleClick = async () => {\n try {\n const item = await handleCreate(searchQuery, nextColor);\n setValue(item.value);\n\n if (multiple) {\n setSearchQuery('');\n } else {\n setOpen(false);\n }\n } catch (error) {\n setValidationError(error as Error);\n }\n };\n\n const handleKeyDown = event => {\n if (isAriaSelectionKey(event)) {\n event.currentTarget.click();\n }\n };\n\n const className = cn('!w-[calc(100%_-_theme(spacing.3))] ml-1.5', createOptionClassName());\n return (\n <button className={className} onClick={handleClick} onKeyDown={handleKeyDown}>\n <span className=\"flex items-center gap-1.5\">\n {texts.select2.create}\n <Tag color={nextColor} className=\"cursor-pointer\">\n {searchQuery}\n </Tag>\n </span>\n </button>\n );\n};\n"],"names":["getNextColor","options","occurrences","AVAILABLE_COLORS","filter","color","forEach","reduce","option","props","colors","Object","keys","length","sort","a","b","undefined","Create","onCreate","handleCreate","multiple","searchQuery","setOpen","setSearchQuery","setValidationError","setValue","useSelect2Context","texts","useLocalization","nextColor","React","useMemo","handleClick","Promise","resolve","then","item","value","error","_temp","e","reject","handleKeyDown","event","isAriaSelectionKey","currentTarget","click","className","cn","createOptionClassName","onClick","onKeyDown","select2","create","Tag"],"mappings":";;;;;;;;;;MAiBaA,YAAY,GAAIC,OAAiD;EAC1E,IAAIC,WAAW,GAAG,EAAE;EACpBC,gBAAgB,CA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;IAAA;uCACT;QAAA,OAAAC,OAAA,CAAAC,OAAA,CACmBf,YAAY,CAACE,WAAW,EAAEQ,SAAS,CAAC,EAAAM,IAAA,WAAjDC,IAAI;UACVX,QAAQ,CAACW,IAAI,CAACC,KAAK,CAAC;UAAC,IAEjBjB,QAAQ;YACRG,cAAc,CAAC,EAAE,CAAC;;YAElBD,OAAO,CAAC,KAAK,CAAC;;;OAErB,YAAQgB,KAAK,EAAE;QACZd,kBAAkB,CAACc,KAAc,CAAC;OACrC;MAAA,OAAAL,OAAA,CAAAC,OAAA,CAAAK,KAAA,IAAAA,KAAA,CAAAJ,IAAA,GAAAI,KAAA,CAAAJ,IAAA;KACJ,QAAAK,CAAA;MAAA,OAAAP,OAAA,CAAAQ,MAAA,CAAAD,CAAA;;;EAED,MAAME,aAAa,GAAGC,KAAK;IACvB,IAAIC,kBAAkB,CAACD,KAAK,CAAC,EAAE;MAC3BA,KAAK,CAACE,aAAa,CAACC,KAAK,EAAE;;GAElC;EAED,MAAMC,SAAS,GAAGC,EAAE,CAAC,2CAA2C,EAAEC,qBAAqB,EAAE,CAAC;EAC1F,oBACInB;IAAQiB,SAAS,EAAEA,SAAS;IAAEG,OAAO,EAAElB,WAAW;IAAEmB,SAAS,EAAET;kBAC3DZ;IAAMiB,SAAS,EAAC;KACXpB,KAAK,CAACyB,OAAO,CAACC,MAAM,eACrBvB,6BAACwB,GAAG;IAAClD,KAAK,EAAEyB,SAAS;IAAEkB,SAAS,EAAC;KAC5B1B,WAAW,CACV,CACH,CACF;AAEjB;;;;"}
1
+ {"version":3,"file":"Create.js","sources":["../../../../../../../../src/components/Select2/components/Create.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { isAriaSelectionKey } from '../../../utils/aria';\nimport { Tag } from '../../Tag/Tag';\nimport { createOptionClassName } from '../utilities';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Color } from '../../../types';\nimport { AVAILABLE_COLORS } from '../../../utils/tailwind';\nimport { Select2CreateHandler } from '../types';\n\nexport type CreateProps = {\n onCreate: Select2CreateHandler;\n options: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const getNextColor = (options: React.ReactElement<Select2OptionProps>[]): Color | undefined => {\n let occurrences = {};\n AVAILABLE_COLORS.filter(color => color !== 'transparent').forEach((color: Color) => {\n occurrences = { ...occurrences, [color]: 0 };\n });\n\n options.reduce((occurrences, option) => {\n if (option.props.color) {\n occurrences[option.props.color] = occurrences[option.props.color] ? occurrences[option.props.color] + 1 : 1;\n }\n return occurrences;\n }, occurrences);\n\n const colors = Object.keys(occurrences);\n\n if (colors.length) {\n return colors.sort((a, b) => occurrences[a] - occurrences[b])[0] as Color;\n }\n\n return undefined;\n};\n\nexport const Create = (props: CreateProps) => {\n const { onCreate: handleCreate, options } = props;\n const { multiple, searchQuery, setOpen, setSearchQuery, setValidationError, setValue } = useSelect2Context();\n const { texts } = useLocalization();\n\n // determine what the next color tag should be based on color occurences\n const nextColor = React.useMemo(() => getNextColor(options), [options]);\n\n if (!searchQuery) {\n return null;\n }\n\n const handleClick = async () => {\n try {\n const item = await handleCreate(searchQuery, nextColor);\n setValue(item.value);\n\n if (multiple) {\n setSearchQuery('');\n } else {\n setOpen(false);\n }\n } catch (error) {\n setValidationError(error as Error);\n }\n };\n\n const handleKeyDown = event => {\n if (isAriaSelectionKey(event)) {\n event.currentTarget.click();\n }\n };\n\n const className = cn('!w-[calc(100%_-_theme(spacing.3))] ml-1.5', createOptionClassName());\n return (\n <button className={className} onClick={handleClick} onKeyDown={handleKeyDown}>\n <span className=\"flex items-center gap-1.5\">\n {texts.select2.create}\n <Tag color={nextColor} className=\"cursor-pointer\">\n {searchQuery}\n </Tag>\n </span>\n </button>\n );\n};\n"],"names":["getNextColor","options","occurrences","AVAILABLE_COLORS","filter","color","forEach","reduce","option","props","colors","Object","keys","length","sort","a","b","undefined","Create","onCreate","handleCreate","multiple","searchQuery","setOpen","setSearchQuery","setValidationError","setValue","useSelect2Context","texts","useLocalization","nextColor","React","useMemo","handleClick","Promise","resolve","then","item","value","error","_temp","e","reject","handleKeyDown","event","isAriaSelectionKey","currentTarget","click","className","cn","createOptionClassName","onClick","onKeyDown","select2","create","Tag"],"mappings":";;;;;;;;;;MAiBaA,YAAY,GAAIC,OAAiD;EAC1E,IAAIC,WAAW,GAAG,EAAE;EACpBC,gBAAgB,CAACC,MAAM,CAACC,KAAK,IAAIA,KAAK,KAAK,aAAa,CAAC,CAACC,OAAO,CAAED,KAAY;IAC3EH,WAAW,GAAG;MAAE,GAAGA,WAAW;MAAE,CAACG,KAAK,GAAG;KAAG;GAC/C,CAAC;EAEFJ,OAAO,CAACM,MAAM,CAAC,CAACL,WAAW,EAAEM,MAAM;IAC/B,IAAIA,MAAM,CAACC,KAAK,CAACJ,KAAK,EAAE;MACpBH,WAAW,CAACM,MAAM,CAACC,KAAK,CAACJ,KAAK,CAAC,GAAGH,WAAW,CAACM,MAAM,CAACC,KAAK,CAACJ,KAAK,CAAC,GAAGH,WAAW,CAACM,MAAM,CAACC,KAAK,CAACJ,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;;IAE/G,OAAOH,WAAW;GACrB,EAAEA,WAAW,CAAC;EAEf,MAAMQ,MAAM,GAAGC,MAAM,CAACC,IAAI,CAACV,WAAW,CAAC;EAEvC,IAAIQ,MAAM,CAACG,MAAM,EAAE;IACf,OAAOH,MAAM,CAACI,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKd,WAAW,CAACa,CAAC,CAAC,GAAGb,WAAW,CAACc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAU;;EAG7E,OAAOC,SAAS;AACpB;MAEaC,MAAM,GAAIT,KAAkB;EACrC,MAAM;IAAEU,QAAQ,EAAEC,YAAY;IAAEnB;GAAS,GAAGQ,KAAK;EACjD,MAAM;IAAEY,QAAQ;IAAEC,WAAW;IAAEC,OAAO;IAAEC,cAAc;IAAEC,kBAAkB;IA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+1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { AVAILABLE_COLORS, getSubtleColorShadeClasses } from '../../../utils/tailwind.js';
4
4
  import { Icon } from '../../Icon/Icon.js';
5
5
  import { useLocalization } from '../../Provider/Localization.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Edit.js","sources":["../../../../../../../../src/components/Select2/components/Edit.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as RadioGroup from '@radix-ui/react-radio-group';\nimport { Button } from '../../Button/Button';\nimport { Input } from '../../Input/Input';\nimport { Popover, PopoverProps } from '../../Popover/Popover';\nimport { Icon } from '../../Icon/Icon';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Field } from '../../Field/Field';\nimport { Group } from '../../Group/Group';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Color } from '../../../types';\nimport { AVAILABLE_COLORS, getSubtleColorShadeClasses } from '../../../utils/tailwind';\n\nexport type EditPopoverProps = PopoverProps & {\n color?: Color;\n text: string;\n value: Select2OptionValue;\n};\n\nexport const EditPopover = (props: EditPopoverProps) => {\n const { color: initialColor, text: initialName, value, ...popoverProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const { onDelete, onEdit, searchRef, ref: selectRef } = useSelect2Context();\n const { texts } = useLocalization();\n const [name, setName] = React.useState(initialName);\n const [color, setColor] = React.useState(initialColor);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n\n const handleInputChange = event => {\n setName(event.target.value);\n setValidationError(undefined);\n };\n\n const handleInputKeyDown = close => async event => {\n event.stopPropagation();\n\n if (event.key === 'Escape') {\n close();\n } else if (event.key === 'Enter') {\n handleSave(close)(event);\n }\n };\n\n const handleDelete = close => async event => {\n event.stopPropagation();\n close();\n\n if (onDelete) {\n await onDelete(value);\n }\n };\n\n const handleSave = close => async event => {\n if (onEdit && (name !== initialName || color !== initialColor)) {\n try {\n await onEdit(value, name, color);\n close();\n } catch (error) {\n event.preventDefault();\n event.stopPropagation();\n setValidationError(error as Error);\n ref.current?.focus();\n }\n } else {\n close();\n }\n };\n\n const handleCloseAutoFocus = event => {\n event.preventDefault();\n setName(initialName);\n setColor(initialColor);\n setValidationError(undefined);\n\n if (searchRef?.current) {\n searchRef.current?.focus();\n } else {\n selectRef.current?.focus();\n }\n };\n\n const handleInteractOutside = () => {\n setName(initialName);\n setColor(initialColor);\n };\n\n const preventKeyDownPropagation = event => {\n // Need to allow 'Escape', 'Tab', 'Shift + Tab' to support default focus and close behaviour of Radix Popover.\n if (event.key === 'Escape' || event.key === 'Tab' || (event.key === 'Tab' && event.shiftKey)) {\n return;\n } else {\n event.stopPropagation();\n }\n };\n\n const popoverContentKeyDown = event => {\n // Need to stop propagation of 'Tab', 'Shift + Tab' keys out of Popover content,\n // to avoid 'Tab' key execution on Option component and closing the dropdown.\n if (event.key === 'Tab' || (event.key === 'Tab' && event.shiftKey)) {\n event.stopPropagation();\n }\n };\n\n return (\n <Popover {...popoverProps}>\n <Popover.Content\n onCloseAutoFocus={handleCloseAutoFocus}\n onInteractOutside={handleInteractOutside}\n onClick={event => event.stopPropagation()}\n onKeyDown={popoverContentKeyDown}\n placement=\"right\"\n tabIndex={-1}\n className=\"focus:!shadow-none\">\n {({ close }) => (\n <>\n <div className=\"flex w-32 flex-col space-y-2\">\n {onEdit ? (\n <>\n <Field\n className={cn('!min-h-fit', { '!pb-0': !validationError })}\n invalid={!!validationError}\n message={validationError?.message}>\n <Input\n invalid={!!validationError}\n onChange={handleInputChange}\n onKeyDown={handleInputKeyDown(close)}\n ref={ref}\n value={name}\n />\n </Field>\n {initialColor ? (\n <>\n <h5>Colours</h5>\n <Colours\n color={color}\n onChangeColor={setColor}\n onKeyDown={preventKeyDownPropagation}\n />\n </>\n ) : null}\n <Group>\n <Button onClick={close}>{texts.select2.cancel}</Button>\n <Button appearance=\"primary\" onClick={handleSave(close)}>\n {texts.select2.save}\n </Button>\n </Group>\n </>\n ) : null}\n {onEdit && onDelete ? <hr /> : null}\n {onDelete ? (\n <button\n className=\"hover:text-grey-700 flex items-center justify-start gap-1\"\n onClick={handleDelete(close)}\n onKeyDown={preventKeyDownPropagation}>\n <Icon className=\"!h-5 !w-5\" name=\"delete-permanently\" /> {texts.select2.delete}\n </button>\n ) : null}\n </div>\n </>\n )}\n </Popover.Content>\n </Popover>\n );\n};\n\nconst Colours = props => {\n const { color, onChangeColor, onClick, onKeyDown } = props;\n const { texts } = useLocalization();\n\n return (\n <RadioGroup.Root\n aria-label={texts.select2.chooseColor}\n className=\"grid grid-cols-4 gap-2 focus:outline-none\"\n onClick={onClick}\n onKeyDown={onKeyDown}\n onValueChange={color => onChangeColor(color)}\n value={color}>\n {AVAILABLE_COLORS.map((availableColor: string) => (\n <RadioGroup.Item\n aria-label={color}\n className={cn(\n 'flex h-6 w-6 cursor-pointer items-center justify-center rounded',\n getSubtleColorShadeClasses(availableColor as Color)\n )}\n key={availableColor}\n onFocus={() => onChangeColor(availableColor)}\n value={availableColor}>\n <RadioGroup.Indicator asChild>\n <Icon name=\"tick\" className=\"!h-5 !w-5\" />\n </RadioGroup.Indicator>\n </RadioGroup.Item>\n ))}\n </RadioGroup.Root>\n );\n};\n"],"names":["EditPopover","props","color","initialColor","text","initialName","value","popoverProps","ref","React","useRef","onDelete","onEdit","searchRef","selectRef","useSelect2Context","texts","useLocalization","name","setName","useState","setColor","validationError","setValidationError","handleInputChange","event","target","undefined","handleInputKeyDown","close","stopPropagation","key","handleSave","Promise","resolve","e","reject","handleDelete","_temp","then","_temp2","_catch","error","_ref$current","preventDefault","current","focus","_temp3","handleCloseAutoFocus","_searchRef$current","_selectRef$current","handleInteractOutside","preventKeyDownPropagation","shiftKey","popoverContentKeyDown","Popover","Content","onCloseAutoFocus","onInteractOutside","onClick","onKeyDown","placement","tabIndex","className","Field","cn","invalid","message","Input","onChange","Colours","onChangeColor","Group","Button","select2","cancel","appearance","save","Icon","delete","RadioGroup","chooseColor","onValueChange","AVA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AAM,CACzE,IACT,IAAI,CACN,CACP,CACN,CACa,CACZ;AAElB;AAEA,MAAMT,OAAO,GAAGrE,KAAK;EACjB,MAAM;IAAEC,KAAK;IAAEqE,aAAa;IAAEZ,OAAO;IAAEC;GAAW,GAAG3D,KAAK;EAC1D,MAAM;IAAEe;GAAO,GAAGC,eAAe,EAAE;EAEnC,oBACIR,6BAACuE,IAAe;kBACAhE,KAAK,CAAC0D,OAAO,CAACO,WAAW;IACrClB,SAAS,EAAC,2CAA2C;IACrDJ,OAAO,EAAEA,OAAO;IAChBC,SAAS,EAAEA,SAAS;IACpBsB,aAAa,EAAEhF,KAAK,IAAIqE,aAAa,CAACrE,KAAK,CAAC;IAC5CI,KAAK,EAAEJ;KACNiF,gBAAgB,CAACC,GAAG,CAAEC,cAAsB,mBACzC5E,6BAACuE,IAAe;kBACA9E,KAAK;IACjB6D,SAAS,EAAEE,EAAE,CACT,iEAAiE,EACjEqB,0BAA0B,CAACD,cAAuB,CAAC,CACtD;IACDtD,GAAG,EAAEsD,cAAc;IACnBE,OAAO,EAAEA,MAAMhB,aAAa,CAACc,cAAc,CAAC;IAC5C/E,KAAK,EAAE+E;kBACP5E,6BAACuE,SAAoB;IAACQ,OAAO;kBACzB/E,6BAACqE,IAAI;IAAC5D,IAAI,EAAC,MAAM;IAAC6C,SAAS,EAAC;IAAc,CACvB,CACT,CACrB,CAAC,CACY;AAE1B,CAAC;;;;"}
1
+ {"version":3,"file":"Edit.js","sources":["../../../../../../../../src/components/Select2/components/Edit.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport * as RadioGroup from '@radix-ui/react-radio-group';\nimport { Button } from '../../Button/Button';\nimport { Input } from '../../Input/Input';\nimport { Popover, PopoverProps } from '../../Popover/Popover';\nimport { Icon } from '../../Icon/Icon';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Field } from '../../Field/Field';\nimport { Group } from '../../Group/Group';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Color } from '../../../types';\nimport { AVAILABLE_COLORS, getSubtleColorShadeClasses } from '../../../utils/tailwind';\n\nexport type EditPopoverProps = PopoverProps & {\n color?: Color;\n text: string;\n value: Select2OptionValue;\n};\n\nexport const EditPopover = (props: EditPopoverProps) => {\n const { color: initialColor, text: initialName, value, ...popoverProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const { onDelete, onEdit, searchRef, ref: selectRef } = useSelect2Context();\n const { texts } = useLocalization();\n const [name, setName] = React.useState(initialName);\n const [color, setColor] = React.useState(initialColor);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n\n const handleInputChange = event => {\n setName(event.target.value);\n setValidationError(undefined);\n };\n\n const handleInputKeyDown = close => async event => {\n event.stopPropagation();\n\n if (event.key === 'Escape') {\n close();\n } else if (event.key === 'Enter') {\n handleSave(close)(event);\n }\n };\n\n const handleDelete = close => async event => {\n event.stopPropagation();\n close();\n\n if (onDelete) {\n await onDelete(value);\n }\n };\n\n const handleSave = close => async event => {\n if (onEdit && (name !== initialName || color !== initialColor)) {\n try {\n await onEdit(value, name, color);\n close();\n } catch (error) {\n event.preventDefault();\n event.stopPropagation();\n setValidationError(error as Error);\n ref.current?.focus();\n }\n } else {\n close();\n }\n };\n\n const handleCloseAutoFocus = event => {\n event.preventDefault();\n setName(initialName);\n setColor(initialColor);\n setValidationError(undefined);\n\n if (searchRef?.current) {\n searchRef.current?.focus();\n } else {\n selectRef.current?.focus();\n }\n };\n\n const handleInteractOutside = () => {\n setName(initialName);\n setColor(initialColor);\n };\n\n const preventKeyDownPropagation = event => {\n // Need to allow 'Escape', 'Tab', 'Shift + Tab' to support default focus and close behaviour of Radix Popover.\n if (event.key === 'Escape' || event.key === 'Tab' || (event.key === 'Tab' && event.shiftKey)) {\n return;\n } else {\n event.stopPropagation();\n }\n };\n\n const popoverContentKeyDown = event => {\n // Need to stop propagation of 'Tab', 'Shift + Tab' keys out of Popover content,\n // to avoid 'Tab' key execution on Option component and closing the dropdown.\n if (event.key === 'Tab' || (event.key === 'Tab' && event.shiftKey)) {\n event.stopPropagation();\n }\n };\n\n return (\n <Popover {...popoverProps}>\n <Popover.Content\n onCloseAutoFocus={handleCloseAutoFocus}\n onInteractOutside={handleInteractOutside}\n onClick={event => event.stopPropagation()}\n onKeyDown={popoverContentKeyDown}\n placement=\"right\"\n tabIndex={-1}\n className=\"focus:!shadow-none\">\n {({ close }) => (\n <>\n <div className=\"flex w-32 flex-col space-y-2\">\n {onEdit ? (\n <>\n <Field\n className={cn('!min-h-fit', { '!pb-0': !validationError })}\n invalid={!!validationError}\n message={validationError?.message}>\n <Input\n invalid={!!validationError}\n onChange={handleInputChange}\n onKeyDown={handleInputKeyDown(close)}\n ref={ref}\n value={name}\n />\n </Field>\n {initialColor ? (\n <>\n <h5>Colours</h5>\n <Colours\n color={color}\n onChangeColor={setColor}\n onKeyDown={preventKeyDownPropagation}\n />\n </>\n ) : null}\n <Group>\n <Button onClick={close}>{texts.select2.cancel}</Button>\n <Button appearance=\"primary\" onClick={handleSave(close)}>\n {texts.select2.save}\n </Button>\n </Group>\n </>\n ) : null}\n {onEdit && onDelete ? <hr /> : null}\n {onDelete ? (\n <button\n className=\"hover:text-grey-700 flex items-center justify-start gap-1\"\n onClick={handleDelete(close)}\n onKeyDown={preventKeyDownPropagation}>\n <Icon className=\"!h-5 !w-5\" name=\"delete-permanently\" /> {texts.select2.delete}\n </button>\n ) : null}\n </div>\n </>\n )}\n </Popover.Content>\n </Popover>\n );\n};\n\nconst Colours = props => {\n const { color, onChangeColor, onClick, onKeyDown } = props;\n const { texts } = useLocalization();\n\n return (\n <RadioGroup.Root\n aria-label={texts.select2.chooseColor}\n className=\"grid grid-cols-4 gap-2 focus:outline-none\"\n onClick={onClick}\n onKeyDown={onKeyDown}\n onValueChange={color => onChangeColor(color)}\n value={color}>\n {AVAILABLE_COLORS.map((availableColor: string) => (\n <RadioGroup.Item\n aria-label={color}\n className={cn(\n 'flex h-6 w-6 cursor-pointer items-center justify-center rounded',\n getSubtleColorShadeClasses(availableColor as Color)\n )}\n key={availableColor}\n onFocus={() => onChangeColor(availableColor)}\n value={availableColor}>\n <RadioGroup.Indicator asChild>\n <Icon name=\"tick\" className=\"!h-5 !w-5\" />\n </RadioGroup.Indicator>\n </RadioGroup.Item>\n ))}\n </RadioGroup.Root>\n );\n};\n"],"names":["EditPopover","props","color","initialColor","text","initialName","value","popoverProps","ref","React","useRef","onDelete","onEdit","searchRef","selectRef","useSelect2Context","texts","useLocalization","name","setName","useState","setColor","validationError","setValidationError","handleInputChange","event","target","undefined","handleInputKeyDown","close","stopPropagation","key","handleSave","Promise","resolve","e","reject","handleDelete","_temp","then","_temp2","_catch","error","_ref$current","preventDefault","current","focus","_temp3","handleCloseAutoFocus","_searchRef$current","_selectRef$current","handleInteractOutside","preventKeyDownPropagation","shiftKey","popoverContentKeyDown","Popover","Content","onCloseAutoFocus","onInteractOutside","onClick","onKeyDown","placement","tabIndex","className","Field","cn","invalid","message","Input","onChange","Colours","onChangeColor","Group","Button","select2","cancel","appearance","save","Icon","delete","RadioGroup","chooseColor","onValueChange","AVAILABLE_COLORS","map","availableColor","getSubtleColorShadeClasses","onFocus","asChild"],"mappings":";;;;;;;;;;;;;;MAqBaA,WAAW,GAAIC,KAAuB;EAC/C,MAAM;IAAEC,KAAK,EAAEC,YAAY;IAAEC,IAAI,EAAEC,WAAW;IAAEC,KAAK;IAAE,GAAGC;GAAc,GAAGN,KAAK;EAChF,MAAMO,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAmB,IAAI,CAAC;EAChD,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,SAAS;IAAEL,GAAG,EAAEM;GAAW,GAAGC,iBAAiB,EAAE;EAC3E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGV,cAAK,CAACW,QAAQ,CAACf,WAAW,CAAC;EACnD,MAAM,CAACH,KAAK,EAAEmB,QAAQ,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E,EAAE,CACT,iEAAiE,EACjEqB,0BAA0B,CAACD,cAAuB,CAAC,CACtD;IACDtD,GAAG,EAAEsD,cAAc;IACnBE,OAAO,EAAEA,MAAMhB,aAAa,CAACc,cAAc,CAAC;IAC5C/E,KAAK,EAAE+E;kBACP5E,6BAACuE,SAAoB;IAACQ,OAAO;kBACzB/E,6BAACqE,IAAI;IAAC5D,IAAI,EAAC,MAAM;IAAC6C,SAAS,EAAC;IAAc,CACvB,CACT,CACrB,CAAC,CACY;AAE1B,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import '../../../primitives/Listbox2/components/Root.js';
4
4
  import '../../../primitives/Listbox2/components/Option.js';
5
5
  import { Group as Group$1 } from '../../../primitives/Listbox2/components/Group.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Group.js","sources":["../../../../../../../../src/components/Select2/components/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\nimport { createCollectionClassName } from '../utilities';\nimport { Select2OptionProps } from './Option';\n\nexport type Select2GroupProps = Omit<ListboxPrimitive.Listbox2GroupProps, 'children'> & {\n children: React.ReactElement<Select2OptionProps>[];\n hasSeparator?: boolean;\n heading?: string;\n};\n\nexport const Group = React.forwardRef<HTMLDivElement, Select2GroupProps>(function Select2Group(props, ref) {\n const { children, heading, hasSeparator, ...attributes } = props;\n const className = cn(\n createCollectionClassName(),\n {\n \"last:after:content-none after:content-[''] after:bg-grey-300 after:mx-2 after:my-1 after:h-px\":\n hasSeparator && children.length,\n },\n props.className\n );\n\n return (\n <ListboxPrimitive.Group {...attributes} className={className} ref={ref}>\n <ListboxPrimitive.Title className=\"sticky top-0 bg-white px-2 font-bold leading-8\">{heading}</ListboxPrimitive.Title>\n {children}\n </ListboxPrimitive.Group>\n );\n});\n"],"names":["Group","React","forwardRef","Select2Group","props","ref","children","heading","hasSeparator","attributes","className","cn","createCollectionClassName","length","ListboxPrimitive"],"mappings":";;;;;;;;MAYaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAoC,SAASC,YAAYA,CAACC,KAAK,EAAEC,GAAG;EACrG,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,YAAY;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAChE,MAAMM,SAAS,GAAGC,EAAE,CAChBC,yBAAyB,EAAE,EAC3B;IACI,+FAA+F,EAC3FJ,YAAY,IAAIF,QAAQ,CAACO;GAChC,EACDT,KAAK,CAACM,SAAS,CAClB;EAED,oBACIT,6BAACa,OAAsB,oBAAKL,UAAU;IAAEC,SAAS,EAAEA,SAAS;IAAEL,GAAG,EAAEA;mBAC/DJ,6BAACa,KAAsB;IAACJ,SAAS,EAAC;KAAkDH,OAAO,CAA0B,EACpHD,QAAQ,CACY;AAEjC,CAAC;;;;"}
1
+ {"version":3,"file":"Group.js","sources":["../../../../../../../../src/components/Select2/components/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\nimport { createCollectionClassName } from '../utilities';\nimport { Select2OptionProps } from './Option';\n\nexport type Select2GroupProps = Omit<ListboxPrimitive.Listbox2GroupProps, 'children'> & {\n children: React.ReactElement<Select2OptionProps>[];\n hasSeparator?: boolean;\n heading?: string;\n};\n\nexport const Group = React.forwardRef<HTMLDivElement, Select2GroupProps>(function Select2Group(props, ref) {\n const { children, heading, hasSeparator, ...attributes } = props;\n const className = cn(\n createCollectionClassName(),\n {\n \"last:after:content-none after:content-[''] after:bg-grey-300 after:mx-2 after:my-1 after:h-px\":\n hasSeparator && children.length,\n },\n props.className\n );\n\n return (\n <ListboxPrimitive.Group {...attributes} className={className} ref={ref}>\n <ListboxPrimitive.Title className=\"sticky top-0 bg-white px-2 font-bold leading-8\">{heading}</ListboxPrimitive.Title>\n {children}\n </ListboxPrimitive.Group>\n );\n});\n"],"names":["Group","React","forwardRef","Select2Group","props","ref","children","heading","hasSeparator","attributes","className","cn","createCollectionClassName","length","ListboxPrimitive"],"mappings":";;;;;;;;MAYaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAoC,SAASC,YAAYA,CAACC,KAAK,EAAEC,GAAG;EACrG,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,YAAY;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAChE,MAAMM,SAAS,GAAGC,EAAE,CAChBC,yBAAyB,EAAE,EAC3B;IACI,+FAA+F,EAC3FJ,YAAY,IAAIF,QAAQ,CAACO;GAChC,EACDT,KAAK,CAACM,SAAS,CAClB;EAED,oBACIT,6BAACa,OAAsB,oBAAKL,UAAU;IAAEC,SAAS,EAAEA,SAAS;IAAEL,GAAG,EAAEA;mBAC/DJ,6BAACa,KAAsB;IAACJ,SAAS,EAAC;KAAkDH,OAAO,CAA0B,EACpHD,QAAQ,CACY;AAEjC,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { Icon } from '../../Icon/Icon.js';
4
4
  import { IconButton } from '../../IconButton/IconButton.js';
5
5
  import { isAriaSelectionKey } from '../../../utils/aria.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Option.js","sources":["../../../../../../../../src/components/Select2/components/Option.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tag } from '../../Tag/Tag';\nimport { isAriaSelectionKey } from '../../../utils/aria';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\nimport { createOptionClassName } from '../utilities';\nimport { useSelect2Context } from './Context';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { EditPopover } from './Edit';\nimport { isMobileDevice } from '../../../utils/device';\nimport { Color } from '../../../types';\nimport { FontSize, FontSizes } from '../../../types';\n\nexport type Select2OptionProps = Omit<ListboxPrimitive.Listbox2OptionProps, 'children' | 'prefix'> & {\n children: string;\n color?: Color;\n description?: string;\n fontSize?: FontSize;\n prefix?: IconName | JSX.Element;\n postfix?: IconName | JSX.Element;\n textValue?: string;\n};\n\nexport const Option = React.forwardRef<HTMLDivElement, Select2OptionProps>(function Select2Option(props, ref) {\n const { children, color, description, prefix, postfix, className: cName, ...otherProps } = props;\n const {\n onDelete,\n onEdit,\n listboxRef,\n multiple,\n ref: selectRef,\n setOpen,\n shouldPauseHoverState,\n tags,\n value,\n fontSize = FontSizes.medium,\n } = useSelect2Context();\n const className = cn(\n createOptionClassName(shouldPauseHoverState),\n {\n 'text-xs': fontSize === FontSizes.small,\n 'text-sm': fontSize === FontSizes.medium,\n 'text-base': fontSize === FontSizes.large,\n },\n cName\n );\n\n const hasValue = Array.isArray(value) ? !!value.length : value !== undefined;\n const isTag = tags && !!color;\n\n const handleClick = () => {\n if (!multiple) {\n setOpen(false);\n } else {\n selectRef.current?.focus();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (isAriaSelectionKey(event)) {\n if (!multiple || event.key === 'Tab') {\n setOpen(false);\n }\n }\n };\n\n const isEmptyOption = children !== '';\n\n const popover =\n isEmptyOption && (onEdit || onDelete)\n ? popoverProps => (\n <EditPopover\n {...popoverProps}\n color={props.color}\n key={props.textValue ?? String(props.children)}\n text={props.textValue ?? String(props.children)}\n value={props.value}\n />\n )\n : undefined;\n\n return (\n <ListboxPrimitive.Option {...otherProps} className={className} onClick={handleClick} onKeyDown={handleKeyDown} ref={ref}>\n {hasValue ? (\n <Icon name=\"tick\" className=\"pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible\" />\n ) : null}\n\n {isTag ? (\n <Tag className=\"pointer-events-none my-1\" color={color} icon={prefix}>\n {children}\n </Tag>\n ) : (\n <>\n {prefix ? typeof prefix === 'string' ? <Icon name={prefix} /> : prefix : null}\n <span className=\"flex w-full justify-between\">\n <span className=\"flex flex-col\">\n <span>{children}</span>\n {description ? <span className=\"text-grey-700 -mt-1.5 mb-1.5 text-xs\">{description}</span> : null}\n </span>\n <span className=\"flex flex-col self-center\">\n {postfix ? typeof postfix === 'string' ? <Icon name={postfix} /> : postfix : null}\n </span>\n </span>\n </>\n )}\n {popover ? (\n <IconButton\n icon=\"ellipsis-vertical\"\n appearance=\"discrete\"\n className={cn(\n 'group-aria-current:visible invisible -mr-1 ml-auto !h-5 min-h-[theme(spacing.6)] !w-5 min-w-[theme(spacing.6)] hover:!bg-black/[.08] focus:!shadow-none group-hover:visible',\n {\n '!visible': isMobileDevice(window?.navigator),\n }\n )}\n onClick={event => {\n event.stopPropagation();\n listboxRef?.current?.setActiveIndex(event.currentTarget.parentElement as HTMLDivElement);\n }}\n popover={popover}\n tabIndex={-1}\n />\n ) : null}\n </ListboxPrimitive.Option>\n );\n});\n"],"names":["Option","React","forwardRef","Select2Option","props","ref","children","color","description","prefix","postfix","className","cName","otherProps","onDelete","onEdit","listboxRef","multiple","selectRef","setOpen","shouldPauseHoverState","tags","value","fontSize","FontSizes","medium","useSelect2Context","cn","createOptionClassName","small","large","hasValue","Array","isArray","length","undefined","isTag","handleClick","_selectRef$current","current","focus","handleKeyDown","event","isAriaSelectionKey","key","isEmptyOption","popover","popoverProps","_props$textValue","_props$textValue2","EditPopover","textValue","String","text","ListboxPrimitive","onClick","onKeyDown","Icon","name","Tag","icon","IconButton","appearance","isMobileDevice","_window","window","navigator","stopPropagation","_listboxRef$current","setActiveIndex","currentTarget","parentElement","tabIndex"],"mappings":";;;;;;;;;;;;;;;;MAwBaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAqC,SAASC,aAAaA,CAACC,KAAK,EAAEC,GAAG;;EACxG,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,WAAW;IAAEC,MAAM;IAAEC,OAAO;IAAEC,SAAS,EAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGT,KAAK;EAChG,MAAM;IACFU,QAAQ;IACRC,MAAM;IACNC,UAA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D,UAAU;IACPD,IAAI,EAAC,mBAAmB;IACxBE,UAAU,EAAC,UAAU;IACrBnD,SAAS,EAAEgB,EAAE,CACT,6KAA6K,EAC7K;MACI,UAAU,EAAEoC,cAAc,EAAAC,OAAA,GAACC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,SAAS;KAC/C,CACJ;IACDX,OAAO,EAAEb,KAAK;;MACVA,KAAK,CAACyB,eAAe,EAAE;MACvBnD,UAAU,aAAVA,UAAU,wBAAAoD,mBAAA,GAAVpD,UAAU,CAAEuB,OAAO,cAAA6B,mBAAA,uBAAnBA,mBAAA,CAAqBC,cAAc,CAAC3B,KAAK,CAAC4B,aAAa,CAACC,aAA+B,CAAC;KAC3F;IACDzB,OAAO,EAAEA,OAAO;IAChB0B,QAAQ,EAAE,CAAC;IACb,IACF,IAAI,CACc;AAElC,CAAC;;;;"}
1
+ {"version":3,"file":"Option.js","sources":["../../../../../../../../src/components/Select2/components/Option.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tag } from '../../Tag/Tag';\nimport { isAriaSelectionKey } from '../../../utils/aria';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\nimport { createOptionClassName } from '../utilities';\nimport { useSelect2Context } from './Context';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { EditPopover } from './Edit';\nimport { isMobileDevice } from '../../../utils/device';\nimport { Color } from '../../../types';\nimport { FontSize, FontSizes } from '../../../types';\n\nexport type Select2OptionProps = Omit<ListboxPrimitive.Listbox2OptionProps, 'children' | 'prefix'> & {\n children: string;\n color?: Color;\n description?: string;\n fontSize?: FontSize;\n prefix?: IconName | JSX.Element;\n postfix?: IconName | JSX.Element;\n textValue?: string;\n};\n\nexport const Option = React.forwardRef<HTMLDivElement, Select2OptionProps>(function Select2Option(props, ref) {\n const { children, color, description, prefix, postfix, className: cName, ...otherProps } = props;\n const {\n onDelete,\n onEdit,\n listboxRef,\n multiple,\n ref: selectRef,\n setOpen,\n shouldPauseHoverState,\n tags,\n value,\n fontSize = FontSizes.medium,\n } = useSelect2Context();\n const className = cn(\n createOptionClassName(shouldPauseHoverState),\n {\n 'text-xs': fontSize === FontSizes.small,\n 'text-sm': fontSize === FontSizes.medium,\n 'text-base': fontSize === FontSizes.large,\n },\n cName\n );\n\n const hasValue = Array.isArray(value) ? !!value.length : value !== undefined;\n const isTag = tags && !!color;\n\n const handleClick = () => {\n if (!multiple) {\n setOpen(false);\n } else {\n selectRef.current?.focus();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (isAriaSelectionKey(event)) {\n if (!multiple || event.key === 'Tab') {\n setOpen(false);\n }\n }\n };\n\n const isEmptyOption = children !== '';\n\n const popover =\n isEmptyOption && (onEdit || onDelete)\n ? popoverProps => (\n <EditPopover\n {...popoverProps}\n color={props.color}\n key={props.textValue ?? String(props.children)}\n text={props.textValue ?? String(props.children)}\n value={props.value}\n />\n )\n : undefined;\n\n return (\n <ListboxPrimitive.Option {...otherProps} className={className} onClick={handleClick} onKeyDown={handleKeyDown} ref={ref}>\n {hasValue ? (\n <Icon name=\"tick\" className=\"pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible\" />\n ) : null}\n\n {isTag ? (\n <Tag className=\"pointer-events-none my-1\" color={color} icon={prefix}>\n {children}\n </Tag>\n ) : (\n <>\n {prefix ? typeof prefix === 'string' ? <Icon name={prefix} /> : prefix : null}\n <span className=\"flex w-full justify-between\">\n <span className=\"flex flex-col\">\n <span>{children}</span>\n {description ? <span className=\"text-grey-700 -mt-1.5 mb-1.5 text-xs\">{description}</span> : null}\n </span>\n <span className=\"flex flex-col self-center\">\n {postfix ? typeof postfix === 'string' ? <Icon name={postfix} /> : postfix : null}\n </span>\n </span>\n </>\n )}\n {popover ? (\n <IconButton\n icon=\"ellipsis-vertical\"\n appearance=\"discrete\"\n className={cn(\n 'group-aria-current:visible invisible -mr-1 ml-auto !h-5 min-h-[theme(spacing.6)] !w-5 min-w-[theme(spacing.6)] hover:!bg-black/[.08] focus:!shadow-none group-hover:visible',\n {\n '!visible': isMobileDevice(window?.navigator),\n }\n )}\n onClick={event => {\n event.stopPropagation();\n listboxRef?.current?.setActiveIndex(event.currentTarget.parentElement as HTMLDivElement);\n }}\n popover={popover}\n tabIndex={-1}\n />\n ) : null}\n </ListboxPrimitive.Option>\n );\n});\n"],"names":["Option","React","forwardRef","Select2Option","props","ref","children","color","description","prefix","postfix","className","cName","otherProps","onDelete","onEdit","listboxRef","multiple","selectRef","setOpen","shouldPauseHoverState","tags","value","fontSize","FontSizes","medium","useSelect2Context","cn","createOptionClassName","small","large","hasValue","Array","isArray","length","undefined","isTag","handleClick","_selectRef$current","current","focus","handleKeyDown","event","isAriaSelectionKey","key","isEmptyOption","popover","popoverProps","_props$textValue","_props$textValue2","EditPopover","textValue","String","text","ListboxPrimitive","onClick","onKeyDown","Icon","name","Tag","icon","IconButton","appearance","isMobileDevice","_window","window","navigator","stopPropagation","_listboxRef$current","setActiveIndex","currentTarget","parentElement","tabIndex"],"mappings":";;;;;;;;;;;;;;;;MAwBaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAqC,SAASC,aAAaA,CAACC,KAAK,EAAEC,GAAG;;EACxG,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,WAAW;IAAEC,MAAM;IAAEC,OAAO;IAAEC,SAAS,EAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGT,KAAK;EAChG,MAAM;IACFU,QAAQ;IACRC,MAAM;IACNC,UAAU;IACVC,QAAQ;IACRZ,GAAG,EAAEa,SAAS;IACdC,OAAO;IACPC,qBAAqB;IACrBC,IAAI;IACJC,KAAK;IACLC,QAAQ,GAAGC,SAAS,CAACC;GACxB,GAAGC,iBAAiB,EAAE;EACvB,MAAMf,SAAS,GAAGgB,EAAE,CAChBC,qBAAqB,CAACR,qBAAqB,CAAC,EAC5C;IACI,SAAS,EAAEG,QAAQ,KAAKC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e,EAAE;MACvBnD,UAAU,aAAVA,UAAU,wBAAAoD,mBAAA,GAAVpD,UAAU,CAAEuB,OAAO,cAAA6B,mBAAA,uBAAnBA,mBAAA,CAAqBC,cAAc,CAAC3B,KAAK,CAAC4B,aAAa,CAACC,aAA+B,CAAC;KAC3F;IACDzB,OAAO,EAAEA,OAAO;IAChB0B,QAAQ,EAAE,CAAC;IACb,IACF,IAAI,CACc;AAElC,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { Input } from '../../Input/Input.js';
4
4
  import { createCustomKeyboardEvent } from '../../../utils/input.js';
5
5
  import { Field } from '../../Field/Field.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Search.js","sources":["../../../../../../../../src/components/Select2/components/Search.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { createCustomKeyboardEvent } from '../../../utils/input';\nimport { Input, InputProps } from '../../Input/Input';\nimport { useSelect2Context } from './Context';\nimport { Field } from '../../Field/Field';\nimport { isAriaSelectionKey } from '../../../utils/aria';\n\nexport type Select2SearchProps = InputProps & {\n onTabKeyPress: () => void;\n};\n\nexport const Search = React.forwardRef<HTMLInputElement, Select2SearchProps>(function ListboxSearch(props, ref) {\n const { onTabKeyPress, ...otherProps } = props;\n const { listboxRef, searchQuery, setSearchQuery, setValidationError, validationError, setOpen } = useSelect2Context();\n\n const handleChange = event => {\n if (validationError) {\n setValidationError(undefined);\n }\n\n setSearchQuery(event.target.value);\n };\n\n const handleKeyDown = event => {\n // space is an aria selection key, so we have to remove it to allow spaces\n if (event.key === ' ') {\n return;\n }\n\n // Select2 should close dropdown and receive focus, when user press Tab while searching (UX requirement to support better keyboard navigation)\n if (event.key === 'Tab') {\n setOpen(false);\n onTabKeyPress();\n }\n\n if (isAriaSelectionKey(event) || event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n // forward navigation events onto the underlying collection - we want arrow keys to work from inside the filter input\n listboxRef?.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n return;\n }\n };\n\n return (\n <Field\n className={cn('mx-1.5 mb-1.5 !min-h-fit ', { '!pb-0': !validationError })}\n invalid={!!validationError}\n message={validationError?.message}>\n <Input\n {...otherProps}\n aria-hidden\n autoFocus\n invalid={!!validationError}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n ref={ref}\n value={searchQuery}\n />\n </Field>\n );\n});\n"],"names":["Search","React","forwardRef","ListboxSearch","props","ref","onTabKeyPress","otherProps","listboxRef","searchQuery","setSearchQuery","setValidationError","validationError","setOpen","useSelect2Context","handleChange","event","undefined","target","value","handleKeyDown","key","isAriaSelectionKey","_listboxRef$current","preventDefault","current","dispatchEvent","createCustomKeyboardEvent","Field","className","cn","invalid","message","Input","autoFocus","onChange","onKeyDown"],"mappings":";;;;;;;;MAYaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAuC,SAASC,aAAaA,CAACC,KAAK,EAAEC,GAAG;EAC1G,MAAM;IAAEC,aAAa;IAAE,GAAGC;GAAY,GAAGH,KAAK;EAC9C,MAAM;IAAEI,UAAU;IAAEC,WAAW;IAAEC,cAAc;IAAEC,kBAAkB;IAAEC,eAAe;IAAEC;GAAS,GAAGC,iBAAiB,EAAE;EAErH,MAAMC,YAAY,GAAGC,KAAK;IACtB,IAAIJ,eAAe,EAAE;MACjBD,kBAAkB,CAACM,SAAS,CAAC;;IAGjCP,cAAc,CAACM,KAAK,CAACE,MAAM,CAACC,KAAK,CAAC;GACrC;EAED,MAAMC,aAAa,GAAGJ,KAAK;;IAEvB,IAAIA,KAAK,CAACK,GAAG,KAAK,GAAG,EAAE;MACnB;;;IAIJ,IAAIL,KAAK,CAACK,GAAG,KAAK,KAAK,EAAE;MACrBR,OAAO,CAAC,KAAK,CAAC;MACdP,aAAa,EAAE;;IAGnB,IAAIgB,kBAAkB,CAACN,KAAK,CAAC,IAAIA,KAAK,CAACK,GAAG,KAAK,WAAW,IAAIL,KAAK,CAACK,GAAG,KAAK,SAAS,EAAE;MAAA,IAAAE,mBAAA;MACnFP,KAAK,CAACQ,cAAc,EAAE;;MAEtBhB,UAAU,aAAVA,UAAU,wBAAAe,mBAAA,GAAVf,UAAU,CAAEiB,OAAO,cAAAF,mBAAA,uBAAnBA,mBAAA,CAAqBG,aAAa,CAACC,yBAAyB,CAACX,KAA8C,CAAC,CAAC;MAC7G;;GAEP;EAED,oBACIf,6BAAC2B,KAAK;IACFC,SAAS,EAAEC,EAAE,CAAC,2BAA2B,EAAE;MAAE,OAAO,EAAE,CAAClB;KAAiB,CAAC;IACzEmB,OAAO,EAAE,CAAC,CAACnB,eAAe;IAC1BoB,OAAO,EAAEpB,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEoB;kBAC1B/B,6BAACgC,KAAK,oBACE1B,UAAU;;IAEd2B,SAAS;IACTH,OAAO,EAAE,CAAC,CAACnB,eAAe;IAC1BuB,QAAQ,EAAEpB,YAAY;IACtBqB,SAAS,EAAEhB,aAAa;IACxBf,GAAG,EAAEA,GAAG;IACRc,KAAK,EAAEV;KACT,CACE;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"Search.js","sources":["../../../../../../../../src/components/Select2/components/Search.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { createCustomKeyboardEvent } from '../../../utils/input';\nimport { Input, InputProps } from '../../Input/Input';\nimport { useSelect2Context } from './Context';\nimport { Field } from '../../Field/Field';\nimport { isAriaSelectionKey } from '../../../utils/aria';\n\nexport type Select2SearchProps = InputProps & {\n onTabKeyPress: () => void;\n};\n\nexport const Search = React.forwardRef<HTMLInputElement, Select2SearchProps>(function ListboxSearch(props, ref) {\n const { onTabKeyPress, ...otherProps } = props;\n const { listboxRef, searchQuery, setSearchQuery, setValidationError, validationError, setOpen } = useSelect2Context();\n\n const handleChange = event => {\n if (validationError) {\n setValidationError(undefined);\n }\n\n setSearchQuery(event.target.value);\n };\n\n const handleKeyDown = event => {\n // space is an aria selection key, so we have to remove it to allow spaces\n if (event.key === ' ') {\n return;\n }\n\n // Select2 should close dropdown and receive focus, when user press Tab while searching (UX requirement to support better keyboard navigation)\n if (event.key === 'Tab') {\n setOpen(false);\n onTabKeyPress();\n }\n\n if (isAriaSelectionKey(event) || event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n // forward navigation events onto the underlying collection - we want arrow keys to work from inside the filter input\n listboxRef?.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n return;\n }\n };\n\n return (\n <Field\n className={cn('mx-1.5 mb-1.5 !min-h-fit ', { '!pb-0': !validationError })}\n invalid={!!validationError}\n message={validationError?.message}>\n <Input\n {...otherProps}\n aria-hidden\n autoFocus\n invalid={!!validationError}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n ref={ref}\n value={searchQuery}\n />\n </Field>\n );\n});\n"],"names":["Search","React","forwardRef","ListboxSearch","props","ref","onTabKeyPress","otherProps","listboxRef","searchQuery","setSearchQuery","setValidationError","validationError","setOpen","useSelect2Context","handleChange","event","undefined","target","value","handleKeyDown","key","isAriaSelectionKey","_listboxRef$current","preventDefault","current","dispatchEvent","createCustomKeyboardEvent","Field","className","cn","invalid","message","Input","autoFocus","onChange","onKeyDown"],"mappings":";;;;;;;;MAYaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAuC,SAASC,aAAaA,CAACC,KAAK,EAAEC,GAAG;EAC1G,MAAM;IAAEC,aAAa;IAAE,GAAGC;GAAY,GAAGH,KAAK;EAC9C,MAAM;IAAEI,UAAU;IAAEC,WAAW;IAAEC,cAAc;IAAEC,kBAAkB;IAAEC,eAAe;IAAEC;GAAS,GAAGC,iBAAiB,EAAE;EAErH,MAAMC,YAAY,GAAGC,KAAK;IACtB,IAAIJ,eAAe,EAAE;MACjBD,kBAAkB,CAACM,SAAS,CAAC;;IAGjCP,cAAc,CAACM,KAAK,CAACE,MAAM,CAACC,KAAK,CAAC;GACrC;EAED,MAAMC,aAAa,GAAGJ,KAAK;;IAEvB,IAAIA,KAAK,CAACK,GAAG,KAAK,GAAG,EAAE;MACnB;;;IAIJ,IAAIL,KAAK,CAACK,GAAG,KAAK,KAAK,EAAE;MACrBR,OAAO,CAAC,KAAK,CAAC;MACdP,aAAa,EAAE;;IAGnB,IAAIgB,kBAAkB,CAACN,KAAK,CAAC,IAAIA,KAAK,CAACK,GAAG,KAAK,WAAW,IAAIL,KAAK,CAACK,GAAG,KAAK,SAAS,EAAE;MAAA,IAAAE,mBAAA;MACnFP,KAAK,CAACQ,cAAc,EAAE;;MAEtBhB,UAAU,aAAVA,UAAU,wBAAAe,mBAAA,GAAVf,UAAU,CAAEiB,OAAO,cAAAF,mBAAA,uBAAnBA,mBAAA,CAAqBG,aAAa,CAACC,yBAAyB,CAACX,KAA8C,CAAC,CAAC;MAC7G;;GAEP;EAED,oBACIf,6BAAC2B,KAAK;IACFC,SAAS,EAAEC,EAAE,CAAC,2BAA2B,EAAE;MAAE,OAAO,EAAE,CAAClB;KAAiB,CAAC;IACzEmB,OAAO,EAAE,CAAC,CAACnB,eAAe;IAC1BoB,OAAO,EAAEpB,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEoB;kBAC1B/B,6BAACgC,KAAK,oBACE1B,UAAU;;IAEd2B,SAAS;IACTH,OAAO,EAAE,CAAC,CAACnB,eAAe;IAC1BuB,QAAQ,EAAEpB,YAAY;IACtBqB,SAAS,EAAEhB,aAAa;IACxBf,GAAG,EAAEA,GAAG;IACRc,KAAK,EAAEV;KACT,CACE;AAEhB,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import '../../../primitives/Listbox2/components/Root.js';
4
4
  import '../../../primitives/Listbox2/components/Option.js';
5
5
  import '../../../primitives/Listbox2/components/Group.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Title.js","sources":["../../../../../../../../src/components/Select2/components/Title.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\n\nexport type Select2TitleProps = ListboxPrimitive.Listbox2TitleProps;\n\nexport const Title = React.forwardRef<HTMLDivElement, Select2TitleProps>(function Select2Title(props, ref) {\n const className = cn('flex items-center text-xs pl-2 h-8', props.className);\n return <ListboxPrimitive.Title {...props} className={className} ref={ref} />;\n});\n"],"names":["Title","React","forwardRef","Select2Title","props","ref","className","cn","ListboxPrimitive"],"mappings":";;;;;;;MAMaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAoC,SAASC,YAAYA,CAACC,KAAK,EAAEC,GAAG;EACrG,MAAMC,SAAS,GAAGC,EAAE,CAAC,oCAAoC,EAAEH,KAAK,CAACE,SAAS,CAAC;EAC3E,oBAAOL,6BAACO,OAAsB,oBAAKJ,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAChF,CAAC;;;;"}
1
+ {"version":3,"file":"Title.js","sources":["../../../../../../../../src/components/Select2/components/Title.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport * as ListboxPrimitive from '../../../primitives/Listbox2/Listbox2';\n\nexport type Select2TitleProps = ListboxPrimitive.Listbox2TitleProps;\n\nexport const Title = React.forwardRef<HTMLDivElement, Select2TitleProps>(function Select2Title(props, ref) {\n const className = cn('flex items-center text-xs pl-2 h-8', props.className);\n return <ListboxPrimitive.Title {...props} className={className} ref={ref} />;\n});\n"],"names":["Title","React","forwardRef","Select2Title","props","ref","className","cn","ListboxPrimitive"],"mappings":";;;;;;;MAMaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAoC,SAASC,YAAYA,CAACC,KAAK,EAAEC,GAAG;EACrG,MAAMC,SAAS,GAAGC,EAAE,CAAC,oCAAoC,EAAEH,KAAK,CAACE,SAAS,CAAC;EAC3E,oBAAOL,6BAACO,OAAsB,oBAAKJ,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAChF,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { Icon } from '../../Icon/Icon.js';
4
4
  import { Badge } from '../../Badge/Badge.js';
5
5
  import { useMergedRef } from '../../../hooks/useMergedRef.js';
@@ -143,7 +143,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
143
143
  className
144
144
  } = buttonProps;
145
145
  if (open) {
146
- className = cn('!absolute z-20', buttonProps.className);
146
+ className = cn('!absolute z-20 !h-fit', buttonProps.className);
147
147
  content = /*#__PURE__*/React__default.createElement(ScrollArea, {
148
148
  className: "my-1 flex max-h-[5.5rem] flex-col"
149
149
  }, /*#__PURE__*/React__default.createElement("div", {