@helpwave/hightide-native 0.0.1 → 0.0.2

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 (58) hide show
  1. package/README.md +56 -0
  2. package/package.json +3 -3
  3. package/src/components/chat/ChatAttachmentCard.tsx +97 -0
  4. package/src/components/chat/ChatConversationList.tsx +68 -0
  5. package/src/components/chat/ChatConversationRow.tsx +145 -0
  6. package/src/components/chat/ChatDateDivider.tsx +45 -0
  7. package/src/components/chat/ChatMessageBubble.tsx +102 -0
  8. package/src/components/chat/ChatMessageCard.tsx +107 -0
  9. package/src/components/chat/ChatMessageComposer.tsx +110 -0
  10. package/src/components/chat/ChatMessageList.tsx +59 -0
  11. package/src/components/chat/ChatQuickReplyChip.tsx +71 -0
  12. package/src/components/chat/ChatSystemLine.tsx +57 -0
  13. package/src/components/chat/ChatThreadHeader.tsx +80 -0
  14. package/src/components/chat/index.ts +11 -0
  15. package/src/components/index.ts +4 -7
  16. package/src/components/menu/Menu.tsx +51 -0
  17. package/src/components/menu/MenuActionItem.tsx +85 -0
  18. package/src/components/menu/MenuItem.tsx +63 -0
  19. package/src/components/menu/MenuNavigationItem.tsx +85 -0
  20. package/src/components/menu/index.ts +4 -0
  21. package/src/components/{Button → user-interaction}/Button.tsx +22 -29
  22. package/src/components/{Checkbox → user-interaction}/Checkbox.tsx +14 -11
  23. package/src/components/{IconButton → user-interaction}/IconButton.tsx +17 -25
  24. package/src/components/{Input → user-interaction}/Input.tsx +15 -11
  25. package/src/components/{MultiSelect → user-interaction}/MultiSelect.tsx +34 -9
  26. package/src/components/{Select → user-interaction}/Select.tsx +33 -8
  27. package/src/components/user-interaction/index.ts +6 -0
  28. package/src/components/{Chip → visualization-and-display}/Chip.tsx +17 -13
  29. package/src/theme/resolvers/button.ts +7 -5
  30. package/src/theme/resolvers/chat.ts +384 -0
  31. package/src/theme/resolvers/checkbox.ts +5 -4
  32. package/src/theme/resolvers/chip.ts +7 -5
  33. package/src/theme/resolvers/iconButton.ts +6 -4
  34. package/src/theme/resolvers/index.ts +2 -0
  35. package/src/theme/resolvers/input.ts +6 -4
  36. package/src/theme/resolvers/menu.ts +112 -0
  37. package/src/theme/resolvers/multiSelect.ts +20 -19
  38. package/src/theme/resolvers/select.ts +16 -15
  39. package/src/theme/themes/createTheme.ts +4 -0
  40. package/src/theme/types/button.ts +7 -30
  41. package/src/theme/types/chat.ts +141 -0
  42. package/src/theme/types/checkbox.ts +5 -14
  43. package/src/theme/types/chip.ts +7 -30
  44. package/src/theme/types/components.ts +4 -0
  45. package/src/theme/types/iconButton.ts +6 -20
  46. package/src/theme/types/index.ts +2 -0
  47. package/src/theme/types/input.ts +5 -15
  48. package/src/theme/types/menu.ts +50 -0
  49. package/src/theme/types/multiSelect.ts +17 -39
  50. package/src/theme/types/resolver.ts +43 -1
  51. package/src/theme/types/select.ts +18 -55
  52. package/src/components/Button/index.ts +0 -1
  53. package/src/components/Checkbox/index.ts +0 -1
  54. package/src/components/IconButton/index.ts +0 -1
  55. package/src/components/Input/index.ts +0 -1
  56. package/src/components/MultiSelect/index.ts +0 -1
  57. package/src/components/Select/index.ts +0 -1
  58. /package/src/components/{Chip → visualization-and-display}/index.ts +0 -0
@@ -1,12 +1,12 @@
1
- import type { ColorValue, FontWeight } from '@helpwave/hightide-design'
2
- import type { ResolverFunction } from './resolver'
1
+ import type { ColorValue } from '@helpwave/hightide-design'
2
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native'
3
+ import type { StyleResolverFunction } from './resolver'
3
4
  import type {
4
5
  SelectMenuStyle,
5
6
  SelectOptionState,
6
7
  SelectOverlayStyle,
7
8
  SelectSearchStyle,
8
9
  SelectState,
9
- SelectTriggerStyle,
10
10
  SelectTriggerTextStyle
11
11
  } from './select'
12
12
 
