@economic/taco 1.9.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/components/Datepicker/Datepicker.stories.d.ts +1 -1
  2. package/dist/components/Menu/Menu.d.ts +17 -30
  3. package/dist/components/Menu/Menu.stories.d.ts +2 -31
  4. package/dist/components/Menu/components/Checkbox.d.ts +5 -1
  5. package/dist/components/Menu/components/Header.d.ts +1 -1
  6. package/dist/components/Menu/components/RadioGroup.d.ts +4 -4
  7. package/dist/components/Select/Select.stories.d.ts +1 -1
  8. package/dist/components/Tag/Tag.d.ts +19 -0
  9. package/dist/components/Tag/Tag.stories.d.ts +9 -0
  10. package/dist/esm/components/Card/Card.js +1 -0
  11. package/dist/esm/components/Card/Card.js.map +1 -1
  12. package/dist/esm/components/Menu/Menu.js +6 -4
  13. package/dist/esm/components/Menu/Menu.js.map +1 -1
  14. package/dist/esm/components/Menu/components/Checkbox.js +3 -3
  15. package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
  16. package/dist/esm/components/Menu/components/Header.js +3 -3
  17. package/dist/esm/components/Menu/components/Header.js.map +1 -1
  18. package/dist/esm/components/Menu/components/Item.js +3 -3
  19. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  20. package/dist/esm/components/Menu/components/RadioGroup.js +5 -5
  21. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  22. package/dist/esm/components/Navigation/Navigation.js +1 -1
  23. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  24. package/dist/esm/components/SearchInput/SearchInput.js +1 -0
  25. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  26. package/dist/esm/components/Tag/Tag.js +53 -0
  27. package/dist/esm/components/Tag/Tag.js.map +1 -0
  28. package/dist/esm/components/Tooltip/Tooltip.js +1 -1
  29. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  30. package/dist/esm/hooks/useIsRefOverflowing.js +15 -0
  31. package/dist/esm/hooks/useIsRefOverflowing.js.map +1 -0
  32. package/dist/esm/index.js +1 -0
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/utils/colors.js +15 -0
  35. package/dist/esm/utils/colors.js.map +1 -0
  36. package/dist/esm/utils/dom.js +4 -0
  37. package/dist/esm/utils/dom.js.map +1 -0
  38. package/dist/hooks/useIsRefOverflowing.d.ts +2 -0
  39. package/dist/index.d.ts +1 -0
  40. package/dist/taco.cjs.development.js +86 -14
  41. package/dist/taco.cjs.development.js.map +1 -1
  42. package/dist/taco.cjs.production.min.js +1 -1
  43. package/dist/taco.cjs.production.min.js.map +1 -1
  44. package/dist/utils/colors.d.ts +13 -0
  45. package/dist/utils/dom.d.ts +1 -0
  46. package/package.json +2 -2
  47. package/types.json +108 -2
@@ -1,9 +1,9 @@
1
- import { createElement } from 'react';
1
+ import { forwardRef, createElement } from 'react';
2
2
  import { Icon } from '../../Icon/Icon.js';
3
3
  import { CheckboxItem, ItemIndicator } from '@radix-ui/react-dropdown-menu';
4
4
  import { useItemStyling } from './Item.js';
5
5
 
6
- const Checkbox = props => {
6
+ const Checkbox = /*#__PURE__*/forwardRef(function MenuCheckboxItem(props) {
7
7
  const {
8
8
  checked,
9
9
  children,
@@ -25,7 +25,7 @@ const Checkbox = props => {
25
25
  name: "tick",
26
26
  className: "-ml-px !h-4 !w-4"
27
27
  })), children);
28
- };
28
+ });
29
29
 
30
30
  export { Checkbox };
31
31
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Menu/components/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Icon } from '../../Icon/Icon';\nimport { useItemStyling } from './Item';\n\nexport type MenuCheckboxItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n /* Whether the checkbox item is disabled */\n disabled?: boolean;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean | 'indeterminate') => void;\n};\n\nexport const Checkbox = (props: MenuCheckboxItemProps) => {\n const { checked, children, onChange, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: true,\n className: props.className,\n });\n\n return (\n <DropdownMenuPrimitive.CheckboxItem {...otherProps} className={className} checked={checked} onCheckedChange={onChange}>\n <DropdownMenuPrimitive.ItemIndicator className=\"absolute left-0 ml-1.5\">\n <Icon name=\"tick\" className=\"-ml-px !h-4 !w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n};\n"],"names":["Checkbox","props","checked","children","onChange","otherProps","className","useItemStyling","disabled","indented","React","DropdownMenuPrimitive","onCheckedChange","Icon","name"],"mappings":";;;;;MAcaA,QAAQ,GAAIC,KAAD;EACpB,MAAM;IAAEC,OAAF;IAAWC,QAAX;IAAqBC,QAArB;IAA+B,GAAGC;MAAeJ,KAAvD;EACA,MAAMK,SAAS,GAAGC,cAAc,CAAC;IAC7BC,QAAQ,EAAEP,KAAK,CAACO,QADa;IAE7BC,QAAQ,EAAE,IAFmB;IAG7BH,SAAS,EAAEL,KAAK,CAACK;GAHW,CAAhC;EAMA,OACII,aAAA,CAACC,YAAD,oBAAwCN;IAAYC,SAAS,EAAEA;IAAWJ,OAAO,EAAEA;IAASU,eAAe,EAAER;IAA7G,EACIM,aAAA,CAACC,aAAD;IAAqCL,SAAS,EAAC;GAA/C,EACII,aAAA,CAACG,IAAD;IAAMC,IAAI,EAAC;IAAOR,SAAS,EAAC;GAA5B,CADJ,CADJ,EAIKH,QAJL,CADJ;AAQH;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Menu/components/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Icon } from '../../Icon/Icon';\nimport { useItemStyling } from './Item';\n\nexport type MenuCheckboxItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n /* Whether the checkbox item is disabled */\n disabled?: boolean;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean | 'indeterminate') => void;\n};\n\nexport const Checkbox = React.forwardRef<HTMLDivElement, MenuCheckboxItemProps>(function MenuCheckboxItem(props) {\n const { checked, children, onChange, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: true,\n className: props.className,\n });\n\n return (\n <DropdownMenuPrimitive.CheckboxItem {...otherProps} className={className} checked={checked} onCheckedChange={onChange}>\n <DropdownMenuPrimitive.ItemIndicator className=\"absolute left-0 ml-1.5\">\n <Icon name=\"tick\" className=\"-ml-px !h-4 !w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\n"],"names":["Checkbox","React","MenuCheckboxItem","props","checked","children","onChange","otherProps","className","useItemStyling","disabled","indented","DropdownMenuPrimitive","onCheckedChange","Icon","name"],"mappings":";;;;;MAcaA,QAAQ,gBAAGC,UAAA,CAAwD,SAASC,gBAAT,CAA0BC,KAA1B;EAC5E,MAAM;IAAEC,OAAF;IAAWC,QAAX;IAAqBC,QAArB;IAA+B,GAAGC;MAAeJ,KAAvD;EACA,MAAMK,SAAS,GAAGC,cAAc,CAAC;IAC7BC,QAAQ,EAAEP,KAAK,CAACO,QADa;IAE7BC,QAAQ,EAAE,IAFmB;IAG7BH,SAAS,EAAEL,KAAK,CAACK;GAHW,CAAhC;EAMA,OACIP,aAAA,CAACW,YAAD,oBAAwCL;IAAYC,SAAS,EAAEA;IAAWJ,OAAO,EAAEA;IAASS,eAAe,EAAEP;IAA7G,EACIL,aAAA,CAACW,aAAD;IAAqCJ,SAAS,EAAC;GAA/C,EACIP,aAAA,CAACa,IAAD;IAAMC,IAAI,EAAC;IAAOP,SAAS,EAAC;GAA5B,CADJ,CADJ,EAIKH,QAJL,CADJ;AAQH,CAhBuB;;;;"}
@@ -1,9 +1,9 @@
1
- import { createElement } from 'react';
1
+ import { forwardRef, createElement } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { useCurrentMenu } from '../Context.js';
4
4
  import { Label } from '@radix-ui/react-dropdown-menu';
