@tedi-design-system/react 16.0.0-rc.2 → 16.0.0-rc.3
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/package.json +1 -1
- package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.es.js +61 -59
- package/src/tedi/components/form/choice-input.types.d.ts +5 -1
- package/src/tedi/components/form/radio/radio.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.es.js +55 -53
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),a=require("../../../../../external/classnames/index.cjs.js"),u=require("react"),p=require("../../base/icon/icon.cjs.js"),$=require("../feedback-text/feedback-text.cjs.js"),B=require("../form-label/form-label.cjs.js"),e=require("./checkbox.module.scss.cjs.js"),F=require("../../layout/grid/row.cjs.js"),j=require("../../layout/grid/col.cjs.js"),q=C=>{const{id:o,label:h,value:f,className:N,disabled:x=!1,onChange:d,hideLabel:g=!1,helper:i,checked:l,defaultChecked:y,indeterminate:s,hover:I,name:R,tooltip:b,invalid:v,size:r="default",required:w,...z}=C,[k,L]=u.useState(y||!1),_=u.useRef(null),n=u.useMemo(()=>s?"mixed":d&&typeof l<"u"?l:k,[s,d,l,k]),M=t=>{typeof l>"u"&&L(t==null?void 0:t.target.checked),d==null||d(f,t==null?void 0:t.target.checked)},m=i?i.id??`${o}-helper`:void 0,S=b?`${o}-tooltip`:void 0,T=a.default(e.default["tedi-checkbox__label"],{[e.default["tedi-checkbox--disabled"]]:x});return c.jsxs("div",{"data-name":"check",...z,children:[c.jsxs(F.Row,{gutter:0,children:[c.jsx(j.Col,{width:"auto",children:c.jsxs("div",{className:e.default["tedi-checkbox__outer-indicator-wrapper"],children:[c.jsx("input",{id:o,value:f,name:R,type:"checkbox",disabled:x,checked:n!=="mixed"?n:!1,"aria-checked":n,onChange:M,className:e.default["tedi-checkbox__input"],"aria-describedby":[m,S].filter(Boolean).join(" ")}),c.jsxs("div",{"aria-hidden":"true",onClick:()=>{var t;return(t=_.current)==null?void 0:t.click()},className:a.default(e.default["tedi-checkbox__indicator"],{[e.default["tedi-checkbox__indicator--hover"]]:I,[e.default["tedi-checkbox__indicator--indeterminate"]]:s,[e.default[`tedi-checkbox__indicator--size-${r}`]]:r,[e.default["tedi-checkbox__indicator--invalid"]]:v},N),"data-testid":"checkbox-indicator",children:[c.jsx(p.Icon,{size:r==="default"?16:18,name:"remove",className:a.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--indeterminate"])}),c.jsx(p.Icon,{size:r==="default"?16:18,name:"check",className:a.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--check"])})]})]})}),h&&c.jsx(j.Col,{children:c.jsx(B.FormLabel,{ref:_,className:T,id:o,"data-testid":"checkbox-label",hideLabel:g,label:h,tooltip:b,required:w})})]}),i&&c.jsx($.FeedbackText,{id:m,...i,className:a.default(e.default["tedi-checkbox__helper"],i.className)})]})};exports.Checkbox=q;exports.default=q;
|
|
@@ -1,84 +1,85 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as s, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import d from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { FeedbackText as
|
|
3
|
+
import m from "react";
|
|
4
|
+
import { Icon as N } from "../../base/icon/icon.es.js";
|
|
5
|
+
import { FeedbackText as q } from "../feedback-text/feedback-text.es.js";
|
|
6
6
|
import { FormLabel as E } from "../form-label/form-label.es.js";
|
|
7
7
|
import e from "./checkbox.module.scss.es.js";
|
|
8
8
|
import { Row as H } from "../../layout/grid/row.es.js";
|
|
9
|
-
import { Col as
|
|
10
|
-
const
|
|
9
|
+
import { Col as C } from "../../layout/grid/col.es.js";
|
|
10
|
+
const Q = (g) => {
|
|
11
11
|
const {
|
|
12
|
-
id:
|
|
13
|
-
label:
|
|
14
|
-
value:
|
|
15
|
-
className:
|
|
16
|
-
disabled:
|
|
17
|
-
onChange:
|
|
18
|
-
hideLabel:
|
|
19
|
-
helper:
|
|
20
|
-
checked:
|
|
21
|
-
defaultChecked:
|
|
22
|
-
indeterminate:
|
|
23
|
-
hover:
|
|
24
|
-
name:
|
|
25
|
-
tooltip:
|
|
26
|
-
invalid:
|
|
27
|
-
size:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
id: a,
|
|
13
|
+
label: k,
|
|
14
|
+
value: b,
|
|
15
|
+
className: y,
|
|
16
|
+
disabled: f = !1,
|
|
17
|
+
onChange: t,
|
|
18
|
+
hideLabel: z = !1,
|
|
19
|
+
helper: o,
|
|
20
|
+
checked: r,
|
|
21
|
+
defaultChecked: I,
|
|
22
|
+
indeterminate: n,
|
|
23
|
+
hover: R,
|
|
24
|
+
name: j,
|
|
25
|
+
tooltip: _,
|
|
26
|
+
invalid: w,
|
|
27
|
+
size: l = "default",
|
|
28
|
+
required: L,
|
|
29
|
+
...$
|
|
30
|
+
} = g, [p, v] = m.useState(I || !1), x = m.useRef(null), h = m.useMemo(() => n ? "mixed" : t && typeof r < "u" ? r : p, [n, t, r, p]), B = (c) => {
|
|
31
|
+
typeof r > "u" && v(c == null ? void 0 : c.target.checked), t == null || t(b, c == null ? void 0 : c.target.checked);
|
|
32
|
+
}, u = o ? o.id ?? `${a}-helper` : void 0, F = _ ? `${a}-tooltip` : void 0, M = d(e["tedi-checkbox__label"], { [e["tedi-checkbox--disabled"]]: f });
|
|
33
|
+
return /* @__PURE__ */ s("div", { "data-name": "check", ...$, children: [
|
|
34
|
+
/* @__PURE__ */ s(H, { gutter: 0, children: [
|
|
35
|
+
/* @__PURE__ */ i(C, { width: "auto", children: /* @__PURE__ */ s("div", { className: e["tedi-checkbox__outer-indicator-wrapper"], children: [
|
|
35
36
|
/* @__PURE__ */ i(
|
|
36
37
|
"input",
|
|
37
38
|
{
|
|
38
|
-
id:
|
|
39
|
-
value:
|
|
40
|
-
name:
|
|
39
|
+
id: a,
|
|
40
|
+
value: b,
|
|
41
|
+
name: j,
|
|
41
42
|
type: "checkbox",
|
|
42
|
-
disabled:
|
|
43
|
-
checked:
|
|
44
|
-
"aria-checked":
|
|
45
|
-
onChange:
|
|
43
|
+
disabled: f,
|
|
44
|
+
checked: h !== "mixed" ? h : !1,
|
|
45
|
+
"aria-checked": h,
|
|
46
|
+
onChange: B,
|
|
46
47
|
className: e["tedi-checkbox__input"],
|
|
47
|
-
"aria-describedby": [u,
|
|
48
|
+
"aria-describedby": [u, F].filter(Boolean).join(" ")
|
|
48
49
|
}
|
|
49
50
|
),
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ s(
|
|
51
52
|
"div",
|
|
52
53
|
{
|
|
53
54
|
"aria-hidden": "true",
|
|
54
55
|
onClick: () => {
|
|
55
56
|
var c;
|
|
56
|
-
return (c =
|
|
57
|
+
return (c = x.current) == null ? void 0 : c.click();
|
|
57
58
|
},
|
|
58
59
|
className: d(
|
|
59
60
|
e["tedi-checkbox__indicator"],
|
|
60
61
|
{
|
|
61
|
-
[e["tedi-checkbox__indicator--hover"]]:
|
|
62
|
-
[e["tedi-checkbox__indicator--indeterminate"]]:
|
|
63
|
-
[e[`tedi-checkbox__indicator--size-${
|
|
64
|
-
[e["tedi-checkbox__indicator--invalid"]]:
|
|
62
|
+
[e["tedi-checkbox__indicator--hover"]]: R,
|
|
63
|
+
[e["tedi-checkbox__indicator--indeterminate"]]: n,
|
|
64
|
+
[e[`tedi-checkbox__indicator--size-${l}`]]: l,
|
|
65
|
+
[e["tedi-checkbox__indicator--invalid"]]: w
|
|
65
66
|
},
|
|
66
|
-
|
|
67
|
+
y
|
|
67
68
|
),
|
|
68
69
|
"data-testid": "checkbox-indicator",
|
|
69
70
|
children: [
|
|
70
71
|
/* @__PURE__ */ i(
|
|
71
|
-
|
|
72
|
+
N,
|
|
72
73
|
{
|
|
73
|
-
size:
|
|
74
|
+
size: l === "default" ? 16 : 18,
|
|
74
75
|
name: "remove",
|
|
75
76
|
className: d(e["tedi-checkbox__icon"], e["tedi-checkbox__icon--indeterminate"])
|
|
76
77
|
}
|
|
77
78
|
),
|
|
78
79
|
/* @__PURE__ */ i(
|
|
79
|
-
|
|
80
|
+
N,
|
|
80
81
|
{
|
|
81
|
-
size:
|
|
82
|
+
size: l === "default" ? 16 : 18,
|
|
82
83
|
name: "check",
|
|
83
84
|
className: d(e["tedi-checkbox__icon"], e["tedi-checkbox__icon--check"])
|
|
84
85
|
}
|
|
@@ -87,23 +88,24 @@ const P = (y) => {
|
|
|
87
88
|
}
|
|
88
89
|
)
|
|
89
90
|
] }) }),
|
|
90
|
-
/* @__PURE__ */ i(
|
|
91
|
+
k && /* @__PURE__ */ i(C, { children: /* @__PURE__ */ i(
|
|
91
92
|
E,
|
|
92
93
|
{
|
|
93
|
-
ref:
|
|
94
|
-
className:
|
|
95
|
-
id:
|
|
94
|
+
ref: x,
|
|
95
|
+
className: M,
|
|
96
|
+
id: a,
|
|
96
97
|
"data-testid": "checkbox-label",
|
|
97
|
-
hideLabel:
|
|
98
|
-
label:
|
|
99
|
-
tooltip:
|
|
98
|
+
hideLabel: z,
|
|
99
|
+
label: k,
|
|
100
|
+
tooltip: _,
|
|
101
|
+
required: L
|
|
100
102
|
}
|
|
101
|
-
)
|
|
103
|
+
) })
|
|
102
104
|
] }),
|
|
103
|
-
|
|
105
|
+
o && /* @__PURE__ */ i(q, { id: u, ...o, className: d(e["tedi-checkbox__helper"], o.className) })
|
|
104
106
|
] });
|
|
105
107
|
};
|
|
106
108
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
Q as Checkbox,
|
|
110
|
+
Q as default
|
|
109
111
|
};
|
|
@@ -7,7 +7,7 @@ export interface ChoiceInputProps {
|
|
|
7
7
|
/**
|
|
8
8
|
* Label text
|
|
9
9
|
*/
|
|
10
|
-
label:
|
|
10
|
+
label: React.ReactNode;
|
|
11
11
|
/**
|
|
12
12
|
* Additional classes.
|
|
13
13
|
*/
|
|
@@ -60,4 +60,8 @@ export interface ChoiceInputProps {
|
|
|
60
60
|
* Whether the input is marked as invalid.
|
|
61
61
|
*/
|
|
62
62
|
invalid?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the input is marked as required.
|
|
65
|
+
*/
|
|
66
|
+
required?: boolean;
|
|
63
67
|
}
|
|
@@ -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=require("react/jsx-runtime"),l=require("../../../../../external/classnames/index.cjs.js"),s=require("react"),T=require("../feedback-text/feedback-text.cjs.js"),$=require("../form-label/form-label.cjs.js"),i=require("./radio.module.scss.cjs.js"),z=require("../../layout/grid/row.cjs.js"),p=require("../../layout/grid/col.cjs.js"),x=j=>{const{id:r,label:c,value:n,className:k,disabled:u,onChange:a,hideLabel:q,helper:t,checked:o,defaultChecked:C,hover:g,name:N,tooltip:f,size:h="default",invalid:R,required:y,...w}=j,[_,L]=s.useState(C||!1),b=s.useRef(null),M=s.useMemo(()=>a&&typeof o<"u"?o:_,[a,_,o]),v=e=>{typeof o>"u"&&L(e==null?void 0:e.target.checked),a==null||a(n,e==null?void 0:e.target.checked)},m=t?t.id??`${r}-helper`:void 0,I=f?`${r}-tooltip`:void 0,S=l.default(i.default["tedi-radio__label"],{[i.default["tedi-radio--disabled"]]:u});return d.jsxs("div",{"data-name":"radio",...w,children:[d.jsxs(z.Row,{gutter:0,children:[d.jsx(p.Col,{width:"auto",children:d.jsxs("div",{className:i.default["tedi-radio__outer-indicator-wrapper"],children:[d.jsx("input",{id:r,value:n,name:N,type:"radio",disabled:u,checked:M,onChange:v,className:i.default["tedi-radio__input"],"aria-describedby":[m,I].filter(Boolean).join(" ")}),d.jsx("div",{"aria-hidden":"true",onClick:()=>{var e;return(e=b.current)==null?void 0:e.click()},className:l.default(i.default["tedi-radio__indicator"],{[i.default["tedi-radio__indicator--hover"]]:g},{[i.default[`tedi-radio__indicator--size-${h}`]]:h},{[i.default["tedi-radio__indicator--invalid"]]:R},k),"data-testid":"radio-indicator"})]})}),c&&d.jsx(p.Col,{children:d.jsx($.FormLabel,{ref:b,className:S,id:r,"data-testid":"radio-label",hideLabel:q,label:c,tooltip:f,required:y})})]}),t&&d.jsx(T.FeedbackText,{id:m,...t,className:l.default(i.default["tedi-radio__helper"],t.className)})]})};exports.Radio=x;exports.default=x;
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { FeedbackText as
|
|
5
|
-
import { FormLabel as
|
|
1
|
+
import { jsxs as l, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import c from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import s from "react";
|
|
4
|
+
import { FeedbackText as M } from "../feedback-text/feedback-text.es.js";
|
|
5
|
+
import { FormLabel as q } from "../form-label/form-label.es.js";
|
|
6
6
|
import i from "./radio.module.scss.es.js";
|
|
7
7
|
import { Row as v } from "../../layout/grid/row.es.js";
|
|
8
|
-
import { Col as
|
|
9
|
-
const
|
|
8
|
+
import { Col as k } from "../../layout/grid/col.es.js";
|
|
9
|
+
const K = (N) => {
|
|
10
10
|
const {
|
|
11
|
-
id:
|
|
12
|
-
label:
|
|
13
|
-
value:
|
|
14
|
-
className:
|
|
15
|
-
disabled:
|
|
16
|
-
onChange:
|
|
17
|
-
hideLabel:
|
|
18
|
-
helper:
|
|
19
|
-
checked:
|
|
20
|
-
defaultChecked:
|
|
21
|
-
hover:
|
|
22
|
-
name:
|
|
11
|
+
id: o,
|
|
12
|
+
label: n,
|
|
13
|
+
value: m,
|
|
14
|
+
className: C,
|
|
15
|
+
disabled: h,
|
|
16
|
+
onChange: a,
|
|
17
|
+
hideLabel: g,
|
|
18
|
+
helper: r,
|
|
19
|
+
checked: t,
|
|
20
|
+
defaultChecked: y,
|
|
21
|
+
hover: R,
|
|
22
|
+
name: x,
|
|
23
23
|
tooltip: p,
|
|
24
|
-
size:
|
|
25
|
-
invalid:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
size: f = "default",
|
|
25
|
+
invalid: j,
|
|
26
|
+
required: w,
|
|
27
|
+
...I
|
|
28
|
+
} = N, [u, L] = s.useState(y || !1), _ = s.useRef(null), $ = s.useMemo(() => a && typeof t < "u" ? t : u, [a, u, t]), z = (e) => {
|
|
29
|
+
typeof t > "u" && L(e == null ? void 0 : e.target.checked), a == null || a(m, e == null ? void 0 : e.target.checked);
|
|
30
|
+
}, b = r ? r.id ?? `${o}-helper` : void 0, B = p ? `${o}-tooltip` : void 0, F = c(i["tedi-radio__label"], { [i["tedi-radio--disabled"]]: h });
|
|
31
|
+
return /* @__PURE__ */ l("div", { "data-name": "radio", ...I, children: [
|
|
32
|
+
/* @__PURE__ */ l(v, { gutter: 0, children: [
|
|
33
|
+
/* @__PURE__ */ d(k, { width: "auto", children: /* @__PURE__ */ l("div", { className: i["tedi-radio__outer-indicator-wrapper"], children: [
|
|
33
34
|
/* @__PURE__ */ d(
|
|
34
35
|
"input",
|
|
35
36
|
{
|
|
36
|
-
id:
|
|
37
|
-
value:
|
|
38
|
-
name:
|
|
37
|
+
id: o,
|
|
38
|
+
value: m,
|
|
39
|
+
name: x,
|
|
39
40
|
type: "radio",
|
|
40
|
-
disabled:
|
|
41
|
-
checked:
|
|
42
|
-
onChange:
|
|
41
|
+
disabled: h,
|
|
42
|
+
checked: $,
|
|
43
|
+
onChange: z,
|
|
43
44
|
className: i["tedi-radio__input"],
|
|
44
|
-
"aria-describedby": [b,
|
|
45
|
+
"aria-describedby": [b, B].filter(Boolean).join(" ")
|
|
45
46
|
}
|
|
46
47
|
),
|
|
47
48
|
/* @__PURE__ */ d(
|
|
@@ -50,36 +51,37 @@ const J = (C) => {
|
|
|
50
51
|
"aria-hidden": "true",
|
|
51
52
|
onClick: () => {
|
|
52
53
|
var e;
|
|
53
|
-
return (e =
|
|
54
|
+
return (e = _.current) == null ? void 0 : e.click();
|
|
54
55
|
},
|
|
55
|
-
className:
|
|
56
|
+
className: c(
|
|
56
57
|
i["tedi-radio__indicator"],
|
|
57
|
-
{ [i["tedi-radio__indicator--hover"]]:
|
|
58
|
-
{ [i[`tedi-radio__indicator--size-${
|
|
59
|
-
{ [i["tedi-radio__indicator--invalid"]]:
|
|
60
|
-
|
|
58
|
+
{ [i["tedi-radio__indicator--hover"]]: R },
|
|
59
|
+
{ [i[`tedi-radio__indicator--size-${f}`]]: f },
|
|
60
|
+
{ [i["tedi-radio__indicator--invalid"]]: j },
|
|
61
|
+
C
|
|
61
62
|
),
|
|
62
63
|
"data-testid": "radio-indicator"
|
|
63
64
|
}
|
|
64
65
|
)
|
|
65
66
|
] }) }),
|
|
66
|
-
/* @__PURE__ */ d(
|
|
67
|
-
|
|
67
|
+
n && /* @__PURE__ */ d(k, { children: /* @__PURE__ */ d(
|
|
68
|
+
q,
|
|
68
69
|
{
|
|
69
|
-
ref:
|
|
70
|
-
className:
|
|
71
|
-
id:
|
|
70
|
+
ref: _,
|
|
71
|
+
className: F,
|
|
72
|
+
id: o,
|
|
72
73
|
"data-testid": "radio-label",
|
|
73
|
-
hideLabel:
|
|
74
|
-
label:
|
|
75
|
-
tooltip: p
|
|
74
|
+
hideLabel: g,
|
|
75
|
+
label: n,
|
|
76
|
+
tooltip: p,
|
|
77
|
+
required: w
|
|
76
78
|
}
|
|
77
|
-
)
|
|
79
|
+
) })
|
|
78
80
|
] }),
|
|
79
|
-
|
|
81
|
+
r && /* @__PURE__ */ d(M, { id: b, ...r, className: c(i["tedi-radio__helper"], r.className) })
|
|
80
82
|
] });
|
|
81
83
|
};
|
|
82
84
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
K as Radio,
|
|
86
|
+
K as default
|
|
85
87
|
};
|