@carbon-labs/react-animated-header 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/__stories__/AnimatedHeader.stories.d.ts +438 -520
- package/es/__stories__/data/index.d.ts +19 -9
- package/es/components/AnimatedHeader/AnimatedHeader.d.ts +31 -12
- package/es/components/AnimatedHeader/AnimatedHeader.js +76 -65
- package/es/components/Tiles/AIPromptTile/AIPromptTile.d.ts +3 -3
- package/es/components/Tiles/AIPromptTile/AIPromptTile.js +10 -8
- package/es/components/Tiles/BaseTile/BaseTile.d.ts +1 -1
- package/es/components/Tiles/BaseTile/BaseTile.js +4 -4
- package/es/components/Tiles/GlassTile/GlassTile.d.ts +3 -3
- package/es/components/Tiles/GlassTile/GlassTile.js +6 -6
- package/es/node_modules/@carbon/icons-react/es/Icon.js +1 -1
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-0.js +392 -403
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-1.js +679 -676
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-10.js +808 -768
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-11.js +959 -998
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-12.js +827 -826
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-13.js +890 -853
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-14.js +741 -776
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-15.js +935 -939
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-16.js +839 -760
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-17.js +705 -779
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-18.js +941 -1002
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-19.js +992 -123
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +676 -775
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +803 -719
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-4.js +834 -828
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-5.js +768 -781
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-6.js +836 -822
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-7.js +816 -850
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +943 -986
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +921 -915
- package/es/node_modules/@carbon/icons-react/es/index.js +20 -20
- package/lib/__stories__/AnimatedHeader.stories.d.ts +438 -520
- package/lib/__stories__/data/index.d.ts +19 -9
- package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +31 -12
- package/lib/components/AnimatedHeader/AnimatedHeader.js +75 -64
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.d.ts +3 -3
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.js +11 -9
- package/lib/components/Tiles/BaseTile/BaseTile.d.ts +1 -1
- package/lib/components/Tiles/BaseTile/BaseTile.js +4 -4
- package/lib/components/Tiles/GlassTile/GlassTile.d.ts +3 -3
- package/lib/components/Tiles/GlassTile/GlassTile.js +6 -6
- package/lib/node_modules/@carbon/icons-react/es/Icon.js +1 -1
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-0.js +394 -405
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-1.js +686 -683
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-10.js +833 -793
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-11.js +985 -1024
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-12.js +854 -853
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-13.js +920 -883
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-14.js +771 -806
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-15.js +966 -970
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-16.js +871 -792
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-17.js +738 -812
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-18.js +974 -1035
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-19.js +1025 -122
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +684 -783
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +811 -727
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-4.js +843 -837
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-5.js +778 -791
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-6.js +848 -834
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-7.js +832 -866
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +964 -1007
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +943 -937
- package/lib/node_modules/@carbon/icons-react/es/index.js +435 -401
- package/package.json +2 -2
- package/scss/AnimatedHeader/animated-header.scss +31 -17
- package/scss/Tiles/AIPromptTile/ai-prompt-tile.scss +12 -5
- package/scss/Tiles/GlassTile/glass-tile.scss +17 -3
- /package/es/node_modules/@carbon/{icon-helpers → icons-react/node_modules/@carbon/icon-helpers}/es/index.js +0 -0
- /package/lib/node_modules/@carbon/{icon-helpers → icons-react/node_modules/@carbon/icon-helpers}/es/index.js +0 -0
|
@@ -1,12 +1,4 @@
|
|
|
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: {
|
|
1
|
+
export const workspaceData: {
|
|
10
2
|
id: string;
|
|
11
3
|
text: string;
|
|
12
4
|
}[];
|
|
@@ -45,3 +37,21 @@ export const headerTiles: ({
|
|
|
45
37
|
subtitle?: undefined;
|
|
46
38
|
})[];
|
|
47
39
|
})[];
|
|
40
|
+
export namespace tasksConfigButton {
|
|
41
|
+
let type: string;
|
|
42
|
+
namespace button {
|
|
43
|
+
export let href: string;
|
|
44
|
+
export { Add as icon };
|
|
45
|
+
export let text: string;
|
|
46
|
+
let type_1: "tertiary";
|
|
47
|
+
export { type_1 as type };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export namespace tasksConfigDropdown {
|
|
51
|
+
let type_2: string;
|
|
52
|
+
export { type_2 as type };
|
|
53
|
+
export namespace dropdown {
|
|
54
|
+
let label: string;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
import { Add } from '@carbon/react/icons';
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonKind } from '@carbon/react';
|
|
3
3
|
/** Animated Header */
|
|
4
|
+
export interface TasksConfig {
|
|
5
|
+
type: 'button' | 'dropdown' | string;
|
|
6
|
+
button?: {
|
|
7
|
+
href?: string;
|
|
8
|
+
icon?: any;
|
|
9
|
+
text?: string;
|
|
10
|
+
type?: ButtonKind;
|
|
11
|
+
};
|
|
12
|
+
dropdown?: {
|
|
13
|
+
label?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface SelectedWorkspace {
|
|
17
|
+
id: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}
|
|
4
20
|
export interface Tile {
|
|
21
|
+
href: string | null;
|
|
5
22
|
id: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
23
|
+
mainIcon: string | null;
|
|
24
|
+
secondaryIcon?: string | null;
|
|
25
|
+
subtitle?: string | null;
|
|
26
|
+
title: string | null;
|
|
9
27
|
}
|
|
10
28
|
export interface TileGroup {
|
|
11
29
|
id: number;
|
|
@@ -13,19 +31,20 @@ export interface TileGroup {
|
|
|
13
31
|
tiles: Tile[];
|
|
14
32
|
}
|
|
15
33
|
export interface AnimatedHeaderProps {
|
|
16
|
-
|
|
34
|
+
allTiles: TileGroup[];
|
|
35
|
+
allWorkspaces?: SelectedWorkspace[];
|
|
17
36
|
description?: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
buttonIcon?: any;
|
|
21
|
-
headerDropdown?: boolean;
|
|
37
|
+
headerAnimation?: object;
|
|
38
|
+
headerStatic?: React.JSX.Element;
|
|
22
39
|
productName?: string;
|
|
23
|
-
tileDropdownItems?: Array<object>;
|
|
24
40
|
selectedTileGroup: TileGroup[] | any;
|
|
41
|
+
selectedWorkspace?: SelectedWorkspace | any;
|
|
25
42
|
setSelectedTileGroup: (e: any) => void;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
43
|
+
setSelectedWorkspace: (e: any) => void;
|
|
44
|
+
tasksConfig?: TasksConfig;
|
|
45
|
+
userName?: string;
|
|
46
|
+
welcomeText?: string;
|
|
47
|
+
workspaceLabel?: string;
|
|
29
48
|
}
|
|
30
49
|
declare const AnimatedHeader: React.FC<AnimatedHeaderProps>;
|
|
31
50
|
export default AnimatedHeader;
|
|
@@ -25,23 +25,24 @@ var _PauseFilled, _PlayFilledAlt;
|
|
|
25
25
|
|
|
26
26
|
const AnimatedHeader = _ref => {
|
|
27
27
|
let {
|
|
28
|
-
|
|
28
|
+
allTiles,
|
|
29
|
+
allWorkspaces,
|
|
29
30
|
description,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
buttonIcon = null,
|
|
33
|
-
headerDropdown = false,
|
|
31
|
+
headerAnimation,
|
|
32
|
+
headerStatic,
|
|
34
33
|
productName = '[Product name]',
|
|
35
|
-
tileDropdownItems,
|
|
36
34
|
selectedTileGroup,
|
|
35
|
+
selectedWorkspace,
|
|
37
36
|
setSelectedTileGroup,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
setSelectedWorkspace,
|
|
38
|
+
tasksConfig,
|
|
39
|
+
userName,
|
|
40
|
+
welcomeText,
|
|
41
|
+
workspaceLabel = `Open in: ${userName}'s workspace` || `Select a workspace`
|
|
41
42
|
} = _ref;
|
|
42
43
|
const prefix = usePrefix.usePrefix();
|
|
43
|
-
const blockClass = `${prefix}
|
|
44
|
-
|
|
44
|
+
const blockClass = `${prefix}--animated-header`;
|
|
45
|
+
const animationContainer = /*#__PURE__*/React.createRef();
|
|
45
46
|
const [open, setOpen] = React.useState(true);
|
|
46
47
|
const [playing, setPlaying] = React.useState(true);
|
|
47
48
|
const [headingTextAnimation, setHeadingTextAnimation] = React.useState('');
|
|
@@ -65,7 +66,7 @@ const AnimatedHeader = _ref => {
|
|
|
65
66
|
setPlaying(!playing);
|
|
66
67
|
};
|
|
67
68
|
React.useEffect(() => {
|
|
68
|
-
|
|
69
|
+
const animation = lottie.default.loadAnimation({
|
|
69
70
|
container: animationContainer.current,
|
|
70
71
|
animationData: headerAnimation,
|
|
71
72
|
renderer: 'svg',
|
|
@@ -86,7 +87,7 @@ const AnimatedHeader = _ref => {
|
|
|
86
87
|
animation.setSpeed(lottieLoopSpeed);
|
|
87
88
|
animation.playSegments([animationData.markers.at(1).tm, animationData.op], true);
|
|
88
89
|
}
|
|
89
|
-
if (
|
|
90
|
+
if (isReduced) {
|
|
90
91
|
// reduced motion on
|
|
91
92
|
animation.addEventListener('DOMLoaded', reducedMotion);
|
|
92
93
|
} else {
|
|
@@ -98,7 +99,12 @@ const AnimatedHeader = _ref => {
|
|
|
98
99
|
// Run Looped Animation
|
|
99
100
|
animation.addEventListener('complete', loop);
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
+
return () => {
|
|
103
|
+
animation?.removeEventListener('DOMLoaded', reducedMotion);
|
|
104
|
+
animation?.removeEventListener('DOMLoaded', load);
|
|
105
|
+
animation?.removeEventListener('complete', loop);
|
|
106
|
+
};
|
|
107
|
+
}, [animationContainer, headerAnimation, isReduced]);
|
|
102
108
|
return /*#__PURE__*/React.createElement("section", {
|
|
103
109
|
className: `${blockClass} ${!open && collapsed}`
|
|
104
110
|
}, /*#__PURE__*/React.createElement(react.Grid, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -123,14 +129,14 @@ const AnimatedHeader = _ref => {
|
|
|
123
129
|
lg: 16
|
|
124
130
|
}, /*#__PURE__*/React.createElement(react.Tooltip, {
|
|
125
131
|
align: "bottom",
|
|
126
|
-
label:
|
|
132
|
+
label: `${welcomeText}, ${userName}`
|
|
127
133
|
}, /*#__PURE__*/React.createElement("h1", {
|
|
128
134
|
className: `${blockClass}__heading ${headingTextAnimation}`
|
|
129
135
|
}, /*#__PURE__*/React.createElement("span", {
|
|
130
136
|
className: `${blockClass}__heading-welcome`
|
|
131
|
-
}, "
|
|
137
|
+
}, welcomeText, ",", ' '), /*#__PURE__*/React.createElement("span", {
|
|
132
138
|
className: `${blockClass}__heading-name`
|
|
133
|
-
},
|
|
139
|
+
}, userName)))), (description || tasksConfig && tasksConfig.type === 'button' && tasksConfig.button?.text || tasksConfig && tasksConfig.type === 'dropdown' && tasksConfig.dropdown?.label) && /*#__PURE__*/React.createElement(react.Column, {
|
|
134
140
|
sm: 4,
|
|
135
141
|
md: 8,
|
|
136
142
|
lg: 4,
|
|
@@ -140,40 +146,42 @@ const AnimatedHeader = _ref => {
|
|
|
140
146
|
label: description
|
|
141
147
|
}, /*#__PURE__*/React.createElement("h2", {
|
|
142
148
|
className: `${blockClass}__description`
|
|
143
|
-
}, description)),
|
|
149
|
+
}, description)), tasksConfig?.button?.text && /*#__PURE__*/React.createElement(react.Button, {
|
|
144
150
|
className: `${blockClass}__button`,
|
|
145
|
-
kind:
|
|
146
|
-
renderIcon:
|
|
147
|
-
|
|
151
|
+
kind: tasksConfig.button.type,
|
|
152
|
+
renderIcon: tasksConfig.button.icon,
|
|
153
|
+
href: tasksConfig.button.href
|
|
154
|
+
}, tasksConfig.button.text), !tasksConfig?.button?.text && tasksConfig && tasksConfig.type === 'dropdown' && allTiles && /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
className: `${blockClass}__header-dropdown--container`
|
|
156
|
+
}, /*#__PURE__*/React.createElement(react.Dropdown, {
|
|
148
157
|
id: `${blockClass}__header-dropdown`,
|
|
149
158
|
className: `${blockClass}__header-dropdown`,
|
|
150
159
|
size: "md",
|
|
151
|
-
autoAlign: true,
|
|
152
160
|
titleText: "Label",
|
|
153
|
-
|
|
154
|
-
label: allTiles[0].name,
|
|
161
|
+
label: tasksConfig.dropdown?.label || allTiles[0].name,
|
|
155
162
|
hideLabel: true,
|
|
156
163
|
type: "inline",
|
|
157
164
|
items: allTiles,
|
|
158
165
|
itemToString: item => item ? item.name : '',
|
|
159
166
|
onChange: e => setSelectedTileGroup(e)
|
|
160
|
-
})), selectedTileGroup && /*#__PURE__*/React.createElement(react.Column, {
|
|
167
|
+
}))), selectedTileGroup && /*#__PURE__*/React.createElement(react.Column, {
|
|
161
168
|
sm: 4,
|
|
162
169
|
md: 8,
|
|
163
170
|
lg: 12,
|
|
164
171
|
className: `${blockClass}__content`
|
|
165
|
-
},
|
|
166
|
-
className: `${blockClass}
|
|
172
|
+
}, allWorkspaces && /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: `${blockClass}__workspace--container ${!open && contentCollapsed}`
|
|
167
174
|
}, /*#__PURE__*/React.createElement(react.Dropdown, {
|
|
168
|
-
id: `${blockClass}
|
|
169
|
-
className: `${blockClass}
|
|
175
|
+
id: `${blockClass}__workspace`,
|
|
176
|
+
className: `${blockClass}__workspace`,
|
|
170
177
|
size: "sm",
|
|
171
178
|
titleText: "Label",
|
|
172
|
-
label:
|
|
179
|
+
label: workspaceLabel,
|
|
173
180
|
hideLabel: true,
|
|
174
181
|
type: "inline",
|
|
175
|
-
items:
|
|
176
|
-
itemToString: item => item ? item['text'] : ''
|
|
182
|
+
items: allWorkspaces,
|
|
183
|
+
itemToString: item => item ? item['text'] : '',
|
|
184
|
+
onChange: e => setSelectedWorkspace(e)
|
|
177
185
|
})), /*#__PURE__*/React.createElement("div", {
|
|
178
186
|
className: `${blockClass}__tiles-container`
|
|
179
187
|
}, selectedTileGroup.tiles.map(tile => {
|
|
@@ -214,68 +222,71 @@ const AnimatedHeader = _ref => {
|
|
|
214
222
|
AnimatedHeader.displayName = 'Animated Header';
|
|
215
223
|
AnimatedHeader.propTypes = {
|
|
216
224
|
/**
|
|
217
|
-
*
|
|
218
|
-
*/
|
|
219
|
-
className: PropTypes.string,
|
|
220
|
-
/**
|
|
221
|
-
* Specify the current username of active user
|
|
225
|
+
* Array of each tile group setup
|
|
222
226
|
*/
|
|
223
|
-
|
|
227
|
+
allTiles: PropTypes.arrayOf(PropTypes.object),
|
|
224
228
|
/**
|
|
225
|
-
*
|
|
229
|
+
* Array of all workspace options
|
|
226
230
|
*/
|
|
227
|
-
|
|
231
|
+
allWorkspaces: PropTypes.arrayOf(PropTypes.object),
|
|
228
232
|
/**
|
|
229
|
-
*
|
|
230
|
-
* the user or content that triggers an action and allow users to
|
|
231
|
-
* directly start working and gain value (within one click)
|
|
233
|
+
* Specify an optional className to be added to your Animated Header
|
|
232
234
|
*/
|
|
233
|
-
|
|
235
|
+
className: PropTypes.string,
|
|
234
236
|
/**
|
|
235
|
-
*
|
|
237
|
+
* Provide short sentence in max. 3 lines related to product context
|
|
236
238
|
*/
|
|
237
|
-
|
|
239
|
+
description: PropTypes.string,
|
|
238
240
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
+
* In-product imagery / lottie animation (.json) dim. 1312 x 738
|
|
242
|
+
* (to update headerAnimation content storybook requires remount in toolbar)
|
|
241
243
|
*/
|
|
242
|
-
|
|
244
|
+
headerAnimation: PropTypes.object,
|
|
243
245
|
/**
|
|
244
|
-
*
|
|
246
|
+
* In-product imagery / static imagery dim. 1312 x 738
|
|
247
|
+
* Only active when headerAnimation is not in use
|
|
245
248
|
*/
|
|
246
|
-
|
|
249
|
+
headerStatic: PropTypes.object,
|
|
247
250
|
/**
|
|
248
251
|
* Provide current product name
|
|
249
252
|
*/
|
|
250
253
|
productName: PropTypes.string,
|
|
251
|
-
/**
|
|
252
|
-
* Object containing dropdown items
|
|
253
|
-
* `Open in: "_"`
|
|
254
|
-
*/
|
|
255
|
-
tileDropdownItems: PropTypes.arrayOf(PropTypes.object),
|
|
256
254
|
/**
|
|
257
255
|
* The tile group that is active in the header
|
|
258
256
|
* ex. "AI Chat Tile w/ two glass tiles", "Four glass tiles", ect.
|
|
259
257
|
*/
|
|
260
258
|
selectedTileGroup: PropTypes.object,
|
|
259
|
+
/**
|
|
260
|
+
* Object containing workspace selection
|
|
261
|
+
* `Open in: "_"`
|
|
262
|
+
*/
|
|
263
|
+
selectedWorkspace: PropTypes.object,
|
|
261
264
|
/**
|
|
262
265
|
* Provide function to be called when switching selected tile group
|
|
263
266
|
*/
|
|
264
267
|
setSelectedTileGroup: PropTypes.func,
|
|
265
268
|
/**
|
|
266
|
-
*
|
|
269
|
+
* Provide function to be called when switching workspace selection
|
|
267
270
|
*/
|
|
268
|
-
|
|
271
|
+
setSelectedWorkspace: PropTypes.func,
|
|
269
272
|
/**
|
|
270
|
-
*
|
|
271
|
-
*
|
|
273
|
+
* Configuration for Carbon button or dropdown menu in header. Customized
|
|
274
|
+
* tasks are used to allow users that have multiple roles and permissions
|
|
275
|
+
* to experience better tailored content based on their need.
|
|
272
276
|
*/
|
|
273
|
-
|
|
277
|
+
tasksConfig: PropTypes.object,
|
|
274
278
|
/**
|
|
275
|
-
*
|
|
276
|
-
|
|
279
|
+
* Specify the current username of active user
|
|
280
|
+
*/
|
|
281
|
+
userName: PropTypes.string,
|
|
282
|
+
/**
|
|
283
|
+
* Specify the current welcome text on the header
|
|
284
|
+
*/
|
|
285
|
+
welcomeText: PropTypes.string,
|
|
286
|
+
/**
|
|
287
|
+
* Specify the default workspace label above the tiles
|
|
277
288
|
*/
|
|
278
|
-
|
|
289
|
+
workspaceLabel: PropTypes.string
|
|
279
290
|
};
|
|
280
291
|
|
|
281
292
|
exports.default = AnimatedHeader;
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
/** Primary UI component for user interaction */
|
|
11
11
|
interface AIPromptTileProps {
|
|
12
|
-
id?: string;
|
|
13
12
|
href?: string;
|
|
14
|
-
|
|
13
|
+
id?: string;
|
|
15
14
|
mainIcon?: string;
|
|
16
|
-
|
|
15
|
+
open?: boolean;
|
|
17
16
|
productName?: string;
|
|
17
|
+
title?: string;
|
|
18
18
|
}
|
|
19
19
|
export declare const AIPromptTile: React.FC<AIPromptTileProps>;
|
|
20
20
|
export {};
|
|
@@ -11,7 +11,7 @@ var React = require('react');
|
|
|
11
11
|
var react = require('@carbon/react');
|
|
12
12
|
var index = require('../../../node_modules/@carbon/icons-react/es/index.js');
|
|
13
13
|
var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
14
|
-
var
|
|
14
|
+
var bucket15 = require('../../../node_modules/@carbon/icons-react/es/generated/bucket-15.js');
|
|
15
15
|
|
|
16
16
|
var _AILabel;
|
|
17
17
|
|
|
@@ -19,25 +19,27 @@ var _AILabel;
|
|
|
19
19
|
|
|
20
20
|
const AIPromptTile = _ref => {
|
|
21
21
|
let {
|
|
22
|
-
id,
|
|
23
22
|
href,
|
|
24
|
-
|
|
23
|
+
id,
|
|
25
24
|
mainIcon,
|
|
26
|
-
|
|
27
|
-
productName
|
|
25
|
+
open,
|
|
26
|
+
productName,
|
|
27
|
+
title
|
|
28
28
|
} = _ref;
|
|
29
29
|
const prefix = usePrefix.usePrefix();
|
|
30
|
-
const blockClass = `${prefix}
|
|
30
|
+
const blockClass = `${prefix}--animated-header__ai-prompt-tile`;
|
|
31
31
|
const collapsed = `${blockClass}--collapsed`;
|
|
32
32
|
const [textInput, setTextInput] = React.useState('');
|
|
33
33
|
const MainIcon = mainIcon ? index[mainIcon] : null;
|
|
34
|
-
const Send =
|
|
34
|
+
const Send = bucket15.Send;
|
|
35
35
|
const handleTextInput = e => {
|
|
36
36
|
setTextInput(e.target.value);
|
|
37
37
|
};
|
|
38
38
|
const openInNewTab = url => {
|
|
39
39
|
const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
|
|
40
|
-
if (newWindow)
|
|
40
|
+
if (newWindow) {
|
|
41
|
+
newWindow.opener = null;
|
|
42
|
+
}
|
|
41
43
|
};
|
|
42
44
|
const handleTextInputKeyDown = event => {
|
|
43
45
|
if (event.key === 'Enter') {
|
|
@@ -47,7 +49,7 @@ const AIPromptTile = _ref => {
|
|
|
47
49
|
};
|
|
48
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
51
|
id: `${blockClass}`,
|
|
50
|
-
className: `${prefix}
|
|
52
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
51
53
|
key: id
|
|
52
54
|
}, /*#__PURE__*/React.createElement("div", {
|
|
53
55
|
className: `${blockClass}--body ${!open && collapsed}`
|
|
@@ -21,8 +21,8 @@ const BaseTile = _ref => {
|
|
|
21
21
|
mainIcon,
|
|
22
22
|
secondaryIcon,
|
|
23
23
|
title,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
subtitle,
|
|
25
|
+
productName
|
|
26
26
|
} = _ref;
|
|
27
27
|
const props = {
|
|
28
28
|
id,
|
|
@@ -31,8 +31,8 @@ const BaseTile = _ref => {
|
|
|
31
31
|
mainIcon,
|
|
32
32
|
secondaryIcon,
|
|
33
33
|
title,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
subtitle,
|
|
35
|
+
productName
|
|
36
36
|
};
|
|
37
37
|
const tile = id === 'ai-tile' ? /*#__PURE__*/React.createElement(AIPromptTile.AIPromptTile, props) : /*#__PURE__*/React.createElement(GlassTile.GlassTile, props);
|
|
38
38
|
return tile;
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
/** Primary UI component for user interaction */
|
|
11
11
|
interface GlassTileProps {
|
|
12
|
-
id?: string;
|
|
13
12
|
href?: string;
|
|
14
|
-
|
|
13
|
+
id?: string;
|
|
15
14
|
mainIcon?: string;
|
|
15
|
+
open?: boolean;
|
|
16
16
|
secondaryIcon?: string;
|
|
17
|
-
title?: string;
|
|
18
17
|
subtitle?: string;
|
|
18
|
+
title?: string;
|
|
19
19
|
}
|
|
20
20
|
export declare const GlassTile: React.FC<GlassTileProps>;
|
|
21
21
|
export {};
|
|
@@ -16,21 +16,21 @@ var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePref
|
|
|
16
16
|
|
|
17
17
|
const GlassTile = _ref => {
|
|
18
18
|
let {
|
|
19
|
-
id,
|
|
20
19
|
href,
|
|
21
|
-
|
|
20
|
+
id,
|
|
22
21
|
mainIcon,
|
|
22
|
+
open,
|
|
23
23
|
secondaryIcon,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
subtitle,
|
|
25
|
+
title
|
|
26
26
|
} = _ref;
|
|
27
27
|
const prefix = usePrefix.usePrefix();
|
|
28
|
-
const blockClass = `${prefix}
|
|
28
|
+
const blockClass = `${prefix}--animated-header__glass-tile`;
|
|
29
29
|
const collapsed = `${blockClass}--collapsed`;
|
|
30
30
|
const MainIcon = mainIcon ? index[mainIcon] : null;
|
|
31
31
|
const SecondaryIcon = secondaryIcon ? index[secondaryIcon] : null;
|
|
32
32
|
return /*#__PURE__*/React.createElement(react.Link, {
|
|
33
|
-
className: `${prefix}
|
|
33
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
34
34
|
key: id,
|
|
35
35
|
href: href
|
|
36
36
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var index = require('
|
|
12
|
+
var index = require('../node_modules/@carbon/icon-helpers/es/index.js');
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
|