@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;
|
|
@@ -14,6 +14,7 @@ var React = require('react');
|
|
|
14
14
|
var react = require('@carbon/react');
|
|
15
15
|
var lottie = require('../../_virtual/lottie.js');
|
|
16
16
|
var usePrefix = require('../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
17
|
+
require('@carbon/react/icons');
|
|
17
18
|
var BaseTile = require('../Tiles/BaseTile/BaseTile.js');
|
|
18
19
|
var TasksController = require('../TasksController/TasksController.js');
|
|
19
20
|
var WorkspaceSelector = require('../WorkspaceSelector/WorkspaceSelector.js');
|
|
@@ -142,7 +143,7 @@ const AnimatedHeader = _ref => {
|
|
|
142
143
|
md: 8,
|
|
143
144
|
lg: 12,
|
|
144
145
|
className: `${blockClass}__content`
|
|
145
|
-
}, workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
}, !!workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
|
|
146
147
|
className: `${blockClass}__workspace--container${!open ? ` ${contentCollapsed}` : ''}`
|
|
147
148
|
}, /*#__PURE__*/React.createElement(WorkspaceSelector.default, {
|
|
148
149
|
workspaceSelectorConfig: workspaceSelectorConfig,
|
|
@@ -152,7 +153,10 @@ const AnimatedHeader = _ref => {
|
|
|
152
153
|
className: `${blockClass}__tiles-container`
|
|
153
154
|
}, selectedTileGroup.tiles.map(tile => {
|
|
154
155
|
return /*#__PURE__*/React.createElement(BaseTile.BaseTile, {
|
|
155
|
-
onClick: () =>
|
|
156
|
+
onClick: tile.href || tile.onClick ? () => {
|
|
157
|
+
tileClickHandler?.(tile);
|
|
158
|
+
tile.onClick?.();
|
|
159
|
+
} : null,
|
|
156
160
|
key: tile.id,
|
|
157
161
|
id: tile.id,
|
|
158
162
|
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;
|
|
@@ -46,7 +46,7 @@ const TasksController = _ref => {
|
|
|
46
46
|
hideLabel: true,
|
|
47
47
|
type: 'inline',
|
|
48
48
|
items: allTileGroups,
|
|
49
|
-
selectedItem: selectedTileGroup,
|
|
49
|
+
selectedItem: selectedTileGroup ?? undefined,
|
|
50
50
|
onChange: e => {
|
|
51
51
|
setSelectedTileGroup?.(e);
|
|
52
52
|
dropdownCustomOnChange?.(e);
|
|
@@ -54,6 +54,9 @@ const TasksController = _ref => {
|
|
|
54
54
|
...dropdownOverrideProps
|
|
55
55
|
};
|
|
56
56
|
}, [allTileGroups, selectedTileGroup, setSelectedTileGroup, blockClass, dropdownCustomClass, dropdownOverrideProps, dropdownCustomOnChange]);
|
|
57
|
+
if (!tasksControllerConfig?.type) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
57
60
|
if (isLoading || tasksControllerConfig?.isLoading) {
|
|
58
61
|
return /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
|
|
59
62
|
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 {};
|
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var react = require('@carbon/react');
|
|
12
|
-
var index = require('../../../node_modules/@carbon/icons-react/es/index.js');
|
|
13
12
|
var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
14
|
-
var
|
|
13
|
+
var icons = require('@carbon/react/icons');
|
|
15
14
|
|
|
16
|
-
var _AILabel;
|
|
15
|
+
var _AILabel, _Send;
|
|
17
16
|
|
|
18
17
|
/** Primary UI component for user interaction */
|
|
19
18
|
|
|
@@ -21,21 +20,20 @@ const AIPromptTile = _ref => {
|
|
|
21
20
|
let {
|
|
22
21
|
href,
|
|
23
22
|
id,
|
|
24
|
-
mainIcon,
|
|
23
|
+
mainIcon: MainIcon,
|
|
25
24
|
open,
|
|
26
25
|
productName,
|
|
27
26
|
title,
|
|
28
27
|
isLoading,
|
|
29
28
|
isDisabled,
|
|
30
|
-
disabledTaskLabel
|
|
29
|
+
disabledTaskLabel,
|
|
30
|
+
onClick
|
|
31
31
|
} = _ref;
|
|
32
32
|
const prefix = usePrefix.usePrefix();
|
|
33
33
|
const blockClass = `${prefix}--animated-header__ai-prompt-tile`;
|
|
34
34
|
const collapsed = `${blockClass}--collapsed`;
|
|
35
35
|
const disabled = `${blockClass}--disabled`;
|
|
36
36
|
const [textInput, setTextInput] = React.useState('');
|
|
37
|
-
const MainIcon = mainIcon ? index[mainIcon] : null;
|
|
38
|
-
const Send = bucket15.Send;
|
|
39
37
|
const handleTextInput = e => {
|
|
40
38
|
setTextInput(e.target.value);
|
|
41
39
|
};
|
|
@@ -94,9 +92,12 @@ const AIPromptTile = _ref => {
|
|
|
94
92
|
size: "sm",
|
|
95
93
|
disabled: !textInput,
|
|
96
94
|
align: "top-right",
|
|
97
|
-
onClick: () =>
|
|
95
|
+
onClick: () => {
|
|
96
|
+
onClick?.();
|
|
97
|
+
openInNewTab(`${href}&primed_chat=${textInput}`);
|
|
98
|
+
},
|
|
98
99
|
onKeyDown: handleTextInputKeyDown
|
|
99
|
-
}, /*#__PURE__*/React.createElement(Send, null))), /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
}, _Send || (_Send = /*#__PURE__*/React.createElement(icons.Send, null)))), /*#__PURE__*/React.createElement("div", {
|
|
100
101
|
className: `${blockClass}--footer`
|
|
101
102
|
}, /*#__PURE__*/React.createElement(react.Button, {
|
|
102
103
|
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 {};
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var react = require('@carbon/react');
|
|
12
|
-
var index = require('../../../node_modules/@carbon/icons-react/es/index.js');
|
|
13
12
|
var usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
13
|
+
var GlassTileBody = require('./GlassTileBody.js');
|
|
14
14
|
|
|
15
15
|
/** Primary UI component for user interaction */
|
|
16
16
|
|
|
@@ -31,9 +31,23 @@ const GlassTile = _ref => {
|
|
|
31
31
|
} = _ref;
|
|
32
32
|
const prefix = usePrefix.usePrefix();
|
|
33
33
|
const blockClass = `${prefix}--animated-header__glass-tile`;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const body = /*#__PURE__*/React.createElement(GlassTileBody.GlassTileBody, {
|
|
35
|
+
mainIcon: mainIcon,
|
|
36
|
+
open: open,
|
|
37
|
+
secondaryIcon: secondaryIcon,
|
|
38
|
+
title: title,
|
|
39
|
+
subtitle: subtitle,
|
|
40
|
+
customContent: customContent,
|
|
41
|
+
isLoading: isLoading
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Non-interactive tile
|
|
45
|
+
if (!href && !glassTileClickHandler) {
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
48
|
+
key: id
|
|
49
|
+
}, body);
|
|
50
|
+
}
|
|
37
51
|
return /*#__PURE__*/React.createElement(react.Link, {
|
|
38
52
|
onClick: () => {
|
|
39
53
|
glassTileClickHandler?.();
|
|
@@ -43,29 +57,7 @@ const GlassTile = _ref => {
|
|
|
43
57
|
href: href ?? undefined,
|
|
44
58
|
disabled: isDisabled || isLoading,
|
|
45
59
|
title: isDisabled ? disabledTaskLabel ?? '' : ''
|
|
46
|
-
},
|
|
47
|
-
className: `${blockClass}--loading-skeleton`
|
|
48
|
-
}) : /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
50
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
className: `${blockClass}--body-background`
|
|
52
|
-
}), customContent ? /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
className: `${blockClass}--custom-content`
|
|
54
|
-
}, customContent) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: `${blockClass}--icons`
|
|
56
|
-
}, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
|
|
57
|
-
fill: `var(--cds-icon-secondary)`,
|
|
58
|
-
size: 24
|
|
59
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: `${blockClass}--title`
|
|
61
|
-
}, title), /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
className: `${blockClass}--footer`
|
|
63
|
-
}, subtitle && /*#__PURE__*/React.createElement("div", {
|
|
64
|
-
className: `${blockClass}--subtitle`
|
|
65
|
-
}, subtitle), SecondaryIcon && /*#__PURE__*/React.createElement(SecondaryIcon, {
|
|
66
|
-
size: 16,
|
|
67
|
-
fill: `var(--cds-icon-secondary)`
|
|
68
|
-
})))));
|
|
60
|
+
}, body);
|
|
69
61
|
};
|
|
70
62
|
|
|
71
63
|
exports.GlassTile = 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,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 usePrefix = require('../../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
12
|
+
var react = require('@carbon/react');
|
|
13
|
+
|
|
14
|
+
const GlassTileBody = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
mainIcon: MainIcon,
|
|
17
|
+
open,
|
|
18
|
+
secondaryIcon: SecondaryIcon,
|
|
19
|
+
subtitle,
|
|
20
|
+
title,
|
|
21
|
+
customContent,
|
|
22
|
+
isLoading
|
|
23
|
+
} = _ref;
|
|
24
|
+
const prefix = usePrefix.usePrefix();
|
|
25
|
+
const blockClass = `${prefix}--animated-header__glass-tile`;
|
|
26
|
+
const collapsed = `${blockClass}--collapsed`;
|
|
27
|
+
if (isLoading) {
|
|
28
|
+
return /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
|
|
29
|
+
className: `${blockClass}--loading-skeleton`
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
34
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: `${blockClass}--body-background`
|
|
36
|
+
}), customContent ? /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: `${blockClass}--custom-content`
|
|
38
|
+
}, customContent) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__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.GlassTileBody = 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
|
};
|
|
@@ -39,7 +39,7 @@ const WorkspaceSelector = _ref => {
|
|
|
39
39
|
hideLabel: true,
|
|
40
40
|
type: 'inline',
|
|
41
41
|
items: workspaceSelectorConfig?.allWorkspaces,
|
|
42
|
-
selectedItem: workspaceSelectorConfig?.selectedWorkspace,
|
|
42
|
+
selectedItem: workspaceSelectorConfig?.selectedWorkspace ?? undefined,
|
|
43
43
|
onChange: e => {
|
|
44
44
|
workspaceSelectorConfig?.setSelectedWorkspace?.(e);
|
|
45
45
|
dropdownCustomOnChange?.(e);
|
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
var AnimatedHeader = require('./components/AnimatedHeader/AnimatedHeader.js');
|
|
11
11
|
require('react');
|
|
12
12
|
require('@carbon/react');
|
|
13
|
+
require('@carbon/react/icons');
|
|
13
14
|
var BaseTile = require('./components/Tiles/BaseTile/BaseTile.js');
|
|
14
15
|
var header_1312x738_data_fabric_light_03 = require('./assets/animated/header_1312x738_data_fabric_light_03.json.js');
|
|
15
16
|
var header_1312x738_data_fabric_dark_06 = require('./assets/animated/header_1312x738_data_fabric_dark_06.json.js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon-labs/react-animated-header",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@carbon-labs/utilities": "canary"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "72a646fa862d36c040b7f205167464831f6d59c5"
|
|
49
49
|
}
|