5
5
 
6
- const Header = props => {
6
+ const Header = /*#__PURE__*/forwardRef(function MenuHeader(props) {
7
7
  const menu = useCurrentMenu();
8
8
  const className = cn('flex items-center justify-start h-7 pr-1.5 text-xs text-grey-darkest', {
9
9
  'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
@@ -12,7 +12,7 @@ const Header = props => {
12
12
  return createElement(Label, Object.assign({}, props, {
13
13
  className: className
14
14
  }));
15
- };
15
+ });
16
16
 
17
17
  export { Header };
18
18
  //# sourceMappingURL=Header.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../../../../src/components/Menu/components/Header.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Header = (props: MenuHeaderProps) => {\n const menu = useCurrentMenu();\n const className = cn(\n 'flex items-center justify-start h-7 pr-1.5 text-xs text-grey-darkest',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n },\n props.className\n );\n\n return <DropdownMenuPrimitive.Label {...props} className={className} />;\n};\n"],"names":["Header","props","menu","useCurrentMenu","className","cn","indented","React","DropdownMenuPrimitive"],"mappings":";;;;;MAOaA,MAAM,GAAIC,KAAD;EAClB,MAAMC,IAAI,GAAGC,cAAc,EAA3B;EACA,MAAMC,SAAS,GAAGC,EAAE,CAChB,sEADgB,EAEhB;IACI,QAAQH,IAAR,aAAQA,IAAR,uBAAQA,IAAI,CAAEI,QADlB;IAEI,UAAU,EAACJ,IAAD,aAACA,IAAD,eAACA,IAAI,CAAEI,QAAP;GAJE,EAMhBL,KAAK,CAACG,SANU,CAApB;EASA,OAAOG,aAAA,CAACC,KAAD,oBAAiCP;IAAOG,SAAS,EAAEA;IAAnD,CAAP;AACH;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../../../../src/components/Menu/components/Header.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Header = React.forwardRef<HTMLDivElement, MenuHeaderProps>(function MenuHeader(props) {\n const menu = useCurrentMenu();\n const className = cn(\n 'flex items-center justify-start h-7 pr-1.5 text-xs text-grey-darkest',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n },\n props.className\n );\n\n return <DropdownMenuPrimitive.Label {...props} className={className} />;\n});\n"],"names":["Header","React","MenuHeader","props","menu","useCurrentMenu","className","cn","indented","DropdownMenuPrimitive"],"mappings":";;;;;MAOaA,MAAM,gBAAGC,UAAA,CAAkD,SAASC,UAAT,CAAoBC,KAApB;EACpE,MAAMC,IAAI,GAAGC,cAAc,EAA3B;EACA,MAAMC,SAAS,GAAGC,EAAE,CAChB,sEADgB,EAEhB;IACI,QAAQH,IAAR,aAAQA,IAAR,uBAAQA,IAAI,CAAEI,QADlB;IAEI,UAAU,EAACJ,IAAD,aAACA,IAAD,eAACA,IAAI,CAAEI,QAAP;GAJE,EAMhBL,KAAK,CAACG,SANU,CAApB;EASA,OAAOL,aAAA,CAACQ,KAAD,oBAAiCN;IAAOG,SAAS,EAAEA;IAAnD,CAAP;AACH,CAZqB;;;;"}
@@ -23,11 +23,11 @@ const useItemStyling = ({
23
23
  menu === null || menu === void 0 ? void 0 : menu.registerIndentation();
24
24
  }
25
25
  }, [indented]);
26
- return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', 'text-black aria-disabled:text-grey hover:bg-grey-light hover:text-black', {
26
+ return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', {
27
27
  'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
28
28
  'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented),
29
- 'cursor-pointer': !disabled,
30
- 'cursor-not-allowed': disabled
29
+ 'cursor-pointer hover:bg-grey-light text-black hover:text-black': !disabled,
30
+ 'cursor-not-allowed hover:bg-white text-grey-dark': disabled
31
31
  }, className);
32
32
  };
