@helpwave/hightide-native 0.0.8 → 0.1.0

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.
Files changed (125) hide show
  1. package/README.md +4 -4
  2. package/package.json +8 -19
  3. package/src/components/card/Card.tsx +41 -0
  4. package/src/components/card/index.ts +1 -0
  5. package/src/components/chat/ChatAttachmentMessageBubble.tsx +246 -0
  6. package/src/components/chat/ChatConversationRow.tsx +21 -16
  7. package/src/components/chat/ChatDateDivider.tsx +2 -2
  8. package/src/components/chat/ChatMessageBubble.tsx +62 -52
  9. package/src/components/chat/ChatMessageComposer.tsx +16 -14
  10. package/src/components/chat/ChatQuickReplyChip.tsx +41 -43
  11. package/src/components/chat/ChatSystemLine.tsx +14 -7
  12. package/src/components/chat/ChatThreadHeader.tsx +60 -6
  13. package/src/components/chat/index.ts +1 -2
  14. package/src/components/index.ts +3 -1
  15. package/src/components/layout/Divider.tsx +60 -0
  16. package/src/components/layout/index.ts +1 -0
  17. package/src/components/list/ListActionItem.tsx +99 -0
  18. package/src/components/list/ListItem.tsx +96 -0
  19. package/src/components/list/ListNavigationItem.tsx +102 -0
  20. package/src/components/list/index.ts +3 -0
  21. package/src/components/user-interaction/Button.tsx +80 -31
  22. package/src/components/user-interaction/Checkbox.tsx +72 -32
  23. package/src/components/user-interaction/IconButton.tsx +68 -30
  24. package/src/components/user-interaction/Input.tsx +61 -14
  25. package/src/components/user-interaction/MultiSelect.tsx +142 -75
  26. package/src/components/user-interaction/SearchBar.tsx +222 -0
  27. package/src/components/user-interaction/Select.tsx +129 -58
  28. package/src/components/user-interaction/Switch.tsx +110 -80
  29. package/src/components/user-interaction/ThemedPressable.tsx +136 -0
  30. package/src/components/user-interaction/index.ts +2 -0
  31. package/src/components/visualization-and-display/Avatar.tsx +112 -93
  32. package/src/components/visualization-and-display/Chip.tsx +22 -22
  33. package/src/components/visualization-and-display/ThemedIcon.tsx +72 -0
  34. package/src/components/visualization-and-display/ThemedText.tsx +38 -0
  35. package/src/components/visualization-and-display/index.ts +2 -1
  36. package/src/global-contexts/HightideProvider.tsx +19 -10
  37. package/src/global-contexts/content-theme/ContentThemeContext.ts +22 -0
  38. package/src/global-contexts/content-theme/ContentThemeProvider.tsx +32 -0
  39. package/src/global-contexts/content-theme/index.ts +2 -0
  40. package/src/global-contexts/debug/forward-exports.ts +10 -0
  41. package/src/global-contexts/debug/index.ts +1 -0
  42. package/src/global-contexts/index.ts +2 -0
  43. package/src/global-contexts/theme/ThemeProvider.tsx +7 -1
  44. package/src/icons/HightideIconRegistry.ts +33 -0
  45. package/src/icons/index.ts +2 -0
  46. package/src/icons/types.ts +11 -0
  47. package/src/theme/adapters/container-adapter.ts +323 -0
  48. package/src/theme/adapters/defined.ts +11 -0
  49. package/src/theme/adapters/icon-style-adapter.ts +10 -0
  50. package/src/theme/adapters/index.ts +4 -0
  51. package/src/theme/adapters/text-style-adapter.ts +16 -0
  52. package/src/theme/index.ts +1 -0
  53. package/src/theme/resolvers/avatar.ts +385 -186
  54. package/src/theme/resolvers/button.ts +50 -82
  55. package/src/theme/resolvers/card.ts +27 -0
  56. package/src/theme/resolvers/chat/attachment-message-bubble.ts +163 -0
  57. package/src/theme/resolvers/chat/chat-theme.ts +69 -0
  58. package/src/theme/resolvers/chat/conversation-list.ts +35 -0
  59. package/src/theme/resolvers/chat/conversation-row.ts +64 -0
  60. package/src/theme/resolvers/chat/date-divider.ts +31 -0
  61. package/src/theme/resolvers/chat/index.ts +11 -0
  62. package/src/theme/resolvers/chat/message-bubble.ts +57 -0
  63. package/src/theme/resolvers/chat/message-composer.ts +38 -0
  64. package/src/theme/resolvers/chat/message-list.ts +27 -0
  65. package/src/theme/resolvers/chat/quick-reply-chip.ts +80 -0
  66. package/src/theme/resolvers/chat/system-line.ts +41 -0
  67. package/src/theme/resolvers/chat/thread-header.ts +85 -0
  68. package/src/theme/resolvers/checkbox.ts +87 -74
  69. package/src/theme/resolvers/chip.ts +30 -67
  70. package/src/theme/resolvers/colorScheme.ts +136 -0
  71. package/src/theme/resolvers/divider.ts +34 -0
  72. package/src/theme/resolvers/icon.ts +21 -0
  73. package/src/theme/resolvers/iconButton.ts +45 -61
  74. package/src/theme/resolvers/index.ts +7 -2
  75. package/src/theme/resolvers/input.ts +64 -42
  76. package/src/theme/resolvers/listItem.ts +115 -0
  77. package/src/theme/resolvers/multiSelect.ts +159 -84
  78. package/src/theme/resolvers/searchBar.ts +121 -0
  79. package/src/theme/resolvers/select.ts +141 -66
  80. package/src/theme/resolvers/switch.ts +59 -53
  81. package/src/theme/resolvers/themedPressable.ts +54 -0
  82. package/src/theme/themes/createHightideTheme.ts +214 -51
  83. package/src/theme/themes/hightideThemes.ts +10 -6
  84. package/src/theme/types/color.ts +2 -59
  85. package/src/theme/types/components/avatar.ts +37 -36
  86. package/src/theme/types/components/button.ts +13 -14
  87. package/src/theme/types/components/card.ts +9 -0
  88. package/src/theme/types/components/chat.ts +124 -103
  89. package/src/theme/types/components/checkbox.ts +11 -12
  90. package/src/theme/types/components/chip.ts +8 -14
  91. package/src/theme/types/components/divider.ts +18 -0
  92. package/src/theme/types/components/hightide.ts +41 -42
  93. package/src/theme/types/components/iconButton.ts +19 -14
  94. package/src/theme/types/components/index.ts +5 -1
  95. package/src/theme/types/components/input.ts +17 -8
  96. package/src/theme/types/components/listItem.ts +86 -0
  97. package/src/theme/types/components/multiSelect.ts +14 -12
  98. package/src/theme/types/components/searchBar.ts +28 -0
  99. package/src/theme/types/components/select.ts +21 -9
  100. package/src/theme/types/components/switch.ts +12 -5
  101. package/src/theme/types/components/themedPressable.ts +31 -0
  102. package/src/theme/types/decoration.ts +1 -11
  103. package/src/theme/types/icongraphy.ts +8 -0
  104. package/src/theme/types/index.ts +2 -0
  105. package/src/theme/types/layout.ts +25 -57
  106. package/src/theme/types/resolver.ts +54 -1
  107. package/src/theme/types/semantics.ts +72 -0
  108. package/src/theme/types/theme.ts +26 -13
  109. package/src/theme/types/typography.ts +16 -17
  110. package/src/utils/hitBoxOverlay.ts +44 -0
  111. package/src/utils/index.ts +2 -0
  112. package/src/utils/minimumTouchTargetHitSlop.ts +68 -0
  113. package/src/components/chat/ChatAttachmentCard.tsx +0 -110
  114. package/src/components/chat/ChatMessageCard.tsx +0 -118
  115. package/src/components/menu/Menu.tsx +0 -61
  116. package/src/components/menu/MenuActionItem.tsx +0 -90
  117. package/src/components/menu/MenuItem.tsx +0 -73
  118. package/src/components/menu/MenuNavigationItem.tsx +0 -90
  119. package/src/components/menu/index.ts +0 -4
  120. package/src/components/visualization-and-display/Icon.tsx +0 -27
  121. package/src/storybook/helper.tsx +0 -36
  122. package/src/theme/resolvers/chat.ts +0 -418
  123. package/src/theme/resolvers/coloring.ts +0 -94
  124. package/src/theme/resolvers/menu.ts +0 -120
  125. package/src/theme/types/components/menu.ts +0 -57
