musae 0.1.8 → 0.1.10
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/button/span.js +4 -4
- package/dist/button/styled.js +4 -4
- package/dist/checkbox/styled.js +7 -6
- package/dist/{input → components/input}/types.d.ts +1 -1
- package/dist/{theme → components/theme}/hooks.d.ts +8 -1
- package/dist/icons/hooks.js +1 -3
- package/dist/input/label.js +5 -5
- package/dist/input/styled.js +4 -4
- package/dist/message/styled.js +4 -4
- package/dist/radio/styled.js +4 -4
- package/dist/switch/styled.js +5 -5
- package/dist/theme/hooks.js +10 -15
- package/dist/utils/object.d.ts +6 -0
- package/dist/utils/object.js +12 -0
- package/package.json +1 -1
- /package/dist/{avatar → components/avatar}/avatar.d.ts +0 -0
- /package/dist/{avatar → components/avatar}/fallback.d.ts +0 -0
- /package/dist/{avatar → components/avatar}/image.d.ts +0 -0
- /package/dist/{avatar → components/avatar}/index.d.ts +0 -0
- /package/dist/{button → components/button}/button.d.ts +0 -0
- /package/dist/{button → components/button}/index.d.ts +0 -0
- /package/dist/{button → components/button}/span.d.ts +0 -0
- /package/dist/{button → components/button}/styled.d.ts +0 -0
- /package/dist/{button → components/button}/types.d.ts +0 -0
- /package/dist/{checkbox → components/checkbox}/checkbox.d.ts +0 -0
- /package/dist/{checkbox → components/checkbox}/context.d.ts +0 -0
- /package/dist/{checkbox → components/checkbox}/group.d.ts +0 -0
- /package/dist/{checkbox → components/checkbox}/index.d.ts +0 -0
- /package/dist/{checkbox → components/checkbox}/styled.d.ts +0 -0
- /package/dist/{checkbox → components/checkbox}/types.d.ts +0 -0
- /package/dist/{divider → components/divider}/divider.d.ts +0 -0
- /package/dist/{divider → components/divider}/index.d.ts +0 -0
- /package/dist/{divider → components/divider}/styled.d.ts +0 -0
- /package/dist/{divider → components/divider}/types.d.ts +0 -0
- /package/dist/{icons → components/icons}/hooks.d.ts +0 -0
- /package/dist/{icons → components/icons}/navigate-before.d.ts +0 -0
- /package/dist/{icons → components/icons}/types.d.ts +0 -0
- /package/dist/{index.d.ts → components/index.d.ts} +0 -0
- /package/dist/{input → components/input}/hooks.d.ts +0 -0
- /package/dist/{input → components/input}/index.d.ts +0 -0
- /package/dist/{input → components/input}/input.d.ts +0 -0
- /package/dist/{input → components/input}/label.d.ts +0 -0
- /package/dist/{input → components/input}/styled.d.ts +0 -0
- /package/dist/{loading → components/loading}/circle.d.ts +0 -0
- /package/dist/{loading → components/loading}/index.d.ts +0 -0
- /package/dist/{loading → components/loading}/loading.d.ts +0 -0
- /package/dist/{loading → components/loading}/styled.d.ts +0 -0
- /package/dist/{loading → components/loading}/types.d.ts +0 -0
- /package/dist/{menu → components/menu}/context.d.ts +0 -0
- /package/dist/{menu → components/menu}/group.d.ts +0 -0
- /package/dist/{menu → components/menu}/index.d.ts +0 -0
- /package/dist/{menu → components/menu}/menu.d.ts +0 -0
- /package/dist/{menu → components/menu}/styled.d.ts +0 -0
- /package/dist/{menu → components/menu}/types.d.ts +0 -0
- /package/dist/{message → components/message}/holder.d.ts +0 -0
- /package/dist/{message → components/message}/hooks.d.ts +0 -0
- /package/dist/{message → components/message}/index.d.ts +0 -0
- /package/dist/{message → components/message}/message.d.ts +0 -0
- /package/dist/{message → components/message}/styled.d.ts +0 -0
- /package/dist/{message → components/message}/types.d.ts +0 -0
- /package/dist/{popper → components/popper}/index.d.ts +0 -0
- /package/dist/{popper → components/popper}/popper.d.ts +0 -0
- /package/dist/{popper → components/popper}/styled.d.ts +0 -0
- /package/dist/{popper → components/popper}/types.d.ts +0 -0
- /package/dist/{radio → components/radio}/context.d.ts +0 -0
- /package/dist/{radio → components/radio}/group.d.ts +0 -0
- /package/dist/{radio → components/radio}/index.d.ts +0 -0
- /package/dist/{radio → components/radio}/radio.d.ts +0 -0
- /package/dist/{radio → components/radio}/styled.d.ts +0 -0
- /package/dist/{radio → components/radio}/types.d.ts +0 -0
- /package/dist/{row → components/row}/index.d.ts +0 -0
- /package/dist/{row → components/row}/row.d.ts +0 -0
- /package/dist/{row → components/row}/styled.d.ts +0 -0
- /package/dist/{row → components/row}/types.d.ts +0 -0
- /package/dist/{select → components/select}/hooks.d.ts +0 -0
- /package/dist/{select → components/select}/index.d.ts +0 -0
- /package/dist/{select → components/select}/select.d.ts +0 -0
- /package/dist/{select → components/select}/types.d.ts +0 -0
- /package/dist/{switch → components/switch}/index.d.ts +0 -0
- /package/dist/{switch → components/switch}/styled.d.ts +0 -0
- /package/dist/{switch → components/switch}/switch.d.ts +0 -0
- /package/dist/{switch → components/switch}/types.d.ts +0 -0
- /package/dist/{theme → components/theme}/theme-provider.d.ts +0 -0
- /package/dist/{theme → components/theme}/types.d.ts +0 -0
package/dist/button/span.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
2
|
+
import { useValidTheme } from '../theme/hooks.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @author murukal
|
|
@@ -7,10 +7,10 @@ import { useTheme } from '../theme/hooks.js';
|
|
|
7
7
|
* @description
|
|
8
8
|
* content
|
|
9
9
|
*/
|
|
10
|
-
const Span = styled.span(() => {
|
|
10
|
+
const Span = styled.span(({ theme }) => {
|
|
11
11
|
var _a, _b;
|
|
12
|
-
const
|
|
13
|
-
return Object.assign({ marginLeft: 8, marginRight: 8, color: "#fff" }, (_b = (_a =
|
|
12
|
+
const validTheme = useValidTheme(theme);
|
|
13
|
+
return Object.assign({ marginLeft: 8, marginRight: 8, color: "#fff" }, (_b = (_a = validTheme.typography) === null || _a === void 0 ? void 0 : _a.label) === null || _b === void 0 ? void 0 : _b.large);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
export { Span as default };
|
package/dist/button/styled.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
2
|
+
import { useValidTheme } from '../theme/hooks.js';
|
|
3
3
|
|
|
4
|
-
const Wrapper = styled.button(() => {
|
|
4
|
+
const Wrapper = styled.button(({ theme }) => {
|
|
5
5
|
var _a;
|
|
6
|
-
const
|
|
6
|
+
const validTheme = useValidTheme(theme);
|
|
7
7
|
return {
|
|
8
8
|
borderRadius: 999,
|
|
9
9
|
padding: "10px 16px",
|
|
10
|
-
backgroundColor: (_a =
|
|
10
|
+
backgroundColor: (_a = validTheme.colors) === null || _a === void 0 ? void 0 : _a.primary,
|
|
11
11
|
border: "none",
|
|
12
12
|
};
|
|
13
13
|
});
|
package/dist/checkbox/styled.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
2
|
+
import { useValidTheme } from '../theme/hooks.js';
|
|
3
3
|
|
|
4
|
-
const Wrapper = styled.input(() => {
|
|
5
|
-
var _a
|
|
6
|
-
const
|
|
4
|
+
const Wrapper = styled.input(({ theme }) => {
|
|
5
|
+
var _a;
|
|
6
|
+
const validTheme = useValidTheme(theme);
|
|
7
|
+
const primaryColor = (_a = validTheme.colors) === null || _a === void 0 ? void 0 : _a.primary;
|
|
7
8
|
return {
|
|
8
9
|
margin: 0,
|
|
9
10
|
visibility: "hidden",
|
|
@@ -24,8 +25,8 @@ const Wrapper = styled.input(() => {
|
|
|
24
25
|
},
|
|
25
26
|
"&[aria-checked=true]": {
|
|
26
27
|
"::before": {
|
|
27
|
-
backgroundColor:
|
|
28
|
-
borderColor:
|
|
28
|
+
backgroundColor: primaryColor,
|
|
29
|
+
borderColor: primaryColor,
|
|
29
30
|
},
|
|
30
31
|
"::after": {
|
|
31
32
|
content: "''",
|
|
@@ -6,7 +6,14 @@ import type { Theme } from "./types";
|
|
|
6
6
|
* we set some presets theme
|
|
7
7
|
* let ui components display well
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const DEFAULT_THEME: Theme;
|
|
10
|
+
/**
|
|
11
|
+
* @author murukal
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* use valid theme for components
|
|
15
|
+
*/
|
|
16
|
+
export declare const useValidTheme: (usedTheme: Theme) => Theme;
|
|
10
17
|
/**
|
|
11
18
|
* @author murukal
|
|
12
19
|
*
|
package/dist/icons/hooks.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useTheme } from '../theme/hooks.js';
|
|
3
2
|
|
|
4
3
|
const useIconProps = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const size = useMemo(() => props.size || 24, [props.size, theme]);
|
|
4
|
+
const size = useMemo(() => props.size || 24, [props.size]);
|
|
7
5
|
const color = useMemo(() => props.color || "white", [props.color]);
|
|
8
6
|
return { size, color };
|
|
9
7
|
};
|
package/dist/input/label.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
2
|
+
import { useValidTheme } from '../theme/hooks.js';
|
|
3
3
|
|
|
4
|
-
const Label = styled.legend(({ isFocused }) => {
|
|
4
|
+
const Label = styled.legend(({ isFocused, theme }) => {
|
|
5
5
|
var _a, _b, _c;
|
|
6
|
-
const
|
|
7
|
-
return Object.assign(Object.assign(Object.assign({}, (_b = (_a =
|
|
6
|
+
const validTheme = useValidTheme(theme);
|
|
7
|
+
return Object.assign(Object.assign(Object.assign({}, (_b = (_a = validTheme.typography) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.small), {
|
|
8
8
|
// layout
|
|
9
9
|
paddingInlineStart: 4, paddingInlineEnd: 4 }), (isFocused && {
|
|
10
|
-
color: (_c =
|
|
10
|
+
color: (_c = validTheme.colors) === null || _c === void 0 ? void 0 : _c.primary,
|
|
11
11
|
}));
|
|
12
12
|
});
|
|
13
13
|
|
package/dist/input/styled.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
2
|
+
import { useValidTheme } from '../theme/hooks.js';
|
|
3
3
|
|
|
4
|
-
const Wrapper = styled.fieldset(({ isFocused }) => {
|
|
4
|
+
const Wrapper = styled.fieldset(({ isFocused, theme }) => {
|
|
5
5
|
var _a;
|
|
6
|
-
const
|
|
6
|
+
const validTheme = useValidTheme(theme);
|
|
7
7
|
return Object.assign({ textAlign: "start", height: 56, margin: 0, paddingTop: 0, paddingBottom: 0, display: "flex", alignItems: "center", borderColor: "#79747e", borderWidth: 1, borderStyle: "solid", borderRadius: 4, boxSizing: "border-box" }, (isFocused && {
|
|
8
|
-
borderColor: (_a =
|
|
8
|
+
borderColor: (_a = validTheme.colors) === null || _a === void 0 ? void 0 : _a.primary,
|
|
9
9
|
borderWidth: 2,
|
|
10
10
|
}));
|
|
11
11
|
});
|
package/dist/message/styled.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
2
|
+
import { useValidTheme } from '../theme/hooks.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @author murukal
|
|
@@ -24,10 +24,10 @@ const HolderWrapper = styled.div(() => {
|
|
|
24
24
|
* @description
|
|
25
25
|
* wrapper of message
|
|
26
26
|
*/
|
|
27
|
-
const MessageWrapper = styled.div(() => {
|
|
27
|
+
const MessageWrapper = styled.div(({ theme }) => {
|
|
28
28
|
var _a;
|
|
29
|
-
const
|
|
30
|
-
return Object.assign({ marginTop: 8, marginBottom: 8, padding: "8px 12px", borderRadius: 6, backgroundColor: "#ffffff" }, (_a =
|
|
29
|
+
const validTheme = useValidTheme(theme);
|
|
30
|
+
return Object.assign({ marginTop: 8, marginBottom: 8, padding: "8px 12px", borderRadius: 6, backgroundColor: "#ffffff" }, (_a = validTheme.elevations) === null || _a === void 0 ? void 0 : _a[1]);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
export { HolderWrapper, MessageWrapper };
|
package/dist/radio/styled.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
2
|
+
import { useValidTheme } from '../theme/hooks.js';
|
|
3
3
|
|
|
4
|
-
const Wrapper = styled.input(() => {
|
|
4
|
+
const Wrapper = styled.input(({ theme }) => {
|
|
5
5
|
var _a;
|
|
6
|
-
const
|
|
6
|
+
const validTheme = useValidTheme(theme);
|
|
7
7
|
return {
|
|
8
8
|
visibility: "hidden",
|
|
9
9
|
margin: 0,
|
|
@@ -25,7 +25,7 @@ const Wrapper = styled.input(() => {
|
|
|
25
25
|
"&[aria-checked=true]": {
|
|
26
26
|
"::after": {
|
|
27
27
|
borderWidth: "0.3rem",
|
|
28
|
-
borderColor: (_a =
|
|
28
|
+
borderColor: (_a = validTheme.colors) === null || _a === void 0 ? void 0 : _a.primary,
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
};
|
package/dist/switch/styled.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import {
|
|
2
|
+
import { useValidTheme } from '../theme/hooks.js';
|
|
3
3
|
|
|
4
|
-
const Wrapper = styled.div(() => {
|
|
4
|
+
const Wrapper = styled.div(({ theme }) => {
|
|
5
5
|
var _a, _b;
|
|
6
|
-
const
|
|
6
|
+
const validTheme = useValidTheme(theme);
|
|
7
7
|
return {
|
|
8
8
|
width: "1.8rem",
|
|
9
9
|
height: "1rem",
|
|
@@ -24,8 +24,8 @@ const Wrapper = styled.div(() => {
|
|
|
24
24
|
transition: "all .2s",
|
|
25
25
|
},
|
|
26
26
|
"&[aria-selected=true]": {
|
|
27
|
-
borderColor: (_a =
|
|
28
|
-
backgroundColor: (_b =
|
|
27
|
+
borderColor: (_a = validTheme.colors) === null || _a === void 0 ? void 0 : _a.primary,
|
|
28
|
+
backgroundColor: (_b = validTheme.colors) === null || _b === void 0 ? void 0 : _b.primary,
|
|
29
29
|
"::before": {
|
|
30
30
|
translate: "100%",
|
|
31
31
|
backgroundColor: "white",
|
package/dist/theme/hooks.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import '@emotion/react';
|
|
3
|
+
import { isEmpty } from '../utils/object.js';
|
|
3
4
|
|
|
4
5
|
const palettes = {
|
|
5
6
|
primary: {
|
|
@@ -85,7 +86,7 @@ const palettes = {
|
|
|
85
86
|
* we set some presets theme
|
|
86
87
|
* let ui components display well
|
|
87
88
|
*/
|
|
88
|
-
const
|
|
89
|
+
const DEFAULT_THEME = {
|
|
89
90
|
colors: {
|
|
90
91
|
primary: palettes.primary[40],
|
|
91
92
|
secondary: palettes.secondary[40],
|
|
@@ -139,18 +140,12 @@ const presets = {
|
|
|
139
140
|
* @author murukal
|
|
140
141
|
*
|
|
141
142
|
* @description
|
|
142
|
-
*
|
|
143
|
-
* because emotion theme has the default value
|
|
144
|
-
* but the default value can not be changed
|
|
145
|
-
* set the preset theme for musae ui component
|
|
143
|
+
* use valid theme for components
|
|
146
144
|
*/
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// when is empty, we always think there are not any theme. use presets!!!
|
|
153
|
-
return useMemo(() => (isThemeEmpty ? presets : theme), [theme, isThemeEmpty]);
|
|
154
|
-
};
|
|
145
|
+
const useValidTheme = (usedTheme) => useMemo(() => {
|
|
146
|
+
if (isEmpty(usedTheme))
|
|
147
|
+
return DEFAULT_THEME;
|
|
148
|
+
return usedTheme;
|
|
149
|
+
}, [usedTheme]);
|
|
155
150
|
|
|
156
|
-
export {
|
|
151
|
+
export { DEFAULT_THEME, useValidTheme };
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|