33
33
  const Shortcut = props => {
@@ -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","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,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;;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 {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n 'cursor-pointer hover:bg-grey-light text-black hover:text-black': !disabled,\n 'cursor-not-allowed hover:bg-white text-grey-dark': 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;EAC1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;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,8 +1,8 @@
1
- import { createElement, useContext, createContext } from 'react';
1
+ import { useContext, createElement, createContext, forwardRef } from 'react';
2
2
  import cn from 'classnames';
3
- import { RadioGroup as RadioGroup$1, RadioItem as RadioItem$1, ItemIndicator } from '@radix-ui/react-dropdown-menu';
3
+ import { RadioItem as RadioItem$1, ItemIndicator, RadioGroup as RadioGroup$1 } from '@radix-ui/react-dropdown-menu';
4
4
  import { useItemStyling } from './Item.js';
5
- import { useRadioGroup, getRadioGroupItemValueAsString } from '../../RadioGroup/RadioGroup.js';
5
+ import { getRadioGroupItemValueAsString, useRadioGroup } from '../../RadioGroup/RadioGroup.js';
6
6
 
7
7
  const RadioItem = props => {
8
8
  const context = useContext(MenuRadioGroupContext);
@@ -30,7 +30,7 @@ const RadioItem = props => {
30
30
  const MenuRadioGroupContext = /*#__PURE__*/createContext({
31
31
  disabled: false
32
32
  });
33
- const RadioGroup = props => {
33
+ const RadioGroup = /*#__PURE__*/forwardRef(function MenuRadioItem(props) {
34
34
  const {
35
35
  context,
36
36
  props: otherProps
@@ -41,7 +41,7 @@ const RadioGroup = props => {
41
41
  }, createElement(RadioGroup$1, Object.assign({}, otherProps, {
42
42
  className: className
43
43
  })));
44
- };
44
+ });
45
45
  RadioGroup.Item = RadioItem;
46
46
 
47
47
  export { RadioGroup, RadioItem };
@@ -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 <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,EAKIH,aAAA,CAACS,aAAD;IAAqCH,SAAS,EAAC;GAA/C,EACIN,aAAA,OAAA;IAAMM,SAAS,EAAC;GAAhB,CADJ,CALJ,EAQKJ,QARL,CADJ;AAYH;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
+ {"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 <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 type ForwardedMenuRadioGroupWithStatics = React.ForwardRefExoticComponent<\n MenuRadioGroupProps & React.RefAttributes<HTMLElement>\n> & {\n Item: React.FunctionComponent<MenuRadioGroupItemProps>;\n};\n\nexport const RadioGroup = React.forwardRef<HTMLDivElement, MenuRadioGroupProps>(function MenuRadioItem(props) {\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}) as ForwardedMenuRadioGroupWithStatics;\nRadioGroup.Item = RadioItem;\n"],"names":["RadioItem","props","context","React","MenuRadioGroupContext","children","value","otherProps","disabled","className","useItemStyling","ind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
@@ -58,7 +58,7 @@ const Panel = /*#__PURE__*/React__default.forwardRef(function Panel(props, ref)
58
58
  const MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(props, ref) {
59
59
  const className = cn('flex-shrink-0 space-y-1 outline-none', {
60
60
  'bg-white pb-2': props.fixed
61
- }, props.className);
61
+ }, typeof props.className === 'function' ? props.className(false) : props.className);
62
62
 
63
63
  const title = expanded => {
64
64
  const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {
@@ -1 +1 @@
1
- {"version":3,"file":"Navigation.js","sources":["../../../../src/components/Navigation/Navigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { TreeviewProps, Treeview, TreeviewGroupProps, TreeviewItemProps } from '../Treeview/Treeview';\nimport { Icon } from '../Icon/Icon';\nimport { useDropTarget } from '../../utils/hooks/useDropTarget';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport './Navigation.css';\n\n// Item\nexport type NavigationItemProps = Omit<TreeviewItemProps, 'prefix'> & {\n /** Change the style to indicate the link is selected */\n active?: boolean;\n /** Handler to be used when dropping a dragged element over the navigation link */\n onDrop?: React.DragEventHandler;\n /**\n * Small amount of information placed next to the text of the link.\n * This can be any valid react element, for e.g. a `span`.\n * Should be used to indicate a relevant information of the link,\n * for e.g. the number of unread notifications\n */\n postfix?: React.ReactNode;\n /**\n * Small amount of information placed before the text of the link.\n * This can be any valid react element, for e.g. a `span`.\n * Should be used to indicate a feedback for user,\n * for e.g. display some sort of visual informational state or a relevant icon.\n */\n prefix?: React.ReactNode;\n /** Target of the link */\n target?: string;\n};\n\nconst Item = React.forwardRef(function Item(props: NavigationItemProps, ref: React.Ref<HTMLAnchorElement>) {\n const { active, children, onDrop, postfix, prefix, role, ...otherProps } = props;\n const proxyRef = useProxiedRef<HTMLAnchorElement>(ref);\n const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);\n const isTreeitem = role === 'treeitem';\n const className = cn(\n 'yt-navigation__item cursor-pointer',\n {\n 'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,\n 'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,\n 'yt-navigation__item--active': active && !isDraggedOver,\n 'bg-grey-dark': isTreeitem && active && !isDraggedOver,\n 'yt-navigation__item--dropping bg-blue': isDraggedOver,\n },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLSpanElement>): void => {\n if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {\n return;\n }\n\n if (proxyRef.current) {\n proxyRef.current.click();\n }\n };\n\n return (\n <span {...dropTargetProps} className={className} onClick={handleClick} role={role}>\n {prefix && <span className=\"yt-navigation__item__prefix flex items-center\">{prefix}</span>}\n <a {...otherProps} className=\"block flex-grow truncate\" ref={proxyRef}>\n {children}\n </a>\n {postfix && <span className=\"yt-navigation__item__postfix ml-1\">{postfix}</span>}\n </span>\n );\n});\n\n// Panel\nexport type NavigationPanelProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Panel = React.forwardRef(function Panel(props: NavigationPanelProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} className={cn('w-full bg-white p-3', props.className)} ref={ref} />;\n});\n\n// Group\nexport type NavigationMenuGroupProps = TreeviewGroupProps;\n\nconst MenuGroup = React.forwardRef(function MenuGroup(props: NavigationMenuGroupProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn(\n 'flex-shrink-0 space-y-1 outline-none',\n {\n 'bg-white pb-2': props.fixed,\n },\n props.className\n );\n const title = (expanded: boolean): JSX.Element => {\n const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {\n 'mb-1': expanded,\n 'cursor-pointer hover:text-blue': !props.fixed,\n });\n\n return (\n <span className={className}>\n {typeof props.title === 'function' ? props.title(expanded) : props.title}\n {!props.fixed && <Icon name={expanded ? 'chevron-up' : 'chevron-down'} />}\n </span>\n );\n };\n\n return <Treeview.Group {...props} className={className} title={title} ref={ref} />;\n});\n\n// Menu\nexport type NavigationMenuProps = React.PropsWithChildren<TreeviewProps>;\n\nexport type ForwardedNavigationMenuWithStatics = React.ForwardRefExoticComponent<\n NavigationMenuProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Expandable region reprezenting a group of related links */\n Group: React.ForwardRefExoticComponent<NavigationMenuGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nconst Menu = React.forwardRef(function Menu(props: NavigationMenuProps, ref: React.Ref<HTMLDivElement>) {\n const scrollableAreas = React.useMemo(() => {\n const scrollableAreas: any[] = [];\n\n const children = React.Children.toArray(props.children).filter(\n child => !!child\n ) as React.ReactElement<NavigationMenuGroupProps>[];\n\n children.forEach(child => {\n if (child.props.fixed) {\n scrollableAreas.push(child);\n } else {\n const x = scrollableAreas[scrollableAreas.length - 1];\n if (Array.isArray(x)) {\n x.push(child);\n } else {\n scrollableAreas.push([child]);\n }\n }\n });\n\n return scrollableAreas;\n }, [props.children]);\n\n return (\n <Treeview\n {...props}\n className={cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className)}\n ref={ref}>\n {scrollableAreas.map((area, i) =>\n Array.isArray(area) ? (\n <div\n className=\"divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto\"\n key={i}>\n {area}\n </div>\n ) : (\n area\n )\n )}\n </Treeview>\n );\n}) as ForwardedNavigationMenuWithStatics;\n\nMenu.Group = MenuGroup;\n\n// Navigation\nexport type NavigationProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedNavigationWithStatics = React.ForwardRefExoticComponent<\n NavigationProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigation link */\n Item: React.ForwardRefExoticComponent<NavigationItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /**\n * Container for the expandable groups that hold navigation links.\n * Should be used as a direct child of Navigation component, e.g. `Navigation.Menu`.\n * Should have the menu groups as a direct child, e.g. `Navigation.Menu.Group`\n */\n Menu: ForwardedNavigationMenuWithStatics;\n /**\n * Isolated container within the Navigation.\n * This can be used to create a region in the Navigation that is usually not scrollable, nor expandable,\n * containing useful information for user and quick actions\n */\n Panel: React.ForwardRefExoticComponent<NavigationPanelProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Navigation = React.forwardRef(function Navigation(props: NavigationProps, ref: React.Ref<HTMLDivElement>) {\n const { children, ...otherProps } = props;\n const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);\n\n return (\n <div {...otherProps} className={className} data-taco=\"navigation\" ref={ref}>\n {children}\n </div>\n );\n}) as ForwardedNavigationWithStatics;\n\nNavigation.Menu = Menu;\nNavigation.Item = Item;\nNavigation.Panel = Panel;\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","forEach","push","x","length","Array","isArray","map","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,4FAA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;QACA,IAAIC,KAAK,CAACC,OAAN,CAAcH,CAAd,CAAJ,EAAsB;UAClBA,CAAC,CAACD,IAAF,CAAOF,KAAP;SADJ,MAEO;UACHL,eAAe,CAACO,IAAhB,CAAqB,CAACF,KAAD,CAArB;;;KARZ;IAaA,OAAOL,eAAP;GApBoB,EAqBrB,CAACnC,KAAK,CAACG,QAAP,CArBqB,CAAxB;EAuBA,OACIL,4BAAA,CAACkC,QAAD,oBACQhC;IACJe,SAAS,EAAEC,EAAE,CAAC,sEAAD,EAAyEhB,KAAK,CAACe,SAA/E;IACbd,GAAG,EAAEA;IAHT,EAIKkC,eAAe,CAACY,GAAhB,CAAoB,CAACC,IAAD,EAAOC,CAAP,KACjBJ,KAAK,CAACC,OAAN,CAAcE,IAAd,IACIlD,4BAAA,MAAA;IACIiB,SAAS,EAAC;IACVmC,GAAG,EAAED;GAFT,EAGKD,IAHL,CADJ,GAOIA,IARP,CAJL,CADJ;AAkBH,CA1CY,CAAb;AA4CAd,IAAI,CAACD,KAAL,GAAaP,SAAb;MAwBayB,UAAU,gBAAGrD,cAAK,CAACC,UAAN,CAAiB,SAASoD,UAAT,CAAoBnD,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;AAW1BgD,UAAU,CAACjB,IAAX,GAAkBA,IAAlB;AACAiB,UAAU,CAACtD,IAAX,GAAkBA,IAAlB;AACAsD,UAAU,CAAC1B,KAAX,GAAmBA,KAAnB;;;;"}
1
+ {"version":3,"file":"Navigation.js","sources":["../../../../src/components/Navigation/Navigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { TreeviewProps, Treeview, TreeviewGroupProps, TreeviewItemProps } from '../Treeview/Treeview';\nimport { Icon } from '../Icon/Icon';\nimport { useDropTarget } from '../../utils/hooks/useDropTarget';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport './Navigation.css';\n\n// Item\nexport type NavigationItemProps = Omit<TreeviewItemProps, 'prefix'> & {\n /** Change the style to indicate the link is selected */\n active?: boolean;\n /** Handler to be used when dropping a dragged element over the navigation link */\n onDrop?: React.DragEventHandler;\n /**\n * Small amount of information placed next to the text of the link.\n * This can be any valid react element, for e.g. a `span`.\n * Should be used to indicate a relevant information of the link,\n * for e.g. the number of unread notifications\n */\n postfix?: React.ReactNode;\n /**\n * Small amount of information placed before the text of the link.\n * This can be any valid react element, for e.g. a `span`.\n * Should be used to indicate a feedback for user,\n * for e.g. display some sort of visual informational state or a relevant icon.\n */\n prefix?: React.ReactNode;\n /** Target of the link */\n target?: string;\n};\n\nconst Item = React.forwardRef(function Item(props: NavigationItemProps, ref: React.Ref<HTMLAnchorElement>) {\n const { active, children, onDrop, postfix, prefix, role, ...otherProps } = props;\n const proxyRef = useProxiedRef<HTMLAnchorElement>(ref);\n const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);\n const isTreeitem = role === 'treeitem';\n const className = cn(\n 'yt-navigation__item cursor-pointer',\n {\n 'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,\n 'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,\n 'yt-navigation__item--active': active && !isDraggedOver,\n 'bg-grey-dark': isTreeitem && active && !isDraggedOver,\n 'yt-navigation__item--dropping bg-blue': isDraggedOver,\n },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLSpanElement>): void => {\n if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {\n return;\n }\n\n if (proxyRef.current) {\n proxyRef.current.click();\n }\n };\n\n return (\n <span {...dropTargetProps} className={className} onClick={handleClick} role={role}>\n {prefix && <span className=\"yt-navigation__item__prefix flex items-center\">{prefix}</span>}\n <a {...otherProps} className=\"block flex-grow truncate\" ref={proxyRef}>\n {children}\n </a>\n {postfix && <span className=\"yt-navigation__item__postfix ml-1\">{postfix}</span>}\n </span>\n );\n});\n\n// Panel\nexport type NavigationPanelProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Panel = React.forwardRef(function Panel(props: NavigationPanelProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} className={cn('w-full bg-white p-3', props.className)} ref={ref} />;\n});\n\n// Group\nexport type NavigationMenuGroupProps = TreeviewGroupProps;\n\nconst MenuGroup = React.forwardRef(function MenuGroup(props: NavigationMenuGroupProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn(\n 'flex-shrink-0 space-y-1 outline-none',\n {\n 'bg-white pb-2': props.fixed,\n },\n typeof props.className === 'function' ? props.className(false) : props.className\n );\n const title = (expanded: boolean): JSX.Element => {\n const className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {\n 'mb-1': expanded,\n 'cursor-pointer hover:text-blue': !props.fixed,\n });\n\n return (\n <span className={className}>\n {typeof props.title === 'function' ? props.title(expanded) : props.title}\n {!props.fixed && <Icon name={expanded ? 'chevron-up' : 'chevron-down'} />}\n </span>\n );\n };\n\n return <Treeview.Group {...props} className={className} title={title} ref={ref} />;\n});\n\n// Menu\nexport type NavigationMenuProps = React.PropsWithChildren<TreeviewProps>;\n\nexport type ForwardedNavigationMenuWithStatics = React.ForwardRefExoticComponent<\n NavigationMenuProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Expandable region reprezenting a group of related links */\n Group: React.ForwardRefExoticComponent<NavigationMenuGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nconst Menu = React.forwardRef(function Menu(props: NavigationMenuProps, ref: React.Ref<HTMLDivElement>) {\n const scrollableAreas = React.useMemo(() => {\n const scrollableAreas: any[] = [];\n\n const children = React.Children.toArray(props.children).filter(\n child => !!child\n ) as React.ReactElement<NavigationMenuGroupProps>[];\n\n children.forEach(child => {\n if (child.props.fixed) {\n scrollableAreas.push(child);\n } else {\n const x = scrollableAreas[scrollableAreas.length - 1];\n if (Array.isArray(x)) {\n x.push(child);\n } else {\n scrollableAreas.push([child]);\n }\n }\n });\n\n return scrollableAreas;\n }, [props.children]);\n\n return (\n <Treeview\n {...props}\n className={cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className)}\n ref={ref}>\n {scrollableAreas.map((area, i) =>\n Array.isArray(area) ? (\n <div\n className=\"divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto\"\n key={i}>\n {area}\n </div>\n ) : (\n area\n )\n )}\n </Treeview>\n );\n}) as ForwardedNavigationMenuWithStatics;\n\nMenu.Group = MenuGroup;\n\n// Navigation\nexport type NavigationProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedNavigationWithStatics = React.ForwardRefExoticComponent<\n NavigationProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigation link */\n Item: React.ForwardRefExoticComponent<NavigationItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /**\n * Container for the expandable groups that hold navigation links.\n * Should be used as a direct child of Navigation component, e.g. `Navigation.Menu`.\n * Should have the menu groups as a direct child, e.g. `Navigation.Menu.Group`\n */\n Menu: ForwardedNavigationMenuWithStatics;\n /**\n * Isolated container within the Navigation.\n * This can be used to create a region in the Navigation that is usually not scrollable, nor expandable,\n * containing useful information for user and quick actions\n */\n Panel: React.ForwardRefExoticComponent<NavigationPanelProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Navigation = React.forwardRef(function Navigation(props: NavigationProps, ref: React.Ref<HTMLDivElement>) {\n const { children, ...otherProps } = props;\n const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);\n\n return (\n <div {...otherProps} className={className} data-taco=\"navigation\" ref={ref}>\n {children}\n </div>\n );\n}) as ForwardedNavigationWithStatics;\n\nNavigation.Menu = Menu;\nNavigation.Item = Item;\nNavigation.Panel = Panel;\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","forEach","push","x","length","Array","isArray","map","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,OAC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AAC,sEAAD,EAAyEhB,KAAK,CAACe,SAA/E;IACbd,GAAG,EAAEA;IAHT,EAIKkC,eAAe,CAACY,GAAhB,CAAoB,CAACC,IAAD,EAAOC,CAAP,KACjBJ,KAAK,CAACC,OAAN,CAAcE,IAAd,IACIlD,4BAAA,MAAA;IACIiB,SAAS,EAAC;IACVmC,GAAG,EAAED;GAFT,EAGKD,IAHL,CADJ,GAOIA,IARP,CAJL,CADJ;AAkBH,CA1CY,CAAb;AA4CAd,IAAI,CAACD,KAAL,GAAaP,SAAb;MAwBayB,UAAU,gBAAGrD,cAAK,CAACC,UAAN,CAAiB,SAASoD,UAAT,CAAoBnD,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;AAW1BgD,UAAU,CAACjB,IAAX,GAAkBA,IAAlB;AACAiB,UAAU,CAACtD,IAAX,GAAkBA,IAAlB;AACAsD,UAAU,CAAC1B,KAAX,GAAmBA,KAAnB;;;;"}
@@ -49,6 +49,7 @@ import '../Table/hooks/useRowCreation.js';
49
49
  import '../Tabs/Tabs.js';
50
50
  import '../Textarea/Textarea.js';
51
51
  import '../Switch/Switch.js';
52
+ import '../Tag/Tag.js';
52
53
  import '../Tour/Tour.js';
53
54
  import '../../utils/hooks/useOnClickOutside.js';
54
55
 
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\n\nexport type SearchInputTexts = {\n /**\n * aria-label text for input\n */\n inputLabel: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n if (!props.disabled) {\n onSearch?.(props.value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const isEnterKeyPressed = event.key === 'Enter';\n\n if (isEnterKeyPressed) {\n handleClick();\n }\n\n props.onKeyDown?.(event);\n };\n\n return (\n <Input\n aria-label={texts.searchInput.inputLabel}\n {...props}\n button={\n <IconButton\n icon=\"search\"\n className=\"!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent\"\n disabled={props.disabled}\n onClick={handleClick}\n />\n }\n onKeyDown={handleKeyDown}\n ref={ref}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","onSearch","props","ref","texts","useLocalization","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","key","onKeyDown","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAeaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,CACxC;EAAEE,QAAF;EAAY,GAAGC;AAAf,CADwC,EAExCC,GAFwC;EAIxC,MAAM;IAAEC;MAAUC,eAAe,EAAjC;;EAEA,MAAMC,WAAW,GAAG;IAChB,IAAI,CAACJ,KAAK,CAACK,QAAX,EAAqB;MACjBN,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACM,KAAT,CAAR;;GAFR;;EAMA,MAAMC,aAAa,GAAIC,KAAD;;;IAClB,MAAMC,iBAAiB,GAAGD,KAAK,CAACE,GAAN,KAAc,OAAxC;;IAEA,IAAID,iBAAJ,EAAuB;MACnBL,WAAW;;;IAGf,oBAAAJ,KAAK,CAACW,SAAN,2EAAAX,KAAK,EAAaQ,KAAb,CAAL;GAPJ;;EAUA,OACIV,aAAA,CAACc,KAAD;kBACgBV,KAAK,CAACW,WAAN,CAAkBC;KAC1Bd;IACJe,MAAM,EACFjB,aAAA,CAACkB,UAAD;MACIC,IAAI,EAAC;MACLC,SAAS,EAAC;MACVb,QAAQ,EAAEL,KAAK,CAACK;MAChBc,OAAO,EAAEf;KAJb;IAOJO,SAAS,EAAEJ;IACXN,GAAG,EAAEA;IACLmB,IAAI,EAAC;IAbT,CADJ;AAiBH,CAvC0B;;;;"}
1
+ {"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\n\nexport type SearchInputTexts = {\n /**\n * aria-label text for input\n */\n inputLabel: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n if (!props.disabled) {\n onSearch?.(props.value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const isEnterKeyPressed = event.key === 'Enter';\n\n if (isEnterKeyPressed) {\n handleClick();\n }\n\n props.onKeyDown?.(event);\n };\n\n return (\n <Input\n aria-label={texts.searchInput.inputLabel}\n {...props}\n button={\n <IconButton\n icon=\"search\"\n className=\"!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent\"\n disabled={props.disabled}\n onClick={handleClick}\n />\n }\n onKeyDown={handleKeyDown}\n ref={ref}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","onSearch","props","ref","texts","useLocalization","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","key","onKeyDown","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAeaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,CACxC;EAAEE,QAAF;EAAY,GAAGC;AAAf,CADwC,EAExCC,GAFwC;EAIxC,MAAM;IAAEC;MAAUC,eAAe,EAAjC;;EAEA,MAAMC,WAAW,GAAG;IAChB,IAAI,CAACJ,KAAK,CAACK,QAAX,EAAqB;MACjBN,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACM,KAAT,CAAR;;GAFR;;EAMA,MAAMC,aAAa,GAAIC,KAAD;;;IAClB,MAAMC,iBAAiB,GAAGD,KAAK,CAACE,GAAN,KAAc,OAAxC;;IAEA,IAAID,iBAAJ,EAAuB;MACnBL,WAAW;;;IAGf,oBAAAJ,KAAK,CAACW,SAAN,2EAAAX,KAAK,EAAaQ,KAAb,CAAL;GAPJ;;EAUA,OACIV,aAAA,CAACc,KAAD;kBACgBV,KAAK,CAACW,WAAN,CAAkBC;KAC1Bd;IACJe,MAAM,EACFjB,aAAA,CAACkB,UAAD;MACIC,IAAI,EAAC;MACLC,SAAS,EAAC;MACVb,QAAQ,EAAEL,KAAK,CAACK;MAChBc,OAAO,EAAEf;KAJb;IAOJO,SAAS,EAAEJ;IACXN,GAAG,EAAEA;IACLmB,IAAI,EAAC;IAbT,CADJ;AAiBH,CAvC0B;;;;"}
@@ -0,0 +1,53 @@
1
+ import React__default from 'react';
2
+ import cn from 'classnames';
3
+ import { Icon } from '../Icon/Icon.js';
4
+ import { Tooltip } from '../Tooltip/Tooltip.js';
5
+ import { colors } from '../../utils/colors.js';
6
+ import { useIsRefOverflowing } from '../../hooks/useIsRefOverflowing.js';
7
+
8
+ const Tag = /*#__PURE__*/React__default.forwardRef((props, ref) => {
9
+ const {
10
+ children,
11
+ color,
12
+ disabled,
13
+ icon,
14
+ readOnly,
15
+ onDelete,
16
+ ...otherProps
17
+ } = props;
18
+ const textRef = React__default.useRef(null);
19
+ const isOverflowed = useIsRefOverflowing(textRef);
20
+ const className = cn('inline-flex items-center rounded h-6 cursor-default', {
21
+ 'bg-opacity-50': disabled,
22
+ 'hover:bg-opacity-75': !disabled,
23
+ 'cursor-pointer': !!otherProps.onClick,
24
+ 'pointer-events-none': disabled || readOnly
25
+ }, color ? colors[color] : 'bg-grey-dark', props.className);
26
+ const content = React__default.createElement("span", Object.assign({}, otherProps, {
27
+ className: className,
28
+ ref: ref
29
+ }), React__default.createElement("span", {
30
+ className: "truncate px-2",
31
+ ref: textRef
32
+ }, icon ? typeof icon === 'string' ? React__default.createElement(Icon, {
33
+ name: icon,
34
+ className: "mr-1 -ml-1 -mt-0.5 !h-5 !w-5"
35
+ }) : React__default.cloneElement(icon, {
36
+ className: 'mr-1 -ml-1 -mt-0.5 !h-5 !w-5'
37
+ }) : null, children), onDelete ? React__default.createElement(Icon, {
38
+ name: "close",
39
+ onClick: onDelete,
40
+ className: "-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
41
+ }) : null);
42
+
43
+ if (isOverflowed) {
44
+ return React__default.createElement(Tooltip, {
45
+ title: children
46
+ }, content);
47
+ }
48
+
49
+ return content;
50
+ });
51
+
52
+ export { Tag };
53
+ //# sourceMappingURL=Tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tag.js","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Color, colors } from '../../utils/colors';\nimport { Icon, IconName, IconProps } from '../Icon/Icon';\nimport { Tooltip } from '../Tooltip/Tooltip';\nimport { useIsRefOverflowing } from '../../hooks/useIsRefOverflowing';\n\nexport type TagProps = Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n children: string;\n color?: Color;\n disabled?: boolean;\n icon?: React.ReactElement<IconProps> | IconName;\n readOnly?: boolean;\n onDelete?: (event: React.MouseEvent<SVGSVGElement>) => void;\n};\n\nexport const Tag = React.forwardRef<HTMLSpanElement, TagProps>((props, ref) => {\n const { children, color, disabled, icon, readOnly, onDelete, ...otherProps } = props;\n const textRef = React.useRef<HTMLDivElement>(null);\n const isOverflowed = useIsRefOverflowing(textRef);\n\n const className = cn(\n 'inline-flex items-center rounded h-6 cursor-default',\n {\n 'bg-opacity-50': disabled,\n 'hover:bg-opacity-75': !disabled,\n 'cursor-pointer': !!otherProps.onClick,\n 'pointer-events-none': disabled || readOnly,\n },\n color ? colors[color] : 'bg-grey-dark',\n props.className\n );\n\n const content = (\n <span {...otherProps} className={className} ref={ref}>\n <span className=\"truncate px-2\" ref={textRef}>\n {icon ? (\n typeof icon === 'string' ? (\n <Icon name={icon} className=\"mr-1 -ml-1 -mt-0.5 !h-5 !w-5\" />\n ) : (\n React.cloneElement(icon, { className: 'mr-1 -ml-1 -mt-0.5 !h-5 !w-5' })\n )\n ) : null}\n {children}\n </span>\n {onDelete ? (\n <Icon\n name=\"close\"\n onClick={onDelete}\n className=\"-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5\"\n />\n ) : null}\n </span>\n );\n\n if (isOverflowed) {\n return <Tooltip title={children}>{content}</Tooltip>;\n }\n\n return content;\n});\n"],"names":["Tag","React","forwardRef","props","ref","children","color","disabled","icon","readOnly","onDelete","otherProps","textRef","useRef","isOverflowed","useIsRefOverflowing","className","cn","onClick","colors","content","Icon","name","cloneElement","Tooltip","title"],"mappings":";;;;;;;MAgBaA,GAAG,gBAAGC,cAAK,CAACC,UAAN,CAA4C,CAACC,KAAD,EAAQC,GAAR;EAC3D,MAAM;IAAEC,QAAF;IAAYC,KAAZ;IAAmBC,QAAnB;IAA6BC,I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-content-transform-origin)'
25
25
  }
26
26
  }, createElement(Arrow, {
27
- className: "fill-purple stroke-purple"
27
+ className: "fill-purple stroke-purple -mt-px"
28
28
  }), title)));
29
29
  });
30
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nexport type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Text displayed in the tooltip */\n title: string;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, ...otherProps } = props;\n\n return (\n <TooltipPrimitive.Root delayDuration={50}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content {...otherProps} asChild side={placement} sideOffset={3}>\n <div\n className=\"wcag-purple xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold opacity-90\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"fill-purple stroke-purple\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","otherProps","TooltipPrimitive","delayDuration","asChild","side","sideOffset","className","style","transformOrigin"],"mappings":";;;MAeaA,OAAO,gBAAGC,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACpC,MAAM;IAAEC,KAAF;IAASC,QAAT;IAAmBC,SAAnB;IAA8B,GAAGC;MAAeL,KAAtD;EAEA,OACID,aAAA,CAACO,IAAD;IAAuBC,aAAa,EAAE;GAAtC,EACIR,aAAA,CAACO,OAAD;IAA0BE,OAAO;IAACP,GAAG,EAAEA;GAAvC,EACKE,QADL,CADJ,EAIIJ,aAAA,CAACO,OAAD,oBAA8BD;IAAYG,OAAO;IAACC,IAAI,EAAEL;IAAWM,UAAU,EAAE;IAA/E,EACIX,aAAA,MAAA;IACIY,SAAS,EAAC;iBACA;IACVC,KAAK,EAAE;MACHC,eAAe,EAAE;;GAJzB,EAMId,aAAA,CAACO,KAAD;IAAwBK,SAAS,EAAC;GAAlC,CANJ,EAOKT,KAPL,CADJ,CAJJ,CADJ;AAkBH,CArBsB;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nexport type TooltipProps = React.HTMLAttributes<HTMLDivElement> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Text displayed in the tooltip */\n title: string;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, ...otherProps } = props;\n\n return (\n <TooltipPrimitive.Root delayDuration={50}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content {...otherProps} asChild side={placement} sideOffset={3}>\n <div\n className=\"wcag-purple xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm px-2 py-1 text-xs font-bold opacity-90\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"fill-purple stroke-purple -mt-px\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","otherProps","TooltipPrimitive","delayDuration","asChild","side","sideOffset","className","style","transformOrigin"],"mappings":";;;MAeaA,OAAO,gBAAGC,UAAA,CAAiB,SAASD,OAAT,CAAiBE,KAAjB,EAAsCC,GAAtC;EACpC,MAAM;IAAEC,KAAF;IAASC,QAAT;IAAmBC,SAAnB;IAA8B,GAAGC;MAAeL,KAAtD;EAEA,OACID,aAAA,CAACO,IAAD;IAAuBC,aAAa,EAAE;GAAtC,EACIR,aAAA,CAACO,OAAD;IAA0BE,OAAO;IAACP,GAAG,EAAEA;GAAvC,EACKE,QADL,CADJ,EAIIJ,aAAA,CAACO,OAAD,oBAA8BD;IAAYG,OAAO;IAACC,IAAI,EAAEL;IAAWM,UAAU,EAAE;IAA/E,EACIX,aAAA,MAAA;IACIY,SAAS,EAAC;iBACA;IACVC,KAAK,EAAE;MACHC,eAAe,EAAE;;GAJzB,EAMId,aAAA,CAACO,KAAD;IAAwBK,SAAS,EAAC;GAAlC,CANJ,EAOKT,KAPL,CADJ,CAJJ,CADJ;AAkBH,CArBsB;;;;"}
@@ -0,0 +1,15 @@
1
+ import React__default from 'react';
2
+ import { isOverflowing } from '../utils/dom.js';
3
+
4
+ const useIsRefOverflowing = ref => {
5
+ const [overflowing, setOverflowing] = React__default.useState(false);
6
+ React__default.useEffect(() => {
7
+ if (ref.current && isOverflowing(ref.current)) {
8
+ setOverflowing(true);
9
+ }
10
+ }, [ref.current]);
11
+ return overflowing;
12
+ };
13
+
14
+ export { useIsRefOverflowing };
15
+ //# sourceMappingURL=useIsRefOverflowing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsRefOverflowing.js","sources":["../../../src/hooks/useIsRefOverflowing.ts"],"sourcesContent":["import React from 'react';\nimport { isOverflowing } from '../utils/dom';\n\nexport const useIsRefOverflowing = (ref: React.RefObject<HTMLElement>) => {\n const [overflowing, setOverflowing] = React.useState(false);\n\n React.useEffect(() => {\n if (ref.current && isOverflowing(ref.current)) {\n setOverflowing(true);\n }\n }, [ref.current]);\n\n return overflowing;\n};\n"],"names":["useIsRefOverflowing","ref","overflowing","setOverflowing","React","useState","useEffect","current","isOverflowing"],"mappings":";;;MAGaA,mBAAmB,GAAIC,GAAD;EAC/B,MAAM,CAACC,WAAD,EAAcC,cAAd,IAAgCC,cAAK,CAACC,QAAN,CAAe,KAAf,CAAtC;EAEAD,cAAK,CAACE,SAAN,CAAgB;IACZ,IAAIL,GAAG,CAACM,OAAJ,IAAeC,aAAa,CAACP,GAAG,CAACM,OAAL,CAAhC,EAA+C;MAC3CJ,cAAc,CAAC,IAAD,CAAd;;GAFR,EAIG,CAACF,GAAG,CAACM,OAAL,CAJH;EAMA,OAAOL,WAAP;AACH;;;;"}
package/dist/esm/index.js CHANGED
@@ -49,6 +49,7 @@ export { insertChildTableRow, removeChildTableRow, useTableRowCreation } from '.
49
49
  export { Tabs } from './components/Tabs/Tabs.js';
50
50
  export { Textarea } from './components/Textarea/Textarea.js';
51
51
  export { Switch } from './components/Switch/Switch.js';
52
+ export { Tag } from './components/Tag/Tag.js';
52
53
  export { Tour, TourStep } from './components/Tour/Tour.js';
53
54
  export { useOnClickOutside } from './utils/hooks/useOnClickOutside.js';
54
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,15 @@
1
+ const colors = {
2
+ green: 'bg-[#E5FAF2] text-[#124537]',
3
+ yellow: 'bg-[#FCF0D0] text-[#733700]',
4
+ red: 'bg-[#FFDAD2] text-[#6E001D]',
5
+ blue: 'bg-[#DEEBFF] text-[#29283E]',
6
+ purple: 'bg-[#EEE5FF] text-[#412970]',
7
+ orange: 'bg-[#FFE3BB] text-[#4A2811]',
8
+ brown: 'bg-[#EEE0DA] text-[#45291F]',
9
+ pink: 'bg-[#FFE3F7] text-[#55003E]',
10
+ grey: 'bg-grey-light text-grey-darkest',
11
+ black: 'bg-grey-darkest text-white'
12
+ };
13
+
14
+ export { colors };
15
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sources":["../../../src/utils/colors.ts"],"sourcesContent":["export const colors = {\n green: 'bg-[#E5FAF2] text-[#124537]',\n yellow: 'bg-[#FCF0D0] text-[#733700]',\n red: 'bg-[#FFDAD2] text-[#6E001D]',\n blue: 'bg-[#DEEBFF] text-[#29283E]',\n purple: 'bg-[#EEE5FF] text-[#412970]',\n orange: 'bg-[#FFE3BB] text-[#4A2811]',\n brown: 'bg-[#EEE0DA] text-[#45291F]',\n pink: 'bg-[#FFE3F7] text-[#55003E]',\n grey: 'bg-grey-light text-grey-darkest',\n black: 'bg-grey-darkest text-white',\n};\n\nexport type Color = keyof typeof colors;\n"],"names":["colors","green","yellow","red","blue","purple","orange","brown","pink","grey","black"],"mappings":"MAAaA,MAAM,GAAG;EAClBC,KAAK,EAAE,6BADW;EAElBC,MAAM,EAAE,6BAFU;EAGlBC,GAAG,EAAE,6BAHa;EAIlBC,IAAI,EAAE,6BAJY;EAKlBC,MAAM,EAAE,6BALU;EAMlBC,MAAM,EAAE,6BANU;EAOlBC,KAAK,EAAE,6BAPW;EAQlBC,IAAI,EAAE,6BARY;EASlBC,IAAI,EAAE,iCATY;EAUlBC,KAAK,EAAE;AAVW;;;;"}
@@ -0,0 +1,4 @@
1
+ const isOverflowing = element => element !== null ? element.scrollWidth > element.offsetWidth : false;
2
+
3
+ export { isOverflowing };
4
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.js","sources":["../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n"],"names":["isOverflowing","element","scrollWidth","offsetWidth"],"mappings":"MAAaA,aAAa,GAAIC,OAAD,IACzBA,OAAO,KAAK,IAAZ,GAAmBA,OAAO,CAACC,WAAR,GAAsBD,OAAO,CAACE,WAAjD,GAA+D;;;;"}
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const useIsRefOverflowing: (ref: React.RefObject<HTMLElement>) => boolean;
package/dist/index.d.ts CHANGED
@@ -34,6 +34,7 @@ export * from './components/Tabs/Tabs';
34
34
  export * from './components/Textarea/Textarea';
35
35
  export * from './components/Toast/Toaster';
36
36
  export * from './components/Switch/Switch';
37
+ export * from './components/Tag/Tag';
37
38
  export * from './components/Tooltip/Tooltip';
38
39
  export * from './components/Tour/Tour';
39
40
  export * from './components/Treeview/Treeview';