@primer/react 0.0.0-20260608154601 → 0.0.0-20260608191948
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 +52 -4
- package/dist/ActionList/ActionList-1940009e.css +2 -0
- package/dist/ActionList/ActionList-1940009e.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +2 -2
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +125 -118
- package/dist/ActionList/TrailingAction.d.ts.map +1 -1
- package/dist/ActionList/TrailingAction.js +1 -0
- package/dist/ActionList/Visuals.js +6 -4
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +3 -1
- package/dist/Autocomplete/AutocompleteInput.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +14 -2
- package/dist/Dialog/Dialog.d.ts +1 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +16 -2
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +3 -1
- package/dist/InlineMessage/InlineMessage-cd1e4c93.css +2 -0
- package/dist/InlineMessage/InlineMessage-cd1e4c93.css.map +1 -0
- package/dist/InlineMessage/InlineMessage.d.ts +1 -1
- package/dist/InlineMessage/InlineMessage.d.ts.map +1 -1
- package/dist/InlineMessage/InlineMessage.js +34 -19
- package/dist/InlineMessage/InlineMessage.module.css.js +1 -1
- package/dist/KeybindingHint/KeybindingHint.d.ts +6 -1
- package/dist/KeybindingHint/KeybindingHint.d.ts.map +1 -1
- package/dist/KeybindingHint/KeybindingHint.js +6 -2
- package/dist/KeybindingHint/components/Chord.d.ts +2 -1
- package/dist/KeybindingHint/components/Chord.d.ts.map +1 -1
- package/dist/KeybindingHint/components/Chord.js +1 -1
- package/dist/KeybindingHint/components/Key.js +10 -10
- package/dist/KeybindingHint/components/Sequence.d.ts +2 -1
- package/dist/KeybindingHint/components/Sequence.d.ts.map +1 -1
- package/dist/KeybindingHint/components/Sequence.js +2 -2
- package/dist/KeybindingHint/key-names.d.ts +4 -3
- package/dist/KeybindingHint/key-names.d.ts.map +1 -1
- package/dist/KeybindingHint/key-names.js +15 -14
- package/dist/KeybindingHint/platform.d.ts +22 -0
- package/dist/KeybindingHint/platform.d.ts.map +1 -0
- package/dist/KeybindingHint/platform.js +61 -0
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +3 -1
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +6 -0
- package/dist/PageLayout/PageLayout.d.ts +24 -6
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +17 -2
- package/dist/Pagehead/Pagehead.js +1 -0
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +2 -0
- package/dist/Portal/Portal.d.ts.map +1 -1
- package/dist/Portal/Portal.js +1 -0
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +2 -0
- package/dist/Text/{Text-ca7603b7.css → Text-d649cda5.css} +2 -2
- package/dist/Text/Text-d649cda5.css.map +1 -0
- package/dist/Text/Text.d.ts +3 -0
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +20 -14
- package/dist/Text/Text.module.css.js +1 -1
- package/dist/Timeline/Timeline-ff81db92.css +2 -0
- package/dist/Timeline/Timeline-ff81db92.css.map +1 -0
- package/dist/Timeline/Timeline.d.ts +9 -8
- package/dist/Timeline/Timeline.d.ts.map +1 -1
- package/dist/Timeline/Timeline.js +156 -61
- package/dist/Timeline/Timeline.module.css.js +1 -1
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +3 -3
- package/dist/TreeView/TreeView-1bf45a33.css +2 -0
- package/dist/TreeView/TreeView-1bf45a33.css.map +1 -0
- package/dist/TreeView/TreeView.d.ts.map +1 -1
- package/dist/TreeView/TreeView.js +25 -12
- package/dist/TreeView/TreeView.module.css.js +2 -2
- package/generated/components.json +57 -10
- package/package.json +1 -1
- package/dist/ActionList/ActionList-2a35a40c.css +0 -2
- package/dist/ActionList/ActionList-2a35a40c.css.map +0 -1
- package/dist/InlineMessage/InlineMessage-80d97643.css +0 -2
- package/dist/InlineMessage/InlineMessage-80d97643.css.map +0 -1
- package/dist/Text/Text-ca7603b7.css.map +0 -1
- package/dist/Timeline/Timeline-0c88f21b.css +0 -2
- package/dist/Timeline/Timeline-0c88f21b.css.map +0 -1
- package/dist/TreeView/TreeView-0fe09f34.css +0 -2
- package/dist/TreeView/TreeView-0fe09f34.css.map +0 -1
- package/dist/hooks/useIsMacOS.js +0 -32
|
@@ -139,7 +139,7 @@ const TrailingVisual = t0 => {
|
|
|
139
139
|
//
|
|
140
140
|
// This preserves the left alignment of item text.
|
|
141
141
|
const VisualOrIndicator = t0 => {
|
|
142
|
-
const $ = c(
|
|
142
|
+
const $ = c(6);
|
|
143
143
|
const {
|
|
144
144
|
children,
|
|
145
145
|
labelId,
|
|
@@ -157,9 +157,10 @@ const VisualOrIndicator = t0 => {
|
|
|
157
157
|
return children;
|
|
158
158
|
}
|
|
159
159
|
let t1;
|
|
160
|
-
if ($[0] !== VisualComponent || $[1] !== className || $[2] !== inactiveText || $[3] !== labelId) {
|
|
160
|
+
if ($[0] !== VisualComponent || $[1] !== className || $[2] !== inactiveText || $[3] !== labelId || $[4] !== position) {
|
|
161
161
|
t1 = inactiveText ? /*#__PURE__*/jsx("span", {
|
|
162
162
|
className: classes.InactiveButtonWrap,
|
|
163
|
+
"data-position": position,
|
|
163
164
|
children: /*#__PURE__*/jsx(Tooltip, {
|
|
164
165
|
text: inactiveText,
|
|
165
166
|
type: "description",
|
|
@@ -182,9 +183,10 @@ const VisualOrIndicator = t0 => {
|
|
|
182
183
|
$[1] = className;
|
|
183
184
|
$[2] = inactiveText;
|
|
184
185
|
$[3] = labelId;
|
|
185
|
-
$[4] =
|
|
186
|
+
$[4] = position;
|
|
187
|
+
$[5] = t1;
|
|
186
188
|
} else {
|
|
187
|
-
t1 = $[
|
|
189
|
+
t1 = $[5];
|
|
188
190
|
}
|
|
189
191
|
return t1;
|
|
190
192
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAmC,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AAChE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAmC,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AAChE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAA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;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAElD;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAElD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA;IAChE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;IACnE;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA2RnF,CAAA"}
|
|
@@ -8,6 +8,7 @@ import classes from './AnchoredOverlay.module.css.js';
|
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import Overlay, { widthMap } from '../Overlay/Overlay.js';
|
|
10
10
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
11
12
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
12
13
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
13
14
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
@@ -49,10 +50,11 @@ const AnchoredOverlay = ({
|
|
|
49
50
|
closeButtonProps = defaultCloseButtonProps,
|
|
50
51
|
renderAs = 'portal'
|
|
51
52
|
}) => {
|
|
53
|
+
const cssAnchorPositioningFlag = useFeatureFlag('primer_react_css_anchor_positioning');
|
|
52
54
|
// Lazy initial state so feature detection runs once per mount on the client.
|
|
53
55
|
// Guarded for SSR where `document` is undefined.
|
|
54
56
|
const [supportsNativeCSSAnchorPositioning] = useState(() => typeof document !== 'undefined' && 'anchorName' in document.documentElement.style && 'positionTryFallbacks' in document.documentElement.style && 'positionVisibility' in document.documentElement.style);
|
|
55
|
-
const cssAnchorPositioning = supportsNativeCSSAnchorPositioning && !(overlayProps !== null && overlayProps !== void 0 && overlayProps.portalContainerName);
|
|
57
|
+
const cssAnchorPositioning = cssAnchorPositioningFlag && supportsNativeCSSAnchorPositioning && !(overlayProps !== null && overlayProps !== void 0 && overlayProps.portalContainerName);
|
|
56
58
|
// Only use Popover API when both CSS anchor positioning is enabled AND renderAs is true
|
|
57
59
|
const shouldRenderAsPopover = cssAnchorPositioning && renderAs === 'popover';
|
|
58
60
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteInput.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqD,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAGlD,KAAK,8BAA8B,GAAG;IAEpC,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAA;IAEtD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAID,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"AutocompleteInput.d.ts","sourceRoot":"","sources":["../../src/Autocomplete/AutocompleteInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqD,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAGlD,KAAK,8BAA8B,GAAG;IAEpC,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAA;IAEtD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAID,QAAA,MAAM,iBAAiB,EA2KlB,8BAA8B,CAAC,OAAO,SAAS,EAAE,8BAA8B,CAAC,CAAA;AAIrF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC7E,eAAe,iBAAiB,CAAA"}
|
|
@@ -56,9 +56,17 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
56
56
|
safeSetTimeout(() => {
|
|
57
57
|
if (document.activeElement !== inputRef.current) {
|
|
58
58
|
setShowMenu(false);
|
|
59
|
+
|
|
60
|
+
// Reset the input's value to the text the user actually typed rather than leaving the
|
|
61
|
+
// inline autocomplete suggestion in place. This keeps the blur behavior consistent with
|
|
62
|
+
// pressing Escape, so deleting characters off a selection and then clicking away does not
|
|
63
|
+
// silently restore the full suggestion. See https://github.com/primer/react/issues/4275
|
|
64
|
+
if (inputRef.current && autocompleteSuggestion && inputRef.current.value !== inputValue) {
|
|
65
|
+
inputRef.current.value = inputValue;
|
|
66
|
+
}
|
|
59
67
|
}
|
|
60
68
|
}, 0);
|
|
61
|
-
}, [onBlur, setShowMenu, inputRef, safeSetTimeout]);
|
|
69
|
+
}, [onBlur, setShowMenu, inputRef, safeSetTimeout, autocompleteSuggestion, inputValue]);
|
|
62
70
|
const handleInputChange = event => {
|
|
63
71
|
onChange && onChange(event);
|
|
64
72
|
setInputValue(event.currentTarget.value);
|
|
@@ -110,7 +118,11 @@ const AutocompleteInput = /*#__PURE__*/React.forwardRef(({
|
|
|
110
118
|
// TODO: fix bug where this function prevents `onChange` from being triggered if the highlighted item text
|
|
111
119
|
// is the same as what I'm typing
|
|
112
120
|
// e.g.: typing 'tw' highlights 'two', but when I 'two', the text input change does not get triggered
|
|
113
|
-
|
|
121
|
+
// Only apply the inline autocomplete suggestion while the input is focused. Without this guard,
|
|
122
|
+
// the suggestion can be re-applied to the DOM after the input is blurred, which would restore
|
|
123
|
+
// the full suggestion the user was editing away from. See https://github.com/primer/react/issues/4275
|
|
124
|
+
const isInputFocused = document.activeElement === inputRef.current;
|
|
125
|
+
if (isInputFocused && highlightRemainingText && autocompleteSuggestion && (inputValue || isMenuDirectlyActivated)) {
|
|
114
126
|
inputRef.current.value = autocompleteSuggestion;
|
|
115
127
|
if (autocompleteSuggestion.toLowerCase().indexOf(inputValue.toLowerCase()) === 0) {
|
|
116
128
|
inputRef.current.setSelectionRange(inputValue.length, autocompleteSuggestion.length);
|
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA2C,KAAK,aAAa,EAAsB,MAAM,OAAO,CAAA;AAC9G,OAAO,KAAK,EAAC,WAAW,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Aa,mCAAqD,CAAA;AAmS/E,eAAO,MAAM,MAAM;;;;;;;;;iBA9EuC,iBAAiB,EAAE;;;iBAoCf,MAAM,IAAI;oBAAc,KAAK,CAAC,oBAAoB;;CAkD9G,CAAA"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -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,
|
|
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"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { FeatureFlagScope } from './FeatureFlagScope.js';
|
|
2
2
|
|
|
3
3
|
const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
4
|
+
primer_react_css_anchor_positioning: false,
|
|
4
5
|
primer_react_select_panel_fullscreen_on_narrow: false,
|
|
5
6
|
primer_react_select_panel_order_selected_at_top: false,
|
|
6
7
|
primer_react_styled_react_use_primer_theme_providers: false,
|
|
7
|
-
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
|
|
8
10
|
});
|
|
9
11
|
|
|
10
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
|
|
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;
|
|
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
|
-
|
|
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
|
-
|
|
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 ($[
|
|
108
|
+
if ($[10] !== className) {
|
|
95
109
|
t2 = clsx(className, classes.InlineMessage);
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
110
|
+
$[10] = className;
|
|
111
|
+
$[11] = t2;
|
|
98
112
|
} else {
|
|
99
|
-
t2 = $[
|
|
113
|
+
t2 = $[11];
|
|
100
114
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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":
|
|
122
|
+
"data-variant": t3,
|
|
108
123
|
"data-component": "InlineMessage",
|
|
109
124
|
children: [icon, children]
|
|
110
125
|
});
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
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
|
-
|
|
134
|
+
t4 = $[18];
|
|
120
135
|
}
|
|
121
|
-
return
|
|
136
|
+
return t4;
|
|
122
137
|
}
|
|
123
138
|
|
|
124
139
|
export { InlineMessage };
|
|
@@ -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,
|
|
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;
|
|
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 {
|
|
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,
|
|
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;
|
|
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,
|
|
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 {
|
|
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
|
|
14
|
+
const platform = usePlatform();
|
|
15
15
|
let t1;
|
|
16
|
-
if ($[0] !==
|
|
17
|
-
t1 = accessibleKeyName(name,
|
|
18
|
-
$[0] =
|
|
19
|
-
$[1] =
|
|
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] !==
|
|
36
|
-
t3 = format === "condensed" ? condensedKeyName(name,
|
|
35
|
+
if ($[5] !== format || $[6] !== name || $[7] !== platform) {
|
|
36
|
+
t3 = format === "condensed" ? condensedKeyName(name, platform) : fullKeyName(name, platform);
|
|
37
37
|
$[5] = format;
|
|
38
|
-
$[6] =
|
|
39
|
-
$[7] =
|
|
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,
|
|
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;
|
|
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 {
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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":"
|
|
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,
|
|
15
|
+
const condensedKeyName = (key, platform) => {
|
|
16
16
|
var _alt$control$shift$me;
|
|
17
17
|
return (_alt$control$shift$me = {
|
|
18
|
-
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:
|
|
23
|
-
mod:
|
|
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,
|
|
51
|
-
var _alt$mod$$
|
|
52
|
-
return (_alt$mod$$
|
|
53
|
-
alt:
|
|
54
|
-
|
|
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$$
|
|
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,
|
|
73
|
+
const accessibleKeyName = (key, platform) => {
|
|
73
74
|
var _alt$meta$mod$pageup$;
|
|
74
75
|
return (_alt$meta$mod$pageup$ = {
|
|
75
|
-
alt:
|
|
76
|
-
meta:
|
|
77
|
-
mod:
|
|
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"}
|