@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.
Files changed (71) hide show
  1. package/package.json +4 -3
  2. package/src/components/chat/ChatAttachmentCard.tsx +26 -13
  3. package/src/components/chat/ChatConversationList.tsx +12 -8
  4. package/src/components/chat/ChatConversationRow.tsx +21 -13
  5. package/src/components/chat/ChatDateDivider.tsx +18 -8
  6. package/src/components/chat/ChatMessageBubble.tsx +23 -13
  7. package/src/components/chat/ChatMessageCard.tsx +25 -14
  8. package/src/components/chat/ChatMessageComposer.tsx +14 -9
  9. package/src/components/chat/ChatMessageList.tsx +12 -5
  10. package/src/components/chat/ChatQuickReplyChip.tsx +7 -6
  11. package/src/components/chat/ChatSystemLine.tsx +21 -10
  12. package/src/components/chat/ChatThreadHeader.tsx +19 -9
  13. package/src/components/menu/Menu.tsx +16 -6
  14. package/src/components/menu/MenuActionItem.tsx +10 -5
  15. package/src/components/menu/MenuItem.tsx +16 -6
  16. package/src/components/menu/MenuNavigationItem.tsx +11 -6
  17. package/src/components/user-interaction/Button.tsx +18 -11
  18. package/src/components/user-interaction/Checkbox.tsx +26 -7
  19. package/src/components/user-interaction/IconButton.tsx +23 -9
  20. package/src/components/user-interaction/Input.tsx +22 -5
  21. package/src/components/user-interaction/MultiSelect.tsx +14 -7
  22. package/src/components/user-interaction/Select.tsx +11 -4
  23. package/src/components/visualization-and-display/Chip.tsx +21 -9
  24. package/src/components/visualization-and-display/Icon.tsx +27 -0
  25. package/src/components/visualization-and-display/index.ts +1 -0
  26. package/src/global-contexts/HightideContext.ts +4 -1
  27. package/src/global-contexts/HightideProvider.tsx +21 -9
  28. package/src/global-contexts/hightide-config/HightideConfigUtils.ts +15 -12
  29. package/src/global-contexts/localization/LocalizationProvider.tsx +3 -1
  30. package/src/global-contexts/localization/forward-exports.ts +1 -0
  31. package/src/global-contexts/theme/ThemeContext.ts +11 -6
  32. package/src/global-contexts/theme/ThemeProvider.tsx +34 -37
  33. package/src/hooks/useMultiSelect.ts +1 -0
  34. package/src/hooks/useNativeKeyValueStore.ts +7 -1
  35. package/src/hooks/useSelect.ts +1 -0
  36. package/src/theme/resolvers/button.ts +33 -20
  37. package/src/theme/resolvers/chat.ts +370 -336
  38. package/src/theme/resolvers/checkbox.ts +22 -18
  39. package/src/theme/resolvers/chip.ts +27 -19
  40. package/src/theme/resolvers/coloring.ts +21 -17
  41. package/src/theme/resolvers/iconButton.ts +25 -17
  42. package/src/theme/resolvers/input.ts +25 -18
  43. package/src/theme/resolvers/menu.ts +37 -29
  44. package/src/theme/resolvers/multiSelect.ts +20 -16
  45. package/src/theme/resolvers/select.ts +20 -16
  46. package/src/theme/themes/createTheme.ts +42 -17
  47. package/src/theme/themes/nativeThemes.ts +7 -6
  48. package/src/theme/types/color.ts +60 -0
  49. package/src/theme/types/components/button.ts +30 -0
  50. package/src/theme/types/components/chat.ts +198 -0
  51. package/src/theme/types/{checkbox.ts → components/checkbox.ts} +11 -5
  52. package/src/theme/types/components/chip.ts +30 -0
  53. package/src/theme/types/{components.ts → components/hightide.ts} +22 -1
  54. package/src/theme/types/components/iconButton.ts +30 -0
  55. package/src/theme/types/components/index.ts +10 -0
  56. package/src/theme/types/components/input.ts +19 -0
  57. package/src/theme/types/{menu.ts → components/menu.ts} +21 -14
  58. package/src/theme/types/{multiSelect.ts → components/multiSelect.ts} +13 -9
  59. package/src/theme/types/{select.ts → components/select.ts} +18 -11
  60. package/src/theme/types/decoration.ts +11 -0
  61. package/src/theme/types/index.ts +4 -9
  62. package/src/theme/types/layout.ts +46 -0
  63. package/src/theme/types/theme.ts +14 -10
  64. package/src/theme/types/typography.ts +18 -0
  65. package/src/icons/Icon.tsx +0 -35
  66. package/src/icons/index.ts +0 -1
  67. package/src/theme/types/button.ts +0 -18
  68. package/src/theme/types/chat.ts +0 -141
  69. package/src/theme/types/chip.ts +0 -18
  70. package/src/theme/types/iconButton.ts +0 -20
  71. package/src/theme/types/input.ts +0 -15
