@serendie/ui 2.5.0 → 2.5.1

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.
@@ -1,82 +1,86 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
2
  import { SerendieSymbolAlertCircle as A, SerendieSymbolClose as W } from "@serendie/symbols";
3
3
  import z from "../../node_modules/merge-refs/dist/esm/index.js";
4
4
  import m, { forwardRef as B } from "react";
5
- import { textFieldRecipe as F } from "../../recipes/textFieldRecipe.js";
6
- import { useTranslations as D } from "../../i18n/index.js";
7
- import { cx as E } from "../../styled-system/css/cx.js";
8
- import { css as V } from "../../styled-system/css/css.js";
9
- const U = B(
5
+ import { textFieldRecipe as b } from "../../recipes/textFieldRecipe.js";
6
+ import { useTranslations as E } from "../../i18n/index.js";
7
+ import { cx as G } from "../../styled-system/css/cx.js";
8
+ import { css as w } from "../../styled-system/css/css.js";
9
+ const X = B(
10
10
  ({
11
- placeholder: b,
11
+ placeholder: F,
12
12
  label: d,
13
- description: i,
13
+ description: o,
14
14
  required: u,
15
- requiredLabel: S,
16
- invalidMessage: c,
17
- invalid: r,
18
- type: w = "text",
19
- disabled: n,
20
- onChange: h,
21
- value: f,
22
- className: y,
23
- leftContent: N,
24
- rightContent: p,
15
+ requiredLabel: V,
16
+ invalidMessage: i,
17
+ invalid: s,
18
+ type: y = "text",
19
+ disabled: c,
20
+ onChange: f,
21
+ value: h,
22
+ className: C,
23
+ leftContent: p,
24
+ rightContent: N,
25
25
  ...l
26
- }, C) => {
27
- const v = D(), o = m.useRef(null), P = z(o, C), [_, j] = F.splitVariantProps({
26
+ }, P) => {
27
+ const v = E(), a = m.useRef(null), S = z(a, P), [D, _] = b.splitVariantProps({
28
28
  ...l
29
- }), t = F(_), I = i || r && c, [T, k] = m.useState(l.defaultValue || f), g = l.id || m.useId(), q = () => {
29
+ }), t = b(D), j = o || s && i, [I, T] = m.useState(l.defaultValue || h), g = l.id || m.useId(), k = () => {
30
30
  var x;
31
- const s = {
31
+ const r = {
32
32
  target: { value: "" }
33
33
  };
34
- R(s), (x = l.onReset) == null || x.call(l, s), o.current && (o.current.value = "");
35
- }, R = (s) => {
36
- k(s.target.value), h && h(s);
34
+ R(r), (x = l.onReset) == null || x.call(l, r), a.current && (a.current.value = "", a.current.focus());
35
+ }, q = (r) => {
36
+ r.button === 0 && r.preventDefault();
37
+ }, R = (r) => {
38
+ T(r.target.value), f && f(r);
37
39
  };
38
- return /* @__PURE__ */ a("div", { className: E(t.root, y), children: [
39
- d ? /* @__PURE__ */ a("label", { className: t.label, htmlFor: g, children: [
40
+ return /* @__PURE__ */ n("div", { className: G(t.root, C), children: [
41
+ d ? /* @__PURE__ */ n("label", { className: t.label, htmlFor: g, children: [
40
42
  d,
41
- u && /* @__PURE__ */ e("span", { className: t.labelRequired, children: S ?? v("common.required") })
43
+ u && /* @__PURE__ */ e("span", { className: t.labelRequired, children: V ?? v("common.required") })
42
44
  ] }) : null,
43
- /* @__PURE__ */ a(
45
+ /* @__PURE__ */ n(
44
46
  "div",
45
47
  {
46
48
  className: t.inputWrapper,
47
- "data-invalid": r ? !0 : void 0,
48
- "data-disabled": n ? !0 : void 0,
49
+ "data-invalid": s ? !0 : void 0,
50
+ "data-disabled": c ? !0 : void 0,
49
51
  children: [
50
- N ? /* @__PURE__ */ e("div", { className: t.leftContent, children: N }) : /* @__PURE__ */ e("div", {}),
52
+ p ? /* @__PURE__ */ e("div", { className: t.leftContent, children: p }) : /* @__PURE__ */ e("div", {}),
51
53
  /* @__PURE__ */ e(
52
54
  "input",
53
55
  {
54
- ref: P,
56
+ ref: S,
55
57
  id: g,
56
- placeholder: b,
58
+ placeholder: F,
57
59
  required: u,
58
- disabled: n,
59
- value: f,
60
- type: w,
60
+ disabled: c,
61
+ value: h,
62
+ type: y,
61
63
  className: t.input,
62
64
  onChange: R,
63
- ...j
65
+ ..._
64
66
  }
65
67
  ),
66
- p ? /* @__PURE__ */ e("div", { className: t.rightContent, children: p }) : /* @__PURE__ */ e("div", { className: t.icon, children: !n && /* disabledの場合はアイコンを表示しない */
67
- (r ? /* @__PURE__ */ e(
68
+ N ? /* @__PURE__ */ e("div", { className: t.rightContent, children: N }) : /* @__PURE__ */ e("div", { className: t.icon, children: !c && /* disabledの場合はアイコンを表示しない */
69
+ (s ? /* @__PURE__ */ e(
68
70
  "span",
69
71
  {
70
- className: V({
72
+ className: w({
71
73
  color: "sd.system.color.impression.negative"
72
74
  }),
73
75
  children: /* @__PURE__ */ e(A, { width: 20, height: 20 })
74
76
  }
75
- ) : T ? /* @__PURE__ */ e(
77
+ ) : I ? /* @__PURE__ */ e(
76
78
  "button",
77
79
  {
78
- className: V({ cursor: "pointer" }),
79
- onClick: q,
80
+ type: "button",
81
+ className: w({ cursor: "pointer" }),
82
+ onPointerDown: q,
83
+ onClick: k,
80
84
  "aria-label": v("textField.clearValue"),
81
85
  children: /* @__PURE__ */ e(W, { width: 20, height: 20 })
82
86
  }
@@ -84,13 +88,13 @@ const U = B(
84
88
  ]
85
89
  }
86
90
  ),
87
- I && /* @__PURE__ */ a("div", { className: t.messageField, children: [
88
- i && /* @__PURE__ */ e("p", { className: t.description, children: i }),
89
- r && c && /* @__PURE__ */ e("p", { className: t.invalidMessage, children: c })
91
+ j && /* @__PURE__ */ n("div", { className: t.messageField, children: [
92
+ o && /* @__PURE__ */ e("p", { className: t.description, children: o }),
93
+ s && i && /* @__PURE__ */ e("p", { className: t.invalidMessage, children: i })
90
94
  ] })
91
95
  ] });
92
96
  }
93
97
  );
94
98
  export {
95
- U as TextField
99
+ X as TextField
96
100
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@serendie/ui",
3
3
  "description": "Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric",
4
4
  "license": "MIT",
5
- "version": "2.5.0",
5
+ "version": "2.5.1",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
8
8
  "sideEffects": [