@xhsreds/reds-rn-next 0.0.23 → 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/benchmarks/out.json +332 -0
- package/coverage/.tmp/coverage-0.json +1 -0
- package/coverage/.tmp/coverage-1.json +1 -0
- package/coverage/.tmp/coverage-2.json +1 -0
- package/coverage/.tmp/coverage-3.json +1 -0
- package/coverage/.tmp/coverage-4.json +1 -0
- package/coverage/.tmp/coverage-5.json +1 -0
- package/coverage/.tmp/coverage-6.json +1 -0
- package/coverage/.tmp/coverage-7.json +1 -0
- package/coverage/.tmp/coverage-8.json +1 -0
- package/coverage/.tmp/coverage-9.json +1 -0
- package/lib/cjs/_chunks/8GiEQzJI.js +14 -0
- package/lib/cjs/_chunks/8GiEQzJI.js.map +1 -0
- package/lib/cjs/_chunks/C61-qTj5.js +45 -0
- package/lib/cjs/_chunks/C61-qTj5.js.map +1 -0
- package/lib/cjs/_chunks/CH-nghLh.js +25 -0
- package/lib/cjs/_chunks/CH-nghLh.js.map +1 -0
- package/lib/cjs/_chunks/CvikiypO.js +20 -0
- package/lib/cjs/_chunks/CvikiypO.js.map +1 -0
- package/lib/cjs/_chunks/CyggXkdu.js +20 -0
- package/lib/cjs/_chunks/CyggXkdu.js.map +1 -0
- package/lib/cjs/_chunks/{0oZeAV32.js → D9ngGICz.js} +14 -1
- package/lib/cjs/_chunks/{0oZeAV32.js.map → D9ngGICz.js.map} +1 -1
- package/lib/cjs/_chunks/DOAnQxcP.js +16 -0
- package/lib/cjs/_chunks/DOAnQxcP.js.map +1 -0
- package/lib/cjs/_chunks/{BUZe8G-Q.js → DkF74KKv.js} +31 -10
- package/lib/cjs/_chunks/DkF74KKv.js.map +1 -0
- package/lib/cjs/_chunks/Dmk9_Zw3.js +20 -0
- package/lib/cjs/_chunks/Dmk9_Zw3.js.map +1 -0
- package/lib/cjs/_chunks/y2LtPP5n.js +21 -0
- package/lib/cjs/_chunks/y2LtPP5n.js.map +1 -0
- package/lib/cjs/_chunks/zrKJYx9X.js +49 -0
- package/lib/cjs/_chunks/zrKJYx9X.js.map +1 -0
- package/lib/cjs/components/Button/Button.js +44 -0
- package/lib/cjs/components/Button/Button.js.map +1 -0
- package/lib/cjs/components/Button/index.js +25 -8
- package/lib/cjs/components/Button/index.js.map +1 -1
- package/lib/cjs/components/Button/interface/index.js +5 -11
- package/lib/cjs/components/Button/interface/index.js.map +1 -1
- package/lib/cjs/components/Button/styleMap.js +24 -8
- package/lib/cjs/components/Button/styleMap.js.map +1 -1
- package/lib/cjs/components/Collapse/Collapse.js +60 -0
- package/lib/cjs/components/Collapse/Collapse.js.map +1 -0
- package/lib/cjs/components/Collapse/Item/Item.js +113 -0
- package/lib/cjs/components/Collapse/Item/Item.js.map +1 -0
- package/lib/cjs/components/Collapse/Item/interface/index.js +12 -0
- package/lib/cjs/components/Collapse/Item/interface/index.js.map +1 -0
- package/lib/cjs/components/Collapse/Item/styles.js +36 -0
- package/lib/cjs/components/Collapse/Item/styles.js.map +1 -0
- package/lib/cjs/components/Collapse/hooks/useCollapseContext.js +14 -0
- package/lib/cjs/components/Collapse/hooks/useCollapseContext.js.map +1 -0
- package/lib/cjs/components/Collapse/index.js +21 -0
- package/lib/cjs/components/Collapse/index.js.map +1 -0
- package/lib/cjs/components/Collapse/interface/index.js +11 -0
- package/lib/cjs/components/Collapse/interface/index.js.map +1 -0
- package/lib/cjs/components/ConfigProvider/ConfigProvider.js +1 -1
- package/lib/cjs/components/ConfigProvider/hooks/ConfigCache/ConfigCache.js +1 -1
- package/lib/cjs/components/ConfigProvider/hooks/ConfigCache/index.js +1 -1
- package/lib/cjs/components/ConfigProvider/hooks/themeToken/useThemeToken.js +1 -1
- package/lib/cjs/components/ConfigProvider/index.js +13 -22
- package/lib/cjs/components/ConfigProvider/index.js.map +1 -1
- package/lib/cjs/components/ConfigProvider/interface/index.js +5 -34
- package/lib/cjs/components/ConfigProvider/interface/index.js.map +1 -1
- package/lib/cjs/components/Empty/Empty.js +44 -0
- package/lib/cjs/components/Empty/Empty.js.map +1 -0
- package/lib/cjs/components/Empty/hooks/useDefaultIcon.js +10 -0
- package/lib/cjs/components/Empty/hooks/useDefaultIcon.js.map +1 -0
- package/lib/cjs/components/Empty/index.js +22 -0
- package/lib/cjs/components/Empty/index.js.map +1 -0
- package/lib/cjs/components/Empty/interface/index.js +8 -0
- package/lib/cjs/components/Empty/interface/index.js.map +1 -0
- package/lib/cjs/components/Empty/styles.js +38 -0
- package/lib/cjs/components/Empty/styles.js.map +1 -0
- package/lib/cjs/components/Image/Image.js +130 -0
- package/lib/cjs/components/Image/Image.js.map +1 -0
- package/lib/cjs/components/Image/hook/index.js +2 -2
- package/lib/cjs/components/Image/index.js +4 -4
- package/lib/cjs/components/Image/index.js.map +1 -1
- package/lib/cjs/components/Image/interface/index.js +8 -35
- package/lib/cjs/components/Image/interface/index.js.map +1 -1
- package/lib/cjs/components/Popover/Popover.js +128 -0
- package/lib/cjs/components/Popover/Popover.js.map +1 -0
- package/lib/cjs/components/Popover/component.js +1 -1
- package/lib/cjs/components/Popover/hook.js +1 -1
- package/lib/cjs/components/Popover/index.js +12 -120
- package/lib/cjs/components/Popover/index.js.map +1 -1
- package/lib/cjs/components/Popover/interface/index.js +5 -11
- package/lib/cjs/components/Popover/interface/index.js.map +1 -1
- package/lib/cjs/components/Popover/styles.js +29 -0
- package/lib/cjs/components/Popover/styles.js.map +1 -0
- package/lib/cjs/components/Result/Result.js +52 -0
- package/lib/cjs/components/Result/Result.js.map +1 -0
- package/lib/cjs/components/Result/hooks/useDefaultIcon.js +19 -0
- package/lib/cjs/components/Result/hooks/useDefaultIcon.js.map +1 -0
- package/lib/cjs/components/Result/index.js +22 -0
- package/lib/cjs/components/Result/index.js.map +1 -0
- package/lib/cjs/components/Result/interface/index.js +8 -0
- package/lib/cjs/components/Result/interface/index.js.map +1 -0
- package/lib/cjs/components/Result/styles.js +47 -0
- package/lib/cjs/components/Result/styles.js.map +1 -0
- package/lib/cjs/components/Switch/Switch.js +80 -0
- package/lib/cjs/components/Switch/Switch.js.map +1 -0
- package/lib/cjs/components/Switch/index.js +10 -63
- package/lib/cjs/components/Switch/index.js.map +1 -1
- package/lib/cjs/components/Switch/interface/index.js +4 -9
- package/lib/cjs/components/Switch/interface/index.js.map +1 -1
- package/lib/cjs/components/Switch/styles.js.map +1 -1
- package/lib/cjs/components/Tag/Tag.js +203 -0
- package/lib/cjs/components/Tag/Tag.js.map +1 -0
- package/lib/cjs/components/Tag/index.js +10 -207
- package/lib/cjs/components/Tag/index.js.map +1 -1
- package/lib/cjs/components/Tag/interface/index.js +4 -17
- package/lib/cjs/components/Tag/interface/index.js.map +1 -1
- package/lib/cjs/components/Tag/styles.js +29 -0
- package/lib/cjs/components/Tag/styles.js.map +1 -0
- package/lib/cjs/components/Text/Text.js +159 -0
- package/lib/cjs/components/Text/Text.js.map +1 -0
- package/lib/cjs/components/Text/hooks/cloneContainer.js +1 -1
- package/lib/cjs/components/Text/hooks/index.js +1 -1
- package/lib/cjs/components/Text/hooks/loadFontFromFile.js +1 -1
- package/lib/cjs/components/Text/index.js +12 -146
- package/lib/cjs/components/Text/index.js.map +1 -1
- package/lib/cjs/components/Text/interface/index.js +5 -12
- package/lib/cjs/components/Text/interface/index.js.map +1 -1
- package/lib/cjs/components/Text/styles.js +1 -1
- package/lib/cjs/index.js +46 -22
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/_chunks/B3zY_xWO.js +17 -0
- package/lib/esm/_chunks/B3zY_xWO.js.map +1 -0
- package/lib/esm/_chunks/BITrbAAT.js +42 -0
- package/lib/esm/_chunks/BITrbAAT.js.map +1 -0
- package/lib/esm/_chunks/BKS4Pa1R.js +13 -0
- package/lib/esm/_chunks/BKS4Pa1R.js.map +1 -0
- package/lib/esm/_chunks/BfaGqGMC.js +11 -0
- package/lib/esm/_chunks/BfaGqGMC.js.map +1 -0
- package/lib/esm/_chunks/BswK5qRp.js +18 -0
- package/lib/esm/_chunks/BswK5qRp.js.map +1 -0
- package/lib/esm/_chunks/Bw08lvHs.js +17 -0
- package/lib/esm/_chunks/Bw08lvHs.js.map +1 -0
- package/lib/esm/_chunks/CszwJiJx.js +22 -0
- package/lib/esm/_chunks/CszwJiJx.js.map +1 -0
- package/lib/esm/_chunks/D7oyCwVx.js +17 -0
- package/lib/esm/_chunks/D7oyCwVx.js.map +1 -0
- package/lib/esm/_chunks/DKABHJAn.js +41 -0
- package/lib/esm/_chunks/DKABHJAn.js.map +1 -0
- package/lib/esm/_chunks/{C6lwOm3T.js → DhfjJNaB.js} +31 -11
- package/lib/esm/_chunks/DhfjJNaB.js.map +1 -0
- package/lib/esm/_chunks/{zVU7tqWk.js → GCWGuPmB.js} +14 -2
- package/lib/esm/_chunks/{zVU7tqWk.js.map → GCWGuPmB.js.map} +1 -1
- package/lib/esm/components/Button/Button.js +36 -0
- package/lib/esm/components/Button/Button.js.map +1 -0
- package/lib/esm/components/Button/index.js +27 -8
- package/lib/esm/components/Button/index.js.map +1 -1
- package/lib/esm/components/Button/interface/index.js +1 -11
- package/lib/esm/components/Button/interface/index.js.map +1 -1
- package/lib/esm/components/Button/styleMap.js +23 -8
- package/lib/esm/components/Button/styleMap.js.map +1 -1
- package/lib/esm/components/Collapse/Collapse.js +56 -0
- package/lib/esm/components/Collapse/Collapse.js.map +1 -0
- package/lib/esm/components/Collapse/Item/Item.js +109 -0
- package/lib/esm/components/Collapse/Item/Item.js.map +1 -0
- package/lib/esm/components/Collapse/Item/interface/index.js +10 -0
- package/lib/esm/components/Collapse/Item/interface/index.js.map +1 -0
- package/lib/esm/components/Collapse/Item/styles.js +32 -0
- package/lib/esm/components/Collapse/Item/styles.js.map +1 -0
- package/lib/esm/components/Collapse/hooks/useCollapseContext.js +12 -0
- package/lib/esm/components/Collapse/hooks/useCollapseContext.js.map +1 -0
- package/lib/esm/components/Collapse/index.js +14 -0
- package/lib/esm/components/Collapse/index.js.map +1 -0
- package/lib/esm/components/Collapse/interface/index.js +9 -0
- package/lib/esm/components/Collapse/interface/index.js.map +1 -0
- package/lib/esm/components/ConfigProvider/ConfigProvider.js +1 -1
- package/lib/esm/components/ConfigProvider/hooks/ConfigCache/ConfigCache.js +1 -1
- package/lib/esm/components/ConfigProvider/hooks/ConfigCache/index.js +1 -1
- package/lib/esm/components/ConfigProvider/hooks/themeToken/useThemeToken.js +1 -1
- package/lib/esm/components/ConfigProvider/index.js +10 -22
- package/lib/esm/components/ConfigProvider/index.js.map +1 -1
- package/lib/esm/components/ConfigProvider/interface/index.js +1 -34
- package/lib/esm/components/ConfigProvider/interface/index.js.map +1 -1
- package/lib/esm/components/Empty/Empty.js +40 -0
- package/lib/esm/components/Empty/Empty.js.map +1 -0
- package/lib/esm/components/Empty/hooks/useDefaultIcon.js +8 -0
- package/lib/esm/components/Empty/hooks/useDefaultIcon.js.map +1 -0
- package/lib/esm/components/Empty/index.js +16 -0
- package/lib/esm/components/Empty/index.js.map +1 -0
- package/lib/esm/components/Empty/interface/index.js +2 -0
- package/lib/esm/components/Empty/interface/index.js.map +1 -0
- package/lib/esm/components/Empty/styles.js +34 -0
- package/lib/esm/components/Empty/styles.js.map +1 -0
- package/lib/esm/components/Image/Image.js +126 -0
- package/lib/esm/components/Image/Image.js.map +1 -0
- package/lib/esm/components/Image/hook/index.js +2 -2
- package/lib/esm/components/Image/index.js +4 -4
- package/lib/esm/components/Image/index.js.map +1 -1
- package/lib/esm/components/Image/interface/index.js +1 -32
- package/lib/esm/components/Image/interface/index.js.map +1 -1
- package/lib/esm/components/Popover/Popover.js +124 -0
- package/lib/esm/components/Popover/Popover.js.map +1 -0
- package/lib/esm/components/Popover/component.js +1 -1
- package/lib/esm/components/Popover/hook.js +1 -1
- package/lib/esm/components/Popover/index.js +10 -120
- package/lib/esm/components/Popover/index.js.map +1 -1
- package/lib/esm/components/Popover/interface/index.js +1 -11
- package/lib/esm/components/Popover/interface/index.js.map +1 -1
- package/lib/esm/components/Popover/styles.js +25 -0
- package/lib/esm/components/Popover/styles.js.map +1 -0
- package/lib/esm/components/Result/Result.js +48 -0
- package/lib/esm/components/Result/Result.js.map +1 -0
- package/lib/esm/components/Result/hooks/useDefaultIcon.js +17 -0
- package/lib/esm/components/Result/hooks/useDefaultIcon.js.map +1 -0
- package/lib/esm/components/Result/index.js +16 -0
- package/lib/esm/components/Result/index.js.map +1 -0
- package/lib/esm/components/Result/interface/index.js +2 -0
- package/lib/esm/components/Result/interface/index.js.map +1 -0
- package/lib/esm/components/Result/styles.js +43 -0
- package/lib/esm/components/Result/styles.js.map +1 -0
- package/lib/esm/components/Switch/Switch.js +76 -0
- package/lib/esm/components/Switch/Switch.js.map +1 -0
- package/lib/esm/components/Switch/index.js +8 -63
- package/lib/esm/components/Switch/index.js.map +1 -1
- package/lib/esm/components/Switch/interface/index.js +2 -11
- package/lib/esm/components/Switch/interface/index.js.map +1 -1
- package/lib/esm/components/Switch/styles.js.map +1 -1
- package/lib/esm/components/Tag/Tag.js +199 -0
- package/lib/esm/components/Tag/Tag.js.map +1 -0
- package/lib/esm/components/Tag/index.js +8 -207
- package/lib/esm/components/Tag/index.js.map +1 -1
- package/lib/esm/components/Tag/interface/index.js +1 -18
- package/lib/esm/components/Tag/interface/index.js.map +1 -1
- package/lib/esm/components/Tag/styles.js +25 -0
- package/lib/esm/components/Tag/styles.js.map +1 -0
- package/lib/esm/components/Text/Text.js +155 -0
- package/lib/esm/components/Text/Text.js.map +1 -0
- package/lib/esm/components/Text/hooks/cloneContainer.js +1 -1
- package/lib/esm/components/Text/hooks/index.js +1 -1
- package/lib/esm/components/Text/hooks/loadFontFromFile.js +1 -1
- package/lib/esm/components/Text/index.js +10 -146
- package/lib/esm/components/Text/index.js.map +1 -1
- package/lib/esm/components/Text/interface/index.js +1 -12
- package/lib/esm/components/Text/interface/index.js.map +1 -1
- package/lib/esm/components/Text/styles.js +1 -1
- package/lib/esm/index.js +28 -11
- package/lib/esm/index.js.map +1 -1
- package/lib/types/components/Button/Button.d.ts +4 -0
- package/lib/types/components/Button/index.d.ts +3 -3
- package/lib/types/components/Button/interface/index.d.ts +2 -0
- package/lib/types/components/Button/styleMap.d.ts +8 -0
- package/lib/types/components/Collapse/Collapse.d.ts +13 -0
- package/lib/types/components/Collapse/Item/Item.d.ts +7 -0
- package/lib/types/components/Collapse/Item/interface/index.d.ts +12 -0
- package/lib/types/components/Collapse/Item/styles.d.ts +19 -0
- package/lib/types/components/Collapse/demo/index.d.ts +2 -0
- package/lib/types/components/Collapse/hooks/useCollapseContext.d.ts +3 -0
- package/lib/types/components/Collapse/index.d.ts +3 -0
- package/lib/types/components/Collapse/interface/index.d.ts +24 -0
- package/lib/types/components/Collapse/test/demo.d.ts +2 -0
- package/lib/types/components/Collapse/test/index.bench.d.ts +1 -0
- package/lib/types/components/Collapse/test/index.test.d.ts +1 -0
- package/lib/types/components/ConfigProvider/hooks/ConfigCache/interface.d.ts +1 -1
- package/lib/types/components/ConfigProvider/index.d.ts +2 -0
- package/lib/types/components/Empty/Empty.d.ts +9 -0
- package/lib/types/components/Empty/demo/index.d.ts +2 -0
- package/lib/types/components/Empty/hooks/useDefaultIcon.d.ts +5 -0
- package/lib/types/components/Empty/index.d.ts +4 -0
- package/lib/types/components/Empty/interface/index.d.ts +9 -0
- package/lib/types/components/Empty/styles.d.ts +20 -0
- package/lib/types/components/Empty/test/index.bench.d.ts +1 -0
- package/lib/types/components/Empty/test/index.test.d.ts +1 -0
- package/lib/types/components/Image/Image.d.ts +5 -0
- package/lib/types/components/Image/index.d.ts +4 -5
- package/lib/types/components/Popover/Popover.d.ts +4 -0
- package/lib/types/components/Popover/index.d.ts +4 -4
- package/lib/types/components/Popover/styles.d.ts +20 -0
- package/lib/types/components/Result/Result.d.ts +11 -0
- package/lib/types/components/Result/demo/index.d.ts +2 -0
- package/lib/types/components/Result/hooks/useDefaultIcon.d.ts +14 -0
- package/lib/types/components/Result/index.d.ts +4 -0
- package/lib/types/components/Result/interface/index.d.ts +13 -0
- package/lib/types/components/Result/styles.d.ts +29 -0
- package/lib/types/components/Result/test/Demo.d.ts +2 -0
- package/lib/types/components/Result/test/index.bench.d.ts +1 -0
- package/lib/types/components/Result/test/index.test.d.ts +1 -0
- package/lib/types/components/Switch/Switch.d.ts +13 -0
- package/lib/types/components/Switch/index.d.ts +3 -12
- package/lib/types/components/Tag/Tag.d.ts +4 -0
- package/lib/types/components/Tag/index.d.ts +3 -3
- package/lib/types/components/Tag/interface/index.d.ts +2 -5
- package/lib/types/components/Tag/styles.d.ts +20 -0
- package/lib/types/components/Text/Text.d.ts +4 -0
- package/lib/types/components/Text/index.d.ts +4 -4
- package/lib/types/index.d.ts +10 -10
- package/package.json +2 -2
- package/src/components/Button/{index.tsx → Button.tsx} +5 -2
- package/src/components/Button/demo/index.tsx +4 -1
- package/src/components/Button/doc/index.mdx +15 -13
- package/src/components/Button/index.ts +5 -0
- package/src/components/Button/interface/index.ts +2 -0
- package/src/components/Button/styleMap.ts +9 -0
- package/src/components/Button/test/__snapshots__/index.test.tsx.snap +3 -0
- package/src/components/Button/test/index.test.tsx +25 -1
- package/src/components/Collapse/Collapse.tsx +72 -0
- package/src/components/Collapse/Item/Item.tsx +103 -0
- package/src/components/Collapse/Item/interface/index.ts +21 -0
- package/src/components/Collapse/Item/styles.ts +27 -0
- package/src/components/Collapse/demo/index.tsx +60 -0
- package/src/components/Collapse/doc/index.mdx +24 -0
- package/src/components/Collapse/hooks/useCollapseContext.ts +8 -0
- package/src/components/Collapse/index.ts +4 -0
- package/src/components/Collapse/interface/index.ts +25 -0
- package/src/components/Collapse/test/demo.tsx +62 -0
- package/src/components/Collapse/test/index.bench.tsx +13 -0
- package/src/components/Collapse/test/index.test.tsx +61 -0
- package/src/components/ConfigProvider/doc/index.mdx +8 -8
- package/src/components/ConfigProvider/hooks/ConfigCache/interface.ts +1 -1
- package/src/components/ConfigProvider/index.ts +3 -0
- package/src/components/Empty/Empty.tsx +29 -0
- package/src/components/Empty/demo/index.tsx +39 -0
- package/src/components/Empty/doc/index.mdx +19 -0
- package/src/components/Empty/hooks/useDefaultIcon.ts +5 -0
- package/src/components/Empty/index.ts +5 -0
- package/src/components/Empty/interface/index.ts +10 -0
- package/src/components/Empty/styles.ts +29 -0
- package/src/components/Empty/test/index.bench.tsx +12 -0
- package/src/components/Empty/test/index.test.tsx +26 -0
- package/src/components/Image/Image.tsx +121 -0
- package/src/components/Image/demo/index.tsx +2 -1
- package/src/components/Image/doc/index.mdx +13 -13
- package/src/components/Image/index.ts +5 -0
- package/src/components/Image/index.tsx +1 -2
- package/src/components/Popover/demo/index.tsx +2 -2
- package/src/components/Popover/doc/index.mdx +15 -15
- package/src/components/Popover/index.ts +5 -0
- package/src/components/Popover/styles.ts +24 -0
- package/src/components/Result/Result.tsx +35 -0
- package/src/components/Result/demo/index.tsx +58 -0
- package/src/components/Result/doc/index.mdx +21 -0
- package/src/components/Result/hooks/useDefaultIcon.ts +21 -0
- package/src/components/Result/index.ts +5 -0
- package/src/components/Result/interface/index.ts +14 -0
- package/src/components/Result/styles.ts +38 -0
- package/src/components/Result/test/Demo.tsx +80 -0
- package/src/components/Result/test/index.bench.tsx +12 -0
- package/src/components/Result/test/index.test.tsx +101 -0
- package/src/components/Switch/{index.tsx → Switch.tsx} +23 -9
- package/src/components/Switch/demo/index.tsx +7 -1
- package/src/components/Switch/doc/index.mdx +11 -11
- package/src/components/Switch/index.ts +5 -0
- package/src/components/Switch/test/index.bench.tsx +1 -1
- package/src/components/Switch/test/paper.bench.tsx +1 -1
- package/src/components/Tag/Tag.tsx +195 -0
- package/src/components/Tag/demo/index.tsx +0 -24
- package/src/components/Tag/doc/index.mdx +18 -20
- package/src/components/Tag/index.ts +5 -0
- package/src/components/Tag/interface/index.ts +1 -5
- package/src/components/{Switch/styles.tsx → Tag/styles.ts} +1 -1
- package/src/components/Tag/test/index.test.tsx +4 -32
- package/src/components/Text/doc/index.mdx +17 -17
- package/src/components/Text/index.ts +5 -0
- package/src/index.ts +10 -12
- package/lib/cjs/_chunks/BUZe8G-Q.js.map +0 -1
- package/lib/cjs/components/Popover/manifest.js +0 -3
- package/lib/cjs/components/Popover/manifest.js.map +0 -1
- package/lib/esm/_chunks/C6lwOm3T.js.map +0 -1
- package/lib/esm/components/Popover/manifest.js +0 -2
- package/lib/esm/components/Popover/manifest.js.map +0 -1
- package/lib/types/components/Popover/manifest.d.ts +0 -3
- package/src/components/Popover/manifest.ts +0 -3
- package/src/components/Tag/index.tsx +0 -199
- /package/src/components/Popover/{index.tsx → Popover.tsx} +0 -0
- /package/src/components/{ConfigProvider/index.tsx → Switch/styles.ts} +0 -0
- /package/src/components/Text/{index.tsx → Text.tsx} +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { typography } from "@xhs/reds-token-next";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import { useThemeColor } from "../ConfigProvider";
|
|
4
|
+
|
|
5
|
+
const createStyles = () => {
|
|
6
|
+
const themeColor = useThemeColor("Empty");
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
paddingHorizontal: 48,
|
|
11
|
+
paddingVertical: 24,
|
|
12
|
+
},
|
|
13
|
+
description: {
|
|
14
|
+
marginTop: 16,
|
|
15
|
+
},
|
|
16
|
+
descriptionText: {
|
|
17
|
+
fontSize: typography.B2LooseFontSize,
|
|
18
|
+
fontWeight: typography.B2LooseFontWeight,
|
|
19
|
+
lineHeight: typography.B2LineHeight,
|
|
20
|
+
color: themeColor.Description,
|
|
21
|
+
},
|
|
22
|
+
action: {
|
|
23
|
+
marginTop: 20,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return styles;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default createStyles;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import Empty from "../";
|
|
6
|
+
import { render } from "@testing-library/react-native";
|
|
7
|
+
|
|
8
|
+
describe("render", () => {
|
|
9
|
+
redsBench("base", async () => {
|
|
10
|
+
render(<Empty></Empty>);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { render, fireEvent, userEvent } from "@testing-library/react-native";
|
|
3
|
+
import "@testing-library/react-native/extend-expect";
|
|
4
|
+
import { Pressable, Text, View } from "react-native";
|
|
5
|
+
import Empty from "../index";
|
|
6
|
+
|
|
7
|
+
describe("Empty", () => {
|
|
8
|
+
it("renders default title and image", () => {
|
|
9
|
+
const wrapper = render(<Empty />);
|
|
10
|
+
const titleElement = wrapper.getByText("暂无数据");
|
|
11
|
+
expect(titleElement).toBeTruthy();
|
|
12
|
+
});
|
|
13
|
+
it("action", () => {
|
|
14
|
+
const wrapper = render(
|
|
15
|
+
<Empty
|
|
16
|
+
action={
|
|
17
|
+
<Pressable>
|
|
18
|
+
<Text>按钮</Text>
|
|
19
|
+
</Pressable>
|
|
20
|
+
}
|
|
21
|
+
/>,
|
|
22
|
+
);
|
|
23
|
+
const titleElement = wrapper.getByText("暂无数据");
|
|
24
|
+
expect(titleElement).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { useState, forwardRef, memo, ForwardRefRenderFunction, useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Image as RNImage,
|
|
5
|
+
GestureResponderEvent,
|
|
6
|
+
ImageProps,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
ImageLoadEventData,
|
|
9
|
+
NativeSyntheticEvent,
|
|
10
|
+
ImageErrorEventData,
|
|
11
|
+
ImageProgressEventDataIOS,
|
|
12
|
+
} from "react-native";
|
|
13
|
+
import { RedsImage, ImageDefaultProps, IMAGE_STATUS, TErrorStyle, TLoadStyle } from "./interface/index";
|
|
14
|
+
import styles from "./styles";
|
|
15
|
+
import { useImage } from "./hook";
|
|
16
|
+
import CircularProgress from "./CircularProgress";
|
|
17
|
+
|
|
18
|
+
const Image = forwardRef<RNImage, RedsImage & Omit<ImageProps, keyof RedsImage>>(
|
|
19
|
+
({ src, source: _source, width, height, borderRadius, errorStyle, loadStyle, style, ...props }, ref) => {
|
|
20
|
+
const [imageStatus, setImageStatus] = useState(IMAGE_STATUS.LOADING);
|
|
21
|
+
const [progress, setProgress] = useState(0);
|
|
22
|
+
|
|
23
|
+
const { source, aveColor, blurSource } = useImage({
|
|
24
|
+
src,
|
|
25
|
+
source: _source,
|
|
26
|
+
errorStyle,
|
|
27
|
+
loadStyle,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const onProgress = (e: NativeSyntheticEvent<ImageProgressEventDataIOS>) => {
|
|
31
|
+
const {
|
|
32
|
+
nativeEvent: { total, loaded },
|
|
33
|
+
} = e;
|
|
34
|
+
if (total) {
|
|
35
|
+
setProgress(((loaded / total) * 100) | 0);
|
|
36
|
+
}
|
|
37
|
+
props.onProgress?.(e);
|
|
38
|
+
};
|
|
39
|
+
const onLoad = (e: NativeSyntheticEvent<ImageLoadEventData>) => {
|
|
40
|
+
props.onLoad?.(e);
|
|
41
|
+
setImageStatus(IMAGE_STATUS.LOADED);
|
|
42
|
+
};
|
|
43
|
+
const onError = (e: NativeSyntheticEvent<ImageErrorEventData>) => {
|
|
44
|
+
props.onError?.(e);
|
|
45
|
+
setImageStatus(errorStyle === TErrorStyle.ERROR ? IMAGE_STATUS.LOADERROR : IMAGE_STATUS.RELOAD);
|
|
46
|
+
};
|
|
47
|
+
const onReload = (e: GestureResponderEvent) => {
|
|
48
|
+
setImageStatus(IMAGE_STATUS.HIDE);
|
|
49
|
+
props.onReload?.(e);
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
setImageStatus(IMAGE_STATUS.LOADING);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<View style={{ borderRadius, height, width, ...(style as {}) }} ref={ref}>
|
|
57
|
+
{imageStatus !== IMAGE_STATUS.HIDE && (
|
|
58
|
+
<RNImage
|
|
59
|
+
{...props}
|
|
60
|
+
source={source}
|
|
61
|
+
onLoad={onLoad}
|
|
62
|
+
onProgress={onProgress}
|
|
63
|
+
onError={onError}
|
|
64
|
+
style={{
|
|
65
|
+
width,
|
|
66
|
+
height,
|
|
67
|
+
borderRadius,
|
|
68
|
+
opacity: imageStatus === IMAGE_STATUS.LOADED ? 1 : 0,
|
|
69
|
+
}}
|
|
70
|
+
></RNImage>
|
|
71
|
+
)}
|
|
72
|
+
{imageStatus === IMAGE_STATUS.LOADING && (
|
|
73
|
+
<View
|
|
74
|
+
style={{
|
|
75
|
+
width,
|
|
76
|
+
height,
|
|
77
|
+
borderRadius,
|
|
78
|
+
...styles.loadingContainer,
|
|
79
|
+
backgroundColor: loadStyle === TLoadStyle.AVE ? aveColor : styles.loadingContainer.backgroundColor,
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{loadStyle === TLoadStyle.BLUR && (
|
|
83
|
+
<RNImage
|
|
84
|
+
source={blurSource}
|
|
85
|
+
style={{
|
|
86
|
+
width,
|
|
87
|
+
height,
|
|
88
|
+
borderRadius,
|
|
89
|
+
}}
|
|
90
|
+
></RNImage>
|
|
91
|
+
)}
|
|
92
|
+
{loadStyle === TLoadStyle.LOADING && <CircularProgress progress={progress}></CircularProgress>}
|
|
93
|
+
</View>
|
|
94
|
+
)}
|
|
95
|
+
{(imageStatus === IMAGE_STATUS.LOADERROR || imageStatus === IMAGE_STATUS.RELOAD) && (
|
|
96
|
+
<TouchableOpacity
|
|
97
|
+
activeOpacity={1}
|
|
98
|
+
onPress={(e) => {
|
|
99
|
+
onReload(e);
|
|
100
|
+
}}
|
|
101
|
+
style={{ width, height, borderRadius, ...styles.loadingContainer }}
|
|
102
|
+
>
|
|
103
|
+
<RNImage
|
|
104
|
+
style={{ width: 40, height: 40 }}
|
|
105
|
+
source={{
|
|
106
|
+
uri:
|
|
107
|
+
imageStatus === IMAGE_STATUS.RELOAD
|
|
108
|
+
? "https://picasso-static.xiaohongshu.com/fe-platform/06ae169b310c2926e541903b828486a80fcac404.png"
|
|
109
|
+
: "https://picasso-static.xiaohongshu.com/fe-platform/76fee5bba4ce3bbf3e9ff5fe1935b737bb27625a.png",
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
</TouchableOpacity>
|
|
113
|
+
)}
|
|
114
|
+
</View>
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
Image.defaultProps = ImageDefaultProps;
|
|
120
|
+
|
|
121
|
+
export default memo(Image);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useState } from "react";
|
|
2
2
|
import { View, Text, StyleSheet, FlatList, ScrollView, Image as RNImage } from "react-native";
|
|
3
|
-
import { Image,
|
|
3
|
+
import { Image, ImageType } from "@xhs/reds-rn-next";
|
|
4
|
+
const { TErrorStyle, TLoadStyle } = ImageType;
|
|
4
5
|
|
|
5
6
|
const Desc = ({ children = "" }) => {
|
|
6
7
|
return <Text>{children}</Text>;
|
|
@@ -10,19 +10,19 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
10
10
|
|
|
11
11
|
### Props
|
|
12
12
|
|
|
13
|
-
| 属性
|
|
14
|
-
|
|
|
15
|
-
| src
|
|
16
|
-
| source
|
|
17
|
-
| width
|
|
18
|
-
| height
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| ------------ | --------------------------------- | ------------------------------------ | ------------------ |
|
|
15
|
+
| src | 图片路径 | string | |
|
|
16
|
+
| source | 图片 source ,与原生 image 相同。 | ImageSourcePropType | |
|
|
17
|
+
| width | 图片宽度 | number | DimensionValue | |
|
|
18
|
+
| height | 图片高度 | number | DimensionValue | |
|
|
19
|
+
| borderRadius | 图片圆角 | number | AnimatableNumericValue | |
|
|
20
|
+
| loadStyle | 加载风格 | TLoadStyle | TLoadStyle.LOADING |
|
|
21
|
+
| loadMode | 加载方式 | TLoadMode | TLoadMode.LAZY |
|
|
22
|
+
| errorStyle | 失败时展示样式 | TErrorStyle | TErrorStyle.ERROR |
|
|
23
23
|
|
|
24
24
|
### Events
|
|
25
25
|
|
|
26
|
-
| 事件
|
|
27
|
-
|
|
|
28
|
-
|
|
|
26
|
+
| 事件 | 描述 | 类型 | 默认值 |
|
|
27
|
+
| -------- | -------------- | ---------------------------------- | ------ |
|
|
28
|
+
| onReload | 重新加载时触发 | (v: GestureResponderEvent) => void | |
|
|
@@ -53,11 +53,10 @@ const Image = forwardRef<RNImage, RedsImage & Omit<ImageProps, keyof RedsImage>>
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<View style={{ borderRadius, height, width, ...(style as {}) }}>
|
|
56
|
+
<View style={{ borderRadius, height, width, ...(style as {}) }} ref={ref}>
|
|
57
57
|
{imageStatus !== IMAGE_STATUS.HIDE && (
|
|
58
58
|
<RNImage
|
|
59
59
|
{...props}
|
|
60
|
-
ref={ref}
|
|
61
60
|
source={source}
|
|
62
61
|
onLoad={onLoad}
|
|
63
62
|
onProgress={onProgress}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useState, forwardRef } from "react";
|
|
2
2
|
import { View, Text, StyleSheet, FlatList, ScrollView } from "react-native";
|
|
3
|
-
import { Popover, Button,
|
|
3
|
+
import { Popover, Button, PopoverType } from "@xhs/reds-rn-next";
|
|
4
4
|
|
|
5
5
|
const styles = StyleSheet.create({
|
|
6
6
|
container: {
|
|
@@ -62,7 +62,7 @@ export default function App() {
|
|
|
62
62
|
|
|
63
63
|
<Br />
|
|
64
64
|
|
|
65
|
-
<Popover content={placement} placement={placement as RedsPopover["placement"]} visible>
|
|
65
|
+
<Popover content={placement} placement={placement as PopoverType.RedsPopover["placement"]} visible>
|
|
66
66
|
<Button>{"气泡位置"}</Button>
|
|
67
67
|
</Popover>
|
|
68
68
|
</View>
|
|
@@ -8,21 +8,21 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
8
8
|
|
|
9
9
|
### Props
|
|
10
10
|
|
|
11
|
-
| 属性
|
|
12
|
-
|
|
|
13
|
-
| visible
|
|
14
|
-
| placement
|
|
15
|
-
| content
|
|
16
|
-
| opacity
|
|
17
|
-
| mode
|
|
18
|
-
| trigger
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
| children
|
|
11
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
12
|
+
| ----------------- | ---------------------- | --------------------------------------------------------------------------------------------------- | --------- |
|
|
13
|
+
| visible | 是否显示气泡 | boolean | undefined |
|
|
14
|
+
| placement | 气泡方向 | "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end" | top |
|
|
15
|
+
| content | 弹出内容 | string | |
|
|
16
|
+
| opacity | 遮罩透明度 | number | 0 |
|
|
17
|
+
| mode | 主题色 | "light" | "dark" | |
|
|
18
|
+
| trigger | 触发方式 | "click" | "touch" | click |
|
|
19
|
+
| zIndex | 层级 | number | 1000 |
|
|
20
|
+
| closeOnClickAgain | 再次点击关闭 | boolean | true |
|
|
21
|
+
| children | popover 作用的目标节点 | ReactNode | |
|
|
22
22
|
|
|
23
23
|
### Events
|
|
24
24
|
|
|
25
|
-
| 事件
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
25
|
+
| 事件 | 描述 | 类型 | 默认值 |
|
|
26
|
+
| --------------- | ---------------- | ------------------------ | ------ |
|
|
27
|
+
| onClickMask | 点击遮罩层时触发 | (evnet: Event) => void | |
|
|
28
|
+
| onVisibleChange | 点击遮罩层时触发 | (value: boolean) => void | |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { alwaysColor } from "@xhs/reds-token-next";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
const styles = StyleSheet.create({
|
|
5
|
+
PopoverContainer: {
|
|
6
|
+
width: 40,
|
|
7
|
+
height: 24,
|
|
8
|
+
borderRadius: 15,
|
|
9
|
+
justifyContent: "center",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
},
|
|
12
|
+
thumb: {
|
|
13
|
+
width: 20,
|
|
14
|
+
height: 20,
|
|
15
|
+
borderRadius: 10,
|
|
16
|
+
backgroundColor: alwaysColor.White,
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
position: "absolute",
|
|
20
|
+
left: 0,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default styles;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
2
|
+
import { View, Text, Image } from "react-native";
|
|
3
|
+
import { RedsResult, ResultDefaultProps } from "./interface/index";
|
|
4
|
+
import createStyles from "./styles";
|
|
5
|
+
import { defaultIcon } from "./hooks/useDefaultIcon";
|
|
6
|
+
|
|
7
|
+
const Result = (props: RedsResult) => {
|
|
8
|
+
const { type, title, description, action, image } = { ...(ResultDefaultProps as RedsResult), ...props };
|
|
9
|
+
const styles = createStyles();
|
|
10
|
+
const defaultTitle = title || defaultIcon[type || "Success"]?.title;
|
|
11
|
+
const defaultImage = image || (
|
|
12
|
+
<Image style={{ height: 52, width: 52 }} source={{ uri: defaultIcon[type || "Success"]?.image }}></Image>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<View style={styles.container}>
|
|
18
|
+
<View>{defaultImage}</View>
|
|
19
|
+
<View style={styles.title}>
|
|
20
|
+
<Text style={styles.titleText}>{defaultTitle}</Text>
|
|
21
|
+
</View>
|
|
22
|
+
{description && (
|
|
23
|
+
<View style={styles.description}>
|
|
24
|
+
<Text style={styles.descriptionText}>{description}</Text>
|
|
25
|
+
</View>
|
|
26
|
+
)}
|
|
27
|
+
{action && <View style={styles.action}>{action}</View>}
|
|
28
|
+
</View>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
Result.defaultProps = ResultDefaultProps;
|
|
34
|
+
|
|
35
|
+
export default Result;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, ScrollView, Image } from "react-native";
|
|
3
|
+
import { Button, Result } from "@xhs/reds-rn-next";
|
|
4
|
+
|
|
5
|
+
const Desc = ({ children = "" }) => {
|
|
6
|
+
return <Text>{children}</Text>;
|
|
7
|
+
};
|
|
8
|
+
const Br = (props: { height?: number }) => <View style={{ height: props.height || 20 }}></View>;
|
|
9
|
+
|
|
10
|
+
const ActionButton = () => {
|
|
11
|
+
return (
|
|
12
|
+
<View style={{ flexDirection: "row" }}>
|
|
13
|
+
<Button variant={"outline"}>次要操作</Button>
|
|
14
|
+
<Button variant={"outline"} type={"primary"} style={{ marginLeft: 12 }}>
|
|
15
|
+
主要操作
|
|
16
|
+
</Button>
|
|
17
|
+
</View>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ImageCustom = () => {
|
|
22
|
+
return <Image source={{ uri: "https://img.yzcdn.cn/vant/cat.jpeg" }} style={{ height: 52, width: 52 }} />;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default function App() {
|
|
26
|
+
return (
|
|
27
|
+
<ScrollView>
|
|
28
|
+
<Desc>基础用法</Desc>
|
|
29
|
+
<Result></Result>
|
|
30
|
+
<Result type={"Info"}></Result>
|
|
31
|
+
<Result type={"Warning"}></Result>
|
|
32
|
+
<Br />
|
|
33
|
+
<Desc>描述</Desc>
|
|
34
|
+
<Result description="我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"></Result>
|
|
35
|
+
<Result
|
|
36
|
+
type={"Info"}
|
|
37
|
+
description="我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"
|
|
38
|
+
></Result>
|
|
39
|
+
<Result
|
|
40
|
+
type={"Warning"}
|
|
41
|
+
description="我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"
|
|
42
|
+
></Result>
|
|
43
|
+
<Br />
|
|
44
|
+
<Desc>操作按钮</Desc>
|
|
45
|
+
<Result action={<ActionButton />}></Result>
|
|
46
|
+
<Result type={"Info"} action={<ActionButton />}></Result>
|
|
47
|
+
<Result type={"Warning"} action={<ActionButton />}></Result>
|
|
48
|
+
<Br />
|
|
49
|
+
<Desc>自定义</Desc>
|
|
50
|
+
<Result
|
|
51
|
+
title={"我是自定义标题"}
|
|
52
|
+
description={"我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"}
|
|
53
|
+
action={<ActionButton />}
|
|
54
|
+
image={<ImageCustom />}
|
|
55
|
+
></Result>
|
|
56
|
+
</ScrollView>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
2
|
+
|
|
3
|
+
## 演示
|
|
4
|
+
|
|
5
|
+
### 基础用法
|
|
6
|
+
|
|
7
|
+
::BaseDemo::
|
|
8
|
+
|
|
9
|
+
## API
|
|
10
|
+
|
|
11
|
+
### Props
|
|
12
|
+
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| ----------- | ------------ | ---------------------------------------- | ------- |
|
|
15
|
+
| type | 类型 | "Success" | "Warning" | "Info" | Success |
|
|
16
|
+
| title | 标题 | string | |
|
|
17
|
+
| description | 描述 | string | |
|
|
18
|
+
| action | 底部操作按钮 | ReactNode | |
|
|
19
|
+
| image | 图片 | ReactNode | |
|
|
20
|
+
|
|
21
|
+
### Events
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Image } from "react-native";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import SuccessIcon from "./icons/success.png";
|
|
4
|
+
import WarningIcon from "./icons/warning.png";
|
|
5
|
+
import InfoIcon from "./icons/info.png";
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
|
|
8
|
+
export const defaultIcon = {
|
|
9
|
+
Success: {
|
|
10
|
+
title: "成功提示",
|
|
11
|
+
image: "https://picasso-static.xiaohongshu.com/fe-platform/c002a29a531d29939a0869bee6537710478a0d10.png",
|
|
12
|
+
},
|
|
13
|
+
Warning: {
|
|
14
|
+
title: "警告",
|
|
15
|
+
image: "https://picasso-static.xiaohongshu.com/fe-platform/63901d54ceaf53ce6c268139528b339e0c7ace38.png",
|
|
16
|
+
},
|
|
17
|
+
Info: {
|
|
18
|
+
title: "处理中",
|
|
19
|
+
image: "https://picasso-static.xiaohongshu.com/fe-platform/c403af64f3b3e5e187812d07eb1207add1d8558e.png",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface RedsResult {
|
|
3
|
+
type?: "Success" | "Warning" | "Info";
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
image?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ResultDefaultProps = {
|
|
11
|
+
type: "Success",
|
|
12
|
+
title: "",
|
|
13
|
+
description: "",
|
|
14
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { typography } from "@xhs/reds-token-next";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import { useThemeColor } from "../ConfigProvider";
|
|
4
|
+
|
|
5
|
+
const createStyles = () => {
|
|
6
|
+
const themeColor = useThemeColor("Result");
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
paddingHorizontal: 48,
|
|
11
|
+
paddingVertical: 24,
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
marginTop: 12,
|
|
15
|
+
},
|
|
16
|
+
titleText: {
|
|
17
|
+
fontSize: typography.B1FontSize,
|
|
18
|
+
fontWeight: typography.B1FontWeight,
|
|
19
|
+
lineHeight: typography.B1LineHeight,
|
|
20
|
+
color: themeColor.Title,
|
|
21
|
+
},
|
|
22
|
+
description: {
|
|
23
|
+
marginTop: 8,
|
|
24
|
+
},
|
|
25
|
+
descriptionText: {
|
|
26
|
+
fontSize: typography.C2FontSize,
|
|
27
|
+
fontWeight: typography.C2FontWeight,
|
|
28
|
+
lineHeight: typography.C2LineHeight,
|
|
29
|
+
color: themeColor.Description,
|
|
30
|
+
},
|
|
31
|
+
action: {
|
|
32
|
+
marginTop: 24,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return styles;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default createStyles;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { View, Text, ScrollView, Image, TouchableWithoutFeedback } from "react-native";
|
|
3
|
+
import { Button } from "@xhs/reds-rn-next";
|
|
4
|
+
import Result from "../Result";
|
|
5
|
+
|
|
6
|
+
const Desc = ({ children = "" }) => {
|
|
7
|
+
return <Text>{children}</Text>;
|
|
8
|
+
};
|
|
9
|
+
const Br = (props: { height?: number }) => <View style={{ height: props.height || 20 }}></View>;
|
|
10
|
+
|
|
11
|
+
const ActionButton = () => {
|
|
12
|
+
return (
|
|
13
|
+
<View style={{ flexDirection: "row" }}>
|
|
14
|
+
<Button variant={"outline"}>次要操作</Button>
|
|
15
|
+
<Button variant={"outline"} type={"primary"} style={{ marginLeft: 12 }}>
|
|
16
|
+
主要操作
|
|
17
|
+
</Button>
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const ImageCustom = () => {
|
|
23
|
+
return <Image source={{ uri: "https://img.yzcdn.cn/vant/cat.jpeg" }} style={{ height: 52, width: 52 }} />;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default function Demo() {
|
|
27
|
+
const [title, setTitle] = useState("标题11");
|
|
28
|
+
const [type, setType] = useState<"Success" | "Info" | "Warning">("Success");
|
|
29
|
+
const [image, setImage] = useState(<></>);
|
|
30
|
+
const onPress = () => {
|
|
31
|
+
setTitle("标题22");
|
|
32
|
+
setType("Warning");
|
|
33
|
+
setImage(<Image source={{ uri: "https://example.com/new-image.png" }}></Image>);
|
|
34
|
+
};
|
|
35
|
+
return (
|
|
36
|
+
<ScrollView>
|
|
37
|
+
<TouchableWithoutFeedback testID="123" onPress={onPress}>
|
|
38
|
+
<Text>测试组件</Text>
|
|
39
|
+
</TouchableWithoutFeedback>
|
|
40
|
+
<Desc>基础用法</Desc>
|
|
41
|
+
{
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
<Result type={type}></Result>
|
|
44
|
+
}
|
|
45
|
+
<Result type={"Info"}></Result>
|
|
46
|
+
<Result type={"Warning"}></Result>
|
|
47
|
+
<Br />
|
|
48
|
+
<Desc>描述</Desc>
|
|
49
|
+
<Result description="我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"></Result>
|
|
50
|
+
<Result
|
|
51
|
+
type={"Info"}
|
|
52
|
+
description="我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"
|
|
53
|
+
></Result>
|
|
54
|
+
<Result
|
|
55
|
+
type={"Warning"}
|
|
56
|
+
description="我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"
|
|
57
|
+
></Result>
|
|
58
|
+
<Br />
|
|
59
|
+
<Desc>操作按钮</Desc>
|
|
60
|
+
<Result action={<ActionButton />}></Result>
|
|
61
|
+
<Result type={"Info"} action={<ActionButton />}></Result>
|
|
62
|
+
<Result type={"Warning"} action={<ActionButton />}></Result>
|
|
63
|
+
<Br />
|
|
64
|
+
<Desc>自定义</Desc>
|
|
65
|
+
<Result
|
|
66
|
+
title={"test"}
|
|
67
|
+
description={"我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"}
|
|
68
|
+
action={<ActionButton />}
|
|
69
|
+
image={<ImageCustom />}
|
|
70
|
+
></Result>
|
|
71
|
+
<Result
|
|
72
|
+
type={type}
|
|
73
|
+
title={title}
|
|
74
|
+
description={"我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"}
|
|
75
|
+
action={<ActionButton />}
|
|
76
|
+
image={image}
|
|
77
|
+
></Result>
|
|
78
|
+
</ScrollView>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import Result from "../Result";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
|
|
8
|
+
describe("render", () => {
|
|
9
|
+
redsBench("base", async () => {
|
|
10
|
+
render(<Result></Result>);
|
|
11
|
+
});
|
|
12
|
+
});
|