@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
+ };
@@ -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
- 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;
@@ -9,11 +9,12 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
- var PropTypes = require('prop-types');
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');
@@ -46,14 +47,10 @@ const AnimatedHeader = ({
46
47
  const blockClass = `${prefix}--animated-header`;
47
48
  const animationContainer = React.useRef(null);
48
49
  const animRef = React.useRef(null);
49
- const [open, setOpen] = React.useState(true);
50
+ const [isOpen, setIsOpen] = React.useState(true);
50
51
  const isReduced = window.matchMedia('(prefers-reduced-motion)').matches;
51
- const collapsed = `${blockClass}--collapsed`;
52
- const contentCollapsed = `${blockClass}__content--collapsed`;
53
- const descriptionCollapsed = `${blockClass}__left-area-container--collapsed`;
54
- const lottieCollapsed = `${blockClass}__lottie-animation--collapsed`;
55
52
  const handleButtonCollapseClick = () => {
56
- setOpen(!open);
53
+ setIsOpen(!isOpen);
57
54
  };
58
55
  React.useEffect(() => {
59
56
  // Make sure any prior instance is destroyed before creating a new one
@@ -103,8 +100,11 @@ const AnimatedHeader = ({
103
100
  // Re-init when the JSON or reduced-motion preference changes
104
101
  }, [headerAnimation, isReduced]);
105
102
  return /*#__PURE__*/React.createElement("header", {
106
- className: `${blockClass}${!open ? ` ${collapsed}` : ''}`
107
- }, /*#__PURE__*/React.createElement(react.Grid, null, /*#__PURE__*/React.createElement("div", {
103
+ className: blockClass,
104
+ "data-expanded": isOpen
105
+ }, /*#__PURE__*/React.createElement(react.Grid, {
106
+ className: `${blockClass}__grid`
107
+ }, /*#__PURE__*/React.createElement("div", {
108
108
  className: `${blockClass}__gradient--overlay`
109
109
  }), /*#__PURE__*/React.createElement("div", {
110
110
  className: `${blockClass}__container--gradient`
@@ -122,7 +122,8 @@ const AnimatedHeader = ({
122
122
  className: `${blockClass}__lottie-animation--container`
123
123
  }, /*#__PURE__*/React.createElement("div", {
124
124
  ref: animationContainer,
125
- className: `${blockClass}__lottie-animation${!open ? ` ${lottieCollapsed}` : ''}`,
125
+ className: `${blockClass}__lottie-animation`,
126
+ "data-expanded": isOpen,
126
127
  "aria-hidden": "true"
127
128
  })), /*#__PURE__*/React.createElement(react.Column, {
128
129
  sm: 4,
@@ -131,14 +132,15 @@ const AnimatedHeader = ({
131
132
  }, /*#__PURE__*/React.createElement(HeaderTitle.default, {
132
133
  userName: userName,
133
134
  welcomeText: welcomeText,
134
- headerExpanded: open,
135
+ headerExpanded: isOpen,
135
136
  ariaLabels: ariaLabels
136
137
  })), (description || tasksControllerConfig) && /*#__PURE__*/React.createElement(react.Column, {
137
138
  sm: 4,
138
139
  md: 8,
139
140
  lg: 4,
140
141
  id: `${blockClass}-content`,
141
- className: `${blockClass}__left-area-container${!open ? ` ${descriptionCollapsed}` : ''}`
142
+ className: `${blockClass}__left-area-container`,
143
+ "data-expanded": isOpen
142
144
  }, description && /*#__PURE__*/React.createElement("h2", {
143
145
  className: `${blockClass}__description`,
144
146
  "aria-label": ariaLabels?.description ?? `Header description`
@@ -154,7 +156,8 @@ const AnimatedHeader = ({
154
156
  lg: 12,
155
157
  className: `${blockClass}__content`
156
158
  }, !!workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
157
- className: `${blockClass}__workspace--container${!open ? ` ${contentCollapsed}` : ''}`
159
+ className: `${blockClass}__workspace--container`,
160
+ "data-expanded": isOpen
158
161
  }, /*#__PURE__*/React.createElement(WorkspaceSelector.default, {
159
162
  workspaceSelectorConfig: workspaceSelectorConfig,
160
163
  userName: userName,
@@ -163,27 +166,30 @@ const AnimatedHeader = ({
163
166
  className: `${blockClass}__tiles-container`,
164
167
  "aria-label": ariaLabels?.tilesContainer ?? `Feature tiles`,
165
168
  role: "list"
166
- }, selectedTileGroup.tiles.map(tile => {
167
- return /*#__PURE__*/React.createElement(BaseTile.BaseTile, {
168
- onClick: tile.href || tile.onClick ? () => {
169
- tileClickHandler?.(tile);
170
- tile.onClick?.();
171
- } : null,
172
- key: tile.id,
173
- id: tile.id,
174
- open: open,
175
- href: tile.href,
176
- mainIcon: tile.mainIcon,
177
- secondaryIcon: tile.secondaryIcon,
178
- title: tile.title,
179
- subtitle: tile.subtitle,
169
+ }, selectedTileGroup.tiles.map((tile, index) => {
170
+ const {
171
+ tileId,
172
+ ...rest
173
+ } = tile;
174
+ const legacyId = tile.id; // old configs
175
+ const resolvedTileId = tileId ?? legacyId;
176
+ const key = resolvedTileId ?? `tile-${index}`;
177
+ const hasAction = tile.href || tile.onClick === 'function';
178
+ return /*#__PURE__*/React.createElement(BaseTile.BaseTile, _rollupPluginBabelHelpers.extends({
179
+ key: key,
180
+ tileId: resolvedTileId
181
+ }, rest, {
182
+ open: isOpen,
180
183
  productName: productName,
181
- customContent: tile.customContent,
182
184
  isLoading: isLoading || tile.isLoading,
183
- isDisabled: tile.isDisabled,
184
185
  disabledTaskLabel: disabledTaskLabel,
185
- ariaLabel: tile.ariaLabel
186
- });
186
+ onClick: hasAction ? () => {
187
+ tileClickHandler?.(tile);
188
+ if (typeof tile.onClick === 'function') {
189
+ tile.onClick();
190
+ }
191
+ } : undefined
192
+ }));
187
193
  }))), /*#__PURE__*/React.createElement("div", {
188
194
  className: `${blockClass}__button-collapse--gradient`
189
195
  }), /*#__PURE__*/React.createElement("div", {
@@ -191,12 +197,12 @@ const AnimatedHeader = ({
191
197
  }, /*#__PURE__*/React.createElement(react.Button, {
192
198
  id: `${blockClass}__button-collapse`,
193
199
  kind: "ghost",
194
- renderIcon: open ? iconsReact.ChevronUp : iconsReact.ChevronDown,
200
+ renderIcon: isOpen ? iconsReact.ChevronUp : iconsReact.ChevronDown,
195
201
  onClick: handleButtonCollapseClick,
196
- "aria-expanded": open,
202
+ "aria-expanded": isOpen,
197
203
  "aria-controls": `${blockClass}-content`,
198
- "aria-label": open ? ariaLabels?.collapseButton ?? 'Collapse header details' : ariaLabels?.expandButton ?? 'Expand header details'
199
- }, open ? collapseButtonLabel : expandButtonLabel))));
204
+ "aria-label": isOpen ? ariaLabels?.collapseButton ?? 'Collapse header details' : ariaLabels?.expandButton ?? 'Expand header details'
205
+ }, isOpen ? collapseButtonLabel : expandButtonLabel))));
200
206
  };
201
207
  AnimatedHeader.displayName = 'Animated Header';
202
208
  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 {};
@@ -13,25 +13,22 @@ 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`;
34
- const collapsed = `${blockClass}--collapsed`;
35
32
  const disabled = `${blockClass}--disabled`;
36
33
  const [textInput, setTextInput] = React.useState('');
37
34
  const handleTextInput = e => {
@@ -54,24 +51,25 @@ const AIPromptTile = ({
54
51
  "aria-label": ariaLabel ?? title ?? 'AI Tile',
55
52
  role: "listitem",
56
53
  title: isDisabled ? disabledTaskLabel ?? '' : '',
57
- key: id
54
+ key: tileId
58
55
  }, isLoading ? /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
59
56
  className: `${blockClass}--loading-skeleton`
60
57
  }) : /*#__PURE__*/React.createElement("div", {
61
- className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
58
+ className: `${blockClass}--body`,
59
+ "data-expanded": open
62
60
  }, /*#__PURE__*/React.createElement("div", {
63
61
  className: `${blockClass}--body-background`
64
62
  }), /*#__PURE__*/React.createElement("div", {
65
63
  className: `${blockClass}--body-gradient`
66
64
  }), /*#__PURE__*/React.createElement("div", {
67
65
  className: `${blockClass}--icons`
68
- }, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
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: "mini"
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: "Start chatting...",
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;