@hzblj/kara-components 0.17.0 → 0.19.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 +62 -0
- package/lib/module/atoms/badge/badge.android.js +5 -0
- package/lib/module/atoms/badge/badge.android.js.map +1 -1
- package/lib/module/atoms/badge/badge.ios.js +2 -0
- package/lib/module/atoms/badge/badge.ios.js.map +1 -1
- package/lib/module/atoms/button/button-tokens.js +8 -0
- package/lib/module/atoms/button/button-tokens.js.map +1 -1
- package/lib/module/atoms/button/button.android.js +43 -15
- package/lib/module/atoms/button/button.android.js.map +1 -1
- package/lib/module/atoms/button/button.ios.js +66 -10
- package/lib/module/atoms/button/button.ios.js.map +1 -1
- package/lib/module/atoms/checkbox/checkbox.android.js +5 -1
- package/lib/module/atoms/checkbox/checkbox.android.js.map +1 -1
- package/lib/module/atoms/checkbox/checkbox.ios.js +3 -1
- package/lib/module/atoms/checkbox/checkbox.ios.js.map +1 -1
- package/lib/module/atoms/color-picker/color-picker.android.js +4 -0
- package/lib/module/atoms/color-picker/color-picker.android.js.map +1 -1
- package/lib/module/atoms/color-picker/color-picker.ios.js +24 -2
- package/lib/module/atoms/color-picker/color-picker.ios.js.map +1 -1
- package/lib/module/atoms/date-picker/date-picker.android.js +85 -10
- package/lib/module/atoms/date-picker/date-picker.android.js.map +1 -1
- package/lib/module/atoms/date-picker/date-picker.ios.js +9 -7
- package/lib/module/atoms/date-picker/date-picker.ios.js.map +1 -1
- package/lib/module/atoms/divider/divider.android.js +17 -4
- package/lib/module/atoms/divider/divider.android.js.map +1 -1
- package/lib/module/atoms/divider/divider.ios.js +4 -0
- package/lib/module/atoms/divider/divider.ios.js.map +1 -1
- package/lib/module/atoms/fab/fab.android.js +64 -8
- package/lib/module/atoms/fab/fab.android.js.map +1 -1
- package/lib/module/atoms/fab/fab.ios.js +68 -12
- package/lib/module/atoms/fab/fab.ios.js.map +1 -1
- package/lib/module/atoms/icon-button/icon-button.android.js +48 -5
- package/lib/module/atoms/icon-button/icon-button.android.js.map +1 -1
- package/lib/module/atoms/icon-button/icon-button.ios.js +60 -10
- package/lib/module/atoms/icon-button/icon-button.ios.js.map +1 -1
- package/lib/module/atoms/list/list.android.js +32 -4
- package/lib/module/atoms/list/list.android.js.map +1 -1
- package/lib/module/atoms/list/list.ios.js +15 -5
- package/lib/module/atoms/list/list.ios.js.map +1 -1
- package/lib/module/atoms/progress/progress.android.js +21 -7
- package/lib/module/atoms/progress/progress.android.js.map +1 -1
- package/lib/module/atoms/progress/progress.ios.js +5 -1
- package/lib/module/atoms/progress/progress.ios.js.map +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.android.js +66 -12
- package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.ios.js +19 -8
- package/lib/module/atoms/segmented-control/segmented-control.ios.js.map +1 -1
- package/lib/module/atoms/segmented-control/segments.js +16 -0
- package/lib/module/atoms/segmented-control/segments.js.map +1 -0
- package/lib/module/atoms/slider/slider.android.js +16 -2
- package/lib/module/atoms/slider/slider.android.js.map +1 -1
- package/lib/module/atoms/slider/slider.ios.js +22 -2
- package/lib/module/atoms/slider/slider.ios.js.map +1 -1
- package/lib/module/atoms/switch/switch.android.js +5 -1
- package/lib/module/atoms/switch/switch.android.js.map +1 -1
- package/lib/module/atoms/switch/switch.ios.js +3 -1
- package/lib/module/atoms/switch/switch.ios.js.map +1 -1
- package/lib/module/atoms/text/spans.js +2 -1
- package/lib/module/atoms/text/spans.js.map +1 -1
- package/lib/module/atoms/text/text.android.js +18 -6
- package/lib/module/atoms/text/text.android.js.map +1 -1
- package/lib/module/atoms/text/text.ios.js +6 -2
- package/lib/module/atoms/text/text.ios.js.map +1 -1
- package/lib/module/atoms/text-field/text-field-input.js +14 -0
- package/lib/module/atoms/text-field/text-field-input.js.map +1 -0
- package/lib/module/atoms/text-field/text-field.android.js +113 -6
- package/lib/module/atoms/text-field/text-field.android.js.map +1 -1
- package/lib/module/atoms/text-field/text-field.ios.js +75 -3
- package/lib/module/atoms/text-field/text-field.ios.js.map +1 -1
- package/lib/module/molecules/collapsible/collapsible.android.js +4 -3
- package/lib/module/molecules/collapsible/collapsible.android.js.map +1 -1
- package/lib/module/molecules/collapsible/collapsible.ios.js +3 -1
- package/lib/module/molecules/collapsible/collapsible.ios.js.map +1 -1
- package/lib/module/molecules/radio-group/radio-group.android.js +10 -2
- package/lib/module/molecules/radio-group/radio-group.android.js.map +1 -1
- package/lib/module/molecules/radio-group/radio-group.ios.js +6 -2
- package/lib/module/molecules/radio-group/radio-group.ios.js.map +1 -1
- package/lib/module/molecules/search-bar/search-bar.js +9 -0
- package/lib/module/molecules/search-bar/search-bar.js.map +1 -1
- package/lib/module/molecules/stepper/stepper.android.js +25 -13
- package/lib/module/molecules/stepper/stepper.android.js.map +1 -1
- package/lib/module/molecules/stepper/stepper.ios.js +12 -6
- package/lib/module/molecules/stepper/stepper.ios.js.map +1 -1
- package/lib/module/organisms/action-sheet/action-sheet.android.js +16 -8
- package/lib/module/organisms/action-sheet/action-sheet.android.js.map +1 -1
- package/lib/module/organisms/action-sheet/action-sheet.ios.js +16 -3
- package/lib/module/organisms/action-sheet/action-sheet.ios.js.map +1 -1
- package/lib/module/organisms/alert/alert.android.js +4 -3
- package/lib/module/organisms/alert/alert.android.js.map +1 -1
- package/lib/module/organisms/alert/alert.ios.js +3 -2
- package/lib/module/organisms/alert/alert.ios.js.map +1 -1
- package/lib/module/organisms/context-menu/context-menu.android.js +3 -1
- package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
- package/lib/module/organisms/context-menu/context-menu.ios.js +1 -0
- package/lib/module/organisms/context-menu/context-menu.ios.js.map +1 -1
- package/lib/module/organisms/fab-menu/fab-menu.android.js +3 -0
- package/lib/module/organisms/fab-menu/fab-menu.android.js.map +1 -1
- package/lib/module/organisms/fab-menu/fab-menu.ios.js +3 -0
- package/lib/module/organisms/fab-menu/fab-menu.ios.js.map +1 -1
- package/lib/module/organisms/menu/menu-parts.js +20 -0
- package/lib/module/organisms/menu/menu-parts.js.map +1 -0
- package/lib/module/organisms/menu/menu.android.js +51 -19
- package/lib/module/organisms/menu/menu.android.js.map +1 -1
- package/lib/module/organisms/menu/menu.ios.js +71 -8
- package/lib/module/organisms/menu/menu.ios.js.map +1 -1
- package/lib/module/organisms/sheet/sheet.js +2 -1
- package/lib/module/organisms/sheet/sheet.js.map +1 -1
- package/lib/typescript/atoms/badge/badge.types.d.ts +2 -0
- package/lib/typescript/atoms/button/button-tokens.d.ts +6 -2
- package/lib/typescript/atoms/button/button.types.d.ts +19 -5
- package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +2 -0
- package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +2 -0
- package/lib/typescript/atoms/date-picker/date-picker.ios.d.ts +5 -5
- package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +30 -7
- package/lib/typescript/atoms/divider/divider.ios.d.ts +4 -0
- package/lib/typescript/atoms/divider/divider.types.d.ts +13 -2
- package/lib/typescript/atoms/fab/fab.types.d.ts +21 -4
- package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +23 -4
- package/lib/typescript/atoms/list/list.types.d.ts +15 -1
- package/lib/typescript/atoms/progress/progress.types.d.ts +13 -2
- package/lib/typescript/atoms/segmented-control/segmented-control.ios.d.ts +3 -1
- package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +26 -3
- package/lib/typescript/atoms/segmented-control/segments.d.ts +6 -0
- package/lib/typescript/atoms/slider/slider.ios.d.ts +4 -0
- package/lib/typescript/atoms/slider/slider.types.d.ts +7 -0
- package/lib/typescript/atoms/switch/switch.types.d.ts +2 -0
- package/lib/typescript/atoms/text/spans.d.ts +2 -0
- package/lib/typescript/atoms/text/text.types.d.ts +9 -1
- package/lib/typescript/atoms/text-field/text-field-input.d.ts +7 -0
- package/lib/typescript/atoms/text-field/text-field.types.d.ts +77 -4
- package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +2 -0
- package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +4 -0
- package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +11 -1
- package/lib/typescript/molecules/stepper/stepper.ios.d.ts +2 -1
- package/lib/typescript/molecules/stepper/stepper.types.d.ts +17 -0
- package/lib/typescript/organisms/action-sheet/action-sheet.ios.d.ts +4 -0
- package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +8 -3
- package/lib/typescript/organisms/alert/alert.types.d.ts +8 -3
- package/lib/typescript/organisms/menu/menu-parts.d.ts +14 -0
- package/lib/typescript/organisms/menu/menu.types.d.ts +35 -7
- package/lib/typescript/organisms/sheet/sheet.types.d.ts +7 -1
- package/package.json +4 -4
- package/src/atoms/badge/badge.android.tsx +9 -2
- package/src/atoms/badge/badge.ios.tsx +2 -2
- package/src/atoms/badge/badge.types.ts +2 -0
- package/src/atoms/button/button-tokens.ts +6 -3
- package/src/atoms/button/button.android.tsx +35 -11
- package/src/atoms/button/button.ios.tsx +72 -8
- package/src/atoms/button/button.types.ts +20 -5
- package/src/atoms/checkbox/checkbox.android.tsx +5 -2
- package/src/atoms/checkbox/checkbox.ios.tsx +2 -2
- package/src/atoms/checkbox/checkbox.types.ts +2 -0
- package/src/atoms/color-picker/color-picker.android.tsx +10 -2
- package/src/atoms/color-picker/color-picker.ios.tsx +24 -1
- package/src/atoms/color-picker/color-picker.types.ts +2 -0
- package/src/atoms/date-picker/date-picker.android.tsx +86 -16
- package/src/atoms/date-picker/date-picker.ios.tsx +20 -8
- package/src/atoms/date-picker/date-picker.types.ts +31 -7
- package/src/atoms/divider/divider.android.tsx +14 -3
- package/src/atoms/divider/divider.ios.tsx +4 -0
- package/src/atoms/divider/divider.types.ts +14 -2
- package/src/atoms/fab/fab.android.tsx +61 -11
- package/src/atoms/fab/fab.ios.tsx +48 -13
- package/src/atoms/fab/fab.types.ts +22 -4
- package/src/atoms/icon-button/icon-button.android.tsx +60 -10
- package/src/atoms/icon-button/icon-button.ios.tsx +77 -8
- package/src/atoms/icon-button/icon-button.types.ts +24 -4
- package/src/atoms/list/list.android.tsx +26 -4
- package/src/atoms/list/list.ios.tsx +20 -5
- package/src/atoms/list/list.types.ts +16 -1
- package/src/atoms/progress/progress.android.tsx +32 -6
- package/src/atoms/progress/progress.ios.tsx +11 -5
- package/src/atoms/progress/progress.types.ts +13 -2
- package/src/atoms/segmented-control/segmented-control.android.tsx +69 -10
- package/src/atoms/segmented-control/segmented-control.ios.tsx +24 -5
- package/src/atoms/segmented-control/segmented-control.types.ts +28 -3
- package/src/atoms/segmented-control/segments.ts +16 -0
- package/src/atoms/slider/slider.android.tsx +18 -2
- package/src/atoms/slider/slider.ios.tsx +38 -2
- package/src/atoms/slider/slider.types.ts +7 -0
- package/src/atoms/switch/switch.android.tsx +5 -2
- package/src/atoms/switch/switch.ios.tsx +2 -2
- package/src/atoms/switch/switch.types.ts +2 -0
- package/src/atoms/text/spans.ts +2 -1
- package/src/atoms/text/text.android.tsx +20 -7
- package/src/atoms/text/text.ios.tsx +7 -0
- package/src/atoms/text/text.types.ts +10 -1
- package/src/atoms/text-field/text-field-input.ts +17 -0
- package/src/atoms/text-field/text-field.android.tsx +132 -9
- package/src/atoms/text-field/text-field.ios.tsx +110 -6
- package/src/atoms/text-field/text-field.types.ts +98 -4
- package/src/molecules/collapsible/collapsible.android.tsx +10 -2
- package/src/molecules/collapsible/collapsible.ios.tsx +8 -2
- package/src/molecules/collapsible/collapsible.types.ts +2 -0
- package/src/molecules/radio-group/radio-group.android.tsx +18 -4
- package/src/molecules/radio-group/radio-group.ios.tsx +19 -5
- package/src/molecules/radio-group/radio-group.types.ts +4 -0
- package/src/molecules/search-bar/search-bar.tsx +9 -0
- package/src/molecules/search-bar/search-bar.types.ts +12 -1
- package/src/molecules/stepper/stepper.android.tsx +24 -4
- package/src/molecules/stepper/stepper.ios.tsx +23 -8
- package/src/molecules/stepper/stepper.types.ts +17 -0
- package/src/organisms/action-sheet/action-sheet.android.tsx +23 -11
- package/src/organisms/action-sheet/action-sheet.ios.tsx +20 -3
- package/src/organisms/action-sheet/action-sheet.types.ts +8 -3
- package/src/organisms/alert/alert.android.tsx +11 -8
- package/src/organisms/alert/alert.ios.tsx +2 -1
- package/src/organisms/alert/alert.types.ts +8 -3
- package/src/organisms/context-menu/context-menu.android.tsx +3 -2
- package/src/organisms/context-menu/context-menu.ios.tsx +1 -0
- package/src/organisms/fab-menu/fab-menu.android.tsx +3 -0
- package/src/organisms/fab-menu/fab-menu.ios.tsx +9 -1
- package/src/organisms/menu/menu-parts.ts +21 -0
- package/src/organisms/menu/menu.android.tsx +39 -10
- package/src/organisms/menu/menu.ios.tsx +55 -5
- package/src/organisms/menu/menu.types.ts +30 -7
- package/src/organisms/sheet/sheet.tsx +2 -1
- package/src/organisms/sheet/sheet.types.ts +7 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","ComposeText","DropdownMenu","DropdownMenuItem","useAppTheme","useCallback","useState","HStack","Icon","Glyph","useHostGuard","jsx","_jsx","jsxs","_jsxs","MenuItem","action","onDismiss","theme","color","
|
|
1
|
+
{"version":3,"names":["Text","ComposeText","DropdownMenu","DropdownMenuItem","useAppTheme","useCallback","useState","HStack","Icon","IconButton","Glyph","useHostGuard","isIconOnly","menuActionColor","jsx","_jsx","jsxs","_jsxs","MenuItem","action","onDismiss","theme","color","elementColors","leadingIconColor","textColor","enabled","disabled","onClick","onPress","children","colorString","style","typography","body","label","icon","LeadingIcon","name","size","triggerOf","props","open","accessibilityLabel","testID","align","spacing","Menu","expanded","setExpanded","dismiss","onDismissRequest","Trigger","Items","actions","map"],"sourceRoot":"../../../../src","sources":["organisms/menu/menu.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,IAAIC,WAAW,EAAEC,YAAY,EAAEC,gBAAgB,QAAO,0BAA0B;AAC5F,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAwBC,WAAW,EAAEC,QAAQ,QAAO,OAAO;AAC3D,SA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CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMQ,IAAmB,GAAIN,KAAgB,IAAK;EACvD9B,YAAY,CAAC,MAAM,CAAC;EAEpB,MAAMU,KAAK,GAAGjB,WAAW,CAAC,CAAC;EAC3B,MAAM,CAAC4C,QAAQ,EAAEC,WAAW,CAAC,GAAG3C,QAAQ,CAAC,KAAK,CAAC;EAC/C,MAAMoC,IAAI,GAAGrC,WAAW,CAAC,MAAM4C,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;EACrD,MAAMC,OAAO,GAAG7C,WAAW,CAAC,MAAM4C,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;EAEzD,oBACEhC,KAAA,CAACf,YAAY;IAACoB,KAAK,EAAED,KAAK,CAACC,KAAK,CAAC,iBAAiB,CAAE;IAAC0B,QAAQ,EAAEA,QAAS;IAACG,gBAAgB,EAAED,OAAQ;IAAApB,QAAA,gBACjGf,IAAA,CAACb,YAAY,CAACkD,OAAO;MAAAtB,QAAA,EAAEU,SAAS,CAACC,KAAK,EAAEC,IAAI;IAAC,CAAuB,CAAC,eACrE3B,IAAA,CAACb,YAAY,CAACmD,KAAK;MAAAvB,QAAA,EAChBW,KAAK,CAACa,OAAO,CAACC,GAAG,CAACpC,MAAM,iBACvBJ,IAAA,CAACG,QAAQ;QAACC,MAAM,EAAEA,MAAO;QAAoBC,SAAS,EAAE8B;MAAQ,GAAjC/B,MAAM,CAACgB,KAA4B,CACnE;IAAC,CACgB,CAAC;EAAA,CACT,CAAC;AAEnB,CAAC","ignoreList":[]}
|
|
@@ -1,19 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Button, Menu as SwiftUIMenu } from '@expo/ui/swift-ui';
|
|
3
|
+
import { Button, Image, Label, Menu as SwiftUIMenu } from '@expo/ui/swift-ui';
|
|
4
|
+
import { contentShape, disabled, frame, resizable, shapes } from '@expo/ui/swift-ui/modifiers';
|
|
5
|
+
import { iconResourceName } from '@hzblj/expo-native-icons';
|
|
6
|
+
import { useAccessibilityModifiers } from '@hzblj/kara-sx';
|
|
7
|
+
import { spacing } from '@hzblj/kara-theme';
|
|
8
|
+
import { Icon } from "../../atoms/icon/index.js";
|
|
9
|
+
import { ZStack } from "../../atoms/z-stack/index.js";
|
|
4
10
|
import { useHostGuard } from "../../host-context.js";
|
|
11
|
+
import { isIconOnly } from "./menu-parts.js";
|
|
5
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
const DISABLED = [disabled(true)];
|
|
14
|
+
|
|
15
|
+
/** Apple's least tap target, as `IconButton` takes it. */
|
|
16
|
+
const TARGET = 44;
|
|
17
|
+
|
|
18
|
+
/** The whole square takes the tap, not only the glyph's own pixels. */
|
|
19
|
+
const WHOLE_TARGET = {
|
|
20
|
+
modifiers: [contentShape(shapes.circle())]
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The icon beside the trigger's text, the size `Link` draws one beside body text. No colour of its own: the asset is a
|
|
25
|
+
* template image, so it takes the menu's tint with the text.
|
|
26
|
+
*/
|
|
27
|
+
const LABEL_ICON = [resizable(), frame({
|
|
28
|
+
height: spacing.s20,
|
|
29
|
+
width: spacing.s20
|
|
30
|
+
})];
|
|
31
|
+
const triggerOf = props => {
|
|
32
|
+
if (isIconOnly(props)) {
|
|
33
|
+
// An icon alone is drawn as an `IconButton`: `content.primary`, its label carried by the icon.
|
|
34
|
+
return /*#__PURE__*/_jsx(ZStack, {
|
|
35
|
+
h: TARGET,
|
|
36
|
+
ios: WHOLE_TARGET,
|
|
37
|
+
w: TARGET,
|
|
38
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
39
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
40
|
+
color: "content.primary",
|
|
41
|
+
name: props.icon
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return props.icon ? /*#__PURE__*/_jsx(Label, {
|
|
46
|
+
icon: /*#__PURE__*/_jsx(Image, {
|
|
47
|
+
assetName: iconResourceName(props.icon),
|
|
48
|
+
modifiers: LABEL_ICON
|
|
49
|
+
}),
|
|
50
|
+
title: props.label
|
|
51
|
+
}) : props.label;
|
|
52
|
+
};
|
|
53
|
+
export const Menu = props => {
|
|
10
54
|
useHostGuard('Menu');
|
|
55
|
+
const {
|
|
56
|
+
accessibilityLabel,
|
|
57
|
+
actions,
|
|
58
|
+
label,
|
|
59
|
+
testID
|
|
60
|
+
} = props;
|
|
61
|
+
// An icon alone carries its own label; with text, `accessibilityLabel` replaces it on the menu.
|
|
62
|
+
const modifiers = useAccessibilityModifiers({
|
|
63
|
+
accessibilityLabel: label === undefined ? undefined : accessibilityLabel
|
|
64
|
+
});
|
|
11
65
|
return /*#__PURE__*/_jsx(SwiftUIMenu, {
|
|
12
|
-
label:
|
|
66
|
+
label: triggerOf(props),
|
|
67
|
+
modifiers: modifiers,
|
|
68
|
+
testID: testID,
|
|
13
69
|
children: actions.map(action => /*#__PURE__*/_jsx(Button, {
|
|
14
|
-
label: action.label,
|
|
70
|
+
label: action.icon ? undefined : action.label,
|
|
71
|
+
modifiers: action.disabled ? DISABLED : undefined,
|
|
15
72
|
onPress: action.onPress,
|
|
16
|
-
role: action.destructive ? 'destructive' : 'default'
|
|
73
|
+
role: action.destructive ? 'destructive' : 'default',
|
|
74
|
+
children: action.icon ? /*#__PURE__*/_jsx(Label, {
|
|
75
|
+
icon: /*#__PURE__*/_jsx(Image, {
|
|
76
|
+
assetName: iconResourceName(action.icon)
|
|
77
|
+
}),
|
|
78
|
+
title: action.label
|
|
79
|
+
}) : undefined
|
|
17
80
|
}, action.label))
|
|
18
81
|
});
|
|
19
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Menu","SwiftUIMenu","useHostGuard","jsx","_jsx","
|
|
1
|
+
{"version":3,"names":["Button","Image","Label","Menu","SwiftUIMenu","contentShape","disabled","frame","resizable","shapes","iconResourceName","useAccessibilityModifiers","spacing","Icon","ZStack","useHostGuard","isIconOnly","jsx","_jsx","DISABLED","TARGET","WHOLE_TARGET","modifiers","circle","LABEL_ICON","height","s20","width","triggerOf","props","h","ios","w","children","accessibilityLabel","color","name","icon","assetName","title","label","actions","testID","undefined","map","action","onPress","role","destructive"],"sourceRoot":"../../../../src","sources":["organisms/menu/menu.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,IAAIC,WAAW,QAAO,mBAAmB;AAC3E,SAAQC,YAAY,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,SAAS,EAAEC,MAAM,QAAO,6BAA6B;AAC5F,SAAQC,gBAAgB,QAAO,0BAA0B;AACzD,SAAQC,yBAAyB,QAAO,gBAAgB;AACxD,SAAQC,OAAO,QAAO,mBAAmB;AAGzC,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,YAAY,QAAO,uBAAoB;AAE/C,SAAQC,UAAU,QAAO,iBAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEvC,MAAMC,QAAQ,GAAG,CAACb,QAAQ,CAAC,IAAI,CAAC,CAAC;;AAEjC;AACA,MAAMc,MAAM,GAAG,EAAE;;AAEjB;AACA,MAAMC,YAAY,GAAG;EAACC,SAAS,EAAE,CAACjB,YAAY,CAACI,MAAM,CAACc,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC;;AAEjE;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAG,CAAChB,SAAS,CAAC,CAAC,EAAED,KAAK,CAAC;EAACkB,MAAM,EAAEb,OAAO,CAACc,GAAG;EAAEC,KAAK,EAAEf,OAAO,CAACc;AAAG,CAAC,CAAC,CAAC;AAElF,MAAME,SAAS,GAAIC,KAAgB,IAAgB;EACjD,IAAIb,UAAU,CAACa,KAAK,CAAC,EAAE;IAC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AU;MAClDG,OAAO,EAAED,MAAM,CAACC,OAAQ;MACxBC,IAAI,EAAEF,MAAM,CAACG,WAAW,GAAG,aAAa,GAAG,SAAU;MAAAf,QAAA,EAGpDY,MAAM,CAACR,IAAI,gBACVnB,IAAA,CAAChB,KAAK;QAACmC,IAAI,eAAEnB,IAAA,CAACjB,KAAK;UAACqC,SAAS,EAAE5B,gBAAgB,CAACmC,MAAM,CAACR,IAAI;QAAE,CAAE,CAAE;QAACE,KAAK,EAAEM,MAAM,CAACL;MAAM,CAAE,CAAC,GACvFG;IAAS,GATRE,MAAM,CAACL,KAUN,CACT;EAAC,CACS,CAAC;AAElB,CAAC","ignoreList":[]}
|
|
@@ -34,6 +34,7 @@ const SheetRoot = ({
|
|
|
34
34
|
onPresent,
|
|
35
35
|
ref,
|
|
36
36
|
scrollable = false,
|
|
37
|
+
systemBackground = false,
|
|
37
38
|
testID,
|
|
38
39
|
visible
|
|
39
40
|
}) => {
|
|
@@ -99,7 +100,7 @@ const SheetRoot = ({
|
|
|
99
100
|
pointerEvents: "box-none",
|
|
100
101
|
style: styles.host,
|
|
101
102
|
children: /*#__PURE__*/_jsx(TrueSheet, {
|
|
102
|
-
backgroundColor: theme.color(bg),
|
|
103
|
+
backgroundColor: systemBackground && Platform.OS === 'ios' ? undefined : theme.color(bg),
|
|
103
104
|
cornerRadius: CORNER_RADIUS,
|
|
104
105
|
detents: detents,
|
|
105
106
|
dimmed: dimmed,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useAppTheme","TrueSheet","useCallback","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","Platform","StyleSheet","View","SheetHeader","SheetScrollContext","SheetScrollView","splitSheetChildren","useSheetHeader","jsxs","_jsxs","jsx","_jsx","FIT_CONTENT","CORNER_RADIUS","OS","undefined","styles","create","host","position","SheetRoot","bg","children","detents","dimmed","dismissible","draggable","footer","grabber","onDetentChange","onDismiss","onPresent","ref","scrollable","testID","visible","theme","content","header","headerProps","sheetHeader","sheetRef","presented","programmaticDismiss","dismiss","current","Promise","resolve","present","detentIndex","resize","sheet","handleDidDismiss","handleDetentChange","event","nativeEvent","index","collapsable","pointerEvents","style","backgroundColor","color","cornerRadius","headerStyle","onDidDismiss","onDidPresent","scrollableOptions","Provider","value","scrollContext","staticLargeTitle","Sheet","Object","assign","Header","ScrollView"],"sourceRoot":"../../../../src","sources":["organisms/sheet/sheet.tsx"],"mappings":";;AAAA,SAAQA,WAAW,QAAO,mBAAmB;AAC7C,SAAgCC,SAAS,QAAO,kCAAkC;AAClF,SAAQC,WAAW,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,QAAO,OAAO;AACnG,SAAQC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAO,cAAc;AAEvD,SAAQC,WAAW,QAAO,mBAAgB;AAC1C,SAAQC,kBAAkB,EAAEC,eAAe,QAAO,mBAAgB;AAClE,SAAQC,kBAAkB,QAAO,2BAAwB;AACzD,SAAQC,cAAc,QAAO,uBAAoB;AAAA,SAAAC,IAAA,IAAAC,KAAA,EAAAC,GAAA,IAAAC,IAAA;AAEjD,MAAMC,WAA0B,GAAG,CAAC,MAAM,CAAC;;AAE3C;AACA,MAAMC,aAAa,GAAGb,QAAQ,CAACc,EAAE,KAAK,SAAS,GAAG,EAAE,GAAGC,SAAS;;AAEhE;AACA,MAAMC,MAAM,GAAGf,UAAU,CAACgB,MAAM,CAAC;EAC/BC,IAAI,EAAE;IAACC,QAAQ,EAAE;EAAU;AAC7B,CAAC,CAAC;AAEF,MAAMC,SAAS,GAAGA,CAAC;EACjBC,EAAE,GAAG,iBAAiB;EACtBC,QAAQ;EACRC,OAAO,GAAGX,WAAW;EACrBY,MAAM,GAAG,IAAI;EACbC,WAAW,GAAG,IAAI;EAClBC,SAAS,GAAG,IAAI;EAChBC,MAAM;EACNC,OAAO,GAAG,IAAI;EACdC,cAAc;EACdC,SAAS;EACTC,SAAS;EACTC,GAAG;EACHC,UAAU,GAAG,KAAK;EAClBC,MAAM;EACNC;AACU,CAAC,KAAK;EAChB,MAAMC,KAAK,
|
|
1
|
+
{"version":3,"names":["useAppTheme","TrueSheet","useCallback","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","Platform","StyleSheet","View","SheetHeader","SheetScrollContext","SheetScrollView","splitSheetChildren","useSheetHeader","jsxs","_jsxs","jsx","_jsx","FIT_CONTENT","CORNER_RADIUS","OS","undefined","styles","create","host","position","SheetRoot","bg","children","detents","dimmed","dismissible","draggable","footer","grabber","onDetentChange","onDismiss","onPresent","ref","scrollable","systemBackground","testID","visible","theme","content","header","headerProps","sheetHeader","sheetRef","presented","programmaticDismiss","dismiss","current","Promise","resolve","present","detentIndex","resize","sheet","handleDidDismiss","handleDetentChange","event","nativeEvent","index","collapsable","pointerEvents","style","backgroundColor","color","cornerRadius","headerStyle","onDidDismiss","onDidPresent","scrollableOptions","Provider","value","scrollContext","staticLargeTitle","Sheet","Object","assign","Header","ScrollView"],"sourceRoot":"../../../../src","sources":["organisms/sheet/sheet.tsx"],"mappings":";;AAAA,SAAQA,WAAW,QAAO,mBAAmB;AAC7C,SAAgCC,SAAS,QAAO,kCAAkC;AAClF,SAAQC,WAAW,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,QAAO,OAAO;AACnG,SAAQC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAO,cAAc;AAEvD,SAAQC,WAAW,QAAO,mBAAgB;AAC1C,SAAQC,kBAAkB,EAAEC,eAAe,QAAO,mBAAgB;AAClE,SAAQC,kBAAkB,QAAO,2BAAwB;AACzD,SAAQC,cAAc,QAAO,uBAAoB;AAAA,SAAAC,IAAA,IAAAC,KAAA,EAAAC,GAAA,IAAAC,IAAA;AAEjD,MAAMC,WAA0B,GAAG,CAAC,MAAM,CAAC;;AAE3C;AACA,MAAMC,aAAa,GAAGb,QAAQ,CAACc,EAAE,KAAK,SAAS,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AAMkC,KAAqB,GAAGC,MAAM,CAACC,MAAM,CAACtD,SAAS,EAAE;EAACuD,MAAM,EAAExE,WAAW;EAAEyE,UAAU,EAAEvE;AAAe,CAAC,CAAC","ignoreList":[]}
|
|
@@ -4,6 +4,8 @@ export type BadgeTone = 'accent' | 'destructive' | 'neutral' | 'success';
|
|
|
4
4
|
export type BadgeProps = {
|
|
5
5
|
/** The text inside. */
|
|
6
6
|
label: string;
|
|
7
|
+
/** Test identifier, forwarded to the native view. */
|
|
8
|
+
testID?: string;
|
|
7
9
|
/** The fill and text colours. `neutral` by default. */
|
|
8
10
|
tone?: BadgeTone;
|
|
9
11
|
};
|
|
@@ -12,14 +12,18 @@ export declare const buttonTokens: (variant: ButtonVariant, disabled: boolean, t
|
|
|
12
12
|
readonly content: 'content.primary';
|
|
13
13
|
readonly fill: 'btn.bg.glass.base';
|
|
14
14
|
readonly shadow: 'btn.glass';
|
|
15
|
+
} | {
|
|
16
|
+
readonly content: 'content.accent';
|
|
17
|
+
readonly fill: undefined;
|
|
18
|
+
readonly shadow: undefined;
|
|
15
19
|
} | {
|
|
16
20
|
readonly content: 'content.primary';
|
|
17
21
|
readonly fill: 'btn.bg.secondary.base';
|
|
18
22
|
readonly shadow: 'btn.secondary';
|
|
19
23
|
} | {
|
|
20
24
|
readonly content: 'btn.content.disabled';
|
|
21
|
-
readonly fill: "btn.bg.glass.disabled" | "btn.bg.secondary.disabled" | "fill.accent.disabled" | "fill.destructive.disabled";
|
|
22
|
-
readonly shadow: "btn.accent" | "btn.destructive" | "btn.glass" | "btn.secondary";
|
|
25
|
+
readonly fill: "btn.bg.glass.disabled" | "btn.bg.secondary.disabled" | "fill.accent.disabled" | "fill.destructive.disabled" | undefined;
|
|
26
|
+
readonly shadow: "btn.accent" | "btn.destructive" | "btn.glass" | "btn.secondary" | undefined;
|
|
23
27
|
};
|
|
24
28
|
/**
|
|
25
29
|
* The label for a button filled with an arbitrary `tint`: the on-accent white over a strong colour, the primary
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ColorToken } from '@hzblj/kara-theme';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
|
|
3
|
+
import type { IconName } from '../icon';
|
|
4
|
+
export type ButtonVariant = 'accent' | 'destructive' | 'glass' | 'plain' | 'secondary';
|
|
4
5
|
/**
|
|
5
6
|
* SwiftUI `ButtonStyle`. iOS only: Compose has no equivalent, so Android ignores it and keeps
|
|
6
7
|
* rendering the variant's tokens.
|
|
@@ -11,19 +12,28 @@ export type ButtonStyleName = 'automatic' | 'bordered' | 'borderedProminent' | '
|
|
|
11
12
|
* whatever the surrounding SwiftUI environment provides.
|
|
12
13
|
*/
|
|
13
14
|
export type ButtonControlSize = 'extraLarge' | 'large' | 'mini' | 'regular' | 'small';
|
|
14
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* A text button: SwiftUI `Button` on iOS, Material's filled button on Android (outlined for `glass`, a `TextButton`
|
|
17
|
+
* for `plain`).
|
|
18
|
+
*/
|
|
15
19
|
export type ButtonProps = {
|
|
16
20
|
/** What pressing it does, when the label alone does not say. See `AccessibilityProps`. */
|
|
17
21
|
accessibilityHint?: string;
|
|
18
22
|
/**
|
|
19
23
|
* Replaces the style the variant picks: `borderedProminent` for `accent` and `destructive`, `bordered` for
|
|
20
|
-
* `secondary`, `glass` for `glass`. iOS only. Android ignores it.
|
|
24
|
+
* `secondary`, `glass` for `glass`, `borderless` for `plain`. iOS only. Android ignores it.
|
|
21
25
|
*/
|
|
22
26
|
buttonStyle?: ButtonStyleName;
|
|
23
27
|
/** SwiftUI's control size. `large` by default. iOS only. Android ignores it. */
|
|
24
28
|
controlSize?: ButtonControlSize;
|
|
25
29
|
/** Draws the button in its disabled colours and stops it responding to presses. */
|
|
26
30
|
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* One of the app's icons, before the label and in the label's colour. iOS sets the two as a SwiftUI `Label`; Android
|
|
33
|
+
* puts the icon in the button's content row, as Material's buttons with an icon do. Screen readers read the label
|
|
34
|
+
* only.
|
|
35
|
+
*/
|
|
36
|
+
icon?: IconName;
|
|
27
37
|
/** The button's text. */
|
|
28
38
|
label: string;
|
|
29
39
|
/** Called when the button is pressed. */
|
|
@@ -33,10 +43,14 @@ export type ButtonProps = {
|
|
|
33
43
|
/**
|
|
34
44
|
* Overrides the variant's own tint. A prominent style takes it as the fill and picks a contrasting
|
|
35
45
|
* label. `glass` has to reach the material through `glassEffect` instead, so tinting one costs it
|
|
36
|
-
* the stock `.glass` style (see the iOS implementation).
|
|
46
|
+
* the stock `.glass` style (see the iOS implementation). `plain` has no fill, so there it colours the label.
|
|
37
47
|
*/
|
|
38
48
|
tint?: ColorToken;
|
|
39
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* The look. `accent` by default. Material has no glass, so on Android `glass` is an outlined button. `plain` is a
|
|
51
|
+
* text button in the accent, with no fill or border, for a lesser action beside a prominent one ("Skip", "Forgot
|
|
52
|
+
* password?"): SwiftUI's `borderless` style, Material's `TextButton`.
|
|
53
|
+
*/
|
|
40
54
|
variant?: ButtonVariant;
|
|
41
55
|
/** Stretches the button to the full width it is offered. On by default. */
|
|
42
56
|
wide?: boolean;
|
|
@@ -7,6 +7,8 @@ export type CheckboxProps = {
|
|
|
7
7
|
label?: string;
|
|
8
8
|
/** Called with the new value when the user toggles it. */
|
|
9
9
|
onValueChange?: (value: boolean) => void;
|
|
10
|
+
/** Test identifier, forwarded to the native control (on Android the box itself, not the labelled row). */
|
|
11
|
+
testID?: string;
|
|
10
12
|
/** Whether it is checked. Controlled: update it from `onValueChange`. */
|
|
11
13
|
value: boolean;
|
|
12
14
|
};
|
|
@@ -5,6 +5,8 @@ import type { ReactNode } from 'react';
|
|
|
5
5
|
* spectrum and RGB sliders.
|
|
6
6
|
*/
|
|
7
7
|
export type ColorPickerProps = {
|
|
8
|
+
/** Stops the user picking a colour, and dims the label and the well. */
|
|
9
|
+
disabled?: boolean;
|
|
8
10
|
/** Text beside the colour well, and the Android sheet's title. */
|
|
9
11
|
label?: string;
|
|
10
12
|
/** Called with the colour the user picks. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DatePickerComponent } from './date-picker.types';
|
|
2
2
|
/**
|
|
3
|
-
* The system's compact
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `useInsideHost`).
|
|
3
|
+
* The system's date picker, in the accent. `compact` by default: the value in a pill, and a tap on it opens the
|
|
4
|
+
* calendar popover UIKit owns. `graphical` is that calendar in place, `wheel` the value on wheels. Its own host, sized
|
|
5
|
+
* to the picker on both axes (a host that took the width it was given would lay the pill out against the far edge of
|
|
6
|
+
* it, or past its container's), so it drops into a row the way a `Text` does. The label is the caller's, beside it.
|
|
7
|
+
* Inside a `Screen` or `Island` it renders into that host instead (see `useInsideHost`).
|
|
8
8
|
*/
|
|
9
9
|
export declare const DatePicker: DatePickerComponent;
|
|
@@ -1,23 +1,46 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
export type DatePickerMode = 'date' | 'datetime' | 'time';
|
|
3
|
+
/** How SwiftUI shows the picker: a pill that opens the calendar, the calendar in place, or wheels. */
|
|
4
|
+
export type DatePickerStyleName = 'compact' | 'graphical' | 'wheel';
|
|
3
5
|
/**
|
|
4
|
-
* A date or time picker: SwiftUI's
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* A date or time picker: SwiftUI's `DatePicker` on iOS (a pill by default, a calendar or wheels with
|
|
7
|
+
* `datePickerStyle`), a field that opens Material's picker dialog on a tap on Android, or Material's calendar in place
|
|
8
|
+
* with `datePickerStyle="graphical"`. The React Native tier: it brings its own host and sizes itself to the value, so it
|
|
9
|
+
* sits in a row beside its label like a `Text`. Inside a `Screen` or `Island` it joins that host instead, beside a
|
|
10
|
+
* native `Text` label.
|
|
7
11
|
*/
|
|
8
12
|
export type DatePickerProps = {
|
|
13
|
+
/**
|
|
14
|
+
* SwiftUI's date picker style. `compact` by default: the value in a pill, which opens the calendar in a popover.
|
|
15
|
+
* `graphical` is the calendar in place, a month at a time, with the time under it in `datetime` mode: what a screen
|
|
16
|
+
* built around picking a day wants. `wheel` puts the value on wheels. Android shows Material's calendar in place for
|
|
17
|
+
* `graphical` in `date` and `datetime` modes (without its title and headline); otherwise it keeps its field and
|
|
18
|
+
* dialog, since Material has no wheel.
|
|
19
|
+
*/
|
|
20
|
+
datePickerStyle?: DatePickerStyleName;
|
|
21
|
+
/**
|
|
22
|
+
* Stops the user changing the date, and dims the picker. Material's calendar has no disabled state of its own, so a
|
|
23
|
+
* `graphical` picker on Android is dimmed and offers only the selected day.
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
9
26
|
/** The latest date that can be picked. Android ignores it in `time` mode. */
|
|
10
27
|
max?: Date;
|
|
11
28
|
/** The earliest date that can be picked. Android ignores it in `time` mode. */
|
|
12
29
|
min?: Date;
|
|
13
30
|
/**
|
|
14
|
-
* What it picks. `date` by default. Android has no combined dialog, so there `datetime` picks the date
|
|
15
|
-
* `value`'s time of day.
|
|
31
|
+
* What it picks. `date` by default. Android has no combined dialog or calendar, so there `datetime` picks the date
|
|
32
|
+
* and keeps `value`'s time of day.
|
|
16
33
|
*/
|
|
17
34
|
mode?: DatePickerMode;
|
|
18
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Called with the new date: on iOS as it changes, on Android when the dialog is confirmed or a day in the calendar
|
|
37
|
+
* is tapped.
|
|
38
|
+
*/
|
|
19
39
|
onValueChange?: (date: Date) => void;
|
|
20
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Test identifier, on the native picker on iOS and on Android's calendar, and on the tappable field elsewhere on
|
|
42
|
+
* Android.
|
|
43
|
+
*/
|
|
21
44
|
testID?: string;
|
|
22
45
|
/** The selected date. Controlled: update it from `onValueChange`. */
|
|
23
46
|
value: Date;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { DividerComponent } from './divider.types';
|
|
2
|
+
/**
|
|
3
|
+
* SwiftUI's divider, which turns with its stack: vertical in an `HStack`, horizontal anywhere else. So `axis`, which
|
|
4
|
+
* Android needs to pick its divider, has nothing to do here.
|
|
5
|
+
*/
|
|
2
6
|
export declare const Divider: DividerComponent;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type { ColorToken } from '@hzblj/kara-theme';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
/**
|
|
3
|
+
/** Which way the line runs. */
|
|
4
|
+
export type DividerAxis = 'horizontal' | 'vertical';
|
|
5
|
+
/**
|
|
6
|
+
* A hairline between views: SwiftUI `Divider` / Compose `HorizontalDivider`, or `VerticalDivider` with
|
|
7
|
+
* `axis="vertical"`.
|
|
8
|
+
*/
|
|
4
9
|
export type DividerProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Which way the line runs. `horizontal` by default: across a `VStack`. `vertical` stands it up between the children
|
|
12
|
+
* of an `HStack`, as tall as the stack, so give the stack a height (`h`). iOS ignores it: SwiftUI's divider turns by
|
|
13
|
+
* itself, vertical in an `HStack` and horizontal anywhere else. Set it anyway, so Android draws the same.
|
|
14
|
+
*/
|
|
15
|
+
axis?: DividerAxis;
|
|
5
16
|
/** The line's colour. `border.tertiary` by default. */
|
|
6
17
|
color?: ColorToken;
|
|
7
|
-
/** Test identifier, forwarded to the native view
|
|
18
|
+
/** Test identifier, forwarded to the native view. */
|
|
8
19
|
testID?: string;
|
|
9
20
|
};
|
|
10
21
|
export type DividerComponent = (props: DividerProps) => ReactNode;
|
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { IconName } from '../icon';
|
|
3
|
+
/** Material's three floating action buttons: 40, 56 and 96 across. */
|
|
4
|
+
export type FabSize = 'large' | 'regular' | 'small';
|
|
3
5
|
/**
|
|
4
|
-
* A floating action button: Material's `FloatingActionButton` on Android,
|
|
5
|
-
*
|
|
6
|
+
* A floating action button: Material's `FloatingActionButton` on Android, an accent circle (a plain SwiftUI `Button`)
|
|
7
|
+
* on iOS. With a `label` it is the extended one, the icon and the text side by side: Material's
|
|
8
|
+
* `ExtendedFloatingActionButton`, an accent capsule on iOS. It renders inline; pinning it to a corner is up to the
|
|
9
|
+
* screen.
|
|
6
10
|
*/
|
|
7
11
|
export type FabProps = {
|
|
8
12
|
/**
|
|
9
13
|
* What VoiceOver and TalkBack say for the button, since an icon has no words of its own: "Share", "Add to
|
|
10
|
-
* favourites". Required for that reason.
|
|
14
|
+
* favourites". Required for that reason. With a `label` it is still what they say, in place of the label, so give
|
|
15
|
+
* it the label's words (or words that start with them), and Voice Control finds the button by what it shows.
|
|
11
16
|
*/
|
|
12
17
|
accessibilityLabel: string;
|
|
13
18
|
/** What pressing it does, when the label alone does not say. See `AccessibilityProps`. */
|
|
14
19
|
accessibilityHint?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Text beside the icon, which makes it an extended FAB: "Compose", "New post". For a screen whose main action needs
|
|
22
|
+
* its words. Material's `ExtendedFloatingActionButton` on Android; on iOS the same accent, 56pt tall, as a capsule.
|
|
23
|
+
*/
|
|
24
|
+
label?: string;
|
|
15
25
|
/** The icon, one of the app's, drawn in `content.on.accent`. */
|
|
16
26
|
name: IconName;
|
|
17
27
|
/** Called when the button is pressed. */
|
|
18
28
|
onPress?: () => void;
|
|
19
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* `regular` by default, 56 across. `small` is 40, for a secondary action beside a regular one; `large` is 96, with a
|
|
31
|
+
* 36 icon, for a screen built around one action. Material's `SmallFloatingActionButton` and
|
|
32
|
+
* `LargeFloatingActionButton` on Android, the same sizes of circle on iOS. A FAB with a `label` has one size and
|
|
33
|
+
* ignores it.
|
|
34
|
+
*/
|
|
35
|
+
size?: FabSize;
|
|
36
|
+
/** Test identifier, forwarded to the native view. */
|
|
20
37
|
testID?: string;
|
|
21
38
|
};
|
|
22
39
|
export type FabComponent = (props: FabProps) => ReactNode;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import type { ColorToken } from '@hzblj/kara-theme';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
import type { IconName } from '../icon';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
5
|
+
* How much the button stands out: just the icon (`plain`), on a fill in the accent (`filled`), on a muted fill
|
|
6
|
+
* (`tonal`), in a ring (`outlined`) or on Liquid Glass (`glass`).
|
|
7
|
+
*/
|
|
8
|
+
export type IconButtonVariant = 'filled' | 'glass' | 'outlined' | 'plain' | 'tonal';
|
|
9
|
+
/**
|
|
10
|
+
* A button that is just an icon: a SwiftUI `Button` on iOS, one of Material's icon buttons on Android. A `plain` one
|
|
11
|
+
* sits centred in a tap target the size each platform asks for, 44pt on iOS and 48dp on Android, so a row of them
|
|
12
|
+
* spaces itself the same way on both; the other variants draw a circle around the icon.
|
|
7
13
|
*/
|
|
8
14
|
export type IconButtonProps = {
|
|
9
15
|
/**
|
|
@@ -13,13 +19,26 @@ export type IconButtonProps = {
|
|
|
13
19
|
accessibilityLabel: string;
|
|
14
20
|
/** What pressing it does, when the label alone does not say. See `AccessibilityProps`. */
|
|
15
21
|
accessibilityHint?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The icon's colour, `content.primary` by default. On `filled` it is the fill instead (`fill.accent.primary` by
|
|
24
|
+
* default) and the icon picks a colour that reads on it, as a `Button`'s `tint` does on a prominent style. On iOS a
|
|
25
|
+
* `tonal` button's circle takes a pale shade of it too.
|
|
26
|
+
*/
|
|
27
|
+
color?: ColorToken;
|
|
16
28
|
/** Dims the icon (iOS's own disabled look, `btn.content.disabled` on Android) and stops the button responding. */
|
|
17
29
|
disabled?: boolean;
|
|
18
30
|
/** The icon, one of the app's. */
|
|
19
31
|
name: IconName;
|
|
20
32
|
/** Called when the button is pressed. */
|
|
21
33
|
onPress?: () => void;
|
|
22
|
-
/** Test identifier, forwarded to the native view
|
|
34
|
+
/** Test identifier, forwarded to the native view. */
|
|
23
35
|
testID?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The look. `plain` by default. iOS draws the others as SwiftUI button styles in a circle: `borderedProminent` for
|
|
38
|
+
* `filled`, `bordered` for `tonal`, `glass` for `glass` (`bordered` below iOS 26), and `outlined` as a plain button
|
|
39
|
+
* in a hairline ring. Android draws Material's `IconButton`, `FilledIconButton`, `FilledTonalIconButton` and
|
|
40
|
+
* `OutlinedIconButton`; Material has no glass, so there `glass` is the tonal one.
|
|
41
|
+
*/
|
|
42
|
+
variant?: IconButtonVariant;
|
|
24
43
|
};
|
|
25
44
|
export type IconButtonComponent = (props: IconButtonProps) => ReactNode;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/** How the rows are laid out: in a rounded card inset from the edges, or edge to edge. */
|
|
3
|
+
export type ListVariant = 'insetGrouped' | 'plain';
|
|
2
4
|
/**
|
|
3
5
|
* A scrolling list: SwiftUI `List`, Compose `LazyColumn`. It has no height of its own, so it needs one from outside:
|
|
4
6
|
* a `Screen`, or an `Island` with `matchContents={false}` and a height. In an island that sizes itself to its content
|
|
@@ -16,7 +18,19 @@ export type ListProps = {
|
|
|
16
18
|
* until the promise settles, so neither platform needs a `refreshing` flag kept in sync by hand.
|
|
17
19
|
*/
|
|
18
20
|
onRefresh?: () => Promise<void>;
|
|
19
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Draws a line between rows. On by default. Off, iOS hides SwiftUI's row separators and Android draws no `Divider`,
|
|
23
|
+
* for rows that carry their own spacing (cards, media).
|
|
24
|
+
*/
|
|
25
|
+
separators?: boolean;
|
|
26
|
+
/** Test identifier, forwarded to the native view. */
|
|
20
27
|
testID?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The layout. Each platform's own list by default: `insetGrouped` on iOS, `plain` on Android. `insetGrouped` sets
|
|
30
|
+
* the rows in a rounded card inset from the edges (SwiftUI's `insetGrouped` list style; on Android a `Card` inside the
|
|
31
|
+
* column, the way `Form` draws its sections). `plain` runs the rows edge to edge (SwiftUI's `plain` style; Android's
|
|
32
|
+
* column as it is).
|
|
33
|
+
*/
|
|
34
|
+
variant?: ListVariant;
|
|
21
35
|
};
|
|
22
36
|
export type ListComponent = (props: ListProps) => ReactNode;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
import type { ColorToken } from '@hzblj/kara-theme';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
/**
|
|
3
|
-
* A progress bar or ring, tinted `fill.accent.primary
|
|
4
|
-
* value, which `ProgressView` cannot draw on iOS) / Compose's `LinearProgressIndicator` and
|
|
4
|
+
* A progress bar or ring, tinted `fill.accent.primary` unless `color` names another: SwiftUI `ProgressView` (a capacity
|
|
5
|
+
* `Gauge` for a ring with a value, which `ProgressView` cannot draw on iOS) / Compose's `LinearProgressIndicator` and
|
|
6
|
+
* `CircularProgressIndicator`.
|
|
5
7
|
*/
|
|
6
8
|
export type ProgressProps = {
|
|
7
9
|
/** What is in progress, for VoiceOver and TalkBack: "Uploading". They read how far along it is themselves. */
|
|
8
10
|
accessibilityLabel?: string;
|
|
9
11
|
/** A circular indicator instead of a bar. Off by default. */
|
|
10
12
|
circular?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Its colour: `fill.destructive.primary` for storage nearly full, `fill.success.primary` for a goal reached.
|
|
15
|
+
* `fill.accent.primary` by default. iOS tints the bar or ring with it. Android draws the indicator in it and, for any
|
|
16
|
+
* colour but the accent, the track in the same colour faded (Material's own track stays under the accent, and an
|
|
17
|
+
* indeterminate ring has none).
|
|
18
|
+
*/
|
|
19
|
+
color?: ColorToken;
|
|
20
|
+
/** Test identifier, forwarded to the native view. */
|
|
21
|
+
testID?: string;
|
|
11
22
|
/** Between `0` and `1`. Leave it unset for an indeterminate indicator. */
|
|
12
23
|
value?: number;
|
|
13
24
|
};
|
|
@@ -3,6 +3,8 @@ import type { SegmentedControlComponent } from './segmented-control.types';
|
|
|
3
3
|
* kara's own `UISegmentedControl`, with the pill in the accent and white text on it — the system control tints only the
|
|
4
4
|
* pill, and SwiftUI's segmented picker not even that. A plain `UIView` in React Native layout: it needs no host, takes
|
|
5
5
|
* the width it is given and UIKit's height. Inside a `Screen` or `Island` it is carried into that host by `RNHostView`
|
|
6
|
-
* (see `useInsideHost`), the host's width and its own height. UIKit plays the control's own feedback.
|
|
6
|
+
* (see `useInsideHost`), the host's width and its own height. UIKit plays the control's own feedback. A segment shows a
|
|
7
|
+
* title or an image, never both, so an icon segment is drawn natively as one image of the icon and the label, in the
|
|
8
|
+
* label's colour; an image segment is the image alone, loaded and drawn by kara-native at `iconSize`.
|
|
7
9
|
*/
|
|
8
10
|
export declare const SegmentedControl: SegmentedControlComponent;
|
|
@@ -1,13 +1,31 @@
|
|
|
1
|
+
import type { SpaceSize } from '@hzblj/kara-theme';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ImageSourcePropType } from 'react-native';
|
|
4
|
+
import type { IconName } from '../icon';
|
|
5
|
+
/** A segment that shows more than its label. */
|
|
6
|
+
export type SegmentedControlSegment = {
|
|
7
|
+
/** One of the app's icons, before the label and in the label's colour, the selected segment's or the others'. */
|
|
8
|
+
icon?: IconName;
|
|
9
|
+
/**
|
|
10
|
+
* An image in its own colours instead of the label, such as a carrier's logo: a `require()`d file, or `{uri}` for a
|
|
11
|
+
* URL (raster or SVG). The label stays what screen readers say, and is shown instead if the image cannot be loaded.
|
|
12
|
+
*/
|
|
13
|
+
image?: ImageSourcePropType;
|
|
14
|
+
/** What the segment says, and what `onChange` reports. */
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
2
17
|
/**
|
|
3
18
|
* A row of mutually exclusive segments, the selected one in the accent: kara's own `UISegmentedControl` on iOS,
|
|
4
19
|
* Material's single-choice segmented buttons on Android. It needs no `Screen` or `Island`: iOS is a plain view, Android
|
|
5
20
|
* brings its own host. Inside one it joins that host, so it can share a stack with other native views. It takes the
|
|
6
|
-
* width it is given; the height is the platform's
|
|
21
|
+
* width it is given; the height is the platform's, or taller with `spacing`. A segment can lead with one of the app's
|
|
22
|
+
* icons or be an image, a logo, both loaded natively (SDWebImage on iOS, androidsvg on Android, as Footshop does).
|
|
7
23
|
*/
|
|
8
24
|
export type SegmentedControlProps = {
|
|
9
25
|
/** Stops the user changing the segment, and dims the control. */
|
|
10
26
|
disabled?: boolean;
|
|
27
|
+
/** The height of the segments' icons and images, a spacing token. `s20` by default. */
|
|
28
|
+
iconSize?: SpaceSize;
|
|
11
29
|
/**
|
|
12
30
|
* Called with the index and label of the segment the user picked, never for a tap on the one already selected.
|
|
13
31
|
* Android plays `selection`; iOS's control plays its own feedback.
|
|
@@ -15,9 +33,14 @@ export type SegmentedControlProps = {
|
|
|
15
33
|
onChange?: (index: number, value: string) => void;
|
|
16
34
|
/** The selected segment. Controlled: pass back what `onChange` reports. */
|
|
17
35
|
selectedIndex: number;
|
|
36
|
+
/**
|
|
37
|
+
* Space above and below the segments' content, a spacing token: a taller control, for bigger icons or an easier
|
|
38
|
+
* target. Unset keeps the platform's own height, and the control is never shorter than that.
|
|
39
|
+
*/
|
|
40
|
+
spacing?: SpaceSize;
|
|
18
41
|
/** Test identifier, on the whole control. Reach a segment by its label. */
|
|
19
42
|
testID?: string;
|
|
20
|
-
/** The segments
|
|
21
|
-
values: string[];
|
|
43
|
+
/** The segments, in order: a label, or a segment with an icon or an image. */
|
|
44
|
+
values: (string | SegmentedControlSegment)[];
|
|
22
45
|
};
|
|
23
46
|
export type SegmentedControlComponent = (props: SegmentedControlProps) => ReactNode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ImageSourcePropType } from 'react-native';
|
|
2
|
+
import type { SegmentedControlSegment } from './segmented-control.types';
|
|
3
|
+
/** A plain label is a segment with nothing else. */
|
|
4
|
+
export declare const segmentOf: (value: string | SegmentedControlSegment) => SegmentedControlSegment;
|
|
5
|
+
/** What the native loaders take: a `require()`d file's packager or file URL, or the URI itself. */
|
|
6
|
+
export declare const imageUri: (source: ImageSourcePropType | undefined) => string | undefined;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { SliderComponent } from './slider.types';
|
|
2
|
+
/**
|
|
3
|
+
* SwiftUI's slider. `onValueChangeEnd` is its `onEditingChanged(false)`, with the last value the drag reported: the
|
|
4
|
+
* controlled `value` can still be a render behind when the finger lifts.
|
|
5
|
+
*/
|
|
2
6
|
export declare const Slider: SliderComponent;
|