@economic/taco 1.1.13-alpha.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/dist/components/Group/Group.d.ts +11 -1
  2. package/dist/components/Toast/Toast.d.ts +2 -2
  3. package/dist/components/Toast/Toaster.d.ts +2 -2
  4. package/dist/esm/components/Accordion/Accordion.js +31 -34
  5. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  6. package/dist/esm/components/Backdrop/Backdrop.js +2 -2
  7. package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
  8. package/dist/esm/components/Badge/Badge.js +14 -14
  9. package/dist/esm/components/Badge/Badge.js.map +1 -1
  10. package/dist/esm/components/Banner/Banner.js +7 -5
  11. package/dist/esm/components/Banner/Banner.js.map +1 -1
  12. package/dist/esm/components/Banner/util.js +1 -1
  13. package/dist/esm/components/Banner/util.js.map +1 -1
  14. package/dist/esm/components/Button/Button.js +12 -13
  15. package/dist/esm/components/Button/Button.js.map +1 -1
  16. package/dist/esm/components/Button/util.js +18 -23
  17. package/dist/esm/components/Button/util.js.map +1 -1
  18. package/dist/esm/components/Calendar/Calendar.js +56 -71
  19. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  20. package/dist/esm/components/Card/Card.js +13 -12
  21. package/dist/esm/components/Card/Card.js.map +1 -1
  22. package/dist/esm/components/Checkbox/Checkbox.js +15 -18
  23. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  24. package/dist/esm/components/Combobox/Combobox.js +23 -25
  25. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  26. package/dist/esm/components/Combobox/useCombobox.js +78 -99
  27. package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
  28. package/dist/esm/components/Datepicker/Datepicker.js +48 -52
  29. package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
  30. package/dist/esm/components/Datepicker/useDatepicker.js +27 -34
  31. package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
  32. package/dist/esm/components/Dialog/Context.js +4 -4
  33. package/dist/esm/components/Dialog/Context.js.map +1 -1
  34. package/dist/esm/components/Dialog/Dialog.js +39 -58
  35. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  36. package/dist/esm/components/Dialog/components/Content.js +39 -44
  37. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  38. package/dist/esm/components/Dialog/components/Drawer.js +3 -3
  39. package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
  40. package/dist/esm/components/Dialog/components/Extra.js +2 -2
  41. package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
  42. package/dist/esm/components/Dialog/components/Trigger.js +2 -2
  43. package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
  44. package/dist/esm/components/Field/Field.js +10 -12
  45. package/dist/esm/components/Field/Field.js.map +1 -1
  46. package/dist/esm/components/Form/Form.js +6 -8
  47. package/dist/esm/components/Form/Form.js.map +1 -1
  48. package/dist/esm/components/Group/Group.js +9 -8
  49. package/dist/esm/components/Group/Group.js.map +1 -1
  50. package/dist/esm/components/Hanger/Hanger.js +27 -35
  51. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  52. package/dist/esm/components/HoverCard/HoverCard.js +8 -9
  53. package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
  54. package/dist/esm/components/Icon/Icon.js +7 -8
  55. package/dist/esm/components/Icon/Icon.js.map +1 -1
  56. package/dist/esm/components/Icon/components/index.js +4 -4
  57. package/dist/esm/components/Icon/components/index.js.map +1 -1
  58. package/dist/esm/components/IconButton/IconButton.js +9 -11
  59. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  60. package/dist/esm/components/Input/Input.js +25 -25
  61. package/dist/esm/components/Input/Input.js.map +1 -1
  62. package/dist/esm/components/Input/util.js +2 -2
  63. package/dist/esm/components/Input/util.js.map +1 -1
  64. package/dist/esm/components/Listbox/Listbox.js +24 -25
  65. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  66. package/dist/esm/components/Listbox/ScrollableList.js +65 -84
  67. package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
  68. package/dist/esm/components/Listbox/useListbox.js +53 -61
  69. package/dist/esm/components/Listbox/useListbox.js.map +1 -1
  70. package/dist/esm/components/Listbox/useMultiListbox.js +69 -96
  71. package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
  72. package/dist/esm/components/Listbox/useTypeahead.js +10 -9
  73. package/dist/esm/components/Listbox/useTypeahead.js.map +1 -1
  74. package/dist/esm/components/Listbox/util.js +48 -85
  75. package/dist/esm/components/Listbox/util.js.map +1 -1
  76. package/dist/esm/components/Menu/Context.js +2 -2
  77. package/dist/esm/components/Menu/Context.js.map +1 -1
  78. package/dist/esm/components/Menu/Menu.js +16 -34
  79. package/dist/esm/components/Menu/Menu.js.map +1 -1
  80. package/dist/esm/components/Menu/components/Checkbox.js +9 -10
  81. package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
  82. package/dist/esm/components/Menu/components/Content.js +9 -11
  83. package/dist/esm/components/Menu/components/Content.js.map +1 -1
  84. package/dist/esm/components/Menu/components/Header.js +3 -3
  85. package/dist/esm/components/Menu/components/Header.js.map +1 -1
  86. package/dist/esm/components/Menu/components/Item.js +30 -31
  87. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  88. package/dist/esm/components/Menu/components/Link.js +10 -11
  89. package/dist/esm/components/Menu/components/Link.js.map +1 -1
  90. package/dist/esm/components/Menu/components/RadioGroup.js +17 -19
  91. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  92. package/dist/esm/components/Menu/components/Separator.js +1 -1
  93. package/dist/esm/components/Menu/components/Separator.js.map +1 -1
  94. package/dist/esm/components/Menu/components/Trigger.js +4 -4
  95. package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
  96. package/dist/esm/components/Navigation/Navigation.js +35 -44
  97. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  98. package/dist/esm/components/Pagination/PageNumbers.js +23 -28
  99. package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
  100. package/dist/esm/components/Pagination/Pagination.js +39 -56
  101. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  102. package/dist/esm/components/Pagination/usePagination.js +7 -21
  103. package/dist/esm/components/Pagination/usePagination.js.map +1 -1
  104. package/dist/esm/components/Pagination/usePaginationShortcuts.js +13 -14
  105. package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
  106. package/dist/esm/components/Popover/Popover.js +29 -34
  107. package/dist/esm/components/Popover/Popover.js.map +1 -1
  108. package/dist/esm/components/Popover/Primitives.js +7 -8
  109. package/dist/esm/components/Popover/Primitives.js.map +1 -1
  110. package/dist/esm/components/Progress/Progress.js +11 -15
  111. package/dist/esm/components/Progress/Progress.js.map +1 -1
  112. package/dist/esm/components/Provider/Provider.js +13 -18
  113. package/dist/esm/components/Provider/Provider.js.map +1 -1
  114. package/dist/esm/components/RadioGroup/RadioGroup.js +45 -57
  115. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  116. package/dist/esm/components/SearchInput/SearchInput.js +10 -12
  117. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  118. package/dist/esm/components/Select/Select.js +30 -31
  119. package/dist/esm/components/Select/Select.js.map +1 -1
  120. package/dist/esm/components/Select/useSelect.js +69 -88
  121. package/dist/esm/components/Select/useSelect.js.map +1 -1
  122. package/dist/esm/components/Spinner/Spinner.js +12 -19
  123. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  124. package/dist/esm/components/Switch/Switch.js +9 -10
  125. package/dist/esm/components/Switch/Switch.js.map +1 -1
  126. package/dist/esm/components/Table/components/BaseTable.js +23 -30
  127. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  128. package/dist/esm/components/Table/components/PaginatedTable.js +3 -7
  129. package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -1
  130. package/dist/esm/components/Table/components/Table.js +18 -25
  131. package/dist/esm/components/Table/components/Table.js.map +1 -1
  132. package/dist/esm/components/Table/components/WindowedTable.js +89 -109
  133. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  134. package/dist/esm/components/Table/hooks/plugins/useRowActions.js +123 -148
  135. package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  136. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js +57 -61
  137. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  138. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js +39 -36
  139. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  140. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js +79 -89
  141. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  142. package/dist/esm/components/Table/hooks/useRowCreation.js +29 -64
  143. package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -1
  144. package/dist/esm/components/Table/hooks/useTable.js +123 -141
  145. package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
  146. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +23 -27
  147. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  148. package/dist/esm/components/Table/util/renderColumn.js +10 -10
  149. package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
  150. package/dist/esm/components/Table/util/renderRow.js +37 -46
  151. package/dist/esm/components/Table/util/renderRow.js.map +1 -1
  152. package/dist/esm/components/Table/util/rowIndexPath.js +14 -16
  153. package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -1
  154. package/dist/esm/components/Table/util/sortTypes.js +23 -31
  155. package/dist/esm/components/Table/util/sortTypes.js.map +1 -1
  156. package/dist/esm/components/Table/util.js +29 -41
  157. package/dist/esm/components/Table/util.js.map +1 -1
  158. package/dist/esm/components/Tabs/Tabs.js +25 -27
  159. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  160. package/dist/esm/components/Textarea/Textarea.js +11 -9
  161. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  162. package/dist/esm/components/Toast/Toast.js +27 -23
  163. package/dist/esm/components/Toast/Toast.js.map +1 -1
  164. package/dist/esm/components/Toast/Toaster.js +88 -118
  165. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  166. package/dist/esm/components/Toast/util.js +2 -2
  167. package/dist/esm/components/Toast/util.js.map +1 -1
  168. package/dist/esm/components/Tooltip/Tooltip.js +7 -8
  169. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  170. package/dist/esm/components/Tour/Tour.js +46 -53
  171. package/dist/esm/components/Tour/Tour.js.map +1 -1
  172. package/dist/esm/components/Treeview/Treeview.js +26 -36
  173. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  174. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
  175. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  176. package/dist/esm/index.css +1 -9
  177. package/dist/esm/index.js +1 -1
  178. package/dist/esm/primitives/Button.js +9 -13
  179. package/dist/esm/primitives/Button.js.map +1 -1
  180. package/dist/esm/utils/date.js +20 -40
  181. package/dist/esm/utils/date.js.map +1 -1
  182. package/dist/esm/utils/hooks/useBoundingClientRectListener.js +12 -20
  183. package/dist/esm/utils/hooks/useBoundingClientRectListener.js.map +1 -1
  184. package/dist/esm/utils/hooks/useDraggable.js +16 -17
  185. package/dist/esm/utils/hooks/useDraggable.js.map +1 -1
  186. package/dist/esm/utils/hooks/useDropTarget.js +7 -10
  187. package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
  188. package/dist/esm/utils/hooks/useListKeyboardNavigation.js +15 -30
  189. package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -1
  190. package/dist/esm/utils/hooks/useListScrollTo.js +9 -9
  191. package/dist/esm/utils/hooks/useListScrollTo.js.map +1 -1
  192. package/dist/esm/utils/hooks/useOnClickOutside.js +6 -8
  193. package/dist/esm/utils/hooks/useOnClickOutside.js.map +1 -1
  194. package/dist/esm/utils/hooks/useProxiedRef.js +3 -3
  195. package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
  196. package/dist/esm/utils/hooks/useTimer.js +9 -17
  197. package/dist/esm/utils/hooks/useTimer.js.map +1 -1
  198. package/dist/esm/utils/input.js +8 -12
  199. package/dist/esm/utils/input.js.map +1 -1
  200. package/dist/esm/utils/mergeRefs.js +2 -2
  201. package/dist/esm/utils/mergeRefs.js.map +1 -1
  202. package/dist/esm/utils/taillwind.js +2 -2
  203. package/dist/esm/utils/taillwind.js.map +1 -1
  204. package/dist/index.css +1 -9
  205. package/dist/taco.cjs.development.js +2334 -2883
  206. package/dist/taco.cjs.development.js.map +1 -1
  207. package/dist/taco.cjs.production.min.js +1 -1
  208. package/dist/taco.cjs.production.min.js.map +1 -1
  209. package/dist/utils/hooks/useListKeyboardNavigation.d.ts +1 -1
  210. package/package.json +4 -5
  211. package/types.json +10 -3
  212. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +0 -34
  213. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.js","sources":["../../../../src/components/Toast/Toaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport { ToastOptions, Toast, ToastProps } from './Toast';\nimport './Toast.css';\n\nconst DEFAULT_AUTO_CLOSE_TIMEOUT = 7500;\n\ntype ToastCreator<T> = (content: React.ReactNode | ((close: () => void) => React.ReactNode), options?: ToastOptions) => T;\n\nexport interface Toaster<T> extends ToastCreator<T> {\n success: ToastCreator<T>;\n error: ToastCreator<T>;\n warning: ToastCreator<T>;\n information: ToastCreator<T>;\n loading: ToastCreator<T>;\n}\n\nexport interface ToastReference {\n /** Show a success toast */\n success: ToastCreator<void>;\n /** Show an error toast */\n error: ToastCreator<void>;\n /** Show a warning toast */\n warning: ToastCreator<void>;\n /** Show an information toast */\n information: ToastCreator<void>;\n /** Show a loading toast */\n loading: ToastCreator<void>;\n /**\n * Close an existing toast.\n * The toast function returns a reference to the active toast,\n * allowing you to programmatically close it when needed\n */\n close: () => void;\n}\n\nconst ToastContext = React.createContext<Toaster<ToastReference>>({} as Toaster<ToastReference>);\n\nexport interface ToastProviderProps {\n children: React.ReactNode;\n}\n\ntype InternalToast = Omit<ToastProps, 'onClose'>;\n\nconst insertToastWithoutDuplicates = (\n currentToasts: InternalToast[],\n id: string,\n content: React.ReactNode,\n options: ToastOptions,\n close: () => void\n): InternalToast[] => {\n const nextToasts = [...currentToasts];\n const existingToastIndex = currentToasts.findIndex(toast => JSON.stringify(toast.content) === JSON.stringify(content));\n\n if (existingToastIndex > -1) {\n nextToasts[existingToastIndex].lastDuplicateId = id;\n nextToasts[existingToastIndex].lastUpdated = Date.now();\n } else {\n nextToasts.push({\n id,\n content: typeof content === 'function' ? content(close) : content,\n options,\n });\n }\n\n return nextToasts;\n};\n\nexport const ToastProvider = ({ children, ...props }: ToastProviderProps): JSX.Element => {\n const [toasts, setToasts] = React.useState<InternalToast[]>([]);\n\n const handleClose = (id: string): void => {\n setToasts(currentToasts => currentToasts.filter(toast => toast.id !== id));\n };\n\n // memoize (useCallback) this function,\n // it is the value of the context provider and we don't want it to trigger state tree re-renders on provider children\n const toaster = React.useCallback((content: React.ReactNode, options: ToastOptions): ToastReference => {\n const id = uuid();\n const close = (): void => handleClose(id);\n\n setToasts(currentToasts => insertToastWithoutDuplicates(currentToasts, id, content, options, close));\n\n const update = (content: React.ReactNode, options: ToastOptions): void => {\n setToasts(currentToasts => {\n const nextToasts = currentToasts.filter(toast => {\n if (toast.lastDuplicateId) {\n return toast.lastDuplicateId !== id;\n }\n\n return toast.id !== id;\n });\n return insertToastWithoutDuplicates(nextToasts, uuid(), content, options, close);\n });\n };\n\n const success = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { autoClose: DEFAULT_AUTO_CLOSE_TIMEOUT, ...options, type: 'success' });\n };\n const error = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { ...options, type: 'error' });\n };\n const warning = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { ...options, type: 'warning' });\n };\n const information = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { ...options, type: 'information' });\n };\n const loading = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { ...options, type: 'loading' });\n };\n\n return {\n success,\n error,\n warning,\n information,\n loading,\n close,\n };\n }, []) as Toaster<ToastReference>;\n\n // no need to rebind these every render, do them once in an effect\n React.useEffect(() => {\n toaster.success = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { autoClose: DEFAULT_AUTO_CLOSE_TIMEOUT, ...options, type: 'success' });\n toaster.error = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { ...options, type: 'error' });\n toaster.warning = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { ...options, type: 'warning' });\n toaster.information = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { ...options, type: 'information' });\n toaster.loading = (content: React.ReactNode, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { ...options, type: 'loading' });\n }, []);\n\n return (\n <ToastContext.Provider {...props} value={toaster}>\n {children}\n <div\n id=\"yt-toast__container\"\n className=\"pointer-events-all absolute bottom-0 right-0 !left-auto z-[1000] mb-4 mr-4 flex max-w-md flex-col items-end justify-end\"\n role=\"log\"\n >\n <AnimatePresence initial={false}>\n {toasts.map((toast: ToastProps) => (\n <motion.div\n key={toast.id}\n transition={{\n type: 'spring',\n damping: 20,\n stiffness: 300,\n }}\n initial={{ opacity: 0, y: 10, scale: 0.5 }}\n animate={{ opacity: 1, y: 0, scale: 1 }}\n exit={{ opacity: 0, scale: 0.5, transition: { duration: 0.2 } }}\n >\n <Toast {...toast} onClose={() => handleClose(toast.id)} />\n </motion.div>\n ))}\n </AnimatePresence>\n </div>\n </ToastContext.Provider>\n );\n};\n\nexport const useToast = (): Toaster<ToastReference> => React.useContext(ToastContext);\n"],"names":["DEFAULT_AUTO_CLOSE_TIMEOUT","ToastContext","React","insertToastWithoutDuplicates","currentToasts","id","content","options","close","nextToasts","existingToastIndex","findIndex","toast","JSON","stringify","lastDuplicateId","lastUpdated","Date","now","push","ToastProvider","children","props","toasts","setToasts","handleClose","filter","toaster","uuid","update","success","autoClose","type","error","warning","information","loading","Provider","value","className","role","AnimatePresence","initial","map","motion","div","key","transition","damping","stiffness","opacity","y","scale","animate","exit","duration","Toast","onClose","useToast"],"mappings":";;;;;;;AAMA,IAAMA,0BAA0B,GAAG,IAAnC;AA+BA,IAAMC,YAAY,gBAAGC,aAAA,CAA6C,EAA7C,CAArB;;AAQA,IAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACjCC,aADiC,EAEjCC,EAFiC,EAGjCC,OAHiC,EAIjCC,OAJiC,EAKjCC,KALiC;EAOjC,IAAMC,UAAU,aAAOL,aAAP,CAAhB;EACA,IAAMM,kBAAkB,GAAGN,aAAa,CAACO,SAAd,CAAwB,UAAAC,KAAK;IAAA,OAAIC,IAAI,CAACC,SAAL,CAAeF,KAAK,CAACN,OAArB,MAAkCO,IAAI,CAACC,SAAL,CAAeR,OAAf,CAAtC;GAA7B,CAA3B;;EAEA,IAAII,kBAAkB,GAAG,CAAC,CAA1B,EAA6B;IACzBD,UAAU,CAACC,kBAAD,CAAV,CAA+BK,eAA/B,GAAiDV,EAAjD;IACAI,UAAU,CAACC,kBAAD,CAAV,CAA+BM,WAA/B,GAA6CC,IAAI,CAACC,GAAL,EAA7C;GAFJ,MAGO;IACHT,UAAU,CAACU,IAAX,CAAgB;MACZd,EAAE,EAAFA,EADY;MAEZC,OAAO,EAAE,OAAOA,OAAP,KAAmB,UAAnB,GAAgCA,OAAO,CAACE,KAAD,CAAvC,GAAiDF,OAF9C;MAGZC,OAAO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MAAO6C,OAAO,EAAE;QAAA,OAAMhC,WAAW,CAACb,KAAK,CAACP,EAAP,CAAjB;;MAA3B,CAXJ,CADQ;GAAX,CADL,CALJ,CAFJ,CADJ;AA4BH;IAEYqD,QAAQ,GAAG,SAAXA,QAAW;EAAA,OAA+BxD,UAAA,CAAiBD,YAAjB,CAA/B;AAAA;;;;"}
1
+ {"version":3,"file":"Toaster.js","sources":["../../../../src/components/Toast/Toaster.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport { ToastOptions, Toast, ToastProps, ToastContent } from './Toast';\nimport './Toast.css';\n\nconst DEFAULT_AUTO_CLOSE_TIMEOUT = 7500;\n\ntype ToastCreator<T> = (content: ToastContent | ((close: () => void) => ToastContent), options?: ToastOptions) => T;\n\nexport interface Toaster<T> extends ToastCreator<T> {\n success: ToastCreator<T>;\n error: ToastCreator<T>;\n warning: ToastCreator<T>;\n information: ToastCreator<T>;\n loading: ToastCreator<T>;\n}\n\nexport interface ToastReference {\n /** Show a success toast */\n success: ToastCreator<void>;\n /** Show an error toast */\n error: ToastCreator<void>;\n /** Show a warning toast */\n warning: ToastCreator<void>;\n /** Show an information toast */\n information: ToastCreator<void>;\n /** Show a loading toast */\n loading: ToastCreator<void>;\n /**\n * Close an existing toast.\n * The toast function returns a reference to the active toast,\n * allowing you to programmatically close it when needed\n */\n close: () => void;\n}\n\nconst ToastContext = React.createContext<Toaster<ToastReference>>({} as Toaster<ToastReference>);\n\nexport interface ToastProviderProps {\n children: React.ReactNode;\n}\n\ntype InternalToast = Omit<ToastProps, 'onClose'>;\n\nconst insertToastWithoutDuplicates = (\n currentToasts: InternalToast[],\n id: string,\n content: ToastContent,\n options: ToastOptions,\n close: () => void\n): InternalToast[] => {\n const nextToasts = [...currentToasts];\n const existingToastIndex = currentToasts.findIndex(toast => JSON.stringify(toast.content) === JSON.stringify(content));\n\n if (existingToastIndex > -1) {\n nextToasts[existingToastIndex].lastDuplicateId = id;\n nextToasts[existingToastIndex].lastUpdated = Date.now();\n } else {\n nextToasts.push({\n id,\n content: typeof content === 'function' ? content(close) : content,\n options,\n });\n }\n\n return nextToasts;\n};\n\nexport const ToastProvider = ({ children, ...props }: ToastProviderProps): JSX.Element => {\n const [toasts, setToasts] = React.useState<InternalToast[]>([]);\n\n const handleClose = (id: string): void => {\n setToasts(currentToasts => currentToasts.filter(toast => toast.id !== id));\n };\n\n // memoize (useCallback) this function,\n // it is the value of the context provider and we don't want it to trigger state tree re-renders on provider children\n const toaster = React.useCallback((content: ToastContent, options: ToastOptions): ToastReference => {\n const id = uuid();\n const close = (): void => handleClose(id);\n\n setToasts(currentToasts => insertToastWithoutDuplicates(currentToasts, id, content, options, close));\n\n const update = (content: ToastContent, options: ToastOptions): void => {\n setToasts(currentToasts => {\n const nextToasts = currentToasts.filter(toast => {\n if (toast.lastDuplicateId) {\n return toast.lastDuplicateId !== id;\n }\n\n return toast.id !== id;\n });\n return insertToastWithoutDuplicates(nextToasts, uuid(), content, options, close);\n });\n };\n\n const success = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { autoClose: DEFAULT_AUTO_CLOSE_TIMEOUT, ...options, type: 'success' });\n };\n const error = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { ...options, type: 'error' });\n };\n const warning = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { ...options, type: 'warning' });\n };\n const information = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { ...options, type: 'information' });\n };\n const loading = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): void => {\n update(content, { ...options, type: 'loading' });\n };\n\n return {\n success,\n error,\n warning,\n information,\n loading,\n close,\n };\n }, []) as Toaster<ToastReference>;\n\n // no need to rebind these every render, do them once in an effect\n React.useEffect(() => {\n toaster.success = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { autoClose: DEFAULT_AUTO_CLOSE_TIMEOUT, ...options, type: 'success' });\n toaster.error = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { ...options, type: 'error' });\n toaster.warning = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { ...options, type: 'warning' });\n toaster.information = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { ...options, type: 'information' });\n toaster.loading = (content: ToastContent, options?: Omit<ToastOptions, 'type'>): ToastReference =>\n toaster(content, { ...options, type: 'loading' });\n }, []);\n\n return (\n <ToastContext.Provider {...props} value={toaster}>\n {children}\n <div\n id=\"yt-toast__container\"\n className=\"pointer-events-all absolute bottom-0 right-0 !left-auto z-[1000] mb-4 mr-4 flex max-w-md flex-col items-end justify-end\"\n role=\"log\">\n <AnimatePresence initial={false}>\n {toasts.map((toast: ToastProps) => (\n <motion.div\n key={toast.id}\n transition={{\n type: 'spring',\n damping: 20,\n stiffness: 300,\n }}\n initial={{ opacity: 0, y: 10, scale: 0.5 }}\n animate={{ opacity: 1, y: 0, scale: 1 }}\n exit={{ opacity: 0, scale: 0.5, transition: { duration: 0.2 } }}>\n <Toast {...toast} onClose={() => handleClose(toast.id)} />\n </motion.div>\n ))}\n </AnimatePresence>\n </div>\n </ToastContext.Provider>\n );\n};\n\nexport const useToast = (): Toaster<ToastReference> => React.useContext(ToastContext);\n"],"names":["DEFAULT_AUTO_CLOSE_TIMEOUT","ToastContext","React","insertToastWithoutDuplicates","currentToasts","id","content","options","close","nextToasts","existingToastIndex","findIndex","toast","JSON","stringify","lastDuplicateId","lastUpdated","Date","now","push","ToastProvider","children","props","toasts","setToasts","handleClose","filter","toaster","uuid","update","success","autoClose","type","error","warning","information","loading","Provider","value","className","role","AnimatePresence","initial","map","motion","div","key","transition","damping","stiffness","opacity","y","scale","animate","exit","duration","Toast","onClose","useToast"],"mappings":";;;;;AAMA,MAAMA,0BAA0B,GAAG,IAAnC;AA+BA,MA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iBC,OAAO,EAAE;GAA1B,EACKnB,MAAM,CAACoB,GAAP,CAAY/B,KAAD,IACRV,aAAA,CAAC0C,MAAM,CAACC,GAAR;IACIC,GAAG,EAAElC,KAAK,CAACP;IACX0C,UAAU,EAAE;MACRf,IAAI,EAAE,QADE;MAERgB,OAAO,EAAE,EAFD;MAGRC,SAAS,EAAE;;IAEfP,OAAO,EAAE;MAAEQ,OAAO,EAAE,CAAX;MAAcC,CAAC,EAAE,EAAjB;MAAqBC,KAAK,EAAE;;IACrCC,OAAO,EAAE;MAAEH,OAAO,EAAE,CAAX;MAAcC,CAAC,EAAE,CAAjB;MAAoBC,KAAK,EAAE;;IACpCE,IAAI,EAAE;MAAEJ,OAAO,EAAE,CAAX;MAAcE,KAAK,EAAE,GAArB;MAA0BL,UAAU,EAAE;QAAEQ,QAAQ,EAAE;;;GAT5D,EAUIrD,aAAA,CAACsD,KAAD,oBAAW5C;IAAO6C,OAAO,EAAE,MAAMhC,WAAW,CAACb,KAAK,CAACP,EAAP;IAA5C,CAVJ,CADH,CADL,CAJJ,CAFJ,CADJ;AA0BH;MAEYqD,QAAQ,GAAG,MAA+BxD,UAAA,CAAiBD,YAAjB;;;;"}
@@ -3,8 +3,8 @@ import cn from 'classnames';
3
3
  import { Icon } from '../Icon/Icon.js';
4
4
  import { Spinner } from '../Spinner/Spinner.js';
5
5
 
6
- var getBadgeIcon = function getBadgeIcon(type) {
7
- var css = 'rounded-full flex-shrink-0 mr-2';
6
+ const getBadgeIcon = type => {
7
+ const css = 'rounded-full flex-shrink-0 mr-2';
8
8
 
9
9
  switch (type) {
10
10
  case 'success':
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../src/components/Toast/util.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon } from '../Icon/Icon';\nimport { Spinner } from '../Spinner/Spinner';\nimport { ToastType } from './Toast';\n\nexport const getBadgeIcon = (type: ToastType): JSX.Element | null => {\n const css = 'rounded-full flex-shrink-0 mr-2';\n\n switch (type) {\n case 'success':\n return <Icon name=\"tick\" className={cn(css, 'yt-green-solid')} />;\n\n case 'warning':\n return <Icon name=\"warning\" className={cn(css, 'yt-yellow-solid')} />;\n\n case 'error':\n return <Icon name=\"warning\" className={cn(css, 'yt-red-solid')} />;\n\n case 'information':\n return <Icon name=\"info\" className={cn(css, 'yt-blue-solid')} />;\n\n case 'loading':\n return <Spinner delay={0} className={cn(css, 'h-6 w-6')} />;\n\n default:\n return null;\n }\n};\n"],"names":["getBadgeIcon","type","css","React","Icon","name","className","cn","Spinner","delay"],"mappings":";;;;;IAMaA,YAAY,GAAG,SAAfA,YAAe,CAACC,IAAD;EACxB,IAAMC,GAAG,GAAG,iCAAZ;;EAEA,QAAQD,IAAR;IACI,KAAK,SAAL;MACI,OAAOE,4BAAA,CAACC,IAAD;QAAMC,IAAI,EAAC;QAAOC,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,gBAAN;OAA/B,CAAP;;IAEJ,KAAK,SAAL;MACI,OAAOC,4BAAA,CAACC,IAAD;QAAMC,IAAI,EAAC;QAAUC,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,iBAAN;OAAlC,CAAP;;IAEJ,KAAK,OAAL;MACI,OAAOC,4BAAA,CAACC,IAAD;QAAMC,IAAI,EAAC;QAAUC,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,cAAN;OAAlC,CAAP;;IAEJ,KAAK,aAAL;MACI,OAAOC,4BAAA,CAACC,IAAD;QAAMC,IAAI,EAAC;QAAOC,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,eAAN;OAA/B,CAAP;;IAEJ,KAAK,SAAL;MACI,OAAOC,4BAAA,CAACK,OAAD;QAASC,KAAK,EAAE;QAAGH,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,SAAN;OAAhC,CAAP;;IAEJ;MACI,OAAO,IAAP;;AAEX;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../src/components/Toast/util.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon } from '../Icon/Icon';\nimport { Spinner } from '../Spinner/Spinner';\nimport { ToastType } from './Toast';\n\nexport const getBadgeIcon = (type: ToastType): JSX.Element | null => {\n const css = 'rounded-full flex-shrink-0 mr-2';\n\n switch (type) {\n case 'success':\n return <Icon name=\"tick\" className={cn(css, 'yt-green-solid')} />;\n\n case 'warning':\n return <Icon name=\"warning\" className={cn(css, 'yt-yellow-solid')} />;\n\n case 'error':\n return <Icon name=\"warning\" className={cn(css, 'yt-red-solid')} />;\n\n case 'information':\n return <Icon name=\"info\" className={cn(css, 'yt-blue-solid')} />;\n\n case 'loading':\n return <Spinner delay={0} className={cn(css, 'h-6 w-6')} />;\n\n default:\n return null;\n }\n};\n"],"names":["getBadgeIcon","type","css","React","Icon","name","className","cn","Spinner","delay"],"mappings":";;;;;MAMaA,YAAY,GAAIC,IAAD;EACxB,MAAMC,GAAG,GAAG,iCAAZ;;EAEA,QAAQD,IAAR;IACI,KAAK,SAAL;MACI,OAAOE,4BAAA,CAACC,IAAD;QAAMC,IAAI,EAAC;QAAOC,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,gBAAN;OAA/B,CAAP;;IAEJ,KAAK,SAAL;MACI,OAAOC,4BAAA,CAACC,IAAD;QAAMC,IAAI,EAAC;QAAUC,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,iBAAN;OAAlC,CAAP;;IAEJ,KAAK,OAAL;MACI,OAAOC,4BAAA,CAACC,IAAD;QAAMC,IAAI,EAAC;QAAUC,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,cAAN;OAAlC,CAAP;;IAEJ,KAAK,aAAL;MACI,OAAOC,4BAAA,CAACC,IAAD;QAAMC,IAAI,EAAC;QAAOC,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,eAAN;OAA/B,CAAP;;IAEJ,KAAK,SAAL;MACI,OAAOC,4BAAA,CAACK,OAAD;QAASC,KAAK,EAAE;QAAGH,SAAS,EAAEC,EAAE,CAACL,GAAD,EAAM,SAAN;OAAhC,CAAP;;IAEJ;MACI,OAAO,IAAP;;AAEX;;;;"}
@@ -1,14 +1,13 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { forwardRef, createElement } from 'react';
3
2
  import { Root, Trigger, Content, Arrow } from '@radix-ui/react-tooltip';
4
3
 
5
- var _excluded = ["title", "children", "placement"];
6
- var Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7
- var title = props.title,
8
- children = props.children,
9
- placement = props.placement,
10
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
11
-
4
+ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
5
+ const {
6
+ title,
7
+ children,
8
+ placement,
9
+ ...otherProps
10
+ } = props;
12
11
  return createElement(Root, {
13
12
  delayDuration: 50
14
13
  }, createElement(Trigger, {
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nexport type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Text displayed in the tooltip */\n title: string;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, ...otherProps } = props;\n\n return (\n <TooltipPrimitive.Root delayDuration={50}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content {...otherProps} asChild side={placement} sideOffset={3}>\n <div\n className=\"wcag-purple max-w-[theme(spacing.56)] animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold opacity-90\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}\n >\n <TooltipPrimitive.Arrow className=\"fill-purple stroke-purple\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","otherProps","TooltipPrimitive","delayDuration","asChild","side","sideOffset","className","style","transformOrigin"],"mappings":";;;;;IAeaA,OAAO,gBAAGC,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACpC,IAAQC,KAAR,GAAsDF,KAAtD,CAAQE,KAAR;MAAeC,QAAf,GAAsDH,KAAtD,CAAeG,QAAf;MAAyBC,SAAzB,GAAsDJ,KAAtD,CAAyBI,SAAzB;MAAuCC,UAAvC,iCAAsDL,KAAtD;;EAEA,OACID,aAAA,CAACO,IAAD;IAAuBC,aAAa,EAAE;GAAtC,EACIR,aAAA,CAACO,OAAD;IAA0BE,OAAO;IAACP,GAAG,EAAEA;GAAvC,EACKE,QADL,CADJ,EAIIJ,aAAA,CAACO,OAAD,oBAA8BD;IAAYG,OAAO;IAACC,IAAI,EAAEL;IAAWM,UAAU,EAAE;IAA/E,EACIX,aAAA,MAAA;IACIY,SAAS,EAAC;iBACA;IACVC,KAAK,EAAE;MACHC,eAAe,EAAE;;GAJzB,EAOId,aAAA,CAACO,KAAD;IAAwBK,SAAS,EAAC;GAAlC,CAPJ,EAQKT,KARL,CADJ,CAJJ,CADJ;AAmBH,CAtBsB;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nexport type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Text displayed in the tooltip */\n title: string;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, ...otherProps } = props;\n\n return (\n <TooltipPrimitive.Root delayDuration={50}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content {...otherProps} asChild side={placement} sideOffset={3}>\n <div\n className=\"wcag-purple max-w-[theme(spacing.56)] animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold opacity-90\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}\n >\n <TooltipPrimitive.Arrow className=\"fill-purple stroke-purple\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","otherProps","TooltipPrimitive","delayDuration","asChild","side","sideOffset","className","style","transformOrigin"],"mappings":";;;MAeaA,OAAO,gBAAGC,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACpC,MAAM;IAAEC,KAAF;IAASC,QAAT;IAAmBC,SAAnB;IAA8B,GAAGC;MAAeL,KAAtD;EAEA,OACID,aAAA,CAACO,IAAD;IAAuBC,aAAa,EAAE;GAAtC,EACIR,aAAA,CAACO,OAAD;IAA0BE,OAAO;IAACP,GAAG,EAAEA;GAAvC,EACKE,QADL,CADJ,EAIIJ,aAAA,CAACO,OAAD,oBAA8BD;IAAYG,OAAO;IAACC,IAAI,EAAEL;IAAWM,UAAU,EAAE;IAA/E,EACIX,aAAA,MAAA;IACIY,SAAS,EAAC;iBACA;IACVC,KAAK,EAAE;MACHC,eAAe,EAAE;;GAJzB,EAOId,aAAA,CAACO,KAAD;IAAwBK,SAAS,EAAC;GAAlC,CAPJ,EAQKT,KARL,CADJ,CAJJ,CADJ;AAmBH,CAtBsB;;;;"}
@@ -1,31 +1,28 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { useMemo, Children, useCallback, createElement, useRef, useEffect } from 'react';
3
2
  import { IconButton } from '../IconButton/IconButton.js';
4
3
  import { Button } from '../Button/Button.js';
5
4
  import { useLocalization } from '../Provider/Provider.js';
6
- import keycode from 'keycode';
7
5
  import { Group } from '../Group/Group.js';
8
6
  import Joyride, { ACTIONS, LIFECYCLE, EVENTS } from 'react-joyride';
9
7
 
10
- var _excluded = ["autoStart", "onComplete", "onClose", "onReady", "spotlightClicks", "disableCloseOnEsc", "disableScrollParentFix", "scrollOffset"];
11
-
12
- var Tooltip = function Tooltip(_ref) {
13
- var continuous = _ref.continuous,
14
- index = _ref.index,
15
- isLastStep = _ref.isLastStep,
16
- step = _ref.step,
17
- backProps = _ref.backProps,
18
- primaryProps = _ref.primaryProps,
19
- skipProps = _ref.skipProps,
20
- tooltipProps = _ref.tooltipProps,
21
- size = _ref.size,
22
- locale = _ref.locale,
23
- disableTourSkipOnEsc = _ref.disableTourSkipOnEsc;
24
- var skipButtonRef = useRef(null);
25
- useEffect(function () {
26
- var onWindowKeyDown = function onWindowKeyDown(event) {
8
+ const Tooltip = ({
9
+ continuous,
10
+ index,
11
+ isLastStep,
12
+ step,
13
+ backProps,
14
+ primaryProps,
15
+ skipProps,
16
+ tooltipProps,
17
+ size,
18
+ locale,
19
+ disableTourSkipOnEsc
20
+ }) => {
21
+ const skipButtonRef = useRef(null);
22
+ useEffect(() => {
23
+ const onWindowKeyDown = event => {
27
24
  if (!disableTourSkipOnEsc) {
28
- if (event.keyCode === keycode('esc') && skipButtonRef.current !== null) {
25
+ if (event.key === 'Escape' && skipButtonRef.current !== null) {
29
26
  event.preventDefault();
30
27
  skipButtonRef.current.click();
31
28
  return;
@@ -34,7 +31,7 @@ var Tooltip = function Tooltip(_ref) {
34
31
  };
35
32
 
36
33
  window.addEventListener('keydown', onWindowKeyDown);
37
- return function () {
34
+ return () => {
38
35
  window.removeEventListener('keydown', onWindowKeyDown);
39
36
  };
40
37
  }, []);
@@ -53,31 +50,31 @@ var Tooltip = function Tooltip(_ref) {
53
50
  appearance: "discrete"
54
51
  }), locale.back), createElement(Button, Object.assign({}, primaryProps, {
55
52
  appearance: "primary"
56
- }), continuous ? isLastStep ? locale.last + " (" + (index + 1) + "/" + size + ")" : locale.next + " (" + (index + 1) + "/" + size + ")" : locale.close)));
53
+ }), continuous ? isLastStep ? `${locale.last} (${index + 1}/${size})` : `${locale.next} (${index + 1}/${size})` : locale.close)));
57
54
  }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
58
55
 
59
56
 
60
- var TourStep = function TourStep(_props) {
61
- return null;
62
- };
63
- var Tour = function Tour(props) {
64
- var _useLocalization = useLocalization(),
65
- tour = _useLocalization.texts.tour;
66
-
67
- var run = props.autoStart,
68
- onComplete = props.onComplete,
69
- onClose = props.onClose,
70
- onReady = props.onReady,
71
- spotlightClicks = props.spotlightClicks,
72
- disableTourSkipOnEsc = props.disableCloseOnEsc,
73
- _props$disableScrollP = props.disableScrollParentFix,
74
- disableScrollParentFix = _props$disableScrollP === void 0 ? false : _props$disableScrollP,
75
- scrollOffset = props.scrollOffset,
76
- rest = _objectWithoutPropertiesLoose(props, _excluded);
77
-
78
- var steps = useMemo(function () {
79
- return Children.map(props.children, function (child) {
80
- var step = {
57
+ const TourStep = _props => null;
58
+ const Tour = props => {
59
+ const {
60
+ texts: {
61
+ tour
62
+ }
63
+ } = useLocalization();
64
+ const {
65
+ autoStart: run,
66
+ onComplete,
67
+ onClose,
68
+ onReady,
69
+ spotlightClicks,
70
+ disableCloseOnEsc: disableTourSkipOnEsc,
71
+ disableScrollParentFix = false,
72
+ scrollOffset,
73
+ ...rest
74
+ } = props;
75
+ const steps = useMemo(() => {
76
+ return Children.map(props.children, child => {
77
+ const step = {
81
78
  disableBeacon: !child.props.showBeacon,
82
79
  target: child.props.selector,
83
80
  placement: child.props.position,
@@ -87,12 +84,10 @@ var Tour = function Tour(props) {
87
84
  return step;
88
85
  });
89
86
  }, [props.children]);
90
- var getStep = useCallback(function (selector) {
87
+ const getStep = useCallback(selector => {
91
88
  var _props$children$find;
92
89
 
93
- return (_props$children$find = props.children.find(function (child) {
94
- return child.props.selector === selector;
95
- })) === null || _props$children$find === void 0 ? void 0 : _props$children$find.props;
90
+ return (_props$children$find = props.children.find(child => child.props.selector === selector)) === null || _props$children$find === void 0 ? void 0 : _props$children$find.props;
96
91
  }, [props.children]);
97
92
 
98
93
  function callback(state) {
@@ -122,12 +117,10 @@ var Tour = function Tour(props) {
122
117
  floaterProps: {
123
118
  disableAnimation: true
124
119
  },
125
- tooltipComponent: function tooltipComponent(tooltipProps) {
126
- return createElement(Tooltip, Object.assign({}, tooltipProps, {
127
- locale: tour,
128
- disableTourSkipOnEsc: disableTourSkipOnEsc
129
- }));
130
- },
120
+ tooltipComponent: tooltipProps => createElement(Tooltip, Object.assign({}, tooltipProps, {
121
+ locale: tour,
122
+ disableTourSkipOnEsc: disableTourSkipOnEsc
123
+ })),
131
124
  locale: tour,
132
125
  spotlightPadding: 8,
133
126
  spotlightClicks: spotlightClicks,
@@ -1 +1 @@
1
- {"version":3,"file":"Tour.js","sources":["../../../../src/components/Tour/Tour.tsx"],"sourcesContent":["import keycode from 'keycode';\nimport * as React from 'react';\nimport Joyride, { Step, CallBackProps, ACTIONS, LIFECYCLE, Placement, EVENTS, TooltipRenderProps } from 'react-joyride';\n\nimport { Button } from '../Button/Button';\nimport { Group } from '../Group/Group';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useLocalization } from '../Provider/Provider';\n\nexport type TourTexts = {\n /** Text for back action button */\n back: string;\n /**\n * Text for close button.\n * This button is displayed if tour is not continuous - replacing the `Next` button.\n * It will pause the flow of the tour and close the tooltip\n */\n close: string;\n /**\n * Aria-label and title for close icon button in each step.\n * This button skips and completes the flow entirely\n */\n skip: string;\n /**\n * Text for last action button.\n * This button is displayed when user is on the last step of the tour\n */\n last: string;\n /**\n * Text for next action button.\n * This button is displayed if tour has more than one steps and is continuous\n */\n next: string;\n /** Aria label and title for beacon that will open the tour step */\n open: string;\n};\n\nexport type TourStepProps = {\n /** Content can be any valid react node, for e.g. a `div` */\n children: React.ReactNode;\n /** Define the position of the tour's popup relative to the element is presenting */\n position?: Placement;\n /** The css selector of the html element you want to include in a tour */\n selector: string;\n /**\n * Show beacon for step.\n * A beacon is a styled component which indicates the current element to be presented.\n * For more informations about how to create a beacon, read [Joyride](https://docs.react-joyride.com) docs\n */\n showBeacon?: boolean;\n /** Text displayed above the children/content of the popup */\n title: string;\n};\n\nconst Tooltip = ({\n continuous,\n index,\n isLastStep,\n step,\n backProps,\n primaryProps,\n skipProps,\n tooltipProps,\n size,\n locale,\n disableTourSkipOnEsc,\n}: TooltipRenderProps & { locale: TourTexts; disableTourSkipOnEsc?: boolean }) => {\n const skipButtonRef = React.useRef<HTMLButtonElement>(null);\n\n React.useEffect(() => {\n const onWindowKeyDown = (event: KeyboardEvent): void => {\n if (!disableTourSkipOnEsc) {\n if (event.keyCode === keycode('esc') && skipButtonRef.current !== null) {\n event.preventDefault();\n skipButtonRef.current.click();\n return;\n }\n }\n };\n\n window.addEventListener('keydown', onWindowKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onWindowKeyDown);\n };\n }, []);\n\n return (\n <div {...tooltipProps} className=\"yt-tour__step w-88 relative rounded bg-white p-4\">\n <IconButton\n {...skipProps}\n ref={skipButtonRef}\n appearance=\"discrete\"\n icon=\"close\"\n title={locale.skip}\n aria-label={locale.skip}\n className=\"absolute top-0 right-0 mt-1 mr-1\"\n />\n {step.title && <h5>{step.title}</h5>}\n {step.content}\n <Group className=\"mt-4 justify-end\">\n {index > 0 && (\n <Button {...backProps} appearance=\"discrete\">\n {locale.back}\n </Button>\n )}\n <Button {...primaryProps} appearance=\"primary\">\n {continuous\n ? isLastStep\n ? `${locale.last} (${index + 1}/${size})`\n : `${locale.next} (${index + 1}/${size})`\n : locale.close}\n </Button>\n </Group>\n </div>\n );\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const TourStep = (_props: TourStepProps): null => null;\n\nexport type TourProps = {\n /** Controls if [Joyride](https://docs.react-joyride.com) is active */\n autoStart?: boolean;\n /** Children should be one or more `Tour.Step` components */\n children: any;\n /** Are there more than one steps and should you be able to navigate between them using `Next` and `Previous` buttons */\n continuous?: boolean;\n /** Disable closing of tour when click on `Escape` */\n disableCloseOnEsc?: boolean;\n /** Don't close the presenting popup of the tour step when clicking outside it */\n disableOverlayClose?: boolean;\n /** Allows user to interact with the presented components (mouse and touch events) when the popup is visible */\n disableScrolling?: boolean;\n /* When user clicks on the close icon button, which will close the tour and complete the flow */\n onClose?: (step: TourStepProps) => void;\n /* When user completes the entire flow */\n onComplete?: Function;\n /** When step is ready */\n onReady?: (step: TourStepProps) => void;\n /* Allow mouse and touch events through the spotlight */\n spotlightClicks?: boolean;\n /* Stops the injection of custom overflow styles on parent container. Can be used to prevent remaining overflow styles after tour is done. */\n disableScrollParentFix?: boolean;\n /** The scroll distance from the element scrollTop value. */\n scrollOffset?: number;\n};\n\nexport const Tour = (props: TourProps) => {\n const {\n texts: { tour },\n } = useLocalization();\n\n const {\n autoStart: run,\n onComplete,\n onClose,\n onReady,\n spotlightClicks,\n disableCloseOnEsc: disableTourSkipOnEsc,\n disableScrollParentFix = false,\n scrollOffset,\n ...rest\n } = props;\n\n const steps = React.useMemo(() => {\n return React.Children.map(props.children, child => {\n const step: Step = {\n disableBeacon: !child.props.showBeacon,\n target: child.props.selector,\n placement: child.props.position,\n title: child.props.title,\n content: child.props.children,\n };\n return step;\n });\n }, [props.children]);\n\n const getStep = React.useCallback(\n (selector: string | HTMLElement) => props.children.find((child: any) => child.props.selector === selector)?.props,\n [props.children]\n );\n\n function callback(state: CallBackProps) {\n if (state.action === ACTIONS.SKIP && state.lifecycle === LIFECYCLE.COMPLETE) {\n if (onClose) {\n onClose(getStep(state.step.target));\n }\n }\n\n if (state.type === EVENTS.TOUR_END) {\n if (onComplete) {\n onComplete();\n }\n }\n\n if (state.lifecycle === LIFECYCLE.READY) {\n if (onReady) {\n onReady(getStep(state.step.target));\n }\n }\n }\n\n return (\n <Joyride\n {...rest}\n run={run}\n steps={steps}\n showProgress\n floaterProps={{\n disableAnimation: true,\n }}\n tooltipComponent={tooltipProps => (\n <Tooltip {...tooltipProps} locale={tour} disableTourSkipOnEsc={disableTourSkipOnEsc} />\n )}\n locale={tour}\n spotlightPadding={8}\n spotlightClicks={spotlightClicks}\n disableScrollParentFix={disableScrollParentFix}\n callback={callback}\n scrollOffset={scrollOffset}\n styles={{\n /** style beacon */\n options: {\n // tailwind.theme.colors.blue.light\n primaryColor: '#6ba4ff',\n },\n }}\n disableCloseOnEsc\n />\n );\n};\n\nTour.Step = TourStep;\n"],"names":["Tooltip","continuous","index","isLastStep","step","backProps","primaryProps","skipProps","tooltipProps","size","locale","disableTourSkipOnEsc","skipButtonRef","React","onWindowKeyDown","event","keyCode","keycode","current","preventDefault","click","window","addEventListener","removeEventListener","className","IconButton","ref","appearance","icon","title","skip","content","Group","Button","back","last","next","close","TourStep","_props","Tour","props","useLocalization","tour","texts","run","autoStart","onComplete","onClose","onReady","spotlightClicks","disableCloseOnEsc","disableScrollParentFix","scrollOffset","rest","steps","map","children","child","disableBeacon","showBeacon","target","selector","placement","position","getStep","find","callback","state","action","ACTIONS","SKIP","lifecycle","LIFECYCLE","COMPLETE","type","EVENTS","TOUR_END","READY","Joyride","showProgress","floaterProps","disableAnimation","tooltipComponent","spotlightPadding","styles","options","primaryColor","Step"],"mappings":";;;;;;;;;;;AAsDA,IAAMA,OAAO,GAAG,SAAVA,OAAU;MACZC,kBAAAA;MACAC,aAAAA;MACAC,kBAAAA;MACAC,YAAAA;MACAC,iBAAAA;MACAC,oBAAAA;MACAC,iBAAAA;MACAC,oBAAA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dgC,MAAM,EAAE;;MAEJC,OAAO,EAAE;;QAELC,YAAY,EAAE;;;IAGtBpC,iBAAiB;IAxBrB,CADJ;AA4BH;AAEDX,IAAI,CAACgD,IAAL,GAAYlD,QAAZ;;;;"}
1
+ {"version":3,"file":"Tour.js","sources":["../../../../src/components/Tour/Tour.tsx"],"sourcesContent":["import * as React from 'react';\nimport Joyride, { Step, CallBackProps, ACTIONS, LIFECYCLE, Placement, EVENTS, TooltipRenderProps } from 'react-joyride';\n\nimport { Button } from '../Button/Button';\nimport { Group } from '../Group/Group';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useLocalization } from '../Provider/Provider';\n\nexport type TourTexts = {\n /** Text for back action button */\n back: string;\n /**\n * Text for close button.\n * This button is displayed if tour is not continuous - replacing the `Next` button.\n * It will pause the flow of the tour and close the tooltip\n */\n close: string;\n /**\n * Aria-label and title for close icon button in each step.\n * This button skips and completes the flow entirely\n */\n skip: string;\n /**\n * Text for last action button.\n * This button is displayed when user is on the last step of the tour\n */\n last: string;\n /**\n * Text for next action button.\n * This button is displayed if tour has more than one steps and is continuous\n */\n next: string;\n /** Aria label and title for beacon that will open the tour step */\n open: string;\n};\n\nexport type TourStepProps = {\n /** Content can be any valid react node, for e.g. a `div` */\n children: React.ReactNode;\n /** Define the position of the tour's popup relative to the element is presenting */\n position?: Placement;\n /** The css selector of the html element you want to include in a tour */\n selector: string;\n /**\n * Show beacon for step.\n * A beacon is a styled component which indicates the current element to be presented.\n * For more informations about how to create a beacon, read [Joyride](https://docs.react-joyride.com) docs\n */\n showBeacon?: boolean;\n /** Text displayed above the children/content of the popup */\n title: string;\n};\n\nconst Tooltip = ({\n continuous,\n index,\n isLastStep,\n step,\n backProps,\n primaryProps,\n skipProps,\n tooltipProps,\n size,\n locale,\n disableTourSkipOnEsc,\n}: TooltipRenderProps & { locale: TourTexts; disableTourSkipOnEsc?: boolean }) => {\n const skipButtonRef = React.useRef<HTMLButtonElement>(null);\n\n React.useEffect(() => {\n const onWindowKeyDown = (event: KeyboardEvent): void => {\n if (!disableTourSkipOnEsc) {\n if (event.key === 'Escape' && skipButtonRef.current !== null) {\n event.preventDefault();\n skipButtonRef.current.click();\n return;\n }\n }\n };\n\n window.addEventListener('keydown', onWindowKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onWindowKeyDown);\n };\n }, []);\n\n return (\n <div {...tooltipProps} className=\"yt-tour__step w-88 relative rounded bg-white p-4\">\n <IconButton\n {...skipProps}\n ref={skipButtonRef}\n appearance=\"discrete\"\n icon=\"close\"\n title={locale.skip}\n aria-label={locale.skip}\n className=\"absolute top-0 right-0 mt-1 mr-1\"\n />\n {step.title && <h5>{step.title}</h5>}\n {step.content}\n <Group className=\"mt-4 justify-end\">\n {index > 0 && (\n <Button {...backProps} appearance=\"discrete\">\n {locale.back}\n </Button>\n )}\n <Button {...primaryProps} appearance=\"primary\">\n {continuous\n ? isLastStep\n ? `${locale.last} (${index + 1}/${size})`\n : `${locale.next} (${index + 1}/${size})`\n : locale.close}\n </Button>\n </Group>\n </div>\n );\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const TourStep = (_props: TourStepProps): null => null;\n\nexport type TourProps = {\n /** Controls if [Joyride](https://docs.react-joyride.com) is active */\n autoStart?: boolean;\n /** Children should be one or more `Tour.Step` components */\n children: any;\n /** Are there more than one steps and should you be able to navigate between them using `Next` and `Previous` buttons */\n continuous?: boolean;\n /** Disable closing of tour when click on `Escape` */\n disableCloseOnEsc?: boolean;\n /** Don't close the presenting popup of the tour step when clicking outside it */\n disableOverlayClose?: boolean;\n /** Allows user to interact with the presented components (mouse and touch events) when the popup is visible */\n disableScrolling?: boolean;\n /* When user clicks on the close icon button, which will close the tour and complete the flow */\n onClose?: (step: TourStepProps) => void;\n /* When user completes the entire flow */\n onComplete?: Function;\n /** When step is ready */\n onReady?: (step: TourStepProps) => void;\n /* Allow mouse and touch events through the spotlight */\n spotlightClicks?: boolean;\n /* Stops the injection of custom overflow styles on parent container. Can be used to prevent remaining overflow styles after tour is done. */\n disableScrollParentFix?: boolean;\n /** The scroll distance from the element scrollTop value. */\n scrollOffset?: number;\n};\n\nexport const Tour = (props: TourProps) => {\n const {\n texts: { tour },\n } = useLocalization();\n\n const {\n autoStart: run,\n onComplete,\n onClose,\n onReady,\n spotlightClicks,\n disableCloseOnEsc: disableTourSkipOnEsc,\n disableScrollParentFix = false,\n scrollOffset,\n ...rest\n } = props;\n\n const steps = React.useMemo(() => {\n return React.Children.map(props.children, child => {\n const step: Step = {\n disableBeacon: !child.props.showBeacon,\n target: child.props.selector,\n placement: child.props.position,\n title: child.props.title,\n content: child.props.children,\n };\n return step;\n });\n }, [props.children]);\n\n const getStep = React.useCallback(\n (selector: string | HTMLElement) => props.children.find((child: any) => child.props.selector === selector)?.props,\n [props.children]\n );\n\n function callback(state: CallBackProps) {\n if (state.action === ACTIONS.SKIP && state.lifecycle === LIFECYCLE.COMPLETE) {\n if (onClose) {\n onClose(getStep(state.step.target));\n }\n }\n\n if (state.type === EVENTS.TOUR_END) {\n if (onComplete) {\n onComplete();\n }\n }\n\n if (state.lifecycle === LIFECYCLE.READY) {\n if (onReady) {\n onReady(getStep(state.step.target));\n }\n }\n }\n\n return (\n <Joyride\n {...rest}\n run={run}\n steps={steps}\n showProgress\n floaterProps={{\n disableAnimation: true,\n }}\n tooltipComponent={tooltipProps => (\n <Tooltip {...tooltipProps} locale={tour} disableTourSkipOnEsc={disableTourSkipOnEsc} />\n )}\n locale={tour}\n spotlightPadding={8}\n spotlightClicks={spotlightClicks}\n disableScrollParentFix={disableScrollParentFix}\n callback={callback}\n scrollOffset={scrollOffset}\n styles={{\n /** style beacon */\n options: {\n // tailwind.theme.colors.blue.light\n primaryColor: '#6ba4ff',\n },\n }}\n disableCloseOnEsc\n />\n );\n};\n\nTour.Step = TourStep;\n"],"names":["Tooltip","continuous","index","isLastStep","step","backProps","primaryProps","skipProps","tooltipProps","size","locale","disableTourSkipOnEsc","skipButtonRef","React","onWindowKeyDown","event","key","current","preventDefault","click","window","addEventListener","removeEventListener","className","IconButton","ref","appearance","icon","title","skip","content","Group","Button","back","last","next","close","TourStep","_props","Tour","props","texts","tour","useLocalization","autoStart","run","onComplete","onClose","onReady","spotlightClicks","disableCloseOnEsc","disableScrollParentFix","scrollOffset","rest","steps","map","children","child","disableBeacon","showBeacon","target","selector","placement","position","getStep","find","callback","state","action","ACTIONS","SKIP","lifecycle","LIFECYCLE","COMPLETE","type","EVENTS","TOUR_END","READY","Joyride","showProgress","floaterProps","disableAnimation","tooltipComponent","spotlightPadding","styles","options","primaryColor","Step"],"mappings":";;;;;;;AAqDA,MAAMA,OAAO,GAAG,CAAC;EACbC,UADa;EAEbC,KAFa;EAGbC,UAHa;EAIbC,IAJa;EAKbC,SALa;EAMbC,YANa;EAObC,SAPa;EAQbC,YARa;EASbC,IATa;EAUbC,MAVa;EAWbC;AAXa,CAAD;EAaZ,MAAMC,aAAa,GAAGC,MAAA,CAAgC,IAAhC,CAAtB;EAEAA,SAAA,CAAgB;IACZ,MAAMC,eAAe,GAAIC,KAAD;MACpB,IAAI,CAACJ,oBAAL,EAA2B;QACvB,IAAII,KAAK,CAACC,GAAN,KAAc,QAAd,IAA0BJ,aAAa,CAACK,OAAd,KAA0B,IAAxD,EAA8D;UAC1DF,KAAK,CAACG,cAAN;UACAN,aAAa,CAACK,OAAd,CAAsBE,KAAtB;UACA;;;KALZ;;IAUAC,MAAM,CAACC,gBAAP,CAAwB,SAAxB,EAAmCP,eAAnC;IAEA,OAAO;MACHM,MAAM,CAACE,mBAAP,CAA2B,SAA3B,EAAsCR,eAAtC;KADJ;GAbJ,EAgBG,EAhBH;EAkBA,OACID,aAAA,MAAA,oBAASL;IAAce,SAAS,EAAC;IAAjC,EACIV,aAAA,CAACW,UAAD,oBACQjB;IACJkB,GAAG,EAAEb;IACLc,UAAU,EAAC;IACXC,IAAI,EAAC;IACLC,KAAK,EAAElB,MAAM,CAACmB;kBACFnB,MAAM,CAACmB;IACnBN,SAAS,EAA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C;IACRyC,gBAAgB,EAAE;IAClBlC,eAAe,EAAEA;IACjBE,sBAAsB,EAAEA;IACxBe,QAAQ,EAAEA;IACVd,YAAY,EAAEA;IACdgC,MAAM,EAAE;;MAEJC,OAAO,EAAE;;QAELC,YAAY,EAAE;;;IAGtBpC,iBAAiB;IAxBrB,CADJ;AA4BH;AAEDX,IAAI,CAACgD,IAAL,GAAYlD,QAAZ;;;;"}
@@ -1,45 +1,39 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import React__default from 'react';
3
2
  import cn from 'classnames';
4
3
 
5
- var _excluded = ["children", "className", "expanded", "title", "fixed", "onClick"];
6
- var TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
4
+ const TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
7
5
  return React__default.createElement("a", Object.assign({}, props, {
8
6
  ref: ref
9
7
  }));
10
8
  });
11
- var TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function TreeviewGroup(props, ref) {
12
- var children = props.children,
13
- externalClassName = props.className,
14
- _props$expanded = props.expanded,
15
- initialExpanded = _props$expanded === void 0 ? false : _props$expanded,
16
- title = props.title,
17
- fixed = props.fixed,
18
- onClick = props.onClick,
19
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
20
-
21
- var _React$useState = React__default.useState(fixed || initialExpanded),
22
- expanded = _React$useState[0],
23
- setExpanded = _React$useState[1];
24
-
25
- React__default.useEffect(function () {
9
+ const TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function TreeviewGroup(props, ref) {
10
+ const {
11
+ children,
12
+ className: externalClassName,
13
+ expanded: initialExpanded = false,
14
+ title,
15
+ fixed,
16
+ onClick,
17
+ ...otherProps
18
+ } = props;
19
+ const [expanded, setExpanded] = React__default.useState(fixed || initialExpanded);
20
+ React__default.useEffect(() => {
26
21
  if (!fixed) {
27
22
  setExpanded(fixed || initialExpanded);
28
23
  }
29
24
  }, [fixed, initialExpanded]);
30
- var listClassName = cn('flex-col mb-0', {
25
+ const listClassName = cn('flex-col mb-0', {
31
26
  flex: expanded,
32
27
  hidden: !expanded
33
28
  });
34
-
35
- var itemProps = _extends({}, otherProps, {
29
+ const itemProps = { ...otherProps,
36
30
  'aria-expanded': expanded,
37
31
  role: 'treeitem',
38
32
  tabIndex: -1
39
- });
33
+ };
40
34
 
41
- var handleClick = function handleClick(event) {
42
- var nextState = !expanded;
35
+ const handleClick = event => {
36
+ const nextState = !expanded;
43
37
 
44
38
  if (!fixed) {
45
39
  setExpanded(nextState);
@@ -50,7 +44,7 @@ var TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function TreeviewGrou
50
44
  }
51
45
  };
52
46
 
53
- var className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;
47
+ const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;
54
48
  return React__default.createElement("div", Object.assign({}, itemProps, {
55
49
  className: className,
56
50
  ref: ref
@@ -59,18 +53,14 @@ var TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function TreeviewGrou
59
53
  }, typeof title === 'function' ? title(expanded) : title), React__default.createElement("ul", {
60
54
  role: "group",
61
55
  className: listClassName
62
- }, React__default.Children.toArray(children).filter(function (item) {
63
- return !!item;
64
- }).map(function (item, i) {
65
- return React__default.createElement("li", {
66
- key: i,
67
- role: "none"
68
- }, React__default.cloneElement(item, {
69
- role: 'treeitem'
70
- }));
71
- })));
56
+ }, React__default.Children.toArray(children).filter(item => !!item).map((item, i) => React__default.createElement("li", {
57
+ key: i,
58
+ role: "none"
59
+ }, React__default.cloneElement(item, {
60
+ role: 'treeitem'
61
+ })))));
72
62
  });
73
- var Treeview = /*#__PURE__*/React__default.forwardRef(function Treeview(props, ref) {
63
+ const Treeview = /*#__PURE__*/React__default.forwardRef(function Treeview(props, ref) {
74
64
  return React__default.createElement("div", Object.assign({}, props, {
75
65
  ref: ref,
76
66
  role: "tree"
@@ -1 +1 @@
1
- {"version":3,"file":"Treeview.js","sources":["../../../../src/components/Treeview/Treeview.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type TreeviewItemProps = React.LinkHTMLAttributes<HTMLAnchorElement>;\n\nconst TreeviewItem = React.forwardRef(function TreeviewItem(props: TreeviewItemProps, ref: React.Ref<HTMLAnchorElement>) {\n return <a {...props} ref={ref} />;\n});\n\nexport type TreeviewGroupProps = Omit<React.LinkHTMLAttributes<HTMLDivElement>, 'className' | 'onClick' | 'title'> & {\n /** Add a classname to the treeview */\n className?: string | ((expanded: boolean) => string);\n /**\n * Set wheter the region is expanded, showing the children, or collapsed.\n * Default value is `false`\n */\n expanded?: boolean;\n /** Region is expanded at mount and can't be collapsed */\n fixed?: boolean;\n /** Handler called when user clicks the title of the group */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;\n /** Text displayed in the group's header */\n title: React.ReactNode | ((expanded: boolean) => React.ReactNode);\n};\n\nconst TreeviewGroup = React.forwardRef(function TreeviewGroup(props: TreeviewGroupProps, ref: React.Ref<HTMLDivElement>) {\n const {\n children,\n className: externalClassName,\n expanded: initialExpanded = false,\n title,\n fixed,\n onClick,\n ...otherProps\n } = props;\n const [expanded, setExpanded] = React.useState(fixed || initialExpanded);\n\n React.useEffect(() => {\n if (!fixed) {\n setExpanded(fixed || initialExpanded);\n }\n }, [fixed, initialExpanded]);\n\n const listClassName = cn('flex-col mb-0', {\n flex: expanded,\n hidden: !expanded,\n });\n\n const itemProps = {\n ...otherProps,\n 'aria-expanded': expanded,\n role: 'treeitem',\n tabIndex: -1,\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n const nextState = !expanded;\n\n if (!fixed) {\n setExpanded(nextState);\n }\n\n if (onClick) {\n onClick(event, nextState);\n }\n };\n\n const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;\n\n return (\n <div {...itemProps} className={className} ref={ref}>\n <div onClick={handleClick}>{typeof title === 'function' ? title(expanded) : title}</div>\n <ul role=\"group\" className={listClassName}>\n {React.Children.toArray(children)\n .filter(item => !!item)\n .map((item, i) => (\n <li key={i} role=\"none\">\n {React.cloneElement(item as React.ReactElement<any>, { role: 'treeitem' })}\n </li>\n ))}\n </ul>\n </div>\n );\n});\n\nexport type TreeviewProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedTreeviewWithStatics = React.ForwardRefExoticComponent<\n TreeviewProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigable link */\n Item: React.ForwardRefExoticComponent<TreeviewItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /** Container for a set of related links, usually expandable */\n Group: React.ForwardRefExoticComponent<TreeviewGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Treeview = React.forwardRef(function Treeview(props: TreeviewProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} ref={ref} role=\"tree\" />;\n}) as ForwardedTreeviewWithStatics;\n\nTreeview.Group = TreeviewGroup;\nTreeview.Item = TreeviewItem;\n"],"names":["TreeviewItem","React","forwardRef","props","ref","TreeviewGroup","children","externalClassName","className","expanded","initialExpanded","title","fixed","onClick","otherProps","useState","setExpanded","useEffect","listClassName","cn","flex","hidden","itemProps","role","tabIndex","handleClick","event","nextState","Children","toArray","filter","item","map","i","key","cloneElement","Treeview","Group","Item"],"mappings":";;;;;AAKA,IAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,YAAT,CAAsBG,KAAtB,EAAgDC,GAAhD;EAClC,OAAOH,4BAAA,IAAA,oBAAOE;IAAOC,GAAG,EAAEA;IAAnB,CAAP;AACH,CAFoB,CAArB;AAoBA,IAAMC,aAAa,gBAAGJ,cAAK,CAACC,UAAN,CAAiB,SAASG,aAAT,CAAuBF,KAAvB,EAAkDC,GAAlD;EACnC,IACIE,QADJ,GAQIH,KARJ,CACIG,QADJ;MAEeC,iBAFf,GAQIJ,KARJ,CA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AD,CAAnC,GAAgDE,KAA5E,CADJ,EAEIV,4BAAA,KAAA;IAAIsB,IAAI,EAAC;IAAQf,SAAS,EAAEU;GAA5B,EACKjB,cAAK,CAAC2B,QAAN,CAAeC,OAAf,CAAuBvB,QAAvB,EACIwB,MADJ,CACW,UAAAC,IAAI;IAAA,OAAI,CAAC,CAACA,IAAN;GADf,EAEIC,GAFJ,CAEQ,UAACD,IAAD,EAAOE,CAAP;IAAA,OACDhC,4BAAA,KAAA;MAAIiC,GAAG,EAAED;MAAGV,IAAI,EAAC;KAAjB,EACKtB,cAAK,CAACkC,YAAN,CAAmBJ,IAAnB,EAAoD;MAAER,IAAI,EAAE;KAA5D,CADL,CADC;GAFR,CADL,CAFJ,CADJ;AAcH,CA1DqB,CAAtB;IAuEaa,QAAQ,gBAAGnC,cAAK,CAACC,UAAN,CAAiB,SAASkC,QAAT,CAAkBjC,KAAlB,EAAwCC,GAAxC;EACrC,OAAOH,4BAAA,MAAA,oBAASE;IAAOC,GAAG,EAAEA;IAAKmB,IAAI,EAAC;IAA/B,CAAP;AACH,CAFuB;AAIxBa,QAAQ,CAACC,KAAT,GAAiBhC,aAAjB;AACA+B,QAAQ,CAACE,IAAT,GAAgBtC,YAAhB;;;;"}
1
+ {"version":3,"file":"Treeview.js","sources":["../../../../src/components/Treeview/Treeview.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type TreeviewItemProps = React.LinkHTMLAttributes<HTMLAnchorElement>;\n\nconst TreeviewItem = React.forwardRef(function TreeviewItem(props: TreeviewItemProps, ref: React.Ref<HTMLAnchorElement>) {\n return <a {...props} ref={ref} />;\n});\n\nexport type TreeviewGroupProps = Omit<React.LinkHTMLAttributes<HTMLDivElement>, 'className' | 'onClick' | 'title'> & {\n /** Add a classname to the treeview */\n className?: string | ((expanded: boolean) => string);\n /**\n * Set wheter the region is expanded, showing the children, or collapsed.\n * Default value is `false`\n */\n expanded?: boolean;\n /** Region is expanded at mount and can't be collapsed */\n fixed?: boolean;\n /** Handler called when user clicks the title of the group */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;\n /** Text displayed in the group's header */\n title: React.ReactNode | ((expanded: boolean) => React.ReactNode);\n};\n\nconst TreeviewGroup = React.forwardRef(function TreeviewGroup(props: TreeviewGroupProps, ref: React.Ref<HTMLDivElement>) {\n const {\n children,\n className: externalClassName,\n expanded: initialExpanded = false,\n title,\n fixed,\n onClick,\n ...otherProps\n } = props;\n const [expanded, setExpanded] = React.useState(fixed || initialExpanded);\n\n React.useEffect(() => {\n if (!fixed) {\n setExpanded(fixed || initialExpanded);\n }\n }, [fixed, initialExpanded]);\n\n const listClassName = cn('flex-col mb-0', {\n flex: expanded,\n hidden: !expanded,\n });\n\n const itemProps = {\n ...otherProps,\n 'aria-expanded': expanded,\n role: 'treeitem',\n tabIndex: -1,\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n const nextState = !expanded;\n\n if (!fixed) {\n setExpanded(nextState);\n }\n\n if (onClick) {\n onClick(event, nextState);\n }\n };\n\n const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;\n\n return (\n <div {...itemProps} className={className} ref={ref}>\n <div onClick={handleClick}>{typeof title === 'function' ? title(expanded) : title}</div>\n <ul role=\"group\" className={listClassName}>\n {React.Children.toArray(children)\n .filter(item => !!item)\n .map((item, i) => (\n <li key={i} role=\"none\">\n {React.cloneElement(item as React.ReactElement<any>, { role: 'treeitem' })}\n </li>\n ))}\n </ul>\n </div>\n );\n});\n\nexport type TreeviewProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedTreeviewWithStatics = React.ForwardRefExoticComponent<\n TreeviewProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigable link */\n Item: React.ForwardRefExoticComponent<TreeviewItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /** Container for a set of related links, usually expandable */\n Group: React.ForwardRefExoticComponent<TreeviewGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Treeview = React.forwardRef(function Treeview(props: TreeviewProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} ref={ref} role=\"tree\" />;\n}) as ForwardedTreeviewWithStatics;\n\nTreeview.Group = TreeviewGroup;\nTreeview.Item = TreeviewItem;\n"],"names":["TreeviewItem","React","forwardRef","props","ref","TreeviewGroup","children","className","externalClassName","expanded","initialExpanded","title","fixed","onClick","otherProps","setExpanded","useState","useEffect","listClassName","cn","flex","hidden","itemProps","role","tabIndex","handleClick","event","nextState","Children","toArray","filter","item","map","i","key","cloneElement","Treeview","Group","Item"],"mappings":";;;AAKA,MAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,YAAT,CAAsBG,KAAtB,EAAgDC,GAAhD;EAClC,OAAOH,4BAAA,IAAA,oBAAOE;IAAOC,GAAG,EAAEA;IAAnB,CAAP;AACH,CAFoB,CAArB;AAoBA,MAAMC,aAAa,gBAAGJ,cAAK,CAACC,UAAN,CAAiB,SAASG,aAAT,CAAuBF,KAAvB,EAAkDC,GAAlD;EACnC,MAAM;IACFE,QADE;IAEFC,SAAS,EAAEC,iBAFT;IAGFC,QAAQ,EAAEC,eAAe,GAAG,KAH1B;IAIFC,KAJE;IAKFC,KALE;IAMFC,OANE;IAOF,GAAGC;MACHX,KARJ;EASA,MAAM,CAACM,QAAD,EAAWM,WAAX,IAA0Bd,cAAK,CAACe,QAAN,CAAeJ,KAAK,IAAIF,eAAxB,CAAhC;EAEAT,cAAK,CAACgB,SAAN,CAAgB;IACZ,IAAI,CAACL,KAAL,EAAY;MACRG,WAAW,CAACH,KAAK,IAAIF,eAAV,CAAX;;GAFR,EAIG,CAACE,KAAD,EAAQF,eAAR,CAJH;EAMA,MAAMQ,aAAa,GAAGC,EAAE,CAAC,eAAD,EAAkB;IACtCC,IAAI,EAAEX,QADgC;IAEtCY,MAAM,EAAE,CAACZ;GAFW,CAAxB;EAKA,MAAMa,SAAS,GAAG,EACd,GAAGR,UADW;IA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AIxBa,QAAQ,CAACC,KAAT,GAAiBhC,aAAjB;AACA+B,QAAQ,CAACE,IAAT,GAAgBtC,YAAhB;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, createElement } from 'react';
2
2
 
3
- var VisuallyHidden = /*#__PURE__*/forwardRef(function VisuallyHidden(props, ref) {
3
+ const VisuallyHidden = /*#__PURE__*/forwardRef(function VisuallyHidden(props, ref) {
4
4
  return createElement("span", Object.assign({}, props, {
5
5
  className: "sr-only",
6
6
  ref: ref
@@ -1 +1 @@
1
- {"version":3,"file":"VisuallyHidden.js","sources":["../../../../src/components/VisuallyHidden/VisuallyHidden.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype Props = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const VisuallyHidden = React.forwardRef(function VisuallyHidden(props: Props, ref: React.Ref<HTMLSpanElement>) {\n return <span {...props} className=\"sr-only\" ref={ref} />;\n});\n"],"names":["VisuallyHidden","React","props","ref","className"],"mappings":";;IAIaA,cAAc,gBAAGC,UAAA,CAAiB,SAASD,cAAT,CAAwBE,KAAxB,EAAsCC,GAAtC;EAC3C,OAAOF,aAAA,OAAA,oBAAUC;IAAOE,SAAS,EAAC;IAAUD,GAAG,EAAEA;IAA1C,CAAP;AACH,CAF6B;;;;"}
1
+ {"version":3,"file":"VisuallyHidden.js","sources":["../../../../src/components/VisuallyHidden/VisuallyHidden.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype Props = React.HTMLAttributes<HTMLSpanElement>;\n\nexport const VisuallyHidden = React.forwardRef(function VisuallyHidden(props: Props, ref: React.Ref<HTMLSpanElement>) {\n return <span {...props} className=\"sr-only\" ref={ref} />;\n});\n"],"names":["VisuallyHidden","React","props","ref","className"],"mappings":";;MAIaA,cAAc,gBAAGC,UAAA,CAAiB,SAASD,cAAT,CAAwBE,KAAxB,EAAsCC,GAAtC;EAC3C,OAAOF,aAAA,OAAA,oBAAUC;IAAOE,SAAS,EAAC;IAAUD,GAAG,EAAEA;IAA1C,CAAP;AACH,CAF6B;;;;"}
@@ -136,7 +136,7 @@
136
136
  input[type='search']::-webkit-search-cancel-button,
137
137
  input[type='search']::-webkit-search-results-button,
138
138
  input[type='search']::-webkit-search-results-decoration {
139
- -webkit-appearance: none;
139
+ @apply cursor-pointer;
140
140
  }
141
141
 
142
142
  table.yt-table {
@@ -441,14 +441,6 @@
441
441
  @apply mt-6;
442
442
  }
443
443
 
444
- [data-taco='group'] > [data-taco='badge'] + [data-taco='badge'] {
445
- @apply ml-1;
446
- }
447
-
448
- [data-taco='group'] > *:not(:first-child):not([data-taco='hanger']) {
449
- @apply ml-2;
450
- }
451
-
452
444
  [data-taco='hanger'] a {
453
445
  @apply text-grey underline;
454
446
  }
package/dist/esm/index.js CHANGED
@@ -16,7 +16,7 @@ export { Card } from './components/Card/Card.js';
16
16
  export { Checkbox } from './components/Checkbox/Checkbox.js';
17
17
  export { useProxiedRef } from './utils/hooks/useProxiedRef.js';
18
18
  export { Input } from './components/Input/Input.js';
19
- export { getNextIndexFromKeycode, useListKeyboardNavigation } from './utils/hooks/useListKeyboardNavigation.js';
19
+ export { getNextIndexFromKey, useListKeyboardNavigation } from './utils/hooks/useListKeyboardNavigation.js';
20
20
  export { useListScrollTo } from './utils/hooks/useListScrollTo.js';
21
21
  export { useBoundingClientRectListener } from './utils/hooks/useBoundingClientRectListener.js';
22
22
  export { Combobox } from './components/Combobox/Combobox.js';
@@ -1,24 +1,20 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { forwardRef, createElement, Children } from 'react';
3
2
 
4
- var _excluded = ["disabled", "target", "type"];
5
- var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
6
- var disabled = props.disabled,
7
- target = props.target,
8
- _props$type = props.type,
9
- type = _props$type === void 0 ? 'button' : _props$type,
10
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
11
-
12
- var Tag = props.href ? 'a' : 'button';
3
+ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4
+ const {
5
+ disabled,
6
+ target,
7
+ type = 'button',
8
+ ...otherProps
9
+ } = props;
10
+ const Tag = props.href ? 'a' : 'button';
13
11
  return createElement(Tag, Object.assign({}, otherProps, {
14
12
  "aria-disabled": disabled ? 'true' : undefined,
15
13
  disabled: disabled,
16
14
  target: Tag === 'a' ? target : undefined,
17
15
  type: Tag !== 'a' ? type : undefined,
18
16
  ref: ref
19
- }), Children.count(props.children) > 1 ? Children.map(props.children, function (child) {
20
- return typeof child === 'string' ? createElement("span", null, child) : child;
21
- }) : props.children);
17
+ }), Children.count(props.children) > 1 ? Children.map(props.children, child => typeof child === 'string' ? createElement("span", null, child) : child) : props.children);
22
18
  });
23
19
 
24
20
  export { Button };
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../src/primitives/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> & {\n /** Content should be a text */\n children: React.ReactNode;\n /** Provides url for buttons being used as a link */\n href?: string;\n /** Provides target for buttons being used as a link */\n target?: '_self' | '_blank' | '_parent' | '_top';\n};\n\nconst Button = React.forwardRef(function Button(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { disabled, target, type = 'button', ...otherProps } = props;\n\n const Tag = props.href ? 'a' : 'button';\n\n return (\n <Tag\n {...otherProps}\n aria-disabled={disabled ? 'true' : undefined}\n disabled={disabled}\n target={Tag === 'a' ? target : undefined}\n type={Tag !== 'a' ? type : undefined}\n ref={ref as any}\n >\n {React.Children.count(props.children) > 1\n ? React.Children.map(props.children, child => (typeof child === 'string' ? <span>{child}</span> : child))\n : props.children}\n </Tag>\n );\n});\n\nexport { Button, ButtonProps };\n"],"names":["Button","React","props","ref","disabled","target","type","otherProps","Tag","href","undefined","count","children","map","child"],"mappings":";;;;IAWMA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;EAC5B,IAAQC,QAAR,GAA6DF,KAA7D,CAAQE,QAAR;MAAkBC,MAAlB,GAA6DH,KAA7D,CAAkBG,MAAlB;oBAA6DH,KAA7D,CAA0BI,IAA1B;MAA0BA,IAA1B,4BAAiC,QAAjC;MAA8CC,UAA9C,iCAA6DL,KAA7D;;EAEA,IAAMM,GAAG,GAAGN,KAAK,CAACO,IAAN,GAAa,GAAb,GAAmB,QAA/B;EAEA,OACIR,aAAA,CAACO,GAAD,oBACQD;qBACWH,QAAQ,GAAG,MAAH,GAAYM;IACnCN,QAAQ,EAAEA;IACVC,MAAM,EAAEG,GAAG,KAAK,GAAR,GAAcH,MAAd,GAAuBK;IAC/BJ,IAAI,EAAEE,GAAG,KAAK,GAAR,GAAcF,IAAd,GAAqBI;IAC3BP,GAAG,EAAEA;IANT,EAQKF,QAAA,CAAeU,KAAf,CAAqBT,KAAK,CAACU,QAA3B,IAAuC,CAAvC,GACKX,QAAA,CAAeY,GAAf,CAAmBX,KAAK,CAACU,QAAzB,EAAmC,UAAAE,KAAK;IAAA,OAAK,OAAOA,KAAP,KAAiB,QAAjB,GAA4Bb,aAAA,OAAA,MAAA,EAAOa,KAAP,CAA5B,GAAmDA,KAAxD;GAAxC,CADL,GAEKZ,KAAK,CAACU,QAVhB,CADJ;AAcH,CAnBc;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../src/primitives/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> & {\n /** Content should be a text */\n children: React.ReactNode;\n /** Provides url for buttons being used as a link */\n href?: string;\n /** Provides target for buttons being used as a link */\n target?: '_self' | '_blank' | '_parent' | '_top';\n};\n\nconst Button = React.forwardRef(function Button(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { disabled, target, type = 'button', ...otherProps } = props;\n\n const Tag = props.href ? 'a' : 'button';\n\n return (\n <Tag\n {...otherProps}\n aria-disabled={disabled ? 'true' : undefined}\n disabled={disabled}\n target={Tag === 'a' ? target : undefined}\n type={Tag !== 'a' ? type : undefined}\n ref={ref as any}\n >\n {React.Children.count(props.children) > 1\n ? React.Children.map(props.children, child => (typeof child === 'string' ? <span>{child}</span> : child))\n : props.children}\n </Tag>\n );\n});\n\nexport { Button, ButtonProps };\n"],"names":["Button","React","props","ref","disabled","target","type","otherProps","Tag","href","undefined","count","children","map","child"],"mappings":";;MAWMA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;EAC5B,MAAM;IAAEC,QAAF;IAAYC,MAAZ;IAAoBC,IAAI,GAAG,QAA3B;IAAqC,GAAGC;MAAeL,KAA7D;EAEA,MAAMM,GAAG,GAAGN,KAAK,CAACO,IAAN,GAAa,GAAb,GAAmB,QAA/B;EAEA,OACIR,aAAA,CAACO,GAAD,oBACQD;qBACWH,QAAQ,GAAG,MAAH,GAAYM;IACnCN,QAAQ,EAAEA;IACVC,MAAM,EAAEG,GAAG,KAAK,GAAR,GAAcH,MAAd,GAAuBK;IAC/BJ,IAAI,EAAEE,GAAG,KAAK,GAAR,GAAcF,IAAd,GAAqBI;IAC3BP,GAAG,EAAEA;IANT,EAQKF,QAAA,CAAeU,KAAf,CAAqBT,KAAK,CAACU,QAA3B,IAAuC,CAAvC,GACKX,QAAA,CAAeY,GAAf,CAAmBX,KAAK,CAACU,QAAzB,EAAmCE,KAAK,IAAK,OAAOA,KAAP,KAAiB,QAAjB,GAA4Bb,aAAA,OAAA,MAAA,EAAOa,KAAP,CAA5B,GAAmDA,KAAhG,CADL,GAEKZ,KAAK,CAACU,QAVhB,CADJ;AAcH,CAnBc;;;;"}