@hzblj/kara-components 0.9.0 → 0.11.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 +72 -28
- package/README.md +8 -8
- package/lib/module/atoms/activity-indicator/activity-indicator.android.js +6 -1
- package/lib/module/atoms/activity-indicator/activity-indicator.android.js.map +1 -1
- package/lib/module/atoms/activity-indicator/activity-indicator.ios.js +2 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.ios.js.map +1 -1
- package/lib/module/atoms/avatar/avatar.js +5 -0
- package/lib/module/atoms/avatar/avatar.js.map +1 -1
- package/lib/module/atoms/button/button-tokens.js +2 -2
- package/lib/module/atoms/button/button-tokens.js.map +1 -1
- package/lib/module/atoms/button/button.android.js +6 -2
- package/lib/module/atoms/button/button.android.js.map +1 -1
- package/lib/module/atoms/button/button.ios.js +7 -2
- package/lib/module/atoms/button/button.ios.js.map +1 -1
- package/lib/module/atoms/card/card.android.js +5 -3
- package/lib/module/atoms/card/card.android.js.map +1 -1
- package/lib/module/atoms/card/card.ios.js +7 -3
- package/lib/module/atoms/card/card.ios.js.map +1 -1
- package/lib/module/atoms/checkbox/checkbox.android.js +1 -1
- package/lib/module/atoms/checkbox/checkbox.android.js.map +1 -1
- 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/fab/fab.android.js +9 -1
- package/lib/module/atoms/fab/fab.android.js.map +1 -1
- package/lib/module/atoms/fab/fab.ios.js +9 -3
- package/lib/module/atoms/fab/fab.ios.js.map +1 -1
- package/lib/module/atoms/glass-view/glass-view.android.js +1 -1
- package/lib/module/atoms/glass-view/glass-view.android.js.map +1 -1
- package/lib/module/atoms/h-stack/h-stack.ios.js +5 -3
- package/lib/module/atoms/h-stack/h-stack.ios.js.map +1 -1
- package/lib/module/atoms/icon-button/icon-button.android.js +9 -0
- package/lib/module/atoms/icon-button/icon-button.android.js.map +1 -1
- package/lib/module/atoms/icon-button/icon-button.ios.js +26 -6
- package/lib/module/atoms/icon-button/icon-button.ios.js.map +1 -1
- package/lib/module/atoms/image/image.js +4 -4
- package/lib/module/atoms/image/image.js.map +1 -1
- package/lib/module/atoms/pressable/pressable.js +52 -28
- package/lib/module/atoms/pressable/pressable.js.map +1 -1
- package/lib/module/atoms/progress/progress.android.js +7 -0
- package/lib/module/atoms/progress/progress.android.js.map +1 -1
- package/lib/module/atoms/progress/progress.ios.js +6 -1
- package/lib/module/atoms/progress/progress.ios.js.map +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.android.js +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.ios.js +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.ios.js.map +1 -1
- package/lib/module/atoms/skeleton/skeleton.js +20 -6
- package/lib/module/atoms/skeleton/skeleton.js.map +1 -1
- package/lib/module/atoms/surface/surface.android.js +5 -3
- package/lib/module/atoms/surface/surface.android.js.map +1 -1
- package/lib/module/atoms/surface/surface.ios.js +7 -3
- package/lib/module/atoms/surface/surface.ios.js.map +1 -1
- package/lib/module/atoms/switch/switch.android.js +1 -1
- package/lib/module/atoms/switch/switch.android.js.map +1 -1
- package/lib/module/atoms/text/text.android.js +5 -3
- package/lib/module/atoms/text/text.android.js.map +1 -1
- package/lib/module/atoms/text/text.ios.js +6 -4
- package/lib/module/atoms/text/text.ios.js.map +1 -1
- package/lib/module/atoms/v-stack/v-stack.ios.js +5 -3
- package/lib/module/atoms/v-stack/v-stack.ios.js.map +1 -1
- package/lib/module/atoms/z-stack/z-stack.ios.js +5 -3
- package/lib/module/atoms/z-stack/z-stack.ios.js.map +1 -1
- package/lib/module/glyph/glyph.android.js +2 -0
- package/lib/module/glyph/glyph.android.js.map +1 -1
- package/lib/module/glyph/glyph.ios.js +5 -2
- package/lib/module/glyph/glyph.ios.js.map +1 -1
- package/lib/module/molecules/collapsible/collapsible.android.js +18 -8
- package/lib/module/molecules/collapsible/collapsible.android.js.map +1 -1
- package/lib/module/molecules/labeled-content/labeled-content.js +4 -1
- package/lib/module/molecules/labeled-content/labeled-content.js.map +1 -1
- package/lib/module/molecules/link/link.js +4 -1
- package/lib/module/molecules/link/link.js.map +1 -1
- package/lib/module/molecules/list-item/list-item.js +4 -1
- package/lib/module/molecules/list-item/list-item.js.map +1 -1
- package/lib/module/molecules/navigation-bar/navigation-bar.android.js +1 -1
- package/lib/module/molecules/navigation-bar/navigation-bar.android.js.map +1 -1
- package/lib/module/molecules/navigation-bar/navigation-bar.ios.js +1 -1
- package/lib/module/molecules/navigation-bar/navigation-bar.ios.js.map +1 -1
- package/lib/module/molecules/rn-list-item/rn-list-item.js +10 -2
- package/lib/module/molecules/rn-list-item/rn-list-item.js.map +1 -1
- package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js +3 -4
- package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js.map +1 -1
- package/lib/module/molecules/stepper/stepper.ios.js +6 -2
- package/lib/module/molecules/stepper/stepper.ios.js.map +1 -1
- package/lib/module/motion.js +19 -0
- package/lib/module/motion.js.map +1 -0
- package/lib/module/organisms/fab-menu/fab-menu.android.js +8 -5
- package/lib/module/organisms/fab-menu/fab-menu.android.js.map +1 -1
- package/lib/module/organisms/fab-menu/fab-menu.ios.js +5 -2
- package/lib/module/organisms/fab-menu/fab-menu.ios.js.map +1 -1
- package/lib/module/organisms/snackbar/snackbar.js +142 -17
- package/lib/module/organisms/snackbar/snackbar.js.map +1 -1
- package/lib/module/organisms/swipe-actions/swipe-actions.android.js +1 -1
- package/lib/module/organisms/swipe-actions/swipe-actions.android.js.map +1 -1
- package/lib/module/use-stack-modifiers.js +10 -8
- package/lib/module/use-stack-modifiers.js.map +1 -1
- package/lib/typescript/atoms/activity-indicator/activity-indicator.types.d.ts +3 -1
- package/lib/typescript/atoms/avatar/avatar.types.d.ts +7 -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-tokens.d.ts +1 -1
- package/lib/typescript/atoms/button/button.types.d.ts +9 -7
- package/lib/typescript/atoms/card/card.types.d.ts +3 -3
- 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 +10 -3
- package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +5 -5
- package/lib/typescript/atoms/h-stack/h-stack.types.d.ts +8 -5
- package/lib/typescript/atoms/icon/icon.types.d.ts +4 -4
- package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +14 -3
- package/lib/typescript/atoms/image/image.d.ts +2 -2
- 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 +23 -7
- package/lib/typescript/atoms/progress/progress.types.d.ts +3 -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 -1
- package/lib/typescript/atoms/spacer/spacer.types.d.ts +1 -1
- package/lib/typescript/atoms/surface/surface.types.d.ts +3 -3
- package/lib/typescript/atoms/switch/switch.types.d.ts +1 -1
- package/lib/typescript/atoms/text/text.types.d.ts +3 -3
- package/lib/typescript/atoms/text-field/text-field.types.d.ts +4 -4
- package/lib/typescript/atoms/v-stack/v-stack.types.d.ts +4 -4
- package/lib/typescript/atoms/z-stack/z-stack.types.d.ts +4 -4
- package/lib/typescript/glyph/glyph-button.types.d.ts +1 -1
- package/lib/typescript/glyph/glyph.types.d.ts +3 -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 +6 -4
- package/lib/typescript/molecules/link/link.types.d.ts +2 -1
- package/lib/typescript/molecules/list-item/list-item.types.d.ts +6 -4
- 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.ios.d.ts +1 -1
- 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/motion.d.ts +8 -0
- 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 +10 -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 +39 -6
- 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/lib/typescript/use-stack-modifiers.d.ts +6 -5
- package/package.json +4 -4
- package/src/atoms/activity-indicator/activity-indicator.android.tsx +7 -1
- package/src/atoms/activity-indicator/activity-indicator.ios.tsx +9 -1
- package/src/atoms/activity-indicator/activity-indicator.types.ts +3 -1
- package/src/atoms/avatar/avatar.tsx +5 -1
- package/src/atoms/avatar/avatar.types.ts +7 -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-tokens.ts +2 -2
- package/src/atoms/button/button.android.tsx +5 -3
- package/src/atoms/button/button.ios.tsx +10 -2
- package/src/atoms/button/button.types.ts +9 -7
- package/src/atoms/card/card.android.tsx +6 -4
- package/src/atoms/card/card.ios.tsx +7 -3
- package/src/atoms/card/card.types.ts +9 -8
- package/src/atoms/checkbox/checkbox.android.tsx +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.android.tsx +5 -3
- package/src/atoms/fab/fab.ios.tsx +8 -4
- package/src/atoms/fab/fab.types.ts +10 -3
- package/src/atoms/glass-view/glass-view.android.tsx +1 -1
- package/src/atoms/glass-view/glass-view.types.ts +5 -5
- package/src/atoms/h-stack/h-stack.ios.tsx +6 -4
- package/src/atoms/h-stack/h-stack.types.ts +18 -14
- package/src/atoms/icon/icon.types.ts +4 -4
- package/src/atoms/icon-button/icon-button.android.tsx +16 -3
- package/src/atoms/icon-button/icon-button.ios.tsx +24 -5
- package/src/atoms/icon-button/icon-button.types.ts +14 -3
- package/src/atoms/image/image.tsx +3 -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 +50 -21
- package/src/atoms/pressable/pressable.types.ts +35 -17
- package/src/atoms/progress/progress.android.tsx +5 -3
- package/src/atoms/progress/progress.ios.tsx +5 -2
- package/src/atoms/progress/progress.types.ts +3 -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.android.tsx +1 -1
- package/src/atoms/segmented-control/segmented-control.ios.tsx +1 -1
- package/src/atoms/segmented-control/segmented-control.types.ts +3 -3
- package/src/atoms/skeleton/skeleton.tsx +18 -4
- package/src/atoms/skeleton/skeleton.types.ts +2 -1
- package/src/atoms/spacer/spacer.types.ts +1 -1
- package/src/atoms/surface/surface.android.tsx +6 -4
- package/src/atoms/surface/surface.ios.tsx +7 -3
- package/src/atoms/surface/surface.types.ts +11 -10
- package/src/atoms/switch/switch.android.tsx +1 -1
- package/src/atoms/switch/switch.types.ts +1 -1
- package/src/atoms/text/text.android.tsx +6 -4
- package/src/atoms/text/text.ios.tsx +6 -4
- package/src/atoms/text/text.types.ts +24 -23
- package/src/atoms/text-field/text-field.types.ts +4 -4
- package/src/atoms/v-stack/v-stack.ios.tsx +6 -4
- package/src/atoms/v-stack/v-stack.types.ts +18 -17
- package/src/atoms/z-stack/z-stack.ios.tsx +6 -4
- package/src/atoms/z-stack/z-stack.types.ts +16 -15
- package/src/glyph/glyph-button.types.ts +1 -1
- package/src/glyph/glyph.android.tsx +14 -2
- package/src/glyph/glyph.ios.tsx +13 -3
- package/src/glyph/glyph.types.ts +3 -1
- package/src/molecules/collapsible/collapsible.android.tsx +27 -7
- 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.tsx +12 -1
- package/src/molecules/labeled-content/labeled-content.types.ts +6 -4
- package/src/molecules/link/link.tsx +2 -1
- package/src/molecules/link/link.types.ts +2 -1
- package/src/molecules/list-item/list-item.tsx +20 -2
- package/src/molecules/list-item/list-item.types.ts +6 -4
- package/src/molecules/navigation-bar/navigation-bar.android.tsx +1 -1
- package/src/molecules/navigation-bar/navigation-bar.ios.tsx +1 -1
- 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.tsx +18 -3
- 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.android.tsx +3 -2
- 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.ios.tsx +8 -2
- package/src/molecules/stepper/stepper.types.ts +2 -2
- package/src/molecules/tooltip/tooltip.types.ts +6 -6
- package/src/motion.ts +13 -0
- 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.android.tsx +9 -5
- package/src/organisms/fab-menu/fab-menu.ios.tsx +6 -2
- package/src/organisms/fab-menu/fab-menu.types.ts +10 -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.tsx +143 -19
- package/src/organisms/snackbar/snackbar.types.ts +42 -6
- package/src/organisms/swipe-actions/swipe-actions.android.tsx +1 -1
- package/src/organisms/swipe-actions/swipe-actions.types.ts +5 -5
- package/src/templates/screen/screen.types.ts +2 -2
- package/src/use-stack-modifiers.ts +20 -7
- 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
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Text as ComposeText} from '@expo/ui/jetpack-compose'
|
|
2
2
|
import {testID as testIdModifier} from '@expo/ui/jetpack-compose/modifiers'
|
|
3
|
-
import {useSxModifiers} from '@hzblj/kara-sx'
|
|
3
|
+
import {splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
4
|
import {useAppTheme} from '@hzblj/kara-theme'
|
|
5
5
|
import {useMemo} from 'react'
|
|
6
6
|
|
|
@@ -33,15 +33,17 @@ export const Text: TextComponent = ({
|
|
|
33
33
|
testID,
|
|
34
34
|
transform,
|
|
35
35
|
variant = 'body',
|
|
36
|
-
...
|
|
36
|
+
...props
|
|
37
37
|
}: TextProps) => {
|
|
38
38
|
useHostGuard('Text')
|
|
39
39
|
const theme = useAppTheme()
|
|
40
40
|
const style = theme.typography[variant]
|
|
41
|
+
const [accessibility, sx] = splitAccessibility(props)
|
|
41
42
|
const sxModifiers = useSxModifiers(sx)
|
|
43
|
+
const accessibilityModifiers = useAccessibilityModifiers(accessibility)
|
|
42
44
|
const modifiers = useMemo(
|
|
43
|
-
() => (testID ? [
|
|
44
|
-
[sxModifiers, testID]
|
|
45
|
+
() => [...sxModifiers, ...(testID ? [testIdModifier(testID)] : []), ...accessibilityModifiers],
|
|
46
|
+
[accessibilityModifiers, sxModifiers, testID]
|
|
45
47
|
)
|
|
46
48
|
|
|
47
49
|
return (
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
underline,
|
|
11
11
|
} from '@expo/ui/swift-ui/modifiers'
|
|
12
12
|
import {scaledFont} from '@hzblj/kara-native/swift-ui'
|
|
13
|
-
import {type FrameAlignment, useSxModifiers} from '@hzblj/kara-sx'
|
|
13
|
+
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
14
14
|
import {useAppTheme} from '@hzblj/kara-theme'
|
|
15
15
|
import {useMemo} from 'react'
|
|
16
16
|
|
|
@@ -39,13 +39,15 @@ export const Text: TextComponent = ({
|
|
|
39
39
|
testID,
|
|
40
40
|
transform,
|
|
41
41
|
variant = 'body',
|
|
42
|
-
...
|
|
42
|
+
...props
|
|
43
43
|
}: TextProps) => {
|
|
44
44
|
useHostGuard('Text')
|
|
45
45
|
const theme = useAppTheme()
|
|
46
46
|
const style = theme.typography[variant]
|
|
47
47
|
// After the text's own modifiers: the font and colour belong to the glyphs, the padding and frame to the box around.
|
|
48
|
+
const [accessibility, sx] = splitAccessibility(props)
|
|
48
49
|
const sxModifiers = useSxModifiers(sx, FRAME_ALIGNMENT[align ?? 'left'])
|
|
50
|
+
const accessibilityModifiers = useAccessibilityModifiers(accessibility)
|
|
49
51
|
|
|
50
52
|
const modifiers = useMemo(() => {
|
|
51
53
|
const list: ModifierConfig[] = [
|
|
@@ -76,8 +78,8 @@ export const Text: TextComponent = ({
|
|
|
76
78
|
list.push(lineLimit(numberOfLines))
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
return [...list, ...sxModifiers]
|
|
80
|
-
}, [align, color, decoration, numberOfLines, style, sxModifiers, theme, transform])
|
|
81
|
+
return [...list, ...sxModifiers, ...accessibilityModifiers]
|
|
82
|
+
}, [accessibilityModifiers, align, color, decoration, numberOfLines, style, sxModifiers, theme, transform])
|
|
81
83
|
|
|
82
84
|
return (
|
|
83
85
|
<SwiftUIText modifiers={modifiers} testID={testID}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {ResponsiveSx} from '@hzblj/kara-sx'
|
|
1
|
+
import type {AccessibilityProps, ResponsiveSx} from '@hzblj/kara-sx'
|
|
2
2
|
import type {ColorToken, TextVariant} from '@hzblj/kara-theme'
|
|
3
3
|
import type {ReactNode} from 'react'
|
|
4
4
|
|
|
@@ -9,30 +9,31 @@ 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
|
*/
|
|
16
|
-
export type TextProps = ResponsiveSx &
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
export type TextProps = ResponsiveSx &
|
|
17
|
+
AccessibilityProps & {
|
|
18
|
+
/**
|
|
19
|
+
* How its lines align. iOS reads `left` and `right` as leading and trailing, so they flip in a right-to-left
|
|
20
|
+
* layout; Android keeps them as they are.
|
|
21
|
+
*/
|
|
22
|
+
align?: TextAlign
|
|
23
|
+
/** The text. */
|
|
24
|
+
children?: ReactNode
|
|
25
|
+
/** The text's colour. `content.primary` by default. */
|
|
26
|
+
color?: ColorToken
|
|
27
|
+
/** An underline or a strikethrough. */
|
|
28
|
+
decoration?: TextDecoration
|
|
29
|
+
/** The most lines it wraps to. iOS truncates the last with an ellipsis; Android clips it. */
|
|
30
|
+
numberOfLines?: number
|
|
31
|
+
/** Test identifier, forwarded to the native view. */
|
|
32
|
+
testID?: string
|
|
33
|
+
/** Upper- or lower-cases the text. Android applies it only when `children` is a plain string. */
|
|
34
|
+
transform?: TextTransform
|
|
35
|
+
/** The typography variant. `body` by default. */
|
|
36
|
+
variant?: TextVariant
|
|
37
|
+
}
|
|
37
38
|
|
|
38
39
|
export type TextComponent = (props: TextProps) => ReactNode
|
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {VStack as SwiftUIVStack} from '@expo/ui/swift-ui'
|
|
2
2
|
import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
|
|
3
|
-
import {type FrameAlignment, useSxModifiers} from '@hzblj/kara-sx'
|
|
3
|
+
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
4
|
import {spacing} from '@hzblj/kara-theme'
|
|
5
5
|
import {useMemo} from 'react'
|
|
6
6
|
import {useHostGuard} from '../../host-context'
|
|
@@ -18,13 +18,15 @@ export const VStack: VStackComponent = ({
|
|
|
18
18
|
onPress,
|
|
19
19
|
spacing: gap,
|
|
20
20
|
testID,
|
|
21
|
-
...
|
|
21
|
+
...props
|
|
22
22
|
}: VStackProps) => {
|
|
23
23
|
useHostGuard('VStack')
|
|
24
|
+
const [accessibility, sx] = splitAccessibility(props)
|
|
24
25
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align])
|
|
26
|
+
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
|
|
25
27
|
const modifiers = useMemo(
|
|
26
|
-
() => (onPress ? [
|
|
27
|
-
[onPress, sxModifiers]
|
|
28
|
+
() => [...sxModifiers, ...(onPress ? [onTapGesture(onPress)] : []), ...accessibilityModifiers],
|
|
29
|
+
[accessibilityModifiers, onPress, sxModifiers]
|
|
28
30
|
)
|
|
29
31
|
|
|
30
32
|
return (
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import type {ResponsiveSx} from '@hzblj/kara-sx'
|
|
1
|
+
import type {AccessibilityProps, ResponsiveSx} from '@hzblj/kara-sx'
|
|
2
2
|
import type {SpaceSize} from '@hzblj/kara-theme'
|
|
3
3
|
import type {ReactNode} from 'react'
|
|
4
4
|
|
|
5
5
|
export type VStackAlign = 'center' | 'end' | 'start'
|
|
6
6
|
|
|
7
|
-
/** Stacks its children top to bottom
|
|
8
|
-
export type VStackProps = ResponsiveSx &
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
/** Stacks its children top to bottom: SwiftUI `VStack` / Compose `Column`. */
|
|
8
|
+
export type VStackProps = ResponsiveSx &
|
|
9
|
+
AccessibilityProps & {
|
|
10
|
+
/** The children's horizontal alignment. `start` by default. */
|
|
11
|
+
align?: VStackAlign
|
|
12
|
+
/** Laid out top to bottom, `spacing` apart. */
|
|
13
|
+
children?: ReactNode
|
|
14
|
+
/**
|
|
15
|
+
* Makes the whole stack pressable. iOS adds a tap gesture with no press feedback; Android a `clickable` whose ripple
|
|
16
|
+
* fills the stack's shape. Screen readers then read the stack as one button.
|
|
17
|
+
*/
|
|
18
|
+
onPress?: () => void
|
|
19
|
+
/** The space between children. */
|
|
20
|
+
spacing?: SpaceSize
|
|
21
|
+
/** Test identifier, forwarded to the native view. */
|
|
22
|
+
testID?: string
|
|
23
|
+
}
|
|
23
24
|
|
|
24
25
|
export type VStackComponent = (props: VStackProps) => ReactNode
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ZStack as SwiftUIZStack} from '@expo/ui/swift-ui'
|
|
2
2
|
import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
|
|
3
|
-
import {type FrameAlignment, useSxModifiers} from '@hzblj/kara-sx'
|
|
3
|
+
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
4
|
import {useMemo} from 'react'
|
|
5
5
|
import {useHostGuard} from '../../host-context'
|
|
6
6
|
import type {ZStackAlign, ZStackComponent, ZStackProps} from './z-stack.types'
|
|
@@ -11,12 +11,14 @@ const ALIGNMENT = {
|
|
|
11
11
|
top: 'top',
|
|
12
12
|
} as const satisfies Record<ZStackAlign, FrameAlignment>
|
|
13
13
|
|
|
14
|
-
export const ZStack: ZStackComponent = ({align = 'center', children, onPress, testID, ...
|
|
14
|
+
export const ZStack: ZStackComponent = ({align = 'center', children, onPress, testID, ...props}: ZStackProps) => {
|
|
15
15
|
useHostGuard('ZStack')
|
|
16
|
+
const [accessibility, sx] = splitAccessibility(props)
|
|
16
17
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align])
|
|
18
|
+
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
|
|
17
19
|
const modifiers = useMemo(
|
|
18
|
-
() => (onPress ? [
|
|
19
|
-
[onPress, sxModifiers]
|
|
20
|
+
() => [...sxModifiers, ...(onPress ? [onTapGesture(onPress)] : []), ...accessibilityModifiers],
|
|
21
|
+
[accessibilityModifiers, onPress, sxModifiers]
|
|
20
22
|
)
|
|
21
23
|
|
|
22
24
|
return (
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import type {ResponsiveSx} from '@hzblj/kara-sx'
|
|
1
|
+
import type {AccessibilityProps, ResponsiveSx} from '@hzblj/kara-sx'
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
|
|
4
4
|
export type ZStackAlign = 'bottom' | 'center' | 'top'
|
|
5
5
|
|
|
6
|
-
/** Layers its children on one another
|
|
7
|
-
export type ZStackProps = ResponsiveSx &
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
/** Layers its children on one another: SwiftUI `ZStack` / Compose `Box`. */
|
|
7
|
+
export type ZStackProps = ResponsiveSx &
|
|
8
|
+
AccessibilityProps & {
|
|
9
|
+
/** Where the children sit vertically; they are always centred horizontally. `center` by default. */
|
|
10
|
+
align?: ZStackAlign
|
|
11
|
+
/** Drawn in order, the last on top. */
|
|
12
|
+
children?: ReactNode
|
|
13
|
+
/**
|
|
14
|
+
* Makes the whole stack pressable. iOS adds a tap gesture with no press feedback; Android a `clickable` whose ripple
|
|
15
|
+
* fills the stack's shape. Screen readers then read the stack as one button.
|
|
16
|
+
*/
|
|
17
|
+
onPress?: () => void
|
|
18
|
+
/** Test identifier, forwarded to the native view. */
|
|
19
|
+
testID?: string
|
|
20
|
+
}
|
|
20
21
|
|
|
21
22
|
export type ZStackComponent = (props: ZStackProps) => ReactNode
|
|
@@ -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
|
|
@@ -5,8 +5,20 @@ import {spacing, useAppTheme} from '@hzblj/kara-theme'
|
|
|
5
5
|
import type {GlyphComponent, GlyphProps} from './glyph.types'
|
|
6
6
|
|
|
7
7
|
/** The Material Symbol `@hzblj/kara-native` ships as a drawable — inside a Compose host. */
|
|
8
|
-
export const Glyph: GlyphComponent = ({
|
|
8
|
+
export const Glyph: GlyphComponent = ({
|
|
9
|
+
accessibilityLabel,
|
|
10
|
+
color = 'content.primary',
|
|
11
|
+
name,
|
|
12
|
+
size = 's24',
|
|
13
|
+
}: GlyphProps) => {
|
|
9
14
|
const theme = useAppTheme()
|
|
10
15
|
|
|
11
|
-
return
|
|
16
|
+
return (
|
|
17
|
+
<DrawableIcon
|
|
18
|
+
accessibilityLabel={accessibilityLabel}
|
|
19
|
+
iconColor={theme.color(color)}
|
|
20
|
+
iconSize={spacing[size]}
|
|
21
|
+
resourceName={GLYPHS[name].android}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
12
24
|
}
|
package/src/glyph/glyph.ios.tsx
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import {Image} from '@expo/ui/swift-ui'
|
|
2
|
-
import {accessibilityHidden} from '@expo/ui/swift-ui/modifiers'
|
|
2
|
+
import {accessibilityHidden, accessibilityLabel as labelModifier} from '@expo/ui/swift-ui/modifiers'
|
|
3
3
|
import {GLYPHS} from '@hzblj/kara-native'
|
|
4
4
|
import {spacing, useAppTheme} from '@hzblj/kara-theme'
|
|
5
|
+
import {useMemo} from 'react'
|
|
5
6
|
|
|
6
7
|
import type {GlyphComponent, GlyphProps} from './glyph.types'
|
|
7
8
|
|
|
8
9
|
const DECORATIVE = [accessibilityHidden(true)]
|
|
9
10
|
|
|
10
11
|
/** The SF Symbol the system already has — inside a SwiftUI host. */
|
|
11
|
-
export const Glyph: GlyphComponent = ({
|
|
12
|
+
export const Glyph: GlyphComponent = ({
|
|
13
|
+
accessibilityLabel,
|
|
14
|
+
color = 'content.primary',
|
|
15
|
+
name,
|
|
16
|
+
size = 's24',
|
|
17
|
+
}: GlyphProps) => {
|
|
12
18
|
const theme = useAppTheme()
|
|
19
|
+
const modifiers = useMemo(
|
|
20
|
+
() => (accessibilityLabel ? [labelModifier(accessibilityLabel)] : DECORATIVE),
|
|
21
|
+
[accessibilityLabel]
|
|
22
|
+
)
|
|
13
23
|
|
|
14
|
-
return <Image color={theme.color(color)} modifiers={
|
|
24
|
+
return <Image color={theme.color(color)} modifiers={modifiers} size={spacing[size]} systemName={GLYPHS[name].ios} />
|
|
15
25
|
}
|
package/src/glyph/glyph.types.ts
CHANGED
|
@@ -3,10 +3,12 @@ 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 = {
|
|
10
|
+
/** What a screen reader says. Unset, the glyph is decorative and hidden from it. */
|
|
11
|
+
accessibilityLabel?: string
|
|
10
12
|
color?: ColorToken
|
|
11
13
|
name: GlyphName
|
|
12
14
|
size?: SpaceSize
|
|
@@ -15,19 +15,25 @@ import {
|
|
|
15
15
|
graphicsLayer,
|
|
16
16
|
tween,
|
|
17
17
|
} from '@expo/ui/jetpack-compose/modifiers'
|
|
18
|
-
import {
|
|
18
|
+
import {useAccessibilityModifiers} from '@hzblj/kara-sx'
|
|
19
|
+
import {duration, useAppTheme, useReducedMotion} from '@hzblj/kara-theme'
|
|
19
20
|
import {useMemo} from 'react'
|
|
20
21
|
import {Glyph} from '../../glyph'
|
|
21
22
|
import {useHostGuard} from '../../host-context'
|
|
22
23
|
import type {CollapsibleComponent, CollapsibleProps} from './collapsible.types'
|
|
23
24
|
|
|
24
|
-
/** Material's standard easing, at the length a
|
|
25
|
-
const TURN = tween({durationMillis: duration.
|
|
25
|
+
/** Material's standard easing, at the length a chevron turning takes. */
|
|
26
|
+
const TURN = tween({durationMillis: duration.fast, easing: 'fastOutSlowIn'})
|
|
27
|
+
const SNAP = tween({durationMillis: duration.none})
|
|
26
28
|
|
|
27
29
|
/** Down from the row, fading in — Compose's default grows from a corner, sideways as well as down. */
|
|
28
30
|
const ENTER = EnterTransition.expandVertically().plus(EnterTransition.fadeIn())
|
|
29
31
|
const EXIT = ExitTransition.shrinkVertically().plus(ExitTransition.fadeOut())
|
|
30
32
|
|
|
33
|
+
/** With motion reduced (Compose follows the device's own setting, this `KaraProvider reduceMotion`): no growing. */
|
|
34
|
+
const FADE_IN = EnterTransition.fadeIn()
|
|
35
|
+
const FADE_OUT = ExitTransition.fadeOut()
|
|
36
|
+
|
|
31
37
|
const WIDE = [fillMaxWidth()]
|
|
32
38
|
|
|
33
39
|
/** Material's least touch target. */
|
|
@@ -41,11 +47,21 @@ const ROW_HEIGHT = 48
|
|
|
41
47
|
export const Collapsible: CollapsibleComponent = ({children, expanded, label, onExpandedChange}: CollapsibleProps) => {
|
|
42
48
|
useHostGuard('Collapsible')
|
|
43
49
|
const theme = useAppTheme()
|
|
50
|
+
const reduced = useReducedMotion()
|
|
51
|
+
const accessibilityModifiers = useAccessibilityModifiers({}, true)
|
|
44
52
|
const modifiers = useMemo(
|
|
45
|
-
() => [
|
|
46
|
-
|
|
53
|
+
() => [
|
|
54
|
+
fillMaxWidth(),
|
|
55
|
+
defaultMinSize({minHeight: ROW_HEIGHT}),
|
|
56
|
+
clickable(() => onExpandedChange(!expanded)),
|
|
57
|
+
...accessibilityModifiers,
|
|
58
|
+
],
|
|
59
|
+
[accessibilityModifiers, expanded, onExpandedChange]
|
|
60
|
+
)
|
|
61
|
+
const turn = useMemo(
|
|
62
|
+
() => [graphicsLayer({rotationZ: animated(expanded ? 90 : 0, reduced ? SNAP : TURN)})],
|
|
63
|
+
[expanded, reduced]
|
|
47
64
|
)
|
|
48
|
-
const turn = useMemo(() => [graphicsLayer({rotationZ: animated(expanded ? 90 : 0, TURN)})], [expanded])
|
|
49
65
|
|
|
50
66
|
return (
|
|
51
67
|
<Column modifiers={WIDE}>
|
|
@@ -57,7 +73,11 @@ export const Collapsible: CollapsibleComponent = ({children, expanded, label, on
|
|
|
57
73
|
<Glyph name="chevronRight" size="s20" />
|
|
58
74
|
</Box>
|
|
59
75
|
</Row>
|
|
60
|
-
<AnimatedVisibility
|
|
76
|
+
<AnimatedVisibility
|
|
77
|
+
enterTransition={reduced ? FADE_IN : ENTER}
|
|
78
|
+
exitTransition={reduced ? FADE_OUT : EXIT}
|
|
79
|
+
visible={expanded}
|
|
80
|
+
>
|
|
61
81
|
{children}
|
|
62
82
|
</AnimatedVisibility>
|
|
63
83
|
</Column>
|
|
@@ -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 = {
|
|
@@ -19,8 +19,19 @@ export const LabeledContent: LabeledContentComponent = ({
|
|
|
19
19
|
px,
|
|
20
20
|
testID,
|
|
21
21
|
value,
|
|
22
|
+
...accessibility
|
|
22
23
|
}: LabeledContentProps) => (
|
|
23
|
-
<HStack
|
|
24
|
+
<HStack
|
|
25
|
+
accessible={children === undefined}
|
|
26
|
+
{...accessibility}
|
|
27
|
+
align="center"
|
|
28
|
+
onPress={onPress}
|
|
29
|
+
px={px}
|
|
30
|
+
py="s8"
|
|
31
|
+
spacing="s12"
|
|
32
|
+
testID={testID}
|
|
33
|
+
wide
|
|
34
|
+
>
|
|
24
35
|
{icon ? <Icon color="content.secondary" name={icon} size="s20" /> : null}
|
|
25
36
|
<Text variant="body">{label}</Text>
|
|
26
37
|
<Spacer />
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import type {AccessibilityProps} from '@hzblj/kara-sx'
|
|
1
2
|
import type {SpaceSize} from '@hzblj/kara-theme'
|
|
2
3
|
import type {ReactNode} from 'react'
|
|
3
4
|
import type {IconName} from '../../atoms/icon'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
* A label on the leading edge and its value on the trailing edge
|
|
7
|
-
* Pass `children` instead of `value` when the trailing side is a control rather than text.
|
|
7
|
+
* A label on the leading edge and its value on the trailing edge: the settings/detail row.
|
|
8
|
+
* Pass `children` instead of `value` when the trailing side is a control rather than text. With a `value`, screen
|
|
9
|
+
* readers read the row as one element ("Version, 2.4"); with a control, the control stays its own.
|
|
8
10
|
*/
|
|
9
|
-
export type LabeledContentProps = {
|
|
11
|
+
export type LabeledContentProps = AccessibilityProps & {
|
|
10
12
|
/** The trailing side when it is a control, in place of `value`. */
|
|
11
13
|
children?: ReactNode
|
|
12
14
|
/** One of the app's icons, before the label, in the secondary colour. */
|
|
@@ -15,7 +17,7 @@ export type LabeledContentProps = {
|
|
|
15
17
|
label: string
|
|
16
18
|
/** Makes the row pressable and adds a chevron on the trailing edge. */
|
|
17
19
|
onPress?: () => void
|
|
18
|
-
/** Horizontal padding inside the row
|
|
20
|
+
/** Horizontal padding inside the row, and inside its press area too, so Android's ripple reaches the card's edges. */
|
|
19
21
|
px?: SpaceSize
|
|
20
22
|
/** Test identifier, forwarded to the native view. */
|
|
21
23
|
testID?: string
|
|
@@ -12,13 +12,14 @@ export const Link: LinkComponent = ({
|
|
|
12
12
|
testID,
|
|
13
13
|
url,
|
|
14
14
|
variant = 'body',
|
|
15
|
+
...accessibility
|
|
15
16
|
}: LinkProps) => {
|
|
16
17
|
const open = () => {
|
|
17
18
|
Linking.openURL(url).catch(() => undefined)
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
return (
|
|
21
|
-
<HStack align="center" onPress={open} spacing="s8" testID={testID}>
|
|
22
|
+
<HStack accessibilityRole="link" {...accessibility} align="center" onPress={open} spacing="s8" testID={testID}>
|
|
22
23
|
{icon ? <Icon color={color} name={icon} size="s20" /> : null}
|
|
23
24
|
<Text color={color} variant={variant}>
|
|
24
25
|
{label}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type {AccessibilityProps} from '@hzblj/kara-sx'
|
|
1
2
|
import type {ColorToken, TextVariant} from '@hzblj/kara-theme'
|
|
2
3
|
import type {ReactNode} from 'react'
|
|
3
4
|
|
|
4
5
|
import type {IconName} from '../../atoms/icon'
|
|
5
6
|
|
|
6
7
|
/** Opens an external URL in the platform browser or the app that claims the scheme. */
|
|
7
|
-
export type LinkProps = {
|
|
8
|
+
export type LinkProps = AccessibilityProps & {
|
|
8
9
|
/** Colours the label and the icon. `content.accent` by default. */
|
|
9
10
|
color?: ColorToken
|
|
10
11
|
/** One of the app's icons, before the label. */
|
|
@@ -14,8 +14,26 @@ import type {ListItemComponent, ListItemProps} from './list-item.types'
|
|
|
14
14
|
*/
|
|
15
15
|
const TEXT_FILLS_ROW = {weight: 1}
|
|
16
16
|
|
|
17
|
-
export const ListItem: ListItemComponent = ({
|
|
18
|
-
|
|
17
|
+
export const ListItem: ListItemComponent = ({
|
|
18
|
+
icon,
|
|
19
|
+
onPress,
|
|
20
|
+
px,
|
|
21
|
+
subtitle,
|
|
22
|
+
testID,
|
|
23
|
+
title,
|
|
24
|
+
...accessibility
|
|
25
|
+
}: ListItemProps) => (
|
|
26
|
+
<HStack
|
|
27
|
+
accessible
|
|
28
|
+
{...accessibility}
|
|
29
|
+
align="center"
|
|
30
|
+
onPress={onPress}
|
|
31
|
+
px={px}
|
|
32
|
+
py="s8"
|
|
33
|
+
spacing="s12"
|
|
34
|
+
testID={testID}
|
|
35
|
+
wide
|
|
36
|
+
>
|
|
19
37
|
{icon ? <Icon color="content.secondary" name={icon} size="s20" /> : null}
|
|
20
38
|
<VStack android={TEXT_FILLS_ROW} spacing="s2">
|
|
21
39
|
<Text variant="body">{title}</Text>
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
import type {AccessibilityProps} from '@hzblj/kara-sx'
|
|
1
2
|
import type {SpaceSize} from '@hzblj/kara-theme'
|
|
2
3
|
import type {ReactNode} from 'react'
|
|
3
4
|
|
|
4
5
|
import type {IconName} from '../../atoms/icon'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
* A row with an optional icon, a title and subtitle, and a chevron when it can be pressed.
|
|
8
|
-
* inside `<Screen>` or `<Island>`; `RnListItem` is
|
|
8
|
+
* A row with an optional icon, a title and subtitle, and a chevron when it can be pressed. Screen readers read it as one
|
|
9
|
+
* element (a button when it is pressable). A native atom: it renders inside `<Screen>` or `<Island>`; `RnListItem` is
|
|
10
|
+
* the same row without a host.
|
|
9
11
|
*/
|
|
10
|
-
export type ListItemProps = {
|
|
12
|
+
export type ListItemProps = AccessibilityProps & {
|
|
11
13
|
/** One of the app's icons, before the title, in the secondary colour. */
|
|
12
14
|
icon?: IconName
|
|
13
15
|
/** Makes the row pressable and adds a chevron on the trailing edge. */
|
|
14
16
|
onPress?: () => void
|
|
15
17
|
/**
|
|
16
|
-
* 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. For
|
|
17
19
|
* rows in a card of your own; a `List` insets its rows by itself.
|
|
18
20
|
*/
|
|
19
21
|
px?: SpaceSize
|
|
@@ -27,7 +27,7 @@ export const NavigationBar: NavigationBarComponent = ({
|
|
|
27
27
|
}: NavigationBarProps) => {
|
|
28
28
|
const theme = useAppTheme()
|
|
29
29
|
const font = theme.typography.headline
|
|
30
|
-
const color = theme.color(inverted ? 'content.on.
|
|
30
|
+
const color = theme.color(inverted ? 'content.on.accent' : 'content.primary')
|
|
31
31
|
|
|
32
32
|
const nativeLeadingItems = useMemo(() => leadingItems?.map(toNativeItem), [leadingItems])
|
|
33
33
|
const nativeTrailingItems = useMemo(() => trailingItems?.map(toNativeItem), [trailingItems])
|
|
@@ -38,7 +38,7 @@ export const NavigationBar: NavigationBarComponent = ({
|
|
|
38
38
|
const theme = useAppTheme()
|
|
39
39
|
const barRef = useRef<NavigationBarRef>(null)
|
|
40
40
|
const font = theme.typography.headline
|
|
41
|
-
const color = theme.color(inverted ? 'content.on.
|
|
41
|
+
const color = theme.color(inverted ? 'content.on.accent' : 'content.primary')
|
|
42
42
|
|
|
43
43
|
useImperativeHandle(
|
|
44
44
|
search?.ref,
|