@carbon-labs/react-animated-header 0.19.0 → 0.20.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;
@@ -143,7 +143,7 @@ const AnimatedHeader = _ref => {
143
143
  md: 8,
144
144
  lg: 12,
145
145
  className: `${blockClass}__content`
146
- }, workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
146
+ }, !!workspaceSelectorConfig?.allWorkspaces?.length && /*#__PURE__*/React.createElement("div", {
147
147
  className: `${blockClass}__workspace--container${!open ? ` ${contentCollapsed}` : ''}`
148
148
  }, /*#__PURE__*/React.createElement(WorkspaceSelector.default, {
149
149
  workspaceSelectorConfig: workspaceSelectorConfig,
@@ -153,7 +153,10 @@ const AnimatedHeader = _ref => {
153
153
  className: `${blockClass}__tiles-container`
154
154
  }, selectedTileGroup.tiles.map(tile => {
155
155
  return /*#__PURE__*/React.createElement(BaseTile.BaseTile, {
156
- onClick: () => tileClickHandler?.(tile),
156
+ onClick: tile.href || tile.onClick ? () => {
157
+ tileClickHandler?.(tile);
158
+ tile.onClick?.();
159
+ } : null,
157
160
  key: tile.id,
158
161
  id: tile.id,
159
162
  open: open,
@@ -166,8 +169,7 @@ const AnimatedHeader = _ref => {
166
169
  customContent: tile.customContent,
167
170
  isLoading: isLoading || tile.isLoading,
168
171
  isDisabled: tile.isDisabled,
169
- disabledTaskLabel: disabledTaskLabel,
170
- isInteractive: tile.isInteractive
172
+ disabledTaskLabel: disabledTaskLabel
171
173
  });
172
174
  }))), /*#__PURE__*/React.createElement("div", {
173
175
  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 {};
@@ -26,7 +26,8 @@ const AIPromptTile = _ref => {
26
26
  title,
27
27
  isLoading,
28
28
  isDisabled,
29
- disabledTaskLabel
29
+ disabledTaskLabel,
30
+ onClick
30
31
  } = _ref;
31
32
  const prefix = usePrefix.usePrefix();
32
33
  const blockClass = `${prefix}--animated-header__ai-prompt-tile`;
@@ -91,7 +92,10 @@ const AIPromptTile = _ref => {
91
92
  size: "sm",
92
93
  disabled: !textInput,
93
94
  align: "top-right",
94
- onClick: () => openInNewTab(`${href}&primed_chat=${textInput}`),
95
+ onClick: () => {
96
+ onClick?.();
97
+ openInNewTab(`${href}&primed_chat=${textInput}`);
98
+ },
95
99
  onKeyDown: handleTextInputKeyDown
96
100
  }, _Send || (_Send = /*#__PURE__*/React.createElement(icons.Send, null)))), /*#__PURE__*/React.createElement("div", {
97
101
  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 {};
@@ -27,8 +27,7 @@ const GlassTile = _ref => {
27
27
  isLoading,
28
28
  isDisabled,
29
29
  disabledTaskLabel,
30
- onClick: glassTileClickHandler,
31
- isInteractive = true
30
+ onClick: glassTileClickHandler
32
31
  } = _ref;
33
32
  const prefix = usePrefix.usePrefix();
34
33
  const blockClass = `${prefix}--animated-header__glass-tile`;
@@ -41,7 +40,9 @@ const GlassTile = _ref => {
41
40
  customContent: customContent,
42
41
  isLoading: isLoading
43
42
  });
44
- if (isInteractive === false) {
43
+
44
+ // Non-interactive tile
45
+ if (!href && !glassTileClickHandler) {
45
46
  return /*#__PURE__*/React.createElement("div", {
46
47
  className: `${prefix}--animated-header__tile ${blockClass}`,
47
48
  key: id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon-labs/react-animated-header",
3
- "version": "0.19.0",
3
+ "version": "0.20.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": "56be4e1c18c10467e7e5117bc9b93099969231d5"
48
+ "gitHead": "72a646fa862d36c040b7f205167464831f6d59c5"
49
49
  }