@oneplatformdev/ui 0.0.1-beta.2 → 0.0.1-beta.22

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 (39) hide show
  1. package/AlertDialog/AlertDialog.d.ts +14 -0
  2. package/AlertDialog/AlertDialog.mjs +58 -60
  3. package/Combobox/Combobox.mjs +71 -60
  4. package/Combobox/Combobox.types.d.ts +7 -0
  5. package/Dropzone/Dropzone.d.ts +22 -0
  6. package/Dropzone/Dropzone.mjs +136 -0
  7. package/Dropzone/Dropzone.types.d.ts +36 -0
  8. package/Dropzone/DropzoneFilePreview.d.ts +4 -0
  9. package/Dropzone/DropzoneFilePreview.mjs +9 -0
  10. package/Dropzone/DropzoneUtils.d.ts +4 -0
  11. package/Dropzone/DropzoneUtils.mjs +15 -0
  12. package/Dropzone/index.d.ts +2 -0
  13. package/Dropzone/index.mjs +7 -0
  14. package/Dropzone/package.json +7 -0
  15. package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
  16. package/FormDropzone/FormDropzone.d.ts +4 -0
  17. package/FormDropzone/FormDropzone.mjs +26 -0
  18. package/FormDropzone/FormDropzone.types.d.ts +7 -0
  19. package/FormDropzone/index.d.ts +2 -0
  20. package/FormDropzone/index.mjs +4 -0
  21. package/FormDropzone/package.json +7 -0
  22. package/FormSelect/FormSelect.types.d.ts +2 -1
  23. package/Input/Input.d.ts +5 -3
  24. package/Input/Input.mjs +58 -18
  25. package/Input/Input.types.d.ts +11 -2
  26. package/Input/index.d.ts +1 -0
  27. package/Input/index.mjs +5 -2
  28. package/Input/inputVariants.d.ts +3 -0
  29. package/Input/inputVariants.mjs +18 -0
  30. package/LazyLoader/LazyLoader.d.ts +17 -0
  31. package/LazyLoader/index.d.ts +1 -1
  32. package/LazyLoader/index.mjs +3 -2
  33. package/Search/index.d.ts +1 -0
  34. package/Search/index.mjs +3 -2
  35. package/Sidebar/Sidebar.d.ts +1 -1
  36. package/index.css +1 -1
  37. package/index.d.ts +2 -0
  38. package/index.mjs +302 -293
  39. package/package.json +7 -6
@@ -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,7 +1,8 @@
1
+ import { PatrialOne } 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>, PatrialOne<SelectProps<ExtendOptionData>, 'onChange'> {
7
8
  }
package/Input/Input.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { InputProps } from './Input.types';
2
- import * as React from "react";
3
- declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
4
- export { Input };
2
+ import { default as React } from 'react';
3
+
4
+ export declare const BaseInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
5
+ export declare const PasswordInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
6
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
package/Input/Input.mjs CHANGED
@@ -1,21 +1,61 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import * as n from "react";
3
- import { cn as s } from "@oneplatformdev/utils";
4
- const l = n.forwardRef(
5
- ({ className: e, type: r, ...o }, t) => /* @__PURE__ */ i(
6
- "input",
7
- {
8
- type: r,
9
- className: s(
10
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground 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",
11
- e
12
- ),
13
- ref: t,
14
- ...o
15
- }
16
- )
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) => {
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 }),
17
+ /* @__PURE__ */ s(
18
+ "input",
19
+ {
20
+ type: o,
21
+ className: b(
22
+ N({ variant: r, className: a }),
23
+ !!i && "pl-8"
24
+ ),
25
+ ref: e,
26
+ ...u
27
+ }
28
+ )
29
+ ] });
30
+ }
17
31
  );
18
- l.displayName = "Input";
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
+ };
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 })
41
+ ] });
42
+ }
43
+ );
44
+ m.displayName = "PasswordInput";
45
+ const w = ({ isVisible: t, onClick: e }) => /* @__PURE__ */ s(
46
+ "button",
47
+ {
48
+ type: "button",
49
+ onClick: e,
50
+ 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 })
52
+ }
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 })
55
+ );
56
+ I.displayName = "Input";
19
57
  export {
20
- l as Input
58
+ p as BaseInput,
59
+ I as Input,
60
+ m as PasswordInput
21
61
  };
