@carbon-labs/react-animated-header 0.15.0 → 0.16.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 +882 -44
- package/es/__stories__/data/index.d.ts +112 -3
- package/es/components/AnimatedHeader/AnimatedHeader.d.ts +11 -31
- package/es/components/AnimatedHeader/AnimatedHeader.js +65 -104
- package/es/components/TasksController/TasksController.d.ts +30 -0
- package/es/components/TasksController/TasksController.js +73 -0
- package/es/components/Tiles/AIPromptTile/AIPromptTile.d.ts +6 -3
- package/es/components/Tiles/AIPromptTile/AIPromptTile.js +12 -6
- package/es/components/Tiles/BaseTile/BaseTile.d.ts +8 -5
- package/es/components/Tiles/BaseTile/BaseTile.js +5 -27
- package/es/components/Tiles/GlassTile/GlassTile.d.ts +8 -5
- package/es/components/Tiles/GlassTile/GlassTile.js +10 -3
- package/es/components/WorkspaceSelector/WorkspaceSelector.d.ts +27 -0
- package/es/components/WorkspaceSelector/WorkspaceSelector.js +57 -0
- package/es/index.d.ts +2 -0
- package/lib/__stories__/AnimatedHeader.stories.d.ts +882 -44
- package/lib/__stories__/data/index.d.ts +112 -3
- package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +11 -31
- package/lib/components/AnimatedHeader/AnimatedHeader.js +64 -103
- package/lib/components/TasksController/TasksController.d.ts +30 -0
- package/lib/components/TasksController/TasksController.js +77 -0
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.d.ts +6 -3
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.js +11 -5
- package/lib/components/Tiles/BaseTile/BaseTile.d.ts +8 -5
- package/lib/components/Tiles/BaseTile/BaseTile.js +5 -27
- package/lib/components/Tiles/GlassTile/GlassTile.d.ts +8 -5
- package/lib/components/Tiles/GlassTile/GlassTile.js +9 -2
- package/lib/components/WorkspaceSelector/WorkspaceSelector.d.ts +27 -0
- package/lib/components/WorkspaceSelector/WorkspaceSelector.js +61 -0
- package/lib/index.d.ts +2 -0
- package/package.json +2 -2
- package/scss/AnimatedHeader/animated-header.scss +37 -6
- package/scss/Tiles/AIPromptTile/ai-prompt-tile.scss +22 -0
- package/scss/Tiles/GlassTile/glass-tile.scss +22 -0
|
@@ -13,33 +13,11 @@ var GlassTile = require('../GlassTile/GlassTile.js');
|
|
|
13
13
|
|
|
14
14
|
/** Base Tile */
|
|
15
15
|
|
|
16
|
-
const BaseTile =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
mainIcon,
|
|
22
|
-
secondaryIcon,
|
|
23
|
-
title,
|
|
24
|
-
subtitle,
|
|
25
|
-
productName,
|
|
26
|
-
customContent,
|
|
27
|
-
onClick
|
|
28
|
-
} = _ref;
|
|
29
|
-
const props = {
|
|
30
|
-
id,
|
|
31
|
-
open,
|
|
32
|
-
href,
|
|
33
|
-
mainIcon,
|
|
34
|
-
secondaryIcon,
|
|
35
|
-
title,
|
|
36
|
-
subtitle,
|
|
37
|
-
productName,
|
|
38
|
-
customContent,
|
|
39
|
-
onClick
|
|
40
|
-
};
|
|
41
|
-
const tile = id === 'ai-tile' ? /*#__PURE__*/React.createElement(AIPromptTile.AIPromptTile, props) : /*#__PURE__*/React.createElement(GlassTile.GlassTile, props);
|
|
42
|
-
return tile;
|
|
16
|
+
const BaseTile = props => {
|
|
17
|
+
if (props.id === 'ai-tile') {
|
|
18
|
+
return /*#__PURE__*/React.createElement(AIPromptTile.AIPromptTile, props);
|
|
19
|
+
}
|
|
20
|
+
return /*#__PURE__*/React.createElement(GlassTile.GlassTile, props);
|
|
43
21
|
};
|
|
44
22
|
|
|
45
23
|
exports.BaseTile = BaseTile;
|
|
@@ -9,14 +9,17 @@
|
|
|
9
9
|
import React, { ReactNode } from 'react';
|
|
10
10
|
/** Primary UI component for user interaction */
|
|
11
11
|
interface GlassTileProps {
|
|
12
|
-
href?: string;
|
|
12
|
+
href?: string | null;
|
|
13
13
|
id?: string;
|
|
14
|
-
mainIcon?: string;
|
|
14
|
+
mainIcon?: string | null;
|
|
15
15
|
open?: boolean;
|
|
16
|
-
secondaryIcon?: string;
|
|
17
|
-
subtitle?: string;
|
|
18
|
-
title?: string;
|
|
16
|
+
secondaryIcon?: string | null;
|
|
17
|
+
subtitle?: string | null;
|
|
18
|
+
title?: string | null;
|
|
19
19
|
customContent?: ReactNode;
|
|
20
|
+
isLoading?: boolean;
|
|
21
|
+
isDisabled?: boolean;
|
|
22
|
+
disabledTaskLabel?: string;
|
|
20
23
|
onClick?: () => void;
|
|
21
24
|
}
|
|
22
25
|
export declare const GlassTile: React.FC<GlassTileProps>;
|
|
@@ -24,6 +24,9 @@ const GlassTile = _ref => {
|
|
|
24
24
|
subtitle,
|
|
25
25
|
title,
|
|
26
26
|
customContent,
|
|
27
|
+
isLoading,
|
|
28
|
+
isDisabled,
|
|
29
|
+
disabledTaskLabel,
|
|
27
30
|
onClick: glassTileClickHandler
|
|
28
31
|
} = _ref;
|
|
29
32
|
const prefix = usePrefix.usePrefix();
|
|
@@ -37,8 +40,12 @@ const GlassTile = _ref => {
|
|
|
37
40
|
},
|
|
38
41
|
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
39
42
|
key: id,
|
|
40
|
-
href: href
|
|
41
|
-
|
|
43
|
+
href: href ?? undefined,
|
|
44
|
+
disabled: isDisabled || isLoading,
|
|
45
|
+
title: isDisabled ? disabledTaskLabel ?? '' : ''
|
|
46
|
+
}, isLoading ? /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
|
|
47
|
+
className: `${blockClass}--loading-skeleton`
|
|
48
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
42
49
|
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
43
50
|
}, /*#__PURE__*/React.createElement("div", {
|
|
44
51
|
className: `${blockClass}--body-background`
|
|
@@ -0,0 +1,27 @@
|
|
|
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 { DropdownProps } from '@carbon/react';
|
|
10
|
+
export interface Workspace {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
export type WorkspaceSelectorConfig = {
|
|
15
|
+
propsOverrides: Partial<Omit<DropdownProps<Workspace>, 'id' | 'items' | 'selectedItem' | 'setSelectedWorkspace'>>;
|
|
16
|
+
allWorkspaces: Workspace[];
|
|
17
|
+
selectedWorkspace?: Workspace;
|
|
18
|
+
setSelectedWorkspace: (e: any) => void;
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type WorkspaceSelectorProps = {
|
|
22
|
+
workspaceSelectorConfig?: WorkspaceSelectorConfig;
|
|
23
|
+
userName?: string;
|
|
24
|
+
isLoading?: boolean;
|
|
25
|
+
};
|
|
26
|
+
declare const WorkspaceSelector: ({ workspaceSelectorConfig, userName, isLoading, }: WorkspaceSelectorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
27
|
+
export default WorkspaceSelector;
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var react = require('@carbon/react');
|
|
13
|
+
var usePrefix = require('../../node_modules/@carbon-labs/utilities/es/usePrefix.js');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
|
|
16
|
+
const WorkspaceSelector = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
workspaceSelectorConfig,
|
|
19
|
+
userName,
|
|
20
|
+
isLoading
|
|
21
|
+
} = _ref;
|
|
22
|
+
const {
|
|
23
|
+
className: dropdownCustomClass,
|
|
24
|
+
onChange: dropdownCustomOnChange,
|
|
25
|
+
...dropdownOverrideProps
|
|
26
|
+
} = workspaceSelectorConfig?.propsOverrides || {};
|
|
27
|
+
const prefix = usePrefix.usePrefix();
|
|
28
|
+
const blockClass = `${prefix}--animated-header`;
|
|
29
|
+
const dropdownProps = React.useMemo(() => {
|
|
30
|
+
if (!workspaceSelectorConfig?.allWorkspaces) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
id: `${blockClass}__workspace`,
|
|
35
|
+
className: `${blockClass}__workspace${dropdownCustomClass ? ` ${dropdownCustomClass}` : ''}`,
|
|
36
|
+
size: 'sm',
|
|
37
|
+
titleText: 'Label',
|
|
38
|
+
label: `Open in: ${userName}'s workspace` || `Select a workspace`,
|
|
39
|
+
hideLabel: true,
|
|
40
|
+
type: 'inline',
|
|
41
|
+
items: workspaceSelectorConfig?.allWorkspaces,
|
|
42
|
+
selectedItem: workspaceSelectorConfig?.selectedWorkspace,
|
|
43
|
+
onChange: e => {
|
|
44
|
+
workspaceSelectorConfig?.setSelectedWorkspace?.(e);
|
|
45
|
+
dropdownCustomOnChange?.(e);
|
|
46
|
+
},
|
|
47
|
+
...dropdownOverrideProps
|
|
48
|
+
};
|
|
49
|
+
}, [blockClass, dropdownCustomClass, dropdownOverrideProps, userName, workspaceSelectorConfig, dropdownCustomOnChange]);
|
|
50
|
+
if (isLoading || workspaceSelectorConfig?.isLoading) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
|
|
52
|
+
className: `${blockClass}__workspace-selector-skeleton`
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!dropdownProps) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return /*#__PURE__*/React.createElement(react.Dropdown, dropdownProps);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.default = WorkspaceSelector;
|
package/lib/index.d.ts
CHANGED
|
@@ -9,4 +9,6 @@
|
|
|
9
9
|
import AnimatedHeader from './components/AnimatedHeader/AnimatedHeader';
|
|
10
10
|
import { BaseTile } from './components/Tiles/index.js';
|
|
11
11
|
export * from './assets';
|
|
12
|
+
export type { Workspace, WorkspaceSelectorConfig, } from './components/WorkspaceSelector/WorkspaceSelector';
|
|
13
|
+
export type { TasksControllerConfig } from './components/TasksController/TasksController';
|
|
12
14
|
export { AnimatedHeader, BaseTile };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon-labs/react-animated-header",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.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": "b2adf21b63ab6a230373abe160cde8fc36251197"
|
|
49
49
|
}
|
|
@@ -49,11 +49,11 @@ body {
|
|
|
49
49
|
overflow: visible;
|
|
50
50
|
background: $background;
|
|
51
51
|
inline-size: 100%;
|
|
52
|
-
max-block-size:
|
|
52
|
+
max-block-size: 200vh;
|
|
53
53
|
outline: 1px solid transparent;
|
|
54
54
|
padding-block: 0 $spacing-10;
|
|
55
55
|
transition: padding 500ms motion.motion(standard, expressive),
|
|
56
|
-
max-
|
|
56
|
+
max-block-size 500ms motion.motion(standard, expressive), color 200ms linear,
|
|
57
57
|
background-color 200ms linear,
|
|
58
58
|
outline 500ms motion.motion(standard, expressive);
|
|
59
59
|
writing-mode: horizontal-tb;
|
|
@@ -226,6 +226,32 @@ body {
|
|
|
226
226
|
max-inline-size: fit-content;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
.#{$prefix}__task-controller-skeleton {
|
|
230
|
+
background: $layer-01;
|
|
231
|
+
block-size: $spacing-08;
|
|
232
|
+
inline-size: auto;
|
|
233
|
+
max-inline-size: 18rem;
|
|
234
|
+
|
|
235
|
+
opacity: 0.7;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.#{$prefix}__task-controller-skeleton::before {
|
|
239
|
+
background: $layer-02;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.#{$prefix}__workspace-selector-skeleton {
|
|
243
|
+
background: $layer-01;
|
|
244
|
+
block-size: $spacing-07;
|
|
245
|
+
inline-size: auto;
|
|
246
|
+
max-inline-size: 18rem;
|
|
247
|
+
|
|
248
|
+
opacity: 0.7;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.#{$prefix}__workspace-selector-skeleton::before {
|
|
252
|
+
background: $layer-02;
|
|
253
|
+
}
|
|
254
|
+
|
|
229
255
|
.#{$prefix}__header-dropdown--container {
|
|
230
256
|
inline-size: auto;
|
|
231
257
|
max-inline-size: 18rem;
|
|
@@ -284,6 +310,13 @@ body {
|
|
|
284
310
|
animation-fill-mode: both;
|
|
285
311
|
}
|
|
286
312
|
|
|
313
|
+
/* support for Safari */
|
|
314
|
+
@supports (font: -apple-system-body) and (-webkit-appearance: none) {
|
|
315
|
+
.#{$prefix}__tile {
|
|
316
|
+
animation: none;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
287
320
|
.#{$prefix}__tile:nth-child(1) {
|
|
288
321
|
animation-delay: 383.333ms;
|
|
289
322
|
}
|
|
@@ -482,10 +515,8 @@ body {
|
|
|
482
515
|
inline-size: calc(100% - 16px);
|
|
483
516
|
}
|
|
484
517
|
|
|
485
|
-
.#{$prefix}__tiles-container
|
|
486
|
-
|
|
487
|
-
~ .#{$prefix}__glass-tile {
|
|
488
|
-
inline-size: calc(50% - 16px);
|
|
518
|
+
.#{$prefix}__tiles-container > ##{$prefix}__ai-prompt-tile {
|
|
519
|
+
flex-grow: 0.5;
|
|
489
520
|
}
|
|
490
521
|
}
|
|
491
522
|
|
|
@@ -23,6 +23,16 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
23
23
|
text-decoration: none;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
.#{$prefix}--disabled {
|
|
27
|
+
outline: 0;
|
|
28
|
+
|
|
29
|
+
* {
|
|
30
|
+
color: $text-disabled;
|
|
31
|
+
fill: $text-disabled;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
.#{$prefix}:hover,
|
|
27
37
|
.#{$prefix}:active,
|
|
28
38
|
.#{$prefix}:focus {
|
|
@@ -192,6 +202,18 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
192
202
|
z-index: 4;
|
|
193
203
|
}
|
|
194
204
|
|
|
205
|
+
.#{$prefix}--loading-skeleton {
|
|
206
|
+
background: $layer-01;
|
|
207
|
+
block-size: 100%;
|
|
208
|
+
inline-size: 100%;
|
|
209
|
+
|
|
210
|
+
opacity: 0.7;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.#{$prefix}--loading-skeleton::before {
|
|
214
|
+
background: $layer-02;
|
|
215
|
+
}
|
|
216
|
+
|
|
195
217
|
@keyframes animate-border {
|
|
196
218
|
0% {
|
|
197
219
|
background-position: 100% 0%;
|
|
@@ -23,6 +23,16 @@ $prefix: 'clabs--animated-header__glass-tile' !default;
|
|
|
23
23
|
text-decoration: none;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
.#{$prefix}[aria-disabled='true'] {
|
|
27
|
+
outline: none;
|
|
28
|
+
|
|
29
|
+
* {
|
|
30
|
+
color: $text-disabled;
|
|
31
|
+
fill: $text-disabled;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
.#{$prefix}:hover,
|
|
27
37
|
.#{$prefix}:active,
|
|
28
38
|
.#{$prefix}:focus {
|
|
@@ -133,3 +143,15 @@ $prefix: 'clabs--animated-header__glass-tile' !default;
|
|
|
133
143
|
.#{$prefix}--custom-content {
|
|
134
144
|
z-index: 2;
|
|
135
145
|
}
|
|
146
|
+
|
|
147
|
+
.#{$prefix}--loading-skeleton {
|
|
148
|
+
background: $layer-01;
|
|
149
|
+
block-size: 100%;
|
|
150
|
+
inline-size: 100%;
|
|
151
|
+
|
|
152
|
+
opacity: 0.7;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.#{$prefix}--loading-skeleton::before {
|
|
156
|
+
background: $layer-02;
|
|
157
|
+
}
|