@economic/taco 1.24.0 → 1.25.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/dist/components/Button/Button.d.ts +13 -0
  2. package/dist/components/Dialog/Dialog.d.ts +1 -1
  3. package/dist/components/Dialog/components/DialogDrawer.d.ts +10 -0
  4. package/dist/components/Drawer/Context.d.ts +18 -0
  5. package/dist/components/Drawer/Drawer.d.ts +51 -0
  6. package/dist/components/Drawer/components/Content.d.ts +53 -0
  7. package/dist/components/Drawer/components/Trigger.d.ts +3 -0
  8. package/dist/components/Drawer/images.d.ts +1 -0
  9. package/dist/components/Drawer/types.d.ts +2 -0
  10. package/dist/components/Drawer/util.d.ts +7 -0
  11. package/dist/components/Navigation2/components/Group.d.ts +5 -3
  12. package/dist/components/Navigation2/components/util.d.ts +1 -0
  13. package/dist/components/Provider/Localization.d.ts +6 -0
  14. package/dist/esm/packages/taco/src/components/Button/Button.js +2 -0
  15. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Button/util.js +5 -0
  17. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js +3 -3
  19. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Dialog/components/{Drawer.js → DialogDrawer.js} +4 -4
  21. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -0
  22. package/dist/esm/packages/taco/src/components/Drawer/Context.js +19 -0
  23. package/dist/esm/packages/taco/src/components/Drawer/Context.js.map +1 -0
  24. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +102 -0
  25. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -0
  26. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +292 -0
  27. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -0
  28. package/dist/esm/packages/taco/src/components/Drawer/components/Trigger.js +12 -0
  29. package/dist/esm/packages/taco/src/components/Drawer/components/Trigger.js.map +1 -0
  30. package/dist/esm/packages/taco/src/components/Drawer/util.js +37 -0
  31. package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -0
  32. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +4 -2
  33. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Header/components/Button.js +1 -0
  35. package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Header/components/Link.js +1 -0
  37. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +1 -0
  39. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Menu/Menu.js +2 -2
  41. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
  42. package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
  43. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
  44. package/dist/esm/packages/taco/src/components/Menu/components/Link.js +1 -1
  45. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +1 -1
  46. package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js +1 -1
  47. package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js +2 -1
  49. package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js +6 -6
  51. package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +2 -1
  53. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +2 -1
  55. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Navigation2/components/util.js +12 -0
  57. package/dist/esm/packages/taco/src/components/Navigation2/components/util.js.map +1 -0
  58. package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -0
  59. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  61. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
  62. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +1 -1
  63. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js +1 -1
  64. package/dist/esm/packages/taco/src/components/Table2/components/Search.js +1 -1
  65. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +1 -1
  66. package/dist/esm/packages/taco/src/index.js +2 -1
  67. package/dist/esm/packages/taco/src/index.js.map +1 -1
  68. package/dist/esm/packages/taco/src/utils/hooks/useDraggable.js +8 -1
  69. package/dist/esm/packages/taco/src/utils/hooks/useDraggable.js.map +1 -1
  70. package/dist/index.d.ts +1 -0
  71. package/dist/taco.cjs.development.js +559 -107
  72. package/dist/taco.cjs.development.js.map +1 -1
  73. package/dist/taco.cjs.production.min.js +1 -1
  74. package/dist/taco.cjs.production.min.js.map +1 -1
  75. package/package.json +3 -2
  76. package/tailwind.config.js +1 -0
  77. package/types.json +331 -4
  78. package/dist/components/Dialog/components/Drawer.d.ts +0 -10
  79. package/dist/esm/packages/taco/src/components/Dialog/components/Drawer.js.map +0 -1
