@serendie/ui 2.3.0-dev.202512090256 → 2.3.0-dev.202601080839

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,9 +1,10 @@
1
- import { jsxs as i, jsx as s } from "react/jsx-runtime";
2
- import _ from "../../node_modules/merge-refs/dist/esm/index.js";
3
- import c, { forwardRef as w } from "react";
4
- import { sva as C } from "../../styled-system/css/sva.js";
5
- import { cx as N } from "../../styled-system/css/cx.js";
6
- const p = C({
1
+ import { jsxs as a, jsx as s } from "react/jsx-runtime";
2
+ import w from "../../node_modules/merge-refs/dist/esm/index.js";
3
+ import c, { forwardRef as C } from "react";
4
+ import { useTranslations as N } from "../../i18n/index.js";
5
+ import { sva as R } from "../../styled-system/css/sva.js";
6
+ import { cx as T } from "../../styled-system/css/cx.js";
7
+ const p = R({
7
8
  slots: [
8
9
  "root",
9
10
  "label",
@@ -102,7 +103,7 @@ const p = C({
102
103
  }
103
104
  }
104
105
  }
105
- }), A = w(
106
+ }), I = C(
106
107
  ({
107
108
  placeholder: y,
108
109
  label: r,
@@ -110,44 +111,44 @@ const p = C({
110
111
  required: d,
111
112
  requiredLabel: u,
112
113
  invalidMessage: o,
113
- invalid: a,
114
- disabled: l,
114
+ invalid: i,
115
+ disabled: n,
115
116
  className: g,
116
- ...n
117
+ ...l
117
118
  }, h) => {
118
- const x = c.useRef(null), b = _(x, h), [f, S] = p.splitVariantProps(n), e = p(f), v = t || a && o, m = n.id || c.useId();
119
- return /* @__PURE__ */ i("div", { className: N(e.root, g), children: [
120
- r ? /* @__PURE__ */ i("label", { className: e.label, htmlFor: m, children: [
119
+ const x = N(), b = c.useRef(null), f = w(b, h), [S, v] = p.splitVariantProps(l), e = p(S), _ = t || i && o, m = l.id || c.useId();
120
+ return /* @__PURE__ */ a("div", { className: T(e.root, g), children: [
121
+ r ? /* @__PURE__ */ a("label", { className: e.label, htmlFor: m, children: [
121
122
  r,
122
- d && /* @__PURE__ */ s("span", { className: e.required, children: u ?? "必須" })
123
+ d && /* @__PURE__ */ s("span", { className: e.required, children: u ?? x("common.required") })
123
124
  ] }) : null,
124
125
  /* @__PURE__ */ s(
125
126
  "div",
126
127
  {
127
128
  className: e.wrapper,
128
- "data-invalid": a ? !0 : void 0,
129
- "data-disabled": l ? !0 : void 0,
129
+ "data-invalid": i ? !0 : void 0,
130
+ "data-disabled": n ? !0 : void 0,
130
131
  children: /* @__PURE__ */ s(
131
132
  "textarea",
132
133
  {
133
- ref: b,
134
+ ref: f,
134
135
  id: m,
135
136
  placeholder: y,
136
137
  required: d,
137
- disabled: l,
138
+ disabled: n,
138
139
  className: e.textarea,
139
- ...S
140
+ ...v
140
141
  }
141
142
  )
142
143
  }
143
144
  ),
144
- v && /* @__PURE__ */ i("div", { className: e.messageField, children: [
145
+ _ && /* @__PURE__ */ a("div", { className: e.messageField, children: [
145
146
  t && /* @__PURE__ */ s("p", { className: e.description, children: t }),
146
- a && o && /* @__PURE__ */ s("p", { className: e.invalidMessage, children: o })
147
+ i && o && /* @__PURE__ */ s("p", { className: e.invalidMessage, children: o })
147
148
  ] })
148
149
  ] });
149
150
  }
150
151
  );
151
152
  export {
152
- A as TextArea
153
+ I as TextArea
153
154
  };
@@ -2,72 +2,72 @@ import { jsxs as a, 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 x } from "../../recipes/textFieldRecipe.js";
5
+ import { textFieldRecipe as F } from "../../recipes/textFieldRecipe.js";
6
6
  import { useTranslations as D } from "../../i18n/index.js";
7
7
  import { cx as E } from "../../styled-system/css/cx.js";
8
- import { css as b } from "../../styled-system/css/css.js";
8
+ import { css as V } from "../../styled-system/css/css.js";
9
9
  const U = B(
10
10
  ({
11
- placeholder: F,
11
+ placeholder: b,
12
12
  label: d,
13
13
  description: i,
14
14
  required: u,
15
15
  requiredLabel: S,
16
- invalidMessage: n,
16
+ invalidMessage: c,
17
17
  invalid: r,
18
- type: V = "text",
19
- disabled: c,
18
+ type: w = "text",
19
+ disabled: n,
20
20
  onChange: h,
21
21
  value: f,
22
- className: w,
22
+ className: y,
23
23
  leftContent: N,
24
24
  rightContent: p,
25
- ...s
26
- }, y) => {
27
- const C = D(), o = m.useRef(null), P = z(o, y), [_, j] = x.splitVariantProps({
28
- ...s
29
- }), t = x(_), I = i || r && n, [T, k] = m.useState(s.defaultValue || f), v = s.id || m.useId(), q = () => {
30
- var R;
31
- const l = {
25
+ ...l
26
+ }, C) => {
27
+ const v = D(), o = m.useRef(null), P = z(o, C), [_, j] = F.splitVariantProps({
28
+ ...l
29
+ }), t = F(_), I = i || r && c, [T, k] = m.useState(l.defaultValue || f), g = l.id || m.useId(), q = () => {
30
+ var x;
31
+ const s = {
32
32
  target: { value: "" }
33
33
  };
34
- g(l), (R = s.onReset) == null || R.call(s, l), o.current && (o.current.value = "");
35
- }, g = (l) => {
36
- k(l.target.value), h && h(l);
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);
37
37
  };
38
- return /* @__PURE__ */ a("div", { className: E(t.root, w), children: [
39
- d ? /* @__PURE__ */ a("label", { className: t.label, htmlFor: v, children: [
38
+ return /* @__PURE__ */ a("div", { className: E(t.root, y), children: [
39
+ d ? /* @__PURE__ */ a("label", { className: t.label, htmlFor: g, children: [
40
40
  d,
41
- u && /* @__PURE__ */ e("span", { className: t.labelRequired, children: S ?? C("common.required") })
41
+ u && /* @__PURE__ */ e("span", { className: t.labelRequired, children: S ?? v("common.required") })
42
42
  ] }) : null,
43
43
  /* @__PURE__ */ a(
44
44
  "div",
45
45
  {
46
46
  className: t.inputWrapper,
47
47
  "data-invalid": r ? !0 : void 0,
48
- "data-disabled": c ? !0 : void 0,
48
+ "data-disabled": n ? !0 : void 0,
49
49
  children: [
50
50
  N ? /* @__PURE__ */ e("div", { className: t.leftContent, children: N }) : /* @__PURE__ */ e("div", {}),
51
51
  /* @__PURE__ */ e(
52
52
  "input",
53
53
  {
54
54
  ref: P,
55
- id: v,
56
- placeholder: F,
55
+ id: g,
56
+ placeholder: b,
57
57
  required: u,
58
- disabled: c,
58
+ disabled: n,
59
59
  value: f,
60
- type: V,
60
+ type: w,
61
61
  className: t.input,
62
- onChange: g,
62
+ onChange: R,
63
63
  ...j
64
64
  }
65
65
  ),
66
- p ? /* @__PURE__ */ e("div", { className: t.rightContent, children: p }) : /* @__PURE__ */ e("div", { className: t.icon, children: !c && /* disabledの場合はアイコンを表示しない */
66
+ p ? /* @__PURE__ */ e("div", { className: t.rightContent, children: p }) : /* @__PURE__ */ e("div", { className: t.icon, children: !n && /* disabledの場合はアイコンを表示しない */
67
67
  (r ? /* @__PURE__ */ e(
68
68
  "span",
69
69
  {
70
- className: b({
70
+ className: V({
71
71
  color: "sd.system.color.impression.negative"
72
72
  }),
73
73
  children: /* @__PURE__ */ e(A, { width: 20, height: 20 })
@@ -75,9 +75,9 @@ const U = B(
75
75
  ) : T ? /* @__PURE__ */ e(
76
76
  "button",
77
77
  {
78
- className: b({ cursor: "pointer" }),
78
+ className: V({ cursor: "pointer" }),
79
79
  onClick: q,
80
- "aria-label": "値をクリア",
80
+ "aria-label": v("textField.clearValue"),
81
81
  children: /* @__PURE__ */ e(W, { width: 20, height: 20 })
82
82
  }
83
83
  ) : null) })
@@ -86,7 +86,7 @@ const U = B(
86
86
  ),
87
87
  I && /* @__PURE__ */ a("div", { className: t.messageField, children: [
88
88
  i && /* @__PURE__ */ e("p", { className: t.description, children: i }),
89
- r && n && /* @__PURE__ */ e("p", { className: t.invalidMessage, children: n })
89
+ r && c && /* @__PURE__ */ e("p", { className: t.invalidMessage, children: c })
90
90
  ] })
91
91
  ] });
92
92
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ModalDialog/Drawer内にある場合、自動的にそのコンテンツ要素をポータルコンテナとして検出するフック
3
+ *
4
+ * @param portalled - Portalを使用するかどうか
5
+ * @returns triggerRef - トリガー要素に設定するref
6
+ * @returns portalContainerRef - Portalのcontainerプロパティに渡すref
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * const { triggerRef, portalContainerRef } = useAutoPortalContainer(portalled);
11
+ *
12
+ * <Trigger ref={triggerRef}>...</Trigger>
13
+ * <Portal container={portalContainerRef}>...</Portal>
14
+ * ```
15
+ */
16
+ export declare const useAutoPortalContainer: (portalled: boolean) => {
17
+ triggerRef: import('react').RefObject<HTMLElement>;
18
+ portalContainerRef: {
19
+ current: HTMLElement;
20
+ } | undefined;
21
+ };
@@ -0,0 +1,16 @@
1
+ import { useRef as a, useState as c, useEffect as s } from "react";
2
+ const l = (r) => {
3
+ const t = a(null), [e, o] = c(
4
+ null
5
+ );
6
+ return s(() => {
7
+ if (!r || !t.current) return;
8
+ const n = t.current.closest(
9
+ '[data-scope="dialog"][data-part="content"], [data-scope="drawer"][data-part="content"]'
10
+ );
11
+ n && o(n);
12
+ }, [r]), { triggerRef: t, portalContainerRef: e ? { current: e } : void 0 };
13
+ };
14
+ export {
15
+ l as useAutoPortalContainer
16
+ };
@@ -1,10 +1,34 @@
1
1
  export declare const dictionary: {
2
2
  readonly ja: {
3
3
  readonly "common.required": "必須";
4
+ readonly "textField.clearValue": "値をクリア";
5
+ readonly "passwordField.hidePassword": "パスワードを隠す";
6
+ readonly "passwordField.showPassword": "パスワードを表示";
7
+ readonly "datePicker.selectDate": "日付を選択";
8
+ readonly "datePicker.startDate": "開始日";
9
+ readonly "datePicker.endDate": "終了日";
4
10
  readonly "pagination.page": "{{page}}ページ目";
11
+ readonly "pagination.firstPage": "最初のページです";
12
+ readonly "pagination.previousPage": "前のページへ";
13
+ readonly "pagination.lastPage": "最後のページです";
14
+ readonly "pagination.nextPage": "次のページへ";
15
+ readonly "pagination.goToPage": "ページ{{page}}へ移動";
16
+ readonly "modalDialog.close": "閉じる";
5
17
  };
6
18
  readonly en: {
7
19
  readonly "common.required": "Required";
20
+ readonly "textField.clearValue": "Clear value";
21
+ readonly "passwordField.hidePassword": "Hide password";
22
+ readonly "passwordField.showPassword": "Show password";
23
+ readonly "datePicker.selectDate": "Select date";
24
+ readonly "datePicker.startDate": "Start date";
25
+ readonly "datePicker.endDate": "End date";
8
26
  readonly "pagination.page": "Page {{page}}";
27
+ readonly "pagination.firstPage": "This is the first page";
28
+ readonly "pagination.previousPage": "Go to previous page";
29
+ readonly "pagination.lastPage": "This is the last page";
30
+ readonly "pagination.nextPage": "Go to next page";
31
+ readonly "pagination.goToPage": "Go to page {{page}}";
32
+ readonly "modalDialog.close": "Close";
9
33
  };
10
34
  };
@@ -1,13 +1,37 @@
1
- const e = {
1
+ const a = {
2
2
  ja: {
3
3
  "common.required": "必須",
4
- "pagination.page": "{{page}}ページ目"
4
+ "textField.clearValue": "値をクリア",
5
+ "passwordField.hidePassword": "パスワードを隠す",
6
+ "passwordField.showPassword": "パスワードを表示",
7
+ "datePicker.selectDate": "日付を選択",
8
+ "datePicker.startDate": "開始日",
9
+ "datePicker.endDate": "終了日",
10
+ "pagination.page": "{{page}}ページ目",
11
+ "pagination.firstPage": "最初のページです",
12
+ "pagination.previousPage": "前のページへ",
13
+ "pagination.lastPage": "最後のページです",
14
+ "pagination.nextPage": "次のページへ",
15
+ "pagination.goToPage": "ページ{{page}}へ移動",
16
+ "modalDialog.close": "閉じる"
5
17
  },
6
18
  en: {
7
19
  "common.required": "Required",
8
- "pagination.page": "Page {{page}}"
20
+ "textField.clearValue": "Clear value",
21
+ "passwordField.hidePassword": "Hide password",
22
+ "passwordField.showPassword": "Show password",
23
+ "datePicker.selectDate": "Select date",
24
+ "datePicker.startDate": "Start date",
25
+ "datePicker.endDate": "End date",
26
+ "pagination.page": "Page {{page}}",
27
+ "pagination.firstPage": "This is the first page",
28
+ "pagination.previousPage": "Go to previous page",
29
+ "pagination.lastPage": "This is the last page",
30
+ "pagination.nextPage": "Go to next page",
31
+ "pagination.goToPage": "Go to page {{page}}",
32
+ "modalDialog.close": "Close"
9
33
  }
10
34
  };
11
35
  export {
12
- e as dictionary
36
+ a as dictionary
13
37
  };
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.3.0-dev.202512090256",
5
+ "version": "2.3.0-dev.202601080839",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
8
8
  "sideEffects": [