@dktunited-techoff/techoff-suite-ui 1.13.1 → 1.13.3
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/esm/components/TsMenuButton/TsMenuButton.js +7 -1
- package/esm/components/TsMenuButton/TsMenuButton.js.map +1 -1
- package/esm/components/TsMenuButton/TsMenuButton.types.d.ts +2 -2
- package/lib/components/TsMenuButton/TsMenuButton.js +7 -1
- package/lib/components/TsMenuButton/TsMenuButton.js.map +1 -1
- package/lib/components/TsMenuButton/TsMenuButton.types.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/TsMenuButton/TsMenuButton.tsx +9 -2
- package/src/components/TsMenuButton/TsMenuButton.types.ts +2 -2
|
@@ -19,10 +19,16 @@ export const TsMenuItem = ({ icon, label, onClick }) => {
|
|
|
19
19
|
export const TsMenuButton = ({ menuAlignment = 'bottom-start', mainButton, items }) => {
|
|
20
20
|
const [showMenu, setShowMenu] = useState(false);
|
|
21
21
|
const dropdownRef = useClickOutside(() => setShowMenu(false));
|
|
22
|
+
// ########
|
|
23
|
+
// Hanlders
|
|
24
|
+
const handleShowMenu = (e) => {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
setShowMenu(true);
|
|
27
|
+
};
|
|
22
28
|
// #########
|
|
23
29
|
// Rendering
|
|
24
30
|
return (React.createElement("div", { className: "ts-menu-button", ref: dropdownRef },
|
|
25
|
-
React.cloneElement(mainButton, { onClick:
|
|
31
|
+
React.cloneElement(mainButton, { onClick: handleShowMenu }),
|
|
26
32
|
showMenu && React.createElement("div", { className: `ts-menu-button-menu ts-menu-button-menu--${menuAlignment}` }, items)));
|
|
27
33
|
};
|
|
28
34
|
//# sourceMappingURL=TsMenuButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsMenuButton.js","sourceRoot":"","sources":["../../../src/components/TsMenuButton/TsMenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,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CAAC,CAAgC,EAAE,EAAE;QAC1D,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAC,gBAAgB,EAAC,GAAG,EAAE,WAAW;QAC7C,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QAC3D,QAAQ,IAAI,6BAAK,SAAS,EAAE,4CAA4C,aAAa,EAAE,IAAG,KAAK,CAAO,CACnG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, ReactElement } from 'react';
|
|
1
|
+
import { ButtonHTMLAttributes, ReactElement, MouseEvent } from 'react';
|
|
2
2
|
export type TsMenuItemProps = {
|
|
3
3
|
label: string;
|
|
4
4
|
icon?: string;
|
|
5
|
-
onClick: () => void;
|
|
5
|
+
onClick: (e: MouseEvent<HTMLElement>) => void;
|
|
6
6
|
};
|
|
7
7
|
export type TsMenuButtonProps = {
|
|
8
8
|
menuAlignment?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
|
|
@@ -24,10 +24,16 @@ exports.TsMenuItem = TsMenuItem;
|
|
|
24
24
|
const TsMenuButton = ({ menuAlignment = 'bottom-start', mainButton, items }) => {
|
|
25
25
|
const [showMenu, setShowMenu] = (0, react_1.useState)(false);
|
|
26
26
|
const dropdownRef = (0, use_click_outside_1.useClickOutside)(() => setShowMenu(false));
|
|
27
|
+
// ########
|
|
28
|
+
// Hanlders
|
|
29
|
+
const handleShowMenu = (e) => {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
setShowMenu(true);
|
|
32
|
+
};
|
|
27
33
|
// #########
|
|
28
34
|
// Rendering
|
|
29
35
|
return (React.createElement("div", { className: "ts-menu-button", ref: dropdownRef },
|
|
30
|
-
React.cloneElement(mainButton, { onClick:
|
|
36
|
+
React.cloneElement(mainButton, { onClick: handleShowMenu }),
|
|
31
37
|
showMenu && React.createElement("div", { className: `ts-menu-button-menu ts-menu-button-menu--${menuAlignment}` }, items)));
|
|
32
38
|
};
|
|
33
39
|
exports.TsMenuButton = TsMenuButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsMenuButton.js","sourceRoot":"","sources":["../../../src/components/TsMenuButton/TsMenuButton.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"TsMenuButton.js","sourceRoot":"","sources":["../../../src/components/TsMenuButton/TsMenuButton.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iCAA6C;AAE7C,6CAA0C;AAC1C,qEAAgE;AAChE,8BAA4B;AAErB,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,YAAY;IACZ,YAAY;IACZ,OAAO,6BAAK,SAAS,EAAC,iBAAiB,GAAG,CAAC;AAC7C,CAAC,CAAC;AAJW,QAAA,aAAa,iBAIxB;AAEK,MAAM,UAAU,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAmB,EAAE,EAAE;IACtE,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,gCAAQ,SAAS,EAAC,cAAc,EAAC,OAAO,EAAE,OAAO;QAC9C,IAAI,IAAI,CACP,6BAAK,SAAS,EAAC,mBAAmB;YAChC,oBAAC,eAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,GAAG,CAC5B,CACP;QAED,6BAAK,SAAS,EAAC,oBAAoB,IAAE,KAAK,CAAO,CAC1C,CACV,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,UAAU,cAcrB;AAEK,MAAM,YAAY,GAAG,CAAC,EAAE,aAAa,GAAG,cAAc,EAAE,UAAU,EAAE,KAAK,EAAqB,EAAE,EAAE;IACvG,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,IAAA,mCAAe,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,WAAW;IACX,WAAW;IACX,MAAM,cAAc,GAAG,CAAC,CAAgC,EAAE,EAAE;QAC1D,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAC,gBAAgB,EAAC,GAAG,EAAE,WAAW;QAC7C,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QAC3D,QAAQ,IAAI,6BAAK,SAAS,EAAE,4CAA4C,aAAa,EAAE,IAAG,KAAK,CAAO,CACnG,CACP,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,YAAY,gBAmBvB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, ReactElement } from 'react';
|
|
1
|
+
import { ButtonHTMLAttributes, ReactElement, MouseEvent } from 'react';
|
|
2
2
|
export type TsMenuItemProps = {
|
|
3
3
|
label: string;
|
|
4
4
|
icon?: string;
|
|
5
|
-
onClick: () => void;
|
|
5
|
+
onClick: (e: MouseEvent<HTMLElement>) => void;
|
|
6
6
|
};
|
|
7
7
|
export type TsMenuButtonProps = {
|
|
8
8
|
menuAlignment?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { MouseEvent, useState } from 'react';
|
|
3
3
|
import { TsMenuButtonProps, TsMenuItemProps } from './TsMenuButton.types';
|
|
4
4
|
import { TsIcon } from '../TsIcon/TsIcon';
|
|
5
5
|
import { useClickOutside } from '../../hooks/use-click-outside';
|
|
@@ -31,11 +31,18 @@ export const TsMenuButton = ({ menuAlignment = 'bottom-start', mainButton, items
|
|
|
31
31
|
const [showMenu, setShowMenu] = useState<boolean>(false);
|
|
32
32
|
const dropdownRef = useClickOutside(() => setShowMenu(false));
|
|
33
33
|
|
|
34
|
+
// ########
|
|
35
|
+
// Hanlders
|
|
36
|
+
const handleShowMenu = (e: MouseEvent<HTMLButtonElement>) => {
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
setShowMenu(true);
|
|
39
|
+
};
|
|
40
|
+
|
|
34
41
|
// #########
|
|
35
42
|
// Rendering
|
|
36
43
|
return (
|
|
37
44
|
<div className="ts-menu-button" ref={dropdownRef}>
|
|
38
|
-
{React.cloneElement(mainButton, { onClick:
|
|
45
|
+
{React.cloneElement(mainButton, { onClick: handleShowMenu })}
|
|
39
46
|
{showMenu && <div className={`ts-menu-button-menu ts-menu-button-menu--${menuAlignment}`}>{items}</div>}
|
|
40
47
|
</div>
|
|
41
48
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, ReactElement } from 'react';
|
|
1
|
+
import { ButtonHTMLAttributes, ReactElement, MouseEvent } from 'react';
|
|
2
2
|
|
|
3
3
|
export type TsMenuItemProps = {
|
|
4
4
|
label: string;
|
|
5
5
|
icon?: string;
|
|
6
|
-
onClick: () => void;
|
|
6
|
+
onClick: (e: MouseEvent<HTMLElement>) => void;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export type TsMenuButtonProps = {
|