creactive 0.0.56 → 0.0.58
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/build/browser.d.ts +1 -0
- package/build/browser.js +2 -0
- package/build/browser.js.LICENSE.txt +9 -0
- package/build/node.d.ts +1 -0
- package/build/node.js +2 -0
- package/build/node.js.LICENSE.txt +9 -0
- package/package.json +11 -6
- package/build/index.js +0 -1656
- package/source/components/index.ts +0 -2
- package/source/components/text/constants/color.ts +0 -26
- package/source/components/text/constants/font.ts +0 -32
- package/source/components/text/constants/index.ts +0 -5
- package/source/components/text/constants/role.ts +0 -12
- package/source/components/text/constants/text.ts +0 -22
- package/source/components/text/constants/type.ts +0 -27
- package/source/components/text/index.ts +0 -2
- package/source/components/text/spec/children.spec.tsx +0 -13
- package/source/components/text/spec/color.spec.native.tsx +0 -15
- package/source/components/text/spec/color.spec.tsx +0 -159
- package/source/components/text/spec/color.spec.web.tsx +0 -15
- package/source/components/text/spec/font.spec.tsx +0 -196
- package/source/components/text/spec/position.spec.tsx +0 -15
- package/source/components/text/spec/text.spec.native.tsx +0 -1043
- package/source/components/text/spec/text.spec.tsx +0 -39
- package/source/components/text/spec/text.spec.web.tsx +0 -1043
- package/source/components/text/spec/type.spec.web.tsx +0 -55
- package/source/components/text/text.stories.tsx +0 -46
- package/source/components/text/text.tsx +0 -262
- package/source/components/text/text.types.ts +0 -67
- package/source/constants/index.ts +0 -46
- package/source/constants/theme/color.ts +0 -27
- package/source/constants/theme/font.ts +0 -48
- package/source/constants/theme/index.ts +0 -50
- package/source/constants/theme/text.ts +0 -12
- package/source/contexts/index.ts +0 -15
- package/source/contexts/media/components/index.ts +0 -4
- package/source/contexts/media/components/media/index.ts +0 -2
- package/source/contexts/media/components/media/media.tsx +0 -37
- package/source/contexts/media/components/media/media.types.ts +0 -26
- package/source/contexts/media/components/wrapper/index.ts +0 -2
- package/source/contexts/media/components/wrapper/wrapper.tsx +0 -73
- package/source/contexts/media/components/wrapper/wrapper.types.ts +0 -3
- package/source/contexts/media/constants/breakpoint.ts +0 -18
- package/source/contexts/media/constants/index.ts +0 -6
- package/source/contexts/media/hooks/index.ts +0 -1
- package/source/contexts/media/hooks/use-breakpoint.ts +0 -18
- package/source/contexts/media/index.ts +0 -7
- package/source/contexts/media/media.tsx +0 -36
- package/source/contexts/media/media.types.ts +0 -38
- package/source/contexts/theme/index.ts +0 -8
- package/source/contexts/theme/theme.tsx +0 -280
- package/source/contexts/theme/theme.types.ts +0 -284
- package/source/helpers/index.ts +0 -3
- package/source/helpers/storybook/constants/control.ts +0 -25
- package/source/helpers/storybook/constants/index.ts +0 -1
- package/source/helpers/storybook/control.spec.ts +0 -140
- package/source/helpers/storybook/control.ts +0 -115
- package/source/helpers/storybook/index.ts +0 -1
- package/source/helpers/style/index.ts +0 -2
- package/source/helpers/style/style.spec.web.ts +0 -20
- package/source/helpers/style/style.ts +0 -14
- package/source/helpers/style/style.types.ts +0 -14
- package/source/hooks/index.ts +0 -1
- package/source/hooks/use-theme-style-sheet.ts +0 -135
- package/source/index.ts +0 -24
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { FunctionComponent, PropsWithChildren } from 'react'
|
|
2
|
-
import type { MediaBreakpoint } from '../../constants'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Media default component props.
|
|
6
|
-
* This variant does accept any breakpoint.
|
|
7
|
-
* This props variant will render children on smallest screen.
|
|
8
|
-
* It will also will render children during server-side rendering.
|
|
9
|
-
*/
|
|
10
|
-
interface MediaDefaultProps extends PropsWithChildren {
|
|
11
|
-
isDefault: true
|
|
12
|
-
breakpoint?: never
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Media breakpoint component props.
|
|
16
|
-
* This variant does accept only one breakpoint.
|
|
17
|
-
* Renders children only on a larger than smallest screen.
|
|
18
|
-
*/
|
|
19
|
-
interface MediaBreakpointProps extends PropsWithChildren {
|
|
20
|
-
isDefault?: never
|
|
21
|
-
breakpoint: MediaBreakpoint
|
|
22
|
-
}
|
|
23
|
-
export type MediaProps = MediaDefaultProps | MediaBreakpointProps
|
|
24
|
-
export type MediaComponent = FunctionComponent<MediaProps> & {
|
|
25
|
-
Breakpoint: Record<keyof typeof MediaBreakpoint, MediaBreakpoint>
|
|
26
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties, JSX } from 'react'
|
|
2
|
-
import { useEffect, useMemo, useRef, useState } from 'react'
|
|
3
|
-
import { Platform } from 'react-native'
|
|
4
|
-
import { WrapperProps } from './wrapper.types'
|
|
5
|
-
|
|
6
|
-
export const Wrapper = Platform.select({
|
|
7
|
-
// We need a wrapper for hiding content blinking.
|
|
8
|
-
// Server side rendered result is allways matching mobile media.
|
|
9
|
-
// Client side effects may decide to render something different.
|
|
10
|
-
// This wrapper helps us to handle this situation gracefully.
|
|
11
|
-
web: ({ children }: WrapperProps) => {
|
|
12
|
-
const ref = useRef<HTMLDivElement>()
|
|
13
|
-
// Hydration flag, allows to detect server and first client render.
|
|
14
|
-
const [isHydrated, setHydrated] = useState(false)
|
|
15
|
-
// Update hydration flag after first render.
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
setHydrated(true)
|
|
18
|
-
}, [])
|
|
19
|
-
// Memorized wrapper style.
|
|
20
|
-
const style = useMemo(() => {
|
|
21
|
-
// Return visible wrapper styles during hydrated client render.
|
|
22
|
-
// Return visible wrapper styles during server side rendering also.
|
|
23
|
-
if (
|
|
24
|
-
isHydrated ||
|
|
25
|
-
typeof window === 'undefined' ||
|
|
26
|
-
typeof document === 'undefined'
|
|
27
|
-
) {
|
|
28
|
-
return {
|
|
29
|
-
display: 'flex',
|
|
30
|
-
flexGrow: 1,
|
|
31
|
-
flexShrink: 1,
|
|
32
|
-
flexBasis: '100%',
|
|
33
|
-
flexDirection: 'column',
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
// Return hidden wrapper styles during first client render.
|
|
37
|
-
// Display style will be already modified by inline script to be onest.
|
|
38
|
-
// Anyway, we want this object to be consistent with final state later.
|
|
39
|
-
return {
|
|
40
|
-
display: 'none',
|
|
41
|
-
flexGrow: 1,
|
|
42
|
-
flexShrink: 1,
|
|
43
|
-
flexBasis: '100%',
|
|
44
|
-
flexDirection: 'column',
|
|
45
|
-
}
|
|
46
|
-
}, [isHydrated])
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<>
|
|
50
|
-
<div
|
|
51
|
-
ref={ref}
|
|
52
|
-
style={style as CSSProperties}
|
|
53
|
-
// We don't want to see hydration warning on this element.
|
|
54
|
-
// We'll set display none in the script below.
|
|
55
|
-
// This will allow us to hide wrapped content during first render.
|
|
56
|
-
suppressHydrationWarning
|
|
57
|
-
>
|
|
58
|
-
{children}
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<script
|
|
62
|
-
// Hide wrapper content immediately during first render.
|
|
63
|
-
dangerouslySetInnerHTML={{
|
|
64
|
-
__html:
|
|
65
|
-
'document.currentScript.previousSibling.style.display="none"',
|
|
66
|
-
}}
|
|
67
|
-
/>
|
|
68
|
-
</>
|
|
69
|
-
)
|
|
70
|
-
},
|
|
71
|
-
// We don't need any wrapping on native platfrom.
|
|
72
|
-
default: ({ children }: WrapperProps) => children as JSX.Element,
|
|
73
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Media breakpoint constants enum.
|
|
3
|
-
* Should be used to define and compare breakpoint.
|
|
4
|
-
* If you mean the smallest screen, use undefined value.
|
|
5
|
-
*/
|
|
6
|
-
export enum MediaBreakpoint {
|
|
7
|
-
MD,
|
|
8
|
-
LG,
|
|
9
|
-
XL,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Default media breakpoint values.
|
|
14
|
-
* This values will are used if no overrides provided.
|
|
15
|
-
*/
|
|
16
|
-
export const BREAKPOINT_MD = 768
|
|
17
|
-
export const BREAKPOINT_LG = 1024
|
|
18
|
-
export const BREAKPOINT_XL = 1280
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useMediaBreakpoint } from './use-breakpoint'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
import { useWindowDimensions } from 'react-native'
|
|
3
|
-
import { MediaBreakpoint } from '../constants'
|
|
4
|
-
|
|
5
|
-
export const useMediaBreakpoint = (
|
|
6
|
-
breakpointMD: number,
|
|
7
|
-
breakpointLG: number,
|
|
8
|
-
breakpointXL: number
|
|
9
|
-
) => {
|
|
10
|
-
const { width } = useWindowDimensions()
|
|
11
|
-
// Returning memorized breakpoint, based on current width.
|
|
12
|
-
return useMemo(() => {
|
|
13
|
-
// Mobile first breakpoint switching ierarchy.
|
|
14
|
-
if (width >= breakpointXL) return MediaBreakpoint.XL
|
|
15
|
-
if (width >= breakpointLG) return MediaBreakpoint.LG
|
|
16
|
-
if (width >= breakpointMD) return MediaBreakpoint.MD
|
|
17
|
-
}, [width >= breakpointXL, width >= breakpointLG, width >= breakpointMD])
|
|
18
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext, useMemo } from 'react'
|
|
2
|
-
import { Wrapper } from './components'
|
|
3
|
-
import { BREAKPOINT_LG, BREAKPOINT_MD, BREAKPOINT_XL } from './constants'
|
|
4
|
-
import { useMediaBreakpoint } from './hooks'
|
|
5
|
-
import type {
|
|
6
|
-
MediaContextProviderComponent,
|
|
7
|
-
MediaContextValue,
|
|
8
|
-
} from './media.types'
|
|
9
|
-
|
|
10
|
-
const MediaContext = createContext<MediaContextValue>({})
|
|
11
|
-
|
|
12
|
-
export const MediaContextProvider: MediaContextProviderComponent = ({
|
|
13
|
-
breakpointMD,
|
|
14
|
-
breakpointLG,
|
|
15
|
-
breakpointXL,
|
|
16
|
-
children,
|
|
17
|
-
}) => {
|
|
18
|
-
const breakpoint = useMediaBreakpoint(
|
|
19
|
-
breakpointMD ?? BREAKPOINT_MD,
|
|
20
|
-
breakpointLG ?? BREAKPOINT_LG,
|
|
21
|
-
breakpointXL ?? BREAKPOINT_XL
|
|
22
|
-
)
|
|
23
|
-
// Memorizing context value to avoid extra re-renders.
|
|
24
|
-
const value = useMemo(
|
|
25
|
-
() => ({
|
|
26
|
-
breakpoint,
|
|
27
|
-
}),
|
|
28
|
-
[breakpoint]
|
|
29
|
-
)
|
|
30
|
-
return (
|
|
31
|
-
<MediaContext.Provider value={value}>
|
|
32
|
-
<Wrapper>{children}</Wrapper>
|
|
33
|
-
</MediaContext.Provider>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
export const useMediaContext = () => useContext(MediaContext)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { FunctionComponent, PropsWithChildren } from 'react'
|
|
2
|
-
import type { MediaBreakpoint } from './constants'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Media context value interface.
|
|
6
|
-
* Contains current media breakpoint.
|
|
7
|
-
*/
|
|
8
|
-
export interface MediaContextValue {
|
|
9
|
-
/**
|
|
10
|
-
* Current media breakpoint.
|
|
11
|
-
* We are using undefined value during server-side rendering.
|
|
12
|
-
* As mobile-first we also use undefined value for the smallest screens.
|
|
13
|
-
* @default undefined
|
|
14
|
-
*/
|
|
15
|
-
breakpoint?: MediaBreakpoint
|
|
16
|
-
}
|
|
17
|
-
interface MediaContextProviderProps extends PropsWithChildren {
|
|
18
|
-
/**
|
|
19
|
-
* Media breakpoint for MD screens.
|
|
20
|
-
* When layout whould switches first time from its smalest version.
|
|
21
|
-
* @default 768
|
|
22
|
-
*/
|
|
23
|
-
breakpointMD?: number
|
|
24
|
-
/**
|
|
25
|
-
* Media breakpoint for LG screens.
|
|
26
|
-
* Second layout switch to its large version.
|
|
27
|
-
* @default 1024
|
|
28
|
-
*/
|
|
29
|
-
breakpointLG?: number
|
|
30
|
-
/**
|
|
31
|
-
* Media breakpoint for XL screens.
|
|
32
|
-
* Largest layout version - last switch.
|
|
33
|
-
* @default 1280
|
|
34
|
-
*/
|
|
35
|
-
breakpointXL?: number
|
|
36
|
-
}
|
|
37
|
-
export type MediaContextProviderComponent =
|
|
38
|
-
FunctionComponent<MediaContextProviderProps>
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COLOR_FOREGROUND_BASE_100,
|
|
3
|
-
COLOR_FOREGROUND_BASE_200,
|
|
4
|
-
COLOR_FOREGROUND_BASE_300,
|
|
5
|
-
COLOR_FOREGROUND_BASE_400,
|
|
6
|
-
COLOR_FOREGROUND_BASE_500,
|
|
7
|
-
COLOR_FOREGROUND_BASE_600,
|
|
8
|
-
COLOR_FOREGROUND_BASE_700,
|
|
9
|
-
COLOR_FOREGROUND_BASE_800,
|
|
10
|
-
COLOR_FOREGROUND_BASE_900,
|
|
11
|
-
COLOR_FOREGROUND_INVERSE_100,
|
|
12
|
-
COLOR_FOREGROUND_INVERSE_200,
|
|
13
|
-
COLOR_FOREGROUND_INVERSE_300,
|
|
14
|
-
COLOR_FOREGROUND_INVERSE_400,
|
|
15
|
-
COLOR_FOREGROUND_INVERSE_500,
|
|
16
|
-
COLOR_FOREGROUND_INVERSE_600,
|
|
17
|
-
COLOR_FOREGROUND_INVERSE_700,
|
|
18
|
-
COLOR_FOREGROUND_INVERSE_800,
|
|
19
|
-
COLOR_FOREGROUND_INVERSE_900,
|
|
20
|
-
FONT_FAMILY_BASE,
|
|
21
|
-
FONT_SIZE_BASE_LG,
|
|
22
|
-
FONT_SIZE_BASE_MD,
|
|
23
|
-
FONT_SIZE_BASE_SM,
|
|
24
|
-
FONT_SIZE_BASE_X2L,
|
|
25
|
-
FONT_SIZE_BASE_X2S,
|
|
26
|
-
FONT_SIZE_BASE_X3L,
|
|
27
|
-
FONT_SIZE_BASE_X4L,
|
|
28
|
-
FONT_SIZE_BASE_X5L,
|
|
29
|
-
FONT_SIZE_BASE_XL,
|
|
30
|
-
FONT_SIZE_BASE_XS,
|
|
31
|
-
FONT_WEIGHT_BASE_BLACK,
|
|
32
|
-
FONT_WEIGHT_BASE_BOLD,
|
|
33
|
-
FONT_WEIGHT_BASE_EXTRABOLD,
|
|
34
|
-
FONT_WEIGHT_BASE_EXTRALIGHT,
|
|
35
|
-
FONT_WEIGHT_BASE_LIGHT,
|
|
36
|
-
FONT_WEIGHT_BASE_MEDIUM,
|
|
37
|
-
FONT_WEIGHT_BASE_REGULAR,
|
|
38
|
-
FONT_WEIGHT_BASE_SEMIBOLD,
|
|
39
|
-
FONT_WEIGHT_BASE_THIN,
|
|
40
|
-
LINE_HEIGHT_BASE_LOOSE,
|
|
41
|
-
LINE_HEIGHT_BASE_NONE,
|
|
42
|
-
LINE_HEIGHT_BASE_NORMAL,
|
|
43
|
-
LINE_HEIGHT_BASE_RELAXED,
|
|
44
|
-
LINE_HEIGHT_BASE_SNUG,
|
|
45
|
-
LINE_HEIGHT_BASE_TIGHT,
|
|
46
|
-
} from '@/constants'
|
|
47
|
-
import { createContext, useContext, useMemo } from 'react'
|
|
48
|
-
import type {
|
|
49
|
-
ThemeContextProviderComponent,
|
|
50
|
-
ThemeContextValue,
|
|
51
|
-
} from './theme.types'
|
|
52
|
-
|
|
53
|
-
// We can use context even outside provider.
|
|
54
|
-
// This can be helpful for testing and storybook.
|
|
55
|
-
const ThemeContext = createContext<ThemeContextValue>({
|
|
56
|
-
colorForegroundBase100: COLOR_FOREGROUND_BASE_100,
|
|
57
|
-
colorForegroundBase200: COLOR_FOREGROUND_BASE_200,
|
|
58
|
-
colorForegroundBase300: COLOR_FOREGROUND_BASE_300,
|
|
59
|
-
colorForegroundBase400: COLOR_FOREGROUND_BASE_400,
|
|
60
|
-
colorForegroundBase500: COLOR_FOREGROUND_BASE_500,
|
|
61
|
-
colorForegroundBase600: COLOR_FOREGROUND_BASE_600,
|
|
62
|
-
colorForegroundBase700: COLOR_FOREGROUND_BASE_700,
|
|
63
|
-
colorForegroundBase800: COLOR_FOREGROUND_BASE_800,
|
|
64
|
-
colorForegroundBase900: COLOR_FOREGROUND_BASE_900,
|
|
65
|
-
colorForegroundInverse100: COLOR_FOREGROUND_INVERSE_100,
|
|
66
|
-
colorForegroundInverse200: COLOR_FOREGROUND_INVERSE_200,
|
|
67
|
-
colorForegroundInverse300: COLOR_FOREGROUND_INVERSE_300,
|
|
68
|
-
colorForegroundInverse400: COLOR_FOREGROUND_INVERSE_400,
|
|
69
|
-
colorForegroundInverse500: COLOR_FOREGROUND_INVERSE_500,
|
|
70
|
-
colorForegroundInverse600: COLOR_FOREGROUND_INVERSE_600,
|
|
71
|
-
colorForegroundInverse700: COLOR_FOREGROUND_INVERSE_700,
|
|
72
|
-
colorForegroundInverse800: COLOR_FOREGROUND_INVERSE_800,
|
|
73
|
-
colorForegroundInverse900: COLOR_FOREGROUND_INVERSE_900,
|
|
74
|
-
fontFamilyBase: FONT_FAMILY_BASE,
|
|
75
|
-
fontWeightBaseThin: FONT_WEIGHT_BASE_THIN,
|
|
76
|
-
fontWeightBaseExtraLight: FONT_WEIGHT_BASE_EXTRALIGHT,
|
|
77
|
-
fontWeightBaseLight: FONT_WEIGHT_BASE_LIGHT,
|
|
78
|
-
fontWeightBaseRegular: FONT_WEIGHT_BASE_REGULAR,
|
|
79
|
-
fontWeightBaseMedium: FONT_WEIGHT_BASE_MEDIUM,
|
|
80
|
-
fontWeightBaseSemibold: FONT_WEIGHT_BASE_SEMIBOLD,
|
|
81
|
-
fontWeightBaseBold: FONT_WEIGHT_BASE_BOLD,
|
|
82
|
-
fontWeightBaseExtraBold: FONT_WEIGHT_BASE_EXTRABOLD,
|
|
83
|
-
fontWeightBaseBlack: FONT_WEIGHT_BASE_BLACK,
|
|
84
|
-
fontSizeBaseX2S: FONT_SIZE_BASE_X2S,
|
|
85
|
-
fontSizeBaseXS: FONT_SIZE_BASE_XS,
|
|
86
|
-
fontSizeBaseSM: FONT_SIZE_BASE_SM,
|
|
87
|
-
fontSizeBaseMD: FONT_SIZE_BASE_MD,
|
|
88
|
-
fontSizeBaseLG: FONT_SIZE_BASE_LG,
|
|
89
|
-
fontSizeBaseXL: FONT_SIZE_BASE_XL,
|
|
90
|
-
fontSizeBaseX2L: FONT_SIZE_BASE_X2L,
|
|
91
|
-
fontSizeBaseX3L: FONT_SIZE_BASE_X3L,
|
|
92
|
-
fontSizeBaseX4L: FONT_SIZE_BASE_X4L,
|
|
93
|
-
fontSizeBaseX5L: FONT_SIZE_BASE_X5L,
|
|
94
|
-
lineHeightBaseNone: LINE_HEIGHT_BASE_NONE,
|
|
95
|
-
lineHeightBaseTight: LINE_HEIGHT_BASE_TIGHT,
|
|
96
|
-
lineHeightBaseSnug: LINE_HEIGHT_BASE_SNUG,
|
|
97
|
-
lineHeightBaseNormal: LINE_HEIGHT_BASE_NORMAL,
|
|
98
|
-
lineHeightBaseRelaxed: LINE_HEIGHT_BASE_RELAXED,
|
|
99
|
-
lineHeightBaseLoose: LINE_HEIGHT_BASE_LOOSE,
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
export const ThemeContextProvider: ThemeContextProviderComponent = ({
|
|
103
|
-
// Foreground color tokens.
|
|
104
|
-
colorForegroundBase100,
|
|
105
|
-
colorForegroundBase200,
|
|
106
|
-
colorForegroundBase300,
|
|
107
|
-
colorForegroundBase400,
|
|
108
|
-
colorForegroundBase500,
|
|
109
|
-
colorForegroundBase600,
|
|
110
|
-
colorForegroundBase700,
|
|
111
|
-
colorForegroundBase800,
|
|
112
|
-
colorForegroundBase900,
|
|
113
|
-
colorForegroundInverse100,
|
|
114
|
-
colorForegroundInverse200,
|
|
115
|
-
colorForegroundInverse300,
|
|
116
|
-
colorForegroundInverse400,
|
|
117
|
-
colorForegroundInverse500,
|
|
118
|
-
colorForegroundInverse600,
|
|
119
|
-
colorForegroundInverse700,
|
|
120
|
-
colorForegroundInverse800,
|
|
121
|
-
colorForegroundInverse900,
|
|
122
|
-
// Font family tokens.
|
|
123
|
-
fontFamilyBase,
|
|
124
|
-
// Font weight tokens.
|
|
125
|
-
fontWeightBaseThin,
|
|
126
|
-
fontWeightBaseExtraLight,
|
|
127
|
-
fontWeightBaseLight,
|
|
128
|
-
fontWeightBaseRegular,
|
|
129
|
-
fontWeightBaseMedium,
|
|
130
|
-
fontWeightBaseSemibold,
|
|
131
|
-
fontWeightBaseBold,
|
|
132
|
-
fontWeightBaseExtraBold,
|
|
133
|
-
fontWeightBaseBlack,
|
|
134
|
-
// Font size tokens.
|
|
135
|
-
fontSizeBaseX2S,
|
|
136
|
-
fontSizeBaseXS,
|
|
137
|
-
fontSizeBaseSM,
|
|
138
|
-
fontSizeBaseMD,
|
|
139
|
-
fontSizeBaseLG,
|
|
140
|
-
fontSizeBaseXL,
|
|
141
|
-
fontSizeBaseX2L,
|
|
142
|
-
fontSizeBaseX3L,
|
|
143
|
-
fontSizeBaseX4L,
|
|
144
|
-
fontSizeBaseX5L,
|
|
145
|
-
// Line height tokens.
|
|
146
|
-
lineHeightBaseNone,
|
|
147
|
-
lineHeightBaseTight,
|
|
148
|
-
lineHeightBaseSnug,
|
|
149
|
-
lineHeightBaseNormal,
|
|
150
|
-
lineHeightBaseRelaxed,
|
|
151
|
-
lineHeightBaseLoose,
|
|
152
|
-
// And at least.. :)
|
|
153
|
-
children,
|
|
154
|
-
}) => {
|
|
155
|
-
// Memorizing context value.
|
|
156
|
-
// Allows to avoid unnecessary re-renders.
|
|
157
|
-
// Context consumers will re-render only if value changes.
|
|
158
|
-
const value = useMemo(
|
|
159
|
-
() => ({
|
|
160
|
-
// Foreground color tokens.
|
|
161
|
-
colorForegroundBase100:
|
|
162
|
-
colorForegroundBase100 ?? COLOR_FOREGROUND_BASE_100,
|
|
163
|
-
colorForegroundBase200:
|
|
164
|
-
colorForegroundBase200 ?? COLOR_FOREGROUND_BASE_200,
|
|
165
|
-
colorForegroundBase300:
|
|
166
|
-
colorForegroundBase300 ?? COLOR_FOREGROUND_BASE_300,
|
|
167
|
-
colorForegroundBase400:
|
|
168
|
-
colorForegroundBase400 ?? COLOR_FOREGROUND_BASE_400,
|
|
169
|
-
colorForegroundBase500:
|
|
170
|
-
colorForegroundBase500 ?? COLOR_FOREGROUND_BASE_500,
|
|
171
|
-
colorForegroundBase600:
|
|
172
|
-
colorForegroundBase600 ?? COLOR_FOREGROUND_BASE_600,
|
|
173
|
-
colorForegroundBase700:
|
|
174
|
-
colorForegroundBase700 ?? COLOR_FOREGROUND_BASE_700,
|
|
175
|
-
colorForegroundBase800:
|
|
176
|
-
colorForegroundBase800 ?? COLOR_FOREGROUND_BASE_800,
|
|
177
|
-
colorForegroundBase900:
|
|
178
|
-
colorForegroundBase900 ?? COLOR_FOREGROUND_BASE_900,
|
|
179
|
-
colorForegroundInverse100:
|
|
180
|
-
colorForegroundInverse100 ?? COLOR_FOREGROUND_INVERSE_100,
|
|
181
|
-
colorForegroundInverse200:
|
|
182
|
-
colorForegroundInverse200 ?? COLOR_FOREGROUND_INVERSE_200,
|
|
183
|
-
colorForegroundInverse300:
|
|
184
|
-
colorForegroundInverse300 ?? COLOR_FOREGROUND_INVERSE_300,
|
|
185
|
-
colorForegroundInverse400:
|
|
186
|
-
colorForegroundInverse400 ?? COLOR_FOREGROUND_INVERSE_400,
|
|
187
|
-
colorForegroundInverse500:
|
|
188
|
-
colorForegroundInverse500 ?? COLOR_FOREGROUND_INVERSE_500,
|
|
189
|
-
colorForegroundInverse600:
|
|
190
|
-
colorForegroundInverse600 ?? COLOR_FOREGROUND_INVERSE_600,
|
|
191
|
-
colorForegroundInverse700:
|
|
192
|
-
colorForegroundInverse700 ?? COLOR_FOREGROUND_INVERSE_700,
|
|
193
|
-
colorForegroundInverse800:
|
|
194
|
-
colorForegroundInverse800 ?? COLOR_FOREGROUND_INVERSE_800,
|
|
195
|
-
colorForegroundInverse900:
|
|
196
|
-
colorForegroundInverse900 ?? COLOR_FOREGROUND_INVERSE_900,
|
|
197
|
-
// Font family tokens.
|
|
198
|
-
fontFamilyBase: fontFamilyBase ?? FONT_FAMILY_BASE,
|
|
199
|
-
// Base font weight tokens.
|
|
200
|
-
fontWeightBaseThin: fontWeightBaseThin ?? FONT_WEIGHT_BASE_THIN,
|
|
201
|
-
fontWeightBaseExtraLight:
|
|
202
|
-
fontWeightBaseExtraLight ?? FONT_WEIGHT_BASE_EXTRALIGHT,
|
|
203
|
-
fontWeightBaseLight: fontWeightBaseLight ?? FONT_WEIGHT_BASE_LIGHT,
|
|
204
|
-
fontWeightBaseRegular: fontWeightBaseRegular ?? FONT_WEIGHT_BASE_REGULAR,
|
|
205
|
-
fontWeightBaseMedium: fontWeightBaseMedium ?? FONT_WEIGHT_BASE_MEDIUM,
|
|
206
|
-
fontWeightBaseSemibold:
|
|
207
|
-
fontWeightBaseSemibold ?? FONT_WEIGHT_BASE_SEMIBOLD,
|
|
208
|
-
fontWeightBaseBold: fontWeightBaseBold ?? FONT_WEIGHT_BASE_BOLD,
|
|
209
|
-
fontWeightBaseExtraBold:
|
|
210
|
-
fontWeightBaseExtraBold ?? FONT_WEIGHT_BASE_EXTRABOLD,
|
|
211
|
-
fontWeightBaseBlack: fontWeightBaseBlack ?? FONT_WEIGHT_BASE_BLACK,
|
|
212
|
-
// Base font size tokens.
|
|
213
|
-
fontSizeBaseX2S: fontSizeBaseX2S ?? FONT_SIZE_BASE_X2S,
|
|
214
|
-
fontSizeBaseXS: fontSizeBaseXS ?? FONT_SIZE_BASE_XS,
|
|
215
|
-
fontSizeBaseSM: fontSizeBaseSM ?? FONT_SIZE_BASE_SM,
|
|
216
|
-
fontSizeBaseMD: fontSizeBaseMD ?? FONT_SIZE_BASE_MD,
|
|
217
|
-
fontSizeBaseLG: fontSizeBaseLG ?? FONT_SIZE_BASE_LG,
|
|
218
|
-
fontSizeBaseXL: fontSizeBaseXL ?? FONT_SIZE_BASE_XL,
|
|
219
|
-
fontSizeBaseX2L: fontSizeBaseX2L ?? FONT_SIZE_BASE_X2L,
|
|
220
|
-
fontSizeBaseX3L: fontSizeBaseX3L ?? FONT_SIZE_BASE_X3L,
|
|
221
|
-
fontSizeBaseX4L: fontSizeBaseX4L ?? FONT_SIZE_BASE_X4L,
|
|
222
|
-
fontSizeBaseX5L: fontSizeBaseX5L ?? FONT_SIZE_BASE_X5L,
|
|
223
|
-
// Base line height tokens.
|
|
224
|
-
lineHeightBaseNone: lineHeightBaseNone ?? LINE_HEIGHT_BASE_NONE,
|
|
225
|
-
lineHeightBaseTight: lineHeightBaseTight ?? LINE_HEIGHT_BASE_TIGHT,
|
|
226
|
-
lineHeightBaseSnug: lineHeightBaseSnug ?? LINE_HEIGHT_BASE_SNUG,
|
|
227
|
-
lineHeightBaseNormal: lineHeightBaseNormal ?? LINE_HEIGHT_BASE_NORMAL,
|
|
228
|
-
lineHeightBaseRelaxed: lineHeightBaseRelaxed ?? LINE_HEIGHT_BASE_RELAXED,
|
|
229
|
-
lineHeightBaseLoose: lineHeightBaseLoose ?? LINE_HEIGHT_BASE_LOOSE,
|
|
230
|
-
}),
|
|
231
|
-
[
|
|
232
|
-
colorForegroundBase100,
|
|
233
|
-
colorForegroundBase200,
|
|
234
|
-
colorForegroundBase300,
|
|
235
|
-
colorForegroundBase400,
|
|
236
|
-
colorForegroundBase500,
|
|
237
|
-
colorForegroundBase600,
|
|
238
|
-
colorForegroundBase700,
|
|
239
|
-
colorForegroundBase800,
|
|
240
|
-
colorForegroundBase900,
|
|
241
|
-
colorForegroundInverse100,
|
|
242
|
-
colorForegroundInverse200,
|
|
243
|
-
colorForegroundInverse300,
|
|
244
|
-
colorForegroundInverse400,
|
|
245
|
-
colorForegroundInverse500,
|
|
246
|
-
colorForegroundInverse600,
|
|
247
|
-
colorForegroundInverse700,
|
|
248
|
-
colorForegroundInverse800,
|
|
249
|
-
colorForegroundInverse900,
|
|
250
|
-
fontFamilyBase,
|
|
251
|
-
fontWeightBaseThin,
|
|
252
|
-
fontWeightBaseExtraLight,
|
|
253
|
-
fontWeightBaseLight,
|
|
254
|
-
fontWeightBaseRegular,
|
|
255
|
-
fontWeightBaseMedium,
|
|
256
|
-
fontWeightBaseSemibold,
|
|
257
|
-
fontWeightBaseBold,
|
|
258
|
-
fontWeightBaseExtraBold,
|
|
259
|
-
fontWeightBaseBlack,
|
|
260
|
-
fontSizeBaseX2S,
|
|
261
|
-
fontSizeBaseXS,
|
|
262
|
-
fontSizeBaseSM,
|
|
263
|
-
fontSizeBaseMD,
|
|
264
|
-
fontSizeBaseLG,
|
|
265
|
-
fontSizeBaseXL,
|
|
266
|
-
fontSizeBaseX2L,
|
|
267
|
-
fontSizeBaseX3L,
|
|
268
|
-
fontSizeBaseX4L,
|
|
269
|
-
fontSizeBaseX5L,
|
|
270
|
-
lineHeightBaseNone,
|
|
271
|
-
lineHeightBaseTight,
|
|
272
|
-
lineHeightBaseSnug,
|
|
273
|
-
lineHeightBaseNormal,
|
|
274
|
-
lineHeightBaseRelaxed,
|
|
275
|
-
lineHeightBaseLoose,
|
|
276
|
-
]
|
|
277
|
-
)
|
|
278
|
-
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
|
|
279
|
-
}
|
|
280
|
-
export const useThemeContext = () => useContext(ThemeContext)
|