@carbon/react 1.16.0-rc.0 → 1.17.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 (73) hide show
  1. package/es/components/Checkbox/Checkbox.Skeleton.d.ts +18 -0
  2. package/es/components/Checkbox/Checkbox.Skeleton.js +1 -2
  3. package/es/components/Checkbox/Checkbox.d.ts +47 -0
  4. package/es/components/Checkbox/Checkbox.js +6 -7
  5. package/es/components/Checkbox/index.d.ts +10 -0
  6. package/es/components/Checkbox/index.js +10 -0
  7. package/es/components/CodeSnippet/CodeSnippet.js +0 -1
  8. package/es/components/DataTable/TableToolbarSearch.js +1 -1
  9. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
  10. package/es/components/Grid/Grid.js +0 -5
  11. package/es/components/NumberInput/NumberInput.js +45 -1
  12. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +10 -4
  13. package/es/components/Search/Search.js +160 -184
  14. package/es/components/Search/index.js +2 -8
  15. package/es/components/Tab/index.js +1 -1
  16. package/es/components/Tabs/Tabs.Skeleton.js +6 -6
  17. package/es/components/Tabs/Tabs.js +582 -508
  18. package/es/components/Tabs/index.js +2 -12
  19. package/es/components/Tabs/{next/usePressable.js → usePressable.js} +1 -1
  20. package/es/components/Text/Text.d.ts +33 -0
  21. package/es/components/Text/Text.js +8 -5
  22. package/es/components/Text/TextDirection.d.ts +35 -0
  23. package/es/components/Text/TextDirectionContext.js +2 -0
  24. package/es/components/Text/createTextComponent.d.ts +18 -0
  25. package/es/components/Text/index.d.ts +18 -0
  26. package/es/components/Text/index.js +2 -0
  27. package/es/components/TextInput/TextInput.js +1 -1
  28. package/es/components/Tile/Tile.js +339 -502
  29. package/es/index.js +6 -6
  30. package/es/internal/useNormalizedInputProps.js +13 -17
  31. package/es/internal/usePrefix.d.ts +9 -0
  32. package/lib/components/Checkbox/Checkbox.Skeleton.d.ts +18 -0
  33. package/lib/components/Checkbox/Checkbox.Skeleton.js +1 -2
  34. package/lib/components/Checkbox/Checkbox.d.ts +47 -0
  35. package/lib/components/Checkbox/Checkbox.js +6 -7
  36. package/lib/components/Checkbox/index.d.ts +10 -0
  37. package/lib/components/Checkbox/index.js +18 -0
  38. package/lib/components/CodeSnippet/CodeSnippet.js +0 -1
  39. package/lib/components/DataTable/TableToolbarSearch.js +2 -2
  40. package/lib/components/ExpandableSearch/ExpandableSearch.js +3 -3
  41. package/lib/components/Grid/Grid.js +0 -5
  42. package/lib/components/NumberInput/NumberInput.js +45 -1
  43. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +9 -3
  44. package/lib/components/Search/Search.js +159 -183
  45. package/lib/components/Search/index.js +2 -25
  46. package/lib/components/Tab/index.js +1 -1
  47. package/lib/components/Tabs/Tabs.Skeleton.js +6 -6
  48. package/lib/components/Tabs/Tabs.js +586 -507
  49. package/lib/components/Tabs/index.js +7 -33
  50. package/lib/components/Tabs/{next/usePressable.js → usePressable.js} +1 -1
  51. package/lib/components/Text/Text.d.ts +33 -0
  52. package/lib/components/Text/Text.js +8 -5
  53. package/lib/components/Text/TextDirection.d.ts +35 -0
  54. package/lib/components/Text/TextDirectionContext.js +2 -0
  55. package/lib/components/Text/createTextComponent.d.ts +18 -0
  56. package/lib/components/Text/index.d.ts +18 -0
  57. package/lib/components/Text/index.js +4 -0
  58. package/lib/components/TextInput/TextInput.js +1 -1
  59. package/lib/components/Tile/Tile.js +336 -499
  60. package/lib/index.js +71 -71
  61. package/lib/internal/useNormalizedInputProps.js +12 -16
  62. package/lib/internal/usePrefix.d.ts +9 -0
  63. package/package.json +8 -4
  64. package/es/components/Search/next/Search.js +0 -265
  65. package/es/components/Tabs/next/Tabs.Skeleton.js +0 -53
  66. package/es/components/Tabs/next/Tabs.js +0 -692
  67. package/es/components/Tile/index.js +0 -19
  68. package/es/components/Tile/next/Tile.js +0 -604
  69. package/lib/components/Search/next/Search.js +0 -275
  70. package/lib/components/Tabs/next/Tabs.Skeleton.js +0 -63
  71. package/lib/components/Tabs/next/Tabs.js +0 -708
  72. package/lib/components/Tile/index.js +0 -48
  73. package/lib/components/Tile/next/Tile.js +0 -619
