@tedi-design-system/react 19.2.0-rc.7 → 19.2.0-rc.9
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/bundle-stats.html +1 -1
- package/component.manifest.json +8 -8
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +2 -2
- package/src/community/components/map-components/map-layer/map-layer.cjs.js +1 -1
- package/src/community/components/map-components/map-layer/map-layer.es.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.cjs.js +1 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.d.ts +20 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.es.js +5 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.cjs.js +1 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.d.ts +72 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.es.js +124 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.module.scss.es.js +13 -0
- package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.d.ts +8 -2
- package/src/tedi/components/form/checkbox/checkbox.es.js +146 -110
- package/src/tedi/components/form/checkbox/checkbox.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.module.scss.es.js +11 -3
- package/src/tedi/components/form/checkbox/index.cjs.js +1 -0
- package/src/tedi/components/form/checkbox/index.d.ts +11 -0
- package/src/tedi/components/form/checkbox/index.es.js +7 -0
- package/src/tedi/components/form/choice-group/choice-group.d.ts +11 -0
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +15 -15
- package/src/tedi/components/form/choice-input.types.d.ts +41 -10
- package/src/tedi/components/form/radio/index.cjs.js +1 -0
- package/src/tedi/components/form/radio/index.d.ts +11 -0
- package/src/tedi/components/form/radio/index.es.js +7 -0
- package/src/tedi/components/form/radio/radio-group/radio-group-context.cjs.js +1 -0
- package/src/tedi/components/form/radio/radio-group/radio-group-context.d.ts +21 -0
- package/src/tedi/components/form/radio/radio-group/radio-group-context.es.js +5 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.cjs.js +1 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.d.ts +56 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.es.js +78 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.module.scss.es.js +13 -0
- package/src/tedi/components/form/radio/radio.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.d.ts +7 -2
- package/src/tedi/components/form/radio/radio.es.js +116 -78
- package/src/tedi/components/form/radio/radio.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.module.scss.es.js +11 -3
- package/src/tedi/components/form/textarea/textarea.cjs.js +1 -1
- package/src/tedi/components/form/textarea/textarea.es.js +71 -62
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.d.ts +12 -0
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.es.js +57 -27
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.d.ts +17 -0
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.es.js +65 -51
- package/src/tedi/index.d.ts +2 -2
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +14 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +25 -11
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +298 -294
|
@@ -1,98 +1,136 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsx as i, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import t from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import o from "react";
|
|
4
|
+
import { Icon as ee } from "../../base/icon/icon.es.js";
|
|
4
5
|
import { FeedbackText as q } from "../feedback-text/feedback-text.es.js";
|
|
5
|
-
import { FormLabel as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import { FormLabel as ae } from "../form-label/form-label.es.js";
|
|
7
|
+
import a from "./radio.module.scss.es.js";
|
|
8
|
+
import { RadioGroupContext as ie } from "./radio-group/radio-group-context.es.js";
|
|
9
|
+
import { useBreakpointProps as de } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
10
|
+
import { Row as re } from "../../layout/grid/row.es.js";
|
|
11
|
+
import { Col as V } from "../../layout/grid/col.es.js";
|
|
12
|
+
const te = (k) => {
|
|
13
|
+
const e = o.useContext(ie), { getCurrentBreakpointProps: $ } = de(k.defaultServerBreakpoint), {
|
|
14
|
+
id: L,
|
|
12
15
|
label: m,
|
|
13
|
-
value:
|
|
14
|
-
className:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
hideLabel: y,
|
|
16
|
+
value: s,
|
|
17
|
+
className: y,
|
|
18
|
+
onChange: c,
|
|
19
|
+
hideLabel: C,
|
|
18
20
|
helper: r,
|
|
19
|
-
checked:
|
|
20
|
-
defaultChecked:
|
|
21
|
-
hover:
|
|
22
|
-
name:
|
|
23
|
-
tooltip:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
checked: p,
|
|
22
|
+
defaultChecked: j,
|
|
23
|
+
hover: E,
|
|
24
|
+
name: D,
|
|
25
|
+
tooltip: P,
|
|
26
|
+
description: b,
|
|
27
|
+
icon: _,
|
|
28
|
+
labelProps: F,
|
|
29
|
+
size: G,
|
|
30
|
+
variant: M,
|
|
31
|
+
cardVariant: S,
|
|
32
|
+
disabled: H,
|
|
33
|
+
invalid: T,
|
|
34
|
+
required: I,
|
|
35
|
+
...w
|
|
36
|
+
} = $(k), u = G ?? (e == null ? void 0 : e.size) ?? "default", B = M ?? (e == null ? void 0 : e.variant) ?? "default", U = S ?? (e == null ? void 0 : e.cardVariant) ?? "primary", h = H ?? (e == null ? void 0 : e.disabled) ?? !1, A = T ?? (e == null ? void 0 : e.invalid), J = I ?? (e == null ? void 0 : e.required);
|
|
37
|
+
B === "card" && P && console.warn('Radio: `tooltip` is not supported with `variant="card"` and will be ignored. Use `description`.');
|
|
38
|
+
const K = o.useId(), n = L ?? K, O = D ?? (e == null ? void 0 : e.name), [x, Q] = o.useState(j || !1), N = e !== null, W = o.useMemo(() => N ? (e == null ? void 0 : e.value) === s : c && typeof p < "u" ? p : x, [N, e, s, c, p, x]), X = (d) => {
|
|
39
|
+
N ? e == null || e.onValueChange(s) : typeof p > "u" && Q(d == null ? void 0 : d.target.checked), c == null || c(s, d == null ? void 0 : d.target.checked);
|
|
40
|
+
}, f = r ? r.id ?? `${n}-helper` : void 0, Y = f, z = /* @__PURE__ */ i(
|
|
41
|
+
"input",
|
|
42
|
+
{
|
|
43
|
+
id: n,
|
|
44
|
+
value: s,
|
|
45
|
+
name: O,
|
|
46
|
+
type: "radio",
|
|
47
|
+
disabled: h,
|
|
48
|
+
checked: W,
|
|
49
|
+
required: J,
|
|
50
|
+
onChange: X,
|
|
51
|
+
className: a["tedi-radio__input"],
|
|
52
|
+
"aria-describedby": Y
|
|
53
|
+
}
|
|
54
|
+
), v = /* @__PURE__ */ i(
|
|
55
|
+
"span",
|
|
56
|
+
{
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
className: t(
|
|
59
|
+
a["tedi-radio__indicator"],
|
|
60
|
+
{ [a["tedi-radio__indicator--hover"]]: E },
|
|
61
|
+
{ [a[`tedi-radio__indicator--size-${u}`]]: u },
|
|
62
|
+
{ [a["tedi-radio__indicator--invalid"]]: A }
|
|
63
|
+
),
|
|
64
|
+
"data-testid": "radio-indicator"
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
if (B === "card") {
|
|
68
|
+
const d = `${n}-label`, R = b ? `${n}-description` : void 0, g = [R, f].filter(Boolean).join(" ") || void 0;
|
|
69
|
+
return /* @__PURE__ */ l(
|
|
70
|
+
"label",
|
|
71
|
+
{
|
|
72
|
+
"data-name": "radio",
|
|
73
|
+
className: t(
|
|
74
|
+
a["tedi-radio"],
|
|
75
|
+
a["tedi-radio--card"],
|
|
76
|
+
a[`tedi-radio--card-${U}`],
|
|
77
|
+
{ [a["tedi-radio--card-with-icon"]]: !!_ },
|
|
78
|
+
{ [a["tedi-radio--disabled"]]: h },
|
|
79
|
+
y
|
|
80
|
+
),
|
|
81
|
+
...w,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ l("span", { className: a["tedi-radio__card-control"], children: [
|
|
84
|
+
o.cloneElement(z, {
|
|
85
|
+
"aria-labelledby": m ? d : void 0,
|
|
86
|
+
"aria-describedby": g
|
|
87
|
+
}),
|
|
88
|
+
v,
|
|
89
|
+
_ && /* @__PURE__ */ i(ee, { name: _, size: u === "default" ? 18 : 24, className: a["tedi-radio__card-icon"] }),
|
|
90
|
+
/* @__PURE__ */ i("span", { id: d, className: t(a["tedi-radio__card-label"], { "sr-only": C }), children: m })
|
|
91
|
+
] }),
|
|
92
|
+
b && /* @__PURE__ */ i("span", { id: R, className: a["tedi-radio__card-description"], children: b }),
|
|
93
|
+
r && /* @__PURE__ */ i(q, { id: f, ...r, className: t(a["tedi-radio__helper"], r.className) })
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
const Z = t(a["tedi-radio__label"], { [a["tedi-radio--disabled"]]: h });
|
|
99
|
+
return /* @__PURE__ */ l(
|
|
33
100
|
"div",
|
|
34
101
|
{
|
|
35
|
-
className:
|
|
102
|
+
className: t(a["tedi-radio"], { [a["tedi-radio--disabled"]]: h }),
|
|
36
103
|
"data-name": "radio",
|
|
37
|
-
...
|
|
104
|
+
...w,
|
|
38
105
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
value: p,
|
|
46
|
-
name: j,
|
|
47
|
-
type: "radio",
|
|
48
|
-
disabled: s,
|
|
49
|
-
checked: z,
|
|
50
|
-
onChange: B,
|
|
51
|
-
className: e["tedi-radio__input"],
|
|
52
|
-
"aria-describedby": [k, F].filter(Boolean).join(" "),
|
|
53
|
-
required: u
|
|
54
|
-
}
|
|
55
|
-
),
|
|
56
|
-
/* @__PURE__ */ d(
|
|
57
|
-
"div",
|
|
58
|
-
{
|
|
59
|
-
"aria-hidden": "true",
|
|
60
|
-
onClick: () => {
|
|
61
|
-
var i;
|
|
62
|
-
return (i = b.current) == null ? void 0 : i.click();
|
|
63
|
-
},
|
|
64
|
-
className: l(
|
|
65
|
-
e["tedi-radio__indicator"],
|
|
66
|
-
{ [e["tedi-radio__indicator--hover"]]: x },
|
|
67
|
-
{ [e[`tedi-radio__indicator--size-${f}`]]: f },
|
|
68
|
-
{ [e["tedi-radio__indicator--invalid"]]: I },
|
|
69
|
-
g
|
|
70
|
-
),
|
|
71
|
-
"data-testid": "radio-indicator"
|
|
72
|
-
}
|
|
73
|
-
)
|
|
106
|
+
/* @__PURE__ */ l(re, { gutter: 0, children: [
|
|
107
|
+
/* @__PURE__ */ i(V, { width: "auto", children: /* @__PURE__ */ l("div", { className: a["tedi-radio__outer-indicator-wrapper"], children: [
|
|
108
|
+
z,
|
|
109
|
+
o.cloneElement(v, {
|
|
110
|
+
className: t(v.props.className, y)
|
|
111
|
+
})
|
|
74
112
|
] }) }),
|
|
75
|
-
m && /* @__PURE__ */
|
|
76
|
-
|
|
113
|
+
m && /* @__PURE__ */ i(V, { children: /* @__PURE__ */ i(
|
|
114
|
+
ae,
|
|
77
115
|
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
id: o,
|
|
116
|
+
className: Z,
|
|
117
|
+
id: n,
|
|
81
118
|
"data-testid": "radio-label",
|
|
82
|
-
hideLabel:
|
|
119
|
+
hideLabel: C,
|
|
83
120
|
label: m,
|
|
84
|
-
tooltip:
|
|
85
|
-
required:
|
|
86
|
-
labelProps:
|
|
121
|
+
tooltip: P,
|
|
122
|
+
required: I,
|
|
123
|
+
labelProps: F
|
|
87
124
|
}
|
|
88
125
|
) })
|
|
89
126
|
] }),
|
|
90
|
-
r && /* @__PURE__ */
|
|
127
|
+
r && /* @__PURE__ */ i(q, { id: f, ...r, className: t(a["tedi-radio__helper"], r.className) })
|
|
91
128
|
]
|
|
92
129
|
}
|
|
93
130
|
);
|
|
94
131
|
};
|
|
132
|
+
te.displayName = "Radio";
|
|
95
133
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
134
|
+
te as Radio,
|
|
135
|
+
te as default
|
|
98
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d={"tedi-radio":"tedi-radio-c814e478","tedi-radio--disabled":"tedi-radio--disabled-fb9dbcd0","tedi-radio__input":"tedi-radio__input-62863a92","tedi-radio__indicator":"tedi-radio__indicator-c6e05a3f","tedi-radio__indicator--size-default":"tedi-radio__indicator--size-default-dd9e104b","tedi-radio__indicator--size-large":"tedi-radio__indicator--size-large-c5c7d068","tedi-radio__indicator--invalid":"tedi-radio__indicator--invalid-d5a930d7","tedi-radio__indicator--hover":"tedi-radio__indicator--hover-6e11a48a","tedi-radio__outer-indicator-wrapper":"tedi-radio__outer-indicator-wrapper-7c0ad4cd","tedi-radio__helper":"tedi-radio__helper-266c7814","tedi-radio--card":"tedi-radio--card-f10f7b18","tedi-radio__card-control":"tedi-radio__card-control-d010324f","tedi-radio__card-label":"tedi-radio__card-label-19b7c642","tedi-radio__card-icon":"tedi-radio__card-icon-fa03c66c","tedi-radio__card-description":"tedi-radio__card-description-69c958cf","tedi-radio--card-with-icon":"tedi-radio--card-with-icon-0735f37d","tedi-radio--card-primary":"tedi-radio--card-primary-f05b3587","tedi-radio--card-secondary":"tedi-radio--card-secondary-9a5fbafe"};exports.default=d;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const d = {
|
|
2
2
|
"tedi-radio": "tedi-radio-c814e478",
|
|
3
3
|
"tedi-radio--disabled": "tedi-radio--disabled-fb9dbcd0",
|
|
4
4
|
"tedi-radio__input": "tedi-radio__input-62863a92",
|
|
@@ -8,8 +8,16 @@ const i = {
|
|
|
8
8
|
"tedi-radio__indicator--invalid": "tedi-radio__indicator--invalid-d5a930d7",
|
|
9
9
|
"tedi-radio__indicator--hover": "tedi-radio__indicator--hover-6e11a48a",
|
|
10
10
|
"tedi-radio__outer-indicator-wrapper": "tedi-radio__outer-indicator-wrapper-7c0ad4cd",
|
|
11
|
-
"tedi-radio__helper": "tedi-radio__helper-266c7814"
|
|
11
|
+
"tedi-radio__helper": "tedi-radio__helper-266c7814",
|
|
12
|
+
"tedi-radio--card": "tedi-radio--card-f10f7b18",
|
|
13
|
+
"tedi-radio__card-control": "tedi-radio__card-control-d010324f",
|
|
14
|
+
"tedi-radio__card-label": "tedi-radio__card-label-19b7c642",
|
|
15
|
+
"tedi-radio__card-icon": "tedi-radio__card-icon-fa03c66c",
|
|
16
|
+
"tedi-radio__card-description": "tedi-radio__card-description-69c958cf",
|
|
17
|
+
"tedi-radio--card-with-icon": "tedi-radio--card-with-icon-0735f37d",
|
|
18
|
+
"tedi-radio--card-primary": "tedi-radio--card-primary-f05b3587",
|
|
19
|
+
"tedi-radio--card-secondary": "tedi-radio--card-secondary-9a5fbafe"
|
|
12
20
|
};
|
|
13
21
|
export {
|
|
14
|
-
|
|
22
|
+
d as default
|
|
15
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),a=require("react"),L=require("../textfield/textfield.cjs.js"),m=require("./textarea.module.scss.cjs.js"),M=a.forwardRef((N,i)=>{const{className:_,helper:w=[],characterLimit:d,onChange:l,onChangeEvent:y,value:h,defaultValue:q,autoGrow:t=!1,minRows:f=3,maxRows:v=12,height:T="7.5rem",maxHeight:c,...z}=N,[C,A]=a.useState(q??""),u=a.useRef(null),[R,E]=a.useState("auto"),O=a.useCallback(e=>{!h&&!(l||y)&&A(e),l==null||l(e)},[h,l,y]),H=a.useMemo(()=>h??C,[h,C]),r=a.useCallback(()=>{if(!t||!u.current)return;const e=u.current,p=e.style.overflow;e.style.overflow="hidden";const o=window.getComputedStyle(e);let n=parseFloat(o.lineHeight);isNaN(n)&&(n=(parseFloat(o.fontSize)||16)*1.5);const s=parseFloat(o.paddingTop),g=parseFloat(o.paddingBottom),x=o.boxSizing==="border-box"?(parseFloat(o.borderTopWidth)||0)+(parseFloat(o.borderBottomWidth)||0):0;e.style.height="auto";const I=e.scrollHeight-s-g,V=Math.ceil((I-1)/n),F=`${Math.min(Math.max(V,f),v)*n+s+g+x}px`;e.style.height=F,E(F),e.style.overflow=p,e.style.overflowY=e.scrollHeight-e.clientHeight>1?"auto":"hidden"},[t,f,v]);a.useEffect(()=>{t&&requestAnimationFrame(()=>{r()})},[H,t,r]),a.useEffect(()=>{t&&u.current&&r()},[t,r]),a.useEffect(()=>{const e=u.current;if(!t||!e||typeof ResizeObserver>"u")return;let p=e.clientWidth;const o=new ResizeObserver(n=>{var x;const s=((x=n[0])==null?void 0:x.contentRect.width)??0,g=s!==p;p=s,s>0&&g&&r()});return o.observe(e),()=>o.disconnect()},[t,r]);const W=a.useCallback(e=>{i&&(typeof i=="function"?i(e):i.current=e),e!=null&&e.input&&e.input instanceof HTMLTextAreaElement&&(u.current=e.input,t&&setTimeout(r,0))},[i,t,r]),j=a.useMemo(()=>t?{rows:f,style:{...c?{maxHeight:c}:{},overflow:"hidden",height:R}}:{style:{height:T,...c?{maxHeight:c}:{},overflow:"auto"}},[t,f,c,T,R]),S=H.length,k=d?`${S}/${d}`:"",B=[...Array.isArray(w)?w:[w],...d?[{type:S>d?"error":"hint",text:k,position:"right",className:b.default(m.default["tedi-textarea__character-count"])}]:[]];return $.jsx(L.TextField,{...z,ref:W,"data-name":"textarea",inputClassName:b.default(m.default["tedi-textarea__input"],{[m.default["tedi-textarea__input--auto-grow"]]:t}),isTextArea:!0,className:b.default(m.default["tedi-textarea"],_),value:H,onChange:O,onChangeEvent:y,helper:B,input:j})});M.displayName="Textarea";exports.Textarea=M;
|
|
@@ -1,93 +1,102 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import a, { forwardRef as
|
|
1
|
+
import { jsx as j } from "react/jsx-runtime";
|
|
2
|
+
import v from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import a, { forwardRef as q, useRef as G, useEffect as b } from "react";
|
|
4
4
|
import { TextField as P } from "../textfield/textfield.es.js";
|
|
5
|
-
import
|
|
6
|
-
const Y =
|
|
5
|
+
import x from "./textarea.module.scss.es.js";
|
|
6
|
+
const Y = q((_, i) => {
|
|
7
7
|
const {
|
|
8
|
-
className:
|
|
9
|
-
helper:
|
|
10
|
-
characterLimit:
|
|
11
|
-
onChange:
|
|
12
|
-
onChangeEvent:
|
|
13
|
-
value:
|
|
14
|
-
defaultValue:
|
|
8
|
+
className: z,
|
|
9
|
+
helper: w = [],
|
|
10
|
+
characterLimit: h,
|
|
11
|
+
onChange: l,
|
|
12
|
+
onChangeEvent: y,
|
|
13
|
+
value: p,
|
|
14
|
+
defaultValue: M,
|
|
15
15
|
autoGrow: e = !1,
|
|
16
|
-
minRows:
|
|
17
|
-
maxRows:
|
|
18
|
-
height:
|
|
19
|
-
maxHeight:
|
|
20
|
-
...
|
|
21
|
-
} =
|
|
16
|
+
minRows: f = 3,
|
|
17
|
+
maxRows: C = 12,
|
|
18
|
+
height: R = "7.5rem",
|
|
19
|
+
maxHeight: c,
|
|
20
|
+
...A
|
|
21
|
+
} = _, [T, W] = a.useState(M ?? ""), u = G(null), [F, k] = a.useState("auto"), B = a.useCallback(
|
|
22
22
|
(t) => {
|
|
23
|
-
!
|
|
23
|
+
!p && !(l || y) && W(t), l == null || l(t);
|
|
24
24
|
},
|
|
25
|
-
[
|
|
26
|
-
),
|
|
25
|
+
[p, l, y]
|
|
26
|
+
), H = a.useMemo(() => p ?? T, [p, T]), r = a.useCallback(() => {
|
|
27
27
|
if (!e || !u.current) return;
|
|
28
|
-
const t = u.current,
|
|
28
|
+
const t = u.current, d = t.style.overflow;
|
|
29
29
|
t.style.overflow = "hidden";
|
|
30
|
-
const
|
|
31
|
-
let
|
|
32
|
-
isNaN(
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
S(() => {
|
|
30
|
+
const o = window.getComputedStyle(t);
|
|
31
|
+
let n = parseFloat(o.lineHeight);
|
|
32
|
+
isNaN(n) && (n = (parseFloat(o.fontSize) || 16) * 1.5);
|
|
33
|
+
const s = parseFloat(o.paddingTop), m = parseFloat(o.paddingBottom), g = o.boxSizing === "border-box" ? (parseFloat(o.borderTopWidth) || 0) + (parseFloat(o.borderBottomWidth) || 0) : 0;
|
|
34
|
+
t.style.height = "auto";
|
|
35
|
+
const $ = t.scrollHeight - s - m, L = Math.ceil(($ - 1) / n), S = `${Math.min(Math.max(L, f), C) * n + s + m + g}px`;
|
|
36
|
+
t.style.height = S, k(S), t.style.overflow = d, t.style.overflowY = t.scrollHeight - t.clientHeight > 1 ? "auto" : "hidden";
|
|
37
|
+
}, [e, f, C]);
|
|
38
|
+
b(() => {
|
|
40
39
|
e && requestAnimationFrame(() => {
|
|
41
|
-
|
|
40
|
+
r();
|
|
42
41
|
});
|
|
43
|
-
}, [
|
|
44
|
-
e && u.current &&
|
|
45
|
-
}, [e,
|
|
46
|
-
|
|
42
|
+
}, [H, e, r]), b(() => {
|
|
43
|
+
e && u.current && r();
|
|
44
|
+
}, [e, r]), b(() => {
|
|
45
|
+
const t = u.current;
|
|
46
|
+
if (!e || !t || typeof ResizeObserver > "u") return;
|
|
47
|
+
let d = t.clientWidth;
|
|
48
|
+
const o = new ResizeObserver((n) => {
|
|
49
|
+
var g;
|
|
50
|
+
const s = ((g = n[0]) == null ? void 0 : g.contentRect.width) ?? 0, m = s !== d;
|
|
51
|
+
d = s, s > 0 && m && r();
|
|
52
|
+
});
|
|
53
|
+
return o.observe(t), () => o.disconnect();
|
|
54
|
+
}, [e, r]);
|
|
55
|
+
const E = a.useCallback(
|
|
47
56
|
(t) => {
|
|
48
|
-
|
|
57
|
+
i && (typeof i == "function" ? i(t) : i.current = t), t != null && t.input && t.input instanceof HTMLTextAreaElement && (u.current = t.input, e && setTimeout(r, 0));
|
|
49
58
|
},
|
|
50
|
-
[
|
|
51
|
-
),
|
|
52
|
-
rows:
|
|
59
|
+
[i, e, r]
|
|
60
|
+
), I = a.useMemo(() => e ? {
|
|
61
|
+
rows: f,
|
|
53
62
|
style: {
|
|
54
|
-
...
|
|
63
|
+
...c ? { maxHeight: c } : {},
|
|
55
64
|
overflow: "hidden",
|
|
56
|
-
height:
|
|
65
|
+
height: F
|
|
57
66
|
}
|
|
58
67
|
} : {
|
|
59
68
|
style: {
|
|
60
|
-
height:
|
|
61
|
-
...
|
|
69
|
+
height: R,
|
|
70
|
+
...c ? { maxHeight: c } : {},
|
|
62
71
|
overflow: "auto"
|
|
63
72
|
}
|
|
64
|
-
}, [e,
|
|
65
|
-
...Array.isArray(
|
|
66
|
-
...
|
|
73
|
+
}, [e, f, c, R, F]), N = H.length, O = h ? `${N}/${h}` : "", V = [
|
|
74
|
+
...Array.isArray(w) ? w : [w],
|
|
75
|
+
...h ? [
|
|
67
76
|
{
|
|
68
|
-
type:
|
|
69
|
-
text:
|
|
77
|
+
type: N > h ? "error" : "hint",
|
|
78
|
+
text: O,
|
|
70
79
|
position: "right",
|
|
71
|
-
className:
|
|
80
|
+
className: v(x["tedi-textarea__character-count"])
|
|
72
81
|
}
|
|
73
82
|
] : []
|
|
74
83
|
];
|
|
75
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ j(
|
|
76
85
|
P,
|
|
77
86
|
{
|
|
78
|
-
...
|
|
79
|
-
ref:
|
|
87
|
+
...A,
|
|
88
|
+
ref: E,
|
|
80
89
|
"data-name": "textarea",
|
|
81
|
-
inputClassName:
|
|
82
|
-
[
|
|
90
|
+
inputClassName: v(x["tedi-textarea__input"], {
|
|
91
|
+
[x["tedi-textarea__input--auto-grow"]]: e
|
|
83
92
|
}),
|
|
84
93
|
isTextArea: !0,
|
|
85
|
-
className:
|
|
86
|
-
value:
|
|
87
|
-
onChange:
|
|
88
|
-
onChangeEvent:
|
|
89
|
-
helper:
|
|
90
|
-
input:
|
|
94
|
+
className: v(x["tedi-textarea"], z),
|
|
95
|
+
value: H,
|
|
96
|
+
onChange: B,
|
|
97
|
+
onChangeEvent: y,
|
|
98
|
+
helper: V,
|
|
99
|
+
input: I
|
|
91
100
|
}
|
|
92
101
|
);
|
|
93
102
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),x=require("../../../../../../../external/classnames/index.cjs.js"),p=require("react"),D=require("../../../../misc/separator/separator.cjs.js"),G=require("../../table-of-contents.cjs.js"),o=require("../../table-of-contents.module.scss.cjs.js"),H=8,j=n=>{let e=(n==null?void 0:n.parentElement)??null;for(;e&&e!==document.body&&e!==document.documentElement;){const{overflowY:t}=window.getComputedStyle(e);if((t==="auto"||t==="scroll"||t==="overlay")&&e.scrollHeight>e.clientHeight)return e;e=e.parentElement}return null},y=(n,e,t,l,c=H)=>n<t+c?n-t-c:e>l-c?e-l+c:0,m=({node:n,depth:e,index:t,numberPrefix:l})=>{const{activeId:c,numbered:f,activeTrail:O,defaultOpen:N,scrollActiveIntoView:_,activeIdChanged:h}=p.useContext(G.TableOfContentsContext),{id:i,content:q,children:d,separator:M,slot:w}=n,$=!!(d!=null&&d.length),u=!!i&&i===c,A=$&&(N||!!i&&O.has(i)),E=Math.min(e,2),R=p.useRef(null);p.useEffect(()=>{var S;if(!_||!u||!h)return;const a=R.current;if(!a)return;const r=j(a);if(!r||typeof r.scrollBy!="function")return;const v=a.getBoundingClientRect(),C=r.getBoundingClientRect(),g=y(v.top,v.bottom,C.top,C.bottom);if(g===0)return;const I=typeof window<"u"&&((S=window.matchMedia)==null?void 0:S.call(window,"(prefers-reduced-motion: reduce)").matches);r.scrollBy({top:g,behavior:I?"auto":"smooth"})},[_,u,h]);const b=l?`${l}.${t+1}`:`${t+1}`,T=l?b:`${b}.`,B=f?"ol":"ul";return s.jsxs("li",{"aria-current":u?"location":void 0,className:x.default(o.default["tedi-table-of-contents__item"],{[o.default["tedi-table-of-contents__item--selected"]]:u}),children:[s.jsxs("div",{ref:R,className:x.default(o.default["tedi-table-of-contents__row"],o.default[`tedi-table-of-contents__row--level-${E}`]),children:[f&&s.jsx("span",{className:o.default["tedi-table-of-contents__number"],"aria-hidden":"true",children:T}),s.jsx("span",{className:o.default["tedi-table-of-contents__content"],children:q}),w!==void 0&&s.jsx("div",{className:o.default["tedi-table-of-contents__slot"],children:w})]}),A&&s.jsx(B,{className:o.default["tedi-table-of-contents__group"],children:d.map((a,r)=>s.jsx(m,{node:a,depth:e+1,index:r,numberPrefix:f?b:void 0},a.id??r))}),M&&s.jsx(D.Separator,{className:o.default["tedi-table-of-contents__separator"]})]})};m.displayName="TableOfContentsRow";exports.TableOfContentsRow=m;exports.getRowScrollDelta=y;exports.getScrollableAncestor=j;
|
|
@@ -6,6 +6,18 @@ interface TableOfContentsRowProps {
|
|
|
6
6
|
/** Parent's number (e.g. `'2'`) for building hierarchical ordinals like `2.1`. */
|
|
7
7
|
numberPrefix?: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Nearest scrollable ancestor that is a real in-page container (never `body` / `documentElement`),
|
|
11
|
+
* so bringing the active row into view scrolls only the table-of-contents' own scroll area and can
|
|
12
|
+
* never scroll the whole document. Returns `null` when no such container exists.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getScrollableAncestor: (element: HTMLElement | null) => HTMLElement | null;
|
|
15
|
+
/**
|
|
16
|
+
* Minimal vertical scroll (with an {@link SCROLL_MARGIN}px margin) to bring the row's
|
|
17
|
+
* `[top, bottom]` band inside the container's `[top, bottom]` band. Returns `0` when the row is
|
|
18
|
+
* already visible — "nearest" semantics: scroll up if it's above, down if it's below, else nothing.
|
|
19
|
+
*/
|
|
20
|
+
export declare const getRowScrollDelta: (rowTop: number, rowBottom: number, containerTop: number, containerBottom: number, margin?: number) => number;
|
|
9
21
|
export declare const TableOfContentsRow: {
|
|
10
22
|
({ node, depth, index, numberPrefix }: TableOfContentsRowProps): JSX.Element;
|
|
11
23
|
displayName: string;
|
|
@@ -1,40 +1,70 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { Separator as
|
|
5
|
-
import { TableOfContentsContext as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as N, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import g from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useContext as G, useRef as H, useEffect as L } from "react";
|
|
4
|
+
import { Separator as T } from "../../../../misc/separator/separator.es.js";
|
|
5
|
+
import { TableOfContentsContext as D } from "../../table-of-contents.es.js";
|
|
6
|
+
import o from "../../table-of-contents.module.scss.es.js";
|
|
7
|
+
const V = 8, Y = (n) => {
|
|
8
|
+
let t = (n == null ? void 0 : n.parentElement) ?? null;
|
|
9
|
+
for (; t && t !== document.body && t !== document.documentElement; ) {
|
|
10
|
+
const { overflowY: e } = window.getComputedStyle(t);
|
|
11
|
+
if ((e === "auto" || e === "scroll" || e === "overlay") && t.scrollHeight > t.clientHeight) return t;
|
|
12
|
+
t = t.parentElement;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}, k = (n, t, e, s, c = V) => n < e + c ? n - e - c : t > s - c ? t - s + c : 0, y = ({ node: n, depth: t, index: e, numberPrefix: s }) => {
|
|
16
|
+
const { activeId: c, numbered: f, activeTrail: S, defaultOpen: O, scrollActiveIntoView: p, activeIdChanged: b } = G(D), { id: i, content: $, children: d, separator: E, slot: _ } = n, M = !!(d != null && d.length), u = !!i && i === c, x = M && (O || !!i && S.has(i)), A = Math.min(t, 2), h = H(null);
|
|
17
|
+
L(() => {
|
|
18
|
+
var C;
|
|
19
|
+
if (!p || !u || !b) return;
|
|
20
|
+
const l = h.current;
|
|
21
|
+
if (!l) return;
|
|
22
|
+
const r = Y(l);
|
|
23
|
+
if (!r || typeof r.scrollBy != "function") return;
|
|
24
|
+
const w = l.getBoundingClientRect(), v = r.getBoundingClientRect(), R = k(w.top, w.bottom, v.top, v.bottom);
|
|
25
|
+
if (R === 0) return;
|
|
26
|
+
const j = typeof window < "u" && ((C = window.matchMedia) == null ? void 0 : C.call(window, "(prefers-reduced-motion: reduce)").matches);
|
|
27
|
+
r.scrollBy({ top: R, behavior: j ? "auto" : "smooth" });
|
|
28
|
+
}, [p, u, b]);
|
|
29
|
+
const m = s ? `${s}.${e + 1}` : `${e + 1}`, B = s ? m : `${m}.`, I = f ? "ol" : "ul";
|
|
30
|
+
return /* @__PURE__ */ N(
|
|
10
31
|
"li",
|
|
11
32
|
{
|
|
12
|
-
"aria-current":
|
|
13
|
-
className:
|
|
14
|
-
[
|
|
33
|
+
"aria-current": u ? "location" : void 0,
|
|
34
|
+
className: g(o["tedi-table-of-contents__item"], {
|
|
35
|
+
[o["tedi-table-of-contents__item--selected"]]: u
|
|
15
36
|
}),
|
|
16
37
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
/* @__PURE__ */ e("span", { className: t["tedi-table-of-contents__content"], children: C }),
|
|
20
|
-
c !== void 0 && /* @__PURE__ */ e("div", { className: t["tedi-table-of-contents__slot"], children: c })
|
|
21
|
-
] }),
|
|
22
|
-
w && /* @__PURE__ */ e(g, { className: t["tedi-table-of-contents__group"], children: n.map((m, f) => /* @__PURE__ */ e(
|
|
23
|
-
b,
|
|
38
|
+
/* @__PURE__ */ N(
|
|
39
|
+
"div",
|
|
24
40
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
ref: h,
|
|
42
|
+
className: g(o["tedi-table-of-contents__row"], o[`tedi-table-of-contents__row--level-${A}`]),
|
|
43
|
+
children: [
|
|
44
|
+
f && /* @__PURE__ */ a("span", { className: o["tedi-table-of-contents__number"], "aria-hidden": "true", children: B }),
|
|
45
|
+
/* @__PURE__ */ a("span", { className: o["tedi-table-of-contents__content"], children: $ }),
|
|
46
|
+
_ !== void 0 && /* @__PURE__ */ a("div", { className: o["tedi-table-of-contents__slot"], children: _ })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
x && /* @__PURE__ */ a(I, { className: o["tedi-table-of-contents__group"], children: d.map((l, r) => /* @__PURE__ */ a(
|
|
51
|
+
y,
|
|
52
|
+
{
|
|
53
|
+
node: l,
|
|
54
|
+
depth: t + 1,
|
|
55
|
+
index: r,
|
|
56
|
+
numberPrefix: f ? m : void 0
|
|
29
57
|
},
|
|
30
|
-
|
|
58
|
+
l.id ?? r
|
|
31
59
|
)) }),
|
|
32
|
-
|
|
60
|
+
E && /* @__PURE__ */ a(T, { className: o["tedi-table-of-contents__separator"] })
|
|
33
61
|
]
|
|
34
62
|
}
|
|
35
63
|
);
|
|
36
64
|
};
|
|
37
|
-
|
|
65
|
+
y.displayName = "TableOfContentsRow";
|
|
38
66
|
export {
|
|
39
|
-
|
|
67
|
+
y as TableOfContentsRow,
|
|
68
|
+
k as getRowScrollDelta,
|
|
69
|
+
Y as getScrollableAncestor
|
|
40
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),I=require("../../../../../external/classnames/index.cjs.js"),s=require("react"),B=require("../../misc/affix/affix.cjs.js"),E=require("./components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js"),k=require("./components/table-of-contents-item/table-of-contents-item.cjs.js"),M=require("./components/table-of-contents-list/table-of-contents-list.cjs.js"),f=require("./table-of-contents.module.scss.cjs.js"),R=require("../../../providers/label-provider/use-labels.cjs.js"),V=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=require("../../content/card/card.cjs.js"),H=require("../../content/card/card-content/card-content.cjs.js"),A=s.createContext({activeTrail:new Set}),h=n=>s.isValidElement(n)&&n.type===k.TableOfContentsItem,m=n=>s.Children.toArray(n).filter(h).map(l=>{const{id:a,separator:i,slot:c,children:o}=l.props,t=s.Children.toArray(o),e=t.filter(h),d=t.filter(u=>!h(u));return{id:a,separator:i,slot:c,content:r.jsx(r.Fragment,{children:d}),children:e.length?m(o):void 0}}),N=(n,l)=>{const a=new Set;if(!l)return a;const i=(c,o)=>{for(const t of c){const e=t.id?[...o,t.id]:o;if(t.id===l||t.children&&i(t.children,e))return e.forEach(d=>a.add(d)),!0}return!1};return i(n,[]),a};function b(n){const{getLabel:l}=R.useLabels(),{getCurrentBreakpointProps:a}=V.useBreakpointProps(n.defaultServerBreakpoint),{children:i,heading:c,headingLevel:o="h3",ariaLabel:t,activeId:e,defaultOpen:d=!0,numbered:u=!1,sticky:p=!0,variant:v="default",bordered:L=!1,scrollActiveIntoView:x=!1,className:P}=a(n),S=c===void 0?l("table-of-contents.title"):c,C=s.useMemo(()=>m(i),[i]),T=s.useMemo(()=>N(C,e),[C,e]),O=s.useRef(e),g=O.current!==e;s.useEffect(()=>{O.current=e},[e]);const w=s.useMemo(()=>({activeId:e,numbered:u,headingLevel:o,ariaLabel:t,activeTrail:T,defaultOpen:d,scrollActiveIntoView:x,activeIdChanged:g}),[e,u,o,t,T,d,x,g]),q=r.jsx("div",{className:I.default(f.default["tedi-table-of-contents"],{[f.default["tedi-table-of-contents--transparent"]]:v==="transparent",[f.default["tedi-table-of-contents--bordered"]]:L}),children:r.jsx(M.TableOfContentsList,{nodes:C,heading:S})}),j=I.default({[f.default["tedi-table-of-contents--sticky"]]:p},P),y=v==="transparent"?r.jsx("div",{className:j,children:q}):r.jsx(F.Card,{className:j,children:r.jsx(H.CardContent,{padding:0,children:q})});return r.jsx(A.Provider,{value:w,children:p?r.jsx(B.Affix,{position:"sticky",top:1.5,bottom:1.5,children:y}):y})}b.displayName="TableOfContents";b.Item=k.TableOfContentsItem;b.Collapsible=E.TableOfContentsCollapsible;exports.TableOfContents=b;exports.TableOfContentsContext=A;exports.buildActiveTrail=N;exports.childrenToNodes=m;
|
|
@@ -17,6 +17,16 @@ type TableOfContentsBreakpointProps = {
|
|
|
17
17
|
* @default true
|
|
18
18
|
*/
|
|
19
19
|
sticky?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Keep the active item visible inside a scrollable table of contents. When the `activeId`
|
|
22
|
+
* changes, the active item's row is scrolled into view within the nearest scroll container
|
|
23
|
+
* (the sticky card, or a scrollable wrapper you provide) using "nearest" semantics — it only
|
|
24
|
+
* scrolls when the row is out of view, leaving ~8px of margin. Positions on the row itself,
|
|
25
|
+
* not its expanded children. Has no effect in non-scrollable layouts and respects
|
|
26
|
+
* `prefers-reduced-motion`.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
scrollActiveIntoView?: boolean;
|
|
20
30
|
};
|
|
21
31
|
export interface TableOfContentsProps extends BreakpointSupport<TableOfContentsBreakpointProps> {
|
|
22
32
|
/**
|
|
@@ -87,6 +97,13 @@ interface TableOfContentsContextValue {
|
|
|
87
97
|
ariaLabel?: string;
|
|
88
98
|
activeTrail: Set<string>;
|
|
89
99
|
defaultOpen?: boolean;
|
|
100
|
+
scrollActiveIntoView?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* True only on renders where `activeId` genuinely changed from its previously committed value
|
|
103
|
+
* (never on the initial render, including Strict Mode's mount-effect replay). Rows use it to
|
|
104
|
+
* scroll into view only on a real transition — not when a selected child first mounts on load.
|
|
105
|
+
*/
|
|
106
|
+
activeIdChanged?: boolean;
|
|
90
107
|
}
|
|
91
108
|
export declare const TableOfContentsContext: import('react').Context<TableOfContentsContextValue>;
|
|
92
109
|
export declare const childrenToNodes: (children: ReactNode) => TableOfContentsNode[];
|