@hzblj/kara-components 0.17.0 → 0.18.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 +49 -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/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/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/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","FloatingActionButtonMenu","FloatingActionButtonMenuItem","ToggleFloatingActionButton","useAppTheme","useCallback","useState","Icon","Glyph","useHostGuard","jsx","_jsx","jsxs","_jsxs","FabMenuRow","action","onSelect","theme","onClick","containerColor","color","contentColor","children","icon","name","colorString","style","typography","labelMedium","label","FabMenu","accessibilityLabel","actions","expanded","setExpanded","onPress","horizontalAlignment","Button","checked","onCheckedChange","map"],"sourceRoot":"../../../../src","sources":["organisms/fab-menu/fab-menu.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,IAAIC,WAAW,QAAO,0BAA0B;AAC5D,SACEC,wBAAwB,EACxBC,4BAA4B,EAC5BC,0BAA0B,QACrB,oCAAoC;AAC3C,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,QAAQ,QAAO,OAAO;AAC3C,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,KAAK,QAAO,sBAAa;AACjC,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS/C;AACA,MAAMC,UAAU,GAAGA,CAAC;EAACC,MAAM;EAAEC;AAAyB,CAAC,KAAK;EAC1D,MAAMC,KAAK,GAAGb,WAAW,CAAC,CAAC;EAC3B,MAAMc,OAAO,GAAGb,WAAW,CAAC,MAAMW,QAAQ,CAACD,MAAM,CAAC,EAAE,CAACA,MAAM,EAAEC,QAAQ,CAAC,CAAC;EAEvE,oBACEH,KAAA,CAACX,4BAA4B;IAC3BiB,cAAc,EAAEF,KAAK,CAACG,KAAK,CAAC,qBAAqB,CAAE;IACnDC,YAAY,EAAEJ,KAAK,CAACG,KAAK,CAAC,mBAAmB,CAAE;IAC/CF,OAAO,EAAEA,OAAQ;IAAAI,QAAA,GAEhBP,MAAM,CAACQ,IAAI,gBACVZ,IAAA,CAACT,4BAA4B,CAACK,IAAI;M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C,IAAI,gBACHZ,IAAA,CAACJ,IAAI;YAACwB,kBAAkB,EAAEA,kBAAmB;YAACX,KAAK,EAAC,mBAAmB;YAACI,IAAI,EAAED;UAAK,CAAE,CAAC,gBAEtFZ,IAAA,CAACH,KAAK;YAACuB,kBAAkB,EAAEA,kBAAmB;YAACX,KAAK,EAAC,mBAAmB;YAACI,IAAI,EAAC;UAAM,CAAE;QACvF,CAC8B;MAAC,CACR;IAAC,CACE,CAAC,EACjCQ,OAAO,CAACQ,GAAG,CAACzB,MAAM,iBACjBJ,IAAA,CAACG,UAAU;MAACC,MAAM,EAAEA,MAAO;MAAoBC,QAAQ,EAAEA;IAAS,GAAjCD,MAAM,CAACc,KAA4B,CACrE,CAAC;EAAA,CACsB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Text","ComposeText","FloatingActionButtonMenu","FloatingActionButtonMenuItem","ToggleFloatingActionButton","useAppTheme","useCallback","useState","Icon","Glyph","useHostGuard","jsx","_jsx","jsxs","_jsxs","FabMenuRow","action","onSelect","theme","onClick","containerColor","color","contentColor","children","icon","name","colorString","style","typography","labelMedium","label","FabMenu","accessibilityLabel","actions","expanded","setExpanded","onPress","horizontalAlignment","Button","checked","onCheckedChange","map"],"sourceRoot":"../../../../src","sources":["organisms/fab-menu/fab-menu.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,IAAIC,WAAW,QAAO,0BAA0B;AAC5D,SACEC,wBAAwB,EACxBC,4BAA4B,EAC5BC,0BAA0B,QACrB,oCAAoC;AAC3C,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,QAAQ,QAAO,OAAO;AAC3C,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,KAAK,QAAO,sBAAa;AACjC,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS/C;AACA,MAAMC,UAAU,GAAGA,CAAC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IAAK;IACnDmB,WAAW,CAAC,KAAK,CAAC;IAClBnB,MAAM,CAACoB,OAAO,CAAC,CAAC;EAClB,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEtB,KAAA,CAACZ,wBAAwB;IAACgC,QAAQ,EAAEA,QAAS;IAACG,mBAAmB,EAAC,KAAK;IAAAd,QAAA,gBACrEX,IAAA,CAACV,wBAAwB,CAACoC,MAAM;MAAAf,QAAA,eAC9BX,IAAA,CAACR,0BAA0B;QACzBmC,OAAO,EAAEL,QAAS;QAClBd,cAAc,EAAEF,KAAK,CAACG,KAAK,CAAC,qBAAqB,CAAE;QACnDmB,eAAe,EAAEL,WAAY;QAAAZ,QAAA,eAE7BX,IAAA,CAACR,0BAA0B,CAACI,IAAI;UAAAe,QAAA,EAC7BC,IAAI,gBACHZ,IAAA,CAACJ,IAAI;YAACwB,kBAAkB,EAAEA,kBAAmB;YAACX,KAAK,EAAC,mBAAmB;YAACI,IAAI,EAAED;UAAK,CAAE,CAAC,gBAEtFZ,IAAA,CAACH,KAAK;YAACuB,kBAAkB,EAAEA,kBAAmB;YAACX,KAAK,EAAC,mBAAmB;YAACI,IAAI,EAAC;UAAM,CAAE;QACvF,CAC8B;MAAC,CACR;IAAC,CACE,CAAC,EACjCQ,OAAO,CAACQ,GAAG,CAACzB,MAAM,iBACjBJ,IAAA,CAACG,UAAU;MAACC,MAAM,EAAEA,MAAO;MAAoBC,QAAQ,EAAEA;IAAS,GAAjCD,MAAM,CAACc,KAA4B,CACrE,CAAC;EAAA,CACsB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Button, Image, Label, Menu } from '@expo/ui/swift-ui';
|
|
4
|
+
import { disabled } from '@expo/ui/swift-ui/modifiers';
|
|
4
5
|
import { iconResourceName } from '@hzblj/expo-native-icons';
|
|
5
6
|
import { Icon } from "../../atoms/icon/index.js";
|
|
6
7
|
import { VStack } from "../../atoms/v-stack/index.js";
|
|
@@ -9,6 +10,7 @@ import { useHostGuard } from "../../host-context.js";
|
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
/** Matches `Fab`, so a screen can switch between the two without the button changing shape. */
|
|
11
12
|
const FAB_SIZE = 56;
|
|
13
|
+
const DISABLED = [disabled(true)];
|
|
12
14
|
export const FabMenu = ({
|
|
13
15
|
accessibilityLabel,
|
|
14
16
|
actions,
|
|
@@ -37,6 +39,7 @@ export const FabMenu = ({
|
|
|
37
39
|
}),
|
|
38
40
|
testID: testID,
|
|
39
41
|
children: actions.map(action => /*#__PURE__*/_jsx(Button, {
|
|
42
|
+
modifiers: action.disabled ? DISABLED : undefined,
|
|
40
43
|
onPress: action.onPress,
|
|
41
44
|
role: action.destructive ? 'destructive' : 'default',
|
|
42
45
|
children: /*#__PURE__*/_jsx(Label, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Image","Label","Menu","iconResourceName","Icon","VStack","Glyph","useHostGuard","jsx","_jsx","FAB_SIZE","FabMenu","accessibilityLabel","actions","icon","testID","label","align","bg","borderRadius","h","p","shadow","w","children","color","name","map","action","onPress","role","destructive","assetName","
|
|
1
|
+
{"version":3,"names":["Button","Image","Label","Menu","disabled","iconResourceName","Icon","VStack","Glyph","useHostGuard","jsx","_jsx","FAB_SIZE","DISABLED","FabMenu","accessibilityLabel","actions","icon","testID","label","align","bg","borderRadius","h","p","shadow","w","children","color","name","map","action","modifiers","undefined","onPress","role","destructive","assetName","title"],"sourceRoot":"../../../../src","sources":["organisms/fab-menu/fab-menu.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,QAAO,mBAAmB;AAC5D,SAAQC,QAAQ,QAAO,6BAA6B;AACpD,SAAQC,gBAAgB,QAAO,0BAA0B;AAEzD,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,8BAAqB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,IAAA,CAACV,KAAK;UAACoC,SAAS,EAAEhC,gBAAgB,CAAC0B,MAAM,CAACd,IAAI;QAAE,CAAE,CAAC,GAAGgB,SAAU;QACpFK,KAAK,EAAEP,MAAM,CAACZ;MAAM,CACrB;IAAC,GATGY,MAAM,CAACZ,KAUN,CACT;EAAC,CACE,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An action's colour in a row kara draws itself (the Android menus and sheets): greyed when disabled, as `IconButton`
|
|
5
|
+
* greys, red when destructive. A Compose `DropdownMenuItem` cannot grey its own text here, since the text sets its
|
|
6
|
+
* colour explicitly.
|
|
7
|
+
*/
|
|
8
|
+
export const menuActionColor = ({
|
|
9
|
+
destructive,
|
|
10
|
+
disabled
|
|
11
|
+
}) => {
|
|
12
|
+
if (disabled) {
|
|
13
|
+
return 'btn.content.disabled';
|
|
14
|
+
}
|
|
15
|
+
return destructive ? 'content.destructive' : 'content.primary';
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** A trigger with no text: the props' union guarantees its icon and the words a screen reader says for it. */
|
|
19
|
+
export const isIconOnly = props => props.label === undefined;
|
|
20
|
+
//# sourceMappingURL=menu-parts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["menuActionColor","destructive","disabled","isIconOnly","props","label","undefined"],"sourceRoot":"../../../../src","sources":["organisms/menu/menu-parts.ts"],"mappings":";;AAKA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,eAAe,GAAGA,CAAC;EAACC,WAAW;EAAEC;AAAoB,CAAC,KAAiB;EAClF,IAAIA,QAAQ,EAAE;IACZ,OAAO,sBAAsB;EAC/B;EAEA,OAAOD,WAAW,GAAG,qBAAqB,GAAG,iBAAiB;AAChE,CAAC;;AAED;AACA,OAAO,MAAME,UAAU,GAAIC,KAAgB,IACzCA,KAAK,CAACC,KAAK,KAAKC,SAAS","ignoreList":[]}
|
|
@@ -5,21 +5,24 @@ import { useAppTheme } from '@hzblj/kara-theme';
|
|
|
5
5
|
import { useCallback, useState } from 'react';
|
|
6
6
|
import { HStack } from "../../atoms/h-stack/index.js";
|
|
7
7
|
import { Icon } from "../../atoms/icon/index.js";
|
|
8
|
+
import { IconButton } from "../../atoms/icon-button/index.js";
|
|
8
9
|
import { Text } from "../../atoms/text/index.js";
|
|
9
10
|
import { Glyph } from "../../glyph/index.js";
|
|
10
11
|
import { useHostGuard } from "../../host-context.js";
|
|
12
|
+
import { isIconOnly, menuActionColor } from "./menu-parts.js";
|
|
11
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
14
|
const MenuItem = ({
|
|
13
15
|
action,
|
|
14
16
|
onDismiss
|
|
15
17
|
}) => {
|
|
16
18
|
const theme = useAppTheme();
|
|
17
|
-
const color = action
|
|
19
|
+
const color = menuActionColor(action);
|
|
18
20
|
return /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
19
21
|
elementColors: {
|
|
20
22
|
leadingIconColor: theme.color(color),
|
|
21
23
|
textColor: theme.color(color)
|
|
22
24
|
},
|
|
25
|
+
enabled: !action.disabled,
|
|
23
26
|
onClick: () => {
|
|
24
27
|
onDismiss();
|
|
25
28
|
action.onPress();
|
|
@@ -39,39 +42,68 @@ const MenuItem = ({
|
|
|
39
42
|
}) : null]
|
|
40
43
|
});
|
|
41
44
|
};
|
|
45
|
+
const triggerOf = (props, open) => {
|
|
46
|
+
if (isIconOnly(props)) {
|
|
47
|
+
// Material's overflow menu: an icon button, its label carried by the icon.
|
|
48
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
49
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
50
|
+
name: props.icon,
|
|
51
|
+
onPress: open,
|
|
52
|
+
testID: props.testID
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const {
|
|
56
|
+
accessibilityLabel,
|
|
57
|
+
icon,
|
|
58
|
+
label,
|
|
59
|
+
testID
|
|
60
|
+
} = props;
|
|
61
|
+
return /*#__PURE__*/_jsxs(HStack, {
|
|
62
|
+
accessibilityLabel: accessibilityLabel,
|
|
63
|
+
align: "center",
|
|
64
|
+
onPress: open,
|
|
65
|
+
spacing: "s4",
|
|
66
|
+
testID: testID,
|
|
67
|
+
children: [icon ? /*#__PURE__*/_jsxs(HStack, {
|
|
68
|
+
align: "center",
|
|
69
|
+
spacing: "s8",
|
|
70
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
71
|
+
color: "content.accent",
|
|
72
|
+
name: icon,
|
|
73
|
+
size: "s20"
|
|
74
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
75
|
+
color: "content.accent",
|
|
76
|
+
children: label
|
|
77
|
+
})]
|
|
78
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
79
|
+
color: "content.accent",
|
|
80
|
+
children: label
|
|
81
|
+
}), /*#__PURE__*/_jsx(Glyph, {
|
|
82
|
+
color: "content.accent",
|
|
83
|
+
name: "chevronDown",
|
|
84
|
+
size: "s16"
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
};
|
|
42
88
|
|
|
43
89
|
/**
|
|
44
90
|
* Material's dropdown menu, anchored to its trigger. The items live in the `Items` slot, which Compose presents in
|
|
45
91
|
* its own popup — anywhere else they would be laid out in place, on top of the trigger.
|
|
46
92
|
*/
|
|
47
|
-
export const Menu =
|
|
48
|
-
actions,
|
|
49
|
-
label
|
|
50
|
-
}) => {
|
|
93
|
+
export const Menu = props => {
|
|
51
94
|
useHostGuard('Menu');
|
|
52
95
|
const theme = useAppTheme();
|
|
53
96
|
const [expanded, setExpanded] = useState(false);
|
|
97
|
+
const open = useCallback(() => setExpanded(true), []);
|
|
54
98
|
const dismiss = useCallback(() => setExpanded(false), []);
|
|
55
99
|
return /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
56
100
|
color: theme.color('surface.primary'),
|
|
57
101
|
expanded: expanded,
|
|
58
102
|
onDismissRequest: dismiss,
|
|
59
103
|
children: [/*#__PURE__*/_jsx(DropdownMenu.Trigger, {
|
|
60
|
-
children:
|
|
61
|
-
align: "center",
|
|
62
|
-
onPress: () => setExpanded(true),
|
|
63
|
-
spacing: "s4",
|
|
64
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
65
|
-
color: "content.accent",
|
|
66
|
-
children: label
|
|
67
|
-
}), /*#__PURE__*/_jsx(Glyph, {
|
|
68
|
-
color: "content.accent",
|
|
69
|
-
name: "chevronDown",
|
|
70
|
-
size: "s16"
|
|
71
|
-
})]
|
|
72
|
-
})
|
|
104
|
+
children: triggerOf(props, open)
|
|
73
105
|
}), /*#__PURE__*/_jsx(DropdownMenu.Items, {
|
|
74
|
-
children: actions.map(action => /*#__PURE__*/_jsx(MenuItem, {
|
|
106
|
+
children: props.actions.map(action => /*#__PURE__*/_jsx(MenuItem, {
|
|
75
107
|
action: action,
|
|
76
108
|
onDismiss: dismiss
|
|
77
109
|
}, action.label))
|
|
@@ -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,gBAA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ftUIMenu } 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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I,GAAGM,SAAS,GAAGE,MAAM,CAACL,KAAM;MAC9ClB,SAAS,EAAEuB,MAAM,CAACvC,QAAQ,GAAGa,QAAQ,GAAGwB,SAAU;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;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AgB,EAC5BjC,OAAO;MAAA,CACmB;IAAC,CACrB;EAAC,CACR,CAAC;AAEX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMkC,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;
|