@oneplatformdev/ui 0.0.1-beta.2 → 0.0.1-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/FormInput/FormInput.mjs +7 -6
- 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 +8 -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/Search.mjs +11 -10
- package/Search/index.d.ts +1 -0
- package/Search/index.mjs +3 -2
- package/Sidebar/Sidebar.d.ts +1 -1
- package/Sidebar/Sidebar.mjs +14 -13
- package/index.css +1 -1
- package/index.mjs +344 -339
- package/package.json +1 -1
package/FormInput/FormInput.mjs
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
2
2
|
import { FormControl as l } from "../Form/Form.mjs";
|
3
|
-
import { FormRenderControl as
|
4
|
-
import
|
5
|
-
|
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) => {
|
6
7
|
const { form: t, label: e, name: n, ...p } = m;
|
7
8
|
return /* @__PURE__ */ r(
|
8
|
-
|
9
|
+
i,
|
9
10
|
{
|
10
11
|
form: t,
|
11
12
|
name: n,
|
12
13
|
label: e,
|
13
14
|
render: ({ field: o }) => /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(
|
14
|
-
|
15
|
+
u,
|
15
16
|
{
|
16
17
|
...o,
|
17
18
|
value: o.value || "",
|
@@ -22,5 +23,5 @@ const F = (m) => {
|
|
22
23
|
);
|
23
24
|
};
|
24
25
|
export {
|
25
|
-
|
26
|
+
d as FormInput
|
26
27
|
};
|
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
@@ -1,4 +1,10 @@
|
|
1
|
-
import { Input as r } from "./Input.mjs";
|
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;
|
2
4
|
export {
|
3
|
-
|
5
|
+
a as BaseInput,
|
6
|
+
n as Input,
|
7
|
+
r as PasswordInput,
|
8
|
+
u as default,
|
9
|
+
s as inputVariants
|
4
10
|
};
|
@@ -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/Search.mjs
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
2
2
|
import { useState as S } from "react";
|
3
|
-
import
|
4
|
-
import { useDebounceCallback as
|
5
|
-
import { cn as
|
6
|
-
|
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) => {
|
7
8
|
const {
|
8
9
|
search: a,
|
9
10
|
onChange: e,
|
@@ -11,20 +12,20 @@ const j = (t) => {
|
|
11
12
|
placeholder: s = "Search",
|
12
13
|
className: n,
|
13
14
|
...m
|
14
|
-
} = t, [i, l] = S(a),
|
15
|
+
} = t, [i, l] = S(a), p = f(c, 1e3), h = (r) => {
|
15
16
|
const u = r.target.value;
|
16
|
-
l(u), e == null || e(r),
|
17
|
+
l(u), e == null || e(r), p(r.target.value);
|
17
18
|
};
|
18
|
-
return /* @__PURE__ */ o("div", { className:
|
19
|
-
|
19
|
+
return /* @__PURE__ */ o("div", { className: v("space-y-4", n), children: /* @__PURE__ */ o(
|
20
|
+
d,
|
20
21
|
{
|
21
22
|
placeholder: s,
|
22
23
|
value: i,
|
23
|
-
onChange:
|
24
|
+
onChange: h,
|
24
25
|
...m
|
25
26
|
}
|
26
27
|
) });
|
27
28
|
};
|
28
29
|
export {
|
29
|
-
|
30
|
+
k as Search
|
30
31
|
};
|
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>>;
|
package/Sidebar/Sidebar.mjs
CHANGED
@@ -6,12 +6,13 @@ 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
|
10
|
-
import { Separator as
|
11
|
-
import { Sheet as
|
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";
|
12
12
|
import { Skeleton as M } from "../Skeleton/Skeleton.mjs";
|
13
|
-
import { TooltipProvider as
|
14
|
-
import { Tooltip as
|
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";
|
15
16
|
const K = 768;
|
16
17
|
function H(a = {}) {
|
17
18
|
const {
|
@@ -66,7 +67,7 @@ const V = i.forwardRef(
|
|
66
67
|
}),
|
67
68
|
[y, g, x, c, p, u, w]
|
68
69
|
);
|
69
|
-
return /* @__PURE__ */ r(R.Provider, { value: I, children: /* @__PURE__ */ r(
|
70
|
+
return /* @__PURE__ */ r(R.Provider, { value: I, children: /* @__PURE__ */ r(A, { delayDuration: 0, children: /* @__PURE__ */ r(
|
70
71
|
"div",
|
71
72
|
{
|
72
73
|
style: {
|
@@ -107,8 +108,8 @@ const U = i.forwardRef(
|
|
107
108
|
...s,
|
108
109
|
children: n
|
109
110
|
}
|
110
|
-
) : m ? /* @__PURE__ */ r(
|
111
|
-
|
111
|
+
) : m ? /* @__PURE__ */ r(B, { open: p, onOpenChange: u, ...s, children: /* @__PURE__ */ r(
|
112
|
+
T,
|
112
113
|
{
|
113
114
|
"data-sidebar": "sidebar",
|
114
115
|
"data-mobile": "true",
|
@@ -228,7 +229,7 @@ const J = i.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(
|
|
228
229
|
));
|
229
230
|
J.displayName = "SidebarInset";
|
230
231
|
const Q = i.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(
|
231
|
-
|
232
|
+
G,
|
232
233
|
{
|
233
234
|
ref: t,
|
234
235
|
"data-sidebar": "input",
|
@@ -261,7 +262,7 @@ const ee = i.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(
|
|
261
262
|
));
|
262
263
|
ee.displayName = "SidebarFooter";
|
263
264
|
const ae = i.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ r(
|
264
|
-
|
265
|
+
z,
|
265
266
|
{
|
266
267
|
ref: t,
|
267
268
|
"data-sidebar": "separator",
|
@@ -395,10 +396,10 @@ const le = C(
|
|
395
396
|
);
|
396
397
|
return n ? (typeof n == "string" && (n = {
|
397
398
|
children: n
|
398
|
-
}), /* @__PURE__ */ S(
|
399
|
-
/* @__PURE__ */ r(
|
399
|
+
}), /* @__PURE__ */ S(L, { children: [
|
400
|
+
/* @__PURE__ */ r(D, { asChild: !0, children: v }),
|
400
401
|
/* @__PURE__ */ r(
|
401
|
-
|
402
|
+
O,
|
402
403
|
{
|
403
404
|
side: "right",
|
404
405
|
align: "center",
|