@ainias42/react-bootstrap-mobile 1.0.7 → 1.0.9
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/Components/DesignProvider/Design.d.ts +4 -0
- package/dist/Components/DesignProvider/DesignContext.d.ts +3 -0
- package/dist/Components/DesignProvider/DesignProvider.d.ts +9 -0
- package/dist/Components/ThemeProvider/ThemeContext.d.ts +2 -0
- package/dist/Components/ThemeProvider/ThemeProvider.d.ts +7 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +72 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Components/DesignProvider/Design.ts +4 -0
- package/src/Components/DesignProvider/DesignContext.ts +8 -0
- package/src/Components/DesignProvider/DesignProvider.tsx +32 -0
- package/src/Components/FormElements/Switch/switch.module.scss +1 -1
- package/src/Components/ThemeProvider/ThemeContext.ts +7 -0
- package/src/Components/ThemeProvider/ThemeProvider.tsx +28 -0
- package/src/index.ts +5 -0
- package/src/scss/_colors.scss +15 -7
- package/src/scss/_designMixin.scss +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Design } from './Design';
|
|
2
|
+
import { DesignContext } from './DesignContext';
|
|
3
|
+
import { withMemo } from '../../helper/withMemo';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import type { ReactNode } from 'react';
|
|
7
|
+
|
|
8
|
+
export type DesignProviderProps = { design?: Design; children?: ReactNode; className?: string };
|
|
9
|
+
|
|
10
|
+
export const DesignProvider = withMemo(function DesignProvider({
|
|
11
|
+
design = Design.FLAT,
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
}: DesignProviderProps) {
|
|
15
|
+
// Refs
|
|
16
|
+
|
|
17
|
+
// States/Variables/Selectors
|
|
18
|
+
|
|
19
|
+
// Callbacks
|
|
20
|
+
|
|
21
|
+
// Effects
|
|
22
|
+
|
|
23
|
+
// Other
|
|
24
|
+
|
|
25
|
+
// RenderFunctions
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<DesignContext value={design}>
|
|
29
|
+
<div className={classNames(design, className)}>{children}</div>
|
|
30
|
+
</DesignContext>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
--switch-background: var(--foreground-primary);
|
|
18
18
|
--switch-box-shadow-color: var(--box-shadow-color);
|
|
19
19
|
--switch-handle-color: var(--foreground-primary);
|
|
20
|
-
--switch-handle-box-shadow-color:
|
|
20
|
+
--switch-handle-box-shadow-color: var(--curtain-light);
|
|
21
21
|
--switch-active-background-color: var(--flavor-accent);
|
|
22
22
|
--switch-active-box-shadow-color: var(--flavor-accent);
|
|
23
23
|
--switch-active-handle-color: var(--foreground-primary);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ThemeContext } from './ThemeContext';
|
|
2
|
+
import { withMemo } from '../../helper/withMemo';
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
export type ThemeProviderProps = { theme: string; children: ReactNode };
|
|
7
|
+
|
|
8
|
+
export const ThemeProvider = withMemo(function ThemeProvider({ theme, children }: ThemeProviderProps) {
|
|
9
|
+
// Refs
|
|
10
|
+
|
|
11
|
+
// States/Variables/Selectors
|
|
12
|
+
|
|
13
|
+
// Callbacks
|
|
14
|
+
|
|
15
|
+
// Effects
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
document.body.classList.add(theme);
|
|
18
|
+
return () => {
|
|
19
|
+
document.body.classList.remove(theme);
|
|
20
|
+
};
|
|
21
|
+
}, [theme]);
|
|
22
|
+
|
|
23
|
+
// Other
|
|
24
|
+
|
|
25
|
+
// RenderFunctions
|
|
26
|
+
|
|
27
|
+
return <ThemeContext value={theme}>{children}</ThemeContext>;
|
|
28
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -19,6 +19,9 @@ export * from './WindowContext/WindowContext';
|
|
|
19
19
|
export * from './Components/ActionSheet/ActionSheet';
|
|
20
20
|
export * from './Components/Card/Card';
|
|
21
21
|
export * from './Components/Clickable/Clickable';
|
|
22
|
+
export * from './Components/DesignProvider/Design';
|
|
23
|
+
export * from './Components/DesignProvider/DesignContext';
|
|
24
|
+
export * from './Components/DesignProvider/DesignProvider';
|
|
22
25
|
export * from './Components/Dialog/AlertDialog';
|
|
23
26
|
export * from './Components/Dialog/ButtonDialog';
|
|
24
27
|
export * from './Components/Dialog/ConfirmDialog';
|
|
@@ -80,6 +83,8 @@ export * from './Components/TabBar/TabBarButton';
|
|
|
80
83
|
export * from './Components/Table/Table';
|
|
81
84
|
export * from './Components/Text/Heading';
|
|
82
85
|
export * from './Components/Text/Text';
|
|
86
|
+
export * from './Components/ThemeProvider/ThemeContext';
|
|
87
|
+
export * from './Components/ThemeProvider/ThemeProvider';
|
|
83
88
|
export * from './Components/Title/HoverTitle';
|
|
84
89
|
export * from './Components/Title/withTitle';
|
|
85
90
|
export * from './Components/Toast/Toast';
|
package/src/scss/_colors.scss
CHANGED
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
--flavor-pale-constructive: #86efac; // Green 300
|
|
34
34
|
--flavor-destructive: #dc2626; // Red 600
|
|
35
35
|
--flavor-pale-destructive: #fca5a5; // Red 300
|
|
36
|
-
--curtain-light: rgb(
|
|
37
|
-
--curtain-strong: rgb(
|
|
36
|
+
--curtain-light: rgb(255 255 255 / 40%);
|
|
37
|
+
--curtain-strong: rgb(255 255 255 / 80%);
|
|
38
38
|
--foreground-primary: #292524; // Stone 800
|
|
39
39
|
--foreground-secondary: #44403c; // Stone 700
|
|
40
40
|
--foreground-tertiary: #57534e; // Stone 600
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
--text-inverse: #0f172a; // Slate 900
|
|
49
49
|
--opacity-disabled: 0.3;
|
|
50
50
|
--text-primary-default-color: var(--text-primary);
|
|
51
|
+
--button-primary-text-color: var(--text-primary);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
.#{$material} {
|
|
@@ -55,10 +56,6 @@
|
|
|
55
56
|
|
|
56
57
|
--flavor-accent: #37474f;
|
|
57
58
|
--box-shadow-color: rgb(0 0 0 / 20%);
|
|
58
|
-
|
|
59
|
-
&.dark {
|
|
60
|
-
@extend %color-vars-dark;
|
|
61
|
-
}
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
.#{$flat} {
|
|
@@ -67,8 +64,19 @@
|
|
|
67
64
|
--flavor-accent: #2563eb; // blue 600
|
|
68
65
|
--flavor-pale-accent: #93c5fd; // blue 300
|
|
69
66
|
--box-shadow-color: rgb(0 0 0 / 12%);
|
|
67
|
+
}
|
|
70
68
|
|
|
71
|
-
|
|
69
|
+
.dark {
|
|
70
|
+
.#{$flat}, &.#{$flat} {
|
|
72
71
|
@extend %color-vars-dark;
|
|
72
|
+
|
|
73
|
+
--box-shadow-color: rgb(255 255 255 / 12%);
|
|
74
|
+
--flavor-pale-accent: #172554; // blue 900
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.#{$material}, &.#{$material} {
|
|
78
|
+
@extend %color-vars-dark;
|
|
79
|
+
|
|
80
|
+
--box-shadow-color: rgb(255 255 255 / 20%);
|
|
73
81
|
}
|
|
74
82
|
}
|