@carbon/ibm-products 2.43.2-canary.105 → 2.43.2-canary.109
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/Card/Card.d.ts +68 -2
- package/es/components/Card/Card.js +28 -35
- package/es/components/Card/CardFooter.d.ts +51 -48
- package/es/components/Card/CardFooter.js +4 -2
- package/es/components/Card/CardHeader.d.ts +67 -49
- package/es/components/Card/CardHeader.js +4 -2
- package/es/components/GetStartedCard/GetStartedCard.d.ts +6 -7
- package/es/components/GetStartedCard/GetStartedCard.js +2 -2
- package/es/components/UserAvatar/UserAvatar.d.ts +59 -1
- package/es/components/UserAvatar/UserAvatar.js +7 -23
- package/lib/components/Card/Card.d.ts +68 -2
- package/lib/components/Card/Card.js +28 -35
- package/lib/components/Card/CardFooter.d.ts +51 -48
- package/lib/components/Card/CardFooter.js +4 -2
- package/lib/components/Card/CardHeader.d.ts +67 -49
- package/lib/components/Card/CardHeader.js +4 -2
- package/lib/components/GetStartedCard/GetStartedCard.d.ts +6 -7
- package/lib/components/GetStartedCard/GetStartedCard.js +2 -2
- package/lib/components/UserAvatar/UserAvatar.d.ts +59 -1
- package/lib/components/UserAvatar/UserAvatar.js +7 -23
- package/package.json +2 -2
@@ -49,7 +49,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
49
49
|
slug = _ref.slug,
|
50
50
|
title = _ref.title,
|
51
51
|
_ref$titleSize = _ref.titleSize,
|
52
|
-
titleSize = _ref$titleSize === void 0 ?
|
52
|
+
titleSize = _ref$titleSize === void 0 ? 'default' : _ref$titleSize;
|
53
53
|
var carbonPrefix = react.usePrefix();
|
54
54
|
var blockClass = "".concat(settings.pkg.prefix, "--card");
|
55
55
|
var headerClass = "".concat(blockClass, "__header");
|
@@ -72,7 +72,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
72
72
|
d: "M13.2436 16H11.5996L10.9276 13.864H7.95164L7.29164 16H5.68364L8.49164 7.624H10.4596L13.2436 16ZM10.5436 12.508L9.46364 9.064H9.40364L8.33564 12.508H10.5436ZM17.9341 16H14.1301V14.728H15.2341V8.896H14.1301V7.624H17.9341V8.896H16.8181V14.728H17.9341V16Z",
|
73
73
|
fill: "#161616"
|
74
74
|
})));
|
75
|
-
var normalizedSlug;
|
75
|
+
var normalizedSlug = null;
|
76
76
|
if (slug) {
|
77
77
|
if (inClickableCard || typeof slug === 'boolean') {
|
78
78
|
normalizedSlug = hollowSlugIcon;
|
@@ -113,6 +113,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
113
113
|
disabled: primaryButtonDisabled
|
114
114
|
}, primaryButtonText)), normalizedSlug));
|
115
115
|
};
|
116
|
+
/**@ts-ignore */
|
116
117
|
CardHeader.propTypes = {
|
117
118
|
actions: index["default"].oneOfType([index["default"].array, index["default"].node]),
|
118
119
|
description: index["default"].oneOfType([index["default"].string, index["default"].object, index["default"].node]),
|
@@ -143,6 +144,7 @@ CardHeader.propTypes = {
|
|
143
144
|
title: index["default"].oneOfType([index["default"].string, index["default"].object, index["default"].node]),
|
144
145
|
titleSize: index["default"].oneOf(['default', 'large'])
|
145
146
|
};
|
147
|
+
/**@ts-ignore */
|
146
148
|
CardHeader.displayName = componentName;
|
147
149
|
|
148
150
|
exports.CardHeader = CardHeader;
|
@@ -5,10 +5,9 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
import React, { PropsWithChildren, ReactNode } from 'react';
|
8
|
-
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
9
8
|
type MetaData = {
|
10
9
|
id?: string;
|
11
|
-
icon?: () =>
|
10
|
+
icon?: () => ReactNode;
|
12
11
|
iconDescription?: string;
|
13
12
|
};
|
14
13
|
interface GetStartedCardProps extends PropsWithChildren {
|
@@ -23,11 +22,11 @@ interface GetStartedCardProps extends PropsWithChildren {
|
|
23
22
|
/**
|
24
23
|
* Provides the action icon that's displayed at the footer of the card
|
25
24
|
*/
|
26
|
-
footerActionIcon:
|
25
|
+
footerActionIcon: React.ElementType;
|
27
26
|
/**
|
28
27
|
* Optional label for the top of the card
|
29
28
|
*/
|
30
|
-
label?:
|
29
|
+
label?: ReactNode;
|
31
30
|
/**
|
32
31
|
* Optional media content like an image to be placed in the card
|
33
32
|
*/
|
@@ -35,7 +34,7 @@ interface GetStartedCardProps extends PropsWithChildren {
|
|
35
34
|
/**
|
36
35
|
* Icons that are displayed on the card showing the time and skill needed
|
37
36
|
*/
|
38
|
-
metadata: MetaData[];
|
37
|
+
metadata: readonly MetaData[];
|
39
38
|
/**
|
40
39
|
* Provides the callback for a clickable card
|
41
40
|
*/
|
@@ -43,7 +42,7 @@ interface GetStartedCardProps extends PropsWithChildren {
|
|
43
42
|
/**
|
44
43
|
* Provides the icon that's displayed at the top of the card
|
45
44
|
*/
|
46
|
-
pictogram?:
|
45
|
+
pictogram?: () => ReactNode;
|
47
46
|
/**
|
48
47
|
* Provides number for card for tasks in a sequential order
|
49
48
|
*/
|
@@ -55,7 +54,7 @@ interface GetStartedCardProps extends PropsWithChildren {
|
|
55
54
|
/**
|
56
55
|
* Title that's displayed at the top of the card
|
57
56
|
*/
|
58
|
-
title?:
|
57
|
+
title?: ReactNode;
|
59
58
|
}
|
60
59
|
/**
|
61
60
|
* GetStartedCard a card with icon, number, and media variants
|
@@ -51,7 +51,7 @@ exports.GetStartedCard.propTypes = {
|
|
51
51
|
/**
|
52
52
|
* Optional label for the top of the card
|
53
53
|
*/
|
54
|
-
label: index["default"].oneOfType([index["default"].string, index["default"].
|
54
|
+
label: index["default"].oneOfType([index["default"].string, index["default"].node]),
|
55
55
|
/**
|
56
56
|
* Optional media content like an image to be placed in the card
|
57
57
|
*/
|
@@ -85,5 +85,5 @@ exports.GetStartedCard.propTypes = {
|
|
85
85
|
/**
|
86
86
|
* Title that's displayed at the top of the card
|
87
87
|
*/
|
88
|
-
title: index["default"].oneOfType([index["default"].string, index["default"].
|
88
|
+
title: index["default"].oneOfType([index["default"].string, index["default"].node])
|
89
89
|
};
|
@@ -1,2 +1,60 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024, 2024
|
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
|
+
*/
|
2
7
|
import React from 'react';
|
8
|
+
import '../../global/js/utils/props-helper';
|
9
|
+
/**
|
10
|
+
* TODO: A description of the component.
|
11
|
+
*/
|
12
|
+
type BackgroundColor = 'order-1-cyan' | 'order-2-gray' | 'order-3-green' | 'order-4-magenta' | 'order-5-purple' | 'order-6-teal' | 'order-7-cyan' | 'order-8-gray' | 'order-9-green' | 'order-10-magenta' | 'order-11-purple' | 'order-12-teal';
|
13
|
+
type Size = 'xl' | 'lg' | 'md' | 'sm';
|
14
|
+
type TooltipAlignment = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
|
15
|
+
type ImageProps = {
|
16
|
+
/**
|
17
|
+
* When passing the image prop, supply a full path to the image to be displayed.
|
18
|
+
*/
|
19
|
+
image: string;
|
20
|
+
/**
|
21
|
+
* When passing the image prop use the imageDescription prop to describe the image for screen reader.
|
22
|
+
*/
|
23
|
+
imageDescription: string;
|
24
|
+
} | {
|
25
|
+
image?: never;
|
26
|
+
imageDescription?: never;
|
27
|
+
};
|
28
|
+
type UserAvatarBaseProps = {
|
29
|
+
/**
|
30
|
+
* Provide the background color need to be set for UserAvatar.
|
31
|
+
*/
|
32
|
+
backgroundColor?: BackgroundColor;
|
33
|
+
/**
|
34
|
+
* Provide an optional class to be applied to the containing node.
|
35
|
+
*/
|
36
|
+
className?: string;
|
37
|
+
/**
|
38
|
+
* When passing the name prop, either send the initials to be used or the user's full name. The first two capital letters of the user's name will be used as the name.
|
39
|
+
*/
|
40
|
+
name?: string;
|
41
|
+
/**
|
42
|
+
* Provide a custom icon to use if you need to use an icon other than the default one
|
43
|
+
*/
|
44
|
+
renderIcon?: React.ElementType;
|
45
|
+
/**
|
46
|
+
* Set the size of the avatar circle
|
47
|
+
*/
|
48
|
+
size?: Size;
|
49
|
+
/**
|
50
|
+
* Specify how the trigger should align with the tooltip
|
51
|
+
*/
|
52
|
+
tooltipAlignment?: TooltipAlignment;
|
53
|
+
/**
|
54
|
+
* Pass in the display name to have it shown on hover
|
55
|
+
*/
|
56
|
+
tooltipText?: string;
|
57
|
+
};
|
58
|
+
type UserAvatarProps = UserAvatarBaseProps & ImageProps;
|
59
|
+
export declare let UserAvatar: React.ForwardRefExoticComponent<UserAvatarProps & React.RefAttributes<HTMLDivElement>>;
|
60
|
+
export {};
|
@@ -35,42 +35,23 @@ var componentName = 'UserAvatar';
|
|
35
35
|
|
36
36
|
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
37
37
|
|
38
|
-
// Default values can be included here and then assigned to the prop params,
|
39
|
-
// e.g. prop = defaults.prop,
|
40
|
-
// This gathers default values together neatly and ensures non-primitive
|
41
|
-
// values are initialized early to avoid react making unnecessary re-renders.
|
42
|
-
// Note that default values are not required for props that are 'required',
|
43
|
-
// nor for props where the component can apply undefined values reasonably.
|
44
|
-
// Default values should be provided when the component needs to make a choice
|
45
|
-
// or assumption when a prop is not supplied.
|
46
|
-
|
47
|
-
// Default values for props
|
48
|
-
// const defaults = {
|
49
|
-
// /* TODO: add defaults for relevant props if needed */
|
50
|
-
// };
|
51
|
-
|
52
38
|
/**
|
53
39
|
* TODO: A description of the component.
|
54
40
|
*/
|
55
41
|
|
56
|
-
var defaults = {
|
57
|
-
size: 'md',
|
58
|
-
tooltipAlignment: 'bottom',
|
59
|
-
backgroundColor: 'order-1-cyan'
|
60
|
-
};
|
61
42
|
exports.UserAvatar = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
62
43
|
var _ref$backgroundColor = _ref.backgroundColor,
|
63
|
-
backgroundColor = _ref$backgroundColor === void 0 ?
|
44
|
+
backgroundColor = _ref$backgroundColor === void 0 ? 'order-1-cyan' : _ref$backgroundColor,
|
64
45
|
className = _ref.className,
|
65
46
|
image = _ref.image,
|
66
47
|
imageDescription = _ref.imageDescription,
|
67
48
|
name = _ref.name,
|
68
49
|
RenderIcon = _ref.renderIcon,
|
69
50
|
_ref$size = _ref.size,
|
70
|
-
size = _ref$size === void 0 ?
|
51
|
+
size = _ref$size === void 0 ? 'md' : _ref$size,
|
71
52
|
tooltipText = _ref.tooltipText,
|
72
53
|
_ref$tooltipAlignment = _ref.tooltipAlignment,
|
73
|
-
tooltipAlignment = _ref$tooltipAlignment === void 0 ?
|
54
|
+
tooltipAlignment = _ref$tooltipAlignment === void 0 ? 'bottom' : _ref$tooltipAlignment,
|
74
55
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
75
56
|
var carbonPrefix = react.usePrefix();
|
76
57
|
var iconSize = {
|
@@ -81,7 +62,7 @@ exports.UserAvatar = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
81
62
|
};
|
82
63
|
var formatInitials = function formatInitials() {
|
83
64
|
var _ref2;
|
84
|
-
var parts = name.split(' ');
|
65
|
+
var parts = (name === null || name === void 0 ? void 0 : name.split(' ')) || [];
|
85
66
|
var firstChar = parts[0].charAt(0).toUpperCase();
|
86
67
|
var secondChar = parts[0].charAt(1).toUpperCase();
|
87
68
|
if (parts.length === 1) {
|
@@ -161,10 +142,12 @@ exports.UserAvatar.propTypes = {
|
|
161
142
|
/**
|
162
143
|
* When passing the image prop, supply a full path to the image to be displayed.
|
163
144
|
*/
|
145
|
+
/**@ts-ignore */
|
164
146
|
image: index["default"].string,
|
165
147
|
/**
|
166
148
|
* When passing the image prop use the imageDescription prop to describe the image for screen reader.
|
167
149
|
*/
|
150
|
+
/**@ts-ignore */
|
168
151
|
imageDescription: index["default"].string.isRequired.if(function (_ref3) {
|
169
152
|
var image = _ref3.image;
|
170
153
|
return !!image;
|
@@ -176,6 +159,7 @@ exports.UserAvatar.propTypes = {
|
|
176
159
|
/**
|
177
160
|
* Provide a custom icon to use if you need to use an icon other than the default one
|
178
161
|
*/
|
162
|
+
/**@ts-ignore */
|
179
163
|
renderIcon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
180
164
|
/**
|
181
165
|
* Set the size of the avatar circle
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.43.2-canary.
|
4
|
+
"version": "2.43.2-canary.109+c90b45fa1",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -120,5 +120,5 @@
|
|
120
120
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
121
121
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
122
122
|
},
|
123
|
-
"gitHead": "
|
123
|
+
"gitHead": "c90b45fa16ad6d01e28b6f94f511271a5c74061c"
|
124
124
|
}
|