@carbon/react 0.10.0 → 0.12.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,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;