@economic/taco 0.0.13-alpha.0 → 0.0.14-alpha.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 (46) hide show
  1. package/dist/components/{Label/Label.d.ts → Field/Field.d.ts} +9 -9
  2. package/dist/esm/components/{Label/Label.js → Field/Field.js} +3 -3
  3. package/dist/esm/components/Field/Field.js.map +1 -0
  4. package/dist/esm/components/Pagination/Pagination.js +56 -39
  5. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  6. package/dist/esm/components/Popover/Popover.js +34 -29
  7. package/dist/esm/components/Popover/Popover.js.map +1 -1
  8. package/dist/esm/components/Progress/Progress.js +15 -11
  9. package/dist/esm/components/Progress/Progress.js.map +1 -1
  10. package/dist/esm/components/Provider/Provider.js +18 -13
  11. package/dist/esm/components/Provider/Provider.js.map +1 -1
  12. package/dist/esm/components/RadioGroup/RadioGroup.js +57 -45
  13. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  14. package/dist/esm/components/SearchInput/SearchInput.js +1 -1
  15. package/dist/esm/components/Select/Select.js +31 -30
  16. package/dist/esm/components/Select/Select.js.map +1 -1
  17. package/dist/esm/components/Spinner/Spinner.js +19 -12
  18. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  19. package/dist/esm/components/Switch/Switch.js +10 -9
  20. package/dist/esm/components/Switch/Switch.js.map +1 -1
  21. package/dist/esm/components/Tabs/Tabs.js +27 -25
  22. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  23. package/dist/esm/components/Textarea/Textarea.js +6 -8
  24. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  25. package/dist/esm/components/Toast/Toaster.js +118 -88
  26. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  27. package/dist/esm/components/Tooltip/Tooltip.js +8 -7
  28. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  29. package/dist/esm/components/Tour/Tour.js +50 -44
  30. package/dist/esm/components/Tour/Tour.js.map +1 -1
  31. package/dist/esm/components/Treeview/Treeview.js +36 -26
  32. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  33. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
  34. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  35. package/dist/esm/index.css +4 -8
  36. package/dist/esm/index.js +1 -1
  37. package/dist/index.css +4 -8
  38. package/dist/index.d.ts +1 -1
  39. package/dist/taco.cjs.development.js +535 -449
  40. package/dist/taco.cjs.development.js.map +1 -1
  41. package/dist/taco.cjs.production.min.js +1 -1
  42. package/dist/taco.cjs.production.min.js.map +1 -1
  43. package/dist/utils/tailwind.d.ts +1 -1
  44. package/package.json +2 -2
  45. package/types.json +116 -116
  46. package/dist/esm/components/Label/Label.js.map +0 -1
@@ -1,29 +1,29 @@
1
1
  import * as React from 'react';
2
2
  import { State } from '../../types';
3
- import './Label.css';
4
- export declare type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
5
- /** Content of the label */
3
+ import './Field.css';
4
+ export declare type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
5
+ /** Content of the field */
6
6
  children: React.ReactNode;
7
7
  /** Changes the style to indicate the element is disabled */
8
8
  disabled?: boolean;
9
9
  /**
10
- * Text displayed below the children of Label.
10
+ * Text displayed below the children of Field.
11
11
  * Should be a short text that indicates feedback for user.
12
12
  */
13
13
  message?: string;
14
- /** State will change the style of the label */
14
+ /** State will change the style of the field */
15
15
  state?: State;
16
16
  };
17
- export declare const Label: React.ForwardRefExoticComponent<React.LabelHTMLAttributes<HTMLLabelElement> & {
18
- /** Content of the label */
17
+ export declare const Field: React.ForwardRefExoticComponent<React.LabelHTMLAttributes<HTMLLabelElement> & {
18
+ /** Content of the field */
19
19
  children: React.ReactNode;
20
20
  /** Changes the style to indicate the element is disabled */
21
21
  disabled?: boolean | undefined;
22
22
  /**
23
- * Text displayed below the children of Label.
23
+ * Text displayed below the children of Field.
24
24
  * Should be a short text that indicates feedback for user.
25
25
  */
26
26
  message?: string | undefined;
27
- /** State will change the style of the label */
27
+ /** State will change the style of the field */
28
28
  state?: "default" | "success" | "error" | "warning" | "information" | undefined;
29
29
  } & React.RefAttributes<HTMLLabelElement>>;
@@ -3,7 +3,7 @@ import { forwardRef, createElement } from 'react';
3
3
  import cn from 'classnames';
4
4
 
5
5
  var _excluded = ["disabled", "children", "message", "state"];
6
- var Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
6
+ var Field = /*#__PURE__*/forwardRef(function Field(props, ref) {
7
7
  var disabled = props.disabled,
8
8
  children = props.children,
9
9
  message = props.message,
@@ -31,5 +31,5 @@ var Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
31
31
  }, message));
