@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.
- package/CHANGELOG.md +59 -0
- package/README.md +5 -5
- package/lib/module/atoms/activity-indicator/activity-indicator.android.js +42 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.android.js.map +1 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.ios.js +19 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.ios.js.map +1 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.types.js +4 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.types.js.map +1 -0
- package/lib/module/atoms/activity-indicator/index.js +2 -1
- package/lib/module/atoms/activity-indicator/index.js.map +1 -1
- package/lib/module/atoms/avatar/avatar.js +2 -4
- package/lib/module/atoms/avatar/avatar.js.map +1 -1
- package/lib/module/atoms/blur-view/blur-view.android.js +100 -0
- package/lib/module/atoms/blur-view/blur-view.android.js.map +1 -0
- package/lib/module/atoms/blur-view/blur-view.ios.js +43 -0
- package/lib/module/atoms/blur-view/blur-view.ios.js.map +1 -0
- package/lib/module/atoms/blur-view/blur-view.types.js +4 -0
- package/lib/module/atoms/blur-view/blur-view.types.js.map +1 -0
- package/lib/module/atoms/blur-view/index.js +5 -0
- package/lib/module/atoms/blur-view/index.js.map +1 -0
- package/lib/module/atoms/glass-view/glass-view.android.js +36 -5
- package/lib/module/atoms/glass-view/glass-view.android.js.map +1 -1
- package/lib/module/atoms/image/image.js +13 -6
- package/lib/module/atoms/image/image.js.map +1 -1
- package/lib/module/atoms/image/image.types.js +4 -0
- package/lib/module/atoms/image/image.types.js.map +1 -0
- package/lib/module/atoms/image/index.js +1 -0
- package/lib/module/atoms/image/index.js.map +1 -1
- package/lib/module/atoms/index.js +1 -0
- package/lib/module/atoms/index.js.map +1 -1
- package/lib/module/atoms/island/island.android.js +6 -2
- package/lib/module/atoms/island/island.android.js.map +1 -1
- package/lib/module/atoms/island/island.ios.js +5 -2
- package/lib/module/atoms/island/island.ios.js.map +1 -1
- package/lib/module/atoms/pressable/pressable.js +38 -6
- package/lib/module/atoms/pressable/pressable.js.map +1 -1
- package/lib/module/atoms/progress/progress.ios.js +10 -4
- package/lib/module/atoms/progress/progress.ios.js.map +1 -1
- package/lib/module/atoms/rn-text/rn-text.js +5 -2
- package/lib/module/atoms/rn-text/rn-text.js.map +1 -1
- package/lib/module/atoms/skeleton/skeleton.js +5 -5
- package/lib/module/atoms/skeleton/skeleton.js.map +1 -1
- package/lib/module/atoms/surface/surface.ios.js +3 -0
- package/lib/module/atoms/surface/surface.ios.js.map +1 -1
- package/lib/module/atoms/text/text.android.js +5 -2
- package/lib/module/atoms/text/text.android.js.map +1 -1
- package/lib/module/atoms/text/text.ios.js +14 -3
- package/lib/module/atoms/text/text.ios.js.map +1 -1
- package/lib/module/atoms/text-field/text-field.android.js +19 -4
- package/lib/module/atoms/text-field/text-field.android.js.map +1 -1
- package/lib/module/atoms/text-field/text-field.ios.js +7 -2
- package/lib/module/atoms/text-field/text-field.ios.js.map +1 -1
- package/lib/module/molecules/collapsible/collapsible.android.js +37 -7
- package/lib/module/molecules/collapsible/collapsible.android.js.map +1 -1
- package/lib/module/molecules/navigation-bar/navigation-bar.android.js +2 -8
- package/lib/module/molecules/navigation-bar/navigation-bar.android.js.map +1 -1
- package/lib/module/molecules/pager/pager.android.js +5 -4
- package/lib/module/molecules/pager/pager.android.js.map +1 -1
- package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js +114 -11
- package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js.map +1 -1
- package/lib/module/molecules/stepper/stepper.ios.js +45 -8
- package/lib/module/molecules/stepper/stepper.ios.js.map +1 -1
- package/lib/module/ripple-clip.js +9 -1
- package/lib/module/ripple-clip.js.map +1 -1
- package/lib/typescript/atoms/activity-indicator/activity-indicator.d.ts +1 -3
- package/lib/typescript/atoms/activity-indicator/activity-indicator.ios.d.ts +3 -0
- package/lib/typescript/atoms/activity-indicator/activity-indicator.types.d.ts +17 -0
- package/lib/typescript/atoms/activity-indicator/index.d.ts +1 -0
- package/lib/typescript/atoms/blur-view/blur-view.d.ts +1 -0
- package/lib/typescript/atoms/blur-view/blur-view.ios.d.ts +3 -0
- package/lib/typescript/atoms/blur-view/blur-view.types.d.ts +31 -0
- package/lib/typescript/atoms/blur-view/index.d.ts +2 -0
- package/lib/typescript/atoms/box/a-box.d.ts +1 -1
- package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +12 -5
- package/lib/typescript/atoms/image/image.d.ts +12 -4
- package/lib/typescript/atoms/image/image.types.d.ts +4 -0
- package/lib/typescript/atoms/image/index.d.ts +1 -0
- package/lib/typescript/atoms/index.d.ts +1 -0
- package/lib/typescript/atoms/island/island.types.d.ts +8 -4
- package/lib/typescript/atoms/pressable/pressable.types.d.ts +5 -3
- package/lib/typescript/atoms/progress/progress.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +7 -2
- package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +8 -4
- package/lib/typescript/atoms/surface/surface.types.d.ts +2 -2
- package/lib/typescript/atoms/text/text.types.d.ts +7 -2
- package/lib/typescript/atoms/text-field/text-field.types.d.ts +6 -2
- package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +6 -4
- package/lib/typescript/molecules/stepper/stepper.ios.d.ts +5 -0
- package/lib/typescript/molecules/stepper/stepper.types.d.ts +1 -4
- package/package.json +5 -5
- package/src/atoms/activity-indicator/activity-indicator.android.tsx +32 -0
- package/src/atoms/activity-indicator/activity-indicator.ios.tsx +15 -0
- package/src/atoms/activity-indicator/activity-indicator.types.ts +20 -0
- package/src/atoms/activity-indicator/index.ts +1 -0
- package/src/atoms/avatar/avatar.tsx +1 -1
- package/src/atoms/blur-view/blur-view.android.tsx +68 -0
- package/src/atoms/blur-view/blur-view.ios.tsx +37 -0
- package/src/atoms/blur-view/blur-view.types.ts +34 -0
- package/src/atoms/blur-view/index.ts +2 -0
- package/src/atoms/glass-view/glass-view.android.tsx +41 -3
- package/src/atoms/glass-view/glass-view.types.ts +12 -5
- package/src/atoms/image/image.tsx +11 -12
- package/src/atoms/image/image.types.ts +6 -0
- package/src/atoms/image/index.ts +1 -0
- package/src/atoms/index.ts +1 -0
- package/src/atoms/island/island.android.tsx +10 -2
- package/src/atoms/island/island.ios.tsx +4 -2
- package/src/atoms/island/island.types.ts +8 -4
- package/src/atoms/pressable/pressable.tsx +46 -6
- package/src/atoms/pressable/pressable.types.ts +5 -3
- package/src/atoms/progress/progress.ios.tsx +14 -5
- package/src/atoms/progress/progress.types.ts +2 -2
- package/src/atoms/rn-text/rn-text.tsx +6 -3
- package/src/atoms/rn-text/rn-text.types.ts +15 -9
- package/src/atoms/skeleton/skeleton.tsx +4 -4
- package/src/atoms/skeleton/skeleton.types.ts +8 -4
- package/src/atoms/surface/surface.ios.tsx +2 -1
- package/src/atoms/surface/surface.types.ts +2 -2
- package/src/atoms/text/text.android.tsx +7 -1
- package/src/atoms/text/text.ios.tsx +14 -3
- package/src/atoms/text/text.types.ts +7 -2
- package/src/atoms/text-field/text-field.android.tsx +19 -3
- package/src/atoms/text-field/text-field.ios.tsx +7 -1
- package/src/atoms/text-field/text-field.types.ts +6 -2
- package/src/molecules/collapsible/collapsible.android.tsx +47 -7
- package/src/molecules/navigation-bar/navigation-bar.android.tsx +1 -6
- package/src/molecules/pager/pager.android.tsx +4 -1
- package/src/molecules/scroll-edge-container/scroll-edge-container.android.tsx +103 -10
- package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +6 -4
- package/src/molecules/stepper/stepper.ios.tsx +37 -1
- package/src/molecules/stepper/stepper.types.ts +1 -4
- package/src/ripple-clip.ts +10 -1
- package/lib/module/atoms/activity-indicator/activity-indicator.js +0 -14
- package/lib/module/atoms/activity-indicator/activity-indicator.js.map +0 -1
- 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
|
|
9
|
-
* blur where content scrolls past a bar
|
|
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,
|
|
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,
|
|
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
|
|
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
|
package/src/ripple-clip.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
}
|