@primer/react 0.0.0-20260610121450 → 0.0.0-20260610122713

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +55 -3
  2. package/dist/ActionList/ActionList-1940009e.css +2 -0
  3. package/dist/ActionList/ActionList-1940009e.css.map +1 -0
  4. package/dist/ActionList/ActionList.module.css.js +2 -2
  5. package/dist/ActionList/Item.d.ts.map +1 -1
  6. package/dist/ActionList/Item.js +125 -118
  7. package/dist/ActionList/TrailingAction.d.ts.map +1 -1
  8. package/dist/ActionList/TrailingAction.js +1 -0
  9. package/dist/ActionList/Visuals.js +6 -4
  10. package/dist/AnchoredOverlay/{AnchoredOverlay-a367c798.css → AnchoredOverlay-83281f45.css} +1 -1
  11. package/dist/AnchoredOverlay/AnchoredOverlay-83281f45.css.map +1 -0
  12. package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +1 -1
  13. package/dist/Autocomplete/AutocompleteInput.d.ts.map +1 -1
  14. package/dist/Autocomplete/AutocompleteInput.js +14 -2
  15. package/dist/Card/Card-59b77d05.css +2 -0
  16. package/dist/Card/Card-59b77d05.css.map +1 -0
  17. package/dist/Card/Card.d.ts +18 -0
  18. package/dist/Card/Card.d.ts.map +1 -1
  19. package/dist/Card/Card.js +165 -154
  20. package/dist/Card/Card.module.css.js +1 -1
  21. package/dist/Card/index.d.ts +2 -0
  22. package/dist/Card/index.d.ts.map +1 -1
  23. package/dist/Dialog/Dialog.d.ts +1 -0
  24. package/dist/Dialog/Dialog.d.ts.map +1 -1
  25. package/dist/Dialog/Dialog.js +16 -2
  26. package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
  27. package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
  28. package/dist/InlineMessage/InlineMessage-cd1e4c93.css +2 -0
  29. package/dist/InlineMessage/InlineMessage-cd1e4c93.css.map +1 -0
  30. package/dist/InlineMessage/InlineMessage.d.ts +1 -1
  31. package/dist/InlineMessage/InlineMessage.d.ts.map +1 -1
  32. package/dist/InlineMessage/InlineMessage.js +34 -19
  33. package/dist/InlineMessage/InlineMessage.module.css.js +1 -1
  34. package/dist/KeybindingHint/KeybindingHint.d.ts +6 -1
  35. package/dist/KeybindingHint/KeybindingHint.d.ts.map +1 -1
  36. package/dist/KeybindingHint/KeybindingHint.js +6 -2
  37. package/dist/KeybindingHint/components/Chord.d.ts +2 -1
  38. package/dist/KeybindingHint/components/Chord.d.ts.map +1 -1
  39. package/dist/KeybindingHint/components/Chord.js +1 -1
  40. package/dist/KeybindingHint/components/Key.js +10 -10
  41. package/dist/KeybindingHint/components/Sequence.d.ts +2 -1
  42. package/dist/KeybindingHint/components/Sequence.d.ts.map +1 -1
  43. package/dist/KeybindingHint/components/Sequence.js +2 -2
  44. package/dist/KeybindingHint/key-names.d.ts +4 -3
  45. package/dist/KeybindingHint/key-names.d.ts.map +1 -1
  46. package/dist/KeybindingHint/key-names.js +15 -14
  47. package/dist/KeybindingHint/platform.d.ts +22 -0
  48. package/dist/KeybindingHint/platform.d.ts.map +1 -0
  49. package/dist/KeybindingHint/platform.js +61 -0
  50. package/dist/PageHeader/PageHeader.d.ts.map +1 -1
  51. package/dist/PageHeader/PageHeader.js +6 -0
  52. package/dist/PageLayout/PageLayout.d.ts +24 -6
  53. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  54. package/dist/PageLayout/PageLayout.js +16 -2
  55. package/dist/Pagehead/Pagehead.js +1 -0
  56. package/dist/Popover/Popover.d.ts.map +1 -1
  57. package/dist/Popover/Popover.js +2 -0
  58. package/dist/Portal/Portal.d.ts.map +1 -1
  59. package/dist/Portal/Portal.js +1 -0
  60. package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
  61. package/dist/ProgressBar/ProgressBar.js +2 -0
  62. package/dist/Text/{Text-ca7603b7.css → Text-d649cda5.css} +2 -2
  63. package/dist/Text/Text-d649cda5.css.map +1 -0
  64. package/dist/Text/Text.d.ts +3 -0
  65. package/dist/Text/Text.d.ts.map +1 -1
  66. package/dist/Text/Text.js +20 -14
  67. package/dist/Text/Text.module.css.js +1 -1
  68. package/dist/Timeline/Timeline-ff81db92.css +2 -0
  69. package/dist/Timeline/Timeline-ff81db92.css.map +1 -0
  70. package/dist/Timeline/Timeline.d.ts +9 -8
  71. package/dist/Timeline/Timeline.d.ts.map +1 -1
  72. package/dist/Timeline/Timeline.js +156 -61
  73. package/dist/Timeline/Timeline.module.css.js +1 -1
  74. package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
  75. package/dist/TooltipV2/Tooltip.js +3 -3
  76. package/dist/TreeView/TreeView-1bf45a33.css +2 -0
  77. package/dist/TreeView/TreeView-1bf45a33.css.map +1 -0
  78. package/dist/TreeView/TreeView.d.ts.map +1 -1
  79. package/dist/TreeView/TreeView.js +25 -12
  80. package/dist/TreeView/TreeView.module.css.js +2 -2
  81. package/generated/components.json +57 -10
  82. package/package.json +9 -9
  83. package/dist/ActionList/ActionList-2a35a40c.css +0 -2
  84. package/dist/ActionList/ActionList-2a35a40c.css.map +0 -1
  85. package/dist/AnchoredOverlay/AnchoredOverlay-a367c798.css.map +0 -1
  86. package/dist/Card/Card-d8a02dd9.css +0 -2
  87. package/dist/Card/Card-d8a02dd9.css.map +0 -1
  88. package/dist/InlineMessage/InlineMessage-80d97643.css +0 -2
  89. package/dist/InlineMessage/InlineMessage-80d97643.css.map +0 -1
  90. package/dist/Text/Text-ca7603b7.css.map +0 -1
  91. package/dist/Timeline/Timeline-0c88f21b.css +0 -2
  92. package/dist/Timeline/Timeline-0c88f21b.css.map +0 -1
  93. package/dist/TreeView/TreeView-0fe09f34.css +0 -2
  94. package/dist/TreeView/TreeView-0fe09f34.css.map +0 -1
  95. package/dist/hooks/useIsMacOS.js +0 -32
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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;;;CAKJ,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAA;AAC5F,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,SAAS,CAAA;AAoEjD,eAAO,MAAM,aAAa,mCAAqD,CAAA;AAmS/E,eAAO,MAAM,MAAM;;;;;;;;;iBA9EuC,iBAAiB,EAAE;;;iBAoCf,MAAM,IAAI;oBAAc,KAAK,CAAC,oBAAoB;;CAkD9G,CAAA"}
@@ -36,6 +36,17 @@ const DefaultHeader = ({
36
36
  const onCloseClick = useCallback(() => {
37
37
  onClose('close-button');
38
38
  }, [onClose]);
39
+ const onCloseKeyDown = useCallback(event => {
40
+ if (event.key === 'Escape') {
41
+ // When the close button is focused its tooltip is open, and the
42
+ // tooltip's own Escape handler (registered on `document`) would
43
+ // otherwise swallow this keypress. Handle Escape here and stop it from
44
+ // reaching the document-level handler so the dialog closes on the first
45
+ // press while keeping the tooltip fully functional.
46
+ event.stopPropagation();
47
+ onClose('escape');
48
+ }
49
+ }, [onClose]);
39
50
  return /*#__PURE__*/jsx(Dialog.Header, {
40
51
  children: /*#__PURE__*/jsxs("div", {
41
52
  className: classes.HeaderInner,
@@ -49,7 +60,8 @@ const DefaultHeader = ({
49
60
  children: subtitle
50
61
  })]
51
62
  }), /*#__PURE__*/jsx(Dialog.CloseButton, {
52
- onClose: onCloseClick
63
+ onClose: onCloseClick,
64
+ onKeyDown: onCloseKeyDown
53
65
  })]
54
66
  })