32
32
  });
33
33
 
34
- export { Label };
35
- //# sourceMappingURL=Label.js.map
34
+ export { Field };
35
+ //# sourceMappingURL=Field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.js","sources":["../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\n\r\nimport { State } from '../../types';\r\nimport './Field.css';\r\n\r\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\r\n /** Content of the field */\r\n children: React.ReactNode;\r\n /**\tChanges the style to indicate the element is disabled */\r\n disabled?: boolean;\r\n /**\r\n * Text displayed below the children of Field.\r\n * Should be a short text that indicates feedback for user.\r\n */\r\n message?: string;\r\n /** State will change the style of the field */\r\n state?: State;\r\n};\r\n\r\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\r\n const { disabled, children, message, state, ...otherProps } = props;\r\n const className = cn(\r\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\r\n {\r\n 'text-grey-dark': disabled,\r\n },\r\n props.className\r\n );\r\n const messageClassName = cn(\r\n 'h-4 text-xs text-left leading-normal font-normal truncate -mb-4',\r\n {\r\n 'text-grey-darkest': !state || state === 'default',\r\n 'text-red': state === 'error',\r\n 'text-green': state === 'success',\r\n 'text-blue': state === 'information',\r\n 'text-yellow-dark': state === 'warning',\r\n 'opacity-50': disabled,\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\r\n {children}\r\n {message && (\r\n <span className={messageClassName} role={state === 'error' ? 'alert' : undefined}>\r\n {message}\r\n </span>\r\n )}\r\n </label>\r\n );\r\n});\r\n"],"names":["Field","React","props","ref","disabled","children","message","state","otherProps","className","cn","messageClassName","role","undefined"],"mappings":";;;;;IAoBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;AAClC,MAAQC,QAAR,GAA8DF,KAA9D,CAAQE,QAAR;AAAA,MAAkBC,QAAlB,GAA8DH,KAA9D,CAAkBG,QAAlB;AAAA,MAA4BC,OAA5B,GAA8DJ,KAA9D,CAA4BI,OAA5B;AAAA,MAAqCC,KAArC,GAA8DL,KAA9D,CAAqCK,KAArC;AAAA,MAA+CC,UAA/C,iCAA8DN,KAA9D;;AACA,MAAMO,SAAS,GAAGC,EAAE,CAChB,8EADgB,EAEhB;AACI,sBAAkBN;AADtB,GAFgB,EAKhBF,KAAK,CAACO,SALU,CAApB;AAOA,MAAME,gBAAgB,GAAGD,EAAE,CACvB,iEADuB,EAEvB;AACI,yBAAqB,CAACH,KAAD,IAAUA,KAAK,KAAK,SAD7C;AAEI,gBAAYA,KAAK,KAAK,OAF1B;AAGI,kBAAcA,KAAK,KAAK,SAH5B;AAII,iBAAaA,KAAK,KAAK,aAJ3B;AAKI,wBAAoBA,KAAK,KAAK,SALlC;AAMI,kBAAcH;AANlB,GAFuB,EAUvBF,KAAK,CAACO,SAViB,CAA3B;AAaA,SACIR,aAAA,QAAA,oBAAWO;AAAYC,IAAAA,SAAS,EAAEA;iBAAqB;AAAQN,IAAAA,GAAG,EAAEA;IAApE,EACKE,QADL,EAEKC,OAAO,IACJL,aAAA,OAAA;AAAMQ,IAAAA,SAAS,EAAEE;AAAkBC,IAAAA,IAAI,EAAEL,KAAK,KAAK,OAAV,GAAoB,OAApB,GAA8BM;GAAvE,EACKP,OADL,CAHR,CADJ;AAUH,CAhCoB;;;;"}
@@ -1,3 +1,4 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { forwardRef, createElement } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { IconButton } from '../IconButton/IconButton.js';
@@ -8,41 +9,47 @@ import { Select } from '../Select/Select.js';
8
9
  import { usePaginationShortcuts } from './usePaginationShortcuts.js';
