@hzblj/kara-components 0.7.0 → 0.9.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 (135) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +5 -5
  3. package/lib/module/atoms/activity-indicator/activity-indicator.android.js +42 -0
  4. package/lib/module/atoms/activity-indicator/activity-indicator.android.js.map +1 -0
  5. package/lib/module/atoms/activity-indicator/activity-indicator.ios.js +19 -0
  6. package/lib/module/atoms/activity-indicator/activity-indicator.ios.js.map +1 -0
  7. package/lib/module/atoms/activity-indicator/activity-indicator.types.js +4 -0
  8. package/lib/module/atoms/activity-indicator/activity-indicator.types.js.map +1 -0
  9. package/lib/module/atoms/activity-indicator/index.js +2 -1
  10. package/lib/module/atoms/activity-indicator/index.js.map +1 -1
  11. package/lib/module/atoms/avatar/avatar.js +2 -4
  12. package/lib/module/atoms/avatar/avatar.js.map +1 -1
  13. package/lib/module/atoms/blur-view/blur-view.android.js +100 -0
  14. package/lib/module/atoms/blur-view/blur-view.android.js.map +1 -0
  15. package/lib/module/atoms/blur-view/blur-view.ios.js +43 -0
  16. package/lib/module/atoms/blur-view/blur-view.ios.js.map +1 -0
  17. package/lib/module/atoms/blur-view/blur-view.types.js +4 -0
  18. package/lib/module/atoms/blur-view/blur-view.types.js.map +1 -0
  19. package/lib/module/atoms/blur-view/index.js +5 -0
  20. package/lib/module/atoms/blur-view/index.js.map +1 -0
  21. package/lib/module/atoms/glass-view/glass-view.android.js +36 -5
  22. package/lib/module/atoms/glass-view/glass-view.android.js.map +1 -1
  23. package/lib/module/atoms/image/image.js +13 -6
  24. package/lib/module/atoms/image/image.js.map +1 -1
  25. package/lib/module/atoms/image/image.types.js +4 -0
  26. package/lib/module/atoms/image/image.types.js.map +1 -0
  27. package/lib/module/atoms/image/index.js +1 -0
  28. package/lib/module/atoms/image/index.js.map +1 -1
  29. package/lib/module/atoms/index.js +1 -0
  30. package/lib/module/atoms/index.js.map +1 -1
  31. package/lib/module/atoms/island/island.android.js +6 -2
  32. package/lib/module/atoms/island/island.android.js.map +1 -1
  33. package/lib/module/atoms/island/island.ios.js +5 -2
  34. package/lib/module/atoms/island/island.ios.js.map +1 -1
  35. package/lib/module/atoms/pressable/pressable.js +38 -6
  36. package/lib/module/atoms/pressable/pressable.js.map +1 -1
  37. package/lib/module/atoms/progress/progress.ios.js +10 -4
  38. package/lib/module/atoms/progress/progress.ios.js.map +1 -1
  39. package/lib/module/atoms/rn-text/rn-text.js +5 -2
  40. package/lib/module/atoms/rn-text/rn-text.js.map +1 -1
  41. package/lib/module/atoms/skeleton/skeleton.js +5 -5
  42. package/lib/module/atoms/skeleton/skeleton.js.map +1 -1
  43. package/lib/module/atoms/surface/surface.ios.js +3 -0
  44. package/lib/module/atoms/surface/surface.ios.js.map +1 -1
  45. package/lib/module/atoms/text/text.android.js +5 -2
  46. package/lib/module/atoms/text/text.android.js.map +1 -1
  47. package/lib/module/atoms/text/text.ios.js +14 -3
  48. package/lib/module/atoms/text/text.ios.js.map +1 -1
  49. package/lib/module/atoms/text-field/text-field.android.js +19 -4
  50. package/lib/module/atoms/text-field/text-field.android.js.map +1 -1
  51. package/lib/module/atoms/text-field/text-field.ios.js +7 -2
  52. package/lib/module/atoms/text-field/text-field.ios.js.map +1 -1
  53. package/lib/module/molecules/collapsible/collapsible.android.js +37 -7
  54. package/lib/module/molecules/collapsible/collapsible.android.js.map +1 -1
  55. package/lib/module/molecules/navigation-bar/navigation-bar.android.js +2 -8
  56. package/lib/module/molecules/navigation-bar/navigation-bar.android.js.map +1 -1
  57. package/lib/module/molecules/pager/pager.android.js +5 -4
  58. package/lib/module/molecules/pager/pager.android.js.map +1 -1
  59. package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js +114 -11
  60. package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js.map +1 -1
  61. package/lib/module/molecules/stepper/stepper.ios.js +45 -8
  62. package/lib/module/molecules/stepper/stepper.ios.js.map +1 -1
  63. package/lib/module/ripple-clip.js +9 -1
  64. package/lib/module/ripple-clip.js.map +1 -1
  65. package/lib/typescript/atoms/activity-indicator/activity-indicator.d.ts +1 -3
  66. package/lib/typescript/atoms/activity-indicator/activity-indicator.ios.d.ts +3 -0
  67. package/lib/typescript/atoms/activity-indicator/activity-indicator.types.d.ts +17 -0
  68. package/lib/typescript/atoms/activity-indicator/index.d.ts +1 -0
  69. package/lib/typescript/atoms/blur-view/blur-view.d.ts +1 -0
  70. package/lib/typescript/atoms/blur-view/blur-view.ios.d.ts +3 -0
  71. package/lib/typescript/atoms/blur-view/blur-view.types.d.ts +31 -0
  72. package/lib/typescript/atoms/blur-view/index.d.ts +2 -0
  73. package/lib/typescript/atoms/box/a-box.d.ts +1 -1
  74. package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +12 -5
  75. package/lib/typescript/atoms/image/image.d.ts +12 -4
  76. package/lib/typescript/atoms/image/image.types.d.ts +4 -0
  77. package/lib/typescript/atoms/image/index.d.ts +1 -0
  78. package/lib/typescript/atoms/index.d.ts +1 -0
  79. package/lib/typescript/atoms/island/island.types.d.ts +8 -4
  80. package/lib/typescript/atoms/pressable/pressable.types.d.ts +5 -3
  81. package/lib/typescript/atoms/progress/progress.types.d.ts +2 -2
  82. package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +7 -2
  83. package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +8 -4
  84. package/lib/typescript/atoms/surface/surface.types.d.ts +2 -2
  85. package/lib/typescript/atoms/text/text.types.d.ts +7 -2
  86. package/lib/typescript/atoms/text-field/text-field.types.d.ts +6 -2
  87. package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +6 -4
  88. package/lib/typescript/molecules/stepper/stepper.ios.d.ts +5 -0
  89. package/lib/typescript/molecules/stepper/stepper.types.d.ts +1 -4
  90. package/package.json +5 -5
  91. package/src/atoms/activity-indicator/activity-indicator.android.tsx +32 -0
  92. package/src/atoms/activity-indicator/activity-indicator.ios.tsx +15 -0
  93. package/src/atoms/activity-indicator/activity-indicator.types.ts +20 -0
  94. package/src/atoms/activity-indicator/index.ts +1 -0
  95. package/src/atoms/avatar/avatar.tsx +1 -1
  96. package/src/atoms/blur-view/blur-view.android.tsx +68 -0
  97. package/src/atoms/blur-view/blur-view.ios.tsx +37 -0
  98. package/src/atoms/blur-view/blur-view.types.ts +34 -0
  99. package/src/atoms/blur-view/index.ts +2 -0
  100. package/src/atoms/glass-view/glass-view.android.tsx +41 -3
  101. package/src/atoms/glass-view/glass-view.types.ts +12 -5
  102. package/src/atoms/image/image.tsx +11 -12
  103. package/src/atoms/image/image.types.ts +6 -0
  104. package/src/atoms/image/index.ts +1 -0
  105. package/src/atoms/index.ts +1 -0
  106. package/src/atoms/island/island.android.tsx +10 -2
  107. package/src/atoms/island/island.ios.tsx +4 -2
  108. package/src/atoms/island/island.types.ts +8 -4
  109. package/src/atoms/pressable/pressable.tsx +46 -6
  110. package/src/atoms/pressable/pressable.types.ts +5 -3
  111. package/src/atoms/progress/progress.ios.tsx +14 -5
  112. package/src/atoms/progress/progress.types.ts +2 -2
  113. package/src/atoms/rn-text/rn-text.tsx +6 -3
  114. package/src/atoms/rn-text/rn-text.types.ts +15 -9
  115. package/src/atoms/skeleton/skeleton.tsx +4 -4
  116. package/src/atoms/skeleton/skeleton.types.ts +8 -4
  117. package/src/atoms/surface/surface.ios.tsx +2 -1
  118. package/src/atoms/surface/surface.types.ts +2 -2
  119. package/src/atoms/text/text.android.tsx +7 -1
  120. package/src/atoms/text/text.ios.tsx +14 -3
  121. package/src/atoms/text/text.types.ts +7 -2
  122. package/src/atoms/text-field/text-field.android.tsx +19 -3
  123. package/src/atoms/text-field/text-field.ios.tsx +7 -1
  124. package/src/atoms/text-field/text-field.types.ts +6 -2
  125. package/src/molecules/collapsible/collapsible.android.tsx +47 -7
  126. package/src/molecules/navigation-bar/navigation-bar.android.tsx +1 -6
  127. package/src/molecules/pager/pager.android.tsx +4 -1
  128. package/src/molecules/scroll-edge-container/scroll-edge-container.android.tsx +103 -10
  129. package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +6 -4
  130. package/src/molecules/stepper/stepper.ios.tsx +37 -1
  131. package/src/molecules/stepper/stepper.types.ts +1 -4
  132. package/src/ripple-clip.ts +10 -1
  133. package/lib/module/atoms/activity-indicator/activity-indicator.js +0 -14
  134. package/lib/module/atoms/activity-indicator/activity-indicator.js.map +0 -1
  135. package/src/atoms/activity-indicator/activity-indicator.tsx +0 -9
