@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;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import React, { useState, useEffect, createRef } from 'react';
|
|
10
|
-
import {
|
|
10
|
+
import { Grid, Column, Tooltip, Button, Dropdown, IconButton } from '@carbon/react';
|
|
11
11
|
import lottie from '../../_virtual/lottie.js';
|
|
12
12
|
import { usePrefix } from '../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
|
|
13
13
|
import { BaseTile } from '../Tiles/BaseTile/BaseTile.js';
|
|
@@ -21,23 +21,24 @@ var _PauseFilled, _PlayFilledAlt;
|
|
|
21
21
|
|
|
22
22
|
const AnimatedHeader = _ref => {
|
|
23
23
|
let {
|
|
24
|
-
|
|
24
|
+
allTiles,
|
|
25
|
+
allWorkspaces,
|
|
25
26
|
description,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
buttonIcon = null,
|
|
29
|
-
headerDropdown = false,
|
|
27
|
+
headerAnimation,
|
|
28
|
+
headerStatic,
|
|
30
29
|
productName = '[Product name]',
|
|
31
|
-
tileDropdownItems,
|
|
32
30
|
selectedTileGroup,
|
|
31
|
+
selectedWorkspace,
|
|
33
32
|
setSelectedTileGroup,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
setSelectedWorkspace,
|
|
34
|
+
tasksConfig,
|
|
35
|
+
userName,
|
|
36
|
+
welcomeText,
|
|
37
|
+
workspaceLabel = `Open in: ${userName}'s workspace` || `Select a workspace`
|
|
37
38
|
} = _ref;
|
|
38
39
|
const prefix = usePrefix();
|
|
39
|
-
const blockClass = `${prefix}
|
|
40
|
-
|
|
40
|
+
const blockClass = `${prefix}--animated-header`;
|
|
41
|
+
const animationContainer = /*#__PURE__*/createRef();
|
|
41
42
|
const [open, setOpen] = useState(true);
|
|
42
43
|
const [playing, setPlaying] = useState(true);
|
|
43
44
|
const [headingTextAnimation, setHeadingTextAnimation] = useState('');
|
|
@@ -61,7 +62,7 @@ const AnimatedHeader = _ref => {
|
|
|
61
62
|
setPlaying(!playing);
|
|
62
63
|
};
|
|
63
64
|
useEffect(() => {
|
|
64
|
-
|
|
65
|
+
const animation = lottie.loadAnimation({
|
|
65
66
|
container: animationContainer.current,
|
|
66
67
|
animationData: headerAnimation,
|
|
67
68
|
renderer: 'svg',
|
|
@@ -82,7 +83,7 @@ const AnimatedHeader = _ref => {
|
|
|
82
83
|
animation.setSpeed(lottieLoopSpeed);
|
|
83
84
|
animation.playSegments([animationData.markers.at(1).tm, animationData.op], true);
|
|
84
85
|
}
|
|
85
|
-
if (
|
|
86
|
+
if (isReduced) {
|
|
86
87
|
// reduced motion on
|
|
87
88
|
animation.addEventListener('DOMLoaded', reducedMotion);
|
|
88
89
|
} else {
|
|
@@ -94,7 +95,12 @@ const AnimatedHeader = _ref => {
|
|
|
94
95
|
// Run Looped Animation
|
|
95
96
|
animation.addEventListener('complete', loop);
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
return () => {
|
|
99
|
+
animation?.removeEventListener('DOMLoaded', reducedMotion);
|
|
100
|
+
animation?.removeEventListener('DOMLoaded', load);
|
|
101
|
+
animation?.removeEventListener('complete', loop);
|
|
102
|
+
};
|
|
103
|
+
}, [animationContainer, headerAnimation, isReduced]);
|
|
98
104
|
return /*#__PURE__*/React.createElement("section", {
|
|
99
105
|
className: `${blockClass} ${!open && collapsed}`
|
|
100
106
|
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -119,14 +125,14 @@ const AnimatedHeader = _ref => {
|
|
|
119
125
|
lg: 16
|
|
120
126
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
121
127
|
align: "bottom",
|
|
122
|
-
label:
|
|
128
|
+
label: `${welcomeText}, ${userName}`
|
|
123
129
|
}, /*#__PURE__*/React.createElement("h1", {
|
|
124
130
|
className: `${blockClass}__heading ${headingTextAnimation}`
|
|
125
131
|
}, /*#__PURE__*/React.createElement("span", {
|
|
126
132
|
className: `${blockClass}__heading-welcome`
|
|
127
|
-
}, "
|
|
133
|
+
}, welcomeText, ",", ' '), /*#__PURE__*/React.createElement("span", {
|
|
128
134
|
className: `${blockClass}__heading-name`
|
|
129
|
-
},
|
|
135
|
+
}, userName)))), (description || tasksConfig && tasksConfig.type === 'button' && tasksConfig.button?.text || tasksConfig && tasksConfig.type === 'dropdown' && tasksConfig.dropdown?.label) && /*#__PURE__*/React.createElement(Column, {
|
|
130
136
|
sm: 4,
|
|
131
137
|
md: 8,
|
|
132
138
|
lg: 4,
|
|
@@ -136,40 +142,42 @@ const AnimatedHeader = _ref => {
|
|
|
136
142
|
label: description
|
|
137
143
|
}, /*#__PURE__*/React.createElement("h2", {
|
|
138
144
|
className: `${blockClass}__description`
|
|
139
|
-
}, description)),
|
|
145
|
+
}, description)), tasksConfig?.button?.text && /*#__PURE__*/React.createElement(Button, {
|
|
140
146
|
className: `${blockClass}__button`,
|
|
141
|
-
kind:
|
|
142
|
-
renderIcon:
|
|
143
|
-
|
|
147
|
+
kind: tasksConfig.button.type,
|
|
148
|
+
renderIcon: tasksConfig.button.icon,
|
|
149
|
+
href: tasksConfig.button.href
|
|
150
|
+
}, tasksConfig.button.text), !tasksConfig?.button?.text && tasksConfig && tasksConfig.type === 'dropdown' && allTiles && /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: `${blockClass}__header-dropdown--container`
|
|
152
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
144
153
|
id: `${blockClass}__header-dropdown`,
|
|
145
154
|
className: `${blockClass}__header-dropdown`,
|
|
146
155
|
size: "md",
|
|
147
|
-
autoAlign: true,
|
|
148
156
|
titleText: "Label",
|
|
149
|
-
|
|
150
|
-
label: allTiles[0].name,
|
|
157
|
+
label: tasksConfig.dropdown?.label || allTiles[0].name,
|
|
151
158
|
hideLabel: true,
|
|
152
159
|
type: "inline",
|
|
153
160
|
items: allTiles,
|
|
154
161
|
itemToString: item => item ? item.name : '',
|
|
155
162
|
onChange: e => setSelectedTileGroup(e)
|
|
156
|
-
})), selectedTileGroup && /*#__PURE__*/React.createElement(Column, {
|
|
163
|
+
}))), selectedTileGroup && /*#__PURE__*/React.createElement(Column, {
|
|
157
164
|
sm: 4,
|
|
158
165
|
md: 8,
|
|
159
166
|
lg: 12,
|
|
160
167
|
className: `${blockClass}__content`
|
|
161
|
-
},
|
|
162
|
-
className: `${blockClass}
|
|
168
|
+
}, allWorkspaces && /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
className: `${blockClass}__workspace--container ${!open && contentCollapsed}`
|
|
163
170
|
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
164
|
-
id: `${blockClass}
|
|
165
|
-
className: `${blockClass}
|
|
171
|
+
id: `${blockClass}__workspace`,
|
|
172
|
+
className: `${blockClass}__workspace`,
|
|
166
173
|
size: "sm",
|
|
167
174
|
titleText: "Label",
|
|
168
|
-
label:
|
|
175
|
+
label: workspaceLabel,
|
|
169
176
|
hideLabel: true,
|
|
170
177
|
type: "inline",
|
|
171
|
-
items:
|
|
172
|
-
itemToString: item => item ? item['text'] : ''
|
|
178
|
+
items: allWorkspaces,
|
|
179
|
+
itemToString: item => item ? item['text'] : '',
|
|
180
|
+
onChange: e => setSelectedWorkspace(e)
|
|
173
181
|
})), /*#__PURE__*/React.createElement("div", {
|
|
174
182
|
className: `${blockClass}__tiles-container`
|
|
175
183
|
}, selectedTileGroup.tiles.map(tile => {
|
|
@@ -210,68 +218,71 @@ const AnimatedHeader = _ref => {
|
|
|
210
218
|
AnimatedHeader.displayName = 'Animated Header';
|
|
211
219
|
AnimatedHeader.propTypes = {
|
|
212
220
|
/**
|
|
213
|
-
*
|
|
214
|
-
*/
|
|
215
|
-
className: PropTypes.string,
|
|
216
|
-
/**
|
|
217
|
-
* Specify the current username of active user
|
|
221
|
+
* Array of each tile group setup
|
|
218
222
|
*/
|
|
219
|
-
|
|
223
|
+
allTiles: PropTypes.arrayOf(PropTypes.object),
|
|
220
224
|
/**
|
|
221
|
-
*
|
|
225
|
+
* Array of all workspace options
|
|
222
226
|
*/
|
|
223
|
-
|
|
227
|
+
allWorkspaces: PropTypes.arrayOf(PropTypes.object),
|
|
224
228
|
/**
|
|
225
|
-
*
|
|
226
|
-
* the user or content that triggers an action and allow users to
|
|
227
|
-
* directly start working and gain value (within one click)
|
|
229
|
+
* Specify an optional className to be added to your Animated Header
|
|
228
230
|
*/
|
|
229
|
-
|
|
231
|
+
className: PropTypes.string,
|
|
230
232
|
/**
|
|
231
|
-
*
|
|
233
|
+
* Provide short sentence in max. 3 lines related to product context
|
|
232
234
|
*/
|
|
233
|
-
|
|
235
|
+
description: PropTypes.string,
|
|
234
236
|
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
+
* In-product imagery / lottie animation (.json) dim. 1312 x 738
|
|
238
|
+
* (to update headerAnimation content storybook requires remount in toolbar)
|
|
237
239
|
*/
|
|
238
|
-
|
|
240
|
+
headerAnimation: PropTypes.object,
|
|
239
241
|
/**
|
|
240
|
-
*
|
|
242
|
+
* In-product imagery / static imagery dim. 1312 x 738
|
|
243
|
+
* Only active when headerAnimation is not in use
|
|
241
244
|
*/
|
|
242
|
-
|
|
245
|
+
headerStatic: PropTypes.object,
|
|
243
246
|
/**
|
|
244
247
|
* Provide current product name
|
|
245
248
|
*/
|
|
246
249
|
productName: PropTypes.string,
|
|
247
|
-
/**
|
|
248
|
-
* Object containing dropdown items
|
|
249
|
-
* `Open in: "_"`
|
|
250
|
-
*/
|
|
251
|
-
tileDropdownItems: PropTypes.arrayOf(PropTypes.object),
|
|
252
250
|
/**
|
|
253
251
|
* The tile group that is active in the header
|
|
254
252
|
* ex. "AI Chat Tile w/ two glass tiles", "Four glass tiles", ect.
|
|
255
253
|
*/
|
|
256
254
|
selectedTileGroup: PropTypes.object,
|
|
255
|
+
/**
|
|
256
|
+
* Object containing workspace selection
|
|
257
|
+
* `Open in: "_"`
|
|
258
|
+
*/
|
|
259
|
+
selectedWorkspace: PropTypes.object,
|
|
257
260
|
/**
|
|
258
261
|
* Provide function to be called when switching selected tile group
|
|
259
262
|
*/
|
|
260
263
|
setSelectedTileGroup: PropTypes.func,
|
|
261
264
|
/**
|
|
262
|
-
*
|
|
265
|
+
* Provide function to be called when switching workspace selection
|
|
263
266
|
*/
|
|
264
|
-
|
|
267
|
+
setSelectedWorkspace: PropTypes.func,
|
|
265
268
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
269
|
+
* Configuration for Carbon button or dropdown menu in header. Customized
|
|
270
|
+
* tasks are used to allow users that have multiple roles and permissions
|
|
271
|
+
* to experience better tailored content based on their need.
|
|
268
272
|
*/
|
|
269
|
-
|
|
273
|
+
tasksConfig: PropTypes.object,
|
|
270
274
|
/**
|
|
271
|
-
*
|
|
272
|
-
|
|
275
|
+
* Specify the current username of active user
|
|
276
|
+
*/
|
|
277
|
+
userName: PropTypes.string,
|
|
278
|
+
/**
|
|
279
|
+
* Specify the current welcome text on the header
|
|
280
|
+
*/
|
|
281
|
+
welcomeText: PropTypes.string,
|
|
282
|
+
/**
|
|
283
|
+
* Specify the default workspace label above the tiles
|
|
273
284
|
*/
|
|
274
|
-
|
|
285
|
+
workspaceLabel: PropTypes.string
|
|
275
286
|
};
|
|
276
287
|
|
|
277
288
|
export { AnimatedHeader as default };
|
|
@@ -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 {};
|
|
@@ -9,7 +9,7 @@ import React, { useState } from 'react';
|
|
|
9
9
|
import { AILabel, TextInput, IconButton, Button } from '@carbon/react';
|
|
10
10
|
import * as index from '../../../node_modules/@carbon/icons-react/es/index.js';
|
|
11
11
|
import { usePrefix } from '../../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
|
|
12
|
-
import { Send } from '../../../node_modules/@carbon/icons-react/es/generated/bucket-
|
|
12
|
+
import { Send } from '../../../node_modules/@carbon/icons-react/es/generated/bucket-15.js';
|
|
13
13
|
|
|
14
14
|
var _AILabel;
|
|
15
15
|
|
|
@@ -17,15 +17,15 @@ var _AILabel;
|
|
|
17
17
|
|
|
18
18
|
const AIPromptTile = _ref => {
|
|
19
19
|
let {
|
|
20
|
-
id,
|
|
21
20
|
href,
|
|
22
|
-
|
|
21
|
+
id,
|
|
23
22
|
mainIcon,
|
|
24
|
-
|
|
25
|
-
productName
|
|
23
|
+
open,
|
|
24
|
+
productName,
|
|
25
|
+
title
|
|
26
26
|
} = _ref;
|
|
27
27
|
const prefix = usePrefix();
|
|
28
|
-
const blockClass = `${prefix}
|
|
28
|
+
const blockClass = `${prefix}--animated-header__ai-prompt-tile`;
|
|
29
29
|
const collapsed = `${blockClass}--collapsed`;
|
|
30
30
|
const [textInput, setTextInput] = useState('');
|
|
31
31
|
const MainIcon = mainIcon ? index[mainIcon] : null;
|
|
@@ -35,7 +35,9 @@ const AIPromptTile = _ref => {
|
|
|
35
35
|
};
|
|
36
36
|
const openInNewTab = url => {
|
|
37
37
|
const newWindow = window.open(url, '_blank', 'noopener,noreferrer');
|
|
38
|
-
if (newWindow)
|
|
38
|
+
if (newWindow) {
|
|
39
|
+
newWindow.opener = null;
|
|
40
|
+
}
|
|
39
41
|
};
|
|
40
42
|
const handleTextInputKeyDown = event => {
|
|
41
43
|
if (event.key === 'Enter') {
|
|
@@ -45,7 +47,7 @@ const AIPromptTile = _ref => {
|
|
|
45
47
|
};
|
|
46
48
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
49
|
id: `${blockClass}`,
|
|
48
|
-
className: `${prefix}
|
|
50
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
49
51
|
key: id
|
|
50
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
51
53
|
className: `${blockClass}--body ${!open && collapsed}`
|
|
@@ -19,8 +19,8 @@ const BaseTile = _ref => {
|
|
|
19
19
|
mainIcon,
|
|
20
20
|
secondaryIcon,
|
|
21
21
|
title,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
subtitle,
|
|
23
|
+
productName
|
|
24
24
|
} = _ref;
|
|
25
25
|
const props = {
|
|
26
26
|
id,
|
|
@@ -29,8 +29,8 @@ const BaseTile = _ref => {
|
|
|
29
29
|
mainIcon,
|
|
30
30
|
secondaryIcon,
|
|
31
31
|
title,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
subtitle,
|
|
33
|
+
productName
|
|
34
34
|
};
|
|
35
35
|
const tile = id === 'ai-tile' ? /*#__PURE__*/React.createElement(AIPromptTile, props) : /*#__PURE__*/React.createElement(GlassTile, props);
|
|
36
36
|
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 {};
|
|
@@ -14,21 +14,21 @@ import { usePrefix } from '../../../node_modules/@carbon-labs/utilities/es/usePr
|
|
|
14
14
|
|
|
15
15
|
const GlassTile = _ref => {
|
|
16
16
|
let {
|
|
17
|
-
id,
|
|
18
17
|
href,
|
|
19
|
-
|
|
18
|
+
id,
|
|
20
19
|
mainIcon,
|
|
20
|
+
open,
|
|
21
21
|
secondaryIcon,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
subtitle,
|
|
23
|
+
title
|
|
24
24
|
} = _ref;
|
|
25
25
|
const prefix = usePrefix();
|
|
26
|
-
const blockClass = `${prefix}
|
|
26
|
+
const blockClass = `${prefix}--animated-header__glass-tile`;
|
|
27
27
|
const collapsed = `${blockClass}--collapsed`;
|
|
28
28
|
const MainIcon = mainIcon ? index[mainIcon] : null;
|
|
29
29
|
const SecondaryIcon = secondaryIcon ? index[secondaryIcon] : null;
|
|
30
30
|
return /*#__PURE__*/React.createElement(Link, {
|
|
31
|
-
className: `${prefix}
|
|
31
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
32
32
|
key: id,
|
|
33
33
|
href: href
|
|
34
34
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { getAttributes } from '
|
|
8
|
+
import { getAttributes } from '../node_modules/@carbon/icon-helpers/es/index.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
|