@unif/react-native-ui 0.1.0 → 0.2.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/lib/commonjs/README.md +99 -0
- package/lib/commonjs/action-sheet/index.js +71 -0
- package/lib/commonjs/action-sheet/index.js.map +1 -0
- package/lib/commonjs/action-sheet/index.md +69 -0
- package/lib/commonjs/action-sheet/style/index.js +42 -0
- package/lib/commonjs/action-sheet/style/index.js.map +1 -0
- package/lib/commonjs/avatar/index.js +50 -0
- package/lib/commonjs/avatar/index.js.map +1 -0
- package/lib/commonjs/avatar/index.md +51 -0
- package/lib/commonjs/avatar/style/index.js +21 -0
- package/lib/commonjs/avatar/style/index.js.map +1 -0
- package/lib/commonjs/button/index.js +60 -0
- package/lib/commonjs/button/index.js.map +1 -0
- package/lib/commonjs/button/index.md +90 -0
- package/lib/commonjs/button/style/index.js +98 -0
- package/lib/commonjs/button/style/index.js.map +1 -0
- package/lib/commonjs/center/index.js +26 -0
- package/lib/commonjs/center/index.js.map +1 -0
- package/lib/commonjs/center/index.md +28 -0
- package/lib/commonjs/center/style/index.js +14 -0
- package/lib/commonjs/center/style/index.js.map +1 -0
- package/lib/commonjs/chip/index.js +69 -0
- package/lib/commonjs/chip/index.js.map +1 -0
- package/lib/commonjs/chip/index.md +60 -0
- package/lib/commonjs/chip/style/index.js +46 -0
- package/lib/commonjs/chip/style/index.js.map +1 -0
- package/lib/commonjs/column/index.js +35 -0
- package/lib/commonjs/column/index.js.map +1 -0
- package/lib/commonjs/column/index.md +34 -0
- package/lib/commonjs/column/style/index.js +13 -0
- package/lib/commonjs/column/style/index.js.map +1 -0
- package/lib/commonjs/divider/index.js +32 -0
- package/lib/commonjs/divider/index.js.map +1 -0
- package/lib/commonjs/divider/index.md +44 -0
- package/lib/commonjs/divider/style/index.js +22 -0
- package/lib/commonjs/divider/style/index.js.map +1 -0
- package/lib/commonjs/hooks/index.js +13 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/index.md +71 -0
- package/lib/commonjs/hooks/useMergeStyles.js +31 -0
- package/lib/commonjs/hooks/useMergeStyles.js.map +1 -0
- package/lib/commonjs/index.js +146 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/input/index.js +76 -0
- package/lib/commonjs/input/index.js.map +1 -0
- package/lib/commonjs/input/index.md +73 -0
- package/lib/commonjs/input/style/index.js +31 -0
- package/lib/commonjs/input/style/index.js.map +1 -0
- package/lib/commonjs/list-item/index.js +76 -0
- package/lib/commonjs/list-item/index.js.map +1 -0
- package/lib/commonjs/list-item/index.md +101 -0
- package/lib/commonjs/list-item/style/index.js +43 -0
- package/lib/commonjs/list-item/style/index.js.map +1 -0
- package/lib/commonjs/menu/index.js +68 -0
- package/lib/commonjs/menu/index.js.map +1 -0
- package/lib/commonjs/menu/style/index.js +32 -0
- package/lib/commonjs/menu/style/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/popover/index.js +68 -0
- package/lib/commonjs/popover/index.js.map +1 -0
- package/lib/commonjs/popover/index.md +57 -0
- package/lib/commonjs/popover/style/index.js +26 -0
- package/lib/commonjs/popover/style/index.js.map +1 -0
- package/lib/commonjs/row/index.js +36 -0
- package/lib/commonjs/row/index.js.map +1 -0
- package/lib/commonjs/row/index.md +46 -0
- package/lib/commonjs/row/style/index.js +19 -0
- package/lib/commonjs/row/style/index.js.map +1 -0
- package/lib/commonjs/space/index.js +25 -0
- package/lib/commonjs/space/index.js.map +1 -0
- package/lib/commonjs/space/index.md +31 -0
- package/lib/commonjs/space/style/index.js +15 -0
- package/lib/commonjs/space/style/index.js.map +1 -0
- package/lib/commonjs/text/index.js +40 -0
- package/lib/commonjs/text/index.js.map +1 -0
- package/lib/commonjs/text/index.md +63 -0
- package/lib/commonjs/text/style/index.js +56 -0
- package/lib/commonjs/text/style/index.js.map +1 -0
- package/lib/commonjs/theme/context.js +40 -0
- package/lib/commonjs/theme/context.js.map +1 -0
- package/lib/commonjs/theme/tokens.js +68 -0
- package/lib/commonjs/theme/tokens.js.map +1 -0
- package/lib/commonjs/touchable/index.js +40 -0
- package/lib/commonjs/touchable/index.js.map +1 -0
- package/lib/commonjs/touchable/index.md +42 -0
- package/lib/commonjs/touchable/style/index.js +13 -0
- package/lib/commonjs/touchable/style/index.js.map +1 -0
- package/lib/commonjs/wave-animation/index.js +72 -0
- package/lib/commonjs/wave-animation/index.js.map +1 -0
- package/lib/commonjs/wave-animation/index.md +50 -0
- package/lib/module/action-sheet/index.js +5 -2
- package/lib/module/action-sheet/index.js.map +1 -1
- package/lib/module/action-sheet/style/index.js +7 -8
- package/lib/module/action-sheet/style/index.js.map +1 -1
- package/lib/module/avatar/index.js +5 -2
- package/lib/module/avatar/index.js.map +1 -1
- package/lib/module/avatar/style/index.js +4 -5
- package/lib/module/avatar/style/index.js.map +1 -1
- package/lib/module/button/index.js +5 -2
- package/lib/module/button/index.js.map +1 -1
- package/lib/module/button/style/index.js +8 -9
- package/lib/module/button/style/index.js.map +1 -1
- package/lib/module/chip/index.js +7 -2
- package/lib/module/chip/index.js.map +1 -1
- package/lib/module/chip/style/index.js +12 -13
- package/lib/module/chip/style/index.js.map +1 -1
- package/lib/module/divider/index.js +13 -7
- package/lib/module/divider/index.js.map +1 -1
- package/lib/module/divider/style/index.js +4 -5
- package/lib/module/divider/style/index.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/input/index.js +5 -3
- package/lib/module/input/index.js.map +1 -1
- package/lib/module/input/style/index.js +8 -9
- package/lib/module/input/style/index.js.map +1 -1
- package/lib/module/list-item/index.js +9 -7
- package/lib/module/list-item/index.js.map +1 -1
- package/lib/module/list-item/style/index.js +5 -6
- package/lib/module/list-item/style/index.js.map +1 -1
- package/lib/module/menu/index.js +62 -0
- package/lib/module/menu/index.js.map +1 -0
- package/lib/module/menu/style/index.js +27 -0
- package/lib/module/menu/style/index.js.map +1 -0
- package/lib/module/popover/index.js +5 -2
- package/lib/module/popover/index.js.map +1 -1
- package/lib/module/popover/style/index.js +3 -4
- package/lib/module/popover/style/index.js.map +1 -1
- package/lib/module/text/index.js +8 -3
- package/lib/module/text/index.js.map +1 -1
- package/lib/module/text/style/index.js +12 -14
- package/lib/module/text/style/index.js.map +1 -1
- package/lib/module/theme/context.js +33 -0
- package/lib/module/theme/context.js.map +1 -0
- package/lib/module/theme/tokens.js +3 -6
- package/lib/module/theme/tokens.js.map +1 -1
- package/lib/typescript/{jest.setup.d.ts.map → commonjs/jest.setup.d.ts.map} +1 -1
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/action-sheet/index.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/action-sheet/style/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/action-sheet/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/avatar/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/avatar/style/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/avatar/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/button/index.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/button/style/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/button/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/center/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/center/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/chip/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/chip/style/index.d.ts +11 -0
- package/lib/typescript/commonjs/src/chip/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/column/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/column/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/divider/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/divider/style/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/divider/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useMergeStyles.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/index.d.ts +6 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/input/index.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/input/style/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/input/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/list-item/index.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/list-item/style/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/list-item/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/menu/index.d.ts +36 -0
- package/lib/typescript/commonjs/src/menu/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/menu/style/index.d.ts +32 -0
- package/lib/typescript/commonjs/src/menu/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/popover/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/popover/style/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/popover/style/index.d.ts.map +1 -0
- package/lib/typescript/{src/column → commonjs/src/row}/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/row/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/space/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/space/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/text/index.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/text/style/index.d.ts +5 -4
- package/lib/typescript/commonjs/src/text/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/context.d.ts +17 -0
- package/lib/typescript/commonjs/src/theme/context.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/theme/tokens.d.ts +4 -3
- package/lib/typescript/commonjs/src/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/touchable/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/touchable/style/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/wave-animation/index.d.ts.map +1 -0
- package/lib/typescript/module/jest.setup.d.ts +1 -0
- package/lib/typescript/module/jest.setup.d.ts.map +1 -0
- package/lib/typescript/module/src/action-sheet/index.d.ts +22 -0
- package/lib/typescript/module/src/action-sheet/index.d.ts.map +1 -0
- package/lib/typescript/module/src/action-sheet/style/index.d.ts +17 -0
- package/lib/typescript/module/src/action-sheet/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/avatar/index.d.ts +19 -0
- package/lib/typescript/module/src/avatar/index.d.ts.map +1 -0
- package/lib/typescript/module/src/avatar/style/index.d.ts +8 -0
- package/lib/typescript/module/src/avatar/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/button/index.d.ts +24 -0
- package/lib/typescript/module/src/button/index.d.ts.map +1 -0
- package/lib/typescript/module/src/button/style/index.d.ts +17 -0
- package/lib/typescript/module/src/button/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/center/index.d.ts +11 -0
- package/lib/typescript/module/src/center/index.d.ts.map +1 -0
- package/lib/typescript/module/src/center/style/index.d.ts +5 -0
- package/lib/typescript/module/src/center/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/chip/index.d.ts +22 -0
- package/lib/typescript/module/src/chip/index.d.ts.map +1 -0
- package/lib/typescript/module/src/chip/style/index.d.ts +11 -0
- package/lib/typescript/module/src/chip/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/column/index.d.ts +20 -0
- package/lib/typescript/module/src/column/index.d.ts.map +1 -0
- package/lib/typescript/module/src/column/style/index.d.ts +4 -0
- package/lib/typescript/module/src/column/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/divider/index.d.ts +13 -0
- package/lib/typescript/module/src/divider/index.d.ts.map +1 -0
- package/lib/typescript/module/src/divider/style/index.d.ts +10 -0
- package/lib/typescript/module/src/divider/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/index.d.ts +2 -0
- package/lib/typescript/module/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useMergeStyles.d.ts +13 -0
- package/lib/typescript/module/src/hooks/useMergeStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +42 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/input/index.d.ts +29 -0
- package/lib/typescript/module/src/input/index.d.ts.map +1 -0
- package/lib/typescript/module/src/input/style/index.d.ts +9 -0
- package/lib/typescript/module/src/input/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/list-item/index.d.ts +25 -0
- package/lib/typescript/module/src/list-item/index.d.ts.map +1 -0
- package/lib/typescript/module/src/list-item/style/index.d.ts +18 -0
- package/lib/typescript/module/src/list-item/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/menu/index.d.ts +36 -0
- package/lib/typescript/module/src/menu/index.d.ts.map +1 -0
- package/lib/typescript/module/src/menu/style/index.d.ts +32 -0
- package/lib/typescript/module/src/menu/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/popover/index.d.ts +27 -0
- package/lib/typescript/module/src/popover/index.d.ts.map +1 -0
- package/lib/typescript/module/src/popover/style/index.d.ts +8 -0
- package/lib/typescript/module/src/popover/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/row/index.d.ts +22 -0
- package/lib/typescript/module/src/row/index.d.ts.map +1 -0
- package/lib/typescript/module/src/row/style/index.d.ts +8 -0
- package/lib/typescript/module/src/row/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/space/index.d.ts +15 -0
- package/lib/typescript/module/src/space/index.d.ts.map +1 -0
- package/lib/typescript/module/src/space/style/index.d.ts +7 -0
- package/lib/typescript/module/src/space/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/text/index.d.ts +18 -0
- package/lib/typescript/module/src/text/index.d.ts.map +1 -0
- package/lib/typescript/module/src/text/style/index.d.ts +36 -0
- package/lib/typescript/module/src/text/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/context.d.ts +17 -0
- package/lib/typescript/module/src/theme/context.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/tokens.d.ts +62 -0
- package/lib/typescript/module/src/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/module/src/touchable/index.d.ts +19 -0
- package/lib/typescript/module/src/touchable/index.d.ts.map +1 -0
- package/lib/typescript/module/src/touchable/style/index.d.ts +4 -0
- package/lib/typescript/module/src/touchable/style/index.d.ts.map +1 -0
- package/lib/typescript/module/src/wave-animation/index.d.ts +20 -0
- package/lib/typescript/module/src/wave-animation/index.d.ts.map +1 -0
- package/package.json +16 -5
- package/src/action-sheet/index.tsx +7 -3
- package/src/action-sheet/style/index.tsx +10 -8
- package/src/avatar/index.tsx +7 -3
- package/src/avatar/style/index.tsx +5 -5
- package/src/button/index.tsx +7 -3
- package/src/button/style/index.tsx +11 -9
- package/src/chip/index.tsx +16 -5
- package/src/chip/style/index.tsx +15 -13
- package/src/divider/index.tsx +18 -11
- package/src/divider/style/index.tsx +12 -10
- package/src/index.tsx +7 -4
- package/src/input/index.tsx +6 -4
- package/src/input/style/index.tsx +9 -9
- package/src/list-item/index.tsx +11 -6
- package/src/list-item/style/index.tsx +6 -6
- package/src/menu/index.tsx +99 -0
- package/src/menu/style/index.tsx +34 -0
- package/src/popover/index.tsx +7 -3
- package/src/popover/style/index.tsx +4 -4
- package/src/text/index.tsx +9 -3
- package/src/text/style/index.tsx +16 -12
- package/src/theme/context.tsx +38 -0
- package/src/theme/tokens.ts +5 -7
- package/lib/module/theme/config.js +0 -27
- package/lib/module/theme/config.js.map +0 -1
- package/lib/typescript/src/action-sheet/index.d.ts.map +0 -1
- package/lib/typescript/src/action-sheet/style/index.d.ts.map +0 -1
- package/lib/typescript/src/avatar/index.d.ts.map +0 -1
- package/lib/typescript/src/avatar/style/index.d.ts +0 -7
- package/lib/typescript/src/avatar/style/index.d.ts.map +0 -1
- package/lib/typescript/src/button/index.d.ts.map +0 -1
- package/lib/typescript/src/button/style/index.d.ts.map +0 -1
- package/lib/typescript/src/center/index.d.ts.map +0 -1
- package/lib/typescript/src/center/style/index.d.ts.map +0 -1
- package/lib/typescript/src/chip/index.d.ts.map +0 -1
- package/lib/typescript/src/chip/style/index.d.ts +0 -10
- package/lib/typescript/src/chip/style/index.d.ts.map +0 -1
- package/lib/typescript/src/column/style/index.d.ts.map +0 -1
- package/lib/typescript/src/divider/index.d.ts.map +0 -1
- package/lib/typescript/src/divider/style/index.d.ts +0 -9
- package/lib/typescript/src/divider/style/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useMergeStyles.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/input/index.d.ts.map +0 -1
- package/lib/typescript/src/input/style/index.d.ts.map +0 -1
- package/lib/typescript/src/list-item/index.d.ts.map +0 -1
- package/lib/typescript/src/list-item/style/index.d.ts.map +0 -1
- package/lib/typescript/src/popover/index.d.ts.map +0 -1
- package/lib/typescript/src/popover/style/index.d.ts +0 -7
- package/lib/typescript/src/popover/style/index.d.ts.map +0 -1
- package/lib/typescript/src/row/index.d.ts.map +0 -1
- package/lib/typescript/src/row/style/index.d.ts.map +0 -1
- package/lib/typescript/src/space/index.d.ts.map +0 -1
- package/lib/typescript/src/space/style/index.d.ts.map +0 -1
- package/lib/typescript/src/text/index.d.ts.map +0 -1
- package/lib/typescript/src/text/style/index.d.ts.map +0 -1
- package/lib/typescript/src/theme/config.d.ts +0 -18
- package/lib/typescript/src/theme/config.d.ts.map +0 -1
- package/lib/typescript/src/theme/tokens.d.ts.map +0 -1
- package/lib/typescript/src/touchable/index.d.ts.map +0 -1
- package/lib/typescript/src/touchable/style/index.d.ts.map +0 -1
- package/lib/typescript/src/wave-animation/index.d.ts.map +0 -1
- package/lib/typescript/tests/component/component.coverage.test.d.ts +0 -2
- package/lib/typescript/tests/component/component.coverage.test.d.ts.map +0 -1
- package/lib/typescript/tests/component/component.interaction.test.d.ts +0 -2
- package/lib/typescript/tests/component/component.interaction.test.d.ts.map +0 -1
- package/lib/typescript/tests/component/component.snapshot.test.d.ts +0 -2
- package/lib/typescript/tests/component/component.snapshot.test.d.ts.map +0 -1
- package/lib/typescript/tests/e2e/app.e2e.test.d.ts +0 -2
- package/lib/typescript/tests/e2e/app.e2e.test.d.ts.map +0 -1
- package/lib/typescript/tests/integration/ui.integration.test.d.ts +0 -2
- package/lib/typescript/tests/integration/ui.integration.test.d.ts.map +0 -1
- package/lib/typescript/tests/unit/mergeStyles.unit.test.d.ts +0 -2
- package/lib/typescript/tests/unit/mergeStyles.unit.test.d.ts.map +0 -1
- package/lib/typescript/tests/unit/public-api.unit.test.d.ts +0 -2
- package/lib/typescript/tests/unit/public-api.unit.test.d.ts.map +0 -1
- package/lib/typescript/tests/unit/theme-config.unit.test.d.ts +0 -2
- package/lib/typescript/tests/unit/theme-config.unit.test.d.ts.map +0 -1
- package/src/theme/config.ts +0 -26
- /package/lib/typescript/{jest.setup.d.ts → commonjs/jest.setup.d.ts} +0 -0
- /package/lib/typescript/{src → commonjs/src}/action-sheet/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/avatar/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/button/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/center/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/center/style/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/chip/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/column/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/column/style/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/divider/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/hooks/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/hooks/useMergeStyles.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/input/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/list-item/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/popover/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/row/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/row/style/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/space/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/space/style/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/text/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/touchable/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/touchable/style/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/wave-animation/index.d.ts +0 -0
- /package/lib/typescript/{package.json → module/package.json} +0 -0
package/src/divider/index.tsx
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* 分割线组件
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
6
|
import { View } from 'react-native';
|
|
7
7
|
import type { ViewStyle } from 'react-native';
|
|
8
|
-
import {
|
|
8
|
+
import { useTokens } from '../theme/context';
|
|
9
|
+
import { createHairlineStyle, createStandardStyle } from './style';
|
|
9
10
|
|
|
10
11
|
interface DividerProps {
|
|
11
12
|
hairline?: boolean;
|
|
@@ -17,14 +18,20 @@ const Divider: React.FC<DividerProps> = ({
|
|
|
17
18
|
hairline = true,
|
|
18
19
|
marginHorizontal,
|
|
19
20
|
style,
|
|
20
|
-
}: DividerProps) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
}: DividerProps) => {
|
|
22
|
+
const tokens = useTokens();
|
|
23
|
+
const hairlineStyle = useMemo(() => createHairlineStyle(tokens), [tokens]);
|
|
24
|
+
const standardStyle = useMemo(() => createStandardStyle(tokens), [tokens]);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<View
|
|
28
|
+
style={[
|
|
29
|
+
hairline ? hairlineStyle : standardStyle,
|
|
30
|
+
marginHorizontal != null && { marginHorizontal },
|
|
31
|
+
style,
|
|
32
|
+
]}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
29
36
|
|
|
30
37
|
export default Divider;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import type { Tokens } from '../../theme/tokens';
|
|
3
3
|
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
4
|
+
export const createHairlineStyle = (t: Tokens) =>
|
|
5
|
+
StyleSheet.create({
|
|
6
|
+
line: {
|
|
7
|
+
height: StyleSheet.hairlineWidth,
|
|
8
|
+
backgroundColor: t.colorBorder,
|
|
9
|
+
},
|
|
10
|
+
}).line;
|
|
10
11
|
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
}
|
|
12
|
+
export const createStandardStyle = (t: Tokens) =>
|
|
13
|
+
StyleSheet.create({
|
|
14
|
+
line: { height: 1, backgroundColor: t.colorBorder },
|
|
15
|
+
}).line;
|
package/src/index.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Theme
|
|
2
|
-
export {
|
|
3
|
-
export type {
|
|
4
|
-
export {
|
|
2
|
+
export { ConfigProvider, useTokens } from './theme/context';
|
|
3
|
+
export type { ConfigProviderProps, TokenOverrides } from './theme/context';
|
|
4
|
+
export { defaultTokens } from './theme/tokens';
|
|
5
|
+
export type { Tokens } from './theme/tokens';
|
|
5
6
|
|
|
6
7
|
// Hooks
|
|
7
8
|
export { mergeStyles } from './hooks';
|
|
@@ -34,7 +35,7 @@ export type { AvatarSemanticStyles } from './avatar/style';
|
|
|
34
35
|
export { default as WaveAnimation } from './wave-animation';
|
|
35
36
|
export type { WaveAnimationProps } from './wave-animation';
|
|
36
37
|
|
|
37
|
-
// Base
|
|
38
|
+
// Base
|
|
38
39
|
export { default as Input } from './input';
|
|
39
40
|
export type { InputProps } from './input';
|
|
40
41
|
export type { InputSemanticStyles } from './input/style';
|
|
@@ -47,3 +48,5 @@ export type { ActionSheetOption, ActionSheetSemanticStyles } from './action-shee
|
|
|
47
48
|
export { default as Popover } from './popover';
|
|
48
49
|
export type { PopoverProps } from './popover';
|
|
49
50
|
export type { PopoverSemanticStyles } from './popover/style';
|
|
51
|
+
export { default as Menu } from './menu';
|
|
52
|
+
export type { MenuProps, Action, MenuSemanticStyles } from './menu';
|
package/src/input/index.tsx
CHANGED
|
@@ -8,9 +8,9 @@ import React, { useRef, useEffect, useMemo, forwardRef } from 'react';
|
|
|
8
8
|
import { View, TextInput } from 'react-native';
|
|
9
9
|
import type { ViewStyle, ReturnKeyTypeOptions } from 'react-native';
|
|
10
10
|
import { mergeStyles } from '../hooks';
|
|
11
|
-
import {
|
|
11
|
+
import { useTokens } from '../theme/context';
|
|
12
12
|
import type { InputSemanticStyles } from './style';
|
|
13
|
-
import {
|
|
13
|
+
import { createDefaultStyles } from './style';
|
|
14
14
|
|
|
15
15
|
export interface InputProps {
|
|
16
16
|
value?: string;
|
|
@@ -52,12 +52,14 @@ const Input = forwardRef<InputRef, InputProps>(({
|
|
|
52
52
|
testID,
|
|
53
53
|
}, ref) => {
|
|
54
54
|
const inputRef = useRef<InputRef>(null);
|
|
55
|
+
const tokens = useTokens();
|
|
56
|
+
const defaultStyles = useMemo(() => createDefaultStyles(tokens), [tokens]);
|
|
55
57
|
|
|
56
58
|
React.useImperativeHandle(ref, () => inputRef.current as InputRef);
|
|
57
59
|
|
|
58
60
|
const s = useMemo(
|
|
59
|
-
() => mergeStyles<InputSemanticStyles>(
|
|
60
|
-
[semanticStyles],
|
|
61
|
+
() => mergeStyles<InputSemanticStyles>(defaultStyles, semanticStyles),
|
|
62
|
+
[defaultStyles, semanticStyles],
|
|
61
63
|
);
|
|
62
64
|
|
|
63
65
|
useEffect(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import type { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import type { Tokens } from '../../theme/tokens';
|
|
4
4
|
|
|
5
5
|
export type InputSemanticStyles = {
|
|
6
6
|
root?: ViewStyle;
|
|
@@ -8,19 +8,19 @@ export type InputSemanticStyles = {
|
|
|
8
8
|
toolbar?: ViewStyle;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const createDefaultStyles = (t: Tokens): InputSemanticStyles => ({
|
|
12
12
|
root: {
|
|
13
|
-
backgroundColor:
|
|
14
|
-
borderRadius:
|
|
13
|
+
backgroundColor: t.colorBgElevated,
|
|
14
|
+
borderRadius: t.radiusXl,
|
|
15
15
|
paddingHorizontal: 12,
|
|
16
16
|
paddingTop: 8,
|
|
17
17
|
paddingBottom: 6,
|
|
18
|
-
...
|
|
18
|
+
...t.shadow,
|
|
19
19
|
},
|
|
20
20
|
input: {
|
|
21
|
-
fontSize:
|
|
22
|
-
color:
|
|
23
|
-
lineHeight:
|
|
21
|
+
fontSize: t.fontSize,
|
|
22
|
+
color: t.colorText,
|
|
23
|
+
lineHeight: t.lineHeight,
|
|
24
24
|
paddingVertical: Platform.OS === 'ios' ? 4 : 2,
|
|
25
25
|
paddingHorizontal: 4,
|
|
26
26
|
},
|
|
@@ -29,4 +29,4 @@ export const DEFAULT_STYLES: InputSemanticStyles = {
|
|
|
29
29
|
alignItems: 'center',
|
|
30
30
|
paddingTop: 4,
|
|
31
31
|
},
|
|
32
|
-
};
|
|
32
|
+
});
|
package/src/list-item/index.tsx
CHANGED
|
@@ -8,9 +8,9 @@ import React, { useMemo } from 'react';
|
|
|
8
8
|
import { View, Text, Pressable } from 'react-native';
|
|
9
9
|
import type { ViewStyle, TextStyle } from 'react-native';
|
|
10
10
|
import { mergeStyles } from '../hooks';
|
|
11
|
-
import {
|
|
11
|
+
import { useTokens } from '../theme/context';
|
|
12
12
|
import type { ListItemSemanticStyles } from './style';
|
|
13
|
-
import {
|
|
13
|
+
import { createDefaultStyles, lineStyle, contentWrapStyle } from './style';
|
|
14
14
|
|
|
15
15
|
interface ListItemProps {
|
|
16
16
|
thumb?: React.ReactNode;
|
|
@@ -27,8 +27,6 @@ interface ListItemProps {
|
|
|
27
27
|
testID?: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const defaultArrowStyle = { fontSize: 18, color: tokens.colorTextSecondary };
|
|
31
|
-
|
|
32
30
|
const ListItem: React.FC<ListItemProps> = ({
|
|
33
31
|
thumb,
|
|
34
32
|
title,
|
|
@@ -40,9 +38,16 @@ const ListItem: React.FC<ListItemProps> = ({
|
|
|
40
38
|
styles: semanticStyles,
|
|
41
39
|
...props
|
|
42
40
|
}: ListItemProps) => {
|
|
41
|
+
const tokens = useTokens();
|
|
42
|
+
const defaultStyles = useMemo(() => createDefaultStyles(tokens), [tokens]);
|
|
43
|
+
const defaultArrowStyle = useMemo(
|
|
44
|
+
() => ({ fontSize: 18, color: tokens.colorTextSecondary }),
|
|
45
|
+
[tokens],
|
|
46
|
+
);
|
|
47
|
+
|
|
43
48
|
const s = useMemo(
|
|
44
|
-
() => mergeStyles(
|
|
45
|
-
[semanticStyles],
|
|
49
|
+
() => mergeStyles(defaultStyles, semanticStyles),
|
|
50
|
+
[defaultStyles, semanticStyles],
|
|
46
51
|
);
|
|
47
52
|
|
|
48
53
|
const content = (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
import type { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import type { Tokens } from '../../theme/tokens';
|
|
4
4
|
|
|
5
5
|
export type ListItemSemanticStyles = {
|
|
6
6
|
root?: ViewStyle;
|
|
@@ -9,7 +9,7 @@ export type ListItemSemanticStyles = {
|
|
|
9
9
|
extra?: ViewStyle & TextStyle;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const createDefaultStyles = (t: Tokens): ListItemSemanticStyles => ({
|
|
13
13
|
root: {
|
|
14
14
|
flexDirection: 'row',
|
|
15
15
|
alignItems: 'center',
|
|
@@ -18,19 +18,19 @@ export const DEFAULT_SEMANTIC: ListItemSemanticStyles = {
|
|
|
18
18
|
},
|
|
19
19
|
content: {
|
|
20
20
|
fontSize: 15,
|
|
21
|
-
color:
|
|
21
|
+
color: t.colorText,
|
|
22
22
|
flex: 1,
|
|
23
23
|
},
|
|
24
24
|
description: {
|
|
25
25
|
fontSize: 12,
|
|
26
|
-
color:
|
|
26
|
+
color: t.colorTextSecondary,
|
|
27
27
|
marginTop: 2,
|
|
28
28
|
},
|
|
29
29
|
extra: {
|
|
30
|
-
color:
|
|
30
|
+
color: t.colorTextSecondary,
|
|
31
31
|
fontSize: 14,
|
|
32
32
|
},
|
|
33
|
-
};
|
|
33
|
+
});
|
|
34
34
|
|
|
35
35
|
export const lineStyle = StyleSheet.create({
|
|
36
36
|
s: { flex: 1, flexDirection: 'row', alignItems: 'center' },
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu 独立组件
|
|
3
|
+
*
|
|
4
|
+
* 基于 Popover 实现的菜单列表,支持 danger、icon、disabled。
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
|
+
import { View, Text, Pressable } from 'react-native';
|
|
9
|
+
import type { ViewStyle } from 'react-native';
|
|
10
|
+
import Popover from '../popover';
|
|
11
|
+
import { useTokens } from '../theme/context';
|
|
12
|
+
import type { MenuSemanticStyles } from './style';
|
|
13
|
+
import { createDefaultStyles } from './style';
|
|
14
|
+
|
|
15
|
+
export type { MenuSemanticStyles } from './style';
|
|
16
|
+
|
|
17
|
+
export type Action = {
|
|
18
|
+
key: string;
|
|
19
|
+
text: string;
|
|
20
|
+
icon?: React.ReactNode;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
danger?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export interface MenuProps {
|
|
26
|
+
visible: boolean;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
anchorLayout: { x: number; y: number; width: number; height: number };
|
|
29
|
+
actions: Action[];
|
|
30
|
+
onAction?: (item: Action) => void;
|
|
31
|
+
placement?: 'bottom' | 'top';
|
|
32
|
+
width?: number;
|
|
33
|
+
style?: ViewStyle;
|
|
34
|
+
styles?: Partial<MenuSemanticStyles>;
|
|
35
|
+
testID?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const Menu: React.FC<MenuProps> = ({
|
|
39
|
+
visible,
|
|
40
|
+
onClose,
|
|
41
|
+
anchorLayout,
|
|
42
|
+
actions,
|
|
43
|
+
onAction,
|
|
44
|
+
placement = 'bottom',
|
|
45
|
+
width = 160,
|
|
46
|
+
style,
|
|
47
|
+
styles: semanticStyles,
|
|
48
|
+
testID,
|
|
49
|
+
}) => {
|
|
50
|
+
const tokens = useTokens();
|
|
51
|
+
const ds = useMemo(() => createDefaultStyles(tokens), [tokens]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Popover
|
|
55
|
+
visible={visible}
|
|
56
|
+
onClose={onClose}
|
|
57
|
+
anchorLayout={anchorLayout}
|
|
58
|
+
placement={placement}
|
|
59
|
+
width={width}
|
|
60
|
+
style={style}
|
|
61
|
+
testID={testID}
|
|
62
|
+
>
|
|
63
|
+
{actions.map((action, index) => (
|
|
64
|
+
<React.Fragment key={action.key}>
|
|
65
|
+
{index > 0 && (
|
|
66
|
+
<View style={[ds.divider, semanticStyles?.divider]} />
|
|
67
|
+
)}
|
|
68
|
+
<Pressable
|
|
69
|
+
style={[ds.item, semanticStyles?.item]}
|
|
70
|
+
onPress={() => {
|
|
71
|
+
if (!action.disabled) {
|
|
72
|
+
onAction?.(action);
|
|
73
|
+
onClose();
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
disabled={action.disabled}
|
|
77
|
+
testID={testID ? `${testID}-${action.key}` : undefined}
|
|
78
|
+
>
|
|
79
|
+
{action.icon && (
|
|
80
|
+
<View style={[ds.itemIcon, semanticStyles?.itemIcon]}>
|
|
81
|
+
{action.icon}
|
|
82
|
+
</View>
|
|
83
|
+
)}
|
|
84
|
+
<Text
|
|
85
|
+
style={[
|
|
86
|
+
action.danger ? ds.itemLabelDanger : ds.itemLabel,
|
|
87
|
+
semanticStyles?.itemLabel,
|
|
88
|
+
]}
|
|
89
|
+
>
|
|
90
|
+
{action.text}
|
|
91
|
+
</Text>
|
|
92
|
+
</Pressable>
|
|
93
|
+
</React.Fragment>
|
|
94
|
+
))}
|
|
95
|
+
</Popover>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default Menu;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import type { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
import type { Tokens } from '../../theme/tokens';
|
|
4
|
+
|
|
5
|
+
export type MenuSemanticStyles = {
|
|
6
|
+
item?: ViewStyle;
|
|
7
|
+
itemLabel?: TextStyle;
|
|
8
|
+
itemIcon?: ViewStyle;
|
|
9
|
+
divider?: ViewStyle;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const createDefaultStyles = (t: Tokens) => ({
|
|
13
|
+
item: {
|
|
14
|
+
flexDirection: 'row' as const,
|
|
15
|
+
alignItems: 'center' as const,
|
|
16
|
+
paddingVertical: 12,
|
|
17
|
+
paddingHorizontal: 16,
|
|
18
|
+
},
|
|
19
|
+
itemLabel: {
|
|
20
|
+
fontSize: 14,
|
|
21
|
+
color: t.colorText,
|
|
22
|
+
},
|
|
23
|
+
itemLabelDanger: {
|
|
24
|
+
fontSize: 14,
|
|
25
|
+
color: t.colorError,
|
|
26
|
+
},
|
|
27
|
+
itemIcon: {
|
|
28
|
+
marginRight: 8,
|
|
29
|
+
},
|
|
30
|
+
divider: {
|
|
31
|
+
height: StyleSheet.hairlineWidth,
|
|
32
|
+
backgroundColor: t.colorBorder,
|
|
33
|
+
},
|
|
34
|
+
});
|
package/src/popover/index.tsx
CHANGED
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
} from 'react-native';
|
|
13
13
|
import type { ViewStyle } from 'react-native';
|
|
14
14
|
import { mergeStyles } from '../hooks';
|
|
15
|
+
import { useTokens } from '../theme/context';
|
|
15
16
|
import type { PopoverSemanticStyles } from './style';
|
|
16
|
-
import {
|
|
17
|
+
import { createDefaultStyles } from './style';
|
|
17
18
|
|
|
18
19
|
export interface PopoverProps {
|
|
19
20
|
visible: boolean;
|
|
@@ -40,9 +41,12 @@ const Popover: React.FC<PopoverProps> = ({
|
|
|
40
41
|
styles: semanticStyles,
|
|
41
42
|
testID,
|
|
42
43
|
}) => {
|
|
44
|
+
const tokens = useTokens();
|
|
45
|
+
const defaultStyles = useMemo(() => createDefaultStyles(tokens), [tokens]);
|
|
46
|
+
|
|
43
47
|
const s = useMemo(
|
|
44
|
-
() => mergeStyles<PopoverSemanticStyles>(
|
|
45
|
-
[semanticStyles],
|
|
48
|
+
() => mergeStyles<PopoverSemanticStyles>(defaultStyles, semanticStyles),
|
|
49
|
+
[defaultStyles, semanticStyles],
|
|
46
50
|
);
|
|
47
51
|
|
|
48
52
|
if (!visible) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ViewStyle } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import type { Tokens } from '../../theme/tokens';
|
|
3
3
|
|
|
4
4
|
export type PopoverSemanticStyles = {
|
|
5
5
|
overlay?: ViewStyle;
|
|
6
6
|
content?: ViewStyle;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const createDefaultStyles = (t: Tokens): PopoverSemanticStyles => ({
|
|
10
10
|
overlay: {
|
|
11
11
|
flex: 1,
|
|
12
12
|
},
|
|
13
13
|
content: {
|
|
14
14
|
position: 'absolute',
|
|
15
|
-
backgroundColor:
|
|
15
|
+
backgroundColor: t.colorBgElevated,
|
|
16
16
|
borderRadius: 12,
|
|
17
17
|
shadowColor: '#000',
|
|
18
18
|
shadowOffset: { width: 0, height: 4 },
|
|
@@ -20,4 +20,4 @@ export const DEFAULT_STYLES: PopoverSemanticStyles = {
|
|
|
20
20
|
shadowRadius: 12,
|
|
21
21
|
elevation: 8,
|
|
22
22
|
},
|
|
23
|
-
};
|
|
23
|
+
});
|
package/src/text/index.tsx
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* variant 驱动样式,支持嵌套 Text。
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
8
|
import { Text as RNText } from 'react-native';
|
|
9
9
|
import type { TextProps as RNTextProps } from 'react-native';
|
|
10
|
+
import { useTokens } from '../theme/context';
|
|
10
11
|
import type { FontWeight } from './style';
|
|
11
|
-
import {
|
|
12
|
+
import { createVariantMap, WEIGHT_MAP, createSecondaryStyle, createPrimaryStyle } from './style';
|
|
12
13
|
|
|
13
14
|
export interface TextProps extends RNTextProps {
|
|
14
15
|
variant?: 'title' | 'heading' | 'body' | 'caption' | 'micro';
|
|
@@ -27,10 +28,15 @@ const Text: React.FC<TextProps> = ({
|
|
|
27
28
|
style,
|
|
28
29
|
...rest
|
|
29
30
|
}: TextProps) => {
|
|
31
|
+
const tokens = useTokens();
|
|
32
|
+
const variantMap = useMemo(() => createVariantMap(tokens), [tokens]);
|
|
33
|
+
const secondaryStyle = useMemo(() => createSecondaryStyle(tokens), [tokens]);
|
|
34
|
+
const primaryStyle = useMemo(() => createPrimaryStyle(tokens), [tokens]);
|
|
35
|
+
|
|
30
36
|
return (
|
|
31
37
|
<RNText
|
|
32
38
|
style={[
|
|
33
|
-
|
|
39
|
+
variantMap[variant],
|
|
34
40
|
secondary && secondaryStyle,
|
|
35
41
|
primary && primaryStyle,
|
|
36
42
|
color != null && { color },
|
package/src/text/style/index.tsx
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
1
|
import type { TextStyle } from 'react-native';
|
|
3
|
-
import {
|
|
2
|
+
import type { Tokens } from '../../theme/tokens';
|
|
4
3
|
|
|
5
4
|
export type FontWeight = 'medium' | 'semibold' | 'bold';
|
|
6
5
|
|
|
7
|
-
export const
|
|
6
|
+
export const createVariantMap = (t: Tokens) => ({
|
|
8
7
|
title: {
|
|
9
8
|
fontSize: 20,
|
|
10
9
|
lineHeight: 26,
|
|
11
|
-
fontWeight: '600',
|
|
12
|
-
color:
|
|
10
|
+
fontWeight: '600' as const,
|
|
11
|
+
color: t.colorText,
|
|
13
12
|
},
|
|
14
13
|
heading: {
|
|
15
14
|
fontSize: 16,
|
|
16
15
|
lineHeight: 22,
|
|
17
|
-
fontWeight: '600',
|
|
18
|
-
color:
|
|
16
|
+
fontWeight: '600' as const,
|
|
17
|
+
color: t.colorText,
|
|
19
18
|
},
|
|
20
|
-
body: { fontSize: 15, lineHeight: 22, color:
|
|
21
|
-
caption: { fontSize: 13, lineHeight: 18, color:
|
|
22
|
-
micro: { fontSize: 12, lineHeight: 18, color:
|
|
19
|
+
body: { fontSize: 15, lineHeight: 22, color: t.colorText },
|
|
20
|
+
caption: { fontSize: 13, lineHeight: 18, color: t.colorText },
|
|
21
|
+
micro: { fontSize: 12, lineHeight: 18, color: t.colorText },
|
|
23
22
|
});
|
|
24
23
|
|
|
25
24
|
export const WEIGHT_MAP: Record<FontWeight, TextStyle> = {
|
|
@@ -28,5 +27,10 @@ export const WEIGHT_MAP: Record<FontWeight, TextStyle> = {
|
|
|
28
27
|
bold: { fontWeight: '700' },
|
|
29
28
|
};
|
|
30
29
|
|
|
31
|
-
export const
|
|
32
|
-
|
|
30
|
+
export const createSecondaryStyle = (t: Tokens): TextStyle => ({
|
|
31
|
+
color: t.colorTextSecondary,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const createPrimaryStyle = (t: Tokens): TextStyle => ({
|
|
35
|
+
color: t.colorPrimary,
|
|
36
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfigProvider — 声明式主题系统
|
|
3
|
+
*
|
|
4
|
+
* 通过 React Context 注入 token,支持嵌套覆盖。
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React, { createContext, useContext, useMemo } from 'react';
|
|
8
|
+
import { defaultTokens } from './tokens';
|
|
9
|
+
import type { Tokens } from './tokens';
|
|
10
|
+
|
|
11
|
+
export type TokenOverrides = Partial<Tokens>;
|
|
12
|
+
|
|
13
|
+
const ThemeContext = createContext<Tokens>(defaultTokens);
|
|
14
|
+
|
|
15
|
+
export interface ConfigProviderProps {
|
|
16
|
+
theme?: { token?: TokenOverrides };
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const ConfigProvider: React.FC<ConfigProviderProps> = ({
|
|
21
|
+
theme,
|
|
22
|
+
children,
|
|
23
|
+
}) => {
|
|
24
|
+
const parent = useContext(ThemeContext);
|
|
25
|
+
|
|
26
|
+
const merged = useMemo<Tokens>(() => {
|
|
27
|
+
if (!theme?.token) return parent;
|
|
28
|
+
return { ...parent, ...theme.token } as Tokens;
|
|
29
|
+
}, [parent, theme?.token]);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<ThemeContext.Provider value={merged}>{children}</ThemeContext.Provider>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export function useTokens(): Tokens {
|
|
37
|
+
return useContext(ThemeContext);
|
|
38
|
+
}
|
package/src/theme/tokens.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Design Tokens
|
|
2
|
+
* Design Tokens — 静态默认值
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const tokens = {
|
|
8
|
-
get colorPrimary() {
|
|
9
|
-
return getPrimaryColor();
|
|
10
|
-
},
|
|
5
|
+
export const defaultTokens = {
|
|
6
|
+
colorPrimary: '#EB6E00',
|
|
11
7
|
colorSuccess: '#34C759',
|
|
12
8
|
colorWarning: '#FF9500',
|
|
13
9
|
colorError: '#FF3B30',
|
|
@@ -64,3 +60,5 @@ export const tokens = {
|
|
|
64
60
|
elevation: 2,
|
|
65
61
|
},
|
|
66
62
|
};
|
|
63
|
+
|
|
64
|
+
export type Tokens = typeof defaultTokens;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 主题配置
|
|
5
|
-
*
|
|
6
|
-
* 消费方通过 configure() 注入主题色,实现包与业务解耦。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
let _config = {};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 配置主题
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* import { configure } from '@unif/react-native-ui';
|
|
16
|
-
* configure({ primaryColor: getAppThemeColor() });
|
|
17
|
-
*/
|
|
18
|
-
export function configure(options) {
|
|
19
|
-
_config = {
|
|
20
|
-
..._config,
|
|
21
|
-
...options
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export function getPrimaryColor() {
|
|
25
|
-
return _config.primaryColor || '#EB6E00';
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_config","configure","options","getPrimaryColor","primaryColor"],"sourceRoot":"../../../src","sources":["theme/config.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAMA,IAAIA,OAAoB,GAAG,CAAC,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,OAAoB,EAAQ;EACpDF,OAAO,GAAG;IAAE,GAAGA,OAAO;IAAE,GAAGE;EAAQ,CAAC;AACtC;AAEA,OAAO,SAASC,eAAeA,CAAA,EAAW;EACxC,OAAOH,OAAO,CAACI,YAAY,IAAI,SAAS;AAC1C","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/action-sheet/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAQvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5E,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAmD3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/action-sheet/style/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,EAAE,yBAiC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/avatar/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA+BjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/avatar/style/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1D,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,oBAY5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/button/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAWpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IAClD,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAgDjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/button/style/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzD,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,oBAY5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,CASrE,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAiBrE,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,oBAAoB,CAEzD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,oBAAoB,CAEtD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAA4B,CAAC;AAEzD,eAAO,MAAM,YAAY;;CAErB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/center/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC;AAEpC,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAEjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/center/style/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;CAKb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/chip/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAkD7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|