@carbon-labs/react-animated-header 0.18.0 → 0.20.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 +624 -192
- package/es/__stories__/data/index.d.ts +52 -16
- package/es/components/AnimatedHeader/AnimatedHeader.d.ts +4 -3
- package/es/components/AnimatedHeader/AnimatedHeader.js +6 -2
- package/es/components/TasksController/TasksController.d.ts +3 -3
- package/es/components/TasksController/TasksController.js +4 -1
- package/es/components/Tiles/AIPromptTile/AIPromptTile.d.ts +3 -2
- package/es/components/Tiles/AIPromptTile/AIPromptTile.js +10 -9
- package/es/components/Tiles/BaseTile/BaseTile.d.ts +4 -4
- package/es/components/Tiles/GlassTile/GlassTile.d.ts +2 -8
- package/es/components/Tiles/GlassTile/GlassTile.js +20 -28
- package/es/components/Tiles/GlassTile/GlassTileBody.d.ts +19 -0
- package/es/components/Tiles/GlassTile/GlassTileBody.js +53 -0
- package/es/components/WorkspaceSelector/WorkspaceSelector.d.ts +2 -2
- package/es/components/WorkspaceSelector/WorkspaceSelector.js +1 -1
- package/es/index.js +1 -0
- package/lib/__stories__/AnimatedHeader.stories.d.ts +624 -192
- package/lib/__stories__/data/index.d.ts +52 -16
- package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +4 -3
- package/lib/components/AnimatedHeader/AnimatedHeader.js +6 -2
- package/lib/components/TasksController/TasksController.d.ts +3 -3
- package/lib/components/TasksController/TasksController.js +4 -1
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.d.ts +3 -2
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.js +10 -9
- package/lib/components/Tiles/BaseTile/BaseTile.d.ts +4 -4
- package/lib/components/Tiles/GlassTile/GlassTile.d.ts +2 -8
- package/lib/components/Tiles/GlassTile/GlassTile.js +19 -27
- package/lib/components/Tiles/GlassTile/GlassTileBody.d.ts +19 -0
- package/lib/components/Tiles/GlassTile/GlassTileBody.js +55 -0
- package/lib/components/WorkspaceSelector/WorkspaceSelector.d.ts +2 -2
- package/lib/components/WorkspaceSelector/WorkspaceSelector.js +1 -1
- package/lib/index.js +1 -0
- package/package.json +2 -2
- package/scss/Tiles/GlassTile/glass-tile.scss +0 -1
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-0.js +0 -2956
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-1.js +0 -3263
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-10.js +0 -2946
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-11.js +0 -3112
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-12.js +0 -2967
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-13.js +0 -3056
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-14.js +0 -2888
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-15.js +0 -3072
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-16.js +0 -2992
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-17.js +0 -2843
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-18.js +0 -3080
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-19.js +0 -1680
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +0 -3096
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-4.js +0 -3008
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-5.js +0 -2916
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-6.js +0 -2992
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-7.js +0 -2983
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3106
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +0 -3090
- package/es/node_modules/@carbon/icons-react/es/index.js +0 -30
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-0.js +0 -3082
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-1.js +0 -3389
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-10.js +0 -3072
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-11.js +0 -3238
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-12.js +0 -3093
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-13.js +0 -3182
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-14.js +0 -3014
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-15.js +0 -3198
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-16.js +0 -3118
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-17.js +0 -2969
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-18.js +0 -3206
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-19.js +0 -1750
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +0 -3222
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-4.js +0 -3134
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-5.js +0 -3042
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-6.js +0 -3118
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-7.js +0 -3109
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3232
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +0 -3216
- package/lib/node_modules/@carbon/icons-react/es/index.js +0 -2480
|
@@ -9,14 +9,14 @@ export const headerTiles: ({
|
|
|
9
9
|
id: string;
|
|
10
10
|
href: string;
|
|
11
11
|
title: string;
|
|
12
|
-
mainIcon:
|
|
12
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
13
13
|
subtitle?: undefined;
|
|
14
14
|
} | {
|
|
15
15
|
id: string;
|
|
16
16
|
href: string;
|
|
17
17
|
title: string;
|
|
18
18
|
subtitle: string;
|
|
19
|
-
mainIcon:
|
|
19
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
20
20
|
})[];
|
|
21
21
|
} | {
|
|
22
22
|
id: number;
|
|
@@ -26,16 +26,34 @@ export const headerTiles: ({
|
|
|
26
26
|
href: string;
|
|
27
27
|
title: string;
|
|
28
28
|
subtitle: string;
|
|
29
|
-
mainIcon:
|
|
29
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
30
|
+
secondaryIcon?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
id: string;
|
|
33
|
+
href: string;
|
|
34
|
+
title: string;
|
|
35
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
36
|
+
secondaryIcon: import("@carbon/react/icons").CarbonIconType;
|
|
37
|
+
subtitle?: undefined;
|
|
38
|
+
})[];
|
|
39
|
+
} | {
|
|
40
|
+
id: number;
|
|
41
|
+
label: string;
|
|
42
|
+
tiles: ({
|
|
43
|
+
id: string;
|
|
44
|
+
href: string;
|
|
45
|
+
title: string;
|
|
46
|
+
subtitle: string;
|
|
47
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
30
48
|
isLoading: boolean;
|
|
31
49
|
isDisabled?: undefined;
|
|
32
50
|
secondaryIcon?: undefined;
|
|
33
51
|
} | {
|
|
34
52
|
id: string;
|
|
35
|
-
href: string;
|
|
36
53
|
title: string;
|
|
37
54
|
subtitle: string;
|
|
38
|
-
mainIcon:
|
|
55
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
56
|
+
href?: undefined;
|
|
39
57
|
isLoading?: undefined;
|
|
40
58
|
isDisabled?: undefined;
|
|
41
59
|
secondaryIcon?: undefined;
|
|
@@ -44,7 +62,7 @@ export const headerTiles: ({
|
|
|
44
62
|
href: string;
|
|
45
63
|
title: string;
|
|
46
64
|
subtitle: string;
|
|
47
|
-
mainIcon:
|
|
65
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
48
66
|
isDisabled: boolean;
|
|
49
67
|
isLoading?: undefined;
|
|
50
68
|
secondaryIcon?: undefined;
|
|
@@ -52,8 +70,8 @@ export const headerTiles: ({
|
|
|
52
70
|
id: string;
|
|
53
71
|
href: string;
|
|
54
72
|
title: string;
|
|
55
|
-
mainIcon:
|
|
56
|
-
secondaryIcon:
|
|
73
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
74
|
+
secondaryIcon: import("@carbon/react/icons").CarbonIconType;
|
|
57
75
|
subtitle?: undefined;
|
|
58
76
|
isLoading?: undefined;
|
|
59
77
|
isDisabled?: undefined;
|
|
@@ -89,14 +107,14 @@ export namespace tasksControllerConfigDropdown {
|
|
|
89
107
|
id: string;
|
|
90
108
|
href: string;
|
|
91
109
|
title: string;
|
|
92
|
-
mainIcon:
|
|
110
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
93
111
|
subtitle?: undefined;
|
|
94
112
|
} | {
|
|
95
113
|
id: string;
|
|
96
114
|
href: string;
|
|
97
115
|
title: string;
|
|
98
116
|
subtitle: string;
|
|
99
|
-
mainIcon:
|
|
117
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
100
118
|
})[];
|
|
101
119
|
} | {
|
|
102
120
|
id: number;
|
|
@@ -106,16 +124,34 @@ export namespace tasksControllerConfigDropdown {
|
|
|
106
124
|
href: string;
|
|
107
125
|
title: string;
|
|
108
126
|
subtitle: string;
|
|
109
|
-
mainIcon:
|
|
127
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
128
|
+
secondaryIcon?: undefined;
|
|
129
|
+
} | {
|
|
130
|
+
id: string;
|
|
131
|
+
href: string;
|
|
132
|
+
title: string;
|
|
133
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
134
|
+
secondaryIcon: import("@carbon/react/icons").CarbonIconType;
|
|
135
|
+
subtitle?: undefined;
|
|
136
|
+
})[];
|
|
137
|
+
} | {
|
|
138
|
+
id: number;
|
|
139
|
+
label: string;
|
|
140
|
+
tiles: ({
|
|
141
|
+
id: string;
|
|
142
|
+
href: string;
|
|
143
|
+
title: string;
|
|
144
|
+
subtitle: string;
|
|
145
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
110
146
|
isLoading: boolean;
|
|
111
147
|
isDisabled?: undefined;
|
|
112
148
|
secondaryIcon?: undefined;
|
|
113
149
|
} | {
|
|
114
150
|
id: string;
|
|
115
|
-
href: string;
|
|
116
151
|
title: string;
|
|
117
152
|
subtitle: string;
|
|
118
|
-
mainIcon:
|
|
153
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
154
|
+
href?: undefined;
|
|
119
155
|
isLoading?: undefined;
|
|
120
156
|
isDisabled?: undefined;
|
|
121
157
|
secondaryIcon?: undefined;
|
|
@@ -124,7 +160,7 @@ export namespace tasksControllerConfigDropdown {
|
|
|
124
160
|
href: string;
|
|
125
161
|
title: string;
|
|
126
162
|
subtitle: string;
|
|
127
|
-
mainIcon:
|
|
163
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
128
164
|
isDisabled: boolean;
|
|
129
165
|
isLoading?: undefined;
|
|
130
166
|
secondaryIcon?: undefined;
|
|
@@ -132,8 +168,8 @@ export namespace tasksControllerConfigDropdown {
|
|
|
132
168
|
id: string;
|
|
133
169
|
href: string;
|
|
134
170
|
title: string;
|
|
135
|
-
mainIcon:
|
|
136
|
-
secondaryIcon:
|
|
171
|
+
mainIcon: import("@carbon/react/icons").CarbonIconType;
|
|
172
|
+
secondaryIcon: import("@carbon/react/icons").CarbonIconType;
|
|
137
173
|
subtitle?: undefined;
|
|
138
174
|
isLoading?: undefined;
|
|
139
175
|
isDisabled?: undefined;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { ElementType, ReactNode } from 'react';
|
|
2
2
|
import { TasksControllerProps } from '../TasksController/TasksController';
|
|
3
3
|
import { WorkspaceSelectorProps } from '../WorkspaceSelector/WorkspaceSelector';
|
|
4
4
|
/** Animated Header */
|
|
5
5
|
export interface Tile {
|
|
6
6
|
href?: string | null;
|
|
7
7
|
id: string;
|
|
8
|
-
mainIcon?:
|
|
9
|
-
secondaryIcon?:
|
|
8
|
+
mainIcon?: ElementType | null;
|
|
9
|
+
secondaryIcon?: ElementType | null;
|
|
10
10
|
subtitle?: string | null;
|
|
11
11
|
title?: string | null;
|
|
12
12
|
customContent?: ReactNode | null;
|
|
13
13
|
isLoading?: boolean;
|
|
14
14
|
isDisabled?: boolean;
|
|
15
|
+
onClick?: () => void;
|
|
15
16
|
}
|
|
16
17
|
export interface TileGroup {
|
|
17
18
|
id: number;
|
|
@@ -10,6 +10,7 @@ import React, { useRef, useState, useEffect } from 'react';
|
|
|
10
10
|
import { Grid, Column, Tooltip, Button } 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
|
+
import '@carbon/react/icons';
|
|
13
14
|
import { BaseTile } from '../Tiles/BaseTile/BaseTile.js';
|
|
14
15
|
import TasksController from '../TasksController/TasksController.js';
|
|
15
16
|
import WorkspaceSelector from '../WorkspaceSelector/WorkspaceSelector.js';
|
|
@@ -138,7 +139,7 @@ const AnimatedHeader = _ref => {
|
|
|
138
139
|
md: 8,
|
|
139
140
|
lg: 12,
|
|
140
141
|
className: `${blockClass}__content`
|
|
141
|
-
}, workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
}, !!workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
|
|
142
143
|
className: `${blockClass}__workspace--container${!open ? ` ${contentCollapsed}` : ''}`
|
|
143
144
|
}, /*#__PURE__*/React.createElement(WorkspaceSelector, {
|
|
144
145
|
workspaceSelectorConfig: workspaceSelectorConfig,
|
|
@@ -148,7 +149,10 @@ const AnimatedHeader = _ref => {
|
|
|
148
149
|
className: `${blockClass}__tiles-container`
|
|
149
150
|
}, selectedTileGroup.tiles.map(tile => {
|
|
150
151
|
return /*#__PURE__*/React.createElement(BaseTile, {
|
|
151
|
-
onClick: () =>
|
|
152
|
+
onClick: tile.href || tile.onClick ? () => {
|
|
153
|
+
tileClickHandler?.(tile);
|
|
154
|
+
tile.onClick?.();
|
|
155
|
+
} : null,
|
|
152
156
|
key: tile.id,
|
|
153
157
|
id: tile.id,
|
|
154
158
|
open: open,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { ButtonBaseProps, DropdownProps } from '@carbon/react';
|
|
10
10
|
import { TileGroup } from '../AnimatedHeader/AnimatedHeader';
|
|
11
11
|
export interface TasksControllerConfig {
|
|
12
|
-
type: 'button' | 'dropdown';
|
|
12
|
+
type: 'button' | 'dropdown' | null;
|
|
13
13
|
isLoading?: boolean;
|
|
14
14
|
button?: {
|
|
15
15
|
text: string;
|
|
@@ -20,10 +20,10 @@ export interface TasksControllerConfig {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
export type TasksControllerProps = {
|
|
23
|
-
tasksControllerConfig?: TasksControllerConfig;
|
|
23
|
+
tasksControllerConfig?: TasksControllerConfig | null;
|
|
24
24
|
isLoading?: boolean;
|
|
25
25
|
allTileGroups?: TileGroup[];
|
|
26
|
-
selectedTileGroup?: TileGroup;
|
|
26
|
+
selectedTileGroup?: TileGroup | null;
|
|
27
27
|
setSelectedTileGroup: (e: any) => void;
|
|
28
28
|
};
|
|
29
29
|
declare const TasksController: ({ tasksControllerConfig, isLoading, allTileGroups, selectedTileGroup, setSelectedTileGroup, }: TasksControllerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -42,7 +42,7 @@ const TasksController = _ref => {
|
|
|
42
42
|
hideLabel: true,
|
|
43
43
|
type: 'inline',
|
|
44
44
|
items: allTileGroups,
|
|
45
|
-
selectedItem: selectedTileGroup,
|
|
45
|
+
selectedItem: selectedTileGroup ?? undefined,
|
|
46
46
|
onChange: e => {
|
|
47
47
|
setSelectedTileGroup?.(e);
|
|
48
48
|
dropdownCustomOnChange?.(e);
|
|
@@ -50,6 +50,9 @@ const TasksController = _ref => {
|
|
|
50
50
|
...dropdownOverrideProps
|
|
51
51
|
};
|
|
52
52
|
}, [allTileGroups, selectedTileGroup, setSelectedTileGroup, blockClass, dropdownCustomClass, dropdownOverrideProps, dropdownCustomOnChange]);
|
|
53
|
+
if (!tasksControllerConfig?.type) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
53
56
|
if (isLoading || tasksControllerConfig?.isLoading) {
|
|
54
57
|
return /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
|
|
55
58
|
className: `${blockClass}__task-controller-skeleton`
|
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import React from 'react';
|
|
9
|
+
import React, { ElementType } from 'react';
|
|
10
10
|
/** Primary UI component for user interaction */
|
|
11
11
|
interface AIPromptTileProps {
|
|
12
12
|
href?: string | null;
|
|
13
13
|
id?: string;
|
|
14
|
-
mainIcon?:
|
|
14
|
+
mainIcon?: ElementType | null;
|
|
15
15
|
open?: boolean;
|
|
16
16
|
productName?: string;
|
|
17
17
|
title?: string | null;
|
|
18
18
|
isLoading?: boolean;
|
|
19
19
|
isDisabled?: boolean;
|
|
20
20
|
disabledTaskLabel?: string;
|
|
21
|
+
onClick?: (() => void) | null;
|
|
21
22
|
}
|
|
22
23
|
export declare const AIPromptTile: React.FC<AIPromptTileProps>;
|
|
23
24
|
export {};
|
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
import { SkeletonPlaceholder, AILabel, TextInput, IconButton, Button } from '@carbon/react';
|
|
10
|
-
import * as index from '../../../node_modules/@carbon/icons-react/es/index.js';
|
|
11
10
|
import { usePrefix } from '../../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
|
|
12
|
-
import { Send } from '
|
|
11
|
+
import { Send } from '@carbon/react/icons';
|
|
13
12
|
|
|
14
|
-
var _AILabel;
|
|
13
|
+
var _AILabel, _Send;
|
|
15
14
|
|
|
16
15
|
/** Primary UI component for user interaction */
|
|
17
16
|
|
|
@@ -19,21 +18,20 @@ const AIPromptTile = _ref => {
|
|
|
19
18
|
let {
|
|
20
19
|
href,
|
|
21
20
|
id,
|
|
22
|
-
mainIcon,
|
|
21
|
+
mainIcon: MainIcon,
|
|
23
22
|
open,
|
|
24
23
|
productName,
|
|
25
24
|
title,
|
|
26
25
|
isLoading,
|
|
27
26
|
isDisabled,
|
|
28
|
-
disabledTaskLabel
|
|
27
|
+
disabledTaskLabel,
|
|
28
|
+
onClick
|
|
29
29
|
} = _ref;
|
|
30
30
|
const prefix = usePrefix();
|
|
31
31
|
const blockClass = `${prefix}--animated-header__ai-prompt-tile`;
|
|
32
32
|
const collapsed = `${blockClass}--collapsed`;
|
|
33
33
|
const disabled = `${blockClass}--disabled`;
|
|
34
34
|
const [textInput, setTextInput] = useState('');
|
|
35
|
-
const MainIcon = mainIcon ? index[mainIcon] : null;
|
|
36
|
-
const Send$1 = Send;
|
|
37
35
|
const handleTextInput = e => {
|
|
38
36
|
setTextInput(e.target.value);
|
|
39
37
|
};
|
|
@@ -92,9 +90,12 @@ const AIPromptTile = _ref => {
|
|
|
92
90
|
size: "sm",
|
|
93
91
|
disabled: !textInput,
|
|
94
92
|
align: "top-right",
|
|
95
|
-
onClick: () =>
|
|
93
|
+
onClick: () => {
|
|
94
|
+
onClick?.();
|
|
95
|
+
openInNewTab(`${href}&primed_chat=${textInput}`);
|
|
96
|
+
},
|
|
96
97
|
onKeyDown: handleTextInputKeyDown
|
|
97
|
-
}, /*#__PURE__*/React.createElement(Send
|
|
98
|
+
}, _Send || (_Send = /*#__PURE__*/React.createElement(Send, null)))), /*#__PURE__*/React.createElement("div", {
|
|
98
99
|
className: `${blockClass}--footer`
|
|
99
100
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
100
101
|
kind: "ghost",
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import React, { ReactNode } from 'react';
|
|
9
|
+
import React, { ElementType, ReactNode } from 'react';
|
|
10
10
|
/** Base Tile */
|
|
11
11
|
interface BaseTileProps {
|
|
12
12
|
id?: string;
|
|
13
13
|
open?: boolean;
|
|
14
14
|
href?: string | null;
|
|
15
|
-
mainIcon?:
|
|
16
|
-
secondaryIcon?:
|
|
15
|
+
mainIcon?: ElementType | null;
|
|
16
|
+
secondaryIcon?: ElementType | null;
|
|
17
17
|
title?: string | null;
|
|
18
18
|
subtitle?: string | null;
|
|
19
19
|
productName?: string;
|
|
@@ -21,7 +21,7 @@ interface BaseTileProps {
|
|
|
21
21
|
isLoading?: boolean;
|
|
22
22
|
isDisabled?: boolean;
|
|
23
23
|
disabledTaskLabel?: string;
|
|
24
|
-
onClick?: () => void;
|
|
24
|
+
onClick?: (() => void) | null;
|
|
25
25
|
}
|
|
26
26
|
export declare const BaseTile: React.FC<BaseTileProps>;
|
|
27
27
|
export {};
|
|
@@ -6,21 +6,15 @@
|
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import React
|
|
9
|
+
import React from 'react';
|
|
10
10
|
/** Primary UI component for user interaction */
|
|
11
11
|
interface GlassTileProps {
|
|
12
12
|
href?: string | null;
|
|
13
13
|
id?: string;
|
|
14
|
-
mainIcon?: string | null;
|
|
15
|
-
open?: boolean;
|
|
16
|
-
secondaryIcon?: string | null;
|
|
17
|
-
subtitle?: string | null;
|
|
18
|
-
title?: string | null;
|
|
19
|
-
customContent?: ReactNode;
|
|
20
14
|
isLoading?: boolean;
|
|
21
15
|
isDisabled?: boolean;
|
|
22
16
|
disabledTaskLabel?: string;
|
|
23
|
-
onClick?: () => void;
|
|
17
|
+
onClick?: (() => void) | null;
|
|
24
18
|
}
|
|
25
19
|
export declare const GlassTile: React.FC<GlassTileProps>;
|
|
26
20
|
export {};
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { Link
|
|
10
|
-
import * as index from '../../../node_modules/@carbon/icons-react/es/index.js';
|
|
9
|
+
import { Link } from '@carbon/react';
|
|
11
10
|
import { usePrefix } from '../../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
|
|
11
|
+
import { GlassTileBody } from './GlassTileBody.js';
|
|
12
12
|
|
|
13
13
|
/** Primary UI component for user interaction */
|
|
14
14
|
|
|
@@ -29,9 +29,23 @@ const GlassTile = _ref => {
|
|
|
29
29
|
} = _ref;
|
|
30
30
|
const prefix = usePrefix();
|
|
31
31
|
const blockClass = `${prefix}--animated-header__glass-tile`;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const body = /*#__PURE__*/React.createElement(GlassTileBody, {
|
|
33
|
+
mainIcon: mainIcon,
|
|
34
|
+
open: open,
|
|
35
|
+
secondaryIcon: secondaryIcon,
|
|
36
|
+
title: title,
|
|
37
|
+
subtitle: subtitle,
|
|
38
|
+
customContent: customContent,
|
|
39
|
+
isLoading: isLoading
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Non-interactive tile
|
|
43
|
+
if (!href && !glassTileClickHandler) {
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
46
|
+
key: id
|
|
47
|
+
}, body);
|
|
48
|
+
}
|
|
35
49
|
return /*#__PURE__*/React.createElement(Link, {
|
|
36
50
|
onClick: () => {
|
|
37
51
|
glassTileClickHandler?.();
|
|
@@ -41,29 +55,7 @@ const GlassTile = _ref => {
|
|
|
41
55
|
href: href ?? undefined,
|
|
42
56
|
disabled: isDisabled || isLoading,
|
|
43
57
|
title: isDisabled ? disabledTaskLabel ?? '' : ''
|
|
44
|
-
},
|
|
45
|
-
className: `${blockClass}--loading-skeleton`
|
|
46
|
-
}) : /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
48
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: `${blockClass}--body-background`
|
|
50
|
-
}), customContent ? /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
className: `${blockClass}--custom-content`
|
|
52
|
-
}, customContent) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
className: `${blockClass}--icons`
|
|
54
|
-
}, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
|
|
55
|
-
fill: `var(--cds-icon-secondary)`,
|
|
56
|
-
size: 24
|
|
57
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
58
|
-
className: `${blockClass}--title`
|
|
59
|
-
}, title), /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: `${blockClass}--footer`
|
|
61
|
-
}, subtitle && /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
className: `${blockClass}--subtitle`
|
|
63
|
-
}, subtitle), SecondaryIcon && /*#__PURE__*/React.createElement(SecondaryIcon, {
|
|
64
|
-
size: 16,
|
|
65
|
-
fill: `var(--cds-icon-secondary)`
|
|
66
|
-
})))));
|
|
58
|
+
}, body);
|
|
67
59
|
};
|
|
68
60
|
|
|
69
61
|
export { GlassTile };
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { ElementType, ReactNode } from 'react';
|
|
10
|
+
export type GlassTileBodyProps = {
|
|
11
|
+
mainIcon?: ElementType | null;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
secondaryIcon?: ElementType | null;
|
|
14
|
+
subtitle?: string | null;
|
|
15
|
+
title?: string | null;
|
|
16
|
+
customContent?: ReactNode;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare const GlassTileBody: ({ mainIcon: MainIcon, open, secondaryIcon: SecondaryIcon, subtitle, title, customContent, isLoading, }: GlassTileBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import { usePrefix } from '../../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
|
|
10
|
+
import { SkeletonPlaceholder } from '@carbon/react';
|
|
11
|
+
|
|
12
|
+
const GlassTileBody = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
mainIcon: MainIcon,
|
|
15
|
+
open,
|
|
16
|
+
secondaryIcon: SecondaryIcon,
|
|
17
|
+
subtitle,
|
|
18
|
+
title,
|
|
19
|
+
customContent,
|
|
20
|
+
isLoading
|
|
21
|
+
} = _ref;
|
|
22
|
+
const prefix = usePrefix();
|
|
23
|
+
const blockClass = `${prefix}--animated-header__glass-tile`;
|
|
24
|
+
const collapsed = `${blockClass}--collapsed`;
|
|
25
|
+
if (isLoading) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
|
|
27
|
+
className: `${blockClass}--loading-skeleton`
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: `${blockClass}--body-background`
|
|
34
|
+
}), customContent ? /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: `${blockClass}--custom-content`
|
|
36
|
+
}, customContent) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: `${blockClass}--icons`
|
|
38
|
+
}, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
|
|
39
|
+
fill: `var(--cds-icon-secondary)`,
|
|
40
|
+
size: 24
|
|
41
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: `${blockClass}--title`
|
|
43
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: `${blockClass}--footer`
|
|
45
|
+
}, subtitle && /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: `${blockClass}--subtitle`
|
|
47
|
+
}, subtitle), SecondaryIcon && /*#__PURE__*/React.createElement(SecondaryIcon, {
|
|
48
|
+
size: 16,
|
|
49
|
+
fill: `var(--cds-icon-secondary)`
|
|
50
|
+
}))));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { GlassTileBody };
|
|
@@ -14,12 +14,12 @@ export interface Workspace {
|
|
|
14
14
|
export type WorkspaceSelectorConfig = {
|
|
15
15
|
propsOverrides: Partial<Omit<DropdownProps<Workspace>, 'id' | 'items' | 'selectedItem' | 'setSelectedWorkspace'>>;
|
|
16
16
|
allWorkspaces: Workspace[];
|
|
17
|
-
selectedWorkspace?: Workspace;
|
|
17
|
+
selectedWorkspace?: Workspace | null;
|
|
18
18
|
setSelectedWorkspace: (e: any) => void;
|
|
19
19
|
isLoading?: boolean;
|
|
20
20
|
};
|
|
21
21
|
export type WorkspaceSelectorProps = {
|
|
22
|
-
workspaceSelectorConfig?: WorkspaceSelectorConfig;
|
|
22
|
+
workspaceSelectorConfig?: WorkspaceSelectorConfig | null;
|
|
23
23
|
userName?: string;
|
|
24
24
|
isLoading?: boolean;
|
|
25
25
|
};
|
|
@@ -35,7 +35,7 @@ const WorkspaceSelector = _ref => {
|
|
|
35
35
|
hideLabel: true,
|
|
36
36
|
type: 'inline',
|
|
37
37
|
items: workspaceSelectorConfig?.allWorkspaces,
|
|
38
|
-
selectedItem: workspaceSelectorConfig?.selectedWorkspace,
|
|
38
|
+
selectedItem: workspaceSelectorConfig?.selectedWorkspace ?? undefined,
|
|
39
39
|
onChange: e => {
|
|
40
40
|
workspaceSelectorConfig?.setSelectedWorkspace?.(e);
|
|
41
41
|
dropdownCustomOnChange?.(e);
|
package/es/index.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
export { default as AnimatedHeader } from './components/AnimatedHeader/AnimatedHeader.js';
|
|
9
9
|
import 'react';
|
|
10
10
|
import '@carbon/react';
|
|
11
|
+
import '@carbon/react/icons';
|
|
11
12
|
export { BaseTile } from './components/Tiles/BaseTile/BaseTile.js';
|
|
12
13
|
export { default as dataFabricAnimatedLight } from './assets/animated/header_1312x738_data_fabric_light_03.json.js';
|
|
13
14
|
export { default as dataFabricAnimatedDark } from './assets/animated/header_1312x738_data_fabric_dark_06.json.js';
|