@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.
- package/AlertDialog/AlertDialog.d.ts +14 -0
- package/AlertDialog/AlertDialog.mjs +58 -60
- package/Combobox/Combobox.mjs +71 -60
- package/Combobox/Combobox.types.d.ts +7 -0
- package/Dropzone/Dropzone.d.ts +22 -0
- package/Dropzone/Dropzone.mjs +136 -0
- package/Dropzone/Dropzone.types.d.ts +36 -0
- package/Dropzone/DropzoneFilePreview.d.ts +4 -0
- package/Dropzone/DropzoneFilePreview.mjs +9 -0
- package/Dropzone/DropzoneUtils.d.ts +4 -0
- package/Dropzone/DropzoneUtils.mjs +15 -0
- package/Dropzone/index.d.ts +2 -0
- package/Dropzone/index.mjs +7 -0
- package/Dropzone/package.json +7 -0
- package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
- package/FormDropzone/FormDropzone.d.ts +4 -0
- package/FormDropzone/FormDropzone.mjs +26 -0
- package/FormDropzone/FormDropzone.types.d.ts +7 -0
- package/FormDropzone/index.d.ts +2 -0
- package/FormDropzone/index.mjs +4 -0
- package/FormDropzone/package.json +7 -0
- package/FormSelect/FormSelect.types.d.ts +2 -1
- package/Input/Input.d.ts +5 -3
- package/Input/Input.mjs +58 -18
- package/Input/Input.types.d.ts +11 -2
- package/Input/index.d.ts +1 -0
- package/Input/index.mjs +5 -2
- package/Input/inputVariants.d.ts +3 -0
- package/Input/inputVariants.mjs +18 -0
- package/LazyLoader/LazyLoader.d.ts +17 -0
- package/LazyLoader/index.d.ts +1 -1
- package/LazyLoader/index.mjs +3 -2
- package/Search/index.d.ts +1 -0
- package/Search/index.mjs +3 -2
- package/Sidebar/Sidebar.d.ts +1 -1
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.mjs +302 -293
- 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
|
+
}
|
@@ -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
|
3
|
-
|
4
|
-
export
|
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
|
2
|
-
import
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
className:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
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
|
-
|
58
|
+
p as BaseInput,
|
59
|
+
I as Input,
|
60
|
+
m as PasswordInput
|
21
61
|
};
|
package/Input/Input.types.d.ts
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
import {
|
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
|
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
package/Input/index.mjs
CHANGED
@@ -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;
|
package/LazyLoader/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { LazyLoader } from './LazyLoader';
|
1
|
+
export { LazyLoader as default, LazyLoader } from './LazyLoader';
|
package/LazyLoader/index.mjs
CHANGED
package/Search/index.d.ts
CHANGED
package/Search/index.mjs
CHANGED
package/Sidebar/Sidebar.d.ts
CHANGED
@@ -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<
|
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>>;
|