@economic/taco 1.12.0 → 1.12.2
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/Button/Button.stories.d.ts +3 -3
- package/dist/components/Button/util.d.ts +2 -1
- package/dist/components/IconButton/IconButton.d.ts +30 -1
- package/dist/components/IconButton/IconButton.stories.d.ts +2 -2
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/esm/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/esm/components/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/esm/components/AlertDialog/components/Trigger.js +8 -4
- package/dist/esm/components/AlertDialog/components/Trigger.js.map +1 -1
- package/dist/esm/components/Button/Button.js +26 -8
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Button/util.js +22 -16
- package/dist/esm/components/Button/util.js.map +1 -1
- package/dist/esm/components/Dialog/components/Trigger.js +8 -4
- package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +13 -6
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js +22 -4
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +8 -4
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/taco.cjs.development.js +105 -43
- 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 +3 -3
@@ -8,10 +8,14 @@ const PopoverContext = /*#__PURE__*/createContext({
|
|
8
8
|
props: {},
|
9
9
|
ref: null
|
10
10
|
});
|
11
|
-
const Trigger = /*#__PURE__*/forwardRef(function
|
11
|
+
const Trigger = /*#__PURE__*/forwardRef(function PopoverAnchor(props, externalRef) {
|
12
12
|
var _props$children;
|
13
13
|
|
14
|
-
const
|
14
|
+
const {
|
15
|
+
ref: parentRef,
|
16
|
+
props: parentProps
|
17
|
+
} = useContext(PopoverContext);
|
18
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
15
19
|
let children = props.children;
|
16
20
|
|
17
21
|
if ( /*#__PURE__*/isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
@@ -19,9 +23,9 @@ const Trigger = /*#__PURE__*/forwardRef(function PopoverTrigger(props, ref) {
|
|
19
23
|
children = /*#__PURE__*/createElement("span", null, props.children);
|
20
24
|
}
|
21
25
|
|
22
|
-
return /*#__PURE__*/createElement(Trigger$1, Object.assign({},
|
26
|
+
return /*#__PURE__*/createElement(Trigger$1, Object.assign({}, parentProps, props, {
|
23
27
|
children: children,
|
24
|
-
ref:
|
28
|
+
ref: refCallback,
|
25
29
|
asChild: true
|
26
30
|
}));
|
27
31
|
});
|
@@ -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<
|
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<HTMLElement>;\nconst Trigger = React.forwardRef(function PopoverAnchor(props: PopoverTriggerProps, externalRef: React.Ref<HTMLElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(PopoverContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\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 <PopoverPrimitive.Trigger {...parentProps} {...props} children={children} ref={refCallback} asChild />;\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ 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(function PopoverContent(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<HTMLElement, PopoverProps>(function Popover(props, ref) {\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","PopoverAnchor","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","type","console","warn","name","PopoverPrimitive","asChild","RenderPropWrapper","onClick","close","CustomEvent","Content","PopoverContent","className","cn","output","UnstyledContent","placement","UnstyledArrow","Close","Popover","trigger","otherProps","context","Provider","value"],"mappings":"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"}
|
package/dist/esm/index.css
CHANGED
@@ -136,7 +136,7 @@
|
|
136
136
|
input[type='search']::-webkit-search-cancel-button,
|
137
137
|
input[type='search']::-webkit-search-results-button,
|
138
138
|
input[type='search']::-webkit-search-results-decoration {
|
139
|
-
@apply cursor-pointer;
|
139
|
+
@apply block cursor-pointer;
|
140
140
|
}
|
141
141
|
|
142
142
|
table.yt-table {
|
package/dist/esm/index.js
CHANGED
@@ -8,7 +8,7 @@ export { Accordion } from './components/Accordion/Accordion.js';
|
|
8
8
|
export { VisuallyHidden } from './components/VisuallyHidden/VisuallyHidden.js';
|
9
9
|
export { Badge } from './components/Badge/Badge.js';
|
10
10
|
export { Tooltip } from './components/Tooltip/Tooltip.js';
|
11
|
-
export { IconButton } from './components/IconButton/IconButton.js';
|
11
|
+
export { Base, IconButton } from './components/IconButton/IconButton.js';
|
12
12
|
export { Banner } from './components/Banner/Banner.js';
|
13
13
|
export { Button } from './components/Button/Button.js';
|
14
14
|
export { Spinner } from './components/Spinner/Spinner.js';
|
package/dist/index.css
CHANGED
@@ -136,7 +136,7 @@
|
|
136
136
|
input[type='search']::-webkit-search-cancel-button,
|
137
137
|
input[type='search']::-webkit-search-results-button,
|
138
138
|
input[type='search']::-webkit-search-results-decoration {
|
139
|
-
@apply cursor-pointer;
|
139
|
+
@apply block cursor-pointer;
|
140
140
|
}
|
141
141
|
|
142
142
|
table.yt-table {
|
@@ -62,10 +62,14 @@ function mergeRefs(refs) {
|
|
62
62
|
};
|
63
63
|
}
|
64
64
|
|
65
|
-
const Trigger = /*#__PURE__*/React.forwardRef(function AlertDialogTrigger(props,
|
66
|
-
const
|
67
|
-
|
68
|
-
|
65
|
+
const Trigger = /*#__PURE__*/React.forwardRef(function AlertDialogTrigger(props, externalRef) {
|
66
|
+
const {
|
67
|
+
ref: parentRef,
|
68
|
+
props: parentProps
|
69
|
+
} = useCurrentAlertDialog();
|
70
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
71
|
+
return /*#__PURE__*/React.createElement(AlertDialogPrimitive.Trigger, Object.assign({}, parentProps, props, {
|
72
|
+
ref: refCallback,
|
69
73
|
asChild: true
|
70
74
|
}));
|
71
75
|
});
|
@@ -198,9 +202,9 @@ const AlertDialog = /*#__PURE__*/React.forwardRef(function AlertDialog(props, re
|
|
198
202
|
...otherProps
|
199
203
|
} = props;
|
200
204
|
const context = React.useMemo(() => ({
|
201
|
-
ref,
|
202
205
|
draggable,
|
203
206
|
props: otherProps,
|
207
|
+
ref,
|
204
208
|
size,
|
205
209
|
trigger
|
206
210
|
}), [draggable, open, otherProps]);
|
@@ -3666,28 +3670,40 @@ const getAppearanceClasses = (value, icon = false) => {
|
|
3666
3670
|
return `yt-grey-solid focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid`;
|
3667
3671
|
}
|
3668
3672
|
};
|
3669
|
-
const
|
3673
|
+
const createButtonWithTooltip = (props, className, ref) => {
|
3670
3674
|
const {
|
3671
|
-
dialog,
|
3672
|
-
hanger,
|
3673
|
-
menu,
|
3674
|
-
popover,
|
3675
3675
|
tooltip,
|
3676
|
-
...
|
3676
|
+
...buttonProps
|
3677
3677
|
} = props;
|
3678
|
-
|
3678
|
+
const button = /*#__PURE__*/React__default.createElement(Button, Object.assign({}, buttonProps, {
|
3679
3679
|
className: className,
|
3680
3680
|
ref: ref
|
3681
3681
|
}));
|
3682
3682
|
|
3683
|
+
if (tooltip) {
|
3684
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
3685
|
+
title: tooltip
|
3686
|
+
}, button);
|
3687
|
+
}
|
3688
|
+
|
3689
|
+
return button;
|
3690
|
+
};
|
3691
|
+
const createButtonWithOverlays = (props, buttonBase) => {
|
3692
|
+
const {
|
3693
|
+
dialog,
|
3694
|
+
hanger,
|
3695
|
+
menu,
|
3696
|
+
popover
|
3697
|
+
} = props;
|
3698
|
+
let button = buttonBase;
|
3699
|
+
|
3683
3700
|
if (typeof dialog === 'function') {
|
3684
3701
|
button = dialog({
|
3685
3702
|
trigger: button
|
3686
3703
|
});
|
3687
3704
|
} else if (typeof menu === 'function') {
|
3688
3705
|
button = menu({
|
3689
|
-
trigger: button
|
3690
|
-
appearance: otherProps.appearance
|
3706
|
+
trigger: button
|
3691
3707
|
});
|
3692
3708
|
} else if (typeof popover === 'function') {
|
3693
3709
|
button = popover({
|
@@ -3701,16 +3717,10 @@ const createButton = (props, className, ref) => {
|
|
3701
3717
|
});
|
3702
3718
|
}
|
3703
3719
|
|
3704
|
-
if (tooltip) {
|
3705
|
-
button = /*#__PURE__*/React__default.createElement(Tooltip, {
|
3706
|
-
title: tooltip
|
3707
|
-
}, button);
|
3708
|
-
}
|
3709
|
-
|
3710
3720
|
return button;
|
3711
3721
|
};
|
3712
3722
|
|
3713
|
-
const
|
3723
|
+
const Base = /*#__PURE__*/React.forwardRef(function IconButtonBase(props, ref) {
|
3714
3724
|
const {
|
3715
3725
|
icon,
|
3716
3726
|
rounded = false,
|
@@ -3727,7 +3737,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref)
|
|
3727
3737
|
return null;
|
3728
3738
|
}
|
3729
3739
|
|
3730
|
-
return
|
3740
|
+
return createButtonWithTooltip({ ...otherProps,
|
3731
3741
|
children: /*#__PURE__*/React.createElement(Icon, {
|
3732
3742
|
name: icon,
|
3733
3743
|
className: "m-0 p-0"
|
@@ -3735,6 +3745,24 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref)
|
|
3735
3745
|
'data-taco': 'icon-button'
|
3736
3746
|
}, className, ref);
|
3737
3747
|
});
|
3748
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3749
|
+
const {
|
3750
|
+
dialog,
|
3751
|
+
hanger,
|
3752
|
+
menu,
|
3753
|
+
popover,
|
3754
|
+
...buttonProps
|
3755
|
+
} = props;
|
3756
|
+
const button = /*#__PURE__*/React.createElement(Base, Object.assign({}, buttonProps, {
|
3757
|
+
ref: ref
|
3758
|
+
}));
|
3759
|
+
return createButtonWithOverlays({
|
3760
|
+
dialog,
|
3761
|
+
hanger,
|
3762
|
+
menu,
|
3763
|
+
popover
|
3764
|
+
}, button);
|
3765
|
+
});
|
3738
3766
|
|
3739
3767
|
const Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
3740
3768
|
const {
|
@@ -3755,7 +3783,7 @@ const Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
|
3755
3783
|
}) : null);
|
3756
3784
|
});
|
3757
3785
|
|
3758
|
-
const
|
3786
|
+
const Base$1 = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
3759
3787
|
const {
|
3760
3788
|
fluid,
|
3761
3789
|
...otherProps
|
@@ -3765,9 +3793,21 @@ const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
3765
3793
|
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
3766
3794
|
'w-full': fluid
|
3767
3795
|
}, props.className);
|
3768
|
-
|
3796
|
+
return createButtonWithTooltip({ ...otherProps,
|
3797
|
+
'data-taco': 'button'
|
3798
|
+
}, className, ref);
|
3799
|
+
});
|
3800
|
+
const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3801
|
+
const {
|
3802
|
+
dialog,
|
3803
|
+
hanger,
|
3804
|
+
menu,
|
3805
|
+
popover,
|
3806
|
+
...buttonProps
|
3807
|
+
} = props;
|
3808
|
+
let children = buttonProps.children; // add a chevron icon to menu buttons
|
3769
3809
|
|
3770
|
-
if (typeof
|
3810
|
+
if (typeof menu === 'function') {
|
3771
3811
|
children = Array.isArray(children) ? [...children, /*#__PURE__*/React.createElement(Icon, {
|
3772
3812
|
key: "chevron-down",
|
3773
3813
|
name: "chevron-down"
|
@@ -3777,10 +3817,16 @@ const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
3777
3817
|
})];
|
3778
3818
|
}
|
3779
3819
|
|
3780
|
-
|
3781
|
-
children,
|
3782
|
-
|
3783
|
-
}
|
3820
|
+
const button = /*#__PURE__*/React.createElement(Base$1, Object.assign({}, buttonProps, {
|
3821
|
+
children: children,
|
3822
|
+
ref: ref
|
3823
|
+
}));
|
3824
|
+
return createButtonWithOverlays({
|
3825
|
+
dialog,
|
3826
|
+
hanger,
|
3827
|
+
menu,
|
3828
|
+
popover
|
3829
|
+
}, button);
|
3784
3830
|
});
|
3785
3831
|
|
3786
3832
|
function useTimer(duration = 0, callback) {
|
@@ -5555,10 +5601,14 @@ const PopoverContext = /*#__PURE__*/React.createContext({
|
|
5555
5601
|
props: {},
|
5556
5602
|
ref: null
|
5557
5603
|
});
|
5558
|
-
const Trigger$2 = /*#__PURE__*/React.forwardRef(function
|
5604
|
+
const Trigger$2 = /*#__PURE__*/React.forwardRef(function PopoverAnchor(props, externalRef) {
|
5559
5605
|
var _props$children;
|
5560
5606
|
|
5561
|
-
const
|
5607
|
+
const {
|
5608
|
+
ref: parentRef,
|
5609
|
+
props: parentProps
|
5610
|
+
} = React.useContext(PopoverContext);
|
5611
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
5562
5612
|
let children = props.children;
|
5563
5613
|
|
5564
5614
|
if ( /*#__PURE__*/React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
@@ -5566,9 +5616,9 @@ const Trigger$2 = /*#__PURE__*/React.forwardRef(function PopoverTrigger(props, r
|
|
5566
5616
|
children = /*#__PURE__*/React.createElement("span", null, props.children);
|
5567
5617
|
}
|
5568
5618
|
|
5569
|
-
return /*#__PURE__*/React.createElement(PopoverPrimitive.Trigger, Object.assign({},
|
5619
|
+
return /*#__PURE__*/React.createElement(PopoverPrimitive.Trigger, Object.assign({}, parentProps, props, {
|
5570
5620
|
children: children,
|
5571
|
-
ref:
|
5621
|
+
ref: refCallback,
|
5572
5622
|
asChild: true
|
5573
5623
|
}));
|
5574
5624
|
});
|
@@ -5709,10 +5759,14 @@ const useCurrentDialog = () => {
|
|
5709
5759
|
return React.useContext(DialogContext);
|
5710
5760
|
};
|
5711
5761
|
|
5712
|
-
const Trigger$3 = /*#__PURE__*/React.forwardRef(function DialogTrigger(props,
|
5713
|
-
const
|
5714
|
-
|
5715
|
-
|
5762
|
+
const Trigger$3 = /*#__PURE__*/React.forwardRef(function DialogTrigger(props, externalRef) {
|
5763
|
+
const {
|
5764
|
+
ref: parentRef,
|
5765
|
+
props: parentProps
|
5766
|
+
} = useCurrentDialog();
|
5767
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
5768
|
+
return /*#__PURE__*/React.createElement(DialogPrimitive.Trigger, Object.assign({}, parentProps, props, {
|
5769
|
+
ref: refCallback,
|
5716
5770
|
asChild: true
|
5717
5771
|
}));
|
5718
5772
|
});
|
@@ -6016,13 +6070,18 @@ const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
|
6016
6070
|
});
|
6017
6071
|
|
6018
6072
|
const HangerContext = /*#__PURE__*/React.createContext({
|
6073
|
+
onClose: undefined,
|
6019
6074
|
props: {},
|
6020
6075
|
ref: null
|
6021
6076
|
});
|
6022
|
-
const Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props,
|
6077
|
+
const Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, externalRef) {
|
6023
6078
|
var _props$children;
|
6024
6079
|
|
6025
|
-
const
|
6080
|
+
const {
|
6081
|
+
ref: parentRef,
|
6082
|
+
props: parentProps
|
6083
|
+
} = React.useContext(HangerContext);
|
6084
|
+
const refCallback = mergeRefs([parentRef, externalRef]);
|
6026
6085
|
let children = props.children;
|
6027
6086
|
|
6028
6087
|
if ( /*#__PURE__*/React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
@@ -6030,9 +6089,9 @@ const Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
|
|
6030
6089
|
children = /*#__PURE__*/React.createElement("span", null, props.children);
|
6031
6090
|
}
|
6032
6091
|
|
6033
|
-
return /*#__PURE__*/React.createElement(PopoverPrimitive.Anchor, Object.assign({},
|
6092
|
+
return /*#__PURE__*/React.createElement(PopoverPrimitive.Anchor, Object.assign({}, parentProps, props, {
|
6034
6093
|
children: children,
|
6035
|
-
ref:
|
6094
|
+
ref: refCallback,
|
6036
6095
|
asChild: true
|
6037
6096
|
}));
|
6038
6097
|
});
|
@@ -6069,7 +6128,7 @@ const Content$5 = /*#__PURE__*/React.forwardRef(function HangerContent(props, re
|
|
6069
6128
|
"aria-label": texts.hanger.close,
|
6070
6129
|
className: "absolute top-0 right-0 ml-2 mr-2 mt-2 text-white",
|
6071
6130
|
icon: "close",
|
6072
|
-
onClick: context.
|
6131
|
+
onClick: context.onClose
|
6073
6132
|
})));
|
6074
6133
|
});
|
6075
6134
|
const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
@@ -6077,12 +6136,14 @@ const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
|
6077
6136
|
anchor,
|
6078
6137
|
children,
|
6079
6138
|
defaultOpen = true,
|
6139
|
+
onClose,
|
6080
6140
|
...otherProps
|
6081
6141
|
} = props;
|
6082
6142
|
const context = React.useMemo(() => ({
|
6143
|
+
onClose,
|
6083
6144
|
props: otherProps,
|
6084
6145
|
ref
|
6085
|
-
}), [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
6146
|
+
}), [onClose, otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
|
6086
6147
|
|
6087
6148
|
const [open, setOpen] = React.useState(false);
|
6088
6149
|
React.useEffect(() => {
|
@@ -9691,6 +9752,7 @@ exports.AlertDialog = AlertDialog;
|
|
9691
9752
|
exports.Backdrop = Backdrop;
|
9692
9753
|
exports.Badge = Badge;
|
9693
9754
|
exports.Banner = Banner;
|
9755
|
+
exports.Base = Base;
|
9694
9756
|
exports.Button = Button$1;
|
9695
9757
|
exports.Calendar = Calendar$1;
|
9696
9758
|
exports.Card = Card;
|