@carbon/react 0.9.1 → 0.11.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.
@@ -1,93 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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
- function _typeof(obj) {
9
- "@babel/helpers - typeof";
10
-
11
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
12
- _typeof = function (obj) {
13
- return typeof obj;
14
- };
15
- } else {
16
- _typeof = function (obj) {
17
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18
- };
19
- }
20
-
21
- return _typeof(obj);
22
- }
23
-
24
- function _defineProperty(obj, key, value) {
25
- if (key in obj) {
26
- Object.defineProperty(obj, key, {
27
- value: value,
28
- enumerable: true,
29
- configurable: true,
30
- writable: true
31
- });
32
- } else {
33
- obj[key] = value;
34
- }
35
-
36
- return obj;
37
- }
38
-
39
- function _extends() {
40
- _extends = Object.assign || function (target) {
41
- for (var i = 1; i < arguments.length; i++) {
42
- var source = arguments[i];
43
-
44
- for (var key in source) {
45
- if (Object.prototype.hasOwnProperty.call(source, key)) {
46
- target[key] = source[key];
47
- }
48
- }
49
- }
50
-
51
- return target;
52
- };
53
-
54
- return _extends.apply(this, arguments);
55
- }
56
-
57
- function _objectWithoutPropertiesLoose(source, excluded) {
58
- if (source == null) return {};
59
- var target = {};
60
- var sourceKeys = Object.keys(source);
61
- var key, i;
62
-
63
- for (i = 0; i < sourceKeys.length; i++) {
64
- key = sourceKeys[i];
65
- if (excluded.indexOf(key) >= 0) continue;
66
- target[key] = source[key];
67
- }
68
-
69
- return target;
70
- }
71
-
72
- function _objectWithoutProperties(source, excluded) {
73
- if (source == null) return {};
74
-
75
- var target = _objectWithoutPropertiesLoose(source, excluded);
76
-
77
- var key, i;
78
-
79
- if (Object.getOwnPropertySymbols) {
80
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
81
-
82
- for (i = 0; i < sourceSymbolKeys.length; i++) {
83
- key = sourceSymbolKeys[i];
84
- if (excluded.indexOf(key) >= 0) continue;
85
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
86
- target[key] = source[key];
87
- }
88
- }
89
-
90
- return target;
91
- }
92
-
93
- export { _defineProperty as defineProperty, _extends as extends, _objectWithoutProperties as objectWithoutProperties, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose, _typeof as typeof };
@@ -1,47 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- import classnames from '../../node_modules/classnames/index.js';
12
- import { usePrefix } from '../../internal/usePrefix.js';
13
-
14
- var _excluded = ["as", "className", "children"];
15
- function Layer(_ref) {
16
- var _ref$as = _ref.as,
17
- BaseComponent = _ref$as === void 0 ? 'div' : _ref$as,
18
- customClassName = _ref.className,
19
- children = _ref.children,
20
- rest = _objectWithoutProperties(_ref, _excluded);
21
-
22
- var prefix = usePrefix();
23
- var className = classnames("".concat(prefix, "--layer"), customClassName);
24
- return /*#__PURE__*/React.createElement(BaseComponent, _extends({}, rest, {
25
- className: className
26
- }), children);
27
- }
28
- Layer.propTypes = {
29
- /**
30
- * Specify a custom component or element to be rendered as the top-level
31
- * element in the component
32
- */
33
- as: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.elementType]),
34
-
35
- /**
36
- * Provide child elements to be rendered inside of `Theme`
37
- */
38
- children: PropTypes.node,
39
-
40
- /**
41
- * Provide a custom class name to be used on the outermost element rendered by
42
- * the component
43
- */
44
- className: PropTypes.string
45
- };
46
-
47
- export { Layer };
@@ -1,76 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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 React from 'react';
10
- import PropTypes from 'prop-types';
11
- import classnames from '../../node_modules/classnames/index.js';
12
- import { usePrefix } from '../../internal/usePrefix.js';
13
-
14
- var _excluded = ["as", "children", "className", "theme"];
15
- var ThemeContext = /*#__PURE__*/React.createContext({
16
- theme: 'white'
17
- });
18
- /**
19
- * Specify the theme to be applied to a page, or a region in a page
20
- */
21
-
22
- function Theme(_ref) {
23
- var _cx;
24
-
25
- var _ref$as = _ref.as,
26
- BaseComponent = _ref$as === void 0 ? 'div' : _ref$as,
27
- children = _ref.children,
28
- customClassName = _ref.className,
29
- theme = _ref.theme,
30
- rest = _objectWithoutProperties(_ref, _excluded);
31
-
32
- var prefix = usePrefix();
33
- var className = classnames(customClassName, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--white"), theme === 'white'), _defineProperty(_cx, "".concat(prefix, "--g10"), theme === 'g10'), _defineProperty(_cx, "".concat(prefix, "--g90"), theme === 'g90'), _defineProperty(_cx, "".concat(prefix, "--g100"), theme === 'g100'), _cx));
34
- var value = React.useMemo(function () {
35
- return {
36
- theme: theme
37
- };
38
- }, [theme]);
39
- return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
40
- value: value
41
- }, /*#__PURE__*/React.createElement(BaseComponent, _extends({}, rest, {
42
- className: className
43
- }), children));
44
- }
45
- Theme.propTypes = {
46
- /**
47
- * Specify a custom component or element to be rendered as the top-level
48
- * element in the component
49
- */
50
- as: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.elementType]),
51
-
52
- /**
53
- * Provide child elements to be rendered inside of `Theme`
54
- */
55
- children: PropTypes.node,
56
-
57
- /**
58
- * Provide a custom class name to be used on the outermost element rendered by
59
- * the component
60
- */
61
- className: PropTypes.string,
62
-
63
- /**
64
- * Specify the theme
65
- */
66
- theme: PropTypes.oneOf(['white', 'g10', 'g90', 'g100'])
67
- };
68
- /**
69
- * Get access to the current theme
70
- */
71
-
72
- function useTheme() {
73
- return React.useContext(ThemeContext);
74
- }
75
-
76
- export { Theme, useTheme };
@@ -1,12 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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 { unstable_usePrefix } from 'carbon-components-react';
9
-
10
- var usePrefix = unstable_usePrefix;
11
-
12
- export { usePrefix };
@@ -1,61 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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 { createCommonjsModule } from '../../_virtual/_commonjsHelpers.js';
10
-
11
- var classnames = createCommonjsModule(function (module) {
12
- /* global define */
13
- (function () {
14
-
15
- var hasOwn = {}.hasOwnProperty;
16
-
17
- function classNames() {
18
- var classes = [];
19
-
20
- for (var i = 0; i < arguments.length; i++) {
21
- var arg = arguments[i];
22
- if (!arg) continue;
23
-
24
- var argType = _typeof(arg);
25
-
26
- if (argType === 'string' || argType === 'number') {
27
- classes.push(arg);
28
- } else if (Array.isArray(arg)) {
29
- if (arg.length) {
30
- var inner = classNames.apply(null, arg);
31
-
32
- if (inner) {
33
- classes.push(inner);
34
- }
35
- }
36
- } else if (argType === 'object') {
37
- if (arg.toString === Object.prototype.toString) {
38
- for (var key in arg) {
39
- if (hasOwn.call(arg, key) && arg[key]) {
40
- classes.push(key);
41
- }
42
- }
43
- } else {
44
- classes.push(arg.toString());
45
- }
46
- }
47
- }
48
-
49
- return classes.join(' ');
50
- }
51
-
52
- if (module.exports) {
53
- classNames.default = classNames;
54
- module.exports = classNames;
55
- } else {
56
- window.classNames = classNames;
57
- }
58
- })();
59
- });
60
-
61
- export default classnames;
@@ -1,17 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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
- function createCommonjsModule(fn) {
13
- var module = { exports: {} };
14
- return fn(module, module.exports), module.exports;
15
- }
16
-
17
- exports.createCommonjsModule = createCommonjsModule;
@@ -1,101 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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
- function _typeof(obj) {
13
- "@babel/helpers - typeof";
14
-
15
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
16
- _typeof = function (obj) {
17
- return typeof obj;
18
- };
19
- } else {
20
- _typeof = function (obj) {
21
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
22
- };
23
- }
24
-
25
- return _typeof(obj);
26
- }
27
-
28
- function _defineProperty(obj, key, value) {
29
- if (key in obj) {
30
- Object.defineProperty(obj, key, {
31
- value: value,
32
- enumerable: true,
33
- configurable: true,
34
- writable: true
35
- });
36
- } else {
37
- obj[key] = value;
38
- }
39
-
40
- return obj;
41
- }
42
-
43
- function _extends() {
44
- _extends = Object.assign || function (target) {
45
- for (var i = 1; i < arguments.length; i++) {
46
- var source = arguments[i];
47
-
48
- for (var key in source) {
49
- if (Object.prototype.hasOwnProperty.call(source, key)) {
50
- target[key] = source[key];
51
- }
52
- }
53
- }
54
-
55
- return target;
56
- };
57
-
58
- return _extends.apply(this, arguments);
59
- }
60
-
61
- function _objectWithoutPropertiesLoose(source, excluded) {
62
- if (source == null) return {};
63
- var target = {};
64
- var sourceKeys = Object.keys(source);
65
- var key, i;
66
-
67
- for (i = 0; i < sourceKeys.length; i++) {
68
- key = sourceKeys[i];
69
- if (excluded.indexOf(key) >= 0) continue;
70
- target[key] = source[key];
71
- }
72
-
73
- return target;
74
- }
75
-
76
- function _objectWithoutProperties(source, excluded) {
77
- if (source == null) return {};
78
-
79
- var target = _objectWithoutPropertiesLoose(source, excluded);
80
-
81
- var key, i;
82
-
83
- if (Object.getOwnPropertySymbols) {
84
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
85
-
86
- for (i = 0; i < sourceSymbolKeys.length; i++) {
87
- key = sourceSymbolKeys[i];
88
- if (excluded.indexOf(key) >= 0) continue;
89
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
90
- target[key] = source[key];
91
- }
92
- }
93
-
94
- return target;
95
- }
96
-
97
- exports.defineProperty = _defineProperty;
98
- exports.extends = _extends;
99
- exports.objectWithoutProperties = _objectWithoutProperties;
100
- exports.objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose;
101
- exports.typeof = _typeof;
@@ -1,56 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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 React = require('react');
14
- var PropTypes = require('prop-types');
15
- var index = require('../../node_modules/classnames/index.js');
16
- var usePrefix = require('../../internal/usePrefix.js');
17
-
18
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
-
20
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
-
23
- var _excluded = ["as", "className", "children"];
24
- function Layer(_ref) {
25
- var _ref$as = _ref.as,
26
- BaseComponent = _ref$as === void 0 ? 'div' : _ref$as,
27
- customClassName = _ref.className,
28
- children = _ref.children,
29
- rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
30
-
31
- var prefix = usePrefix.usePrefix();
32
- var className = index("".concat(prefix, "--layer"), customClassName);
33
- return /*#__PURE__*/React__default['default'].createElement(BaseComponent, _rollupPluginBabelHelpers['extends']({}, rest, {
34
- className: className
35
- }), children);
36
- }
37
- Layer.propTypes = {
38
- /**
39
- * Specify a custom component or element to be rendered as the top-level
40
- * element in the component
41
- */
42
- as: PropTypes__default['default'].oneOfType([PropTypes__default['default'].func, PropTypes__default['default'].string, PropTypes__default['default'].elementType]),
43
-
44
- /**
45
- * Provide child elements to be rendered inside of `Theme`
46
- */
47
- children: PropTypes__default['default'].node,
48
-
49
- /**
50
- * Provide a custom class name to be used on the outermost element rendered by
51
- * the component
52
- */
53
- className: PropTypes__default['default'].string
54
- };
55
-
56
- exports.Layer = Layer;
@@ -1,86 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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 React = require('react');
14
- var PropTypes = require('prop-types');
15
- var index = require('../../node_modules/classnames/index.js');
16
- var usePrefix = require('../../internal/usePrefix.js');
17
-
18
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
-
20
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
-
23
- var _excluded = ["as", "children", "className", "theme"];
24
- var ThemeContext = /*#__PURE__*/React__default['default'].createContext({
25
- theme: 'white'
26
- });
27
- /**
28
- * Specify the theme to be applied to a page, or a region in a page
29
- */
30
-
31
- function Theme(_ref) {
32
- var _cx;
33
-
34
- var _ref$as = _ref.as,
35
- BaseComponent = _ref$as === void 0 ? 'div' : _ref$as,
36
- children = _ref.children,
37
- customClassName = _ref.className,
38
- theme = _ref.theme,
39
- rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
40
-
41
- var prefix = usePrefix.usePrefix();
42
- var className = index(customClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--white"), theme === 'white'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--g10"), theme === 'g10'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--g90"), theme === 'g90'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--g100"), theme === 'g100'), _cx));
43
- var value = React__default['default'].useMemo(function () {
44
- return {
45
- theme: theme
46
- };
47
- }, [theme]);
48
- return /*#__PURE__*/React__default['default'].createElement(ThemeContext.Provider, {
49
- value: value
50
- }, /*#__PURE__*/React__default['default'].createElement(BaseComponent, _rollupPluginBabelHelpers['extends']({}, rest, {
51
- className: className
52
- }), children));
53
- }
54
- Theme.propTypes = {
55
- /**
56
- * Specify a custom component or element to be rendered as the top-level
57
- * element in the component
58
- */
59
- as: PropTypes__default['default'].oneOfType([PropTypes__default['default'].func, PropTypes__default['default'].string, PropTypes__default['default'].elementType]),
60
-
61
- /**
62
- * Provide child elements to be rendered inside of `Theme`
63
- */
64
- children: PropTypes__default['default'].node,
65
-
66
- /**
67
- * Provide a custom class name to be used on the outermost element rendered by
68
- * the component
69
- */
70
- className: PropTypes__default['default'].string,
71
-
72
- /**
73
- * Specify the theme
74
- */
75
- theme: PropTypes__default['default'].oneOf(['white', 'g10', 'g90', 'g100'])
76
- };
77
- /**
78
- * Get access to the current theme
79
- */
80
-
81
- function useTheme() {
82
- return React__default['default'].useContext(ThemeContext);
83
- }
84
-
85
- exports.Theme = Theme;
86
- exports.useTheme = useTheme;
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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 carbonComponentsReact = require('carbon-components-react');
13
-
14
- var usePrefix = carbonComponentsReact.unstable_usePrefix;
15
-
16
- exports.usePrefix = usePrefix;
@@ -1,63 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2021
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
- var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
11
- var _commonjsHelpers = require('../../_virtual/_commonjsHelpers.js');
12
-
13
- var classnames = _commonjsHelpers.createCommonjsModule(function (module) {
14
- /* global define */
15
- (function () {
16
-
17
- var hasOwn = {}.hasOwnProperty;
18
-
19
- function classNames() {
20
- var classes = [];
21
-
22
- for (var i = 0; i < arguments.length; i++) {
23
- var arg = arguments[i];
24
- if (!arg) continue;
25
-
26
- var argType = _rollupPluginBabelHelpers['typeof'](arg);
27
-
28
- if (argType === 'string' || argType === 'number') {
29
- classes.push(arg);
30
- } else if (Array.isArray(arg)) {
31
- if (arg.length) {
32
- var inner = classNames.apply(null, arg);
33
-
34
- if (inner) {
35
- classes.push(inner);
36
- }
37
- }
38
- } else if (argType === 'object') {
39
- if (arg.toString === Object.prototype.toString) {
40
- for (var key in arg) {
41
- if (hasOwn.call(arg, key) && arg[key]) {
42
- classes.push(key);
43
- }
44
- }
45
- } else {
46
- classes.push(arg.toString());
47
- }
48
- }
49
- }
50
-
51
- return classes.join(' ');
52
- }
53
-
54
- if (module.exports) {
55
- classNames.default = classNames;
56
- module.exports = classNames;
57
- } else {
58
- window.classNames = classNames;
59
- }
60
- })();
61
- });
62
-
63
- module.exports = classnames;