@carbon-labs/react-animated-header 0.35.0 → 0.37.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.
Files changed (27) hide show
  1. package/es/__stories__/AnimatedHeader.stories.d.ts +6 -44
  2. package/es/__stories__/data/index.d.ts +4 -22
  3. package/es/components/AnimatedHeader/AnimatedHeader.js +4 -2
  4. package/es/components/AnimatedHeader/types.d.ts +1 -3
  5. package/es/components/ContentSwitcherSelector/ContentSwitcherSelector.js +9 -10
  6. package/es/components/TasksController/TasksController.d.ts +2 -4
  7. package/es/components/TasksController/TasksController.js +20 -16
  8. package/es/components/Tiles/AIPromptTile/AIPromptTile.d.ts +3 -2
  9. package/es/components/Tiles/AITile/AITile.d.ts +3 -2
  10. package/es/components/Tiles/BaseTile/BaseTile.d.ts +1 -10
  11. package/es/components/Tiles/BaseTile/BaseTile.js +1 -1
  12. package/es/components/Tiles/GlassTile/GlassTile.d.ts +3 -2
  13. package/es/index.d.ts +2 -0
  14. package/lib/__stories__/AnimatedHeader.stories.d.ts +6 -44
  15. package/lib/__stories__/data/index.d.ts +4 -22
  16. package/lib/components/AnimatedHeader/AnimatedHeader.js +4 -2
  17. package/lib/components/AnimatedHeader/types.d.ts +1 -3
  18. package/lib/components/ContentSwitcherSelector/ContentSwitcherSelector.js +8 -9
  19. package/lib/components/TasksController/TasksController.d.ts +2 -4
  20. package/lib/components/TasksController/TasksController.js +20 -16
  21. package/lib/components/Tiles/AIPromptTile/AIPromptTile.d.ts +3 -2
  22. package/lib/components/Tiles/AITile/AITile.d.ts +3 -2
  23. package/lib/components/Tiles/BaseTile/BaseTile.d.ts +1 -10
  24. package/lib/components/Tiles/BaseTile/BaseTile.js +1 -1
  25. package/lib/components/Tiles/GlassTile/GlassTile.d.ts +3 -2
  26. package/lib/index.d.ts +2 -0
  27. package/package.json +2 -2
@@ -15162,28 +15162,9 @@ export declare const ThemeG10: {
15162
15162
  options: number[];
15163
15163
  mapping: {
15164
15164
  0: null;
15165
- 1: {
15166
- ariaLabel: string;
15167
- visibleCount: number;
15168
- items: {
15169
- id: string;
15170
- text: string;
15171
- }[];
15172
- };
15173
- 2: {
15174
- ariaLabel: string;
15175
- visibleCount: number;
15176
- items: {
15177
- id: string;
15178
- text: string;
15179
- }[];
15180
- };
15181
- 3: {
15182
- ariaLabel: string;
15183
- isLoading: boolean;
15184
- visibleCount: number;
15185
- items: never[];
15186
- };
15165
+ 1: import("..").ContentSwitcherConfig;
15166
+ 2: import("..").ContentSwitcherConfig;
15167
+ 3: import("..").ContentSwitcherConfig;
15187
15168
  };
15188
15169
  };
