@carbon/react 1.22.0 → 1.23.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 (49) hide show
  1. package/es/components/CodeSnippet/CodeSnippet.js +2 -2
  2. package/es/components/ComboBox/ComboBox.d.ts +151 -0
  3. package/es/components/ComboBox/ComboBox.js +28 -21
  4. package/es/components/ComposedModal/ComposedModal.js +2 -2
  5. package/es/components/DataTable/TableSelectRow.d.ts +88 -0
  6. package/es/components/DataTable/TableSelectRow.js +3 -5
  7. package/es/components/DatePicker/DatePicker.js +1 -1
  8. package/es/components/DatePicker/plugins/fixEventsPlugin.js +10 -1
  9. package/es/components/DatePicker/plugins/rangePlugin.js +1 -1
  10. package/es/components/FileUploader/FileUploaderButton.js +14 -16
  11. package/es/components/NumberInput/NumberInput.d.ts +132 -0
  12. package/es/components/NumberInput/NumberInput.js +9 -7
  13. package/es/components/TextArea/TextArea.js +1 -0
  14. package/es/components/Toggle/Toggle.js +54 -33
  15. package/es/components/Toggletip/index.js +26 -1
  16. package/es/internal/useNormalizedInputProps.js +3 -3
  17. package/lib/components/CodeSnippet/CodeSnippet.js +4 -3
  18. package/lib/components/ComboBox/ComboBox.d.ts +151 -0
  19. package/lib/components/ComboBox/ComboBox.js +28 -21
  20. package/lib/components/ComposedModal/ComposedModal.js +2 -2
  21. package/lib/components/DataTable/TableSelectRow.d.ts +88 -0
  22. package/lib/components/DataTable/TableSelectRow.js +2 -4
  23. package/lib/components/DatePicker/DatePicker.js +9 -8
  24. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +10 -1
  25. package/lib/components/DatePicker/plugins/rangePlugin.js +6 -2
  26. package/lib/components/FileUploader/FileUploaderButton.js +14 -16
  27. package/lib/components/NumberInput/NumberInput.d.ts +132 -0
  28. package/lib/components/NumberInput/NumberInput.js +9 -7
  29. package/lib/components/TextArea/TextArea.js +1 -0
  30. package/lib/components/Toggle/Toggle.js +53 -32
  31. package/lib/components/Toggletip/index.js +26 -1
  32. package/lib/internal/useNormalizedInputProps.js +3 -3
  33. package/package.json +3 -5
  34. package/es/_virtual/ResizeObserver.es.js +0 -13
  35. package/es/_virtual/_commonjsHelpers.js +0 -42
  36. package/es/_virtual/index.js +0 -14
  37. package/es/_virtual/rangePlugin.js +0 -14
  38. package/es/node_modules/flatpickr/dist/l10n/index.js +0 -1423
  39. package/es/node_modules/flatpickr/dist/plugins/rangePlugin.js +0 -196
  40. package/es/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -1112
  41. package/es/node_modules/use-resize-observer/polyfilled.js +0 -111
  42. package/lib/_virtual/ResizeObserver.es.js +0 -17
  43. package/lib/_virtual/_commonjsHelpers.js +0 -48
  44. package/lib/_virtual/index.js +0 -18
  45. package/lib/_virtual/rangePlugin.js +0 -18
  46. package/lib/node_modules/flatpickr/dist/l10n/index.js +0 -1427
  47. package/lib/node_modules/flatpickr/dist/plugins/rangePlugin.js +0 -200
  48. package/lib/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -1116
  49. package/lib/node_modules/use-resize-observer/polyfilled.js +0 -119