@@ -16,35 +16,13 @@ export type MultiSelectState = SelectState & {
16
16
 
17
17
  export type MultiSelectOptionState = SelectOptionState
18
18
 
19
- export type MultiSelectTriggerStyle = SelectTriggerStyle & {
20
- gap: number,
21
- }
19
+ export type MultiSelectTriggerStyle = StyleProp<ViewStyle>
22
20
 
23
- export type MultiSelectOptionStyle = {
24
- paddingHorizontal: number,
25
- paddingVertical: number,
26
- backgroundColor: ColorValue | 'transparent',
27
- opacity: number,
28
- flexDirection: 'row',
29
- alignItems: 'center',
30
- gap: number,
31
- }
21
+ export type MultiSelectOptionStyle = StyleProp<ViewStyle>
32
22
 
33
- export type MultiSelectOptionTextStyle = {
34
- color: ColorValue,
35
- fontWeight: FontWeight,
36
- }
23
+ export type MultiSelectOptionTextStyle = StyleProp<TextStyle>
37
24
 
38
- export type MultiSelectCheckboxStyle = {
39
- width: number,
40
- height: number,
41
- borderRadius: number,
42
- borderWidth: number,
43
- borderColor: ColorValue,
44
- backgroundColor: ColorValue | 'transparent',
45
- alignItems: 'center',
46
- justifyContent: 'center',
47
- }
25
+ export type MultiSelectCheckboxStyle = StyleProp<ViewStyle>
48
26
 
49
27
  export type MultiSelectCheckboxIconStyle = {
50
28
  color: ColorValue,
@@ -52,14 +30,14 @@ export type MultiSelectCheckboxIconStyle = {
52
30
  }
53
31
 
54
32
  export type MultiSelectTheme = {
55
- trigger: ResolverFunction<MultiSelectState, MultiSelectTriggerStyle>,
56
- triggerText: ResolverFunction<MultiSelectState, SelectTriggerTextStyle>,
57
- overlay: ResolverFunction<MultiSelectState, SelectOverlayStyle>,
58
- menu: ResolverFunction<MultiSelectState, SelectMenuStyle>,
59
- search: ResolverFunction<MultiSelectState, SelectSearchStyle>,
60
- searchPlaceholderColor: ResolverFunction<MultiSelectState, ColorValue>,
61
- option: ResolverFunction<MultiSelectOptionState, MultiSelectOptionStyle>,
62
- optionText: ResolverFunction<MultiSelectOptionState, MultiSelectOptionTextStyle>,
63
- checkbox: ResolverFunction<MultiSelectOptionState, MultiSelectCheckboxStyle>,
64
- checkboxIcon: ResolverFunction<MultiSelectOptionState, MultiSelectCheckboxIconStyle>,
33
+ trigger: StyleResolverFunction<MultiSelectState, MultiSelectTriggerStyle>,
34
+ triggerText: StyleResolverFunction<MultiSelectState, SelectTriggerTextStyle>,
35
+ overlay: StyleResolverFunction<MultiSelectState, SelectOverlayStyle>,
36
+ menu: StyleResolverFunction<MultiSelectState, SelectMenuStyle>,
37
+ search: StyleResolverFunction<MultiSelectState, SelectSearchStyle>,
38
+ searchPlaceholderColor: StyleResolverFunction<MultiSelectState, ColorValue>,
39
+ option: StyleResolverFunction<MultiSelectOptionState, MultiSelectOptionStyle>,
40
+ optionText: StyleResolverFunction<MultiSelectOptionState, MultiSelectOptionTextStyle>,
41
+ checkbox: StyleResolverFunction<MultiSelectOptionState, MultiSelectCheckboxStyle>,
42
+ checkboxIcon: StyleResolverFunction<MultiSelectOptionState, MultiSelectCheckboxIconStyle>,
65
43
  }
@@ -7,4 +7,46 @@ export type InteractionState = {
7
7
  isInvalid?: boolean,
8
8
  }
9
9
 
10
- export type ResolverFunction<TState, TStyle> = (props: TState) => TStyle
10
+ export type StyleOverwrite<TState, TStyle> =
11
+ TStyle | ((prev: TStyle, state: TState) => TStyle)
12
+
13
+ export type StyleResolverFunction<TState, TStyle> = (
14
+ props: TState,
15
+ overwrite?: StyleOverwrite<TState, TStyle>,
16
+ ) => TStyle
17
+
18
+ export const createStyleResolver = <TState, TStyle>(
19
+ resolve: (props: TState) => TStyle
20
+ ): StyleResolverFunction<TState, TStyle> => {
21
+ return (props, overwrite) => {
22
+ const base = resolve(props)
23
+
24
+ if (overwrite === undefined) {
25
+ return base
26
+ }
27
+
28
+ if (typeof overwrite === 'function') {
29
+ return (overwrite as (prev: TStyle, state: TState) => TStyle)(base, props)
30
+ }
31
+
32
+ return [base, overwrite] as TStyle
33
+ }
34
+ }
35
+
36
+ export const createValueResolver = <TState, TValue>(
37
+ resolve: (props: TState) => TValue
38
+ ): StyleResolverFunction<TState, TValue> => {
39
+ return (props, overwrite) => {
40
+ const base = resolve(props)
41
+
42
+ if (overwrite === undefined) {
43
+ return base
44
+ }
45
+
46
+ if (typeof overwrite === 'function') {
47
+ return (overwrite as (prev: TValue, state: TState) => TValue)(base, props)
48
+ }
49
+
50
+ return overwrite
51
+ }
52
+ }
@@ -1,5 +1,6 @@
1
- import type { ColorValue, FontWeight } from '@helpwave/hightide-design'
2
- import type { InteractionState, ResolverFunction } from './resolver'
1
+ import type { ColorValue } from '@helpwave/hightide-design'
2
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native'
3
+ import type { InteractionState, StyleResolverFunction } from './resolver'
3
4
 
4
5
  export type SelectState = InteractionState & {
5
6
  isInvalid?: boolean,
@@ -13,65 +14,27 @@ export type SelectOptionState = InteractionState & {
13
14
  isHighlighted?: boolean,
14
15
  }
15
16
 
16
- export type SelectTriggerStyle = {
17
- minHeight: number,
18
- paddingHorizontal: number,
19
- paddingVertical: number,
20
- borderRadius: number,
21
- borderWidth: number,
22
- borderColor: ColorValue,
23
- backgroundColor: ColorValue,
24
- justifyContent: 'center',
25
- opacity: number,
26
- }
17
+ export type SelectTriggerStyle = StyleProp<ViewStyle>
27
18
 
28
- export type SelectTriggerTextStyle = {
29
- color: ColorValue,
30
- }
19
+ export type SelectTriggerTextStyle = StyleProp<TextStyle>
31
20
 
32
- export type SelectOverlayStyle = {
33
- flex: 1,
34
- backgroundColor: ColorValue,
35
- justifyContent: 'center',
36
- padding: number,
37
- }
21
+ export type SelectOverlayStyle = StyleProp<ViewStyle>
38
22
 
39
- export type SelectMenuStyle = {
40
- maxHeight: number,
41
- borderRadius: number,
42
- backgroundColor: ColorValue,
43
- borderWidth: number,
44
- borderColor: ColorValue,
45
- overflow: 'hidden',
46
- }
23
+ export type SelectMenuStyle = StyleProp<ViewStyle>
47
24
 
48
- export type SelectSearchStyle = {
49
- paddingHorizontal: number,
50
- paddingVertical: number,
51
- borderBottomWidth: number,
52
- borderBottomColor: ColorValue,
53
- color: ColorValue,
54
- }
25
+ export type SelectSearchStyle = StyleProp<TextStyle>
55
26
 
56
- export type SelectOptionStyle = {
57
- paddingHorizontal: number,
58
- paddingVertical: number,
59
- backgroundColor: ColorValue | 'transparent',
60
- opacity: number,
61
- }
27
+ export type SelectOptionStyle = StyleProp<ViewStyle>
62
28
 
63
- export type SelectOptionTextStyle = {
64
- color: ColorValue,
65
- fontWeight: FontWeight,
66
- }
29
+ export type SelectOptionTextStyle = StyleProp<TextStyle>
67
30
 
68
31
  export type SelectTheme = {
69
- trigger: ResolverFunction<SelectState, SelectTriggerStyle>,
70
- triggerText: ResolverFunction<SelectState, SelectTriggerTextStyle>,
71
- overlay: ResolverFunction<SelectState, SelectOverlayStyle>,
72
- menu: ResolverFunction<SelectState, SelectMenuStyle>,
73
- search: ResolverFunction<SelectState, SelectSearchStyle>,
74
- searchPlaceholderColor: ResolverFunction<SelectState, ColorValue>,
75
- option: ResolverFunction<SelectOptionState, SelectOptionStyle>,
76
- optionText: ResolverFunction<SelectOptionState, SelectOptionTextStyle>,
32
+ trigger: StyleResolverFunction<SelectState, SelectTriggerStyle>,
33
+ triggerText: StyleResolverFunction<SelectState, SelectTriggerTextStyle>,
34
+ overlay: StyleResolverFunction<SelectState, SelectOverlayStyle>,
35
+ menu: StyleResolverFunction<SelectState, SelectMenuStyle>,
36
+ search: StyleResolverFunction<SelectState, SelectSearchStyle>,
37
+ searchPlaceholderColor: StyleResolverFunction<SelectState, ColorValue>,
38
+ option: StyleResolverFunction<SelectOptionState, SelectOptionStyle>,
39
+ optionText: StyleResolverFunction<SelectOptionState, SelectOptionTextStyle>,
77
40
  }
@@ -1 +0,0 @@
1
- export * from './Button'
@@ -1 +0,0 @@
1
- export * from './Checkbox'
@@ -1 +0,0 @@
1
- export * from './IconButton'
@@ -1 +0,0 @@
1
- export * from './Input'
@@ -1 +0,0 @@
1
- export * from './MultiSelect'
@@ -1 +0,0 @@
1
- export * from './Select'