@hzblj/kara-components 0.26.1 → 0.27.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 (68) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/lib/module/atoms/activity-indicator/activity-indicator.android.js +3 -4
  3. package/lib/module/atoms/activity-indicator/activity-indicator.android.js.map +1 -1
  4. package/lib/module/atoms/date-picker/date-picker.android.js +3 -4
  5. package/lib/module/atoms/date-picker/date-picker.android.js.map +1 -1
  6. package/lib/module/atoms/island/island.android.js +2 -6
  7. package/lib/module/atoms/island/island.android.js.map +1 -1
  8. package/lib/module/atoms/picker/picker.android.js +3 -4
  9. package/lib/module/atoms/picker/picker.android.js.map +1 -1
  10. package/lib/module/atoms/pressable/pressable.js +5 -4
  11. package/lib/module/atoms/pressable/pressable.js.map +1 -1
  12. package/lib/module/atoms/segmented-control/segmented-control.android.js +3 -4
  13. package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -1
  14. package/lib/module/hooks/compose-host.js +27 -0
  15. package/lib/module/hooks/compose-host.js.map +1 -0
  16. package/lib/module/molecules/navigation-bar/bar-search-field.js +80 -0
  17. package/lib/module/molecules/navigation-bar/bar-search-field.js.map +1 -0
  18. package/lib/module/molecules/navigation-bar/navigation-bar.android.js +97 -22
  19. package/lib/module/molecules/navigation-bar/navigation-bar.android.js.map +1 -1
  20. package/lib/module/molecules/rn-list-item/rn-list-item.js +3 -2
  21. package/lib/module/molecules/rn-list-item/rn-list-item.js.map +1 -1
  22. package/lib/module/molecules/rn-tooltip/rn-tooltip.android.js +3 -4
  23. package/lib/module/molecules/rn-tooltip/rn-tooltip.android.js.map +1 -1
  24. package/lib/module/organisms/context-menu/context-menu.android.js +4 -5
  25. package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
  26. package/lib/module/organisms/header/header-options.android.js +2 -6
  27. package/lib/module/organisms/header/header-options.android.js.map +1 -1
  28. package/lib/module/organisms/header/header-search-accessory.android.js +29 -2
  29. package/lib/module/organisms/header/header-search-accessory.android.js.map +1 -1
  30. package/lib/module/organisms/header/header-search-input.android.js +11 -51
  31. package/lib/module/organisms/header/header-search-input.android.js.map +1 -1
  32. package/lib/module/organisms/header/use-header-search.js +19 -11
  33. package/lib/module/organisms/header/use-header-search.js.map +1 -1
  34. package/lib/module/organisms/sheet/sheet.js +17 -1
  35. package/lib/module/organisms/sheet/sheet.js.map +1 -1
  36. package/lib/module/organisms/sheet/use-sheet-header.js +7 -1
  37. package/lib/module/organisms/sheet/use-sheet-header.js.map +1 -1
  38. package/lib/module/templates/screen/screen.android.js +3 -6
  39. package/lib/module/templates/screen/screen.android.js.map +1 -1
  40. package/lib/typescript/hooks/compose-host.d.ts +8 -0
  41. package/lib/typescript/molecules/navigation-bar/bar-search-field.d.ts +29 -0
  42. package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -6
  43. package/lib/typescript/organisms/header/header.types.d.ts +20 -10
  44. package/lib/typescript/organisms/header/use-header-search.d.ts +5 -3
  45. package/lib/typescript/organisms/sheet/sheet.types.d.ts +1 -1
  46. package/package.json +4 -4
  47. package/src/atoms/activity-indicator/activity-indicator.android.tsx +3 -6
  48. package/src/atoms/date-picker/date-picker.android.tsx +3 -12
  49. package/src/atoms/island/island.android.tsx +3 -7
  50. package/src/atoms/picker/picker.android.tsx +3 -3
  51. package/src/atoms/pressable/pressable.tsx +5 -7
  52. package/src/atoms/segmented-control/segmented-control.android.tsx +3 -6
  53. package/src/hooks/compose-host.tsx +20 -0
  54. package/src/molecules/navigation-bar/bar-search-field.tsx +94 -0
  55. package/src/molecules/navigation-bar/navigation-bar.android.tsx +123 -19
  56. package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -6
  57. package/src/molecules/rn-list-item/rn-list-item.tsx +2 -1
  58. package/src/molecules/rn-tooltip/rn-tooltip.android.tsx +4 -3
  59. package/src/organisms/context-menu/context-menu.android.tsx +5 -9
  60. package/src/organisms/header/header-options.android.tsx +3 -7
  61. package/src/organisms/header/header-search-accessory.android.tsx +37 -3
  62. package/src/organisms/header/header-search-input.android.tsx +14 -53
  63. package/src/organisms/header/header.types.ts +20 -10
  64. package/src/organisms/header/use-header-search.tsx +18 -10
  65. package/src/organisms/sheet/sheet.tsx +19 -2
  66. package/src/organisms/sheet/sheet.types.ts +1 -1
  67. package/src/organisms/sheet/use-sheet-header.tsx +7 -1
  68. package/src/templates/screen/screen.android.tsx +4 -7
