@stamcat/craftsman 0.0.43 → 0.0.44
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/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import r from "clsx";
|
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/Input/Input.tsx
|
|
8
8
|
var o = (o) => {
|
|
9
|
-
let { label: s, id: c, labelPosition: l = "top", required: u = !1, type: d = "text", error: f, endAdornment: p, preAdornment: m, style: h, className: g,
|
|
9
|
+
let { label: s, id: c, labelPosition: l = "top", required: u = !1, type: d = "text", error: f, endAdornment: p, preAdornment: m, style: h, className: g, value: _, defaultValue: v, ...y } = o, b = n(), x = c || b;
|
|
10
10
|
return /* @__PURE__ */ i(t, {
|
|
11
11
|
className: g,
|
|
12
12
|
label: s,
|
|
@@ -14,6 +14,8 @@ var o = (o) => {
|
|
|
14
14
|
error: f,
|
|
15
15
|
required: u,
|
|
16
16
|
style: h,
|
|
17
|
+
value: _,
|
|
18
|
+
defaultValue: v,
|
|
17
19
|
children: /* @__PURE__ */ a("span", {
|
|
18
20
|
className: "input-field",
|
|
19
21
|
"data-has-end-adornment": !e(p),
|
|
@@ -24,10 +26,12 @@ var o = (o) => {
|
|
|
24
26
|
children: m
|
|
25
27
|
}),
|
|
26
28
|
/* @__PURE__ */ i("input", {
|
|
27
|
-
id:
|
|
29
|
+
id: x,
|
|
28
30
|
type: d,
|
|
29
31
|
className: r("input", d),
|
|
30
|
-
|
|
32
|
+
value: _,
|
|
33
|
+
defaultValue: v,
|
|
34
|
+
...y
|
|
31
35
|
}),
|
|
32
36
|
!e(p) && /* @__PURE__ */ i("span", {
|
|
33
37
|
className: "input-end-adornment",
|
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isEmpty as e } from "../../utilities/validations.esm.js";
|
|
3
3
|
import './Input.css';/* empty css */
|
|
4
|
-
import t from "
|
|
5
|
-
import
|
|
4
|
+
import { useState as t } from "react";
|
|
5
|
+
import n from "clsx";
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/Input/InputWrapper.tsx
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
children:
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
var a = ({ label: a, labelPosition: o = "top", required: s = !1, error: c, className: l, style: u, children: d, value: f, defaultValue: p, onLabelClick: m }) => {
|
|
9
|
+
let h = f !== void 0, [g, _] = t(!e(p)), v = h ? !e(f) : g, y = (t) => {
|
|
10
|
+
if (h) return;
|
|
11
|
+
let n = t.target;
|
|
12
|
+
_(!e(n.value));
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ i("div", {
|
|
15
|
+
"data-label-position": o,
|
|
16
|
+
"data-required": s,
|
|
17
|
+
"data-has-input": v,
|
|
18
|
+
className: n("input-wrapper", l),
|
|
19
|
+
style: u,
|
|
20
|
+
onInput: y,
|
|
21
|
+
onChange: y,
|
|
22
|
+
children: [e(a) ? d : /* @__PURE__ */ i("label", {
|
|
23
|
+
onClick: m,
|
|
24
|
+
children: [o !== "hidden" && /* @__PURE__ */ r("div", {
|
|
25
|
+
className: "input-label",
|
|
26
|
+
children: a
|
|
27
|
+
}), d]
|
|
28
|
+
}), !e(c) && /* @__PURE__ */ r("div", {
|
|
29
|
+
className: "input-error",
|
|
30
|
+
children: c
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
24
34
|
//#endregion
|
|
25
|
-
export {
|
|
35
|
+
export { a as InputWrapper };
|
|
@@ -3,8 +3,8 @@ import { InputWrapper as e } from "../Input/InputWrapper.esm.js";
|
|
|
3
3
|
import { useId as t } from "react";
|
|
4
4
|
import { jsx as n } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/Textarea/Textarea.tsx
|
|
6
|
-
var r = ({ labelPosition: r = "top", id: i, label: a, error: o, required: s, className: c, style: l,
|
|
7
|
-
let
|
|
6
|
+
var r = ({ labelPosition: r = "top", id: i, label: a, error: o, required: s, className: c, style: l, value: u, defaultValue: d, ...f }) => {
|
|
7
|
+
let p = t();
|
|
8
8
|
return /* @__PURE__ */ n(e, {
|
|
9
9
|
label: a,
|
|
10
10
|
className: c,
|
|
@@ -12,10 +12,14 @@ var r = ({ labelPosition: r = "top", id: i, label: a, error: o, required: s, cla
|
|
|
12
12
|
error: o,
|
|
13
13
|
required: s,
|
|
14
14
|
style: l,
|
|
15
|
+
value: u,
|
|
16
|
+
defaultValue: d,
|
|
15
17
|
children: /* @__PURE__ */ n("textarea", {
|
|
16
|
-
id: i ||
|
|
18
|
+
id: i || p,
|
|
17
19
|
className: "input",
|
|
18
|
-
|
|
20
|
+
value: u,
|
|
21
|
+
defaultValue: d,
|
|
22
|
+
...f
|
|
19
23
|
})
|
|
20
24
|
});
|
|
21
25
|
};
|