@economic/taco 1.37.0 → 1.38.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/components/Checkbox/Checkbox.d.ts +0 -1
  2. package/dist/components/Input/util.d.ts +1 -1
  3. package/dist/components/Table2/hooks/useColumnDefinitions.d.ts +1 -1
  4. package/dist/components/Table2/types.d.ts +1 -1
  5. package/dist/components/Tabs/Tabs.d.ts +0 -1
  6. package/dist/esm/index.css +0 -20
  7. package/dist/esm/packages/taco/src/components/Button/Button.js +0 -2
  8. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/Button/util.js +7 -7
  10. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +7 -8
  12. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +5 -8
  14. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +6 -5
  16. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Field/Field.js +1 -1
  18. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Header/components/Button.js +1 -1
  20. package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Header/components/Link.js +2 -2
  22. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js +1 -3
  24. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
  26. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Input/util.js +11 -11
  28. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +6 -4
  30. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +14 -6
  32. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -2
  34. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Switch/Switch.js +3 -3
  36. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js +4 -2
  38. package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js +4 -3
  40. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js +3 -1
  42. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Table2/types.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +21 -8
  45. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  46. package/dist/index.css +0 -20
  47. package/dist/taco.cjs.development.js +96 -77
  48. package/dist/taco.cjs.development.js.map +1 -1
  49. package/dist/taco.cjs.production.min.js +1 -1
  50. package/dist/taco.cjs.production.min.js.map +1 -1
  51. package/package.json +2 -2
  52. package/plugins/tailwindcss-aria-attributes.js +20 -36
  53. package/tailwind.config.js +6 -2
  54. package/types.json +7 -4
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  declare type CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {
3
- highlighted?: boolean;
4
3
  /**
5
4
  * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all
6
5
  * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.
@@ -1,2 +1,2 @@
1
1
  export declare const getInputClasses: (props: any) => string;
2
- export declare const getButtonStateClasses: (invalid: boolean | undefined) => string;
2
+ export declare const getButtonStateClasses: (invalid: boolean | undefined, disabled?: boolean) => string;
@@ -8,7 +8,7 @@ declare module '@tanstack/table-core' {
8
8
  control?: Table2ColumnControlRenderer;
9
9
  dataType?: ColumnDataType;
10
10
  disableReordering?: boolean;
11
- defaultWidth?: number;
11
+ defaultWidth?: number | 'grow';
12
12
  headerClassName?: string;
13
13
  menu?: Table2ColumnHeaderMenu;
14
14
  tooltip?: string;
@@ -57,7 +57,7 @@ export declare type Table2ColumnProps<TType = any> = {
57
57
  disableReordering?: boolean;
58
58
  disableResizing?: boolean;
59
59
  disableSorting?: boolean;
60
- defaultWidth?: number;
60
+ defaultWidth?: number | 'grow';
61
61
  header: string;
62
62
  headerClassName?: string;
63
63
  footer?: Table2ColumnFooterRenderer;
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { Orientation } from '../../types';
3
- import './Tabs.css';
4
3
  export declare type TabsProps = React.HTMLAttributes<HTMLDivElement> & {
5
4
  /**
6
5
  * The controlled value of the tab to activate. Should be used in conjunction with `onChange`.
@@ -638,23 +638,3 @@
638
638
  #yt-table__drag__placeholder {
639
639
  @apply flex w-3/12 rounded bg-blue-500 p-4 font-bold text-white;
640
640
  }
641
-
642
- .yt-tabs .yt-tab__list[aria-orientation='vertical'] {
643
- @apply m-0 mr-4 flex-col border-0 border-r;
644
- }
645
-
646
- .yt-tabs .yt-tab__list[aria-orientation='vertical'] .yt-tab {
647
- @apply h-8 py-0;
648
- }
649
-
650
- .yt-tabs.yt-tabs--vertical .yt-tab__list {
651
- @apply flex-initial;
652
- }
653
-
654
- .yt-tabs.yt-tabs--vertical .yt-tab__panel {
655
- @apply flex-grow;
656
- }
657
-
658
- .yt-tabs .yt-tab__list[aria-orientation='vertical'] .yt-tab {
659
- @apply rounded-none rounded-l border-0 border-r-2;
660
- }
@@ -10,8 +10,6 @@ const Base = /*#__PURE__*/forwardRef(function ButtonBase(props, ref) {
10
10
  ...otherProps
11
11
  } = props;
12
12
  const className = cn(getButtonClasses(), getAppearanceClasses(appearance), 'rounded px-3', {
13
- 'cursor-not-allowed opacity-50': props.disabled,
14
- 'focus:yt-focus active:focus:yt-focus': !props.disabled,
15
13
  'w-full': fluid
16
14
  }, props.className);
17
15
  return createButtonWithTooltip({
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { getAppearanceClasses, getButtonClasses, createButtonWithTooltip, createButtonWithOverlays } from './util';\nimport { HangerProps } from '../Hanger/Hanger';\nimport { MenuProps } from '../Menu/Menu';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { PopoverProps } from '../Popover/Popover';\nimport './Button.css';\nimport { Icon } from '../Icon/Icon';\nimport { DrawerProps } from '../Drawer/Drawer';\n\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n /**\n * Drawer component associated with the button, clicking the button will open the drawer.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated drawer when clicked.\n */\n drawer?: (props: Partial<DrawerProps>) => JSX.Element;\n /** If fluid, button expands to the width of it's container */\n fluid?: boolean;\n /** Hanger component associated with the button. */\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\n /** A tooltip to show when hovering over the button */\n tooltip?: string | JSX.Element;\n};\n\nconst Base = React.forwardRef(function ButtonBase(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { appearance, fluid, ...otherProps } = props;\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(appearance),\n 'rounded px-3',\n {\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n 'w-full': fluid,\n },\n props.className\n );\n\n return createButtonWithTooltip({ ...otherProps, 'data-taco': 'button' }, className, ref);\n});\n\nexport const Button = React.forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { dialog, drawer, hanger, menu, popover, ...buttonProps } = props;\n\n let children = buttonProps.children;\n\n // add a chevron icon to menu buttons\n if (typeof menu === 'function') {\n children = Array.isArray(children)\n ? [...children, <Icon key=\"chevron-down\" name=\"chevron-down\" />]\n : [children, <Icon key=\"chevron-down\" name=\"chevron-down\" />];\n }\n\n const button = (\n <Base {...buttonProps} ref={ref}>\n {children}\n </Base>\n );\n\n return createButtonWithOverlays({ dialog, drawer, hanger, menu, popover }, button);\n});\n"],"names":["Base","React","ButtonBase","props","ref","appearance","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","disabled","createButtonWithTooltip","Button","dialog","drawer","hanger","menu","popover","buttonProps","children","Array","isArray","Icon","key","name","button","createButtonWithOverlays"],"mappings":";;;;;AA4CA,MAAMA,IAAI,gBAAGC,UAAgB,CAAC,SAASC,UAAU,CAACC,KAAkB,EAAEC,GAAqD;EACvH,MAAM;IAAEC,UAAU;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAClD,MAAMK,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EAAE,EAClBC,oBAAoB,CAACN,UAAU,CAAC,EAChC,cAAc,EACd;IACI,+BAA+B,EAAEF,KAAK,CAACS,QAAQ;IAC/C,sCAAsC,EAAE,CAACT,KAAK,CAACS,QAAQ;IACvD,QAAQ,EAAEN;GACb,EACDH,KAAK,CAACK,SAAS,CAClB;EAED,OAAOK,uBAAuB,CAAC;IAAE,GAAGN,UAAU;IAAE,WAAW,EAAE;GAAU,EAAEC,SAAS,EAAEJ,GAAG,CAAC;AAC5F,CAAC,CAAC;MAEWU,MAAM,gBAAGb,UAAgB,CAAC,SAASa,MAAM,CAClDX,KAAkB,EAClBC,GAAqD;EAErD,MAAM;IAAEW,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGjB,KAAK;EAEvE,IAAIkB,QAAQ,GAAGD,WAAW,CAACC,QAAQ;;EAGnC,IAAI,OAAOH,IAAI,KAAK,UAAU,EAAE;IAC5BG,QAAQ,GAAGC,KAAK,CAACC,OAAO,CAACF,QAAQ,CAAC,GAC5B,CAAC,GAAGA,QAAQ,eAAEpB,cAACuB,IAAI;MAACC,GAAG,EAAC,cAAc;MAACC,IAAI,EAAC;MAAiB,CAAC,GAC9D,CAACL,QAAQ,eAAEpB,cAACuB,IAAI;MAACC,GAAG,EAAC,cAAc;MAACC,IAAI,EAAC;MAAiB,CAAC;;EAGrE,MAAMC,MAAM,gBACR1B,cAACD,IAAI,oBAAKoB,WAAW;IAAEhB,GAAG,EAAEA;MACvBiB,QAAQ,CAEhB;EAED,OAAOO,wBAAwB,CAAC;IAAEb,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,EAAEQ,MAAM,CAAC;AACtF,CAAC;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { getAppearanceClasses, getButtonClasses, createButtonWithTooltip, createButtonWithOverlays } from './util';\nimport { HangerProps } from '../Hanger/Hanger';\nimport { MenuProps } from '../Menu/Menu';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { PopoverProps } from '../Popover/Popover';\nimport './Button.css';\nimport { Icon } from '../Icon/Icon';\nimport { DrawerProps } from '../Drawer/Drawer';\n\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n /**\n * Drawer component associated with the button, clicking the button will open the drawer.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated drawer when clicked.\n */\n drawer?: (props: Partial<DrawerProps>) => JSX.Element;\n /** If fluid, button expands to the width of it's container */\n fluid?: boolean;\n /** Hanger component associated with the button. */\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\n /** A tooltip to show when hovering over the button */\n tooltip?: string | JSX.Element;\n};\n\nconst Base = React.forwardRef(function ButtonBase(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { appearance, fluid, ...otherProps } = props;\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(appearance),\n 'rounded px-3',\n {\n 'w-full': fluid,\n },\n props.className\n );\n\n return createButtonWithTooltip({ ...otherProps, 'data-taco': 'button' }, className, ref);\n});\n\nexport const Button = React.forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { dialog, drawer, hanger, menu, popover, ...buttonProps } = props;\n\n let children = buttonProps.children;\n\n // add a chevron icon to menu buttons\n if (typeof menu === 'function') {\n children = Array.isArray(children)\n ? [...children, <Icon key=\"chevron-down\" name=\"chevron-down\" />]\n : [children, <Icon key=\"chevron-down\" name=\"chevron-down\" />];\n }\n\n const button = (\n <Base {...buttonProps} ref={ref}>\n {children}\n </Base>\n );\n\n return createButtonWithOverlays({ dialog, drawer, hanger, menu, popover }, button);\n});\n"],"names":["Base","React","ButtonBase","props","ref","appearance","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","createButtonWithTooltip","Button","dialog","drawer","hanger","menu","popover","buttonProps","children","Array","isArray","Icon","key","name","button","createButtonWithOverlays"],"mappings":";;;;;AA4CA,MAAMA,IAAI,gBAAGC,UAAgB,CAAC,SAASC,UAAU,CAACC,KAAkB,EAAEC,GAAqD;EACvH,MAAM;IAAEC,UAAU;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAClD,MAAMK,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EAAE,EAClBC,oBAAoB,CAACN,UAAU,CAAC,EAChC,cAAc,EACd;IACI,QAAQ,EAAEC;GACb,EACDH,KAAK,CAACK,SAAS,CAClB;EAED,OAAOI,uBAAuB,CAAC;IAAE,GAAGL,UAAU;IAAE,WAAW,EAAE;GAAU,EAAEC,SAAS,EAAEJ,GAAG,CAAC;AAC5F,CAAC,CAAC;MAEWS,MAAM,gBAAGZ,UAAgB,CAAC,SAASY,MAAM,CAClDV,KAAkB,EAClBC,GAAqD;EAErD,MAAM;IAAEU,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGhB,KAAK;EAEvE,IAAIiB,QAAQ,GAAGD,WAAW,CAACC,QAAQ;;EAGnC,IAAI,OAAOH,IAAI,KAAK,UAAU,EAAE;IAC5BG,QAAQ,GAAGC,KAAK,CAACC,OAAO,CAACF,QAAQ,CAAC,GAC5B,CAAC,GAAGA,QAAQ,eAAEnB,cAACsB,IAAI;MAACC,GAAG,EAAC,cAAc;MAACC,IAAI,EAAC;MAAiB,CAAC,GAC9D,CAACL,QAAQ,eAAEnB,cAACsB,IAAI;MAACC,GAAG,EAAC,cAAc;MAACC,IAAI,EAAC;MAAiB,CAAC;;EAGrE,MAAMC,MAAM,gBACRzB,cAACD,IAAI,oBAAKmB,WAAW;IAAEf,GAAG,EAAEA;MACvBgB,QAAQ,CAEhB;EAED,OAAOO,wBAAwB,CAAC;IAAEb,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,EAAEQ,MAAM,CAAC;AACtF,CAAC;;;;"}
@@ -3,25 +3,25 @@ import { Button } from '../../primitives/Button.js';
3
3
  import { Tooltip } from '../Tooltip/Tooltip.js';
4
4
 
5
5
  const getButtonClasses = () => {
6
- return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';
6
+ return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus disabled:cursor-not-allowed';
7
7
  };
8
8
  const getAppearanceClasses = (value, icon = false) => {
9
9
  switch (value) {
10
10
  case 'primary':
11
- return `wcag-blue-500 focus:bg-blue-500 focus:text-white focus:yt-focus active:bg-blue-700 active:text-white hover:bg-blue-300 hover:text-white hover:focus:bg-blue-300 hover:focus:border-blue-300 hover:focus:text-white disabled:hover:wcag-blue-500 disabled:hover:hover:border-blue-500`;
11
+ return `wcag-blue-500 enabled:hover:wcag-blue-700 enabled:hover:active:wcag-blue-500 disabled:bg-blue-500/50`;
12
12
  case 'danger':
13
- return `wcag-red-500 focus:bg-red-500 focus:text-white focus:yt-focus-red active:bg-red-700 active:text-white hover:bg-red-300 hover:text-white hover:focus:bg-red-300 hover:focus:text-white disabled:hover:wcag-red-500`;
13
+ return `wcag-red-500 enabled:hover:wcag-red-700 enabled:hover:active:wcag-red-500 disabled:bg-red-500/50`;
14
14
  case 'ghost':
15
- return `bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.500)] text-blue-500 focus:bg-transparent focus:text-blue-500 active:bg-blue-100 focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.500),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-700 hover:bg-blue-100 hover:shadow-[inset_0_0_0_1px_theme(colors.blue.300)] hover:text-blue-300 hover:focus:bg-blue-100 hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.300),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-300`;
15
+ return `bg-white border border-blue-500 text-blue-500 enabled:hover:bg-blue-100 enabled:hover:text-blue-700 disabled:border-blue-500/50 disabled:text-blue-500/50`;
16
16
  case 'discrete':
17
17
  {
18
18
  if (icon) {
19
- return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-700 hover:focus:text-grey-700 disabled:hover:text-black `;
19
+ return `bg-transparent text-black enabled:hover:bg-grey-200/80 disabled:text-black/30`;
20
20
  }
21
- return `yt-transparent focus:text-blue-500 focus:yt-focus active:text-blue-700 hover:text-blue-300 hover:focus:text-blue-300 disabled:hover:yt-transparent`;
21
+ return `bg-transparent text-blue-500 enabled:hover:text-blue-700 disabled:text-blue-500/50`;
22
22
  }
23
23
  default:
24
- return `wcag-grey-200 focus:bg-grey-200 focus:yt-focus active:bg-grey-300 active:text-black hover:bg-grey-100 hover:text-grey-700 hover:focus:bg-grey-100 hover:focus:text-grey-700 disabled:hover:wcag-grey-200`;
24
+ return `wcag-grey-200 enabled:hover:wcag-grey-300 disabled:bg-grey-200/50 disabled:text-black/30`;
25
25
  }
26
26
  };
27
27
  const createButtonWithTooltip = (props, className, ref) => {
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `wcag-blue-500 focus:bg-blue-500 focus:text-white focus:yt-focus active:bg-blue-700 active:text-white hover:bg-blue-300 hover:text-white hover:focus:bg-blue-300 hover:focus:border-blue-300 hover:focus:text-white disabled:hover:wcag-blue-500 disabled:hover:hover:border-blue-500`;\n\n case 'danger':\n return `wcag-red-500 focus:bg-red-500 focus:text-white focus:yt-focus-red active:bg-red-700 active:text-white hover:bg-red-300 hover:text-white hover:focus:bg-red-300 hover:focus:text-white disabled:hover:wcag-red-500`;\n\n case 'ghost':\n return `bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.500)] text-blue-500 focus:bg-transparent focus:text-blue-500 active:bg-blue-100 focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.500),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-700 hover:bg-blue-100 hover:shadow-[inset_0_0_0_1px_theme(colors.blue.300)] hover:text-blue-300 hover:focus:bg-blue-100 hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.300),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-300`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-700 hover:focus:text-grey-700 disabled:hover:text-black `;\n }\n\n return `yt-transparent focus:text-blue-500 focus:yt-focus active:text-blue-700 hover:text-blue-300 hover:focus:text-blue-300 disabled:hover:yt-transparent`;\n }\n\n default:\n return `wcag-grey-200 focus:bg-grey-200 focus:yt-focus active:bg-grey-300 active:text-black hover:bg-grey-100 hover:text-grey-700 hover:focus:bg-grey-100 hover:focus:text-grey-700 disabled:hover:wcag-grey-200`;\n }\n};\n\nexport const createButtonWithTooltip = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { tooltip, ...buttonProps } = props;\n const button = <ButtonPrimitive.Button {...buttonProps} className={className} ref={ref} />;\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n\nexport const createButtonWithOverlays = (props: any, buttonBase: JSX.Element) => {\n const { dialog, drawer, hanger, menu, popover } = props;\n let button = buttonBase;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof drawer === 'function') {\n button = drawer({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButtonWithTooltip","props","className","ref","tooltip","buttonProps","button","React","ButtonPrimitive","Tooltip","title","createButtonWithOverlays","buttonBase","dialog","drawer","hanger","menu","popover","trigger","anchor"],"mappings":";;;;MAKaA,gBAAgB,GAAG;EAC5B,OAAO,+HAA+H;AAC1I;MAEaC,oBAAoB,GAAG,CAACC,KAA6B,EAAEC,IAAI,GAAG,KAAK;EAC5E,QAAQD,KAAK;IACT,KAAK,SAAS;MACV,6RAA6R;IAEjS,KAAK,QAAQ;MACT,0NAA0N;IAE9N,KAAK,OAAO;MACR,8dAA8d;IAEle,KAAK,UAAU;MAAE;QACb,IAAIC,IAAI,EAAE;UACN,gLAAgL;;QAGpL,2JAA2J;;IAG/J;MACI,iNAAiN;;AAE7N;MAEaC,uBAAuB,GAAG,CACnCC,KAAU,EACVC,SAAiB,EACjBC,GAAqD;EAErD,MAAM;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGJ,KAAK;EACzC,MAAMK,MAAM,gBAAGC,6BAACC,MAAsB,oBAAKH,WAAW;IAAEH,SAAS,EAAEA,SAAS;IAAEC,GAAG,EAAEA;KAAO;EAE1F,IAAIC,OAAO,EAAE;IACT,oBAAOG,6BAACE,OAAO;MAACC,KAAK,EAAEN;OAAUE,MAAM,CAAW;;EAGtD,OAAOA,MAAM;AACjB;MAEaK,wBAAwB,GAAG,CAACV,KAAU,EAAEW,UAAuB;EACxE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,GAAGhB,KAAK;EACvD,IAAIK,MAAM,GAAGM,UAAU;EAEvB,IAAI,OAAOC,MAAM,KAAK,UAAU,EAAE;IAC9BP,MAAM,GAAGO,MAAM,CAAC;MAAEK,OAAO,EAAEZ;KAAQ,CAAC;GACvC,MAAM,IAAI,OAAOQ,MAAM,KAAK,UAAU,EAAE;IACrCR,MAAM,GAAGQ,MAAM,CAAC;MAAEI,OAAO,EAAEZ;KAAQ,CAAC;GACvC,MAAM,IAAI,OAAOU,IAAI,KAAK,UAAU,EAAE;IACnCV,MAAM,GAAGU,IAAI,CAAC;MAAEE,OAAO,EAAEZ;KAAQ,CAAC;GACrC,MAAM,IAAI,OAAOW,OAAO,KAAK,UAAU,EAAE;IACtCX,MAAM,GAAGW,OAAO,CAAC;MAAEC,OAAO,EAAEZ;KAAQ,CAAC;;EAGzC,IAAI,OAAOS,MAAM,KAAK,UAAU,EAAE;IAC9BT,MAAM,GAAGS,MAAM,CAAC;MAAEI,MAAM,EAAEb;KAAQ,CAAC;;EAGvC,OAAOA,MAAM;AACjB;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus disabled:cursor-not-allowed';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `wcag-blue-500 enabled:hover:wcag-blue-700 enabled:hover:active:wcag-blue-500 disabled:bg-blue-500/50`;\n\n case 'danger':\n return `wcag-red-500 enabled:hover:wcag-red-700 enabled:hover:active:wcag-red-500 disabled:bg-red-500/50`;\n\n case 'ghost':\n return `bg-white border border-blue-500 text-blue-500 enabled:hover:bg-blue-100 enabled:hover:text-blue-700 disabled:border-blue-500/50 disabled:text-blue-500/50`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black enabled:hover:bg-grey-200/80 disabled:text-black/30`;\n }\n\n return `bg-transparent text-blue-500 enabled:hover:text-blue-700 disabled:text-blue-500/50`;\n }\n\n default:\n return `wcag-grey-200 enabled:hover:wcag-grey-300 disabled:bg-grey-200/50 disabled:text-black/30`;\n }\n};\n\nexport const createButtonWithTooltip = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { tooltip, ...buttonProps } = props;\n const button = <ButtonPrimitive.Button {...buttonProps} className={className} ref={ref} />;\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n\nexport const createButtonWithOverlays = (props: any, buttonBase: JSX.Element) => {\n const { dialog, drawer, hanger, menu, popover } = props;\n let button = buttonBase;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof drawer === 'function') {\n button = drawer({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButtonWithTooltip","props","className","ref","tooltip","buttonProps","button","React","ButtonPrimitive","Tooltip","title","createButtonWithOverlays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,OAAO,EAAEZ;KAAQ,CAAC;GACrC,MAAM,IAAI,OAAOW,OAAO,KAAK,UAAU,EAAE;IACtCX,MAAM,GAAGW,OAAO,CAAC;MAAEC,OAAO,EAAEZ;KAAQ,CAAC;;EAGzC,IAAI,OAAOS,MAAM,KAAK,UAAU,EAAE;IAC9BT,MAAM,GAAGS,MAAM,CAAC;MAAEI,MAAM,EAAEb;KAAQ,CAAC;;EAGvC,OAAOA,MAAM;AACjB;;;;"}
@@ -7,7 +7,6 @@ import { useId } from '../../hooks/useId.js';
7
7
  const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
8
8
  const {
9
9
  checked,
10
- highlighted,
11
10
  indeterminate,
12
11
  invalid,
13
12
  label,
@@ -15,14 +14,14 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
15
14
  ...otherProps
16
15
  } = props;
17
16
  const id = useId(props.id);
18
- const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus:yt-focus',
19
- //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]
20
- {
21
- 'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300': !props.disabled && !invalid,
22
- 'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,
23
- 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
24
- 'border-red-500 text-red-500 hover:text-red-300 hover:border-red-300 focus:border-red-500 focus:hover:border-red-300': invalid && !props.disabled,
17
+ const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus-visible:yt-focus disabled:cursor-not-allowed text-white', {
25
18
  'self-start': !!label
19
+ }, invalid ? {
20
+ 'border-red-500 hover:border-red-700 aria-checked:border-red-500 aria-checked-mixed:border-red-500 aria-checked:bg-red-500 aria-checked-mixed:bg-red-500 aria-checked:hover:border-red-700 aria-checked-mixed:hover:border-red-700 aria-checked:hover:bg-red-700 aria-checked-mixed:hover:bg-red-700': !props.disabled,
21
+ 'border-red-500/50 aria-checked:wcag-red-500/50 aria-checked-mixed:wcag-red-500/50': props.disabled
22
+ } : {
23
+ 'border-grey-500 hover:border-grey-700 aria-checked:border-blue-500 aria-checked-mixed:border-blue-500 aria-checked:bg-blue-500 aria-checked-mixed:bg-blue-500 aria-checked:hover:border-blue-700 aria-checked-mixed:hover:border-blue-700 aria-checked:hover:bg-blue-700 aria-checked-mixed:hover:bg-blue-700': !props.disabled,
24
+ 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked-mixed:bg-blue-500/50': props.disabled
26
25
  }, props.className);
27
26
  let handleChange;
28
27
  if (onChange) {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\nimport { useId } from '../../hooks/useId';\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /* Increases visual prominenance of the checkbox */\n highlighted?: boolean;\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\n\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\n const { checked, highlighted, indeterminate, invalid, label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]\n {\n 'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300':\n !props.disabled && !invalid,\n 'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,\n 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,\n 'border-red-500 text-red-500 hover:text-red-300 hover:border-red-300 focus:border-red-500 focus:hover:border-red-300':\n invalid && !props.disabled,\n 'self-start': !!label,\n },\n props.className\n );\n\n let handleChange: ((checked: CheckedState) => void) | undefined;\n\n if (onChange) {\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\n }\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n // the enter keyboard shortcut isn't supported by default, but we want it\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter') {\n event.currentTarget.click();\n }\n };\n\n const element = (\n <CheckboxPrimitive.Root\n {...otherProps}\n {...labelledByProps}\n data-taco=\"checkbox\"\n checked={indeterminate ? 'indeterminate' : checked}\n className={className}\n onCheckedChange={handleChange}\n onKeyDown={handleKeyDown}\n ref={ref}>\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {\n 'cursor-not-allowed text-grey-300': props.disabled,\n });\n\n return (\n <span className={labelContainerClassName}>\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nCheckbox.displayName = 'Checkbox';\n"],"names":["Checkbox","React","props","ref","checked","highlighted","indeterminate","invalid","label","onChange","otherProps","id","useId","className","cn","disabled","handleChange","labelledByProps","handleKeyDown","event","key","currentTarget","click","element","CheckboxPrimitive","onCheckedChange","onKeyDown","Icon","name","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;;MAyCaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQ,CAACE,KAAoB,EAAEC,GAAiC;EAC9G,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,aAAa;IAAEC,OAAO;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAC9F,MAAMS,EAAE,GAAGC,KAAK,CAACV,KAAK,CAACS,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,kFAAkF;;EAClF;IACI,qGAAqG,EACjG,CAACZ,KAAK,CAACa,QAAQ,IAAI,CAACR,OAAO;IAC/B,kDAAkD,EAAEL,KAAK,CAACa,QAAQ;IAClE,8DAA8D,EAAEV,WAAW;IAC3E,qHAAqH,EACjHE,OAAO,IAAI,CAACL,KAAK,CAACa,QAAQ;IAC9B,YAAY,EAAE,CAAC,CAACP;GACnB,EACDN,KAAK,CAACW,SAAS,CAClB;EAED,IAAIG,YAA2D;EAE/D,IAAIP,QAAQ,EAAE;IACVO,YAAY,GAAIZ,OAAqB,IAAKK,QAAQ,CAACL,OAAO,KAAK,eAAe,GAAG,KAAK,GAAGA,OAAO,CAAC;;EAGrG,IAAIa,eAAe,GAAkC,IAAI;EAEzD,IAAIT,KAAK,EAAE;IACPS,eAAe,GAAG;MACd,iBAAiB,KAAKN,UAAU;MAChCA;KACH;;;EAIL,MAAMO,aAAa,GAAIC,KAA6C;IAChE,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,EAAE;MACvBD,KAAK,CAACE,aAAa,CAACC,KAAK,EAAE;;GAElC;EAED,MAAMC,OAAO,gBACTtB,cAACuB,IAAsB,oBACfd,UAAU,EACVO,eAAe;iBACT,UAAU;IACpBb,OAAO,EAAEE,aAAa,GAAG,eAAe,GAAGF,OAAO;IAClDS,SAAS,EAAEA,SAAS;IACpBY,eAAe,EAAET,YAAY;IAC7BU,SAAS,EAAER,aAAa;IACxBf,GAAG,EAAEA;mBACLF,cAACuB,SAA2B;IAACX,SAAS,EAAC;kBACnCZ,cAAC0B,IAAI;IAACC,IAAI,EAAEtB,aAAa,GAAG,MAAM,GAAG,MAAM;IAAEO,SAAS,EAAC;IAAoB,CACjD,CAErC;EAED,IAAIL,KAAK,EAAE;IACP,MAAMqB,uBAAuB,GAAGf,EAAE,CAAC,wCAAwC,EAAE;MACzE,kCAAkC,EAAEZ,KAAK,CAACa;KAC7C,CAAC;IAEF,oBACId;MAAMY,SAAS,EAAEgB;OACZN,OAAO,eACRtB;MAAO6B,OAAO,EAAEnB,EAAE;MAAEA,EAAE,KAAKA;OACtBH,KAAK,CACF,CACL;;EAIf,OAAOe,OAAO;AAClB,CAAC;AACDvB,QAAQ,CAAC+B,WAAW,GAAG,UAAU;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\nimport { useId } from '../../hooks/useId';\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\n\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\n const { checked, indeterminate, invalid, label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus-visible:yt-focus disabled:cursor-not-allowed text-white',\n {\n 'self-start': !!label,\n },\n invalid\n ? {\n 'border-red-500 hover:border-red-700 aria-checked:border-red-500 aria-checked-mixed:border-red-500 aria-checked:bg-red-500 aria-checked-mixed:bg-red-500 aria-checked:hover:border-red-700 aria-checked-mixed:hover:border-red-700 aria-checked:hover:bg-red-700 aria-checked-mixed:hover:bg-red-700':\n !props.disabled,\n 'border-red-500/50 aria-checked:wcag-red-500/50 aria-checked-mixed:wcag-red-500/50': props.disabled,\n }\n : {\n 'border-grey-500 hover:border-grey-700 aria-checked:border-blue-500 aria-checked-mixed:border-blue-500 aria-checked:bg-blue-500 aria-checked-mixed:bg-blue-500 aria-checked:hover:border-blue-700 aria-checked-mixed:hover:border-blue-700 aria-checked:hover:bg-blue-700 aria-checked-mixed:hover:bg-blue-700':\n !props.disabled,\n 'border-grey-500/50 aria-checked:bg-blue-500/50 aria-checked-mixed:bg-blue-500/50': props.disabled,\n },\n props.className\n );\n\n let handleChange: ((checked: CheckedState) => void) | undefined;\n\n if (onChange) {\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\n }\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n // the enter keyboard shortcut isn't supported by default, but we want it\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter') {\n event.currentTarget.click();\n }\n };\n\n const element = (\n <CheckboxPrimitive.Root\n {...otherProps}\n {...labelledByProps}\n data-taco=\"checkbox\"\n checked={indeterminate ? 'indeterminate' : checked}\n className={className}\n onCheckedChange={handleChange}\n onKeyDown={handleKeyDown}\n ref={ref}>\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {\n 'cursor-not-allowed text-grey-300': props.disabled,\n });\n\n return (\n <span className={labelContainerClassName}>\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nCheckbox.displayName = 'Checkbox';\n"],"names":["Checkbox","React","props","ref","checked","indeterminate","invalid","label","onChange","otherProps","id","useId","className","cn","disabled","handleChange","labelledByProps","handleKeyDown","event","key","currentTarget","click","element","CheckboxPrimitive","onCheckedChange","onKeyDown","Icon","name","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;;MAuCaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQ,CAACE,KAAoB,EAAEC,GAAiC;EAC9G,MAAM;IAAEC,OAAO;IAAEC,aAAa;IAAEC,OAAO;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGP,KAAK;EACjF,MAAMQ,EAAE,GAAGC,KAAK,CAACT,KAAK,CAACQ,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,iIAAiI,EACjI;IACI,YAAY,EAAE,CAAC,CAACN;GACnB,EACDD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A;OACtBH,KAAK,CACF,CACL;;EAIf,OAAOe,OAAO;AAClB,CAAC;AACDtB,QAAQ,CAAC8B,WAAW,GAAG,UAAU;;;;"}
@@ -1,6 +1,5 @@
1
1
  import { forwardRef, createElement } from 'react';
2
2
  import cn from 'classnames';
3
- import { Tooltip } from '../Tooltip/Tooltip.js';
4
3
  import { IconButton } from '../IconButton/IconButton.js';
5
4
  import { useLocalization } from '../Provider/Localization.js';
6
5
  import { Calendar } from '../Calendar/Calendar.js';
@@ -30,14 +29,11 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
30
29
  "data-taco": "datepicker",
31
30
  style: style
32
31
  }, /*#__PURE__*/createElement(Input, Object.assign({}, input, {
33
- button: /*#__PURE__*/createElement(Tooltip, {
34
- title: texts.datepicker.calendar
35
- }, /*#__PURE__*/createElement(IconButton, {
32
+ button: /*#__PURE__*/createElement(IconButton, {
36
33
  "aria-label": texts.datepicker.expand,
37
34
  disabled: input.disabled || input.readOnly,
38
35
  icon: "calendar",
39
36
  tabIndex: -1,
40
- className: " border-grey-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 flex h-full items-center justify-center rounded-l-none rounded-r border transition-colors transition-opacity ease-in focus:z-10 focus:rounded focus:!border-blue-300 focus:outline-none",
41
37
  popover: props => /*#__PURE__*/createElement(Popover, Object.assign({}, props), /*#__PURE__*/createElement(Popover.Content, null, ({
42
38
  close
43
39
  }) => /*#__PURE__*/createElement("div", {
@@ -63,14 +59,15 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
63
59
  }
64
60
  }, shortcut.text)))), handleReset && /*#__PURE__*/createElement("button", {
65
61
  type: "button",
66
- className: "my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
62
+ className: "mx-auto my-4 mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
67
63
  onClick: event => {
68
64
  event.persist();
69
65
  handleReset(event);
70
66
  close();
71
67
  }
72
- }, texts.datepicker.clear)))))
73
- }))
68
+ }, texts.datepicker.clear))))),
69
+ tooltip: texts.datepicker.calendar
70
+ })
74
71
  })));
