@zeturn/watercolor-react 1.1.46 → 1.2.0
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/dist/src/ThemeReact.d.ts +13 -10
- package/dist/src/ThemeReact.d.ts.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/src/components/Alert/Alert.d.ts.map +1 -1
- package/dist/src/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/src/components/Banner/Banner.d.ts.map +1 -1
- package/dist/src/components/Button/Button.d.ts.map +1 -1
- package/dist/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/src/components/Card/Card.d.ts +2 -1
- package/dist/src/components/Card/Card.d.ts.map +1 -1
- package/dist/src/components/Chip/Chip.d.ts +3 -1
- package/dist/src/components/Chip/Chip.d.ts.map +1 -1
- package/dist/src/components/Copy/Copy.d.ts.map +1 -1
- package/dist/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/src/components/Feature/Feature.d.ts +2 -2
- package/dist/src/components/Feature/Feature.d.ts.map +1 -1
- package/dist/src/components/Feed/Feed.d.ts.map +1 -1
- package/dist/src/components/FileInput/FileInput.d.ts +3 -1
- package/dist/src/components/FileInput/FileInput.d.ts.map +1 -1
- package/dist/src/components/Form/FormControlLabel.d.ts +2 -1
- package/dist/src/components/Form/FormControlLabel.d.ts.map +1 -1
- package/dist/src/components/Grid/Grid.d.ts.map +1 -1
- package/dist/src/components/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/src/components/Inline/Inline.d.ts +24 -0
- package/dist/src/components/Inline/Inline.d.ts.map +1 -0
- package/dist/src/components/List/List.d.ts.map +1 -1
- package/dist/src/components/Menu/Menu.d.ts.map +1 -1
- package/dist/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/src/components/NumberAnimation/NumberAnimation.d.ts.map +1 -1
- package/dist/src/components/Page/Page.d.ts +20 -0
- package/dist/src/components/Page/Page.d.ts.map +1 -0
- package/dist/src/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/src/components/Paper/Paper.d.ts +8 -1
- package/dist/src/components/Paper/Paper.d.ts.map +1 -1
- package/dist/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/src/components/Progress/Progress.d.ts.map +1 -1
- package/dist/src/components/Radio/Radio.d.ts.map +1 -1
- package/dist/src/components/Rating/Rating.d.ts +3 -4
- package/dist/src/components/Rating/Rating.d.ts.map +1 -1
- package/dist/src/components/Select/Select.d.ts.map +1 -1
- package/dist/src/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/src/components/SlideOver/SlideOver.d.ts.map +1 -1
- package/dist/src/components/Slider/Slider.d.ts +3 -4
- package/dist/src/components/Slider/Slider.d.ts.map +1 -1
- package/dist/src/components/Snackbar/Snackbar.d.ts.map +1 -1
- package/dist/src/components/Split/Split.d.ts +24 -0
- package/dist/src/components/Split/Split.d.ts.map +1 -0
- package/dist/src/components/Stack/Stack.d.ts +20 -0
- package/dist/src/components/Stack/Stack.d.ts.map +1 -0
- package/dist/src/components/Status/Status.d.ts.map +1 -1
- package/dist/src/components/Switch/Switch.d.ts.map +1 -1
- package/dist/src/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/src/components/Typography/Typography.d.ts.map +1 -1
- package/dist/src/composition.d.ts +38 -0
- package/dist/src/composition.d.ts.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/utils/theme.d.ts +2 -166
- package/dist/src/utils/theme.d.ts.map +1 -1
- package/dist/watercolor-react.css +1 -1
- package/dist/watercolor-react.es.js +2104 -1860
- package/dist/watercolor-react.umd.js +2 -38
- package/index.d.ts +49 -1
- package/package.json +7 -2
- package/dist/src/utils/themeManager.d.ts +0 -23
- package/dist/src/utils/themeManager.d.ts.map +0 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
|
-
import type { ComponentType } from 'react'
|
|
1
|
+
import type { ComponentPropsWithoutRef, ComponentType, ElementType, ReactElement, ReactNode } from 'react'
|
|
2
|
+
import type {
|
|
3
|
+
CompositionAlign,
|
|
4
|
+
CompositionGap,
|
|
5
|
+
InlineJustify,
|
|
6
|
+
PageGutter,
|
|
7
|
+
PageSize,
|
|
8
|
+
SplitCollapse,
|
|
9
|
+
SplitRatio,
|
|
10
|
+
} from '@zeturn/watercolor-core'
|
|
2
11
|
|
|
3
12
|
type WatercolorComponent = ComponentType<any>
|
|
13
|
+
type PolymorphicProps<T extends ElementType, OwnProps> = OwnProps &
|
|
14
|
+
Omit<ComponentPropsWithoutRef<T>, keyof OwnProps | 'as'> & { as?: T }
|
|
15
|
+
type CompositionBaseProps = { children?: ReactNode; className?: string }
|
|
16
|
+
|
|
17
|
+
export type PageProps<T extends ElementType = 'div'> = PolymorphicProps<T, CompositionBaseProps & {
|
|
18
|
+
size?: PageSize
|
|
19
|
+
gutter?: PageGutter
|
|
20
|
+
}>
|
|
21
|
+
export type StackProps<T extends ElementType = 'div'> = PolymorphicProps<T, CompositionBaseProps & {
|
|
22
|
+
gap?: CompositionGap
|
|
23
|
+
align?: CompositionAlign
|
|
24
|
+
}>
|
|
25
|
+
export type InlineProps<T extends ElementType = 'div'> = PolymorphicProps<T, CompositionBaseProps & {
|
|
26
|
+
gap?: CompositionGap
|
|
27
|
+
align?: CompositionAlign
|
|
28
|
+
justify?: InlineJustify
|
|
29
|
+
wrap?: boolean
|
|
30
|
+
}>
|
|
31
|
+
export type SplitProps<T extends ElementType = 'div'> = PolymorphicProps<T, CompositionBaseProps & {
|
|
32
|
+
ratio?: SplitRatio
|
|
33
|
+
gap?: CompositionGap
|
|
34
|
+
align?: CompositionAlign
|
|
35
|
+
collapse?: SplitCollapse
|
|
36
|
+
}>
|
|
37
|
+
|
|
38
|
+
export type {
|
|
39
|
+
CompositionAlign,
|
|
40
|
+
CompositionGap,
|
|
41
|
+
InlineJustify,
|
|
42
|
+
PageGutter,
|
|
43
|
+
PageSize,
|
|
44
|
+
SplitCollapse,
|
|
45
|
+
SplitRatio,
|
|
46
|
+
} from '@zeturn/watercolor-core'
|
|
4
47
|
|
|
5
48
|
export const Accordion: WatercolorComponent
|
|
6
49
|
export const Alert: WatercolorComponent
|
|
@@ -36,6 +79,7 @@ export const HoverCard: WatercolorComponent
|
|
|
36
79
|
export const Icon: WatercolorComponent
|
|
37
80
|
export const IconButton: WatercolorComponent
|
|
38
81
|
export const ImageGallery: WatercolorComponent
|
|
82
|
+
export const Inline: <T extends ElementType = 'div'>(props: InlineProps<T>) => ReactElement | null
|
|
39
83
|
export const Input: WatercolorComponent
|
|
40
84
|
export const List: WatercolorComponent
|
|
41
85
|
export const ListItem: WatercolorComponent
|
|
@@ -45,6 +89,7 @@ export const Menu: WatercolorComponent
|
|
|
45
89
|
export const Modal: WatercolorComponent
|
|
46
90
|
export const NumberAnimation: WatercolorComponent
|
|
47
91
|
export const Pagination: WatercolorComponent
|
|
92
|
+
export const Page: <T extends ElementType = 'div'>(props: PageProps<T>) => ReactElement | null
|
|
48
93
|
export const Paper: WatercolorComponent
|
|
49
94
|
export const Popover: WatercolorComponent
|
|
50
95
|
export const PricingTable: WatercolorComponent
|
|
@@ -56,6 +101,8 @@ export const Select: WatercolorComponent
|
|
|
56
101
|
export const Skeleton: WatercolorComponent
|
|
57
102
|
export const Slider: WatercolorComponent
|
|
58
103
|
export const SlideOver: WatercolorComponent
|
|
104
|
+
export const Split: <T extends ElementType = 'div'>(props: SplitProps<T>) => ReactElement | null
|
|
105
|
+
export const Stack: <T extends ElementType = 'div'>(props: StackProps<T>) => ReactElement | null
|
|
59
106
|
export const Snackbar: WatercolorComponent
|
|
60
107
|
export const Status: WatercolorComponent
|
|
61
108
|
export const Switch: WatercolorComponent
|
|
@@ -76,3 +123,4 @@ export const Watermark: WatercolorComponent
|
|
|
76
123
|
|
|
77
124
|
export * from './dist/src/utils/theme'
|
|
78
125
|
export { ThemeProvider, useTheme } from './dist/src/ThemeReact'
|
|
126
|
+
export type { ThemeContextValue, ThemeProviderProps } from './dist/src/ThemeReact'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeturn/watercolor-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/watercolor-react.umd.js",
|
|
6
6
|
"module": "dist/watercolor-react.es.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"import": "./dist/watercolor-react.es.js",
|
|
13
13
|
"require": "./dist/watercolor-react.umd.js"
|
|
14
14
|
},
|
|
15
|
-
"./style.css": "./
|
|
15
|
+
"./style.css": "./dist/watercolor-react.css"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist",
|
|
@@ -54,6 +54,11 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@zeturn/watercolor-core": "*",
|
|
57
|
+
"@zeturn/watercolor-icons-feather": "*",
|
|
58
|
+
"@zeturn/watercolor-icons-heroicons-react": "*",
|
|
59
|
+
"@zeturn/watercolor-icons-lucide-react": "*",
|
|
60
|
+
"@zeturn/watercolor-icons-phosphor-react": "*",
|
|
61
|
+
"@zeturn/watercolor-icons-tabler-react": "*",
|
|
57
62
|
"prop-types": "^15.8.1"
|
|
58
63
|
},
|
|
59
64
|
"devDependencies": {
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { themes } from './theme';
|
|
2
|
-
export type ColorTheme = keyof typeof themes;
|
|
3
|
-
export interface ThemeManager {
|
|
4
|
-
/** 当前颜色主题名 */
|
|
5
|
-
color: ColorTheme;
|
|
6
|
-
/** 是否暗黑模式 */
|
|
7
|
-
dark: boolean;
|
|
8
|
-
/** 设置颜色主题 */
|
|
9
|
-
setColor: (c: ColorTheme) => void;
|
|
10
|
-
/** 切换暗黑模式 */
|
|
11
|
-
toggleDark: () => void;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 创建一个跨框架可复用的主题管理器
|
|
15
|
-
* ─ 负责:
|
|
16
|
-
* • 从 localStorage 读取初始色彩/明暗偏好
|
|
17
|
-
* • 同步调用 applyTheme / toggleDarkMode 修改 DOM
|
|
18
|
-
* • 把结果写回 localStorage
|
|
19
|
-
* @param defaultColor 默认颜色主题
|
|
20
|
-
* @param defaultDark 默认暗黑模式
|
|
21
|
-
*/
|
|
22
|
-
export declare function createThemeManager(defaultColor?: ColorTheme, defaultDark?: boolean): ThemeManager;
|
|
23
|
-
//# sourceMappingURL=themeManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"themeManager.d.ts","sourceRoot":"","sources":["../../../src/utils/themeManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,MAAM,CAAA;AAE5C,MAAM,WAAW,YAAY;IAC3B,cAAc;IACd,KAAK,EAAE,UAAU,CAAA;IACjB,aAAa;IACb,IAAI,EAAE,OAAO,CAAA;IACb,aAAa;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;IACjC,aAAa;IACb,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB;AAMD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,GAAE,UAAsB,EACpC,WAAW,GAAE,OAAe,GAC3B,YAAY,CAmEd"}
|