@carbon/react 1.3.0-rc.1 → 1.4.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/Checkbox/Checkbox.Skeleton.js +5 -3
- package/es/components/ComposedModal/next/ComposedModal.js +11 -11
- package/es/components/DatePicker/DatePicker.js +264 -334
- package/es/components/DatePickerInput/DatePickerInput.js +141 -168
- package/es/components/FileUploader/FileUploader.js +3 -3
- package/es/components/FileUploader/FileUploaderButton.js +4 -4
- package/es/components/FileUploader/FileUploaderDropContainer.js +3 -3
- package/es/components/FormGroup/FormGroup.js +1 -2
- package/es/components/IconButton/index.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +10 -0
- package/es/components/MultiSelect/next/FilterableMultiSelect.js +11 -0
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/Slider/Slider.js +11 -0
- package/es/components/StructuredList/next/StructuredList.js +19 -3
- package/es/components/TabContent/TabContent.js +2 -1
- package/es/components/Tabs/next/Tabs.js +31 -25
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/index.js +3 -3
- package/lib/components/Checkbox/Checkbox.Skeleton.js +5 -3
- package/lib/components/ComposedModal/next/ComposedModal.js +11 -11
- package/lib/components/DatePicker/DatePicker.js +261 -331
- package/lib/components/DatePickerInput/DatePickerInput.js +138 -165
- package/lib/components/FileUploader/FileUploader.js +3 -3
- package/lib/components/FileUploader/FileUploaderButton.js +4 -4
- package/lib/components/FileUploader/FileUploaderDropContainer.js +3 -3
- package/lib/components/FormGroup/FormGroup.js +1 -2
- package/lib/components/IconButton/index.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +10 -0
- package/lib/components/MultiSelect/next/FilterableMultiSelect.js +11 -0
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/Slider/Slider.js +11 -0
- package/lib/components/StructuredList/next/StructuredList.js +19 -3
- package/lib/components/TabContent/TabContent.js +2 -1
- package/lib/components/Tabs/next/Tabs.js +31 -25
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/index.js +100 -100
- package/package.json +4 -4
- package/es/components/DatePicker/index.js +0 -15
- package/es/components/DatePicker/next/DatePicker.js +0 -562
- package/es/components/DatePickerInput/index.js +0 -15
- package/es/components/DatePickerInput/next/DatePickerInput.js +0 -244
- package/lib/components/DatePicker/index.js +0 -39
- package/lib/components/DatePicker/next/DatePicker.js +0 -573
- package/lib/components/DatePickerInput/index.js +0 -39
- package/lib/components/DatePickerInput/next/DatePickerInput.js +0 -254
|
@@ -1,254 +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 cx = require('classnames');
|
|
15
|
-
var PropTypes = require('prop-types');
|
|
16
|
-
var React = require('react');
|
|
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 cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
22
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
-
|
|
25
|
-
var _excluded = ["datePickerType", "disabled", "helperText", "hideLabel", "id", "invalid", "invalidText", "labelText", "onClick", "onChange", "pattern", "placeholder", "size", "type", "warn", "warnText"];
|
|
26
|
-
var DatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(function DatePickerInput(props, ref) {
|
|
27
|
-
var _cx, _cx2, _cx4;
|
|
28
|
-
|
|
29
|
-
var datePickerType = props.datePickerType,
|
|
30
|
-
_props$disabled = props.disabled,
|
|
31
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
32
|
-
helperText = props.helperText,
|
|
33
|
-
hideLabel = props.hideLabel,
|
|
34
|
-
id = props.id,
|
|
35
|
-
_props$invalid = props.invalid,
|
|
36
|
-
invalid = _props$invalid === void 0 ? false : _props$invalid,
|
|
37
|
-
invalidText = props.invalidText,
|
|
38
|
-
labelText = props.labelText,
|
|
39
|
-
_props$onClick = props.onClick,
|
|
40
|
-
_onClick = _props$onClick === void 0 ? function () {} : _props$onClick,
|
|
41
|
-
_props$onChange = props.onChange,
|
|
42
|
-
_onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
43
|
-
_props$pattern = props.pattern,
|
|
44
|
-
pattern = _props$pattern === void 0 ? '\\d{1,2}\\/\\d{1,2}\\/\\d{4}' : _props$pattern,
|
|
45
|
-
placeholder = props.placeholder,
|
|
46
|
-
_props$size = props.size,
|
|
47
|
-
size = _props$size === void 0 ? 'md' : _props$size,
|
|
48
|
-
_props$type = props.type,
|
|
49
|
-
type = _props$type === void 0 ? 'text' : _props$type,
|
|
50
|
-
warn = props.warn,
|
|
51
|
-
warnText = props.warnText,
|
|
52
|
-
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
53
|
-
|
|
54
|
-
var prefix = usePrefix.usePrefix();
|
|
55
|
-
var datePickerInputProps = {
|
|
56
|
-
id: id,
|
|
57
|
-
onChange: function onChange(event) {
|
|
58
|
-
if (!disabled) {
|
|
59
|
-
_onChange(event);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
onClick: function onClick(event) {
|
|
63
|
-
if (!disabled) {
|
|
64
|
-
_onClick(event);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
pattern: pattern,
|
|
68
|
-
placeholder: placeholder,
|
|
69
|
-
type: type
|
|
70
|
-
};
|
|
71
|
-
var wrapperClasses = cx__default["default"]("".concat(prefix, "--date-picker-input__wrapper"), (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--date-picker-input__wrapper--invalid"), invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--date-picker-input__wrapper--warn"), warn), _cx));
|
|
72
|
-
var labelClasses = cx__default["default"]("".concat(prefix, "--label"), (_cx2 = {}, _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--visually-hidden"), hideLabel), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--label--disabled"), disabled), _cx2));
|
|
73
|
-
var helperTextClasses = cx__default["default"]("".concat(prefix, "--form__helper-text"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
74
|
-
var inputClasses = cx__default["default"]("".concat(prefix, "--date-picker__input"), (_cx4 = {}, _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--date-picker__input--").concat(size), size), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--date-picker__input--invalid"), invalid), _cx4));
|
|
75
|
-
var containerClasses = cx__default["default"]("".concat(prefix, "--date-picker-container"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--date-picker--nolabel"), !labelText));
|
|
76
|
-
var input = invalid ? /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, rest, datePickerInputProps, {
|
|
77
|
-
disabled: disabled,
|
|
78
|
-
ref: ref,
|
|
79
|
-
"data-invalid": true,
|
|
80
|
-
className: inputClasses
|
|
81
|
-
})) : /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, rest, datePickerInputProps, {
|
|
82
|
-
disabled: disabled,
|
|
83
|
-
className: inputClasses,
|
|
84
|
-
ref: ref
|
|
85
|
-
}));
|
|
86
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
87
|
-
className: containerClasses
|
|
88
|
-
}, labelText && /*#__PURE__*/React__default["default"].createElement("label", {
|
|
89
|
-
htmlFor: id,
|
|
90
|
-
className: labelClasses
|
|
91
|
-
}, labelText), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
92
|
-
className: wrapperClasses
|
|
93
|
-
}, input, /*#__PURE__*/React__default["default"].createElement(DatePickerIcon, {
|
|
94
|
-
datePickerType: datePickerType,
|
|
95
|
-
invalid: invalid,
|
|
96
|
-
warn: warn
|
|
97
|
-
})), invalid && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
98
|
-
className: "".concat(prefix, "--form-requirement")
|
|
99
|
-
}, invalidText), warn && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
100
|
-
className: "".concat(prefix, "--form-requirement")
|
|
101
|
-
}, warnText), helperText && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
102
|
-
className: helperTextClasses
|
|
103
|
-
}, helperText));
|
|
104
|
-
});
|
|
105
|
-
DatePickerInput.propTypes = {
|
|
106
|
-
/**
|
|
107
|
-
* The type of the date picker:
|
|
108
|
-
*
|
|
109
|
-
* * `simple` - Without calendar dropdown.
|
|
110
|
-
* * `single` - With calendar dropdown and single date.
|
|
111
|
-
* * `range` - With calendar dropdown and a date range.
|
|
112
|
-
*/
|
|
113
|
-
datePickerType: PropTypes__default["default"].oneOf(['simple', 'single', 'range']),
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Specify whether or not the input should be disabled
|
|
117
|
-
*/
|
|
118
|
-
disabled: PropTypes__default["default"].bool,
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Provide text that is used alongside the control label for additional help
|
|
122
|
-
*/
|
|
123
|
-
helperText: PropTypes__default["default"].node,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Specify if the label should be hidden
|
|
127
|
-
*/
|
|
128
|
-
hideLabel: PropTypes__default["default"].bool,
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Specify an id that uniquely identifies the `<input>`
|
|
132
|
-
*/
|
|
133
|
-
id: PropTypes__default["default"].string.isRequired,
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Specify whether or not the input should be invalid
|
|
137
|
-
*/
|
|
138
|
-
invalid: PropTypes__default["default"].bool,
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Specify the text to be rendered when the input is invalid
|
|
142
|
-
*/
|
|
143
|
-
invalidText: PropTypes__default["default"].node,
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Provide the text that will be read by a screen reader when visiting this
|
|
147
|
-
* control
|
|
148
|
-
*/
|
|
149
|
-
labelText: PropTypes__default["default"].node.isRequired,
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Specify an `onChange` handler that is called whenever a change in the
|
|
153
|
-
* input field has occurred
|
|
154
|
-
*/
|
|
155
|
-
onChange: PropTypes__default["default"].func,
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Provide a function to be called when the input field is clicked
|
|
159
|
-
*/
|
|
160
|
-
onClick: PropTypes__default["default"].func,
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Provide a regular expression that the input value must match
|
|
164
|
-
*/
|
|
165
|
-
pattern: function pattern(props, propName, componentName) {
|
|
166
|
-
if (props[propName] === undefined) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
new RegExp(props[propName]);
|
|
172
|
-
} catch (e) {
|
|
173
|
-
return new Error("Invalid value of prop '".concat(propName, "' supplied to '").concat(componentName, "', it should be a valid regular expression"));
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Specify the placeholder text
|
|
179
|
-
*/
|
|
180
|
-
placeholder: PropTypes__default["default"].string,
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Specify the size of the Date Picker Input. Currently supports either `sm`, `md`, or `lg` as an option.
|
|
184
|
-
*/
|
|
185
|
-
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Specify the type of the `<input>`
|
|
189
|
-
*/
|
|
190
|
-
type: PropTypes__default["default"].string,
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Specify whether the control is currently in warning state
|
|
194
|
-
*/
|
|
195
|
-
warn: PropTypes__default["default"].bool,
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Provide the text that is displayed when the control is in warning state
|
|
199
|
-
*/
|
|
200
|
-
warnText: PropTypes__default["default"].node
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
function DatePickerIcon(_ref) {
|
|
204
|
-
var datePickerType = _ref.datePickerType,
|
|
205
|
-
invalid = _ref.invalid,
|
|
206
|
-
warn = _ref.warn;
|
|
207
|
-
var prefix = usePrefix.usePrefix();
|
|
208
|
-
|
|
209
|
-
if (datePickerType === 'simple' && !invalid && !warn) {
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (invalid) {
|
|
214
|
-
return /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
215
|
-
className: "".concat(prefix, "--date-picker__icon ").concat(prefix, "--date-picker__icon--invalid")
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (!invalid && warn) {
|
|
220
|
-
return /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningAltFilled, {
|
|
221
|
-
className: "".concat(prefix, "--date-picker__icon ").concat(prefix, "--date-picker__icon--warn")
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return /*#__PURE__*/React__default["default"].createElement(iconsReact.Calendar, {
|
|
226
|
-
className: "".concat(prefix, "--date-picker__icon"),
|
|
227
|
-
role: "img",
|
|
228
|
-
"aria-hidden": "true"
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
DatePickerIcon.propTypes = {
|
|
233
|
-
/**
|
|
234
|
-
* The type of the date picker:
|
|
235
|
-
*
|
|
236
|
-
* * `simple` - Without calendar dropdown.
|
|
237
|
-
* * `single` - With calendar dropdown and single date.
|
|
238
|
-
* * `range` - With calendar dropdown and a date range.
|
|
239
|
-
*/
|
|
240
|
-
datePickerType: PropTypes__default["default"].oneOf(['simple', 'single', 'range']),
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Specify whether or not the input should be invalid
|
|
244
|
-
*/
|
|
245
|
-
invalid: PropTypes__default["default"].bool,
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Specify whether the control is currently in warning state
|
|
249
|
-
*/
|
|
250
|
-
warn: PropTypes__default["default"].bool
|
|
251
|
-
};
|
|
252
|
-
var DatePickerInputNext = DatePickerInput;
|
|
253
|
-
|
|
254
|
-
exports["default"] = DatePickerInputNext;
|