@economic/taco 1.1.4 → 1.1.5-alpha.102

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 (160) hide show
  1. package/README.md +82 -82
  2. package/dist/components/Icon/components/LogOut.d.ts +3 -0
  3. package/dist/components/Icon/components/Menu.d.ts +3 -0
  4. package/dist/components/Icon/components/Numbers.d.ts +3 -0
  5. package/dist/components/Icon/components/Profile.d.ts +3 -0
  6. package/dist/components/Icon/components/index.d.ts +1 -1
  7. package/dist/components/Input/Input.d.ts +1 -1
  8. package/dist/components/Menu/Menu.d.ts +2 -2
  9. package/dist/components/Menu/components/Item.d.ts +1 -1
  10. package/dist/components/Menu/components/Link.d.ts +1 -1
  11. package/dist/components/Tour/Tour.d.ts +2 -0
  12. package/dist/esm/components/Banner/util.js +1 -1
  13. package/dist/esm/components/Banner/util.js.map +1 -1
  14. package/dist/esm/components/Button/util.js +18 -23
  15. package/dist/esm/components/Button/util.js.map +1 -1
  16. package/dist/esm/components/Card/Card.js +3 -0
  17. package/dist/esm/components/Card/Card.js.map +1 -1
  18. package/dist/esm/components/Combobox/Combobox.js +1 -0
  19. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  20. package/dist/esm/components/Combobox/useCombobox.js +67 -87
  21. package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
  22. package/dist/esm/components/Datepicker/useDatepicker.js +27 -34
  23. package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
  24. package/dist/esm/components/Dialog/Context.js +4 -4
  25. package/dist/esm/components/Dialog/Context.js.map +1 -1
  26. package/dist/esm/components/Dialog/components/Content.js +39 -44
  27. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  28. package/dist/esm/components/Dialog/components/Drawer.js +3 -3
  29. package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
  30. package/dist/esm/components/Dialog/components/Extra.js +2 -2
  31. package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
  32. package/dist/esm/components/Dialog/components/Trigger.js +3 -3
  33. package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
  34. package/dist/esm/components/Hanger/Hanger.js +1 -1
  35. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  36. package/dist/esm/components/Icon/components/LogOut.js +20 -0
  37. package/dist/esm/components/Icon/components/LogOut.js.map +1 -0
  38. package/dist/esm/components/Icon/components/Menu.js +18 -0
  39. package/dist/esm/components/Icon/components/Menu.js.map +1 -0
  40. package/dist/esm/components/Icon/components/Numbers.js +18 -0
  41. package/dist/esm/components/Icon/components/Numbers.js.map +1 -0
  42. package/dist/esm/components/Icon/components/Profile.js +20 -0
  43. package/dist/esm/components/Icon/components/Profile.js.map +1 -0
  44. package/dist/esm/components/Icon/components/index.js +12 -4
  45. package/dist/esm/components/Icon/components/index.js.map +1 -1
  46. package/dist/esm/components/Input/util.js +2 -2
  47. package/dist/esm/components/Input/util.js.map +1 -1
  48. package/dist/esm/components/Listbox/ScrollableList.js +64 -83
  49. package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
  50. package/dist/esm/components/Listbox/useListbox.js +51 -60
  51. package/dist/esm/components/Listbox/useListbox.js.map +1 -1
  52. package/dist/esm/components/Listbox/useMultiListbox.js +64 -91
  53. package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
  54. package/dist/esm/components/Listbox/useTypeahead.js +10 -9
  55. package/dist/esm/components/Listbox/useTypeahead.js.map +1 -1
  56. package/dist/esm/components/Listbox/util.js +48 -85
  57. package/dist/esm/components/Listbox/util.js.map +1 -1
  58. package/dist/esm/components/Menu/Context.js +2 -2
  59. package/dist/esm/components/Menu/Context.js.map +1 -1
  60. package/dist/esm/components/Menu/components/Checkbox.js +9 -10
  61. package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
  62. package/dist/esm/components/Menu/components/Content.js +9 -11
  63. package/dist/esm/components/Menu/components/Content.js.map +1 -1
  64. package/dist/esm/components/Menu/components/Header.js +3 -3
  65. package/dist/esm/components/Menu/components/Header.js.map +1 -1
  66. package/dist/esm/components/Menu/components/Item.js +30 -31
  67. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  68. package/dist/esm/components/Menu/components/Link.js +10 -11
  69. package/dist/esm/components/Menu/components/Link.js.map +1 -1
  70. package/dist/esm/components/Menu/components/RadioGroup.js +17 -19
  71. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  72. package/dist/esm/components/Menu/components/Separator.js +1 -1
  73. package/dist/esm/components/Menu/components/Separator.js.map +1 -1
  74. package/dist/esm/components/Menu/components/Trigger.js +4 -4
  75. package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
  76. package/dist/esm/components/Pagination/PageNumbers.js +23 -28
  77. package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
  78. package/dist/esm/components/Pagination/usePagination.js +7 -21
  79. package/dist/esm/components/Pagination/usePagination.js.map +1 -1
  80. package/dist/esm/components/Pagination/usePaginationShortcuts.js +9 -9
  81. package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
  82. package/dist/esm/components/Popover/Popover.js +1 -1
  83. package/dist/esm/components/Popover/Popover.js.map +1 -1
  84. package/dist/esm/components/Popover/Primitives.js +7 -8
  85. package/dist/esm/components/Popover/Primitives.js.map +1 -1
  86. package/dist/esm/components/SearchInput/SearchInput.js +4 -1
  87. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  88. package/dist/esm/components/Select/useSelect.js +63 -81
  89. package/dist/esm/components/Select/useSelect.js.map +1 -1
  90. package/dist/esm/components/Table/components/BaseTable.js +23 -30
  91. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  92. package/dist/esm/components/Table/components/PaginatedTable.js +3 -7
  93. package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -1
  94. package/dist/esm/components/Table/components/Table.js +18 -25
  95. package/dist/esm/components/Table/components/Table.js.map +1 -1
  96. package/dist/esm/components/Table/components/WindowedTable.js +89 -109
  97. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  98. package/dist/esm/components/Table/hooks/plugins/useRowActions.js +122 -146
  99. package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  100. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js +57 -61
  101. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  102. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js +39 -36
  103. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  104. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js +79 -89
  105. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  106. package/dist/esm/components/Table/hooks/useRowCreation.js +29 -64
  107. package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -1
  108. package/dist/esm/components/Table/hooks/useTable.js +119 -141
  109. package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
  110. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +13 -16
  111. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  112. package/dist/esm/components/Table/util/renderColumn.js +10 -10
  113. package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
  114. package/dist/esm/components/Table/util/renderRow.js +37 -46
  115. package/dist/esm/components/Table/util/renderRow.js.map +1 -1
  116. package/dist/esm/components/Table/util/rowIndexPath.js +14 -16
  117. package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -1
  118. package/dist/esm/components/Table/util/sortTypes.js +23 -31
  119. package/dist/esm/components/Table/util/sortTypes.js.map +1 -1
  120. package/dist/esm/components/Table/util.js +29 -41
  121. package/dist/esm/components/Table/util.js.map +1 -1
  122. package/dist/esm/components/Toast/Toast.js +21 -22
  123. package/dist/esm/components/Toast/Toast.js.map +1 -1
  124. package/dist/esm/components/Toast/util.js +2 -2
  125. package/dist/esm/components/Toast/util.js.map +1 -1
  126. package/dist/esm/components/Tour/Tour.js +3 -1
  127. package/dist/esm/components/Tour/Tour.js.map +1 -1
  128. package/dist/esm/index.css +661 -661
  129. package/dist/esm/index.js +4 -1
  130. package/dist/esm/index.js.map +1 -1
  131. package/dist/esm/primitives/Button.js +9 -13
  132. package/dist/esm/primitives/Button.js.map +1 -1
  133. package/dist/esm/utils/date.js.map +1 -1
  134. package/dist/esm/utils/hooks/useBoundingClientRectListener.js.map +1 -1
  135. package/dist/esm/utils/hooks/useDraggable.js +16 -17
  136. package/dist/esm/utils/hooks/useDraggable.js.map +1 -1
  137. package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
  138. package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -1
  139. package/dist/esm/utils/hooks/useListScrollTo.js.map +1 -1
  140. package/dist/esm/utils/hooks/useOnClickOutside.js.map +1 -1
  141. package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
  142. package/dist/esm/utils/hooks/useTimer.js +9 -17
  143. package/dist/esm/utils/hooks/useTimer.js.map +1 -1
  144. package/dist/esm/utils/input.js +7 -11
  145. package/dist/esm/utils/input.js.map +1 -1
  146. package/dist/esm/utils/mergeRefs.js +1 -1
  147. package/dist/esm/utils/mergeRefs.js.map +1 -1
  148. package/dist/esm/utils/taillwind.js +2 -2
  149. package/dist/esm/utils/taillwind.js.map +1 -1
  150. package/dist/index.css +661 -661
  151. package/dist/index.d.ts +4 -1
  152. package/dist/taco.cjs.development.js +1566 -1823
  153. package/dist/taco.cjs.development.js.map +1 -1
  154. package/dist/taco.cjs.production.min.js +1 -1
  155. package/dist/taco.cjs.production.min.js.map +1 -1
  156. package/dist/utils/mergeRefs.d.ts +1 -1
  157. package/package.json +6 -7
  158. package/plugins/tailwindcss-aria-attributes.js +73 -73
  159. package/tailwind.config.js +9 -0
  160. package/types.json +2612 -7006
@@ -1,26 +1,24 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { forwardRef, createElement, useEffect } from 'react';
3
2
  import cn from 'classnames';
4
3
  import { Icon as Icon$1 } from '../../Icon/Icon.js';
5
4
  import { useCurrentMenu } from '../Context.js';
6
5
  import { Item as Item$1 } from '@radix-ui/react-dropdown-menu';
7
6
 
