@oneplatformdev/ui 0.0.1-beta.3 → 0.0.1-beta.30

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.
@@ -0,0 +1,7 @@
1
+ import { Dropzone as r } from "./Dropzone.mjs";
2
+ import { D as T, a as _ } from "../DropzoneFilePreview-Dhtv8F4u.js";
3
+ export {
4
+ T as DEFAULT_FILE_TYPES,
5
+ _ as DEFAULT_IMAGES_TYPES,
6
+ r as Dropzone
7
+ };
@@ -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
+ }
@@ -0,0 +1,67 @@
1
+ import { jsx as l, jsxs as d } from "react/jsx-runtime";
2
+ import { useState as m, useEffect as f } from "react";
3
+ import { File as s } from "lucide-react";
4
+ import { isFile as o } from "./Dropzone/DropzoneUtils.mjs";
5
+ import { cn as c } from "@oneplatformdev/utils";
6
+ const h = [
7
+ "application/msword",
8
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
9
+ "text/csv",
10
+ "text/plain",
11
+ "application/pdf"
12
+ ], u = [
13
+ "image/png",
14
+ "image/jpeg",
15
+ "image/jpg",
16
+ "image/webp",
17
+ "image/gif"
18
+ ], j = ({ item: e, styles: r }) => {
19
+ const [t, a] = m(null), p = o(e) && u.includes(e.type);
20
+ return f(() => {
21
+ let n = null;
22
+ if (o(e) && p) {
23
+ const i = new FileReader();
24
+ return i.onloadend = () => a(i.result), i.readAsDataURL(e), () => a(null);
25
+ } else {
26
+ if (typeof e == "string")
27
+ return n = new Image(), n.src = e, n.onload = () => a(e), n.onerror = () => a(null), () => {
28
+ n.onload = null, n.onerror = null;
29
+ };
30
+ a(null);
31
+ }
32
+ return () => a(null);
33
+ }, [e, p]), /* @__PURE__ */ l(
34
+ "div",
35
+ {
36
+ className: c(
37
+ "w-32 h-32 border border-gray-300 rounded-md overflow-hidden flex items-center justify-center",
38
+ r == null ? void 0 : r.previewWraper
39
+ ),
40
+ children: t ? /* @__PURE__ */ l(
41
+ "img",
42
+ {
43
+ src: t,
44
+ alt: o(e) ? e.name : "external-image",
45
+ className: c("w-full h-full object-cover", r == null ? void 0 : r.previewImage)
46
+ }
47
+ ) : /* @__PURE__ */ d(
48
+ "div",
49
+ {
50
+ className: c(
51
+ "flex flex-col items-center justify-center text-gray-500 text-sm p-2 text-center",
52
+ r == null ? void 0 : r.previewFile
53
+ ),
54
+ children: [
55
+ /* @__PURE__ */ l(s, { className: "w-6 h-6" }),
56
+ o(e) ? /* @__PURE__ */ l("span", { className: "text-xs break-all", children: e.name }) : /* @__PURE__ */ l("span", { className: "text-xs break-all", children: e })
57
+ ]
58
+ }
59
+ )
60
+ }
61
+ );
62
+ };
63
+ export {
64
+ h as D,
65
+ j as F,
66
+ u as a
67
+ };
@@ -0,0 +1,4 @@
1
+ import { FormDropzoneProps } from './FormDropzone.types';
2
+ import { FieldValues, UseFormReturn } from 'react-hook-form';
3
+
4
+ export declare const FormDropzone: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormDropzoneProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { FormControl as a } from "../Form/Form.mjs";
3
+ import { FormRenderControl as l } from "../Form/FormRenderControl.mjs";
4
+ import { Dropzone as f } from "../Dropzone/Dropzone.mjs";
5
+ const h = (n) => {
6
+ const { form: e, label: m, name: t, ...p } = n;
7
+ return /* @__PURE__ */ o(
8
+ l,
9
+ {
10
+ form: e,
11
+ label: m,
12
+ name: t,
13
+ render: ({ field: r }) => /* @__PURE__ */ o(a, { children: /* @__PURE__ */ o(
14
+ f,
15
+ {
16
+ ...p,
17
+ ...r,
18
+ onChangeValue: r.onChange
19
+ }
20
+ ) })
21
+ }
22
+ );
23
+ };
24
+ export {
25
+ h as FormDropzone
26
+ };
@@ -0,0 +1,7 @@
1
+ import { FormRenderControlExtendProps } from '../Form';
2
+ import { DropzoneProps } from '../Dropzone';
3
+ import { UseFormReturn } from 'react-hook-form';
4
+ import { FieldValues } from 'react-hook-form/dist/types/fields';
5
+
6
+ export interface FormDropzoneProps<Data extends FieldValues, Form extends UseFormReturn<Data>> extends FormRenderControlExtendProps<Data, Form>, DropzoneProps {
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './FormDropzone';
2
+ export * from './FormDropzone.types';
@@ -0,0 +1,4 @@
1
+ import { FormDropzone as e } from "./FormDropzone.mjs";
2
+ export {
3
+ e as FormDropzone
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
+ }
@@ -1,18 +1,17 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { FormControl as l } from "../Form/Form.mjs";
3
- import { FormRenderControl as i } from "../Form/FormRenderControl.mjs";
4
- import "../Input/index.mjs";
5
- import { Input as u } from "../Input/Input.mjs";
6
- const d = (m) => {
3
+ import { FormRenderControl as u } from "../Form/FormRenderControl.mjs";
4
+ import { Input as a } from "../Input/Input.mjs";
5
+ const F = (m) => {
7
6
  const { form: t, label: e, name: n, ...p } = m;
8
7
  return /* @__PURE__ */ r(
9
- i,
8
+ u,
10
9
  {
11
10
  form: t,
12
11
  name: n,
13
12
  label: e,
14
13
  render: ({ field: o }) => /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(
15
- u,
14
+ a,
16
15
  {
17
16
  ...o,
18
17
  value: o.value || "",
@@ -23,5 +22,5 @@ const d = (m) => {
23
22
  );
24
23
  };
25
24
  export {
26
- d as FormInput
25
+ F as FormInput
27
26
  };
@@ -1,7 +1,8 @@
1
+ import { PartialOne } from '../../../utils/src';
1
2
  import { SelectProps } from '../Select';
2
3
  import { FormRenderControlExtendProps } from '../Form';
3
4
  import { UseFormReturn } from 'react-hook-form';
4
5
  import { FieldValues } from 'react-hook-form/dist/types/fields';
5
6
 
6
- export interface FormSelectProps<Data extends FieldValues, Form extends UseFormReturn<Data>, ExtendOptionData> extends FormRenderControlExtendProps<Data, Form>, SelectProps<ExtendOptionData> {
7
+ export interface FormSelectProps<Data extends FieldValues, Form extends UseFormReturn<Data>, ExtendOptionData> extends FormRenderControlExtendProps<Data, Form>, PartialOne<SelectProps<ExtendOptionData>, 'onChange'> {
7
8
  }
package/Input/Input.mjs CHANGED
@@ -1,61 +1,66 @@
1
- import { jsxs as c, jsx as s } from "react/jsx-runtime";
2
- import l, { useState as d } from "react";
3
- import { Eye as f, EyeOff as y } from "lucide-react";
4
- import { inputVariants as N } from "./inputVariants.mjs";
5
- import { cn as b } from "@oneplatformdev/utils";
6
- const p = l.forwardRef(
7
- (t, e) => {
1
+ import { jsxs as f, jsx as s } from "react/jsx-runtime";
2
+ import u, { useState as N } from "react";
3
+ import { Eye as g, EyeOff as b } from "lucide-react";
4
+ import { inputVariants as v } from "./inputVariants.mjs";
5
+ import { cn as h } from "@oneplatformdev/utils";
6
+ const c = u.forwardRef(
7
+ (t, a) => {
8
8
  const {
9
- className: a,
10
- variant: r,
11
- type: o,
12
- slotProps: { input: n } = {},
13
- ...u
14
- } = t, { startAdornment: i } = n || {};
15
- return /* @__PURE__ */ c("div", { className: "relative", children: [
16
- !!i && /* @__PURE__ */ s("span", { className: "absolute left-[10px] top-1/2 -translate-y-1/2", children: i }),
9
+ className: e,
10
+ variant: o,
11
+ type: i,
12
+ slotProps: { input: l } = {},
13
+ onChange: m,
14
+ onTransform: n,
15
+ ...y
16
+ } = t, { startAdornment: p } = l || {};
17
+ return /* @__PURE__ */ f("div", { className: "relative", children: [
18
+ !!p && /* @__PURE__ */ s("span", { className: "absolute left-[10px] top-1/2 -translate-y-1/2", children: p }),
17
19
  /* @__PURE__ */ s(
18
20
  "input",
19
21
  {
20
- type: o,
21
- className: b(
22
- N({ variant: r, className: a }),
23
- !!i && "pl-8"
22
+ type: i,
23
+ className: h(
24
+ v({ variant: o, className: e }),
25
+ !!p && "pl-8"
24
26
  ),
25
- ref: e,
26
- ...u
27
+ ref: a,
28
+ ...y,
29
+ onChange: (r) => {
30
+ typeof (n == null ? void 0 : n(r.target.value, r)) == "string" && (r.target.value = n(r.target.value, r)), m && m(r);
31
+ }
27
32
  }
28
33
  )
29
34
  ] });
30
35
  }
31
36
  );
32
- p.displayName = "Input";
33
- const m = l.forwardRef(
34
- (t, e) => {
35
- const [a, r] = d(!1), o = a ? "text" : "password", n = () => {
36
- r(!a);
37
+ c.displayName = "Input";
38
+ const d = u.forwardRef(
39
+ (t, a) => {
40
+ const [e, o] = N(!1), i = e ? "text" : "password", l = () => {
41
+ o(!e);
37
42
  };
38
- return /* @__PURE__ */ c("div", { className: "relative", children: [
39
- /* @__PURE__ */ s(p, { ...t, type: o, className: "pr-8", ref: e }),
40
- /* @__PURE__ */ s(w, { isVisible: a, onClick: n })
43
+ return /* @__PURE__ */ f("div", { className: "relative", children: [
44
+ /* @__PURE__ */ s(c, { ...t, type: i, className: "pr-8", ref: a }),
45
+ /* @__PURE__ */ s(w, { isVisible: e, onClick: l })
41
46
  ] });
42
47
  }
43
48
  );
44
- m.displayName = "PasswordInput";
45
- const w = ({ isVisible: t, onClick: e }) => /* @__PURE__ */ s(
49
+ d.displayName = "PasswordInput";
50
+ const w = ({ isVisible: t, onClick: a }) => /* @__PURE__ */ s(
46
51
  "button",
47
52
  {
48
53
  type: "button",
49
- onClick: e,
54
+ onClick: a,
50
55
  className: "absolute top-1/2 right-3 transform -translate-y-1/2",
51
- children: t ? /* @__PURE__ */ s(f, { size: 16 }) : /* @__PURE__ */ s(y, { size: 16 })
56
+ children: t ? /* @__PURE__ */ s(g, { size: 16 }) : /* @__PURE__ */ s(b, { size: 16 })
52
57
  }
53
- ), I = l.forwardRef(
54
- ({ type: t, ...e }, a) => t === "password" ? /* @__PURE__ */ s(m, { type: t, ...e, ref: a }) : /* @__PURE__ */ s(p, { type: t, ...e, ref: a })
58
+ ), I = u.forwardRef(
59
+ ({ type: t, ...a }, e) => t === "password" ? /* @__PURE__ */ s(d, { type: t, ...a, ref: e }) : /* @__PURE__ */ s(c, { type: t, ...a, ref: e })
55
60
  );
56
61
  I.displayName = "Input";
57
62
  export {
58
- p as BaseInput,
63
+ c as BaseInput,
59
64
  I as Input,
60
- m as PasswordInput
65
+ d as PasswordInput
61
66
  };
@@ -1,6 +1,6 @@
1
1
  import { inputVariants } from './inputVariants';
2
2
  import { VariantProps } from 'class-variance-authority';
3
- import { default as React, ReactNode } from 'react';
3
+ import { default as React, ChangeEvent, ReactNode } from 'react';
4
4
 
5
5
  export interface InputSlotInputProps {
6
6
  startAdornment?: ReactNode;
@@ -10,4 +10,6 @@ export interface InputSlotProps {
10
10
  }
11
11
  export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {
12
12
  slotProps?: InputSlotProps;
13
+ /** func transform event.target.value before onChange event call*/
14
+ onTransform?: (value: string, event: ChangeEvent<HTMLInputElement>) => string;
13
15
  }
package/Input/index.mjs CHANGED
@@ -1,10 +1,7 @@
1
- import { BaseInput as a, Input as n, PasswordInput as r, Input as u } from "./Input.mjs";
2
- import { inputVariants as s } from "./inputVariants.mjs";
3
- e;
1
+ import { BaseInput as u, Input as a, PasswordInput as n, Input as s } from "./Input.mjs";
4
2
  export {
5
- a as BaseInput,
6
- n as Input,
7
- r as PasswordInput,
8
- u as default,
9
- s as inputVariants
3
+ u as BaseInput,
4
+ a as Input,
5
+ n as PasswordInput,
6
+ s as default
10
7
  };
package/Search/Search.mjs CHANGED
@@ -1,10 +1,9 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useState as S } from "react";
3
- import "../Input/index.mjs";
4
- import { useDebounceCallback as f } from "@oneplatformdev/hooks";
5
- import { cn as v } from "@oneplatformdev/utils";
6
- import { Input as d } from "../Input/Input.mjs";
7
- const k = (t) => {
3
+ import { Input as f } from "../Input/Input.mjs";
4
+ import { useDebounceCallback as v } from "@oneplatformdev/hooks";
5
+ import { cn as d } from "@oneplatformdev/utils";
6
+ const j = (t) => {
8
7
  const {
9
8
  search: a,
10
9
  onChange: e,
@@ -12,20 +11,20 @@ const k = (t) => {
12
11
  placeholder: s = "Search",
13
12
  className: n,
14
13
  ...m
15
- } = t, [i, l] = S(a), p = f(c, 1e3), h = (r) => {
14
+ } = t, [i, l] = S(a), h = v(c, 1e3), p = (r) => {
16
15
  const u = r.target.value;
17
- l(u), e == null || e(r), p(r.target.value);
16
+ l(u), e == null || e(r), h(r.target.value);
18
17
  };
19
- return /* @__PURE__ */ o("div", { className: v("space-y-4", n), children: /* @__PURE__ */ o(
20
- d,
18
+ return /* @__PURE__ */ o("div", { className: d("space-y-4", n), children: /* @__PURE__ */ o(
19
+ f,
21
20
  {
22
21
  placeholder: s,
23
22
  value: i,
24
- onChange: h,
23
+ onChange: p,
25
24
  ...m
26
25
  }
27
26
  ) });
28
27
  };
29
28
  export {
30
- k as Search
29
+ j as Search
31
30
  };
@@ -6,13 +6,12 @@ import { PanelLeft as k } from "lucide-react";
6
6
  import { cn as d } from "@oneplatformdev/utils";
7
7
  import { Button as E } from "../Button/Button.mjs";
8
8
  import "../Button/buttonVariants.mjs";
9
- import "../Input/index.mjs";
10
- import { Separator as z } from "../Separator/Separator.mjs";
11
- import { Sheet as B, SheetContent as T } from "../Sheet/Sheet.mjs";
9
+ import { Input as z } from "../Input/Input.mjs";
10
+ import { Separator as B } from "../Separator/Separator.mjs";
11
+ import { Sheet as T, SheetContent as A } from "../Sheet/Sheet.mjs";
12
12
  import { Skeleton as M } from "../Skeleton/Skeleton.mjs";
13
- import { TooltipProvider as A, TooltipTrigger as D, TooltipContent as O } from "../Tooltip/TooltipRoot.mjs";
14
- import { Tooltip as L } from "../Tooltip/Tooltip.mjs";
15
- import { Input as G } from "../Input/Input.mjs";
13
+ import { TooltipProvider as D, TooltipTrigger as O, TooltipContent as L } from "../Tooltip/TooltipRoot.mjs";
14
+ import { Tooltip as G } from "../Tooltip/Tooltip.mjs";
16
15
  const K = 768;
17
16
  function H(a = {}) {
18
17
  const {
@@ -67,7 +66,7 @@ const V = i.forwardRef(
67
66
  }),
68
67
  [y, g, x, c, p, u, w]
69
68
  );
70
- return /* @__PURE__ */ r(R.Provider, { value: I, children: /* @__PURE__ */ r(A, { delayDuration: 0, children: /* @__PURE__ */ r(
69
+ return /* @__PURE__ */ r(R.Provider, { value: I, children: /* @__PURE__ */ r(D, { delayDuration: 0, children: /* @__PURE__ */ r(
71
70
  "div",
72
71
  {
73
72
  style: {
@@ -108,8 +107,8 @@ const U = i.forwardRef(
108
107
  ...s,
109
108
  children: n
110
109
  }
111
- ) : m ? /* @__PURE__ */ r(B, { open: p, onOpenChange: u, ...s, children: /* @__PURE__ */ r(
112
- T,
110
+ ) : m ? /* @__PURE__ */ r(T, { open: p, onOpenChange: u, ...s, children: /* @__PURE__ */ r(
111
+ A,
113
112
  {
114
113
  "data-sidebar": "sidebar",
115
114
  "data-mobile": "true",
@@ -229,7 +228,7 @@ const J = i.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(
229
228
  ));
230
229
  J.displayName = "SidebarInset";
231
230
  const Q = i.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(
232
- G,
231
+ z,
233
232
  {
234
233
  ref: t,
235
234
  "data-sidebar": "input",
@@ -262,7 +261,7 @@ const ee = i.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(
262
261
  ));
263
262
  ee.displayName = "SidebarFooter";
264
263
  const ae = i.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(
265
- z,
264
+ B,
266
265
  {
267
266
  ref: t,
268
267
  "data-sidebar": "separator",
@@ -396,10 +395,10 @@ const le = C(
396
395
  );
397
396
  return n ? (typeof n == "string" && (n = {
398
397
  children: n
399
- }), /* @__PURE__ */ S(L, { children: [
400
- /* @__PURE__ */ r(D, { asChild: !0, children: v }),
398
+ }), /* @__PURE__ */ S(G, { children: [
399
+ /* @__PURE__ */ r(O, { asChild: !0, children: v }),
401
400
  /* @__PURE__ */ r(
402
- O,
401
+ L,
403
402
  {
404
403
  side: "right",
405
404
  align: "center",
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
  };