@primer/react 0.0.0-20260619204513 → 0.0.0-20260622123513
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 +5 -5
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +30 -63
- package/dist/Textarea/Textarea.d.ts.map +1 -1
- package/dist/Textarea/Textarea.js +109 -150
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts +2 -1
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +331 -91
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +11 -1
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +4 -1
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +2 -0
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItem.d.ts +32 -1
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +38 -33
- package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
- package/dist/UnderlineNav/index.d.ts +1 -1
- package/dist/UnderlineNav/index.d.ts.map +1 -1
- package/dist/UnderlineNav/styles.d.ts +16 -0
- package/dist/UnderlineNav/styles.d.ts.map +1 -0
- package/dist/UnderlineNav/styles.js +19 -0
- package/dist/UnderlineNav/types.d.ts +10 -0
- package/dist/UnderlineNav/types.d.ts.map +1 -0
- package/dist/UnderlineNav/utils.d.ts +0 -2
- package/dist/UnderlineNav/utils.d.ts.map +1 -1
- package/dist/UnderlineNav/utils.js +1 -2
- package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css +2 -0
- package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css.map +1 -0
- package/dist/experimental/UnderlinePanels/UnderlinePanels.d.ts.map +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +11 -8
- package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +1 -1
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +60 -66
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/utils/__tests__/useCharacterCountAnnouncement.test.d.ts +2 -0
- package/dist/utils/__tests__/useCharacterCountAnnouncement.test.d.ts.map +1 -0
- package/dist/utils/character-counter.d.ts +16 -21
- package/dist/utils/character-counter.d.ts.map +1 -1
- package/dist/utils/character-counter.js +23 -59
- package/dist/utils/useCharacterCountAnnouncement.d.ts +14 -0
- package/dist/utils/useCharacterCountAnnouncement.d.ts.map +1 -0
- package/dist/utils/useCharacterCountAnnouncement.js +73 -0
- package/generated/components.json +2 -2
- package/package.json +1 -1
- package/dist/UnderlineNav/UnderlineNav-263b4e8f.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-263b4e8f.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItem-402cd41c.css +0 -2
- package/dist/UnderlineNav/UnderlineNavItem-402cd41c.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts +0 -40
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.js +0 -6
- package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css +0 -2
- package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
|
@@ -1,39 +1,46 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useContext
|
|
1
|
+
import React, { forwardRef, useRef, useContext } from 'react';
|
|
2
2
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
3
|
+
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
3
4
|
import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
|
|
4
5
|
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((
|
|
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;
|
|
9
21
|
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
onSelect,
|
|
15
|
-
'aria-current': ariaCurrent,
|
|
16
|
-
icon: Icon,
|
|
17
|
-
leadingVisual,
|
|
18
|
-
...props
|
|
19
|
-
} = allProps;
|
|
20
|
-
const ref = useRef(null);
|
|
21
|
-
const {
|
|
22
|
-
loadingCounters
|
|
22
|
+
setChildrenWidth,
|
|
23
|
+
setNoIconChildrenWidth,
|
|
24
|
+
loadingCounters,
|
|
25
|
+
iconsVisible
|
|
23
26
|
} = useContext(UnderlineNavContext);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
useIsomorphicLayoutEffect(() => {
|
|
28
|
+
if (ref.current) {
|
|
29
|
+
const domRect = ref.current.getBoundingClientRect();
|
|
30
|
+
const icon = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'icon');
|
|
31
|
+
const content = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'text');
|
|
32
|
+
const text = content.textContent;
|
|
33
|
+
const iconWidthWithMargin = icon ? icon.getBoundingClientRect().width + Number(getComputedStyle(icon).marginRight.slice(0, -2)) + Number(getComputedStyle(icon).marginLeft.slice(0, -2)) : 0;
|
|
34
|
+
setChildrenWidth({
|
|
35
|
+
text,
|
|
36
|
+
width: domRect.width
|
|
37
|
+
});
|
|
38
|
+
setNoIconChildrenWidth({
|
|
39
|
+
text,
|
|
40
|
+
width: domRect.width - iconWidthWithMargin
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, [ref, setChildrenWidth, setNoIconChildrenWidth]);
|
|
37
44
|
const keyDownHandler = React.useCallback(event => {
|
|
38
45
|
if ((event.key === ' ' || event.key === 'Enter') && !event.defaultPrevented && typeof onSelect === 'function') {
|
|
39
46
|
onSelect(event);
|
|
@@ -46,10 +53,8 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
|
46
53
|
}, [onSelect]);
|
|
47
54
|
return /*#__PURE__*/jsx("li", {
|
|
48
55
|
className: classes.UnderlineNavItem,
|
|
49
|
-
ref: ref,
|
|
50
|
-
"aria-hidden": isOverflowing ? true : allProps['aria-hidden'],
|
|
51
56
|
children: /*#__PURE__*/jsx(UnderlineItem, {
|
|
52
|
-
ref:
|
|
57
|
+
ref: ref,
|
|
53
58
|
as: Component,
|
|
54
59
|
href: href,
|
|
55
60
|
"aria-current": ariaCurrent,
|
|
@@ -58,8 +63,8 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
|
58
63
|
counter: counter,
|
|
59
64
|
icon: leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : Icon,
|
|
60
65
|
loadingCounters: loadingCounters,
|
|
66
|
+
iconsVisible: iconsVisible,
|
|
61
67
|
...props,
|
|
62
|
-
tabIndex: isOverflowing ? -1 : allProps.tabIndex,
|
|
63
68
|
children: children
|
|
64
69
|
})
|
|
65
70
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UnderlineNavProps } from './UnderlineNav';
|
|
2
|
-
import type { UnderlineNavItemProps } from './
|
|
2
|
+
import type { UnderlineNavItemProps } from './UnderlineNavItem';
|
|
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,oBAAoB,CAAA;AAG7D,QAAA,MAAM,YAAY;;CAEhB,CAAA;AAEF,OAAO,EAAC,YAAY,EAAC,CAAA;AACrB,YAAY,EAAC,iBAAiB,EAAE,qBAAqB,EAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const dividerStyles: {
|
|
2
|
+
display: string;
|
|
3
|
+
borderLeft: string;
|
|
4
|
+
width: string;
|
|
5
|
+
borderLeftColor: string;
|
|
6
|
+
marginRight: string;
|
|
7
|
+
height: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const menuItemStyles: {
|
|
10
|
+
'& > span': {
|
|
11
|
+
display: string;
|
|
12
|
+
};
|
|
13
|
+
textDecoration: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const baseMenuMinWidth = 192;
|
|
16
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;CAOzB,CAAA;AAED,eAAO,MAAM,cAAc;;;;;CAO1B,CAAA;AAED,eAAO,MAAM,gBAAgB,MAAM,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const dividerStyles = {
|
|
2
|
+
display: 'inline-block',
|
|
3
|
+
borderLeft: '1px solid',
|
|
4
|
+
width: '1px',
|
|
5
|
+
borderLeftColor: 'var(--borderColor-muted)',
|
|
6
|
+
marginRight: 'var(--base-size-4)',
|
|
7
|
+
height: '24px' // The height of the divider - reference from Figma
|
|
8
|
+
};
|
|
9
|
+
const menuItemStyles = {
|
|
10
|
+
// This is needed to hide the selected check icon on the menu item. https://github.com/primer/react/tree/main/packages/react/src/ActionList/Selection.tsx#L32
|
|
11
|
+
'& > span': {
|
|
12
|
+
display: 'none'
|
|
13
|
+
},
|
|
14
|
+
// To reset the style when the menu items are rendered as react router links
|
|
15
|
+
textDecoration: 'none'
|
|
16
|
+
};
|
|
17
|
+
const baseMenuMinWidth = 192;
|
|
18
|
+
|
|
19
|
+
export { baseMenuMinWidth, dividerStyles, menuItemStyles };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ChildSize = {
|
|
2
|
+
text: string;
|
|
3
|
+
width: number;
|
|
4
|
+
};
|
|
5
|
+
export type ChildWidthArray = Array<ChildSize>;
|
|
6
|
+
export type ResponsiveProps = {
|
|
7
|
+
items: Array<React.ReactElement<any>>;
|
|
8
|
+
menuItems: Array<React.ReactElement<any>>;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;AAC9C,MAAM,MAAM,eAAe,GAAG;IAE5B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;IAErC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;CAC1C,CAAA"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { UnderlineNavItemProps } from './UnderlineNavItemsRegistry';
|
|
3
2
|
export declare const getValidChildren: (children: React.ReactNode) => React.ReactElement<any>[];
|
|
4
|
-
export declare const isCurrent: (props: UnderlineNavItemProps) => boolean;
|
|
5
3
|
//# 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;AAEzB,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,CAAC,SAAS,KAEgC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAChH,CAAA"}
|
|
@@ -4,6 +4,5 @@ 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';
|
|
8
7
|
|
|
9
|
-
export { getValidChildren
|
|
8
|
+
export { getValidChildren };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-UnderlinePanels-StyledUnderlineWrapper-aiLna{overflow-x:auto;overflow-y:hidden;width:100%;-webkit-overflow-scrolling:auto}.prc-UnderlinePanels-StyledUnderlineWrapper-aiLna[data-icons-visible=false] [data-component=icon]{display:none}
|
|
2
|
+
/*# sourceMappingURL=UnderlinePanels-e4b325b9.css.map */
|
|
@@ -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,CAEA,kGACE,YACF","file":"UnderlinePanels-e4b325b9.css","sourcesContent":[".StyledUnderlineWrapper {\n width: 100%;\n overflow-x: auto;\n overflow-y: hidden;\n -webkit-overflow-scrolling: auto;\n}\n\n.StyledUnderlineWrapper[data-icons-visible='false'] [data-component='icon'] {\n display: none;\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;;;;;AA8M7D,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(16);
|
|
142
142
|
let ariaSelected;
|
|
143
143
|
let onSelect;
|
|
144
144
|
let props;
|
|
@@ -158,6 +158,7 @@ const TabImpl = t0 => {
|
|
|
158
158
|
props = $[3];
|
|
159
159
|
}
|
|
160
160
|
const {
|
|
161
|
+
iconsVisible,
|
|
161
162
|
loadingCounters
|
|
162
163
|
} = useContext(UnderlinePanelsContext);
|
|
163
164
|
let t1;
|
|
@@ -188,7 +189,7 @@ const TabImpl = t0 => {
|
|
|
188
189
|
const keyDownHandler = t2;
|
|
189
190
|
const t3 = ariaSelected ? 0 : -1;
|
|
190
191
|
let t4;
|
|
191
|
-
if ($[8] !== ariaSelected || $[9] !== clickHandler || $[10] !==
|
|
192
|
+
if ($[8] !== ariaSelected || $[9] !== clickHandler || $[10] !== iconsVisible || $[11] !== keyDownHandler || $[12] !== loadingCounters || $[13] !== props || $[14] !== t3) {
|
|
192
193
|
t4 = /*#__PURE__*/jsx(UnderlineItem, {
|
|
193
194
|
as: "button",
|
|
194
195
|
role: "tab",
|
|
@@ -197,18 +198,20 @@ const TabImpl = t0 => {
|
|
|
197
198
|
type: "button",
|
|
198
199
|
onClick: clickHandler,
|
|
199
200
|
onKeyDown: keyDownHandler,
|
|
201
|
+
iconsVisible: iconsVisible,
|
|
200
202
|
loadingCounters: loadingCounters,
|
|
201
203
|
...props
|
|
202
204
|
});
|
|
203
205
|
$[8] = ariaSelected;
|
|
204
206
|
$[9] = clickHandler;
|
|
205
|
-
$[10] =
|
|
206
|
-
$[11] =
|
|
207
|
-
$[12] =
|
|
208
|
-
$[13] =
|
|
209
|
-
$[14] =
|
|
207
|
+
$[10] = iconsVisible;
|
|
208
|
+
$[11] = keyDownHandler;
|
|
209
|
+
$[12] = loadingCounters;
|
|
210
|
+
$[13] = props;
|
|
211
|
+
$[14] = t3;
|
|
212
|
+
$[15] = t4;
|
|
210
213
|
} else {
|
|
211
|
-
t4 = $[
|
|
214
|
+
t4 = $[15];
|
|
212
215
|
}
|
|
213
216
|
return t4;
|
|
214
217
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-components-UnderlineWrapper-eT-Yj{align-items:center;box-shadow:inset 0 -1px var(--borderColor-muted,#d1d9e0b3);display:flex;justify-content:flex-start;min-height:var(--control-xlarge-size,48px);overflow:visible;padding-inline:var(--stack-padding-normal,1rem)}.prc-components-UnderlineWrapper-eT-Yj[data-overflow-measured=false]{overflow:hidden}.prc-components-UnderlineWrapper-eT-Yj[data-overflow-measured=true]{overflow:visible}.prc-components-UnderlineWrapper-eT-Yj[data-variant=flush]{padding-inline:unset}.prc-components-UnderlineItemList-xKlKC{display:flex;gap:8px;list-style:none;margin:0;padding:0;white-space:nowrap}.prc-components-UnderlineItem-7fP-n,.prc-components-UnderlineItemList-xKlKC{align-items:center;position:relative}.prc-components-UnderlineItem-7fP-n{appearance:none;background-color:transparent;border:0;border-radius:var(--borderRadius-medium,var(--borderRadius-small,.1875rem));color:var(--fgColor-default,#1f2328);cursor:pointer;display:inline-flex;font:inherit;font-size:var(--text-body-size-medium,.875rem);line-height:var(--text-body-lineHeight-medium,1.4285);padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-8,.5rem);text-align:center;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.prc-components-UnderlineItem-7fP-n:hover{background-color:var(--bgColor-neutral-muted,#818b981f);-webkit-text-decoration:none;text-decoration:none;transition:background-color .12s ease-out}}.prc-components-UnderlineItem-7fP-n:focus{box-shadow:inset 0 0 0 2px var(--fgColor-accent,#0969da);outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n:focus:not(:focus-visible){box-shadow:none}.prc-components-UnderlineItem-7fP-n:focus-visible{box-shadow:inset 0 0 0 2px var(--fgColor-accent,#0969da);outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n [data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden;white-space:nowrap}.prc-components-UnderlineItem-7fP-n [data-component=icon]{align-items:center;color:var(--fgColor-muted,#59636e);display:inline-flex;margin-inline-end:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n [data-component=counter]{align-items:center;display:flex;margin-inline-start:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n:after{background-color:transparent;border-radius:0;bottom:calc(50% - var(--control-xlarge-size, var(--base-size-48,3rem))/2 - 1px);content:"";height:2px;pointer-events:none;position:absolute;right:50%;transform:translate(50%,-50%);width:100%}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]) [data-component=text],.prc-components-UnderlineItem-7fP-n[aria-selected=true] [data-component=text]{font-weight:var(--base-text-weight-semibold,600)}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73))}@media (forced-colors:active){.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:LinkText}}.prc-components-LoadingCounter-dBuLy{animation:prc-components-loadingCounterKeyFrames-8tMlf 1.2s ease-in-out infinite alternate;background-color:var(--bgColor-neutral-muted,#818b981f);border-color:var(--borderColor-default,#d1d9e0);border-radius:20px;display:inline-block;height:1rem;width:1.5rem}@keyframes prc-components-loadingCounterKeyFrames-8tMlf{0%{opacity:1}to{opacity:.2}}
|
|
2
|
+
/*# sourceMappingURL=UnderlineTabbedInterface-4197ee28.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/components/UnderlineTabbedInterface.module.css.js"],"names":[],"mappings":"AAAA,uCAKE,kBAAmB,CAOnB,0DAAiD,CAXjD,YAAa,CAGb,0BAA2B,CAI3B,0CAA4C,CAO5C,gBAAiB,CAZjB,+CA0BF,CAZE,qEACE,eACF,CAEA,oEACE,gBACF,CAEA,2DAEE,oBACF,CAGF,wCAEE,YAAa,CAMb,OAAQ,CAFR,eAAgB,CAFhB,QAAS,CADT,SAAU,CAEV,kBAIF,CAEA,4EAJE,kBAAmB,CANnB,iBAsCF,CA5BA,oCAgBE,eAAgB,CALhB,4BAA6B,CAC7B,QAAS,CACT,2EAAoE,CANpE,oCAA6B,CAG7B,cAAe,CAPf,mBAAoB,CACpB,YAAa,CACb,8CAAuC,CACvC,qDAAuD,CAYvD,wCAAiC,CADjC,uCAAkC,CATlC,iBAAkB,CAClB,4BAAqB,CAArB,oBAmBF,CAPE,qBACE,0CAEE,uDAA8C,CAD9C,4BAAqB,CAArB,oBAAqB,CAErB,yCACF,CACF,CAGF,0CAGE,wDAAiD,CAFjD,6BAQF,CAHE,8DACE,eACF,CAGF,kDAGE,wDAAiD,CAFjD,6BAGF,CAGA,0DAME,0BAA2B,CAL3B,aAAc,CAEd,gDAA6C,CAD7C,QAAS,CAGT,iBAAkB,CADlB,kBAGF,CAEA,0DAGE,kBAAmB,CADnB,kCAA2B,CAD3B,mBAAoB,CAGpB,0CACF,CAEA,6DAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAEA,0CAaE,4BAA6B,CAC7B,eAAgB,CANhB,+EAAmF,CAInF,UAAW,CAFX,UAAW,CACX,mBAAoB,CAVpB,iBAAkB,CAClB,SAAU,CAaV,6BAA+B,CAN/B,UAOF,CAEA,gLAEE,gDACF,CAEA,gJAGE,iGAMF,CAJE,8BALF,gJAOI,yBAEJ,CADE,CAGF,qCASE,0FAAsE,CAJtE,uDAA8C,CAC9C,+CAAwC,CAExC,kBAAmB,CAPnB,oBAAqB,CAErB,WAAY,CADZ,YAQF,CAEA,wDACE,GACE,SACF,CAEA,GACE,UACF,CACF","file":"UnderlineTabbedInterface-4197ee28.css","sourcesContent":[".UnderlineWrapper {\n display: flex;\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: var(--stack-padding-normal);\n justify-content: flex-start;\n align-items: center;\n\n /* make space for the underline */\n min-height: var(--control-xlarge-size, 48px);\n\n /* using a box-shadow instead of a border to accommodate 'overflow-y: hidden' on UnderlinePanels */\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 -1px var(--borderColor-muted);\n\n /* Hide overflow until calculation is complete to prevent CLS */\n overflow: visible;\n\n &[data-overflow-measured='false'] {\n overflow: hidden;\n }\n\n &[data-overflow-measured='true'] {\n overflow: visible;\n }\n\n &[data-variant='flush'] {\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: unset;\n }\n}\n\n.UnderlineItemList {\n position: relative;\n display: flex;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n list-style: none;\n align-items: center;\n gap: 8px;\n}\n\n.UnderlineItem {\n /* underline tab specific styles */\n position: relative;\n display: inline-flex;\n font: inherit;\n font-size: var(--text-body-size-medium);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n color: var(--fgColor-default);\n text-align: center;\n text-decoration: none;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--borderRadius-medium, var(--borderRadius-small));\n\n /* button resets */\n appearance: none;\n padding-inline: var(--base-size-8);\n padding-block: var(--base-size-6);\n align-items: center;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: none;\n background-color: var(--bgColor-neutral-muted);\n transition: background-color 0.12s ease-out;\n }\n }\n}\n\n.UnderlineItem:focus {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n\n /* where focus-visible is supported, remove the focus box-shadow */\n &:not(:focus-visible) {\n box-shadow: none;\n }\n}\n\n.UnderlineItem:focus-visible {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n}\n\n/* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n.UnderlineItem [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold);\n white-space: nowrap;\n visibility: hidden;\n content: attr(data-content);\n}\n\n.UnderlineItem [data-component='icon'] {\n display: inline-flex;\n color: var(--fgColor-muted);\n align-items: center;\n margin-inline-end: var(--base-size-8);\n}\n\n.UnderlineItem [data-component='counter'] {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n}\n\n.UnderlineItem::after {\n position: absolute;\n right: 50%;\n\n /* TODO: see if we can simplify this positioning */\n\n /* 48px total height / 2 (24px) + 1px */\n /* stylelint-disable-next-line primer/spacing */\n bottom: calc(50% - calc(var(--control-xlarge-size, var(--base-size-48)) / 2 + 1px));\n width: 100%;\n height: 2px;\n pointer-events: none;\n content: '';\n background-color: transparent;\n border-radius: 0;\n transform: translate(50%, -50%);\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false']) [data-component='text'],\n.UnderlineItem[aria-selected='true'] [data-component='text'] {\n font-weight: var(--base-text-weight-semibold);\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false'])::after,\n.UnderlineItem[aria-selected='true']::after {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--underlineNav-borderColor-active, var(--color-primer-border-active, #fd8c73));\n\n @media (forced-colors: active) {\n /* Support for Window Force Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */\n background-color: LinkText;\n }\n}\n\n.LoadingCounter {\n display: inline-block;\n width: 1.5rem;\n height: 1rem;\n /* 16px */\n background-color: var(--bgColor-neutral-muted);\n border-color: var(--borderColor-default);\n /* stylelint-disable-next-line primer/borders */\n border-radius: 20px;\n animation: loadingCounterKeyFrames 1.2s ease-in-out infinite alternate;\n}\n\n@keyframes loadingCounterKeyFrames {\n from {\n opacity: 1;\n }\n\n to {\n opacity: 0.2;\n }\n}\n"]}
|
|
@@ -15,6 +15,7 @@ export declare const LoadingCounter: () => React.JSX.Element;
|
|
|
15
15
|
export type UnderlineItemProps<As extends React.ElementType> = {
|
|
16
16
|
as?: As | 'a' | 'button';
|
|
17
17
|
className?: string;
|
|
18
|
+
iconsVisible?: boolean;
|
|
18
19
|
loadingCounters?: boolean;
|
|
19
20
|
counter?: number | string;
|
|
20
21
|
icon?: FC<IconProps> | React.ReactElement<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineTabbedInterface.d.ts","sourceRoot":"","sources":["../../../src/internal/components/UnderlineTabbedInterface.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAgC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"UnderlineTabbedInterface.d.ts","sourceRoot":"","sources":["../../../src/internal/components/UnderlineTabbedInterface.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAgC,KAAK,EAAE,EAA0B,KAAK,WAAW,EAAC,MAAM,OAAO,CAAA;AAEtG,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAErD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,yBAAyB,CAAA;AAMlG,eAAO,MAAM,GAAG,IAAI,CAAA;AAgBpB,KAAK,qBAAqB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI;IACzD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAWvB,8BAA8B,CAAC,WAAW,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAA;AAErF,eAAO,MAAM,iBAAiB,EAMxB,8BAA8B,CAAC,IAAI,CAAC,CAAA;AAE1C,eAAO,MAAM,cAAc,yBAE1B,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI;IAC7D,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAEzB,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAC9C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;CACzB,GAAG,KAAK,CAAC,wBAAwB,CAAC,EAAE,SAAS,GAAG,GAAG,GAAG,GAAG,EAAE,SAAS,QAAQ,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAA;AAE9F,eAAO,MAAM,aAAa,EAwBpB,8BAA8B,CAAC,WAAW,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAA"}
|
|
@@ -6,6 +6,8 @@ import { clsx } from 'clsx';
|
|
|
6
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
7
|
import CounterLabel from '../../CounterLabel/CounterLabel.js';
|
|
8
8
|
|
|
9
|
+
const GAP = 8;
|
|
10
|
+
|
|
9
11
|
// Helper to extract direct text content from children for the data-content attribute.
|
|
10
12
|
// This is used by CSS to reserve space for bold text (preventing layout shift).
|
|
11
13
|
// Only extracts strings/numbers, not text from nested React elements (e.g., Popovers).
|
|
@@ -73,50 +75,37 @@ const UnderlineWrapper = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
73
75
|
return t3;
|
|
74
76
|
});
|
|
75
77
|
const UnderlineItemList = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
76
|
-
const $ = c(
|
|
78
|
+
const $ = c(7);
|
|
77
79
|
let children;
|
|
78
|
-
let className;
|
|
79
80
|
let rest;
|
|
80
81
|
if ($[0] !== t0) {
|
|
81
82
|
({
|
|
82
83
|
children,
|
|
83
|
-
className,
|
|
84
84
|
...rest
|
|
85
85
|
} = t0);
|
|
86
86
|
$[0] = t0;
|
|
87
87
|
$[1] = children;
|
|
88
|
-
$[2] =
|
|
89
|
-
$[3] = rest;
|
|
88
|
+
$[2] = rest;
|
|
90
89
|
} else {
|
|
91
90
|
children = $[1];
|
|
92
|
-
|
|
93
|
-
rest = $[3];
|
|
91
|
+
rest = $[2];
|
|
94
92
|
}
|
|
95
93
|
let t1;
|
|
96
|
-
if ($[4] !==
|
|
97
|
-
t1 =
|
|
98
|
-
|
|
99
|
-
$[5] = t1;
|
|
100
|
-
} else {
|
|
101
|
-
t1 = $[5];
|
|
102
|
-
}
|
|
103
|
-
let t2;
|
|
104
|
-
if ($[6] !== children || $[7] !== forwardedRef || $[8] !== rest || $[9] !== t1) {
|
|
105
|
-
t2 = /*#__PURE__*/jsx("ul", {
|
|
106
|
-
className: t1,
|
|
94
|
+
if ($[3] !== children || $[4] !== forwardedRef || $[5] !== rest) {
|
|
95
|
+
t1 = /*#__PURE__*/jsx("ul", {
|
|
96
|
+
className: classes.UnderlineItemList,
|
|
107
97
|
ref: forwardedRef,
|
|
108
98
|
...rest,
|
|
109
99
|
children: children
|
|
110
100
|
});
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[10] = t2;
|
|
101
|
+
$[3] = children;
|
|
102
|
+
$[4] = forwardedRef;
|
|
103
|
+
$[5] = rest;
|
|
104
|
+
$[6] = t1;
|
|
116
105
|
} else {
|
|
117
|
-
|
|
106
|
+
t1 = $[6];
|
|
118
107
|
}
|
|
119
|
-
return
|
|
108
|
+
return t1;
|
|
120
109
|
});
|
|
121
110
|
const LoadingCounter = () => {
|
|
122
111
|
const $ = c(1);
|
|
@@ -132,11 +121,12 @@ const LoadingCounter = () => {
|
|
|
132
121
|
return t0;
|
|
133
122
|
};
|
|
134
123
|
const UnderlineItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
135
|
-
const $ = c(
|
|
124
|
+
const $ = c(30);
|
|
136
125
|
let Icon;
|
|
137
126
|
let children;
|
|
138
127
|
let className;
|
|
139
128
|
let counter;
|
|
129
|
+
let iconsVisible;
|
|
140
130
|
let loadingCounters;
|
|
141
131
|
let rest;
|
|
142
132
|
let t0;
|
|
@@ -146,6 +136,7 @@ const UnderlineItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
146
136
|
children,
|
|
147
137
|
counter,
|
|
148
138
|
icon: Icon,
|
|
139
|
+
iconsVisible,
|
|
149
140
|
loadingCounters,
|
|
150
141
|
className,
|
|
151
142
|
...rest
|
|
@@ -155,62 +146,65 @@ const UnderlineItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
155
146
|
$[2] = children;
|
|
156
147
|
$[3] = className;
|
|
157
148
|
$[4] = counter;
|
|
158
|
-
$[5] =
|
|
159
|
-
$[6] =
|
|
160
|
-
$[7] =
|
|
149
|
+
$[5] = iconsVisible;
|
|
150
|
+
$[6] = loadingCounters;
|
|
151
|
+
$[7] = rest;
|
|
152
|
+
$[8] = t0;
|
|
161
153
|
} else {
|
|
162
154
|
Icon = $[1];
|
|
163
155
|
children = $[2];
|
|
164
156
|
className = $[3];
|
|
165
157
|
counter = $[4];
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
158
|
+
iconsVisible = $[5];
|
|
159
|
+
loadingCounters = $[6];
|
|
160
|
+
rest = $[7];
|
|
161
|
+
t0 = $[8];
|
|
169
162
|
}
|
|
170
163
|
const Component = t0 === undefined ? "a" : t0;
|
|
171
164
|
let t1;
|
|
172
|
-
if ($[
|
|
165
|
+
if ($[9] !== children) {
|
|
173
166
|
t1 = getTextContent(children);
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
167
|
+
$[9] = children;
|
|
168
|
+
$[10] = t1;
|
|
176
169
|
} else {
|
|
177
|
-
t1 = $[
|
|
170
|
+
t1 = $[10];
|
|
178
171
|
}
|
|
179
172
|
const textContent = t1;
|
|
180
173
|
let t2;
|
|
181
|
-
if ($[
|
|
174
|
+
if ($[11] !== className) {
|
|
182
175
|
t2 = clsx(classes.UnderlineItem, className);
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
176
|
+
$[11] = className;
|
|
177
|
+
$[12] = t2;
|
|
185
178
|
} else {
|
|
186
|
-
t2 = $[
|
|
179
|
+
t2 = $[12];
|
|
187
180
|
}
|
|
188
181
|
let t3;
|
|
189
|
-
if ($[
|
|
190
|
-
t3 = Icon && /*#__PURE__*/jsx("span", {
|
|
182
|
+
if ($[13] !== Icon || $[14] !== iconsVisible) {
|
|
183
|
+
t3 = iconsVisible && Icon && /*#__PURE__*/jsx("span", {
|
|
191
184
|
"data-component": "icon",
|
|
192
185
|
children: isElement(Icon) ? Icon : /*#__PURE__*/jsx(Icon, {})
|
|
193
186
|
});
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
187
|
+
$[13] = Icon;
|
|
188
|
+
$[14] = iconsVisible;
|
|
189
|
+
$[15] = t3;
|
|
196
190
|
} else {
|
|
197
|
-
t3 = $[
|
|
191
|
+
t3 = $[15];
|
|
198
192
|
}
|
|
199
193
|
let t4;
|
|
200
|
-
if ($[
|
|
194
|
+
if ($[16] !== children || $[17] !== textContent) {
|
|
201
195
|
t4 = children && /*#__PURE__*/jsx("span", {
|
|
202
196
|
"data-component": "text",
|
|
203
197
|
"data-content": textContent || undefined,
|
|
204
198
|
children: children
|
|
205
199
|
});
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
200
|
+
$[16] = children;
|
|
201
|
+
$[17] = textContent;
|
|
202
|
+
$[18] = t4;
|
|
209
203
|
} else {
|
|
210
|
-
t4 = $[
|
|
204
|
+
t4 = $[18];
|
|
211
205
|
}
|
|
212
206
|
let t5;
|
|
213
|
-
if ($[
|
|
207
|
+
if ($[19] !== counter || $[20] !== loadingCounters) {
|
|
214
208
|
t5 = counter !== undefined ? loadingCounters ? /*#__PURE__*/jsx("span", {
|
|
215
209
|
"data-component": "counter",
|
|
216
210
|
children: /*#__PURE__*/jsx(LoadingCounter, {})
|
|
@@ -220,32 +214,32 @@ const UnderlineItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
220
214
|
children: counter
|
|
221
215
|
})
|
|
222
216
|
}) : null;
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
217
|
+
$[19] = counter;
|
|
218
|
+
$[20] = loadingCounters;
|
|
219
|
+
$[21] = t5;
|
|
226
220
|
} else {
|
|
227
|
-
t5 = $[
|
|
221
|
+
t5 = $[21];
|
|
228
222
|
}
|
|
229
223
|
let t6;
|
|
230
|
-
if ($[
|
|
224
|
+
if ($[22] !== Component || $[23] !== ref || $[24] !== rest || $[25] !== t2 || $[26] !== t3 || $[27] !== t4 || $[28] !== t5) {
|
|
231
225
|
t6 = /*#__PURE__*/jsxs(Component, {
|
|
232
226
|
...rest,
|
|
233
227
|
ref: ref,
|
|
234
228
|
className: t2,
|
|
235
229
|
children: [t3, t4, t5]
|
|
236
230
|
});
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
231
|
+
$[22] = Component;
|
|
232
|
+
$[23] = ref;
|
|
233
|
+
$[24] = rest;
|
|
234
|
+
$[25] = t2;
|
|
235
|
+
$[26] = t3;
|
|
236
|
+
$[27] = t4;
|
|
237
|
+
$[28] = t5;
|
|
238
|
+
$[29] = t6;
|
|
245
239
|
} else {
|
|
246
|
-
t6 = $[
|
|
240
|
+
t6 = $[29];
|
|
247
241
|
}
|
|
248
242
|
return t6;
|
|
249
243
|
});
|
|
250
244
|
|
|
251
|
-
export { LoadingCounter, UnderlineItem, UnderlineItemList, UnderlineWrapper };
|
|
245
|
+
export { GAP, LoadingCounter, UnderlineItem, UnderlineItemList, UnderlineWrapper };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './UnderlineTabbedInterface-
|
|
1
|
+
import './UnderlineTabbedInterface-4197ee28.css';
|
|
2
2
|
|
|
3
3
|
var classes = {"UnderlineWrapper":"prc-components-UnderlineWrapper-eT-Yj","UnderlineItemList":"prc-components-UnderlineItemList-xKlKC","UnderlineItem":"prc-components-UnderlineItem-7fP-n","LoadingCounter":"prc-components-LoadingCounter-dBuLy","loadingCounterKeyFrames":"prc-components-loadingCounterKeyFrames-8tMlf"};
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCharacterCountAnnouncement.test.d.ts","sourceRoot":"","sources":["../../../src/utils/__tests__/useCharacterCountAnnouncement.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared character counting
|
|
3
|
-
*
|
|
2
|
+
* Shared character counting helpers for text inputs with character limits.
|
|
3
|
+
* Provides the pure derivation used to render the counter and validation state.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
onScreenReaderAnnounce: (message: string) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare class CharacterCounter {
|
|
10
|
-
private announceTimeout;
|
|
11
|
-
private callbacks;
|
|
12
|
-
private isInitialLoad;
|
|
13
|
-
constructor(callbacks: CharacterCounterCallbacks);
|
|
14
|
-
/**
|
|
15
|
-
* Update the character count based on current input value
|
|
16
|
-
*/
|
|
17
|
-
updateCharacterCount(currentLength: number, maxLength: number): void;
|
|
5
|
+
export declare const SCREEN_READER_DELAY = 500;
|
|
6
|
+
export interface CharacterCountState {
|
|
18
7
|
/**
|
|
19
|
-
*
|
|
8
|
+
* Number of characters remaining before the limit is reached, or the number of
|
|
9
|
+
* characters over the limit when it has been exceeded.
|
|
20
10
|
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
count: number;
|
|
12
|
+
/** Whether the current length exceeds the limit. */
|
|
13
|
+
isOverLimit: boolean;
|
|
14
|
+
/** Human readable description of the remaining or over count. */
|
|
15
|
+
message: string;
|
|
26
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Compute the character count state for a given length and limit. This is a pure
|
|
19
|
+
* function so the counter can be derived during render without component state.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCharacterCountState(currentLength: number, maxLength: number): CharacterCountState;
|
|
27
22
|
//# sourceMappingURL=character-counter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-counter.d.ts","sourceRoot":"","sources":["../../src/utils/character-counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"character-counter.d.ts","sourceRoot":"","sources":["../../src/utils/character-counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,oDAAoD;IACpD,WAAW,EAAE,OAAO,CAAA;IACpB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,mBAAmB,CAmBpG"}
|