8
- var _excluded = ["dialog", "icon", "onClick", "shortcut"];
9
- var Icon = function Icon(_ref) {
10
- var name = _ref.name;
11
- return createElement("span", {
12
- className: "absolute left-0 ml-1"
13
- }, createElement(Icon$1, {
14
- className: "-ml-px -mt-px !h-5 !w-5",
15
- name: name
16
- }));
17
- };
18
- var useItemStyling = function useItemStyling(_ref2) {
19
- var disabled = _ref2.disabled,
20
- indented = _ref2.indented,
21
- className = _ref2.className;
22
- var menu = useCurrentMenu();
23
- useEffect(function () {
7
+ const Icon = ({
8
+ name
9
+ }) => createElement("span", {
10
+ className: "absolute left-0 ml-1"
11
+ }, createElement(Icon$1, {
12
+ className: "-ml-px -mt-px !h-5 !w-5",
13
+ name: name
14
+ }));
15
+ const useItemStyling = ({
16
+ disabled,
17
+ indented,
18
+ className
19
+ }) => {
20
+ const menu = useCurrentMenu();
21
+ useEffect(() => {
24
22
  if (indented && !(menu !== null && menu !== void 0 && menu.indented)) {
25
23
  menu === null || menu === void 0 ? void 0 : menu.registerIndentation();
26
24
  }
@@ -32,36 +30,37 @@ var useItemStyling = function useItemStyling(_ref2) {
32
30
  'cursor-not-allowed': disabled
33
31
  }, className);
34
32
  };
35
- var Shortcut = function Shortcut(props) {
33
+ const Shortcut = props => {
36
34
  return createElement("span", Object.assign({}, props, {
37
35
  className: "text-grey-darkest ml-auto pl-3"
38
36
  }));
39
37
  };
40
- var Item = /*#__PURE__*/forwardRef(function MenuItem(props, ref) {
38
+ const Item = /*#__PURE__*/forwardRef(function MenuItem(props, ref) {
41
39
  var _props$disabled;
42
40
 
43
- var dialog = props.dialog,
44
- icon = props.icon,
45
- onClick = props.onClick,
46
- shortcut = props.shortcut,
47
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
48
-
49
- var className = useItemStyling({
41
+ const {
42
+ dialog,
43
+ icon,
44
+ onClick,
45
+ shortcut,
46
+ ...otherProps
47
+ } = props;
48
+ const className = useItemStyling({
50
49
  disabled: props.disabled,
51
50
  indented: !!icon,
52
51
  className: props.className
53
52
  });
54
- var disabled = (_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : props['aria-disabled'];
55
- var handleClick; // radix has a bug that does not disable clicks when disabled is set on items
53
+ const disabled = (_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : props['aria-disabled'];
54
+ let handleClick; // radix has a bug that does not disable clicks when disabled is set on items
56
55
 
57
56
  if (disabled) {
58
- handleClick = function handleClick(event) {
57
+ handleClick = event => {
59
58
  event.preventDefault();
60
59
  event.stopPropagation();
61
60
  };
62
61
  }
63
62
 
64
- var handleSelect = function handleSelect(event) {
63
+ const handleSelect = event => {
65
64
  if (onClick) {
66
65
  onClick(event);
67
66
  }
@@ -71,7 +70,7 @@ var Item = /*#__PURE__*/forwardRef(function MenuItem(props, ref) {
71
70
  }
72
71
  };
73
72
 
74
- var button = createElement(Item$1, Object.assign({}, otherProps, {
73
+ let button = createElement(Item$1, Object.assign({}, otherProps, {
75
74
  className: className,
76
75
  onClick: handleClick,
77
76
  onSelect: handleSelect,
@@ -1 +1 @@
1
- {"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { DialogProps } from '../../Dialog/Dialog';\n\nexport const Icon = ({ name }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nexport const useItemStyling = ({ disabled, indented, className }) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\n 'text-black aria-disabled:text-grey hover:bg-grey-light hover:text-black',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n 'cursor-pointer': !disabled,\n 'cursor-not-allowed': disabled,\n },\n className\n );\n};\n\nexport const Shortcut = props => {\n return <span {...props} className=\"text-grey-darkest ml-auto pl-3\" />;\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const disabled = props.disabled ?? props['aria-disabled'];\n\n let handleClick;\n\n // radix has a bug that does not disable clicks when disabled is set on items\n if (disabled) {\n handleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n };\n }\n\n const handleSelect = event => {\n if (onClick) {\n onClick(event);\n }\n\n if (props['aria-haspopup'] || typeof dialog === 'function') {\n event.preventDefault();\n }\n };\n\n let button = (\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\n {icon && <Icon name={icon} />}\n {props.children}\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\n </DropdownMenuPrimitive.Item>\n );\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n }\n\n return button;\n});\n"],"names":["Icon","name","React","className","IconPrimitive","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","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A3D;;EACA,IAAMV,SAAS,GAAGE,cAAc,CAAC;IAC7BC,QAAQ,EAAEO,KAAK,CAACP,QADa;IAE7BC,QAAQ,EAAE,CAAC,CAACW,IAFiB;IAG7Bf,SAAS,EAAEU,KAAK,CAACV;GAHW,CAAhC;EAMA,IAAMG,QAAQ,sBAAGO,KAAK,CAACP,QAAT,6DAAqBO,KAAK,CAAC,eAAD,CAAxC;EAEA,IAAIS,WAAJ;;EAGA,IAAIhB,QAAJ,EAAc;IACVgB,WAAW,GAAG,qBAAAC,KAAK;MACfA,KAAK,CAACC,cAAN;MACAD,KAAK,CAACE,eAAN;KAFJ;;;EAMJ,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAAAH,KAAK;IACtB,IAAIJ,OAAJ,EAAa;MACTA,OAAO,CAACI,KAAD,CAAP;;;IAGJ,IAAIV,KAAK,CAAC,eAAD,CAAL,IAA0B,OAAOI,MAAP,KAAkB,UAAhD,EAA4D;MACxDM,KAAK,CAACC,cAAN;;GANR;;EAUA,IAAIG,MAAM,GACNzB,aAAA,CAAC0B,MAAD,oBAAgCP;IAAYlB,SAAS,EAAEA;IAAWgB,OAAO,EAAEG;IAAaO,QAAQ,EAAEH;IAAcV,GAAG,EAAEA;IAArH,EACKE,IAAI,IAAIhB,aAAA,CAACF,IAAD;IAAMC,IAAI,EAAEiB;GAAZ,CADb,EAEKL,KAAK,CAACiB,QAFX,EAGKV,QAAQ,IAAIlB,aAAA,CAACU,QAAD,MAAA,EAAWQ,QAAX,CAHjB,CADJ;;EAQA,IAAI,OAAOH,MAAP,KAAkB,UAAtB,EAAkC;IAC9BU,MAAM,GAAGV,MAAM,CAAC;MAAEc,OAAO,EAAEJ;KAAZ,CAAf;;;EAGJ,OAAOA,MAAP;AACH,CA3CmB;;;;"}
1
+ {"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { DialogProps } from '../../Dialog/Dialog';\n\nexport const Icon = ({ name }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nexport const useItemStyling = ({ disabled, indented, className }) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\n 'text-black aria-disabled:text-grey hover:bg-grey-light hover:text-black',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n 'cursor-pointer': !disabled,\n 'cursor-not-allowed': disabled,\n },\n className\n );\n};\n\nexport const Shortcut = props => {\n return <span {...props} className=\"text-grey-darkest ml-auto pl-3\" />;\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const disabled = props.disabled ?? props['aria-disabled'];\n\n let handleClick;\n\n // radix has a bug that does not disable clicks when disabled is set on items\n if (disabled) {\n handleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n };\n }\n\n const handleSelect = event => {\n if (onClick) {\n onClick(event);\n }\n\n if (props['aria-haspopup'] || typeof dialog === 'function') {\n event.preventDefault();\n }\n };\n\n let button = (\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\n {icon && <Icon name={icon} />}\n {props.children}\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\n </DropdownMenuPrimitive.Item>\n );\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n }\n\n return button;\n});\n"],"names":["Icon","name","React","className","IconPrimitive","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","onSelect","children","trigger"],"mappings":";;;;;;MAQaA,IAAI,GAAG,CAAC;EAAEC;AAAF,CAAD,KAChBC,aAAA,OAAA;EAAMC,SAAS,EAAC;CAAhB,EACID,aAAA,CAACE,MAAD;EAAeD,SAAS,EAAC;EAA0BF,IAAI,EAAEA;CAAzD,CADJ;MAKSI,cAAc,GAAG,CAAC;EAAEC,QAAF;EAAYC,QAAZ;EAAsBJ;AAAtB,CAAD;EAC1B,MAAMK,IAAI,GAAGC,cAAc,EAA3B;EAEAP,SAAA,CAAgB;IACZ,IAAIK,QAAQ,IAAI,EAACC,IAAD,aAACA,IAAD,eAACA,IAAI,CAAED,QAAP,CAAhB,EAAiC;MAC7BC,IAAI,SAAJ,IAAAA,IAAI,WAAJ,YAAAA,IAAI,CAAEE,mBAAN;;GAFR,EAIG,CAACH,QAAD,CAJH;EAMA,OAAOI,EAAE,CACL,6FADK,EAEL,yEAFK,EAGL;IACI,QAAQH,IAAR,aAAQA,IAAR,uBAAQA,IAAI,CAAED,QADlB;IAEI,UAAU,EAACC,IAAD,aAACA,IAAD,eAACA,IAAI,CAAED,QAAP,CAFd;IAGI,kBAAkB,CAACD,QAHvB;IAII,sBAAsBA;GAPrB,EASLH,SATK,CAAT;AAWH;MAEYS,QAAQ,GAAGC,KAAK;EACzB,OAAOX,aAAA,OAAA,oBAAUW;IAAOV,SAAS,EAAC;IAA3B,CAAP;AACH;MAUYW,IAAI,gBAAGZ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 -1,24 +1,23 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { forwardRef, createElement } from 'react';
3
2
  import { useCurrentMenu } from '../Context.js';
4
3
  import { Item } from '@radix-ui/react-dropdown-menu';
5
4
  import { useItemStyling, Icon } from './Item.js';
6
5
 
7
- var _excluded = ["href", "icon", "onClick"];
8
- var Link = /*#__PURE__*/forwardRef(function MenuLink(props, ref) {
9
- var href = props.href,
10
- icon = props.icon,
11
- onClick = props.onClick,
12
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
13
-
14
- var menu = useCurrentMenu();
15
- var className = useItemStyling({
6
+ const Link = /*#__PURE__*/forwardRef(function MenuLink(props, ref) {
7
+ const {
8
+ href,
9
+ icon,
10
+ onClick,
11
+ ...otherProps
12
+ } = props;
13
+ const menu = useCurrentMenu();
14
+ const className = useItemStyling({
16
15
  disabled: props.disabled,
17
16
  indented: !!icon,
18
17
  className: props.className
19
18
  });
20
19
 
21
- var handleClick = function handleClick(event) {
20
+ const handleClick = event => {
22
21
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
23
22
  menu === null || menu === void 0 ? void 0 : menu.close();
24
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sources":["../../../../../src/components/Menu/components/Link.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon, useItemStyling } from './Item';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuLinkItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n disabled?: boolean;\n icon?: IconName;\n href: string;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n};\n\nexport const Link = React.forwardRef(function MenuLink(props: MenuLinkItemProps, ref: React.Ref<HTMLDivElement>) {\n const { href, icon, onClick, ...otherProps } = props;\n const menu = useCurrentMenu();\n\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const handleClick: React.MouseEventHandler<HTMLDivElement> = event => {\n onClick?.(event);\n menu?.close();\n };\n\n return (\n <DropdownMenuPrimitive.Item {...otherProps} asChild className={className} ref={ref} onClick={handleClick}>\n <a href={href} target=\"_blank\">\n {icon && <Icon name={icon} />}\n {props.children}\n </a>\n </DropdownMenuPrimitive.Item>\n );\n});\n"],"names":["Link","React","MenuLink","props","ref","href","icon","onClick","otherProps","menu","useCurrentMenu","className","useItemStyling","disabled","indented","handleClick","event","close","DropdownMenuPrimitive","asChild","target","Icon","name","children"],"mappings":";;;;;;;IAaaA,IAAI,gBAAGC,UAAA,CAAiB,SAASC,QAAT,CAAkBC,KAAlB,EAA4CC,GAA5C;EACjC,IAAQC,IAAR,GAA+CF,KAA/C,CAAQE,IAAR;MAAcC,IAAd,GAA+CH,KAA/C,CAAcG,IAAd;MAAoBC,OAApB,GAA+CJ,KAA/C,CAAoBI,OAApB;MAAgCC,UAAhC,iCAA+CL,KAA/C;;EACA,IAAMM,IAAI,GAAGC,cAAc,EAA3B;EAEA,IAAMC,SAAS,GAAGC,cAAc,CAAC;IAC7BC,QAAQ,EAAEV,KAAK,CAACU,QADa;IAE7BC,QAAQ,EAAE,CAAC,CAACR,IAFiB;IAG7BK,SAAS,EAAER,KAAK,CAACQ;GAHW,CAAhC;;EAMA,IAAMI,WAAW,GAA4C,SAAvDA,WAAuD,CAAAC,KAAK;IAC9DT,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGS,KAAH,CAAP;IACAP,IAAI,SAAJ,IAAAA,IAAI,WAAJ,YAAAA,IAAI,CAAEQ,KAAN;GAFJ;;EAKA,OACIhB,aAAA,CAACiB,IAAD,oBAAgCV;IAAYW,OAAO;IAACR,SAAS,EAAEA;IAAWP,GAAG,EAAEA;IAAKG,OAAO,EAAEQ;IAA7F,EACId,aAAA,IAAA;IAAGI,IAAI,EAAEA;IAAMe,MAAM,EAAC;GAAtB,EACKd,IAAI,IAAIL,aAAA,CAACoB,IAAD;IAAMC,IAAI,EAAEhB;GAAZ,CADb,EAEKH,KAAK,CAACoB,QAFX,CADJ,CADJ;AAQH,CAvBmB;;;;"}
1
+ {"version":3,"file":"Link.js","sources":["../../../../../src/components/Menu/components/Link.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon, useItemStyling } from './Item';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuLinkItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n disabled?: boolean;\n icon?: IconName;\n href: string;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n};\n\nexport const Link = React.forwardRef(function MenuLink(props: MenuLinkItemProps, ref: React.Ref<HTMLDivElement>) {\n const { href, icon, onClick, ...otherProps } = props;\n const menu = useCurrentMenu();\n\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const handleClick: React.MouseEventHandler<HTMLDivElement> = event => {\n onClick?.(event);\n menu?.close();\n };\n\n return (\n <DropdownMenuPrimitive.Item {...otherProps} asChild className={className} ref={ref} onClick={handleClick}>\n <a href={href} target=\"_blank\">\n {icon && <Icon name={icon} />}\n {props.children}\n </a>\n </DropdownMenuPrimitive.Item>\n );\n});\n"],"names":["Link","React","MenuLink","props","ref","href","icon","onClick","otherProps","menu","useCurrentMenu","className","useItemStyling","disabled","indented","handleClick","event","close","DropdownMenuPrimitive","asChild","target","Icon","name","children"],"mappings":";;;;;MAaaA,IAAI,gBAAGC,UAAA,CAAiB,SAASC,QAAT,CAAkBC,KAAlB,EAA4CC,GAA5C;EACjC,MAAM;IAAEC,IAAF;IAAQC,IAAR;IAAcC,OAAd;IAAuB,GAAGC;MAAeL,KAA/C;EACA,MAAMM,IAAI,GAAGC,cAAc,EAA3B;EAEA,MAAMC,SAAS,GAAGC,cAAc,CAAC;IAC7BC,QAAQ,EAAEV,KAAK,CAACU,QADa;IAE7BC,QAAQ,EAAE,CAAC,CAACR,IAFiB;IAG7BK,SAAS,EAAER,KAAK,CAACQ;GAHW,CAAhC;;EAMA,MAAMI,WAAW,GAA4CC,KAAK;IAC9DT,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGS,KAAH,CAAP;IACAP,IAAI,SAAJ,IAAAA,IAAI,WAAJ,YAAAA,IAAI,CAAEQ,KAAN;GAFJ;;EAKA,OACIhB,aAAA,CAACiB,IAAD,oBAAgCV;IAAYW,OAAO;IAACR,SAAS,EAAEA;IAAWP,GAAG,EAAEA;IAAKG,OAAO,EAAEQ;IAA7F,EACId,aAAA,IAAA;IAAGI,IAAI,EAAEA;IAAMe,MAAM,EAAC;GAAtB,EACKd,IAAI,IAAIL,aAAA,CAACoB,IAAD;IAAMC,IAAI,EAAEhB;GAAZ,CADb,EAEKH,KAAK,CAACoB,QAFX,CADJ,CADJ;AAQH,CAvBmB;;;;"}
@@ -1,20 +1,18 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { createElement, useContext, createContext } from 'react';
3
2
  import cn from 'classnames';
4
3
  import { RadioGroup as RadioGroup$1, RadioItem as RadioItem$1, ItemIndicator } from '@radix-ui/react-dropdown-menu';
5
4
  import { useItemStyling } from './Item.js';
6
5
  import { useRadioGroup, getRadioGroupItemValueAsString } from '../../RadioGroup/RadioGroup.js';
7
6
 
8
- var _excluded = ["children", "value"];
9
- var RadioItem = function RadioItem(props) {
10
- var context = useContext(MenuRadioGroupContext);
11
-
12
- var children = props.children,
13
- value = props.value,
14
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
15
-
16
- var disabled = context.disabled || props.disabled;
17
- var className = useItemStyling({
7
+ const RadioItem = props => {
8
+ const context = useContext(MenuRadioGroupContext);
9
+ const {
10
+ children,
11
+ value,
12
+ ...otherProps
13
+ } = props;
14
+ const disabled = context.disabled || props.disabled;
15
+ const className = useItemStyling({
18
16
  disabled: disabled,
19
17
  indented: true,
20
18
  className: props.className
@@ -26,18 +24,18 @@ var RadioItem = function RadioItem(props) {
26
24
  }), createElement(ItemIndicator, {
27
25
  className: "absolute left-0 ml-1.5"
28
26
  }, createElement("span", {
29
- className: "flex h-1.5 w-1.5 ml-1 rounded-full bg-current "
27
+ className: "ml-1 flex h-1.5 w-1.5 rounded-full bg-current "
30
28
  })), children);
31
29
  };
32
- var MenuRadioGroupContext = /*#__PURE__*/createContext({
30
+ const MenuRadioGroupContext = /*#__PURE__*/createContext({
33
31
  disabled: false
34
32
  });
35
- var RadioGroup = function RadioGroup(props) {
36
- var _useRadioGroup = useRadioGroup(props),
37
- context = _useRadioGroup.context,
38
- otherProps = _useRadioGroup.props;
39
-
40
- var className = cn('flex flex-col', props.className);
33
+ const RadioGroup = props => {
34
+ const {
35
+ context,
36
+ props: otherProps
37
+ } = useRadioGroup(props);
38
+ const className = cn('flex flex-col', props.className);
41
39
  return createElement(MenuRadioGroupContext.Provider, {
42
40
  value: context
43
41
  }, createElement(RadioGroup$1, Object.assign({}, otherProps, {
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sources":["../../../../../src/components/Menu/components/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { getRadioGroupItemValueAsString, RadioGroupItemProps, RadioGroupProps, useRadioGroup } from '../../RadioGroup/RadioGroup';\nimport { useItemStyling } from './Item';\n\nexport type MenuRadioGroupItemProps = RadioGroupItemProps<HTMLDivElement>;\n\nexport const RadioItem = (props: MenuRadioGroupItemProps) => {\n const context = React.useContext(MenuRadioGroupContext);\n const { children, value, ...otherProps } = props;\n const disabled = context.disabled || props.disabled;\n const className = useItemStyling({\n disabled: disabled,\n indented: true,\n className: props.className,\n });\n\n return (\n <DropdownMenuPrimitive.RadioItem\n {...otherProps}\n className={className}\n disabled={disabled}\n value={getRadioGroupItemValueAsString(value)}\n >\n <DropdownMenuPrimitive.ItemIndicator className=\"absolute left-0 ml-1.5\">\n <span className=\"flex h-1.5 w-1.5 ml-1 rounded-full bg-current \" />\n </DropdownMenuPrimitive.ItemIndicator>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n};\n\nconst MenuRadioGroupContext = React.createContext({ disabled: false });\n\nexport type MenuRadioGroupProps = RadioGroupProps;\n\nexport const RadioGroup = (props: MenuRadioGroupProps) => {\n const { context, props: otherProps } = useRadioGroup(props);\n const className = cn('flex flex-col', props.className);\n\n return (\n <MenuRadioGroupContext.Provider value={context}>\n <DropdownMenuPrimitive.RadioGroup {...otherProps} className={className} />\n </MenuRadioGroupContext.Provider>\n );\n};\nRadioGroup.Item = RadioItem;\n"],"names":["RadioItem","props","context","React","MenuRadioGroupContext","children","value","otherProps","disabled","className","useItemStyling","indented","DropdownMenuPrimitive","getRadioGroupItemValueAsString","RadioGroup","useRadioGroup","cn","Provider","Item"],"mappings":";;;;;;;;IAQaA,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;EACrB,IAAMC,OAAO,GAAGC,UAAA,CAAiBC,qBAAjB,CAAhB;;EACA,IAAQC,QAAR,GAA2CJ,KAA3C,CAAQI,QAAR;MAAkBC,KAAlB,GAA2CL,KAA3C,CAAkBK,KAAlB;MAA4BC,UAA5B,iCAA2CN,KAA3C;;EACA,IAAMO,QAAQ,GAAGN,OAAO,CAACM,QAAR,IAAoBP,KAAK,CAACO,QAA3C;EACA,IAAMC,SAAS,GAAGC,cAAc,CAAC;IAC7BF,QAAQ,EAAEA,QADmB;IAE7BG,QAAQ,EAAE,IAFmB;IAG7BF,SAAS,EAAER,KAAK,CAACQ;GAHW,CAAhC;EAMA,OACIN,aAAA,CAACS,WAAD,oBACQL;IACJE,SAAS,EAAEA;IACXD,QAAQ,EAAEA;IACVF,KAAK,EAAEO,8BAA8B,CAACP,KAAD;IAJzC,EAMIH,aAAA,CAACS,aAAD;IAAqCH,SAAS,EAAC;GAA/C,EACIN,aAAA,OAAA;IAAMM,SAAS,EAAC;GAAhB,CADJ,CANJ,EASKJ,QATL,CADJ;AAaH;AAED,IAAMD,qBAAqB,gBAAGD,aAAA,CAAoB;EAAEK,QAAQ,EAAE;AAAZ,CAApB,CAA9B;IAIaM,UAAU,GAAG,SAAbA,UAAa,CAACb,KAAD;EACtB,qBAAuCc,aAAa,CAACd,KAAD,CAApD;MAAQC,OAAR,kBAAQA,OAAR;MAAwBK,UAAxB,kBAAiBN,KAAjB;;EACA,IAAMQ,SAAS,GAAGO,EAAE,CAAC,eAAD,EAAkBf,KAAK,CAACQ,SAAxB,CAApB;EAEA,OACIN,aAAA,CAACC,qBAAqB,CAACa,QAAvB;IAAgCX,KAAK,EAAEJ;GAAvC,EACIC,aAAA,CAACS,YAAD,oBAAsCL;IAAYE,SAAS,EAAEA;IAA7D,CADJ,CADJ;AAKH;AACDK,UAAU,CAACI,IAAX,GAAkBlB,SAAlB;;;;"}
1
+ {"version":3,"file":"RadioGroup.js","sources":["../../../../../src/components/Menu/components/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { getRadioGroupItemValueAsString, RadioGroupItemProps, RadioGroupProps, useRadioGroup } from '../../RadioGroup/RadioGroup';\nimport { useItemStyling } from './Item';\n\nexport type MenuRadioGroupItemProps = RadioGroupItemProps<HTMLDivElement>;\n\nexport const RadioItem = (props: MenuRadioGroupItemProps) => {\n const context = React.useContext(MenuRadioGroupContext);\n const { children, value, ...otherProps } = props;\n const disabled = context.disabled || props.disabled;\n const className = useItemStyling({\n disabled: disabled,\n indented: true,\n className: props.className,\n });\n\n return (\n <DropdownMenuPrimitive.RadioItem\n {...otherProps}\n className={className}\n disabled={disabled}\n value={getRadioGroupItemValueAsString(value)}\n >\n <DropdownMenuPrimitive.ItemIndicator className=\"absolute left-0 ml-1.5\">\n <span className=\"ml-1 flex h-1.5 w-1.5 rounded-full bg-current \" />\n </DropdownMenuPrimitive.ItemIndicator>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n};\n\nconst MenuRadioGroupContext = React.createContext({ disabled: false });\n\nexport type MenuRadioGroupProps = RadioGroupProps;\n\nexport const RadioGroup = (props: MenuRadioGroupProps) => {\n const { context, props: otherProps } = useRadioGroup(props);\n const className = cn('flex flex-col', props.className);\n\n return (\n <MenuRadioGroupContext.Provider value={context}>\n <DropdownMenuPrimitive.RadioGroup {...otherProps} className={className} />\n </MenuRadioGroupContext.Provider>\n );\n};\nRadioGroup.Item = RadioItem;\n"],"names":["RadioItem","props","context","React","MenuRadioGroupContext","children","value","otherProps","disabled","className","useItemStyling","indented","DropdownMenuPrimitive","getRadioGroupItemValueAsString","RadioGroup","useRadioGroup","cn","Provider","Item"],"mappings":";;;;;;MAQaA,SAAS,GAAIC,KAAD;EACrB,MAAMC,OAAO,GAAGC,UAAA,CAAiBC,qBAAjB,CAAhB;EACA,MAAM;IAAEC,QAAF;IAAYC,KAAZ;IAAmB,GAAGC;MAAeN,KAA3C;EACA,MAAMO,QAAQ,GAAGN,OAAO,CAACM,QAAR,IAAoBP,KAAK,CAACO,QAA3C;EACA,MAAMC,SAAS,GAAGC,cAAc,CAAC;IAC7BF,QAAQ,EAAEA,QADmB;IAE7BG,QAAQ,EAAE,IAFmB;IAG7BF,SAAS,EAAER,KAAK,CAACQ;GAHW,CAAhC;EAMA,OACIN,aAAA,CAACS,WAAD,oBACQL;IACJE,SAAS,EAAEA;IACXD,QAAQ,EAAEA;IACVF,KAAK,EAAEO,8BAA8B,CAACP,KAAD;IAJzC,EAMIH,aAAA,CAACS,aAAD;IAAqCH,SAAS,EAAC;GAA/C,EACIN,aAAA,OAAA;IAAMM,SAAS,EAAC;GAAhB,CADJ,CANJ,EASKJ,QATL,CADJ;AAaH;AAED,MAAMD,qBAAqB,gBAAGD,aAAA,CAAoB;EAAEK,QAAQ,EAAE;AAAZ,CAApB,CAA9B;MAIaM,UAAU,GAAIb,KAAD;EACtB,MAAM;IAAEC,OAAF;IAAWD,KAAK,EAAEM;MAAeQ,aAAa,CAACd,KAAD,CAApD;EACA,MAAMQ,SAAS,GAAGO,EAAE,CAAC,eAAD,EAAkBf,KAAK,CAACQ,SAAxB,CAApB;EAEA,OACIN,aAAA,CAACC,qBAAqB,CAACa,QAAvB;IAAgCX,KAAK,EAAEJ;GAAvC,EACIC,aAAA,CAACS,YAAD,oBAAsCL;IAAYE,SAAS,EAAEA;IAA7D,CADJ,CADJ;AAKH;AACDK,UAAU,CAACI,IAAX,GAAkBlB,SAAlB;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { createElement } from 'react';
2
2
  import { Separator as Separator$1 } from '@radix-ui/react-dropdown-menu';
3
3
 
4
- var Separator = function Separator() {
4
+ const Separator = () => {
5
5
  return createElement(Separator$1, {
6
6
  className: "bg-grey-dark my-1 h-px"
7
7
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Separator.js","sources":["../../../../../src/components/Menu/components/Separator.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\n\nexport const Separator = () => {\n return <DropdownMenuPrimitive.Separator className=\"bg-grey-dark my-1 h-px\" />;\n};\n"],"names":["Separator","React","DropdownMenuPrimitive","className"],"mappings":";;;IAGaA,SAAS,GAAG,SAAZA,SAAY;EACrB,OAAOC,aAAA,CAACC,WAAD;IAAiCC,SAAS,EAAC;GAA3C,CAAP;AACH;;;;"}
1
+ {"version":3,"file":"Separator.js","sources":["../../../../../src/components/Menu/components/Separator.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\n\nexport const Separator = () => {\n return <DropdownMenuPrimitive.Separator className=\"bg-grey-dark my-1 h-px\" />;\n};\n"],"names":["Separator","React","DropdownMenuPrimitive","className"],"mappings":";;;MAGaA,SAAS,GAAG;EACrB,OAAOC,aAAA,CAACC,WAAD;IAAiCC,SAAS,EAAC;GAA3C,CAAP;AACH;;;;"}
@@ -3,10 +3,10 @@ import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
3
3
  import { useCurrentMenu } from '../Context.js';
4
4
  import { Trigger as Trigger$1 } from '@radix-ui/react-dropdown-menu';
5
5
 
6
- var Trigger = /*#__PURE__*/forwardRef(function MenuTrigger(props, ref) {
7
- var menu = useCurrentMenu();
8
- var internalRef = useProxiedRef(ref);
9
- useEffect(function () {
6
+ const Trigger = /*#__PURE__*/forwardRef(function MenuTrigger(props, ref) {
7
+ const menu = useCurrentMenu();
8
+ const internalRef = useProxiedRef(ref);
9
+ useEffect(() => {
10
10
  if (internalRef.current) {
11
11
  menu === null || menu === void 0 ? void 0 : menu.setMinWidth(internalRef.current.getBoundingClientRect().width);
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.js","sources":["../../../../../src/components/Menu/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuTriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'> & {\n children: React.ReactElement;\n};\n\nexport const Trigger = React.forwardRef(function MenuTrigger(props: MenuTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const menu = useCurrentMenu();\n const internalRef = useProxiedRef<HTMLButtonElement>(ref);\n\n React.useEffect(() => {\n if (internalRef.current) {\n menu?.setMinWidth(internalRef.current.getBoundingClientRect().width);\n }\n }, [internalRef]);\n\n return <DropdownMenuPrimitive.Trigger {...props} asChild ref={internalRef} />;\n});\n"],"names":["Trigger","React","MenuTrigger","props","ref","menu","useCurrentMenu","internalRef","useProxiedRef","current","setMinWidth","getBoundingClientRect","width","DropdownMenuPrimitive","asChild"],"mappings":";;;;;IASaA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;EACpC,IAAMC,IAAI,GAAGC,cAAc,EAA3B;EACA,IAAMC,WAAW,GAAGC,aAAa,CAAoBJ,GAApB,CAAjC;EAEAH,SAAA,CAAgB;IACZ,IAAIM,WAAW,CAACE,OAAhB,EAAyB;MACrBJ,IAAI,SAAJ,IAAAA,IAAI,WAAJ,YAAAA,IAAI,CAAEK,WAAN,CAAkBH,WAAW,CAACE,OAAZ,CAAoBE,qBAApB,GAA4CC,KAA9D;;GAFR,EAIG,CAACL,WAAD,CAJH;EAMA,OAAON,aAAA,CAACY,SAAD,oBAAmCV;IAAOW,OAAO;IAACV,GAAG,EAAEG;IAAvD,CAAP;AACH,CAXsB;;;;"}
1
+ {"version":3,"file":"Trigger.js","sources":["../../../../../src/components/Menu/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuTriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children'> & {\n children: React.ReactElement;\n};\n\nexport const Trigger = React.forwardRef(function MenuTrigger(props: MenuTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const menu = useCurrentMenu();\n const internalRef = useProxiedRef<HTMLButtonElement>(ref);\n\n React.useEffect(() => {\n if (internalRef.current) {\n menu?.setMinWidth(internalRef.current.getBoundingClientRect().width);\n }\n }, [internalRef]);\n\n return <DropdownMenuPrimitive.Trigger {...props} asChild ref={internalRef} />;\n});\n"],"names":["Trigger","React","MenuTrigger","props","ref","menu","useCurrentMenu","internalRef","useProxiedRef","current","setMinWidth","getBoundingClientRect","width","DropdownMenuPrimitive","asChild"],"mappings":";;;;;MASaA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;EACpC,MAAMC,IAAI,GAAGC,cAAc,EAA3B;EACA,MAAMC,WAAW,GAAGC,aAAa,CAAoBJ,GAApB,CAAjC;EAEAH,SAAA,CAAgB;IACZ,IAAIM,WAAW,CAACE,OAAhB,EAAyB;MACrBJ,IAAI,SAAJ,IAAAA,IAAI,WAAJ,YAAAA,IAAI,CAAEK,WAAN,CAAkBH,WAAW,CAACE,OAAZ,CAAoBE,qBAApB,GAA4CC,KAA9D;;GAFR,EAIG,CAACL,WAAD,CAJH;EAMA,OAAON,aAAA,CAACY,SAAD,oBAAmCV;IAAOW,OAAO;IAACV,GAAG,EAAEG;IAAvD,CAAP;AACH,CAXsB;;;;"}
@@ -2,11 +2,11 @@ import { createElement, Fragment } from 'react';
2
2
  import { Button } from '../Button/Button.js';
3
3
  import { useLocalization } from '../Provider/Provider.js';
4
4
 
5
- var createPageRange = function createPageRange(pageCount, pageNumber) {
6
- var lowerLimit = Math.min(pageNumber, pageCount);
7
- var upperLimit = Math.min(pageNumber, pageCount);
5
+ const createPageRange = (pageCount, pageNumber) => {
6
+ let lowerLimit = Math.min(pageNumber, pageCount);
7
+ let upperLimit = Math.min(pageNumber, pageCount);
8
8
 
9
- for (var b = 1; b < 5 && b < pageCount;) {
9
+ for (let b = 1; b < 5 && b < pageCount;) {
10
10
  if (lowerLimit > 1) {
11
11
  lowerLimit--;
12
12
  b++;
@@ -18,37 +18,32 @@ var createPageRange = function createPageRange(pageCount, pageNumber) {
18
18
  }
19
19
  }
20
20
 
21
- var range = [];
21
+ const range = [];
22
22
 
23
- for (var i = lowerLimit; i <= upperLimit; i++) {
23
+ for (let i = lowerLimit; i <= upperLimit; i++) {
24
24
  range.push(i);
25
25
  }
26
26
 
27
27
  return range;
28
28
  };
29
29
 
30
- var PageNumbers = function PageNumbers(_ref) {
31
- var _ref$currentPageIndex = _ref.currentPageIndex,
32
- currentPageIndex = _ref$currentPageIndex === void 0 ? 0 : _ref$currentPageIndex,
33
- handleClick = _ref.onClick,
34
- pageCount = _ref.pageCount;
35
- var range = createPageRange(pageCount, currentPageIndex + 1);
36
-
37
- var _useLocalization = useLocalization(),
38
- texts = _useLocalization.texts;
39
-
40
- return createElement(Fragment, null, range.map(function (pageNumber) {
41
- return createElement(Button, {
42
- appearance: pageNumber === currentPageIndex + 1 ? 'primary' : 'default',
43
- "aria-current": pageNumber === currentPageIndex + 1 ? 'page' : undefined,
44
- key: pageNumber,
45
- onClick: function onClick() {
46
- return handleClick(pageNumber - 1);
47
- },
48
- "aria-label": texts.pagination.actions.pageX.replace('[X]', String(pageNumber)),
49
- tooltip: texts.pagination.actions.pageX.replace('[X]', String(pageNumber))
50
- }, pageNumber);
51
- }));
30
+ const PageNumbers = ({
31
+ currentPageIndex = 0,
32
+ onClick: handleClick,
33
+ pageCount
34
+ }) => {
35
+ const range = createPageRange(pageCount, currentPageIndex + 1);
36
+ const {
37
+ texts
38
+ } = useLocalization();
39
+ return createElement(Fragment, null, range.map(pageNumber => createElement(Button, {
40
+ appearance: pageNumber === currentPageIndex + 1 ? 'primary' : 'default',
41
+ "aria-current": pageNumber === currentPageIndex + 1 ? 'page' : undefined,
42
+ key: pageNumber,
43
+ onClick: () => handleClick(pageNumber - 1),
44
+ "aria-label": texts.pagination.actions.pageX.replace('[X]', String(pageNumber)),
45
+ tooltip: texts.pagination.actions.pageX.replace('[X]', String(pageNumber))
46
+ }, pageNumber)));
52
47
  };
53
48
 
54
49
  export { PageNumbers };
@@ -1 +1 @@
1
- {"version":3,"file":"PageNumbers.js","sources":["../../../../src/components/Pagination/PageNumbers.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button/Button';\nimport { useLocalization } from '../Provider/Provider';\n\ntype PageNumberProps = {\n currentPageIndex: number;\n onClick: (pageIndex: number) => void;\n pageCount: number;\n};\n\nconst createPageRange = (pageCount: number, pageNumber: number): number[] => {\n let lowerLimit = Math.min(pageNumber, pageCount);\n let upperLimit = Math.min(pageNumber, pageCount);\n\n for (let b = 1; b < 5 && b < pageCount; ) {\n if (lowerLimit > 1) {\n lowerLimit--;\n b++;\n }\n if (b < 5 && upperLimit < pageCount) {\n upperLimit++;\n b++;\n }\n }\n\n const range: number[] = [];\n\n for (let i = lowerLimit; i <= upperLimit; i++) {\n range.push(i);\n }\n\n return range;\n};\n\nexport const PageNumbers = ({ currentPageIndex = 0, onClick: handleClick, pageCount }: PageNumberProps): JSX.Element => {\n const range = createPageRange(pageCount, currentPageIndex + 1);\n const { texts } = useLocalization();\n\n return (\n <>\n {range.map((pageNumber: number) => (\n <Button\n appearance={pageNumber === currentPageIndex + 1 ? 'primary' : 'default'}\n aria-current={pageNumber === currentPageIndex + 1 ? 'page' : undefined}\n key={pageNumber}\n onClick={() => handleClick(pageNumber - 1)}\n aria-label={texts.pagination.actions.pageX.replace('[X]', String(pageNumber))}\n tooltip={texts.pagination.actions.pageX.replace('[X]', String(pageNumber))}\n >\n {pageNumber}\n </Button>\n ))}\n </>\n );\n};\n"],"names":["createPageRange","pageCount","pageNumber","lowerLimit","Math","min","upperLimit","b","range","i","push","PageNumbers","currentPageIndex","handleClick","onClick","useLocalization","texts","React","map","Button","appearance","undefined","key","pagination","actions","pageX","replace","String","tooltip"],"mappings":";;;;AAUA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,SAAD,EAAoBC,UAApB;EACpB,IAAIC,UAAU,GAAGC,IAAI,CAACC,GAAL,CAASH,UAAT,EAAqBD,SAArB,CAAjB;EACA,IAAIK,UAAU,GAAGF,IAAI,CAACC,GAAL,CAASH,UAAT,EAAqBD,SAArB,CAAjB;;EAEA,KAAK,IAAIM,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAGN,SAA7B,GAA0C;IACtC,IAAIE,UAAU,GAAG,CAAjB,EAAoB;MAChBA,UAAU;MACVI,CAAC;;;IAEL,IAAIA,CAAC,GAAG,CAAJ,IAASD,UAAU,GAAGL,SAA1B,EAAqC;MACjCK,UAAU;MACVC,CAAC;;;;EAIT,IAAMC,KAAK,GAAa,EAAxB;;EAEA,KAAK,IAAIC,CAAC,GAAGN,UAAb,EAAyBM,CAAC,IAAIH,UAA9B,EAA0CG,CAAC,EAA3C,EAA+C;IAC3CD,KAAK,CAACE,IAAN,CAAWD,CAAX;;;EAGJ,OAAOD,KAAP;AACH,CAtBD;;IAwBaG,WAAW,GAAG,SAAdA,WAAc;mCAAGC;MAAAA,sDAAmB;MAAYC,mBAATC;MAAsBb,iBAAAA;EACtE,IAAMO,KAAK,GAAGR,eAAe,CAACC,SAAD,EAAYW,gBAAgB,GAAG,CAA/B,CAA7B;;EACA,uBAAkBG,eAAe,EAAjC;MAAQC,KAAR,oBAAQA,KAAR;;EAEA,OACIC,aAAA,SAAA,MAAA,EACKT,KAAK,CAACU,GAAN,CAAU,UAAChB,UAAD;IAAA,OACPe,aAAA,CAACE,MAAD;MACIC,UAAU,EAAElB,UAAU,KAAKU,gBAAgB,GAAG,CAAlC,GAAsC,SAAtC,GAAkD;sBAChDV,UAAU,KAAKU,gBAAgB,GAAG,CAAlC,GAAsC,MAAtC,GAA+CS;MAC7DC,GAAG,EAAEpB;MACLY,OAAO,EAAE;QAAA,OAAMD,WAAW,CAACX,UAAU,GAAG,CAAd,CAAjB;;oBACGc,KAAK,CAACO,UAAN,CAAiBC,OAAjB,CAAyBC,KAAzB,CAA+BC,OAA/B,CAAuC,KAAvC,EAA8CC,MAAM,CAACzB,UAAD,CAApD;MACZ0B,OAAO,EAAEZ,KAAK,CAACO,UAAN,CAAiBC,OAAjB,CAAyBC,KAAzB,CAA+BC,OAA/B,CAAuC,KAAvC,EAA8CC,MAAM,CAACzB,UAAD,CAApD;KANb,EAQKA,UARL,CADO;GAAV,CADL,CADJ;AAgBH;;;;"}
1
+ {"version":3,"file":"PageNumbers.js","sources":["../../../../src/components/Pagination/PageNumbers.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button/Button';\nimport { useLocalization } from '../Provider/Provider';\n\ntype PageNumberProps = {\n currentPageIndex: number;\n onClick: (pageIndex: number) => void;\n pageCount: number;\n};\n\nconst createPageRange = (pageCount: number, pageNumber: number): number[] => {\n let lowerLimit = Math.min(pageNumber, pageCount);\n let upperLimit = Math.min(pageNumber, pageCount);\n\n for (let b = 1; b < 5 && b < pageCount; ) {\n if (lowerLimit > 1) {\n lowerLimit--;\n b++;\n }\n if (b < 5 && upperLimit < pageCount) {\n upperLimit++;\n b++;\n }\n }\n\n const range: number[] = [];\n\n for (let i = lowerLimit; i <= upperLimit; i++) {\n range.push(i);\n }\n\n return range;\n};\n\nexport const PageNumbers = ({ currentPageIndex = 0, onClick: handleClick, pageCount }: PageNumberProps): JSX.Element => {\n const range = createPageRange(pageCount, currentPageIndex + 1);\n const { texts } = useLocalization();\n\n return (\n <>\n {range.map((pageNumber: number) => (\n <Button\n appearance={pageNumber === currentPageIndex + 1 ? 'primary' : 'default'}\n aria-current={pageNumber === currentPageIndex + 1 ? 'page' : undefined}\n key={pageNumber}\n onClick={() => handleClick(pageNumber - 1)}\n aria-label={texts.pagination.actions.pageX.replace('[X]', String(pageNumber))}\n tooltip={texts.pagination.actions.pageX.replace('[X]', String(pageNumber))}\n >\n {pageNumber}\n </Button>\n ))}\n </>\n );\n};\n"],"names":["createPageRange","pageCount","pageNumber","lowerLimit","Math","min","upperLimit","b","range","i","push","PageNumbers","currentPageIndex","onClick","handleClick","texts","useLocalization","React","map","Button","appearance","undefined","key","pagination","actions","pageX","replace","String","tooltip"],"mappings":";;;;AAUA,MAAMA,eAAe,GAAG,CAACC,SAAD,EAAoBC,UAApB;EACpB,IAAIC,UAAU,GAAGC,IAAI,CAACC,GAAL,CAASH,UAAT,EAAqBD,SAArB,CAAjB;EACA,IAAIK,UAAU,GAAGF,IAAI,CAACC,GAAL,CAASH,UAAT,EAAqBD,SAArB,CAAjB;;EAEA,KAAK,IAAIM,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAGN,SAA7B,GAA0C;IACtC,IAAIE,U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
2
2
 
3
- var usePagination = function usePagination(initialPageIndex, initialPageSize) {
4
- if (initialPageIndex === void 0) {
5
- initialPageIndex = 0;
6
- }
7
-
8
- if (initialPageSize === void 0) {
9
- initialPageSize = 10;
10
- }
11
-
12
- var _React$useState = React__default.useState(initialPageIndex),
13
- pageIndex = _React$useState[0],
14
- setPageIndex = _React$useState[1];
15
-
16
- var _React$useState2 = React__default.useState(initialPageSize),
17
- pageSize = _React$useState2[0],
18
- setPageSize = _React$useState2[1];
19
-
3
+ const usePagination = (initialPageIndex = 0, initialPageSize = 10) => {
4
+ const [pageIndex, setPageIndex] = React__default.useState(initialPageIndex);
5
+ const [pageSize, setPageSize] = React__default.useState(initialPageSize);
20
6
  return {
21
- pageIndex: pageIndex,
22
- pageSize: pageSize,
23
- setPageIndex: setPageIndex,
24
- setPageSize: setPageSize
7
+ pageIndex,
8
+ pageSize,
9
+ setPageIndex,
10
+ setPageSize
25
11
  };
26
12
  };
27
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"usePagination.js","sources":["../../../../src/components/Pagination/usePagination.tsx"],"sourcesContent":["import React from 'react';\n\nexport type usePaginationValues = {\n /** Current page index (zero based) */\n pageIndex: number;\n /** Number of items displayed on a page */\n pageSize: number;\n /** Handler called when navigating through pages */\n setPageIndex: (pageIndex: number) => void;\n /** Handler called when changing the size of the page */\n setPageSize: (size: number) => void;\n};\n\nexport const usePagination = (initialPageIndex = 0, initialPageSize = 10): usePaginationValues => {\n const [pageIndex, setPageIndex] = React.useState(initialPageIndex);\n const [pageSize, setPageSize] = React.useState(initialPageSize);\n\n return {\n pageIndex,\n pageSize,\n setPageIndex,\n setPageSize,\n };\n};\n"],"names":["usePagination","initialPageIndex","initialPageSize","React","useState","pageIndex","setPageIndex","pageSize","setPageSize"],"mappings":";;IAaaA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,gBAAD,EAAuBC,eAAvB;MAACD;IAAAA,mBAAmB;;;MAAGC;IAAAA,kBAAkB;;;EAClE,sBAAkCC,cAAK,CAACC,QAAN,CAAeH,gBAAf,CAAlC;MAAOI,SAAP;MAAkBC,YAAlB;;EACA,uBAAgCH,cAAK,CAACC,QAAN,CAAeF,eAAf,CAAhC;MAAOK,QAAP;MAAiBC,WAAjB;;EAEA,OAAO;IACHH,SAAS,EAATA,SADG;IAEHE,QAAQ,EAARA,QAFG;IAGHD,YAAY,EAAZA,YAHG;IAIHE,WAAW,EAAXA;GAJJ;AAMH;;;;"}
1
+ {"version":3,"file":"usePagination.js","sources":["../../../../src/components/Pagination/usePagination.tsx"],"sourcesContent":["import React from 'react';\n\nexport type usePaginationValues = {\n /** Current page index (zero based) */\n pageIndex: number;\n /** Number of items displayed on a page */\n pageSize: number;\n /** Handler called when navigating through pages */\n setPageIndex: (pageIndex: number) => void;\n /** Handler called when changing the size of the page */\n setPageSize: (size: number) => void;\n};\n\nexport const usePagination = (initialPageIndex = 0, initialPageSize = 10): usePaginationValues => {\n const [pageIndex, setPageIndex] = React.useState(initialPageIndex);\n const [pageSize, setPageSize] = React.useState(initialPageSize);\n\n return {\n pageIndex,\n pageSize,\n setPageIndex,\n setPageSize,\n };\n};\n"],"names":["usePagination","initialPageIndex","initialPageSize","pageIndex","setPageIndex","React","useState","pageSize","setPageSize"],"mappings":";;MAaaA,aAAa,GAAG,CAACC,gBAAgB,GAAG,CAApB,EAAuBC,eAAe,GAAG,EAAzC;EACzB,MAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4BC,cAAK,CAACC,QAAN,CAAeL,gBAAf,CAAlC;EACA,MAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BH,cAAK,CAACC,QAAN,CAAeJ,eAAf,CAAhC;EAEA,OAAO;IACHC,SADG;IAEHI,QAFG;IAGHH,YAHG;IAIHI;GAJJ;AAMH;;;;"}
@@ -1,13 +1,13 @@
1
1
  import React__default from 'react';
2
2
  import keycode from 'keycode';
3
3
 
4
- var usePaginationShortcuts = function usePaginationShortcuts(_ref) {
5
- var setPageIndex = _ref.setPageIndex,
6
- maxPageIndex = _ref.maxPageIndex,
7
- pageIndex = _ref.pageIndex,
8
- useGlobalKeyboardNavigation = _ref.dangerouslyHijackGlobalKeyboardNavigation;
9
-
10
- var onKeyDown = function onKeyDown(event) {
4
+ const usePaginationShortcuts = ({
5
+ setPageIndex,
6
+ maxPageIndex,
7
+ pageIndex,
8
+ dangerouslyHijackGlobalKeyboardNavigation: useGlobalKeyboardNavigation
9
+ }) => {
10
+ const onKeyDown = event => {
11
11
  if (setPageIndex && event.keyCode === keycode('home')) {
12
12
  event.preventDefault();
13
13
  setPageIndex(0);
@@ -33,12 +33,12 @@ var usePaginationShortcuts = function usePaginationShortcuts(_ref) {
33
33
  }
34
34
  };
35
35
 
36
- React__default.useEffect(function () {
36
+ React__default.useEffect(() => {
37
37
  if (useGlobalKeyboardNavigation) {
38
38
  window.addEventListener('keydown', onKeyDown);
39
39
  }
40
40
 
41
- return function () {
41
+ return () => {
42
42
  if (useGlobalKeyboardNavigation) {
43
43
  window.removeEventListener('keydown', onKeyDown);
44
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"usePaginationShortcuts.js","sources":["../../../../src/components/Pagination/usePaginationShortcuts.tsx"],"sourcesContent":["import React from 'react';\nimport keycode from 'keycode';\n\ninterface Props {\n setPageIndex: (pageIndex: number) => void;\n maxPageIndex: number;\n pageIndex: number;\n dangerouslyHijackGlobalKeyboardNavigation: boolean;\n}\n\nexport const usePaginationShortcuts = ({\n setPageIndex,\n maxPageIndex,\n pageIndex,\n dangerouslyHijackGlobalKeyboardNavigation: useGlobalKeyboardNavigation,\n}: Props) => {\n const onKeyDown = (event: KeyboardEvent): void => {\n if (setPageIndex && event.keyCode === keycode('home')) {\n event.preventDefault();\n setPageIndex(0);\n return;\n }\n\n if (setPageIndex && event.keyCode === keycode('end')) {\n event.preventDefault();\n setPageIndex(maxPageIndex);\n return;\n }\n\n if (setPageIndex && event.keyCode === keycode('page up')) {\n event.preventDefault();\n setPageIndex(Math.max(0, pageIndex - 1));\n return;\n }\n\n if (setPageIndex && event.keyCode === keycode('page down')) {\n event.preventDefault();\n setPageIndex(Math.min(maxPageIndex, pageIndex + 1));\n return;\n }\n };\n\n React.useEffect(() => {\n if (useGlobalKeyboardNavigation) {\n window.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n if (useGlobalKeyboardNavigation) {\n window.removeEventListener('keydown', onKeyDown);\n }\n };\n }, [onKeyDown, useGlobalKeyboardNavigation]);\n};\n"],"names":["usePaginationShortcuts","setPageIndex","maxPageIndex","pageIndex","useGlobalKeyboardNavigation","dangerouslyHijackGlobalKeyboardNavigation","onKeyDown","event","keyCode","keycode","preventDefault","Math","max","min","React","useEffect","window","addEventListener","removeEventListener"],"mappings":";;;IAUaA,sBAAsB,GAAG,SAAzBA,sBAAyB;MAClCC,oBAAAA;MACAC,oBAAAA;MACAC,iBAAAA;MAC2CC,mCAA3CC;;EAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;IACd,IAAIN,YAAY,IAAIM,KAAK,CAACC,OAAN,KAAkBC,OAAO,CAAC,MAAD,CAA7C,EAAuD;MACnDF,KAAK,CAACG,cAAN;MACAT,YAAY,CAAC,CAAD,CAAZ;MACA;;;IAGJ,IAAIA,YAAY,IAAIM,KAAK,CAACC,OAAN,KAAkBC,OAAO,CAAC,KAAD,CAA7C,EAAsD;MAClDF,KAAK,CAACG,cAAN;MACAT,YAAY,CAACC,YAAD,CAAZ;MACA;;;IAGJ,IAAID,YAAY,IAAIM,KAAK,CAACC,OAAN,KAAkBC,OAAO,CAAC,SAAD,CAA7C,EAA0D;MACtDF,KAAK,CAACG,cAAN;MACAT,YAAY,CAACU,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYT,SAAS,GAAG,CAAxB,CAAD,CAAZ;MACA;;;IAGJ,IAAIF,YAAY,IAAIM,KAAK,CAACC,OAAN,KAAkBC,OAAO,CAAC,WAAD,CAA7C,EAA4D;MACxDF,KAAK,CAACG,cAAN;MACAT,YAAY,CAACU,IAAI,CAACE,GAAL,CAASX,YAAT,EAAuBC,SAAS,GAAG,CAAnC,CAAD,CAAZ;MACA;;GAtBR;;EA0BAW,cAAK,CAACC,SAAN,CAAgB;IACZ,IAAIX,2BAAJ,EAAiC;MAC7BY,MAAM,CAACC,gBAAP,CAAwB,SAAxB,EAAmCX,SAAnC;;;IAGJ,OAAO;MACH,IAAIF,2BAAJ,EAAiC;QAC7BY,MAAM,CAACE,mBAAP,CAA2B,SAA3B,EAAsCZ,SAAtC;;KAFR;GALJ,EAUG,CAACA,SAAD,EAAYF,2BAAZ,CAVH;AAWH;;;;"}
1
+ {"version":3,"file":"usePaginationShortcuts.js","sources":["../../../../src/components/Pagination/usePaginationShortcuts.tsx"],"sourcesContent":["import React from 'react';\nimport keycode from 'keycode';\n\ninterface Props {\n setPageIndex: (pageIndex: number) => void;\n maxPageIndex: number;\n pageIndex: number;\n dangerouslyHijackGlobalKeyboardNavigation: boolean;\n}\n\nexport const usePaginationShortcuts = ({\n setPageIndex,\n maxPageIndex,\n pageIndex,\n dangerouslyHijackGlobalKeyboardNavigation: useGlobalKeyboardNavigation,\n}: Props) => {\n const onKeyDown = (event: KeyboardEvent): void => {\n if (setPageIndex && event.keyCode === keycode('home')) {\n event.preventDefault();\n setPageIndex(0);\n return;\n }\n\n if (setPageIndex && event.keyCode === keycode('end')) {\n event.preventDefault();\n setPageIndex(maxPageIndex);\n return;\n }\n\n if (setPageIndex && event.keyCode === keycode('page up')) {\n event.preventDefault();\n setPageIndex(Math.max(0, pageIndex - 1));\n return;\n }\n\n if (setPageIndex && event.keyCode === keycode('page down')) {\n event.preventDefault();\n setPageIndex(Math.min(maxPageIndex, pageIndex + 1));\n return;\n }\n };\n\n React.useEffect(() => {\n if (useGlobalKeyboardNavigation) {\n window.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n if (useGlobalKeyboardNavigation) {\n window.removeEventListener('keydown', onKeyDown);\n }\n };\n }, [onKeyDown, useGlobalKeyboardNavigation]);\n};\n"],"names":["usePaginationShortcuts","setPageIndex","maxPageIndex","pageIndex","dangerouslyHijackGlobalKeyboardNavigation","useGlobalKeyboardNavigation","onKeyDown","event","keyCode","keycode","preventDefault","Math","max","min","React","useEffect","window","addEventListener","removeEventListener"],"mappings":";;;MAUaA,sBAAsB,GAAG,CAAC;EACnCC,YADmC;EAEnCC,YAFmC;EAGnCC,SAHmC;EAInCC,yCAAyC,EAAEC;AAJR,CAAD;EAMlC,MAAMC,SAAS,GAAIC,KAAD;IACd,IAAIN,YAAY,IAAIM,KAAK,CAACC,OAAN,KAAkBC,OAAO,CAAC,MAAD,CAA7C,EAAuD;MACnDF,KAAK,CAACG,cAAN;MACAT,YAAY,CAAC,CAAD,CAAZ;MACA;;;IAGJ,IAAIA,YAAY,IAAIM,KAAK,CAACC,OAAN,KAAkBC,OAAO,CAAC,KAAD,CAA7C,EAAsD;MAClDF,KAAK,CAACG,cAAN;MACAT,YAAY,CAACC,YAAD,CAAZ;MACA;;;IAGJ,IAAID,YAAY,IAAIM,KAAK,CAACC,OAAN,KAAkBC,OAAO,CAAC,SAAD,CAA7C,EAA0D;MACtDF,KAAK,CAACG,cAAN;MACAT,YAAY,CAACU,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYT,SAAS,GAAG,CAAxB,CAAD,CAAZ;MACA;;;IAGJ,IAAIF,YAAY,IAAIM,KAAK,CAACC,OAAN,KAAkBC,OAAO,CAAC,WAAD,CAA7C,EAA4D;MACxDF,KAAK,CAACG,cAAN;MACAT,YAAY,CAACU,IAAI,CAACE,GAAL,CAASX,YAAT,EAAuBC,SAAS,GAAG,CAAnC,CAAD,CAAZ;MACA;;GAtBR;;EA0BAW,cAAK,CAACC,SAAN,CAAgB;IACZ,IAAIV,2BAAJ,EAAiC;MAC7BW,MAAM,CAACC,gBAAP,CAAwB,SAAxB,EAAmCX,SAAnC;;;IAGJ,OAAO;MACH,IAAID,2BAAJ,EAAiC;QAC7BW,MAAM,CAACE,mBAAP,CAA2B,SAA3B,EAAsCZ,SAAtC;;KAFR;GALJ,EAUG,CAACA,SAAD,EAAYD,2BAAZ,CAVH;AAWH;;;;"}
@@ -3,7 +3,7 @@ import { forwardRef, useMemo, createElement, createContext, useContext, isValidE
3
3
  import cn from 'classnames';
4
4
  import { Root, Trigger as Trigger$1, Close as Close$1 } from '@radix-ui/react-popover';
5
5
  import { UnstyledContent, UnstyledArrow } from './Primitives.js';
6
- import mergeRefs from '../../utils/mergeRefs.js';
6
+ import { mergeRefs } from '../../utils/mergeRefs.js';
7
7
 
8
8
  var _excluded = ["children", "trigger"];
9
9
  var PopoverContext = /*#__PURE__*/createContext({
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from './Primitives';\nimport mergeRefs from '../../utils/mergeRefs';\n\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\n\nconst PopoverContext = React.createContext<PopoverContextValue>({\n props: {},\n ref: null,\n});\n\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Trigger = React.forwardRef(function PopoverTrigger(props: PopoverTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const context = React.useContext(PopoverContext);\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\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`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Trigger {...context.props} {...props} children={children} ref={mergeRefs([context.ref, ref])} asChild />\n );\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('hide'));\n };\n\n return children({ close, ref });\n});\n\nexport type PopoverContentRenderProps = { close: () => void };\nexport type PopoverContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function PopoverContent(props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('bg-white focus:border-blue-light', props.className);\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <PopoverPrimitive.Close asChild>\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\n </PopoverPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <UnstyledContent className={className} placement={props.placement} ref={ref}>\n {output}\n <UnstyledArrow className=\"text-white\" />\n </UnstyledContent>\n );\n});\n\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Close = React.forwardRef(\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\n )\n);\n\nexport type PopoverProps = React.PropsWithChildren<{\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n}>;\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\n};\n\nexport const Popover = React.forwardRef(function Popover(props: PopoverProps, ref: React.Ref<HTMLElement>) {\n const { children, trigger, ...otherProps } = props;\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\n\n return (\n <PopoverContext.Provider value={context}>\n <PopoverPrimitive.Root>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </PopoverPrimitive.Root>\n </PopoverContext.Provider>\n );\n}) as ForwardedPopoverWithStatics;\nPopover.Trigger = Trigger;\nPopover.Content = Content;\nPopover.Close = Close;\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;EAC5DC,KAAK,EAAE,EADqD;EAE5DC,GAAG,EAAE;AAFuD,CAAzC,CAAvB;AAMA,IAAMC,OAAO,gBAAGH,UAAA,CAAiB,SAASI,cAAT,CAAwBH,KAAxB,EAAoDC,GAApD;;;EAC7B,IAAMG,OAAO,GAAGL,UAAA,CAAiBD,cAAjB,CAAhB;EACA,IAAIO,QAAQ,GAAGL,KAAK,CAACK,QAArB;;EAEA,IAAIN,cAAA,CAAqBC,KAAK,CAACK,QAA3B,KAAwC,2BAAOL,KAAK,CAACK,QAAb,oDAAO,gBAAgBC,IAAvB,MAAgC,UAA5E,EAAwF;IACpFC,OAAO,CAACC,IAAR,uHACwHR,KAAK,CAACK,QAAN,CAAeC,IAAf,CAAoBG,IAD5I,mDAC8LT,KAAK,CAACK,QAAN,CAAeC,IAAf,CAAoBG,IADlN;IAGAJ,QAAQ,GAAGN,aAAA,OAAA,MAAA,EAAOC,KAAK,CAACK,QAAb,CAAX;;;EAGJ,OACIN,aAAA,CAACW,SAAD,oBAA8BN,OAAO,CAACJ,OAAWA;IAAOK,QAAQ,EAAEA;IAAUJ,GAAG,EAAEU,SAAS,CAAC,CAACP,OAAO,CAACH,GAAT,EAAcA,GAAd,CAAD;IAAsBW,OAAO;IAAvH,CADJ;AAGH,CAde,CAAhB;AAgBA,IAAMC,iBAAiB,gBAAGd,UAAA,CAAiB,SAASc,iBAAT,OAAuDZ,GAAvD;MAA6BI,gBAAAA;MAAUS,eAAAA;;EAC9E,IAAMC,KAA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EACA,IAAMI,OAAO,GAAGL,OAAA,CAAc;IAAA,OAAO;MAAEC,KAAK,EAAE4B,UAAT;MAAqB3B,GAAG,EAAHA;KAA5B;GAAd,EAAkD,CAAC2B,UAAD,CAAlD,CAAhB;EAEA,OACI7B,aAAA,CAACD,cAAc,CAAC+B,QAAhB;IAAyBC,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';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from './Primitives';\nimport { mergeRefs } from '../../utils/mergeRefs';\n\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\n\nconst PopoverContext = React.createContext<PopoverContextValue>({\n props: {},\n ref: null,\n});\n\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Trigger = React.forwardRef(function PopoverTrigger(props: PopoverTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const context = React.useContext(PopoverContext);\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\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`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Trigger {...context.props} {...props} children={children} ref={mergeRefs([context.ref, ref])} asChild />\n );\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('hide'));\n };\n\n return children({ close, ref });\n});\n\nexport type PopoverContentRenderProps = { close: () => void };\nexport type PopoverContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function PopoverContent(props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('bg-white focus:border-blue-light', props.className);\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <PopoverPrimitive.Close asChild>\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\n </PopoverPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <UnstyledContent className={className} placement={props.placement} ref={ref}>\n {output}\n <UnstyledArrow className=\"text-white\" />\n </UnstyledContent>\n );\n});\n\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Close = React.forwardRef(\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\n )\n);\n\nexport type PopoverProps = React.PropsWithChildren<{\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n}>;\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\n};\n\nexport const Popover = React.forwardRef(function Popover(props: PopoverProps, ref: React.Ref<HTMLElement>) {\n const { children, trigger, ...otherProps } = props;\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\n\n return (\n <PopoverContext.Provider value={context}>\n <PopoverPrimitive.Root>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </PopoverPrimitive.Root>\n </PopoverContext.Provider>\n );\n}) as ForwardedPopoverWithStatics;\nPopover.Trigger = Trigger;\nPopover.Content = Content;\nPopover.Close = Close;\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;EAC5DC,KAAK,EAAE,EADqD;EAE5DC,GAAG,EAAE;AAFuD,CAAzC,CAAvB;AAMA,IAAMC,OAAO,gBAAGH,UAAA,CAAiB,SAASI,cAAT,CAAwBH,KAAxB,EAAoDC,GAApD;;;EAC7B,IAAMG,OAAO,GAAGL,UAAA,CAAiBD,cAAjB,CAAhB;EACA,IAAIO,QAAQ,GAAGL,KAAK,CAACK,QAArB;;EAEA,IAAIN,cAAA,CAAqBC,KAAK,CAACK,QAA3B,KAAwC,2BAAOL,KAAK,CAACK,QAAb,oDAAO,gBAAgBC,IAAvB,MAAgC,UAA5E,EAAwF;IACpFC,OAAO,CAACC,IAAR,uHACwHR,KAAK,CAACK,QAAN,CAAeC,IAAf,CAAoBG,IAD5I,mDAC8LT,KAAK,CAACK,QAAN,CAAeC,IAAf,CAAoBG,IADlN;IAGAJ,QAAQ,GAAGN,aAAA,OAAA,MAAA,EAAOC,KAAK,CAACK,QAAb,CAAX;;;EAGJ,OACIN,aAAA,CAACW,SAAD,oBAA8BN,OAAO,CAACJ,OAAWA;IAAOK,QAAQ,EAAEA;IAAUJ,GAAG,EAAEU,SAAS,CAAC,CAACP,OAAO,CAACH,GAAT,EAAcA,GAAd,CAAD;IAAsBW,OAAO;IAAvH,CADJ;AAGH,CAde,CAAhB;AAgBA,IAAMC,iBAAiB,gBA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CAAQK,QAAR;MAAkBsB,OAAlB,GAA6C3B,KAA7C,CAAkB2B,OAAlB;MAA8BC,UAA9B,iCAA6C5B,KAA7C;;EACA,IAAMI,OAAO,GAAGL,OAAA,CAAc;IAAA,OAAO;MAAEC,KAAK,EAAE4B,UAAT;MAAqB3B,GAAG,EAAHA;KAA5B;GAAd,EAAkD,CAAC2B,UAAD,CAAlD,CAAhB;EAEA,OACI7B,aAAA,CAACD,cAAc,CAAC+B,QAAhB;IAAyBC,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,10 +1,8 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { forwardRef, createElement } from 'react';
3
2
  import cn from 'classnames';
4
3
  import { Arrow, Content } from '@radix-ui/react-popover';
5
4
 
6
- var _excluded = ["placement"];
7
- var UnstyledArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
5
+ const UnstyledArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
8
6
  return createElement(Arrow, {
9
7
  className: "pointer-events-none -mt-px",
10
8
  asChild: true,
@@ -25,11 +23,12 @@ var UnstyledArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
25
23
  d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
26
24
  })));
27
25
  });
28
- var UnstyledContent = /*#__PURE__*/forwardRef(function PopoverContent(props, ref) {
29
- var side = props.placement,
30
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
31
-
32
- var className = cn('border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group z-[996]', props.className);
26
+ const UnstyledContent = /*#__PURE__*/forwardRef(function PopoverContent(props, ref) {
27
+ const {
28
+ placement: side,
29
+ ...otherProps
30
+ } = props;
31
+ const className = cn('border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group z-[996]', props.className);
33
32
  return createElement(Content, Object.assign({}, otherProps, {
34
33
  className: className,
35
34
  side: side,
@@ -1 +1 @@
1
- {"version":3,"file":"Primitives.js","sources":["../../../../src/components/Popover/Primitives.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../../types';\n\nexport const UnstyledArrow = React.forwardRef(function PopoverArrow(\n props: React.SVGAttributes<SVGElement>,\n ref: React.Ref<SVGSVGElement>\n) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"text-grey-dark group-focus:text-blue-light fill-current\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"\n ></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"\n ></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n\nexport type UnstyledContentProps = Omit<PopoverPrimitive.PopoverContentProps, 'side'> & {\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nexport const UnstyledContent = React.forwardRef(function PopoverContent(\n props: UnstyledContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { placement: side, ...otherProps } = props;\n\n const className = cn(\n 'border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group z-[996]',\n props.className\n );\n\n return <PopoverPrimitive.Content {...otherProps} className={className} side={side} sideOffset={1} ref={ref} />;\n});\n"],"names":["UnstyledArrow","React","PopoverArrow","props","ref","PopoverPrimitive","className","asChild","offset","width","height","viewBox","style","transform","d","UnstyledContent","PopoverContent","side","placement","otherProps","cn","sideOffset"],"mappings":";;;;;;IAKaA,aAAa,gBAAGC,UAAA,CAAiB,SAASC,YAAT,CAC1CC,KAD0C,EAE1CC,GAF0C;EAI1C,OACIH,aAAA,CAACI,KAAD;IAAwBC,SAAS,EAAC;IAA6BC,OAAO;IAACC,MAAM,EAAE;IAAGC,KAAK,EAAE;IAAIC,MAAM,EAAE;GAArG,EACIT,aAAA,MAAA,oBAASE;IAAOC,GAAG,EAAEA;IAAKO,OAAO,EAAC;IAAaC,KAAK,EAAE;MAAEC,SAAS,EAAE;;IAAnE,EACIZ,aAAA,OAAA;IACIK,SAAS,EAAC;IACVQ,CAAC,EAAC;GAFN,CADJ,EAKIb,aAAA,OAAA;IACIK,SAAS,EAAC;IACVQ,CAAC,EAAC;GAFN,CALJ,CADJ,CADJ;AAcH,CAlB4B;IAwBhBC,eAAe,gBAAGd,UAAA,CAAiB,SAASe,cAAT,CAC5Cb,KAD4C,EAE5CC,GAF4C;EAI5C,IAAmBa,IAAnB,GAA2Cd,KAA3C,CAAQe,SAAR;MAA4BC,UAA5B,iCAA2ChB,KAA3C;;EAEA,IAAMG,SAAS,GAAGc,EAAE,CAChB,2FADgB,EAEhBjB,KAAK,CAACG,SAFU,CAApB;EAKA,OAAOL,aAAA,CAACI,OAAD,oBAA8Bc;IAAYb,SAAS,EAAEA;IAAWW,IAAI,EAAEA;IAAMI,UAAU,EAAE;IAAGjB,GAAG,EAAEA;IAAhG,CAAP;AACH,CAZ8B;;;;"}
1
+ {"version":3,"file":"Primitives.js","sources":["../../../../src/components/Popover/Primitives.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../../types';\n\nexport const UnstyledArrow = React.forwardRef(function PopoverArrow(\n props: React.SVGAttributes<SVGElement>,\n ref: React.Ref<SVGSVGElement>\n) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"text-grey-dark group-focus:text-blue-light fill-current\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"\n ></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"\n ></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n\nexport type UnstyledContentProps = Omit<PopoverPrimitive.PopoverContentProps, 'side'> & {\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nexport const UnstyledContent = React.forwardRef(function PopoverContent(\n props: UnstyledContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { placement: side, ...otherProps } = props;\n\n const className = cn(\n 'border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group z-[996]',\n props.className\n );\n\n return <PopoverPrimitive.Content {...otherProps} className={className} side={side} sideOffset={1} ref={ref} />;\n});\n"],"names":["UnstyledArrow","React","PopoverArrow","props","ref","PopoverPrimitive","className","asChild","offset","width","height","viewBox","style","transform","d","UnstyledContent","PopoverContent","placement","side","otherProps","cn","sideOffset"],"mappings":";;;;MAKaA,aAAa,gBAAGC,UAAA,CAAiB,SAASC,YAAT,CAC1CC,KAD0C,EAE1CC,GAF0C;EAI1C,OACIH,aAAA,CAACI,KAAD;IAAwBC,SAAS,EAAC;IAA6BC,OAAO;IAACC,MAAM,EAAE;IAAGC,KAAK,EAAE;IAAIC,MAAM,EAAE;GAArG,EACIT,aAAA,MAAA,oBAASE;IAAOC,GAAG,EAAEA;IAAKO,OAAO,EAAC;IAAaC,KAAK,EAAE;MAAEC,SAAS,EAAE;;IAAnE,EACIZ,aAAA,OAAA;IACIK,SAAS,EAAC;IACVQ,CAAC,EAAC;GAFN,CADJ,EAKIb,aAAA,OAAA;IACIK,SAAS,EAAC;IACVQ,CAAC,EAAC;GAFN,CALJ,CADJ,CADJ;AAcH,CAlB4B;MAwBhBC,eAAe,gBAAGd,UAAA,CAAiB,SAASe,cAAT,CAC5Cb,KAD4C,EAE5CC,GAF4C;EAI5C,MAAM;IAAEa,SAAS,EAAEC,IAAb;IAAmB,GAAGC;MAAehB,KAA3C;EAEA,MAAMG,SAAS,GAAGc,EAAE,CAChB,2FADgB,EAEhBjB,KAAK,CAACG,SAFU,CAApB;EAKA,OAAOL,aAAA,CAACI,OAAD,oBAA8Bc;IAAYb,SAAS,EAAEA;IAAWY,IAAI,EAAEA;IAAMG,UAAU,EAAE;IAAGjB,GAAG,EAAEA;IAAhG,CAAP;AACH,CAZ8B;;;;"}