@@ -1,4 +1,13 @@
1
- import { ComponentProps } from 'react';
1
+ import { inputVariants } from './inputVariants';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import { default as React, ReactNode } from 'react';
2
4
 
3
- export interface InputProps extends ComponentProps<'input'> {
5
+ export interface InputSlotInputProps {
6
+ startAdornment?: ReactNode;
7
+ }
8
+ export interface InputSlotProps {
9
+ input?: InputSlotInputProps;
10
+ }
11
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {
12
+ slotProps?: InputSlotProps;
4
13
  }
package/Input/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './Input';
2
+ export { Input as default } from './Input';
2
3
  export type * from './Input.types';
package/Input/index.mjs CHANGED
@@ -1,4 +1,7 @@
1
- import { Input as r } from "./Input.mjs";
1
+ import { BaseInput as u, Input as a, PasswordInput as n, Input as s } from "./Input.mjs";
2
2
  export {
3
- r as Input
3
+ u as BaseInput,
4
+ a as Input,
5
+ n as PasswordInput,
6
+ s as default
4
7
  };
@@ -0,0 +1,3 @@
1
+ export declare const inputVariants: (props?: ({
2
+ variant?: "default" | "grey" | null | undefined;
3
+ } & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
@@ -0,0 +1,18 @@
1
+ import { cva as e } from "class-variance-authority";
2
+ const r = e(
3
+ "flex h-10 w-full rounded-md border border-input px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
4
+ {
5
+ variants: {
6
+ variant: {
7
+ default: "bg-background",
8
+ grey: "bg-slate-200"
9
+ }
10
+ },
11
+ defaultVariants: {
12
+ variant: "default"
13
+ }
14
+ }
15
+ );
16
+ export {
17
+ r as inputVariants
18
+ };
@@ -1,3 +1,20 @@
1
1
  import { default as React, JSX } from 'react';
2
2
 
3
+ /**
4
+ * Component lazy load component.
5
+ * @public
6
+ * @see [Documentation](#)
7
+ * @example
8
+ * ```tsx
9
+ * import { lazy } from 'react';
10
+ * import { LazyLoader } from '@oneplatformdev/ui/LazyLoader';
11
+ *
12
+ * const ModuleComponentViewLazy = LazyLoader(
13
+ * lazy(() => import('path/to/module').then(module => ({
14
+ * default: module.ModuleComponentView,
15
+ * })),
16
+ * ),
17
+ * );
18
+ * ```
19
+ */
3
20
  export declare const LazyLoader: (Component: React.LazyExoticComponent<any>, showLoader?: boolean) => (props: any) => JSX.Element;
@@ -1 +1 @@
1
- export { LazyLoader } from './LazyLoader';
1
+ export { LazyLoader as default, LazyLoader } from './LazyLoader';
@@ -1,4 +1,5 @@
1
- import { LazyLoader as a } from "./LazyLoader.mjs";
1
+ import { LazyLoader as o, LazyLoader as r } from "./LazyLoader.mjs";
2
2
  export {
3
- a as LazyLoader
3
+ o as LazyLoader,
4
+ r as default
4
5
  };
package/Search/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './Search';
2
+ export { Search as default } from './Search';
2
3
  export type * from './Search.types';
package/Search/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { Search as o } from "./Search.mjs";
1
+ import { Search as r, Search as c } from "./Search.mjs";
2
2
  export {
3
- o as Search
3
+ r as Search,
4
+ c as default
4
5
  };
@@ -25,7 +25,7 @@ declare const Sidebar: React.ForwardRefExoticComponent<Omit<React.ClassAttribute
25
25
  declare const SidebarTrigger: React.ForwardRefExoticComponent<Omit<import('../Button').ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
26
26
  declare const SidebarRail: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
27
27
  declare const SidebarInset: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
28
- declare const SidebarInput: React.ForwardRefExoticComponent<Omit<Omit<import('../Input').InputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
28
+ declare const SidebarInput: React.ForwardRefExoticComponent<Omit<import('../Input').InputProps & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
29
29
  declare const SidebarHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
30
  declare const SidebarFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
31
  declare const SidebarSeparator: React.ForwardRefExoticComponent<Omit<Omit<import('@radix-ui/react-separator').SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;