@tedi-design-system/react 19.2.0-rc.6 → 19.2.0-rc.7
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/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/package.json +1 -1
- package/src/tedi/components/content/label/label.cjs.js +1 -1
- package/src/tedi/components/content/label/label.d.ts +22 -0
- package/src/tedi/components/content/label/label.es.js +30 -28
- package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.es.js +32 -30
- package/src/tedi/components/form/choice-group/choice-group.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/choice-group.es.js +80 -69
- package/src/tedi/components/form/choice-input.types.d.ts +7 -0
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +5 -0
- package/src/tedi/components/form/date-field/date-field.es.js +187 -184
- package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -1
- package/src/tedi/components/form/date-time-field/date-time-field.d.ts +5 -0
- package/src/tedi/components/form/date-time-field/date-time-field.es.js +103 -101
- package/src/tedi/components/form/form-label/form-label.cjs.js +1 -1
- package/src/tedi/components/form/form-label/form-label.d.ts +9 -0
- package/src/tedi/components/form/form-label/form-label.es.js +15 -14
- package/src/tedi/components/form/multi-value-field/multi-value-field.cjs.js +1 -1
- package/src/tedi/components/form/multi-value-field/multi-value-field.d.ts +7 -0
- package/src/tedi/components/form/multi-value-field/multi-value-field.es.js +41 -40
- package/src/tedi/components/form/number-field/number-field.cjs.js +1 -1
- package/src/tedi/components/form/number-field/number-field.es.js +54 -43
- package/src/tedi/components/form/radio/radio.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.es.js +30 -28
- package/src/tedi/components/form/select/select.cjs.js +1 -1
- package/src/tedi/components/form/select/select.es.js +79 -77
- package/src/tedi/components/form/slider/slider.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.d.ts +7 -0
- package/src/tedi/components/form/slider/slider.es.js +48 -47
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +72 -61
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.d.ts +5 -0
- package/src/tedi/components/form/time-field/time-field.es.js +87 -85
- package/src/tedi/components/form/toggle/toggle.cjs.js +1 -1
- package/src/tedi/components/form/toggle/toggle.d.ts +7 -0
- package/src/tedi/components/form/toggle/toggle.es.js +26 -24
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.cjs2.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.cjs2.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.cjs4.js"),r=require("./cjs/react-is.production.min.cjs.js"),o=require("./cjs/react-is.development.cjs.js");process.env.NODE_ENV==="production"?e.__module.exports=r.__require():e.__module.exports=o.__require();var t=e.__module.exports;exports.reactIsExports=t;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as r } from "../../../../_virtual/index.
|
|
1
|
+
import { __module as r } from "../../../../_virtual/index.es4.js";
|
|
2
2
|
import { __require as e } from "./cjs/react-is.production.min.es.js";
|
|
3
3
|
import { __require as o } from "./cjs/react-is.development.es.js";
|
|
4
4
|
process.env.NODE_ENV === "production" ? r.exports = e() : r.exports = o();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.cjs.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.cjs.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.cjs3.js"),t=require("./cjs/react-is.production.min.cjs.js"),o=require("./cjs/react-is.development.cjs.js");var r;function u(){return r||(r=1,process.env.NODE_ENV==="production"?e.__module.exports=t.__require():e.__module.exports=o.__require()),e.__module.exports}exports.__require=u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as e } from "../../../../_virtual/index.
|
|
1
|
+
import { __module as e } from "../../../../_virtual/index.es3.js";
|
|
2
2
|
import { __require as o } from "./cjs/react-is.production.min.es.js";
|
|
3
3
|
import { __require as t } from "./cjs/react-is.development.es.js";
|
|
4
4
|
var r;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tedi-design-system/react",
|
|
3
|
-
"version": "19.2.0-rc.
|
|
3
|
+
"version": "19.2.0-rc.7",
|
|
4
4
|
"description": "TEDI Design System React component library — accessible, reusable UI components. Docs & live examples: https://storybook.tedi.ee/react/rc/",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),j=require("../../../../../external/classnames/index.cjs.js"),_=require("react"),B=require("../../overlays/tooltip/info-tooltip.cjs.js"),e=require("./label.module.scss.cjs.js"),N=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),o=_.forwardRef((r,d)=>{const{getCurrentBreakpointProps:u}=N.useBreakpointProps(r.defaultServerBreakpoint),{as:c="label",children:p,className:b,isBold:f,isSmall:s,modifiers:t,required:m,tooltip:i,...q}=u(r),a=typeof t=="string"?[t]:t,x=j.default(e.default["tedi-label"],f&&e.default["tedi-label--bold"],s&&e.default["tedi-label--small"],a==null?void 0:a.map(h=>`text-${h}`),b),n=l.jsxs(c,{ref:d,className:x,...q,children:[p,m&&l.jsx("span",{className:e.default["tedi-label__required"],"aria-hidden":"true",children:"*"})]});return i?l.jsxs("span",{className:e.default["tedi-label__wrapper"],children:[n,l.jsx("span",{className:e.default["tedi-label__info"],children:l.jsx(B.InfoTooltip,{isSmall:s,children:i})})]}):n});o.displayName="Label";exports.Label=o;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { ElementType, LabelHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { BreakpointSupport } from '../../../helpers';
|
|
3
|
+
import { TextModifiers } from '../../base/typography/text/text';
|
|
4
|
+
/**
|
|
5
|
+
* Subset of {@link TextModifiers} that is meaningful for a label. `.tedi-label` is
|
|
6
|
+
* `display: inline`, so text-alignment (`center`/`left`/`right`) and `::first-letter`
|
|
7
|
+
* (`capitalize-first`) have no effect and are intentionally excluded — only wrapping,
|
|
8
|
+
* text-transform and italic controls that actually apply to inline text remain.
|
|
9
|
+
*/
|
|
10
|
+
export type LabelModifiers = Extract<TextModifiers, 'nowrap' | 'break-all' | 'break-word' | 'break-spaces' | 'italic' | 'uppercase' | 'lowercase' | 'capitalize'>;
|
|
11
|
+
/**
|
|
12
|
+
* Breakpoint-aware `modifiers` for a label, so consumers can vary wrapping responsively
|
|
13
|
+
* (e.g. `{ modifiers: 'nowrap', sm: { modifiers: 'break-word' } }`).
|
|
14
|
+
*/
|
|
15
|
+
export type LabelModifierProps = BreakpointSupport<{
|
|
16
|
+
modifiers?: LabelModifiers[] | LabelModifiers;
|
|
17
|
+
}>;
|
|
3
18
|
type LabelBreakpointProps = {
|
|
4
19
|
/**
|
|
5
20
|
* If true, applies a bold font weight to the label text.
|
|
@@ -11,6 +26,13 @@ type LabelBreakpointProps = {
|
|
|
11
26
|
* @default false
|
|
12
27
|
*/
|
|
13
28
|
isSmall?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Text modifiers that control how the label text is rendered, e.g. wrapping and
|
|
31
|
+
* line-breaking behavior (`'nowrap'`, `'break-word'`, `'break-all'`, `'break-spaces'`).
|
|
32
|
+
* Reuses the same modifiers as the `Text` component. Useful to prevent long labels
|
|
33
|
+
* from breaking across multiple lines and distorting form layouts.
|
|
34
|
+
*/
|
|
35
|
+
modifiers?: LabelModifiers[] | LabelModifiers;
|
|
14
36
|
};
|
|
15
37
|
export interface LabelProps extends BreakpointSupport<LabelBreakpointProps>, LabelHTMLAttributes<HTMLLabelElement | HTMLSpanElement> {
|
|
16
38
|
/**
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { InfoTooltip as
|
|
1
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import B from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { forwardRef as x } from "react";
|
|
4
|
+
import { InfoTooltip as k } from "../../overlays/tooltip/info-tooltip.es.js";
|
|
5
5
|
import e from "./label.module.scss.es.js";
|
|
6
|
-
import { useBreakpointProps as
|
|
7
|
-
const
|
|
8
|
-
const { getCurrentBreakpointProps:
|
|
9
|
-
as:
|
|
10
|
-
children:
|
|
11
|
-
className:
|
|
12
|
-
isBold:
|
|
13
|
-
isSmall:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
import { useBreakpointProps as E } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
7
|
+
const g = x((t, m) => {
|
|
8
|
+
const { getCurrentBreakpointProps: d } = E(t.defaultServerBreakpoint), {
|
|
9
|
+
as: p = "label",
|
|
10
|
+
children: c,
|
|
11
|
+
className: f,
|
|
12
|
+
isBold: b,
|
|
13
|
+
isSmall: s,
|
|
14
|
+
modifiers: l,
|
|
15
|
+
required: u,
|
|
16
|
+
tooltip: i,
|
|
17
|
+
...h
|
|
18
|
+
} = d(t), r = typeof l == "string" ? [l] : l, N = B(
|
|
18
19
|
e["tedi-label"],
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
b && e["tedi-label--bold"],
|
|
21
|
+
s && e["tedi-label--small"],
|
|
22
|
+
r == null ? void 0 : r.map((_) => `text-${_}`),
|
|
23
|
+
f
|
|
24
|
+
), o = /* @__PURE__ */ n(p, { ref: m, className: N, ...h, children: [
|
|
25
|
+
c,
|
|
26
|
+
u && /* @__PURE__ */ a("span", { className: e["tedi-label__required"], "aria-hidden": "true", children: "*" })
|
|
25
27
|
] });
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
] }) :
|
|
28
|
+
return i ? /* @__PURE__ */ n("span", { className: e["tedi-label__wrapper"], children: [
|
|
29
|
+
o,
|
|
30
|
+
/* @__PURE__ */ a("span", { className: e["tedi-label__info"], children: /* @__PURE__ */ a(k, { isSmall: s, children: i }) })
|
|
31
|
+
] }) : o;
|
|
30
32
|
});
|
|
31
|
-
|
|
33
|
+
g.displayName = "Label";
|
|
32
34
|
export {
|
|
33
|
-
|
|
35
|
+
g as Label
|
|
34
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),d=require("../../../../../external/classnames/index.cjs.js"),r=require("react"),j=require("../../base/icon/icon.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),d=require("../../../../../external/classnames/index.cjs.js"),r=require("react"),j=require("../../base/icon/icon.cjs.js"),E=require("../feedback-text/feedback-text.cjs.js"),F=require("../form-label/form-label.cjs.js"),e=require("./checkbox.module.scss.cjs.js"),P=require("../../layout/grid/row.cjs.js"),q=require("../../layout/grid/col.cjs.js"),C=N=>{const{id:a,label:h,value:b,className:R,disabled:n=!1,onChange:l,hideLabel:g=!1,helper:i,checked:u,defaultChecked:v,indeterminate:o,hover:y,name:I,tooltip:k,labelProps:w,invalid:x,size:s="default",required:_,...z}=N,[L,M]=r.useState(v||!1),m=r.useRef(null),f=r.useRef(null),S=l&&typeof u<"u"?u:L;r.useEffect(()=>{f.current&&(f.current.indeterminate=!!o)},[o]);const T=t=>{typeof u>"u"&&M(t==null?void 0:t.target.checked),l==null||l(b,t==null?void 0:t.target.checked)},p=i?i.id??`${a}-helper`:void 0,$=k?`${a}-tooltip`:void 0,B=d.default(e.default["tedi-checkbox__label"],{[e.default["tedi-checkbox--disabled"]]:n});return c.jsxs("div",{className:d.default(e.default["tedi-checkbox"],{[e.default["tedi-checkbox--disabled"]]:n}),"data-name":"check",...z,children:[c.jsxs(P.Row,{gutter:0,children:[c.jsx(q.Col,{width:"auto",children:c.jsxs("div",{className:e.default["tedi-checkbox__outer-indicator-wrapper"],children:[c.jsx("input",{ref:f,id:a,value:b,name:I,type:"checkbox",disabled:n,checked:o?!1:S,onChange:T,className:e.default["tedi-checkbox__input"],"aria-describedby":[p,$].filter(Boolean).join(" "),required:_,"aria-invalid":x||void 0}),c.jsxs("div",{"aria-hidden":"true",onClick:()=>{var t;return(t=m.current)==null?void 0:t.click()},className:d.default(e.default["tedi-checkbox__indicator"],{[e.default["tedi-checkbox__indicator--hover"]]:y,[e.default["tedi-checkbox__indicator--indeterminate"]]:o,[e.default[`tedi-checkbox__indicator--size-${s}`]]:s,[e.default["tedi-checkbox__indicator--invalid"]]:x},R),"data-testid":"checkbox-indicator",children:[c.jsx(j.Icon,{size:s==="default"?16:18,name:"remove",className:d.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--indeterminate"])}),c.jsx(j.Icon,{size:s==="default"?16:18,name:"check",className:d.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--check"])})]})]})}),h&&c.jsx(q.Col,{children:c.jsx(F.FormLabel,{ref:m,className:B,id:a,"data-testid":"checkbox-label",hideLabel:g,label:h,tooltip:k,required:_,labelProps:w})})]}),i&&c.jsx(E.FeedbackText,{id:p,...i,className:d.default(e.default["tedi-checkbox__helper"],i.className)})]})};exports.Checkbox=C;exports.default=C;
|
|
@@ -2,60 +2,61 @@ import { jsxs as s, jsx as i } from "react/jsx-runtime";
|
|
|
2
2
|
import t from "../../../../../external/classnames/index.es.js";
|
|
3
3
|
import n from "react";
|
|
4
4
|
import { Icon as C } from "../../base/icon/icon.es.js";
|
|
5
|
-
import { FeedbackText as
|
|
6
|
-
import { FormLabel as
|
|
5
|
+
import { FeedbackText as M } from "../feedback-text/feedback-text.es.js";
|
|
6
|
+
import { FormLabel as P } from "../form-label/form-label.es.js";
|
|
7
7
|
import e from "./checkbox.module.scss.es.js";
|
|
8
8
|
import { Row as S } from "../../layout/grid/row.es.js";
|
|
9
9
|
import { Col as R } from "../../layout/grid/col.es.js";
|
|
10
|
-
const
|
|
10
|
+
const V = (y) => {
|
|
11
11
|
const {
|
|
12
|
-
id:
|
|
13
|
-
label:
|
|
14
|
-
value:
|
|
12
|
+
id: a,
|
|
13
|
+
label: f,
|
|
14
|
+
value: k,
|
|
15
15
|
className: g,
|
|
16
16
|
disabled: h = !1,
|
|
17
|
-
onChange:
|
|
17
|
+
onChange: d,
|
|
18
18
|
hideLabel: v = !1,
|
|
19
|
-
helper:
|
|
19
|
+
helper: o,
|
|
20
20
|
checked: m,
|
|
21
21
|
defaultChecked: z,
|
|
22
22
|
indeterminate: r,
|
|
23
23
|
hover: I,
|
|
24
24
|
name: j,
|
|
25
25
|
tooltip: _,
|
|
26
|
+
labelProps: w,
|
|
26
27
|
invalid: u,
|
|
27
28
|
size: l = "default",
|
|
28
29
|
required: p,
|
|
29
|
-
...
|
|
30
|
-
} = y, [
|
|
30
|
+
...L
|
|
31
|
+
} = y, [$, B] = n.useState(z || !1), x = n.useRef(null), b = n.useRef(null), E = d && typeof m < "u" ? m : $;
|
|
31
32
|
n.useEffect(() => {
|
|
32
|
-
|
|
33
|
+
b.current && (b.current.indeterminate = !!r);
|
|
33
34
|
}, [r]);
|
|
34
|
-
const
|
|
35
|
-
typeof m > "u" &&
|
|
36
|
-
}, N =
|
|
35
|
+
const F = (c) => {
|
|
36
|
+
typeof m > "u" && B(c == null ? void 0 : c.target.checked), d == null || d(k, c == null ? void 0 : c.target.checked);
|
|
37
|
+
}, N = o ? o.id ?? `${a}-helper` : void 0, q = _ ? `${a}-tooltip` : void 0, H = t(e["tedi-checkbox__label"], { [e["tedi-checkbox--disabled"]]: h });
|
|
37
38
|
return /* @__PURE__ */ s(
|
|
38
39
|
"div",
|
|
39
40
|
{
|
|
40
41
|
className: t(e["tedi-checkbox"], { [e["tedi-checkbox--disabled"]]: h }),
|
|
41
42
|
"data-name": "check",
|
|
42
|
-
...
|
|
43
|
+
...L,
|
|
43
44
|
children: [
|
|
44
45
|
/* @__PURE__ */ s(S, { gutter: 0, children: [
|
|
45
46
|
/* @__PURE__ */ i(R, { width: "auto", children: /* @__PURE__ */ s("div", { className: e["tedi-checkbox__outer-indicator-wrapper"], children: [
|
|
46
47
|
/* @__PURE__ */ i(
|
|
47
48
|
"input",
|
|
48
49
|
{
|
|
49
|
-
ref:
|
|
50
|
-
id:
|
|
51
|
-
value:
|
|
50
|
+
ref: b,
|
|
51
|
+
id: a,
|
|
52
|
+
value: k,
|
|
52
53
|
name: j,
|
|
53
54
|
type: "checkbox",
|
|
54
55
|
disabled: h,
|
|
55
|
-
checked: r ? !1 :
|
|
56
|
-
onChange:
|
|
56
|
+
checked: r ? !1 : E,
|
|
57
|
+
onChange: F,
|
|
57
58
|
className: e["tedi-checkbox__input"],
|
|
58
|
-
"aria-describedby": [N,
|
|
59
|
+
"aria-describedby": [N, q].filter(Boolean).join(" "),
|
|
59
60
|
required: p,
|
|
60
61
|
"aria-invalid": u || void 0
|
|
61
62
|
}
|
|
@@ -100,26 +101,27 @@ const U = (y) => {
|
|
|
100
101
|
}
|
|
101
102
|
)
|
|
102
103
|
] }) }),
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
f && /* @__PURE__ */ i(R, { children: /* @__PURE__ */ i(
|
|
105
|
+
P,
|
|
105
106
|
{
|
|
106
107
|
ref: x,
|
|
107
|
-
className:
|
|
108
|
-
id:
|
|
108
|
+
className: H,
|
|
109
|
+
id: a,
|
|
109
110
|
"data-testid": "checkbox-label",
|
|
110
111
|
hideLabel: v,
|
|
111
|
-
label:
|
|
112
|
+
label: f,
|
|
112
113
|
tooltip: _,
|
|
113
|
-
required: p
|
|
114
|
+
required: p,
|
|
115
|
+
labelProps: w
|
|
114
116
|
}
|
|
115
117
|
) })
|
|
116
118
|
] }),
|
|
117
|
-
|
|
119
|
+
o && /* @__PURE__ */ i(M, { id: N, ...o, className: t(e["tedi-checkbox__helper"], o.className) })
|
|
118
120
|
]
|
|
119
121
|
}
|
|
120
122
|
);
|
|
121
123
|
};
|
|
122
124
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
V as Checkbox,
|
|
126
|
+
V as default
|
|
125
127
|
};
|
|
@@ -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 i=require("react/jsx-runtime"),N=require("../../../../../external/classnames/index.cjs.js"),f=require("react"),ee=require("../feedback-text/feedback-text.cjs.js"),te=require("../form-label/form-label.cjs.js"),re=require("../checkbox/checkbox.cjs.js"),q=require("./choice-group.module.scss.cjs.js"),oe=require("./choice-group-context.cjs.js"),P=require("./components/choice-group-item/choice-group-item.cjs.js"),ne=require("../../../providers/label-provider/use-labels.cjs.js"),j=require("../../../helpers/hooks/use-breakpoint.cjs.js"),ie=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=require("../../layout/grid/row.cjs.js"),ae=require("../../layout/grid/col.cjs.js"),B=h=>{const{getLabel:m}=ne.useLabels(),I=j.default(h.defaultServerBreakpoint),{getCurrentBreakpointProps:R}=ie.useBreakpointProps(h.defaultServerBreakpoint),{id:u,className:T,label:S,required:G,helper:a,items:o,variant:g="default",direction:k=g==="default"||j.isBreakpointBelow(I,"md")?"column":"row",rowProps:p,name:w,inputType:n="radio",value:L,defaultValue:M,onChange:d,hideLabel:H,labelProps:E,indeterminateCheck:s,indeterminateCheckProps:b={},color:$,layout:v="separated",showIndicator:O,...W}=R(h),{...X}=b,Y=(b==null?void 0:b.indented)??!0,y=(a==null?void 0:a.id)??`${u}-helper`,A=s&&n==="checkbox",[z,_]=f.useState(()=>{if(M)return M;if(n==="radio"){const e=o.find(l=>l.defaultChecked);return e?e.value:null}return n==="checkbox"?o.filter(e=>e.defaultChecked).map(e=>e.value):null}),C=(e=h.value)=>!!d&&typeof e<"u",r=C(L)?L:z,x=f.useMemo(()=>(r==null?void 0:r.length)===0,[r==null?void 0:r.length]),c=f.useMemo(()=>{var e;return(r==null?void 0:r.length)===((e=o==null?void 0:o.filter(l=>!l.disabled))==null?void 0:e.length)},[r==null?void 0:r.length,o]),D=f.useMemo(()=>!x&&!c,[c,x]),J=f.useMemo(()=>{const e=c?"all":x?"none":"some";return typeof s=="string"?s:typeof s=="function"?s(e):s?m(e==="all"?"table.filter.remove-all":"table.filter.select-all"):""},[m,s,c,x]),K={name:w,inputType:n,onChange:(e,l)=>{let t=r;n==="checkbox"&&t?t=l?Array.isArray(t)?[...t,e]:[e]:Array.isArray(t)?t.filter(Z=>Z!==e):t:t=e,C()||_(Array.isArray(t)?[...t]:t),d==null||d(t)},currentValue:r},Q=N.default(q.default["tedi-choice-group"],T),U=N.default(q.default["tedi-choice-group__inner"],p==null?void 0:p.className,{[q.default["tedi-choice-group__inner--indented"]]:A&&Y}),V=()=>{var l;const e=c?[]:(l=o==null?void 0:o.filter(t=>!t.disabled))==null?void 0:l.map(t=>t.value);C()||_([...e]),d==null||d(e)};return i.jsx(oe.ChoiceGroupContext.Provider,{value:K,children:i.jsxs("fieldset",{...W,className:Q,id:u,name:w,"aria-describedby":a&&n!=="radio"?y:void 0,children:[S&&i.jsx(te.FormLabel,{id:u,label:S,required:G,hideLabel:H,renderWithoutLabel:!0,labelProps:E}),i.jsx(F.Row,{children:i.jsx(ae.Col,{children:o!=null&&o.length?i.jsxs(i.Fragment,{children:[A&&i.jsx(re.Checkbox,{id:`${u}-indeterminate`,value:"indeterminate",name:"indeterminate",...X,label:J,indeterminate:D,checked:c,onChange:V}),i.jsx(F.Row,{direction:k,gutterX:v==="segmented"?0:2,gutterY:v==="segmented"?0:1,gap:g==="default"&&(j.isBreakpointBelow(I,"md")||k==="row")?1:0,...p,className:U,role:n==="radio"?"radiogroup":void 0,"aria-labelledby":n==="radio"?u:void 0,"aria-describedby":n==="radio"&&a?y:void 0,"aria-required":n==="radio"&&G?!0:void 0,"aria-invalid":n==="radio"&&(a==null?void 0:a.type)==="error"?!0:void 0,children:o.map(e=>i.jsx(P.ChoiceGroupItem,{...e,color:$,variant:g,type:n,layout:v,showIndicator:O,direction:k},e.id))})]}):i.jsx("p",{children:m("table.filter.no-options")})})}),a&&i.jsx(ee.FeedbackText,{...a,id:y})]})})};B.Item=P.ChoiceGroupItem;exports.ChoiceGroup=B;exports.default=B;
|
|
@@ -1,107 +1,118 @@
|
|
|
1
|
-
import { jsx as a, jsxs as F, Fragment as
|
|
1
|
+
import { jsx as a, jsxs as F, Fragment as ee } from "react/jsx-runtime";
|
|
2
2
|
import G from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import
|
|
4
|
-
import { FeedbackText as
|
|
5
|
-
import { FormLabel as
|
|
6
|
-
import { Checkbox as
|
|
7
|
-
import
|
|
8
|
-
import { ChoiceGroupContext as
|
|
3
|
+
import g, { useState as te } from "react";
|
|
4
|
+
import { FeedbackText as re } from "../feedback-text/feedback-text.es.js";
|
|
5
|
+
import { FormLabel as oe } from "../form-label/form-label.es.js";
|
|
6
|
+
import { Checkbox as ie } from "../checkbox/checkbox.es.js";
|
|
7
|
+
import I from "./choice-group.module.scss.es.js";
|
|
8
|
+
import { ChoiceGroupContext as ne } from "./choice-group-context.es.js";
|
|
9
9
|
import { ChoiceGroupItem as q } from "./components/choice-group-item/choice-group-item.es.js";
|
|
10
|
-
import { useLabels as
|
|
11
|
-
import
|
|
10
|
+
import { useLabels as ae } from "../../../providers/label-provider/use-labels.es.js";
|
|
11
|
+
import de, { isBreakpointBelow as H } from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
12
12
|
import { useBreakpointProps as le } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
13
13
|
import { Row as j } from "../../layout/grid/row.es.js";
|
|
14
|
-
import { Col as
|
|
15
|
-
const
|
|
16
|
-
const { getLabel: f } =
|
|
17
|
-
id:
|
|
18
|
-
className:
|
|
19
|
-
label:
|
|
14
|
+
import { Col as se } from "../../layout/grid/col.es.js";
|
|
15
|
+
const ce = (u) => {
|
|
16
|
+
const { getLabel: f } = ae(), B = de(u.defaultServerBreakpoint), { getCurrentBreakpointProps: E } = le(u.defaultServerBreakpoint), {
|
|
17
|
+
id: m,
|
|
18
|
+
className: P,
|
|
19
|
+
label: S,
|
|
20
20
|
required: A,
|
|
21
21
|
helper: n,
|
|
22
22
|
items: o,
|
|
23
|
-
variant:
|
|
24
|
-
direction:
|
|
25
|
-
rowProps:
|
|
23
|
+
variant: y = "default",
|
|
24
|
+
direction: k = y === "default" || H(B, "md") ? "column" : "row",
|
|
25
|
+
rowProps: p,
|
|
26
26
|
name: L,
|
|
27
27
|
inputType: i = "radio",
|
|
28
28
|
value: M,
|
|
29
29
|
defaultValue: N,
|
|
30
|
-
onChange:
|
|
31
|
-
hideLabel:
|
|
30
|
+
onChange: l,
|
|
31
|
+
hideLabel: R,
|
|
32
|
+
labelProps: T,
|
|
32
33
|
indeterminateCheck: s,
|
|
33
|
-
indeterminateCheckProps:
|
|
34
|
+
indeterminateCheckProps: h = {},
|
|
34
35
|
color: $,
|
|
35
|
-
layout:
|
|
36
|
-
showIndicator:
|
|
37
|
-
...
|
|
38
|
-
} = E(u), { ...
|
|
36
|
+
layout: v = "separated",
|
|
37
|
+
showIndicator: W,
|
|
38
|
+
...X
|
|
39
|
+
} = E(u), { ...Y } = h, z = (h == null ? void 0 : h.indented) ?? !0, C = (n == null ? void 0 : n.id) ?? `${m}-helper`, _ = s && i === "checkbox", [D, w] = te(() => {
|
|
39
40
|
if (N) return N;
|
|
40
41
|
if (i === "radio") {
|
|
41
|
-
const e = o.find((
|
|
42
|
+
const e = o.find((d) => d.defaultChecked);
|
|
42
43
|
return e ? e.value : null;
|
|
43
44
|
}
|
|
44
45
|
return i === "checkbox" ? o.filter((e) => e.defaultChecked).map((e) => e.value) : null;
|
|
45
|
-
}),
|
|
46
|
+
}), x = (e = u.value) => !!l && typeof e < "u", r = x(M) ? M : D, b = g.useMemo(() => (r == null ? void 0 : r.length) === 0, [r == null ? void 0 : r.length]), c = g.useMemo(
|
|
46
47
|
() => {
|
|
47
48
|
var e;
|
|
48
|
-
return (r == null ? void 0 : r.length) === ((e = o == null ? void 0 : o.filter((
|
|
49
|
+
return (r == null ? void 0 : r.length) === ((e = o == null ? void 0 : o.filter((d) => !d.disabled)) == null ? void 0 : e.length);
|
|
49
50
|
},
|
|
50
51
|
[r == null ? void 0 : r.length, o]
|
|
51
|
-
),
|
|
52
|
-
const e =
|
|
52
|
+
), J = g.useMemo(() => !b && !c, [c, b]), K = g.useMemo(() => {
|
|
53
|
+
const e = c ? "all" : b ? "none" : "some";
|
|
53
54
|
return typeof s == "string" ? s : typeof s == "function" ? s(e) : s ? f(e === "all" ? "table.filter.remove-all" : "table.filter.select-all") : "";
|
|
54
|
-
}, [f, s,
|
|
55
|
+
}, [f, s, c, b]), O = {
|
|
55
56
|
name: L,
|
|
56
57
|
inputType: i,
|
|
57
|
-
onChange: (e,
|
|
58
|
+
onChange: (e, d) => {
|
|
58
59
|
let t = r;
|
|
59
|
-
i === "checkbox" && t ? t =
|
|
60
|
+
i === "checkbox" && t ? t = d ? Array.isArray(t) ? [...t, e] : [e] : Array.isArray(t) ? t.filter((Z) => Z !== e) : t : t = e, x() || w(Array.isArray(t) ? [...t] : t), l == null || l(t);
|
|
60
61
|
},
|
|
61
62
|
currentValue: r
|
|
62
|
-
},
|
|
63
|
-
[
|
|
64
|
-
}),
|
|
65
|
-
var
|
|
66
|
-
const e =
|
|
67
|
-
|
|
63
|
+
}, Q = G(I["tedi-choice-group"], P), U = G(I["tedi-choice-group__inner"], p == null ? void 0 : p.className, {
|
|
64
|
+
[I["tedi-choice-group__inner--indented"]]: _ && z
|
|
65
|
+
}), V = () => {
|
|
66
|
+
var d;
|
|
67
|
+
const e = c ? [] : (d = o == null ? void 0 : o.filter((t) => !t.disabled)) == null ? void 0 : d.map((t) => t.value);
|
|
68
|
+
x() || w([...e]), l == null || l(e);
|
|
68
69
|
};
|
|
69
|
-
return /* @__PURE__ */ a(
|
|
70
|
+
return /* @__PURE__ */ a(ne.Provider, { value: O, children: /* @__PURE__ */ F(
|
|
70
71
|
"fieldset",
|
|
71
72
|
{
|
|
72
|
-
...
|
|
73
|
-
className:
|
|
74
|
-
id:
|
|
73
|
+
...X,
|
|
74
|
+
className: Q,
|
|
75
|
+
id: m,
|
|
75
76
|
name: L,
|
|
76
|
-
"aria-describedby": n && i !== "radio" ?
|
|
77
|
+
"aria-describedby": n && i !== "radio" ? C : void 0,
|
|
77
78
|
children: [
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
S && /* @__PURE__ */ a(
|
|
80
|
+
oe,
|
|
81
|
+
{
|
|
82
|
+
id: m,
|
|
83
|
+
label: S,
|
|
84
|
+
required: A,
|
|
85
|
+
hideLabel: R,
|
|
86
|
+
renderWithoutLabel: !0,
|
|
87
|
+
labelProps: T
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ a(j, { children: /* @__PURE__ */ a(se, { children: o != null && o.length ? /* @__PURE__ */ F(ee, { children: [
|
|
80
91
|
_ && /* @__PURE__ */ a(
|
|
81
|
-
|
|
92
|
+
ie,
|
|
82
93
|
{
|
|
83
|
-
id: `${
|
|
94
|
+
id: `${m}-indeterminate`,
|
|
84
95
|
value: "indeterminate",
|
|
85
96
|
name: "indeterminate",
|
|
86
|
-
...
|
|
87
|
-
label:
|
|
88
|
-
indeterminate:
|
|
89
|
-
checked:
|
|
90
|
-
onChange:
|
|
97
|
+
...Y,
|
|
98
|
+
label: K,
|
|
99
|
+
indeterminate: J,
|
|
100
|
+
checked: c,
|
|
101
|
+
onChange: V
|
|
91
102
|
}
|
|
92
103
|
),
|
|
93
104
|
/* @__PURE__ */ a(
|
|
94
105
|
j,
|
|
95
106
|
{
|
|
96
|
-
direction:
|
|
97
|
-
gutterX:
|
|
98
|
-
gutterY:
|
|
99
|
-
gap:
|
|
100
|
-
...
|
|
101
|
-
className:
|
|
107
|
+
direction: k,
|
|
108
|
+
gutterX: v === "segmented" ? 0 : 2,
|
|
109
|
+
gutterY: v === "segmented" ? 0 : 1,
|
|
110
|
+
gap: y === "default" && (H(B, "md") || k === "row") ? 1 : 0,
|
|
111
|
+
...p,
|
|
112
|
+
className: U,
|
|
102
113
|
role: i === "radio" ? "radiogroup" : void 0,
|
|
103
|
-
"aria-labelledby": i === "radio" ?
|
|
104
|
-
"aria-describedby": i === "radio" && n ?
|
|
114
|
+
"aria-labelledby": i === "radio" ? m : void 0,
|
|
115
|
+
"aria-describedby": i === "radio" && n ? C : void 0,
|
|
105
116
|
"aria-required": i === "radio" && A ? !0 : void 0,
|
|
106
117
|
"aria-invalid": i === "radio" && (n == null ? void 0 : n.type) === "error" ? !0 : void 0,
|
|
107
118
|
children: o.map((e) => /* @__PURE__ */ a(
|
|
@@ -109,24 +120,24 @@ const se = (u) => {
|
|
|
109
120
|
{
|
|
110
121
|
...e,
|
|
111
122
|
color: $,
|
|
112
|
-
variant:
|
|
123
|
+
variant: y,
|
|
113
124
|
type: i,
|
|
114
|
-
layout:
|
|
115
|
-
showIndicator:
|
|
116
|
-
direction:
|
|
125
|
+
layout: v,
|
|
126
|
+
showIndicator: W,
|
|
127
|
+
direction: k
|
|
117
128
|
},
|
|
118
129
|
e.id
|
|
119
130
|
))
|
|
120
131
|
}
|
|
121
132
|
)
|
|
122
133
|
] }) : /* @__PURE__ */ a("p", { children: f("table.filter.no-options") }) }) }),
|
|
123
|
-
n && /* @__PURE__ */ a(
|
|
134
|
+
n && /* @__PURE__ */ a(re, { ...n, id: C })
|
|
124
135
|
]
|
|
125
136
|
}
|
|
126
137
|
) });
|
|
127
138
|
};
|
|
128
|
-
|
|
139
|
+
ce.Item = q;
|
|
129
140
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
ce as ChoiceGroup,
|
|
142
|
+
ce as default
|
|
132
143
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FeedbackTextProps } from './feedback-text/feedback-text';
|
|
2
|
+
import { FormLabelProps } from './form-label/form-label';
|
|
2
3
|
export interface ChoiceInputProps {
|
|
3
4
|
/**
|
|
4
5
|
* ID property
|
|
@@ -53,6 +54,12 @@ export interface ChoiceInputProps {
|
|
|
53
54
|
* not just a plain string.
|
|
54
55
|
*/
|
|
55
56
|
tooltip?: React.ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Additional props forwarded to the underlying `Label` component.
|
|
59
|
+
* Use `modifiers` to control how the label text wraps or breaks
|
|
60
|
+
* (e.g. `{ modifiers: 'nowrap' }`).
|
|
61
|
+
*/
|
|
62
|
+
labelProps?: FormLabelProps['labelProps'];
|
|
56
63
|
/**
|
|
57
64
|
* Input size
|
|
58
65
|
*/
|