@carbon/react 1.14.0-rc.0 → 1.14.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/es/components/NumberInput/NumberInput.js +2 -2
- package/es/components/TextInput/TextInput.js +42 -6
- package/es/index.js +0 -2
- package/lib/components/NumberInput/NumberInput.js +2 -2
- package/lib/components/TextInput/TextInput.js +40 -4
- package/lib/index.js +0 -4
- package/package.json +7 -7
- package/es/components/SearchFilterButton/SearchFilterButton.js +0 -61
- package/es/components/SearchLayoutButton/SearchLayoutButton.js +0 -151
- package/lib/components/SearchFilterButton/SearchFilterButton.js +0 -70
- package/lib/components/SearchLayoutButton/SearchLayoutButton.js +0 -160
|
@@ -187,7 +187,7 @@ var NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(pr
|
|
|
187
187
|
disabled: disabled,
|
|
188
188
|
onClick: function onClick(event) {
|
|
189
189
|
var state = {
|
|
190
|
-
value: clamp(max, min, value - step),
|
|
190
|
+
value: clamp(max, min, parseInt(value) - step),
|
|
191
191
|
direction: 'down'
|
|
192
192
|
};
|
|
193
193
|
setValue(state.value);
|
|
@@ -213,7 +213,7 @@ var NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(pr
|
|
|
213
213
|
disabled: disabled,
|
|
214
214
|
onClick: function onClick(event) {
|
|
215
215
|
var state = {
|
|
216
|
-
value: clamp(max, min, value + step),
|
|
216
|
+
value: clamp(max, min, parseInt(value) + step),
|
|
217
217
|
direction: 'up'
|
|
218
218
|
};
|
|
219
219
|
setValue(state.value);
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default, { useContext } from 'react';
|
|
10
|
+
import React__default, { useState, useContext } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
13
13
|
import PasswordInput from './PasswordInput.js';
|
|
@@ -18,9 +18,9 @@ import * as FeatureFlags from '@carbon/feature-flags';
|
|
|
18
18
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
19
19
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
20
20
|
|
|
21
|
-
var _excluded = ["className", "disabled", "helperText", "hideLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "placeholder", "readOnly", "size", "type", "warn", "warnText"];
|
|
21
|
+
var _excluded = ["className", "disabled", "helperText", "hideLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "placeholder", "readOnly", "size", "type", "warn", "warnText", "enableCounter", "maxCount"];
|
|
22
22
|
var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref, ref) {
|
|
23
|
-
var _classNames, _classNames2, _classNames3, _classNames4, _classNames7;
|
|
23
|
+
var _classNames, _classNames2, _classNames3, _classNames4, _classNames7, _classNames8;
|
|
24
24
|
|
|
25
25
|
var className = _ref.className,
|
|
26
26
|
_ref$disabled = _ref.disabled,
|
|
@@ -49,10 +49,21 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
|
|
|
49
49
|
_ref$warn = _ref.warn,
|
|
50
50
|
warn = _ref$warn === void 0 ? false : _ref$warn,
|
|
51
51
|
warnText = _ref.warnText,
|
|
52
|
+
_ref$enableCounter = _ref.enableCounter,
|
|
53
|
+
enableCounter = _ref$enableCounter === void 0 ? false : _ref$enableCounter,
|
|
54
|
+
maxCount = _ref.maxCount,
|
|
52
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
53
56
|
|
|
54
57
|
var prefix = usePrefix();
|
|
55
58
|
var enabled = useFeatureFlag('enable-v11-release');
|
|
59
|
+
var defaultValue = rest.defaultValue,
|
|
60
|
+
value = rest.value;
|
|
61
|
+
|
|
62
|
+
var _useState = useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) || (value === null || value === void 0 ? void 0 : value.length) || 0),
|
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
+
textCount = _useState2[0],
|
|
65
|
+
setTextCount = _useState2[1];
|
|
66
|
+
|
|
56
67
|
var normalizedProps = useNormalizedInputProps({
|
|
57
68
|
id: id,
|
|
58
69
|
readOnly: readOnly,
|
|
@@ -69,6 +80,10 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
|
|
|
69
80
|
id: id,
|
|
70
81
|
onChange: function onChange(evt) {
|
|
71
82
|
if (!normalizedProps.disabled) {
|
|
83
|
+
var _evt$target$value;
|
|
84
|
+
|
|
85
|
+
setTextCount((_evt$target$value = evt.target.value) === null || _evt$target$value === void 0 ? void 0 : _evt$target$value.length);
|
|
86
|
+
|
|
72
87
|
_onChange(evt);
|
|
73
88
|
}
|
|
74
89
|
},
|
|
@@ -86,16 +101,27 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
|
|
|
86
101
|
readOnly: readOnly
|
|
87
102
|
}, 'aria-describedby', helperText && normalizedProps.helperId), rest);
|
|
88
103
|
|
|
104
|
+
if (enableCounter) {
|
|
105
|
+
sharedTextInputProps.maxLength = maxCount;
|
|
106
|
+
}
|
|
107
|
+
|
|
89
108
|
var inputWrapperClasses = cx([enabled ? cx("".concat(prefix, "--form-item"), className) : "".concat(prefix, "--form-item")], "".concat(prefix, "--text-input-wrapper"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--readonly"), readOnly), _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--light"), light), _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--inline"), inline), _classNames2));
|
|
90
109
|
var labelClasses = cx("".concat(prefix, "--label"), (_classNames3 = {}, _defineProperty(_classNames3, "".concat(prefix, "--visually-hidden"), hideLabel), _defineProperty(_classNames3, "".concat(prefix, "--label--disabled"), normalizedProps.disabled), _defineProperty(_classNames3, "".concat(prefix, "--label--inline"), inline), _defineProperty(_classNames3, "".concat(prefix, "--label--inline--").concat(size), inline && !!size), _classNames3));
|
|
91
110
|
var helperTextClasses = cx("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), normalizedProps.disabled), _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
|
|
92
111
|
var fieldOuterWrapperClasses = cx("".concat(prefix, "--text-input__field-outer-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
|
|
93
112
|
var fieldWrapperClasses = cx("".concat(prefix, "--text-input__field-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
|
|
94
113
|
var iconClasses = cx((_classNames7 = {}, _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__readonly-icon"), readOnly), _classNames7));
|
|
114
|
+
var counterClasses = cx("".concat(prefix, "--label"), (_classNames8 = {}, _defineProperty(_classNames8, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_classNames8, "".concat(prefix, "--text-input__label-counter"), true), _classNames8));
|
|
115
|
+
var counter = enableCounter && maxCount ? /*#__PURE__*/React__default.createElement("div", {
|
|
116
|
+
className: counterClasses
|
|
117
|
+
}, "".concat(textCount, "/").concat(maxCount)) : null;
|
|
95
118
|
var label = labelText ? /*#__PURE__*/React__default.createElement("label", {
|
|
96
119
|
htmlFor: id,
|
|
97
120
|
className: labelClasses
|
|
98
121
|
}, labelText) : null;
|
|
122
|
+
var labelWrapper = /*#__PURE__*/React__default.createElement("div", {
|
|
123
|
+
className: "".concat(prefix, "--text-input__label-wrapper")
|
|
124
|
+
}, label, counter);
|
|
99
125
|
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
100
126
|
id: normalizedProps.helperId,
|
|
101
127
|
className: helperTextClasses
|
|
@@ -113,9 +139,9 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
|
|
|
113
139
|
|
|
114
140
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
115
141
|
className: inputWrapperClasses
|
|
116
|
-
}, !inline ?
|
|
142
|
+
}, !inline ? labelWrapper : /*#__PURE__*/React__default.createElement("div", {
|
|
117
143
|
className: "".concat(prefix, "--text-input__label-helper-wrapper")
|
|
118
|
-
},
|
|
144
|
+
}, labelWrapper, !isFluid && helper), /*#__PURE__*/React__default.createElement("div", {
|
|
119
145
|
className: fieldOuterWrapperClasses
|
|
120
146
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
121
147
|
className: fieldWrapperClasses,
|
|
@@ -145,6 +171,11 @@ TextInput.propTypes = {
|
|
|
145
171
|
*/
|
|
146
172
|
disabled: PropTypes.bool,
|
|
147
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Specify whether to display the character counter
|
|
176
|
+
*/
|
|
177
|
+
enableCounter: PropTypes.bool,
|
|
178
|
+
|
|
148
179
|
/**
|
|
149
180
|
* Provide text that is used alongside the control label for additional help
|
|
150
181
|
*/
|
|
@@ -187,6 +218,11 @@ TextInput.propTypes = {
|
|
|
187
218
|
*/
|
|
188
219
|
light: PropTypes.bool,
|
|
189
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Max character count allowed for the textarea. This is needed in order for enableCounter to display
|
|
223
|
+
*/
|
|
224
|
+
maxCount: PropTypes.number,
|
|
225
|
+
|
|
190
226
|
/**
|
|
191
227
|
* Optionally provide an `onChange` handler that is called whenever `<input>`
|
|
192
228
|
* is updated
|
package/es/index.js
CHANGED
|
@@ -50,8 +50,6 @@ export { default as PrimaryButton } from './components/PrimaryButton/PrimaryButt
|
|
|
50
50
|
export { default as RadioButton } from './components/RadioButton/RadioButton.js';
|
|
51
51
|
export { default as RadioButtonGroup } from './components/RadioButtonGroup/RadioButtonGroup.js';
|
|
52
52
|
export { default as Search } from './components/Search/index.js';
|
|
53
|
-
export { default as SearchFilterButton } from './components/SearchFilterButton/SearchFilterButton.js';
|
|
54
|
-
export { default as SearchLayoutButton } from './components/SearchLayoutButton/SearchLayoutButton.js';
|
|
55
53
|
export { default as ExpandableSearch } from './components/ExpandableSearch/ExpandableSearch.js';
|
|
56
54
|
export { default as SecondaryButton } from './components/SecondaryButton/SecondaryButton.js';
|
|
57
55
|
export { default as SelectSkeleton } from './components/Select/Select.Skeleton.js';
|
|
@@ -197,7 +197,7 @@ var NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function Num
|
|
|
197
197
|
disabled: disabled,
|
|
198
198
|
onClick: function onClick(event) {
|
|
199
199
|
var state = {
|
|
200
|
-
value: clamp(max, min, value - step),
|
|
200
|
+
value: clamp(max, min, parseInt(value) - step),
|
|
201
201
|
direction: 'down'
|
|
202
202
|
};
|
|
203
203
|
setValue(state.value);
|
|
@@ -223,7 +223,7 @@ var NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function Num
|
|
|
223
223
|
disabled: disabled,
|
|
224
224
|
onClick: function onClick(event) {
|
|
225
225
|
var state = {
|
|
226
|
-
value: clamp(max, min, value + step),
|
|
226
|
+
value: clamp(max, min, parseInt(value) + step),
|
|
227
227
|
direction: 'up'
|
|
228
228
|
};
|
|
229
229
|
setValue(state.value);
|
|
@@ -47,9 +47,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
47
47
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
48
48
|
var FeatureFlags__namespace = /*#__PURE__*/_interopNamespace(FeatureFlags);
|
|
49
49
|
|
|
50
|
-
var _excluded = ["className", "disabled", "helperText", "hideLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "placeholder", "readOnly", "size", "type", "warn", "warnText"];
|
|
50
|
+
var _excluded = ["className", "disabled", "helperText", "hideLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "placeholder", "readOnly", "size", "type", "warn", "warnText", "enableCounter", "maxCount"];
|
|
51
51
|
var TextInput = /*#__PURE__*/React__default["default"].forwardRef(function TextInput(_ref, ref) {
|
|
52
|
-
var _classNames, _classNames2, _classNames3, _classNames4, _classNames7;
|
|
52
|
+
var _classNames, _classNames2, _classNames3, _classNames4, _classNames7, _classNames8;
|
|
53
53
|
|
|
54
54
|
var className = _ref.className,
|
|
55
55
|
_ref$disabled = _ref.disabled,
|
|
@@ -78,10 +78,21 @@ var TextInput = /*#__PURE__*/React__default["default"].forwardRef(function TextI
|
|
|
78
78
|
_ref$warn = _ref.warn,
|
|
79
79
|
warn = _ref$warn === void 0 ? false : _ref$warn,
|
|
80
80
|
warnText = _ref.warnText,
|
|
81
|
+
_ref$enableCounter = _ref.enableCounter,
|
|
82
|
+
enableCounter = _ref$enableCounter === void 0 ? false : _ref$enableCounter,
|
|
83
|
+
maxCount = _ref.maxCount,
|
|
81
84
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
82
85
|
|
|
83
86
|
var prefix = usePrefix.usePrefix();
|
|
84
87
|
var enabled = index.useFeatureFlag('enable-v11-release');
|
|
88
|
+
var defaultValue = rest.defaultValue,
|
|
89
|
+
value = rest.value;
|
|
90
|
+
|
|
91
|
+
var _useState = React.useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) || (value === null || value === void 0 ? void 0 : value.length) || 0),
|
|
92
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
93
|
+
textCount = _useState2[0],
|
|
94
|
+
setTextCount = _useState2[1];
|
|
95
|
+
|
|
85
96
|
var normalizedProps = useNormalizedInputProps.useNormalizedInputProps({
|
|
86
97
|
id: id,
|
|
87
98
|
readOnly: readOnly,
|
|
@@ -98,6 +109,10 @@ var TextInput = /*#__PURE__*/React__default["default"].forwardRef(function TextI
|
|
|
98
109
|
id: id,
|
|
99
110
|
onChange: function onChange(evt) {
|
|
100
111
|
if (!normalizedProps.disabled) {
|
|
112
|
+
var _evt$target$value;
|
|
113
|
+
|
|
114
|
+
setTextCount((_evt$target$value = evt.target.value) === null || _evt$target$value === void 0 ? void 0 : _evt$target$value.length);
|
|
115
|
+
|
|
101
116
|
_onChange(evt);
|
|
102
117
|
}
|
|
103
118
|
},
|
|
@@ -115,16 +130,27 @@ var TextInput = /*#__PURE__*/React__default["default"].forwardRef(function TextI
|
|
|
115
130
|
readOnly: readOnly
|
|
116
131
|
}, 'aria-describedby', helperText && normalizedProps.helperId), rest);
|
|
117
132
|
|
|
133
|
+
if (enableCounter) {
|
|
134
|
+
sharedTextInputProps.maxLength = maxCount;
|
|
135
|
+
}
|
|
136
|
+
|
|
118
137
|
var inputWrapperClasses = cx__default["default"]([enabled ? cx__default["default"]("".concat(prefix, "--form-item"), className) : "".concat(prefix, "--form-item")], "".concat(prefix, "--text-input-wrapper"), (_classNames2 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--readonly"), readOnly), _rollupPluginBabelHelpers.defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--light"), light), _rollupPluginBabelHelpers.defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--inline"), inline), _classNames2));
|
|
119
138
|
var labelClasses = cx__default["default"]("".concat(prefix, "--label"), (_classNames3 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames3, "".concat(prefix, "--visually-hidden"), hideLabel), _rollupPluginBabelHelpers.defineProperty(_classNames3, "".concat(prefix, "--label--disabled"), normalizedProps.disabled), _rollupPluginBabelHelpers.defineProperty(_classNames3, "".concat(prefix, "--label--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_classNames3, "".concat(prefix, "--label--inline--").concat(size), inline && !!size), _classNames3));
|
|
120
139
|
var helperTextClasses = cx__default["default"]("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), normalizedProps.disabled), _rollupPluginBabelHelpers.defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
|
|
121
140
|
var fieldOuterWrapperClasses = cx__default["default"]("".concat(prefix, "--text-input__field-outer-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
|
|
122
141
|
var fieldWrapperClasses = cx__default["default"]("".concat(prefix, "--text-input__field-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
|
|
123
142
|
var iconClasses = cx__default["default"]((_classNames7 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _rollupPluginBabelHelpers.defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _rollupPluginBabelHelpers.defineProperty(_classNames7, "".concat(prefix, "--text-input__readonly-icon"), readOnly), _classNames7));
|
|
143
|
+
var counterClasses = cx__default["default"]("".concat(prefix, "--label"), (_classNames8 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames8, "".concat(prefix, "--label--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_classNames8, "".concat(prefix, "--text-input__label-counter"), true), _classNames8));
|
|
144
|
+
var counter = enableCounter && maxCount ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
145
|
+
className: counterClasses
|
|
146
|
+
}, "".concat(textCount, "/").concat(maxCount)) : null;
|
|
124
147
|
var label = labelText ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
125
148
|
htmlFor: id,
|
|
126
149
|
className: labelClasses
|
|
127
150
|
}, labelText) : null;
|
|
151
|
+
var labelWrapper = /*#__PURE__*/React__default["default"].createElement("div", {
|
|
152
|
+
className: "".concat(prefix, "--text-input__label-wrapper")
|
|
153
|
+
}, label, counter);
|
|
128
154
|
var helper = helperText ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
129
155
|
id: normalizedProps.helperId,
|
|
130
156
|
className: helperTextClasses
|
|
@@ -142,9 +168,9 @@ var TextInput = /*#__PURE__*/React__default["default"].forwardRef(function TextI
|
|
|
142
168
|
|
|
143
169
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
144
170
|
className: inputWrapperClasses
|
|
145
|
-
}, !inline ?
|
|
171
|
+
}, !inline ? labelWrapper : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
146
172
|
className: "".concat(prefix, "--text-input__label-helper-wrapper")
|
|
147
|
-
},
|
|
173
|
+
}, labelWrapper, !isFluid && helper), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
148
174
|
className: fieldOuterWrapperClasses
|
|
149
175
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
150
176
|
className: fieldWrapperClasses,
|
|
@@ -174,6 +200,11 @@ TextInput.propTypes = {
|
|
|
174
200
|
*/
|
|
175
201
|
disabled: PropTypes__default["default"].bool,
|
|
176
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Specify whether to display the character counter
|
|
205
|
+
*/
|
|
206
|
+
enableCounter: PropTypes__default["default"].bool,
|
|
207
|
+
|
|
177
208
|
/**
|
|
178
209
|
* Provide text that is used alongside the control label for additional help
|
|
179
210
|
*/
|
|
@@ -216,6 +247,11 @@ TextInput.propTypes = {
|
|
|
216
247
|
*/
|
|
217
248
|
light: PropTypes__default["default"].bool,
|
|
218
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Max character count allowed for the textarea. This is needed in order for enableCounter to display
|
|
252
|
+
*/
|
|
253
|
+
maxCount: PropTypes__default["default"].number,
|
|
254
|
+
|
|
219
255
|
/**
|
|
220
256
|
* Optionally provide an `onChange` handler that is called whenever `<input>`
|
|
221
257
|
* is updated
|
package/lib/index.js
CHANGED
|
@@ -54,8 +54,6 @@ var PrimaryButton = require('./components/PrimaryButton/PrimaryButton.js');
|
|
|
54
54
|
var RadioButton = require('./components/RadioButton/RadioButton.js');
|
|
55
55
|
var RadioButtonGroup = require('./components/RadioButtonGroup/RadioButtonGroup.js');
|
|
56
56
|
var index$6 = require('./components/Search/index.js');
|
|
57
|
-
var SearchFilterButton = require('./components/SearchFilterButton/SearchFilterButton.js');
|
|
58
|
-
var SearchLayoutButton = require('./components/SearchLayoutButton/SearchLayoutButton.js');
|
|
59
57
|
var ExpandableSearch = require('./components/ExpandableSearch/ExpandableSearch.js');
|
|
60
58
|
var SecondaryButton = require('./components/SecondaryButton/SecondaryButton.js');
|
|
61
59
|
var Select_Skeleton = require('./components/Select/Select.Skeleton.js');
|
|
@@ -252,8 +250,6 @@ exports.PrimaryButton = PrimaryButton["default"];
|
|
|
252
250
|
exports.RadioButton = RadioButton["default"];
|
|
253
251
|
exports.RadioButtonGroup = RadioButtonGroup["default"];
|
|
254
252
|
exports.Search = index$6["default"];
|
|
255
|
-
exports.SearchFilterButton = SearchFilterButton["default"];
|
|
256
|
-
exports.SearchLayoutButton = SearchLayoutButton["default"];
|
|
257
253
|
exports.ExpandableSearch = ExpandableSearch["default"];
|
|
258
254
|
exports.SecondaryButton = SecondaryButton["default"];
|
|
259
255
|
exports.SelectSkeleton = Select_Skeleton["default"];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.14.0
|
|
4
|
+
"version": "1.14.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@babel/runtime": "^7.18.3",
|
|
46
46
|
"@carbon/feature-flags": "^0.9.0",
|
|
47
|
-
"@carbon/icons-react": "^11.9.0
|
|
48
|
-
"@carbon/layout": "^11.7.0
|
|
49
|
-
"@carbon/styles": "^1.14.0
|
|
47
|
+
"@carbon/icons-react": "^11.9.0",
|
|
48
|
+
"@carbon/layout": "^11.7.0",
|
|
49
|
+
"@carbon/styles": "^1.14.0",
|
|
50
50
|
"@carbon/telemetry": "0.1.0",
|
|
51
|
-
"classnames": "2.3.
|
|
51
|
+
"classnames": "2.3.2",
|
|
52
52
|
"copy-to-clipboard": "^3.3.1",
|
|
53
53
|
"downshift": "5.2.1",
|
|
54
54
|
"flatpickr": "4.6.9",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@babel/preset-env": "^7.18.2",
|
|
74
74
|
"@babel/preset-react": "^7.17.12",
|
|
75
75
|
"@carbon/test-utils": "^10.26.0",
|
|
76
|
-
"@carbon/themes": "^11.10.0
|
|
76
|
+
"@carbon/themes": "^11.10.0",
|
|
77
77
|
"@rollup/plugin-babel": "^5.3.0",
|
|
78
78
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
79
79
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"**/*.scss",
|
|
132
132
|
"**/*.css"
|
|
133
133
|
],
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "dcf802a75caf0201ac831826f611d24dbe508859"
|
|
135
135
|
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import { Filter } from '@carbon/icons-react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
import React__default from 'react';
|
|
12
|
-
import { warning } from '../../internal/warning.js';
|
|
13
|
-
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
-
|
|
15
|
-
var _excluded = ["labelText", "iconDescription"];
|
|
16
|
-
var didWarnAboutDeprecation = false;
|
|
17
|
-
/**
|
|
18
|
-
* The filter button for `<Search>`.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
var SearchFilterButton = function SearchFilterButton(_ref) {
|
|
22
|
-
var labelText = _ref.labelText,
|
|
23
|
-
iconDescription = _ref.iconDescription,
|
|
24
|
-
other = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
-
|
|
26
|
-
var prefix = usePrefix();
|
|
27
|
-
|
|
28
|
-
if (process.env.NODE_ENV !== "production") {
|
|
29
|
-
process.env.NODE_ENV !== "production" ? warning(didWarnAboutDeprecation, 'The SearchFilterButton component has been deprecated and will be removed in the next major release of `carbon-components-react`') : void 0;
|
|
30
|
-
didWarnAboutDeprecation = true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return /*#__PURE__*/React__default.createElement("button", _extends({
|
|
34
|
-
className: "".concat(prefix, "--search-button"),
|
|
35
|
-
type: "button",
|
|
36
|
-
"aria-label": labelText,
|
|
37
|
-
title: labelText
|
|
38
|
-
}, other), /*#__PURE__*/React__default.createElement(Filter, {
|
|
39
|
-
className: "".concat(prefix, "--search-filter"),
|
|
40
|
-
"aria-label": iconDescription
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
SearchFilterButton.propTypes = {
|
|
45
|
-
/**
|
|
46
|
-
* The icon description.
|
|
47
|
-
*/
|
|
48
|
-
iconDescription: PropTypes.string,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The a11y label text.
|
|
52
|
-
*/
|
|
53
|
-
labelText: PropTypes.string
|
|
54
|
-
};
|
|
55
|
-
SearchFilterButton.defaultProps = {
|
|
56
|
-
labelText: 'Search',
|
|
57
|
-
iconDescription: 'filter'
|
|
58
|
-
};
|
|
59
|
-
var SearchFilterButton$1 = SearchFilterButton;
|
|
60
|
-
|
|
61
|
-
export { SearchFilterButton$1 as default };
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import { ListBulleted, Grid } from '@carbon/icons-react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
import React__default, { Component } from 'react';
|
|
12
|
-
import { warning } from '../../internal/warning.js';
|
|
13
|
-
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
14
|
-
|
|
15
|
-
var didWarnAboutDeprecation = false;
|
|
16
|
-
/**
|
|
17
|
-
* The layout button for `<Search>`.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
var SearchLayoutButton = /*#__PURE__*/function (_Component) {
|
|
21
|
-
_inherits(SearchLayoutButton, _Component);
|
|
22
|
-
|
|
23
|
-
var _super = _createSuper(SearchLayoutButton);
|
|
24
|
-
|
|
25
|
-
function SearchLayoutButton(props) {
|
|
26
|
-
var _this;
|
|
27
|
-
|
|
28
|
-
_classCallCheck(this, SearchLayoutButton);
|
|
29
|
-
|
|
30
|
-
_this = _super.call(this, props);
|
|
31
|
-
|
|
32
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
33
|
-
format: 'list'
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "toggleLayout", function () {
|
|
37
|
-
var format = _this.state.format === 'list' ? 'grid' : 'list';
|
|
38
|
-
|
|
39
|
-
_this.setState({
|
|
40
|
-
format: format
|
|
41
|
-
}, function () {
|
|
42
|
-
var onChangeFormat = _this.props.onChangeFormat;
|
|
43
|
-
|
|
44
|
-
if (typeof onChangeFormat === 'function') {
|
|
45
|
-
onChangeFormat({
|
|
46
|
-
format: format
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (process.env.NODE_ENV !== "production") {
|
|
53
|
-
process.env.NODE_ENV !== "production" ? warning(didWarnAboutDeprecation, 'The SearchLayoutButton component has been deprecated and will be removed in the next major release of `carbon-components-react`') : void 0;
|
|
54
|
-
didWarnAboutDeprecation = true;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return _this;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Toggles the button state upon user-initiated event.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
_createClass(SearchLayoutButton, [{
|
|
65
|
-
key: "render",
|
|
66
|
-
value: function render() {
|
|
67
|
-
var _this2 = this;
|
|
68
|
-
|
|
69
|
-
var prefix = this.context;
|
|
70
|
-
var _this$props = this.props,
|
|
71
|
-
labelText = _this$props.labelText,
|
|
72
|
-
iconDescriptionList = _this$props.iconDescriptionList,
|
|
73
|
-
iconDescriptionGrid = _this$props.iconDescriptionGrid;
|
|
74
|
-
|
|
75
|
-
var SearchLayoutButtonIcon = function SearchLayoutButtonIcon() {
|
|
76
|
-
if (_this2.state.format === 'list') {
|
|
77
|
-
return /*#__PURE__*/React__default.createElement(ListBulleted, {
|
|
78
|
-
className: "".concat(prefix, "--search-view"),
|
|
79
|
-
"aria-label": iconDescriptionList
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return /*#__PURE__*/React__default.createElement(Grid, {
|
|
84
|
-
className: "".concat(prefix, "--search-view"),
|
|
85
|
-
"aria-label": iconDescriptionGrid
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return /*#__PURE__*/React__default.createElement("button", {
|
|
90
|
-
className: "".concat(prefix, "--search-button"),
|
|
91
|
-
type: "button",
|
|
92
|
-
onClick: this.toggleLayout,
|
|
93
|
-
"aria-label": labelText,
|
|
94
|
-
title: labelText
|
|
95
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
96
|
-
className: "".concat(prefix, "--search__toggle-layout__container")
|
|
97
|
-
}, /*#__PURE__*/React__default.createElement(SearchLayoutButtonIcon, null)));
|
|
98
|
-
}
|
|
99
|
-
}], [{
|
|
100
|
-
key: "getDerivedStateFromProps",
|
|
101
|
-
value: function getDerivedStateFromProps(_ref, state) {
|
|
102
|
-
var format = _ref.format;
|
|
103
|
-
var prevFormat = state.prevFormat;
|
|
104
|
-
return prevFormat === format ? null : {
|
|
105
|
-
format: format || 'list',
|
|
106
|
-
prevFormat: format
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}]);
|
|
110
|
-
|
|
111
|
-
return SearchLayoutButton;
|
|
112
|
-
}(Component);
|
|
113
|
-
|
|
114
|
-
_defineProperty(SearchLayoutButton, "contextType", PrefixContext);
|
|
115
|
-
|
|
116
|
-
_defineProperty(SearchLayoutButton, "propTypes", {
|
|
117
|
-
/**
|
|
118
|
-
* The layout.
|
|
119
|
-
*/
|
|
120
|
-
format: PropTypes.oneOf(['list', 'grid']),
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* The description for the "grid" icon.
|
|
124
|
-
*/
|
|
125
|
-
iconDescriptionGrid: PropTypes.string,
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* The description for the "list" icon.
|
|
129
|
-
*/
|
|
130
|
-
iconDescriptionList: PropTypes.string,
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* The a11y label text.
|
|
134
|
-
*/
|
|
135
|
-
labelText: PropTypes.string,
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* The callback called when layout switches.
|
|
139
|
-
*/
|
|
140
|
-
onChangeFormat: PropTypes.func
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
_defineProperty(SearchLayoutButton, "defaultProps", {
|
|
144
|
-
labelText: 'Filter',
|
|
145
|
-
iconDescriptionList: 'list',
|
|
146
|
-
iconDescriptionGrid: 'grid'
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
var SearchLayoutButton$1 = SearchLayoutButton;
|
|
150
|
-
|
|
151
|
-
export { SearchLayoutButton$1 as default };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
-
var iconsReact = require('@carbon/icons-react');
|
|
14
|
-
var PropTypes = require('prop-types');
|
|
15
|
-
var React = require('react');
|
|
16
|
-
var warning = require('../../internal/warning.js');
|
|
17
|
-
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
-
|
|
19
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
-
|
|
21
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
|
-
|
|
24
|
-
var _excluded = ["labelText", "iconDescription"];
|
|
25
|
-
var didWarnAboutDeprecation = false;
|
|
26
|
-
/**
|
|
27
|
-
* The filter button for `<Search>`.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
var SearchFilterButton = function SearchFilterButton(_ref) {
|
|
31
|
-
var labelText = _ref.labelText,
|
|
32
|
-
iconDescription = _ref.iconDescription,
|
|
33
|
-
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
34
|
-
|
|
35
|
-
var prefix = usePrefix.usePrefix();
|
|
36
|
-
|
|
37
|
-
if (process.env.NODE_ENV !== "production") {
|
|
38
|
-
process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, 'The SearchFilterButton component has been deprecated and will be removed in the next major release of `carbon-components-react`') : void 0;
|
|
39
|
-
didWarnAboutDeprecation = true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
|
|
43
|
-
className: "".concat(prefix, "--search-button"),
|
|
44
|
-
type: "button",
|
|
45
|
-
"aria-label": labelText,
|
|
46
|
-
title: labelText
|
|
47
|
-
}, other), /*#__PURE__*/React__default["default"].createElement(iconsReact.Filter, {
|
|
48
|
-
className: "".concat(prefix, "--search-filter"),
|
|
49
|
-
"aria-label": iconDescription
|
|
50
|
-
}));
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
SearchFilterButton.propTypes = {
|
|
54
|
-
/**
|
|
55
|
-
* The icon description.
|
|
56
|
-
*/
|
|
57
|
-
iconDescription: PropTypes__default["default"].string,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The a11y label text.
|
|
61
|
-
*/
|
|
62
|
-
labelText: PropTypes__default["default"].string
|
|
63
|
-
};
|
|
64
|
-
SearchFilterButton.defaultProps = {
|
|
65
|
-
labelText: 'Search',
|
|
66
|
-
iconDescription: 'filter'
|
|
67
|
-
};
|
|
68
|
-
var SearchFilterButton$1 = SearchFilterButton;
|
|
69
|
-
|
|
70
|
-
exports["default"] = SearchFilterButton$1;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
-
var iconsReact = require('@carbon/icons-react');
|
|
14
|
-
var PropTypes = require('prop-types');
|
|
15
|
-
var React = require('react');
|
|
16
|
-
var warning = require('../../internal/warning.js');
|
|
17
|
-
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
-
|
|
19
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
-
|
|
21
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
|
-
|
|
24
|
-
var didWarnAboutDeprecation = false;
|
|
25
|
-
/**
|
|
26
|
-
* The layout button for `<Search>`.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
var SearchLayoutButton = /*#__PURE__*/function (_Component) {
|
|
30
|
-
_rollupPluginBabelHelpers.inherits(SearchLayoutButton, _Component);
|
|
31
|
-
|
|
32
|
-
var _super = _rollupPluginBabelHelpers.createSuper(SearchLayoutButton);
|
|
33
|
-
|
|
34
|
-
function SearchLayoutButton(props) {
|
|
35
|
-
var _this;
|
|
36
|
-
|
|
37
|
-
_rollupPluginBabelHelpers.classCallCheck(this, SearchLayoutButton);
|
|
38
|
-
|
|
39
|
-
_this = _super.call(this, props);
|
|
40
|
-
|
|
41
|
-
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "state", {
|
|
42
|
-
format: 'list'
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "toggleLayout", function () {
|
|
46
|
-
var format = _this.state.format === 'list' ? 'grid' : 'list';
|
|
47
|
-
|
|
48
|
-
_this.setState({
|
|
49
|
-
format: format
|
|
50
|
-
}, function () {
|
|
51
|
-
var onChangeFormat = _this.props.onChangeFormat;
|
|
52
|
-
|
|
53
|
-
if (typeof onChangeFormat === 'function') {
|
|
54
|
-
onChangeFormat({
|
|
55
|
-
format: format
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
if (process.env.NODE_ENV !== "production") {
|
|
62
|
-
process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, 'The SearchLayoutButton component has been deprecated and will be removed in the next major release of `carbon-components-react`') : void 0;
|
|
63
|
-
didWarnAboutDeprecation = true;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return _this;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Toggles the button state upon user-initiated event.
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_rollupPluginBabelHelpers.createClass(SearchLayoutButton, [{
|
|
74
|
-
key: "render",
|
|
75
|
-
value: function render() {
|
|
76
|
-
var _this2 = this;
|
|
77
|
-
|
|
78
|
-
var prefix = this.context;
|
|
79
|
-
var _this$props = this.props,
|
|
80
|
-
labelText = _this$props.labelText,
|
|
81
|
-
iconDescriptionList = _this$props.iconDescriptionList,
|
|
82
|
-
iconDescriptionGrid = _this$props.iconDescriptionGrid;
|
|
83
|
-
|
|
84
|
-
var SearchLayoutButtonIcon = function SearchLayoutButtonIcon() {
|
|
85
|
-
if (_this2.state.format === 'list') {
|
|
86
|
-
return /*#__PURE__*/React__default["default"].createElement(iconsReact.ListBulleted, {
|
|
87
|
-
className: "".concat(prefix, "--search-view"),
|
|
88
|
-
"aria-label": iconDescriptionList
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return /*#__PURE__*/React__default["default"].createElement(iconsReact.Grid, {
|
|
93
|
-
className: "".concat(prefix, "--search-view"),
|
|
94
|
-
"aria-label": iconDescriptionGrid
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
99
|
-
className: "".concat(prefix, "--search-button"),
|
|
100
|
-
type: "button",
|
|
101
|
-
onClick: this.toggleLayout,
|
|
102
|
-
"aria-label": labelText,
|
|
103
|
-
title: labelText
|
|
104
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
105
|
-
className: "".concat(prefix, "--search__toggle-layout__container")
|
|
106
|
-
}, /*#__PURE__*/React__default["default"].createElement(SearchLayoutButtonIcon, null)));
|
|
107
|
-
}
|
|
108
|
-
}], [{
|
|
109
|
-
key: "getDerivedStateFromProps",
|
|
110
|
-
value: function getDerivedStateFromProps(_ref, state) {
|
|
111
|
-
var format = _ref.format;
|
|
112
|
-
var prevFormat = state.prevFormat;
|
|
113
|
-
return prevFormat === format ? null : {
|
|
114
|
-
format: format || 'list',
|
|
115
|
-
prevFormat: format
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}]);
|
|
119
|
-
|
|
120
|
-
return SearchLayoutButton;
|
|
121
|
-
}(React.Component);
|
|
122
|
-
|
|
123
|
-
_rollupPluginBabelHelpers.defineProperty(SearchLayoutButton, "contextType", usePrefix.PrefixContext);
|
|
124
|
-
|
|
125
|
-
_rollupPluginBabelHelpers.defineProperty(SearchLayoutButton, "propTypes", {
|
|
126
|
-
/**
|
|
127
|
-
* The layout.
|
|
128
|
-
*/
|
|
129
|
-
format: PropTypes__default["default"].oneOf(['list', 'grid']),
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* The description for the "grid" icon.
|
|
133
|
-
*/
|
|
134
|
-
iconDescriptionGrid: PropTypes__default["default"].string,
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* The description for the "list" icon.
|
|
138
|
-
*/
|
|
139
|
-
iconDescriptionList: PropTypes__default["default"].string,
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* The a11y label text.
|
|
143
|
-
*/
|
|
144
|
-
labelText: PropTypes__default["default"].string,
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* The callback called when layout switches.
|
|
148
|
-
*/
|
|
149
|
-
onChangeFormat: PropTypes__default["default"].func
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
_rollupPluginBabelHelpers.defineProperty(SearchLayoutButton, "defaultProps", {
|
|
153
|
-
labelText: 'Filter',
|
|
154
|
-
iconDescriptionList: 'list',
|
|
155
|
-
iconDescriptionGrid: 'grid'
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
var SearchLayoutButton$1 = SearchLayoutButton;
|
|
159
|
-
|
|
160
|
-
exports["default"] = SearchLayoutButton$1;
|