@elliemae/ds-group-box 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.
Files changed (65) hide show
  1. package/dist/cjs/ActionItem.js +55 -0
  2. package/dist/cjs/ActionItem.js.map +7 -0
  3. package/dist/cjs/Actions.js +64 -0
  4. package/dist/cjs/Actions.js.map +7 -0
  5. package/dist/cjs/DSGroupBox.js +121 -0
  6. package/dist/cjs/DSGroupBox.js.map +7 -0
  7. package/dist/cjs/GroupBoxLabel.js +83 -0
  8. package/dist/cjs/GroupBoxLabel.js.map +7 -0
  9. package/dist/cjs/LabelElement.js +52 -0
  10. package/dist/cjs/LabelElement.js.map +7 -0
  11. package/dist/cjs/components/GroupHeader.js +69 -0
  12. package/dist/cjs/components/GroupHeader.js.map +7 -0
  13. package/dist/cjs/components/blocks.js +58 -0
  14. package/dist/cjs/components/blocks.js.map +7 -0
  15. package/dist/cjs/constants.js +40 -0
  16. package/dist/cjs/constants.js.map +7 -0
  17. package/dist/cjs/index.js +37 -0
  18. package/dist/cjs/index.js.map +7 -0
  19. package/dist/esm/ActionItem.js +26 -0
  20. package/dist/esm/ActionItem.js.map +7 -0
  21. package/dist/esm/Actions.js +35 -0
  22. package/dist/esm/Actions.js.map +7 -0
  23. package/dist/esm/DSGroupBox.js +94 -0
  24. package/dist/esm/DSGroupBox.js.map +7 -0
  25. package/dist/esm/GroupBoxLabel.js +54 -0
  26. package/dist/esm/GroupBoxLabel.js.map +7 -0
  27. package/dist/esm/LabelElement.js +23 -0
  28. package/dist/esm/LabelElement.js.map +7 -0
  29. package/dist/esm/components/GroupHeader.js +40 -0
  30. package/dist/esm/components/GroupHeader.js.map +7 -0
  31. package/dist/esm/components/blocks.js +29 -0
  32. package/dist/esm/components/blocks.js.map +7 -0
  33. package/dist/esm/constants.js +11 -0
  34. package/dist/esm/constants.js.map +7 -0
  35. package/dist/esm/index.js +8 -0
  36. package/dist/esm/index.js.map +7 -0
  37. package/package.json +49 -38
  38. package/cjs/ActionItem.js +0 -24
  39. package/cjs/Actions.js +0 -37
  40. package/cjs/DSGroupBox.js +0 -140
  41. package/cjs/GroupBoxLabel.js +0 -40
  42. package/cjs/LabelElement.js +0 -24
  43. package/cjs/components/GroupHeader.js +0 -53
  44. package/cjs/components/blocks.js +0 -56
  45. package/cjs/constants.js +0 -12
  46. package/cjs/index.js +0 -14
  47. package/esm/ActionItem.js +0 -17
  48. package/esm/Actions.js +0 -27
  49. package/esm/DSGroupBox.js +0 -128
  50. package/esm/GroupBoxLabel.js +0 -33
  51. package/esm/LabelElement.js +0 -17
  52. package/esm/components/GroupHeader.js +0 -44
  53. package/esm/components/blocks.js +0 -50
  54. package/esm/constants.js +0 -7
  55. package/esm/index.js +0 -2
  56. package/types/ActionItem.d.ts +0 -11
  57. package/types/Actions.d.ts +0 -16
  58. package/types/DSGroupBox.d.ts +0 -113
  59. package/types/GroupBoxLabel.d.ts +0 -21
  60. package/types/LabelElement.d.ts +0 -11
  61. package/types/components/GroupHeader.d.ts +0 -13
  62. package/types/components/blocks.d.ts +0 -4
  63. package/types/constants.d.ts +0 -5
  64. package/types/index.d.ts +0 -3
  65. package/types/tests/DSGroupBox.test.d.ts +0 -1