75
72
  });
76
73
  Datepicker.displayName = 'Datepicker';
@@ -1 +1 @@
1
- {"version":3,"file":"Datepicker.js","sources":["../../../../../../../src/components/Datepicker/Datepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Calendar, CalendarProps } from '../Calendar/Calendar';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Localization';\nimport { useDatepicker } from './useDatepicker';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Popover } from '../Popover/Popover';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport type DatepickerTexts = {\n /** Aria-label for calendar */\n calendar: string;\n /** Clear button text */\n clear: string;\n /**\n * Aria-label for calendar icon button in the input.\n * Calendar will open when user clicks this icon button.\n */\n expand: string;\n /** Shortcut heading text */\n shortcuts: string;\n};\n\nexport type DatePickerShortcut = {\n onClick: (event: React.MouseEvent) => void;\n text: string;\n};\n\nexport type DatepickerProps = Omit<InputProps, 'value'> & {\n /** [Calendar](component:calendar) component associated with the DatePicker */\n calendar?: CalendarProps;\n /** List of shortcuts */\n shortcuts?: DatePickerShortcut[];\n /** Title for the shortcuts panel */\n shortcutsText?: string;\n /** Handler to be called when the clear button is clicked */\n onReset?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Date value of the calendar.\n * This will be displayed in DatePicker's input in the format given to the [Provider](component:provider) component\n */\n value?: Date;\n};\n\nexport const Datepicker = React.forwardRef(function Datepicker(props: DatepickerProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, onReset: handleReset, style, shortcuts, shortcutsText, ...otherProps } = props;\n const { calendar, input } = useDatepicker(otherProps, ref);\n const { texts } = useLocalization();\n const className = cn('inline-flex w-full text-black font-normal', externalClassName);\n\n return (\n <span className={className} data-taco=\"datepicker\" style={style}>\n <Input\n {...input}\n button={\n <Tooltip title={texts.datepicker.calendar}>\n <IconButton\n aria-label={texts.datepicker.expand}\n disabled={input.disabled || input.readOnly}\n icon=\"calendar\"\n tabIndex={-1}\n className=\" border-grey-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 flex h-full items-center justify-center rounded-l-none rounded-r border transition-colors transition-opacity ease-in focus:z-10 focus:rounded focus:!border-blue-300 focus:outline-none\"\n popover={props => (\n <Popover {...props}>\n <Popover.Content>\n {({ close }) => (\n <div className=\"-m-3 flex\">\n <Calendar\n {...calendar}\n onChange={(date: Date, event?: React.MouseEvent<HTMLDivElement>) => {\n calendar.onChange(date, event);\n close();\n }}\n />\n {shortcuts && (\n <div className=\"border-grey-300 flex flex-col border-l\">\n <span className=\"m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold\">\n {shortcutsText ?? texts.datepicker.shortcuts}\n </span>\n <ul>\n {shortcuts.map(shortcut => (\n <li key={shortcut.text}>\n <button\n type=\"button\"\n className=\"hover:wcag-grey-200 flex w-full items-start px-4 py-1 text-xs\"\n onClick={event => {\n event.persist();\n shortcut.onClick(event);\n close();\n }}>\n {shortcut.text}\n </button>\n </li>\n ))}\n </ul>\n {handleReset && (\n <button\n type=\"button\"\n className=\"my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300\"\n onClick={event => {\n event.persist();\n handleReset(event);\n close();\n }}>\n {texts.datepicker.clear}\n </button>\n )}\n </div>\n )}\n </div>\n )}\n </Popover.Content>\n </Popover>\n )}\n />\n </Tooltip>\n }\n />\n </span>\n );\n});\nDatepicker.displayName = 'Datepicker';\n"],"names":["Datepicker","React","props","ref","className","externalClassName","onReset","handleReset","style","shortcuts","shortcutsText","otherProps","calendar","input","useDatepicker","texts","useLocalization","cn","Input","button","Tooltip","title","datepicker","IconButton","expand","disabled","readOnly","icon","tabIndex","popover","Popover","Content","close","Calendar","onChange","date","event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AAC;sBACXH;QAAMG,SAAS,EAAC;SACXM,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAIK,KAAK,CAACO,UAAU,CAACb,SAAS,CACzC,eACPR,0BACKQ,SAAS,CAAC4B,GAAG,CAACC,QAAQ,iBACnBrC;QAAIsC,GAAG,EAAED,QAAQ,CAACE;sBACdvC;QACIwC,IAAI,EAAC,QAAQ;QACbrC,SAAS,EAAC,+DAA+D;QACzEsC,OAAO,EAAEN,KAAK;UACVA,KAAK,CAACO,OAAO,EAAE;UACfL,QAAQ,CAACI,OAAO,CAACN,KAAK,CAAC;UACvBJ,KAAK,EAAE;;SAEVM,QAAQ,CAACE,IAAI,CACT,CAEhB,CAAC,CACD,EACJjC,WAAW,iBACRN;QACIwC,IAAI,EAAC,QAAQ;QACbrC,SAAS,EAAC,sHAAsH;QAChIsC,OAAO,EAAEN,KAAK;UACVA,KAAK,CAACO,OAAO,EAAE;UACfpC,WAAW,CAAC6B,KAAK,CAAC;UAClBJ,KAAK,EAAE;;SAEVjB,KAAK,CAACO,UAAU,CAACsB,KAAK,CAE9B,CAER,CAER,CACa;MAG5B;KAGZ,CACC;AAEf,CAAC;AACD5C,UAAU,CAAC6C,WAAW,GAAG,YAAY;;;;"}
1
+ {"version":3,"file":"Datepicker.js","sources":["../../../../../../../src/components/Datepicker/Datepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Calendar, CalendarProps } from '../Calendar/Calendar';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Localization';\nimport { useDatepicker } from './useDatepicker';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Popover } from '../Popover/Popover';\n\nexport type DatepickerTexts = {\n /** Aria-label for calendar */\n calendar: string;\n /** Clear button text */\n clear: string;\n /**\n * Aria-label for calendar icon button in the input.\n * Calendar will open when user clicks this icon button.\n */\n expand: string;\n /** Shortcut heading text */\n shortcuts: string;\n};\n\nexport type DatePickerShortcut = {\n onClick: (event: React.MouseEvent) => void;\n text: string;\n};\n\nexport type DatepickerProps = Omit<InputProps, 'value'> & {\n /** [Calendar](component:calendar) component associated with the DatePicker */\n calendar?: CalendarProps;\n /** List of shortcuts */\n shortcuts?: DatePickerShortcut[];\n /** Title for the shortcuts panel */\n shortcutsText?: string;\n /** Handler to be called when the clear button is clicked */\n onReset?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Date value of the calendar.\n * This will be displayed in DatePicker's input in the format given to the [Provider](component:provider) component\n */\n value?: Date;\n};\n\nexport const Datepicker = React.forwardRef(function Datepicker(props: DatepickerProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, onReset: handleReset, style, shortcuts, shortcutsText, ...otherProps } = props;\n const { calendar, input } = useDatepicker(otherProps, ref);\n const { texts } = useLocalization();\n const className = cn('inline-flex w-full text-black font-normal', externalClassName);\n\n return (\n <span className={className} data-taco=\"datepicker\" style={style}>\n <Input\n {...input}\n button={\n <IconButton\n aria-label={texts.datepicker.expand}\n disabled={input.disabled || input.readOnly}\n icon=\"calendar\"\n tabIndex={-1}\n popover={props => (\n <Popover {...props}>\n <Popover.Content>\n {({ close }) => (\n <div className=\"-m-3 flex\">\n <Calendar\n {...calendar}\n onChange={(date: Date, event?: React.MouseEvent<HTMLDivElement>) => {\n calendar.onChange(date, event);\n close();\n }}\n />\n {shortcuts && (\n <div className=\"border-grey-300 flex flex-col border-l\">\n <span className=\"m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold\">\n {shortcutsText ?? texts.datepicker.shortcuts}\n </span>\n <ul>\n {shortcuts.map(shortcut => (\n <li key={shortcut.text}>\n <button\n type=\"button\"\n className=\"hover:wcag-grey-200 flex w-full items-start px-4 py-1 text-xs\"\n onClick={event => {\n event.persist();\n shortcut.onClick(event);\n close();\n }}>\n {shortcut.text}\n </button>\n </li>\n ))}\n </ul>\n {handleReset && (\n <button\n type=\"button\"\n className=\"mx-auto my-4 mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300\"\n onClick={event => {\n event.persist();\n handleReset(event);\n close();\n }}>\n {texts.datepicker.clear}\n </button>\n )}\n </div>\n )}\n </div>\n )}\n </Popover.Content>\n </Popover>\n )}\n tooltip={texts.datepicker.calendar}\n />\n }\n />\n </span>\n );\n});\nDatepicker.displayName = 'Datepicker';\n"],"names":["Datepicker","React","props","ref","className","externalClassName","onReset","handleReset","style","shortcuts","shortcutsText","otherProps","calendar","input","useDatepicker","texts","useLocalization","cn","Input","button","IconButton","datepicker","expand","disabled","readOnly","icon","tabIndex","popover","Popover","Content","close","Calendar","onChange","date","event","map","shortcut","key","text","type","onClick","persist","clear","tooltip","displayName"],"mappings":";;;;;;;;;MA4CaA,UAAU,gBAAGC,UAAgB,CAAC,SAASD,UAAU,CAACE,KAAsB,EAAEC,GAAgC;EACnH,MAAM;IAAEC,SAAS,EAAEC,iBAAiB;IAAEC,OAAO,EAAEC,WAAW;IAAEC,KAAK;IAAEC,SAAS;IAAEC,aAAa;IAAE,GAAGC;GAAY,GAAGT,KAAK;EACpH,MAAM;IAAEU,QAAQ;IAAEC;GAAO,GAAGC,aAAa,CAACH,UAAU,EAAER,GAAG,CAAC;EAC1D,MAAM;IAAEY;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMZ,SAAS,GAAGa,EAAE,CAAC,2CAA2C,EAAEZ,iBAAiB,CAAC;EAEpF,oBACIJ;IAAMG,SAAS,EAAEA,SAAS;iBAAY,YAAY;IAACI,KAAK,EAAEA;kBACtDP,cAACiB,KAAK,oBACEL,KAAK;IACTM,MAAM,eACFlB,cAACmB,UAAU;oBACKL,KAAK,CAACM,UAAU,CAACC,MAAM;MACnCC,QAAQ,EAAEV,KAAK,CAACU,QAAQ,IAAIV,KAAK,CAACW,QAAQ;MAC1CC,IAAI,EAAC,UAAU;MACfC,QAAQ,EAAE,CAAC,CAAC;MACZC,OAAO,EAAEzB,KAAK,iBACVD,cAAC2B,OAAO,oBAAK1B,KAAK,gBACdD,cAAC2B,OAAO,CAACC,OAAO,QACX,CAAC;QAAEC;OAAO,kBACP7B;QAAKG,SAAS,EAAC;sBACXH,cAAC8B,QAAQ,oBACDnB,QAAQ;QACZoB,QAAQ,EAAE,CAACC,IAAU,EAAEC,KAAwC;UAC3DtB,QAAQ,CAACoB,QAAQ,CAACC,IAAI,EAAEC,KAAK,CAAC;UAC9BJ,KAAK,EAAE;;SAEb,EACDrB,SAAS,iBACNR;QAAKG,SAAS,EAAC;sBACXH;QAAMG,SAAS,EAAC;SACXM,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAIK,KAAK,CAACM,UAAU,CAACZ,SAAS,CACzC,eACPR,0BACKQ,SAAS,CAAC0B,GAAG,CAACC,QAAQ,iBACnBnC;QAAIoC,GAAG,EAAED,QAAQ,CAACE;sBACdrC;QACIsC,IAAI,EAAC,QAAQ;QACbnC,SAAS,EAAC,+DAA+D;QACzEoC,OAAO,EAAEN,KAAK;UACVA,KAAK,CAACO,OAAO,EAAE;UACfL,QAAQ,CAACI,OAAO,CAACN,KAAK,CAAC;UACvBJ,KAAK,EAAE;;SAEVM,QAAQ,CAACE,IAAI,CACT,CAEhB,CAAC,CACD,EACJ/B,WAAW,iBACRN;QACIsC,IAAI,EAAC,QAAQ;QACbnC,SAAS,EAAC,sHAAsH;QAChIoC,OAAO,EAAEN,KAAK;UACVA,KAAK,CAACO,OAAO,EAAE;UACflC,WAAW,CAAC2B,KAAK,CAAC;UAClBJ,KAAK,EAAE;;SAEVf,KAAK,CAACM,UAAU,CAACqB,KAAK,CAE9B,CAER,CAER,CACa,CAEzB;MACDC,OAAO,EAAE5B,KAAK,CAACM,UAAU,CAACT;;KAGpC,CACC;AAEf,CAAC;AACDZ,UAAU,CAAC4C,WAAW,GAAG,YAAY;;;;"}
@@ -97,15 +97,16 @@ const InnerContent = /*#__PURE__*/React__default.forwardRef(function InnerConten
97
97
  children,
98
98
  ...otherProps
99
99
  } = props;
100
- const cName = cn('grow-1 p-4', className);
100
+ const cName = cn('grow flex flex-col', {
101
+ 'overflow-y-hidden': isScrollable,
102
+ 'p-4': !isScrollable
103
+ }, className);
101
104
  return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
102
105
  className: cName,
103
106
  ref: ref
104
107
  }), isScrollable ? /*#__PURE__*/React__default.createElement(ScrollArea, {
105
- className: "w-full gap-y-0.5"
106
- }, children) : {
107
- children
108
- });
108
+ className: "w-full gap-y-0.5 p-4"
109
+ }, children) : children);
109
110
  });
