@elliemae/ds-mini-toolbar 2.3.1 → 3.0.0-alpha.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/dist/cjs/Components/MiniToolbar.js +81 -0
- package/dist/cjs/Components/MiniToolbar.js.map +7 -0
- package/dist/cjs/Components/ToolbarShortcut.js +79 -0
- package/dist/cjs/Components/ToolbarShortcut.js.map +7 -0
- package/dist/cjs/Components/outOfTheBox/Button.js +57 -0
- package/dist/cjs/Components/outOfTheBox/Button.js.map +7 -0
- package/dist/cjs/Components/outOfTheBox/ComboBox.js +51 -0
- package/dist/cjs/Components/outOfTheBox/ComboBox.js.map +7 -0
- package/dist/cjs/Components/outOfTheBox/IconItem.js +50 -0
- package/dist/cjs/Components/outOfTheBox/IconItem.js.map +7 -0
- package/dist/cjs/Components/outOfTheBox/SearchBox.js +71 -0
- package/dist/cjs/Components/outOfTheBox/SearchBox.js.map +7 -0
- package/dist/cjs/Components/outOfTheBox/Separator.js +39 -0
- package/dist/cjs/Components/outOfTheBox/Separator.js.map +7 -0
- package/dist/cjs/Components/outOfTheBox/index.js +53 -0
- package/dist/cjs/Components/outOfTheBox/index.js.map +7 -0
- package/dist/cjs/hooks/useGenerateItems.js +131 -0
- package/dist/cjs/hooks/useGenerateItems.js.map +7 -0
- package/dist/cjs/index.d.js +27 -0
- package/dist/cjs/index.d.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/propTypes.js +69 -0
- package/dist/cjs/propTypes.js.map +7 -0
- package/dist/cjs/styles.js +62 -0
- package/dist/cjs/styles.js.map +7 -0
- package/dist/esm/Components/MiniToolbar.js +52 -0
- package/dist/esm/Components/MiniToolbar.js.map +7 -0
- package/dist/esm/Components/ToolbarShortcut.js +52 -0
- package/dist/esm/Components/ToolbarShortcut.js.map +7 -0
- package/dist/esm/Components/outOfTheBox/Button.js +30 -0
- package/dist/esm/Components/outOfTheBox/Button.js.map +7 -0
- package/dist/esm/Components/outOfTheBox/ComboBox.js +24 -0
- package/dist/esm/Components/outOfTheBox/ComboBox.js.map +7 -0
- package/dist/esm/Components/outOfTheBox/IconItem.js +21 -0
- package/dist/esm/Components/outOfTheBox/IconItem.js.map +7 -0
- package/dist/esm/Components/outOfTheBox/SearchBox.js +44 -0
- package/dist/esm/Components/outOfTheBox/SearchBox.js.map +7 -0
- package/dist/esm/Components/outOfTheBox/Separator.js +10 -0
- package/dist/esm/Components/outOfTheBox/Separator.js.map +7 -0
- package/dist/esm/Components/outOfTheBox/index.js +24 -0
- package/dist/esm/Components/outOfTheBox/index.js.map +7 -0
- package/dist/esm/hooks/useGenerateItems.js +115 -0
- package/dist/esm/hooks/useGenerateItems.js.map +7 -0
- package/dist/esm/index.d.js +2 -0
- package/dist/esm/index.d.js.map +7 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/propTypes.js +40 -0
- package/dist/esm/propTypes.js.map +7 -0
- package/dist/esm/styles.js +33 -0
- package/dist/esm/styles.js.map +7 -0
- package/package.json +51 -42
- package/cjs/Components/MiniToolbar.js +0 -70
- package/cjs/Components/ToolbarShortcut.js +0 -72
- package/cjs/Components/outOfTheBox/Button.js +0 -29
- package/cjs/Components/outOfTheBox/ComboBox.js +0 -25
- package/cjs/Components/outOfTheBox/IconItem.js +0 -36
- package/cjs/Components/outOfTheBox/SearchBox.js +0 -55
- package/cjs/Components/outOfTheBox/Separator.js +0 -19
- package/cjs/Components/outOfTheBox/index.js +0 -26
- package/cjs/hooks/useGenerateItems.js +0 -134
- package/cjs/index.d.js +0 -2
- package/cjs/index.js +0 -12
- package/cjs/propTypes.js +0 -35
- package/cjs/styles.js +0 -29
- package/esm/Components/MiniToolbar.js +0 -60
- package/esm/Components/ToolbarShortcut.js +0 -63
- package/esm/Components/outOfTheBox/Button.js +0 -20
- package/esm/Components/outOfTheBox/ComboBox.js +0 -17
- package/esm/Components/outOfTheBox/IconItem.js +0 -28
- package/esm/Components/outOfTheBox/SearchBox.js +0 -45
- package/esm/Components/outOfTheBox/Separator.js +0 -11
- package/esm/Components/outOfTheBox/index.js +0 -13
- package/esm/hooks/useGenerateItems.js +0 -125
- package/esm/index.d.js +0 -1
- package/esm/index.js +0 -2
- package/esm/propTypes.js +0 -30
- package/esm/styles.js +0 -17
- package/types/Components/MiniToolbar.d.ts +0 -21
- package/types/Components/ToolbarShortcut.d.ts +0 -4
- package/types/Components/outOfTheBox/Button.d.ts +0 -3
- package/types/Components/outOfTheBox/ComboBox.d.ts +0 -3
- package/types/Components/outOfTheBox/IconItem.d.ts +0 -4
- package/types/Components/outOfTheBox/SearchBox.d.ts +0 -5
- package/types/Components/outOfTheBox/Separator.d.ts +0 -3
- package/types/Components/outOfTheBox/index.d.ts +0 -10
- package/types/hooks/useGenerateItems.d.ts +0 -4
- package/types/index.d.d.ts +0 -75
- package/types/index.d.ts +0 -2
- package/types/propTypes.d.ts +0 -17
- package/types/styles.d.ts +0 -5
- package/types/tests/DSMiniToolbar.events.test.d.ts +0 -1
- package/types/tests/DSMiniToolbar.keyboard.test.d.ts +0 -1
- package/types/tests/DSMiniToolbar.test.d.ts +0 -1
- package/types/tests/utils.test.d.ts +0 -161
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import React2 from "react";
|
|
19
|
+
import { Search } from "@elliemae/ds-icons";
|
|
20
|
+
import { DSSearchBox } from "@elliemae/ds-form";
|
|
21
|
+
import { StyledButton } from "../../styles";
|
|
22
|
+
const MiniToolbarSearchButton = (props) => {
|
|
23
|
+
const { size, color, onClick, ariaLabel, style, buttonType = "secondary" } = props;
|
|
24
|
+
return /* @__PURE__ */ React2.createElement(StyledButton, {
|
|
25
|
+
"aria-label": ariaLabel,
|
|
26
|
+
buttonType,
|
|
27
|
+
onClick,
|
|
28
|
+
style,
|
|
29
|
+
leftIcon: /* @__PURE__ */ React2.createElement(Search, {
|
|
30
|
+
size,
|
|
31
|
+
color
|
|
32
|
+
}),
|
|
33
|
+
"data-testid": "ds-mini-toolbar__shortcut"
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const MiniToolbarSearchBox = (props) => /* @__PURE__ */ React2.createElement(DSSearchBox, __spreadValues({
|
|
37
|
+
clearable: true,
|
|
38
|
+
showIcon: false
|
|
39
|
+
}, props));
|
|
40
|
+
export {
|
|
41
|
+
MiniToolbarSearchBox,
|
|
42
|
+
MiniToolbarSearchButton
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=SearchBox.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/Components/outOfTheBox/SearchBox.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { Search } from '@elliemae/ds-icons';\nimport { DSSearchBox } from '@elliemae/ds-form';\nimport { StyledButton } from '../../styles';\nimport { MiniToolbarIconItemPropsT } from '../../index.d';\n\nconst MiniToolbarSearchButton = (props: MiniToolbarIconItemPropsT): React.ReactElement => {\n const { size, color, onClick, ariaLabel, style, buttonType = 'secondary' } = props;\n\n return (\n <StyledButton\n aria-label={ariaLabel}\n buttonType={buttonType}\n onClick={onClick}\n style={style}\n leftIcon={<Search size={size} color={color} />}\n data-testid=\"ds-mini-toolbar__shortcut\"\n />\n );\n};\n\nconst MiniToolbarSearchBox = (props: Record<string, unknown>): JSX.Element => (\n <DSSearchBox clearable showIcon={false} {...props} />\n);\n\nexport { MiniToolbarSearchButton, MiniToolbarSearchBox };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;ACCA;AACA;AACA;AACA;AAGA,MAAM,0BAA0B,CAAC,UAAyD;AACxF,QAAM,EAAE,MAAM,OAAO,SAAS,WAAW,OAAO,aAAa,gBAAgB;AAE7E,SACE,qCAAC,cAAD;AAAA,IACE,cAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,qCAAC,QAAD;AAAA,MAAQ;AAAA,MAAY;AAAA;AAAA,IAC9B,eAAY;AAAA;AAAA;AAKlB,MAAM,uBAAuB,CAAC,UAC5B,qCAAC,aAAD;AAAA,EAAa,WAAS;AAAA,EAAC,UAAU;AAAA,GAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { Separator } from "../../styles";
|
|
4
|
+
const MiniToolbarSeparator = () => /* @__PURE__ */ React2.createElement(Separator, {
|
|
5
|
+
"data-testid": "ds-mini-toolbar__separator"
|
|
6
|
+
});
|
|
7
|
+
export {
|
|
8
|
+
MiniToolbarSeparator
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=Separator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/Components/outOfTheBox/Separator.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { Separator } from '../../styles';\n\nconst MiniToolbarSeparator = (): React.ReactElement => (\n <Separator data-testid=\"ds-mini-toolbar__separator\" />\n);\n\nexport { MiniToolbarSeparator };\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEA,MAAM,uBAAuB,MAC3B,qCAAC,WAAD;AAAA,EAAW,eAAY;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { MiniToolbarButton } from "./Button";
|
|
3
|
+
import { MiniToolbarIcon } from "./IconItem";
|
|
4
|
+
import { MiniToolbarSearchBox } from "./SearchBox";
|
|
5
|
+
import { MiniToolbarSeparator } from "./Separator";
|
|
6
|
+
import { MiniToolbarComboBox } from "./ComboBox";
|
|
7
|
+
const ICON_ITEM = "ds-icon-item";
|
|
8
|
+
const SEPARATOR = "ds-separator";
|
|
9
|
+
const BUTTON = "ds-button";
|
|
10
|
+
const SEARCH_BOX = "ds-search-box";
|
|
11
|
+
const COMBO_BOX = "ds-combo-box";
|
|
12
|
+
export {
|
|
13
|
+
BUTTON,
|
|
14
|
+
COMBO_BOX,
|
|
15
|
+
ICON_ITEM,
|
|
16
|
+
MiniToolbarButton,
|
|
17
|
+
MiniToolbarComboBox,
|
|
18
|
+
MiniToolbarIcon,
|
|
19
|
+
MiniToolbarSearchBox,
|
|
20
|
+
MiniToolbarSeparator,
|
|
21
|
+
SEARCH_BOX,
|
|
22
|
+
SEPARATOR
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/Components/outOfTheBox/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { MiniToolbarButton } from './Button';\nexport { MiniToolbarIcon } from './IconItem';\nexport { MiniToolbarSearchBox } from './SearchBox';\nexport { MiniToolbarSeparator } from './Separator';\nexport { MiniToolbarComboBox } from './ComboBox';\n\nexport const ICON_ITEM = 'ds-icon-item';\nexport const SEPARATOR = 'ds-separator';\nexport const BUTTON = 'ds-button';\nexport const SEARCH_BOX = 'ds-search-box';\nexport const COMBO_BOX = 'ds-combo-box';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEO,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,SAAS;AACf,MAAM,aAAa;AACnB,MAAM,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import React2, { useMemo } from "react";
|
|
19
|
+
import { uid } from "uid";
|
|
20
|
+
import { Search } from "@elliemae/ds-icons";
|
|
21
|
+
import {
|
|
22
|
+
ICON_ITEM,
|
|
23
|
+
SEPARATOR,
|
|
24
|
+
BUTTON,
|
|
25
|
+
SEARCH_BOX,
|
|
26
|
+
COMBO_BOX,
|
|
27
|
+
MiniToolbarButton,
|
|
28
|
+
MiniToolbarSeparator,
|
|
29
|
+
MiniToolbarSearchBox,
|
|
30
|
+
MiniToolbarIcon,
|
|
31
|
+
MiniToolbarComboBox
|
|
32
|
+
} from "../Components/outOfTheBox";
|
|
33
|
+
import { ToolbarShortcut } from "../Components/ToolbarShortcut";
|
|
34
|
+
import { MiniToolbarSearchButton } from "../Components/outOfTheBox/SearchBox";
|
|
35
|
+
const useGenerateItems = (items) => {
|
|
36
|
+
const instanceUID = useMemo(() => uid(6), []);
|
|
37
|
+
const shortcutItems = useMemo(() => items.filter((item) => item.hasShortcut || item.component === SEARCH_BOX || item.contextualRegion).map((item, index) => {
|
|
38
|
+
const { component, shortcutComponent, shortcutProps, sharedProps, contextualRegion, contextualRegionProps } = item;
|
|
39
|
+
let Component;
|
|
40
|
+
let ContextualRegion;
|
|
41
|
+
if (component === SEPARATOR)
|
|
42
|
+
return /* @__PURE__ */ React2.createElement(MiniToolbarSeparator, null);
|
|
43
|
+
if (component === BUTTON)
|
|
44
|
+
Component = MiniToolbarButton;
|
|
45
|
+
else if (component === ICON_ITEM)
|
|
46
|
+
Component = MiniToolbarIcon;
|
|
47
|
+
else if (component === COMBO_BOX)
|
|
48
|
+
Component = MiniToolbarComboBox;
|
|
49
|
+
else if (component === SEARCH_BOX) {
|
|
50
|
+
if (item.hasShortcut) {
|
|
51
|
+
Component = MiniToolbarSearchButton;
|
|
52
|
+
}
|
|
53
|
+
ContextualRegion = MiniToolbarSearchBox;
|
|
54
|
+
}
|
|
55
|
+
if (!ContextualRegion) {
|
|
56
|
+
ContextualRegion = contextualRegion;
|
|
57
|
+
}
|
|
58
|
+
if (!Component) {
|
|
59
|
+
Component = shortcutComponent;
|
|
60
|
+
}
|
|
61
|
+
return /* @__PURE__ */ React2.createElement(ToolbarShortcut, {
|
|
62
|
+
key: `${instanceUID}-shortcut-${index}`,
|
|
63
|
+
Component,
|
|
64
|
+
shortcutProps,
|
|
65
|
+
sharedProps,
|
|
66
|
+
ContextualRegion,
|
|
67
|
+
contextualRegionProps
|
|
68
|
+
});
|
|
69
|
+
}), [instanceUID, items]);
|
|
70
|
+
const dropdownMenuItems = useMemo(() => items.map((item, index) => {
|
|
71
|
+
const { component, sharedProps, dropdownComponentProps } = item;
|
|
72
|
+
const dropdownItem = {};
|
|
73
|
+
const { Icon, color, label, onClick } = __spreadValues(__spreadValues({}, sharedProps), dropdownComponentProps);
|
|
74
|
+
if (component === SEPARATOR)
|
|
75
|
+
dropdownItem.type = "separator";
|
|
76
|
+
else {
|
|
77
|
+
dropdownItem.id = `${instanceUID}-dropdown-${index}`;
|
|
78
|
+
dropdownItem.onClick = () => onClick(item);
|
|
79
|
+
dropdownItem.label = label;
|
|
80
|
+
dropdownItem.onKeyDown = (e) => {
|
|
81
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
82
|
+
onClick(item);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (component === ICON_ITEM) {
|
|
87
|
+
dropdownItem.leftAddon = /* @__PURE__ */ React2.createElement(Icon, {
|
|
88
|
+
color
|
|
89
|
+
});
|
|
90
|
+
} else if (component === SEARCH_BOX) {
|
|
91
|
+
dropdownItem.leftAddon = /* @__PURE__ */ React2.createElement(Search, {
|
|
92
|
+
color
|
|
93
|
+
});
|
|
94
|
+
} else if (component === COMBO_BOX) {
|
|
95
|
+
dropdownItem.type = "subMenu";
|
|
96
|
+
dropdownItem.label = label;
|
|
97
|
+
dropdownItem.subItems = sharedProps.options.map((option, index2) => {
|
|
98
|
+
option.id = `${instanceUID}-option-${index2}`;
|
|
99
|
+
option.onClick = () => dropdownComponentProps.onSelectMenuItem(option);
|
|
100
|
+
option.onKeyDown = (e) => {
|
|
101
|
+
if (e.key === " " || e.key === "Enter") {
|
|
102
|
+
dropdownComponentProps.onSelectMenuItem(option);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return option;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return dropdownItem;
|
|
109
|
+
}), [instanceUID, items]);
|
|
110
|
+
return [shortcutItems, dropdownMenuItems];
|
|
111
|
+
};
|
|
112
|
+
export {
|
|
113
|
+
useGenerateItems
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=useGenerateItems.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useGenerateItems.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { uid } from 'uid';\nimport { Search } from '@elliemae/ds-icons';\nimport {\n ICON_ITEM,\n SEPARATOR,\n BUTTON,\n SEARCH_BOX,\n COMBO_BOX,\n MiniToolbarButton,\n MiniToolbarSeparator,\n MiniToolbarSearchBox,\n MiniToolbarIcon,\n MiniToolbarComboBox,\n} from '../Components/outOfTheBox';\nimport { ToolbarShortcut } from '../Components/ToolbarShortcut';\nimport { MiniToolbarSearchButton } from '../Components/outOfTheBox/SearchBox';\nimport { GeneratedDropdownItemT, MiniToolbarItemT } from '../index.d';\n\nconst useGenerateItems = (items: MiniToolbarItemT[]): [React.ReactElement[], GeneratedDropdownItemT[]] => {\n const instanceUID = useMemo(() => uid(6), []);\n\n const shortcutItems = useMemo(\n () =>\n items\n .filter((item) => item.hasShortcut || item.component === SEARCH_BOX || item.contextualRegion)\n .map((item, index) => {\n const { component, shortcutComponent, shortcutProps, sharedProps, contextualRegion, contextualRegionProps } =\n item;\n\n let Component;\n let ContextualRegion;\n\n if (component === SEPARATOR) return <MiniToolbarSeparator />;\n if (component === BUTTON) Component = MiniToolbarButton;\n else if (component === ICON_ITEM) Component = MiniToolbarIcon;\n else if (component === COMBO_BOX) Component = MiniToolbarComboBox;\n else if (component === SEARCH_BOX) {\n if (item.hasShortcut) {\n Component = MiniToolbarSearchButton;\n }\n ContextualRegion = MiniToolbarSearchBox;\n }\n if (!ContextualRegion) {\n ContextualRegion = contextualRegion;\n }\n if (!Component) {\n Component = shortcutComponent;\n }\n\n return (\n <ToolbarShortcut\n key={`${instanceUID}-shortcut-${index}`}\n Component={Component}\n shortcutProps={shortcutProps}\n sharedProps={sharedProps}\n ContextualRegion={ContextualRegion}\n contextualRegionProps={contextualRegionProps}\n />\n );\n }),\n [instanceUID, items],\n );\n\n const dropdownMenuItems = useMemo(\n () =>\n items.map((item, index) => {\n const { component, sharedProps, dropdownComponentProps } = item;\n const dropdownItem: GeneratedDropdownItemT = {};\n\n const { Icon, color, label, onClick } = {\n ...sharedProps,\n ...dropdownComponentProps,\n };\n\n if (component === SEPARATOR) dropdownItem.type = 'separator';\n else {\n dropdownItem.id = `${instanceUID}-dropdown-${index}`;\n dropdownItem.onClick = () => onClick(item);\n dropdownItem.label = label;\n dropdownItem.onKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n onClick(item);\n }\n };\n }\n\n if (component === ICON_ITEM) {\n dropdownItem.leftAddon = <Icon color={color} />;\n } else if (component === SEARCH_BOX) {\n dropdownItem.leftAddon = <Search color={color} />;\n } else if (component === COMBO_BOX) {\n dropdownItem.type = 'subMenu';\n dropdownItem.label = label;\n dropdownItem.subItems = sharedProps.options.map((option, index) => {\n option.id = `${instanceUID}-option-${index}`;\n option.onClick = () => dropdownComponentProps.onSelectMenuItem(option);\n option.onKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n dropdownComponentProps.onSelectMenuItem(option);\n }\n };\n return option;\n });\n }\n\n return dropdownItem;\n }),\n [instanceUID, items],\n );\n\n return [shortcutItems, dropdownMenuItems];\n};\n\nexport { useGenerateItems };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA;AACA;AAGA,MAAM,mBAAmB,CAAC,UAAgF;AACxG,QAAM,cAAc,QAAQ,MAAM,IAAI,IAAI;AAE1C,QAAM,gBAAgB,QACpB,MACE,MACG,OAAO,CAAC,SAAS,KAAK,eAAe,KAAK,cAAc,cAAc,KAAK,kBAC3E,IAAI,CAAC,MAAM,UAAU;AACpB,UAAM,EAAE,WAAW,mBAAmB,eAAe,aAAa,kBAAkB,0BAClF;AAEF,QAAI;AACJ,QAAI;AAEJ,QAAI,cAAc;AAAW,aAAO,qCAAC,sBAAD;AACpC,QAAI,cAAc;AAAQ,kBAAY;AAAA,aAC7B,cAAc;AAAW,kBAAY;AAAA,aACrC,cAAc;AAAW,kBAAY;AAAA,aACrC,cAAc,YAAY;AACjC,UAAI,KAAK,aAAa;AACpB,oBAAY;AAAA;AAEd,yBAAmB;AAAA;AAErB,QAAI,CAAC,kBAAkB;AACrB,yBAAmB;AAAA;AAErB,QAAI,CAAC,WAAW;AACd,kBAAY;AAAA;AAGd,WACE,qCAAC,iBAAD;AAAA,MACE,KAAK,GAAG,wBAAwB;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAIV,CAAC,aAAa;AAGhB,QAAM,oBAAoB,QACxB,MACE,MAAM,IAAI,CAAC,MAAM,UAAU;AACzB,UAAM,EAAE,WAAW,aAAa,2BAA2B;AAC3D,UAAM,eAAuC;AAE7C,UAAM,EAAE,MAAM,OAAO,OAAO,YAAY,kCACnC,cACA;AAGL,QAAI,cAAc;AAAW,mBAAa,OAAO;AAAA,SAC5C;AACH,mBAAa,KAAK,GAAG,wBAAwB;AAC7C,mBAAa,UAAU,MAAM,QAAQ;AACrC,mBAAa,QAAQ;AACrB,mBAAa,YAAY,CAAC,MAA2B;AACnD,YAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,kBAAQ;AAAA;AAAA;AAAA;AAKd,QAAI,cAAc,WAAW;AAC3B,mBAAa,YAAY,qCAAC,MAAD;AAAA,QAAM;AAAA;AAAA,eACtB,cAAc,YAAY;AACnC,mBAAa,YAAY,qCAAC,QAAD;AAAA,QAAQ;AAAA;AAAA,eACxB,cAAc,WAAW;AAClC,mBAAa,OAAO;AACpB,mBAAa,QAAQ;AACrB,mBAAa,WAAW,YAAY,QAAQ,IAAI,CAAC,QAAQ,WAAU;AACjE,eAAO,KAAK,GAAG,sBAAsB;AACrC,eAAO,UAAU,MAAM,uBAAuB,iBAAiB;AAC/D,eAAO,YAAY,CAAC,MAA2B;AAC7C,cAAI,EAAE,QAAQ,OAAO,EAAE,QAAQ,SAAS;AACtC,mCAAuB,iBAAiB;AAAA;AAAA;AAG5C,eAAO;AAAA;AAAA;AAIX,WAAO;AAAA,MAEX,CAAC,aAAa;AAGhB,SAAO,CAAC,eAAe;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { MiniToolbar, MiniToolbarWithSchema } from "./Components/MiniToolbar";
|
|
3
|
+
import { ToolbarItemWithSchema } from "./propTypes";
|
|
4
|
+
export {
|
|
5
|
+
MiniToolbar,
|
|
6
|
+
MiniToolbarWithSchema,
|
|
7
|
+
ToolbarItemWithSchema
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { MiniToolbar, MiniToolbarWithSchema } from './Components/MiniToolbar';\nexport { ToolbarItemWithSchema } from './propTypes';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes, describe } from "react-desc";
|
|
3
|
+
const outOfTheBoxType = PropTypes.oneOf([
|
|
4
|
+
"ds-button",
|
|
5
|
+
"ds-icon-item",
|
|
6
|
+
"ds-separator",
|
|
7
|
+
"ds-search-box",
|
|
8
|
+
"ds-combo-box"
|
|
9
|
+
]).description("out-of-the-box toolbar components");
|
|
10
|
+
const toolbarItemProps = {
|
|
11
|
+
component: PropTypes.oneOfType([
|
|
12
|
+
outOfTheBoxType,
|
|
13
|
+
PropTypes.element
|
|
14
|
+
]).description("Main component").isRequired,
|
|
15
|
+
hasShortcut: PropTypes.bool.description("Whether to include the component as a shortcut in the toolbar or not").defaultValue(false),
|
|
16
|
+
shortcutComponent: PropTypes.element.description("Component to render as a shortcut in the toolbar"),
|
|
17
|
+
shortcutProps: PropTypes.object.description("Shortcut component props"),
|
|
18
|
+
dropdownComponentProps: PropTypes.object.description("Dropdown component props"),
|
|
19
|
+
sharedProps: PropTypes.object.description("Props shared by shortcut component and dropdown component"),
|
|
20
|
+
contextualRegion: PropTypes.element.description("Component that can be rendered as an adjacent region to the shortcut component"),
|
|
21
|
+
contextualRegionProps: PropTypes.object.description("Contextual region component props")
|
|
22
|
+
};
|
|
23
|
+
const itemPropTypes = PropTypes.shape(toolbarItemProps).description("Items props");
|
|
24
|
+
const overflowButtonPropTypes = {
|
|
25
|
+
ariaLabel: PropTypes.string,
|
|
26
|
+
buttonType: PropTypes.oneOf(["secondary", "text"]),
|
|
27
|
+
style: PropTypes.object
|
|
28
|
+
};
|
|
29
|
+
const miniToolbarProps = {
|
|
30
|
+
items: PropTypes.arrayOf(itemPropTypes).description("Array of items").isRequired,
|
|
31
|
+
overflowButtonProps: PropTypes.shape(overflowButtonPropTypes).description("Overflow button props")
|
|
32
|
+
};
|
|
33
|
+
const ToolbarItem = () => null;
|
|
34
|
+
const ToolbarItemWithSchema = describe(ToolbarItem);
|
|
35
|
+
ToolbarItemWithSchema.propTypes = toolbarItemProps;
|
|
36
|
+
export {
|
|
37
|
+
ToolbarItemWithSchema,
|
|
38
|
+
miniToolbarProps
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=propTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes, describe } from 'react-desc';\n\nconst outOfTheBoxType = PropTypes.oneOf([\n 'ds-button',\n 'ds-icon-item',\n 'ds-separator',\n 'ds-search-box',\n 'ds-combo-box',\n]).description('out-of-the-box toolbar components');\n\nconst toolbarItemProps = {\n component: PropTypes.oneOfType([\n outOfTheBoxType,\n PropTypes.element,\n ]).description('Main component').isRequired,\n hasShortcut: PropTypes.bool\n .description(\n 'Whether to include the component as a shortcut in the toolbar or not',\n )\n .defaultValue(false),\n shortcutComponent: PropTypes.element.description(\n 'Component to render as a shortcut in the toolbar',\n ),\n shortcutProps: PropTypes.object.description('Shortcut component props'),\n dropdownComponentProps: PropTypes.object.description(\n 'Dropdown component props',\n ),\n sharedProps: PropTypes.object.description(\n 'Props shared by shortcut component and dropdown component',\n ),\n contextualRegion: PropTypes.element.description(\n 'Component that can be rendered as an adjacent region to the shortcut component',\n ),\n contextualRegionProps: PropTypes.object.description(\n 'Contextual region component props',\n ),\n};\n\nconst itemPropTypes = PropTypes.shape(toolbarItemProps).description(\n 'Items props',\n);\n\nconst overflowButtonPropTypes = {\n ariaLabel: PropTypes.string,\n buttonType: PropTypes.oneOf(['secondary', 'text']),\n style: PropTypes.object,\n};\n\nconst miniToolbarProps = {\n items: PropTypes.arrayOf(itemPropTypes).description('Array of items')\n .isRequired,\n overflowButtonProps: PropTypes.shape(overflowButtonPropTypes).description(\n 'Overflow button props',\n ),\n};\n\nconst ToolbarItem = () => null;\n\nconst ToolbarItemWithSchema = describe(ToolbarItem);\nToolbarItemWithSchema.propTypes = toolbarItemProps;\nexport { ToolbarItemWithSchema, miniToolbarProps };\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA,MAAM,kBAAkB,UAAU,MAAM;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GACC,YAAY;AAEf,MAAM,mBAAmB;AAAA,EACvB,WAAW,UAAU,UAAU;AAAA,IAC7B;AAAA,IACA,UAAU;AAAA,KACT,YAAY,kBAAkB;AAAA,EACjC,aAAa,UAAU,KACpB,YACC,wEAED,aAAa;AAAA,EAChB,mBAAmB,UAAU,QAAQ,YACnC;AAAA,EAEF,eAAe,UAAU,OAAO,YAAY;AAAA,EAC5C,wBAAwB,UAAU,OAAO,YACvC;AAAA,EAEF,aAAa,UAAU,OAAO,YAC5B;AAAA,EAEF,kBAAkB,UAAU,QAAQ,YAClC;AAAA,EAEF,uBAAuB,UAAU,OAAO,YACtC;AAAA;AAIJ,MAAM,gBAAgB,UAAU,MAAM,kBAAkB,YACtD;AAGF,MAAM,0BAA0B;AAAA,EAC9B,WAAW,UAAU;AAAA,EACrB,YAAY,UAAU,MAAM,CAAC,aAAa;AAAA,EAC1C,OAAO,UAAU;AAAA;AAGnB,MAAM,mBAAmB;AAAA,EACvB,OAAO,UAAU,QAAQ,eAAe,YAAY,kBACjD;AAAA,EACH,qBAAqB,UAAU,MAAM,yBAAyB,YAC5D;AAAA;AAIJ,MAAM,cAAc,MAAM;AAE1B,MAAM,wBAAwB,SAAS;AACvC,sBAAsB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { DSButton } from "@elliemae/ds-button";
|
|
4
|
+
const Container = styled.ul`
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
padding: 0 6px;
|
|
10
|
+
`;
|
|
11
|
+
const Separator = styled.span`
|
|
12
|
+
height: 24px;
|
|
13
|
+
width: 1px;
|
|
14
|
+
margin: 6px;
|
|
15
|
+
border-left: 1px solid #bbb;
|
|
16
|
+
`;
|
|
17
|
+
const Item = styled.li`
|
|
18
|
+
display: flex;
|
|
19
|
+
margin: 6px;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
`;
|
|
22
|
+
const StyledButton = styled(DSButton)`
|
|
23
|
+
&:not(:focus) {
|
|
24
|
+
border-color: transparent;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
export {
|
|
28
|
+
Container,
|
|
29
|
+
Item,
|
|
30
|
+
Separator,
|
|
31
|
+
StyledButton
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\nimport { DSButton } from '@elliemae/ds-button';\n\nconst Container = styled.ul`\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n padding: 0 6px;\n`;\n\nconst Separator = styled.span`\n height: 24px;\n width: 1px;\n margin: 6px;\n border-left: 1px solid #bbb;\n`;\n\nconst Item = styled.li`\n display: flex;\n margin: 6px;\n cursor: pointer;\n`;\n\nconst StyledButton = styled(DSButton)`\n &:not(:focus) {\n border-color: transparent;\n }\n`;\n\nexport { Container, Separator, Item, StyledButton };\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEA,MAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQzB,MAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOzB,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAMpB,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,59 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-mini-toolbar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - MiniToolbar",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
|
-
"import": "./esm/index.js",
|
|
12
|
-
"require": "./cjs/index.js"
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
13
16
|
},
|
|
14
17
|
"./styles": {
|
|
15
|
-
"import": "./esm/styles.js",
|
|
16
|
-
"require": "./cjs/styles.js"
|
|
18
|
+
"import": "./dist/esm/styles.js",
|
|
19
|
+
"require": "./dist/cjs/styles.js"
|
|
17
20
|
},
|
|
18
21
|
"./propTypes": {
|
|
19
|
-
"import": "./esm/propTypes.js",
|
|
20
|
-
"require": "./cjs/propTypes.js"
|
|
22
|
+
"import": "./dist/esm/propTypes.js",
|
|
23
|
+
"require": "./dist/cjs/propTypes.js"
|
|
21
24
|
},
|
|
22
25
|
"./hooks/useGenerateItems": {
|
|
23
|
-
"import": "./esm/hooks/useGenerateItems.js",
|
|
24
|
-
"require": "./cjs/hooks/useGenerateItems.js"
|
|
26
|
+
"import": "./dist/esm/hooks/useGenerateItems.js",
|
|
27
|
+
"require": "./dist/cjs/hooks/useGenerateItems.js"
|
|
25
28
|
},
|
|
26
29
|
"./Components/ToolbarShortcut": {
|
|
27
|
-
"import": "./esm/Components/ToolbarShortcut.js",
|
|
28
|
-
"require": "./cjs/Components/ToolbarShortcut.js"
|
|
30
|
+
"import": "./dist/esm/Components/ToolbarShortcut.js",
|
|
31
|
+
"require": "./dist/cjs/Components/ToolbarShortcut.js"
|
|
29
32
|
},
|
|
30
33
|
"./Components/outOfTheBox/Separator": {
|
|
31
|
-
"import": "./esm/Components/outOfTheBox/Separator.js",
|
|
32
|
-
"require": "./cjs/Components/outOfTheBox/Separator.js"
|
|
34
|
+
"import": "./dist/esm/Components/outOfTheBox/Separator.js",
|
|
35
|
+
"require": "./dist/cjs/Components/outOfTheBox/Separator.js"
|
|
33
36
|
},
|
|
34
37
|
"./Components/outOfTheBox/SearchBox": {
|
|
35
|
-
"import": "./esm/Components/outOfTheBox/SearchBox.js",
|
|
36
|
-
"require": "./cjs/Components/outOfTheBox/SearchBox.js"
|
|
38
|
+
"import": "./dist/esm/Components/outOfTheBox/SearchBox.js",
|
|
39
|
+
"require": "./dist/cjs/Components/outOfTheBox/SearchBox.js"
|
|
37
40
|
},
|
|
38
41
|
"./Components/outOfTheBox": {
|
|
39
|
-
"import": "./esm/Components/outOfTheBox/index.js",
|
|
40
|
-
"require": "./cjs/Components/outOfTheBox/index.js"
|
|
42
|
+
"import": "./dist/esm/Components/outOfTheBox/index.js",
|
|
43
|
+
"require": "./dist/cjs/Components/outOfTheBox/index.js"
|
|
41
44
|
},
|
|
42
45
|
"./Components/outOfTheBox/IconItem": {
|
|
43
|
-
"import": "./esm/Components/outOfTheBox/IconItem.js",
|
|
44
|
-
"require": "./cjs/Components/outOfTheBox/IconItem.js"
|
|
46
|
+
"import": "./dist/esm/Components/outOfTheBox/IconItem.js",
|
|
47
|
+
"require": "./dist/cjs/Components/outOfTheBox/IconItem.js"
|
|
45
48
|
},
|
|
46
49
|
"./Components/outOfTheBox/ComboBox": {
|
|
47
|
-
"import": "./esm/Components/outOfTheBox/ComboBox.js",
|
|
48
|
-
"require": "./cjs/Components/outOfTheBox/ComboBox.js"
|
|
50
|
+
"import": "./dist/esm/Components/outOfTheBox/ComboBox.js",
|
|
51
|
+
"require": "./dist/cjs/Components/outOfTheBox/ComboBox.js"
|
|
49
52
|
},
|
|
50
53
|
"./Components/outOfTheBox/Button": {
|
|
51
|
-
"import": "./esm/Components/outOfTheBox/Button.js",
|
|
52
|
-
"require": "./cjs/Components/outOfTheBox/Button.js"
|
|
54
|
+
"import": "./dist/esm/Components/outOfTheBox/Button.js",
|
|
55
|
+
"require": "./dist/cjs/Components/outOfTheBox/Button.js"
|
|
53
56
|
},
|
|
54
57
|
"./Components/MiniToolbar": {
|
|
55
|
-
"import": "./esm/Components/MiniToolbar.js",
|
|
56
|
-
"require": "./cjs/Components/MiniToolbar.js"
|
|
58
|
+
"import": "./dist/esm/Components/MiniToolbar.js",
|
|
59
|
+
"require": "./dist/cjs/Components/MiniToolbar.js"
|
|
57
60
|
}
|
|
58
61
|
},
|
|
59
62
|
"repository": {
|
|
@@ -61,22 +64,22 @@
|
|
|
61
64
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
62
65
|
},
|
|
63
66
|
"engines": {
|
|
64
|
-
"
|
|
65
|
-
"node": ">=
|
|
67
|
+
"pnpm": ">=6",
|
|
68
|
+
"node": ">=16"
|
|
66
69
|
},
|
|
67
70
|
"author": "ICE MT",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
71
|
+
"jestSonar": {
|
|
72
|
+
"sonar56x": true,
|
|
73
|
+
"reportPath": "reports",
|
|
74
|
+
"reportFile": "tests.xml",
|
|
75
|
+
"indent": 4
|
|
73
76
|
},
|
|
74
77
|
"dependencies": {
|
|
75
|
-
"@elliemae/ds-button": "
|
|
76
|
-
"@elliemae/ds-dropdownmenu": "
|
|
77
|
-
"@elliemae/ds-form": "
|
|
78
|
-
"@elliemae/ds-icons": "
|
|
79
|
-
"@elliemae/ds-system": "
|
|
78
|
+
"@elliemae/ds-button": "3.0.0-alpha.3",
|
|
79
|
+
"@elliemae/ds-dropdownmenu": "3.0.0-alpha.3",
|
|
80
|
+
"@elliemae/ds-form": "3.0.0-alpha.3",
|
|
81
|
+
"@elliemae/ds-icons": "3.0.0-alpha.3",
|
|
82
|
+
"@elliemae/ds-system": "3.0.0-alpha.3",
|
|
80
83
|
"react-desc": "~4.1.3",
|
|
81
84
|
"uid": "~2.0.0"
|
|
82
85
|
},
|
|
@@ -93,7 +96,13 @@
|
|
|
93
96
|
},
|
|
94
97
|
"publishConfig": {
|
|
95
98
|
"access": "public",
|
|
96
|
-
"
|
|
97
|
-
|
|
99
|
+
"typeSafety": false
|
|
100
|
+
},
|
|
101
|
+
"scripts": {
|
|
102
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
103
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
104
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
105
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
106
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
98
107
|
}
|
|
99
108
|
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
var reactDesc = require('react-desc');
|
|
9
|
-
var DSDropdownMenu = require('@elliemae/ds-dropdownmenu');
|
|
10
|
-
var dsIcons = require('@elliemae/ds-icons');
|
|
11
|
-
var styles = require('../styles.js');
|
|
12
|
-
var propTypes = require('../propTypes.js');
|
|
13
|
-
var useGenerateItems = require('../hooks/useGenerateItems.js');
|
|
14
|
-
|
|
15
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
-
|
|
17
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
|
-
var DSDropdownMenu__default = /*#__PURE__*/_interopDefaultLegacy(DSDropdownMenu);
|
|
19
|
-
|
|
20
|
-
const Elipsis = /*#__PURE__*/_jsx__default["default"](dsIcons.MoreOptionsVert, {
|
|
21
|
-
color: ['brand-primary', '600'],
|
|
22
|
-
size: "m"
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const MiniToolbar = _ref => {
|
|
26
|
-
let {
|
|
27
|
-
items,
|
|
28
|
-
overflowButtonProps
|
|
29
|
-
} = _ref;
|
|
30
|
-
const [shortcutItems, dropdownMenuItems] = useGenerateItems.useGenerateItems(items);
|
|
31
|
-
const [isDropdownMenuOpen, setIsDropdownMenuOpen] = react.useState(false);
|
|
32
|
-
const closeDropdownMenu = react.useCallback(() => setIsDropdownMenuOpen(false), []);
|
|
33
|
-
const openDropdownMenu = react.useCallback(() => setIsDropdownMenuOpen(true), []);
|
|
34
|
-
const openDropdownMenuKeyPress = react.useCallback(e => {
|
|
35
|
-
if (e.key === ' ') {
|
|
36
|
-
setIsDropdownMenuOpen(true);
|
|
37
|
-
}
|
|
38
|
-
}, []);
|
|
39
|
-
const {
|
|
40
|
-
ariaLabel,
|
|
41
|
-
style,
|
|
42
|
-
buttonType = 'secondary'
|
|
43
|
-
} = overflowButtonProps || {};
|
|
44
|
-
return /*#__PURE__*/_jsx__default["default"](styles.Container, {
|
|
45
|
-
role: "toolbar",
|
|
46
|
-
"data-testid": "ds-mini-toolbar"
|
|
47
|
-
}, void 0, shortcutItems, /*#__PURE__*/_jsx__default["default"](DSDropdownMenu__default["default"], {
|
|
48
|
-
"data-testid": "ds-mini-toolbar__dropdown-menu",
|
|
49
|
-
isOpen: isDropdownMenuOpen,
|
|
50
|
-
onSelectMenuItem: closeDropdownMenu,
|
|
51
|
-
onClickOutsideMenu: closeDropdownMenu,
|
|
52
|
-
options: dropdownMenuItems,
|
|
53
|
-
triggerComponent: /*#__PURE__*/_jsx__default["default"](styles.StyledButton, {
|
|
54
|
-
"aria-label": ariaLabel,
|
|
55
|
-
"data-testid": "ds-mini-toolbar__elipsis",
|
|
56
|
-
size: "m",
|
|
57
|
-
style: style,
|
|
58
|
-
buttonType: buttonType,
|
|
59
|
-
onClick: openDropdownMenu,
|
|
60
|
-
onKeyPress: openDropdownMenuKeyPress,
|
|
61
|
-
leftIcon: Elipsis
|
|
62
|
-
})
|
|
63
|
-
}));
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const MiniToolbarWithSchema = reactDesc.describe(MiniToolbar);
|
|
67
|
-
MiniToolbarWithSchema.propTypes = propTypes.miniToolbarProps;
|
|
68
|
-
|
|
69
|
-
exports.MiniToolbar = MiniToolbar;
|
|
70
|
-
exports.MiniToolbarWithSchema = MiniToolbarWithSchema;
|