@carbon-labs/react-animated-header 0.31.0 → 0.33.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 (52) 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 +42 -36
  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 +14 -16
  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 +6 -6
  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 +42 -36
  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 +14 -16
  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 +6 -6
  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/AnimatedHeader/animated-header.scss +66 -36
  49. package/scss/Tiles/AIPromptTile/ai-prompt-tile.scss +14 -2
  50. package/scss/Tiles/AITile/ai-tile.scss +222 -0
  51. package/scss/Tiles/GlassTile/glass-tile.scss +14 -2
  52. 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';
@@ -42,14 +43,10 @@ const AnimatedHeader = ({
42
43
  const blockClass = `${prefix}--animated-header`;
43
44
  const animationContainer = useRef(null);
44
45
  const animRef = useRef(null);
45
- const [open, setOpen] = useState(true);
46
+ const [isOpen, setIsOpen] = useState(true);
46
47
  const isReduced = window.matchMedia('(prefers-reduced-motion)').matches;
47
- const collapsed = `${blockClass}--collapsed`;
48
- const contentCollapsed = `${blockClass}__content--collapsed`;
49
- const descriptionCollapsed = `${blockClass}__left-area-container--collapsed`;
50
- const lottieCollapsed = `${blockClass}__lottie-animation--collapsed`;
51
48
  const handleButtonCollapseClick = () => {
52
- setOpen(!open);
49
+ setIsOpen(!isOpen);
53
50
  };
54
51
  useEffect(() => {
55
52
  // Make sure any prior instance is destroyed before creating a new one
@@ -99,8 +96,11 @@ const AnimatedHeader = ({
99
96
  // Re-init when the JSON or reduced-motion preference changes
100
97
  }, [headerAnimation, isReduced]);
101
98
  return /*#__PURE__*/React.createElement("header", {
102
- className: `${blockClass}${!open ? ` ${collapsed}` : ''}`
103
- }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement("div", {
99
+ className: blockClass,
100
+ "data-expanded": isOpen
101
+ }, /*#__PURE__*/React.createElement(Grid, {
102
+ className: `${blockClass}__grid`
103
+ }, /*#__PURE__*/React.createElement("div", {
104
104
  className: `${blockClass}__gradient--overlay`
105
105
  }), /*#__PURE__*/React.createElement("div", {
106
106
  className: `${blockClass}__container--gradient`
@@ -118,7 +118,8 @@ const AnimatedHeader = ({
118
118
  className: `${blockClass}__lottie-animation--container`
119
119
  }, /*#__PURE__*/React.createElement("div", {
120
120
  ref: animationContainer,
121
- className: `${blockClass}__lottie-animation${!open ? ` ${lottieCollapsed}` : ''}`,
121
+ className: `${blockClass}__lottie-animation`,
122
+ "data-expanded": isOpen,
122
123
  "aria-hidden": "true"
123
124
  })), /*#__PURE__*/React.createElement(Column, {
124
125
  sm: 4,
@@ -127,14 +128,15 @@ const AnimatedHeader = ({
127
128
  }, /*#__PURE__*/React.createElement(HeaderTitle, {
128
129
  userName: userName,
129
130
  welcomeText: welcomeText,
130
- headerExpanded: open,
131
+ headerExpanded: isOpen,
131
132
  ariaLabels: ariaLabels
132
133
  })), (description || tasksControllerConfig) && /*#__PURE__*/React.createElement(Column, {
133
134
  sm: 4,
134
135
  md: 8,
135
136
  lg: 4,
136
137
  id: `${blockClass}-content`,
137
- className: `${blockClass}__left-area-container${!open ? ` ${descriptionCollapsed}` : ''}`
138
+ className: `${blockClass}__left-area-container`,
139
+ "data-expanded": isOpen
138
140
  }, description && /*#__PURE__*/React.createElement("h2", {
139
141
  className: `${blockClass}__description`,
140
142
  "aria-label": ariaLabels?.description ?? `Header description`
@@ -150,7 +152,8 @@ const AnimatedHeader = ({
150
152
  lg: 12,
151
153
  className: `${blockClass}__content`
152
154
  }, !!workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
153
- className: `${blockClass}__workspace--container${!open ? ` ${contentCollapsed}` : ''}`
155
+ className: `${blockClass}__workspace--container`,
156
+ "data-expanded": isOpen
154
157
  }, /*#__PURE__*/React.createElement(WorkspaceSelector, {
155
158
  workspaceSelectorConfig: workspaceSelectorConfig,
156
159
  userName: userName,
@@ -159,27 +162,30 @@ const AnimatedHeader = ({
159
162
  className: `${blockClass}__tiles-container`,
160
163
  "aria-label": ariaLabels?.tilesContainer ?? `Feature tiles`,
161
164
  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,
170
- open: open,
171
- href: tile.href,
172
- mainIcon: tile.mainIcon,
173
- secondaryIcon: tile.secondaryIcon,
174
- title: tile.title,
175
- subtitle: tile.subtitle,
165
+ }, selectedTileGroup.tiles.map((tile, index) => {
166
+ const {
167
+ tileId,
168
+ ...rest
169
+ } = tile;
170
+ const legacyId = tile.id; // old configs
171
+ const resolvedTileId = tileId ?? legacyId;
172
+ const key = resolvedTileId ?? `tile-${index}`;
173
+ const hasAction = tile.href || tile.onClick === 'function';
174
+ return /*#__PURE__*/React.createElement(BaseTile, _extends({
175
+ key: key,
176
+ tileId: resolvedTileId
177
+ }, rest, {
178
+ open: isOpen,
176
179
  productName: productName,
177
- customContent: tile.customContent,
178
180
  isLoading: isLoading || tile.isLoading,
179
- isDisabled: tile.isDisabled,
180
181
  disabledTaskLabel: disabledTaskLabel,
181
- ariaLabel: tile.ariaLabel
182
- });
182
+ onClick: hasAction ? () => {
183
+ tileClickHandler?.(tile);
184
+ if (typeof tile.onClick === 'function') {
185
+ tile.onClick();
186
+ }
187
+ } : undefined
188
+ }));
183
189
  }))), /*#__PURE__*/React.createElement("div", {
184
190
  className: `${blockClass}__button-collapse--gradient`
185
191
  }), /*#__PURE__*/React.createElement("div", {
@@ -187,12 +193,12 @@ const AnimatedHeader = ({
187
193
  }, /*#__PURE__*/React.createElement(Button, {
188
194
  id: `${blockClass}__button-collapse`,
189
195
  kind: "ghost",
190
- renderIcon: open ? ChevronUp : ChevronDown,
196
+ renderIcon: isOpen ? ChevronUp : ChevronDown,
191
197
  onClick: handleButtonCollapseClick,
192
- "aria-expanded": open,
198
+ "aria-expanded": isOpen,
193
199
  "aria-controls": `${blockClass}-content`,
194
- "aria-label": open ? ariaLabels?.collapseButton ?? 'Collapse header details' : ariaLabels?.expandButton ?? 'Expand header details'
195
- }, open ? collapseButtonLabel : expandButtonLabel))));
200
+ "aria-label": isOpen ? ariaLabels?.collapseButton ?? 'Collapse header details' : ariaLabels?.expandButton ?? 'Expand header details'
201
+ }, isOpen ? collapseButtonLabel : expandButtonLabel))));
196
202
  };
197
203
  AnimatedHeader.displayName = 'Animated Header';
198
204
  AnimatedHeader.propTypes = {
@@ -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,25 +11,22 @@ 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`;
32
- const collapsed = `${blockClass}--collapsed`;
33
30
  const disabled = `${blockClass}--disabled`;
34
31
  const [textInput, setTextInput] = useState('');
35
32
  const handleTextInput = e => {
@@ -52,24 +49,25 @@ const AIPromptTile = ({
52
49
  "aria-label": ariaLabel ?? title ?? 'AI Tile',
53
50
  role: "listitem",
54
51
  title: isDisabled ? disabledTaskLabel ?? '' : '',
55
- key: id
52
+ key: tileId
56
53
  }, isLoading ? /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
57
54
  className: `${blockClass}--loading-skeleton`
58
55
  }) : /*#__PURE__*/React.createElement("div", {
59
- className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
56
+ className: `${blockClass}--body`,
57
+ "data-expanded": open
60
58
  }, /*#__PURE__*/React.createElement("div", {
61
59
  className: `${blockClass}--body-background`
62
60
  }), /*#__PURE__*/React.createElement("div", {
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;