55
67
  });
@@ -348,12 +360,14 @@ const Buttons = ({
348
360
  });
349
361
  };
350
362
  const CloseButton = ({
351
- onClose
363
+ onClose,
364
+ onKeyDown
352
365
  }) => {
353
366
  return /*#__PURE__*/jsx(IconButton, {
354
367
  icon: XIcon,
355
368
  "aria-label": "Close",
356
369
  onClick: onClose,
370
+ onKeyDown: onKeyDown,
357
371
  variant: "invisible",
358
372
  "data-component": "Dialog.CloseButton"
359
373
  });
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,kBAM9B,CAAA"}
1
+ {"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,kBAO9B,CAAA"}
@@ -5,7 +5,8 @@ const DefaultFeatureFlags = FeatureFlagScope.create({
5
5
  primer_react_select_panel_fullscreen_on_narrow: false,
6
6
  primer_react_select_panel_order_selected_at_top: false,
7
7
  primer_react_styled_react_use_primer_theme_providers: false,
8
- primer_react_action_list_group_heading_trailing_action: false
8
+ primer_react_action_list_group_heading_trailing_action: false,
9
+ primer_react_timeline_list_semantics: false
9
10
  });
10
11
 
11
12
  export { DefaultFeatureFlags };
@@ -0,0 +1,2 @@
1
+ .prc-InlineMessage-InlineMessage-8xfK-{align-items:start;color:var(--inline-message-fgColor);column-gap:.5rem;display:grid;font-size:var(--inline-message-fontSize);grid-template-columns:auto 1fr;line-height:var(--inline-message-lineHeight);--inline-message-fgColor:var(--fgColor-default,#1f2328)}.prc-InlineMessage-InlineMessage-8xfK-[data-size=small]{--inline-message-fontSize:var(--text-body-size-small,0.75rem);--inline-message-lineHeight:var(--text-body-lineHeight-small,1.6666)}.prc-InlineMessage-InlineMessage-8xfK-[data-size=medium]{--inline-message-fontSize:var(--text-body-size-medium,0.875rem);--inline-message-lineHeight:var(--text-body-lineHeight-medium,1.4285)}.prc-InlineMessage-InlineMessage-8xfK-[data-variant=warning]{--inline-message-fgColor:var(--fgColor-attention,#9a6700)}.prc-InlineMessage-InlineMessage-8xfK-[data-variant=critical]{--inline-message-fgColor:var(--fgColor-danger,#d1242f)}.prc-InlineMessage-InlineMessage-8xfK-[data-variant=success]{--inline-message-fgColor:var(--fgColor-success,#1a7f37)}.prc-InlineMessage-InlineMessage-8xfK-[data-variant=unavailable]{--inline-message-fgColor:var(--fgColor-muted,#59636e)}.prc-InlineMessage-InlineMessageIcon-rl8pZ{min-height:calc(var(--inline-message-lineHeight)*var(--inline-message-fontSize))}
2
+ /*# sourceMappingURL=InlineMessage-cd1e4c93.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/InlineMessage/InlineMessage.module.css.js"],"names":[],"mappings":"AAAA,uCAUE,iBAAkB,CAHlB,mCAAoC,CACpC,gBAAkB,CAPlB,YAAa,CAEb,wCAAyC,CAMzC,8BAA+B,CAJ/B,4CAA6C,CAO7C,uDA2BF,CAzBE,wDACE,6DAAsD,CACtD,oEACF,CAEA,yDACE,+DAAuD,CACvD,qEACF,CAEA,6DACE,yDACF,CAEA,8DACE,sDACF,CAEA,6DACE,uDACF,CAEA,iEACE,qDACF,CAGF,2CACE,gFACF","file":"InlineMessage-cd1e4c93.css","sourcesContent":[".InlineMessage {\n display: grid;\n /* stylelint-disable-next-line primer/typography */\n font-size: var(--inline-message-fontSize);\n /* stylelint-disable-next-line primer/typography */\n line-height: var(--inline-message-lineHeight);\n /* stylelint-disable-next-line primer/colors */\n color: var(--inline-message-fgColor);\n column-gap: 0.5rem;\n grid-template-columns: auto 1fr;\n align-items: start;\n\n --inline-message-fgColor: var(--fgColor-default);\n\n &[data-size='small'] {\n --inline-message-fontSize: var(--text-body-size-small);\n --inline-message-lineHeight: var(--text-body-lineHeight-small, 1.6666);\n }\n\n &[data-size='medium'] {\n --inline-message-fontSize: var(--text-body-size-medium);\n --inline-message-lineHeight: var(--text-body-lineHeight-medium, 1.4285);\n }\n\n &[data-variant='warning'] {\n --inline-message-fgColor: var(--fgColor-attention);\n }\n\n &[data-variant='critical'] {\n --inline-message-fgColor: var(--fgColor-danger);\n }\n\n &[data-variant='success'] {\n --inline-message-fgColor: var(--fgColor-success);\n }\n\n &[data-variant='unavailable'] {\n --inline-message-fgColor: var(--fgColor-muted);\n }\n}\n\n.InlineMessageIcon {\n min-height: calc(var(--inline-message-lineHeight) * var(--inline-message-fontSize));\n}\n"]}
@@ -8,7 +8,7 @@ export type InlineMessageProps = React.ComponentPropsWithoutRef<'div'> & {
8
8
  /**
9
9
  * Specify the type of the InlineMessage
10
10
  */
11
- variant: MessageVariant;
11
+ variant?: MessageVariant;
12
12
  /**
13
13
  * A custom leading visual (icon or other element) to display instead of the default variant icon.
14
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"InlineMessage.d.ts","sourceRoot":"","sources":["../../src/InlineMessage/InlineMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,KAAK,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;AAExE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IACvE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAEzB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAA;IAEvB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;CACpD,CAAA;AAgBD,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,IAAe,EACf,OAAO,EACP,aAAa,EAAE,aAAa,EAC5B,GAAG,IAAI,EACR,EAAE,kBAAkB,qBA0BpB"}
1
+ {"version":3,"file":"InlineMessage.d.ts","sourceRoot":"","sources":["../../src/InlineMessage/InlineMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,KAAK,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;AAExE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IACvE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAEzB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IAExB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;CACpD,CAAA;AAgBD,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,IAAe,EACf,OAAO,EACP,aAAa,EAAE,aAAa,EAC5B,GAAG,IAAI,EACR,EAAE,kBAAkB,qBA4BpB"}
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import { AlertIcon, CheckCircleIcon, AlertFillIcon, CheckCircleFillIcon } from '@primer/octicons-react';
2
+ import { AlertIcon, CheckCircleIcon, AlertFillIcon, CheckCircleFillIcon, InfoIcon } from '@primer/octicons-react';
3
3
  import { clsx } from 'clsx';
4
4
  import { isValidElementType } from 'react-is';
5
5
  import classes from './InlineMessage.module.css.js';
@@ -38,7 +38,8 @@ const smallIcons = {
38
38
  })
39
39
  };
40
40
  function InlineMessage(t0) {
41
- const $ = c(18);
41
+ var _variant;
42
+ const $ = c(19);
42
43
  let LeadingVisual;
43
44
  let children;
44
45
  let className;
@@ -88,37 +89,51 @@ function InlineMessage(t0) {
88
89
  icon = LeadingVisual;
89
90
  }
90
91
  } else {
91
- icon = size === "small" ? smallIcons[variant] : icons[variant];
92
+ if (variant) {
93
+ icon = size === "small" ? smallIcons[variant] : icons[variant];
94
+ } else {
95
+ let t2;
96
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
97
+ t2 = /*#__PURE__*/jsx(InfoIcon, {
98
+ className: classes.InlineMessageIcon
99
+ });
100
+ $[9] = t2;
101
+ } else {
102
+ t2 = $[9];
103
+ }
104
+ icon = t2;
105
+ }
92
106
  }
