@primer/react 38.29.0-rc.30acfb591 → 38.29.0-rc.d7f442775
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/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/Item.js +3 -2
- package/dist/ActionList/Selection.js +1 -1
- 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.js +2 -1
- package/dist/Button/IconButton.d.ts.map +1 -1
- package/dist/Button/IconButton.js +3 -2
- package/dist/Dialog/Dialog.d.ts +0 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +2 -4
- 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/FilteredActionList/FilteredActionList.js +2 -1
- package/dist/FilteredActionList/FilteredActionListLoaders.d.ts +2 -10
- package/dist/FilteredActionList/FilteredActionListLoaders.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionListLoaders.js +3 -12
- 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/KeybindingHint/KeybindingHint.js +2 -1
- package/dist/KeybindingHint/components/Chord.d.ts +2 -3
- package/dist/KeybindingHint/components/Chord.d.ts.map +1 -1
- package/dist/KeybindingHint/components/Chord.js +3 -21
- package/dist/KeybindingHint/components/Sequence.d.ts +2 -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/Overlay/Overlay.d.ts +2 -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.js +2 -1
- package/dist/Timeline/Timeline.d.ts +2 -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/Token/IssueLabelToken.js +3 -1
- package/dist/Token/Token.js +3 -1
- package/dist/Token/TokenBase.d.ts +4 -5
- package/dist/Token/TokenBase.d.ts.map +1 -1
- package/dist/Token/TokenBase.js +2 -13
- package/dist/Token/_RemoveTokenButton.js +5 -2
- 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 +2 -2
- 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/UnderlineNav/UnderlineNav.d.ts +2 -1
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +1 -4
- 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.js +2 -1
- package/dist/experimental/index.js +1 -1
- 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/useMedia.d.ts +1 -24
- package/dist/hooks/useMedia.d.ts.map +1 -1
- package/dist/hooks/useMedia.js +15 -6
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ import { ActionList } from '../ActionList/index.js';
|
|
|
13
13
|
import { invariant } from '../utils/invariant.js';
|
|
14
14
|
import classes from './UnderlineNav.module.css.js';
|
|
15
15
|
import { getAnchoredPosition } from '@primer/behaviors';
|
|
16
|
+
import { getValidChildren } from './utils.js';
|
|
16
17
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
17
18
|
import { ButtonComponent } from '../Button/Button.js';
|
|
18
19
|
import CounterLabel from '../CounterLabel/CounterLabel.js';
|
|
@@ -82,10 +83,6 @@ const overflowEffect = (navWidth, moreMenuWidth, childArray, childWidthArray, no
|
|
|
82
83
|
menuItems
|
|
83
84
|
}, iconsVisible, true);
|
|
84
85
|
};
|
|
85
|
-
const getValidChildren = children => {
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
-
return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
|
|
88
|
-
};
|
|
89
86
|
const calculatePossibleItems = (childWidthArray, navWidth, moreMenuWidth = 0) => {
|
|
90
87
|
const widthToFit = navWidth - moreMenuWidth;
|
|
91
88
|
let breakpoint = childWidthArray.length; // assume all items will fit
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,CAAC,SAAS,KAEgC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAChH,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const getValidChildren = children => {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { getValidChildren };
|
|
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
2
2
|
import { AlertIcon, SearchIcon, XCircleFillIcon, ArrowLeftIcon, FilterRemoveIcon, XIcon } from '@primer/octicons-react';
|
|
3
3
|
import { ActionListContainerContext } from '../../ActionList/ActionListContainerContext.js';
|
|
4
4
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
5
|
-
import { BaseOverlay
|
|
5
|
+
import { BaseOverlay } from '../../Overlay/Overlay.js';
|
|
6
6
|
import { InputLabel } from '../../internal/components/InputLabel.js';
|
|
7
7
|
import { invariant } from '../../utils/invariant.js';
|
|
8
8
|
import { useResponsiveValue } from '../../hooks/useResponsiveValue.js';
|
|
@@ -13,6 +13,7 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
13
13
|
import { useProvidedRefOrCreate } from '../../hooks/useProvidedRefOrCreate.js';
|
|
14
14
|
import { useId } from '../../hooks/useId.js';
|
|
15
15
|
import { useAnchoredPosition } from '../../hooks/useAnchoredPosition.js';
|
|
16
|
+
import { heightMap } from '../../Overlay/constants.js';
|
|
16
17
|
import { AriaStatus } from '../../live-region/AriaStatus.js';
|
|
17
18
|
import Octicon from '../../Octicon/Octicon.js';
|
|
18
19
|
import Spinner from '../../Spinner/Spinner.js';
|
|
@@ -14,7 +14,7 @@ export { DataTable } from '../DataTable/DataTable.js';
|
|
|
14
14
|
export { DefaultFeatureFlags } from '../FeatureFlags/DefaultFeatureFlags.js';
|
|
15
15
|
export { Dialog } from '../Dialog/Dialog.js';
|
|
16
16
|
export { FeatureFlags } from '../FeatureFlags/FeatureFlags.js';
|
|
17
|
-
export { FilteredActionListLoadingTypes } from '../FilteredActionList/
|
|
17
|
+
export { FilteredActionListLoadingTypes } from '../FilteredActionList/constants.js';
|
|
18
18
|
export { Hidden } from '../Hidden/Hidden.js';
|
|
19
19
|
export { InlineMessage } from '../InlineMessage/InlineMessage.js';
|
|
20
20
|
export { IssueLabel } from './IssueLabel/IssueLabel.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type MediaQueryFeatures } from './MatchMediaContext';
|
|
3
|
+
type MatchMediaProps = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
features?: MediaQueryFeatures;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Use `MatchMedia` to emulate media conditions by passing in feature
|
|
9
|
+
* queries to the `features` prop. If a component uses `useMedia` with the
|
|
10
|
+
* feature passed in to `MatchMedia` it will force its value to match what is
|
|
11
|
+
* provided to `MatchMedia`
|
|
12
|
+
*
|
|
13
|
+
* This should be used for development and documentation only in situations
|
|
14
|
+
* where devtools cannot emulate this feature
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <MatchMedia features={{ "(pointer: coarse)": true}}>
|
|
18
|
+
* <Children />
|
|
19
|
+
* </MatchMedia>
|
|
20
|
+
*/
|
|
21
|
+
export declare function MatchMedia({ children, features }: MatchMediaProps): React.JSX.Element;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=MatchMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchMedia.d.ts","sourceRoot":"","sources":["../../src/hooks/MatchMedia.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAoB,KAAK,kBAAkB,EAAC,MAAM,qBAAqB,CAAA;AAE9E,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAC9B,CAAA;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,EAAC,QAAQ,EAAE,QAA0B,EAAC,EAAE,eAAe,qBAGjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchMediaContext.d.ts","sourceRoot":"","sources":["../../src/hooks/MatchMediaContext.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;CACnC,CAAA;AAKD,eAAO,MAAM,iBAAiB,6CAAwC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
// Used to keep track of overrides to specific media query features, this should
|
|
4
|
+
// be used for development and demo purposes to emulate specific features if
|
|
5
|
+
// unavailable through devtools
|
|
6
|
+
const MatchMediaContext = /*#__PURE__*/createContext({});
|
|
7
|
+
|
|
8
|
+
export { MatchMediaContext };
|
package/dist/hooks/useMedia.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
/**
|
|
3
2
|
* `useMedia` will use the given `mediaQueryString` with `matchMedia` to
|
|
4
3
|
* determine if the document matches the media query string.
|
|
@@ -13,27 +12,5 @@ import React from 'react';
|
|
|
13
12
|
* }
|
|
14
13
|
*/
|
|
15
14
|
export declare function useMedia(mediaQueryString: string, defaultState?: boolean): boolean;
|
|
16
|
-
|
|
17
|
-
[key: string]: boolean | undefined;
|
|
18
|
-
};
|
|
19
|
-
type MatchMediaProps = {
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
features?: MediaQueryFeatures;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Use `MatchMedia` to emulate media conditions by passing in feature
|
|
25
|
-
* queries to the `features` prop. If a component uses `useMedia` with the
|
|
26
|
-
* feature passed in to `MatchMedia` it will force its value to match what is
|
|
27
|
-
* provided to `MatchMedia`
|
|
28
|
-
*
|
|
29
|
-
* This should be used for development and documentation only in situations
|
|
30
|
-
* where devtools cannot emulate this feature
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* <MatchMedia features={{ "(pointer: coarse)": true}}>
|
|
34
|
-
* <Children />
|
|
35
|
-
* </MatchMedia>
|
|
36
|
-
*/
|
|
37
|
-
export declare function MatchMedia({ children, features }: MatchMediaProps): React.JSX.Element;
|
|
38
|
-
export {};
|
|
15
|
+
export { MatchMedia } from './MatchMedia';
|
|
39
16
|
//# sourceMappingURL=useMedia.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../src/hooks/useMedia.
|
|
1
|
+
{"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../src/hooks/useMedia.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,WAmExE;AAED,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA"}
|
package/dist/hooks/useMedia.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, { useContext, useEffect
|
|
3
|
-
import '
|
|
2
|
+
import React, { useContext, useEffect } from 'react';
|
|
3
|
+
import { MatchMediaContext } from './MatchMediaContext.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* `useMedia` will use the given `mediaQueryString` with `matchMedia` to
|
|
7
|
+
* determine if the document matches the media query string.
|
|
8
|
+
*
|
|
9
|
+
* If `MatchMedia` is used as an ancestor, `useMedia` will instead use the
|
|
10
|
+
* value of the media query string, if available
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* function Example() {
|
|
14
|
+
* const coarsePointer = useMedia('(pointer: coarse)');
|
|
15
|
+
* // ...
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
5
18
|
function useMedia(mediaQueryString, defaultState) {
|
|
6
19
|
const $ = c(8);
|
|
7
20
|
const features = useContext(MatchMediaContext);
|
|
@@ -63,9 +76,5 @@ function useMedia(mediaQueryString, defaultState) {
|
|
|
63
76
|
useEffect(t1, t2);
|
|
64
77
|
return matches;
|
|
65
78
|
}
|
|
66
|
-
// Used to keep track of overrides to specific media query features, this should
|
|
67
|
-
// be used for development and demo purposes to emulate specific features if
|
|
68
|
-
// unavailable through devtools
|
|
69
|
-
const MatchMediaContext = /*#__PURE__*/createContext({});
|
|
70
79
|
|
|
71
80
|
export { useMedia };
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,9 @@ export { ActionList } from './ActionList/index.js';
|
|
|
28
28
|
export { Banner } from './Banner/index.js';
|
|
29
29
|
export { default as Label } from './Label/Label.js';
|
|
30
30
|
export { default as Pagination } from './Pagination/Pagination.js';
|
|
31
|
-
export { Portal
|
|
31
|
+
export { Portal } from './Portal/Portal.js';
|
|
32
|
+
export { PortalContext } from './Portal/PortalContext.js';
|
|
33
|
+
export { registerPortalRoot } from './Portal/portalRoot.js';
|
|
32
34
|
export { ProgressBar } from './ProgressBar/index.js';
|
|
33
35
|
export { default as SideNav } from './SideNav.js';
|
|
34
36
|
export { useRovingTabIndex } from './TreeView/useRovingTabIndex.js';
|
package/package.json
CHANGED