@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.
Files changed (49) hide show
  1. package/es/__stories__/AnimatedHeader.stories.d.ts +148 -1944
  2. package/es/__stories__/data/index.d.ts +52 -225
  3. package/es/_virtual/lottie.js +1 -1
  4. package/es/components/AnimatedHeader/AnimatedHeader.d.ts +11 -27
  5. package/es/components/AnimatedHeader/AnimatedHeader.js +23 -19
  6. package/es/components/AnimatedHeader/types.d.ts +24 -0
  7. package/es/components/HeaderTitle/HeaderTitle.d.ts +1 -1
  8. package/es/components/TasksController/TasksController.d.ts +1 -1
  9. package/es/components/Tiles/AIPromptTile/AIPromptTile.d.ts +10 -11
  10. package/es/components/Tiles/AIPromptTile/AIPromptTile.js +12 -14
  11. package/es/components/Tiles/AITile/AITile.d.ts +26 -0
  12. package/es/components/Tiles/AITile/AITile.js +65 -0
  13. package/es/components/Tiles/AITile/AITileBody.d.ts +19 -0
  14. package/es/components/Tiles/AITile/AITileBody.js +59 -0
  15. package/es/components/Tiles/BaseTile/BaseTile.d.ts +15 -18
  16. package/es/components/Tiles/BaseTile/BaseTile.js +34 -4
  17. package/es/components/Tiles/GlassTile/GlassTile.d.ts +13 -9
  18. package/es/components/Tiles/GlassTile/GlassTile.js +13 -15
  19. package/es/components/Tiles/GlassTile/GlassTileBody.d.ts +4 -4
  20. package/es/components/Tiles/GlassTile/GlassTileBody.js +4 -4
  21. package/es/components/Tiles/index.d.ts +2 -1
  22. package/es/index.d.ts +3 -2
  23. package/es/node_modules/lottie-web/build/player/lottie.js +194 -193
  24. package/lib/__stories__/AnimatedHeader.stories.d.ts +148 -1944
  25. package/lib/__stories__/data/index.d.ts +52 -225
  26. package/lib/_virtual/lottie.js +1 -1
  27. package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +11 -27
  28. package/lib/components/AnimatedHeader/AnimatedHeader.js +23 -19
  29. package/lib/components/AnimatedHeader/types.d.ts +24 -0
  30. package/lib/components/HeaderTitle/HeaderTitle.d.ts +1 -1
  31. package/lib/components/TasksController/TasksController.d.ts +1 -1
  32. package/lib/components/Tiles/AIPromptTile/AIPromptTile.d.ts +10 -11
  33. package/lib/components/Tiles/AIPromptTile/AIPromptTile.js +12 -14
  34. package/lib/components/Tiles/AITile/AITile.d.ts +26 -0
  35. package/lib/components/Tiles/AITile/AITile.js +70 -0
  36. package/lib/components/Tiles/AITile/AITileBody.d.ts +19 -0
  37. package/lib/components/Tiles/AITile/AITileBody.js +61 -0
  38. package/lib/components/Tiles/BaseTile/BaseTile.d.ts +15 -18
  39. package/lib/components/Tiles/BaseTile/BaseTile.js +34 -4
  40. package/lib/components/Tiles/GlassTile/GlassTile.d.ts +13 -9
  41. package/lib/components/Tiles/GlassTile/GlassTile.js +13 -15
  42. package/lib/components/Tiles/GlassTile/GlassTileBody.d.ts +4 -4
  43. package/lib/components/Tiles/GlassTile/GlassTileBody.js +4 -4
  44. package/lib/components/Tiles/index.d.ts +2 -1
  45. package/lib/index.d.ts +3 -2
  46. package/lib/node_modules/lottie-web/build/player/lottie.js +194 -193
  47. package/package.json +2 -2
  48. package/scss/Tiles/AITile/ai-tile.scss +222 -0
  49. package/scss/animated-header.scss +1 -0
