@primer/react 38.43.0-rc.fd837f586 → 38.44.0-rc.0c9e08268

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.
@@ -1,3 +1,4 @@
1
+ import { c } from "../../utils/react-compiler-runtime.js";
1
2
  import useIsomorphicLayoutEffect from "../../utils/useIsomorphicLayoutEffect.js";
2
3
  import { useResizeObserver } from "../../hooks/useResizeObserver.js";
3
4
  import { useId as useId$1 } from "../../hooks/useId.js";
@@ -10,7 +11,7 @@ import { useTab } from "../Tabs/useTab.js";
10
11
  import { useTabList } from "../Tabs/useTabList.js";
11
12
  import { useTabPanel } from "../Tabs/useTabPanel.js";
12
13
  import { Tabs } from "../Tabs/Tabs.js";
13
- import React, { Children, cloneElement, createContext, isValidElement, useContext, useMemo, useRef, useState } from "react";
14
+ import React, { Children, cloneElement, createContext, isValidElement, useContext, useRef, useState } from "react";
14
15
  import { jsx, jsxs } from "react/jsx-runtime";
15
16
  import { clsx } from "clsx";
16
17
  //#region src/experimental/UnderlinePanels/UnderlinePanels.tsx
@@ -18,172 +19,460 @@ const UnderlinePanelsContext = /*#__PURE__*/ createContext({
18
19
  iconsVisible: true,
19
20
  loadingCounters: void 0
20
21
  });
