@oneplatformdev/ui 0.0.1-beta.13 → 0.0.1-beta.130

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 (144) hide show
  1. package/Accordion/Accordion.d.ts +5 -3
  2. package/Accordion/Accordion.mjs +27 -24
  3. package/AlertDialog/AlertDialogRoot.d.ts +2 -2
  4. package/AlertDialog/AlertDialogRoot.mjs +7 -7
  5. package/Button/Button.mjs +11 -10
  6. package/Button/buttonVariants.mjs +14 -8
  7. package/Calendar/Calendar.mjs +3 -2
  8. package/Card/Card.d.ts +1 -1
  9. package/Card/Card.mjs +24 -23
  10. package/Checkbox/Checkbox.d.ts +5 -4
  11. package/Checkbox/Checkbox.mjs +48 -21
  12. package/Checkbox/Checkbox.types.d.ts +10 -0
  13. package/Checkbox/index.d.ts +1 -0
  14. package/Checkbox/index.mjs +3 -2
  15. package/Combobox/Combobox.d.ts +2 -2
  16. package/Combobox/Combobox.mjs +12 -123
  17. package/Combobox/Combobox.types.d.ts +36 -1
  18. package/Combobox/ComboboxOptionItem.d.ts +5 -0
  19. package/Combobox/ComboboxOptionItem.mjs +69 -0
  20. package/Combobox/ComboboxOptions.d.ts +4 -0
  21. package/Combobox/ComboboxOptions.mjs +12 -0
  22. package/Combobox/index.mjs +1 -1
  23. package/Combobox-CkGEIfTD.js +325 -0
  24. package/Command/Command.d.ts +1 -1
  25. package/Command/Command.mjs +15 -7
  26. package/DataTable/DataTable.d.ts +10 -3
  27. package/DataTable/DataTable.mjs +33 -33
  28. package/DataTable/DataTableColumnFilter.d.ts +4 -0
  29. package/DataTable/DataTableColumnFilter.mjs +31 -0
  30. package/DatePicker/DatePicker.mjs +2 -2
  31. package/Dialog/Dialog.d.ts +7 -3
  32. package/Dialog/Dialog.mjs +109 -65
  33. package/Dialog/DialogOverlayScope.d.ts +9 -0
  34. package/Dialog/DialogOverlayScope.mjs +10 -0
  35. package/Dialog/index.d.ts +1 -0
  36. package/Dialog/index.mjs +12 -8
  37. package/DropdownMenu/DropdownMenu.d.ts +2 -2
  38. package/DropdownMenu/DropdownMenu.mjs +30 -26
  39. package/Dropzone/Dropzone.d.ts +3 -3
  40. package/Dropzone/Dropzone.mjs +136 -104
  41. package/Dropzone/Dropzone.types.d.ts +16 -9
  42. package/Dropzone/{FilePreview.mjs → DropzoneFilePreview.mjs} +1 -1
  43. package/Dropzone/DropzoneSinglePickPreview.d.ts +10 -0
  44. package/Dropzone/DropzoneSinglePickPreview.mjs +44 -0
  45. package/Dropzone/DropzoneUtils.d.ts +1 -0
  46. package/Dropzone/DropzoneUtils.mjs +17 -8
  47. package/Dropzone/index.mjs +1 -1
  48. package/Form/Form.d.ts +2 -2
  49. package/Form/Form.mjs +48 -45
  50. package/Form/FormRenderControl.d.ts +2 -3
  51. package/Form/FormRenderControl.mjs +10 -10
  52. package/Form/FormRenderControl.types.d.ts +5 -7
  53. package/FormCheckbox/FormCheckbox.d.ts +2 -3
  54. package/FormCheckbox/FormCheckbox.mjs +23 -23
  55. package/FormCheckbox/FormCheckbox.types.d.ts +3 -3
  56. package/FormCombobox/FormCombobox.d.ts +2 -2
  57. package/FormCombobox/FormCombobox.mjs +6 -6
  58. package/FormCombobox/FormCombobox.types.d.ts +2 -3
  59. package/FormDatePicker/FormDatePicker.d.ts +2 -2
  60. package/FormDatePicker/FormDatePicker.mjs +20 -18
  61. package/FormDatePicker/FormDatePicker.types.d.ts +2 -3
  62. package/FormDropzone/FormDropzone.d.ts +4 -0
  63. package/FormDropzone/FormDropzone.mjs +19 -0
  64. package/FormDropzone/FormDropzone.types.d.ts +6 -0
  65. package/FormDropzone/index.d.ts +2 -0
  66. package/FormDropzone/index.mjs +4 -0
  67. package/FormDropzone/package.json +7 -0
  68. package/FormInput/FormInput.d.ts +5 -3
  69. package/FormInput/FormInput.mjs +37 -16
  70. package/FormInput/FormInput.types.d.ts +2 -3
  71. package/FormRadio/FormRadio.d.ts +4 -0
  72. package/FormRadio/FormRadio.mjs +40 -0
  73. package/FormRadio/FormRadio.types.d.ts +6 -0
  74. package/FormRadio/index.d.ts +2 -0
  75. package/FormRadio/index.mjs +4 -0
  76. package/FormRadio/package.json +7 -0
  77. package/FormSelect/FormSelect.d.ts +2 -3
  78. package/FormSelect/FormSelect.mjs +19 -17
  79. package/FormSelect/FormSelect.types.d.ts +2 -3
  80. package/FormTextarea/FormTextarea.d.ts +2 -3
  81. package/FormTextarea/FormTextarea.mjs +13 -12
  82. package/FormTextarea/FormTextarea.types.d.ts +2 -3
  83. package/Input/Input.mjs +50 -38
  84. package/Input/Input.types.d.ts +6 -2
  85. package/Input/inputVariants.mjs +9 -3
  86. package/Label/Label.d.ts +2 -2
  87. package/Label/labelVariants.mjs +7 -4
  88. package/LazyLoader/LazyLoader.mjs +5 -4
  89. package/LoadedIcon/LoadedIcon.d.ts +11 -0
  90. package/LoadedIcon/LoadedIcon.mjs +27 -0
  91. package/LoadedIcon/index.d.ts +1 -0
  92. package/LoadedIcon/index.mjs +4 -0
  93. package/LoadedIcon/package.json +7 -0
  94. package/LoadingMask/LoadingMask.d.ts +4 -1
  95. package/LoadingMask/LoadingMask.mjs +18 -56
  96. package/LoadingMask/LoadingMask.types.d.ts +5 -0
  97. package/LoadingMask/RenderLoadingMask.d.ts +3 -0
  98. package/LoadingMask/RenderLoadingMask.mjs +108 -0
  99. package/LoadingMask/index.d.ts +2 -0
  100. package/LoadingMask/index.mjs +4 -2
  101. package/Popover/Popover.d.ts +2 -2
  102. package/Popover/Popover.mjs +30 -21
  103. package/Radio/Radio.d.ts +4 -0
  104. package/Radio/Radio.mjs +12 -0
  105. package/Radio/Radio.types.d.ts +11 -0
  106. package/Radio/index.d.ts +2 -0
  107. package/Radio/index.mjs +4 -0
  108. package/Radio/package.json +7 -0
  109. package/RadioGroup/RadioGroup.d.ts +9 -3
  110. package/RadioGroup/RadioGroup.mjs +37 -19
  111. package/RadioGroup/index.mjs +4 -3
  112. package/ScrollArea/ScrollArea.d.ts +2 -2
  113. package/ScrollArea/ScrollArea.mjs +26 -13
  114. package/Search/Search.d.ts +1 -2
  115. package/Search/Search.mjs +36 -21
  116. package/Search/Search.types.d.ts +1 -0
  117. package/Select/Select.mjs +94 -63
  118. package/Select/Select.types.d.ts +11 -3
  119. package/Select/SelectRoot.d.ts +2 -2
  120. package/Select/SelectRoot.mjs +29 -24
  121. package/Sheet/Sheet.d.ts +5 -2
  122. package/Sheet/Sheet.mjs +33 -33
  123. package/TablePagination/TablePagination.d.ts +16 -0
  124. package/TablePagination/TablePagination.mjs +74 -0
  125. package/TablePagination/index.d.ts +1 -0
  126. package/TablePagination/index.mjs +4 -0
  127. package/TablePagination/package.json +7 -0
  128. package/Tabs/Tabs.d.ts +3 -2
  129. package/Tabs/Tabs.mjs +20 -6
  130. package/Tabs/Tabs.types.d.ts +5 -2
  131. package/Tabs/index.mjs +8 -7
  132. package/Textarea/Textarea.d.ts +1 -1
  133. package/Textarea/Textarea.mjs +72 -15
  134. package/Textarea/Textarea.types.d.ts +16 -2
  135. package/Textarea/useAutosizeTextArea.d.ts +3 -0
  136. package/Textarea/useAutosizeTextArea.mjs +20 -0
  137. package/Toast/toastVariants.mjs +3 -3
  138. package/index.css +1 -1
  139. package/index.d.ts +3 -0
  140. package/index.mjs +305 -290
  141. package/package.json +6 -6
  142. package/tailwind.config.mjs +13 -13
  143. /package/Dropzone/{FilePreview.d.ts → DropzoneFilePreview.d.ts} +0 -0
  144. /package/{FilePreview-Dhtv8F4u.js → DropzoneFilePreview-Dhtv8F4u.js} +0 -0