@@ -5,8 +5,10 @@ import type {ReactElement, ReactNode} from 'react'
5
5
  export type {ScrollEdgeEffect, ScrollEdgeScrollableProps} from '@hzblj/kara-native/swift-ui'
6
6
 
7
7
  /**
8
- * Bars over one React Native scroll view, with the iOS 26 scroll edge effect under them — the system's progressive
9
- * blur where content scrolls past a bar. The React Native tier: it needs no host.
8
+ * Bars over one React Native scroll view, with each platform's scroll edge under them — on iOS 26 the system's
9
+ * progressive blur where content scrolls past a bar; on Android a Material top app bar's behaviour, the bars stacked
10
+ * around the scroll view and filling with `surface.secondary` once content scrolls under them. The React Native tier:
11
+ * it needs no host.
10
12
  *
11
13
  * A screen-level container: wrap the screen's scroll view with it. Mounted inside a cell of a virtualized list on iOS
12
14
  * it draws only its bottom bar — the hosted scroll view and the top bar stay blank.
@@ -17,7 +19,7 @@ export type ScrollEdgeContainerProps = ResponsiveViewSx & {
17
19
  * content begins below the top bar and scrolls under it. On by default.
18
20
  */
19
21
  automaticInsets?: boolean
20
- /** Laid over the scroll view's bottom edge on iOS; stacked below it on Android, where it wants a background. */
22
+ /** Laid over the scroll view's bottom edge on iOS; stacked below it on Android, filled while content continues below. */
21
23
  bottomBar?: ReactNode
