@serendie/ui 2.5.0 → 2.5.1-dev.202602170627

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.
Files changed (52) hide show
  1. package/README.md +63 -8
  2. package/dist/client.js +135 -119
  3. package/dist/components/Avatar/Avatar.js +3 -3
  4. package/dist/components/Badge/Badge.d.ts +6 -6
  5. package/dist/components/Badge/Badge.js +21 -21
  6. package/dist/components/Banner/Banner.d.ts +1 -4
  7. package/dist/components/Banner/Banner.js +8 -11
  8. package/dist/components/Button/Button.d.ts +0 -2
  9. package/dist/components/Button/Button.js +10 -11
  10. package/dist/components/CheckBox/CheckBox.js +4 -4
  11. package/dist/components/DatePicker/styles.js +1 -1
  12. package/dist/components/Divider/Divider.d.ts +2 -2
  13. package/dist/components/Divider/Divider.js +11 -11
  14. package/dist/components/Drawer/Drawer.js +3 -3
  15. package/dist/components/DropdownMenu/DropdownMenu.js +5 -5
  16. package/dist/components/IconButton/IconButton.d.ts +0 -1
  17. package/dist/components/IconButton/IconButton.js +0 -1
  18. package/dist/components/ModalDialog/ModalDialog.js +1 -1
  19. package/dist/components/ProgressIndicator/ProgressIndicator.js +9 -9
  20. package/dist/components/Search/Search.js +5 -5
  21. package/dist/components/Select/Select.js +14 -14
  22. package/dist/components/Switch/Switch.js +5 -5
  23. package/dist/components/TextField/TextField.js +52 -48
  24. package/dist/components/Toast/Toast.d.ts +3 -5
  25. package/dist/components/Toast/Toast.js +8 -10
  26. package/dist/i18n/index.d.ts +1 -1
  27. package/dist/i18n/provider.d.ts +29 -4
  28. package/dist/i18n/provider.js +31 -11
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.js +135 -119
  31. package/dist/node_modules/@serendie/design-token/dist/panda-tokens.js +310 -0
  32. package/dist/node_modules/@serendie/design-token/dist/tokens.js +126 -0
  33. package/dist/preset.d.ts +0 -930
  34. package/dist/styled-system/css/conditions.js +1 -1
  35. package/dist/styled-system/jsx/is-valid-prop.js +1 -1
  36. package/dist/styles.css +1 -1
  37. package/dist/theme/ThemeContext.d.ts +55 -0
  38. package/dist/theme/ThemeContext.js +15 -0
  39. package/dist/theme/index.d.ts +3 -0
  40. package/dist/theme/index.js +11 -0
  41. package/dist/theme/initColorScheme.d.ts +74 -0
  42. package/dist/theme/initColorScheme.js +32 -0
  43. package/dist/theme/useSystemColorScheme.d.ts +15 -0
  44. package/dist/theme/useSystemColorScheme.js +19 -0
  45. package/dist/tokens/getToken.d.ts +0 -378
  46. package/dist/tokens/index.d.ts +0 -930
  47. package/package.json +2 -2
  48. package/styled-system/css/conditions.js +1 -1
  49. package/styled-system/jsx/is-valid-prop.js +1 -1
  50. package/styled-system/themes/index.d.ts +6 -1
  51. package/styled-system/themes/theme-konjo-dark.json +5 -0
  52. package/styled-system/types/conditions.d.ts +2 -0
@@ -1,13 +1,38 @@
1
+ import { ColorMode, ColorTheme } from '../theme/ThemeContext';
1
2
  export type Language = "ja" | "en";
2
3
  export declare const LanguageContext: import('react').Context<Language | undefined>;
