@carbon/react 1.22.0 → 1.23.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/CodeSnippet/CodeSnippet.js +2 -2
- package/es/components/ComboBox/ComboBox.d.ts +151 -0
- package/es/components/ComboBox/ComboBox.js +28 -21
- package/es/components/ComposedModal/ComposedModal.js +2 -2
- package/es/components/DataTable/TableSelectRow.d.ts +88 -0
- package/es/components/DataTable/TableSelectRow.js +3 -5
- package/es/components/DataTable/tools/sorting.js +3 -0
- package/es/components/DatePicker/DatePicker.js +1 -1
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +10 -1
- package/es/components/DatePicker/plugins/rangePlugin.js +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +14 -16
- package/es/components/Grid/CSSGrid.d.ts +9 -0
- package/es/components/Grid/CSSGrid.js +8 -5
- package/es/components/Grid/Column.d.ts +73 -0
- package/es/components/Grid/Column.js +40 -34
- package/es/components/Grid/ColumnHang.d.ts +24 -0
- package/es/components/Grid/ColumnHang.js +7 -4
- package/es/components/Grid/FlexGrid.d.ts +9 -0
- package/es/components/Grid/FlexGrid.js +6 -3
- package/es/components/Grid/Grid.d.ts +9 -0
- package/es/components/Grid/Grid.js +6 -5
- package/es/components/Grid/GridContext.d.ts +38 -0
- package/es/components/Grid/GridContext.js +6 -6
- package/es/components/Grid/GridTypes.d.ts +37 -0
- package/es/components/Grid/Row.d.ts +34 -0
- package/es/components/Grid/Row.js +4 -2
- package/es/components/Grid/index.d.ts +11 -0
- package/es/components/NumberInput/NumberInput.d.ts +132 -0
- package/es/components/NumberInput/NumberInput.js +9 -7
- package/es/components/TextArea/TextArea.js +1 -0
- package/es/components/Toggle/Toggle.js +54 -33
- package/es/components/Toggletip/index.js +26 -1
- package/es/index.js +5 -5
- package/es/internal/useNormalizedInputProps.js +3 -3
- package/lib/components/CodeSnippet/CodeSnippet.js +4 -3
- package/lib/components/ComboBox/ComboBox.d.ts +151 -0
- package/lib/components/ComboBox/ComboBox.js +28 -21
- package/lib/components/ComposedModal/ComposedModal.js +2 -2
- package/lib/components/DataTable/TableSelectRow.d.ts +88 -0
- package/lib/components/DataTable/TableSelectRow.js +2 -4
- package/lib/components/DataTable/tools/sorting.js +3 -0
- package/lib/components/DatePicker/DatePicker.js +9 -8
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +10 -1
- package/lib/components/DatePicker/plugins/rangePlugin.js +6 -2
- package/lib/components/FileUploader/FileUploaderButton.js +14 -16
- package/lib/components/Grid/CSSGrid.d.ts +9 -0
- package/lib/components/Grid/CSSGrid.js +8 -5
- package/lib/components/Grid/Column.d.ts +73 -0
- package/lib/components/Grid/Column.js +36 -30
- package/lib/components/Grid/ColumnHang.d.ts +24 -0
- package/lib/components/Grid/ColumnHang.js +7 -4
- package/lib/components/Grid/FlexGrid.d.ts +9 -0
- package/lib/components/Grid/FlexGrid.js +6 -3
- package/lib/components/Grid/Grid.d.ts +9 -0
- package/lib/components/Grid/Grid.js +2 -1
- package/lib/components/Grid/GridContext.d.ts +38 -0
- package/lib/components/Grid/GridContext.js +6 -6
- package/lib/components/Grid/GridTypes.d.ts +37 -0
- package/lib/components/Grid/Row.d.ts +34 -0
- package/lib/components/Grid/Row.js +4 -2
- package/lib/components/Grid/index.d.ts +11 -0
- package/lib/components/NumberInput/NumberInput.d.ts +132 -0
- package/lib/components/NumberInput/NumberInput.js +9 -7
- package/lib/components/TextArea/TextArea.js +1 -0
- package/lib/components/Toggle/Toggle.js +53 -32
- package/lib/components/Toggletip/index.js +26 -1
- package/lib/index.js +10 -10
- package/lib/internal/useNormalizedInputProps.js +3 -3
- package/package.json +3 -5
- package/es/_virtual/ResizeObserver.es.js +0 -13
- package/es/_virtual/_commonjsHelpers.js +0 -42
- package/es/_virtual/index.js +0 -14
- package/es/_virtual/rangePlugin.js +0 -14
- package/es/node_modules/flatpickr/dist/l10n/index.js +0 -1423
- package/es/node_modules/flatpickr/dist/plugins/rangePlugin.js +0 -196
- package/es/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -1112
- package/es/node_modules/use-resize-observer/polyfilled.js +0 -111
- package/lib/_virtual/ResizeObserver.es.js +0 -17
- package/lib/_virtual/_commonjsHelpers.js +0 -48
- package/lib/_virtual/index.js +0 -18
- package/lib/_virtual/rangePlugin.js +0 -18
- package/lib/node_modules/flatpickr/dist/l10n/index.js +0 -1427
- package/lib/node_modules/flatpickr/dist/plugins/rangePlugin.js +0 -200
- package/lib/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -1116
- package/lib/node_modules/use-resize-observer/polyfilled.js +0 -119
|
@@ -1,111 +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 { typeof as _typeof } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import require$$0 from '../../_virtual/ResizeObserver.es.js';
|
|
10
|
-
import React__default from 'react';
|
|
11
|
-
|
|
12
|
-
function _interopDefault(ex) {
|
|
13
|
-
return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var ResizeObserver = _interopDefault(require$$0);
|
|
17
|
-
|
|
18
|
-
var react = React__default;
|
|
19
|
-
|
|
20
|
-
function useResizeObserver(opts) {
|
|
21
|
-
if (opts === void 0) {
|
|
22
|
-
opts = {};
|
|
23
|
-
} // `defaultRef` Has to be non-conditionally declared here whether or not it'll
|
|
24
|
-
// be used as that's how hooks work.
|
|
25
|
-
// @see https://reactjs.org/docs/hooks-rules.html#explanation
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var defaultRef = react.useRef(null); // Saving the callback as a ref. With this, I don't need to put onResize in the
|
|
29
|
-
// effect dep array, and just passing in an anonymous function without memoising
|
|
30
|
-
// will not reinstantiate the hook's ResizeObserver
|
|
31
|
-
|
|
32
|
-
var onResize = opts.onResize;
|
|
33
|
-
var onResizeRef = react.useRef(undefined);
|
|
34
|
-
onResizeRef.current = onResize; // Using a single instance throughought the hook's lifetime
|
|
35
|
-
|
|
36
|
-
var resizeObserverRef = react.useRef();
|
|
37
|
-
var ref = opts.ref || defaultRef;
|
|
38
|
-
|
|
39
|
-
var _useState = react.useState({
|
|
40
|
-
width: undefined,
|
|
41
|
-
height: undefined
|
|
42
|
-
}),
|
|
43
|
-
size = _useState[0],
|
|
44
|
-
setSize = _useState[1]; // Using a ref to track the previous width / height to avoid unnecessary renders
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var previous = react.useRef({
|
|
48
|
-
width: undefined,
|
|
49
|
-
height: undefined
|
|
50
|
-
});
|
|
51
|
-
react.useEffect(function () {
|
|
52
|
-
if (resizeObserverRef.current) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
resizeObserverRef.current = new ResizeObserver(function (entries) {
|
|
57
|
-
if (!Array.isArray(entries)) {
|
|
58
|
-
return;
|
|
59
|
-
} // Since we only observe the one element, we don't need to loop over the
|
|
60
|
-
// array
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (!entries.length) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
var entry = entries[0]; // `Math.round` is in line with how CSS resolves sub-pixel values
|
|
68
|
-
|
|
69
|
-
var newWidth = Math.round(entry.contentRect.width);
|
|
70
|
-
var newHeight = Math.round(entry.contentRect.height);
|
|
71
|
-
|
|
72
|
-
if (previous.current.width !== newWidth || previous.current.height !== newHeight) {
|
|
73
|
-
var newSize = {
|
|
74
|
-
width: newWidth,
|
|
75
|
-
height: newHeight
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
if (onResizeRef.current) {
|
|
79
|
-
onResizeRef.current(newSize);
|
|
80
|
-
} else {
|
|
81
|
-
previous.current.width = newWidth;
|
|
82
|
-
previous.current.height = newHeight;
|
|
83
|
-
setSize(newSize);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}, []);
|
|
88
|
-
react.useEffect(function () {
|
|
89
|
-
if (_typeof(ref) !== "object" || ref === null || !(ref.current instanceof Element)) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
var element = ref.current;
|
|
94
|
-
resizeObserverRef.current.observe(element);
|
|
95
|
-
return function () {
|
|
96
|
-
return resizeObserverRef.current.unobserve(element);
|
|
97
|
-
};
|
|
98
|
-
}, [ref]);
|
|
99
|
-
return react.useMemo(function () {
|
|
100
|
-
return {
|
|
101
|
-
ref: ref,
|
|
102
|
-
width: size.width,
|
|
103
|
-
height: size.height
|
|
104
|
-
};
|
|
105
|
-
}, [ref, size ? size.width : null, size ? size.height : null]);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
var polyfilled = useResizeObserver;
|
|
109
|
-
var useResizeObserver$1 = polyfilled;
|
|
110
|
-
|
|
111
|
-
export { useResizeObserver$1 as default };
|
|
@@ -1,17 +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 _commonjsHelpers = require('./_commonjsHelpers.js');
|
|
13
|
-
var ResizeObserver_es = require('../node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js');
|
|
14
|
-
|
|
15
|
-
var require$$0 = /*@__PURE__*/_commonjsHelpers.getAugmentedNamespace(ResizeObserver_es);
|
|
16
|
-
|
|
17
|
-
exports["default"] = require$$0;
|
|
@@ -1,48 +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 commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
13
|
-
|
|
14
|
-
function getDefaultExportFromCjs (x) {
|
|
15
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function getAugmentedNamespace(n) {
|
|
19
|
-
if (n.__esModule) return n;
|
|
20
|
-
var f = n.default;
|
|
21
|
-
if (typeof f == "function") {
|
|
22
|
-
var a = function a () {
|
|
23
|
-
if (this instanceof a) {
|
|
24
|
-
var args = [null];
|
|
25
|
-
args.push.apply(args, arguments);
|
|
26
|
-
var Ctor = Function.bind.apply(f, args);
|
|
27
|
-
return new Ctor();
|
|
28
|
-
}
|
|
29
|
-
return f.apply(this, arguments);
|
|
30
|
-
};
|
|
31
|
-
a.prototype = f.prototype;
|
|
32
|
-
} else a = {};
|
|
33
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
34
|
-
Object.keys(n).forEach(function (k) {
|
|
35
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
36
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return n[k];
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
return a;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
exports.commonjsGlobal = commonjsGlobal;
|
|
47
|
-
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
48
|
-
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
package/lib/_virtual/index.js
DELETED
|
@@ -1,18 +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
|
-
exports.exports = {};
|
|
13
|
-
var l10n = {
|
|
14
|
-
get exports(){ return exports.exports; },
|
|
15
|
-
set exports(v){ exports.exports = v; },
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.__module = l10n;
|
|
@@ -1,18 +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
|
-
exports.exports = {};
|
|
13
|
-
var rangePlugin = {
|
|
14
|
-
get exports(){ return exports.exports; },
|
|
15
|
-
set exports(v){ exports.exports = v; },
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.__module = rangePlugin;
|