15189
15170
  contentSwitcherLowContrast: {
@@ -30374,28 +30355,9 @@ export declare const ThemeG100: {
30374
30355
  options: number[];
30375
30356
  mapping: {
30376
30357
  0: null;
30377
- 1: {
30378
- ariaLabel: string;
30379
- visibleCount: number;
30380
- items: {
30381
- id: string;
30382
- text: string;
30383
- }[];
30384
- };
30385
- 2: {
30386
- ariaLabel: string;
30387
- visibleCount: number;
30388
- items: {
30389
- id: string;
30390
- text: string;
30391
- }[];
30392
- };
30393
- 3: {
30394
- ariaLabel: string;
30395
- isLoading: boolean;
30396
- visibleCount: number;
30397
- items: never[];
30398
- };
30358
+ 1: import("..").ContentSwitcherConfig;
30359
+ 2: import("..").ContentSwitcherConfig;
30360
+ 3: import("..").ContentSwitcherConfig;
30399
30361
  };
30400
30362
  };
30401
30363
  contentSwitcherLowContrast: {
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { TileGroup } from '../../components/AnimatedHeader/types';
10
10
  import type { HeaderActionConfig } from '../../components/HeaderAction/header-action.types';
11
+ import type { ContentSwitcherConfig } from '../../components/ContentSwitcherSelector/ContentSwitcherSelector';
11
12
  export declare const workspaceData: {
12
13
  id: string;
13
14
  label: string;
@@ -36,28 +37,9 @@ export declare const tasksControllerConfigLoading: {
36
37
  type: string;
37
38
  isLoading: boolean;
38
39
  };
39
- export declare const contentSwitcherConfigTwo: {
40
- ariaLabel: string;
41
- visibleCount: number;
42
- items: {
43
- id: string;
44
- text: string;
45
- }[];
46
- };
47
- export declare const contentSwitcherConfigThree: {
48
- ariaLabel: string;
49
- visibleCount: number;
50
- items: {
51
- id: string;
52
- text: string;
53
- }[];
54
- };
55
- export declare const contentSwitcherConfigLoading: {
56
- ariaLabel: string;
57
- isLoading: boolean;
58
- visibleCount: number;
59
- items: never[];
60
- };
40
+ export declare const contentSwitcherConfigTwo: ContentSwitcherConfig;
41
+ export declare const contentSwitcherConfigThree: ContentSwitcherConfig;
42
+ export declare const contentSwitcherConfigLoading: ContentSwitcherConfig;
61
43
  export declare const workspaceSelectorConfig: {
62
44
  allWorkspaces: {
63
45
  id: string;
@@ -58,7 +58,9 @@ const AnimatedHeader = ({
58
58
  animRef.current.destroy();
59
59
  animRef.current = null;
60
60
  }
61
- if (!animationContainer.current || !headerAnimation) return;
61
+ if (!animationContainer.current || !headerAnimation) {
62
+ return;
63
+ }
62
64
  const animation = lottie.loadAnimation({
63
65
  container: animationContainer.current,
64
66
  animationData: headerAnimation,
@@ -183,7 +185,7 @@ const AnimatedHeader = ({
183
185
  const legacyId = tile.id; // old configs
184
186
  const resolvedTileId = tileId ?? legacyId;
185
187
  const key = resolvedTileId ?? `tile-${index}`;
186
- const hasAction = tile.href || tile.onClick === 'function';
188
+ const hasAction = tile.href || typeof tile.onClick === 'function';
187
189
  return /*#__PURE__*/React.createElement(BaseTile, _extends({
188
190
  key: key,
189
191
  tileId: resolvedTileId
@@ -7,9 +7,7 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
9
  import type { BaseTileProps } from '../../components/Tiles/BaseTile/BaseTile';
10
- export type Tile = Omit<BaseTileProps, 'id'> & {
11
- tileId: string;
12
- };
10
+ export type Tile = BaseTileProps;
13
11
  export interface TileGroup {
14
12
  id: number;
15
13
  label: string;
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React, { useMemo } from 'react';
9
+ import React from 'react';
10
10
  import { SkeletonPlaceholder, ContentSwitcher, Switch } from '@carbon/react';
11
11
  import { usePrefix } from '../../node_modules/@carbon-labs/utilities/es/usePrefix.js';
12
12
 
@@ -17,11 +17,8 @@ const ContentSwitcherSelector = ({
17
17
  }) => {
18
18
  const prefix = usePrefix();
19
19
  const blockClass = `${prefix}--animated-header__content-switcher`;
20
- if (!contentSwitcherConfig) return null;
21
- if (isLoading || contentSwitcherConfig.isLoading) {
22
- return /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
23
- className: `${blockClass}-skeleton`
24
- });
20
+ if (!contentSwitcherConfig) {
21
+ return null;
25
22
  }
26
23
  const {
27
24
  items = [],
@@ -34,16 +31,18 @@ const ContentSwitcherSelector = ({
34
31
  } = contentSwitcherConfig;
35
32
  const count = visibleCount === 3 ? 3 : 2;
36
33
  const visibleItems = items.slice(0, count);
34
+ const selectedIndexSafe = Math.min(Math.max(selectedIndex, 0), visibleItems.length - 1);
35
+ if (isLoading || contentSwitcherConfig.isLoading) {
36
+ return /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
37
+ className: `${blockClass}-skeleton`
38
+ });
39
+ }
37
40
  if (visibleItems.length < 2 || visibleItems.length > 3) {
38
41
  if (process.env.NODE_ENV !== 'production') {
39
42
  console.warn('[ContentSwitcherSelector] contentSwitcherConfig.items must contain 2 or 3 items.');
40
43
  }
41
44
  return null;
42
45
  }
43
- const selectedIndexSafe = useMemo(() => {
44
- const idx = typeof selectedIndex === 'number' ? selectedIndex : 0;
45
- return Math.min(Math.max(idx, 0), visibleItems.length - 1);
46
- }, [selectedIndex, visibleItems.length]);
47
46
  return /*#__PURE__*/React.createElement("div", {
48
47
  className: `${blockClass}--container`,
49
48
  "data-expanded": headerExpanded
@@ -25,10 +25,8 @@ export type TasksControllerProps = {
25
25
  tasksControllerConfig?: TasksControllerConfig | null;
26
26
  isLoading?: boolean;
27
27
  allTileGroups?: TileGroup[];
28
- selectedTileGroup?: TileGroup | null;
29
- setSelectedTileGroup?: (group: TileGroup | {
30
- selectedItem: TileGroup;
31
- }) => void;
28
+ selectedTileGroup?: TileGroup;
29
+ setSelectedTileGroup?: (e: any) => void;
32
30
  };
33
31
  declare const TasksController: ({ tasksControllerConfig, isLoading, allTileGroups, selectedTileGroup, setSelectedTileGroup, }: TasksControllerProps) => import("react/jsx-runtime").JSX.Element | null;
34
32
  export default TasksController;
@@ -33,24 +33,11 @@ const TasksController = ({
33
33
  ...dropdownOverrideProps
34
34
  } = tasksControllerConfig?.dropdown?.propsOverrides || {};
35
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
36
  /** Build Dropdown props (uses top-level list/selection/setter) */
52
37
  const dropdownProps = useMemo(() => {
53
- if (!allTileGroups?.length) return null;
38
+ if (!allTileGroups?.length) {
39
+ return null;
40
+ }
54
41
  return {
55
42
  id: `${blockClass}__header-dropdown`,
56
43
  className: `${blockClass}__header-dropdown${dropdownCustomClass ? ` ${dropdownCustomClass}` : ''}`,
@@ -74,6 +61,23 @@ const TasksController = ({
74
61
  };
75
62
  }, [allTileGroups, selectedTileGroup, setSelectedTileGroup, blockClass, dropdownCustomClass, dropdownOverrideProps, dropdownCustomOnChange, tasksControllerConfig?.dropdown?.label, tasksControllerConfig?.dropdown?.ariaLabel]);
76
63
 
64
+ /** Early outs */
65
+ if (!tasksControllerConfig?.type) {
66
+ return null;
67
+ }
68
+ if (isLoading || tasksControllerConfig?.isLoading) {
69
+ return /*#__PURE__*/React.createElement(SkeletonPlaceholder, {
70
+ className: `${blockClass}__task-controller-skeleton`
71
+ });
72
+ }
73
+
74
+ /** Button mode */
75
+ if (tasksControllerConfig?.type === 'button' && tasksControllerConfig?.button?.text) {
76
+ return /*#__PURE__*/React.createElement(Button, _extends({
77
+ className: `${blockClass}__button${buttonCustomClass ? ` ${buttonCustomClass}` : ''}`
78
+ }, buttonOverrideProps), tasksControllerConfig.button.text);
79
+ }
80
+
77
81
  /** Dropdown mode */
78
82
  if (tasksControllerConfig?.type === 'dropdown' && dropdownProps) {
79
83
  return /*#__PURE__*/React.createElement("div", {
@@ -8,7 +8,8 @@
8
8
  */
9
9
  import React, { ElementType } from 'react';
10
10
  export type AIPromptTileProps = {
11
- tileId: string | null;
11
+ variant: 'aiPrompt';
12
+ tileId: string;
12
13
  href?: string | null;
13
14
  title?: string | null;
14
15
  disabledTaskLabel?: string | null;
@@ -20,5 +21,5 @@ export type AIPromptTileProps = {
20
21
  open?: boolean;
21
22
  isLoading?: boolean;
22
23
  isDisabled?: boolean;
23
- } & Record<string, unknown>;
24
+ };
24
25
  export declare const AIPromptTile: React.FC<AIPromptTileProps>;
@@ -8,7 +8,8 @@
8
8
  */
9
9
  import React, { ElementType } from 'react';
10
10
  export type AITileProps = {
11
- tileId: string | null;
11
+ variant: 'ai';
12
+ tileId: string;
12
13
  href?: string | null;
13
14
  title?: string | null;
14
15
  subtitle?: string | null;
@@ -21,6 +22,6 @@ export type AITileProps = {
21
22
  open?: boolean;
22
23
  isLoading?: boolean;
23
24
  isDisabled?: boolean;
24
- } & Record<string, unknown>;
25
+ };
25
26
  export declare const AITile: React.FC<AITileProps>;
26
27
  export default AITile;
@@ -12,14 +12,5 @@ import { type AIPromptTileProps } from '../AIPromptTile/AIPromptTile';
12
12
  import { type GlassTileProps } from '../GlassTile/GlassTile';
13
13
  /** Base Tile router */
14
14
  export type TileVariant = 'glass' | 'aiPrompt' | 'ai';
15
- export type BaseTileProps = ({
16
- variant?: 'glass';
17
- } & GlassTileProps) | ({
18
- variant: 'aiPrompt';
19
- } & AIPromptTileProps) | (({
20
- variant: 'ai';
21
- } & AITileProps) & {
22
- id?: string;
23
- tileId?: string | null;
24
- });
15
+ export type BaseTileProps = GlassTileProps | AIPromptTileProps | AITileProps;
25
16
  export declare const BaseTile: React.FC<BaseTileProps>;
@@ -16,7 +16,7 @@ function inferVariant(props) {
16
16
  if (props.variant) {
17
17
  return props.variant;
18
18
  }
19
- if (props.id === 'ai-tile') {
19
+ if (props.tileId === 'ai-tile') {
20
20
  return 'aiPrompt';
21
21
  }
22
22
  return 'glass';
@@ -8,7 +8,8 @@
8
8
  */
9
9
  import React, { ElementType } from 'react';
10
10
  export type GlassTileProps = {
11
- tileId: string | null;
11
+ variant?: 'glass';
12
+ tileId: string;
12
13
  href?: string | null;
13
14
  title?: string | null;
14
15
  subtitle?: string | null;
@@ -21,5 +22,5 @@ export type GlassTileProps = {
21
22
  open?: boolean;
22
23
  isLoading?: boolean;
23
24
  isDisabled?: boolean;
24
- } & Record<string, unknown>;
25
+ };
25
26
  export declare const GlassTile: React.FC<GlassTileProps>;
package/es/index.d.ts CHANGED
@@ -14,4 +14,6 @@ import { BaseTile } from './components/Tiles/index';
14
14
  export * from './assets';
15
15
  export type { Workspace, WorkspaceSelectorConfig, } from './components/WorkspaceSelector/WorkspaceSelector';
16
16
  export type { TasksControllerConfig } from './components/TasksController/TasksController';
17
+ export type { HeaderActionConfig } from './components/HeaderAction/header-action.types';
18
+ export type { ContentSwitcherConfig } from './components/ContentSwitcherSelector/ContentSwitcherSelector';
17
19
  export { AnimatedHeader, BaseTile, HeaderAction, HeaderTitle, type AriaLabels, type TileGroup, };
@@ -15162,28 +15162,9 @@ export declare const ThemeG10: {
15162
15162
  options: number[];
15163
15163
  mapping: {
15164
15164
  0: null;
15165
- 1: {
15166
- ariaLabel: string;
15167
- visibleCount: number;
15168
- items: {
15169
- id: string;
15170
- text: string;
15171
- }[];
15172
- };
15173
- 2: {
15174
- ariaLabel: string;
15175
- visibleCount: number;
15176
- items: {
15177
- id: string;
15178
- text: string;
15179
- }[];
15180
- };
15181
- 3: {
15182
- ariaLabel: string;
15183
- isLoading: boolean;
15184
- visibleCount: number;
15185
- items: never[];
15186
- };
15165
+ 1: import("..").ContentSwitcherConfig;
15166
+ 2: import("..").ContentSwitcherConfig;
15167
+ 3: import("..").ContentSwitcherConfig;
15187
15168
  };
15188
15169
  };
15189
15170
  contentSwitcherLowContrast: {
@@ -30374,28 +30355,9 @@ export declare const ThemeG100: {
30374
30355
  options: number[];
30375
30356
  mapping: {
30376
30357
  0: null;
30377
- 1: {
30378
- ariaLabel: string;
30379
- visibleCount: number;
30380
- items: {
30381
- id: string;
30382
- text: string;
30383
- }[];
30384
- };
30385
- 2: {
30386
- ariaLabel: string;
30387
- visibleCount: number;
30388
- items: {
30389
- id: string;
30390
- text: string;
30391
- }[];
30392
- };
30393
- 3: {
30394
- ariaLabel: string;
30395
- isLoading: boolean;
30396
- visibleCount: number;
30397
- items: never[];
30398
- };
30358
+ 1: import("..").ContentSwitcherConfig;
30359
+ 2: import("..").ContentSwitcherConfig;
30360
+ 3: import("..").ContentSwitcherConfig;
30399
30361
  };
30400
30362
  };
30401
30363
  contentSwitcherLowContrast: {
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { TileGroup } from '../../components/AnimatedHeader/types';
10
10
  import type { HeaderActionConfig } from '../../components/HeaderAction/header-action.types';
11
+ import type { ContentSwitcherConfig } from '../../components/ContentSwitcherSelector/ContentSwitcherSelector';
11
12
  export declare const workspaceData: {
12
13
  id: string;
13
14
  label: string;
@@ -36,28 +37,9 @@ export declare const tasksControllerConfigLoading: {
36
37
  type: string;
37
38
  isLoading: boolean;
38
39
  };
39
- export declare const contentSwitcherConfigTwo: {
40
- ariaLabel: string;
41
- visibleCount: number;
42
- items: {
43
- id: string;
44
- text: string;
45
- }[];
46
- };
47
- export declare const contentSwitcherConfigThree: {
48
- ariaLabel: string;
49
- visibleCount: number;
50
- items: {
51
- id: string;
52
- text: string;
53
- }[];
54
- };
55
- export declare const contentSwitcherConfigLoading: {
56
- ariaLabel: string;
57
- isLoading: boolean;
58
- visibleCount: number;
59
- items: never[];
60
- };
40
+ export declare const contentSwitcherConfigTwo: ContentSwitcherConfig;
41
+ export declare const contentSwitcherConfigThree: ContentSwitcherConfig;
42
+ export declare const contentSwitcherConfigLoading: ContentSwitcherConfig;
61
43
  export declare const workspaceSelectorConfig: {
62
44
  allWorkspaces: {
63
45
  id: string;
@@ -62,7 +62,9 @@ const AnimatedHeader = ({
62
62
  animRef.current.destroy();
63
63
  animRef.current = null;
64
64
  }
65
- if (!animationContainer.current || !headerAnimation) return;
65
+ if (!animationContainer.current || !headerAnimation) {
66
+ return;
67
+ }
66
68
  const animation = lottie.default.loadAnimation({
67
69
  container: animationContainer.current,
68
70
  animationData: headerAnimation,
@@ -187,7 +189,7 @@ const AnimatedHeader = ({
187
189
  const legacyId = tile.id; // old configs
188
190
  const resolvedTileId = tileId ?? legacyId;
189
191
  const key = resolvedTileId ?? `tile-${index}`;
190
- const hasAction = tile.href || tile.onClick === 'function';
192
+ const hasAction = tile.href || typeof tile.onClick === 'function';
191
193
  return /*#__PURE__*/React.createElement(BaseTile.BaseTile, _rollupPluginBabelHelpers.extends({
192
194
  key: key,
193
195
  tileId: resolvedTileId
@@ -7,9 +7,7 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
9
  import type { BaseTileProps } from '../../components/Tiles/BaseTile/BaseTile';
10
- export type Tile = Omit<BaseTileProps, 'id'> & {
11
- tileId: string;
12
- };
10
+ export type Tile = BaseTileProps;
13
11
  export interface TileGroup {
14
12
  id: number;
15
13
  label: string;
@@ -21,11 +21,8 @@ const ContentSwitcherSelector = ({
21
21
  }) => {
22
22
  const prefix = usePrefix.usePrefix();
23
23
  const blockClass = `${prefix}--animated-header__content-switcher`;
24
- if (!contentSwitcherConfig) return null;
25
- if (isLoading || contentSwitcherConfig.isLoading) {
26
- return /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
27
- className: `${blockClass}-skeleton`
28
- });
24
+ if (!contentSwitcherConfig) {
25
+ return null;
29
26
  }
30
27
  const {
31
28
  items = [],
@@ -38,16 +35,18 @@ const ContentSwitcherSelector = ({
38
35
  } = contentSwitcherConfig;
39
36
  const count = visibleCount === 3 ? 3 : 2;
40
37
  const visibleItems = items.slice(0, count);
38
+ const selectedIndexSafe = Math.min(Math.max(selectedIndex, 0), visibleItems.length - 1);
39
+ if (isLoading || contentSwitcherConfig.isLoading) {
40
+ return /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
41
+ className: `${blockClass}-skeleton`
42
+ });
43
+ }
41
44
  if (visibleItems.length < 2 || visibleItems.length > 3) {
42
45
  if (process.env.NODE_ENV !== 'production') {
43
46
  console.warn('[ContentSwitcherSelector] contentSwitcherConfig.items must contain 2 or 3 items.');
44
47
  }
45
48
  return null;
46
49
  }
47
- const selectedIndexSafe = React.useMemo(() => {
48
- const idx = typeof selectedIndex === 'number' ? selectedIndex : 0;
49
- return Math.min(Math.max(idx, 0), visibleItems.length - 1);
50
- }, [selectedIndex, visibleItems.length]);
51
50
  return /*#__PURE__*/React.createElement("div", {
52
51
  className: `${blockClass}--container`,
53
52
  "data-expanded": headerExpanded
@@ -25,10 +25,8 @@ export type TasksControllerProps = {
25
25
  tasksControllerConfig?: TasksControllerConfig | null;
26
26
  isLoading?: boolean;
27
27
  allTileGroups?: TileGroup[];
28
- selectedTileGroup?: TileGroup | null;
29
- setSelectedTileGroup?: (group: TileGroup | {
30
- selectedItem: TileGroup;
31
- }) => void;
28
+ selectedTileGroup?: TileGroup;
29
+ setSelectedTileGroup?: (e: any) => void;
32
30
  };
33
31
  declare const TasksController: ({ tasksControllerConfig, isLoading, allTileGroups, selectedTileGroup, setSelectedTileGroup, }: TasksControllerProps) => import("react/jsx-runtime").JSX.Element | null;
34
32
  export default TasksController;
@@ -37,24 +37,11 @@ const TasksController = ({
37
37
  ...dropdownOverrideProps
38
38
  } = tasksControllerConfig?.dropdown?.propsOverrides || {};
39
39
 
40
- /** Early outs */
41
- if (!tasksControllerConfig?.type) return null;
42
- if (isLoading || tasksControllerConfig?.isLoading) {
43
- return /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
44
- className: `${blockClass}__task-controller-skeleton`
45
- });
46
- }
47
-
48
- /** Button mode */
49
- if (tasksControllerConfig?.type === 'button' && tasksControllerConfig?.button?.text) {
50
- return /*#__PURE__*/React.createElement(react.Button, _rollupPluginBabelHelpers.extends({
51
- className: `${blockClass}__button${buttonCustomClass ? ` ${buttonCustomClass}` : ''}`
52
- }, buttonOverrideProps), tasksControllerConfig.button.text);
53
- }
54
-
55
40
  /** Build Dropdown props (uses top-level list/selection/setter) */
56
41
  const dropdownProps = React.useMemo(() => {
57
- if (!allTileGroups?.length) return null;
42
+ if (!allTileGroups?.length) {
43
+ return null;
44
+ }
58
45
  return {
59
46
  id: `${blockClass}__header-dropdown`,
60
47
  className: `${blockClass}__header-dropdown${dropdownCustomClass ? ` ${dropdownCustomClass}` : ''}`,
@@ -78,6 +65,23 @@ const TasksController = ({
78
65
  };
79
66
  }, [allTileGroups, selectedTileGroup, setSelectedTileGroup, blockClass, dropdownCustomClass, dropdownOverrideProps, dropdownCustomOnChange, tasksControllerConfig?.dropdown?.label, tasksControllerConfig?.dropdown?.ariaLabel]);
80
67
 
68
+ /** Early outs */
69
+ if (!tasksControllerConfig?.type) {
70
+ return null;
71
+ }
72
+ if (isLoading || tasksControllerConfig?.isLoading) {
73
+ return /*#__PURE__*/React.createElement(react.SkeletonPlaceholder, {
74
+ className: `${blockClass}__task-controller-skeleton`
75
+ });
76
+ }
77
+
78
+ /** Button mode */
79
+ if (tasksControllerConfig?.type === 'button' && tasksControllerConfig?.button?.text) {
80
+ return /*#__PURE__*/React.createElement(react.Button, _rollupPluginBabelHelpers.extends({
81
+ className: `${blockClass}__button${buttonCustomClass ? ` ${buttonCustomClass}` : ''}`
82
+ }, buttonOverrideProps), tasksControllerConfig.button.text);
83
+ }
84
+
81
85
  /** Dropdown mode */
82
86
  if (tasksControllerConfig?.type === 'dropdown' && dropdownProps) {
83
87
  return /*#__PURE__*/React.createElement("div", {
@@ -8,7 +8,8 @@
8
8
  */
9
9
  import React, { ElementType } from 'react';
10
10
  export type AIPromptTileProps = {
11
- tileId: string | null;
11
+ variant: 'aiPrompt';
12
+ tileId: string;
12
13
  href?: string | null;
13
14
  title?: string | null;
14
15
  disabledTaskLabel?: string | null;
@@ -20,5 +21,5 @@ export type AIPromptTileProps = {
20
21
  open?: boolean;
21
22
  isLoading?: boolean;
22
23
  isDisabled?: boolean;
23
- } & Record<string, unknown>;
24
+ };
24
25
  export declare const AIPromptTile: React.FC<AIPromptTileProps>;
@@ -8,7 +8,8 @@
8
8
  */
9
9
  import React, { ElementType } from 'react';
10
10
  export type AITileProps = {
11
- tileId: string | null;
11
+ variant: 'ai';
12
+ tileId: string;
12
13
  href?: string | null;
13
14
  title?: string | null;
14
15
  subtitle?: string | null;
@@ -21,6 +22,6 @@ export type AITileProps = {
21
22
  open?: boolean;
22
23
  isLoading?: boolean;
23
24
  isDisabled?: boolean;
24
- } & Record<string, unknown>;
25
+ };
25
26
  export declare const AITile: React.FC<AITileProps>;
26
27
  export default AITile;
@@ -12,14 +12,5 @@ import { type AIPromptTileProps } from '../AIPromptTile/AIPromptTile';
12
12
  import { type GlassTileProps } from '../GlassTile/GlassTile';
13
13
  /** Base Tile router */
14
14
  export type TileVariant = 'glass' | 'aiPrompt' | 'ai';
15
- export type BaseTileProps = ({
16
- variant?: 'glass';
17
- } & GlassTileProps) | ({
18
- variant: 'aiPrompt';
19
- } & AIPromptTileProps) | (({
20
- variant: 'ai';
21
- } & AITileProps) & {
22
- id?: string;
23
- tileId?: string | null;
24
- });
15
+ export type BaseTileProps = GlassTileProps | AIPromptTileProps | AITileProps;
25
16
  export declare const BaseTile: React.FC<BaseTileProps>;
@@ -18,7 +18,7 @@ function inferVariant(props) {
18
18
  if (props.variant) {
19
19
  return props.variant;
20
20
  }
21
- if (props.id === 'ai-tile') {
21
+ if (props.tileId === 'ai-tile') {
22
22
  return 'aiPrompt';
23
23
  }
24
24
  return 'glass';
@@ -8,7 +8,8 @@
8
8
  */
9
9
  import React, { ElementType } from 'react';
10
10
  export type GlassTileProps = {
11
- tileId: string | null;
11
+ variant?: 'glass';
12
+ tileId: string;
12
13
  href?: string | null;
13
14
  title?: string | null;
14
15
  subtitle?: string | null;
@@ -21,5 +22,5 @@ export type GlassTileProps = {
21
22
  open?: boolean;
22
23
  isLoading?: boolean;
23
24
  isDisabled?: boolean;
24
- } & Record<string, unknown>;
25
+ };
25
26
  export declare const GlassTile: React.FC<GlassTileProps>;
package/lib/index.d.ts CHANGED
@@ -14,4 +14,6 @@ import { BaseTile } from './components/Tiles/index';
14
14
  export * from './assets';
15
15
  export type { Workspace, WorkspaceSelectorConfig, } from './components/WorkspaceSelector/WorkspaceSelector';
16
16
  export type { TasksControllerConfig } from './components/TasksController/TasksController';
17
+ export type { HeaderActionConfig } from './components/HeaderAction/header-action.types';
18
+ export type { ContentSwitcherConfig } from './components/ContentSwitcherSelector/ContentSwitcherSelector';
17
19
  export { AnimatedHeader, BaseTile, HeaderAction, HeaderTitle, type AriaLabels, type TileGroup, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon-labs/react-animated-header",
3
- "version": "0.35.0",
3
+ "version": "0.37.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": "e309816781d0fc8aff80cb7c9525830cc20c753c"
48
+ "gitHead": "864d211894887413eba51fb15c147b1711c83e33"
49
49
  }