@doist/reactist 33.2.0 → 33.2.1

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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## [33.2.1](https://github.com/Doist/reactist/compare/v33.2.0...v33.2.1) (2026-06-19)
2
+
3
+ ### Bug Fixes
4
+
5
+ - avoid ref access in useId ([#1078](https://github.com/Doist/reactist/issues/1078)) ([4d44edf](https://github.com/Doist/reactist/commit/4d44edfb09f436f37e81d28d7876a65a9e439ac0))
6
+
1
7
  ## [33.2.0](https://github.com/Doist/reactist/compare/v33.1.0...v33.2.0) (2026-06-19)
2
8
 
3
9
  ### Features
@@ -1338,13 +1338,17 @@ function generateElementId(prefix) {
1338
1338
  * @deprecated Use `useId` available from React 18 or above instead.
1339
1339
  */
1340
1340
  function useId(providedId) {
1341
- const ref = React__namespace.useRef(providedId ?? null);
1342
- // eslint-disable-next-line react-hooks/refs
1343
- if (!ref.current) {
1344
- ref.current = generateElementId('element');
1341
+ const $ = reactCompilerRuntime.c(2);
1342
+ let t0;
1343
+ if ($[0] !== providedId) {
1344
+ t0 = () => providedId || generateElementId("element");
1345
+ $[0] = providedId;
1346
+ $[1] = t0;
1347
+ } else {
1348
+ t0 = $[1];
1345
1349
  }
1346
- // eslint-disable-next-line react-hooks/refs
1347
- return ref.current;
1350
+ const [id] = React__namespace.useState(t0);
1351
+ return id;
1348
1352
  }
1349
1353
 
1350
1354
  var modules_afa80466 = {"banner":"a9238c10","image":"_74fb1d6c","title":"_7d720b64","description":"e20c1413","secondary":"a4ec529c","typeIcon":"f7f9b63d","iconCopy":"_22bc210c","closeButton":"_97060900","copy":"_32c8bd8c","inlineLink":"_0569f1dd","actions":"_154f8e60","topContent":"f76860a9","content":"cb9aeb0c"};
@@ -6049,27 +6053,60 @@ const TabsContext = /*#__PURE__*/React__namespace.createContext(null);
6049
6053
  /**
6050
6054
  * Used to group components that compose a set of tabs. There can only be one active tab within the same `<Tabs>` group.
6051
6055
  */
6052
- function Tabs({
6053
- children,
6054
- selectedId,
6055
- defaultSelectedId,
6056
- variant = 'neutral',
6057
- onSelectedIdChange
6058
- }) {
6059
- const tabStore = react.useTabStore({
6060
- defaultSelectedId,
6056
+ function Tabs(t0) {
6057
+ const $ = reactCompilerRuntime.c(11);
6058
+ const {
6059
+ children,
6061
6060
  selectedId,
6062
- setSelectedId: onSelectedIdChange
6063
- });
6064
- const actualSelectedId = tabStore.useState('selectedId');
6065
- const memoizedTabState = React__namespace.useMemo(() => ({
6066
- tabStore,
6067
- variant,
6068
- selectedId: selectedId ?? actualSelectedId ?? null
6069
- }), [variant, tabStore, selectedId, actualSelectedId]);
6070
- return /*#__PURE__*/React__namespace.createElement(TabsContext.Provider, {
6071
- value: memoizedTabState
6072
- }, children);
6061
+ defaultSelectedId,
6062
+ variant: t1,
6063
+ onSelectedIdChange
6064
+ } = t0;
6065
+ const variant = t1 === undefined ? "neutral" : t1;
6066
+ let t2;
6067
+ if ($[0] !== defaultSelectedId || $[1] !== onSelectedIdChange || $[2] !== selectedId) {
6068
+ t2 = {
6069
+ defaultSelectedId,
6070
+ selectedId,
6071
+ setSelectedId: onSelectedIdChange
6072
+ };
6073
+ $[0] = defaultSelectedId;
6074
+ $[1] = onSelectedIdChange;
6075
+ $[2] = selectedId;
6076
+ $[3] = t2;
6077
+ } else {
6078
+ t2 = $[3];
6079
+ }
6080
+ const tabStore = react.useTabStore(t2);
6081
+ const actualSelectedId = react.useStoreState(tabStore, "selectedId");
6082
+ const t3 = selectedId ?? actualSelectedId ?? null;
6083
+ let t4;
6084
+ if ($[4] !== t3 || $[5] !== tabStore || $[6] !== variant) {
6085
+ t4 = {
6086
+ tabStore,
6087
+ variant,
6088
+ selectedId: t3
6089
+ };
6090
+ $[4] = t3;
6091
+ $[5] = tabStore;
6092
+ $[6] = variant;
6093
+ $[7] = t4;
6094
+ } else {
6095
+ t4 = $[7];
6096
+ }
6097
+ const memoizedTabState = t4;
6098
+ let t5;
6099
+ if ($[8] !== children || $[9] !== memoizedTabState) {
6100
+ t5 = /*#__PURE__*/React__namespace.createElement(TabsContext.Provider, {
6101
+ value: memoizedTabState
6102
+ }, children);
6103
+ $[8] = children;
6104
+ $[9] = memoizedTabState;
6105
+ $[10] = t5;
6106
+ } else {
6107
+ t5 = $[10];
6108
+ }
6109
+ return t5;
6073
6110
  }
6074
6111
  /**
6075
6112
  * Represents the individual tab elements within the group. Each `<Tab>` must have a corresponding `<TabPanel>` component.
@@ -6131,64 +6168,133 @@ const Tab = /*#__PURE__*/React__namespace.forwardRef(function Tab(t0, ref) {
6131
6168
  /**
6132
6169
  * A component used to group `<Tab>` elements together.
6133
6170
  */
6134
- function TabList({
6135
- children,
6136
- space,
6137
- width = 'maxContent',
6138
- align = 'start',
6139
- exceptionallySetClassName,
6140
- ...props
6141
- }) {
6171
+ function TabList(t0) {
6172
+ const $ = reactCompilerRuntime.c(44);
6173
+ let children;
6174
+ let exceptionallySetClassName;
6175
+ let props;
6176
+ let space;
6177
+ let t1;
6178
+ let t2;
6179
+ if ($[0] !== t0) {
6180
+ ({
6181
+ children,
6182
+ space,
6183
+ width: t1,
6184
+ align: t2,
6185
+ exceptionallySetClassName,
6186
+ ...props
6187
+ } = t0);
6188
+ $[0] = t0;
6189
+ $[1] = children;
6190
+ $[2] = exceptionallySetClassName;
6191
+ $[3] = props;
6192
+ $[4] = space;
6193
+ $[5] = t1;
6194
+ $[6] = t2;
6195
+ } else {
6196
+ children = $[1];
6197
+ exceptionallySetClassName = $[2];
6198
+ props = $[3];
6199
+ space = $[4];
6200
+ t1 = $[5];
6201
+ t2 = $[6];
6202
+ }
6203
+ const width = t1 === undefined ? "maxContent" : t1;
6204
+ const align = t2 === undefined ? "start" : t2;
6142
6205
  const tabListRef = React__namespace.useRef(null);
6143
6206
  const tabListPrevWidthRef = React__namespace.useRef(0);
6144
6207
  const tabContextValue = React__namespace.useContext(TabsContext);
6145
6208
  const [selectedTabElement, setSelectedTabElement] = React__namespace.useState(null);
6146
- const [selectedTabStyle, setSelectedTabStyle] = React__namespace.useState({});
6147
- const selectedId = tabContextValue?.tabStore.useState('selectedId');
6148
- const updateSelectedTabPosition = React__namespace.useCallback(function updateSelectedTabPositionCallback() {
6149
- if (!selectedId || !tabListRef.current) {
6150
- return;
6151
- }
6152
- const tabs = tabListRef.current.querySelectorAll('[role="tab"]');
6153
- const selectedTab = Array.from(tabs).find(tab => tab.getAttribute('id') === selectedId);
6154
- if (selectedTab) {
6155
- setSelectedTabElement(selectedTab);
6156
- setSelectedTabStyle({
6157
- left: `${selectedTab.offsetLeft}px`,
6158
- width: `${selectedTab.offsetWidth}px`
6159
- });
6160
- }
6161
- }, [selectedId]);
6162
- React__namespace.useEffect(function updateSelectedTabPositionOnTabChange() {
6163
- updateSelectedTabPosition();
6164
- },
6165
- // `selectedId` is a dependency to ensure the effect runs when the selected tab changes
6166
- [selectedId, updateSelectedTabPosition]);
6167
- React__namespace.useEffect(function observeTabListWidthChange() {
6168
- let animationFrameId = null;
6169
- const tabListObserver = new ResizeObserver(([entry]) => {
6170
- const width_0 = entry?.contentRect.width;
6171
- if (width_0 && tabListPrevWidthRef.current !== width_0) {
6172
- tabListPrevWidthRef.current = width_0;
6173
- if (animationFrameId !== null) {
6174
- cancelAnimationFrame(animationFrameId);
6175
- }
6176
- animationFrameId = requestAnimationFrame(() => {
6177
- updateSelectedTabPosition();
6178
- animationFrameId = null;
6209
+ let t3;
6210
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
6211
+ t3 = {};
6212
+ $[7] = t3;
6213
+ } else {
6214
+ t3 = $[7];
6215
+ }
6216
+ const [selectedTabStyle, setSelectedTabStyle] = React__namespace.useState(t3);
6217
+ const selectedId = react.useStoreState(tabContextValue?.tabStore, "selectedId");
6218
+ let t4;
6219
+ if ($[8] !== selectedId) {
6220
+ t4 = function updateSelectedTabPositionCallback() {
6221
+ if (!selectedId || !tabListRef.current) {
6222
+ return;
6223
+ }
6224
+ const tabs = tabListRef.current.querySelectorAll("[role=\"tab\"]");
6225
+ const selectedTab = Array.from(tabs).find(tab => tab.getAttribute("id") === selectedId);
6226
+ if (selectedTab) {
6227
+ setSelectedTabElement(selectedTab);
6228
+ setSelectedTabStyle({
6229
+ left: `${selectedTab.offsetLeft}px`,
6230
+ width: `${selectedTab.offsetWidth}px`
6179
6231
  });
6180
6232
  }
6181
- });
6182
- if (tabListRef.current) {
6183
- tabListObserver.observe(tabListRef.current);
6184
- }
6185
- return function cleanupResizeObserver() {
6186
- if (animationFrameId) {
6187
- cancelAnimationFrame(animationFrameId);
6233
+ };
6234
+ $[8] = selectedId;
6235
+ $[9] = t4;
6236
+ } else {
6237
+ t4 = $[9];
6238
+ }
6239
+ const updateSelectedTabPosition = t4;
6240
+ let t5;
6241
+ if ($[10] !== updateSelectedTabPosition) {
6242
+ t5 = function updateSelectedTabPositionOnTabChange() {
6243
+ updateSelectedTabPosition();
6244
+ };
6245
+ $[10] = updateSelectedTabPosition;
6246
+ $[11] = t5;
6247
+ } else {
6248
+ t5 = $[11];
6249
+ }
6250
+ let t6;
6251
+ if ($[12] !== selectedId || $[13] !== updateSelectedTabPosition) {
6252
+ t6 = [selectedId, updateSelectedTabPosition];
6253
+ $[12] = selectedId;
6254
+ $[13] = updateSelectedTabPosition;
6255
+ $[14] = t6;
6256
+ } else {
6257
+ t6 = $[14];
6258
+ }
6259
+ React__namespace.useEffect(t5, t6);
6260
+ let t7;
6261
+ let t8;
6262
+ if ($[15] !== updateSelectedTabPosition) {
6263
+ t7 = function observeTabListWidthChange() {
6264
+ let animationFrameId = null;
6265
+ const tabListObserver = new ResizeObserver(t9 => {
6266
+ const [entry] = t9;
6267
+ const width_0 = entry?.contentRect.width;
6268
+ if (width_0 && tabListPrevWidthRef.current !== width_0) {
6269
+ tabListPrevWidthRef.current = width_0;
6270
+ if (animationFrameId !== null) {
6271
+ cancelAnimationFrame(animationFrameId);
6272
+ }
6273
+ animationFrameId = requestAnimationFrame(() => {
6274
+ updateSelectedTabPosition();
6275
+ animationFrameId = null;
6276
+ });
6277
+ }
6278
+ });
6279
+ if (tabListRef.current) {
6280
+ tabListObserver.observe(tabListRef.current);
6188
6281
  }
6189
- tabListObserver.disconnect();
6282
+ return function cleanupResizeObserver() {
6283
+ if (animationFrameId) {
6284
+ cancelAnimationFrame(animationFrameId);
6285
+ }
6286
+ tabListObserver.disconnect();
6287
+ };
6190
6288
  };
6191
- }, [updateSelectedTabPosition]);
6289
+ t8 = [updateSelectedTabPosition];
6290
+ $[15] = updateSelectedTabPosition;
6291
+ $[16] = t7;
6292
+ $[17] = t8;
6293
+ } else {
6294
+ t7 = $[16];
6295
+ t8 = $[17];
6296
+ }
6297
+ React__namespace.useEffect(t7, t8);
6192
6298
  if (!tabContextValue) {
6193
6299
  return null;
6194
6300
  }
@@ -6196,83 +6302,210 @@ function TabList({
6196
6302
  tabStore,
6197
6303
  variant
6198
6304
  } = tabContextValue;
6199
- const justifyContentAlignMap = {
6200
- start: 'flexStart',
6201
- end: 'flexEnd',
6202
- center: 'center'
6203
- };
6204
- return (
6205
- /*#__PURE__*/
6206
- // This extra <Box> not only provides alignment for the tabs, but also prevents <Inline>'s
6207
- // negative margins from collapsing when used in a flex container which will render the
6208
- // track with the wrong height
6209
- React__namespace.createElement(Box$1, {
6210
- display: "flex",
6211
- justifyContent: width === 'full' ? 'center' : justifyContentAlignMap[align]
6212
- }, /*#__PURE__*/React__namespace.createElement(react.TabList, _extends__default["default"]({
6213
- store: tabStore,
6214
- render: /*#__PURE__*/React__namespace.createElement(Box$1, {
6215
- position: "relative",
6216
- width: width,
6217
- className: exceptionallySetClassName
6218
- }),
6219
- ref: tabListRef
6220
- }, props), /*#__PURE__*/React__namespace.createElement(Box$1, {
6221
- className: [modules_40c67f5b.track, modules_40c67f5b[`track-${variant}`]]
6222
- }), selectedTabElement ? /*#__PURE__*/React__namespace.createElement(Box$1, {
6305
+ let t9;
6306
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
6307
+ t9 = {
6308
+ start: "flexStart",
6309
+ end: "flexEnd",
6310
+ center: "center"
6311
+ };
6312
+ $[18] = t9;
6313
+ } else {
6314
+ t9 = $[18];
6315
+ }
6316
+ const justifyContentAlignMap = t9;
6317
+ const t10 = width === "full" ? "center" : justifyContentAlignMap[align];
6318
+ let t11;
6319
+ if ($[19] !== exceptionallySetClassName || $[20] !== width) {
6320
+ t11 = /*#__PURE__*/React__namespace.createElement(Box$1, {
6321
+ position: "relative",
6322
+ width: width,
6323
+ className: exceptionallySetClassName
6324
+ });
6325
+ $[19] = exceptionallySetClassName;
6326
+ $[20] = width;
6327
+ $[21] = t11;
6328
+ } else {
6329
+ t11 = $[21];
6330
+ }
6331
+ const t12 = modules_40c67f5b[`track-${variant}`];
6332
+ let t13;
6333
+ if ($[22] !== t12) {
6334
+ t13 = /*#__PURE__*/React__namespace.createElement(Box$1, {
6335
+ className: [modules_40c67f5b.track, t12]
6336
+ });
6337
+ $[22] = t12;
6338
+ $[23] = t13;
6339
+ } else {
6340
+ t13 = $[23];
6341
+ }
6342
+ let t14;
6343
+ if ($[24] !== selectedTabElement || $[25] !== selectedTabStyle || $[26] !== variant) {
6344
+ t14 = selectedTabElement ? /*#__PURE__*/React__namespace.createElement(Box$1, {
6223
6345
  className: [modules_40c67f5b.selected, modules_40c67f5b[`selected-${variant}`]],
6224
6346
  style: selectedTabStyle
6225
- }) : null, /*#__PURE__*/React__namespace.createElement(Inline, {
6347
+ }) : null;
6348
+ $[24] = selectedTabElement;
6349
+ $[25] = selectedTabStyle;
6350
+ $[26] = variant;
6351
+ $[27] = t14;
6352
+ } else {
6353
+ t14 = $[27];
6354
+ }
6355
+ const t15 = width === "full" ? modules_40c67f5b.fullTabList : null;
6356
+ let t16;
6357
+ if ($[28] !== t15) {
6358
+ t16 = classNames__default["default"](t15);
6359
+ $[28] = t15;
6360
+ $[29] = t16;
6361
+ } else {
6362
+ t16 = $[29];
6363
+ }
6364
+ let t17;
6365
+ if ($[30] !== children || $[31] !== space || $[32] !== t16) {
6366
+ t17 = /*#__PURE__*/React__namespace.createElement(Inline, {
6226
6367
  space: space,
6227
- exceptionallySetClassName: classNames__default["default"](width === 'full' ? modules_40c67f5b.fullTabList : null)
6228
- }, children)))
6229
- );
6368
+ exceptionallySetClassName: t16
6369
+ }, children);
6370
+ $[30] = children;
6371
+ $[31] = space;
6372
+ $[32] = t16;
6373
+ $[33] = t17;
6374
+ } else {
6375
+ t17 = $[33];
6376
+ }
6377
+ let t18;
6378
+ if ($[34] !== props || $[35] !== t11 || $[36] !== t13 || $[37] !== t14 || $[38] !== t17 || $[39] !== tabStore) {
6379
+ t18 = /*#__PURE__*/React__namespace.createElement(react.TabList, _extends__default["default"]({
6380
+ store: tabStore,
6381
+ render: t11,
6382
+ ref: tabListRef
6383
+ }, props), t13, t14, t17);
6384
+ $[34] = props;
6385
+ $[35] = t11;
6386
+ $[36] = t13;
6387
+ $[37] = t14;
6388
+ $[38] = t17;
6389
+ $[39] = tabStore;
6390
+ $[40] = t18;
6391
+ } else {
6392
+ t18 = $[40];
6393
+ }
6394
+ let t19;
6395
+ if ($[41] !== t10 || $[42] !== t18) {
6396
+ t19 = /*#__PURE__*/React__namespace.createElement(Box$1, {
6397
+ display: "flex",
6398
+ justifyContent: t10
6399
+ }, t18);
6400
+ $[41] = t10;
6401
+ $[42] = t18;
6402
+ $[43] = t19;
6403
+ } else {
6404
+ t19 = $[43];
6405
+ }
6406
+ return t19;
6230
6407
  }
6231
6408
  /**
6232
6409
  * Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a
6233
6410
  * corresponding `<Tab>` component.
6234
6411
  */
6235
- const TabPanel = /*#__PURE__*/React__namespace.forwardRef(function TabPanel({
6236
- children,
6237
- id,
6238
- renderMode = 'always',
6239
- ...props
6240
- }, ref) {
6412
+ const TabPanel = /*#__PURE__*/React__namespace.forwardRef(function TabPanel(t0, ref) {
6413
+ const $ = reactCompilerRuntime.c(16);
6414
+ let children;
6415
+ let id;
6416
+ let props;
6417
+ let t1;
6418
+ if ($[0] !== t0) {
6419
+ ({
6420
+ children,
6421
+ id,
6422
+ renderMode: t1,
6423
+ ...props
6424
+ } = t0);
6425
+ $[0] = t0;
6426
+ $[1] = children;
6427
+ $[2] = id;
6428
+ $[3] = props;
6429
+ $[4] = t1;
6430
+ } else {
6431
+ children = $[1];
6432
+ id = $[2];
6433
+ props = $[3];
6434
+ t1 = $[4];
6435
+ }
6436
+ const renderMode = t1 === undefined ? "always" : t1;
6241
6437
  const tabContextValue = React__namespace.useContext(TabsContext);
6242
6438
  const [tabRendered, setTabRendered] = React__namespace.useState(false);
6243
- const selectedId = tabContextValue?.tabStore.useState('selectedId');
6439
+ const selectedId = react.useStoreState(tabContextValue?.tabStore, "selectedId");
6244
6440
  const tabIsActive = selectedId === id;
6245
- React__namespace.useEffect(function trackTabRenderedState() {
6246
- if (!tabRendered && tabIsActive) {
6247
- // eslint-disable-next-line react-hooks/set-state-in-effect
6248
- setTabRendered(true);
6249
- }
6250
- }, [tabRendered, tabIsActive]);
6441
+ let t2;
6442
+ let t3;
6443
+ if ($[5] !== tabIsActive || $[6] !== tabRendered) {
6444
+ t2 = function trackTabRenderedState() {
6445
+ if (!tabRendered && tabIsActive) {
6446
+ setTabRendered(true);
6447
+ }
6448
+ };
6449
+ t3 = [tabRendered, tabIsActive];
6450
+ $[5] = tabIsActive;
6451
+ $[6] = tabRendered;
6452
+ $[7] = t2;
6453
+ $[8] = t3;
6454
+ } else {
6455
+ t2 = $[7];
6456
+ t3 = $[8];
6457
+ }
6458
+ React__namespace.useEffect(t2, t3);
6251
6459
  if (!tabContextValue) {
6252
6460
  return null;
6253
6461
  }
6254
6462
  const {
6255
6463
  tabStore
6256
6464
  } = tabContextValue;
6257
- const shouldRender = renderMode === 'always' || renderMode === 'active' && tabIsActive || renderMode === 'lazy' && (tabIsActive || tabRendered);
6258
- return shouldRender ? /*#__PURE__*/React__namespace.createElement(react.TabPanel, _extends__default["default"]({}, props, {
6259
- tabId: id,
6260
- store: tabStore,
6261
- ref: ref
6262
- }), children) : null;
6465
+ const shouldRender = renderMode === "always" || renderMode === "active" && tabIsActive || renderMode === "lazy" && (tabIsActive || tabRendered);
6466
+ let t4;
6467
+ if ($[9] !== children || $[10] !== id || $[11] !== props || $[12] !== ref || $[13] !== shouldRender || $[14] !== tabStore) {
6468
+ t4 = shouldRender ? /*#__PURE__*/React__namespace.createElement(react.TabPanel, _extends__default["default"]({}, props, {
6469
+ tabId: id,
6470
+ store: tabStore,
6471
+ ref: ref
6472
+ }), children) : null;
6473
+ $[9] = children;
6474
+ $[10] = id;
6475
+ $[11] = props;
6476
+ $[12] = ref;
6477
+ $[13] = shouldRender;
6478
+ $[14] = tabStore;
6479
+ $[15] = t4;
6480
+ } else {
6481
+ t4 = $[15];
6482
+ }
6483
+ return t4;
6263
6484
  });
6264
6485
  /**
6265
6486
  * Allows content to be rendered based on the current tab being selected while outside of the
6266
6487
  * TabPanel component. Can be placed freely within the main `<Tabs>` component.
6267
6488
  */
6268
- function TabAwareSlot({
6269
- children
6270
- }) {
6489
+ function TabAwareSlot(t0) {
6490
+ const $ = reactCompilerRuntime.c(4);
6491
+ const {
6492
+ children
6493
+ } = t0;
6271
6494
  const tabContextValue = React__namespace.useContext(TabsContext);
6272
- const selectedId = tabContextValue?.tabStore.useState('selectedId');
6273
- return tabContextValue ? children({
6274
- selectedId
6275
- }) : null;
6495
+ const selectedId = react.useStoreState(tabContextValue?.tabStore, "selectedId");
6496
+ let t1;
6497
+ if ($[0] !== children || $[1] !== selectedId || $[2] !== tabContextValue) {
6498
+ t1 = tabContextValue ? children({
6499
+ selectedId
6500
+ }) : null;
6501
+ $[0] = children;
6502
+ $[1] = selectedId;
6503
+ $[2] = tabContextValue;
6504
+ $[3] = t1;
6505
+ } else {
6506
+ t1 = $[3];
6507
+ }
6508
+ return t1;
6276
6509
  }
6277
6510
 
6278
6511
  /** @deprecated */