@namroodinc/liquid-editorial 0.6.4 → 0.6.6
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/README.md +81 -1
- package/UPGRADING.md +160 -0
- package/dist/chunks/{Avatar-BTKqaJLP.cjs → Avatar-B_2lI7fS.cjs} +2 -2
- package/dist/chunks/{Avatar-BTKqaJLP.cjs.map → Avatar-B_2lI7fS.cjs.map} +1 -1
- package/dist/chunks/{Avatar-C1q2AUD-.js → Avatar-DdFEOumt.js} +3 -3
- package/dist/chunks/{Avatar-C1q2AUD-.js.map → Avatar-DdFEOumt.js.map} +1 -1
- package/dist/chunks/{Board-z688-51u.js → Board-B8wK079I.js} +2 -2
- package/dist/chunks/{Board-z688-51u.js.map → Board-B8wK079I.js.map} +1 -1
- package/dist/chunks/{Board-CUt4j2-8.cjs → Board-CMf5Azt0.cjs} +2 -2
- package/dist/chunks/{Board-CUt4j2-8.cjs.map → Board-CMf5Azt0.cjs.map} +1 -1
- package/dist/chunks/{ColourField-BwDb7ydB.js → ColourField-DC6cLb9h.js} +7 -3
- package/dist/chunks/ColourField-DC6cLb9h.js.map +1 -0
- package/dist/chunks/ColourField-NnFxLEsh.cjs +2 -0
- package/dist/chunks/ColourField-NnFxLEsh.cjs.map +1 -0
- package/dist/chunks/DatePicker-01sor8iD.cjs +2 -0
- package/dist/chunks/DatePicker-01sor8iD.cjs.map +1 -0
- package/dist/chunks/{DatePicker-C1zcScC3.js → DatePicker-DJAqXUDJ.js} +2 -2
- package/dist/chunks/DatePicker-DJAqXUDJ.js.map +1 -0
- package/dist/chunks/EntryPicker-CR8Phuzl.js +180 -0
- package/dist/chunks/EntryPicker-CR8Phuzl.js.map +1 -0
- package/dist/chunks/EntryPicker-D7JIgx23.cjs +2 -0
- package/dist/chunks/EntryPicker-D7JIgx23.cjs.map +1 -0
- package/dist/chunks/{FormEditor-C4PJu7ZF.js → FormEditor-BSfxVqLn.js} +192 -146
- package/dist/chunks/FormEditor-BSfxVqLn.js.map +1 -0
- package/dist/chunks/FormEditor-DNcSAnRF.cjs +2 -0
- package/dist/chunks/FormEditor-DNcSAnRF.cjs.map +1 -0
- package/dist/chunks/Message-CaX8Y1Xb.js +74 -0
- package/dist/chunks/Message-CaX8Y1Xb.js.map +1 -0
- package/dist/chunks/Message-DU31JAb3.cjs +2 -0
- package/dist/chunks/Message-DU31JAb3.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-DEJ-u-ZR.js → RichTextEditor-CNkwWist.js} +2 -2
- package/dist/chunks/{RichTextEditor-DEJ-u-ZR.js.map → RichTextEditor-CNkwWist.js.map} +1 -1
- package/dist/chunks/{RichTextEditor-Ddk7qaqg.cjs → RichTextEditor-DAnjElUO.cjs} +2 -2
- package/dist/chunks/{RichTextEditor-Ddk7qaqg.cjs.map → RichTextEditor-DAnjElUO.cjs.map} +1 -1
- package/dist/chunks/context-BONPXF-V.cjs.map +1 -1
- package/dist/chunks/context-CXvOl4Kt.js.map +1 -1
- package/dist/chunks/frame-BBVQTBcX.cjs +2 -0
- package/dist/chunks/frame-BBVQTBcX.cjs.map +1 -0
- package/dist/chunks/frame-De6IuTQz.js +189 -0
- package/dist/chunks/frame-De6IuTQz.js.map +1 -0
- package/dist/chunks/group-Bj9ZKc0R.cjs +2 -0
- package/dist/chunks/group-Bj9ZKc0R.cjs.map +1 -0
- package/dist/chunks/group-Ckz4Xya-.js +34 -0
- package/dist/chunks/group-Ckz4Xya-.js.map +1 -0
- package/dist/chunks/limit-BX6-o1a2.cjs +2 -0
- package/dist/chunks/limit-BX6-o1a2.cjs.map +1 -0
- package/dist/chunks/limit-ChteDN4T.js +18 -0
- package/dist/chunks/limit-ChteDN4T.js.map +1 -0
- package/dist/chunks/mergeRefs-C6_5pADN.js +19 -0
- package/dist/chunks/mergeRefs-C6_5pADN.js.map +1 -0
- package/dist/chunks/mergeRefs-CZ-SArlE.cjs +2 -0
- package/dist/chunks/mergeRefs-CZ-SArlE.cjs.map +1 -0
- package/dist/chunks/useLimit-BOmHKdJE.js +73 -0
- package/dist/chunks/useLimit-BOmHKdJE.js.map +1 -0
- package/dist/chunks/useLimit-DXe_VmYl.cjs +2 -0
- package/dist/chunks/useLimit-DXe_VmYl.cjs.map +1 -0
- package/dist/chunks/{useTooltip-D6cJji8v.js → useTooltip-C5gvEoYk.js} +2 -1
- package/dist/chunks/{useTooltip-D6cJji8v.js.map → useTooltip-C5gvEoYk.js.map} +1 -1
- package/dist/chunks/{useTooltip-CCf79zE9.cjs → useTooltip-bTE_a2Xn.cjs} +2 -2
- package/dist/chunks/{useTooltip-CCf79zE9.cjs.map → useTooltip-bTE_a2Xn.cjs.map} +1 -1
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Banner/index.cjs +2 -0
- package/dist/components/Banner/index.cjs.map +1 -0
- package/dist/components/Banner/index.d.cts +6 -0
- package/dist/components/Banner/index.d.cts.map +1 -0
- package/dist/components/Banner/index.d.ts +6 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +18 -0
- package/dist/components/Banner/index.js.map +1 -0
- package/dist/components/Banner/style.css +6 -0
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.js +6 -2
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.js +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -2
- package/dist/components/EntryPicker/index.d.cts.map +1 -1
- package/dist/components/EntryPicker/index.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.js +1 -171
- package/dist/components/EntryPicker/limit.d.cts +8 -0
- package/dist/components/EntryPicker/limit.d.cts.map +1 -0
- package/dist/components/EntryPicker/limit.d.ts +8 -0
- package/dist/components/EntryPicker/limit.d.ts.map +1 -0
- package/dist/components/Field/context.d.cts +6 -0
- package/dist/components/Field/context.d.cts.map +1 -1
- package/dist/components/Field/context.d.ts +6 -0
- package/dist/components/Field/context.d.ts.map +1 -1
- package/dist/components/Field/frame.d.cts +1 -1
- package/dist/components/Field/frame.d.cts.map +1 -1
- package/dist/components/Field/frame.d.ts +1 -1
- package/dist/components/Field/frame.d.ts.map +1 -1
- package/dist/components/Field/group.d.cts +1 -1
- package/dist/components/Field/group.d.cts.map +1 -1
- package/dist/components/Field/group.d.ts +1 -1
- package/dist/components/Field/group.d.ts.map +1 -1
- package/dist/components/Field/header.d.cts +12 -0
- package/dist/components/Field/header.d.cts.map +1 -0
- package/dist/components/Field/header.d.ts +12 -0
- package/dist/components/Field/header.d.ts.map +1 -0
- package/dist/components/Field/index.cjs +1 -1
- package/dist/components/Field/index.cjs.map +1 -1
- package/dist/components/Field/index.d.cts +1 -1
- package/dist/components/Field/index.d.cts.map +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/Field/index.d.ts.map +1 -1
- package/dist/components/Field/index.js +1 -1
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/Field/limit-reading.d.cts +12 -0
- package/dist/components/Field/limit-reading.d.cts.map +1 -0
- package/dist/components/Field/limit-reading.d.ts +12 -0
- package/dist/components/Field/limit-reading.d.ts.map +1 -0
- package/dist/components/Field/limit.d.cts +8 -0
- package/dist/components/Field/limit.d.cts.map +1 -0
- package/dist/components/Field/limit.d.ts +8 -0
- package/dist/components/Field/limit.d.ts.map +1 -0
- package/dist/components/Field/style.css +77 -0
- package/dist/components/Field/types.d.cts +12 -1
- package/dist/components/Field/types.d.cts.map +1 -1
- package/dist/components/Field/types.d.ts +12 -1
- package/dist/components/Field/types.d.ts.map +1 -1
- package/dist/components/Field/useLimit.d.cts +18 -0
- package/dist/components/Field/useLimit.d.cts.map +1 -0
- package/dist/components/Field/useLimit.d.ts +18 -0
- package/dist/components/Field/useLimit.d.ts.map +1 -0
- package/dist/components/FormEditor/README.md +62 -0
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/model.d.cts +21 -8
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +21 -8
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.js +6 -2
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.js +1 -1
- package/dist/components/Popover/style.css +2 -1
- package/dist/components/Popover/useTooltip.d.cts.map +1 -1
- package/dist/components/Popover/useTooltip.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.cjs.map +1 -1
- package/dist/components/SearchField/index.d.cts.map +1 -1
- package/dist/components/SearchField/index.d.ts.map +1 -1
- package/dist/components/SearchField/index.js +27 -22
- package/dist/components/SearchField/index.js.map +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.cjs.map +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/TagsInput/index.cjs +1 -1
- package/dist/components/TagsInput/index.cjs.map +1 -1
- package/dist/components/TagsInput/index.d.cts.map +1 -1
- package/dist/components/TagsInput/index.d.ts.map +1 -1
- package/dist/components/TagsInput/index.js +36 -30
- package/dist/components/TagsInput/index.js.map +1 -1
- package/dist/components/TextField/index.cjs +1 -1
- package/dist/components/TextField/index.cjs.map +1 -1
- package/dist/components/TextField/index.d.cts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/components/TextField/index.js +35 -20
- package/dist/components/TextField/index.js.map +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +2 -2
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +35 -60
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/Toast/style.css +5 -50
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -16
- package/dist/internal/Message.d.cts +23 -0
- package/dist/internal/Message.d.cts.map +1 -0
- package/dist/internal/Message.d.ts +23 -0
- package/dist/internal/Message.d.ts.map +1 -0
- package/dist/internal/mergeRefs.d.cts +5 -1
- package/dist/internal/mergeRefs.d.cts.map +1 -1
- package/dist/internal/mergeRefs.d.ts +5 -1
- package/dist/internal/mergeRefs.d.ts.map +1 -1
- package/dist/message.css +122 -0
- package/dist/styles.css +2 -0
- package/dist/tokens.css +36 -12
- package/package.json +1 -1
- package/dist/chunks/ColourField-Bk5O632x.cjs +0 -2
- package/dist/chunks/ColourField-Bk5O632x.cjs.map +0 -1
- package/dist/chunks/ColourField-BwDb7ydB.js.map +0 -1
- package/dist/chunks/DatePicker-BVsloqVY.cjs +0 -2
- package/dist/chunks/DatePicker-BVsloqVY.cjs.map +0 -1
- package/dist/chunks/DatePicker-C1zcScC3.js.map +0 -1
- package/dist/chunks/FormEditor-C4PJu7ZF.js.map +0 -1
- package/dist/chunks/FormEditor-Dd44EMp_.cjs +0 -2
- package/dist/chunks/FormEditor-Dd44EMp_.cjs.map +0 -1
- package/dist/chunks/frame-Bs_jaQRw.js +0 -70
- package/dist/chunks/frame-Bs_jaQRw.js.map +0 -1
- package/dist/chunks/frame-CNxvbg0D.cjs +0 -2
- package/dist/chunks/frame-CNxvbg0D.cjs.map +0 -1
- package/dist/chunks/group-CzbacuAY.js +0 -29
- package/dist/chunks/group-CzbacuAY.js.map +0 -1
- package/dist/chunks/group-pKDQtq-9.cjs +0 -2
- package/dist/chunks/group-pKDQtq-9.cjs.map +0 -1
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs +0 -2
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs.map +0 -1
- package/dist/chunks/mergeRefs-DGM402mE.js +0 -10
- package/dist/chunks/mergeRefs-DGM402mE.js.map +0 -1
- package/dist/components/EntryPicker/index.cjs.map +0 -1
- package/dist/components/EntryPicker/index.js.map +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { t as e } from "./context-CXvOl4Kt.js";
|
|
2
|
+
import { Badge as t } from "../components/Badge/index.js";
|
|
3
|
+
import { i as n, n as r, r as i, t as a } from "./limit-ChteDN4T.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { useId as o, useMemo as s, useState as c } from "react";
|
|
6
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/Field/header.tsx
|
|
8
|
+
function f({ label: e, count: n, isRequired: r, isGroup: i, id: a, labelId: o, hasLimit: s, children: c }) {
|
|
9
|
+
let f = i ? "legend" : "label", p = /* @__PURE__ */ d(l, { children: [
|
|
10
|
+
e,
|
|
11
|
+
n !== void 0 && /* @__PURE__ */ u(t, {
|
|
12
|
+
className: "ds-field__count",
|
|
13
|
+
shape: "count",
|
|
14
|
+
isCountExact: !0,
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
children: n
|
|
17
|
+
}),
|
|
18
|
+
r && /* @__PURE__ */ u("span", {
|
|
19
|
+
className: "ds-field__required",
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
children: "*"
|
|
22
|
+
})
|
|
23
|
+
] }), m = /* @__PURE__ */ u(f, {
|
|
24
|
+
id: o,
|
|
25
|
+
className: "ds-field__label",
|
|
26
|
+
htmlFor: i ? void 0 : a,
|
|
27
|
+
children: p
|
|
28
|
+
});
|
|
29
|
+
return s ? i ? /* @__PURE__ */ d("legend", {
|
|
30
|
+
className: "ds-field__header",
|
|
31
|
+
children: [/* @__PURE__ */ u("span", {
|
|
32
|
+
id: o,
|
|
33
|
+
className: "ds-field__label",
|
|
34
|
+
children: p
|
|
35
|
+
}), c]
|
|
36
|
+
}) : /* @__PURE__ */ d("div", {
|
|
37
|
+
className: "ds-field__header",
|
|
38
|
+
children: [m, c]
|
|
39
|
+
}) : m;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/components/Field/limit-reading.tsx
|
|
43
|
+
function p({ count: e, max: t, id: n, limitDisplay: i = "used", showLimitRing: o = !0 }) {
|
|
44
|
+
let s = Math.min(1, e / t), c = {
|
|
45
|
+
"--limit-mix": `${(s <= .6 ? s / .6 : (s - .6) / .4) * 100}%`,
|
|
46
|
+
"--limit-from": s <= .6 ? "var(--color-success)" : "var(--color-warning)",
|
|
47
|
+
"--limit-to": s <= .6 ? "var(--color-warning)" : "var(--color-danger)"
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ d("span", {
|
|
50
|
+
className: "ds-field__limit",
|
|
51
|
+
"data-tone": r({
|
|
52
|
+
count: e,
|
|
53
|
+
max: t
|
|
54
|
+
}),
|
|
55
|
+
style: c,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ u("span", {
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
children: i === "remaining" ? `${t - e} left` : `${e}/${t}`
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ u("span", {
|
|
62
|
+
id: n,
|
|
63
|
+
className: "ds-field__limit-description",
|
|
64
|
+
children: a({
|
|
65
|
+
count: e,
|
|
66
|
+
max: t
|
|
67
|
+
}, i)
|
|
68
|
+
}),
|
|
69
|
+
o && /* @__PURE__ */ d("svg", {
|
|
70
|
+
className: "ds-field__limit-ring",
|
|
71
|
+
width: "16",
|
|
72
|
+
height: "16",
|
|
73
|
+
viewBox: "0 0 16 16",
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
children: [/* @__PURE__ */ u("circle", {
|
|
76
|
+
cx: "8",
|
|
77
|
+
cy: "8",
|
|
78
|
+
r: "6"
|
|
79
|
+
}), /* @__PURE__ */ u("circle", {
|
|
80
|
+
className: "ds-field__limit-progress",
|
|
81
|
+
cx: "8",
|
|
82
|
+
cy: "8",
|
|
83
|
+
r: "6",
|
|
84
|
+
pathLength: "1",
|
|
85
|
+
strokeDasharray: s >= 1 ? "none" : `${s} 1`
|
|
86
|
+
})]
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
var m = {
|
|
92
|
+
warning: 1,
|
|
93
|
+
danger: 2
|
|
94
|
+
};
|
|
95
|
+
function h({ limitDisplay: e, ...t }) {
|
|
96
|
+
let n = r(t), i = n ? m[n] : 0, [o, s] = c({
|
|
97
|
+
level: i,
|
|
98
|
+
text: ""
|
|
99
|
+
});
|
|
100
|
+
return o.level !== i && s({
|
|
101
|
+
level: i,
|
|
102
|
+
text: i > o.level ? a(t, e) : ""
|
|
103
|
+
}), /* @__PURE__ */ u("span", {
|
|
104
|
+
className: "ds-field__limit-announcement",
|
|
105
|
+
"aria-live": "polite",
|
|
106
|
+
"aria-atomic": "true",
|
|
107
|
+
children: o.text
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/components/Field/frame.tsx
|
|
112
|
+
function g({ label: t, hint: r, error: a, isRequired: l, count: m, limit: g, limitDisplay: b, limitVisibility: x, showLimitRing: S, isGroup: C = !1, children: w, className: T, groupBinding: E }) {
|
|
113
|
+
let D = o(), O = v(r, a, D), k = `${D}-label`, A = `${D}-limit`, j = C ? "fieldset" : "div", [M, N] = c(), [P, F] = c(() => /* @__PURE__ */ new Map()), I = g !== void 0, L = s(() => ({
|
|
114
|
+
labelId: k,
|
|
115
|
+
isGroup: C,
|
|
116
|
+
reportCount: N,
|
|
117
|
+
reportLimit: I ? void 0 : (e, t) => F((n) => _(n, e, t))
|
|
118
|
+
}), [
|
|
119
|
+
k,
|
|
120
|
+
C,
|
|
121
|
+
I
|
|
122
|
+
]), R = m ?? M, [z] = P.values(), B = g ?? z, V = n(B, x), H = [O?.id, V ? A : void 0].filter(Boolean).join(" ") || void 0, U = V && /* @__PURE__ */ u(p, {
|
|
123
|
+
...V,
|
|
124
|
+
id: A,
|
|
125
|
+
limitDisplay: b,
|
|
126
|
+
showLimitRing: S
|
|
127
|
+
}), W = i(B) ? B : void 0, G = W !== void 0;
|
|
128
|
+
return /* @__PURE__ */ d(j, {
|
|
129
|
+
...C ? y(E, H, !!a, G ? k : void 0) : void 0,
|
|
130
|
+
className: ["ds-field", T].filter(Boolean).join(" "),
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ u(f, {
|
|
133
|
+
label: t,
|
|
134
|
+
count: R,
|
|
135
|
+
isRequired: l,
|
|
136
|
+
isGroup: C,
|
|
137
|
+
id: D,
|
|
138
|
+
labelId: k,
|
|
139
|
+
hasLimit: G,
|
|
140
|
+
children: U
|
|
141
|
+
}),
|
|
142
|
+
W && /* @__PURE__ */ u(h, {
|
|
143
|
+
...W,
|
|
144
|
+
limitDisplay: b
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ u(e.Provider, {
|
|
147
|
+
value: L,
|
|
148
|
+
children: w({
|
|
149
|
+
id: D,
|
|
150
|
+
"aria-describedby": H,
|
|
151
|
+
"aria-labelledby": k,
|
|
152
|
+
"aria-invalid": a ? !0 : void 0,
|
|
153
|
+
required: l
|
|
154
|
+
})
|
|
155
|
+
}),
|
|
156
|
+
O && /* @__PURE__ */ u("span", { ...O })
|
|
157
|
+
]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function _(e, t, n) {
|
|
161
|
+
let r = e.get(t);
|
|
162
|
+
if (n ? r?.count === n.count && r.max === n.max : !r) return e;
|
|
163
|
+
let i = new Map(e);
|
|
164
|
+
return n ? i.set(t, n) : i.delete(t), i;
|
|
165
|
+
}
|
|
166
|
+
function v(e, t, n) {
|
|
167
|
+
if (t) return {
|
|
168
|
+
id: `${n}-error`,
|
|
169
|
+
className: "ds-field__error",
|
|
170
|
+
children: t
|
|
171
|
+
};
|
|
172
|
+
if (e) return {
|
|
173
|
+
id: `${n}-hint`,
|
|
174
|
+
className: "ds-field__hint",
|
|
175
|
+
children: e
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function y(e, t, n, r) {
|
|
179
|
+
return {
|
|
180
|
+
...e,
|
|
181
|
+
"aria-labelledby": e?.["aria-labelledby"] || (e?.["aria-label"] ? void 0 : r),
|
|
182
|
+
"aria-describedby": [e?.["aria-describedby"], t].filter(Boolean).join(" ") || void 0,
|
|
183
|
+
"aria-invalid": n || e?.["aria-invalid"]
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { g as t };
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=frame-De6IuTQz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-De6IuTQz.js","names":["_Fragment","FieldFrameContext","visibleLimit","limitTone","usableLimit","limitDescription","Fragment$1","FieldHeader","Label","isGroup","contents","label","count","Badge","isRequired","labelElement","labelId","id","hasLimit","children","LimitReading","ratio","max","style","limitDisplay","showLimitRing","levels","LimitAnnouncer","limit","tone","level","announcement","setAnnouncement","useState","FieldFrame","useId","message","fieldMessage","hint","error","limitId","Wrapper","reportedCount","reportCount","reports","setReports","hasExplicitLimit","frame","useMemo","withReport","current","key","next","shownCount","reportedLimit","currentLimit","shownLimit","limitVisibility","describedBy","reading","activeLimit","groupAttributes","groupBinding","className","binding","limitLabelId","description","invalid"],"sources":["../../src/components/Field/header.tsx","../../src/components/Field/limit-reading.tsx","../../src/components/Field/frame.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Badge } from \"../Badge\";\nimport type { FieldProps } from \"./types\";\n\ninterface FieldHeaderProps extends Pick<FieldProps, \"label\" | \"count\" | \"isRequired\" | \"isGroup\"> {\n id: string;\n labelId: string;\n hasLimit: boolean;\n children: ReactNode;\n}\n\n/** Keep the usage reading outside the label's name and the legend directly in its fieldset. */\nexport function FieldHeader({\n label,\n count,\n isRequired,\n isGroup,\n id,\n labelId,\n hasLimit,\n children,\n}: FieldHeaderProps) {\n const Label = isGroup ? \"legend\" : \"label\";\n const contents = (\n <>\n {label}\n {count !== undefined && (\n <Badge\n className=\"ds-field__count\"\n shape=\"count\"\n isCountExact\n aria-hidden=\"true\"\n >\n {count}\n </Badge>\n )}\n {isRequired && (\n <span\n className=\"ds-field__required\"\n aria-hidden=\"true\"\n >\n *\n </span>\n )}\n </>\n );\n const labelElement = (\n <Label\n id={labelId}\n className=\"ds-field__label\"\n htmlFor={isGroup ? undefined : id}\n >\n {contents}\n </Label>\n );\n if (!hasLimit) {\n return labelElement;\n }\n if (isGroup) {\n return (\n <legend className=\"ds-field__header\">\n <span\n id={labelId}\n className=\"ds-field__label\"\n >\n {contents}\n </span>\n {children}\n </legend>\n );\n }\n return (\n <div className=\"ds-field__header\">\n {labelElement}\n {children}\n </div>\n );\n}\n","import { useState, type CSSProperties } from \"react\";\nimport { limitDescription, limitTone } from \"./limit\";\nimport type { FieldLimit, FieldLimitOptions } from \"./types\";\n\nexport function LimitReading({\n count,\n max,\n id,\n limitDisplay = \"used\",\n showLimitRing = true,\n}: FieldLimit & FieldLimitOptions & { id: string }) {\n const ratio = Math.min(1, count / max);\n const progress = ratio <= 0.6 ? ratio / 0.6 : (ratio - 0.6) / 0.4;\n const style = {\n \"--limit-mix\": `${progress * 100}%`,\n \"--limit-from\": ratio <= 0.6 ? \"var(--color-success)\" : \"var(--color-warning)\",\n \"--limit-to\": ratio <= 0.6 ? \"var(--color-warning)\" : \"var(--color-danger)\",\n } as CSSProperties;\n return (\n <span\n className=\"ds-field__limit\"\n data-tone={limitTone({ count, max })}\n style={style}\n >\n <span aria-hidden=\"true\">\n {limitDisplay === \"remaining\" ? `${max - count} left` : `${count}/${max}`}\n </span>\n <span\n id={id}\n className=\"ds-field__limit-description\"\n >\n {limitDescription({ count, max }, limitDisplay)}\n </span>\n {showLimitRing && (\n <svg\n className=\"ds-field__limit-ring\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <circle\n cx=\"8\"\n cy=\"8\"\n r=\"6\"\n />\n <circle\n className=\"ds-field__limit-progress\"\n cx=\"8\"\n cy=\"8\"\n r=\"6\"\n pathLength=\"1\"\n // A continuous stroke avoids a dash seam at the circle's closing point.\n strokeDasharray={ratio >= 1 ? \"none\" : `${ratio} 1`}\n />\n </svg>\n )}\n </span>\n );\n}\n\nconst levels = { warning: 1, danger: 2 } as const;\n\n/**\n * A polite region that exists for as long as the limit does, so it is already\n * registered when usage first crosses into warning or danger. It speaks only on\n * those crossings, not on every keystroke, and falls silent below them so a\n * later crossing is announced again. Loaded values are described, not announced.\n */\nexport function LimitAnnouncer({\n limitDisplay,\n ...limit\n}: FieldLimit & Pick<FieldLimitOptions, \"limitDisplay\">) {\n const tone = limitTone(limit);\n const level = tone ? levels[tone] : 0;\n const [announcement, setAnnouncement] = useState({ level, text: \"\" });\n if (announcement.level !== level) {\n setAnnouncement({\n level,\n text: level > announcement.level ? limitDescription(limit, limitDisplay) : \"\",\n });\n }\n return (\n <span\n className=\"ds-field__limit-announcement\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {announcement.text}\n </span>\n );\n}\n","import { useId, useMemo, useState } from \"react\";\nimport { FieldFrameContext, type FieldFrameContextValue } from \"./context\";\nimport { FieldHeader } from \"./header\";\nimport { LimitAnnouncer, LimitReading } from \"./limit-reading\";\nimport { usableLimit, visibleLimit } from \"./limit\";\nimport type { FieldBinding, FieldLimit, FieldProps } from \"./types\";\nimport \"./style.css\";\n\ninterface FieldFrameProps extends FieldProps {\n className?: string;\n groupBinding?: FieldBinding;\n}\n\ntype LimitReports = ReadonlyMap<string, FieldLimit>;\n\n/**\n * Shared label/legend, count, required marker and messages, including standalone\n * groups. A group's fieldset carries the description; bound controls don't repeat it.\n */\nexport function FieldFrame({\n label,\n hint,\n error,\n isRequired,\n count,\n limit,\n limitDisplay,\n limitVisibility,\n showLimitRing,\n isGroup = false,\n children,\n className,\n groupBinding,\n}: FieldFrameProps) {\n const id = useId();\n const message = fieldMessage(hint, error, id);\n const labelId = `${id}-label`;\n const limitId = `${id}-limit`;\n const Wrapper = isGroup ? \"fieldset\" : \"div\";\n const [reportedCount, reportCount] = useState<number>();\n const [reports, setReports] = useState<LimitReports>(() => new Map());\n const hasExplicitLimit = limit !== undefined;\n const frame = useMemo<FieldFrameContextValue>(\n () => ({\n labelId,\n isGroup,\n reportCount,\n reportLimit: hasExplicitLimit\n ? undefined\n : (key, next) => setReports((current) => withReport(current, key, next)),\n }),\n [labelId, isGroup, hasExplicitLimit],\n );\n const shownCount = count ?? reportedCount;\n // The first bound control to report keeps the reading while others come and go.\n const [reportedLimit] = reports.values();\n const currentLimit = limit ?? reportedLimit;\n const shownLimit = visibleLimit(currentLimit, limitVisibility);\n const describedBy =\n [message?.id, shownLimit ? limitId : undefined].filter(Boolean).join(\" \") || undefined;\n const reading = shownLimit && (\n <LimitReading\n {...shownLimit}\n id={limitId}\n limitDisplay={limitDisplay}\n showLimitRing={showLimitRing}\n />\n );\n const activeLimit = usableLimit(currentLimit) ? currentLimit : undefined;\n const hasLimit = activeLimit !== undefined;\n return (\n <Wrapper\n {...(isGroup\n ? groupAttributes(groupBinding, describedBy, Boolean(error), hasLimit ? labelId : undefined)\n : undefined)}\n className={[\"ds-field\", className].filter(Boolean).join(\" \")}\n >\n <FieldHeader\n label={label}\n count={shownCount}\n isRequired={isRequired}\n isGroup={isGroup}\n id={id}\n labelId={labelId}\n hasLimit={hasLimit}\n >\n {reading}\n </FieldHeader>\n {activeLimit && (\n <LimitAnnouncer\n {...activeLimit}\n limitDisplay={limitDisplay}\n />\n )}\n <FieldFrameContext.Provider value={frame}>\n {children({\n id,\n \"aria-describedby\": describedBy,\n \"aria-labelledby\": labelId,\n \"aria-invalid\": error ? true : undefined,\n required: isRequired,\n })}\n </FieldFrameContext.Provider>\n {message && <span {...message} />}\n </Wrapper>\n );\n}\n\n/** Updates keep a report's position, so one control never displaces another. */\nfunction withReport(reports: LimitReports, key: string, limit: FieldLimit | undefined) {\n const current = reports.get(key);\n if (limit ? current?.count === limit.count && current.max === limit.max : !current) {\n return reports;\n }\n const next = new Map(reports);\n if (limit) {\n next.set(key, limit);\n } else {\n next.delete(key);\n }\n return next;\n}\n\nfunction fieldMessage(hint: FieldProps[\"hint\"], error: FieldProps[\"error\"], id: string) {\n if (error) {\n return { id: `${id}-error`, className: \"ds-field__error\", children: error };\n }\n if (hint) {\n return { id: `${id}-hint`, className: \"ds-field__hint\", children: hint };\n }\n}\n\n/**\n * A limited legend also holds the counter, so `limitLabelId` names the group by\n * its label text alone. A consumer's own name for the group always wins.\n */\nfunction groupAttributes(\n binding: FieldBinding | undefined,\n description: string | undefined,\n invalid: boolean,\n limitLabelId: string | undefined,\n) {\n return {\n ...binding,\n \"aria-labelledby\":\n binding?.[\"aria-labelledby\"] || (binding?.[\"aria-label\"] ? undefined : limitLabelId),\n \"aria-describedby\":\n [binding?.[\"aria-describedby\"], description].filter(Boolean).join(\" \") || undefined,\n \"aria-invalid\": invalid || binding?.[\"aria-invalid\"],\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./frame-BBVQTBcX.cjs"),t=require("./useLimit-DXe_VmYl.cjs"),n=require("./binding-tMjrUzkU.cjs");let r=require("react"),i=require("react/jsx-runtime");function a({label:a,hint:o,error:s,isRequired:c,count:l,limit:u,limitDisplay:d,limitVisibility:f,showLimitRing:p,children:m,className:h,...g}){let{frame:_,attributes:v}=n.r(g);return t.t(g,u),(0,r.useEffect)(()=>{if(_&&l!==void 0)return _.reportCount(l),()=>_.reportCount(void 0)},[_,l]),_?(0,i.jsx)(`div`,{...v,className:h,children:m}):(0,i.jsx)(e.t,{label:a,hint:o,error:s,isRequired:c,count:l,limit:u,limitDisplay:d,limitVisibility:f,showLimitRing:p,isGroup:!0,className:h,groupBinding:n.t(g),children:()=>m})}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
2
|
+
//# sourceMappingURL=group-Bj9ZKc0R.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-Bj9ZKc0R.cjs","names":["useGroupBinding","FieldFrame","fieldAttributes","require_frame","require_useLimit","require_binding","react","react_jsx_runtime","FieldGroup","binding","limit","frame","count","attributes","children"],"sources":["../../src/components/Field/group.tsx"],"sourcesContent":["import { useEffect, type ReactNode } from \"react\";\nimport { FieldFrame } from \"./frame\";\nimport { fieldAttributes, useGroupBinding } from \"./binding\";\nimport type { FieldBinding, FieldProps } from \"./types\";\nimport { useReportedLimit } from \"./useLimit\";\n\nexport interface FieldGroupProps extends FieldBinding, Omit<FieldProps, \"children\" | \"isGroup\"> {\n children: ReactNode;\n className?: string;\n}\n\n/**\n * Standalone groups render their own Field frame. Bound to an enclosing Field,\n * they render only their controls and report their count to its label.\n */\nexport function FieldGroup({\n label,\n hint,\n error,\n isRequired,\n count,\n limit,\n limitDisplay,\n limitVisibility,\n showLimitRing,\n children,\n className,\n ...binding\n}: FieldGroupProps) {\n const { frame, attributes } = useGroupBinding(binding);\n useReportedLimit(binding, limit);\n useEffect(() => {\n if (!frame || count === undefined) {\n return;\n }\n frame.reportCount(count);\n return () => frame.reportCount(undefined);\n }, [frame, count]);\n if (frame) {\n return (\n <div\n {...attributes}\n className={className}\n >\n {children}\n </div>\n );\n }\n return (\n <FieldFrame\n label={label}\n hint={hint}\n error={error}\n isRequired={isRequired}\n count={count}\n limit={limit}\n limitDisplay={limitDisplay}\n limitVisibility={limitVisibility}\n showLimitRing={showLimitRing}\n isGroup\n className={className}\n groupBinding={fieldAttributes(binding)}\n >\n {() => children}\n </FieldFrame>\n );\n}\n"],"mappings":"A,uKAeA,SAAgBQ,EAAW,CACzB,QACA,OACA,QACA,aACA,QACA,QACA,eACA,kBACA,gBACA,WACA,YACA,GAAGC,GACe,CAClB,GAAM,CAAE,QAAO,cAAeT,EAAAA,EAAgBS,CAAO,EAmBrD,OAlBAL,EAAA,EAAiBK,EAASC,CAAK,GAC/B,EAAAJ,EAAA,UAAA,KAAgB,CACd,GAAKK,GAASC,IAAU,IAAA,GAIxB,OADAD,EAAM,YAAYC,CAAK,MACVD,EAAM,YAAY,IAAA,EAAS,CAC1C,EAAG,CAACA,EAAOC,CAAK,CAAC,EACbD,GAEA,EAAAJ,EAAA,IAAA,CAAC,MAAD,CACE,GAAIM,EACO,YAEV,UACE,CAAA,GAIP,EAAAN,EAAA,IAAA,CAACN,EAAAA,EAAD,CACS,QACD,OACC,QACK,aACL,QACA,QACO,eACG,kBACF,gBACf,QAAA,GACW,YACX,aAAcC,EAAAA,EAAgBO,CAAO,EAE9B,aAAAK,CACG,CAAA,CAEhB,C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { t as e } from "./frame-De6IuTQz.js";
|
|
2
|
+
import { t } from "./useLimit-BOmHKdJE.js";
|
|
3
|
+
import { r as n, t as r } from "./binding-Bshy43sG.js";
|
|
4
|
+
import { useEffect as i } from "react";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Field/group.tsx
|
|
7
|
+
function o({ label: o, hint: s, error: c, isRequired: l, count: u, limit: d, limitDisplay: f, limitVisibility: p, showLimitRing: m, children: h, className: g, ..._ }) {
|
|
8
|
+
let { frame: v, attributes: y } = n(_);
|
|
9
|
+
return t(_, d), i(() => {
|
|
10
|
+
if (v && u !== void 0) return v.reportCount(u), () => v.reportCount(void 0);
|
|
11
|
+
}, [v, u]), v ? /* @__PURE__ */ a("div", {
|
|
12
|
+
...y,
|
|
13
|
+
className: g,
|
|
14
|
+
children: h
|
|
15
|
+
}) : /* @__PURE__ */ a(e, {
|
|
16
|
+
label: o,
|
|
17
|
+
hint: s,
|
|
18
|
+
error: c,
|
|
19
|
+
isRequired: l,
|
|
20
|
+
count: u,
|
|
21
|
+
limit: d,
|
|
22
|
+
limitDisplay: f,
|
|
23
|
+
limitVisibility: p,
|
|
24
|
+
showLimitRing: m,
|
|
25
|
+
isGroup: !0,
|
|
26
|
+
className: g,
|
|
27
|
+
groupBinding: r(_),
|
|
28
|
+
children: () => h
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { o as t };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=group-Ckz4Xya-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-Ckz4Xya-.js","names":["FieldFrame","useGroupBinding","fieldAttributes","FieldGroup","binding","useReportedLimit","limit","useEffect","frame","count","attributes","children"],"sources":["../../src/components/Field/group.tsx"],"sourcesContent":["import { useEffect, type ReactNode } from \"react\";\nimport { FieldFrame } from \"./frame\";\nimport { fieldAttributes, useGroupBinding } from \"./binding\";\nimport type { FieldBinding, FieldProps } from \"./types\";\nimport { useReportedLimit } from \"./useLimit\";\n\nexport interface FieldGroupProps extends FieldBinding, Omit<FieldProps, \"children\" | \"isGroup\"> {\n children: ReactNode;\n className?: string;\n}\n\n/**\n * Standalone groups render their own Field frame. Bound to an enclosing Field,\n * they render only their controls and report their count to its label.\n */\nexport function FieldGroup({\n label,\n hint,\n error,\n isRequired,\n count,\n limit,\n limitDisplay,\n limitVisibility,\n showLimitRing,\n children,\n className,\n ...binding\n}: FieldGroupProps) {\n const { frame, attributes } = useGroupBinding(binding);\n useReportedLimit(binding, limit);\n useEffect(() => {\n if (!frame || count === undefined) {\n return;\n }\n frame.reportCount(count);\n return () => frame.reportCount(undefined);\n }, [frame, count]);\n if (frame) {\n return (\n <div\n {...attributes}\n className={className}\n >\n {children}\n </div>\n );\n }\n return (\n <FieldFrame\n label={label}\n hint={hint}\n error={error}\n isRequired={isRequired}\n count={count}\n limit={limit}\n limitDisplay={limitDisplay}\n limitVisibility={limitVisibility}\n showLimitRing={showLimitRing}\n isGroup\n className={className}\n groupBinding={fieldAttributes(binding)}\n >\n {() => children}\n </FieldFrame>\n );\n}\n"],"mappings":";;;;;;AAeA,SAAgBG,EAAW,EACzB,UACA,SACA,UACA,eACA,UACA,UACA,iBACA,oBACA,kBACA,aACA,cACA,GAAGC,KACe;CAClB,IAAM,EAAE,UAAO,kBAAeH,EAAgBG,CAAO;CAmBrD,OAlBAC,EAAiBD,GAASE,CAAK,GAC/BC,QAAgB;EACd,IAAKC,KAASC,MAAU,KAAA,GAIxB,OADAD,EAAM,YAAYC,CAAK,SACVD,EAAM,YAAY,KAAA,CAAS;CAC1C,GAAG,CAACA,GAAOC,CAAK,CAAC,GACbD,IAEA,kBAAC,OAAD;EACE,GAAIE;EACO;EAEV;CACE,CAAA,IAIP,kBAACV,GAAD;EACS;EACD;EACC;EACK;EACL;EACA;EACO;EACG;EACF;EACf,SAAA;EACW;EACX,cAAcE,EAAgBE,CAAO;EAE9B,gBAAAO;CACG,CAAA;AAEhB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return!!(e&&Number.isFinite(e.max)&&e.max>0&&Number.isFinite(e.count)&&e.count>=0)}function t(t,n){return e(t)&&(n!==`nearLimit`||t.count/t.max>=.8)?t:void 0}function n({count:e,max:t}){let n=e/t;return n>=1?`danger`:n>=.85?`warning`:void 0}function r({count:e,max:t},n){return n===`remaining`?`${t-e} remaining`:`${e} of ${t} used`}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
2
|
+
//# sourceMappingURL=limit-BX6-o1a2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limit-BX6-o1a2.cjs","names":["usableLimit","limit","visibleLimit","visibility","limitTone","ratio","count","max","limitDescription","display"],"sources":["../../src/components/Field/limit.ts"],"sourcesContent":["import type { FieldLimit, FieldLimitOptions } from \"./types\";\n\n/** Keep invalid limits out of the presentation without changing input enforcement. */\nexport function usableLimit(limit: FieldLimit | undefined): limit is FieldLimit {\n return Boolean(\n limit &&\n Number.isFinite(limit.max) &&\n limit.max > 0 &&\n Number.isFinite(limit.count) &&\n limit.count >= 0,\n );\n}\n\nexport function visibleLimit(\n limit: FieldLimit | undefined,\n visibility: FieldLimitOptions[\"limitVisibility\"],\n) {\n return usableLimit(limit) && (visibility !== \"nearLimit\" || limit.count / limit.max >= 0.8)\n ? limit\n : undefined;\n}\n\n/** Warning from 85% usage, danger at and above the limit. */\nexport function limitTone({ count, max }: FieldLimit) {\n const ratio = count / max;\n return ratio >= 1 ? \"danger\" : ratio >= 0.85 ? \"warning\" : undefined;\n}\n\nexport function limitDescription(\n { count, max }: FieldLimit,\n display: FieldLimitOptions[\"limitDisplay\"],\n) {\n return display === \"remaining\" ? `${max - count} remaining` : `${count} of ${max} used`;\n}\n"],"mappings":"AAGA,SAAgBA,EAAY,EAAoD,CAC9E,MAAO,GACLC,GACA,OAAO,SAASA,EAAM,GAAG,GACzBA,EAAM,IAAM,GACZ,OAAO,SAASA,EAAM,KAAK,GAC3BA,EAAM,OAAS,EAEnB,CAEA,SAAgBC,EACd,EACA,EACA,CACA,OAAOF,EAAYC,CAAK,IAAME,IAAe,aAAeF,EAAM,MAAQA,EAAM,KAAO,IACnFA,EACA,IAAA,EACN,CAGA,SAAgBG,EAAU,CAAE,QAAO,OAAmB,CACpD,IAAMC,EAAQC,EAAQC,EACtB,OAAOF,GAAS,EAAI,SAAWA,GAAS,IAAO,UAAY,IAAA,EAC7D,CAEA,SAAgBG,EACd,CAAE,QAAO,OACT,EACA,CACA,OAAOC,IAAY,YAAc,GAAGF,EAAMD,EAAM,YAAc,GAAGA,EAAM,MAAMC,EAAI,MACnF,C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/components/Field/limit.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return !!(e && Number.isFinite(e.max) && e.max > 0 && Number.isFinite(e.count) && e.count >= 0);
|
|
4
|
+
}
|
|
5
|
+
function t(t, n) {
|
|
6
|
+
return e(t) && (n !== "nearLimit" || t.count / t.max >= .8) ? t : void 0;
|
|
7
|
+
}
|
|
8
|
+
function n({ count: e, max: t }) {
|
|
9
|
+
let n = e / t;
|
|
10
|
+
return n >= 1 ? "danger" : n >= .85 ? "warning" : void 0;
|
|
11
|
+
}
|
|
12
|
+
function r({ count: e, max: t }, n) {
|
|
13
|
+
return n === "remaining" ? `${t - e} remaining` : `${e} of ${t} used`;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { t as i, n, e as r, r as t };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=limit-ChteDN4T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limit-ChteDN4T.js","names":["usableLimit","limit","visibleLimit","visibility","limitTone","ratio","count","max","limitDescription","display"],"sources":["../../src/components/Field/limit.ts"],"sourcesContent":["import type { FieldLimit, FieldLimitOptions } from \"./types\";\n\n/** Keep invalid limits out of the presentation without changing input enforcement. */\nexport function usableLimit(limit: FieldLimit | undefined): limit is FieldLimit {\n return Boolean(\n limit &&\n Number.isFinite(limit.max) &&\n limit.max > 0 &&\n Number.isFinite(limit.count) &&\n limit.count >= 0,\n );\n}\n\nexport function visibleLimit(\n limit: FieldLimit | undefined,\n visibility: FieldLimitOptions[\"limitVisibility\"],\n) {\n return usableLimit(limit) && (visibility !== \"nearLimit\" || limit.count / limit.max >= 0.8)\n ? limit\n : undefined;\n}\n\n/** Warning from 85% usage, danger at and above the limit. */\nexport function limitTone({ count, max }: FieldLimit) {\n const ratio = count / max;\n return ratio >= 1 ? \"danger\" : ratio >= 0.85 ? \"warning\" : undefined;\n}\n\nexport function limitDescription(\n { count, max }: FieldLimit,\n display: FieldLimitOptions[\"limitDisplay\"],\n) {\n return display === \"remaining\" ? `${max - count} remaining` : `${count} of ${max} used`;\n}\n"],"mappings":";AAGA,SAAgBA,EAAY,GAAoD;CAC9E,OAAO,GACLC,KACA,OAAO,SAASA,EAAM,GAAG,KACzBA,EAAM,MAAM,KACZ,OAAO,SAASA,EAAM,KAAK,KAC3BA,EAAM,SAAS;AAEnB;AAEA,SAAgBC,EACd,GACA,GACA;CACA,OAAOF,EAAYC,CAAK,MAAME,MAAe,eAAeF,EAAM,QAAQA,EAAM,OAAO,MACnFA,IACA,KAAA;AACN;AAGA,SAAgBG,EAAU,EAAE,UAAO,UAAmB;CACpD,IAAMC,IAAQC,IAAQC;CACtB,OAAOF,KAAS,IAAI,WAAWA,KAAS,MAAO,YAAY,KAAA;AAC7D;AAEA,SAAgBG,EACd,EAAE,UAAO,UACT,GACA;CACA,OAAOC,MAAY,cAAc,GAAGF,IAAMD,EAAM,cAAc,GAAGA,EAAM,MAAMC,EAAI;AACnF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/internal/mergeRefs.ts
|
|
2
|
+
function e(...e) {
|
|
3
|
+
return (t) => {
|
|
4
|
+
let n = e.map((e) => {
|
|
5
|
+
if (typeof e == "function") {
|
|
6
|
+
let n = e(t);
|
|
7
|
+
return typeof n == "function" ? n : () => e(null);
|
|
8
|
+
}
|
|
9
|
+
if (e) return e.current = t, () => {
|
|
10
|
+
e.current = null;
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
return () => n.forEach((e) => e?.());
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { e as t };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=mergeRefs-C6_5pADN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeRefs-C6_5pADN.js","names":["mergeRefs","refs","cleanups","ref","cleanup","node"],"sources":["../../src/internal/mergeRefs.ts"],"sourcesContent":["import type { Ref, RefCallback } from \"react\";\n\n/**\n * Send the same node to internal and forwarded refs. The returned cleanup keeps\n * host-ref semantics on React 19: a callback ref's own cleanup runs on detach in\n * place of a null call. React 18 ignores it and detaches with null as before.\n */\nexport function mergeRefs<T>(...refs: (Ref<T> | undefined)[]): RefCallback<T> {\n return (node) => {\n const cleanups = refs.map((ref) => {\n if (typeof ref === \"function\") {\n const cleanup = ref(node);\n return typeof cleanup === \"function\" ? cleanup : () => ref(null);\n }\n if (ref) {\n ref.current = node;\n return () => {\n ref.current = null;\n };\n }\n });\n return () => cleanups.forEach((cleanup) => cleanup?.());\n };\n}\n"],"mappings":";AAOA,SAAgBA,EAAa,GAAGC,GAA8C;CAC5E,QAAQ,MAAS;EACf,IAAMC,IAAWD,EAAK,KAAK,MAAQ;GACjC,IAAI,OAAOE,KAAQ,YAAY;IAC7B,IAAMC,IAAUD,EAAIE,CAAI;IACxB,OAAO,OAAOD,KAAY,aAAaA,UAAgBD,EAAI,IAAI;GACjE;GACA,IAAIA,GAEF,OADA,EAAI,UAAUE,SACD;IACX,EAAI,UAAU;GAChB;EAEJ,CAAC;EACD,aAAaH,EAAS,SAAS,MAAYE,IAAU,CAAC;CACxD;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(...e){return t=>{let n=e.map(e=>{if(typeof e==`function`){let n=e(t);return typeof n==`function`?n:()=>e(null)}if(e)return e.current=t,()=>{e.current=null}});return()=>n.forEach(e=>e?.())}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
|
2
|
+
//# sourceMappingURL=mergeRefs-CZ-SArlE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeRefs-CZ-SArlE.cjs","names":["mergeRefs","refs","cleanups","ref","cleanup","node"],"sources":["../../src/internal/mergeRefs.ts"],"sourcesContent":["import type { Ref, RefCallback } from \"react\";\n\n/**\n * Send the same node to internal and forwarded refs. The returned cleanup keeps\n * host-ref semantics on React 19: a callback ref's own cleanup runs on detach in\n * place of a null call. React 18 ignores it and detaches with null as before.\n */\nexport function mergeRefs<T>(...refs: (Ref<T> | undefined)[]): RefCallback<T> {\n return (node) => {\n const cleanups = refs.map((ref) => {\n if (typeof ref === \"function\") {\n const cleanup = ref(node);\n return typeof cleanup === \"function\" ? cleanup : () => ref(null);\n }\n if (ref) {\n ref.current = node;\n return () => {\n ref.current = null;\n };\n }\n });\n return () => cleanups.forEach((cleanup) => cleanup?.());\n };\n}\n"],"mappings":"AAOA,SAAgBA,EAAa,GAAGC,EAA8C,CAC5E,MAAQ,IAAS,CACf,IAAMC,EAAWD,EAAK,IAAK,GAAQ,CACjC,GAAI,OAAOE,GAAQ,WAAY,CAC7B,IAAMC,EAAUD,EAAIE,CAAI,EACxB,OAAO,OAAOD,GAAY,WAAaA,MAAgBD,EAAI,IAAI,CACjE,CACA,GAAIA,EAEF,MADA,GAAI,QAAUE,MACD,CACX,EAAI,QAAU,IAChB,CAEJ,CAAC,EACD,UAAaH,EAAS,QAAS,GAAYE,IAAU,CAAC,CACxD,CACF,C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { t as e } from "./context-CXvOl4Kt.js";
|
|
2
|
+
import { r as t } from "./limit-ChteDN4T.js";
|
|
3
|
+
import { useContext as n, useEffect as r, useId as i, useMemo as a } from "react";
|
|
4
|
+
//#region src/components/Field/useLimit.ts
|
|
5
|
+
function o(o) {
|
|
6
|
+
let s = n(e), c = i(), l = s && o["aria-labelledby"] === s.labelId ? s.reportLimit : void 0, u = a(() => l && ((e) => l(c, t(e) ? e : void 0)), [l, c]);
|
|
7
|
+
return r(() => () => u?.(void 0), [u]), u;
|
|
8
|
+
}
|
|
9
|
+
function s(e, t) {
|
|
10
|
+
let n = o(e), i = t?.count, a = t?.max;
|
|
11
|
+
r(() => {
|
|
12
|
+
n?.(i === void 0 || a === void 0 ? void 0 : {
|
|
13
|
+
count: i,
|
|
14
|
+
max: a
|
|
15
|
+
});
|
|
16
|
+
}, [
|
|
17
|
+
n,
|
|
18
|
+
i,
|
|
19
|
+
a
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
function c(e, { value: t, defaultValue: n, maxLength: i, ...a }) {
|
|
23
|
+
let s = o(a), c = t == null ? void 0 : String(t).length;
|
|
24
|
+
r(() => {
|
|
25
|
+
let t = e.current;
|
|
26
|
+
if (s && t) {
|
|
27
|
+
if (i === void 0) s(void 0);
|
|
28
|
+
else if (c !== void 0) s({
|
|
29
|
+
count: c,
|
|
30
|
+
max: i
|
|
31
|
+
});
|
|
32
|
+
else return l(t, () => s({
|
|
33
|
+
count: t.value.length,
|
|
34
|
+
max: i
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
}, [
|
|
38
|
+
e,
|
|
39
|
+
s,
|
|
40
|
+
i,
|
|
41
|
+
c,
|
|
42
|
+
n == null ? "" : String(n)
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
function l(e, t) {
|
|
46
|
+
let n, r = (r) => {
|
|
47
|
+
r.target === e.form && (clearTimeout(n), n = setTimeout(t));
|
|
48
|
+
}, i = e.ownerDocument, a = u(e, t);
|
|
49
|
+
return e.addEventListener("input", t), e.addEventListener("change", t), i.addEventListener("reset", r, !0), t(), () => {
|
|
50
|
+
clearTimeout(n), a(), e.removeEventListener("input", t), e.removeEventListener("change", t), i.removeEventListener("reset", r, !0);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function u(e, t) {
|
|
54
|
+
let n = Object.getOwnPropertyDescriptor(e, "value"), r = n ?? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), "value"), i = r?.get, a = r?.set;
|
|
55
|
+
if (!i || !a || n?.configurable === !1) return () => {};
|
|
56
|
+
let o = !0, s = {
|
|
57
|
+
configurable: !0,
|
|
58
|
+
enumerable: r.enumerable,
|
|
59
|
+
get() {
|
|
60
|
+
return i.call(this);
|
|
61
|
+
},
|
|
62
|
+
set(e) {
|
|
63
|
+
a.call(this, e), o && t();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return Object.defineProperty(e, "value", s), () => {
|
|
67
|
+
o = !1, Object.getOwnPropertyDescriptor(e, "value")?.set === s.set && (n ? Object.defineProperty(e, "value", n) : Reflect.deleteProperty(e, "value"));
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { c as n, s as t };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=useLimit-BOmHKdJE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLimit-BOmHKdJE.js","names":["FieldFrameContext","usableLimit","useLimitReport","frame","useContext","key","useId","reportLimit","binding","report","useMemo","limit","useEffect","useReportedLimit","count","max","useTextLimit","controlledLength","value","input","inputRef","maxLength","observeText","defaultValue","timer","onReset","event","read","owner","restoreValue","interceptValueWrites","own","accessor","get","set","isActive","wrapper","next","onWrite"],"sources":["../../src/components/Field/useLimit.ts"],"sourcesContent":["import { useContext, useEffect, useId, useMemo, type RefObject } from \"react\";\nimport { FieldFrameContext } from \"./context\";\nimport { usableLimit } from \"./limit\";\nimport type { FieldBinding, FieldLimit } from \"./types\";\n\ntype ReportLimit = (limit: FieldLimit | undefined) => void;\ntype TextControl = HTMLInputElement | HTMLTextAreaElement;\n\n/**\n * A control reports only to the Field it is explicitly bound to, and only while\n * that Field has no explicit limit. Each control owns one keyed report, removed\n * on unmount or rebinding without disturbing another control's report.\n */\nfunction useLimitReport(binding: FieldBinding): ReportLimit | undefined {\n const frame = useContext(FieldFrameContext);\n const key = useId();\n const reportLimit =\n frame && binding[\"aria-labelledby\"] === frame.labelId ? frame.reportLimit : undefined;\n const report = useMemo<ReportLimit | undefined>(\n () => reportLimit && ((limit) => reportLimit(key, usableLimit(limit) ? limit : undefined)),\n [reportLimit, key],\n );\n useEffect(() => () => report?.(undefined), [report]);\n return report;\n}\n\n/** Report a limit derived during render, such as committed tags or selected entries. */\nexport function useReportedLimit(binding: FieldBinding, limit: FieldLimit | undefined) {\n const report = useLimitReport(binding);\n const count = limit?.count;\n const max = limit?.max;\n useEffect(() => {\n report?.(count === undefined || max === undefined ? undefined : { count, max });\n }, [report, count, max]);\n}\n\ninterface TextLimitProps extends FieldBinding {\n maxLength?: number;\n value?: string | number | readonly string[] | null;\n defaultValue?: string | number | readonly string[] | null;\n}\n\n/**\n * Count a native text control for its bound Field. A controlled value is counted\n * from props; null is uncontrolled, as in React. An uncontrolled control is\n * observed only while a Field can show its count.\n */\nexport function useTextLimit(\n inputRef: RefObject<TextControl | null>,\n { value, defaultValue, maxLength, ...binding }: TextLimitProps,\n) {\n const report = useLimitReport(binding);\n const controlledLength = value == null ? undefined : String(value).length;\n // A new default changes an unedited control's value without any event.\n const defaultText = defaultValue == null ? \"\" : String(defaultValue);\n useEffect(() => {\n const input = inputRef.current;\n if (!report || !input) {\n return;\n }\n if (maxLength === undefined) {\n report(undefined);\n } else if (controlledLength !== undefined) {\n report({ count: controlledLength, max: maxLength });\n } else {\n return observeText(input, () => report({ count: input.value.length, max: maxLength }));\n }\n }, [inputRef, report, maxLength, controlledLength, defaultText]);\n}\n\n/**\n * Follow typing, autofill, programmatic writes and native resets without\n * replacing React's handlers or its value tracker.\n */\nfunction observeText(input: TextControl, read: () => void) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n // The reset event precedes the browser restoring the form's controls, and a\n // later listener may still cancel it, so read once the reset task completes.\n // The form owner is checked at event time so `form` attribute changes apply.\n const onReset = (event: Event) => {\n if (event.target === input.form) {\n clearTimeout(timer);\n timer = setTimeout(read);\n }\n };\n const owner = input.ownerDocument;\n const restoreValue = interceptValueWrites(input, read);\n input.addEventListener(\"input\", read);\n input.addEventListener(\"change\", read);\n owner.addEventListener(\"reset\", onReset, true);\n read();\n return () => {\n clearTimeout(timer);\n restoreValue();\n input.removeEventListener(\"input\", read);\n input.removeEventListener(\"change\", read);\n owner.removeEventListener(\"reset\", onReset, true);\n };\n}\n\n/**\n * Programmatic `value` writes (form libraries' setValue/reset) fire no events.\n * Wrap the instance accessor, chaining to whatever defines it now (React's\n * tracker), and restore that accessor when observation ends.\n */\nfunction interceptValueWrites(input: TextControl, onWrite: () => void) {\n const own = Object.getOwnPropertyDescriptor(input, \"value\");\n const accessor = own ?? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), \"value\");\n const get = accessor?.get;\n const set = accessor?.set;\n if (!get || !set || own?.configurable === false) {\n return () => {};\n }\n let isActive = true;\n const wrapper: PropertyDescriptor = {\n configurable: true,\n enumerable: accessor.enumerable,\n get(this: TextControl) {\n return get.call(this);\n },\n set(this: TextControl, next: string) {\n set.call(this, next);\n if (isActive) {\n onWrite();\n }\n },\n };\n Object.defineProperty(input, \"value\", wrapper);\n return () => {\n isActive = false;\n // Leave a later wrapper in place; it still chains through this inert one.\n if (Object.getOwnPropertyDescriptor(input, \"value\")?.set !== wrapper.set) {\n return;\n }\n if (own) {\n Object.defineProperty(input, \"value\", own);\n } else {\n Reflect.deleteProperty(input, \"value\");\n }\n };\n}\n"],"mappings":";;;;AAaA,SAASE,EAAe,GAAgD;CACtE,IAAMC,IAAQC,EAAWJ,CAAiB,GACpCK,IAAMC,EAAM,GACZC,IACJJ,KAASK,EAAQ,uBAAuBL,EAAM,UAAUA,EAAM,cAAc,KAAA,GACxEM,IAASC,QACPH,OAAiB,MAAUA,EAAYF,GAAKJ,EAAYU,CAAK,IAAIA,IAAQ,KAAA,CAAS,IACxF,CAACJ,GAAaF,CAAG,CACnB;CAEA,OADAO,cAAsBH,IAAS,KAAA,CAAS,GAAG,CAACA,CAAM,CAAC,GAC5CA;AACT;AAGA,SAAgBI,EAAiB,GAAuB,GAA+B;CACrF,IAAMJ,IAASP,EAAeM,CAAO,GAC/BM,IAAQH,GAAO,OACfI,IAAMJ,GAAO;CACnB,QAAgB;EACd,IAASG,MAAU,KAAA,KAAaC,MAAQ,KAAA,IAAY,KAAA,IAAY;GAAE;GAAO;EAAI,CAAC;CAChF,GAAG;EAACN;EAAQK;EAAOC;CAAG,CAAC;AACzB;AAaA,SAAgBC,EACd,GACA,EAAE,UAAO,iBAAc,cAAW,GAAGR,KACrC;CACA,IAAMC,IAASP,EAAeM,CAAO,GAC/BS,IAAmBC,KAAS,OAAO,KAAA,IAAY,OAAOA,CAAK,CAAC,CAAC;CAGnE,QAAgB;EACd,IAAMC,IAAQC,EAAS;EACvB,IAAKX,KAAWU,GAGhB;OAAIE,MAAc,KAAA,GAChB,EAAO,KAAA,CAAS;QACX,IAAIJ,MAAqB,KAAA,GAC9B,EAAO;IAAE,OAAOA;IAAkB,KAAKI;GAAU,CAAC;QAElD,OAAOC,EAAYH,SAAaV,EAAO;IAAE,OAAOU,EAAM,MAAM;IAAQ,KAAKE;GAAU,CAAC,CAAC;EAAA;CAEzF,GAAG;EAACD;EAAUX;EAAQY;EAAWJ;EAbbM,KAAgB,OAAO,KAAK,OAAOA,CAAY;CAaL,CAAC;AACjE;AAMA,SAASD,EAAY,GAAoB,GAAkB;CACzD,IAAIE,GAIEC,KAAW,MAAiB;EAChC,AAAIC,EAAM,WAAWP,EAAM,SACzB,aAAaK,CAAK,GAClB,IAAQ,WAAWG,CAAI;CAE3B,GACMC,IAAQT,EAAM,eACdU,IAAeC,EAAqBX,GAAOQ,CAAI;CAKrD,OAJAR,EAAM,iBAAiB,SAASQ,CAAI,GACpCR,EAAM,iBAAiB,UAAUQ,CAAI,GACrCC,EAAM,iBAAiB,SAASH,GAAS,EAAI,GAC7CE,EAAK,SACQ;EAKX,AAJA,aAAaH,CAAK,GAClBK,EAAa,GACbV,EAAM,oBAAoB,SAASQ,CAAI,GACvCR,EAAM,oBAAoB,UAAUQ,CAAI,GACxCC,EAAM,oBAAoB,SAASH,GAAS,EAAI;CAClD;AACF;AAOA,SAASK,EAAqB,GAAoB,GAAqB;CACrE,IAAMC,IAAM,OAAO,yBAAyBZ,GAAO,OAAO,GACpDa,IAAWD,KAAO,OAAO,yBAAyB,OAAO,eAAeZ,CAAK,GAAG,OAAO,GACvFc,IAAMD,GAAU,KAChBE,IAAMF,GAAU;CACtB,IAAI,CAACC,KAAO,CAACC,KAAOH,GAAK,iBAAiB,IACxC,aAAa,CAAC;CAEhB,IAAII,IAAW,IACTC,IAA8B;EAClC,cAAc;EACd,YAAYJ,EAAS;EACrB,MAAuB;GACrB,OAAOC,EAAI,KAAK,IAAI;EACtB;EACA,IAAuB,GAAc;GAEnC,AADAC,EAAI,KAAK,MAAMG,CAAI,GACfF,KACFG,EAAQ;EAEZ;CACF;CAEA,OADA,OAAO,eAAenB,GAAO,SAASiB,CAAO,SAChC;EAGX,AAFA,IAAW,IAEP,OAAO,yBAAyBjB,GAAO,OAAO,CAAC,EAAE,QAAQiB,EAAQ,QAGjEL,IACF,OAAO,eAAeZ,GAAO,SAASY,CAAG,IAEzC,QAAQ,eAAeZ,GAAO,OAAO;CAEzC;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./context-BONPXF-V.cjs"),t=require("./limit-BX6-o1a2.cjs");let n=require("react");function r(r){let i=(0,n.useContext)(e.t),a=(0,n.useId)(),o=i&&r[`aria-labelledby`]===i.labelId?i.reportLimit:void 0,s=(0,n.useMemo)(()=>o&&(e=>o(a,t.r(e)?e:void 0)),[o,a]);return(0,n.useEffect)(()=>()=>s?.(void 0),[s]),s}function i(e,t){let i=r(e),a=t?.count,o=t?.max;(0,n.useEffect)(()=>{i?.(a===void 0||o===void 0?void 0:{count:a,max:o})},[i,a,o])}function a(e,{value:t,defaultValue:i,maxLength:a,...s}){let c=r(s),l=t==null?void 0:String(t).length;(0,n.useEffect)(()=>{let t=e.current;if(c&&t){if(a===void 0)c(void 0);else if(l!==void 0)c({count:l,max:a});else return o(t,()=>c({count:t.value.length,max:a}))}},[e,c,a,l,i==null?``:String(i)])}function o(e,t){let n,r=r=>{r.target===e.form&&(clearTimeout(n),n=setTimeout(t))},i=e.ownerDocument,a=s(e,t);return e.addEventListener(`input`,t),e.addEventListener(`change`,t),i.addEventListener(`reset`,r,!0),t(),()=>{clearTimeout(n),a(),e.removeEventListener(`input`,t),e.removeEventListener(`change`,t),i.removeEventListener(`reset`,r,!0)}}function s(e,t){let n=Object.getOwnPropertyDescriptor(e,`value`),r=n??Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),`value`),i=r?.get,a=r?.set;if(!i||!a||n?.configurable===!1)return()=>{};let o=!0,s={configurable:!0,enumerable:r.enumerable,get(){return i.call(this)},set(e){a.call(this,e),o&&t()}};return Object.defineProperty(e,"value",s),()=>{o=!1,Object.getOwnPropertyDescriptor(e,`value`)?.set===s.set&&(n?Object.defineProperty(e,"value",n):Reflect.deleteProperty(e,`value`))}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|
|
2
|
+
//# sourceMappingURL=useLimit-DXe_VmYl.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLimit-DXe_VmYl.cjs","names":["useContext","FieldFrameContext","useId","useMemo","usableLimit","require_context","require_limit","react","useLimitReport","frame","key","reportLimit","binding","report","limit","useReportedLimit","count","max","useTextLimit","controlledLength","value","input","inputRef","maxLength","observeText","defaultValue","timer","onReset","event","read","owner","restoreValue","interceptValueWrites","own","accessor","get","set","isActive","wrapper","next","onWrite"],"sources":["../../src/components/Field/useLimit.ts"],"sourcesContent":["import { useContext, useEffect, useId, useMemo, type RefObject } from \"react\";\nimport { FieldFrameContext } from \"./context\";\nimport { usableLimit } from \"./limit\";\nimport type { FieldBinding, FieldLimit } from \"./types\";\n\ntype ReportLimit = (limit: FieldLimit | undefined) => void;\ntype TextControl = HTMLInputElement | HTMLTextAreaElement;\n\n/**\n * A control reports only to the Field it is explicitly bound to, and only while\n * that Field has no explicit limit. Each control owns one keyed report, removed\n * on unmount or rebinding without disturbing another control's report.\n */\nfunction useLimitReport(binding: FieldBinding): ReportLimit | undefined {\n const frame = useContext(FieldFrameContext);\n const key = useId();\n const reportLimit =\n frame && binding[\"aria-labelledby\"] === frame.labelId ? frame.reportLimit : undefined;\n const report = useMemo<ReportLimit | undefined>(\n () => reportLimit && ((limit) => reportLimit(key, usableLimit(limit) ? limit : undefined)),\n [reportLimit, key],\n );\n useEffect(() => () => report?.(undefined), [report]);\n return report;\n}\n\n/** Report a limit derived during render, such as committed tags or selected entries. */\nexport function useReportedLimit(binding: FieldBinding, limit: FieldLimit | undefined) {\n const report = useLimitReport(binding);\n const count = limit?.count;\n const max = limit?.max;\n useEffect(() => {\n report?.(count === undefined || max === undefined ? undefined : { count, max });\n }, [report, count, max]);\n}\n\ninterface TextLimitProps extends FieldBinding {\n maxLength?: number;\n value?: string | number | readonly string[] | null;\n defaultValue?: string | number | readonly string[] | null;\n}\n\n/**\n * Count a native text control for its bound Field. A controlled value is counted\n * from props; null is uncontrolled, as in React. An uncontrolled control is\n * observed only while a Field can show its count.\n */\nexport function useTextLimit(\n inputRef: RefObject<TextControl | null>,\n { value, defaultValue, maxLength, ...binding }: TextLimitProps,\n) {\n const report = useLimitReport(binding);\n const controlledLength = value == null ? undefined : String(value).length;\n // A new default changes an unedited control's value without any event.\n const defaultText = defaultValue == null ? \"\" : String(defaultValue);\n useEffect(() => {\n const input = inputRef.current;\n if (!report || !input) {\n return;\n }\n if (maxLength === undefined) {\n report(undefined);\n } else if (controlledLength !== undefined) {\n report({ count: controlledLength, max: maxLength });\n } else {\n return observeText(input, () => report({ count: input.value.length, max: maxLength }));\n }\n }, [inputRef, report, maxLength, controlledLength, defaultText]);\n}\n\n/**\n * Follow typing, autofill, programmatic writes and native resets without\n * replacing React's handlers or its value tracker.\n */\nfunction observeText(input: TextControl, read: () => void) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n // The reset event precedes the browser restoring the form's controls, and a\n // later listener may still cancel it, so read once the reset task completes.\n // The form owner is checked at event time so `form` attribute changes apply.\n const onReset = (event: Event) => {\n if (event.target === input.form) {\n clearTimeout(timer);\n timer = setTimeout(read);\n }\n };\n const owner = input.ownerDocument;\n const restoreValue = interceptValueWrites(input, read);\n input.addEventListener(\"input\", read);\n input.addEventListener(\"change\", read);\n owner.addEventListener(\"reset\", onReset, true);\n read();\n return () => {\n clearTimeout(timer);\n restoreValue();\n input.removeEventListener(\"input\", read);\n input.removeEventListener(\"change\", read);\n owner.removeEventListener(\"reset\", onReset, true);\n };\n}\n\n/**\n * Programmatic `value` writes (form libraries' setValue/reset) fire no events.\n * Wrap the instance accessor, chaining to whatever defines it now (React's\n * tracker), and restore that accessor when observation ends.\n */\nfunction interceptValueWrites(input: TextControl, onWrite: () => void) {\n const own = Object.getOwnPropertyDescriptor(input, \"value\");\n const accessor = own ?? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), \"value\");\n const get = accessor?.get;\n const set = accessor?.set;\n if (!get || !set || own?.configurable === false) {\n return () => {};\n }\n let isActive = true;\n const wrapper: PropertyDescriptor = {\n configurable: true,\n enumerable: accessor.enumerable,\n get(this: TextControl) {\n return get.call(this);\n },\n set(this: TextControl, next: string) {\n set.call(this, next);\n if (isActive) {\n onWrite();\n }\n },\n };\n Object.defineProperty(input, \"value\", wrapper);\n return () => {\n isActive = false;\n // Leave a later wrapper in place; it still chains through this inert one.\n if (Object.getOwnPropertyDescriptor(input, \"value\")?.set !== wrapper.set) {\n return;\n }\n if (own) {\n Object.defineProperty(input, \"value\", own);\n } else {\n Reflect.deleteProperty(input, \"value\");\n }\n };\n}\n"],"mappings":"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"}
|
|
@@ -55,6 +55,7 @@ function u(u, { placement: d, className: f } = {}) {
|
|
|
55
55
|
placement: d,
|
|
56
56
|
className: [
|
|
57
57
|
"ds-surface-raised",
|
|
58
|
+
"ds-field-surface",
|
|
58
59
|
"ds-tooltip",
|
|
59
60
|
f
|
|
60
61
|
].filter(Boolean).join(" "),
|
|
@@ -70,4 +71,4 @@ function u(u, { placement: d, className: f } = {}) {
|
|
|
70
71
|
//#endregion
|
|
71
72
|
export { u as t };
|
|
72
73
|
|
|
73
|
-
//# sourceMappingURL=useTooltip-
|
|
74
|
+
//# sourceMappingURL=useTooltip-C5gvEoYk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip-
|
|
1
|
+
{"version":3,"file":"useTooltip-C5gvEoYk.js","names":["isComposing","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isEnabled","content","anchorRef","useRef","id","useId","isOpen","setIsOpen","useState","hasOpened","setHasOpened","hovered","timer","useEffect","dismiss","show","hide","enter","leave","handlers","Popover","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!isEnabled && isOpen) {\n // Disabling closes it, so re-enabling later cannot reopen it unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (isEnabled) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":";;;;;AAcA,IAAMC,IAAc;AAgBpB,SAASC,EACP,GACA,GACA;CACA,QAAQ,MAAa;EAEnB,AADAC,IAASC,CAAK,GACTA,EAAM,oBACTC,EAAKD,CAAK;CAEd;AACF;AAOA,SAASE,EAAmB,GAAwB;CAClD,IAAMC,IAAS,OAAO,WAAa,MAAc,OAAO,SAAS;CACjE,IAAI,CAACC,KAAU,CAACD,KAAU,CAACC,EAAO,SAASD,CAAM,GAC/C,OAAO;CAET,IAAI;EACF,OAAOA,EAAO,QAAQ,gBAAgB;CACxC,QAAQ;EAEN,OAAO;CACT;AACF;AAOA,SAAgBE,EACd,GACA,EAAE,cAAW,iBAA8B,CAAC,GAC5C;CACA,IAAMC,IACJC,MAAY,MAASA,KAAY,QAAiCA,MAAY,IAC1EC,IAAYC,EAAiB,IAAI,GACjCC,IAAKC,EAAM,GACX,CAACC,GAAQC,KAAaC,EAAS,EAAK,GAEpC,CAACC,GAAWC,KAAgBF,EAAS,EAAK,GAC1CG,IAAUR,EAAO,EAAK,GACtBS,IAAQT,EAAkD,KAAA,CAAS;CAQzE,AAPI,CAACH,KAAaM,KAEhBC,EAAU,EAAK,GAGjBM,cAAsB,aAAaD,EAAM,OAAO,GAAG,CAAC,CAAC,GAErDC,QAAgB;EACd,IAAI,CAACP,GACH;EAEF,IAAMQ,KAAW,MAAyB;GACxC,AAAIpB,EAAM,QAAQ,YAAYA,EAAM,oBAAoBJ,EAAYI,CAAK,MAKzEA,EAAM,eAAe,GACrBa,EAAU,EAAK;EACjB;EAEA,OADA,SAAS,iBAAiB,WAAWO,CAAO,SAC/B,SAAS,oBAAoB,WAAWA,CAAO;CAC9D,GAAG,CAACR,CAAM,CAAC;CAEX,IAAMS,UAAa;EAEjB,AADA,aAAaH,EAAM,OAAO,GACtBZ,MACFO,EAAU,EAAI,GACdG,EAAa,EAAI;CAErB,GACMM,UAAa;EAEjB,AADA,aAAaJ,EAAM,OAAO,GAC1B,EAAM,UAAU,iBAAiB;GAC/B,AAAI,CAACD,EAAQ,WAAW,CAACf,EAAmBM,EAAU,OAAO,KAC3DK,EAAU,EAAK;EAEnB,GAAGhB,CAAW;CAChB,GACM0B,UAAc;EAElB,AADA,EAAQ,UAAU,IAClBF,EAAK;CACP,GACMG,UAAc;EAElB,AADA,EAAQ,UAAU,IAClBF,EAAK;CACP;CAEA,OAAO;EACL;EAEA,aAAahB,KAAaM,IAASF,IAAK,KAAA;EAExC,eAAe,IAAsC,CAAC,OAAO;GAC3D,cAAcZ,EAAQ2B,EAAS,cAAcF,CAAK;GAClD,cAAczB,EAAQ2B,EAAS,cAAcD,CAAK;GAClD,SAAS1B,EAAQ2B,EAAS,SAASJ,CAAI;GACvC,QAAQvB,EAAQ2B,EAAS,QAAQH,CAAI;EACvC;EACA,OACEhB,KAAaS,IACX,kBAACW,GAAD;GACa;GACH;GACJ;GACJ,MAAK;GACM;GACX,WAAW;IAAC;IAAqB;IAAoB;IAAcC;GAAS,CAAC,CAC1E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;GAEX,UAAA,kBAAC,QAAD;IACE,WAAU;IACV,cAAcJ;IACd,cAAcC;IAEb,UAAAjB;GACG,CAAA;EACC,CAAA,IACP;CACR;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./isComposing-BrBcAANm.cjs"),t=require("../components/Popover/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=100;function a(e,t){return n=>{e?.(n),n.defaultPrevented||t(n)}}function o(e){let t=typeof document>`u`?null:document.activeElement;if(!e||!t||!e.contains(t))return!1;try{return t.matches(`:focus-visible`)}catch{return!0}}function s(s,{placement:c,className:l}={}){let u=s!==!1&&s!=null&&s!==``,d=(0,n.useRef)(null),f=(0,n.useId)(),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),_=(0,n.useRef)(!1),v=(0,n.useRef)(void 0);!u&&p&&m(!1),(0,n.useEffect)(()=>()=>clearTimeout(v.current),[]),(0,n.useEffect)(()=>{if(!p)return;let t=t=>{t.key!==`Escape`||t.defaultPrevented||e.t(t)||(t.preventDefault(),m(!1))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[p]);let y=()=>{clearTimeout(v.current),u&&(m(!0),g(!0))},b=()=>{clearTimeout(v.current),v.current=setTimeout(()=>{!_.current&&!o(d.current)&&m(!1)},i)},x=()=>{_.current=!0,y()},S=()=>{_.current=!1,b()};return{anchorRef:d,description:u&&p?f:void 0,triggerProps:(e={})=>({onMouseEnter:a(e.onMouseEnter,x),onMouseLeave:a(e.onMouseLeave,S),onFocus:a(e.onFocus,y),onBlur:a(e.onBlur,b)}),panel:u&&h?(0,r.jsx)(t.Popover,{anchorRef:d,isOpen:p,id:f,role:`tooltip`,placement:c,className:[`ds-surface-raised`,`ds-tooltip`,l].filter(Boolean).join(` `),children:(0,r.jsx)(`span`,{className:`ds-tooltip__content`,onMouseEnter:x,onMouseLeave:S,children:s})}):null}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
2
|
-
//# sourceMappingURL=useTooltip-
|
|
1
|
+
const e=require("./isComposing-BrBcAANm.cjs"),t=require("../components/Popover/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=100;function a(e,t){return n=>{e?.(n),n.defaultPrevented||t(n)}}function o(e){let t=typeof document>`u`?null:document.activeElement;if(!e||!t||!e.contains(t))return!1;try{return t.matches(`:focus-visible`)}catch{return!0}}function s(s,{placement:c,className:l}={}){let u=s!==!1&&s!=null&&s!==``,d=(0,n.useRef)(null),f=(0,n.useId)(),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),_=(0,n.useRef)(!1),v=(0,n.useRef)(void 0);!u&&p&&m(!1),(0,n.useEffect)(()=>()=>clearTimeout(v.current),[]),(0,n.useEffect)(()=>{if(!p)return;let t=t=>{t.key!==`Escape`||t.defaultPrevented||e.t(t)||(t.preventDefault(),m(!1))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[p]);let y=()=>{clearTimeout(v.current),u&&(m(!0),g(!0))},b=()=>{clearTimeout(v.current),v.current=setTimeout(()=>{!_.current&&!o(d.current)&&m(!1)},i)},x=()=>{_.current=!0,y()},S=()=>{_.current=!1,b()};return{anchorRef:d,description:u&&p?f:void 0,triggerProps:(e={})=>({onMouseEnter:a(e.onMouseEnter,x),onMouseLeave:a(e.onMouseLeave,S),onFocus:a(e.onFocus,y),onBlur:a(e.onBlur,b)}),panel:u&&h?(0,r.jsx)(t.Popover,{anchorRef:d,isOpen:p,id:f,role:`tooltip`,placement:c,className:[`ds-surface-raised`,`ds-field-surface`,`ds-tooltip`,l].filter(Boolean).join(` `),children:(0,r.jsx)(`span`,{className:`ds-tooltip__content`,onMouseEnter:x,onMouseLeave:S,children:s})}):null}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
2
|
+
//# sourceMappingURL=useTooltip-bTE_a2Xn.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip-
|
|
1
|
+
{"version":3,"file":"useTooltip-bTE_a2Xn.cjs","names":["useRef","useId","useState","isComposing","Popover","require_isComposing","require_components_Popover_index","react","react_jsx_runtime","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isEnabled","content","anchorRef","id","isOpen","setIsOpen","hasOpened","setHasOpened","hovered","timer","dismiss","show","hide","enter","leave","handlers","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!isEnabled && isOpen) {\n // Disabling closes it, so re-enabling later cannot reopen it unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (isEnabled) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":"A,iJAcA,IAAMS,EAAc,IAgBpB,SAASC,EACP,EACA,EACA,CACA,MAAQ,IAAa,CACnBC,IAASC,CAAK,EACTA,EAAM,kBACTC,EAAKD,CAAK,CAEd,CACF,CAOA,SAASE,EAAmB,EAAwB,CAClD,IAAMC,EAAS,OAAO,SAAa,IAAc,KAAO,SAAS,cACjE,GAAI,CAACC,GAAU,CAACD,GAAU,CAACC,EAAO,SAASD,CAAM,EAC/C,MAAO,GAET,GAAI,CACF,OAAOA,EAAO,QAAQ,gBAAgB,CACxC,MAAQ,CAEN,MAAO,EACT,CACF,CAOA,SAAgBE,EACd,EACA,CAAE,YAAW,aAA8B,CAAC,EAC5C,CACA,IAAMC,EACJC,IAAY,IAASA,GAAY,MAAiCA,IAAY,GAC1EC,GAAA,EAAYpB,EAAAA,OAAAA,CAAiB,IAAI,EACjCqB,GAAA,EAAKpB,EAAAA,MAAAA,CAAM,EACX,CAACqB,EAAQC,IAAA,EAAarB,EAAAA,SAAAA,CAAS,EAAK,EAEpC,CAACsB,EAAWC,IAAA,EAAgBvB,EAAAA,SAAAA,CAAS,EAAK,EAC1CwB,GAAA,EAAU1B,EAAAA,OAAAA,CAAO,EAAK,EACtB2B,GAAA,EAAQ3B,EAAAA,OAAAA,CAAkD,IAAA,EAAS,EACrE,CAACkB,GAAaI,GAEhBC,EAAU,EAAK,GAGjB,EAAAhB,EAAA,UAAA,SAAsB,aAAaoB,EAAM,OAAO,EAAG,CAAC,CAAC,GAErD,EAAApB,EAAA,UAAA,KAAgB,CACd,GAAI,CAACe,EACH,OAEF,IAAMM,EAAW,GAAyB,CACpChB,EAAM,MAAQ,UAAYA,EAAM,kBAAoBT,EAAAA,EAAYS,CAAK,IAKzEA,EAAM,eAAe,EACrBW,EAAU,EAAK,EACjB,EAEA,OADA,SAAS,iBAAiB,UAAWK,CAAO,MAC/B,SAAS,oBAAoB,UAAWA,CAAO,CAC9D,EAAG,CAACN,CAAM,CAAC,EAEX,IAAMO,MAAa,CACjB,aAAaF,EAAM,OAAO,EACtBT,IACFK,EAAU,EAAI,EACdE,EAAa,EAAI,EAErB,EACMK,MAAa,CACjB,aAAaH,EAAM,OAAO,EAC1B,EAAM,QAAU,eAAiB,CAC3B,CAACD,EAAQ,SAAW,CAACZ,EAAmBM,EAAU,OAAO,GAC3DG,EAAU,EAAK,CAEnB,EAAGd,CAAW,CAChB,EACMsB,MAAc,CAClB,EAAQ,QAAU,GAClBF,EAAK,CACP,EACMG,MAAc,CAClB,EAAQ,QAAU,GAClBF,EAAK,CACP,EAEA,MAAO,CACL,YAEA,YAAaZ,GAAaI,EAASD,EAAK,IAAA,GAExC,cAAe,EAAsC,CAAC,KAAO,CAC3D,aAAcX,EAAQuB,EAAS,aAAcF,CAAK,EAClD,aAAcrB,EAAQuB,EAAS,aAAcD,CAAK,EAClD,QAAStB,EAAQuB,EAAS,QAASJ,CAAI,EACvC,OAAQnB,EAAQuB,EAAS,OAAQH,CAAI,CACvC,GACA,MACEZ,GAAaM,GACX,EAAAhB,EAAA,IAAA,CAACJ,EAAAA,QAAD,CACa,YACH,SACJ,KACJ,KAAK,UACM,YACX,UAAW,CAAC,oBAAqB,mBAAoB,aAAc8B,CAAS,CAAC,CAC1E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,EAEX,UAAA,EAAA1B,EAAA,IAAA,CAAC,OAAD,CACE,UAAU,sBACV,aAAcuB,EACd,aAAcC,EAEb,SAAAb,CACG,CAAA,CACC,CAAA,EACP,IACR,CACF,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/mergeRefs-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),n=require("../Drawer/index.cjs"),r=require("../SideNav/index.cjs"),i=require("../TopNav/index.cjs"),a=require("../../chunks/observeElementWidth-BCJM2FAw.cjs");let o=require("react"),s=require("react/jsx-runtime");var c=(0,o.forwardRef)(function({brand:c,navigation:l,actions:u,navigationLabel:d=`Main`,scrollMode:f=`container`,contentPadding:p=`default`,className:m,children:h,...g},_){let[v,y]=(0,o.useState)(null),[b,x]=(0,o.useState)(!1),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(!1),T=(0,o.useId)(),E=(0,o.useMemo)(()=>t.t(y,_),[_]);(0,o.useEffect)(()=>v?a.t(v,e=>{e<768||(document.getElementById(T)?.contains(document.activeElement)&&(w.current=!0),x(!1))}):void 0,[v,T]),(0,o.useEffect)(()=>{!b&&w.current&&(w.current=!1,(S.current?.querySelector(`[aria-current='page']`)??S.current?.querySelector(`a[href]`)??C.current)?.focus())},[b]);let D=u?.(`drawer`);return(0,s.jsxs)(`div`,{...g,ref:E,"data-scroll-mode":f,"data-content-padding":p,className:[`ds-appshell`,m].filter(Boolean).join(` `),children:[(0,s.jsxs)(`div`,{className:`ds-appshell__frame`,"aria-hidden":b||void 0,ref:e=>{e&&(e.inert=b)},children:[(0,s.jsx)(i.TopNav,{brand:c,actions:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`ds-appshell__actions`,children:u?.(`topnav`)}),(0,s.jsx)(e.Button,{variant:`simple`,size:`lg`,isIconOnly:!0,iconStart:`menu`,className:`ds-appshell__toggle`,"aria-label":`Open navigation`,"aria-expanded":b,"aria-controls":T,onClick:()=>x(!0)})]})}),(0,s.jsxs)(`div`,{className:`ds-appshell__body`,children:[(0,s.jsx)(r.SideNav,{ref:S,className:`ds-appshell__desktop-nav`,label:d,children:l}),(0,s.jsx)(`main`,{ref:C,className:`ds-appshell__main`,tabIndex:-1,children:h})]})]}),(0,s.jsx)(n.Drawer,{id:T,isOpen:b,onClose:()=>x(!1),variant:`navigation`,side:`end`,portalContainer:f===`document`?void 0:v,dir:g.dir,title:c,"aria-label":`Navigation`,closeLabel:`Close navigation`,footer:D?(0,s.jsx)(r.SideNavFooter,{children:D}):void 0,children:(0,s.jsx)(r.SideNav,{className:`ds-appshell__mobile-nav`,label:d,onClick:e=>{let t=e.target instanceof Element?e.target.closest(`a[href]`):null,n=e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||t?.target===`_blank`;t&&!n&&x(!1)},children:l})})]})});exports.AppShell=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button as e } from "../Button/index.js";
|
|
2
|
-
import { t } from "../../chunks/mergeRefs-
|
|
2
|
+
import { t } from "../../chunks/mergeRefs-C6_5pADN.js";
|
|
3
3
|
import { Drawer as n } from "../Drawer/index.js";
|
|
4
4
|
import { SideNav as r, SideNavFooter as i } from "../SideNav/index.js";
|
|
5
5
|
import { TopNav as a } from "../TopNav/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Avatar-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Avatar-B_2lI7fS.cjs");exports.Avatar=e.t,exports.AvatarGroup=e.n;
|