22
24
  /** Exactly one React Native scroll view — `RnScrollView`, `RnFlatList`, `RnSectionList`. */
23
25
  children: ReactElement<ScrollEdgeScrollableProps>
@@ -25,7 +27,7 @@ export type ScrollEdgeContainerProps = ResponsiveViewSx & {
25
27
  effect?: ScrollEdgeEffect
26
28
  /** Test identifier, forwarded to the container view. */
27
29
  testID?: string
28
- /** Laid over the scroll view's top edge on iOS; stacked above it on Android, where it wants a background. */
30
+ /** Laid over the scroll view's top edge on iOS; stacked above it on Android, filled once content scrolls under it. */
29
31
  topBar?: ReactNode
30
32
  }
31
33
 
@@ -1,10 +1,46 @@
1
1
  import {Stepper as SwiftUIStepper} from '@expo/ui/swift-ui'
2
+ import {labelsHidden} from '@expo/ui/swift-ui/modifiers'
3
+ import {useRef} from 'react'
2
4
 
5
+ import {HStack} from '../../atoms/h-stack'
6
+ import {Spacer} from '../../atoms/spacer'
7
+ import {Text} from '../../atoms/text'
3
8
  import {useHostGuard} from '../../host-context'
4
9
  import type {StepperComponent, StepperProps} from './stepper.types'
5
10
 
11
+ /** The label stays VoiceOver's, on the control; on screen it is the row's own text. */
12
+ const LABEL_HIDDEN = [labelsHidden()]
13
+
14
+ /**
15
+ * SwiftUI's `Stepper` at the end of a row, the label leading and the value just before the control — the way iOS's own
16
+ * settings show a stepped value. The value rolls to the next one (`numericText`), up or down with the change, in
17
+ * monospaced digits so the row does not jump.
18
+ */
6
19
  export const Stepper: StepperComponent = ({label, max, min, onValueChange, step = 1, value}: StepperProps) => {
7
20
  useHostGuard('Stepper')
21
+ const previous = useRef(value)
22
+ const countsDown = value < previous.current
23
+ previous.current = value
8
24
 
9
- return <SwiftUIStepper label={label} max={max} min={min} onValueChange={onValueChange} step={step} value={value} />
25
+ return (
26
+ <HStack align="center" spacing="s12" wide>
27
+ <Text>{label}</Text>
28
+ <Spacer />
29
+ <Text
30
+ color="content.secondary"
31
+ ios={{animation: {value}, contentTransition: {countsDown, type: 'numericText'}, monospacedDigit: true}}
32
+ >
33
+ {String(value)}
34
+ </Text>
35
+ <SwiftUIStepper
36
+ label={label}
37
+ max={max}
38
+ min={min}
39
+ modifiers={LABEL_HIDDEN}
40
+ onValueChange={onValueChange}
41
+ step={step}
42
+ value={value}
43
+ />
44
+ </HStack>
45
+ )
10
46
  }
