@elliemae/ds-toolbar 2.2.0-next.6 → 2.3.0-alpha.1
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/cjs/DSToolbarItemV2.js +49 -44
- package/cjs/DSToolbarItemV2.js.map +7 -0
- package/cjs/DSToolbarSeparatorV2.js +38 -17
- package/cjs/DSToolbarSeparatorV2.js.map +7 -0
- package/cjs/DSToolbarV2.js +62 -69
- package/cjs/DSToolbarV2.js.map +7 -0
- package/cjs/DSToolbarV2Context.js +37 -10
- package/cjs/DSToolbarV2Context.js.map +7 -0
- package/cjs/deprecated/DSToolbar.js +86 -89
- package/cjs/deprecated/DSToolbar.js.map +7 -0
- package/cjs/deprecated/ToolbarDivider.js +39 -9
- package/cjs/deprecated/ToolbarDivider.js.map +7 -0
- package/cjs/deprecated/ToolbarGroup.js +48 -34
- package/cjs/deprecated/ToolbarGroup.js.map +7 -0
- package/cjs/deprecated/ToolbarItem.js +58 -54
- package/cjs/deprecated/ToolbarItem.js.map +7 -0
- package/cjs/deprecated/decorateToolbarChildren.js +39 -27
- package/cjs/deprecated/decorateToolbarChildren.js.map +7 -0
- package/cjs/deprecated/index.js +36 -17
- package/cjs/deprecated/index.js.map +7 -0
- package/cjs/index.js +39 -24
- package/cjs/index.js.map +7 -0
- package/cjs/props.js +39 -12
- package/cjs/props.js.map +7 -0
- package/cjs/styled.js +51 -22
- package/cjs/styled.js.map +7 -0
- package/cjs/useToolbarItemHandlers.js +48 -28
- package/cjs/useToolbarItemHandlers.js.map +7 -0
- package/esm/DSToolbarItemV2.js +17 -33
- package/esm/DSToolbarItemV2.js.map +7 -0
- package/esm/DSToolbarSeparatorV2.js +9 -9
- package/esm/DSToolbarSeparatorV2.js.map +7 -0
- package/esm/DSToolbarV2.js +29 -54
- package/esm/DSToolbarV2.js.map +7 -0
- package/esm/DSToolbarV2Context.js +8 -6
- package/esm/DSToolbarV2Context.js.map +7 -0
- package/esm/deprecated/DSToolbar.js +57 -73
- package/esm/deprecated/DSToolbar.js.map +7 -0
- package/esm/deprecated/ToolbarDivider.js +10 -7
- package/esm/deprecated/ToolbarDivider.js.map +7 -0
- package/esm/deprecated/ToolbarGroup.js +21 -30
- package/esm/deprecated/ToolbarGroup.js.map +7 -0
- package/esm/deprecated/ToolbarItem.js +27 -43
- package/esm/deprecated/ToolbarItem.js.map +7 -0
- package/esm/deprecated/decorateToolbarChildren.js +11 -21
- package/esm/deprecated/decorateToolbarChildren.js.map +7 -0
- package/esm/deprecated/index.js +7 -4
- package/esm/deprecated/index.js.map +7 -0
- package/esm/index.js +10 -7
- package/esm/index.js.map +7 -0
- package/esm/props.js +10 -8
- package/esm/props.js.map +7 -0
- package/esm/styled.js +23 -12
- package/esm/styled.js.map +7 -0
- package/esm/useToolbarItemHandlers.js +19 -24
- package/esm/useToolbarItemHandlers.js.map +7 -0
- package/package.json +10 -10
- package/types/deprecated/DSToolbar.d.ts +1 -10
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const blockName =
|
|
7
|
-
const ToolbarGroupContainer = aggregatedClasses(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let {
|
|
18
|
-
children,
|
|
19
|
-
size,
|
|
20
|
-
space = 0
|
|
21
|
-
} = _ref2;
|
|
22
|
-
return /*#__PURE__*/_jsx(ToolbarGroupContainer, {
|
|
23
|
-
classProps: {
|
|
24
|
-
space
|
|
25
|
-
}
|
|
26
|
-
}, void 0, decorateToolbarChildren(children, {
|
|
27
|
-
size
|
|
28
|
-
}));
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
5
|
+
import decorateToolbarChildren from "./decorateToolbarChildren";
|
|
6
|
+
const blockName = "toolbar-group";
|
|
7
|
+
const ToolbarGroupContainer = aggregatedClasses("div")(blockName, null, ({ space }) => ({
|
|
8
|
+
[`space-${space}`]: !!space
|
|
9
|
+
}));
|
|
10
|
+
const ToolbarGroup = ({ children, size, space = 0 }) => /* @__PURE__ */ React2.createElement(ToolbarGroupContainer, {
|
|
11
|
+
classProps: { space }
|
|
12
|
+
}, decorateToolbarChildren(children, { size }));
|
|
13
|
+
ToolbarGroup.propTypes = {
|
|
14
|
+
children: PropTypes.any,
|
|
15
|
+
size: PropTypes.number,
|
|
16
|
+
space: PropTypes.number
|
|
29
17
|
};
|
|
30
|
-
|
|
31
|
-
export {
|
|
18
|
+
var ToolbarGroup_default = ToolbarGroup;
|
|
19
|
+
export {
|
|
20
|
+
ToolbarGroup_default as default
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=ToolbarGroup.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/ToolbarGroup.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport decorateToolbarChildren from './decorateToolbarChildren';\n\nconst blockName = 'toolbar-group';\n\nconst ToolbarGroupContainer = aggregatedClasses('div')(\n blockName,\n null,\n ({ space }) => ({\n [`space-${space}`]: !!space,\n }),\n);\n\nconst ToolbarGroup = ({ children, size, space = 0 }) => (\n <ToolbarGroupContainer classProps={{ space }}>\n {decorateToolbarChildren(children, { size })}\n </ToolbarGroupContainer>\n);\n\nToolbarGroup.propTypes = {\n children: PropTypes.any,\n size: PropTypes.number,\n space: PropTypes.number,\n};\n\nexport default ToolbarGroup;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,YAAY;AAElB,MAAM,wBAAwB,kBAAkB,OAC9C,WACA,MACA,CAAC,EAAE,YAAa;AAAA,GACb,SAAS,UAAU,CAAC,CAAC;AAAA;AAI1B,MAAM,eAAe,CAAC,EAAE,UAAU,MAAM,QAAQ,QAC9C,qCAAC,uBAAD;AAAA,EAAuB,YAAY,EAAE;AAAA,GAClC,wBAAwB,UAAU,EAAE;AAIzC,aAAa,YAAY;AAAA,EACvB,UAAU,UAAU;AAAA,EACpB,MAAM,UAAU;AAAA,EAChB,OAAO,UAAU;AAAA;AAGnB,IAAO,uBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,51 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
9
|
-
import React, { useState } from 'react';
|
|
10
|
-
import { useFocusGroupWithState } from '@elliemae/ds-shared/FocusGroup';
|
|
11
|
-
import DSButton from '@elliemae/ds-button';
|
|
12
|
-
import { PopperPositions } from '@elliemae/ds-popper';
|
|
13
|
-
import { jsx } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
const _excluded = ["icon", "labelText", "menu"];
|
|
16
|
-
|
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
-
|
|
19
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
-
|
|
21
|
-
const ToolbarItem = _ref => {
|
|
22
|
-
let {
|
|
23
|
-
icon,
|
|
24
|
-
labelText,
|
|
25
|
-
menu = undefined
|
|
26
|
-
} = _ref,
|
|
27
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useState } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { useFocusGroupWithState } from "@elliemae/ds-shared/FocusGroup";
|
|
5
|
+
import DSButton from "@elliemae/ds-button";
|
|
6
|
+
import { PopperPositions as Position } from "@elliemae/ds-popper";
|
|
7
|
+
const ToolbarItem = ({ icon, labelText, menu = void 0, ...otherProps }) => {
|
|
29
8
|
const [ref, setRef] = useState(null);
|
|
30
9
|
useFocusGroupWithState(ref);
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
const btn = /* @__PURE__ */ React2.createElement(DSButton, {
|
|
11
|
+
...otherProps,
|
|
33
12
|
buttonType: "text",
|
|
34
|
-
icon
|
|
35
|
-
innerRef: r => setRef(r),
|
|
36
|
-
labelText
|
|
37
|
-
})
|
|
38
|
-
|
|
13
|
+
icon,
|
|
14
|
+
innerRef: (r) => setRef(r),
|
|
15
|
+
labelText
|
|
16
|
+
});
|
|
39
17
|
if (menu) {
|
|
40
|
-
return
|
|
41
|
-
|
|
18
|
+
return React2.cloneElement(menu, {
|
|
19
|
+
...menu.props,
|
|
20
|
+
placement: Position.BOTTOM_END,
|
|
42
21
|
triggerComponent: btn
|
|
43
|
-
})
|
|
22
|
+
});
|
|
44
23
|
}
|
|
45
|
-
|
|
46
24
|
return btn;
|
|
47
25
|
};
|
|
48
|
-
|
|
49
|
-
ToolbarItem.
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
ToolbarItem.displayName = "ToolbarItem";
|
|
27
|
+
ToolbarItem.propTypes = {
|
|
28
|
+
icon: PropTypes.element,
|
|
29
|
+
labelText: PropTypes.string
|
|
30
|
+
};
|
|
31
|
+
var ToolbarItem_default = ToolbarItem;
|
|
32
|
+
export {
|
|
33
|
+
ToolbarItem_default as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=ToolbarItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/ToolbarItem.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useFocusGroupWithState } from '@elliemae/ds-shared/FocusGroup';\nimport DSButton from '@elliemae/ds-button';\nimport { PopperPositions as Position } from '@elliemae/ds-popper';\n\nconst ToolbarItem = ({ icon, labelText, menu = undefined, ...otherProps }) => {\n const [ref, setRef] = useState(null);\n\n useFocusGroupWithState(ref);\n const btn = (\n <DSButton {...otherProps} buttonType=\"text\" icon={icon} innerRef={(r) => setRef(r)} labelText={labelText} />\n );\n if (menu) {\n return React.cloneElement(menu, {\n ...menu.props,\n placement: Position.BOTTOM_END,\n triggerComponent: btn,\n });\n }\n return btn;\n};\n\nToolbarItem.displayName = 'ToolbarItem';\n\nToolbarItem.propTypes = {\n icon: PropTypes.element,\n labelText: PropTypes.string,\n};\n\nexport default ToolbarItem;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA,MAAM,cAAc,CAAC,EAAE,MAAM,WAAW,OAAO,WAAc,iBAAiB;AAC5E,QAAM,CAAC,KAAK,UAAU,SAAS;AAE/B,yBAAuB;AACvB,QAAM,MACJ,qCAAC,UAAD;AAAA,OAAc;AAAA,IAAY,YAAW;AAAA,IAAO;AAAA,IAAY,UAAU,CAAC,MAAM,OAAO;AAAA,IAAI;AAAA;AAEtF,MAAI,MAAM;AACR,WAAO,OAAM,aAAa,MAAM;AAAA,SAC3B,KAAK;AAAA,MACR,WAAW,SAAS;AAAA,MACpB,kBAAkB;AAAA;AAAA;AAGtB,SAAO;AAAA;AAGT,YAAY,cAAc;AAE1B,YAAY,YAAY;AAAA,EACtB,MAAM,UAAU;AAAA,EAChB,WAAW,UAAU;AAAA;AAGvB,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
-
var decorateToolbarChildren = (function (children) {
|
|
15
|
-
let extraProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
16
|
-
return React.Children.map(children, component => component ? /*#__PURE__*/cloneElement(component, _objectSpread(_objectSpread(_objectSpread({}, extraProps), component.props), {}, {
|
|
17
|
-
className: "".concat(component.props.className, " toolbar-item")
|
|
18
|
-
})) : component, null);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export { decorateToolbarChildren as default };
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { cloneElement } from "react";
|
|
3
|
+
var decorateToolbarChildren_default = (children, extraProps = {}) => React2.Children.map(children, (component) => component ? cloneElement(component, {
|
|
4
|
+
...extraProps,
|
|
5
|
+
...component.props,
|
|
6
|
+
className: `${component.props.className} toolbar-item`
|
|
7
|
+
}) : component, null);
|
|
8
|
+
export {
|
|
9
|
+
decorateToolbarChildren_default as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=decorateToolbarChildren.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/decorateToolbarChildren.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { cloneElement } from 'react';\n\nexport default (children, extraProps = {}) =>\n React.Children.map(\n children,\n component =>\n component\n ? cloneElement(component, {\n ...extraProps,\n ...component.props,\n className: `${component.props.className} toolbar-item`,\n })\n : component,\n null,\n );\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA,IAAO,kCAAQ,CAAC,UAAU,aAAa,OACrC,OAAM,SAAS,IACb,UACA,eACE,YACI,aAAa,WAAW;AAAA,KACnB;AAAA,KACA,UAAU;AAAA,EACb,WAAW,GAAG,UAAU,MAAM;AAAA,KAEhC,WACN;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/deprecated/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export * from "./DSToolbar";
|
|
3
|
+
import { default as default2 } from "./DSToolbar";
|
|
4
|
+
export {
|
|
5
|
+
default2 as default
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable import/export */\nexport * from './DSToolbar';\n\nexport { default } from './DSToolbar';\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AAEA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export * from "./deprecated";
|
|
3
|
+
import { default as default2 } from "./deprecated";
|
|
4
|
+
export * from "./DSToolbarV2";
|
|
5
|
+
export * from "./DSToolbarItemV2";
|
|
6
|
+
export * from "./DSToolbarSeparatorV2";
|
|
7
|
+
export {
|
|
8
|
+
default2 as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -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 * from './deprecated';\nexport { default } from './deprecated';\nexport * from './DSToolbarV2';\nexport * from './DSToolbarItemV2';\nexport * from './DSToolbarSeparatorV2';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/props.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes } from "react-desc";
|
|
3
3
|
const DSToolbarV2Schema = {
|
|
4
|
-
alignment: PropTypes.oneOf([
|
|
5
|
-
withDepth: PropTypes.bool.description(
|
|
6
|
-
compact: PropTypes.bool.description(
|
|
7
|
-
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description(
|
|
4
|
+
alignment: PropTypes.oneOf(["right", "left"]).description("Whether to align the content left or right").defaultValue("right"),
|
|
5
|
+
withDepth: PropTypes.bool.description("Whether to add a box-shadow to the container").defaultValue(true),
|
|
6
|
+
compact: PropTypes.bool.description("Whether you want the compact version of the toolbar").defaultValue(false),
|
|
7
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description("Reference to attach to the wrapper")
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export {
|
|
10
|
+
DSToolbarV2Schema
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=props.js.map
|
package/esm/props.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/props.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\n\nexport const DSToolbarV2Schema = {\n alignment: PropTypes.oneOf(['right', 'left'])\n .description('Whether to align the content left or right')\n .defaultValue('right'),\n withDepth: PropTypes.bool.description('Whether to add a box-shadow to the container').defaultValue(true),\n compact: PropTypes.bool.description('Whether you want the compact version of the toolbar').defaultValue(false),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Reference to attach to the wrapper'),\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,oBAAoB;AAAA,EAC/B,WAAW,UAAU,MAAM,CAAC,SAAS,SAClC,YAAY,8CACZ,aAAa;AAAA,EAChB,WAAW,UAAU,KAAK,YAAY,gDAAgD,aAAa;AAAA,EACnG,SAAS,UAAU,KAAK,YAAY,uDAAuD,aAAa;AAAA,EACxG,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,SAAS,YAAY;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/styled.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import Grid from "@elliemae/ds-grid";
|
|
4
|
+
const StyledToolbarWrapper = styled(Grid)`
|
|
5
|
+
background-color: ${(props) => props.theme.colors.neutral["000"]};
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
})(["background-color:", ";min-height:", ";max-height:", ";padding:0 ", ";box-shadow:", ";"], props => props.theme.colors.neutral['000'], props => props.compact ? '28px' : '40px', props => props.theme.space.xxl, props => props.theme.space.xxs, props => !props.withDepth ? 'none' : '0 1px 5px 0 rgb(0 0 0 / 13%), 0 2px 4px 0 rgb(0 0 0 / 20%)');
|
|
7
|
-
const StyledToolbarItem = /*#__PURE__*/styled(Grid).withConfig({
|
|
8
|
-
componentId: "sc-8ez8n4-1"
|
|
9
|
-
})([""]);
|
|
10
|
-
const StyledSeparator = /*#__PURE__*/styled(Grid).withConfig({
|
|
11
|
-
componentId: "sc-8ez8n4-2"
|
|
12
|
-
})(["height:30px;width:1px;background-color:", ";"], props => props.theme.colors.neutral[200]);
|
|
7
|
+
min-height: ${(props) => props.compact ? "28px" : "40px"};
|
|
8
|
+
max-height: ${(props) => props.theme.space.xxl};
|
|
13
9
|
|
|
14
|
-
|
|
10
|
+
padding: 0 ${(props) => props.theme.space.xxs};
|
|
11
|
+
|
|
12
|
+
box-shadow: ${(props) => !props.withDepth ? "none" : "0 1px 5px 0 rgb(0 0 0 / 13%), 0 2px 4px 0 rgb(0 0 0 / 20%)"};
|
|
13
|
+
`;
|
|
14
|
+
const StyledToolbarItem = styled(Grid)``;
|
|
15
|
+
const StyledSeparator = styled(Grid)`
|
|
16
|
+
height: 30px;
|
|
17
|
+
width: 1px;
|
|
18
|
+
background-color: ${(props) => props.theme.colors.neutral[200]};
|
|
19
|
+
`;
|
|
20
|
+
export {
|
|
21
|
+
StyledSeparator,
|
|
22
|
+
StyledToolbarItem,
|
|
23
|
+
StyledToolbarWrapper
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\nimport Grid from '@elliemae/ds-grid';\n\nexport const StyledToolbarWrapper = styled(Grid)`\n background-color: ${(props) => props.theme.colors.neutral['000']};\n\n min-height: ${(props) => (props.compact ? '28px' : '40px')};\n max-height: ${(props) => props.theme.space.xxl};\n\n padding: 0 ${(props) => props.theme.space.xxs};\n\n box-shadow: ${(props) => (!props.withDepth ? 'none' : '0 1px 5px 0 rgb(0 0 0 / 13%), 0 2px 4px 0 rgb(0 0 0 / 20%)')};\n`;\n\nexport const StyledToolbarItem = styled(Grid)``;\n\nexport const StyledSeparator = styled(Grid)`\n height: 30px;\n width: 1px;\n background-color: ${(props) => props.theme.colors.neutral[200]};\n`;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,uBAAuB,OAAO;AAAA,sBACrB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAAA,gBAE5C,CAAC,UAAW,MAAM,UAAU,SAAS;AAAA,gBACrC,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,eAE9B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,gBAE5B,CAAC,UAAW,CAAC,MAAM,YAAY,SAAS;AAAA;AAGjD,MAAM,oBAAoB,OAAO;AAEjC,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA,sBAGhB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { DSToolbarV2Context } from
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const {
|
|
7
|
-
toolbarUid
|
|
8
|
-
itemReferences
|
|
9
|
-
} = useContext(DSToolbarV2Context);
|
|
10
|
-
const onKeyDown = useCallback(e => {
|
|
11
|
-
const toolbarItems = [...document.querySelectorAll("#".concat(toolbarUid, " .ds-toolbar-item"))];
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useCallback, useContext } from "react";
|
|
3
|
+
import { DSToolbarV2Context } from "./DSToolbarV2Context";
|
|
4
|
+
const useToolbarItemHandlers = (toolbarItemId) => {
|
|
5
|
+
const { toolbarUid, itemReferences } = useContext(DSToolbarV2Context);
|
|
6
|
+
const onKeyDown = useCallback((e) => {
|
|
7
|
+
const toolbarItems = [...document.querySelectorAll(`#${toolbarUid} .ds-toolbar-item`)];
|
|
12
8
|
let nextToolbarItemIndex = -1;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} else if (e.code === 'Home') {
|
|
9
|
+
if (["ArrowLeft", "ArrowRight"].includes(e.code)) {
|
|
10
|
+
const toolbarItemIndex = toolbarItems.findIndex((domElem) => domElem.id === toolbarItemId);
|
|
11
|
+
nextToolbarItemIndex = toolbarItemIndex + (e.code === "ArrowLeft" ? -1 : 1);
|
|
12
|
+
} else if (e.code === "Home") {
|
|
18
13
|
nextToolbarItemIndex = 0;
|
|
19
|
-
} else if (e.code ===
|
|
14
|
+
} else if (e.code === "End") {
|
|
20
15
|
nextToolbarItemIndex = toolbarItems.length - 1;
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
if (nextToolbarItemIndex >= 0 && nextToolbarItemIndex < toolbarItems.length) {
|
|
24
18
|
e.preventDefault();
|
|
25
19
|
e.stopPropagation();
|
|
26
20
|
const ref = itemReferences[toolbarItems[nextToolbarItemIndex].id];
|
|
27
|
-
if (ref.current)
|
|
21
|
+
if (ref.current)
|
|
22
|
+
ref.current.focus();
|
|
28
23
|
}
|
|
29
24
|
}, [toolbarUid, toolbarItemId, itemReferences]);
|
|
30
|
-
return {
|
|
31
|
-
onKeyDown
|
|
32
|
-
};
|
|
25
|
+
return { onKeyDown };
|
|
33
26
|
};
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
export {
|
|
28
|
+
useToolbarItemHandlers
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=useToolbarItemHandlers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/useToolbarItemHandlers.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useContext } from 'react';\nimport { DSToolbarV2Context } from './DSToolbarV2Context';\n\nexport const useToolbarItemHandlers = (\n toolbarItemId: string,\n): {\n onKeyDown: React.KeyboardEventHandler;\n} => {\n const { toolbarUid, itemReferences } = useContext(DSToolbarV2Context);\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n const toolbarItems = [...document.querySelectorAll(`#${toolbarUid} .ds-toolbar-item`)];\n let nextToolbarItemIndex = -1;\n\n if (['ArrowLeft', 'ArrowRight'].includes(e.code)) {\n const toolbarItemIndex = toolbarItems.findIndex((domElem) => domElem.id === toolbarItemId);\n nextToolbarItemIndex = toolbarItemIndex + (e.code === 'ArrowLeft' ? -1 : 1);\n } else if (e.code === 'Home') {\n nextToolbarItemIndex = 0;\n } else if (e.code === 'End') {\n nextToolbarItemIndex = toolbarItems.length - 1;\n }\n\n if (nextToolbarItemIndex >= 0 && nextToolbarItemIndex < toolbarItems.length) {\n e.preventDefault();\n e.stopPropagation();\n const ref = itemReferences[toolbarItems[nextToolbarItemIndex].id];\n if (ref.current) ref.current.focus();\n }\n },\n [toolbarUid, toolbarItemId, itemReferences],\n );\n\n return { onKeyDown };\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,yBAAyB,CACpC,kBAGG;AACH,QAAM,EAAE,YAAY,mBAAmB,WAAW;AAElD,QAAM,YAAwC,YAC5C,CAAC,MAAM;AACL,UAAM,eAAe,CAAC,GAAG,SAAS,iBAAiB,IAAI;AACvD,QAAI,uBAAuB;AAE3B,QAAI,CAAC,aAAa,cAAc,SAAS,EAAE,OAAO;AAChD,YAAM,mBAAmB,aAAa,UAAU,CAAC,YAAY,QAAQ,OAAO;AAC5E,6BAAuB,mBAAoB,GAAE,SAAS,cAAc,KAAK;AAAA,eAChE,EAAE,SAAS,QAAQ;AAC5B,6BAAuB;AAAA,eACd,EAAE,SAAS,OAAO;AAC3B,6BAAuB,aAAa,SAAS;AAAA;AAG/C,QAAI,wBAAwB,KAAK,uBAAuB,aAAa,QAAQ;AAC3E,QAAE;AACF,QAAE;AACF,YAAM,MAAM,eAAe,aAAa,sBAAsB;AAC9D,UAAI,IAAI;AAAS,YAAI,QAAQ;AAAA;AAAA,KAGjC,CAAC,YAAY,eAAe;AAG9B,SAAO,EAAE;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-toolbar",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-alpha.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Toolbar",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -84,15 +84,15 @@
|
|
|
84
84
|
"build": "node ../../scripts/build/build.js"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@elliemae/ds-button": "2.
|
|
88
|
-
"@elliemae/ds-classnames": "2.
|
|
89
|
-
"@elliemae/ds-grid": "2.
|
|
90
|
-
"@elliemae/ds-icons": "2.
|
|
91
|
-
"@elliemae/ds-popper": "2.
|
|
92
|
-
"@elliemae/ds-props-helpers": "2.
|
|
93
|
-
"@elliemae/ds-shared": "2.
|
|
94
|
-
"@elliemae/ds-system": "2.
|
|
95
|
-
"@elliemae/ds-utilities": "2.
|
|
87
|
+
"@elliemae/ds-button": "2.3.0-alpha.1",
|
|
88
|
+
"@elliemae/ds-classnames": "2.3.0-alpha.1",
|
|
89
|
+
"@elliemae/ds-grid": "2.3.0-alpha.1",
|
|
90
|
+
"@elliemae/ds-icons": "2.3.0-alpha.1",
|
|
91
|
+
"@elliemae/ds-popper": "2.3.0-alpha.1",
|
|
92
|
+
"@elliemae/ds-props-helpers": "2.3.0-alpha.1",
|
|
93
|
+
"@elliemae/ds-shared": "2.3.0-alpha.1",
|
|
94
|
+
"@elliemae/ds-system": "2.3.0-alpha.1",
|
|
95
|
+
"@elliemae/ds-utilities": "2.3.0-alpha.1",
|
|
96
96
|
"prop-types": "~15.7.2",
|
|
97
97
|
"react-desc": "~4.1.3",
|
|
98
98
|
"uid": "2.0.0"
|
|
@@ -43,16 +43,7 @@ declare const DSToolbar: {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
declare const ToolbarWithSchema: {
|
|
46
|
-
(props?:
|
|
47
|
-
[x: string]: any;
|
|
48
|
-
containerProps?: {} | undefined;
|
|
49
|
-
innerRef: any;
|
|
50
|
-
withDepth?: boolean | undefined;
|
|
51
|
-
alignment?: string | undefined;
|
|
52
|
-
autoFocusOnMount?: boolean | undefined;
|
|
53
|
-
children?: never[] | undefined;
|
|
54
|
-
size?: string | undefined;
|
|
55
|
-
} | undefined): JSX.Element;
|
|
46
|
+
(props?: unknown): JSX.Element;
|
|
56
47
|
propTypes: unknown;
|
|
57
48
|
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
58
49
|
};
|