@economic/taco 0.0.31-alpha.2 → 0.0.33-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/esm/components/Button/util.js +1 -1
  2. package/dist/esm/components/Button/util.js.map +1 -1
  3. package/dist/esm/components/Listbox/Listbox.js +24 -25
  4. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  5. package/dist/esm/components/Menu/Menu.js +20 -43
  6. package/dist/esm/components/Menu/Menu.js.map +1 -1
  7. package/dist/esm/components/Navigation/Navigation.js +35 -44
  8. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  9. package/dist/esm/components/Pagination/Pagination.js +39 -56
  10. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  11. package/dist/esm/components/Popover/Popover.js +29 -34
  12. package/dist/esm/components/Popover/Popover.js.map +1 -1
  13. package/dist/esm/components/Progress/Progress.js +11 -15
  14. package/dist/esm/components/Progress/Progress.js.map +1 -1
  15. package/dist/esm/components/Provider/Provider.js +13 -18
  16. package/dist/esm/components/Provider/Provider.js.map +1 -1
  17. package/dist/esm/components/RadioGroup/RadioGroup.js +45 -57
  18. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  19. package/dist/esm/components/SearchInput/SearchInput.js +10 -11
  20. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  21. package/dist/esm/components/Select/Select.js +30 -31
  22. package/dist/esm/components/Select/Select.js.map +1 -1
  23. package/dist/esm/components/Select/useSelect.js +3 -6
  24. package/dist/esm/components/Select/useSelect.js.map +1 -1
  25. package/dist/esm/components/Spinner/Spinner.js +12 -19
  26. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  27. package/dist/esm/components/Switch/Switch.js +9 -10
  28. package/dist/esm/components/Switch/Switch.js.map +1 -1
  29. package/dist/esm/components/Tabs/Tabs.js +25 -27
  30. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  31. package/dist/esm/components/Textarea/Textarea.js +11 -9
  32. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  33. package/dist/esm/components/Toast/Toaster.js +88 -118
  34. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  35. package/dist/esm/components/Tooltip/Tooltip.js +7 -8
  36. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  37. package/dist/esm/components/Treeview/Treeview.js +26 -36
  38. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  39. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
  40. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  41. package/dist/esm/index.css +3 -3
  42. package/dist/index.css +3 -3
  43. package/dist/taco.cjs.development.js +531 -647
  44. package/dist/taco.cjs.development.js.map +1 -1
  45. package/dist/taco.cjs.production.min.js +1 -1
  46. package/dist/taco.cjs.production.min.js.map +1 -1
  47. package/dist/utils/tailwind.d.ts +1 -1
  48. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.js","sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { PageNumbers } from './PageNumbers';\r\nimport { LocalizationTexts, useLocalization } from '../Provider/Provider';\r\nimport { Select } from '../Select/Select';\r\nimport { Group } from '../Group/Group';\r\nimport { IconButton } from '../IconButton/IconButton';\r\nimport { usePaginationValues } from './usePagination';\r\nimport { usePaginationShortcuts } from './usePaginationShortcuts';\r\n\r\nexport * from './usePagination';\r\n\r\nexport type PaginationTextsActions = {\r\n /**\r\n * Aria-label for first page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n firstPage: string;\r\n /**\r\n * Aria-label for first page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n firstPageWithShortcut: string;\r\n /**\r\n * Aria-label for next page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n nextPage: string;\r\n /**\r\n * Aria-label for next page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n nextPageWithShortcut: string;\r\n /**\r\n * Aria-label for previous page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n previousPage: string;\r\n /**\r\n * Aria-label for previous page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n previousPageWithShortcut: string;\r\n /**\r\n * Aria-label for last page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n lastPage: string;\r\n /**\r\n * Aria-label for last page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n lastPageWithShortcut: string;\r\n /**\r\n * Aria-label for page X action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n pageX: string;\r\n};\r\n\r\nexport type PaginationTexts = {\r\n /**\r\n * Aria-label provided for page numbers and page actions group.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n label: string;\r\n /**\r\n * Aria-label provided for page size selection.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n pageSize: string;\r\n /**\r\n * Text that indicates the number of the first and last element displayed on the current page, out of total items\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n showingXofYofTotal: string;\r\n /**\r\n * Aria-labels provided for page action buttons.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n actions: PaginationTextsActions;\r\n};\r\n\r\nexport type PaginationProps = React.HTMLAttributes<HTMLDivElement> &\r\n usePaginationValues & {\r\n /** Indicate total number of items that will be paginated */\r\n length: number;\r\n /** Page size options */\r\n pageSizes?: number[];\r\n /** Shows page controls */\r\n showPageControls?: boolean;\r\n /** Shows page numbers between navigation buttons, which allows users to quickly navigate to a specific page */\r\n showPageNumbers?: boolean;\r\n /** Shows a dropdown with page sizes, which allows user to change the number of items displayed on the page */\r\n showPageSize?: boolean;\r\n /** Enable pagination shortcuts */\r\n dangerouslyHijackGlobalKeyboardNavigation?: boolean;\r\n };\r\n\r\nconst getShowingLabel = (length: number, pageIndex: number, pageSize: number, texts: LocalizationTexts): string => {\r\n const minItemIndex = pageIndex * pageSize + 1;\r\n const maxItemIndex = (pageIndex + 1) * pageSize;\r\n\r\n return texts.pagination.showingXofYofTotal\r\n .replace('[X]', length === 0 ? '0' : String(minItemIndex))\r\n .replace('[Y]', String(maxItemIndex > length ? length : maxItemIndex))\r\n .replace('[total]', String(length));\r\n};\r\n\r\nexport const Pagination = React.forwardRef(function Pagination(props: PaginationProps, ref: React.Ref<HTMLDivElement>) {\r\n const {\r\n length,\r\n pageIndex,\r\n pageSize,\r\n pageSizes = [10, 25, 50, 100, 500],\r\n setPageIndex,\r\n setPageSize,\r\n showPageControls = true,\r\n showPageNumbers = true,\r\n showPageSize = true,\r\n dangerouslyHijackGlobalKeyboardNavigation = false,\r\n ...otherProps\r\n } = props;\r\n const { texts } = useLocalization();\r\n\r\n const maxPageIndex = Math.ceil(length / pageSize) - 1;\r\n const showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;\r\n\r\n usePaginationShortcuts({\r\n setPageIndex,\r\n maxPageIndex,\r\n pageIndex,\r\n dangerouslyHijackGlobalKeyboardNavigation,\r\n });\r\n\r\n const pageCount = Math.ceil(length / pageSize);\r\n const canPreviousPage = pageIndex > 0;\r\n const canNextPage = pageIndex < pageCount - 1;\r\n\r\n const className = cn('inline-flex relative justify-between items-center', props.className);\r\n\r\n return (\r\n <div {...otherProps} className={className} data-taco=\"pagination\" ref={ref}>\r\n {showPageSize && (\r\n <span className=\"mr-4\">\r\n {getShowingLabel(length, pageIndex, pageSize, texts)}\r\n <Select\r\n aria-label={texts.pagination.pageSize}\r\n className=\"ml-4 !w-20\"\r\n data={pageSizes.map(pageSize => ({\r\n text: String(pageSize),\r\n value: pageSize,\r\n }))}\r\n onChange={event => {\r\n setPageIndex(0);\r\n setPageSize(Number(event.target.value));\r\n }}\r\n value={pageSize}\r\n />\r\n </span>\r\n )}\r\n {showPageControls && (\r\n <Group as=\"nav\" aria-label={texts.pagination.label}>\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canPreviousPage}\r\n icon=\"arrow-start\"\r\n onClick={() => setPageIndex(0)}\r\n aria-label={\r\n showShortcutTexts\r\n ? texts.pagination.actions.firstPageWithShortcut\r\n : texts.pagination.actions.firstPage\r\n }\r\n tooltip={\r\n showShortcutTexts\r\n ? texts.pagination.actions.firstPageWithShortcut\r\n : texts.pagination.actions.firstPage\r\n }\r\n />\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canPreviousPage}\r\n icon=\"arrow-left\"\r\n onClick={() => setPageIndex(pageIndex - 1)}\r\n aria-label={\r\n showShortcutTexts\r\n ? texts.pagination.actions.previousPageWithShortcut\r\n : texts.pagination.actions.previousPage\r\n }\r\n tooltip={\r\n showShortcutTexts\r\n ? texts.pagination.actions.previousPageWithShortcut\r\n : texts.pagination.actions.previousPage\r\n }\r\n />\r\n {showPageNumbers && pageCount > 0 && (\r\n <PageNumbers pageCount={pageCount} currentPageIndex={pageIndex} onClick={setPageIndex} />\r\n )}\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canNextPage}\r\n icon=\"arrow-right\"\r\n onClick={() => setPageIndex(pageIndex + 1)}\r\n aria-label={\r\n showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage\r\n }\r\n tooltip={\r\n showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage\r\n }\r\n />\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canNextPage}\r\n icon=\"arrow-end\"\r\n onClick={() => setPageIndex(pageCount - 1)}\r\n aria-label={\r\n showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage\r\n }\r\n tooltip={\r\n showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage\r\n }\r\n />\r\n </Group>\r\n )}\r\n </div>\r\n );\r\n});\r\n"],"names":["getShowingLabel","length","pageIndex","pageSize","texts","minItemIndex","maxItemIndex","pagination","showingXofYofTotal","replace","String","Pagination","React","props","ref","pageSizes","setPageIndex","setPageSize","showPageControls","showPageNumbers","showPageSize","dangerouslyHijackGlobalKeyboardNavigation","otherProps","useLocalization","maxPageIndex","Math","ceil","showShortcutTexts","usePaginationShortcuts","pageCount","canPreviousPage","canNextPage","className","cn","Select","data","map","text","value","onChange","event","Number","target","Group","as","label","IconButton","appearance","disabled","icon","onClick","actions","firstPageWithShortcut","firstPage","tooltip","previousPageWithShortcut","previousPage","PageNumbers","currentPageIndex","nextPageWithShortcut","nextPage","lastPageWithShortcut","lastPage"],"mappings":";;;;;;;;;;;;;AAmGA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,MAAD,EAAiBC,SAAjB,EAAoCC,QAApC,EAAsDC,KAAtD;AACpB,MAAMC,YAAY,GAAGH,SAAS,GAAGC,QAAZ,GAAuB,CAA5C;AACA,MAAMG,YAAY,GAAG,CAACJ,SAAS,GAAG,CAAb,IAAkBC,QAAvC;AAEA,SAAOC,KAAK,CAACG,UAAN,CAAiBC,kBAAjB,CACFC,OADE,CACM,KADN,EACaR,MAAM,KAAK,CAAX,GAAe,GAAf,GAAqBS,MAAM,CAACL,YAAD,CADxC,EAEFI,OAFE,CAEM,KAFN,EAEaC,MAAM,CAACJ,YAAY,GAAGL,MAAf,GAAwBA,MAAxB,GAAiCK,YAAlC,CAFnB,EAGFG,OAHE,CAGM,SAHN,EAGiBC,MAAM,CAACT,MAAD,CAHvB,CAAP;AAIH,CARD;;IAUaU,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;AACvC,MACIb,MADJ,GAYIY,KAZJ,CACIZ,MADJ;AAAA,MAEIC,SAFJ,GAYIW,KAZJ,CAEIX,SAFJ;AAAA,MAGIC,QAHJ,GAYIU,KAZJ,CAGIV,QAHJ;AAAA,yBAYIU,KAZJ,CAIIE,S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,EAAC;AACXC,IAAAA,QAAQ,EAAE,CAACjB;AACXkB,IAAAA,IAAI,EAAC;AACLC,IAAAA,OAAO,EAAE;AAAA,aAAMlC,YAAY,CAACa,SAAS,GAAG,CAAb,CAAlB;AAAA;kBAELF,iBAAiB,GAAGvB,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBU,oBAA5B,GAAmDzD,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBW;AAEjGR,IAAAA,OAAO,EACH3B,iBAAiB,GAAGvB,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBU,oBAA5B,GAAmDzD,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBW;GATrG,CAhDJ,CApBR,CADJ;AAqFH,CArHyB;;;;"}
1
+ {"version":3,"file":"Pagination.js","sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { PageNumbers } from './PageNumbers';\r\nimport { LocalizationTexts, useLocalization } from '../Provider/Provider';\r\nimport { Select } from '../Select/Select';\r\nimport { Group } from '../Group/Group';\r\nimport { IconButton } from '../IconButton/IconButton';\r\nimport { usePaginationValues } from './usePagination';\r\nimport { usePaginationShortcuts } from './usePaginationShortcuts';\r\n\r\nexport * from './usePagination';\r\n\r\nexport type PaginationTextsActions = {\r\n /**\r\n * Aria-label for first page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n firstPage: string;\r\n /**\r\n * Aria-label for first page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n firstPageWithShortcut: string;\r\n /**\r\n * Aria-label for next page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n nextPage: string;\r\n /**\r\n * Aria-label for next page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n nextPageWithShortcut: string;\r\n /**\r\n * Aria-label for previous page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n previousPage: string;\r\n /**\r\n * Aria-label for previous page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n previousPageWithShortcut: string;\r\n /**\r\n * Aria-label for last page action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n lastPage: string;\r\n /**\r\n * Aria-label for last page action button with shortcut.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n lastPageWithShortcut: string;\r\n /**\r\n * Aria-label for page X action button.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n pageX: string;\r\n};\r\n\r\nexport type PaginationTexts = {\r\n /**\r\n * Aria-label provided for page numbers and page actions group.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n label: string;\r\n /**\r\n * Aria-label provided for page size selection.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n pageSize: string;\r\n /**\r\n * Text that indicates the number of the first and last element displayed on the current page, out of total items\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n showingXofYofTotal: string;\r\n /**\r\n * Aria-labels provided for page action buttons.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n actions: PaginationTextsActions;\r\n};\r\n\r\nexport type PaginationProps = React.HTMLAttributes<HTMLDivElement> &\r\n usePaginationValues & {\r\n /** Indicate total number of items that will be paginated */\r\n length: number;\r\n /** Page size options */\r\n pageSizes?: number[];\r\n /** Shows page controls */\r\n showPageControls?: boolean;\r\n /** Shows page numbers between navigation buttons, which allows users to quickly navigate to a specific page */\r\n showPageNumbers?: boolean;\r\n /** Shows a dropdown with page sizes, which allows user to change the number of items displayed on the page */\r\n showPageSize?: boolean;\r\n /** Enable pagination shortcuts */\r\n dangerouslyHijackGlobalKeyboardNavigation?: boolean;\r\n };\r\n\r\nconst getShowingLabel = (length: number, pageIndex: number, pageSize: number, texts: LocalizationTexts): string => {\r\n const minItemIndex = pageIndex * pageSize + 1;\r\n const maxItemIndex = (pageIndex + 1) * pageSize;\r\n\r\n return texts.pagination.showingXofYofTotal\r\n .replace('[X]', length === 0 ? '0' : String(minItemIndex))\r\n .replace('[Y]', String(maxItemIndex > length ? length : maxItemIndex))\r\n .replace('[total]', String(length));\r\n};\r\n\r\nexport const Pagination = React.forwardRef(function Pagination(props: PaginationProps, ref: React.Ref<HTMLDivElement>) {\r\n const {\r\n length,\r\n pageIndex,\r\n pageSize,\r\n pageSizes = [10, 25, 50, 100, 500],\r\n setPageIndex,\r\n setPageSize,\r\n showPageControls = true,\r\n showPageNumbers = true,\r\n showPageSize = true,\r\n dangerouslyHijackGlobalKeyboardNavigation = false,\r\n ...otherProps\r\n } = props;\r\n const { texts } = useLocalization();\r\n\r\n const maxPageIndex = Math.ceil(length / pageSize) - 1;\r\n const showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;\r\n\r\n usePaginationShortcuts({\r\n setPageIndex,\r\n maxPageIndex,\r\n pageIndex,\r\n dangerouslyHijackGlobalKeyboardNavigation,\r\n });\r\n\r\n const pageCount = Math.ceil(length / pageSize);\r\n const canPreviousPage = pageIndex > 0;\r\n const canNextPage = pageIndex < pageCount - 1;\r\n\r\n const className = cn('inline-flex relative justify-between items-center', props.className);\r\n\r\n return (\r\n <div {...otherProps} className={className} data-taco=\"pagination\" ref={ref}>\r\n {showPageSize && (\r\n <span className=\"mr-4\">\r\n {getShowingLabel(length, pageIndex, pageSize, texts)}\r\n <Select\r\n aria-label={texts.pagination.pageSize}\r\n className=\"ml-4 !w-20\"\r\n data={pageSizes.map(pageSize => ({\r\n text: String(pageSize),\r\n value: pageSize,\r\n }))}\r\n onChange={event => {\r\n setPageIndex(0);\r\n setPageSize(Number(event.target.value));\r\n }}\r\n value={pageSize}\r\n />\r\n </span>\r\n )}\r\n {showPageControls && (\r\n <Group as=\"nav\" aria-label={texts.pagination.label}>\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canPreviousPage}\r\n icon=\"arrow-start\"\r\n onClick={() => setPageIndex(0)}\r\n aria-label={\r\n showShortcutTexts\r\n ? texts.pagination.actions.firstPageWithShortcut\r\n : texts.pagination.actions.firstPage\r\n }\r\n tooltip={\r\n showShortcutTexts\r\n ? texts.pagination.actions.firstPageWithShortcut\r\n : texts.pagination.actions.firstPage\r\n }\r\n />\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canPreviousPage}\r\n icon=\"arrow-left\"\r\n onClick={() => setPageIndex(pageIndex - 1)}\r\n aria-label={\r\n showShortcutTexts\r\n ? texts.pagination.actions.previousPageWithShortcut\r\n : texts.pagination.actions.previousPage\r\n }\r\n tooltip={\r\n showShortcutTexts\r\n ? texts.pagination.actions.previousPageWithShortcut\r\n : texts.pagination.actions.previousPage\r\n }\r\n />\r\n {showPageNumbers && pageCount > 0 && (\r\n <PageNumbers pageCount={pageCount} currentPageIndex={pageIndex} onClick={setPageIndex} />\r\n )}\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canNextPage}\r\n icon=\"arrow-right\"\r\n onClick={() => setPageIndex(pageIndex + 1)}\r\n aria-label={\r\n showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage\r\n }\r\n tooltip={\r\n showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage\r\n }\r\n />\r\n <IconButton\r\n appearance=\"default\"\r\n disabled={!canNextPage}\r\n icon=\"arrow-end\"\r\n onClick={() => setPageIndex(pageCount - 1)}\r\n aria-label={\r\n showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage\r\n }\r\n tooltip={\r\n showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage\r\n }\r\n />\r\n </Group>\r\n )}\r\n </div>\r\n );\r\n});\r\n"],"names":["getShowingLabel","length","pageIndex","pageSize","texts","minItemIndex","maxItemIndex","pagination","showingXofYofTotal","replace","String","Pagination","React","props","ref","pageSizes","setPageIndex","setPageSize","showPageControls","showPageNumbers","showPageSize","dangerouslyHijackGlobalKeyboardNavigation","otherProps","useLocalization","maxPageIndex","Math","ceil","showShortcutTexts","usePaginationShortcuts","pageCount","canPreviousPage","canNextPage","className","cn","Select","data","map","text","value","onChange","event","Number","target","Group","as","label","IconButton","appearance","disabled","icon","onClick","actions","firstPageWithShortcut","firstPage","tooltip","previousPageWithShortcut","previousPage","PageNumbers","currentPageIndex","nextPageWithShortcut","nextPage","lastPageWithShortcut","lastPage"],"mappings":";;;;;;;;;;AAmGA,MAAMA,eAAe,GAAG,CAACC,MAAD,EAAiBC,SAAjB,EAAoCC,QAApC,EAAsDC,KAAtD;AACpB,QAAMC,YAAY,GAAGH,SAAS,GAAGC,QAAZ,GAAuB,CAA5C;AACA,QAAMG,YAAY,GAAG,CAACJ,SAAS,GAAG,CAAb,IAAkBC,QAAvC;AAEA,SAAOC,KAAK,CAACG,UAAN,CAAiBC,kBAAjB,CACFC,OADE,CACM,KADN,EACaR,MAAM,KAAK,CAAX,GAAe,GAAf,GAAqBS,MAAM,CAACL,YAAD,CADxC,EAEFI,OAFE,CAEM,KAFN,EAEaC,MAAM,CAACJ,YAAY,GAAGL,MAAf,GAAwBA,MAAxB,GAAiCK,YAAlC,CAFnB,EAGFG,OAHE,CAGM,SAHN,EAGiBC,MAAM,CAACT,MAAD,CAHvB,CAAP;AAIH,CARD;;MAUaU,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;AACvC,QAAM;AACFb,IAAAA,MADE;AAEFC,IAAAA,SAFE;AAGFC,IAAAA,QAHE;AAIFY,IAAAA,SAAS,GAAG,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,GAAb,EAAkB,GAAlB,CAJV;AAKFC,IAAAA,YALE;AAMFC,IAAAA,WANE;AAOFC,IAAAA,gBAAgB,GAAG,IAPjB;AAQFC,IAAAA,eAAe,GAAG,IARhB;AASFC,IAAAA,YAAY,GAAG,IATb;AAUFC,IAAAA,yCAAyC,GA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SAAS,EAAEA;AAAW6B,IAAAA,gBAAgB,EAAExD;AAAWgD,IAAAA,OAAO,EAAElC;GAAzE,CAlCR,EAoCIJ,aAAA,CAACkC,UAAD;AACIC,IAAAA,UAAU,EAAC;AACXC,IAAAA,QAAQ,EAAE,CAACjB;AACXkB,IAAAA,IAAI,EAAC;AACLC,IAAAA,OAAO,EAAE,MAAMlC,YAAY,CAACd,SAAS,GAAG,CAAb;kBAEvByB,iBAAiB,GAAGvB,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBQ,oBAA5B,GAAmDvD,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBS;AAEjGN,IAAAA,OAAO,EACH3B,iBAAiB,GAAGvB,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBQ,oBAA5B,GAAmDvD,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBS;GATrG,CApCJ,EAgDIhD,aAAA,CAACkC,UAAD;AACIC,IAAAA,UAAU,EAAC;AACXC,IAAAA,QAAQ,EAAE,CAACjB;AACXkB,IAAAA,IAAI,EAAC;AACLC,IAAAA,OAAO,EAAE,MAAMlC,YAAY,CAACa,SAAS,GAAG,CAAb;kBAEvBF,iBAAiB,GAAGvB,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBU,oBAA5B,GAAmDzD,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBW;AAEjGR,IAAAA,OAAO,EACH3B,iBAAiB,GAAGvB,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBU,oBAA5B,GAAmDzD,KAAK,CAACG,UAAN,CAAiB4C,OAAjB,CAAyBW;GATrG,CAhDJ,CApBR,CADJ;AAqFH,CArHyB;;;;"}
@@ -1,23 +1,21 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { forwardRef, useMemo, createElement, createContext, useContext, isValidElement } from 'react';
3
2
  import cn from 'classnames';
