@economic/taco 0.0.8-alpha.0 → 0.0.12-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/Accordion.d.ts +9 -9
- package/dist/components/Backdrop/Backdrop.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +8 -12
- package/dist/components/Dialog/Context.d.ts +0 -1
- package/dist/components/Dialog/Dialog.d.ts +7 -1
- package/dist/components/Hanger/Hanger.d.ts +4 -1
- package/dist/components/IconButton/IconButton.d.ts +13 -13
- package/dist/components/Menu/Menu.d.ts +3 -1
- package/dist/components/Menu/components/Item.d.ts +3 -0
- package/dist/components/Popover/Popover.d.ts +4 -1
- package/dist/esm/components/Accordion/Accordion.js +14 -9
- package/dist/esm/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/components/Backdrop/Backdrop.js +5 -4
- package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Button/util.js +16 -16
- package/dist/esm/components/Button/util.js.map +1 -1
- package/dist/esm/components/Calendar/Calendar.js +1 -1
- package/dist/esm/components/Combobox/Combobox.js +1 -1
- package/dist/esm/components/Datepicker/Datepicker.js +2 -2
- package/dist/esm/components/Dialog/Context.js +0 -1
- package/dist/esm/components/Dialog/Context.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +11 -15
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Dialog/components/Content.js +28 -11
- package/dist/esm/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +6 -6
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/components/Menu/Menu.js +9 -3
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/Menu/components/Content.js +2 -2
- package/dist/esm/components/Menu/components/Header.js +1 -1
- package/dist/esm/components/Menu/components/Item.js +34 -17
- package/dist/esm/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/components/Menu/components/Separator.js +1 -1
- package/dist/esm/components/Menu/components/Trigger.js +2 -2
- package/dist/esm/components/Pagination/PageNumbers.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js +1 -1
- package/dist/esm/components/Popover/Popover.js +3 -4
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +8 -8
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js +1 -1
- package/dist/esm/components/Toast/Toast.js +1 -1
- package/dist/esm/components/Tour/Tour.js +1 -1
- package/dist/esm/index.css +37 -37
- package/dist/esm/index.js +8 -8
- package/dist/index.css +37 -37
- package/dist/taco.cjs.development.js +2612 -2569
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +963 -623
@@ -7,7 +7,7 @@ import { Content, Title, Footer, Close } from './components/Content.js';
|
|
7
7
|
import { Drawer } from './components/Drawer.js';
|
8
8
|
import { Extra } from './components/Extra.js';
|
9
9
|
|
10
|
-
var _excluded = ["children", "closeOnEscape", "draggable", "onClose", "open", "showCloseButton", "size"];
|
10
|
+
var _excluded = ["children", "closeOnEscape", "defaultOpen", "draggable", "onChange", "onClose", "open", "showCloseButton", "size", "trigger"];
|
11
11
|
|
12
12
|
var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
13
13
|
return useMemo(function () {
|
@@ -31,14 +31,17 @@ var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
31
31
|
var initialChildren = props.children,
|
32
32
|
_props$closeOnEscape = props.closeOnEscape,
|
33
33
|
closeOnEscape = _props$closeOnEscape === void 0 ? true : _props$closeOnEscape,
|
34
|
+
defaultOpen = props.defaultOpen,
|
34
35
|
_props$draggable = props.draggable,
|
35
36
|
draggable = _props$draggable === void 0 ? false : _props$draggable,
|
37
|
+
onChange = props.onChange,
|
36
38
|
onClose = props.onClose,
|
37
|
-
|
39
|
+
open = props.open,
|
38
40
|
_props$showCloseButto = props.showCloseButton,
|
39
41
|
showCloseButton = _props$showCloseButto === void 0 ? true : _props$showCloseButto,
|
40
42
|
_props$size = props.size,
|
41
43
|
size = _props$size === void 0 ? 'sm' : _props$size,
|
44
|
+
trigger = props.trigger,
|
42
45
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
43
46
|
|
44
47
|
var _useSeparatedChildren = useSeparatedChildren(initialChildren),
|
@@ -46,19 +49,12 @@ var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
46
49
|
drawer = _useSeparatedChildren[1],
|
47
50
|
extra = _useSeparatedChildren[2];
|
48
51
|
|
49
|
-
var _React$useState = useState(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
var _React$useState2 = useState(false),
|
54
|
-
drawerOpen = _React$useState2[0],
|
55
|
-
setDrawerOpen = _React$useState2[1];
|
52
|
+
var _React$useState = useState(false),
|
53
|
+
drawerOpen = _React$useState[0],
|
54
|
+
setDrawerOpen = _React$useState[1];
|
56
55
|
|
57
56
|
var context = useMemo(function () {
|
58
57
|
return {
|
59
|
-
close: function close() {
|
60
|
-
return setOpen(false);
|
61
|
-
},
|
62
58
|
closeOnEscape: closeOnEscape,
|
63
59
|
draggable: draggable,
|
64
60
|
drawer: {
|
@@ -83,10 +79,10 @@ var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
83
79
|
return createElement(DialogContext.Provider, {
|
84
80
|
value: context
|
85
81
|
}, createElement(Root, {
|
86
|
-
|
82
|
+
defaultOpen: defaultOpen,
|
87
83
|
open: open,
|
88
|
-
onOpenChange:
|
89
|
-
}));
|
84
|
+
onOpenChange: onChange
|
85
|
+
}, trigger && createElement(Trigger, null, trigger), children));
|
90
86
|
});
|
91
87
|
Dialog.Trigger = Trigger;
|
92
88
|
Dialog.Content = Content;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport './Dialog.css';\nimport { DialogTriggerProps, Trigger } from './components/Trigger';\nimport {\n Content,\n Title,\n Footer,\n Close,\n DialogContentProps,\n DialogContentRenderProps,\n DialogContentDrawerRenderProps,\n DialogTitleProps,\n DialogFooterProps,\n DialogCloseProps,\n} from './components/Content';\nimport { DialogDrawerProps, Drawer } from './components/Drawer';\nimport { DialogExtraProps, Extra } from './components/Extra';\nimport { DialogContext } from './Context';\nimport { DialogSize } from './types';\n\nexport {\n DialogContentProps,\n DialogContentRenderProps,\n DialogContentDrawerRenderProps,\n DialogTitleProps,\n DialogFooterProps,\n DialogCloseProps,\n DialogSize,\n};\n\nexport type DialogTexts = {\n /**\n * Aria-label for close icon button in dialog.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n close: string;\n drag: string;\n};\n\nexport type DialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** When `true`, pressing escape will close the dialog */\n closeOnEscape?: boolean;\n /** Allows dragging the dialog around the screen (window constrained) */\n draggable?: boolean;\n /** Handler called when dialog closes by user interaction */\n onClose?: () => void;\n /**
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport './Dialog.css';\nimport { DialogTriggerProps, Trigger } from './components/Trigger';\nimport {\n Content,\n Title,\n Footer,\n Close,\n DialogContentProps,\n DialogContentRenderProps,\n DialogContentDrawerRenderProps,\n DialogTitleProps,\n DialogFooterProps,\n DialogCloseProps,\n} from './components/Content';\nimport { DialogDrawerProps, Drawer } from './components/Drawer';\nimport { DialogExtraProps, Extra } from './components/Extra';\nimport { DialogContext } from './Context';\nimport { DialogSize } from './types';\n\nexport {\n DialogContentProps,\n DialogContentRenderProps,\n DialogContentDrawerRenderProps,\n DialogTitleProps,\n DialogFooterProps,\n DialogCloseProps,\n DialogSize,\n};\n\nexport type DialogTexts = {\n /**\n * Aria-label for close icon button in dialog.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n close: string;\n drag: string;\n};\n\nexport type DialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** When `true`, pressing escape will close the dialog */\n closeOnEscape?: boolean;\n /** Set whether the dialog is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Allows dragging the dialog around the screen (window constrained) */\n draggable?: boolean;\n /** Handler called when dialog closes by user interaction */\n onClose?: () => void;\n /** Called when the dialog opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n /** Control the open state of the dialog from outside the component */\n open?: boolean;\n /** Shows the close icon button of the dialog */\n showCloseButton?: boolean;\n /** Size of the dialog. This is the recommended way to set a size for dialog component. */\n size?: DialogSize;\n /** A trigger to be used for the dialog, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\n\nconst useSeparatedChildren = initialChildren => {\n return React.useMemo(() => {\n const children: any[] = [];\n let drawer;\n let extra;\n\n React.Children.forEach(initialChildren, (child: any) => {\n if (child.type.displayName === 'Drawer') {\n drawer = child;\n } else if (child.type.displayName === 'Extra') {\n extra = child;\n } else {\n children.push(child);\n }\n });\n\n return [children, drawer, extra];\n }, [initialChildren]);\n};\n\nexport type ForwardedDialogWithStatics = React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;\n Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;\n Extra: React.ForwardRefExoticComponent<DialogExtraProps & React.RefAttributes<HTMLDivElement>>;\n Drawer: React.ForwardRefExoticComponent<DialogDrawerProps & React.RefAttributes<HTMLDivElement>>;\n Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;\n};\n\nexport const Dialog = React.forwardRef((props: DialogProps, ref: React.Ref<HTMLElement>): JSX.Element => {\n const {\n children: initialChildren,\n closeOnEscape = true,\n defaultOpen,\n draggable = false,\n onChange,\n onClose,\n open,\n showCloseButton = true,\n size = 'sm',\n trigger,\n ...otherProps\n } = props;\n const [children, drawer, extra] = useSeparatedChildren(initialChildren);\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n\n const context = React.useMemo(\n () => ({\n closeOnEscape,\n draggable,\n drawer: {\n open: drawerOpen,\n toggle: () => setDrawerOpen(isDrawerOpen => !isDrawerOpen),\n },\n elements: {\n drawer,\n extra,\n },\n onClose,\n props: otherProps,\n showCloseButton,\n size,\n ref,\n }),\n [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]\n );\n\n return (\n <DialogContext.Provider value={context}>\n <DialogPrimitive.Root defaultOpen={defaultOpen} open={open} onOpenChange={onChange}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </DialogPrimitive.Root>\n </DialogContext.Provider>\n );\n}) as ForwardedDialogWithStatics;\n\nDialog.Trigger = Trigger;\nDialog.Content = Content;\nDialog.Title = Title;\nDialog.Footer = Footer;\nDialog.Extra = Extra;\nDialog.Drawer = Drawer;\nDialog.Close = Close;\n"],"names":["useSeparatedChildren","initialChildren","React","children","drawer","extra","forEach","child","type","displayName","push","Dialog","props","ref","closeOnEscape","defaultOpen","draggable","onChange","onClose","open","showCloseButton","size","trigger","otherProps","drawerOpen","setDrawerOpen","context","toggle","isDrawerOpen","elements","DialogContext","Provider","value","DialogPrimitive","onOpenChange","Trigger","Content","Title","Footer","Extra","Drawer","Close"],"mappings":";;;;;;;;;;;AA8DA,IAAMA,oBAAoB,GAAG,SAAvBA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,QAFL,CADJ,CADJ;AAQH,CA9CqB;AAgDtBQ,MAAM,CAACwB,OAAP,GAAiBA,OAAjB;AACAxB,MAAM,CAACyB,OAAP,GAAiBA,OAAjB;AACAzB,MAAM,CAAC0B,KAAP,GAAeA,KAAf;AACA1B,MAAM,CAAC2B,MAAP,GAAgBA,MAAhB;AACA3B,MAAM,CAAC4B,KAAP,GAAeA,KAAf;AACA5B,MAAM,CAAC6B,MAAP,GAAgBA,MAAhB;AACA7B,MAAM,CAAC8B,KAAP,GAAeA,KAAf;;;;"}
|
@@ -2,13 +2,13 @@ import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers
|
|
2
2
|
import { forwardRef, createElement } from 'react';
|
3
3
|
import cn from 'classnames';
|
4
4
|
import { Backdrop } from '../../Backdrop/Backdrop.js';
|
5
|
+
import { IconButton } from '../../IconButton/IconButton.js';
|
5
6
|
import { useLocalization } from '../../Provider/Provider.js';
|
6
|
-
import { useCurrentMenu } from '../../Menu/Context.js';
|
7
7
|
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
8
8
|
import { Title as Title$1, Close as Close$1, Portal, Overlay, Content as Content$1 } from '@radix-ui/react-dialog';
|
9
9
|
import { useCurrentDialog } from '../Context.js';
|
10
10
|
import { useDraggable } from '../../../utils/hooks/useDraggable.js';
|
11
|
-
import {
|
11
|
+
import { useCurrentMenu } from '../../Menu/Context.js';
|
12
12
|
|
13
13
|
var Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
|
14
14
|
var className = cn('text-center', props.className);
|
@@ -33,6 +33,20 @@ var Close = /*#__PURE__*/forwardRef(function DialogClose(props, ref) {
|
|
33
33
|
asChild: true
|
34
34
|
}));
|
35
35
|
});
|
36
|
+
var RenderPropWrapper = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
37
|
+
var children = _ref.children,
|
38
|
+
onClick = _ref.onClick,
|
39
|
+
renderProps = _ref.renderProps;
|
40
|
+
|
41
|
+
var close = function close() {
|
42
|
+
onClick(new CustomEvent('close'));
|
43
|
+
};
|
44
|
+
|
45
|
+
return children(_extends({
|
46
|
+
close: close,
|
47
|
+
ref: ref
|
48
|
+
}, renderProps));
|
49
|
+
});
|
36
50
|
var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
37
51
|
var dialog = useCurrentDialog();
|
38
52
|
var internalRef = useProxiedRef(ref);
|
@@ -55,7 +69,7 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
55
69
|
};
|
56
70
|
}
|
57
71
|
|
58
|
-
var className = cn('bg-white rounded mt-16 mx-auto', {
|
72
|
+
var className = cn('bg-white rounded relative mt-16 mx-auto', {
|
59
73
|
'w-128 text-center justify-center': dialog.size === 'dialog',
|
60
74
|
'w-xs': dialog.size === 'xs',
|
61
75
|
'w-sm': dialog.size === 'sm',
|
@@ -82,10 +96,13 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
82
96
|
var output;
|
83
97
|
|
84
98
|
if (typeof props.children === 'function') {
|
85
|
-
output =
|
86
|
-
|
87
|
-
|
88
|
-
|
99
|
+
output = createElement(Close$1, {
|
100
|
+
asChild: true
|
101
|
+
}, createElement(RenderPropWrapper, {
|
102
|
+
renderProps: {
|
103
|
+
drawer: dialog.drawer
|
104
|
+
}
|
105
|
+
}, props.children));
|
89
106
|
} else {
|
90
107
|
output = props.children;
|
91
108
|
}
|
@@ -99,8 +116,8 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
99
116
|
onCloseAutoFocus: handleCloseAutoFocus,
|
100
117
|
ref: ref,
|
101
118
|
style: _extends({}, props.style, {
|
102
|
-
left: dialog.draggable ?
|
103
|
-
top: dialog.draggable ?
|
119
|
+
left: dialog.draggable ? position.x + "px" : undefined,
|
120
|
+
top: dialog.draggable ? position.y + "px" : undefined
|
104
121
|
})
|
105
122
|
}), createElement("div", {
|
106
123
|
className: containerClassName,
|
@@ -109,8 +126,8 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
109
126
|
"aria-label": texts.dialog.drag,
|
110
127
|
className: "yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center"
|
111
128
|
})), dialog.showCloseButton ? createElement(Close$1, {
|
112
|
-
|
113
|
-
|
129
|
+
onClick: dialog.onClose,
|
130
|
+
asChild: true
|
114
131
|
}, createElement(IconButton, {
|
115
132
|
appearance: "discrete",
|
116
133
|
"aria-label": texts.dialog.close,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Content.js","sources":["../../../../../src/components/Dialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDialog } from '../Context';\nimport { useLocalization } from '../../Provider/Provider';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Backdrop } from '../../Backdrop/Backdrop';\n\nexport type DialogContentDrawerRenderProps = {\n open: boolean;\n toggle: () => void;\n};\n\nexport type DialogContentRenderProps = {\n close: () => void;\n drawer?: DialogContentDrawerRenderProps;\n};\n\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('text-center', props.className);\n return <DialogPrimitive.Title {...props} className={className} ref={ref} />;\n});\n\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('mt-8 flex justify-end', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {props.children}\n </div>\n );\n});\n\nexport type DialogCloseProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Close = React.forwardRef(function DialogClose(props: DialogCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const dialog = useCurrentDialog();\n\n return <DialogPrimitive.Close onClick={dialog.onClose} {...props} ref={ref} asChild />;\n});\n\nexport type DialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogContentRenderProps) => JSX.Element);\n};\nexport const Content = React.forwardRef(function DialogContent(props: DialogContentProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const internalRef = useProxiedRef<HTMLDivElement>(ref);\n const { position, handleProps: dragHandleProps } = useDraggable(internalRef);\n const { texts } = useLocalization();\n\n // if the dialog was opened by a menu, we need to close the menu when the dialog closes\n // the menu is still open (and mounted) because it is the trigger for the dialog\n const menu = useCurrentMenu();\n let handleCloseAutoFocus;\n\n if (menu) {\n handleCloseAutoFocus = () => menu.close();\n }\n\n const className = cn('bg-white rounded mt-16 mx-auto', {\n 'w-128 text-center justify-center': dialog.size === 'dialog',\n 'w-xs': dialog.size === 'xs',\n 'w-sm': dialog.size === 'sm',\n 'w-md': dialog.size === 'md',\n 'w-lg': dialog.size === 'lg',\n });\n\n const containerClassName = cn(\n 'bg-white p-6 rounded relative z-[999]',\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]',\n {\n 'rounded-b-none': !!dialog.elements.extra,\n },\n props.className\n );\n\n const handleEscapeKeyDown = event => {\n if (!dialog.closeOnEscape) {\n event.preventDefault();\n } else if (dialog.onClose) {\n dialog.onClose();\n }\n };\n\n // the chosen behaviour in taco is that outside clicks do not close the dialog\n const handleInteractOutside = event => event.preventDefault();\n\n let output;\n\n if (typeof props.children === 'function') {\n output = props.children({ drawer: dialog.drawer, close: dialog.close });\n } else {\n output = props.children;\n }\n\n return (\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay asChild>\n <Backdrop>\n <DialogPrimitive.Content\n {...props}\n className={className}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={handleInteractOutside}\n onCloseAutoFocus={handleCloseAutoFocus}\n ref={ref}\n style={{\n ...props.style,\n left: dialog.draggable ? `calc(50% + ${position.x}px)` : undefined,\n top: dialog.draggable ? `calc(50% + ${position.y}px)` : undefined,\n }}\n >\n <div className={containerClassName} data-taco=\"dialog\">\n {output}\n {dialog.draggable && (\n <div\n {...dragHandleProps}\n aria-label={texts.dialog.drag}\n className=\"yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center\"\n />\n )}\n {dialog.showCloseButton ? (\n <DialogPrimitive.Close asChild onClick={dialog.onClose}>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.dialog.close}\n className=\"absolute top-0 right-0 mt-2 mr-2\"\n icon=\"close\"\n />\n </DialogPrimitive.Close>\n ) : null}\n </div>\n {dialog.elements.drawer}\n {dialog.elements.extra}\n </DialogPrimitive.Content>\n </Backdrop>\n </DialogPrimitive.Overlay>\n </DialogPrimitive.Portal>\n );\n});\n"],"names":["Title","React","DialogTitle","props","ref","className","cn","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","Content","DialogContent","internalRef","useProxiedRef","useDraggable","position","dragHandleProps","handleProps","useLocalization","texts","menu","useCurrentMenu","handleCloseAutoFocus","close","size","containerClassName","elements","extra","handleEscapeKeyDown","event","closeOnEscape","preventDefault","handleInteractOutside","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus","style","left","draggable","x","undefined","top","y","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;;IAsBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;AAClC,MAAMC,SAAS,GAAGC,EAAE,CAAC,aAAD,EAAgBH,KAAK,CAACE,SAAtB,CAApB;AACA,SAAOJ,aAAA,CAAC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QAAD,MAAA,EACI1C,aAAA,CAACM,SAAD,oBACQJ;AACJE,IAAAA,SAAS,EAAEA;AACXuC,IAAAA,eAAe,EAAER;AACjBS,IAAAA,iBAAiB,EAAEL;AACnBM,IAAAA,gBAAgB,EAAEhB;AAClB1B,IAAAA,GAAG,EAAEA;AACL2C,IAAAA,KAAK,eACE5C,KAAK,CAAC4C,KADR;AAEDC,MAAAA,IAAI,EAAEnC,MAAM,CAACoC,SAAP,mBAAiC1B,QAAQ,CAAC2B,CAA1C,WAAmDC,SAFxD;AAGDC,MAAAA,GAAG,EAAEvC,MAAM,CAACoC,SAAP,mBAAiC1B,QAAQ,CAAC8B,CAA1C,WAAmDF;AAHvD;IAPT,EAaIlD,aAAA,MAAA;AAAKI,IAAAA,SAAS,EAAE4B;iBAA8B;GAA9C,EACKQ,MADL,EAEK5B,MAAM,CAACoC,SAAP,IACGhD,aAAA,MAAA,oBACQuB;kBACQG,KAAK,CAACd,MAAN,CAAayC;AACzBjD,IAAAA,SAAS,EAAC;IAHd,CAHR,EASKQ,MAAM,CAAC0C,eAAP,GACGtD,aAAA,CAACM,OAAD;AAAuBU,IAAAA,OAAO;AAACF,IAAAA,OAAO,EAAEF,MAAM,CAACG;GAA/C,EACIf,aAAA,CAACuD,UAAD;AACIC,IAAAA,UAAU,EAAC;kBACC9B,KAAK,CAACd,MAAN,CAAakB;AACzB1B,IAAAA,SAAS,EAAC;AACVqD,IAAAA,IAAI,EAAC;GAJT,CADJ,CADH,GASG,IAlBR,CAbJ,EAiCK7C,MAAM,CAACqB,QAAP,CAAgBQ,MAjCrB,EAkCK7B,MAAM,CAACqB,QAAP,CAAgBC,KAlCrB,CADJ,CADJ,CADJ,CADJ;AA4CH,CA/FsB;;;;"}
|
1
|
+
{"version":3,"file":"Content.js","sources":["../../../../../src/components/Dialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDialog } from '../Context';\nimport { useLocalization } from '../../Provider/Provider';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Backdrop } from '../../Backdrop/Backdrop';\n\nexport type DialogContentDrawerRenderProps = {\n open: boolean;\n toggle: () => void;\n};\n\nexport type DialogContentRenderProps = {\n close: () => void;\n drawer?: DialogContentDrawerRenderProps;\n};\n\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('text-center', props.className);\n return <DialogPrimitive.Title {...props} className={className} ref={ref} />;\n});\n\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('mt-8 flex justify-end', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {props.children}\n </div>\n );\n});\n\nexport type DialogCloseProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Close = React.forwardRef(function DialogClose(props: DialogCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const dialog = useCurrentDialog();\n\n return <DialogPrimitive.Close onClick={dialog.onClose} {...props} ref={ref} asChild />;\n});\n\nconst RenderPropWrapper = React.forwardRef(({ 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 DialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogContentRenderProps) => JSX.Element);\n};\nexport const Content = React.forwardRef(function DialogContent(props: DialogContentProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const internalRef = useProxiedRef<HTMLDivElement>(ref);\n const { position, handleProps: dragHandleProps } = useDraggable(internalRef);\n const { texts } = useLocalization();\n\n // if the dialog was opened by a menu, we need to close the menu when the dialog closes\n // the menu is still open (and mounted) because it is the trigger for the dialog\n const menu = useCurrentMenu();\n let handleCloseAutoFocus;\n\n if (menu) {\n handleCloseAutoFocus = () => menu.close();\n }\n\n const className = cn('bg-white rounded relative mt-16 mx-auto', {\n 'w-128 text-center justify-center': dialog.size === 'dialog',\n 'w-xs': dialog.size === 'xs',\n 'w-sm': dialog.size === 'sm',\n 'w-md': dialog.size === 'md',\n 'w-lg': dialog.size === 'lg',\n });\n\n const containerClassName = cn(\n 'bg-white p-6 rounded relative z-[999]',\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]',\n {\n 'rounded-b-none': !!dialog.elements.extra,\n },\n props.className\n );\n\n const handleEscapeKeyDown = event => {\n if (!dialog.closeOnEscape) {\n event.preventDefault();\n } else if (dialog.onClose) {\n dialog.onClose();\n }\n };\n\n // the chosen behaviour in taco is that outside clicks do not close the dialog\n const handleInteractOutside = event => event.preventDefault();\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <DialogPrimitive.Close asChild>\n <RenderPropWrapper renderProps={{ drawer: dialog.drawer }}>{props.children}</RenderPropWrapper>\n </DialogPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay asChild>\n <Backdrop>\n <DialogPrimitive.Content\n {...props}\n className={className}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={handleInteractOutside}\n onCloseAutoFocus={handleCloseAutoFocus}\n ref={ref}\n style={{\n ...props.style,\n left: dialog.draggable ? `${position.x}px` : undefined,\n top: dialog.draggable ? `${position.y}px` : undefined,\n }}\n >\n <div className={containerClassName} data-taco=\"dialog\">\n {output}\n {dialog.draggable && (\n <div\n {...dragHandleProps}\n aria-label={texts.dialog.drag}\n className=\"yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center\"\n />\n )}\n {dialog.showCloseButton ? (\n <DialogPrimitive.Close onClick={dialog.onClose} asChild>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.dialog.close}\n className=\"absolute top-0 right-0 mt-2 mr-2\"\n icon=\"close\"\n />\n </DialogPrimitive.Close>\n ) : null}\n </div>\n {dialog.elements.drawer}\n {dialog.elements.extra}\n </DialogPrimitive.Content>\n </Backdrop>\n </DialogPrimitive.Overlay>\n </DialogPrimitive.Portal>\n );\n});\n"],"names":["Title","React","DialogTitle","props","ref","className","cn","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","RenderPropWrapper","renderProps","close","CustomEvent","Content","DialogContent","internalRef","useProxiedRef","useDraggable","position","dragHandleProps","handleProps","useLocalization","texts","menu","useCurrentMenu","handleCloseAutoFocus","size","containerClassName","elements","extra","handleEscapeKeyDown","event","closeOnEscape","preventDefault","handleInteractOutside","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus","style","left","draggable","x","undefined","top","y","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;;IAsBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;AAClC,MAAMC,SAAS,GAAGC,EAAE,CAAC,aAAD,EAAgBH,KAAK,CAACE,SAAtB,CAApB;AACA,SAAOJ,aAAA,CAACM,OAAD,oBAA2BJ;AAAOE,IAAAA,SAAS,EAAEA;AAAWD,IAAAA,GAAG,EAAEA;IAA7D,CAAP;AACH,CAHoB;IAMRI,MAAM,gBAAGP,UAAA,CAAiB,SAASQ,YAAT,CAAsBN,KAAtB,EAAgDC,GAAhD;AACnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,uBAAD,EAA0BH,KAAK,CAACE,SAAhC,CAApB;AACA,SACIJ,aAAA,MAAA,oB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 @@
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import { forwardRef, useMemo, createElement, createContext, useContext, isValidElement } from 'react';
|
3
3
|
import cn from 'classnames';
|
4
|
+
import { IconButton } from '../IconButton/IconButton.js';
|
5
|
+
import { useLocalization } from '../Provider/Provider.js';
|
4
6
|
import { Root, Anchor as Anchor$1, Close } from '@radix-ui/react-popover';
|
5
7
|
import { UnstyledContent, UnstyledArrow } from '../Popover/Primitives.js';
|
6
|
-
import { useLocalization } from '../Provider/Provider.js';
|
7
8
|
import mergeRefs from '../../utils/mergeRefs.js';
|
8
|
-
import { IconButton } from '../IconButton/IconButton.js';
|
9
9
|
|
10
|
-
var _excluded = ["children"];
|
10
|
+
var _excluded = ["anchor", "children"];
|
11
11
|
var HangerContext = /*#__PURE__*/createContext({
|
12
12
|
props: {},
|
13
13
|
ref: null
|
@@ -58,7 +58,8 @@ var Content = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
58
58
|
})));
|
59
59
|
});
|
60
60
|
var Hanger = /*#__PURE__*/forwardRef(function (props, ref) {
|
61
|
-
var
|
61
|
+
var anchor = props.anchor,
|
62
|
+
children = props.children,
|
62
63
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
63
64
|
|
64
65
|
var context = useMemo(function () {
|
@@ -70,9 +71,8 @@ var Hanger = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
71
|
return createElement(HangerContext.Provider, {
|
71
72
|
value: context
|
72
73
|
}, createElement(Root, {
|
73
|
-
children: children,
|
74
74
|
defaultOpen: true
|
75
|
-
}));
|
75
|
+
}, anchor && createElement(Anchor, null, anchor), children));
|
76
76
|
});
|
77
77
|
Hanger.Anchor = Anchor;
|
78
78
|
Hanger.Content = Content;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Hanger.js","sources":["../../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from '../Popover/Primitives';\nimport { useLocalization } from '../Provider/Provider';\nimport './Hanger.css';\nimport mergeRefs from '../../utils/mergeRefs';\n\ntype HangerContextValue = {\n props: any;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef((props: HangerAnchorProps, ref: React.Ref<HTMLDivElement>) => {\n const context = React.useContext(HangerContext);\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Anchor {...context.props} {...props} children={children} ref={mergeRefs([context.ref, ref])} asChild />\n );\n});\n\nexport type CloseHandler = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | undefined;\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Handler called when user closes the hanger */\n onClose?: CloseHandler;\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n};\n\nconst Content = React.forwardRef((props: HangerContentProps, ref: React.Ref<HTMLDivElement>) => {\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <UnstyledContent\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n placement={props.placement}\n ref={ref}\n >\n {props.children}\n <UnstyledArrow className=\"text-blue\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute top-0 right-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={props.onClose}\n />\n </PopoverPrimitive.Close>\n </UnstyledContent>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n};\n\nexport const Hanger = React.forwardRef((props: HangerProps, ref: React.Ref<HTMLElement>): JSX.Element => {\n const { children, ...otherProps } = props;\n
|
1
|
+
{"version":3,"file":"Hanger.js","sources":["../../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from '../Popover/Primitives';\nimport { useLocalization } from '../Provider/Provider';\nimport './Hanger.css';\nimport mergeRefs from '../../utils/mergeRefs';\n\ntype HangerContextValue = {\n props: any;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef((props: HangerAnchorProps, ref: React.Ref<HTMLDivElement>) => {\n const context = React.useContext(HangerContext);\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Anchor {...context.props} {...props} children={children} ref={mergeRefs([context.ref, ref])} asChild />\n );\n});\n\nexport type CloseHandler = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | undefined;\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Handler called when user closes the hanger */\n onClose?: CloseHandler;\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n};\n\nconst Content = React.forwardRef((props: HangerContentProps, ref: React.Ref<HTMLDivElement>) => {\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <UnstyledContent\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n placement={props.placement}\n ref={ref}\n >\n {props.children}\n <UnstyledArrow className=\"text-blue\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute top-0 right-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={props.onClose}\n />\n </PopoverPrimitive.Close>\n </UnstyledContent>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n};\n\nexport const Hanger = React.forwardRef((props: HangerProps, ref: React.Ref<HTMLElement>): JSX.Element => {\n const { anchor, children, ...otherProps } = props;\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root defaultOpen>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\n"],"names":["HangerContext","React","props","ref","Anchor","context","children","type","console","warn","name","PopoverPrimitive","mergeRefs","asChild","Content","useLocalization","texts","className","cn","handleInteractOutside","event","preventDefault","UnstyledContent","onInteractOutside","placement","UnstyledArrow","IconButton","appearance","hanger","close","icon","onClick","onClose","Hanger","anchor","otherProps","Provider","value","defaultOpen"],"mappings":";;;;;;;;;;AAcA,IAAMA,aAAa,gBAAGC,aAAA,CAAwC;AAC1DC,EAAAA,KAAK,EAAE,EADmD;AAE1DC,EAAAA,GAAG,EAAE;AAFqD,CAAxC,CAAtB;AAWA,IAAMC,MAAM,gBAAGH,UAAA,CAAiB,UAACC,KAAD,EAA2BC,GAA3B;;;AAC5B,MAAME,OAAO,GAAGJ,UAAA,CAAiBD,aAAjB,CAAhB;AACA,MAAIM,QAAQ,GAAGJ,KAAK,CAACI,QAArB;;AAEA,MAAIL,cAAA,CAAqBC,KAAK,CAACI,QAA3B,KAAwC,2BAAOJ,KAAK,CAACI,QAAb,oDAAO,gBAAgBC,IAAvB,MAAgC,UAA5E,EAAwF;AACpFC,IAAAA,OAAO,CAACC,IAAR,qHACsHP,KAAK,CAACI,QAAN,CAAeC,IAAf,CAAoBG,IAD1I,mDAC4LR,KAAK,CAACI,QAAN,CAAeC,IAAf,CAAoBG,IADhN;AAGAJ,IAAAA,QAAQ,GAAGL,aAAA,OAAA,MAAA,EAAOC,KAAK,CAACI,QAAb,CAAX;AACH;;AAED,SACIL,aAAA,CAACU,QAAD,oBAA6BN,OAAO,CAACH,OAAWA;AAAOI,IAAAA,QAAQ,EAAEA;AAAUH,IAAAA,GAAG,EAAES,SAAS,CAAC,CAACP,OAAO,CAACF,GAAT,EAAcA,GAAd,CA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AG,EAAHA;AAArB,KAAP;AAAA,GAAd,EAAkD,CAACgC,UAAD,CAAlD,CAAhB;AAEA,SACIlC,aAAA,CAACD,aAAa,CAACoC,QAAf;AAAwBC,IAAAA,KAAK,EAAEhC;GAA/B,EACIJ,aAAA,CAACU,IAAD;AAAuB2B,IAAAA,WAAW;GAAlC,EACKJ,MAAM,IAAIjC,aAAA,CAACG,MAAD,MAAA,EAAS8B,MAAT,CADf,EAEK5B,QAFL,CADJ,CADJ;AAQH,CAZqB;AAatB2B,MAAM,CAAC7B,MAAP,GAAgBA,MAAhB;AACA6B,MAAM,CAACnB,OAAP,GAAiBA,OAAjB;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"IconButton.js","sources":["../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getAppearanceClasses, getButtonClasses, createButton } from '../Button/util';\nimport { Appearance } from '../../types';\nimport { DialogProps, HangerProps, PopoverProps } from '../..';\n\nexport type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {\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?:
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getAppearanceClasses, getButtonClasses, createButton } from '../Button/util';\nimport { Appearance } from '../../types';\nimport { DialogProps, HangerProps, MenuProps, PopoverProps } from '../..';\n\nexport type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'children'> & {\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 /** Hanger component associated with the button. */\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\n /** Set which icon should be rendered within button */\n icon: IconName; // this dynamic type causes the type extraction for props to fail\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 /**\n * Set whether the button is rounded.\n * Default value is `false`\n */\n rounded?: boolean;\n /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nexport const IconButton = React.forwardRef(function IconButton(props: IconButtonProps, ref: React.Ref<HTMLButtonElement>) {\n const { appearance, icon, rounded = false, ...otherProps } = props;\n\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(appearance, true),\n {\n 'rounded-full': rounded,\n rounded: !rounded,\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n },\n props.className\n );\n\n if (!icon) {\n return null;\n }\n\n return createButton(\n { ...otherProps, children: <Icon name={icon} className=\"m-0 p-0\" />, 'data-taco': 'icon-button' },\n className,\n ref\n );\n});\n"],"names":["IconButton","React","props","ref","appearance","icon","rounded","otherProps","className","cn","getButtonClasses","getAppearanceClasses","disabled","createButton","children","Icon","name"],"mappings":";;;;;;;IAsCaA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;AACvC,MAAQC,UAAR,GAA6DF,KAA7D,CAAQE,UAAR;AAAA,MAAoBC,IAApB,GAA6DH,KAA7D,CAAoBG,IAApB;AAAA,uBAA6DH,KAA7D,CAA0BI,OAA1B;AAAA,MAA0BA,OAA1B,+BAAoC,KAApC;AAAA,MAA8CC,UAA9C,iCAA6DL,KAA7D;;AAEA,MAAMM,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EADA,EAEhBC,oBAAoB,CAACP,UAAD,EAAa,IAAb,CAFJ,EAGhB;AACI,oBAAgBE,OADpB;AAEIA,IAAAA,OAAO,EAAE,CAACA,OAFd;AAGI,qCAAiCJ,KAAK,CAACU,QAH3C;AAII,4CAAwC,CAACV,KAAK,CAACU;AAJnD,GAHgB,EAShBV,KAAK,CAACM,SATU,CAApB;;AAYA,MAAI,CAACH,IAAL,EAAW;AACP,WAAO,IAAP;AACH;;AAED,SAAOQ,YAAY,cACVN,UADU;AACEO,IAAAA,QAAQ,EAAEb,aAAA,CAACc,IAAD;AAAMC,MAAAA,IAAI,EAAEX;AAAMG,MAAAA,SAAS,EAAC;KAA5B,CADZ;AACsD,iBAAa;AADnE,MAEfA,SAFe,EAGfL,GAHe,CAAnB;AAKH,CAxByB;;;;"}
|
@@ -3,8 +3,8 @@ import { forwardRef, useMemo, createRef, useEffect, createElement } from 'react'
|
|
3
3
|
import cn from 'classnames';
|
4
4
|
import { Spinner } from '../Spinner/Spinner.js';
|
5
5
|
import { useLocalization } from '../Provider/Provider.js';
|
6
|
-
import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
|
7
6
|
import { Checkbox } from '../Checkbox/Checkbox.js';
|
7
|
+
import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
|
8
8
|
import { getInputClasses } from '../Input/util.js';
|
9
9
|
import { getNextIndexFromKeycode } from '../../utils/hooks/useListKeyboardNavigation.js';
|
10
10
|
import { useListScrollTo } from '../../utils/hooks/useListScrollTo.js';
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { useState, useMemo, createElement } from 'react';
|
2
|
-
import { Root } from '@radix-ui/react-dropdown-menu';
|
3
3
|
import { MenuContext } from './Context.js';
|
4
|
+
import { Root } from '@radix-ui/react-dropdown-menu';
|
4
5
|
import { Content } from './components/Content.js';
|
5
6
|
import { Item } from './components/Item.js';
|
6
7
|
import { Link } from './components/Link.js';
|
@@ -10,7 +11,12 @@ import { RadioGroup } from './components/RadioGroup.js';
|
|
10
11
|
import { Separator } from './components/Separator.js';
|
11
12
|
import { Header } from './components/Header.js';
|
12
13
|
|
13
|
-
var
|
14
|
+
var _excluded = ["children", "trigger"];
|
15
|
+
var Menu = function Menu(externalProps) {
|
16
|
+
var children = externalProps.children,
|
17
|
+
trigger = externalProps.trigger,
|
18
|
+
props = _objectWithoutPropertiesLoose(externalProps, _excluded);
|
19
|
+
|
14
20
|
var _React$useState = useState(false),
|
15
21
|
open = _React$useState[0],
|
16
22
|
setOpen = _React$useState[1];
|
@@ -51,7 +57,7 @@ var Menu = function Menu(props) {
|
|
51
57
|
}, createElement(Root, Object.assign({}, props, {
|
52
58
|
open: open,
|
53
59
|
onOpenChange: setOpen
|
54
|
-
})));
|
60
|
+
}), trigger && createElement(Trigger, null, trigger), children));
|
55
61
|
};
|
56
62
|
Menu.Trigger = Trigger;
|
57
63
|
Menu.Content = Content;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { MenuContext } from './Context';\nimport { Content } from './components/Content';\nimport { Item } from './components/Item';\nimport { Link } from './components/Link';\nimport { Trigger } from './components/Trigger';\nimport { Checkbox } from './components/Checkbox';\nimport { RadioGroup } from './components/RadioGroup';\nimport { Separator } from './components/Separator';\nimport { Header } from './components/Header';\nimport { Appearance } from '../..';\n\nexport type MenuProps = {\n children: React.ReactNode;\n id?: string;\n};\n\nexport const Menu = (
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { MenuContext } from './Context';\nimport { Content } from './components/Content';\nimport { Item } from './components/Item';\nimport { Link } from './components/Link';\nimport { Trigger } from './components/Trigger';\nimport { Checkbox } from './components/Checkbox';\nimport { RadioGroup } from './components/RadioGroup';\nimport { Separator } from './components/Separator';\nimport { Header } from './components/Header';\nimport { Appearance } from '../..';\n\nexport type MenuProps = {\n children: React.ReactNode;\n id?: string;\n /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\n\nexport const Menu = (externalProps: MenuProps): JSX.Element => {\n const { children, trigger, ...props } = externalProps;\n const [open, setOpen] = React.useState(false);\n const [appearance, setAppearance] = React.useState<Appearance>('default');\n const [indented, setIndented] = React.useState(false);\n const [minWidth, setMinWidth] = React.useState<number | undefined>(undefined);\n\n const context = React.useMemo(\n () => ({\n appearance,\n setAppearance: (appearance: Appearance) => setAppearance(appearance),\n indented,\n registerIndentation: () => setIndented(true),\n minWidth,\n setMinWidth: (width: number) => setMinWidth(width),\n close: () => setOpen(false),\n }),\n [indented, minWidth, appearance]\n );\n\n return (\n <MenuContext.Provider value={context}>\n <DropdownMenuPrimitive.Root {...props} open={open} onOpenChange={setOpen}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </DropdownMenuPrimitive.Root>\n </MenuContext.Provider>\n );\n};\nMenu.Trigger = Trigger;\nMenu.Content = Content;\nMenu.Item = Item;\nMenu.Link = Link;\nMenu.Checkbox = Checkbox;\nMenu.Separator = Separator;\nMenu.Header = Header;\nMenu.RadioGroup = RadioGroup;\n"],"names":["Menu","externalProps","children","trigger","props","React","open","setOpen","appearance","setAppearance","indented","setIndented","undefined","minWidth","setMinWidth","context","registerIndentation","width","close","MenuContext","Provider","value","DropdownMenuPrimitive","onOpenChange","Trigger","Content","Item","Link","Checkbox","Separator","Header","RadioGroup"],"mappings":";;;;;;;;;;;;;;IAoBaA,IAAI,GAAG,SAAPA,IAAO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,OAAO,IAAIE,aAAA,CAACmB,OAAD,MAAA,EAAUrB,OAAV,CADhB,EAEKD,QAFL,CADJ,CADJ;AAQH;AACDF,IAAI,CAACwB,OAAL,GAAeA,OAAf;AACAxB,IAAI,CAACyB,OAAL,GAAeA,OAAf;AACAzB,IAAI,CAAC0B,IAAL,GAAYA,IAAZ;AACA1B,IAAI,CAAC2B,IAAL,GAAYA,IAAZ;AACA3B,IAAI,CAAC4B,QAAL,GAAgBA,QAAhB;AACA5B,IAAI,CAAC6B,SAAL,GAAiBA,SAAjB;AACA7B,IAAI,CAAC8B,MAAL,GAAcA,MAAd;AACA9B,IAAI,CAAC+B,UAAL,GAAkBA,UAAlB;;;;"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import { forwardRef, createElement } from 'react';
|
3
3
|
import cn from 'classnames';
|
4
|
-
import { Content as Content$1 } from '@radix-ui/react-dropdown-menu';
|
5
|
-
import { useCurrentMenu } from '../Context.js';
|
6
4
|
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
5
|
+
import { useCurrentMenu } from '../Context.js';
|
6
|
+
import { Content as Content$1 } from '@radix-ui/react-dropdown-menu';
|
7
7
|
|
8
8
|
var _excluded = ["children", "placement"];
|
9
9
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
|
-
import { Label } from '@radix-ui/react-dropdown-menu';
|
4
3
|
import { useCurrentMenu } from '../Context.js';
|
4
|
+
import { Label } from '@radix-ui/react-dropdown-menu';
|
5
5
|
|
6
6
|
var getAppearanceClasses = function getAppearanceClasses(appearance) {
|
7
7
|
switch (appearance) {
|
@@ -2,16 +2,16 @@ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '.
|
|
2
2
|
import { forwardRef, createElement, useEffect } from 'react';
|
3
3
|
import cn from 'classnames';
|
4
4
|
import { Icon as Icon$1 } from '../../Icon/Icon.js';
|
5
|
-
import { Item as Item$1 } from '@radix-ui/react-dropdown-menu';
|
6
5
|
import { useCurrentMenu } from '../Context.js';
|
6
|
+
import { Item as Item$1 } from '@radix-ui/react-dropdown-menu';
|
7
7
|
|
8
|
-
var _excluded = ["icon", "shortcut"];
|
8
|
+
var _excluded = ["dialog", "icon", "onClick", "shortcut"];
|
9
9
|
var Icon = function Icon(_ref) {
|
10
10
|
var name = _ref.name;
|
11
11
|
return createElement("span", {
|
12
12
|
className: "absolute left-0 ml-1"
|
13
13
|
}, createElement(Icon$1, {
|
14
|
-
className: "!h-5 !w-5
|
14
|
+
className: "-ml-px -mt-px !h-5 !w-5",
|
15
15
|
name: name
|
16
16
|
}));
|
17
17
|
};
|
@@ -86,7 +86,11 @@ var Shortcut = function Shortcut(props) {
|
|
86
86
|
}));
|
87
87
|
};
|
88
88
|
var Item = /*#__PURE__*/forwardRef(function MenuItem(props, ref) {
|
89
|
-
var
|
89
|
+
var _props$disabled;
|
90
|
+
|
91
|
+
var dialog = props.dialog,
|
92
|
+
icon = props.icon,
|
93
|
+
onClick = props.onClick,
|
90
94
|
shortcut = props.shortcut,
|
91
95
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
92
96
|
|
@@ -95,29 +99,42 @@ var Item = /*#__PURE__*/forwardRef(function MenuItem(props, ref) {
|
|
95
99
|
indented: !!icon,
|
96
100
|
className: props.className
|
97
101
|
});
|
102
|
+
var disabled = (_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : props['aria-disabled'];
|
98
103
|
var handleClick; // radix has a bug that does not disable clicks when disabled is set on items
|
99
104
|
|
100
|
-
if (
|
101
|
-
handleClick =
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
if (props.onClick) {
|
106
|
-
event.persist();
|
107
|
-
props.onClick(event);
|
108
|
-
event.preventDefault();
|
109
|
-
}
|
110
|
-
};
|
111
|
-
}
|
105
|
+
if (disabled) {
|
106
|
+
handleClick = function handleClick(event) {
|
107
|
+
event.preventDefault();
|
108
|
+
event.stopPropagation();
|
109
|
+
};
|
112
110
|
}
|
113
111
|
|
114
|
-
|
112
|
+
var handleSelect = function handleSelect(event) {
|
113
|
+
if (onClick) {
|
114
|
+
onClick(event);
|
115
|
+
}
|
116
|
+
|
117
|
+
if (props['aria-haspopup'] || typeof dialog === 'function') {
|
118
|
+
event.preventDefault();
|
119
|
+
}
|
120
|
+
};
|
121
|
+
|
122
|
+
var button = createElement(Item$1, Object.assign({}, otherProps, {
|
115
123
|
className: className,
|
116
124
|
onClick: handleClick,
|
125
|
+
onSelect: handleSelect,
|
117
126
|
ref: ref
|
118
127
|
}), icon && createElement(Icon, {
|
119
128
|
name: icon
|
120
129
|
}), props.children, shortcut && createElement(Shortcut, null, shortcut));
|
130
|
+
|
131
|
+
if (typeof dialog === 'function') {
|
132
|
+
button = dialog({
|
133
|
+
trigger: button
|
134
|
+
});
|
135
|
+
}
|
136
|
+
|
137
|
+
return button;
|
121
138
|
});
|
122
139
|
|
123
140
|
export { Icon, Item, Shortcut, useItemStyling };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { Appearance } from '../../../types';\n\nexport const Icon = ({ name }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"!h-5 !w-5
|
1
|
+
{"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { Appearance } from '../../../types';\nimport { DialogProps } from '../../Dialog/Dialog';\n\nexport const Icon = ({ name }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nconst getAppearanceClasses = (appearance: Appearance | undefined) => {\n switch (appearance) {\n case 'primary':\n return 'wcag-blue aria-disabled:text-blue-dark focus:wcag-blue-light';\n\n case 'danger':\n return 'wcag-red aria-disabled:text-red-dark focus:wcag-red-light';\n\n case 'ghost':\n return 'text-blue aria-disabled:text-grey focus:wcag-blue';\n\n case 'discrete':\n return 'text-black aria-disabled:text-grey focus:wcag-blue-lightest';\n\n case 'default':\n default:\n return 'wcag-grey-light aria-disabled:text-grey-darker focus:wcag-grey-dark';\n }\n};\n\nexport const useItemStyling = ({ disabled, indented, className }) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-7 pr-1.5 relative rounded w-full focus:outline-none group',\n getAppearanceClasses(menu?.appearance),\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n 'cursor-pointer': !disabled,\n 'cursor-not-allowed': disabled,\n },\n className\n );\n};\n\nexport const Shortcut = props => {\n const menu = useCurrentMenu();\n let appearance;\n\n switch (menu?.appearance) {\n case 'primary':\n appearance = 'text-blue-lightest group-focus:text-black';\n break;\n\n case 'danger':\n appearance = 'text-red-lightest group-focus:text-white';\n break;\n\n case 'ghost':\n appearance = 'text-blue-light group-focus:text-blue-lightest';\n break;\n\n case 'discrete':\n appearance = 'text-grey-darker group-focus:text-blue-light';\n break;\n\n case 'default':\n default:\n appearance = 'text-grey-darkest';\n break;\n }\n\n const className = cn('ml-auto pl-3', appearance);\n\n return <span {...props} className={className} />;\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n let disabled = props.disabled ?? props['aria-disabled'];\n\n let handleClick;\n\n // radix has a bug that does not disable clicks when disabled is set on items\n if (disabled) {\n handleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n };\n }\n\n let handleSelect = event => {\n if (onClick) {\n onClick(event);\n }\n\n if (props['aria-haspopup'] || typeof dialog === 'function') {\n event.preventDefault();\n }\n };\n\n let button = (\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\n {icon && <Icon name={icon} />}\n {props.children}\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\n </DropdownMenuPrimitive.Item>\n );\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n }\n\n return button;\n});\n"],"names":["Icon","name","React","className","IconPrimitive","getAppearanceClasses","appearance","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","onSelect","children","trigger"],"mappings":";;;;;;;;IASaA,IAAI,GAAG,SAAPA,IAAO;AAAA,MAAGC,IAAH,QAAGA,IAAH;AAAA,SAChBC,aAAA,OAAA;AAAMC,IAAAA,SAAS,EAAC;GAAhB,EACID,aAAA,CAACE,MAAD;AAAeD,IAAAA,SAAS,EAAC;AAA0BF,IAAAA,IAAI,EAAEA;GAAzD,CADJ,CADgB;AAAA;;AAMpB,IAAMI,oBAAoB,GAAG,SAAvBA,oBAAu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L,IAA0B,OAAOI,MAAP,KAAkB,UAAhD,EAA4D;AACxDM,MAAAA,KAAK,CAACC,cAAN;AACH;AACJ,GARD;;AAUA,MAAIG,MAAM,GACN3B,aAAA,CAAC4B,MAAD,oBAAgCP;AAAYpB,IAAAA,SAAS,EAAEA;AAAWkB,IAAAA,OAAO,EAAEG;AAAaO,IAAAA,QAAQ,EAAEH;AAAcV,IAAAA,GAAG,EAAEA;IAArH,EACKE,IAAI,IAAIlB,aAAA,CAACF,IAAD;AAAMC,IAAAA,IAAI,EAAEmB;GAAZ,CADb,EAEKL,KAAK,CAACiB,QAFX,EAGKV,QAAQ,IAAIpB,aAAA,CAACY,QAAD,MAAA,EAAWQ,QAAX,CAHjB,CADJ;;AAQA,MAAI,OAAOH,MAAP,KAAkB,UAAtB,EAAkC;AAC9BU,IAAAA,MAAM,GAAGV,MAAM,CAAC;AAAEc,MAAAA,OAAO,EAAEJ;AAAX,KAAD,CAAf;AACH;;AAED,SAAOA,MAAP;AACH,CA3CmB;;;;"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
|
-
import { Separator as Separator$1 } from '@radix-ui/react-dropdown-menu';
|
4
3
|
import { useCurrentMenu } from '../Context.js';
|
4
|
+
import { Separator as Separator$1 } from '@radix-ui/react-dropdown-menu';
|
5
5
|
|
6
6
|
var getAppearanceClasses = function getAppearanceClasses(appearance) {
|
7
7
|
switch (appearance) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { forwardRef, useEffect, createElement } from 'react';
|
2
|
-
import { Trigger as Trigger$1 } from '@radix-ui/react-dropdown-menu';
|
3
|
-
import { useCurrentMenu } from '../Context.js';
|
4
2
|
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
3
|
+
import { useCurrentMenu } from '../Context.js';
|
4
|
+
import { Trigger as Trigger$1 } from '@radix-ui/react-dropdown-menu';
|
5
5
|
|
6
6
|
var Trigger = /*#__PURE__*/forwardRef(function MenuTrigger(props, ref) {
|
7
7
|
var _props$children3, _props$children3$prop;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createElement, Fragment } from 'react';
|
2
|
-
import { useLocalization } from '../Provider/Provider.js';
|
3
2
|
import { Button } from '../Button/Button.js';
|
3
|
+
import { useLocalization } from '../Provider/Provider.js';
|
4
4
|
|
5
5
|
var createPageRange = function createPageRange(pageCount, pageNumber) {
|
6
6
|
var lowerLimit = Math.min(pageNumber, pageCount);
|