ag-common 0.0.236 → 0.0.239
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/ui/components/DropdownList/index.js +27 -40
- package/dist/ui/components/DropdownList/types.d.ts +14 -3
- package/dist/ui/components/KebabDots/index.d.ts +4 -0
- package/dist/ui/components/KebabDots/index.js +16 -0
- package/dist/ui/components/index.d.ts +0 -1
- package/dist/ui/components/index.js +0 -1
- package/package.json +8 -8
- package/dist/ui/components/Dropdown/Modal.d.ts +0 -12
- package/dist/ui/components/Dropdown/Modal.js +0 -20
- package/dist/ui/components/Dropdown/index.d.ts +0 -13
- package/dist/ui/components/Dropdown/index.js +0 -70
|
@@ -24,11 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.DropdownList = void 0;
|
|
27
|
-
const Icon_1 = require("../Icon");
|
|
28
27
|
const dom_1 = require("../../helpers/dom");
|
|
29
28
|
const common_1 = require("../../styles/common");
|
|
30
29
|
const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
|
|
31
30
|
const colours_1 = require("../../styles/colours");
|
|
31
|
+
const KebabDots_1 = require("../KebabDots");
|
|
32
32
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
33
33
|
const react_1 = __importStar(require("react"));
|
|
34
34
|
const SBase = styled_components_1.default.div `
|
|
@@ -43,13 +43,12 @@ const SBase = styled_components_1.default.div `
|
|
|
43
43
|
const DropItems = styled_components_1.default.div `
|
|
44
44
|
flex-flow: column;
|
|
45
45
|
z-index: 5;
|
|
46
|
-
|
|
47
46
|
display: none;
|
|
48
|
-
|
|
49
47
|
background-color: white;
|
|
50
48
|
cursor: default;
|
|
51
49
|
width: 100%;
|
|
52
|
-
|
|
50
|
+
position: absolute;
|
|
51
|
+
${({ shadow }) => shadow && (0, common_1.Shadow)(shadow)}
|
|
53
52
|
${({ maxHeight }) => maxHeight &&
|
|
54
53
|
(0, styled_components_1.css) `
|
|
55
54
|
max-height: ${maxHeight};
|
|
@@ -59,25 +58,19 @@ const DropItems = styled_components_1.default.div `
|
|
|
59
58
|
&[data-open='true'] {
|
|
60
59
|
display: flex;
|
|
61
60
|
}
|
|
62
|
-
&[data-defaultopen='false'] {
|
|
63
|
-
position: absolute;
|
|
64
|
-
${({ shadow }) => shadow && (0, common_1.Shadow)(shadow)}
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
67
|
-
const Dots = (react_1.default.createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fillRule: "evenodd", clipRule: "evenodd" },
|
|
68
|
-
react_1.default.createElement("path", { d: "M16 12a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 0117 12zm-8 0a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 0110 12zm-8 0a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 013 12z" })));
|
|
69
|
-
const IconStyled = (0, styled_components_1.default)(Icon_1.Icon) `
|
|
70
|
-
position: absolute;
|
|
71
61
|
`;
|
|
72
|
-
const
|
|
62
|
+
const ListItemStyle = styled_components_1.default.div `
|
|
73
63
|
z-index: 1;
|
|
74
64
|
font-weight: 500;
|
|
75
65
|
padding-left: 0.5rem;
|
|
76
66
|
flex-grow: 1;
|
|
77
67
|
padding: 1rem;
|
|
78
68
|
cursor: pointer;
|
|
69
|
+
display: flex;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
align-items: center;
|
|
79
73
|
&[data-selected='true'] {
|
|
80
|
-
cursor: default;
|
|
81
74
|
opacity: 1 !important;
|
|
82
75
|
background-color: ${colours_1.colours.orangeRed} !important;
|
|
83
76
|
}
|
|
@@ -95,20 +88,18 @@ const SList = styled_components_1.default.div `
|
|
|
95
88
|
background-color: rgba(0, 0, 0, 0.2);
|
|
96
89
|
}
|
|
97
90
|
`;
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} }, renderF(s))))));
|
|
105
|
-
};
|
|
91
|
+
const ListItem = ({ render, onChange, selected, }) => (react_1.default.createElement(ListItemStyle, { "data-selected": selected, onClick: (e) => {
|
|
92
|
+
if (!selected) {
|
|
93
|
+
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
94
|
+
}
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
} }, render));
|
|
106
97
|
function DropdownList(p) {
|
|
107
|
-
const { options, value, placeholder, className, renderF,
|
|
98
|
+
const { options, value, placeholder, className, renderF, shadow = '#555', maxHeight = '50vh', } = p;
|
|
108
99
|
const ref = (0, react_1.useRef)(null);
|
|
109
100
|
const [state, setState] = (0, react_1.useState)(value);
|
|
110
|
-
const [open, setOpen] = (0, react_1.useState)(
|
|
111
|
-
(0, useOnClickOutside_1.useOnClickOutside)({ disabled: !open
|
|
101
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
102
|
+
(0, useOnClickOutside_1.useOnClickOutside)({ disabled: !open, ref, moveMouseOutside: false }, () => {
|
|
112
103
|
setOpen(false);
|
|
113
104
|
});
|
|
114
105
|
(0, react_1.useEffect)(() => {
|
|
@@ -122,7 +113,7 @@ function DropdownList(p) {
|
|
|
122
113
|
var _a, _b, _c, _d;
|
|
123
114
|
const maxLen = Math.max(...options.map((s) => renderF(s).length));
|
|
124
115
|
const newStyle = {
|
|
125
|
-
|
|
116
|
+
minWidth: `calc(${maxLen}ch + 2rem)`,
|
|
126
117
|
};
|
|
127
118
|
const minPx = (0, dom_1.convertRemToPixels)(2 + maxLen / 2);
|
|
128
119
|
const offsetLeft = (_b = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetLeft) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -130,7 +121,7 @@ function DropdownList(p) {
|
|
|
130
121
|
newStyle.left = '0';
|
|
131
122
|
}
|
|
132
123
|
else {
|
|
133
|
-
newStyle.right = '
|
|
124
|
+
newStyle.right = '0';
|
|
134
125
|
}
|
|
135
126
|
const b = (_d = (_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect()) !== null && _d !== void 0 ? _d : { bottom: 0 };
|
|
136
127
|
const ih = typeof window !== 'undefined' ? window.innerHeight : 0;
|
|
@@ -139,26 +130,22 @@ function DropdownList(p) {
|
|
|
139
130
|
newStyle.bottom = '1rem';
|
|
140
131
|
}
|
|
141
132
|
else {
|
|
142
|
-
newStyle.top = '
|
|
133
|
+
newStyle.top = '0';
|
|
143
134
|
}
|
|
144
135
|
if (JSON.stringify(style) !== JSON.stringify(newStyle)) {
|
|
145
136
|
setStyle(newStyle);
|
|
146
137
|
}
|
|
147
|
-
}, [
|
|
138
|
+
}, [open, options, renderF, style]);
|
|
139
|
+
const defaultRender = !p.value ? react_1.default.createElement(KebabDots_1.KebabDots, null) : react_1.default.createElement(react_1.default.Fragment, null, p.renderF(p.value));
|
|
140
|
+
const defaultKey = !p.value ? '(noval)' : p.renderF(p.value);
|
|
141
|
+
const openDisplay = p.children || (react_1.default.createElement(ListItem, { selected: true, render: defaultRender, key: defaultKey }));
|
|
148
142
|
return (react_1.default.createElement(SBase, { className: className, ref: ref, title: placeholder, onClick: (e) => {
|
|
149
|
-
if (defaultOpen) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
143
|
e.stopPropagation();
|
|
153
144
|
e.preventDefault();
|
|
154
145
|
setOpen(!open);
|
|
155
146
|
} },
|
|
156
|
-
react_1.default.createElement(DropItems, { "data-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
e.stopPropagation();
|
|
160
|
-
e.preventDefault();
|
|
161
|
-
setOpen(!open);
|
|
162
|
-
} }, Dots)))));
|
|
147
|
+
react_1.default.createElement(DropItems, { "data-open": open, style: style, shadow: shadow, maxHeight: maxHeight }, open &&
|
|
148
|
+
options.map((s, i) => (react_1.default.createElement(ListItem, { key: p.renderF(s), render: p.renderF(s), onChange: () => p.onChange(s, i), selected: s === state })))),
|
|
149
|
+
openDisplay));
|
|
163
150
|
}
|
|
164
151
|
exports.DropdownList = DropdownList;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface IDropdownList<T> {
|
|
3
|
+
/**
|
|
4
|
+
* all items that can be in dropdown
|
|
5
|
+
*/
|
|
3
6
|
options: T[];
|
|
7
|
+
/**
|
|
8
|
+
* selected item from options.
|
|
9
|
+
*/
|
|
4
10
|
value?: T;
|
|
5
11
|
onChange: (v: T, index: number) => void;
|
|
12
|
+
/**
|
|
13
|
+
* placeholder title for list
|
|
14
|
+
*/
|
|
6
15
|
placeholder?: string;
|
|
7
16
|
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* function to render value
|
|
19
|
+
*/
|
|
8
20
|
renderF: (v: T) => string;
|
|
9
|
-
children?: JSX.Element;
|
|
10
21
|
/**
|
|
11
22
|
* colour of dropdown shadow. default #555
|
|
12
23
|
*/
|
|
@@ -16,7 +27,7 @@ export interface IDropdownList<T> {
|
|
|
16
27
|
*/
|
|
17
28
|
maxHeight?: string;
|
|
18
29
|
/**
|
|
19
|
-
* if
|
|
30
|
+
* if not provided, will default display value, then kebab dots
|
|
20
31
|
*/
|
|
21
|
-
|
|
32
|
+
children?: JSX.Element;
|
|
22
33
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.KebabDots = void 0;
|
|
7
|
+
const Icon_1 = require("../Icon");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
+
const Dots = (react_1.default.createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fillRule: "evenodd", clipRule: "evenodd" },
|
|
11
|
+
react_1.default.createElement("path", { d: "M16 12a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 0117 12zm-8 0a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 0110 12zm-8 0a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 013 12z" })));
|
|
12
|
+
const IconStyled = (0, styled_components_1.default)(Icon_1.Icon) `
|
|
13
|
+
position: absolute;
|
|
14
|
+
`;
|
|
15
|
+
const KebabDots = ({ onClick }) => (react_1.default.createElement(IconStyled, { width: "2rem", height: "2rem", onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick() }, Dots));
|
|
16
|
+
exports.KebabDots = KebabDots;
|
|
@@ -19,7 +19,6 @@ __exportStar(require("./Button"), exports);
|
|
|
19
19
|
__exportStar(require("./Chevron"), exports);
|
|
20
20
|
__exportStar(require("./Close"), exports);
|
|
21
21
|
__exportStar(require("./Confirm/Dialog"), exports);
|
|
22
|
-
__exportStar(require("./Dropdown"), exports);
|
|
23
22
|
__exportStar(require("./DropdownList"), exports);
|
|
24
23
|
__exportStar(require("./FlexColumn"), exports);
|
|
25
24
|
__exportStar(require("./FlexRow"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.239",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"jwks-rsa": "2.x",
|
|
24
24
|
"node-cache": "5.x",
|
|
25
25
|
"openapi-request-validator": "11.0.0",
|
|
26
|
-
"react": "18.
|
|
27
|
-
"react-dom": "18.
|
|
26
|
+
"react": "18.1.0",
|
|
27
|
+
"react-dom": "18.1.0",
|
|
28
28
|
"react-hot-toast": "2.x",
|
|
29
29
|
"styled-components": "5.x",
|
|
30
30
|
"typescript": "4.x"
|
|
@@ -40,21 +40,21 @@
|
|
|
40
40
|
"@storybook/react": "6.4.22",
|
|
41
41
|
"@storybook/theming": "6.4.22",
|
|
42
42
|
"@types/jsonwebtoken": "8.5.8",
|
|
43
|
-
"@types/node": "17.0.
|
|
43
|
+
"@types/node": "17.0.29",
|
|
44
44
|
"@types/react": "17.0.43",
|
|
45
45
|
"@types/react-dom": "17.0.14",
|
|
46
46
|
"@types/styled-components": "5.1.25",
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
48
|
-
"@typescript-eslint/parser": "5.
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "5.21.0",
|
|
48
|
+
"@typescript-eslint/parser": "5.21.0",
|
|
49
49
|
"cross-env": "7.0.3",
|
|
50
|
-
"eslint": "8.
|
|
50
|
+
"eslint": "8.14.0",
|
|
51
51
|
"eslint-config-airbnb-typescript": "17.0.0",
|
|
52
52
|
"eslint-config-prettier": "8.5.0",
|
|
53
53
|
"eslint-plugin-import": "2.26.0",
|
|
54
54
|
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
55
55
|
"eslint-plugin-prettier": "4.0.0",
|
|
56
56
|
"eslint-plugin-react": "7.29.4",
|
|
57
|
-
"eslint-plugin-react-hooks": "4.
|
|
57
|
+
"eslint-plugin-react-hooks": "4.5.0",
|
|
58
58
|
"prettier": "2.6.2",
|
|
59
59
|
"rimraf": "3.0.2"
|
|
60
60
|
},
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const DropdownModal: (p: {
|
|
3
|
-
options: (string | JSX.Element)[];
|
|
4
|
-
onSelect?: ((i: number, e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
5
|
-
position?: "left" | "right" | undefined;
|
|
6
|
-
topPosition?: "top" | "bottom" | undefined;
|
|
7
|
-
open: boolean;
|
|
8
|
-
setOpen: (b: boolean) => void;
|
|
9
|
-
closeOnMoveMouseOutside?: boolean | undefined;
|
|
10
|
-
showCloseButton?: boolean | undefined;
|
|
11
|
-
className?: string | undefined;
|
|
12
|
-
}) => JSX.Element;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DropdownModal = void 0;
|
|
7
|
-
const Modal_1 = require("../Modal");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
-
const ModalDropdownStyled = (0, styled_components_1.default)(Modal_1.Modal) `
|
|
11
|
-
flex-flow: column;
|
|
12
|
-
`;
|
|
13
|
-
const DropdownModal = (p) => (react_1.default.createElement(ModalDropdownStyled, Object.assign({}, p, { className: p.className }), p.options.map((option, index) => (react_1.default.createElement(Modal_1.ModalItem, { key: option, onClick: (e) => {
|
|
14
|
-
var _a;
|
|
15
|
-
e.stopPropagation();
|
|
16
|
-
e.preventDefault();
|
|
17
|
-
(_a = p.onSelect) === null || _a === void 0 ? void 0 : _a.call(p, index, e);
|
|
18
|
-
p.setOpen(false);
|
|
19
|
-
} }, option)))));
|
|
20
|
-
exports.DropdownModal = DropdownModal;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const Dropdown: ({ options, position, topPosition, onSelect, className, enableHoverOpen, children, }: {
|
|
3
|
-
className?: string | undefined;
|
|
4
|
-
options: (string | JSX.Element)[];
|
|
5
|
-
topPosition?: "top" | "bottom" | undefined;
|
|
6
|
-
position?: "left" | "right" | undefined;
|
|
7
|
-
onSelect: (i: number, e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
8
|
-
enableHoverOpen?: boolean | undefined;
|
|
9
|
-
/**
|
|
10
|
-
* if not provided, will show ... dots to click to open (default)
|
|
11
|
-
*/
|
|
12
|
-
children?: JSX.Element | undefined;
|
|
13
|
-
}) => JSX.Element;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Dropdown = void 0;
|
|
30
|
-
const Modal_1 = require("./Modal");
|
|
31
|
-
const common_1 = require("../../styles/common");
|
|
32
|
-
const react_1 = __importStar(require("react"));
|
|
33
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
34
|
-
const Base = styled_components_1.default.div `
|
|
35
|
-
cursor: pointer;
|
|
36
|
-
`;
|
|
37
|
-
const Dots = (react_1.default.createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fillRule: "evenodd", clipRule: "evenodd" },
|
|
38
|
-
react_1.default.createElement("path", { d: "M16 12a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 0117 12zm-8 0a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 0110 12zm-8 0a3.001 3.001 0 016 0 3.001 3.001 0 01-6 0zm1 0a2 2 0 114.001.001A2 2 0 013 12z" })));
|
|
39
|
-
const Icon = styled_components_1.default.div `
|
|
40
|
-
display: flex;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
align-content: center;
|
|
43
|
-
align-items: center;
|
|
44
|
-
&[data-fixedsize='true'] {
|
|
45
|
-
width: 1.5rem;
|
|
46
|
-
height: 1.5rem;
|
|
47
|
-
top: -0.5rem;
|
|
48
|
-
right: -0.5rem;
|
|
49
|
-
position: absolute;
|
|
50
|
-
}
|
|
51
|
-
border: solid 1px #ccc;
|
|
52
|
-
border-radius: 50%;
|
|
53
|
-
background-color: white;
|
|
54
|
-
`;
|
|
55
|
-
const Dropdown = ({ options, position = 'left', topPosition, onSelect, className, enableHoverOpen = false, children, }) => {
|
|
56
|
-
const [open, setOpen] = (0, react_1.useState)(false);
|
|
57
|
-
const child = !children ? (react_1.default.createElement(Icon, { "data-fixedsize": true, onClick: (e) => {
|
|
58
|
-
e.stopPropagation();
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
setOpen(!open);
|
|
61
|
-
} }, Dots)) : (react_1.default.createElement("div", { tabIndex: -1, role: "button", onKeyDown: (e) => e.key === 'Enter' && setOpen(!open), "data-fixedsize": false, onClick: (e) => {
|
|
62
|
-
e.stopPropagation();
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
setOpen(!open);
|
|
65
|
-
} }, children));
|
|
66
|
-
return (react_1.default.createElement(Base, Object.assign({ onKeyPress: (e) => e.key === 'Enter' && setOpen(!open), onMouseEnter: () => enableHoverOpen && setOpen(true), onMouseLeave: () => enableHoverOpen && setOpen(false), className: className }, common_1.noDrag),
|
|
67
|
-
child,
|
|
68
|
-
react_1.default.createElement(Modal_1.DropdownModal, { position: position, topPosition: topPosition, options: options, open: open, setOpen: setOpen, onSelect: onSelect, showCloseButton: false })));
|
|
69
|
-
};
|
|
70
|
-
exports.Dropdown = Dropdown;
|