@tedi-design-system/react 19.2.0-rc.8 → 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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.cjs2.js");/** @license React v16.13.1
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
- import { __exports as r } from "../../../../../_virtual/react-is.development.es2.js";
1
+ import { __exports as r } from "../../../../../_virtual/react-is.development.es.js";
2
2
  /** @license React v16.13.1
3
3
  * react-is.development.js
4
4
  *
@@ -1,4 +1,4 @@
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
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,4 +1,4 @@
1
- import { __exports as r } from "../../../../../_virtual/react-is.production.min.es2.js";
1
+ import { __exports as r } from "../../../../../_virtual/react-is.production.min.es.js";
2
2
  /** @license React v16.13.1
3
3
  * react-is.production.min.js
4
4
  *
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.cjs3.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.es4.js";
1
+ import { __module as r } from "../../../../_virtual/index.es3.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.cjs.js");/** @license React v16.13.1
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.
@@ -1,4 +1,4 @@
1
- import { __exports as r } from "../../../../../_virtual/react-is.development.es.js";
1
+ import { __exports as r } from "../../../../../_virtual/react-is.development.es2.js";
2
2
  /** @license React v16.13.1
3
3
  * react-is.development.js
4
4
  *
@@ -1,4 +1,4 @@
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
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,4 +1,4 @@
1
- import { __exports as r } from "../../../../../_virtual/react-is.production.min.es.js";
1
+ import { __exports as r } from "../../../../../_virtual/react-is.production.min.es2.js";
2
2
  /** @license React v16.13.1
3
3
  * react-is.production.min.js
4
4
  *
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.cjs4.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.es3.js";
1
+ import { __module as e } from "../../../../_virtual/index.es4.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.8",
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 L=require("react/jsx-runtime"),w=require("../../../../../external/classnames/index.cjs.js"),a=require("react"),O=require("../textfield/textfield.cjs.js"),d=require("./textarea.module.scss.cjs.js"),N=a.forwardRef((_,o)=>{const{className:b,helper:p=[],characterLimit:s,onChange:n,onChangeEvent:g,value:l,defaultValue:q,autoGrow:t=!1,minRows:u=3,maxRows:y=12,height:H="7.5rem",maxHeight:i,...F}=_,[T,A]=a.useState(q??""),c=a.useRef(null),[v,E]=a.useState("auto"),j=a.useCallback(e=>{!l&&!(n||g)&&A(e),n==null||n(e)},[l,n,g]),m=a.useMemo(()=>l??T,[l,T]),r=a.useCallback(()=>{if(!t||!c.current)return;const e=c.current,$=e.style.overflow;e.style.overflow="hidden";const f=window.getComputedStyle(e);let h=parseFloat(f.lineHeight);isNaN(h)&&(h=(parseFloat(f.fontSize)||16)*1.5);const S=parseFloat(f.paddingTop),R=parseFloat(f.paddingBottom),B=e.scrollHeight-S-R;let x=Math.ceil(B/h);x=Math.min(Math.max(x,u),y);const M=`${x*h+S+R}px`;e.style.height=M,E(M),e.style.overflow=$,e.style.overflowY=e.scrollHeight>e.clientHeight?"auto":"hidden"},[t,u,y]);a.useEffect(()=>{t&&requestAnimationFrame(()=>{r()})},[m,t,r]),a.useEffect(()=>{t&&c.current&&r()},[t,r]);const k=a.useCallback(e=>{o&&(typeof o=="function"?o(e):o.current=e),e!=null&&e.input&&e.input instanceof HTMLTextAreaElement&&(c.current=e.input,t&&setTimeout(r,0))},[o,t,r]),z=a.useMemo(()=>t?{rows:u,style:{...i?{maxHeight:i}:{},overflow:"hidden",height:v}}:{style:{height:H,...i?{maxHeight:i}:{},overflow:"auto"}},[t,u,i,H,v]),C=m.length,I=s?`${C}/${s}`:"",V=[...Array.isArray(p)?p:[p],...s?[{type:C>s?"error":"hint",text:I,position:"right",className:w.default(d.default["tedi-textarea__character-count"])}]:[]];return L.jsx(O.TextField,{...F,ref:k,"data-name":"textarea",inputClassName:w.default(d.default["tedi-textarea__input"],{[d.default["tedi-textarea__input--auto-grow"]]:t}),isTextArea:!0,className:w.default(d.default["tedi-textarea"],b),value:m,onChange:j,onChangeEvent:g,helper:V,input:z})});N.displayName="Textarea";exports.Textarea=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),a=require("react"),L=require("../textfield/textfield.cjs.js"),m=require("./textarea.module.scss.cjs.js"),M=a.forwardRef((N,i)=>{const{className:_,helper:w=[],characterLimit:d,onChange:l,onChangeEvent:y,value:h,defaultValue:q,autoGrow:t=!1,minRows:f=3,maxRows:v=12,height:T="7.5rem",maxHeight:c,...z}=N,[C,A]=a.useState(q??""),u=a.useRef(null),[R,E]=a.useState("auto"),O=a.useCallback(e=>{!h&&!(l||y)&&A(e),l==null||l(e)},[h,l,y]),H=a.useMemo(()=>h??C,[h,C]),r=a.useCallback(()=>{if(!t||!u.current)return;const e=u.current,p=e.style.overflow;e.style.overflow="hidden";const o=window.getComputedStyle(e);let n=parseFloat(o.lineHeight);isNaN(n)&&(n=(parseFloat(o.fontSize)||16)*1.5);const s=parseFloat(o.paddingTop),g=parseFloat(o.paddingBottom),x=o.boxSizing==="border-box"?(parseFloat(o.borderTopWidth)||0)+(parseFloat(o.borderBottomWidth)||0):0;e.style.height="auto";const I=e.scrollHeight-s-g,V=Math.ceil((I-1)/n),F=`${Math.min(Math.max(V,f),v)*n+s+g+x}px`;e.style.height=F,E(F),e.style.overflow=p,e.style.overflowY=e.scrollHeight-e.clientHeight>1?"auto":"hidden"},[t,f,v]);a.useEffect(()=>{t&&requestAnimationFrame(()=>{r()})},[H,t,r]),a.useEffect(()=>{t&&u.current&&r()},[t,r]),a.useEffect(()=>{const e=u.current;if(!t||!e||typeof ResizeObserver>"u")return;let p=e.clientWidth;const o=new ResizeObserver(n=>{var x;const s=((x=n[0])==null?void 0:x.contentRect.width)??0,g=s!==p;p=s,s>0&&g&&r()});return o.observe(e),()=>o.disconnect()},[t,r]);const W=a.useCallback(e=>{i&&(typeof i=="function"?i(e):i.current=e),e!=null&&e.input&&e.input instanceof HTMLTextAreaElement&&(u.current=e.input,t&&setTimeout(r,0))},[i,t,r]),j=a.useMemo(()=>t?{rows:f,style:{...c?{maxHeight:c}:{},overflow:"hidden",height:R}}:{style:{height:T,...c?{maxHeight:c}:{},overflow:"auto"}},[t,f,c,T,R]),S=H.length,k=d?`${S}/${d}`:"",B=[...Array.isArray(w)?w:[w],...d?[{type:S>d?"error":"hint",text:k,position:"right",className:b.default(m.default["tedi-textarea__character-count"])}]:[]];return $.jsx(L.TextField,{...z,ref:W,"data-name":"textarea",inputClassName:b.default(m.default["tedi-textarea__input"],{[m.default["tedi-textarea__input--auto-grow"]]:t}),isTextArea:!0,className:b.default(m.default["tedi-textarea"],_),value:H,onChange:O,onChangeEvent:y,helper:B,input:j})});M.displayName="Textarea";exports.Textarea=M;
@@ -1,93 +1,102 @@
1
- import { jsx as q } from "react/jsx-runtime";
2
- import w from "../../../../../external/classnames/index.es.js";
3
- import a, { forwardRef as G, useRef as O, useEffect as S } from "react";
1
+ import { jsx as j } from "react/jsx-runtime";
2
+ import v from "../../../../../external/classnames/index.es.js";
3
+ import a, { forwardRef as q, useRef as G, useEffect as b } from "react";
4
4
  import { TextField as P } from "../textfield/textfield.es.js";
5
- import p from "./textarea.module.scss.es.js";
6
- const Y = G((F, r) => {
5
+ import x from "./textarea.module.scss.es.js";
6
+ const Y = q((_, i) => {
7
7
  const {
8
- className: M,
9
- helper: f = [],
10
- characterLimit: i,
11
- onChange: s,
12
- onChangeEvent: g,
13
- value: l,
14
- defaultValue: A,
8
+ className: z,
9
+ helper: w = [],
10
+ characterLimit: h,
11
+ onChange: l,
12
+ onChangeEvent: y,
13
+ value: p,
14
+ defaultValue: M,
15
15
  autoGrow: e = !1,
16
- minRows: c = 3,
17
- maxRows: H = 12,
18
- height: y = "7.5rem",
19
- maxHeight: n,
20
- ...b
21
- } = F, [v, k] = a.useState(A ?? ""), u = O(null), [C, z] = a.useState("auto"), E = a.useCallback(
16
+ minRows: f = 3,
17
+ maxRows: C = 12,
18
+ height: R = "7.5rem",
19
+ maxHeight: c,
20
+ ...A
21
+ } = _, [T, W] = a.useState(M ?? ""), u = G(null), [F, k] = a.useState("auto"), B = a.useCallback(
22
22
  (t) => {
23
- !l && !(s || g) && k(t), s == null || s(t);
23
+ !p && !(l || y) && W(t), l == null || l(t);
24
24
  },
25
- [l, s, g]
26
- ), x = a.useMemo(() => l ?? v, [l, v]), o = a.useCallback(() => {
25
+ [p, l, y]
26
+ ), H = a.useMemo(() => p ?? T, [p, T]), r = a.useCallback(() => {
27
27
  if (!e || !u.current) return;
28
- const t = u.current, L = t.style.overflow;
28
+ const t = u.current, d = t.style.overflow;
29
29
  t.style.overflow = "hidden";
30
- const h = window.getComputedStyle(t);
31
- let m = parseFloat(h.lineHeight);
32
- isNaN(m) && (m = (parseFloat(h.fontSize) || 16) * 1.5);
33
- const N = parseFloat(h.paddingTop), _ = parseFloat(h.paddingBottom), j = t.scrollHeight - N - _;
34
- let d = Math.ceil(j / m);
35
- d = Math.min(Math.max(d, c), H);
36
- const R = `${d * m + N + _}px`;
37
- t.style.height = R, z(R), t.style.overflow = L, t.style.overflowY = t.scrollHeight > t.clientHeight ? "auto" : "hidden";
38
- }, [e, c, H]);
39
- S(() => {
30
+ const o = window.getComputedStyle(t);
31
+ let n = parseFloat(o.lineHeight);
32
+ isNaN(n) && (n = (parseFloat(o.fontSize) || 16) * 1.5);
33
+ const s = parseFloat(o.paddingTop), m = parseFloat(o.paddingBottom), g = o.boxSizing === "border-box" ? (parseFloat(o.borderTopWidth) || 0) + (parseFloat(o.borderBottomWidth) || 0) : 0;
34
+ t.style.height = "auto";
35
+ const $ = t.scrollHeight - s - m, L = Math.ceil(($ - 1) / n), S = `${Math.min(Math.max(L, f), C) * n + s + m + g}px`;
36
+ t.style.height = S, k(S), t.style.overflow = d, t.style.overflowY = t.scrollHeight - t.clientHeight > 1 ? "auto" : "hidden";
37
+ }, [e, f, C]);
38
+ b(() => {
40
39
  e && requestAnimationFrame(() => {
41
- o();
40
+ r();
42
41
  });
43
- }, [x, e, o]), S(() => {
44
- e && u.current && o();
45
- }, [e, o]);
46
- const I = a.useCallback(
42
+ }, [H, e, r]), b(() => {
43
+ e && u.current && r();
44
+ }, [e, r]), b(() => {
45
+ const t = u.current;
46
+ if (!e || !t || typeof ResizeObserver > "u") return;
47
+ let d = t.clientWidth;
48
+ const o = new ResizeObserver((n) => {
49
+ var g;
50
+ const s = ((g = n[0]) == null ? void 0 : g.contentRect.width) ?? 0, m = s !== d;
51
+ d = s, s > 0 && m && r();
52
+ });
53
+ return o.observe(t), () => o.disconnect();
54
+ }, [e, r]);
55
+ const E = a.useCallback(
47
56
  (t) => {
48
- r && (typeof r == "function" ? r(t) : r.current = t), t != null && t.input && t.input instanceof HTMLTextAreaElement && (u.current = t.input, e && setTimeout(o, 0));
57
+ i && (typeof i == "function" ? i(t) : i.current = t), t != null && t.input && t.input instanceof HTMLTextAreaElement && (u.current = t.input, e && setTimeout(r, 0));
49
58
  },
50
- [r, e, o]
51
- ), V = a.useMemo(() => e ? {
52
- rows: c,
59
+ [i, e, r]
60
+ ), I = a.useMemo(() => e ? {
61
+ rows: f,
53
62
  style: {
54
- ...n ? { maxHeight: n } : {},
63
+ ...c ? { maxHeight: c } : {},
55
64
  overflow: "hidden",
56
- height: C
65
+ height: F
57
66
  }
58
67
  } : {
59
68
  style: {
60
- height: y,
61
- ...n ? { maxHeight: n } : {},
69
+ height: R,
70
+ ...c ? { maxHeight: c } : {},
62
71
  overflow: "auto"
63
72
  }
64
- }, [e, c, n, y, C]), T = x.length, $ = i ? `${T}/${i}` : "", B = [
65
- ...Array.isArray(f) ? f : [f],
66
- ...i ? [
73
+ }, [e, f, c, R, F]), N = H.length, O = h ? `${N}/${h}` : "", V = [
74
+ ...Array.isArray(w) ? w : [w],
75
+ ...h ? [
67
76
  {
68
- type: T > i ? "error" : "hint",
69
- text: $,
77
+ type: N > h ? "error" : "hint",
78
+ text: O,
70
79
  position: "right",
71
- className: w(p["tedi-textarea__character-count"])
80
+ className: v(x["tedi-textarea__character-count"])
72
81
  }
73
82
  ] : []
74
83
  ];
75
- return /* @__PURE__ */ q(
84
+ return /* @__PURE__ */ j(
76
85
  P,
77
86
  {
78
- ...b,
79
- ref: I,
87
+ ...A,
88
+ ref: E,
80
89
  "data-name": "textarea",
81
- inputClassName: w(p["tedi-textarea__input"], {
82
- [p["tedi-textarea__input--auto-grow"]]: e
90
+ inputClassName: v(x["tedi-textarea__input"], {
91
+ [x["tedi-textarea__input--auto-grow"]]: e
83
92
  }),
84
93
  isTextArea: !0,
85
- className: w(p["tedi-textarea"], M),
86
- value: x,
87
- onChange: E,
88
- onChangeEvent: g,
89
- helper: B,
90
- input: V
94
+ className: v(x["tedi-textarea"], z),
95
+ value: H,
96
+ onChange: B,
97
+ onChangeEvent: y,
98
+ helper: V,
99
+ input: I
91
100
  }
92
101
  );
93
102
  });