@economic/taco 0.0.6-alpha.0 → 0.0.10-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 +11 -10
- package/dist/components/Dialog/Context.d.ts +2 -1
- package/dist/components/Dialog/Dialog.d.ts +20 -10
- package/dist/components/Dialog/components/Content.d.ts +9 -8
- package/dist/components/Hanger/Hanger.d.ts +4 -1
- package/dist/components/IconButton/IconButton.d.ts +5 -1
- package/dist/components/Menu/Menu.d.ts +3 -1
- package/dist/components/Popover/Popover.d.ts +4 -1
- package/dist/components/Select/Select.d.ts +1 -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 +20 -10
- 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 +2 -1
- package/dist/esm/components/Dialog/Context.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +18 -16
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Dialog/components/Content.js +46 -19
- package/dist/esm/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/components/Dialog/components/Drawer.js +3 -1
- package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
- package/dist/esm/components/Dialog/components/Extra.js +3 -1
- package/dist/esm/components/Dialog/components/Extra.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/Input/Input.js +1 -1
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/components/Menu/Menu.js +8 -2
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- 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 +7 -7
- package/dist/esm/components/Table/components/Table.js +1 -2
- package/dist/esm/components/Table/components/Table.js.map +1 -1
- package/dist/esm/components/Table/components/WindowedTable.js +0 -1
- package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/components/Table/hooks/useTable.js +4 -1
- package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
- package/dist/esm/components/Toast/Toast.js +1 -1
- package/dist/esm/components/Tour/Tour.js +2 -2
- package/dist/esm/index.css +45 -45
- package/dist/esm/index.js +7 -7
- package/dist/index.css +45 -45
- package/dist/taco.cjs.development.js +1850 -1793
- 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 +1073 -542
@@ -1,12 +1,12 @@
|
|
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 { useLocalization } from '../Provider/Provider.js';
|
5
|
-
import { Popover } from '../Popover/Popover.js';
|
6
4
|
import { IconButton } from '../IconButton/IconButton.js';
|
5
|
+
import { useLocalization } from '../Provider/Provider.js';
|
7
6
|
import { Calendar } from '../Calendar/Calendar.js';
|
8
7
|
import { Input } from '../Input/Input.js';
|
9
8
|
import { useDatepicker } from './useDatepicker.js';
|
9
|
+
import { Popover } from '../Popover/Popover.js';
|
10
10
|
|
11
11
|
var _excluded = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
|
12
12
|
var Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
|
@@ -2,7 +2,7 @@ import { createContext, useContext } from 'react';
|
|
2
2
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
4
4
|
var DialogContext = /*#__PURE__*/createContext({
|
5
|
-
|
5
|
+
closeOnEscape: true,
|
6
6
|
draggable: false,
|
7
7
|
drawer: undefined,
|
8
8
|
elements: {
|
@@ -12,6 +12,7 @@ var DialogContext = /*#__PURE__*/createContext({
|
|
12
12
|
onClose: function onClose() {},
|
13
13
|
props: {},
|
14
14
|
ref: null,
|
15
|
+
showCloseButton: true,
|
15
16
|
size: 'sm'
|
16
17
|
});
|
17
18
|
var useCurrentDialog = function useCurrentDialog() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Context.js","sources":["../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n draggable: boolean;\n drawer?: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n
|
1
|
+
{"version":3,"file":"Context.js","sources":["../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n closeOnEscape: boolean;\n draggable: boolean;\n drawer?: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n onClose?: () => void;\n props: {};\n ref: React.Ref<HTMLElement>;\n showCloseButton: boolean;\n size: DialogSize;\n};\n\nexport const DialogContext = React.createContext<DialogContext>({\n closeOnEscape: true,\n draggable: false,\n drawer: undefined,\n elements: {\n drawer: undefined,\n extra: undefined,\n },\n onClose: () => {},\n props: {},\n ref: null,\n showCloseButton: true,\n size: 'sm',\n});\n\nexport const useCurrentDialog = () => {\n return React.useContext(DialogContext);\n};\n"],"names":["DialogContext","React","closeOnEscape","draggable","drawer","undefined","elements","extra","onClose","props","ref","showCloseButton","size","useCurrentDialog"],"mappings":";;AAAA;IAsBaA,aAAa,gBAAGC,aAAA,CAAmC;AAC5DC,EAAAA,aAAa,EAAE,IAD6C;AAE5DC,EAAAA,SAAS,EAAE,KAFiD;AAG5DC,EAAAA,MAAM,EAAEC,SAHoD;AAI5DC,EAAAA,QAAQ,EAAE;AACNF,IAAAA,MAAM,EAAEC,SADF;AAENE,IAAAA,KAAK,EAAEF;AAFD,GAJkD;AAQ5DG,EAAAA,OAAO,EAAE,qBARmD;AAS5DC,EAAAA,KAAK,EAAE,EATqD;AAU5DC,EAAAA,GAAG,EAAE,IAVuD;AAW5DC,EAAAA,eAAe,EAAE,IAX2C;AAY5DC,EAAAA,IAAI,EAAE;AAZsD,CAAnC;IAehBC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAOZ,UAAA,CAAiBD,aAAjB,CAAP;AACH;;;;"}
|
@@ -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", "draggable", "onClose", "open", "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 () {
|
@@ -29,12 +29,19 @@ var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
|
29
29
|
|
30
30
|
var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
31
31
|
var initialChildren = props.children,
|
32
|
+
_props$closeOnEscape = props.closeOnEscape,
|
33
|
+
closeOnEscape = _props$closeOnEscape === void 0 ? true : _props$closeOnEscape,
|
34
|
+
defaultOpen = props.defaultOpen,
|
32
35
|
_props$draggable = props.draggable,
|
33
36
|
draggable = _props$draggable === void 0 ? false : _props$draggable,
|
37
|
+
onChange = props.onChange,
|
34
38
|
onClose = props.onClose,
|
35
|
-
|
39
|
+
open = props.open,
|
40
|
+
_props$showCloseButto = props.showCloseButton,
|
41
|
+
showCloseButton = _props$showCloseButto === void 0 ? true : _props$showCloseButto,
|
36
42
|
_props$size = props.size,
|
37
43
|
size = _props$size === void 0 ? 'sm' : _props$size,
|
44
|
+
trigger = props.trigger,
|
38
45
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
39
46
|
|
40
47
|
var _useSeparatedChildren = useSeparatedChildren(initialChildren),
|
@@ -42,19 +49,13 @@ var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
42
49
|
drawer = _useSeparatedChildren[1],
|
43
50
|
extra = _useSeparatedChildren[2];
|
44
51
|
|
45
|
-
var _React$useState = useState(
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
var _React$useState2 = useState(false),
|
50
|
-
drawerOpen = _React$useState2[0],
|
51
|
-
setDrawerOpen = _React$useState2[1];
|
52
|
+
var _React$useState = useState(false),
|
53
|
+
drawerOpen = _React$useState[0],
|
54
|
+
setDrawerOpen = _React$useState[1];
|
52
55
|
|
53
56
|
var context = useMemo(function () {
|
54
57
|
return {
|
55
|
-
|
56
|
-
return setOpen(false);
|
57
|
-
},
|
58
|
+
closeOnEscape: closeOnEscape,
|
58
59
|
draggable: draggable,
|
59
60
|
drawer: {
|
60
61
|
open: drawerOpen,
|
@@ -70,17 +71,18 @@ var Dialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
71
|
},
|
71
72
|
onClose: onClose,
|
72
73
|
props: otherProps,
|
74
|
+
showCloseButton: showCloseButton,
|
73
75
|
size: size,
|
74
76
|
ref: ref
|
75
77
|
};
|
76
|
-
}, [
|
78
|
+
}, [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]);
|
77
79
|
return createElement(DialogContext.Provider, {
|
78
80
|
value: context
|
79
81
|
}, createElement(Root, {
|
80
|
-
|
82
|
+
defaultOpen: defaultOpen,
|
81
83
|
open: open,
|
82
|
-
onOpenChange:
|
83
|
-
}));
|
84
|
+
onOpenChange: onChange
|
85
|
+
}, trigger && createElement(Trigger, null, trigger), children));
|
84
86
|
});
|
85
87
|
Dialog.Trigger = Trigger;
|
86
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 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 {
|
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,oBAAuB,CAAAC,eAAe;AACxC,SAAOC,O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DtBQ,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,26 +2,27 @@ 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';
|
7
|
+
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
6
8
|
import { Title as Title$1, Close as Close$1, Portal, Overlay, Content as Content$1 } from '@radix-ui/react-dialog';
|
7
9
|
import { useCurrentDialog } from '../Context.js';
|
8
|
-
import { useProxiedRef } from '../../../utils/hooks/useProxiedRef.js';
|
9
10
|
import { useDraggable } from '../../../utils/hooks/useDraggable.js';
|
10
11
|
import { useCurrentMenu } from '../../Menu/Context.js';
|
11
|
-
import { Group } from '../../Group/Group.js';
|
12
|
-
import { IconButton } from '../../IconButton/IconButton.js';
|
13
12
|
|
14
13
|
var Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
|
14
|
+
var className = cn('text-center', props.className);
|
15
15
|
return createElement(Title$1, Object.assign({}, props, {
|
16
|
-
className:
|
16
|
+
className: className,
|
17
17
|
ref: ref
|
18
18
|
}));
|
19
19
|
});
|
20
20
|
var Footer = /*#__PURE__*/forwardRef(function DialogFooter(props, ref) {
|
21
|
+
var className = cn('mt-8 flex justify-end', props.className);
|
21
22
|
return createElement("div", Object.assign({}, props, {
|
22
|
-
className:
|
23
|
+
className: className,
|
23
24
|
ref: ref
|
24
|
-
}),
|
25
|
+
}), props.children);
|
25
26
|
});
|
26
27
|
var Close = /*#__PURE__*/forwardRef(function DialogClose(props, ref) {
|
27
28
|
var dialog = useCurrentDialog();
|
@@ -32,6 +33,20 @@ var Close = /*#__PURE__*/forwardRef(function DialogClose(props, ref) {
|
|
32
33
|
asChild: true
|
33
34
|
}));
|
34
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
|
+
});
|
35
50
|
var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
36
51
|
var dialog = useCurrentDialog();
|
37
52
|
var internalRef = useProxiedRef(ref);
|
@@ -54,7 +69,7 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
54
69
|
};
|
55
70
|
}
|
56
71
|
|
57
|
-
var className = cn('bg-white rounded mt-16 mx-auto', {
|
72
|
+
var className = cn('bg-white rounded relative mt-16 mx-auto', {
|
58
73
|
'w-128 text-center justify-center': dialog.size === 'dialog',
|
59
74
|
'w-xs': dialog.size === 'xs',
|
60
75
|
'w-sm': dialog.size === 'sm',
|
@@ -63,7 +78,16 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
63
78
|
});
|
64
79
|
var containerClassName = cn('bg-white p-6 rounded relative z-[999]', 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]', {
|
65
80
|
'rounded-b-none': !!dialog.elements.extra
|
66
|
-
}, props.className);
|
81
|
+
}, props.className);
|
82
|
+
|
83
|
+
var handleEscapeKeyDown = function handleEscapeKeyDown(event) {
|
84
|
+
if (!dialog.closeOnEscape) {
|
85
|
+
event.preventDefault();
|
86
|
+
} else if (dialog.onClose) {
|
87
|
+
dialog.onClose();
|
88
|
+
}
|
89
|
+
}; // the chosen behaviour in taco is that outside clicks do not close the dialog
|
90
|
+
|
67
91
|
|
68
92
|
var handleInteractOutside = function handleInteractOutside(event) {
|
69
93
|
return event.preventDefault();
|
@@ -72,10 +96,13 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
72
96
|
var output;
|
73
97
|
|
74
98
|
if (typeof props.children === 'function') {
|
75
|
-
output =
|
76
|
-
|
77
|
-
|
78
|
-
|
99
|
+
output = createElement(Close$1, {
|
100
|
+
asChild: true
|
101
|
+
}, createElement(RenderPropWrapper, {
|
102
|
+
renderProps: {
|
103
|
+
drawer: dialog.drawer
|
104
|
+
}
|
105
|
+
}, props.children));
|
79
106
|
} else {
|
80
107
|
output = props.children;
|
81
108
|
}
|
@@ -84,13 +111,13 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
84
111
|
asChild: true
|
85
112
|
}, createElement(Backdrop, null, createElement(Content$1, Object.assign({}, props, {
|
86
113
|
className: className,
|
87
|
-
onEscapeKeyDown:
|
114
|
+
onEscapeKeyDown: handleEscapeKeyDown,
|
88
115
|
onInteractOutside: handleInteractOutside,
|
89
116
|
onCloseAutoFocus: handleCloseAutoFocus,
|
90
117
|
ref: ref,
|
91
118
|
style: _extends({}, props.style, {
|
92
|
-
left: dialog.draggable ?
|
93
|
-
top: dialog.draggable ?
|
119
|
+
left: dialog.draggable ? position.x + "px" : undefined,
|
120
|
+
top: dialog.draggable ? position.y + "px" : undefined
|
94
121
|
})
|
95
122
|
}), createElement("div", {
|
96
123
|
className: containerClassName,
|
@@ -98,15 +125,15 @@ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
|
|
98
125
|
}, output, dialog.draggable && createElement("div", Object.assign({}, dragHandleProps, {
|
99
126
|
"aria-label": texts.dialog.drag,
|
100
127
|
className: "yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center"
|
101
|
-
})), createElement(Close$1, {
|
102
|
-
|
103
|
-
|
128
|
+
})), dialog.showCloseButton ? createElement(Close$1, {
|
129
|
+
onClick: dialog.onClose,
|
130
|
+
asChild: true
|
104
131
|
}, createElement(IconButton, {
|
105
132
|
appearance: "discrete",
|
106
133
|
"aria-label": texts.dialog.close,
|
107
134
|
className: "absolute top-0 right-0 mt-2 mr-2",
|
108
135
|
icon: "close"
|
109
|
-
}))), dialog.elements.drawer, dialog.elements.extra))));
|
136
|
+
})) : null), dialog.elements.drawer, dialog.elements.extra))));
|
110
137
|
});
|
111
138
|
|
112
139
|
export { Close, Content, Footer, Title };
|
@@ -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 { Group } from '../../Group/Group';\nimport { Backdrop } from '../../Backdrop/Backdrop';\n\nexport type DialogContentRenderProps = {\n close: () => void;\n drawer?: {\n open: boolean;\n toggle: () => void;\n };\n};\n\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n return <DialogPrimitive.Title {...props} className=\"text-center\" ref={ref} />;\n});\n\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\n return (\n <div {...props} className=\"mt-8 flex justify-end\" ref={ref}>\n <Group>{props.children}</Group>\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 description to be announced when the dialog is opened */\n 'aria-describedby': 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 // 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={dialog.onClose}\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 <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 </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","DialogPrimitive","className","Footer","DialogFooter","Group","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","Content","DialogContent","internalRef","useProxiedRef","useDraggable","position","dragHandleProps","handleProps","useLocalization","texts","menu","useCurrentMenu","handleCloseAutoFocus","close","cn","size","containerClassName","elements","extra","handleInteractOutside","event","preventDefault","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus","style","left","draggable","x","undefined","top","y","drag","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;;;IAqBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;AAClC,SAAOH,aAAA,CAACI,OAAD,oBAA2BF;AAAOG,IAAAA,SAAS,EAAC;AAAcF,IAAAA,GAAG,EAAEA;IAA/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A,GAAG,EAAEtC,MAAM,CAACmC,SAAP,mBAAiCzB,QAAQ,CAAC6B,CAA1C,WAAmDF;AAHvD;IAPT,EAaIjD,aAAA,MAAA;AAAKK,IAAAA,SAAS,EAAE4B;iBAA8B;GAA9C,EACKM,MADL,EAEK3B,MAAM,CAACmC,SAAP,IACG/C,aAAA,MAAA,oBACQuB;kBACQG,KAAK,CAACd,MAAN,CAAawC;AACzB/C,IAAAA,SAAS,EAAC;IAHd,CAHR,EASIL,aAAA,CAACI,OAAD;AAAuBY,IAAAA,OAAO;AAACF,IAAAA,OAAO,EAAEF,MAAM,CAACG;GAA/C,EACIf,aAAA,CAACqD,UAAD;AACIC,IAAAA,UAAU,EAAC;kBACC5B,KAAK,CAACd,MAAN,CAAakB;AACzBzB,IAAAA,SAAS,EAAC;AACVkD,IAAAA,IAAI,EAAC;GAJT,CADJ,CATJ,CAbJ,EA+BK3C,MAAM,CAACsB,QAAP,CAAgBM,MA/BrB,EAgCK5B,MAAM,CAACsB,QAAP,CAAgBC,KAhCrB,CADJ,CADJ,CADJ,CADJ;AA0CH,CArFsB;;;;"}
|
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,oBAASE;AAAOE,IAAAA,SAAS,EAAEA;AAAWD,IAAAA,GAAG,EAAEA;IAA3C,EACKD,KAAK,CAACO,QADX,CADJ;AAKH,CAPqB;IAWTC,KAAK,gBAAGV,UAAA,CAAiB,SAASW,WAAT,CAAqBT,KAArB,EAA8CC,GAA9C;AAClC,MAAMS,MAAM,GAAGC,gBAAgB,EAA/B;AAEA,SAAOb,aAAA,CAACM,OAAD;AAAuBQ,IAAAA,OAAO,EAAEF,MAAM,CAACG;KAAab;AAAOC,IAAAA,GAAG,EAAEA;AAAKa,IAAAA,OAAO;IAA5E,CAAP;AACH,CAJoB;AAMrB,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I,EAAEtC,MAAM,CAACuC,SAAP,GAAsBzB,QAAQ,CAAC0B,CAA/B,UAAuCC,SAF5C;AAGDC,MAAAA,GAAG,EAAE1C,MAAM,CAACuC,SAAP,GAAsBzB,QAAQ,CAAC6B,CAA/B,UAAuCF;AAH3C;IAPT,EAaIrD,aAAA,MAAA;AAAKI,IAAAA,SAAS,EAAE+B;iBAA8B;GAA9C,EACKQ,MADL,EAEK/B,MAAM,CAACuC,SAAP,IACGnD,aAAA,MAAA,oBACQ2B;kBACQG,KAAK,CAAClB,MAAN,CAAa4C;AACzBpD,IAAAA,SAAS,EAAC;IAHd,CAHR,EASKQ,MAAM,CAAC6C,eAAP,GACGzD,aAAA,CAACM,OAAD;AAAuBQ,IAAAA,OAAO,EAAEF,MAAM,CAACG;AAASC,IAAAA,OAAO;GAAvD,EACIhB,aAAA,CAAC0D,UAAD;AACIC,IAAAA,UAAU,EAAC;kBACC7B,KAAK,CAAClB,MAAN,CAAaO;AACzBf,IAAAA,SAAS,EAAC;AACVwD,IAAAA,IAAI,EAAC;GAJT,CADJ,CADH,GASG,IAlBR,CAbJ,EAiCKhD,MAAM,CAACwB,QAAP,CAAgBQ,MAjCrB,EAkCKhC,MAAM,CAACwB,QAAP,CAAgBC,KAlCrB,CADJ,CADJ,CADJ,CADJ;AA4CH,CAnGsB;;;;"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
|
+
import cn from 'classnames';
|
2
3
|
import { motion } from 'framer-motion';
|
3
4
|
import { useCurrentDialog } from '../Context.js';
|
4
5
|
|
@@ -6,8 +7,9 @@ var Drawer = /*#__PURE__*/forwardRef(function DialogDrawer(props, ref) {
|
|
6
7
|
var _dialog$drawer, _dialog$drawer2;
|
7
8
|
|
8
9
|
var dialog = useCurrentDialog();
|
10
|
+
var className = cn('absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left', props.className);
|
9
11
|
return createElement(motion.div, Object.assign({}, props, {
|
10
|
-
className:
|
12
|
+
className: className,
|
11
13
|
"data-taco": "dialog-drawer",
|
12
14
|
"aria-hidden": !((_dialog$drawer = dialog.drawer) !== null && _dialog$drawer !== void 0 && _dialog$drawer.open),
|
13
15
|
variants: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Drawer.js","sources":["../../../../../src/components/Dialog/components/Drawer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { motion } from 'framer-motion';\nimport { useCurrentDialog } from '../Context';\n\nexport type DialogDrawerProps = Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onAnimationStart' | 'onDragStart' | 'onDragEnd' | 'onDrag'\n>;\n\nexport const Drawer = React.forwardRef(function DialogDrawer(props: DialogDrawerProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../../../../../src/components/Dialog/components/Drawer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { motion } from 'framer-motion';\nimport cn from 'classnames';\nimport { useCurrentDialog } from '../Context';\n\nexport type DialogDrawerProps = Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onAnimationStart' | 'onDragStart' | 'onDragEnd' | 'onDrag'\n>;\n\nexport const Drawer = React.forwardRef(function DialogDrawer(props: DialogDrawerProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const className = cn(\n 'absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left',\n props.className\n );\n\n return (\n <motion.div\n {...props}\n className={className}\n data-taco=\"dialog-drawer\"\n aria-hidden={!dialog.drawer?.open}\n variants={{\n visible: {\n left: '100%',\n display: 'block',\n transition: { ease: 'easeOut', duration: 0.2 },\n },\n hidden: {\n left: '0%',\n transition: { ease: 'easeOut', duration: 0.2 },\n transitionEnd: {\n display: 'none',\n },\n },\n }}\n animate={dialog.drawer?.open ? 'visible' : 'hidden'}\n ref={ref}\n />\n );\n});\n"],"names":["Drawer","React","DialogDrawer","props","ref","dialog","useCurrentDialog","className","cn","motion","div","drawer","open","variants","visible","left","display","transition","ease","duration","hidden","transitionEnd","animate"],"mappings":";;;;;IAUaA,MAAM,gBAAGC,UAAA,CAAiB,SAASC,YAAT,CAAsBC,KAAtB,EAAgDC,GAAhD;;;AACnC,MAAMC,MAAM,GAAGC,gBAAgB,EAA/B;AACA,MAAMC,SAAS,GAAGC,EAAE,CAChB,wGADgB,EAEhBL,KAAK,CAACI,SAFU,CAApB;AAKA,SACIN,aAAA,CAACQ,MAAM,CAACC,GAAR,oBACQP;AACJI,IAAAA,SAAS,EAAEA;iBACD;mBACG,oBAACF,MAAM,CAACM,MAAR,2CAAC,eAAeC,IAAhB;AACbC,IAAAA,QAAQ,EAAE;AACNC,MAAAA,OAAO,EAAE;AACLC,QAAAA,IAAI,EAAE,MADD;AAELC,QAAAA,OAAO,EAAE,OAFJ;AAGLC,QAAAA,UAAU,EAAE;AAAEC,UAAAA,IAAI,EAAE,SAAR;AAAmBC,UAAAA,QAAQ,EAAE;AAA7B;AAHP,OADH;AAMNC,MAAAA,MAAM,EAAE;AACJL,QAAAA,IAAI,EAAE,IADF;AAEJE,QAAAA,UAAU,EAAE;AAAEC,UAAAA,IAAI,EAAE,SAAR;AAAmBC,UAAAA,QAAQ,EAAE;AAA7B,SAFR;AAGJE,QAAAA,aAAa,EAAE;AACXL,UAAAA,OAAO,EAAE;AADE;AAHX;AANF;AAcVM,IAAAA,OAAO,EAAE,mBAAAjB,MAAM,CAACM,MAAP,4DAAeC,IAAf,GAAsB,SAAtB,GAAkC;AAC3CR,IAAAA,GAAG,EAAEA;IApBT,CADJ;AAwBH,CA/BqB;;;;"}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
|
+
import cn from 'classnames';
|
2
3
|
|
3
4
|
var Extra = /*#__PURE__*/forwardRef(function (props, ref) {
|
5
|
+
var className = cn('bg-grey-light yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left', props.className);
|
4
6
|
return createElement("div", Object.assign({}, props, {
|
5
|
-
className:
|
7
|
+
className: className,
|
6
8
|
"data-taco": "dialog-extra",
|
7
9
|
ref: ref
|
8
10
|
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Extra.js","sources":["../../../../../src/components/Dialog/components/Extra.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type DialogExtraProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Extra = React.forwardRef(function (props: DialogExtraProps, ref: React.Ref<HTMLDivElement>) {\n
|
1
|
+
{"version":3,"file":"Extra.js","sources":["../../../../../src/components/Dialog/components/Extra.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nexport type DialogExtraProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Extra = React.forwardRef(function (props: DialogExtraProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn(\n 'bg-grey-light yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left',\n props.className\n );\n\n return <div {...props} className={className} data-taco=\"dialog-extra\" ref={ref} />;\n});\n"],"names":["Extra","React","props","ref","className","cn"],"mappings":";;;IAKaA,KAAK,gBAAGC,UAAA,CAAiB,UAAUC,KAAV,EAAmCC,GAAnC;AAClC,MAAMC,SAAS,GAAGC,EAAE,CAChB,6GADgB,EAEhBH,KAAK,CAACE,SAFU,CAApB;AAKA,SAAOH,aAAA,MAAA,oBAASC;AAAOE,IAAAA,SAAS,EAAEA;iBAAqB;AAAeD,IAAAA,GAAG,EAAEA;IAApE,CAAP;AACH,CAPoB;;;;"}
|
@@ -1,13 +1,13 @@
|
|
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,CAAD;AAAsBU,IAAAA,OAAO;IAAtH,CADJ;AAGH,CAdc,CAAf;AAwBA,IAAMC,OAAO,gBAAGb,UAAA,CAAiB,UAACC,KAAD,EAA4BC,GAA5B;AAC7B,yBAAkBY,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBA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AuB2B,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?: React.ReactElement<DialogProps>;\n /** Set which icon should be rendered within button */\n icon: IconName; // this dynamic type causes the type extraction for props to fail\n /** Hanger component associated with the button. */\n hanger?: React.ReactElement<HangerProps>;\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?: React.ReactElement<PopoverProps>;\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":";;;;;;;
|
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?: React.ReactElement<DialogProps>;\n /** Set which icon should be rendered within button */\n icon: IconName; // this dynamic type causes the type extraction for props to fail\n /** Hanger component associated with the button. */\n hanger?: React.ReactElement<HangerProps>;\n /** Menu component associated with the button. */\n menu?: React.ReactElement<MenuProps>;\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?: React.ReactElement<PopoverProps>;\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;;;;"}
|
@@ -5,7 +5,7 @@ import { Icon } from '../Icon/Icon.js';
|
|
5
5
|
import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
|
6
6
|
import { getInputClasses, getButtonStateClasses } from './util.js';
|
7
7
|
|
8
|
-
var _excluded = ["button", "
|
8
|
+
var _excluded = ["button", "icon", "highlighted", "state", "autoFocus"];
|
9
9
|
var Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
|
10
10
|
var button = props.button,
|
11
11
|
icon = props.icon,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { State } from '../../types';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { getButtonStateClasses, getInputClasses } from './util';\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** State will change the style of the input **/\n state?: State;\n};\n\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button,
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { State } from '../../types';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { getButtonStateClasses, getInputClasses } from './util';\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** State will change the style of the input **/\n state?: State;\n};\n\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, highlighted, state, autoFocus, ...otherProps } = props;\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const hasContainer = button || icon;\n const className = cn(\n getInputClasses(props),\n 'min-h-[theme(spacing.8)] pointer-events-all',\n {\n 'pr-8': !!hasContainer,\n },\n !hasContainer && otherProps.className\n );\n\n React.useEffect(() => {\n if (autoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, []);\n\n const input = <input {...otherProps} className={className} data-taco=\"input\" ref={inputRef} />;\n\n if (hasContainer) {\n let extra: any;\n\n if (button) {\n const disabled = button.props.disabled ?? otherProps.disabled;\n const buttonClassName = cn(\n 'items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none',\n {\n [getButtonStateClasses(state)]: !props.disabled,\n },\n button.props.className\n );\n extra = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n const iconClassName = cn(\n 'items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2',\n {\n 'text-grey-dark': props.disabled,\n 'text-grey-darkest': !props.disabled,\n }\n );\n extra =\n typeof icon === 'string' ? (\n <Icon className={iconClassName} name={icon} />\n ) : (\n React.cloneElement(icon, { className: cn(iconClassName, icon.props.className) })\n );\n }\n\n const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);\n\n return (\n <div className={containerClassName} data-taco=\"input-container\">\n {input}\n {extra}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["Input","React","props","ref","button","icon","state","autoFocus","otherProps","inputRef","useProxiedRef","hasContainer","className","cn","getInputClasses","current","focus","input","extra","disabled","buttonClassName","getButtonStateClasses","iconClassName","Icon","name","containerClassName"],"mappings":";;;;;;;;IAkBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;AAClC,MAAQC,MAAR,GAAuEF,KAAvE,CAAQE,MAAR;AAAA,MAAgBC,IAAhB,GAAuEH,KAAvE,CAAgBG,IAAhB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iB,aAAa,GAAGT,EAAE,CACpB,8GADoB,EAEpB;AACI,0BAAkBX,KAAK,CAACiB,QAD5B;AAEI,6BAAqB,CAACjB,KAAK,CAACiB;AAFhC,OAFoB,CAAxB;AAOAD,MAAAA,KAAK,GACD,OAAOb,IAAP,KAAgB,QAAhB,GACIJ,aAAA,CAACsB,IAAD;AAAMX,QAAAA,SAAS,EAAEU;AAAeE,QAAAA,IAAI,EAAEnB;OAAtC,CADJ,GAGIJ,YAAA,CAAmBI,IAAnB,EAAyB;AAAEO,QAAAA,SAAS,EAAEC,EAAE,CAACS,aAAD,EAAgBjB,IAAI,CAACH,KAAL,CAAWU,SAA3B;AAAf,OAAzB,CAJR;AAMH;;AAED,QAAMa,kBAAkB,GAAGZ,EAAE,CAAC,8CAAD,EAAiDL,UAAU,CAACI,SAA5D,CAA7B;AAEA,WACIX,aAAA,MAAA;AAAKW,MAAAA,SAAS,EAAEa;mBAA8B;KAA9C,EACKR,KADL,EAEKC,KAFL,CADJ;AAMH;;AAED,SAAOD,KAAP;AACH,CAhEoB;;;;"}
|
@@ -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,3 +1,4 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { useState, useMemo, createElement } from 'react';
|
2
3
|
import { MenuContext } from './Context.js';
|
3
4
|
import { Root } from '@radix-ui/react-dropdown-menu';
|
@@ -10,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;
|