@@ -0,0 +1,86 @@
1
+ import type { ColorPairToken } from '@helpwave/hightide-design/theme-tokens'
2
+ import type {
3
+ TextStyle,
4
+ ViewStyle
5
+ } from 'react-native'
6
+
7
+ import type {
8
+ InteractionState,
9
+ StyleResolverFunction
10
+ } from '../resolver'
11
+ import type { IconStyle } from '../../../icons'
12
+
13
+ export type ListItemState = {
14
+ color?: ColorPairToken,
15
+ }
16
+
17
+ export type ListItemStyle = ViewStyle
18
+
19
+ export type ListItemLeadingItemContainerStyle = ViewStyle
20
+
21
+ export type ListItemContentStyle = ViewStyle
22
+
23
+ export type ListItemTrailingItemContainerStyle = ViewStyle
24
+
25
+ export type ListItemDescriptionStyle = TextStyle
26
+
27
+ export type ListItemTitleStyle = TextStyle
28
+
29
+ export type ListItemIconStyle = IconStyle
30
+
31
+ export type ListItemDefaultThemeResolvers = {
32
+ container: StyleResolverFunction<ListItemState, ListItemStyle>,
33
+ leadingItemContainer: StyleResolverFunction<ListItemState, ListItemLeadingItemContainerStyle>,
34
+ content: StyleResolverFunction<ListItemState, ListItemContentStyle>,
35
+ trailingItemContainer: StyleResolverFunction<ListItemState, ListItemTrailingItemContainerStyle>,
36
+ descriptionText: StyleResolverFunction<ListItemState, ListItemDescriptionStyle>,
37
+ titleText: StyleResolverFunction<ListItemState, ListItemTitleStyle>,
38
+ icon: StyleResolverFunction<ListItemState, ListItemIconStyle>,
39
+ }
40
+
41
+ export type ListActionItemState = InteractionState & {
42
+ color?: ColorPairToken,
43
+ }
44
+
45
+ export type ListActionItemStyle = ViewStyle
46
+
47
+ export type ListActionItemLeadingItemContainerStyle = ViewStyle
48
+
49
+ export type ListActionItemContentStyle = ViewStyle
50
+
51
+ export type ListActionItemTrailingItemContainerStyle = ViewStyle
52
+
53
+ export type ListActionItemTitleStyle = TextStyle
54
+
55
+ export type ListActionItemIconStyle = IconStyle
56
+
57
+ export type ListActionItemThemeResolvers = {
58
+ container: StyleResolverFunction<ListActionItemState, ListActionItemStyle>,
59
+ leadingItemContainer: StyleResolverFunction<ListActionItemState, ListActionItemLeadingItemContainerStyle>,
60
+ content: StyleResolverFunction<ListActionItemState, ListActionItemContentStyle>,
61
+ trailingItemContainer: StyleResolverFunction<ListActionItemState, ListActionItemTrailingItemContainerStyle>,
62
+ titleText: StyleResolverFunction<ListActionItemState, ListActionItemTitleStyle>,
63
+ icon: StyleResolverFunction<ListActionItemState, ListActionItemIconStyle>,
64
+ }
65
+
66
+ export type ListNavigationItemState = ListActionItemState
67
+
68
+ export type ListNavigationItemStyle = ListActionItemStyle
69
+
70
+ export type ListNavigationItemLeadingItemContainerStyle = ListActionItemLeadingItemContainerStyle
71
+
72
+ export type ListNavigationItemContentStyle = ListActionItemContentStyle
73
+
74
+ export type ListNavigationItemTrailingItemContainerStyle = ListActionItemTrailingItemContainerStyle
75
+
76
+ export type ListNavigationItemTitleStyle = ListActionItemTitleStyle
77
+
78
+ export type ListNavigationItemIconStyle = ListActionItemIconStyle
79
+
80
+ export type ListNavigationItemThemeResolvers = ListActionItemThemeResolvers
81
+
82
+ export type ListItemThemeResolvers = {
83
+ default: ListItemDefaultThemeResolvers,
84
+ action: ListActionItemThemeResolvers,
85
+ navigation: ListNavigationItemThemeResolvers,
86
+ }
@@ -3,16 +3,21 @@ import type {
3
3
  ViewStyle
4
4
  } from 'react-native'
