@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.
Files changed (68) hide show
  1. package/bundle-stats.html +1 -1
  2. package/component.manifest.json +8 -8
  3. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  4. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  5. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  6. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  7. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  8. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  9. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  10. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  11. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  12. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  13. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  14. package/external/prop-types/external/react-is/index.es.js +1 -1
  15. package/index.css +1 -1
  16. package/package.json +2 -2
  17. package/src/community/components/map-components/map-layer/map-layer.cjs.js +1 -1
  18. package/src/community/components/map-components/map-layer/map-layer.es.js +1 -1
  19. package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.cjs.js +1 -0
  20. package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.d.ts +20 -0
  21. package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.es.js +5 -0
  22. package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.cjs.js +1 -0
  23. package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.d.ts +72 -0
  24. package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.es.js +124 -0
  25. package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.module.scss.cjs.js +1 -0
  26. package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.module.scss.es.js +13 -0
  27. package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
  28. package/src/tedi/components/form/checkbox/checkbox.d.ts +8 -2
  29. package/src/tedi/components/form/checkbox/checkbox.es.js +146 -110
  30. package/src/tedi/components/form/checkbox/checkbox.module.scss.cjs.js +1 -1
  31. package/src/tedi/components/form/checkbox/checkbox.module.scss.es.js +11 -3
  32. package/src/tedi/components/form/checkbox/index.cjs.js +1 -0
  33. package/src/tedi/components/form/checkbox/index.d.ts +11 -0
  34. package/src/tedi/components/form/checkbox/index.es.js +7 -0
  35. package/src/tedi/components/form/choice-group/choice-group.d.ts +11 -0
  36. package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
  37. package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +15 -15
  38. package/src/tedi/components/form/choice-input.types.d.ts +41 -10
  39. package/src/tedi/components/form/radio/index.cjs.js +1 -0
  40. package/src/tedi/components/form/radio/index.d.ts +11 -0
  41. package/src/tedi/components/form/radio/index.es.js +7 -0
  42. package/src/tedi/components/form/radio/radio-group/radio-group-context.cjs.js +1 -0
  43. package/src/tedi/components/form/radio/radio-group/radio-group-context.d.ts +21 -0
  44. package/src/tedi/components/form/radio/radio-group/radio-group-context.es.js +5 -0
  45. package/src/tedi/components/form/radio/radio-group/radio-group.cjs.js +1 -0
  46. package/src/tedi/components/form/radio/radio-group/radio-group.d.ts +56 -0
  47. package/src/tedi/components/form/radio/radio-group/radio-group.es.js +78 -0
  48. package/src/tedi/components/form/radio/radio-group/radio-group.module.scss.cjs.js +1 -0
  49. package/src/tedi/components/form/radio/radio-group/radio-group.module.scss.es.js +13 -0
  50. package/src/tedi/components/form/radio/radio.cjs.js +1 -1
  51. package/src/tedi/components/form/radio/radio.d.ts +7 -2
  52. package/src/tedi/components/form/radio/radio.es.js +116 -78
  53. package/src/tedi/components/form/radio/radio.module.scss.cjs.js +1 -1
  54. package/src/tedi/components/form/radio/radio.module.scss.es.js +11 -3
  55. package/src/tedi/components/form/textarea/textarea.cjs.js +1 -1
  56. package/src/tedi/components/form/textarea/textarea.es.js +71 -62
  57. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.cjs.js +1 -1
  58. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.d.ts +12 -0
  59. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.es.js +57 -27
  60. package/src/tedi/components/navigation/table-of-contents/table-of-contents.cjs.js +1 -1
  61. package/src/tedi/components/navigation/table-of-contents/table-of-contents.d.ts +17 -0
  62. package/src/tedi/components/navigation/table-of-contents/table-of-contents.es.js +65 -51
  63. package/src/tedi/index.d.ts +2 -2
  64. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  65. package/src/tedi/providers/label-provider/labels-map.d.ts +14 -0
  66. package/src/tedi/providers/label-provider/labels-map.es.js +25 -11
  67. package/tedi.cjs.js +1 -1
  68. package/tedi.es.js +298 -294
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "19.2.0-rc.7",
3
+ "version": "19.2.0-rc.9",
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,
@@ -126,7 +126,7 @@
126
126
  "jest": "29.7.0",
127
127
  "jest-environment-jsdom": "30.4.1",
128
128
  "linkify-string": "^4.1.3",
129
- "lint-staged": "^16.1.6",
129
+ "lint-staged": "^17.6.0",
130
130
  "next": "^16.2.2",
131
131
  "prettier": "^2.8.8",