@@ -65,7 +65,7 @@ export type SheetProps = {
65
65
  draggable?: boolean
66
66
  /** Pinned to the bottom, above the content and the keyboard. */
67
67
  footer?: ReactElement
68
- /** The drag handle. On by default. */
68
+ /** The drag handle. On by default. On Android it is Material's handle, coloured by the app's theme. */
69
69
  grabber?: boolean
70
70
  /** The user dismissed it; `visible` going false does not call this. */
71
71
  onDismiss: () => void
@@ -17,6 +17,12 @@ type UseSheetHeaderParams = {
17
17
  /** The bar's own height (`NavigationBar`) plus the room above it, before the header has been measured. */
18
18
  const ESTIMATED_HEADER_HEIGHT = (Platform.OS === 'ios' ? 56 : 64) + spacing.s16
19
19
 
20
+ /**
21
+ * Above a header with no bar. Android's grabber is drawn over the sheet's content, 16 dp from the top and 4 dp tall, so
22
+ * there the header starts 8 dp under it. iOS's grabber ends 10 pt from the top, inside the usual 16 pt.
23
+ */
24
+ const HEADER_TOP_WITHOUT_BAR = Platform.OS === 'android' ? 's28' : 's16'
25
+
20
26
  /** Where a large title's bar title appears once it has scrolled away: the platform's own place for it. */
21
27
  const COLLAPSED_TITLE_ALIGNMENT: NavigationBarTitleAlignment = Platform.OS === 'ios' ? 'center' : 'leading'
22
28
 
@@ -83,7 +89,7 @@ export const useSheetHeader = ({header: headerProps, scrollable}: UseSheetHeader
83
89
  }
84
90
 
85
91
  return (
86
- <Box onLayout={isOverlay ? handleHeaderLayout : undefined} pt="s16">
92
+ <Box onLayout={isOverlay ? handleHeaderLayout : undefined} pt={hasBar ? 's16' : HEADER_TOP_WITHOUT_BAR}>
87
93
  {hasBar ? (
88
94
  <NavigationBar
89
95
  inverted={inverted}
@@ -1,9 +1,9 @@
1
- import {Column, Host} from '@expo/ui/jetpack-compose'
1
+ import {Column} from '@expo/ui/jetpack-compose'
2
2
  import {padding} from '@expo/ui/jetpack-compose/modifiers'
3
3
  import {useSxModifiers} from '@hzblj/kara-sx'
4
- import {useAppTheme} from '@hzblj/kara-theme'
5
4
  import {useCallback, useMemo, useRef, useState} from 'react'
6
5
  import {StatusBar, StyleSheet, View} from 'react-native'
6
+ import {ComposeHost} from '../../hooks/compose-host'
7
7
  import {HostBoundary} from '../../hooks/host-context'
8
8
  import type {ScreenComponent, ScreenProps} from './screen.types'
9
9
 
@@ -18,7 +18,6 @@ export const Screen: ScreenComponent = ({
18
18
  ignoreSafeArea = 'none',
19
19
  testID,
20
20
  }: ScreenProps) => {
21
- const theme = useAppTheme()
22
21
  const frame = useRef<View>(null)
23
22
  const [statusBarOverlap, setStatusBarOverlap] = useState(0)
24
23
  const sx = useSxModifiers({bg, tall: true, wide: true})
@@ -35,16 +34,14 @@ export const Screen: ScreenComponent = ({
35
34
 
36
35
  return (
37
36
  <View onLayout={onLayout} ref={frame} style={StyleSheet.absoluteFill} testID={testID}>
38
- <Host
39
- colorScheme={theme.dark ? 'dark' : 'light'}
37
+ <ComposeHost
40
38
  ignoreSafeAreaKeyboardInsets={ignoreSafeArea === 'all' || ignoreSafeArea === 'keyboard'}
41
- seedColor={theme.materialSeed}
42
39
  style={StyleSheet.absoluteFill}
43
40
  >
44
41
  <Column modifiers={modifiers}>
45
42
  <HostBoundary>{children}</HostBoundary>
46
43
  </Column>
47
- </Host>
44
+ </ComposeHost>
48
45
  </View>
49
46
  )
50
47
  }