@primer/react 0.0.0-20260224220130 → 0.0.0-20260225001226

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,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260224220130
3
+ ## 0.0.0-20260225001226
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
- - [#7587](https://github.com/primer/react/pull/7587) [`6170943`](https://github.com/primer/react/commit/6170943fb0cb1aa7289bbb27f8ebf4e68f255dee) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Fixes an accessibility issue where screen readers announce segmented control buttons without their associated count.
11
+ - [#7529](https://github.com/primer/react/pull/7529) [`7b11c23`](https://github.com/primer/react/commit/7b11c23088e9887608d28b8198f3370425f4cd8a) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add keyboard-accessible tooltip for truncated ActionList.Description
12
12
 
13
13
  - Fake entry to force publishing
14
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAgD7F,CAAA"}
1
+ {"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAG1D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAuE7F,CAAA"}
@@ -3,11 +3,12 @@ import React from 'react';
3
3
  import { ItemContext } from './shared.js';
4
4
  import classes from './ActionList.module.css.js';
5
5
  import { clsx } from 'clsx';
6
+ import { useResizeObserver } from '../hooks/useResizeObserver.js';
6
7
  import { jsx } from 'react/jsx-runtime';
7
8
  import Truncate from '../Truncate/Truncate.js';
8
9
 
9
10
  const Description = t0 => {
10
- const $ = c(26);
11
+ const $ = c(37);
11
12
  let className;
12
13
  let props;
13
14
  let style;
@@ -37,7 +38,8 @@ const Description = t0 => {
37
38
  const variant = t1 === undefined ? "inline" : t1;
38
39
  const {
39
40
  blockDescriptionId,
40
- inlineDescriptionId
41
+ inlineDescriptionId,
42
+ setTruncatedText
41
43
  } = React.useContext(ItemContext);
42
44
  const containerRef = React.useRef(null);
43
45
  const [computedTitle, setComputedTitle] = React.useState("");
@@ -65,66 +67,117 @@ const Description = t0 => {
65
67
  }
66
68
  React.useEffect(t2, t3);
67
69
  const effectiveTitle = typeof props.children === "string" ? props.children : computedTitle;
70
+ const truncateEnabled = truncate && !!setTruncatedText;
71
+ let t4;
72
+ if ($[11] !== effectiveTitle || $[12] !== setTruncatedText) {
73
+ t4 = () => {
74
+ const el = containerRef.current;
75
+ if (!el || !setTruncatedText) {
76
+ return;
77
+ }
78
+ setTruncatedText(el.scrollWidth > el.clientWidth ? effectiveTitle : undefined);
79
+ };
80
+ $[11] = effectiveTitle;
81
+ $[12] = setTruncatedText;
82
+ $[13] = t4;
83
+ } else {
84
+ t4 = $[13];
85
+ }
86
+ let t5;
87
+ if ($[14] !== effectiveTitle || $[15] !== truncateEnabled) {
88
+ t5 = [truncateEnabled, effectiveTitle];
89
+ $[14] = effectiveTitle;
90
+ $[15] = truncateEnabled;
91
+ $[16] = t5;
92
+ } else {
93
+ t5 = $[16];
94
+ }
95
+ useResizeObserver(t4, containerRef, t5);
96
+ let t6;
97
+ let t7;
98
+ if ($[17] !== effectiveTitle || $[18] !== setTruncatedText || $[19] !== truncateEnabled) {
99
+ t6 = () => {
100
+ if (!truncateEnabled || !containerRef.current) {
101
+ return;
102
+ }
103
+ const el_0 = containerRef.current;
104
+ setTruncatedText(el_0.scrollWidth > el_0.clientWidth ? effectiveTitle : undefined);
105
+ return () => {
106
+ setTruncatedText(undefined);
107
+ };
108
+ };
109
+ t7 = [truncateEnabled, effectiveTitle, setTruncatedText];
110
+ $[17] = effectiveTitle;
111
+ $[18] = setTruncatedText;
112
+ $[19] = truncateEnabled;
113
+ $[20] = t6;
114
+ $[21] = t7;
115
+ } else {
116
+ t6 = $[20];
117
+ t7 = $[21];
118
+ }
119
+ React.useEffect(t6, t7);
68
120
  if (variant === "block" || !truncate) {
69
- const t4 = variant === "block" ? blockDescriptionId : inlineDescriptionId;
70
- let t5;
71
- if ($[11] !== className) {
72
- t5 = clsx(className, classes.Description);
73
- $[11] = className;
74
- $[12] = t5;
121
+ const t8 = variant === "block" ? blockDescriptionId : inlineDescriptionId;
122
+ let t9;
123
+ if ($[22] !== className) {
124
+ t9 = clsx(className, classes.Description);
125
+ $[22] = className;
126
+ $[23] = t9;
75
127
  } else {
76
- t5 = $[12];
128
+ t9 = $[23];
77
129
  }
78
- let t6;
79
- if ($[13] !== props.children || $[14] !== style || $[15] !== t4 || $[16] !== t5) {
80
- t6 = /*#__PURE__*/jsx("span", {
81
- id: t4,
82
- className: t5,
130
+ let t10;
131
+ if ($[24] !== props.children || $[25] !== style || $[26] !== t8 || $[27] !== t9) {
132
+ t10 = /*#__PURE__*/jsx("span", {
133
+ id: t8,
134
+ className: t9,
83
135
  style: style,
84
136
  "data-component": "ActionList.Description",
85
137
  children: props.children
86
138
  });
87
- $[13] = props.children;
88
- $[14] = style;
89
- $[15] = t4;
90
- $[16] = t5;
91
- $[17] = t6;
139
+ $[24] = props.children;
140
+ $[25] = style;
141
+ $[26] = t8;
142
+ $[27] = t9;
143
+ $[28] = t10;
92
144
  } else {
93
- t6 = $[17];
145
+ t10 = $[28];
94
146
  }
95
- return t6;
147
+ return t10;
96
148
  } else {
97
- let t4;
98
- if ($[18] !== className) {
99
- t4 = clsx(className, classes.Description);
100
- $[18] = className;
101
- $[19] = t4;
149
+ let t8;
150
+ if ($[29] !== className) {
151
+ t8 = clsx(className, classes.Description);
152
+ $[29] = className;
153
+ $[30] = t8;
102
154
  } else {
103
- t4 = $[19];
155
+ t8 = $[30];
104
156
  }
105
- let t5;
106
- if ($[20] !== effectiveTitle || $[21] !== inlineDescriptionId || $[22] !== props.children || $[23] !== style || $[24] !== t4) {
107
- t5 = /*#__PURE__*/jsx(Truncate, {
157
+ const t9 = setTruncatedText ? "" : effectiveTitle;
158
+ let t10;
159
+ if ($[31] !== inlineDescriptionId || $[32] !== props.children || $[33] !== style || $[34] !== t8 || $[35] !== t9) {
160
+ t10 = /*#__PURE__*/jsx(Truncate, {
108
161
  ref: containerRef,
109
162
  id: inlineDescriptionId,
110
- className: t4,
163
+ className: t8,
111
164
  style: style,
112
- title: effectiveTitle,
165
+ title: t9,
113
166
  inline: true,
114
167
  maxWidth: "100%",
115
168
  "data-component": "ActionList.Description",
116
169
  children: props.children
117
170
  });
118
- $[20] = effectiveTitle;
119
- $[21] = inlineDescriptionId;
120
- $[22] = props.children;
121
- $[23] = style;
122
- $[24] = t4;
123
- $[25] = t5;
171
+ $[31] = inlineDescriptionId;
172
+ $[32] = props.children;
173
+ $[33] = style;
174
+ $[34] = t8;
175
+ $[35] = t9;
176
+ $[36] = t10;
124
177
  } else {
125
- t5 = $[25];
178
+ t10 = $[36];
126
179
  }
127
- return t5;
180
+ return t10;
128
181
  }
129
182
  };
130
183
  Description.__SLOT__ = Symbol('ActionList.Description');
@@ -1 +1 @@
1
- {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAmBrC,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAEpD,CAAA;AA0SD,QAAA,MAAM,IAAI,IAlRa,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqRjD,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA"}
1
+ {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAqBrC,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AA0BD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAEpD,CAAA;AAkTD,QAAA,MAAM,IAAI,IA1Ra,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6RjD,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA"}
@@ -15,8 +15,45 @@ import VisuallyHidden from '../_VisuallyHidden.js';
15
15
  import classes from './ActionList.module.css.js';
16
16
  import { clsx } from 'clsx';
17
17
  import { fixedForwardRef } from '../utils/modern-polymorphic.js';
18
+ import { TooltipContext, Tooltip } from '../TooltipV2/Tooltip.js';
18
19
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
19
20
 
21
+ /**
22
+ * Stable wrapper that keeps Tooltip in the tree for button-semantic items
23
+ * to avoid remount cycles when truncation state changes.
24
+ * For non-button-semantic items, renders children directly.
25
+ */
26
+ function ConditionalTooltip(t0) {
27
+ const $ = c(4);
28
+ const {
29
+ text,
30
+ enabled,
31
+ children
32
+ } = t0;
33
+ if (!enabled) {
34
+ return children;
35
+ }
36
+ const t1 = text || "";
37
+ const t2 = !text;
38
+ let t3;
39
+ if ($[0] !== children || $[1] !== t1 || $[2] !== t2) {
40
+ t3 = /*#__PURE__*/jsx(Tooltip, {
41
+ text: t1,
42
+ direction: "e",
43
+ delay: "medium",
44
+ _privateDisableTooltip: t2,
45
+ _privateRenderBeforeTrigger: true,
46
+ children: children
47
+ });
48
+ $[0] = children;
49
+ $[1] = t1;
50
+ $[2] = t2;
51
+ $[3] = t3;
52
+ } else {
53
+ t3 = $[3];
54
+ }
55
+ return t3;
56
+ }
20
57
  const SubItem = t0 => {
21
58
  const $ = c(2);
22
59
  const {
@@ -218,6 +255,7 @@ const UnwrappedItem = ({
218
255
  const blockDescriptionId = `${itemId}--block-description`;
219
256
  const trailingVisualId = `${itemId}--trailing-visual`;
220
257
  const inactiveWarningId = inactive && !showInactiveIndicator ? `${itemId}--warning-message` : undefined;
258
+ const [truncatedText, setTruncatedText] = React.useState(undefined);
221
259
  const DefaultItemWrapper = listSemantics ? DivItemContainerNoBox : ButtonItemContainerNoBox;
222
260
  const ItemWrapper = _PrivateItemWrapper || DefaultItemWrapper;
223
261
 
@@ -238,8 +276,8 @@ const UnwrappedItem = ({
238
276
  'data-inactive': inactive ? true : undefined,
239
277
  'data-loading': loading && !inactive ? true : undefined,
240
278
  tabIndex: focusable ? undefined : 0,
241
- 'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''} ${slots.description && descriptionVariant === 'inline' ? inlineDescriptionId : ''}`,
242
- 'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
279
+ 'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''}`,
280
+ 'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, slots.description && descriptionVariant === 'inline' ? inlineDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
243
281
  ...(includeSelectionAttribute && {
244
282
  [itemSelectionAttribute]: selected
245
283
  }),
@@ -269,7 +307,8 @@ const UnwrappedItem = ({
269
307
  inactive: Boolean(inactiveText),
270
308
  inlineDescriptionId,
271
309
  blockDescriptionId,
272
- trailingVisualId
310
+ trailingVisualId,
311
+ setTruncatedText: buttonSemantics ? setTruncatedText : undefined
273
312
  },
274
313
  children: /*#__PURE__*/jsxs("li", {
275
314
  ...containerProps,
@@ -281,55 +320,62 @@ const UnwrappedItem = ({
281
320
  "data-has-subitem": slots.subItem ? true : undefined,
282
321
  "data-has-description": slots.description ? true : false,
283
322
  className: clsx(classes.ActionListItem, className),
284
- children: [/*#__PURE__*/jsxs(ItemWrapper, {
285
- ...wrapperProps,
286
- className: classes.ActionListContent,
287
- "data-size": size
288
- // @ts-ignore: ItemWrapper is polymorphic and the ref type depends on the rendered element ('button' or 'li')
289
- ,
290
- ref: forwardedRef,
291
- children: [/*#__PURE__*/jsx("span", {
292
- className: classes.Spacer
293
- }), /*#__PURE__*/jsx(Selection, {
294
- selected: selected,
295
- className: classes.LeadingAction
296
- }), /*#__PURE__*/jsx(VisualOrIndicator, {
297
- inactiveText: showInactiveIndicator ? inactiveText : undefined,
298
- itemHasLeadingVisual: Boolean(slots.leadingVisual),
299
- labelId: labelId,
300
- loading: loading,
301
- position: "leading",
302
- children: slots.leadingVisual
303
- }), /*#__PURE__*/jsxs("span", {
304
- className: classes.ActionListSubContent,
305
- "data-component": "ActionList.Item--DividerContainer",
306
- children: [/*#__PURE__*/jsxs(ConditionalWrapper, {
307
- if: !!slots.description,
308
- className: classes.ItemDescriptionWrap,
309
- "data-description-variant": descriptionVariant,
310
- children: [/*#__PURE__*/jsxs("span", {
311
- id: labelId,
312
- className: classes.ItemLabel,
313
- children: [childrenWithoutSlots, loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
314
- children: "Loading"
315
- })]
316
- }), slots.description]
317
- }), /*#__PURE__*/jsx(VisualOrIndicator, {
318
- inactiveText: showInactiveIndicator ? inactiveText : undefined,
319
- itemHasLeadingVisual: Boolean(slots.leadingVisual),
320
- labelId: labelId,
321
- loading: loading,
322
- position: "trailing",
323
- children: trailingVisual
324
- }),
325
- // If the item is inactive, but it's not in an overlay (e.g. ActionMenu, SelectPanel),
326
- // render the inactive warning message directly in the item.
327
- !showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
328
- className: classes.InactiveWarning,
329
- id: inactiveWarningId,
330
- children: inactiveText
331
- }) : null]
332
- })]
323
+ children: [/*#__PURE__*/jsx(ConditionalTooltip, {
324
+ text: truncatedText,
325
+ enabled: buttonSemantics,
326
+ children: /*#__PURE__*/jsx(ItemWrapper, {
327
+ ...wrapperProps,
328
+ className: classes.ActionListContent,
329
+ "data-size": size
330
+ // @ts-ignore: ItemWrapper is polymorphic and the ref type depends on the rendered element ('button' or 'li')
331
+ ,
332
+ ref: forwardedRef,
333
+ children: /*#__PURE__*/jsxs(TooltipContext.Provider, {
334
+ value: {},
335
+ children: [/*#__PURE__*/jsx("span", {
336
+ className: classes.Spacer
337
+ }), /*#__PURE__*/jsx(Selection, {
338
+ selected: selected,
339
+ className: classes.LeadingAction
340
+ }), /*#__PURE__*/jsx(VisualOrIndicator, {
341
+ inactiveText: showInactiveIndicator ? inactiveText : undefined,
342
+ itemHasLeadingVisual: Boolean(slots.leadingVisual),
343
+ labelId: labelId,
344
+ loading: loading,
345
+ position: "leading",
346
+ children: slots.leadingVisual
347
+ }), /*#__PURE__*/jsxs("span", {
348
+ className: classes.ActionListSubContent,
349
+ "data-component": "ActionList.Item--DividerContainer",
350
+ children: [/*#__PURE__*/jsxs(ConditionalWrapper, {
351
+ if: !!slots.description,
352
+ className: classes.ItemDescriptionWrap,
353
+ "data-description-variant": descriptionVariant,
354
+ children: [/*#__PURE__*/jsxs("span", {
355
+ id: labelId,
356
+ className: classes.ItemLabel,
357
+ children: [childrenWithoutSlots, loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
358
+ children: "Loading"
359
+ })]
360
+ }), slots.description]
361
+ }), /*#__PURE__*/jsx(VisualOrIndicator, {
362
+ inactiveText: showInactiveIndicator ? inactiveText : undefined,
363
+ itemHasLeadingVisual: Boolean(slots.leadingVisual),
364
+ labelId: labelId,
365
+ loading: loading,
366
+ position: "trailing",
367
+ children: trailingVisual
368
+ }),
369
+ // If the item is inactive, but it's not in an overlay (e.g. ActionMenu, SelectPanel),
370
+ // render the inactive warning message directly in the item.
371
+ !showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
372
+ className: classes.InactiveWarning,
373
+ id: inactiveWarningId,
374
+ children: inactiveText
375
+ }) : null]
376
+ })]
377
+ })
378
+ })
333
379
  }), !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction, slots.subItem]
334
380
  })
335
381
  });
@@ -77,6 +77,7 @@ export type ItemContext = Pick<ActionListItemProps<React.ElementType>, 'variant'
77
77
  blockDescriptionId?: string;
78
78
  trailingVisualId?: string;
79
79
  inactive?: boolean;
80
+ setTruncatedText?: (text: string | undefined) => void;
80
81
  };
81
82
  export declare const ItemContext: React.Context<ItemContext>;
82
83
  export declare const getVariantStyles: (variant: ActionListItemProps<React.ElementType>["variant"], disabled: ActionListItemProps<React.ElementType>["dis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AC,UAAU,CAAC,EAC5D,WAAW,OAAO;;;;;;;;;;CAkCnB,CAAA;AAED,eAAO,MAAM,eAAe,SAAS,CAAA;AAErC,MAAM,MAAM,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,IAAI,gBAAgB,CACjF,EAAE,EACF,IAAI,EACJ,KAAK,CAAC,iBAAiB,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,MAAM,CAAA;IAC/C;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAA;IAClD;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CACH,CAAA;AAED,KAAK,YAAY,GAAG,IAAI,CACtB,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,EAClC,SAAS,GAAG,kBAAkB,GAAG,cAAc,GAAG,MAAM,CACzD,GAAG;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,6BAAwC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlButton.d.ts","sourceRoot":"","sources":["../../src/SegmentedControl/SegmentedControlButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,OAAO,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAMrD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AAEpD,MAAM,MAAM,2BAA2B,GAAG;IACxC,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB,oK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,aAAa,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACrG,wFAAwF;IAExF,WAAW,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACnG,gHAAgH;IAChH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,GAAG,oBAAoB,CAAC,iBAAiB,GAAG,aAAa,CAAC,CAAA;AAE3D,QAAA,MAAM,sBAAsB,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,CAyClG,CAAA;AAED,eAAe,sBAAsB,CAAA"}
@@ -7,7 +7,7 @@ import CounterLabel from '../CounterLabel/CounterLabel.js';
7
7
 
8
8
  const SegmentedControlButton = t0 => {
9
9
  var _leadingVisual;
10
- const $ = c(38);
10
+ const $ = c(36);
11
11
  let children;
12
12
  let className;
13
13
  let count;
@@ -56,138 +56,131 @@ const SegmentedControlButton = t0 => {
56
56
  selected = $[8];
57
57
  }
58
58
  let ariaDisabled;
59
- let ariaLabel;
60
59
  let rest;
61
60
  if ($[9] !== props) {
62
61
  ({
63
62
  "aria-disabled": ariaDisabled,
64
- "aria-label": ariaLabel,
65
63
  ...rest
66
64
  } = props);
67
65
  $[9] = props;
68
66
  $[10] = ariaDisabled;
69
- $[11] = ariaLabel;
70
- $[12] = rest;
67
+ $[11] = rest;
71
68
  } else {
72
69
  ariaDisabled = $[10];
73
- ariaLabel = $[11];
74
- rest = $[12];
70
+ rest = $[11];
75
71
  }
76
72
  const LeadingVisual = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : leadingIcon;
77
- const computedAriaLabel = ariaLabel !== undefined && count !== undefined ? `${ariaLabel} ${count}` : ariaLabel;
78
73
  let t1;
79
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
74
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
80
75
  t1 = clsx(classes.Item);
81
- $[13] = t1;
76
+ $[12] = t1;
82
77
  } else {
83
- t1 = $[13];
78
+ t1 = $[12];
84
79
  }
85
80
  const t2 = selected ? "" : undefined;
86
81
  const t3 = disabled || ariaDisabled || undefined;
87
82
  let t4;
88
- if ($[14] !== className) {
83
+ if ($[13] !== className) {
89
84
  t4 = clsx(classes.Button, className);
90
- $[14] = className;
91
- $[15] = t4;
85
+ $[13] = className;
86
+ $[14] = t4;
92
87
  } else {
93
- t4 = $[15];
88
+ t4 = $[14];
94
89
  }
95
90
  let t5;
96
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
91
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
97
92
  t5 = clsx(classes.Content, "segmentedControl-content");
98
- $[16] = t5;
93
+ $[15] = t5;
99
94
  } else {
100
- t5 = $[16];
95
+ t5 = $[15];
101
96
  }
102
97
  let t6;
103
- if ($[17] !== LeadingVisual) {
98
+ if ($[16] !== LeadingVisual) {
104
99
  t6 = LeadingVisual && /*#__PURE__*/jsx("div", {
105
100
  className: classes.LeadingIcon,
106
101
  children: isElement(LeadingVisual) ? LeadingVisual : /*#__PURE__*/jsx(LeadingVisual, {})
107
102
  });
108
- $[17] = LeadingVisual;
109
- $[18] = t6;
103
+ $[16] = LeadingVisual;
104
+ $[17] = t6;
110
105
  } else {
111
- t6 = $[18];
106
+ t6 = $[17];
112
107
  }
113
108
  let t7;
114
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
109
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
115
110
  t7 = clsx(classes.Text, "segmentedControl-text");
116
- $[19] = t7;
111
+ $[18] = t7;
117
112
  } else {
118
- t7 = $[19];
113
+ t7 = $[18];
119
114
  }
120
115
  let t8;
121
- if ($[20] !== children) {
116
+ if ($[19] !== children) {
122
117
  t8 = /*#__PURE__*/jsx("div", {
123
118
  className: t7,
124
119
  "data-text": children,
125
120
  children: children
126
121
  });
127
- $[20] = children;
128
- $[21] = t8;
122
+ $[19] = children;
123
+ $[20] = t8;
129
124
  } else {
130
- t8 = $[21];
125
+ t8 = $[20];
131
126
  }
132
127
  let t9;
133
- if ($[22] !== count) {
128
+ if ($[21] !== count) {
134
129
  t9 = count !== undefined && /*#__PURE__*/jsx("span", {
135
130
  className: classes.Counter,
136
131
  children: /*#__PURE__*/jsx(CounterLabel, {
137
132
  children: count
138
133
  })
139
134
  });
140
- $[22] = count;
141
- $[23] = t9;
135
+ $[21] = count;
136
+ $[22] = t9;
142
137
  } else {
143
- t9 = $[23];
138
+ t9 = $[22];
144
139
  }
145
140
  let t10;
146
- if ($[24] !== t6 || $[25] !== t8 || $[26] !== t9) {
141
+ if ($[23] !== t6 || $[24] !== t8 || $[25] !== t9) {
147
142
  t10 = /*#__PURE__*/jsxs("span", {
148
143
  className: t5,
149
144
  children: [t6, t8, t9]
150
145
  });
151
- $[24] = t6;
152
- $[25] = t8;
153
- $[26] = t9;
154
- $[27] = t10;
146
+ $[23] = t6;
147
+ $[24] = t8;
148
+ $[25] = t9;
149
+ $[26] = t10;
155
150
  } else {
156
- t10 = $[27];
151
+ t10 = $[26];
157
152
  }
158
153
  let t11;
159
- if ($[28] !== computedAriaLabel || $[29] !== rest || $[30] !== selected || $[31] !== t10 || $[32] !== t3 || $[33] !== t4) {
154
+ if ($[27] !== rest || $[28] !== selected || $[29] !== t10 || $[30] !== t3 || $[31] !== t4) {
160
155
  t11 = /*#__PURE__*/jsx("button", {
161
156
  "aria-current": selected,
162
- "aria-label": computedAriaLabel,
163
157
  "aria-disabled": t3,
164
158
  className: t4,
165
159
  type: "button",
166
160
  ...rest,
167
161
  children: t10
168
162
  });
169
- $[28] = computedAriaLabel;
170
- $[29] = rest;
171
- $[30] = selected;
172
- $[31] = t10;
173
- $[32] = t3;
174
- $[33] = t4;
175
- $[34] = t11;
163
+ $[27] = rest;
164
+ $[28] = selected;
165
+ $[29] = t10;
166
+ $[30] = t3;
167
+ $[31] = t4;
168
+ $[32] = t11;
176
169
  } else {
177
- t11 = $[34];
170
+ t11 = $[32];
178
171
  }
179
172
  let t12;
180
- if ($[35] !== t11 || $[36] !== t2) {
173
+ if ($[33] !== t11 || $[34] !== t2) {
181
174
  t12 = /*#__PURE__*/jsx("li", {
182
175
  className: t1,
183
176
  "data-selected": t2,
184
177
  children: t11
185
178
  });
186
- $[35] = t11;
187
- $[36] = t2;
188
- $[37] = t12;
179
+ $[33] = t11;
180
+ $[34] = t2;
181
+ $[35] = t12;
189
182
  } else {
190
- t12 = $[37];
183
+ t12 = $[35];
191
184
  }
192
185
  return t12;
193
186
  };
@@ -24,6 +24,17 @@ export type TooltipProps = React.PropsWithChildren<{
24
24
  * @default false
25
25
  */
26
26
  _privateDisableTooltip?: boolean;
27
+ /**
28
+ * Private API for use internally only. Renders the tooltip popover element before
29
+ * the trigger in the DOM instead of after it.
30
+ *
31
+ * This is used by ActionList items to ensure the tooltip's popover `<span>` does not
32
+ * sit between the ActionListContent and its adjacent SubGroup sibling, which would
33
+ * break CSS adjacent sibling (`+`) selectors used for expand/collapse.
34
+ *
35
+ * @default false
36
+ */
37
+ _privateRenderBeforeTrigger?: boolean;
27
38
  }> & React.HTMLAttributes<HTMLElement>;
28
39
  export declare const TooltipContext: React.Context<{
29
40
  tooltipId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiD,KAAK,yBAAyB,EAAC,MAAM,OAAO,CAAA;AAS3G,OAAO,EAAoD,KAAK,mBAAmB,EAAC,MAAM,mBAAmB,CAAA;AAG7G,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CA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SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;IAC9B,cAAc,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAC5C;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACnC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;;;;;;;;OASG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAA;CACtC,CAAC,GACA,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAiEnC,eAAO,MAAM,cAAc;gBAAoC,MAAM;EAAM,CAAA;AAE3E,eAAO,MAAM,OAAO,EAAE,yBAAyB,CAC7C,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CACvE,GACC,UAmTD,CAAA"}
@@ -86,6 +86,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
86
86
  keybindingHint,
87
87
  delay = 'short',
88
88
  _privateDisableTooltip = false,
89
+ _privateRenderBeforeTrigger = false,
89
90
  ...rest
90
91
  }, forwardedRef) => {
91
92
  const tooltipId = useId(id);
@@ -196,112 +197,134 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
196
197
  }, [isPopoverOpen]);
197
198
  const isMacOS = useIsMacOS();
198
199
  const hasAriaLabel = 'aria-label' in rest;
199
- return /*#__PURE__*/jsx(TooltipContext.Provider, {
200
- value: value,
201
- children: /*#__PURE__*/jsxs(Fragment, {
202
- children: [/*#__PURE__*/React.isValidElement(child) &&
203
- /*#__PURE__*/
204
- // eslint-disable-next-line react-hooks/refs
205
- React.cloneElement(child, {
206
- // @ts-expect-error it needs a non nullable ref
207
- ref: triggerRef,
208
- // If it is a type description, we use tooltip to describe the trigger
209
- 'aria-describedby': (() => {
210
- // If tooltip is not a description type, keep the original aria-describedby
211
- if (type !== 'description') {
212
- return child.props['aria-describedby'];
213
- }
200
+ const tooltipPopover = /*#__PURE__*/jsx("span", {
201
+ className: clsx(className, classes.Tooltip),
202
+ ref: tooltipElRef,
203
+ "data-direction": calculatedDirection,
204
+ ...rest,
205
+ // Only need tooltip role if the tooltip is a description for supplementary information
206
+ role: type === 'description' ? 'tooltip' : undefined
207
+ // stop AT from announcing the tooltip twice: when it is a label type it will be announced with "aria-labelledby",when it is a description type it will be announced with "aria-describedby"
208
+ ,
209
+ "aria-hidden": true
210
+ // mouse leave and enter on the tooltip itself is needed to keep the tooltip open when the mouse is over the tooltip
211
+ ,
212
+ onMouseEnter: openTooltip,
213
+ onMouseLeave: closeTooltip
214
+ // If there is an aria-label prop, always assign the ID to the parent so the accessible label can be overridden
215
+ ,
216
+ id: hasAriaLabel || !keybindingHint ? tooltipId : undefined,
217
+ children: keybindingHint ? /*#__PURE__*/jsxs(Fragment, {
218
+ children: [/*#__PURE__*/jsxs("span", {
219
+ id: hasAriaLabel ? undefined : tooltipId,
220
+ children: [text, /*#__PURE__*/jsxs(VisuallyHidden, {
221
+ children: ["(", getAccessibleKeybindingHintString(keybindingHint, isMacOS), ")"]
222
+ })]
223
+ }), /*#__PURE__*/jsx("span", {
224
+ className: clsx(classes.KeybindingHintContainer, text && classes.HasTextBefore),
225
+ "aria-hidden": true,
226
+ children: /*#__PURE__*/jsx(KeybindingHint, {
227
+ keys: keybindingHint,
228
+ format: "condensed",
229
+ variant: "onEmphasis",
230
+ size: "small"
231
+ })
232
+ })]
233
+ }) : text
234
+ });
235
+ const setTriggerRef = node => {
236
+ const triggerMutableRef = triggerRef;
237
+ triggerMutableRef.current = node;
238
+ const childRef = child.ref;
239
+ if (typeof childRef === 'function') {
240
+ childRef(node);
241
+ } else if (childRef && typeof childRef === 'object') {
242
+ const childMutableRef = childRef;
243
+ childMutableRef.current = node;
244
+ }
245
+ };
246
+ const triggerElement = /*#__PURE__*/React.isValidElement(child) &&
247
+ /*#__PURE__*/
248
+ // eslint-disable-next-line react-hooks/refs
249
+ React.cloneElement(child, {
250
+ ref: setTriggerRef,
251
+ // If it is a type description, we use tooltip to describe the trigger
252
+ 'aria-describedby': (() => {
253
+ // If tooltip is not a description type, keep the original aria-describedby
254
+ if (type !== 'description') {
255
+ return child.props['aria-describedby'];
256
+ }
257
+
258
+ // When the tooltip is disabled, don't add its ID to aria-describedby
259
+ // to avoid an empty string polluting the accessible description
260
+ if (_privateDisableTooltip) {
261
+ return child.props['aria-describedby'];
262
+ }
214
263
 
215
- // If tooltip is a description type, append our tooltipId
216
- const existingDescribedBy = child.props['aria-describedby'];
217
- if (existingDescribedBy) {
218
- return `${existingDescribedBy} ${tooltipId}`;
219
- }
264
+ // If tooltip is a description type, append our tooltipId
265
+ const existingDescribedBy = child.props['aria-describedby'];
266
+ if (existingDescribedBy) {
267
+ return `${existingDescribedBy} ${tooltipId}`;
268
+ }
220
269
 
221
- // If no existing aria-describedby, use our tooltipId
222
- return tooltipId;
223
- })(),
224
- // If it is a label type, we use tooltip to label the trigger
225
- 'aria-labelledby': type === 'label' ? tooltipId : child.props['aria-labelledby'],
226
- onBlur: event => {
227
- var _child$props$onBlur, _child$props;
228
- closeTooltip();
229
- (_child$props$onBlur = (_child$props = child.props).onBlur) === null || _child$props$onBlur === void 0 ? void 0 : _child$props$onBlur.call(_child$props, event);
230
- },
231
- onTouchEnd: event => {
232
- var _child$props$onTouchE, _child$props2;
233
- (_child$props$onTouchE = (_child$props2 = child.props).onTouchEnd) === null || _child$props$onTouchE === void 0 ? void 0 : _child$props$onTouchE.call(_child$props2, event);
270
+ // If no existing aria-describedby, use our tooltipId
271
+ return tooltipId;
272
+ })(),
273
+ // If it is a label type, we use tooltip to label the trigger
274
+ 'aria-labelledby': type === 'label' ? tooltipId : child.props['aria-labelledby'],
275
+ onBlur: event => {
276
+ var _child$props$onBlur, _child$props;
277
+ closeTooltip();
278
+ (_child$props$onBlur = (_child$props = child.props).onBlur) === null || _child$props$onBlur === void 0 ? void 0 : _child$props$onBlur.call(_child$props, event);
279
+ },
280
+ onTouchEnd: event => {
281
+ var _child$props$onTouchE, _child$props2;
282
+ (_child$props$onTouchE = (_child$props2 = child.props).onTouchEnd) === null || _child$props$onTouchE === void 0 ? void 0 : _child$props$onTouchE.call(_child$props2, event);
234
283
 
235
- // Hide tooltips on tap to essentially disable them on touch devices;
236
- // this still allows viewing the tooltip on tap-and-hold
237
- safeSetTimeout(() => closeTooltip(), 10);
238
- },
239
- onFocus: event => {
240
- var _child$props$onFocus, _child$props3;
241
- // only show tooltip on :focus-visible, not on :focus
242
- try {
243
- if (!event.target.matches(':focus-visible')) return;
244
- } catch (_error) {
245
- // jsdom (jest) does not support `:focus-visible` yet and would throw an error
246
- // https://github.com/jsdom/jsdom/issues/3426
247
- }
248
- openTooltip();
249
- (_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 ? void 0 : _child$props$onFocus.call(_child$props3, event);
250
- },
251
- onMouseOverCapture: event => {
252
- const delayTime = delayTimeMap[delay] || 50;
253
- // We use a `capture` event to ensure this is called first before
254
- // events that might cancel the opening timeout (like `onTouchEnd`)
255
- // show tooltip after mouse has been hovering for the specified delay time
256
- // (prevent showing tooltip when mouse is just passing through)
257
- openTimeoutRef.current = safeSetTimeout(() => {
258
- var _child$props$onMouseE, _child$props4;
259
- // if the mouse is already moved out, do not show the tooltip
260
- if (!openTimeoutRef.current) return;
261
- openTooltip();
262
- (_child$props$onMouseE = (_child$props4 = child.props).onMouseEnter) === null || _child$props$onMouseE === void 0 ? void 0 : _child$props$onMouseE.call(_child$props4, event);
263
- }, delayTime);
264
- },
265
- onMouseLeave: event => {
266
- var _child$props$onMouseL, _child$props5;
267
- closeTooltip();
268
- (_child$props$onMouseL = (_child$props5 = child.props).onMouseLeave) === null || _child$props$onMouseL === void 0 ? void 0 : _child$props$onMouseL.call(_child$props5, event);
269
- }
270
- }), /*#__PURE__*/jsx("span", {
271
- className: clsx(className, classes.Tooltip),
272
- ref: tooltipElRef,
273
- "data-direction": calculatedDirection,
274
- ...rest,
275
- // Only need tooltip role if the tooltip is a description for supplementary information
276
- role: type === 'description' ? 'tooltip' : undefined
277
- // stop AT from announcing the tooltip twice: when it is a label type it will be announced with "aria-labelledby",when it is a description type it will be announced with "aria-describedby"
278
- ,
279
- "aria-hidden": true
280
- // mouse leave and enter on the tooltip itself is needed to keep the tooltip open when the mouse is over the tooltip
281
- ,
282
- onMouseEnter: openTooltip,
283
- onMouseLeave: closeTooltip
284
- // If there is an aria-label prop, always assign the ID to the parent so the accessible label can be overridden
285
- ,
286
- id: hasAriaLabel || !keybindingHint ? tooltipId : undefined,
287
- children: keybindingHint ? /*#__PURE__*/jsxs(Fragment, {
288
- children: [/*#__PURE__*/jsxs("span", {
289
- id: hasAriaLabel ? undefined : tooltipId,
290
- children: [text, /*#__PURE__*/jsxs(VisuallyHidden, {
291
- children: ["(", getAccessibleKeybindingHintString(keybindingHint, isMacOS), ")"]
292
- })]
293
- }), /*#__PURE__*/jsx("span", {
294
- className: clsx(classes.KeybindingHintContainer, text && classes.HasTextBefore),
295
- "aria-hidden": true,
296
- children: /*#__PURE__*/jsx(KeybindingHint, {
297
- keys: keybindingHint,
298
- format: "condensed",
299
- variant: "onEmphasis",
300
- size: "small"
301
- })
302
- })]
303
- }) : text
304
- })]
284
+ // Hide tooltips on tap to essentially disable them on touch devices;
285
+ // this still allows viewing the tooltip on tap-and-hold
286
+ safeSetTimeout(() => closeTooltip(), 10);
287
+ },
288
+ onFocus: event => {
289
+ var _child$props$onFocus, _child$props3;
290
+ // only show tooltip on :focus-visible, not on :focus
291
+ try {
292
+ if (!event.target.matches(':focus-visible')) return;
293
+ } catch (_error) {
294
+ // jsdom (jest) does not support `:focus-visible` yet and would throw an error
295
+ // https://github.com/jsdom/jsdom/issues/3426
296
+ }
297
+ openTooltip();
298
+ (_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 ? void 0 : _child$props$onFocus.call(_child$props3, event);
299
+ },
300
+ onMouseOverCapture: event => {
301
+ const delayTime = delayTimeMap[delay] || 50;
302
+ // We use a `capture` event to ensure this is called first before
303
+ // events that might cancel the opening timeout (like `onTouchEnd`)
304
+ // show tooltip after mouse has been hovering for the specified delay time
305
+ // (prevent showing tooltip when mouse is just passing through)
306
+ openTimeoutRef.current = safeSetTimeout(() => {
307
+ var _child$props$onMouseE, _child$props4;
308
+ // if the mouse is already moved out, do not show the tooltip
309
+ if (!openTimeoutRef.current) return;
310
+ openTooltip();
311
+ (_child$props$onMouseE = (_child$props4 = child.props).onMouseEnter) === null || _child$props$onMouseE === void 0 ? void 0 : _child$props$onMouseE.call(_child$props4, event);
312
+ }, delayTime);
313
+ },
314
+ onMouseLeave: event => {
315
+ var _child$props$onMouseL, _child$props5;
316
+ closeTooltip();
317
+ (_child$props$onMouseL = (_child$props5 = child.props).onMouseLeave) === null || _child$props$onMouseL === void 0 ? void 0 : _child$props$onMouseL.call(_child$props5, event);
318
+ }
319
+ });
320
+ return /*#__PURE__*/jsx(TooltipContext.Provider, {
321
+ value: value,
322
+ children: /*#__PURE__*/jsx(Fragment, {
323
+ children: _privateRenderBeforeTrigger ? /*#__PURE__*/jsxs(Fragment, {
324
+ children: [tooltipPopover, triggerElement]
325
+ }) : /*#__PURE__*/jsxs(Fragment, {
326
+ children: [triggerElement, tooltipPopover]
327
+ })
305
328
  })
306
329
  });
307
330
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260224220130",
4
+ "version": "0.0.0-20260225001226",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",