@primer/react 38.29.0-rc.30acfb591 → 38.29.0-rc.34ad69eed
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 +8 -0
- package/dist/ActionList/ActionList-65f7daac.css +2 -0
- package/dist/ActionList/ActionList-65f7daac.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +2 -2
- package/dist/ActionList/Description.d.ts.map +1 -1
- package/dist/ActionList/Group.d.ts +0 -5
- package/dist/ActionList/Group.d.ts.map +1 -1
- package/dist/ActionList/Group.js +2 -5
- package/dist/ActionList/GroupContext.d.ts +8 -0
- package/dist/ActionList/GroupContext.d.ts.map +1 -0
- package/dist/ActionList/GroupContext.js +8 -0
- package/dist/ActionList/GroupHeadingTrailingAction.js +20 -14
- package/dist/ActionList/Item.js +3 -2
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +21 -16
- package/dist/ActionList/Selection.js +1 -1
- package/dist/ActionList/TrailingAction.d.ts +2 -1
- package/dist/ActionList/TrailingAction.d.ts.map +1 -1
- package/dist/ActionList/TrailingAction.js +37 -31
- package/dist/ActionList/index.d.ts.map +1 -1
- package/dist/ActionList/index.js +2 -1
- package/dist/ActionMenu/ActionMenu.js +1 -1
- 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 +3 -1
- package/dist/Autocomplete/AutocompleteMenu.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +7 -1
- package/dist/AvatarStack/AvatarStack.d.ts.map +1 -1
- package/dist/AvatarStack/AvatarStack.js +1 -0
- package/dist/Blankslate/Blankslate-11d7a7fd.css +2 -0
- package/dist/Blankslate/Blankslate-11d7a7fd.css.map +1 -0
- package/dist/Blankslate/Blankslate.module.css.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +7 -0
- package/dist/Button/IconButton.d.ts.map +1 -1
- package/dist/Button/IconButton.js +3 -2
- package/dist/ConfirmationDialog/ConfirmationDialog.d.ts +0 -9
- package/dist/ConfirmationDialog/ConfirmationDialog.d.ts.map +1 -1
- package/dist/ConfirmationDialog/ConfirmationDialog.js +1 -42
- package/dist/ConfirmationDialog/useConfirm.d.ts +12 -0
- package/dist/ConfirmationDialog/useConfirm.d.ts.map +1 -0
- package/dist/ConfirmationDialog/useConfirm.js +44 -0
- package/dist/DataTable/storybook/data.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 +3 -5
- package/dist/Dialog/DialogContext.d.ts +3 -0
- package/dist/Dialog/DialogContext.d.ts.map +1 -0
- package/dist/Dialog/DialogContext.js +5 -0
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -0
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +6 -1
- package/dist/FilteredActionList/FilteredActionListLoaders-bdda3d7e.css +2 -0
- package/dist/FilteredActionList/FilteredActionListLoaders-bdda3d7e.css.map +1 -0
- package/dist/FilteredActionList/FilteredActionListLoaders.d.ts +2 -10
- package/dist/FilteredActionList/FilteredActionListLoaders.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionListLoaders.js +4 -13
- package/dist/FilteredActionList/FilteredActionListLoaders.module.css.js +2 -2
- package/dist/FilteredActionList/constants.d.ts +11 -0
- package/dist/FilteredActionList/constants.d.ts.map +1 -0
- package/dist/FilteredActionList/constants.js +13 -0
- package/dist/FilteredActionList/index.js +0 -1
- package/dist/FilteredActionList/useAnnouncements.d.ts.map +1 -1
- package/dist/KeybindingHint/KeybindingHint.d.ts +0 -14
- package/dist/KeybindingHint/KeybindingHint.d.ts.map +1 -1
- package/dist/KeybindingHint/KeybindingHint.js +2 -16
- package/dist/KeybindingHint/components/Chord.d.ts +0 -3
- package/dist/KeybindingHint/components/Chord.d.ts.map +1 -1
- package/dist/KeybindingHint/components/Chord.js +2 -21
- package/dist/KeybindingHint/components/Sequence.d.ts +0 -3
- package/dist/KeybindingHint/components/Sequence.d.ts.map +1 -1
- package/dist/KeybindingHint/components/Sequence.js +2 -5
- package/dist/KeybindingHint/components/utils.d.ts +8 -0
- package/dist/KeybindingHint/components/utils.d.ts.map +1 -0
- package/dist/KeybindingHint/components/utils.js +32 -0
- package/dist/KeybindingHint/index.d.ts +2 -1
- package/dist/KeybindingHint/index.d.ts.map +1 -1
- package/dist/KeybindingHint/utils.d.ts +15 -0
- package/dist/KeybindingHint/utils.d.ts.map +1 -0
- package/dist/KeybindingHint/utils.js +17 -0
- package/dist/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/LabelGroup/LabelGroup.js +5 -0
- package/dist/Overlay/Overlay.d.ts +1 -18
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +1 -20
- package/dist/Overlay/constants.d.ts +19 -0
- package/dist/Overlay/constants.d.ts.map +1 -0
- package/dist/Overlay/constants.js +20 -0
- package/dist/Portal/Portal.d.ts +0 -14
- package/dist/Portal/Portal.d.ts.map +1 -1
- package/dist/Portal/Portal.js +4 -46
- package/dist/Portal/PortalContext.d.ts +5 -0
- package/dist/Portal/PortalContext.d.ts.map +1 -0
- package/dist/Portal/PortalContext.js +5 -0
- package/dist/Portal/index.d.ts +3 -1
- package/dist/Portal/index.d.ts.map +1 -1
- package/dist/Portal/index.js +0 -1
- package/dist/Portal/portalRoot.d.ts +11 -0
- package/dist/Portal/portalRoot.d.ts.map +1 -0
- package/dist/Portal/portalRoot.js +39 -0
- package/dist/Radio/Radio.js +1 -1
- package/dist/RadioGroup/RadioGroup.d.ts +1 -6
- package/dist/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup/RadioGroup.js +2 -3
- package/dist/RadioGroup/RadioGroupContext.d.ts +7 -0
- package/dist/RadioGroup/RadioGroupContext.d.ts.map +1 -0
- package/dist/RadioGroup/RadioGroupContext.js +5 -0
- package/dist/RadioGroup/index.d.ts +2 -1
- package/dist/RadioGroup/index.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +27 -3
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Textarea/Textarea.d.ts.map +1 -1
- package/dist/ThemeContext.d.ts +15 -0
- package/dist/ThemeContext.d.ts.map +1 -0
- package/dist/ThemeContext.js +9 -0
- package/dist/ThemeProvider.d.ts +1 -14
- package/dist/ThemeProvider.d.ts.map +1 -1
- package/dist/ThemeProvider.js +3 -18
- package/dist/Timeline/Timeline.d.ts +1 -1
- package/dist/Timeline/Timeline.d.ts.map +1 -1
- package/dist/Timeline/constants.d.ts +2 -0
- package/dist/Timeline/constants.d.ts.map +1 -0
- package/dist/ToggleSwitch/ToggleSwitch.d.ts.map +1 -1
- package/dist/Token/IssueLabelToken.d.ts.map +1 -1
- package/dist/Token/IssueLabelToken.js +3 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +3 -1
- package/dist/Token/TokenBase.d.ts +2 -5
- package/dist/Token/TokenBase.d.ts.map +1 -1
- package/dist/Token/TokenBase.js +3 -14
- package/dist/Token/_RemoveTokenButton.js +1 -1
- package/dist/Token/constants.d.ts +4 -0
- package/dist/Token/constants.d.ts.map +1 -0
- package/dist/Token/constants.js +3 -0
- package/dist/Token/utils.d.ts +3 -0
- package/dist/Token/utils.d.ts.map +1 -0
- package/dist/Token/utils.js +14 -0
- package/dist/Tooltip/Tooltip.d.ts +0 -3
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +2 -3
- package/dist/Tooltip/TooltipContext.d.ts +5 -0
- package/dist/Tooltip/TooltipContext.d.ts.map +1 -0
- package/dist/Tooltip/TooltipContext.js +5 -0
- package/dist/TooltipV2/Tooltip.d.ts +0 -3
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +5 -3
- package/dist/TooltipV2/TooltipContext.d.ts +5 -0
- package/dist/TooltipV2/TooltipContext.d.ts.map +1 -0
- package/dist/TooltipV2/TooltipContext.js +5 -0
- package/dist/TreeView/TreeView.d.ts.map +1 -1
- package/dist/TreeView/TreeView.js +1 -1
- package/dist/UnderlineNav/UnderlineNav.d.ts +0 -1
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +2 -5
- package/dist/UnderlineNav/utils.d.ts +3 -0
- package/dist/UnderlineNav/utils.d.ts.map +1 -0
- package/dist/UnderlineNav/utils.js +8 -0
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts.map +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +3 -1
- package/dist/experimental/SelectPanel2/index.d.ts +2 -1
- package/dist/experimental/SelectPanel2/index.d.ts.map +1 -1
- package/dist/experimental/Tabs/Tabs.d.ts +3 -111
- package/dist/experimental/Tabs/Tabs.d.ts.map +1 -1
- package/dist/experimental/Tabs/Tabs.js +3 -237
- package/dist/experimental/Tabs/TabsContext.d.ts +3 -0
- package/dist/experimental/Tabs/TabsContext.d.ts.map +1 -0
- package/dist/experimental/Tabs/TabsContext.js +5 -0
- package/dist/experimental/Tabs/index.d.ts +5 -2
- package/dist/experimental/Tabs/index.d.ts.map +1 -1
- package/dist/experimental/Tabs/types.d.ts +107 -0
- package/dist/experimental/Tabs/types.d.ts.map +1 -0
- package/dist/experimental/Tabs/useTab.d.ts +7 -0
- package/dist/experimental/Tabs/useTab.d.ts.map +1 -0
- package/dist/experimental/Tabs/useTab.js +97 -0
- package/dist/experimental/Tabs/useTabList.d.ts +3 -0
- package/dist/experimental/Tabs/useTabList.d.ts.map +1 -0
- package/dist/experimental/Tabs/useTabList.js +100 -0
- package/dist/experimental/Tabs/useTabPanel.d.ts +4 -0
- package/dist/experimental/Tabs/useTabPanel.d.ts.map +1 -0
- package/dist/experimental/Tabs/useTabPanel.js +37 -0
- package/dist/experimental/Tabs/useTabs.d.ts +3 -0
- package/dist/experimental/Tabs/useTabs.d.ts.map +1 -0
- package/dist/experimental/Tabs/useTabs.js +12 -0
- package/dist/experimental/index.js +7 -3
- package/dist/hooks/MatchMedia.d.ts +23 -0
- package/dist/hooks/MatchMedia.d.ts.map +1 -0
- package/dist/hooks/MatchMediaContext.d.ts +5 -0
- package/dist/hooks/MatchMediaContext.d.ts.map +1 -0
- package/dist/hooks/MatchMediaContext.js +8 -0
- package/dist/hooks/useControllableState.d.ts.map +1 -1
- package/dist/hooks/useControllableState.js +2 -0
- package/dist/hooks/useDetails.d.ts.map +1 -1
- package/dist/hooks/useDialog.d.ts.map +1 -1
- package/dist/hooks/useFocusZone.d.ts.map +1 -1
- package/dist/hooks/useFocusZone.js +3 -1
- package/dist/hooks/useMedia.d.ts +1 -24
- package/dist/hooks/useMedia.d.ts.map +1 -1
- package/dist/hooks/useMedia.js +15 -6
- package/dist/hooks/useMenuInitialFocus.d.ts.map +1 -1
- package/dist/hooks/useMenuInitialFocus.js +1 -0
- package/dist/hooks/useMnemonics.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/useTheme.d.ts +15 -0
- package/dist/useTheme.d.ts.map +1 -0
- package/dist/useTheme.js +16 -0
- package/dist/utils/StressTest.d.ts.map +1 -1
- package/dist/utils/descendant-registry.d.ts.map +1 -1
- package/dist/utils/story-helpers.d.ts +70 -0
- package/dist/utils/story-helpers.d.ts.map +1 -0
- package/generated/components.json +12 -6
- package/package.json +5 -3
- package/dist/ActionList/ActionList-1940009e.css +0 -2
- package/dist/ActionList/ActionList-1940009e.css.map +0 -1
- package/dist/Blankslate/Blankslate-a039d79a.css +0 -2
- package/dist/Blankslate/Blankslate-a039d79a.css.map +0 -1
- package/dist/FilteredActionList/FilteredActionListLoaders-a46a8ea4.css +0 -2
- package/dist/FilteredActionList/FilteredActionListLoaders-a46a8ea4.css.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class FilteredActionListLoadingType {
|
|
2
|
+
constructor(name, appearsInBody) {
|
|
3
|
+
this.name = name;
|
|
4
|
+
this.appearsInBody = appearsInBody;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
const FilteredActionListLoadingTypes = {
|
|
8
|
+
bodySpinner: new FilteredActionListLoadingType('body-spinner', true),
|
|
9
|
+
bodySkeleton: new FilteredActionListLoadingType('body-skeleton', true),
|
|
10
|
+
input: new FilteredActionListLoadingType('input', false)
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { FilteredActionListLoadingType, FilteredActionListLoadingTypes };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FilteredActionList as FilteredActionList$1 } from './FilteredActionList.js';
|
|
2
2
|
import { FilteredActionListInput } from './FilteredActionListInput.js';
|
|
3
3
|
import { FilteredActionListBodyLoader } from './FilteredActionListLoaders.js';
|
|
4
|
-
export { FilteredActionListLoadingTypes } from './FilteredActionListLoaders.js';
|
|
5
4
|
|
|
6
5
|
const FilteredActionList = Object.assign(FilteredActionList$1, {
|
|
7
6
|
BodyLoader: FilteredActionListBodyLoader,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnnouncements.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/useAnnouncements.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAA;AAmCpD,eAAO,MAAM,gBAAgB,GAC3B,OAAO,uBAAuB,CAAC,OAAO,CAAC,EACvC,kBAAkB,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAC1D,UAAU,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAClD,UAAS,OAAc,EACvB,UAAS,OAAe,EACxB,UAAU;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,EAC9C,kBAAkB,mBAAmB,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"useAnnouncements.d.ts","sourceRoot":"","sources":["../../src/FilteredActionList/useAnnouncements.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAA;AAmCpD,eAAO,MAAM,gBAAgB,GAC3B,OAAO,uBAAuB,CAAC,OAAO,CAAC,EACvC,kBAAkB,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAC1D,UAAU,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAClD,UAAS,OAAc,EACvB,UAAS,OAAe,EACxB,UAAU;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,EAC9C,kBAAkB,mBAAmB,GAAG,iBAAiB,SA6G1D,CAAA"}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import type { KeybindingHintProps } from './props';
|
|
2
|
-
import type { Platform } from './platform';
|
|
3
2
|
/** Indicates the presence of an available keybinding. */
|
|
4
3
|
export declare const KeybindingHint: import("react").MemoExoticComponent<({ className, ...props }: KeybindingHintProps) => import("react").JSX.Element>;
|
|
5
|
-
/**
|
|
6
|
-
* AVOID: `KeybindingHint` is nearly always sufficient for providing both visible and accessible keyboard hints.
|
|
7
|
-
* However, there may be cases where we need a plain string version, such as when building `aria-label` or
|
|
8
|
-
* `aria-description`. In that case, this plain string builder can be used instead.
|
|
9
|
-
*
|
|
10
|
-
* NOTE that this string should _only_ be used when building `aria-label` or `aria-description` props (never rendered
|
|
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'`.
|
|
16
|
-
*/
|
|
17
|
-
export declare const getAccessibleKeybindingHintString: (sequence: string, platform: Platform | boolean) => string;
|
|
18
4
|
//# 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;AAoBhD,yDAAyD;AAEzD,eAAO,MAAM,cAAc,gEAAgC,mBAAmB,iCAI5E,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import { Sequence
|
|
3
|
+
import { Sequence } 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';
|
|
@@ -82,18 +82,4 @@ const KeybindingHint = /*#__PURE__*/memo(t0 => {
|
|
|
82
82
|
});
|
|
83
83
|
KeybindingHint.displayName = 'KeybindingHint';
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
* AVOID: `KeybindingHint` is nearly always sufficient for providing both visible and accessible keyboard hints.
|
|
87
|
-
* However, there may be cases where we need a plain string version, such as when building `aria-label` or
|
|
88
|
-
* `aria-description`. In that case, this plain string builder can be used instead.
|
|
89
|
-
*
|
|
90
|
-
* NOTE that this string should _only_ be used when building `aria-label` or `aria-description` props (never rendered
|
|
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'`.
|
|
96
|
-
*/
|
|
97
|
-
const getAccessibleKeybindingHintString = (sequence, platform) => accessibleSequenceString(sequence, typeof platform === 'boolean' ? platform ? 'apple' : 'other' : platform);
|
|
98
|
-
|
|
99
|
-
export { KeybindingHint, getAccessibleKeybindingHintString };
|
|
85
|
+
export { KeybindingHint };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { KeybindingHintProps } from '../props';
|
|
2
|
-
import type { Platform } from '../platform';
|
|
3
2
|
export declare const Chord: ({ keys, format, variant, size }: KeybindingHintProps) => import("react").JSX.Element;
|
|
4
|
-
/** Plain string version of `Chord` for use in `aria` string attributes. */
|
|
5
|
-
export declare const accessibleChordString: (chord: string, platform: Platform) => string;
|
|
6
3
|
//# 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;AAMjD,eAAO,MAAM,KAAK,GAAI,iCAAmE,mBAAmB,gCAsB3G,CAAA"}
|
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
3
|
import { Key } from './Key.js';
|
|
4
|
-
import { accessibleKeyName } from '../key-names.js';
|
|
5
4
|
import { clsx } from 'clsx';
|
|
6
5
|
import classes from './Chord.module.css.js';
|
|
6
|
+
import { splitChord } from './utils.js';
|
|
7
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
8
|
import Text from '../../Text/Text.js';
|
|
9
9
|
|
|
10
|
-
const keySortPriorities = {
|
|
11
|
-
control: 1,
|
|
12
|
-
meta: 2,
|
|
13
|
-
alt: 3,
|
|
14
|
-
option: 4,
|
|
15
|
-
shift: 5,
|
|
16
|
-
function: 6
|
|
17
|
-
};
|
|
18
|
-
const keySortPriority = priority => {
|
|
19
|
-
var _keySortPriorities$pr;
|
|
20
|
-
return (_keySortPriorities$pr = keySortPriorities[priority]) !== null && _keySortPriorities$pr !== void 0 ? _keySortPriorities$pr : Infinity;
|
|
21
|
-
};
|
|
22
|
-
const compareLowercaseKeys = (a, b) => keySortPriority(a) - keySortPriority(b);
|
|
23
|
-
|
|
24
|
-
/** Split and sort the chord keys in standard order. */
|
|
25
|
-
const splitChord = chord => chord.split('+').map(k => k.toLowerCase()).sort(compareLowercaseKeys);
|
|
26
10
|
const Chord = t0 => {
|
|
27
11
|
const $ = c(13);
|
|
28
12
|
const {
|
|
@@ -95,7 +79,4 @@ const Chord = t0 => {
|
|
|
95
79
|
return t10;
|
|
96
80
|
};
|
|
97
81
|
|
|
98
|
-
|
|
99
|
-
const accessibleChordString = (chord, platform) => splitChord(chord).map(key => accessibleKeyName(key, platform)).join(' ');
|
|
100
|
-
|
|
101
|
-
export { Chord, accessibleChordString };
|
|
82
|
+
export { Chord };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { KeybindingHintProps } from '../props';
|
|
2
|
-
import type { Platform } from '../platform';
|
|
3
2
|
export declare const Sequence: ({ keys, ...chordProps }: KeybindingHintProps) => import("react").JSX.Element[];
|
|
4
|
-
/** Plain string version of `Sequence` for use in `aria` string attributes. */
|
|
5
|
-
export declare const accessibleSequenceString: (sequence: string, platform: Platform) => string;
|
|
6
3
|
//# 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;AAMjD,eAAO,MAAM,QAAQ,GAAI,yBAAuB,mBAAmB,kCAa/D,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
2
|
import VisuallyHidden from '../../_VisuallyHidden.js';
|
|
3
|
-
import { Chord
|
|
3
|
+
import { Chord } 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(' ');
|
|
@@ -20,7 +20,4 @@ const Sequence = ({
|
|
|
20
20
|
})]
|
|
21
21
|
}, i));
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
const accessibleSequenceString = (sequence, platform) => splitSequence(sequence).map(chord => accessibleChordString(chord, platform)).join(' then ');
|
|
25
|
-
|
|
26
|
-
export { Sequence, accessibleSequenceString };
|
|
23
|
+
export { Sequence };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Platform } from '../platform';
|
|
2
|
+
/** Split and sort the chord keys in standard order. */
|
|
3
|
+
export declare const splitChord: (chord: string) => string[];
|
|
4
|
+
/** Plain string version of `Chord` for use in `aria` string attributes. */
|
|
5
|
+
export declare const accessibleChordString: (chord: string, platform: Platform) => string;
|
|
6
|
+
/** Plain string version of `Sequence` for use in `aria` string attributes. */
|
|
7
|
+
export declare const accessibleSequenceString: (sequence: string, platform: Platform) => string;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/KeybindingHint/components/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AAoBzC,uDAAuD;AACvD,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,aAIT,CAAA;AAI/B,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,EAAE,UAAU,QAAQ,WAGzD,CAAA;AAEd,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,EAAE,UAAU,QAAQ,WAG1D,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { accessibleKeyName } from '../key-names.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Consistent sort order for modifier keys. There should never be more than one non-modifier
|
|
5
|
+
* key in a chord, so we don't need to worry about sorting those - we just put them at
|
|
6
|
+
* the end.
|
|
7
|
+
*/
|
|
8
|
+
const keySortPriorities = {
|
|
9
|
+
control: 1,
|
|
10
|
+
meta: 2,
|
|
11
|
+
alt: 3,
|
|
12
|
+
option: 4,
|
|
13
|
+
shift: 5,
|
|
14
|
+
function: 6
|
|
15
|
+
};
|
|
16
|
+
const keySortPriority = priority => {
|
|
17
|
+
var _keySortPriorities$pr;
|
|
18
|
+
return (_keySortPriorities$pr = keySortPriorities[priority]) !== null && _keySortPriorities$pr !== void 0 ? _keySortPriorities$pr : Infinity;
|
|
19
|
+
};
|
|
20
|
+
const compareLowercaseKeys = (a, b) => keySortPriority(a) - keySortPriority(b);
|
|
21
|
+
|
|
22
|
+
/** Split and sort the chord keys in standard order. */
|
|
23
|
+
const splitChord = chord => chord.split('+').map(k => k.toLowerCase()).sort(compareLowercaseKeys);
|
|
24
|
+
const splitSequence = sequence => sequence.split(' ');
|
|
25
|
+
|
|
26
|
+
/** Plain string version of `Chord` for use in `aria` string attributes. */
|
|
27
|
+
const accessibleChordString = (chord, platform) => splitChord(chord).map(key => accessibleKeyName(key, platform)).join(' ');
|
|
28
|
+
|
|
29
|
+
/** Plain string version of `Sequence` for use in `aria` string attributes. */
|
|
30
|
+
const accessibleSequenceString = (sequence, platform) => splitSequence(sequence).map(chord => accessibleChordString(chord, platform)).join(' then ');
|
|
31
|
+
|
|
32
|
+
export { accessibleChordString, accessibleSequenceString, splitChord };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/KeybindingHint/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/KeybindingHint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,iCAAiC,EAAC,MAAM,SAAS,CAAA;AAEzD,YAAY,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Platform } from './platform';
|
|
2
|
+
/**
|
|
3
|
+
* AVOID: `KeybindingHint` is nearly always sufficient for providing both visible and accessible keyboard hints.
|
|
4
|
+
* However, there may be cases where we need a plain string version, such as when building `aria-label` or
|
|
5
|
+
* `aria-description`. In that case, this plain string builder can be used instead.
|
|
6
|
+
*
|
|
7
|
+
* NOTE that this string should _only_ be used when building `aria-label` or `aria-description` props (never rendered
|
|
8
|
+
* visibly) and should nearly always also be paired with a visible hint for sighted users.
|
|
9
|
+
*
|
|
10
|
+
* The `platform` argument controls how platform-specific keys (such as `Meta`, `Alt`, and `Mod`) are named. For
|
|
11
|
+
* backwards compatibility, a `boolean` may be passed instead, where `true` is treated as `'apple'` and `false` is
|
|
12
|
+
* treated as `'other'`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getAccessibleKeybindingHintString: (sequence: string, platform: Platform | boolean) => string;
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/KeybindingHint/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,GAAI,UAAU,MAAM,EAAE,UAAU,QAAQ,GAAG,OAAO,WACe,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { accessibleSequenceString } from './components/utils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AVOID: `KeybindingHint` is nearly always sufficient for providing both visible and accessible keyboard hints.
|
|
5
|
+
* However, there may be cases where we need a plain string version, such as when building `aria-label` or
|
|
6
|
+
* `aria-description`. In that case, this plain string builder can be used instead.
|
|
7
|
+
*
|
|
8
|
+
* NOTE that this string should _only_ be used when building `aria-label` or `aria-description` props (never rendered
|
|
9
|
+
* visibly) and should nearly always also be paired with a visible hint for sighted users.
|
|
10
|
+
*
|
|
11
|
+
* The `platform` argument controls how platform-specific keys (such as `Meta`, `Alt`, and `Mod`) are named. For
|
|
12
|
+
* backwards compatibility, a `boolean` may be passed instead, where `true` is treated as `'apple'` and `false` is
|
|
13
|
+
* treated as `'other'`.
|
|
14
|
+
*/
|
|
15
|
+
const getAccessibleKeybindingHintString = (sequence, platform) => accessibleSequenceString(sequence, typeof platform === 'boolean' ? platform ? 'apple' : 'other' : platform);
|
|
16
|
+
|
|
17
|
+
export { getAccessibleKeybindingHintString };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabelGroup.d.ts","sourceRoot":"","sources":["../../src/LabelGroup/LabelGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,MAAM,MAAM,eAAe,GAAG;IAC5B,2DAA2D;IAC3D,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,4LAA4L;IAC5L,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IACpC,4MAA4M;IAC5M,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AA6FD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"LabelGroup.d.ts","sourceRoot":"","sources":["../../src/LabelGroup/LabelGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,MAAM,MAAM,eAAe,GAAG;IAC5B,2DAA2D;IAC3D,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,4LAA4L;IAC5L,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IACpC,4MAA4M;IAC5M,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AA6FD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAuPlE,CAAA;AAID,eAAe,UAAU,CAAA"}
|
|
@@ -223,6 +223,7 @@ const LabelGroup = ({
|
|
|
223
223
|
}, [setVisibilityMap, setIsOverflowShown]);
|
|
224
224
|
React.useEffect(() => {
|
|
225
225
|
// If we're not truncating, we don't need to run this useEffect.
|
|
226
|
+
// eslint-disable-next-line react-you-might-not-need-an-effect/no-event-handler
|
|
226
227
|
if (!visibleChildCount || isOverflowShown) {
|
|
227
228
|
return;
|
|
228
229
|
}
|
|
@@ -267,6 +268,7 @@ const LabelGroup = ({
|
|
|
267
268
|
// We need to keep track of this so we can focus the first hidden child when the overflow is shown inline.
|
|
268
269
|
React.useEffect(() => {
|
|
269
270
|
// If we're using an overlay, we don't need to keep track of the first hidden index.
|
|
271
|
+
// eslint-disable-next-line react-you-might-not-need-an-effect/no-event-handler
|
|
270
272
|
if (overflowStyle === 'overlay') {
|
|
271
273
|
return;
|
|
272
274
|
}
|
|
@@ -279,11 +281,14 @@ const LabelGroup = ({
|
|
|
279
281
|
// We need to keep track of this so we can focus the first hidden child when the overflow is shown inline.
|
|
280
282
|
React.useEffect(() => {
|
|
281
283
|
// If we're using an overlay, we don't need to focus the first child that was previously hidden.
|
|
284
|
+
// eslint-disable-next-line react-you-might-not-need-an-effect/no-event-handler
|
|
282
285
|
if (overflowStyle === 'overlay') {
|
|
283
286
|
return;
|
|
284
287
|
}
|
|
285
288
|
const firstHiddenChildDOM = document.querySelector(`[data-index="${firstHiddenIndexRef.current}"]`);
|
|
286
289
|
const focusableChild = firstHiddenChildDOM ? getFocusableChild(firstHiddenChildDOM) : null;
|
|
290
|
+
|
|
291
|
+
// eslint-disable-next-line react-you-might-not-need-an-effect/no-event-handler
|
|
287
292
|
if (isOverflowShown) {
|
|
288
293
|
// If the first hidden child is focusable, focus it.
|
|
289
294
|
// Otherwise, focus the collapse button.
|
|
@@ -4,6 +4,7 @@ import type { AriaRole, Merge } from '../utils/types';
|
|
|
4
4
|
import type { TouchOrMouseEvent } from '../hooks';
|
|
5
5
|
import type { AnchorSide } from '@primer/behaviors';
|
|
6
6
|
import type { ForwardRefComponent as PolymorphicForwardRefComponent } from '../utils/polymorphic';
|
|
7
|
+
import type { heightMap, widthMap } from './constants';
|
|
7
8
|
type StyledOverlayProps = {
|
|
8
9
|
width?: keyof typeof widthMap;
|
|
9
10
|
height?: keyof typeof heightMap;
|
|
@@ -13,24 +14,6 @@ type StyledOverlayProps = {
|
|
|
13
14
|
overflow?: 'auto' | 'hidden' | 'scroll' | 'visible';
|
|
14
15
|
style?: React.CSSProperties;
|
|
15
16
|
};
|
|
16
|
-
export declare const heightMap: {
|
|
17
|
-
xsmall: string;
|
|
18
|
-
small: string;
|
|
19
|
-
medium: string;
|
|
20
|
-
large: string;
|
|
21
|
-
xlarge: string;
|
|
22
|
-
auto: string;
|
|
23
|
-
initial: string;
|
|
24
|
-
'fit-content': string;
|
|
25
|
-
};
|
|
26
|
-
export declare const widthMap: {
|
|
27
|
-
small: string;
|
|
28
|
-
medium: string;
|
|
29
|
-
large: string;
|
|
30
|
-
xlarge: string;
|
|
31
|
-
xxlarge: string;
|
|
32
|
-
auto: string;
|
|
33
|
-
};
|
|
34
17
|
type BaseOverlayProps = {
|
|
35
18
|
visibility?: 'visible' | 'hidden';
|
|
36
19
|
'data-test-id'?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAe,MAAM,OAAO,CAAA;AAC9D,OAAO,KAA0B,MAAM,OAAO,CAAA;AAE9C,OAAO,KAAK,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAA;AAG/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"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"}
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -9,25 +9,6 @@ import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
|
9
9
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
10
10
|
import { useOverlay } from '../hooks/useOverlay.js';
|
|
11
11
|
|
|
12
|
-
const heightMap = {
|
|
13
|
-
xsmall: '192px',
|
|
14
|
-
small: '256px',
|
|
15
|
-
medium: '320px',
|
|
16
|
-
large: '432px',
|
|
17
|
-
xlarge: '600px',
|
|
18
|
-
auto: 'auto',
|
|
19
|
-
initial: 'auto',
|
|
20
|
-
// Passing 'initial' initially applies 'auto'
|
|
21
|
-
'fit-content': 'fit-content'
|
|
22
|
-
};
|
|
23
|
-
const widthMap = {
|
|
24
|
-
small: '256px',
|
|
25
|
-
medium: '320px',
|
|
26
|
-
large: '480px',
|
|
27
|
-
xlarge: '640px',
|
|
28
|
-
xxlarge: '960px',
|
|
29
|
-
auto: 'auto'
|
|
30
|
-
};
|
|
31
12
|
const animationDuration = 200;
|
|
32
13
|
function getSlideAnimationStartingVector(anchorSide) {
|
|
33
14
|
if (anchorSide !== null && anchorSide !== void 0 && anchorSide.endsWith('bottom')) {
|
|
@@ -329,4 +310,4 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
329
310
|
return t13;
|
|
330
311
|
});
|
|
331
312
|
|
|
332
|
-
export { BaseOverlay, Overlay as default
|
|
313
|
+
export { BaseOverlay, Overlay as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const heightMap: {
|
|
2
|
+
xsmall: string;
|
|
3
|
+
small: string;
|
|
4
|
+
medium: string;
|
|
5
|
+
large: string;
|
|
6
|
+
xlarge: string;
|
|
7
|
+
auto: string;
|
|
8
|
+
initial: string;
|
|
9
|
+
'fit-content': string;
|
|
10
|
+
};
|
|
11
|
+
export declare const widthMap: {
|
|
12
|
+
small: string;
|
|
13
|
+
medium: string;
|
|
14
|
+
large: string;
|
|
15
|
+
xlarge: string;
|
|
16
|
+
xxlarge: string;
|
|
17
|
+
auto: string;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/Overlay/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;CASrB,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;;;CAOpB,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const heightMap = {
|
|
2
|
+
xsmall: '192px',
|
|
3
|
+
small: '256px',
|
|
4
|
+
medium: '320px',
|
|
5
|
+
large: '432px',
|
|
6
|
+
xlarge: '600px',
|
|
7
|
+
auto: 'auto',
|
|
8
|
+
initial: 'auto',
|
|
9
|
+
'fit-content': 'fit-content'
|
|
10
|
+
};
|
|
11
|
+
const widthMap = {
|
|
12
|
+
small: '256px',
|
|
13
|
+
medium: '320px',
|
|
14
|
+
large: '480px',
|
|
15
|
+
xlarge: '640px',
|
|
16
|
+
xxlarge: '960px',
|
|
17
|
+
auto: 'auto'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { heightMap, widthMap };
|
package/dist/Portal/Portal.d.ts
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Register a container to serve as a portal root.
|
|
4
|
-
* @param root The element that will be the root for portals created in this container
|
|
5
|
-
* @param name The name of the container, to be used with the `containerName` prop on the Portal Component.
|
|
6
|
-
* If name is not specified, registers the default portal root.
|
|
7
|
-
*/
|
|
8
|
-
export declare function registerPortalRoot(root: Element, name?: string): void;
|
|
9
|
-
/**
|
|
10
|
-
* Provides the ability for component trees to override the portal root container for a sub-set of the experience.
|
|
11
|
-
* The portal will prioritize the context value unless overridden by their own `containerName` prop, and fallback to the default root if neither are specified
|
|
12
|
-
*/
|
|
13
|
-
export declare const PortalContext: React.Context<{
|
|
14
|
-
portalContainerName?: string;
|
|
15
|
-
}>;
|
|
16
2
|
export interface PortalProps {
|
|
17
3
|
/**
|
|
18
4
|
* Called when this portal is added to the DOM
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../src/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../src/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAMvC,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAEpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CA6CjE,CAAA"}
|
package/dist/Portal/Portal.js
CHANGED
|
@@ -1,51 +1,9 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
|
+
import { PortalContext } from './PortalContext.js';
|
|
5
|
+
import { DEFAULT_PORTAL_CONTAINER_NAME, ensureDefaultPortal, getPortalRoot } from './portalRoot.js';
|
|
4
6
|
|
|
5
|
-
const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
|
|
6
|
-
const DEFAULT_PORTAL_CONTAINER_NAME = '__default__';
|
|
7
|
-
const portalRootRegistry = {};
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Register a container to serve as a portal root.
|
|
11
|
-
* @param root The element that will be the root for portals created in this container
|
|
12
|
-
* @param name The name of the container, to be used with the `containerName` prop on the Portal Component.
|
|
13
|
-
* If name is not specified, registers the default portal root.
|
|
14
|
-
*/
|
|
15
|
-
function registerPortalRoot(root, name = DEFAULT_PORTAL_CONTAINER_NAME) {
|
|
16
|
-
portalRootRegistry[name] = root;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Ensures that a default portal root exists and is registered. If a DOM element exists
|
|
20
|
-
// with id __primerPortalRoot__, allow that element to serve as the default portal root.
|
|
21
|
-
// Otherwise, create that element and attach it to the end of document.body.
|
|
22
|
-
function ensureDefaultPortal() {
|
|
23
|
-
const existingDefaultPortalContainer = portalRootRegistry[DEFAULT_PORTAL_CONTAINER_NAME];
|
|
24
|
-
if (!existingDefaultPortalContainer || !document.body.contains(existingDefaultPortalContainer)) {
|
|
25
|
-
let defaultPortalContainer = document.getElementById(PRIMER_PORTAL_ROOT_ID);
|
|
26
|
-
if (!(defaultPortalContainer instanceof Element)) {
|
|
27
|
-
defaultPortalContainer = document.createElement('div');
|
|
28
|
-
defaultPortalContainer.setAttribute('id', PRIMER_PORTAL_ROOT_ID);
|
|
29
|
-
defaultPortalContainer.style.position = 'absolute';
|
|
30
|
-
defaultPortalContainer.style.top = '0';
|
|
31
|
-
defaultPortalContainer.style.left = '0';
|
|
32
|
-
defaultPortalContainer.style.width = '100%';
|
|
33
|
-
const suitablePortalRoot = document.querySelector('[data-portal-root]');
|
|
34
|
-
if (suitablePortalRoot) {
|
|
35
|
-
suitablePortalRoot.appendChild(defaultPortalContainer);
|
|
36
|
-
} else {
|
|
37
|
-
document.body.appendChild(defaultPortalContainer);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
registerPortalRoot(defaultPortalContainer);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Provides the ability for component trees to override the portal root container for a sub-set of the experience.
|
|
46
|
-
* The portal will prioritize the context value unless overridden by their own `containerName` prop, and fallback to the default root if neither are specified
|
|
47
|
-
*/
|
|
48
|
-
const PortalContext = /*#__PURE__*/React.createContext({});
|
|
49
7
|
/**
|
|
50
8
|
* Creates a React Portal, placing all children in a separate physical DOM root node.
|
|
51
9
|
* @see https://reactjs.org/docs/portals.html
|
|
@@ -79,7 +37,7 @@ const Portal = ({
|
|
|
79
37
|
containerName = DEFAULT_PORTAL_CONTAINER_NAME;
|
|
80
38
|
ensureDefaultPortal();
|
|
81
39
|
}
|
|
82
|
-
const parentElement =
|
|
40
|
+
const parentElement = getPortalRoot(containerName);
|
|
83
41
|
if (!parentElement) {
|
|
84
42
|
throw new Error(`Portal container '${containerName}' is not yet registered. Container must be registered with registerPortalRoot before use.`);
|
|
85
43
|
}
|
|
@@ -93,4 +51,4 @@ const Portal = ({
|
|
|
93
51
|
return /*#__PURE__*/createPortal(children, element);
|
|
94
52
|
};
|
|
95
53
|
|
|
96
|
-
export { Portal
|
|
54
|
+
export { Portal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalContext.d.ts","sourceRoot":"","sources":["../../src/Portal/PortalContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,aAAa;0BACF,MAAM;EACxB,CAAA"}
|
package/dist/Portal/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PortalProps } from './Portal';
|
|
2
|
-
import { Portal
|
|
2
|
+
import { Portal } from './Portal';
|
|
3
|
+
import { PortalContext } from './PortalContext';
|
|
4
|
+
import { registerPortalRoot } from './portalRoot';
|
|
3
5
|
export default Portal;
|
|
4
6
|
export { registerPortalRoot };
|
|
5
7
|
export type { PortalProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Portal/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAA;AACzC,OAAO,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Portal/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAA;AACzC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAA;AAE/C,eAAe,MAAM,CAAA;AACrB,OAAO,EAAC,kBAAkB,EAAC,CAAA;AAC3B,YAAY,EAAC,WAAW,EAAC,CAAA;AACzB,OAAO,EAAC,aAAa,EAAC,CAAA"}
|
package/dist/Portal/index.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const DEFAULT_PORTAL_CONTAINER_NAME = "__default__";
|
|
2
|
+
/**
|
|
3
|
+
* Register a container to serve as a portal root.
|
|
4
|
+
* @param root The element that will be the root for portals created in this container
|
|
5
|
+
* @param name The name of the container, to be used with the `containerName` prop on the Portal Component.
|
|
6
|
+
* If name is not specified, registers the default portal root.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerPortalRoot(root: Element, name?: string): void;
|
|
9
|
+
export declare function ensureDefaultPortal(): void;
|
|
10
|
+
export declare function getPortalRoot(name: string): Element | undefined;
|
|
11
|
+
//# sourceMappingURL=portalRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portalRoot.d.ts","sourceRoot":"","sources":["../../src/Portal/portalRoot.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,6BAA6B,gBAAgB,CAAA;AAI1D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,SAAgC,GAAG,IAAI,CAE5F;AAED,wBAAgB,mBAAmB,SAqBlC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,uBAEzC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
|
|
2
|
+
const DEFAULT_PORTAL_CONTAINER_NAME = '__default__';
|
|
3
|
+
const portalRootRegistry = {};
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Register a container to serve as a portal root.
|
|
7
|
+
* @param root The element that will be the root for portals created in this container
|
|
8
|
+
* @param name The name of the container, to be used with the `containerName` prop on the Portal Component.
|
|
9
|
+
* If name is not specified, registers the default portal root.
|
|
10
|
+
*/
|
|
11
|
+
function registerPortalRoot(root, name = DEFAULT_PORTAL_CONTAINER_NAME) {
|
|
12
|
+
portalRootRegistry[name] = root;
|
|
13
|
+
}
|
|
14
|
+
function ensureDefaultPortal() {
|
|
15
|
+
const existingDefaultPortalContainer = portalRootRegistry[DEFAULT_PORTAL_CONTAINER_NAME];
|
|
16
|
+
if (!existingDefaultPortalContainer || !document.body.contains(existingDefaultPortalContainer)) {
|
|
17
|
+
let defaultPortalContainer = document.getElementById(PRIMER_PORTAL_ROOT_ID);
|
|
18
|
+
if (!(defaultPortalContainer instanceof Element)) {
|
|
19
|
+
defaultPortalContainer = document.createElement('div');
|
|
20
|
+
defaultPortalContainer.setAttribute('id', PRIMER_PORTAL_ROOT_ID);
|
|
21
|
+
defaultPortalContainer.style.position = 'absolute';
|
|
22
|
+
defaultPortalContainer.style.top = '0';
|
|
23
|
+
defaultPortalContainer.style.left = '0';
|
|
24
|
+
defaultPortalContainer.style.width = '100%';
|
|
25
|
+
const suitablePortalRoot = document.querySelector('[data-portal-root]');
|
|
26
|
+
if (suitablePortalRoot) {
|
|
27
|
+
suitablePortalRoot.appendChild(defaultPortalContainer);
|
|
28
|
+
} else {
|
|
29
|
+
document.body.appendChild(defaultPortalContainer);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
registerPortalRoot(defaultPortalContainer);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function getPortalRoot(name) {
|
|
36
|
+
return portalRootRegistry[name];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { DEFAULT_PORTAL_CONTAINER_NAME, ensureDefaultPortal, getPortalRoot, registerPortalRoot };
|
package/dist/Radio/Radio.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
|
-
import { RadioGroupContext } from '../RadioGroup/
|
|
3
|
+
import { RadioGroupContext } from '../RadioGroup/RadioGroupContext.js';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import sharedClasses from '../Checkbox/shared.module.css.js';
|
|
6
6
|
import classes from './Radio.module.css.js';
|