132
132
  "react": "18.3.1",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),r=require("react"),N=require("../../../../tedi/components/base/typography/text/text.cjs.js"),p=require("../../../../tedi/components/buttons/button/button.cjs.js"),j=require("../../../../tedi/components/form/checkbox/checkbox.cjs.js"),g=require("../map-select/map-select.cjs.js"),n=require("./map-layer.module.scss.cjs.js"),w=m=>{const{items:d,selectAllLabel:k="Kõik kihid"}=m,[h,u]=r.useState({}),[v,f]=r.useState({}),[_,C]=r.useState(!1);r.useEffect(()=>{const e={},a={},t=i=>{for(const l of i)l.type==="checkbox"&&(e[l.id]=l.defaultChecked??!1),l.type==="select"&&l.defaultValue&&(a[l.id]=l.defaultValue),l.children&&t(l.children)};t(d),u(e),f(a)},[d]),r.useEffect(()=>{const e=Object.values(h),a=e.length,t=e.filter(Boolean).length;C(t>0&&t<a)},[h]);const S=(e,a)=>{if(u(t=>({...t,[e]:a})),!a){const t=i=>{for(const l of i)if(l.id===e&&l.children)for(const s of l.children)s.type==="select"&&f(o=>({...o,[s.id]:void 0})),s.type==="checkbox"&&u(o=>({...o,[s.id]:!1})),s.children&&t([s]);else l.children&&t(l.children)};t(d)}},q=e=>{const a={},t=i=>{for(const l of i)l.type==="checkbox"&&(a[l.id]=e),l.children&&t(l.children)};t(d),u(a),e||f({})},x=(e,a=0)=>{var i,l;const t=h[e.id]??!1;return c.jsxs("div",{className:b.default(n.default["tedi-map-layer__item"],n.default[`tedi-map-layer__level-${a}`]),children:[c.jsxs("div",{className:n.default["tedi-map-layer__row"],children:[e.type==="checkbox"&&c.jsx(j.Checkbox,{id:e.id,label:e.label,name:e.id,checked:t,onChange:(s,o)=>S(e.id,o),value:""}),e.type==="select"&&c.jsx(g.MapSelect,{id:e.id,label:e.label,options:e.options??[],value:v[e.id],onChange:s=>f(o=>({...o,[e.id]:s}))}),e.type==="checkbox"&&c.jsxs("div",{className:n.default["tedi-map-layer__actions"],children:[c.jsx(p.Button,{visualType:"link",icon:"download",children:"Download"}),c.jsx(p.Button,{visualType:"link",icon:"edit",children:"Edit"}),c.jsx(p.Button,{visualType:"link",icon:"info",children:"Info"}),c.jsx(p.Button,{visualType:"link",icon:"more_horiz",children:"Show more actions"})]})]}),e.type==="label"&&c.jsxs("div",{className:n.default["tedi-map-layer__item"],children:[c.jsx("div",{className:n.default["tedi-map-layer__label"],children:e.label}),(i=e.children)==null?void 0:i.map(s=>x(s,a+1))]},e.id),(l=e.children)==null?void 0:l.map(s=>x(s,a+1))]},e.id)},y=e=>e.some(a=>a.type==="checkbox"?!0:a.children?y(a.children):!1);return c.jsxs("div",{className:n.default["tedi-map-layer"],children:[c.jsx("div",{className:n.default["tedi-map-layer__select-all"],children:y(d)?c.jsx(j.Checkbox,{id:"select-all",label:k,name:"select-all",value:"all",checked:Object.values(h).every(Boolean),indeterminate:_,onChange:(e,a)=>q(a)}):c.jsx(N.Text,{color:"primary",modifiers:["bold"],children:k})}),c.jsx("div",{className:b.default(n.default["tedi-map-layer"],!y(d)&&n.default["tedi-map-layer--no-checkboxes"]),children:d.map(e=>x(e,1))})]})};exports.MapLayer=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),r=require("react"),N=require("../../../../tedi/components/base/typography/text/text.cjs.js"),p=require("../../../../tedi/components/buttons/button/button.cjs.js"),j=require("../../../../tedi/components/form/checkbox/index.cjs.js"),g=require("../map-select/map-select.cjs.js"),n=require("./map-layer.module.scss.cjs.js"),w=m=>{const{items:d,selectAllLabel:k="Kõik kihid"}=m,[u,h]=r.useState({}),[v,f]=r.useState({}),[_,C]=r.useState(!1);r.useEffect(()=>{const e={},a={},t=i=>{for(const l of i)l.type==="checkbox"&&(e[l.id]=l.defaultChecked??!1),l.type==="select"&&l.defaultValue&&(a[l.id]=l.defaultValue),l.children&&t(l.children)};t(d),h(e),f(a)},[d]),r.useEffect(()=>{const e=Object.values(u),a=e.length,t=e.filter(Boolean).length;C(t>0&&t<a)},[u]);const S=(e,a)=>{if(h(t=>({...t,[e]:a})),!a){const t=i=>{for(const l of i)if(l.id===e&&l.children)for(const s of l.children)s.type==="select"&&f(o=>({...o,[s.id]:void 0})),s.type==="checkbox"&&h(o=>({...o,[s.id]:!1})),s.children&&t([s]);else l.children&&t(l.children)};t(d)}},q=e=>{const a={},t=i=>{for(const l of i)l.type==="checkbox"&&(a[l.id]=e),l.children&&t(l.children)};t(d),h(a),e||f({})},x=(e,a=0)=>{var i,l;const t=u[e.id]??!1;return c.jsxs("div",{className:b.default(n.default["tedi-map-layer__item"],n.default[`tedi-map-layer__level-${a}`]),children:[c.jsxs("div",{className:n.default["tedi-map-layer__row"],children:[e.type==="checkbox"&&c.jsx(j.Checkbox,{id:e.id,label:e.label,name:e.id,checked:t,onChange:(s,o)=>S(e.id,o),value:""}),e.type==="select"&&c.jsx(g.MapSelect,{id:e.id,label:e.label,options:e.options??[],value:v[e.id],onChange:s=>f(o=>({...o,[e.id]:s}))}),e.type==="checkbox"&&c.jsxs("div",{className:n.default["tedi-map-layer__actions"],children:[c.jsx(p.Button,{visualType:"link",icon:"download",children:"Download"}),c.jsx(p.Button,{visualType:"link",icon:"edit",children:"Edit"}),c.jsx(p.Button,{visualType:"link",icon:"info",children:"Info"}),c.jsx(p.Button,{visualType:"link",icon:"more_horiz",children:"Show more actions"})]})]}),e.type==="label"&&c.jsxs("div",{className:n.default["tedi-map-layer__item"],children:[c.jsx("div",{className:n.default["tedi-map-layer__label"],children:e.label}),(i=e.children)==null?void 0:i.map(s=>x(s,a+1))]},e.id),(l=e.children)==null?void 0:l.map(s=>x(s,a+1))]},e.id)},y=e=>e.some(a=>a.type==="checkbox"?!0:a.children?y(a.children):!1);return c.jsxs("div",{className:n.default["tedi-map-layer"],children:[c.jsx("div",{className:n.default["tedi-map-layer__select-all"],children:y(d)?c.jsx(j.Checkbox,{id:"select-all",label:k,name:"select-all",value:"all",checked:Object.values(u).every(Boolean),indeterminate:_,onChange:(e,a)=>q(a)}):c.jsx(N.Text,{color:"primary",modifiers:["bold"],children:k})}),c.jsx("div",{className:b.default(n.default["tedi-map-layer"],!y(d)&&n.default["tedi-map-layer--no-checkboxes"]),children:d.map(e=>x(e,1))})]})};exports.MapLayer=w;
@@ -3,7 +3,7 @@ import v from "../../../../../external/classnames/index.es.js";
3
3
  import { useState as u, useEffect as _ } from "react";
4
4
  import { Text as j } from "../../../../tedi/components/base/typography/text/text.es.js";
5
5
  import { Button as m } from "../../../../tedi/components/buttons/button/button.es.js";
