@economic/taco 1.1.5-alpha.1 → 1.1.8

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 (93) hide show
  1. package/dist/components/Icon/components/LogOut.d.ts +3 -0
  2. package/dist/components/Icon/components/Menu.d.ts +3 -0
  3. package/dist/components/Icon/components/Profile.d.ts +3 -0
  4. package/dist/components/Icon/components/index.d.ts +1 -1
  5. package/dist/components/Input/Input.d.ts +1 -1
  6. package/dist/components/Menu/Menu.d.ts +2 -2
  7. package/dist/components/Menu/components/Item.d.ts +1 -1
  8. package/dist/components/Menu/components/Link.d.ts +1 -1
  9. package/dist/esm/components/Card/Card.js +12 -14
  10. package/dist/esm/components/Card/Card.js.map +1 -1
  11. package/dist/esm/components/Checkbox/Checkbox.js +18 -15
  12. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  13. package/dist/esm/components/Combobox/Combobox.js +25 -23
  14. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  15. package/dist/esm/components/Datepicker/Datepicker.js +52 -48
  16. package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
  17. package/dist/esm/components/Dialog/Dialog.js +58 -39
  18. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  19. package/dist/esm/components/Field/Field.js +12 -10
  20. package/dist/esm/components/Field/Field.js.map +1 -1
  21. package/dist/esm/components/Form/Form.js +8 -6
  22. package/dist/esm/components/Form/Form.js.map +1 -1
  23. package/dist/esm/components/Group/Group.js +8 -6
  24. package/dist/esm/components/Group/Group.js.map +1 -1
  25. package/dist/esm/components/Hanger/Hanger.js +35 -27
  26. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  27. package/dist/esm/components/HoverCard/HoverCard.js +9 -8
  28. package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
  29. package/dist/esm/components/Icon/Icon.js +8 -7
  30. package/dist/esm/components/Icon/Icon.js.map +1 -1
  31. package/dist/esm/components/Icon/components/LogOut.js +20 -0
  32. package/dist/esm/components/Icon/components/LogOut.js.map +1 -0
  33. package/dist/esm/components/Icon/components/Menu.js +18 -0
  34. package/dist/esm/components/Icon/components/Menu.js.map +1 -0
  35. package/dist/esm/components/Icon/components/Profile.js +20 -0
  36. package/dist/esm/components/Icon/components/Profile.js.map +1 -0
  37. package/dist/esm/components/Icon/components/index.js +6 -0
  38. package/dist/esm/components/Icon/components/index.js.map +1 -1
  39. package/dist/esm/components/IconButton/IconButton.js +11 -9
  40. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  41. package/dist/esm/components/Input/Input.js +25 -25
  42. package/dist/esm/components/Input/Input.js.map +1 -1
  43. package/dist/esm/components/Listbox/Listbox.js +25 -24
  44. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  45. package/dist/esm/components/Menu/Menu.js +34 -16
  46. package/dist/esm/components/Menu/Menu.js.map +1 -1
  47. package/dist/esm/components/Navigation/Navigation.js +44 -35
  48. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  49. package/dist/esm/components/Pagination/Pagination.js +56 -39
  50. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  51. package/dist/esm/components/Popover/Popover.js +34 -29
  52. package/dist/esm/components/Popover/Popover.js.map +1 -1
  53. package/dist/esm/components/Progress/Progress.js +15 -11
  54. package/dist/esm/components/Progress/Progress.js.map +1 -1
  55. package/dist/esm/components/Provider/Provider.js +18 -13
  56. package/dist/esm/components/Provider/Provider.js.map +1 -1
  57. package/dist/esm/components/RadioGroup/RadioGroup.js +57 -45
  58. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  59. package/dist/esm/components/SearchInput/SearchInput.js +11 -11
  60. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  61. package/dist/esm/components/Select/Select.js +31 -30
  62. package/dist/esm/components/Select/Select.js.map +1 -1
  63. package/dist/esm/components/Spinner/Spinner.js +19 -12
  64. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  65. package/dist/esm/components/Switch/Switch.js +10 -9
  66. package/dist/esm/components/Switch/Switch.js.map +1 -1
  67. package/dist/esm/components/Tabs/Tabs.js +27 -25
  68. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  69. package/dist/esm/components/Textarea/Textarea.js +9 -11
  70. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  71. package/dist/esm/components/Toast/Toaster.js +118 -88
  72. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  73. package/dist/esm/components/Tooltip/Tooltip.js +8 -7
  74. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  75. package/dist/esm/components/Tour/Tour.js +50 -44
  76. package/dist/esm/components/Tour/Tour.js.map +1 -1
  77. package/dist/esm/components/Treeview/Treeview.js +36 -26
  78. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  79. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
  80. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  81. package/dist/esm/index.js +0 -1
  82. package/dist/esm/index.js.map +1 -1
  83. package/dist/esm/utils/hooks/useProxiedRef.js +3 -3
  84. package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
  85. package/dist/index.d.ts +0 -1
  86. package/dist/taco.cjs.development.js +913 -724
  87. package/dist/taco.cjs.development.js.map +1 -1
  88. package/dist/taco.cjs.production.min.js +1 -1
  89. package/dist/taco.cjs.production.min.js.map +1 -1
  90. package/dist/utils/tailwind.d.ts +1 -1
  91. package/package.json +4 -5
  92. package/tailwind.config.js +0 -5
  93. package/types.json +5 -2
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.js","sources":["../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as ButtonPrimitive from '../../primitives/Button';\r\nimport { Icon, IconName } from '../Icon/Icon';\r\nimport { getAppearanceClasses, getButtonClasses, createButton } from '../Button/util';\r\nimport { Appearance } from '../../types';\r\nimport { DialogProps, HangerProps, MenuProps, PopoverProps } from '../..';\r\n\r\nexport type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {\r\n /** Appearance will change the style of the button */\r\n appearance?: Appearance;\r\n /**\r\n * Dialog component associated with the button, clicking the button will open the dialog.\r\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\r\n * the button should be only to open the associated dialog when clicked.\r\n */\r\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\r\n /** Hanger component associated with the button. */\r\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\r\n /** Set which icon should be rendered within button */\r\n icon: IconName; // this dynamic type causes the type extraction for props to fail\r\n /** Menu component associated with the button. */\r\n menu?: (props: Partial<MenuProps>) => JSX.Element;\r\n /**\r\n * Popover component associated with the button, clicking the button will open the popover.\r\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\r\n * the button should be only to open the associated popover when clicked.\r\n */\r\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\r\n /**\r\n * Set whether the button is rounded.\r\n * Default value is `false`\r\n */\r\n rounded?: boolean;\r\n /** A tooltip to show when hovering over the button */\r\n tooltip?: string;\r\n};\r\n\r\nexport const IconButton = React.forwardRef(function IconButton(props: IconButtonProps, ref: React.Ref<HTMLButtonElement>) {\r\n const { icon, rounded = false, ...otherProps } = props;\r\n\r\n const className = cn(\r\n 'w-8',\r\n getButtonClasses(),\r\n getAppearanceClasses(otherProps.appearance, true),\r\n {\r\n 'rounded-full': rounded,\r\n rounded: !rounded,\r\n 'cursor-not-allowed opacity-50': props.disabled,\r\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\r\n },\r\n props.className\r\n );\r\n\r\n if (!icon) {\r\n return null;\r\n }\r\n\r\n return createButton(\r\n { ...otherProps, children: <Icon name={icon} className=\"m-0 p-0\" />, 'data-taco': 'icon-button' },\r\n className,\r\n ref\r\n );\r\n});\r\n"],"names":["IconButton","React","props","ref","icon","rounded","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","disabled","createButton","children","Icon","name"],"mappings":";;;;;MAsCaA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;EACvC,MAAM;IAAEC,IAAF;IAAQC,OAAO,GAAG,KAAlB;IAAyB,GAAGC;MAAeJ,KAAjD;EAEA,MAAMK,SAAS,GAAGC,EAAE,CAChB,KADgB,EAEhBC,gBAAgB,EAFA,EAGhBC,oBAAoB,CAACJ,UAAU,CAACK,UAAZ,EAAwB,IAAxB,CAHJ,EAIhB;IACI,gBAAgBN,OADpB;IAEIA,OAAO,EAAE,CAACA,OAFd;IAGI,iCAAiCH,KAAK,CAACU,QAH3C;IAII,wCAAwC,CAACV,KAAK,CAACU;GARnC,EAUhBV,KAAK,CAACK,SAVU,CAApB;;EAaA,IAAI,CAACH,IAAL,EAAW;IACP,OAAO,IAAP;;;EAGJ,OAAOS,YAAY,CACf,EAAE,GAAGP,UAAL;IAAiBQ,QAAQ,EAAEb,aAAA,CAACc,IAAD;MAAMC,IAAI,EAAEZ;MAAMG,SAAS,EAAC;KAA5B,CAA3B;IAAqE,aAAa;GADnE,EAEfA,SAFe,EAGfJ,GAHe,CAAnB;AAKH,CAzByB;;;;"}
1
+ {"version":3,"file":"IconButton.js","sources":["../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as ButtonPrimitive from '../../primitives/Button';\r\nimport { Icon, IconName } from '../Icon/Icon';\r\nimport { getAppearanceClasses, getButtonClasses, createButton } from '../Button/util';\r\nimport { Appearance } from '../../types';\r\nimport { DialogProps, HangerProps, MenuProps, PopoverProps } from '../..';\r\n\r\nexport type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {\r\n /** Appearance will change the style of the button */\r\n appearance?: Appearance;\r\n /**\r\n * Dialog component associated with the button, clicking the button will open the dialog.\r\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\r\n * the button should be only to open the associated dialog when clicked.\r\n */\r\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\r\n /** Hanger component associated with the button. */\r\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\r\n /** Set which icon should be rendered within button */\r\n icon: IconName; // this dynamic type causes the type extraction for props to fail\r\n /** Menu component associated with the button. */\r\n menu?: (props: Partial<MenuProps>) => JSX.Element;\r\n /**\r\n * Popover component associated with the button, clicking the button will open the popover.\r\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\r\n * the button should be only to open the associated popover when clicked.\r\n */\r\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\r\n /**\r\n * Set whether the button is rounded.\r\n * Default value is `false`\r\n */\r\n rounded?: boolean;\r\n /** A tooltip to show when hovering over the button */\r\n tooltip?: string;\r\n};\r\n\r\nexport const IconButton = React.forwardRef(function IconButton(props: IconButtonProps, ref: React.Ref<HTMLButtonElement>) {\r\n const { icon, rounded = false, ...otherProps } = props;\r\n\r\n const className = cn(\r\n 'w-8',\r\n getButtonClasses(),\r\n getAppearanceClasses(otherProps.appearance, true),\r\n {\r\n 'rounded-full': rounded,\r\n rounded: !rounded,\r\n 'cursor-not-allowed opacity-50': props.disabled,\r\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\r\n },\r\n props.className\r\n );\r\n\r\n if (!icon) {\r\n return null;\r\n }\r\n\r\n return createButton(\r\n { ...otherProps, children: <Icon name={icon} className=\"m-0 p-0\" />, 'data-taco': 'icon-button' },\r\n className,\r\n ref\r\n );\r\n});\r\n"],"names":["IconButton","React","props","ref","icon","rounded","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","disabled","createButton","children","Icon","name"],"mappings":";;;;;;;IAsCaA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;EACvC,IAAQC,IAAR,GAAiDF,KAAjD,CAAQE,IAAR;uBAAiDF,KAAjD,CAAcG,OAAd;MAAcA,OAAd,+BAAwB,KAAxB;MAAkCC,UAAlC,iCAAiDJ,KAAjD;;EAEA,IAAMK,SAAS,GAAGC,EAAE,CAChB,KADgB,EAEhBC,gBAAgB,EAFA,EAGhBC,oBAAoB,CAACJ,UAAU,CAACK,UAAZ,EAAwB,IAAxB,CAHJ,EAIhB;IACI,gBAAgBN,OADpB;IAEIA,OAAO,EAAE,CAACA,OAFd;IAGI,iCAAiCH,KAAK,CAACU,QAH3C;IAII,wCAAwC,CAACV,KAAK,CAACU;GARnC,EAUhBV,KAAK,CAACK,SAVU,CAApB;;EAaA,IAAI,CAACH,IAAL,EAAW;IACP,OAAO,IAAP;;;EAGJ,OAAOS,YAAY,cACVP,UADU;IACEQ,QAAQ,EAAEb,aAAA,CAACc,IAAD;MAAMC,IAAI,EAAEZ;MAAMG,SAAS,EAAC;KAA5B,CADZ;IACsD,aAAa;MAClFA,SAFe,EAGfJ,GAHe,CAAnB;AAKH,CAzByB;;;;"}
@@ -1,25 +1,25 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { forwardRef, useEffect, createElement, cloneElement } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { Icon } from '../Icon/Icon.js';
4
5
  import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
5
6
  import { getInputClasses, getButtonStateClasses } from './util.js';
6
7
 
7
- const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
8
- const {
9
- button,
10
- icon,
11
- highlighted,
12
- invalid,
13
- onKeyDown,
14
- autoFocus,
15
- ...otherProps
16
- } = props;
17
- const inputRef = useProxiedRef(ref);
18
- const hasContainer = button || icon;
19
- const className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
8
+ var _excluded = ["button", "icon", "highlighted", "invalid", "onKeyDown", "autoFocus"];
9
+ var Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
10
+ var button = props.button,
11
+ icon = props.icon,
12
+ invalid = props.invalid,
13
+ onKeyDown = props.onKeyDown,
14
+ autoFocus = props.autoFocus,
15
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
16
+
17
+ var inputRef = useProxiedRef(ref);
18
+ var hasContainer = button || icon;
19
+ var className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
20
20
  'pr-8': !!hasContainer
21
21
  }, !hasContainer && otherProps.className);
