@carbon-labs/react-animated-header 0.1.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 (92) hide show
  1. package/LICENSE +201 -0
  2. package/es/__stories__/AnimatedHeader.stories.d.ts +17275 -0
  3. package/es/_virtual/_commonjsHelpers.js +12 -0
  4. package/es/_virtual/lottie.js +14 -0
  5. package/es/_virtual/lottie2.js +10 -0
  6. package/es/assets/index.d.ts +7 -0
  7. package/es/components/AnimatedHeader/AnimatedHeader.d.ts +31 -0
  8. package/es/components/AnimatedHeader/AnimatedHeader.js +277 -0
  9. package/es/components/Tiles/AIPromptTile/AIPromptTile.d.ts +20 -0
  10. package/es/components/Tiles/AIPromptTile/AIPromptTile.js +94 -0
  11. package/es/components/Tiles/BaseTile/BaseTile.d.ts +22 -0
  12. package/es/components/Tiles/BaseTile/BaseTile.js +39 -0
  13. package/es/components/Tiles/GlassTile/GlassTile.d.ts +21 -0
  14. package/es/components/Tiles/GlassTile/GlassTile.js +53 -0
  15. package/es/components/Tiles/index.d.ts +12 -0
  16. package/es/data/index.d.ts +47 -0
  17. package/es/index.d.ts +11 -0
  18. package/es/index.js +11 -0
  19. package/es/node_modules/@carbon/icon-helpers/es/index.js +125 -0
  20. package/es/node_modules/@carbon/icons-react/es/Icon.js +71 -0
  21. package/es/node_modules/@carbon/icons-react/es/generated/bucket-0.js +2967 -0
  22. package/es/node_modules/@carbon/icons-react/es/generated/bucket-1.js +3260 -0
  23. package/es/node_modules/@carbon/icons-react/es/generated/bucket-10.js +2906 -0
  24. package/es/node_modules/@carbon/icons-react/es/generated/bucket-11.js +3151 -0
  25. package/es/node_modules/@carbon/icons-react/es/generated/bucket-12.js +2966 -0
  26. package/es/node_modules/@carbon/icons-react/es/generated/bucket-13.js +3019 -0
  27. package/es/node_modules/@carbon/icons-react/es/generated/bucket-14.js +2923 -0
  28. package/es/node_modules/@carbon/icons-react/es/generated/bucket-15.js +3076 -0
  29. package/es/node_modules/@carbon/icons-react/es/generated/bucket-16.js +2913 -0
  30. package/es/node_modules/@carbon/icons-react/es/generated/bucket-17.js +2917 -0
  31. package/es/node_modules/@carbon/icons-react/es/generated/bucket-18.js +3141 -0
  32. package/es/node_modules/@carbon/icons-react/es/generated/bucket-19.js +811 -0
  33. package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +3195 -0
  34. package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +3119 -0
  35. package/es/node_modules/@carbon/icons-react/es/generated/bucket-4.js +3002 -0
  36. package/es/node_modules/@carbon/icons-react/es/generated/bucket-5.js +2929 -0
  37. package/es/node_modules/@carbon/icons-react/es/generated/bucket-6.js +2978 -0
  38. package/es/node_modules/@carbon/icons-react/es/generated/bucket-7.js +3017 -0
  39. package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +3149 -0
  40. package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +3084 -0
  41. package/es/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +14 -0
  42. package/es/node_modules/@carbon/icons-react/es/index.js +30 -0
  43. package/es/node_modules/@carbon-labs/utilities/es/usePrefix.js +20 -0
  44. package/es/node_modules/lottie-web/build/player/lottie.js +682 -0
  45. package/lib/__stories__/AnimatedHeader.stories.d.ts +17275 -0
  46. package/lib/_virtual/_commonjsHelpers.js +14 -0
  47. package/lib/_virtual/lottie.js +18 -0
  48. package/lib/_virtual/lottie2.js +12 -0
  49. package/lib/assets/index.d.ts +7 -0
  50. package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +31 -0
  51. package/lib/components/AnimatedHeader/AnimatedHeader.js +281 -0
  52. package/lib/components/Tiles/AIPromptTile/AIPromptTile.d.ts +20 -0
  53. package/lib/components/Tiles/AIPromptTile/AIPromptTile.js +96 -0
  54. package/lib/components/Tiles/BaseTile/BaseTile.d.ts +22 -0
  55. package/lib/components/Tiles/BaseTile/BaseTile.js +41 -0
  56. package/lib/components/Tiles/GlassTile/GlassTile.d.ts +21 -0
  57. package/lib/components/Tiles/GlassTile/GlassTile.js +55 -0
  58. package/lib/components/Tiles/index.d.ts +12 -0
  59. package/lib/data/index.d.ts +47 -0
  60. package/lib/index.d.ts +11 -0
  61. package/lib/index.js +18 -0
  62. package/lib/node_modules/@carbon/icon-helpers/es/index.js +128 -0
  63. package/lib/node_modules/@carbon/icons-react/es/Icon.js +75 -0
  64. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-0.js +3093 -0
  65. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-1.js +3386 -0
  66. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-10.js +3032 -0
  67. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-11.js +3277 -0
  68. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-12.js +3092 -0
  69. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-13.js +3145 -0
  70. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-14.js +3049 -0
  71. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-15.js +3202 -0
  72. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-16.js +3039 -0
  73. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-17.js +3043 -0
  74. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-18.js +3267 -0
  75. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-19.js +847 -0
  76. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +3321 -0
  77. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +3245 -0
  78. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-4.js +3128 -0
  79. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-5.js +3055 -0
  80. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-6.js +3104 -0
  81. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-7.js +3143 -0
  82. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +3275 -0
  83. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +3210 -0
  84. package/lib/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +16 -0
  85. package/lib/node_modules/@carbon/icons-react/es/index.js +2446 -0
  86. package/lib/node_modules/@carbon-labs/utilities/es/usePrefix.js +23 -0
  87. package/lib/node_modules/lottie-web/build/player/lottie.js +684 -0
  88. package/package.json +35 -0
  89. package/scss/AnimatedHeader/animated-header.scss +619 -0
  90. package/scss/Tiles/AIPromptTile/ai-prompt-tile.scss +187 -0
  91. package/scss/Tiles/GlassTile/glass-tile.scss +111 -0
  92. package/scss/animated_header.scss +10 -0