package/cjs/Actions.js DELETED
@@ -1,37 +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/esnext.async-iterator.map.js');
7
- require('core-js/modules/esnext.iterator.map.js');
8
- require('react');
9
- var styled = require('styled-components');
10
- var styledComponents = require('@xstyled/styled-components');
11
- var dsSystem = require('@elliemae/ds-system');
12
- var ActionItem = require('./ActionItem.js');
13
-
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
-
16
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
17
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
18
-
19
- const ActionsNode = /*#__PURE__*/styled__default["default"].div.withConfig({
20
- componentId: "sc-1umfb8g-0"
21
- })(["display:flex;flex-direction:row;padding-left:", ";overflow:hidden;", ""], props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.m), styledComponents.space);
22
-
23
- function Actions(_ref) {
24
- let {
25
- actions = [],
26
- centerActions,
27
- rightActions
28
- } = _ref;
29
- if (actions.length < 1) return null;
30
- return /*#__PURE__*/_jsx__default["default"](ActionsNode, {
31
- marginLeft: !!rightActions && 'auto',
32
- marginRight: !!centerActions && 'auto'
33
- }, void 0, actions.map((action, key) => /*#__PURE__*/_jsx__default["default"](ActionItem, {}, key, action)));
34
- }
35
-
36
- exports.Actions = Actions;
37
- exports["default"] = Actions;
package/cjs/DSGroupBox.js DELETED
@@ -1,140 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
- var _jsx = require('@babel/runtime/helpers/jsx');
7
- require('core-js/modules/esnext.async-iterator.map.js');
8
- require('core-js/modules/esnext.iterator.map.js');
9
- require('core-js/modules/esnext.async-iterator.filter.js');
10
- require('core-js/modules/esnext.iterator.constructor.js');
11
- require('core-js/modules/esnext.iterator.filter.js');
12
- require('core-js/modules/esnext.async-iterator.for-each.js');
13
- require('core-js/modules/esnext.iterator.for-each.js');
14
- var React = require('react');
15
- var reactDesc = require('react-desc');
16
- var blocks = require('./components/blocks.js');
17
- var GroupHeader = require('./components/GroupHeader.js');
18
- var constants = require('./constants.js');
19
- var jsxRuntime = require('react/jsx-runtime');
20
-
21
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
-
23
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
24
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
25
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
-
27
- 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; }
28
-
29
- 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__default["default"](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; }
30
-
31
- const DSGroupBox = _ref => {
32
- let {
33
- containerProps = {},
34
- labelProps = {
35
- labelText: '',
36
- borderBottom: false,
37
- id: 'ds-group-box__header'
38
- },
39
- rightActions = [],
40
- centerActions = [],
41
- type = constants.BOX_TYPES.CATEGORY,
42
- asRow = false,
43
- onlyHeader = false,
44
- noBorder = true,
45
- noPadding = false,
46
- children: components = [],
47
- // eslint-disable-next-line react/prop-types
48
- isMain = true
49
- } = _ref;
50
- const {
51
- labelText
52
- } = labelProps;
53
- return /*#__PURE__*/jsxRuntime.jsxs(blocks.GroupBoxWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
54
- classProps: {
55
- onlyHeader,
56
- noBorder,
57
- type,
58
- isMain
59
- },
60
- children: [labelText && /*#__PURE__*/_jsx__default["default"](GroupHeader.DSGroupBoxHeader, {
61
- centerActions: centerActions,
62
- isMain: isMain,
63
- labelProps: labelProps,
64
- noBorder: noBorder,
65
- rightActions: rightActions,
66
- type: type
67
- }), /*#__PURE__*/_jsx__default["default"](blocks.GroupBoxContent, {
68
- classProps: {
69
- type,
70
- asRow,
71
- onlyHeader,
72
- noPadding,
73
- noBorder,
74
- noBorderTop: !!labelText
75
- }
76
- }, void 0, components && components.props ? React__default["default"].Children.map(components, component => /*#__PURE__*/React__default["default"].cloneElement(component, _objectSpread(_objectSpread({}, component.props), {}, {
77
- isMain: false
78
- })), null) : components)]
79
- }));
80
- };
81
-
82
- const props = {
83
- /** props to inject to wrapper */
84
- containerProps: reactDesc.PropTypes.object.description('props to inject to wrapper'),
85
-
86
- /**
87
- * Label attributes to be rendered
88
- */
89
- labelProps: reactDesc.PropTypes.shape({
90
- labelText: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.element]),
91
- borderBottom: reactDesc.PropTypes.bool,
92
- id: reactDesc.PropTypes.string
93
- }).description('Label attributes to be rendered'),
94
-
95
- /**
96
- * ['category-box', 'group-box']
97
- */
98
- type: reactDesc.PropTypes.oneOf(constants.BOX_TYPES_ARRAY).description(constants.BOX_TYPES_ARRAY.toString()),
99
-
100
- /**
101
- * Components to be rendered inside the box
102
- */
103
- children: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.element, reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.element)]).isRequired.description('Components to be rendered inside the box'),
104
-
105
- /**
106
- * Actions on the right side of the label
107
- */
108
- rightActions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.element).description('Actions on the right side of the label'),
109
-
110
- /**
111
- * Actions on the next to the label
112
- */
113
- centerActions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.element).description('Actions on the next to the label'),
114
-
115
- /**
116
- * Display the content of the group box with flex direction row
117
- */
118
- asRow: reactDesc.PropTypes.bool.description('Display the content of the group box with flex direction row'),
119
-
120
- /**
121
- * Show border only on the header
122
- */
123
- onlyHeader: reactDesc.PropTypes.bool.description('Show border only on the header'),
124
-
125
- /**
126
- * Remove the wrapper border
127
- */
128
- noBorder: reactDesc.PropTypes.bool.description('Remove the wrapper border'),
129
-
130
- /**
131
- * Remove the top and bottom padding from the content
132
- */
133
- noPadding: reactDesc.PropTypes.bool.description('Remove the top and bottom padding from the content')
134
- };
135
- const DSGroupBoxWithSchema = reactDesc.describe(DSGroupBox);
136
- DSGroupBoxWithSchema.propTypes = props;
137
-
138
- exports.DSGroupBox = DSGroupBox;
139
- exports.DSGroupBoxWithSchema = DSGroupBoxWithSchema;
140
- exports["default"] = DSGroupBox;
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- var _jsx = require('@babel/runtime/helpers/jsx');
4
- require('react');
5
- var styled = require('styled-components');
6
- var dsSystem = require('@elliemae/ds-system');
7
-
8
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
-
10
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
11
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
12
-
13
- const borderBase200 = props => "1px solid ".concat(props.theme.colors.neutral[200], ";");
14
-
15
- const categoryBoxStyles = "\n width: 100%;\n height: 36px;\n padding:0 0;\n color: ".concat(props => props.theme.colors.neutral[800], ";\n display: flex;\n flex-direction: row;\n align-items: center;\n border-bottom: ").concat(borderBase200, "\n");
16
- const groupBoxStyles = "\n border: unset;\n font-size: ".concat(props => dsSystem.toMobile(props.theme.fontSizes.title[500]), ";\n padding: 12px 0;\n");
17
- const GroupBoxLabelNode = /*#__PURE__*/styled__default["default"].div.withConfig({
18
- componentId: "sc-141ikkh-0"
19
- })(["", " ", " ", " ", ""], props => props.nodeType === 'category-box' ? categoryBoxStyles : groupBoxStyles, props => props.noBorder ? 'border: none;' : '', props => props.borderBottom ? "border-bottom: ".concat(borderBase200(props)) : '', props => props.isMain ? "padding-right: ".concat(dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xs), ";") : '');
20
-
21
- function GroupBoxLabel(_ref) {
22
- let {
23
- borderBottom,
24
- children,
25
- noBorder,
26
- isMain,
27
- type,
28
- id
29
- } = _ref;
30
- return /*#__PURE__*/_jsx__default["default"](GroupBoxLabelNode, {
31
- borderBottom: borderBottom,
32
- "data-testid": "ds-group-box__header",
33
- isMain: isMain,
34
- noBorder: noBorder,
35
- nodeType: type,
36
- id: id
37
- }, void 0, children);
38
- }
39
-
40
- module.exports = GroupBoxLabel;
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- var _jsx = require('@babel/runtime/helpers/jsx');
4
- require('react');
5
- var styled = require('styled-components');
6
- var dsSystem = require('@elliemae/ds-system');
7
-
8
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
-
10
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
11
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
12
-
13
- const LabelElementNode = /*#__PURE__*/styled__default["default"].div.withConfig({
14
- componentId: "sc-nu03bl-0"
15
- })(["overflow:hidden;display:flex;align-items:center;font-size:", ";font-weight:400;"], props => dsSystem.toMobile(props.theme.fontSizes.title[700]));
16
-
17
- function LabelElement(_ref) {
18
- let {
19
- children
20
- } = _ref;
21
- return /*#__PURE__*/_jsx__default["default"](LabelElementNode, {}, void 0, children);
22
- }
23
-
24
- module.exports = LabelElement;
@@ -1,53 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _jsx = require('@babel/runtime/helpers/jsx');
6
- require('react');
7
- var DSTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
8
- var constants = require('../constants.js');
9
- var Actions = require('../Actions.js');
10
- var LabelElement = require('../LabelElement.js');
11
- var GroupBoxLabel = require('../GroupBoxLabel.js');
12
-
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
16
- var DSTruncatedTooltipText__default = /*#__PURE__*/_interopDefaultLegacy(DSTruncatedTooltipText);
17
-
18
- const DSGroupBoxHeader = _ref => {
19
- let {
20
- labelProps = {
21
- labelText: '',
22
- borderBottom: false,
23
- id: 'ds-group-box__header'
24
- },
25
- rightActions = [],
26
- centerActions = [],
27
- type = constants.BOX_TYPES.CATEGORY,
28
- noBorder,
29
- isMain
30
- } = _ref;
31
- const {
32
- labelText,
33
- borderBottom,
34
- id
35
- } = labelProps;
36
- return /*#__PURE__*/_jsx__default["default"](GroupBoxLabel, {
37
- borderBottom: borderBottom,
38
- isMain: isMain,
39
- noBorder: noBorder,
40
- type: type,
41
- id: id
42
- }, void 0, /*#__PURE__*/_jsx__default["default"](LabelElement, {}, void 0, /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText__default["default"], {
43
- value: labelText
44
- })), /*#__PURE__*/_jsx__default["default"](Actions.Actions, {
45
- actions: centerActions,
46
- centerActions: centerActions.length > 0
47
- }), /*#__PURE__*/_jsx__default["default"](Actions.Actions, {
48
- actions: rightActions,
49
- rightActions: rightActions.length > 0
50
- }));
51
- };
52
-
53
- exports.DSGroupBoxHeader = DSGroupBoxHeader;
@@ -1,56 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var dsClassnames = require('@elliemae/ds-classnames');
6
-
7
- const blockName = 'group-box';
8
- const GroupBoxWrapper = dsClassnames.aggregatedClasses('div')(blockName, 'wrapper', _ref => {
9
- let {
10
- onlyHeader,
11
- noBorder,
12
- type,
13
- isMain
14
- } = _ref;
15
- return {
16
- 'only-header': onlyHeader,
17
- 'no-border': noBorder,
18
- [type]: type,
19
- 'main-box': isMain,
20
- 'nested-box': !isMain
21
- };
22
- });
23
- const GroupBoxContent = dsClassnames.aggregatedClasses('div')(blockName, 'content', _ref2 => {
24
- let {
25
- type,
26
- asRow,
27
- onlyHeader,
28
- noPadding,
29
- noBorder,
30
- noBorderTop
31
- } = _ref2;
32
- return {
33
- [type]: type,
34
- 'as-row': asRow,
35
- 'only-header': onlyHeader,
36
- 'no-padding': noPadding,
37
- 'no-border': noBorder,
38
- 'no-border-top': noBorderTop
39
- };
40
- });
41
- const Label = dsClassnames.aggregatedClasses('div')(blockName, 'label', _ref3 => {
42
- let {
43
- borderBottom,
44
- type,
45
- noBorder
46
- } = _ref3;
47
- return {
48
- 'border-bottom': borderBottom,
49
- [type]: type,
50
- 'no-border': noBorder
51
- };
52
- });
53
-
54
- exports.GroupBoxContent = GroupBoxContent;
55
- exports.GroupBoxWrapper = GroupBoxWrapper;
56
- exports.Label = Label;
package/cjs/constants.js DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const BOX_TYPES = {
6
- CATEGORY: 'category-box',
7
- GROUP: 'group-box'
8
- };
9
- const BOX_TYPES_ARRAY = [BOX_TYPES.CATEGORY, BOX_TYPES.GROUP];
10
-
11
- exports.BOX_TYPES = BOX_TYPES;
12
- exports.BOX_TYPES_ARRAY = BOX_TYPES_ARRAY;
package/cjs/index.js DELETED
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var DSGroupBox = require('./DSGroupBox.js');
6
- var constants = require('./constants.js');
7
-
8
-
9
-
10
- exports.DSGroupBox = DSGroupBox.DSGroupBox;
11
- exports.DSGroupBoxWithSchema = DSGroupBox.DSGroupBoxWithSchema;
12
- exports["default"] = DSGroupBox.DSGroupBox;
13
- exports.BOX_TYPES = constants.BOX_TYPES;
14
- exports.BOX_TYPES_ARRAY = constants.BOX_TYPES_ARRAY;
package/esm/ActionItem.js DELETED
@@ -1,17 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import styled from 'styled-components';
4
- import { __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-system';
5
-
6
- const ActionItemNode = /*#__PURE__*/styled.div.withConfig({
7
- componentId: "sc-1ysc0gb-0"
8
- })(["padding-right:", ";font-weight:300;overflow:hidden;align-items:center;display:flex;&:last-child{padding-right:0;}"], props => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xs));
9
-
10
- function ActionItem(_ref) {
11
- let {
12
- children
13
- } = _ref;
14
- return /*#__PURE__*/_jsx(ActionItemNode, {}, void 0, children);
15
- }
16
-
17
- export { ActionItem as default };
package/esm/Actions.js DELETED
@@ -1,27 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/esnext.async-iterator.map.js';
3
- import 'core-js/modules/esnext.iterator.map.js';
4
- import 'react';
5
- import styled from 'styled-components';
6
- import { space } from '@xstyled/styled-components';
7
- import { __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-system';
8
- import ActionItem from './ActionItem.js';
9
-
10
- const ActionsNode = /*#__PURE__*/styled.div.withConfig({
11
- componentId: "sc-1umfb8g-0"
12
- })(["display:flex;flex-direction:row;padding-left:", ";overflow:hidden;", ""], props => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.m), space);
13
-
14
- function Actions(_ref) {
15
- let {
16
- actions = [],
17
- centerActions,
18
- rightActions
19
- } = _ref;
20
- if (actions.length < 1) return null;
21
- return /*#__PURE__*/_jsx(ActionsNode, {
22
- marginLeft: !!rightActions && 'auto',
23
- marginRight: !!centerActions && 'auto'
24
- }, void 0, actions.map((action, key) => /*#__PURE__*/_jsx(ActionItem, {}, key, action)));
25
- }
26
-
27
- export { Actions, Actions as default };
package/esm/DSGroupBox.js DELETED
@@ -1,128 +0,0 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import _jsx from '@babel/runtime/helpers/esm/jsx';
3
- import 'core-js/modules/esnext.async-iterator.map.js';
4
- import 'core-js/modules/esnext.iterator.map.js';
5
- import 'core-js/modules/esnext.async-iterator.filter.js';
6
- import 'core-js/modules/esnext.iterator.constructor.js';
7
- import 'core-js/modules/esnext.iterator.filter.js';
8
- import 'core-js/modules/esnext.async-iterator.for-each.js';
9
- import 'core-js/modules/esnext.iterator.for-each.js';
10
- import React from 'react';
11
- import { PropTypes, describe } from 'react-desc';
12
- import { GroupBoxWrapper, GroupBoxContent } from './components/blocks.js';
13
- import { DSGroupBoxHeader } from './components/GroupHeader.js';
14
- import { BOX_TYPES_ARRAY, BOX_TYPES } from './constants.js';
15
- import { jsxs } from 'react/jsx-runtime';
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 DSGroupBox = _ref => {
22
- let {
23
- containerProps = {},
24
- labelProps = {
25
- labelText: '',
26
- borderBottom: false,
27
- id: 'ds-group-box__header'
28
- },
29
- rightActions = [],
30
- centerActions = [],
31
- type = BOX_TYPES.CATEGORY,
32
- asRow = false,
33
- onlyHeader = false,
34
- noBorder = true,
35
- noPadding = false,
36
- children: components = [],
37
- // eslint-disable-next-line react/prop-types
38
- isMain = true
39
- } = _ref;
40
- const {
41
- labelText
42
- } = labelProps;
43
- return /*#__PURE__*/jsxs(GroupBoxWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
44
- classProps: {
45
- onlyHeader,
46
- noBorder,
47
- type,
48
- isMain
49
- },
50
- children: [labelText && /*#__PURE__*/_jsx(DSGroupBoxHeader, {
51
- centerActions: centerActions,
52
- isMain: isMain,
53
- labelProps: labelProps,
54
- noBorder: noBorder,
55
- rightActions: rightActions,
56
- type: type
57
- }), /*#__PURE__*/_jsx(GroupBoxContent, {
58
- classProps: {
59
- type,
60
- asRow,
61
- onlyHeader,
62
- noPadding,
63
- noBorder,
64
- noBorderTop: !!labelText
65
- }
66
- }, void 0, components && components.props ? React.Children.map(components, component => /*#__PURE__*/React.cloneElement(component, _objectSpread(_objectSpread({}, component.props), {}, {
67
- isMain: false
68
- })), null) : components)]
69
- }));
70
- };
71
-
72
- const props = {
73
- /** props to inject to wrapper */
74
- containerProps: PropTypes.object.description('props to inject to wrapper'),
75
-
76
- /**
77
- * Label attributes to be rendered
78
- */
79
- labelProps: PropTypes.shape({
80
- labelText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
81
- borderBottom: PropTypes.bool,
82
- id: PropTypes.string
83
- }).description('Label attributes to be rendered'),
84
-
85
- /**
86
- * ['category-box', 'group-box']
87
- */
88
- type: PropTypes.oneOf(BOX_TYPES_ARRAY).description(BOX_TYPES_ARRAY.toString()),
89
-
90
- /**
91
- * Components to be rendered inside the box
92
- */
93
- children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]).isRequired.description('Components to be rendered inside the box'),
94
-
95
- /**
96
- * Actions on the right side of the label
97
- */
98
- rightActions: PropTypes.arrayOf(PropTypes.element).description('Actions on the right side of the label'),
99
-
100
- /**
101
- * Actions on the next to the label
102
- */
103
- centerActions: PropTypes.arrayOf(PropTypes.element).description('Actions on the next to the label'),
104
-
105
- /**
106
- * Display the content of the group box with flex direction row
107
- */
108
- asRow: PropTypes.bool.description('Display the content of the group box with flex direction row'),
109
-
110
- /**
111
- * Show border only on the header
112
- */
113
- onlyHeader: PropTypes.bool.description('Show border only on the header'),
114
-
115
- /**
116
- * Remove the wrapper border
117
- */
118
- noBorder: PropTypes.bool.description('Remove the wrapper border'),
119
-
120
- /**
121
- * Remove the top and bottom padding from the content
122
- */
123
- noPadding: PropTypes.bool.description('Remove the top and bottom padding from the content')
124
- };
125
- const DSGroupBoxWithSchema = describe(DSGroupBox);
126
- DSGroupBoxWithSchema.propTypes = props;
127
-
128
- export { DSGroupBox, DSGroupBoxWithSchema, DSGroupBox as default };
@@ -1,33 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import styled from 'styled-components';
4
- import { __UNSAFE_SPACE_TO_DIMSUM, toMobile } from '@elliemae/ds-system';
5
-
6
- const borderBase200 = props => "1px solid ".concat(props.theme.colors.neutral[200], ";");
7
-
8
- const categoryBoxStyles = "\n width: 100%;\n height: 36px;\n padding:0 0;\n color: ".concat(props => props.theme.colors.neutral[800], ";\n display: flex;\n flex-direction: row;\n align-items: center;\n border-bottom: ").concat(borderBase200, "\n");
9
- const groupBoxStyles = "\n border: unset;\n font-size: ".concat(props => toMobile(props.theme.fontSizes.title[500]), ";\n padding: 12px 0;\n");
10
- const GroupBoxLabelNode = /*#__PURE__*/styled.div.withConfig({
11
- componentId: "sc-141ikkh-0"
12
- })(["", " ", " ", " ", ""], props => props.nodeType === 'category-box' ? categoryBoxStyles : groupBoxStyles, props => props.noBorder ? 'border: none;' : '', props => props.borderBottom ? "border-bottom: ".concat(borderBase200(props)) : '', props => props.isMain ? "padding-right: ".concat(__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xs), ";") : '');
13
-
14
- function GroupBoxLabel(_ref) {
15
- let {
16
- borderBottom,
17
- children,
18
- noBorder,
19
- isMain,
20
- type,
21
- id
22
- } = _ref;
23
- return /*#__PURE__*/_jsx(GroupBoxLabelNode, {
24
- borderBottom: borderBottom,
25
- "data-testid": "ds-group-box__header",
26
- isMain: isMain,
27
- noBorder: noBorder,
28
- nodeType: type,
29
- id: id
30
- }, void 0, children);
31
- }
32
-
33
- export { GroupBoxLabel as default };
@@ -1,17 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import styled from 'styled-components';
4
- import { toMobile } from '@elliemae/ds-system';
5
-
6
- const LabelElementNode = /*#__PURE__*/styled.div.withConfig({
7
- componentId: "sc-nu03bl-0"
8
- })(["overflow:hidden;display:flex;align-items:center;font-size:", ";font-weight:400;"], props => toMobile(props.theme.fontSizes.title[700]));
9
-
10
- function LabelElement(_ref) {
11
- let {
12
- children
13
- } = _ref;
14
- return /*#__PURE__*/_jsx(LabelElementNode, {}, void 0, children);
15
- }
16
-
17
- export { LabelElement as default };
@@ -1,44 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
3
- import DSTruncatedTooltipText from '@elliemae/ds-truncated-tooltip-text';
4
- import { BOX_TYPES } from '../constants.js';
5
- import { Actions } from '../Actions.js';
6
- import LabelElement from '../LabelElement.js';
7
- import GroupBoxLabel from '../GroupBoxLabel.js';
8
-
9
- const DSGroupBoxHeader = _ref => {
10
- let {
11
- labelProps = {
12
- labelText: '',
13
- borderBottom: false,
14
- id: 'ds-group-box__header'
15
- },
16
- rightActions = [],
17
- centerActions = [],
18
- type = BOX_TYPES.CATEGORY,
19
- noBorder,
20
- isMain
21
- } = _ref;
22
- const {
23
- labelText,
24
- borderBottom,
25
- id
26
- } = labelProps;
27
- return /*#__PURE__*/_jsx(GroupBoxLabel, {
28
- borderBottom: borderBottom,
29
- isMain: isMain,
30
- noBorder: noBorder,
31
- type: type,
32
- id: id
33
- }, void 0, /*#__PURE__*/_jsx(LabelElement, {}, void 0, /*#__PURE__*/_jsx(DSTruncatedTooltipText, {
34
- value: labelText
35
- })), /*#__PURE__*/_jsx(Actions, {
36
- actions: centerActions,
37
- centerActions: centerActions.length > 0
38
- }), /*#__PURE__*/_jsx(Actions, {
39
- actions: rightActions,
40
- rightActions: rightActions.length > 0
41
- }));
42
- };
43
-
44
- export { DSGroupBoxHeader };