@@ -5,10 +5,7 @@ import type {ReactNode} from 'react'
5
5
  * two icon buttons in a row. A native atom — it renders inside `<Screen>` or `<Island>`.
6
6
  */
7
7
  export type StepperProps = {
8
- /**
9
- * The leading text. iOS shows only the label, not the value — put the value in it if it should be seen. Android
10
- * shows the value between its buttons.
11
- */
8
+ /** The leading text. The value is shown too — before the control on iOS, between the buttons on Android. */
12
9
  label: string
13
10
  /** The highest value. When unset, Android has no upper limit and iOS stops at `100`. */
14
11
  max?: number
@@ -23,6 +23,9 @@ const CONTENT_KEYS = new Set<string>([
23
23
 
24
24
  const FILL: ViewStyle = {flexGrow: 1}
25
25
 
26
+ /** What gives the outer view a height of its own, rather than its content's. */
27
+ const SIZING_KEYS = ['aspectRatio', 'flex', 'flexBasis', 'flexGrow', 'height', 'minHeight'] as const
28
+
26
29
  /**
27
30
  * Splits a resolved style for a pressable with an Android ripple. The ripple is drawn as the pressable's foreground,
28
31
  * which its own `overflow: hidden` does not clip — so it would spill past rounded corners. A parent clips its
@@ -43,5 +46,11 @@ export const splitForRipple = (style: ViewStyle | undefined): {inner: ViewStyle[
43
46
  }
44
47
  }
45
48
 
46
- return {inner: [FILL, inner as ViewStyle], outer: outer as ViewStyle}
49
+ // Only a sized outer view needs the pressable stretched to it. Sized by its content it must not be: Yoga grows a
50
+ // `flexGrow` child of a fit-content parent to the most it may take — inside a row centred on its cross axis, the
51
+ // pressable would stretch to the row's full height and leave its content at the top.
52
+ const sized =
53
+ SIZING_KEYS.some(key => flat[key] !== undefined) || (flat.top !== undefined && flat.bottom !== undefined)
54
+
55
+ return {inner: sized ? [FILL, inner as ViewStyle] : [inner as ViewStyle], outer: outer as ViewStyle}
47
56
  }
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- import { useAppTheme } from '@hzblj/kara-theme';
4
- import { ActivityIndicator as RNActivityIndicator } from 'react-native';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- export const ActivityIndicator = props => {
7
- const theme = useAppTheme();
8
- return /*#__PURE__*/_jsx(RNActivityIndicator, {
9
- color: theme.color('fill.accent.primary'),
10
- size: "small",
11
- ...props
12
- });
13
- };
14
- //# sourceMappingURL=activity-indicator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useAppTheme","ActivityIndicator","RNActivityIndicator","jsx","_jsx","props","theme","color","size"],"sourceRoot":"../../../../src","sources":["atoms/activity-indicator/activity-indicator.tsx"],"mappings":";;AAAA,SAAQA,WAAW,QAAO,mBAAmB;AAE7C,SAAqCC,iBAAiB,IAAIC,mBAAmB,QAAO,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAElG,OAAO,MAAMH,iBAA6C,GAAGI,KAAK,IAAI;EACpE,MAAMC,KAAK,GAAGN,WAAW,CAAC,CAAC;EAE3B,oBAAOI,IAAA,CAACF,mBAAmB;IAACK,KAAK,EAAED,KAAK,CAACC,KAAK,CAAC,qBAAqB,CAAE;IAACC,IAAI,EAAC,OAAO;IAAA,GAAKH;EAAK,CAAG,CAAC;AACnG,CAAC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import {useAppTheme} from '@hzblj/kara-theme'
2
- import type {FC} from 'react'
3
- import {type ActivityIndicatorProps, ActivityIndicator as RNActivityIndicator} from 'react-native'
4
-
5
- export const ActivityIndicator: FC<ActivityIndicatorProps> = props => {
6
- const theme = useAppTheme()
7
-
8
- return <RNActivityIndicator color={theme.color('fill.accent.primary')} size="small" {...props} />
9
- }