@@ -1,196 +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 { commonjsGlobal } from '../../../../_virtual/_commonjsHelpers.js';
9
- import { exports as rangePluginExports, __module as rangePlugin$1 } from '../../../../_virtual/rangePlugin.js';
10
-
11
- (function (module, exports) {
12
- (function (global, factory) {
13
- module.exports = factory() ;
14
- })(commonjsGlobal, function () {
15
- /*! *****************************************************************************
16
- Copyright (c) Microsoft Corporation.
17
- Permission to use, copy, modify, and/or distribute this software for any
18
- purpose with or without fee is hereby granted.
19
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
- PERFORMANCE OF THIS SOFTWARE.
26
- ***************************************************************************** */
27
-
28
- function __spreadArrays() {
29
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
30
- s += arguments[i].length;
31
- }
32
-
33
- for (var r = Array(s), k = 0, i = 0; i < il; i++) {
34
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
35
- r[k] = a[j];
36
- }
37
- }
38
-
39
- return r;
40
- }
41
-
42
- function rangePlugin(config) {
43
- if (config === void 0) {
44
- config = {};
45
- }
46
-
47
- return function (fp) {
48
- var dateFormat = "",
49
- secondInput,
50
- _secondInputFocused,
51
- _prevDates;
52
-
53
- var createSecondInput = function createSecondInput() {
54
- if (config.input) {
55
- secondInput = config.input instanceof Element ? config.input : window.document.querySelector(config.input);
56
-
57
- if (!secondInput) {
58
- fp.config.errorHandler(new Error("Invalid input element specified"));
59
- return;
60
- }
61
-
62
- if (fp.config.wrap) {
63
- secondInput = secondInput.querySelector("[data-input]");
64
- }
65
- } else {
66
- secondInput = fp._input.cloneNode();
67
- secondInput.removeAttribute("id");
68
- secondInput._flatpickr = undefined;
69
- }
70
-
71
- if (secondInput.value) {
72
- var parsedDate = fp.parseDate(secondInput.value);
73
- if (parsedDate) fp.selectedDates.push(parsedDate);
74
- }
75
-
76
- secondInput.setAttribute("data-fp-omit", "");
77
-
78
- if (fp.config.clickOpens) {
79
- fp._bind(secondInput, ["focus", "click"], function () {
80
- if (fp.selectedDates[1]) {
81
- fp.latestSelectedDateObj = fp.selectedDates[1];
82
-
83
- fp._setHoursFromDate(fp.selectedDates[1]);
84
-
85
- fp.jumpToDate(fp.selectedDates[1]);
86
- }
87
-
88
- _secondInputFocused = true;
89
- fp.isOpen = false;
90
- fp.open(undefined, config.position === "left" ? fp._input : secondInput);
91
- });
92
-
93
- fp._bind(fp._input, ["focus", "click"], function (e) {
94
- e.preventDefault();
95
- fp.isOpen = false;
96
- fp.open();
97
- });
98
- }
99
-
100
- if (fp.config.allowInput) fp._bind(secondInput, "keydown", function (e) {
101
- if (e.key === "Enter") {
102
- fp.setDate([fp.selectedDates[0], secondInput.value], true, dateFormat);
103
- secondInput.click();
104
- }
105
- });
106
- if (!config.input) fp._input.parentNode && fp._input.parentNode.insertBefore(secondInput, fp._input.nextSibling);
107
- };
108
-
109
- var plugin = {
110
- onParseConfig: function onParseConfig() {
111
- fp.config.mode = "range";
112
- dateFormat = fp.config.altInput ? fp.config.altFormat : fp.config.dateFormat;
113
- },
114
- onReady: function onReady() {
115
- createSecondInput();
116
- fp.config.ignoredFocusElements.push(secondInput);
117
-
118
- if (fp.config.allowInput) {
119
- fp._input.removeAttribute("readonly");
120
-
121
- secondInput.removeAttribute("readonly");
122
- } else {
123
- secondInput.setAttribute("readonly", "readonly");
124
- }
125
-
126
- fp._bind(fp._input, "focus", function () {
127
- fp.latestSelectedDateObj = fp.selectedDates[0];
128
-
129
- fp._setHoursFromDate(fp.selectedDates[0]);
130
-
131
- _secondInputFocused = false;
132
- fp.jumpToDate(fp.selectedDates[0]);
133
- });
134
-
135
- if (fp.config.allowInput) fp._bind(fp._input, "keydown", function (e) {
136
- if (e.key === "Enter") fp.setDate([fp._input.value, fp.selectedDates[1]], true, dateFormat);
137
- });
138
- fp.setDate(fp.selectedDates, false);
139
- plugin.onValueUpdate(fp.selectedDates);
140
- fp.loadedPlugins.push("range");
141
- },
142
- onPreCalendarPosition: function onPreCalendarPosition() {
143
- if (_secondInputFocused) {
144
- fp._positionElement = secondInput;
145
- setTimeout(function () {
146
- fp._positionElement = fp._input;
147
- }, 0);
148
- }
149
- },
150
- onChange: function onChange() {
151
- if (!fp.selectedDates.length) {
152
- setTimeout(function () {
153
- if (fp.selectedDates.length) return;
154
- secondInput.value = "";
155
- _prevDates = [];
156
- }, 10);
157
- }
158
-
159
- if (_secondInputFocused) {
160
- setTimeout(function () {
161
- secondInput.focus();
162
- }, 0);
163
- }
164
- },
165
- onDestroy: function onDestroy() {
166
- if (!config.input) secondInput.parentNode && secondInput.parentNode.removeChild(secondInput);
167
- },
168
- onValueUpdate: function onValueUpdate(selDates) {
169
- var _a, _b, _c;
170
-
171
- if (!secondInput) return;
172
- _prevDates = !_prevDates || selDates.length >= _prevDates.length ? __spreadArrays(selDates) : _prevDates;
173
-
174
- if (_prevDates.length > selDates.length) {
175
- var newSelectedDate = selDates[0];
176
- var newDates = _secondInputFocused ? [_prevDates[0], newSelectedDate] : [newSelectedDate, _prevDates[1]];
177
- fp.setDate(newDates, false);
178
- _prevDates = __spreadArrays(newDates);
179
- }
180
-
181
- _a = fp.selectedDates.map(function (d) {
182
- return fp.formatDate(d, dateFormat);
183
- }), _b = _a[0], fp._input.value = _b === void 0 ? "" : _b, _c = _a[1], secondInput.value = _c === void 0 ? "" : _c;
184
- }
185
- };
186
- return plugin;
187
- };
188
- }
189
-
190
- return rangePlugin;
191
- });
192
- })(rangePlugin$1);
193
-
194
- var rangePlugin = rangePluginExports;
195
-
196
- export { rangePlugin as default };