93
107
  let t2;
94
- if ($[9] !== className) {
108
+ if ($[10] !== className) {
95
109
  t2 = clsx(className, classes.InlineMessage);
96
- $[9] = className;
97
- $[10] = t2;
110
+ $[10] = className;
111
+ $[11] = t2;
98
112
  } else {
99
- t2 = $[10];
113
+ t2 = $[11];
100
114
  }
101
- let t3;
102
- if ($[11] !== children || $[12] !== icon || $[13] !== rest || $[14] !== size || $[15] !== t2 || $[16] !== variant) {
103
- t3 = /*#__PURE__*/jsxs("div", {
115
+ const t3 = (_variant = variant) !== null && _variant !== void 0 ? _variant : undefined;
116
+ let t4;
117
+ if ($[12] !== children || $[13] !== icon || $[14] !== rest || $[15] !== size || $[16] !== t2 || $[17] !== t3) {
118
+ t4 = /*#__PURE__*/jsxs("div", {
104
119
  ...rest,
105
120
  className: t2,
106
121
  "data-size": size,
107
- "data-variant": variant,
122
+ "data-variant": t3,
108
123
  "data-component": "InlineMessage",
109
124
  children: [icon, children]
110
125
  });
111
- $[11] = children;
112
- $[12] = icon;
113
- $[13] = rest;
114
- $[14] = size;
115
- $[15] = t2;
116
- $[16] = variant;
126
+ $[12] = children;
127
+ $[13] = icon;
128
+ $[14] = rest;
129
+ $[15] = size;
130
+ $[16] = t2;
117
131
  $[17] = t3;
132
+ $[18] = t4;
118
133
  } else {
119
- t3 = $[17];
134
+ t4 = $[18];
120
135
  }
121
- return t3;
136
+ return t4;
122
137
  }
123
138
 
124
139
  export { InlineMessage };
@@ -1,4 +1,4 @@
1
- import './InlineMessage-80d97643.css';
1
+ import './InlineMessage-cd1e4c93.css';
2
2
 
3
3
  var classes = {"InlineMessage":"prc-InlineMessage-InlineMessage-8xfK-","InlineMessageIcon":"prc-InlineMessage-InlineMessageIcon-rl8pZ"};
4
4
 
@@ -1,4 +1,5 @@
1
1
  import type { KeybindingHintProps } from './props';
2
+ import type { Platform } from './platform';
2
3
  /** Indicates the presence of an available keybinding. */
3
4
  export declare const KeybindingHint: import("react").MemoExoticComponent<({ className, ...props }: KeybindingHintProps) => import("react").JSX.Element>;
4
5
  /**
@@ -8,6 +9,10 @@ export declare const KeybindingHint: import("react").MemoExoticComponent<({ clas
8
9
  *
9
10
  * NOTE that this string should _only_ be used when building `aria-label` or `aria-description` props (never rendered
10
11
  * visibly) and should nearly always also be paired with a visible hint for sighted users.
12
+ *
13
+ * The `platform` argument controls how platform-specific keys (such as `Meta`, `Alt`, and `Mod`) are named. For
14
+ * backwards compatibility, a `boolean` may be passed instead, where `true` is treated as `'apple'` and `false` as
15
+ * `'other'`.
11
16
  */
12
- export declare const getAccessibleKeybindingHintString: (sequence: string, isMacOS: boolean) => string;
17
+ export declare const getAccessibleKeybindingHintString: (sequence: string, platform: Platform | boolean) => string;
13
18
  //# sourceMappingURL=KeybindingHint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KeybindingHint.d.ts","sourceRoot":"","sources":["../../src/KeybindingHint/KeybindingHint.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAoBhD,yDAAyD;AAEzD,eAAO,MAAM,cAAc,gEAAgC,mBAAmB,iCAI5E,CAAA;AAGF;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,gDAA2B,CAAA"}
1
+ {"version":3,"file":"KeybindingHint.d.ts","sourceRoot":"","sources":["../../src/KeybindingHint/KeybindingHint.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAEhD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AAmBxC,yDAAyD;AAEzD,eAAO,MAAM,cAAc,gEAAgC,mBAAmB,iCAI5E,CAAA;AAGF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,GAAI,UAAU,MAAM,EAAE,UAAU,QAAQ,GAAG,OAAO,WACe,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import { memo } from 'react';
3
- import { accessibleSequenceString, Sequence } from './components/Sequence.js';
3
+ import { Sequence, accessibleSequenceString } from './components/Sequence.js';
4
4
  import classes from './KeybindingHint.module.css.js';
5
5
  import { clsx } from 'clsx';
6
6
  import { jsx } from 'react/jsx-runtime';
@@ -89,7 +89,11 @@ KeybindingHint.displayName = 'KeybindingHint';
89
89
  *
90
90
  * NOTE that this string should _only_ be used when building `aria-label` or `aria-description` props (never rendered
91
91
  * visibly) and should nearly always also be paired with a visible hint for sighted users.
92
+ *
93
+ * The `platform` argument controls how platform-specific keys (such as `Meta`, `Alt`, and `Mod`) are named. For
94
+ * backwards compatibility, a `boolean` may be passed instead, where `true` is treated as `'apple'` and `false` as
95
+ * `'other'`.
92
96
  */
93
- const getAccessibleKeybindingHintString = accessibleSequenceString;
97
+ const getAccessibleKeybindingHintString = (sequence, platform) => accessibleSequenceString(sequence, typeof platform === 'boolean' ? platform ? 'apple' : 'other' : platform);
94
98
 
95
99
  export { KeybindingHint, getAccessibleKeybindingHintString };
@@ -1,5 +1,6 @@
1
1
  import type { KeybindingHintProps } from '../props';
2
+ import type { Platform } from '../platform';
2
3
  export declare const Chord: ({ keys, format, variant, size }: KeybindingHintProps) => import("react").JSX.Element;
3
4
  /** Plain string version of `Chord` for use in `aria` string attributes. */
4
- export declare const accessibleChordString: (chord: string, isMacOS: boolean) => string;
5
+ export declare const accessibleChordString: (chord: string, platform: Platform) => string;
5
6
  //# sourceMappingURL=Chord.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chord.d.ts","sourceRoot":"","sources":["../../../src/KeybindingHint/components/Chord.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAA;AA+BjD,eAAO,MAAM,KAAK,GAAI,iCAAmE,mBAAmB,gCAsB3G,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,EAAE,SAAS,OAAO,WAGvD,CAAA"}
1
+ {"version":3,"file":"Chord.d.ts","sourceRoot":"","sources":["../../../src/KeybindingHint/components/Chord.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAA;AAGjD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AA6BzC,eAAO,MAAM,KAAK,GAAI,iCAAmE,mBAAmB,gCAsB3G,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,EAAE,UAAU,QAAQ,WAGzD,CAAA"}
@@ -96,6 +96,6 @@ const Chord = t0 => {
96
96
  };
97
97
 
98
98
  /** Plain string version of `Chord` for use in `aria` string attributes. */
99
- const accessibleChordString = (chord, isMacOS) => splitChord(chord).map(key => accessibleKeyName(key, isMacOS)).join(' ');
99
+ const accessibleChordString = (chord, platform) => splitChord(chord).map(key => accessibleKeyName(key, platform)).join(' ');
100
100
 
101
101
  export { Chord, accessibleChordString };
@@ -1,7 +1,7 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import VisuallyHidden from '../../_VisuallyHidden.js';
3
3
  import { accessibleKeyName, condensedKeyName, fullKeyName } from '../key-names.js';
4
- import { useIsMacOS } from '../../hooks/useIsMacOS.js';
4
+ import { usePlatform } from '../platform.js';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
 
7
7
  /** Renders a single key with accessible alternative text. */
@@ -11,12 +11,12 @@ const Key = t0 => {
11
11
  name,
12
12
  format
13
13
  } = t0;
14
- const isMacOS = useIsMacOS();
14
+ const platform = usePlatform();
15
15
  let t1;
16
- if ($[0] !== isMacOS || $[1] !== name) {
17
- t1 = accessibleKeyName(name, isMacOS);
18
- $[0] = isMacOS;
19
- $[1] = name;
16
+ if ($[0] !== name || $[1] !== platform) {
17
+ t1 = accessibleKeyName(name, platform);
18
+ $[0] = name;
19
+ $[1] = platform;
20
20
  $[2] = t1;
21
21
  } else {
22
22
  t1 = $[2];
@@ -32,11 +32,11 @@ const Key = t0 => {
32
32
  t2 = $[4];
33
33
  }
34
34
  let t3;
35
- if ($[5] !== format || $[6] !== isMacOS || $[7] !== name) {
36
- t3 = format === "condensed" ? condensedKeyName(name, isMacOS) : fullKeyName(name, isMacOS);
35
+ if ($[5] !== format || $[6] !== name || $[7] !== platform) {
36
+ t3 = format === "condensed" ? condensedKeyName(name, platform) : fullKeyName(name, platform);
37
37
  $[5] = format;
38
- $[6] = isMacOS;
39
- $[7] = name;
38
+ $[6] = name;
39
+ $[7] = platform;
40
40
  $[8] = t3;
41
41
  } else {
42
42
  t3 = $[8];
@@ -1,5 +1,6 @@
1
1
  import type { KeybindingHintProps } from '../props';
2
+ import type { Platform } from '../platform';
2
3
  export declare const Sequence: ({ keys, ...chordProps }: KeybindingHintProps) => import("react").JSX.Element[];
3
4
  /** Plain string version of `Sequence` for use in `aria` string attributes. */
4
- export declare const accessibleSequenceString: (sequence: string, isMacOS: boolean) => string;
5
+ export declare const accessibleSequenceString: (sequence: string, platform: Platform) => string;
5
6
  //# sourceMappingURL=Sequence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sequence.d.ts","sourceRoot":"","sources":["../../../src/KeybindingHint/components/Sequence.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAA;AAMjD,eAAO,MAAM,QAAQ,GAAI,yBAAuB,mBAAmB,kCAa/D,CAAA;AAEJ,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,EAAE,SAAS,OAAO,WAGxD,CAAA"}
1
+ {"version":3,"file":"Sequence.d.ts","sourceRoot":"","sources":["../../../src/KeybindingHint/components/Sequence.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAA;AAGjD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AAIzC,eAAO,MAAM,QAAQ,GAAI,yBAAuB,mBAAmB,kCAa/D,CAAA;AAEJ,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,EAAE,UAAU,QAAQ,WAG1D,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Fragment } from 'react';
2
2
  import VisuallyHidden from '../../_VisuallyHidden.js';
3
- import { accessibleChordString, Chord } from './Chord.js';
3
+ import { Chord, accessibleChordString } from './Chord.js';
4
4
  import { jsxs, Fragment as Fragment$1, jsx } from 'react/jsx-runtime';
5
5
 
6
6
  const splitSequence = sequence => sequence.split(' ');
@@ -21,6 +21,6 @@ const Sequence = ({
21
21
  }, i));
22
22
 
23
23
  /** Plain string version of `Sequence` for use in `aria` string attributes. */
24
- const accessibleSequenceString = (sequence, isMacOS) => splitSequence(sequence).map(chord => accessibleChordString(chord, isMacOS)).join(' then ');
24
+ const accessibleSequenceString = (sequence, platform) => splitSequence(sequence).map(chord => accessibleChordString(chord, platform)).join(' then ');
25
25
 
26
26
  export { Sequence, accessibleSequenceString };
@@ -1,16 +1,17 @@
1
+ import type { Platform } from './platform';
1
2
  /**
2
3
  * Short-form iconic versions of keys. These should be intuitive (not archaic) and match icons on keyboards.
3
4
  */
4
- export declare const condensedKeyName: (key: string, isMacOS: boolean) => string;
5
+ export declare const condensedKeyName: (key: string, platform: Platform) => string;
5
6
  /**
6
7
  * Specific key displays for 'full' format. We still do show some icons (ie punctuation)
7
8
  * because that's more intuitive, but for the rest of keys we show the standard key name.
8
9
  */
9
- export declare const fullKeyName: (key: string, isMacOS: boolean) => string;
10
+ export declare const fullKeyName: (key: string, platform: Platform) => string;
10
11
  /**
11
12
  * Accessible key names intended to be read by a screen reader. This prevents screen
12
13
  * readers from expressing punctuation in speech, ie, reading a long pause instead of the
13
14
  * word "period".
14
15
  */
15
- export declare const accessibleKeyName: (key: string, isMacOS: boolean) => string;
16
+ export declare const accessibleKeyName: (key: string, platform: Platform) => string;
16
17
  //# sourceMappingURL=key-names.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"key-names.d.ts","sourceRoot":"","sources":["../../src/KeybindingHint/key-names.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,EAAE,SAAS,OAAO,WAwBlC,CAAA;AAE5B;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,SAAS,OAAO,WAa7B,CAAA;AAE5B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,EAAE,SAAS,OAAO,WAmDjC,CAAA"}
1
+ {"version":3,"file":"key-names.d.ts","sourceRoot":"","sources":["../../src/KeybindingHint/key-names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AAUxC;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,EAAE,UAAU,QAAQ,WAwBpC,CAAA;AAE5B;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,UAAU,QAAQ,WAc/B,CAAA;AAE5B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,EAAE,UAAU,QAAQ,WAmDnC,CAAA"}
@@ -12,15 +12,15 @@ const capitalize = ([first, ...rest]) => {
12
12
  /**
13
13
  * Short-form iconic versions of keys. These should be intuitive (not archaic) and match icons on keyboards.
14
14
  */
15
- const condensedKeyName = (key, isMacOS) => {
15
+ const condensedKeyName = (key, platform) => {
16
16
  var _alt$control$shift$me;
17
17
  return (_alt$control$shift$me = {
18
- alt: isMacOS ? '⌥' : 'Alt',
18
+ alt: platform === 'apple' ? '⌥' : 'Alt',
19
19
  // the alt key _is_ the option key on MacOS - in the browser there is no "option" key
20
20
  control: '⌃',
21
21
  shift: '⇧',
22
- meta: isMacOS ? '⌘' : 'Win',
23
- mod: isMacOS ? '⌘' : '⌃',
22
+ meta: platform === 'apple' ? '⌘' : platform === 'windows' ? 'Win' : 'Meta',
23
+ mod: platform === 'apple' ? '⌘' : '⌃',
24
24
  pageup: 'PgUp',
25
25
  pagedown: 'PgDn',
26
26
  arrowup: '↑',
@@ -47,11 +47,12 @@ const condensedKeyName = (key, isMacOS) => {
47
47
  * Specific key displays for 'full' format. We still do show some icons (ie punctuation)
48
48
  * because that's more intuitive, but for the rest of keys we show the standard key name.
49
49
  */
50
- const fullKeyName = (key, isMacOS) => {
51
- var _alt$mod$$pageup$pag;
52
- return (_alt$mod$$pageup$pag = {
53
- alt: isMacOS ? 'Option' : 'Alt',
54
- mod: isMacOS ? 'Command' : 'Control',
50
+ const fullKeyName = (key, platform) => {
51
+ var _alt$meta$mod$$pageu;
52
+ return (_alt$meta$mod$$pageu = {
53
+ alt: platform === 'apple' ? 'Option' : 'Alt',
54
+ meta: platform === 'apple' ? 'Command' : platform === 'windows' ? 'Windows' : 'Meta',
55
+ mod: platform === 'apple' ? 'Command' : 'Control',
55
56
  '+': 'Plus',
56
57
  pageup: 'Page Up',
57
58
  pagedown: 'Page Down',
@@ -61,7 +62,7 @@ const fullKeyName = (key, isMacOS) => {
61
62
  arrowright: 'Right Arrow',
62
63
  capslock: 'Caps Lock',
63
64
  printscreen: 'Print Screen'
64
- }[key]) !== null && _alt$mod$$pageup$pag !== void 0 ? _alt$mod$$pageup$pag : capitalize(key);
65
+ }[key]) !== null && _alt$meta$mod$$pageu !== void 0 ? _alt$meta$mod$$pageu : capitalize(key);
65
66
  };
66
67
 
67
68
  /**
@@ -69,12 +70,12 @@ const fullKeyName = (key, isMacOS) => {
69
70
  * readers from expressing punctuation in speech, ie, reading a long pause instead of the
70
71
  * word "period".
71
72
  */
72
- const accessibleKeyName = (key, isMacOS) => {
73
+ const accessibleKeyName = (key, platform) => {
73
74
  var _alt$meta$mod$pageup$;
74
75
  return (_alt$meta$mod$pageup$ = {
75
- alt: isMacOS ? 'option' : 'alt',
76
- meta: isMacOS ? 'command' : 'Windows',
77
- mod: isMacOS ? 'command' : 'control',
76
+ alt: platform === 'apple' ? 'option' : 'alt',
77
+ meta: platform === 'apple' ? 'command' : platform === 'windows' ? 'Windows' : 'meta',
78
+ mod: platform === 'apple' ? 'command' : 'control',
78
79
  // Screen readers may not be able to pronounce concatenated words - this provides a better experience
79
80
  pageup: 'page up',
80
81
  pagedown: 'page down',
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The platform categories that affect how keyboard shortcut keys are displayed.
3
+ *
4
+ * - `apple`: Apple platforms (macOS and iOS/iPadOS), which use the Command and Option keys.
5
+ * - `windows`: Windows, which uses the Windows (Meta) key.
6
+ * - `other`: Any other platform (e.g. Linux, Android), where the Meta key does not map to a
7
+ * consistent label.
8
+ */
9
+ export type Platform = 'apple' | 'windows' | 'other';
10
+ export declare const PlatformOverrideProvider: import("react").Provider<Platform | null>;
11
+ /**
12
+ * SSR-safe hook for determining the current platform category used when displaying
13
+ * keyboard shortcut keys.
14
+ *
15
+ * Mirrors the approach of `useIsMacOS`: on the client it reads the real value immediately,
16
+ * and on the server it returns a safe default (`'other'`).
17
+ *
18
+ * If a `PlatformOverrideProvider` is present with a non-null value, that value is used
19
+ * instead of the detected platform.
20
+ */
21
+ export declare function usePlatform(): Platform;
22
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/KeybindingHint/platform.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAkCpD,eAAO,MAAM,wBAAwB,2CAAmC,CAAA;AAExE;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAItC"}
@@ -0,0 +1,61 @@
1
+ import { isMacOS } from '@primer/behaviors/utils';
2
+ import { useContext, useSyncExternalStore, createContext } from 'react';
3
+
4
+ /**
5
+ * The platform categories that affect how keyboard shortcut keys are displayed.
6
+ *
7
+ * - `apple`: Apple platforms (macOS and iOS/iPadOS), which use the Command and Option keys.
8
+ * - `windows`: Windows, which uses the Windows (Meta) key.
9
+ * - `other`: Any other platform (e.g. Linux, Android), where the Meta key does not map to a
10
+ * consistent label.
11
+ */
12
+
13
+ // No-op. The platform never changes at runtime, so there is nothing to
14
+ // subscribe to. Hoisted to avoid creating a new function on every call.
15
+ const subscribe = () => () => {};
16
+
17
+ /** SSR-unsafe detection of iOS/iPadOS (in addition to macOS, which is detected separately). */
18
+ const ssrUnsafeIsIOS = () => {
19
+ if (typeof navigator === 'undefined') return false;
20
+ return /iphone|ipad|ipod/i.test(navigator.platform) || /iphone|ipad|ipod/i.test(navigator.userAgent);
21
+ };
22
+
23
+ /** SSR-unsafe detection of Windows. */
24
+ const ssrUnsafeIsWindows = () => {
25
+ if (typeof navigator === 'undefined') return false;
26
+ return /^win/i.test(navigator.platform);
27
+ };
28
+ const getSnapshot = () => {
29
+ if (isMacOS() || ssrUnsafeIsIOS()) return 'apple';
30
+ if (ssrUnsafeIsWindows()) return 'windows';
31
+ return 'other';
32
+ };
33
+
34
+ // Safe default for SSR since we can't detect the platform on the server.
35
+ const getServerSnapshot = () => 'other';
36
+
37
+ /**
38
+ * Allows overriding the detected platform. This is primarily intended for testing and
39
+ * Storybook, where we want to preview how keyboard hints render on platforms other than the
40
+ * one actually running. A `null` value (the default) means "use the detected platform".
41
+ */
42
+ const PlatformOverrideContext = /*#__PURE__*/createContext(null);
43
+ PlatformOverrideContext.Provider;
44
+
45
+ /**
46
+ * SSR-safe hook for determining the current platform category used when displaying
47
+ * keyboard shortcut keys.
48
+ *
49
+ * Mirrors the approach of `useIsMacOS`: on the client it reads the real value immediately,
50
+ * and on the server it returns a safe default (`'other'`).
51
+ *
52
+ * If a `PlatformOverrideProvider` is present with a non-null value, that value is used
53
+ * instead of the detected platform.
54
+ */
55
+ function usePlatform() {
56
+ const override = useContext(PlatformOverrideContext);
57
+ const detected = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
58
+ return override !== null && override !== void 0 ? override : detected;
59
+ }
60
+
61
+ export { usePlatform };
@@ -1 +1 @@
1
- {"version":3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AAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC5D,GAAG,iBAAiB,CAAA;AAsFrB,eAAO,MAAM,UAAU;;;;;;;;;;;;+CA/GiC,YAAY;;;CA8HlE,CAAA"}
@@ -94,6 +94,7 @@ const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
94
94
  t6 = /*#__PURE__*/jsx(BaseComponent, {
95
95
  ref: rootRef,
96
96
  className: t4,
97
+ "data-component": "PageHeader",
97
98
  "data-has-border": t5,
98
99
  "aria-label": ariaLabel,
99
100
  role: role,
@@ -145,6 +146,7 @@ const ContextArea = t0 => {
145
146
  if ($[4] !== children || $[5] !== t2 || $[6] !== t3) {
146
147
  t4 = /*#__PURE__*/jsx("div", {
147
148
  className: t2,
149
+ "data-component": "PageHeader.ContextArea",
148
150
  ...t3,
149
151
  children: children
150
152
  });
@@ -213,6 +215,7 @@ const ParentLink = /*#__PURE__*/React.forwardRef((t0, ref) => {
213
215
  "aria-label": ariaLabel,
214
216
  muted: true,
215
217
  className: t3,
218
+ "data-component": "PageHeader.ParentLink",
216
219
  ...t4,
217
220
  href: href,
218
221
  children: [t5, t6]
@@ -265,6 +268,7 @@ const ContextBar = t0 => {
265
268
  if ($[4] !== children || $[5] !== t2 || $[6] !== t3) {
266
269
  t4 = /*#__PURE__*/jsx("div", {
267
270
  className: t2,
271
+ "data-component": "PageHeader.ContextBar",
268
272
  ...t3,
269
273
  children: children
270
274
  });
@@ -308,6 +312,7 @@ const ContextAreaActions = t0 => {
308
312
  if ($[4] !== children || $[5] !== t2 || $[6] !== t3) {
309
313
  t4 = /*#__PURE__*/jsx("div", {
310
314
  className: t2,
315
+ "data-component": "PageHeader.ContextAreaActions",
311
316
  ...t3,
312
317
  children: children
313
318
  });
@@ -714,6 +719,7 @@ const Description = t0 => {
714
719
  if ($[4] !== children || $[5] !== t2 || $[6] !== t3) {
715
720
  t4 = /*#__PURE__*/jsx("div", {
716
721
  className: t2,
722
+ "data-component": "PageHeader.Description",
717
723
  ...t3,
718
724
  children: children
719
725
  });