wn-native-ui 0.0.0-stage → 0.1.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 +11 -0
- package/LICENSE +21 -0
- package/README.md +128 -3
- package/lib/module/components/Avatar/Avatar.js +131 -0
- package/lib/module/components/Avatar/index.js +3 -0
- package/lib/module/components/Avatar/styles.js +49 -0
- package/lib/module/components/BottomActionBar/BottomActionBar.js +43 -0
- package/lib/module/components/BottomActionBar/index.js +3 -0
- package/lib/module/components/BottomActionBar/styles.js +22 -0
- package/lib/module/components/BottomSheet/BottomSheet.js +103 -0
- package/lib/module/components/BottomSheet/index.js +3 -0
- package/lib/module/components/BottomSheet/styles.js +84 -0
- package/lib/module/components/Button/Button.js +38 -0
- package/lib/module/components/Button/index.js +3 -0
- package/lib/module/components/Button/styles.js +50 -0
- package/lib/module/components/Checkbox/Checkbox.js +131 -0
- package/lib/module/components/Checkbox/index.js +3 -0
- package/lib/module/components/Checkbox/styles.js +64 -0
- package/lib/module/components/DatePicker/DatePicker.js +521 -0
- package/lib/module/components/DatePicker/index.js +3 -0
- package/lib/module/components/DatePicker/model.js +255 -0
- package/lib/module/components/DatePicker/styles.js +273 -0
- package/lib/module/components/Dialog/Dialog.js +146 -0
- package/lib/module/components/Dialog/index.js +3 -0
- package/lib/module/components/Dialog/styles.js +112 -0
- package/lib/module/components/EmptyState/EmptyState.js +56 -0
- package/lib/module/components/EmptyState/index.js +3 -0
- package/lib/module/components/EmptyState/styles.js +84 -0
- package/lib/module/components/Field/Field.js +54 -0
- package/lib/module/components/Field/FieldContext.js +7 -0
- package/lib/module/components/Field/index.js +3 -0
- package/lib/module/components/Field/styles.js +56 -0
- package/lib/module/components/FilterChips/FilterChips.js +74 -0
- package/lib/module/components/FilterChips/index.js +3 -0
- package/lib/module/components/FilterChips/styles.js +72 -0
- package/lib/module/components/Form/Form.js +53 -0
- package/lib/module/components/Form/FormItem.js +128 -0
- package/lib/module/components/Form/context.js +4 -0
- package/lib/module/components/Form/index.js +10 -0
- package/lib/module/components/Form/model.js +327 -0
- package/lib/module/components/Form/styles.js +10 -0
- package/lib/module/components/ImagePreview/ImagePreview.js +189 -0
- package/lib/module/components/ImagePreview/index.js +3 -0
- package/lib/module/components/ImagePreview/styles.js +87 -0
- package/lib/module/components/InlineFeedback/InlineFeedback.js +78 -0
- package/lib/module/components/InlineFeedback/index.js +3 -0
- package/lib/module/components/InlineFeedback/styles.js +148 -0
- package/lib/module/components/Input/Input.js +50 -0
- package/lib/module/components/Input/index.js +3 -0
- package/lib/module/components/Input/styles.js +41 -0
- package/lib/module/components/ListSkeleton/ListSkeleton.js +50 -0
- package/lib/module/components/ListSkeleton/index.js +3 -0
- package/lib/module/components/ListSkeleton/styles.js +30 -0
- package/lib/module/components/NavigationBar/NavigationBar.js +170 -0
- package/lib/module/components/NavigationBar/index.js +3 -0
- package/lib/module/components/NavigationBar/styles.js +98 -0
- package/lib/module/components/Picker/Picker.js +156 -0
- package/lib/module/components/Picker/index.js +3 -0
- package/lib/module/components/Picker/styles.js +96 -0
- package/lib/module/components/Radio/Radio.js +114 -0
- package/lib/module/components/Radio/index.js +3 -0
- package/lib/module/components/Radio/styles.js +70 -0
- package/lib/module/components/SearchInput/SearchInput.js +102 -0
- package/lib/module/components/SearchInput/index.js +3 -0
- package/lib/module/components/SearchInput/styles.js +106 -0
- package/lib/module/components/SideDrawer/SideDrawer.js +161 -0
- package/lib/module/components/SideDrawer/index.js +3 -0
- package/lib/module/components/SideDrawer/styles.js +89 -0
- package/lib/module/components/Skeleton/Skeleton.js +66 -0
- package/lib/module/components/Skeleton/index.js +3 -0
- package/lib/module/components/Skeleton/styles.js +18 -0
- package/lib/module/components/Switch/Switch.js +61 -0
- package/lib/module/components/Switch/index.js +3 -0
- package/lib/module/components/Switch/styles.js +33 -0
- package/lib/module/components/TabBar/TabBar.js +68 -0
- package/lib/module/components/TabBar/index.js +3 -0
- package/lib/module/components/TabBar/styles.js +84 -0
- package/lib/module/components/Tabs/Tabs.js +65 -0
- package/lib/module/components/Tabs/index.js +3 -0
- package/lib/module/components/Tabs/styles.js +99 -0
- package/lib/module/components/Tag/Tag.js +171 -0
- package/lib/module/components/Tag/index.js +3 -0
- package/lib/module/components/Tag/styles.js +163 -0
- package/lib/module/components/TextArea/TextArea.js +74 -0
- package/lib/module/components/TextArea/index.js +3 -0
- package/lib/module/components/TextArea/styles.js +45 -0
- package/lib/module/components/TimePicker/TimePicker.js +262 -0
- package/lib/module/components/TimePicker/index.js +3 -0
- package/lib/module/components/TimePicker/model.js +63 -0
- package/lib/module/components/TimePicker/styles.js +143 -0
- package/lib/module/components/Timeline/Timeline.js +154 -0
- package/lib/module/components/Timeline/index.js +3 -0
- package/lib/module/components/Timeline/model.js +36 -0
- package/lib/module/components/Timeline/styles.js +115 -0
- package/lib/module/components/Toast/Toast.js +249 -0
- package/lib/module/components/Toast/index.js +3 -0
- package/lib/module/components/Toast/styles.js +61 -0
- package/lib/module/components/Upload/Upload.js +762 -0
- package/lib/module/components/Upload/index.js +3 -0
- package/lib/module/components/Upload/model.js +3 -0
- package/lib/module/components/Upload/picker.js +97 -0
- package/lib/module/components/Upload/styles.js +358 -0
- package/lib/module/components/index.js +32 -0
- package/lib/module/index.js +4 -0
- package/lib/module/package.json +1 -0
- package/lib/module/ui/tokens.js +174 -0
- package/lib/typescript/components/Avatar/Avatar.d.ts +20 -0
- package/lib/typescript/components/Avatar/Avatar.d.ts.map +1 -0
- package/lib/typescript/components/Avatar/index.d.ts +3 -0
- package/lib/typescript/components/Avatar/index.d.ts.map +1 -0
- package/lib/typescript/components/Avatar/styles.d.ts +46 -0
- package/lib/typescript/components/Avatar/styles.d.ts.map +1 -0
- package/lib/typescript/components/BottomActionBar/BottomActionBar.d.ts +17 -0
- package/lib/typescript/components/BottomActionBar/BottomActionBar.d.ts.map +1 -0
- package/lib/typescript/components/BottomActionBar/index.d.ts +3 -0
- package/lib/typescript/components/BottomActionBar/index.d.ts.map +1 -0
- package/lib/typescript/components/BottomActionBar/styles.d.ts +19 -0
- package/lib/typescript/components/BottomActionBar/styles.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet/BottomSheet.d.ts +19 -0
- package/lib/typescript/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet/index.d.ts +3 -0
- package/lib/typescript/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet/styles.d.ts +86 -0
- package/lib/typescript/components/BottomSheet/styles.d.ts.map +1 -0
- package/lib/typescript/components/Button/Button.d.ts +12 -0
- package/lib/typescript/components/Button/Button.d.ts.map +1 -0
- package/lib/typescript/components/Button/index.d.ts +3 -0
- package/lib/typescript/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/components/Button/styles.d.ts +48 -0
- package/lib/typescript/components/Button/styles.d.ts.map +1 -0
- package/lib/typescript/components/Checkbox/Checkbox.d.ts +39 -0
- package/lib/typescript/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/lib/typescript/components/Checkbox/index.d.ts +3 -0
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -0
- package/lib/typescript/components/Checkbox/styles.d.ts +65 -0
- package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -0
- package/lib/typescript/components/DatePicker/DatePicker.d.ts +40 -0
- package/lib/typescript/components/DatePicker/DatePicker.d.ts.map +1 -0
- package/lib/typescript/components/DatePicker/index.d.ts +4 -0
- package/lib/typescript/components/DatePicker/index.d.ts.map +1 -0
- package/lib/typescript/components/DatePicker/model.d.ts +49 -0
- package/lib/typescript/components/DatePicker/model.d.ts.map +1 -0
- package/lib/typescript/components/DatePicker/styles.d.ts +287 -0
- package/lib/typescript/components/DatePicker/styles.d.ts.map +1 -0
- package/lib/typescript/components/Dialog/Dialog.d.ts +35 -0
- package/lib/typescript/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/typescript/components/Dialog/index.d.ts +3 -0
- package/lib/typescript/components/Dialog/index.d.ts.map +1 -0
- package/lib/typescript/components/Dialog/styles.d.ts +114 -0
- package/lib/typescript/components/Dialog/styles.d.ts.map +1 -0
- package/lib/typescript/components/EmptyState/EmptyState.d.ts +13 -0
- package/lib/typescript/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/lib/typescript/components/EmptyState/index.d.ts +3 -0
- package/lib/typescript/components/EmptyState/index.d.ts.map +1 -0
- package/lib/typescript/components/EmptyState/styles.d.ts +86 -0
- package/lib/typescript/components/EmptyState/styles.d.ts.map +1 -0
- package/lib/typescript/components/Field/Field.d.ts +14 -0
- package/lib/typescript/components/Field/Field.d.ts.map +1 -0
- package/lib/typescript/components/Field/FieldContext.d.ts +8 -0
- package/lib/typescript/components/Field/FieldContext.d.ts.map +1 -0
- package/lib/typescript/components/Field/index.d.ts +3 -0
- package/lib/typescript/components/Field/index.d.ts.map +1 -0
- package/lib/typescript/components/Field/styles.d.ts +58 -0
- package/lib/typescript/components/Field/styles.d.ts.map +1 -0
- package/lib/typescript/components/FilterChips/FilterChips.d.ts +23 -0
- package/lib/typescript/components/FilterChips/FilterChips.d.ts.map +1 -0
- package/lib/typescript/components/FilterChips/index.d.ts +3 -0
- package/lib/typescript/components/FilterChips/index.d.ts.map +1 -0
- package/lib/typescript/components/FilterChips/styles.d.ts +75 -0
- package/lib/typescript/components/FilterChips/styles.d.ts.map +1 -0
- package/lib/typescript/components/Form/Form.d.ts +17 -0
- package/lib/typescript/components/Form/Form.d.ts.map +1 -0
- package/lib/typescript/components/Form/FormItem.d.ts +29 -0
- package/lib/typescript/components/Form/FormItem.d.ts.map +1 -0
- package/lib/typescript/components/Form/context.d.ts +8 -0
- package/lib/typescript/components/Form/context.d.ts.map +1 -0
- package/lib/typescript/components/Form/index.d.ts +12 -0
- package/lib/typescript/components/Form/index.d.ts.map +1 -0
- package/lib/typescript/components/Form/model.d.ts +82 -0
- package/lib/typescript/components/Form/model.d.ts.map +1 -0
- package/lib/typescript/components/Form/styles.d.ts +7 -0
- package/lib/typescript/components/Form/styles.d.ts.map +1 -0
- package/lib/typescript/components/ImagePreview/ImagePreview.d.ts +17 -0
- package/lib/typescript/components/ImagePreview/ImagePreview.d.ts.map +1 -0
- package/lib/typescript/components/ImagePreview/index.d.ts +3 -0
- package/lib/typescript/components/ImagePreview/index.d.ts.map +1 -0
- package/lib/typescript/components/ImagePreview/styles.d.ts +87 -0
- package/lib/typescript/components/ImagePreview/styles.d.ts.map +1 -0
- package/lib/typescript/components/InlineFeedback/InlineFeedback.d.ts +13 -0
- package/lib/typescript/components/InlineFeedback/InlineFeedback.d.ts.map +1 -0
- package/lib/typescript/components/InlineFeedback/index.d.ts +3 -0
- package/lib/typescript/components/InlineFeedback/index.d.ts.map +1 -0
- package/lib/typescript/components/InlineFeedback/styles.d.ts +151 -0
- package/lib/typescript/components/InlineFeedback/styles.d.ts.map +1 -0
- package/lib/typescript/components/Input/Input.d.ts +14 -0
- package/lib/typescript/components/Input/Input.d.ts.map +1 -0
- package/lib/typescript/components/Input/index.d.ts +3 -0
- package/lib/typescript/components/Input/index.d.ts.map +1 -0
- package/lib/typescript/components/Input/styles.d.ts +40 -0
- package/lib/typescript/components/Input/styles.d.ts.map +1 -0
- package/lib/typescript/components/ListSkeleton/ListSkeleton.d.ts +10 -0
- package/lib/typescript/components/ListSkeleton/ListSkeleton.d.ts.map +1 -0
- package/lib/typescript/components/ListSkeleton/index.d.ts +3 -0
- package/lib/typescript/components/ListSkeleton/index.d.ts.map +1 -0
- package/lib/typescript/components/ListSkeleton/styles.d.ts +27 -0
- package/lib/typescript/components/ListSkeleton/styles.d.ts.map +1 -0
- package/lib/typescript/components/NavigationBar/NavigationBar.d.ts +34 -0
- package/lib/typescript/components/NavigationBar/NavigationBar.d.ts.map +1 -0
- package/lib/typescript/components/NavigationBar/index.d.ts +3 -0
- package/lib/typescript/components/NavigationBar/index.d.ts.map +1 -0
- package/lib/typescript/components/NavigationBar/styles.d.ts +97 -0
- package/lib/typescript/components/NavigationBar/styles.d.ts.map +1 -0
- package/lib/typescript/components/Picker/Picker.d.ts +32 -0
- package/lib/typescript/components/Picker/Picker.d.ts.map +1 -0
- package/lib/typescript/components/Picker/index.d.ts +3 -0
- package/lib/typescript/components/Picker/index.d.ts.map +1 -0
- package/lib/typescript/components/Picker/styles.d.ts +99 -0
- package/lib/typescript/components/Picker/styles.d.ts.map +1 -0
- package/lib/typescript/components/Radio/Radio.d.ts +38 -0
- package/lib/typescript/components/Radio/Radio.d.ts.map +1 -0
- package/lib/typescript/components/Radio/index.d.ts +3 -0
- package/lib/typescript/components/Radio/index.d.ts.map +1 -0
- package/lib/typescript/components/Radio/styles.d.ts +71 -0
- package/lib/typescript/components/Radio/styles.d.ts.map +1 -0
- package/lib/typescript/components/SearchInput/SearchInput.d.ts +20 -0
- package/lib/typescript/components/SearchInput/SearchInput.d.ts.map +1 -0
- package/lib/typescript/components/SearchInput/index.d.ts +3 -0
- package/lib/typescript/components/SearchInput/index.d.ts.map +1 -0
- package/lib/typescript/components/SearchInput/styles.d.ts +105 -0
- package/lib/typescript/components/SearchInput/styles.d.ts.map +1 -0
- package/lib/typescript/components/SideDrawer/SideDrawer.d.ts +19 -0
- package/lib/typescript/components/SideDrawer/SideDrawer.d.ts.map +1 -0
- package/lib/typescript/components/SideDrawer/index.d.ts +3 -0
- package/lib/typescript/components/SideDrawer/index.d.ts.map +1 -0
- package/lib/typescript/components/SideDrawer/styles.d.ts +88 -0
- package/lib/typescript/components/SideDrawer/styles.d.ts.map +1 -0
- package/lib/typescript/components/Skeleton/Skeleton.d.ts +11 -0
- package/lib/typescript/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/typescript/components/Skeleton/index.d.ts +3 -0
- package/lib/typescript/components/Skeleton/index.d.ts.map +1 -0
- package/lib/typescript/components/Skeleton/styles.d.ts +15 -0
- package/lib/typescript/components/Skeleton/styles.d.ts.map +1 -0
- package/lib/typescript/components/Switch/Switch.d.ts +9 -0
- package/lib/typescript/components/Switch/Switch.d.ts.map +1 -0
- package/lib/typescript/components/Switch/index.d.ts +3 -0
- package/lib/typescript/components/Switch/index.d.ts.map +1 -0
- package/lib/typescript/components/Switch/styles.d.ts +30 -0
- package/lib/typescript/components/Switch/styles.d.ts.map +1 -0
- package/lib/typescript/components/TabBar/TabBar.d.ts +26 -0
- package/lib/typescript/components/TabBar/TabBar.d.ts.map +1 -0
- package/lib/typescript/components/TabBar/index.d.ts +3 -0
- package/lib/typescript/components/TabBar/index.d.ts.map +1 -0
- package/lib/typescript/components/TabBar/styles.d.ts +82 -0
- package/lib/typescript/components/TabBar/styles.d.ts.map +1 -0
- package/lib/typescript/components/Tabs/Tabs.d.ts +21 -0
- package/lib/typescript/components/Tabs/Tabs.d.ts.map +1 -0
- package/lib/typescript/components/Tabs/index.d.ts +3 -0
- package/lib/typescript/components/Tabs/index.d.ts.map +1 -0
- package/lib/typescript/components/Tabs/styles.d.ts +100 -0
- package/lib/typescript/components/Tabs/styles.d.ts.map +1 -0
- package/lib/typescript/components/Tag/Tag.d.ts +22 -0
- package/lib/typescript/components/Tag/Tag.d.ts.map +1 -0
- package/lib/typescript/components/Tag/index.d.ts +3 -0
- package/lib/typescript/components/Tag/index.d.ts.map +1 -0
- package/lib/typescript/components/Tag/styles.d.ts +164 -0
- package/lib/typescript/components/Tag/styles.d.ts.map +1 -0
- package/lib/typescript/components/TextArea/TextArea.d.ts +16 -0
- package/lib/typescript/components/TextArea/TextArea.d.ts.map +1 -0
- package/lib/typescript/components/TextArea/index.d.ts +3 -0
- package/lib/typescript/components/TextArea/index.d.ts.map +1 -0
- package/lib/typescript/components/TextArea/styles.d.ts +46 -0
- package/lib/typescript/components/TextArea/styles.d.ts.map +1 -0
- package/lib/typescript/components/TimePicker/TimePicker.d.ts +17 -0
- package/lib/typescript/components/TimePicker/TimePicker.d.ts.map +1 -0
- package/lib/typescript/components/TimePicker/index.d.ts +4 -0
- package/lib/typescript/components/TimePicker/index.d.ts.map +1 -0
- package/lib/typescript/components/TimePicker/model.d.ts +16 -0
- package/lib/typescript/components/TimePicker/model.d.ts.map +1 -0
- package/lib/typescript/components/TimePicker/styles.d.ts +150 -0
- package/lib/typescript/components/TimePicker/styles.d.ts.map +1 -0
- package/lib/typescript/components/Timeline/Timeline.d.ts +12 -0
- package/lib/typescript/components/Timeline/Timeline.d.ts.map +1 -0
- package/lib/typescript/components/Timeline/index.d.ts +4 -0
- package/lib/typescript/components/Timeline/index.d.ts.map +1 -0
- package/lib/typescript/components/Timeline/model.d.ts +45 -0
- package/lib/typescript/components/Timeline/model.d.ts.map +1 -0
- package/lib/typescript/components/Timeline/styles.d.ts +120 -0
- package/lib/typescript/components/Timeline/styles.d.ts.map +1 -0
- package/lib/typescript/components/Toast/Toast.d.ts +30 -0
- package/lib/typescript/components/Toast/Toast.d.ts.map +1 -0
- package/lib/typescript/components/Toast/index.d.ts +3 -0
- package/lib/typescript/components/Toast/index.d.ts.map +1 -0
- package/lib/typescript/components/Toast/styles.d.ts +59 -0
- package/lib/typescript/components/Toast/styles.d.ts.map +1 -0
- package/lib/typescript/components/Upload/Upload.d.ts +31 -0
- package/lib/typescript/components/Upload/Upload.d.ts.map +1 -0
- package/lib/typescript/components/Upload/index.d.ts +4 -0
- package/lib/typescript/components/Upload/index.d.ts.map +1 -0
- package/lib/typescript/components/Upload/model.d.ts +50 -0
- package/lib/typescript/components/Upload/model.d.ts.map +1 -0
- package/lib/typescript/components/Upload/picker.d.ts +13 -0
- package/lib/typescript/components/Upload/picker.d.ts.map +1 -0
- package/lib/typescript/components/Upload/styles.d.ts +376 -0
- package/lib/typescript/components/Upload/styles.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +61 -0
- package/lib/typescript/components/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/ui/tokens.d.ts +167 -0
- package/lib/typescript/ui/tokens.d.ts.map +1 -0
- package/package.json +216 -6
- package/src/components/Avatar/Avatar.tsx +192 -0
- package/src/components/Avatar/README.md +32 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Avatar/styles.ts +49 -0
- package/src/components/BottomActionBar/BottomActionBar.tsx +53 -0
- package/src/components/BottomActionBar/README.md +50 -0
- package/src/components/BottomActionBar/index.ts +2 -0
- package/src/components/BottomActionBar/styles.ts +22 -0
- package/src/components/BottomSheet/BottomSheet.tsx +136 -0
- package/src/components/BottomSheet/README.md +51 -0
- package/src/components/BottomSheet/index.ts +2 -0
- package/src/components/BottomSheet/styles.ts +84 -0
- package/src/components/Button/Button.tsx +65 -0
- package/src/components/Button/README.md +59 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Button/styles.ts +50 -0
- package/src/components/Checkbox/Checkbox.tsx +220 -0
- package/src/components/Checkbox/README.md +60 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Checkbox/styles.ts +64 -0
- package/src/components/DatePicker/DatePicker.tsx +728 -0
- package/src/components/DatePicker/README.md +88 -0
- package/src/components/DatePicker/index.ts +9 -0
- package/src/components/DatePicker/model.ts +316 -0
- package/src/components/DatePicker/styles.ts +267 -0
- package/src/components/Dialog/Dialog.tsx +254 -0
- package/src/components/Dialog/README.md +98 -0
- package/src/components/Dialog/index.ts +2 -0
- package/src/components/Dialog/styles.ts +109 -0
- package/src/components/EmptyState/EmptyState.tsx +58 -0
- package/src/components/EmptyState/README.md +44 -0
- package/src/components/EmptyState/index.ts +2 -0
- package/src/components/EmptyState/styles.ts +82 -0
- package/src/components/Field/Field.tsx +59 -0
- package/src/components/Field/FieldContext.ts +13 -0
- package/src/components/Field/README.md +68 -0
- package/src/components/Field/index.ts +2 -0
- package/src/components/Field/styles.ts +56 -0
- package/src/components/FilterChips/FilterChips.tsx +110 -0
- package/src/components/FilterChips/README.md +69 -0
- package/src/components/FilterChips/index.ts +2 -0
- package/src/components/FilterChips/styles.ts +72 -0
- package/src/components/Form/Form.tsx +77 -0
- package/src/components/Form/FormItem.tsx +204 -0
- package/src/components/Form/README.md +101 -0
- package/src/components/Form/context.ts +11 -0
- package/src/components/Form/index.ts +25 -0
- package/src/components/Form/model.ts +427 -0
- package/src/components/Form/styles.ts +10 -0
- package/src/components/ImagePreview/ImagePreview.tsx +207 -0
- package/src/components/ImagePreview/README.md +51 -0
- package/src/components/ImagePreview/index.ts +2 -0
- package/src/components/ImagePreview/styles.ts +87 -0
- package/src/components/InlineFeedback/InlineFeedback.tsx +88 -0
- package/src/components/InlineFeedback/README.md +47 -0
- package/src/components/InlineFeedback/index.ts +2 -0
- package/src/components/InlineFeedback/styles.ts +140 -0
- package/src/components/Input/Input.tsx +79 -0
- package/src/components/Input/README.md +62 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Input/styles.ts +41 -0
- package/src/components/ListSkeleton/ListSkeleton.tsx +48 -0
- package/src/components/ListSkeleton/README.md +37 -0
- package/src/components/ListSkeleton/index.ts +2 -0
- package/src/components/ListSkeleton/styles.ts +30 -0
- package/src/components/NavigationBar/NavigationBar.tsx +218 -0
- package/src/components/NavigationBar/README.md +72 -0
- package/src/components/NavigationBar/index.ts +7 -0
- package/src/components/NavigationBar/styles.ts +98 -0
- package/src/components/Picker/Picker.tsx +238 -0
- package/src/components/Picker/README.md +76 -0
- package/src/components/Picker/index.ts +8 -0
- package/src/components/Picker/styles.ts +94 -0
- package/src/components/README.md +44 -0
- package/src/components/Radio/README.md +52 -0
- package/src/components/Radio/Radio.tsx +195 -0
- package/src/components/Radio/index.ts +2 -0
- package/src/components/Radio/styles.ts +70 -0
- package/src/components/SearchInput/README.md +48 -0
- package/src/components/SearchInput/SearchInput.tsx +131 -0
- package/src/components/SearchInput/index.ts +2 -0
- package/src/components/SearchInput/styles.ts +100 -0
- package/src/components/SideDrawer/README.md +48 -0
- package/src/components/SideDrawer/SideDrawer.tsx +198 -0
- package/src/components/SideDrawer/index.ts +2 -0
- package/src/components/SideDrawer/styles.ts +86 -0
- package/src/components/Skeleton/README.md +38 -0
- package/src/components/Skeleton/Skeleton.tsx +108 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/Skeleton/styles.ts +18 -0
- package/src/components/Switch/README.md +27 -0
- package/src/components/Switch/Switch.tsx +77 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Switch/styles.ts +33 -0
- package/src/components/TabBar/README.md +66 -0
- package/src/components/TabBar/TabBar.tsx +93 -0
- package/src/components/TabBar/index.ts +2 -0
- package/src/components/TabBar/styles.ts +81 -0
- package/src/components/Tabs/README.md +64 -0
- package/src/components/Tabs/Tabs.tsx +114 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Tabs/styles.ts +99 -0
- package/src/components/Tag/README.md +60 -0
- package/src/components/Tag/Tag.tsx +166 -0
- package/src/components/Tag/index.ts +2 -0
- package/src/components/Tag/styles.ts +159 -0
- package/src/components/TextArea/README.md +61 -0
- package/src/components/TextArea/TextArea.tsx +114 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextArea/styles.ts +45 -0
- package/src/components/TimePicker/README.md +62 -0
- package/src/components/TimePicker/TimePicker.tsx +343 -0
- package/src/components/TimePicker/index.ts +3 -0
- package/src/components/TimePicker/model.ts +88 -0
- package/src/components/TimePicker/styles.ts +141 -0
- package/src/components/Timeline/README.md +81 -0
- package/src/components/Timeline/Timeline.tsx +197 -0
- package/src/components/Timeline/index.ts +12 -0
- package/src/components/Timeline/model.ts +87 -0
- package/src/components/Timeline/styles.ts +115 -0
- package/src/components/Toast/README.md +68 -0
- package/src/components/Toast/Toast.tsx +310 -0
- package/src/components/Toast/index.ts +8 -0
- package/src/components/Toast/styles.ts +58 -0
- package/src/components/Upload/README.md +93 -0
- package/src/components/Upload/Upload.tsx +839 -0
- package/src/components/Upload/index.ts +14 -0
- package/src/components/Upload/model.ts +61 -0
- package/src/components/Upload/picker.ts +125 -0
- package/src/components/Upload/styles.ts +358 -0
- package/src/components/index.ts +119 -0
- package/src/index.ts +2 -0
- package/src/ui/tokens.ts +144 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 更新记录
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
- 品牌统一为 WN UI,npm 包名为 wn-native-ui,同步展示项目、导入路径及安装文档。
|
|
6
|
+
|
|
7
|
+
- 提取 30 组 React Native 公共组件,保留原交互与默认视觉。
|
|
8
|
+
- 移除原项目的路径别名,提供包入口、组件子路径和 token 导出。
|
|
9
|
+
- 增加 ES Module、TypeScript 声明、npm 打包和格式化配置。
|
|
10
|
+
- 展示应用独立放入 example,通过实际 tgz 安装组件库。
|
|
11
|
+
- 原始提取文件保存在 archive,不随 npm 包分发。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 yee
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,128 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# WN UI
|
|
2
|
+
|
|
3
|
+
30 组可复用的 React Native 公共组件,提供 TypeScript 类型、统一入口、单组件子路径和默认 UI token。不依赖原项目的路由、接口、登录态或 `@/` 路径别名。
|
|
4
|
+
|
|
5
|
+
包名 `wn-native-ui`、版本 `0.1.0`,目前仅用于本地安装,尚未发布到 npm。`private: true` 防止误发布;`UNLICENSED` 表示尚未授权公开分发,并非开源许可证。
|
|
6
|
+
|
|
7
|
+
## 在其他项目安装
|
|
8
|
+
|
|
9
|
+
适用于 Expo / React Native 工程,不是普通 React DOM 组件库。本版沿用源项目依赖范围:Expo SDK 56、React 19.2.3、React Native 0.85.3。其他版本需单独验证,不建议使用 `--force` 跳过依赖冲突。
|
|
10
|
+
|
|
11
|
+
在已有的兼容 Expo 工程根目录执行:
|
|
12
|
+
|
|
13
|
+
```powershell
|
|
14
|
+
npx expo install expo-document-picker expo-image expo-image-picker expo-linear-gradient react-native-safe-area-context react-native-svg
|
|
15
|
+
npm install "D:/code/compontent/artifacts/wn-native-ui-0.1.0.tgz"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
也可将 `.tgz` 复制到目标项目的 `vendor/` 后执行:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install ./vendor/wn-native-ui-0.1.0.tgz
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
推荐安装 tgz,避免本地目录链接导致 React 多实例。不要从公共 npm 仓库直接安装同名包:此包尚未发布,同名包可能属于其他人。
|
|
25
|
+
|
|
26
|
+
裸 React Native 工程需要先接入 Expo Modules,并安装兼容的原生依赖。iOS 按宿主流程安装 Pods;新增原生模块或更改相机/相册权限后需要重新构建 App。
|
|
27
|
+
|
|
28
|
+
## 最小示例
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { View } from 'react-native';
|
|
32
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
33
|
+
import { Button, Toast, ToastProvider } from 'wn-native-ui';
|
|
34
|
+
|
|
35
|
+
export default function App() {
|
|
36
|
+
return (
|
|
37
|
+
<SafeAreaProvider>
|
|
38
|
+
<ToastProvider>
|
|
39
|
+
<View style={{ flex: 1, justifyContent: 'center', padding: 24 }}>
|
|
40
|
+
<Button onPress={() => Toast.success('保存成功')}>保存</Button>
|
|
41
|
+
</View>
|
|
42
|
+
</ToastProvider>
|
|
43
|
+
</SafeAreaProvider>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
宿主已有 SafeAreaProvider 时沿用现有 Provider。ToastProvider 全局挂载一次。库不要求使用 Expo Router,路由依赖仅属于展示项目。
|
|
49
|
+
|
|
50
|
+
统一入口与子路径都可使用:
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { Button, Form, Input, type ButtonProps } from 'wn-native-ui';
|
|
54
|
+
import { DatePicker, type DatePickerProps } from 'wn-native-ui/DatePicker';
|
|
55
|
+
import { uiTokens } from 'wn-native-ui/tokens';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
子路径只公开组件入口,不公开内部实现。单组件导入不意味着可以忽略本版声明的 peerDependencies。
|
|
59
|
+
|
|
60
|
+
## 宿主责任与兼容边界
|
|
61
|
+
|
|
62
|
+
- 业务数据、接口请求和持久化由宿主提供。
|
|
63
|
+
- Upload 的 `upload` 回调由宿主对接真实上传服务;不提供时选择结果保留为待上传。展示页的 simulateUpload 仅供演示。
|
|
64
|
+
- 相机、相册、文件选择依赖 Expo 模块;权限文案、系统授权和原生构建由宿主配置。图片选择器插件配置可参考 `example/app.json`。
|
|
65
|
+
- 保留原组件默认视觉,可通过已暴露的 style、titleStyle 等属性调整。uiTokens 用于读取默认样式,本版没有运行时主题切换,不应修改 token 对象来切换主题。
|
|
66
|
+
- 默认文案含中文,是否可以覆盖取决于各组件 Props;本版未完成完整国际化。
|
|
67
|
+
- Web 需要 React Native Web。SSR、Node 服务端直接渲染及纯 React DOM 项目不在验证范围。
|
|
68
|
+
|
|
69
|
+
Props、事件与示例见 [组件目录](src/components/README.md) 及各组件的 README。
|
|
70
|
+
|
|
71
|
+
## 开发和打包
|
|
72
|
+
|
|
73
|
+
本次工具环境为 Node.js 22.22.0 / npm 10.9.4。
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm ci
|
|
77
|
+
npm run format
|
|
78
|
+
npm run format:check
|
|
79
|
+
npm run typecheck
|
|
80
|
+
npm run build
|
|
81
|
+
npm run verify:package
|
|
82
|
+
npm pack --dry-run
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
生成安装包:
|
|
86
|
+
|
|
87
|
+
```powershell
|
|
88
|
+
New-Item -ItemType Directory -Path artifacts -Force
|
|
89
|
+
npm pack --pack-destination artifacts
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
prepack 自动执行类型检查、构建和包入口检查。安装 tgz 不会在使用方执行组件库构建。lib 包含 ES Module 与 `.d.ts` 声明;运行时依赖由宿主提供,React 没有打进产物。
|
|
93
|
+
|
|
94
|
+
## 展示项目
|
|
95
|
+
|
|
96
|
+
先生成 tgz,再执行:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd example
|
|
100
|
+
npm ci
|
|
101
|
+
npm run typecheck
|
|
102
|
+
npm run android
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
macOS / Xcode 环境可运行 `npm run ios`。`npm run web` 用于 Web 布局检查,示例固定使用端口 5188,请先确保可用。
|
|
106
|
+
|
|
107
|
+
示例使用 `file:../artifacts/wn-native-ui-0.1.0.tgz` 安装真实包,不使用指向库源码的别名。库更新后需要重新打包并更新安装;正式维护时递增版本,同时更新示例的 tgz 路径和锁文件,避免同版本缓存。
|
|
108
|
+
|
|
109
|
+
## 目录
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
src/index.ts 公共包入口
|
|
113
|
+
src/components/ 30 组组件与文档
|
|
114
|
+
src/ui/tokens.ts 默认样式 token
|
|
115
|
+
lib/ 自动生成的 JS 与类型声明
|
|
116
|
+
example/ 独立 Expo 展示应用
|
|
117
|
+
scripts/verify-package.mjs 包入口、路径及依赖检查
|
|
118
|
+
artifacts/ npm 安装包
|
|
119
|
+
archive/ 原始提取 ZIP、清单、依赖记录和说明
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
archive 的 SHA-256 清单仅对应原始备份,不对应整理后的文件。example、archive、artifacts、锁文件和开发脚本不随 npm 包分发。
|
|
123
|
+
|
|
124
|
+
## 发布准备
|
|
125
|
+
|
|
126
|
+
发布前确定自己拥有的 npm 包名或 scope、分发范围和许可证,再调整 private、license、包名及示例中的导入路径。本次没有登录或发布到 npm。
|
|
127
|
+
|
|
128
|
+
构建参考 [React Native Builder Bob](https://oss.callstack.com/react-native-builder-bob/build),打包参考 [npm pack](https://docs.npmjs.com/cli/v11/commands/npm-pack/)。
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
import { Image, Text, View } from 'react-native';
|
|
5
|
+
import { styles } from "./styles.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export function Avatar({
|
|
8
|
+
accessibilityLabel,
|
|
9
|
+
decorative = false,
|
|
10
|
+
fallback,
|
|
11
|
+
label,
|
|
12
|
+
shape = 'circle',
|
|
13
|
+
size = 'large',
|
|
14
|
+
source,
|
|
15
|
+
src,
|
|
16
|
+
style,
|
|
17
|
+
testID,
|
|
18
|
+
textStyle,
|
|
19
|
+
tone = 'accent'
|
|
20
|
+
}) {
|
|
21
|
+
const [failedImageKey, setFailedImageKey] = useState('');
|
|
22
|
+
const imageSource = source ?? (src ? {
|
|
23
|
+
uri: src
|
|
24
|
+
} : undefined);
|
|
25
|
+
const imageSourceKey = useMemo(() => getImageSourceKey(source, src), [source, src]);
|
|
26
|
+
const sizeValue = resolveAvatarSize(size);
|
|
27
|
+
const radius = shape === 'circle' ? sizeValue / 2 : resolveRoundedRadius(sizeValue);
|
|
28
|
+
const textMetrics = resolveTextMetrics(sizeValue);
|
|
29
|
+
const initial = getAvatarInitial(fallback ?? label);
|
|
30
|
+
const showImage = Boolean(imageSource && failedImageKey !== imageSourceKey);
|
|
31
|
+
return /*#__PURE__*/_jsx(View, {
|
|
32
|
+
accessibilityElementsHidden: decorative,
|
|
33
|
+
accessibilityLabel: decorative ? undefined : accessibilityLabel ?? getAvatarAccessibilityLabel(label),
|
|
34
|
+
accessibilityRole: decorative ? undefined : 'image',
|
|
35
|
+
accessible: !decorative,
|
|
36
|
+
importantForAccessibility: decorative ? 'no-hide-descendants' : 'auto',
|
|
37
|
+
style: [styles.root, stylesByTone[tone].root, {
|
|
38
|
+
borderRadius: radius,
|
|
39
|
+
height: sizeValue,
|
|
40
|
+
width: sizeValue
|
|
41
|
+
}, style],
|
|
42
|
+
testID: testID,
|
|
43
|
+
children: showImage && imageSource ? /*#__PURE__*/_jsx(Image, {
|
|
44
|
+
accessibilityIgnoresInvertColors: true,
|
|
45
|
+
onError: () => setFailedImageKey(imageSourceKey),
|
|
46
|
+
resizeMode: "cover",
|
|
47
|
+
source: imageSource,
|
|
48
|
+
style: [styles.image, {
|
|
49
|
+
borderRadius: radius
|
|
50
|
+
}]
|
|
51
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
52
|
+
allowFontScaling: false,
|
|
53
|
+
numberOfLines: 1,
|
|
54
|
+
style: [styles.text, stylesByTone[tone].text, textMetrics, textStyle],
|
|
55
|
+
children: initial
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const stylesByTone = {
|
|
60
|
+
accent: {
|
|
61
|
+
root: styles.accentRoot,
|
|
62
|
+
text: styles.accentText
|
|
63
|
+
},
|
|
64
|
+
neutral: {
|
|
65
|
+
root: styles.neutralRoot,
|
|
66
|
+
text: styles.neutralText
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
function resolveAvatarSize(size) {
|
|
70
|
+
if (typeof size === 'number') {
|
|
71
|
+
return Math.max(20, size);
|
|
72
|
+
}
|
|
73
|
+
const sizes = {
|
|
74
|
+
large: 52,
|
|
75
|
+
medium: 40,
|
|
76
|
+
profile: 72,
|
|
77
|
+
small: 32
|
|
78
|
+
};
|
|
79
|
+
return sizes[size];
|
|
80
|
+
}
|
|
81
|
+
function resolveRoundedRadius(size) {
|
|
82
|
+
if (size >= 52) {
|
|
83
|
+
return 18;
|
|
84
|
+
}
|
|
85
|
+
if (size >= 40) {
|
|
86
|
+
return 14;
|
|
87
|
+
}
|
|
88
|
+
return 12;
|
|
89
|
+
}
|
|
90
|
+
function resolveTextMetrics(size) {
|
|
91
|
+
if (size >= 64) {
|
|
92
|
+
return styles.profileText;
|
|
93
|
+
}
|
|
94
|
+
if (size >= 52) {
|
|
95
|
+
return styles.largeText;
|
|
96
|
+
}
|
|
97
|
+
if (size >= 40) {
|
|
98
|
+
return styles.mediumText;
|
|
99
|
+
}
|
|
100
|
+
return styles.smallText;
|
|
101
|
+
}
|
|
102
|
+
function getAvatarInitial(value) {
|
|
103
|
+
const normalized = value?.trim();
|
|
104
|
+
if (!normalized) {
|
|
105
|
+
return '学';
|
|
106
|
+
}
|
|
107
|
+
return Array.from(normalized)[0] ?? '学';
|
|
108
|
+
}
|
|
109
|
+
function getAvatarAccessibilityLabel(label) {
|
|
110
|
+
const normalized = label?.trim();
|
|
111
|
+
if (!normalized) {
|
|
112
|
+
return '头像';
|
|
113
|
+
}
|
|
114
|
+
return `${normalized}头像`;
|
|
115
|
+
}
|
|
116
|
+
function getImageSourceKey(source, src) {
|
|
117
|
+
if (src) {
|
|
118
|
+
return src;
|
|
119
|
+
}
|
|
120
|
+
if (!source) {
|
|
121
|
+
return '';
|
|
122
|
+
}
|
|
123
|
+
if (typeof source === 'number') {
|
|
124
|
+
return String(source);
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
return JSON.stringify(source);
|
|
128
|
+
} catch {
|
|
129
|
+
return 'source';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { uiTokens as token } from "../../ui/tokens.js";
|
|
5
|
+
export const styles = StyleSheet.create({
|
|
6
|
+
accentRoot: {
|
|
7
|
+
backgroundColor: token.color.bgSelected
|
|
8
|
+
},
|
|
9
|
+
accentText: {
|
|
10
|
+
color: token.color.tintDefault
|
|
11
|
+
},
|
|
12
|
+
image: {
|
|
13
|
+
height: '100%',
|
|
14
|
+
width: '100%'
|
|
15
|
+
},
|
|
16
|
+
largeText: {
|
|
17
|
+
fontSize: 20,
|
|
18
|
+
lineHeight: 25
|
|
19
|
+
},
|
|
20
|
+
mediumText: {
|
|
21
|
+
fontSize: 16,
|
|
22
|
+
lineHeight: 21
|
|
23
|
+
},
|
|
24
|
+
neutralRoot: {
|
|
25
|
+
backgroundColor: token.color.bgDisabled
|
|
26
|
+
},
|
|
27
|
+
neutralText: {
|
|
28
|
+
color: token.color.labelSecondary
|
|
29
|
+
},
|
|
30
|
+
profileText: {
|
|
31
|
+
fontSize: 26,
|
|
32
|
+
lineHeight: 32
|
|
33
|
+
},
|
|
34
|
+
root: {
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
flexShrink: 0,
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
overflow: 'hidden'
|
|
39
|
+
},
|
|
40
|
+
smallText: {
|
|
41
|
+
fontSize: 13,
|
|
42
|
+
lineHeight: 18
|
|
43
|
+
},
|
|
44
|
+
text: {
|
|
45
|
+
fontWeight: '700',
|
|
46
|
+
includeFontPadding: false,
|
|
47
|
+
textAlign: 'center'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
5
|
+
import { Button } from "../Button/index.js";
|
|
6
|
+
import { styles } from "./styles.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
function ActionButton({
|
|
9
|
+
action,
|
|
10
|
+
defaultVariant
|
|
11
|
+
}) {
|
|
12
|
+
return /*#__PURE__*/_jsx(View, {
|
|
13
|
+
style: styles.action,
|
|
14
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
15
|
+
accessibilityHint: action.accessibilityHint,
|
|
16
|
+
disabled: action.disabled,
|
|
17
|
+
loading: action.loading,
|
|
18
|
+
onPress: action.onPress,
|
|
19
|
+
variant: action.variant ?? defaultVariant,
|
|
20
|
+
children: action.label
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function BottomActionBar({
|
|
25
|
+
primary,
|
|
26
|
+
secondary,
|
|
27
|
+
style
|
|
28
|
+
}) {
|
|
29
|
+
return /*#__PURE__*/_jsx(SafeAreaView, {
|
|
30
|
+
edges: ['bottom'],
|
|
31
|
+
style: [styles.safeArea, style],
|
|
32
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
33
|
+
style: styles.actions,
|
|
34
|
+
children: [secondary ? /*#__PURE__*/_jsx(ActionButton, {
|
|
35
|
+
action: secondary,
|
|
36
|
+
defaultVariant: "secondary"
|
|
37
|
+
}) : null, /*#__PURE__*/_jsx(ActionButton, {
|
|
38
|
+
action: primary,
|
|
39
|
+
defaultVariant: "primary"
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { uiTokens as token } from "../../ui/tokens.js";
|
|
5
|
+
export const styles = StyleSheet.create({
|
|
6
|
+
action: {
|
|
7
|
+
flex: 1
|
|
8
|
+
},
|
|
9
|
+
actions: {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
gap: token.space.s12,
|
|
12
|
+
paddingHorizontal: token.space.s16,
|
|
13
|
+
paddingTop: token.space.s8
|
|
14
|
+
},
|
|
15
|
+
safeArea: {
|
|
16
|
+
alignSelf: 'stretch',
|
|
17
|
+
backgroundColor: token.color.bgSecondary,
|
|
18
|
+
borderTopColor: token.color.separator,
|
|
19
|
+
borderTopWidth: 1,
|
|
20
|
+
paddingBottom: token.space.s8
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { ActivityIndicator, KeyboardAvoidingView, Modal, Platform, Pressable, ScrollView, Text, View } from 'react-native';
|
|
4
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
5
|
+
import { uiTokens as token } from "../../ui/tokens.js";
|
|
6
|
+
import { styles } from "./styles.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export function BottomSheet({
|
|
9
|
+
cancelText = '取消',
|
|
10
|
+
children,
|
|
11
|
+
confirmDisabled = false,
|
|
12
|
+
confirmLoading = false,
|
|
13
|
+
confirmText = '确定',
|
|
14
|
+
contentContainerStyle,
|
|
15
|
+
header,
|
|
16
|
+
onCancel,
|
|
17
|
+
onClose,
|
|
18
|
+
onConfirm,
|
|
19
|
+
onDismiss,
|
|
20
|
+
scrollable = true,
|
|
21
|
+
title,
|
|
22
|
+
visible
|
|
23
|
+
}) {
|
|
24
|
+
const hasConfirmation = Boolean(onConfirm);
|
|
25
|
+
const confirmUnavailable = confirmDisabled || confirmLoading;
|
|
26
|
+
const content = scrollable ? /*#__PURE__*/_jsx(ScrollView, {
|
|
27
|
+
contentContainerStyle: [styles.content, contentContainerStyle],
|
|
28
|
+
keyboardShouldPersistTaps: "handled",
|
|
29
|
+
showsVerticalScrollIndicator: false,
|
|
30
|
+
style: styles.scrollView,
|
|
31
|
+
children: children
|
|
32
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
33
|
+
style: [styles.content, contentContainerStyle],
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
return /*#__PURE__*/_jsx(Modal, {
|
|
37
|
+
animationType: "slide",
|
|
38
|
+
onDismiss: onDismiss,
|
|
39
|
+
onRequestClose: onClose,
|
|
40
|
+
presentationStyle: "overFullScreen",
|
|
41
|
+
statusBarTranslucent: true,
|
|
42
|
+
transparent: true,
|
|
43
|
+
visible: visible,
|
|
44
|
+
children: /*#__PURE__*/_jsxs(KeyboardAvoidingView, {
|
|
45
|
+
accessibilityViewIsModal: true,
|
|
46
|
+
behavior: Platform.OS === 'ios' ? 'padding' : undefined,
|
|
47
|
+
style: styles.modalRoot,
|
|
48
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
49
|
+
accessibilityLabel: `关闭${title}`,
|
|
50
|
+
accessibilityRole: "button",
|
|
51
|
+
onPress: onClose,
|
|
52
|
+
style: styles.backdrop
|
|
53
|
+
}), /*#__PURE__*/_jsxs(SafeAreaView, {
|
|
54
|
+
edges: ['bottom'],
|
|
55
|
+
style: styles.sheet,
|
|
56
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
57
|
+
style: styles.grabberArea,
|
|
58
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
59
|
+
style: styles.grabber
|
|
60
|
+
})
|
|
61
|
+
}), header ?? /*#__PURE__*/_jsxs(View, {
|
|
62
|
+
style: styles.header,
|
|
63
|
+
children: [hasConfirmation ? /*#__PURE__*/_jsx(Pressable, {
|
|
64
|
+
accessibilityRole: "button",
|
|
65
|
+
onPress: onCancel ?? onClose,
|
|
66
|
+
style: ({
|
|
67
|
+
pressed
|
|
68
|
+
}) => [styles.action, pressed && styles.pressed],
|
|
69
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
70
|
+
style: styles.cancelText,
|
|
71
|
+
children: cancelText
|
|
72
|
+
})
|
|
73
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
74
|
+
style: styles.action
|
|
75
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
76
|
+
accessibilityRole: "header",
|
|
77
|
+
numberOfLines: 1,
|
|
78
|
+
style: styles.title,
|
|
79
|
+
children: title
|
|
80
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
81
|
+
accessibilityRole: "button",
|
|
82
|
+
accessibilityState: {
|
|
83
|
+
busy: confirmLoading,
|
|
84
|
+
disabled: hasConfirmation && confirmUnavailable
|
|
85
|
+
},
|
|
86
|
+
disabled: hasConfirmation && confirmUnavailable,
|
|
87
|
+
onPress: onConfirm ?? onClose,
|
|
88
|
+
style: ({
|
|
89
|
+
pressed
|
|
90
|
+
}) => [styles.action, styles.actionEnd, hasConfirmation && confirmUnavailable && styles.disabled, pressed && styles.pressed],
|
|
91
|
+
children: confirmLoading ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
92
|
+
color: token.color.tintDefault,
|
|
93
|
+
size: "small"
|
|
94
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
95
|
+
style: styles.confirmText,
|
|
96
|
+
children: hasConfirmation ? confirmText : '关闭'
|
|
97
|
+
})
|
|
98
|
+
})]
|
|
99
|
+
}), content]
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { uiTokens as token } from "../../ui/tokens.js";
|
|
5
|
+
export const styles = StyleSheet.create({
|
|
6
|
+
action: {
|
|
7
|
+
alignItems: 'flex-start',
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
minHeight: token.size.minTouch,
|
|
10
|
+
minWidth: token.size.minTouch,
|
|
11
|
+
paddingHorizontal: token.space.s16
|
|
12
|
+
},
|
|
13
|
+
actionEnd: {
|
|
14
|
+
alignItems: 'flex-end'
|
|
15
|
+
},
|
|
16
|
+
backdrop: {
|
|
17
|
+
bottom: 0,
|
|
18
|
+
left: 0,
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
right: 0,
|
|
21
|
+
top: 0
|
|
22
|
+
},
|
|
23
|
+
cancelText: {
|
|
24
|
+
color: token.color.labelSecondary,
|
|
25
|
+
...token.type.subheadline
|
|
26
|
+
},
|
|
27
|
+
confirmText: {
|
|
28
|
+
color: token.color.tintPressed,
|
|
29
|
+
...token.type.subheadline,
|
|
30
|
+
fontWeight: '600'
|
|
31
|
+
},
|
|
32
|
+
content: {
|
|
33
|
+
gap: token.space.s12,
|
|
34
|
+
paddingBottom: token.space.s16,
|
|
35
|
+
paddingHorizontal: token.space.s16
|
|
36
|
+
},
|
|
37
|
+
disabled: {
|
|
38
|
+
opacity: token.opacity.disabled
|
|
39
|
+
},
|
|
40
|
+
grabber: {
|
|
41
|
+
backgroundColor: token.color.labelTertiary,
|
|
42
|
+
borderRadius: token.radius.capsule,
|
|
43
|
+
height: token.size.bottomSheetGrabberHeight,
|
|
44
|
+
opacity: token.opacity.disabled,
|
|
45
|
+
width: token.size.bottomSheetGrabberWidth
|
|
46
|
+
},
|
|
47
|
+
grabberArea: {
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
minHeight: token.space.s20,
|
|
50
|
+
paddingTop: token.space.s8
|
|
51
|
+
},
|
|
52
|
+
header: {
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
flexDirection: 'row',
|
|
55
|
+
minHeight: token.size.minTouch
|
|
56
|
+
},
|
|
57
|
+
modalRoot: {
|
|
58
|
+
backgroundColor: token.color.overlayScrim,
|
|
59
|
+
flex: 1,
|
|
60
|
+
justifyContent: 'flex-end'
|
|
61
|
+
},
|
|
62
|
+
pressed: {
|
|
63
|
+
opacity: token.opacity.pressed
|
|
64
|
+
},
|
|
65
|
+
scrollView: {
|
|
66
|
+
flexShrink: 1
|
|
67
|
+
},
|
|
68
|
+
sheet: {
|
|
69
|
+
alignSelf: 'center',
|
|
70
|
+
backgroundColor: token.color.bgSecondary,
|
|
71
|
+
borderTopLeftRadius: token.radius.large,
|
|
72
|
+
borderTopRightRadius: token.radius.large,
|
|
73
|
+
maxHeight: '86%',
|
|
74
|
+
maxWidth: token.size.bottomSheetMaxWidth,
|
|
75
|
+
overflow: 'hidden',
|
|
76
|
+
width: '100%'
|
|
77
|
+
},
|
|
78
|
+
title: {
|
|
79
|
+
color: token.color.labelPrimary,
|
|
80
|
+
flex: 1,
|
|
81
|
+
textAlign: 'center',
|
|
82
|
+
...token.type.headline
|
|
83
|
+
}
|
|
84
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { ActivityIndicator, Pressable, Text } from 'react-native';
|
|
4
|
+
import { uiTokens as token } from "../../ui/tokens.js";
|
|
5
|
+
import { styles } from "./styles.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export function Button({
|
|
8
|
+
accessibilityState,
|
|
9
|
+
children,
|
|
10
|
+
disabled = false,
|
|
11
|
+
loading = false,
|
|
12
|
+
style,
|
|
13
|
+
variant = 'primary',
|
|
14
|
+
...pressableProps
|
|
15
|
+
}) {
|
|
16
|
+
const isDisabled = disabled || loading;
|
|
17
|
+
const spinnerColor = variant === 'secondary' ? token.color.tintDefault : token.color.onTint;
|
|
18
|
+
return /*#__PURE__*/_jsxs(Pressable, {
|
|
19
|
+
...pressableProps,
|
|
20
|
+
accessibilityRole: "button",
|
|
21
|
+
accessibilityState: {
|
|
22
|
+
...accessibilityState,
|
|
23
|
+
busy: loading,
|
|
24
|
+
disabled: isDisabled
|
|
25
|
+
},
|
|
26
|
+
disabled: isDisabled,
|
|
27
|
+
style: ({
|
|
28
|
+
pressed
|
|
29
|
+
}) => [styles.button, variant === 'primary' && styles.primary, variant === 'secondary' && styles.secondary, variant === 'destructive' && styles.destructive, isDisabled && styles.disabled, pressed && !isDisabled && styles.pressed, style],
|
|
30
|
+
children: [loading ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
31
|
+
color: spinnerColor,
|
|
32
|
+
size: "small"
|
|
33
|
+
}) : null, /*#__PURE__*/_jsx(Text, {
|
|
34
|
+
style: [styles.label, variant === 'secondary' && styles.secondaryLabel, isDisabled && styles.disabledLabel],
|
|
35
|
+
children: children
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
}
|