@@ -5,15 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import * as FeatureFlags from '@carbon/feature-flags';
9
- import { Tabs as Tabs$2 } from './next/Tabs.js';
10
- export { IconTab, Tab, TabList, TabPanel, TabPanels } from './next/Tabs.js';
11
- import Tabs$3 from './Tabs.js';
12
- import TabsSkeleton$1 from './Tabs.Skeleton.js';
13
- import TabsSkeleton from './next/Tabs.Skeleton.js';
14
-
15
- var Tabs = FeatureFlags.enabled('enable-v11-release') ? Tabs$2 : Tabs$3;
16
- FeatureFlags.enabled('enable-v11-release') ? TabsSkeleton : TabsSkeleton$1;
17
- var Tabs$1 = Tabs;
18
-
19
- export { Tabs$1 as default };
8
+ import { Tabs } from './Tabs.js';
9
+ export { IconTab, Tab, TabList, TabPanel, TabPanels, Tabs as default } from './Tabs.js';
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import { useRef, useState, useEffect } from 'react';
10
10
 
11
11
  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 };
@@ -13,15 +13,16 @@ import { TextDirectionContext } from './TextDirectionContext.js';
13
13
  var _excluded = ["as", "children", "dir"];
14
14
 
15
15
  function Text(_ref) {
16
- var _ref$as = _ref.as,
17
- BaseComponent = _ref$as === void 0 ? 'span' : _ref$as,
16
+ var as = _ref.as,
18
17
  children = _ref.children,
19
18
  _ref$dir = _ref.dir,
20
19
  dir = _ref$dir === void 0 ? 'auto' : _ref$dir,
21
20
  rest = _objectWithoutProperties(_ref, _excluded);
22
21
 
22
+ // TODO: Update with context typing once its been converted to TS
23
23
  var context = useContext(TextDirectionContext);
24
24
  var textProps = {};
25
+ var BaseComponent = as !== null && as !== void 0 ? as : 'span';
25
26
 
26
27
  var value = _objectSpread2({}, context);
27
28
 
@@ -74,21 +75,23 @@ Text.propTypes = {
74
75
  };
75
76
 
76
77
  function getTextFromChildren(children) {
78
+ var _React$Children$map;
79
+
77
80
  if (typeof children === 'string') {
78
81
  return children;
79
82
  }
80
83
 
81
- var text = React__default.Children.map(children, function (child) {
84
+ var text = (_React$Children$map = React__default.Children.map(children, function (child) {
82
85
  if (typeof child === 'string') {
83
86
  return child;
84
87
  }
85
88
 
86
89
  return null;
87
- }).filter(function (text) {
90
+ })) === null || _React$Children$map === void 0 ? void 0 : _React$Children$map.filter(function (text) {
88
91
  return text !== null;
89
92
  });
90
93
 
91
- if (text.length === 1) {
94
+ if ((text === null || text === void 0 ? void 0 : text.length) === 1) {
92
95
  return text[0];
93
96
  }
94
97
 
@@ -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 };
@@ -7,6 +7,8 @@
7
7
 
8
8
  import { createContext } from 'react';
9
9
 
10
+ /** @type any */
11
+
10
12
  var TextDirectionContext = /*#__PURE__*/createContext(null);
11
13
 
12
14
  export { TextDirectionContext };
@@ -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
+ };
@@ -5,6 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ export { TextDirection } from './TextDirection.js';
9
+ export { Text } from './Text.js';
8
10
  import { createTextComponent } from './createTextComponent.js';
9
11
 
10
12
  createTextComponent('label', 'Label');
@@ -109,7 +109,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
109
109
  var helperTextClasses = cx("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), normalizedProps.disabled), _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
110
110
  var fieldOuterWrapperClasses = cx("".concat(prefix, "--text-input__field-outer-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
111
111
  var fieldWrapperClasses = cx("".concat(prefix, "--text-input__field-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
112
- var iconClasses = cx((_classNames7 = {}, _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__readonly-icon"), readOnly), _classNames7));
112
+ var iconClasses = cx((_classNames7 = {}, _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _classNames7));
113
113
  var counterClasses = cx("".concat(prefix, "--label"), (_classNames8 = {}, _defineProperty(_classNames8, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_classNames8, "".concat(prefix, "--text-input__label-counter"), true), _classNames8));
114
114
  var counter = enableCounter && maxCount ? /*#__PURE__*/React__default.createElement("div", {
115
115
  className: counterClasses