@elliemae/ds-toolbar 2.2.0-alpha.4 → 3.0.0-next.2
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 +44 -49
- package/cjs/DSToolbarSeparatorV2.js +17 -38
- package/cjs/DSToolbarV2.js +69 -62
- package/cjs/DSToolbarV2Context.js +10 -37
- package/cjs/deprecated/DSToolbar.js +89 -86
- package/cjs/deprecated/ToolbarDivider.js +9 -39
- package/cjs/deprecated/ToolbarGroup.js +34 -48
- package/cjs/deprecated/ToolbarItem.js +54 -58
- package/cjs/deprecated/decorateToolbarChildren.js +27 -39
- package/cjs/deprecated/index.js +17 -36
- package/cjs/index.js +24 -39
- package/cjs/props.js +12 -39
- package/cjs/styled.js +22 -51
- package/cjs/useToolbarItemHandlers.js +28 -48
- package/esm/DSToolbarItemV2.js +33 -17
- package/esm/DSToolbarSeparatorV2.js +9 -9
- package/esm/DSToolbarV2.js +54 -29
- package/esm/DSToolbarV2Context.js +6 -8
- package/esm/deprecated/DSToolbar.js +73 -57
- package/esm/deprecated/ToolbarDivider.js +7 -10
- package/esm/deprecated/ToolbarGroup.js +30 -21
- package/esm/deprecated/ToolbarItem.js +43 -27
- package/esm/deprecated/decorateToolbarChildren.js +21 -11
- package/esm/deprecated/index.js +4 -7
- package/esm/index.js +7 -10
- package/esm/props.js +8 -10
- package/esm/styled.js +12 -23
- package/esm/useToolbarItemHandlers.js +24 -19
- package/package.json +10 -10
- package/cjs/DSToolbarItemV2.js.map +0 -7
- package/cjs/DSToolbarSeparatorV2.js.map +0 -7
- package/cjs/DSToolbarV2.js.map +0 -7
- package/cjs/DSToolbarV2Context.js.map +0 -7
- package/cjs/deprecated/DSToolbar.js.map +0 -7
- package/cjs/deprecated/ToolbarDivider.js.map +0 -7
- package/cjs/deprecated/ToolbarGroup.js.map +0 -7
- package/cjs/deprecated/ToolbarItem.js.map +0 -7
- package/cjs/deprecated/decorateToolbarChildren.js.map +0 -7
- package/cjs/deprecated/index.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/props.js.map +0 -7
- package/cjs/styled.js.map +0 -7
- package/cjs/useToolbarItemHandlers.js.map +0 -7
- package/esm/DSToolbarItemV2.js.map +0 -7
- package/esm/DSToolbarSeparatorV2.js.map +0 -7
- package/esm/DSToolbarV2.js.map +0 -7
- package/esm/DSToolbarV2Context.js.map +0 -7
- package/esm/deprecated/DSToolbar.js.map +0 -7
- package/esm/deprecated/ToolbarDivider.js.map +0 -7
- package/esm/deprecated/ToolbarGroup.js.map +0 -7
- package/esm/deprecated/ToolbarItem.js.map +0 -7
- package/esm/deprecated/decorateToolbarChildren.js.map +0 -7
- package/esm/deprecated/index.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/props.js.map +0 -7
- package/esm/styled.js.map +0 -7
- package/esm/useToolbarItemHandlers.js.map +0 -7
package/esm/DSToolbarItemV2.js
CHANGED
|
@@ -1,26 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import { useContext, useRef, useMemo } from 'react';
|
|
8
|
+
import { uid } from 'uid';
|
|
9
|
+
import { DSToolbarV2Context } from './DSToolbarV2Context.js';
|
|
10
|
+
import { StyledToolbarItem } from './styled.js';
|
|
11
|
+
import { useToolbarItemHandlers } from './useToolbarItemHandlers.js';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
const DSToolbarItemV2 = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
render
|
|
20
|
+
} = _ref;
|
|
21
|
+
const {
|
|
22
|
+
registerReference
|
|
23
|
+
} = useContext(DSToolbarV2Context);
|
|
9
24
|
const ref = useRef(null);
|
|
10
25
|
const toolbarItemId = useMemo(() => {
|
|
11
|
-
const id =
|
|
26
|
+
const id = "ds-toolbar-item-".concat(uid());
|
|
12
27
|
registerReference(id, ref);
|
|
13
28
|
return id;
|
|
14
29
|
}, [registerReference, ref]);
|
|
15
30
|
const handlers = useToolbarItemHandlers(toolbarItemId);
|
|
16
|
-
return
|
|
31
|
+
return /*#__PURE__*/jsx(StyledToolbarItem, _objectSpread(_objectSpread({
|
|
17
32
|
id: toolbarItemId,
|
|
18
33
|
"data-testid": "ds-toolbar-item",
|
|
19
|
-
className: "ds-toolbar-item"
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
className: "ds-toolbar-item"
|
|
35
|
+
}, handlers), {}, {
|
|
36
|
+
children: render({
|
|
37
|
+
innerRef: ref
|
|
38
|
+
})
|
|
39
|
+
}));
|
|
22
40
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=DSToolbarItemV2.js.map
|
|
41
|
+
|
|
42
|
+
export { DSToolbarItemV2 };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { StyledSeparator } from
|
|
4
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { StyledSeparator } from './styled.js';
|
|
4
|
+
|
|
5
|
+
var _StyledSeparator;
|
|
6
|
+
const DSToolbarSeparatorV2 = () => _StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
|
|
5
7
|
className: "ds-toolbar-separator"
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=DSToolbarSeparatorV2.js.map
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
export { DSToolbarSeparatorV2 };
|
package/esm/DSToolbarV2.js
CHANGED
|
@@ -1,44 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
11
|
+
import React, { useMemo, useState, useCallback } from 'react';
|
|
12
|
+
import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
13
|
+
import { describe } from 'react-desc';
|
|
14
|
+
import { uid } from 'uid';
|
|
15
|
+
import { DSToolbarV2Context } from './DSToolbarV2Context.js';
|
|
16
|
+
import { DSToolbarV2Schema } from './props.js';
|
|
17
|
+
import { StyledToolbarWrapper } from './styled.js';
|
|
18
|
+
import { jsx } from 'react/jsx-runtime';
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
const DSToolbarV2 = props => {
|
|
25
|
+
const {
|
|
26
|
+
alignment,
|
|
27
|
+
withDepth,
|
|
28
|
+
compact,
|
|
29
|
+
innerRef,
|
|
30
|
+
children
|
|
31
|
+
} = props;
|
|
11
32
|
useValidateTypescriptPropTypes(props, DSToolbarV2Schema);
|
|
12
|
-
const toolbarUid = useMemo(() =>
|
|
33
|
+
const toolbarUid = useMemo(() => "ds-toolbar-".concat(uid()), []);
|
|
13
34
|
const [itemReferences, setItemReferences] = useState({});
|
|
14
35
|
const registerReference = useCallback((itemId, ref) => {
|
|
15
|
-
setItemReferences(
|
|
36
|
+
setItemReferences(prevItemReferences => _objectSpread(_objectSpread({}, prevItemReferences), {}, {
|
|
37
|
+
[itemId]: ref
|
|
38
|
+
}));
|
|
16
39
|
}, [setItemReferences]);
|
|
17
|
-
return
|
|
18
|
-
value: {
|
|
19
|
-
|
|
40
|
+
return /*#__PURE__*/_jsx(DSToolbarV2Context.Provider, {
|
|
41
|
+
value: {
|
|
42
|
+
toolbarUid,
|
|
43
|
+
registerReference,
|
|
44
|
+
itemReferences
|
|
45
|
+
}
|
|
46
|
+
}, void 0, /*#__PURE__*/jsx(StyledToolbarWrapper, {
|
|
20
47
|
role: "toolbar",
|
|
21
48
|
"data-testid": "ds-toolbar-wrapper",
|
|
22
49
|
id: toolbarUid,
|
|
23
50
|
alignItems: "center",
|
|
24
|
-
justifyContent: alignment ===
|
|
25
|
-
withDepth,
|
|
26
|
-
cols:
|
|
51
|
+
justifyContent: alignment === 'left' ? 'flex-start' : 'flex-end',
|
|
52
|
+
withDepth: withDepth,
|
|
53
|
+
cols: React.Children.map(children, () => ['auto']),
|
|
27
54
|
gutter: "xxs2",
|
|
28
|
-
compact,
|
|
29
|
-
ref: innerRef
|
|
30
|
-
|
|
55
|
+
compact: compact,
|
|
56
|
+
ref: innerRef,
|
|
57
|
+
children: children
|
|
58
|
+
}));
|
|
31
59
|
};
|
|
32
|
-
|
|
60
|
+
|
|
33
61
|
DSToolbarV2.defaultProps = {
|
|
34
|
-
alignment:
|
|
62
|
+
alignment: 'right',
|
|
35
63
|
withDepth: true,
|
|
36
64
|
compact: false
|
|
37
65
|
};
|
|
38
|
-
const DSToolbarV2WithSchema = describe(DSToolbarV2).description(
|
|
66
|
+
const DSToolbarV2WithSchema = describe(DSToolbarV2).description('Toolbar');
|
|
39
67
|
DSToolbarV2WithSchema.propTypes = DSToolbarV2Schema;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
DSToolbarV2WithSchema
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=DSToolbarV2.js.map
|
|
68
|
+
|
|
69
|
+
export { DSToolbarV2, DSToolbarV2WithSchema };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const DSToolbarV2Context = createContext({
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const DSToolbarV2Context = /*#__PURE__*/createContext({
|
|
4
4
|
registerReference: () => null,
|
|
5
5
|
itemReferences: {},
|
|
6
|
-
toolbarUid:
|
|
6
|
+
toolbarUid: ''
|
|
7
7
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=DSToolbarV2Context.js.map
|
|
8
|
+
|
|
9
|
+
export { DSToolbarV2Context };
|
|
@@ -1,67 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import { useRef } from 'react';
|
|
10
|
+
import { PropTypes, describe } from 'react-desc';
|
|
11
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
12
|
+
import FocusGroupProvider from '@elliemae/ds-shared/FocusGroup/FocusGroupManager';
|
|
13
|
+
import { mergeRefs } from '@elliemae/ds-utilities';
|
|
14
|
+
import decorateToolbarChildren from './decorateToolbarChildren.js';
|
|
15
|
+
export { default as ToolbarItem } from './ToolbarItem.js';
|
|
16
|
+
export { default as ToolbarGroup } from './ToolbarGroup.js';
|
|
17
|
+
export { default as ToolbarDivider } from './ToolbarDivider.js';
|
|
18
|
+
import { jsx } from 'react/jsx-runtime';
|
|
19
|
+
|
|
20
|
+
const _excluded = ["containerProps", "innerRef", "withDepth", "alignment", "autoFocusOnMount", "children", "size"];
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
const blockName = 'toolbar';
|
|
26
|
+
const ToolbarContainer = aggregatedClasses('div')(blockName, null, _ref => {
|
|
27
|
+
let {
|
|
28
|
+
withDepth,
|
|
29
|
+
alignment,
|
|
30
|
+
size
|
|
31
|
+
} = _ref;
|
|
32
|
+
return {
|
|
33
|
+
'without-depth': !withDepth,
|
|
34
|
+
[alignment]: !!alignment,
|
|
35
|
+
[size]: size
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const DSToolbar = _ref2 => {
|
|
40
|
+
let {
|
|
41
|
+
containerProps = {},
|
|
42
|
+
innerRef,
|
|
43
|
+
withDepth = true,
|
|
44
|
+
alignment = 'right',
|
|
45
|
+
// left || right
|
|
46
|
+
autoFocusOnMount = true,
|
|
47
|
+
children = [],
|
|
48
|
+
size = 'normal'
|
|
49
|
+
} = _ref2,
|
|
50
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded);
|
|
51
|
+
|
|
27
52
|
const containerRef = useRef(null);
|
|
28
|
-
return
|
|
29
|
-
autoFocusOnMount,
|
|
53
|
+
return /*#__PURE__*/_jsx(FocusGroupProvider, {
|
|
54
|
+
autoFocusOnMount: autoFocusOnMount,
|
|
30
55
|
getContainer: () => containerRef.current,
|
|
31
56
|
keyBindings: {
|
|
32
|
-
Tab:
|
|
57
|
+
Tab: 'next'
|
|
33
58
|
},
|
|
34
59
|
orientation: "horizontal"
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
}, void 0, /*#__PURE__*/jsx(ToolbarContainer, _objectSpread(_objectSpread(_objectSpread({}, containerProps), otherProps), {}, {
|
|
61
|
+
classProps: {
|
|
62
|
+
withDepth,
|
|
63
|
+
alignment,
|
|
64
|
+
size
|
|
65
|
+
},
|
|
66
|
+
innerRef: mergeRefs(innerRef, containerRef),
|
|
67
|
+
children: decorateToolbarChildren(children)
|
|
68
|
+
})));
|
|
41
69
|
};
|
|
70
|
+
|
|
42
71
|
const toolbarProps = {
|
|
43
|
-
containerProps: PropTypes.object.description(
|
|
44
|
-
withDepth: PropTypes.bool.description(
|
|
45
|
-
alignment: PropTypes.oneOf([
|
|
46
|
-
size: PropTypes.oneOf([
|
|
47
|
-
autoFocusOnMount: PropTypes.bool.description(
|
|
48
|
-
children: PropTypes.oneOfType([
|
|
49
|
-
|
|
50
|
-
PropTypes.func,
|
|
51
|
-
PropTypes.node
|
|
52
|
-
]).description("Toolbar items").isRequired,
|
|
53
|
-
innerRef: PropTypes.object.description("Ref to the Toolbar container element")
|
|
72
|
+
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
73
|
+
withDepth: PropTypes.bool.description('Shows a shadow rear the toolbar').defaultValue(true),
|
|
74
|
+
alignment: PropTypes.oneOf(['right', 'left']).description('Aligns the toolbar to the left or right').defaultValue('right'),
|
|
75
|
+
size: PropTypes.oneOf(['normal', 'compact']).description('Toolbar size').defaultValue('normal'),
|
|
76
|
+
autoFocusOnMount: PropTypes.bool.description('Wheter to focus the component when it mounts or not').defaultValue(true),
|
|
77
|
+
children: PropTypes.oneOfType([PropTypes.array, PropTypes.func, PropTypes.node]).description('Toolbar items').isRequired,
|
|
78
|
+
innerRef: PropTypes.object.description('Ref to the Toolbar container element')
|
|
54
79
|
};
|
|
55
|
-
DSToolbar.propTypes = toolbarProps;
|
|
56
80
|
const ToolbarWithSchema = describe(DSToolbar);
|
|
57
81
|
ToolbarWithSchema.propTypes = toolbarProps;
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
DSToolbar,
|
|
61
|
-
Divider as ToolbarDivider,
|
|
62
|
-
ToolbarGroup,
|
|
63
|
-
Item as ToolbarItem,
|
|
64
|
-
ToolbarWithSchema,
|
|
65
|
-
DSToolbar_default as default
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=DSToolbar.js.map
|
|
82
|
+
|
|
83
|
+
export { DSToolbar, ToolbarWithSchema, DSToolbar as default };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const blockName =
|
|
4
|
-
const ToolbarDivider = aggregatedClasses(
|
|
5
|
-
ToolbarDivider.displayName =
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
ToolbarDivider_default as default
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=ToolbarDivider.js.map
|
|
1
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
2
|
+
|
|
3
|
+
const blockName = 'toolbar';
|
|
4
|
+
const ToolbarDivider = aggregatedClasses('div')(blockName, 'divider');
|
|
5
|
+
ToolbarDivider.displayName = 'ToolbarDivider';
|
|
6
|
+
|
|
7
|
+
export { ToolbarDivider as default };
|
|
@@ -1,22 +1,31 @@
|
|
|
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
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
4
|
+
import decorateToolbarChildren from './decorateToolbarChildren.js';
|
|
5
|
+
|
|
6
|
+
const blockName = 'toolbar-group';
|
|
7
|
+
const ToolbarGroupContainer = aggregatedClasses('div')(blockName, null, _ref => {
|
|
8
|
+
let {
|
|
9
|
+
space
|
|
10
|
+
} = _ref;
|
|
11
|
+
return {
|
|
12
|
+
["space-".concat(space)]: !!space
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const ToolbarGroup = _ref2 => {
|
|
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
|
+
}));
|
|
17
29
|
};
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
ToolbarGroup_default as default
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=ToolbarGroup.js.map
|
|
30
|
+
|
|
31
|
+
export { ToolbarGroup as default };
|
|
@@ -1,35 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
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
|
+
|
|
8
29
|
const [ref, setRef] = useState(null);
|
|
9
30
|
useFocusGroupWithState(ref);
|
|
10
|
-
|
|
11
|
-
|
|
31
|
+
|
|
32
|
+
const btn = /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
12
33
|
buttonType: "text",
|
|
13
|
-
icon,
|
|
14
|
-
innerRef:
|
|
15
|
-
labelText
|
|
16
|
-
});
|
|
34
|
+
icon: icon,
|
|
35
|
+
innerRef: r => setRef(r),
|
|
36
|
+
labelText: labelText
|
|
37
|
+
}));
|
|
38
|
+
|
|
17
39
|
if (menu) {
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
placement: Position.BOTTOM_END,
|
|
40
|
+
return /*#__PURE__*/React.cloneElement(menu, _objectSpread(_objectSpread({}, menu.props), {}, {
|
|
41
|
+
placement: PopperPositions.BOTTOM_END,
|
|
21
42
|
triggerComponent: btn
|
|
22
|
-
});
|
|
43
|
+
}));
|
|
23
44
|
}
|
|
45
|
+
|
|
24
46
|
return btn;
|
|
25
47
|
};
|
|
26
|
-
|
|
27
|
-
ToolbarItem.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
var ToolbarItem_default = ToolbarItem;
|
|
32
|
-
export {
|
|
33
|
-
ToolbarItem_default as default
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=ToolbarItem.js.map
|
|
48
|
+
|
|
49
|
+
ToolbarItem.displayName = 'ToolbarItem';
|
|
50
|
+
|
|
51
|
+
export { ToolbarItem as default };
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
9
|
+
import React, { cloneElement } from 'react';
|
|
10
|
+
|
|
11
|
+
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; }
|
|
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 };
|
package/esm/deprecated/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
default2 as default
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { DSToolbar, ToolbarWithSchema, DSToolbar as default } from './DSToolbar.js';
|
|
2
|
+
export { default as ToolbarItem } from './ToolbarItem.js';
|
|
3
|
+
export { default as ToolbarGroup } from './ToolbarGroup.js';
|
|
4
|
+
export { default as ToolbarDivider } from './ToolbarDivider.js';
|
package/esm/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
8
|
-
default2 as default
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { DSToolbar, ToolbarWithSchema, DSToolbar as default } from './deprecated/DSToolbar.js';
|
|
2
|
+
export { DSToolbarV2, DSToolbarV2WithSchema } from './DSToolbarV2.js';
|
|
3
|
+
export { DSToolbarItemV2 } from './DSToolbarItemV2.js';
|
|
4
|
+
export { DSToolbarSeparatorV2 } from './DSToolbarSeparatorV2.js';
|
|
5
|
+
export { default as ToolbarItem } from './deprecated/ToolbarItem.js';
|
|
6
|
+
export { default as ToolbarGroup } from './deprecated/ToolbarGroup.js';
|
|
7
|
+
export { default as ToolbarDivider } from './deprecated/ToolbarDivider.js';
|
package/esm/props.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
|
|
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
|
-
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=props.js.map
|
|
9
|
+
|
|
10
|
+
export { DSToolbarV2Schema };
|
package/esm/styled.js
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import Grid from "@elliemae/ds-grid";
|
|
4
|
-
const StyledToolbarWrapper = styled(Grid)`
|
|
5
|
-
background-color: ${(props) => props.theme.colors.neutral["000"]};
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import Grid from '@elliemae/ds-grid';
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const StyledToolbarWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
5
|
+
componentId: "sc-8ez8n4-0"
|
|
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]);
|
|
9
13
|
|
|
10
|
-
|
|
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
|
|
14
|
+
export { StyledSeparator, StyledToolbarItem, StyledToolbarWrapper };
|