@@ -0,0 +1,14 @@
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
+ function getDefaultExportFromCjs (x) {
11
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
12
+ }
13
+
14
+ exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
@@ -0,0 +1,18 @@
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 _commonjsHelpers = require('./_commonjsHelpers.js');
13
+ var lottie$1 = require('../node_modules/lottie-web/build/player/lottie.js');
14
+
15
+ var lottieExports = lottie$1.__require();
16
+ var lottie = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(lottieExports);
17
+
18
+ exports.default = lottie;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var lottie = {exports: {}};
11
+
12
+ exports.__module = lottie;
@@ -0,0 +1,7 @@
1
+ import dataFabricAnimatedLight from './animated/header_1312x738_data_fabric_light_03.json';
2
+ import dataFabricAnimatedDark from './animated/header_1312x738_data_fabric_dark_06.json';
3
+ import watsonXAnimatedLight from './animated/header_1312x738_watsonx_data_light_03.json';
4
+ import watsonXAnimatedDark from './animated/header_1312x738_watsonx_data_dark_02.json';
5
+ import wxbiaAnimatedLight from './animated/header_illustration_container_wxbia_light_08.json';
6
+ import wxbiaAnimatedDark from './animated/header_illustration_container_wxbia_dark_05.json';
7
+ export { dataFabricAnimatedLight, dataFabricAnimatedDark, dataFabricStaticLight, dataFabricStaticDark, watsonXAnimatedLight, watsonXAnimatedDark, watsonXStaticLight, watsonXStaticDark, wxbiaAnimatedLight, wxbiaAnimatedDark };
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { ButtonKind } from '@carbon/react';
3
+ /** Animated Header */
4
+ export interface Tile {
5
+ id: string;
6
+ href: string;
7
+ title: string;
8
+ mainIcon: string;
9
+ }
10
+ export interface TileGroup {
11
+ id: number;
12
+ name: string;
13
+ tiles: Tile[];
14
+ }
15
+ export interface AnimatedHeaderProps {
16
+ name?: string;
17
+ description?: string;
18
+ buttonText?: string;
19
+ buttonType?: ButtonKind;
20
+ buttonIcon?: any;
21
+ headerDropdown?: boolean;
22
+ productName?: string;
23
+ tileDropdownItems?: Array<object>;
24
+ selectedTileGroup: TileGroup[] | any;
25
+ setSelectedTileGroup: (e: any) => void;
26
+ allTiles: TileGroup[];
27
+ headerAnimation?: object;
28
+ headerStatic?: React.JSX.Element;
29
+ }
30
+ declare const AnimatedHeader: React.FC<AnimatedHeaderProps>;
31
+ export default AnimatedHeader;
@@ -0,0 +1,281 @@
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 PropTypes = require('prop-types');
13
+ var React = require('react');
14
+ var react = require('@carbon/react');
15
+ var lottie = require('../../_virtual/lottie.js');
16
+ var usePrefix = require('../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
17
+ var BaseTile = require('../Tiles/BaseTile/BaseTile.js');
18
+ var bucket12 = require('../../node_modules/@carbon/icons-react/es/generated/bucket-12.js');
19
+ var bucket13 = require('../../node_modules/@carbon/icons-react/es/generated/bucket-13.js');
20
+ var bucket3 = require('../../node_modules/@carbon/icons-react/es/generated/bucket-3.js');
21
+
22
+ var _PauseFilled, _PlayFilledAlt;
23
+
24
+ /** Animated Header */
25
+
26
+ const AnimatedHeader = _ref => {
27
+ let {
28
+ name,
29
+ description,
30
+ buttonText,
31
+ buttonType = 'tertiary',
32
+ buttonIcon = null,
33
+ headerDropdown = false,
34
+ productName = '[Product name]',
35
+ tileDropdownItems,
36
+ selectedTileGroup,
37
+ setSelectedTileGroup,
38
+ allTiles,
39
+ headerAnimation,
40
+ headerStatic
41
+ } = _ref;
42
+ const prefix = usePrefix.usePrefix();
43
+ const blockClass = `${prefix}-animated-header`;
44
+ let animationContainer = /*#__PURE__*/React.createRef();
45
+ const [open, setOpen] = React.useState(true);
46
+ const [playing, setPlaying] = React.useState(true);
47
+ const [headingTextAnimation, setHeadingTextAnimation] = React.useState('');
48
+ const isReduced = window.matchMedia('(prefers-reduced-motion)').matches;
49
+ const collapsed = `${blockClass}--collapsed`;
50
+ const contentCollapsed = `${blockClass}__content--collapsed`;
51
+ const descriptionCollapsed = `${blockClass}__left-area-container--collapsed`;
52
+ const headingCollapsed = `${blockClass}__heading--collapsed`;
53
+ const headingExpanded = `${blockClass}__heading--expanded`;
54
+ const lottieCollapsed = `${blockClass}__lottie-animation--collapsed`;
55
+ const handleButtonCollapseClick = () => {
56
+ setOpen(!open);
57
+ open ? setHeadingTextAnimation(headingCollapsed) : setHeadingTextAnimation(headingExpanded);
58
+ };
59
+ const handleLottieAnimationClick = () => {
60
+ if (playing) {
61
+ lottie.default.pause();
62
+ } else {
63
+ lottie.default.play();
64
+ }
65
+ setPlaying(!playing);
66
+ };
67
+ React.useEffect(() => {
68
+ let animation = lottie.default.loadAnimation({
69
+ container: animationContainer.current,
70
+ animationData: headerAnimation,
71
+ renderer: 'svg',
72
+ loop: false,
73
+ autoplay: false
74
+ });
75
+ const lottieLoadSpeed = 1;
76
+ const lottieLoopSpeed = 1;
77
+ const animationData = animation['animationData'];
78
+ function reducedMotion() {
79
+ animation.goToAndStop(5000);
80
+ }
81
+ function load() {
82
+ animation.setSpeed(lottieLoadSpeed);
83
+ animation.playSegments([animationData.markers.at(0).tm, animationData.markers.at(1).tm], true);
84
+ }
85
+ function loop() {
86
+ animation.setSpeed(lottieLoopSpeed);
87
+ animation.playSegments([animationData.markers.at(1).tm, animationData.op], true);
88
+ }
89
+ if (!!isReduced) {
90
+ // reduced motion on
91
+ animation.addEventListener('DOMLoaded', reducedMotion);
92
+ } else {
93
+ // reduced motion off
94
+
95
+ // Run Start Animation
96
+ animation.addEventListener('DOMLoaded', load);
97
+
98
+ // Run Looped Animation
99
+ animation.addEventListener('complete', loop);
100
+ }
101
+ }, []);
102
+ return /*#__PURE__*/React.createElement("section", {
103
+ className: `${blockClass} ${!open && collapsed}`
104
+ }, /*#__PURE__*/React.createElement(react.Grid, null, /*#__PURE__*/React.createElement("div", {
105
+ className: `${blockClass}__gradient--overlay`
106
+ }), /*#__PURE__*/React.createElement("div", {
107
+ className: `${blockClass}__container--gradient`
108
+ }), !headerAnimation && headerStatic && /*#__PURE__*/React.createElement("div", {
109
+ className: `${blockClass}__static--container`
110
+ }, /*#__PURE__*/React.createElement("div", {
111
+ className: `${blockClass}__static`,
112
+ style: {
113
+ backgroundImage: `url(${headerStatic})`
114
+ }
115
+ })), /*#__PURE__*/React.createElement("div", {
116
+ className: `${blockClass}__lottie-animation--container`
117
+ }, /*#__PURE__*/React.createElement("div", {
118
+ ref: animationContainer,
119
+ className: `${blockClass}__lottie-animation ${!open && lottieCollapsed}`
120
+ })), /*#__PURE__*/React.createElement(react.Column, {
121
+ sm: 4,
122
+ md: 8,
123
+ lg: 16
124
+ }, /*#__PURE__*/React.createElement(react.Tooltip, {
125
+ align: "bottom",
126
+ label: `Welcome, ${name}`
127
+ }, /*#__PURE__*/React.createElement("h1", {
128
+ className: `${blockClass}__heading ${headingTextAnimation}`
129
+ }, /*#__PURE__*/React.createElement("span", {
130
+ className: `${blockClass}__heading-welcome`
131
+ }, "Welcome,", ' '), /*#__PURE__*/React.createElement("span", {
132
+ className: `${blockClass}__heading-name`
133
+ }, name)))), (description || buttonText || headerDropdown) && /*#__PURE__*/React.createElement(react.Column, {
134
+ sm: 4,
135
+ md: 8,
136
+ lg: 4,
137
+ className: `${blockClass}__left-area-container ${!open && descriptionCollapsed}`
138
+ }, description && /*#__PURE__*/React.createElement(react.Tooltip, {
139
+ align: "bottom",
140
+ label: description
141
+ }, /*#__PURE__*/React.createElement("h2", {
142
+ className: `${blockClass}__description`
143
+ }, description)), buttonText && /*#__PURE__*/React.createElement(react.Button, {
144
+ className: `${blockClass}__button`,
145
+ kind: buttonType,
146
+ renderIcon: buttonIcon
147
+ }, buttonText), !buttonText && headerDropdown && allTiles && /*#__PURE__*/React.createElement(react.Dropdown, {
148
+ id: `${blockClass}__header-dropdown`,
149
+ className: `${blockClass}__header-dropdown`,
150
+ size: "md",
151
+ autoAlign: true,
152
+ titleText: "Label",
153
+ initialSelectedItem: allTiles[0],
154
+ label: allTiles[0].name,
155
+ hideLabel: true,
156
+ type: "inline",
157
+ items: allTiles,
158
+ itemToString: item => item ? item.name : '',
159
+ onChange: e => setSelectedTileGroup(e)
160
+ })), selectedTileGroup && /*#__PURE__*/React.createElement(react.Column, {
161
+ sm: 4,
162
+ md: 8,
163
+ lg: 12,
164
+ className: `${blockClass}__content`
165
+ }, tileDropdownItems && /*#__PURE__*/React.createElement("div", {
166
+ className: `${blockClass}__tile-dropdown--container ${!open && contentCollapsed}`
167
+ }, /*#__PURE__*/React.createElement(react.Dropdown, {
168
+ id: `${blockClass}__tile-dropdown`,
169
+ className: `${blockClass}__tile-dropdown`,
170
+ size: "sm",
171
+ titleText: "Label",
172
+ label: `Open in: ${name}'s sandbox`,
173
+ hideLabel: true,
174
+ type: "inline",
175
+ items: tileDropdownItems,
176
+ itemToString: item => item ? item['text'] : ''
177
+ })), /*#__PURE__*/React.createElement("div", {
178
+ className: `${blockClass}__tiles-container`
179
+ }, selectedTileGroup.tiles.map(tile => {
180
+ return /*#__PURE__*/React.createElement(BaseTile.BaseTile, {
181
+ key: tile.id,
182
+ id: tile.id,
183
+ open: open,
184
+ href: tile.href,
185
+ mainIcon: tile.mainIcon,
186
+ secondaryIcon: tile.secondaryIcon,
187
+ title: tile.title,
188
+ subtitle: tile.subtitle,
189
+ productName: productName
190
+ });
191
+ }))), /*#__PURE__*/React.createElement("div", {
192
+ className: `${blockClass}__button-collapse--gradient`
193
+ }), /*#__PURE__*/React.createElement("div", {
194
+ className: `${blockClass}__button-collapse--container`
195
+ }, headerAnimation && !isReduced && /*#__PURE__*/React.createElement(react.IconButton, {
196
+ className: `${blockClass}__icon-button`,
197
+ label: playing ? 'Pause' : 'Play',
198
+ kind: "ghost",
199
+ type: "button",
200
+ onClick: handleLottieAnimationClick
201
+ }, playing ? _PauseFilled || (_PauseFilled = /*#__PURE__*/React.createElement(bucket12.PauseFilled, {
202
+ size: 16,
203
+ fill: `var(--cds-icon-secondary)`
204
+ })) : _PlayFilledAlt || (_PlayFilledAlt = /*#__PURE__*/React.createElement(bucket13.PlayFilledAlt, {
205
+ size: 16,
206
+ fill: `var(--cds-icon-secondary)`
207
+ }))), /*#__PURE__*/React.createElement(react.Button, {
208
+ id: `${blockClass}__button-collapse`,
209
+ kind: "ghost",
210
+ renderIcon: open ? bucket3.ChevronUp : bucket3.ChevronDown,
211
+ onClick: handleButtonCollapseClick
212
+ }, open ? `Collapse` : `Expand`))));
213
+ };
214
+ AnimatedHeader.displayName = 'Animated Header';
215
+ AnimatedHeader.propTypes = {
216
+ /**
217
+ * Specify an optional className to be added to your Animated Header
218
+ */
219
+ className: PropTypes.string,
220
+ /**
221
+ * Specify the current username of active user
222
+ */
223
+ name: PropTypes.string,
224
+ /**
225
+ * Provide short sentence in max. 3 lines related to product context
226
+ */
227
+ description: PropTypes.string,
228
+ /**
229
+ * (optional), Provide content that needs highest attention from
230
+ * the user or content that triggers an action and allow users to
231
+ * directly start working and gain value (within one click)
232
+ */
233
+ buttonText: PropTypes.string,
234
+ /**
235
+ * Specify the carbon button type
236
+ */
237
+ buttonType: react.ButtonKinds,
238
+ /**
239
+ * (optional), Provide the renderIcon used in the button
240
+ * ex. Launch, Add, ect.
241
+ */
242
+ buttonIcon: PropTypes.any,
243
+ /**
244
+ * Header dropdown menu when button/buttonText is not in use
245
+ */
246
+ headerDropdown: PropTypes.bool,
247
+ /**
248
+ * Provide current product name
249
+ */
250
+ productName: PropTypes.string,
251
+ /**
252
+ * Object containing dropdown items
253
+ * `Open in: "_"`
254
+ */
255
+ tileDropdownItems: PropTypes.arrayOf(PropTypes.object),
256
+ /**
257
+ * The tile group that is active in the header
258
+ * ex. "AI Chat Tile w/ two glass tiles", "Four glass tiles", ect.
259
+ */
260
+ selectedTileGroup: PropTypes.object,
261
+ /**
262
+ * Provide function to be called when switching selected tile group
263
+ */
264
+ setSelectedTileGroup: PropTypes.func,
265
+ /**
266
+ * Array of each tile group setup
267
+ */
268
+ allTiles: PropTypes.arrayOf(PropTypes.object),
269
+ /**
270
+ * In-product imagery / lottie animation (.json) dim. 1312 x 738
271
+ * (to update headerAnimation content storybook requires remount in toolbar)
272
+ */
273
+ headerAnimation: PropTypes.object,
274
+ /**
275
+ * In-product imagery / static imagery dim. 1312 x 738
276
+ * Only active when headerAnimation is not in use
277
+ */
278
+ headerStatic: PropTypes.object
279
+ };
280
+
281
+ exports.default = AnimatedHeader;
@@ -0,0 +1,20 @@
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';
10
+ /** Primary UI component for user interaction */
11
+ interface AIPromptTileProps {
12
+ id?: string;
13
+ href?: string;
14
+ open?: boolean;
15
+ mainIcon?: string;
16
+ title?: string;
17
+ productName?: string;
18
+ }
19
+ export declare const AIPromptTile: React.FC<AIPromptTileProps>;
20
+ export {};
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var React = require('react');
11
+ var react = require('@carbon/react');
12
+ var index = require('../../../node_modules/@carbon/icons-react/es/index.js');
13
+ var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
14
+ var bucket14 = require('../../../node_modules/@carbon/icons-react/es/generated/bucket-14.js');
15
+
16
+ var _AILabel;
17
+
18
+ /** Primary UI component for user interaction */
19
+
20
+ const AIPromptTile = _ref => {
21
+ let {
22
+ id,
23
+ href,
24
+ open,
25
+ mainIcon,
26
+ title,
27
+ productName
28
+ } = _ref;
29
+ const prefix = usePrefix.usePrefix();
30
+ const blockClass = `${prefix}-animated-header__ai-prompt-tile`;
31
+ const collapsed = `${blockClass}--collapsed`;
32
+ const [textInput, setTextInput] = React.useState('');
33
+ const MainIcon = mainIcon ? index[mainIcon] : null;
34
+ const Send = bucket14.Send;
35
+ const handleTextInput = e => {
36
+ setTextInput(e.target.value);
37
+ };
38
+ const openInNewTab = url => {
39
+ const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
40
+ if (newWindow) newWindow.opener = null;
41
+ };
42
+ const handleTextInputKeyDown = event => {
43
+ if (event.key === 'Enter') {
44
+ console.log('do validate');
45
+ openInNewTab(`${href}&primed_chat=${textInput}`);
46
+ }
47
+ };
48
+ return /*#__PURE__*/React.createElement("div", {
49
+ id: `${blockClass}`,
50
+ className: `${prefix}-animated-header__tile ${blockClass}`,
51
+ key: id
52
+ }, /*#__PURE__*/React.createElement("div", {
53
+ className: `${blockClass}--body ${!open && collapsed}`
54
+ }, /*#__PURE__*/React.createElement("div", {
55
+ className: `${blockClass}--icons`
56
+ }, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
57
+ fill: `var(--cds-icon-secondary)`,
58
+ size: 24
59
+ }), _AILabel || (_AILabel = /*#__PURE__*/React.createElement(react.AILabel, {
60
+ autoAlign: true,
61
+ aiText: "AI",
62
+ size: "mini"
63
+ }))), /*#__PURE__*/React.createElement("div", {
64
+ className: `${blockClass}--title`
65
+ }, title), /*#__PURE__*/React.createElement("div", {
66
+ className: `${blockClass}--text-input-container ${textInput && `${blockClass}--text-input-container__active`}`
67
+ }, /*#__PURE__*/React.createElement(react.TextInput, {
68
+ id: `${blockClass}--text-input`,
69
+ className: `${blockClass}--text-input`,
70
+ type: "text",
71
+ labelText: "AI Chat Input",
72
+ hideLabel: true,
73
+ placeholder: "Start chatting...",
74
+ size: "sm",
75
+ onChange: handleTextInput,
76
+ onKeyDown: handleTextInputKeyDown,
77
+ value: textInput
78
+ }), /*#__PURE__*/React.createElement(react.IconButton, {
79
+ className: `${blockClass}--icon-button ${textInput && `${blockClass}--icon-button__active`}`,
80
+ label: `Chat in ${productName}`,
81
+ kind: "ghost",
82
+ size: "sm",
83
+ disabled: !textInput,
84
+ align: "top-right",
85
+ onClick: () => openInNewTab(`${href}&primed_chat=${textInput}`),
86
+ onKeyDown: handleTextInputKeyDown
87
+ }, /*#__PURE__*/React.createElement(Send, null))), /*#__PURE__*/React.createElement("div", {
88
+ className: `${blockClass}--footer`
89
+ }, /*#__PURE__*/React.createElement(react.Button, {
90
+ kind: "ghost",
91
+ size: "sm",
92
+ href: href
93
+ }, "Open ", productName))));
94
+ };
95
+
96
+ exports.AIPromptTile = AIPromptTile;
@@ -0,0 +1,22 @@
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';
10
+ /** Base Tile */
11
+ interface BaseTileProps {
12
+ id?: string;
13
+ open?: boolean;
14
+ href?: string;
15
+ mainIcon?: string;
16
+ secondaryIcon?: string;
17
+ title?: string;
18
+ productName?: string;
19
+ subtitle?: string;
20
+ }
21
+ export declare const BaseTile: React.FC<BaseTileProps>;
22
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var React = require('react');
11
+ var AIPromptTile = require('../AIPromptTile/AIPromptTile.js');
12
+ var GlassTile = require('../GlassTile/GlassTile.js');
13
+
14
+ /** Base Tile */
15
+
16
+ const BaseTile = _ref => {
17
+ let {
18
+ id,
19
+ open,
20
+ href,
21
+ mainIcon,
22
+ secondaryIcon,
23
+ title,
24
+ productName,
25
+ subtitle
26
+ } = _ref;
27
+ const props = {
28
+ id,
29
+ open,
30
+ href,
31
+ mainIcon,
32
+ secondaryIcon,
33
+ title,
34
+ productName,
35
+ subtitle
36
+ };
37
+ const tile = id === 'ai-tile' ? /*#__PURE__*/React.createElement(AIPromptTile.AIPromptTile, props) : /*#__PURE__*/React.createElement(GlassTile.GlassTile, props);
38
+ return tile;
39
+ };
40
+
41
+ exports.BaseTile = BaseTile;
@@ -0,0 +1,21 @@
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';
10
+ /** Primary UI component for user interaction */
11
+ interface GlassTileProps {
12
+ id?: string;
13
+ href?: string;
14
+ open?: boolean;
15
+ mainIcon?: string;
16
+ secondaryIcon?: string;
17
+ title?: string;
18
+ subtitle?: string;
19
+ }
20
+ export declare const GlassTile: React.FC<GlassTileProps>;
21
+ export {};
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var React = require('react');
11
+ var react = require('@carbon/react');
12
+ var index = require('../../../node_modules/@carbon/icons-react/es/index.js');
13
+ var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
14
+
15
+ /** Primary UI component for user interaction */
16
+
17
+ const GlassTile = _ref => {
18
+ let {
19
+ id,
20
+ href,
21
+ open,
22
+ mainIcon,
23
+ secondaryIcon,
24
+ title,
25
+ subtitle
26
+ } = _ref;
27
+ const prefix = usePrefix.usePrefix();
28
+ const blockClass = `${prefix}-animated-header__glass-tile`;
29
+ const collapsed = `${blockClass}--collapsed`;
30
+ const MainIcon = mainIcon ? index[mainIcon] : null;
31
+ const SecondaryIcon = secondaryIcon ? index[secondaryIcon] : null;
32
+ return /*#__PURE__*/React.createElement(react.Link, {
33
+ className: `${prefix}-animated-header__tile ${blockClass}`,
34
+ key: id,
35
+ href: href
36
+ }, /*#__PURE__*/React.createElement("div", {
37
+ className: `${blockClass}--body ${!open && collapsed}`
38
+ }, /*#__PURE__*/React.createElement("div", {
39
+ className: `${blockClass}--icons`
40
+ }, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
41
+ fill: `var(--cds-icon-secondary)`,
42
+ size: 24
43
+ })), /*#__PURE__*/React.createElement("div", {
44
+ className: `${blockClass}--title`
45
+ }, title), /*#__PURE__*/React.createElement("div", {
46
+ className: `${blockClass}--footer`
47
+ }, subtitle && /*#__PURE__*/React.createElement("div", {
48
+ className: `${blockClass}--subtitle`
49
+ }, subtitle), SecondaryIcon && /*#__PURE__*/React.createElement(SecondaryIcon, {
50
+ size: 16,
51
+ fill: `var(--cds-icon-secondary)`
52
+ }))));
53
+ };
54
+
55
+ exports.GlassTile = GlassTile;
@@ -0,0 +1,12 @@
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 { AIPromptTile } from './AIPromptTile/AIPromptTile';
10
+ import { BaseTile } from './BaseTile/BaseTile';
11
+ import { GlassTile } from './GlassTile/GlassTile';
12
+ export { AIPromptTile, BaseTile, GlassTile };
@@ -0,0 +1,47 @@
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
+ export const tileDropdownData: {
10
+ id: string;
11
+ text: string;
12
+ }[];
13
+ export const headerTiles: ({
14
+ id: number;
15
+ name: string;
16
+ tiles: ({
17
+ id: string;
18
+ href: string;
19
+ title: string;
20
+ mainIcon: string;
21
+ subtitle?: undefined;
22
+ } | {
23
+ id: string;
24
+ href: string;
25
+ title: string;
26
+ subtitle: string;
27
+ mainIcon: string;
28
+ })[];
29
+ } | {
30
+ id: number;
31
+ name: string;
32
+ tiles: ({
33
+ id: string;
34
+ href: string;
35
+ title: string;
36
+ subtitle: string;
37
+ mainIcon: string;
38
+ secondaryIcon?: undefined;
39
+ } | {
40
+ id: string;
41
+ href: string;
42
+ title: string;
43
+ mainIcon: string;
44
+ secondaryIcon: string;
45
+ subtitle?: undefined;
46
+ })[];
47
+ })[];