@carbon-labs/react-animated-header 0.33.0 → 0.35.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/assets/animated/header_animated_db2_dark_03.json +1 -0
- package/assets/animated/header_animated_db2_light_03.json +1 -0
- package/assets/index.js +7 -2
- package/assets/static/header_static_db2_dark_01.svg +53 -0
- package/assets/static/header_static_db2_light_01.svg +46 -0
- package/es/__stories__/AnimatedHeader.stories.d.ts +15328 -4716
- package/es/__stories__/data/index.d.ts +25 -0
- package/es/assets/animated/header_animated_db2_dark_03.json.js +10 -0
- package/es/assets/animated/header_animated_db2_light_03.json.js +10 -0
- package/es/assets/index.d.ts +3 -1
- package/es/assets/static/header_static_db2_dark_01.svg.js +10 -0
- package/es/assets/static/header_static_db2_light_01.svg.js +10 -0
- package/es/components/AnimatedHeader/AnimatedHeader.d.ts +4 -1
- package/es/components/AnimatedHeader/AnimatedHeader.js +72 -12
- package/es/components/ContentSwitcherSelector/ContentSwitcherSelector.d.ts +30 -0
- package/es/components/ContentSwitcherSelector/ContentSwitcherSelector.js +70 -0
- package/es/components/HeaderAction/HeaderAction.d.ts +15 -0
- package/es/components/HeaderAction/HeaderAction.js +69 -0
- package/es/components/HeaderAction/header-action.types.d.ts +32 -0
- package/es/components/HeaderTitle/HeaderTitle.js +2 -3
- package/es/components/TasksController/TasksController.d.ts +4 -1
- package/es/components/TasksController/TasksController.js +33 -23
- package/es/index.d.ts +2 -1
- package/es/index.js +5 -2
- package/lib/__stories__/AnimatedHeader.stories.d.ts +15328 -4716
- package/lib/__stories__/data/index.d.ts +25 -0
- package/lib/assets/animated/header_animated_db2_dark_03.json.js +26 -0
- package/lib/assets/animated/header_animated_db2_light_03.json.js +26 -0
- package/lib/assets/index.d.ts +3 -1
- package/lib/assets/static/header_static_db2_dark_01.svg.js +14 -0
- package/lib/assets/static/header_static_db2_light_01.svg.js +14 -0
- package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +4 -1
- package/lib/components/AnimatedHeader/AnimatedHeader.js +72 -12
- package/lib/components/ContentSwitcherSelector/ContentSwitcherSelector.d.ts +30 -0
- package/lib/components/ContentSwitcherSelector/ContentSwitcherSelector.js +74 -0
- package/lib/components/HeaderAction/HeaderAction.d.ts +15 -0
- package/lib/components/HeaderAction/HeaderAction.js +73 -0
- package/lib/components/HeaderAction/header-action.types.d.ts +32 -0
- package/lib/components/HeaderTitle/HeaderTitle.js +2 -3
- package/lib/components/TasksController/TasksController.d.ts +4 -1
- package/lib/components/TasksController/TasksController.js +33 -23
- package/lib/index.d.ts +2 -1
- package/lib/index.js +10 -4
- package/package.json +2 -2
- package/scss/AnimatedHeader/animated-header.scss +82 -0
- package/scss/HeaderAction/header-action.scss +54 -0
- package/scss/HeaderTitle/header-title.scss +18 -12
- package/scss/animated-header.scss +1 -0
- package/assets/static/header_static_db2_dark_02.svg +0 -88
- package/assets/static/header_static_db2_light_02.svg +0 -44
- package/es/assets/static/header_static_db2_dark_02.svg.js +0 -10
- package/es/assets/static/header_static_db2_light_02.svg.js +0 -10
- package/lib/assets/static/header_static_db2_dark_02.svg.js +0 -14
- package/lib/assets/static/header_static_db2_light_02.svg.js +0 -14
|
@@ -31,13 +31,12 @@ const HeaderTitle = ({
|
|
|
31
31
|
const blockClass = `${prefix}--animated-header__title`;
|
|
32
32
|
const currentLang = typeof window !== 'undefined' ? document.documentElement.lang || 'en' : 'en';
|
|
33
33
|
const isNameFirst = NAME_FIRST_LANGS.includes(currentLang.slice(0, 2));
|
|
34
|
-
const headingCollapsed = `${blockClass}-collapsed`;
|
|
35
|
-
const headingExpanded = `${blockClass}-expanded`;
|
|
36
34
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
37
35
|
align: "bottom",
|
|
38
36
|
label: `${welcomeText}, ${userName}`
|
|
39
37
|
}, /*#__PURE__*/React.createElement("h1", {
|
|
40
|
-
className:
|
|
38
|
+
className: blockClass,
|
|
39
|
+
"data-expanded": headerExpanded,
|
|
41
40
|
"aria-label": ariaLabels?.welcome ?? `${welcomeText}, ${userName}`
|
|
42
41
|
}, isNameFirst ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
43
42
|
className: `${blockClass}-first`
|
|
@@ -17,6 +17,7 @@ export interface TasksControllerConfig {
|
|
|
17
17
|
};
|
|
18
18
|
dropdown?: {
|
|
19
19
|
propsOverrides?: Partial<Omit<DropdownProps<TileGroup>, 'id' | 'items' | 'selectedItem'>>;
|
|
20
|
+
label?: string;
|
|
20
21
|
ariaLabel?: string;
|
|
21
22
|
};
|
|
22
23
|
}
|
|
@@ -25,7 +26,9 @@ export type TasksControllerProps = {
|
|
|
25
26
|
isLoading?: boolean;
|
|
26
27
|
allTileGroups?: TileGroup[];
|
|
27
28
|
selectedTileGroup?: TileGroup | null;
|
|
28
|
-
setSelectedTileGroup
|
|
29
|
+
setSelectedTileGroup?: (group: TileGroup | {
|
|
30
|
+
selectedItem: TileGroup;
|
|
31
|
+
}) => void;
|
|
29
32
|
};
|
|
30
33
|
declare const TasksController: ({ tasksControllerConfig, isLoading, allTileGroups, selectedTileGroup, setSelectedTileGroup, }: TasksControllerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
31
34
|
export default TasksController;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import { SkeletonPlaceholder, Button, Dropdown } from '@carbon/react';
|
|
10
9
|
import React, { useMemo } from 'react';
|
|
10
|
+
import { SkeletonPlaceholder, Button, Dropdown } from '@carbon/react';
|
|
11
11
|
import { usePrefix } from '../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
|
|
12
12
|
|
|
13
13
|
const TasksController = ({
|
|
@@ -17,54 +17,64 @@ const TasksController = ({
|
|
|
17
17
|
selectedTileGroup,
|
|
18
18
|
setSelectedTileGroup
|
|
19
19
|
}) => {
|
|
20
|
+
const prefix = usePrefix();
|
|
21
|
+
const blockClass = `${prefix}--animated-header`;
|
|
22
|
+
|
|
23
|
+
/** Button overrides */
|
|
20
24
|
const {
|
|
21
25
|
className: buttonCustomClass,
|
|
22
26
|
...buttonOverrideProps
|
|
23
27
|
} = tasksControllerConfig?.button?.propsOverrides || {};
|
|
28
|
+
|
|
29
|
+
/** Dropdown overrides */
|
|
24
30
|
const {
|
|
25
31
|
className: dropdownCustomClass,
|
|
26
32
|
onChange: dropdownCustomOnChange,
|
|
27
33
|
...dropdownOverrideProps
|
|
28
34
|
} = tasksControllerConfig?.dropdown?.propsOverrides || {};
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
|
|
36
|
+
/** Early outs */
|
|
37
|
+
if (!tasksControllerConfig?.type) return null;
|
|
38
|
+
if (isLoading || tasksControllerConfig?.isLoading) {
|
|
39
|
+
return /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
|
|
40
|
+
className: `${blockClass}__task-controller-skeleton`
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Button mode */
|
|
45
|
+
if (tasksControllerConfig?.type === 'button' && tasksControllerConfig?.button?.text) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
47
|
+
className: `${blockClass}__button${buttonCustomClass ? ` ${buttonCustomClass}` : ''}`
|
|
48
|
+
}, buttonOverrideProps), tasksControllerConfig.button.text);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Build Dropdown props (uses top-level list/selection/setter) */
|
|
31
52
|
const dropdownProps = useMemo(() => {
|
|
32
|
-
if (!allTileGroups?.length)
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
53
|
+
if (!allTileGroups?.length) return null;
|
|
35
54
|
return {
|
|
36
55
|
id: `${blockClass}__header-dropdown`,
|
|
37
56
|
className: `${blockClass}__header-dropdown${dropdownCustomClass ? ` ${dropdownCustomClass}` : ''}`,
|
|
38
57
|
size: 'md',
|
|
39
58
|
titleText: 'Label',
|
|
40
|
-
label: allTileGroups[0]?.label ?? '',
|
|
59
|
+
label: tasksControllerConfig?.dropdown?.label ?? allTileGroups[0]?.label ?? '',
|
|
41
60
|
hideLabel: true,
|
|
42
61
|
type: 'inline',
|
|
43
62
|
items: allTileGroups,
|
|
44
63
|
selectedItem: selectedTileGroup ?? undefined,
|
|
45
64
|
onChange: e => {
|
|
46
|
-
|
|
65
|
+
if (e.selectedItem) {
|
|
66
|
+
setSelectedTileGroup?.({
|
|
67
|
+
selectedItem: e.selectedItem
|
|
68
|
+
});
|
|
69
|
+
}
|
|
47
70
|
dropdownCustomOnChange?.(e);
|
|
48
71
|
},
|
|
49
72
|
'aria-label': tasksControllerConfig?.dropdown?.ariaLabel ?? 'Select a task group',
|
|
50
73
|
...dropdownOverrideProps
|
|
51
74
|
};
|
|
52
|
-
}, [allTileGroups, blockClass, dropdownCustomClass,
|
|
53
|
-
if (!tasksControllerConfig?.type) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
if (isLoading || tasksControllerConfig?.isLoading) {
|
|
57
|
-
return /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
|
|
58
|
-
className: `${blockClass}__task-controller-skeleton`
|
|
59
|
-
});
|
|
60
|
-
}
|
|
75
|
+
}, [allTileGroups, selectedTileGroup, setSelectedTileGroup, blockClass, dropdownCustomClass, dropdownOverrideProps, dropdownCustomOnChange, tasksControllerConfig?.dropdown?.label, tasksControllerConfig?.dropdown?.ariaLabel]);
|
|
61
76
|
|
|
62
|
-
|
|
63
|
-
if (tasksControllerConfig?.type === 'button' && tasksControllerConfig?.button?.text) {
|
|
64
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
65
|
-
className: `${blockClass}__button${buttonCustomClass ? ` ${buttonCustomClass}` : ''}`
|
|
66
|
-
}, buttonOverrideProps), tasksControllerConfig.button.text);
|
|
67
|
-
}
|
|
77
|
+
/** Dropdown mode */
|
|
68
78
|
if (tasksControllerConfig?.type === 'dropdown' && dropdownProps) {
|
|
69
79
|
return /*#__PURE__*/React.createElement("div", {
|
|
70
80
|
className: `${blockClass}__header-dropdown--container`
|
package/es/index.d.ts
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import AnimatedHeader from './components/AnimatedHeader/AnimatedHeader';
|
|
10
10
|
import { AriaLabels, TileGroup } from './components/AnimatedHeader/types';
|
|
11
|
+
import HeaderAction from './components/HeaderAction/HeaderAction';
|
|
11
12
|
import HeaderTitle from './components/HeaderTitle/HeaderTitle';
|
|
12
13
|
import { BaseTile } from './components/Tiles/index';
|
|
13
14
|
export * from './assets';
|
|
14
15
|
export type { Workspace, WorkspaceSelectorConfig, } from './components/WorkspaceSelector/WorkspaceSelector';
|
|
15
16
|
export type { TasksControllerConfig } from './components/TasksController/TasksController';
|
|
16
|
-
export { AnimatedHeader, BaseTile, HeaderTitle, type AriaLabels, type TileGroup, };
|
|
17
|
+
export { AnimatedHeader, BaseTile, HeaderAction, HeaderTitle, type AriaLabels, type TileGroup, };
|
package/es/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export { default as AnimatedHeader } from './components/AnimatedHeader/AnimatedHeader.js';
|
|
9
|
+
export { default as HeaderAction } from './components/HeaderAction/HeaderAction.js';
|
|
9
10
|
export { default as HeaderTitle } from './components/HeaderTitle/HeaderTitle.js';
|
|
10
11
|
import 'react';
|
|
11
12
|
import '@carbon/react';
|
|
@@ -13,8 +14,8 @@ import '@carbon/react/icons';
|
|
|
13
14
|
export { BaseTile } from './components/Tiles/BaseTile/BaseTile.js';
|
|
14
15
|
export { default as dataFabricStaticLight } from './assets/static/header_static_data_fabric_light_06.svg.js';
|
|
15
16
|
export { default as dataFabricStaticDark } from './assets/static/header_static_data_fabric_dark_06.svg.js';
|
|
16
|
-
export { default as db2StaticLight } from './assets/static/
|
|
17
|
-
export { default as db2StaticDark } from './assets/static/
|
|
17
|
+
export { default as db2StaticLight } from './assets/static/header_static_db2_light_01.svg.js';
|
|
18
|
+
export { default as db2StaticDark } from './assets/static/header_static_db2_dark_01.svg.js';
|
|
18
19
|
export { default as watsonXStaticLight } from './assets/static/header_static_watsonx_data_light_06.svg.js';
|
|
19
20
|
export { default as watsonXStaticDark } from './assets/static/header_static_watsonx_data_dark_05.svg.js';
|
|
20
21
|
export { default as watsonXAStaticLight } from './assets/static/header_static_watsonx_a_light_01.svg.js';
|
|
@@ -23,6 +24,8 @@ export { default as wxbiaStaticLight } from './assets/static/header_static_wxbia
|
|
|
23
24
|
export { default as wxbiaStaticDark } from './assets/static/header_static_wxbia_dark_01.svg.js';
|
|
24
25
|
export { default as dataFabricAnimatedLight } from './assets/animated/header_animated_data_fabric_light_03.json.js';
|
|
25
26
|
export { default as dataFabricAnimatedDark } from './assets/animated/header_animated_data_fabric_dark_06.json.js';
|
|
27
|
+
export { default as db2AnimatedLight } from './assets/animated/header_animated_db2_light_03.json.js';
|
|
28
|
+
export { default as db2AnimatedDark } from './assets/animated/header_animated_db2_dark_03.json.js';
|
|
26
29
|
export { default as watsonXAnimatedLight } from './assets/animated/header_animated_watsonx_data_light_04.json.js';
|
|
27
30
|
export { default as watsonXAnimatedDark } from './assets/animated/header_animated_watsonx_data_dark_03.json.js';
|
|
28
31
|
export { default as watsonXAAnimatedLight } from './assets/animated/header_animated_watsonx_a_light_06.json.js';
|