@wallarm-org/design-system 2.1.3 → 2.2.0-rc-fix-overflow-list-api.1
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/components/OverflowList/OverflowList.d.ts +18 -9
- package/dist/components/OverflowList/OverflowList.js +193 -204
- package/dist/components/OverflowList/OverflowListContext.d.ts +25 -0
- package/dist/components/OverflowList/OverflowListContext.js +12 -0
- package/dist/components/OverflowList/OverflowListMore.d.ts +17 -0
- package/dist/components/OverflowList/OverflowListMore.js +85 -0
- package/dist/components/OverflowList/OverflowListMoreContent.d.ts +7 -0
- package/dist/components/OverflowList/OverflowListMoreContent.js +60 -0
- package/dist/components/OverflowList/OverflowListMoreCount.d.ts +8 -0
- package/dist/components/OverflowList/OverflowListMoreCount.js +41 -0
- package/dist/components/OverflowList/OverflowListMoreHeader.d.ts +7 -0
- package/dist/components/OverflowList/OverflowListMoreHeader.js +36 -0
- package/dist/components/OverflowList/OverflowListMoreItems.d.ts +18 -0
- package/dist/components/OverflowList/OverflowListMoreItems.js +105 -0
- package/dist/components/OverflowList/OverflowListMoreTrigger.d.ts +10 -0
- package/dist/components/OverflowList/OverflowListMoreTrigger.js +143 -0
- package/dist/components/OverflowList/classes.d.ts +3 -0
- package/dist/components/OverflowList/classes.js +13 -0
- package/dist/components/OverflowList/index.d.ts +8 -1
- package/dist/components/OverflowList/index.js +7 -0
- package/dist/components/OverflowList/useOverflowListMore.d.ts +12 -0
- package/dist/components/OverflowList/useOverflowListMore.js +22 -0
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Select/SelectInput/SelectInputOverflowRenderer.d.ts +1 -3
- package/dist/components/Select/SelectInput/SelectInputOverflowRenderer.js +16 -26
- package/dist/metadata/components.json +2048 -505
- package/package.json +1 -1
- package/dist/components/OverflowList/DefaultOverflowRenderer.d.ts +0 -17
- package/dist/components/OverflowList/DefaultOverflowRenderer.js +0 -179
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import { type PopoverContentProps } from '../Popover/index.js';
|
|
3
|
+
export interface OverflowListMoreContentProps extends Omit<PopoverContentProps, 'children'> {
|
|
4
|
+
/** Defaults to `<OverflowListMoreItems />`. */
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const OverflowListMoreContent: FC<OverflowListMoreContentProps>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { PopoverContent } from "../Popover/index.js";
|
|
5
|
+
import { useOverflowListContext } from "./OverflowListContext.js";
|
|
6
|
+
import { OverflowListMoreItems } from "./OverflowListMoreItems.js";
|
|
7
|
+
const DEFAULT_CHILDREN = /*#__PURE__*/ jsx(OverflowListMoreItems, {});
|
|
8
|
+
const OverflowListMoreContent = (t0)=>{
|
|
9
|
+
const $ = c(14);
|
|
10
|
+
let className;
|
|
11
|
+
let props;
|
|
12
|
+
let t1;
|
|
13
|
+
let t2;
|
|
14
|
+
let t3;
|
|
15
|
+
if ($[0] !== t0) {
|
|
16
|
+
({ children: t1, className, minHeight: t2, maxWidth: t3, ...props } = t0);
|
|
17
|
+
$[0] = t0;
|
|
18
|
+
$[1] = className;
|
|
19
|
+
$[2] = props;
|
|
20
|
+
$[3] = t1;
|
|
21
|
+
$[4] = t2;
|
|
22
|
+
$[5] = t3;
|
|
23
|
+
} else {
|
|
24
|
+
className = $[1];
|
|
25
|
+
props = $[2];
|
|
26
|
+
t1 = $[3];
|
|
27
|
+
t2 = $[4];
|
|
28
|
+
t3 = $[5];
|
|
29
|
+
}
|
|
30
|
+
const children = void 0 === t1 ? DEFAULT_CHILDREN : t1;
|
|
31
|
+
const minHeight = void 0 === t2 ? "auto" : t2;
|
|
32
|
+
const maxWidth = void 0 === t3 ? "360px" : t3;
|
|
33
|
+
const { measuring } = useOverflowListContext();
|
|
34
|
+
if (measuring) return null;
|
|
35
|
+
let t4;
|
|
36
|
+
if ($[6] !== className) {
|
|
37
|
+
t4 = cn("gap-8", className);
|
|
38
|
+
$[6] = className;
|
|
39
|
+
$[7] = t4;
|
|
40
|
+
} else t4 = $[7];
|
|
41
|
+
let t5;
|
|
42
|
+
if ($[8] !== children || $[9] !== maxWidth || $[10] !== minHeight || $[11] !== props || $[12] !== t4) {
|
|
43
|
+
t5 = /*#__PURE__*/ jsx(PopoverContent, {
|
|
44
|
+
...props,
|
|
45
|
+
minHeight: minHeight,
|
|
46
|
+
maxWidth: maxWidth,
|
|
47
|
+
className: t4,
|
|
48
|
+
children: children
|
|
49
|
+
});
|
|
50
|
+
$[8] = children;
|
|
51
|
+
$[9] = maxWidth;
|
|
52
|
+
$[10] = minHeight;
|
|
53
|
+
$[11] = props;
|
|
54
|
+
$[12] = t4;
|
|
55
|
+
$[13] = t5;
|
|
56
|
+
} else t5 = $[13];
|
|
57
|
+
return t5;
|
|
58
|
+
};
|
|
59
|
+
OverflowListMoreContent.displayName = "OverflowListMoreContent";
|
|
60
|
+
export { OverflowListMoreContent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface OverflowListMoreCountProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'>, TestableProps {
|
|
4
|
+
/** `hidden` — items folded into the overflow; `total` — every item. */
|
|
5
|
+
of?: 'hidden' | 'total';
|
|
6
|
+
ref?: Ref<HTMLSpanElement>;
|
|
7
|
+
}
|
|
8
|
+
export declare const OverflowListMoreCount: FC<OverflowListMoreCountProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useTestId } from "../../utils/testId.js";
|
|
4
|
+
import { useOverflowListMore } from "./useOverflowListMore.js";
|
|
5
|
+
const OverflowListMoreCount = (t0)=>{
|
|
6
|
+
const $ = c(8);
|
|
7
|
+
let props;
|
|
8
|
+
let t1;
|
|
9
|
+
let testIdProp;
|
|
10
|
+
if ($[0] !== t0) {
|
|
11
|
+
({ of: t1, "data-testid": testIdProp, ...props } = t0);
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
$[1] = props;
|
|
14
|
+
$[2] = t1;
|
|
15
|
+
$[3] = testIdProp;
|
|
16
|
+
} else {
|
|
17
|
+
props = $[1];
|
|
18
|
+
t1 = $[2];
|
|
19
|
+
testIdProp = $[3];
|
|
20
|
+
}
|
|
21
|
+
const of = void 0 === t1 ? "hidden" : t1;
|
|
22
|
+
const testId = useTestId("count", testIdProp);
|
|
23
|
+
const { hiddenCount, totalCount } = useOverflowListMore();
|
|
24
|
+
const t2 = "total" === of ? totalCount : hiddenCount;
|
|
25
|
+
let t3;
|
|
26
|
+
if ($[4] !== props || $[5] !== t2 || $[6] !== testId) {
|
|
27
|
+
t3 = /*#__PURE__*/ jsx("span", {
|
|
28
|
+
...props,
|
|
29
|
+
"data-slot": "overflow-list-more-count",
|
|
30
|
+
"data-testid": testId,
|
|
31
|
+
children: t2
|
|
32
|
+
});
|
|
33
|
+
$[4] = props;
|
|
34
|
+
$[5] = t2;
|
|
35
|
+
$[6] = testId;
|
|
36
|
+
$[7] = t3;
|
|
37
|
+
} else t3 = $[7];
|
|
38
|
+
return t3;
|
|
39
|
+
};
|
|
40
|
+
OverflowListMoreCount.displayName = "OverflowListMoreCount";
|
|
41
|
+
export { OverflowListMoreCount };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import type { TestableProps } from '../../utils/testId.js';
|
|
3
|
+
import { type TextProps } from '../Text/index.js';
|
|
4
|
+
export interface OverflowListMoreHeaderProps extends Omit<TextProps, 'size' | 'weight' | 'color'>, TestableProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const OverflowListMoreHeader: FC<OverflowListMoreHeaderProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useTestId } from "../../utils/testId.js";
|
|
4
|
+
import { Text } from "../Text/index.js";
|
|
5
|
+
const OverflowListMoreHeader = (t0)=>{
|
|
6
|
+
const $ = c(6);
|
|
7
|
+
let props;
|
|
8
|
+
let testIdProp;
|
|
9
|
+
if ($[0] !== t0) {
|
|
10
|
+
({ "data-testid": testIdProp, ...props } = t0);
|
|
11
|
+
$[0] = t0;
|
|
12
|
+
$[1] = props;
|
|
13
|
+
$[2] = testIdProp;
|
|
14
|
+
} else {
|
|
15
|
+
props = $[1];
|
|
16
|
+
testIdProp = $[2];
|
|
17
|
+
}
|
|
18
|
+
const testId = useTestId("header", testIdProp);
|
|
19
|
+
let t1;
|
|
20
|
+
if ($[3] !== props || $[4] !== testId) {
|
|
21
|
+
t1 = /*#__PURE__*/ jsx(Text, {
|
|
22
|
+
...props,
|
|
23
|
+
size: "sm",
|
|
24
|
+
weight: "medium",
|
|
25
|
+
color: "secondary",
|
|
26
|
+
"data-slot": "overflow-list-more-header",
|
|
27
|
+
"data-testid": testId
|
|
28
|
+
});
|
|
29
|
+
$[3] = props;
|
|
30
|
+
$[4] = testId;
|
|
31
|
+
$[5] = t1;
|
|
32
|
+
} else t1 = $[5];
|
|
33
|
+
return t1;
|
|
34
|
+
};
|
|
35
|
+
OverflowListMoreHeader.displayName = "OverflowListMoreHeader";
|
|
36
|
+
export { OverflowListMoreHeader };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { type TestableProps } from '../../utils/testId.js';
|
|
3
|
+
export interface OverflowListMoreItemsProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>, TestableProps {
|
|
4
|
+
/** `all` lists every item (visible ones first); `hidden` only the folded ones. */
|
|
5
|
+
show?: 'all' | 'hidden';
|
|
6
|
+
/** Fade the items that are already visible in the row. Only with `show='all'`. */
|
|
7
|
+
dimVisible?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Item renderer for the popover. Defaults to the list's `itemRenderer`.
|
|
10
|
+
* `T` is not linked to the list's item type — annotate the parameter.
|
|
11
|
+
*/
|
|
12
|
+
renderItem?: (item: T, index: number) => ReactNode;
|
|
13
|
+
ref?: Ref<HTMLDivElement>;
|
|
14
|
+
}
|
|
15
|
+
export declare function OverflowListMoreItems<T>({ show, dimVisible, renderItem, className, 'data-testid': testIdProp, ...props }: OverflowListMoreItemsProps<T>): import("react").JSX.Element;
|
|
16
|
+
export declare namespace OverflowListMoreItems {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { TestIdProvider, useTestId } from "../../utils/testId.js";
|
|
5
|
+
import { overflowListMoreItemVariants } from "./classes.js";
|
|
6
|
+
import { useOverflowListContext } from "./OverflowListContext.js";
|
|
7
|
+
const OverflowListMoreItems = (t0)=>{
|
|
8
|
+
const $ = c(29);
|
|
9
|
+
let className;
|
|
10
|
+
let props;
|
|
11
|
+
let renderItem;
|
|
12
|
+
let t1;
|
|
13
|
+
let t2;
|
|
14
|
+
let testIdProp;
|
|
15
|
+
if ($[0] !== t0) {
|
|
16
|
+
({ show: t1, dimVisible: t2, renderItem, className, "data-testid": testIdProp, ...props } = t0);
|
|
17
|
+
$[0] = t0;
|
|
18
|
+
$[1] = className;
|
|
19
|
+
$[2] = props;
|
|
20
|
+
$[3] = renderItem;
|
|
21
|
+
$[4] = t1;
|
|
22
|
+
$[5] = t2;
|
|
23
|
+
$[6] = testIdProp;
|
|
24
|
+
} else {
|
|
25
|
+
className = $[1];
|
|
26
|
+
props = $[2];
|
|
27
|
+
renderItem = $[3];
|
|
28
|
+
t1 = $[4];
|
|
29
|
+
t2 = $[5];
|
|
30
|
+
testIdProp = $[6];
|
|
31
|
+
}
|
|
32
|
+
const show = void 0 === t1 ? "all" : t1;
|
|
33
|
+
const dimVisible = void 0 === t2 ? true : t2;
|
|
34
|
+
const testId = useTestId("items", testIdProp);
|
|
35
|
+
const { allItems, hiddenItems, itemRenderer } = useOverflowListContext();
|
|
36
|
+
const render = renderItem ?? itemRenderer;
|
|
37
|
+
const firstHidden = allItems.length - hiddenItems.length;
|
|
38
|
+
const itemTestId = testId && `${testId}--item`;
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[7] !== className) {
|
|
41
|
+
t3 = cn("flex flex-row flex-wrap gap-4", className);
|
|
42
|
+
$[7] = className;
|
|
43
|
+
$[8] = t3;
|
|
44
|
+
} else t3 = $[8];
|
|
45
|
+
let t4;
|
|
46
|
+
if ($[9] !== allItems || $[10] !== dimVisible || $[11] !== firstHidden || $[12] !== itemTestId || $[13] !== render || $[14] !== show) {
|
|
47
|
+
let t5;
|
|
48
|
+
if ($[16] !== dimVisible || $[17] !== firstHidden || $[18] !== itemTestId || $[19] !== render || $[20] !== show) {
|
|
49
|
+
t5 = (item, index)=>{
|
|
50
|
+
const isHidden = index >= firstHidden;
|
|
51
|
+
if ("hidden" === show && !isHidden) return null;
|
|
52
|
+
return /*#__PURE__*/ jsx("div", {
|
|
53
|
+
"data-slot": "overflow-list-more-item",
|
|
54
|
+
"data-testid": itemTestId,
|
|
55
|
+
"data-state": isHidden ? "hidden" : "visible",
|
|
56
|
+
className: overflowListMoreItemVariants({
|
|
57
|
+
dimmed: dimVisible && !isHidden
|
|
58
|
+
}),
|
|
59
|
+
children: render(item, index)
|
|
60
|
+
}, index);
|
|
61
|
+
};
|
|
62
|
+
$[16] = dimVisible;
|
|
63
|
+
$[17] = firstHidden;
|
|
64
|
+
$[18] = itemTestId;
|
|
65
|
+
$[19] = render;
|
|
66
|
+
$[20] = show;
|
|
67
|
+
$[21] = t5;
|
|
68
|
+
} else t5 = $[21];
|
|
69
|
+
t4 = allItems.map(t5);
|
|
70
|
+
$[9] = allItems;
|
|
71
|
+
$[10] = dimVisible;
|
|
72
|
+
$[11] = firstHidden;
|
|
73
|
+
$[12] = itemTestId;
|
|
74
|
+
$[13] = render;
|
|
75
|
+
$[14] = show;
|
|
76
|
+
$[15] = t4;
|
|
77
|
+
} else t4 = $[15];
|
|
78
|
+
let t5;
|
|
79
|
+
if ($[22] !== t4) {
|
|
80
|
+
t5 = /*#__PURE__*/ jsx(TestIdProvider, {
|
|
81
|
+
value: void 0,
|
|
82
|
+
children: t4
|
|
83
|
+
});
|
|
84
|
+
$[22] = t4;
|
|
85
|
+
$[23] = t5;
|
|
86
|
+
} else t5 = $[23];
|
|
87
|
+
let t6;
|
|
88
|
+
if ($[24] !== props || $[25] !== t3 || $[26] !== t5 || $[27] !== testId) {
|
|
89
|
+
t6 = /*#__PURE__*/ jsx("div", {
|
|
90
|
+
...props,
|
|
91
|
+
"data-slot": "overflow-list-more-items",
|
|
92
|
+
"data-testid": testId,
|
|
93
|
+
className: t3,
|
|
94
|
+
children: t5
|
|
95
|
+
});
|
|
96
|
+
$[24] = props;
|
|
97
|
+
$[25] = t3;
|
|
98
|
+
$[26] = t5;
|
|
99
|
+
$[27] = testId;
|
|
100
|
+
$[28] = t6;
|
|
101
|
+
} else t6 = $[28];
|
|
102
|
+
return t6;
|
|
103
|
+
};
|
|
104
|
+
OverflowListMoreItems.displayName = "OverflowListMoreItems";
|
|
105
|
+
export { OverflowListMoreItems };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { TestableProps } from '../../utils/testId.js';
|
|
3
|
+
import { type TagProps } from '../Tag/index.js';
|
|
4
|
+
export interface OverflowListMoreTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'value'>, TestableProps {
|
|
5
|
+
/** Defaults to `+<OverflowListMoreCount /> more`. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
size?: TagProps['size'];
|
|
8
|
+
ref?: Ref<HTMLButtonElement>;
|
|
9
|
+
}
|
|
10
|
+
export declare const OverflowListMoreTrigger: FC<OverflowListMoreTriggerProps>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { mergeRefs } from "../../utils/mergeRefs.js";
|
|
4
|
+
import { PopoverTrigger } from "../Popover/index.js";
|
|
5
|
+
import { Tag } from "../Tag/index.js";
|
|
6
|
+
import { useOverflowListContext, useOverflowListMoreTriggerRef } from "./OverflowListContext.js";
|
|
7
|
+
import { OverflowListMoreCount } from "./OverflowListMoreCount.js";
|
|
8
|
+
const DEFAULT_LABEL = /*#__PURE__*/ jsxs(Fragment, {
|
|
9
|
+
children: [
|
|
10
|
+
"+",
|
|
11
|
+
/*#__PURE__*/ jsx(OverflowListMoreCount, {}),
|
|
12
|
+
" more"
|
|
13
|
+
]
|
|
14
|
+
});
|
|
15
|
+
const OverflowListMoreTrigger = (t0)=>{
|
|
16
|
+
const $ = c(35);
|
|
17
|
+
let className;
|
|
18
|
+
let props;
|
|
19
|
+
let ref;
|
|
20
|
+
let size;
|
|
21
|
+
let style;
|
|
22
|
+
let t1;
|
|
23
|
+
let testId;
|
|
24
|
+
if ($[0] !== t0) {
|
|
25
|
+
({ children: t1, size, className, style, ref, "data-testid": testId, ...props } = t0);
|
|
26
|
+
$[0] = t0;
|
|
27
|
+
$[1] = className;
|
|
28
|
+
$[2] = props;
|
|
29
|
+
$[3] = ref;
|
|
30
|
+
$[4] = size;
|
|
31
|
+
$[5] = style;
|
|
32
|
+
$[6] = t1;
|
|
33
|
+
$[7] = testId;
|
|
34
|
+
} else {
|
|
35
|
+
className = $[1];
|
|
36
|
+
props = $[2];
|
|
37
|
+
ref = $[3];
|
|
38
|
+
size = $[4];
|
|
39
|
+
style = $[5];
|
|
40
|
+
t1 = $[6];
|
|
41
|
+
testId = $[7];
|
|
42
|
+
}
|
|
43
|
+
const children = void 0 === t1 ? DEFAULT_LABEL : t1;
|
|
44
|
+
const { measuring } = useOverflowListContext();
|
|
45
|
+
const triggerRef = useOverflowListMoreTriggerRef();
|
|
46
|
+
if (measuring) {
|
|
47
|
+
let t2;
|
|
48
|
+
if ($[8] !== children) {
|
|
49
|
+
t2 = /*#__PURE__*/ jsx("span", {
|
|
50
|
+
children: children
|
|
51
|
+
});
|
|
52
|
+
$[8] = children;
|
|
53
|
+
$[9] = t2;
|
|
54
|
+
} else t2 = $[9];
|
|
55
|
+
let t3;
|
|
56
|
+
if ($[10] !== className || $[11] !== props || $[12] !== style || $[13] !== t2) {
|
|
57
|
+
t3 = /*#__PURE__*/ jsx("button", {
|
|
58
|
+
...props,
|
|
59
|
+
type: "button",
|
|
60
|
+
tabIndex: -1,
|
|
61
|
+
className: className,
|
|
62
|
+
style: style,
|
|
63
|
+
children: t2
|
|
64
|
+
});
|
|
65
|
+
$[10] = className;
|
|
66
|
+
$[11] = props;
|
|
67
|
+
$[12] = style;
|
|
68
|
+
$[13] = t2;
|
|
69
|
+
$[14] = t3;
|
|
70
|
+
} else t3 = $[14];
|
|
71
|
+
let t4;
|
|
72
|
+
if ($[15] !== size || $[16] !== t3) {
|
|
73
|
+
t4 = /*#__PURE__*/ jsx(Tag, {
|
|
74
|
+
size: size,
|
|
75
|
+
asChild: true,
|
|
76
|
+
children: t3
|
|
77
|
+
});
|
|
78
|
+
$[15] = size;
|
|
79
|
+
$[16] = t3;
|
|
80
|
+
$[17] = t4;
|
|
81
|
+
} else t4 = $[17];
|
|
82
|
+
return t4;
|
|
83
|
+
}
|
|
84
|
+
const t2 = triggerRef ?? void 0;
|
|
85
|
+
let t3;
|
|
86
|
+
if ($[18] !== ref || $[19] !== t2) {
|
|
87
|
+
t3 = mergeRefs(ref, t2);
|
|
88
|
+
$[18] = ref;
|
|
89
|
+
$[19] = t2;
|
|
90
|
+
$[20] = t3;
|
|
91
|
+
} else t3 = $[20];
|
|
92
|
+
let t4;
|
|
93
|
+
if ($[21] !== children) {
|
|
94
|
+
t4 = /*#__PURE__*/ jsx("span", {
|
|
95
|
+
children: children
|
|
96
|
+
});
|
|
97
|
+
$[21] = children;
|
|
98
|
+
$[22] = t4;
|
|
99
|
+
} else t4 = $[22];
|
|
100
|
+
let t5;
|
|
101
|
+
if ($[23] !== className || $[24] !== style || $[25] !== t4) {
|
|
102
|
+
t5 = /*#__PURE__*/ jsx("button", {
|
|
103
|
+
type: "button",
|
|
104
|
+
"data-slot": "overflow-list-more-trigger",
|
|
105
|
+
className: className,
|
|
106
|
+
style: style,
|
|
107
|
+
children: t4
|
|
108
|
+
});
|
|
109
|
+
$[23] = className;
|
|
110
|
+
$[24] = style;
|
|
111
|
+
$[25] = t4;
|
|
112
|
+
$[26] = t5;
|
|
113
|
+
} else t5 = $[26];
|
|
114
|
+
let t6;
|
|
115
|
+
if ($[27] !== size || $[28] !== t5) {
|
|
116
|
+
t6 = /*#__PURE__*/ jsx(Tag, {
|
|
117
|
+
size: size,
|
|
118
|
+
asChild: true,
|
|
119
|
+
children: t5
|
|
120
|
+
});
|
|
121
|
+
$[27] = size;
|
|
122
|
+
$[28] = t5;
|
|
123
|
+
$[29] = t6;
|
|
124
|
+
} else t6 = $[29];
|
|
125
|
+
let t7;
|
|
126
|
+
if ($[30] !== props || $[31] !== t3 || $[32] !== t6 || $[33] !== testId) {
|
|
127
|
+
t7 = /*#__PURE__*/ jsx(PopoverTrigger, {
|
|
128
|
+
...props,
|
|
129
|
+
ref: t3,
|
|
130
|
+
"data-testid": testId,
|
|
131
|
+
asChild: true,
|
|
132
|
+
children: t6
|
|
133
|
+
});
|
|
134
|
+
$[30] = props;
|
|
135
|
+
$[31] = t3;
|
|
136
|
+
$[32] = t6;
|
|
137
|
+
$[33] = testId;
|
|
138
|
+
$[34] = t7;
|
|
139
|
+
} else t7 = $[34];
|
|
140
|
+
return t7;
|
|
141
|
+
};
|
|
142
|
+
OverflowListMoreTrigger.displayName = "OverflowListMoreTrigger";
|
|
143
|
+
export { OverflowListMoreTrigger };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
const overflowListMoreItemVariants = cva('flex', {
|
|
3
|
+
variants: {
|
|
4
|
+
dimmed: {
|
|
5
|
+
true: 'opacity-60',
|
|
6
|
+
false: ''
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
defaultVariants: {
|
|
10
|
+
dimmed: false
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export { overflowListMoreItemVariants };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
export type { OverflowListProps,
|
|
1
|
+
export type { OverflowListOverflowMeta, OverflowListProps, OverflowListRenderer, } from './OverflowList.js';
|
|
2
2
|
export { OverflowList } from './OverflowList.js';
|
|
3
|
+
export { OverflowListMore, type OverflowListMoreProps } from './OverflowListMore.js';
|
|
4
|
+
export { OverflowListMoreContent, type OverflowListMoreContentProps, } from './OverflowListMoreContent.js';
|
|
5
|
+
export { OverflowListMoreCount, type OverflowListMoreCountProps } from './OverflowListMoreCount.js';
|
|
6
|
+
export { OverflowListMoreHeader, type OverflowListMoreHeaderProps, } from './OverflowListMoreHeader.js';
|
|
7
|
+
export { OverflowListMoreItems, type OverflowListMoreItemsProps } from './OverflowListMoreItems.js';
|
|
8
|
+
export { OverflowListMoreTrigger, type OverflowListMoreTriggerProps, } from './OverflowListMoreTrigger.js';
|
|
9
|
+
export { type OverflowListMoreState, useOverflowListMore } from './useOverflowListMore.js';
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export { OverflowList } from "./OverflowList.js";
|
|
2
|
+
export { OverflowListMore } from "./OverflowListMore.js";
|
|
3
|
+
export { OverflowListMoreContent } from "./OverflowListMoreContent.js";
|
|
4
|
+
export { OverflowListMoreCount } from "./OverflowListMoreCount.js";
|
|
5
|
+
export { OverflowListMoreHeader } from "./OverflowListMoreHeader.js";
|
|
6
|
+
export { OverflowListMoreItems } from "./OverflowListMoreItems.js";
|
|
7
|
+
export { OverflowListMoreTrigger } from "./OverflowListMoreTrigger.js";
|
|
8
|
+
export { useOverflowListMore } from "./useOverflowListMore.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface OverflowListMoreState<T> {
|
|
2
|
+
allItems: T[];
|
|
3
|
+
visibleItems: T[];
|
|
4
|
+
hiddenItems: T[];
|
|
5
|
+
hiddenCount: number;
|
|
6
|
+
totalCount: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Read the list split from inside an `OverflowList` overflow renderer — e.g.
|
|
10
|
+
* to pluralize a localized header: `t('tags', { count: totalCount })`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useOverflowListMore: <T = unknown>() => OverflowListMoreState<T>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { useOverflowListContext } from "./OverflowListContext.js";
|
|
3
|
+
const useOverflowListMore = ()=>{
|
|
4
|
+
const $ = c(4);
|
|
5
|
+
const { allItems, visibleItems, hiddenItems } = useOverflowListContext();
|
|
6
|
+
let t0;
|
|
7
|
+
if ($[0] !== allItems || $[1] !== hiddenItems || $[2] !== visibleItems) {
|
|
8
|
+
t0 = {
|
|
9
|
+
allItems,
|
|
10
|
+
visibleItems,
|
|
11
|
+
hiddenItems,
|
|
12
|
+
hiddenCount: hiddenItems.length,
|
|
13
|
+
totalCount: allItems.length
|
|
14
|
+
};
|
|
15
|
+
$[0] = allItems;
|
|
16
|
+
$[1] = hiddenItems;
|
|
17
|
+
$[2] = visibleItems;
|
|
18
|
+
$[3] = t0;
|
|
19
|
+
} else t0 = $[3];
|
|
20
|
+
return t0;
|
|
21
|
+
};
|
|
22
|
+
export { useOverflowListMore };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Popover } from './Popover.js';
|
|
1
|
+
export { Popover, type PopoverProps } from './Popover.js';
|
|
2
2
|
export { PopoverContent, type PopoverContentProps } from './PopoverContent.js';
|
|
3
3
|
export { PopoverTrigger, type PopoverTriggerProps } from './PopoverTrigger.js';
|
|
4
4
|
export type { PopoverSizeDimension } from './types.js';
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SelectDataItem } from '../types.js';
|
|
3
|
-
export declare const createSelectInputOverflowRenderer: (size: 'small' | 'medium' | 'default' | 'inline-edit') => (data: ShowAllOverflowData<SelectDataItem>) => import("react").JSX.Element;
|
|
1
|
+
export declare const createSelectInputOverflowRenderer: (size: 'small' | 'medium' | 'default' | 'inline-edit') => () => import("react").JSX.Element;
|
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../../Popover/index.js";
|
|
4
|
-
import { HStack } from "../../Stack/index.js";
|
|
2
|
+
import { OverflowListMore, OverflowListMoreContent, OverflowListMoreCount, OverflowListMoreItems, OverflowListMoreTrigger } from "../../OverflowList/index.js";
|
|
5
3
|
import { Tag } from "../../Tag/index.js";
|
|
6
4
|
import { TAG_SIZE_BY_SELECT_SIZE } from "./SelectInputItemRenderer.js";
|
|
7
5
|
const POPOVER_MAX_WIDTH = '256px';
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const renderPopoverItem = (item)=>/*#__PURE__*/ jsx(Tag, {
|
|
7
|
+
size: "large",
|
|
8
|
+
children: item.label
|
|
9
|
+
});
|
|
10
|
+
const createSelectInputOverflowRenderer = (size)=>()=>/*#__PURE__*/ jsxs(OverflowListMore, {
|
|
11
11
|
children: [
|
|
12
|
-
/*#__PURE__*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"+",
|
|
19
|
-
data.hiddenCount
|
|
20
|
-
]
|
|
21
|
-
})
|
|
12
|
+
/*#__PURE__*/ jsxs(OverflowListMoreTrigger, {
|
|
13
|
+
size: TAG_SIZE_BY_SELECT_SIZE[size],
|
|
14
|
+
children: [
|
|
15
|
+
"+",
|
|
16
|
+
/*#__PURE__*/ jsx(OverflowListMoreCount, {})
|
|
17
|
+
]
|
|
22
18
|
}),
|
|
23
|
-
/*#__PURE__*/ jsx(
|
|
24
|
-
minHeight: "auto",
|
|
19
|
+
/*#__PURE__*/ jsx(OverflowListMoreContent, {
|
|
25
20
|
maxWidth: POPOVER_MAX_WIDTH,
|
|
26
|
-
children: /*#__PURE__*/ jsx(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
children: hiddenItems.map((item)=>/*#__PURE__*/ jsx(Tag, {
|
|
30
|
-
size: "large",
|
|
31
|
-
children: item.label
|
|
32
|
-
}, item.value))
|
|
21
|
+
children: /*#__PURE__*/ jsx(OverflowListMoreItems, {
|
|
22
|
+
show: "hidden",
|
|
23
|
+
renderItem: renderPopoverItem
|
|
33
24
|
})
|
|
34
25
|
})
|
|
35
26
|
]
|
|
36
27
|
});
|
|
37
|
-
};
|
|
38
28
|
export { createSelectInputOverflowRenderer };
|