@primer/react 38.45.0-rc.3d36dffa3 → 38.45.0-rc.cac8791d9

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.
@@ -4,7 +4,7 @@ import { DEFAULT_SORT_DIRECTION, SortDirection, strategies, transition } from ".
4
4
  import { useId, useState } from "react";
5
5
  //#region src/DataTable/useTable.ts
6
6
  function useTable(t0) {
7
- const $ = c(80);
7
+ const $ = c(82);
8
8
  const { columns, data, initialSortColumn, initialSortDirection, externalSorting, getRowId, rowSelection: t1, selectedRows: controlledSelectedRows, defaultSelectedRows, onSelectionChange, isRowSelectable, collapsibleGroups: t2, expandedGroups: controlledExpandedGroups, defaultExpandedGroups, onExpandedGroupsChange } = t0;
9
9
  const rowSelection = t1 === void 0 ? false : t1;
10
10
  const collapsibleGroups = t2 === void 0 ? false : t2;
@@ -232,13 +232,17 @@ function useTable(t0) {
232
232
  for (const item_0 of rowOrder) if (isDataTableRowGroup(item_0)) {
233
233
  if (body.rows.length > 0) bodies.push(body);
234
234
  const groupStartIndex = rowIndex_0;
235
+ const rows_1 = item_0.rows.map((row_1, index_2) => createRow(row_1, groupStartIndex + index_2));
236
+ const selectableRows = rows_1.filter(_temp2);
235
237
  bodies.push({
236
238
  type: "row-group",
237
239
  key: `group:${typeof item_0.groupId}:${item_0.groupId}`,
238
240
  id: item_0.groupId,
239
241
  label: item_0.label,
240
- rows: item_0.rows.map((row_1, index_2) => createRow(row_1, groupStartIndex + index_2)),
242
+ rows: rows_1,
241
243
  expanded: !collapsibleGroups || expandedGroups.has(item_0.groupId),
244
+ selection: selectableRows.length > 0 && selectableRows.every(_temp3) ? "all" : selectableRows.some(_temp4) ? "some" : "none",
245
+ selectable: selectableRows.length > 0,
242
246
  "aria-label": item_0["aria-label"]
243
247
  });
244
248
  rowIndex_0 = rowIndex_0 + item_0.rows.length;
@@ -252,7 +256,7 @@ function useTable(t0) {
252
256
  rowIndex_0 = rowIndex_0 + 1;
253
257
  }
254
258
  if (body.rows.length > 0 || bodies.length === 0) bodies.push(body);
255
- t11 = bodies.flatMap(_temp2).filter(_temp3);
259
+ t11 = bodies.flatMap(_temp5).filter(_temp6);
256
260
  $[23] = collapsibleGroups;
257
261
  $[24] = columns;
258
262
  $[25] = data;
@@ -277,25 +281,25 @@ function useTable(t0) {
277
281
  sortBy = $[39];
278
282
  t11 = $[40];
279
283
  }
280
- const selectableRows = t11;
284
+ const selectableRows_0 = t11;
281
285
  let t12;
282
- if ($[45] !== selectableRows) {
283
- t12 = new Set(selectableRows.filter(_temp4).map(_temp5));
284
- $[45] = selectableRows;
286
+ if ($[45] !== selectableRows_0) {
287
+ t12 = new Set(selectableRows_0.filter(_temp7).map(_temp8));
288
+ $[45] = selectableRows_0;
285
289
  $[46] = t12;
286
290
  } else t12 = $[46];
287
291
  const effectiveSelectedRows = t12;
288
292
  const selectedCount = effectiveSelectedRows.size;
289
- const selectableCount = selectableRows.length;
293
+ const selectableCount = selectableRows_0.length;
290
294
  const allSelected = selectableCount > 0 && selectedCount === selectableCount;
291
295
  const someSelected = selectedCount > 0 && !allSelected;
292
296
  let t13;
293
297
  if ($[47] !== selectedRows || $[48] !== setSelectedRows) {
294
- t13 = function toggleRowSelection(row_5) {
295
- if (!row_5.selectable) return;
298
+ t13 = function toggleRowSelection(row_8) {
299
+ if (!row_8.selectable) return;
296
300
  const nextSelectedRows_0 = new Set(selectedRows);
297
- if (nextSelectedRows_0.has(row_5.selectionId)) nextSelectedRows_0.delete(row_5.selectionId);
298
- else nextSelectedRows_0.add(row_5.selectionId);
301
+ if (nextSelectedRows_0.has(row_8.selectionId)) nextSelectedRows_0.delete(row_8.selectionId);
302
+ else nextSelectedRows_0.add(row_8.selectionId);
299
303
  setSelectedRows(nextSelectedRows_0);
300
304
  };
301
305
  $[47] = selectedRows;
@@ -303,109 +307,133 @@ function useTable(t0) {
303
307
  $[49] = t13;
304
308
  } else t13 = $[49];
305
309
  const toggleRowSelection = t13;
306
- let t14;
307
- if ($[50] !== allSelected || $[51] !== selectableRows || $[52] !== selectedRows || $[53] !== setSelectedRows) {
308
- t14 = function toggleAllRows() {
309
- if (selectableRows.length === 0) return;
310
+ let toggleAllRows;
311
+ let toggleGroupSelection;
312
+ if ($[50] !== allSelected || $[51] !== selectableRows_0 || $[52] !== selectedRows || $[53] !== setSelectedRows) {
313
+ toggleAllRows = function toggleAllRows() {
314
+ toggleRowsSelection(selectableRows_0, allSelected);
315
+ };
316
+ toggleGroupSelection = function toggleGroupSelection(group_0) {
317
+ toggleRowsSelection(group_0.rows.filter(_temp9), group_0.selection === "all");
318
+ };
319
+ function toggleRowsSelection(rows_2, allSelected_0) {
320
+ if (rows_2.length === 0) return;
310
321
  const nextSelectedRows_1 = new Set(selectedRows);
311
- for (const row_6 of selectableRows) if (allSelected) nextSelectedRows_1.delete(row_6.selectionId);
312
- else nextSelectedRows_1.add(row_6.selectionId);
322
+ for (const row_10 of rows_2) if (allSelected_0) nextSelectedRows_1.delete(row_10.selectionId);
323
+ else nextSelectedRows_1.add(row_10.selectionId);
313
324
  setSelectedRows(nextSelectedRows_1);
314
- };
325
+ }
315
326
  $[50] = allSelected;
316
- $[51] = selectableRows;
327
+ $[51] = selectableRows_0;
317
328
  $[52] = selectedRows;
318
329
  $[53] = setSelectedRows;
319
- $[54] = t14;
320
- } else t14 = $[54];
321
- const toggleAllRows = t14;
322
- let t15;
323
- if ($[55] !== collapsibleGroups || $[56] !== expandedGroups || $[57] !== setExpandedGroups) {
324
- t15 = function toggleGroupExpansion(group_0) {
330
+ $[54] = toggleAllRows;
331
+ $[55] = toggleGroupSelection;
332
+ } else {
333
+ toggleAllRows = $[54];
334
+ toggleGroupSelection = $[55];
335
+ }
336
+ let t14;
337
+ if ($[56] !== collapsibleGroups || $[57] !== expandedGroups || $[58] !== setExpandedGroups) {
338
+ t14 = function toggleGroupExpansion(group_1) {
325
339
  if (!collapsibleGroups) return;
326
340
  const nextExpandedGroups_0 = new Set(expandedGroups);
327
- if (nextExpandedGroups_0.has(group_0.id)) nextExpandedGroups_0.delete(group_0.id);
328
- else nextExpandedGroups_0.add(group_0.id);
341
+ if (nextExpandedGroups_0.has(group_1.id)) nextExpandedGroups_0.delete(group_1.id);
342
+ else nextExpandedGroups_0.add(group_1.id);
329
343
  setExpandedGroups(nextExpandedGroups_0);
330
344
  };
331
- $[55] = collapsibleGroups;
332
- $[56] = expandedGroups;
333
- $[57] = setExpandedGroups;
334
- $[58] = t15;
335
- } else t15 = $[58];
336
- const toggleGroupExpansion = t15;
337
- let t16;
338
- if ($[59] !== setSelectedRows) {
339
- t16 = () => {
345
+ $[56] = collapsibleGroups;
346
+ $[57] = expandedGroups;
347
+ $[58] = setExpandedGroups;
348
+ $[59] = t14;
349
+ } else t14 = $[59];
350
+ const toggleGroupExpansion = t14;
351
+ let t15;
352
+ if ($[60] !== setSelectedRows) {
353
+ t15 = () => {
340
354
  setSelectedRows(/* @__PURE__ */ new Set());
341
355
  };
342
- $[59] = setSelectedRows;
343
- $[60] = t16;
344
- } else t16 = $[60];
345
- let t17;
346
- if ($[61] !== sortBy || $[62] !== t16 || $[63] !== toggleAllRows || $[64] !== toggleGroupExpansion || $[65] !== toggleRowSelection) {
347
- t17 = {
356
+ $[60] = setSelectedRows;
357
+ $[61] = t15;
358
+ } else t15 = $[61];
359
+ let t16;
360
+ if ($[62] !== sortBy || $[63] !== t15 || $[64] !== toggleAllRows || $[65] !== toggleGroupExpansion || $[66] !== toggleGroupSelection || $[67] !== toggleRowSelection) {
361
+ t16 = {
348
362
  sortBy,
349
363
  toggleRowSelection,
350
364
  toggleAllRows,
365
+ toggleGroupSelection,
351
366
  toggleGroupExpansion,
352
- clearSelection: t16
367
+ clearSelection: t15
353
368
  };
354
- $[61] = sortBy;
355
- $[62] = t16;
356
- $[63] = toggleAllRows;
357
- $[64] = toggleGroupExpansion;
358
- $[65] = toggleRowSelection;
359
- $[66] = t17;
360
- } else t17 = $[66];
361
- const t18 = `${tableId}-selection-column`;
362
- let t19;
363
- if ($[67] !== allSelected || $[68] !== effectiveSelectedRows || $[69] !== selectableCount || $[70] !== selectedCount || $[71] !== someSelected || $[72] !== t18) {
364
- t19 = {
365
- headerId: t18,
369
+ $[62] = sortBy;
370
+ $[63] = t15;
371
+ $[64] = toggleAllRows;
372
+ $[65] = toggleGroupExpansion;
373
+ $[66] = toggleGroupSelection;
374
+ $[67] = toggleRowSelection;
375
+ $[68] = t16;
376
+ } else t16 = $[68];
377
+ const t17 = `${tableId}-selection-column`;
378
+ let t18;
379
+ if ($[69] !== allSelected || $[70] !== effectiveSelectedRows || $[71] !== selectableCount || $[72] !== selectedCount || $[73] !== someSelected || $[74] !== t17) {
380
+ t18 = {
381
+ headerId: t17,
366
382
  selectedRows: effectiveSelectedRows,
367
383
  allSelected,
368
384
  someSelected,
369
385
  selectableCount,
370
386
  selectedCount
371
387
  };
372
- $[67] = allSelected;
373
- $[68] = effectiveSelectedRows;
374
- $[69] = selectableCount;
375
- $[70] = selectedCount;
376
- $[71] = someSelected;
377
- $[72] = t18;
378
- $[73] = t19;
379
- } else t19 = $[73];
380
- let t20;
381
- if ($[74] !== bodies || $[75] !== gridTemplateColumns || $[76] !== headers || $[77] !== t17 || $[78] !== t19) {
382
- t20 = {
388
+ $[69] = allSelected;
389
+ $[70] = effectiveSelectedRows;
390
+ $[71] = selectableCount;
391
+ $[72] = selectedCount;
392
+ $[73] = someSelected;
393
+ $[74] = t17;
394
+ $[75] = t18;
395
+ } else t18 = $[75];
396
+ let t19;
397
+ if ($[76] !== bodies || $[77] !== gridTemplateColumns || $[78] !== headers || $[79] !== t16 || $[80] !== t18) {
398
+ t19 = {
383
399
  headers,
384
- actions: t17,
385
- selection: t19,
400
+ actions: t16,
401
+ selection: t18,
386
402
  gridTemplateColumns,
387
403
  bodies
388
404
  };
389
- $[74] = bodies;
390
- $[75] = gridTemplateColumns;
391
- $[76] = headers;
392
- $[77] = t17;
393
- $[78] = t19;
394
- $[79] = t20;
395
- } else t20 = $[79];
396
- return t20;
405
+ $[76] = bodies;
406
+ $[77] = gridTemplateColumns;
407
+ $[78] = headers;
408
+ $[79] = t16;
409
+ $[80] = t18;
410
+ $[81] = t19;
411
+ } else t19 = $[81];
412
+ return t19;
413
+ }
414
+ function _temp9(row_9) {
415
+ return row_9.selectable;
416
+ }
417
+ function _temp8(row_7) {
418
+ return row_7.selectionId;
397
419
  }
398
- function _temp5(row_4) {
399
- return row_4.selectionId;
420
+ function _temp7(row_6) {
421
+ return row_6.selected;
422
+ }
423
+ function _temp6(row_5) {
424
+ return row_5.selectable;
425
+ }
426
+ function _temp5(body_0) {
427
+ return body_0.rows;
400
428
  }
401
429
  function _temp4(row_3) {
402
430
  return row_3.selected;
403
431
  }
404
- function _temp3(row_2) {
405
- return row_2.selectable;
432
+ function _temp3(row_4) {
433
+ return row_4.selected;
406
434
  }
407
- function _temp2(body_0) {
408
- return body_0.rows;
435
+ function _temp2(row_2) {
436
+ return row_2.selectable;
409
437
  }
410
438
  function _temp(group) {
411
439
  return group.groupId;
@@ -0,0 +1,2 @@
1
+ .prc-SegmentedControl-SegmentedControl-lqIXp{--segmented-control-icon-width:32px;--segmented-control-outer-radius:var(--borderRadius-medium,0.375rem);background-color:var(--controlTrack-bgColor-rest,#e6eaef);border:var(--borderWidth-thin,.0625rem) solid var(--controlTrack-borderColor-rest,transparent);border-radius:var(--borderRadius-medium,.375rem);display:inline-flex;font-size:var(--text-body-size-medium,.875rem);height:32px;margin:0;max-width:100%;padding:0;position:relative}@supports (anchor-name:--value){.prc-SegmentedControl-SegmentedControl-lqIXp:before{position-anchor:--segmented-control-current-item;background-color:var(--controlKnob-bgColor-rest,#fff);border:var(--borderWidth-thin,.0625rem) solid var(--controlKnob-borderColor-rest,#d1d9e0);border-radius:var(--segmented-control-outer-radius);content:"";inset:anchor(top) anchor(right) anchor(bottom) anchor(left);position:absolute}@media (prefers-reduced-motion:no-preference){.prc-SegmentedControl-SegmentedControl-lqIXp:before{transition:inset var(--base-duration-200,[ object Object ]) var(--base-easing-easeInOut,.6,0,.2,1)}}.prc-SegmentedControl-SegmentedControl-lqIXp[data-disable-knob-transition]:before{transition:none}}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}.prc-SegmentedControl-SegmentedControl-lqIXp>[data-component="SegmentedControl.Divider"]{align-self:stretch;background-color:var(--borderColor-default,#d1d9e0);display:none;list-style:none;margin-block:var(--base-size-8,.5rem);margin-inline-end:calc(var(--base-size-8,.5rem) - 1px);margin-inline-start:var(--base-size-8,.5rem);width:1px}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-narrow=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-narrow=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}@media (min-width:48rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}@media (min-width:87.5rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-wide=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=true]:not([data-full-width-wide=true]),.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-wide=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant=dropdown]{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant=subtle]){--segmented-control-outer-radius:var(--borderRadius-large,0.75rem);--segmented-control-button-bg-inset:0px;--segmented-control-button-bgColor-hover:var(--button-invisible-bgColor-hover,#818b981a);background-color:transparent;border:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant=subtle]):before{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant=subtle]) .prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:transparent}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant=subtle])>[data-component="SegmentedControl.Divider"]{display:block}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant=subtle]) .prc-SegmentedControl-Button-E48xz{border:0;border-radius:var(--borderRadius-large,.75rem);color:var(--fgColor-muted,#59636e);padding:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant=subtle]) .prc-SegmentedControl-Button-E48xz .prc-SegmentedControl-Content-1COlk{border:0;padding-inline:var(--base-size-12,.75rem)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true]{color:var(--fgColor-default,#1f2328)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true] .prc-SegmentedControl-Content-1COlk{background-color:var(--bgColor-muted,#f6f8fa)}.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-narrow=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-narrow=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-narrow=subtle]){--segmented-control-outer-radius:var(--borderRadius-large,0.75rem);--segmented-control-button-bg-inset:0px;--segmented-control-button-bgColor-hover:var(--button-invisible-bgColor-hover,#818b981a);background-color:transparent;border:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-narrow=subtle]):before{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-narrow=subtle]) .prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:transparent}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-narrow=subtle])>[data-component="SegmentedControl.Divider"]{display:block}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-narrow=subtle]) .prc-SegmentedControl-Button-E48xz{border:0;border-radius:var(--borderRadius-large,.75rem);color:var(--fgColor-muted,#59636e);padding:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-narrow=subtle]) .prc-SegmentedControl-Button-E48xz .prc-SegmentedControl-Content-1COlk{border:0;padding-inline:var(--base-size-12,.75rem)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-narrow=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true]{color:var(--fgColor-default,#1f2328)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-narrow=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true] .prc-SegmentedControl-Content-1COlk{background-color:var(--bgColor-muted,#f6f8fa)}}@media (min-width:48rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-regular=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-regular=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]){--segmented-control-outer-radius:var(--borderRadius-large,0.75rem);--segmented-control-button-bg-inset:0px;--segmented-control-button-bgColor-hover:var(--button-invisible-bgColor-hover,#818b981a);background-color:transparent;border:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):before{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]) .prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:transparent}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle])>[data-component="SegmentedControl.Divider"]{display:block}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]) .prc-SegmentedControl-Button-E48xz{border:0;border-radius:var(--borderRadius-large,.75rem);color:var(--fgColor-muted,#59636e);padding:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]) .prc-SegmentedControl-Button-E48xz .prc-SegmentedControl-Content-1COlk{border:0;padding-inline:var(--base-size-12,.75rem)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true]{color:var(--fgColor-default,#1f2328)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true] .prc-SegmentedControl-Content-1COlk{background-color:var(--bgColor-muted,#f6f8fa)}}@media (min-width:87.5rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-wide=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-wide=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-wide=subtle]){--segmented-control-outer-radius:var(--borderRadius-large,0.75rem);--segmented-control-button-bg-inset:0px;--segmented-control-button-bgColor-hover:var(--button-invisible-bgColor-hover,#818b981a);background-color:transparent;border:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-wide=subtle]):before{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-wide=subtle]) .prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:transparent}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-wide=subtle])>[data-component="SegmentedControl.Divider"]{display:block}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-wide=subtle]) .prc-SegmentedControl-Button-E48xz{border:0;border-radius:var(--borderRadius-large,.75rem);color:var(--fgColor-muted,#59636e);padding:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-wide=subtle]) .prc-SegmentedControl-Button-E48xz .prc-SegmentedControl-Content-1COlk{border:0;padding-inline:var(--base-size-12,.75rem)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-wide=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true]{color:var(--fgColor-default,#1f2328)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-wide=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true] .prc-SegmentedControl-Content-1COlk{background-color:var(--bgColor-muted,#f6f8fa)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):not([data-variant-wide=subtle]){--segmented-control-outer-radius:var(--borderRadius-medium,0.375rem);--segmented-control-button-bg-inset:4px;--segmented-control-button-bgColor-hover:var(--controlTrack-bgColor-hover,#e0e6eb);background-color:var(--controlTrack-bgColor-rest,#e6eaef);border:var(--borderWidth-thin,.0625rem) solid var(--controlTrack-borderColor-rest,transparent)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):not([data-variant-wide=subtle]):before{display:block}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):not([data-variant-wide=subtle]) .prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:var(--borderColor-default,#d1d9e0)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):not([data-variant-wide=subtle])>[data-component="SegmentedControl.Divider"]{display:none}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):not([data-variant-wide=subtle]) .prc-SegmentedControl-Button-E48xz{border-radius:var(--segmented-control-outer-radius);color:currentColor;padding:var(--segmented-control-button-bg-inset)}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):not([data-variant-wide=subtle]) .prc-SegmentedControl-Button-E48xz .prc-SegmentedControl-Content-1COlk{border:var(--borderWidth-thin,.0625rem) solid transparent;padding-inline:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset))}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):not([data-variant-wide=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true]{color:currentColor;padding:0}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-variant-regular=subtle]):not([data-variant-wide=subtle]) .prc-SegmentedControl-Button-E48xz[aria-pressed=true] .prc-SegmentedControl-Content-1COlk{background-color:transparent;padding-inline:var(--segmented-control-button-inner-padding)}}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-size=small]){font-size:var(--text-body-size-small,.75rem);height:28px}.prc-SegmentedControl-DropdownGroup-9SmpX{--segmented-control-action-size:32px;--segmented-control-list-flex:0 1 auto;align-items:center;display:inline-flex;gap:var(--base-size-4,.25rem)}.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width=true]{width:100%;--segmented-control-list-flex:1 1 auto}.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width=false]{width:auto}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width-narrow=true]{width:100%;--segmented-control-list-flex:1 1 auto}.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width-narrow=false]{width:auto}}@media (min-width:48rem){.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width-regular=true]{width:100%;--segmented-control-list-flex:1 1 auto}.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width-regular=false]{width:auto}}@media (min-width:87.5rem){.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width-wide=true]{width:100%;--segmented-control-list-flex:1 1 auto}.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width-wide=false]{width:auto}.prc-SegmentedControl-DropdownGroup-9SmpX[data-full-width-regular=true]:not([data-full-width-wide=true]){width:auto;--segmented-control-list-flex:0 1 auto}}.prc-SegmentedControl-DropdownGroup-9SmpX[data-size=small]{--segmented-control-action-size:28px}.prc-SegmentedControl-DropdownGroup-9SmpX>.prc-SegmentedControl-SegmentedControl-lqIXp{flex:var(--segmented-control-list-flex);min-width:0}.prc-SegmentedControl-InlineAction-4qmw0{display:flex}.prc-SegmentedControl-InlineAction-4qmw0[data-variant=dropdown]{display:none}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-InlineAction-4qmw0[data-variant-narrow=dropdown]{display:none}}@media (min-width:48rem){.prc-SegmentedControl-InlineAction-4qmw0[data-variant-regular=dropdown]{display:none}}@media (min-width:87.5rem){.prc-SegmentedControl-InlineAction-4qmw0[data-variant-wide=dropdown]{display:none}}.prc-SegmentedControl-DropdownContainer-ZaPMn{display:none}.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant=dropdown]{display:block}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-narrow=dropdown]{display:block}}@media (min-width:48rem){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-regular=dropdown]{display:block}}@media (min-width:87.5rem){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-wide=dropdown]{display:block}}.prc-SegmentedControl-Item-tSCQh{display:block;flex-grow:1;margin-bottom:-1px;margin-top:-1px;position:relative}.prc-SegmentedControl-Item-tSCQh:not(:last-child){margin-right:1px}.prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:var(--borderColor-default,#d1d9e0);bottom:var(--base-size-8,.5rem);content:"";position:absolute;right:calc(var(--base-size-2,.125rem)*-1);top:var(--base-size-8,.5rem);width:1px}.prc-SegmentedControl-Item-tSCQh:not(:last-child):has(+:where([data-component="SegmentedControl.Divider"])+:where([data-selected])):after,.prc-SegmentedControl-Item-tSCQh:not(:last-child):has(+[data-selected]):after,.prc-SegmentedControl-Item-tSCQh:not(:last-child):where([data-selected]):after{background-color:transparent}.prc-SegmentedControl-Item-tSCQh:first-child{margin-left:-1px}.prc-SegmentedControl-Item-tSCQh:last-child{margin-right:-1px}.prc-SegmentedControl-Item-tSCQh .prc-SegmentedControl-Counter-GmZOI{grid-column:3;margin-inline-start:var(--base-size-8,.5rem)}.prc-SegmentedControl-ActionItem-2V1ou,.prc-SegmentedControl-Item-tSCQh .prc-SegmentedControl-Counter-GmZOI{align-items:center;display:flex}.prc-SegmentedControl-ActionItem-2V1ou{margin-inline-start:0}.prc-SegmentedControl-ActionButton-Q5fnw{height:var(--segmented-control-action-size);padding:0;width:var(--segmented-control-action-size)}.prc-SegmentedControl-Button-E48xz{--segmented-control-button-inner-padding:12px;--segmented-control-button-bg-inset:4px;background-color:transparent;border-color:transparent;border-radius:var(--segmented-control-outer-radius);border-width:0;color:currentColor;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:var(--base-text-weight-normal,400);height:100%;padding:var(--segmented-control-button-bg-inset);width:100%}.prc-SegmentedControl-Button-E48xz svg{fill:var(--fgColor-muted,#59636e);color:var(--fgColor-muted,#59636e)}.prc-SegmentedControl-Button-E48xz:focus:not(:disabled){box-shadow:none;outline:var(--base-size-2,.125rem) solid var(--fgColor-accent,#0969da);outline-offset:-1px}.prc-SegmentedControl-Button-E48xz:focus:not(:disabled):not(:focus-visible){outline:1px solid transparent}.prc-SegmentedControl-Button-E48xz:focus-visible:not(:disabled){box-shadow:none;outline:var(--base-size-2,.125rem) solid var(--fgColor-accent,#0969da);outline-offset:-1px}.prc-SegmentedControl-Button-E48xz:focus:focus-visible:not(:last-child):after{width:0}.prc-SegmentedControl-Button-E48xz[aria-disabled=true]:not([aria-pressed=true]){background-color:transparent;color:var(--fgColor-disabled,#818b98);cursor:not-allowed}.prc-SegmentedControl-Button-E48xz[aria-disabled=true]:not([aria-pressed=true]) svg{fill:var(--fgColor-disabled,#818b98);color:var(--fgColor-disabled,#818b98)}@media (pointer:coarse){.prc-SegmentedControl-Button-E48xz:before{content:"";left:0;min-height:44px;position:absolute;right:0;top:50%;transform:translateY(-50%)}}.prc-SegmentedControl-IconButton-tlzDE{width:var(--segmented-control-icon-width,32px)}.prc-SegmentedControl-Content-1COlk{align-items:center;background-color:transparent;border-color:transparent;border-radius:calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset)/2);border-style:solid;border-width:var(--borderWidth-thin,.0625rem);display:grid;grid-template-columns:auto minmax(0,max-content) auto;height:100%;justify-content:center;padding-left:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));padding-right:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));transition:background-color var(--base-duration-200,[ object Object ]) var(--base-easing-easeInOut,.6,0,.2,1)}.prc-SegmentedControl-Button-E48xz[aria-pressed=true]{font-weight:var(--base-text-weight-semibold,600);padding:0}.prc-SegmentedControl-Button-E48xz[aria-pressed=true] .prc-SegmentedControl-Content-1COlk{padding-left:var(--segmented-control-button-inner-padding);padding-right:var(--segmented-control-button-inner-padding);anchor-name:--segmented-control-current-item}@supports not (anchor-name:--value){.prc-SegmentedControl-Button-E48xz[aria-pressed=true] .prc-SegmentedControl-Content-1COlk{background-color:var(--controlKnob-bgColor-rest,#fff);border-color:var(--controlKnob-borderColor-rest,#d1d9e0);border-radius:var(--segmented-control-outer-radius)}}.prc-SegmentedControl-Button-E48xz:not([aria-pressed=true],[aria-disabled=true]):hover .prc-SegmentedControl-Content-1COlk{background-color:var(--segmented-control-button-bgColor-hover,var(--controlTrack-bgColor-hover,#e0e6eb))}.prc-SegmentedControl-Button-E48xz:not([aria-pressed=true],[aria-disabled=true]):active .prc-SegmentedControl-Content-1COlk{background-color:var(--controlTrack-bgColor-active,#dae0e7)}.prc-SegmentedControl-Text-7S2y2{grid-column:2;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.prc-SegmentedControl-Text-7S2y2:after{content:attr(data-text);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none;visibility:hidden}.prc-SegmentedControl-LeadingIcon-74n5s{grid-column:1;margin-right:var(--base-size-4,.25rem)}
2
+ /*# sourceMappingURL=SegmentedControl-3dc28307.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SegmentedControl/SegmentedControl.module.css.js"],"names":[],"mappings":"AA0FA,6CAEE,mCAAoC,CACpC,oEAA4D,CAU5D,yDAA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,OACF,CAEA,gFAGE,4BAA6B,CAD7B,qCAA8B,CAD9B,kBAQF,CAJE,oFACE,oCAA6B,CAC7B,qCACF,CAGF,wBACE,0CAME,UAAW,CAFX,MAAO,CACP,eAAgB,CAJhB,iBAAkB,CAElB,OAAQ,CADR,OAAQ,CAKR,0BACF,CACF,CAGF,uCACE,8CACF,CAEA,oCAoBE,kBAAmB,CATnB,4BAA6B,CAH7B,wBAAyB,CAWzB,sGAAyG,CAVzG,kBAAmB,CACnB,6CAAqC,CATrC,YAAa,CACb,qDAAuD,CACvD,WAAY,CAkBZ,sBAAuB,CAdvB,2GAA4G,CAF5G,4GAA6G,CAO7G,6GAUF,CAEA,sDAEE,gDAA6C,CAD7C,SAiBF,CAdE,0FAIE,0DAA2D,CAF3D,2DAA4D,CAG5D,4CAQF,CANE,oCAPF,0FAQI,qDAAiD,CACjD,wDAAiD,CAEjD,mDAEJ,CADE,CAKF,2HAEE,wGACF,CAEA,4HACE,2DACF,CAGF,iCACE,aAAc,CACd,WAAY,CACZ,eAAgB,CAChB,sBAAuB,CACvB,kBACF,CAEA,uCAOE,uBAAwB,CANxB,aAAc,CAGd,gDAA6C,CAF7C,QAAS,CACT,eAAgB,CAEhB,mBAAoB,CAGpB,wBAAiB,CAAjB,gBAAiB,CAFjB,iBAGF,CAEA,wCACE,aAAc,CACd,sCACF","file":"SegmentedControl-3dc28307.css","sourcesContent":["@define-mixin subtleVariant {\n --segmented-control-outer-radius: var(--borderRadius-large);\n --segmented-control-button-bg-inset: 0px;\n --segmented-control-button-bgColor-hover: var(--button-invisible-bgColor-hover);\n\n background-color: transparent;\n border: 0;\n\n /* stylelint-disable-next-line nesting-selector-no-missing-scoping-root */\n &::before {\n display: none;\n }\n\n .Item:not(:last-child)::after {\n background-color: transparent;\n }\n\n > [data-component='SegmentedControl.Divider'] {\n display: block;\n }\n\n .Button {\n padding: 0;\n color: var(--fgColor-muted);\n border: 0;\n border-radius: var(--borderRadius-large);\n\n .Content {\n padding-inline: var(--base-size-12);\n border: 0;\n }\n }\n\n .Button[aria-pressed='true'] {\n color: var(--fgColor-default);\n\n .Content {\n background-color: var(--bgColor-muted);\n }\n }\n}\n\n@define-mixin defaultVariant {\n --segmented-control-outer-radius: var(--borderRadius-medium);\n --segmented-control-button-bg-inset: 4px;\n --segmented-control-button-bgColor-hover: var(--controlTrack-bgColor-hover);\n\n background-color: var(--controlTrack-bgColor-rest);\n border: var(--borderWidth-thin) solid var(--controlTrack-borderColor-rest, transparent);\n\n /* stylelint-disable-next-line nesting-selector-no-missing-scoping-root */\n &::before {\n display: block;\n }\n\n .Item:not(:last-child)::after {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-default);\n }\n\n > [data-component='SegmentedControl.Divider'] {\n display: none;\n }\n\n .Button {\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--segmented-control-button-bg-inset);\n color: currentColor;\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n\n .Content {\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n border: var(--borderWidth-thin) solid transparent;\n }\n }\n\n .Button[aria-pressed='true'] {\n padding: 0;\n color: currentColor;\n\n .Content {\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: var(--segmented-control-button-inner-padding);\n background-color: transparent;\n }\n }\n}\n\n.SegmentedControl {\n /* TODO: use primitive `control.medium.size` when it is available instead of '32px' */\n --segmented-control-icon-width: 32px;\n --segmented-control-outer-radius: var(--borderRadius-medium);\n\n display: inline-flex;\n max-width: 100%;\n\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 32px;\n padding: 0;\n margin: 0;\n font-size: var(--text-body-size-medium);\n background-color: var(--controlTrack-bgColor-rest);\n border: var(--borderWidth-thin) solid var(--controlTrack-borderColor-rest, transparent);\n border-radius: var(--borderRadius-medium);\n position: relative;\n\n @supports (anchor-name: --value) {\n &::before {\n position-anchor: --segmented-control-current-item;\n content: '';\n position: absolute;\n inset: anchor(top) anchor(right) anchor(bottom) anchor(left);\n background-color: var(--controlKnob-bgColor-rest);\n border: var(--borderWidth-thin) solid var(--controlKnob-borderColor-rest);\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n\n @media (prefers-reduced-motion: no-preference) {\n transition: inset var(--base-duration-200) var(--base-easing-easeInOut);\n }\n }\n\n &[data-disable-knob-transition]::before {\n transition: none;\n }\n }\n\n /* Responsive full-width */\n &[data-full-width='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n > [data-component='SegmentedControl.Divider'] {\n display: none;\n align-self: stretch;\n width: 1px;\n margin-block: var(--base-size-8);\n margin-inline-start: var(--base-size-8);\n /* stylelint-disable-next-line primer/spacing -- preserve the previous divider's 16px layout footprint */\n margin-inline-end: calc(var(--base-size-8) - 1px);\n list-style: none;\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-default);\n }\n\n @media (--viewportRange-narrow) {\n &[data-full-width-narrow='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-narrow='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-full-width-regular='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-regular='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-full-width-wide='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-wide='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n &[data-full-width-regular='true']:not([data-full-width-wide='true']) {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n /* Hide when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: none;\n }\n\n &:where([data-variant='subtle']) {\n @mixin subtleVariant;\n }\n\n /* Handle hideLabels variant - hide button text */\n &[data-variant='hideLabels'] .Text {\n display: none;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: none;\n }\n\n &[data-variant-narrow='hideLabels'] .Text {\n display: none;\n }\n\n &:where([data-variant-narrow='subtle']) {\n @mixin subtleVariant;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: none;\n }\n\n &[data-variant-regular='hideLabels'] .Text {\n display: none;\n }\n\n &:where([data-variant-regular='subtle']) {\n @mixin subtleVariant;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: none;\n }\n\n &[data-variant-wide='hideLabels'] .Text {\n display: none;\n }\n\n &:where([data-variant-wide='subtle']) {\n @mixin subtleVariant;\n }\n\n &:where([data-variant-regular='subtle']):not([data-variant-wide='subtle']) {\n @mixin defaultVariant;\n }\n }\n\n &:where([data-size='small']) {\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 28px;\n font-size: var(--text-body-size-small);\n }\n}\n\n.DropdownGroup {\n --segmented-control-action-size: 32px;\n --segmented-control-list-flex: 0 1 auto;\n\n display: inline-flex;\n align-items: center;\n gap: var(--base-size-4);\n\n &[data-full-width='true'] {\n width: 100%;\n\n --segmented-control-list-flex: 1 1 auto;\n }\n\n &[data-full-width='false'] {\n width: auto;\n }\n\n @media (--viewportRange-narrow) {\n &[data-full-width-narrow='true'] {\n width: 100%;\n\n --segmented-control-list-flex: 1 1 auto;\n }\n\n &[data-full-width-narrow='false'] {\n width: auto;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-full-width-regular='true'] {\n width: 100%;\n\n --segmented-control-list-flex: 1 1 auto;\n }\n\n &[data-full-width-regular='false'] {\n width: auto;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-full-width-wide='true'] {\n width: 100%;\n\n --segmented-control-list-flex: 1 1 auto;\n }\n\n &[data-full-width-wide='false'] {\n width: auto;\n }\n\n &[data-full-width-regular='true']:not([data-full-width-wide='true']) {\n width: auto;\n\n --segmented-control-list-flex: 0 1 auto;\n }\n }\n\n &[data-size='small'] {\n --segmented-control-action-size: 28px;\n }\n\n > .SegmentedControl {\n min-width: 0;\n flex: var(--segmented-control-list-flex);\n }\n}\n\n.InlineAction {\n display: flex;\n\n &[data-variant='dropdown'] {\n display: none;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: none;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: none;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: none;\n }\n }\n}\n\n.DropdownContainer {\n display: none;\n\n /* Show when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: block;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: block;\n }\n }\n}\n\n.Item {\n position: relative;\n display: block;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: -1px;\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n flex-grow: 1;\n\n &:not(:last-child) {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: 1px;\n\n &::after {\n position: absolute;\n top: var(--base-size-8);\n right: calc(-1 * var(--base-size-2));\n bottom: var(--base-size-8);\n width: 1px;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-default);\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(+ [data-selected])::after,\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- account for a hidden divider in the default variant */\n &:has(+ :where([data-component='SegmentedControl.Divider']) + :where([data-selected]))::after,\n &:where([data-selected])::after {\n background-color: transparent;\n }\n }\n\n &:first-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -1px;\n }\n\n &:last-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: -1px;\n }\n\n .Counter {\n grid-column: 3;\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n }\n}\n\n.ActionItem {\n display: flex;\n align-items: center;\n margin-inline-start: 0;\n}\n\n.ActionButton {\n width: var(--segmented-control-action-size);\n height: var(--segmented-control-action-size);\n padding: 0;\n}\n\n.Button {\n /* TODO: use primitive `primer.control.medium.paddingInline.normal` when it is available */\n --segmented-control-button-inner-padding: 12px;\n --segmented-control-button-bg-inset: 4px;\n\n width: 100%;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--segmented-control-button-bg-inset);\n font-family: inherit;\n font-size: inherit;\n font-weight: var(--base-text-weight-normal);\n color: currentColor;\n cursor: pointer;\n background-color: transparent;\n border-color: transparent;\n border-width: 0;\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n\n & svg {\n fill: var(--fgColor-muted);\n color: var(--fgColor-muted);\n }\n\n /* fallback :focus state */\n &:focus:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n }\n }\n\n /* default focus state */\n &:focus-visible:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n }\n\n /* stylelint-disable-next-line selector-max-specificity */\n &:focus:focus-visible:not(:last-child)::after {\n /* fixes an issue where the focus outline shows over the pseudo-element */\n width: 0;\n }\n\n &[aria-disabled='true']:not([aria-pressed='true']) {\n cursor: not-allowed;\n color: var(--fgColor-disabled);\n background-color: transparent;\n\n & svg {\n fill: var(--fgColor-disabled);\n color: var(--fgColor-disabled);\n }\n }\n\n @media (pointer: coarse) {\n &::before {\n position: absolute;\n top: 50%;\n right: 0;\n left: 0;\n min-height: 44px;\n content: '';\n transform: translateY(-50%);\n }\n }\n}\n\n.IconButton {\n width: var(--segmented-control-icon-width, 32px);\n}\n\n.Content {\n display: grid;\n grid-template-columns: auto minmax(0, max-content) auto;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding-right: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n /* stylelint-disable-next-line primer/spacing */\n padding-left: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n border-color: transparent;\n border-style: solid;\n border-width: var(--borderWidth-thin);\n background-color: transparent;\n transition: background-color var(--base-duration-200) var(--base-easing-easeInOut);\n\n /*\n innerRadius = outerRadius - distance/2\n https://stackoverflow.com/questions/2932146/math-problem-determine-the-corner-radius-of-an-inner-border-based-on-outer-corn\n */\n /* stylelint-disable-next-line primer/borders */\n border-radius: calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset) / 2);\n align-items: center;\n justify-content: center;\n}\n\n.Button[aria-pressed='true'] {\n padding: 0;\n font-weight: var(--base-text-weight-semibold);\n\n .Content {\n /* stylelint-disable-next-line primer/spacing */\n padding-right: var(--segmented-control-button-inner-padding);\n /* stylelint-disable-next-line primer/spacing */\n padding-left: var(--segmented-control-button-inner-padding);\n anchor-name: --segmented-control-current-item;\n\n @supports not (anchor-name: --value) {\n background-color: var(--controlKnob-bgColor-rest);\n border-color: var(--controlKnob-borderColor-rest);\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n }\n }\n}\n\n.Button:not([aria-pressed='true'], [aria-disabled='true']) {\n &:hover .Content {\n /* stylelint-disable-next-line primer/colors -- each variant supplies a semantic background token */\n background-color: var(--segmented-control-button-bgColor-hover, var(--controlTrack-bgColor-hover));\n }\n\n &:active .Content {\n background-color: var(--controlTrack-bgColor-active);\n }\n}\n\n.Text {\n grid-column: 2;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.Text::after {\n display: block;\n height: 0;\n overflow: hidden;\n font-weight: var(--base-text-weight-semibold);\n pointer-events: none;\n visibility: hidden;\n content: attr(data-text);\n user-select: none;\n}\n\n.LeadingIcon {\n grid-column: 1;\n margin-right: var(--base-size-4);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import "./SegmentedControl-99b8e34e.css";
1
+ import "./SegmentedControl-3dc28307.css";
2
2
  //#region src/SegmentedControl/SegmentedControl.module.css.js
3
3
  var SegmentedControl_module_css_default = {
4
4
  "SegmentedControl": "prc-SegmentedControl-SegmentedControl-lqIXp",
@@ -1,12 +1,16 @@
1
1
  import { c } from "../utils/react-compiler-runtime.js";
2
+ import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
3
+ import { useResizeObserver } from "../hooks/useResizeObserver.js";
2
4
  import CounterLabel from "../CounterLabel/CounterLabel.js";
5
+ import { Tooltip } from "../TooltipV2/Tooltip.js";
3
6
  import SegmentedControl_module_css_default from "./SegmentedControl.module.css.js";
7
+ import { useRef, useState } from "react";
4
8
  import { jsx, jsxs } from "react/jsx-runtime";
5
9
  import { clsx } from "clsx";
6
10
  import { isElement } from "react-is";
7
11
  //#region src/SegmentedControl/SegmentedControlButton.tsx
8
12
  const SegmentedControlButton = (t0) => {
9
- const $ = c(36);
13
+ const $ = c(44);
10
14
  let children;
11
15
  let className;
12
16
  let count;
@@ -55,103 +59,142 @@ const SegmentedControlButton = (t0) => {
55
59
  ariaDisabled = $[10];
56
60
  rest = $[11];
57
61
  }
58
- const LeadingVisual = leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : leadingIcon;
62
+ const labelRef = useRef(null);
63
+ const [isTruncated, setIsTruncated] = useState(false);
59
64
  let t1;
60
65
  if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
61
- t1 = clsx(SegmentedControl_module_css_default.Item);
66
+ t1 = () => {
67
+ const label = labelRef.current;
68
+ if (label) setIsTruncated(label.scrollWidth > label.clientWidth);
69
+ };
62
70
  $[12] = t1;
63
71
  } else t1 = $[12];
64
- const t2 = selected ? "" : void 0;
65
- const t3 = disabled || ariaDisabled || void 0;
66
- let t4;
67
- if ($[13] !== className) {
68
- t4 = clsx(SegmentedControl_module_css_default.Button, className);
69
- $[13] = className;
70
- $[14] = t4;
71
- } else t4 = $[14];
72
- let t5;
73
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
74
- t5 = clsx(SegmentedControl_module_css_default.Content, "segmentedControl-content");
75
- $[15] = t5;
76
- } else t5 = $[15];
77
- let t6;
78
- if ($[16] !== LeadingVisual) {
79
- t6 = LeadingVisual && /* @__PURE__ */ jsx("div", {
72
+ const updateTruncation = t1;
73
+ useResizeObserver(updateTruncation, labelRef);
74
+ let t2;
75
+ if ($[13] !== children || $[14] !== selected) {
76
+ t2 = [
77
+ children,
78
+ selected,
79
+ updateTruncation
80
+ ];
81
+ $[13] = children;
82
+ $[14] = selected;
83
+ $[15] = t2;
84
+ } else t2 = $[15];
85
+ useIsomorphicLayoutEffect(updateTruncation, t2);
86
+ const LeadingVisual = leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : leadingIcon;
87
+ let t3;
88
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
89
+ t3 = clsx(SegmentedControl_module_css_default.Item);
90
+ $[16] = t3;
91
+ } else t3 = $[16];
92
+ const t4 = selected ? "" : void 0;
93
+ const t5 = isTruncated ? children : "";
94
+ const t6 = !isTruncated;
95
+ const t7 = disabled || ariaDisabled || void 0;
96
+ let t8;
97
+ if ($[17] !== className) {
98
+ t8 = clsx(SegmentedControl_module_css_default.Button, className);
99
+ $[17] = className;
100
+ $[18] = t8;
101
+ } else t8 = $[18];
102
+ let t9;
103
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
104
+ t9 = clsx(SegmentedControl_module_css_default.Content, "segmentedControl-content");
105
+ $[19] = t9;
106
+ } else t9 = $[19];
107
+ let t10;
108
+ if ($[20] !== LeadingVisual) {
109
+ t10 = LeadingVisual && /* @__PURE__ */ jsx("div", {
80
110
  className: SegmentedControl_module_css_default.LeadingIcon,
81
111
  children: isElement(LeadingVisual) ? LeadingVisual : /* @__PURE__ */ jsx(LeadingVisual, {})
82
112
  });
83
- $[16] = LeadingVisual;
84
- $[17] = t6;
85
- } else t6 = $[17];
86
- let t7;
87
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
88
- t7 = clsx(SegmentedControl_module_css_default.Text, "segmentedControl-text");
89
- $[18] = t7;
90
- } else t7 = $[18];
91
- let t8;
92
- if ($[19] !== children) {
93
- t8 = /* @__PURE__ */ jsx("div", {
94
- className: t7,
113
+ $[20] = LeadingVisual;
114
+ $[21] = t10;
115
+ } else t10 = $[21];
116
+ let t11;
117
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
118
+ t11 = clsx(SegmentedControl_module_css_default.Text, "segmentedControl-text");
119
+ $[22] = t11;
120
+ } else t11 = $[22];
121
+ let t12;
122
+ if ($[23] !== children) {
123
+ t12 = /* @__PURE__ */ jsx("div", {
124
+ ref: labelRef,
125
+ className: t11,
95
126
  "data-text": children,
96
127
  children
97
128
  });
98
- $[19] = children;
99
- $[20] = t8;
100
- } else t8 = $[20];
101
- let t9;
102
- if ($[21] !== count) {
103
- t9 = count !== void 0 && /* @__PURE__ */ jsx("span", {
129
+ $[23] = children;
130
+ $[24] = t12;
131
+ } else t12 = $[24];
132
+ let t13;
133
+ if ($[25] !== count) {
134
+ t13 = count !== void 0 && /* @__PURE__ */ jsx("span", {
104
135
  className: SegmentedControl_module_css_default.Counter,
105
136
  children: /* @__PURE__ */ jsx(CounterLabel, { children: count })
106
137
  });
107
- $[21] = count;
108
- $[22] = t9;
109
- } else t9 = $[22];
110
- let t10;
111
- if ($[23] !== t6 || $[24] !== t8 || $[25] !== t9) {
112
- t10 = /* @__PURE__ */ jsxs("span", {
113
- className: t5,
138
+ $[25] = count;
139
+ $[26] = t13;
140
+ } else t13 = $[26];
141
+ let t14;
142
+ if ($[27] !== t10 || $[28] !== t12 || $[29] !== t13) {
143
+ t14 = /* @__PURE__ */ jsxs("span", {
144
+ className: t9,
114
145
  children: [
115
- t6,
116
- t8,
117
- t9
146
+ t10,
147
+ t12,
148
+ t13
118
149
  ]
119
150
  });
120
- $[23] = t6;
121
- $[24] = t8;
122
- $[25] = t9;
123
- $[26] = t10;
124
- } else t10 = $[26];
125
- let t11;
126
- if ($[27] !== rest || $[28] !== selected || $[29] !== t10 || $[30] !== t3 || $[31] !== t4) {
127
- t11 = /* @__PURE__ */ jsx("button", {
151
+ $[27] = t10;
152
+ $[28] = t12;
153
+ $[29] = t13;
154
+ $[30] = t14;
155
+ } else t14 = $[30];
156
+ let t15;
157
+ if ($[31] !== rest || $[32] !== selected || $[33] !== t14 || $[34] !== t7 || $[35] !== t8) {
158
+ t15 = /* @__PURE__ */ jsx("button", {
128
159
  "aria-pressed": selected,
129
- "aria-disabled": t3,
130
- className: t4,
160
+ "aria-disabled": t7,
161
+ className: t8,
131
162
  type: "button",
132
163
  ...rest,
133
- children: t10
164
+ children: t14
134
165
  });
135
- $[27] = rest;
136
- $[28] = selected;
137
- $[29] = t10;
138
- $[30] = t3;
139
- $[31] = t4;
140
- $[32] = t11;
141
- } else t11 = $[32];
142
- let t12;
143
- if ($[33] !== t11 || $[34] !== t2) {
144
- t12 = /* @__PURE__ */ jsx("li", {
145
- className: t1,
146
- "data-selected": t2,
166
+ $[31] = rest;
167
+ $[32] = selected;
168
+ $[33] = t14;
169
+ $[34] = t7;
170
+ $[35] = t8;
171
+ $[36] = t15;
172
+ } else t15 = $[36];
173
+ let t16;
174
+ if ($[37] !== t15 || $[38] !== t5 || $[39] !== t6) {
175
+ t16 = /* @__PURE__ */ jsx(Tooltip, {
176
+ text: t5,
177
+ _privateDisableTooltip: t6,
178
+ children: t15
179
+ });
180
+ $[37] = t15;
181
+ $[38] = t5;
182
+ $[39] = t6;
183
+ $[40] = t16;
184
+ } else t16 = $[40];
185
+ let t17;
186
+ if ($[41] !== t16 || $[42] !== t4) {
187
+ t17 = /* @__PURE__ */ jsx("li", {
188
+ className: t3,
189
+ "data-selected": t4,
147
190
  "data-component": "SegmentedControl.Button",
148
- children: t11
191
+ children: t16
149
192
  });
150
- $[33] = t11;
151
- $[34] = t2;
152
- $[35] = t12;
153
- } else t12 = $[35];
154
- return t12;
193
+ $[41] = t16;
194
+ $[42] = t4;
195
+ $[43] = t17;
196
+ } else t17 = $[43];
197
+ return t17;
155
198
  };
156
199
  SegmentedControlButton.__SLOT__ = Symbol("SegmentedControl.Button");
157
200
  //#endregion
@@ -17,7 +17,7 @@ type TooltipProps = React.PropsWithChildren<{
17
17
  */
18
18
  delay?: 'short' | 'medium' | 'long';
19
19
  /**
20
- * Private API for use internally only. Prevents the tooltip from opening if `true`.
20
+ * Private API for use internally only. Closes the tooltip and prevents it from opening if `true`.
21
21
  *
22
22
  * Accessibility note: This prop should be used with caution. Only use when needing to
23
23
  * programmatically close the tooltip in response to a specific user action, such as