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
|
@@ -3,7 +3,7 @@ import StyledInput from "../../__internal__/input/input.style";
|
|
|
3
3
|
import StyledInputPresentation from "../../__internal__/input/input-presentation.style";
|
|
4
4
|
import StyledFormField from "../../__internal__/form-field/form-field.style";
|
|
5
5
|
import InputIconToggleStyle from "../../__internal__/input-icon-toggle/input-icon-toggle.style";
|
|
6
|
-
import { StyledSelectText } from "../select/__internal__/select-
|
|
6
|
+
import { StyledSelectText } from "../select/__internal__/select-textbox/select-textbox.style";
|
|
7
7
|
import Link from "../link";
|
|
8
8
|
const StyledSelectContainer = styled.div`
|
|
9
9
|
height: 26px;
|
|
@@ -37,8 +37,6 @@ export interface SelectListProps {
|
|
|
37
37
|
tableHeader?: React.ReactNode;
|
|
38
38
|
/** When true component will work in multi column mode, children should consist of OptionRow components in this mode */
|
|
39
39
|
multiColumn?: boolean;
|
|
40
|
-
/** Data role for loader component */
|
|
41
|
-
loaderDataRole?: string;
|
|
42
40
|
/** Placement of the select list relative to the input element */
|
|
43
41
|
listPlacement?: Side;
|
|
44
42
|
/** Use the opposite list placement if the set placement does not fit */
|
|
@@ -38,7 +38,6 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
38
38
|
onListScrollBottom,
|
|
39
39
|
multiColumn,
|
|
40
40
|
tableHeader,
|
|
41
|
-
loaderDataRole,
|
|
42
41
|
listPlacement = "bottom",
|
|
43
42
|
flipEnabled = true,
|
|
44
43
|
isOpen,
|
|
@@ -172,9 +171,6 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
172
171
|
start
|
|
173
172
|
}) => {
|
|
174
173
|
const child = childrenList[index];
|
|
175
|
-
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
176
|
-
return child;
|
|
177
|
-
}
|
|
178
174
|
const optionChildIndex = optionChildrenList.indexOf(child);
|
|
179
175
|
const isOption = optionChildIndex > -1;
|
|
180
176
|
const newProps = {
|
|
@@ -384,9 +380,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
384
380
|
})] : [])], [flipEnabled]);
|
|
385
381
|
const loader = isLoading ? /*#__PURE__*/React.createElement(StyledSelectLoaderContainer, {
|
|
386
382
|
key: "loader"
|
|
387
|
-
}, /*#__PURE__*/React.createElement(Loader,
|
|
388
|
-
"data-role": loaderDataRole
|
|
389
|
-
})) : undefined;
|
|
383
|
+
}, /*#__PURE__*/React.createElement(Loader, null)) : undefined;
|
|
390
384
|
let selectListContent = renderedChildren;
|
|
391
385
|
const listBoxProps = {
|
|
392
386
|
role: "listbox",
|
|
@@ -423,11 +417,13 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
423
417
|
animationFrame: true
|
|
424
418
|
}, /*#__PURE__*/React.createElement(StyledSelectListContainer, _extends({
|
|
425
419
|
"data-element": "select-list-wrapper",
|
|
420
|
+
"data-role": "select-list-wrapper",
|
|
426
421
|
isLoading: isLoading
|
|
427
422
|
}, listProps), /*#__PURE__*/React.createElement(StyledScrollableContainer, {
|
|
428
423
|
ref: listContainerRef,
|
|
429
424
|
maxHeight: listMaxHeight,
|
|
430
425
|
"data-component": "select-list-scrollable-container",
|
|
426
|
+
"data-role": "select-list-scrollable-container",
|
|
431
427
|
hasActionButton: !!listActionButton
|
|
432
428
|
}, /*#__PURE__*/React.createElement(StyledSelectList, _extends({
|
|
433
429
|
as: multiColumn ? "div" : "ul",
|
|
@@ -463,7 +459,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
463
459
|
"listActionButton": PropTypes.node,
|
|
464
460
|
"listMaxHeight": PropTypes.number,
|
|
465
461
|
"listPlacement": PropTypes.oneOf(["bottom", "left", "right", "top"]),
|
|
466
|
-
"loaderDataRole": PropTypes.string,
|
|
467
462
|
"multiColumn": PropTypes.bool,
|
|
468
463
|
"multiselectValues": PropTypes.arrayOf(PropTypes.string),
|
|
469
464
|
"onListAction": PropTypes.func,
|
|
@@ -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;
|
|
@@ -1,81 +1,45 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { SelectTextboxContext } from "./select-textbox.context";
|
|
5
|
+
import { StyledSelectText, StyledSelectTextChildrenWrapper } from "./select-textbox.style";
|
|
6
6
|
import Textbox from "../../../textbox";
|
|
7
|
-
import SelectText from "../select-text";
|
|
8
7
|
import useLocale from "../../../../hooks/__internal__/useLocale";
|
|
9
|
-
import { SelectTextboxContext } from "./select-textbox.context";
|
|
10
|
-
const floatingMiddleware = [offset(({
|
|
11
|
-
rects
|
|
12
|
-
}) => ({
|
|
13
|
-
mainAxis: -rects.reference.height
|
|
14
|
-
})), sizeMiddleware({
|
|
15
|
-
apply({
|
|
16
|
-
rects,
|
|
17
|
-
elements
|
|
18
|
-
}) {
|
|
19
|
-
elements.reference.style.height = `${rects.floating.height}px`;
|
|
20
|
-
elements.floating.style.width = `${rects.reference.width}px`;
|
|
21
|
-
}
|
|
22
|
-
})];
|
|
23
8
|
const SelectTextbox = /*#__PURE__*/React.forwardRef(({
|
|
24
9
|
ariaLabel,
|
|
25
10
|
ariaLabelledby,
|
|
26
11
|
accessibilityLabelId,
|
|
27
12
|
labelId,
|
|
28
13
|
"aria-controls": ariaControls,
|
|
29
|
-
disabled,
|
|
14
|
+
disabled = false,
|
|
30
15
|
isOpen,
|
|
31
16
|
id,
|
|
32
|
-
readOnly,
|
|
33
|
-
placeholder,
|
|
17
|
+
readOnly = false,
|
|
18
|
+
placeholder: customPlaceholder,
|
|
34
19
|
size = "medium",
|
|
35
20
|
onClick,
|
|
36
21
|
onFocus,
|
|
37
22
|
onBlur,
|
|
38
23
|
onChange,
|
|
24
|
+
formattedValue = "",
|
|
39
25
|
selectedValue,
|
|
40
26
|
required,
|
|
41
27
|
isOptional,
|
|
42
|
-
textboxRef,
|
|
43
28
|
hasTextCursor,
|
|
44
|
-
transparent,
|
|
29
|
+
transparent = false,
|
|
45
30
|
activeDescendantId,
|
|
46
31
|
onKeyDown,
|
|
47
32
|
...restProps
|
|
48
33
|
}, ref) => {
|
|
49
|
-
const reference = useMemo(() => ({
|
|
50
|
-
current: textboxRef?.parentElement?.parentElement || null
|
|
51
|
-
}), [textboxRef]);
|
|
52
|
-
const floating = useMemo(() => ({
|
|
53
|
-
current: textboxRef?.parentElement || null
|
|
54
|
-
}), [textboxRef]);
|
|
55
|
-
useFloating({
|
|
56
|
-
isOpen,
|
|
57
|
-
reference,
|
|
58
|
-
floating,
|
|
59
|
-
strategy: "fixed",
|
|
60
|
-
animationFrame: true,
|
|
61
|
-
middleware: floatingMiddleware
|
|
62
|
-
});
|
|
63
34
|
const l = useLocale();
|
|
35
|
+
const placeholder = customPlaceholder || l.select.placeholder();
|
|
36
|
+
const showPlaceholder = !disabled && !readOnly && !formattedValue;
|
|
64
37
|
function handleTextboxClick(event) {
|
|
65
38
|
onClick?.(event);
|
|
66
39
|
}
|
|
67
40
|
function handleTextboxFocus(event) {
|
|
68
|
-
if (disabled || readOnly)
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
if (onFocus) {
|
|
72
|
-
onFocus(event);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function handleTextboxBlur(event) {
|
|
76
|
-
if (onBlur) {
|
|
77
|
-
onBlur(event);
|
|
78
|
-
}
|
|
41
|
+
if (disabled || readOnly) return;
|
|
42
|
+
onFocus?.(event);
|
|
79
43
|
}
|
|
80
44
|
const textboxProps = {
|
|
81
45
|
disabled,
|
|
@@ -85,7 +49,7 @@ const SelectTextbox = /*#__PURE__*/React.forwardRef(({
|
|
|
85
49
|
isOptional,
|
|
86
50
|
onClick: handleTextboxClick,
|
|
87
51
|
onFocus: handleTextboxFocus,
|
|
88
|
-
onBlur
|
|
52
|
+
onBlur,
|
|
89
53
|
labelId,
|
|
90
54
|
type: "text",
|
|
91
55
|
ref,
|
|
@@ -108,22 +72,27 @@ const SelectTextbox = /*#__PURE__*/React.forwardRef(({
|
|
|
108
72
|
}, /*#__PURE__*/React.createElement(Textbox, _extends({
|
|
109
73
|
"aria-label": ariaLabel,
|
|
110
74
|
"data-element": "select-input",
|
|
75
|
+
"data-role": "select-textbox",
|
|
111
76
|
inputIcon: "dropdown",
|
|
112
77
|
autoComplete: "off",
|
|
113
78
|
size: size,
|
|
114
79
|
onChange: onChange,
|
|
80
|
+
formattedValue: formattedValue,
|
|
115
81
|
value: hasStringValue ? selectedValue : undefined,
|
|
116
|
-
placeholder: hasTextCursor ? placeholder
|
|
82
|
+
placeholder: hasTextCursor ? placeholder : undefined
|
|
117
83
|
}, inputAriaAttributes, textboxProps, {
|
|
118
84
|
my: 0 // prevents any form spacing being applied
|
|
119
|
-
}), !hasTextCursor && /*#__PURE__*/React.createElement(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
85
|
+
}), !hasTextCursor && /*#__PURE__*/React.createElement(StyledSelectText, _extends({
|
|
86
|
+
"aria-hidden": true,
|
|
87
|
+
"data-element": "select-text",
|
|
88
|
+
"data-role": "select-text",
|
|
123
89
|
disabled: disabled,
|
|
90
|
+
hasPlaceholder: showPlaceholder,
|
|
91
|
+
onClick: disabled || readOnly ? undefined : handleTextboxClick,
|
|
124
92
|
readOnly: readOnly,
|
|
93
|
+
transparent: transparent,
|
|
125
94
|
size: size
|
|
126
|
-
}, restProps))));
|
|
95
|
+
}, restProps), /*#__PURE__*/React.createElement(StyledSelectTextChildrenWrapper, null, showPlaceholder ? placeholder : formattedValue))));
|
|
127
96
|
});
|
|
128
97
|
if (process.env.NODE_ENV !== "production") {
|
|
129
98
|
SelectTextbox.propTypes = {
|
|
@@ -652,7 +621,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
652
621
|
"suppressContentEditableWarning": PropTypes.bool,
|
|
653
622
|
"suppressHydrationWarning": PropTypes.bool,
|
|
654
623
|
"tabIndex": PropTypes.number,
|
|
655
|
-
"textboxRef": PropTypes.object,
|
|
656
624
|
"title": PropTypes.string,
|
|
657
625
|
"tooltipPosition": PropTypes.oneOf(["bottom", "left", "right", "top"]),
|
|
658
626
|
"translate": PropTypes.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;
|
|
@@ -364,10 +364,9 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
364
364
|
onListAction?.();
|
|
365
365
|
}
|
|
366
366
|
const assignInput = useCallback(element => {
|
|
367
|
+
if (!element) return;
|
|
367
368
|
setTextboxRef(element);
|
|
368
|
-
if (!ref)
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
369
|
+
if (!ref) return;
|
|
371
370
|
if (typeof ref === "function") {
|
|
372
371
|
ref(element);
|
|
373
372
|
} else {
|
|
@@ -381,7 +380,6 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
381
380
|
label,
|
|
382
381
|
disabled,
|
|
383
382
|
readOnly,
|
|
384
|
-
ref: assignInput,
|
|
385
383
|
selectedValue,
|
|
386
384
|
formattedValue: textValue,
|
|
387
385
|
onClick: handleTextboxClick,
|
|
@@ -416,7 +414,6 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
416
414
|
onListScrollBottom,
|
|
417
415
|
tableHeader,
|
|
418
416
|
multiColumn,
|
|
419
|
-
loaderDataRole: "filterable-select-list-loader",
|
|
420
417
|
listPlacement,
|
|
421
418
|
flipEnabled,
|
|
422
419
|
isOpen,
|
|
@@ -436,14 +433,14 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
436
433
|
}, marginProps), /*#__PURE__*/React.createElement("div", {
|
|
437
434
|
ref: containerRef
|
|
438
435
|
}, /*#__PURE__*/React.createElement(SelectTextbox, _extends({
|
|
436
|
+
ref: assignInput,
|
|
439
437
|
activeDescendantId: activeDescendantId,
|
|
440
438
|
ariaLabel: ariaLabel,
|
|
441
439
|
ariaLabelledby: ariaLabelledby,
|
|
442
440
|
labelId: label ? labelId : undefined,
|
|
443
441
|
"aria-controls": selectListId.current,
|
|
444
442
|
isOpen: isOpen,
|
|
445
|
-
hasTextCursor: true
|
|
446
|
-
textboxRef: textboxRef
|
|
443
|
+
hasTextCursor: true
|
|
447
444
|
}, getTextboxProps()))), selectList);
|
|
448
445
|
});
|
|
449
446
|
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;
|
|
@@ -386,10 +386,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
386
386
|
setFilterText("");
|
|
387
387
|
}, []);
|
|
388
388
|
const assignInput = useCallback(element => {
|
|
389
|
+
if (!element) return;
|
|
389
390
|
setTextboxRef(element);
|
|
390
|
-
if (!ref)
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
391
|
+
if (!ref) return;
|
|
393
392
|
if (typeof ref === "function") {
|
|
394
393
|
ref(element);
|
|
395
394
|
} else {
|
|
@@ -405,7 +404,6 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
405
404
|
readOnly,
|
|
406
405
|
placeholder: placeholderOverride,
|
|
407
406
|
leftChildren: mapValuesToPills,
|
|
408
|
-
ref: assignInput,
|
|
409
407
|
formattedValue: textValue,
|
|
410
408
|
selectedValue: actualValue,
|
|
411
409
|
onClick: handleTextboxClick,
|
|
@@ -440,7 +438,6 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
440
438
|
listPlacement: listPlacement,
|
|
441
439
|
listMaxHeight: listMaxHeight,
|
|
442
440
|
flipEnabled: flipEnabled,
|
|
443
|
-
loaderDataRole: "multi-select-list-loader",
|
|
444
441
|
multiselectValues: actualValue,
|
|
445
442
|
isOpen: isOpen,
|
|
446
443
|
enableVirtualScroll: enableVirtualScroll,
|
|
@@ -462,6 +459,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
462
459
|
"data-element": "accessibility-label",
|
|
463
460
|
id: accessibilityLabelId.current
|
|
464
461
|
}, accessibilityLabel), /*#__PURE__*/React.createElement(SelectTextbox, _extends({
|
|
462
|
+
ref: assignInput,
|
|
465
463
|
accessibilityLabelId: accessibilityLabelId.current,
|
|
466
464
|
activeDescendantId: activeDescendantId,
|
|
467
465
|
"aria-controls": selectListId.current,
|
|
@@ -469,8 +467,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
469
467
|
ariaLabelledby: ariaLabelledby,
|
|
470
468
|
hasTextCursor: true,
|
|
471
469
|
isOpen: isOpen,
|
|
472
|
-
labelId: labelId
|
|
473
|
-
textboxRef: textboxRef
|
|
470
|
+
labelId: labelId
|
|
474
471
|
}, getTextboxProps()))), selectList);
|
|
475
472
|
});
|
|
476
473
|
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;
|
|
@@ -282,10 +282,9 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
282
282
|
setOpenState(false);
|
|
283
283
|
}, []);
|
|
284
284
|
const assignInput = useCallback(element => {
|
|
285
|
+
if (!element) return;
|
|
285
286
|
setTextboxRef(element);
|
|
286
|
-
if (!ref)
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
287
|
+
if (!ref) return;
|
|
289
288
|
if (typeof ref === "function") {
|
|
290
289
|
ref(element);
|
|
291
290
|
} else {
|
|
@@ -298,7 +297,6 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
298
297
|
name,
|
|
299
298
|
disabled,
|
|
300
299
|
readOnly,
|
|
301
|
-
ref: assignInput,
|
|
302
300
|
selectedValue,
|
|
303
301
|
formattedValue: textValue,
|
|
304
302
|
onClick: handleTextboxClick,
|
|
@@ -330,7 +328,6 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
330
328
|
onListScrollBottom: onListScrollBottom,
|
|
331
329
|
tableHeader: tableHeader,
|
|
332
330
|
multiColumn: multiColumn,
|
|
333
|
-
loaderDataRole: "simple-select-list-loader",
|
|
334
331
|
listPlacement: listPlacement,
|
|
335
332
|
flipEnabled: flipEnabled,
|
|
336
333
|
isOpen: isOpen,
|
|
@@ -349,12 +346,12 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
349
346
|
}, marginProps), /*#__PURE__*/React.createElement("div", {
|
|
350
347
|
ref: containerRef
|
|
351
348
|
}, /*#__PURE__*/React.createElement(SelectTextbox, _extends({
|
|
349
|
+
ref: assignInput,
|
|
352
350
|
ariaLabel: ariaLabel,
|
|
353
351
|
"aria-controls": selectListId.current,
|
|
354
352
|
activeDescendantId: activeDescendantId,
|
|
355
353
|
ariaLabelledby: ariaLabelledby,
|
|
356
|
-
isOpen: isOpen
|
|
357
|
-
textboxRef: textboxRef
|
|
354
|
+
isOpen: isOpen
|
|
358
355
|
}, getTextboxProps()))), selectList);
|
|
359
356
|
});
|
|
360
357
|
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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import StyledTile from "./tile.style";
|
|
4
|
+
import StyledTile, { StyledHighlight } from "./tile.style";
|
|
5
5
|
import TileContext from "./__internal__/tile.context";
|
|
6
6
|
import filterStyledSystemPaddingProps from "../../style/utils/filter-styled-system-padding-props";
|
|
7
7
|
import filterStyledSystemMarginProps from "../../style/utils/filter-styled-system-margin-props";
|
|
@@ -17,6 +17,7 @@ export const Tile = ({
|
|
|
17
17
|
height,
|
|
18
18
|
borderWidth,
|
|
19
19
|
borderVariant,
|
|
20
|
+
highlightVariant,
|
|
20
21
|
...rest
|
|
21
22
|
}) => {
|
|
22
23
|
const isHorizontal = orientation === "horizontal";
|
|
@@ -26,7 +27,7 @@ export const Tile = ({
|
|
|
26
27
|
});
|
|
27
28
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
28
29
|
const contentPaddingProps = computeContentPadding(paddingProps, isHorizontal);
|
|
29
|
-
|
|
30
|
+
const tile = /*#__PURE__*/React.createElement(StyledTile, _extends({
|
|
30
31
|
variant: variant,
|
|
31
32
|
width: width,
|
|
32
33
|
height: height,
|
|
@@ -41,5 +42,14 @@ export const Tile = ({
|
|
|
41
42
|
paddingPropsFromTile: contentPaddingProps
|
|
42
43
|
}
|
|
43
44
|
}, children));
|
|
45
|
+
if (highlightVariant) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(StyledHighlight, {
|
|
47
|
+
variant: highlightVariant,
|
|
48
|
+
roundness: roundness,
|
|
49
|
+
"aria-hidden": true,
|
|
50
|
+
"data-role": `tile-${highlightVariant}-highlight`
|
|
51
|
+
}, tile);
|
|
52
|
+
}
|
|
53
|
+
return tile;
|
|
44
54
|
};
|
|
45
55
|
export default Tile;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export const TILE_ORIENTATIONS = ["horizontal", "vertical"];
|
|
2
2
|
export const TILE_THEMES = ["tile", "transparent", "active", "grey"];
|
|
3
|
-
export const TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
3
|
+
export const TILE_BORDER_VARIANTS = ["default", "info", "selected", "negative", "positive", "caution"];
|
|
4
|
+
export const 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;
|
|
@@ -2,6 +2,7 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { space } from "styled-system";
|
|
3
3
|
import baseTheme from "../../style/themes/base";
|
|
4
4
|
import computeSizing from "../../style/utils/element-sizing";
|
|
5
|
+
import StyledTileContent from "./tile-content/tile-content.style";
|
|
5
6
|
const getBorderColor = (borderVariant, variant) => {
|
|
6
7
|
switch (borderVariant) {
|
|
7
8
|
case "selected":
|
|
@@ -35,6 +36,23 @@ const getBorderRadius = roundness => {
|
|
|
35
36
|
return "var(--borderRadius100)";
|
|
36
37
|
}
|
|
37
38
|
};
|
|
39
|
+
const getHeighlightVariant = variant => {
|
|
40
|
+
switch (variant) {
|
|
41
|
+
case "success":
|
|
42
|
+
return "var(--colorsSemanticPositive500)";
|
|
43
|
+
case "neutral":
|
|
44
|
+
return "var(--colorsSemanticNeutral500)";
|
|
45
|
+
case "error":
|
|
46
|
+
return "var(--colorsSemanticNegative500)";
|
|
47
|
+
case "warning":
|
|
48
|
+
return "var(--colorsSemanticCaution500)";
|
|
49
|
+
case "info":
|
|
50
|
+
return "var(--colorsSemanticInfo500)";
|
|
51
|
+
default:
|
|
52
|
+
// gradient is default
|
|
53
|
+
return "linear-gradient(0deg, rgb(143, 73, 254) 5%, rgb(0, 146, 219) 50%, rgb(19, 160, 56) 95%)";
|
|
54
|
+
}
|
|
55
|
+
};
|
|
38
56
|
const StyledTile = styled.div`
|
|
39
57
|
${({
|
|
40
58
|
borderVariant,
|
|
@@ -53,12 +71,12 @@ const StyledTile = styled.div`
|
|
|
53
71
|
border-radius: ${getBorderRadius(roundness)};
|
|
54
72
|
--tileBorderRadius: ${getBorderRadius(roundness)};
|
|
55
73
|
|
|
56
|
-
> *:first-child {
|
|
74
|
+
> *:first-child:not(${StyledTileContent}) {
|
|
57
75
|
border-top-left-radius: calc(${getBorderRadius(roundness)} - 1px);
|
|
58
76
|
border-top-right-radius: calc(${getBorderRadius(roundness)} - 1px);
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
> *:last-child {
|
|
79
|
+
> *:last-child:not(${StyledTileContent}) {
|
|
62
80
|
border-bottom-left-radius: calc(${getBorderRadius(roundness)} - 1px);
|
|
63
81
|
border-bottom-right-radius: calc(${getBorderRadius(roundness)} - 1px);
|
|
64
82
|
}
|
|
@@ -91,4 +109,21 @@ const StyledTile = styled.div`
|
|
|
91
109
|
StyledTile.defaultProps = {
|
|
92
110
|
theme: baseTheme
|
|
93
111
|
};
|
|
112
|
+
export const StyledHighlight = styled.div`
|
|
113
|
+
height: 100%;
|
|
114
|
+
width: 100%;
|
|
115
|
+
position: relative;
|
|
116
|
+
background: ${({
|
|
117
|
+
variant
|
|
118
|
+
}) => getHeighlightVariant(variant)};
|
|
119
|
+
border-radius: ${({
|
|
120
|
+
roundness
|
|
121
|
+
}) => getBorderRadius(roundness)};
|
|
122
|
+
|
|
123
|
+
${StyledTile} {
|
|
124
|
+
border-left: 0;
|
|
125
|
+
left: 4px;
|
|
126
|
+
width: calc(100% - 4px);
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
94
129
|
export default StyledTile;
|
|
@@ -9,7 +9,7 @@ var _input = _interopRequireDefault(require("../../__internal__/input/input.styl
|
|
|
9
9
|
var _inputPresentation = _interopRequireDefault(require("../../__internal__/input/input-presentation.style"));
|
|
10
10
|
var _formField = _interopRequireDefault(require("../../__internal__/form-field/form-field.style"));
|
|
11
11
|
var _inputIconToggle = _interopRequireDefault(require("../../__internal__/input-icon-toggle/input-icon-toggle.style"));
|
|
12
|
-
var
|
|
12
|
+
var _selectTextbox = require("../select/__internal__/select-textbox/select-textbox.style");
|
|
13
13
|
var _link = _interopRequireDefault(require("../link"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
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); }
|
|
@@ -51,7 +51,7 @@ const StyledPagerSizeOptions = exports.StyledPagerSizeOptions = _styledComponent
|
|
|
51
51
|
min-width: 10px;
|
|
52
52
|
margin: 0px;
|
|
53
53
|
|
|
54
|
-
${
|
|
54
|
+
${_selectTextbox.StyledSelectText} {
|
|
55
55
|
font-size: 14px;
|
|
56
56
|
padding-right: 0px;
|
|
57
57
|
padding-left: 8px;
|
|
@@ -37,8 +37,6 @@ export interface SelectListProps {
|
|
|
37
37
|
tableHeader?: React.ReactNode;
|
|
38
38
|
/** When true component will work in multi column mode, children should consist of OptionRow components in this mode */
|
|
39
39
|
multiColumn?: boolean;
|
|
40
|
-
/** Data role for loader component */
|
|
41
|
-
loaderDataRole?: string;
|
|
42
40
|
/** Placement of the select list relative to the input element */
|
|
43
41
|
listPlacement?: Side;
|
|
44
42
|
/** Use the opposite list placement if the set placement does not fit */
|
|
@@ -47,7 +47,6 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
47
47
|
onListScrollBottom,
|
|
48
48
|
multiColumn,
|
|
49
49
|
tableHeader,
|
|
50
|
-
loaderDataRole,
|
|
51
50
|
listPlacement = "bottom",
|
|
52
51
|
flipEnabled = true,
|
|
53
52
|
isOpen,
|
|
@@ -181,9 +180,6 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
181
180
|
start
|
|
182
181
|
}) => {
|
|
183
182
|
const child = childrenList[index];
|
|
184
|
-
if (! /*#__PURE__*/_react.default.isValidElement(child)) {
|
|
185
|
-
return child;
|
|
186
|
-
}
|
|
187
183
|
const optionChildIndex = optionChildrenList.indexOf(child);
|
|
188
184
|
const isOption = optionChildIndex > -1;
|
|
189
185
|
const newProps = {
|
|
@@ -393,9 +389,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
393
389
|
})] : [])], [flipEnabled]);
|
|
394
390
|
const loader = isLoading ? /*#__PURE__*/_react.default.createElement(_selectList.StyledSelectLoaderContainer, {
|
|
395
391
|
key: "loader"
|
|
396
|
-
}, /*#__PURE__*/_react.default.createElement(_loader.default,
|
|
397
|
-
"data-role": loaderDataRole
|
|
398
|
-
})) : undefined;
|
|
392
|
+
}, /*#__PURE__*/_react.default.createElement(_loader.default, null)) : undefined;
|
|
399
393
|
let selectListContent = renderedChildren;
|
|
400
394
|
const listBoxProps = {
|
|
401
395
|
role: "listbox",
|
|
@@ -432,11 +426,13 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
432
426
|
animationFrame: true
|
|
433
427
|
}, /*#__PURE__*/_react.default.createElement(_selectList.StyledSelectListContainer, _extends({
|
|
434
428
|
"data-element": "select-list-wrapper",
|
|
429
|
+
"data-role": "select-list-wrapper",
|
|
435
430
|
isLoading: isLoading
|
|
436
431
|
}, listProps), /*#__PURE__*/_react.default.createElement(_selectList.StyledScrollableContainer, {
|
|
437
432
|
ref: listContainerRef,
|
|
438
433
|
maxHeight: listMaxHeight,
|
|
439
434
|
"data-component": "select-list-scrollable-container",
|
|
435
|
+
"data-role": "select-list-scrollable-container",
|
|
440
436
|
hasActionButton: !!listActionButton
|
|
441
437
|
}, /*#__PURE__*/_react.default.createElement(_selectList.StyledSelectList, _extends({
|
|
442
438
|
as: multiColumn ? "div" : "ul",
|
|
@@ -472,7 +468,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
472
468
|
"listActionButton": _propTypes.default.node,
|
|
473
469
|
"listMaxHeight": _propTypes.default.number,
|
|
474
470
|
"listPlacement": _propTypes.default.oneOf(["bottom", "left", "right", "top"]),
|
|
475
|
-
"loaderDataRole": _propTypes.default.string,
|
|
476
471
|
"multiColumn": _propTypes.default.bool,
|
|
477
472
|
"multiselectValues": _propTypes.default.arrayOf(_propTypes.default.string),
|
|
478
473
|
"onListAction": _propTypes.default.func,
|