@helpwave/hightide-native 0.0.2 → 0.0.6
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/package.json +4 -3
- package/src/components/chat/ChatAttachmentCard.tsx +26 -13
- package/src/components/chat/ChatConversationList.tsx +12 -8
- package/src/components/chat/ChatConversationRow.tsx +21 -13
- package/src/components/chat/ChatDateDivider.tsx +18 -8
- package/src/components/chat/ChatMessageBubble.tsx +23 -13
- package/src/components/chat/ChatMessageCard.tsx +25 -14
- package/src/components/chat/ChatMessageComposer.tsx +14 -9
- package/src/components/chat/ChatMessageList.tsx +12 -5
- package/src/components/chat/ChatQuickReplyChip.tsx +7 -6
- package/src/components/chat/ChatSystemLine.tsx +21 -10
- package/src/components/chat/ChatThreadHeader.tsx +19 -9
- package/src/components/menu/Menu.tsx +16 -6
- package/src/components/menu/MenuActionItem.tsx +10 -5
- package/src/components/menu/MenuItem.tsx +16 -6
- package/src/components/menu/MenuNavigationItem.tsx +11 -6
- package/src/components/user-interaction/Button.tsx +18 -11
- package/src/components/user-interaction/Checkbox.tsx +26 -7
- package/src/components/user-interaction/IconButton.tsx +23 -9
- package/src/components/user-interaction/Input.tsx +22 -5
- package/src/components/user-interaction/MultiSelect.tsx +14 -7
- package/src/components/user-interaction/Select.tsx +11 -4
- package/src/components/visualization-and-display/Chip.tsx +21 -9
- package/src/components/visualization-and-display/Icon.tsx +27 -0
- package/src/components/visualization-and-display/index.ts +1 -0
- package/src/global-contexts/HightideContext.ts +4 -1
- package/src/global-contexts/HightideProvider.tsx +21 -9
- package/src/global-contexts/hightide-config/HightideConfigUtils.ts +15 -12
- package/src/global-contexts/localization/LocalizationProvider.tsx +3 -1
- package/src/global-contexts/localization/forward-exports.ts +1 -0
- package/src/global-contexts/theme/ThemeContext.ts +11 -6
- package/src/global-contexts/theme/ThemeProvider.tsx +34 -37
- package/src/hooks/useMultiSelect.ts +1 -0
- package/src/hooks/useNativeKeyValueStore.ts +7 -1
- package/src/hooks/useSelect.ts +1 -0
- package/src/theme/resolvers/button.ts +33 -20
- package/src/theme/resolvers/chat.ts +370 -336
- package/src/theme/resolvers/checkbox.ts +22 -18
- package/src/theme/resolvers/chip.ts +27 -19
- package/src/theme/resolvers/coloring.ts +21 -17
- package/src/theme/resolvers/iconButton.ts +25 -17
- package/src/theme/resolvers/input.ts +25 -18
- package/src/theme/resolvers/menu.ts +37 -29
- package/src/theme/resolvers/multiSelect.ts +20 -16
- package/src/theme/resolvers/select.ts +20 -16
- package/src/theme/themes/createTheme.ts +42 -17
- package/src/theme/themes/nativeThemes.ts +7 -6
- package/src/theme/types/color.ts +60 -0
- package/src/theme/types/components/button.ts +30 -0
- package/src/theme/types/components/chat.ts +198 -0
- package/src/theme/types/{checkbox.ts → components/checkbox.ts} +11 -5
- package/src/theme/types/components/chip.ts +30 -0
- package/src/theme/types/{components.ts → components/hightide.ts} +22 -1
- package/src/theme/types/components/iconButton.ts +30 -0
- package/src/theme/types/components/index.ts +10 -0
- package/src/theme/types/components/input.ts +19 -0
- package/src/theme/types/{menu.ts → components/menu.ts} +21 -14
- package/src/theme/types/{multiSelect.ts → components/multiSelect.ts} +13 -9
- package/src/theme/types/{select.ts → components/select.ts} +18 -11
- package/src/theme/types/decoration.ts +11 -0
- package/src/theme/types/index.ts +4 -9
- package/src/theme/types/layout.ts +46 -0
- package/src/theme/types/theme.ts +14 -10
- package/src/theme/types/typography.ts +18 -0
- package/src/icons/Icon.tsx +0 -35
- package/src/icons/index.ts +0 -1
- package/src/theme/types/button.ts +0 -18
- package/src/theme/types/chat.ts +0 -141
- package/src/theme/types/chip.ts +0 -18
- package/src/theme/types/iconButton.ts +0 -20
- package/src/theme/types/input.ts +0 -15
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
remToPx,
|
|
3
|
-
spacing,
|
|
4
|
-
type ComponentColors,
|
|
5
|
-
type DesignTheme as DesignTokensTheme,
|
|
6
|
-
type ElementSize,
|
|
7
|
-
type SemanticColors
|
|
8
|
-
} from '@helpwave/hightide-design'
|
|
9
1
|
import type { ViewStyle } from 'react-native'
|
|
2
|
+
|
|
3
|
+
import { componentLayouts } from '@helpwave/hightide-design/tokens'
|
|
4
|
+
import type {
|
|
5
|
+
ComponentColorTokens,
|
|
6
|
+
HightideDesignTokens as DesignTokensTheme,
|
|
7
|
+
ElementSize
|
|
8
|
+
} from '@helpwave/hightide-design/types'
|
|
9
|
+
|
|
10
|
+
import type { HightideSemanticColors } from '../types/color'
|
|
10
11
|
import type {
|
|
11
12
|
CheckboxSize,
|
|
12
13
|
CheckboxState,
|
|
13
14
|
CheckboxTheme
|
|
14
|
-
} from '../types'
|
|
15
|
-
import {
|
|
15
|
+
} from '../types/components/checkbox'
|
|
16
|
+
import {
|
|
17
|
+
createStyleResolver,
|
|
18
|
+
createValueResolver
|
|
19
|
+
} from '../types/resolver'
|
|
16
20
|
|
|
17
21
|
const checkboxSizes: Record<CheckboxSize, number> = {
|
|
18
|
-
sm:
|
|
19
|
-
md:
|
|
20
|
-
lg:
|
|
22
|
+
sm: 20,
|
|
23
|
+
md: 24,
|
|
24
|
+
lg: 32,
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
const checkboxIconSizes: Record<CheckboxSize, Exclude<ElementSize, 'xs'>> = {
|
|
@@ -27,8 +31,8 @@ const checkboxIconSizes: Record<CheckboxSize, Exclude<ElementSize, 'xs'>> = {
|
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
export type CreateCheckboxThemeOptions = {
|
|
30
|
-
semantic:
|
|
31
|
-
component:
|
|
34
|
+
semantic: HightideSemanticColors,
|
|
35
|
+
component: ComponentColorTokens,
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
export const createCheckboxTheme = ({
|
|
@@ -56,7 +60,7 @@ export const createCheckboxTheme = ({
|
|
|
56
60
|
height: dimension,
|
|
57
61
|
alignItems: 'center',
|
|
58
62
|
justifyContent: 'center',
|
|
59
|
-
borderWidth:
|
|
63
|
+
borderWidth: componentLayouts.shared.coloringOutlineWidth,
|
|
60
64
|
borderColor,
|
|
61
65
|
borderRadius: state.isRounded ? dimension / 2 : 6,
|
|
62
66
|
backgroundColor,
|
|
@@ -81,7 +85,7 @@ export const createCheckboxTheme = ({
|
|
|
81
85
|
|
|
82
86
|
export const createCheckboxThemeFromDesign = (theme: DesignTokensTheme): CheckboxTheme => {
|
|
83
87
|
return createCheckboxTheme({
|
|
84
|
-
semantic: theme.
|
|
85
|
-
component: theme.
|
|
88
|
+
semantic: theme.semanticColors,
|
|
89
|
+
component: theme.componentColors,
|
|
86
90
|
})
|
|
87
91
|
}
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
TextStyle,
|
|
3
|
+
ViewStyle
|
|
4
|
+
} from 'react-native'
|
|
5
|
+
|
|
1
6
|
import {
|
|
2
7
|
componentLayouts,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '@helpwave/hightide-design'
|
|
8
|
-
import type { TextStyle, ViewStyle } from 'react-native'
|
|
9
|
-
import type { ChipState, ChipTheme } from '../types'
|
|
10
|
-
import { createStyleResolver } from '../types/resolver'
|
|
8
|
+
fontWeights
|
|
9
|
+
} from '@helpwave/hightide-design/tokens'
|
|
10
|
+
import type { HightideDesignTokens as DesignTokensTheme } from '@helpwave/hightide-design/types'
|
|
11
|
+
|
|
11
12
|
import { resolveColoringStyles } from './coloring'
|
|
13
|
+
import type { HightideSemanticColors } from '../types/color'
|
|
14
|
+
import type {
|
|
15
|
+
ChipState,
|
|
16
|
+
ChipTheme
|
|
17
|
+
} from '../types/components/chip'
|
|
18
|
+
import type { HightideComponentThemes } from '../types/components/hightide'
|
|
19
|
+
import { createStyleResolver } from '../types/resolver'
|
|
12
20
|
|
|
13
21
|
export type CreateChipThemeOptions = {
|
|
14
|
-
semantic:
|
|
15
|
-
coloring:
|
|
22
|
+
semantic: HightideSemanticColors,
|
|
23
|
+
coloring: HightideComponentThemes['coloring'],
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
export const createChipTheme = ({
|
|
@@ -35,18 +43,18 @@ export const createChipTheme = ({
|
|
|
35
43
|
backgroundColor: resolved.backgroundColor,
|
|
36
44
|
borderColor: resolved.borderColor,
|
|
37
45
|
borderWidth: resolved.borderWidth,
|
|
38
|
-
paddingVertical:
|
|
39
|
-
paddingHorizontal:
|
|
40
|
-
gap:
|
|
41
|
-
minHeight:
|
|
42
|
-
borderRadius:
|
|
46
|
+
paddingVertical: layout.paddingVertical,
|
|
47
|
+
paddingHorizontal: layout.paddingHorizontal,
|
|
48
|
+
gap: layout.gap,
|
|
49
|
+
minHeight: layout.minHeight,
|
|
50
|
+
borderRadius: layout.borderRadius,
|
|
43
51
|
opacity: state.isDisabled ? 0.6 : 1,
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
const text: TextStyle = {
|
|
47
55
|
color: resolved.color,
|
|
48
|
-
fontSize:
|
|
49
|
-
fontWeight:
|
|
56
|
+
fontSize: layout.fontSize,
|
|
57
|
+
fontWeight: fontWeights.semibold,
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
return { chip, text }
|
|
@@ -60,7 +68,7 @@ export const createChipTheme = ({
|
|
|
60
68
|
|
|
61
69
|
export const createChipThemeFromDesign = (theme: DesignTokensTheme): ChipTheme => {
|
|
62
70
|
return createChipTheme({
|
|
63
|
-
semantic: theme.
|
|
64
|
-
coloring: theme.coloring,
|
|
71
|
+
semantic: theme.semanticColors,
|
|
72
|
+
coloring: theme.coloring as HightideComponentThemes['coloring'],
|
|
65
73
|
})
|
|
66
74
|
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
hexWithAlpha
|
|
3
|
+
} from '@helpwave/hightide-design/helpers'
|
|
4
|
+
import { componentLayouts } from '@helpwave/hightide-design/tokens'
|
|
5
|
+
import type {
|
|
6
|
+
ButtonColoringStyle,
|
|
7
|
+
ChipColoringStyle,
|
|
8
|
+
ColoringStyle
|
|
9
|
+
} from '@helpwave/hightide-design/types'
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
Color,
|
|
13
|
+
HightideSemanticColors
|
|
14
|
+
} from '../types/color'
|
|
15
|
+
import type { ColoringDefinition } from '../types/components/hightide'
|
|
16
|
+
import type { InteractionState } from '../types/resolver'
|
|
13
17
|
|
|
14
18
|
export type ResolvedColoringStyles = {
|
|
15
|
-
backgroundColor:
|
|
16
|
-
color:
|
|
17
|
-
borderColor?:
|
|
19
|
+
backgroundColor: Color | 'transparent',
|
|
20
|
+
color: Color,
|
|
21
|
+
borderColor?: Color,
|
|
18
22
|
borderWidth: number,
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -23,12 +27,12 @@ const usesHover = (state: InteractionState): boolean => {
|
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
export const resolveColoringStyles = (
|
|
26
|
-
tokens:
|
|
30
|
+
tokens: ColoringDefinition,
|
|
27
31
|
coloringStyle: ColoringStyle,
|
|
28
|
-
semantic:
|
|
32
|
+
semantic: HightideSemanticColors,
|
|
29
33
|
state: InteractionState = {}
|
|
30
34
|
): ResolvedColoringStyles => {
|
|
31
|
-
const outlineWidth =
|
|
35
|
+
const outlineWidth = componentLayouts.shared.coloringOutlineWidth
|
|
32
36
|
const hovered = usesHover(state)
|
|
33
37
|
|
|
34
38
|
if (state.isDisabled) {
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
componentLayouts,
|
|
3
|
-
toPx,
|
|
4
|
-
type ColoringTokensDefinitions,
|
|
5
|
-
type DesignTheme as DesignTokensTheme,
|
|
6
|
-
type SemanticColors
|
|
7
|
-
} from '@helpwave/hightide-design'
|
|
8
1
|
import type { ViewStyle } from 'react-native'
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { componentLayouts } from '@helpwave/hightide-design/tokens'
|
|
4
|
+
import type { HightideDesignTokens as DesignTokensTheme } from '@helpwave/hightide-design/types'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
isOutlineColoringStyle,
|
|
8
|
+
resolveColoringStyles
|
|
9
|
+
} from './coloring'
|
|
10
|
+
import type { HightideSemanticColors } from '../types/color'
|
|
11
|
+
import type { HightideComponentThemes } from '../types/components/hightide'
|
|
12
|
+
import type {
|
|
13
|
+
IconButtonState,
|
|
14
|
+
IconButtonTheme
|
|
15
|
+
} from '../types/components/iconButton'
|
|
16
|
+
import {
|
|
17
|
+
createStyleResolver,
|
|
18
|
+
createValueResolver
|
|
19
|
+
} from '../types/resolver'
|
|
12
20
|
|
|
13
21
|
export type CreateIconButtonThemeOptions = {
|
|
14
|
-
semantic:
|
|
15
|
-
coloring:
|
|
22
|
+
semantic: HightideSemanticColors,
|
|
23
|
+
coloring: HightideComponentThemes['coloring'],
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
export const createIconButtonTheme = ({
|
|
@@ -26,8 +34,8 @@ export const createIconButtonTheme = ({
|
|
|
26
34
|
const tokens = coloring[color]
|
|
27
35
|
const resolved = resolveColoringStyles(tokens, coloringStyle, semantic, state)
|
|
28
36
|
const sizing = componentLayouts.element[size]
|
|
29
|
-
const outlineWidth =
|
|
30
|
-
const dimension =
|
|
37
|
+
const outlineWidth = componentLayouts.shared.coloringOutlineWidth
|
|
38
|
+
const dimension = sizing.height
|
|
31
39
|
const borderWidth = resolved.borderWidth > 0
|
|
32
40
|
? resolved.borderWidth
|
|
33
41
|
: (isOutlineColoringStyle(coloringStyle) ? outlineWidth : 0)
|
|
@@ -40,7 +48,7 @@ export const createIconButtonTheme = ({
|
|
|
40
48
|
borderWidth,
|
|
41
49
|
width: dimension,
|
|
42
50
|
height: dimension,
|
|
43
|
-
borderRadius:
|
|
51
|
+
borderRadius: componentLayouts.button[size].borderRadius,
|
|
44
52
|
opacity: state.isDisabled ? 0.6 : 1,
|
|
45
53
|
}
|
|
46
54
|
|
|
@@ -58,7 +66,7 @@ export const createIconButtonTheme = ({
|
|
|
58
66
|
|
|
59
67
|
export const createIconButtonThemeFromDesign = (theme: DesignTokensTheme): IconButtonTheme => {
|
|
60
68
|
return createIconButtonTheme({
|
|
61
|
-
semantic: theme.
|
|
62
|
-
coloring: theme.coloring,
|
|
69
|
+
semantic: theme.semanticColors,
|
|
70
|
+
coloring: theme.coloring as HightideComponentThemes['coloring'],
|
|
63
71
|
})
|
|
64
72
|
}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
inputElementSizes,
|
|
3
|
-
remToPx,
|
|
4
|
-
type ComponentColors,
|
|
5
|
-
type DesignTheme as DesignTokensTheme,
|
|
6
|
-
type SemanticColors
|
|
7
|
-
} from '@helpwave/hightide-design'
|
|
8
1
|
import type { TextStyle } from 'react-native'
|
|
9
|
-
|
|
10
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { componentLayouts } from '@helpwave/hightide-design/tokens'
|
|
4
|
+
import type {
|
|
5
|
+
ComponentColorTokens,
|
|
6
|
+
HightideDesignTokens as DesignTokensTheme
|
|
7
|
+
} from '@helpwave/hightide-design/types'
|
|
8
|
+
|
|
9
|
+
import type { HightideSemanticColors } from '../types/color'
|
|
10
|
+
import type {
|
|
11
|
+
InputState,
|
|
12
|
+
InputTheme
|
|
13
|
+
} from '../types/components/input'
|
|
14
|
+
import {
|
|
15
|
+
createStyleResolver,
|
|
16
|
+
createValueResolver
|
|
17
|
+
} from '../types/resolver'
|
|
11
18
|
|
|
12
19
|
export type CreateInputThemeOptions = {
|
|
13
|
-
semantic:
|
|
14
|
-
component:
|
|
20
|
+
semantic: HightideSemanticColors,
|
|
21
|
+
component: ComponentColorTokens,
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
export const createInputTheme = ({
|
|
@@ -19,14 +26,14 @@ export const createInputTheme = ({
|
|
|
19
26
|
component,
|
|
20
27
|
}: CreateInputThemeOptions): InputTheme => {
|
|
21
28
|
const resolveInput = (state: InputState): TextStyle => {
|
|
22
|
-
const sizing =
|
|
29
|
+
const sizing = componentLayouts.input.md
|
|
23
30
|
const borderColor = state.isInvalid ? semantic.negative : component.border
|
|
24
31
|
|
|
25
32
|
return {
|
|
26
|
-
minHeight:
|
|
27
|
-
paddingHorizontal:
|
|
28
|
-
paddingVertical:
|
|
29
|
-
borderRadius:
|
|
33
|
+
minHeight: sizing.height,
|
|
34
|
+
paddingHorizontal: sizing.paddingX,
|
|
35
|
+
paddingVertical: sizing.paddingY,
|
|
36
|
+
borderRadius: sizing.borderRadius,
|
|
30
37
|
borderWidth: 1,
|
|
31
38
|
borderColor,
|
|
32
39
|
backgroundColor: state.isDisabled ? semantic.disabled : component.input.background,
|
|
@@ -44,7 +51,7 @@ export const createInputTheme = ({
|
|
|
44
51
|
|
|
45
52
|
export const createInputThemeFromDesign = (theme: DesignTokensTheme): InputTheme => {
|
|
46
53
|
return createInputTheme({
|
|
47
|
-
semantic: theme.
|
|
48
|
-
component: theme.
|
|
54
|
+
semantic: theme.semanticColors,
|
|
55
|
+
component: theme.componentColors,
|
|
49
56
|
})
|
|
50
57
|
}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native'
|
|
2
|
+
|
|
3
|
+
import { fontWeights } from '@helpwave/hightide-design/tokens'
|
|
4
|
+
import type {
|
|
5
|
+
ComponentColorTokens,
|
|
6
|
+
HightideDesignTokens as DesignTokensTheme
|
|
7
|
+
} from '@helpwave/hightide-design/types'
|
|
8
|
+
|
|
9
|
+
import type { HightideSemanticColors } from '../types/color'
|
|
10
|
+
import type {
|
|
11
|
+
MenuActionItemState,
|
|
12
|
+
MenuTheme
|
|
13
|
+
} from '../types/components/menu'
|
|
2
14
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type SemanticColors
|
|
7
|
-
} from '@helpwave/hightide-design'
|
|
8
|
-
import type { MenuActionItemState, MenuTheme } from '../types'
|
|
9
|
-
import { createStyleResolver, createValueResolver } from '../types/resolver'
|
|
15
|
+
createStyleResolver,
|
|
16
|
+
createValueResolver
|
|
17
|
+
} from '../types/resolver'
|
|
10
18
|
|
|
11
19
|
export type CreateMenuThemeOptions = {
|
|
12
|
-
semantic:
|
|
13
|
-
component:
|
|
20
|
+
semantic: HightideSemanticColors,
|
|
21
|
+
component: ComponentColorTokens,
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
export const createMenuTheme = ({
|
|
@@ -24,9 +32,9 @@ export const createMenuTheme = ({
|
|
|
24
32
|
flexDirection: 'row' as const,
|
|
25
33
|
alignItems: 'center' as const,
|
|
26
34
|
minHeight: 64,
|
|
27
|
-
gap:
|
|
28
|
-
paddingHorizontal:
|
|
29
|
-
paddingVertical:
|
|
35
|
+
gap: 12,
|
|
36
|
+
paddingHorizontal: 16,
|
|
37
|
+
paddingVertical: 8,
|
|
30
38
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
31
39
|
borderBottomColor: component.divider,
|
|
32
40
|
backgroundColor: pressed ? semantic.surfaceHover : ('transparent' as const),
|
|
@@ -36,14 +44,14 @@ export const createMenuTheme = ({
|
|
|
36
44
|
|
|
37
45
|
const resolveItemContent = () => ({
|
|
38
46
|
flex: 1,
|
|
39
|
-
gap:
|
|
47
|
+
gap: 4,
|
|
40
48
|
justifyContent: 'center' as const,
|
|
41
49
|
})
|
|
42
50
|
|
|
43
51
|
const resolveActionLabel = (state: MenuActionItemState) => ({
|
|
44
52
|
color: state.isDanger ? semantic.negative : semantic.onSurface,
|
|
45
|
-
fontSize:
|
|
46
|
-
fontWeight:
|
|
53
|
+
fontSize: 15,
|
|
54
|
+
fontWeight: fontWeights.medium,
|
|
47
55
|
})
|
|
48
56
|
|
|
49
57
|
const resolveActionIcon = (state: MenuActionItemState) => ({
|
|
@@ -52,20 +60,20 @@ export const createMenuTheme = ({
|
|
|
52
60
|
|
|
53
61
|
return {
|
|
54
62
|
section: createStyleResolver(() => ({
|
|
55
|
-
marginBottom:
|
|
56
|
-
gap:
|
|
63
|
+
marginBottom: 20,
|
|
64
|
+
gap: 8,
|
|
57
65
|
})),
|
|
58
66
|
sectionTitle: createStyleResolver(() => ({
|
|
59
67
|
color: semantic.description,
|
|
60
|
-
fontSize:
|
|
61
|
-
fontWeight:
|
|
68
|
+
fontSize: 12,
|
|
69
|
+
fontWeight: fontWeights.bold,
|
|
62
70
|
letterSpacing: 0.4,
|
|
63
71
|
textTransform: 'uppercase',
|
|
64
|
-
paddingHorizontal:
|
|
72
|
+
paddingHorizontal: 4,
|
|
65
73
|
})),
|
|
66
74
|
card: createStyleResolver(() => ({
|
|
67
75
|
backgroundColor: semantic.surface,
|
|
68
|
-
borderRadius:
|
|
76
|
+
borderRadius: 12,
|
|
69
77
|
borderWidth: 1,
|
|
70
78
|
borderColor: component.border,
|
|
71
79
|
overflow: 'hidden',
|
|
@@ -74,21 +82,21 @@ export const createMenuTheme = ({
|
|
|
74
82
|
flexDirection: 'row' as const,
|
|
75
83
|
alignItems: 'center' as const,
|
|
76
84
|
minHeight: 64,
|
|
77
|
-
paddingHorizontal:
|
|
78
|
-
paddingVertical:
|
|
85
|
+
paddingHorizontal: 16,
|
|
86
|
+
paddingVertical: 8,
|
|
79
87
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
80
88
|
borderBottomColor: component.divider,
|
|
81
|
-
gap:
|
|
89
|
+
gap: 12,
|
|
82
90
|
})),
|
|
83
91
|
itemContent: createStyleResolver(resolveItemContent),
|
|
84
92
|
itemLabel: createStyleResolver(() => ({
|
|
85
93
|
color: semantic.description,
|
|
86
|
-
fontSize:
|
|
94
|
+
fontSize: 12,
|
|
87
95
|
})),
|
|
88
96
|
itemValue: createStyleResolver(() => ({
|
|
89
97
|
color: semantic.onSurface,
|
|
90
|
-
fontSize:
|
|
91
|
-
fontWeight:
|
|
98
|
+
fontSize: 15,
|
|
99
|
+
fontWeight: fontWeights.medium,
|
|
92
100
|
})),
|
|
93
101
|
actionItem: createStyleResolver(resolveActionItem),
|
|
94
102
|
actionItemContent: createStyleResolver(resolveItemContent),
|
|
@@ -106,7 +114,7 @@ export const createMenuTheme = ({
|
|
|
106
114
|
|
|
107
115
|
export const createMenuThemeFromDesign = (theme: DesignTokensTheme): MenuTheme => {
|
|
108
116
|
return createMenuTheme({
|
|
109
|
-
semantic: theme.
|
|
110
|
-
component: theme.
|
|
117
|
+
semantic: theme.semanticColors,
|
|
118
|
+
component: theme.componentColors,
|
|
111
119
|
})
|
|
112
120
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { fontWeights } from '@helpwave/hightide-design/tokens'
|
|
2
|
+
import type {
|
|
3
|
+
ComponentColorTokens,
|
|
4
|
+
HightideDesignTokens as DesignTokensTheme
|
|
5
|
+
} from '@helpwave/hightide-design/types'
|
|
6
|
+
|
|
7
|
+
import type { HightideSemanticColors } from '../types/color'
|
|
7
8
|
import type {
|
|
8
9
|
MultiSelectOptionState,
|
|
9
10
|
MultiSelectState,
|
|
10
11
|
MultiSelectTheme
|
|
11
|
-
} from '../types'
|
|
12
|
-
import {
|
|
12
|
+
} from '../types/components/multiSelect'
|
|
13
|
+
import {
|
|
14
|
+
createStyleResolver,
|
|
15
|
+
createValueResolver
|
|
16
|
+
} from '../types/resolver'
|
|
13
17
|
|
|
14
18
|
export type CreateMultiSelectThemeOptions = {
|
|
15
|
-
semantic:
|
|
16
|
-
component:
|
|
19
|
+
semantic: HightideSemanticColors,
|
|
20
|
+
component: ComponentColorTokens,
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
export const createMultiSelectTheme = ({
|
|
@@ -23,9 +27,9 @@ export const createMultiSelectTheme = ({
|
|
|
23
27
|
return {
|
|
24
28
|
trigger: createStyleResolver((state: MultiSelectState) => ({
|
|
25
29
|
minHeight: 44,
|
|
26
|
-
paddingHorizontal:
|
|
27
|
-
paddingVertical:
|
|
28
|
-
borderRadius:
|
|
30
|
+
paddingHorizontal: 12,
|
|
31
|
+
paddingVertical: 8,
|
|
32
|
+
borderRadius: 6,
|
|
29
33
|
borderWidth: 1,
|
|
30
34
|
borderColor: state.isInvalid ? semantic.negative : component.border,
|
|
31
35
|
backgroundColor: state.isDisabled ? semantic.disabled : component.input.background,
|
|
@@ -69,7 +73,7 @@ export const createMultiSelectTheme = ({
|
|
|
69
73
|
})),
|
|
70
74
|
optionText: createStyleResolver((state: MultiSelectOptionState) => ({
|
|
71
75
|
color: state.isSelected ? semantic.primary : component.menu.text,
|
|
72
|
-
fontWeight: state.isSelected ?
|
|
76
|
+
fontWeight: state.isSelected ? fontWeights.semibold : fontWeights.base,
|
|
73
77
|
})),
|
|
74
78
|
checkbox: createStyleResolver((state: MultiSelectOptionState) => ({
|
|
75
79
|
width: 18,
|
|
@@ -90,7 +94,7 @@ export const createMultiSelectTheme = ({
|
|
|
90
94
|
|
|
91
95
|
export const createMultiSelectThemeFromDesign = (theme: DesignTokensTheme): MultiSelectTheme => {
|
|
92
96
|
return createMultiSelectTheme({
|
|
93
|
-
semantic: theme.
|
|
94
|
-
component: theme.
|
|
97
|
+
semantic: theme.semanticColors,
|
|
98
|
+
component: theme.componentColors,
|
|
95
99
|
})
|
|
96
100
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { fontWeights } from '@helpwave/hightide-design/tokens'
|
|
2
|
+
import type {
|
|
3
|
+
ComponentColorTokens,
|
|
4
|
+
HightideDesignTokens as DesignTokensTheme
|
|
5
|
+
} from '@helpwave/hightide-design/types'
|
|
6
|
+
|
|
7
|
+
import type { HightideSemanticColors } from '../types/color'
|
|
7
8
|
import type {
|
|
8
9
|
SelectOptionState,
|
|
9
10
|
SelectState,
|
|
10
11
|
SelectTheme
|
|
11
|
-
} from '../types'
|
|
12
|
-
import {
|
|
12
|
+
} from '../types/components/select'
|
|
13
|
+
import {
|
|
14
|
+
createStyleResolver,
|
|
15
|
+
createValueResolver
|
|
16
|
+
} from '../types/resolver'
|
|
13
17
|
|
|
14
18
|
export type CreateSelectThemeOptions = {
|
|
15
|
-
semantic:
|
|
16
|
-
component:
|
|
19
|
+
semantic: HightideSemanticColors,
|
|
20
|
+
component: ComponentColorTokens,
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
export const createSelectTheme = ({
|
|
@@ -23,9 +27,9 @@ export const createSelectTheme = ({
|
|
|
23
27
|
return {
|
|
24
28
|
trigger: createStyleResolver((state: SelectState) => ({
|
|
25
29
|
minHeight: 44,
|
|
26
|
-
paddingHorizontal:
|
|
27
|
-
paddingVertical:
|
|
28
|
-
borderRadius:
|
|
30
|
+
paddingHorizontal: 12,
|
|
31
|
+
paddingVertical: 8,
|
|
32
|
+
borderRadius: 6,
|
|
29
33
|
borderWidth: 1,
|
|
30
34
|
borderColor: state.isInvalid ? semantic.negative : component.border,
|
|
31
35
|
backgroundColor: state.isDisabled ? semantic.disabled : component.input.background,
|
|
@@ -65,14 +69,14 @@ export const createSelectTheme = ({
|
|
|
65
69
|
})),
|
|
66
70
|
optionText: createStyleResolver((state: SelectOptionState) => ({
|
|
67
71
|
color: state.isSelected ? semantic.primary : component.menu.text,
|
|
68
|
-
fontWeight: state.isSelected ?
|
|
72
|
+
fontWeight: state.isSelected ? fontWeights.semibold : fontWeights.base,
|
|
69
73
|
})),
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
export const createSelectThemeFromDesign = (theme: DesignTokensTheme): SelectTheme => {
|
|
74
78
|
return createSelectTheme({
|
|
75
|
-
semantic: theme.
|
|
76
|
-
component: theme.
|
|
79
|
+
semantic: theme.semanticColors,
|
|
80
|
+
component: theme.componentColors,
|
|
77
81
|
})
|
|
78
82
|
}
|
|
@@ -1,22 +1,47 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
createCheckboxThemeFromDesign,
|
|
6
|
-
createChipThemeFromDesign,
|
|
7
|
-
createIconButtonThemeFromDesign,
|
|
8
|
-
createInputThemeFromDesign,
|
|
9
|
-
createMenuThemeFromDesign,
|
|
10
|
-
createMultiSelectThemeFromDesign,
|
|
11
|
-
createSelectThemeFromDesign
|
|
12
|
-
} from '../resolvers'
|
|
13
|
-
import type { DesignTheme } from '../types'
|
|
1
|
+
import type {
|
|
2
|
+
ColorPaletteToken,
|
|
3
|
+
HightideDesignTokens
|
|
4
|
+
} from '@helpwave/hightide-design/types'
|
|
14
5
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
import { createButtonThemeFromDesign } from '../resolvers/button'
|
|
7
|
+
import { createChatThemeFromDesign } from '../resolvers/chat'
|
|
8
|
+
import { createCheckboxThemeFromDesign } from '../resolvers/checkbox'
|
|
9
|
+
import { createChipThemeFromDesign } from '../resolvers/chip'
|
|
10
|
+
import { createIconButtonThemeFromDesign } from '../resolvers/iconButton'
|
|
11
|
+
import { createInputThemeFromDesign } from '../resolvers/input'
|
|
12
|
+
import { createMenuThemeFromDesign } from '../resolvers/menu'
|
|
13
|
+
import { createMultiSelectThemeFromDesign } from '../resolvers/multiSelect'
|
|
14
|
+
import { createSelectThemeFromDesign } from '../resolvers/select'
|
|
15
|
+
import type {
|
|
16
|
+
Color,
|
|
17
|
+
ColorPalette,
|
|
18
|
+
HightideColors
|
|
19
|
+
} from '../types/color'
|
|
20
|
+
import type { Theme } from '../types/theme'
|
|
21
|
+
|
|
22
|
+
const unwrapColorPaletteToken = (token: ColorPaletteToken): Color | ColorPalette => {
|
|
23
|
+
if (token.type === 'singleValue') {
|
|
24
|
+
return token.value
|
|
25
|
+
}
|
|
26
|
+
return token.value
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const unwrapColors = (colors: HightideDesignTokens['colors']): HightideColors & Record<string, Color | ColorPalette> => {
|
|
30
|
+
const result: Record<string, Color | ColorPalette> = {}
|
|
31
|
+
for (const [key, token] of Object.entries(colors)) {
|
|
32
|
+
result[key] = unwrapColorPaletteToken(token)
|
|
33
|
+
}
|
|
34
|
+
return result as HightideColors & Record<string, Color | ColorPalette>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const createTheme = (tokens: HightideDesignTokens): Theme => ({
|
|
38
|
+
colors: unwrapColors(tokens.colors),
|
|
39
|
+
semantic: tokens.semanticColors,
|
|
40
|
+
typography: tokens.typography,
|
|
41
|
+
layout: tokens.layout,
|
|
42
|
+
decoration: tokens.decorcation,
|
|
19
43
|
components: {
|
|
44
|
+
coloring: tokens.coloring,
|
|
20
45
|
button: createButtonThemeFromDesign(tokens),
|
|
21
46
|
iconButton: createIconButtonThemeFromDesign(tokens),
|
|
22
47
|
chip: createChipThemeFromDesign(tokens),
|