@carbon/react 1.13.0 → 1.14.0-rc.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/Accordion/Accordion.Skeleton.js +12 -4
- package/es/components/Accordion/Accordion.js +9 -2
- package/es/components/FileUploader/Filename.js +3 -1
- package/es/components/FluidTextArea/FluidTextArea.js +130 -0
- package/es/components/FluidTextInput/FluidTextInput.js +13 -4
- package/es/components/Notification/Notification.js +6 -2
- package/es/components/ProgressIndicator/ProgressIndicator.js +128 -154
- package/es/components/RadioTile/RadioTile.js +2 -11
- package/es/components/TextArea/TextArea.js +14 -5
- package/es/components/TextInput/PasswordInput.js +7 -6
- package/es/index.js +2 -2
- package/lib/components/Accordion/Accordion.Skeleton.js +12 -4
- package/lib/components/Accordion/Accordion.js +9 -2
- package/lib/components/FileUploader/Filename.js +3 -1
- package/lib/components/FluidTextArea/FluidTextArea.js +140 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +12 -3
- package/lib/components/Notification/Notification.js +6 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.js +126 -152
- package/lib/components/RadioTile/RadioTile.js +2 -11
- package/lib/components/TextArea/TextArea.js +13 -4
- package/lib/components/TextInput/PasswordInput.js +7 -6
- package/lib/index.js +47 -46
- package/package.json +7 -6
- package/es/components/ProgressIndicator/index.js +0 -15
- package/es/components/ProgressIndicator/next/ProgressIndicator.js +0 -117
- package/lib/components/ProgressIndicator/index.js +0 -39
- package/lib/components/ProgressIndicator/next/ProgressIndicator.js +0 -127
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var cx = require('classnames');
|
|
13
14
|
var PropTypes = require('prop-types');
|
|
14
15
|
var React = require('react');
|
|
15
|
-
var cx = require('classnames');
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var match = require('../../internal/keyboard/match.js');
|
|
@@ -20,12 +20,12 @@ var keys = require('../../internal/keyboard/keys.js');
|
|
|
20
20
|
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
22
|
|
|
23
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
23
24
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
24
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
26
26
|
|
|
27
|
-
var _excluded = ["
|
|
28
|
-
_excluded2 = ["className", "
|
|
27
|
+
var _excluded = ["children", "className", "currentIndex", "onChange", "spaceEqually", "vertical"],
|
|
28
|
+
_excluded2 = ["label", "description", "className", "current", "complete", "invalid", "secondaryLabel", "disabled", "onClick", "translateWithId"];
|
|
29
29
|
var defaultTranslations = {
|
|
30
30
|
'carbon.progress-step.complete': 'Complete',
|
|
31
31
|
'carbon.progress-step.incomplete': 'Incomplete',
|
|
@@ -37,23 +37,124 @@ function translateWithId(messageId) {
|
|
|
37
37
|
return defaultTranslations[messageId];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
disabled = _ref.disabled,
|
|
51
|
-
onClick = _ref.onClick,
|
|
52
|
-
t = _ref.translateWithId,
|
|
40
|
+
function ProgressIndicator(_ref) {
|
|
41
|
+
var _cx;
|
|
42
|
+
|
|
43
|
+
var children = _ref.children,
|
|
44
|
+
customClassName = _ref.className,
|
|
45
|
+
_ref$currentIndex = _ref.currentIndex,
|
|
46
|
+
controlledIndex = _ref$currentIndex === void 0 ? 0 : _ref$currentIndex,
|
|
47
|
+
onChange = _ref.onChange,
|
|
48
|
+
spaceEqually = _ref.spaceEqually,
|
|
49
|
+
vertical = _ref.vertical,
|
|
53
50
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
54
51
|
|
|
55
52
|
var prefix = usePrefix.usePrefix();
|
|
56
|
-
|
|
53
|
+
|
|
54
|
+
var _useState = React.useState(controlledIndex),
|
|
55
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
56
|
+
currentIndex = _useState2[0],
|
|
57
|
+
setCurrentIndex = _useState2[1];
|
|
58
|
+
|
|
59
|
+
var _useState3 = React.useState(controlledIndex),
|
|
60
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
61
|
+
prevControlledIndex = _useState4[0],
|
|
62
|
+
setPrevControlledIndex = _useState4[1];
|
|
63
|
+
|
|
64
|
+
var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--progress"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--progress--vertical"), vertical), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--progress--space-equal"), spaceEqually && !vertical), _rollupPluginBabelHelpers.defineProperty(_cx, customClassName, customClassName), _cx));
|
|
65
|
+
|
|
66
|
+
if (controlledIndex !== prevControlledIndex) {
|
|
67
|
+
setCurrentIndex(controlledIndex);
|
|
68
|
+
setPrevControlledIndex(controlledIndex);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({
|
|
72
|
+
className: className
|
|
73
|
+
}, rest), React__default["default"].Children.map(children, function (child, index) {
|
|
74
|
+
// only setup click handlers if onChange event is passed
|
|
75
|
+
var onClick = onChange ? function () {
|
|
76
|
+
return onChange(index);
|
|
77
|
+
} : undefined;
|
|
78
|
+
|
|
79
|
+
if (index === currentIndex) {
|
|
80
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
81
|
+
complete: child.props.complete,
|
|
82
|
+
current: child.props.complete ? false : true,
|
|
83
|
+
index: index,
|
|
84
|
+
onClick: onClick
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (index < currentIndex) {
|
|
89
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
90
|
+
complete: true,
|
|
91
|
+
index: index,
|
|
92
|
+
onClick: onClick
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (index > currentIndex) {
|
|
97
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
98
|
+
complete: child.props.complete || false,
|
|
99
|
+
index: index,
|
|
100
|
+
onClick: onClick
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return null;
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
ProgressIndicator.propTypes = {
|
|
109
|
+
/**
|
|
110
|
+
* Provide `<ProgressStep>` components to be rendered in the
|
|
111
|
+
* `<ProgressIndicator>`
|
|
112
|
+
*/
|
|
113
|
+
children: PropTypes__default["default"].node,
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Provide an optional className to be applied to the containing node
|
|
117
|
+
*/
|
|
118
|
+
className: PropTypes__default["default"].string,
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Optionally specify the current step array index
|
|
122
|
+
*/
|
|
123
|
+
currentIndex: PropTypes__default["default"].number,
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Optional callback called if a ProgressStep is clicked on. Returns the index of the step.
|
|
127
|
+
*/
|
|
128
|
+
onChange: PropTypes__default["default"].func,
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Specify whether the progress steps should be split equally in size in the div
|
|
132
|
+
*/
|
|
133
|
+
spaceEqually: PropTypes__default["default"].bool,
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Determines whether or not the ProgressIndicator should be rendered vertically.
|
|
137
|
+
*/
|
|
138
|
+
vertical: PropTypes__default["default"].bool
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
function ProgressStep(_ref2) {
|
|
142
|
+
var _cx2;
|
|
143
|
+
|
|
144
|
+
var label = _ref2.label,
|
|
145
|
+
description = _ref2.description,
|
|
146
|
+
className = _ref2.className,
|
|
147
|
+
current = _ref2.current,
|
|
148
|
+
complete = _ref2.complete,
|
|
149
|
+
invalid = _ref2.invalid,
|
|
150
|
+
secondaryLabel = _ref2.secondaryLabel,
|
|
151
|
+
disabled = _ref2.disabled,
|
|
152
|
+
onClick = _ref2.onClick,
|
|
153
|
+
t = _ref2.translateWithId,
|
|
154
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref2, _excluded2);
|
|
155
|
+
|
|
156
|
+
var prefix = usePrefix.usePrefix();
|
|
157
|
+
var classes = cx__default["default"]((_cx2 = {}, _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--progress-step"), true), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--progress-step--current"), current), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--progress-step--complete"), complete), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--progress-step--incomplete"), !complete && !current), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--progress-step--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_cx2, className, className), _cx2));
|
|
57
158
|
|
|
58
159
|
var handleKeyDown = function handleKeyDown(e) {
|
|
59
160
|
if (match.matches(e, [keys.Enter, keys.Space])) {
|
|
@@ -62,12 +163,12 @@ function ProgressStep(_ref) {
|
|
|
62
163
|
}; // eslint-disable-next-line react/prop-types
|
|
63
164
|
|
|
64
165
|
|
|
65
|
-
var SVGIcon = function SVGIcon(
|
|
66
|
-
var complete =
|
|
67
|
-
current =
|
|
68
|
-
description =
|
|
69
|
-
invalid =
|
|
70
|
-
prefix =
|
|
166
|
+
var SVGIcon = function SVGIcon(_ref3) {
|
|
167
|
+
var complete = _ref3.complete,
|
|
168
|
+
current = _ref3.current,
|
|
169
|
+
description = _ref3.description,
|
|
170
|
+
invalid = _ref3.invalid,
|
|
171
|
+
prefix = _ref3.prefix;
|
|
71
172
|
|
|
72
173
|
if (invalid) {
|
|
73
174
|
return /*#__PURE__*/React__default["default"].createElement(iconsReact.Warning, {
|
|
@@ -129,6 +230,7 @@ function ProgressStep(_ref) {
|
|
|
129
230
|
className: "".concat(prefix, "--progress-line")
|
|
130
231
|
})));
|
|
131
232
|
}
|
|
233
|
+
|
|
132
234
|
ProgressStep.propTypes = {
|
|
133
235
|
/**
|
|
134
236
|
* Provide an optional className to be applied to the containing `<li>` node
|
|
@@ -199,134 +301,6 @@ ProgressStep.propTypes = {
|
|
|
199
301
|
ProgressStep.defaultProps = {
|
|
200
302
|
translateWithId: translateWithId
|
|
201
303
|
};
|
|
202
|
-
var ProgressIndicator = /*#__PURE__*/function (_Component) {
|
|
203
|
-
_rollupPluginBabelHelpers.inherits(ProgressIndicator, _Component);
|
|
204
|
-
|
|
205
|
-
var _super = _rollupPluginBabelHelpers.createSuper(ProgressIndicator);
|
|
206
|
-
|
|
207
|
-
function ProgressIndicator() {
|
|
208
|
-
var _this;
|
|
209
|
-
|
|
210
|
-
_rollupPluginBabelHelpers.classCallCheck(this, ProgressIndicator);
|
|
211
|
-
|
|
212
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
213
|
-
args[_key] = arguments[_key];
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
217
|
-
|
|
218
|
-
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "state", {});
|
|
219
|
-
|
|
220
|
-
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "renderSteps", function () {
|
|
221
|
-
var onChange = _this.props.onChange;
|
|
222
|
-
return React__default["default"].Children.map(_this.props.children, function (child, index) {
|
|
223
|
-
// only setup click handlers if onChange event is passed
|
|
224
|
-
var onClick = onChange ? function () {
|
|
225
|
-
return onChange(index);
|
|
226
|
-
} : undefined;
|
|
227
|
-
|
|
228
|
-
if (index === _this.state.currentIndex) {
|
|
229
|
-
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
230
|
-
current: true,
|
|
231
|
-
index: index,
|
|
232
|
-
onClick: onClick
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (index < _this.state.currentIndex) {
|
|
237
|
-
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
238
|
-
complete: true,
|
|
239
|
-
index: index,
|
|
240
|
-
onClick: onClick
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (index > _this.state.currentIndex) {
|
|
245
|
-
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
246
|
-
complete: child.props.complete || false,
|
|
247
|
-
index: index,
|
|
248
|
-
onClick: onClick
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return null;
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
return _this;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
_rollupPluginBabelHelpers.createClass(ProgressIndicator, [{
|
|
260
|
-
key: "render",
|
|
261
|
-
value: function render() {
|
|
262
|
-
var _classnames3;
|
|
263
|
-
|
|
264
|
-
var _this$props = this.props,
|
|
265
|
-
className = _this$props.className;
|
|
266
|
-
_this$props.currentIndex;
|
|
267
|
-
var vertical = _this$props.vertical,
|
|
268
|
-
spaceEqually = _this$props.spaceEqually,
|
|
269
|
-
other = _rollupPluginBabelHelpers.objectWithoutProperties(_this$props, _excluded2);
|
|
270
|
-
|
|
271
|
-
var prefix = this.context;
|
|
272
|
-
var classes = cx__default["default"]((_classnames3 = {}, _rollupPluginBabelHelpers.defineProperty(_classnames3, "".concat(prefix, "--progress"), true), _rollupPluginBabelHelpers.defineProperty(_classnames3, "".concat(prefix, "--progress--vertical"), vertical), _rollupPluginBabelHelpers.defineProperty(_classnames3, "".concat(prefix, "--progress--space-equal"), spaceEqually && !vertical), _rollupPluginBabelHelpers.defineProperty(_classnames3, className, className), _classnames3));
|
|
273
|
-
return /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({
|
|
274
|
-
className: classes
|
|
275
|
-
}, other), this.renderSteps());
|
|
276
|
-
}
|
|
277
|
-
}], [{
|
|
278
|
-
key: "getDerivedStateFromProps",
|
|
279
|
-
value: function getDerivedStateFromProps(_ref3, state) {
|
|
280
|
-
var currentIndex = _ref3.currentIndex;
|
|
281
|
-
var prevCurrentIndex = state.prevCurrentIndex;
|
|
282
|
-
return prevCurrentIndex === currentIndex ? null : {
|
|
283
|
-
currentIndex: currentIndex,
|
|
284
|
-
prevCurrentIndex: currentIndex
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
}]);
|
|
288
|
-
|
|
289
|
-
return ProgressIndicator;
|
|
290
|
-
}(React.Component);
|
|
291
|
-
|
|
292
|
-
_rollupPluginBabelHelpers.defineProperty(ProgressIndicator, "propTypes", {
|
|
293
|
-
/**
|
|
294
|
-
* Provide `<ProgressStep>` components to be rendered in the
|
|
295
|
-
* `<ProgressIndicator>`
|
|
296
|
-
*/
|
|
297
|
-
children: PropTypes__default["default"].node,
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Provide an optional className to be applied to the containing node
|
|
301
|
-
*/
|
|
302
|
-
className: PropTypes__default["default"].string,
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Optionally specify the current step array index
|
|
306
|
-
*/
|
|
307
|
-
currentIndex: PropTypes__default["default"].number,
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Optional callback called if a ProgressStep is clicked on. Returns the index of the step.
|
|
311
|
-
*/
|
|
312
|
-
onChange: PropTypes__default["default"].func,
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Specify whether the progress steps should be split equally in size in the div
|
|
316
|
-
*/
|
|
317
|
-
spaceEqually: PropTypes__default["default"].bool,
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Determines whether or not the ProgressIndicator should be rendered vertically.
|
|
321
|
-
*/
|
|
322
|
-
vertical: PropTypes__default["default"].bool
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
_rollupPluginBabelHelpers.defineProperty(ProgressIndicator, "contextType", usePrefix.PrefixContext);
|
|
326
|
-
|
|
327
|
-
_rollupPluginBabelHelpers.defineProperty(ProgressIndicator, "defaultProps", {
|
|
328
|
-
currentIndex: 0
|
|
329
|
-
});
|
|
330
304
|
|
|
331
305
|
exports.ProgressIndicator = ProgressIndicator;
|
|
332
306
|
exports.ProgressStep = ProgressStep;
|
|
@@ -15,7 +15,6 @@ var cx = require('classnames');
|
|
|
15
15
|
var PropTypes = require('prop-types');
|
|
16
16
|
var React = require('react');
|
|
17
17
|
var useId = require('../../internal/useId.js');
|
|
18
|
-
var index = require('../FeatureFlags/index.js');
|
|
19
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
19
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
21
20
|
var match = require('../../internal/keyboard/match.js');
|
|
@@ -48,10 +47,7 @@ function RadioTile(_ref) {
|
|
|
48
47
|
|
|
49
48
|
var prefix = usePrefix.usePrefix();
|
|
50
49
|
var inputId = useId.useFallbackId(id);
|
|
51
|
-
var enabled = index.useFeatureFlag('enable-v11-release');
|
|
52
50
|
var className = cx__default["default"](customClassName, "".concat(prefix, "--tile"), "".concat(prefix, "--tile--selectable"), (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tile--is-selected"), checked), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tile--light"), light), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tile--disabled"), disabled), _cx));
|
|
53
|
-
var inputProps = enabled ? {} : rest;
|
|
54
|
-
var labelProps = enabled ? rest : {};
|
|
55
51
|
|
|
56
52
|
function handleOnChange(evt) {
|
|
57
53
|
onChange(value, name, evt);
|
|
@@ -64,7 +60,7 @@ function RadioTile(_ref) {
|
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("input",
|
|
63
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
68
64
|
checked: checked,
|
|
69
65
|
className: "".concat(prefix, "--tile-input"),
|
|
70
66
|
disabled: disabled,
|
|
@@ -75,7 +71,7 @@ function RadioTile(_ref) {
|
|
|
75
71
|
tabIndex: !disabled ? tabIndex : null,
|
|
76
72
|
type: "radio",
|
|
77
73
|
value: value
|
|
78
|
-
})
|
|
74
|
+
}), /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
79
75
|
htmlFor: inputId,
|
|
80
76
|
className: className
|
|
81
77
|
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -101,11 +97,6 @@ RadioTile.propTypes = {
|
|
|
101
97
|
*/
|
|
102
98
|
className: PropTypes__default["default"].string,
|
|
103
99
|
|
|
104
|
-
/**
|
|
105
|
-
* `true` if the `<input>` should be checked at initialization.
|
|
106
|
-
*/
|
|
107
|
-
defaultChecked: PropTypes__default["default"].bool,
|
|
108
|
-
|
|
109
100
|
/**
|
|
110
101
|
* Specify whether the RadioTile should be disabled
|
|
111
102
|
*/
|
|
@@ -16,6 +16,7 @@ var cx = require('classnames');
|
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
17
|
var index = require('../FeatureFlags/index.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
|
+
var FormContext = require('../FluidForm/FormContext.js');
|
|
19
20
|
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
22
|
|
|
@@ -43,6 +44,10 @@ var TextArea = /*#__PURE__*/React__default["default"].forwardRef(function TextAr
|
|
|
43
44
|
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
44
45
|
|
|
45
46
|
var prefix = usePrefix.usePrefix();
|
|
47
|
+
|
|
48
|
+
var _useContext = React.useContext(FormContext.FormContext),
|
|
49
|
+
isFluid = _useContext.isFluid;
|
|
50
|
+
|
|
46
51
|
var enabled = index.useFeatureFlag('enable-v11-release');
|
|
47
52
|
var defaultValue = other.defaultValue,
|
|
48
53
|
value = other.value,
|
|
@@ -76,7 +81,7 @@ var TextArea = /*#__PURE__*/React__default["default"].forwardRef(function TextAr
|
|
|
76
81
|
textareaProps.maxLength = maxCount;
|
|
77
82
|
}
|
|
78
83
|
|
|
79
|
-
var labelClasses = cx__default["default"]("".concat(prefix, "--label"), (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--visually-hidden"), hideLabel), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--label--disabled"), disabled), _classNames));
|
|
84
|
+
var labelClasses = cx__default["default"]("".concat(prefix, "--label"), (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--visually-hidden"), hideLabel && !isFluid), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--label--disabled"), disabled), _classNames));
|
|
80
85
|
var label = labelText ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
81
86
|
htmlFor: id,
|
|
82
87
|
className: labelClasses
|
|
@@ -94,7 +99,9 @@ var TextArea = /*#__PURE__*/React__default["default"].forwardRef(function TextAr
|
|
|
94
99
|
role: "alert",
|
|
95
100
|
className: "".concat(prefix, "--form-requirement"),
|
|
96
101
|
id: errorId
|
|
97
|
-
}, invalidText
|
|
102
|
+
}, invalidText, isFluid && /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
103
|
+
className: "".concat(prefix, "--text-area__invalid-icon")
|
|
104
|
+
})) : null;
|
|
98
105
|
var textareaClasses = cx__default["default"]("".concat(prefix, "--text-area"), [enabled ? null : className], (_classNames4 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames4, "".concat(prefix, "--text-area--light"), light), _rollupPluginBabelHelpers.defineProperty(_classNames4, "".concat(prefix, "--text-area--invalid"), invalid), _classNames4));
|
|
99
106
|
var input = /*#__PURE__*/React__default["default"].createElement("textarea", _rollupPluginBabelHelpers["extends"]({}, other, textareaProps, {
|
|
100
107
|
placeholder: placeholder || null,
|
|
@@ -110,9 +117,11 @@ var TextArea = /*#__PURE__*/React__default["default"].forwardRef(function TextAr
|
|
|
110
117
|
}, label, counter), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
111
118
|
className: "".concat(prefix, "--text-area__wrapper"),
|
|
112
119
|
"data-invalid": invalid || null
|
|
113
|
-
}, invalid && /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
120
|
+
}, invalid && !isFluid && /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
114
121
|
className: "".concat(prefix, "--text-area__invalid-icon")
|
|
115
|
-
}), input
|
|
122
|
+
}), input, isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
123
|
+
className: "".concat(prefix, "--text-area__divider")
|
|
124
|
+
}), isFluid && invalid ? error : null), invalid && !isFluid ? error : helper);
|
|
116
125
|
});
|
|
117
126
|
TextArea.displayName = 'TextArea';
|
|
118
127
|
TextArea.propTypes = {
|
|
@@ -98,6 +98,9 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
98
98
|
warnText: warnText
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
+
var _useContext = React.useContext(FormContext.FormContext),
|
|
102
|
+
isFluid = _useContext.isFluid;
|
|
103
|
+
|
|
101
104
|
var handleTogglePasswordVisibility = function handleTogglePasswordVisibility(event) {
|
|
102
105
|
setInputType(inputType === 'password' ? 'text' : 'password');
|
|
103
106
|
onTogglePasswordVisibility && onTogglePasswordVisibility(event);
|
|
@@ -123,7 +126,7 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
123
126
|
ref: ref
|
|
124
127
|
}, rest);
|
|
125
128
|
|
|
126
|
-
var inputWrapperClasses = cx__default["default"]("".concat(prefix, "--form-item"), "".concat(prefix, "--text-input-wrapper"), "".concat(prefix, "--password-input-wrapper"), (_classNames2 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--light"), light), _rollupPluginBabelHelpers.defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--inline"), inline), _classNames2));
|
|
129
|
+
var inputWrapperClasses = cx__default["default"]("".concat(prefix, "--form-item"), "".concat(prefix, "--text-input-wrapper"), "".concat(prefix, "--password-input-wrapper"), (_classNames2 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--light"), light), _rollupPluginBabelHelpers.defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_classNames2, "".concat(prefix, "--text-input--fluid"), isFluid), _classNames2));
|
|
127
130
|
var labelClasses = cx__default["default"]("".concat(prefix, "--label"), (_classNames3 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames3, "".concat(prefix, "--visually-hidden"), hideLabel), _rollupPluginBabelHelpers.defineProperty(_classNames3, "".concat(prefix, "--label--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_classNames3, "".concat(prefix, "--label--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_classNames3, "".concat(prefix, "--label--inline--").concat(size), inline && !!size), _classNames3));
|
|
128
131
|
var helperTextClasses = cx__default["default"]("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
|
|
129
132
|
var fieldOuterWrapperClasses = cx__default["default"]("".concat(prefix, "--text-input__field-outer-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
|
|
@@ -152,7 +155,9 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
152
155
|
}), {
|
|
153
156
|
disabled: disabled,
|
|
154
157
|
"data-toggle-password-visibility": inputType === 'password'
|
|
155
|
-
})), /*#__PURE__*/React__default["default"].createElement("
|
|
158
|
+
})), isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
159
|
+
className: "".concat(prefix, "--text-input__divider")
|
|
160
|
+
}), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
156
161
|
type: "button",
|
|
157
162
|
className: passwordVisibilityToggleClasses,
|
|
158
163
|
disabled: disabled,
|
|
@@ -160,10 +165,6 @@ var PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function P
|
|
|
160
165
|
}, !disabled && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
161
166
|
className: "".concat(prefix, "--assistive-text")
|
|
162
167
|
}, passwordIsVisible ? hidePasswordLabel : showPasswordLabel), passwordVisibilityIcon));
|
|
163
|
-
|
|
164
|
-
var _useContext = React.useContext(FormContext.FormContext),
|
|
165
|
-
isFluid = _useContext.isFluid;
|
|
166
|
-
|
|
167
168
|
React.useEffect(function () {
|
|
168
169
|
setInputType(type);
|
|
169
170
|
}, [type]);
|
package/lib/index.js
CHANGED
|
@@ -51,7 +51,6 @@ var index$4 = require('./components/OverflowMenuItem/index.js');
|
|
|
51
51
|
var index$5 = require('./components/Pagination/index.js');
|
|
52
52
|
var PaginationNav = require('./components/PaginationNav/PaginationNav.js');
|
|
53
53
|
var PrimaryButton = require('./components/PrimaryButton/PrimaryButton.js');
|
|
54
|
-
var index$f = require('./components/ProgressIndicator/index.js');
|
|
55
54
|
var RadioButton = require('./components/RadioButton/RadioButton.js');
|
|
56
55
|
var RadioButtonGroup = require('./components/RadioButtonGroup/RadioButtonGroup.js');
|
|
57
56
|
var index$6 = require('./components/Search/index.js');
|
|
@@ -65,7 +64,7 @@ var SelectItem = require('./components/SelectItem/SelectItem.js');
|
|
|
65
64
|
var SelectItemGroup = require('./components/SelectItemGroup/SelectItemGroup.js');
|
|
66
65
|
var Switch = require('./components/Switch/Switch.js');
|
|
67
66
|
var index$7 = require('./components/Slider/index.js');
|
|
68
|
-
var index$
|
|
67
|
+
var index$f = require('./components/StructuredList/index.js');
|
|
69
68
|
var index$8 = require('./components/Tab/index.js');
|
|
70
69
|
var TabContent = require('./components/TabContent/TabContent.js');
|
|
71
70
|
var index$9 = require('./components/Tabs/index.js');
|
|
@@ -74,14 +73,14 @@ var Tag = require('./components/Tag/Tag.js');
|
|
|
74
73
|
var TextArea_Skeleton = require('./components/TextArea/TextArea.Skeleton.js');
|
|
75
74
|
var TextArea = require('./components/TextArea/TextArea.js');
|
|
76
75
|
require('./components/TextInput/index.js');
|
|
77
|
-
var index$
|
|
76
|
+
var index$g = require('./components/Tile/index.js');
|
|
78
77
|
var RadioTile = require('./components/RadioTile/RadioTile.js');
|
|
79
78
|
var index$a = require('./components/TileGroup/index.js');
|
|
80
79
|
var index$b = require('./components/TimePicker/index.js');
|
|
81
80
|
var index$c = require('./components/TimePickerSelect/index.js');
|
|
82
81
|
var Toggle_Skeleton = require('./components/Toggle/Toggle.Skeleton.js');
|
|
83
82
|
var Toggle = require('./components/Toggle/Toggle.js');
|
|
84
|
-
var index$
|
|
83
|
+
var index$h = require('./components/Toggletip/index.js');
|
|
85
84
|
require('./components/TreeView/index.js');
|
|
86
85
|
var UnorderedList = require('./components/UnorderedList/UnorderedList.js');
|
|
87
86
|
var SkeletonText = require('./components/SkeletonText/SkeletonText.js');
|
|
@@ -99,16 +98,16 @@ var Tabs_Skeleton = require('./components/Tabs/Tabs.Skeleton.js');
|
|
|
99
98
|
var TextInput_Skeleton = require('./components/TextInput/TextInput.Skeleton.js');
|
|
100
99
|
var ToggleSmall_Skeleton = require('./components/ToggleSmall/ToggleSmall.Skeleton.js');
|
|
101
100
|
var Icon_Skeleton = require('./components/Icon/Icon.Skeleton.js');
|
|
102
|
-
var index$
|
|
103
|
-
var index$
|
|
104
|
-
var index$
|
|
105
|
-
var index$
|
|
101
|
+
var index$i = require('./components/FeatureFlags/index.js');
|
|
102
|
+
var index$j = require('./components/Heading/index.js');
|
|
103
|
+
var index$k = require('./components/IconButton/index.js');
|
|
104
|
+
var index$l = require('./components/Layer/index.js');
|
|
106
105
|
require('./components/Menu/index.js');
|
|
107
|
-
var index$
|
|
108
|
-
var index$
|
|
109
|
-
var index$
|
|
106
|
+
var index$m = require('./components/OverflowMenuV2/index.js');
|
|
107
|
+
var index$n = require('./components/Popover/index.js');
|
|
108
|
+
var index$o = require('./components/Stack/index.js');
|
|
110
109
|
var DefinitionTooltip = require('./components/Tooltip/next/DefinitionTooltip.js');
|
|
111
|
-
var index$
|
|
110
|
+
var index$p = require('./components/Theme/index.js');
|
|
112
111
|
var usePrefix = require('./internal/usePrefix.js');
|
|
113
112
|
var AspectRatio = require('./components/AspectRatio/AspectRatio.js');
|
|
114
113
|
var Filename = require('./components/FileUploader/Filename.js');
|
|
@@ -129,6 +128,7 @@ var SideNavItem = require('./components/UIShell/SideNavItem.js');
|
|
|
129
128
|
var SideNavLinkText = require('./components/UIShell/SideNavLinkText.js');
|
|
130
129
|
var useContextMenu = require('./components/ContextMenu/useContextMenu.js');
|
|
131
130
|
var FluidTextInput = require('./components/FluidTextInput/FluidTextInput.js');
|
|
131
|
+
var FluidTextArea = require('./components/FluidTextArea/FluidTextArea.js');
|
|
132
132
|
var MenuDivider = require('./components/Menu/MenuDivider.js');
|
|
133
133
|
var MenuGroup = require('./components/Menu/MenuGroup.js');
|
|
134
134
|
var MenuItem = require('./components/Menu/MenuItem.js');
|
|
@@ -249,7 +249,6 @@ exports.OverflowMenuItem = index$4["default"];
|
|
|
249
249
|
exports.Pagination = index$5["default"];
|
|
250
250
|
exports.PaginationNav = PaginationNav["default"];
|
|
251
251
|
exports.PrimaryButton = PrimaryButton["default"];
|
|
252
|
-
exports.ProgressIndicator = index$f.ProgressIndicator;
|
|
253
252
|
exports.RadioButton = RadioButton["default"];
|
|
254
253
|
exports.RadioButtonGroup = RadioButtonGroup["default"];
|
|
255
254
|
exports.Search = index$6["default"];
|
|
@@ -263,12 +262,12 @@ exports.SelectItem = SelectItem["default"];
|
|
|
263
262
|
exports.SelectItemGroup = SelectItemGroup["default"];
|
|
264
263
|
exports.Switch = Switch["default"];
|
|
265
264
|
exports.Slider = index$7["default"];
|
|
266
|
-
exports.StructuredListBody = index$
|
|
267
|
-
exports.StructuredListCell = index$
|
|
268
|
-
exports.StructuredListHead = index$
|
|
269
|
-
exports.StructuredListInput = index$
|
|
270
|
-
exports.StructuredListRow = index$
|
|
271
|
-
exports.StructuredListWrapper = index$
|
|
265
|
+
exports.StructuredListBody = index$f.StructuredListBody;
|
|
266
|
+
exports.StructuredListCell = index$f.StructuredListCell;
|
|
267
|
+
exports.StructuredListHead = index$f.StructuredListHead;
|
|
268
|
+
exports.StructuredListInput = index$f.StructuredListInput;
|
|
269
|
+
exports.StructuredListRow = index$f.StructuredListRow;
|
|
270
|
+
exports.StructuredListWrapper = index$f.StructuredListWrapper;
|
|
272
271
|
exports.Tab = index$8["default"];
|
|
273
272
|
exports.TabContent = TabContent["default"];
|
|
274
273
|
exports.Tabs = index$9["default"];
|
|
@@ -276,23 +275,23 @@ exports.TagSkeleton = Tag_Skeleton["default"];
|
|
|
276
275
|
exports.Tag = Tag["default"];
|
|
277
276
|
exports.TextAreaSkeleton = TextArea_Skeleton["default"];
|
|
278
277
|
exports.TextArea = TextArea["default"];
|
|
279
|
-
exports.ClickableTile = index$
|
|
280
|
-
exports.ExpandableTile = index$
|
|
281
|
-
exports.SelectableTile = index$
|
|
282
|
-
exports.Tile = index$
|
|
283
|
-
exports.TileAboveTheFoldContent = index$
|
|
284
|
-
exports.TileBelowTheFoldContent = index$
|
|
278
|
+
exports.ClickableTile = index$g.ClickableTile;
|
|
279
|
+
exports.ExpandableTile = index$g.ExpandableTile;
|
|
280
|
+
exports.SelectableTile = index$g.SelectableTile;
|
|
281
|
+
exports.Tile = index$g.Tile;
|
|
282
|
+
exports.TileAboveTheFoldContent = index$g.TileAboveTheFoldContent;
|
|
283
|
+
exports.TileBelowTheFoldContent = index$g.TileBelowTheFoldContent;
|
|
285
284
|
exports.RadioTile = RadioTile["default"];
|
|
286
285
|
exports.TileGroup = index$a["default"];
|
|
287
286
|
exports.TimePicker = index$b["default"];
|
|
288
287
|
exports.TimePickerSelect = index$c["default"];
|
|
289
288
|
exports.ToggleSkeleton = Toggle_Skeleton["default"];
|
|
290
289
|
exports.Toggle = Toggle.Toggle;
|
|
291
|
-
exports.Toggletip = index$
|
|
292
|
-
exports.ToggletipActions = index$
|
|
293
|
-
exports.ToggletipButton = index$
|
|
294
|
-
exports.ToggletipContent = index$
|
|
295
|
-
exports.ToggletipLabel = index$
|
|
290
|
+
exports.Toggletip = index$h.Toggletip;
|
|
291
|
+
exports.ToggletipActions = index$h.ToggletipActions;
|
|
292
|
+
exports.ToggletipButton = index$h.ToggletipButton;
|
|
293
|
+
exports.ToggletipContent = index$h.ToggletipContent;
|
|
294
|
+
exports.ToggletipLabel = index$h.ToggletipLabel;
|
|
296
295
|
exports.UnorderedList = UnorderedList["default"];
|
|
297
296
|
exports.SkeletonText = SkeletonText["default"];
|
|
298
297
|
exports.SkeletonPlaceholder = SkeletonPlaceholder["default"];
|
|
@@ -309,23 +308,23 @@ exports.TabsSkeleton = Tabs_Skeleton["default"];
|
|
|
309
308
|
exports.TextInputSkeleton = TextInput_Skeleton["default"];
|
|
310
309
|
exports.ToggleSmallSkeleton = ToggleSmall_Skeleton["default"];
|
|
311
310
|
exports.IconSkeleton = Icon_Skeleton["default"];
|
|
312
|
-
exports.unstable_FeatureFlags = index$
|
|
313
|
-
exports.unstable_useFeatureFlag = index$
|
|
314
|
-
exports.unstable_useFeatureFlags = index$
|
|
315
|
-
exports.Heading = index$
|
|
316
|
-
exports.Section = index$
|
|
317
|
-
exports.IconButton = index$
|
|
318
|
-
exports.Layer = index$
|
|
319
|
-
exports.useLayer = index$
|
|
320
|
-
exports.unstable_OverflowMenuV2 = index$
|
|
321
|
-
exports.Popover = index$
|
|
322
|
-
exports.PopoverContent = index$
|
|
323
|
-
exports.HStack = index$
|
|
324
|
-
exports.VStack = index$
|
|
311
|
+
exports.unstable_FeatureFlags = index$i.FeatureFlags;
|
|
312
|
+
exports.unstable_useFeatureFlag = index$i.useFeatureFlag;
|
|
313
|
+
exports.unstable_useFeatureFlags = index$i.useFeatureFlags;
|
|
314
|
+
exports.Heading = index$j.Heading;
|
|
315
|
+
exports.Section = index$j.Section;
|
|
316
|
+
exports.IconButton = index$k.IconButton;
|
|
317
|
+
exports.Layer = index$l.Layer;
|
|
318
|
+
exports.useLayer = index$l.useLayer;
|
|
319
|
+
exports.unstable_OverflowMenuV2 = index$m.OverflowMenuV2;
|
|
320
|
+
exports.Popover = index$n.Popover;
|
|
321
|
+
exports.PopoverContent = index$n.PopoverContent;
|
|
322
|
+
exports.HStack = index$o.HStack;
|
|
323
|
+
exports.VStack = index$o.VStack;
|
|
325
324
|
exports.DefinitionTooltip = DefinitionTooltip.DefinitionTooltip;
|
|
326
|
-
exports.GlobalTheme = index$
|
|
327
|
-
exports.Theme = index$
|
|
328
|
-
exports.useTheme = index$
|
|
325
|
+
exports.GlobalTheme = index$p.GlobalTheme;
|
|
326
|
+
exports.Theme = index$p.Theme;
|
|
327
|
+
exports.useTheme = index$p.useTheme;
|
|
329
328
|
exports.usePrefix = usePrefix.usePrefix;
|
|
330
329
|
exports.AspectRatio = AspectRatio["default"];
|
|
331
330
|
exports.Filename = Filename["default"];
|
|
@@ -346,6 +345,7 @@ exports.SideNavItem = SideNavItem["default"];
|
|
|
346
345
|
exports.SideNavLinkText = SideNavLinkText["default"];
|
|
347
346
|
exports.unstable_useContextMenu = useContextMenu["default"];
|
|
348
347
|
exports.unstable__FluidTextInput = FluidTextInput["default"];
|
|
348
|
+
exports.unstable__FluidTextArea = FluidTextArea["default"];
|
|
349
349
|
exports.unstable_MenuDivider = MenuDivider["default"];
|
|
350
350
|
exports.unstable_MenuGroup = MenuGroup["default"];
|
|
351
351
|
exports.unstable_MenuItem = MenuItem["default"];
|
|
@@ -398,6 +398,7 @@ exports.ToastNotification = Notification.ToastNotification;
|
|
|
398
398
|
exports.NumberInput = NumberInput.NumberInput;
|
|
399
399
|
exports.ControlledPasswordInput = ControlledPasswordInput["default"];
|
|
400
400
|
exports.PasswordInput = PasswordInput["default"];
|
|
401
|
+
exports.ProgressIndicator = ProgressIndicator.ProgressIndicator;
|
|
401
402
|
exports.ProgressStep = ProgressIndicator.ProgressStep;
|
|
402
403
|
exports.StructuredListSkeleton = StructuredList_Skeleton["default"];
|
|
403
404
|
exports.IconTab = Tabs.IconTab;
|