@@ -0,0 +1,46 @@
1
+ export type ElementSize = 'xs' | 'sm' | 'md' | 'lg'
2
+
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
+ }
@@ -1,13 +1,17 @@
1
1
  import type {
2
- ColoringTokensDefinitions,
3
- DesignColorPalettes,
4
- SemanticColors
5
- } from '@helpwave/hightide-design'
6
- import type { ComponentThemes } from './components'
2
+ HightideColors,
3
+ HightideSemanticColors
4
+ } from './color'
5
+ import type { HightideComponentThemes } from './components/hightide'
6
+ import type { HightideDecoration } from './decoration'
7
+ import type { HightideLayout } from './layout'
8
+ import type { HightideTypography } from './typography'
7
9
 
8
- export type DesignTheme = {
9
- palettes: DesignColorPalettes,
10
- semantic: SemanticColors,
11
- coloring: ColoringTokensDefinitions,
12
- components: ComponentThemes,
10
+ export type Theme = {
11
+ colors: Record<string, unknown> & HightideColors,
12
+ semantic: Record<string, unknown> & HightideSemanticColors,
13
+ components: Record<string, unknown> & HightideComponentThemes,
14
+ typography: Record<string, unknown> & HightideTypography,
15
+ layout: Record<string, unknown> & HightideLayout,
16
+ decoration: Record<string, unknown> & HightideDecoration,
13
17
  }
@@ -0,0 +1,18 @@
1
+ export type TextStyle = {
2
+ fontSize: number,
3
+ lineHeight: number,
4
+ fontWeight: string,
5
+ fontFamily?: string,
6
+ }
7
+
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
+ }
@@ -1,35 +0,0 @@
1
- import { getIconSizePx, getIconStrokeWidth, type ElementSize } from '@helpwave/hightide-design'
2
- import type { LucideIcon } from 'lucide-react-native'
3
-
4
- export type IconProps = {
5
- icon: LucideIcon,
6
- size?: ElementSize,
7
- color?: string,
8
- }
9
-
10
- export const Icon = ({
11
- icon: IconComponent,
12
- size = 'md',
13
- color,
14
- }: IconProps) => {
15
- return (
16
- <IconComponent
17
- size={getIconSizePx(size)}
18
- strokeWidth={getIconStrokeWidth(size)}
19
- color={color}
20
- />
21
- )
22
- }
23
-
24
- export const resolveIconProps = (
25
- size: ElementSize = 'md',
26
- color?: string
27
- ): {
28
- size: number,
29
- strokeWidth: number,
30
- color?: string,
31
- } => ({
32
- size: getIconSizePx(size),
33
- strokeWidth: getIconStrokeWidth(size),
34
- color,
35
- })
@@ -1 +0,0 @@
1
- export * from './Icon'
@@ -1,18 +0,0 @@
1
- import type { ButtonColoringStyle, ColoringType, ElementSize } from '@helpwave/hightide-design'
2
- import type { StyleProp, TextStyle, ViewStyle } from 'react-native'
3
- import type { InteractionState, StyleResolverFunction } from './resolver'
4
-
5
- export type ButtonState = InteractionState & {
6
- size?: ElementSize,
7
- color?: ColoringType,
8
- coloringStyle?: ButtonColoringStyle,
9
- }
10
-
11
- export type ButtonStyle = StyleProp<ViewStyle>
12
-
13
- export type ButtonTextStyle = StyleProp<TextStyle>
14
-
15
- export type ButtonTheme = {
16
- button: StyleResolverFunction<ButtonState, ButtonStyle>,
17
- text: StyleResolverFunction<ButtonState, ButtonTextStyle>,
18
- }
@@ -1,141 +0,0 @@
1
- import type { ColorValue, ColoringType } from '@helpwave/hightide-design'
2
- import type { StyleProp, TextStyle, ViewStyle } from 'react-native'
3
- import type { InteractionState, StyleResolverFunction } from './resolver'
4
-
5
- export type ChatMessageDirection = 'incoming' | 'outgoing'
6
-
7
- export type ChatConversationRowState = InteractionState & {
8
- isUnread?: boolean,
9
- isSelected?: boolean,
10
- }
11
-
12
- export type ChatConversationRowStyle = StyleProp<ViewStyle>
13
- export type ChatConversationRowTitleStyle = StyleProp<TextStyle>
14
- export type ChatConversationRowTimestampStyle = StyleProp<TextStyle>
15
- export type ChatConversationRowPreviewStyle = StyleProp<TextStyle>
16
- export type ChatConversationRowUnreadBadgeStyle = StyleProp<ViewStyle>
17
- export type ChatConversationRowUnreadBadgeTextStyle = StyleProp<TextStyle>
18
- export type ChatConversationListStyle = StyleProp<ViewStyle>
19
- export type ChatConversationListHeaderStyle = StyleProp<ViewStyle>
20
- export type ChatConversationListFooterStyle = StyleProp<ViewStyle>
21
- export type ChatThreadHeaderStyle = StyleProp<ViewStyle>
22
- export type ChatThreadHeaderTitleStyle = StyleProp<TextStyle>
23
- export type ChatThreadHeaderSubtitleStyle = StyleProp<TextStyle>
24
- export type ChatMessageListStyle = StyleProp<ViewStyle>
25
-
26
- export type ChatMessageBubbleState = {
27
- direction: ChatMessageDirection,
28
- }
29
-
30
- export type ChatMessageBubbleContainerStyle = StyleProp<ViewStyle>
31
- export type ChatMessageBubbleStyle = StyleProp<ViewStyle>
32
- export type ChatMessageBubbleContentStyle = StyleProp<TextStyle>
33
- export type ChatMessageBubbleTimestampStyle = StyleProp<TextStyle>
34
- export type ChatMessageBubbleReceiptStyle = StyleProp<ViewStyle>
35
- export type ChatMessageBubbleReceiptTextStyle = StyleProp<TextStyle>
36
-
37
- export type ChatMessageBubbleReceiptIconStyle = {
38
- color: ColorValue,
39
- }
40
-
41
- export type ChatMessageCardState = {
42
- direction: ChatMessageDirection,
43
- color?: ColoringType,
44
- }
45
-
46
- export type ChatMessageCardStyle = StyleProp<ViewStyle>
47
- export type ChatMessageCardHeaderStyle = StyleProp<ViewStyle>
48
- export type ChatMessageCardIconStyle = StyleProp<ViewStyle>
49
-
50
- export type ChatMessageCardIconColor = {
51
- color: ColorValue,
52
- }
53
-
54
- export type ChatMessageCardTitleStyle = StyleProp<TextStyle>
55
- export type ChatMessageCardSubtitleStyle = StyleProp<TextStyle>
56
- export type ChatMessageCardBodyStyle = StyleProp<ViewStyle>
57
- export type ChatMessageCardActionsStyle = StyleProp<ViewStyle>
58
-
59
- export type ChatAttachmentCardState = {
60
- direction: ChatMessageDirection,
61
- }
62
-
63
- export type ChatAttachmentCardStyle = StyleProp<ViewStyle>
64
- export type ChatAttachmentCardIconStyle = StyleProp<ViewStyle>
65
-
66
- export type ChatAttachmentCardIconColor = {
67
- color: ColorValue,
68
- }
69
-
70
- export type ChatAttachmentCardNameStyle = StyleProp<TextStyle>
71
- export type ChatAttachmentCardMetadataStyle = StyleProp<TextStyle>
72
-
73
- export type ChatSystemLineState = {
74
- color?: ColoringType,
75
- }
76
-
77
- export type ChatSystemLineStyle = StyleProp<ViewStyle>
78
- export type ChatSystemLineTextStyle = StyleProp<TextStyle>
79
-
80
- export type ChatSystemLineIconStyle = {
81
- color: ColorValue,
82
- }
83
-
84
- export type ChatDateDividerStyle = StyleProp<ViewStyle>
85
- export type ChatDateDividerTextStyle = StyleProp<TextStyle>
86
-
87
- export type ChatQuickReplyChipState = InteractionState & {
88
- isActive?: boolean,
89
- }
90
-
91
- export type ChatQuickReplyChipStyle = StyleProp<ViewStyle>
92
- export type ChatQuickReplyChipTextStyle = StyleProp<TextStyle>
93
- export type ChatMessageComposerStyle = StyleProp<ViewStyle>
94
- export type ChatMessageComposerInputStyle = StyleProp<TextStyle>
95
-
96
- export type ChatTheme = {
97
- conversationRow: StyleResolverFunction<ChatConversationRowState, ChatConversationRowStyle>,
98
- conversationRowTitle: StyleResolverFunction<ChatConversationRowState, ChatConversationRowTitleStyle>,
99
- conversationRowTimestamp: StyleResolverFunction<ChatConversationRowState, ChatConversationRowTimestampStyle>,
100
- conversationRowPreview: StyleResolverFunction<ChatConversationRowState, ChatConversationRowPreviewStyle>,
101
- conversationRowUnreadBadge: StyleResolverFunction<Record<string, never>, ChatConversationRowUnreadBadgeStyle>,
102
- conversationRowUnreadBadgeText: StyleResolverFunction<Record<string, never>, ChatConversationRowUnreadBadgeTextStyle>,
103
- conversationRowSentIndicator: StyleResolverFunction<Record<string, never>, ChatMessageBubbleReceiptIconStyle>,
104
- conversationList: StyleResolverFunction<Record<string, never>, ChatConversationListStyle>,
105
- conversationListHeader: StyleResolverFunction<Record<string, never>, ChatConversationListHeaderStyle>,
106
- conversationListFooter: StyleResolverFunction<Record<string, never>, ChatConversationListFooterStyle>,
107
- threadHeader: StyleResolverFunction<Record<string, never>, ChatThreadHeaderStyle>,
108
- threadHeaderTitle: StyleResolverFunction<Record<string, never>, ChatThreadHeaderTitleStyle>,
109
- threadHeaderSubtitle: StyleResolverFunction<Record<string, never>, ChatThreadHeaderSubtitleStyle>,
110
- messageList: StyleResolverFunction<Record<string, never>, ChatMessageListStyle>,
111
- messageBubbleContainer: StyleResolverFunction<ChatMessageBubbleState, ChatMessageBubbleContainerStyle>,
112
- messageBubble: StyleResolverFunction<ChatMessageBubbleState, ChatMessageBubbleStyle>,
113
- messageBubbleContent: StyleResolverFunction<ChatMessageBubbleState, ChatMessageBubbleContentStyle>,
114
- messageBubbleTimestamp: StyleResolverFunction<ChatMessageBubbleState, ChatMessageBubbleTimestampStyle>,
115
- messageBubbleReceipt: StyleResolverFunction<Record<string, never>, ChatMessageBubbleReceiptStyle>,
116
- messageBubbleReceiptText: StyleResolverFunction<Record<string, never>, ChatMessageBubbleReceiptTextStyle>,
117
- messageBubbleReceiptIcon: StyleResolverFunction<Record<string, never>, ChatMessageBubbleReceiptIconStyle>,
118
- messageCard: StyleResolverFunction<ChatMessageCardState, ChatMessageCardStyle>,
119
- messageCardHeader: StyleResolverFunction<Record<string, never>, ChatMessageCardHeaderStyle>,
120
- messageCardIcon: StyleResolverFunction<ChatMessageCardState, ChatMessageCardIconStyle>,
121
- messageCardIconColor: StyleResolverFunction<ChatMessageCardState, ChatMessageCardIconColor>,
122
- messageCardTitle: StyleResolverFunction<ChatMessageCardState, ChatMessageCardTitleStyle>,
123
- messageCardSubtitle: StyleResolverFunction<Record<string, never>, ChatMessageCardSubtitleStyle>,
124
- messageCardBody: StyleResolverFunction<Record<string, never>, ChatMessageCardBodyStyle>,
125
- messageCardActions: StyleResolverFunction<Record<string, never>, ChatMessageCardActionsStyle>,
126
- attachmentCard: StyleResolverFunction<ChatAttachmentCardState, ChatAttachmentCardStyle>,
127
- attachmentCardIcon: StyleResolverFunction<Record<string, never>, ChatAttachmentCardIconStyle>,
128
- attachmentCardIconColor: StyleResolverFunction<Record<string, never>, ChatAttachmentCardIconColor>,
129
- attachmentCardName: StyleResolverFunction<Record<string, never>, ChatAttachmentCardNameStyle>,
130
- attachmentCardMetadata: StyleResolverFunction<Record<string, never>, ChatAttachmentCardMetadataStyle>,
131
- systemLine: StyleResolverFunction<ChatSystemLineState, ChatSystemLineStyle>,
132
- systemLineText: StyleResolverFunction<ChatSystemLineState, ChatSystemLineTextStyle>,
133
- systemLineIcon: StyleResolverFunction<ChatSystemLineState, ChatSystemLineIconStyle>,
134
- dateDivider: StyleResolverFunction<Record<string, never>, ChatDateDividerStyle>,
135
- dateDividerText: StyleResolverFunction<Record<string, never>, ChatDateDividerTextStyle>,
136
- quickReplyChip: StyleResolverFunction<ChatQuickReplyChipState, ChatQuickReplyChipStyle>,
137
- quickReplyChipText: StyleResolverFunction<ChatQuickReplyChipState, ChatQuickReplyChipTextStyle>,
138
- messageComposer: StyleResolverFunction<Record<string, never>, ChatMessageComposerStyle>,
139
- messageComposerInput: StyleResolverFunction<Record<string, never>, ChatMessageComposerInputStyle>,
140
- messageComposerPlaceholderColor: StyleResolverFunction<Record<string, never>, ColorValue>,
141
- }
@@ -1,18 +0,0 @@
1
- import type { ChipColoringStyle, ColoringType, ElementSize } from '@helpwave/hightide-design'
2
- import type { StyleProp, TextStyle, ViewStyle } from 'react-native'
3
- import type { InteractionState, StyleResolverFunction } from './resolver'
4
-
5
- export type ChipState = InteractionState & {
6
- size?: ElementSize,
7
- color?: ColoringType,
8
- coloringStyle?: ChipColoringStyle,
9
- }
10
-
11
- export type ChipStyle = StyleProp<ViewStyle>
12
-
13
- export type ChipTextStyle = StyleProp<TextStyle>
14
-
15
- export type ChipTheme = {
16
- chip: StyleResolverFunction<ChipState, ChipStyle>,
17
- text: StyleResolverFunction<ChipState, ChipTextStyle>,
18
- }
@@ -1,20 +0,0 @@
1
- import type { ButtonColoringStyle, ColorValue, ColoringType, ElementSize } from '@helpwave/hightide-design'
2
- import type { StyleProp, ViewStyle } from 'react-native'
3
- import type { InteractionState, StyleResolverFunction } from './resolver'
4
-
5
- export type IconButtonState = InteractionState & {
6
- size?: ElementSize,
7
- color?: ColoringType,
8
- coloringStyle?: ButtonColoringStyle,
9
- }
10
-
11
- export type IconButtonStyle = StyleProp<ViewStyle>
12
-
13
- export type IconButtonIconStyle = {
14
- color: ColorValue,
15
- }
16
-
17
- export type IconButtonTheme = {
18
- button: StyleResolverFunction<IconButtonState, IconButtonStyle>,
19
- icon: StyleResolverFunction<IconButtonState, IconButtonIconStyle>,
20
- }
@@ -1,15 +0,0 @@
1
- import type { ColorValue } from '@helpwave/hightide-design'
2
- import type { StyleProp, TextStyle } from 'react-native'
3
- import type { InteractionState, StyleResolverFunction } from './resolver'
4
-
5
- export type InputState = InteractionState & {
6
- isInvalid?: boolean,
7
- isReadOnly?: boolean,
8
- }
9
-
10
- export type InputStyle = StyleProp<TextStyle>
11
-
12
- export type InputTheme = {
13
- input: StyleResolverFunction<InputState, InputStyle>,
14
- placeholderColor: StyleResolverFunction<InputState, ColorValue>,
15
- }