@konstructio/ui 0.1.2-alpha.44 → 0.1.2-alpha.47

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 (68) hide show
  1. package/dist/components/AlertDialog/AlertDialog.js +39 -37
  2. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  3. package/dist/components/AlertDialog/components/index.js +1 -1
  4. package/dist/components/Badge/Badge.js +23 -26
  5. package/dist/components/Badge/Badge.variants.js +1 -1
  6. package/dist/components/Button/Button.variants.js +108 -98
  7. package/dist/components/Checkbox/Checkbox.js +104 -100
  8. package/dist/components/Checkbox/Checkbox.variants.js +30 -7
  9. package/dist/components/Counter/Counter.js +210 -0
  10. package/dist/components/Counter/Counter.variants.js +70 -0
  11. package/dist/components/Filter/Filter.js +1 -1
  12. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +9 -10
  13. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +76 -43
  14. package/dist/components/Filter/components/ResetButton/ResetButton.js +21 -32
  15. package/dist/components/Filter/events/index.js +3 -3
  16. package/dist/components/ImageUpload/ImageUpload.js +221 -0
  17. package/dist/components/ImageUpload/ImageUpload.variants.js +109 -0
  18. package/dist/components/Input/Input.variants.js +10 -2
  19. package/dist/components/PhoneNumberInput/PhoneNumberInput.variants.js +4 -4
  20. package/dist/components/PhoneNumberInput/components/FlagContent/FlagContent.js +16 -7
  21. package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +92 -74
  22. package/dist/components/PhoneNumberInput/components/FlagSelectorWrapper/FlagSelectorWrapper.js +53 -29
  23. package/dist/components/PhoneNumberInput/components/Wrapper.js +139 -120
  24. package/dist/components/Radio/Radio.js +47 -44
  25. package/dist/components/Radio/Radio.variants.js +12 -8
  26. package/dist/components/Select/Select.js +48 -0
  27. package/dist/components/{Dropdown/Dropdown.variants.js → Select/Select.variants.js} +3 -3
  28. package/dist/components/{Dropdown → Select}/components/List/List.js +48 -43
  29. package/dist/components/{Dropdown → Select}/components/List/List.variants.js +8 -5
  30. package/dist/components/{Dropdown → Select}/components/ListItem/ListItem.js +20 -20
  31. package/dist/components/{Dropdown → Select}/components/ListItem/ListItem.variants.js +3 -2
  32. package/dist/components/{Dropdown → Select}/components/Wrapper.js +70 -70
  33. package/dist/components/Select/contexts/index.js +6 -0
  34. package/dist/components/{Dropdown/contexts/dropdown.context.js → Select/contexts/select.context.js} +2 -2
  35. package/dist/components/Select/contexts/select.hook.js +11 -0
  36. package/dist/components/Select/contexts/select.provider.js +58 -0
  37. package/dist/components/{Dropdown → Select}/hooks/useNavigationList.js +3 -3
  38. package/dist/components/{Dropdown/hooks/useDropdown.js → Select/hooks/useSelect.js} +33 -33
  39. package/dist/components/Switch/Switch.js +153 -125
  40. package/dist/components/Switch/Switch.variants.js +15 -6
  41. package/dist/components/TimePicker/TimePicker.variants.js +11 -6
  42. package/dist/components/TimePicker/components/MeridianList/MeridianList.js +30 -20
  43. package/dist/components/TimePicker/components/Wrapper/Wrapper.js +50 -35
  44. package/dist/components/Typography/Typography.js +24 -28
  45. package/dist/components/Typography/Typography.variants.js +49 -46
  46. package/dist/components/VirtualizedTable/components/Actions/Actions.js +14 -14
  47. package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +10 -10
  48. package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +1 -1
  49. package/dist/components/index.js +84 -80
  50. package/dist/{index-CPU02rhe.js → index-D6KzX_ef.js} +13 -12
  51. package/dist/index.d.ts +134 -81
  52. package/dist/index.js +114 -110
  53. package/dist/package.json +4 -4
  54. package/dist/styles.css +1 -1
  55. package/dist/ui/civo-theme.css +6 -5
  56. package/dist/ui/theme.css +27 -0
  57. package/dist/x-BXShoIAM.js +8 -0
  58. package/package.json +4 -4
  59. package/dist/components/Dropdown/Dropdown.js +0 -48
  60. package/dist/components/Dropdown/contexts/dropdown.hook.js +0 -13
  61. package/dist/components/Dropdown/contexts/dropdown.provider.js +0 -58
  62. package/dist/components/Dropdown/contexts/index.js +0 -6
  63. package/dist/components/NumberInput/NumberInput.js +0 -179
  64. package/dist/components/NumberInput/NumberInput.variants.js +0 -50
  65. /package/dist/components/{Dropdown → Select}/components/EmptyList.js +0 -0
  66. /package/dist/components/{Dropdown → Select}/components/index.js +0 -0
  67. /package/dist/components/{Dropdown → Select}/constants/index.js +0 -0
  68. /package/dist/components/{Dropdown → Select}/constants/pagination.js +0 -0
