@primer/react 0.0.0-20260601220336 → 0.0.0-20260601225305
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 +16 -3
- package/dist/ActionList/LinkItem.d.ts +1 -1
- package/dist/ActionList/List.d.ts +2 -11
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/index.d.ts +4 -24
- package/dist/ActionList/index.d.ts.map +1 -1
- package/dist/BranchName/BranchName.d.ts +2 -4
- package/dist/BranchName/BranchName.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +4 -10
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Card/Card.d.ts +2 -14
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/index.d.ts +2 -7
- package/dist/Card/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.d.ts +0 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +2 -16
- 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/Link/Link.d.ts +1 -1
- package/dist/NavList/NavList.d.ts +2 -8
- package/dist/NavList/NavList.d.ts.map +1 -1
- package/dist/Text/Text.d.ts +2 -7
- package/dist/Text/Text.d.ts.map +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 +11 -2
- package/dist/TreeView/TreeView.d.ts.map +1 -1
- package/dist/TreeView/TreeView.js +128 -92
- package/dist/TreeView/TreeView.module.css.js +2 -2
- package/dist/utils/modern-polymorphic.d.ts +1 -1
- package/dist/utils/modern-polymorphic.d.ts.map +1 -1
- package/generated/components.json +4 -0
- package/package.json +1 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260601225305
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -8,14 +8,27 @@
|
|
|
8
8
|
|
|
9
9
|
- [#7906](https://github.com/primer/react/pull/7906) [`adc5299`](https://github.com/primer/react/commit/adc5299f3d98519119fb9547e50dd2985fc96174) Thanks [@jonrohan](https://github.com/jonrohan)! - Text: Add `whiteSpace` prop to control the CSS `white-space` property
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- [#7897](https://github.com/primer/react/pull/7897) [`dea9ea7`](https://github.com/primer/react/commit/dea9ea7908d3d9fe935c42311952fa5cbd7a17e4) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add support for the `as` prop on `TreeView.Item`. This enables rendering the
|
|
12
|
+
treeitem as a different element (e.g. `as="a"` for native anchors, or a custom
|
|
13
|
+
router-link component) while preserving all existing keyboard, focus, and ARIA
|
|
14
|
+
behavior. Defaults to `'li'`, so existing usage is unchanged.
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
### Patch Changes
|
|
14
17
|
|
|
15
18
|
- Fake entry to force publishing
|
|
16
19
|
|
|
20
|
+
- [#7908](https://github.com/primer/react/pull/7908) [`e9a2254`](https://github.com/primer/react/commit/e9a225421df61e7fa62da1b2796972122d266d36) Thanks [@jonrohan](https://github.com/jonrohan)! - `KeybindingHint`: display the `Meta` key correctly on platforms other than macOS and Windows. The `Meta`, `Alt`, and `Mod` keys are now resolved based on the detected platform: Apple platforms (macOS and iOS) show `⌘`/`⌥`, Windows shows `Win`, and all other platforms show `Meta`/`Alt`.
|
|
21
|
+
|
|
17
22
|
- [#7894](https://github.com/primer/react/pull/7894) [`af4541d`](https://github.com/primer/react/commit/af4541d991c6e583dbf510bd0a0699f244ea00b2) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ActionList: Replace `:has(...)` selectors on `ActionList.Item`, `InactiveButtonWrap`, and `TrailingActionButton` with JS-derived data attributes (`data-has-trailing-action`, `data-trailing-action-loading`, `data-position`, `data-has-label`). Reduces style-recalculation cost on lists that render many items. No visual or behavioral changes.
|
|
18
23
|
|
|
24
|
+
- [#7899](https://github.com/primer/react/pull/7899) [`9659ce7`](https://github.com/primer/react/commit/9659ce767760d85c033e43e7e8ecdfdfb452dcb1) Thanks [@mattcosta7](https://github.com/mattcosta7)! - `TreeView`: make rows safer to use with `contain: paint` / `content-visibility: auto` and reduce style-recalc cost on hover/focus in large trees. No visual or layout changes; all changes are either invisible at the default rendering or behind an opt-in CSS containment property the consumer sets.
|
|
25
|
+
|
|
26
|
+
- The current-item indicator (positioned at `left: -8px` of the row container) was being clipped when a consumer applied `contain: paint` to the `<li>` or when the documented `containIntrinsicSize` prop on `TreeView.Item` triggered `content-visibility: auto` on the row container — including for `current` items. Both `.TreeViewItem` and `.TreeViewItemContainer` now declare `overflow-clip-margin: var(--base-size-8)`, which extends the paint-clip edge by 8px on the side the indicator paints. The property is a no-op when no paint containment is active, so default rendering is byte-identical.
|
|
27
|
+
- Skeleton-row hover suppression no longer relies on `:has(.TreeViewItemSkeleton)`, which forced subtree invalidation on every row. `LoadingItem` now communicates with the placeholder `Item` via a module-private context that emits a positive `data-loading` attribute on the `<li>`, and the CSS selector targets that directly. No new public prop.
|
|
28
|
+
- Nesting indicator lines no longer use a root-scope `:hover`/`:focus-within` descendant selector. Color is driven by an inherited `--tree-line-color` custom property set on the root `<ul>`, so a hover or focus change inside the tree updates one property on one element instead of re-matching `.TreeViewItemLevelLine` selectors against every level line in the tree.
|
|
29
|
+
- Fixed a unitless `outline-offset: -2` in the forced-colors focus-ring fallback that browsers were silently dropping (so forced-colors users now actually get a focus indicator on tree items).
|
|
30
|
+
- `.TreeViewItemContainer`'s `grid-template-columns` now declares the `trailingAction` column explicitly (`auto`) so it matches the 5-area `grid-template-areas` declaration (previously the trailing column was implicit `auto`).
|
|
31
|
+
|
|
19
32
|
## 38.26.0
|
|
20
33
|
|
|
21
34
|
### Minor Changes
|
|
@@ -14,7 +14,7 @@ type LinkProps = {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
};
|
|
16
16
|
export type ActionListLinkItemProps = Pick<ActionListItemProps, 'active' | 'children' | 'inactiveText' | 'variant' | 'size'> & LinkProps;
|
|
17
|
-
declare const LinkItemComponent: <As extends React.ElementType = "a">(props: (
|
|
17
|
+
declare const LinkItemComponent: <As extends React.ElementType = "a">(props: import("../utils/modern-polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & Pick<ActionListItemProps, "active" | "children" | "inactiveText" | "size" | "variant"> & LinkProps, "as"> & {
|
|
18
18
|
as?: As | undefined;
|
|
19
19
|
} & React.RefAttributes<unknown>) => React.ReactNode;
|
|
20
20
|
export declare const LinkItem: WithSlotMarker<typeof LinkItemComponent>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const List: <As extends React.ElementType = "ul">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "ul" : As> & {
|
|
2
|
+
declare const List: <As extends React.ElementType = "ul">(props: import("../utils/modern-polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "ul" : As> & {
|
|
3
3
|
variant?: "inset" | "horizontal-inset" | "full";
|
|
4
4
|
selectionVariant?: "single" | "radio" | "multiple";
|
|
5
5
|
showDividers?: boolean;
|
|
@@ -8,16 +8,7 @@ declare const List: <As extends React.ElementType = "ul">(props: (React.Componen
|
|
|
8
8
|
className?: string;
|
|
9
9
|
} & {
|
|
10
10
|
children?: React.ReactNode | undefined;
|
|
11
|
-
}
|
|
12
|
-
variant?: "inset" | "horizontal-inset" | "full";
|
|
13
|
-
selectionVariant?: "single" | "radio" | "multiple";
|
|
14
|
-
showDividers?: boolean;
|
|
15
|
-
role?: import("../utils/types").AriaRole;
|
|
16
|
-
disableFocusZone?: boolean;
|
|
17
|
-
className?: string;
|
|
18
|
-
} & {
|
|
19
|
-
children?: React.ReactNode | undefined;
|
|
20
|
-
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
11
|
+
}, "as"> & {
|
|
21
12
|
as?: As | undefined;
|
|
22
13
|
} & React.RefAttributes<unknown>) => React.ReactNode;
|
|
23
14
|
export { List };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAqHrC,QAAA,MAAM,IAAI,GAxGa,EAAE,SAAS,KAAK,CAAC,WAAW
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAqHrC,QAAA,MAAM,IAAI,GAxGa,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;oDAwGR,CAAA;AAI3C,OAAO,EAAC,IAAI,EAAC,CAAA"}
|
|
@@ -11,7 +11,7 @@ export type { ActionListGroupHeadingTrailingActionProps } from './GroupHeadingTr
|
|
|
11
11
|
/**
|
|
12
12
|
* Collection of list-related components.
|
|
13
13
|
*/
|
|
14
|
-
export declare const ActionList: (<As extends React.ElementType = "ul">(props: (import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "ul" : As> & {
|
|
14
|
+
export declare const ActionList: (<As extends React.ElementType = "ul">(props: import("../utils/modern-polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "ul" : As> & {
|
|
15
15
|
variant?: "inset" | "horizontal-inset" | "full";
|
|
16
16
|
selectionVariant?: "single" | "radio" | "multiple";
|
|
17
17
|
showDividers?: boolean;
|
|
@@ -20,16 +20,7 @@ export declare const ActionList: (<As extends React.ElementType = "ul">(props: (
|
|
|
20
20
|
className?: string;
|
|
21
21
|
} & {
|
|
22
22
|
children?: import("react").ReactNode | undefined;
|
|
23
|
-
}
|
|
24
|
-
variant?: "inset" | "horizontal-inset" | "full";
|
|
25
|
-
selectionVariant?: "single" | "radio" | "multiple";
|
|
26
|
-
showDividers?: boolean;
|
|
27
|
-
role?: import("../utils/types").AriaRole;
|
|
28
|
-
disableFocusZone?: boolean;
|
|
29
|
-
className?: string;
|
|
30
|
-
} & {
|
|
31
|
-
children?: import("react").ReactNode | undefined;
|
|
32
|
-
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
23
|
+
}, "as"> & {
|
|
33
24
|
as?: As | undefined;
|
|
34
25
|
} & import("react").RefAttributes<unknown>) => React.ReactNode) & {
|
|
35
26
|
/** Context for the `ActionList` container. */
|
|
@@ -96,18 +87,7 @@ export declare const ActionList: (<As extends React.ElementType = "ul">(props: (
|
|
|
96
87
|
__SLOT__: symbol;
|
|
97
88
|
};
|
|
98
89
|
/** A `Item` that renders a full-size anchor inside ListItem */
|
|
99
|
-
LinkItem: import("..").WithSlotMarker<(<As extends React.ElementType = "a">(props: (import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & Pick<import("./shared").ActionListItemProps, "active" | "children" | "inactiveText" | "size" | "variant"> & {
|
|
100
|
-
download?: string;
|
|
101
|
-
href?: string;
|
|
102
|
-
hrefLang?: string;
|
|
103
|
-
media?: string;
|
|
104
|
-
ping?: string;
|
|
105
|
-
rel?: string;
|
|
106
|
-
target?: string;
|
|
107
|
-
type?: string;
|
|
108
|
-
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>["referrerPolicy"];
|
|
109
|
-
className?: string;
|
|
110
|
-
} extends infer T ? T extends import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & Pick<import("./shared").ActionListItemProps, "active" | "children" | "inactiveText" | "size" | "variant"> & {
|
|
90
|
+
LinkItem: import("..").WithSlotMarker<(<As extends React.ElementType = "a">(props: import("../utils/modern-polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & Pick<import("./shared").ActionListItemProps, "active" | "children" | "inactiveText" | "size" | "variant"> & {
|
|
111
91
|
download?: string;
|
|
112
92
|
href?: string;
|
|
113
93
|
hrefLang?: string;
|
|
@@ -118,7 +98,7 @@ export declare const ActionList: (<As extends React.ElementType = "ul">(props: (
|
|
|
118
98
|
type?: string;
|
|
119
99
|
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>["referrerPolicy"];
|
|
120
100
|
className?: string;
|
|
121
|
-
}
|
|
101
|
+
}, "as"> & {
|
|
122
102
|
as?: As | undefined;
|
|
123
103
|
} & import("react").RefAttributes<unknown>) => React.ReactNode)>;
|
|
124
104
|
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ActionList/index.ts"],"names":[],"mappings":"AAWA,YAAY,EAAC,eAAe,EAAC,MAAM,UAAU,CAAA;AAC7C,YAAY,EAAC,oBA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AAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGzC,+DAA+D;;;;;;;;;;;;;;;IAG/D,iEAAiE;;IAGjE,4EAA4E;;IAG5E,uDAAuD;;IAGvD,sDAAsD;;IAGtD,mCAAmC;;IAGnC,gGAAgG;;;;IAGhG,qCAAqC;;;;;;;IAGrC,uBAAuB;;CAEvB,CAAA"}
|
|
@@ -3,11 +3,9 @@ import { type PolymorphicProps } from '../utils/modern-polymorphic';
|
|
|
3
3
|
export type BranchNameProps<As extends React.ElementType> = PolymorphicProps<As, 'a', {
|
|
4
4
|
className?: string;
|
|
5
5
|
}>;
|
|
6
|
-
declare const _default: <As extends React.ElementType>(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
6
|
+
declare const _default: <As extends React.ElementType>(props: import("../utils/modern-polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
7
7
|
className?: string;
|
|
8
|
-
}
|
|
9
|
-
className?: string;
|
|
10
|
-
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
8
|
+
}, "as"> & {
|
|
11
9
|
as?: As | undefined;
|
|
12
10
|
} & React.RefAttributes<any>) => React.ReactNode;
|
|
13
11
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BranchName.d.ts","sourceRoot":"","sources":["../../src/BranchName/BranchName.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI,gBAAgB,CAC1E,EAAE,EACF,GAAG,EACH;IACE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGmB,EAAE,SAAS,KAAK,CAAC,WAAW;gBALhC,MAAM
|
|
1
|
+
{"version":3,"file":"BranchName.d.ts","sourceRoot":"","sources":["../../src/BranchName/BranchName.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI,gBAAgB,CAC1E,EAAE,EACF,GAAG,EACH;IACE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGmB,EAAE,SAAS,KAAK,CAAC,WAAW;gBALhC,MAAM;;;;AAgBtB,wBAA0C"}
|
|
@@ -34,13 +34,10 @@ type StyledBreadcrumbsItemProps<As extends React.ElementType = 'a'> = Polymorphi
|
|
|
34
34
|
}>;
|
|
35
35
|
export type BreadcrumbsItemProps<As extends React.ElementType = 'a'> = StyledBreadcrumbsItemProps<As>;
|
|
36
36
|
declare const _default: typeof Breadcrumbs & {
|
|
37
|
-
Item: (<As extends React.ElementType = "a">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
37
|
+
Item: (<As extends React.ElementType = "a">(props: import("../utils/modern-polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
38
38
|
to?: To;
|
|
39
39
|
selected?: boolean;
|
|
40
|
-
}
|
|
41
|
-
to?: To;
|
|
42
|
-
selected?: boolean;
|
|
43
|
-
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
40
|
+
}, "as"> & {
|
|
44
41
|
as?: As | undefined;
|
|
45
42
|
} & React.RefAttributes<any>) => React.ReactNode) & {
|
|
46
43
|
displayName: string;
|
|
@@ -51,13 +48,10 @@ export default _default;
|
|
|
51
48
|
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
|
52
49
|
*/
|
|
53
50
|
export declare const Breadcrumb: typeof Breadcrumbs & {
|
|
54
|
-
Item: <As extends React.ElementType = "a">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
55
|
-
to?: To;
|
|
56
|
-
selected?: boolean;
|
|
57
|
-
} extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
51
|
+
Item: <As extends React.ElementType = "a">(props: import("../utils/modern-polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
58
52
|
to?: To;
|
|
59
53
|
selected?: boolean;
|
|
60
|
-
}
|
|
54
|
+
}, "as"> & {
|
|
61
55
|
as?: As | undefined;
|
|
62
56
|
} & React.RefAttributes<any>) => React.ReactNode;
|
|
63
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAC/B,OAAO,KAA6E,MAAM,OAAO,CAAA;AAUjG,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAA;IAC7C;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAC,CAAA;AA8GF,iBAAS,WAAW,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAiB,EAAE,OAAkB,EAAC,EAAE,gBAAgB,qBAoMzG;kBApMQ,WAAW;;;AAgNpB,KAAK,0BAA0B,CAAC,EAAE,SAAS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E,OAAO,CAAA;CACnB,CACF,CAAA;AAuBD,MAAM,MAAM,oBAAoB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,0BAA0B,CAAC,EAAE,CAAC,CAAA;;YApBlG,EAAE,SAAS,KAAK,CAAC,WAAW;aANtB,EAAE;mBACI,OAAO;;;;;;;AA4BtB,wBAAiF;AAEjF;;GAEG;AACH,eAAO,MAAM,UAAU;WA5BpB,EAAE,SAAS,KAAK,CAAC,WAAW;aANtB,EAAE;mBACI,OAAO;;;;CAiCuD,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAA;AAE9C;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAA"}
|
package/dist/Card/Card.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ type MetadataProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
|
60
60
|
*/
|
|
61
61
|
children: React.ReactNode;
|
|
62
62
|
};
|
|
63
|
-
declare const CardImpl: <As extends CardAs>(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
|
|
63
|
+
declare const CardImpl: <As extends CardAs>(props: import("../utils/modern-polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
|
|
64
64
|
/** Optional className for the root element. */
|
|
65
65
|
className?: string;
|
|
66
66
|
/** Internal padding. @default 'normal' */
|
|
@@ -72,19 +72,7 @@ declare const CardImpl: <As extends CardAs>(props: (React.ComponentPropsWithRef<
|
|
|
72
72
|
* `Card.Description`, `Card.Metadata`) or custom content.
|
|
73
73
|
*/
|
|
74
74
|
children: React.ReactNode;
|
|
75
|
-
}
|
|
76
|
-
/** Optional className for the root element. */
|
|
77
|
-
className?: string;
|
|
78
|
-
/** Internal padding. @default 'normal' */
|
|
79
|
-
padding?: "none" | "condensed" | "normal";
|
|
80
|
-
/** Border radius. @default 'large' */
|
|
81
|
-
borderRadius?: "medium" | "large";
|
|
82
|
-
/**
|
|
83
|
-
* Card contents. Provide either `Card.*` subcomponents (e.g. `Card.Heading`,
|
|
84
|
-
* `Card.Description`, `Card.Metadata`) or custom content.
|
|
85
|
-
*/
|
|
86
|
-
children: React.ReactNode;
|
|
87
|
-
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
75
|
+
}, "as"> & {
|
|
88
76
|
as?: As | undefined;
|
|
89
77
|
} & React.RefAttributes<any>) => React.ReactNode;
|
|
90
78
|
declare function CardIcon({ icon: IconComponent, 'aria-label': ariaLabel, className }: IconProps): React.JSX.Element;
|
package/dist/Card/Card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiE,MAAM,OAAO,CAAA;AAErF,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAMlF,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS,CAAA;AAE/B,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,MAAM,GAAG,KAAK,IAAI,gBAAgB,CACjE,EAAE,EACF,KAAK,EACL;IACE,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;IAEzC,sCAAsC;IACtC,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAEjC;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CACF,CAAA;AAED,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpD,KAAK,YAAY,GAAG,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG;IACzD;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AAC,CAAA;AACxC,YAAY,EAAC,UAAU,IAAI,cAAc,EAAC,CAAA;AAC1C,YAAY,EAAC,WAAW,IAAI,eAAe,EAAC,CAAA;AAC5C,YAAY,EAAC,aAAa,IAAI,iBAAiB,EAAC,CAAA"}
|
package/dist/Card/index.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { CardIcon, CardImage, CardAction } from './Card';
|
|
2
2
|
import type { CardProps, CardIconProps, CardImageProps, CardHeadingProps, CardDescriptionProps, CardActionProps, CardMetadataProps } from './Card';
|
|
3
|
-
declare const Card: (<As extends "div" | "section">(props: (import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
|
|
3
|
+
declare const Card: (<As extends "div" | "section">(props: import("../utils/modern-polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
|
|
4
4
|
className?: string;
|
|
5
5
|
padding?: "none" | "condensed" | "normal";
|
|
6
6
|
borderRadius?: "medium" | "large";
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
className?: string;
|
|
10
|
-
padding?: "none" | "condensed" | "normal";
|
|
11
|
-
borderRadius?: "medium" | "large";
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
8
|
+
}, "as"> & {
|
|
14
9
|
as?: As | undefined;
|
|
15
10
|
} & import("react").RefAttributes<any>) => React.ReactNode) & {
|
|
16
11
|
Icon: typeof CardIcon;
|
package/dist/Card/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,SAAS,EAAgC,UAAU,EAAe,MAAM,QAAQ,CAAA;AAC5G,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EAClB,MAAM,QAAQ,CAAA;AAEf,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,SAAS,EAAgC,UAAU,EAAe,MAAM,QAAQ,CAAA;AAC5G,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EAClB,MAAM,QAAQ,CAAA;AAEf,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;CAOR,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA;AACb,YAAY,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,CAAA"}
|
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,EAAC,MAAM,WAAW,CAAA;AAU1C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAgB/F;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAC7D;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAExD;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,C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E/G;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAEnC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAEpD;;OAEG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAErD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAA;CAC5B;AAGD,QAAA,MAAM,SAAS;;;;CAIL,CAAA;AAEV,QAAA,MAAM,QAAQ;;;;;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;AAsDjD,eAAO,MAAM,aAAa,mCAAqD,CAAA;AA+R/E,eAAO,MAAM,MAAM;;;;;;;;;iBA1EuC,iBAAiB,EAAE;;;iBAoCf,MAAM,IAAI;;CA8CtE,CAAA"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -36,17 +36,6 @@ 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]);
|
|
50
39
|
return /*#__PURE__*/jsx(Dialog.Header, {
|
|
51
40
|
children: /*#__PURE__*/jsxs("div", {
|
|
52
41
|
className: classes.HeaderInner,
|
|
@@ -60,8 +49,7 @@ const DefaultHeader = ({
|
|
|
60
49
|
children: subtitle
|
|
61
50
|
})]
|
|
62
51
|
}), /*#__PURE__*/jsx(Dialog.CloseButton, {
|
|
63
|
-
onClose: onCloseClick
|
|
64
|
-
onKeyDown: onCloseKeyDown
|
|
52
|
+
onClose: onCloseClick
|
|
65
53
|
})]
|
|
66
54
|
})
|
|
67
55
|
});
|
|
@@ -360,14 +348,12 @@ const Buttons = ({
|
|
|
360
348
|
});
|
|
361
349
|
};
|
|
362
350
|
const CloseButton = ({
|
|
363
|
-
onClose
|
|
364
|
-
onKeyDown
|
|
351
|
+
onClose
|
|
365
352
|
}) => {
|
|
366
353
|
return /*#__PURE__*/jsx(IconButton, {
|
|
367
354
|
icon: XIcon,
|
|
368
355
|
"aria-label": "Close",
|
|
369
356
|
onClick: onClose,
|
|
370
|
-
onKeyDown: onKeyDown,
|
|
371
357
|
variant: "invisible",
|
|
372
358
|
"data-component": "Dialog.CloseButton"
|
|
373
359
|
});
|
|
@@ -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
|