9
10
  export { usePagination } from './usePagination.js';
10
11
 
11
- const getShowingLabel = (length, pageIndex, pageSize, texts) => {
12
- const minItemIndex = pageIndex * pageSize + 1;
13
- const maxItemIndex = (pageIndex + 1) * pageSize;
12
+ var _excluded = ["length", "pageIndex", "pageSize", "pageSizes", "setPageIndex", "setPageSize", "showPageControls", "showPageNumbers", "showPageSize", "dangerouslyHijackGlobalKeyboardNavigation"];
13
+
14
+ var getShowingLabel = function getShowingLabel(length, pageIndex, pageSize, texts) {
15
+ var minItemIndex = pageIndex * pageSize + 1;
16
+ var maxItemIndex = (pageIndex + 1) * pageSize;
14
17
  return texts.pagination.showingXofYofTotal.replace('[X]', length === 0 ? '0' : String(minItemIndex)).replace('[Y]', String(maxItemIndex > length ? length : maxItemIndex)).replace('[total]', String(length));
15
18
  };
16
19
 
17
- const Pagination = /*#__PURE__*/forwardRef(function Pagination(props, ref) {
18
- const {
19
- length,
20
- pageIndex,
21
- pageSize,
22
- pageSizes = [10, 25, 50, 100, 500],
23
- setPageIndex,
24
- setPageSize,
25
- showPageControls = true,
26
- showPageNumbers = true,
27
- showPageSize = true,
28
- dangerouslyHijackGlobalKeyboardNavigation = false,
29
- ...otherProps
30
- } = props;
31
- const {
32
- texts
33
- } = useLocalization();
34
- const maxPageIndex = Math.ceil(length / pageSize) - 1;
35
- const showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;
20
+ var Pagination = /*#__PURE__*/forwardRef(function Pagination(props, ref) {
21
+ var length = props.length,
22
+ pageIndex = props.pageIndex,
23
+ pageSize = props.pageSize,
24
+ _props$pageSizes = props.pageSizes,
25
+ pageSizes = _props$pageSizes === void 0 ? [10, 25, 50, 100, 500] : _props$pageSizes,
26
+ setPageIndex = props.setPageIndex,
27
+ setPageSize = props.setPageSize,
28
+ _props$showPageContro = props.showPageControls,
29
+ showPageControls = _props$showPageContro === void 0 ? true : _props$showPageContro,
30
+ _props$showPageNumber = props.showPageNumbers,
31
+ showPageNumbers = _props$showPageNumber === void 0 ? true : _props$showPageNumber,
32
+ _props$showPageSize = props.showPageSize,
33
+ showPageSize = _props$showPageSize === void 0 ? true : _props$showPageSize,
34
+ _props$dangerouslyHij = props.dangerouslyHijackGlobalKeyboardNavigation,
35
+ dangerouslyHijackGlobalKeyboardNavigation = _props$dangerouslyHij === void 0 ? false : _props$dangerouslyHij,
36
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
37
+
38
+ var _useLocalization = useLocalization(),
39
+ texts = _useLocalization.texts;
40
+
41
+ var maxPageIndex = Math.ceil(length / pageSize) - 1;
42
+ var showShortcutTexts = dangerouslyHijackGlobalKeyboardNavigation;
36
43
  usePaginationShortcuts({
37
- setPageIndex,
38
- maxPageIndex,
39
- pageIndex,
40
- dangerouslyHijackGlobalKeyboardNavigation
44
+ setPageIndex: setPageIndex,
45
+ maxPageIndex: maxPageIndex,
46
+ pageIndex: pageIndex,
47
+ dangerouslyHijackGlobalKeyboardNavigation: dangerouslyHijackGlobalKeyboardNavigation
41
48
  });
42
- const pageCount = Math.ceil(length / pageSize);
43
- const canPreviousPage = pageIndex > 0;
44
- const canNextPage = pageIndex < pageCount - 1;
45
- const className = cn('inline-flex relative justify-between items-center', props.className);
49
+ var pageCount = Math.ceil(length / pageSize);
50
+ var canPreviousPage = pageIndex > 0;
51
+ var canNextPage = pageIndex < pageCount - 1;
52
+ var className = cn('inline-flex relative justify-between items-center', props.className);
46
53
  return createElement("div", Object.assign({}, otherProps, {
47
54
  className: className,
48
55
  "data-taco": "pagination",
@@ -52,11 +59,13 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(props, ref) {
52
59
  }, getShowingLabel(length, pageIndex, pageSize, texts), createElement(Select, {
53
60
  "aria-label": texts.pagination.pageSize,
54
61
  className: "ml-4 !w-20",
55
- data: pageSizes.map(pageSize => ({
56
- text: String(pageSize),
57
- value: pageSize
58
- })),
59
- onChange: event => {
62
+ data: pageSizes.map(function (pageSize) {
63
+ return {
64
+ text: String(pageSize),
65
+ value: pageSize
66
+ };
67
+ }),
68
+ onChange: function onChange(event) {
60
69
  setPageIndex(0);
61
70
  setPageSize(Number(event.target.value));
62
71
  },
@@ -68,14 +77,18 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(props, ref) {
68
77
  appearance: "default",
69
78
  disabled: !canPreviousPage,
70
79
  icon: "arrow-start",
71
- onClick: () => setPageIndex(0),
80
+ onClick: function onClick() {
81
+ return setPageIndex(0);
82
+ },
72
83
  "aria-label": showShortcutTexts ? texts.pagination.actions.firstPageWithShortcut : texts.pagination.actions.firstPage,
73
84
  tooltip: showShortcutTexts ? texts.pagination.actions.firstPageWithShortcut : texts.pagination.actions.firstPage
74
85
  }), createElement(IconButton, {
75
86
  appearance: "default",
76
87
  disabled: !canPreviousPage,
77
88
  icon: "arrow-left",
78
- onClick: () => setPageIndex(pageIndex - 1),
89
+ onClick: function onClick() {
90
+ return setPageIndex(pageIndex - 1);
91
+ },
79
92
  "aria-label": showShortcutTexts ? texts.pagination.actions.previousPageWithShortcut : texts.pagination.actions.previousPage,
80
93
  tooltip: showShortcutTexts ? texts.pagination.actions.previousPageWithShortcut : texts.pagination.actions.previousPage
81
94
  }), showPageNumbers && pageCount > 0 && createElement(PageNumbers, {
@@ -86,14 +99,18 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(props, ref) {
86
99
  appearance: "default",
87
100
  disabled: !canNextPage,
88
101
  icon: "arrow-right",
89
- onClick: () => setPageIndex(pageIndex + 1),
102
+ onClick: function onClick() {
103
+ return setPageIndex(pageIndex + 1);
104
+ },
90
105
  "aria-label": showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage,
91
106
  tooltip: showShortcutTexts ? texts.pagination.actions.nextPageWithShortcut : texts.pagination.actions.nextPage
92
107
  }), createElement(IconButton, {
93
108
  appearance: "default",
94
109
  disabled: !canNextPage,
95
110
  icon: "arrow-end",
96
- onClick: () => setPageIndex(pageCount - 1),
111
+ onClick: function onClick() {
112
+ return setPageIndex(pageCount - 1);
113
+ },
97
114
  "aria-label": showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage,
98
115
  tooltip: showShortcutTexts ? texts.pagination.actions.lastPageWithShortcut : texts.pagination.actions.lastPage
99
116
  })));
@@ -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,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,gBA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"],"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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O,EAAElC;GAAzE,CAlCR,EAoCIJ,aAAA,CAACkC,UAAD;AACIC,IAAAA,UAAU,EAAC;AACXC,IAAAA,QAAQ,EAAE,CAACjB;AACXkB,IAAAA,IAAI,EAAC;AACLC,IAAAA,OAAO,EAAE;AAAA,aAAMlC,YAAY,CAACd,SAAS,GAAG,CAAb,CAAlB;AAAA;kBAELyB,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;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,21 +1,23 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { forwardRef, useMemo, createElement, createContext, useContext, isValidElement } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { Root, Trigger as Trigger$1, Close as Close$1 } from '@radix-ui/react-popover';
4
5
  import { UnstyledContent, UnstyledArrow } from './Primitives.js';
5
6
  import mergeRefs from '../../utils/mergeRefs.js';
6
7
 
7
- const PopoverContext = /*#__PURE__*/createContext({
8
+ var _excluded = ["children", "trigger"];
9
+ var PopoverContext = /*#__PURE__*/createContext({
8
10
  props: {},
9
11
  ref: null
10
12
  });
11
- const Trigger = /*#__PURE__*/forwardRef((props, ref) => {
13
+ var Trigger = /*#__PURE__*/forwardRef(function (props, ref) {
12
14
  var _props$children;
13
15
 
14
- const context = useContext(PopoverContext);
15
- let children = props.children;
16
+ var context = useContext(PopoverContext);
17
+ var children = props.children;
16
18
 
17
19
  if (isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
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`);
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");
19
21
  children = createElement("span", null, props.children);
20
22
  }
21
23
 
@@ -25,22 +27,22 @@ const Trigger = /*#__PURE__*/forwardRef((props, ref) => {
25
27
  asChild: true
26
28
  }));
27
29
  });
28
- const RenderPropWrapper = /*#__PURE__*/forwardRef(({
29
- children,
30
- onClick
31
- }, ref) => {
32
- const close = () => {
30
+ var RenderPropWrapper = /*#__PURE__*/forwardRef(function (_ref, ref) {
31
+ var children = _ref.children,
32
+ onClick = _ref.onClick;
33
+
34
+ var close = function close() {
33
35
  onClick(new CustomEvent('hide'));
34
36
  };
35
37
 
36
38
  return children({
37
- close,
38
- ref
39
+ close: close,
40
+ ref: ref
39
41
  });
40
42
  });
41
- const Content = /*#__PURE__*/forwardRef((props, ref) => {
42
- const className = cn('bg-white focus:border-blue-light', props.className);
43
- let output;
43
+ var Content = /*#__PURE__*/forwardRef(function (props, ref) {
44
+ var className = cn('bg-white focus:border-blue-light', props.className);
45
+ var output;
44
46
 
45
47
  if (typeof props.children === 'function') {
46
48
  output = createElement(Close$1, {
@@ -58,20 +60,23 @@ const Content = /*#__PURE__*/forwardRef((props, ref) => {
58
60
  className: "text-white"
59
61
  }));
60
62
  });
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((props, ref) => {
66
- const {
67
- children,
68
- trigger,
69
- ...otherProps
70
- } = props;
71
- const context = useMemo(() => ({
72
- props: otherProps,
73
- ref
74
- }), [otherProps]);
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 (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]);
75
80
  return createElement(PopoverContext.Provider, {
76
81
  value: context
77
82
  }, 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((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(({ 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((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((props: PopoverProps, ref: React.Ref<HTMLElement>): JSX.Element => {\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","context","children","type","console","warn","name","PopoverPrimitive","mergeRefs","asChild","RenderPropWrapper","onClick","close","CustomEvent","Content","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,CAACC,KAAD,EAA6BC,GAA7B;;;AAC7B,QAAME,OAAO,GAAGJ,UAAA,CAAiBD,cAAjB,CAAhB;AACA,MAA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"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((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(({ 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((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((props: PopoverProps, ref: React.Ref<HTMLElement>): JSX.Element => {\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","context","children","type","console","warn","name","PopoverPrimitive","mergeRefs","asChild","RenderPropWrapper","onClick","close","CustomEvent","Content","className","cn","output","UnstyledContent","placement","Un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ArB,KAAP;AAAA,GAAd,EAAkD,CAACyB,UAAD,CAAlD,CAAhB;AAEA,SACI3B,aAAA,CAACD,cAAc,CAAC6B,QAAhB;AAAyBC,IAAAA,KAAK,EAAEzB;GAAhC,EACIJ,aAAA,CAACU,IAAD,MAAA,EACKgB,OAAO,IAAI1B,aAAA,CAACG,OAAD,MAAA,EAAUuB,OAAV,CADhB,EAEKrB,QAFL,CADJ,CADJ;AAQH,CAZsB;AAavBoB,OAAO,CAACtB,OAAR,GAAkBA,OAAlB;AACAsB,OAAO,CAACR,OAAR,GAAkBA,OAAlB;AACAQ,OAAO,CAACD,KAAR,GAAgBA,KAAhB;;;;"}
@@ -1,23 +1,27 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import React__default from 'react';
2
3
  import cn from 'classnames';
3
4
 
4
- const Progress = ({
5
- duration = undefined,
6
- ...props
7
- }) => {
8
- let style;
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;
9
14
 
10
15
  if (duration) {
11
16
  style = {
12
- animationDuration: `${duration}ms`
17
+ animationDuration: duration + "ms"
13
18
  };
14
19
  }
15
20
 
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
- });
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));
21
25
  return React__default.createElement("span", Object.assign({}, props, {
22
26
  "data-taco": "progress",
23
27
  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":";;;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
+ {"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,7 +1,7 @@
1
1
  import { useMemo, createElement, useContext, createContext } from 'react';
2
2
  import { ToastProvider } from '../Toast/Toaster.js';
3
3
 
4
- const defaultLocalisationTexts = {
4
+ var 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'],
@@ -73,30 +73,35 @@ const defaultLocalisationTexts = {
73
73
  inputLabel: 'Search...'
74
74
  }
75
75
  };
76
- const defaultLocalizationContext = {
76
+ var defaultLocalizationContext = {
77
77
  locale: 'en-GB',
78
78
  texts: defaultLocalisationTexts,
79
79
  formatting: {
80
80
  date: 'dd.mm.yy'
81
81
  }
82
82
  };
83
- const Context = /*#__PURE__*/createContext({
83
+ var Context = /*#__PURE__*/createContext({
84
84
  localization: defaultLocalizationContext
85
85
  });
86
- const Provider = props => {
87
- const {
88
- children,
89
- localization = defaultLocalizationContext
90
- } = props;
91
- const value = useMemo(() => ({
92
- localization
93
- }), [localization]);
86
+ var Provider = function Provider(props) {
87
+ var children = props.children,
88
+ _props$localization = props.localization,
89
+ localization = _props$localization === void 0 ? defaultLocalizationContext : _props$localization;
90
+ var value = useMemo(function () {
91
+ return {
92
+ localization: localization
93
+ };
94
+ }, [localization]);
94
95
  return createElement(Context.Provider, {
95
96
  value: value
96
97
  }, createElement(ToastProvider, null, children));
97
98
  };
98
- const useTaco = () => useContext(Context);
99
- const useLocalization = () => useTaco().localization;
99
+ var useTaco = function useTaco() {
100
+ return useContext(Context);
101
+ };
102
+ var useLocalization = function useLocalization() {
103
+ return useTaco().localization;
104
+ };
100
105
 
101
106
  export { Provider, defaultLocalisationTexts, useLocalization, useTaco };
102
107
  //# 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 { 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 [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 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","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":";;;MA4DaA,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,UAAU,EAAE;AACRT,IAAAA,QAAQ,EAAE,UADF;AAERU,IAAAA,KAAK,EAAE,OAFC;AAGRC,IAAAA,MAAM,EAAE,eAHA;AAIRC,IAAAA,SAAS,EAAE;AAJH,GAzBwB;AA+BpCC,EAAAA,MAAM,EAAE;AACJC,IAAAA,KAAK,EAAE;AADH,GA/B4B;AAkCpCC,EAAAA,OAAO,EAAE;AACLC,IAAAA,OAAO,EAAE,oBADJ;AAELC,IAAAA,KAAK,EAAE,kBAFF;AAGLC,IAAAA,SAAS,EAAE;AAHN,GAlC2B;AAuCpCC,EAAAA,MAAM,EA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AAsFxC,MAAMC,0BAA0B,GAAiB;AAC7CC,EAAAA,MAAM,EAAE,OADqC;AAE7CC,EAAAA,KAAK,EAAEtD,wBAFsC;AAG7CuD,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
+ {"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 { 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 [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 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","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":";;;IA4DaA,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,UAAU,EAAE;AACRT,IAAAA,QAAQ,EAAE,UADF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