@economic/taco 0.0.16-alpha.0 → 0.0.17-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/esm/components/Menu/components/Link.js +12 -2
- package/dist/esm/components/Menu/components/Link.js.map +1 -1
- package/dist/taco.cjs.development.js +11 -2
- 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
@@ -1,23 +1,33 @@
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import { forwardRef, createElement } from 'react';
|
3
|
+
import { useCurrentMenu } from '../Context.js';
|
3
4
|
import { Item } from '@radix-ui/react-dropdown-menu';
|
4
5
|
import { useItemStyling, Icon } from './Item.js';
|
5
6
|
|
6
|
-
var _excluded = ["href", "icon"];
|
7
|
+
var _excluded = ["href", "icon", "onClick"];
|
7
8
|
var Link = /*#__PURE__*/forwardRef(function MenuLink(props, ref) {
|
8
9
|
var href = props.href,
|
9
10
|
icon = props.icon,
|
11
|
+
onClick = props.onClick,
|
10
12
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
11
13
|
|
14
|
+
var menu = useCurrentMenu();
|
12
15
|
var className = useItemStyling({
|
13
16
|
disabled: props.disabled,
|
14
17
|
indented: !!icon,
|
15
18
|
className: props.className
|
16
19
|
});
|
20
|
+
|
21
|
+
var handleClick = function handleClick(event) {
|
22
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
23
|
+
menu === null || menu === void 0 ? void 0 : menu.close();
|
24
|
+
};
|
25
|
+
|
17
26
|
return createElement(Item, Object.assign({}, otherProps, {
|
18
27
|
asChild: true,
|
19
28
|
className: className,
|
20
|
-
ref: ref
|
29
|
+
ref: ref,
|
30
|
+
onClick: handleClick
|
21
31
|
}), createElement("a", {
|
22
32
|
href: href,
|
23
33
|
target: "_blank"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Link.js","sources":["../../../../../src/components/Menu/components/Link.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon, useItemStyling } from './Item';\n\nexport type MenuLinkItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n disabled?: boolean;\n icon?: IconName;\n href: string;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n};\n\nexport const Link = React.forwardRef(function MenuLink(props: MenuLinkItemProps, ref: React.Ref<HTMLDivElement>) {\n const { href, icon, ...otherProps } = props;\n\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n return (\n <DropdownMenuPrimitive.Item {...otherProps} asChild className={className} ref={ref}>\n <a href={href} target=\"_blank\">\n {icon && <Icon name={icon} />}\n {props.children}\n </a>\n </DropdownMenuPrimitive.Item>\n );\n});\n"],"names":["Link","React","MenuLink","props","ref","href","icon","otherProps","className","useItemStyling","disabled","indented","DropdownMenuPrimitive","asChild","target","Icon","name","children"],"mappings":"
|
1
|
+
{"version":3,"file":"Link.js","sources":["../../../../../src/components/Menu/components/Link.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon, useItemStyling } from './Item';\nimport { useCurrentMenu } from '../Context';\n\nexport type MenuLinkItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n disabled?: boolean;\n icon?: IconName;\n href: string;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n};\n\nexport const Link = React.forwardRef(function MenuLink(props: MenuLinkItemProps, ref: React.Ref<HTMLDivElement>) {\n const { href, icon, onClick, ...otherProps } = props;\n const menu = useCurrentMenu();\n\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const handleClick: React.MouseEventHandler<HTMLDivElement> = event => {\n onClick?.(event);\n menu?.close();\n };\n\n return (\n <DropdownMenuPrimitive.Item {...otherProps} asChild className={className} ref={ref} onClick={handleClick}>\n <a href={href} target=\"_blank\">\n {icon && <Icon name={icon} />}\n {props.children}\n </a>\n </DropdownMenuPrimitive.Item>\n );\n});\n"],"names":["Link","React","MenuLink","props","ref","href","icon","onClick","otherProps","menu","useCurrentMenu","className","useItemStyling","disabled","indented","handleClick","event","close","DropdownMenuPrimitive","asChild","target","Icon","name","children"],"mappings":";;;;;;;IAaaA,IAAI,gBAAGC,UAAA,CAAiB,SAASC,QAAT,CAAkBC,KAAlB,EAA4CC,GAA5C;AACjC,MAAQC,IAAR,GAA+CF,KAA/C,CAAQE,IAAR;AAAA,MAAcC,IAAd,GAA+CH,KAA/C,CAAcG,IAAd;AAAA,MAAoBC,OAApB,GAA+CJ,KAA/C,CAAoBI,OAApB;AAAA,MAAgCC,UAAhC,iCAA+CL,KAA/C;;AACA,MAAMM,IAAI,GAAGC,cAAc,EAA3B;AAEA,MAAMC,SAAS,GAAGC,cAAc,CAAC;AAC7BC,IAAAA,QAAQ,EAAEV,KAAK,CAACU,QADa;AAE7BC,IAAAA,QAAQ,EAAE,CAAC,CAACR,IAFiB;AAG7BK,IAAAA,SAAS,EAAER,KAAK,CAACQ;AAHY,GAAD,CAAhC;;AAMA,MAAMI,WAAW,GAA4C,SAAvDA,WAAuD,CAAAC,KAAK;AAC9DT,IAAAA,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGS,KAAH,CAAP;AACAP,IAAAA,IAAI,SAAJ,IAAAA,IAAI,WAAJ,YAAAA,IAAI,CAAEQ,KAAN;AACH,GAHD;;AAKA,SACIhB,aAAA,CAACiB,IAAD,oBAAgCV;AAAYW,IAAAA,OAAO;AAACR,IAAAA,SAAS,EAAEA;AAAWP,IAAAA,GAAG,EAAEA;AAAKG,IAAAA,OAAO,EAAEQ;IAA7F,EACId,aAAA,IAAA;AAAGI,IAAAA,IAAI,EAAEA;AAAMe,IAAAA,MAAM,EAAC;GAAtB,EACKd,IAAI,IAAIL,aAAA,CAACoB,IAAD;AAAMC,IAAAA,IAAI,EAAEhB;GAAZ,CADb,EAEKH,KAAK,CAACoB,QAFX,CADJ,CADJ;AAQH,CAvBmB;;;;"}
|
@@ -6657,21 +6657,30 @@ var Item$1 = /*#__PURE__*/React.forwardRef(function MenuItem(props, ref) {
|
|
6657
6657
|
return button;
|
6658
6658
|
});
|
6659
6659
|
|
6660
|
-
var _excluded$x = ["href", "icon"];
|
6660
|
+
var _excluded$x = ["href", "icon", "onClick"];
|
6661
6661
|
var Link = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
|
6662
6662
|
var href = props.href,
|
6663
6663
|
icon = props.icon,
|
6664
|
+
onClick = props.onClick,
|
6664
6665
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$x);
|
6665
6666
|
|
6667
|
+
var menu = useCurrentMenu();
|
6666
6668
|
var className = useItemStyling({
|
6667
6669
|
disabled: props.disabled,
|
6668
6670
|
indented: !!icon,
|
6669
6671
|
className: props.className
|
6670
6672
|
});
|
6673
|
+
|
6674
|
+
var handleClick = function handleClick(event) {
|
6675
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
6676
|
+
menu === null || menu === void 0 ? void 0 : menu.close();
|
6677
|
+
};
|
6678
|
+
|
6671
6679
|
return React.createElement(DropdownMenuPrimitive.Item, Object.assign({}, otherProps, {
|
6672
6680
|
asChild: true,
|
6673
6681
|
className: className,
|
6674
|
-
ref: ref
|
6682
|
+
ref: ref,
|
6683
|
+
onClick: handleClick
|
6675
6684
|
}), React.createElement("a", {
|
6676
6685
|
href: href,
|
6677
6686
|
target: "_blank"
|