4
+ export interface SerendieProviderProps {
5
+ /** 言語設定 */
6
+ lang: Language;
7
+ /** カラーテーマ(デフォルト: 'konjo') */
8
+ colorTheme?: ColorTheme;
9
+ /** カラーモード(デフォルト: undefined = ライトモード) */
10
+ colorMode?: ColorMode;
11
+ children: React.ReactNode;
12
+ }
3
13
  /**
4
14
  * Serendie UIの設定を提供するProvider
5
15
  * アプリケーションのルートで使用してください
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * // 基本的な使い方(言語のみ)
20
+ * <SerendieProvider lang="ja">
21
+ * <App />
22
+ * </SerendieProvider>
23
+ *
24
+ * // カラーモードを指定(OSの設定に従う)
25
+ * <SerendieProvider lang="ja" colorMode="system">
26
+ * <App />
27
+ * </SerendieProvider>
28
+ *
29
+ * // カラーテーマとモードを指定
30
+ * <SerendieProvider lang="ja" colorTheme="asagi" colorMode="system">
31
+ * <App />
32
+ * </SerendieProvider>
33
+ * ```
6
34
  */
7
- export declare function SerendieProvider({ lang, children, }: {
8
- lang: Language;
9
- children: React.ReactNode;
10
- }): import("react/jsx-runtime").JSX.Element;
35
+ export declare function SerendieProvider({ lang, colorTheme, colorMode, children, }: SerendieProviderProps): import("react/jsx-runtime").JSX.Element;
11
36
  /**
12
37
  * @deprecated LanguageProvider は SerendieProvider にリネームされました
13
38
  */
@@ -1,15 +1,35 @@
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
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { useMemo as m, useEffect as u, createContext as f } from "react";
3
+ import { resolveTheme as c, ThemeContext as v } from "../theme/ThemeContext.js";
4
+ import { useSystemColorScheme as h } from "../theme/useSystemColorScheme.js";
5
+ const l = f(void 0);
6
+ function p({
7
+ lang: d,
8
+ colorTheme: t = "konjo",
9
+ colorMode: o,
10
+ children: i
7
11
  }) {
8
- return /* @__PURE__ */ o(n.Provider, { value: e, children: r });
12
+ const r = h() === "dark", e = m(() => c(t, o ?? "light", r), [t, o, r]);
13
+ u(() => {
14
+ if (typeof document > "u") return;
15
+ const n = document.documentElement;
16
+ return e ? n.dataset.pandaTheme = e : delete n.dataset.pandaTheme, () => {
17
+ };
18
+ }, [e]);
19
+ const a = m(
20
+ () => ({
21
+ colorTheme: t,
22
+ colorMode: o ?? "light",
23
+ resolvedTheme: e,
24
+ systemPrefersDark: r
25
+ }),
26
+ [t, o, e, r]
27
+ );
28
+ return /* @__PURE__ */ s(l.Provider, { value: d, children: /* @__PURE__ */ s(v.Provider, { value: a, children: i }) });
9
29
  }
