@economic/taco 0.0.9-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 +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/Menu/Menu.d.ts +3 -1
- 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 -12
- 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/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 +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 +2556 -2526
- 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 +777 -558
@@ -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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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,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,IAlBR,CAbJ,EAiCKhD,MAAM,CAACwB,QAAP,CAAgBQ,MAjCrB,EAkCKhC,MAAM,CAACwB,QAAP,CAAgBC,KAlCrB,CADJ,CADJ,CADJ,CADJ;AA4CH,CAnGsB;;;;"}
|
@@ -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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,KAA5C,CAAgBI,QAAhB;AAAA,MAA6B6B,UAA7B,iCAA4CjC,KAA5C;;AACA,MAAMG,OAAO,GAAGJ,OAAA,CAAc;AAAA,WAAO;AAAEC,MAAAA,KAAK,EAAEiC,UAAT;AAAqBhC,MAAAA,GAAG,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;;;;"}
|
@@ -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,CAACC,aAAD;AAChB,MAAQC,QA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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,8 +2,8 @@ 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
8
|
var _excluded = ["icon", "shortcut"];
|
9
9
|
var Icon = function Icon(_ref) {
|
@@ -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);
|
@@ -1,8 +1,8 @@
|
|
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
4
|
import { IconButton } from '../IconButton/IconButton.js';
|
5
|
+
import { useLocalization } from '../Provider/Provider.js';
|
6
6
|
import { Group } from '../Group/Group.js';
|
7
7
|
import { PageNumbers } from './PageNumbers.js';
|
8
8
|
import { Select } from '../Select/Select.js';
|
@@ -5,7 +5,7 @@ import { Root, Trigger as Trigger$1, Close as Close$1 } from '@radix-ui/react-po
|
|
5
5
|
import { UnstyledContent, UnstyledArrow } from './Primitives.js';
|
6
6
|
import mergeRefs from '../../utils/mergeRefs.js';
|
7
7
|
|
8
|
-
var _excluded = ["children"];
|
8
|
+
var _excluded = ["children", "trigger"];
|
9
9
|
var PopoverContext = /*#__PURE__*/createContext({
|
10
10
|
props: {},
|
11
11
|
ref: null
|
@@ -68,6 +68,7 @@ var Close = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
68
68
|
});
|
69
69
|
var Popover = /*#__PURE__*/forwardRef(function (props, ref) {
|
70
70
|
var children = props.children,
|
71
|
+
trigger = props.trigger,
|
71
72
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
72
73
|
|
73
74
|
var context = useMemo(function () {
|
@@ -78,9 +79,7 @@ var Popover = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
78
79
|
}, [otherProps]);
|
79
80
|
return createElement(PopoverContext.Provider, {
|
80
81
|
value: context
|
81
|
-
}, createElement(Root,
|
82
|
-
children: children
|
83
|
-
}));
|
82
|
+
}, createElement(Root, null, trigger && createElement(Trigger, null, trigger), children));
|
84
83
|
});
|
85
84
|
Popover.Trigger = Trigger;
|
86
85
|
Popover.Content = Content;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from './Primitives';\nimport mergeRefs from '../../utils/mergeRefs';\n\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\n\nconst PopoverContext = React.createContext<PopoverContextValue>({\n props: {},\n ref: null,\n});\n\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Trigger = React.forwardRef((props: PopoverTriggerProps, ref: React.Ref<HTMLButtonElement>) => {\n const context = React.useContext(PopoverContext);\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Popover.Trigger 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.Trigger {...context.props} {...props} children={children} ref={mergeRefs([context.ref, ref])} asChild />\n );\n});\nconst RenderPropWrapper = React.forwardRef(({ children, onClick }: any, ref) => {\n const close = () => {\n onClick(new CustomEvent('hide'));\n };\n\n return children({ close, ref });\n});\n\nexport type PopoverContentRenderProps = { close: () => void };\nexport type PopoverContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef((props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) => {\n const className = cn('bg-white focus:border-blue-light', props.className);\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <PopoverPrimitive.Close asChild>\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\n </PopoverPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <UnstyledContent className={className} placement={props.placement} ref={ref}>\n {output}\n <UnstyledArrow className=\"text-white\" />\n </UnstyledContent>\n );\n});\n\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Close = React.forwardRef(\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\n )\n);\n\nexport type PopoverProps = React.PropsWithChildren<{}>;\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\n};\n\nexport const Popover = React.forwardRef((props: PopoverProps, ref: React.Ref<HTMLElement>): JSX.Element => {\n const { children, ...otherProps } = props;\n
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../..';\nimport { UnstyledArrow, UnstyledContent } from './Primitives';\nimport mergeRefs from '../../utils/mergeRefs';\n\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\n\nconst PopoverContext = React.createContext<PopoverContextValue>({\n props: {},\n ref: null,\n});\n\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Trigger = React.forwardRef((props: PopoverTriggerProps, ref: React.Ref<HTMLButtonElement>) => {\n const context = React.useContext(PopoverContext);\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Popover.Trigger 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.Trigger {...context.props} {...props} children={children} ref={mergeRefs([context.ref, ref])} asChild />\n );\n});\n\nconst RenderPropWrapper = React.forwardRef(({ children, onClick }: any, ref) => {\n const close = () => {\n onClick(new CustomEvent('hide'));\n };\n\n return children({ close, ref });\n});\n\nexport type PopoverContentRenderProps = { close: () => void };\nexport type PopoverContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef((props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) => {\n const className = cn('bg-white focus:border-blue-light', props.className);\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <PopoverPrimitive.Close asChild>\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\n </PopoverPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <UnstyledContent className={className} placement={props.placement} ref={ref}>\n {output}\n <UnstyledArrow className=\"text-white\" />\n </UnstyledContent>\n );\n});\n\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Close = React.forwardRef(\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\n )\n);\n\nexport type PopoverProps = React.PropsWithChildren<{\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n}>;\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\n};\n\nexport const Popover = React.forwardRef((props: PopoverProps, ref: React.Ref<HTMLElement>): JSX.Element => {\n const { children, trigger, ...otherProps } = props;\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\n\n return (\n <PopoverContext.Provider value={context}>\n <PopoverPrimitive.Root>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </PopoverPrimitive.Root>\n </PopoverContext.Provider>\n );\n}) as ForwardedPopoverWithStatics;\nPopover.Trigger = Trigger;\nPopover.Content = Content;\nPopover.Close = Close;\n"],"names":["PopoverContext","React","props","ref","Trigger","context","children","type","console","warn","name","PopoverPrimitive","mergeRefs","asChild","RenderPropWrapper","onClick","close","CustomEvent","Content","className","cn","output","UnstyledContent","placement","UnstyledArrow","Close","Popover","trigger","otherProps","Provider","value"],"mappings":";;;;;;;;AASA,IAAMA,cAAc,gBAAGC,aAAA,CAAyC;AAC5DC,EAAAA,KAAK,EAAE,EADqD;AAE5DC,EAAAA,GAAG,EAAE;AAFuD,CAAzC,CAAvB;AAMA,IAAMC,OAAO,gBAAGH,UAAA,CAAiB,UAACC,KAAD,EAA6BC,GAA7B;;;AAC7B,MAAME,OAAO,GAAGJ,UAAA,CAAiBD,cAAjB,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,uHACwHP,KAAK,CAACI,QAAN,CAAeC,IAAf,CAAoBG,IAD5I,mDAC8LR,KAAK,CAACI,QAAN,CAAeC,IAAf,CAAoBG,IADlN;AAGAJ,IAAAA,QAAQ,GAAGL,aAAA,OAAA,MAAA,EAAOC,KAAK,CAACI,QAAb,CAAX;AACH;;AAED,SACIL,aAAA,CAACU,SAAD,oBAA8BN,OAAO,CAACH,OAAWA;AAAOI,IAAAA,QAAQ,EAAEA;AAAUH,IAAAA,GAAG,EAAES,SAAS,CAAC,CAACP,OAAO,CAACF,GAAT,EAAcA,GAAd,CAAD;AAAsBU,IAAAA,OAAO;IAAvH,CADJ;AAGH,CAde,CAAhB;AAgBA,IAAMC,iBAAiB,gBAAGb,UAAA,CAAiB,gBAA6BE,GAA7B;MAAGG,gBAAAA;MAAUS,eAAAA;;A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AA,MAAkBqB,OAAlB,GAA6CzB,KAA7C,CAAkByB,OAAlB;AAAA,MAA8BC,UAA9B,iCAA6C1B,KAA7C;;AACA,MAAMG,OAAO,GAAGJ,OAAA,CAAc;AAAA,WAAO;AAAEC,MAAAA,KAAK,EAAE0B,UAAT;AAAqBzB,MAAAA,GAAG,EAAHA;AAArB,KAAP;AAAA,GAAd,EAAkD,CAACyB,UAAD,CAAlD,CAAhB;AAEA,SACI3B,aAAA,CAACD,cAAc,CAAC6B,QAAhB;AAAyBC,IAAAA,KAAK,EAAEzB;GAAhC,EACIJ,aAAA,CAACU,IAAD,MAAA,EACKgB,OAAO,IAAI1B,aAAA,CAACG,OAAD,MAAA,EAAUuB,OAAV,CADhB,EAEKrB,QAFL,CADJ,CADJ;AAQH,CAZsB;AAavBoB,OAAO,CAACtB,OAAR,GAAkBA,OAAlB;AACAsB,OAAO,CAACR,OAAR,GAAkBA,OAAlB;AACAQ,OAAO,CAACD,KAAR,GAAgBA,KAAhB;;;;"}
|
@@ -7,17 +7,12 @@ import '../Backdrop/Backdrop.js';
|
|
7
7
|
import '../VisuallyHidden/VisuallyHidden.js';
|
8
8
|
import '../Badge/Badge.js';
|
9
9
|
import '../Tooltip/Tooltip.js';
|
10
|
-
import '../Spinner/Spinner.js';
|
11
|
-
import '../Toast/Toaster.js';
|
12
|
-
import { useLocalization } from '../Provider/Provider.js';
|
13
|
-
import '../Hanger/Hanger.js';
|
14
|
-
import '../RadioGroup/RadioGroup.js';
|
15
|
-
import '../Menu/Menu.js';
|
16
|
-
import '../Dialog/Dialog.js';
|
17
|
-
import '../Popover/Popover.js';
|
18
10
|
import { IconButton } from '../IconButton/IconButton.js';
|
19
11
|
import '../Banner/Banner.js';
|
20
12
|
import '../Button/Button.js';
|
13
|
+
import '../Spinner/Spinner.js';
|
14
|
+
import '../Toast/Toaster.js';
|
15
|
+
import { useLocalization } from '../Provider/Provider.js';
|
21
16
|
import '../Calendar/Calendar.js';
|
22
17
|
import '../Checkbox/Checkbox.js';
|
23
18
|
import { Input } from '../Input/Input.js';
|
@@ -26,11 +21,16 @@ import '../../utils/hooks/useListKeyboardNavigation.js';
|
|
26
21
|
import '../../utils/hooks/useListScrollTo.js';
|
27
22
|
import '../Combobox/Combobox.js';
|
28
23
|
import '../../utils/date.js';
|
24
|
+
import '../Popover/Popover.js';
|
29
25
|
import '../Datepicker/Datepicker.js';
|
26
|
+
import '../Dialog/Dialog.js';
|
30
27
|
import '../Form/Form.js';
|
31
28
|
import '../Group/Group.js';
|
29
|
+
import '../Hanger/Hanger.js';
|
32
30
|
import '../Label/Label.js';
|
33
31
|
import '../Listbox/Listbox.js';
|
32
|
+
import '../RadioGroup/RadioGroup.js';
|
33
|
+
import '../Menu/Menu.js';
|
34
34
|
import '../Treeview/Treeview.js';
|
35
35
|
import '../Navigation/Navigation.js';
|
36
36
|
import '../Select/Select.js';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import { Menu } from '../../../Menu/Menu.js';
|
3
2
|
import { IconButton } from '../../../IconButton/IconButton.js';
|
4
3
|
import keycode from 'keycode';
|
4
|
+
import { Menu } from '../../../Menu/Menu.js';
|
5
5
|
import { sanitizeRowProps } from '../../util.js';
|
6
6
|
import { InView } from 'react-intersection-observer';
|
7
7
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React__default from 'react';
|
3
3
|
import cn from 'classnames';
|
4
|
+
import { IconButton } from '../IconButton/IconButton.js';
|
4
5
|
import { useAnimation, motion } from 'framer-motion';
|
5
6
|
import useTimer from '../../utils/hooks/useTimer.js';
|
6
7
|
import { getBadgeIcon } from './util.js';
|
7
8
|
import { useLocalization } from '../Provider/Provider.js';
|
8
|
-
import { IconButton } from '../IconButton/IconButton.js';
|
9
9
|
|
10
10
|
var _excluded = ["content", "lastUpdated", "onClose", "options"];
|
11
11
|
var Toast = function Toast(_ref) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import { useMemo, Children, useCallback, createElement, useRef, useEffect } from 'react';
|
3
|
-
import { useLocalization } from '../Provider/Provider.js';
|
4
3
|
import { IconButton } from '../IconButton/IconButton.js';
|
5
4
|
import { Button } from '../Button/Button.js';
|
5
|
+
import { useLocalization } from '../Provider/Provider.js';
|
6
6
|
import keycode from 'keycode';
|
7
7
|
import { Group } from '../Group/Group.js';
|
8
8
|
import Joyride, { ACTIONS, LIFECYCLE, EVENTS } from 'react-joyride';
|
package/dist/esm/index.css
CHANGED
@@ -155,6 +155,14 @@
|
|
155
155
|
@apply max-h-full p-0;
|
156
156
|
}
|
157
157
|
|
158
|
+
[data-taco='button'] > [data-taco='icon'] {
|
159
|
+
@apply pointer-events-none -ml-2 mr-1 -mt-2 -mb-2 inline p-px;
|
160
|
+
}
|
161
|
+
|
162
|
+
[data-taco='button'] > span + [data-taco='icon'] {
|
163
|
+
@apply ml-1 -mr-2;
|
164
|
+
}
|
165
|
+
|
158
166
|
[data-taco='spinner'] svg circle {
|
159
167
|
@apply flex;
|
160
168
|
fill: transparent;
|
@@ -226,43 +234,6 @@
|
|
226
234
|
@apply -mt-px py-0 px-2;
|
227
235
|
}
|
228
236
|
|
229
|
-
[data-taco='hanger'] a {
|
230
|
-
@apply text-grey underline;
|
231
|
-
}
|
232
|
-
|
233
|
-
[data-taco='hanger'] > *:last-child {
|
234
|
-
@apply mb-0;
|
235
|
-
}
|
236
|
-
|
237
|
-
.yt-dialog__drag::before,
|
238
|
-
.yt-dialog__drag::after {
|
239
|
-
@apply bg-grey-dark absolute rounded;
|
240
|
-
content: '';
|
241
|
-
left: theme('spacing.1');
|
242
|
-
height: 2px;
|
243
|
-
width: calc(100% - (2 * theme('spacing.1')));
|
244
|
-
}
|
245
|
-
|
246
|
-
.yt-dialog__drag::before {
|
247
|
-
top: 3px;
|
248
|
-
}
|
249
|
-
|
250
|
-
.yt-dialog__drag::after {
|
251
|
-
bottom: 3px;
|
252
|
-
}
|
253
|
-
|
254
|
-
[data-taco='dialog'] *:last-child {
|
255
|
-
@apply mb-0;
|
256
|
-
}
|
257
|
-
|
258
|
-
[data-taco='button'] > [data-taco='icon'] {
|
259
|
-
@apply pointer-events-none -ml-2 mr-1 -mt-2 -mb-2 inline p-px;
|
260
|
-
}
|
261
|
-
|
262
|
-
[data-taco='button'] > span + [data-taco='icon'] {
|
263
|
-
@apply ml-1 -mr-2;
|
264
|
-
}
|
265
|
-
|
266
237
|
[data-taco='calendar'] .DayPicker-wrapper {
|
267
238
|
@apply relative select-none flex-row;
|
268
239
|
}
|
@@ -405,6 +376,27 @@
|
|
405
376
|
@apply border-blue;
|
406
377
|
}
|
407
378
|
|
379
|
+
.yt-dialog__drag::before,
|
380
|
+
.yt-dialog__drag::after {
|
381
|
+
@apply bg-grey-dark absolute rounded;
|
382
|
+
content: '';
|
383
|
+
left: theme('spacing.1');
|
384
|
+
height: 2px;
|
385
|
+
width: calc(100% - (2 * theme('spacing.1')));
|
386
|
+
}
|
387
|
+
|
388
|
+
.yt-dialog__drag::before {
|
389
|
+
top: 3px;
|
390
|
+
}
|
391
|
+
|
392
|
+
.yt-dialog__drag::after {
|
393
|
+
bottom: 3px;
|
394
|
+
}
|
395
|
+
|
396
|
+
[data-taco='dialog'] *:last-child {
|
397
|
+
@apply mb-0;
|
398
|
+
}
|
399
|
+
|
408
400
|
.yt-form > [data-taco='button'] {
|
409
401
|
@apply mr-3;
|
410
402
|
}
|
@@ -429,6 +421,14 @@
|
|
429
421
|
@apply ml-2;
|
430
422
|
}
|
431
423
|
|
424
|
+
[data-taco='hanger'] a {
|
425
|
+
@apply text-grey underline;
|
426
|
+
}
|
427
|
+
|
428
|
+
[data-taco='hanger'] > *:last-child {
|
429
|
+
@apply mb-0;
|
430
|
+
}
|
431
|
+
|
432
432
|
/* label inside label is invalid html, but the client is littered with it */
|
433
433
|
[data-taco='label'] [data-taco='label'] {
|
434
434
|
min-height: 0;
|