@carbon-labs/react-animated-header 0.19.0 → 0.21.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.
@@ -46,16 +46,14 @@ export const headerTiles: ({
46
46
  subtitle: string;
47
47
  mainIcon: import("@carbon/react/icons").CarbonIconType;
48
48
  isLoading: boolean;
49
- isInteractive?: undefined;
50
49
  isDisabled?: undefined;
51
50
  secondaryIcon?: undefined;
52
51
  } | {
53
52
  id: string;
54
- href: string;
55
53
  title: string;
56
54
  subtitle: string;
57
55
  mainIcon: import("@carbon/react/icons").CarbonIconType;
58
- isInteractive: boolean;
56
+ href?: undefined;
59
57
  isLoading?: undefined;
60
58
  isDisabled?: undefined;
61
59
  secondaryIcon?: undefined;
@@ -67,7 +65,6 @@ export const headerTiles: ({
67
65
  mainIcon: import("@carbon/react/icons").CarbonIconType;
68
66
  isDisabled: boolean;
69
67
  isLoading?: undefined;
70
- isInteractive?: undefined;
71
68
  secondaryIcon?: undefined;
72
69
  } | {
73
70
  id: string;
@@ -77,7 +74,6 @@ export const headerTiles: ({
77
74
  secondaryIcon: import("@carbon/react/icons").CarbonIconType;
78
75
  subtitle?: undefined;
79
76
  isLoading?: undefined;
80
- isInteractive?: undefined;
81
77
  isDisabled?: undefined;
82
78
  })[];
83
79
  } | {
@@ -148,16 +144,14 @@ export namespace tasksControllerConfigDropdown {
148
144
  subtitle: string;
149
145
  mainIcon: import("@carbon/react/icons").CarbonIconType;
150
146
  isLoading: boolean;
151
- isInteractive?: undefined;
152
147
  isDisabled?: undefined;
153
148
  secondaryIcon?: undefined;
154
149
  } | {
155
150
  id: string;
156
- href: string;
157
151
  title: string;
158
152
  subtitle: string;
159
153
  mainIcon: import("@carbon/react/icons").CarbonIconType;
160
- isInteractive: boolean;
154
+ href?: undefined;
161
155
  isLoading?: undefined;
162
156
  isDisabled?: undefined;
163
157
  secondaryIcon?: undefined;
@@ -169,7 +163,6 @@ export namespace tasksControllerConfigDropdown {
169
163
  mainIcon: import("@carbon/react/icons").CarbonIconType;
170
164
  isDisabled: boolean;
171
165
  isLoading?: undefined;
172
- isInteractive?: undefined;
173
166
  secondaryIcon?: undefined;
174
167
  } | {
175
168
  id: string;
@@ -179,7 +172,6 @@ export namespace tasksControllerConfigDropdown {
179
172
  secondaryIcon: import("@carbon/react/icons").CarbonIconType;
180
173
  subtitle?: undefined;
181
174
  isLoading?: undefined;
182
- isInteractive?: undefined;
183
175
  isDisabled?: undefined;
184
176
  })[];
185
177
  } | {
@@ -12,7 +12,7 @@ export interface Tile {
12
12
  customContent?: ReactNode | null;
13
13
  isLoading?: boolean;
14
14
  isDisabled?: boolean;
15
- isInteractive?: boolean;
15
+ onClick?: () => void;
16
16
  }
17
17
  export interface TileGroup {
18
18
  id: number;
@@ -139,7 +139,7 @@ const AnimatedHeader = _ref => {
139
139
  md: 8,
140
140
  lg: 12,
141
141
  className: `${blockClass}__content`
142
- }, workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
142
+ }, !!workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
143
143
  className: `${blockClass}__workspace--container${!open ? ` ${contentCollapsed}` : ''}`
144
144
  }, /*#__PURE__*/React.createElement(WorkspaceSelector, {
145
145
  workspaceSelectorConfig: workspaceSelectorConfig,
@@ -149,7 +149,10 @@ const AnimatedHeader = _ref => {
149
149
  className: `${blockClass}__tiles-container`
150
150
  }, selectedTileGroup.tiles.map(tile => {
151
151
  return /*#__PURE__*/React.createElement(BaseTile, {
152
- onClick: () => tileClickHandler?.(tile),
152
+ onClick: tile.href || tile.onClick ? () => {
153
+ tileClickHandler?.(tile);
154
+ tile.onClick?.();
155
+ } : null,
153
156
  key: tile.id,
154
157
  id: tile.id,
155
158
  open: open,
@@ -162,8 +165,7 @@ const AnimatedHeader = _ref => {
162
165
  customContent: tile.customContent,
163
166
  isLoading: isLoading || tile.isLoading,
164
167
  isDisabled: tile.isDisabled,
165
- disabledTaskLabel: disabledTaskLabel,
166
- isInteractive: tile.isInteractive
168
+ disabledTaskLabel: disabledTaskLabel
167
169
  });
168
170
  }))), /*#__PURE__*/React.createElement("div", {
169
171
  className: `${blockClass}__button-collapse--gradient`
@@ -18,6 +18,7 @@ interface AIPromptTileProps {
18
18
  isLoading?: boolean;
19
19
  isDisabled?: boolean;
20
20
  disabledTaskLabel?: string;
21
+ onClick?: (() => void) | null;
21
22
  }
22
23
  export declare const AIPromptTile: React.FC<AIPromptTileProps>;
23
24
  export {};
@@ -24,7 +24,8 @@ const AIPromptTile = _ref => {
24
24
  title,
25
25
  isLoading,
26
26
  isDisabled,
27
- disabledTaskLabel
27
+ disabledTaskLabel,
28
+ onClick
28
29
  } = _ref;
29
30
  const prefix = usePrefix();
30
31
  const blockClass = `${prefix}--animated-header__ai-prompt-tile`;
@@ -89,7 +90,10 @@ const AIPromptTile = _ref => {
89
90
  size: "sm",
90
91
  disabled: !textInput,
91
92
  align: "top-right",
92
- onClick: () => openInNewTab(`${href}&primed_chat=${textInput}`),
93
+ onClick: () => {
94
+ onClick?.();
95
+ openInNewTab(`${href}&primed_chat=${textInput}`);
96
+ },
93
97
  onKeyDown: handleTextInputKeyDown
94
98
  }, _Send || (_Send = /*#__PURE__*/React.createElement(Send, null)))), /*#__PURE__*/React.createElement("div", {
95
99
  className: `${blockClass}--footer`
@@ -21,8 +21,7 @@ interface BaseTileProps {
21
21
  isLoading?: boolean;
22
22
  isDisabled?: boolean;
23
23
  disabledTaskLabel?: string;
24
- onClick?: () => void;
25
- isInteractive?: boolean;
24
+ onClick?: (() => void) | null;
26
25
  }
27
26
  export declare const BaseTile: React.FC<BaseTileProps>;
28
27
  export {};
@@ -14,8 +14,7 @@ interface GlassTileProps {
14
14
  isLoading?: boolean;
15
15
  isDisabled?: boolean;
16
16
  disabledTaskLabel?: string;
17
- onClick?: () => void;
18
- isInteractive?: boolean;
17
+ onClick?: (() => void) | null;
19
18
  }
20
19
  export declare const GlassTile: React.FC<GlassTileProps>;
21
20
  export {};
@@ -25,8 +25,7 @@ const GlassTile = _ref => {
25
25
  isLoading,
26
26
  isDisabled,
27
27
  disabledTaskLabel,
28
- onClick: glassTileClickHandler,
29
- isInteractive = true
28
+ onClick: glassTileClickHandler
30
29
  } = _ref;
31
30
  const prefix = usePrefix();
32
31
  const blockClass = `${prefix}--animated-header__glass-tile`;
@@ -39,7 +38,9 @@ const GlassTile = _ref => {
39
38
  customContent: customContent,
40
39
  isLoading: isLoading
41
40
  });
42
- if (isInteractive === false) {
41
+
42
+ // Non-interactive tile
43
+ if (!href && !glassTileClickHandler) {
43
44
  return /*#__PURE__*/React.createElement("div", {
44
45
  className: `${prefix}--animated-header__tile ${blockClass}`,
45
46
  key: id