110
111
  const Portal = props => {
111
112
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Drawer/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Group, GroupProps } from '../../Group/Group';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDrawer } from '../Context';\nimport {\n getBackdropClassNames,\n getDrawerContainerClassNames,\n getDrawerContentClassNames,\n getDrawerDragHandlerClassNames,\n} from '../util';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { FocusScope } from '@react-aria/focus';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\n\nconst RESIZE_MIN = 360;\nconst RESIZE_MAX = 1000;\n\nexport type DrawerContentRenderProps = {\n close: () => void;\n};\n\nexport enum DrawerAnimationDefinition {\n Visible = 'visible',\n Hidden = 'hidden',\n}\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DrawerTitle(props: DrawerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const { className, children, ...otherProps } = props;\n /**\n * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,\n * where we might want to hide the grey separator. For this reason separator was rendedr with using of classNames,\n * so it can be easily overriden in exceptional scenarious.\n * */\n const cName = cn('grow-0 py-4 pl-4 justyfy-self-start mb-0 border-b-[1px] border-grey-300', className);\n return (\n <DialogPrimitive.Title className={cName} {...otherProps} ref={ref}>\n <span className=\"line-clamp-2 inline-block w-4/6 overflow-y-hidden\">{children}</span>\n </DialogPrimitive.Title>\n );\n});\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DrawerFooter(props: DrawerFooterProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n /**\n * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.\n */\n const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-grey-300', props.className);\n return <div {...otherProps} className={cName} ref={ref} />;\n});\n\nexport const Actions = React.forwardRef(function Actions(props: GroupProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);\n return <Group {...otherProps} className={cName} ref={ref} />;\n});\n\nexport type DrawerCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nexport const Close = React.forwardRef(function DrawerClose(props: DrawerCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const { onClose } = useCurrentDrawer();\n\n return <DialogPrimitive.Close {...props} onClick={onClose} ref={ref} asChild />;\n});\n\n/**\n * It is container component, needed to provide default scrolling behaviour and padding, to simplyfy usage, requested by feature devs.\n * It is optional to use InnerContent component, if consumer need to implement custom behaviour or paddings for inner content,\n * then it's simply enough to render children and wrap them in custom implementation.\n */\nexport type DrawerInnerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Consumer might want to use innerContent component to apply default paddings, but want to implement custom scrolling behaviour,\n * default value - true\n */\n isScrollable?: boolean;\n};\nexport const InnerContent = React.forwardRef(function InnerContent(\n props: DrawerInnerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { className, isScrollable = true, children, ...otherProps } = props;\n const cName = cn('grow-1 p-4', className);\n return (\n <div {...otherProps} className={cName} ref={ref}>\n {isScrollable ? <ScrollArea className=\"w-full gap-y-0.5\">{children}</ScrollArea> : { children }}\n </div>\n );\n});\n\nconst Portal = (props: DialogPrimitive.DialogPortalProps) => {\n const { children, ...otherProps } = props;\n const { open = false, variant, outlet } = useCurrentDrawer();\n\n const backdropClassNames = React.useMemo(() => {\n return getBackdropClassNames(open);\n }, [open]);\n\n if (!outlet) {\n return null;\n }\n\n return (\n <DialogPrimitive.Portal {...otherProps} container={outlet ?? undefined}>\n {variant === 'overlay' ? (\n <DialogPrimitive.Overlay forceMount>\n {/* Animate backdrop appearance for overlay version of Drawer */}\n <Backdrop className={backdropClassNames} />\n </DialogPrimitive.Overlay>\n ) : null}\n {children}\n </DialogPrimitive.Portal>\n );\n};\n\ntype UntrappedFocusDrawerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n onEscape: (event: KeyboardEvent) => void;\n};\nconst UntrappedFocusDrawerContent = React.forwardRef(function EmbeddedDrawerContent(\n props: UntrappedFocusDrawerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { onEscape, children, ...otherProps } = props;\n\n useGlobalKeyDown('Escape', onEscape);\n\n return (\n <div {...otherProps} ref={ref}>\n <FocusScope autoFocus={true} restoreFocus={true}>\n {children}\n </FocusScope>\n </div>\n );\n});\n\nexport type DrawerContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the side drawer is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DrawerContentRenderProps) => JSX.Element);\n};\nexport const DrawerContent = React.forwardRef(function Content(\n props: DrawerContentProps,\n externalRef: React.Ref<HTMLDivElement>\n) {\n const {\n size,\n onClose,\n onResize,\n open = false,\n closeOnEscape,\n variant,\n focusTrap,\n showCloseButton,\n setOpen,\n } = useCurrentDrawer();\n const { className, style, children, ...otherProps } = props;\n const { texts } = useLocalization();\n const ref = useMergedRef<HTMLDivElement>(externalRef);\n\n // if the drawer was opened by a menu, we need to close the menu when the drawer closes\n // the menu is still open (and mounted) because it is the trigger for the drawer\n const menu = useCurrentMenu();\n let handleCloseAutoFocus: DialogPrimitive.DialogContentProps['onCloseAutoFocus'];\n\n if (menu) {\n handleCloseAutoFocus = () => {\n menu.close();\n };\n }\n\n const containerClassName: string = React.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);\n\n const { contentClassName, dragHandlerClassName } = React.useMemo(() => {\n const contentClassName = getDrawerContentClassNames(size, variant, open);\n const dragHandlerClassName: string = getDrawerDragHandlerClassNames();\n return { contentClassName, dragHandlerClassName };\n }, [size, variant, open]);\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n const isTargetInsideDrawerContent = ref.current?.contains(event.target as HTMLElement);\n if (isTargetInsideDrawerContent) {\n if (!closeOnEscape) {\n event.preventDefault();\n } else {\n setOpen && setOpen(false);\n if (onClose) {\n onClose();\n }\n }\n }\n };\n\n const [containerWidth, setContainerWidth] = React.useState<number>();\n\n const dragHandlerRef = React.useRef<HTMLDivElement>(null);\n const {\n position,\n dragging,\n handleProps: dragHandleProps,\n resetPosition,\n } = useDraggable(useMergedRef<HTMLDivElement>(dragHandlerRef));\n\n const contentRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (onResize) {\n onResize(position.x);\n }\n }, [position]);\n\n React.useEffect(() => {\n setContainerWidth(contentRef.current?.offsetWidth);\n }, [contentRef, open]);\n\n const resizedWidth = React.useMemo((): number | undefined => {\n if (containerWidth) {\n return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));\n }\n return;\n }, [containerWidth, position]);\n\n React.useEffect(() => {\n if (!dragging && resizedWidth) {\n setContainerWidth(resizedWidth);\n resetPosition();\n }\n }, [dragging]);\n\n let output;\n\n if (typeof children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper>{children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = children;\n }\n\n const content = (\n <div ref={contentRef} data-taco=\"drawer\" className={containerClassName}>\n <div className={dragHandlerClassName} {...dragHandleProps} data-testid=\"resize-handler\" ref={dragHandlerRef} />\n {output}\n {showCloseButton ? (\n <Close>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.close}\n className=\"absolute top-0 right-0 mt-4 mr-2\"\n icon=\"close\"\n />\n </Close>\n ) : null}\n </div>\n );\n\n const styleProp = {\n ...style,\n ...{ width: resizedWidth },\n };\n\n return focusTrap ? (\n <DialogPrimitive.Content\n forceMount\n {...otherProps}\n className={contentClassName}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={variant === 'overlay' ? undefined : event => event.preventDefault()}\n onCloseAutoFocus={handleCloseAutoFocus}\n ref={ref}\n style={styleProp}>\n {content}\n </DialogPrimitive.Content>\n ) : (\n <UntrappedFocusDrawerContent onEscape={handleEscapeKeyDown} className={contentClassName} style={styleProp} ref={ref}>\n {content}\n </UntrappedFocusDrawerContent>\n );\n});\n\nexport const Content = React.forwardRef(function Content(props: DrawerContentProps, externalRef: React.Ref<HTMLDivElement>) {\n const { children } = props;\n\n return (\n <Portal>\n <DrawerContent {...props} ref={externalRef}>\n {children}\n </DrawerContent>\n </Portal>\n );\n});\n"],"names":["RESIZE_MIN","RESIZE_MAX","DrawerAnimationDefinition","RenderPropWrapper","React","forwardRef","children","onClick","renderProps","ref","close","CustomEvent","Title","DrawerTitle","props","className","otherProps","cName","cn","DialogPrimitive","Footer","DrawerFooter","Actions","Group","Close","DrawerClose","onClose","useCurrentDrawer","asChild","InnerContent","isScrollable","ScrollArea","Portal","open","variant","outlet","backdropClassNames","useMemo","getBackdropClassNames","container","undefined","forceMount","Backdrop","UntrappedFocusDrawerContent","EmbeddedDrawerContent","onEscape","useGlobalKeyDown","FocusScope","autoFocus","restoreFocus","DrawerContent","Content","externalRef","size","onResize","closeOnEscape","focusTrap","showCloseButton","setOpen","style","texts","useLocalization","useMergedRef","menu","useCurrentMenu","handleCloseAutoFocus","containerClassName","getDrawerContainerClassNames","contentClassName","dragHandlerClassName","getDrawerContentClassNames","getDrawerDragHandlerClassNames","handleEscapeKeyDown","event","isTargetInsideDrawerContent","current","contains","target","preventDefault","containerWidth","setContainerWidth","useState","dragHandlerRef","useRef","position","dragging","handleProps","dragHandleProps","resetPosition","useDraggable","contentRef","useEffect","x","offsetWidth","resizedWidth","Math","min","max","output","content","IconButton","appearance","drawer","icon","styleProp","width","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAMA,UAAU,GAAG,GAAG;AACtB,MAAMC,UAAU,GAAG,IAAI;IAMXC;AAAZ,WAAYA,yBAAyB;EACjCA,gDAAmB;EACnBA,8CAAiB;AACrB,CAAC,EAHWA,yBAAyB,KAAzBA,yBAAyB;AAKrC,MAAMC,iBAAiB,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,iBAAiB,CAAC;EAAEG,QAAQ;EAAEC,OAAO;EAAEC;CAAkB,EAAEC,GAAG;EAC9G,MAAMC,KAAK,GAAG;IACVH,OAAO,CAAC,IAAII,WAAW,CAAC,OAAO,CAAC,CAAC;GACpC;EAED,OAAOL,QAAQ,CAAC;IAAEI,KAAK;IAAED,GAAG;IAAE,GAAGD;GAAa,CAAC;AACnD,CAAC,CAAC;MAGWI,KAAK,gBAAGR,cAAK,CAACC,UAAU,CAAC,SAASQ,WAAW,CAACC,KAAuB,EAAEL,GAAkC;EAClH,MAAM;IAAEM,SAAS;IAAET,QAAQ;IAAE,GAAGU;GAAY,GAAGF,KAAK;;;;;;EAMpD,MAAMG,KAAK,GAAGC,EAAE,CAAC,yEAAyE,EAAEH,SAAS,CAAC;EACtG,oBACIX,6BAACe,OAAqB;IAACJ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AK,EAAE6C,SAAS;IAAE/F,GAAG,EAAEA;KAC3G0F,OAAO,CAEf;AACL,CAAC;MAEYhD,OAAO,gBAAG/C,cAAK,CAACC,UAAU,CAAC,SAAS8C,OAAO,CAACrC,KAAyB,EAAEsC,WAAsC;EACtH,MAAM;IAAE9C;GAAU,GAAGQ,KAAK;EAE1B,oBACIV,6BAAC4B,MAAM,qBACH5B,6BAAC8C,aAAa,oBAAKpC,KAAK;IAAEL,GAAG,EAAE2C;MAC1B9C,QAAQ,CACG,CACX;AAEjB,CAAC;;;;"}
1
+ {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Drawer/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Group, GroupProps } from '../../Group/Group';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDrawer } from '../Context';\nimport {\n getBackdropClassNames,\n getDrawerContainerClassNames,\n getDrawerContentClassNames,\n getDrawerDragHandlerClassNames,\n} from '../util';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { FocusScope } from '@react-aria/focus';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\n\nconst RESIZE_MIN = 360;\nconst RESIZE_MAX = 1000;\n\nexport type DrawerContentRenderProps = {\n close: () => void;\n};\n\nexport enum DrawerAnimationDefinition {\n Visible = 'visible',\n Hidden = 'hidden',\n}\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DrawerTitle(props: DrawerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const { className, children, ...otherProps } = props;\n /**\n * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,\n * where we might want to hide the grey separator. For this reason separator was rendedr with using of classNames,\n * so it can be easily overriden in exceptional scenarious.\n * */\n const cName = cn('grow-0 py-4 pl-4 justyfy-self-start mb-0 border-b-[1px] border-grey-300', className);\n return (\n <DialogPrimitive.Title className={cName} {...otherProps} ref={ref}>\n <span className=\"line-clamp-2 inline-block w-4/6 overflow-y-hidden\">{children}</span>\n </DialogPrimitive.Title>\n );\n});\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DrawerFooter(props: DrawerFooterProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n /**\n * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.\n */\n const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-grey-300', props.className);\n return <div {...otherProps} className={cName} ref={ref} />;\n});\n\nexport const Actions = React.forwardRef(function Actions(props: GroupProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);\n return <Group {...otherProps} className={cName} ref={ref} />;\n});\n\nexport type DrawerCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nexport const Close = React.forwardRef(function DrawerClose(props: DrawerCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const { onClose } = useCurrentDrawer();\n\n return <DialogPrimitive.Close {...props} onClick={onClose} ref={ref} asChild />;\n});\n\n/**\n * It is container component, needed to provide default scrolling behaviour and padding, to simplyfy usage, requested by feature devs.\n * It is optional to use InnerContent component, if consumer need to implement custom behaviour or paddings for inner content,\n * then it's simply enough to render children and wrap them in custom implementation.\n */\nexport type DrawerInnerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Consumer might want to use innerContent component to apply default paddings, but want to implement custom scrolling behaviour,\n * default value - true\n */\n isScrollable?: boolean;\n};\nexport const InnerContent = React.forwardRef(function InnerContent(\n props: DrawerInnerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { className, isScrollable = true, children, ...otherProps } = props;\n const cName = cn(\n 'grow flex flex-col',\n {\n 'overflow-y-hidden': isScrollable,\n 'p-4': !isScrollable,\n },\n className\n );\n return (\n <div {...otherProps} className={cName} ref={ref}>\n {isScrollable ? <ScrollArea className=\"w-full gap-y-0.5 p-4\">{children}</ScrollArea> : children}\n </div>\n );\n});\n\nconst Portal = (props: DialogPrimitive.DialogPortalProps) => {\n const { children, ...otherProps } = props;\n const { open = false, variant, outlet } = useCurrentDrawer();\n\n const backdropClassNames = React.useMemo(() => {\n return getBackdropClassNames(open);\n }, [open]);\n\n if (!outlet) {\n return null;\n }\n\n return (\n <DialogPrimitive.Portal {...otherProps} container={outlet ?? undefined}>\n {variant === 'overlay' ? (\n <DialogPrimitive.Overlay forceMount>\n {/* Animate backdrop appearance for overlay version of Drawer */}\n <Backdrop className={backdropClassNames} />\n </DialogPrimitive.Overlay>\n ) : null}\n {children}\n </DialogPrimitive.Portal>\n );\n};\n\ntype UntrappedFocusDrawerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n onEscape: (event: KeyboardEvent) => void;\n};\nconst UntrappedFocusDrawerContent = React.forwardRef(function EmbeddedDrawerContent(\n props: UntrappedFocusDrawerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { onEscape, children, ...otherProps } = props;\n\n useGlobalKeyDown('Escape', onEscape);\n\n return (\n <div {...otherProps} ref={ref}>\n <FocusScope autoFocus={true} restoreFocus={true}>\n {children}\n </FocusScope>\n </div>\n );\n});\n\nexport type DrawerContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the side drawer is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DrawerContentRenderProps) => JSX.Element);\n};\nexport const DrawerContent = React.forwardRef(function Content(\n props: DrawerContentProps,\n externalRef: React.Ref<HTMLDivElement>\n) {\n const {\n size,\n onClose,\n onResize,\n open = false,\n closeOnEscape,\n variant,\n focusTrap,\n showCloseButton,\n setOpen,\n } = useCurrentDrawer();\n const { className, style, children, ...otherProps } = props;\n const { texts } = useLocalization();\n const ref = useMergedRef<HTMLDivElement>(externalRef);\n\n // if the drawer was opened by a menu, we need to close the menu when the drawer closes\n // the menu is still open (and mounted) because it is the trigger for the drawer\n const menu = useCurrentMenu();\n let handleCloseAutoFocus: DialogPrimitive.DialogContentProps['onCloseAutoFocus'];\n\n if (menu) {\n handleCloseAutoFocus = () => {\n menu.close();\n };\n }\n\n const containerClassName: string = React.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);\n\n const { contentClassName, dragHandlerClassName } = React.useMemo(() => {\n const contentClassName = getDrawerContentClassNames(size, variant, open);\n const dragHandlerClassName: string = getDrawerDragHandlerClassNames();\n return { contentClassName, dragHandlerClassName };\n }, [size, variant, open]);\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n const isTargetInsideDrawerContent = ref.current?.contains(event.target as HTMLElement);\n if (isTargetInsideDrawerContent) {\n if (!closeOnEscape) {\n event.preventDefault();\n } else {\n setOpen && setOpen(false);\n if (onClose) {\n onClose();\n }\n }\n }\n };\n\n const [containerWidth, setContainerWidth] = React.useState<number>();\n\n const dragHandlerRef = React.useRef<HTMLDivElement>(null);\n const {\n position,\n dragging,\n handleProps: dragHandleProps,\n resetPosition,\n } = useDraggable(useMergedRef<HTMLDivElement>(dragHandlerRef));\n\n const contentRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (onResize) {\n onResize(position.x);\n }\n }, [position]);\n\n React.useEffect(() => {\n setContainerWidth(contentRef.current?.offsetWidth);\n }, [contentRef, open]);\n\n const resizedWidth = React.useMemo((): number | undefined => {\n if (containerWidth) {\n return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));\n }\n return;\n }, [containerWidth, position]);\n\n React.useEffect(() => {\n if (!dragging && resizedWidth) {\n setContainerWidth(resizedWidth);\n resetPosition();\n }\n }, [dragging]);\n\n let output;\n\n if (typeof children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper>{children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = children;\n }\n\n const content = (\n <div ref={contentRef} data-taco=\"drawer\" className={containerClassName}>\n <div className={dragHandlerClassName} {...dragHandleProps} data-testid=\"resize-handler\" ref={dragHandlerRef} />\n {output}\n {showCloseButton ? (\n <Close>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.close}\n className=\"absolute top-0 right-0 mt-4 mr-2\"\n icon=\"close\"\n />\n </Close>\n ) : null}\n </div>\n );\n\n const styleProp = {\n ...style,\n ...{ width: resizedWidth },\n };\n\n return focusTrap ? (\n <DialogPrimitive.Content\n forceMount\n {...otherProps}\n className={contentClassName}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={variant === 'overlay' ? undefined : event => event.preventDefault()}\n onCloseAutoFocus={handleCloseAutoFocus}\n ref={ref}\n style={styleProp}>\n {content}\n </DialogPrimitive.Content>\n ) : (\n <UntrappedFocusDrawerContent onEscape={handleEscapeKeyDown} className={contentClassName} style={styleProp} ref={ref}>\n {content}\n </UntrappedFocusDrawerContent>\n );\n});\n\nexport const Content = React.forwardRef(function Content(props: DrawerContentProps, externalRef: React.Ref<HTMLDivElement>) {\n const { children } = props;\n\n return (\n <Portal>\n <DrawerContent {...props} ref={externalRef}>\n {children}\n </DrawerContent>\n </Portal>\n );\n});\n"],"names":["RESIZE_MIN","RESIZE_MAX","DrawerAnimationDefinition","RenderPropWrapper","React","forwardRef","children","onClick","renderProps","ref","close","CustomEvent","Title","DrawerTitle","props","className","otherProps","cName","cn","DialogPrimitive","Footer","DrawerFooter","Actions","Group","Close","DrawerClose","onClose","useCurrentDrawer","asChild","InnerContent","isScrollable","ScrollArea","Portal","open","variant","outlet","backdropClassNames","useMemo","getBackdropClassNames","container","undefined","forceMount","Backdrop","UntrappedFocusDrawerContent","EmbeddedDrawerContent","onEscape","useGlobalKeyDown","FocusScope","autoFocus","restoreFocus","DrawerContent","Content","externalRef","size","onResize","closeOnEscape","focusTrap","showCloseButton","setOpen","style","texts","useLocalization","useMergedRef","menu","useCurrentMenu","handleCloseAutoFocus","containerClassName","getDrawerContainerClassNames","contentClassName","dragHandlerClassName","getDrawerContentClassNames","getDrawerDragHandlerClassNames","handleEscapeKeyDown","event","isTargetInsideDrawerContent","current","contains","target","preventDefault","containerWidth","setContainerWidth","useState","dragHandlerRef","useRef","position","dragging","handleProps","dragHandleProps","resetPosition","useDraggable","contentRef","useEffect","x","offsetWidth","resizedWidth","Math","min","max","output","content","IconButton","appearance","drawer","icon","styleProp","width","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAMA,UAAU,GAAG,GAAG;AACtB,MAAMC,UAAU,GAAG,IAAI;IAMXC;AAAZ,WAAYA,yBAAyB;EACjCA,gDAAmB;EACnBA,8CAAiB;AACrB,CAAC,EAHWA,yBAAyB,KAAzBA,yBAAyB;AAKrC,MAAMC,iBAAiB,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,iBAAiB,CAAC;EAAEG,QAAQ;EAAEC,OAAO;EAAEC;CAAkB,EAAEC,GAAG;EAC9G,MAAMC,KAAK,GAAG;IACVH,OAAO,CAAC,IAAII,WAAW,CAAC,OAAO,CAAC,CAAC;GACpC;EAED,OAAOL,QAAQ,CAAC;IAAEI,KAAK;IAAED,GAAG;IAAE,GAAGD;GAAa,CAAC;AACnD,CAAC,CAAC;MAGWI,KAAK,gBAAGR,cAAK,CAACC,UAAU,CAAC,SAASQ,WAAW,CAACC,KAAuB,EAAEL,GAAkC;EAClH,MAAM;IAAEM,SAAS;IAAET,QAAQ;IAAE,GAAGU;GAAY,GAAGF,KAAK;;;;;;EAMpD,MAAMG,KAAK,GAAGC,EA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AAK,EAAE6C;MACNL,OAAO,CACc,gBAE1B/F,6BAACuC,2BAA2B;IAACE,QAAQ,EAAE2B,mBAAmB;IAAEzD,SAAS,EAAEqD,gBAAgB;IAAET,KAAK,EAAE6C,SAAS;IAAE/F,GAAG,EAAEA;KAC3G0F,OAAO,CAEf;AACL,CAAC;MAEYhD,OAAO,gBAAG/C,cAAK,CAACC,UAAU,CAAC,SAAS8C,OAAO,CAACrC,KAAyB,EAAEsC,WAAsC;EACtH,MAAM;IAAE9C;GAAU,GAAGQ,KAAK;EAE1B,oBACIV,6BAAC4B,MAAM,qBACH5B,6BAAC8C,aAAa,oBAAKpC,KAAK;IAAEL,GAAG,EAAE2C;MAC1B9C,QAAQ,CACG,CACX;AAEjB,CAAC;;;;"}
@@ -16,7 +16,7 @@ const Field = /*#__PURE__*/forwardRef(function Field(props, ref) {
16
16
  'text-grey-700': !invalid,
17
17
  'text-red-500': invalid,
18
18
  'opacity-50': disabled
19
- }, props.className);
19
+ });
20
20
  return /*#__PURE__*/createElement("label", Object.assign({}, otherProps, {
21
21
  className: className,
22
22
  "data-taco": "label",
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nimport './Field.css';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const { disabled, children, invalid = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-grey-300': disabled,\n },\n props.className\n );\n const messageClassName = cn(\n 'h-4 text-xs text-left leading-normal font-normal truncate -mb-4',\n {\n 'text-grey-700': !invalid,\n 'text-red-500': invalid,\n 'opacity-50': disabled,\n },\n props.className\n );\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <span className={messageClassName} role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n )}\n </label>\n );\n});\n"],"names":["Field","React","props","ref","disabled","children","invalid","message","otherProps","className","cn","messageClassName","role","undefined"],"mappings":";;;MAmBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASD,KAAK,CAACE,KAAiB,EAAEC,GAAgC;EACpG,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,OAAO,GAAG,KAAK;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC7E,MAAMO,SAAS,GAAGC,EAAE,CAChB,8EAA8E,EAC9E;IACI,eAAe,EAAEN;GACpB,EACDF,KAAK,CAACO,SAAS,CAClB;EACD,MAAME,gBAAgB,GAAGD,EAAE,CACvB,iEAAiE,EACjE;IACI,eAAe,EAAE,CAACJ,OAAO;IACzB,cAAc,EAAEA,OAAO;IACvB,YAAY,EAAEF;GACjB,EACDF,KAAK,CAACO,SAAS,CAClB;EAED,oBACIR,yCAAWO,UAAU;IAAEC,SAAS,EAAEA,SAAS;iBAAY,OAAO;IAACN,GAAG,EAAEA;MAC/DE,QAAQ,EACRE,OAAO,iBACJN;IAAMQ,SAAS,EAAEE,gBAAgB;IAAEC,IAAI,EAAEN,OAAO,GAAG,OAAO,GAAGO;KACxDN,OAAO,CAEf,CACG;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nimport './Field.css';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const { disabled, children, invalid = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-grey-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-grey-700': !invalid,\n 'text-red-500': invalid,\n 'opacity-50': disabled,\n });\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <span className={messageClassName} role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n )}\n </label>\n );\n});\n"],"names":["Field","React","props","ref","disabled","children","invalid","message","otherProps","className","cn","messageClassName","role","undefined"],"mappings":";;;MAmBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASD,KAAK,CAACE,KAAiB,EAAEC,GAAgC;EACpG,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,OAAO,GAAG,KAAK;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC7E,MAAMO,SAAS,GAAGC,EAAE,CAChB,8EAA8E,EAC9E;IACI,eAAe,EAAEN;GACpB,EACDF,KAAK,CAACO,SAAS,CAClB;EACD,MAAME,gBAAgB,GAAGD,EAAE,CAAC,iEAAiE,EAAE;IAC3F,eAAe,EAAE,CAACJ,OAAO;IACzB,cAAc,EAAEA,OAAO;IACvB,YAAY,EAAEF;GACjB,CAAC;EAEF,oBACIH,yCAAWO,UAAU;IAAEC,SAAS,EAAEA,SAAS;iBAAY,OAAO;IAACN,GAAG,EAAEA;MAC/DE,QAAQ,EACRE,OAAO,iBACJN;IAAMQ,SAAS,EAAEE,gBAAgB;IAAEC,IAAI,EAAEN,OAAO,GAAG,OAAO,GAAGO;KACxDN,OAAO,CAEf,CACG;AAEhB,CAAC;;;;"}
@@ -14,7 +14,7 @@ const Button = /*#__PURE__*/React__default.forwardRef(function Button(props, ref
14
14
  ref: ref
15
15
  }));
