@serendie/ui 2.5.0 → 2.5.1-dev.202602161330
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
|
|
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
|
|
6
|
-
import { useTranslations as
|
|
7
|
-
import { cx as
|
|
8
|
-
import { css as
|
|
9
|
-
const
|
|
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:
|
|
11
|
+
placeholder: F,
|
|
12
12
|
label: d,
|
|
13
|
-
description:
|
|
13
|
+
description: o,
|
|
14
14
|
required: u,
|
|
15
|
-
requiredLabel:
|
|
16
|
-
invalidMessage:
|
|
17
|
-
invalid:
|
|
18
|
-
type:
|
|
19
|
-
disabled:
|
|
20
|
-
onChange:
|
|
21
|
-
value:
|
|
22
|
-
className:
|
|
23
|
-
leftContent:
|
|
24
|
-
rightContent:
|
|
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
|
-
},
|
|
27
|
-
const v =
|
|
26
|
+
}, P) => {
|
|
27
|
+
const v = E(), a = m.useRef(null), S = z(a, P), [D, _] = b.splitVariantProps({
|
|
28
28
|
...l
|
|
29
|
-
}), t =
|
|
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
|
|
31
|
+
const r = {
|
|
32
32
|
target: { value: "" }
|
|
33
33
|
};
|
|
34
|
-
R(
|
|
35
|
-
},
|
|
36
|
-
|
|
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__ */
|
|
39
|
-
d ? /* @__PURE__ */
|
|
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:
|
|
43
|
+
u && /* @__PURE__ */ e("span", { className: t.labelRequired, children: V ?? v("common.required") })
|
|
42
44
|
] }) : null,
|
|
43
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ n(
|
|
44
46
|
"div",
|
|
45
47
|
{
|
|
46
48
|
className: t.inputWrapper,
|
|
47
|
-
"data-invalid":
|
|
48
|
-
"data-disabled":
|
|
49
|
+
"data-invalid": s ? !0 : void 0,
|
|
50
|
+
"data-disabled": c ? !0 : void 0,
|
|
49
51
|
children: [
|
|
50
|
-
|
|
52
|
+
p ? /* @__PURE__ */ e("div", { className: t.leftContent, children: p }) : /* @__PURE__ */ e("div", {}),
|
|
51
53
|
/* @__PURE__ */ e(
|
|
52
54
|
"input",
|
|
53
55
|
{
|
|
54
|
-
ref:
|
|
56
|
+
ref: S,
|
|
55
57
|
id: g,
|
|
56
|
-
placeholder:
|
|
58
|
+
placeholder: F,
|
|
57
59
|
required: u,
|
|
58
|
-
disabled:
|
|
59
|
-
value:
|
|
60
|
-
type:
|
|
60
|
+
disabled: c,
|
|
61
|
+
value: h,
|
|
62
|
+
type: y,
|
|
61
63
|
className: t.input,
|
|
62
64
|
onChange: R,
|
|
63
|
-
...
|
|
65
|
+
..._
|
|
64
66
|
}
|
|
65
67
|
),
|
|
66
|
-
|
|
67
|
-
(
|
|
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:
|
|
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
|
-
) :
|
|
77
|
+
) : I ? /* @__PURE__ */ e(
|
|
76
78
|
"button",
|
|
77
79
|
{
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
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.
|
|
5
|
+
"version": "2.5.1-dev.202602161330",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"sideEffects": [
|