carbon-react 142.4.0 → 142.5.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/esm/components/menu/__internal__/submenu/submenu.style.js +0 -1
- package/esm/components/pager/pager.style.js +1 -1
- package/esm/components/select/__internal__/select-list/select-list.component.d.ts +0 -2
- package/esm/components/select/__internal__/select-list/select-list.component.js +3 -8
- package/esm/components/select/__internal__/select-textbox/select-textbox.component.d.ts +1 -3
- package/esm/components/select/__internal__/select-textbox/select-textbox.component.js +24 -56
- package/esm/components/select/__internal__/{select-text/select-text.style.d.ts → select-textbox/select-textbox.style.d.ts} +2 -3
- package/esm/components/select/filterable-select/filterable-select.component.d.ts +1 -1
- package/esm/components/select/filterable-select/filterable-select.component.js +4 -7
- package/esm/components/select/multi-select/multi-select.component.d.ts +1 -1
- package/esm/components/select/multi-select/multi-select.component.js +4 -7
- package/esm/components/select/simple-select/simple-select.component.d.ts +1 -1
- package/esm/components/select/simple-select/simple-select.component.js +4 -7
- package/esm/components/tile/tile.component.d.ts +5 -1
- package/esm/components/tile/tile.component.js +12 -2
- package/esm/components/tile/tile.config.d.ts +1 -0
- package/esm/components/tile/tile.config.js +2 -1
- package/esm/components/tile/tile.style.d.ts +5 -1
- package/esm/components/tile/tile.style.js +37 -2
- package/lib/components/menu/__internal__/submenu/submenu.style.js +0 -1
- package/lib/components/pager/pager.style.js +2 -2
- package/lib/components/select/__internal__/select-list/select-list.component.d.ts +0 -2
- package/lib/components/select/__internal__/select-list/select-list.component.js +3 -8
- package/lib/components/select/__internal__/select-textbox/select-textbox.component.d.ts +1 -3
- package/lib/components/select/__internal__/select-textbox/select-textbox.component.js +24 -58
- package/lib/components/select/__internal__/{select-text/select-text.style.d.ts → select-textbox/select-textbox.style.d.ts} +2 -3
- package/lib/components/select/filterable-select/filterable-select.component.d.ts +1 -1
- package/lib/components/select/filterable-select/filterable-select.component.js +4 -7
- package/lib/components/select/multi-select/multi-select.component.d.ts +1 -1
- package/lib/components/select/multi-select/multi-select.component.js +4 -7
- package/lib/components/select/simple-select/simple-select.component.d.ts +1 -1
- package/lib/components/select/simple-select/simple-select.component.js +4 -7
- package/lib/components/tile/tile.component.d.ts +5 -1
- package/lib/components/tile/tile.component.js +14 -2
- package/lib/components/tile/tile.config.d.ts +1 -0
- package/lib/components/tile/tile.config.js +3 -2
- package/lib/components/tile/tile.style.d.ts +5 -1
- package/lib/components/tile/tile.style.js +38 -3
- package/package.json +1 -1
- package/esm/components/select/__internal__/select-text/index.d.ts +0 -2
- package/esm/components/select/__internal__/select-text/index.js +0 -1
- package/esm/components/select/__internal__/select-text/select-text.component.d.ts +0 -22
- package/esm/components/select/__internal__/select-text/select-text.component.js +0 -27
- package/lib/components/select/__internal__/select-text/index.d.ts +0 -2
- package/lib/components/select/__internal__/select-text/index.js +0 -13
- package/lib/components/select/__internal__/select-text/package.json +0 -6
- package/lib/components/select/__internal__/select-text/select-text.component.d.ts +0 -22
- package/lib/components/select/__internal__/select-text/select-text.component.js +0 -34
- /package/esm/components/select/__internal__/{select-text/select-text.style.js → select-textbox/select-textbox.style.js} +0 -0
- /package/lib/components/select/__internal__/{select-text/select-text.style.js → select-textbox/select-textbox.style.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { CustomSelectChangeEvent } from "../../simple-select/simple-select.component";
|
|
2
3
|
import { CommonTextboxProps } from "../../../textbox";
|
|
3
4
|
import { ValidationProps } from "../../../../__internal__/validations";
|
|
4
|
-
import { CustomSelectChangeEvent } from "../../simple-select/simple-select.component";
|
|
5
5
|
export interface FormInputPropTypes extends ValidationProps, Omit<CommonTextboxProps, "onClick" | "onChange"> {
|
|
6
6
|
/** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
|
|
7
7
|
adaptiveLabelBreakpoint?: number;
|
|
@@ -74,8 +74,6 @@ export interface SelectTextboxProps extends FormInputPropTypes {
|
|
|
74
74
|
/** Value of the Select Input */
|
|
75
75
|
selectedValue?: string | Record<string, unknown> | string[] | Record<string, unknown>[];
|
|
76
76
|
/** @private @ignore */
|
|
77
|
-
textboxRef?: HTMLInputElement | null;
|
|
78
|
-
/** @private @ignore */
|
|
79
77
|
transparent?: boolean;
|
|
80
78
|
/** @private @ignore */
|
|
81
79
|
activeDescendantId?: string;
|
|
@@ -4,87 +4,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _selectTextbox = require("./select-textbox.context");
|
|
10
|
+
var _selectTextbox2 = require("./select-textbox.style");
|
|
11
11
|
var _textbox = _interopRequireDefault(require("../../../textbox"));
|
|
12
|
-
var _selectText = _interopRequireDefault(require("../select-text"));
|
|
13
12
|
var _useLocale = _interopRequireDefault(require("../../../../hooks/__internal__/useLocale"));
|
|
14
|
-
var _selectTextbox = require("./select-textbox.context");
|
|
15
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
|
-
const floatingMiddleware = [(0, _dom.offset)(({
|
|
20
|
-
rects
|
|
21
|
-
}) => ({
|
|
22
|
-
mainAxis: -rects.reference.height
|
|
23
|
-
})), (0, _dom.size)({
|
|
24
|
-
apply({
|
|
25
|
-
rects,
|
|
26
|
-
elements
|
|
27
|
-
}) {
|
|
28
|
-
elements.reference.style.height = `${rects.floating.height}px`;
|
|
29
|
-
elements.floating.style.width = `${rects.reference.width}px`;
|
|
30
|
-
}
|
|
31
|
-
})];
|
|
32
15
|
const SelectTextbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
33
16
|
ariaLabel,
|
|
34
17
|
ariaLabelledby,
|
|
35
18
|
accessibilityLabelId,
|
|
36
19
|
labelId,
|
|
37
20
|
"aria-controls": ariaControls,
|
|
38
|
-
disabled,
|
|
21
|
+
disabled = false,
|
|
39
22
|
isOpen,
|
|
40
23
|
id,
|
|
41
|
-
readOnly,
|
|
42
|
-
placeholder,
|
|
24
|
+
readOnly = false,
|
|
25
|
+
placeholder: customPlaceholder,
|
|
43
26
|
size = "medium",
|
|
44
27
|
onClick,
|
|
45
28
|
onFocus,
|
|
46
29
|
onBlur,
|
|
47
30
|
onChange,
|
|
31
|
+
formattedValue = "",
|
|
48
32
|
selectedValue,
|
|
49
33
|
required,
|
|
50
34
|
isOptional,
|
|
51
|
-
textboxRef,
|
|
52
35
|
hasTextCursor,
|
|
53
|
-
transparent,
|
|
36
|
+
transparent = false,
|
|
54
37
|
activeDescendantId,
|
|
55
38
|
onKeyDown,
|
|
56
39
|
...restProps
|
|
57
40
|
}, ref) => {
|
|
58
|
-
const reference = (0, _react.useMemo)(() => ({
|
|
59
|
-
current: textboxRef?.parentElement?.parentElement || null
|
|
60
|
-
}), [textboxRef]);
|
|
61
|
-
const floating = (0, _react.useMemo)(() => ({
|
|
62
|
-
current: textboxRef?.parentElement || null
|
|
63
|
-
}), [textboxRef]);
|
|
64
|
-
(0, _useFloating.default)({
|
|
65
|
-
isOpen,
|
|
66
|
-
reference,
|
|
67
|
-
floating,
|
|
68
|
-
strategy: "fixed",
|
|
69
|
-
animationFrame: true,
|
|
70
|
-
middleware: floatingMiddleware
|
|
71
|
-
});
|
|
72
41
|
const l = (0, _useLocale.default)();
|
|
42
|
+
const placeholder = customPlaceholder || l.select.placeholder();
|
|
43
|
+
const showPlaceholder = !disabled && !readOnly && !formattedValue;
|
|
73
44
|
function handleTextboxClick(event) {
|
|
74
45
|
onClick?.(event);
|
|
75
46
|
}
|
|
76
47
|
function handleTextboxFocus(event) {
|
|
77
|
-
if (disabled || readOnly)
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
if (onFocus) {
|
|
81
|
-
onFocus(event);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function handleTextboxBlur(event) {
|
|
85
|
-
if (onBlur) {
|
|
86
|
-
onBlur(event);
|
|
87
|
-
}
|
|
48
|
+
if (disabled || readOnly) return;
|
|
49
|
+
onFocus?.(event);
|
|
88
50
|
}
|
|
89
51
|
const textboxProps = {
|
|
90
52
|
disabled,
|
|
@@ -94,7 +56,7 @@ const SelectTextbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
94
56
|
isOptional,
|
|
95
57
|
onClick: handleTextboxClick,
|
|
96
58
|
onFocus: handleTextboxFocus,
|
|
97
|
-
onBlur
|
|
59
|
+
onBlur,
|
|
98
60
|
labelId,
|
|
99
61
|
type: "text",
|
|
100
62
|
ref,
|
|
@@ -117,22 +79,27 @@ const SelectTextbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
117
79
|
}, /*#__PURE__*/_react.default.createElement(_textbox.default, _extends({
|
|
118
80
|
"aria-label": ariaLabel,
|
|
119
81
|
"data-element": "select-input",
|
|
82
|
+
"data-role": "select-textbox",
|
|
120
83
|
inputIcon: "dropdown",
|
|
121
84
|
autoComplete: "off",
|
|
122
85
|
size: size,
|
|
123
86
|
onChange: onChange,
|
|
87
|
+
formattedValue: formattedValue,
|
|
124
88
|
value: hasStringValue ? selectedValue : undefined,
|
|
125
|
-
placeholder: hasTextCursor ? placeholder
|
|
89
|
+
placeholder: hasTextCursor ? placeholder : undefined
|
|
126
90
|
}, inputAriaAttributes, textboxProps, {
|
|
127
91
|
my: 0 // prevents any form spacing being applied
|
|
128
|
-
}), !hasTextCursor && /*#__PURE__*/_react.default.createElement(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
92
|
+
}), !hasTextCursor && /*#__PURE__*/_react.default.createElement(_selectTextbox2.StyledSelectText, _extends({
|
|
93
|
+
"aria-hidden": true,
|
|
94
|
+
"data-element": "select-text",
|
|
95
|
+
"data-role": "select-text",
|
|
132
96
|
disabled: disabled,
|
|
97
|
+
hasPlaceholder: showPlaceholder,
|
|
98
|
+
onClick: disabled || readOnly ? undefined : handleTextboxClick,
|
|
133
99
|
readOnly: readOnly,
|
|
100
|
+
transparent: transparent,
|
|
134
101
|
size: size
|
|
135
|
-
}, restProps))));
|
|
102
|
+
}, restProps), /*#__PURE__*/_react.default.createElement(_selectTextbox2.StyledSelectTextChildrenWrapper, null, showPlaceholder ? placeholder : formattedValue))));
|
|
136
103
|
});
|
|
137
104
|
if (process.env.NODE_ENV !== "production") {
|
|
138
105
|
SelectTextbox.propTypes = {
|
|
@@ -661,7 +628,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
661
628
|
"suppressContentEditableWarning": _propTypes.default.bool,
|
|
662
629
|
"suppressHydrationWarning": _propTypes.default.bool,
|
|
663
630
|
"tabIndex": _propTypes.default.number,
|
|
664
|
-
"textboxRef": _propTypes.default.object,
|
|
665
631
|
"title": _propTypes.default.string,
|
|
666
632
|
"tooltipPosition": _propTypes.default.oneOf(["bottom", "left", "right", "top"]),
|
|
667
633
|
"translate": _propTypes.default.oneOf(["no", "yes"]),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface StyledSelectTextProps extends Pick<
|
|
1
|
+
import { SelectTextboxProps } from "./select-textbox.component";
|
|
2
|
+
interface StyledSelectTextProps extends Required<Pick<SelectTextboxProps, "disabled" | "readOnly" | "transparent" | "size">> {
|
|
3
3
|
hasPlaceholder: boolean;
|
|
4
|
-
size: NonNullable<SelectTextProps["size"]>;
|
|
5
4
|
}
|
|
6
5
|
declare const StyledSelectText: import("styled-components").StyledComponent<"span", any, StyledSelectTextProps, never>;
|
|
7
6
|
declare const StyledSelectTextChildrenWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -66,5 +66,5 @@ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "default
|
|
|
66
66
|
/** Flag to configure component as mandatory */
|
|
67
67
|
required?: boolean;
|
|
68
68
|
}
|
|
69
|
-
export declare const FilterableSelect: React.ForwardRefExoticComponent<FilterableSelectProps & React.RefAttributes<
|
|
69
|
+
export declare const FilterableSelect: React.ForwardRefExoticComponent<FilterableSelectProps & React.RefAttributes<HTMLInputElement>>;
|
|
70
70
|
export default FilterableSelect;
|
|
@@ -373,10 +373,9 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
|
|
|
373
373
|
onListAction?.();
|
|
374
374
|
}
|
|
375
375
|
const assignInput = (0, _react.useCallback)(element => {
|
|
376
|
+
if (!element) return;
|
|
376
377
|
setTextboxRef(element);
|
|
377
|
-
if (!ref)
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
378
|
+
if (!ref) return;
|
|
380
379
|
if (typeof ref === "function") {
|
|
381
380
|
ref(element);
|
|
382
381
|
} else {
|
|
@@ -390,7 +389,6 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
|
|
|
390
389
|
label,
|
|
391
390
|
disabled,
|
|
392
391
|
readOnly,
|
|
393
|
-
ref: assignInput,
|
|
394
392
|
selectedValue,
|
|
395
393
|
formattedValue: textValue,
|
|
396
394
|
onClick: handleTextboxClick,
|
|
@@ -425,7 +423,6 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
|
|
|
425
423
|
onListScrollBottom,
|
|
426
424
|
tableHeader,
|
|
427
425
|
multiColumn,
|
|
428
|
-
loaderDataRole: "filterable-select-list-loader",
|
|
429
426
|
listPlacement,
|
|
430
427
|
flipEnabled,
|
|
431
428
|
isOpen,
|
|
@@ -445,14 +442,14 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
|
|
|
445
442
|
}, marginProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
446
443
|
ref: containerRef
|
|
447
444
|
}, /*#__PURE__*/_react.default.createElement(_selectTextbox.default, _extends({
|
|
445
|
+
ref: assignInput,
|
|
448
446
|
activeDescendantId: activeDescendantId,
|
|
449
447
|
ariaLabel: ariaLabel,
|
|
450
448
|
ariaLabelledby: ariaLabelledby,
|
|
451
449
|
labelId: label ? labelId : undefined,
|
|
452
450
|
"aria-controls": selectListId.current,
|
|
453
451
|
isOpen: isOpen,
|
|
454
|
-
hasTextCursor: true
|
|
455
|
-
textboxRef: textboxRef
|
|
452
|
+
hasTextCursor: true
|
|
456
453
|
}, getTextboxProps()))), selectList);
|
|
457
454
|
});
|
|
458
455
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -58,5 +58,5 @@ export interface MultiSelectProps extends Omit<FormInputPropTypes, "defaultValue
|
|
|
58
58
|
/** Flag to configure component as optional. */
|
|
59
59
|
isOptional?: boolean;
|
|
60
60
|
}
|
|
61
|
-
export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<
|
|
61
|
+
export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLInputElement>>;
|
|
62
62
|
export default MultiSelect;
|
|
@@ -395,10 +395,9 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
|
|
|
395
395
|
setFilterText("");
|
|
396
396
|
}, []);
|
|
397
397
|
const assignInput = (0, _react.useCallback)(element => {
|
|
398
|
+
if (!element) return;
|
|
398
399
|
setTextboxRef(element);
|
|
399
|
-
if (!ref)
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
400
|
+
if (!ref) return;
|
|
402
401
|
if (typeof ref === "function") {
|
|
403
402
|
ref(element);
|
|
404
403
|
} else {
|
|
@@ -414,7 +413,6 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
|
|
|
414
413
|
readOnly,
|
|
415
414
|
placeholder: placeholderOverride,
|
|
416
415
|
leftChildren: mapValuesToPills,
|
|
417
|
-
ref: assignInput,
|
|
418
416
|
formattedValue: textValue,
|
|
419
417
|
selectedValue: actualValue,
|
|
420
418
|
onClick: handleTextboxClick,
|
|
@@ -449,7 +447,6 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
|
|
|
449
447
|
listPlacement: listPlacement,
|
|
450
448
|
listMaxHeight: listMaxHeight,
|
|
451
449
|
flipEnabled: flipEnabled,
|
|
452
|
-
loaderDataRole: "multi-select-list-loader",
|
|
453
450
|
multiselectValues: actualValue,
|
|
454
451
|
isOpen: isOpen,
|
|
455
452
|
enableVirtualScroll: enableVirtualScroll,
|
|
@@ -471,6 +468,7 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
|
|
|
471
468
|
"data-element": "accessibility-label",
|
|
472
469
|
id: accessibilityLabelId.current
|
|
473
470
|
}, accessibilityLabel), /*#__PURE__*/_react.default.createElement(_selectTextbox.default, _extends({
|
|
471
|
+
ref: assignInput,
|
|
474
472
|
accessibilityLabelId: accessibilityLabelId.current,
|
|
475
473
|
activeDescendantId: activeDescendantId,
|
|
476
474
|
"aria-controls": selectListId.current,
|
|
@@ -478,8 +476,7 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
|
|
|
478
476
|
ariaLabelledby: ariaLabelledby,
|
|
479
477
|
hasTextCursor: true,
|
|
480
478
|
isOpen: isOpen,
|
|
481
|
-
labelId: labelId
|
|
482
|
-
textboxRef: textboxRef
|
|
479
|
+
labelId: labelId
|
|
483
480
|
}, getTextboxProps()))), selectList);
|
|
484
481
|
});
|
|
485
482
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -66,5 +66,5 @@ export interface SimpleSelectProps extends Omit<FormInputPropTypes, "defaultValu
|
|
|
66
66
|
/** Flag to configure component as mandatory */
|
|
67
67
|
isRequired?: boolean;
|
|
68
68
|
}
|
|
69
|
-
export declare const SimpleSelect: React.ForwardRefExoticComponent<SimpleSelectProps & React.RefAttributes<
|
|
69
|
+
export declare const SimpleSelect: React.ForwardRefExoticComponent<SimpleSelectProps & React.RefAttributes<HTMLInputElement>>;
|
|
70
70
|
export default SimpleSelect;
|
|
@@ -291,10 +291,9 @@ const SimpleSelect = exports.SimpleSelect = /*#__PURE__*/_react.default.forwardR
|
|
|
291
291
|
setOpenState(false);
|
|
292
292
|
}, []);
|
|
293
293
|
const assignInput = (0, _react.useCallback)(element => {
|
|
294
|
+
if (!element) return;
|
|
294
295
|
setTextboxRef(element);
|
|
295
|
-
if (!ref)
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
296
|
+
if (!ref) return;
|
|
298
297
|
if (typeof ref === "function") {
|
|
299
298
|
ref(element);
|
|
300
299
|
} else {
|
|
@@ -307,7 +306,6 @@ const SimpleSelect = exports.SimpleSelect = /*#__PURE__*/_react.default.forwardR
|
|
|
307
306
|
name,
|
|
308
307
|
disabled,
|
|
309
308
|
readOnly,
|
|
310
|
-
ref: assignInput,
|
|
311
309
|
selectedValue,
|
|
312
310
|
formattedValue: textValue,
|
|
313
311
|
onClick: handleTextboxClick,
|
|
@@ -339,7 +337,6 @@ const SimpleSelect = exports.SimpleSelect = /*#__PURE__*/_react.default.forwardR
|
|
|
339
337
|
onListScrollBottom: onListScrollBottom,
|
|
340
338
|
tableHeader: tableHeader,
|
|
341
339
|
multiColumn: multiColumn,
|
|
342
|
-
loaderDataRole: "simple-select-list-loader",
|
|
343
340
|
listPlacement: listPlacement,
|
|
344
341
|
flipEnabled: flipEnabled,
|
|
345
342
|
isOpen: isOpen,
|
|
@@ -358,12 +355,12 @@ const SimpleSelect = exports.SimpleSelect = /*#__PURE__*/_react.default.forwardR
|
|
|
358
355
|
}, marginProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
359
356
|
ref: containerRef
|
|
360
357
|
}, /*#__PURE__*/_react.default.createElement(_selectTextbox.default, _extends({
|
|
358
|
+
ref: assignInput,
|
|
361
359
|
ariaLabel: ariaLabel,
|
|
362
360
|
"aria-controls": selectListId.current,
|
|
363
361
|
activeDescendantId: activeDescendantId,
|
|
364
362
|
ariaLabelledby: ariaLabelledby,
|
|
365
|
-
isOpen: isOpen
|
|
366
|
-
textboxRef: textboxRef
|
|
363
|
+
isOpen: isOpen
|
|
367
364
|
}, getTextboxProps()))), selectList);
|
|
368
365
|
});
|
|
369
366
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -2,7 +2,9 @@ import React from "react";
|
|
|
2
2
|
import * as DesignTokens from "@sage/design-tokens/js/base/common";
|
|
3
3
|
import { SpaceProps, WidthProps } from "styled-system";
|
|
4
4
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
5
|
+
import { TILE_HIGHLIGHT_VARIANTS } from "./tile.config";
|
|
5
6
|
declare type DesignTokensType = keyof typeof DesignTokens;
|
|
7
|
+
declare type HighlightVariantType = typeof TILE_HIGHLIGHT_VARIANTS[number];
|
|
6
8
|
export interface TileProps extends SpaceProps, WidthProps, TagProps {
|
|
7
9
|
/** Sets the theme of the tile */
|
|
8
10
|
variant?: "tile" | "transparent" | "active" | "grey";
|
|
@@ -31,6 +33,8 @@ export interface TileProps extends SpaceProps, WidthProps, TagProps {
|
|
|
31
33
|
* Set a percentage-based height for the whole Tile component, relative to its parent.
|
|
32
34
|
*/
|
|
33
35
|
height?: string | number;
|
|
36
|
+
/** Sets the highlight variant */
|
|
37
|
+
highlightVariant?: HighlightVariantType;
|
|
34
38
|
}
|
|
35
|
-
export declare const Tile: ({ variant, p, children, orientation, width, roundness, height, borderWidth, borderVariant, ...rest }: TileProps) => React.JSX.Element;
|
|
39
|
+
export declare const Tile: ({ variant, p, children, orientation, width, roundness, height, borderWidth, borderVariant, highlightVariant, ...rest }: TileProps) => React.JSX.Element;
|
|
36
40
|
export default Tile;
|
|
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.Tile = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _tile =
|
|
9
|
+
var _tile = _interopRequireWildcard(require("./tile.style"));
|
|
10
10
|
var _tile2 = _interopRequireDefault(require("./__internal__/tile.context"));
|
|
11
11
|
var _filterStyledSystemPaddingProps = _interopRequireDefault(require("../../style/utils/filter-styled-system-padding-props"));
|
|
12
12
|
var _filterStyledSystemMarginProps = _interopRequireDefault(require("../../style/utils/filter-styled-system-margin-props"));
|
|
13
13
|
var _computeContentPadding = _interopRequireDefault(require("./__internal__/compute-content-padding"));
|
|
14
14
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
18
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
19
|
const Tile = ({
|
|
@@ -24,6 +26,7 @@ const Tile = ({
|
|
|
24
26
|
height,
|
|
25
27
|
borderWidth,
|
|
26
28
|
borderVariant,
|
|
29
|
+
highlightVariant,
|
|
27
30
|
...rest
|
|
28
31
|
}) => {
|
|
29
32
|
const isHorizontal = orientation === "horizontal";
|
|
@@ -33,7 +36,7 @@ const Tile = ({
|
|
|
33
36
|
});
|
|
34
37
|
const marginProps = (0, _filterStyledSystemMarginProps.default)(rest);
|
|
35
38
|
const contentPaddingProps = (0, _computeContentPadding.default)(paddingProps, isHorizontal);
|
|
36
|
-
|
|
39
|
+
const tile = /*#__PURE__*/_react.default.createElement(_tile.default, _extends({
|
|
37
40
|
variant: variant,
|
|
38
41
|
width: width,
|
|
39
42
|
height: height,
|
|
@@ -48,6 +51,15 @@ const Tile = ({
|
|
|
48
51
|
paddingPropsFromTile: contentPaddingProps
|
|
49
52
|
}
|
|
50
53
|
}, children));
|
|
54
|
+
if (highlightVariant) {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_tile.StyledHighlight, {
|
|
56
|
+
variant: highlightVariant,
|
|
57
|
+
roundness: roundness,
|
|
58
|
+
"aria-hidden": true,
|
|
59
|
+
"data-role": `tile-${highlightVariant}-highlight`
|
|
60
|
+
}, tile);
|
|
61
|
+
}
|
|
62
|
+
return tile;
|
|
51
63
|
};
|
|
52
64
|
exports.Tile = Tile;
|
|
53
65
|
var _default = exports.default = Tile;
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TILE_THEMES = exports.TILE_ORIENTATIONS = exports.TILE_BORDER_VARIANTS = void 0;
|
|
6
|
+
exports.TILE_THEMES = exports.TILE_ORIENTATIONS = exports.TILE_HIGHLIGHT_VARIANTS = exports.TILE_BORDER_VARIANTS = void 0;
|
|
7
7
|
const TILE_ORIENTATIONS = exports.TILE_ORIENTATIONS = ["horizontal", "vertical"];
|
|
8
8
|
const TILE_THEMES = exports.TILE_THEMES = ["tile", "transparent", "active", "grey"];
|
|
9
|
-
const TILE_BORDER_VARIANTS = exports.TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
9
|
+
const TILE_BORDER_VARIANTS = exports.TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
10
|
+
const TILE_HIGHLIGHT_VARIANTS = exports.TILE_HIGHLIGHT_VARIANTS = ["gradient", "success", "neutral", "error", "warning", "info"];
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { SpaceProps } from "styled-system";
|
|
2
2
|
import { TileProps } from "./tile.component";
|
|
3
|
-
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "roundness" | "borderWidth" | "borderVariant"> & {
|
|
3
|
+
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "roundness" | "borderWidth" | "borderVariant" | "highlightVariant"> & {
|
|
4
4
|
isHorizontal?: boolean | undefined;
|
|
5
5
|
} & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
|
|
6
|
+
export declare const StyledHighlight: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
variant: Required<TileProps["highlightVariant"]>;
|
|
8
|
+
roundness: TileProps["roundness"];
|
|
9
|
+
}, never>;
|
|
6
10
|
export default StyledTile;
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.StyledHighlight = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _styledSystem = require("styled-system");
|
|
9
9
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
10
10
|
var _elementSizing = _interopRequireDefault(require("../../style/utils/element-sizing"));
|
|
11
|
+
var _tileContent = _interopRequireDefault(require("./tile-content/tile-content.style"));
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -44,6 +45,23 @@ const getBorderRadius = roundness => {
|
|
|
44
45
|
return "var(--borderRadius100)";
|
|
45
46
|
}
|
|
46
47
|
};
|
|
48
|
+
const getHeighlightVariant = variant => {
|
|
49
|
+
switch (variant) {
|
|
50
|
+
case "success":
|
|
51
|
+
return "var(--colorsSemanticPositive500)";
|
|
52
|
+
case "neutral":
|
|
53
|
+
return "var(--colorsSemanticNeutral500)";
|
|
54
|
+
case "error":
|
|
55
|
+
return "var(--colorsSemanticNegative500)";
|
|
56
|
+
case "warning":
|
|
57
|
+
return "var(--colorsSemanticCaution500)";
|
|
58
|
+
case "info":
|
|
59
|
+
return "var(--colorsSemanticInfo500)";
|
|
60
|
+
default:
|
|
61
|
+
// gradient is default
|
|
62
|
+
return "linear-gradient(0deg, rgb(143, 73, 254) 5%, rgb(0, 146, 219) 50%, rgb(19, 160, 56) 95%)";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
47
65
|
const StyledTile = _styledComponents.default.div`
|
|
48
66
|
${({
|
|
49
67
|
borderVariant,
|
|
@@ -62,12 +80,12 @@ const StyledTile = _styledComponents.default.div`
|
|
|
62
80
|
border-radius: ${getBorderRadius(roundness)};
|
|
63
81
|
--tileBorderRadius: ${getBorderRadius(roundness)};
|
|
64
82
|
|
|
65
|
-
> *:first-child {
|
|
83
|
+
> *:first-child:not(${_tileContent.default}) {
|
|
66
84
|
border-top-left-radius: calc(${getBorderRadius(roundness)} - 1px);
|
|
67
85
|
border-top-right-radius: calc(${getBorderRadius(roundness)} - 1px);
|
|
68
86
|
}
|
|
69
87
|
|
|
70
|
-
> *:last-child {
|
|
88
|
+
> *:last-child:not(${_tileContent.default}) {
|
|
71
89
|
border-bottom-left-radius: calc(${getBorderRadius(roundness)} - 1px);
|
|
72
90
|
border-bottom-right-radius: calc(${getBorderRadius(roundness)} - 1px);
|
|
73
91
|
}
|
|
@@ -100,4 +118,21 @@ const StyledTile = _styledComponents.default.div`
|
|
|
100
118
|
StyledTile.defaultProps = {
|
|
101
119
|
theme: _base.default
|
|
102
120
|
};
|
|
121
|
+
const StyledHighlight = exports.StyledHighlight = _styledComponents.default.div`
|
|
122
|
+
height: 100%;
|
|
123
|
+
width: 100%;
|
|
124
|
+
position: relative;
|
|
125
|
+
background: ${({
|
|
126
|
+
variant
|
|
127
|
+
}) => getHeighlightVariant(variant)};
|
|
128
|
+
border-radius: ${({
|
|
129
|
+
roundness
|
|
130
|
+
}) => getBorderRadius(roundness)};
|
|
131
|
+
|
|
132
|
+
${StyledTile} {
|
|
133
|
+
border-left: 0;
|
|
134
|
+
left: 4px;
|
|
135
|
+
width: calc(100% - 4px);
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
103
138
|
var _default = exports.default = StyledTile;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./select-text.component";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface SelectTextProps {
|
|
3
|
-
/** If true the Component will be disabled */
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
/** Value to be displayed */
|
|
6
|
-
formattedValue?: string;
|
|
7
|
-
/** Callback function for when the component is clicked. */
|
|
8
|
-
onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
9
|
-
/** Callback function for when the key is pressed when focused on Select Text. */
|
|
10
|
-
/** Callback function for when the left mouse key is pressed when focused on Select Text. */
|
|
11
|
-
onMouseDown?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
12
|
-
/** Placeholder string to be displayed when formattedValue is empty */
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
/** If true the Component will be read-only */
|
|
15
|
-
readOnly?: boolean;
|
|
16
|
-
/** If true the component has no border and a transparent background */
|
|
17
|
-
transparent?: boolean;
|
|
18
|
-
/** Component size */
|
|
19
|
-
size?: "small" | "medium" | "large";
|
|
20
|
-
}
|
|
21
|
-
declare const SelectText: ({ disabled, formattedValue, onClick, onMouseDown, placeholder, readOnly, transparent, size, }: SelectTextProps) => React.JSX.Element;
|
|
22
|
-
export default SelectText;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { StyledSelectText, StyledSelectTextChildrenWrapper } from "./select-text.style";
|
|
4
|
-
const SelectText = ({
|
|
5
|
-
disabled,
|
|
6
|
-
formattedValue = "",
|
|
7
|
-
onClick,
|
|
8
|
-
onMouseDown,
|
|
9
|
-
placeholder,
|
|
10
|
-
readOnly,
|
|
11
|
-
transparent,
|
|
12
|
-
size = "medium"
|
|
13
|
-
}) => {
|
|
14
|
-
const hasPlaceholder = !disabled && !readOnly && !formattedValue;
|
|
15
|
-
return /*#__PURE__*/React.createElement(StyledSelectText, {
|
|
16
|
-
"aria-hidden": true,
|
|
17
|
-
"data-element": "select-text",
|
|
18
|
-
disabled: disabled,
|
|
19
|
-
hasPlaceholder: hasPlaceholder,
|
|
20
|
-
onClick: onClick,
|
|
21
|
-
onMouseDown: onMouseDown,
|
|
22
|
-
readOnly: readOnly,
|
|
23
|
-
transparent: transparent,
|
|
24
|
-
size: size
|
|
25
|
-
}, /*#__PURE__*/React.createElement(StyledSelectTextChildrenWrapper, null, hasPlaceholder ? placeholder : formattedValue));
|
|
26
|
-
};
|
|
27
|
-
export default SelectText;
|
|
@@ -1,13 +0,0 @@
|
|
|
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 _selectText.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _selectText = _interopRequireDefault(require("./select-text.component"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface SelectTextProps {
|
|
3
|
-
/** If true the Component will be disabled */
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
/** Value to be displayed */
|
|
6
|
-
formattedValue?: string;
|
|
7
|
-
/** Callback function for when the component is clicked. */
|
|
8
|
-
onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
9
|
-
/** Callback function for when the key is pressed when focused on Select Text. */
|
|
10
|
-
/** Callback function for when the left mouse key is pressed when focused on Select Text. */
|
|
11
|
-
onMouseDown?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
12
|
-
/** Placeholder string to be displayed when formattedValue is empty */
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
/** If true the Component will be read-only */
|
|
15
|
-
readOnly?: boolean;
|
|
16
|
-
/** If true the component has no border and a transparent background */
|
|
17
|
-
transparent?: boolean;
|
|
18
|
-
/** Component size */
|
|
19
|
-
size?: "small" | "medium" | "large";
|
|
20
|
-
}
|
|
21
|
-
declare const SelectText: ({ disabled, formattedValue, onClick, onMouseDown, placeholder, readOnly, transparent, size, }: SelectTextProps) => React.JSX.Element;
|
|
22
|
-
export default SelectText;
|