@carbon-labs/react-animated-header 0.31.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/es/__stories__/AnimatedHeader.stories.d.ts +148 -1944
- package/es/__stories__/data/index.d.ts +52 -225
- package/es/_virtual/lottie.js +1 -1
- package/es/components/AnimatedHeader/AnimatedHeader.d.ts +11 -27
- package/es/components/AnimatedHeader/AnimatedHeader.js +23 -19
- 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/node_modules/lottie-web/build/player/lottie.js +194 -193
- package/lib/__stories__/AnimatedHeader.stories.d.ts +148 -1944
- package/lib/__stories__/data/index.d.ts +52 -225
- package/lib/_virtual/lottie.js +1 -1
- package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +11 -27
- package/lib/components/AnimatedHeader/AnimatedHeader.js +23 -19
- 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/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
|
@@ -1,230 +1,57 @@
|
|
|
1
|
-
|
|
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 { TileGroup } from '../../components/AnimatedHeader/types';
|
|
10
|
+
export declare const workspaceData: {
|
|
2
11
|
id: string;
|
|
3
12
|
label: string;
|
|
4
13
|
}[];
|
|
5
|
-
export const headerTiles:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
id: string;
|
|
10
|
-
href: string;
|
|
11
|
-
title: string;
|
|
12
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
13
|
-
ariaLabel: string;
|
|
14
|
-
subtitle?: undefined;
|
|
15
|
-
} | {
|
|
16
|
-
id: string;
|
|
14
|
+
export declare const headerTiles: TileGroup[];
|
|
15
|
+
export declare const tasksControllerConfigButton: {
|
|
16
|
+
type: string;
|
|
17
|
+
button: {
|
|
17
18
|
href: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
ariaLabel: string;
|
|
54
|
-
isDisabled?: undefined;
|
|
55
|
-
secondaryIcon?: undefined;
|
|
56
|
-
} | {
|
|
57
|
-
id: string;
|
|
58
|
-
title: string;
|
|
59
|
-
subtitle: string;
|
|
60
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
61
|
-
ariaLabel: string;
|
|
62
|
-
href?: undefined;
|
|
63
|
-
isLoading?: undefined;
|
|
64
|
-
isDisabled?: undefined;
|
|
65
|
-
secondaryIcon?: undefined;
|
|
66
|
-
} | {
|
|
67
|
-
id: string;
|
|
68
|
-
href: string;
|
|
69
|
-
title: string;
|
|
70
|
-
subtitle: string;
|
|
71
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
72
|
-
isDisabled: boolean;
|
|
73
|
-
ariaLabel: string;
|
|
74
|
-
isLoading?: undefined;
|
|
75
|
-
secondaryIcon?: undefined;
|
|
76
|
-
} | {
|
|
77
|
-
id: string;
|
|
78
|
-
href: string;
|
|
79
|
-
title: string;
|
|
80
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
81
|
-
secondaryIcon: import("@carbon/react/icons").CarbonIconType;
|
|
82
|
-
ariaLabel: string;
|
|
83
|
-
subtitle?: undefined;
|
|
84
|
-
isLoading?: undefined;
|
|
85
|
-
isDisabled?: undefined;
|
|
86
|
-
})[];
|
|
87
|
-
} | {
|
|
88
|
-
id: number;
|
|
89
|
-
label: string;
|
|
90
|
-
tiles: {
|
|
91
|
-
id: string;
|
|
92
|
-
customContent: import("react/jsx-runtime").JSX.Element;
|
|
93
|
-
ariaLabel: string;
|
|
19
|
+
icon: import("@carbon/react/icons").CarbonIconType;
|
|
20
|
+
text: string;
|
|
21
|
+
type: "tertiary";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const tasksControllerConfigDropdown: {
|
|
25
|
+
type: string;
|
|
26
|
+
dropdown: {
|
|
27
|
+
label: string;
|
|
28
|
+
allTileGroups: TileGroup[];
|
|
29
|
+
selectedTileGroup: TileGroup;
|
|
30
|
+
setSelectedTileGroup: () => void;
|
|
31
|
+
ariaLabel: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare const tasksControllerConfigLoading: {
|
|
35
|
+
type: string;
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare const workspaceSelectorConfig: {
|
|
39
|
+
allWorkspaces: {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
}[];
|
|
43
|
+
setSelectedWorkspace: () => void;
|
|
44
|
+
propsOverrides: {
|
|
45
|
+
label: string;
|
|
46
|
+
renderSelectedItem: (item: any) => string;
|
|
47
|
+
};
|
|
48
|
+
ariaLabel: string;
|
|
49
|
+
};
|
|
50
|
+
export declare const workspaceSelectorConfigLoading: {
|
|
51
|
+
allWorkspaces: {
|
|
52
|
+
id: string;
|
|
53
|
+
label: string;
|
|
94
54
|
}[];
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
namespace button {
|
|
99
|
-
export let href: string;
|
|
100
|
-
export { Add as icon };
|
|
101
|
-
export let text: string;
|
|
102
|
-
let type_1: "tertiary";
|
|
103
|
-
export { type_1 as type };
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
export namespace tasksControllerConfigDropdown {
|
|
107
|
-
let type_2: string;
|
|
108
|
-
export { type_2 as type };
|
|
109
|
-
export namespace dropdown {
|
|
110
|
-
export let label: string;
|
|
111
|
-
export { headerTiles as allTileGroups };
|
|
112
|
-
export let selectedTileGroup: {
|
|
113
|
-
id: number;
|
|
114
|
-
label: string;
|
|
115
|
-
tiles: ({
|
|
116
|
-
id: string;
|
|
117
|
-
href: string;
|
|
118
|
-
title: string;
|
|
119
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
120
|
-
ariaLabel: string;
|
|
121
|
-
subtitle?: undefined;
|
|
122
|
-
} | {
|
|
123
|
-
id: string;
|
|
124
|
-
href: string;
|
|
125
|
-
title: string;
|
|
126
|
-
subtitle: string;
|
|
127
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
128
|
-
ariaLabel: string;
|
|
129
|
-
})[];
|
|
130
|
-
} | {
|
|
131
|
-
id: number;
|
|
132
|
-
label: string;
|
|
133
|
-
tiles: ({
|
|
134
|
-
id: string;
|
|
135
|
-
href: string;
|
|
136
|
-
title: string;
|
|
137
|
-
subtitle: string;
|
|
138
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
139
|
-
ariaLabel: string;
|
|
140
|
-
secondaryIcon?: undefined;
|
|
141
|
-
} | {
|
|
142
|
-
id: string;
|
|
143
|
-
href: string;
|
|
144
|
-
title: string;
|
|
145
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
146
|
-
secondaryIcon: import("@carbon/react/icons").CarbonIconType;
|
|
147
|
-
ariaLabel: string;
|
|
148
|
-
subtitle?: undefined;
|
|
149
|
-
})[];
|
|
150
|
-
} | {
|
|
151
|
-
id: number;
|
|
152
|
-
label: string;
|
|
153
|
-
tiles: ({
|
|
154
|
-
id: string;
|
|
155
|
-
href: string;
|
|
156
|
-
title: string;
|
|
157
|
-
subtitle: string;
|
|
158
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
159
|
-
isLoading: boolean;
|
|
160
|
-
ariaLabel: string;
|
|
161
|
-
isDisabled?: undefined;
|
|
162
|
-
secondaryIcon?: undefined;
|
|
163
|
-
} | {
|
|
164
|
-
id: string;
|
|
165
|
-
title: string;
|
|
166
|
-
subtitle: string;
|
|
167
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
168
|
-
ariaLabel: string;
|
|
169
|
-
href?: undefined;
|
|
170
|
-
isLoading?: undefined;
|
|
171
|
-
isDisabled?: undefined;
|
|
172
|
-
secondaryIcon?: undefined;
|
|
173
|
-
} | {
|
|
174
|
-
id: string;
|
|
175
|
-
href: string;
|
|
176
|
-
title: string;
|
|
177
|
-
subtitle: string;
|
|
178
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
179
|
-
isDisabled: boolean;
|
|
180
|
-
ariaLabel: string;
|
|
181
|
-
isLoading?: undefined;
|
|
182
|
-
secondaryIcon?: undefined;
|
|
183
|
-
} | {
|
|
184
|
-
id: string;
|
|
185
|
-
href: string;
|
|
186
|
-
title: string;
|
|
187
|
-
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
188
|
-
secondaryIcon: import("@carbon/react/icons").CarbonIconType;
|
|
189
|
-
ariaLabel: string;
|
|
190
|
-
subtitle?: undefined;
|
|
191
|
-
isLoading?: undefined;
|
|
192
|
-
isDisabled?: undefined;
|
|
193
|
-
})[];
|
|
194
|
-
} | {
|
|
195
|
-
id: number;
|
|
196
|
-
label: string;
|
|
197
|
-
tiles: {
|
|
198
|
-
id: string;
|
|
199
|
-
customContent: import("react/jsx-runtime").JSX.Element;
|
|
200
|
-
ariaLabel: string;
|
|
201
|
-
}[];
|
|
202
|
-
};
|
|
203
|
-
export function setSelectedTileGroup(): void;
|
|
204
|
-
export let ariaLabel: string;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
export namespace tasksControllerConfigLoading {
|
|
208
|
-
let type_3: string;
|
|
209
|
-
export { type_3 as type };
|
|
210
|
-
export let isLoading: boolean;
|
|
211
|
-
}
|
|
212
|
-
export namespace workspaceSelectorConfig {
|
|
213
|
-
export { workspaceData as allWorkspaces };
|
|
214
|
-
export function setSelectedWorkspace(): void;
|
|
215
|
-
export namespace propsOverrides {
|
|
216
|
-
let label_1: string;
|
|
217
|
-
export { label_1 as label };
|
|
218
|
-
export function renderSelectedItem(item: any): string;
|
|
219
|
-
}
|
|
220
|
-
let ariaLabel_1: string;
|
|
221
|
-
export { ariaLabel_1 as ariaLabel };
|
|
222
|
-
}
|
|
223
|
-
export namespace workspaceSelectorConfigLoading {
|
|
224
|
-
export { workspaceData as allWorkspaces };
|
|
225
|
-
export function setSelectedWorkspace_1(): void;
|
|
226
|
-
export { setSelectedWorkspace_1 as setSelectedWorkspace };
|
|
227
|
-
let isLoading_1: boolean;
|
|
228
|
-
export { isLoading_1 as isLoading };
|
|
229
|
-
}
|
|
230
|
-
import { Add } from '@carbon/react/icons';
|
|
55
|
+
setSelectedWorkspace: () => void;
|
|
56
|
+
isLoading: boolean;
|
|
57
|
+
};
|
package/lib/_virtual/lottie.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _commonjsHelpers = require('./_commonjsHelpers.js');
|
|
13
13
|
var lottie$1 = require('../node_modules/lottie-web/build/player/lottie.js');
|
|
14
14
|
|
|
15
|
-
var lottieExports = lottie$1.__require();
|
|
15
|
+
var lottieExports = /*@__PURE__*/ lottie$1.__require();
|
|
16
16
|
var lottie = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(lottieExports);
|
|
17
17
|
|
|
18
18
|
exports.default = lottie;
|
|
@@ -1,37 +1,21 @@
|
|
|
1
|
-
|
|
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 from 'react';
|
|
2
10
|
import { TasksControllerProps } from '../TasksController/TasksController';
|
|
3
11
|
import { WorkspaceSelectorProps } from '../WorkspaceSelector/WorkspaceSelector';
|
|
12
|
+
import { Tile, TileGroup, AriaLabels } from './types';
|
|
4
13
|
/** Animated Header */
|
|
5
|
-
export interface AriaLabels {
|
|
6
|
-
welcome?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
collapseButton?: string;
|
|
9
|
-
expandButton?: string;
|
|
10
|
-
tilesContainer?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface Tile {
|
|
13
|
-
href?: string | null;
|
|
14
|
-
id: string;
|
|
15
|
-
mainIcon?: ElementType | null;
|
|
16
|
-
secondaryIcon?: ElementType | null;
|
|
17
|
-
subtitle?: string | null;
|
|
18
|
-
title?: string | null;
|
|
19
|
-
customContent?: ReactNode | null;
|
|
20
|
-
isLoading?: boolean;
|
|
21
|
-
isDisabled?: boolean;
|
|
22
|
-
onClick?: () => void;
|
|
23
|
-
ariaLabel?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface TileGroup {
|
|
26
|
-
id: number;
|
|
27
|
-
label: string;
|
|
28
|
-
tiles: Tile[];
|
|
29
|
-
}
|
|
30
14
|
export type AnimatedHeaderProps = {
|
|
31
15
|
allTileGroups?: TileGroup[];
|
|
32
16
|
ariaLabels?: AriaLabels;
|
|
33
17
|
selectedTileGroup?: TileGroup;
|
|
34
|
-
setSelectedTileGroup
|
|
18
|
+
setSelectedTileGroup?: (e: any) => void;
|
|
35
19
|
description?: string;
|
|
36
20
|
headerAnimation?: object;
|
|
37
21
|
headerStatic?: React.JSX.Element | string;
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var React = require('react');
|
|
14
|
+
var PropTypes = require('prop-types');
|
|
15
|
+
var lottie = require('../../_virtual/lottie.js');
|
|
14
16
|
var react = require('@carbon/react');
|
|
15
17
|
var iconsReact = require('@carbon/icons-react');
|
|
16
|
-
var lottie = require('../../_virtual/lottie.js');
|
|
17
18
|
var usePrefix = require('../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
18
19
|
require('@carbon/react/icons');
|
|
19
20
|
var BaseTile = require('../Tiles/BaseTile/BaseTile.js');
|
|
@@ -163,27 +164,30 @@ const AnimatedHeader = ({
|
|
|
163
164
|
className: `${blockClass}__tiles-container`,
|
|
164
165
|
"aria-label": ariaLabels?.tilesContainer ?? `Feature tiles`,
|
|
165
166
|
role: "list"
|
|
166
|
-
}, selectedTileGroup.tiles.map(tile => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
167
|
+
}, selectedTileGroup.tiles.map((tile, index) => {
|
|
168
|
+
const {
|
|
169
|
+
tileId,
|
|
170
|
+
...rest
|
|
171
|
+
} = tile;
|
|
172
|
+
const legacyId = tile.id; // old configs
|
|
173
|
+
const resolvedTileId = tileId ?? legacyId;
|
|
174
|
+
const key = resolvedTileId ?? `tile-${index}`;
|
|
175
|
+
const hasAction = tile.href || tile.onClick === 'function';
|
|
176
|
+
return /*#__PURE__*/React.createElement(BaseTile.BaseTile, _rollupPluginBabelHelpers.extends({
|
|
177
|
+
key: key,
|
|
178
|
+
tileId: resolvedTileId
|
|
179
|
+
}, rest, {
|
|
174
180
|
open: open,
|
|
175
|
-
href: tile.href,
|
|
176
|
-
mainIcon: tile.mainIcon,
|
|
177
|
-
secondaryIcon: tile.secondaryIcon,
|
|
178
|
-
title: tile.title,
|
|
179
|
-
subtitle: tile.subtitle,
|
|
180
181
|
productName: productName,
|
|
181
|
-
customContent: tile.customContent,
|
|
182
182
|
isLoading: isLoading || tile.isLoading,
|
|
183
|
-
isDisabled: tile.isDisabled,
|
|
184
183
|
disabledTaskLabel: disabledTaskLabel,
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
onClick: hasAction ? () => {
|
|
185
|
+
tileClickHandler?.(tile);
|
|
186
|
+
if (typeof tile.onClick === 'function') {
|
|
187
|
+
tile.onClick();
|
|
188
|
+
}
|
|
189
|
+
} : undefined
|
|
190
|
+
}));
|
|
187
191
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
188
192
|
className: `${blockClass}__button-collapse--gradient`
|
|
189
193
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -0,0 +1,24 @@
|
|
|
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 type { BaseTileProps } from '../../components/Tiles/BaseTile/BaseTile';
|
|
10
|
+
export type Tile = Omit<BaseTileProps, 'id'> & {
|
|
11
|
+
tileId: string;
|
|
12
|
+
};
|
|
13
|
+
export interface TileGroup {
|
|
14
|
+
id: number;
|
|
15
|
+
label: string;
|
|
16
|
+
tiles: Tile[];
|
|
17
|
+
}
|
|
18
|
+
export interface AriaLabels {
|
|
19
|
+
welcome?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
collapseButton?: string;
|
|
22
|
+
expandButton?: string;
|
|
23
|
+
tilesContainer?: string;
|
|
24
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { AriaLabels } from '../AnimatedHeader/
|
|
10
|
+
import { AriaLabels } from '../AnimatedHeader/types';
|
|
11
11
|
export type HeaderTitleProps = {
|
|
12
12
|
userName?: string;
|
|
13
13
|
welcomeText?: string;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
import { ButtonBaseProps, DropdownProps } from '@carbon/react';
|
|
10
|
-
import { TileGroup } from '../AnimatedHeader/
|
|
10
|
+
import { TileGroup } from '../AnimatedHeader/types';
|
|
11
11
|
export interface TasksControllerConfig {
|
|
12
12
|
type: 'button' | 'dropdown' | null;
|
|
13
13
|
isLoading?: boolean;
|
|
@@ -7,19 +7,18 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
import React, { ElementType } from 'react';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export type AIPromptTileProps = {
|
|
11
|
+
tileId: string | null;
|
|
12
12
|
href?: string | null;
|
|
13
|
-
id?: string;
|
|
14
|
-
mainIcon?: ElementType | null;
|
|
15
|
-
open?: boolean;
|
|
16
|
-
productName?: string;
|
|
17
13
|
title?: string | null;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
disabledTaskLabel?: string | null;
|
|
15
|
+
productName?: string;
|
|
16
|
+
promptPlaceholder?: string;
|
|
17
|
+
primaryIcon?: ElementType | null;
|
|
21
18
|
onClick?: (() => void) | null;
|
|
22
19
|
ariaLabel?: string;
|
|
23
|
-
|
|
20
|
+
open?: boolean;
|
|
21
|
+
isLoading?: boolean;
|
|
22
|
+
isDisabled?: boolean;
|
|
23
|
+
} & Record<string, unknown>;
|
|
24
24
|
export declare const AIPromptTile: React.FC<AIPromptTileProps>;
|
|
25
|
-
export {};
|
|
@@ -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;
|