21
- const UnderlinePanels = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, loadingCounters, className, value: controlledValue, defaultValue, onChange, activationMode = "automatic", ...props }) => {
22
- var _tabValues$;
22
+ const UnderlinePanels = (t0) => {
23
+ const $ = c(75);
24
+ let ariaLabel;
25
+ let ariaLabelledBy;
26
+ let children;
27
+ let className;
28
+ let controlledValue;
29
+ let defaultValue;
30
+ let loadingCounters;
31
+ let onChange;
32
+ let props;
33
+ let t1;
34
+ if ($[0] !== t0) {
35
+ ({"aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, loadingCounters, className, value: controlledValue, defaultValue, onChange, activationMode: t1, ...props} = t0);
36
+ $[0] = t0;
37
+ $[1] = ariaLabel;
38
+ $[2] = ariaLabelledBy;
39
+ $[3] = children;
40
+ $[4] = className;
41
+ $[5] = controlledValue;
42
+ $[6] = defaultValue;
43
+ $[7] = loadingCounters;
44
+ $[8] = onChange;
45
+ $[9] = props;
46
+ $[10] = t1;
47
+ } else {
48
+ ariaLabel = $[1];
49
+ ariaLabelledBy = $[2];
50
+ children = $[3];
51
+ className = $[4];
52
+ controlledValue = $[5];
53
+ defaultValue = $[6];
54
+ loadingCounters = $[7];
55
+ onChange = $[8];
56
+ props = $[9];
57
+ t1 = $[10];
58
+ }
59
+ const activationMode = t1 === void 0 ? "automatic" : t1;
23
60
  const [iconsVisible, setIconsVisible] = useState(true);
24
61
  const wrapperRef = useRef(null);
25
62
  const listRef = useRef(null);
26
63
  const parentId = useId$1(props.id);
27
- const [tabs, tabPanels, tabsHaveIcons, selectedFromProps, tabValues, panelValues] = useMemo(() => {
28
- let tabIndex = 0;
29
- let panelIndex = 0;
64
+ let panelValues;
65
+ let selectedFromProps;
66
+ let t2;
67
+ let tabPanels;
68
+ let tabValues;
69
+ let tabs;
70
+ if ($[11] !== children) {
71
+ const indices = {
72
+ tab: 0,
73
+ panel: 0
74
+ };
30
75
  const childrenWithProps = Children.map(children, (child) => {
31
76
  if (/*#__PURE__*/ isValidElement(child) && (child.type === Tab || isSlot(child, Tab))) {
32
77
  var _child$props$value;
33
- const value = (_child$props$value = child.props.value) !== null && _child$props$value !== void 0 ? _child$props$value : `${tabIndex}`;
34
- tabIndex++;
78
+ const value = (_child$props$value = child.props.value) !== null && _child$props$value !== void 0 ? _child$props$value : `${indices.tab}`;
79
+ indices.tab = indices.tab + 1;
35
80
  return /*#__PURE__*/ cloneElement(child, { value });
36
81
  }
37
82
  if (/*#__PURE__*/ isValidElement(child) && (child.type === Panel || isSlot(child, Panel))) {
38
83
  var _child$props$value2;
39
- const value = (_child$props$value2 = child.props.value) !== null && _child$props$value2 !== void 0 ? _child$props$value2 : `${panelIndex}`;
40
- panelIndex++;
41
- return /*#__PURE__*/ cloneElement(child, { value });
84
+ const value_0 = (_child$props$value2 = child.props.value) !== null && _child$props$value2 !== void 0 ? _child$props$value2 : `${indices.panel}`;
85
+ indices.panel = indices.panel + 1;
86
+ return /*#__PURE__*/ cloneElement(child, { value: value_0 });
42
87
  }
43
88
  return child;
44
89
  });
45
- const tabs = [];
46
- const tabPanels = [];
47
- const tabValues = [];
48
- const panelValues = [];
49
- let selectedFromProps;
50
- for (const child of Children.toArray(childrenWithProps)) {
51
- if (!/*#__PURE__*/ isValidElement(child)) continue;
52
- if (child.type === Tab || isSlot(child, Tab)) {
53
- const value = child.props.value;
54
- if (value !== void 0) tabValues.push(value);
55
- const ariaSelected = child.props["aria-selected"];
56
- if (ariaSelected === true || ariaSelected === "true") selectedFromProps = value;
57
- tabs.push(child);
58
- } else if (child.type === Panel || isSlot(child, Panel)) {
59
- const value = child.props.value;
60
- if (value !== void 0) panelValues.push(value);
61
- tabPanels.push(child);
90
+ tabs = [];
91
+ tabPanels = [];
92
+ tabValues = [];
93
+ panelValues = [];
94
+ for (const child_0 of Children.toArray(childrenWithProps)) {
95
+ if (!/*#__PURE__*/ isValidElement(child_0)) continue;
96
+ if (child_0.type === Tab || isSlot(child_0, Tab)) {
97
+ const value_1 = child_0.props.value;
98
+ if (value_1 !== void 0) tabValues.push(value_1);
99
+ const ariaSelected = child_0.props["aria-selected"];
100
+ if (ariaSelected === true || ariaSelected === "true") selectedFromProps = value_1;
101
+ tabs.push(child_0);
102
+ } else if (child_0.type === Panel || isSlot(child_0, Panel)) {
103
+ const value_2 = child_0.props.value;
104
+ if (value_2 !== void 0) panelValues.push(value_2);
105
+ tabPanels.push(child_0);
62
106
  }
63
107
  }
64
- return [
108
+ t2 = tabs.some(_temp);
109
+ $[11] = children;
110
+ $[12] = panelValues;
111
+ $[13] = selectedFromProps;
112
+ $[14] = t2;
113
+ $[15] = tabPanels;
114
+ $[16] = tabValues;
115
+ $[17] = tabs;
116
+ } else {
117
+ panelValues = $[12];
118
+ selectedFromProps = $[13];
119
+ t2 = $[14];
120
+ tabPanels = $[15];
121
+ tabValues = $[16];
122
+ tabs = $[17];
123
+ }
124
+ const tabsHaveIcons = t2;
125
+ let t3;
126
+ if ($[18] !== panelValues || $[19] !== selectedFromProps || $[20] !== tabPanels || $[21] !== tabValues || $[22] !== tabs || $[23] !== tabsHaveIcons) {
127
+ t3 = [
65
128
  tabs,
66
129
  tabPanels,
67
- tabs.some((tab) => /*#__PURE__*/ React.isValidElement(tab) && tab.props.icon),
130
+ tabsHaveIcons,
68
131
  selectedFromProps,
69
132
  tabValues,
70
133
  panelValues
71
134
  ];
72
- }, [children]);
135
+ $[18] = panelValues;
136
+ $[19] = selectedFromProps;
137
+ $[20] = tabPanels;
138
+ $[21] = tabValues;
139
+ $[22] = tabs;
140
+ $[23] = tabsHaveIcons;
141
+ $[24] = t3;
142
+ } else t3 = $[24];
143
+ const [tabs_0, tabPanels_0, tabsHaveIcons_0, selectedFromProps_0, tabValues_0, panelValues_0] = t3;
73
144
  const isControlled = controlledValue !== void 0;
74
- const [uncontrolledValue, setUncontrolledValue] = useState(() => {
75
- var _ref;
76
- return (_ref = defaultValue !== null && defaultValue !== void 0 ? defaultValue : selectedFromProps) !== null && _ref !== void 0 ? _ref : "0";
77
- });
78
- const [prevSelectedFromProps, setPrevSelectedFromProps] = useState(selectedFromProps);
79
- if (!isControlled && selectedFromProps !== prevSelectedFromProps) {
80
- setPrevSelectedFromProps(selectedFromProps);
81
- if (selectedFromProps !== void 0 && selectedFromProps !== uncontrolledValue) setUncontrolledValue(selectedFromProps);
145
+ let t4;
146
+ if ($[25] !== defaultValue || $[26] !== selectedFromProps_0) {
147
+ t4 = () => {
148
+ var _ref;
149
+ return (_ref = defaultValue !== null && defaultValue !== void 0 ? defaultValue : selectedFromProps_0) !== null && _ref !== void 0 ? _ref : "0";
150
+ };
151
+ $[25] = defaultValue;
152
+ $[26] = selectedFromProps_0;
153
+ $[27] = t4;
154
+ } else t4 = $[27];
155
+ const [uncontrolledValue, setUncontrolledValue] = useState(t4);
156
+ const [prevSelectedFromProps, setPrevSelectedFromProps] = useState(selectedFromProps_0);
157
+ if (!isControlled && selectedFromProps_0 !== prevSelectedFromProps) {
158
+ setPrevSelectedFromProps(selectedFromProps_0);
159
+ if (selectedFromProps_0 !== void 0 && selectedFromProps_0 !== uncontrolledValue) setUncontrolledValue(selectedFromProps_0);
82
160
  }
83
161
  const selectedValue = isControlled ? controlledValue : uncontrolledValue;
84
- const effectiveValue = tabValues.includes(selectedValue) ? selectedValue : (_tabValues$ = tabValues[0]) !== null && _tabValues$ !== void 0 ? _tabValues$ : selectedValue;
85
- const handleValueChange = (value) => {
86
- if (!isControlled) setUncontrolledValue(value);
87
- onChange === null || onChange === void 0 || onChange({ value });
88
- };
89
- const { tabListProps } = useTabList({
90
- "aria-label": ariaLabel,
91
- "aria-labelledby": ariaLabelledBy,
92
- ref: listRef
93
- });
94
- const contextValue = useMemo(() => ({
95
- iconsVisible,
96
- loadingCounters
97
- }), [iconsVisible, loadingCounters]);
162
+ let t5;
163
+ if ($[28] !== selectedValue || $[29] !== tabValues_0) {
164
+ var _tabValues_0$;
165
+ t5 = tabValues_0.includes(selectedValue) ? selectedValue : (_tabValues_0$ = tabValues_0[0]) !== null && _tabValues_0$ !== void 0 ? _tabValues_0$ : selectedValue;
166
+ $[28] = selectedValue;
167
+ $[29] = tabValues_0;
168
+ $[30] = t5;
169
+ } else t5 = $[30];
170
+ const effectiveValue = t5;
171
+ let t6;
172
+ if ($[31] !== isControlled || $[32] !== onChange) {
173
+ t6 = (value_3) => {
174
+ var _onChange;
175
+ if (!isControlled) setUncontrolledValue(value_3);
176
+ (_onChange = onChange) === null || _onChange === void 0 || _onChange({ value: value_3 });
177
+ };
178
+ $[31] = isControlled;
179
+ $[32] = onChange;
180
+ $[33] = t6;
181
+ } else t6 = $[33];
182
+ const handleValueChange = t6;
183
+ let t7;
184
+ if ($[34] !== ariaLabel || $[35] !== ariaLabelledBy) {
185
+ t7 = {
186
+ "aria-label": ariaLabel,
187
+ "aria-labelledby": ariaLabelledBy,
188
+ ref: listRef
189
+ };
190
+ $[34] = ariaLabel;
191
+ $[35] = ariaLabelledBy;
192
+ $[36] = t7;
193
+ } else t7 = $[36];
194
+ const { tabListProps } = useTabList(t7);
195
+ let t8;
196
+ if ($[37] !== iconsVisible || $[38] !== loadingCounters) {
197
+ t8 = {
198
+ iconsVisible,
199
+ loadingCounters
200
+ };
201
+ $[37] = iconsVisible;
202
+ $[38] = loadingCounters;
203
+ $[39] = t8;
204
+ } else t8 = $[39];
205
+ const contextValue = t8;
98
206
  const iconsVisibleRef = useRef(iconsVisible);
99
- useIsomorphicLayoutEffect(() => {
100
- iconsVisibleRef.current = iconsVisible;
101
- }, [iconsVisible]);
207
+ let t10;
208
+ let t9;
209
+ if ($[40] !== iconsVisible) {
210
+ t9 = () => {
211
+ iconsVisibleRef.current = iconsVisible;
212
+ };
213
+ t10 = [iconsVisible];
214
+ $[40] = iconsVisible;
215
+ $[41] = t10;
216
+ $[42] = t9;
217
+ } else {
218
+ t10 = $[41];
219
+ t9 = $[42];
220
+ }
221
+ useIsomorphicLayoutEffect(t9, t10);
102
222
  const listWidthRef = useRef(0);
103
- useResizeObserver((entries) => {
104
- if (!tabsHaveIcons) return;
105
- if (!iconsVisibleRef.current) return;
106
- listWidthRef.current = entries[0].contentRect.width;
107
- }, listRef, []);
108
- useResizeObserver((resizeObserverEntries) => {
109
- if (!tabsHaveIcons) return;
110
- const wrapperWidth = resizeObserverEntries[0].contentRect.width;
111
- setIconsVisible(wrapperWidth > listWidthRef.current);
112
- }, wrapperRef, []);
223
+ let t11;
224
+ if ($[43] !== tabsHaveIcons_0) {
225
+ t11 = (entries) => {
226
+ if (!tabsHaveIcons_0) return;
227
+ if (!iconsVisibleRef.current) return;
228
+ listWidthRef.current = entries[0].contentRect.width;
229
+ };
230
+ $[43] = tabsHaveIcons_0;
231
+ $[44] = t11;
232
+ } else t11 = $[44];
233
+ let t12;
234
+ if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
235
+ t12 = [];
236
+ $[45] = t12;
237
+ } else t12 = $[45];
238
+ useResizeObserver(t11, listRef, t12);
239
+ let t13;
240
+ if ($[46] !== tabsHaveIcons_0) {
241
+ t13 = (resizeObserverEntries) => {
242
+ if (!tabsHaveIcons_0) return;
243
+ const wrapperWidth = resizeObserverEntries[0].contentRect.width;
244
+ setIconsVisible(wrapperWidth > listWidthRef.current);
245
+ };
246
+ $[46] = tabsHaveIcons_0;
247
+ $[47] = t13;
248
+ } else t13 = $[47];
249
+ let t14;
250
+ if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
251
+ t14 = [];
252
+ $[48] = t14;
253
+ } else t14 = $[48];
254
+ useResizeObserver(t13, wrapperRef, t14);
113
255
  {
114
- const selectedTabs = tabs.filter((tab) => {
115
- const ariaSelected = /*#__PURE__*/ React.isValidElement(tab) && tab.props["aria-selected"];
116
- return ariaSelected === true || ariaSelected === "true";
117
- });
256
+ const selectedTabs = tabs_0.filter(_temp2);
118
257
  !(selectedTabs.length <= 1) && invariant(false, "Only one tab can be selected at a time.");
119
- tabs.length !== tabPanels.length && invariant(false, `The number of tabs and panels must be equal. Counted ${tabs.length} tabs and ${tabPanels.length} panels.`);
120
- const duplicateTabValue = tabValues.find((value, index) => tabValues.indexOf(value) !== index);
258
+ tabs_0.length !== tabPanels_0.length && invariant(false, `The number of tabs and panels must be equal. Counted ${tabs_0.length} tabs and ${tabPanels_0.length} panels.`);
259
+ const duplicateTabValue = tabValues_0.find((value_4, index) => tabValues_0.indexOf(value_4) !== index);
121
260
  duplicateTabValue !== void 0 && invariant(false, `Every tab must have a unique \`value\`. Found duplicate "${duplicateTabValue}".`);
122
- const duplicatePanelValue = panelValues.find((value, index) => panelValues.indexOf(value) !== index);
261
+ const duplicatePanelValue = panelValues_0.find((value_5, index_0) => panelValues_0.indexOf(value_5) !== index_0);
123
262
  duplicatePanelValue !== void 0 && invariant(false, `Every panel must have a unique \`value\`. Found duplicate "${duplicatePanelValue}".`);
124
- const unmatchedTabValue = tabValues.find((value) => !panelValues.includes(value));
263
+ const unmatchedTabValue = tabValues_0.find((value_6) => !panelValues_0.includes(value_6));
125
264
  unmatchedTabValue !== void 0 && invariant(false, `Tab with \`value\` "${unmatchedTabValue}" has no matching panel. Give a \`UnderlinePanels.Panel\` the same \`value\`.`);
126
265
  warning(isControlled && selectedTabs.length > 0, "UnderlinePanels: do not combine the controlled `value` prop with `aria-selected` on a tab. `value` takes precedence; use `value`/`onChange` (or `defaultValue`) to drive selection.");
127
266
  warning(controlledValue !== void 0 && defaultValue !== void 0, "UnderlinePanels: do not combine the controlled `value` prop with `defaultValue`. `value` takes precedence; use one or the other.");
128
267
  const providedValue = controlledValue !== null && controlledValue !== void 0 ? controlledValue : defaultValue;
129
- warning(providedValue !== void 0 && tabValues.length > 0 && !tabValues.includes(providedValue), `UnderlinePanels: the selected value "${providedValue}" does not match any tab, so the first tab is selected instead. Provide a \`value\`/\`defaultValue\` that matches a \`UnderlinePanels.Tab\` \`value\`.`);
268
+ warning(providedValue !== void 0 && tabValues_0.length > 0 && !tabValues_0.includes(providedValue), `UnderlinePanels: the selected value "${providedValue}" does not match any tab, so the first tab is selected instead. Provide a \`value\`/\`defaultValue\` that matches a \`UnderlinePanels.Tab\` \`value\`.`);
130
269
  }
131
- return /* @__PURE__ */ jsx(UnderlinePanelsContext.Provider, {
132
- value: contextValue,
133
- children: /* @__PURE__ */ jsxs(Tabs, {
270
+ let t15;
271
+ if ($[49] !== handleValueChange) {
272
+ t15 = (t16) => {
273
+ const { value: value_7 } = t16;
274
+ return handleValueChange(value_7);
275
+ };
276
+ $[49] = handleValueChange;
277
+ $[50] = t15;
278
+ } else t15 = $[50];
279
+ let t16;
280
+ if ($[51] !== className) {
281
+ t16 = clsx(className, UnderlinePanels_module_css_default.StyledUnderlineWrapper);
282
+ $[51] = className;
283
+ $[52] = t16;
284
+ } else t16 = $[52];
285
+ const t17 = tabListProps["aria-label"];
286
+ const t18 = tabListProps["aria-labelledby"];
287
+ const t19 = tabListProps["aria-orientation"];
288
+ let t20;
289
+ if ($[53] !== t17 || $[54] !== t18 || $[55] !== t19 || $[56] !== tabListProps.onKeyDown || $[57] !== tabListProps.role || $[58] !== tabs_0) {
290
+ t20 = /* @__PURE__ */ jsx(UnderlineItemList, {
291
+ ref: listRef,
292
+ role: tabListProps.role,
293
+ "aria-label": t17,
294
+ "aria-labelledby": t18,
295
+ "aria-orientation": t19,
296
+ onKeyDown: tabListProps.onKeyDown,
297
+ children: tabs_0
298
+ });
299
+ $[53] = t17;
300
+ $[54] = t18;
301
+ $[55] = t19;
302
+ $[56] = tabListProps.onKeyDown;
303
+ $[57] = tabListProps.role;
304
+ $[58] = tabs_0;
305
+ $[59] = t20;
306
+ } else t20 = $[59];
307
+ let t21;
308
+ if ($[60] !== iconsVisible || $[61] !== props || $[62] !== t16 || $[63] !== t20) {
309
+ t21 = /* @__PURE__ */ jsx(UnderlineWrapper, {
310
+ ref: wrapperRef,
311
+ "data-icons-visible": iconsVisible,
312
+ className: t16,
313
+ ...props,
314
+ children: t20
315
+ });
316
+ $[60] = iconsVisible;
317
+ $[61] = props;
318
+ $[62] = t16;
319
+ $[63] = t20;
320
+ $[64] = t21;
321
+ } else t21 = $[64];
322
+ let t22;
323
+ if ($[65] !== activationMode || $[66] !== effectiveValue || $[67] !== parentId || $[68] !== t15 || $[69] !== t21 || $[70] !== tabPanels_0) {
324
+ t22 = /* @__PURE__ */ jsxs(Tabs, {
134
325
  id: parentId,
135
326
  value: effectiveValue,
136
327
  activationMode,
137
- onValueChange: ({ value }) => handleValueChange(value),
138
- children: [/* @__PURE__ */ jsx(UnderlineWrapper, {
139
- ref: wrapperRef,
140
- "data-icons-visible": iconsVisible,
141
- className: clsx(className, UnderlinePanels_module_css_default.StyledUnderlineWrapper),
142
- ...props,
143
- children: /* @__PURE__ */ jsx(UnderlineItemList, {
144
- ref: listRef,
145
- role: tabListProps.role,
146
- "aria-label": tabListProps["aria-label"],
147
- "aria-labelledby": tabListProps["aria-labelledby"],
148
- "aria-orientation": tabListProps["aria-orientation"],
149
- onKeyDown: tabListProps.onKeyDown,
150
- children: tabs
151
- })
152
- }), tabPanels]
153
- })
154
- });
328
+ onValueChange: t15,
329
+ children: [t21, tabPanels_0]
330
+ });
331
+ $[65] = activationMode;
332
+ $[66] = effectiveValue;
333
+ $[67] = parentId;
334
+ $[68] = t15;
335
+ $[69] = t21;
336
+ $[70] = tabPanels_0;
337
+ $[71] = t22;
338
+ } else t22 = $[71];
339
+ let t23;
340
+ if ($[72] !== contextValue || $[73] !== t22) {
341
+ t23 = /* @__PURE__ */ jsx(UnderlinePanelsContext.Provider, {
342
+ value: contextValue,
343
+ children: t22
344
+ });
345
+ $[72] = contextValue;
346
+ $[73] = t22;
347
+ $[74] = t23;
348
+ } else t23 = $[74];
349
+ return t23;
155
350
  };
156
- const TabImpl = ({ onSelect, value, ...itemProps }) => {
351
+ const TabImpl = (t0) => {
352
+ const $ = c(24);
353
+ let itemProps;
354
+ let onSelect;
355
+ let value;
356
+ if ($[0] !== t0) {
357
+ ({onSelect, value, ...itemProps} = t0);
358
+ $[0] = t0;
359
+ $[1] = itemProps;
360
+ $[2] = onSelect;
361
+ $[3] = value;
362
+ } else {
363
+ itemProps = $[1];
364
+ onSelect = $[2];
365
+ value = $[3];
366
+ }
157
367
  const { loadingCounters } = useContext(UnderlinePanelsContext);
158
- const { tabProps } = useTab({ value: value !== null && value !== void 0 ? value : "" });
159
- const { onKeyDown: tabOnKeyDown, onMouseDown: tabOnMouseDown, onFocus: tabOnFocus, ...restTabProps } = tabProps;
160
- return /* @__PURE__ */ jsx(UnderlineItem, {
161
- as: "button",
162
- ...itemProps,
163
- ...restTabProps,
164
- type: "button",
165
- onClick: (event) => {
368
+ const t1 = value !== null && value !== void 0 ? value : "";
369
+ let t2;
370
+ if ($[4] !== t1) {
371
+ t2 = { value: t1 };
372
+ $[4] = t1;
373
+ $[5] = t2;
374
+ } else t2 = $[5];
375
+ const { tabProps } = useTab(t2);
376
+ let restTabProps;
377
+ let tabOnFocus;
378
+ let tabOnKeyDown;
379
+ let tabOnMouseDown;
380
+ if ($[6] !== tabProps) {
381
+ ({onKeyDown: tabOnKeyDown, onMouseDown: tabOnMouseDown, onFocus: tabOnFocus, ...restTabProps} = tabProps);
382
+ $[6] = tabProps;
383
+ $[7] = restTabProps;
384
+ $[8] = tabOnFocus;
385
+ $[9] = tabOnKeyDown;
386
+ $[10] = tabOnMouseDown;
387
+ } else {
388
+ restTabProps = $[7];
389
+ tabOnFocus = $[8];
390
+ tabOnKeyDown = $[9];
391
+ tabOnMouseDown = $[10];
392
+ }
393
+ let t3;
394
+ if ($[11] !== onSelect) {
395
+ t3 = (event) => {
166
396
  if (!event.defaultPrevented && typeof onSelect === "function") onSelect(event);
167
- },
168
- onKeyDown: (event) => {
169
- tabOnKeyDown === null || tabOnKeyDown === void 0 || tabOnKeyDown(event);
170
- if ((event.key === " " || event.key === "Enter") && !event.defaultPrevented && typeof onSelect === "function") onSelect(event);
171
- },
172
- onMouseDown: tabOnMouseDown,
173
- onFocus: tabOnFocus,
174
- loadingCounters
175
- });
397
+ };
398
+ $[11] = onSelect;
399
+ $[12] = t3;
400
+ } else t3 = $[12];
401
+ let t4;
402
+ if ($[13] !== onSelect || $[14] !== tabOnKeyDown) {
403
+ t4 = (event_0) => {
404
+ var _tabOnKeyDown;
405
+ (_tabOnKeyDown = tabOnKeyDown) === null || _tabOnKeyDown === void 0 || _tabOnKeyDown(event_0);
406
+ if ((event_0.key === " " || event_0.key === "Enter") && !event_0.defaultPrevented && typeof onSelect === "function") onSelect(event_0);
407
+ };
408
+ $[13] = onSelect;
409
+ $[14] = tabOnKeyDown;
410
+ $[15] = t4;
411
+ } else t4 = $[15];
412
+ let t5;
413
+ if ($[16] !== itemProps || $[17] !== loadingCounters || $[18] !== restTabProps || $[19] !== t3 || $[20] !== t4 || $[21] !== tabOnFocus || $[22] !== tabOnMouseDown) {
414
+ t5 = /* @__PURE__ */ jsx(UnderlineItem, {
415
+ as: "button",
416
+ ...itemProps,
417
+ ...restTabProps,
418
+ type: "button",
419
+ onClick: t3,
420
+ onKeyDown: t4,
421
+ onMouseDown: tabOnMouseDown,
422
+ onFocus: tabOnFocus,
423
+ loadingCounters
424
+ });
425
+ $[16] = itemProps;
426
+ $[17] = loadingCounters;
427
+ $[18] = restTabProps;
428
+ $[19] = t3;
429
+ $[20] = t4;
430
+ $[21] = tabOnFocus;
431
+ $[22] = tabOnMouseDown;
432
+ $[23] = t5;
433
+ } else t5 = $[23];
434
+ return t5;
176
435
  };
177
436
  TabImpl.displayName = "UnderlinePanels.Tab";
178
437
  const Tab = /*#__PURE__*/ React.memo(TabImpl);
179
438
  Tab.displayName = "UnderlinePanels.Tab";
180
- const PanelImpl = ({ children, value, ...panelRest }) => {
181
- const { tabPanelProps } = useTabPanel({ value: value !== null && value !== void 0 ? value : "" });
182
- return /* @__PURE__ */ jsx("div", {
183
- ...panelRest,
184
- ...tabPanelProps,
185
- children
186
- });
439
+ const PanelImpl = (t0) => {
440
+ const $ = c(10);
441
+ let children;
442
+ let panelRest;
443
+ let value;
444
+ if ($[0] !== t0) {
445
+ ({children, value, ...panelRest} = t0);
446
+ $[0] = t0;
447
+ $[1] = children;
448
+ $[2] = panelRest;
449
+ $[3] = value;
450
+ } else {
451
+ children = $[1];
452
+ panelRest = $[2];
453
+ value = $[3];
454
+ }
455
+ const t1 = value !== null && value !== void 0 ? value : "";
456
+ let t2;
457
+ if ($[4] !== t1) {
458
+ t2 = { value: t1 };
459
+ $[4] = t1;
460
+ $[5] = t2;
461
+ } else t2 = $[5];
462
+ const { tabPanelProps } = useTabPanel(t2);
463
+ let t3;
464
+ if ($[6] !== children || $[7] !== panelRest || $[8] !== tabPanelProps) {
465
+ t3 = /* @__PURE__ */ jsx("div", {
466
+ ...panelRest,
467
+ ...tabPanelProps,
468
+ children
469
+ });
470
+ $[6] = children;
471
+ $[7] = panelRest;
472
+ $[8] = tabPanelProps;
473
+ $[9] = t3;
474
+ } else t3 = $[9];
475
+ return t3;
187
476
  };
188
477
  PanelImpl.displayName = "UnderlinePanels.Panel";
189
478
  const Panel = PanelImpl;
@@ -194,5 +483,12 @@ var UnderlinePanels_default = Object.assign(UnderlinePanels, {
194
483
  });
195
484
  Tab.__SLOT__ = Symbol("UnderlinePanels.Tab");
196
485
  Panel.__SLOT__ = Symbol("UnderlinePanels.Panel");
486
+ function _temp(tab) {
487
+ return /*#__PURE__*/ React.isValidElement(tab) && tab.props.icon;
488
+ }
489
+ function _temp2(tab_0) {
490
+ const ariaSelected_0 = /*#__PURE__*/ React.isValidElement(tab_0) && tab_0.props["aria-selected"];
491
+ return ariaSelected_0 === true || ariaSelected_0 === "true";
492
+ }
197
493
  //#endregion
198
494
  export { UnderlinePanels_default as default };