@doist/reactist 33.2.0 → 33.2.2
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/CHANGELOG.md +12 -0
- package/dist/reactist.cjs.development.js +364 -142
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/tabs/tabs.js +354 -125
- package/es/tabs/tabs.js.map +1 -1
- package/es/tooltip/tooltip.js +1 -12
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/utils/common-helpers.js +11 -6
- package/es/utils/common-helpers.js.map +1 -1
- package/lib/tabs/tabs.js +353 -124
- package/lib/tabs/tabs.js.map +1 -1
- package/lib/tooltip/tooltip.js +1 -12
- package/lib/tooltip/tooltip.js.map +1 -1
- package/lib/utils/common-helpers.js +11 -6
- package/lib/utils/common-helpers.js.map +1 -1
- package/package.json +1 -1
package/es/tabs/tabs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
2
|
import { c } from 'react-compiler-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { useTabStore, TabList as TabList$1, TabPanel as TabPanel$1, Tab as Tab$1 } from '@ariakit/react';
|
|
4
|
+
import { useTabStore, useStoreState, TabList as TabList$1, TabPanel as TabPanel$1, Tab as Tab$1 } from '@ariakit/react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import modules_40c67f5b from './tabs.module.css.js';
|
|
7
7
|
import { Box } from '../box/box.js';
|
|
@@ -11,27 +11,60 @@ const TabsContext = /*#__PURE__*/React.createContext(null);
|
|
|
11
11
|
/**
|
|
12
12
|
* Used to group components that compose a set of tabs. There can only be one active tab within the same `<Tabs>` group.
|
|
13
13
|
*/
|
|
14
|
-
function Tabs({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
variant = 'neutral',
|
|
19
|
-
onSelectedIdChange
|
|
20
|
-
}) {
|
|
21
|
-
const tabStore = useTabStore({
|
|
22
|
-
defaultSelectedId,
|
|
14
|
+
function Tabs(t0) {
|
|
15
|
+
const $ = c(11);
|
|
16
|
+
const {
|
|
17
|
+
children,
|
|
23
18
|
selectedId,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
defaultSelectedId,
|
|
20
|
+
variant: t1,
|
|
21
|
+
onSelectedIdChange
|
|
22
|
+
} = t0;
|
|
23
|
+
const variant = t1 === undefined ? "neutral" : t1;
|
|
24
|
+
let t2;
|
|
25
|
+
if ($[0] !== defaultSelectedId || $[1] !== onSelectedIdChange || $[2] !== selectedId) {
|
|
26
|
+
t2 = {
|
|
27
|
+
defaultSelectedId,
|
|
28
|
+
selectedId,
|
|
29
|
+
setSelectedId: onSelectedIdChange
|
|
30
|
+
};
|
|
31
|
+
$[0] = defaultSelectedId;
|
|
32
|
+
$[1] = onSelectedIdChange;
|
|
33
|
+
$[2] = selectedId;
|
|
34
|
+
$[3] = t2;
|
|
35
|
+
} else {
|
|
36
|
+
t2 = $[3];
|
|
37
|
+
}
|
|
38
|
+
const tabStore = useTabStore(t2);
|
|
39
|
+
const actualSelectedId = useStoreState(tabStore, "selectedId");
|
|
40
|
+
const t3 = selectedId ?? actualSelectedId ?? null;
|
|
41
|
+
let t4;
|
|
42
|
+
if ($[4] !== t3 || $[5] !== tabStore || $[6] !== variant) {
|
|
43
|
+
t4 = {
|
|
44
|
+
tabStore,
|
|
45
|
+
variant,
|
|
46
|
+
selectedId: t3
|
|
47
|
+
};
|
|
48
|
+
$[4] = t3;
|
|
49
|
+
$[5] = tabStore;
|
|
50
|
+
$[6] = variant;
|
|
51
|
+
$[7] = t4;
|
|
52
|
+
} else {
|
|
53
|
+
t4 = $[7];
|
|
54
|
+
}
|
|
55
|
+
const memoizedTabState = t4;
|
|
56
|
+
let t5;
|
|
57
|
+
if ($[8] !== children || $[9] !== memoizedTabState) {
|
|
58
|
+
t5 = /*#__PURE__*/React.createElement(TabsContext.Provider, {
|
|
59
|
+
value: memoizedTabState
|
|
60
|
+
}, children);
|
|
61
|
+
$[8] = children;
|
|
62
|
+
$[9] = memoizedTabState;
|
|
63
|
+
$[10] = t5;
|
|
64
|
+
} else {
|
|
65
|
+
t5 = $[10];
|
|
66
|
+
}
|
|
67
|
+
return t5;
|
|
35
68
|
}
|
|
36
69
|
/**
|
|
37
70
|
* Represents the individual tab elements within the group. Each `<Tab>` must have a corresponding `<TabPanel>` component.
|
|
@@ -93,64 +126,133 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(t0, ref) {
|
|
|
93
126
|
/**
|
|
94
127
|
* A component used to group `<Tab>` elements together.
|
|
95
128
|
*/
|
|
96
|
-
function TabList({
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
129
|
+
function TabList(t0) {
|
|
130
|
+
const $ = c(44);
|
|
131
|
+
let children;
|
|
132
|
+
let exceptionallySetClassName;
|
|
133
|
+
let props;
|
|
134
|
+
let space;
|
|
135
|
+
let t1;
|
|
136
|
+
let t2;
|
|
137
|
+
if ($[0] !== t0) {
|
|
138
|
+
({
|
|
139
|
+
children,
|
|
140
|
+
space,
|
|
141
|
+
width: t1,
|
|
142
|
+
align: t2,
|
|
143
|
+
exceptionallySetClassName,
|
|
144
|
+
...props
|
|
145
|
+
} = t0);
|
|
146
|
+
$[0] = t0;
|
|
147
|
+
$[1] = children;
|
|
148
|
+
$[2] = exceptionallySetClassName;
|
|
149
|
+
$[3] = props;
|
|
150
|
+
$[4] = space;
|
|
151
|
+
$[5] = t1;
|
|
152
|
+
$[6] = t2;
|
|
153
|
+
} else {
|
|
154
|
+
children = $[1];
|
|
155
|
+
exceptionallySetClassName = $[2];
|
|
156
|
+
props = $[3];
|
|
157
|
+
space = $[4];
|
|
158
|
+
t1 = $[5];
|
|
159
|
+
t2 = $[6];
|
|
160
|
+
}
|
|
161
|
+
const width = t1 === undefined ? "maxContent" : t1;
|
|
162
|
+
const align = t2 === undefined ? "start" : t2;
|
|
104
163
|
const tabListRef = React.useRef(null);
|
|
105
164
|
const tabListPrevWidthRef = React.useRef(0);
|
|
106
165
|
const tabContextValue = React.useContext(TabsContext);
|
|
107
166
|
const [selectedTabElement, setSelectedTabElement] = React.useState(null);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let animationFrameId = null;
|
|
131
|
-
const tabListObserver = new ResizeObserver(([entry]) => {
|
|
132
|
-
const width_0 = entry?.contentRect.width;
|
|
133
|
-
if (width_0 && tabListPrevWidthRef.current !== width_0) {
|
|
134
|
-
tabListPrevWidthRef.current = width_0;
|
|
135
|
-
if (animationFrameId !== null) {
|
|
136
|
-
cancelAnimationFrame(animationFrameId);
|
|
137
|
-
}
|
|
138
|
-
animationFrameId = requestAnimationFrame(() => {
|
|
139
|
-
updateSelectedTabPosition();
|
|
140
|
-
animationFrameId = null;
|
|
167
|
+
let t3;
|
|
168
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
169
|
+
t3 = {};
|
|
170
|
+
$[7] = t3;
|
|
171
|
+
} else {
|
|
172
|
+
t3 = $[7];
|
|
173
|
+
}
|
|
174
|
+
const [selectedTabStyle, setSelectedTabStyle] = React.useState(t3);
|
|
175
|
+
const selectedId = useStoreState(tabContextValue?.tabStore, "selectedId");
|
|
176
|
+
let t4;
|
|
177
|
+
if ($[8] !== selectedId) {
|
|
178
|
+
t4 = function updateSelectedTabPositionCallback() {
|
|
179
|
+
if (!selectedId || !tabListRef.current) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const tabs = tabListRef.current.querySelectorAll("[role=\"tab\"]");
|
|
183
|
+
const selectedTab = Array.from(tabs).find(tab => tab.getAttribute("id") === selectedId);
|
|
184
|
+
if (selectedTab) {
|
|
185
|
+
setSelectedTabElement(selectedTab);
|
|
186
|
+
setSelectedTabStyle({
|
|
187
|
+
left: `${selectedTab.offsetLeft}px`,
|
|
188
|
+
width: `${selectedTab.offsetWidth}px`
|
|
141
189
|
});
|
|
142
190
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
191
|
+
};
|
|
192
|
+
$[8] = selectedId;
|
|
193
|
+
$[9] = t4;
|
|
194
|
+
} else {
|
|
195
|
+
t4 = $[9];
|
|
196
|
+
}
|
|
197
|
+
const updateSelectedTabPosition = t4;
|
|
198
|
+
let t5;
|
|
199
|
+
if ($[10] !== updateSelectedTabPosition) {
|
|
200
|
+
t5 = function updateSelectedTabPositionOnTabChange() {
|
|
201
|
+
updateSelectedTabPosition();
|
|
202
|
+
};
|
|
203
|
+
$[10] = updateSelectedTabPosition;
|
|
204
|
+
$[11] = t5;
|
|
205
|
+
} else {
|
|
206
|
+
t5 = $[11];
|
|
207
|
+
}
|
|
208
|
+
let t6;
|
|
209
|
+
if ($[12] !== selectedId || $[13] !== updateSelectedTabPosition) {
|
|
210
|
+
t6 = [selectedId, updateSelectedTabPosition];
|
|
211
|
+
$[12] = selectedId;
|
|
212
|
+
$[13] = updateSelectedTabPosition;
|
|
213
|
+
$[14] = t6;
|
|
214
|
+
} else {
|
|
215
|
+
t6 = $[14];
|
|
216
|
+
}
|
|
217
|
+
React.useEffect(t5, t6);
|
|
218
|
+
let t7;
|
|
219
|
+
let t8;
|
|
220
|
+
if ($[15] !== updateSelectedTabPosition) {
|
|
221
|
+
t7 = function observeTabListWidthChange() {
|
|
222
|
+
let animationFrameId = null;
|
|
223
|
+
const tabListObserver = new ResizeObserver(t9 => {
|
|
224
|
+
const [entry] = t9;
|
|
225
|
+
const width_0 = entry?.contentRect.width;
|
|
226
|
+
if (width_0 && tabListPrevWidthRef.current !== width_0) {
|
|
227
|
+
tabListPrevWidthRef.current = width_0;
|
|
228
|
+
if (animationFrameId !== null) {
|
|
229
|
+
cancelAnimationFrame(animationFrameId);
|
|
230
|
+
}
|
|
231
|
+
animationFrameId = requestAnimationFrame(() => {
|
|
232
|
+
updateSelectedTabPosition();
|
|
233
|
+
animationFrameId = null;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
if (tabListRef.current) {
|
|
238
|
+
tabListObserver.observe(tabListRef.current);
|
|
150
239
|
}
|
|
151
|
-
|
|
240
|
+
return function cleanupResizeObserver() {
|
|
241
|
+
if (animationFrameId) {
|
|
242
|
+
cancelAnimationFrame(animationFrameId);
|
|
243
|
+
}
|
|
244
|
+
tabListObserver.disconnect();
|
|
245
|
+
};
|
|
152
246
|
};
|
|
153
|
-
|
|
247
|
+
t8 = [updateSelectedTabPosition];
|
|
248
|
+
$[15] = updateSelectedTabPosition;
|
|
249
|
+
$[16] = t7;
|
|
250
|
+
$[17] = t8;
|
|
251
|
+
} else {
|
|
252
|
+
t7 = $[16];
|
|
253
|
+
t8 = $[17];
|
|
254
|
+
}
|
|
255
|
+
React.useEffect(t7, t8);
|
|
154
256
|
if (!tabContextValue) {
|
|
155
257
|
return null;
|
|
156
258
|
}
|
|
@@ -158,83 +260,210 @@ function TabList({
|
|
|
158
260
|
tabStore,
|
|
159
261
|
variant
|
|
160
262
|
} = tabContextValue;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
263
|
+
let t9;
|
|
264
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
265
|
+
t9 = {
|
|
266
|
+
start: "flexStart",
|
|
267
|
+
end: "flexEnd",
|
|
268
|
+
center: "center"
|
|
269
|
+
};
|
|
270
|
+
$[18] = t9;
|
|
271
|
+
} else {
|
|
272
|
+
t9 = $[18];
|
|
273
|
+
}
|
|
274
|
+
const justifyContentAlignMap = t9;
|
|
275
|
+
const t10 = width === "full" ? "center" : justifyContentAlignMap[align];
|
|
276
|
+
let t11;
|
|
277
|
+
if ($[19] !== exceptionallySetClassName || $[20] !== width) {
|
|
278
|
+
t11 = /*#__PURE__*/React.createElement(Box, {
|
|
279
|
+
position: "relative",
|
|
280
|
+
width: width,
|
|
281
|
+
className: exceptionallySetClassName
|
|
282
|
+
});
|
|
283
|
+
$[19] = exceptionallySetClassName;
|
|
284
|
+
$[20] = width;
|
|
285
|
+
$[21] = t11;
|
|
286
|
+
} else {
|
|
287
|
+
t11 = $[21];
|
|
288
|
+
}
|
|
289
|
+
const t12 = modules_40c67f5b[`track-${variant}`];
|
|
290
|
+
let t13;
|
|
291
|
+
if ($[22] !== t12) {
|
|
292
|
+
t13 = /*#__PURE__*/React.createElement(Box, {
|
|
293
|
+
className: [modules_40c67f5b.track, t12]
|
|
294
|
+
});
|
|
295
|
+
$[22] = t12;
|
|
296
|
+
$[23] = t13;
|
|
297
|
+
} else {
|
|
298
|
+
t13 = $[23];
|
|
299
|
+
}
|
|
300
|
+
let t14;
|
|
301
|
+
if ($[24] !== selectedTabElement || $[25] !== selectedTabStyle || $[26] !== variant) {
|
|
302
|
+
t14 = selectedTabElement ? /*#__PURE__*/React.createElement(Box, {
|
|
185
303
|
className: [modules_40c67f5b.selected, modules_40c67f5b[`selected-${variant}`]],
|
|
186
304
|
style: selectedTabStyle
|
|
187
|
-
}) : null
|
|
305
|
+
}) : null;
|
|
306
|
+
$[24] = selectedTabElement;
|
|
307
|
+
$[25] = selectedTabStyle;
|
|
308
|
+
$[26] = variant;
|
|
309
|
+
$[27] = t14;
|
|
310
|
+
} else {
|
|
311
|
+
t14 = $[27];
|
|
312
|
+
}
|
|
313
|
+
const t15 = width === "full" ? modules_40c67f5b.fullTabList : null;
|
|
314
|
+
let t16;
|
|
315
|
+
if ($[28] !== t15) {
|
|
316
|
+
t16 = classNames(t15);
|
|
317
|
+
$[28] = t15;
|
|
318
|
+
$[29] = t16;
|
|
319
|
+
} else {
|
|
320
|
+
t16 = $[29];
|
|
321
|
+
}
|
|
322
|
+
let t17;
|
|
323
|
+
if ($[30] !== children || $[31] !== space || $[32] !== t16) {
|
|
324
|
+
t17 = /*#__PURE__*/React.createElement(Inline, {
|
|
188
325
|
space: space,
|
|
189
|
-
exceptionallySetClassName:
|
|
190
|
-
}, children)
|
|
191
|
-
|
|
326
|
+
exceptionallySetClassName: t16
|
|
327
|
+
}, children);
|
|
328
|
+
$[30] = children;
|
|
329
|
+
$[31] = space;
|
|
330
|
+
$[32] = t16;
|
|
331
|
+
$[33] = t17;
|
|
332
|
+
} else {
|
|
333
|
+
t17 = $[33];
|
|
334
|
+
}
|
|
335
|
+
let t18;
|
|
336
|
+
if ($[34] !== props || $[35] !== t11 || $[36] !== t13 || $[37] !== t14 || $[38] !== t17 || $[39] !== tabStore) {
|
|
337
|
+
t18 = /*#__PURE__*/React.createElement(TabList$1, _extends({
|
|
338
|
+
store: tabStore,
|
|
339
|
+
render: t11,
|
|
340
|
+
ref: tabListRef
|
|
341
|
+
}, props), t13, t14, t17);
|
|
342
|
+
$[34] = props;
|
|
343
|
+
$[35] = t11;
|
|
344
|
+
$[36] = t13;
|
|
345
|
+
$[37] = t14;
|
|
346
|
+
$[38] = t17;
|
|
347
|
+
$[39] = tabStore;
|
|
348
|
+
$[40] = t18;
|
|
349
|
+
} else {
|
|
350
|
+
t18 = $[40];
|
|
351
|
+
}
|
|
352
|
+
let t19;
|
|
353
|
+
if ($[41] !== t10 || $[42] !== t18) {
|
|
354
|
+
t19 = /*#__PURE__*/React.createElement(Box, {
|
|
355
|
+
display: "flex",
|
|
356
|
+
justifyContent: t10
|
|
357
|
+
}, t18);
|
|
358
|
+
$[41] = t10;
|
|
359
|
+
$[42] = t18;
|
|
360
|
+
$[43] = t19;
|
|
361
|
+
} else {
|
|
362
|
+
t19 = $[43];
|
|
363
|
+
}
|
|
364
|
+
return t19;
|
|
192
365
|
}
|
|
193
366
|
/**
|
|
194
367
|
* Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a
|
|
195
368
|
* corresponding `<Tab>` component.
|
|
196
369
|
*/
|
|
197
|
-
const TabPanel = /*#__PURE__*/React.forwardRef(function TabPanel({
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
370
|
+
const TabPanel = /*#__PURE__*/React.forwardRef(function TabPanel(t0, ref) {
|
|
371
|
+
const $ = c(16);
|
|
372
|
+
let children;
|
|
373
|
+
let id;
|
|
374
|
+
let props;
|
|
375
|
+
let t1;
|
|
376
|
+
if ($[0] !== t0) {
|
|
377
|
+
({
|
|
378
|
+
children,
|
|
379
|
+
id,
|
|
380
|
+
renderMode: t1,
|
|
381
|
+
...props
|
|
382
|
+
} = t0);
|
|
383
|
+
$[0] = t0;
|
|
384
|
+
$[1] = children;
|
|
385
|
+
$[2] = id;
|
|
386
|
+
$[3] = props;
|
|
387
|
+
$[4] = t1;
|
|
388
|
+
} else {
|
|
389
|
+
children = $[1];
|
|
390
|
+
id = $[2];
|
|
391
|
+
props = $[3];
|
|
392
|
+
t1 = $[4];
|
|
393
|
+
}
|
|
394
|
+
const renderMode = t1 === undefined ? "always" : t1;
|
|
203
395
|
const tabContextValue = React.useContext(TabsContext);
|
|
204
396
|
const [tabRendered, setTabRendered] = React.useState(false);
|
|
205
|
-
const selectedId = tabContextValue?.tabStore
|
|
397
|
+
const selectedId = useStoreState(tabContextValue?.tabStore, "selectedId");
|
|
206
398
|
const tabIsActive = selectedId === id;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
399
|
+
let t2;
|
|
400
|
+
let t3;
|
|
401
|
+
if ($[5] !== tabIsActive || $[6] !== tabRendered) {
|
|
402
|
+
t2 = function trackTabRenderedState() {
|
|
403
|
+
if (!tabRendered && tabIsActive) {
|
|
404
|
+
setTabRendered(true);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
t3 = [tabRendered, tabIsActive];
|
|
408
|
+
$[5] = tabIsActive;
|
|
409
|
+
$[6] = tabRendered;
|
|
410
|
+
$[7] = t2;
|
|
411
|
+
$[8] = t3;
|
|
412
|
+
} else {
|
|
413
|
+
t2 = $[7];
|
|
414
|
+
t3 = $[8];
|
|
415
|
+
}
|
|
416
|
+
React.useEffect(t2, t3);
|
|
213
417
|
if (!tabContextValue) {
|
|
214
418
|
return null;
|
|
215
419
|
}
|
|
216
420
|
const {
|
|
217
421
|
tabStore
|
|
218
422
|
} = tabContextValue;
|
|
219
|
-
const shouldRender = renderMode ===
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
423
|
+
const shouldRender = renderMode === "always" || renderMode === "active" && tabIsActive || renderMode === "lazy" && (tabIsActive || tabRendered);
|
|
424
|
+
let t4;
|
|
425
|
+
if ($[9] !== children || $[10] !== id || $[11] !== props || $[12] !== ref || $[13] !== shouldRender || $[14] !== tabStore) {
|
|
426
|
+
t4 = shouldRender ? /*#__PURE__*/React.createElement(TabPanel$1, _extends({}, props, {
|
|
427
|
+
tabId: id,
|
|
428
|
+
store: tabStore,
|
|
429
|
+
ref: ref
|
|
430
|
+
}), children) : null;
|
|
431
|
+
$[9] = children;
|
|
432
|
+
$[10] = id;
|
|
433
|
+
$[11] = props;
|
|
434
|
+
$[12] = ref;
|
|
435
|
+
$[13] = shouldRender;
|
|
436
|
+
$[14] = tabStore;
|
|
437
|
+
$[15] = t4;
|
|
438
|
+
} else {
|
|
439
|
+
t4 = $[15];
|
|
440
|
+
}
|
|
441
|
+
return t4;
|
|
225
442
|
});
|
|
226
443
|
/**
|
|
227
444
|
* Allows content to be rendered based on the current tab being selected while outside of the
|
|
228
445
|
* TabPanel component. Can be placed freely within the main `<Tabs>` component.
|
|
229
446
|
*/
|
|
230
|
-
function TabAwareSlot({
|
|
231
|
-
|
|
232
|
-
|
|
447
|
+
function TabAwareSlot(t0) {
|
|
448
|
+
const $ = c(4);
|
|
449
|
+
const {
|
|
450
|
+
children
|
|
451
|
+
} = t0;
|
|
233
452
|
const tabContextValue = React.useContext(TabsContext);
|
|
234
|
-
const selectedId = tabContextValue?.tabStore
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
453
|
+
const selectedId = useStoreState(tabContextValue?.tabStore, "selectedId");
|
|
454
|
+
let t1;
|
|
455
|
+
if ($[0] !== children || $[1] !== selectedId || $[2] !== tabContextValue) {
|
|
456
|
+
t1 = tabContextValue ? children({
|
|
457
|
+
selectedId
|
|
458
|
+
}) : null;
|
|
459
|
+
$[0] = children;
|
|
460
|
+
$[1] = selectedId;
|
|
461
|
+
$[2] = tabContextValue;
|
|
462
|
+
$[3] = t1;
|
|
463
|
+
} else {
|
|
464
|
+
t1 = $[3];
|
|
465
|
+
}
|
|
466
|
+
return t1;
|
|
238
467
|
}
|
|
239
468
|
|
|
240
469
|
export { Tab, TabAwareSlot, TabList, TabPanel, Tabs };
|