@@ -1,230 +1,57 @@
1
- export const workspaceData: {
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
- id: number;
7
- label: string;
8
- tiles: ({
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
- title: string;
19
- subtitle: string;
20
- mainIcon: import("@carbon/react/icons").CarbonIconType;
21
- ariaLabel: string;
22
- })[];
23
- } | {
24
- id: number;
25
- label: string;
26
- tiles: ({
27
- id: string;
28
- href: string;
29
- title: string;
30
- subtitle: string;
31
- mainIcon: import("@carbon/react/icons").CarbonIconType;
32
- ariaLabel: string;
33
- secondaryIcon?: undefined;
34
- } | {
35
- id: string;
36
- href: string;
37
- title: string;
38
- mainIcon: import("@carbon/react/icons").CarbonIconType;
39
- secondaryIcon: import("@carbon/react/icons").CarbonIconType;
40
- ariaLabel: string;
41
- subtitle?: undefined;
42
- })[];
43
- } | {
44
- id: number;
45
- label: string;
46
- tiles: ({
47
- id: string;
48
- href: string;
49
- title: string;
50
- subtitle: string;
51
- mainIcon: import("@carbon/react/icons").CarbonIconType;
52
- isLoading: boolean;
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
- export namespace tasksControllerConfigButton {
97
- let type: string;
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
+ };
@@ -8,7 +8,7 @@
8
8
  import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
9
9
  import { __require as requireLottie } from '../node_modules/lottie-web/build/player/lottie.js';
10
10
 
11
- var lottieExports = requireLottie();
11
+ var lottieExports = /*@__PURE__*/ requireLottie();
12
12
  var lottie = /*@__PURE__*/getDefaultExportFromCjs(lottieExports);
13
13
 
14
14
  export { lottie as default };
@@ -1,37 +1,21 @@
1
- import React, { ElementType, ReactNode } from 'react';
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: (e: any) => void;
18
+ setSelectedTileGroup?: (e: any) => void;
35
19
  description?: string;
36
20
  headerAnimation?: object;
37
21
  headerStatic?: React.JSX.Element | string;
@@ -5,11 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import PropTypes from 'prop-types';
8
+ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React, { useRef, useState, useEffect } from 'react';
10
+ import PropTypes from 'prop-types';
11
+ import lottie from '../../_virtual/lottie.js';
10
12
  import { Grid, Column, Button } from '@carbon/react';
11
13
  import { ChevronUp, ChevronDown } from '@carbon/icons-react';
12
- import lottie from '../../_virtual/lottie.js';
13
14
  import { usePrefix } from '../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
14
15
  import '@carbon/react/icons';
15
16
  import { BaseTile } from '../Tiles/BaseTile/BaseTile.js';
@@ -159,27 +160,30 @@ const AnimatedHeader = ({
159
160
  className: `${blockClass}__tiles-container`,
160
161
  "aria-label": ariaLabels?.tilesContainer ?? `Feature tiles`,
161
162
  role: "list"
162
- }, selectedTileGroup.tiles.map(tile => {
163
- return /*#__PURE__*/React.createElement(BaseTile, {
164
- onClick: tile.href || tile.onClick ? () => {
165
- tileClickHandler?.(tile);
166
- tile.onClick?.();
167
- } : null,
168
- key: tile.id,
169
- id: tile.id,
163
+ }, selectedTileGroup.tiles.map((tile, index) => {
164
+ const {
165
+ tileId,
166
+ ...rest
167
+ } = tile;
168
+ const legacyId = tile.id; // old configs
169
+ const resolvedTileId = tileId ?? legacyId;
170
+ const key = resolvedTileId ?? `tile-${index}`;
171
+ const hasAction = tile.href || tile.onClick === 'function';
172
+ return /*#__PURE__*/React.createElement(BaseTile, _extends({
173
+ key: key,
174
+ tileId: resolvedTileId
175
+ }, rest, {
170
176
  open: open,
171
- href: tile.href,
172
- mainIcon: tile.mainIcon,
173
- secondaryIcon: tile.secondaryIcon,
174
- title: tile.title,
175
- subtitle: tile.subtitle,
176
177
  productName: productName,
177
- customContent: tile.customContent,
178
178
  isLoading: isLoading || tile.isLoading,
179
- isDisabled: tile.isDisabled,
180
179
  disabledTaskLabel: disabledTaskLabel,
181
- ariaLabel: tile.ariaLabel
182
- });
180
+ onClick: hasAction ? () => {
181
+ tileClickHandler?.(tile);
182
+ if (typeof tile.onClick === 'function') {
183
+ tile.onClick();
184
+ }
185
+ } : undefined
186
+ }));
183
187
  }))), /*#__PURE__*/React.createElement("div", {
184
188
  className: `${blockClass}__button-collapse--gradient`
185
189
  }), /*#__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/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/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
- /** Primary UI component for user interaction */
11
- interface AIPromptTileProps {
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
- isLoading?: boolean;
19
- isDisabled?: boolean;
20
- disabledTaskLabel?: string;
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 {};
@@ -11,21 +11,19 @@ import { usePrefix } from '../../../node_modules/@carbon-labs/utilities/es/usePr
11
11
  import { Send } from '@carbon/react/icons';
12
12
 
13
13
  var _AILabel, _Send;
14
-
15
- /** Primary UI component for user interaction */
16
-
17
14
  const AIPromptTile = ({
15
+ tileId,
18
16
  href,
19
- id,
20
- mainIcon: MainIcon,
21
- open,
22
- productName,
23
17
  title,
24
- isLoading,
25
- isDisabled,
26
18
  disabledTaskLabel,
19
+ productName,
20
+ promptPlaceholder = 'Start chatting...',
21
+ primaryIcon: PrimaryIcon,
27
22
  onClick,
28
- ariaLabel
23
+ ariaLabel,
24
+ open,
25
+ isLoading,
26
+ isDisabled
29
27
  }) => {
30
28
  const prefix = usePrefix();
31
29
  const blockClass = `${prefix}--animated-header__ai-prompt-tile`;
@@ -52,7 +50,7 @@ const AIPromptTile = ({
52
50
  "aria-label": ariaLabel ?? title ?? 'AI Tile',
53
51
  role: "listitem",
54
52
  title: isDisabled ? disabledTaskLabel ?? '' : '',
55
- key: id
53
+ key: tileId
56
54
  }, isLoading ? /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
57
55
  className: `${blockClass}--loading-skeleton`
58
56
  }) : /*#__PURE__*/React.createElement("div", {
@@ -63,13 +61,13 @@ const AIPromptTile = ({
63
61
  className: `${blockClass}--body-gradient`
64
62
  }), /*#__PURE__*/React.createElement("div", {
65
63
  className: `${blockClass}--icons`
66
- }, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
64
+ }, PrimaryIcon && /*#__PURE__*/React.createElement(PrimaryIcon, {
67
65
  fill: `var(--cds-icon-secondary)`,
68
66
  size: 24
69
67
  }), _AILabel || (_AILabel = /*#__PURE__*/React.createElement(AILabel, {
70
68
  autoAlign: true,
71
69
  aiText: "AI",
72
- size: "mini"
70
+ size: "xs"
73
71
  }))), /*#__PURE__*/React.createElement("div", {
74
72
  className: `${blockClass}--title`
75
73
  }, title), /*#__PURE__*/React.createElement("div", {
@@ -80,7 +78,7 @@ const AIPromptTile = ({
80
78
  type: "text",
81
79
  labelText: "AI Chat Input",
82
80
  hideLabel: true,
83
- placeholder: "Start chatting...",
81
+ placeholder: promptPlaceholder,
84
82
  size: "sm",
85
83
  onChange: handleTextInput,
86
84
  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,65 @@
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
+ import React from 'react';
9
+ import { Link } from '@carbon/react';
10
+ import { usePrefix } from '../../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
11
+ import { AITileBody } from './AITileBody.js';
12
+
13
+ const AITile = ({
14
+ tileId,
15
+ href,
16
+ title,
17
+ subtitle,
18
+ disabledTaskLabel,
19
+ customContent,
20
+ primaryIcon: PrimaryIcon,
21
+ secondaryIcon: SecondaryIcon,
22
+ onClick: aiTileClickHandler,
23
+ ariaLabel,
24
+ open,
25
+ isLoading,
26
+ isDisabled
27
+ }) => {
28
+ const prefix = usePrefix();
29
+ const blockClass = `${prefix}--animated-header__ai-tile`;
30
+ const body = /*#__PURE__*/React.createElement(AITileBody, {
31
+ open: open,
32
+ primaryIcon: PrimaryIcon,
33
+ secondaryIcon: SecondaryIcon,
34
+ title: title,
35
+ subtitle: subtitle,
36
+ customContent: customContent,
37
+ isLoading: isLoading
38
+ });
39
+
40
+ // Non-interactive tile
41
+ if (!href && !aiTileClickHandler) {
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ className: `${prefix}--animated-header__tile ${blockClass}`,
44
+ key: tileId,
45
+ "aria-label": ariaLabel ?? title ?? 'AI Tile',
46
+ title: isDisabled ? disabledTaskLabel ?? '' : '',
47
+ tabIndex: -1
48
+ }, body);
49
+ }
50
+ return /*#__PURE__*/React.createElement(Link, {
51
+ onClick: () => {
52
+ aiTileClickHandler?.();
53
+ },
54
+ className: `${prefix}--animated-header__tile ${blockClass}`,
55
+ "aria-label": ariaLabel ?? title ?? 'AI Tile',
56
+ role: "listitem",
57
+ tabIndex: isDisabled || isLoading ? -1 : 0,
58
+ key: tileId,
59
+ href: href ?? undefined,
60
+ disabled: isDisabled || isLoading,
61
+ title: isDisabled ? disabledTaskLabel ?? '' : ''
62
+ }, body);
63
+ };
64
+
65
+ export { AITile, AITile as default };
@@ -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;