@neko-os/ui 0.0.8 → 0.0.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/DynamicStyleTag.js +5 -0
- package/dist/DynamicStyleTag.native.js +1 -0
- package/dist/NekoUI.js +1 -1
- package/dist/abstractions/ActivityIndicator.native.js +1 -1
- package/dist/abstractions/ActivityIndicator.web.js +1 -0
- package/dist/abstractions/AnimatedView.web.js +1 -0
- package/dist/abstractions/BlurView.web.js +1 -0
- package/dist/abstractions/FlatList.js +1 -0
- package/dist/abstractions/FlatList.native.js +1 -0
- package/dist/abstractions/FlatList.web.js +1 -0
- package/dist/abstractions/ScrollView.web.js +1 -0
- package/dist/abstractions/StaticList.js +1 -0
- package/dist/abstractions/helpers/storage.js +1 -0
- package/dist/abstractions/helpers/storage.native.js +1 -0
- package/dist/abstractions/helpers/useSafeAreaInsets.js +1 -0
- package/dist/abstractions/helpers/useSafeAreaInsets.native.js +1 -0
- package/dist/components/actions/Button.js +1 -1
- package/dist/components/actions/Dropdown.js +1 -1
- package/dist/components/actions/FloatingButton.js +1 -0
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/menu/VerticalMenu.js +1 -1
- package/dist/components/calendar/_helpers/calendarDays.js +1 -1
- package/dist/components/feedback/alerter.js +1 -1
- package/dist/components/feedback/confirmer.js +1 -1
- package/dist/components/helpers/ConditionalLazyRender.js +1 -0
- package/dist/components/helpers/LazyAction.js +1 -0
- package/dist/components/helpers/LazyRender.js +1 -1
- package/dist/components/helpers/LazyRender.native.js +1 -1
- package/dist/components/helpers/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/inputs/DateInput.js +1 -1
- package/dist/components/inputs/InputWrapper.js +1 -1
- package/dist/components/inputs/LinkInput.js +1 -1
- package/dist/components/inputs/NumberInput.js +1 -0
- package/dist/components/inputs/Picker.js +1 -1
- package/dist/components/inputs/Radio.js +1 -1
- package/dist/components/inputs/RateInput.js +1 -0
- package/dist/components/inputs/SegmentedPicker.js +1 -0
- package/dist/components/inputs/Select.js +1 -0
- package/dist/components/inputs/datePicker/DayPicker.js +1 -1
- package/dist/components/inputs/datePicker/MonthPicker.js +1 -1
- package/dist/components/inputs/datePicker/QuarterPicker.js +1 -1
- package/dist/components/inputs/datePicker/WeekPicker.js +1 -1
- package/dist/components/inputs/datePicker/YearPicker.js +1 -1
- package/dist/components/inputs/index.js +1 -1
- package/dist/components/layout/Layout.js +1 -1
- package/dist/components/list/FlatList.js +1 -0
- package/dist/components/list/index.js +1 -1
- package/dist/components/presentation/Rate.js +1 -0
- package/dist/components/presentation/RateTag.js +1 -0
- package/dist/components/presentation/Result.js +1 -1
- package/dist/components/presentation/Tooltip.js +1 -1
- package/dist/components/presentation/index.js +1 -1
- package/dist/components/state/LoadingView.js +1 -1
- package/dist/components/structure/Accordion.js +1 -1
- package/dist/components/structure/Row.js +1 -1
- package/dist/components/structure/Segment.js +1 -0
- package/dist/components/structure/View.js +1 -1
- package/dist/components/structure/bottomDrawer/native/BottomDrawer.js +1 -1
- package/dist/components/structure/bottomDrawer/native/utils.js +1 -1
- package/dist/components/structure/bottomDrawer/web/BottomDrawer.js +1 -1
- package/dist/components/structure/index.js +1 -1
- package/dist/components/structure/overlay/OverlayHandler.js +1 -1
- package/dist/components/structure/popover/Popover.js +1 -1
- package/dist/components/structure/popover/Popover.native.js +1 -1
- package/dist/components/structure/popover/Popover_BU.js +1 -0
- package/dist/components/tabs/ActiveTabContent.js +1 -0
- package/dist/components/tabs/TabsHandler.js +1 -0
- package/dist/components/tabs/TabsMenu.js +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/theme/ThemePicker.js +1 -0
- package/dist/components/theme/ThemePickerDrawer.js +1 -0
- package/dist/components/theme/ThemeStatusBar.js +1 -0
- package/dist/components/theme/ThemeStatusBar.native.js +1 -0
- package/dist/components/theme/ThemeThumb.js +1 -0
- package/dist/components/theme/index.js +1 -0
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/storage.js +1 -0
- package/dist/helpers/string.js +1 -1
- package/dist/i18n/I18n.js +1 -0
- package/dist/i18n/I18nProvider.js +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/index.css +4 -0
- package/dist/index.js +1 -1
- package/dist/modifiers/animations/fadeEffect.web.js +1 -0
- package/dist/modifiers/animations/scrollEffect.web.js +1 -0
- package/dist/modifiers/animations/slideEffect.web.js +1 -0
- package/dist/modifiers/fullColor.js +1 -1
- package/dist/modifiers/overflow.js +1 -1
- package/dist/modifiers/position.js +1 -1
- package/dist/theme/ThemeHandler.js +1 -1
- package/dist/theme/default/base.js +1 -1
- package/dist/theme/default/blackTheme.js +1 -1
- package/dist/theme/default/cyberpunkTheme.js +1 -1
- package/dist/theme/default/darkTheme.js +1 -1
- package/dist/theme/default/deepWoodsTheme.js +1 -1
- package/dist/theme/default/forestTheme.js +1 -1
- package/dist/theme/default/hackerTheme.js +1 -1
- package/dist/theme/default/lightTheme.js +1 -1
- package/dist/theme/default/midnightTheme.js +1 -1
- package/dist/theme/default/msdosTheme.js +1 -1
- package/dist/theme/default/oceanTheme.js +1 -1
- package/dist/theme/default/paperTheme.js +1 -0
- package/dist/theme/default/pastelTheme.js +1 -1
- package/dist/theme/default/sunsetTheme.js +1 -1
- package/dist/theme/default/themes.js +1 -1
- package/dist/theme/format/formatTheme.js +1 -1
- package/dist/theme/helpers/contrastColor.js +1 -1
- package/package.json +1 -1
- package/src/DynamicStyleTag.js +21 -0
- package/src/DynamicStyleTag.native.js +3 -0
- package/src/NekoUI.js +21 -4
- package/src/abstractions/ActivityIndicator.native.js +3 -4
- package/src/abstractions/ActivityIndicator.web.js +43 -0
- package/src/abstractions/AnimatedView.web.js +3 -0
- package/src/abstractions/BlurView.web.js +39 -0
- package/src/abstractions/FlatList.js +3 -0
- package/src/abstractions/FlatList.native.js +36 -0
- package/src/abstractions/FlatList.web.js +3 -0
- package/src/abstractions/ScrollView.web.js +3 -0
- package/src/abstractions/StaticList.js +51 -0
- package/src/abstractions/Text.web.js +15 -0
- package/src/abstractions/helpers/storage.js +32 -0
- package/src/abstractions/helpers/storage.native.js +34 -0
- package/src/abstractions/helpers/useSafeAreaInsets.js +3 -0
- package/src/abstractions/helpers/useSafeAreaInsets.native.js +3 -0
- package/src/components/actions/Button.js +1 -0
- package/src/components/actions/Dropdown.js +24 -5
- package/src/components/actions/FloatingButton.js +87 -0
- package/src/components/actions/index.js +1 -0
- package/src/components/actions/menu/VerticalMenu.js +30 -5
- package/src/components/calendar/_helpers/calendarDays.js +2 -0
- package/src/components/feedback/alerter.js +1 -1
- package/src/components/feedback/confirmer.js +2 -2
- package/src/components/helpers/ConditionalLazyRender.js +6 -0
- package/src/components/helpers/LazyAction.js +22 -0
- package/src/components/helpers/LazyRender.js +2 -2
- package/src/components/helpers/LazyRender.native.js +1 -1
- package/src/components/helpers/index.js +1 -0
- package/src/components/index.js +2 -0
- package/src/components/inputs/DateInput.js +11 -1
- package/src/components/inputs/InputWrapper.js +0 -1
- package/src/components/inputs/LinkInput.js +3 -3
- package/src/components/inputs/NumberInput.js +105 -0
- package/src/components/inputs/Picker.js +61 -9
- package/src/components/inputs/Radio.js +1 -1
- package/src/components/inputs/RateInput.js +62 -0
- package/src/components/inputs/SegmentedPicker.js +62 -0
- package/src/components/inputs/Select.js +189 -0
- package/src/components/inputs/datePicker/DayPicker.js +4 -5
- package/src/components/inputs/datePicker/MonthPicker.js +2 -2
- package/src/components/inputs/datePicker/QuarterPicker.js +2 -2
- package/src/components/inputs/datePicker/WeekPicker.js +2 -2
- package/src/components/inputs/datePicker/YearPicker.js +9 -6
- package/src/components/inputs/index.js +4 -0
- package/src/components/layout/Layout.js +1 -1
- package/src/components/list/FlatList.js +91 -0
- package/src/components/list/index.js +1 -0
- package/src/components/presentation/Rate.js +58 -0
- package/src/components/presentation/RateTag.js +35 -0
- package/src/components/presentation/Result.js +2 -2
- package/src/components/presentation/Tooltip.js +1 -0
- package/src/components/presentation/index.js +2 -0
- package/src/components/state/LoadingView.js +10 -1
- package/src/components/structure/Accordion.js +1 -1
- package/src/components/structure/Row.js +9 -1
- package/src/components/structure/Segment.js +51 -0
- package/src/components/structure/View.js +2 -0
- package/src/components/structure/bottomDrawer/native/BottomDrawer.js +19 -3
- package/src/components/structure/bottomDrawer/native/utils.js +29 -22
- package/src/components/structure/bottomDrawer/web/BottomDrawer.js +3 -1
- package/src/components/structure/index.js +1 -0
- package/src/components/structure/overlay/OverlayHandler.js +6 -1
- package/src/components/structure/popover/Popover.js +44 -21
- package/src/components/structure/popover/Popover.native.js +3 -2
- package/src/components/structure/popover/Popover_BU.js +157 -0
- package/src/components/tabs/ActiveTabContent.js +35 -0
- package/src/components/tabs/TabsHandler.js +16 -0
- package/src/components/tabs/TabsMenu.js +15 -0
- package/src/components/tabs/index.js +3 -0
- package/src/components/theme/ThemePicker.js +49 -0
- package/src/components/theme/ThemePickerDrawer.js +13 -0
- package/src/components/theme/ThemeStatusBar.js +3 -0
- package/src/components/theme/ThemeStatusBar.native.js +9 -0
- package/src/components/theme/ThemeThumb.js +98 -0
- package/src/components/theme/index.js +3 -0
- package/src/helpers/index.js +1 -0
- package/src/helpers/storage.js +54 -0
- package/src/helpers/string.js +18 -1
- package/src/i18n/I18n.js +97 -0
- package/src/i18n/I18nProvider.js +40 -0
- package/src/i18n/index.js +2 -0
- package/src/index.css +4 -0
- package/src/index.js +1 -0
- package/src/modifiers/animations/fadeEffect.web.js +3 -0
- package/src/modifiers/animations/scrollEffect.web.js +3 -0
- package/src/modifiers/animations/slideEffect.web.js +3 -0
- package/src/modifiers/fullColor.js +2 -2
- package/src/modifiers/overflow.js +6 -1
- package/src/modifiers/position.js +7 -0
- package/src/theme/ThemeHandler.js +18 -2
- package/src/theme/default/base.js +12 -8
- package/src/theme/default/blackTheme.js +4 -1
- package/src/theme/default/cyberpunkTheme.js +3 -1
- package/src/theme/default/darkTheme.js +3 -1
- package/src/theme/default/deepWoodsTheme.js +4 -2
- package/src/theme/default/forestTheme.js +3 -1
- package/src/theme/default/hackerTheme.js +3 -1
- package/src/theme/default/lightTheme.js +3 -1
- package/src/theme/default/midnightTheme.js +3 -1
- package/src/theme/default/msdosTheme.js +18 -4
- package/src/theme/default/oceanTheme.js +4 -2
- package/src/theme/default/paperTheme.js +35 -0
- package/src/theme/default/pastelTheme.js +3 -1
- package/src/theme/default/sunsetTheme.js +5 -3
- package/src/theme/default/themes.js +7 -10
- package/src/theme/format/formatTheme.js +9 -3
- package/src/theme/helpers/contrastColor.js +49 -11
- package/dist/abstractions/TouchableOpacity.web.js +0 -1
- package/src/abstractions/TouchableOpacity.web.js +0 -3
package/src/i18n/I18n.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export class I18n {
|
|
2
|
+
constructor(options = {}) {
|
|
3
|
+
this.language = options.language || 'en'
|
|
4
|
+
this.fallback = options.fallback || 'en'
|
|
5
|
+
this.onChangeLanguage = options.onChangeLanguage
|
|
6
|
+
this.resources = options.resources || {}
|
|
7
|
+
this.loader = options.loader
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
addResources(lang, ns, data) {
|
|
11
|
+
if (!this.resources[lang]) this.resources[lang] = {}
|
|
12
|
+
this.resources[lang][ns] = { ...this.resources[lang][ns], ...data }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
changeLanguage(lang) {
|
|
16
|
+
this.language = lang
|
|
17
|
+
this.onChangeLanguage?.(lang)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async tAsync(key, opts = {}) {
|
|
21
|
+
const { ns = 'common' } = opts
|
|
22
|
+
if (!this.resources[this.language]?.[ns] && this.loader) {
|
|
23
|
+
await this._loadNamespace(this.language, ns)
|
|
24
|
+
}
|
|
25
|
+
return this.t(key, opts)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
t(key, opts = {}) {
|
|
29
|
+
let { ns = 'common', context, ...vars } = opts
|
|
30
|
+
const count = vars?.count
|
|
31
|
+
if (key.includes(':')) {
|
|
32
|
+
const splittedKey = key.split(':')
|
|
33
|
+
ns = splittedKey[0]
|
|
34
|
+
key = splittedKey[1]
|
|
35
|
+
}
|
|
36
|
+
const langData = this.resources[this.language]?.[ns]
|
|
37
|
+
let value = this._resolveKey(langData, key, count, context)
|
|
38
|
+
if (context) console.log(context, value)
|
|
39
|
+
|
|
40
|
+
if (!value) {
|
|
41
|
+
const fallbackData = this.resources[this.fallback]?.[ns]
|
|
42
|
+
value = this._resolveKey(fallbackData, key, count, context) || key
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return this._interpolate(value, vars)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async _loadNamespace(lang, ns) {
|
|
49
|
+
if (!this.loader) return
|
|
50
|
+
const data = await this.loader(lang, ns)
|
|
51
|
+
this.addResources(lang, ns, data)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_resolveKey(nsData, key, count, context) {
|
|
55
|
+
if (!nsData) return null
|
|
56
|
+
|
|
57
|
+
// Support for nested keys like "a.b.c"
|
|
58
|
+
const parts = key.split('.')
|
|
59
|
+
const basePath = parts.slice(0, -1)
|
|
60
|
+
const baseKey = parts[parts.length - 1]
|
|
61
|
+
const parent = basePath.reduce((acc, part) => (acc ? acc[part] : undefined), nsData) || nsData
|
|
62
|
+
|
|
63
|
+
if (!parent) return null
|
|
64
|
+
|
|
65
|
+
// Support for context (e.g., gender) - tries key_context
|
|
66
|
+
if (context) {
|
|
67
|
+
const contextKey = `${baseKey}_${context}`
|
|
68
|
+
if (parent[contextKey] != null) {
|
|
69
|
+
return parent[contextKey]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Support for pluralization - tries key_one for singular
|
|
74
|
+
if (typeof count === 'number') {
|
|
75
|
+
if (count === 0) {
|
|
76
|
+
const singularKey = `${baseKey}_zero`
|
|
77
|
+
if (parent[singularKey] != null) {
|
|
78
|
+
return parent[singularKey]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (count === 1) {
|
|
82
|
+
const singularKey = `${baseKey}_one`
|
|
83
|
+
if (parent[singularKey] != null) {
|
|
84
|
+
return parent[singularKey]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Return the base key
|
|
90
|
+
return parent[baseKey]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_interpolate(str, vars) {
|
|
94
|
+
if (typeof str !== 'string') return str
|
|
95
|
+
return str.replace(/\{\{(.*?)\}\}/g, (_, v) => vars[v.trim()] ?? '')
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { I18n } from './I18n'
|
|
4
|
+
|
|
5
|
+
const I18nContext = React.createContext()
|
|
6
|
+
|
|
7
|
+
export function I18nProvider({ children, i18n, config }) {
|
|
8
|
+
const i18nRef = React.useRef(i18n || new I18n(config))
|
|
9
|
+
const [v, setVersion] = React.useState(0)
|
|
10
|
+
|
|
11
|
+
const forceUpdate = React.useCallback(() => setVersion((v) => v + 1), [])
|
|
12
|
+
|
|
13
|
+
const changeLanguage = React.useCallback(
|
|
14
|
+
(lang) => {
|
|
15
|
+
i18nRef.current.changeLanguage(lang)
|
|
16
|
+
forceUpdate()
|
|
17
|
+
},
|
|
18
|
+
[forceUpdate]
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const value = React.useMemo(
|
|
22
|
+
() => ({
|
|
23
|
+
t: (...args) => i18nRef.current.t(...args),
|
|
24
|
+
i18n: i18nRef.current,
|
|
25
|
+
v,
|
|
26
|
+
language: i18nRef.current.language,
|
|
27
|
+
changeLanguage,
|
|
28
|
+
}),
|
|
29
|
+
[v, forceUpdate, changeLanguage]
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useTranslation(namespace) {
|
|
36
|
+
const ctx = React.useContext(I18nContext)
|
|
37
|
+
if (!ctx) throw new Error('useTranslation must be used inside <I18nProvider>')
|
|
38
|
+
const t = (key, opts = {}) => ctx?.t?.(key, { ns: namespace, ...opts })
|
|
39
|
+
return { ...ctx, t }
|
|
40
|
+
}
|
package/src/index.css
CHANGED
package/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import tinycolor from 'tinycolor2'
|
|
|
3
3
|
import { getContrastColor } from '../theme/helpers/contrastColor'
|
|
4
4
|
import { useGetColor } from '../theme/ThemeHandler'
|
|
5
5
|
|
|
6
|
-
export function useFullColorModifier([{ color, ...values }, { outline, fill, ...props }]) {
|
|
6
|
+
export function useFullColorModifier([{ color, ...values }, { outline, contrastTolerance, fill, ...props }]) {
|
|
7
7
|
const getColor = useGetColor()
|
|
8
8
|
|
|
9
9
|
let bg = color
|
|
@@ -15,7 +15,7 @@ export function useFullColorModifier([{ color, ...values }, { outline, fill, ...
|
|
|
15
15
|
bg = 'transparent'
|
|
16
16
|
fontColor = color
|
|
17
17
|
} else {
|
|
18
|
-
fontColor = getContrastColor(bgObj, [getColor('
|
|
18
|
+
fontColor = getContrastColor(bgObj, [getColor('overlayBG'), getColor('text')], contrastTolerance)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return [
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { clearProps } from './_helpers'
|
|
2
2
|
|
|
3
3
|
export function useOverflowModifier([values, props]) {
|
|
4
|
-
let { hiddenOverflow, scroll, scrollY, scrollX, overflow, overflowY, overflowX, ...restProps } = props
|
|
4
|
+
let { hiddenOverflow, scroll, noScroll, scrollY, scrollX, overflow, overflowY, overflowX, ...restProps } = props
|
|
5
5
|
|
|
6
6
|
if (hiddenOverflow) overflow = 'hidden'
|
|
7
7
|
if (scroll) overflow = 'scroll'
|
|
8
8
|
if (scrollY) overflowY = 'scroll'
|
|
9
9
|
if (scrollX) overflowX = 'scroll'
|
|
10
|
+
if (noScroll) {
|
|
11
|
+
if (overflow === 'scroll') overflow = undefined
|
|
12
|
+
if (overflowY === 'scroll') overflowY = undefined
|
|
13
|
+
if (overflowX === 'scroll') overflowX = undefined
|
|
14
|
+
}
|
|
10
15
|
|
|
11
16
|
const style = clearProps({ overflow, overflowY, overflowX })
|
|
12
17
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Platform } from '../abstractions/Platform'
|
|
2
2
|
import { clearProps } from './_helpers'
|
|
3
|
+
import { useGetSpace } from '../theme'
|
|
3
4
|
|
|
4
5
|
export function usePositionModifier([values, props]) {
|
|
6
|
+
const getSpace = useGetSpace()
|
|
5
7
|
let {
|
|
6
8
|
position,
|
|
7
9
|
absolute,
|
|
@@ -24,6 +26,11 @@ export function usePositionModifier([values, props]) {
|
|
|
24
26
|
if (fixed || fixedFill) position = 'fixed'
|
|
25
27
|
if (sticky) position = 'sticky'
|
|
26
28
|
|
|
29
|
+
top = getSpace(top)
|
|
30
|
+
bottom = getSpace(bottom)
|
|
31
|
+
right = getSpace(right)
|
|
32
|
+
left = getSpace(left)
|
|
33
|
+
|
|
27
34
|
if (absoluteFill || fixedFill) {
|
|
28
35
|
top = 0
|
|
29
36
|
bottom = 0
|
|
@@ -53,10 +53,26 @@ export function useMergeThemeComponent(name, props) {
|
|
|
53
53
|
return mergeDeepRight(themeProps, props)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export function ThemeHandler({ breakpoints, themes, initTheme, children }) {
|
|
56
|
+
export function ThemeHandler({ breakpoints, themes, initTheme, onChangeTheme, children }) {
|
|
57
|
+
const [themePickerOpen, setThemePickerOpen] = React.useState(false)
|
|
58
|
+
const openThemePicker = () => setThemePickerOpen(true)
|
|
57
59
|
const [activeThemeKey, setActiveThemeKey] = React.useState(initTheme || 'light')
|
|
60
|
+
const toggleTheme = () => setActiveThemeKey(activeThemeKey === 'light' ? 'dark' : 'light')
|
|
58
61
|
const theme = useFormattedTheme(themes, activeThemeKey)
|
|
59
|
-
|
|
62
|
+
|
|
63
|
+
const value = {
|
|
64
|
+
theme,
|
|
65
|
+
themes,
|
|
66
|
+
activeThemeKey,
|
|
67
|
+
setActiveThemeKey,
|
|
68
|
+
toggleTheme,
|
|
69
|
+
themePickerOpen,
|
|
70
|
+
setThemePickerOpen,
|
|
71
|
+
onChangeTheme,
|
|
72
|
+
openThemePicker,
|
|
73
|
+
toggleTheme,
|
|
74
|
+
breakpoints: breakpoints || DEFAULT_BREAKPOINTS,
|
|
75
|
+
}
|
|
60
76
|
|
|
61
77
|
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
|
|
62
78
|
}
|
|
@@ -37,36 +37,40 @@ export const BASE_THEME = {
|
|
|
37
37
|
|
|
38
38
|
// Buttons, inputs, etc.
|
|
39
39
|
elementHeights: {
|
|
40
|
+
xxxs: 10,
|
|
41
|
+
xxs: 15,
|
|
40
42
|
xs: 20,
|
|
41
43
|
sm: 30,
|
|
42
44
|
md: 35,
|
|
43
|
-
lg:
|
|
44
|
-
xl:
|
|
45
|
+
lg: 40,
|
|
46
|
+
xl: 50,
|
|
47
|
+
xxl: 60,
|
|
48
|
+
xxxl: 70,
|
|
45
49
|
},
|
|
46
50
|
|
|
47
51
|
texts: {
|
|
48
52
|
h1: {
|
|
49
|
-
fontSize:
|
|
53
|
+
fontSize: 35,
|
|
50
54
|
strong: true,
|
|
51
55
|
},
|
|
52
56
|
h2: {
|
|
53
|
-
fontSize:
|
|
57
|
+
fontSize: 28,
|
|
54
58
|
strong: true,
|
|
55
59
|
},
|
|
56
60
|
h3: {
|
|
57
|
-
fontSize:
|
|
61
|
+
fontSize: 26,
|
|
58
62
|
strong: true,
|
|
59
63
|
},
|
|
60
64
|
h4: {
|
|
61
|
-
fontSize:
|
|
65
|
+
fontSize: 22,
|
|
62
66
|
strong: true,
|
|
63
67
|
},
|
|
64
68
|
h5: {
|
|
65
|
-
fontSize:
|
|
69
|
+
fontSize: 18,
|
|
66
70
|
strong: true,
|
|
67
71
|
},
|
|
68
72
|
h6: {
|
|
69
|
-
fontSize:
|
|
73
|
+
fontSize: 16,
|
|
70
74
|
strong: true,
|
|
71
75
|
},
|
|
72
76
|
p: { fontSize: 14 },
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { mergeDeepRight } from 'ramda'
|
|
2
|
+
|
|
2
3
|
import { BASE_THEME } from './base'
|
|
3
4
|
|
|
4
5
|
export const DEFAULT_BLACK_THEME = mergeDeepRight(BASE_THEME, {
|
|
6
|
+
label: 'Pitch Black',
|
|
7
|
+
|
|
5
8
|
colors: {
|
|
6
9
|
primary: '#818DF9',
|
|
7
10
|
text: '#FFFFFF',
|
|
@@ -9,7 +12,7 @@ export const DEFAULT_BLACK_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
9
12
|
text3: '#B0B0B0',
|
|
10
13
|
text4: '#8A8A8A',
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
mainBG: '#0f0f0f',
|
|
13
16
|
overlayBG: '#000000',
|
|
14
17
|
backdrop: '#1f1f1f',
|
|
15
18
|
shadow: 'rgba(216, 210, 203, 0.1)',
|
|
@@ -2,6 +2,8 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import { BASE_THEME } from './base'
|
|
3
3
|
|
|
4
4
|
export const CYBERPUNK_DARK_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
label: 'Cyberpunk',
|
|
6
|
+
|
|
5
7
|
colors: {
|
|
6
8
|
primary: '#FCEE09',
|
|
7
9
|
text: '#FFFFFF',
|
|
@@ -9,7 +11,7 @@ export const CYBERPUNK_DARK_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
9
11
|
text3: '#8C8C8C',
|
|
10
12
|
text4: '#666666',
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
mainBG: '#14141F',
|
|
13
15
|
overlayBG: '#14141F',
|
|
14
16
|
backdrop: '#0A0A0F',
|
|
15
17
|
shadow: 'rgba(39, 45, 52, 0.6)',
|
|
@@ -2,6 +2,8 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import { BASE_THEME } from './base'
|
|
3
3
|
|
|
4
4
|
export const DEFAULT_DARK_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
label: 'Dark',
|
|
6
|
+
|
|
5
7
|
colors: {
|
|
6
8
|
primary: '#818DF9',
|
|
7
9
|
text: '#FFFFFF',
|
|
@@ -9,7 +11,7 @@ export const DEFAULT_DARK_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
9
11
|
text3: '#B0B0B0',
|
|
10
12
|
text4: '#8A8A8A',
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
mainBG: '#383E44',
|
|
13
15
|
overlayBG: '#272D34',
|
|
14
16
|
backdrop: '#383E44',
|
|
15
17
|
shadow: 'rgba(216, 210, 203, 0.1)',
|
|
@@ -2,14 +2,16 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import { BASE_THEME } from './base'
|
|
3
3
|
|
|
4
4
|
export const DEEP_WOODS_DARK_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
label: 'Deep Woods',
|
|
6
|
+
|
|
5
7
|
colors: {
|
|
6
8
|
primary: '#4CAF50',
|
|
7
|
-
text: '#
|
|
9
|
+
text: '#C8E6C9',
|
|
8
10
|
text2: '#C8E6C9',
|
|
9
11
|
text3: '#A5D6A7',
|
|
10
12
|
text4: '#81C784',
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
mainBG: '#0D1B14',
|
|
13
15
|
overlayBG: '#16281F',
|
|
14
16
|
backdrop: '#0D1B14',
|
|
15
17
|
shadow: 'rgba(39, 45, 52, 0.6)',
|
|
@@ -2,6 +2,8 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import { BASE_THEME } from './base'
|
|
3
3
|
|
|
4
4
|
export const FOREST_MIST_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
label: 'Forest Mist',
|
|
6
|
+
|
|
5
7
|
colors: {
|
|
6
8
|
primary: '#4CAF50',
|
|
7
9
|
text: '#0B2414',
|
|
@@ -9,7 +11,7 @@ export const FOREST_MIST_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
9
11
|
text3: '#1B5E20',
|
|
10
12
|
text4: '#388E3C',
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
mainBG: '#E9F5EC',
|
|
13
15
|
overlayBG: '#FFFFFF',
|
|
14
16
|
backdrop: '#E9F5EC',
|
|
15
17
|
shadow: 'rgba(39, 45, 52, 0.15)',
|
|
@@ -3,6 +3,8 @@ import { mergeDeepRight } from 'ramda'
|
|
|
3
3
|
import { BASE_THEME } from './base'
|
|
4
4
|
|
|
5
5
|
export const DEFAULT_MATRIX_THEME = mergeDeepRight(BASE_THEME, {
|
|
6
|
+
label: 'Hacker',
|
|
7
|
+
|
|
6
8
|
colors: {
|
|
7
9
|
primary: '#00FF41',
|
|
8
10
|
text: '#00FF41',
|
|
@@ -10,7 +12,7 @@ export const DEFAULT_MATRIX_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
10
12
|
text3: '#009926',
|
|
11
13
|
text4: '#00661A',
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
mainBG: '#000000',
|
|
14
16
|
overlayBG: '#0A0A0A',
|
|
15
17
|
backdrop: '#000000',
|
|
16
18
|
shadow: 'rgba(0, 255, 65, 0.2)',
|
|
@@ -2,6 +2,8 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import { BASE_THEME } from './base'
|
|
3
3
|
|
|
4
4
|
export const DEFAULT_LIGHT_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
label: 'Light',
|
|
6
|
+
|
|
5
7
|
colors: {
|
|
6
8
|
primary: '#818DF9',
|
|
7
9
|
text: '#272D34',
|
|
@@ -9,7 +11,7 @@ export const DEFAULT_LIGHT_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
9
11
|
text3: '#6E7680',
|
|
10
12
|
text4: '#9AA1AC',
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
mainBG: '#F4F5FE',
|
|
13
15
|
overlayBG: '#FFFFFF',
|
|
14
16
|
backdrop: '#383E44',
|
|
15
17
|
shadow: 'rgba(39, 45, 52, 0.15)',
|
|
@@ -2,6 +2,8 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import { BASE_THEME } from './base'
|
|
3
3
|
|
|
4
4
|
export const MIDNIGHT_NEON_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
label: 'Midnight',
|
|
6
|
+
|
|
5
7
|
colors: {
|
|
6
8
|
primary: '#FF00FF',
|
|
7
9
|
text: '#F0F0F0',
|
|
@@ -9,7 +11,7 @@ export const MIDNIGHT_NEON_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
9
11
|
text3: '#A3A3A3',
|
|
10
12
|
text4: '#7A7A7A',
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
mainBG: '#0D0D0D',
|
|
13
15
|
overlayBG: '#1A1A1A',
|
|
14
16
|
backdrop: '#0D0D0D',
|
|
15
17
|
shadow: 'rgba(39, 45, 52, 0.6)',
|
|
@@ -3,14 +3,16 @@ import { mergeDeepRight } from 'ramda'
|
|
|
3
3
|
import { BASE_THEME } from './base'
|
|
4
4
|
|
|
5
5
|
export const DEFAULT_MSDOS_THEME = mergeDeepRight(BASE_THEME, {
|
|
6
|
+
label: 'MSDOS',
|
|
7
|
+
|
|
6
8
|
colors: {
|
|
7
9
|
primary: '#FFFF00',
|
|
8
10
|
text: '#FFFFFF',
|
|
9
|
-
text2: '#
|
|
10
|
-
text3: '#
|
|
11
|
-
text4: '#
|
|
11
|
+
text2: '#E0E0E0',
|
|
12
|
+
text3: '#B0B0B0',
|
|
13
|
+
text4: '#8A8A8A',
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
mainBG: '#0000AA',
|
|
14
16
|
overlayBG: '#000088',
|
|
15
17
|
backdrop: '#0000AA',
|
|
16
18
|
shadow: 'rgba(0, 0, 0, 0.6)',
|
|
@@ -31,6 +33,18 @@ export const DEFAULT_MSDOS_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
31
33
|
pink: '#FF69B4',
|
|
32
34
|
},
|
|
33
35
|
|
|
36
|
+
radius: {
|
|
37
|
+
xxxs: 1,
|
|
38
|
+
xxs: 2,
|
|
39
|
+
xs: 3,
|
|
40
|
+
sm: 4,
|
|
41
|
+
md: 6,
|
|
42
|
+
lg: 8,
|
|
43
|
+
xl: 10,
|
|
44
|
+
xxl: 12,
|
|
45
|
+
xxxl: 14,
|
|
46
|
+
},
|
|
47
|
+
|
|
34
48
|
components: {
|
|
35
49
|
Card: {
|
|
36
50
|
border: 1,
|
|
@@ -2,14 +2,16 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import { BASE_THEME } from './base'
|
|
3
3
|
|
|
4
4
|
export const OCEAN_BREEZE_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
label: 'Ocean Breeze',
|
|
6
|
+
|
|
5
7
|
colors: {
|
|
6
8
|
primary: '#2B90D9',
|
|
7
|
-
text: '#
|
|
9
|
+
text: '#065277',
|
|
8
10
|
text2: '#065A82',
|
|
9
11
|
text3: '#0B84B4',
|
|
10
12
|
text4: '#3ABEFF',
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
mainBG: '#E6F7FF',
|
|
13
15
|
overlayBG: '#FFFFFF',
|
|
14
16
|
backdrop: '#04364A',
|
|
15
17
|
shadow: 'rgba(39, 45, 52, 0.15)',
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mergeDeepRight } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { BASE_THEME } from './base'
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_PAPER_THEME = mergeDeepRight(BASE_THEME, {
|
|
6
|
+
label: 'Paper',
|
|
7
|
+
|
|
8
|
+
colors: {
|
|
9
|
+
primary: '#5A5A5A',
|
|
10
|
+
text: '#000000',
|
|
11
|
+
text2: '#333333',
|
|
12
|
+
text3: '#555555',
|
|
13
|
+
text4: '#777777',
|
|
14
|
+
|
|
15
|
+
mainBG: '#F8F1E3',
|
|
16
|
+
overlayBG: '#F8F1E3',
|
|
17
|
+
backdrop: '#383E44',
|
|
18
|
+
shadow: 'rgba(0, 0, 0, 0.04)',
|
|
19
|
+
divider: '#E3D9C9',
|
|
20
|
+
|
|
21
|
+
blue: '#6B8EAE',
|
|
22
|
+
yellow: '#EADCA6',
|
|
23
|
+
green: '#88A288',
|
|
24
|
+
purple: '#A391B8',
|
|
25
|
+
orange: '#D9A066',
|
|
26
|
+
cyan: '#9CC9C2',
|
|
27
|
+
red: '#B85C5C',
|
|
28
|
+
navy: '#4A4A4A',
|
|
29
|
+
indigo: '#70788C',
|
|
30
|
+
gray: '#B8B8B8',
|
|
31
|
+
brown: '#8B7355',
|
|
32
|
+
lylac: '#C7B7D4',
|
|
33
|
+
pink: '#E4A1B2',
|
|
34
|
+
},
|
|
35
|
+
})
|
|
@@ -2,6 +2,8 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import { BASE_THEME } from './base'
|
|
3
3
|
|
|
4
4
|
export const PASTEL_DREAM_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
label: 'Pastel Dream',
|
|
6
|
+
|
|
5
7
|
colors: {
|
|
6
8
|
primary: '#FFB6C1',
|
|
7
9
|
text: '#4B4453',
|
|
@@ -9,7 +11,7 @@ export const PASTEL_DREAM_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
9
11
|
text3: '#A093A6',
|
|
10
12
|
text4: '#C9BBCF',
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
mainBG: '#FFF7FA',
|
|
13
15
|
overlayBG: '#FFFFFF',
|
|
14
16
|
backdrop: '#4B4453',
|
|
15
17
|
shadow: 'rgba(39, 45, 52, 0.15)',
|
|
@@ -3,15 +3,17 @@ import { mergeDeepRight } from 'ramda'
|
|
|
3
3
|
import { BASE_THEME } from './base'
|
|
4
4
|
|
|
5
5
|
export const SUNSET_GLOW_THEME = mergeDeepRight(BASE_THEME, {
|
|
6
|
+
label: 'Sunset',
|
|
7
|
+
|
|
6
8
|
colors: {
|
|
7
9
|
primary: '#FF6B6B',
|
|
8
|
-
text: '#
|
|
10
|
+
text: '#4B372E',
|
|
9
11
|
text2: '#5C4033',
|
|
10
12
|
text3: '#8C5A43',
|
|
11
13
|
text4: '#B97A57',
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
overlayBG: '#
|
|
15
|
+
mainBG: '#FFF5E6',
|
|
16
|
+
overlayBG: '#FFFAF1',
|
|
15
17
|
backdrop: '#331E0A',
|
|
16
18
|
shadow: 'rgba(39, 45, 52, 0.15)',
|
|
17
19
|
divider: '#f0f0f0',
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import { CYBERPUNK_DARK_THEME } from './cyberpunkTheme'
|
|
2
|
-
import { DEEP_WOODS_DARK_THEME } from './deepWoodsTheme'
|
|
3
2
|
import { DEFAULT_BLACK_THEME } from './blackTheme'
|
|
4
3
|
import { DEFAULT_DARK_THEME } from './darkTheme'
|
|
5
4
|
import { DEFAULT_LIGHT_THEME } from './lightTheme'
|
|
6
5
|
import { DEFAULT_MATRIX_THEME } from './hackerTheme'
|
|
7
6
|
import { DEFAULT_MSDOS_THEME } from './msdosTheme'
|
|
8
|
-
import {
|
|
7
|
+
import { DEFAULT_PAPER_THEME } from './paperTheme'
|
|
9
8
|
import { MIDNIGHT_NEON_THEME } from './midnightTheme'
|
|
10
|
-
import { OCEAN_BREEZE_THEME } from './oceanTheme'
|
|
11
|
-
import { PASTEL_DREAM_THEME } from './pastelTheme'
|
|
12
|
-
import { SUNSET_GLOW_THEME } from './sunsetTheme'
|
|
13
9
|
|
|
14
10
|
export const DEFAULT_THEMES = {
|
|
15
11
|
light: DEFAULT_LIGHT_THEME,
|
|
16
12
|
dark: DEFAULT_DARK_THEME,
|
|
13
|
+
paper: DEFAULT_PAPER_THEME,
|
|
17
14
|
black: DEFAULT_BLACK_THEME,
|
|
18
|
-
pastel: PASTEL_DREAM_THEME,
|
|
15
|
+
// pastel: PASTEL_DREAM_THEME,
|
|
19
16
|
midnight: MIDNIGHT_NEON_THEME,
|
|
20
|
-
sunset: SUNSET_GLOW_THEME,
|
|
21
|
-
ocean: OCEAN_BREEZE_THEME,
|
|
22
|
-
forest: FOREST_MIST_THEME,
|
|
17
|
+
// sunset: SUNSET_GLOW_THEME,
|
|
18
|
+
// ocean: OCEAN_BREEZE_THEME,
|
|
19
|
+
// forest: FOREST_MIST_THEME,
|
|
23
20
|
cyberpunk: CYBERPUNK_DARK_THEME,
|
|
24
|
-
deepWoods: DEEP_WOODS_DARK_THEME,
|
|
21
|
+
// deepWoods: DEEP_WOODS_DARK_THEME,
|
|
25
22
|
hacker: DEFAULT_MATRIX_THEME,
|
|
26
23
|
msdos: DEFAULT_MSDOS_THEME,
|
|
27
24
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { mergeDeepRight, pipe } from 'ramda'
|
|
1
|
+
import { mergeDeepRight, mergeDeepLeft, pipe } from 'ramda'
|
|
2
2
|
import React from 'react'
|
|
3
|
+
import tinycolor from 'tinycolor2'
|
|
3
4
|
|
|
4
5
|
import { DEFAULT_LIGHT_THEME } from '../default/lightTheme'
|
|
5
6
|
import { DEFAULT_THEMES } from '../default/themes'
|
|
@@ -15,8 +16,13 @@ export function formatTheme(themes, key) {
|
|
|
15
16
|
const theme = themes[key] || DEFAULT_THEMES[key] || DEFAULT_LIGHT_THEME
|
|
16
17
|
const baseDefaultTheme = DEFAULT_THEMES[theme.base] || DEFAULT_THEMES[key] || DEFAULT_LIGHT_THEME
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
const formattedTheme = pipe(
|
|
19
20
|
mergeDeepRight(baseDefaultTheme), //
|
|
20
|
-
applyColorVariantsOnTheme
|
|
21
|
+
applyColorVariantsOnTheme,
|
|
22
|
+
mergeDeepLeft(themes._all || {}) //
|
|
21
23
|
)({ ...theme })
|
|
24
|
+
|
|
25
|
+
const isDark = tinycolor(formattedTheme?.colors?.overlayBG || formattedTheme?.colors?.bg).isDark()
|
|
26
|
+
|
|
27
|
+
return { ...formattedTheme, isDark, isLight: !isDark }
|
|
22
28
|
}
|