@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamcat/craftsman",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "type": "module",
5
5
  "description": "A powerful, lightweight framework for design systems",
6
6
  "repository": {
@@ -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, ..._ } = o, v = n(), y = c || v;
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: y,
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 "clsx";
5
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
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 i = ({ label: i, labelPosition: a = "top", required: o = !1, error: s, className: c, style: l, children: u, value: d, defaultValue: f, onLabelClick: p }) => /* @__PURE__ */ r("div", {
8
- "data-label-position": a,
9
- "data-required": o,
10
- "data-has-input": !e(d) || !e(f),
11
- className: t("input-wrapper", c),
12
- style: l,
13
- children: [e(i) ? u : /* @__PURE__ */ r("label", {
14
- onClick: p,
15
- children: [a !== "hidden" && /* @__PURE__ */ n("div", {
16
- className: "input-label",
17
- children: i
18
- }), u]
19
- }), !e(s) && /* @__PURE__ */ n("div", {
20
- className: "input-error",
21
- children: s
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 { i as InputWrapper };
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, ...u }) => {
7
- let d = t();
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 || d,
18
+ id: i || p,
17
19
  className: "input",
18
- ...u
20
+ value: u,
21
+ defaultValue: d,
22
+ ...f
19
23
  })
20
24
  });
21
25
  };