@carbon-labs/react-animated-header 0.7.0 → 0.9.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 +14 -14
- package/es/_virtual/_rollupPluginBabelHelpers.js +18 -0
- package/es/components/AnimatedHeader/AnimatedHeader.d.ts +5 -3
- package/es/components/AnimatedHeader/AnimatedHeader.js +32 -14
- package/es/components/Tiles/AIPromptTile/AIPromptTile.js +5 -1
- package/es/components/Tiles/GlassTile/GlassTile.js +3 -1
- package/lib/__stories__/AnimatedHeader.stories.d.ts +14 -14
- package/lib/_virtual/_rollupPluginBabelHelpers.js +20 -0
- package/lib/components/AnimatedHeader/AnimatedHeader.d.ts +5 -3
- package/lib/components/AnimatedHeader/AnimatedHeader.js +32 -14
- package/lib/components/Tiles/AIPromptTile/AIPromptTile.js +5 -1
- package/lib/components/Tiles/GlassTile/GlassTile.js +3 -1
- package/package.json +2 -2
- package/scss/AnimatedHeader/animated-header.scss +14 -25
- package/scss/Tiles/AIPromptTile/ai-prompt-tile.scss +32 -17
- package/scss/Tiles/GlassTile/glass-tile.scss +23 -17
|
@@ -8243,13 +8243,13 @@ export declare const ThemeG10: {
|
|
|
8243
8243
|
type: string;
|
|
8244
8244
|
labels: {
|
|
8245
8245
|
0: string;
|
|
8246
|
-
1:
|
|
8247
|
-
2:
|
|
8248
|
-
3:
|
|
8249
|
-
4:
|
|
8250
|
-
5:
|
|
8251
|
-
6:
|
|
8252
|
-
7:
|
|
8246
|
+
1: string;
|
|
8247
|
+
2: string;
|
|
8248
|
+
3: string;
|
|
8249
|
+
4: string;
|
|
8250
|
+
5: string;
|
|
8251
|
+
6: string;
|
|
8252
|
+
7: string;
|
|
8253
8253
|
};
|
|
8254
8254
|
};
|
|
8255
8255
|
options: number[];
|
|
@@ -16840,13 +16840,13 @@ export declare const ThemeG100: {
|
|
|
16840
16840
|
type: string;
|
|
16841
16841
|
labels: {
|
|
16842
16842
|
0: string;
|
|
16843
|
-
1:
|
|
16844
|
-
2:
|
|
16845
|
-
3:
|
|
16846
|
-
4:
|
|
16847
|
-
5:
|
|
16848
|
-
6:
|
|
16849
|
-
7:
|
|
16843
|
+
1: string;
|
|
16844
|
+
2: string;
|
|
16845
|
+
3: string;
|
|
16846
|
+
4: string;
|
|
16847
|
+
5: string;
|
|
16848
|
+
6: string;
|
|
16849
|
+
7: string;
|
|
16850
16850
|
};
|
|
16851
16851
|
};
|
|
16852
16852
|
options: number[];
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
function _extends() {
|
|
9
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
10
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
11
|
+
var t = arguments[e];
|
|
12
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
13
|
+
}
|
|
14
|
+
return n;
|
|
15
|
+
}, _extends.apply(null, arguments);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { _extends as extends };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { ButtonKind } from '@carbon/react';
|
|
3
3
|
/** Animated Header */
|
|
4
4
|
export interface TasksConfig {
|
|
@@ -34,8 +34,10 @@ export interface AnimatedHeaderProps {
|
|
|
34
34
|
allTiles: TileGroup[];
|
|
35
35
|
allWorkspaces?: SelectedWorkspace[];
|
|
36
36
|
description?: string;
|
|
37
|
-
handleHeaderItemsToString
|
|
38
|
-
|
|
37
|
+
handleHeaderItemsToString?: (item: TileGroup | null) => string;
|
|
38
|
+
renderHeaderSelectedItem?: (item: TileGroup | null) => ReactNode;
|
|
39
|
+
handleWorkspaceItemsToString?: (item: SelectedWorkspace | null) => string;
|
|
40
|
+
renderWorkspaceSelectedItem?: (item: SelectedWorkspace | null) => ReactNode;
|
|
39
41
|
headerAnimation?: object;
|
|
40
42
|
headerStatic?: React.JSX.Element;
|
|
41
43
|
productName?: string;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import React, { useRef, useState, useEffect } from 'react';
|
|
10
11
|
import { Grid, Column, Tooltip, Button, Dropdown } from '@carbon/react';
|
|
@@ -25,6 +26,8 @@ const AnimatedHeader = _ref => {
|
|
|
25
26
|
headerAnimation,
|
|
26
27
|
headerStatic,
|
|
27
28
|
productName = '[Product name]',
|
|
29
|
+
renderHeaderSelectedItem,
|
|
30
|
+
renderWorkspaceSelectedItem,
|
|
28
31
|
selectedTileGroup,
|
|
29
32
|
selectedWorkspace,
|
|
30
33
|
setSelectedTileGroup,
|
|
@@ -102,7 +105,7 @@ const AnimatedHeader = _ref => {
|
|
|
102
105
|
className: `${blockClass}__lottie-animation--container`
|
|
103
106
|
}, /*#__PURE__*/React.createElement("div", {
|
|
104
107
|
ref: animationContainer,
|
|
105
|
-
className: `${blockClass}__lottie-animation
|
|
108
|
+
className: `${blockClass}__lottie-animation${!open ? ` ${lottieCollapsed}` : ''}`
|
|
106
109
|
})), /*#__PURE__*/React.createElement(Column, {
|
|
107
110
|
sm: 4,
|
|
108
111
|
md: 8,
|
|
@@ -120,20 +123,17 @@ const AnimatedHeader = _ref => {
|
|
|
120
123
|
sm: 4,
|
|
121
124
|
md: 8,
|
|
122
125
|
lg: 4,
|
|
123
|
-
className: `${blockClass}__left-area-container
|
|
124
|
-
}, description && /*#__PURE__*/React.createElement(
|
|
125
|
-
align: "bottom",
|
|
126
|
-
label: description
|
|
127
|
-
}, /*#__PURE__*/React.createElement("h2", {
|
|
126
|
+
className: `${blockClass}__left-area-container${!open ? ` ${descriptionCollapsed}` : ''}`
|
|
127
|
+
}, description && /*#__PURE__*/React.createElement("h2", {
|
|
128
128
|
className: `${blockClass}__description`
|
|
129
|
-
}, description)
|
|
129
|
+
}, description), tasksConfig?.button?.text && /*#__PURE__*/React.createElement(Button, {
|
|
130
130
|
className: `${blockClass}__button`,
|
|
131
131
|
kind: tasksConfig.button.type,
|
|
132
132
|
renderIcon: tasksConfig.button.icon,
|
|
133
133
|
href: tasksConfig.button.href
|
|
134
134
|
}, tasksConfig.button.text), !tasksConfig?.button?.text && tasksConfig && tasksConfig.type === 'dropdown' && allTiles && /*#__PURE__*/React.createElement("div", {
|
|
135
135
|
className: `${blockClass}__header-dropdown--container`
|
|
136
|
-
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
136
|
+
}, /*#__PURE__*/React.createElement(Dropdown, _extends({
|
|
137
137
|
id: `${blockClass}__header-dropdown`,
|
|
138
138
|
className: `${blockClass}__header-dropdown`,
|
|
139
139
|
size: "md",
|
|
@@ -142,16 +142,19 @@ const AnimatedHeader = _ref => {
|
|
|
142
142
|
hideLabel: true,
|
|
143
143
|
type: "inline",
|
|
144
144
|
items: allTiles,
|
|
145
|
-
itemToString: item => handleHeaderItemsToString(item),
|
|
146
145
|
onChange: e => setSelectedTileGroup(e)
|
|
147
|
-
}
|
|
146
|
+
}, handleHeaderItemsToString ? {
|
|
147
|
+
itemToString: handleHeaderItemsToString
|
|
148
|
+
} : {}, renderHeaderSelectedItem ? {
|
|
149
|
+
renderSelectedItem: renderHeaderSelectedItem
|
|
150
|
+
} : {})))), selectedTileGroup && /*#__PURE__*/React.createElement(Column, {
|
|
148
151
|
sm: 4,
|
|
149
152
|
md: 8,
|
|
150
153
|
lg: 12,
|
|
151
154
|
className: `${blockClass}__content`
|
|
152
155
|
}, allWorkspaces && /*#__PURE__*/React.createElement("div", {
|
|
153
|
-
className: `${blockClass}__workspace--container
|
|
154
|
-
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
156
|
+
className: `${blockClass}__workspace--container${!open ? ` ${contentCollapsed}` : ''}`
|
|
157
|
+
}, /*#__PURE__*/React.createElement(Dropdown, _extends({
|
|
155
158
|
id: `${blockClass}__workspace`,
|
|
156
159
|
className: `${blockClass}__workspace`,
|
|
157
160
|
size: "sm",
|
|
@@ -160,9 +163,12 @@ const AnimatedHeader = _ref => {
|
|
|
160
163
|
hideLabel: true,
|
|
161
164
|
type: "inline",
|
|
162
165
|
items: allWorkspaces,
|
|
163
|
-
itemToString: item => handleWorkspaceItemsToString(item),
|
|
164
166
|
onChange: e => setSelectedWorkspace(e)
|
|
165
|
-
}
|
|
167
|
+
}, handleWorkspaceItemsToString ? {
|
|
168
|
+
itemToString: handleWorkspaceItemsToString
|
|
169
|
+
} : {}, renderWorkspaceSelectedItem ? {
|
|
170
|
+
renderSelectedItem: renderWorkspaceSelectedItem
|
|
171
|
+
} : {}))), /*#__PURE__*/React.createElement("div", {
|
|
166
172
|
className: `${blockClass}__tiles-container`
|
|
167
173
|
}, selectedTileGroup.tiles.map(tile => {
|
|
168
174
|
return /*#__PURE__*/React.createElement(BaseTile, {
|
|
@@ -233,6 +239,18 @@ AnimatedHeader.propTypes = {
|
|
|
233
239
|
* Provide current product name
|
|
234
240
|
*/
|
|
235
241
|
productName: PropTypes.string,
|
|
242
|
+
/**
|
|
243
|
+
* Helper function passed to downshift that allows the library to render a
|
|
244
|
+
* selected item to as an arbitrary ReactNode. By default it uses standard Carbon renderer that renders only item.label text
|
|
245
|
+
* (Dropdown under description in header)
|
|
246
|
+
*/
|
|
247
|
+
renderHeaderSelectedItem: PropTypes.func,
|
|
248
|
+
/**
|
|
249
|
+
* Helper function passed to downshift that allows the library to render a
|
|
250
|
+
* selected item to as an arbitrary ReactNode. By default it uses standard Carbon renderer that renders only item.label text
|
|
251
|
+
* (Dropdown related to workspace selection)
|
|
252
|
+
*/
|
|
253
|
+
renderWorkspaceSelectedItem: PropTypes.func,
|
|
236
254
|
/**
|
|
237
255
|
* The tile group that is active in the header
|
|
238
256
|
* ex. "AI Chat Tile w/ two glass tiles", "Four glass tiles", ect.
|
|
@@ -50,8 +50,12 @@ const AIPromptTile = _ref => {
|
|
|
50
50
|
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
51
51
|
key: id
|
|
52
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
className: `${blockClass}--body
|
|
53
|
+
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
54
54
|
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: `${blockClass}--body-background`
|
|
56
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: `${blockClass}--body-gradient`
|
|
58
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
55
59
|
className: `${blockClass}--icons`
|
|
56
60
|
}, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
|
|
57
61
|
fill: `var(--cds-icon-secondary)`,
|
|
@@ -32,8 +32,10 @@ const GlassTile = _ref => {
|
|
|
32
32
|
key: id,
|
|
33
33
|
href: href
|
|
34
34
|
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
-
className: `${blockClass}--body
|
|
35
|
+
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
36
36
|
}, /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: `${blockClass}--body-background`
|
|
38
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
37
39
|
className: `${blockClass}--icons`
|
|
38
40
|
}, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
|
|
39
41
|
fill: `var(--cds-icon-secondary)`,
|
|
@@ -8243,13 +8243,13 @@ export declare const ThemeG10: {
|
|
|
8243
8243
|
type: string;
|
|
8244
8244
|
labels: {
|
|
8245
8245
|
0: string;
|
|
8246
|
-
1:
|
|
8247
|
-
2:
|
|
8248
|
-
3:
|
|
8249
|
-
4:
|
|
8250
|
-
5:
|
|
8251
|
-
6:
|
|
8252
|
-
7:
|
|
8246
|
+
1: string;
|
|
8247
|
+
2: string;
|
|
8248
|
+
3: string;
|
|
8249
|
+
4: string;
|
|
8250
|
+
5: string;
|
|
8251
|
+
6: string;
|
|
8252
|
+
7: string;
|
|
8253
8253
|
};
|
|
8254
8254
|
};
|
|
8255
8255
|
options: number[];
|
|
@@ -16840,13 +16840,13 @@ export declare const ThemeG100: {
|
|
|
16840
16840
|
type: string;
|
|
16841
16841
|
labels: {
|
|
16842
16842
|
0: string;
|
|
16843
|
-
1:
|
|
16844
|
-
2:
|
|
16845
|
-
3:
|
|
16846
|
-
4:
|
|
16847
|
-
5:
|
|
16848
|
-
6:
|
|
16849
|
-
7:
|
|
16843
|
+
1: string;
|
|
16844
|
+
2: string;
|
|
16845
|
+
3: string;
|
|
16846
|
+
4: string;
|
|
16847
|
+
5: string;
|
|
16848
|
+
6: string;
|
|
16849
|
+
7: string;
|
|
16850
16850
|
};
|
|
16851
16851
|
};
|
|
16852
16852
|
options: number[];
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
function _extends() {
|
|
11
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
12
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
13
|
+
var t = arguments[e];
|
|
14
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
15
|
+
}
|
|
16
|
+
return n;
|
|
17
|
+
}, _extends.apply(null, arguments);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.extends = _extends;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { ButtonKind } from '@carbon/react';
|
|
3
3
|
/** Animated Header */
|
|
4
4
|
export interface TasksConfig {
|
|
@@ -34,8 +34,10 @@ export interface AnimatedHeaderProps {
|
|
|
34
34
|
allTiles: TileGroup[];
|
|
35
35
|
allWorkspaces?: SelectedWorkspace[];
|
|
36
36
|
description?: string;
|
|
37
|
-
handleHeaderItemsToString
|
|
38
|
-
|
|
37
|
+
handleHeaderItemsToString?: (item: TileGroup | null) => string;
|
|
38
|
+
renderHeaderSelectedItem?: (item: TileGroup | null) => ReactNode;
|
|
39
|
+
handleWorkspaceItemsToString?: (item: SelectedWorkspace | null) => string;
|
|
40
|
+
renderWorkspaceSelectedItem?: (item: SelectedWorkspace | null) => ReactNode;
|
|
39
41
|
headerAnimation?: object;
|
|
40
42
|
headerStatic?: React.JSX.Element;
|
|
41
43
|
productName?: string;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
12
13
|
var PropTypes = require('prop-types');
|
|
13
14
|
var React = require('react');
|
|
14
15
|
var react = require('@carbon/react');
|
|
@@ -29,6 +30,8 @@ const AnimatedHeader = _ref => {
|
|
|
29
30
|
headerAnimation,
|
|
30
31
|
headerStatic,
|
|
31
32
|
productName = '[Product name]',
|
|
33
|
+
renderHeaderSelectedItem,
|
|
34
|
+
renderWorkspaceSelectedItem,
|
|
32
35
|
selectedTileGroup,
|
|
33
36
|
selectedWorkspace,
|
|
34
37
|
setSelectedTileGroup,
|
|
@@ -106,7 +109,7 @@ const AnimatedHeader = _ref => {
|
|
|
106
109
|
className: `${blockClass}__lottie-animation--container`
|
|
107
110
|
}, /*#__PURE__*/React.createElement("div", {
|
|
108
111
|
ref: animationContainer,
|
|
109
|
-
className: `${blockClass}__lottie-animation
|
|
112
|
+
className: `${blockClass}__lottie-animation${!open ? ` ${lottieCollapsed}` : ''}`
|
|
110
113
|
})), /*#__PURE__*/React.createElement(react.Column, {
|
|
111
114
|
sm: 4,
|
|
112
115
|
md: 8,
|
|
@@ -124,20 +127,17 @@ const AnimatedHeader = _ref => {
|
|
|
124
127
|
sm: 4,
|
|
125
128
|
md: 8,
|
|
126
129
|
lg: 4,
|
|
127
|
-
className: `${blockClass}__left-area-container
|
|
128
|
-
}, description && /*#__PURE__*/React.createElement(
|
|
129
|
-
align: "bottom",
|
|
130
|
-
label: description
|
|
131
|
-
}, /*#__PURE__*/React.createElement("h2", {
|
|
130
|
+
className: `${blockClass}__left-area-container${!open ? ` ${descriptionCollapsed}` : ''}`
|
|
131
|
+
}, description && /*#__PURE__*/React.createElement("h2", {
|
|
132
132
|
className: `${blockClass}__description`
|
|
133
|
-
}, description)
|
|
133
|
+
}, description), tasksConfig?.button?.text && /*#__PURE__*/React.createElement(react.Button, {
|
|
134
134
|
className: `${blockClass}__button`,
|
|
135
135
|
kind: tasksConfig.button.type,
|
|
136
136
|
renderIcon: tasksConfig.button.icon,
|
|
137
137
|
href: tasksConfig.button.href
|
|
138
138
|
}, tasksConfig.button.text), !tasksConfig?.button?.text && tasksConfig && tasksConfig.type === 'dropdown' && allTiles && /*#__PURE__*/React.createElement("div", {
|
|
139
139
|
className: `${blockClass}__header-dropdown--container`
|
|
140
|
-
}, /*#__PURE__*/React.createElement(react.Dropdown, {
|
|
140
|
+
}, /*#__PURE__*/React.createElement(react.Dropdown, _rollupPluginBabelHelpers.extends({
|
|
141
141
|
id: `${blockClass}__header-dropdown`,
|
|
142
142
|
className: `${blockClass}__header-dropdown`,
|
|
143
143
|
size: "md",
|
|
@@ -146,16 +146,19 @@ const AnimatedHeader = _ref => {
|
|
|
146
146
|
hideLabel: true,
|
|
147
147
|
type: "inline",
|
|
148
148
|
items: allTiles,
|
|
149
|
-
itemToString: item => handleHeaderItemsToString(item),
|
|
150
149
|
onChange: e => setSelectedTileGroup(e)
|
|
151
|
-
}
|
|
150
|
+
}, handleHeaderItemsToString ? {
|
|
151
|
+
itemToString: handleHeaderItemsToString
|
|
152
|
+
} : {}, renderHeaderSelectedItem ? {
|
|
153
|
+
renderSelectedItem: renderHeaderSelectedItem
|
|
154
|
+
} : {})))), selectedTileGroup && /*#__PURE__*/React.createElement(react.Column, {
|
|
152
155
|
sm: 4,
|
|
153
156
|
md: 8,
|
|
154
157
|
lg: 12,
|
|
155
158
|
className: `${blockClass}__content`
|
|
156
159
|
}, allWorkspaces && /*#__PURE__*/React.createElement("div", {
|
|
157
|
-
className: `${blockClass}__workspace--container
|
|
158
|
-
}, /*#__PURE__*/React.createElement(react.Dropdown, {
|
|
160
|
+
className: `${blockClass}__workspace--container${!open ? ` ${contentCollapsed}` : ''}`
|
|
161
|
+
}, /*#__PURE__*/React.createElement(react.Dropdown, _rollupPluginBabelHelpers.extends({
|
|
159
162
|
id: `${blockClass}__workspace`,
|
|
160
163
|
className: `${blockClass}__workspace`,
|
|
161
164
|
size: "sm",
|
|
@@ -164,9 +167,12 @@ const AnimatedHeader = _ref => {
|
|
|
164
167
|
hideLabel: true,
|
|
165
168
|
type: "inline",
|
|
166
169
|
items: allWorkspaces,
|
|
167
|
-
itemToString: item => handleWorkspaceItemsToString(item),
|
|
168
170
|
onChange: e => setSelectedWorkspace(e)
|
|
169
|
-
}
|
|
171
|
+
}, handleWorkspaceItemsToString ? {
|
|
172
|
+
itemToString: handleWorkspaceItemsToString
|
|
173
|
+
} : {}, renderWorkspaceSelectedItem ? {
|
|
174
|
+
renderSelectedItem: renderWorkspaceSelectedItem
|
|
175
|
+
} : {}))), /*#__PURE__*/React.createElement("div", {
|
|
170
176
|
className: `${blockClass}__tiles-container`
|
|
171
177
|
}, selectedTileGroup.tiles.map(tile => {
|
|
172
178
|
return /*#__PURE__*/React.createElement(BaseTile.BaseTile, {
|
|
@@ -237,6 +243,18 @@ AnimatedHeader.propTypes = {
|
|
|
237
243
|
* Provide current product name
|
|
238
244
|
*/
|
|
239
245
|
productName: PropTypes.string,
|
|
246
|
+
/**
|
|
247
|
+
* Helper function passed to downshift that allows the library to render a
|
|
248
|
+
* selected item to as an arbitrary ReactNode. By default it uses standard Carbon renderer that renders only item.label text
|
|
249
|
+
* (Dropdown under description in header)
|
|
250
|
+
*/
|
|
251
|
+
renderHeaderSelectedItem: PropTypes.func,
|
|
252
|
+
/**
|
|
253
|
+
* Helper function passed to downshift that allows the library to render a
|
|
254
|
+
* selected item to as an arbitrary ReactNode. By default it uses standard Carbon renderer that renders only item.label text
|
|
255
|
+
* (Dropdown related to workspace selection)
|
|
256
|
+
*/
|
|
257
|
+
renderWorkspaceSelectedItem: PropTypes.func,
|
|
240
258
|
/**
|
|
241
259
|
* The tile group that is active in the header
|
|
242
260
|
* ex. "AI Chat Tile w/ two glass tiles", "Four glass tiles", ect.
|
|
@@ -52,8 +52,12 @@ const AIPromptTile = _ref => {
|
|
|
52
52
|
className: `${prefix}--animated-header__tile ${blockClass}`,
|
|
53
53
|
key: id
|
|
54
54
|
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: `${blockClass}--body
|
|
55
|
+
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
56
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: `${blockClass}--body-background`
|
|
58
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: `${blockClass}--body-gradient`
|
|
60
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
57
61
|
className: `${blockClass}--icons`
|
|
58
62
|
}, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
|
|
59
63
|
fill: `var(--cds-icon-secondary)`,
|
|
@@ -34,8 +34,10 @@ const GlassTile = _ref => {
|
|
|
34
34
|
key: id,
|
|
35
35
|
href: href
|
|
36
36
|
}, /*#__PURE__*/React.createElement("div", {
|
|
37
|
-
className: `${blockClass}--body
|
|
37
|
+
className: `${blockClass}--body${!open ? ` ${collapsed}` : ''}`
|
|
38
38
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: `${blockClass}--body-background`
|
|
40
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
39
41
|
className: `${blockClass}--icons`
|
|
40
42
|
}, MainIcon && /*#__PURE__*/React.createElement(MainIcon, {
|
|
41
43
|
fill: `var(--cds-icon-secondary)`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon-labs/react-animated-header",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@carbon-labs/utilities": "canary"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "c610e01c130ef513bb64286934496f86d2c8091d"
|
|
40
40
|
}
|
|
@@ -65,14 +65,7 @@ body {
|
|
|
65
65
|
overflow: hidden;
|
|
66
66
|
justify-content: flex-end;
|
|
67
67
|
|
|
68
|
-
block-size: 100%;
|
|
69
|
-
|
|
70
|
-
/* stylelint-disable-next-line declaration-block-no-duplicate-properties */
|
|
71
68
|
block-size: fill-available;
|
|
72
|
-
|
|
73
|
-
inline-size: 100%;
|
|
74
|
-
|
|
75
|
-
/* stylelint-disable-next-line declaration-block-no-duplicate-properties */
|
|
76
69
|
inline-size: fill-available;
|
|
77
70
|
|
|
78
71
|
max-inline-size: 96rem;
|
|
@@ -102,14 +95,7 @@ body {
|
|
|
102
95
|
position: absolute;
|
|
103
96
|
z-index: 1;
|
|
104
97
|
|
|
105
|
-
block-size: 100%;
|
|
106
|
-
|
|
107
|
-
/* stylelint-disable-next-line declaration-block-no-duplicate-properties */
|
|
108
98
|
block-size: fill-available;
|
|
109
|
-
|
|
110
|
-
inline-size: 100%;
|
|
111
|
-
|
|
112
|
-
/* stylelint-disable-next-line declaration-block-no-duplicate-properties */
|
|
113
99
|
inline-size: fill-available;
|
|
114
100
|
|
|
115
101
|
margin-inline: auto;
|
|
@@ -232,7 +218,7 @@ body {
|
|
|
232
218
|
|
|
233
219
|
.#{$prefix}__header-dropdown--container {
|
|
234
220
|
inline-size: auto;
|
|
235
|
-
max-inline-size:
|
|
221
|
+
max-inline-size: 18rem;
|
|
236
222
|
}
|
|
237
223
|
|
|
238
224
|
.#{$prefix}__header-dropdown {
|
|
@@ -304,19 +290,22 @@ body {
|
|
|
304
290
|
overflow: hidden;
|
|
305
291
|
justify-content: flex-end;
|
|
306
292
|
|
|
307
|
-
block-size: 100%;
|
|
308
|
-
|
|
309
|
-
/* stylelint-disable-next-line declaration-block-no-duplicate-properties */
|
|
310
293
|
block-size: fill-available;
|
|
311
|
-
|
|
312
|
-
inline-size: 100%;
|
|
313
|
-
|
|
314
|
-
/* stylelint-disable-next-line declaration-block-no-duplicate-properties */
|
|
315
294
|
inline-size: fill-available;
|
|
316
295
|
|
|
317
296
|
max-inline-size: 96rem;
|
|
318
297
|
}
|
|
319
298
|
|
|
299
|
+
/* support for Safari */
|
|
300
|
+
@supports (font: -apple-system-body) and (-webkit-appearance: none) {
|
|
301
|
+
.#{$prefix}__gradient--overlay,
|
|
302
|
+
.#{$prefix}__static--container,
|
|
303
|
+
.#{$prefix}__lottie-animation--container {
|
|
304
|
+
block-size: 100%;
|
|
305
|
+
inline-size: 100%;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
320
309
|
.#{$prefix}__lottie-animation {
|
|
321
310
|
position: absolute;
|
|
322
311
|
z-index: 0;
|
|
@@ -608,9 +597,9 @@ body {
|
|
|
608
597
|
}
|
|
609
598
|
|
|
610
599
|
/*
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
*/
|
|
600
|
+
If the user has expressed their preference for
|
|
601
|
+
reduced motion, then don't use animations
|
|
602
|
+
*/
|
|
614
603
|
@media (prefers-reduced-motion: reduce) {
|
|
615
604
|
.#{$prefix},
|
|
616
605
|
.#{$prefix}__static,
|
|
@@ -31,7 +31,9 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
31
31
|
|
|
32
32
|
.#{$prefix}--body {
|
|
33
33
|
position: relative;
|
|
34
|
+
z-index: 0;
|
|
34
35
|
display: flex;
|
|
36
|
+
overflow: hidden;
|
|
35
37
|
flex: 1;
|
|
36
38
|
flex-direction: column;
|
|
37
39
|
justify-content: flex-start;
|
|
@@ -42,14 +44,25 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
42
44
|
transition: opacity 500ms linear;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
/* Semi-transparent background layer */
|
|
48
|
+
.#{$prefix}--body-background {
|
|
49
|
+
position: absolute;
|
|
50
|
+
z-index: 1;
|
|
51
|
+
background-color: $layer-01;
|
|
52
|
+
inset: 0;
|
|
53
|
+
opacity: 0.7;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
transition: opacity 150ms motion.motion(standard, productive);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:root .#{$prefix}--body-background,
|
|
59
|
+
[data-carbon-theme='white'] .#{$prefix}--body-background,
|
|
60
|
+
[data-carbon-theme='g10'] .#{$prefix}--body-background {
|
|
48
61
|
background-color: $layer-01;
|
|
49
62
|
}
|
|
50
63
|
|
|
51
|
-
[data-carbon-theme='g90'] .#{$prefix}--body
|
|
52
|
-
[data-carbon-theme='g100'] .#{$prefix}--body
|
|
64
|
+
[data-carbon-theme='g90'] .#{$prefix}--body-background,
|
|
65
|
+
[data-carbon-theme='g100'] .#{$prefix}--body-background {
|
|
53
66
|
background-color: $layer-hover-01;
|
|
54
67
|
}
|
|
55
68
|
|
|
@@ -57,27 +70,32 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
57
70
|
opacity: 0;
|
|
58
71
|
}
|
|
59
72
|
|
|
60
|
-
|
|
73
|
+
/* Animated gradient layer */
|
|
74
|
+
.#{$prefix}--body-gradient {
|
|
61
75
|
position: absolute;
|
|
76
|
+
z-index: 2;
|
|
62
77
|
animation: 1000ms motion.motion(standard, expressive) animate-gradient;
|
|
63
78
|
animation-delay: 466.666ms;
|
|
64
79
|
animation-fill-mode: both;
|
|
65
80
|
background: linear-gradient(0deg, #4589ff4d 0%, transparent 100%);
|
|
66
81
|
background-repeat: no-repeat;
|
|
67
82
|
background-size: 100% 64px;
|
|
68
|
-
content: '';
|
|
69
83
|
inset: 0;
|
|
70
84
|
opacity: 0.7;
|
|
71
85
|
pointer-events: none;
|
|
72
86
|
transition: opacity 150ms motion.motion(standard, productive);
|
|
73
87
|
}
|
|
74
88
|
|
|
75
|
-
.#{$prefix}--body:hover
|
|
76
|
-
|
|
89
|
+
.#{$prefix}--body:hover {
|
|
90
|
+
.#{$prefix}--body-gradient,
|
|
91
|
+
.#{$prefix}--body-background {
|
|
92
|
+
opacity: 0.85;
|
|
93
|
+
}
|
|
77
94
|
}
|
|
78
95
|
|
|
79
|
-
.#{$prefix}--body
|
|
96
|
+
.#{$prefix}--body::after {
|
|
80
97
|
position: absolute;
|
|
98
|
+
z-index: 3;
|
|
81
99
|
border: 1px solid transparent;
|
|
82
100
|
animation: 1000ms motion.motion(standard, expressive) animate-border;
|
|
83
101
|
animation-delay: 466.666ms;
|
|
@@ -86,9 +104,6 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
86
104
|
background-size: 100% 150%;
|
|
87
105
|
content: '';
|
|
88
106
|
inset: 0;
|
|
89
|
-
inset-block-end: 0;
|
|
90
|
-
inset-inline: 0;
|
|
91
|
-
inset-inline-start: 0;
|
|
92
107
|
-webkit-mask: linear-gradient(#ffffff 0 0) padding-box,
|
|
93
108
|
linear-gradient(#ffffff 0 0);
|
|
94
109
|
mask: linear-gradient(#ffffff 0 0) padding-box, linear-gradient(#ffffff 0 0);
|
|
@@ -98,7 +113,7 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
98
113
|
|
|
99
114
|
.#{$prefix}--icons {
|
|
100
115
|
position: relative;
|
|
101
|
-
z-index:
|
|
116
|
+
z-index: 4;
|
|
102
117
|
display: flex;
|
|
103
118
|
justify-content: space-between;
|
|
104
119
|
margin-block-end: $spacing-05;
|
|
@@ -108,7 +123,7 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
108
123
|
@include type-style('body-compact-02');
|
|
109
124
|
|
|
110
125
|
position: relative;
|
|
111
|
-
z-index:
|
|
126
|
+
z-index: 4;
|
|
112
127
|
|
|
113
128
|
overflow: hidden;
|
|
114
129
|
text-overflow: ellipsis;
|
|
@@ -125,7 +140,7 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
125
140
|
}
|
|
126
141
|
|
|
127
142
|
.#{$prefix}--footer {
|
|
128
|
-
z-index:
|
|
143
|
+
z-index: 4;
|
|
129
144
|
display: flex;
|
|
130
145
|
justify-content: flex-end;
|
|
131
146
|
margin-block: $spacing-03 calc(-1 * $spacing-05);
|
|
@@ -144,7 +159,7 @@ $prefix: 'clabs--animated-header__ai-prompt-tile' !default;
|
|
|
144
159
|
}
|
|
145
160
|
|
|
146
161
|
.#{$prefix}--text-input-container {
|
|
147
|
-
z-index:
|
|
162
|
+
z-index: 4;
|
|
148
163
|
display: flex;
|
|
149
164
|
align-items: center;
|
|
150
165
|
border: 1px solid $border-subtle-01;
|
|
@@ -31,7 +31,9 @@ $prefix: 'clabs--animated-header__glass-tile' !default;
|
|
|
31
31
|
|
|
32
32
|
.#{$prefix}--body {
|
|
33
33
|
position: relative;
|
|
34
|
+
z-index: 0;
|
|
34
35
|
display: flex;
|
|
36
|
+
overflow: hidden;
|
|
35
37
|
flex: 1;
|
|
36
38
|
flex-direction: column;
|
|
37
39
|
justify-content: flex-start;
|
|
@@ -43,39 +45,41 @@ $prefix: 'clabs--animated-header__glass-tile' !default;
|
|
|
43
45
|
transition: opacity 500ms linear;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
/* Semi-transparent background layer */
|
|
49
|
+
.#{$prefix}--body-background {
|
|
50
|
+
position: absolute;
|
|
51
|
+
z-index: 1;
|
|
52
|
+
background-color: $layer-01;
|
|
53
|
+
inset: 0;
|
|
54
|
+
opacity: 0.7;
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
transition: opacity 150ms motion.motion(standard, productive);
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
:root .#{$prefix}--body
|
|
51
|
-
[data-carbon-theme='white'] .#{$prefix}--body
|
|
52
|
-
[data-carbon-theme='g10'] .#{$prefix}--body
|
|
59
|
+
:root .#{$prefix}--body-background,
|
|
60
|
+
[data-carbon-theme='white'] .#{$prefix}--body-background,
|
|
61
|
+
[data-carbon-theme='g10'] .#{$prefix}--body-background {
|
|
53
62
|
background-color: $layer-01;
|
|
54
63
|
}
|
|
55
64
|
|
|
56
|
-
[data-carbon-theme='g90'] .#{$prefix}--body
|
|
57
|
-
[data-carbon-theme='g100'] .#{$prefix}--body
|
|
65
|
+
[data-carbon-theme='g90'] .#{$prefix}--body-background,
|
|
66
|
+
[data-carbon-theme='g100'] .#{$prefix}--body-background {
|
|
58
67
|
background-color: $layer-hover-01;
|
|
59
68
|
}
|
|
60
69
|
|
|
61
|
-
.#{$prefix}--
|
|
62
|
-
|
|
63
|
-
content: '';
|
|
64
|
-
inset: 0;
|
|
65
|
-
opacity: 0.7;
|
|
66
|
-
pointer-events: none;
|
|
67
|
-
transition: opacity 150ms motion.motion(standard, productive);
|
|
70
|
+
.#{$prefix}--collapsed {
|
|
71
|
+
opacity: 0;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
.#{$prefix}--body:hover
|
|
74
|
+
.#{$prefix}--body:hover .#{$prefix}--body-background {
|
|
71
75
|
opacity: 0.85;
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
.#{$prefix}--icons {
|
|
75
79
|
position: relative;
|
|
80
|
+
z-index: 2;
|
|
76
81
|
display: flex;
|
|
77
82
|
justify-content: space-between;
|
|
78
|
-
|
|
79
83
|
margin-block-end: $spacing-05;
|
|
80
84
|
}
|
|
81
85
|
|
|
@@ -83,6 +87,7 @@ $prefix: 'clabs--animated-header__glass-tile' !default;
|
|
|
83
87
|
@include type-style('body-compact-02');
|
|
84
88
|
|
|
85
89
|
position: relative;
|
|
90
|
+
z-index: 2;
|
|
86
91
|
overflow: hidden;
|
|
87
92
|
text-overflow: ellipsis;
|
|
88
93
|
white-space: nowrap;
|
|
@@ -99,7 +104,7 @@ $prefix: 'clabs--animated-header__glass-tile' !default;
|
|
|
99
104
|
|
|
100
105
|
.#{$prefix}--footer {
|
|
101
106
|
position: absolute;
|
|
102
|
-
z-index:
|
|
107
|
+
z-index: 2;
|
|
103
108
|
display: flex;
|
|
104
109
|
gap: $spacing-05;
|
|
105
110
|
inset-block-end: $spacing-05;
|
|
@@ -109,6 +114,7 @@ $prefix: 'clabs--animated-header__glass-tile' !default;
|
|
|
109
114
|
@include type-style('body-short-01');
|
|
110
115
|
|
|
111
116
|
position: relative;
|
|
117
|
+
z-index: 2;
|
|
112
118
|
overflow: hidden;
|
|
113
119
|
color: $text-secondary;
|
|
114
120
|
text-overflow: ellipsis;
|