carbon-react 125.3.0 → 125.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/inline-inputs/inline-inputs.component.d.ts +3 -1
- package/esm/components/inline-inputs/inline-inputs.component.js +2 -0
- package/esm/components/select/filterable-select/filterable-select.component.d.ts +3 -0
- package/esm/components/select/filterable-select/filterable-select.component.js +24 -19
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +3 -1
- package/lib/components/inline-inputs/inline-inputs.component.js +2 -0
- package/lib/components/select/filterable-select/filterable-select.component.d.ts +3 -0
- package/lib/components/select/filterable-select/filterable-select.component.js +24 -19
- package/package.json +1 -1
|
@@ -12,6 +12,8 @@ export interface InlineInputsProps extends MarginProps, StyledContentContainerPr
|
|
|
12
12
|
htmlFor?: string;
|
|
13
13
|
/** Defines the label text for the heading. */
|
|
14
14
|
label?: string;
|
|
15
|
+
/** Inline label alignment */
|
|
16
|
+
labelAlign?: "left" | "right";
|
|
15
17
|
/**
|
|
16
18
|
* Custom label id, could be used in combination with aria-labelledby prop of each input,
|
|
17
19
|
* to make them accesible for screen readers.
|
|
@@ -21,7 +23,7 @@ export interface InlineInputsProps extends MarginProps, StyledContentContainerPr
|
|
|
21
23
|
required?: boolean;
|
|
22
24
|
}
|
|
23
25
|
declare const InlineInputs: {
|
|
24
|
-
({ adaptiveLabelBreakpoint, label, labelId, htmlFor, children, className, gutter, inputWidth, labelInline, labelWidth, required, ...rest }: InlineInputsProps): React.JSX.Element;
|
|
26
|
+
({ adaptiveLabelBreakpoint, label, labelAlign, labelId, htmlFor, children, className, gutter, inputWidth, labelInline, labelWidth, required, ...rest }: InlineInputsProps): React.JSX.Element;
|
|
25
27
|
displayName: string;
|
|
26
28
|
};
|
|
27
29
|
export default InlineInputs;
|
|
@@ -17,6 +17,7 @@ const columnWrapper = (children, gutter) => {
|
|
|
17
17
|
const InlineInputs = ({
|
|
18
18
|
adaptiveLabelBreakpoint,
|
|
19
19
|
label,
|
|
20
|
+
labelAlign,
|
|
20
21
|
labelId,
|
|
21
22
|
htmlFor,
|
|
22
23
|
children = null,
|
|
@@ -36,6 +37,7 @@ const InlineInputs = ({
|
|
|
36
37
|
function renderLabel() {
|
|
37
38
|
if (!label) return null;
|
|
38
39
|
return /*#__PURE__*/React.createElement(Label, {
|
|
40
|
+
align: labelAlign,
|
|
39
41
|
labelId: labelId,
|
|
40
42
|
inline: inlineLabel,
|
|
41
43
|
htmlFor: htmlFor,
|
|
@@ -60,6 +60,9 @@ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "default
|
|
|
60
60
|
* Higher values make for smoother scrolling but may impact performance.
|
|
61
61
|
* Only used if the `enableVirtualScroll` prop is set. */
|
|
62
62
|
virtualScrollOverscan?: number;
|
|
63
|
+
/** Boolean to disable automatic filtering and highlighting of options.
|
|
64
|
+
* This allows custom filtering and option styling to be performed outside of the component when the filter text changes. */
|
|
65
|
+
disableDefaultFiltering?: boolean;
|
|
63
66
|
}
|
|
64
67
|
export declare const FilterableSelect: React.ForwardRefExoticComponent<FilterableSelectProps & React.RefAttributes<unknown>>;
|
|
65
68
|
export default FilterableSelect;
|
|
@@ -54,6 +54,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
54
54
|
inputRef,
|
|
55
55
|
enableVirtualScroll,
|
|
56
56
|
virtualScrollOverscan,
|
|
57
|
+
disableDefaultFiltering = false,
|
|
57
58
|
...textboxProps
|
|
58
59
|
}, ref) => {
|
|
59
60
|
const [activeDescendantId, setActiveDescendantId] = useState();
|
|
@@ -396,32 +397,35 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
396
397
|
...filterOutStyledSystemSpacingProps(textboxProps)
|
|
397
398
|
};
|
|
398
399
|
}
|
|
399
|
-
const
|
|
400
|
+
const selectListProps = {
|
|
400
401
|
ref: listboxRef,
|
|
401
402
|
id: selectListId.current,
|
|
402
|
-
labelId
|
|
403
|
+
labelId,
|
|
403
404
|
anchorElement: textboxRef?.parentElement || undefined,
|
|
404
405
|
onSelect: onSelectOption,
|
|
405
|
-
onSelectListClose
|
|
406
|
+
onSelectListClose,
|
|
406
407
|
onMouseDown: handleListMouseDown,
|
|
407
|
-
filterText
|
|
408
|
-
highlightedValue
|
|
409
|
-
noResultsMessage
|
|
410
|
-
disablePortal
|
|
411
|
-
listActionButton
|
|
412
|
-
listMaxHeight
|
|
408
|
+
filterText,
|
|
409
|
+
highlightedValue,
|
|
410
|
+
noResultsMessage,
|
|
411
|
+
disablePortal,
|
|
412
|
+
listActionButton,
|
|
413
|
+
listMaxHeight,
|
|
413
414
|
onListAction: handleOnListAction,
|
|
414
|
-
isLoading
|
|
415
|
-
onListScrollBottom
|
|
416
|
-
tableHeader
|
|
417
|
-
multiColumn
|
|
415
|
+
isLoading,
|
|
416
|
+
onListScrollBottom,
|
|
417
|
+
tableHeader,
|
|
418
|
+
multiColumn,
|
|
418
419
|
loaderDataRole: "filterable-select-list-loader",
|
|
419
|
-
listPlacement
|
|
420
|
-
flipEnabled
|
|
421
|
-
isOpen
|
|
422
|
-
enableVirtualScroll
|
|
423
|
-
virtualScrollOverscan
|
|
424
|
-
}
|
|
420
|
+
listPlacement,
|
|
421
|
+
flipEnabled,
|
|
422
|
+
isOpen,
|
|
423
|
+
enableVirtualScroll,
|
|
424
|
+
virtualScrollOverscan
|
|
425
|
+
};
|
|
426
|
+
const selectList = disableDefaultFiltering ? /*#__PURE__*/React.createElement(SelectList, selectListProps, children) : /*#__PURE__*/React.createElement(FilterableSelectList, _extends({}, selectListProps, {
|
|
427
|
+
filterText: filterText
|
|
428
|
+
}), children);
|
|
425
429
|
const marginProps = useFormSpacing(textboxProps);
|
|
426
430
|
return /*#__PURE__*/React.createElement(StyledSelect, _extends({
|
|
427
431
|
hasTextCursor: true,
|
|
@@ -529,6 +533,7 @@ FilterableSelect.propTypes = {
|
|
|
529
533
|
"deferTimeout": PropTypes.number,
|
|
530
534
|
"dir": PropTypes.string,
|
|
531
535
|
"disabled": PropTypes.bool,
|
|
536
|
+
"disableDefaultFiltering": PropTypes.bool,
|
|
532
537
|
"disablePortal": PropTypes.bool,
|
|
533
538
|
"draggable": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
|
|
534
539
|
"enableVirtualScroll": PropTypes.bool,
|
|
@@ -12,6 +12,8 @@ export interface InlineInputsProps extends MarginProps, StyledContentContainerPr
|
|
|
12
12
|
htmlFor?: string;
|
|
13
13
|
/** Defines the label text for the heading. */
|
|
14
14
|
label?: string;
|
|
15
|
+
/** Inline label alignment */
|
|
16
|
+
labelAlign?: "left" | "right";
|
|
15
17
|
/**
|
|
16
18
|
* Custom label id, could be used in combination with aria-labelledby prop of each input,
|
|
17
19
|
* to make them accesible for screen readers.
|
|
@@ -21,7 +23,7 @@ export interface InlineInputsProps extends MarginProps, StyledContentContainerPr
|
|
|
21
23
|
required?: boolean;
|
|
22
24
|
}
|
|
23
25
|
declare const InlineInputs: {
|
|
24
|
-
({ adaptiveLabelBreakpoint, label, labelId, htmlFor, children, className, gutter, inputWidth, labelInline, labelWidth, required, ...rest }: InlineInputsProps): React.JSX.Element;
|
|
26
|
+
({ adaptiveLabelBreakpoint, label, labelAlign, labelId, htmlFor, children, className, gutter, inputWidth, labelInline, labelWidth, required, ...rest }: InlineInputsProps): React.JSX.Element;
|
|
25
27
|
displayName: string;
|
|
26
28
|
};
|
|
27
29
|
export default InlineInputs;
|
|
@@ -26,6 +26,7 @@ const columnWrapper = (children, gutter) => {
|
|
|
26
26
|
const InlineInputs = ({
|
|
27
27
|
adaptiveLabelBreakpoint,
|
|
28
28
|
label,
|
|
29
|
+
labelAlign,
|
|
29
30
|
labelId,
|
|
30
31
|
htmlFor,
|
|
31
32
|
children = null,
|
|
@@ -45,6 +46,7 @@ const InlineInputs = ({
|
|
|
45
46
|
function renderLabel() {
|
|
46
47
|
if (!label) return null;
|
|
47
48
|
return /*#__PURE__*/_react.default.createElement(_label.default, {
|
|
49
|
+
align: labelAlign,
|
|
48
50
|
labelId: labelId,
|
|
49
51
|
inline: inlineLabel,
|
|
50
52
|
htmlFor: htmlFor,
|
|
@@ -60,6 +60,9 @@ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "default
|
|
|
60
60
|
* Higher values make for smoother scrolling but may impact performance.
|
|
61
61
|
* Only used if the `enableVirtualScroll` prop is set. */
|
|
62
62
|
virtualScrollOverscan?: number;
|
|
63
|
+
/** Boolean to disable automatic filtering and highlighting of options.
|
|
64
|
+
* This allows custom filtering and option styling to be performed outside of the component when the filter text changes. */
|
|
65
|
+
disableDefaultFiltering?: boolean;
|
|
63
66
|
}
|
|
64
67
|
export declare const FilterableSelect: React.ForwardRefExoticComponent<FilterableSelectProps & React.RefAttributes<unknown>>;
|
|
65
68
|
export default FilterableSelect;
|
|
@@ -63,6 +63,7 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
|
|
|
63
63
|
inputRef,
|
|
64
64
|
enableVirtualScroll,
|
|
65
65
|
virtualScrollOverscan,
|
|
66
|
+
disableDefaultFiltering = false,
|
|
66
67
|
...textboxProps
|
|
67
68
|
}, ref) => {
|
|
68
69
|
const [activeDescendantId, setActiveDescendantId] = (0, _react.useState)();
|
|
@@ -405,32 +406,35 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
|
|
|
405
406
|
...(0, _utils.filterOutStyledSystemSpacingProps)(textboxProps)
|
|
406
407
|
};
|
|
407
408
|
}
|
|
408
|
-
const
|
|
409
|
+
const selectListProps = {
|
|
409
410
|
ref: listboxRef,
|
|
410
411
|
id: selectListId.current,
|
|
411
|
-
labelId
|
|
412
|
+
labelId,
|
|
412
413
|
anchorElement: textboxRef?.parentElement || undefined,
|
|
413
414
|
onSelect: onSelectOption,
|
|
414
|
-
onSelectListClose
|
|
415
|
+
onSelectListClose,
|
|
415
416
|
onMouseDown: handleListMouseDown,
|
|
416
|
-
filterText
|
|
417
|
-
highlightedValue
|
|
418
|
-
noResultsMessage
|
|
419
|
-
disablePortal
|
|
420
|
-
listActionButton
|
|
421
|
-
listMaxHeight
|
|
417
|
+
filterText,
|
|
418
|
+
highlightedValue,
|
|
419
|
+
noResultsMessage,
|
|
420
|
+
disablePortal,
|
|
421
|
+
listActionButton,
|
|
422
|
+
listMaxHeight,
|
|
422
423
|
onListAction: handleOnListAction,
|
|
423
|
-
isLoading
|
|
424
|
-
onListScrollBottom
|
|
425
|
-
tableHeader
|
|
426
|
-
multiColumn
|
|
424
|
+
isLoading,
|
|
425
|
+
onListScrollBottom,
|
|
426
|
+
tableHeader,
|
|
427
|
+
multiColumn,
|
|
427
428
|
loaderDataRole: "filterable-select-list-loader",
|
|
428
|
-
listPlacement
|
|
429
|
-
flipEnabled
|
|
430
|
-
isOpen
|
|
431
|
-
enableVirtualScroll
|
|
432
|
-
virtualScrollOverscan
|
|
433
|
-
}
|
|
429
|
+
listPlacement,
|
|
430
|
+
flipEnabled,
|
|
431
|
+
isOpen,
|
|
432
|
+
enableVirtualScroll,
|
|
433
|
+
virtualScrollOverscan
|
|
434
|
+
};
|
|
435
|
+
const selectList = disableDefaultFiltering ? /*#__PURE__*/_react.default.createElement(_selectList.default, selectListProps, children) : /*#__PURE__*/_react.default.createElement(FilterableSelectList, _extends({}, selectListProps, {
|
|
436
|
+
filterText: filterText
|
|
437
|
+
}), children);
|
|
434
438
|
const marginProps = (0, _useFormSpacing.default)(textboxProps);
|
|
435
439
|
return /*#__PURE__*/_react.default.createElement(_select.default, _extends({
|
|
436
440
|
hasTextCursor: true,
|
|
@@ -538,6 +542,7 @@ FilterableSelect.propTypes = {
|
|
|
538
542
|
"deferTimeout": _propTypes.default.number,
|
|
539
543
|
"dir": _propTypes.default.string,
|
|
540
544
|
"disabled": _propTypes.default.bool,
|
|
545
|
+
"disableDefaultFiltering": _propTypes.default.bool,
|
|
541
546
|
"disablePortal": _propTypes.default.bool,
|
|
542
547
|
"draggable": _propTypes.default.oneOfType([_propTypes.default.oneOf(["false", "true"]), _propTypes.default.bool]),
|
|
543
548
|
"enableVirtualScroll": _propTypes.default.bool,
|