@primer/react 38.30.0-rc.dc0369509 → 38.30.1-rc.0d136c1b7
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 +22 -0
- package/dist/ActionBar/ActionBar.d.ts +24 -1
- package/dist/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar/ActionBar.js +96 -4
- package/dist/ActionBar/index.d.ts +21 -1
- package/dist/ActionBar/index.d.ts.map +1 -1
- package/dist/ActionBar/index.js +2 -1
- package/dist/AvatarStack/AvatarStack.js +231 -117
- package/dist/Heading/Heading.js +69 -19
- package/dist/Link/Link.js +81 -25
- package/dist/NavList/NavList-b50d982b.css +2 -0
- package/dist/NavList/NavList-b50d982b.css.map +1 -0
- package/dist/NavList/NavList.d.ts +13 -4
- package/dist/NavList/NavList.d.ts.map +1 -1
- package/dist/NavList/NavList.js +238 -70
- package/dist/NavList/NavList.module.css.js +2 -2
- package/dist/Pagehead/Pagehead.js +45 -11
- package/dist/SelectPanel/SelectPanel.d.ts +2 -2
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +4 -1
- package/dist/SideNav.js +112 -41
- package/dist/UnderlineNav/UnderlineNav-47547980.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts +1 -2
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +91 -331
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +1 -11
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +1 -4
- package/dist/UnderlineNav/UnderlineNavItem-402cd41c.css +2 -0
- package/dist/UnderlineNav/UnderlineNavItem-402cd41c.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItem.d.ts +1 -44
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +33 -38
- package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts +51 -0
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.js +8 -0
- package/dist/UnderlineNav/index.d.ts +1 -1
- package/dist/UnderlineNav/index.d.ts.map +1 -1
- package/dist/UnderlineNav/utils.d.ts +2 -0
- package/dist/UnderlineNav/utils.d.ts.map +1 -1
- package/dist/UnderlineNav/utils.js +2 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css +2 -0
- package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css.map +1 -0
- package/dist/experimental/UnderlinePanels/UnderlinePanels.d.ts.map +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +8 -11
- package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +196 -75
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupCaption.js +33 -11
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel.js +53 -16
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation.js +27 -12
- package/dist/internal/components/InputValidation.js +1 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts +0 -1
- package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +66 -60
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/generated/components.json +72 -5
- package/package.json +1 -1
- package/dist/NavList/NavList-5dc067e3.css +0 -2
- package/dist/NavList/NavList-5dc067e3.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +0 -2
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +0 -1
- package/dist/UnderlineNav/styles.d.ts +0 -16
- package/dist/UnderlineNav/styles.d.ts.map +0 -1
- package/dist/UnderlineNav/styles.js +0 -19
- package/dist/UnderlineNav/types.d.ts +0 -10
- package/dist/UnderlineNav/types.d.ts.map +0 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css +0 -2
- package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +0 -1
|
@@ -1,46 +1,39 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useContext } from 'react';
|
|
1
|
+
import React, { forwardRef, useRef, useContext, useSyncExternalStore, useCallback } from 'react';
|
|
2
2
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
3
|
-
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
3
|
import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
|
|
5
4
|
import classes from './UnderlineNavItem.module.css.js';
|
|
5
|
+
import { UnderlineNavItemsRegistry } from './UnderlineNavItemsRegistry.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
|
-
const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
9
|
-
as: Component = 'a',
|
|
10
|
-
href = '#',
|
|
11
|
-
children,
|
|
12
|
-
counter,
|
|
13
|
-
onSelect,
|
|
14
|
-
'aria-current': ariaCurrent,
|
|
15
|
-
icon: Icon,
|
|
16
|
-
leadingVisual,
|
|
17
|
-
...props
|
|
18
|
-
}, forwardedRef) => {
|
|
19
|
-
const backupRef = useRef(null);
|
|
20
|
-
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
8
|
+
const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
21
9
|
const {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
as: Component = 'a',
|
|
11
|
+
href = '#',
|
|
12
|
+
children,
|
|
13
|
+
counter,
|
|
14
|
+
onSelect,
|
|
15
|
+
'aria-current': ariaCurrent,
|
|
16
|
+
icon: Icon,
|
|
17
|
+
leadingVisual,
|
|
18
|
+
...props
|
|
19
|
+
} = allProps;
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
const {
|
|
22
|
+
loadingCounters
|
|
26
23
|
} = useContext(UnderlineNavContext);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
width: domRect.width - iconWidthWithMargin
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}, [ref, setChildrenWidth, setNoIconChildrenWidth]);
|
|
24
|
+
const isOverflowing = useSyncExternalStore(useCallback(onChange => {
|
|
25
|
+
const observer = new IntersectionObserver(() => onChange(), {
|
|
26
|
+
threshold: 1
|
|
27
|
+
});
|
|
28
|
+
if (ref.current) observer.observe(ref.current);
|
|
29
|
+
return () => observer.disconnect();
|
|
30
|
+
}, [ref]),
|
|
31
|
+
// Note: the IntersectionObserver is just being used as a trigger to re-check
|
|
32
|
+
// `offsetTop > 0`; this is fast and simpler than checking visibility from
|
|
33
|
+
// the observed entry. When an item wraps, it will move to the next row which
|
|
34
|
+
// increases its `offsetTop`
|
|
35
|
+
() => ref.current ? ref.current.offsetTop > 0 : false, () => false);
|
|
36
|
+
UnderlineNavItemsRegistry.useRegisterDescendant(isOverflowing ? allProps : null);
|
|
44
37
|
const keyDownHandler = React.useCallback(event => {
|
|
45
38
|
if ((event.key === ' ' || event.key === 'Enter') && !event.defaultPrevented && typeof onSelect === 'function') {
|
|
46
39
|
onSelect(event);
|
|
@@ -53,8 +46,10 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
|
53
46
|
}, [onSelect]);
|
|
54
47
|
return /*#__PURE__*/jsx("li", {
|
|
55
48
|
className: classes.UnderlineNavItem,
|
|
49
|
+
ref: ref,
|
|
50
|
+
"aria-hidden": isOverflowing ? true : allProps['aria-hidden'],
|
|
56
51
|
children: /*#__PURE__*/jsx(UnderlineItem, {
|
|
57
|
-
ref:
|
|
52
|
+
ref: forwardedRef,
|
|
58
53
|
as: Component,
|
|
59
54
|
href: href,
|
|
60
55
|
"aria-current": ariaCurrent,
|
|
@@ -63,8 +58,8 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
|
63
58
|
counter: counter,
|
|
64
59
|
icon: leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : Icon,
|
|
65
60
|
loadingCounters: loadingCounters,
|
|
66
|
-
iconsVisible: iconsVisible,
|
|
67
61
|
...props,
|
|
62
|
+
tabIndex: isOverflowing ? -1 : allProps.tabIndex,
|
|
68
63
|
children: children
|
|
69
64
|
})
|
|
70
65
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IconProps } from '@primer/octicons-react';
|
|
2
|
+
type LinkProps = {
|
|
3
|
+
download?: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
hrefLang?: string;
|
|
6
|
+
media?: string;
|
|
7
|
+
ping?: string;
|
|
8
|
+
rel?: string;
|
|
9
|
+
target?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>['referrerPolicy'];
|
|
12
|
+
};
|
|
13
|
+
export type UnderlineNavItemProps = {
|
|
14
|
+
/**
|
|
15
|
+
* Primary content for an UnderlineNav
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Callback that will trigger both on click selection and keyboard selection.
|
|
20
|
+
*/
|
|
21
|
+
onSelect?: (event: React.MouseEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLAnchorElement>) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Is `UnderlineNav.Item` current page?
|
|
24
|
+
*/
|
|
25
|
+
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Icon before the text
|
|
28
|
+
* @deprecated Use the `leadingVisual` prop instead
|
|
29
|
+
*/
|
|
30
|
+
icon?: React.FunctionComponent<IconProps> | React.ReactElement<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Render a visual before the text
|
|
33
|
+
*/
|
|
34
|
+
leadingVisual?: React.ReactElement;
|
|
35
|
+
/**
|
|
36
|
+
* Renders `UnderlineNav.Item` as given component i.e. react-router's Link
|
|
37
|
+
**/
|
|
38
|
+
as?: React.ElementType | 'a';
|
|
39
|
+
/**
|
|
40
|
+
* Counter
|
|
41
|
+
*/
|
|
42
|
+
counter?: number | string;
|
|
43
|
+
} & LinkProps;
|
|
44
|
+
/** Registry of currently-overflowing underline items. If an item is not overflowing, its value will be `null`. */
|
|
45
|
+
export declare const UnderlineNavItemsRegistry: {
|
|
46
|
+
Provider: ({ children, setRegistry }: import("../utils/descendant-registry").ProviderProps<UnderlineNavItemProps | null>) => import("react").JSX.Element;
|
|
47
|
+
useRegistryState: () => [ReadonlyMap<string, UnderlineNavItemProps | null> | undefined, import("react").Dispatch<import("react").SetStateAction<ReadonlyMap<string, UnderlineNavItemProps | null> | undefined>>];
|
|
48
|
+
useRegisterDescendant: (value: UnderlineNavItemProps | null) => string;
|
|
49
|
+
};
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=UnderlineNavItemsRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnderlineNavItemsRegistry.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItemsRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAIrD,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACjF,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAExG;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAE5F;;;OAGG;IAEH,IAAI,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAEnE;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAElC;;QAEI;IACJ,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,GAAG,CAAA;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,GAAG,SAAS,CAAA;AAEb,kHAAkH;AAClH,eAAO,MAAM,yBAAyB;;;;CAA2D,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createDescendantRegistry } from '../utils/descendant-registry.js';
|
|
2
|
+
|
|
3
|
+
// adopted from React.AnchorHTMLAttributes
|
|
4
|
+
|
|
5
|
+
/** Registry of currently-overflowing underline items. If an item is not overflowing, its value will be `null`. */
|
|
6
|
+
const UnderlineNavItemsRegistry = createDescendantRegistry();
|
|
7
|
+
|
|
8
|
+
export { UnderlineNavItemsRegistry };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UnderlineNavProps } from './UnderlineNav';
|
|
2
|
-
import type { UnderlineNavItemProps } from './
|
|
2
|
+
import type { UnderlineNavItemProps } from './UnderlineNavItemsRegistry';
|
|
3
3
|
declare const UnderlineNav: import("react").ForwardRefExoticComponent<UnderlineNavProps & import("react").RefAttributes<unknown>> & {
|
|
4
4
|
Item: import("../utils/polymorphic").ForwardRefComponent<"a", UnderlineNavItemProps>;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAErD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAErD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,6BAA6B,CAAA;AAGtE,QAAA,MAAM,YAAY;;CAEhB,CAAA;AAEF,OAAO,EAAC,YAAY,EAAC,CAAA;AACrB,YAAY,EAAC,iBAAiB,EAAE,qBAAqB,EAAC,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { UnderlineNavItemProps } from './UnderlineNavItemsRegistry';
|
|
2
3
|
export declare const getValidChildren: (children: React.ReactNode) => React.ReactElement<any>[];
|
|
4
|
+
export declare const isCurrent: (props: UnderlineNavItemProps) => boolean;
|
|
3
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,6BAA6B,CAAA;AAEtE,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,CAAC,SAAS,KAEgC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAChH,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,OAAO,qBAAqB,YACuD,CAAA"}
|
|
@@ -4,5 +4,6 @@ const getValidChildren = children => {
|
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
5
|
return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
|
|
6
6
|
};
|
|
7
|
+
const isCurrent = props => props['aria-current'] !== undefined && props['aria-current'] !== false && props['aria-current'] !== 'false';
|
|
7
8
|
|
|
8
|
-
export { getValidChildren };
|
|
9
|
+
export { getValidChildren, isCurrent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/experimental/UnderlinePanels/UnderlinePanels.module.css.js"],"names":[],"mappings":"AAAA,kDAEE,eAAgB,CAChB,iBAAkB,CAFlB,UAAW,CAGX,+BACF","file":"UnderlinePanels-162f9aed.css","sourcesContent":[".StyledUnderlineWrapper {\n width: 100%;\n overflow-x: auto;\n overflow-y: hidden;\n -webkit-overflow-scrolling: auto;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlinePanels.d.ts","sourceRoot":"","sources":["../../../src/experimental/UnderlinePanels/UnderlinePanels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAQZ,KAAK,EAAE,EACP,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAerD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AAEvD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAC3D;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,iBAAiB,CAAC;IACvC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACxG;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAA;CACrB,CAAC,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;;;;;
|
|
1
|
+
{"version":3,"file":"UnderlinePanels.d.ts","sourceRoot":"","sources":["../../../src/experimental/UnderlinePanels/UnderlinePanels.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAQZ,KAAK,EAAE,EACP,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAerD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AAEvD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAC3D;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,iBAAiB,CAAC;IACvC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACxG;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAA;CACrB,CAAC,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;;;;;AA6M7D,wBAA2D"}
|
|
@@ -138,7 +138,7 @@ const UnderlinePanels = ({
|
|
|
138
138
|
};
|
|
139
139
|
UnderlinePanels.displayName = "UnderlinePanels";
|
|
140
140
|
const TabImpl = t0 => {
|
|
141
|
-
const $ = c(
|
|
141
|
+
const $ = c(15);
|
|
142
142
|
let ariaSelected;
|
|
143
143
|
let onSelect;
|
|
144
144
|
let props;
|
|
@@ -158,7 +158,6 @@ const TabImpl = t0 => {
|
|
|
158
158
|
props = $[3];
|
|
159
159
|
}
|
|
160
160
|
const {
|
|
161
|
-
iconsVisible,
|
|
162
161
|
loadingCounters
|
|
163
162
|
} = useContext(UnderlinePanelsContext);
|
|
164
163
|
let t1;
|
|
@@ -189,7 +188,7 @@ const TabImpl = t0 => {
|
|
|
189
188
|
const keyDownHandler = t2;
|
|
190
189
|
const t3 = ariaSelected ? 0 : -1;
|
|
191
190
|
let t4;
|
|
192
|
-
if ($[8] !== ariaSelected || $[9] !== clickHandler || $[10] !==
|
|
191
|
+
if ($[8] !== ariaSelected || $[9] !== clickHandler || $[10] !== keyDownHandler || $[11] !== loadingCounters || $[12] !== props || $[13] !== t3) {
|
|
193
192
|
t4 = /*#__PURE__*/jsx(UnderlineItem, {
|
|
194
193
|
as: "button",
|
|
195
194
|
role: "tab",
|
|
@@ -198,20 +197,18 @@ const TabImpl = t0 => {
|
|
|
198
197
|
type: "button",
|
|
199
198
|
onClick: clickHandler,
|
|
200
199
|
onKeyDown: keyDownHandler,
|
|
201
|
-
iconsVisible: iconsVisible,
|
|
202
200
|
loadingCounters: loadingCounters,
|
|
203
201
|
...props
|
|
204
202
|
});
|
|
205
203
|
$[8] = ariaSelected;
|
|
206
204
|
$[9] = clickHandler;
|
|
207
|
-
$[10] =
|
|
208
|
-
$[11] =
|
|
209
|
-
$[12] =
|
|
210
|
-
$[13] =
|
|
211
|
-
$[14] =
|
|
212
|
-
$[15] = t4;
|
|
205
|
+
$[10] = keyDownHandler;
|
|
206
|
+
$[11] = loadingCounters;
|
|
207
|
+
$[12] = props;
|
|
208
|
+
$[13] = t3;
|
|
209
|
+
$[14] = t4;
|
|
213
210
|
} else {
|
|
214
|
-
t4 = $[
|
|
211
|
+
t4 = $[14];
|
|
215
212
|
}
|
|
216
213
|
return t4;
|
|
217
214
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import ValidationAnimationContainer from '../ValidationAnimationContainer.js';
|
|
3
4
|
import { useId } from '../../../hooks/useId.js';
|
|
@@ -9,22 +10,33 @@ import VisuallyHidden from '../../../_VisuallyHidden.js';
|
|
|
9
10
|
import { useSlots } from '../../../hooks/useSlots.js';
|
|
10
11
|
import classes from './CheckboxOrRadioGroup.module.css.js';
|
|
11
12
|
import { clsx } from 'clsx';
|
|
12
|
-
import {
|
|
13
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
13
14
|
|
|
14
|
-
const CheckboxOrRadioGroup =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
const CheckboxOrRadioGroup = t0 => {
|
|
16
|
+
const $ = c(51);
|
|
17
|
+
const {
|
|
18
|
+
"aria-labelledby": ariaLabelledby,
|
|
19
|
+
children,
|
|
20
|
+
disabled: t1,
|
|
21
|
+
id: idProp,
|
|
22
|
+
required: t2,
|
|
23
|
+
className,
|
|
24
|
+
"data-component": dataComponentProp
|
|
25
|
+
} = t0;
|
|
26
|
+
const disabled = t1 === undefined ? false : t1;
|
|
27
|
+
const required = t2 === undefined ? false : t2;
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t3 = {
|
|
31
|
+
caption: CheckboxOrRadioGroupCaption,
|
|
32
|
+
label: CheckboxOrRadioGroupLabel,
|
|
33
|
+
validation: CheckboxOrRadioGroupValidation
|
|
34
|
+
};
|
|
35
|
+
$[0] = t3;
|
|
36
|
+
} else {
|
|
37
|
+
t3 = $[0];
|
|
38
|
+
}
|
|
39
|
+
const [slots, rest] = useSlots(children, t3);
|
|
28
40
|
const labelChild = slots.label;
|
|
29
41
|
const validationChild = slots.validation;
|
|
30
42
|
const captionChild = slots.caption;
|
|
@@ -33,78 +45,187 @@ const CheckboxOrRadioGroup = ({
|
|
|
33
45
|
const captionId = captionChild ? `${id}-caption` : undefined;
|
|
34
46
|
const requiredMessageId = required ? `${id}-requiredMessage` : undefined;
|
|
35
47
|
if (!labelChild && !ariaLabelledby) {
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
console.warn("A choice group must be labelled using a `CheckboxOrRadioGroup.Label` child, or by passing `aria-labelledby` to the CheckboxOrRadioGroup component.");
|
|
49
|
+
}
|
|
50
|
+
let t4;
|
|
51
|
+
if ($[1] !== labelChild) {
|
|
52
|
+
t4 = /*#__PURE__*/React.isValidElement(labelChild) && !labelChild.props.visuallyHidden;
|
|
53
|
+
$[1] = labelChild;
|
|
54
|
+
$[2] = t4;
|
|
55
|
+
} else {
|
|
56
|
+
t4 = $[2];
|
|
38
57
|
}
|
|
39
|
-
const isLegendVisible =
|
|
40
|
-
const Component = labelChild ?
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
const isLegendVisible = t4;
|
|
59
|
+
const Component = labelChild ? "fieldset" : "div";
|
|
60
|
+
let t5;
|
|
61
|
+
if ($[3] !== captionId || $[4] !== dataComponentProp || $[5] !== disabled || $[6] !== required || $[7] !== validationMessageId) {
|
|
62
|
+
t5 = {
|
|
43
63
|
disabled,
|
|
44
64
|
required,
|
|
45
65
|
captionId,
|
|
46
66
|
validationMessageId,
|
|
47
67
|
parentName: dataComponentProp
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
})]
|
|
93
|
-
}), validationChild && /*#__PURE__*/jsx(ValidationAnimationContainer
|
|
94
|
-
// If we have CheckboxOrRadioGroup.Label as a child, we render a screenreader-accessible validation message in the <legend>
|
|
95
|
-
, {
|
|
96
|
-
"aria-hidden": Boolean(labelChild),
|
|
97
|
-
show: true,
|
|
98
|
-
children: slots.validation
|
|
68
|
+
};
|
|
69
|
+
$[3] = captionId;
|
|
70
|
+
$[4] = dataComponentProp;
|
|
71
|
+
$[5] = disabled;
|
|
72
|
+
$[6] = required;
|
|
73
|
+
$[7] = validationMessageId;
|
|
74
|
+
$[8] = t5;
|
|
75
|
+
} else {
|
|
76
|
+
t5 = $[8];
|
|
77
|
+
}
|
|
78
|
+
let t6;
|
|
79
|
+
if ($[9] !== className) {
|
|
80
|
+
t6 = clsx(className, classes.GroupFieldset);
|
|
81
|
+
$[9] = className;
|
|
82
|
+
$[10] = t6;
|
|
83
|
+
} else {
|
|
84
|
+
t6 = $[10];
|
|
85
|
+
}
|
|
86
|
+
const t7 = validationChild ? "" : undefined;
|
|
87
|
+
let t8;
|
|
88
|
+
if ($[11] !== disabled || $[12] !== labelChild) {
|
|
89
|
+
t8 = labelChild ? {
|
|
90
|
+
disabled
|
|
91
|
+
} : {};
|
|
92
|
+
$[11] = disabled;
|
|
93
|
+
$[12] = labelChild;
|
|
94
|
+
$[13] = t8;
|
|
95
|
+
} else {
|
|
96
|
+
t8 = $[13];
|
|
97
|
+
}
|
|
98
|
+
let t9;
|
|
99
|
+
if ($[14] !== isLegendVisible || $[15] !== labelChild || $[16] !== required || $[17] !== requiredMessageId || $[18] !== slots.caption || $[19] !== slots.label || $[20] !== slots.validation) {
|
|
100
|
+
t9 = labelChild ? /*#__PURE__*/jsxs("legend", {
|
|
101
|
+
className: classes.GroupLegend,
|
|
102
|
+
"data-legend-visible": isLegendVisible ? "" : undefined,
|
|
103
|
+
children: [slots.label, required && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
104
|
+
children: ", required"
|
|
105
|
+
}), slots.caption, /*#__PURE__*/React.isValidElement(slots.validation) && slots.validation.props.children && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
106
|
+
children: slots.validation.props.children
|
|
107
|
+
})]
|
|
108
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
109
|
+
children: [slots.caption, required && requiredMessageId && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
110
|
+
id: requiredMessageId,
|
|
111
|
+
children: "Required"
|
|
99
112
|
})]
|
|
100
|
-
})
|
|
101
|
-
|
|
113
|
+
});
|
|
114
|
+
$[14] = isLegendVisible;
|
|
115
|
+
$[15] = labelChild;
|
|
116
|
+
$[16] = required;
|
|
117
|
+
$[17] = requiredMessageId;
|
|
118
|
+
$[18] = slots.caption;
|
|
119
|
+
$[19] = slots.label;
|
|
120
|
+
$[20] = slots.validation;
|
|
121
|
+
$[21] = t9;
|
|
122
|
+
} else {
|
|
123
|
+
t9 = $[21];
|
|
124
|
+
}
|
|
125
|
+
let t10;
|
|
126
|
+
if ($[22] !== ariaLabelledby || $[23] !== captionId || $[24] !== labelChild || $[25] !== requiredMessageId || $[26] !== validationMessageId) {
|
|
127
|
+
t10 = !labelChild ? {
|
|
128
|
+
"aria-labelledby": ariaLabelledby,
|
|
129
|
+
"aria-describedby": [validationMessageId, captionId, requiredMessageId].filter(Boolean).join(" "),
|
|
130
|
+
as: "div",
|
|
131
|
+
role: "group"
|
|
132
|
+
} : {};
|
|
133
|
+
$[22] = ariaLabelledby;
|
|
134
|
+
$[23] = captionId;
|
|
135
|
+
$[24] = labelChild;
|
|
136
|
+
$[25] = requiredMessageId;
|
|
137
|
+
$[26] = validationMessageId;
|
|
138
|
+
$[27] = t10;
|
|
139
|
+
} else {
|
|
140
|
+
t10 = $[27];
|
|
141
|
+
}
|
|
142
|
+
let t11;
|
|
143
|
+
if ($[28] !== rest) {
|
|
144
|
+
t11 = React.Children.toArray(rest).filter(_temp);
|
|
145
|
+
$[28] = rest;
|
|
146
|
+
$[29] = t11;
|
|
147
|
+
} else {
|
|
148
|
+
t11 = $[29];
|
|
149
|
+
}
|
|
150
|
+
let t12;
|
|
151
|
+
if ($[30] !== t10 || $[31] !== t11) {
|
|
152
|
+
t12 = /*#__PURE__*/jsx("div", {
|
|
153
|
+
className: classes.Body,
|
|
154
|
+
...t10,
|
|
155
|
+
children: t11
|
|
156
|
+
});
|
|
157
|
+
$[30] = t10;
|
|
158
|
+
$[31] = t11;
|
|
159
|
+
$[32] = t12;
|
|
160
|
+
} else {
|
|
161
|
+
t12 = $[32];
|
|
162
|
+
}
|
|
163
|
+
let t13;
|
|
164
|
+
if ($[33] !== Component || $[34] !== dataComponentProp || $[35] !== t12 || $[36] !== t6 || $[37] !== t7 || $[38] !== t8 || $[39] !== t9) {
|
|
165
|
+
t13 = /*#__PURE__*/jsxs(Component, {
|
|
166
|
+
"data-component": dataComponentProp,
|
|
167
|
+
className: t6,
|
|
168
|
+
"data-validation": t7,
|
|
169
|
+
...t8,
|
|
170
|
+
children: [t9, t12]
|
|
171
|
+
});
|
|
172
|
+
$[33] = Component;
|
|
173
|
+
$[34] = dataComponentProp;
|
|
174
|
+
$[35] = t12;
|
|
175
|
+
$[36] = t6;
|
|
176
|
+
$[37] = t7;
|
|
177
|
+
$[38] = t8;
|
|
178
|
+
$[39] = t9;
|
|
179
|
+
$[40] = t13;
|
|
180
|
+
} else {
|
|
181
|
+
t13 = $[40];
|
|
182
|
+
}
|
|
183
|
+
let t14;
|
|
184
|
+
if ($[41] !== labelChild || $[42] !== slots.validation || $[43] !== validationChild) {
|
|
185
|
+
t14 = validationChild && /*#__PURE__*/jsx(ValidationAnimationContainer, {
|
|
186
|
+
"aria-hidden": Boolean(labelChild),
|
|
187
|
+
show: true,
|
|
188
|
+
children: slots.validation
|
|
189
|
+
});
|
|
190
|
+
$[41] = labelChild;
|
|
191
|
+
$[42] = slots.validation;
|
|
192
|
+
$[43] = validationChild;
|
|
193
|
+
$[44] = t14;
|
|
194
|
+
} else {
|
|
195
|
+
t14 = $[44];
|
|
196
|
+
}
|
|
197
|
+
let t15;
|
|
198
|
+
if ($[45] !== t13 || $[46] !== t14) {
|
|
199
|
+
t15 = /*#__PURE__*/jsxs("div", {
|
|
200
|
+
children: [t13, t14]
|
|
201
|
+
});
|
|
202
|
+
$[45] = t13;
|
|
203
|
+
$[46] = t14;
|
|
204
|
+
$[47] = t15;
|
|
205
|
+
} else {
|
|
206
|
+
t15 = $[47];
|
|
207
|
+
}
|
|
208
|
+
let t16;
|
|
209
|
+
if ($[48] !== t15 || $[49] !== t5) {
|
|
210
|
+
t16 = /*#__PURE__*/jsx(CheckboxOrRadioGroupContext.Provider, {
|
|
211
|
+
value: t5,
|
|
212
|
+
children: t15
|
|
213
|
+
});
|
|
214
|
+
$[48] = t15;
|
|
215
|
+
$[49] = t5;
|
|
216
|
+
$[50] = t16;
|
|
217
|
+
} else {
|
|
218
|
+
t16 = $[50];
|
|
219
|
+
}
|
|
220
|
+
return t16;
|
|
102
221
|
};
|
|
103
|
-
CheckboxOrRadioGroup.displayName = "CheckboxOrRadioGroup";
|
|
104
222
|
var CheckboxOrRadioGroup$1 = Object.assign(CheckboxOrRadioGroup, {
|
|
105
223
|
Caption: CheckboxOrRadioGroupCaption,
|
|
106
224
|
Label: CheckboxOrRadioGroupLabel,
|
|
107
225
|
Validation: CheckboxOrRadioGroupValidation
|
|
108
226
|
});
|
|
227
|
+
function _temp(child) {
|
|
228
|
+
return /*#__PURE__*/React.isValidElement(child);
|
|
229
|
+
}
|
|
109
230
|
|
|
110
231
|
export { CheckboxOrRadioGroup$1 as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import CheckboxOrRadioGroupContext from './CheckboxOrRadioGroupContext.js';
|
|
3
4
|
import classes from './CheckboxOrRadioGroup.module.css.js';
|
|
@@ -5,22 +6,43 @@ import { clsx } from 'clsx';
|
|
|
5
6
|
import { jsx } from 'react/jsx-runtime';
|
|
6
7
|
import Text from '../../../Text/Text.js';
|
|
7
8
|
|
|
8
|
-
const CheckboxOrRadioGroupCaption =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const CheckboxOrRadioGroupCaption = t0 => {
|
|
10
|
+
const $ = c(7);
|
|
11
|
+
const {
|
|
12
|
+
className,
|
|
13
|
+
children
|
|
14
|
+
} = t0;
|
|
12
15
|
const {
|
|
13
16
|
captionId,
|
|
14
17
|
parentName
|
|
15
18
|
} = React.useContext(CheckboxOrRadioGroupContext);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
let t1;
|
|
20
|
+
if ($[0] !== className) {
|
|
21
|
+
t1 = clsx(className, classes.CheckboxOrRadioGroupCaption);
|
|
22
|
+
$[0] = className;
|
|
23
|
+
$[1] = t1;
|
|
24
|
+
} else {
|
|
25
|
+
t1 = $[1];
|
|
26
|
+
}
|
|
27
|
+
const t2 = parentName ? `${parentName}.Caption` : undefined;
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[2] !== captionId || $[3] !== children || $[4] !== t1 || $[5] !== t2) {
|
|
30
|
+
t3 = /*#__PURE__*/jsx(Text, {
|
|
31
|
+
className: t1,
|
|
32
|
+
id: captionId,
|
|
33
|
+
"data-component": t2,
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
$[2] = captionId;
|
|
37
|
+
$[3] = children;
|
|
38
|
+
$[4] = t1;
|
|
39
|
+
$[5] = t2;
|
|
40
|
+
$[6] = t3;
|
|
41
|
+
} else {
|
|
42
|
+
t3 = $[6];
|
|
43
|
+
}
|
|
44
|
+
return t3;
|
|
22
45
|
};
|
|
23
|
-
CheckboxOrRadioGroupCaption.displayName = "CheckboxOrRadioGroupCaption";
|
|
24
46
|
CheckboxOrRadioGroupCaption.__SLOT__ = Symbol('CheckboxOrRadioGroup.Caption');
|
|
25
47
|
|
|
26
48
|
export { CheckboxOrRadioGroupCaption as default };
|