5
5
 
6
- import type { Color } from '../color'
7
6
  import type {
7
+ SelectEmptyTextStyle,
8
+ SelectHeaderStyle,
9
+ SelectMenuState,
8
10
  SelectMenuStyle,
9
11
  SelectOptionState,
10
12
  SelectOverlayStyle,
11
- SelectSearchStyle,
12
13
  SelectState,
13
14
  SelectTriggerTextStyle
14
15
  } from './select'
15
- import type { StyleResolverFunction } from '../resolver'
16
+ import type {
17
+ SimpleStyleResolver,
18
+ StyleResolverFunction
19
+ } from '../resolver'
20
+ import type { IconStyle } from '../../../icons'
16
21
 
17
22
  export type MultiSelectState = SelectState & {
18
23
  hasSelections?: boolean,
@@ -28,20 +33,17 @@ export type MultiSelectOptionTextStyle = TextStyle
28
33
 
29
34
  export type MultiSelectCheckboxStyle = ViewStyle
30
35
 
31
- export type MultiSelectCheckboxIconStyle = {
32
- color: Color,
33
- visible: boolean,
34
- }
36
+ export type MultiSelectCheckboxIconStyle = IconStyle
35
37
 
36
- export type MultiSelectTheme = {
38
+ export type MultiSelectThemeResolvers = {
37
39
  trigger: StyleResolverFunction<MultiSelectState, MultiSelectTriggerStyle>,
38
40
  triggerText: StyleResolverFunction<MultiSelectState, SelectTriggerTextStyle>,
39
- overlay: StyleResolverFunction<MultiSelectState, SelectOverlayStyle>,
40
- menu: StyleResolverFunction<MultiSelectState, SelectMenuStyle>,
41
- search: StyleResolverFunction<MultiSelectState, SelectSearchStyle>,
42
- searchPlaceholderColor: StyleResolverFunction<MultiSelectState, Color>,
41
+ overlay: SimpleStyleResolver<SelectOverlayStyle>,
42
+ menu: StyleResolverFunction<SelectMenuState, SelectMenuStyle>,
43
+ header: SimpleStyleResolver<SelectHeaderStyle>,
43
44
  option: StyleResolverFunction<MultiSelectOptionState, MultiSelectOptionStyle>,
44
45
  optionText: StyleResolverFunction<MultiSelectOptionState, MultiSelectOptionTextStyle>,
46
+ emptyText: SimpleStyleResolver<SelectEmptyTextStyle>,
45
47
  checkbox: StyleResolverFunction<MultiSelectOptionState, MultiSelectCheckboxStyle>,
46
48
  checkboxIcon: StyleResolverFunction<MultiSelectOptionState, MultiSelectCheckboxIconStyle>,
47
49
  }
@@ -0,0 +1,28 @@
1
+ import type { TextStyle, ViewStyle } from 'react-native'
2
+
3
+ import type { ColorPairToken } from '@helpwave/hightide-design/theme-tokens'
4
+
5
+ import type {
6
+ InteractionState,
7
+ StyleResolverFunction
8
+ } from '../resolver'
9
+
10
+ export type SearchBarState = InteractionState & {
11
+ color?: ColorPairToken,
12
+ }
13
+
14
+ export type SearchBarContainerStyle = ViewStyle
15
+
16
+ export type SearchBarInputStyle = TextStyle
17
+
18
+ export type SearchBarPlaceholderStyle = TextStyle
19
+
20
+ export type SearchBarIconButtonStyle = ViewStyle
21
+
22
+ export type SearchBarThemeResolvers = {
23
+ container: StyleResolverFunction<SearchBarState, SearchBarContainerStyle>,
24
+ input: StyleResolverFunction<SearchBarState, SearchBarInputStyle>,
25
+ placeholder: StyleResolverFunction<SearchBarState, SearchBarPlaceholderStyle>,
26
+ iconButton: StyleResolverFunction<SearchBarState, SearchBarIconButtonStyle>,
27
+ iconButtonColor: StyleResolverFunction<SearchBarState, ColorPairToken>,
28
+ }
@@ -3,20 +3,23 @@ import type {
3
3
  ViewStyle
4
4
  } from 'react-native'
5
5
 
6
- import type { Color } from '../color'
6
+ import type { ColorPairToken } from '@helpwave/hightide-design/theme-tokens'
7
+
7
8
  import type {
8
9
  InteractionState,
10
+ SimpleStyleResolver,
9
11
  StyleResolverFunction
10
12
  } from '../resolver'
13
+ import type { IconStyle } from '../../../icons'
11
14
 
12
15
  export type SelectState = InteractionState & {
13
- isInvalid?: boolean,
14
- isReadOnly?: boolean,
16
+ color?: ColorPairToken,
15
17
  isOpen?: boolean,
16
18
  hasValue?: boolean,
17
19
  }
18
20
 
19
21
  export type SelectOptionState = InteractionState & {
22
+ color?: ColorPairToken,
20
23
  isSelected?: boolean,
21
24
  isHighlighted?: boolean,
22
25
  }
@@ -25,23 +28,32 @@ export type SelectTriggerStyle = ViewStyle
25
28
 
26
29
  export type SelectTriggerTextStyle = TextStyle
27
30
 
31
+ export type SelectIconStyle = IconStyle
32
+
33
+ export type SelectMenuState = {
34
+ hasSearch?: boolean,
35
+ }
36
+
28
37
  export type SelectOverlayStyle = ViewStyle
29
38
 
30
39
  export type SelectMenuStyle = ViewStyle
31
40
 
32
- export type SelectSearchStyle = TextStyle
41
+ export type SelectHeaderStyle = ViewStyle
33
42
 
34
43
  export type SelectOptionStyle = ViewStyle
35
44
 
36
45
  export type SelectOptionTextStyle = TextStyle
37
46
 
38
- export type SelectTheme = {
47
+ export type SelectEmptyTextStyle = TextStyle
48
+
49
+ export type SelectThemeResolvers = {
39
50
  trigger: StyleResolverFunction<SelectState, SelectTriggerStyle>,
40
51
  triggerText: StyleResolverFunction<SelectState, SelectTriggerTextStyle>,
41
- overlay: StyleResolverFunction<SelectState, SelectOverlayStyle>,
42
- menu: StyleResolverFunction<SelectState, SelectMenuStyle>,
43
- search: StyleResolverFunction<SelectState, SelectSearchStyle>,
44
- searchPlaceholderColor: StyleResolverFunction<SelectState, Color>,
52
+ icon: StyleResolverFunction<SelectState, SelectIconStyle>,
53
+ overlay: SimpleStyleResolver<SelectOverlayStyle>,
54
+ menu: StyleResolverFunction<SelectMenuState, SelectMenuStyle>,
55
+ header: SimpleStyleResolver<SelectHeaderStyle>,
45
56
  option: StyleResolverFunction<SelectOptionState, SelectOptionStyle>,
46
57
  optionText: StyleResolverFunction<SelectOptionState, SelectOptionTextStyle>,
58
+ emptyText: SimpleStyleResolver<SelectEmptyTextStyle>,
47
59
  }
@@ -1,4 +1,5 @@
1
- import type { Color } from '../color'
1
+ import type { ViewStyle } from 'react-native'
2
+
2
3
  import type {
3
4
  InteractionState,
4
5
  StyleResolverFunction
@@ -8,8 +9,14 @@ export type SwitchState = InteractionState & {
8
9
  isActive?: boolean,
9
10
  }
10
11
 
11
- export type SwitchTheme = {
12
- trackColor: StyleResolverFunction<SwitchState, Color>,
13
- borderColor: StyleResolverFunction<SwitchState, Color>,
14
- thumbColor: StyleResolverFunction<SwitchState, Color>,
12
+ export type SwitchContainerStyle = ViewStyle
13
+
14
+ export type SwitchTrackStyle = ViewStyle
15
+
16
+ export type SwitchThumbStyle = ViewStyle
17
+
18
+ export type SwitchThemeResolvers = {
19
+ container: StyleResolverFunction<SwitchState, SwitchContainerStyle>,
20
+ track: StyleResolverFunction<SwitchState, SwitchTrackStyle>,
21
+ thumb: StyleResolverFunction<SwitchState, SwitchThumbStyle>,
15
22
  }
@@ -0,0 +1,31 @@
1
+ import type { TextStyle, ViewStyle } from 'react-native'
2
+
3
+ import type {
4
+ ColoringColorVariant,
5
+ ColoringStyle,
6
+ ComponentSize
7
+ } from '@helpwave/hightide-design/semantic-token-resolvers'
8
+ import type { ColorPairToken } from '@helpwave/hightide-design/theme-tokens'
9
+
10
+ import type {
11
+ InteractionState,
12
+ StyleResolverFunction
13
+ } from '../resolver'
14
+
15
+ export type ThemedPressableState = InteractionState & {
16
+ size?: ComponentSize,
17
+ color?: ColorPairToken,
18
+ coloringStyle?: ColoringStyle,
19
+ coloringColorVariant?: ColoringColorVariant,
20
+ hasAdditionalHorizontalPadding?: boolean,
21
+ }
22
+
23
+ export type ThemedPressableStyle = ViewStyle
24
+
25
+ export type ThemedPressableTextStyle = TextStyle
26
+
27
+ export type ThemedPressableThemeResolvers = {
28
+ container: StyleResolverFunction<ThemedPressableState, ThemedPressableStyle>,
29
+ stateLayer: StyleResolverFunction<ThemedPressableState, ThemedPressableStyle>,
30
+ text: StyleResolverFunction<ThemedPressableState, ThemedPressableTextStyle>,
31
+ }
@@ -1,11 +1 @@
1
- export type BorderRadius = number | 'full'
2
-
3
- export type HightideDecoration = {
4
- borderRadius: {
5
- xs: BorderRadius,
6
- sm: BorderRadius,
7
- md: BorderRadius,
8
- lg: BorderRadius,
9
- xl: BorderRadius,
10
- } & Record<string, BorderRadius>,
11
- }
1
+ export {}
@@ -0,0 +1,8 @@
1
+ import type {
2
+ IconSize,
3
+ ThemeIcongraphyTokens
4
+ } from '@helpwave/hightide-design/theme-tokens'
5
+
6
+ export type HightideIcongraphy = ThemeIcongraphyTokens
7
+
8
+ export type IconSizes = IconSize
@@ -1,7 +1,9 @@
1
1
  export * from './color'
2
2
  export * from './components'
3
3
  export * from './decoration'
4
+ export * from './icongraphy'
4
5
  export * from './layout'
5
6
  export * from './resolver'
7
+ export * from './semantics'
6
8
  export * from './theme'
7
9
  export * from './typography'
@@ -1,58 +1,26 @@
1
- export type ElementSize = 'xs' | 'sm' | 'md' | 'lg'
1
+ import type {
2
+ ElementLayoutTokens
3
+ } from '@helpwave/hightide-design/semantic-token-resolvers'
4
+ import type {
5
+ ThemeBorderWidthTokens,
6
+ ThemeElevationTokens,
7
+ ThemeShapeTokens,
8
+ ThemeSpacingTokens
9
+ } from '@helpwave/hightide-design/theme-tokens'
2
10
 
3
- export type HightideLayout = {
4
- shared: {
5
- spacingBase: number,
6
- drawerIndent: number,
7
- scrollbarWidth: number,
8
- scrollbarPadding: number,
9
- coloringOutlineWidth: number,
10
- breakpoints: {
11
- tablet: number,
12
- desktop: number,
13
- },
14
- },
15
- element: Record<ElementSize, { height: number, borderRadius: number }>,
16
- elementPadding: Record<ElementSize, { vertical: number, horizontal: number }>,
17
- button: Record<ElementSize, {
18
- paddingY: number,
19
- paddingX: number,
20
- paddingYOutline: number,
21
- paddingXOutline: number,
22
- gap: number,
23
- minWidth: number,
24
- borderRadius: number,
25
- }>,
26
- iconButton: Record<ElementSize, {
27
- paddingYOutline: number,
28
- paddingXOutline: number,
29
- borderRadius: number,
30
- }>,
31
- icon: Record<ElementSize, { size: number, strokeWidth: number }>,
32
- input: Record<'md', {
33
- height: number,
34
- paddingX: number,
35
- paddingY: number,
36
- borderRadius: number,
37
- }>,
38
- chip: Record<ElementSize, {
39
- minHeight: number,
40
- paddingVertical: number,
41
- paddingHorizontal: number,
42
- gap: number,
43
- borderRadius: number,
44
- fontSize: number,
45
- }>,
46
- avatar: Record<ElementSize, {
47
- size: number,
48
- padding: number,
49
- fontSize: number,
50
- statusDotSize: number,
51
- statusDotBorderWidth: number,
52
- }>,
53
- avatarGroup: {
54
- overlap: number,
55
- maxShown: number,
56
- gap: number,
57
- },
58
- }
11
+ export type HightideSpacing = ThemeSpacingTokens
12
+
13
+ export type HightideElements = ElementLayoutTokens
14
+
15
+ export type HightideBorderRadius = ThemeShapeTokens['borderRadius']
16
+
17
+ export type HightideBorder = ThemeBorderWidthTokens
18
+
19
+ export type HightideShadowToken = ThemeElevationTokens[keyof ThemeElevationTokens]
20
+
21
+ export type HightideShadow = {
22
+ raised: HightideShadowToken,
23
+ container: HightideShadowToken,
24
+ popover: HightideShadowToken,
25
+ dialog: HightideShadowToken,
26
+ }
@@ -1,12 +1,45 @@
1
+ import type { ThemeTokens } from '@helpwave/hightide-design/theme-tokens'
2
+ import type { SemanticTokenResolvers } from '@helpwave/hightide-design/semantic-token-resolvers'
3
+ import type {
4
+ ComponentTokenResolvers,
5
+ PressableState,
6
+ PressableStateValue
7
+ } from '@helpwave/hightide-design/component-token-resolvers'
8
+
1
9
  export type InteractionState = {
2
10
  isDisabled?: boolean,
3
11
  isHovered?: boolean,
4
12
  isFocused?: boolean,
13
+ isFocusVisible?: boolean,
5
14
  isPressed?: boolean,
6
- isReadOnly?: boolean,
15
+ isReadonly?: boolean,
7
16
  isInvalid?: boolean,
8
17
  }
9
18
 
19
+ export const toPressableInteractionState = (
20
+ state: InteractionState = {}
21
+ ): PressableState => {
22
+ const active = new Set<PressableStateValue>()
23
+
24
+ if (state.isDisabled) {
25
+ active.add('disabled')
26
+ }
27
+ if (state.isFocused) {
28
+ active.add('focused')
29
+ }
30
+ if (state.isFocusVisible) {
31
+ active.add('focusVisible')
32
+ }
33
+ if (state.isHovered) {
34
+ active.add('hovered')
35
+ }
36
+ if (state.isPressed) {
37
+ active.add('pressed')
38
+ }
39
+
40
+ return active
41
+ }
42
+
10
43
  export type StyleOverwrite<TState, TStyle> =
11
44
  TStyle | ((prev: TStyle, state: TState) => TStyle)
12
45
 
@@ -15,6 +48,14 @@ export type StyleResolverFunction<TState, TStyle> = (
15
48
  overwrite?: StyleOverwrite<TState, TStyle>,
16
49
  ) => TStyle
17
50
 
51
+ export type SimpleStyleResolver<TStyle> = StyleResolverFunction<Record<string, never>, TStyle>
52
+
53
+ export type ComponentThemeResolver<TTheme> = (params: {
54
+ themeTokens: ThemeTokens,
55
+ semanticTokens: SemanticTokenResolvers,
56
+ componentTokens: ComponentTokenResolvers,
57
+ }) => TTheme
58
+
18
59
  export const createStyleResolver = <TState, TStyle>(
19
60
  resolve: (props: TState) => TStyle
20
61
  ): StyleResolverFunction<TState, TStyle> => {
@@ -33,6 +74,12 @@ export const createStyleResolver = <TState, TStyle>(
33
74
  }
34
75
  }
35
76
 
77
+ export const createSimpleStyleResolver = <TStyle>(
78
+ resolve: () => TStyle
79
+ ): SimpleStyleResolver<TStyle> => {
80
+ return createStyleResolver<Record<string, never>, TStyle>(resolve)
81
+ }
82
+
36
83
  export const createValueResolver = <TState, TValue>(
37
84
  resolve: (props: TState) => TValue
38
85
  ): StyleResolverFunction<TState, TValue> => {
@@ -50,3 +97,9 @@ export const createValueResolver = <TState, TValue>(
50
97
  return overwrite
51
98
  }
52
99
  }
100
+
101
+ export const createSimpleValueResolver = <TValue>(
102
+ resolve: () => TValue
103
+ ): SimpleStyleResolver<TValue> => {
104
+ return createValueResolver<Record<string, never>, TValue>(resolve)
105
+ }
@@ -0,0 +1,72 @@
1
+ import type { ColorToken, HexColorToken } from '@helpwave/hightide-design/primitive-tokens'
2
+ import type {
3
+ Appearance,
4
+ ColoringColorTokens,
5
+ ColoringColorVariant,
6
+ ColoringStyle,
7
+ ColoringToken,
8
+ ContainerLayoutToken,
9
+ ControlElementLayoutToken,
10
+ InputColoringTokens,
11
+ InsideControlElementLayoutToken,
12
+ PressableColoringTokens,
13
+ ButtonVariant
14
+ } from '@helpwave/hightide-design/semantic-token-resolvers'
15
+ import type { InputState } from '@helpwave/hightide-design/component-token-resolvers'
16
+ import type { PressableState } from '@helpwave/hightide-design/component-token-resolvers'
17
+ import type {
18
+ ColorPairToken,
19
+ ThemeLayoutSize,
20
+ ThemeTypographySize,
21
+ TintStrength
22
+ } from '@helpwave/hightide-design/theme-tokens'
23
+
24
+ export type BoundSemanticResolver<TParameter, TResult> = (parameter: TParameter) => TResult
25
+
26
+ export type HightideThemeSemantics = {
27
+ coloringColorVariant: BoundSemanticResolver<{
28
+ colorPair: ColorPairToken,
29
+ variant: ColoringColorVariant,
30
+ }, ColoringColorTokens>,
31
+ coloringStyle: BoundSemanticResolver<{
32
+ coloring: ColoringColorTokens,
33
+ style: ColoringStyle,
34
+ }, ColoringToken>,
35
+ pressableColoring: BoundSemanticResolver<{
36
+ coloring: ColoringToken,
37
+ variant: ButtonVariant,
38
+ state: PressableState,
39
+ }, PressableColoringTokens>,
40
+ pressableStateLayerTint: BoundSemanticResolver<{
41
+ states: PressableState,
42
+ color: ColorToken,
43
+ }, ColorToken>,
44
+ inputColoring: BoundSemanticResolver<{
45
+ state: InputState,
46
+ color?: ColorPairToken,
47
+ }, InputColoringTokens>,
48
+ controlLayout: BoundSemanticResolver<{
49
+ size: ThemeLayoutSize,
50
+ }, ControlElementLayoutToken>,
51
+ touchTargetSize: BoundSemanticResolver<object, number>,
52
+ containerLayout: BoundSemanticResolver<{
53
+ size: ThemeLayoutSize,
54
+ }, ContainerLayoutToken>,
55
+ insideControlLayout: BoundSemanticResolver<{
56
+ size: ThemeTypographySize,
57
+ }, InsideControlElementLayoutToken>,
58
+ tintedSurface: BoundSemanticResolver<{
59
+ tintColor: HexColorToken,
60
+ tintStrength?: TintStrength,
61
+ }, HexColorToken>,
62
+ withAppearance: BoundSemanticResolver<{
63
+ color: HexColorToken,
64
+ appearance: Appearance,
65
+ }, HexColorToken>,
66
+ asFaded: BoundSemanticResolver<{
67
+ color: HexColorToken,
68
+ }, HexColorToken>,
69
+ asDescription: BoundSemanticResolver<{
70
+ color: HexColorToken,
71
+ }, HexColorToken>,
72
+ }
@@ -1,26 +1,39 @@
1
- import type {
2
- HightideColors,
3
- HightideSemanticColors
4
- } from './color'
1
+ import type { ThemeColorTokens } from '@helpwave/hightide-design/theme-tokens'
2
+
5
3
  import type { HightideComponentThemes } from './components/hightide'
6
- import type { HightideDecoration } from './decoration'
7
- import type { HightideLayout } from './layout'
4
+ import type { HightideIcongraphy } from './icongraphy'
5
+ import type {
6
+ HightideBorder,
7
+ HightideBorderRadius,
8
+ HightideElements,
9
+ HightideShadow,
10
+ HightideSpacing
11
+ } from './layout'
12
+ import type { HightideThemeSemantics } from './semantics'
8
13
  import type { HightideTypography } from './typography'
9
14
 
10
15
  export type Theme = {
11
16
  colors: Record<string, unknown>,
12
- semantic: Record<string, unknown>,
17
+ semantics: Record<string, unknown>,
13
18
  components: Record<string, unknown>,
14
19
  typography: Record<string, unknown>,
15
- layout: Record<string, unknown>,
16
- decoration: Record<string, unknown>,
20
+ icongraphy: Record<string, unknown>,
21
+ spacing: Record<string, unknown>,
22
+ elements: Record<string, unknown>,
23
+ borderRadius: Record<string, unknown>,
24
+ border: Record<string, unknown>,
25
+ shadow: Record<string, unknown>,
17
26
  }
18
27
 
19
28
  export type HightideTheme = Theme & {
20
- colors: HightideColors & Theme['colors'],
21
- semantic: HightideSemanticColors & Theme['semantic'],
29
+ colors: ThemeColorTokens & Theme['colors'],
30
+ semantics: HightideThemeSemantics & Theme['semantics'],
22
31
  components: HightideComponentThemes & Theme['components'],
23
32
  typography: HightideTypography & Theme['typography'],
24
- layout: HightideLayout & Theme['layout'],
25
- decoration: HightideDecoration & Theme['decoration'],
33
+ icongraphy: HightideIcongraphy & Theme['icongraphy'],
34
+ spacing: HightideSpacing & Theme['spacing'],
35
+ elements: HightideElements & Theme['elements'],
36
+ borderRadius: HightideBorderRadius & Theme['borderRadius'],
37
+ border: HightideBorder & Theme['border'],
38
+ shadow: HightideShadow & Theme['shadow'],
26
39
  }
@@ -1,18 +1,17 @@
1
- export type TextStyle = {
2
- fontSize: number,
3
- lineHeight: number,
4
- fontWeight: string,
5
- fontFamily?: string,
6
- }
1
+ import type {
2
+ ThemeTypographyTokens,
3
+ ThemeTypographySize,
4
+ TypographyStyleToken
5
+ } from '@helpwave/hightide-design/theme-tokens'
7
6
 
8
- export type HightideTypography = {
9
- fontWeights: Record<string, string>,
10
- scales: {
11
- headline: { large: TextStyle, medium: TextStyle, small: TextStyle },
12
- title: { large: TextStyle, medium: TextStyle, small: TextStyle },
13
- body: { large: TextStyle, medium: TextStyle },
14
- label: { large: TextStyle, medium: TextStyle },
15
- caption: { large: TextStyle, medium: TextStyle, small: TextStyle },
16
- button: { large: TextStyle, medium: TextStyle, small: TextStyle },
17
- },
18
- }
7
+ export type TextStyle = TypographyStyleToken
8
+
9
+ export type HightideTypography = ThemeTypographyTokens
10
+
11
+ export type HightideFontFamilies = ThemeTypographyTokens['fontFamilies']
12
+
13
+ export type HightideFontWeights = ThemeTypographyTokens['fontWeights']
14
+
15
+ export type TypographySizes = ThemeTypographySize
16
+
17
+ export type { TypographyStyleToken }