6
- import { Checkbox as x } from "../../../../tedi/components/form/checkbox/checkbox.es.js";
6
+ import { Checkbox as x } from "../../../../tedi/components/form/checkbox/index.es.js";
7
7
  import { MapSelect as V } from "../map-select/map-select.es.js";
8
8
  import n from "./map-layer.module.scss.es.js";
9
9
  const D = (C) => {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=e.createContext(null);exports.CheckboxGroupContext=t;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ import { ChoiceInputCardVariant, ChoiceInputVariant } from '../../choice-input.types';
3
+ export interface CheckboxGroupContextValue {
4
+ /** Shared `name` for all checkboxes in the group. */
5
+ name?: string;
6
+ /** Currently selected values. */
7
+ values: string[];
8
+ /** Called by a `Checkbox` when it is toggled. */
9
+ onToggle: (value: string, checked: boolean) => void;
10
+ disabled?: boolean;
11
+ invalid?: boolean;
12
+ size?: 'default' | 'large';
13
+ variant?: ChoiceInputVariant;
14
+ cardVariant?: ChoiceInputCardVariant;
15
+ }
16
+ /**
17
+ * Provided by `Checkbox.Group`. When present, a `Checkbox` reads its checked
18
+ * state, `name`, and shared visual props from here.
19
+ */
20
+ export declare const CheckboxGroupContext: React.Context<CheckboxGroupContextValue | null>;
@@ -0,0 +1,5 @@
1
+ import t from "react";
2
+ const o = t.createContext(null);
3
+ export {
4
+ o as CheckboxGroupContext
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),q=require("../../../../../../external/classnames/index.cjs.js"),s=require("react"),U=require("../../feedback-text/feedback-text.cjs.js"),W=require("../checkbox.cjs.js"),o=require("./checkbox-group.module.scss.cjs.js"),X=require("./checkbox-group-context.cjs.js"),Y=require("../../../../helpers/hooks/use-breakpoint-props.cjs.js"),Z=require("../../../../providers/label-provider/use-labels.cjs.js"),j=S=>{const{getCurrentBreakpointProps:T}=Y.useBreakpointProps(S.defaultServerBreakpoint),{getLabel:x}=Z.useLabels(),{id:I,name:_,label:y,hideLabel:M=!1,helper:d,className:B,value:k,defaultValue:w=[],onChange:i,disabled:f,invalid:m,required:$,size:g,variant:u="default",cardVariant:V="primary",direction:E=u==="card"?"row":"column",indeterminateCheck:r,selectAllLabel:F,removeAllLabel:R,indeterminateCheckProps:z,children:v}=T(S),O=s.useId(),L=I??O,b=k!==void 0,[N,D]=s.useState(w),l=s.useMemo(()=>b?k??[]:N,[b,k,N]),A=d?d.id??`${L}-helper`:void 0,p=s.useCallback(e=>{b||D(e),i==null||i(e)},[b,i]),G=s.useCallback((e,h)=>{p(h?[...l,e]:l.filter(C=>C!==e))},[l,p]),H=s.useMemo(()=>({name:_,values:l,onToggle:G,disabled:f,invalid:m,size:g,variant:u,cardVariant:V}),[_,l,G,f,m,g,u,V]),a=s.useMemo(()=>{const e=new Set,h=C=>{s.Children.forEach(C,n=>{s.isValidElement(n)&&(n.props.value!==void 0&&!n.props.disabled&&e.add(n.props.value),h(n.props.children))})};return h(v),[...e]},[v]),c=a.length>0&&a.every(e=>l.includes(e)),P=a.every(e=>!l.includes(e)),J=!c&&!P,K=typeof r=="string"?r:typeof r=="function"?r(c?"all":P?"none":"some"):c?R??x("checkbox-group.remove-all"):F??x("checkbox-group.select-all"),Q=s.useCallback(()=>{p(c?l.filter(e=>!a.includes(e)):[...new Set([...l,...a])])},[c,l,a,p]);return t.jsxs("fieldset",{className:q.default(o.default["tedi-checkbox-group"],o.default[`tedi-checkbox-group--${E}`],{[o.default["tedi-checkbox-group--card"]]:u==="card"},B),disabled:f,"aria-invalid":m||void 0,"aria-describedby":A,children:[y&&t.jsxs("legend",{className:q.default(o.default["tedi-checkbox-group__legend"],{"sr-only":M}),children:[y,$&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:o.default["tedi-checkbox-group__required"],children:"*"}),t.jsxs("span",{className:"sr-only",children:[" ",x("required")]})]})]}),r&&t.jsx(W.Checkbox,{id:`${L}-select-all`,...z,value:"select-all",label:K,checked:c,indeterminate:J,onChange:Q,size:g}),t.jsx(X.CheckboxGroupContext.Provider,{value:H,children:t.jsx("div",{className:q.default(o.default["tedi-checkbox-group__items"],{[o.default["tedi-checkbox-group__items--indented"]]:!!r}),children:v})}),d&&t.jsx(U.FeedbackText,{id:A,...d})]})};j.displayName="Checkbox.Group";exports.CheckboxGroup=j;exports.default=j;
@@ -0,0 +1,72 @@
1
+ import { default as React } from 'react';
2
+ import { BreakpointSupport } from '../../../../helpers';
3
+ import { ChoiceInputCardVariant, ChoiceInputVariant } from '../../choice-input.types';
4
+ import { FeedbackTextProps } from '../../feedback-text/feedback-text';
5
+ import { CheckboxBaseProps } from '../checkbox';
6
+ /** State of the select-all checkbox, passed to a custom `indeterminateCheck` label function. */
7
+ export type CheckboxGroupSelectAllState = 'all' | 'some' | 'none';
8
+ interface CheckboxGroupBreakpointProps {
9
+ /** Group id. When omitted a stable id is generated. */
10
+ id?: string;
11
+ /** Shared `name` for the checkboxes. */
12
+ name?: string;
13
+ /** Group label, rendered as the fieldset legend. */
14
+ label: React.ReactNode;
15
+ /** Visually hide the legend while keeping it available to screen readers. */
16
+ hideLabel?: boolean;
17
+ /** Helper / feedback text rendered below the group. */
18
+ helper?: FeedbackTextProps;
19
+ /** Additional class name(s) applied to the fieldset. */
20
+ className?: string;
21
+ /** Controlled selected values. Pair with `onChange`. */
22
+ value?: string[];
23
+ /** Uncontrolled initial selected values. */
24
+ defaultValue?: string[];
25
+ /** Fires with the full new list of selected values. */
26
+ onChange?: (value: string[]) => void;
27
+ /** Disables the whole group and every checkbox within it. */
28
+ disabled?: boolean;
29
+ /** Marks the group as invalid, forwarding the error state to each checkbox. */
30
+ invalid?: boolean;
31
+ /** Marks the group as required, adding a required indicator to the legend. */
32
+ required?: boolean;
33
+ /** Size forwarded to every checkbox. @default 'default' */
34
+ size?: 'default' | 'large';
35
+ /** Visual variant forwarded to every checkbox. @default 'default' */
36
+ variant?: ChoiceInputVariant;
37
+ /** Card colour variant forwarded to every checkbox (only applies to `variant="card"`). @default 'primary' */
38
+ cardVariant?: ChoiceInputCardVariant;
39
+ /** Layout direction of the checkboxes. Defaults to `row` for cards, `column` otherwise. */
40
+ direction?: 'row' | 'column';
41
+ /**
42
+ * Renders a "select all" checkbox above the children that reflects and controls
43
+ * them: checked when all are selected, indeterminate when some are, unchecked
44
+ * when none are. Toggling it selects or clears all (enabled) children.
45
+ * - `true` — use the localised default label ("Select all" / "Remove all").
46
+ * - `string` — a fixed label.
47
+ * - `(state) => string` — a label derived from the current `all` / `some` / `none` state.
48
+ */
49
+ indeterminateCheck?: boolean | string | ((state: CheckboxGroupSelectAllState) => string);
50
+ /**
51
+ * Overrides the localised label shown on the select-all checkbox when not all children are
52
+ * selected (the `some` / `none` states). Ignored when `indeterminateCheck` is a `string` or
53
+ * function, which control the label directly.
54
+ */
55
+ selectAllLabel?: string;
56
+ /**
57
+ * Overrides the localised label shown on the select-all checkbox when every child is selected
58
+ * (the `all` state). Ignored when `indeterminateCheck` is a `string` or function, which control
59
+ * the label directly.
60
+ */
61
+ removeAllLabel?: string;
62
+ /** Extra props forwarded to the select-all checkbox (its checked/indeterminate/value are managed). */
63
+ indeterminateCheckProps?: Partial<Omit<CheckboxBaseProps, 'value' | 'label' | 'checked' | 'indeterminate' | 'onChange'>>;
64
+ /** The `Checkbox` items that make up the group. */
65
+ children: React.ReactNode;
66
+ }
67
+ export type CheckboxGroupProps = BreakpointSupport<CheckboxGroupBreakpointProps>;
68
+ export declare const CheckboxGroup: {
69
+ (props: CheckboxGroupProps): JSX.Element;
70
+ displayName: string;
71
+ };
72
+ export default CheckboxGroup;
@@ -0,0 +1,124 @@
1
+ import { jsxs as h, Fragment as U, jsx as n } from "react/jsx-runtime";
2
+ import _ from "../../../../../../external/classnames/index.es.js";
3
+ import o from "react";
4
+ import { FeedbackText as W } from "../../feedback-text/feedback-text.es.js";
5
+ import { Checkbox as X } from "../checkbox.es.js";
6
+ import r from "./checkbox-group.module.scss.es.js";
7
+ import { CheckboxGroupContext as Y } from "./checkbox-group-context.es.js";
8
+ import { useBreakpointProps as Z } from "../../../../helpers/hooks/use-breakpoint-props.es.js";
9
+ import { useLabels as ee } from "../../../../providers/label-provider/use-labels.es.js";
10
+ const le = (S) => {
11
+ const { getCurrentBreakpointProps: w } = Z(S.defaultServerBreakpoint), { getLabel: f } = ee(), {
12
+ id: B,
13
+ name: N,
14
+ label: V,
15
+ hideLabel: G = !1,
16
+ helper: i,
17
+ className: M,
18
+ value: k,
19
+ defaultValue: $ = [],
20
+ onChange: d,
21
+ disabled: g,
22
+ invalid: v,
23
+ required: j,
24
+ size: x,
25
+ variant: u = "default",
26
+ cardVariant: A = "primary",
27
+ direction: E = u === "card" ? "row" : "column",
28
+ indeterminateCheck: t,
29
+ selectAllLabel: F,
30
+ removeAllLabel: z,
31
+ indeterminateCheckProps: R,
32
+ children: C
33
+ } = w(S), D = o.useId(), L = B ?? D, p = k !== void 0, [I, H] = o.useState($), l = o.useMemo(
34
+ () => p ? k ?? [] : I,
35
+ [p, k, I]
36
+ ), P = i ? i.id ?? `${L}-helper` : void 0, m = o.useCallback(
37
+ (e) => {
38
+ p || H(e), d == null || d(e);
39
+ },
40
+ [p, d]
41
+ ), T = o.useCallback(
42
+ (e, b) => {
43
+ m(b ? [...l, e] : l.filter((y) => y !== e));
44
+ },
45
+ [l, m]
46
+ ), J = o.useMemo(
47
+ () => ({
48
+ name: N,
49
+ values: l,
50
+ onToggle: T,
51
+ disabled: g,
52
+ invalid: v,
53
+ size: x,
54
+ variant: u,
55
+ cardVariant: A
56
+ }),
57
+ [N, l, T, g, v, x, u, A]
58
+ ), s = o.useMemo(() => {
59
+ const e = /* @__PURE__ */ new Set(), b = (y) => {
60
+ o.Children.forEach(y, (c) => {
61
+ o.isValidElement(c) && (c.props.value !== void 0 && !c.props.disabled && e.add(c.props.value), b(c.props.children));
62
+ });
63
+ };
64
+ return b(C), [...e];
65
+ }, [C]), a = s.length > 0 && s.every((e) => l.includes(e)), q = s.every((e) => !l.includes(e)), K = !a && !q, O = typeof t == "string" ? t : typeof t == "function" ? t(a ? "all" : q ? "none" : "some") : a ? z ?? f("checkbox-group.remove-all") : F ?? f("checkbox-group.select-all"), Q = o.useCallback(() => {
66
+ m(
67
+ a ? l.filter((e) => !s.includes(e)) : [.../* @__PURE__ */ new Set([...l, ...s])]
68
+ );
69
+ }, [a, l, s, m]);
70
+ return /* @__PURE__ */ h(
71
+ "fieldset",
72
+ {
73
+ className: _(
74
+ r["tedi-checkbox-group"],
75
+ r[`tedi-checkbox-group--${E}`],
76
+ { [r["tedi-checkbox-group--card"]]: u === "card" },
77
+ M
78
+ ),
79
+ disabled: g,
80
+ "aria-invalid": v || void 0,
81
+ "aria-describedby": P,
82
+ children: [
83
+ V && /* @__PURE__ */ h("legend", { className: _(r["tedi-checkbox-group__legend"], { "sr-only": G }), children: [
84
+ V,
85
+ j && /* @__PURE__ */ h(U, { children: [
86
+ /* @__PURE__ */ n("span", { "aria-hidden": "true", className: r["tedi-checkbox-group__required"], children: "*" }),
87
+ /* @__PURE__ */ h("span", { className: "sr-only", children: [
88
+ " ",
89
+ f("required")
90
+ ] })
91
+ ] })
92
+ ] }),
93
+ t && /* @__PURE__ */ n(
94
+ X,
95
+ {
96
+ id: `${L}-select-all`,
97
+ ...R,
98
+ value: "select-all",
99
+ label: O,
100
+ checked: a,
101
+ indeterminate: K,
102
+ onChange: Q,
103
+ size: x
104
+ }
105
+ ),
106
+ /* @__PURE__ */ n(Y.Provider, { value: J, children: /* @__PURE__ */ n(
107
+ "div",
108
+ {
109
+ className: _(r["tedi-checkbox-group__items"], {
110
+ [r["tedi-checkbox-group__items--indented"]]: !!t
111
+ }),
112
+ children: C
113
+ }
114
+ ) }),
115
+ i && /* @__PURE__ */ n(W, { id: P, ...i })
116
+ ]
117
+ }
118
+ );
119
+ };
120
+ le.displayName = "Checkbox.Group";
121
+ export {
122
+ le as CheckboxGroup,
123
+ le as default
124
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-checkbox-group":"tedi-checkbox-group-8c1eff4a","tedi-checkbox-group__legend":"tedi-checkbox-group__legend-78f7c383","tedi-checkbox-group__required":"tedi-checkbox-group__required-0ef1066e","tedi-checkbox-group__items":"tedi-checkbox-group__items-55131f62","tedi-checkbox-group--column":"tedi-checkbox-group--column-72f10a57","tedi-checkbox-group__items--indented":"tedi-checkbox-group__items--indented-47a5f592","tedi-checkbox-group--row":"tedi-checkbox-group--row-824f71cf","tedi-checkbox-group--card":"tedi-checkbox-group--card-e304e3dd"};exports.default=e;
@@ -0,0 +1,13 @@
1
+ const e = {
2
+ "tedi-checkbox-group": "tedi-checkbox-group-8c1eff4a",
3
+ "tedi-checkbox-group__legend": "tedi-checkbox-group__legend-78f7c383",
4
+ "tedi-checkbox-group__required": "tedi-checkbox-group__required-0ef1066e",
5
+ "tedi-checkbox-group__items": "tedi-checkbox-group__items-55131f62",
6
+ "tedi-checkbox-group--column": "tedi-checkbox-group--column-72f10a57",
7
+ "tedi-checkbox-group__items--indented": "tedi-checkbox-group__items--indented-47a5f592",
8
+ "tedi-checkbox-group--row": "tedi-checkbox-group--row-824f71cf",
9
+ "tedi-checkbox-group--card": "tedi-checkbox-group--card-e304e3dd"
10
+ };
11
+ export {
12
+ e as default
13
+ };
@@ -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"),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;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),t=require("../../../../../external/classnames/index.cjs.js"),s=require("react"),v=require("../../base/icon/icon.cjs.js"),M=require("../feedback-text/feedback-text.cjs.js"),de=require("../form-label/form-label.cjs.js"),c=require("./checkbox.module.scss.cjs.js"),te=require("./checkbox-group/checkbox-group-context.cjs.js"),ie=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),se=require("../../layout/grid/row.cjs.js"),S=require("../../layout/grid/col.cjs.js"),N=C=>{const e=s.useContext(te.CheckboxGroupContext),{getCurrentBreakpointProps:V}=ie.useBreakpointProps(C.defaultServerBreakpoint),{id:E,label:h,value:r,className:q,onChange:o,hideLabel:y=!1,helper:i,checked:b,defaultChecked:F,indeterminate:n,hover:G,name:D,tooltip:I,description:k,icon:m,labelProps:H,size:O,variant:U,cardVariant:A,disabled:J,invalid:P,required:K,...w}=V(C),l=O??(e==null?void 0:e.size)??"default",z=U??(e==null?void 0:e.variant)??"default",Q=A??(e==null?void 0:e.cardVariant)??"primary";z==="card"&&I&&console.warn('Checkbox: `tooltip` is not supported with `variant="card"` and will be ignored. Use `description`.');const f=J??(e==null?void 0:e.disabled)??!1,W=P??(e==null?void 0:e.invalid),B=K,X=s.useId(),u=E??X,Y=D??(e==null?void 0:e.name),[$,Z]=s.useState(F||!1),_=s.useRef(null),p=e!==null,j=s.useMemo(()=>n?"mixed":p?!!(e!=null&&e.values.includes(r)):o&&typeof b<"u"?b:$,[n,p,e,r,o,b,$]);s.useEffect(()=>{_.current&&(_.current.indeterminate=!!n)},[n,j]);const g=d=>{p?e==null||e.onToggle(r,d.target.checked):typeof b>"u"&&Z(d==null?void 0:d.target.checked),o==null||o(r,d==null?void 0:d.target.checked)},x=i?i.id??`${u}-helper`:void 0,ee=x,L=a.jsx("input",{ref:_,id:u,value:r,name:Y,type:"checkbox",disabled:f,checked:j!=="mixed"?j:!1,required:B,"aria-invalid":P||void 0,onChange:g,className:c.default["tedi-checkbox__input"],"aria-describedby":ee}),R=d=>a.jsxs("div",{"aria-hidden":"true",className:t.default(c.default["tedi-checkbox__indicator"],{[c.default["tedi-checkbox__indicator--hover"]]:G,[c.default["tedi-checkbox__indicator--indeterminate"]]:n,[c.default[`tedi-checkbox__indicator--size-${l}`]]:l,[c.default["tedi-checkbox__indicator--invalid"]]:W},d),"data-testid":"checkbox-indicator",children:[a.jsx(v.Icon,{size:l==="default"?16:18,name:"remove",className:t.default(c.default["tedi-checkbox__icon"],c.default["tedi-checkbox__icon--indeterminate"])}),a.jsx(v.Icon,{size:l==="default"?16:18,name:"check",className:t.default(c.default["tedi-checkbox__icon"],c.default["tedi-checkbox__icon--check"])})]});if(z==="card"){const d=`${u}-label`,T=k?`${u}-description`:void 0,ae=[T,x].filter(Boolean).join(" ")||void 0;return a.jsxs("label",{"data-name":"check",className:t.default(c.default["tedi-checkbox"],c.default["tedi-checkbox--card"],c.default[`tedi-checkbox--card-${Q}`],{[c.default["tedi-checkbox--card-with-icon"]]:!!m},{[c.default["tedi-checkbox--disabled"]]:f},q),...w,children:[a.jsxs("span",{className:c.default["tedi-checkbox__card-control"],children:[s.cloneElement(L,{"aria-labelledby":h?d:void 0,"aria-describedby":ae}),R(),m&&a.jsx(v.Icon,{name:m,size:l==="default"?18:24,className:c.default["tedi-checkbox__card-icon"]}),a.jsx("span",{id:d,className:t.default(c.default["tedi-checkbox__card-label"],{"sr-only":y}),children:h})]}),k&&a.jsx("span",{id:T,className:c.default["tedi-checkbox__card-description"],children:k}),i&&a.jsx(M.FeedbackText,{id:x,...i,className:t.default(c.default["tedi-checkbox__helper"],i.className)})]})}const ce=t.default(c.default["tedi-checkbox__label"],{[c.default["tedi-checkbox--disabled"]]:f});return a.jsxs("div",{className:t.default(c.default["tedi-checkbox"],{[c.default["tedi-checkbox--disabled"]]:f}),"data-name":"check",...w,children:[a.jsxs(se.Row,{gutter:0,children:[a.jsx(S.Col,{width:"auto",children:a.jsxs("div",{className:c.default["tedi-checkbox__outer-indicator-wrapper"],children:[L,R(q)]})}),h&&a.jsx(S.Col,{children:a.jsx(de.FormLabel,{className:ce,id:u,"data-testid":"checkbox-label",hideLabel:y,label:h,tooltip:I,required:B,labelProps:H})})]}),i&&a.jsx(M.FeedbackText,{id:x,...i,className:t.default(c.default["tedi-checkbox__helper"],i.className)})]})};N.displayName="Checkbox";exports.Checkbox=N;exports.default=N;
@@ -1,10 +1,16 @@
1
+ import { BreakpointSupport } from '../../../helpers';
1
2
  import { ChoiceInputProps } from '../choice-input.types';
2
- export interface CheckboxProps extends ChoiceInputProps {
3
+ export type CheckboxBaseProps = ChoiceInputProps & {
3
4
  /**
4
5
  * If the check is in indeterminate state. (Not checked or unchecked)
5
6
  * When this is true then the checked prop is ignored
6
7
  */
7
8
  indeterminate?: boolean;
9
+ };
10
+ export type CheckboxProps = BreakpointSupport<CheckboxBaseProps>;
11
+ interface CheckboxComponent {
12
+ (props: CheckboxProps): JSX.Element;
13
+ displayName?: string;
8
14
  }
9
- export declare const Checkbox: (props: CheckboxProps) => JSX.Element;
15
+ export declare const Checkbox: CheckboxComponent;
10
16
  export default Checkbox;
@@ -1,127 +1,163 @@
1
- import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
- import t from "../../../../../external/classnames/index.es.js";
3
- import n from "react";
1
+ import { jsxs as o, jsx as a } from "react/jsx-runtime";
2
+ import d from "../../../../../external/classnames/index.es.js";
3
+ import r from "react";
4
4
  import { Icon as C } from "../../base/icon/icon.es.js";
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
- import e from "./checkbox.module.scss.es.js";
8
- import { Row as S } from "../../layout/grid/row.es.js";
9
- import { Col as R } from "../../layout/grid/col.es.js";
10
- const V = (y) => {
11
- const {
12
- id: a,
13
- label: f,
14
- value: k,
15
- className: g,
16
- disabled: h = !1,
17
- onChange: d,
18
- hideLabel: v = !1,
19
- helper: o,
20
- checked: m,
21
- defaultChecked: z,
22
- indeterminate: r,
23
- hover: I,
24
- name: j,
25
- tooltip: _,
26
- labelProps: w,
27
- invalid: u,
28
- size: l = "default",
29
- required: p,
30
- ...L
31
- } = y, [$, B] = n.useState(z || !1), x = n.useRef(null), b = n.useRef(null), E = d && typeof m < "u" ? m : $;
32
- n.useEffect(() => {
33
- b.current && (b.current.indeterminate = !!r);
34
- }, [r]);
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 });
38
- return /* @__PURE__ */ s(
5
+ import { FeedbackText as E } from "../feedback-text/feedback-text.es.js";
6
+ import { FormLabel as ae } from "../form-label/form-label.es.js";
7
+ import c from "./checkbox.module.scss.es.js";
8
+ import { CheckboxGroupContext as de } from "./checkbox-group/checkbox-group-context.es.js";
9
+ import { useBreakpointProps as te } from "../../../helpers/hooks/use-breakpoint-props.es.js";
10
+ import { Row as re } from "../../layout/grid/row.es.js";
11
+ import { Col as D } from "../../layout/grid/col.es.js";
12
+ const oe = (y) => {
13
+ const e = r.useContext(de), { getCurrentBreakpointProps: F } = te(y.defaultServerBreakpoint), {
14
+ id: G,
15
+ label: m,
16
+ value: n,
17
+ className: I,
18
+ onChange: s,
19
+ hideLabel: P = !1,
20
+ helper: t,
21
+ checked: k,
22
+ defaultChecked: M,
23
+ indeterminate: l,
24
+ hover: S,
25
+ name: T,
26
+ tooltip: z,
27
+ description: _,
28
+ icon: p,
29
+ labelProps: H,
30
+ size: U,
31
+ variant: A,
32
+ cardVariant: J,
33
+ disabled: K,
34
+ invalid: w,
35
+ required: O,
36
+ ...B
37
+ } = F(y), h = U ?? (e == null ? void 0 : e.size) ?? "default", $ = A ?? (e == null ? void 0 : e.variant) ?? "default", Q = J ?? (e == null ? void 0 : e.cardVariant) ?? "primary";
38
+ $ === "card" && z && console.warn('Checkbox: `tooltip` is not supported with `variant="card"` and will be ignored. Use `description`.');
39
+ const f = K ?? (e == null ? void 0 : e.disabled) ?? !1, W = w ?? (e == null ? void 0 : e.invalid), L = O, X = r.useId(), b = G ?? X, Y = T ?? (e == null ? void 0 : e.name), [R, Z] = r.useState(M || !1), u = r.useRef(null), N = e !== null, v = r.useMemo(() => l ? "mixed" : N ? !!(e != null && e.values.includes(n)) : s && typeof k < "u" ? k : R, [l, N, e, n, s, k, R]);
40
+ r.useEffect(() => {
41
+ u.current && (u.current.indeterminate = !!l);
42
+ }, [l, v]);
43
+ const g = (i) => {
44
+ N ? e == null || e.onToggle(n, i.target.checked) : typeof k > "u" && Z(i == null ? void 0 : i.target.checked), s == null || s(n, i == null ? void 0 : i.target.checked);
45
+ }, x = t ? t.id ?? `${b}-helper` : void 0, ee = x, V = /* @__PURE__ */ a(
46
+ "input",
47
+ {
48
+ ref: u,
49
+ id: b,
50
+ value: n,
51
+ name: Y,
52
+ type: "checkbox",
53
+ disabled: f,
54
+ checked: v !== "mixed" ? v : !1,
55
+ required: L,
56
+ "aria-invalid": w || void 0,
57
+ onChange: g,
58
+ className: c["tedi-checkbox__input"],
59
+ "aria-describedby": ee
60
+ }
61
+ ), j = (i) => /* @__PURE__ */ o(
62
+ "div",
63
+ {
64
+ "aria-hidden": "true",
65
+ className: d(
66
+ c["tedi-checkbox__indicator"],
67
+ {
68
+ [c["tedi-checkbox__indicator--hover"]]: S,
69
+ [c["tedi-checkbox__indicator--indeterminate"]]: l,
70
+ [c[`tedi-checkbox__indicator--size-${h}`]]: h,
71
+ [c["tedi-checkbox__indicator--invalid"]]: W
72
+ },
73
+ i
74
+ ),
75
+ "data-testid": "checkbox-indicator",
76
+ children: [
77
+ /* @__PURE__ */ a(
78
+ C,
79
+ {
80
+ size: h === "default" ? 16 : 18,
81
+ name: "remove",
82
+ className: d(c["tedi-checkbox__icon"], c["tedi-checkbox__icon--indeterminate"])
83
+ }
84
+ ),
85
+ /* @__PURE__ */ a(
86
+ C,
87
+ {
88
+ size: h === "default" ? 16 : 18,
89
+ name: "check",
90
+ className: d(c["tedi-checkbox__icon"], c["tedi-checkbox__icon--check"])
91
+ }
92
+ )
93
+ ]
94
+ }
95
+ );
96
+ if ($ === "card") {
97
+ const i = `${b}-label`, q = _ ? `${b}-description` : void 0, ie = [q, x].filter(Boolean).join(" ") || void 0;
98
+ return /* @__PURE__ */ o(
99
+ "label",
100
+ {
101
+ "data-name": "check",
102
+ className: d(
103
+ c["tedi-checkbox"],
104
+ c["tedi-checkbox--card"],
105
+ c[`tedi-checkbox--card-${Q}`],
106
+ { [c["tedi-checkbox--card-with-icon"]]: !!p },
107
+ { [c["tedi-checkbox--disabled"]]: f },
108
+ I
109
+ ),
110
+ ...B,
111
+ children: [
112
+ /* @__PURE__ */ o("span", { className: c["tedi-checkbox__card-control"], children: [
113
+ r.cloneElement(V, {
114
+ "aria-labelledby": m ? i : void 0,
115
+ "aria-describedby": ie
116
+ }),
117
+ j(),
118
+ p && /* @__PURE__ */ a(C, { name: p, size: h === "default" ? 18 : 24, className: c["tedi-checkbox__card-icon"] }),
119
+ /* @__PURE__ */ a("span", { id: i, className: d(c["tedi-checkbox__card-label"], { "sr-only": P }), children: m })
120
+ ] }),
121
+ _ && /* @__PURE__ */ a("span", { id: q, className: c["tedi-checkbox__card-description"], children: _ }),
122
+ t && /* @__PURE__ */ a(E, { id: x, ...t, className: d(c["tedi-checkbox__helper"], t.className) })
123
+ ]
124
+ }
125
+ );
126
+ }
127
+ const ce = d(c["tedi-checkbox__label"], { [c["tedi-checkbox--disabled"]]: f });
128
+ return /* @__PURE__ */ o(
39
129
  "div",
40
130
  {
41
- className: t(e["tedi-checkbox"], { [e["tedi-checkbox--disabled"]]: h }),
131
+ className: d(c["tedi-checkbox"], { [c["tedi-checkbox--disabled"]]: f }),
42
132
  "data-name": "check",
43
- ...L,
133
+ ...B,
44
134
  children: [
45
- /* @__PURE__ */ s(S, { gutter: 0, children: [
46
- /* @__PURE__ */ i(R, { width: "auto", children: /* @__PURE__ */ s("div", { className: e["tedi-checkbox__outer-indicator-wrapper"], children: [
47
- /* @__PURE__ */ i(
48
- "input",
49
- {
50
- ref: b,
51
- id: a,
52
- value: k,
53
- name: j,
54
- type: "checkbox",
55
- disabled: h,
56
- checked: r ? !1 : E,
57
- onChange: F,
58
- className: e["tedi-checkbox__input"],
59
- "aria-describedby": [N, q].filter(Boolean).join(" "),
60
- required: p,
61
- "aria-invalid": u || void 0
62
- }
63
- ),
64
- /* @__PURE__ */ s(
65
- "div",
66
- {
67
- "aria-hidden": "true",
68
- onClick: () => {
69
- var c;
70
- return (c = x.current) == null ? void 0 : c.click();
71
- },
72
- className: t(
73
- e["tedi-checkbox__indicator"],
74
- {
75
- [e["tedi-checkbox__indicator--hover"]]: I,
76
- [e["tedi-checkbox__indicator--indeterminate"]]: r,
77
- [e[`tedi-checkbox__indicator--size-${l}`]]: l,
78
- [e["tedi-checkbox__indicator--invalid"]]: u
79
- },
80
- g
81
- ),
82
- "data-testid": "checkbox-indicator",
83
- children: [
84
- /* @__PURE__ */ i(
85
- C,
86
- {
87
- size: l === "default" ? 16 : 18,
88
- name: "remove",
89
- className: t(e["tedi-checkbox__icon"], e["tedi-checkbox__icon--indeterminate"])
90
- }
91
- ),
92
- /* @__PURE__ */ i(
93
- C,
94
- {
95
- size: l === "default" ? 16 : 18,
96
- name: "check",
97
- className: t(e["tedi-checkbox__icon"], e["tedi-checkbox__icon--check"])
98
- }
99
- )
100
- ]
101
- }
102
- )
135
+ /* @__PURE__ */ o(re, { gutter: 0, children: [
136
+ /* @__PURE__ */ a(D, { width: "auto", children: /* @__PURE__ */ o("div", { className: c["tedi-checkbox__outer-indicator-wrapper"], children: [
137
+ V,
138
+ j(I)
103
139
  ] }) }),
104
- f && /* @__PURE__ */ i(R, { children: /* @__PURE__ */ i(
105
- P,
140
+ m && /* @__PURE__ */ a(D, { children: /* @__PURE__ */ a(
141
+ ae,
106
142
  {
107
- ref: x,
108
- className: H,
109
- id: a,
143
+ className: ce,
144
+ id: b,
110
145
  "data-testid": "checkbox-label",
111
- hideLabel: v,
112
- label: f,
113
- tooltip: _,
114
- required: p,
115
- labelProps: w
146
+ hideLabel: P,
147
+ label: m,
148
+ tooltip: z,
149
+ required: L,
150
+ labelProps: H
116
151
  }
117
152
  ) })
118
153
  ] }),
119
- o && /* @__PURE__ */ i(M, { id: N, ...o, className: t(e["tedi-checkbox__helper"], o.className) })
154
+ t && /* @__PURE__ */ a(E, { id: x, ...t, className: d(c["tedi-checkbox__helper"], t.className) })
120
155
  ]
121
156
  }
122
157
  );
123
158
  };
159
+ oe.displayName = "Checkbox";
124
160
  export {
125
- V as Checkbox,
126
- V as default
161
+ oe as Checkbox,
162
+ oe as default
127
163
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-checkbox":"tedi-checkbox-0294a114","tedi-checkbox--disabled":"tedi-checkbox--disabled-e22bbaf4","tedi-checkbox__input":"tedi-checkbox__input-2ecab369","tedi-checkbox__outer-indicator-wrapper":"tedi-checkbox__outer-indicator-wrapper-5c85e0ab","tedi-checkbox__helper":"tedi-checkbox__helper-ab2b492c","tedi-checkbox__icon":"tedi-checkbox__icon-281ccd2f","tedi-checkbox__indicator":"tedi-checkbox__indicator-3ae3e79f","tedi-checkbox__icon--check":"tedi-checkbox__icon--check-048f3d53","tedi-checkbox__indicator--indeterminate":"tedi-checkbox__indicator--indeterminate-909c7897","tedi-checkbox__icon--indeterminate":"tedi-checkbox__icon--indeterminate-3e893b59","tedi-checkbox__tooltip-icon":"tedi-checkbox__tooltip-icon-46223bb7","tedi-checkbox__indicator--size-default":"tedi-checkbox__indicator--size-default-00511279","tedi-checkbox__indicator--size-large":"tedi-checkbox__indicator--size-large-b64ce54c","tedi-checkbox__indicator--hover":"tedi-checkbox__indicator--hover-436b8cb1","tedi-checkbox__indicator--invalid":"tedi-checkbox__indicator--invalid-019a355d"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c={"tedi-checkbox":"tedi-checkbox-0294a114","tedi-checkbox--disabled":"tedi-checkbox--disabled-e22bbaf4","tedi-checkbox__input":"tedi-checkbox__input-2ecab369","tedi-checkbox__outer-indicator-wrapper":"tedi-checkbox__outer-indicator-wrapper-5c85e0ab","tedi-checkbox__helper":"tedi-checkbox__helper-ab2b492c","tedi-checkbox__icon":"tedi-checkbox__icon-281ccd2f","tedi-checkbox__indicator":"tedi-checkbox__indicator-3ae3e79f","tedi-checkbox__icon--check":"tedi-checkbox__icon--check-048f3d53","tedi-checkbox__indicator--indeterminate":"tedi-checkbox__indicator--indeterminate-909c7897","tedi-checkbox__icon--indeterminate":"tedi-checkbox__icon--indeterminate-3e893b59","tedi-checkbox__tooltip-icon":"tedi-checkbox__tooltip-icon-46223bb7","tedi-checkbox__indicator--size-default":"tedi-checkbox__indicator--size-default-00511279","tedi-checkbox__indicator--size-large":"tedi-checkbox__indicator--size-large-b64ce54c","tedi-checkbox__indicator--invalid":"tedi-checkbox__indicator--invalid-019a355d","tedi-checkbox__indicator--hover":"tedi-checkbox__indicator--hover-436b8cb1","tedi-checkbox--card":"tedi-checkbox--card-d1faeb0e","tedi-checkbox__card-control":"tedi-checkbox__card-control-ea88c4f4","tedi-checkbox__card-label":"tedi-checkbox__card-label-4c136337","tedi-checkbox__card-icon":"tedi-checkbox__card-icon-a4d72e5a","tedi-checkbox__card-description":"tedi-checkbox__card-description-fa672631","tedi-checkbox--card-with-icon":"tedi-checkbox--card-with-icon-2636b953","tedi-checkbox--card-primary":"tedi-checkbox--card-primary-b7da557f","tedi-checkbox--card-secondary":"tedi-checkbox--card-secondary-179169ca"};exports.default=c;