@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,72 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useCallback, useLayoutEffect } from "react";
|
|
2
|
+
import { RedsCollapse, CollapseDefaultProps } from "./interface/index";
|
|
3
|
+
import { CollapseContext } from "./hooks/useCollapseContext";
|
|
4
|
+
|
|
5
|
+
const Collapse = (props: RedsCollapse) => {
|
|
6
|
+
const {
|
|
7
|
+
activeValue,
|
|
8
|
+
accordion,
|
|
9
|
+
defaultActiveValue,
|
|
10
|
+
onChange,
|
|
11
|
+
children = null,
|
|
12
|
+
} = {
|
|
13
|
+
...(CollapseDefaultProps as RedsCollapse),
|
|
14
|
+
...props,
|
|
15
|
+
} as RedsCollapse;
|
|
16
|
+
const activeValueInnel = useRef<Array<string | number>>([]);
|
|
17
|
+
// 新增某个 active key
|
|
18
|
+
const addActiveValue = useCallback(
|
|
19
|
+
(key: string | number) => {
|
|
20
|
+
if (accordion) {
|
|
21
|
+
activeValueInnel.current = [key];
|
|
22
|
+
} else {
|
|
23
|
+
if (!activeValueInnel.current.includes(key)) activeValueInnel.current = [...activeValueInnel.current, key];
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
[accordion],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// 移除某个 active key
|
|
30
|
+
const removeActiveValue = useCallback(
|
|
31
|
+
(key: string | number) => {
|
|
32
|
+
if (accordion) {
|
|
33
|
+
activeValueInnel.current = [];
|
|
34
|
+
} else {
|
|
35
|
+
if (activeValueInnel.current.includes(key))
|
|
36
|
+
activeValueInnel.current = activeValueInnel.current.filter((item) => item !== key);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
[accordion],
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// 是否展开
|
|
43
|
+
const isActiveValue = useCallback(
|
|
44
|
+
(key: string | number) => activeValueInnel.current.includes(key),
|
|
45
|
+
[activeValue, defaultActiveValue],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// 默认值
|
|
49
|
+
useLayoutEffect(() => {
|
|
50
|
+
activeValueInnel.current = activeValue || [];
|
|
51
|
+
if (defaultActiveValue?.length) {
|
|
52
|
+
activeValueInnel.current = defaultActiveValue;
|
|
53
|
+
}
|
|
54
|
+
}, [activeValue, defaultActiveValue]);
|
|
55
|
+
|
|
56
|
+
// 触发onChange
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (onChange) {
|
|
59
|
+
onChange(activeValueInnel.current);
|
|
60
|
+
}
|
|
61
|
+
}, [activeValueInnel, onChange]);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<CollapseContext.Provider value={{ addActiveValue, removeActiveValue, isActiveValue }}>
|
|
65
|
+
{children}
|
|
66
|
+
</CollapseContext.Provider>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
Collapse.defaultProps = { ...(CollapseDefaultProps as RedsCollapse) };
|
|
71
|
+
|
|
72
|
+
export default Collapse;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
+
import { View, Text, TouchableWithoutFeedback, Animated, Easing, LayoutChangeEvent } from "react-native";
|
|
3
|
+
import { IItem, ItemDefaultProps } from "./interface/index";
|
|
4
|
+
import createStyles from "./styles";
|
|
5
|
+
import { CollapseContext } from "../hooks/useCollapseContext";
|
|
6
|
+
|
|
7
|
+
const Item = ({ value, title, lazyRender, children, onClick }: IItem) => {
|
|
8
|
+
const styles = createStyles();
|
|
9
|
+
const { addActiveValue, isActiveValue, removeActiveValue } = React.useContext(CollapseContext);
|
|
10
|
+
const [visible, setVisible] = useState(false);
|
|
11
|
+
|
|
12
|
+
const [shouldMount, setShouldMount] = useState(!lazyRender);
|
|
13
|
+
const firstRender = useRef(false);
|
|
14
|
+
|
|
15
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
16
|
+
const [getContentHeight, setGetContentHeight] = useState(true);
|
|
17
|
+
const heightAnimation = useRef(new Animated.Value(0)).current;
|
|
18
|
+
|
|
19
|
+
const setFirstRenderTag = () => {
|
|
20
|
+
firstRender.current = true;
|
|
21
|
+
setShouldMount(true);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!getContentHeight) {
|
|
26
|
+
setGetContentHeight(true);
|
|
27
|
+
}
|
|
28
|
+
}, [children]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const isActive = isActiveValue?.(value);
|
|
32
|
+
setVisible(isActive || false);
|
|
33
|
+
if (!firstRender.current && isActive) {
|
|
34
|
+
setFirstRenderTag();
|
|
35
|
+
}
|
|
36
|
+
}, [isActiveValue]);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
Animated.timing(heightAnimation, {
|
|
40
|
+
toValue: visible ? contentHeight : 0,
|
|
41
|
+
duration: 100,
|
|
42
|
+
easing: Easing.linear,
|
|
43
|
+
useNativeDriver: false,
|
|
44
|
+
}).start();
|
|
45
|
+
}, [visible, contentHeight]);
|
|
46
|
+
|
|
47
|
+
const onPress = () => {
|
|
48
|
+
if (isActiveValue?.(value)) {
|
|
49
|
+
removeActiveValue?.(value);
|
|
50
|
+
} else {
|
|
51
|
+
if (!firstRender.current) {
|
|
52
|
+
setFirstRenderTag();
|
|
53
|
+
}
|
|
54
|
+
addActiveValue?.(value);
|
|
55
|
+
}
|
|
56
|
+
setVisible(isActiveValue?.(value) || false);
|
|
57
|
+
onClick?.(value);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handleLayout = (event: LayoutChangeEvent) => {
|
|
61
|
+
setContentHeight(event?.nativeEvent?.layout?.height || 0);
|
|
62
|
+
setGetContentHeight(false);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<View>
|
|
67
|
+
<TouchableWithoutFeedback onPress={onPress} testID={`reds-collapse-item-title-${value}`}>
|
|
68
|
+
<View style={styles.header}>
|
|
69
|
+
<Text style={styles.title}>{title}</Text>
|
|
70
|
+
</View>
|
|
71
|
+
</TouchableWithoutFeedback>
|
|
72
|
+
{shouldMount && (
|
|
73
|
+
<Animated.View
|
|
74
|
+
testID={`reds-collapse-item-content-${value}`}
|
|
75
|
+
style={{
|
|
76
|
+
height: heightAnimation,
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</Animated.View>
|
|
81
|
+
)}
|
|
82
|
+
{getContentHeight && (
|
|
83
|
+
<Animated.View
|
|
84
|
+
testID={`r2eds-collapse-item-content-${value}`}
|
|
85
|
+
onLayout={handleLayout}
|
|
86
|
+
style={{
|
|
87
|
+
position: "absolute",
|
|
88
|
+
top: -99999,
|
|
89
|
+
height: "auto",
|
|
90
|
+
minHeight: "auto",
|
|
91
|
+
maxHeight: "auto",
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{children}
|
|
95
|
+
</Animated.View>
|
|
96
|
+
)}
|
|
97
|
+
</View>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
Item.defaultProps = ItemDefaultProps;
|
|
102
|
+
|
|
103
|
+
export default Item;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface IItem {
|
|
4
|
+
value: string | number;
|
|
5
|
+
title?: string;
|
|
6
|
+
lazyRender?: boolean;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
onClick?: (value: string | number) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IItemEvent {
|
|
12
|
+
(e: "change", value: string | number): any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const ItemDefaultProps: IItem = {
|
|
16
|
+
value: "",
|
|
17
|
+
title: "",
|
|
18
|
+
lazyRender: true,
|
|
19
|
+
children: null,
|
|
20
|
+
onClick: () => {},
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { typography } from "@xhs/reds-token-next";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import { useThemeColor } from "../../ConfigProvider/hooks/themeToken/useThemeToken";
|
|
4
|
+
|
|
5
|
+
const createStyles = () => {
|
|
6
|
+
const themeColor = useThemeColor();
|
|
7
|
+
return StyleSheet.create({
|
|
8
|
+
header: {
|
|
9
|
+
paddingVertical: 12,
|
|
10
|
+
paddingHorizontal: 16,
|
|
11
|
+
},
|
|
12
|
+
title: {
|
|
13
|
+
color: themeColor.Title,
|
|
14
|
+
fontSize: typography.B1FontSize,
|
|
15
|
+
fontWeight: typography.B1FontWeight,
|
|
16
|
+
lineHeight: typography.B1LineHeight,
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
paddingTop: 0,
|
|
20
|
+
paddingBottom: 12,
|
|
21
|
+
paddingLeft: 16,
|
|
22
|
+
paddingRight: 16,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default createStyles;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState } from "react";
|
|
2
|
+
import { View, Text, StyleSheet, FlatList, ScrollView } from "react-native";
|
|
3
|
+
import Collapse from "../Collapse";
|
|
4
|
+
import CollapseItem from "../Item/Item";
|
|
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
|
+
export default function App() {
|
|
12
|
+
const handleClick = (value: string | number) => {
|
|
13
|
+
console.log("Collapse clicked", value);
|
|
14
|
+
};
|
|
15
|
+
const handleClick2 = (value: string | number) => {
|
|
16
|
+
console.log("Collapse clicked", value);
|
|
17
|
+
};
|
|
18
|
+
const handleChange = (activeValue: (string | number)[]) => {
|
|
19
|
+
console.log("Collapse value changed to", activeValue);
|
|
20
|
+
};
|
|
21
|
+
return (
|
|
22
|
+
<View>
|
|
23
|
+
<Desc>基础用法</Desc>
|
|
24
|
+
<Collapse onChange={handleChange}>
|
|
25
|
+
<CollapseItem title="标题1" value={"1"} onClick={handleClick}>
|
|
26
|
+
<Text>
|
|
27
|
+
测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据
|
|
28
|
+
</Text>
|
|
29
|
+
</CollapseItem>
|
|
30
|
+
<CollapseItem title="标题2" value={"2"}>
|
|
31
|
+
<Text>
|
|
32
|
+
测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据
|
|
33
|
+
</Text>
|
|
34
|
+
</CollapseItem>
|
|
35
|
+
</Collapse>
|
|
36
|
+
<Br />
|
|
37
|
+
<Desc>手风琴模式</Desc>
|
|
38
|
+
<Collapse accordion>
|
|
39
|
+
<CollapseItem title="标题3" value={"3"}>
|
|
40
|
+
<Text>
|
|
41
|
+
测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据
|
|
42
|
+
</Text>
|
|
43
|
+
</CollapseItem>
|
|
44
|
+
<CollapseItem title="标题4" value={"4"}>
|
|
45
|
+
<Text>测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据</Text>
|
|
46
|
+
</CollapseItem>
|
|
47
|
+
</Collapse>
|
|
48
|
+
<Br />
|
|
49
|
+
<Desc>懒加载</Desc>
|
|
50
|
+
<Collapse activeValue={["3"]}>
|
|
51
|
+
<CollapseItem title="标题5" value={"5"} lazyRender={false}>
|
|
52
|
+
<Text>测试数据测试数据测试数据测试数据</Text>
|
|
53
|
+
</CollapseItem>
|
|
54
|
+
<CollapseItem title="标题6" value={"6"} onClick={handleClick2}>
|
|
55
|
+
<Text>测试数据测试数据</Text>
|
|
56
|
+
</CollapseItem>
|
|
57
|
+
</Collapse>
|
|
58
|
+
</View>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
| activeValue | 当前面板选中值 | ActiveValueType | `[]` |
|
|
16
|
+
| accordion | 是否开启手风琴模式 | boolean | false |
|
|
17
|
+
| defaultActiveValue | 初始化选中面板的 key | ActiveValueType | `[]` |
|
|
18
|
+
| children | 面板内容 | ReactNode | `null` |
|
|
19
|
+
|
|
20
|
+
### Events
|
|
21
|
+
|
|
22
|
+
| 事件 | 描述 | 类型 | 默认值 |
|
|
23
|
+
| -------- | -------------- | -------------------------------------- | ------ |
|
|
24
|
+
| onChange | 切换面板时触发 | (activeValue: ActiveValueType) => void | |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
type ActiveValueType = Array<string | number>;
|
|
4
|
+
|
|
5
|
+
export interface ICollapseContext {
|
|
6
|
+
isActiveValue?: (key: string | number) => boolean;
|
|
7
|
+
addActiveValue?: (key: string | number) => void;
|
|
8
|
+
removeActiveValue?: (key: string | number) => void;
|
|
9
|
+
activeValue?: Array<string | number>;
|
|
10
|
+
}
|
|
11
|
+
export interface RedsCollapse {
|
|
12
|
+
activeValue?: ActiveValueType;
|
|
13
|
+
accordion?: boolean;
|
|
14
|
+
defaultActiveValue?: ActiveValueType;
|
|
15
|
+
onChange?: (activeValue: ActiveValueType) => void;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface RedsCollapseEvent {}
|
|
20
|
+
export const CollapseDefaultProps = {
|
|
21
|
+
activeValue: [],
|
|
22
|
+
accordion: false,
|
|
23
|
+
defaultActiveValue: [],
|
|
24
|
+
children: null,
|
|
25
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState } from "react";
|
|
2
|
+
import { View, Text, StyleSheet, FlatList, ScrollView } from "react-native";
|
|
3
|
+
import Collapse from "../Collapse";
|
|
4
|
+
import CollapseItem from "../Item/Item";
|
|
5
|
+
import { CollapseContext } from "../hooks/useCollapseContext";
|
|
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
|
+
export default function App() {
|
|
12
|
+
const { addActiveValue, isActiveValue, removeActiveValue } = { ...React.useContext(CollapseContext) };
|
|
13
|
+
const isActive = isActiveValue?.("1");
|
|
14
|
+
const handleClick = (value: number | string) => {
|
|
15
|
+
console.log("Collapse clicked", value);
|
|
16
|
+
};
|
|
17
|
+
const handleClick2 = (value: number | string) => {
|
|
18
|
+
console.log("Collapse clicked", value);
|
|
19
|
+
};
|
|
20
|
+
const handleChange = (activeValue: (string | number)[]) => {
|
|
21
|
+
console.log("Collapse value changed to", activeValue);
|
|
22
|
+
};
|
|
23
|
+
return (
|
|
24
|
+
<View>
|
|
25
|
+
<Desc>基础用法</Desc>
|
|
26
|
+
<Collapse onChange={handleChange} defaultActiveValue={["1"]}>
|
|
27
|
+
<CollapseItem title="标题1" value={"1"} onClick={handleClick}>
|
|
28
|
+
<Text>
|
|
29
|
+
测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据
|
|
30
|
+
</Text>
|
|
31
|
+
</CollapseItem>
|
|
32
|
+
<CollapseItem title="标题2" value={"2"} onClick={handleClick}>
|
|
33
|
+
<Text>
|
|
34
|
+
测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据
|
|
35
|
+
</Text>
|
|
36
|
+
</CollapseItem>
|
|
37
|
+
</Collapse>
|
|
38
|
+
<Br />
|
|
39
|
+
<Desc>手风琴模式</Desc>
|
|
40
|
+
<Collapse accordion>
|
|
41
|
+
<CollapseItem title="标题3" value={"3"}>
|
|
42
|
+
<Text>
|
|
43
|
+
测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据
|
|
44
|
+
</Text>
|
|
45
|
+
</CollapseItem>
|
|
46
|
+
<CollapseItem title="标题4" value={"4"}>
|
|
47
|
+
<Text>测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据</Text>
|
|
48
|
+
</CollapseItem>
|
|
49
|
+
</Collapse>
|
|
50
|
+
<Br />
|
|
51
|
+
<Desc>懒加载</Desc>
|
|
52
|
+
<Collapse activeValue={["3"]}>
|
|
53
|
+
<CollapseItem title="标题5" value={"5"} lazyRender={false}>
|
|
54
|
+
<Text>测试数据测试数据测试数据测试数据</Text>
|
|
55
|
+
</CollapseItem>
|
|
56
|
+
<CollapseItem title="标题6" value={"6"} onClick={handleClick2}>
|
|
57
|
+
<Text>测试数据测试数据</Text>
|
|
58
|
+
</CollapseItem>
|
|
59
|
+
</Collapse>
|
|
60
|
+
</View>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import Collapse from "../Collapse";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
render(<Collapse></Collapse>);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { Collapse, CollapseItem } from "@xhs/reds-rn-next";
|
|
6
|
+
import Demo from "./demo";
|
|
7
|
+
|
|
8
|
+
describe("Collapse", () => {
|
|
9
|
+
it(":wrapper", async () => {
|
|
10
|
+
const wrapper = render(<Demo />);
|
|
11
|
+
const title1 = await wrapper.findByTestId("reds-collapse-item-title-1");
|
|
12
|
+
expect(title1).toBeTruthy();
|
|
13
|
+
expect(title1.children[0].props.children).toBe("标题1");
|
|
14
|
+
const content1 = await wrapper.findByTestId("reds-collapse-item-content-1");
|
|
15
|
+
expect(content1.children[0].props.children).toBe(
|
|
16
|
+
"测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据",
|
|
17
|
+
);
|
|
18
|
+
await fireEvent(title1.children[0], "press");
|
|
19
|
+
const content2 = await wrapper.findByTestId("reds-collapse-item-content-1");
|
|
20
|
+
expect(content2.children[0].props.children).toBe(
|
|
21
|
+
"测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据",
|
|
22
|
+
);
|
|
23
|
+
await fireEvent(title1.children[0], "press");
|
|
24
|
+
const content2remove = await wrapper.findByTestId("reds-collapse-item-content-1");
|
|
25
|
+
expect(content2remove.children[0].props.children).toBe(
|
|
26
|
+
"测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据",
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
it(":wrapper2", async () => {
|
|
30
|
+
const wrapper = render(<Demo />);
|
|
31
|
+
const title2 = await wrapper.findByTestId("reds-collapse-item-title-2");
|
|
32
|
+
expect(title2).toBeTruthy();
|
|
33
|
+
expect(title2.children[0].props.children).toBe("标题2");
|
|
34
|
+
await fireEvent(title2.children[0], "press");
|
|
35
|
+
const content2 = await wrapper.findByTestId("reds-collapse-item-content-2");
|
|
36
|
+
expect(content2.children[0].props.children).toBe(
|
|
37
|
+
"测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据",
|
|
38
|
+
);
|
|
39
|
+
await fireEvent(title2.children[0], "press");
|
|
40
|
+
const content2remove = await wrapper.findByTestId("reds-collapse-item-content-2");
|
|
41
|
+
expect(content2remove.children[0].props.children).toBe(
|
|
42
|
+
"测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据",
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
it(":wrapper3", async () => {
|
|
46
|
+
const wrapper = render(<Demo />);
|
|
47
|
+
const title3 = await wrapper.findByTestId("reds-collapse-item-title-3");
|
|
48
|
+
expect(title3).toBeTruthy();
|
|
49
|
+
expect(title3.children[0].props.children).toBe("标题3");
|
|
50
|
+
await fireEvent(title3.children[0], "press");
|
|
51
|
+
const content3 = await wrapper.findByTestId("reds-collapse-item-content-3");
|
|
52
|
+
expect(content3.children[0].props.children).toBe(
|
|
53
|
+
"测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据",
|
|
54
|
+
);
|
|
55
|
+
await fireEvent(title3.children[0], "press");
|
|
56
|
+
const content3remove = await wrapper.findByTestId("reds-collapse-item-content-3");
|
|
57
|
+
expect(content3remove.children[0].props.children).toBe(
|
|
58
|
+
"测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据",
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -10,13 +10,13 @@ import BaseDemo from "!!raw-loader!../demo/base.tsx";
|
|
|
10
10
|
|
|
11
11
|
### Props
|
|
12
12
|
|
|
13
|
-
| 属性
|
|
14
|
-
|
|
|
15
|
-
| id
|
|
16
|
-
|
|
|
17
|
-
| theme
|
|
18
|
-
|
|
|
19
|
-
| inherit
|
|
20
|
-
| token
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| --------- | ------------------------------- | ------------ | ------------------------------------------------------------------------------------------------ |
|
|
15
|
+
| id | 主题 ID | string | root |
|
|
16
|
+
| parentId | 父级主题 ID | string | root |
|
|
17
|
+
| theme | 主题定制 | IThemeConfig | `{"colorMode":"light","inherit":true,"token":{"lightColor":{},"darkColor":{},"alwaysColor":{}}}` |
|
|
18
|
+
| colorMode | IThemeConfig colorMode 主题模式 | string | light |
|
|
19
|
+
| inherit | IThemeConfig inherit Token 继承 | boolean | true |
|
|
20
|
+
| token | IThemeConfig token Token 定制 | Object | `{}` |
|
|
21
21
|
|
|
22
22
|
### Events
|
|
@@ -9,7 +9,7 @@ export type TypographyToken = keyof typeof typography;
|
|
|
9
9
|
export type ThemeColor = { [key in LightToken | DarkToken]: ValueOf<typeof lightColor | typeof darkColor> };
|
|
10
10
|
|
|
11
11
|
export type ColorMode = "light" | "dark";
|
|
12
|
-
export type Component = "Button" | "Popover" | "Text" | "Tag" | "Switch";
|
|
12
|
+
export type Component = "Button" | "Popover" | "Text" | "Tag" | "Switch" | "Icon" | "Result" | "Empty";
|
|
13
13
|
export type ComponentColor = { [key in Component]: ThemeColor };
|
|
14
14
|
|
|
15
15
|
type ComponentsToken = {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
2
|
+
import { View, Image, Text, GestureResponderEvent } from "react-native";
|
|
3
|
+
import { RedsEmpty, EmptyDefaultProps } from "./interface/index";
|
|
4
|
+
import createStyles from "./styles";
|
|
5
|
+
import { defaultIcon } from "./hooks/useDefaultIcon";
|
|
6
|
+
|
|
7
|
+
const Empty = (props: RedsEmpty) => {
|
|
8
|
+
const { description, image, action } = { ...(EmptyDefaultProps as RedsEmpty), ...props };
|
|
9
|
+
|
|
10
|
+
const styles = createStyles();
|
|
11
|
+
|
|
12
|
+
const defaultImage = image || (
|
|
13
|
+
<Image style={{ height: 88, width: 84 }} source={{ uri: defaultIcon["default"].image }}></Image>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<View style={styles.container}>
|
|
18
|
+
<View>{defaultImage}</View>
|
|
19
|
+
<View style={styles.description}>
|
|
20
|
+
<Text style={styles.descriptionText}>{description || "暂无数据"}</Text>
|
|
21
|
+
</View>
|
|
22
|
+
{action && <View style={styles.action}>{action}</View>}
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
Empty.defaultProps = EmptyDefaultProps;
|
|
28
|
+
|
|
29
|
+
export default Empty;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, ScrollView, Image } from "react-native";
|
|
3
|
+
import { Button } from "@xhs/reds-rn-next";
|
|
4
|
+
import Empty from "../index";
|
|
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 <Button variant={"outline"}>按钮</Button>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const ImageCustom = () => {
|
|
16
|
+
return <Image source={{ uri: "https://img.yzcdn.cn/vant/cat.jpeg" }} style={{ height: 52, width: 52 }} />;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default function App() {
|
|
20
|
+
return (
|
|
21
|
+
<ScrollView>
|
|
22
|
+
<Desc>基础用法</Desc>
|
|
23
|
+
<Empty></Empty>
|
|
24
|
+
<Br />
|
|
25
|
+
<Desc>描述</Desc>
|
|
26
|
+
<Empty description="我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"></Empty>
|
|
27
|
+
<Br />
|
|
28
|
+
<Desc>操作按钮</Desc>
|
|
29
|
+
<Empty action={<ActionButton />}></Empty>
|
|
30
|
+
<Br />
|
|
31
|
+
<Desc>自定义</Desc>
|
|
32
|
+
<Empty
|
|
33
|
+
description={"我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行我是测试描述文案,尽量不超过两行"}
|
|
34
|
+
action={<ActionButton />}
|
|
35
|
+
image={<ImageCustom />}
|
|
36
|
+
></Empty>
|
|
37
|
+
</ScrollView>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
| description | 描述 | string | |
|
|
16
|
+
| action | 底部操作按钮 | ReactNode | |
|
|
17
|
+
| image | 图片 | ReactNode | |
|
|
18
|
+
|
|
19
|
+
### Events
|