@@ -0,0 +1,70 @@
1
+ import { c as e } from "../../index-D29mdTf5.js";
2
+ const t = e([
3
+ "[&::-webkit-inner-spin-button]:appearance-none",
4
+ "[&::-webkit-outer-spin-button]:appearance-none",
5
+ "[-moz-appearance:textfield]",
6
+ "appearance-none",
7
+ "border",
8
+ "border-x-0",
9
+ "focus-visible:outline-none",
10
+ "focus-visible:ring-transparent",
11
+ "h-9",
12
+ "max-w-16",
13
+ "text-right",
14
+ "px-3",
15
+ "border-gray-300",
16
+ "text-slate-800",
17
+ "bg-white",
18
+ "dark:bg-metal-800",
19
+ "dark:border-metal-700",
20
+ "dark:text-metal-50"
21
+ ]), r = e(
22
+ [
23
+ "h-9",
24
+ "w-9",
25
+ "flex",
26
+ "items-center",
27
+ "justify-center",
28
+ "border",
29
+ "text-slate-500",
30
+ "border-gray-300",
31
+ "bg-white",
32
+ "cursor-pointer",
33
+ "hover:bg-aurora-50",
34
+ "hover:text-slate-600",
35
+ "disabled:hover:bg-white",
36
+ "disabled:bg-white",
37
+ "disabled:text-slate-400",
38
+ "dark:bg-metal-800",
39
+ "dark:border-metal-700",
40
+ "dark:text-aurora-500",
41
+ "dark:hover:bg-aurora-900",
42
+ "dark:hover:text-aurora-500",
43
+ "dark:disabled:text-metal-400",
44
+ "dark:disabled:hover:bg-metal-800",
45
+ "dark:disabled:bg-metal-800",
46
+ "disabled:cursor-not-allowed"
47
+ ],
48
+ {
49
+ variants: {
50
+ button: {
51
+ left: ["rounded-e"],
52
+ rigth: ["rounded-s"]
53
+ }
54
+ }
55
+ }
56
+ ), o = e(["cursor-pointer"], {
57
+ variants: {
58
+ variant: {
59
+ default: ""
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ variant: "default"
64
+ }
65
+ });
66
+ export {
67
+ r as buttonVariants,
68
+ t as counterVariants,
69
+ o as labelVariants
70
+ };
@@ -9,7 +9,7 @@ const t = ({
9
9
  theme: o = "civo",
10
10
  children: r
11
11
  }) => /* @__PURE__ */ i("div", { className: m(a({ className: e })), "data-theme": o, children: r });
12
- t.displayName = "Filter";
12
+ t.displayName = "KonstructFilter";
13
13
  t.BadgeMultiSelect = l;
14
14
  t.DateFilterDropdown = p;
15
15
  t.ResetButton = s;
@@ -2,8 +2,8 @@ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
2
  import { Badge as o } from "../../../Badge/Badge.js";
3
3
  import { Button as m } from "../../../Button/Button.js";
4
4
  import { Checkbox as k } from "../../../Checkbox/Checkbox.js";
5
- import { cn as l } from "../../../../utils/index.js";
6
5
  import { filterButtonIconVariants as C, filterButtonVariants as y } from "../../Filter.variants.js";
6
+ import { cn as r } from "../../../../utils/index.js";
7
7
  import { useBadgeMultiSelect as N } from "./BadgeMultiSelect.hook.js";
8
8
  import { C as B } from "../../../../chevron-down-DgT-uSF9.js";
9
9
  const $ = ({
@@ -14,7 +14,7 @@ const $ = ({
14
14
  }) => {
15
15
  const {
16
16
  wrapperRef: h,
17
- isOpen: r,
17
+ isOpen: l,
18
18
  selectedOptions: u,
19
19
  selectedCount: c,
20
20
  handleOpen: g,
@@ -26,8 +26,8 @@ const $ = ({
26
26
  /* @__PURE__ */ t(
27
27
  "button",
28
28
  {
29
- className: l(y(), {
30
- "text-slate-700 dark:text-metal-50": r
29
+ className: r(y(), {
30
+ "text-slate-700 dark:text-metal-50": l
31
31
  }),
32
32
  onClick: g,
33
33
  children: [
@@ -36,19 +36,18 @@ const $ = ({
36
36
  /* @__PURE__ */ e(
37
37
  B,
38
38
  {
39
- className: l(C(), {
40
- "rotate-180": r,
41
- "text-blue-600 dark:text-aurora-500": r
39
+ className: r(C(), {
40
+ "rotate-180 text-blue-600 dark:text-aurora-500": l
42
41
  })
43
42
  }
44
43
  )
45
44
  ]
46
45
  }
47
46
  ),
48
- r && /* @__PURE__ */ t(
47
+ l && /* @__PURE__ */ t(
49
48
  "div",
50
49
  {
51
- className: l(
50
+ className: r(
52
51
  "absolute",
53
52
  "top-full",
54
53
  "mt-1",
@@ -88,7 +87,7 @@ const $ = ({
88
87
  /* @__PURE__ */ t(
89
88
  "div",
90
89
  {
91
- className: l(
90
+ className: r(
92
91
  "flex",
93
92
  "justify-center",
94
93
  "items-center",
@@ -1,55 +1,71 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
- import { Badge as g } from "../../../Badge/Badge.js";
2
+ import { Badge as b } from "../../../Badge/Badge.js";
3
3
  import { Button as i } from "../../../Button/Button.js";
4
- import { DatePicker as w } from "../../../Datepicker/DatePicker.js";
5
- import { cn as o } from "../../../../utils/index.js";
6
- import { filterButtonIconVariants as x, filterButtonVariants as y } from "../../Filter.variants.js";
7
- import { useDateFilterDropdown as D } from "./DateFilterDropdown.hook.js";
8
- import { C as N } from "../../../../chevron-down-DgT-uSF9.js";
4
+ import { DatePicker as g } from "../../../Datepicker/DatePicker.js";
5
+ import { filterButtonIconVariants as x, filterButtonVariants as w } from "../../Filter.variants.js";
6
+ import { cn as t } from "../../../../utils/index.js";
7
+ import { useDateFilterDropdown as y } from "./DateFilterDropdown.hook.js";
8
+ import { C as k } from "../../../../chevron-down-DgT-uSF9.js";
9
9
  const R = ({
10
- label: s,
10
+ label: d,
11
11
  position: l = "left",
12
- onApply: p
12
+ onApply: s
13
13
  }) => {
14
14
  const {
15
- id: c,
15
+ id: p,
16
16
  appliedDay: n,
17
- isOpen: t,
18
- selectedDay: r,
19
- wrapperRef: d,
20
- handleApply: m,
17
+ isOpen: r,
18
+ selectedDay: o,
19
+ wrapperRef: m,
20
+ handleApply: c,
21
21
  handleOpen: f,
22
22
  handleSelect: h,
23
23
  handleReset: u
24
- } = D({ onApply: p });
25
- return /* @__PURE__ */ a("div", { ref: d, className: "relative", children: [
24
+ } = y({ onApply: s });
25
+ return /* @__PURE__ */ a("div", { ref: m, className: "relative", children: [
26
26
  /* @__PURE__ */ a(
27
27
  "button",
28
28
  {
29
- className: o(y(), {
30
- "text-slate-700": t
29
+ className: t(w(), {
30
+ "text-slate-700": r
31
31
  }),
32
32
  onClick: f,
33
33
  children: [
34
- s,
35
- n && /* @__PURE__ */ e(g, { label: n }),
34
+ d,
35
+ n && /* @__PURE__ */ e(b, { label: n }),
36
36
  /* @__PURE__ */ e(
37
- N,
37
+ k,
38
38
  {
39
- className: o(x(), {
40
- "rotate-180": t,
41
- "text-blue-600": t
39
+ className: t(x(), {
40
+ "rotate-180 text-blue-600 dark:text-aurora-500": r
42
41
  })
43
42
  }
44
43
  )
45
44
  ]
46
45
  }
47
46
  ),
48
- t && /* @__PURE__ */ a(
47
+ r && /* @__PURE__ */ a(
49
48
  "div",
50
49
  {
51
- className: o(
52
- "absolute top-full mt-1 bg-white rounded-md shadow-md animate-in fade-in-0 z-10 border border-gray-200 flex flex-col gap-4 py-4 px-6",
50
+ className: t(
51
+ "absolute",
52
+ "top-full",
53
+ "mt-1",
54
+ "bg-white",
55
+ "rounded-md",
56
+ "shadow-md",
57
+ "animate-in",
58
+ "fade-in-0",
59
+ "z-10",
60
+ "border",
61
+ "border-gray-200",
62
+ "flex",
63
+ "flex-col",
64
+ "gap-4",
65
+ "py-4",
66
+ "px-6",
67
+ "dark:bg-metal-800",
68
+ "dark:border-metal-700",
53
69
  {
54
70
  "left-0": l === "left",
55
71
  "right-0": l === "right"
@@ -57,29 +73,46 @@ const R = ({
57
73
  ),
58
74
  children: [
59
75
  /* @__PURE__ */ e(
60
- w,
76
+ g,
61
77
  {
62
78
  className: "p-0",
63
79
  arrowClassName: "-top-1 right-0",
64
- monthsClassName: "shadow-none p-0 w-auto",
65
- defaultSelected: r,
66
- defaultMonth: r,
80
+ monthsClassName: t(
81
+ "shadow-none",
82
+ "p-0",
83
+ "w-auto",
84
+ "dark:border-transparent"
85
+ ),
86
+ defaultSelected: o,
87
+ defaultMonth: o,
67
88
  onSelect: h
68
89
  },
69
- r?.toISOString() ?? c
90
+ o?.toISOString() ?? p
70
91
  ),
71
- /* @__PURE__ */ a("div", { className: "flex justify-end items-center gap-4 py-2", children: [
72
- /* @__PURE__ */ e(
73
- i,
74
- {
75
- variant: "secondary",
76
- appearance: "compact",
77
- onClick: u,
78
- children: "Reset"
79
- }
80
- ),
81
- /* @__PURE__ */ e(i, { appearance: "compact", onClick: m, children: "Apply" })
82
- ] })
92
+ /* @__PURE__ */ a(
93
+ "div",
94
+ {
95
+ className: t(
96
+ "flex",
97
+ "justify-end",
98
+ "items-center",
99
+ "gap-4",
100
+ "py-2"
101
+ ),
102
+ children: [
103
+ /* @__PURE__ */ e(
104
+ i,
105
+ {
106
+ variant: "secondary",
107
+ appearance: "compact",
108
+ onClick: u,
109
+ children: "Reset"
110
+ }
111
+ ),
112
+ /* @__PURE__ */ e(i, { appearance: "compact", onClick: c, children: "Apply" })
113
+ ]
114
+ }
115
+ )
83
116
  ]
84
117
  }
85
118
  )
@@ -1,43 +1,32 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { useCallback as s } from "react";
3
- import { Button as p } from "../../../Button/Button.js";
4
- import { cn as m } from "../../../../utils/index.js";
5
- import { resetEvent as c } from "../../events/index.js";
6
- const b = ({
7
- disabled: t,
8
- className: e,
9
- onClick: r,
10
- ...a
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useCallback as m } from "react";
3
+ import { Button as i } from "../../../Button/Button.js";
4
+ import { cn as c } from "../../../../utils/index.js";
5
+ import { resetEvent as p } from "../../events/index.js";
6
+ const d = ({
7
+ disabled: e,
8
+ className: r,
9
+ onClick: t,
10
+ ...o
11
11
  }) => {
12
- const o = s(() => {
13
- c(), r?.();
14
- }, [r]);
15
- return /* @__PURE__ */ n(
16
- p,
12
+ const n = m(() => {
13
+ p(), t?.();
14
+ }, [t]);
15
+ return /* @__PURE__ */ a(
16
+ i,
17
17
  {
18
18
  type: "button",
19
- variant: "text",
19
+ variant: "link",
20
20
  appearance: "compact",
21
21
  version: "alternate",
22
- onClick: o,
23
- disabled: t,
24
- className: m(
25
- "text-aurora-500",
26
- "hover:text-slate-700",
27
- "disabled:text-aurora-500/60",
28
- "bg-transparent",
29
- "hover:bg-transparent",
30
- "hover:text-aurora-500",
31
- "border-transparent",
32
- "dark:hover:text-aurora-500",
33
- "dark:hover:bg-aurora-900",
34
- e
35
- ),
36
- ...a,
22
+ onClick: n,
23
+ disabled: e,
24
+ className: c("hover:no-underline", r),
25
+ ...o,
37
26
  children: "Reset"
38
27
  }
39
28
  );
40
29
  };
41
30
  export {
42
- b as ResetButton
31
+ d as ResetButton
43
32
  };
@@ -1,8 +1,8 @@
1
- var e = /* @__PURE__ */ ((t) => (t.OPEN = "@konstrtuctio/Filter/event-OPEN", t.RESET = "@konstrtuctio/Filter/event-RESET", t))(e || {});
1
+ var e = /* @__PURE__ */ ((t) => (t.OPEN = "@konstrtuctio/KonstructFilter/event-OPEN", t.RESET = "@konstrtuctio/KonstructFilter/event-RESET", t))(e || {});
2
2
  const n = (t) => document.dispatchEvent(
3
- new CustomEvent("@konstrtuctio/Filter/event-OPEN", { detail: t })
3
+ new CustomEvent("@konstrtuctio/KonstructFilter/event-OPEN", { detail: t })
4
4
  ), o = () => document.dispatchEvent(new CustomEvent(
5
- "@konstrtuctio/Filter/event-RESET"
5
+ "@konstrtuctio/KonstructFilter/event-RESET"
6
6
  /* RESET */
7
7
  ));
8
8
  export {
@@ -0,0 +1,221 @@
1
+ import { jsxs as l, jsx as e, Fragment as S } from "react/jsx-runtime";
2
+ import { useId as ee, useRef as j, useState as g, useEffect as te } from "react";
3
+ import { S as ae } from "../../loader-juvMSJ9L.js";
4
+ import { Button as F } from "../Button/Button.js";
5
+ import { cn as m } from "../../utils/index.js";
6
+ import { labelVariants as re, inputFieldVariants as le, inputContainerVariants as ie, helperTextVariants as se, imageUploadVariants as ne } from "./ImageUpload.variants.js";
7
+ import { c as ce } from "../../createLucideIcon-D4r5Phnh.js";
8
+ import { Warning as oe } from "../../assets/icons/components/Warning.js";
9
+ import { X as D } from "../../x-BXShoIAM.js";
10
+ const de = [
11
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
12
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
13
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
14
+ ], me = ce("image", de);
15
+ var t = /* @__PURE__ */ ((s) => (s.Default = "default", s.Uploading = "uploading", s.Complete = "complete", s.Error = "error", s))(t || {});
16
+ const pe = ({
17
+ className: s,
18
+ error: b,
19
+ fileName: T,
20
+ fileSize: E,
21
+ fileUrl: z,
22
+ helperText: R = "Logo should be 32 x 32 pixels with transparent background (larger images will be downscaled proportionally to fit). Accepted file type is SVG, PNG, JPEG. Max file size is 5MB.",
23
+ isRequired: L = !1,
24
+ label: p = "Item logo",
25
+ labelClassName: P,
26
+ name: A,
27
+ onChange: N,
28
+ onRemove: H,
29
+ status: k = t.Default,
30
+ theme: u,
31
+ uploadButtonText: J = "Upload logo",
32
+ accept: M = "image/svg+xml,image/png,image/jpeg,image/jpg",
33
+ maxSize: K = 5 * 1024 * 1024
34
+ }) => {
35
+ const U = ee(), f = j(null), n = j(null), [W, c] = g(k), [_, B] = g(z), [$, C] = g(T), [X, G] = g(E);
36
+ te(() => () => {
37
+ n.current && clearTimeout(n.current);
38
+ }, []);
39
+ const a = k !== t.Default ? k : W, y = z ?? _, o = T ?? $, h = E ?? X, x = !!b || a === t.Error, q = (i) => {
40
+ const r = i.target.files?.[0];
41
+ if (!r) return;
42
+ if (!M.split(",").map((d) => d.trim()).some((d) => {
43
+ if (d.includes("*")) {
44
+ const Z = d.split("/")[0];
45
+ return r.type.startsWith(Z);
46
+ }
47
+ return r.type === d;
48
+ })) {
49
+ c(t.Error), N?.(i);
50
+ return;
51
+ }
52
+ if (r.size > K) {
53
+ c(t.Error), N?.(i);
54
+ return;
55
+ }
56
+ c(t.Uploading), C(r.name), G(Q(r.size));
57
+ const v = new FileReader();
58
+ v.onloadend = () => {
59
+ B(v.result), n.current = setTimeout(() => {
60
+ c(t.Complete);
61
+ }, 500);
62
+ }, v.readAsDataURL(r), N?.(i);
63
+ }, V = () => {
64
+ n.current && (clearTimeout(n.current), n.current = null), B(void 0), C(void 0), G(void 0), c(t.Default), f.current && (f.current.value = ""), H?.();
65
+ }, O = () => {
66
+ f.current?.click();
67
+ }, Q = (i) => {
68
+ if (i === 0) return "0 Bytes";
69
+ const r = 1024, I = ["Bytes", "KB", "MB", "GB"], w = Math.floor(Math.log(i) / Math.log(r));
70
+ return `${parseFloat((i / Math.pow(r, w)).toFixed(2))}${I[w]}`;
71
+ }, Y = b || (x ? "Invalid file format. Accepted file type is SVG, PNG, JPEG. Max file size is 5MB." : R || "Logo should be 32 x 32 pixels with transparent background (larger images will be downscaled proportionally to fit). Accepted file type is SVG, PNG, JPEG. Max file size is 5MB.");
72
+ return /* @__PURE__ */ l(
73
+ "div",
74
+ {
75
+ className: m(
76
+ ne({
77
+ status: a,
78
+ className: s
79
+ })
80
+ ),
81
+ "data-theme": u,
82
+ children: [
83
+ p && /* @__PURE__ */ l(
84
+ "label",
85
+ {
86
+ htmlFor: U,
87
+ className: m(
88
+ re({
89
+ className: P
90
+ }),
91
+ "cursor-pointer"
92
+ ),
93
+ children: [
94
+ p,
95
+ L && /* @__PURE__ */ e("span", { className: "text-red-600 text-xs mt-0.5", children: "*" })
96
+ ]
97
+ }
98
+ ),
99
+ /* @__PURE__ */ l(
100
+ "div",
101
+ {
102
+ className: m(
103
+ ie({
104
+ status: a
105
+ })
106
+ ),
107
+ children: [
108
+ /* @__PURE__ */ l(
109
+ "div",
110
+ {
111
+ className: m(
112
+ le({
113
+ status: a
114
+ }),
115
+ {
116
+ "justify-between": x,
117
+ "justify-start": !x
118
+ }
119
+ ),
120
+ children: [
121
+ a === t.Uploading && /* @__PURE__ */ l(S, { children: [
122
+ /* @__PURE__ */ e(ae, { className: "w-5 h-5 shrink-0 animate-spin text-metal-400" }),
123
+ o && /* @__PURE__ */ l("div", { className: "flex flex-col items-start min-w-0 flex-1", children: [
124
+ /* @__PURE__ */ e("p", { className: "text-sm leading-5 truncate w-full text-slate-800 dark:text-metal-50", children: o }),
125
+ h && /* @__PURE__ */ e("p", { className: "text-xs leading-4 text-slate-600 dark:text-metal-300 tracking-[0.15px]", children: h })
126
+ ] })
127
+ ] }),
128
+ a === t.Complete && y && /* @__PURE__ */ l(S, { children: [
129
+ /* @__PURE__ */ e("div", { className: "w-8 h-8 shrink-0 relative", children: /* @__PURE__ */ e(
130
+ "img",
131
+ {
132
+ src: y,
133
+ alt: o || "Uploaded image",
134
+ className: "w-full h-full object-contain"
135
+ }
136
+ ) }),
137
+ o && /* @__PURE__ */ l("div", { className: "flex flex-col items-start min-w-0 flex-1", children: [
138
+ /* @__PURE__ */ e("p", { className: "text-sm leading-5 truncate w-full text-slate-800 dark:text-slate-50 kubefirst-dark:text-slate-50", children: o }),
139
+ h && /* @__PURE__ */ e("p", { className: "text-xs leading-4 text-slate-600 dark:text-slate-400 kubefirst-dark:text-slate-400 tracking-[0.15px]", children: h })
140
+ ] })
141
+ ] }),
142
+ (a === t.Default || a === t.Error && !y) && /* @__PURE__ */ e("div", { className: "w-8 h-8 shrink-0 flex items-center justify-center", children: /* @__PURE__ */ e(me, { className: "w-8 h-8 text-slate-400 dark:text-slate-500 kubefirst-dark:text-slate-500" }) }),
143
+ x && /* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(oe, { className: "w-5 h-5 text-red-700 dark:text-red-500 kubefirst-dark:text-red-500" }) })
144
+ ]
145
+ }
146
+ ),
147
+ (a === t.Default || a === t.Error) && /* @__PURE__ */ e(
148
+ F,
149
+ {
150
+ variant: "secondary",
151
+ onClick: O,
152
+ theme: u,
153
+ className: "h-10 px-4 py-2 shrink-0",
154
+ children: J
155
+ }
156
+ ),
157
+ a === t.Uploading && /* @__PURE__ */ e(
158
+ F,
159
+ {
160
+ variant: "secondary",
161
+ shape: "circle",
162
+ size: "medium",
163
+ onClick: V,
164
+ theme: u,
165
+ className: "shrink-0",
166
+ "aria-label": "Cancel upload",
167
+ children: /* @__PURE__ */ e(D, { className: "w-6 h-6" })
168
+ }
169
+ ),
170
+ a === t.Complete && /* @__PURE__ */ e(
171
+ F,
172
+ {
173
+ variant: "secondary",
174
+ shape: "circle",
175
+ size: "medium",
176
+ onClick: V,
177
+ theme: u,
178
+ className: "shrink-0",
179
+ "aria-label": "Remove file",
180
+ children: /* @__PURE__ */ e(D, { className: "w-6 h-6" })
181
+ }
182
+ )
183
+ ]
184
+ }
185
+ ),
186
+ /* @__PURE__ */ l("div", { className: "flex w-full gap-2", children: [
187
+ /* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ e(
188
+ "p",
189
+ {
190
+ className: m(
191
+ se({
192
+ status: a
193
+ })
194
+ ),
195
+ children: Y
196
+ }
197
+ ) }),
198
+ (a === t.Default || a === t.Error) && /* @__PURE__ */ e("div", { className: "shrink-0 w-29" }),
199
+ a === t.Uploading && /* @__PURE__ */ e("div", { className: "shrink-0 w-10" })
200
+ ] }),
201
+ /* @__PURE__ */ e(
202
+ "input",
203
+ {
204
+ ref: f,
205
+ id: U,
206
+ type: "file",
207
+ name: A,
208
+ accept: M,
209
+ onChange: q,
210
+ className: "hidden",
211
+ "aria-label": typeof p == "string" ? p : "File upload"
212
+ }
213
+ )
214
+ ]
215
+ }
216
+ );
217
+ };
218
+ pe.displayName = "KonstructImageUpload";
219
+ export {
220
+ pe as ImageUpload
221
+ };