@carbon-labs/react-animated-header 0.30.0 → 0.32.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.
- package/assets/animated/{header_1312x738_data_fabric_dark_06.json → header_animated_data_fabric_dark_06.json} +1 -1
- package/assets/animated/{header_1312x738_data_fabric_light_03.json → header_animated_data_fabric_light_03.json} +1 -1
- package/assets/animated/header_animated_watsonx_a_dark_06.json +1 -0
- package/assets/animated/header_animated_watsonx_a_light_06.json +1 -0
- package/assets/animated/header_animated_watsonx_data_dark_03.json +1 -0
- package/assets/animated/header_animated_watsonx_data_light_04.json +1 -0
- package/assets/animated/header_animated_wxbia_dark_06.json +1 -0
- package/assets/animated/header_animated_wxbia_light_09.json +1 -0
- package/assets/index.js +44 -14
- package/assets/static/{illustration_data_fabric_dark_05.svg → header_static_data_fabric_dark_06.svg} +3 -3
- package/assets/static/{illustration_data_fabric_light_04.svg → header_static_data_fabric_light_06.svg} +9 -13
- package/assets/static/header_static_db2_dark_02.svg +88 -0
- package/assets/static/header_static_db2_light_02.svg +44 -0
- package/assets/static/header_static_watsonx_a_dark_01.svg +99 -0
- package/assets/static/header_static_watsonx_a_light_01.svg +99 -0
- package/assets/static/header_static_watsonx_data_dark_05.svg +43 -0
- package/assets/static/header_static_watsonx_data_light_06.svg +46 -0
- package/assets/static/header_static_wxbia_dark_01.svg +69 -0
- package/assets/static/header_static_wxbia_light_01.svg +69 -0
- package/es/__stories__/AnimatedHeader.stories.d.ts +4024 -2752
- package/es/__stories__/data/index.d.ts +52 -225
- package/es/_virtual/lottie.js +1 -1
- package/es/assets/animated/{header_1312x738_data_fabric_dark_06.json.js → header_animated_data_fabric_dark_06.json.js} +2 -2
- package/es/assets/animated/{header_1312x738_data_fabric_light_03.json.js → header_animated_data_fabric_light_03.json.js} +2 -2
- package/es/assets/animated/header_animated_watsonx_a_dark_06.json.js +10 -0
- package/es/assets/animated/header_animated_watsonx_a_light_06.json.js +10 -0
- package/es/assets/animated/header_animated_watsonx_data_dark_03.json.js +10 -0
- package/es/assets/animated/header_animated_watsonx_data_light_04.json.js +10 -0
- package/es/assets/animated/header_animated_wxbia_dark_06.json.js +10 -0
- package/es/assets/animated/header_animated_wxbia_light_09.json.js +10 -0
- package/es/assets/index.d.ts +9 -7
- package/es/assets/static/header_static_data_fabric_dark_06.svg.js +10 -0
- package/es/assets/static/header_static_data_fabric_light_06.svg.js +10 -0
- package/es/assets/static/header_static_db2_dark_02.svg.js +10 -0
- package/es/assets/static/header_static_db2_light_02.svg.js +10 -0
- package/es/assets/static/header_static_watsonx_a_dark_01.svg.js +10 -0
- package/es/assets/static/header_static_watsonx_a_light_01.svg.js +10 -0
- package/es/assets/static/header_static_watsonx_data_dark_05.svg.js +10 -0
- package/es/assets/static/header_static_watsonx_data_light_06.svg.js +10 -0
- package/es/assets/static/header_static_wxbia_dark_01.svg.js +10 -0
- package/es/assets/static/header_static_wxbia_light_01.svg.js +10 -0
- package/es/components/AnimatedHeader/AnimatedHeader.d.ts +11 -27
- package/es/components/AnimatedHeader/AnimatedHeader.js +61 -44
- package/es/components/AnimatedHeader/types.d.ts +24 -0
- package/es/components/HeaderTitle/HeaderTitle.d.ts +1 -1
- package/es/components/TasksController/TasksController.d.ts +1 -1
- package/es/components/Tiles/AIPromptTile/AIPromptTile.d.ts +10 -11
- package/es/components/Tiles/AIPromptTile/AIPromptTile.js +12 -14
- package/es/components/Tiles/AITile/AITile.d.ts +26 -0
- package/es/components/Tiles/AITile/AITile.js +65 -0
- package/es/components/Tiles/AITile/AITileBody.d.ts +19 -0
- package/es/components/Tiles/AITile/AITileBody.js +59 -0
- package/es/components/Tiles/BaseTile/BaseTile.d.ts +15 -18
- package/es/components/Tiles/BaseTile/BaseTile.js +34 -4
- package/es/components/Tiles/GlassTile/GlassTile.d.ts +13 -9
- package/es/components/Tiles/GlassTile/GlassTile.js +13 -15
- package/es/components/Tiles/GlassTile/GlassTileBody.d.ts +4 -4
- package/es/components/Tiles/GlassTile/GlassTileBody.js +4 -4
- package/es/components/Tiles/index.d.ts +2 -1
- package/es/index.d.ts +3 -2
- package/es/index.js +18 -10
- package/es/node_modules/lottie-web/build/player/lottie.js +194 -193
- package/lib/__stories__/AnimatedHeader.stories.d.ts +4024 -2752
- package/lib/__stories__/data/index.d.ts +52 -225
- package/lib/_virtual/lottie.js +1 -1
- package/lib/assets/animated/{header_1312x738_data_fabric_dark_06.json.js → header_animated_data_fabric_dark_06.json.js} +2 -2
- package/lib/assets/animated/{header_1312x738_data_fabric_light_03.json.js → header_animated_data_fabric_light_03.json.js} +2 -2
- package/lib/assets/animated/header_animated_watsonx_a_dark_06.json.js +26 -0
- package/lib/assets/animated/header_animated_watsonx_a_light_06.json.js +26 -0
- package/lib/assets/animated/header_animated_watsonx_data_dark_03.json.js +26 -0
- package/lib/assets/animated/header_animated_watsonx_data_light_04.json.js +26 -0
- package/lib/assets/animated/header_animated_wxbia_dark_06.json.js +26 -0
- package/lib/assets/animated/header_animated_wxbia_light_09.json.js +26 -0
- package/lib/assets/index.d.ts +9 -7
- package/lib/assets/static/header_static_data_fabric_dark_06.svg.js +14 -0
- package/lib/assets/static/header_static_data_fabric_light_06.svg.js +14 -0
- package/lib/assets/static/header_static_db2_dark_02.svg.js +14 -0
- package/lib/assets/static/header_static_db2_light_02.svg.js +14 -0
- package/lib/assets/static/header_static_watsonx_a_dark_01.svg.js +14 -0
- package/lib/assets/static/header_static_watsonx_a_light_01.svg.js +14 -0
- package/lib/assets/static/header_static_watsonx_data_dark_05.svg.js +14 -0
- package/lib/assets/static/header_static_watsonx_data_light_06.svg.js +14 -0
- package/lib/assets/static/header_static_wxbia_dark_01.svg.js +14 -0
- package/lib/assets/static/header_static_wxbia_light_01.svg.js +14 -0
- package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +11 -27
- package/lib/components/AnimatedHeader/AnimatedHeader.js +61 -44
- package/lib/components/AnimatedHeader/types.d.ts +24 -0
- package/lib/components/HeaderTitle/HeaderTitle.d.ts +1 -1
- package/lib/components/TasksController/TasksController.d.ts +1 -1
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.d.ts +10 -11
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.js +12 -14
- package/lib/components/Tiles/AITile/AITile.d.ts +26 -0
- package/lib/components/Tiles/AITile/AITile.js +70 -0
- package/lib/components/Tiles/AITile/AITileBody.d.ts +19 -0
- package/lib/components/Tiles/AITile/AITileBody.js +61 -0
- package/lib/components/Tiles/BaseTile/BaseTile.d.ts +15 -18
- package/lib/components/Tiles/BaseTile/BaseTile.js +34 -4
- package/lib/components/Tiles/GlassTile/GlassTile.d.ts +13 -9
- package/lib/components/Tiles/GlassTile/GlassTile.js +13 -15
- package/lib/components/Tiles/GlassTile/GlassTileBody.d.ts +4 -4
- package/lib/components/Tiles/GlassTile/GlassTileBody.js +4 -4
- package/lib/components/Tiles/index.d.ts +2 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +36 -20
- package/lib/node_modules/lottie-web/build/player/lottie.js +194 -193
- package/package.json +2 -2
- package/scss/Tiles/AITile/ai-tile.scss +222 -0
- package/scss/animated-header.scss +1 -0
- package/assets/animated/header_1312x738_watsonx_data_dark_02.json +0 -1
- package/assets/animated/header_1312x738_watsonx_data_light_03.json +0 -1
- package/assets/animated/header_illustration_container_watsonx_a_dark_06.json +0 -1
- package/assets/animated/header_illustration_container_watsonx_a_light_06.json +0 -1
- package/assets/animated/header_illustration_container_wxbia_dark_05.json +0 -1
- package/assets/animated/header_illustration_container_wxbia_light_08.json +0 -1
- package/assets/static/illustration_data_fabric_dark_03.svg +0 -199
- package/assets/static/illustration_data_fabric_light_03.svg +0 -200
- package/assets/static/illustration_watson_x_data_dark_03.svg +0 -72
- package/assets/static/illustration_watson_x_data_light_03.svg +0 -57
- package/es/assets/animated/header_1312x738_watsonx_data_dark_02.json.js +0 -10
- package/es/assets/animated/header_1312x738_watsonx_data_light_03.json.js +0 -10
- package/es/assets/animated/header_illustration_container_wxbia_dark_05.json.js +0 -10
- package/es/assets/animated/header_illustration_container_wxbia_light_08.json.js +0 -10
- package/es/assets/static/illustration_data_fabric_dark_05.svg.js +0 -10
- package/es/assets/static/illustration_data_fabric_light_04.svg.js +0 -10
- package/es/assets/static/illustration_watson_x_data_dark_03.svg.js +0 -10
- package/es/assets/static/illustration_watson_x_data_light_03.svg.js +0 -10
- package/lib/assets/animated/header_1312x738_watsonx_data_dark_02.json.js +0 -26
- package/lib/assets/animated/header_1312x738_watsonx_data_light_03.json.js +0 -26
- package/lib/assets/animated/header_illustration_container_wxbia_dark_05.json.js +0 -26
- package/lib/assets/animated/header_illustration_container_wxbia_light_08.json.js +0 -26
- package/lib/assets/static/illustration_data_fabric_dark_05.svg.js +0 -14
- package/lib/assets/static/illustration_data_fabric_light_04.svg.js +0 -14
- package/lib/assets/static/illustration_watson_x_data_dark_03.svg.js +0 -14
- package/lib/assets/static/illustration_watson_x_data_light_03.svg.js +0 -14
|
@@ -13,21 +13,19 @@ var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePref
|
|
|
13
13
|
var icons = require('@carbon/react/icons');
|
|
14
14
|
|
|
15
15
|
var _AILabel, _Send;
|
|
16
|
-
|
|
17
|
-
/** Primary UI component for user interaction */
|
|
18
|
-
|
|
19
16
|
const AIPromptTile = ({
|
|
17
|
+
tileId,
|
|
20
18
|
href,
|
|
21
|
-
id,
|
|
22
|
-
mainIcon: MainIcon,
|
|
23
|
-
open,
|
|
24
|
-
productName,
|
|
25
19
|
title,
|
|
26
|
-
isLoading,
|
|
27
|
-
isDisabled,
|
|
28
20
|
disabledTaskLabel,
|
|
21
|
+
productName,
|
|
22
|
+
promptPlaceholder = 'Start chatting...',
|
|
23
|
+
primaryIcon: PrimaryIcon,
|
|
29
24
|
onClick,
|
|
30
|
-
ariaLabel
|
|
25
|
+
ariaLabel,
|
|
26
|
+
open,
|
|
27
|
+
isLoading,
|
|
28
|
+
isDisabled
|
|
31
29
|
}) => {
|
|
32
30
|
const prefix = usePrefix.usePrefix();
|
|
33
31
|
const blockClass = `${prefix}--animated-header__ai-prompt-tile`;
|
|
@@ -54,7 +52,7 @@ const AIPromptTile = ({
|
|
|
54
52
|
"aria-label": ariaLabel ?? title ?? 'AI Tile',
|
|
55
53
|
role: "listitem",
|
|
56
54
|
title: isDisabled ? disabledTaskLabel ?? '' : '',
|
|
57
|
-
key:
|
|
55
|
+
key: tileId
|
|
58
56
|
}, isLoading ? /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
|
|
59
57
|
className: `${blockClass}--loading-skeleton`
|
|
60
58
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
@@ -65,13 +63,13 @@ const AIPromptTile = ({
|
|
|
65
63
|
className: `${blockClass}--body-gradient`
|
|
66
64
|
}), /*#__PURE__*/React.createElement("div", {
|
|
67
65
|
className: `${blockClass}--icons`
|
|
68
|
-
},
|
|
66
|
+
}, PrimaryIcon && /*#__PURE__*/React.createElement(PrimaryIcon, {
|
|
69
67
|
fill: `var(--cds-icon-secondary)`,
|
|
70
68
|
size: 24
|
|
71
69
|
}), _AILabel || (_AILabel = /*#__PURE__*/React.createElement(react.AILabel, {
|
|
72
70
|
autoAlign: true,
|
|
73
71
|
aiText: "AI",
|
|
74
|
-
size: "
|
|
72
|
+
size: "xs"
|
|
75
73
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
76
74
|
className: `${blockClass}--title`
|
|
77
75
|
}, title), /*#__PURE__*/React.createElement("div", {
|
|
@@ -82,7 +80,7 @@ const AIPromptTile = ({
|
|
|
82
80
|
type: "text",
|
|
83
81
|
labelText: "AI Chat Input",
|
|
84
82
|
hideLabel: true,
|
|
85
|
-
placeholder:
|
|
83
|
+
placeholder: promptPlaceholder,
|
|
86
84
|
size: "sm",
|
|
87
85
|
onChange: handleTextInput,
|
|
88
86
|
onKeyDown: handleTextInputKeyDown,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import React, { ElementType } from 'react';
|
|
10
|
+
export type AITileProps = {
|
|
11
|
+
tileId: string | null;
|
|
12
|
+
href?: string | null;
|
|
13
|
+
title?: string | null;
|
|
14
|
+
subtitle?: string | null;
|
|
15
|
+
disabledTaskLabel?: string | null;
|
|
16
|
+
customContent?: React.ReactNode | null;
|
|
17
|
+
primaryIcon?: ElementType | null;
|
|
18
|
+
secondaryIcon?: ElementType | null;
|
|
19
|
+
onClick?: (() => void) | null;
|
|
20
|
+
ariaLabel?: string;
|
|
21
|
+
open?: boolean;
|
|
22
|
+
isLoading?: boolean;
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
} & Record<string, unknown>;
|
|
25
|
+
export declare const AITile: React.FC<AITileProps>;
|
|
26
|
+
export default AITile;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 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
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var React = require('react');
|
|
13
|
+
var react = require('@carbon/react');
|
|
14
|
+
var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
15
|
+
var AITileBody = require('./AITileBody.js');
|
|
16
|
+
|
|
17
|
+
const AITile = ({
|
|
18
|
+
tileId,
|
|
19
|
+
href,
|
|
20
|
+
title,
|
|
21
|
+
subtitle,
|
|
22
|
+
disabledTaskLabel,
|
|
23
|
+
customContent,
|
|
24
|
+
primaryIcon: PrimaryIcon,
|
|
25
|
+
secondaryIcon: SecondaryIcon,
|
|
26
|
+
onClick: aiTileClickHandler,
|
|
27
|
+
ariaLabel,
|
|
28
|
+
open,
|
|
29
|
+
isLoading,
|
|
30
|
+
isDisabled
|
|
31
|
+
}) => {
|
|
32
|
+
const prefix = usePrefix.usePrefix();
|
|
33
|
+
const blockClass = `${prefix}--animated-header__ai-tile`;
|
|
34
|
+
const body = /*#__PURE__*/React.createElement(AITileBody.AITileBody, {
|
|
35
|
+
open: open,
|
|
36
|
+
primaryIcon: PrimaryIcon,
|
|
37
|
+
secondaryIcon: SecondaryIcon,
|
|
38
|
+
title: title,
|
|
39
|
+
subtitle: subtitle,
|
|
40
|
+
customContent: customContent,
|
|
41
|
+
isLoading: isLoading
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Non-interactive tile
|
|
45
|
+
if (!href && !aiTileClickHandler) {
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
48
|
+
key: tileId,
|
|
49
|
+
"aria-label": ariaLabel ?? title ?? 'AI Tile',
|
|
50
|
+
title: isDisabled ? disabledTaskLabel ?? '' : '',
|
|
51
|
+
tabIndex: -1
|
|
52
|
+
}, body);
|
|
53
|
+
}
|
|
54
|
+
return /*#__PURE__*/React.createElement(react.Link, {
|
|
55
|
+
onClick: () => {
|
|
56
|
+
aiTileClickHandler?.();
|
|
57
|
+
},
|
|
58
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
59
|
+
"aria-label": ariaLabel ?? title ?? 'AI Tile',
|
|
60
|
+
role: "listitem",
|
|
61
|
+
tabIndex: isDisabled || isLoading ? -1 : 0,
|
|
62
|
+
key: tileId,
|
|
63
|
+
href: href ?? undefined,
|
|
64
|
+
disabled: isDisabled || isLoading,
|
|
65
|
+
title: isDisabled ? disabledTaskLabel ?? '' : ''
|
|
66
|
+
}, body);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.AITile = AITile;
|
|
70
|
+
exports.default = AITile;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import { ElementType, ReactNode } from 'react';
|
|
10
|
+
export type AITileBodyProps = {
|
|
11
|
+
open?: boolean;
|
|
12
|
+
title?: string | null;
|
|
13
|
+
subtitle?: string | null;
|
|
14
|
+
customContent?: ReactNode;
|
|
15
|
+
primaryIcon?: ElementType | null;
|
|
16
|
+
secondaryIcon?: ElementType | null;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare const AITileBody: ({ open, title, subtitle, customContent, primaryIcon: PrimaryIcon, secondaryIcon: SecondaryIcon, isLoading, }: AITileBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 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
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var React = require('react');
|
|
11
|
+
var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
12
|
+
var react = require('@carbon/react');
|
|
13
|
+
|
|
14
|
+
var _AILabel;
|
|
15
|
+
const AITileBody = ({
|
|
16
|
+
open,
|
|
17
|
+
title,
|
|
18
|
+
subtitle,
|
|
19
|
+
customContent,
|
|
20
|
+
primaryIcon: PrimaryIcon,
|
|
21
|
+
secondaryIcon: SecondaryIcon,
|
|
22
|
+
isLoading
|
|
23
|
+
}) => {
|
|
24
|
+
const prefix = usePrefix.usePrefix();
|
|
25
|
+
const blockClass = `${prefix}--animated-header__ai-tile`;
|
|
26
|
+
if (isLoading) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
|
|
28
|
+
className: `${blockClass}--loading-skeleton`
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: `${blockClass}--body`,
|
|
33
|
+
"data-expanded": open
|
|
34
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: `${blockClass}--body-background`
|
|
36
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: `${blockClass}--body-gradient`
|
|
38
|
+
}), customContent ? /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: `${blockClass}--custom-content`
|
|
40
|
+
}, customContent) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: `${blockClass}--icons`
|
|
42
|
+
}, PrimaryIcon && /*#__PURE__*/React.createElement(PrimaryIcon, {
|
|
43
|
+
fill: `var(--cds-icon-secondary)`,
|
|
44
|
+
size: 24
|
|
45
|
+
}), _AILabel || (_AILabel = /*#__PURE__*/React.createElement(react.AILabel, {
|
|
46
|
+
autoAlign: true,
|
|
47
|
+
aiText: "AI",
|
|
48
|
+
size: "xs"
|
|
49
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: `${blockClass}--title`
|
|
51
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: `${blockClass}--footer`
|
|
53
|
+
}, subtitle && /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: `${blockClass}--subtitle`
|
|
55
|
+
}, subtitle), SecondaryIcon && /*#__PURE__*/React.createElement(SecondaryIcon, {
|
|
56
|
+
size: 16,
|
|
57
|
+
fill: `var(--cds-icon-secondary)`
|
|
58
|
+
}))));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.AITileBody = AITileBody;
|
|
@@ -6,23 +6,20 @@
|
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import React
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { type AITileProps } from '../AITile/AITile';
|
|
11
|
+
import { type AIPromptTileProps } from '../AIPromptTile/AIPromptTile';
|
|
12
|
+
import { type GlassTileProps } from '../GlassTile/GlassTile';
|
|
13
|
+
/** Base Tile router */
|
|
14
|
+
export type TileVariant = 'glass' | 'aiPrompt' | 'ai';
|
|
15
|
+
export type BaseTileProps = ({
|
|
16
|
+
variant?: 'glass';
|
|
17
|
+
} & GlassTileProps) | ({
|
|
18
|
+
variant: 'aiPrompt';
|
|
19
|
+
} & AIPromptTileProps) | (({
|
|
20
|
+
variant: 'ai';
|
|
21
|
+
} & AITileProps) & {
|
|
12
22
|
id?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
mainIcon?: ElementType | null;
|
|
16
|
-
secondaryIcon?: ElementType | null;
|
|
17
|
-
title?: string | null;
|
|
18
|
-
subtitle?: string | null;
|
|
19
|
-
productName?: string;
|
|
20
|
-
customContent?: ReactNode;
|
|
21
|
-
isLoading?: boolean;
|
|
22
|
-
isDisabled?: boolean;
|
|
23
|
-
disabledTaskLabel?: string;
|
|
24
|
-
onClick?: (() => void) | null;
|
|
25
|
-
ariaLabel?: string;
|
|
26
|
-
}
|
|
23
|
+
tileId?: string | null;
|
|
24
|
+
});
|
|
27
25
|
export declare const BaseTile: React.FC<BaseTileProps>;
|
|
28
|
-
export {};
|
|
@@ -8,16 +8,46 @@
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
10
|
var React = require('react');
|
|
11
|
+
var AITile = require('../AITile/AITile.js');
|
|
11
12
|
var AIPromptTile = require('../AIPromptTile/AIPromptTile.js');
|
|
12
13
|
var GlassTile = require('../GlassTile/GlassTile.js');
|
|
13
14
|
|
|
14
|
-
/** Base Tile */
|
|
15
|
+
/** Base Tile router */
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
function inferVariant(props) {
|
|
18
|
+
if (props.variant) {
|
|
19
|
+
return props.variant;
|
|
20
|
+
}
|
|
17
21
|
if (props.id === 'ai-tile') {
|
|
18
|
-
return
|
|
22
|
+
return 'aiPrompt';
|
|
23
|
+
}
|
|
24
|
+
return 'glass';
|
|
25
|
+
}
|
|
26
|
+
const BaseTile = props => {
|
|
27
|
+
// Back-compat: alias legacy icon prop to the new name
|
|
28
|
+
const normalizedProps = {
|
|
29
|
+
...props,
|
|
30
|
+
primaryIcon: props.primaryIcon ?? props.mainIcon // ← fallback
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// strip legacy id, but flow it into tileId if needed
|
|
34
|
+
const {
|
|
35
|
+
id: legacyId,
|
|
36
|
+
...rest
|
|
37
|
+
} = normalizedProps;
|
|
38
|
+
const forward = {
|
|
39
|
+
...rest,
|
|
40
|
+
tileId: rest.tileId ?? legacyId
|
|
41
|
+
};
|
|
42
|
+
switch (inferVariant(props)) {
|
|
43
|
+
case 'ai':
|
|
44
|
+
return /*#__PURE__*/React.createElement(AITile.AITile, forward);
|
|
45
|
+
case 'aiPrompt':
|
|
46
|
+
return /*#__PURE__*/React.createElement(AIPromptTile.AIPromptTile, forward);
|
|
47
|
+
case 'glass':
|
|
48
|
+
default:
|
|
49
|
+
return /*#__PURE__*/React.createElement(GlassTile.GlassTile, forward);
|
|
19
50
|
}
|
|
20
|
-
return /*#__PURE__*/React.createElement(GlassTile.GlassTile, props);
|
|
21
51
|
};
|
|
22
52
|
|
|
23
53
|
exports.BaseTile = BaseTile;
|
|
@@ -6,16 +6,20 @@
|
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import React, { ElementType } from 'react';
|
|
10
|
+
export type GlassTileProps = {
|
|
11
|
+
tileId: string | null;
|
|
12
12
|
href?: string | null;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
title?: string | null;
|
|
14
|
+
subtitle?: string | null;
|
|
15
|
+
disabledTaskLabel?: string | null;
|
|
16
|
+
customContent?: React.ReactNode | null;
|
|
17
|
+
primaryIcon?: ElementType | null;
|
|
18
|
+
secondaryIcon?: ElementType | null;
|
|
17
19
|
onClick?: (() => void) | null;
|
|
18
20
|
ariaLabel?: string;
|
|
19
|
-
|
|
21
|
+
open?: boolean;
|
|
22
|
+
isLoading?: boolean;
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
} & Record<string, unknown>;
|
|
20
25
|
export declare const GlassTile: React.FC<GlassTileProps>;
|
|
21
|
-
export {};
|
|
@@ -12,29 +12,27 @@ var react = require('@carbon/react');
|
|
|
12
12
|
var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
13
13
|
var GlassTileBody = require('./GlassTileBody.js');
|
|
14
14
|
|
|
15
|
-
/** Primary UI component for user interaction */
|
|
16
|
-
|
|
17
15
|
const GlassTile = ({
|
|
16
|
+
tileId,
|
|
18
17
|
href,
|
|
19
|
-
id,
|
|
20
|
-
mainIcon,
|
|
21
|
-
open,
|
|
22
|
-
secondaryIcon,
|
|
23
|
-
subtitle,
|
|
24
18
|
title,
|
|
25
|
-
|
|
26
|
-
isLoading,
|
|
27
|
-
isDisabled,
|
|
19
|
+
subtitle,
|
|
28
20
|
disabledTaskLabel,
|
|
21
|
+
customContent,
|
|
22
|
+
primaryIcon: PrimaryIcon,
|
|
23
|
+
secondaryIcon: SecondaryIcon,
|
|
29
24
|
onClick: glassTileClickHandler,
|
|
30
|
-
ariaLabel
|
|
25
|
+
ariaLabel,
|
|
26
|
+
open,
|
|
27
|
+
isLoading,
|
|
28
|
+
isDisabled
|
|
31
29
|
}) => {
|
|
32
30
|
const prefix = usePrefix.usePrefix();
|
|
33
31
|
const blockClass = `${prefix}--animated-header__glass-tile`;
|
|
34
32
|
const body = /*#__PURE__*/React.createElement(GlassTileBody.GlassTileBody, {
|
|
35
|
-
mainIcon: mainIcon,
|
|
36
33
|
open: open,
|
|
37
|
-
|
|
34
|
+
primaryIcon: PrimaryIcon,
|
|
35
|
+
secondaryIcon: SecondaryIcon,
|
|
38
36
|
title: title,
|
|
39
37
|
subtitle: subtitle,
|
|
40
38
|
customContent: customContent,
|
|
@@ -45,7 +43,7 @@ const GlassTile = ({
|
|
|
45
43
|
if (!href && !glassTileClickHandler) {
|
|
46
44
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
45
|
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
48
|
-
key:
|
|
46
|
+
key: tileId,
|
|
49
47
|
"aria-label": ariaLabel ?? title ?? 'Glass Tile',
|
|
50
48
|
title: isDisabled ? disabledTaskLabel ?? '' : '',
|
|
51
49
|
tabIndex: -1
|
|
@@ -59,7 +57,7 @@ const GlassTile = ({
|
|
|
59
57
|
"aria-label": ariaLabel ?? title ?? 'Glass Tile',
|
|
60
58
|
role: "listitem",
|
|
61
59
|
tabIndex: isDisabled || isLoading ? -1 : 0,
|
|
62
|
-
key:
|
|
60
|
+
key: tileId,
|
|
63
61
|
href: href ?? undefined,
|
|
64
62
|
disabled: isDisabled || isLoading,
|
|
65
63
|
title: isDisabled ? disabledTaskLabel ?? '' : ''
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { ElementType, ReactNode } from 'react';
|
|
10
10
|
export type GlassTileBodyProps = {
|
|
11
|
-
mainIcon?: ElementType | null;
|
|
12
11
|
open?: boolean;
|
|
13
|
-
secondaryIcon?: ElementType | null;
|
|
14
|
-
subtitle?: string | null;
|
|
15
12
|
title?: string | null;
|
|
13
|
+
subtitle?: string | null;
|
|
16
14
|
customContent?: ReactNode;
|
|
15
|
+
primaryIcon?: ElementType | null;
|
|
16
|
+
secondaryIcon?: ElementType | null;
|
|
17
17
|
isLoading?: boolean;
|
|
18
18
|
};
|
|
19
|
-
export declare const GlassTileBody: ({
|
|
19
|
+
export declare const GlassTileBody: ({ open, title, subtitle, customContent, primaryIcon: PrimaryIcon, secondaryIcon: SecondaryIcon, isLoading, }: GlassTileBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,12 +12,12 @@ var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePref
|
|
|
12
12
|
var react = require('@carbon/react');
|
|
13
13
|
|
|
14
14
|
const GlassTileBody = ({
|
|
15
|
-
mainIcon: MainIcon,
|
|
16
15
|
open,
|
|
17
|
-
secondaryIcon: SecondaryIcon,
|
|
18
|
-
subtitle,
|
|
19
16
|
title,
|
|
17
|
+
subtitle,
|
|
20
18
|
customContent,
|
|
19
|
+
primaryIcon: PrimaryIcon,
|
|
20
|
+
secondaryIcon: SecondaryIcon,
|
|
21
21
|
isLoading
|
|
22
22
|
}) => {
|
|
23
23
|
const prefix = usePrefix.usePrefix();
|
|
@@ -36,7 +36,7 @@ const GlassTileBody = ({
|
|
|
36
36
|
className: `${blockClass}--custom-content`
|
|
37
37
|
}, customContent) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
38
38
|
className: `${blockClass}--icons`
|
|
39
|
-
},
|
|
39
|
+
}, PrimaryIcon && /*#__PURE__*/React.createElement(PrimaryIcon, {
|
|
40
40
|
fill: `var(--cds-icon-secondary)`,
|
|
41
41
|
size: 24
|
|
42
42
|
})), /*#__PURE__*/React.createElement("div", {
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
+
import { AITile } from './AITile/AITile';
|
|
9
10
|
import { AIPromptTile } from './AIPromptTile/AIPromptTile';
|
|
10
11
|
import { BaseTile } from './BaseTile/BaseTile';
|
|
11
12
|
import { GlassTile } from './GlassTile/GlassTile';
|
|
12
|
-
export { AIPromptTile, BaseTile, GlassTile };
|
|
13
|
+
export { AITile, AIPromptTile, BaseTile, GlassTile };
|
package/lib/index.d.ts
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import AnimatedHeader
|
|
9
|
+
import AnimatedHeader from './components/AnimatedHeader/AnimatedHeader';
|
|
10
|
+
import { AriaLabels, TileGroup } from './components/AnimatedHeader/types';
|
|
10
11
|
import HeaderTitle from './components/HeaderTitle/HeaderTitle';
|
|
11
|
-
import { BaseTile } from './components/Tiles/index
|
|
12
|
+
import { BaseTile } from './components/Tiles/index';
|
|
12
13
|
export * from './assets';
|
|
13
14
|
export type { Workspace, WorkspaceSelectorConfig, } from './components/WorkspaceSelector/WorkspaceSelector';
|
|
14
15
|
export type { TasksControllerConfig } from './components/TasksController/TasksController';
|
package/lib/index.js
CHANGED
|
@@ -13,29 +13,45 @@ require('react');
|
|
|
13
13
|
require('@carbon/react');
|
|
14
14
|
require('@carbon/react/icons');
|
|
15
15
|
var BaseTile = require('./components/Tiles/BaseTile/BaseTile.js');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
16
|
+
var header_static_data_fabric_light_06 = require('./assets/static/header_static_data_fabric_light_06.svg.js');
|
|
17
|
+
var header_static_data_fabric_dark_06 = require('./assets/static/header_static_data_fabric_dark_06.svg.js');
|
|
18
|
+
var header_static_db2_light_02 = require('./assets/static/header_static_db2_light_02.svg.js');
|
|
19
|
+
var header_static_db2_dark_02 = require('./assets/static/header_static_db2_dark_02.svg.js');
|
|
20
|
+
var header_static_watsonx_data_light_06 = require('./assets/static/header_static_watsonx_data_light_06.svg.js');
|
|
21
|
+
var header_static_watsonx_data_dark_05 = require('./assets/static/header_static_watsonx_data_dark_05.svg.js');
|
|
22
|
+
var header_static_watsonx_a_light_01 = require('./assets/static/header_static_watsonx_a_light_01.svg.js');
|
|
23
|
+
var header_static_watsonx_a_dark_01 = require('./assets/static/header_static_watsonx_a_dark_01.svg.js');
|
|
24
|
+
var header_static_wxbia_light_01 = require('./assets/static/header_static_wxbia_light_01.svg.js');
|
|
25
|
+
var header_static_wxbia_dark_01 = require('./assets/static/header_static_wxbia_dark_01.svg.js');
|
|
26
|
+
var header_animated_data_fabric_light_03 = require('./assets/animated/header_animated_data_fabric_light_03.json.js');
|
|
27
|
+
var header_animated_data_fabric_dark_06 = require('./assets/animated/header_animated_data_fabric_dark_06.json.js');
|
|
28
|
+
var header_animated_watsonx_data_light_04 = require('./assets/animated/header_animated_watsonx_data_light_04.json.js');
|
|
29
|
+
var header_animated_watsonx_data_dark_03 = require('./assets/animated/header_animated_watsonx_data_dark_03.json.js');
|
|
30
|
+
var header_animated_watsonx_a_light_06 = require('./assets/animated/header_animated_watsonx_a_light_06.json.js');
|
|
31
|
+
var header_animated_watsonx_a_dark_06 = require('./assets/animated/header_animated_watsonx_a_dark_06.json.js');
|
|
32
|
+
var header_animated_wxbia_light_09 = require('./assets/animated/header_animated_wxbia_light_09.json.js');
|
|
33
|
+
var header_animated_wxbia_dark_06 = require('./assets/animated/header_animated_wxbia_dark_06.json.js');
|
|
26
34
|
|
|
27
35
|
|
|
28
36
|
|
|
29
37
|
exports.AnimatedHeader = AnimatedHeader.default;
|
|
30
38
|
exports.HeaderTitle = HeaderTitle.default;
|
|
31
39
|
exports.BaseTile = BaseTile.BaseTile;
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
40
|
+
exports.dataFabricStaticLight = header_static_data_fabric_light_06.default;
|
|
41
|
+
exports.dataFabricStaticDark = header_static_data_fabric_dark_06.default;
|
|
42
|
+
exports.db2StaticLight = header_static_db2_light_02.default;
|
|
43
|
+
exports.db2StaticDark = header_static_db2_dark_02.default;
|
|
44
|
+
exports.watsonXStaticLight = header_static_watsonx_data_light_06.default;
|
|
45
|
+
exports.watsonXStaticDark = header_static_watsonx_data_dark_05.default;
|
|
46
|
+
exports.watsonXAStaticLight = header_static_watsonx_a_light_01.default;
|
|
47
|
+
exports.watsonXAStaticDark = header_static_watsonx_a_dark_01.default;
|
|
48
|
+
exports.wxbiaStaticLight = header_static_wxbia_light_01.default;
|
|
49
|
+
exports.wxbiaStaticDark = header_static_wxbia_dark_01.default;
|
|
50
|
+
exports.dataFabricAnimatedLight = header_animated_data_fabric_light_03.default;
|
|
51
|
+
exports.dataFabricAnimatedDark = header_animated_data_fabric_dark_06.default;
|
|
52
|
+
exports.watsonXAnimatedLight = header_animated_watsonx_data_light_04.default;
|
|
53
|
+
exports.watsonXAnimatedDark = header_animated_watsonx_data_dark_03.default;
|
|
54
|
+
exports.watsonXAAnimatedLight = header_animated_watsonx_a_light_06.default;
|
|
55
|
+
exports.watsonXAAnimatedDark = header_animated_watsonx_a_dark_06.default;
|
|
56
|
+
exports.wxbiaAnimatedLight = header_animated_wxbia_light_09.default;
|
|
57
|
+
exports.wxbiaAnimatedDark = header_animated_wxbia_dark_06.default;
|