@prodivix/ui 0.1.0
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/LICENSE +21 -0
- package/dist/button/PdxButton.js +70 -0
- package/dist/button/PdxButtonLink.js +11 -0
- package/dist/container/PdxCard.js +32 -0
- package/dist/container/PdxDiv.js +80 -0
- package/dist/container/PdxPanel.js +71 -0
- package/dist/container/PdxSection.js +30 -0
- package/dist/data/PdxBadge.js +40 -0
- package/dist/data/PdxCheckList.js +58 -0
- package/dist/data/PdxDataGrid.js +70 -0
- package/dist/data/PdxList.js +35 -0
- package/dist/data/PdxProgress.js +38 -0
- package/dist/data/PdxSpinner.js +36 -0
- package/dist/data/PdxStatistic.js +40 -0
- package/dist/data/PdxSteps.js +37 -0
- package/dist/data/PdxTable.js +61 -0
- package/dist/data/PdxTag.js +36 -0
- package/dist/data/PdxTimeline.js +32 -0
- package/dist/data/PdxTree.js +71 -0
- package/dist/data/PdxTreeSelect.js +69 -0
- package/dist/embed/PdxEmbed.js +109 -0
- package/dist/embed/PdxIframe.js +76 -0
- package/dist/feedback/PdxDrawer.js +45 -0
- package/dist/feedback/PdxEmpty.js +33 -0
- package/dist/feedback/PdxMessage.js +32 -0
- package/dist/feedback/PdxModal.js +49 -0
- package/dist/feedback/PdxNotification.js +46 -0
- package/dist/feedback/PdxPopover.js +59 -0
- package/dist/feedback/PdxSkeleton.js +23 -0
- package/dist/feedback/PdxTooltip.js +30 -0
- package/dist/form/PdxColorPicker.js +75 -0
- package/dist/form/PdxDatePicker.js +89 -0
- package/dist/form/PdxDateRangePicker.js +90 -0
- package/dist/form/PdxFileUpload.js +108 -0
- package/dist/form/PdxImageUpload.js +87 -0
- package/dist/form/PdxPasswordStrength.js +73 -0
- package/dist/form/PdxRadioGroup.js +71 -0
- package/dist/form/PdxRange.js +95 -0
- package/dist/form/PdxRating.js +62 -0
- package/dist/form/PdxRegexInput.js +76 -0
- package/dist/form/PdxRegionPicker.js +121 -0
- package/dist/form/PdxRichTextEditor.js +177 -0
- package/dist/form/PdxSelect.js +69 -0
- package/dist/form/PdxSlider.js +64 -0
- package/dist/form/PdxTimePicker.js +89 -0
- package/dist/form/PdxVerificationCode.js +90 -0
- package/dist/icon/PdxIcon.js +73 -0
- package/dist/icon/PdxIconLink.js +13 -0
- package/dist/image/PdxAvatar.js +38 -0
- package/dist/image/PdxImage.js +39 -0
- package/dist/image/PdxImageGallery.js +77 -0
- package/dist/index.js +142 -0
- package/dist/input/PdxInput.js +75 -0
- package/dist/input/PdxSearch.js +89 -0
- package/dist/input/PdxTextarea.js +72 -0
- package/dist/link/PdxLink.js +34 -0
- package/dist/nav/PdxAnchorNavigation.js +37 -0
- package/dist/nav/PdxBreadcrumb.js +30 -0
- package/dist/nav/PdxCollapse.js +64 -0
- package/dist/nav/PdxNav.js +48 -0
- package/dist/nav/PdxNavbar.js +43 -0
- package/dist/nav/PdxOutlet.js +26 -0
- package/dist/nav/PdxPagination.js +66 -0
- package/dist/nav/PdxRoute.js +119 -0
- package/dist/nav/PdxSidebar.js +45 -0
- package/dist/nav/PdxTabs.js +49 -0
- package/dist/style.css +1 -0
- package/dist/text/PdxHeading.js +21 -0
- package/dist/text/PdxKbd.js +42 -0
- package/dist/text/PdxParagraph.js +21 -0
- package/dist/text/PdxText.js +22 -0
- package/dist/video/PdxAudio.js +57 -0
- package/dist/video/PdxVideo.js +84 -0
- package/package.json +67 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import "@prodivix/shared";
|
|
4
|
+
import { useState as I, useId as L, useEffect as V } from "react";
|
|
5
|
+
function y({
|
|
6
|
+
label: s,
|
|
7
|
+
description: l,
|
|
8
|
+
message: r,
|
|
9
|
+
options: m,
|
|
10
|
+
value: d,
|
|
11
|
+
defaultValue: u,
|
|
12
|
+
name: p,
|
|
13
|
+
layout: x = "Vertical",
|
|
14
|
+
disabled: c = !1,
|
|
15
|
+
onChange: n,
|
|
16
|
+
className: h,
|
|
17
|
+
style: N,
|
|
18
|
+
id: P,
|
|
19
|
+
dataAttributes: f = {}
|
|
20
|
+
}) {
|
|
21
|
+
const [b, o] = I(u || ""), v = L();
|
|
22
|
+
V(() => {
|
|
23
|
+
d !== void 0 && o(d);
|
|
24
|
+
}, [d]);
|
|
25
|
+
const G = d !== void 0 ? d : b, R = p || `prodivix-radio-${v}`, $ = (e) => {
|
|
26
|
+
d === void 0 && o(e), n && n(e);
|
|
27
|
+
}, D = `PdxRadioGroup ${x} ${c ? "Disabled" : ""} ${h || ""}`.trim(), F = { ...f };
|
|
28
|
+
return /* @__PURE__ */ i(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: `PdxField ${D}`,
|
|
32
|
+
style: N,
|
|
33
|
+
id: P,
|
|
34
|
+
...F,
|
|
35
|
+
children: [
|
|
36
|
+
s && /* @__PURE__ */ a("div", { className: "PdxFieldHeader", children: /* @__PURE__ */ a("label", { className: "PdxFieldLabel", children: s }) }),
|
|
37
|
+
l && /* @__PURE__ */ a("div", { className: "PdxFieldDescription", children: l }),
|
|
38
|
+
/* @__PURE__ */ a("ul", { className: "PdxRadioGroupList", children: m.map((e) => {
|
|
39
|
+
const t = c || e.disabled;
|
|
40
|
+
return /* @__PURE__ */ a("li", { className: "PdxRadioGroupItem", children: /* @__PURE__ */ i(
|
|
41
|
+
"label",
|
|
42
|
+
{
|
|
43
|
+
className: `PdxRadioGroupLabel ${t ? "Disabled" : ""}`,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ a(
|
|
46
|
+
"input",
|
|
47
|
+
{
|
|
48
|
+
type: "radio",
|
|
49
|
+
name: R,
|
|
50
|
+
value: e.value,
|
|
51
|
+
checked: G === e.value,
|
|
52
|
+
disabled: t,
|
|
53
|
+
onChange: () => $(e.value)
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ i("span", { className: "PdxRadioGroupText", children: [
|
|
57
|
+
/* @__PURE__ */ a("span", { children: e.label }),
|
|
58
|
+
e.description && /* @__PURE__ */ a("span", { className: "PdxRadioGroupDescription", children: e.description })
|
|
59
|
+
] })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
) }, e.value);
|
|
63
|
+
}) }),
|
|
64
|
+
r && /* @__PURE__ */ a("div", { className: "PdxFieldMessage", children: r })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
y as default
|
|
71
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsxs as l, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import "@prodivix/shared";
|
|
4
|
+
import { useState as b, useEffect as j, useMemo as k } from "react";
|
|
5
|
+
function L({
|
|
6
|
+
label: d,
|
|
7
|
+
description: m,
|
|
8
|
+
message: o,
|
|
9
|
+
min: n = 0,
|
|
10
|
+
max: s = 100,
|
|
11
|
+
step: x = 1,
|
|
12
|
+
value: t,
|
|
13
|
+
defaultValue: P,
|
|
14
|
+
disabled: i = !1,
|
|
15
|
+
showValue: p = !0,
|
|
16
|
+
onChange: u,
|
|
17
|
+
className: N,
|
|
18
|
+
style: f,
|
|
19
|
+
id: M,
|
|
20
|
+
dataAttributes: R = {}
|
|
21
|
+
}) {
|
|
22
|
+
const [F, g] = b(
|
|
23
|
+
P || { min: n, max: s }
|
|
24
|
+
);
|
|
25
|
+
j(() => {
|
|
26
|
+
t && g(t);
|
|
27
|
+
}, [t?.min, t?.max]);
|
|
28
|
+
const e = t || F, h = (a) => {
|
|
29
|
+
t || g(a), u && u(a);
|
|
30
|
+
}, $ = (a) => {
|
|
31
|
+
const r = Math.min(Number(a.target.value), e.max);
|
|
32
|
+
h({ min: r, max: e.max });
|
|
33
|
+
}, v = (a) => {
|
|
34
|
+
const r = Math.max(Number(a.target.value), e.min);
|
|
35
|
+
h({ min: e.min, max: r });
|
|
36
|
+
}, y = k(() => {
|
|
37
|
+
const a = s - n || 1, r = (e.min - n) / a * 100, I = (e.max - n) / a * 100;
|
|
38
|
+
return {
|
|
39
|
+
"--range-start": `${r}%`,
|
|
40
|
+
"--range-end": `${I}%`
|
|
41
|
+
};
|
|
42
|
+
}, [e.min, e.max, n, s]), C = `PdxRange ${i ? "Disabled" : ""} ${N || ""}`.trim(), V = { ...R };
|
|
43
|
+
return /* @__PURE__ */ l(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: `PdxField ${C}`,
|
|
47
|
+
style: f,
|
|
48
|
+
id: M,
|
|
49
|
+
...V,
|
|
50
|
+
children: [
|
|
51
|
+
d && /* @__PURE__ */ l("div", { className: "PdxFieldHeader", children: [
|
|
52
|
+
/* @__PURE__ */ c("label", { className: "PdxFieldLabel", children: d }),
|
|
53
|
+
p && /* @__PURE__ */ l("span", { className: "PdxRangeValue", children: [
|
|
54
|
+
e.min,
|
|
55
|
+
" - ",
|
|
56
|
+
e.max
|
|
57
|
+
] })
|
|
58
|
+
] }),
|
|
59
|
+
m && /* @__PURE__ */ c("div", { className: "PdxFieldDescription", children: m }),
|
|
60
|
+
/* @__PURE__ */ l("div", { className: "PdxRangeTrack", style: y, children: [
|
|
61
|
+
/* @__PURE__ */ c(
|
|
62
|
+
"input",
|
|
63
|
+
{
|
|
64
|
+
className: "PdxRangeInput",
|
|
65
|
+
type: "range",
|
|
66
|
+
min: n,
|
|
67
|
+
max: s,
|
|
68
|
+
step: x,
|
|
69
|
+
value: e.min,
|
|
70
|
+
disabled: i,
|
|
71
|
+
onChange: $
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ c(
|
|
75
|
+
"input",
|
|
76
|
+
{
|
|
77
|
+
className: "PdxRangeInput",
|
|
78
|
+
type: "range",
|
|
79
|
+
min: n,
|
|
80
|
+
max: s,
|
|
81
|
+
step: x,
|
|
82
|
+
value: e.max,
|
|
83
|
+
disabled: i,
|
|
84
|
+
onChange: v
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] }),
|
|
88
|
+
o && /* @__PURE__ */ c("div", { className: "PdxFieldMessage", children: o })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
L as default
|
|
95
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsxs as y, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import "@prodivix/shared";
|
|
4
|
+
import { Star as b } from "lucide-react";
|
|
5
|
+
import { useState as m, useEffect as j } from "react";
|
|
6
|
+
function k({
|
|
7
|
+
label: n,
|
|
8
|
+
description: r,
|
|
9
|
+
message: s,
|
|
10
|
+
value: t,
|
|
11
|
+
defaultValue: f = 0,
|
|
12
|
+
max: x = 5,
|
|
13
|
+
size: P = "Medium",
|
|
14
|
+
readOnly: h = !1,
|
|
15
|
+
disabled: i = !1,
|
|
16
|
+
onChange: d,
|
|
17
|
+
className: p,
|
|
18
|
+
style: N,
|
|
19
|
+
id: v,
|
|
20
|
+
dataAttributes: V = {}
|
|
21
|
+
}) {
|
|
22
|
+
const [g, o] = m(f), [c, u] = m(null);
|
|
23
|
+
j(() => {
|
|
24
|
+
t !== void 0 && o(t);
|
|
25
|
+
}, [t]);
|
|
26
|
+
const F = c !== null ? c : t !== void 0 ? t : g, R = (l) => {
|
|
27
|
+
h || i || (t === void 0 && o(l), d && d(l));
|
|
28
|
+
}, S = `PdxRating ${P} ${i ? "Disabled" : ""} ${p || ""}`.trim(), $ = { ...V };
|
|
29
|
+
return /* @__PURE__ */ y(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: `PdxField ${S}`,
|
|
33
|
+
style: N,
|
|
34
|
+
id: v,
|
|
35
|
+
...$,
|
|
36
|
+
children: [
|
|
37
|
+
n && /* @__PURE__ */ e("div", { className: "PdxFieldHeader", children: /* @__PURE__ */ e("label", { className: "PdxFieldLabel", children: n }) }),
|
|
38
|
+
r && /* @__PURE__ */ e("div", { className: "PdxFieldDescription", children: r }),
|
|
39
|
+
/* @__PURE__ */ e("div", { className: "PdxRatingStars", children: Array.from({ length: x }, (l, M) => {
|
|
40
|
+
const a = M + 1;
|
|
41
|
+
return /* @__PURE__ */ e(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
className: `PdxRatingStar ${F >= a ? "Active" : ""}`,
|
|
46
|
+
onClick: () => R(a),
|
|
47
|
+
onMouseEnter: () => u(a),
|
|
48
|
+
onMouseLeave: () => u(null),
|
|
49
|
+
disabled: i,
|
|
50
|
+
children: /* @__PURE__ */ e(b, { className: "PdxRatingIcon" })
|
|
51
|
+
},
|
|
52
|
+
a
|
|
53
|
+
);
|
|
54
|
+
}) }),
|
|
55
|
+
s && /* @__PURE__ */ e("div", { className: "PdxFieldMessage", children: s })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
k as default
|
|
62
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs as P, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import "@prodivix/shared";
|
|
4
|
+
import { useState as w, useEffect as y, useMemo as L } from "react";
|
|
5
|
+
function z({
|
|
6
|
+
label: o,
|
|
7
|
+
description: i,
|
|
8
|
+
message: v,
|
|
9
|
+
invalidMessage: N = "Invalid format",
|
|
10
|
+
validMessage: R = "Looks good",
|
|
11
|
+
pattern: s,
|
|
12
|
+
value: e,
|
|
13
|
+
defaultValue: F,
|
|
14
|
+
placeholder: $,
|
|
15
|
+
size: D = "Medium",
|
|
16
|
+
state: r = "Default",
|
|
17
|
+
disabled: d = !1,
|
|
18
|
+
required: c = !1,
|
|
19
|
+
onChange: u,
|
|
20
|
+
className: E,
|
|
21
|
+
style: I,
|
|
22
|
+
id: l,
|
|
23
|
+
dataAttributes: V = {}
|
|
24
|
+
}) {
|
|
25
|
+
const [M, f] = w(F || "");
|
|
26
|
+
y(() => {
|
|
27
|
+
e !== void 0 && f(e);
|
|
28
|
+
}, [e]);
|
|
29
|
+
const a = e !== void 0 ? e : M, x = L(() => {
|
|
30
|
+
try {
|
|
31
|
+
if (s instanceof RegExp) {
|
|
32
|
+
const n = s.flags.replace("g", "");
|
|
33
|
+
return new RegExp(s.source, n);
|
|
34
|
+
}
|
|
35
|
+
return new RegExp(s);
|
|
36
|
+
} catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}, [s]), m = x ? x.test(a) : !0, g = r !== "Default" ? r : a ? m ? "Success" : "Error" : "Default", C = (n) => {
|
|
40
|
+
const h = n.target.value;
|
|
41
|
+
e === void 0 && f(h), u && u(h);
|
|
42
|
+
}, S = `PdxRegexInput ${D} ${g} ${d ? "Disabled" : ""} ${E || ""}`.trim(), j = { ...V }, p = v || (a ? m ? R : N : void 0);
|
|
43
|
+
return /* @__PURE__ */ P(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: `PdxField ${S}`,
|
|
47
|
+
style: I,
|
|
48
|
+
id: l,
|
|
49
|
+
...j,
|
|
50
|
+
children: [
|
|
51
|
+
o && /* @__PURE__ */ P("div", { className: "PdxFieldHeader", children: [
|
|
52
|
+
/* @__PURE__ */ t("label", { className: "PdxFieldLabel", htmlFor: l, children: o }),
|
|
53
|
+
c && /* @__PURE__ */ t("span", { className: "PdxFieldRequired", children: "*" })
|
|
54
|
+
] }),
|
|
55
|
+
i && /* @__PURE__ */ t("div", { className: "PdxFieldDescription", children: i }),
|
|
56
|
+
/* @__PURE__ */ t(
|
|
57
|
+
"input",
|
|
58
|
+
{
|
|
59
|
+
className: "PdxRegexInputControl",
|
|
60
|
+
id: l,
|
|
61
|
+
type: "text",
|
|
62
|
+
placeholder: $,
|
|
63
|
+
value: a,
|
|
64
|
+
disabled: d,
|
|
65
|
+
required: c,
|
|
66
|
+
onChange: C
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
p && /* @__PURE__ */ t("div", { className: `PdxFieldMessage ${g}`, children: p })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
z as default
|
|
76
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsxs as l, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import "@prodivix/shared";
|
|
4
|
+
import { useState as q, useEffect as E } from "react";
|
|
5
|
+
const P = (s, r) => {
|
|
6
|
+
if (r)
|
|
7
|
+
return s.find((d) => d.value === r)?.label;
|
|
8
|
+
};
|
|
9
|
+
function G({
|
|
10
|
+
label: s,
|
|
11
|
+
description: r,
|
|
12
|
+
message: d,
|
|
13
|
+
size: y = "Medium",
|
|
14
|
+
state: m = "Default",
|
|
15
|
+
disabled: a = !1,
|
|
16
|
+
required: C = !1,
|
|
17
|
+
options: x,
|
|
18
|
+
value: t,
|
|
19
|
+
defaultValue: N,
|
|
20
|
+
placeholder: o,
|
|
21
|
+
onChange: p,
|
|
22
|
+
className: b,
|
|
23
|
+
style: R,
|
|
24
|
+
id: k,
|
|
25
|
+
dataAttributes: F = {}
|
|
26
|
+
}) {
|
|
27
|
+
const [$, f] = q(
|
|
28
|
+
N || {}
|
|
29
|
+
);
|
|
30
|
+
E(() => {
|
|
31
|
+
t && f(t);
|
|
32
|
+
}, [t?.province, t?.city, t?.district]);
|
|
33
|
+
const i = t || $, v = x, h = v.find(
|
|
34
|
+
(e) => e.value === i.province
|
|
35
|
+
)?.children || [], g = h.find((e) => e.value === i.city)?.children || [], u = (e) => {
|
|
36
|
+
const n = {
|
|
37
|
+
province: P(v, e.province),
|
|
38
|
+
city: P(h, e.city),
|
|
39
|
+
district: P(g, e.district)
|
|
40
|
+
};
|
|
41
|
+
t || f(e), p && p(e, n);
|
|
42
|
+
}, D = (e) => {
|
|
43
|
+
const n = e.target.value || void 0;
|
|
44
|
+
u({ province: n, city: void 0, district: void 0 });
|
|
45
|
+
}, S = (e) => {
|
|
46
|
+
const n = e.target.value || void 0;
|
|
47
|
+
u({
|
|
48
|
+
province: i.province,
|
|
49
|
+
city: n,
|
|
50
|
+
district: void 0
|
|
51
|
+
});
|
|
52
|
+
}, j = (e) => {
|
|
53
|
+
const n = e.target.value || void 0;
|
|
54
|
+
u({
|
|
55
|
+
province: i.province,
|
|
56
|
+
city: i.city,
|
|
57
|
+
district: n
|
|
58
|
+
});
|
|
59
|
+
}, L = `PdxRegionPicker ${y} ${m} ${a ? "Disabled" : ""} ${b || ""}`.trim(), M = { ...F };
|
|
60
|
+
return /* @__PURE__ */ l(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: `PdxField ${L}`,
|
|
64
|
+
style: R,
|
|
65
|
+
id: k,
|
|
66
|
+
...M,
|
|
67
|
+
children: [
|
|
68
|
+
s && /* @__PURE__ */ l("div", { className: "PdxFieldHeader", children: [
|
|
69
|
+
/* @__PURE__ */ c("label", { className: "PdxFieldLabel", children: s }),
|
|
70
|
+
C && /* @__PURE__ */ c("span", { className: "PdxFieldRequired", children: "*" })
|
|
71
|
+
] }),
|
|
72
|
+
r && /* @__PURE__ */ c("div", { className: "PdxFieldDescription", children: r }),
|
|
73
|
+
/* @__PURE__ */ l("div", { className: "PdxRegionPickerControls", children: [
|
|
74
|
+
/* @__PURE__ */ l(
|
|
75
|
+
"select",
|
|
76
|
+
{
|
|
77
|
+
className: "PdxRegionPickerSelect",
|
|
78
|
+
disabled: a,
|
|
79
|
+
value: i.province || "",
|
|
80
|
+
onChange: D,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ c("option", { value: "", children: o?.province || "Province" }),
|
|
83
|
+
v.map((e) => /* @__PURE__ */ c("option", { value: e.value, children: e.label }, e.value))
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ l(
|
|
88
|
+
"select",
|
|
89
|
+
{
|
|
90
|
+
className: "PdxRegionPickerSelect",
|
|
91
|
+
disabled: a || !i.province,
|
|
92
|
+
value: i.city || "",
|
|
93
|
+
onChange: S,
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ c("option", { value: "", children: o?.city || "City" }),
|
|
96
|
+
h.map((e) => /* @__PURE__ */ c("option", { value: e.value, children: e.label }, e.value))
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ l(
|
|
101
|
+
"select",
|
|
102
|
+
{
|
|
103
|
+
className: "PdxRegionPickerSelect",
|
|
104
|
+
disabled: a || !i.city,
|
|
105
|
+
value: i.district || "",
|
|
106
|
+
onChange: j,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ c("option", { value: "", children: o?.district || "District" }),
|
|
109
|
+
g.map((e) => /* @__PURE__ */ c("option", { value: e.value, children: e.label }, e.value))
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] }),
|
|
114
|
+
d && /* @__PURE__ */ c("div", { className: `PdxFieldMessage ${m}`, children: d })
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
G as default
|
|
121
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { jsxs as u, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import "@prodivix/shared";
|
|
4
|
+
import { Bold as M, Italic as $, Underline as q, List as A, ListOrdered as H, Link as V, Eraser as j } from "lucide-react";
|
|
5
|
+
import { useState as L, useRef as D, useEffect as m } from "react";
|
|
6
|
+
function X({
|
|
7
|
+
label: f,
|
|
8
|
+
description: b,
|
|
9
|
+
message: h,
|
|
10
|
+
value: l,
|
|
11
|
+
defaultValue: N,
|
|
12
|
+
placeholder: v = "Write something...",
|
|
13
|
+
disabled: t = !1,
|
|
14
|
+
readOnly: i = !1,
|
|
15
|
+
showToolbar: k = !0,
|
|
16
|
+
onChange: p,
|
|
17
|
+
className: P,
|
|
18
|
+
style: T,
|
|
19
|
+
id: E,
|
|
20
|
+
dataAttributes: R = {}
|
|
21
|
+
}) {
|
|
22
|
+
const [S, C] = L(N || ""), [d, U] = L({
|
|
23
|
+
bold: !1,
|
|
24
|
+
italic: !1,
|
|
25
|
+
underline: !1,
|
|
26
|
+
unorderedList: !1,
|
|
27
|
+
orderedList: !1
|
|
28
|
+
}), n = D(null);
|
|
29
|
+
m(() => {
|
|
30
|
+
l !== void 0 && C(l);
|
|
31
|
+
}, [l]);
|
|
32
|
+
const s = l !== void 0 ? l : S;
|
|
33
|
+
m(() => {
|
|
34
|
+
n.current && n.current.innerHTML !== s && (n.current.innerHTML = s);
|
|
35
|
+
}, [s]);
|
|
36
|
+
const x = () => {
|
|
37
|
+
const o = n.current?.innerHTML || "";
|
|
38
|
+
l === void 0 && C(o), p && p(o);
|
|
39
|
+
}, c = () => {
|
|
40
|
+
typeof document > "u" || U({
|
|
41
|
+
bold: document.queryCommandState("bold"),
|
|
42
|
+
italic: document.queryCommandState("italic"),
|
|
43
|
+
underline: document.queryCommandState("underline"),
|
|
44
|
+
unorderedList: document.queryCommandState("insertUnorderedList"),
|
|
45
|
+
orderedList: document.queryCommandState("insertOrderedList")
|
|
46
|
+
});
|
|
47
|
+
}, I = () => {
|
|
48
|
+
!n.current || t || i || n.current.focus();
|
|
49
|
+
}, r = (o, B) => {
|
|
50
|
+
t || i || typeof document > "u" || (I(), document.execCommand(o, !1, B), c(), x());
|
|
51
|
+
}, g = () => {
|
|
52
|
+
if (t || i) return;
|
|
53
|
+
const o = typeof window < "u" ? window.prompt("Enter URL") : void 0;
|
|
54
|
+
o && r("createLink", o);
|
|
55
|
+
};
|
|
56
|
+
m(() => {
|
|
57
|
+
c();
|
|
58
|
+
}, []);
|
|
59
|
+
const a = s.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim(), y = a.length, z = a ? a.split(" ").length : 0, F = `PdxRichTextEditor ${t ? "Disabled" : ""} ${i ? "ReadOnly" : ""} ${P || ""}`.trim(), w = { ...R };
|
|
60
|
+
return /* @__PURE__ */ u(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: `PdxField ${F}`,
|
|
64
|
+
style: T,
|
|
65
|
+
id: E,
|
|
66
|
+
...w,
|
|
67
|
+
children: [
|
|
68
|
+
f && /* @__PURE__ */ e("div", { className: "PdxFieldHeader", children: /* @__PURE__ */ e("label", { className: "PdxFieldLabel", children: f }) }),
|
|
69
|
+
b && /* @__PURE__ */ e("div", { className: "PdxFieldDescription", children: b }),
|
|
70
|
+
k && /* @__PURE__ */ u("div", { className: "PdxRichTextEditorToolbar", children: [
|
|
71
|
+
/* @__PURE__ */ e(
|
|
72
|
+
"button",
|
|
73
|
+
{
|
|
74
|
+
type: "button",
|
|
75
|
+
className: d.bold ? "Active" : "",
|
|
76
|
+
onClick: () => r("bold"),
|
|
77
|
+
disabled: t || i,
|
|
78
|
+
title: "Bold (Ctrl/Cmd+B)",
|
|
79
|
+
"aria-label": "Bold",
|
|
80
|
+
children: /* @__PURE__ */ e(M, { size: 14 })
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ e(
|
|
84
|
+
"button",
|
|
85
|
+
{
|
|
86
|
+
type: "button",
|
|
87
|
+
className: d.italic ? "Active" : "",
|
|
88
|
+
onClick: () => r("italic"),
|
|
89
|
+
disabled: t || i,
|
|
90
|
+
title: "Italic (Ctrl/Cmd+I)",
|
|
91
|
+
"aria-label": "Italic",
|
|
92
|
+
children: /* @__PURE__ */ e($, { size: 14 })
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ e(
|
|
96
|
+
"button",
|
|
97
|
+
{
|
|
98
|
+
type: "button",
|
|
99
|
+
className: d.underline ? "Active" : "",
|
|
100
|
+
onClick: () => r("underline"),
|
|
101
|
+
disabled: t || i,
|
|
102
|
+
title: "Underline (Ctrl/Cmd+U)",
|
|
103
|
+
"aria-label": "Underline",
|
|
104
|
+
children: /* @__PURE__ */ e(q, { size: 14 })
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ e(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
className: d.unorderedList ? "Active" : "",
|
|
112
|
+
onClick: () => r("insertUnorderedList"),
|
|
113
|
+
disabled: t || i,
|
|
114
|
+
title: "Bulleted list",
|
|
115
|
+
"aria-label": "Bulleted list",
|
|
116
|
+
children: /* @__PURE__ */ e(A, { size: 14 })
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ e(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
type: "button",
|
|
123
|
+
className: d.orderedList ? "Active" : "",
|
|
124
|
+
onClick: () => r("insertOrderedList"),
|
|
125
|
+
disabled: t || i,
|
|
126
|
+
title: "Numbered list",
|
|
127
|
+
"aria-label": "Numbered list",
|
|
128
|
+
children: /* @__PURE__ */ e(H, { size: 14 })
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ e(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
type: "button",
|
|
135
|
+
onClick: g,
|
|
136
|
+
disabled: t || i,
|
|
137
|
+
title: "Insert link",
|
|
138
|
+
"aria-label": "Insert link",
|
|
139
|
+
children: /* @__PURE__ */ e(V, { size: 14 })
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ e(
|
|
143
|
+
"button",
|
|
144
|
+
{
|
|
145
|
+
type: "button",
|
|
146
|
+
onClick: () => r("removeFormat"),
|
|
147
|
+
disabled: t || i,
|
|
148
|
+
title: "Clear formatting",
|
|
149
|
+
"aria-label": "Clear formatting",
|
|
150
|
+
children: /* @__PURE__ */ e(j, { size: 14 })
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ e(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
ref: n,
|
|
158
|
+
className: "PdxRichTextEditorContent",
|
|
159
|
+
contentEditable: !t && !i,
|
|
160
|
+
"data-placeholder": v,
|
|
161
|
+
onInput: x,
|
|
162
|
+
onKeyUp: c,
|
|
163
|
+
onMouseUp: c
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
/* @__PURE__ */ u("div", { className: "PdxRichTextEditorFooter", "aria-live": "polite", children: [
|
|
167
|
+
/* @__PURE__ */ e("span", { children: `${z} words` }),
|
|
168
|
+
/* @__PURE__ */ e("span", { children: `${y} chars` })
|
|
169
|
+
] }),
|
|
170
|
+
h && /* @__PURE__ */ e("div", { className: "PdxFieldMessage", children: h })
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
X as default
|
|
177
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsxs as m, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import "@prodivix/shared";
|
|
4
|
+
import { useState as g, useEffect as j } from "react";
|
|
5
|
+
function I({
|
|
6
|
+
label: i,
|
|
7
|
+
description: t,
|
|
8
|
+
message: s,
|
|
9
|
+
options: c,
|
|
10
|
+
value: e,
|
|
11
|
+
defaultValue: u,
|
|
12
|
+
placeholder: f = "Select item",
|
|
13
|
+
size: x = "Medium",
|
|
14
|
+
disabled: r = !1,
|
|
15
|
+
onChange: n,
|
|
16
|
+
className: h,
|
|
17
|
+
style: v,
|
|
18
|
+
id: P,
|
|
19
|
+
dataAttributes: N = {}
|
|
20
|
+
}) {
|
|
21
|
+
const [b, o] = g(u || "");
|
|
22
|
+
j(() => {
|
|
23
|
+
e !== void 0 && o(e);
|
|
24
|
+
}, [e]);
|
|
25
|
+
const p = e !== void 0 ? e : b, F = (l) => {
|
|
26
|
+
const a = l.target.value;
|
|
27
|
+
e === void 0 && o(a);
|
|
28
|
+
const $ = c.find((C) => C.value === a);
|
|
29
|
+
n && n(a, $);
|
|
30
|
+
}, S = `PdxSelect ${x} ${r ? "Disabled" : ""} ${h || ""}`.trim(), V = { ...N };
|
|
31
|
+
return /* @__PURE__ */ m(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: `PdxField ${S}`,
|
|
35
|
+
style: v,
|
|
36
|
+
id: P,
|
|
37
|
+
...V,
|
|
38
|
+
children: [
|
|
39
|
+
i && /* @__PURE__ */ d("div", { className: "PdxFieldHeader", children: /* @__PURE__ */ d("label", { className: "PdxFieldLabel", children: i }) }),
|
|
40
|
+
t && /* @__PURE__ */ d("div", { className: "PdxFieldDescription", children: t }),
|
|
41
|
+
/* @__PURE__ */ m(
|
|
42
|
+
"select",
|
|
43
|
+
{
|
|
44
|
+
className: "PdxSelectControl",
|
|
45
|
+
disabled: r,
|
|
46
|
+
value: p,
|
|
47
|
+
onChange: F,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ d("option", { value: "", disabled: !0, hidden: !0, children: f }),
|
|
50
|
+
c.map((l) => /* @__PURE__ */ d(
|
|
51
|
+
"option",
|
|
52
|
+
{
|
|
53
|
+
value: l.value,
|
|
54
|
+
disabled: l.disabled,
|
|
55
|
+
children: l.label
|
|
56
|
+
},
|
|
57
|
+
l.value
|
|
58
|
+
))
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
s && /* @__PURE__ */ d("div", { className: "PdxFieldMessage", children: s })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
I as default
|
|
69
|
+
};
|