@sesamehr/react-design-system 3.10.2 → 3.12.0
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/Display/AvatarGroup/AvatarGroup.d.ts +16 -2
- package/dist/Display/AvatarGroup/AvatarGroup.js +73 -61
- package/dist/Display/AvatarGroup/AvatarGroup.module.css.js +16 -14
- package/dist/Feedback/Alert/Alert.d.ts +5 -0
- package/dist/Feedback/Alert/Alert.js +42 -31
- package/dist/Feedback/Alert/Alert.module.css.js +7 -6
- package/dist/Feedback/Alert/AlertDescription.module.css.js +1 -1
- package/dist/Feedback/Alert/AlertIcon.js +25 -23
- package/dist/Feedback/Alert/AlertLink.d.ts +4 -3
- package/dist/Feedback/Alert/AlertLink.module.css.js +1 -1
- package/dist/Feedback/Alert/alert-context.d.ts +1 -1
- package/dist/Forms/Inputs/Combobox/ComboboxContent.d.ts +2 -0
- package/dist/Forms/Inputs/Combobox/ComboboxContent.js +50 -38
- package/dist/Forms/Inputs/Combobox/useReachEnd.d.ts +22 -0
- package/dist/Forms/Inputs/Combobox/useReachEnd.js +33 -0
- package/dist/react-design-system.css +1 -1
- package/dist/translations/ca.json.js +1 -0
- package/dist/translations/de.json.js +1 -0
- package/dist/translations/en.json.js +1 -0
- package/dist/translations/es-MX.json.js +1 -0
- package/dist/translations/es.json.js +1 -0
- package/dist/translations/fr.json.js +1 -0
- package/dist/translations/it.json.js +1 -0
- package/dist/translations/nl.json.js +1 -0
- package/dist/translations/pt-BR.json.js +1 -0
- package/package.json +1 -1
|
@@ -34,8 +34,22 @@ export interface AvatarGroupProps extends Omit<React.ButtonHTMLAttributes<HTMLBu
|
|
|
34
34
|
interactive?: boolean;
|
|
35
35
|
/** The size every avatar in the stack is drawn at. */
|
|
36
36
|
size?: AvatarSize;
|
|
37
|
-
/**
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Click handler (only fired when interactive). `avatar` is the avatar the
|
|
39
|
+
* click landed on and `index` its index into `avatars`.
|
|
40
|
+
*
|
|
41
|
+
* Avatars only report themselves while the stack is **complete**. The
|
|
42
|
+
* moment there is an overflow counter the stack is one affordance for the
|
|
43
|
+
* whole group, so every click fires with no payload at all, a click straight
|
|
44
|
+
* on a face included: what is on show is a subset, and pointing at one cannot
|
|
45
|
+
* stand for a person. So an absent avatar means "the group", and a caller
|
|
46
|
+
* written before this ignores the arguments and is unaffected.
|
|
47
|
+
*
|
|
48
|
+
* The faces are still not individually focusable, since the stack is one
|
|
49
|
+
* `<button>`, so this is a pointer-grade affordance. A caller that needs
|
|
50
|
+
* per-person keyboard access has to paint the avatars itself.
|
|
51
|
+
*/
|
|
52
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>, avatar?: AvatarItem, index?: number) => void;
|
|
39
53
|
dataTestid: string;
|
|
40
54
|
}
|
|
41
55
|
export declare const AvatarGroup: import('react').ForwardRefExoticComponent<AvatarGroupProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,90 +1,102 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { cn as
|
|
1
|
+
import { jsx as a, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "@radix-ui/react-tooltip";
|
|
3
|
+
import { forwardRef as I, useMemo as v } from "react";
|
|
4
|
+
import { cn as $ } from "../../lib/utils.js";
|
|
5
5
|
import o from "./AvatarGroup.module.css.js";
|
|
6
|
-
import { AvatarRounded as
|
|
7
|
-
import { TooltipContent as
|
|
8
|
-
const
|
|
6
|
+
import { AvatarRounded as G } from "../Avatar/AvatarRounded/AvatarRounded.js";
|
|
7
|
+
import { TooltipContent as R } from "../../Feedback/Tooltip/TooltipContent.js";
|
|
8
|
+
const T = 300, w = I(
|
|
9
9
|
({
|
|
10
|
-
className:
|
|
11
|
-
avatars:
|
|
12
|
-
max:
|
|
13
|
-
total:
|
|
14
|
-
interactive:
|
|
15
|
-
size:
|
|
16
|
-
onClick:
|
|
17
|
-
dataTestid:
|
|
18
|
-
...
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
return Math.max(0, Math.trunc(
|
|
23
|
-
}, [
|
|
24
|
-
return /* @__PURE__ */
|
|
10
|
+
className: b,
|
|
11
|
+
avatars: d,
|
|
12
|
+
max: h = 3,
|
|
13
|
+
total: x,
|
|
14
|
+
interactive: A = !0,
|
|
15
|
+
size: l = "xs",
|
|
16
|
+
onClick: r,
|
|
17
|
+
dataTestid: i,
|
|
18
|
+
...N
|
|
19
|
+
}, y) => {
|
|
20
|
+
const s = v(() => d.slice(0, h), [d, h]), m = v(() => {
|
|
21
|
+
const t = x ?? d.length;
|
|
22
|
+
return Math.max(0, Math.trunc(t) - s.length) || 0;
|
|
23
|
+
}, [x, d.length, s.length]);
|
|
24
|
+
return /* @__PURE__ */ a(
|
|
25
25
|
"button",
|
|
26
26
|
{
|
|
27
|
-
ref:
|
|
27
|
+
ref: y,
|
|
28
28
|
type: "button",
|
|
29
29
|
"data-slot": "avatar-group",
|
|
30
|
-
"data-testid":
|
|
31
|
-
className:
|
|
30
|
+
"data-testid": i,
|
|
31
|
+
className: $(
|
|
32
32
|
o.oxAvatarGroup,
|
|
33
|
-
o[`oxAvatarGroup--${
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
o[`oxAvatarGroup--${l}`],
|
|
34
|
+
A && o.oxAvatarGroupInteractive,
|
|
35
|
+
m > 0 && o.oxAvatarGroupOverflowing,
|
|
36
|
+
b
|
|
36
37
|
),
|
|
37
|
-
onClick: (
|
|
38
|
-
u
|
|
38
|
+
onClick: (t) => {
|
|
39
|
+
var u, g;
|
|
40
|
+
if (!A) return;
|
|
41
|
+
if (m > 0) {
|
|
42
|
+
r == null || r(t);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const e = (g = (u = t.target) == null ? void 0 : u.closest) == null ? void 0 : g.call(
|
|
46
|
+
u,
|
|
47
|
+
"[data-avatar-index]"
|
|
48
|
+
), n = e ? Number(e.getAttribute("data-avatar-index")) : -1, f = s[n];
|
|
49
|
+
f ? r == null || r(t, f, n) : r == null || r(t);
|
|
39
50
|
},
|
|
40
|
-
...
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
51
|
+
...N,
|
|
52
|
+
children: /* @__PURE__ */ a(c.Provider, { delayDuration: T, children: /* @__PURE__ */ p("div", { className: o.oxAvatarGroupStack, children: [
|
|
53
|
+
s.map((t, e) => {
|
|
54
|
+
const n = /* @__PURE__ */ a(
|
|
55
|
+
G,
|
|
45
56
|
{
|
|
46
|
-
role:
|
|
47
|
-
"aria-label":
|
|
48
|
-
dataTestid: `${
|
|
49
|
-
src:
|
|
50
|
-
size:
|
|
51
|
-
disabled:
|
|
52
|
-
children:
|
|
57
|
+
role: t.name ? "img" : void 0,
|
|
58
|
+
"aria-label": t.name,
|
|
59
|
+
dataTestid: `${i}-avatar-${e}`,
|
|
60
|
+
src: t.src,
|
|
61
|
+
size: l,
|
|
62
|
+
disabled: t.disabled,
|
|
63
|
+
children: t.initials
|
|
53
64
|
}
|
|
54
65
|
);
|
|
55
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ a(
|
|
56
67
|
"div",
|
|
57
68
|
{
|
|
58
69
|
className: o.oxAvatarGroupItem,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
70
|
+
"data-avatar-index": e,
|
|
71
|
+
style: { zIndex: e },
|
|
72
|
+
children: t.name ? /* @__PURE__ */ p(c.Root, { children: [
|
|
73
|
+
/* @__PURE__ */ a(c.Trigger, { asChild: !0, children: n }),
|
|
74
|
+
/* @__PURE__ */ a(
|
|
75
|
+
R,
|
|
64
76
|
{
|
|
65
|
-
dataTestid: `${
|
|
66
|
-
children:
|
|
77
|
+
dataTestid: `${i}-tooltip-${e}`,
|
|
78
|
+
children: t.name
|
|
67
79
|
}
|
|
68
80
|
)
|
|
69
|
-
] }) :
|
|
81
|
+
] }) : n
|
|
70
82
|
},
|
|
71
|
-
|
|
83
|
+
e
|
|
72
84
|
);
|
|
73
85
|
}),
|
|
74
|
-
|
|
86
|
+
m > 0 && /* @__PURE__ */ a(
|
|
75
87
|
"div",
|
|
76
88
|
{
|
|
77
89
|
className: o.oxAvatarGroupItem,
|
|
78
|
-
style: { zIndex:
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
|
|
90
|
+
style: { zIndex: s.length },
|
|
91
|
+
children: /* @__PURE__ */ p(
|
|
92
|
+
G,
|
|
81
93
|
{
|
|
82
|
-
dataTestid: `${
|
|
83
|
-
size:
|
|
94
|
+
dataTestid: `${i}-count`,
|
|
95
|
+
size: l,
|
|
84
96
|
tone: "neutral",
|
|
85
97
|
children: [
|
|
86
98
|
"+",
|
|
87
|
-
|
|
99
|
+
m
|
|
88
100
|
]
|
|
89
101
|
}
|
|
90
102
|
)
|
|
@@ -95,7 +107,7 @@ const N = 300, $ = b(
|
|
|
95
107
|
);
|
|
96
108
|
}
|
|
97
109
|
);
|
|
98
|
-
|
|
110
|
+
w.displayName = "OxAvatarGroup";
|
|
99
111
|
export {
|
|
100
|
-
|
|
112
|
+
w as AvatarGroup
|
|
101
113
|
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
const a = "
|
|
2
|
-
oxAvatarGroup:
|
|
3
|
-
"oxAvatarGroup--xs": "_oxAvatarGroup--
|
|
4
|
-
"oxAvatarGroup--sm": "_oxAvatarGroup--
|
|
5
|
-
"oxAvatarGroup--md": "_oxAvatarGroup--
|
|
6
|
-
"oxAvatarGroup--lg": "_oxAvatarGroup--
|
|
7
|
-
"oxAvatarGroup--xl": "_oxAvatarGroup--
|
|
8
|
-
oxAvatarGroupInteractive:
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const o = "_oxAvatarGroup_1tcwh_2", a = "_oxAvatarGroupInteractive_1tcwh_2", r = "_oxAvatarGroupOverflowing_1tcwh_2", t = "_oxAvatarGroupStack_1tcwh_2", v = "_oxAvatarGroupItem_1tcwh_2", x = {
|
|
2
|
+
oxAvatarGroup: o,
|
|
3
|
+
"oxAvatarGroup--xs": "_oxAvatarGroup--xs_1tcwh_2",
|
|
4
|
+
"oxAvatarGroup--sm": "_oxAvatarGroup--sm_1tcwh_2",
|
|
5
|
+
"oxAvatarGroup--md": "_oxAvatarGroup--md_1tcwh_2",
|
|
6
|
+
"oxAvatarGroup--lg": "_oxAvatarGroup--lg_1tcwh_2",
|
|
7
|
+
"oxAvatarGroup--xl": "_oxAvatarGroup--xl_1tcwh_2",
|
|
8
|
+
oxAvatarGroupInteractive: a,
|
|
9
|
+
oxAvatarGroupOverflowing: r,
|
|
10
|
+
oxAvatarGroupStack: t,
|
|
11
|
+
oxAvatarGroupItem: v
|
|
11
12
|
};
|
|
12
13
|
export {
|
|
13
14
|
x as default,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
o as oxAvatarGroup,
|
|
16
|
+
a as oxAvatarGroupInteractive,
|
|
17
|
+
v as oxAvatarGroupItem,
|
|
18
|
+
r as oxAvatarGroupOverflowing,
|
|
19
|
+
t as oxAvatarGroupStack
|
|
18
20
|
};
|
|
@@ -4,6 +4,11 @@ export interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
4
4
|
dismissible?: boolean;
|
|
5
5
|
collapsible?: boolean;
|
|
6
6
|
isOpen?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Drops the "Generated with AI" marker from an `ai` alert. Read on `ai` and
|
|
9
|
+
* ignored everywhere else.
|
|
10
|
+
*/
|
|
11
|
+
hideAiTag?: boolean;
|
|
7
12
|
/** Called once the alert has been dismissed. */
|
|
8
13
|
onDismissed?: () => void;
|
|
9
14
|
/** Called with the next open state — the controlled half of `isOpen`. */
|
|
@@ -1,60 +1,71 @@
|
|
|
1
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsx as i, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { IconSesameIa as j } from "@sesame/orxata-icons/IconSesameIa";
|
|
3
|
+
import { Icon as y } from "@sesame/orxata-icons/react";
|
|
4
|
+
import { forwardRef as M, useState as N } from "react";
|
|
5
|
+
import { AiTag as T } from "../../Display/AiTag/AiTag.js";
|
|
6
|
+
import { TransitionFade as w } from "../../Transitions/TransitionFade/TransitionFade.js";
|
|
7
|
+
import { cn as D } from "../../lib/utils.js";
|
|
8
|
+
import m from "./Alert.module.css.js";
|
|
9
|
+
import { AlertContext as F } from "./alert-context.js";
|
|
10
|
+
import { useTranslate as P } from "../../Locale/useTranslate.js";
|
|
11
|
+
const R = 200, _ = M(
|
|
8
12
|
({
|
|
9
|
-
className:
|
|
13
|
+
className: c,
|
|
10
14
|
variant: r = "info",
|
|
11
15
|
dismissible: f = !1,
|
|
12
|
-
collapsible:
|
|
16
|
+
collapsible: x = !1,
|
|
13
17
|
isOpen: t = !0,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
hideAiTag: d = !1,
|
|
19
|
+
onDismissed: a,
|
|
20
|
+
onOpenChange: e,
|
|
21
|
+
onToggled: o,
|
|
17
22
|
children: u,
|
|
18
|
-
...
|
|
23
|
+
...p
|
|
19
24
|
}, A) => {
|
|
20
|
-
const [
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
25
|
+
const [l, I] = N(!1), S = P(), v = () => {
|
|
26
|
+
I(!0), a == null || a();
|
|
27
|
+
}, h = () => {
|
|
28
|
+
e == null || e(!t), o == null || o(!t);
|
|
24
29
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
30
|
+
return /* @__PURE__ */ i(
|
|
31
|
+
F.Provider,
|
|
27
32
|
{
|
|
28
33
|
value: {
|
|
29
34
|
variant: r,
|
|
30
|
-
isDismissed:
|
|
35
|
+
isDismissed: l,
|
|
31
36
|
isOpen: t,
|
|
32
37
|
dismissible: f,
|
|
33
|
-
collapsible:
|
|
38
|
+
collapsible: x,
|
|
34
39
|
handleDismiss: v,
|
|
35
|
-
handleToggle:
|
|
40
|
+
handleToggle: h
|
|
36
41
|
},
|
|
37
|
-
children: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ i(w, { in: !l, leaveDuration: R, children: /* @__PURE__ */ s(
|
|
38
43
|
"div",
|
|
39
44
|
{
|
|
40
45
|
ref: A,
|
|
41
|
-
className:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
className: D(
|
|
47
|
+
m.oxAlert,
|
|
48
|
+
m[`oxAlert-${r}`],
|
|
49
|
+
c
|
|
45
50
|
),
|
|
46
51
|
role: "alert",
|
|
47
52
|
"aria-live": r === "error" ? "assertive" : "polite",
|
|
48
53
|
"aria-atomic": "true",
|
|
49
|
-
...
|
|
50
|
-
children:
|
|
54
|
+
...p,
|
|
55
|
+
children: [
|
|
56
|
+
r === "ai" && !d && /* @__PURE__ */ s(T, { dataTestid: "ox-alert-ai-tag", children: [
|
|
57
|
+
/* @__PURE__ */ i(y, { icon: j, "data-slot": "icon" }),
|
|
58
|
+
S("orxata.alert.aiTag")
|
|
59
|
+
] }),
|
|
60
|
+
u
|
|
61
|
+
]
|
|
51
62
|
}
|
|
52
63
|
) })
|
|
53
64
|
}
|
|
54
65
|
);
|
|
55
66
|
}
|
|
56
67
|
);
|
|
57
|
-
|
|
68
|
+
_.displayName = "OxAlert";
|
|
58
69
|
export {
|
|
59
|
-
|
|
70
|
+
_ as Alert
|
|
60
71
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
const e = "
|
|
1
|
+
const e = "_oxAlert_1nisp_2", r = {
|
|
2
2
|
oxAlert: e,
|
|
3
|
-
"oxAlert-warning": "_oxAlert-
|
|
4
|
-
"oxAlert-error": "_oxAlert-
|
|
5
|
-
"oxAlert-info": "_oxAlert-
|
|
6
|
-
"oxAlert-success": "_oxAlert-
|
|
7
|
-
"oxAlert-muted": "_oxAlert-
|
|
3
|
+
"oxAlert-warning": "_oxAlert-warning_1nisp_2",
|
|
4
|
+
"oxAlert-error": "_oxAlert-error_1nisp_2",
|
|
5
|
+
"oxAlert-info": "_oxAlert-info_1nisp_2",
|
|
6
|
+
"oxAlert-success": "_oxAlert-success_1nisp_2",
|
|
7
|
+
"oxAlert-muted": "_oxAlert-muted_1nisp_2",
|
|
8
|
+
"oxAlert-ai": "_oxAlert-ai_1nisp_2"
|
|
8
9
|
};
|
|
9
10
|
export {
|
|
10
11
|
r as default,
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { IconAlertCircle as
|
|
3
|
-
import { IconAlertTriangle as
|
|
4
|
-
import { IconCircleCheck as
|
|
2
|
+
import { IconAlertCircle as a } from "@sesame/orxata-icons/IconAlertCircle";
|
|
3
|
+
import { IconAlertTriangle as f } from "@sesame/orxata-icons/IconAlertTriangle";
|
|
4
|
+
import { IconCircleCheck as l } from "@sesame/orxata-icons/IconCircleCheck";
|
|
5
5
|
import { IconInfoCircle as s } from "@sesame/orxata-icons/IconInfoCircle";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import A from "
|
|
11
|
-
import
|
|
12
|
-
|
|
6
|
+
import { IconSesameIa as p } from "@sesame/orxata-icons/IconSesameIa";
|
|
7
|
+
import { IconStar as I } from "@sesame/orxata-icons/IconStar";
|
|
8
|
+
import { Icon as d } from "@sesame/orxata-icons/react";
|
|
9
|
+
import { forwardRef as u } from "react";
|
|
10
|
+
import { cn as A } from "../../lib/utils.js";
|
|
11
|
+
import x from "./AlertIcon.module.css.js";
|
|
12
|
+
import { useAlertContext as C } from "./alert-context.js";
|
|
13
|
+
const g = {
|
|
13
14
|
info: s,
|
|
14
|
-
warning:
|
|
15
|
-
error:
|
|
16
|
-
success:
|
|
17
|
-
muted:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
warning: f,
|
|
16
|
+
error: a,
|
|
17
|
+
success: l,
|
|
18
|
+
muted: I,
|
|
19
|
+
ai: p
|
|
20
|
+
}, h = u(
|
|
21
|
+
({ className: t, children: e, dataTestid: o, ...m }, n) => {
|
|
22
|
+
const { variant: c } = C(), i = g[c];
|
|
21
23
|
return /* @__PURE__ */ r(
|
|
22
24
|
"div",
|
|
23
25
|
{
|
|
24
|
-
ref:
|
|
25
|
-
className:
|
|
26
|
+
ref: n,
|
|
27
|
+
className: A(x.oxAlertIcon, t),
|
|
26
28
|
"data-slot": "icon",
|
|
27
29
|
"data-testid": o,
|
|
28
|
-
...
|
|
29
|
-
children: e ?? /* @__PURE__ */ r(
|
|
30
|
+
...m,
|
|
31
|
+
children: e ?? /* @__PURE__ */ r(d, { icon: i, "data-testid": `${o}-default` })
|
|
30
32
|
}
|
|
31
33
|
);
|
|
32
34
|
}
|
|
33
35
|
);
|
|
34
|
-
|
|
36
|
+
h.displayName = "OxAlertIcon";
|
|
35
37
|
export {
|
|
36
|
-
|
|
38
|
+
h as AlertIcon
|
|
37
39
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type AlertLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
2
2
|
/**
|
|
3
|
-
* AlertLink — the action link the board
|
|
4
|
-
* the
|
|
5
|
-
* as configuration; `href` and the rest arrive
|
|
3
|
+
* AlertLink — the action link, which the board puts in a row of its own under
|
|
4
|
+
* the description rather than beside it. A `link` prop on `Alert` would carry
|
|
5
|
+
* the text and the destination as configuration; `href` and the rest arrive
|
|
6
|
+
* here as native attributes.
|
|
6
7
|
*/
|
|
7
8
|
export declare const AlertLink: import('react').ForwardRefExoticComponent<AlertLinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
@@ -3,5 +3,7 @@ export interface ComboboxContentProps extends Omit<React.ComponentPropsWithoutRe
|
|
|
3
3
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
4
|
sideOffset?: number;
|
|
5
5
|
align?: 'start' | 'center' | 'end';
|
|
6
|
+
/** Called when the end of the list comes into view. */
|
|
7
|
+
onReachEnd?: () => void;
|
|
6
8
|
}
|
|
7
9
|
export declare const ComboboxContent: import('react').ForwardRefExoticComponent<ComboboxContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,78 +1,90 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
2
|
import * as c from "@radix-ui/react-popover";
|
|
3
|
-
import { Command as
|
|
4
|
-
import { forwardRef as
|
|
3
|
+
import { Command as P, CommandInput as S, CommandList as L } from "cmdk";
|
|
4
|
+
import { forwardRef as F, useRef as j, useState as A } from "react";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { useComboboxContext as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
6
|
+
import { useComboboxContext as D } from "./context.js";
|
|
7
|
+
import { useReachEnd as I } from "./useReachEnd.js";
|
|
8
|
+
import { Surface as O } from "../../../internal/Surface/Surface.js";
|
|
9
|
+
import { ListboxViewport as R } from "../../../internal/Listbox/ListboxViewport.js";
|
|
10
|
+
import { Scrollbar as k } from "../../../Layout/Scrollbar/Scrollbar.js";
|
|
11
|
+
const w = 16, G = F(
|
|
11
12
|
({
|
|
12
|
-
children:
|
|
13
|
+
children: d,
|
|
13
14
|
side: b = "bottom",
|
|
14
|
-
sideOffset:
|
|
15
|
-
align:
|
|
16
|
-
onInteractOutside:
|
|
17
|
-
onEscapeKeyDown:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
sideOffset: p = 4,
|
|
16
|
+
align: x = "start",
|
|
17
|
+
onInteractOutside: e,
|
|
18
|
+
onEscapeKeyDown: m,
|
|
19
|
+
onReachEnd: a,
|
|
20
|
+
...f
|
|
21
|
+
}, u) => {
|
|
22
|
+
const { search: s, cancelOpenEdit: h, skipFilter: C } = D(), i = j(null), [v, N] = A(null);
|
|
23
|
+
return I(i, v, a), /* @__PURE__ */ r(c.Portal, { children: /* @__PURE__ */ r(
|
|
22
24
|
c.Content,
|
|
23
25
|
{
|
|
24
|
-
ref:
|
|
26
|
+
ref: u,
|
|
25
27
|
asChild: !0,
|
|
26
28
|
"data-slot": "combobox-content",
|
|
27
29
|
side: b,
|
|
28
|
-
sideOffset:
|
|
29
|
-
collisionPadding:
|
|
30
|
-
align:
|
|
30
|
+
sideOffset: p,
|
|
31
|
+
collisionPadding: w,
|
|
32
|
+
align: x,
|
|
31
33
|
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
32
34
|
onInteractOutside: (o) => {
|
|
33
|
-
var
|
|
35
|
+
var n;
|
|
34
36
|
const t = o.target;
|
|
35
|
-
(
|
|
37
|
+
(n = t == null ? void 0 : t.closest) != null && n.call(t, '[data-slot="combobox"]') && o.preventDefault(), e == null || e(o);
|
|
36
38
|
},
|
|
37
39
|
onEscapeKeyDown: (o) => {
|
|
38
|
-
|
|
40
|
+
h() && o.preventDefault(), m == null || m(o);
|
|
39
41
|
},
|
|
40
|
-
...
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
42
|
+
...f,
|
|
43
|
+
children: /* @__PURE__ */ l(O, { children: [
|
|
44
|
+
/* @__PURE__ */ l(
|
|
45
|
+
P,
|
|
44
46
|
{
|
|
45
47
|
shouldFilter: !C,
|
|
46
|
-
value:
|
|
48
|
+
value: s,
|
|
47
49
|
className: "ox-combobox-command",
|
|
48
50
|
children: [
|
|
49
51
|
/* @__PURE__ */ r(
|
|
50
|
-
|
|
52
|
+
S,
|
|
51
53
|
{
|
|
52
|
-
value:
|
|
54
|
+
value: s,
|
|
53
55
|
"aria-hidden": !0,
|
|
54
56
|
tabIndex: -1,
|
|
55
57
|
className: "ox-combobox-hidden-input"
|
|
56
58
|
}
|
|
57
59
|
),
|
|
58
|
-
/* @__PURE__ */ r(
|
|
59
|
-
|
|
60
|
+
/* @__PURE__ */ r(L, { asChild: !0, children: /* @__PURE__ */ l(
|
|
61
|
+
R,
|
|
60
62
|
{
|
|
61
|
-
ref:
|
|
63
|
+
ref: i,
|
|
62
64
|
className: "ox-combobox-viewport",
|
|
63
|
-
children:
|
|
65
|
+
children: [
|
|
66
|
+
d,
|
|
67
|
+
a && /* @__PURE__ */ r(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
ref: N,
|
|
71
|
+
className: "ox-combobox-reach-end",
|
|
72
|
+
"aria-hidden": !0
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
]
|
|
64
76
|
}
|
|
65
77
|
) })
|
|
66
78
|
]
|
|
67
79
|
}
|
|
68
80
|
),
|
|
69
|
-
/* @__PURE__ */ r(
|
|
81
|
+
/* @__PURE__ */ r(k, { port: i, dataTestid: "combobox-scrollbar" })
|
|
70
82
|
] })
|
|
71
83
|
}
|
|
72
84
|
) });
|
|
73
85
|
}
|
|
74
86
|
);
|
|
75
|
-
|
|
87
|
+
G.displayName = "OxComboboxContent";
|
|
76
88
|
export {
|
|
77
|
-
|
|
89
|
+
G as ComboboxContent
|
|
78
90
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Reports that the end of a scrolling list has come into view, once per
|
|
4
|
+
* arrival.
|
|
5
|
+
*
|
|
6
|
+
* An `IntersectionObserver` and not a scroll listener because of the re-arm: a
|
|
7
|
+
* listener has to be disarmed after firing or it fires on every frame the user
|
|
8
|
+
* sits at the bottom, and then something has to decide when to arm it again.
|
|
9
|
+
* The observer re-fires on the transition for free.
|
|
10
|
+
*
|
|
11
|
+
* The sentinel arrives as an element and the port as a ref, which is the one
|
|
12
|
+
* place this diverges from the Vue composable. It has to: the list mounts when
|
|
13
|
+
* it opens, long after this hook first runs, and a ref filling in is not a
|
|
14
|
+
* render — so a hook waiting on `sentinel.current` waits for ever. A callback
|
|
15
|
+
* ref behind state is what turns the element arriving into something the effect
|
|
16
|
+
* can hang off. By the time it has, `port.current` is set too: both land in the
|
|
17
|
+
* same commit.
|
|
18
|
+
*
|
|
19
|
+
* @param port The scrolling element, which is also the observer's root.
|
|
20
|
+
* @param sentinel An empty element at the end of the list, inside `port`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useReachEnd(port: RefObject<HTMLElement | null>, sentinel: HTMLElement | null, reached: (() => void) | undefined): void;
|