@hzblj/kara-components 0.9.0 → 0.10.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 +45 -28
- package/README.md +8 -8
- package/lib/module/atoms/color-picker/color-picker.android.js +32 -5
- package/lib/module/atoms/color-picker/color-picker.android.js.map +1 -1
- package/lib/module/atoms/icon-button/icon-button.ios.js +17 -4
- package/lib/module/atoms/icon-button/icon-button.ios.js.map +1 -1
- package/lib/module/atoms/pressable/pressable.js +45 -22
- package/lib/module/atoms/pressable/pressable.js.map +1 -1
- package/lib/typescript/atoms/activity-indicator/activity-indicator.types.d.ts +1 -1
- package/lib/typescript/atoms/avatar/avatar.types.d.ts +2 -2
- package/lib/typescript/atoms/badge/badge.types.d.ts +1 -1
- package/lib/typescript/atoms/blur-view/blur-view.types.d.ts +6 -6
- package/lib/typescript/atoms/button/button.types.d.ts +7 -7
- package/lib/typescript/atoms/card/card.types.d.ts +1 -1
- package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +2 -2
- package/lib/typescript/atoms/chip/chip.types.d.ts +1 -1
- package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +4 -3
- package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +4 -4
- package/lib/typescript/atoms/divider/divider.types.d.ts +2 -2
- package/lib/typescript/atoms/fab/fab.types.d.ts +2 -2
- package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +5 -5
- package/lib/typescript/atoms/h-stack/h-stack.types.d.ts +3 -3
- package/lib/typescript/atoms/icon/icon.types.d.ts +4 -4
- package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +7 -3
- package/lib/typescript/atoms/island/island.types.d.ts +4 -4
- package/lib/typescript/atoms/list/list.types.d.ts +5 -5
- package/lib/typescript/atoms/picker/picker.types.d.ts +1 -1
- package/lib/typescript/atoms/pressable/pressable.types.d.ts +21 -5
- package/lib/typescript/atoms/progress/progress.types.d.ts +1 -1
- package/lib/typescript/atoms/rn-flat-list/rn-flat-list.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-icon/rn-icon.types.d.ts +1 -1
- package/lib/typescript/atoms/rn-scroll-view/rn-scroll-view.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-section-list/rn-section-list.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-view/rn-view.types.d.ts +3 -3
- package/lib/typescript/atoms/scroll-view/scroll-view.types.d.ts +3 -3
- package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +3 -3
- package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +2 -2
- package/lib/typescript/atoms/spacer/spacer.types.d.ts +1 -1
- package/lib/typescript/atoms/surface/surface.types.d.ts +1 -1
- package/lib/typescript/atoms/switch/switch.types.d.ts +1 -1
- package/lib/typescript/atoms/text/text.types.d.ts +1 -1
- package/lib/typescript/atoms/text-field/text-field.types.d.ts +4 -4
- package/lib/typescript/atoms/v-stack/v-stack.types.d.ts +1 -1
- package/lib/typescript/atoms/z-stack/z-stack.types.d.ts +1 -1
- package/lib/typescript/glyph/glyph-button.types.d.ts +1 -1
- package/lib/typescript/glyph/glyph.types.d.ts +1 -1
- package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +1 -1
- package/lib/typescript/molecules/empty-state/empty-state.types.d.ts +1 -1
- package/lib/typescript/molecules/label/label.types.d.ts +1 -1
- package/lib/typescript/molecules/labeled-content/labeled-content.types.d.ts +2 -2
- package/lib/typescript/molecules/list-item/list-item.types.d.ts +2 -2
- package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -8
- package/lib/typescript/molecules/pager/pager.types.d.ts +2 -2
- package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +2 -2
- package/lib/typescript/molecules/rn-list-item/rn-list-item.types.d.ts +1 -1
- package/lib/typescript/molecules/rn-tooltip/rn-tooltip.types.d.ts +7 -7
- package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +3 -3
- package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +2 -2
- package/lib/typescript/molecules/stepper/stepper.types.d.ts +2 -2
- package/lib/typescript/molecules/tooltip/tooltip.types.d.ts +6 -6
- package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +3 -3
- package/lib/typescript/organisms/alert/alert.types.d.ts +3 -3
- package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +9 -9
- package/lib/typescript/organisms/fab-menu/fab-menu.types.d.ts +5 -5
- package/lib/typescript/organisms/form/form.types.d.ts +1 -1
- package/lib/typescript/organisms/menu/menu.types.d.ts +2 -2
- package/lib/typescript/organisms/sheet/sheet.types.d.ts +12 -12
- package/lib/typescript/organisms/snackbar/snackbar.types.d.ts +1 -1
- package/lib/typescript/organisms/swipe-actions/swipe-actions.types.d.ts +5 -5
- package/lib/typescript/templates/screen/screen.types.d.ts +2 -2
- package/package.json +4 -4
- package/src/atoms/activity-indicator/activity-indicator.types.ts +1 -1
- package/src/atoms/avatar/avatar.types.ts +2 -2
- package/src/atoms/badge/badge.types.ts +1 -1
- package/src/atoms/blur-view/blur-view.types.ts +6 -6
- package/src/atoms/button/button.types.ts +7 -7
- package/src/atoms/card/card.types.ts +1 -1
- package/src/atoms/checkbox/checkbox.types.ts +2 -2
- package/src/atoms/chip/chip.types.ts +1 -1
- package/src/atoms/color-picker/color-picker.android.tsx +26 -6
- package/src/atoms/color-picker/color-picker.types.ts +4 -3
- package/src/atoms/date-picker/date-picker.types.ts +4 -4
- package/src/atoms/divider/divider.types.ts +2 -2
- package/src/atoms/fab/fab.types.ts +2 -2
- package/src/atoms/glass-view/glass-view.types.ts +5 -5
- package/src/atoms/h-stack/h-stack.types.ts +3 -3
- package/src/atoms/icon/icon.types.ts +4 -4
- package/src/atoms/icon-button/icon-button.ios.tsx +12 -2
- package/src/atoms/icon-button/icon-button.types.ts +7 -3
- package/src/atoms/island/island.types.ts +4 -4
- package/src/atoms/list/list.types.ts +5 -5
- package/src/atoms/picker/picker.types.ts +1 -1
- package/src/atoms/pressable/pressable.tsx +39 -18
- package/src/atoms/pressable/pressable.types.ts +22 -5
- package/src/atoms/progress/progress.types.ts +1 -1
- package/src/atoms/rn-flat-list/rn-flat-list.types.ts +2 -2
- package/src/atoms/rn-icon/rn-icon.types.ts +1 -1
- package/src/atoms/rn-scroll-view/rn-scroll-view.types.ts +2 -2
- package/src/atoms/rn-section-list/rn-section-list.types.ts +2 -2
- package/src/atoms/rn-text/rn-text.types.ts +2 -2
- package/src/atoms/rn-view/rn-view.types.ts +3 -3
- package/src/atoms/scroll-view/scroll-view.types.ts +3 -3
- package/src/atoms/segmented-control/segmented-control.types.ts +3 -3
- package/src/atoms/skeleton/skeleton.types.ts +2 -2
- package/src/atoms/spacer/spacer.types.ts +1 -1
- package/src/atoms/surface/surface.types.ts +1 -1
- package/src/atoms/switch/switch.types.ts +1 -1
- package/src/atoms/text/text.types.ts +1 -1
- package/src/atoms/text-field/text-field.types.ts +4 -4
- package/src/atoms/v-stack/v-stack.types.ts +1 -1
- package/src/atoms/z-stack/z-stack.types.ts +1 -1
- package/src/glyph/glyph-button.types.ts +1 -1
- package/src/glyph/glyph.types.ts +1 -1
- package/src/molecules/collapsible/collapsible.types.ts +1 -1
- package/src/molecules/empty-state/empty-state.types.ts +1 -1
- package/src/molecules/label/label.types.ts +1 -1
- package/src/molecules/labeled-content/labeled-content.types.ts +2 -2
- package/src/molecules/list-item/list-item.types.ts +2 -2
- package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -8
- package/src/molecules/pager/pager.types.ts +2 -2
- package/src/molecules/radio-group/radio-group.types.ts +2 -2
- package/src/molecules/rn-list-item/rn-list-item.types.ts +1 -1
- package/src/molecules/rn-tooltip/rn-tooltip.types.ts +7 -7
- package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +3 -3
- package/src/molecules/search-bar/search-bar.types.ts +2 -2
- package/src/molecules/stepper/stepper.types.ts +2 -2
- package/src/molecules/tooltip/tooltip.types.ts +6 -6
- package/src/organisms/action-sheet/action-sheet.types.ts +3 -3
- package/src/organisms/alert/alert.types.ts +3 -3
- package/src/organisms/context-menu/context-menu.types.ts +9 -9
- package/src/organisms/fab-menu/fab-menu.types.ts +5 -5
- package/src/organisms/form/form.types.ts +1 -1
- package/src/organisms/menu/menu.types.ts +2 -2
- package/src/organisms/sheet/sheet.types.ts +12 -12
- package/src/organisms/snackbar/snackbar.types.ts +1 -1
- package/src/organisms/swipe-actions/swipe-actions.types.ts +5 -5
- package/src/templates/screen/screen.types.ts +2 -2
- package/lib/module/platform-support.js +0 -19
- package/lib/module/platform-support.js.map +0 -1
- package/lib/typescript/platform-support.d.ts +0 -8
- package/src/platform-support.ts +0 -20
|
@@ -4,7 +4,7 @@ import type {ScrollViewProps as RNScrollViewProps} from 'react-native'
|
|
|
4
4
|
import type {ScrollViewAxis} from '../scroll-view'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* React Native tier scroll container
|
|
7
|
+
* React Native tier scroll container, the sibling of `RnView`/`RnText`. Use it when the
|
|
8
8
|
* subtree is React Native and native atoms are embedded through `Island`. For a screen that
|
|
9
9
|
* is native all the way down, reach for the `ScrollView` atom instead.
|
|
10
10
|
*
|
|
@@ -17,7 +17,7 @@ export type RnScrollViewProps = ResponsiveViewSx &
|
|
|
17
17
|
axis?: ScrollViewAxis
|
|
18
18
|
/** The scrolling content. */
|
|
19
19
|
children?: ReactNode
|
|
20
|
-
/** Styles the scrolling content container
|
|
20
|
+
/** Styles the scrolling content container; padding and gap belong here. */
|
|
21
21
|
content?: ResponsiveViewSx
|
|
22
22
|
/** Shows the scroll indicators. On by default. */
|
|
23
23
|
showsIndicators?: boolean
|
|
@@ -3,11 +3,11 @@ import type {DefaultSectionT, SectionListProps as RNSectionListProps} from 'reac
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Top-level `sx` styles the viewport; `content` styles the scrolling content container, so padding and
|
|
6
|
-
* gap belong there
|
|
6
|
+
* gap belong there (the same split as `RnScrollView` and `RnFlatList`). `removeClippedSubviews` is off unless
|
|
7
7
|
* you turn it on, as in `RnFlatList`: Android's default would leave rows with hosts in them empty.
|
|
8
8
|
*/
|
|
9
9
|
export type RnSectionListProps<TItem, TSection = DefaultSectionT> = ResponsiveViewSx &
|
|
10
10
|
Omit<RNSectionListProps<TItem, TSection>, 'contentContainerStyle' | 'style'> & {
|
|
11
|
-
/** Styles the scrolling content container
|
|
11
|
+
/** Styles the scrolling content container; padding and gap belong here. */
|
|
12
12
|
content?: ResponsiveViewSx
|
|
13
13
|
}
|
|
@@ -4,8 +4,8 @@ import type {ReactNode} from 'react'
|
|
|
4
4
|
import type {TextProps as RNTextProps} from 'react-native'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* React Native's `Text` in a theme typography variant
|
|
8
|
-
* `Box`'s `sx` surface for its own box
|
|
7
|
+
* React Native's `Text` in a theme typography variant: the React Native tier, for text outside a native host. It takes
|
|
8
|
+
* `Box`'s `sx` surface for its own box (margins, flex, padding, a background), all but `align`, which here aligns the
|
|
9
9
|
* lines.
|
|
10
10
|
*/
|
|
11
11
|
export type RnTextProps = Omit<RNTextProps, 'style'> &
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type {ReactElement, ReactNode} from 'react'
|
|
2
2
|
|
|
3
|
-
/** Carries a React Native view into a SwiftUI or Compose tree
|
|
3
|
+
/** Carries a React Native view into a SwiftUI or Compose tree: `@expo/ui`'s `RNHostView` on both platforms. */
|
|
4
4
|
export type RnViewProps = {
|
|
5
5
|
/**
|
|
6
6
|
* A single React Native *view*. It may not contain React Native text: a bare string becomes a
|
|
7
7
|
* `RawText` node, which has no component view, so mounting it across the SwiftUI host boundary
|
|
8
8
|
* fails the `RCTComponentViewFactory` assertion and takes the whole app down. `@expo/ui` states
|
|
9
|
-
* the rule itself in `ListItem.ios.tsx`
|
|
9
|
+
* the rule itself in `ListItem.ios.tsx` ("SwiftUI hosts can't render bare strings") and wraps
|
|
10
10
|
* every raw string in a SwiftUI `Text` before it reaches a host. Do the same: use the `Text` atom
|
|
11
11
|
* inside the host, and keep `RnText` outside it.
|
|
12
12
|
*/
|
|
@@ -16,7 +16,7 @@ export type RnViewProps = {
|
|
|
16
16
|
* intrinsic size and would otherwise stretch to fill the SwiftUI parent.
|
|
17
17
|
*/
|
|
18
18
|
matchContents?: boolean
|
|
19
|
-
/** Not forwarded on either platform
|
|
19
|
+
/** Not forwarded on either platform: give the child its own `testID`. */
|
|
20
20
|
testID?: string
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -5,7 +5,7 @@ import type {ReactNode} from 'react'
|
|
|
5
5
|
export type ScrollViewAxis = 'horizontal' | 'vertical'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* The `sx` props style the scrolling *content* container, not the viewport
|
|
8
|
+
* The `sx` props style the scrolling *content* container, not the viewport: `p` behaves
|
|
9
9
|
* like React Native's `contentContainerStyle` padding and scrolls with the content.
|
|
10
10
|
*/
|
|
11
11
|
export type ScrollViewProps = ResponsiveSx & {
|
|
@@ -15,13 +15,13 @@ export type ScrollViewProps = ResponsiveSx & {
|
|
|
15
15
|
children?: ReactNode
|
|
16
16
|
/**
|
|
17
17
|
* Enables pull-to-refresh. Async on purpose: the spinner runs until the promise settles, which is
|
|
18
|
-
* what SwiftUI's `refreshable` expects and what Compose's controlled indicator is driven from
|
|
18
|
+
* what SwiftUI's `refreshable` expects and what Compose's controlled indicator is driven from, so
|
|
19
19
|
* neither platform needs a separate `refreshing` flag to be kept in sync by the caller.
|
|
20
20
|
*
|
|
21
21
|
* Only a vertical scroll view can be pulled; on a horizontal one both platforms ignore it.
|
|
22
22
|
*/
|
|
23
23
|
onRefresh?: () => Promise<void>
|
|
24
|
-
/** iOS only
|
|
24
|
+
/** iOS only: Compose exposes no indicator toggle, so Android always shows the native one. */
|
|
25
25
|
showsIndicators?: boolean
|
|
26
26
|
/** The space between children. */
|
|
27
27
|
spacing?: SpaceSize
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A row of mutually exclusive segments, the selected one in the accent
|
|
4
|
+
* A row of mutually exclusive segments, the selected one in the accent: kara's own `UISegmentedControl` on iOS,
|
|
5
5
|
* Material's single-choice segmented buttons on Android. It needs no `Screen` or `Island`: iOS is a plain view, Android
|
|
6
6
|
* brings its own host. It takes the width it is given; the height is the platform's.
|
|
7
7
|
*/
|
|
@@ -9,13 +9,13 @@ export type SegmentedControlProps = {
|
|
|
9
9
|
/** Stops the user changing the segment, and dims the control. */
|
|
10
10
|
disabled?: boolean
|
|
11
11
|
/**
|
|
12
|
-
* Called with the index and label of the segment the user picked
|
|
12
|
+
* Called with the index and label of the segment the user picked, never for a tap on the one already selected.
|
|
13
13
|
* Android plays `selection`; iOS's control plays its own feedback.
|
|
14
14
|
*/
|
|
15
15
|
onChange?: (index: number, value: string) => void
|
|
16
16
|
/** The selected segment. Controlled: pass back what `onChange` reports. */
|
|
17
17
|
selectedIndex: number
|
|
18
|
-
/** Test identifier, on the whole control
|
|
18
|
+
/** Test identifier, on the whole control. Reach a segment by its label. */
|
|
19
19
|
testID?: string
|
|
20
20
|
/** The segments' labels, in order. */
|
|
21
21
|
values: string[]
|
|
@@ -3,8 +3,8 @@ import type {RadiiSize} from '@hzblj/kara-theme'
|
|
|
3
3
|
import type {ReactNode} from 'react'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A loading placeholder that pulses in `fill.quaternary
|
|
7
|
-
* `sx` names: `w`, `h`, `borderRadius`.
|
|
6
|
+
* A loading placeholder that pulses in `fill.quaternary`. It is a React Native view, so it needs no host. Sized with
|
|
7
|
+
* the `sx` names: `w`, `h`, `borderRadius`.
|
|
8
8
|
*/
|
|
9
9
|
export type SkeletonProps = {
|
|
10
10
|
/** The corner radius. `small` by default. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {SpaceSize} from '@hzblj/kara-theme'
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
|
|
4
|
-
/** Takes up the free space in a stack
|
|
4
|
+
/** Takes up the free space in a stack: SwiftUI `Spacer` / Compose `Spacer` with `weight(1)`. */
|
|
5
5
|
export type SpacerProps = {
|
|
6
6
|
/** The least room it takes. iOS holds it along the stack's axis; Android as a minimum height only. */
|
|
7
7
|
min?: SpaceSize
|
|
@@ -2,7 +2,7 @@ import type {ResponsiveSx} from '@hzblj/kara-sx'
|
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* A container on `surface.primary`, padded `s16` and rounded `large` unless told otherwise
|
|
5
|
+
* A container on `surface.primary`, padded `s16` and rounded `large` unless told otherwise: a SwiftUI `VStack` on
|
|
6
6
|
* iOS, Material's `Surface` around a `Column` on Android.
|
|
7
7
|
*/
|
|
8
8
|
export type SurfaceProps = ResponsiveSx & {
|
|
@@ -5,7 +5,7 @@ export type SwitchProps = {
|
|
|
5
5
|
/** Stops the user flipping it, and dims it. */
|
|
6
6
|
disabled?: boolean
|
|
7
7
|
/**
|
|
8
|
-
* Shown beside the switch. On Android it makes a full-width row
|
|
8
|
+
* Shown beside the switch. On Android it makes a full-width row (label at the start, switch at the end) that
|
|
9
9
|
* toggles wherever it is tapped.
|
|
10
10
|
*/
|
|
11
11
|
label?: string
|
|
@@ -9,7 +9,7 @@ export type TextDecoration = 'none' | 'strikethrough' | 'underline'
|
|
|
9
9
|
export type TextTransform = 'lowercase' | 'uppercase'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* SwiftUI `Text` / Compose `Text` in a theme typography variant
|
|
12
|
+
* SwiftUI `Text` / Compose `Text` in a theme typography variant. A native atom: outside a host, use `RnText`. It takes
|
|
13
13
|
* the native `sx` surface too: padding, a frame (`wide` lines it up by `align`), a background, and the `ios` bucket's
|
|
14
14
|
* `contentTransition`, `animation` and `monospacedDigit` for a number that changes in place.
|
|
15
15
|
*/
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* An uncontrolled text field with an optional label above it
|
|
4
|
+
* An uncontrolled text field with an optional label above it: SwiftUI `TextField` (`SecureField` when `secure`) /
|
|
5
5
|
* Compose `OutlinedTextField`.
|
|
6
6
|
*/
|
|
7
7
|
export type TextFieldProps = {
|
|
8
|
-
/** The text it starts with. Read once, on mount
|
|
8
|
+
/** The text it starts with. Read once, on mount: the field is uncontrolled. */
|
|
9
9
|
defaultValue?: string
|
|
10
10
|
/** Stops editing and dims the field. On iOS it outranks `error`. */
|
|
11
11
|
disabled?: boolean
|
|
12
12
|
/**
|
|
13
|
-
* Marks the field invalid: a destructive outline and label. A message is shown under the field as well
|
|
14
|
-
* as Material's supporting text, beside its error icon
|
|
13
|
+
* Marks the field invalid: a destructive outline and label. A message is shown under the field as well (on Android
|
|
14
|
+
* as Material's supporting text, beside its error icon), so the error never rests on colour alone; Material's error
|
|
15
15
|
* colour is a pale red in dark mode. `true` marks it without a message.
|
|
16
16
|
*/
|
|
17
17
|
error?: boolean | string
|
|
@@ -4,7 +4,7 @@ import type {ReactNode} from 'react'
|
|
|
4
4
|
|
|
5
5
|
export type VStackAlign = 'center' | 'end' | 'start'
|
|
6
6
|
|
|
7
|
-
/** Stacks its children top to bottom
|
|
7
|
+
/** Stacks its children top to bottom: SwiftUI `VStack` / Compose `Column`. */
|
|
8
8
|
export type VStackProps = ResponsiveSx & {
|
|
9
9
|
/** The children's horizontal alignment. `start` by default. */
|
|
10
10
|
align?: VStackAlign
|
|
@@ -3,7 +3,7 @@ import type {ReactNode} from 'react'
|
|
|
3
3
|
|
|
4
4
|
export type ZStackAlign = 'bottom' | 'center' | 'top'
|
|
5
5
|
|
|
6
|
-
/** Layers its children on one another
|
|
6
|
+
/** Layers its children on one another: SwiftUI `ZStack` / Compose `Box`. */
|
|
7
7
|
export type ZStackProps = ResponsiveSx & {
|
|
8
8
|
/** Where the children sit vertically; they are always centred horizontally. `center` by default. */
|
|
9
9
|
align?: ZStackAlign
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {GlyphName} from '@hzblj/kara-native'
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
|
|
4
|
-
/** An icon button over one of kara's glyphs
|
|
4
|
+
/** An icon button over one of kara's glyphs, for the controls its own components build (a stepper, a bar). */
|
|
5
5
|
export type GlyphButtonProps = {
|
|
6
6
|
accessibilityLabel?: string
|
|
7
7
|
disabled?: boolean
|
package/src/glyph/glyph.types.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {ColorToken, SpaceSize} from '@hzblj/kara-theme'
|
|
|
3
3
|
import type {ReactNode} from 'react'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* One of the few glyphs kara's own components draw
|
|
6
|
+
* One of the few glyphs kara's own components draw: a search field's magnifier, a row's chevron. Internal: apps draw
|
|
7
7
|
* their own icons with `Icon` / `RnIcon`.
|
|
8
8
|
*/
|
|
9
9
|
export type GlyphProps = {
|
|
@@ -2,7 +2,7 @@ import type {ReactNode} from 'react'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A row that shows and hides its content: SwiftUI's `DisclosureGroup` on iOS; on Android a pressable row with a
|
|
5
|
-
* chevron over an animated reveal. A native atom
|
|
5
|
+
* chevron over an animated reveal. A native atom: it renders inside `<Screen>` or `<Island>`.
|
|
6
6
|
*/
|
|
7
7
|
export type CollapsibleProps = {
|
|
8
8
|
/** Shown while `expanded`. */
|
|
@@ -6,7 +6,7 @@ import type {IconName} from '../../atoms/icon'
|
|
|
6
6
|
* `action` takes a `Button` so the state can offer a way out.
|
|
7
7
|
*/
|
|
8
8
|
export type EmptyStateProps = {
|
|
9
|
-
/** Under the text
|
|
9
|
+
/** Under the text: a `Button`, say. */
|
|
10
10
|
action?: ReactNode
|
|
11
11
|
/** A second line under the title, in the secondary colour. */
|
|
12
12
|
description?: string
|
|
@@ -4,7 +4,7 @@ import type {ReactNode} from 'react'
|
|
|
4
4
|
import type {IconName} from '../../atoms/icon'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* An inline icon + text pair
|
|
7
|
+
* An inline icon + text pair: the thing you put inside a button, a menu row or a section
|
|
8
8
|
* header. For a full tappable row with a subtitle and chevron, use `ListItem`.
|
|
9
9
|
*/
|
|
10
10
|
export type LabelProps = {
|
|
@@ -3,7 +3,7 @@ import type {ReactNode} from 'react'
|
|
|
3
3
|
import type {IconName} from '../../atoms/icon'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A label on the leading edge and its value on the trailing edge
|
|
6
|
+
* A label on the leading edge and its value on the trailing edge: the settings/detail row.
|
|
7
7
|
* Pass `children` instead of `value` when the trailing side is a control rather than text.
|
|
8
8
|
*/
|
|
9
9
|
export type LabeledContentProps = {
|
|
@@ -15,7 +15,7 @@ export type LabeledContentProps = {
|
|
|
15
15
|
label: string
|
|
16
16
|
/** Makes the row pressable and adds a chevron on the trailing edge. */
|
|
17
17
|
onPress?: () => void
|
|
18
|
-
/** Horizontal padding inside the row
|
|
18
|
+
/** Horizontal padding inside the row, and inside its press area too, so Android's ripple reaches the card's edges. */
|
|
19
19
|
px?: SpaceSize
|
|
20
20
|
/** Test identifier, forwarded to the native view. */
|
|
21
21
|
testID?: string
|
|
@@ -4,7 +4,7 @@ import type {ReactNode} from 'react'
|
|
|
4
4
|
import type {IconName} from '../../atoms/icon'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* A row with an optional icon, a title and subtitle, and a chevron when it can be pressed. A native atom
|
|
7
|
+
* A row with an optional icon, a title and subtitle, and a chevron when it can be pressed. A native atom: it renders
|
|
8
8
|
* inside `<Screen>` or `<Island>`; `RnListItem` is the same row without a host.
|
|
9
9
|
*/
|
|
10
10
|
export type ListItemProps = {
|
|
@@ -13,7 +13,7 @@ export type ListItemProps = {
|
|
|
13
13
|
/** Makes the row pressable and adds a chevron on the trailing edge. */
|
|
14
14
|
onPress?: () => void
|
|
15
15
|
/**
|
|
16
|
-
* Horizontal padding inside the row
|
|
16
|
+
* Horizontal padding inside the row, and inside its press area too, so Android's ripple reaches the card's edges. For
|
|
17
17
|
* rows in a card of your own; a `List` insets its rows by itself.
|
|
18
18
|
*/
|
|
19
19
|
px?: SpaceSize
|
|
@@ -15,8 +15,8 @@ type NavigationBarItemBase = {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* One item of the bar. `back` and `close` are the platform's own
|
|
19
|
-
* Material arrow and cross on Android
|
|
18
|
+
* One item of the bar. `back` and `close` are the platform's own (a chevron and the system close item on iOS, the
|
|
19
|
+
* Material arrow and cross on Android), with `Back` / `Close` as their labels unless given others. `icon` is one of the
|
|
20
20
|
* app's icons and names itself for VoiceOver and TalkBack.
|
|
21
21
|
*/
|
|
22
22
|
export type NavigationBarItem =
|
|
@@ -28,7 +28,7 @@ export type NavigationBarSearchRef = {
|
|
|
28
28
|
clear: () => void
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/** A search field in place of the title
|
|
31
|
+
/** A search field in place of the title. iOS only for now; Android keeps the title. */
|
|
32
32
|
export type NavigationBarSearch = {
|
|
33
33
|
/** Every edit of the field's text. */
|
|
34
34
|
onChangeText: (text: string) => void
|
|
@@ -45,10 +45,10 @@ export type NavigationBarSearch = {
|
|
|
45
45
|
export type NavigationBarTitleAlignment = 'center' | 'leading'
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* A title with items on either side, for a header that is not a navigation screen's
|
|
48
|
+
* A title with items on either side, for a header that is not a navigation screen's. `Sheet.Header` is built on it.
|
|
49
49
|
* On iOS a standalone `UINavigationBar`, so the items press and render exactly like a native-stack header's: on iOS 26
|
|
50
50
|
* neighbours share a glass capsule instead of swelling as standalone glass buttons do. On Android Material's top app
|
|
51
|
-
* bar. Where an item goes is the caller's choice
|
|
51
|
+
* bar. Where an item goes is the caller's choice: the bar places nothing by itself, so a close can sit on either side.
|
|
52
52
|
* The React Native tier: it needs no host.
|
|
53
53
|
*/
|
|
54
54
|
export type NavigationBarProps = {
|
|
@@ -58,13 +58,13 @@ export type NavigationBarProps = {
|
|
|
58
58
|
leadingItems?: NavigationBarItem[]
|
|
59
59
|
/** Replaces the title with a search field (iOS). */
|
|
60
60
|
search?: NavigationBarSearch
|
|
61
|
-
/** Test identifier, forwarded to the native bar. iOS only
|
|
61
|
+
/** Test identifier, forwarded to the native bar. iOS only; Android ignores it. */
|
|
62
62
|
testID?: string
|
|
63
63
|
/** The bar's title. */
|
|
64
64
|
title?: string
|
|
65
|
-
/** `center`
|
|
65
|
+
/** `center` (iOS's own) by default; `leading` is Material's top app bar. */
|
|
66
66
|
titleAlignment?: NavigationBarTitleAlignment
|
|
67
|
-
/** Fades the title out and in without moving the items
|
|
67
|
+
/** Fades the title out and in without moving the items, for a large title that scrolls under the bar. */
|
|
68
68
|
titleVisible?: boolean
|
|
69
69
|
/** In screen order, toward the trailing edge. */
|
|
70
70
|
trailingItems?: NavigationBarItem[]
|
|
@@ -5,7 +5,7 @@ import type {ReactNode} from 'react'
|
|
|
5
5
|
* A swipeable, snapping pager: SwiftUI's `TabView` in its page style, Compose's `HorizontalPager`.
|
|
6
6
|
*
|
|
7
7
|
* Pages are addressed by their index rather than by a name, because Compose's pager is index-native
|
|
8
|
-
* and SwiftUI's tab values are strings
|
|
8
|
+
* and SwiftUI's tab values are strings; synthesising the string from the child's position is
|
|
9
9
|
* lossless, whereas inventing indices for named tabs on Compose would not be. Children are therefore
|
|
10
10
|
* plain nodes with no `Pager.Page` part to wrap them in: a page carries no props of its own, so the
|
|
11
11
|
* ceremony would buy nothing.
|
|
@@ -22,7 +22,7 @@ export type PagerProps = {
|
|
|
22
22
|
onPageChange?: (page: number) => void
|
|
23
23
|
/** Zero-based. Controlled when passed; otherwise the pager just starts at 0 and owns its position. */
|
|
24
24
|
page?: number
|
|
25
|
-
/** Android only
|
|
25
|
+
/** Android only: a SwiftUI page-style `TabView` has no gap between pages. */
|
|
26
26
|
pageSpacing?: SpaceSize
|
|
27
27
|
/**
|
|
28
28
|
* Android only. SwiftUI can only disable a `TabView` as a whole, which would take the pages'
|
|
@@ -4,13 +4,13 @@ import type {ReactNode} from 'react'
|
|
|
4
4
|
export type RadioOption = {
|
|
5
5
|
/** The option's text. */
|
|
6
6
|
label: string
|
|
7
|
-
/** Identifies the option to `value` and `onValueChange`, and keys its row
|
|
7
|
+
/** Identifies the option to `value` and `onValueChange`, and keys its row. Keep it unique. */
|
|
8
8
|
value: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A single choice from a list: rows with a checkmark on the selected one on iOS, Material radio buttons on Android. A
|
|
13
|
-
* native atom
|
|
13
|
+
* native atom: it renders inside `<Screen>` or `<Island>`.
|
|
14
14
|
*/
|
|
15
15
|
export type RadioGroupProps = {
|
|
16
16
|
/** The user pressed an option; it passes that option's `value`. */
|
|
@@ -3,7 +3,7 @@ import type {ReactNode} from 'react'
|
|
|
3
3
|
import type {ListItemProps} from '../list-item'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* `ListItem`'s row in the React Native tier
|
|
6
|
+
* `ListItem`'s row in the React Native tier: plain views, no host. For lists long enough that a native host per row
|
|
7
7
|
* would cost too much to mount (a navigation list, an `RnFlatList` of rows), with the platform's own press feedback: a
|
|
8
8
|
* ripple across the whole row on Android, a highlight on iOS. In a rounded card, give the card `overflow="hidden"`:
|
|
9
9
|
* Android draws the ripple as the row's foreground, which only a parent's clip keeps inside rounded corners.
|
|
@@ -6,9 +6,9 @@ export type RnTooltipActionVariant = 'link' | 'primary' | 'secondary'
|
|
|
6
6
|
export type RnTooltipAction = {
|
|
7
7
|
/** The button's text. */
|
|
8
8
|
label: string
|
|
9
|
-
/** Called on press. The tooltip stays up
|
|
9
|
+
/** Called on press. The tooltip stays up; turn `visible` off here if the action should close it. */
|
|
10
10
|
onPress: () => void
|
|
11
|
-
/** `link` by default
|
|
11
|
+
/** `link` by default, an underlined text. `primary`/`secondary` are small filled/outlined buttons. */
|
|
12
12
|
variant?: RnTooltipActionVariant
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ export type RnTooltipAction = {
|
|
|
16
16
|
export type RnTooltipDismissReason = 'anchorHidden' | 'outside'
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* A rich tooltip
|
|
19
|
+
* A rich tooltip (title, message, actions) anchored below a React Native view, and drawn above every sibling.
|
|
20
20
|
* Controlled: it never hides itself. `onDismiss` reports why it should, and the caller turns `visible` off. The React
|
|
21
21
|
* Native tier, unlike `Tooltip`, whose anchor is a native view inside a host.
|
|
22
22
|
*/
|
|
@@ -26,16 +26,16 @@ export type RnTooltipProps = {
|
|
|
26
26
|
/** Which end of the bubble the actions sit at. `end` by default. */
|
|
27
27
|
actionsAlignment?: 'end' | 'start'
|
|
28
28
|
/**
|
|
29
|
-
* Insets from the window's top and bottom that the anchor's centre must stay inside
|
|
30
|
-
* content. Past them the tooltip asks to be dismissed with `anchorHidden`.
|
|
29
|
+
* Insets from the window's top and bottom that the anchor's centre must stay inside (a header or a tab bar over the
|
|
30
|
+
* content). Past them the tooltip asks to be dismissed with `anchorHidden`.
|
|
31
31
|
*/
|
|
32
32
|
boundaryInsets?: {bottom?: number; top?: number}
|
|
33
|
-
/** The anchor
|
|
33
|
+
/** The anchor: a single React Native view. */
|
|
34
34
|
children: ReactElement
|
|
35
35
|
/** The body text, under the title. */
|
|
36
36
|
message?: string
|
|
37
37
|
/**
|
|
38
|
-
* Asks for the tooltip to close, with the reason
|
|
38
|
+
* Asks for the tooltip to close, with the reason; turn `visible` off. On Android any touch outside asks, the start
|
|
39
39
|
* of a scroll included; iOS keeps the tooltip through a scroll.
|
|
40
40
|
*/
|
|
41
41
|
onDismiss: (reason: RnTooltipDismissReason) => void
|
|
@@ -5,13 +5,13 @@ 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 each platform's scroll edge under them
|
|
8
|
+
* Bars over one React Native scroll view, with each platform's scroll edge under them: on iOS 26 the system's
|
|
9
9
|
* progressive blur where content scrolls past a bar; on Android a Material top app bar's behaviour, the bars stacked
|
|
10
10
|
* around the scroll view and filling with `surface.secondary` once content scrolls under them. The React Native tier:
|
|
11
11
|
* it needs no host.
|
|
12
12
|
*
|
|
13
13
|
* A screen-level container: wrap the screen's scroll view with it. Mounted inside a cell of a virtualized list on iOS
|
|
14
|
-
* it draws only its bottom bar
|
|
14
|
+
* it draws only its bottom bar; the hosted scroll view and the top bar stay blank.
|
|
15
15
|
*/
|
|
16
16
|
export type ScrollEdgeContainerProps = ResponsiveViewSx & {
|
|
17
17
|
/**
|
|
@@ -21,7 +21,7 @@ export type ScrollEdgeContainerProps = ResponsiveViewSx & {
|
|
|
21
21
|
automaticInsets?: boolean
|
|
22
22
|
/** Laid over the scroll view's bottom edge on iOS; stacked below it on Android, filled while content continues below. */
|
|
23
23
|
bottomBar?: ReactNode
|
|
24
|
-
/** Exactly one React Native scroll view
|
|
24
|
+
/** Exactly one React Native scroll view: `RnScrollView`, `RnFlatList`, `RnSectionList`. */
|
|
25
25
|
children: ReactElement<ScrollEdgeScrollableProps>
|
|
26
26
|
/** iOS 26: how hard the edge cuts. `soft` by default. */
|
|
27
27
|
effect?: ScrollEdgeEffect
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A search field drawn the same on both platforms
|
|
4
|
+
* A search field drawn the same on both platforms: a rounded box with a magnifier, a `TextInput` and a clear button
|
|
5
5
|
* while there is text. The React Native tier: it needs no host.
|
|
6
6
|
*/
|
|
7
7
|
export type SearchBarProps = {
|
|
@@ -11,7 +11,7 @@ export type SearchBarProps = {
|
|
|
11
11
|
placeholder?: string
|
|
12
12
|
/** Test identifier, put on the field's container view rather than on the `TextInput`. */
|
|
13
13
|
testID?: string
|
|
14
|
-
/** The field's text. Controlled
|
|
14
|
+
/** The field's text. Controlled: pass back what `onChangeText` reports. */
|
|
15
15
|
value: string
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -2,10 +2,10 @@ import type {ReactNode} from 'react'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A number with minus and plus buttons beside a label: SwiftUI's `Stepper` on iOS; on Android the label, the value and
|
|
5
|
-
* two icon buttons in a row. A native atom
|
|
5
|
+
* two icon buttons in a row. A native atom: it renders inside `<Screen>` or `<Island>`.
|
|
6
6
|
*/
|
|
7
7
|
export type StepperProps = {
|
|
8
|
-
/** The leading text. The value is shown too
|
|
8
|
+
/** The leading text. The value is shown too: before the control on iOS, between the buttons on Android. */
|
|
9
9
|
label: string
|
|
10
10
|
/** The highest value. When unset, Android has no upper limit and iOS stops at `100`. */
|
|
11
11
|
max?: number
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A short text tip on a native view, shown while `visible
|
|
5
|
-
* tooltip centred above them on Android. A native atom
|
|
4
|
+
* A short text tip on a native view, shown while `visible`: a SwiftUI popover from `children` on iOS, Material's plain
|
|
5
|
+
* tooltip centred above them on Android. A native atom: it renders inside `<Screen>` or `<Island>`; `RnTooltip`
|
|
6
6
|
* anchors to a React Native view.
|
|
7
7
|
*/
|
|
8
8
|
export type TooltipProps = {
|
|
9
|
-
/** The anchor
|
|
9
|
+
/** The anchor: a native view. */
|
|
10
10
|
children: ReactNode
|
|
11
11
|
/** The tip. */
|
|
12
12
|
text: string
|
|
13
|
-
/** Shows the tip while true. Controlled: nothing opens it but this
|
|
13
|
+
/** Shows the tip while true. Controlled: nothing opens it but this. Wire a long press to it if you want one. */
|
|
14
14
|
visible: boolean
|
|
15
15
|
/**
|
|
16
|
-
* The user dismissed the tip
|
|
17
|
-
* start of a scroll included, or the anchor scrolling out of the window.
|
|
16
|
+
* The user dismissed the tip, so turn `visible` off. iOS: a tap outside the popover. Android: any touch outside it,
|
|
17
|
+
* the start of a scroll included, or the anchor scrolling out of the window.
|
|
18
18
|
*/
|
|
19
19
|
onDismiss: () => void
|
|
20
20
|
}
|
|
@@ -3,13 +3,13 @@ import type {ReactNode} from 'react'
|
|
|
3
3
|
import type {MenuAction} from '../menu'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A list of actions to pick one from: SwiftUI's confirmation dialog on iOS, a `Sheet` of Material rows
|
|
7
|
-
*
|
|
6
|
+
* A list of actions to pick one from: SwiftUI's confirmation dialog on iOS, a `Sheet` of Material rows (icon and label)
|
|
7
|
+
* under the title on Android. A native atom: it renders inside `<Screen>` or `<Island>`.
|
|
8
8
|
*/
|
|
9
9
|
export type ActionSheetProps = {
|
|
10
10
|
/** The choices, top to bottom. Picking one closes the sheet. */
|
|
11
11
|
actions: MenuAction[]
|
|
12
|
-
/** The sheet closed
|
|
12
|
+
/** The sheet closed (after a pick too), so turn `visible` off. */
|
|
13
13
|
onDismiss: () => void
|
|
14
14
|
/** The heading above the actions. Android always shows it; on iOS the system decides, and may hide it. */
|
|
15
15
|
title: string
|
|
@@ -2,18 +2,18 @@ import type {ReactNode} from 'react'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A modal alert with a confirm button and Cancel: SwiftUI's alert on iOS, Material's `AlertDialog` on Android. A native
|
|
5
|
-
* atom
|
|
5
|
+
* atom: it renders inside `<Screen>` or `<Island>`.
|
|
6
6
|
*/
|
|
7
7
|
export type AlertProps = {
|
|
8
8
|
/** The confirm button's label. `OK` by default. */
|
|
9
9
|
confirmLabel?: string
|
|
10
|
-
/** Marks the confirm button destructive
|
|
10
|
+
/** Marks the confirm button destructive: the system's destructive role on iOS, the destructive colour on Android. */
|
|
11
11
|
destructive?: boolean
|
|
12
12
|
/** The body text, under the title. */
|
|
13
13
|
message?: string
|
|
14
14
|
/** The confirm button was pressed. `onDismiss` follows, as it does for every way the alert closes. */
|
|
15
15
|
onConfirm?: () => void
|
|
16
|
-
/** The alert closed
|
|
16
|
+
/** The alert closed (either button, or on Android a tap outside or back), so turn `visible` off. */
|
|
17
17
|
onDismiss: () => void
|
|
18
18
|
/** The alert's heading. */
|
|
19
19
|
title: string
|