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