16
16
  });
17
- const getButtonClasses = (rounded = true) => cn('!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer relative', 'focus:!outline-none focus:!shadow-none focus-visible:!yt-focus-dark ', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', '!text-white hover:text-white focus:text-white', {
17
+ const getButtonClasses = (rounded = true) => cn('!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer relative', 'focus:!outline-none focus:!shadow-none focus-visible:!yt-focus-dark ', 'bg-transparent enabled:hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', 'text-white', {
18
18
  '!rounded-full': rounded
19
19
  });
20
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../../../../../src/components/Header/components/Button.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { IconButton, IconButtonProps } from '../../IconButton/IconButton';\n\nexport type ButtonProps = Omit<IconButtonProps, 'appearance' | 'aria-label'> & {\n 'aria-label': string;\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(props, ref) {\n const { ...attributes } = props;\n const className = cn(getButtonClasses(), props.className);\n\n return <IconButton {...attributes} appearance=\"discrete\" className={className} data-taco=\"header-button\" ref={ref} />;\n});\n\nexport const getButtonClasses = (rounded = true) =>\n cn(\n '!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer relative',\n 'focus:!outline-none focus:!shadow-none focus-visible:!yt-focus-dark ',\n 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]',\n '!text-white hover:text-white focus:text-white',\n {\n '!rounded-full': rounded,\n }\n );\n"],"names":["Button","React","forwardRef","props","ref","attributes","className","cn","getButtonClasses","IconButton","appearance","rounded"],"mappings":";;;;MAQaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAiC,SAASF,MAAM,CAACG,KAAK,EAAEC,GAAG;EAC7F,MAAM;IAAE,GAAGC;GAAY,GAAGF,KAAK;EAC/B,MAAMG,SAAS,GAAGC,EAAE,CAACC,gBAAgB,EAAE,EAAEL,KAAK,CAACG,SAAS,CAAC;EAEzD,oBAAOL,6BAACQ,UAAU,oBAAKJ,UAAU;IAAEK,UAAU,EAAC,UAAU;IAACJ,SAAS,EAAEA,SAAS;iBAAY,eAAe;IAACF,GAAG,EAAEA;KAAO;AACzH,CAAC;MAEYI,gBAAgB,GAAG,CAACG,OAAO,GAAG,IAAI,KAC3CJ,EAAE,CACE,6DAA6D,EAC7D,sEAAsE,EACtE,2FAA2F,EAC3F,+CAA+C,EAC/C;EACI,eAAe,EAAEI;CACpB;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../../../../../src/components/Header/components/Button.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { IconButton, IconButtonProps } from '../../IconButton/IconButton';\n\nexport type ButtonProps = Omit<IconButtonProps, 'appearance' | 'aria-label'> & {\n 'aria-label': string;\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(props, ref) {\n const { ...attributes } = props;\n const className = cn(getButtonClasses(), props.className);\n\n return <IconButton {...attributes} appearance=\"discrete\" className={className} data-taco=\"header-button\" ref={ref} />;\n});\n\nexport const getButtonClasses = (rounded = true) =>\n cn(\n '!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer relative',\n 'focus:!outline-none focus:!shadow-none focus-visible:!yt-focus-dark ',\n 'bg-transparent enabled:hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]',\n 'text-white',\n {\n '!rounded-full': rounded,\n }\n );\n"],"names":["Button","React","forwardRef","props","ref","attributes","className","cn","getButtonClasses","IconButton","appearance","rounded"],"mappings":";;;;MAQaA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAiC,SAASF,MAAM,CAACG,KAAK,EAAEC,GAAG;EAC7F,MAAM;IAAE,GAAGC;GAAY,GAAGF,KAAK;EAC/B,MAAMG,SAAS,GAAGC,EAAE,CAACC,gBAAgB,EAAE,EAAEL,KAAK,CAACG,SAAS,CAAC;EAEzD,oBAAOL,6BAACQ,UAAU,oBAAKJ,UAAU;IAAEK,UAAU,EAAC,UAAU;IAACJ,SAAS,EAAEA,SAAS;iBAAY,eAAe;IAACF,GAAG,EAAEA;KAAO;AACzH,CAAC;MAEYI,gBAAgB,GAAG,CAACG,OAAO,GAAG,IAAI,KAC3CJ,EAAE,CACE,6DAA6D,EAC7D,sEAAsE,EACtE,mGAAmG,EACnG,YAAY,EACZ;EACI,eAAe,EAAEI;CACpB;;;;"}
@@ -27,7 +27,7 @@ const Link = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
27
27
  }) : null, children, isNew ? /*#__PURE__*/React__default.createElement(Badge, {
28
28
  color: "blue",
29
29
  small: true,
30
- className: "absolute top-0 right-0 -mt-1.5 -mr-2.5 !h-3 !px-0.5 text-[0.55rem] font-normal"
30
+ className: "absolute right-0 top-0 -mr-2.5 -mt-1.5 !h-3 !px-0.5 text-[0.55rem] font-normal"
31
31
  }, texts.header.new) : null);