22
- useEffect(() => {
22
+ useEffect(function () {
23
23
  if (autoFocus && inputRef.current) {
24
24
  inputRef.current.focus();
25
25
  }
@@ -27,10 +27,10 @@ const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
27
27
  // if it has scroll height then the browser reverts to native scrolling behaviour only
28
28
  // so we manually override it to ensure _our_ desired behaviour remains intact
29
29
 
30
- const handleKeyDown = event => {
30
+ var handleKeyDown = function handleKeyDown(event) {
31
31
  if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {
32
32
  event.preventDefault();
33
- const position = event.key === 'End' ? event.currentTarget.value.length : 0;
33
+ var position = event.key === 'End' ? event.currentTarget.value.length : 0;
34
34
  event.currentTarget.setSelectionRange(position, position);
35
35
  }
36
36
 
@@ -39,7 +39,7 @@ const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
39
39
  }
40
40
  };
41
41
 
42
- const input = createElement("input", Object.assign({}, otherProps, {
42
+ var input = createElement("input", Object.assign({}, otherProps, {
43
43
  className: className,
44
44
  "data-taco": "input",
45
45
  onKeyDown: handleKeyDown,
@@ -47,19 +47,19 @@ const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
47
47
  }));
48
48
 
49
49
  if (hasContainer) {
50
- let extra;
50
+ var extra;
51
51
 
52
52
  if (button) {
53
- const disabled = button.props.disabled || otherProps.disabled;
54
- const buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', {
55
- [getButtonStateClasses(invalid)]: !props.disabled
56
- }, button.props.className);
53
+ var _cn;
54
+
55
+ var disabled = button.props.disabled || otherProps.disabled;
56
+ var buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', (_cn = {}, _cn[getButtonStateClasses(invalid)] = !props.disabled, _cn), button.props.className);
57
57
  extra = cloneElement(button, {
58
58
  className: buttonClassName,
59
- disabled
59
+ disabled: disabled
60
60
  });
61
61
  } else if (icon) {
62
- const iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
62
+ var iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
63
63
  'text-grey-dark': props.disabled,
64
64
  'text-grey-darkest': !props.disabled
65
65
  });
@@ -71,7 +71,7 @@ const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
71
71
  });
72
72
  }
73
73
 
74
- const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
74
+ var containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
75
75
  return createElement("div", {
76
76
  className: containerClassName,
77
77
  "data-taco": "input-container"
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { Icon, IconName } from '../Icon/Icon';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\nimport { getButtonStateClasses, getInputClasses } from './util';\r\n\r\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\r\n /** Shows a button within the input field */\r\n button?: React.ReactElement;\r\n /** Shows an icon within the input field */\r\n icon?: IconName | JSX.Element;\r\n /** Draws attention to the input by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n};\r\n\r\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\r\n const { button, icon, highlighted, invalid, onKeyDown, autoFocus, ...otherProps } = props;\r\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\r\n const hasContainer = button || icon;\r\n const className = cn(\r\n getInputClasses(props),\r\n 'min-h-[theme(spacing.8)] pointer-events-all',\r\n {\r\n 'pr-8': !!hasContainer,\r\n },\r\n !hasContainer && otherProps.className\r\n );\r\n\r\n React.useEffect(() => {\r\n if (autoFocus && inputRef.current) {\r\n inputRef.current.focus();\r\n }\r\n }, []);\r\n\r\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\r\n // if it has scroll height then the browser reverts to native scrolling behaviour only\r\n // so we manually override it to ensure _our_ desired behaviour remains intact\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {\r\n event.preventDefault();\r\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\r\n event.currentTarget.setSelectionRange(position, position);\r\n }\r\n\r\n if (onKeyDown) {\r\n onKeyDown(event);\r\n }\r\n };\r\n\r\n const input = <input {...otherProps} className={className} data-taco=\"input\" onKeyDown={handleKeyDown} ref={inputRef} />;\r\n\r\n if (hasContainer) {\r\n let extra: any;\r\n\r\n if (button) {\r\n const disabled = button.props.disabled || otherProps.disabled;\r\n const buttonClassName = cn(\r\n 'items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none',\r\n {\r\n [getButtonStateClasses(invalid)]: !props.disabled,\r\n },\r\n button.props.className\r\n );\r\n extra = React.cloneElement(button, {\r\n className: buttonClassName,\r\n disabled,\r\n });\r\n } else if (icon) {\r\n const iconClassName = cn(\r\n 'items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2',\r\n {\r\n 'text-grey-dark': props.disabled,\r\n 'text-grey-darkest': !props.disabled,\r\n }\r\n );\r\n extra =\r\n typeof icon === 'string' ? (\r\n <Icon className={iconClassName} name={icon} />\r\n ) : (\r\n React.cloneElement(icon, { className: cn(iconClassName, icon.props.className) })\r\n );\r\n }\r\n\r\n const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);\r\n\r\n return (\r\n <div className={containerClassName} data-taco=\"input-container\">\r\n {input}\r\n {extra}\r\n </div>\r\n );\r\n }\r\n\r\n return input;\r\n});\r\n"],"names":["Input","React","props","ref","button","icon","highlighted","invalid","onKeyDown","autoFocus","otherProps","inputRef","useProxiedRef","hasContainer","className","cn","getInputClasses","current","focus","handleKeyDown","event","shiftKey","key","preventDefault","position","currentTarget","value","length","setSelectionRange","input","extra","disabled","buttonClassName","getButtonStateClasses","iconClassName","Icon","name","containerClassName"],"mappings":";;;;;;MAiBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;EAClC,MAAM;IAAEC,MAAF;IAAUC,IAAV;IAAgBC,WAAhB;IAA6BC,OAA7B;IAAsCC,SAAtC;IAAiDC,SAAjD;IAA4D,GAAGC;MAAeR,KAApF;EACA,MAAMS,QAAQ,GAAGC,aAAa,CAAmBT,GAAnB,CAA9B;EACA,MAAMU,YAAY,GAAGT,MAAM,IAAIC,IAA/B;EACA,MAAMS,SAAS,GAAGC,EAAE,CAChBC,eAAe,CAACd,KAAD,CADC,EAEhB,6CAFgB,EAGhB;IACI,QAAQ,CAAC,CAACW;GAJE,EAMhB,CAACA,YAAD,IAAiBH,UAAU,CAACI,SANZ,CAApB;EASAb,SAAA,CAAgB;IACZ,IAAIQ,SAAS,IAAIE,QAAQ,CAACM,OAA1B,EAAmC;MAC/BN,QAAQ,CAACM,OAAT,CAAiBC,KAAjB;;GAFR,EAIG,EAJH;;;;EASA,MAAMC,aAAa,GAAIC,KAAD;IAClB,IAAI,CAACA,KAAK,CAACC,QAAP,KAAoBD,KAAK,CAACE,GAAN,KAAc,MAAd,IAAwBF,KAAK,CAACE,GAAN,KAAc,KAA1D,CAAJ,EAAsE;MAClEF,KAAK,CAACG,cAAN;MACA,MAAMC,QAAQ,GAAGJ,KAAK,CAACE,GAAN,KAAc,KAAd,GAAsBF,KAAK,CAACK,aAAN,CAAoBC,KAApB,CA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8CAAD,EAAiDL,UAAU,CAACI,SAA5D,CAA7B;IAEA,OACIb,aAAA,MAAA;MAAKa,SAAS,EAAEuB;mBAA8B;KAA9C,EACKR,KADL,EAEKC,KAFL,CADJ;;;EAQJ,OAAOD,KAAP;AACH,CA/EoB;;;;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { Icon, IconName } from '../Icon/Icon';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\nimport { getButtonStateClasses, getInputClasses } from './util';\r\n\r\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\r\n /** Shows a button within the input field */\r\n button?: React.ReactElement;\r\n /** Shows an icon within the input field */\r\n icon?: IconName | JSX.Element;\r\n /** Draws attention to the input by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n};\r\n\r\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\r\n const { button, icon, highlighted, invalid, onKeyDown, autoFocus, ...otherProps } = props;\r\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\r\n const hasContainer = button || icon;\r\n const className = cn(\r\n getInputClasses(props),\r\n 'min-h-[theme(spacing.8)] pointer-events-all',\r\n {\r\n 'pr-8': !!hasContainer,\r\n },\r\n !hasContainer && otherProps.className\r\n );\r\n\r\n React.useEffect(() => {\r\n if (autoFocus && inputRef.current) {\r\n inputRef.current.focus();\r\n }\r\n }, []);\r\n\r\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\r\n // if it has scroll height then the browser reverts to native scrolling behaviour only\r\n // so we manually override it to ensure _our_ desired behaviour remains intact\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {\r\n event.preventDefault();\r\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\r\n event.currentTarget.setSelectionRange(position, position);\r\n }\r\n\r\n if (onKeyDown) {\r\n onKeyDown(event);\r\n }\r\n };\r\n\r\n const input = <input {...otherProps} className={className} data-taco=\"input\" onKeyDown={handleKeyDown} ref={inputRef} />;\r\n\r\n if (hasContainer) {\r\n let extra: any;\r\n\r\n if (button) {\r\n const disabled = button.props.disabled || otherProps.disabled;\r\n const buttonClassName = cn(\r\n 'items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none',\r\n {\r\n [getButtonStateClasses(invalid)]: !props.disabled,\r\n },\r\n button.props.className\r\n );\r\n extra = React.cloneElement(button, {\r\n className: buttonClassName,\r\n disabled,\r\n });\r\n } else if (icon) {\r\n const iconClassName = cn(\r\n 'items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2',\r\n {\r\n 'text-grey-dark': props.disabled,\r\n 'text-grey-darkest': !props.disabled,\r\n }\r\n );\r\n extra =\r\n typeof icon === 'string' ? (\r\n <Icon className={iconClassName} name={icon} />\r\n ) : (\r\n React.cloneElement(icon, { className: cn(iconClassName, icon.props.className) })\r\n );\r\n }\r\n\r\n const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);\r\n\r\n return (\r\n <div className={containerClassName} data-taco=\"input-container\">\r\n {input}\r\n {extra}\r\n </div>\r\n );\r\n }\r\n\r\n return input;\r\n});\r\n"],"names":["Input","React","props","ref","button","icon","invalid","onKeyDown","autoFocus","otherProps","inputRef","useProxiedRef","hasContainer","className","cn","getInputClasses","current","focus","handleKeyDown","event","shiftKey","key","preventDefault","position","currentTarget","value","length","setSelectionRange","input","extra","disabled","buttonClassName","getButtonStateClasses","iconClassName","Icon","name","containerClassName"],"mappings":";;;;;;;;IAiBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;MAC1BC,MAAR,GAAoFF,KAApF,CAAQE,MAAR;MAAgBC,IAAhB,GAAoFH,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AkB;IACd,IAAIiB,KAAJ;;IAEA,IAAIzB,MAAJ,EAAY;MAAA;;MACR,IAAM0B,QAAQ,GAAG1B,MAAM,CAACF,KAAP,CAAa4B,QAAb,IAAyBrB,UAAU,CAACqB,QAArD;MACA,IAAMC,eAAe,GAAGjB,EAAE,CACtB,2HADsB,iBAGjBkB,qBAAqB,CAAC1B,OAAD,CAHJ,IAGgB,CAACJ,KAAK,CAAC4B,QAHvB,QAKtB1B,MAAM,CAACF,KAAP,CAAaW,SALS,CAA1B;MAOAgB,KAAK,GAAG5B,YAAA,CAAmBG,MAAnB,EAA2B;QAC/BS,SAAS,EAAEkB,eADoB;QAE/BD,QAAQ,EAARA;OAFI,CAAR;KATJ,MAaO,IAAIzB,IAAJ,EAAU;MACb,IAAM4B,aAAa,GAAGnB,EAAE,CACpB,8GADoB,EAEpB;QACI,kBAAkBZ,KAAK,CAAC4B,QAD5B;QAEI,qBAAqB,CAAC5B,KAAK,CAAC4B;OAJZ,CAAxB;MAOAD,KAAK,GACD,OAAOxB,IAAP,KAAgB,QAAhB,GACIJ,aAAA,CAACiC,IAAD;QAAMrB,SAAS,EAAEoB;QAAeE,IAAI,EAAE9B;OAAtC,CADJ,GAGIJ,YAAA,CAAmBI,IAAnB,EAAyB;QAAEQ,SAAS,EAAEC,EAAE,CAACmB,aAAD,EAAgB5B,IAAI,CAACH,KAAL,CAAWW,SAA3B;OAAxC,CAJR;;;IAQJ,IAAMuB,kBAAkB,GAAGtB,EAAE,CAAC,8CAAD,EAAiDL,UAAU,CAACI,SAA5D,CAA7B;IAEA,OACIZ,aAAA,MAAA;MAAKY,SAAS,EAAEuB;mBAA8B;KAA9C,EACKR,KADL,EAEKC,KAFL,CADJ;;;EAQJ,OAAOD,KAAP;AACH,CA/EoB;;;;"}
@@ -1,52 +1,53 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { forwardRef, createElement } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { ScrollableList } from './ScrollableList.js';
4
5
  import { useListbox } from './useListbox.js';
5
6
  import { useMultiListbox } from './useMultiListbox.js';
6
7
 
7
- const Listbox = /*#__PURE__*/forwardRef(function Listbox(props, ref) {
8
- const {
9
- className: externalClassName,
10
- ...otherProps
11
- } = props;
12
- const {
13
- list,
14
- input
15
- } = useListbox(otherProps, ref);
16
- const className = cn('bg-white inline-flex relative w-full', externalClassName);
8
+ var _excluded = ["className"],
9
+ _excluded2 = ["className"];
10
+ var Listbox = /*#__PURE__*/forwardRef(function Listbox(props, ref) {
11
+ var externalClassName = props.className,
12
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
13
+
14
+ var _useListbox = useListbox(otherProps, ref),
15
+ list = _useListbox.list,
16
+ input = _useListbox.input;
17
+
18
+ var className = cn('bg-white inline-flex relative w-full', externalClassName);
17
19
  return createElement("span", {
18
20
  "data-taco": "listbox",
19
21
  className: className
20
22
  }, createElement(ScrollableList, Object.assign({}, list, {
21
- style: { ...list.style,
23
+ style: _extends({}, list.style, {
22
24
  maxHeight: 'calc(12rem + 2px)'
23
25
  /* (6 * option height) + listbox border */
24
26
 
25
- }
27
+ })
26
28
  })), createElement("input", Object.assign({}, input, {
27
29
  className: "hidden",
28
30
  type: "text"
29
31
  })));
30
32
  });
31
- const MultiListbox = /*#__PURE__*/forwardRef(function Listbox(props, ref) {
32
- const {
33
- className: externalClassName,
34
- ...otherProps
35
- } = props;
36
- const {
37
- list,
38
- input
39
- } = useMultiListbox(otherProps, ref);
40
- const className = cn('bg-white inline-flex relative w-full', externalClassName);
33
+ var MultiListbox = /*#__PURE__*/forwardRef(function Listbox(props, ref) {
34
+ var externalClassName = props.className,
35
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
36
+
37
+ var _useMultiListbox = useMultiListbox(otherProps, ref),
38
+ list = _useMultiListbox.list,
39
+ input = _useMultiListbox.input;
40
+
41
+ var className = cn('bg-white inline-flex relative w-full', externalClassName);
41
42
  return createElement("span", {
42
43
  "data-taco": "listbox",
43
44
  className: className
44
45
  }, createElement(ScrollableList, Object.assign({}, list, {
45
- style: { ...list.style,
46
+ style: _extends({}, list.style, {
46
47
  maxHeight: 'calc(12rem + 2px + 2px)'
47
48
  /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
48
49
 
49
- }
50
+ })
50
51
  })), createElement("input", Object.assign({}, input, {
51
52
  className: "hidden",
52
53
  type: "text"
@@ -1 +1 @@
1
- {"version":3,"file":"Listbox.js","sources":["../../../../src/components/Listbox/Listbox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { useListbox } from './useListbox';\r\nimport { useMultiListbox } from './useMultiListbox';\r\nimport { ScrollableList, ScrollableListItemValue, ScrollableListItem } from './ScrollableList';\r\n\r\nexport type ListboxItem = ScrollableListItem;\r\nexport type ListboxValue = ScrollableListItemValue;\r\n\r\nexport type ListboxTexts = {\r\n /**\r\n * Text displayed in the listbox if no data provided.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n empty: string;\r\n /**\r\n * Text displayed in the listbox to indicate the data is loading.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n loading: string;\r\n /**\r\n * The first option displayed in a multiselect listbox that selects all available options.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n allOption: string;\r\n};\r\n\r\nexport type ListboxProps = Pick<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onFocus'> &\r\n Omit<React.InputHTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange' | 'value'> & {\r\n /** Data indicating the options in listbox */\r\n data?: ListboxItem[];\r\n /**\r\n * Initial value of the listbox.\r\n * This is used when listbox is mounted, if no value is provided.\r\n * *Note* that listbox is a controlled component, setting this will also trigger the `onChange` event\r\n */\r\n defaultValue?: ListboxValue;\r\n /** Set what value should have an empty option in listbox */\r\n emptyValue?: ListboxValue;\r\n /** Draws attention to the listbox by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n /**\r\n * Shows a loading indicator with a text next to it.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n loading?: boolean;\r\n /**\r\n * Value of the listbox representing the selected item.\r\n * It needs to be an existing value from the provided data\r\n */\r\n value?: ListboxValue;\r\n };\r\n\r\nexport const Listbox = React.forwardRef(function Listbox(props: ListboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, ...otherProps } = props;\r\n const { list, input } = useListbox(otherProps, ref);\r\n const className = cn('bg-white inline-flex relative w-full', externalClassName);\r\n\r\n return (\r\n <span data-taco=\"listbox\" className={className}>\r\n <ScrollableList\r\n {...list}\r\n style={{ ...list.style, maxHeight: 'calc(12rem + 2px)' /* (6 * option height) + listbox border */ }}\r\n />\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </span>\r\n );\r\n});\r\n\r\nexport const MultiListbox = React.forwardRef(function Listbox(props: ListboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, ...otherProps } = props;\r\n const { list, input } = useMultiListbox(otherProps, ref);\r\n const className = cn('bg-white inline-flex relative w-full', externalClassName);\r\n\r\n return (\r\n <span data-taco=\"listbox\" className={className}>\r\n <ScrollableList\r\n {...list}\r\n style={{\r\n ...list.style,\r\n maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */,\r\n }}\r\n />\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </span>\r\n );\r\n});\r\n"],"names":["Listbox","React","props","ref","className","externalClassName","otherProps","list","input","useListbox","cn","ScrollableList","style","maxHeight","type","MultiListbox","useMultiListbox"],"mappings":";;;;;;MAuDaA,OAAO,gBAAGC,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACpC,MAAM;IAAEC,SAAS,EAAEC,iBAAb;IAAgC,GAAGC;MAAeJ,KAAxD;EACA,MAAM;IAAEK,IAAF;IAAQC;MAAUC,UAAU,CAACH,UAAD,EAAaH,GAAb,CAAlC;EACA,MAAMC,SAAS,GAAGM,EAAE,CAAC,sCAAD,EAAyCL,iBAAzC,CAApB;EAEA,OACIJ,aAAA,OAAA;iBAAgB;IAAUG,SAAS,EAAEA;GAArC,EACIH,aAAA,CAACU,cAAD,oBACQJ;IACJK,KAAK,EAAE,EAAE,GAAGL,IAAI,CAACK,KAAV;MAAiBC,SAAS,EAAE;;;;IAFvC,CADJ,EAKIZ,aAAA,QAAA,oBAAWO;IAAOJ,SAAS,EAAC;IAASU,IAAI,EAAC;IAA1C,CALJ,CADJ;AASH,CAdsB;MAgBVC,YAAY,gBAAGd,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACzC,MAAM;IAAEC,SAAS,EAAEC,iBAAb;IAAgC,GAAGC;MAAeJ,KAAxD;EACA,MAAM;IAAEK,IAAF;IAAQC;MAAUQ,eAAe,CAACV,UAAD,EAAaH,GAAb,CAAvC;EACA,MAAMC,SAAS,GAAGM,EAAE,CAAC,sCAAD,EAAyCL,iBAAzC,CAApB;EAEA,OACIJ,aAAA,OAAA;iBAAgB;IAAUG,SAAS,EAAEA;GAArC,EACIH,aAAA,CAACU,cAAD,oBACQJ;IACJK,KAAK,EAAE,EACH,GAAGL,IAAI,CAACK,KADL;MAEHC,SAAS,EAAE;;;;IAJnB,CADJ,EAQIZ,aAAA,QAAA,oBAAWO;IAAOJ,SAAS,EAAC;IAASU,IAAI,EAAC;IAA1C,CARJ,CADJ;AAYH,CAjB2B;;;;"}
1
+ {"version":3,"file":"Listbox.js","sources":["../../../../src/components/Listbox/Listbox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { useListbox } from './useListbox';\r\nimport { useMultiListbox } from './useMultiListbox';\r\nimport { ScrollableList, ScrollableListItemValue, ScrollableListItem } from './ScrollableList';\r\n\r\nexport type ListboxItem = ScrollableListItem;\r\nexport type ListboxValue = ScrollableListItemValue;\r\n\r\nexport type ListboxTexts = {\r\n /**\r\n * Text displayed in the listbox if no data provided.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n empty: string;\r\n /**\r\n * Text displayed in the listbox to indicate the data is loading.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n loading: string;\r\n /**\r\n * The first option displayed in a multiselect listbox that selects all available options.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n allOption: string;\r\n};\r\n\r\nexport type ListboxProps = Pick<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onFocus'> &\r\n Omit<React.InputHTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange' | 'value'> & {\r\n /** Data indicating the options in listbox */\r\n data?: ListboxItem[];\r\n /**\r\n * Initial value of the listbox.\r\n * This is used when listbox is mounted, if no value is provided.\r\n * *Note* that listbox is a controlled component, setting this will also trigger the `onChange` event\r\n */\r\n defaultValue?: ListboxValue;\r\n /** Set what value should have an empty option in listbox */\r\n emptyValue?: ListboxValue;\r\n /** Draws attention to the listbox by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n /**\r\n * Shows a loading indicator with a text next to it.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n loading?: boolean;\r\n /**\r\n * Value of the listbox representing the selected item.\r\n * It needs to be an existing value from the provided data\r\n */\r\n value?: ListboxValue;\r\n };\r\n\r\nexport const Listbox = React.forwardRef(function Listbox(props: ListboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, ...otherProps } = props;\r\n const { list, input } = useListbox(otherProps, ref);\r\n const className = cn('bg-white inline-flex relative w-full', externalClassName);\r\n\r\n return (\r\n <span data-taco=\"listbox\" className={className}>\r\n <ScrollableList\r\n {...list}\r\n style={{ ...list.style, maxHeight: 'calc(12rem + 2px)' /* (6 * option height) + listbox border */ }}\r\n />\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </span>\r\n );\r\n});\r\n\r\nexport const MultiListbox = React.forwardRef(function Listbox(props: ListboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, ...otherProps } = props;\r\n const { list, input } = useMultiListbox(otherProps, ref);\r\n const className = cn('bg-white inline-flex relative w-full', externalClassName);\r\n\r\n return (\r\n <span data-taco=\"listbox\" className={className}>\r\n <ScrollableList\r\n {...list}\r\n style={{\r\n ...list.style,\r\n maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */,\r\n }}\r\n />\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </span>\r\n );\r\n});\r\n"],"names":["Listbox","React","props","ref","externalClassName","className","otherProps","useListbox","list","input","cn","ScrollableList","style","maxHeight","type","MultiListbox","useMultiListbox"],"mappings":";;;;;;;;;IAuDaA,OAAO,gBAAGC,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACpC,IAAmBC,iBAAnB,GAAwDF,KAAxD,CAAQG,SAAR;MAAyCC,UAAzC,iCAAwDJ,KAAxD;;EACA,kBAAwBK,UAAU,CAACD,UAAD,EAAaH,GAAb,CAAlC;MAAQK,IAAR,eAAQA,IAAR;MAAcC,KAAd,eAAcA,KAAd;;EACA,IAAMJ,SAAS,GAAGK,EAAE,CAAC,sCAAD,EAAyCN,iBAAzC,CAApB;EAEA,OACIH,aAAA,OAAA;iBAAgB;IAAUI,SAAS,EAAEA;GAArC,EACIJ,aAAA,CAACU,cAAD,oBACQH;IACJI,KAAK,eAAOJ,IAAI,CAACI,KAAZ;MAAmBC,SAAS,EAAE;;;;IAFvC,CADJ,EAKIZ,aAAA,QAAA,oBAAWQ;IAAOJ,SAAS,EAAC;IAASS,IAAI,EAAC;IAA1C,CALJ,CADJ;AASH,CAdsB;IAgBVC,YAAY,gBAAGd,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACzC,IAAmBC,iBAAnB,GAAwDF,KAAxD,CAAQG,SAAR;MAAyCC,UAAzC,iCAAwDJ,KAAxD;;EACA,uBAAwBc,eAAe,CAACV,UAAD,EAAaH,GAAb,CAAvC;MAAQK,IAAR,oBAAQA,IAAR;MAAcC,KAAd,oBAAcA,KAAd;;EACA,IAAMJ,SAAS,GAAGK,EAAE,CAAC,sCAAD,EAAyCN,iBAAzC,CAApB;EAEA,OACIH,aAAA,OAAA;iBAAgB;IAAUI,SAAS,EAAEA;GAArC,EACIJ,aAAA,CAACU,cAAD,oBACQH;IACJI,KAAK,eACEJ,IAAI,CAACI,KADP;MAEDC,SAAS,EAAE;;;;IAJnB,CADJ,EAQIZ,aAAA,QAAA,oBAAWQ;IAAOJ,SAAS,EAAC;IAASS,IAAI,EAAC;IAA1C,CARJ,CADJ;AAYH,CAjB2B;;;;"}
@@ -1,3 +1,4 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { useState, useMemo, createElement } from 'react';
2
3
  import { MenuContext } from './Context.js';
3
4
  import { Root } from '@radix-ui/react-dropdown-menu';
@@ -10,22 +11,39 @@ import { RadioGroup } from './components/RadioGroup.js';
10
11
  import { Separator } from './components/Separator.js';
11
12
  import { Header } from './components/Header.js';
12
13
 
13
- const Menu = externalProps => {
14
- const {
15
- children,
16
- trigger,
17
- ...props
18
- } = externalProps;
19
- const [open, setOpen] = useState(false);
20
- const [indented, setIndented] = useState(false);
21
- const [minWidth, setMinWidth] = useState(undefined);
22
- const context = useMemo(() => ({
23
- indented,
24
- registerIndentation: () => setIndented(true),
25
- minWidth,
26
- setMinWidth: width => setMinWidth(width),
27
- close: () => setOpen(false)
28
- }), [indented, minWidth]);
14
+ var _excluded = ["children", "trigger"];
15
+ var Menu = function Menu(externalProps) {
16
+ var children = externalProps.children,
17
+ trigger = externalProps.trigger,
18
+ props = _objectWithoutPropertiesLoose(externalProps, _excluded);
19
+
20
+ var _React$useState = useState(false),
21
+ open = _React$useState[0],
22
+ setOpen = _React$useState[1];
23
+
24
+ var _React$useState2 = useState(false),
25
+ indented = _React$useState2[0],
26
+ setIndented = _React$useState2[1];
27
+
28
+ var _React$useState3 = useState(undefined),
29
+ minWidth = _React$useState3[0],
30
+ _setMinWidth = _React$useState3[1];
31
+
32
+ var context = useMemo(function () {
33
+ return {
34
+ indented: indented,
35
+ registerIndentation: function registerIndentation() {
36
+ return setIndented(true);
37
+ },
38
+ minWidth: minWidth,
39
+ setMinWidth: function setMinWidth(width) {
40
+ return _setMinWidth(width);
41
+ },
42
+ close: function close() {
43
+ return setOpen(false);
44
+ }
45
+ };
46
+ }, [indented, minWidth]);
29
47
  return createElement(MenuContext.Provider, {
30
48
  value: context
31
49
  }, createElement(Root, Object.assign({}, props, {
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sources":["../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport { MenuContext } from './Context';\r\nimport { Content } from './components/Content';\r\nimport { Item } from './components/Item';\r\nimport { Link } from './components/Link';\r\nimport { Trigger } from './components/Trigger';\r\nimport { Checkbox } from './components/Checkbox';\r\nimport { RadioGroup } from './components/RadioGroup';\r\nimport { Separator } from './components/Separator';\r\nimport { Header } from './components/Header';\r\n\r\nexport type MenuProps = {\r\n children: React.ReactNode;\r\n id?: string;\r\n /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n};\r\n\r\nexport const Menu = (externalProps: MenuProps): JSX.Element => {\r\n const { children, trigger, ...props } = externalProps;\r\n const [open, setOpen] = React.useState(false);\r\n const [indented, setIndented] = React.useState(false);\r\n const [minWidth, setMinWidth] = React.useState<number | undefined>(undefined);\r\n\r\n const context = React.useMemo(\r\n () => ({\r\n indented,\r\n registerIndentation: () => setIndented(true),\r\n minWidth,\r\n setMinWidth: (width: number) => setMinWidth(width),\r\n close: () => setOpen(false),\r\n }),\r\n [indented, minWidth]\r\n );\r\n\r\n return (\r\n <MenuContext.Provider value={context}>\r\n <DropdownMenuPrimitive.Root {...props} modal={false} open={open} onOpenChange={setOpen}>\r\n {trigger && <Trigger>{trigger}</Trigger>}\r\n {children}\r\n </DropdownMenuPrimitive.Root>\r\n </MenuContext.Provider>\r\n );\r\n};\r\nMenu.Trigger = Trigger;\r\nMenu.Content = Content;\r\nMenu.Item = Item;\r\nMenu.Link = Link;\r\nMenu.Checkbox = Checkbox;\r\nMenu.Separator = Separator;\r\nMenu.Header = Header;\r\nMenu.RadioGroup = RadioGroup;\r\n"],"names":["Menu","externalProps","children","trigger","props","open","setOpen","React","indented","setIndented","minWidth","setMinWidth","undefined","context","registerIndentation","width","close","MenuContext","Provider","value","DropdownMenuPrimitive","modal","onOpenChange","Trigger","Content","Item","Link","Checkbox","Separator","Header","RadioGroup"],"mappings":";;;;;;;;;;;;MAmBaA,IAAI,GAAIC,aAAD;EAChB,MAAM;IAAEC,QAAF;IAAYC,OAAZ;IAAqB,GAAGC;MAAUH,aAAxC;EACA,MAAM,CAACI,IAAD,EAAOC,OAAP,IAAkBC,QAAA,CAAe,KAAf,CAAxB;EACA,MAAM,CAACC,QAAD,EAAWC,WAAX,IAA0BF,QAAA,CAAe,KAAf,CAAhC;EACA,MAAM,CAACG,QAAD,EAAWC,WAAX,IAA0BJ,QAAA,CAAmCK,SAAnC,CAAhC;EAEA,MAAMC,OAAO,GAAGN,OAAA,CACZ,OAAO;IACHC,QADG;IAEHM,mBAAmB,EAAE,MAAML,WAAW,CAAC,IAAD,CAFnC;IAGHC,QAHG;IAIHC,WAAW,EAAGI,KAAD,IAAmBJ,WAAW,CAACI,KAAD,CAJxC;IAKHC,KAAK,EAAE,MAAMV,OAAO,CAAC,KAAD;GALxB,CADY,EAQZ,CAACE,QAAD,EAAWE,QAAX,CARY,CAAhB;EAWA,OACIH,aAAA,CAACU,WAAW,CAACC,QAAb;IAAsBC,KAAK,EAAEN;GAA7B,EACIN,aAAA,CAACa,IAAD,oBAAgChB;IAAOiB,KAAK,EAAE;IAAOhB,IAAI,EAAEA;IAAMiB,YAAY,EAAEhB;IAA/E,EACKH,OAAO,IAAII,aAAA,CAACgB,OAAD,MAAA,EAAUpB,OAAV,CADhB,EAEKD,QAFL,CADJ,CADJ;AAQH;AACDF,IAAI,CAACuB,OAAL,GAAeA,OAAf;AACAvB,IAAI,CAACwB,OAAL,GAAeA,OAAf;AACAxB,IAAI,CAACyB,IAAL,GAAYA,IAAZ;AACAzB,IAAI,CAAC0B,IAAL,GAAYA,IAAZ;AACA1B,IAAI,CAAC2B,QAAL,GAAgBA,QAAhB;AACA3B,IAAI,CAAC4B,SAAL,GAAiBA,SAAjB;AACA5B,IAAI,CAAC6B,MAAL,GAAcA,MAAd;AACA7B,IAAI,CAAC8B,UAAL,GAAkBA,UAAlB;;;;"}
1
+ {"version":3,"file":"Menu.js","sources":["../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport { MenuContext } from './Context';\r\nimport { Content } from './components/Content';\r\nimport { Item } from './components/Item';\r\nimport { Link } from './components/Link';\r\nimport { Trigger } from './components/Trigger';\r\nimport { Checkbox } from './components/Checkbox';\r\nimport { RadioGroup } from './components/RadioGroup';\r\nimport { Separator } from './components/Separator';\r\nimport { Header } from './components/Header';\r\n\r\nexport type MenuProps = {\r\n children: React.ReactNode;\r\n id?: string;\r\n /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n};\r\n\r\nexport const Menu = (externalProps: MenuProps): JSX.Element => {\r\n const { children, trigger, ...props } = externalProps;\r\n const [open, setOpen] = React.useState(false);\r\n const [indented, setIndented] = React.useState(false);\r\n const [minWidth, setMinWidth] = React.useState<number | undefined>(undefined);\r\n\r\n const context = React.useMemo(\r\n () => ({\r\n indented,\r\n registerIndentation: () => setIndented(true),\r\n minWidth,\r\n setMinWidth: (width: number) => setMinWidth(width),\r\n close: () => setOpen(false),\r\n }),\r\n [indented, minWidth]\r\n );\r\n\r\n return (\r\n <MenuContext.Provider value={context}>\r\n <DropdownMenuPrimitive.Root {...props} modal={false} open={open} onOpenChange={setOpen}>\r\n {trigger && <Trigger>{trigger}</Trigger>}\r\n {children}\r\n </DropdownMenuPrimitive.Root>\r\n </MenuContext.Provider>\r\n );\r\n};\r\nMenu.Trigger = Trigger;\r\nMenu.Content = Content;\r\nMenu.Item = Item;\r\nMenu.Link = Link;\r\nMenu.Checkbox = Checkbox;\r\nMenu.Separator = Separator;\r\nMenu.Header = Header;\r\nMenu.RadioGroup = RadioGroup;\r\n"],"names":["Menu","externalProps","children","trigger","props","React","open","setOpen","indented","setIndented","undefined","minWidth","setMinWidth","context","registerIndentation","width","close","MenuContext","Provider","value","DropdownMenuPrimitive","modal","onOpenChange","Trigger","Content","Item","Link","Checkbox","Separator","Header","RadioGroup"],"mappings":";;;;;;;;;;;;;;IAmBaA,IAAI,GAAG,SAAPA,IAAO,CAACC,aAAD;EAChB,IAAQC,QAAR,GAAwCD,aAAxC,CAAQC,QAAR;MAAkBC,OAAlB,GAAwCF,aAAxC,CAAkBE,OAAlB;MAA8BC,KAA9B,iCAAwCH,aAAxC;;EACA,sBAAwBI,QAAA,CAAe,KAAf,CAAxB;MAAOC,IAAP;MAAaC,OAAb;;EACA,uBAAgCF,QAAA,CAAe,KAAf,CAAhC;MAAOG,QAAP;MAAiBC,WAAjB;;EACA,uBAAgCJ,QAAA,CAAmCK,SAAnC,CAAhC;MAAOC,QAAP;MAAiBC,YAAjB;;EAEA,IAAMC,OAAO,GAAGR,OAAA,CACZ;IAAA,OAAO;MACHG,QAAQ,EAARA,QADG;MAEHM,mBAAmB,EAAE;QAAA,OAAML,WAAW,CAAC,IAAD,CAAjB;OAFlB;MAGHE,QAAQ,EAARA,QAHG;MAIHC,WAAW,EAAE,qBAACG,KAAD;QAAA,OAAmBH,YAAW,CAACG,KAAD,CAA9B;OAJV;MAKHC,KAAK,EAAE;QAAA,OAAMT,OAAO,CAAC,KAAD,CAAb;;KALX;GADY,EAQZ,CAACC,QAAD,EAAWG,QAAX,CARY,CAAhB;EAWA,OACIN,aAAA,CAACY,WAAW,CAACC,QAAb;IAAsBC,KAAK,EAAEN;GAA7B,EACIR,aAAA,CAACe,IAAD,oBAAgChB;IAAOiB,KAAK,EAAE;IAAOf,IAAI,EAAEA;IAAMgB,YAAY,EAAEf;IAA/E,EACKJ,OAAO,IAAIE,aAAA,CAACkB,OAAD,MAAA,EAAUpB,OAAV,CADhB,EAEKD,QAFL,CADJ,CADJ;AAQH;AACDF,IAAI,CAACuB,OAAL,GAAeA,OAAf;AACAvB,IAAI,CAACwB,OAAL,GAAeA,OAAf;AACAxB,IAAI,CAACyB,IAAL,GAAYA,IAAZ;AACAzB,IAAI,CAAC0B,IAAL,GAAYA,IAAZ;AACA1B,IAAI,CAAC2B,QAAL,GAAgBA,QAAhB;AACA3B,IAAI,CAAC4B,SAAL,GAAiBA,SAAjB;AACA5B,IAAI,CAAC6B,MAAL,GAAcA,MAAd;AACA7B,IAAI,CAAC8B,UAAL,GAAkBA,UAAlB;;;;"}
@@ -1,3 +1,4 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import React__default from 'react';
2
3
  import cn from 'classnames';
3
4
  import { Icon } from '../Icon/Icon.js';
@@ -5,20 +6,25 @@ import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
5
6
  import { Treeview } from '../Treeview/Treeview.js';
6
7
  import { useDropTarget } from '../../utils/hooks/useDropTarget.js';
7
8
 
8
- const Item = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
9
- const {
10
- active,
11
- children,
12
- onDrop,
13
- postfix,
14
- prefix,
15
- role,
16
- ...otherProps
17
- } = props;
18
- const proxyRef = useProxiedRef(ref);
19
- const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);
20
- const isTreeitem = role === 'treeitem';
21
- const className = cn('yt-navigation__item cursor-pointer', {
9
+ var _excluded = ["active", "children", "onDrop", "postfix", "prefix", "role"],
10
+ _excluded2 = ["children"];
11
+ var Item = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
12
+ var active = props.active,
13
+ children = props.children,
14
+ onDrop = props.onDrop,
15
+ postfix = props.postfix,
16
+ prefix = props.prefix,
17
+ role = props.role,
18
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
19
+
20
+ var proxyRef = useProxiedRef(ref);
21
+
22
+ var _useDropTarget = useDropTarget(onDrop),
23
+ isDraggedOver = _useDropTarget[0],
24
+ dropTargetProps = _useDropTarget[1];
25
+
26
+ var isTreeitem = role === 'treeitem';
27
+ var className = cn('yt-navigation__item cursor-pointer', {
22
28
  'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,
23
29
  'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,
24
30
  'yt-navigation__item--active': active && !isDraggedOver,
@@ -26,7 +32,7 @@ const Item = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
26
32
  'yt-navigation__item--dropping bg-blue': isDraggedOver
27
33
  }, props.className);
28
34
 
29
- const handleClick = event => {
35
+ var handleClick = function handleClick(event) {
30
36
  if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {
31
37
  return;
32
38
  }
@@ -49,19 +55,19 @@ const Item = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
49
55
  className: "yt-navigation__item__postfix ml-1"
50
56
  }, postfix));
51
57
  });
52
- const Panel = /*#__PURE__*/React__default.forwardRef(function Panel(props, ref) {
58
+ var Panel = /*#__PURE__*/React__default.forwardRef(function Panel(props, ref) {
53
59
  return React__default.createElement("div", Object.assign({}, props, {
54
60
  className: cn('w-full bg-white p-3', props.className),
55
61
  ref: ref
56
62
  }));
57
63
  });
58
- const MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(props, ref) {
59
- const className = cn('flex-shrink-0 space-y-1 outline-none', {
64
+ var MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(props, ref) {
65
+ var className = cn('flex-shrink-0 space-y-1 outline-none', {
60
66
  'bg-white pb-2': props.fixed
61
67
  }, props.className);
62
68
 
63
- const title = expanded => {
64
- const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {
69
+ var title = function title(expanded) {
70
+ var className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {
65
71
  'mb-1': expanded,
66
72
  'cursor-pointer hover:text-blue': !props.fixed
67
73
  });
@@ -78,14 +84,16 @@ const MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(prop
78
84
  ref: ref
79
85
  }));
80
86
  });
81
- const Menu = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
82
- const scrollableAreas = React__default.useMemo(() => {
83
- const scrollableAreas = [];
84
- React__default.Children.toArray(props.children).filter(child => !!child).map(child => {
87
+ var Menu = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
88
+ var scrollableAreas = React__default.useMemo(function () {
89
+ var scrollableAreas = [];
90
+ React__default.Children.toArray(props.children).filter(function (child) {
91
+ return !!child;
92
+ }).map(function (child) {
85
93
  if (child.props.fixed) {
86
94
  scrollableAreas.push(child);
87
95
  } else {
88
- const x = scrollableAreas[scrollableAreas.length - 1];
96
+ var x = scrollableAreas[scrollableAreas.length - 1];
89
97
 
90
98
  if (Array.isArray(x)) {
91
99
  x.push(child);
@@ -99,18 +107,19 @@ const Menu = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
99
107
  return React__default.createElement(Treeview, Object.assign({}, props, {
100
108
  className: cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className),
101
109
  ref: ref
102
- }), scrollableAreas.map((area, i) => Array.isArray(area) ? React__default.createElement("div", {
103
- className: "divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto",
104
- key: i
105
- }, area) : area));
110
+ }), scrollableAreas.map(function (area, i) {
111
+ return Array.isArray(area) ? React__default.createElement("div", {
112
+ className: "divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto",
113
+ key: i
114
+ }, area) : area;
115
+ }));
106
116
  });
107
117
  Menu.Group = MenuGroup;
108
- const Navigation = /*#__PURE__*/React__default.forwardRef(function Navigation(props, ref) {
109
- const {
110
- children,
111
- ...otherProps
112
- } = props;
113
- const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);
118
+ var Navigation = /*#__PURE__*/React__default.forwardRef(function Navigation(props, ref) {
119
+ var children = props.children,
120
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
121
+
122
+ var className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);
114
123
  return React__default.createElement("div", Object.assign({}, otherProps, {
115
124
  className: className,
116
125
  "data-taco": "navigation",
@@ -1 +1 @@
1
- {"version":3,"file":"Navigation.js","sources":["../../../../src/components/Navigation/Navigation.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { TreeviewProps, Treeview, TreeviewGroupProps, TreeviewItemProps } from '../Treeview/Treeview';\r\nimport { Icon } from '../Icon/Icon';\r\nimport { useDropTarget } from '../../utils/hooks/useDropTarget';\r\nimport './Navigation.css';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\n\r\n// Item\r\nexport type NavigationItemProps = Omit<TreeviewItemProps, 'prefix'> & {\r\n /** Change the style to indicate the link is selected */\r\n active?: boolean;\r\n /** Handler to be used when dropping a dragged element over the navigation link */\r\n onDrop?: React.DragEventHandler;\r\n /**\r\n * Small amount of information placed next to the text of the link.\r\n * This can be any valid react element, for e.g. a `span`.\r\n * Should be used to indicate a relevant information of the link,\r\n * for e.g. the number of unread notifications\r\n */\r\n postfix?: React.ReactNode;\r\n /**\r\n * Small amount of information placed before the text of the link.\r\n * This can be any valid react element, for e.g. a `span`.\r\n * Should be used to indicate a feedback for user,\r\n * for e.g. display some sort of visual informational state or a relevant icon.\r\n */\r\n prefix?: React.ReactNode;\r\n /** Target of the link */\r\n target?: string;\r\n};\r\n\r\nconst Item = React.forwardRef(function Item(props: NavigationItemProps, ref: React.Ref<HTMLAnchorElement>) {\r\n const { active, children, onDrop, postfix, prefix, role, ...otherProps } = props;\r\n const proxyRef = useProxiedRef<HTMLAnchorElement>(ref);\r\n const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);\r\n const isTreeitem = role === 'treeitem';\r\n const className = cn(\r\n 'yt-navigation__item cursor-pointer',\r\n {\r\n 'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,\r\n 'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,\r\n 'yt-navigation__item--active': active && !isDraggedOver,\r\n 'bg-grey-dark': isTreeitem && active && !isDraggedOver,\r\n 'yt-navigation__item--dropping bg-blue': isDraggedOver,\r\n },\r\n props.className\r\n );\r\n\r\n const handleClick = (event: React.MouseEvent<HTMLSpanElement>): void => {\r\n if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {\r\n return;\r\n }\r\n\r\n if (proxyRef.current) {\r\n proxyRef.current.click();\r\n }\r\n };\r\n\r\n return (\r\n <span {...dropTargetProps} className={className} onClick={handleClick} role={role}>\r\n {prefix && <span className=\"yt-navigation__item__prefix flex items-center\">{prefix}</span>}\r\n <a {...otherProps} className=\"block flex-grow truncate\" ref={proxyRef}>\r\n {children}\r\n </a>\r\n {postfix && <span className=\"yt-navigation__item__postfix ml-1\">{postfix}</span>}\r\n </span>\r\n );\r\n});\r\n\r\n// Panel\r\nexport type NavigationPanelProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nconst Panel = React.forwardRef(function Panel(props: NavigationPanelProps, ref: React.Ref<HTMLDivElement>) {\r\n return <div {...props} className={cn('w-full bg-white p-3', props.className)} ref={ref} />;\r\n});\r\n\r\n// Group\r\nexport type NavigationMenuGroupProps = TreeviewGroupProps;\r\n\r\nconst MenuGroup = React.forwardRef(function MenuGroup(props: NavigationMenuGroupProps, ref: React.Ref<HTMLDivElement>) {\r\n const className = cn(\r\n 'flex-shrink-0 space-y-1 outline-none',\r\n {\r\n 'bg-white pb-2': props.fixed,\r\n },\r\n props.className\r\n );\r\n const title = (expanded: boolean): JSX.Element => {\r\n const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {\r\n 'mb-1': expanded,\r\n 'cursor-pointer hover:text-blue': !props.fixed,\r\n });\r\n\r\n return (\r\n <span className={className}>\r\n {typeof props.title === 'function' ? props.title(expanded) : props.title}\r\n {!props.fixed && <Icon name={expanded ? 'chevron-up' : 'chevron-down'} />}\r\n </span>\r\n );\r\n };\r\n\r\n return <Treeview.Group {...props} className={className} title={title} ref={ref} />;\r\n});\r\n\r\n// Menu\r\nexport type NavigationMenuProps = React.PropsWithChildren<TreeviewProps>;\r\n\r\nexport type ForwardedNavigationMenuWithStatics = React.ForwardRefExoticComponent<\r\n NavigationMenuProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Expandable region reprezenting a group of related links */\r\n Group: React.ForwardRefExoticComponent<NavigationMenuGroupProps & React.RefAttributes<HTMLDivElement>>;\r\n};\r\n\r\nconst Menu = React.forwardRef(function Menu(props: NavigationMenuProps, ref: React.Ref<HTMLDivElement>) {\r\n const scrollableAreas = React.useMemo(() => {\r\n const scrollableAreas: any[] = [];\r\n\r\n React.Children.toArray(props.children)\r\n .filter(child => !!child)\r\n .map((child: React.ReactElement<NavigationMenuGroupProps>) => {\r\n if (child.props.fixed) {\r\n scrollableAreas.push(child);\r\n } else {\r\n const x = scrollableAreas[scrollableAreas.length - 1];\r\n if (Array.isArray(x)) {\r\n x.push(child);\r\n } else {\r\n scrollableAreas.push([child]);\r\n }\r\n }\r\n });\r\n\r\n return scrollableAreas;\r\n }, [props.children]);\r\n\r\n return (\r\n <Treeview\r\n {...props}\r\n className={cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className)}\r\n ref={ref}\r\n >\r\n {scrollableAreas.map((area, i) =>\r\n Array.isArray(area) ? (\r\n <div\r\n className=\"divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto\"\r\n key={i}\r\n >\r\n {area}\r\n </div>\r\n ) : (\r\n area\r\n )\r\n )}\r\n </Treeview>\r\n );\r\n}) as ForwardedNavigationMenuWithStatics;\r\n\r\nMenu.Group = MenuGroup;\r\n\r\n// Navigation\r\nexport type NavigationProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nexport type ForwardedNavigationWithStatics = React.ForwardRefExoticComponent<\r\n NavigationProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Navigation link */\r\n Item: React.ForwardRefExoticComponent<NavigationItemProps & React.RefAttributes<HTMLAnchorElement>>;\r\n /**\r\n * Container for the expandable groups that hold navigation links.\r\n * Should be used as a direct child of Navigation component, e.g. `Navigation.Menu`.\r\n * Should have the menu groups as a direct child, e.g. `Navigation.Menu.Group`\r\n */\r\n Menu: ForwardedNavigationMenuWithStatics;\r\n /**\r\n * Isolated container within the Navigation.\r\n * This can be used to create a region in the Navigation that is usually not scrollable, nor expandable,\r\n * containing useful information for user and quick actions\r\n */\r\n Panel: React.ForwardRefExoticComponent<NavigationPanelProps & React.RefAttributes<HTMLDivElement>>;\r\n};\r\n\r\nexport const Navigation = React.forwardRef(function Navigation(props: NavigationProps, ref: React.Ref<HTMLDivElement>) {\r\n const { children, ...otherProps } = props;\r\n const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);\r\n\r\n return (\r\n <div {...otherProps} className={className} data-taco=\"navigation\" ref={ref}>\r\n {children}\r\n </div>\r\n );\r\n}) as ForwardedNavigationWithStatics;\r\n\r\nNavigation.Menu = Menu;\r\nNavigation.Item = Item;\r\nNavigation.Panel = Panel;\r\n"],"names":["Item","React","forwardRef","props","ref","active","children","onDrop","postfix","prefix","role","otherProps","proxyRef","useProxiedRef","isDraggedOver","dropTargetProps","useDropTarget","isTreeitem","className","cn","handleClick","event","target","HTMLAnchorElement","HTMLButtonElement","current","click","onClick","Panel","MenuGroup","fixed","title","expanded","Icon","name","Treeview","Group","Menu","scrollableAreas","useMemo","Children","toArray","filter","child","map","push","x","length","Array","isArray","area","i","key","Navigation"],"mappings":";;;;;;;AAgCA,MAAMA,IAAI,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,IAAT,CAAcG,KAAd,EAA0CC,GAA1C;EAC1B,MAAM;IAAEC,MAAF;IAAUC,QAAV;IAAoBC,MAApB;IAA4BC,OAA5B;IAAqCC,MAArC;IAA6CC,IAA7C;IAAmD,GAAGC;MAAeR,KAA3E;EACA,MAAMS,QAAQ,GAAGC,aAAa,CAAoBT,GAApB,CAA9B;EACA,MAAM,CAACU,aAAD,EAAgBC,eAAhB,IAAmCC,aAAa,CAACT,MAAD,CAAtD;EACA,MAAMU,UAAU,GAAGP,IAAI,KAAK,UAA5B;EACA,MAAMQ,SAAS,GAAGC,EAAE,CAChB,oCADgB,EAEhB;IACI,+DAA+DF,UADnE;IAEI,4FAA4F,CAACA,UAFjG;IAGI,+BAA+BZ,MAAM,IAAI,CAACS,aAH9C;IAII,gBAAgBG,UAAU,IAAIZ,MAAd,IAAwB,CAACS,aAJ7C;IAKI,yCAAyCA;GAP7B,EAShBX,KAAK,CAACe,SATU,CAApB;;EAYA,MAAME,WAAW,GAAIC,KAAD;IAChB,IAAIA,KAAK,CAACC,MAAN,YAAwBC,iBAAxB,IAA6CF,KAAK,CAACC,MAAN,YAAwBE,iBAAzE,EAA4F;MACxF;;;IAGJ,IAAIZ,QAAQ,CAACa,OAAb,EAAsB;MAClBb,QAAQ,CAACa,OAAT,CAAiBC,KAAjB;;GANR;;EAUA,OACIzB,4BAAA,OAAA,oBAA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IACIjD,4BAAA,MAAA;IACIiB,SAAS,EAAC;IACVkC,GAAG,EAAED;GAFT,EAIKD,IAJL,CADJ,GAQIA,IATP,CALL,CADJ;AAoBH,CA1CY,CAAb;AA4CAb,IAAI,CAACD,KAAL,GAAaP,SAAb;MAwBawB,UAAU,gBAAGpD,cAAK,CAACC,UAAN,CAAiB,SAASmD,UAAT,CAAoBlD,KAApB,EAA4CC,GAA5C;EACvC,MAAM;IAAEE,QAAF;IAAY,GAAGK;MAAeR,KAApC;EACA,MAAMe,SAAS,GAAGC,EAAE,CAAC,iEAAD,EAAoEhB,KAAK,CAACe,SAA1E,CAApB;EAEA,OACIjB,4BAAA,MAAA,oBAASU;IAAYO,SAAS,EAAEA;iBAAqB;IAAad,GAAG,EAAEA;IAAvE,EACKE,QADL,CADJ;AAKH,CATyB;AAW1B+C,UAAU,CAAChB,IAAX,GAAkBA,IAAlB;AACAgB,UAAU,CAACrD,IAAX,GAAkBA,IAAlB;AACAqD,UAAU,CAACzB,KAAX,GAAmBA,KAAnB;;;;"}
1
+ {"version":3,"file":"Navigation.js","sources":["../../../../src/components/Navigation/Navigation.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { TreeviewProps, Treeview, TreeviewGroupProps, TreeviewItemProps } from '../Treeview/Treeview';\r\nimport { Icon } from '../Icon/Icon';\r\nimport { useDropTarget } from '../../utils/hooks/useDropTarget';\r\nimport './Navigation.css';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\n\r\n// Item\r\nexport type NavigationItemProps = Omit<TreeviewItemProps, 'prefix'> & {\r\n /** Change the style to indicate the link is selected */\r\n active?: boolean;\r\n /** Handler to be used when dropping a dragged element over the navigation link */\r\n onDrop?: React.DragEventHandler;\r\n /**\r\n * Small amount of information placed next to the text of the link.\r\n * This can be any valid react element, for e.g. a `span`.\r\n * Should be used to indicate a relevant information of the link,\r\n * for e.g. the number of unread notifications\r\n */\r\n postfix?: React.ReactNode;\r\n /**\r\n * Small amount of information placed before the text of the link.\r\n * This can be any valid react element, for e.g. a `span`.\r\n * Should be used to indicate a feedback for user,\r\n * for e.g. display some sort of visual informational state or a relevant icon.\r\n */\r\n prefix?: React.ReactNode;\r\n /** Target of the link */\r\n target?: string;\r\n};\r\n\r\nconst Item = React.forwardRef(function Item(props: NavigationItemProps, ref: React.Ref<HTMLAnchorElement>) {\r\n const { active, children, onDrop, postfix, prefix, role, ...otherProps } = props;\r\n const proxyRef = useProxiedRef<HTMLAnchorElement>(ref);\r\n const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);\r\n const isTreeitem = role === 'treeitem';\r\n const className = cn(\r\n 'yt-navigation__item cursor-pointer',\r\n {\r\n 'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,\r\n 'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,\r\n 'yt-navigation__item--active': active && !isDraggedOver,\r\n 'bg-grey-dark': isTreeitem && active && !isDraggedOver,\r\n 'yt-navigation__item--dropping bg-blue': isDraggedOver,\r\n },\r\n props.className\r\n );\r\n\r\n const handleClick = (event: React.MouseEvent<HTMLSpanElement>): void => {\r\n if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {\r\n return;\r\n }\r\n\r\n if (proxyRef.current) {\r\n proxyRef.current.click();\r\n }\r\n };\r\n\r\n return (\r\n <span {...dropTargetProps} className={className} onClick={handleClick} role={role}>\r\n {prefix && <span className=\"yt-navigation__item__prefix flex items-center\">{prefix}</span>}\r\n <a {...otherProps} className=\"block flex-grow truncate\" ref={proxyRef}>\r\n {children}\r\n </a>\r\n {postfix && <span className=\"yt-navigation__item__postfix ml-1\">{postfix}</span>}\r\n </span>\r\n );\r\n});\r\n\r\n// Panel\r\nexport type NavigationPanelProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nconst Panel = React.forwardRef(function Panel(props: NavigationPanelProps, ref: React.Ref<HTMLDivElement>) {\r\n return <div {...props} className={cn('w-full bg-white p-3', props.className)} ref={ref} />;\r\n});\r\n\r\n// Group\r\nexport type NavigationMenuGroupProps = TreeviewGroupProps;\r\n\r\nconst MenuGroup = React.forwardRef(function MenuGroup(props: NavigationMenuGroupProps, ref: React.Ref<HTMLDivElement>) {\r\n const className = cn(\r\n 'flex-shrink-0 space-y-1 outline-none',\r\n {\r\n 'bg-white pb-2': props.fixed,\r\n },\r\n props.className\r\n );\r\n const title = (expanded: boolean): JSX.Element => {\r\n const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {\r\n 'mb-1': expanded,\r\n 'cursor-pointer hover:text-blue': !props.fixed,\r\n });\r\n\r\n return (\r\n <span className={className}>\r\n {typeof props.title === 'function' ? props.title(expanded) : props.title}\r\n {!props.fixed && <Icon name={expanded ? 'chevron-up' : 'chevron-down'} />}\r\n </span>\r\n );\r\n };\r\n\r\n return <Treeview.Group {...props} className={className} title={title} ref={ref} />;\r\n});\r\n\r\n// Menu\r\nexport type NavigationMenuProps = React.PropsWithChildren<TreeviewProps>;\r\n\r\nexport type ForwardedNavigationMenuWithStatics = React.ForwardRefExoticComponent<\r\n NavigationMenuProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Expandable region reprezenting a group of related links */\r\n Group: React.ForwardRefExoticComponent<NavigationMenuGroupProps & React.RefAttributes<HTMLDivElement>>;\r\n};\r\n\r\nconst Menu = React.forwardRef(function Menu(props: NavigationMenuProps, ref: React.Ref<HTMLDivElement>) {\r\n const scrollableAreas = React.useMemo(() => {\r\n const scrollableAreas: any[] = [];\r\n\r\n React.Children.toArray(props.children)\r\n .filter(child => !!child)\r\n .map((child: React.ReactElement<NavigationMenuGroupProps>) => {\r\n if (child.props.fixed) {\r\n scrollableAreas.push(child);\r\n } else {\r\n const x = scrollableAreas[scrollableAreas.length - 1];\r\n if (Array.isArray(x)) {\r\n x.push(child);\r\n } else {\r\n scrollableAreas.push([child]);\r\n }\r\n }\r\n });\r\n\r\n return scrollableAreas;\r\n }, [props.children]);\r\n\r\n return (\r\n <Treeview\r\n {...props}\r\n className={cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className)}\r\n ref={ref}\r\n >\r\n {scrollableAreas.map((area, i) =>\r\n Array.isArray(area) ? (\r\n <div\r\n className=\"divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto\"\r\n key={i}\r\n >\r\n {area}\r\n </div>\r\n ) : (\r\n area\r\n )\r\n )}\r\n </Treeview>\r\n );\r\n}) as ForwardedNavigationMenuWithStatics;\r\n\r\nMenu.Group = MenuGroup;\r\n\r\n// Navigation\r\nexport type NavigationProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nexport type ForwardedNavigationWithStatics = React.ForwardRefExoticComponent<\r\n NavigationProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Navigation link */\r\n Item: React.ForwardRefExoticComponent<NavigationItemProps & React.RefAttributes<HTMLAnchorElement>>;\r\n /**\r\n * Container for the expandable groups that hold navigation links.\r\n * Should be used as a direct child of Navigation component, e.g. `Navigation.Menu`.\r\n * Should have the menu groups as a direct child, e.g. `Navigation.Menu.Group`\r\n */\r\n Menu: ForwardedNavigationMenuWithStatics;\r\n /**\r\n * Isolated container within the Navigation.\r\n * This can be used to create a region in the Navigation that is usually not scrollable, nor expandable,\r\n * containing useful information for user and quick actions\r\n */\r\n Panel: React.ForwardRefExoticComponent<NavigationPanelProps & React.RefAttributes<HTMLDivElement>>;\r\n};\r\n\r\nexport const Navigation = React.forwardRef(function Navigation(props: NavigationProps, ref: React.Ref<HTMLDivElement>) {\r\n const { children, ...otherProps } = props;\r\n const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);\r\n\r\n return (\r\n <div {...otherProps} className={className} data-taco=\"navigation\" ref={ref}>\r\n {children}\r\n </div>\r\n );\r\n}) as ForwardedNavigationWithStatics;\r\n\r\nNavigation.Menu = Menu;\r\nNavigation.Item = Item;\r\nNavigation.Panel = Panel;\r\n"],"names":["Item","React","forwardRef","props","ref","active","children","onDrop","postfix","prefix","role","otherProps","proxyRef","useProxiedRef","useDropTarget","isDraggedOver","dropTargetProps","isTreeitem","className","cn","handleClick","event","target","HTMLAnchorElement","HTMLButtonElement","current","click","onClick","Panel","MenuGroup","fixed","title","expanded","Icon","name","Treeview","Group","Menu","scrollableAreas","useMemo","Children","toArray","filter","child","map","push","x","length","Array","isArray","area","i","key","Navigation"],"mappings":";;;;;;;;;;AAgCA,IAAMA,IAAI,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,IAAT,CAAcG,KAAd,EAA0CC,GAA1C;EAC1B,IAAQC,MAAR,GAA2EF,KAA3E,CAAQE,MAAR;MAAgBC,QAAhB,GAA2EH,KAA3E,CAAgBG,QAAhB;MAA0BC,MAA1B,GAA2EJ,KAA3E,CAA0BI,MAA1B;MAAkCC,OAAlC,GAA2EL,KAA3E,CAAkCK,OAAlC;MAA2CC,MAA3C,GAA2EN,KAA3E,CAA2CM,MAA3C;MAAmDC,IAAnD,GAA2EP,KAA3E,CAAmDO,IAAnD;MAA4DC,UAA5D,iCAA2ER,KAA3E;;EACA,IAAMS,QAAQ,GAAGC,aAAa,CAAoBT,GAApB,CAA9B;;EACA,qBAAyCU,aAAa,CAACP,MAAD,CAAtD;MAAOQ,aAAP;MAAsBC,eAAtB;;EACA,IAAMC,UAAU,GAAGP,IAAI,KAAK,UAA5B;EACA,IAAMQ,SAAS,GAAGC,EAAE,CAChB,oCADgB,EAEhB;IACI,+DAA+DF,UADnE;IAEI,4FAA4F,CAACA,UAFjG;IAGI,+BAA+BZ,MAAM,IAAI,CAACU,aAH9C;IAII,gBAAgBE,UAAU,IAAIZ,MAAd,IAAwB,CAACU,aAJ7C;IAKI,yCAAyCA;GAP7B,EAShBZ,KAAK,CAACe,SATU,CAApB;;EAYA,IAAME,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD;IAChB,IAAIA,KAAK,CAACC,MAAN,YAAwB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