@konstructio/ui 0.1.2-alpha.55 → 0.1.2-alpha.56
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/dist/assets/icons/components/BookOpen.d.ts +3 -0
- package/dist/assets/icons/components/BookOpen.js +32 -0
- package/dist/assets/icons/components/DollarSign.d.ts +3 -0
- package/dist/assets/icons/components/DollarSign.js +30 -0
- package/dist/assets/icons/components/LightBulb.d.ts +3 -0
- package/dist/assets/icons/components/LightBulb.js +43 -0
- package/dist/assets/icons/components/index.d.ts +3 -0
- package/dist/assets/icons/components/index.js +114 -108
- package/dist/assets/icons/index.js +114 -108
- package/dist/components/Autocomplete/Autocomplete.js +41 -40
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +2 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +97 -79
- package/dist/components/ButtonGroup/ButtonGroup.types.d.ts +2 -0
- package/dist/components/ButtonGroup/ButtonGroup.variants.d.ts +5 -4
- package/dist/components/ButtonGroup/ButtonGroup.variants.js +33 -25
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +95 -246
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.types.d.ts +0 -2
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.d.ts +0 -4
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.js +9 -13
- package/dist/components/Checkbox/Checkbox.js +152 -144
- package/dist/components/Checkbox/Checkbox.types.d.ts +2 -0
- package/dist/components/Counter/Counter.js +43 -42
- package/dist/components/Counter/Counter.types.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +94 -93
- package/dist/components/DateRangePicker/DateRangePicker.types.d.ts +2 -0
- package/dist/components/DateRangePicker/components/CalendarPanel/components/IndependentModeCalendar/IndependentModeCalendar.js +1 -1
- package/dist/components/DateRangePicker/components/CalendarPanel/components/TogetherModeCalendar/TogetherModeCalendar.js +1 -1
- package/dist/components/ImageUpload/ImageUpload.d.ts +1 -1
- package/dist/components/ImageUpload/ImageUpload.js +51 -50
- package/dist/components/ImageUpload/ImageUpload.types.d.ts +2 -0
- package/dist/components/Input/Input.js +72 -58
- package/dist/components/Input/Input.types.d.ts +4 -0
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.types.d.ts +2 -0
- package/dist/components/MultiSelectDropdown/components/Wrapper/Wrapper.js +40 -39
- package/dist/components/PhoneNumberInput/PhoneNumberInput.types.d.ts +2 -0
- package/dist/components/PhoneNumberInput/components/Wrapper.js +164 -163
- package/dist/components/PhoneNumberInput/contexts/phone-number.provider.js +172 -116
- package/dist/components/Range/Range.js +26 -24
- package/dist/components/Range/Range.types.d.ts +2 -0
- package/dist/components/Select/Select.types.d.ts +1 -0
- package/dist/components/Select/Select.variants.js +2 -1
- package/dist/components/Select/components/Wrapper.js +74 -73
- package/dist/components/Slider/Slider.js +30 -20
- package/dist/components/Slider/Slider.types.d.ts +2 -0
- package/dist/components/Switch/Switch.js +89 -87
- package/dist/components/Switch/Switch.types.d.ts +2 -0
- package/dist/components/TagSelect/TagSelect.types.d.ts +2 -0
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +47 -46
- package/dist/components/TextArea/TextArea.js +27 -26
- package/dist/components/TextArea/TextArea.types.d.ts +2 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +114 -108
- package/dist/package.json +17 -17
- package/dist/{proxy-i19-YB39.js → proxy-BhEKW5n7.js} +1903 -1757
- package/dist/styles.css +1 -1
- package/package.json +17 -17
|
@@ -32,6 +32,8 @@ export interface CounterProps extends VariantProps<typeof counterVariants> {
|
|
|
32
32
|
isRequired?: boolean;
|
|
33
33
|
/** Label displayed above the counter */
|
|
34
34
|
label?: string;
|
|
35
|
+
/** Additional CSS classes for the label wrapper */
|
|
36
|
+
labelWrapperClassName?: string;
|
|
35
37
|
/** Maximum allowed value */
|
|
36
38
|
max?: number;
|
|
37
39
|
/** Minimum allowed value */
|
|
@@ -1,84 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { cn as a } from "../../utils/index.js";
|
|
3
3
|
import { Typography as i } from "../Typography/Typography.js";
|
|
4
|
-
import { rightPanelVariants as
|
|
5
|
-
import { DateRangePickerProvider as
|
|
6
|
-
import { PresetPanel as
|
|
7
|
-
import { DateTimeInputs as
|
|
8
|
-
import { CalendarPanel as
|
|
9
|
-
const
|
|
4
|
+
import { rightPanelVariants as Q, dateRangePickerVariants as S } from "./DateRangePicker.variants.js";
|
|
5
|
+
import { DateRangePickerProvider as U } from "./contexts/date-range-picker.provider.js";
|
|
6
|
+
import { PresetPanel as W } from "./components/PresetPanel/PresetPanel.js";
|
|
7
|
+
import { DateTimeInputs as X } from "./components/DateTimeInputs/DateTimeInputs.js";
|
|
8
|
+
import { CalendarPanel as Y } from "./components/CalendarPanel/CalendarPanel.js";
|
|
9
|
+
const Z = ({
|
|
10
10
|
animationDuration: o = 500,
|
|
11
11
|
className: m,
|
|
12
12
|
defaultPreset: l = "custom",
|
|
13
13
|
defaultRange: c,
|
|
14
|
-
defaultTime:
|
|
15
|
-
disabled:
|
|
14
|
+
defaultTime: s,
|
|
15
|
+
disabled: p = !1,
|
|
16
16
|
isRequired: d,
|
|
17
17
|
label: n,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
labelWrapperClassName: f,
|
|
19
|
+
name: g,
|
|
20
|
+
showTime: P = !0,
|
|
21
|
+
theme: h,
|
|
21
22
|
timeFormat: x = "24",
|
|
22
|
-
blockedDays:
|
|
23
|
-
blockedMonths:
|
|
24
|
-
minDate:
|
|
25
|
-
maxDate:
|
|
23
|
+
blockedDays: u,
|
|
24
|
+
blockedMonths: k,
|
|
25
|
+
minDate: v,
|
|
26
|
+
maxDate: N,
|
|
26
27
|
hideDisabledNavigation: D,
|
|
27
|
-
showOutsideDays:
|
|
28
|
-
navigationMode:
|
|
28
|
+
showOutsideDays: R,
|
|
29
|
+
navigationMode: y = "independent",
|
|
29
30
|
// CalendarPanel props
|
|
30
|
-
ariaLabelCalendar:
|
|
31
|
-
ariaLabelPrevMonth:
|
|
32
|
-
ariaLabelNextMonth:
|
|
33
|
-
ariaLabelPrevMonthStart:
|
|
34
|
-
ariaLabelNextMonthStart:
|
|
35
|
-
ariaLabelPrevMonthEnd:
|
|
36
|
-
ariaLabelNextMonthEnd:
|
|
31
|
+
ariaLabelCalendar: T,
|
|
32
|
+
ariaLabelPrevMonth: j,
|
|
33
|
+
ariaLabelNextMonth: I,
|
|
34
|
+
ariaLabelPrevMonthStart: V,
|
|
35
|
+
ariaLabelNextMonthStart: b,
|
|
36
|
+
ariaLabelPrevMonthEnd: C,
|
|
37
|
+
ariaLabelNextMonthEnd: K,
|
|
37
38
|
// DateTimeInputs props
|
|
38
|
-
labelStartDate:
|
|
39
|
-
labelEndDate:
|
|
40
|
-
labelTime:
|
|
41
|
-
ariaLabelStartDate:
|
|
42
|
-
ariaLabelEndDate:
|
|
43
|
-
errorInvalidDate:
|
|
44
|
-
errorDateNotAvailable:
|
|
39
|
+
labelStartDate: L,
|
|
40
|
+
labelEndDate: q,
|
|
41
|
+
labelTime: w,
|
|
42
|
+
ariaLabelStartDate: z,
|
|
43
|
+
ariaLabelEndDate: A,
|
|
44
|
+
errorInvalidDate: B,
|
|
45
|
+
errorDateNotAvailable: E,
|
|
45
46
|
// PresetPanel props
|
|
46
|
-
showPresets:
|
|
47
|
-
labelTimePeriod:
|
|
48
|
-
ariaLabelTimePeriod:
|
|
49
|
-
presetLabels:
|
|
47
|
+
showPresets: F = !0,
|
|
48
|
+
labelTimePeriod: G,
|
|
49
|
+
ariaLabelTimePeriod: H,
|
|
50
|
+
presetLabels: J,
|
|
50
51
|
// Customizable class names
|
|
51
|
-
classNames:
|
|
52
|
+
classNames: r,
|
|
52
53
|
// Callbacks
|
|
53
|
-
onRangeChange:
|
|
54
|
-
onDateChange:
|
|
55
|
-
}) => /* @__PURE__ */
|
|
56
|
-
|
|
54
|
+
onRangeChange: M,
|
|
55
|
+
onDateChange: O
|
|
56
|
+
}) => /* @__PURE__ */ e(
|
|
57
|
+
U,
|
|
57
58
|
{
|
|
58
59
|
defaultRange: c,
|
|
59
|
-
defaultTime:
|
|
60
|
+
defaultTime: s,
|
|
60
61
|
defaultPreset: l,
|
|
61
62
|
timeFormat: x,
|
|
62
|
-
showTime:
|
|
63
|
-
name:
|
|
64
|
-
disabled:
|
|
63
|
+
showTime: P,
|
|
64
|
+
name: g,
|
|
65
|
+
disabled: p,
|
|
65
66
|
animationDuration: o,
|
|
66
|
-
blockedDays:
|
|
67
|
-
blockedMonths:
|
|
68
|
-
minDate:
|
|
69
|
-
maxDate:
|
|
67
|
+
blockedDays: u,
|
|
68
|
+
blockedMonths: k,
|
|
69
|
+
minDate: v,
|
|
70
|
+
maxDate: N,
|
|
70
71
|
hideDisabledNavigation: D,
|
|
71
|
-
showOutsideDays:
|
|
72
|
-
navigationMode:
|
|
73
|
-
onRangeChange:
|
|
74
|
-
onDateChange:
|
|
75
|
-
children: /* @__PURE__ */
|
|
76
|
-
n ? /* @__PURE__ */ a(
|
|
72
|
+
showOutsideDays: R,
|
|
73
|
+
navigationMode: y,
|
|
74
|
+
onRangeChange: M,
|
|
75
|
+
onDateChange: O,
|
|
76
|
+
children: /* @__PURE__ */ t("div", { className: "flex flex-col gap-2", "data-theme": h, children: [
|
|
77
|
+
n ? /* @__PURE__ */ e("div", { className: a(f), children: /* @__PURE__ */ t(
|
|
77
78
|
i,
|
|
78
79
|
{
|
|
79
80
|
component: "label",
|
|
80
81
|
variant: "labelLarge",
|
|
81
|
-
className:
|
|
82
|
+
className: a(
|
|
82
83
|
"cursor-pointer",
|
|
83
84
|
"flex",
|
|
84
85
|
"gap-1",
|
|
@@ -87,11 +88,11 @@ const Y = ({
|
|
|
87
88
|
),
|
|
88
89
|
children: [
|
|
89
90
|
n,
|
|
90
|
-
d && /* @__PURE__ */
|
|
91
|
+
d && /* @__PURE__ */ e(
|
|
91
92
|
i,
|
|
92
93
|
{
|
|
93
94
|
component: "span",
|
|
94
|
-
className:
|
|
95
|
+
className: a(
|
|
95
96
|
"text-red-600",
|
|
96
97
|
"dark:text-red-500",
|
|
97
98
|
"text-xs",
|
|
@@ -102,52 +103,52 @@ const Y = ({
|
|
|
102
103
|
)
|
|
103
104
|
]
|
|
104
105
|
}
|
|
105
|
-
) : null,
|
|
106
|
-
/* @__PURE__ */
|
|
106
|
+
) }) : null,
|
|
107
|
+
/* @__PURE__ */ t(
|
|
107
108
|
"div",
|
|
108
109
|
{
|
|
109
|
-
className:
|
|
110
|
-
|
|
110
|
+
className: a(
|
|
111
|
+
S({ className: m }),
|
|
111
112
|
"gap-4",
|
|
112
|
-
|
|
113
|
+
r?.container
|
|
113
114
|
),
|
|
114
115
|
role: "group",
|
|
115
116
|
"aria-label": n || "Date range picker",
|
|
116
117
|
children: [
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
F && /* @__PURE__ */ e(
|
|
119
|
+
W,
|
|
119
120
|
{
|
|
120
|
-
labelTimePeriod:
|
|
121
|
-
ariaLabelTimePeriod:
|
|
122
|
-
presetLabels:
|
|
123
|
-
classNames:
|
|
121
|
+
labelTimePeriod: G,
|
|
122
|
+
ariaLabelTimePeriod: H,
|
|
123
|
+
presetLabels: J,
|
|
124
|
+
classNames: r?.presetPanel
|
|
124
125
|
}
|
|
125
126
|
),
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
|
|
127
|
+
/* @__PURE__ */ t("div", { className: a(Q(), r?.rightPanel), children: [
|
|
128
|
+
/* @__PURE__ */ e(
|
|
129
|
+
X,
|
|
129
130
|
{
|
|
130
|
-
labelStartDate:
|
|
131
|
-
labelEndDate:
|
|
132
|
-
labelTime:
|
|
133
|
-
ariaLabelStartDate:
|
|
134
|
-
ariaLabelEndDate:
|
|
135
|
-
errorInvalidDate:
|
|
136
|
-
errorDateNotAvailable:
|
|
137
|
-
classNames:
|
|
131
|
+
labelStartDate: L,
|
|
132
|
+
labelEndDate: q,
|
|
133
|
+
labelTime: w,
|
|
134
|
+
ariaLabelStartDate: z,
|
|
135
|
+
ariaLabelEndDate: A,
|
|
136
|
+
errorInvalidDate: B,
|
|
137
|
+
errorDateNotAvailable: E,
|
|
138
|
+
classNames: r?.dateTimeInputs
|
|
138
139
|
}
|
|
139
140
|
),
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
|
|
141
|
+
/* @__PURE__ */ e(
|
|
142
|
+
Y,
|
|
142
143
|
{
|
|
143
|
-
ariaLabelCalendar:
|
|
144
|
-
ariaLabelPrevMonth:
|
|
145
|
-
ariaLabelNextMonth:
|
|
146
|
-
ariaLabelPrevMonthStart:
|
|
147
|
-
ariaLabelNextMonthStart:
|
|
148
|
-
ariaLabelPrevMonthEnd:
|
|
149
|
-
ariaLabelNextMonthEnd:
|
|
150
|
-
classNames:
|
|
144
|
+
ariaLabelCalendar: T,
|
|
145
|
+
ariaLabelPrevMonth: j,
|
|
146
|
+
ariaLabelNextMonth: I,
|
|
147
|
+
ariaLabelPrevMonthStart: V,
|
|
148
|
+
ariaLabelNextMonthStart: b,
|
|
149
|
+
ariaLabelPrevMonthEnd: C,
|
|
150
|
+
ariaLabelNextMonthEnd: K,
|
|
151
|
+
classNames: r?.calendarPanel
|
|
151
152
|
}
|
|
152
153
|
)
|
|
153
154
|
] })
|
|
@@ -157,7 +158,7 @@ const Y = ({
|
|
|
157
158
|
] })
|
|
158
159
|
}
|
|
159
160
|
);
|
|
160
|
-
|
|
161
|
+
Z.displayName = "KonstructDateRangePicker";
|
|
161
162
|
export {
|
|
162
|
-
|
|
163
|
+
Z as DateRangePicker
|
|
163
164
|
};
|
|
@@ -41,6 +41,8 @@ export type DateRangePickerProps = VariantProps<typeof dateRangePickerVariants>
|
|
|
41
41
|
name?: string;
|
|
42
42
|
/** Label for the component */
|
|
43
43
|
label?: string;
|
|
44
|
+
/** Additional CSS classes for the label wrapper */
|
|
45
|
+
labelWrapperClassName?: string;
|
|
44
46
|
/** Whether the field is required */
|
|
45
47
|
isRequired?: boolean;
|
|
46
48
|
/** Animation duration in milliseconds for month transitions (default: 400) */
|
|
@@ -7,7 +7,7 @@ import { CalendarDivider as tt } from "../CalendarDivider/CalendarDivider.js";
|
|
|
7
7
|
import { CalendarMonth as d } from "../CalendarMonth/CalendarMonth.js";
|
|
8
8
|
import { NavigationButton as g } from "../NavigationButton/NavigationButton.js";
|
|
9
9
|
import { useIndependentCarousel as nt } from "../../hooks/useIndependentCarousel.js";
|
|
10
|
-
import { m as et } from "../../../../../../proxy-
|
|
10
|
+
import { m as et } from "../../../../../../proxy-BhEKW5n7.js";
|
|
11
11
|
const at = ({
|
|
12
12
|
className: b,
|
|
13
13
|
calendarWidth: x = 550,
|
|
@@ -6,7 +6,7 @@ import { CalendarDivider as F } from "../CalendarDivider/CalendarDivider.js";
|
|
|
6
6
|
import { CalendarMonth as G } from "../CalendarMonth/CalendarMonth.js";
|
|
7
7
|
import { NavigationButton as m } from "../NavigationButton/NavigationButton.js";
|
|
8
8
|
import { useTogetherCarousel as H } from "../../hooks/useTogetherCarousel.js";
|
|
9
|
-
import { m as R } from "../../../../../../proxy-
|
|
9
|
+
import { m as R } from "../../../../../../proxy-BhEKW5n7.js";
|
|
10
10
|
const S = ({
|
|
11
11
|
className: s,
|
|
12
12
|
calendarWidth: h = 550,
|
|
@@ -19,7 +19,7 @@ import { ImageUploadProps } from './ImageUpload.types';
|
|
|
19
19
|
* @see {@link https://konstructio.github.io/konstruct-ui/?path=/docs/components-imageupload--docs Storybook}
|
|
20
20
|
*/
|
|
21
21
|
declare const ImageUpload: {
|
|
22
|
-
({ className, error, fileName, fileSize, fileUrl, helperText, isRequired, label, labelClassName, name, onChange, onRemove, status, theme, uploadButtonText, accept, maxSize, }: ImageUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
({ className, error, fileName, fileSize, fileUrl, helperText, isRequired, label, labelClassName, labelWrapperClassName, name, onChange, onRemove, status, theme, uploadButtonText, accept, maxSize, }: ImageUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
displayName: string;
|
|
24
24
|
};
|
|
25
25
|
export { ImageUpload };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import { useId as
|
|
2
|
+
import { useId as te, useRef as D, useState as g, useEffect as ae } from "react";
|
|
3
3
|
import { Button as F } from "../Button/Button.js";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { labelVariants as
|
|
6
|
-
import { LoaderIcon as
|
|
4
|
+
import { cn as c } from "../../utils/index.js";
|
|
5
|
+
import { labelVariants as re, inputFieldVariants as le, inputContainerVariants as ie, helperTextVariants as se, imageUploadVariants as ne } from "./ImageUpload.variants.js";
|
|
6
|
+
import { LoaderIcon as ce } from "../../assets/icons/components/Loader.js";
|
|
7
7
|
import { PhotoLibraryIcon as oe } from "../../assets/icons/components/PhotoLibrary.js";
|
|
8
|
-
import { WarningIcon as
|
|
8
|
+
import { WarningIcon as de } from "../../assets/icons/components/Warning.js";
|
|
9
9
|
import { X as P } from "../../x-B9bYxG31.js";
|
|
10
10
|
var t = /* @__PURE__ */ ((s) => (s.Default = "default", s.Uploading = "uploading", s.Complete = "complete", s.Error = "error", s))(t || {});
|
|
11
|
-
const
|
|
11
|
+
const me = ({
|
|
12
12
|
className: s,
|
|
13
13
|
error: b,
|
|
14
14
|
fileName: T,
|
|
@@ -18,37 +18,38 @@ const de = ({
|
|
|
18
18
|
isRequired: S = !1,
|
|
19
19
|
label: p = "Item logo",
|
|
20
20
|
labelClassName: L,
|
|
21
|
-
|
|
21
|
+
labelWrapperClassName: A,
|
|
22
|
+
name: H,
|
|
22
23
|
onChange: N,
|
|
23
|
-
onRemove:
|
|
24
|
+
onRemove: J,
|
|
24
25
|
status: k = t.Default,
|
|
25
26
|
theme: u,
|
|
26
|
-
uploadButtonText:
|
|
27
|
+
uploadButtonText: K = "Upload logo",
|
|
27
28
|
accept: M = "image/svg+xml,image/png,image/jpeg,image/jpg",
|
|
28
|
-
maxSize:
|
|
29
|
+
maxSize: W = 5 * 1024 * 1024
|
|
29
30
|
}) => {
|
|
30
|
-
const U =
|
|
31
|
-
|
|
31
|
+
const U = te(), f = D(null), n = D(null), [$, o] = g(k), [X, B] = g(E), [q, C] = g(T), [O, G] = g(z);
|
|
32
|
+
ae(() => () => {
|
|
32
33
|
n.current && clearTimeout(n.current);
|
|
33
34
|
}, []);
|
|
34
|
-
const a = k !== t.Default ? k :
|
|
35
|
+
const a = k !== t.Default ? k : $, v = E ?? X, d = T ?? q, h = z ?? O, x = !!b || a === t.Error, Q = (i) => {
|
|
35
36
|
const r = i.target.files?.[0];
|
|
36
37
|
if (!r) return;
|
|
37
|
-
if (!M.split(",").map((
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
return r.type.startsWith(
|
|
38
|
+
if (!M.split(",").map((m) => m.trim()).some((m) => {
|
|
39
|
+
if (m.includes("*")) {
|
|
40
|
+
const ee = m.split("/")[0];
|
|
41
|
+
return r.type.startsWith(ee);
|
|
41
42
|
}
|
|
42
|
-
return r.type ===
|
|
43
|
+
return r.type === m;
|
|
43
44
|
})) {
|
|
44
45
|
o(t.Error), N?.(i);
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
|
-
if (r.size >
|
|
48
|
+
if (r.size > W) {
|
|
48
49
|
o(t.Error), N?.(i);
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
|
-
o(t.Uploading), C(r.name), G(
|
|
52
|
+
o(t.Uploading), C(r.name), G(Z(r.size));
|
|
52
53
|
const y = new FileReader();
|
|
53
54
|
y.onloadend = () => {
|
|
54
55
|
B(y.result), n.current = setTimeout(() => {
|
|
@@ -56,31 +57,31 @@ const de = ({
|
|
|
56
57
|
}, 500);
|
|
57
58
|
}, y.readAsDataURL(r), N?.(i);
|
|
58
59
|
}, I = () => {
|
|
59
|
-
n.current && (clearTimeout(n.current), n.current = null), B(void 0), C(void 0), G(void 0), o(t.Default), f.current && (f.current.value = ""),
|
|
60
|
-
},
|
|
60
|
+
n.current && (clearTimeout(n.current), n.current = null), B(void 0), C(void 0), G(void 0), o(t.Default), f.current && (f.current.value = ""), J?.();
|
|
61
|
+
}, Y = () => {
|
|
61
62
|
f.current?.click();
|
|
62
|
-
},
|
|
63
|
+
}, Z = (i) => {
|
|
63
64
|
if (i === 0) return "0 Bytes";
|
|
64
65
|
const r = 1024, V = ["Bytes", "KB", "MB", "GB"], w = Math.floor(Math.log(i) / Math.log(r));
|
|
65
66
|
return `${parseFloat((i / Math.pow(r, w)).toFixed(2))}${V[w]}`;
|
|
66
|
-
},
|
|
67
|
+
}, _ = 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.");
|
|
67
68
|
return /* @__PURE__ */ l(
|
|
68
69
|
"div",
|
|
69
70
|
{
|
|
70
|
-
className:
|
|
71
|
-
|
|
71
|
+
className: c(
|
|
72
|
+
ne({
|
|
72
73
|
status: a,
|
|
73
74
|
className: s
|
|
74
75
|
})
|
|
75
76
|
),
|
|
76
77
|
"data-theme": u,
|
|
77
78
|
children: [
|
|
78
|
-
p && /* @__PURE__ */ l(
|
|
79
|
+
p && /* @__PURE__ */ e("div", { className: c(A), children: /* @__PURE__ */ l(
|
|
79
80
|
"label",
|
|
80
81
|
{
|
|
81
82
|
htmlFor: U,
|
|
82
|
-
className:
|
|
83
|
-
|
|
83
|
+
className: c(
|
|
84
|
+
re({
|
|
84
85
|
className: L
|
|
85
86
|
}),
|
|
86
87
|
"cursor-pointer"
|
|
@@ -90,12 +91,12 @@ const de = ({
|
|
|
90
91
|
S && /* @__PURE__ */ e("span", { className: "text-red-600 dark:text-red-500 text-xs mt-0.5", children: "*" })
|
|
91
92
|
]
|
|
92
93
|
}
|
|
93
|
-
),
|
|
94
|
+
) }),
|
|
94
95
|
/* @__PURE__ */ l(
|
|
95
96
|
"div",
|
|
96
97
|
{
|
|
97
|
-
className:
|
|
98
|
-
|
|
98
|
+
className: c(
|
|
99
|
+
ie({
|
|
99
100
|
status: a
|
|
100
101
|
})
|
|
101
102
|
),
|
|
@@ -103,8 +104,8 @@ const de = ({
|
|
|
103
104
|
/* @__PURE__ */ l(
|
|
104
105
|
"div",
|
|
105
106
|
{
|
|
106
|
-
className:
|
|
107
|
-
|
|
107
|
+
className: c(
|
|
108
|
+
le({
|
|
108
109
|
status: a
|
|
109
110
|
}),
|
|
110
111
|
{
|
|
@@ -115,14 +116,14 @@ const de = ({
|
|
|
115
116
|
children: [
|
|
116
117
|
a === t.Uploading && /* @__PURE__ */ l(j, { children: [
|
|
117
118
|
/* @__PURE__ */ e(
|
|
118
|
-
|
|
119
|
+
ce,
|
|
119
120
|
{
|
|
120
121
|
size: 20,
|
|
121
122
|
className: "shrink-0 animate-spin text-metal-400"
|
|
122
123
|
}
|
|
123
124
|
),
|
|
124
|
-
|
|
125
|
-
/* @__PURE__ */ e("p", { className: "text-sm leading-5 truncate w-full text-slate-800 dark:text-metal-50", children:
|
|
125
|
+
d && /* @__PURE__ */ l("div", { className: "flex flex-col items-start min-w-0 flex-1", children: [
|
|
126
|
+
/* @__PURE__ */ e("p", { className: "text-sm leading-5 truncate w-full text-slate-800 dark:text-metal-50", children: d }),
|
|
126
127
|
h && /* @__PURE__ */ e("p", { className: "text-xs leading-4 text-slate-600 dark:text-metal-300 tracking-[0.15px]", children: h })
|
|
127
128
|
] })
|
|
128
129
|
] }),
|
|
@@ -131,17 +132,17 @@ const de = ({
|
|
|
131
132
|
"img",
|
|
132
133
|
{
|
|
133
134
|
src: v,
|
|
134
|
-
alt:
|
|
135
|
+
alt: d || "Uploaded image",
|
|
135
136
|
className: "w-full h-full object-contain"
|
|
136
137
|
}
|
|
137
138
|
) }),
|
|
138
|
-
|
|
139
|
-
/* @__PURE__ */ e("p", { className: "text-sm leading-5 truncate w-full text-slate-800 dark:text-slate-50 kubefirst-dark:text-slate-50", children:
|
|
139
|
+
d && /* @__PURE__ */ l("div", { className: "flex flex-col items-start min-w-0 flex-1", children: [
|
|
140
|
+
/* @__PURE__ */ e("p", { className: "text-sm leading-5 truncate w-full text-slate-800 dark:text-slate-50 kubefirst-dark:text-slate-50", children: d }),
|
|
140
141
|
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 })
|
|
141
142
|
] })
|
|
142
143
|
] }),
|
|
143
144
|
(a === t.Default || a === t.Error && !v) && /* @__PURE__ */ e("div", { className: "w-8 h-8 shrink-0 flex items-center justify-center", children: /* @__PURE__ */ e(oe, { className: "w-8 h-8 text-slate-400 dark:text-slate-500 kubefirst-dark:text-slate-500" }) }),
|
|
144
|
-
x && /* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(
|
|
145
|
+
x && /* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(de, { className: "w-5 h-5 text-red-700 dark:text-red-500 kubefirst-dark:text-red-500" }) })
|
|
145
146
|
]
|
|
146
147
|
}
|
|
147
148
|
),
|
|
@@ -149,10 +150,10 @@ const de = ({
|
|
|
149
150
|
F,
|
|
150
151
|
{
|
|
151
152
|
variant: "secondary",
|
|
152
|
-
onClick:
|
|
153
|
+
onClick: Y,
|
|
153
154
|
theme: u,
|
|
154
155
|
className: "h-10 px-4 py-2 shrink-0",
|
|
155
|
-
children:
|
|
156
|
+
children: K
|
|
156
157
|
}
|
|
157
158
|
),
|
|
158
159
|
a === t.Uploading && /* @__PURE__ */ e(
|
|
@@ -188,12 +189,12 @@ const de = ({
|
|
|
188
189
|
/* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ e(
|
|
189
190
|
"p",
|
|
190
191
|
{
|
|
191
|
-
className:
|
|
192
|
-
|
|
192
|
+
className: c(
|
|
193
|
+
se({
|
|
193
194
|
status: a
|
|
194
195
|
})
|
|
195
196
|
),
|
|
196
|
-
children:
|
|
197
|
+
children: _
|
|
197
198
|
}
|
|
198
199
|
) }),
|
|
199
200
|
(a === t.Default || a === t.Error) && /* @__PURE__ */ e("div", { className: "shrink-0 w-29" }),
|
|
@@ -205,9 +206,9 @@ const de = ({
|
|
|
205
206
|
ref: f,
|
|
206
207
|
id: U,
|
|
207
208
|
type: "file",
|
|
208
|
-
name:
|
|
209
|
+
name: H,
|
|
209
210
|
accept: M,
|
|
210
|
-
onChange:
|
|
211
|
+
onChange: Q,
|
|
211
212
|
className: "hidden",
|
|
212
213
|
"aria-label": typeof p == "string" ? p : "File upload"
|
|
213
214
|
}
|
|
@@ -216,7 +217,7 @@ const de = ({
|
|
|
216
217
|
}
|
|
217
218
|
);
|
|
218
219
|
};
|
|
219
|
-
|
|
220
|
+
me.displayName = "KonstructImageUpload";
|
|
220
221
|
export {
|
|
221
|
-
|
|
222
|
+
me as ImageUpload
|
|
222
223
|
};
|
|
@@ -48,6 +48,8 @@ export interface ImageUploadProps extends Omit<VariantProps<typeof imageUploadVa
|
|
|
48
48
|
label?: string | ReactNode;
|
|
49
49
|
/** Additional CSS classes for the label */
|
|
50
50
|
labelClassName?: string;
|
|
51
|
+
/** Additional CSS classes for the label wrapper */
|
|
52
|
+
labelWrapperClassName?: string;
|
|
51
53
|
/** Form field name */
|
|
52
54
|
name?: string;
|
|
53
55
|
/** Callback fired when a file is selected */
|