carbon-react 87.5.0 → 89.2.0
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/lib/__internal__/input/input.component.js +2 -1
- package/lib/__spec_helper__/mock-date-helper.js +2 -1
- package/lib/components/action-toolbar/action-toolbar.component.js +6 -7
- package/lib/components/app-wrapper/app-wrapper.component.js +2 -5
- package/lib/components/configurable-items/configurable-item-row/configurable-item-row.component.js +6 -8
- package/lib/components/configurable-items/configurable-items.component.js +1 -2
- package/lib/components/date/date.component.js +1 -2
- package/lib/components/date-range/date-range.component.js +1 -2
- package/lib/components/decimal/decimal.component.js +1 -2
- package/lib/components/detail/detail.component.js +2 -3
- package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.js +2 -3
- package/lib/components/drag-and-drop/draggable-context/draggable-context.js +10 -11
- package/lib/components/drag-and-drop/with-drag/with-drag.js +4 -6
- package/lib/components/drag-and-drop/with-drop/with-drop.js +4 -6
- package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +2 -1
- package/lib/components/heading/heading.component.js +4 -8
- package/lib/components/i18n-provider/i18n-provider.d.ts +3 -94
- package/lib/components/icon/icon.component.js +4 -3
- package/lib/components/mount-in-app/mount-in-app.js +2 -5
- package/lib/components/multi-step-wizard/multi-step-wizard.js +14 -17
- package/lib/components/multi-step-wizard/step/step.js +6 -9
- package/lib/components/pod/pod.component.js +185 -390
- package/lib/components/profile/profile.component.js +47 -113
- package/lib/components/profile/profile.d.ts +0 -2
- package/lib/components/scrollable-list/scrollable-list.component.js +2 -3
- package/lib/components/show-edit-pod/show-edit-pod.component.js +1 -3
- package/lib/components/sidebar/sidebar.component.js +2 -1
- package/lib/components/table/table.component.js +1 -3
- package/lib/components/text-editor/text-editor.component.js +2 -1
- package/lib/components/textarea/textarea.component.js +1 -3
- package/lib/components/{pod/pod-manager.component.js → tile-select/__internal__/accordion/accordion.component.js} +30 -30
- package/lib/components/tile-select/__internal__/accordion/accordion.d.ts +13 -0
- package/lib/components/tile-select/__internal__/accordion/accordion.style.js +30 -0
- package/lib/components/tile-select/__internal__/accordion/index.js +15 -0
- package/lib/components/tile-select/tile-select.component.js +39 -10
- package/lib/components/tile-select/tile-select.d.ts +6 -0
- package/lib/components/tile-select/tile-select.style.js +17 -1
- package/lib/locales/en-gb.d.ts +5 -0
- package/lib/locales/en-gb.js +2 -3
- package/lib/locales/index.d.ts +2 -0
- package/lib/locales/locale.d.ts +96 -0
- package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +2 -3
- package/lib/patterns/configurable-items/configurable-items.js +2 -2
- package/lib/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.js +2 -2
- package/package.json +8 -6
- package/lib/components/pod/pod-context.js +0 -12
- package/lib/components/pod/pod-manager.d.ts +0 -9
|
@@ -11,8 +11,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
13
13
|
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
14
|
var _ether = require("../../utils/ether/ether");
|
|
17
15
|
|
|
18
16
|
var _tags = _interopRequireDefault(require("../../utils/helpers/tags/tags"));
|
|
@@ -25,117 +23,59 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
23
|
|
|
26
24
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
25
|
|
|
28
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
29
|
-
|
|
30
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
31
|
-
|
|
32
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
33
|
-
|
|
34
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
35
|
-
|
|
36
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
|
-
|
|
38
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
39
|
-
|
|
40
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
41
|
-
|
|
42
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
|
-
|
|
44
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
|
-
|
|
46
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
|
-
|
|
48
26
|
const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
|
|
49
27
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return Boolean(this.props.src);
|
|
67
|
-
}
|
|
68
|
-
/** Returns the classes for the component. */
|
|
69
|
-
|
|
70
|
-
}, {
|
|
71
|
-
key: "classes",
|
|
72
|
-
get: function () {
|
|
73
|
-
return (0, _classnames.default)(this.props.className);
|
|
74
|
-
}
|
|
75
|
-
/** Returns the initials for the name. */
|
|
76
|
-
|
|
77
|
-
}, {
|
|
78
|
-
key: "initials",
|
|
79
|
-
get: function () {
|
|
80
|
-
if (this.props.initials) return this.props.initials;
|
|
81
|
-
return (0, _ether.acronymize)(this.props.name);
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "marginProps",
|
|
85
|
-
get: function () {
|
|
86
|
-
return (0, _utils.filterStyledSystemMarginProps)(this.props);
|
|
87
|
-
}
|
|
88
|
-
/** Returns the avatar portion of the profile. */
|
|
89
|
-
|
|
90
|
-
}, {
|
|
91
|
-
key: "avatar",
|
|
92
|
-
get: function () {
|
|
93
|
-
if (this.hasSrc) {
|
|
94
|
-
return /*#__PURE__*/_react.default.createElement(_profile.ProfileAvatarStyle, {
|
|
95
|
-
src: this.props.src,
|
|
96
|
-
alt: this.initials,
|
|
97
|
-
initials: this.initials,
|
|
98
|
-
size: this.props.size,
|
|
99
|
-
shape: "square",
|
|
100
|
-
"data-element": "user-image"
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
28
|
+
const Profile = ({
|
|
29
|
+
src,
|
|
30
|
+
className,
|
|
31
|
+
initials,
|
|
32
|
+
name,
|
|
33
|
+
size,
|
|
34
|
+
email,
|
|
35
|
+
...props
|
|
36
|
+
}) => {
|
|
37
|
+
const getInitials = () => {
|
|
38
|
+
if (initials) return initials;
|
|
39
|
+
return (0, _ether.acronymize)(name);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const avatar = () => {
|
|
43
|
+
if (src) {
|
|
104
44
|
return /*#__PURE__*/_react.default.createElement(_profile.ProfileAvatarStyle, {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
45
|
+
src: src,
|
|
46
|
+
alt: getInitials(),
|
|
47
|
+
initials: getInitials(),
|
|
48
|
+
size: size,
|
|
49
|
+
shape: "square",
|
|
50
|
+
"data-element": "user-image"
|
|
108
51
|
});
|
|
109
52
|
}
|
|
110
|
-
/** Returns the text portion of the profile. */
|
|
111
|
-
|
|
112
|
-
}, {
|
|
113
|
-
key: "text",
|
|
114
|
-
get: function () {
|
|
115
|
-
return /*#__PURE__*/_react.default.createElement(_profile.ProfileDetailsStyle, {
|
|
116
|
-
size: this.props.size,
|
|
117
|
-
hasSrc: this.hasSrc
|
|
118
|
-
}, /*#__PURE__*/_react.default.createElement(_profile.ProfileNameStyle, {
|
|
119
|
-
size: this.props.size,
|
|
120
|
-
"data-element": "name"
|
|
121
|
-
}, this.props.name), /*#__PURE__*/_react.default.createElement(_profile.ProfileEmailStyle, {
|
|
122
|
-
size: this.props.size,
|
|
123
|
-
"data-element": "email"
|
|
124
|
-
}, this.props.email));
|
|
125
|
-
}
|
|
126
|
-
}, {
|
|
127
|
-
key: "render",
|
|
128
|
-
value: function render() {
|
|
129
|
-
return /*#__PURE__*/_react.default.createElement(_profile.ProfileStyle, _extends({
|
|
130
|
-
large: this.props.large,
|
|
131
|
-
className: this.classes,
|
|
132
|
-
hasSrc: this.hasSrc
|
|
133
|
-
}, (0, _tags.default)("profile", this.props), this.marginProps), this.avatar, this.text);
|
|
134
|
-
}
|
|
135
|
-
}]);
|
|
136
53
|
|
|
137
|
-
|
|
138
|
-
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_profile.ProfileAvatarStyle, {
|
|
55
|
+
initials: getInitials(),
|
|
56
|
+
gravatar: email,
|
|
57
|
+
size: size
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const text = () => {
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_profile.ProfileDetailsStyle, {
|
|
63
|
+
size: size,
|
|
64
|
+
hasSrc: !!src
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement(_profile.ProfileNameStyle, {
|
|
66
|
+
size: size,
|
|
67
|
+
"data-element": "name"
|
|
68
|
+
}, name), /*#__PURE__*/_react.default.createElement(_profile.ProfileEmailStyle, {
|
|
69
|
+
size: size,
|
|
70
|
+
"data-element": "email"
|
|
71
|
+
}, email));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_profile.ProfileStyle, _extends({
|
|
75
|
+
className: className,
|
|
76
|
+
hasSrc: !!src
|
|
77
|
+
}, (0, _tags.default)("profile", props), (0, _utils.filterStyledSystemMarginProps)(props)), avatar(), text());
|
|
78
|
+
};
|
|
139
79
|
|
|
140
80
|
Profile.propTypes = { ...marginPropTypes,
|
|
141
81
|
|
|
@@ -154,14 +94,8 @@ Profile.propTypes = { ...marginPropTypes,
|
|
|
154
94
|
/** Define initials to display if there is no Gravatar image. */
|
|
155
95
|
initials: _propTypes.default.string,
|
|
156
96
|
|
|
157
|
-
/** [Legacy] Enable a larger theme for the name. */
|
|
158
|
-
large: _propTypes.default.bool,
|
|
159
|
-
|
|
160
97
|
/** Allow to setup size for the component */
|
|
161
98
|
size: _propTypes.default.oneOf(["XS", "S", "M", "ML", "L", "XL", "XXL"])
|
|
162
99
|
};
|
|
163
|
-
Profile.defaultProps = {
|
|
164
|
-
large: false
|
|
165
|
-
};
|
|
166
100
|
var _default = Profile;
|
|
167
101
|
exports.default = _default;
|
|
@@ -11,8 +11,6 @@ export interface ProfileProps {
|
|
|
11
11
|
email: string;
|
|
12
12
|
/** Define initials to display if there is no Gravatar image. */
|
|
13
13
|
initials?: string;
|
|
14
|
-
/** [Legacy] Enable a larger theme for the name. */
|
|
15
|
-
large?: boolean;
|
|
16
14
|
/** Allow to setup size for the component */
|
|
17
15
|
size?: "XS" | "S" | "M" | "ML" | "L" | "XL" | "XXL";
|
|
18
16
|
}
|
|
@@ -314,7 +314,7 @@ let ScrollableList = /*#__PURE__*/function (_Component) {
|
|
|
314
314
|
return ScrollableList;
|
|
315
315
|
}(_react.Component);
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
ScrollableList.propTypes = {
|
|
318
318
|
alwaysHighlight: _propTypes.default.bool,
|
|
319
319
|
// ensures an item is always highlighted
|
|
320
320
|
isLoopable: _propTypes.default.bool,
|
|
@@ -323,7 +323,6 @@ _defineProperty(ScrollableList, "propTypes", {
|
|
|
323
323
|
maxHeight: _propTypes.default.string,
|
|
324
324
|
onLazyLoad: _propTypes.default.func,
|
|
325
325
|
onSelect: _propTypes.default.func
|
|
326
|
-
}
|
|
327
|
-
|
|
326
|
+
};
|
|
328
327
|
var _default = ScrollableList;
|
|
329
328
|
exports.default = _default;
|
|
@@ -260,9 +260,7 @@ let ShowEditPod = /*#__PURE__*/function (_React$Component) {
|
|
|
260
260
|
}(_react.default.Component);
|
|
261
261
|
|
|
262
262
|
exports.BaseShowEditPod = ShowEditPod;
|
|
263
|
-
|
|
264
|
-
_defineProperty(ShowEditPod, "contextType", _i18nContext.default);
|
|
265
|
-
|
|
263
|
+
ShowEditPod.contextType = _i18nContext.default;
|
|
266
264
|
ShowEditPod.propTypes = { ...marginPropTypes,
|
|
267
265
|
|
|
268
266
|
/** Pod theme variant. */
|
|
@@ -48,7 +48,8 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
48
48
|
onCancel,
|
|
49
49
|
...rest
|
|
50
50
|
}, ref) => {
|
|
51
|
-
|
|
51
|
+
let sidebarRef = (0, _react.useRef)();
|
|
52
|
+
if (ref) sidebarRef = ref;
|
|
52
53
|
|
|
53
54
|
const closeIcon = () => {
|
|
54
55
|
if (!onCancel) return null;
|
|
@@ -660,9 +660,7 @@ let Table = /*#__PURE__*/function (_React$Component) {
|
|
|
660
660
|
}(_react.default.Component);
|
|
661
661
|
|
|
662
662
|
exports.Table = Table;
|
|
663
|
-
|
|
664
|
-
_defineProperty(Table, "contextType", _i18nContext.default);
|
|
665
|
-
|
|
663
|
+
Table.contextType = _i18nContext.default;
|
|
666
664
|
Table.propTypes = {
|
|
667
665
|
/** The actions to display in the toolbar */
|
|
668
666
|
actions: _propTypes.default.object,
|
|
@@ -65,7 +65,8 @@ const TextEditor = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
65
65
|
const [inlines, setInlines] = (0, _react.useState)([]);
|
|
66
66
|
const [activeInlines, setActiveInlines] = (0, _react.useState)({});
|
|
67
67
|
const [focusToolbar, setFocusToolbar] = (0, _react.useState)(false);
|
|
68
|
-
const
|
|
68
|
+
const editorRef = (0, _react.useRef)();
|
|
69
|
+
const editor = ref || editorRef;
|
|
69
70
|
const contentLength = (0, _utils.getContent)(value).getPlainText("").length;
|
|
70
71
|
const moveCursor = (0, _react.useRef)(contentLength > 0);
|
|
71
72
|
const lastKeyPressed = (0, _react.useRef)();
|
|
@@ -245,9 +245,7 @@ let Textarea = /*#__PURE__*/function (_React$Component) {
|
|
|
245
245
|
}(_react.default.Component);
|
|
246
246
|
|
|
247
247
|
exports.OriginalTextarea = Textarea;
|
|
248
|
-
|
|
249
|
-
_defineProperty(Textarea, "contextType", _i18nContext.default);
|
|
250
|
-
|
|
248
|
+
Textarea.contextType = _i18nContext.default;
|
|
251
249
|
Textarea.propTypes = { ...marginPropTypes,
|
|
252
250
|
|
|
253
251
|
/** id of the input */
|
|
@@ -9,9 +9,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _accordion = require("./accordion.style");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _useResizeObserver = _interopRequireDefault(require("../../../../hooks/__internal__/useResizeObserver"));
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -19,38 +19,38 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const Accordion = ({
|
|
23
|
+
children,
|
|
24
|
+
expanded,
|
|
25
|
+
contentId,
|
|
26
|
+
controlId
|
|
26
27
|
}) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const podManagerRef = (0, _react.useRef)();
|
|
34
|
-
const [heightOfTheLongestPod, setHeightOfTheLongestPod] = (0, _react.useState)();
|
|
28
|
+
const [contentHeight, setContentHeight] = (0, _react.useState)(0);
|
|
29
|
+
const contentRef = (0, _react.useRef)(null);
|
|
30
|
+
(0, _useResizeObserver.default)(contentRef, () => {
|
|
31
|
+
setContentHeight(contentRef.current.scrollHeight);
|
|
32
|
+
});
|
|
35
33
|
(0, _react.useEffect)(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
ref: podManagerRef
|
|
34
|
+
setContentHeight(contentRef.current.scrollHeight);
|
|
35
|
+
}, [contentRef]);
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_accordion.StyledContentContainer, {
|
|
37
|
+
"aria-expanded": expanded,
|
|
38
|
+
isExpanded: expanded,
|
|
39
|
+
maxHeight: contentHeight
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(_accordion.StyledContent, {
|
|
41
|
+
role: "region",
|
|
42
|
+
"data-element": "tile-select-accordion-content",
|
|
43
|
+
ref: contentRef,
|
|
44
|
+
id: contentId,
|
|
45
|
+
"aria-labelledby": controlId
|
|
49
46
|
}, children));
|
|
50
47
|
};
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
children: _propTypes.default.node
|
|
49
|
+
Accordion.propTypes = {
|
|
50
|
+
children: _propTypes.default.node.isRequired,
|
|
51
|
+
expanded: _propTypes.default.bool,
|
|
52
|
+
contentId: _propTypes.default.string,
|
|
53
|
+
controlId: _propTypes.default.string
|
|
54
54
|
};
|
|
55
|
-
var _default =
|
|
55
|
+
var _default = Accordion;
|
|
56
56
|
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { SpaceProps } from "styled-system";
|
|
3
|
+
|
|
4
|
+
export interface AccordionProps extends SpaceProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
contentId?: string;
|
|
8
|
+
controlId?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare function Accordion(props: AccordionProps): JSX.Element;
|
|
12
|
+
|
|
13
|
+
export default Accordion;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledContent = exports.StyledContentContainer = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _accordion = require("../../../accordion/accordion.style");
|
|
11
|
+
|
|
12
|
+
var _base = _interopRequireDefault(require("../../../../style/themes/base"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const StyledContentContainer = (0, _styledComponents.default)(_accordion.StyledAccordionContentContainer)`
|
|
17
|
+
background-color: ${({
|
|
18
|
+
theme
|
|
19
|
+
}) => theme.tileSelect.hoverBackground};
|
|
20
|
+
`;
|
|
21
|
+
exports.StyledContentContainer = StyledContentContainer;
|
|
22
|
+
const StyledContent = (0, _styledComponents.default)(_accordion.StyledAccordionContent)`
|
|
23
|
+
padding: 24px;
|
|
24
|
+
position: relative;
|
|
25
|
+
z-index: 200;
|
|
26
|
+
`;
|
|
27
|
+
exports.StyledContent = StyledContent;
|
|
28
|
+
StyledContentContainer.defaultProps = {
|
|
29
|
+
theme: _base.default
|
|
30
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _accordion.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _accordion = _interopRequireDefault(require("./accordion.component"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -5,30 +5,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
9
|
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
12
|
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
13
13
|
|
|
14
14
|
var _tags = _interopRequireDefault(require("../../utils/helpers/tags/tags"));
|
|
15
15
|
|
|
16
16
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
17
17
|
|
|
18
|
+
var _guid = _interopRequireDefault(require("../../utils/helpers/guid"));
|
|
19
|
+
|
|
18
20
|
var _button = _interopRequireDefault(require("../button"));
|
|
19
21
|
|
|
20
22
|
var _box = _interopRequireDefault(require("../box"));
|
|
21
23
|
|
|
24
|
+
var _accordion = _interopRequireDefault(require("./__internal__/accordion"));
|
|
25
|
+
|
|
22
26
|
var _tileSelect = require("./tile-select.style");
|
|
23
27
|
|
|
24
28
|
var _utils = require("../../style/utils");
|
|
25
29
|
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
26
32
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
27
33
|
|
|
28
34
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
35
|
|
|
30
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
36
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
33
37
|
|
|
34
38
|
const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
|
|
@@ -57,6 +61,9 @@ const TileSelect = ({
|
|
|
57
61
|
footer,
|
|
58
62
|
prefixAdornment,
|
|
59
63
|
additionalInformation,
|
|
64
|
+
accordionContent,
|
|
65
|
+
accordionControl,
|
|
66
|
+
accordionExpanded,
|
|
60
67
|
...rest
|
|
61
68
|
}) => {
|
|
62
69
|
const l = (0, _useLocale.default)();
|
|
@@ -88,6 +95,9 @@ const TileSelect = ({
|
|
|
88
95
|
setHasFocus(false);
|
|
89
96
|
}
|
|
90
97
|
}, [disabled, hasFocus]);
|
|
98
|
+
const guid = (0, _react.useRef)((0, _guid.default)());
|
|
99
|
+
const contentId = `AccordionContent_${guid.current}`;
|
|
100
|
+
const controlId = `AccordionControl_${guid.current}`;
|
|
91
101
|
return /*#__PURE__*/_react.default.createElement(_tileSelect.StyledTileSelectContainer, _extends({
|
|
92
102
|
checked: checked,
|
|
93
103
|
className: className,
|
|
@@ -121,14 +131,21 @@ const TileSelect = ({
|
|
|
121
131
|
checked: checked
|
|
122
132
|
}, /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
123
133
|
display: "flex",
|
|
124
|
-
justifyContent: "space-between"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}, prefixAdornment), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
134
|
+
justifyContent: "space-between",
|
|
135
|
+
flexDirection: "row-reverse"
|
|
136
|
+
}, (customActionButton || checked) && renderActionButton(), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
128
137
|
flexGrow: "1"
|
|
129
138
|
}, /*#__PURE__*/_react.default.createElement(_tileSelect.StyledTitleContainer, null, title && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledTitle, checkPropTypeIsNode(title), title), subtitle && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledSubtitle, checkPropTypeIsNode(subtitle), subtitle), titleAdornment && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledAdornment, {
|
|
130
139
|
hasAdditionalInformation: !!additionalInformation
|
|
131
|
-
}, titleAdornment)), additionalInformation && /*#__PURE__*/_react.default.createElement("div", null, additionalInformation), /*#__PURE__*/_react.default.createElement(_tileSelect.StyledDescription, checkPropTypeIsNode(description), description), footer && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledFooterWrapper, null, footer)
|
|
140
|
+
}, titleAdornment)), additionalInformation && /*#__PURE__*/_react.default.createElement("div", null, additionalInformation), /*#__PURE__*/_react.default.createElement(_tileSelect.StyledDescription, checkPropTypeIsNode(description), description), footer && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledFooterWrapper, null, footer), accordionContent && accordionControl && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledAccordionFooterWrapper, {
|
|
141
|
+
accordionExpanded: accordionExpanded
|
|
142
|
+
}, accordionControl(controlId, contentId))), prefixAdornment && /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
143
|
+
mr: 3
|
|
144
|
+
}, prefixAdornment))), accordionContent && /*#__PURE__*/_react.default.createElement(_accordion.default, {
|
|
145
|
+
contentId: contentId,
|
|
146
|
+
controlId: controlId,
|
|
147
|
+
expanded: accordionExpanded
|
|
148
|
+
}, accordionContent)));
|
|
132
149
|
};
|
|
133
150
|
|
|
134
151
|
TileSelect.defaultProps = {
|
|
@@ -192,7 +209,19 @@ TileSelect.propTypes = { ...marginPropTypes,
|
|
|
192
209
|
prefixAdornment: _propTypes.default.node,
|
|
193
210
|
|
|
194
211
|
/** Component to render additional information row between title and description */
|
|
195
|
-
additionalInformation: _propTypes.default.node
|
|
212
|
+
additionalInformation: _propTypes.default.node,
|
|
213
|
+
|
|
214
|
+
/** Components to render in the TileSelect Accordion */
|
|
215
|
+
accordionContent: _propTypes.default.node,
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Render prop to support rendering the control to handle the expanded state of the TileSelect Accordion.
|
|
219
|
+
* `(controlId, contentId) => <Button id={controlId} aria-controls={contentId}>...</Button>`
|
|
220
|
+
*/
|
|
221
|
+
accordionControl: _propTypes.default.func,
|
|
222
|
+
|
|
223
|
+
/** Flag to control the open state of TileSelect Accordion */
|
|
224
|
+
accordionExpanded: _propTypes.default.bool
|
|
196
225
|
};
|
|
197
226
|
TileSelect.displayName = "TileSelect";
|
|
198
227
|
var _default = TileSelect;
|
|
@@ -38,6 +38,12 @@ export interface TileSelectProps extends MarginProps {
|
|
|
38
38
|
prefixAdornment?: React.ReactNode;
|
|
39
39
|
/** Component to render additional information row between title and description */
|
|
40
40
|
additionalInformation?: React.ReactNode;
|
|
41
|
+
/** Components to render in the TileSelect Accordion */
|
|
42
|
+
accordionContent?: React.ReactNode;
|
|
43
|
+
/** Callback to toggle expanded state of TileSelect Accordion */
|
|
44
|
+
accordionControl?: (controlId: string, contentId: string) => JSX.Element;
|
|
45
|
+
/** Flag to control the open state of TileSelect Accordion */
|
|
46
|
+
accordionExpanded?: boolean;
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
declare function TileSelect(props: TileSelectProps): JSX.Element;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledFocusWrapper = exports.StyledFooterWrapper = exports.StyledDeselectWrapper = exports.StyledDescription = exports.StyledAdornment = exports.StyledSubtitle = exports.StyledTitle = exports.StyledTitleContainer = exports.StyledTileSelectInput = exports.StyledTileSelect = exports.StyledTileSelectContainer = exports.StyledGroupDescription = exports.StyledTileSelectFieldset = void 0;
|
|
6
|
+
exports.StyledAccordionFooterWrapper = exports.StyledFocusWrapper = exports.StyledFooterWrapper = exports.StyledDeselectWrapper = exports.StyledDescription = exports.StyledAdornment = exports.StyledSubtitle = exports.StyledTitle = exports.StyledTitleContainer = exports.StyledTileSelectInput = exports.StyledTileSelect = exports.StyledTileSelectContainer = exports.StyledGroupDescription = exports.StyledTileSelectFieldset = void 0;
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
@@ -131,6 +131,22 @@ const StyledFooterWrapper = _styledComponents.default.div`
|
|
|
131
131
|
z-index: 200;
|
|
132
132
|
`;
|
|
133
133
|
exports.StyledFooterWrapper = StyledFooterWrapper;
|
|
134
|
+
const StyledAccordionFooterWrapper = _styledComponents.default.div`
|
|
135
|
+
width: fit-content;
|
|
136
|
+
position: relative;
|
|
137
|
+
z-index: 200;
|
|
138
|
+
left: -12px;
|
|
139
|
+
|
|
140
|
+
${({
|
|
141
|
+
accordionExpanded
|
|
142
|
+
}) => `
|
|
143
|
+
span[data-element="chevron_down"] {
|
|
144
|
+
transition: transform 0.3s;
|
|
145
|
+
${!accordionExpanded && "transform: rotate(-90deg)"};
|
|
146
|
+
}
|
|
147
|
+
`}
|
|
148
|
+
`;
|
|
149
|
+
exports.StyledAccordionFooterWrapper = StyledAccordionFooterWrapper;
|
|
134
150
|
const StyledTileSelectInput = (0, _styledComponents.default)(_input.Input)`
|
|
135
151
|
position: absolute;
|
|
136
152
|
top: 0;
|
package/lib/locales/en-gb.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
const isSingular = count => parseInt(count
|
|
8
|
+
const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
|
|
9
9
|
|
|
10
|
-
exports.isSingular = isSingular;
|
|
11
10
|
var _default = {
|
|
12
11
|
locale: () => "en-GB",
|
|
13
12
|
actions: {
|