@@ -0,0 +1,102 @@
1
+ import { forwardRef, useState, useMemo, useCallback, useEffect, createElement } from 'react';
2
+ import cn from 'classnames';
3
+ import { Root } from '@radix-ui/react-dialog';
4
+ import { DrawerContext } from './Context.js';
5
+ import { Content, InnerContent, Title, Footer, Close, Actions } from './components/Content.js';
6
+ import { useControllableState } from '@radix-ui/react-use-controllable-state';
7
+ import { Trigger } from './components/Trigger.js';
8
+
9
+ const Outlet = /*#__PURE__*/forwardRef(function Outlet(props, ref) {
10
+ const className = cn('h-full ml-auto overflow-hidden flex-shrink-0', props.className);
11
+ return /*#__PURE__*/createElement("div", Object.assign({}, props, {
12
+ className: className,
13
+ "data-taco": "drawer-outlet",
14
+ ref: ref
15
+ }));
16
+ });
17
+ // drawerStack getting set by previous drawer instance, to be able to close previous instance, when new instance getting opened.
18
+ let drawerStack;
19
+ const Drawer = /*#__PURE__*/forwardRef(function Drawer(props, ref) {
20
+ const {
21
+ open: openProp,
22
+ defaultOpen: defaultOpenProp,
23
+ // if onChange is not provided, then replace it with empty function, needed for useControllableState
24
+ onChange = () => {
25
+ // do nothing.
26
+ },
27
+ variant = 'embedded',
28
+ className,
29
+ closeOnEscape = true,
30
+ onResize,
31
+ onClose,
32
+ size = 'md',
33
+ trigger,
34
+ children,
35
+ focusTrap = props.focusTrap === undefined && props.variant === 'overlay' ? true : props.focusTrap,
36
+ showCloseButton = true,
37
+ ...otherProps
38
+ } = props;
39
+ const [open, setOpen] = useControllableState({
40
+ prop: openProp,
41
+ defaultProp: defaultOpenProp,
42
+ onChange
43
+ });
44
+ const [outlet, setOutlet] = useState();
45
+ const context = useMemo(() => ({
46
+ closeOnEscape,
47
+ onClose,
48
+ onResize,
49
+ props: otherProps,
50
+ size,
51
+ ref,
52
+ open,
53
+ setOpen,
54
+ variant,
55
+ focusTrap,
56
+ showCloseButton,
57
+ outlet
58
+ }), [closeOnEscape, open, setOpen, otherProps, variant, onResize, onClose, size, focusTrap, showCloseButton, outlet]);
59
+ // this prevents two drawers being open at once and used when one drawer getting opened before another one got closed.
60
+ const close = useCallback(() => {
61
+ setOpen(false);
62
+ onClose && onClose();
63
+ }, []);
64
+ useEffect(() => {
65
+ var _document$querySelect;
66
+ const outletElement = (_document$querySelect = document.querySelector('[data-taco="drawer-outlet"]')) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.body;
67
+ setOutlet(outletElement);
68
+ }, []);
69
+ useEffect(() => {
70
+ if (open) {
71
+ // if drawerStack is defined, this means that another drawer was opened before
72
+ if (drawerStack) {
73
+ drawerStack();
74
+ }
75
+ drawerStack = close;
76
+ } else {
77
+ // if drawerStack is equal to current close callback,
78
+ // this means that drawer getting closed completely instead of getting closed on re-open
79
+ if (drawerStack === close) {
80
+ drawerStack = undefined;
81
+ }
82
+ }
83
+ }, [open]);
84
+ return /*#__PURE__*/createElement(DrawerContext.Provider, {
85
+ value: context
86
+ }, /*#__PURE__*/createElement(Root, {
87
+ modal: variant === 'overlay' ? true : false,
88
+ open: open,
89
+ onOpenChange: setOpen
90
+ }, trigger && /*#__PURE__*/createElement(Trigger, null, trigger), children));
91
+ });
92
+ Drawer.Trigger = Trigger;
93
+ Drawer.Content = Content;
94
+ Drawer.InnerContent = InnerContent;
95
+ Drawer.Title = Title;
96
+ Drawer.Footer = Footer;
97
+ Drawer.Close = Close;
98
+ Drawer.Actions = Actions;
99
+ Drawer.Outlet = Outlet;
100
+
101
+ export { Drawer };
102
+ //# sourceMappingURL=Drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.js","sources":["../../../../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n Actions,\n Footer,\n InnerContent,\n DrawerInnerContentProps,\n DrawerFooterProps,\n DrawerTitleProps,\n Title,\n Close,\n Content,\n DrawerContentProps,\n DrawerCloseProps,\n} from './components/Content';\nimport { GroupProps } from '../Group/Group';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport cn from 'classnames';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { DrawerTriggerProps, Trigger } from './components/Trigger';\nimport { DrawerContext } from './Context';\nimport { DrawerSize, DrawerVariant } from './types';\n\nexport type DrawerTexts = {\n /**\n * Aria-label for close icon button in drawer.\n */\n close: string;\n};\n\nexport type DrawerProps = Omit<DialogProps, 'draggable' | 'size'> & {\n children: React.ReactNode | React.ReactNode[];\n /** Size of the drawer. This is the recommended way to set a size for drawer component. */\n size?: DrawerSize;\n /** When `true`, pressing escape will close the drawer */\n closeOnEscape?: boolean;\n /** Set whether the drawer is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Handler called when drawer closes by user interaction */\n onClose?: () => void;\n /** Called when the drawer opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean | undefined) => void;\n /** Control the open state of the drawer from outside the component */\n open?: boolean;\n /** A trigger to be used for the drawer, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n /** Triggers when resizing, can be throttled or debounced for better performances */\n onResize?: (delta: number) => void;\n /** Rendering variant of the drawer */\n variant?: DrawerVariant;\n /** className for children container, needed for embedded version, in cases where we might need to control children height */\n className?: string;\n /** When 'true' preventing focus from leaving drawer content */\n focusTrap?: boolean;\n /** When 'true' renders close button in topr right cornenr of drawer content */\n showCloseButton?: boolean;\n};\n\nexport type OutletProps = React.HTMLAttributes<HTMLDivElement>;\nconst Outlet = React.forwardRef(function Outlet(props: OutletProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('h-full ml-auto overflow-hidden flex-shrink-0', props.className);\n return <div {...props} className={className} data-taco=\"drawer-outlet\" ref={ref} />;\n});\n\n// drawerStack getting set by previous drawer instance, to be able to close previous instance, when new instance getting opened.\nlet drawerStack: undefined | (() => void);\n\nexport type ForwardedDrawerWithStatics = React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<DrawerTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;\n InnerContent: React.ForwardRefExoticComponent<DrawerInnerContentProps & React.RefAttributes<HTMLDivElement>>;\n Title: React.ForwardRefExoticComponent<DrawerTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<DrawerFooterProps & React.RefAttributes<HTMLDivElement>>;\n Close: React.ForwardRefExoticComponent<DrawerCloseProps & React.RefAttributes<HTMLButtonElement>>;\n Actions: React.ForwardRefExoticComponent<GroupProps & React.RefAttributes<HTMLDivElement>>;\n Outlet: React.ForwardRefExoticComponent<OutletProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Drawer = React.forwardRef(function Drawer(props: DrawerProps, ref: React.Ref<HTMLElement>) {\n const {\n open: openProp,\n defaultOpen: defaultOpenProp,\n // if onChange is not provided, then replace it with empty function, needed for useControllableState\n onChange = () => {\n // do nothing.\n },\n variant = 'embedded',\n className,\n closeOnEscape = true,\n onResize,\n onClose,\n size = 'md',\n trigger,\n children,\n focusTrap = props.focusTrap === undefined && props.variant === 'overlay' ? true : props.focusTrap,\n showCloseButton = true,\n ...otherProps\n } = props;\n\n const [open, setOpen] = useControllableState<boolean | undefined>({\n prop: openProp,\n defaultProp: defaultOpenProp,\n onChange,\n });\n\n const [outlet, setOutlet] = React.useState<HTMLElement>();\n\n const context = React.useMemo(\n () => ({\n closeOnEscape,\n onClose,\n onResize,\n props: otherProps,\n size,\n ref,\n open,\n setOpen,\n variant,\n focusTrap,\n showCloseButton,\n outlet,\n }),\n [closeOnEscape, open, setOpen, otherProps, variant, onResize, onClose, size, focusTrap, showCloseButton, outlet]\n );\n\n // this prevents two drawers being open at once and used when one drawer getting opened before another one got closed.\n const close = React.useCallback(() => {\n setOpen(false);\n onClose && onClose();\n }, []);\n\n React.useEffect(() => {\n const outletElement = document.querySelector<HTMLElement>('[data-taco=\"drawer-outlet\"]') ?? document.body;\n setOutlet(outletElement);\n }, []);\n\n React.useEffect(() => {\n if (open) {\n // if drawerStack is defined, this means that another drawer was opened before\n if (drawerStack) {\n drawerStack();\n }\n drawerStack = close;\n } else {\n // if drawerStack is equal to current close callback,\n // this means that drawer getting closed completely instead of getting closed on re-open\n if (drawerStack === close) {\n drawerStack = undefined;\n }\n }\n }, [open]);\n\n return (\n <DrawerContext.Provider value={context}>\n <DialogPrimitive.Root modal={variant === 'overlay' ? true : false} open={open} onOpenChange={setOpen}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </DialogPrimitive.Root>\n </DrawerContext.Provider>\n );\n}) as ForwardedDrawerWithStatics;\n\nDrawer.Trigger = Trigger;\nDrawer.Content = Content;\nDrawer.InnerContent = InnerContent;\nDrawer.Title = Title;\nDrawer.Footer = Footer;\nDrawer.Close = Close;\nDrawer.Actions = Actions;\nDrawer.Outlet = Outlet;\n"],"names":["Outlet","React","props","ref","className","cn","drawerStack","Drawer","open","openProp","defaultOpen","defaultOpenProp","onChange","variant","closeOnEscape","onResize","onClose","size","trigger","children","focusTrap","undefined","showCloseButton","otherProps","setOpen","useControllableState","prop","defaultProp","outlet","setOutlet","context","close","outletElement","document","querySelector","body","DrawerContext","Provider","value","DialogPrimitive","modal","onOpenChange","Trigger","Content","InnerContent","Title","Footer","Close","Actions"],"mappings":";;;;;;;;AA2DA,MAAMA,MAAM,gBAAGC,UAAgB,CAAC,SAASD,MAAM,CAACE,KAAkB,EAAEC,GAA8B;EAC9F,MAAMC,SAAS,GAAGC,EAAE,CAAC,8CAA8C,EAAEH,KAAK,CAACE,SAAS,CAAC;EACrF,oBAAOH,uCAASC,KAAK;IAAEE,SAAS,EAAEA,SAAS;iBAAY,eAAe;IAACD,GAAG,EAAEA;KAAO;AACvF,CAAC,CAAC;AAEF;AACA,IAAIG,WAAqC;MAa5BC,MAAM,gBAAGN,UAAgB,CAAC,SAASM,MAAM,CAACL,KAAkB,EAAEC,GAA2B;EAClG,MAAM;IACFK,IAAI,EAAEC,QAAQ;IACdC,WAAW,EAAEC,eAAe;;IAE5BC,QAAQ,GAAG;;KAEV;IACDC,OAAO,GAAG,UAAU;IACpBT,SAAS;IACTU,aAAa,GAAG,IAAI;IACpBC,QAAQ;IACRC,OAAO;IACPC,IAAI,GAAG,IAAI;IACXC,OAAO;IACPC,QAAQ;IACRC,SAAS,GAAGlB,KAAK,CAACkB,SAAS,KAAKC,SAAS,IAAInB,KAAK,CAACW,OAAO,KAAK,SAAS,GAAG,IA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cAACmC,aAAa,CAACC,QAAQ;IAACC,KAAK,EAAER;kBAC3B7B,cAACsC,IAAoB;IAACC,KAAK,EAAE3B,OAAO,KAAK,SAAS,GAAG,IAAI,GAAG,KAAK;IAAEL,IAAI,EAAEA,IAAI;IAAEiC,YAAY,EAAEjB;KACxFN,OAAO,iBAAIjB,cAACyC,OAAO,QAAExB,OAAO,CAAW,EACvCC,QAAQ,CACU,CACF;AAEjC,CAAC;AAEDZ,MAAM,CAACmC,OAAO,GAAGA,OAAO;AACxBnC,MAAM,CAACoC,OAAO,GAAGA,OAAO;AACxBpC,MAAM,CAACqC,YAAY,GAAGA,YAAY;AAClCrC,MAAM,CAACsC,KAAK,GAAGA,KAAK;AACpBtC,MAAM,CAACuC,MAAM,GAAGA,MAAM;AACtBvC,MAAM,CAACwC,KAAK,GAAGA,KAAK;AACpBxC,MAAM,CAACyC,OAAO,GAAGA,OAAO;AACxBzC,MAAM,CAACP,MAAM,GAAGA,MAAM;;;;"}
@@ -0,0 +1,292 @@
1
+ import React__default from 'react';
2
+ import cn from 'classnames';
3
+ import { Backdrop } from '../../Backdrop/Backdrop.js';
4
+ import { IconButton } from '../../IconButton/IconButton.js';
5
+ import { useLocalization } from '../../Provider/Localization.js';
6
+ import { useMergedRef } from '../../../hooks/useMergedRef.js';
7
+ import { Title as Title$1, Close as Close$1, Portal as Portal$1, Overlay, Content as Content$1 } from '@radix-ui/react-dialog';
8
+ import { useDraggable } from '../../../utils/hooks/useDraggable.js';
9
+ import { Group } from '../../Group/Group.js';
10
+ import { useCurrentMenu } from '../../Menu/Context.js';
11
+ import { useCurrentDrawer } from '../Context.js';
12
+ import { getBackdropClassNames, getDrawerContainerClassNames, getDrawerContentClassNames, getDrawerDragHandlerClassNames } from '../util.js';
13
+ import { useGlobalKeyboardShortcut } from '../../../hooks/useGlobalKeyboardShortcut.js';
14
+ import { FocusScope } from '@react-aria/focus';
15
+ import { ScrollArea } from '../../ScrollArea/ScrollArea.js';
16
+
17
+ const RESIZE_MIN = 360;
18
+ const RESIZE_MAX = 1000;
19
+ var DrawerAnimationDefinition;
20
+ (function (DrawerAnimationDefinition) {
21
+ DrawerAnimationDefinition["Visible"] = "visible";
22
+ DrawerAnimationDefinition["Hidden"] = "hidden";
23
+ })(DrawerAnimationDefinition || (DrawerAnimationDefinition = {}));
24
+ const RenderPropWrapper = /*#__PURE__*/React__default.forwardRef(function RenderPropWrapper({
25
+ children,
26
+ onClick,
27
+ renderProps
28
+ }, ref) {
29
+ const close = () => {
30
+ onClick(new CustomEvent('close'));
31
+ };
32
+ return children({
33
+ close,
34
+ ref,
35
+ ...renderProps
36
+ });
37
+ });
38
+ const Title = /*#__PURE__*/React__default.forwardRef(function DrawerTitle(props, ref) {
39
+ const {
40
+ className,
41
+ children,
42
+ ...otherProps
43
+ } = props;
44
+ /**
45
+ * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,
46
+ * where we might want to hide the grey separator. For this reason separator was rendedr with using of classNames,
47
+ * so it can be easily overriden in exceptional scenarious.
48
+ * */
49
+ const cName = cn('grow-0 py-4 pl-4 justyfy-self-start mb-0 border-b-[1px] border-grey-300', className);
50
+ return /*#__PURE__*/React__default.createElement(Title$1, Object.assign({
51
+ className: cName
52
+ }, otherProps, {
53
+ ref: ref
54
+ }), /*#__PURE__*/React__default.createElement("span", {
55
+ className: "line-clamp-2 inline-block w-4/6 overflow-y-hidden"
56
+ }, children));
57
+ });
58
+ const Footer = /*#__PURE__*/React__default.forwardRef(function DrawerFooter(props, ref) {
59
+ const {
60
+ className,
61
+ ...otherProps
62
+ } = props;
63
+ /**
64
+ * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.
65
+ */
66
+ const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-grey-300', props.className);
67
+ return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
68
+ className: cName,
69
+ ref: ref
70
+ }));
71
+ });
72
+ const Actions = /*#__PURE__*/React__default.forwardRef(function Actions(props, ref) {
73
+ const {
74
+ className,
75
+ ...otherProps
76
+ } = props;
77
+ const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);
78
+ return /*#__PURE__*/React__default.createElement(Group, Object.assign({}, otherProps, {
79
+ className: cName,
80
+ ref: ref
81
+ }));
82
+ });
83
+ const Close = /*#__PURE__*/React__default.forwardRef(function DrawerClose(props, ref) {
84
+ const {
85
+ onClose
86
+ } = useCurrentDrawer();
87
+ return /*#__PURE__*/React__default.createElement(Close$1, Object.assign({}, props, {
88
+ onClick: onClose,
89
+ ref: ref,
90
+ asChild: true
91
+ }));
92
+ });
93
+ const InnerContent = /*#__PURE__*/React__default.forwardRef(function InnerContent(props, ref) {
94
+ const {
95
+ className,
96
+ isScrollable = true,
97
+ children,
98
+ ...otherProps
99
+ } = props;
100
+ const cName = cn('grow-1 p-4', className);
101
+ return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
102
+ className: cName,
103
+ ref: ref
104
+ }), isScrollable ? /*#__PURE__*/React__default.createElement(ScrollArea, {
105
+ className: "w-full gap-y-0.5"
106
+ }, children) : {
107
+ children
108
+ });
109
+ });
110
+ const Portal = props => {
111
+ const {
112
+ children,
113
+ ...otherProps
114
+ } = props;
115
+ const {
116
+ open = false,
117
+ variant,
118
+ outlet
119
+ } = useCurrentDrawer();
120
+ const backdropClassNames = React__default.useMemo(() => {
121
+ return getBackdropClassNames(open);
122
+ }, [open]);
123
+ if (!outlet) {
124
+ return null;
125
+ }
126
+ return /*#__PURE__*/React__default.createElement(Portal$1, Object.assign({}, otherProps, {
127
+ container: outlet !== null && outlet !== void 0 ? outlet : undefined
128
+ }), variant === 'overlay' ? /*#__PURE__*/React__default.createElement(Overlay, {
129
+ forceMount: true
130
+ }, /*#__PURE__*/React__default.createElement(Backdrop, {
131
+ className: backdropClassNames
132
+ })) : null, children);
133
+ };
134
+ const UntrappedFocusDrawerContent = /*#__PURE__*/React__default.forwardRef(function EmbeddedDrawerContent(props, ref) {
135
+ const {
136
+ onEscape,
137
+ children,
138
+ ...otherProps
139
+ } = props;
140
+ useGlobalKeyboardShortcut(event => {
141
+ if (event.key === 'Escape') {
142
+ onEscape(event);
143
+ }
144
+ });
145
+ return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
146
+ ref: ref
147
+ }), /*#__PURE__*/React__default.createElement(FocusScope, {
148
+ autoFocus: true,
149
+ restoreFocus: true
150
+ }, children));
151
+ });
152
+ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(props, externalRef) {
153
+ const {
154
+ size,
155
+ onClose,
156
+ onResize,
157
+ open = false,
158
+ closeOnEscape,
159
+ variant,
160
+ focusTrap,
161
+ showCloseButton,
162
+ setOpen
163
+ } = useCurrentDrawer();
164
+ const {
165
+ className,
166
+ style,
167
+ children,
168
+ ...otherProps
169
+ } = props;
170
+ const {
171
+ texts
172
+ } = useLocalization();
173
+ const ref = useMergedRef(externalRef);
174
+ // if the drawer was opened by a menu, we need to close the menu when the drawer closes
175
+ // the menu is still open (and mounted) because it is the trigger for the drawer
176
+ const menu = useCurrentMenu();
177
+ let handleCloseAutoFocus;
178
+ if (menu) {
179
+ handleCloseAutoFocus = () => {
180
+ menu.close();
181
+ };
182
+ }
183
+ const containerClassName = React__default.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);
184
+ const {
185
+ contentClassName,
186
+ dragHandlerClassName
187
+ } = React__default.useMemo(() => {
188
+ const contentClassName = getDrawerContentClassNames(size, variant, open);
189
+ const dragHandlerClassName = getDrawerDragHandlerClassNames();
190
+ return {
191
+ contentClassName,
192
+ dragHandlerClassName
193
+ };
194
+ }, [size, variant, open]);
195
+ const handleEscapeKeyDown = event => {
196
+ var _ref$current;
197
+ const isTargetInsideDrawerContent = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(event.target);
198
+ if (isTargetInsideDrawerContent) {
199
+ if (!closeOnEscape) {
200
+ event.preventDefault();
201
+ } else {
202
+ setOpen && setOpen(false);
203
+ if (onClose) {
204
+ onClose();
205
+ }
206
+ }
207
+ }
208
+ };
209
+ const [containerWidth, setContainerWidth] = React__default.useState();
210
+ const dragHandlerRef = React__default.useRef(null);
211
+ const {
212
+ position,
213
+ dragging,
214
+ handleProps: dragHandleProps,
215
+ resetPosition
216
+ } = useDraggable(useMergedRef(dragHandlerRef));
217
+ const contentRef = React__default.useRef(null);
218
+ React__default.useEffect(() => {
219
+ if (onResize) {
220
+ onResize(position.x);
221
+ }
222
+ }, [position]);
223
+ React__default.useEffect(() => {
224
+ var _contentRef$current;
225
+ setContainerWidth((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.offsetWidth);
226
+ }, [contentRef, open]);
227
+ const resizedWidth = React__default.useMemo(() => {
228
+ if (containerWidth) {
229
+ return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));
230
+ }
231
+ return;
232
+ }, [containerWidth, position]);
233
+ React__default.useEffect(() => {
234
+ if (!dragging && resizedWidth) {
235
+ setContainerWidth(resizedWidth);
236
+ resetPosition();
237
+ }
238
+ }, [dragging]);
239
+ let output;
240
+ if (typeof children === 'function') {
241
+ output = /*#__PURE__*/React__default.createElement(Close, null, /*#__PURE__*/React__default.createElement(RenderPropWrapper, null, children));
242
+ } else {
243
+ output = children;
244
+ }
245
+ const content = /*#__PURE__*/React__default.createElement("div", {
246
+ ref: contentRef,
247
+ "data-taco": "drawer",
248
+ className: containerClassName
249
+ }, /*#__PURE__*/React__default.createElement("div", Object.assign({
250
+ className: dragHandlerClassName
251
+ }, dragHandleProps, {
252
+ "data-testid": "resize-handler",
253
+ ref: dragHandlerRef
254
+ })), output, showCloseButton ? /*#__PURE__*/React__default.createElement(Close, null, /*#__PURE__*/React__default.createElement(IconButton, {
255
+ appearance: "discrete",
256
+ "aria-label": texts.drawer.close,
257
+ className: "absolute top-0 right-0 mt-4 mr-2",
258
+ icon: "close"
259
+ })) : null);
260
+ const styleProp = {
261
+ ...style,
262
+ ...{
263
+ width: resizedWidth
264
+ }
265
+ };
266
+ return focusTrap ? /*#__PURE__*/React__default.createElement(Content$1, Object.assign({
267
+ forceMount: true
268
+ }, otherProps, {
269
+ className: contentClassName,
270
+ onEscapeKeyDown: handleEscapeKeyDown,
271
+ onInteractOutside: variant === 'overlay' ? undefined : event => event.preventDefault(),
272
+ onCloseAutoFocus: handleCloseAutoFocus,
273
+ ref: ref,
274
+ style: styleProp
275
+ }), content) : /*#__PURE__*/React__default.createElement(UntrappedFocusDrawerContent, {
276
+ onEscape: handleEscapeKeyDown,
277
+ className: contentClassName,
278
+ style: styleProp,
279
+ ref: ref
280
+ }, content);
281
+ });
282
+ const Content = /*#__PURE__*/React__default.forwardRef(function Content(props, externalRef) {
283
+ const {
284
+ children
285
+ } = props;
286
+ return /*#__PURE__*/React__default.createElement(Portal, null, /*#__PURE__*/React__default.createElement(DrawerContent, Object.assign({}, props, {
287
+ ref: externalRef
288
+ }), children));
289
+ });
290
+
291
+ export { Actions, Close, Content, DrawerAnimationDefinition, DrawerContent, Footer, InnerContent, Title };
292
+ //# sourceMappingURL=Content.js.map
@@ -0,0 +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 { useGlobalKeyboardShortcut } from '../../../hooks/useGlobalKeyboardShortcut';\nimport { FocusScope } from '@react-aria/focus';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\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 useGlobalKeyboardShortcut((event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onEscape(event);\n }\n });\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","useGlobalKeyboardShortcut","event","key","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","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,MAAM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EAED,MAAMC,SAAS,GAAG;IACd,GAAG5C,KAAK;IACR,GAAG;MAAE6C,KAAK,EAAEX;;GACf;EAED,OAAOrC,SAAS,gBACZtD,6BAACe,SAAuB;IACpBsB,UAAU;KACNzB,UAAU;IACdD,SAAS,EAAEuD,gBAAgB;IAC3BqC,eAAe,EAAEjC,mBAAmB;IACpCkC,iBAAiB,EAAE1E,OAAO,KAAK,SAAS,GAAGM,SAAS,GAAGO,KAAK,IAAIA,KAAK,CAACgC,cAAc,EAAE;IACtF8B,gBAAgB,EAAE1C,oBAAoB;IACtC1D,GAAG,EAAEA,GAAG;IACRoD,KAAK,EAAE4C;MACNL,OAAO,CACc,gBAE1BhG,6BAACuC,2BAA2B;IAACE,QAAQ,EAAE6B,mBAAmB;IAAE3D,SAAS,EAAEuD,gBAAgB;IAAET,KAAK,EAAE4C,SAAS;IAAEhG,GAAG,EAAEA;KAC3G2F,OAAO,CAEf;AACL,CAAC;MAEY/C,OAAO,gBAAGjD,cAAK,CAACC,UAAU,CAAC,SAASgD,OAAO,CAACvC,KAAyB,EAAEwC,WAAsC;EACtH,MAAM;IAAEhD;GAAU,GAAGQ,KAAK;EAE1B,oBACIV,6BAAC4B,MAAM,qBACH5B,6BAACgD,aAAa,oBAAKtC,KAAK;IAAEL,GAAG,EAAE6C;MAC1BhD,QAAQ,CACG,CACX;AAEjB,CAAC;;;;"}
@@ -0,0 +1,12 @@
1
+ import { forwardRef, createElement } from 'react';
2
+ import { Trigger as Trigger$1 } from '@radix-ui/react-dialog';
3
+
4
+ const Trigger = /*#__PURE__*/forwardRef(function DrawerTrigger(props, ref) {
5
+ return /*#__PURE__*/createElement(Trigger$1, Object.assign({}, props, {
6
+ ref: ref,
7
+ asChild: true
8
+ }));
9
+ });
10
+
11
+ export { Trigger };
12
+ //# sourceMappingURL=Trigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Drawer/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nexport type DrawerTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Trigger = React.forwardRef(function DrawerTrigger(props: DrawerTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n return <DialogPrimitive.Trigger {...props} ref={ref} asChild />;\n});\n"],"names":["Trigger","React","DrawerTrigger","props","ref","DialogPrimitive","asChild"],"mappings":";;;MAIaA,OAAO,gBAAGC,UAAgB,CAAC,SAASC,aAAa,CAACC,KAAyB,EAAEC,GAAiC;EACvH,oBAAOH,cAACI,SAAuB,oBAAKF,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEE,OAAO;KAAG;AACnE,CAAC;;;;"}
@@ -0,0 +1,37 @@
1
+ import cn from 'classnames';
2
+
3
+ const getDrawerSizeClassnames = size => {
4
+ switch (size) {
5
+ case 'lg':
6
+ return 'w-[600px]';
7
+ case 'md':
8
+ default:
9
+ return 'w-[420px]';
10
+ }
11
+ };
12
+ const getDrawerContentClassNames = (size, variant, open) => {
13
+ return cn('bg-white h-full bottom-0 top-0 right-0 transition-none', {
14
+ block: open,
15
+ hidden: !open,
16
+ fixed: variant === 'overlay',
17
+ 'relative h-full overflow-hidden': variant === 'embedded'
18
+ }, getDrawerSizeClassnames(size));
19
+ };
20
+ const getDrawerContainerClassNames = variant => {
21
+ return cn('bg-white mx-auto absolute h-full w-full flex flex-col ', {
22
+ 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]': variant === 'overlay',
23
+ 'border-l border-grey h-full': variant === 'embedded'
24
+ });
25
+ };
26
+ const getDrawerDragHandlerClassNames = () => {
27
+ return cn('border-[2px] absolute border-transparent top-0 w-2 h-full cursor-ew-resize left-0 hover:border-l-blue-500');
28
+ };
29
+ const getBackdropClassNames = open => {
30
+ return cn({
31
+ block: open,
32
+ hidden: !open
33
+ });
34
+ };
35
+
36
+ export { getBackdropClassNames, getDrawerContainerClassNames, getDrawerContentClassNames, getDrawerDragHandlerClassNames, getDrawerSizeClassnames };
37
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Drawer/util.ts"],"sourcesContent":["import { DrawerSize, DrawerVariant } from './types';\nimport cn from 'classnames';\n\nexport const getDrawerSizeClassnames = (size: DrawerSize): string => {\n switch (size) {\n case 'lg':\n return 'w-[600px]';\n case 'md':\n default:\n return 'w-[420px]';\n }\n};\n\nexport const getDrawerPrimitiveContentClassNames = (): string => {\n return 'fixed bottom-0 top-0 right-0';\n};\n\nexport const getDrawerContentClassNames = (size: DrawerSize, variant: DrawerVariant, open: boolean): string => {\n return cn(\n 'bg-white h-full bottom-0 top-0 right-0 transition-none',\n {\n block: open,\n hidden: !open,\n fixed: variant === 'overlay',\n 'relative h-full overflow-hidden': variant === 'embedded',\n },\n getDrawerSizeClassnames(size)\n );\n};\n\nexport const getDrawerContainerClassNames = (variant: DrawerVariant): string => {\n return cn('bg-white mx-auto absolute h-full w-full flex flex-col ', {\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]': variant === 'overlay',\n 'border-l border-grey h-full': variant === 'embedded',\n });\n};\n\nexport const getDrawerDragHandlerClassNames = (): string => {\n return cn('border-[2px] absolute border-transparent top-0 w-2 h-full cursor-ew-resize left-0 hover:border-l-blue-500');\n};\n\nexport const getBackdropClassNames = (open: boolean): string => {\n return cn({\n block: open,\n hidden: !open,\n });\n};\n"],"names":["getDrawerSizeClassnames","size","getDrawerContentClassNames","variant","open","cn","block","hidden","fixed","getDrawerContainerClassNames","getDrawerDragHandlerClassNames","getBackdropClassNames"],"mappings":";;MAGaA,uBAAuB,GAAIC,IAAgB;EACpD,QAAQA,IAAI;IACR,KAAK,IAAI;MACL,OAAO,WAAW;IACtB,KAAK,IAAI;IACT;MACI,OAAO,WAAW;;AAE9B;MAMaC,0BAA0B,GAAG,CAACD,IAAgB,EAAEE,OAAsB,EAAEC,IAAa;EAC9F,OAAOC,EAAE,CACL,wDAAwD,EACxD;IACIC,KAAK,EAAEF,IAAI;IACXG,MAAM,EAAE,CAACH,IAAI;IACbI,KAAK,EAAEL,OAAO,KAAK,SAAS;IAC5B,iCAAiC,EAAEA,OAAO,KAAK;GAClD,EACDH,uBAAuB,CAACC,IAAI,CAAC,CAChC;AACL;MAEaQ,4BAA4B,GAAIN,OAAsB;EAC/D,OAAOE,EAAE,CAAC,wDAAwD,EAAE;IAChE,sEAAsE,EAAEF,OAAO,KAAK,SAAS;IAC7F,6BAA6B,EAAEA,OAAO,KAAK;GAC9C,CAAC;AACN;MAEaO,8BAA8B,GAAG;EAC1C,OAAOL,EAAE,CAAC,2GAA2G,CAAC;AAC1H;MAEaM,qBAAqB,GAAIP,IAAa;EAC/C,OAAOC,EAAE,CAAC;IACNC,KAAK,EAAEF,IAAI;IACXG,MAAM,EAAE,CAACH;GACZ,CAAC;AACN;;;;"}
@@ -4,15 +4,16 @@ import { useLocalization } from '../../Provider/Localization.js';
4
4
  import { Button } from '../../Button/Button.js';
5
5
  import { Root, Trigger, Content } from '@radix-ui/react-popover';
6
6
  import { createCustomKeyboardEvent } from '../../../utils/input.js';
7
- import { SearchInput } from '../../SearchInput/SearchInput.js';
8
7
  import { useControllableState } from '@radix-ui/react-use-controllable-state';
8
+ import { SearchInput } from '../../SearchInput/SearchInput.js';
9
9
  import { Root as Root$1 } from '../../../primitives/Collection/components/Root.js';
10
10
  import '../../../primitives/Collection/Collection.js';
11
11
  import { AgreementDetails } from './Agreements/AgreementDetails.js';
12
12
 
13
13
  const Container = props => {
14
14
  return /*#__PURE__*/React__default.createElement("div", {
15
- className: "-ml-3 flex flex-shrink-0 flex-grow-0 items-center gap-2 xl:ml-auto xl:w-64 xl:pr-2"
15
+ className: "-ml-3 flex flex-shrink-0 flex-grow-0 items-center gap-2 xl:ml-auto xl:w-64 xl:pr-2",
16
+ "data-taco": "header-agreements"
16
17
  }, /*#__PURE__*/React__default.createElement("span", {
17
18
  className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
18
19
  }), props.children);
@@ -121,6 +122,7 @@ const isCurrentAgreement = (agreement, currentAgreement) => {
121
122
  const createAgreementButton = (agreement, fallbackImageSrc, onChangeAgreement, isCurrentAgreement = false) => /*#__PURE__*/React__default.createElement("button", {
122
123
  "aria-current": isCurrentAgreement ? 'true' : undefined,
123
124
  className: "focus:yt-focus-dark w-full rounded outline-none",
125
+ "data-taco": "header-agreements-agreement",
124
126
  key: `${agreement.number}_${agreement.userId}`,
125
127
  onClick: () => onChangeAgreement(agreement),
126
128
  onKeyDown: () => onChangeAgreement(agreement),
@@ -1 +1 @@
1
- {"version":3,"file":"AgreementSelector.js","sources":["../../../../../../../../src/components/Header/components/AgreementSelector.tsx"],"sourcesContent":["import React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as CollectionPrimitive from '../../../primitives/Collection/Collection';\nimport { Agreement, AgreementDetails } from './Agreements/AgreementDetails';\nimport { createCustomKeyboardEvent } from '../../../utils/input';\nimport { Icon } from '../../Icon/Icon';\nimport { SearchInput } from '../../SearchInput/SearchInput';\nimport { Button } from '../../Button/Button';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst Container = props => {\n return (\n <div className=\"-ml-3 flex flex-shrink-0 flex-grow-0 items-center gap-2 xl:ml-auto xl:w-64 xl:pr-2\">\n <span className=\"hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex\" />\n {props.children}\n </div>\n );\n};\n\nexport type AgreementDisplayProps = React.HTMLAttributes<HTMLDivElement> & {\n currentAgreement: Agreement;\n fallbackImageSrc: string;\n};\n\nexport function AgreementDisplay(props: AgreementDisplayProps) {\n const { currentAgreement, fallbackImageSrc } = props;\n\n return (\n <Container>\n <AgreementDetails\n {...currentAgreement}\n className=\"h-12 [&>span>span]:hidden xl:[&>span>span]:flex \"\n fallbackImageSrc={fallbackImageSrc}\n />\n </Container>\n );\n}\n\nexport type AgreementSelectorProps = AgreementDisplayProps & {\n agreements: Agreement[];\n filterAgreement: (agreement: Agreement, filter: (agreement: Agreement) => boolean) => void;\n filterClientAgreement: (agreement: Agreement, filter: (agreement: Agreement) => boolean) => void;\n onAddAgreement?: () => void;\n onChangeAgreement: (agreement: Agreement) => void;\n onLogout: () => void;\n open?: boolean;\n setOpen?: (open: boolean) => void;\n};\n\nexport function AgreementSelector(props: AgreementSelectorProps) {\n const {\n agreements,\n currentAgreement,\n fallbackImageSrc,\n filterAgreement = () => true,\n filterClientAgreement = () => true,\n onAddAgreement: handleAddAgreement,\n onChangeAgreement,\n onLogout: handleLogout,\n open: prop,\n setOpen: onChange,\n } = props;\n const { texts } = useLocalization();\n const collectionRef = React.useRef<CollectionPrimitive.CollectionRef | null>(null);\n const [open, setOpen] = useControllableState<boolean>({\n onChange,\n prop,\n });\n const [search, setSearch] = React.useState('');\n\n React.useEffect(() => {\n setSearch('');\n }, [open]);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter') {\n event.preventDefault();\n collectionRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n }\n };\n\n const handleChangeAgreement = (agreement: Agreement) => {\n onChangeAgreement(agreement);\n setOpen(false);\n };\n\n return (\n <Container>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger className=\"xl:focus-visible:yt-focus-dark [&:focus-visible_img]:yt-focus-dark w-full rounded outline-none xl:[&:focus-visible_img]:shadow-none\">\n <AgreementDetails\n {...currentAgreement}\n className=\"h-12 flex-grow xl:hover:bg-white/[0.16] [&>span>span]:hidden xl:[&>span>span]:flex [[aria-current='true']>&]:bg-white/[0.16]\"\n fallbackImageSrc={fallbackImageSrc}>\n {agreements ? (\n <Icon\n className=\"ml-auto hidden flex-shrink-0 flex-grow-0 text-white xl:flex\"\n name={open ? 'chevron-up' : 'chevron-down'}\n />\n ) : null}\n </AgreementDetails>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content className=\"z-[996] mt-2 flex h-[calc(100vh_-_theme(spacing.16))] w-64 flex-col gap-1 bg-blue-900\">\n <SearchInput\n autoFocus\n className=\"focus-visible:!yt-focus-dark mx-2 !border-transparent !bg-white/[0.08] !text-white hover:!bg-white/[0.16] hover:!shadow-none focus:!bg-white/[0.16] active:!bg-white/[0.16] [&+div>button]:!text-white\"\n onChange={event => setSearch(event.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={texts.header.search}\n />\n <CollectionPrimitive.Root\n querySelector=\"button\"\n className=\"-my-1 flex w-full flex-grow flex-col gap-1 overflow-auto px-2 py-1 outline-none\"\n ref={collectionRef}\n tabIndex={-1}>\n {agreements\n ?.filter(agreement => filterAgreement(agreement, filterBySearchValue(search)))\n .map(agreement => {\n const button = createAgreementButton(\n agreement,\n fallbackImageSrc,\n handleChangeAgreement,\n isCurrentAgreement(agreement, currentAgreement)\n );\n\n if (agreement.clients) {\n return (\n <span\n className=\"flex flex-col gap-px [&>*:first-child>span]:!rounded-t [&>*:last-child>span]:!rounded-b [&>*>span]:!rounded-none\"\n key={`${agreement.number}_${agreement.userId}_clients`}>\n {filterBySearchValue(search)(agreement) ? button : null}\n {agreement.clients\n .filter(agreement =>\n filterClientAgreement(agreement, filterBySearchValue(search))\n )\n .map(clientAgreement =>\n createAgreementButton(\n clientAgreement,\n fallbackImageSrc,\n handleChangeAgreement,\n isCurrentAgreement(clientAgreement, currentAgreement)\n )\n )}\n </span>\n );\n }\n\n return button;\n })}\n </CollectionPrimitive.Root>\n {handleAddAgreement ? (\n <Button\n className=\"focus-visible:!yt-focus-dark my-1 mx-2 !h-9 shrink-0 !bg-white/[0.08] !text-white hover:!bg-white/[0.16]\"\n onClick={handleAddAgreement}>\n {texts.header.addAgreement}\n </Button>\n ) : null}\n <hr className=\"my-0 h-px w-full bg-white/[0.08]\" />\n <a\n className=\"focus-visible:yt-focus-dark mx-2 mb-2 flex h-8 shrink-0 items-center justify-center rounded text-white hover:cursor-pointer hover:text-white hover:underline focus-visible:outline-none\"\n onClick={handleLogout}\n tabIndex={0}>\n {texts.header.logout}\n </a>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Root>\n </Container>\n );\n}\n\nconst filterBySearchValue = (search: string) => (agreement: Agreement) => {\n if (!search || !search.length) {\n return true;\n }\n\n const matchesAgreementNumber = String(agreement.number).indexOf(search) > -1;\n const matchesCompanyName = agreement.name.toLowerCase().indexOf(search.toLowerCase()) > -1;\n\n return matchesAgreementNumber || matchesCompanyName;\n};\n\nconst isCurrentAgreement = (agreement: Agreement, currentAgreement: Agreement) => {\n return agreement.number === currentAgreement.number && agreement.userId === currentAgreement.userId;\n};\n\nconst createAgreementButton = (\n agreement: Agreement,\n fallbackImageSrc: string,\n onChangeAgreement: (agreement: Agreement) => void,\n isCurrentAgreement = false\n) => (\n <button\n aria-current={isCurrentAgreement ? 'true' : undefined}\n className=\"focus:yt-focus-dark w-full rounded outline-none\"\n key={`${agreement.number}_${agreement.userId}`}\n onClick={() => onChangeAgreement(agreement)}\n onKeyDown={() => onChangeAgreement(agreement)}\n tabIndex={0}>\n <AgreementDetails\n {...agreement}\n className=\"h-14 bg-white/[0.08] xl:hover:bg-white/[0.16] [[aria-current='true']>&]:bg-white/[0.16]\"\n fallbackImageSrc={fallbackImageSrc}\n />\n </button>\n);\n"],"names":["Container","props","React","className","children","AgreementDisplay","currentAgreement","fallbackImageSrc","AgreementDetails","AgreementSelector","agreements","filterAgreement","filterClientAgreement","onAddAgreement","handleAddAgreement","onChangeAgreement","onLogout","handleLogout","open","prop","setOpen","onChange","texts","useLocalization","collectionRef","useRef","useControllableState","search","setSearch","useState","useEffect","handleKeyDown","event","key","preventDefault","current","dispatchEvent","createCustomKeyboardEvent","handleChangeAgreement","agreement","PopoverPrimitive","onOpenChange","Icon","name","SearchInput","autoFocus","target","value","onKeyDown","placeholder","header","CollectionPrimitive","querySelector","ref","tabIndex","filter","filterBySearchValue","map","button","createAgreementButton","isCurrentAgreement","clients","number","userId","clientAgreement","Button","onClick","addAgreement","logout","length","matchesAgreementNumber","String","indexOf","matchesCompanyName","toLowerCase","undefined"],"mappings":";;;;;;;;;;;;AAWA,MAAMA,SAAS,GAAGC,KAAK;EACnB,oBACIC;IAAKC,SAAS,EAAC;kBACXD;IAAMC,SAAS,EAAC;IAAqE,EACpFF,KAAK,CAACG,QAAQ,CACb;AAEd,CAAC;SAOeC,gBAAgB,CAACJ,KAA4B;EACzD,MAAM;IAAEK,gBAAgB;IAAEC;GAAkB,GAAGN,KAAK;EAEpD,oBACIC,6BAACF,SAAS,qBACNE,6BAACM,gBAAgB,oBACTF,gBAAgB;IACpBH,SAAS,EAAC,kDAAkD;IAC5DI,gBAAgB,EAAEA;KACpB,CACM;AAEpB;SAagBE,iBAAiB,CAACR,KAA6B;EAC3D,MAAM;IACFS,UAAU;IACVJ,gBAAgB;IAChBC,gBAAgB;IAChBI,eAAe,GAAG,MAAM,IAAI;IAC5BC,qBAAqB,GAAG,MAAM,IAAI;IAClCC,cAAc,EAAEC,kBAAkB;IAClCC,iBAAiB;IACjBC,QAAQ,EAAEC,YAAY;IACtBC,IAAI,EAAEC,IAAI;IACVC,OAAO,EAAEC;GACZ,GAAGpB,KAAK;EACT,MAAM;IAAEqB;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,aAAa,GAAGtB,cAAK,CAACuB,MAAM,CAA2C,IAAI,CAAC;EAClF,MAAM,CAACP,IAAI,EAAEE,OAAO,CAAC,GAAGM,oBAAoB,CAAU;IAClDL,QAAQ;IACRF;GACH,CAAC;EACF,MAAM,CAACQ,MAAM,EAAEC,SAAS,CAAC,GAAG1B,cAAK,CAAC2B,QAAQ,CAAC,EAAE,CAAC;EAE9C3B,cAAK,CAAC4B,SAAS,CAAC;IACZF,SAAS,CAAC,EAAE,CAAC;G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IAAMY,SAAoB;EACjE,IAAI,CAACZ,MAAM,IAAI,CAACA,MAAM,CAAC0C,MAAM,EAAE;IAC3B,OAAO,IAAI;;EAGf,MAAMC,sBAAsB,GAAGC,MAAM,CAAChC,SAAS,CAACuB,MAAM,CAAC,CAACU,OAAO,CAAC7C,MAAM,CAAC,GAAG,CAAC,CAAC;EAC5E,MAAM8C,kBAAkB,GAAGlC,SAAS,CAACI,IAAI,CAAC+B,WAAW,EAAE,CAACF,OAAO,CAAC7C,MAAM,CAAC+C,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;EAE1F,OAAOJ,sBAAsB,IAAIG,kBAAkB;AACvD,CAAC;AAED,MAAMb,kBAAkB,GAAG,CAACrB,SAAoB,EAAEjC,gBAA2B;EACzE,OAAOiC,SAAS,CAACuB,MAAM,KAAKxD,gBAAgB,CAACwD,MAAM,IAAIvB,SAAS,CAACwB,MAAM,KAAKzD,gBAAgB,CAACyD,MAAM;AACvG,CAAC;AAED,MAAMJ,qBAAqB,GAAG,CAC1BpB,SAAoB,EACpBhC,gBAAwB,EACxBQ,iBAAiD,EACjD6C,kBAAkB,GAAG,KAAK,kBAE1B1D;kBACkB0D,kBAAkB,GAAG,MAAM,GAAGe,SAAS;EACrDxE,SAAS,EAAC,iDAAiD;EAC3D8B,GAAG,KAAKM,SAAS,CAACuB,UAAUvB,SAAS,CAACwB,QAAQ;EAC9CG,OAAO,EAAE,MAAMnD,iBAAiB,CAACwB,SAAS,CAAC;EAC3CS,SAAS,EAAE,MAAMjC,iBAAiB,CAACwB,SAAS,CAAC;EAC7Ce,QAAQ,EAAE;gBACVpD,6BAACM,gBAAgB,oBACT+B,SAAS;EACbpC,SAAS,EAAC,yFAAyF;EACnGI,gBAAgB,EAAEA;GACpB,CAET;;;;"}
1
+ {"version":3,"file":"AgreementSelector.js","sources":["../../../../../../../../src/components/Header/components/AgreementSelector.tsx"],"sourcesContent":["import React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as CollectionPrimitive from '../../../primitives/Collection/Collection';\nimport { Agreement, AgreementDetails } from './Agreements/AgreementDetails';\nimport { createCustomKeyboardEvent } from '../../../utils/input';\nimport { Icon } from '../../Icon/Icon';\nimport { SearchInput } from '../../SearchInput/SearchInput';\nimport { Button } from '../../Button/Button';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst Container = props => {\n return (\n <div\n className=\"-ml-3 flex flex-shrink-0 flex-grow-0 items-center gap-2 xl:ml-auto xl:w-64 xl:pr-2\"\n data-taco=\"header-agreements\">\n <span className=\"hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex\" />\n {props.children}\n </div>\n );\n};\n\nexport type AgreementDisplayProps = React.HTMLAttributes<HTMLDivElement> & {\n currentAgreement: Agreement;\n fallbackImageSrc: string;\n};\n\nexport function AgreementDisplay(props: AgreementDisplayProps) {\n const { currentAgreement, fallbackImageSrc } = props;\n\n return (\n <Container>\n <AgreementDetails\n {...currentAgreement}\n className=\"h-12 [&>span>span]:hidden xl:[&>span>span]:flex \"\n fallbackImageSrc={fallbackImageSrc}\n />\n </Container>\n );\n}\n\nexport type AgreementSelectorProps = AgreementDisplayProps & {\n agreements: Agreement[];\n filterAgreement: (agreement: Agreement, filter: (agreement: Agreement) => boolean) => void;\n filterClientAgreement: (agreement: Agreement, filter: (agreement: Agreement) => boolean) => void;\n onAddAgreement?: () => void;\n onChangeAgreement: (agreement: Agreement) => void;\n onLogout: () => void;\n open?: boolean;\n setOpen?: (open: boolean) => void;\n};\n\nexport function AgreementSelector(props: AgreementSelectorProps) {\n const {\n agreements,\n currentAgreement,\n fallbackImageSrc,\n filterAgreement = () => true,\n filterClientAgreement = () => true,\n onAddAgreement: handleAddAgreement,\n onChangeAgreement,\n onLogout: handleLogout,\n open: prop,\n setOpen: onChange,\n } = props;\n const { texts } = useLocalization();\n const collectionRef = React.useRef<CollectionPrimitive.CollectionRef | null>(null);\n const [open, setOpen] = useControllableState<boolean>({\n onChange,\n prop,\n });\n const [search, setSearch] = React.useState('');\n\n React.useEffect(() => {\n setSearch('');\n }, [open]);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter') {\n event.preventDefault();\n collectionRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n }\n };\n\n const handleChangeAgreement = (agreement: Agreement) => {\n onChangeAgreement(agreement);\n setOpen(false);\n };\n\n return (\n <Container>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger className=\"xl:focus-visible:yt-focus-dark [&:focus-visible_img]:yt-focus-dark w-full rounded outline-none xl:[&:focus-visible_img]:shadow-none\">\n <AgreementDetails\n {...currentAgreement}\n className=\"h-12 flex-grow xl:hover:bg-white/[0.16] [&>span>span]:hidden xl:[&>span>span]:flex [[aria-current='true']>&]:bg-white/[0.16]\"\n fallbackImageSrc={fallbackImageSrc}>\n {agreements ? (\n <Icon\n className=\"ml-auto hidden flex-shrink-0 flex-grow-0 text-white xl:flex\"\n name={open ? 'chevron-up' : 'chevron-down'}\n />\n ) : null}\n </AgreementDetails>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content className=\"z-[996] mt-2 flex h-[calc(100vh_-_theme(spacing.16))] w-64 flex-col gap-1 bg-blue-900\">\n <SearchInput\n autoFocus\n className=\"focus-visible:!yt-focus-dark mx-2 !border-transparent !bg-white/[0.08] !text-white hover:!bg-white/[0.16] hover:!shadow-none focus:!bg-white/[0.16] active:!bg-white/[0.16] [&+div>button]:!text-white\"\n onChange={event => setSearch(event.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={texts.header.search}\n />\n <CollectionPrimitive.Root\n querySelector=\"button\"\n className=\"-my-1 flex w-full flex-grow flex-col gap-1 overflow-auto px-2 py-1 outline-none\"\n ref={collectionRef}\n tabIndex={-1}>\n {agreements\n ?.filter(agreement => filterAgreement(agreement, filterBySearchValue(search)))\n .map(agreement => {\n const button = createAgreementButton(\n agreement,\n fallbackImageSrc,\n handleChangeAgreement,\n isCurrentAgreement(agreement, currentAgreement)\n );\n\n if (agreement.clients) {\n return (\n <span\n className=\"flex flex-col gap-px [&>*:first-child>span]:!rounded-t [&>*:last-child>span]:!rounded-b [&>*>span]:!rounded-none\"\n key={`${agreement.number}_${agreement.userId}_clients`}>\n {filterBySearchValue(search)(agreement) ? button : null}\n {agreement.clients\n .filter(agreement =>\n filterClientAgreement(agreement, filterBySearchValue(search))\n )\n .map(clientAgreement =>\n createAgreementButton(\n clientAgreement,\n fallbackImageSrc,\n handleChangeAgreement,\n isCurrentAgreement(clientAgreement, currentAgreement)\n )\n )}\n </span>\n );\n }\n\n return button;\n })}\n </CollectionPrimitive.Root>\n {handleAddAgreement ? (\n <Button\n className=\"focus-visible:!yt-focus-dark my-1 mx-2 !h-9 shrink-0 !bg-white/[0.08] !text-white hover:!bg-white/[0.16]\"\n onClick={handleAddAgreement}>\n {texts.header.addAgreement}\n </Button>\n ) : null}\n <hr className=\"my-0 h-px w-full bg-white/[0.08]\" />\n <a\n className=\"focus-visible:yt-focus-dark mx-2 mb-2 flex h-8 shrink-0 items-center justify-center rounded text-white hover:cursor-pointer hover:text-white hover:underline focus-visible:outline-none\"\n onClick={handleLogout}\n tabIndex={0}>\n {texts.header.logout}\n </a>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Root>\n </Container>\n );\n}\n\nconst filterBySearchValue = (search: string) => (agreement: Agreement) => {\n if (!search || !search.length) {\n return true;\n }\n\n const matchesAgreementNumber = String(agreement.number).indexOf(search) > -1;\n const matchesCompanyName = agreement.name.toLowerCase().indexOf(search.toLowerCase()) > -1;\n\n return matchesAgreementNumber || matchesCompanyName;\n};\n\nconst isCurrentAgreement = (agreement: Agreement, currentAgreement: Agreement) => {\n return agreement.number === currentAgreement.number && agreement.userId === currentAgreement.userId;\n};\n\nconst createAgreementButton = (\n agreement: Agreement,\n fallbackImageSrc: string,\n onChangeAgreement: (agreement: Agreement) => void,\n isCurrentAgreement = false\n) => (\n <button\n aria-current={isCurrentAgreement ? 'true' : undefined}\n className=\"focus:yt-focus-dark w-full rounded outline-none\"\n data-taco=\"header-agreements-agreement\"\n key={`${agreement.number}_${agreement.userId}`}\n onClick={() => onChangeAgreement(agreement)}\n onKeyDown={() => onChangeAgreement(agreement)}\n tabIndex={0}>\n <AgreementDetails\n {...agreement}\n className=\"h-14 bg-white/[0.08] xl:hover:bg-white/[0.16] [[aria-current='true']>&]:bg-white/[0.16]\"\n fallbackImageSrc={fallbackImageSrc}\n />\n </button>\n);\n"],"names":["Container","props","React","className","children","AgreementDisplay","currentAgreement","fallbackImageSrc","AgreementDetails","AgreementSelector","agreements","filterAgreement","filterClientAgreement","onAddAgreement","handleAddAgreement","onChangeAgreement","onLogout","handleLogout","open","prop","setOpen","onChange","texts","useLocalization","collectionRef","useRef","useControllableState","search","setSearch","useState","useEffect","handleKeyDown","event","key","preventDefault","current","dispatchEvent","createCustomKeyboardEvent","handleChangeAgreement","agreement","PopoverPrimitive","onOpenChange","Icon","name","SearchInput","autoFocus","target","value","onKeyDown","placeholder","header","CollectionPrimitive","querySelector","ref","tabIndex","filter","filterBySearchValue","map","button","createAgreementButton","isCurrentAgreement","clients","number","userId","clientAgreement","Button","onClick","addAgreement","logout","length","matchesAgreementNumber","String","indexOf","matchesCompanyName","toLowerCase","undefined"],"mappings":";;;;;;;;;;;;AAWA,MAAMA,SAAS,GAAGC,KAAK;EACnB,oBACIC;IACIC,SAAS,EAAC,oFAAoF;iBACpF;kBACVD;IAAMC,SAAS,EAAC;IAAqE,EACpFF,KAAK,CAACG,QAAQ,CACb;AAEd,CAAC;SAOeC,gBAAgB,CAACJ,KAA4B;EACzD,MAAM;IAAEK,gBAAgB;IAAEC;GAAkB,GAAGN,KAAK;EAEpD,oBACIC,6BAACF,SAAS,qBACNE,6BAACM,gBAAgB,oBACTF,gBAAgB;IACpBH,SAA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,CAACwD,MAAM,IAAIvB,SAAS,CAACwB,MAAM,KAAKzD,gBAAgB,CAACyD,MAAM;AACvG,CAAC;AAED,MAAMJ,qBAAqB,GAAG,CAC1BpB,SAAoB,EACpBhC,gBAAwB,EACxBQ,iBAAiD,EACjD6C,kBAAkB,GAAG,KAAK,kBAE1B1D;kBACkB0D,kBAAkB,GAAG,MAAM,GAAGe,SAAS;EACrDxE,SAAS,EAAC,iDAAiD;eACjD,6BAA6B;EACvC8B,GAAG,KAAKM,SAAS,CAACuB,UAAUvB,SAAS,CAACwB,QAAQ;EAC9CG,OAAO,EAAE,MAAMnD,iBAAiB,CAACwB,SAAS,CAAC;EAC3CS,SAAS,EAAE,MAAMjC,iBAAiB,CAACwB,SAAS,CAAC;EAC7Ce,QAAQ,EAAE;gBACVpD,6BAACM,gBAAgB,oBACT+B,SAAS;EACbpC,SAAS,EAAC,yFAAyF;EACnGI,gBAAgB,EAAEA;GACpB,CAET;;;;"}
@@ -14,6 +14,7 @@ const Button = /*#__PURE__*/React__default.forwardRef(function Button(props, ref
14
14
  }, /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, attributes, {
15
15
  appearance: "discrete",
16
16
  className: className,
17
+ "data-taco": "header-button",
17
18
  ref: ref
18
19
  })));
19
20
  });