4
3
  import { Root, Trigger as Trigger$1, Close as Close$1 } from '@radix-ui/react-popover';
5
4
  import { UnstyledContent, UnstyledArrow } from './Primitives.js';
6
5
  import mergeRefs from '../../utils/mergeRefs.js';
7
6
 
8
- var _excluded = ["children", "trigger"];
9
- var PopoverContext = /*#__PURE__*/createContext({
7
+ const PopoverContext = /*#__PURE__*/createContext({
10
8
  props: {},
11
9
  ref: null
12
10
  });
13
- var Trigger = /*#__PURE__*/forwardRef(function PopoverTrigger(props, ref) {
11
+ const Trigger = /*#__PURE__*/forwardRef(function PopoverTrigger(props, ref) {
14
12
  var _props$children;
15
13
 
16
- var context = useContext(PopoverContext);
17
- var children = props.children;
14
+ const context = useContext(PopoverContext);
15
+ let children = props.children;
18
16
 
19
17
  if (isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
20
- console.warn("Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '" + props.children.type.name + "' in React.forwardRef()? Taco has wrapped '" + props.children.type.name + "' in a 'span' to maintain functionality, but this may cause unintended behaviour");
18
+ console.warn(`Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`);
21
19
  children = createElement("span", null, props.children);
22
20
  }
23
21
 
@@ -27,22 +25,22 @@ var Trigger = /*#__PURE__*/forwardRef(function PopoverTrigger(props, ref) {
27
25
  asChild: true
28
26
  }));
29
27
  });
30
- var RenderPropWrapper = /*#__PURE__*/forwardRef(function RenderPropWrapper(_ref, ref) {
31
- var children = _ref.children,
32
- onClick = _ref.onClick;
33
-
34
- var close = function close() {
28
+ const RenderPropWrapper = /*#__PURE__*/forwardRef(function RenderPropWrapper({
29
+ children,
30
+ onClick
31
+ }, ref) {
32
+ const close = () => {
35
33
  onClick(new CustomEvent('hide'));
36
34
  };
37
35
 
38
36
  return children({
39
- close: close,
40
- ref: ref
37
+ close,
38
+ ref
41
39
  });
42
40
  });
43
- var Content = /*#__PURE__*/forwardRef(function PopoverContent(props, ref) {
44
- var className = cn('bg-white focus:border-blue-light', props.className);
45
- var output;
41
+ const Content = /*#__PURE__*/forwardRef(function PopoverContent(props, ref) {
42
+ const className = cn('bg-white focus:border-blue-light', props.className);
43
+ let output;
46
44
 
47
45
  if (typeof props.children === 'function') {
48
46
  output = createElement(Close$1, {
@@ -60,23 +58,20 @@ var Content = /*#__PURE__*/forwardRef(function PopoverContent(props, ref) {
60
58
  className: "text-white"
61
59
  }));
62
60
  });
63
- var Close = /*#__PURE__*/forwardRef(function (props, ref) {
64
- return createElement(Close$1, Object.assign({}, props, {
65
- ref: ref,
66
- asChild: true
67
- }));
68
- });
69
- var Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
70
- var children = props.children,
71
- trigger = props.trigger,
72
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
73
-
74
- var context = useMemo(function () {
75
- return {
76
- props: otherProps,
77
- ref: ref
78
- };
79
- }, [otherProps]);
61
+ const Close = /*#__PURE__*/forwardRef((props, ref) => createElement(Close$1, Object.assign({}, props, {
62
+ ref: ref,
63
+ asChild: true
64
+ })));
65
+ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
66
+ const {
67
+ children,
68
+ trigger,
69
+ ...otherProps
70
+ } = props;
71
+ const context = useMemo(() => ({
72
+ props: otherProps,
73
+ ref
74
+ }), [otherProps]);
80
75
  return createElement(PopoverContext.Provider, {
81
76
  value: context
82
77
  }, createElement(Root, null, trigger && createElement(Trigger, null, trigger), children));
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { Placement } from '../..';\r\nimport { UnstyledArrow, UnstyledContent } from './Primitives';\r\nimport mergeRefs from '../../utils/mergeRefs';\r\n\r\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\r\n\r\nconst PopoverContext = React.createContext<PopoverContextValue>({\r\n props: {},\r\n ref: null,\r\n});\r\n\r\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\r\nconst Trigger = React.forwardRef(function PopoverTrigger(props: PopoverTriggerProps, ref: React.Ref<HTMLButtonElement>) {\r\n const context = React.useContext(PopoverContext);\r\n let children = props.children;\r\n\r\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\r\n console.warn(\r\n `Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\r\n );\r\n children = <span>{props.children}</span>;\r\n }\r\n\r\n return (\r\n <PopoverPrimitive.Trigger {...context.props} {...props} children={children} ref={mergeRefs([context.ref, ref])} asChild />\r\n );\r\n});\r\n\r\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick }: any, ref) {\r\n const close = () => {\r\n onClick(new CustomEvent('hide'));\r\n };\r\n\r\n return children({ close, ref });\r\n});\r\n\r\nexport type PopoverContentRenderProps = { close: () => void };\r\nexport type PopoverContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\r\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\r\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\r\n placement?: Placement;\r\n};\r\nconst Content = React.forwardRef(function PopoverContent(props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) {\r\n const className = cn('bg-white focus:border-blue-light', props.className);\r\n\r\n let output;\r\n\r\n if (typeof props.children === 'function') {\r\n output = (\r\n <PopoverPrimitive.Close asChild>\r\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\r\n </PopoverPrimitive.Close>\r\n );\r\n } else {\r\n output = props.children;\r\n }\r\n\r\n return (\r\n <UnstyledContent className={className} placement={props.placement} ref={ref}>\r\n {output}\r\n <UnstyledArrow className=\"text-white\" />\r\n </UnstyledContent>\r\n );\r\n});\r\n\r\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\r\nconst Close = React.forwardRef(\r\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\r\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\r\n )\r\n);\r\n\r\nexport type PopoverProps = React.PropsWithChildren<{\r\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n}>;\r\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\r\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\r\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\r\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\r\n};\r\n\r\nexport const Popover = React.forwardRef(function Popover(props: PopoverProps, ref: React.Ref<HTMLElement>) {\r\n const { children, trigger, ...otherProps } = props;\r\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\r\n\r\n return (\r\n <PopoverContext.Provider value={context}>\r\n <PopoverPrimitive.Root>\r\n {trigger && <Trigger>{trigger}</Trigger>}\r\n {children}\r\n </PopoverPrimitive.Root>\r\n </PopoverContext.Provider>\r\n );\r\n}) as ForwardedPopoverWithStatics;\r\nPopover.Trigger = Trigger;\r\nPopover.Content = Content;\r\nPopover.Close = Close;\r\n"],"names":["PopoverContext","React","props","ref","Trigger","PopoverTrigger","context","children","type","console","warn","name","PopoverPrimitive","mergeRefs","asChild","RenderPropWrapper","onClick","close","CustomEvent","Content","PopoverContent","className","cn","output","UnstyledContent","placement","UnstyledArrow","Close","Popover","trigger","otherProps","Provider","value"],"mappings":";;;;;;;;AASA,IAAMA,cAAc,gBAAGC,aAAA,CAAyC;AAC5DC,EAAAA,KAAK,EAAE,EADqD;AAE5DC,EAAAA,GAAG,EAA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cAAc,CAAC+B,QAAhB;AAAyBC,IAAAA,KAAK,EAAE1B;GAAhC,EACIL,aAAA,CAACW,IAAD,MAAA,EACKiB,OAAO,IAAI5B,aAAA,CAACG,OAAD,MAAA,EAAUyB,OAAV,CADhB,EAEKtB,QAFL,CADJ,CADJ;AAQH,CAZsB;AAavBqB,OAAO,CAACxB,OAAR,GAAkBA,OAAlB;AACAwB,OAAO,CAACT,OAAR,GAAkBA,OAAlB;AACAS,OAAO,CAACD,KAAR,GAAgBA,KAAhB;;;;"}
1
+ {"version":3,"file":"Popover.js","sources":["../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { Placement } from '../..';\r\nimport { UnstyledArrow, UnstyledContent } from './Primitives';\r\nimport mergeRefs from '../../utils/mergeRefs';\r\n\r\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\r\n\r\nconst PopoverContext = React.createContext<PopoverContextValue>({\r\n props: {},\r\n ref: null,\r\n});\r\n\r\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\r\nconst Trigger = React.forwardRef(function PopoverTrigger(props: PopoverTriggerProps, ref: React.Ref<HTMLButtonElement>) {\r\n const context = React.useContext(PopoverContext);\r\n let children = props.children;\r\n\r\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\r\n console.warn(\r\n `Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\r\n );\r\n children = <span>{props.children}</span>;\r\n }\r\n\r\n return (\r\n <PopoverPrimitive.Trigger {...context.props} {...props} children={children} ref={mergeRefs([context.ref, ref])} asChild />\r\n );\r\n});\r\n\r\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick }: any, ref) {\r\n const close = () => {\r\n onClick(new CustomEvent('hide'));\r\n };\r\n\r\n return children({ close, ref });\r\n});\r\n\r\nexport type PopoverContentRenderProps = { close: () => void };\r\nexport type PopoverContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\r\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\r\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\r\n placement?: Placement;\r\n};\r\nconst Content = React.forwardRef(function PopoverContent(props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) {\r\n const className = cn('bg-white focus:border-blue-light', props.className);\r\n\r\n let output;\r\n\r\n if (typeof props.children === 'function') {\r\n output = (\r\n <PopoverPrimitive.Close asChild>\r\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\r\n </PopoverPrimitive.Close>\r\n );\r\n } else {\r\n output = props.children;\r\n }\r\n\r\n return (\r\n <UnstyledContent className={className} placement={props.placement} ref={ref}>\r\n {output}\r\n <UnstyledArrow className=\"text-white\" />\r\n </UnstyledContent>\r\n );\r\n});\r\n\r\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\r\nconst Close = React.forwardRef(\r\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\r\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\r\n )\r\n);\r\n\r\nexport type PopoverProps = React.PropsWithChildren<{\r\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n}>;\r\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\r\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\r\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\r\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\r\n};\r\n\r\nexport const Popover = React.forwardRef(function Popover(props: PopoverProps, ref: React.Ref<HTMLElement>) {\r\n const { children, trigger, ...otherProps } = props;\r\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\r\n\r\n return (\r\n <PopoverContext.Provider value={context}>\r\n <PopoverPrimitive.Root>\r\n {trigger && <Trigger>{trigger}</Trigger>}\r\n {children}\r\n </PopoverPrimitive.Root>\r\n </PopoverContext.Provider>\r\n );\r\n}) as ForwardedPopoverWithStatics;\r\nPopover.Trigger = Trigger;\r\nPopover.Content = Content;\r\nPopover.Close = Close;\r\n"],"names":["PopoverContext","React","props","ref","Trigger","PopoverTrigger","context","children","type","console","warn","name","PopoverPrimitive","mergeRefs","asChild","RenderPropWrapper","onClick","close","CustomEvent","Content","PopoverContent","className","cn","output","UnstyledContent","placement","UnstyledArrow","Close","Popover","trigger","otherProps","Provider","value"],"mappings":";;;;;;AASA,MAAMA,cAAc,gBAAGC,aAAA,CAAyC;AAC5DC,EAAAA,KAAK,EAAE,EADqD;AAE5DC,EAAAA,GAAG,EAAE;AAFuD,CAAzC,CAAvB;AAMA,MAAMC,OAAO,gBAAGH,UAAA,CAAiB,SAASI,cAAT,CAAwBH,KAAxB,EAAoDC,GAApD;;;AAC7B,QAAMG,OAAO,GAAGL,UAAA,CAAiBD,cAAjB,CAAhB;AACA,MAAIO,QAAQ,GAAGL,KAAK,CAACK,QAArB;;AAEA,MAAIN,cAAA,CAAqBC,KAAK,CAACK,QAA3B,KAAwC,2BAAOL,KAAK,CAACK,QAAb,oDAAO,gBAAgBC,IAAvB,MAAgC,UAA5E,EAAwF;AACpFC,IAAAA,OAAO,CAACC,IAAR,qHACwHR,KAAK,CAACK,QAAN,CAAeC,IAAf,CAAoBG,kDAAkDT,KAAK,CAACK,QAAN,CAAeC,IAAf,CAAoBG,sFADlN;AAGAJ,IAAAA,QAAQ,GAAGN,aAAA,OAAA,MAAA,EAAOC,KAAK,CAACK,QAAb,CAAX;AACH;;AAED,SACIN,aAAA,CAACW,SAAD,oBAA8BN,OAAO,CAACJ,OAAWA;AAAOK,IAAAA,QAAQ,EAAEA;AAAUJ,IAAAA,GAAG,EAAEU,SAAS,CAAC,CAACP,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;AAAOC,EAAAA,GAAG,EAAEA;AAAKW,EAAAA,OAAO;EAApD,CAFM,CAAd;MAgBac,OAAO,gBAAG3B,UAAA,CAAiB,SAAS2B,OAAT,CAAiB1B,KAAjB,EAAsCC,GAAtC;AACpC,QAAM;AAAEI,IAAAA,QAAF;AAAYsB,IAAAA,OAAZ;AAAqB,OAAGC;AAAxB,MAAuC5B,KAA7C;AACA,QAAMI,OAAO,GAAGL,OAAA,CAAc,OAAO;AAAEC,IAAAA,KAAK,EAAE4B,UAAT;AAAqB3B,IAAAA;AAArB,GAAP,CAAd,EAAkD,CAAC2B,UAAD,CAAlD,CAAhB;AAEA,SACI7B,aAAA,CAACD,cAAc,CAAC+B,QAAhB;AAAyBC,IAAAA,KAAK,EAAE1B;GAAhC,EACIL,aAAA,CAACW,IAAD,MAAA,EACKiB,OAAO,IAAI5B,aAAA,CAACG,OAAD,MAAA,EAAUyB,OAAV,CADhB,EAEKtB,QAFL,CADJ,CADJ;AAQH,CAZsB;AAavBqB,OAAO,CAACxB,OAAR,GAAkBA,OAAlB;AACAwB,OAAO,CAACT,OAAR,GAAkBA,OAAlB;AACAS,OAAO,CAACD,KAAR,GAAgBA,KAAhB;;;;"}
@@ -1,27 +1,23 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import React__default from 'react';
3
2
  import cn from 'classnames';
4
3
 
5
- var _excluded = ["duration"];
6
- var Progress = function Progress(_ref) {
7
- var _cn;
8
-
9
- var _ref$duration = _ref.duration,
10
- duration = _ref$duration === void 0 ? undefined : _ref$duration,
11
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
12
-
13
- var style;
4
+ const Progress = ({
5
+ duration = undefined,
6
+ ...props
7
+ }) => {
8
+ let style;
14
9
 
15
10
  if (duration) {
16
11
  style = {
17
- animationDuration: duration + "ms"
12
+ animationDuration: `${duration}ms`
18
13
  };
19
14
  }
20
15
 
21
- var className = cn('bg-grey-light rounded block h-1 overflow-hidden w-full', props.className);
22
- var progressClassName = cn('yt-progress__bar block h-1', (_cn = {
23
- "w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']": !duration
24
- }, _cn["w-0 bg-grey-dark animate-[progress_linear]"] = duration, _cn));
16
+ const className = cn('bg-grey-light rounded block h-1 overflow-hidden w-full', props.className);
17
+ const progressClassName = cn('yt-progress__bar block h-1', {
18
+ "w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']": !duration,
19
+ [`w-0 bg-grey-dark animate-[progress_linear]`]: duration
20
+ });
25
21
  return React__default.createElement("span", Object.assign({}, props, {
26
22
  "data-taco": "progress",
27
23
  className: className
@@ -1 +1 @@
1
- {"version":3,"file":"Progress.js","sources":["../../../../src/components/Progress/Progress.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport './Progress.css';\r\n\r\nexport type ProgressProps = React.HTMLAttributes<HTMLSpanElement> & {\r\n /**\r\n * Indicates how long (in milliseconds) a progress bar will take to progress through.\r\n * By default, progress bar has no duration\r\n */\r\n duration?: number;\r\n};\r\n\r\nexport const Progress = ({ duration = undefined, ...props }: ProgressProps): JSX.Element => {\r\n let style;\r\n\r\n if (duration) {\r\n style = {\r\n animationDuration: `${duration}ms`,\r\n };\r\n }\r\n\r\n const className = cn('bg-grey-light rounded block h-1 overflow-hidden w-full', props.className);\r\n\r\n const progressClassName = cn('yt-progress__bar block h-1', {\r\n \"w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']\":\r\n !duration,\r\n [`w-0 bg-grey-dark animate-[progress_linear]`]: duration,\r\n });\r\n\r\n return (\r\n <span {...props} data-taco=\"progress\" className={className}>\r\n <span className={progressClassName} data-taco=\"progress-bar\" style={style} />\r\n </span>\r\n );\r\n};\r\n"],"names":["Progress","duration","undefined","props","style","animationDuration","className","cn","progressClassName","React"],"mappings":";;;;;IAYaA,QAAQ,GAAG,SAAXA,QAAW;;;2BAAGC;MAAAA,sCAAWC;MAAcC;;AAChD,MAAIC,KAAJ;;AAEA,MAAIH,QAAJ,EAAc;AACVG,IAAAA,KAAK,GAAG;AACJC,MAAAA,iBAAiB,EAAKJ,QAAL;AADb,KAAR;AAGH;;AAED,MAAMK,SAAS,GAAGC,EAAE,CAAC,wDAAD,EAA2DJ,KAAK,CAACG,SAAjE,CAApB;AAEA,MAAME,iBAAiB,GAAGD,EAAE,CAAC,4BAAD;AACxB,6JACI,CAACN;AAFmB,yDAGwBA,QAHxB,OAA5B;AAMA,SACIQ,4BAAA,OAAA,oBAAUN;iBAAiB;AAAWG,IAAAA,SAAS,EAAEA;IAAjD,EACIG,4BAAA,OAAA;AAAMH,IAAAA,SAAS,EAAEE;iBAA6B;AAAeJ,IAAAA,KAAK,EAAEA;GAApE,CADJ,CADJ;AAKH;;;;"}
1
+ {"version":3,"file":"Progress.js","sources":["../../../../src/components/Progress/Progress.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport './Progress.css';\r\n\r\nexport type ProgressProps = React.HTMLAttributes<HTMLSpanElement> & {\r\n /**\r\n * Indicates how long (in milliseconds) a progress bar will take to progress through.\r\n * By default, progress bar has no duration\r\n */\r\n duration?: number;\r\n};\r\n\r\nexport const Progress = ({ duration = undefined, ...props }: ProgressProps): JSX.Element => {\r\n let style;\r\n\r\n if (duration) {\r\n style = {\r\n animationDuration: `${duration}ms`,\r\n };\r\n }\r\n\r\n const className = cn('bg-grey-light rounded block h-1 overflow-hidden w-full', props.className);\r\n\r\n const progressClassName = cn('yt-progress__bar block h-1', {\r\n \"w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']\":\r\n !duration,\r\n [`w-0 bg-grey-dark animate-[progress_linear]`]: duration,\r\n });\r\n\r\n return (\r\n <span {...props} data-taco=\"progress\" className={className}>\r\n <span className={progressClassName} data-taco=\"progress-bar\" style={style} />\r\n </span>\r\n );\r\n};\r\n"],"names":["Progress","duration","undefined","props","style","animationDuration","className","cn","progressClassName","React"],"mappings":";;;MAYaA,QAAQ,GAAG,CAAC;AAAEC,EAAAA,QAAQ,GAAGC,SAAb;AAAwB,KAAGC;AAA3B,CAAD;AACpB,MAAIC,KAAJ;;AAEA,MAAIH,QAAJ,EAAc;AACVG,IAAAA,KAAK,GAAG;AACJC,MAAAA,iBAAiB,KAAKJ;AADlB,KAAR;AAGH;;AAED,QAAMK,SAAS,GAAGC,EAAE,CAAC,wDAAD,EAA2DJ,KAAK,CAACG,SAAjE,CAApB;AAEA,QAAME,iBAAiB,GAAGD,EAAE,CAAC,4BAAD,EAA+B;AACvD,6JACI,CAACN,QAFkD;AAGvD,iDAAA,GAAgDA;AAHO,GAA/B,CAA5B;AAMA,SACIQ,4BAAA,OAAA,oBAAUN;iBAAiB;AAAWG,IAAAA,SAAS,EAAEA;IAAjD,EACIG,4BAAA,OAAA;AAAMH,IAAAA,SAAS,EAAEE;iBAA6B;AAAeJ,IAAAA,KAAK,EAAEA;GAApE,CADJ,CADJ;AAKH;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { useMemo, createElement, useContext, createContext } from 'react';
2
2
  import { ToastProvider } from '../Toast/Toaster.js';
3
3
 
4
- var defaultLocalisationTexts = {
4
+ const defaultLocalisationTexts = {
5
5
  calendar: {
6
6
  months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
7
7
  weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
@@ -76,35 +76,30 @@ var defaultLocalisationTexts = {
76
76
  inputLabel: 'Search...'
77
77
  }
78
78
  };
79
- var defaultLocalizationContext = {
79
+ const defaultLocalizationContext = {
80
80
  locale: 'en-GB',
81
81
  texts: defaultLocalisationTexts,
82
82
  formatting: {
83
83
  date: 'dd.mm.yy'
84
84
  }
85
85
  };
86
- var Context = /*#__PURE__*/createContext({
86
+ const Context = /*#__PURE__*/createContext({
87
87
  localization: defaultLocalizationContext
88
88
  });
89
- var Provider = function Provider(props) {
90
- var children = props.children,
91
- _props$localization = props.localization,
92
- localization = _props$localization === void 0 ? defaultLocalizationContext : _props$localization;
93
- var value = useMemo(function () {
94
- return {
95
- localization: localization
96
- };
97
- }, [localization]);
89
+ const Provider = props => {
90
+ const {
91
+ children,
92
+ localization = defaultLocalizationContext
93
+ } = props;
94
+ const value = useMemo(() => ({
95
+ localization
96
+ }), [localization]);
98
97
  return createElement(Context.Provider, {
99
98
  value: value
100
99
  }, createElement(ToastProvider, null, children));
101
100
  };
102
- var useTaco = function useTaco() {
103
- return useContext(Context);
104
- };
105
- var useLocalization = function useLocalization() {
106
- return useTaco().localization;
107
- };
101
+ const useTaco = () => useContext(Context);
102
+ const useLocalization = () => useTaco().localization;
108
103
 
109
104
  export { Provider, defaultLocalisationTexts, useLocalization, useTaco };
110
105
  //# sourceMappingURL=Provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","sources":["../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\r\n\r\nimport { Locale } from '../../types';\r\nimport { CalendarTexts } from '../Calendar/Calendar';\r\nimport { ComboboxTexts } from '../Combobox/Combobox';\r\nimport { DialogTexts } from '../Dialog/Dialog';\r\nimport { PaginationTexts } from '../Pagination/Pagination';\r\nimport { ListboxTexts } from '../Listbox/Listbox';\r\nimport { ToastsTexts } from '../Toast/Toast';\r\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\r\nimport { HangerTexts } from '../Hanger/Hanger';\r\nimport { SelectTexts } from '../Select/Select';\r\nimport { TourTexts } from '../Tour/Tour';\r\nimport { TableTexts } from '../Table/Table';\r\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\r\nimport { ToastProvider } from '../Toast/Toaster';\r\n\r\nexport type LocalizationTexts = {\r\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\r\n calendar: CalendarTexts;\r\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\r\n combobox: ComboboxTexts;\r\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\r\n datepicker: DatepickerTexts;\r\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\r\n hanger: HangerTexts;\r\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\r\n listbox: ListboxTexts;\r\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\r\n dialog: DialogTexts;\r\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\r\n pagination: PaginationTexts;\r\n /** Localized texts and aria-labels for [Table](component:table) component */\r\n table: TableTexts;\r\n /** Localized texts and aria-labels for [Select](component:select) component */\r\n select: SelectTexts;\r\n /** Localized texts and aria-labels for [Toast](component:toast) component */\r\n toasts: ToastsTexts;\r\n /** Localized texts and aria-labels for [Tour](component:tour) component */\r\n tour: TourTexts;\r\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\r\n searchInput: SearchInputTexts;\r\n};\r\n\r\nexport type Localization = {\r\n /**\r\n * Provide the language code used in application.\r\n * Default value is `en-GB`\r\n */\r\n locale: Locale;\r\n /** Provide the texts and aria-labels for components used within the provider */\r\n texts: LocalizationTexts;\r\n /** Provide the formatting */\r\n formatting: {\r\n /** Default value is `dd.mm.yy` */\r\n date: string;\r\n };\r\n};\r\nexport type Taco = {\r\n /** Define localized texts and formatted data in your application */\r\n localization: Localization;\r\n};\r\n\r\nexport const defaultLocalisationTexts = {\r\n calendar: {\r\n months: [\r\n 'January',\r\n 'February',\r\n 'March',\r\n 'April',\r\n 'May',\r\n 'June',\r\n 'July',\r\n 'August',\r\n 'September',\r\n 'October',\r\n 'November',\r\n 'December',\r\n ],\r\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\r\n actions: {\r\n previousMonth: 'Previous month',\r\n nextMonth: 'Next month',\r\n previousYear: 'Previous year',\r\n nextYear: 'Next year',\r\n today: 'Today',\r\n },\r\n },\r\n combobox: {\r\n tooltip: 'Search in list',\r\n },\r\n datepicker: {\r\n calendar: 'Calendar',\r\n clear: 'Clear',\r\n expand: 'Show calendar',\r\n shortcuts: 'Shortcuts',\r\n },\r\n hanger: {\r\n close: 'Close',\r\n },\r\n listbox: {\r\n loading: 'Loading results...',\r\n empty: 'No results found',\r\n allOption: 'All',\r\n },\r\n dialog: {\r\n close: 'Close',\r\n drag: 'Drag',\r\n },\r\n pagination: {\r\n label: 'Pagination',\r\n pageSize: 'Items per page',\r\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\r\n actions: {\r\n firstPage: 'Goto first page',\r\n firstPageWithShortcut: 'Goto first page (Home)',\r\n previousPage: 'Goto previous page',\r\n previousPageWithShortcut: 'Goto previous page (Page Up)',\r\n nextPage: 'Goto next page',\r\n nextPageWithShortcut: 'Goto next page (Page Down)',\r\n lastPage: 'Goto last page',\r\n lastPageWithShortcut: 'Goto last page (End)',\r\n pageX: 'Goto page [X]',\r\n },\r\n },\r\n table: {\r\n actions: 'Other actions',\r\n edit: 'Edit (e)',\r\n copy: 'Copy (c)',\r\n del: 'Delete (del)',\r\n newSubRow: 'New row (shift + n)',\r\n loading: 'Loading...',\r\n },\r\n select: {\r\n allOptionsSelected: 'All',\r\n },\r\n toasts: {\r\n dismiss: 'Dismiss',\r\n },\r\n tour: {\r\n back: 'Back',\r\n close: 'Close',\r\n skip: 'Close and complete',\r\n last: 'Done',\r\n next: 'Next',\r\n open: 'Open',\r\n },\r\n searchInput: {\r\n inputLabel: 'Search...',\r\n },\r\n};\r\n\r\nconst defaultLocalizationContext: Localization = {\r\n locale: 'en-GB',\r\n texts: defaultLocalisationTexts,\r\n formatting: {\r\n date: 'dd.mm.yy',\r\n },\r\n};\r\n\r\nconst Context = React.createContext<Taco>({\r\n localization: defaultLocalizationContext,\r\n});\r\n\r\nexport type ProviderProps = {\r\n /** Content would be your application */\r\n children?: any;\r\n /** Define localized texts and formatted data in your application */\r\n localization?: Localization;\r\n};\r\n\r\nexport const Provider = (props: ProviderProps): JSX.Element => {\r\n const { children, localization = defaultLocalizationContext } = props;\r\n const value = React.useMemo(() => ({ localization }), [localization]);\r\n\r\n return (\r\n <Context.Provider value={value}>\r\n <ToastProvider>{children}</ToastProvider>\r\n </Context.Provider>\r\n );\r\n};\r\n\r\nexport const useTaco = (): Taco => React.useContext(Context);\r\nexport const useLocalization = (): Localization => useTaco().localization;\r\n"],"names":["defaultLocalisationTexts","calendar","months","weekdaysShort","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","hanger","close","listbox","loading","empty","allOption","dialog","drag","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","select","allOptionsSelected","toasts","dismiss","tour","back","skip","last","next","open","searchInput","inputLabel","defaultLocalizationContext","locale","texts","formatting","date","Context","React","localization","Provider","props","children","value","ToastProvider","useTaco","useLocalization"],"mappings":";;;IA+DaA,wBAAwB,GAAG;AACpCC,EAAAA,QAAQ,EAAE;AACNC,IAAAA,MAAM,EAAE,CACJ,SADI,EAEJ,UAFI,EAGJ,OAHI,EAIJ,OAJI,EAKJ,KALI,EAMJ,MANI,EAOJ,MAPI,EAQJ,QARI,EASJ,WATI,EAUJ,SAVI,EAWJ,UAXI,EAYJ,UAZI,CADF;AAeNC,IAAAA,aAAa,EAAE,CAAC,KAAD,EAAQ,KAAR,EAAe,KAAf,EAAsB,KAAtB,EAA6B,KAA7B,EAAoC,KAApC,EAA2C,KAA3C,CAfT;AAgBNC,IAAAA,OAAO,EAAE;AACLC,MAAAA,aAAa,EAAE,gBADV;AAELC,MAAAA,SAAS,EAAE,YAFN;AAGLC,MAAAA,YAAY,EAAE,eAHT;AAIL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ADJ;AAKH;IAEYG,OAAO,GAAG,SAAVA,OAAU;AAAA,SAAYP,UAAA,CAAiBD,OAAjB,CAAZ;AAAA;IACVS,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAAoBD,OAAO,GAAGN,YAA9B;AAAA;;;;"}
1
+ {"version":3,"file":"Provider.js","sources":["../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\r\n\r\nimport { Locale } from '../../types';\r\nimport { CalendarTexts } from '../Calendar/Calendar';\r\nimport { ComboboxTexts } from '../Combobox/Combobox';\r\nimport { DialogTexts } from '../Dialog/Dialog';\r\nimport { PaginationTexts } from '../Pagination/Pagination';\r\nimport { ListboxTexts } from '../Listbox/Listbox';\r\nimport { ToastsTexts } from '../Toast/Toast';\r\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\r\nimport { HangerTexts } from '../Hanger/Hanger';\r\nimport { SelectTexts } from '../Select/Select';\r\nimport { TourTexts } from '../Tour/Tour';\r\nimport { TableTexts } from '../Table/Table';\r\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\r\nimport { ToastProvider } from '../Toast/Toaster';\r\n\r\nexport type LocalizationTexts = {\r\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\r\n calendar: CalendarTexts;\r\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\r\n combobox: ComboboxTexts;\r\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\r\n datepicker: DatepickerTexts;\r\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\r\n hanger: HangerTexts;\r\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\r\n listbox: ListboxTexts;\r\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\r\n dialog: DialogTexts;\r\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\r\n pagination: PaginationTexts;\r\n /** Localized texts and aria-labels for [Table](component:table) component */\r\n table: TableTexts;\r\n /** Localized texts and aria-labels for [Select](component:select) component */\r\n select: SelectTexts;\r\n /** Localized texts and aria-labels for [Toast](component:toast) component */\r\n toasts: ToastsTexts;\r\n /** Localized texts and aria-labels for [Tour](component:tour) component */\r\n tour: TourTexts;\r\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\r\n searchInput: SearchInputTexts;\r\n};\r\n\r\nexport type Localization = {\r\n /**\r\n * Provide the language code used in application.\r\n * Default value is `en-GB`\r\n */\r\n locale: Locale;\r\n /** Provide the texts and aria-labels for components used within the provider */\r\n texts: LocalizationTexts;\r\n /** Provide the formatting */\r\n formatting: {\r\n /** Default value is `dd.mm.yy` */\r\n date: string;\r\n };\r\n};\r\nexport type Taco = {\r\n /** Define localized texts and formatted data in your application */\r\n localization: Localization;\r\n};\r\n\r\nexport const defaultLocalisationTexts = {\r\n calendar: {\r\n months: [\r\n 'January',\r\n 'February',\r\n 'March',\r\n 'April',\r\n 'May',\r\n 'June',\r\n 'July',\r\n 'August',\r\n 'September',\r\n 'October',\r\n 'November',\r\n 'December',\r\n ],\r\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\r\n actions: {\r\n previousMonth: 'Previous month',\r\n nextMonth: 'Next month',\r\n previousYear: 'Previous year',\r\n nextYear: 'Next year',\r\n today: 'Today',\r\n },\r\n },\r\n combobox: {\r\n tooltip: 'Search in list',\r\n },\r\n datepicker: {\r\n calendar: 'Calendar',\r\n clear: 'Clear',\r\n expand: 'Show calendar',\r\n shortcuts: 'Shortcuts',\r\n },\r\n hanger: {\r\n close: 'Close',\r\n },\r\n listbox: {\r\n loading: 'Loading results...',\r\n empty: 'No results found',\r\n allOption: 'All',\r\n },\r\n dialog: {\r\n close: 'Close',\r\n drag: 'Drag',\r\n },\r\n pagination: {\r\n label: 'Pagination',\r\n pageSize: 'Items per page',\r\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\r\n actions: {\r\n firstPage: 'Goto first page',\r\n firstPageWithShortcut: 'Goto first page (Home)',\r\n previousPage: 'Goto previous page',\r\n previousPageWithShortcut: 'Goto previous page (Page Up)',\r\n nextPage: 'Goto next page',\r\n nextPageWithShortcut: 'Goto next page (Page Down)',\r\n lastPage: 'Goto last page',\r\n lastPageWithShortcut: 'Goto last page (End)',\r\n pageX: 'Goto page [X]',\r\n },\r\n },\r\n table: {\r\n actions: 'Other actions',\r\n edit: 'Edit (e)',\r\n copy: 'Copy (c)',\r\n del: 'Delete (del)',\r\n newSubRow: 'New row (shift + n)',\r\n loading: 'Loading...',\r\n },\r\n select: {\r\n allOptionsSelected: 'All',\r\n },\r\n toasts: {\r\n dismiss: 'Dismiss',\r\n },\r\n tour: {\r\n back: 'Back',\r\n close: 'Close',\r\n skip: 'Close and complete',\r\n last: 'Done',\r\n next: 'Next',\r\n open: 'Open',\r\n },\r\n searchInput: {\r\n inputLabel: 'Search...',\r\n },\r\n};\r\n\r\nconst defaultLocalizationContext: Localization = {\r\n locale: 'en-GB',\r\n texts: defaultLocalisationTexts,\r\n formatting: {\r\n date: 'dd.mm.yy',\r\n },\r\n};\r\n\r\nconst Context = React.createContext<Taco>({\r\n localization: defaultLocalizationContext,\r\n});\r\n\r\nexport type ProviderProps = {\r\n /** Content would be your application */\r\n children?: any;\r\n /** Define localized texts and formatted data in your application */\r\n localization?: Localization;\r\n};\r\n\r\nexport const Provider = (props: ProviderProps): JSX.Element => {\r\n const { children, localization = defaultLocalizationContext } = props;\r\n const value = React.useMemo(() => ({ localization }), [localization]);\r\n\r\n return (\r\n <Context.Provider value={value}>\r\n <ToastProvider>{children}</ToastProvider>\r\n </Context.Provider>\r\n );\r\n};\r\n\r\nexport const useTaco = (): Taco => React.useContext(Context);\r\nexport const useLocalization = (): Localization => useTaco().localization;\r\n"],"names":["defaultLocalisationTexts","calendar","months","weekdaysShort","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","hanger","close","listbox","loading","empty","allOption","dialog","drag","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","select","allOptionsSelected","toasts","dismiss","tour","back","skip","last","next","open","searchInput","inputLabel","defaultLocalizationContext","locale","texts","formatting","date","Context","React","localization","Provider","props","children","value","ToastProvider","useTaco","useLocalization"],"mappings":";;;MA+DaA,wBAAwB,GAAG;AACpCC,EAAAA,QAAQ,EAAE;AACNC,IAAAA,MAAM,EAAE,CACJ,SADI,EAEJ,UAFI,EAGJ,OAHI,EAIJ,OAJI,EAKJ,KALI,EAMJ,MANI,EAOJ,MAPI,EAQJ,QARI,EASJ,WATI,EAUJ,SAVI,EAWJ,UAXI,EAYJ,UAZI,CADF;AAeNC,IAAAA,aAAa,EAAE,CAAC,KAAD,EAAQ,KAAR,EAAe,KAAf,EAAsB,KAAtB,EAA6B,KAA7B,EAAoC,KAApC,EAA2C,KAA3C,CAfT;AAgBNC,IAAAA,OAAO,EAAE;AACLC,MAAAA,aAAa,EAAE,gBADV;AAELC,MAAAA,SAAS,EAAE,YAFN;AAGLC,MAAAA,YAAY,EAAE,eAHT;AAILC,MAAAA,QAAQ,EAAE,WAJL;AAKLC,MAAAA,KAAK,EAAE;AALF;AAhBH,GAD0B;AAyBpCC,EAAAA,QAAQ,EAAE;AACNC,IAAAA,OAAO,EAAE;AADH,GAzB0B;AA4BpCC,EAAAA,UAAU,EAAE;AACRX,IAAAA,QAAQ,EAAE,UADF;AAERY,IAAAA,KAAK,EAAE,OAFC;AAGRC,IAAAA,MAAM,EAAE,eAHA;AAIRC,IAAAA,SAAS,EAAE;AAJH,GA5BwB;AAkCpCC,EAAAA,MAAM,EAAE;AACJC,IAAAA,KAAK,EAAE;AADH,GAlC4B;AAqCpCC,EAAAA,OAAO,EAAE;AACLC,IAAAA,OAAO,EAAE,oBADJ;AAELC,IAAAA,KAAK,EAAE,kBAFF;AAGLC,IAAAA,SAAS,EAAE;AAHN,GArC2B;AA0CpCC,EAAAA,MAAM,EAAE;AACJ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MAAMC,0BAA0B,GAAiB;AAC7CC,EAAAA,MAAM,EAAE,OADqC;AAE7CC,EAAAA,KAAK,EAAExD,wBAFsC;AAG7CyD,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AADE;AAHiC,CAAjD;AAQA,MAAMC,OAAO,gBAAGC,aAAA,CAA0B;AACtCC,EAAAA,YAAY,EAAEP;AADwB,CAA1B,CAAhB;MAWaQ,QAAQ,GAAIC,KAAD;AACpB,QAAM;AAAEC,IAAAA,QAAF;AAAYH,IAAAA,YAAY,GAAGP;AAA3B,MAA0DS,KAAhE;AACA,QAAME,KAAK,GAAGL,OAAA,CAAc,OAAO;AAAEC,IAAAA;AAAF,GAAP,CAAd,EAAwC,CAACA,YAAD,CAAxC,CAAd;AAEA,SACID,aAAA,CAACD,OAAO,CAACG,QAAT;AAAkBG,IAAAA,KAAK,EAAEA;GAAzB,EACIL,aAAA,CAACM,aAAD,MAAA,EAAgBF,QAAhB,CADJ,CADJ;AAKH;MAEYG,OAAO,GAAG,MAAYP,UAAA,CAAiBD,OAAjB;MACtBS,eAAe,GAAG,MAAoBD,OAAO,GAAGN;;;;"}
@@ -1,36 +1,27 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { useMemo, Children, isValidElement, forwardRef, createElement, createContext, useContext } from 'react';
3
2
  import cn from 'classnames';
4
3
  import { Root, Item, Indicator } from '@radix-ui/react-radio-group';
5
4
 
6
- var _excluded = ["children", "value"],
7
- _excluded2 = ["children", "defaultValue", "disabled", "invalid", "onChange", "orientation", "value"];
8
- var getRadioGroupItemValueAsString = function getRadioGroupItemValueAsString(value) {
9
- return value === null ? '' : String(value);
10
- };
11
- var findByValue = function findByValue(values, valueAsString) {
12
- return values.find(function (value) {
13
- return getRadioGroupItemValueAsString(value) === valueAsString;
14
- });
15
- };
16
- var RadioGroupContext = /*#__PURE__*/createContext({
5
+ const getRadioGroupItemValueAsString = value => value === null ? '' : String(value);
6
+ const findByValue = (values, valueAsString) => values.find(value => getRadioGroupItemValueAsString(value) === valueAsString);
7
+ const RadioGroupContext = /*#__PURE__*/createContext({
17
8
  disabled: false,
18
9
  invalid: false
19
10
  });
20
- var RadioGroupItem = /*#__PURE__*/forwardRef(function RadioGroupItem(props, ref) {
21
- var context = useContext(RadioGroupContext);
22
-
23
- var children = props.children,
24
- value = props.value,
25
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
26
-
27
- var disabled = context.disabled || props.disabled;
28
- var className = cn('flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mr-2 mt-[0.2rem] rounded-full bg-white border-2 ', {
11
+ const RadioGroupItem = /*#__PURE__*/forwardRef(function RadioGroupItem(props, ref) {
12
+ const context = useContext(RadioGroupContext);
13
+ const {
14
+ children,
15
+ value,
16
+ ...otherProps
17
+ } = props;
18
+ const disabled = context.disabled || props.disabled;
19
+ const className = cn('flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mr-2 mt-[0.2rem] rounded-full bg-white border-2 ', {
29
20
  'border-grey-dark focus:border-blue focus:yt-focus aria-checked:bg-blue aria-checked:border-blue': !disabled && !context.invalid,
30
21
  'border-grey cursor-not-allowed aria-checked:bg-grey-dark aria-checked:border-grey-dark': disabled,
31
22
  'border-red text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red': context.invalid && !disabled
32
23
  });
33
- var labelClassName = cn('flex items-center cursor-pointer', {
24
+ const labelClassName = cn('flex items-center cursor-pointer', {
34
25
  'cursor-not-allowed text-grey-dark': disabled
35
26
  }, props.className);
36
27
  return createElement("label", {
@@ -44,38 +35,34 @@ var RadioGroupItem = /*#__PURE__*/forwardRef(function RadioGroupItem(props, ref)
44
35
  className: "h-2 w-2 rounded-full bg-white"
45
36
  })), children);
46
37
  });
47
- var useRadioGroup = function useRadioGroup(props) {
48
- var children = props.children,
49
- defaultValue = props.defaultValue,
50
- disabled = props.disabled,
51
- invalid = props.invalid,
52
- onChange = props.onChange,
53
- _props$orientation = props.orientation,
54
- orientation = _props$orientation === void 0 ? 'vertical' : _props$orientation,
55
- value = props.value,
56
- otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
57
-
58
- var values = useMemo(function () {
59
- var radioGroupItemValues = [];
60
- Children.forEach(children, function (child) {
38
+ const useRadioGroup = props => {
39
+ const {
40
+ children,
41
+ defaultValue,
42
+ disabled,
43
+ invalid,
44
+ onChange,
45
+ orientation = 'vertical',
46
+ value,
47
+ ...otherProps
48
+ } = props;
49
+ const values = useMemo(() => {
50
+ const radioGroupItemValues = [];
51
+ Children.forEach(children, child => {
61
52
  if (isValidElement(child)) {
62
53
  radioGroupItemValues.push(child.props.value);
63
54
  }
64
55
  });
65
56
  return radioGroupItemValues;
66
57
  }, [children]);
67
- var context = useMemo(function () {
68
- return {
69
- disabled: disabled !== null && disabled !== void 0 ? disabled : false,
70
- invalid: invalid !== null && invalid !== void 0 ? invalid : false
71
- };
72
- }, [disabled, invalid]);
73
- var valueProps;
58
+ const context = useMemo(() => ({
59
+ disabled: disabled !== null && disabled !== void 0 ? disabled : false,
60
+ invalid: invalid !== null && invalid !== void 0 ? invalid : false
61
+ }), [disabled, invalid]);
62
+ let valueProps;
74
63
 
75
64
  if (onChange !== undefined) {
76
- var handleChange = function handleChange(value) {
77
- return onChange(findByValue(values, value));
78
- };
65
+ const handleChange = value => onChange(findByValue(values, value));
79
66
 
80
67
  valueProps = {
81
68
  onValueChange: handleChange,
@@ -88,19 +75,20 @@ var useRadioGroup = function useRadioGroup(props) {
88
75
  }
89
76
 
90
77
  return {
91
- context: context,
92
- props: _extends({}, otherProps, valueProps, {
93
- children: children,
94
- orientation: orientation
95
- })
78
+ context,
79
+ props: { ...otherProps,
80
+ ...valueProps,
81
+ children,
82
+ orientation
83
+ }
96
84
  };
97
85
  };
98
- var RadioGroup = /*#__PURE__*/forwardRef(function RadioGroup(props, ref) {
99
- var _useRadioGroup = useRadioGroup(props),
100
- context = _useRadioGroup.context,
101
- otherProps = _useRadioGroup.props;
102
-
103
- var className = cn('flex items-start', {
86
+ const RadioGroup = /*#__PURE__*/forwardRef(function RadioGroup(props, ref) {
87
+ const {
88
+ context,
89
+ props: otherProps
90
+ } = useRadioGroup(props);
91
+ const className = cn('flex items-start', {
104
92
  'flex-wrap space-x-4': otherProps.orientation === 'horizontal',
105
93
  'flex-col space-y-2': otherProps.orientation === 'vertical'
106
94
  }, otherProps.className);
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sources":["../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\r\nimport { Orientation } from '../../types';\r\n\r\nexport type RadioGroupItemValue = string | number | boolean | null;\r\n\r\nexport const getRadioGroupItemValueAsString = (value: RadioGroupItemValue): string => (value === null ? '' : String(value));\r\n\r\nexport const findByValue = (values: RadioGroupItemValue[], valueAsString: string): RadioGroupItemValue =>\r\n values.find(value => getRadioGroupItemValueAsString(value) === valueAsString) as RadioGroupItemValue;\r\n\r\nconst RadioGroupContext = React.createContext({ disabled: false, invalid: false });\r\n\r\nexport type RadioGroupItemProps<T = HTMLButtonElement> = Omit<\r\n React.ButtonHTMLAttributes<T>,\r\n 'children' | 'onSelect' | 'value'\r\n> & {\r\n /** Label for the radio group item */\r\n children: React.ReactNode;\r\n /* Whether the radio group item is disabled */\r\n disabled?: boolean;\r\n /** Value of the radio button */\r\n value: RadioGroupItemValue;\r\n};\r\n\r\nconst RadioGroupItem = React.forwardRef(function RadioGroupItem(props: RadioGroupItemProps, ref: React.Ref<HTMLButtonElement>) {\r\n const context = React.useContext(RadioGroupContext);\r\n const { children, value, ...otherProps } = props;\r\n\r\n const disabled = context.disabled || props.disabled;\r\n\r\n const className = cn(\r\n 'flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mr-2 mt-[0.2rem] rounded-full bg-white border-2 ',\r\n {\r\n 'border-grey-dark focus:border-blue focus:yt-focus aria-checked:bg-blue aria-checked:border-blue':\r\n !disabled && !context.invalid,\r\n 'border-grey cursor-not-allowed aria-checked:bg-grey-dark aria-checked:border-grey-dark': disabled,\r\n 'border-red text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red':\r\n context.invalid && !disabled,\r\n }\r\n );\r\n const labelClassName = cn(\r\n 'flex items-center cursor-pointer',\r\n {\r\n 'cursor-not-allowed text-grey-dark': disabled,\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <label className={labelClassName}>\r\n <RadioGroupPrimitive.Item\r\n {...otherProps}\r\n className={className}\r\n disabled={disabled}\r\n ref={ref}\r\n value={getRadioGroupItemValueAsString(value)}\r\n >\r\n <RadioGroupPrimitive.Indicator className=\"h-2 w-2 rounded-full bg-white\" />\r\n </RadioGroupPrimitive.Item>\r\n {children}\r\n </label>\r\n );\r\n});\r\n\r\ntype ReactGroupBaseChild = React.ReactElement<RadioGroupItemProps> | boolean | null;\r\n\r\ntype RadioGroupBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\r\n children: ReactGroupBaseChild[];\r\n /* Whether the radio group is disabled */\r\n disabled?: boolean;\r\n /* Whether the radio group is in an invalid state */\r\n invalid?: boolean;\r\n /** The name of the radio group, used when submitting an HTML form */\r\n name?: string;\r\n /**\r\n * Orientation of the radio group\r\n * @defaultValue vertical\r\n */\r\n orientation?: Orientation;\r\n /* Whether the radio group requires user input */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledRadioGroupProps extends RadioGroupBaseProps {\r\n /* The default value (uncontrolled) */\r\n defaultValue?: RadioGroupItemValue;\r\n onChange?: never;\r\n value?: never;\r\n}\r\n\r\ninterface ControlledRadioGroupProps extends RadioGroupBaseProps {\r\n defaultValue?: never;\r\n /** Handler called when the value changes */\r\n onChange: (value: RadioGroupItemValue) => void;\r\n /** The current value (controlled) */\r\n value?: RadioGroupItemValue;\r\n}\r\n\r\nexport type RadioGroupProps = UncontrolledRadioGroupProps | ControlledRadioGroupProps;\r\n\r\nexport type ForwardedRadioGroupWithStatics = React.ForwardRefExoticComponent<\r\n RadioGroupProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Item component rendered in a `RadioGroup` component */\r\n Item: React.ForwardRefExoticComponent<RadioGroupItemProps>;\r\n};\r\n\r\nexport const useRadioGroup = (props: RadioGroupProps) => {\r\n const { children, defaultValue, disabled, invalid, onChange, orientation = 'vertical', value, ...otherProps } = props;\r\n\r\n const values = React.useMemo<RadioGroupItemValue[]>(() => {\r\n const radioGroupItemValues: RadioGroupItemValue[] = [];\r\n\r\n React.Children.forEach(children, child => {\r\n if (React.isValidElement(child)) {\r\n radioGroupItemValues.push(child.props.value);\r\n }\r\n });\r\n\r\n return radioGroupItemValues;\r\n }, [children]);\r\n\r\n const context = React.useMemo(() => ({ disabled: disabled ?? false, invalid: invalid ?? false }), [disabled, invalid]);\r\n\r\n let valueProps;\r\n\r\n if (onChange !== undefined) {\r\n const handleChange = (value: string): void => onChange(findByValue(values, value));\r\n\r\n valueProps = {\r\n onValueChange: handleChange,\r\n value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined,\r\n };\r\n } else {\r\n valueProps = {\r\n defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined,\r\n };\r\n }\r\n\r\n return {\r\n context,\r\n props: {\r\n ...otherProps,\r\n ...valueProps,\r\n children,\r\n orientation,\r\n },\r\n };\r\n};\r\n\r\nexport const RadioGroup = React.forwardRef(function RadioGroup(props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) {\r\n const { context, props: otherProps } = useRadioGroup(props);\r\n const className = cn(\r\n 'flex items-start',\r\n {\r\n 'flex-wrap space-x-4': otherProps.orientation === 'horizontal',\r\n 'flex-col space-y-2': otherProps.orientation === 'vertical',\r\n },\r\n otherProps.className\r\n );\r\n\r\n return (\r\n <RadioGroupContext.Provider value={context}>\r\n <RadioGroupPrimitive.Root {...otherProps} className={className} data-taco=\"radio-group\" ref={ref} />\r\n </RadioGroupContext.Provider>\r\n );\r\n}) as ForwardedRadioGroupWithStatics;\r\nRadioGroup.Item = RadioGroupItem;\r\n"],"names":["getRadioGroupItemValueAsString","value","String","findByValue","values","valueAsString","find","RadioGroupContext","React","disabled","invalid","RadioGroupItem","props","ref","context","children","otherProps","className","cn","labelClassName","RadioGroupPrimitive","useRadioGroup","defaultValue","onChange","orientation","radioGroupItemValues","forEach","child","push","valueProps","undefined","handleChange","onValueChange","RadioGroup","Provider","Item"],"mappings":";;;;;;;IAOaA,8BAA8B,GAAG,SAAjCA,8BAAiC,CAACC,KAAD;AAAA,SAAyCA,KAAK,KAAK,IAAV,GAAiB,EAAjB,GAAsBC,MAAM,CAACD,KAAD,CAArE;AAAA;IAEjCE,WAAW,GAAG,SAAdA,WAAc,CAACC,MAAD,EAAgCC,aAAhC;AAAA,SACvBD,MAAM,CAACE,IAAP,CAAY,UAAAL,KAAK;AAAA,WAAID,8BAA8B,CAACC,KAAD,CAA9B,KAA0CI,aAA9C;AAAA,GAAjB,CADuB;AAAA;AAG3B,IAAME,iBAAiB,gBAAGC,aAAA,CAAoB;AAAEC,EAAAA,QAAQ,EAAE,KAAZ;AAAmBC,EAAAA,OAAO,EAAE;AAA5B,CAApB,CAA1B;AAcA,IAAMC,cAAc,gBAAGH,UAAA,CAAiB,SAASG,cAAT,CAAwBC,KAAxB,EAAoDC,GAApD;AACpC,MAAMC,OAAO,GAAGN,UAAA,CAAiBD,iBAAjB,CAAhB;;AACA,MAAQQ,QAAR,GAA2CH,KAA3C,CAAQG,QAAR;AAAA,MAAkBd,KAAlB,GAA2CW,KAA3C,CAAkBX,KAAlB;AAAA,MAA4Be,UAA5B,iCAA2CJ,KAA3C;;AAEA,MAAMH,QAAQ,GAAGK,OAAO,CAACL,QAAR,IAAoBG,KAAK,CAACH,QAA3C;AAEA,MAAMQ,SAAS,GAAGC,EAAE,CAChB,oHADgB,EA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A4CC,GAA5C;AACvC,uBAAuCQ,aAAa,CAACT,KAAD,CAApD;AAAA,MAAQE,OAAR,kBAAQA,OAAR;AAAA,MAAwBE,UAAxB,kBAAiBJ,KAAjB;;AACA,MAAMK,SAAS,GAAGC,EAAE,CAChB,kBADgB,EAEhB;AACI,2BAAuBF,UAAU,CAACQ,WAAX,KAA2B,YADtD;AAEI,0BAAsBR,UAAU,CAACQ,WAAX,KAA2B;AAFrD,GAFgB,EAMhBR,UAAU,CAACC,SANK,CAApB;AASA,SACIT,aAAA,CAACD,iBAAiB,CAAC2B,QAAnB;AAA4BjC,IAAAA,KAAK,EAAEa;GAAnC,EACIN,aAAA,CAACY,IAAD,oBAA8BJ;AAAYC,IAAAA,SAAS,EAAEA;iBAAqB;AAAcJ,IAAAA,GAAG,EAAEA;IAA7F,CADJ,CADJ;AAKH,CAhByB;AAiB1BoB,UAAU,CAACE,IAAX,GAAkBxB,cAAlB;;;;"}
1
+ {"version":3,"file":"RadioGroup.js","sources":["../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\r\nimport { Orientation } from '../../types';\r\n\r\nexport type RadioGroupItemValue = string | number | boolean | null;\r\n\r\nexport const getRadioGroupItemValueAsString = (value: RadioGroupItemValue): string => (value === null ? '' : String(value));\r\n\r\nexport const findByValue = (values: RadioGroupItemValue[], valueAsString: string): RadioGroupItemValue =>\r\n values.find(value => getRadioGroupItemValueAsString(value) === valueAsString) as RadioGroupItemValue;\r\n\r\nconst RadioGroupContext = React.createContext({ disabled: false, invalid: false });\r\n\r\nexport type RadioGroupItemProps<T = HTMLButtonElement> = Omit<\r\n React.ButtonHTMLAttributes<T>,\r\n 'children' | 'onSelect' | 'value'\r\n> & {\r\n /** Label for the radio group item */\r\n children: React.ReactNode;\r\n /* Whether the radio group item is disabled */\r\n disabled?: boolean;\r\n /** Value of the radio button */\r\n value: RadioGroupItemValue;\r\n};\r\n\r\nconst RadioGroupItem = React.forwardRef(function RadioGroupItem(props: RadioGroupItemProps, ref: React.Ref<HTMLButtonElement>) {\r\n const context = React.useContext(RadioGroupContext);\r\n const { children, value, ...otherProps } = props;\r\n\r\n const disabled = context.disabled || props.disabled;\r\n\r\n const className = cn(\r\n 'flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mr-2 mt-[0.2rem] rounded-full bg-white border-2 ',\r\n {\r\n 'border-grey-dark focus:border-blue focus:yt-focus aria-checked:bg-blue aria-checked:border-blue':\r\n !disabled && !context.invalid,\r\n 'border-grey cursor-not-allowed aria-checked:bg-grey-dark aria-checked:border-grey-dark': disabled,\r\n 'border-red text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red':\r\n context.invalid && !disabled,\r\n }\r\n );\r\n const labelClassName = cn(\r\n 'flex items-center cursor-pointer',\r\n {\r\n 'cursor-not-allowed text-grey-dark': disabled,\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <label className={labelClassName}>\r\n <RadioGroupPrimitive.Item\r\n {...otherProps}\r\n className={className}\r\n disabled={disabled}\r\n ref={ref}\r\n value={getRadioGroupItemValueAsString(value)}\r\n >\r\n <RadioGroupPrimitive.Indicator className=\"h-2 w-2 rounded-full bg-white\" />\r\n </RadioGroupPrimitive.Item>\r\n {children}\r\n </label>\r\n );\r\n});\r\n\r\ntype ReactGroupBaseChild = React.ReactElement<RadioGroupItemProps> | boolean | null;\r\n\r\ntype RadioGroupBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\r\n children: ReactGroupBaseChild[];\r\n /* Whether the radio group is disabled */\r\n disabled?: boolean;\r\n /* Whether the radio group is in an invalid state */\r\n invalid?: boolean;\r\n /** The name of the radio group, used when submitting an HTML form */\r\n name?: string;\r\n /**\r\n * Orientation of the radio group\r\n * @defaultValue vertical\r\n */\r\n orientation?: Orientation;\r\n /* Whether the radio group requires user input */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledRadioGroupProps extends RadioGroupBaseProps {\r\n /* The default value (uncontrolled) */\r\n defaultValue?: RadioGroupItemValue;\r\n onChange?: never;\r\n value?: never;\r\n}\r\n\r\ninterface ControlledRadioGroupProps extends RadioGroupBaseProps {\r\n defaultValue?: never;\r\n /** Handler called when the value changes */\r\n onChange: (value: RadioGroupItemValue) => void;\r\n /** The current value (controlled) */\r\n value?: RadioGroupItemValue;\r\n}\r\n\r\nexport type RadioGroupProps = UncontrolledRadioGroupProps | ControlledRadioGroupProps;\r\n\r\nexport type ForwardedRadioGroupWithStatics = React.ForwardRefExoticComponent<\r\n RadioGroupProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Item component rendered in a `RadioGroup` component */\r\n Item: React.ForwardRefExoticComponent<RadioGroupItemProps>;\r\n};\r\n\r\nexport const useRadioGroup = (props: RadioGroupProps) => {\r\n const { children, defaultValue, disabled, invalid, onChange, orientation = 'vertical', value, ...otherProps } = props;\r\n\r\n const values = React.useMemo<RadioGroupItemValue[]>(() => {\r\n const radioGroupItemValues: RadioGroupItemValue[] = [];\r\n\r\n React.Children.forEach(children, child => {\r\n if (React.isValidElement(child)) {\r\n radioGroupItemValues.push(child.props.value);\r\n }\r\n });\r\n\r\n return radioGroupItemValues;\r\n }, [children]);\r\n\r\n const context = React.useMemo(() => ({ disabled: disabled ?? false, invalid: invalid ?? false }), [disabled, invalid]);\r\n\r\n let valueProps;\r\n\r\n if (onChange !== undefined) {\r\n const handleChange = (value: string): void => onChange(findByValue(values, value));\r\n\r\n valueProps = {\r\n onValueChange: handleChange,\r\n value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined,\r\n };\r\n } else {\r\n valueProps = {\r\n defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined,\r\n };\r\n }\r\n\r\n return {\r\n context,\r\n props: {\r\n ...otherProps,\r\n ...valueProps,\r\n children,\r\n orientation,\r\n },\r\n };\r\n};\r\n\r\nexport const RadioGroup = React.forwardRef(function RadioGroup(props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) {\r\n const { context, props: otherProps } = useRadioGroup(props);\r\n const className = cn(\r\n 'flex items-start',\r\n {\r\n 'flex-wrap space-x-4': otherProps.orientation === 'horizontal',\r\n 'flex-col space-y-2': otherProps.orientation === 'vertical',\r\n },\r\n otherProps.className\r\n );\r\n\r\n return (\r\n <RadioGroupContext.Provider value={context}>\r\n <RadioGroupPrimitive.Root {...otherProps} className={className} data-taco=\"radio-group\" ref={ref} />\r\n </RadioGroupContext.Provider>\r\n );\r\n}) as ForwardedRadioGroupWithStatics;\r\nRadioGroup.Item = RadioGroupItem;\r\n"],"names":["getRadioGroupItemValueAsString","value","String","findByValue","values","valueAsString","find","RadioGroupContext","React","disabled","invalid","RadioGroupItem","props","ref","context","children","otherProps","className","cn","labelClassName","RadioGroupPrimitive","useRadioGroup","defaultValue","onChange","orientation","radioGroupItemValues","forEach","child","push","valueProps","undefined","handleChange","onValueChange","RadioGroup","Provider","Item"],"mappings":";;;;MAOaA,8BAA8B,GAAIC,KAAD,IAAyCA,KAAK,KAAK,IAAV,GAAiB,EAAjB,GAAsBC,MAAM,CAACD,KAAD;MAEtGE,WAAW,GAAG,CAACC,MAAD,EAAgCC,aAAhC,KACvBD,MAAM,CAACE,IAAP,CAAYL,KAAK,IAAID,8BAA8B,CAACC,KAAD,CAA9B,KAA0CI,aAA/D;AAEJ,MAAME,iBAAiB,gBAAGC,aAAA,CAAoB;AAAEC,EAAAA,QAAQ,EAAE,KAAZ;AAAmBC,EAAAA,OAAO,EAAE;AAA5B,CAApB,CAA1B;AAcA,MAAMC,cAAc,gBAAGH,UAAA,CAAiB,SAASG,cAAT,CAAwBC,KAAxB,EAAoDC,GAApD;AACpC,QAAMC,OAAO,GAAGN,UAAA,CAAiBD,iBAAjB,CAAhB;AACA,QAAM;AAAEQ,IAAAA,QAAF;AAAYd,IAAAA,KAAZ;AAAmB,OAAGe;AAAtB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