@carbon/react 1.16.0 → 1.17.0-rc.1
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/Checkbox/Checkbox.Skeleton.d.ts +18 -0
- package/es/components/Checkbox/Checkbox.Skeleton.js +1 -2
- package/es/components/Checkbox/Checkbox.d.ts +47 -0
- package/es/components/Checkbox/Checkbox.js +6 -7
- package/es/components/Checkbox/index.d.ts +10 -0
- package/es/components/Checkbox/index.js +10 -0
- package/es/components/ComposedModal/ComposedModal.js +4 -3
- package/es/components/DataTable/TableToolbarSearch.js +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
- package/es/components/Grid/Grid.js +0 -5
- package/es/components/Modal/Modal.js +5 -4
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -2
- package/es/components/Search/Search.js +160 -184
- package/es/components/Search/index.js +2 -8
- package/es/components/Tab/index.js +1 -1
- package/es/components/Tabs/Tabs.Skeleton.js +6 -6
- package/es/components/Tabs/Tabs.js +582 -508
- package/es/components/Tabs/index.js +2 -12
- package/es/components/Tabs/{next/usePressable.js → usePressable.js} +1 -1
- package/es/components/Text/Text.d.ts +33 -0
- package/es/components/Text/Text.js +8 -5
- package/es/components/Text/TextDirection.d.ts +35 -0
- package/es/components/Text/TextDirectionContext.js +2 -0
- package/es/components/Text/createTextComponent.d.ts +18 -0
- package/es/components/Text/index.d.ts +18 -0
- package/es/components/Text/index.js +2 -0
- package/es/components/TextArea/TextArea.js +19 -2
- package/es/components/Tile/Tile.js +339 -502
- package/es/index.js +9 -9
- package/es/internal/usePrefix.d.ts +9 -0
- package/lib/components/Checkbox/Checkbox.Skeleton.d.ts +18 -0
- package/lib/components/Checkbox/Checkbox.Skeleton.js +1 -2
- package/lib/components/Checkbox/Checkbox.d.ts +47 -0
- package/lib/components/Checkbox/Checkbox.js +6 -7
- package/lib/components/Checkbox/index.d.ts +10 -0
- package/lib/components/Checkbox/index.js +18 -0
- package/lib/components/ComposedModal/ComposedModal.js +4 -3
- package/lib/components/DataTable/TableToolbarSearch.js +2 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +3 -3
- package/lib/components/Grid/Grid.js +0 -5
- package/lib/components/Modal/Modal.js +5 -4
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +8 -2
- package/lib/components/Search/Search.js +159 -183
- package/lib/components/Search/index.js +2 -25
- package/lib/components/Tab/index.js +1 -1
- package/lib/components/Tabs/Tabs.Skeleton.js +6 -6
- package/lib/components/Tabs/Tabs.js +586 -507
- package/lib/components/Tabs/index.js +7 -33
- package/lib/components/Tabs/{next/usePressable.js → usePressable.js} +1 -1
- package/lib/components/Text/Text.d.ts +33 -0
- package/lib/components/Text/Text.js +8 -5
- package/lib/components/Text/TextDirection.d.ts +35 -0
- package/lib/components/Text/TextDirectionContext.js +2 -0
- package/lib/components/Text/createTextComponent.d.ts +18 -0
- package/lib/components/Text/index.d.ts +18 -0
- package/lib/components/Text/index.js +4 -0
- package/lib/components/TextArea/TextArea.js +18 -1
- package/lib/components/Tile/Tile.js +336 -499
- package/lib/index.js +76 -76
- package/lib/internal/usePrefix.d.ts +9 -0
- package/package.json +8 -4
- package/es/components/Search/next/Search.js +0 -265
- package/es/components/Tabs/next/Tabs.Skeleton.js +0 -53
- package/es/components/Tabs/next/Tabs.js +0 -692
- package/es/components/Tile/index.js +0 -19
- package/es/components/Tile/next/Tile.js +0 -604
- package/lib/components/Search/next/Search.js +0 -275
- package/lib/components/Tabs/next/Tabs.Skeleton.js +0 -63
- package/lib/components/Tabs/next/Tabs.js +0 -708
- package/lib/components/Tile/index.js +0 -48
- package/lib/components/Tile/next/Tile.js +0 -619
|
@@ -9,39 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var Tabs$2 = require('./next/Tabs.js');
|
|
14
|
-
var Tabs$3 = require('./Tabs.js');
|
|
15
|
-
var Tabs_Skeleton$1 = require('./Tabs.Skeleton.js');
|
|
16
|
-
var Tabs_Skeleton = require('./next/Tabs.Skeleton.js');
|
|
12
|
+
var Tabs = require('./Tabs.js');
|
|
17
13
|
|
|
18
|
-
function _interopNamespace(e) {
|
|
19
|
-
if (e && e.__esModule) return e;
|
|
20
|
-
var n = Object.create(null);
|
|
21
|
-
if (e) {
|
|
22
|
-
Object.keys(e).forEach(function (k) {
|
|
23
|
-
if (k !== 'default') {
|
|
24
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () { return e[k]; }
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
n["default"] = e;
|
|
33
|
-
return Object.freeze(n);
|
|
34
|
-
}
|
|
35
14
|
|
|
36
|
-
var FeatureFlags__namespace = /*#__PURE__*/_interopNamespace(FeatureFlags);
|
|
37
15
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
exports.
|
|
43
|
-
exports
|
|
44
|
-
exports.TabList = Tabs$2.TabList;
|
|
45
|
-
exports.TabPanel = Tabs$2.TabPanel;
|
|
46
|
-
exports.TabPanels = Tabs$2.TabPanels;
|
|
47
|
-
exports["default"] = Tabs$1;
|
|
16
|
+
exports.IconTab = Tabs.IconTab;
|
|
17
|
+
exports.Tab = Tabs.Tab;
|
|
18
|
+
exports.TabList = Tabs.TabList;
|
|
19
|
+
exports.TabPanel = Tabs.TabPanel;
|
|
20
|
+
exports.TabPanels = Tabs.TabPanels;
|
|
21
|
+
exports["default"] = Tabs.Tabs;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var _rollupPluginBabelHelpers = require('
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var React = require('react');
|
|
14
14
|
|
|
15
15
|
function usePressable(ref) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
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
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { PolymorphicProps } from '../../types/common';
|
|
10
|
+
import { TextDir } from './TextDirection';
|
|
11
|
+
export interface TextBaseProps {
|
|
12
|
+
dir?: TextDir | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare type TextProps<T extends React.ElementType> = PolymorphicProps<T, TextBaseProps>;
|
|
15
|
+
declare function Text<T extends React.ElementType>({ as, children, dir, ...rest }: TextProps<T>): JSX.Element;
|
|
16
|
+
declare namespace Text {
|
|
17
|
+
var propTypes: {
|
|
18
|
+
/**
|
|
19
|
+
* Provide a custom element type used to render the outermost node
|
|
20
|
+
*/
|
|
21
|
+
as: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactComponentLike | null | undefined>>;
|
|
22
|
+
/**
|
|
23
|
+
* Provide child elements or text to be rendered inside of this component
|
|
24
|
+
*/
|
|
25
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
26
|
+
/**
|
|
27
|
+
* Specify the text direction to be used for this component and any of its
|
|
28
|
+
* children
|
|
29
|
+
*/
|
|
30
|
+
dir: PropTypes.Requireable<string>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export { Text };
|
|
@@ -22,15 +22,16 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
22
|
var _excluded = ["as", "children", "dir"];
|
|
23
23
|
|
|
24
24
|
function Text(_ref) {
|
|
25
|
-
var
|
|
26
|
-
BaseComponent = _ref$as === void 0 ? 'span' : _ref$as,
|
|
25
|
+
var as = _ref.as,
|
|
27
26
|
children = _ref.children,
|
|
28
27
|
_ref$dir = _ref.dir,
|
|
29
28
|
dir = _ref$dir === void 0 ? 'auto' : _ref$dir,
|
|
30
29
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
31
30
|
|
|
31
|
+
// TODO: Update with context typing once its been converted to TS
|
|
32
32
|
var context = React.useContext(TextDirectionContext.TextDirectionContext);
|
|
33
33
|
var textProps = {};
|
|
34
|
+
var BaseComponent = as !== null && as !== void 0 ? as : 'span';
|
|
34
35
|
|
|
35
36
|
var value = _rollupPluginBabelHelpers.objectSpread2({}, context);
|
|
36
37
|
|
|
@@ -83,21 +84,23 @@ Text.propTypes = {
|
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
function getTextFromChildren(children) {
|
|
87
|
+
var _React$Children$map;
|
|
88
|
+
|
|
86
89
|
if (typeof children === 'string') {
|
|
87
90
|
return children;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
var text = React__default["default"].Children.map(children, function (child) {
|
|
93
|
+
var text = (_React$Children$map = React__default["default"].Children.map(children, function (child) {
|
|
91
94
|
if (typeof child === 'string') {
|
|
92
95
|
return child;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
return null;
|
|
96
|
-
}).filter(function (text) {
|
|
99
|
+
})) === null || _React$Children$map === void 0 ? void 0 : _React$Children$map.filter(function (text) {
|
|
97
100
|
return text !== null;
|
|
98
101
|
});
|
|
99
102
|
|
|
100
|
-
if (text.length === 1) {
|
|
103
|
+
if ((text === null || text === void 0 ? void 0 : text.length) === 1) {
|
|
101
104
|
return text[0];
|
|
102
105
|
}
|
|
103
106
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
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
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
9
|
+
export declare type TextDir = 'ltr' | 'rtl' | 'auto';
|
|
10
|
+
export declare type GetTextDirection = (text: string | string[] | undefined) => TextDir;
|
|
11
|
+
export interface TextDirectionProps {
|
|
12
|
+
children: ReactNode | undefined;
|
|
13
|
+
dir?: TextDir;
|
|
14
|
+
getTextDirection?: GetTextDirection;
|
|
15
|
+
}
|
|
16
|
+
declare function TextDirection({ children, dir, getTextDirection, }: TextDirectionProps): JSX.Element;
|
|
17
|
+
declare namespace TextDirection {
|
|
18
|
+
var propTypes: {
|
|
19
|
+
/**
|
|
20
|
+
* Provide children to be rendered inside of this component
|
|
21
|
+
*/
|
|
22
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
23
|
+
/**
|
|
24
|
+
* Specify the text direction for rendered children
|
|
25
|
+
*/
|
|
26
|
+
dir: PropTypes.Requireable<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Optionally provide a custom function to get the text direction for a piece
|
|
29
|
+
* of text. Whatever is returned will become the value of the `dir` attribute
|
|
30
|
+
* on a node of text. Should return one of: 'ltr', 'rtl', or 'auto'
|
|
31
|
+
*/
|
|
32
|
+
getTextDirection: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export { TextDirection };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
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
|
+
import React from 'react';
|
|
8
|
+
import { TextProps } from './Text';
|
|
9
|
+
/**
|
|
10
|
+
* Create a text component wrapper for a given text node type. Useful for
|
|
11
|
+
* returning a `Text` component for a text node like a `<label>`.
|
|
12
|
+
* @param {string} element
|
|
13
|
+
* @param {string} displayName
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTextComponent(element: React.ElementType, displayName: string): {
|
|
16
|
+
(props: TextProps<React.ElementType>): JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
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
|
+
import { TextDirection, TextDirectionProps, GetTextDirection, TextDir } from './TextDirection';
|
|
8
|
+
import { Text, TextBaseProps, TextProps } from './Text';
|
|
9
|
+
export { TextDirection, Text };
|
|
10
|
+
export type { TextBaseProps, TextProps, TextDirectionProps, GetTextDirection, TextDir, };
|
|
11
|
+
export declare const Label: {
|
|
12
|
+
(props: TextProps<import("react").ElementType<any>>): JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const Legend: {
|
|
16
|
+
(props: TextProps<import("react").ElementType<any>>): JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
@@ -9,9 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
var TextDirection = require('./TextDirection.js');
|
|
13
|
+
var Text = require('./Text.js');
|
|
12
14
|
var createTextComponent = require('./createTextComponent.js');
|
|
13
15
|
|
|
14
16
|
createTextComponent.createTextComponent('label', 'Label');
|
|
15
17
|
var Legend = createTextComponent.createTextComponent('legend', 'Legend');
|
|
16
18
|
|
|
19
|
+
exports.TextDirection = TextDirection.TextDirection;
|
|
20
|
+
exports.Text = Text.Text;
|
|
17
21
|
exports.Legend = Legend;
|
|
@@ -59,6 +59,11 @@ var TextArea = /*#__PURE__*/React__default["default"].forwardRef(function TextAr
|
|
|
59
59
|
textCount = _useState2[0],
|
|
60
60
|
setTextCount = _useState2[1];
|
|
61
61
|
|
|
62
|
+
var _useState3 = React.useState(''),
|
|
63
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
64
|
+
ariaAnnouncement = _useState4[0],
|
|
65
|
+
setAriaAnnouncement = _useState4[1];
|
|
66
|
+
|
|
62
67
|
var textareaProps = {
|
|
63
68
|
id: id,
|
|
64
69
|
onChange: function onChange(evt) {
|
|
@@ -82,6 +87,15 @@ var TextArea = /*#__PURE__*/React__default["default"].forwardRef(function TextAr
|
|
|
82
87
|
textareaProps.maxLength = maxCount;
|
|
83
88
|
}
|
|
84
89
|
|
|
90
|
+
React.useEffect(function () {
|
|
91
|
+
var lastTen = maxCount - 10;
|
|
92
|
+
|
|
93
|
+
if (textCount >= lastTen) {
|
|
94
|
+
setAriaAnnouncement("".concat(maxCount - textCount, " characters left."));
|
|
95
|
+
} else {
|
|
96
|
+
setAriaAnnouncement('');
|
|
97
|
+
}
|
|
98
|
+
}, [textCount, maxCount]);
|
|
85
99
|
var labelClasses = cx__default["default"]("".concat(prefix, "--label"), (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--visually-hidden"), hideLabel && !isFluid), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--label--disabled"), disabled), _classNames));
|
|
86
100
|
var label = labelText ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
87
101
|
htmlFor: id,
|
|
@@ -120,7 +134,10 @@ var TextArea = /*#__PURE__*/React__default["default"].forwardRef(function TextAr
|
|
|
120
134
|
"data-invalid": invalid || null
|
|
121
135
|
}, invalid && !isFluid && /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
122
136
|
className: "".concat(prefix, "--text-area__invalid-icon")
|
|
123
|
-
}), input,
|
|
137
|
+
}), input, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
138
|
+
className: "".concat(prefix, "--text-area__counter-alert"),
|
|
139
|
+
role: "alert"
|
|
140
|
+
}, ariaAnnouncement), isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
124
141
|
className: "".concat(prefix, "--text-area__divider")
|
|
125
142
|
}), isFluid && invalid ? error : null), invalid && !isFluid ? error : helper);
|
|
126
143
|
});
|