@carbon-labs/react-animated-header 0.2.0 → 0.3.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 +12 -4
- package/es/__stories__/data/index.d.ts +1 -1
- package/es/components/AnimatedHeader/AnimatedHeader.d.ts +12 -4
- package/es/components/AnimatedHeader/AnimatedHeader.js +27 -14
- package/es/components/Tiles/AIPromptTile/AIPromptTile.js +3 -3
- 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.js +2 -2
- 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 +12 -4
- package/lib/__stories__/data/index.d.ts +1 -1
- package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +12 -4
- package/lib/components/AnimatedHeader/AnimatedHeader.js +27 -14
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.js +4 -4
- 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.js +2 -2
- 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 +16 -8
- package/scss/Tiles/AIPromptTile/ai-prompt-tile.scss +1 -1
- package/scss/Tiles/GlassTile/glass-tile.scss +13 -1
|
@@ -26,7 +26,7 @@ export declare const ThemeG10: {
|
|
|
26
26
|
default: boolean;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
selectedWorkspace: {
|
|
30
30
|
description: string;
|
|
31
31
|
type: string;
|
|
32
32
|
control: {
|
|
@@ -8595,7 +8595,11 @@ export declare const ThemeG10: {
|
|
|
8595
8595
|
buttonIcon: number;
|
|
8596
8596
|
headerStatic: number;
|
|
8597
8597
|
headerDropdown: boolean;
|
|
8598
|
-
|
|
8598
|
+
selectedWorkspace: number;
|
|
8599
|
+
allWorkspaces: {
|
|
8600
|
+
id: string;
|
|
8601
|
+
text: string;
|
|
8602
|
+
}[];
|
|
8599
8603
|
selectedTileGroup: number;
|
|
8600
8604
|
allTiles: ({
|
|
8601
8605
|
id: number;
|
|
@@ -8658,7 +8662,7 @@ export declare const ThemeG100: {
|
|
|
8658
8662
|
default: boolean;
|
|
8659
8663
|
};
|
|
8660
8664
|
};
|
|
8661
|
-
|
|
8665
|
+
selectedWorkspace: {
|
|
8662
8666
|
description: string;
|
|
8663
8667
|
type: string;
|
|
8664
8668
|
control: {
|
|
@@ -17227,7 +17231,11 @@ export declare const ThemeG100: {
|
|
|
17227
17231
|
buttonIcon: number;
|
|
17228
17232
|
headerStatic: number;
|
|
17229
17233
|
headerDropdown: boolean;
|
|
17230
|
-
|
|
17234
|
+
selectedWorkspace: number;
|
|
17235
|
+
allWorkspaces: {
|
|
17236
|
+
id: string;
|
|
17237
|
+
text: string;
|
|
17238
|
+
}[];
|
|
17231
17239
|
selectedTileGroup: number;
|
|
17232
17240
|
allTiles: ({
|
|
17233
17241
|
id: number;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonKind } from '@carbon/react';
|
|
3
3
|
/** Animated Header */
|
|
4
|
+
export interface SelectedWorkspace {
|
|
5
|
+
id: string;
|
|
6
|
+
text: string;
|
|
7
|
+
}
|
|
4
8
|
export interface Tile {
|
|
5
9
|
id: string;
|
|
6
|
-
href: string;
|
|
7
|
-
title: string;
|
|
8
|
-
|
|
10
|
+
href: string | null;
|
|
11
|
+
title: string | null;
|
|
12
|
+
subtitle: string | null;
|
|
13
|
+
mainIcon: string | null;
|
|
14
|
+
secondaryIcon: string | null;
|
|
9
15
|
}
|
|
10
16
|
export interface TileGroup {
|
|
11
17
|
id: number;
|
|
@@ -20,7 +26,9 @@ export interface AnimatedHeaderProps {
|
|
|
20
26
|
buttonIcon?: any;
|
|
21
27
|
headerDropdown?: boolean;
|
|
22
28
|
productName?: string;
|
|
23
|
-
|
|
29
|
+
selectedWorkspace?: SelectedWorkspace[] | any;
|
|
30
|
+
setSelectedWorkspace: (e: any) => void;
|
|
31
|
+
allWorkspaces?: SelectedWorkspace[];
|
|
24
32
|
selectedTileGroup: TileGroup[] | any;
|
|
25
33
|
setSelectedTileGroup: (e: any) => void;
|
|
26
34
|
allTiles: TileGroup[];
|
|
@@ -28,7 +28,9 @@ const AnimatedHeader = _ref => {
|
|
|
28
28
|
buttonIcon = null,
|
|
29
29
|
headerDropdown = false,
|
|
30
30
|
productName = '[Product name]',
|
|
31
|
-
|
|
31
|
+
selectedWorkspace,
|
|
32
|
+
setSelectedWorkspace,
|
|
33
|
+
allWorkspaces,
|
|
32
34
|
selectedTileGroup,
|
|
33
35
|
setSelectedTileGroup,
|
|
34
36
|
allTiles,
|
|
@@ -36,7 +38,7 @@ const AnimatedHeader = _ref => {
|
|
|
36
38
|
headerStatic
|
|
37
39
|
} = _ref;
|
|
38
40
|
const prefix = usePrefix();
|
|
39
|
-
const blockClass = `${prefix}
|
|
41
|
+
const blockClass = `${prefix}--animated-header`;
|
|
40
42
|
let animationContainer = /*#__PURE__*/createRef();
|
|
41
43
|
const [open, setOpen] = useState(true);
|
|
42
44
|
const [playing, setPlaying] = useState(true);
|
|
@@ -140,36 +142,39 @@ const AnimatedHeader = _ref => {
|
|
|
140
142
|
className: `${blockClass}__button`,
|
|
141
143
|
kind: buttonType,
|
|
142
144
|
renderIcon: buttonIcon
|
|
143
|
-
}, buttonText), !buttonText && headerDropdown && allTiles && /*#__PURE__*/React.createElement(
|
|
145
|
+
}, buttonText), !buttonText && headerDropdown && allTiles && /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
className: `${blockClass}__header-dropdown--container`
|
|
147
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
144
148
|
id: `${blockClass}__header-dropdown`,
|
|
145
149
|
className: `${blockClass}__header-dropdown`,
|
|
146
150
|
size: "md",
|
|
147
151
|
autoAlign: true,
|
|
148
152
|
titleText: "Label",
|
|
149
153
|
initialSelectedItem: allTiles[0],
|
|
150
|
-
label: allTiles[0].name,
|
|
154
|
+
label: allTiles[0].name || 'Select an option below',
|
|
151
155
|
hideLabel: true,
|
|
152
156
|
type: "inline",
|
|
153
157
|
items: allTiles,
|
|
154
158
|
itemToString: item => item ? item.name : '',
|
|
155
159
|
onChange: e => setSelectedTileGroup(e)
|
|
156
|
-
})), selectedTileGroup && /*#__PURE__*/React.createElement(Column, {
|
|
160
|
+
}))), selectedTileGroup && /*#__PURE__*/React.createElement(Column, {
|
|
157
161
|
sm: 4,
|
|
158
162
|
md: 8,
|
|
159
163
|
lg: 12,
|
|
160
164
|
className: `${blockClass}__content`
|
|
161
|
-
},
|
|
162
|
-
className: `${blockClass}
|
|
165
|
+
}, allWorkspaces && /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
className: `${blockClass}__workspace--container ${!open && contentCollapsed}`
|
|
163
167
|
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
164
|
-
id: `${blockClass}
|
|
165
|
-
className: `${blockClass}
|
|
168
|
+
id: `${blockClass}__workspace`,
|
|
169
|
+
className: `${blockClass}__workspace`,
|
|
166
170
|
size: "sm",
|
|
167
171
|
titleText: "Label",
|
|
168
|
-
label: `Open in: ${name}'s
|
|
172
|
+
label: `Open in: ${name}'s workspace` || 'Select a workspace',
|
|
169
173
|
hideLabel: true,
|
|
170
174
|
type: "inline",
|
|
171
|
-
items:
|
|
172
|
-
itemToString: item => item ? item['text'] : ''
|
|
175
|
+
items: allWorkspaces,
|
|
176
|
+
itemToString: item => item ? item['text'] : '',
|
|
177
|
+
onChange: e => setSelectedWorkspace(e)
|
|
173
178
|
})), /*#__PURE__*/React.createElement("div", {
|
|
174
179
|
className: `${blockClass}__tiles-container`
|
|
175
180
|
}, selectedTileGroup.tiles.map(tile => {
|
|
@@ -245,10 +250,18 @@ AnimatedHeader.propTypes = {
|
|
|
245
250
|
*/
|
|
246
251
|
productName: PropTypes.string,
|
|
247
252
|
/**
|
|
248
|
-
* Object containing
|
|
253
|
+
* Object containing workspace selection
|
|
249
254
|
* `Open in: "_"`
|
|
250
255
|
*/
|
|
251
|
-
|
|
256
|
+
selectedWorkspace: PropTypes.object,
|
|
257
|
+
/**
|
|
258
|
+
* Provide function to be called when switching workspace selection
|
|
259
|
+
*/
|
|
260
|
+
setSelectedWorkspace: PropTypes.func,
|
|
261
|
+
/**
|
|
262
|
+
* Array of all workspace options
|
|
263
|
+
*/
|
|
264
|
+
allWorkspaces: PropTypes.arrayOf(PropTypes.object),
|
|
252
265
|
/**
|
|
253
266
|
* The tile group that is active in the header
|
|
254
267
|
* ex. "AI Chat Tile w/ two glass tiles", "Four glass tiles", ect.
|
|
@@ -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
|
|
|
@@ -25,7 +25,7 @@ const AIPromptTile = _ref => {
|
|
|
25
25
|
productName
|
|
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;
|
|
@@ -45,7 +45,7 @@ const AIPromptTile = _ref => {
|
|
|
45
45
|
};
|
|
46
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
47
|
id: `${blockClass}`,
|
|
48
|
-
className: `${prefix}
|
|
48
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
49
49
|
key: id
|
|
50
50
|
}, /*#__PURE__*/React.createElement("div", {
|
|
51
51
|
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;
|
|
@@ -23,12 +23,12 @@ const GlassTile = _ref => {
|
|
|
23
23
|
subtitle
|
|
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", {
|