10
- const u = i;
30
+ const S = p;
11
31
  export {
12
- n as LanguageContext,
13
- u as LanguageProvider,
14
- i as SerendieProvider
32
+ l as LanguageContext,
33
+ S as LanguageProvider,
34
+ p as SerendieProvider
15
35
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export { SerendiePreset } from './preset';
2
+ export { ThemeContext, useThemeContext, useSystemColorScheme, resolveTheme, getColorSchemeScript, ColorSchemeScript, type ColorMode, type ColorTheme, type ThemeContextValue, type ColorSchemeScriptOptions, } from './theme/index';
3
+ export { SerendieProvider, LanguageProvider, useTranslations, getTranslations, formatDateByLang, type Language, type SerendieProviderProps, } from './i18n/index';
2
4
  export * from './components/Accordion/index.ts';
3
5
  export * from './components/Avatar/index.ts';
4
6
  export * from './components/Badge/index.ts';
package/dist/index.js CHANGED
@@ -1,121 +1,137 @@
1
- import { SerendiePreset as e } from "./preset.js";
2
- import { Accordion as a } from "./components/Accordion/Accordion.js";
3
- import { AccordionGroup as m } from "./components/Accordion/AccordionGroup.js";
4
- import { Avatar as i, AvatarStyle as n } from "./components/Avatar/Avatar.js";
5
- import { Badge as s, BadgeCloseButton as c, BadgeStyle as d } from "./components/Badge/Badge.js";
6
- import { Banner as h } from "./components/Banner/Banner.js";
7
- import { BottomNavigation as S } from "./components/BottomNavigation/BottomNavigation.js";
8
- import { BottomNavigationItem as g, BottomNavigationItemStyle as y } from "./components/BottomNavigation/BottomNavigationItem.js";
9
- import { Button as I, ButtonStyle as T } from "./components/Button/Button.js";
10
- import { SerendieChartTheme as D } from "./components/Chart/SerendieChartTheme.js";
11
- import { compactChartMargin as k, defaultChartMargin as v, getChartColor as M, getChartColors as w, legendChartMargin as A, spaciousChartMargin as L, useBarChartProps as N, useChartProps as R, useLineChartProps as F, usePieChartProps as G } from "./components/Chart/SerendieChartProps.js";
12
- import { CheckBox as W, CheckBoxStyle as j, checkboxCheckedIconCss as q, checkboxIconCss as z, checkboxUncheckedIconCss as E } from "./components/CheckBox/CheckBox.js";
13
- import { ChoiceBox as J, ChoiceBoxStyle as K } from "./components/ChoiceBox/ChoiceBox.js";
14
- import { DashboardWidget as Q } from "./components/DashboardWidget/DashboardWidget.js";
15
- import { DataTable as X } from "./components/DataTable/index.js";
16
- import { DatePicker as Z } from "./components/DatePicker/DatePicker.js";
17
- import { Divider as $, DividerStyle as oo } from "./components/Divider/Divider.js";
18
- import { Drawer as eo } from "./components/Drawer/Drawer.js";
19
- import { DropdownMenu as ao, DropdownMenuStyle as po } from "./components/DropdownMenu/DropdownMenu.js";
20
- import { IconButton as xo, IconButtonStyle as io } from "./components/IconButton/IconButton.js";
21
- import { List as fo } from "./components/List/List.js";
22
- import { ListItem as co, ListItemStyle as lo } from "./components/List/ListItem.js";
23
- import { ModalDialog as Co } from "./components/ModalDialog/ModalDialog.js";
24
- import { NotificationBadge as Bo } from "./components/NotificationBadge/NotificationBadge.js";
25
- import { Pagination as yo, PaginationStyle as uo } from "./components/Pagination/Pagination.js";
26
- import { PasswordField as To } from "./components/PasswordField/PasswordField.js";
27
- import { ProgressIndicator as Do } from "./components/ProgressIndicator/ProgressIndicator.js";
28
- import { ProgressIndicatorIndeterminate as ko } from "./components/ProgressIndicator/ProgressIndicatorIndeterminate.js";
29
- import { RadioButton as Mo, RadioButtonStyle as wo, radioCheckedIconCss as Ao, radioIconCss as Lo, radioUncheckedIconCss as No } from "./components/RadioButton/RadioButton.js";
30
- import { RadioGroup as Fo } from "./components/RadioButton/RadioGroup.js";
31
- import { Search as Uo, SearchStyle as Wo } from "./components/Search/Search.js";
32
- import { Select as qo, SelectStyle as zo } from "./components/Select/Select.js";
33
- import { Switch as Ho, SwitchStyle as Jo } from "./components/Switch/Switch.js";
34
- import { Tabs as Oo, TabsStyle as Qo } from "./components/Tabs/Tabs.js";
35
- import { TabItem as Xo, TabItemStyle as Yo } from "./components/Tabs/TabItem.js";
36
- import { TextArea as _o } from "./components/TextArea/TextArea.js";
37
- import { TextField as or } from "./components/TextField/TextField.js";
38
- import { Toast as er, ToastStyle as tr, toaster as ar } from "./components/Toast/Toast.js";
39
- import { Tooltip as mr } from "./components/Tooltip/Tooltip.js";
40
- import { TopAppBar as ir } from "./components/TopAppBar/TopAppBar.js";
41
- import { DataTableComponent as fr } from "./components/DataTable/DataTableComponent.js";
42
- import { parse as cr } from "./node_modules/@zag-js/date-picker/dist/index.js";
1
+ import { SerendiePreset as r } from "./preset.js";
2
+ import { ThemeContext as a, resolveTheme as m, useThemeContext as p } from "./theme/ThemeContext.js";
3
+ import { useSystemColorScheme as i } from "./theme/useSystemColorScheme.js";
4
+ import { ColorSchemeScript as s, getColorSchemeScript as f } from "./theme/initColorScheme.js";
5
+ import { formatDateByLang as l, getTranslations as d, useTranslations as h } from "./i18n/index.js";
6
+ import { Accordion as C } from "./components/Accordion/Accordion.js";
7
+ import { AccordionGroup as B } from "./components/Accordion/AccordionGroup.js";
8
+ import { Avatar as y, AvatarStyle as T } from "./components/Avatar/Avatar.js";
9
+ import { Badge as P, BadgeCloseButton as D, BadgeStyle as b } from "./components/Badge/Badge.js";
10
+ import { Banner as v } from "./components/Banner/Banner.js";
11
+ import { BottomNavigation as w } from "./components/BottomNavigation/BottomNavigation.js";
12
+ import { BottomNavigationItem as L, BottomNavigationItemStyle as N } from "./components/BottomNavigation/BottomNavigationItem.js";
13
+ import { Button as F, ButtonStyle as G } from "./components/Button/Button.js";
14
+ import { SerendieChartTheme as W } from "./components/Chart/SerendieChartTheme.js";
15
+ import { compactChartMargin as q, defaultChartMargin as z, getChartColor as E, getChartColors as H, legendChartMargin as J, spaciousChartMargin as K, useBarChartProps as O, useChartProps as Q, useLineChartProps as V, usePieChartProps as X } from "./components/Chart/SerendieChartProps.js";
16
+ import { CheckBox as Z, CheckBoxStyle as _, checkboxCheckedIconCss as $, checkboxIconCss as oo, checkboxUncheckedIconCss as eo } from "./components/CheckBox/CheckBox.js";
17
+ import { ChoiceBox as to, ChoiceBoxStyle as ao } from "./components/ChoiceBox/ChoiceBox.js";
18
+ import { DashboardWidget as po } from "./components/DashboardWidget/DashboardWidget.js";
19
+ import { DataTable as io } from "./components/DataTable/index.js";
20
+ import { DatePicker as so } from "./components/DatePicker/DatePicker.js";
21
+ import { Divider as co, DividerStyle as lo } from "./components/Divider/Divider.js";
22
+ import { Drawer as So } from "./components/Drawer/Drawer.js";
23
+ import { DropdownMenu as go, DropdownMenuStyle as Bo } from "./components/DropdownMenu/DropdownMenu.js";
24
+ import { IconButton as yo, IconButtonStyle as To } from "./components/IconButton/IconButton.js";
25
+ import { List as Po } from "./components/List/List.js";
26
+ import { ListItem as bo, ListItemStyle as ko } from "./components/List/ListItem.js";
27
+ import { ModalDialog as Mo } from "./components/ModalDialog/ModalDialog.js";
28
+ import { NotificationBadge as Ao } from "./components/NotificationBadge/NotificationBadge.js";
29
+ import { Pagination as No, PaginationStyle as Ro } from "./components/Pagination/Pagination.js";
30
+ import { PasswordField as Go } from "./components/PasswordField/PasswordField.js";
31
+ import { ProgressIndicator as Wo } from "./components/ProgressIndicator/ProgressIndicator.js";
32
+ import { ProgressIndicatorIndeterminate as qo } from "./components/ProgressIndicator/ProgressIndicatorIndeterminate.js";
33
+ import { RadioButton as Eo, RadioButtonStyle as Ho, radioCheckedIconCss as Jo, radioIconCss as Ko, radioUncheckedIconCss as Oo } from "./components/RadioButton/RadioButton.js";
34
+ import { RadioGroup as Vo } from "./components/RadioButton/RadioGroup.js";
35
+ import { Search as Yo, SearchStyle as Zo } from "./components/Search/Search.js";
36
+ import { Select as $o, SelectStyle as oe } from "./components/Select/Select.js";
37
+ import { Switch as re, SwitchStyle as te } from "./components/Switch/Switch.js";
38
+ import { Tabs as me, TabsStyle as pe } from "./components/Tabs/Tabs.js";
39
+ import { TabItem as ie, TabItemStyle as ne } from "./components/Tabs/TabItem.js";
40
+ import { TextArea as fe } from "./components/TextArea/TextArea.js";
41
+ import { TextField as le } from "./components/TextField/TextField.js";
42
+ import { Toast as he, ToastStyle as Se, toaster as Ce } from "./components/Toast/Toast.js";
43
+ import { Tooltip as Be } from "./components/Tooltip/Tooltip.js";
44
+ import { TopAppBar as ye } from "./components/TopAppBar/TopAppBar.js";
45
+ import { LanguageProvider as Ie, SerendieProvider as Pe } from "./i18n/provider.js";
46
+ import { DataTableComponent as be } from "./components/DataTable/DataTableComponent.js";
47
+ import { parse as ve } from "./node_modules/@zag-js/date-picker/dist/index.js";
43
48
  export {
44
- a as Accordion,
45
- m as AccordionGroup,
46
- i as Avatar,
47
- n as AvatarStyle,
48
- s as Badge,
49
- c as BadgeCloseButton,
50
- d as BadgeStyle,
51
- h as Banner,
52
- S as BottomNavigation,
53
- g as BottomNavigationItem,
54
- y as BottomNavigationItemStyle,
55
- I as Button,
56
- T as ButtonStyle,
57
- W as CheckBox,
58
- j as CheckBoxStyle,
59
- J as ChoiceBox,
60
- K as ChoiceBoxStyle,
61
- Q as DashboardWidget,
62
- X as DataTable,
63
- fr as DataTableComponent,
64
- Z as DatePicker,
65
- $ as Divider,
66
- oo as DividerStyle,
67
- eo as Drawer,
68
- ao as DropdownMenu,
69
- po as DropdownMenuStyle,
70
- xo as IconButton,
71
- io as IconButtonStyle,
72
- fo as List,
73
- co as ListItem,
74
- lo as ListItemStyle,
75
- Co as ModalDialog,
76
- Bo as NotificationBadge,
77
- yo as Pagination,
78
- uo as PaginationStyle,
79
- To as PasswordField,
80
- Do as ProgressIndicator,
81
- ko as ProgressIndicatorIndeterminate,
82
- Mo as RadioButton,
83
- wo as RadioButtonStyle,
84
- Fo as RadioGroup,
85
- Uo as Search,
86
- Wo as SearchStyle,
87
- qo as Select,
88
- zo as SelectStyle,
89
- D as SerendieChartTheme,
90
- e as SerendiePreset,
91
- Ho as Switch,
92
- Jo as SwitchStyle,
93
- Xo as TabItem,
94
- Yo as TabItemStyle,
95
- Oo as Tabs,
96
- Qo as TabsStyle,
97
- _o as TextArea,
98
- or as TextField,
99
- er as Toast,
100
- tr as ToastStyle,
101
- mr as Tooltip,
102
- ir as TopAppBar,
103
- q as checkboxCheckedIconCss,
104
- z as checkboxIconCss,
105
- E as checkboxUncheckedIconCss,
106
- k as compactChartMargin,
107
- v as defaultChartMargin,
108
- M as getChartColor,
109
- w as getChartColors,
110
- A as legendChartMargin,
111
- cr as parseDate,
112
- Ao as radioCheckedIconCss,
113
- Lo as radioIconCss,
114
- No as radioUncheckedIconCss,
115
- L as spaciousChartMargin,
116
- ar as toaster,
117
- N as useBarChartProps,
118
- R as useChartProps,
119
- F as useLineChartProps,
120
- G as usePieChartProps
49
+ C as Accordion,
50
+ B as AccordionGroup,
51
+ y as Avatar,
52
+ T as AvatarStyle,
53
+ P as Badge,
54
+ D as BadgeCloseButton,
55
+ b as BadgeStyle,
56
+ v as Banner,
57
+ w as BottomNavigation,
58
+ L as BottomNavigationItem,
59
+ N as BottomNavigationItemStyle,
60
+ F as Button,
61
+ G as ButtonStyle,
62
+ Z as CheckBox,
63
+ _ as CheckBoxStyle,
64
+ to as ChoiceBox,
65
+ ao as ChoiceBoxStyle,
66
+ s as ColorSchemeScript,
67
+ po as DashboardWidget,
68
+ io as DataTable,
69
+ be as DataTableComponent,
70
+ so as DatePicker,
71
+ co as Divider,
72
+ lo as DividerStyle,
73
+ So as Drawer,
74
+ go as DropdownMenu,
75
+ Bo as DropdownMenuStyle,
76
+ yo as IconButton,
77
+ To as IconButtonStyle,
78
+ Ie as LanguageProvider,
79
+ Po as List,
80
+ bo as ListItem,
81
+ ko as ListItemStyle,
82
+ Mo as ModalDialog,
83
+ Ao as NotificationBadge,
84
+ No as Pagination,
85
+ Ro as PaginationStyle,
86
+ Go as PasswordField,
87
+ Wo as ProgressIndicator,
88
+ qo as ProgressIndicatorIndeterminate,
89
+ Eo as RadioButton,
90
+ Ho as RadioButtonStyle,
91
+ Vo as RadioGroup,
92
+ Yo as Search,
93
+ Zo as SearchStyle,
94
+ $o as Select,
95
+ oe as SelectStyle,
96
+ W as SerendieChartTheme,
97
+ r as SerendiePreset,
98
+ Pe as SerendieProvider,
99
+ re as Switch,
100
+ te as SwitchStyle,
101
+ ie as TabItem,
102
+ ne as TabItemStyle,
103
+ me as Tabs,
104
+ pe as TabsStyle,
105
+ fe as TextArea,
106
+ le as TextField,
107
+ a as ThemeContext,
108
+ he as Toast,
109
+ Se as ToastStyle,
110
+ Be as Tooltip,
111
+ ye as TopAppBar,
112
+ $ as checkboxCheckedIconCss,
113
+ oo as checkboxIconCss,
114
+ eo as checkboxUncheckedIconCss,
115
+ q as compactChartMargin,
116
+ z as defaultChartMargin,
117
+ l as formatDateByLang,
118
+ E as getChartColor,
119
+ H as getChartColors,
120
+ f as getColorSchemeScript,
121
+ d as getTranslations,
122
+ J as legendChartMargin,
123
+ ve as parseDate,
124
+ Jo as radioCheckedIconCss,
125
+ Ko as radioIconCss,
126
+ Oo as radioUncheckedIconCss,
127
+ m as resolveTheme,
128
+ K as spaciousChartMargin,
129
+ Ce as toaster,
130
+ O as useBarChartProps,
131
+ Q as useChartProps,
132
+ V as useLineChartProps,
133
+ X as usePieChartProps,
134
+ i as useSystemColorScheme,
135
+ p as useThemeContext,
136
+ h as useTranslations
121
137
  };