@oneplatformdev/ui 0.0.1-beta.85 → 0.0.1-beta.87

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.
@@ -1,5 +1,6 @@
1
1
  import { DropzoneValueItem } from './Dropzone.types';
2
2
 
3
+ export declare const transformImageToSrc: (preview?: string | File | null) => string;
3
4
  interface SinglePickPreviewProps {
4
5
  item: DropzoneValueItem;
5
6
  disabled?: boolean;
@@ -1,38 +1,41 @@
1
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
- import { useState as u, useEffect as f } from "react";
3
- import { isFile as p } from "./DropzoneUtils.mjs";
4
- import { X as h, FileIcon as m } from "lucide-react";
5
- const b = ({
6
- item: e,
7
- disabled: a,
8
- onRemoveClick: d
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import { useMemo as c } from "react";
3
+ import { isFile as i } from "./DropzoneUtils.mjs";
4
+ import { X as a, FileIcon as u } from "lucide-react";
5
+ const d = (t) => {
6
+ if (!t) return "";
7
+ switch (!0) {
8
+ case (typeof t == "string" && !!t.trim() && t !== "null"):
9
+ return t;
10
+ case t instanceof File:
11
+ return URL.createObjectURL(t);
12
+ case t instanceof FileList:
13
+ return t[0] ? URL.createObjectURL(t[0]) : "";
14
+ default:
15
+ return "";
16
+ }
17
+ }, p = ({
18
+ item: t,
19
+ disabled: l,
20
+ onRemoveClick: n
9
21
  }) => {
10
- const r = p(e), l = r ? e.name : e, [n, o] = u(null);
11
- return f(() => {
12
- if (r) {
13
- const i = e;
14
- if (i.type.startsWith("image/")) {
15
- const s = new FileReader();
16
- s.onloadend = () => o(s.result), s.readAsDataURL(i);
17
- } else
18
- o(null);
19
- } else
20
- o(typeof e == "string" ? e : null);
21
- }, [e, r]), /* @__PURE__ */ c("div", { className: "relative w-full h-64 sm:h-80 md:h-96 overflow-hidden outline-[#E4E4E7] outline-[2px] outline-dashed outline-offset-[-1px] rounded-lg", children: [
22
- !a && /* @__PURE__ */ t("div", { className: "absolute top-2 right-2 cursor-pointer bg-white/70 rounded-[4px] p-1 shadow", onClick: d, children: /* @__PURE__ */ t(h, { size: 16, strokeWidth: 2, color: "black" }) }),
23
- n ? /* @__PURE__ */ t(
22
+ const e = i(t) ? t.name : t, o = c(() => d(t), [t]);
23
+ return /* @__PURE__ */ s("div", { className: "relative w-full h-64 sm:h-80 md:h-96 overflow-hidden outline-[#E4E4E7] outline-[2px] outline-dashed outline-offset-[-1px] rounded-lg", children: [
24
+ !l && /* @__PURE__ */ r("div", { className: "absolute top-2 right-2 cursor-pointer bg-white/70 rounded-[4px] p-1 shadow", onClick: n, children: /* @__PURE__ */ r(a, { size: 16, strokeWidth: 2, color: "black" }) }),
25
+ o ? /* @__PURE__ */ r(
24
26
  "img",
25
27
  {
26
- src: n,
27
- alt: l == null ? void 0 : l.toString(),
28
+ src: o,
29
+ alt: e == null ? void 0 : e.toString(),
28
30
  className: "w-full h-full object-cover rounded-lg "
29
31
  }
30
- ) : /* @__PURE__ */ c("div", { className: "w-full h-full flex flex-col items-center justify-center text-gray-600", children: [
31
- /* @__PURE__ */ t(m, { size: 28 }),
32
- /* @__PURE__ */ t("span", { className: "text-sm mt-2 break-all px-2 text-center", children: l == null ? void 0 : l.toString() })
32
+ ) : /* @__PURE__ */ s("div", { className: "w-full h-full flex flex-col items-center justify-center text-gray-600", children: [
33
+ /* @__PURE__ */ r(u, { size: 28 }),
34
+ /* @__PURE__ */ r("span", { className: "text-sm mt-2 break-all px-2 text-center", children: e == null ? void 0 : e.toString() })
33
35
  ] })
34
36
  ] });
35
37
  };
36
38
  export {
37
- b as DropzoneSinglePickPreview
39
+ p as DropzoneSinglePickPreview,
40
+ d as transformImageToSrc
38
41
  };
@@ -1,9 +1,9 @@
1
1
  import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
3
  import * as e from "@radix-ui/react-select";
4
- import { ChevronDown as i, ChevronUp as f, Check as u } from "lucide-react";
4
+ import { ChevronDown as i, ChevronUp as u, Check as h } from "lucide-react";
5
5
  import { cn as s } from "@oneplatformdev/utils";
6
- const v = e.Root, R = e.Group, C = e.Value, h = l.forwardRef(({ className: o, children: r, ...a }, d) => /* @__PURE__ */ n(
6
+ const R = e.Root, C = e.Group, I = e.Value, w = l.forwardRef(({ className: o, children: r, ...a }, d) => /* @__PURE__ */ n(
7
7
  e.Trigger,
8
8
  {
9
9
  ref: d,
@@ -19,7 +19,7 @@ const v = e.Root, R = e.Group, C = e.Value, h = l.forwardRef(({ className: o, ch
19
19
  ]
20
20
  }
21
21
  ));
22
- h.displayName = e.Trigger.displayName;
22
+ w.displayName = e.Trigger.displayName;
23
23
  const c = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
24
24
  e.ScrollUpButton,
25
25
  {
@@ -29,7 +29,7 @@ const c = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
29
29
  o
30
30
  ),
31
31
  ...r,
32
- children: /* @__PURE__ */ t(f, { className: "h-4 w-4" })
32
+ children: /* @__PURE__ */ t(u, { className: "h-4 w-4" })
33
33
  }
34
34
  ));
35
35
  c.displayName = e.ScrollUpButton.displayName;
@@ -46,17 +46,21 @@ const m = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
46
46
  }
47
47
  ));
48
48
  m.displayName = e.ScrollDownButton.displayName;
49
- const w = l.forwardRef(({ className: o, children: r, position: a = "popper", ...d }, p) => /* @__PURE__ */ t(e.Portal, { children: /* @__PURE__ */ n(
49
+ const y = l.forwardRef(({ className: o, children: r, position: a = "popper", style: d, ...p }, f) => /* @__PURE__ */ t(e.Portal, { children: /* @__PURE__ */ n(
50
50
  e.Content,
51
51
  {
52
- ref: p,
52
+ ref: f,
53
53
  className: s(
54
54
  "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
55
55
  a === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
56
56
  o
57
57
  ),
58
58
  position: a,
59
- ...d,
59
+ style: {
60
+ pointerEvents: "auto",
61
+ ...d
62
+ },
63
+ ...p,
60
64
  children: [
61
65
  /* @__PURE__ */ t(c, {}),
62
66
  /* @__PURE__ */ t(
@@ -73,8 +77,8 @@ const w = l.forwardRef(({ className: o, children: r, position: a = "popper", ...
73
77
  ]
74
78
  }
75
79
  ) }));
76
- w.displayName = e.Content.displayName;
77
- const y = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
80
+ y.displayName = e.Content.displayName;
81
+ const g = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
78
82
  e.Label,
79
83
  {
80
84
  ref: a,
@@ -82,8 +86,8 @@ const y = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
82
86
  ...r
83
87
  }
84
88
  ));
85
- y.displayName = e.Label.displayName;
86
- const g = l.forwardRef(({ className: o, children: r, ...a }, d) => /* @__PURE__ */ n(
89
+ g.displayName = e.Label.displayName;
90
+ const N = l.forwardRef(({ className: o, children: r, ...a }, d) => /* @__PURE__ */ n(
87
91
  e.Item,
88
92
  {
89
93
  ref: d,
@@ -93,13 +97,13 @@ const g = l.forwardRef(({ className: o, children: r, ...a }, d) => /* @__PURE__
93
97
  ),
94
98
  ...a,
95
99
  children: [
96
- /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(e.ItemIndicator, { children: /* @__PURE__ */ t(u, { className: "h-4 w-4" }) }) }),
100
+ /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(e.ItemIndicator, { children: /* @__PURE__ */ t(h, { className: "h-4 w-4" }) }) }),
97
101
  /* @__PURE__ */ t(e.ItemText, { children: r })
98
102
  ]
99
103
  }
100
104
  ));
101
- g.displayName = e.Item.displayName;
102
- const N = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
105
+ N.displayName = e.Item.displayName;
106
+ const x = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
103
107
  e.Separator,
104
108
  {
105
109
  ref: a,
@@ -107,16 +111,16 @@ const N = l.forwardRef(({ className: o, ...r }, a) => /* @__PURE__ */ t(
107
111
  ...r
108
112
  }
109
113
  ));
110
- N.displayName = e.Separator.displayName;
114
+ x.displayName = e.Separator.displayName;
111
115
  export {
112
- w as SelectContent,
113
- R as SelectGroup,
114
- g as SelectItem,
115
- y as SelectLabel,
116
- v as SelectRoot,
116
+ y as SelectContent,
117
+ C as SelectGroup,
118
+ N as SelectItem,
119
+ g as SelectLabel,
120
+ R as SelectRoot,
117
121
  m as SelectScrollDownButton,
118
122
  c as SelectScrollUpButton,
119
- N as SelectSeparator,
120
- h as SelectTrigger,
121
- C as SelectValue
123
+ x as SelectSeparator,
124
+ w as SelectTrigger,
125
+ I as SelectValue
122
126
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneplatformdev/ui",
3
- "version": "0.0.1-beta.85",
3
+ "version": "0.0.1-beta.87",
4
4
  "description": "UI React Components.",
5
5
  "author": "One Platform Development Team",
6
6
  "keywords": [