@serendie/ui 2.2.8 → 2.3.0-dev.202512051042
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/README.md +105 -1
- package/dist/client.js +32 -30
- package/dist/components/Steps/Steps.d.ts +13 -0
- package/dist/components/Steps/Steps.js +370 -0
- package/dist/components/Steps/index.d.ts +2 -0
- package/dist/components/Steps/index.js +4 -0
- package/dist/components/TextField/TextField.js +35 -34
- package/dist/i18n/dictionary.d.ts +10 -0
- package/dist/i18n/dictionary.js +13 -0
- package/dist/i18n/index.d.ts +20 -0
- package/dist/i18n/index.js +34 -0
- package/dist/i18n/provider.d.ts +14 -0
- package/dist/i18n/provider.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +27 -25
- package/dist/styles.css +1 -1
- package/package.json +6 -2
|
@@ -1,81 +1,82 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { SerendieSymbolAlertCircle as
|
|
3
|
-
import
|
|
4
|
-
import m, { forwardRef as
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { SerendieSymbolAlertCircle as A, SerendieSymbolClose as W } from "@serendie/symbols";
|
|
3
|
+
import z from "../../node_modules/merge-refs/dist/esm/index.js";
|
|
4
|
+
import m, { forwardRef as B } from "react";
|
|
5
5
|
import { textFieldRecipe as x } from "../../recipes/textFieldRecipe.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useTranslations as D } from "../../i18n/index.js";
|
|
7
|
+
import { cx as E } from "../../styled-system/css/cx.js";
|
|
7
8
|
import { css as b } from "../../styled-system/css/css.js";
|
|
8
|
-
const
|
|
9
|
+
const U = B(
|
|
9
10
|
({
|
|
10
11
|
placeholder: F,
|
|
11
12
|
label: d,
|
|
12
13
|
description: i,
|
|
13
14
|
required: u,
|
|
14
15
|
requiredLabel: S,
|
|
15
|
-
invalidMessage:
|
|
16
|
-
invalid:
|
|
16
|
+
invalidMessage: n,
|
|
17
|
+
invalid: r,
|
|
17
18
|
type: V = "text",
|
|
18
|
-
disabled:
|
|
19
|
+
disabled: c,
|
|
19
20
|
onChange: h,
|
|
20
21
|
value: f,
|
|
21
22
|
className: w,
|
|
22
23
|
leftContent: N,
|
|
23
24
|
rightContent: p,
|
|
24
|
-
...
|
|
25
|
+
...s
|
|
25
26
|
}, y) => {
|
|
26
|
-
const o = m.useRef(null),
|
|
27
|
-
...
|
|
28
|
-
}), t = x(
|
|
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 = () => {
|
|
29
30
|
var R;
|
|
30
|
-
const
|
|
31
|
+
const l = {
|
|
31
32
|
target: { value: "" }
|
|
32
33
|
};
|
|
33
|
-
g(
|
|
34
|
-
}, g = (
|
|
35
|
-
k(
|
|
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);
|
|
36
37
|
};
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
d ? /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ a("div", { className: E(t.root, w), children: [
|
|
39
|
+
d ? /* @__PURE__ */ a("label", { className: t.label, htmlFor: v, children: [
|
|
39
40
|
d,
|
|
40
|
-
u && /* @__PURE__ */ e("span", { className: t.labelRequired, children: S ?? "
|
|
41
|
+
u && /* @__PURE__ */ e("span", { className: t.labelRequired, children: S ?? C("common.required") })
|
|
41
42
|
] }) : null,
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ a(
|
|
43
44
|
"div",
|
|
44
45
|
{
|
|
45
46
|
className: t.inputWrapper,
|
|
46
|
-
"data-invalid":
|
|
47
|
-
"data-disabled":
|
|
47
|
+
"data-invalid": r ? !0 : void 0,
|
|
48
|
+
"data-disabled": c ? !0 : void 0,
|
|
48
49
|
children: [
|
|
49
50
|
N ? /* @__PURE__ */ e("div", { className: t.leftContent, children: N }) : /* @__PURE__ */ e("div", {}),
|
|
50
51
|
/* @__PURE__ */ e(
|
|
51
52
|
"input",
|
|
52
53
|
{
|
|
53
|
-
ref:
|
|
54
|
+
ref: P,
|
|
54
55
|
id: v,
|
|
55
56
|
placeholder: F,
|
|
56
57
|
required: u,
|
|
57
|
-
disabled:
|
|
58
|
+
disabled: c,
|
|
58
59
|
value: f,
|
|
59
60
|
type: V,
|
|
60
61
|
className: t.input,
|
|
61
62
|
onChange: g,
|
|
62
|
-
...
|
|
63
|
+
...j
|
|
63
64
|
}
|
|
64
65
|
),
|
|
65
|
-
p ? /* @__PURE__ */ e("div", { className: t.rightContent, children: p }) : /* @__PURE__ */ e("div", { className: t.icon, children: !
|
|
66
|
-
(
|
|
66
|
+
p ? /* @__PURE__ */ e("div", { className: t.rightContent, children: p }) : /* @__PURE__ */ e("div", { className: t.icon, children: !c && /* disabledの場合はアイコンを表示しない */
|
|
67
|
+
(r ? /* @__PURE__ */ e(
|
|
67
68
|
"span",
|
|
68
69
|
{
|
|
69
70
|
className: b({
|
|
70
71
|
color: "sd.system.color.impression.negative"
|
|
71
72
|
}),
|
|
72
|
-
children: /* @__PURE__ */ e(
|
|
73
|
+
children: /* @__PURE__ */ e(A, { width: 20, height: 20 })
|
|
73
74
|
}
|
|
74
|
-
) :
|
|
75
|
+
) : T ? /* @__PURE__ */ e(
|
|
75
76
|
"button",
|
|
76
77
|
{
|
|
77
78
|
className: b({ cursor: "pointer" }),
|
|
78
|
-
onClick:
|
|
79
|
+
onClick: q,
|
|
79
80
|
"aria-label": "値をクリア",
|
|
80
81
|
children: /* @__PURE__ */ e(W, { width: 20, height: 20 })
|
|
81
82
|
}
|
|
@@ -83,13 +84,13 @@ const M = z(
|
|
|
83
84
|
]
|
|
84
85
|
}
|
|
85
86
|
),
|
|
86
|
-
|
|
87
|
+
I && /* @__PURE__ */ a("div", { className: t.messageField, children: [
|
|
87
88
|
i && /* @__PURE__ */ e("p", { className: t.description, children: i }),
|
|
88
|
-
|
|
89
|
+
r && n && /* @__PURE__ */ e("p", { className: t.invalidMessage, children: n })
|
|
89
90
|
] })
|
|
90
91
|
] });
|
|
91
92
|
}
|
|
92
93
|
);
|
|
93
94
|
export {
|
|
94
|
-
|
|
95
|
+
U as TextField
|
|
95
96
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { dictionary } from './dictionary';
|
|
2
|
+
import { Language } from './provider';
|
|
3
|
+
export { SerendieProvider, LanguageProvider, type Language } from './provider';
|
|
4
|
+
export type TranslationKey = keyof typeof dictionary.ja;
|
|
5
|
+
/**
|
|
6
|
+
* 翻訳関数を生成するヘルパー
|
|
7
|
+
* Context不要な場合や、サーバーサイドで直接使う場合に使用
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTranslations(lang: Language): (key: TranslationKey, params?: Record<string, string | number>) => string;
|
|
10
|
+
/**
|
|
11
|
+
* 翻訳関数を取得するReact Hook
|
|
12
|
+
* SerendieProviderがない場合はデフォルト言語(ja)を使用します
|
|
13
|
+
*/
|
|
14
|
+
export declare function useTranslations(): (key: TranslationKey, params?: Record<string, string | number>) => string;
|
|
15
|
+
/**
|
|
16
|
+
* 言語に合わせて日付文字列をフォーマットする
|
|
17
|
+
* @param date ISO形式などDateが解釈できる文字列
|
|
18
|
+
* @param lang 言語
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatDateByLang(date: string, lang: Language): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useContext as l } from "react";
|
|
2
|
+
import { dictionary as u } from "./dictionary.js";
|
|
3
|
+
import { LanguageContext as s } from "./provider.js";
|
|
4
|
+
import { LanguageProvider as x, SerendieProvider as P } from "./provider.js";
|
|
5
|
+
function c(e) {
|
|
6
|
+
return function(r, t) {
|
|
7
|
+
let n = u[e][r];
|
|
8
|
+
return !n && e !== "ja" && (n = u.ja[r]), n ? (t && Object.entries(t).forEach(([a, f]) => {
|
|
9
|
+
const i = `{{${a}}}`;
|
|
10
|
+
n.includes(i) || console.warn(
|
|
11
|
+
`Placeholder "${i}" not found in translation "${n}"`
|
|
12
|
+
), n = n.replace(
|
|
13
|
+
new RegExp(`\\{\\{${a}\\}\\}`, "g"),
|
|
14
|
+
String(f)
|
|
15
|
+
);
|
|
16
|
+
}), n) : (console.warn(`Translation key "${r}" not found`), r);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function m() {
|
|
20
|
+
const e = l(s);
|
|
21
|
+
return !e && process.env.NODE_ENV === "development" && console.warn(
|
|
22
|
+
"SerendieProvider is not found. Using default language 'ja'. Consider wrapping your app with <SerendieProvider lang='ja'>"
|
|
23
|
+
), c(e || "ja");
|
|
24
|
+
}
|
|
25
|
+
function j(e, o) {
|
|
26
|
+
return new Date(e).toLocaleDateString(o === "en" ? "en-US" : "ja-JP");
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
x as LanguageProvider,
|
|
30
|
+
P as SerendieProvider,
|
|
31
|
+
j as formatDateByLang,
|
|
32
|
+
c as getTranslations,
|
|
33
|
+
m as useTranslations
|
|
34
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Language = "ja" | "en";
|
|
2
|
+
export declare const LanguageContext: import('react').Context<Language | undefined>;
|
|
3
|
+
/**
|
|
4
|
+
* Serendie UIの設定を提供するProvider
|
|
5
|
+
* アプリケーションのルートで使用してください
|
|
6
|
+
*/
|
|
7
|
+
export declare function SerendieProvider({ lang, children, }: {
|
|
8
|
+
lang: Language;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated LanguageProvider は SerendieProvider にリネームされました
|
|
13
|
+
*/
|
|
14
|
+
export declare const LanguageProvider: typeof SerendieProvider;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as t } from "react";
|
|
3
|
+
const n = t(void 0);
|
|
4
|
+
function i({
|
|
5
|
+
lang: e,
|
|
6
|
+
children: r
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ o(n.Provider, { value: e, children: r });
|
|
9
|
+
}
|
|
10
|
+
const u = i;
|
|
11
|
+
export {
|
|
12
|
+
n as LanguageContext,
|
|
13
|
+
u as LanguageProvider,
|
|
14
|
+
i as SerendieProvider
|
|
15
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './components/ProgressIndicator/index.ts';
|
|
|
24
24
|
export * from './components/RadioButton/index.ts';
|
|
25
25
|
export * from './components/Search/index.ts';
|
|
26
26
|
export * from './components/Select/index.ts';
|
|
27
|
+
export * from './components/Steps/index.ts';
|
|
27
28
|
export * from './components/Switch/index.ts';
|
|
28
29
|
export * from './components/Tabs/index.ts';
|
|
29
30
|
export * from './components/TextArea/index.ts';
|
package/dist/index.js
CHANGED
|
@@ -30,16 +30,17 @@ import { RadioButton as Mo, RadioButtonStyle as wo, radioCheckedIconCss as Ao, r
|
|
|
30
30
|
import { RadioGroup as Fo } from "./components/RadioButton/RadioGroup.js";
|
|
31
31
|
import { Search as Uo, SearchStyle as Wo } from "./components/Search/Search.js";
|
|
32
32
|
import { Select as qo, SelectStyle as zo } from "./components/Select/Select.js";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
33
|
+
import { Steps as Ho } from "./components/Steps/Steps.js";
|
|
34
|
+
import { Switch as Ko, SwitchStyle as Oo } from "./components/Switch/Switch.js";
|
|
35
|
+
import { Tabs as Vo, TabsStyle as Xo } from "./components/Tabs/Tabs.js";
|
|
36
|
+
import { TabItem as Zo, TabItemStyle as _o } from "./components/Tabs/TabItem.js";
|
|
37
|
+
import { TextArea as or } from "./components/TextArea/TextArea.js";
|
|
38
|
+
import { TextField as er } from "./components/TextField/TextField.js";
|
|
39
|
+
import { Toast as ar, ToastStyle as pr, toaster as mr } from "./components/Toast/Toast.js";
|
|
40
|
+
import { Tooltip as ir } from "./components/Tooltip/Tooltip.js";
|
|
41
|
+
import { TopAppBar as fr } from "./components/TopAppBar/TopAppBar.js";
|
|
42
|
+
import { DataTableComponent as cr } from "./components/DataTable/DataTableComponent.js";
|
|
43
|
+
import { parse as lr } from "./node_modules/@zag-js/date-picker/dist/index.js";
|
|
43
44
|
export {
|
|
44
45
|
a as Accordion,
|
|
45
46
|
m as AccordionGroup,
|
|
@@ -60,7 +61,7 @@ export {
|
|
|
60
61
|
K as ChoiceBoxStyle,
|
|
61
62
|
Q as DashboardWidget,
|
|
62
63
|
X as DataTable,
|
|
63
|
-
|
|
64
|
+
cr as DataTableComponent,
|
|
64
65
|
Z as DatePicker,
|
|
65
66
|
$ as Divider,
|
|
66
67
|
oo as DividerStyle,
|
|
@@ -88,18 +89,19 @@ export {
|
|
|
88
89
|
zo as SelectStyle,
|
|
89
90
|
D as SerendieChartTheme,
|
|
90
91
|
e as SerendiePreset,
|
|
91
|
-
Ho as
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
or as
|
|
99
|
-
er as
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
ir as
|
|
92
|
+
Ho as Steps,
|
|
93
|
+
Ko as Switch,
|
|
94
|
+
Oo as SwitchStyle,
|
|
95
|
+
Zo as TabItem,
|
|
96
|
+
_o as TabItemStyle,
|
|
97
|
+
Vo as Tabs,
|
|
98
|
+
Xo as TabsStyle,
|
|
99
|
+
or as TextArea,
|
|
100
|
+
er as TextField,
|
|
101
|
+
ar as Toast,
|
|
102
|
+
pr as ToastStyle,
|
|
103
|
+
ir as Tooltip,
|
|
104
|
+
fr as TopAppBar,
|
|
103
105
|
q as checkboxCheckedIconCss,
|
|
104
106
|
z as checkboxIconCss,
|
|
105
107
|
E as checkboxUncheckedIconCss,
|
|
@@ -108,12 +110,12 @@ export {
|
|
|
108
110
|
M as getChartColor,
|
|
109
111
|
w as getChartColors,
|
|
110
112
|
A as legendChartMargin,
|
|
111
|
-
|
|
113
|
+
lr as parseDate,
|
|
112
114
|
Ao as radioCheckedIconCss,
|
|
113
115
|
Lo as radioIconCss,
|
|
114
116
|
No as radioUncheckedIconCss,
|
|
115
117
|
L as spaciousChartMargin,
|
|
116
|
-
|
|
118
|
+
mr as toaster,
|
|
117
119
|
N as useBarChartProps,
|
|
118
120
|
R as useChartProps,
|
|
119
121
|
F as useLineChartProps,
|