@oneplatformdev/ui 0.1.99-beta.226 → 0.1.99-beta.228

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/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## 0.1.99-beta.228 (2026-02-23)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **Textarea:** set `counter` default to true and ensure proper handling in FormTextarea ([b7f5ec8](https://github.com/oneplatformdev/core-web/commit/b7f5ec8))
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated @oneplatformdev/utils to 0.1.99-beta.228
10
+ - Updated @oneplatformdev/hooks to 0.1.99-beta.228
11
+ - Updated @oneplatformdev/tokens to 0.1.99-beta.228
12
+
13
+ ### ❤️ Thank You
14
+
15
+ - Bohdan Radchenko
16
+
17
+ ## 0.1.99-beta.227 (2026-02-23)
18
+
19
+ ### 🚀 Features
20
+
21
+ - **FormTextarea:** add `counter` prop support with conditional rendering based on field state ([5b7ca3d](https://github.com/oneplatformdev/core-web/commit/5b7ca3d))
22
+
23
+ ### 🧱 Updated Dependencies
24
+
25
+ - Updated @oneplatformdev/utils to 0.1.99-beta.227
26
+ - Updated @oneplatformdev/hooks to 0.1.99-beta.227
27
+ - Updated @oneplatformdev/tokens to 0.1.99-beta.227
28
+
29
+ ### ❤️ Thank You
30
+
31
+ - Bohdan Radchenko
32
+
1
33
  ## 0.1.99-beta.226 (2026-02-23)
2
34
 
3
35
  ### 🚀 Features
@@ -1,24 +1,24 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
- import { FormControl as T } from "../Form/Form.js";
3
- import { FormRenderControl as S } from "../Form/FormRenderControl.js";
4
- import { Input as V } from "../Input/Input.js";
5
- import { forwardRef as j } from "react";
6
- function q(D, o) {
7
- const { form: a, tooltip: x, tooltipProps: P, label: b, name: u, maxLength: s, counter: y, onChange: C, onBlur: F, onPaste: w, style: I, onPastePrepare: p, ...B } = D;
2
+ import { FormControl as S } from "../Form/Form.js";
3
+ import { FormRenderControl as V } from "../Form/FormRenderControl.js";
4
+ import { Input as j } from "../Input/Input.js";
5
+ import { forwardRef as q } from "react";
6
+ function w(D, o) {
7
+ const { form: a, tooltip: x, tooltipProps: P, label: b, name: u, maxLength: s, counter: y, onChange: C, onBlur: F, onPaste: A, style: I, onPastePrepare: p, ...B } = D;
8
8
  return /* @__PURE__ */ m(
9
- S,
9
+ V,
10
10
  {
11
11
  form: a,
12
12
  name: u,
13
13
  tooltip: x,
14
14
  tooltipProps: P,
15
15
  label: b,
16
- render: ({ field: n }) => /* @__PURE__ */ m(T, { children: /* @__PURE__ */ m(
17
- V,
16
+ render: ({ field: n, fieldState: R }) => /* @__PURE__ */ m(S, { children: /* @__PURE__ */ m(
17
+ j,
18
18
  {
19
19
  ...n,
20
20
  ...B,
21
- counter: y,
21
+ counter: R.error ? !1 : y,
22
22
  maxLength: s,
23
23
  ref: (t) => {
24
24
  n.ref(t), typeof o == "function" ? o(t) : o && (o.current = t);
@@ -43,8 +43,8 @@ function q(D, o) {
43
43
  t.preventDefault();
44
44
  return;
45
45
  }
46
- const i = h.slice(0, v), R = l + i + d;
47
- t.preventDefault(), a.setValue(u, R, {
46
+ const i = h.slice(0, v), T = l + i + d;
47
+ t.preventDefault(), a.setValue(u, T, {
48
48
  shouldDirty: !0,
49
49
  shouldTouch: !0
50
50
  }), requestAnimationFrame(() => {
@@ -62,8 +62,8 @@ function q(D, o) {
62
62
  }
63
63
  );
64
64
  }
65
- const z = j(q);
65
+ const G = q(w);
66
66
  export {
67
- z as FormInput
67
+ G as FormInput
68
68
  };
69
69
  //# sourceMappingURL=FormInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormInput.js","sources":["../../src/FormInput/FormInput.tsx"],"sourcesContent":["import { FormControl, FormRenderControl } from '../Form';\nimport { Input } from '../Input';\nimport { FormInputProps } from './FormInput.types';\nimport { FieldValues, Path, PathValue } from 'react-hook-form';\nimport { forwardRef, ReactElement, Ref, RefObject } from 'react';\n\n// TODO: add description\n// export const FormInput = <Data extends FieldValues>(\n// props: FormInputProps<Data> & { inputRef?: Ref<HTMLInputElement> }\n// ) => {\n// const { inputRef, form, label, name, onChange, onBlur, style, ...rest } =\n// props;\n// return (\n// <FormRenderControl\n// form={form}\n// name={name}\n// label={label}\n// render={({ field }) => (\n// <FormControl>\n// <Input\n// {...field}\n// {...rest}\n// ref={(el) => {\n// field.ref(el);\n// if (typeof inputRef === 'function') {\n// inputRef(el);\n// } else if (inputRef) {\n// (inputRef as RefObject<HTMLInputElement | null>).current = el;\n// }\n// }}\n// style={style}\n// value={field.value || ''}\n// onChange={(...rest) => {\n// field.onChange?.(...rest);\n// onChange?.(...rest);\n// }}\n// onBlur={(...rest) => {\n// field.onBlur?.();\n// onBlur?.(...rest);\n// }}\n// />\n// </FormControl>\n// )}\n// />\n// );\n// };\n\nfunction FormInputInner<Data extends FieldValues>(\n props: FormInputProps<Data>,\n ref: Ref<HTMLInputElement>\n) {\n const { form, tooltip, tooltipProps, label, name, maxLength, counter, onChange, onBlur, onPaste, style, onPastePrepare, ...rest } = props;\n return (\n <FormRenderControl\n form={form}\n name={name}\n tooltip={tooltip}\n tooltipProps={tooltipProps}\n label={label}\n render={({ field }) => (\n <FormControl>\n <Input\n {...field}\n {...rest}\n counter={counter}\n maxLength={maxLength}\n ref={(el) => {\n field.ref(el);\n if (typeof ref === 'function') {\n ref(el);\n } else if (ref) {\n (ref as RefObject<HTMLInputElement | null>).current = el;\n }\n }}\n style={style}\n value={field.value || ''}\n onChange={(...rest) => {\n field.onChange?.(...rest);\n onChange?.(...rest);\n }}\n onPaste={(e) => {\n const pasted = e.clipboardData.getData('text');\n const input = e.currentTarget;\n\n const start = input.selectionStart ?? input.value.length;\n const end = input.selectionEnd ?? input.value.length;\n\n const current = input.value;\n\n let next = current.slice(0, start) + pasted + current.slice(end);\n\n if (onPastePrepare) {\n next = onPastePrepare(next, e);\n }\n\n if (typeof maxLength !== 'number') {\n e.preventDefault();\n\n form.setValue(name, next as PathValue<Data, Path<Data>>, {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n return;\n }\n\n const before = current.slice(0, start);\n const after = current.slice(end);\n\n const available = maxLength - (before.length + after.length);\n\n if (available <= 0) {\n e.preventDefault();\n return;\n }\n\n const limitedPaste = pasted.slice(0, available);\n const limitedNext = before + limitedPaste + after;\n\n e.preventDefault();\n\n form.setValue(name, limitedNext as PathValue<Data, Path<Data>>, {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n requestAnimationFrame(() => {\n input.setSelectionRange(\n before.length + limitedPaste.length,\n before.length + limitedPaste.length\n );\n });\n }}\n onBlur={(...rest) => {\n field.onBlur?.();\n onBlur?.(...rest);\n }}\n />\n </FormControl>\n )}\n />\n );\n}\n\nexport const FormInput = forwardRef(FormInputInner) as <Data extends FieldValues>(\n props: FormInputProps<Data> & { ref?: Ref<HTMLInputElement> }\n) => ReactElement;\n"],"names":["FormInputInner","props","ref","form","tooltip","tooltipProps","label","name","maxLength","counter","onChange","onBlur","onPaste","style","onPastePrepare","rest","jsx","FormRenderControl","field","FormControl","Input","el","e","pasted","input","start","end","current","next","before","after","available","limitedPaste","limitedNext","FormInput","forwardRef"],"mappings":";;;;;AA+CA,SAASA,EACPC,GACAC,GACA;AACA,QAAM,EAAE,MAAAC,GAAM,SAAAC,GAAS,cAAAC,GAAc,OAAAC,GAAO,MAAAC,GAAM,WAAAC,GAAW,SAAAC,GAAS,UAAAC,GAAU,QAAAC,GAAQ,SAAAC,GAAS,OAAAC,GAAO,gBAAAC,GAAgB,GAAGC,MAASd;AACpI,SACE,gBAAAe;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAd;AAAA,MACA,MAAAI;AAAA,MACA,SAAAH;AAAA,MACA,cAAAC;AAAA,MACA,OAAAC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAY,EAAA,wBACRC,GAAA,EACC,UAAA,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACE,GAAGF;AA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sBAAsB,MAAM;AAC1B,cAAAT,EAAM;AAAA,gBACJK,EAAO,SAASG,EAAa;AAAA,gBAC7BH,EAAO,SAASG,EAAa;AAAA,cAAA;AAAA,YAEjC,CAAC;AAAA,UACH;AAAA,UACA,QAAQ,IAAIjB,MAAS;AACnB,YAAAG,EAAM,SAAA,GACNP,IAAS,GAAGI,CAAI;AAAA,UAClB;AAAA,QAAA;AAAA,MAAA,EACF,CACF;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,MAAMmB,IAAYC,EAAWnC,CAAc;"}
1
+ {"version":3,"file":"FormInput.js","sources":["../../src/FormInput/FormInput.tsx"],"sourcesContent":["import { FormControl, FormRenderControl } from '../Form';\nimport { Input } from '../Input';\nimport { FormInputProps } from './FormInput.types';\nimport { FieldValues, Path, PathValue } from 'react-hook-form';\nimport { forwardRef, ReactElement, Ref, RefObject } from 'react';\n\n// TODO: add description\n// export const FormInput = <Data extends FieldValues>(\n// props: FormInputProps<Data> & { inputRef?: Ref<HTMLInputElement> }\n// ) => {\n// const { inputRef, form, label, name, onChange, onBlur, style, ...rest } =\n// props;\n// return (\n// <FormRenderControl\n// form={form}\n// name={name}\n// label={label}\n// render={({ field }) => (\n// <FormControl>\n// <Input\n// {...field}\n// {...rest}\n// ref={(el) => {\n// field.ref(el);\n// if (typeof inputRef === 'function') {\n// inputRef(el);\n// } else if (inputRef) {\n// (inputRef as RefObject<HTMLInputElement | null>).current = el;\n// }\n// }}\n// style={style}\n// value={field.value || ''}\n// onChange={(...rest) => {\n// field.onChange?.(...rest);\n// onChange?.(...rest);\n// }}\n// onBlur={(...rest) => {\n// field.onBlur?.();\n// onBlur?.(...rest);\n// }}\n// />\n// </FormControl>\n// )}\n// />\n// );\n// };\n\nfunction FormInputInner<Data extends FieldValues>(\n props: FormInputProps<Data>,\n ref: Ref<HTMLInputElement>\n) {\n const { form, tooltip, tooltipProps, label, name, maxLength, counter, onChange, onBlur, onPaste, style, onPastePrepare, ...rest } = props;\n return (\n <FormRenderControl\n form={form}\n name={name}\n tooltip={tooltip}\n tooltipProps={tooltipProps}\n label={label}\n render={({ field, fieldState }) => (\n <FormControl>\n <Input\n {...field}\n {...rest}\n counter={!!fieldState.error ? false : counter}\n maxLength={maxLength}\n ref={(el) => {\n field.ref(el);\n if (typeof ref === 'function') {\n ref(el);\n } else if (ref) {\n (ref as RefObject<HTMLInputElement | null>).current = el;\n }\n }}\n style={style}\n value={field.value || ''}\n onChange={(...rest) => {\n field.onChange?.(...rest);\n onChange?.(...rest);\n }}\n onPaste={(e) => {\n const pasted = e.clipboardData.getData('text');\n const input = e.currentTarget;\n\n const start = input.selectionStart ?? input.value.length;\n const end = input.selectionEnd ?? input.value.length;\n\n const current = input.value;\n\n let next = current.slice(0, start) + pasted + current.slice(end);\n\n if (onPastePrepare) {\n next = onPastePrepare(next, e);\n }\n\n if (typeof maxLength !== 'number') {\n e.preventDefault();\n\n form.setValue(name, next as PathValue<Data, Path<Data>>, {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n return;\n }\n\n const before = current.slice(0, start);\n const after = current.slice(end);\n\n const available = maxLength - (before.length + after.length);\n\n if (available <= 0) {\n e.preventDefault();\n return;\n }\n\n const limitedPaste = pasted.slice(0, available);\n const limitedNext = before + limitedPaste + after;\n\n e.preventDefault();\n\n form.setValue(name, limitedNext as PathValue<Data, Path<Data>>, {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n requestAnimationFrame(() => {\n input.setSelectionRange(\n before.length + limitedPaste.length,\n before.length + limitedPaste.length\n );\n });\n }}\n onBlur={(...rest) => {\n field.onBlur?.();\n onBlur?.(...rest);\n }}\n />\n </FormControl>\n )}\n />\n );\n}\n\nexport const FormInput = forwardRef(FormInputInner) as <Data extends FieldValues>(\n props: FormInputProps<Data> & { ref?: Ref<HTMLInputElement> }\n) => ReactElement;\n"],"names":["FormInputInner","props","ref","form","tooltip","tooltipProps","label","name","maxLength","counter","onChange","onBlur","onPaste","style","onPastePrepare","rest","jsx","FormRenderControl","field","fieldState","FormControl","Input","el","e","pasted","input","start","end","current","next","before","after","available","limitedPaste","limitedNext","FormInput","forwardRef"],"mappings":";;;;;AA+CA,SAASA,EACPC,GACAC,GACA;AACA,QAAM,EAAE,MAAAC,GAAM,SAAAC,GAAS,cAAAC,GAAc,OAAAC,GAAO,MAAAC,GAAM,WAAAC,GAAW,SAAAC,GAAS,UAAAC,GAAU,QAAAC,GAAQ,SAAAC,GAAS,OAAAC,GAAO,gBAAAC,GAAgB,GAAGC,MAASd;AACpI,SACE,gBAAAe;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAd;AAAA,MACA,MAAAI;AAAA,MACA,SAAAH;AAAA,MACA,cAAAC;AAAA,MACA,OAAAC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAY,GAAO,YAAAC,EAAA,wBACfC,GAAA,EACC,UAAA,gBAAAJ;AAAA,QAACK;AAAA,QAAA;AAAA,UACE,GAAGH;AAAA,UACH,GAAGH;AAAA,UACJ,SAAWI,EAAW,QAAQ,KAAQV;AAAA,UACtC,WAAAD;AAAA,UACA,KAAK,CAACc,MAAO;AACX,YAAAJ,EAAM,IAAII,CAAE,GACR,OAAOpB,KAAQ,aACjBA,EAAIoB,CAAE,IACGpB,MACRA,EAA2C,UAAUoB;AAAA,UAE1D;AAAA,UACA,OAAAT;AAAA,UACA,OAAOK,EAAM,SAAS;AAAA,UACtB,UAAU,IAAIH,MAAS;AACrB,YAAAG,EAAM,WAAW,GAAGH,CAAI,GACxBL,IAAW,GAAGK,CAAI;AAAA,UACpB;AAAA,UACA,SAAS,CAACQ,MAAM;AACd,kBAAMC,IAASD,EAAE,cAAc,QAAQ,MAAM,GACvCE,IAAQF,EAAE,eAEVG,IAAQD,EAAM,kBAAkBA,EAAM,MAAM,QAC5CE,IAAMF,EAAM,gBAAgBA,EAAM,MAAM,QAExCG,IAAUH,EAAM;AAEtB,gBAAII,IAAOD,EAAQ,MAAM,GAAGF,CAAK,IAAIF,IAASI,EAAQ,MAAMD,CAAG;AAM/D,gBAJIb,MACFe,IAAOf,EAAee,GAAMN,CAAC,IAG3B,OAAOf,KAAc,UAAU;AACjC,cAAAe,EAAE,eAAA,GAEFpB,EAAK,SAASI,GAAMsB,GAAqC;AAAA,gBACvD,aAAa;AAAA,gBACb,aAAa;AAAA,cAAA,CACd;AAED;AAAA,YACF;AAEA,kBAAMC,IAASF,EAAQ,MAAM,GAAGF,CAAK,GAC/BK,IAAQH,EAAQ,MAAMD,CAAG,GAEzBK,IAAYxB,KAAasB,EAAO,SAASC,EAAM;AAErD,gBAAIC,KAAa,GAAG;AAClB,cAAAT,EAAE,eAAA;AACF;AAAA,YACF;AAEA,kBAAMU,IAAeT,EAAO,MAAM,GAAGQ,CAAS,GACxCE,IAAcJ,IAASG,IAAeF;AAE5C,YAAAR,EAAE,eAAA,GAEFpB,EAAK,SAASI,GAAM2B,GAA4C;AAAA,cAC9D,aAAa;AAAA,cACb,aAAa;AAAA,YAAA,CACd,GAED,sBAAsB,MAAM;AAC1B,cAAAT,EAAM;AAAA,gBACJK,EAAO,SAASG,EAAa;AAAA,gBAC7BH,EAAO,SAASG,EAAa;AAAA,cAAA;AAAA,YAEjC,CAAC;AAAA,UACH;AAAA,UACA,QAAQ,IAAIlB,MAAS;AACnB,YAAAG,EAAM,SAAA,GACNP,IAAS,GAAGI,CAAI;AAAA,UAClB;AAAA,QAAA;AAAA,MAAA,EACF,CACF;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,MAAMoB,IAAYC,EAAWpC,CAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormTextarea.js","sources":["../../src/FormTextarea/FormTextarea.tsx"],"sourcesContent":["import { FormControl, FormRenderControl } from '../Form';\nimport { FormTextareaProps } from './FormTextarea.types';\nimport { FieldValues } from 'react-hook-form';\nimport { Textarea } from '../Textarea';\n\n// TODO: add description\nexport const FormTextarea = <Data extends FieldValues>(\n props: FormTextareaProps<Data>\n) => {\n const { form, label, tooltip, tooltipProps, name, containerProps, counter, ...rest } = props;\n return (\n <FormRenderControl\n form={form}\n tooltip={tooltip}\n tooltipProps={tooltipProps}\n name={name}\n label={label}\n containerProps={containerProps}\n render={({ field, fieldState }) => (\n <FormControl>\n <Textarea\n {...field}\n value={field.value || ''}\n {...rest}\n counter={fieldState.error ? false : counter}\n />\n </FormControl>\n )}\n />\n )\n};\n"],"names":["FormTextarea","props","form","label","tooltip","tooltipProps","name","containerProps","counter","rest","jsx","FormRenderControl","field","fieldState","FormControl","Textarea"],"mappings":";;;;AAMO,MAAMA,IAAe,CAC1BC,MACG;AACH,QAAM,EAAE,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,cAAAC,GAAc,MAAAC,GAAM,gBAAAC,GAAgB,SAAAC,GAAS,GAAGC,EAAA,IAASR;AACvF,SACE,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAT;AAAA,MACA,SAAAE;AAAA,MACA,cAAAC;AAAA,MACA,MAAAC;AAAA,MACA,OAAAH;AAAA,MACA,gBAAAI;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAK,GAAO,YAAAC,EAAA,wBACfC,GAAA,EACC,UAAA,gBAAAJ;AAAA,QAACK;AAAA,QAAA;AAAA,UACE,GAAGH;AAAA,UACJ,OAAOA,EAAM,SAAS;AAAA,UACrB,GAAGH;AAAA,UACJ,SAASI,EAAW,QAAQ,KAAQL;AAAA,QAAA;AAAA,MAAA,EACtC,CACF;AAAA,IAAA;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"FormTextarea.js","sources":["../../src/FormTextarea/FormTextarea.tsx"],"sourcesContent":["import { FormControl, FormRenderControl } from '../Form';\nimport { FormTextareaProps } from './FormTextarea.types';\nimport { FieldValues } from 'react-hook-form';\nimport { Textarea } from '../Textarea';\n\n// TODO: add description\nexport const FormTextarea = <Data extends FieldValues>(\n props: FormTextareaProps<Data>\n) => {\n const { form, label, tooltip, tooltipProps, name, containerProps, counter, ...rest } = props;\n return (\n <FormRenderControl\n form={form}\n tooltip={tooltip}\n tooltipProps={tooltipProps}\n name={name}\n label={label}\n containerProps={containerProps}\n render={({ field, fieldState }) => (\n <FormControl>\n <Textarea\n {...field}\n value={field.value || ''}\n {...rest}\n counter={!!fieldState.error ? false : counter}\n />\n </FormControl>\n )}\n />\n )\n};\n"],"names":["FormTextarea","props","form","label","tooltip","tooltipProps","name","containerProps","counter","rest","jsx","FormRenderControl","field","fieldState","FormControl","Textarea"],"mappings":";;;;AAMO,MAAMA,IAAe,CAC1BC,MACG;AACH,QAAM,EAAE,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,cAAAC,GAAc,MAAAC,GAAM,gBAAAC,GAAgB,SAAAC,GAAS,GAAGC,EAAA,IAASR;AACvF,SACE,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAT;AAAA,MACA,SAAAE;AAAA,MACA,cAAAC;AAAA,MACA,MAAAC;AAAA,MACA,OAAAH;AAAA,MACA,gBAAAI;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAK,GAAO,YAAAC,EAAA,wBACfC,GAAA,EACC,UAAA,gBAAAJ;AAAA,QAACK;AAAA,QAAA;AAAA,UACE,GAAGH;AAAA,UACJ,OAAOA,EAAM,SAAS;AAAA,UACrB,GAAGH;AAAA,UACJ,SAAWI,EAAW,QAAQ,KAAQL;AAAA,QAAA;AAAA,MAAA,EACxC,CACF;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -1,22 +1,22 @@
1
1
  import { jsxs as d, Fragment as v, jsx as A } from "react/jsx-runtime";
2
2
  import * as w from "react";
3
3
  import { useId as y, useRef as z, useState as F, useImperativeHandle as N, useEffect as T } from "react";
4
- import { cn as f } from "@oneplatformdev/utils";
4
+ import { cn as m } from "@oneplatformdev/utils";
5
5
  import { useAutosizeTextArea as C } from "./useAutosizeTextArea.js";
6
6
  const R = w.forwardRef(
7
- (m, c) => {
7
+ (f, c) => {
8
8
  const {
9
9
  className: g,
10
10
  value: r = "",
11
11
  maxHeight: a = Number.MAX_SAFE_INTEGER,
12
12
  minHeight: i = 40,
13
13
  resizeble: x = !1,
14
- counter: s = !1,
15
- id: n = "",
14
+ counter: n = !0,
15
+ id: s = "",
16
16
  onChange: p,
17
17
  onTransform: l,
18
18
  ...o
19
- } = m, u = y(), t = z(null), [b, h] = F("");
19
+ } = f, u = y(), t = z(null), [b, h] = F("");
20
20
  return C({
21
21
  textAreaRef: t,
22
22
  triggerAutoSize: b,
@@ -34,29 +34,29 @@ const R = w.forwardRef(
34
34
  /* @__PURE__ */ A(
35
35
  "textarea",
36
36
  {
37
- id: n || u,
37
+ id: s || u,
38
38
  ...o,
39
39
  ref: t,
40
40
  value: r,
41
41
  onChange: (e) => {
42
42
  typeof l?.(e.target.value, e) == "string" && (e.target.value = l(e.target.value, e)), p?.(e);
43
43
  },
44
- className: f(
44
+ className: m(
45
45
  "flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm",
46
46
  "rounded-lg border border-input bg-[#FCFCFC] shadow-none",
47
47
  "placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
48
48
  "focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring",
49
49
  x ? "resize" : "resize-none overflow-hidden!",
50
- s && "pb-1",
50
+ n && "pb-1",
51
51
  g
52
52
  )
53
53
  }
54
54
  ),
55
- s && /* @__PURE__ */ d(
55
+ n && typeof o?.maxLength == "number" && /* @__PURE__ */ d(
56
56
  "label",
57
57
  {
58
- htmlFor: n || u,
59
- className: f(
58
+ htmlFor: s || u,
59
+ className: m(
60
60
  "w-full text-right inline-flex items-center justify-end",
61
61
  "text-xs font-medium leading-[1.2] text-muted-foreground",
62
62
  "peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../src/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEffect, useId, useImperativeHandle, useRef, useState } from 'react';\nimport { cn } from '@oneplatformdev/utils';\n\nimport { TextareaProps } from './Textarea.types';\nimport { useAutosizeTextArea } from './useAutosizeTextArea';\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (textareaProps, ref) => {\n const {\n className,\n value = '',\n maxHeight = Number.MAX_SAFE_INTEGER,\n minHeight = 40,\n resizeble = false,\n counter = false,\n id: customId = '',\n onChange,\n onTransform,\n ...props\n } = textareaProps;\n const id = useId();\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const [triggerAutoSize, setTriggerAutoSize] = useState('');\n\n useAutosizeTextArea({\n textAreaRef,\n triggerAutoSize: triggerAutoSize,\n maxHeight,\n minHeight,\n });\n\n useImperativeHandle(ref, () => ({\n ...((textAreaRef.current ?? {}) as HTMLTextAreaElement),\n textArea: textAreaRef.current as HTMLTextAreaElement,\n focus: () => textAreaRef?.current?.focus(),\n maxHeight,\n minHeight,\n }));\n\n useEffect(() => {\n setTriggerAutoSize(value as string);\n }, [props?.defaultValue, value]);\n\n return (\n <>\n <textarea\n id={customId || id}\n {...props}\n ref={textAreaRef}\n value={value}\n onChange={(e) => {\n if (typeof onTransform?.(e.target.value, e) === 'string') {\n e.target.value = onTransform(e.target.value, e);\n }\n onChange?.(e);\n }}\n className={cn(\n 'flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm',\n 'rounded-lg border border-input bg-[#FCFCFC] shadow-none',\n 'placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n 'focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring',\n resizeble ? 'resize' : 'resize-none overflow-hidden!',\n counter && 'pb-1',\n className\n )}\n />\n {counter && (\n <label\n htmlFor={customId || id}\n className={cn(\n 'w-full text-right inline-flex items-center justify-end',\n 'text-xs font-medium leading-[1.2] text-muted-foreground',\n 'peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\n )}\n >\n {String(value || '').length} / {props?.maxLength}\n </label>\n )}\n </>\n );\n }\n);\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"],"names":["Textarea","React","textareaProps","ref","className","value","maxHeight","minHeight","resizeble","counter","customId","onChange","onTransform","props","id","useId","textAreaRef","useRef","triggerAutoSize","setTriggerAutoSize","useState","useAutosizeTextArea","useImperativeHandle","useEffect","jsxs","Fragment","jsx","cn"],"mappings":";;;;;AAOA,MAAMA,IAAWC,EAAM;AAAA,EACrB,CAACC,GAAeC,MAAQ;AACtB,UAAM;AAAA,MACJ,WAAAC;AAAA,MACA,OAAAC,IAAQ;AAAA,MACR,WAAAC,IAAY,OAAO;AAAA,MACnB,WAAAC,IAAY;AAAA,MACZ,WAAAC,IAAY;AAAA,MACZ,SAAAC,IAAU;AAAA,MACV,IAAIC,IAAW;AAAA,MACf,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,GAAGC;AAAA,IAAA,IACDX,GACEY,IAAKC,EAAA,GACLC,IAAcC,EAAmC,IAAI,GACrD,CAACC,GAAiBC,CAAkB,IAAIC,EAAS,EAAE;AAEzD,WAAAC,EAAoB;AAAA,MAClB,aAAAL;AAAA,MACA,iBAAAE;AAAA,MACA,WAAAZ;AAAA,MACA,WAAAC;AAAA,IAAA,CACD,GAEDe,EAAoBnB,GAAK,OAAO;AAAA,MAC9B,GAAKa,EAAY,WAAW,CAAA;AAAA,MAC5B,UAAUA,EAAY;AAAA,MACtB,OAAO,MAAMA,GAAa,SAAS,MAAA;AAAA,MACnC,WAAAV;AAAA,MACA,WAAAC;AAAA,IAAA,EACA,GAEFgB,EAAU,MAAM;AACd,MAAAJ,EAAmBd,CAAe;AAAA,IACpC,GAAG,CAACQ,GAAO,cAAcR,CAAK,CAAC,GAG7B,gBAAAmB,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAIhB,KAAYI;AAAA,UACf,GAAGD;AAAA,UACJ,KAAKG;AAAA,UACL,OAAAX;AAAA,UACA,UAAU,CAAC,MAAM;AACf,YAAI,OAAOO,IAAc,EAAE,OAAO,OAAO,CAAC,KAAM,aAC9C,EAAE,OAAO,QAAQA,EAAY,EAAE,OAAO,OAAO,CAAC,IAEhDD,IAAW,CAAC;AAAA,UACd;AAAA,UACA,WAAWgB;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACAnB,IAAY,WAAW;AAAA,YACvBC,KAAW;AAAA,YACXL;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,MAEDK,KACC,gBAAAe;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAASd,KAAYI;AAAA,UACrB,WAAWa;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,UAGD,UAAA;AAAA,YAAA,OAAOtB,KAAS,EAAE,EAAE;AAAA,YAAO;AAAA,YAAIQ,GAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACzC,GAEJ;AAAA,EAEJ;AACF;AACAb,EAAS,cAAc;"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../src/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEffect, useId, useImperativeHandle, useRef, useState } from 'react';\nimport { cn } from '@oneplatformdev/utils';\n\nimport { TextareaProps } from './Textarea.types';\nimport { useAutosizeTextArea } from './useAutosizeTextArea';\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (textareaProps, ref) => {\n const {\n className,\n value = '',\n maxHeight = Number.MAX_SAFE_INTEGER,\n minHeight = 40,\n resizeble = false,\n counter = true,\n id: customId = '',\n onChange,\n onTransform,\n ...props\n } = textareaProps;\n const id = useId();\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const [triggerAutoSize, setTriggerAutoSize] = useState('');\n\n useAutosizeTextArea({\n textAreaRef,\n triggerAutoSize: triggerAutoSize,\n maxHeight,\n minHeight,\n });\n\n useImperativeHandle(ref, () => ({\n ...((textAreaRef.current ?? {}) as HTMLTextAreaElement),\n textArea: textAreaRef.current as HTMLTextAreaElement,\n focus: () => textAreaRef?.current?.focus(),\n maxHeight,\n minHeight,\n }));\n\n useEffect(() => {\n setTriggerAutoSize(value as string);\n }, [props?.defaultValue, value]);\n\n return (\n <>\n <textarea\n id={customId || id}\n {...props}\n ref={textAreaRef}\n value={value}\n onChange={(e) => {\n if (typeof onTransform?.(e.target.value, e) === 'string') {\n e.target.value = onTransform(e.target.value, e);\n }\n onChange?.(e);\n }}\n className={cn(\n 'flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm',\n 'rounded-lg border border-input bg-[#FCFCFC] shadow-none',\n 'placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n 'focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring',\n resizeble ? 'resize' : 'resize-none overflow-hidden!',\n counter && 'pb-1',\n className\n )}\n />\n {counter && typeof props?.maxLength === 'number' && (\n <label\n htmlFor={customId || id}\n className={cn(\n 'w-full text-right inline-flex items-center justify-end',\n 'text-xs font-medium leading-[1.2] text-muted-foreground',\n 'peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\n )}\n >\n {String(value || '').length} / {props?.maxLength}\n </label>\n )}\n </>\n );\n }\n);\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"],"names":["Textarea","React","textareaProps","ref","className","value","maxHeight","minHeight","resizeble","counter","customId","onChange","onTransform","props","id","useId","textAreaRef","useRef","triggerAutoSize","setTriggerAutoSize","useState","useAutosizeTextArea","useImperativeHandle","useEffect","jsxs","Fragment","jsx","cn"],"mappings":";;;;;AAOA,MAAMA,IAAWC,EAAM;AAAA,EACrB,CAACC,GAAeC,MAAQ;AACtB,UAAM;AAAA,MACJ,WAAAC;AAAA,MACA,OAAAC,IAAQ;AAAA,MACR,WAAAC,IAAY,OAAO;AAAA,MACnB,WAAAC,IAAY;AAAA,MACZ,WAAAC,IAAY;AAAA,MACZ,SAAAC,IAAU;AAAA,MACV,IAAIC,IAAW;AAAA,MACf,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,GAAGC;AA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YAAO;AAAA,YAAIQ,GAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACzC,GAEJ;AAAA,EAEJ;AACF;AACAb,EAAS,cAAc;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneplatformdev/ui",
3
- "version": "0.1.99-beta.226",
3
+ "version": "0.1.99-beta.228",
4
4
  "description": "UI component library for OnePlatform",
5
5
  "author": "One Platform Development Team",
6
6
  "keywords": [
@@ -106,9 +106,9 @@
106
106
  "recharts": "^3.2.0",
107
107
  "sonner": "^2.0.7",
108
108
  "vaul": "^1.1.2",
109
- "@oneplatformdev/hooks": "^0.1.99-beta.226",
110
- "@oneplatformdev/utils": "^0.1.99-beta.226",
111
- "@oneplatformdev/tokens": "^0.1.99-beta.226"
109
+ "@oneplatformdev/tokens": "^0.1.99-beta.228",
110
+ "@oneplatformdev/utils": "^0.1.99-beta.228",
111
+ "@oneplatformdev/hooks": "^0.1.99-beta.228"
112
112
  },
113
113
  "scripts": {
114
114
  "chromatic": "chromatic"