package/Sheet/Sheet.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { jsx as o, jsxs as n } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as d } from "react/jsx-runtime";
2
2
  import * as r from "react";
3
3
  import * as e from "@radix-ui/react-dialog";
4
- import { cva as c } from "class-variance-authority";
5
- import { X as f } from "lucide-react";
4
+ import { cva as f } from "class-variance-authority";
5
+ import { X as p } from "lucide-react";
6
6
  import { cn as i } from "@oneplatformdev/utils";
7
- const C = e.Root, R = e.Trigger, T = e.Close, p = e.Portal, d = r.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
7
+ const R = e.Root, T = e.Trigger, j = e.Close, h = e.Portal, l = r.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
8
8
  e.Overlay,
9
9
  {
10
10
  className: i(
@@ -15,8 +15,8 @@ const C = e.Root, R = e.Trigger, T = e.Close, p = e.Portal, d = r.forwardRef(({
15
15
  ref: s
16
16
  }
17
17
  ));
18
- d.displayName = e.Overlay.displayName;
19
- const h = c(
18
+ l.displayName = e.Overlay.displayName;
19
+ const g = f(
20
20
  "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
21
21
  {
22
22
  variants: {
@@ -31,17 +31,17 @@ const h = c(
31
31
  side: "right"
32
32
  }
33
33
  }
34
- ), g = r.forwardRef(({ side: t = "right", className: a, children: s, ...l }, m) => /* @__PURE__ */ n(p, { children: [
35
- /* @__PURE__ */ o(d, {}),
36
- /* @__PURE__ */ n(
34
+ ), u = r.forwardRef(({ side: t = "right", className: a, children: s, slotProps: n, ...m }, c) => /* @__PURE__ */ d(h, { children: [
35
+ /* @__PURE__ */ o(l, { ...(n == null ? void 0 : n.overlay) || {} }),
36
+ /* @__PURE__ */ d(
37
37
  e.Content,
38
38
  {
39
- ref: m,
40
- className: i(h({ side: t }), a),
41
- ...l,
39
+ ref: c,
40
+ className: i(g({ side: t }), a),
41
+ ...m,
42
42
  children: [
43
- /* @__PURE__ */ n(e.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
44
- /* @__PURE__ */ o(f, { className: "h-4 w-4" }),
43
+ /* @__PURE__ */ d(e.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
44
+ /* @__PURE__ */ o(p, { className: "h-4 w-4" }),
45
45
  /* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
46
46
  ] }),
47
47
  s
@@ -49,8 +49,8 @@ const h = c(
49
49
  }
50
50
  )
51
51
  ] }));
52
- g.displayName = e.Content.displayName;
53
- const u = ({
52
+ u.displayName = e.Content.displayName;
53
+ const y = ({
54
54
  className: t,
55
55
  ...a
56
56
  }) => /* @__PURE__ */ o(
@@ -63,8 +63,8 @@ const u = ({
63
63
  ...a
64
64
  }
65
65
  );
66
- u.displayName = "SheetHeader";
67
- const y = ({
66
+ y.displayName = "SheetHeader";
67
+ const x = ({
68
68
  className: t,
69
69
  ...a
70
70
  }) => /* @__PURE__ */ o(
@@ -77,8 +77,8 @@ const y = ({
77
77
  ...a
78
78
  }
79
79
  );
80
- y.displayName = "SheetFooter";
81
- const x = r.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
80
+ x.displayName = "SheetFooter";
81
+ const N = r.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
82
82
  e.Title,
83
83
  {
84
84
  ref: s,
@@ -86,8 +86,8 @@ const x = r.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
86
86
  ...a
87
87
  }
88
88
  ));
89
- x.displayName = e.Title.displayName;
90
- const N = r.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
89
+ N.displayName = e.Title.displayName;
90
+ const b = r.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
91
91
  e.Description,
92
92
  {
93
93
  ref: s,
@@ -95,16 +95,16 @@ const N = r.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ o(
95
95
  ...a
96
96
  }
97
97
  ));
98
- N.displayName = e.Description.displayName;
98
+ b.displayName = e.Description.displayName;
99
99
  export {
100
- C as Sheet,
101
- T as SheetClose,
102
- g as SheetContent,
103
- N as SheetDescription,
104
- y as SheetFooter,
105
- u as SheetHeader,
106
- d as SheetOverlay,
107
- p as SheetPortal,
108
- x as SheetTitle,
109
- R as SheetTrigger
100
+ R as Sheet,
101
+ j as SheetClose,
102
+ u as SheetContent,
103
+ b as SheetDescription,
104
+ x as SheetFooter,
105
+ y as SheetHeader,
106
+ l as SheetOverlay,
107
+ h as SheetPortal,
108
+ N as SheetTitle,
109
+ T as SheetTrigger
110
110
  };
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+
3
+ interface IProps {
4
+ limit: number;
5
+ offset: number;
6
+ totalRows: number;
7
+ setLimit: (limit: number) => void;
8
+ setOffset: (offset: number) => void;
9
+ tRowsPerPage?: string;
10
+ tPrevious?: string;
11
+ tPage?: string;
12
+ tNext?: string;
13
+ tOf?: string;
14
+ }
15
+ export declare const TablePagination: FC<IProps>;
16
+ export {};
@@ -0,0 +1,74 @@
1
+ import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
+ import { Button as i } from "../Button/Button.mjs";
3
+ import "../Button/buttonVariants.mjs";
4
+ import "../Select/SelectRoot.mjs";
5
+ import { Select as P } from "../Select/Select.mjs";
6
+ const y = ({
7
+ offset: l,
8
+ limit: a,
9
+ totalRows: s,
10
+ setLimit: p,
11
+ setOffset: t,
12
+ tRowsPerPage: d = "Rows per page",
13
+ tPrevious: u = "Previous",
14
+ tPage: x = "Page",
15
+ tNext: v = "Next",
16
+ tOf: h = "Of"
17
+ }) => {
18
+ const r = Math.ceil(l / a) + 1, o = Math.ceil(s / a), m = r === o, b = (e) => {
19
+ t(0), p(parseInt(e));
20
+ }, g = () => {
21
+ let e = l - a;
22
+ e < 0 && (e = 0), t(e);
23
+ }, N = () => {
24
+ let e = l + a;
25
+ e > s && (e = s - a), t(e);
26
+ };
27
+ return /* @__PURE__ */ c("div", { className: "flex items-center justify-end space-x-2 py-4", children: [
28
+ /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
29
+ /* @__PURE__ */ n("span", { className: "text-sm text-nowrap", children: d }),
30
+ /* @__PURE__ */ n(
31
+ P,
32
+ {
33
+ value: a == null ? void 0 : a.toString(),
34
+ options: [
35
+ { value: "5", label: "5" },
36
+ { value: "10", label: "10" },
37
+ { value: "20", label: "20" },
38
+ { value: "30", label: "30" },
39
+ { value: "50", label: "50" }
40
+ ],
41
+ onChange: b,
42
+ placeholder: "6",
43
+ nullable: !1
44
+ }
45
+ )
46
+ ] }),
47
+ /* @__PURE__ */ c("div", { className: "space-x-2", children: [
48
+ /* @__PURE__ */ n(
49
+ i,
50
+ {
51
+ variant: "outline",
52
+ size: "sm",
53
+ disabled: !l,
54
+ onClick: g,
55
+ children: u
56
+ }
57
+ ),
58
+ /* @__PURE__ */ n("span", { className: "text-sm", children: `${x} ${r} ${h} ${o}` }),
59
+ /* @__PURE__ */ n(
60
+ i,
61
+ {
62
+ variant: "outline",
63
+ size: "sm",
64
+ disabled: m,
65
+ onClick: N,
66
+ children: v
67
+ }
68
+ )
69
+ ] })
70
+ ] });
71
+ };
72
+ export {
73
+ y as TablePagination
74
+ };
@@ -0,0 +1 @@
1
+ export * from './TablePagination';
@@ -0,0 +1,4 @@
1
+ import { TablePagination as e } from "./TablePagination.mjs";
2
+ export {
3
+ e as TablePagination
4
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "sideEffects": false,
3
+ "main": "./index.mjs",
4
+ "module": "./index.mjs",
5
+ "default": "./index.mjs",
6
+ "types": "./index.d.ts"
7
+ }
package/Tabs/Tabs.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { TabsProps } from './Tabs.types';
2
- import { FC } from 'react';
2
+ import { FC, PropsWithChildren } from 'react';
3
3
 
4
- export declare const Tabs: FC<TabsProps>;
4
+ export declare const TabRender: FC<TabsProps>;
5
+ export declare const Tabs: FC<PropsWithChildren<TabsProps>>;
package/Tabs/Tabs.mjs CHANGED
@@ -1,9 +1,23 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { TabsRoot as n, TabsList as t, TabsTrigger as c } from "./TabsRoot.mjs";
3
- const p = (r) => {
4
- const { tab: s, tabs: l, onChange: o } = r;
5
- return /* @__PURE__ */ e(n, { value: s, onValueChange: o, children: /* @__PURE__ */ e(t, { className: "px-2 py-6 bg-[#E0E7FF] rounded-[6px]", children: l.map((a) => /* @__PURE__ */ e(c, { value: a.value, className: "h-8", children: a.label }, a.value)) }) });
1
+ import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
+ import { Children as p } from "react";
3
+ import { TabsContent as m, TabsRoot as b, TabsList as i, TabsTrigger as h } from "./TabsRoot.mjs";
4
+ const T = (a) => {
5
+ const { tabs: s = [], contents: t } = a;
6
+ return p.map(t, (n, r) => {
7
+ var l;
8
+ if (!n || !s[r]) return null;
9
+ const e = (l = s[r]) == null ? void 0 : l.value, u = n.props || {};
10
+ return /* @__PURE__ */ o(m, { value: e, ...u, children: n }, e);
11
+ });
12
+ }, f = (a) => {
13
+ const { tab: s, tabs: t = [], onChange: n, children: r } = a;
14
+ return /* @__PURE__ */ c(b, { value: s, onValueChange: n, children: [
15
+ /* @__PURE__ */ o(i, { className: "px-2 py-6 bg-[#E0E7FF] rounded-[6px]", children: t.map((e) => /* @__PURE__ */ o(h, { value: e.value, className: "h-8", children: e.label }, e.value)) }),
16
+ r,
17
+ !r && /* @__PURE__ */ o(T, { ...a })
18
+ ] });
6
19
  };
7
20
  export {
8
- p as Tabs
21
+ T as TabRender,
22
+ f as Tabs
9
23
  };
@@ -1,9 +1,12 @@
1
+ import { ReactElement } from 'react';
2
+
1
3
  export interface TabItemProps {
2
4
  value: string;
3
5
  label: string;
4
6
  }
5
7
  export interface TabsProps {
6
8
  tabs: TabItemProps[];
7
- tab: string;
8
- onChange: (value: string) => void;
9
+ tab?: string;
10
+ onChange?: (value: string) => void;
11
+ contents?: ReactElement[];
9
12
  }
package/Tabs/index.mjs CHANGED
@@ -1,9 +1,10 @@
1
- import { TabsContent as s, TabsList as t, TabsRoot as T, TabsTrigger as a } from "./TabsRoot.mjs";
2
- import { Tabs as e } from "./Tabs.mjs";
1
+ import { TabsContent as T, TabsList as a, TabsRoot as b, TabsTrigger as e } from "./TabsRoot.mjs";
2
+ import { TabRender as t, Tabs as n } from "./Tabs.mjs";
3
3
  export {
4
- e as Tabs,
5
- s as TabsContent,
6
- t as TabsList,
7
- T as TabsRoot,
8
- a as TabsTrigger
4
+ t as TabRender,
5
+ n as Tabs,
6
+ T as TabsContent,
7
+ a as TabsList,
8
+ b as TabsRoot,
9
+ e as TabsTrigger
9
10
  };
@@ -1,4 +1,4 @@
1
1
  import { TextareaProps } from './Textarea.types';
2
- import * as React from "react";
2
+ import * as React from 'react';
3
3
  declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
4
4
  export { Textarea };
@@ -1,18 +1,75 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import * as a from "react";
3
- import { cn as s } from "@oneplatformdev/utils";
4
- const i = a.forwardRef(({ className: e, ...r }, o) => /* @__PURE__ */ t(
5
- "textarea",
6
- {
7
- className: s(
8
- "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
9
- e
10
- ),
11
- ref: o,
12
- ...r
1
+ import { jsxs as u, Fragment as h, jsx as p } from "react/jsx-runtime";
2
+ import * as v from "react";
3
+ import { useId as w, useRef as z, useState as A, useImperativeHandle as F, useEffect as N } from "react";
4
+ import { cn as d } from "@oneplatformdev/utils";
5
+ import { useAutosizeTextArea as y } from "./useAutosizeTextArea.mjs";
6
+ const S = v.forwardRef(
7
+ (m, c) => {
8
+ const {
9
+ className: f,
10
+ value: r = "",
11
+ maxHeight: o = Number.MAX_SAFE_INTEGER,
12
+ minHeight: i = 0,
13
+ resizeble: x = !0,
14
+ counter: n = !1,
15
+ id: s = "",
16
+ ...e
17
+ } = m, a = w(), t = z(null), [g, b] = A("");
18
+ return y({
19
+ textAreaRef: t,
20
+ triggerAutoSize: g,
21
+ maxHeight: o,
22
+ minHeight: i
23
+ }), F(c, () => ({
24
+ ...t.current ?? {},
25
+ textArea: t.current,
26
+ focus: () => {
27
+ var l;
28
+ return (l = t == null ? void 0 : t.current) == null ? void 0 : l.focus();
29
+ },
30
+ maxHeight: o,
31
+ minHeight: i
32
+ })), N(() => {
33
+ b(r);
34
+ }, [e == null ? void 0 : e.defaultValue, r]), /* @__PURE__ */ u(h, { children: [
35
+ /* @__PURE__ */ p(
36
+ "textarea",
37
+ {
38
+ id: s || a,
39
+ ...e,
40
+ ref: t,
41
+ value: r,
42
+ className: d(
43
+ "flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm",
44
+ "rounded-[12px] border border-input bg-[#FCFCFC] shadow-none",
45
+ "placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
46
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
47
+ x ? "resize" : "resize-none !overflow-hidden",
48
+ n && "pb-2",
49
+ f
50
+ )
51
+ }
52
+ ),
53
+ n && /* @__PURE__ */ u(
54
+ "label",
55
+ {
56
+ htmlFor: s || a,
57
+ className: d(
58
+ "w-full text-right inline-flex items-center justify-end",
59
+ "text-sm font-normal text-muted-foreground",
60
+ "leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
61
+ ),
62
+ children: [
63
+ String(r || "").length,
64
+ " / ",
65
+ e == null ? void 0 : e.maxLength
66
+ ]
67
+ }
68
+ )
69
+ ] });
13
70
  }
14
- ));
15
- i.displayName = "Textarea";
71
+ );
72
+ S.displayName = "Textarea";
16
73
  export {
17
- i as Textarea
74
+ S as Textarea
18
75
  };
@@ -1,4 +1,18 @@
1
- import { ComponentProps } from 'react';
1
+ import { ComponentProps, RefObject } from 'react';
2
2
 
3
- export interface TextareaProps extends ComponentProps<'textarea'> {
3
+ export interface IUseAutosizeTextAreaProps {
4
+ textAreaRef: RefObject<HTMLTextAreaElement | null>;
5
+ triggerAutoSize: string;
6
+ /**
7
+ * The minimum height of the textarea.
8
+ */
9
+ minHeight?: number;
10
+ /**
11
+ * The maximum height of the textarea.
12
+ */
13
+ maxHeight?: number;
14
+ }
15
+ export interface TextareaProps extends ComponentProps<'textarea'>, Pick<IUseAutosizeTextAreaProps, 'minHeight' | 'maxHeight'> {
16
+ resizeble?: boolean;
17
+ counter?: boolean;
4
18
  }
@@ -0,0 +1,3 @@
1
+ import { IUseAutosizeTextAreaProps } from '..';
2
+
3
+ export declare const useAutosizeTextArea: ({ textAreaRef, triggerAutoSize, maxHeight, minHeight, }: IUseAutosizeTextAreaProps) => void;
@@ -0,0 +1,20 @@
1
+ import * as f from "react";
2
+ const u = ({
3
+ textAreaRef: r,
4
+ triggerAutoSize: l,
5
+ maxHeight: t = Number.MAX_SAFE_INTEGER,
6
+ minHeight: s = 0
7
+ }) => {
8
+ const [c, i] = f.useState(!0);
9
+ f.useEffect(() => {
10
+ const e = r.current;
11
+ if (e) {
12
+ c && (e.style.minHeight = `${s + 0}px`, t > s && (e.style.maxHeight = `${t}px`), i(!1)), e.style.height = `${s + 0}px`;
13
+ const o = e.scrollHeight;
14
+ o > t ? e.style.height = `${t}px` : e.style.height = `${o + 0}px`;
15
+ }
16
+ }, [r.current, l]);
17
+ };
18
+ export {
19
+ u as useAutosizeTextArea
20
+ };
@@ -6,9 +6,9 @@ const a = t(
6
6
  variant: {
7
7
  default: "border bg-background text-foreground",
8
8
  destructive: "destructive group border-destructive bg-destructive text-destructive-foreground",
9
- success: "",
10
- info: "",
11
- update: ""
9
+ success: "border bg-primary text-white",
10
+ info: "border bg-blue-400 text-white",
11
+ update: "border bg-orange-400 text-white"
12
12
  }
13
13
  },
14
14
  defaultVariants: {