@carbon/react 1.45.0-rc.0 → 1.45.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 (38) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +828 -910
  2. package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
  3. package/es/components/ComboBox/ComboBox.js +1 -1
  4. package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
  5. package/es/components/DatePickerInput/DatePickerInput.js +1 -1
  6. package/es/components/Dropdown/Dropdown.js +1 -1
  7. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
  8. package/es/components/MultiSelect/MultiSelect.js +4 -1
  9. package/es/components/NumberInput/NumberInput.js +2 -2
  10. package/es/components/ProgressIndicator/ProgressIndicator.js +4 -0
  11. package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  12. package/es/components/Select/Select.js +1 -1
  13. package/es/components/Slug/index.js +1 -0
  14. package/es/components/Tag/Tag.d.ts +18 -10
  15. package/es/components/Tag/Tag.js +23 -7
  16. package/es/components/TextArea/TextArea.js +1 -1
  17. package/es/components/TextInput/TextInput.js +1 -1
  18. package/es/components/Tile/Tile.js +2 -2
  19. package/es/components/UIShell/Switcher.js +1 -1
  20. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  21. package/lib/components/ComboBox/ComboBox.js +1 -1
  22. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  23. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  24. package/lib/components/Dropdown/Dropdown.js +1 -1
  25. package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -1
  26. package/lib/components/MultiSelect/MultiSelect.js +4 -1
  27. package/lib/components/NumberInput/NumberInput.js +2 -2
  28. package/lib/components/ProgressIndicator/ProgressIndicator.js +4 -0
  29. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  30. package/lib/components/Select/Select.js +1 -1
  31. package/lib/components/Slug/index.js +1 -0
  32. package/lib/components/Tag/Tag.d.ts +18 -10
  33. package/lib/components/Tag/Tag.js +23 -7
  34. package/lib/components/TextArea/TextArea.js +1 -1
  35. package/lib/components/TextInput/TextInput.js +1 -1
  36. package/lib/components/Tile/Tile.js +2 -2
  37. package/lib/components/UIShell/Switcher.js +1 -1
  38. package/package.json +4 -4
@@ -54,6 +54,7 @@ const Tag = _ref => {
54
54
  onClose,
55
55
  size,
56
56
  as: BaseComponent,
57
+ slug,
57
58
  ...other
58
59
  } = _ref;
59
60
  const prefix = usePrefix.usePrefix();
@@ -74,15 +75,26 @@ const Tag = _ref => {
74
75
  onClose(event);
75
76
  }
76
77
  };
78
+
79
+ // Slug is always size `md` and `inline`
80
+ let normalizedSlug;
81
+ if (slug && slug['type']?.displayName === 'Slug') {
82
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
83
+ size: 'sm',
84
+ kind: 'inline'
85
+ });
86
+ }
77
87
  if (filter) {
78
88
  const ComponentTag = BaseComponent ?? 'div';
79
89
  return /*#__PURE__*/React__default["default"].createElement(ComponentTag, _rollupPluginBabelHelpers["extends"]({
80
90
  className: tagClasses,
81
91
  id: tagId
82
- }, other), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
92
+ }, other), CustomIconElement ? /*#__PURE__*/React__default["default"].createElement("div", {
93
+ className: `${prefix}--tag__custom-icon`
94
+ }, /*#__PURE__*/React__default["default"].createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default["default"].createElement(Text.Text, {
83
95
  className: `${prefix}--tag__label`,
84
96
  title: typeof children === 'string' ? children : undefined
85
- }, children !== null && children !== undefined ? children : typeText), /*#__PURE__*/React__default["default"].createElement("button", {
97
+ }, children !== null && children !== undefined ? children : typeText), normalizedSlug, /*#__PURE__*/React__default["default"].createElement("button", {
86
98
  type: "button",
87
99
  className: `${prefix}--tag__close-icon`,
88
100
  onClick: handleClose,
@@ -100,7 +112,7 @@ const Tag = _ref => {
100
112
  className: `${prefix}--tag__custom-icon`
101
113
  }, /*#__PURE__*/React__default["default"].createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default["default"].createElement(Text.Text, {
102
114
  title: typeof children === 'string' ? children : undefined
103
- }, children !== null && children !== undefined ? children : typeText));
115
+ }, children !== null && children !== undefined ? children : typeText), normalizedSlug);
104
116
  };