32
32
  if (tooltip) {
33
33
  return /*#__PURE__*/React__default.createElement(Tooltip, {
@@ -36,7 +36,7 @@ const Link = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
36
36
  }
37
37
  return link;
38
38
  });
39
- const getLinkClasses = (icon = undefined) => cn('flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ', 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', '!text-white hover:text-white focus:text-white', {
39
+ const getLinkClasses = (icon = undefined) => cn('flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ', 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', 'text-white hover:text-white focus:text-white', {
40
40
  '!rounded-full !h-9 !w-9': icon,
41
41
  'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon
42
42
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sources":["../../../../../../../../src/components/Header/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Badge } from '../../Badge/Badge';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type BaseLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n tooltip?: string;\n};\n\ninterface LinkPropsWithoutIcon extends BaseLinkProps {\n children: JSX.Element | string;\n icon?: never;\n isNew?: never;\n}\n\ninterface LinkPropsWithIcon extends Omit<BaseLinkProps, 'aria-label'> {\n 'aria-label': string;\n children?: never;\n icon: IconName;\n isNew?: boolean;\n}\n\nexport type LinkProps = LinkPropsWithoutIcon | LinkPropsWithIcon;\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(props, ref) {\n const { children, icon, isNew, tooltip, ...otherProps } = props;\n const { texts } = useLocalization();\n const className = cn(getLinkClasses(icon), 'relative', props.className);\n\n const link = (\n <a {...otherProps} className={className} data-taco=\"header-link\" ref={ref} tabIndex={0}>\n {icon ? <Icon name={icon} /> : null}\n {children}\n {isNew ? (\n <Badge\n color=\"blue\"\n small\n className=\"absolute top-0 right-0 -mt-1.5 -mr-2.5 !h-3 !px-0.5 text-[0.55rem] font-normal\">\n {texts.header.new}\n </Badge>\n ) : null}\n </a>\n );\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{link}</Tooltip>;\n }\n\n return link;\n});\n\nexport const getLinkClasses = (icon: IconName | undefined = undefined) =>\n cn(\n 'flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ',\n 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark',\n 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]',\n '!text-white hover:text-white focus:text-white',\n {\n '!rounded-full !h-9 !w-9': icon,\n 'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon,\n }\n );\n"],"names":["Link","React","forwardRef","props","ref","children","icon","isNew","tooltip","otherProps","texts","useLocalization","className","cn","getLinkClasses","link","tabIndex","Icon","name","Badge","color","small","header","new","Tooltip","title","undefined"],"mappings":";;;;;;;MA0BaA,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAA+B,SAASF,IAAI,CAACG,KAAK,EAAEC,GAAG;EACvF,MAAM;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,KAAK;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC/D,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGC,EAAE,CAACC,cAAc,CAACR,IAAI,CAAC,EAAE,UAAU,EAAEH,KAAK,CAACS,SAAS,CAAC;EAEvE,MAAMG,IAAI,gBACNd,oDAAOQ,UAAU;IAAEG,SAAS,EAAEA,SAAS;iBAAY,aAAa;IAACR,GAAG,EAAEA,GAAG;IAAEY,QAAQ,EAAE;MAChFV,IAAI,gBAAGL,6BAACgB,IAAI;IAACC,IAAI,EAAEZ;IAAQ,GAAG,IAAI,EAClCD,QAAQ,EACRE,KAAK,gBACFN,6BAACkB,KAAK;IACFC,KAAK,EAAC,MAAM;IACZC,KAAK;IACLT,SAAS,EAAC;KACTF,KAAK,CAACY,MAAM,CAACC,GAAG,CACb,GACR,IAAI,CAEf;EAED,IAAIf,OAAO,EAAE;IACT,oBAAOP,6BAACuB,OAAO;MAACC,KAAK,EAAEjB;OAAUO,IAAI,CAAW;;EAGpD,OAAOA,IAAI;AACf,CAAC;MAEYD,cAAc,GAAG,CAACR,OAA6BoB,SAAS,KACjEb,EAAE,CACE,gFAAgF,EAChF,qEAAqE,EACrE,2FAA2F,EAC3F,+CAA+C,EAC/C;EACI,yBAAyB,EAAEP,IAAI;EAC/B,uDAAuD,EAAE,CAACA;CAC7D;;;;"}
1
+ {"version":3,"file":"Link.js","sources":["../../../../../../../../src/components/Header/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Badge } from '../../Badge/Badge';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type BaseLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n tooltip?: string;\n};\n\ninterface LinkPropsWithoutIcon extends BaseLinkProps {\n children: JSX.Element | string;\n icon?: never;\n isNew?: never;\n}\n\ninterface LinkPropsWithIcon extends Omit<BaseLinkProps, 'aria-label'> {\n 'aria-label': string;\n children?: never;\n icon: IconName;\n isNew?: boolean;\n}\n\nexport type LinkProps = LinkPropsWithoutIcon | LinkPropsWithIcon;\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(props, ref) {\n const { children, icon, isNew, tooltip, ...otherProps } = props;\n const { texts } = useLocalization();\n const className = cn(getLinkClasses(icon), 'relative', props.className);\n\n const link = (\n <a {...otherProps} className={className} data-taco=\"header-link\" ref={ref} tabIndex={0}>\n {icon ? <Icon name={icon} /> : null}\n {children}\n {isNew ? (\n <Badge\n color=\"blue\"\n small\n className=\"absolute right-0 top-0 -mr-2.5 -mt-1.5 !h-3 !px-0.5 text-[0.55rem] font-normal\">\n {texts.header.new}\n </Badge>\n ) : null}\n </a>\n );\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{link}</Tooltip>;\n }\n\n return link;\n});\n\nexport const getLinkClasses = (icon: IconName | undefined = undefined) =>\n cn(\n 'flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ',\n 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark',\n 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]',\n 'text-white hover:text-white focus:text-white',\n {\n '!rounded-full !h-9 !w-9': icon,\n 'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon,\n }\n );\n"],"names":["Link","React","forwardRef","props","ref","children","icon","isNew","tooltip","otherProps","texts","useLocalization","className","cn","getLinkClasses","link","tabIndex","Icon","name","Badge","color","small","header","new","Tooltip","title","undefined"],"mappings":";;;;;;;MA0BaA,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAA+B,SAASF,IAAI,CAACG,KAAK,EAAEC,GAAG;EACvF,MAAM;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,KAAK;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC/D,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGC,EAAE,CAACC,cAAc,CAACR,IAAI,CAAC,EAAE,UAAU,EAAEH,KAAK,CAACS,SAAS,CAAC;EAEvE,MAAMG,IAAI,gBACNd,oDAAOQ,UAAU;IAAEG,SAAS,EAAEA,SAAS;iBAAY,aAAa;IAACR,GAAG,EAAEA,GAAG;IAAEY,QAAQ,EAAE;MAChFV,IAAI,gBAAGL,6BAACgB,IAAI;IAACC,IAAI,EAAEZ;IAAQ,GAAG,IAAI,EAClCD,QAAQ,EACRE,KAAK,gBACFN,6BAACkB,KAAK;IACFC,KAAK,EAAC,MAAM;IACZC,KAAK;IACLT,SAAS,EAAC;KACTF,KAAK,CAACY,MAAM,CAACC,GAAG,CACb,GACR,IAAI,CAEf;EAED,IAAIf,OAAO,EAAE;IACT,oBAAOP,6BAACuB,OAAO;MAACC,KAAK,EAAEjB;OAAUO,IAAI,CAAW;;EAGpD,OAAOA,IAAI;AACf,CAAC;MAEYD,cAAc,GAAG,CAACR,OAA6BoB,SAAS,KACjEb,EAAE,CACE,gFAAgF,EAChF,qEAAqE,EACrE,2FAA2F,EAC3F,8CAA8C,EAC9C;EACI,yBAAyB,EAAEP,IAAI;EAC/B,uDAAuD,EAAE,CAACA;CAC7D;;;;"}
@@ -11,9 +11,7 @@ const Base = /*#__PURE__*/forwardRef(function IconButtonBase(props, ref) {
11
11
  } = props;
12
12
  const className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
13
13
  'rounded-full': rounded,
14
- rounded: !rounded,
15
- 'cursor-not-allowed opacity-50': props.disabled,
16
- 'focus:yt-focus active:focus:yt-focus': !props.disabled
14
+ rounded: !rounded
17
15
  }, props.className);
18
16
  if (!icon) {
19
17
  return null;