@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.
@@ -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 u } from "../Form/FormRenderControl.mjs";
4
- import { Input as a } from "../Input/Input.mjs";
5
- const F = (m) => {
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
- u,
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
- a,
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
- F as FormInput
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 * 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,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
- r as Input
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,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/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 { 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) => {
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), h = v(c, 1e3), p = (r) => {
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), h(r.target.value);
17
+ l(u), e == null || e(r), p(r.target.value);
17
18
  };
18
- return /* @__PURE__ */ o("div", { className: d("space-y-4", n), children: /* @__PURE__ */ o(
19
- f,
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: p,
24
+ onChange: h,
24
25
  ...m
25
26
  }
26
27
  ) });
27
28
  };
28
29
  export {
29
- j as Search
30
+ k as Search
30
31
  };
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>>;
@@ -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 { 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";
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 D, TooltipTrigger as O, TooltipContent as L } from "../Tooltip/TooltipRoot.mjs";
14
- import { Tooltip as G } from "../Tooltip/Tooltip.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";
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(D, { delayDuration: 0, 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(T, { open: p, onOpenChange: u, ...s, children: /* @__PURE__ */ r(
111
- A,
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
- z,
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
- B,
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(G, { children: [
399
- /* @__PURE__ */ r(O, { asChild: !0, children: v }),
399
+ }), /* @__PURE__ */ S(L, { children: [
400
+ /* @__PURE__ */ r(D, { asChild: !0, children: v }),
400
401
  /* @__PURE__ */ r(
401
- L,
402
+ O,
402
403
  {
403
404
  side: "right",
404
405
  align: "center",