105
117
  Tag.propTypes = {
106
118
  /**
@@ -109,7 +121,7 @@ Tag.propTypes = {
109
121
  */
110
122
  as: PropTypes__default["default"].elementType,
111
123
  /**
112
- * Provide content to be rendered inside of a <Tag>
124
+ * Provide content to be rendered inside of a `Tag`
113
125
  */
114
126
  children: PropTypes__default["default"].node,
115
127
  /**
@@ -117,11 +129,11 @@ Tag.propTypes = {
117
129
  */
118
130
  className: PropTypes__default["default"].string,
119
131
  /**
120
- * Specify if the <Tag> is disabled
132
+ * Specify if the `Tag` is disabled
121
133
  */
122
134
  disabled: PropTypes__default["default"].bool,
123
135
  /**
124
- * Determine if <Tag> is a filter/chip
136
+ * Determine if `Tag` is a filter/chip
125
137
  */
126
138
  filter: PropTypes__default["default"].bool,
127
139
  /**
@@ -142,12 +154,16 @@ Tag.propTypes = {
142
154
  * 'md' (default) sizes.
143
155
  */
144
156
  size: PropTypes__default["default"].oneOf(['sm', 'md']),
157
+ /**
158
+ * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
159
+ */
160
+ slug: PropTypes__default["default"].node,
145
161
  /**
146
162
  * Text to show on clear filters
147
163
  */
148
164
  title: PropTypes__default["default"].string,
149
165
  /**
150
- * Specify the type of the <Tag>
166
+ * Specify the type of the `Tag`
151
167
  */
152
168
  type: PropTypes__default["default"].oneOf(Object.keys(TYPES))
153
169
  };
@@ -236,7 +236,7 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
236
236
 
237
237
  // Slug is always size `mini`
238
238
  let normalizedSlug;
239
- if (slug) {
239
+ if (slug && slug['type']?.displayName === 'Slug') {
240
240
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
241
241
  size: 'mini'
242
242
  });
@@ -167,7 +167,7 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
167
167
 
168
168
  // Slug is always size `mini`
169
169
  let normalizedSlug;
170
- if (slug) {
170
+ if (slug && slug['type']?.displayName === 'Slug') {
171
171
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
172
172
  size: 'mini'
173
173
  });
@@ -279,7 +279,7 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
279
279
  // Slug is always size `xs`
280
280
  const slugRef = React.useRef(null);
281
281
  let normalizedSlug;
282
- if (slug) {
282
+ if (slug && slug['type']?.displayName === 'Slug') {
283
283
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
284
284
  size: 'xs',
285
285
  ref: slugRef
@@ -504,7 +504,7 @@ const ExpandableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
504
504
 
505
505
  // Slug is always size `xs`
506
506
  let normalizedSlug;
507
- if (slug) {
507
+ if (slug && slug['type']?.displayName === 'Slug') {
508
508
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
509
509
  size: 'xs'
510
510
  });
@@ -70,7 +70,7 @@ const Switcher = /*#__PURE__*/React.forwardRef(function Switcher(props, forwardR
70
70
  switcherItem.focus();
71
71
  }
72
72
  };
73
- const childrenWithProps = React__default["default"].Children.map(children, (child, index) => {
73
+ const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) => {
74
74
  // only setup click handlers if onChange event is passed
75
75
  if ( /*#__PURE__*/React__default["default"].isValidElement(child) && child.type && getDisplayName["default"](child.type) === 'Switcher') {
76
76
  return /*#__PURE__*/React__default["default"].cloneElement(child, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.45.0-rc.0",
4
+ "version": "1.45.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -48,9 +48,9 @@
48
48
  "dependencies": {
49
49
  "@babel/runtime": "^7.18.3",
50
50
  "@carbon/feature-flags": "^0.16.0",
51
- "@carbon/icons-react": "^11.32.0-rc.0",
51
+ "@carbon/icons-react": "^11.32.0",
52
52
  "@carbon/layout": "^11.20.0",
53
- "@carbon/styles": "^1.45.0-rc.0",
53
+ "@carbon/styles": "^1.45.0",
54
54
  "@carbon/telemetry": "0.1.0",
55
55
  "classnames": "2.3.2",
56
56
  "copy-to-clipboard": "^3.3.1",
@@ -137,5 +137,5 @@
137
137
  "**/*.scss",
138
138
  "**/*.css"
139
139
  ],
140
- "gitHead": "451ce652bb9e0fcd30fc28a41ddee1a1daedfd34"
140
+ "gitHead": "670dffcae241d9bf9b3a64ea06e100e7e5a08c37"
141
141
  }