@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
|
@@ -11,33 +11,11 @@ import { GlassTile } from '../GlassTile/GlassTile.js';
|
|
|
11
11
|
|
|
12
12
|
/** Base Tile */
|
|
13
13
|
|
|
14
|
-
const BaseTile =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
mainIcon,
|
|
20
|
-
secondaryIcon,
|
|
21
|
-
title,
|
|
22
|
-
subtitle,
|
|
23
|
-
productName,
|
|
24
|
-
customContent,
|
|
25
|
-
onClick
|
|
26
|
-
} = _ref;
|
|
27
|
-
const props = {
|
|
28
|
-
id,
|
|
29
|
-
open,
|
|
30
|
-
href,
|
|
31
|
-
mainIcon,
|
|
32
|
-
secondaryIcon,
|
|
33
|
-
title,
|
|
34
|
-
subtitle,
|
|
35
|
-
productName,
|
|
36
|
-
customContent,
|
|
37
|
-
onClick
|
|
38
|
-
};
|
|
39
|
-
const tile = id === 'ai-tile' ? /*#__PURE__*/React.createElement(AIPromptTile, props) : /*#__PURE__*/React.createElement(GlassTile, props);
|
|
40
|
-
return tile;
|
|
14
|
+
const BaseTile = props => {
|
|
15
|
+
if (props.id === 'ai-tile') {
|
|
16
|
+
return /*#__PURE__*/React.createElement(AIPromptTile, props);
|
|
17
|
+
}
|
|
18
|
+
return /*#__PURE__*/React.createElement(GlassTile, props);
|
|
41
19
|
};
|
|
42
20
|
|
|
43
21
|
export { 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>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { Link } from '@carbon/react';
|
|
9
|
+
import { Link, SkeletonPlaceholder } 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
12
|
|
|
@@ -22,6 +22,9 @@ const GlassTile = _ref => {
|
|
|
22
22
|
subtitle,
|
|
23
23
|
title,
|
|
24
24
|
customContent,
|
|
25
|
+
isLoading,
|
|
26
|
+
isDisabled,
|
|
27
|
+
disabledTaskLabel,
|
|
25
28
|
onClick: glassTileClickHandler
|
|
26
29
|
} = _ref;
|
|
27
30
|
const prefix = usePrefix();
|
|
@@ -35,8 +38,12 @@ const GlassTile = _ref => {
|
|
|
35
38
|
},
|
|
36
39
|
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
37
40
|
key: id,
|
|
38
|
-
href: href
|
|
39
|
-
|
|
41
|
+
href: href ?? undefined,
|
|
42
|
+
disabled: isDisabled || isLoading,
|
|
43
|
+
title: isDisabled ? disabledTaskLabel ?? '' : ''
|
|
44
|
+
}, isLoading ? /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
|
|
45
|
+
className: `${blockClass}--loading-skeleton`
|
|
46
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
40
47
|
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
41
48
|
}, /*#__PURE__*/React.createElement("div", {
|
|
42
49
|
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,57 @@
|
|
|
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 { SkeletonPlaceholder, Dropdown } from '@carbon/react';
|
|
9
|
+
import { usePrefix } from '../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
|
|
10
|
+
import React, { useMemo } from 'react';
|
|
11
|
+
|
|
12
|
+
const WorkspaceSelector = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
workspaceSelectorConfig,
|
|
15
|
+
userName,
|
|
16
|
+
isLoading
|
|
17
|
+
} = _ref;
|
|
18
|
+
const {
|
|
19
|
+
className: dropdownCustomClass,
|
|
20
|
+
onChange: dropdownCustomOnChange,
|
|
21
|
+
...dropdownOverrideProps
|
|
22
|
+
} = workspaceSelectorConfig?.propsOverrides || {};
|
|
23
|
+
const prefix = usePrefix();
|
|
24
|
+
const blockClass = `${prefix}--animated-header`;
|
|
25
|
+
const dropdownProps = useMemo(() => {
|
|
26
|
+
if (!workspaceSelectorConfig?.allWorkspaces) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
id: `${blockClass}__workspace`,
|
|
31
|
+
className: `${blockClass}__workspace${dropdownCustomClass ? ` ${dropdownCustomClass}` : ''}`,
|
|
32
|
+
size: 'sm',
|
|
33
|
+
titleText: 'Label',
|
|
34
|
+
label: `Open in: ${userName}'s workspace` || `Select a workspace`,
|
|
35
|
+
hideLabel: true,
|
|
36
|
+
type: 'inline',
|
|
37
|
+
items: workspaceSelectorConfig?.allWorkspaces,
|
|
38
|
+
selectedItem: workspaceSelectorConfig?.selectedWorkspace,
|
|
39
|
+
onChange: e => {
|
|
40
|
+
workspaceSelectorConfig?.setSelectedWorkspace?.(e);
|
|
41
|
+
dropdownCustomOnChange?.(e);
|
|
42
|
+
},
|
|
43
|
+
...dropdownOverrideProps
|
|
44
|
+
};
|
|
45
|
+
}, [blockClass, dropdownCustomClass, dropdownOverrideProps, userName, workspaceSelectorConfig, dropdownCustomOnChange]);
|
|
46
|
+
if (isLoading || workspaceSelectorConfig?.isLoading) {
|
|
47
|
+
return /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
|
|
48
|
+
className: `${blockClass}__workspace-selector-skeleton`
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (!dropdownProps) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return /*#__PURE__*/React.createElement(Dropdown, dropdownProps);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { WorkspaceSelector as default };
|
package/es/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 };
|