@tedi-design-system/react 17.1.0-rc.6 → 17.1.0-rc.8
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/_virtual/index.cjs10.js +1 -1
- package/_virtual/index.cjs11.js +1 -1
- package/_virtual/index.cjs12.js +1 -1
- package/_virtual/index.cjs13.js +1 -1
- package/_virtual/index.cjs5.js +1 -1
- package/_virtual/index.cjs6.js +1 -1
- package/_virtual/index.cjs7.js +1 -1
- package/_virtual/index.cjs8.js +1 -1
- package/_virtual/index.cjs9.js +1 -1
- package/_virtual/index.es10.js +1 -1
- package/_virtual/index.es11.js +1 -1
- package/_virtual/index.es12.js +1 -1
- package/_virtual/index.es13.js +2 -4
- package/_virtual/index.es5.js +4 -2
- package/_virtual/index.es6.js +1 -1
- package/_virtual/index.es7.js +1 -1
- package/_virtual/index.es8.js +1 -1
- package/_virtual/index.es9.js +1 -1
- package/bundle-stats.html +1 -1
- package/external/@mui/system/colorManipulator.cjs.js +1 -1
- package/external/@mui/system/colorManipulator.es.js +2 -2
- package/external/@mui/system/createStyled.cjs.js +1 -1
- package/external/@mui/system/createStyled.es.js +6 -6
- package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
- package/external/@mui/system/useThemeWithoutDefault.es.js +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/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/content/text-group/index.d.ts +2 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.cjs.js +1 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.d.ts +82 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.es.js +30 -0
- package/src/tedi/components/content/text-group/text-group.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.d.ts +9 -1
- package/src/tedi/components/content/text-group/text-group.es.js +20 -15
- package/src/tedi/components/content/text-group/text-group.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.module.scss.es.js +3 -1
- 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 +70 -70
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +110 -110
- package/src/tedi/components/form/time-field/time-field-helpers.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field-helpers.d.ts +51 -0
- package/src/tedi/components/form/time-field/time-field-helpers.es.js +65 -0
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field.d.ts +87 -0
- package/src/tedi/components/form/time-field/time-field.es.js +149 -0
- package/src/tedi/components/form/time-field/time-field.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field.module.scss.es.js +10 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.d.ts +38 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.es.js +101 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.d.ts +40 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.es.js +184 -0
- package/src/tedi/components/form/time-picker/time-picker.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/time-picker.d.ts +60 -0
- package/src/tedi/components/form/time-picker/time-picker.es.js +45 -0
- package/src/tedi/components/form/time-picker/time-picker.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/time-picker.module.scss.es.js +14 -0
- package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.d.ts +9 -0
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +98 -88
- package/src/tedi/index.d.ts +3 -1
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +7 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +9 -2
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +214 -208
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../../../../../external/classnames/index.cjs.js"),v=require("../../label/label.cjs.js"),t=require("../text-group.module.scss.cjs.js"),y=require("../../../../helpers/hooks/use-breakpoint-props.cjs.js"),m=e=>typeof e=="string"?r.jsx(v.Label,{children:e}):e,a=e=>typeof e=="number"?`${e}%`:e,o=e=>{const{getCurrentBreakpointProps:i}=y.useBreakpointProps(e.defaultServerBreakpoint),{items:d,labelWidth:u="auto",className:n,type:c="vertical",labelAlign:p="left"}=i(e),x=s.default(t.default["tedi-text-group"],t.default["tedi-text-group--list"],t.default[`tedi-text-group--${c}`],n),f=a(u);return r.jsx("dl",{className:x,style:{"--label-width":f},children:d.map((l,g)=>{const b=l.labelAlign??p,h=l.labelWidth!==void 0?{"--label-width":a(l.labelWidth)}:void 0;return r.jsxs("div",{className:t.default["tedi-text-group__row"],style:h,children:[r.jsx("dt",{className:s.default(t.default["tedi-text-group__label"],t.default[`tedi-text-group--align-${b}`]),children:m(l.label)}),r.jsx("dd",{className:s.default(t.default["tedi-text-group__value"]),children:l.value})]},g)})})};o.displayName="TextGroup.List";exports.TextGroupList=o;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BreakpointSupport } from '../../../../helpers';
|
|
3
|
+
type TextAlign = 'left' | 'right';
|
|
4
|
+
type TextGroupListBreakpointProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Type of text group layout.
|
|
7
|
+
*/
|
|
8
|
+
type?: 'horizontal';
|
|
9
|
+
/**
|
|
10
|
+
* Alignment for the label text.
|
|
11
|
+
* @default 'left'
|
|
12
|
+
*/
|
|
13
|
+
labelAlign?: TextAlign;
|
|
14
|
+
/**
|
|
15
|
+
* Width for the label column (e.g., `'200px'`, `'30%'`, or a `number`
|
|
16
|
+
* interpreted as a percent).
|
|
17
|
+
* @default 'auto'
|
|
18
|
+
*/
|
|
19
|
+
labelWidth?: string | number;
|
|
20
|
+
} | {
|
|
21
|
+
/**
|
|
22
|
+
* Type of text group layout.
|
|
23
|
+
*/
|
|
24
|
+
type: 'vertical';
|
|
25
|
+
/**
|
|
26
|
+
* Alignment for the label text. Vertical layout only supports left
|
|
27
|
+
* alignment — pass `'right'` only with `type: 'horizontal'`.
|
|
28
|
+
* @default 'left'
|
|
29
|
+
*/
|
|
30
|
+
labelAlign?: 'left';
|
|
31
|
+
/**
|
|
32
|
+
* Width for the label column (e.g., `'200px'`, `'30%'`, or a `number`
|
|
33
|
+
* interpreted as a percent).
|
|
34
|
+
* @default 'auto'
|
|
35
|
+
*/
|
|
36
|
+
labelWidth?: string | number;
|
|
37
|
+
};
|
|
38
|
+
export interface TextGroupListItem {
|
|
39
|
+
/**
|
|
40
|
+
* Label rendered as the `<dt>` for this row. Strings are auto-wrapped in
|
|
41
|
+
* `<Label>`; any other ReactNode is rendered as-is.
|
|
42
|
+
*/
|
|
43
|
+
label: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Value rendered as the `<dd>` for this row.
|
|
46
|
+
*/
|
|
47
|
+
value: React.ReactNode | React.ReactNode[];
|
|
48
|
+
/**
|
|
49
|
+
* Per-row override of the list-level `labelAlign`. Falls back to the list's
|
|
50
|
+
* value when omitted.
|
|
51
|
+
*/
|
|
52
|
+
labelAlign?: TextAlign;
|
|
53
|
+
/**
|
|
54
|
+
* Per-row override of the list-level `labelWidth`. Falls back to the list's
|
|
55
|
+
* value when omitted.
|
|
56
|
+
*/
|
|
57
|
+
labelWidth?: string | number;
|
|
58
|
+
}
|
|
59
|
+
export type TextGroupListProps = BreakpointSupport<TextGroupListBreakpointProps> & {
|
|
60
|
+
/**
|
|
61
|
+
* Label / value pairs rendered together inside a **single** `<dl>` element,
|
|
62
|
+
* preserving the definition-list semantics that stacking N individual
|
|
63
|
+
* `<TextGroup>`s would break.
|
|
64
|
+
*/
|
|
65
|
+
items: TextGroupListItem[];
|
|
66
|
+
/**
|
|
67
|
+
* Additional class name(s) to apply to the root `<dl>` element.
|
|
68
|
+
*/
|
|
69
|
+
className?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Multi-row variant of `TextGroup`. Visually identical to stacking N
|
|
73
|
+
* `<TextGroup>` rows, but wraps every label / value pair in **one** semantic
|
|
74
|
+
* `<dl>` — so screen readers announce them as one definition list, not N
|
|
75
|
+
* fragments. Reuse the same `type` / `labelWidth` / `labelAlign` knobs as the
|
|
76
|
+
* single-pair component; per-row overrides are available via `items[i]`.
|
|
77
|
+
*/
|
|
78
|
+
export declare const TextGroupList: {
|
|
79
|
+
(props: TextGroupListProps): JSX.Element;
|
|
80
|
+
displayName: string;
|
|
81
|
+
};
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as l, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import o from "../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { Label as f } from "../../label/label.es.js";
|
|
4
|
+
import e from "../text-group.module.scss.es.js";
|
|
5
|
+
import { useBreakpointProps as v } from "../../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
6
|
+
const y = (t) => typeof t == "string" ? /* @__PURE__ */ l(f, { children: t }) : t, s = (t) => typeof t == "number" ? `${t}%` : t, L = (t) => {
|
|
7
|
+
const { getCurrentBreakpointProps: i } = v(t.defaultServerBreakpoint), {
|
|
8
|
+
items: a,
|
|
9
|
+
labelWidth: n = "auto",
|
|
10
|
+
className: d,
|
|
11
|
+
type: p = "vertical",
|
|
12
|
+
labelAlign: c = "left"
|
|
13
|
+
} = i(t), u = o(
|
|
14
|
+
e["tedi-text-group"],
|
|
15
|
+
e["tedi-text-group--list"],
|
|
16
|
+
e[`tedi-text-group--${p}`],
|
|
17
|
+
d
|
|
18
|
+
), m = s(n);
|
|
19
|
+
return /* @__PURE__ */ l("dl", { className: u, style: { "--label-width": m }, children: a.map((r, g) => {
|
|
20
|
+
const x = r.labelAlign ?? c, b = r.labelWidth !== void 0 ? { "--label-width": s(r.labelWidth) } : void 0;
|
|
21
|
+
return /* @__PURE__ */ h("div", { className: e["tedi-text-group__row"], style: b, children: [
|
|
22
|
+
/* @__PURE__ */ l("dt", { className: o(e["tedi-text-group__label"], e[`tedi-text-group--align-${x}`]), children: y(r.label) }),
|
|
23
|
+
/* @__PURE__ */ l("dd", { className: o(e["tedi-text-group__value"]), children: r.value })
|
|
24
|
+
] }, g);
|
|
25
|
+
}) });
|
|
26
|
+
};
|
|
27
|
+
L.displayName = "TextGroup.List";
|
|
28
|
+
export {
|
|
29
|
+
L as TextGroupList
|
|
30
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../../../../external/classnames/index.cjs.js"),f=require("../label/label.cjs.js"),t=require("./text-group.module.scss.cjs.js"),g=require("./text-group-list/text-group-list.cjs.js"),b=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),m=e=>typeof e=="string"?r.jsx(f.Label,{children:e}):e,y=e=>typeof e=="number"?`${e}%`:e,o=e=>{const{getCurrentBreakpointProps:l}=b.useBreakpointProps(e.defaultServerBreakpoint),{label:u,value:a,labelWidth:n="auto",className:i,type:d="vertical",labelAlign:c="left"}=l(e),p=s.default(t.default["tedi-text-group"],t.default[`tedi-text-group--${d}`],i),x=y(n);return r.jsxs("dl",{className:p,style:{"--label-width":x},children:[r.jsx("dt",{className:s.default(t.default["tedi-text-group__label"],t.default[`tedi-text-group--align-${c}`]),children:m(u)}),r.jsx("dd",{className:s.default(t.default["tedi-text-group__value"]),children:a})]})};o.displayName="TextGroup";const G=Object.assign(o,{List:g.TextGroupList});exports.TextGroup=G;
|
|
@@ -46,5 +46,13 @@ export type TextGroupProps = BreakpointSupport<TextGroupBreakpointProps> & {
|
|
|
46
46
|
*/
|
|
47
47
|
className?: string;
|
|
48
48
|
};
|
|
49
|
-
export declare const TextGroup:
|
|
49
|
+
export declare const TextGroup: {
|
|
50
|
+
(props: TextGroupProps): JSX.Element;
|
|
51
|
+
displayName: string;
|
|
52
|
+
} & {
|
|
53
|
+
List: {
|
|
54
|
+
(props: import('./text-group-list/text-group-list').TextGroupListProps): JSX.Element;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
50
58
|
export {};
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { Label as
|
|
1
|
+
import { jsxs as x, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import r from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { Label as f } from "../label/label.es.js";
|
|
4
4
|
import e from "./text-group.module.scss.es.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { TextGroupList as g } from "./text-group-list/text-group-list.es.js";
|
|
6
|
+
import { useBreakpointProps as b } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
7
|
+
const y = (t) => typeof t == "string" ? /* @__PURE__ */ o(f, { children: t }) : t, h = (t) => typeof t == "number" ? `${t}%` : t, s = (t) => {
|
|
8
|
+
const { getCurrentBreakpointProps: l } = b(t.defaultServerBreakpoint), {
|
|
9
|
+
label: a,
|
|
9
10
|
value: i,
|
|
10
|
-
labelWidth:
|
|
11
|
+
labelWidth: n = "auto",
|
|
11
12
|
className: p,
|
|
12
|
-
type:
|
|
13
|
-
labelAlign:
|
|
14
|
-
} =
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
13
|
+
type: c = "vertical",
|
|
14
|
+
labelAlign: m = "left"
|
|
15
|
+
} = l(t), d = r(e["tedi-text-group"], e[`tedi-text-group--${c}`], p), u = h(n);
|
|
16
|
+
return /* @__PURE__ */ x("dl", { className: d, style: { "--label-width": u }, children: [
|
|
17
|
+
/* @__PURE__ */ o("dt", { className: r(e["tedi-text-group__label"], e[`tedi-text-group--align-${m}`]), children: y(a) }),
|
|
18
|
+
/* @__PURE__ */ o("dd", { className: r(e["tedi-text-group__value"]), children: i })
|
|
18
19
|
] });
|
|
19
20
|
};
|
|
21
|
+
s.displayName = "TextGroup";
|
|
22
|
+
const _ = Object.assign(s, {
|
|
23
|
+
List: g
|
|
24
|
+
});
|
|
20
25
|
export {
|
|
21
|
-
|
|
26
|
+
_ as TextGroup
|
|
22
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-text-group":"tedi-text-group-be3b15d8","tedi-text-group--horizontal":"tedi-text-group--horizontal-9d91c910","tedi-text-group__label":"tedi-text-group__label-a8904597","tedi-text-group__value":"tedi-text-group__value-4bbf1a22","tedi-text-group--align-left":"tedi-text-group--align-left-cc82fd31","tedi-text-group--align-right":"tedi-text-group--align-right-0eebe973"};exports.default=t;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-text-group":"tedi-text-group-be3b15d8","tedi-text-group--horizontal":"tedi-text-group--horizontal-9d91c910","tedi-text-group__label":"tedi-text-group__label-a8904597","tedi-text-group__value":"tedi-text-group__value-4bbf1a22","tedi-text-group--align-left":"tedi-text-group--align-left-cc82fd31","tedi-text-group--align-right":"tedi-text-group--align-right-0eebe973","tedi-text-group--list":"tedi-text-group--list-bd143f34","tedi-text-group__row":"tedi-text-group__row-fc6928bf"};exports.default=t;
|
|
@@ -4,7 +4,9 @@ const t = {
|
|
|
4
4
|
"tedi-text-group__label": "tedi-text-group__label-a8904597",
|
|
5
5
|
"tedi-text-group__value": "tedi-text-group__value-4bbf1a22",
|
|
6
6
|
"tedi-text-group--align-left": "tedi-text-group--align-left-cc82fd31",
|
|
7
|
-
"tedi-text-group--align-right": "tedi-text-group--align-right-0eebe973"
|
|
7
|
+
"tedi-text-group--align-right": "tedi-text-group--align-right-0eebe973",
|
|
8
|
+
"tedi-text-group--list": "tedi-text-group--list-bd143f34",
|
|
9
|
+
"tedi-text-group__row": "tedi-text-group__row-fc6928bf"
|
|
8
10
|
};
|
|
9
11
|
export {
|
|
10
12
|
t as default
|
package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),h=require("../../../../../../../external/classnames/index.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),h=require("../../../../../../../external/classnames/index.cjs.js"),S=require("react"),A=require("../../../checkbox/checkbox.cjs.js"),H=require("../../../feedback-text/feedback-text.cjs.js"),L=require("../../../radio/radio.cjs.js"),O=require("../../choice-group-context.cjs.js"),e=require("./choice-group-item.module.scss.cjs.js"),V=require("../../../../../helpers/hooks/use-breakpoint-props.cjs.js"),z=require("../../../../layout/grid/col.cjs.js"),_=n=>{const{getCurrentBreakpointProps:q}=V.useBreakpointProps(n.defaultServerBreakpoint),{id:a,label:C,value:d,className:N,direction:m,disabled:r,colProps:I=m==="column"?{width:12}:{width:"auto"},onChange:p,hideLabel:B,helper:u,tooltip:$,type:o="radio",variant:s="default",color:G="primary",layout:P,showIndicator:x,justifyContent:b="start"}=q(n),{currentValue:l,name:v,onChange:f,inputType:M}=S.useContext(O.ChoiceGroupContext),i=Array.isArray(l)?l.includes(d):d===l,R=l===void 0?n.defaultChecked:i,y=(c,k)=>{f==null||f(c,k),p==null||p(c,k)},T=h.default(e.default[`tedi-choice-group-item--${P==="separated"?"separated":"segmented"}`],m&&e.default[`tedi-choice-group-item--${m}`]),w=h.default(e.default["tedi-choice-group-item"],e.default[`tedi-choice-group-item--${s}`],e.default[`tedi-choice-group-item--${s}-${G}`],x&&e.default["tedi-choice-group-item--indicator"],o&&e.default[`tedi-choice-group-item--${o}`],{[e.default["tedi-choice-group-item--disabled"]]:r},{[e.default["tedi-choice-group-item--checked"]]:i},{[`justify-content-${b}`]:b}),E=o==="radio"?L.Radio:A.Checkbox,F=c=>{var j;r||s!=="card"||c.target.closest("input, label")||(j=document.getElementById(a))==null||j.click()},g=o==="radio";return t.jsx(z.Col,{...I,className:T,children:t.jsx("div",{className:w,tabIndex:g||r?-1:0,onClick:F,role:g?void 0:o,"aria-checked":g?void 0:i,children:s==="default"||x?t.jsx(E,{id:a,label:C,value:d,name:v,className:h.default(e.default["tedi-choice-group-item__indicator"],N),disabled:r,checked:i,defaultChecked:R,onChange:y,hideLabel:B,helper:u?{...u,className:h.default(e.default["tedi-choice-group-item__feedback-text"],u.className)}:void 0,tooltip:$,"data-testid":"choice-group-item-indicator","aria-checked":i}):t.jsxs(t.Fragment,{children:[t.jsx("input",{id:a,value:d,name:v,type:M,disabled:r,checked:i,defaultChecked:l===void 0?n.defaultChecked:void 0,onChange:c=>{y(d,c.target.checked)},className:"visually-hidden",role:o==="radio"?"radio":void 0,"aria-checked":i,tabIndex:-1}),t.jsxs("label",{htmlFor:a,className:e.default["tedi-choice-group-item__label"],children:[C,u&&t.jsx(H.FeedbackText,{...u,id:a,className:e.default["tedi-choice-group-item__feedback-text"]})]})]})})})};exports.ChoiceGroupItem=_;exports.default=_;
|
package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s, jsxs as _, Fragment as H } from "react/jsx-runtime";
|
|
2
2
|
import u from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
-
import
|
|
4
|
-
import { Checkbox as
|
|
5
|
-
import { FeedbackText as
|
|
6
|
-
import { Radio as
|
|
7
|
-
import { ChoiceGroupContext as
|
|
3
|
+
import L from "react";
|
|
4
|
+
import { Checkbox as S } from "../../../checkbox/checkbox.es.js";
|
|
5
|
+
import { FeedbackText as V } from "../../../feedback-text/feedback-text.es.js";
|
|
6
|
+
import { Radio as q } from "../../../radio/radio.es.js";
|
|
7
|
+
import { ChoiceGroupContext as z } from "../../choice-group-context.es.js";
|
|
8
8
|
import e from "./choice-group-item.module.scss.es.js";
|
|
9
|
-
import { useBreakpointProps as
|
|
10
|
-
import { Col as
|
|
11
|
-
const
|
|
12
|
-
const { getCurrentBreakpointProps:
|
|
13
|
-
id:
|
|
14
|
-
label:
|
|
15
|
-
value:
|
|
16
|
-
className:
|
|
9
|
+
import { useBreakpointProps as D } from "../../../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
10
|
+
import { Col as J } from "../../../../layout/grid/col.es.js";
|
|
11
|
+
const oe = (l) => {
|
|
12
|
+
const { getCurrentBreakpointProps: $ } = D(l.defaultServerBreakpoint), {
|
|
13
|
+
id: c,
|
|
14
|
+
label: C,
|
|
15
|
+
value: r,
|
|
16
|
+
className: B,
|
|
17
17
|
direction: h,
|
|
18
|
-
disabled:
|
|
19
|
-
colProps:
|
|
18
|
+
disabled: a,
|
|
19
|
+
colProps: I = h === "column" ? { width: 12 } : { width: "auto" },
|
|
20
20
|
onChange: p,
|
|
21
|
-
hideLabel:
|
|
22
|
-
helper:
|
|
23
|
-
tooltip:
|
|
24
|
-
type:
|
|
21
|
+
hideLabel: j,
|
|
22
|
+
helper: d,
|
|
23
|
+
tooltip: w,
|
|
24
|
+
type: o = "radio",
|
|
25
25
|
variant: m = "default",
|
|
26
|
-
color:
|
|
27
|
-
layout:
|
|
28
|
-
showIndicator:
|
|
29
|
-
justifyContent:
|
|
30
|
-
} =
|
|
31
|
-
f == null || f(
|
|
32
|
-
},
|
|
33
|
-
e[`tedi-choice-group-item--${
|
|
26
|
+
color: E = "primary",
|
|
27
|
+
layout: F,
|
|
28
|
+
showIndicator: b,
|
|
29
|
+
justifyContent: y = "start"
|
|
30
|
+
} = $(l), { currentValue: n, name: v, onChange: f, inputType: G } = L.useContext(z), t = Array.isArray(n) ? n.includes(r) : r === n, P = n === void 0 ? l.defaultChecked : t, x = (i, k) => {
|
|
31
|
+
f == null || f(i, k), p == null || p(i, k);
|
|
32
|
+
}, R = u(
|
|
33
|
+
e[`tedi-choice-group-item--${F === "separated" ? "separated" : "segmented"}`],
|
|
34
34
|
h && e[`tedi-choice-group-item--${h}`]
|
|
35
35
|
), A = u(
|
|
36
36
|
e["tedi-choice-group-item"],
|
|
37
37
|
e[`tedi-choice-group-item--${m}`],
|
|
38
|
-
e[`tedi-choice-group-item--${m}-${
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{ [e["tedi-choice-group-item--disabled"]]:
|
|
38
|
+
e[`tedi-choice-group-item--${m}-${E}`],
|
|
39
|
+
b && e["tedi-choice-group-item--indicator"],
|
|
40
|
+
o && e[`tedi-choice-group-item--${o}`],
|
|
41
|
+
{ [e["tedi-choice-group-item--disabled"]]: a },
|
|
42
42
|
{ [e["tedi-choice-group-item--checked"]]: t },
|
|
43
|
-
{ [`justify-content-${
|
|
44
|
-
)
|
|
45
|
-
|
|
43
|
+
{ [`justify-content-${y}`]: y }
|
|
44
|
+
), M = o === "radio" ? q : S, T = (i) => {
|
|
45
|
+
var N;
|
|
46
|
+
a || m !== "card" || i.target.closest("input, label") || (N = document.getElementById(c)) == null || N.click();
|
|
47
|
+
}, g = o === "radio";
|
|
48
|
+
return /* @__PURE__ */ s(J, { ...I, className: R, children: /* @__PURE__ */ s(
|
|
46
49
|
"div",
|
|
47
50
|
{
|
|
48
51
|
className: A,
|
|
49
|
-
tabIndex:
|
|
50
|
-
onClick:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"aria-checked": t,
|
|
56
|
-
children: m === "default" || C ? /* @__PURE__ */ l(
|
|
57
|
-
d === "radio" ? L : T,
|
|
52
|
+
tabIndex: g || a ? -1 : 0,
|
|
53
|
+
onClick: T,
|
|
54
|
+
role: g ? void 0 : o,
|
|
55
|
+
"aria-checked": g ? void 0 : t,
|
|
56
|
+
children: m === "default" || b ? /* @__PURE__ */ s(
|
|
57
|
+
M,
|
|
58
58
|
{
|
|
59
|
-
id:
|
|
60
|
-
label:
|
|
61
|
-
value:
|
|
62
|
-
name:
|
|
63
|
-
className: u(e["tedi-choice-group-item__indicator"],
|
|
64
|
-
disabled:
|
|
59
|
+
id: c,
|
|
60
|
+
label: C,
|
|
61
|
+
value: r,
|
|
62
|
+
name: v,
|
|
63
|
+
className: u(e["tedi-choice-group-item__indicator"], B),
|
|
64
|
+
disabled: a,
|
|
65
65
|
checked: t,
|
|
66
|
-
defaultChecked:
|
|
66
|
+
defaultChecked: P,
|
|
67
67
|
onChange: x,
|
|
68
|
-
hideLabel:
|
|
69
|
-
helper:
|
|
70
|
-
tooltip:
|
|
68
|
+
hideLabel: j,
|
|
69
|
+
helper: d ? { ...d, className: u(e["tedi-choice-group-item__feedback-text"], d.className) } : void 0,
|
|
70
|
+
tooltip: w,
|
|
71
71
|
"data-testid": "choice-group-item-indicator",
|
|
72
72
|
"aria-checked": t
|
|
73
73
|
}
|
|
74
|
-
) : /* @__PURE__ */ _(
|
|
75
|
-
/* @__PURE__ */
|
|
74
|
+
) : /* @__PURE__ */ _(H, { children: [
|
|
75
|
+
/* @__PURE__ */ s(
|
|
76
76
|
"input",
|
|
77
77
|
{
|
|
78
|
-
id:
|
|
79
|
-
value:
|
|
80
|
-
name:
|
|
81
|
-
type:
|
|
82
|
-
disabled:
|
|
78
|
+
id: c,
|
|
79
|
+
value: r,
|
|
80
|
+
name: v,
|
|
81
|
+
type: G,
|
|
82
|
+
disabled: a,
|
|
83
83
|
checked: t,
|
|
84
|
-
defaultChecked: n === void 0 ?
|
|
85
|
-
onChange: (
|
|
86
|
-
x(
|
|
84
|
+
defaultChecked: n === void 0 ? l.defaultChecked : void 0,
|
|
85
|
+
onChange: (i) => {
|
|
86
|
+
x(r, i.target.checked);
|
|
87
87
|
},
|
|
88
88
|
className: "visually-hidden",
|
|
89
|
-
role:
|
|
89
|
+
role: o === "radio" ? "radio" : void 0,
|
|
90
90
|
"aria-checked": t,
|
|
91
91
|
tabIndex: -1
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
/* @__PURE__ */ _("label", { htmlFor:
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
/* @__PURE__ */ _("label", { htmlFor: c, className: e["tedi-choice-group-item__label"], children: [
|
|
95
|
+
C,
|
|
96
|
+
d && /* @__PURE__ */ s(V, { ...d, id: c, className: e["tedi-choice-group-item__feedback-text"] })
|
|
97
97
|
] })
|
|
98
98
|
] })
|
|
99
99
|
}
|
|
100
100
|
) });
|
|
101
101
|
};
|
|
102
102
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
oe as ChoiceGroupItem,
|
|
104
|
+
oe as default
|
|
105
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),_=require("../../../../../external/classnames/index.cjs.js"),l=require("react"),O=require("../../base/icon/icon.cjs.js"),pe=require("../../buttons/closing-button/closing-button.cjs.js"),_e=require("../../misc/separator/separator.cjs.js"),D=require("../feedback-text/feedback-text.cjs.js"),he=require("../field/field.cjs.js"),ge=require("../form-label/form-label.cjs.js"),k=require("../input-group/input-group.cjs.js"),r=require("./textfield.module.scss.cjs.js"),Ie=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),je=require("../../../providers/label-provider/use-labels.cjs.js"),Ae={large:24,default:18},q=l.forwardRef((h,U)=>{var H;const{getCurrentBreakpointProps:J}=Ie.useBreakpointProps(h.defaultServerBreakpoint),{id:Ne,label:g,className:Q,inputClassName:W,disabled:c,required:C,hideLabel:S,invalid:u,readOnly:B,icon:i,onIconClick:b,iconButtonProps:y,size:d="default",placeholder:X,isArrowsHidden:Y=!0,isClearable:F,onClear:v,onChange:o,onChangeEvent:Z,onKeyUp:G,onKeyDown:ee,onKeyPress:te,defaultValue:T,value:I,onFocus:j,onBlur:A,onClick:re,helper:e,input:s,name:ae,isTextArea:le,startSlot:ie,endSlot:se,...ne}=J(h)||{},{getLabel:w}=je.useLabels(),z=l.useRef(null),L=l.useRef(null),[de,R]=l.useState(I??T??""),M=I??de,f=!!(F&&M&&!B),x=(H=k.useOptionalInputGroup)==null?void 0:H.call(k),oe=l.useId(),ce=x==null?void 0:x.hasExternalLabel,m=h.id??(x==null?void 0:x.inputId)??oe;l.useImperativeHandle(U,()=>({get input(){return L.current},get inner(){return z.current}}));const P=l.useMemo(()=>Array.isArray(e)?u||e.some(t=>t.type==="error"):u||(e==null?void 0:e.type)==="error",[u,e]),ue=l.useMemo(()=>!e||Array.isArray(e)&&e.length===0?!1:Array.isArray(e)?!u&&e.every(t=>t.type==="valid"):!u&&e.type==="valid",[u,e]),fe=d==="large"?"default":d,p=I!==void 0,xe=l.useCallback(t=>{p||R(t),o==null||o(t)},[p,o]),$=l.useCallback(()=>{p||R(""),o==null||o(""),v==null||v()},[p,o,v]),E=l.useCallback(()=>{if(!i)return null;const N={size:d==="large"?24:d==="small"?!!b?18:16:18,className:r.default["tedi-textfield__icon"]},K=typeof i=="string"?{...N,name:i}:{...N,...i,className:_.default(N.className,i.className)};return b?a.jsx("button",{type:"button",...y,className:_.default(r.default["tedi-textfield__icon-wrapper"],y==null?void 0:y.className),onClick:c?void 0:b,disabled:c,children:a.jsx(O.Icon,{...K})}):a.jsx("div",{className:r.default["tedi-textfield__icon-wrapper"],"aria-hidden":"true",children:a.jsx(O.Icon,{...K})})},[i,d,b,y,c]),V=l.useMemo(()=>f?a.jsx(pe.ClosingButton,{iconSize:Ae[d==="large"?"large":"default"],onClick:c?void 0:$,disabled:c,title:w("clear"),className:r.default["tedi-textfield__clear-button"]}):null,[f,d,c,$,w]),me=l.useMemo(()=>!f&&!i?null:a.jsxs("div",{className:r.default["tedi-textfield__right-area"],children:[V,f&&i&&a.jsx(_e.Separator,{color:"primary",axis:"vertical",className:r.default["tedi-textfield__separator"]}),i&&E()]}),[f,i,V,E]),ye=a.jsx(he.Field,{...s,id:m,name:ae,value:M,defaultValue:T,onChange:xe,onChangeEvent:Z,disabled:c,readOnly:B,required:C,invalid:P,placeholder:X,className:_.default(r.default["tedi-textfield__input"],W,{[r.default["tedi-textfield__input--hidden-arrows"]]:Y}),onFocus:t=>{var n;(n=s==null?void 0:s.onFocus)==null||n.call(s,t),j==null||j(t)},onBlur:t=>{var n;(n=s==null?void 0:s.onBlur)==null||n.call(s,t),A==null||A(t)},isTextArea:le,"aria-describedby":!e||Array.isArray(e)&&e.length===0?void 0:Array.isArray(e)?e.map((t,n)=>`${m}-helper-${n}`).join(" "):`${m}-helper`,"aria-label":S&&typeof g=="string"?g:void 0,ref:L}),be=_.default(r.default["tedi-textfield"],{[r.default[`tedi-textfield--${d}`]]:d},{[r.default["tedi-textfield--with-icon"]]:i},{[r.default["tedi-textfield--invalid"]]:P},{[r.default["tedi-textfield--valid"]]:ue},{[r.default["tedi-textfield--clearable"]]:f},Q),ve=()=>!e||Array.isArray(e)&&e.length===0?null:a.jsx("div",{className:r.default["tedi-textfield__feedback-wrapper"],children:Array.isArray(e)?e.map((t,n)=>a.jsx(D.FeedbackText,{...t,id:`${m}-helper-${n}`},n)):a.jsx(D.FeedbackText,{...e,id:`${m}-helper`})});return a.jsxs("div",{"data-name":"textfield",...ne,className:be,children:[!ce&&a.jsx(ge.FormLabel,{id:m,label:g,required:C,hideLabel:S,size:fe}),a.jsxs("div",{className:r.default["tedi-textfield__inner"],onKeyDown:ee,onKeyUp:G,onKeyPress:te,onClick:re,ref:z,children:[ie,ye,se,(F||i)&&me]}),ve()]})});q.displayName="TextField";exports.TextField=q;exports.default=q;
|