@situaction/traq-ui-ste 1.2.26 → 1.2.27

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.
@@ -11,6 +11,8 @@ export interface LabelInputProps {
11
11
  onSubmit: (newValue: string) => void;
12
12
  /** Placeholder shown when the input is empty (in edit mode) */
13
13
  placeholder?: string;
14
+ /** Background for the input container (.fullWidth) */
15
+ background?: string;
14
16
  }
15
17
  /** InputLabel is a labeled input component with submit-on-blur and Enter support */
16
18
  export declare const InputLabel: FC<LabelInputProps>;
@@ -1,43 +1,53 @@
1
- import { jsxs as h, jsx as n } from "react/jsx-runtime";
2
- import { useState as d, useEffect as f } from "react";
3
- import { Input as b } from "../input/Input.js";
4
- import '../../styles/InputLabel.css';const x = "_inputLabel_1x3uf_30", _ = "_fullWidth_1x3uf_39", o = {
5
- inputLabel: x,
6
- fullWidth: _
7
- }, W = ({
1
+ import { jsxs as x, jsx as n } from "react/jsx-runtime";
2
+ import { useState as b, useEffect as v } from "react";
3
+ import { Input as y } from "../input/Input.js";
4
+ import '../../styles/InputLabel.css';const _ = "_inputLabel_1x3uf_30", L = "_fullWidth_1x3uf_39", u = {
5
+ inputLabel: _,
6
+ fullWidth: L
7
+ }, N = ({
8
8
  label: a,
9
- defaultValue: t,
10
- size: u = "s",
11
- onSubmit: r,
12
- placeholder: y,
13
- ...c
9
+ defaultValue: e,
10
+ size: r = "s",
11
+ onSubmit: c,
12
+ placeholder: m,
13
+ background: l,
14
+ ...p
14
15
  }) => {
15
- const [e, s] = d("");
16
- f(() => {
17
- s(t ?? "");
18
- }, [t]);
19
- const i = () => {
20
- e.trim() !== t && r(e.trim());
21
- }, m = (l) => {
22
- l.key === "Enter" && i();
23
- }, p = () => {
24
- i();
16
+ const [s, i] = b("");
17
+ v(() => {
18
+ i(e ?? "");
19
+ }, [e]);
20
+ const o = () => {
21
+ const t = s.trim(), d = (e ?? "").trim();
22
+ t !== d && c(t);
23
+ }, f = (t) => {
24
+ t.key === "Enter" && o();
25
+ }, h = () => {
26
+ o();
25
27
  };
26
- return /* @__PURE__ */ h("div", { className: o.inputLabel, children: [
28
+ return /* @__PURE__ */ x("div", { className: u.inputLabel, children: [
27
29
  /* @__PURE__ */ n("label", { className: "textSmall", children: a }),
28
- /* @__PURE__ */ n("div", { className: o.fullWidth, children: /* @__PURE__ */ n(
29
- b,
30
+ /* @__PURE__ */ n(
31
+ "div",
30
32
  {
31
- value: e,
32
- sizeStyle: u,
33
- onChange: (l) => s(l.target.value),
34
- onKeyDown: m,
35
- onBlur: p,
36
- ...c
33
+ className: u.fullWidth,
34
+ style: l ? { background: l } : void 0,
35
+ children: /* @__PURE__ */ n(
36
+ y,
37
+ {
38
+ value: s,
39
+ sizeStyle: r,
40
+ onChange: (t) => i(t.target.value),
41
+ onKeyDown: f,
42
+ onBlur: h,
43
+ placeholder: m,
44
+ ...p
45
+ }
46
+ )
37
47
  }
38
- ) })
48
+ )
39
49
  ] });
40
50
  };
41
51
  export {
42
- W as InputLabel
52
+ N as InputLabel
43
53
  };