@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,101 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
3
|
+
import { Text, Image, View, TouchableWithoutFeedback } from "react-native";
|
|
4
|
+
import { render, screen, act, fireEvent } from "@testing-library/react-native";
|
|
5
|
+
import Result from "../Result";
|
|
6
|
+
import { ResultDefaultProps, RedsResult } from "../interface/index";
|
|
7
|
+
import { defaultIcon } from "../hooks/useDefaultIcon";
|
|
8
|
+
import Demo from "./Demo";
|
|
9
|
+
|
|
10
|
+
describe("Result Component", () => {
|
|
11
|
+
it("renders default title and image", () => {
|
|
12
|
+
render(<Result />);
|
|
13
|
+
const titleElement = screen.getByText(
|
|
14
|
+
defaultIcon[(ResultDefaultProps?.type as "Success" | "Info" | "Warning") || "Success"].title,
|
|
15
|
+
);
|
|
16
|
+
expect(titleElement).toBeTruthy();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("renders custom title and image", () => {
|
|
20
|
+
const customTitle = "Custom Title";
|
|
21
|
+
const customImageUri = "https://example.com/custom-image.png";
|
|
22
|
+
render(<Result title={customTitle} image={<Image source={{ uri: customImageUri }}></Image>} />);
|
|
23
|
+
const titleElement = screen.getByText(customTitle);
|
|
24
|
+
expect(titleElement).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("updates title and image on props change", () => {
|
|
28
|
+
const { rerender } = render(<Result />);
|
|
29
|
+
const newProps: RedsResult = {
|
|
30
|
+
title: "New Title",
|
|
31
|
+
image: <Image source={{ uri: "https://example.com/new-image.png" }}></Image>,
|
|
32
|
+
type: "Info",
|
|
33
|
+
};
|
|
34
|
+
rerender(<Result {...newProps} />);
|
|
35
|
+
const titleElement = screen.getByText(newProps.title || "");
|
|
36
|
+
expect(titleElement).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
it("updates title and image on props change", async () => {
|
|
39
|
+
const { rerender } = render(<Result />);
|
|
40
|
+
const titleElement1 = screen.getByText("成功提示");
|
|
41
|
+
expect(titleElement1).toBeTruthy();
|
|
42
|
+
const newProps: RedsResult = {
|
|
43
|
+
image: <Image source={{ uri: "https://example.com/new-image.png" }}></Image>,
|
|
44
|
+
type: "Info",
|
|
45
|
+
};
|
|
46
|
+
await rerender(<Result {...newProps} />);
|
|
47
|
+
const titleElement = screen.getByText("处理中");
|
|
48
|
+
expect(titleElement).toBeTruthy();
|
|
49
|
+
rerender(<Result title="New Title" />);
|
|
50
|
+
const titleElement2 = screen.getByText("New Title");
|
|
51
|
+
expect(titleElement2).toBeTruthy();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("handles null or undefined props gracefully", async () => {
|
|
55
|
+
const warpper = render(<Result />);
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
const titleElement = warpper.queryByText(defaultIcon[ResultDefaultProps?.type || "Success"].title);
|
|
58
|
+
expect(titleElement).toBeTruthy();
|
|
59
|
+
warpper.update(<Result title="New Description" />);
|
|
60
|
+
const titleElement2 = warpper.queryByText("New Description");
|
|
61
|
+
expect(titleElement2).toBeTruthy();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("renders description when provided", () => {
|
|
65
|
+
const description = "This is a description.";
|
|
66
|
+
render(<Result description={description} />);
|
|
67
|
+
const descriptionElement = screen.getByText(description);
|
|
68
|
+
expect(descriptionElement).toBeTruthy();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("renders action when provided", () => {
|
|
72
|
+
const action = <Text>Click me!</Text>;
|
|
73
|
+
render(<Result action={action} />);
|
|
74
|
+
const actionElement = screen.getByText("Click me!");
|
|
75
|
+
expect(actionElement).toBeTruthy();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("covers branch logic for dynamic prop updates", async () => {
|
|
79
|
+
const { rerender } = render(<Result />);
|
|
80
|
+
const newProps: RedsResult = {
|
|
81
|
+
title: "New Title",
|
|
82
|
+
image: <Image source={{ uri: "https://example.com/new-image.png" }}></Image>,
|
|
83
|
+
type: "Warning",
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// 使用 act 包裹 rerender 调用来确保在组件更新期间的副作用正确处理
|
|
87
|
+
await act(async () => {
|
|
88
|
+
rerender(<Result {...newProps} />);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const titleElement = screen.getByText(newProps.title || "");
|
|
92
|
+
expect(titleElement).toBeTruthy();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("testbutton", async () => {
|
|
96
|
+
const warpper = render(<Demo />);
|
|
97
|
+
expect(warpper.getByText("标题11")).toBeTruthy();
|
|
98
|
+
await fireEvent(warpper.getByTestId("123"), "onPress");
|
|
99
|
+
expect(warpper.getByText("标题22")).toBeTruthy();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -3,7 +3,7 @@ import { View, TouchableWithoutFeedback, Animated, GestureResponderEvent } from
|
|
|
3
3
|
import { RedsSwitch, SwitchDefaultProps } from "./interface/index";
|
|
4
4
|
import styles from "./styles";
|
|
5
5
|
|
|
6
|
-
const Switch = ({ value, defaultValue, onChange, onClick, trackOnColor, trackOffColor }: RedsSwitch) => {
|
|
6
|
+
const Switch = ({ value, defaultValue, onChange, onClick, trackOnColor, trackOffColor, disabled }: RedsSwitch) => {
|
|
7
7
|
const isControlled = useRef(value !== undefined);
|
|
8
8
|
const [isOn, setIsOn] = useState(defaultValue);
|
|
9
9
|
|
|
@@ -15,13 +15,21 @@ const Switch = ({ value, defaultValue, onChange, onClick, trackOnColor, trackOff
|
|
|
15
15
|
}, [isOn]);
|
|
16
16
|
|
|
17
17
|
useEffect(() => {
|
|
18
|
-
isControlled.current
|
|
18
|
+
if (isControlled.current) {
|
|
19
|
+
setIsOn(value);
|
|
20
|
+
}
|
|
19
21
|
}, [value]);
|
|
20
22
|
|
|
21
|
-
const toggleSwitch = useCallback(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const toggleSwitch = useCallback(
|
|
24
|
+
(e: GestureResponderEvent) => {
|
|
25
|
+
if (disabled) return;
|
|
26
|
+
onClick?.(e);
|
|
27
|
+
if (!isControlled.current) {
|
|
28
|
+
setIsOn((v) => !v);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
[disabled],
|
|
32
|
+
);
|
|
25
33
|
|
|
26
34
|
const dynamicStyles = useMemo(() => {
|
|
27
35
|
Animated.timing(animatedValue, {
|
|
@@ -32,12 +40,18 @@ const Switch = ({ value, defaultValue, onChange, onClick, trackOnColor, trackOff
|
|
|
32
40
|
return {
|
|
33
41
|
backgroundColor: isOn ? trackOnColor : trackOffColor,
|
|
34
42
|
transform: [{ translateX: thumbTranslateX }],
|
|
43
|
+
opacity: disabled ? 0.4 : 1,
|
|
35
44
|
};
|
|
36
|
-
}, [isOn]);
|
|
45
|
+
}, [isOn, disabled]);
|
|
37
46
|
|
|
38
47
|
return (
|
|
39
|
-
<TouchableWithoutFeedback onPress={(e) => toggleSwitch(e)}>
|
|
40
|
-
<View
|
|
48
|
+
<TouchableWithoutFeedback onPress={(e) => toggleSwitch(e)} disabled={disabled}>
|
|
49
|
+
<View
|
|
50
|
+
style={[
|
|
51
|
+
styles.switchContainer,
|
|
52
|
+
{ backgroundColor: dynamicStyles.backgroundColor, opacity: dynamicStyles.opacity },
|
|
53
|
+
]}
|
|
54
|
+
>
|
|
41
55
|
<Animated.View style={[styles.thumb, { transform: dynamicStyles.transform }]}></Animated.View>
|
|
42
56
|
</View>
|
|
43
57
|
</TouchableWithoutFeedback>
|
|
@@ -33,7 +33,6 @@ export default function App() {
|
|
|
33
33
|
return (
|
|
34
34
|
<View style={styles.container}>
|
|
35
35
|
<Desc>默认用法</Desc>
|
|
36
|
-
<Text>{"children"}</Text>
|
|
37
36
|
<Switch></Switch>
|
|
38
37
|
<Br />
|
|
39
38
|
|
|
@@ -41,6 +40,13 @@ export default function App() {
|
|
|
41
40
|
<Switch defaultValue={true}></Switch>
|
|
42
41
|
<Br />
|
|
43
42
|
|
|
43
|
+
<Desc>disabled</Desc>
|
|
44
|
+
<View style={{ flexDirection: "row" }}>
|
|
45
|
+
<Switch defaultValue={true} disabled></Switch>
|
|
46
|
+
<Switch disabled></Switch>
|
|
47
|
+
</View>
|
|
48
|
+
<Br />
|
|
49
|
+
|
|
44
50
|
<Desc>修改开关颜色</Desc>
|
|
45
51
|
<Switch trackOnColor={"#1b8bcd"} trackOffColor={"#da36c9"}></Switch>
|
|
46
52
|
<Br />
|
|
@@ -8,17 +8,17 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
8
8
|
|
|
9
9
|
### Props
|
|
10
10
|
|
|
11
|
-
| 属性
|
|
12
|
-
|
|
|
13
|
-
| value
|
|
14
|
-
|
|
|
15
|
-
| disabled
|
|
16
|
-
|
|
|
17
|
-
|
|
|
11
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
12
|
+
| ------------- | ---------------- | ------- | ------------------ |
|
|
13
|
+
| value | 当前的状态 | boolean | undefined |
|
|
14
|
+
| defaultValue | 默认状态 | boolean | false |
|
|
15
|
+
| disabled | 是否显示气泡 | boolean | false |
|
|
16
|
+
| trackOnColor | 开关开启时的颜色 | string | lightColor.Primary |
|
|
17
|
+
| trackOffColor | 开关关闭时的颜色 | string | lightColor.Fill2 |
|
|
18
18
|
|
|
19
19
|
### Events
|
|
20
20
|
|
|
21
|
-
| 事件
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
21
|
+
| 事件 | 描述 | 类型 | 默认值 |
|
|
22
|
+
| -------- | ------------------ | ------------------------------------- | ------ |
|
|
23
|
+
| onChange | 当值发生变化时触发 | (value: boolean) => any | |
|
|
24
|
+
| onClick | 被点击时触发 | (value: GestureResponderEvent) => any | |
|
|
@@ -5,7 +5,7 @@ import { redsBench } from "~root/utils/redsBench";
|
|
|
5
5
|
import { Switch } from "@xhs/reds-rn-next";
|
|
6
6
|
import { render } from "@testing-library/react-native";
|
|
7
7
|
|
|
8
|
-
describe("
|
|
8
|
+
describe("Switch", () => {
|
|
9
9
|
redsBench("base", () => {
|
|
10
10
|
render(<Switch></Switch>);
|
|
11
11
|
});
|
|
@@ -5,7 +5,7 @@ import { redsBench } from "~root/utils/redsBench";
|
|
|
5
5
|
import { Switch } from "react-native-paper";
|
|
6
6
|
import { render } from "@testing-library/react-native";
|
|
7
7
|
|
|
8
|
-
describe("
|
|
8
|
+
describe("Switch", () => {
|
|
9
9
|
redsBench("base", async () => {
|
|
10
10
|
render(<Switch></Switch>);
|
|
11
11
|
});
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import React, { useState, useMemo, useImperativeHandle, forwardRef, memo, FunctionComponent } from "react";
|
|
2
|
+
import { View, Text, StyleSheet, GestureResponderEvent, TouchableOpacity } from "react-native";
|
|
3
|
+
import { RedsTag, TagDefaultProps } from "./interface";
|
|
4
|
+
import { lightColor, typography, alwaysColor } from "@xhs/reds-token-next";
|
|
5
|
+
|
|
6
|
+
const typeStyles = {
|
|
7
|
+
primary: {
|
|
8
|
+
backgroundColor: lightColor.Primary2,
|
|
9
|
+
color: lightColor.Primary,
|
|
10
|
+
borderColor: lightColor.Primary,
|
|
11
|
+
},
|
|
12
|
+
default: {
|
|
13
|
+
backgroundColor: lightColor.Fill1,
|
|
14
|
+
color: lightColor.Paragraph,
|
|
15
|
+
borderColor: lightColor.Separator2,
|
|
16
|
+
},
|
|
17
|
+
warning: {
|
|
18
|
+
backgroundColor: lightColor.Warning2,
|
|
19
|
+
color: lightColor.Warning,
|
|
20
|
+
borderColor: lightColor.Warning,
|
|
21
|
+
},
|
|
22
|
+
success: {
|
|
23
|
+
backgroundColor: lightColor.Success2,
|
|
24
|
+
color: lightColor.Success,
|
|
25
|
+
borderColor: lightColor.Success,
|
|
26
|
+
},
|
|
27
|
+
info: {
|
|
28
|
+
backgroundColor: lightColor.Info2,
|
|
29
|
+
color: lightColor.Info,
|
|
30
|
+
borderColor: lightColor.Info,
|
|
31
|
+
},
|
|
32
|
+
ghost: {
|
|
33
|
+
backgroundColor: alwaysColor.Black,
|
|
34
|
+
color: alwaysColor.White,
|
|
35
|
+
borderColor: alwaysColor.LightTitle,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const sizeStyles: { [key: string]: any } = {
|
|
40
|
+
mini: {
|
|
41
|
+
fontSize: typography.C3FontSize,
|
|
42
|
+
lineHeight: typography.C3LineHeight,
|
|
43
|
+
height: 16,
|
|
44
|
+
paddingHorizontal: 4,
|
|
45
|
+
paddingVertical: 1,
|
|
46
|
+
borderRadius: 4,
|
|
47
|
+
},
|
|
48
|
+
small: {
|
|
49
|
+
fontSize: typography.C3FontSize,
|
|
50
|
+
lineHeight: typography.C3LineHeight,
|
|
51
|
+
height: 20,
|
|
52
|
+
paddingHorizontal: 6,
|
|
53
|
+
paddingVertical: 3,
|
|
54
|
+
borderRadius: 4,
|
|
55
|
+
},
|
|
56
|
+
medium: {
|
|
57
|
+
fontSize: typography.C2FontSize,
|
|
58
|
+
lineHeight: typography.C2LineHeight,
|
|
59
|
+
height: 28,
|
|
60
|
+
paddingHorizontal: 10,
|
|
61
|
+
paddingVertical: 5,
|
|
62
|
+
borderRadius: 6,
|
|
63
|
+
},
|
|
64
|
+
large: {
|
|
65
|
+
fontSize: typography.B2FontSize,
|
|
66
|
+
lineHeight: typography.B2LineHeight,
|
|
67
|
+
height: 36,
|
|
68
|
+
paddingHorizontal: 16,
|
|
69
|
+
paddingVertical: 8,
|
|
70
|
+
borderRadius: 6,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const shapeStyles: { [key: string]: any } = {
|
|
75
|
+
square: {},
|
|
76
|
+
round: { borderRadius: 999 },
|
|
77
|
+
mark: { borderRadius: 999, borderTopLeftRadius: 0, borderBottomLeftRadius: 0 },
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const Tag: FunctionComponent<RedsTag> = memo(
|
|
81
|
+
forwardRef((props: RedsTag, ref) => {
|
|
82
|
+
const {
|
|
83
|
+
content,
|
|
84
|
+
type = TagDefaultProps.type,
|
|
85
|
+
size = TagDefaultProps.size,
|
|
86
|
+
plain = TagDefaultProps.plain,
|
|
87
|
+
borderRadius,
|
|
88
|
+
disabled = TagDefaultProps.disabled,
|
|
89
|
+
shape = TagDefaultProps.shape,
|
|
90
|
+
closeabled = TagDefaultProps.closeabled,
|
|
91
|
+
icon,
|
|
92
|
+
afterIcon,
|
|
93
|
+
closeIcon,
|
|
94
|
+
onClose,
|
|
95
|
+
children,
|
|
96
|
+
} = props;
|
|
97
|
+
|
|
98
|
+
const [visible, setVisible] = useState<boolean>(true);
|
|
99
|
+
|
|
100
|
+
useImperativeHandle(ref, () => ({
|
|
101
|
+
setVisible,
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
const tagStyle = useMemo(() => {
|
|
105
|
+
const style: any = {
|
|
106
|
+
fontFamily: "PingFang SC",
|
|
107
|
+
fontWeight: typography.C3FontWeight,
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
borderWidth: 0.5,
|
|
110
|
+
borderColor: "transparent",
|
|
111
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
112
|
+
userSelect: "none",
|
|
113
|
+
opacity: disabled ? 0.5 : 1,
|
|
114
|
+
alignSelf: "flex-start",
|
|
115
|
+
flexShrink: 0,
|
|
116
|
+
flexDirection: "row",
|
|
117
|
+
};
|
|
118
|
+
if (type) {
|
|
119
|
+
const currentType = type as keyof typeof typeStyles;
|
|
120
|
+
Object.assign(
|
|
121
|
+
style,
|
|
122
|
+
plain
|
|
123
|
+
? {
|
|
124
|
+
backgroundColor: "transparent",
|
|
125
|
+
borderColor: typeStyles[currentType].borderColor,
|
|
126
|
+
color: typeStyles[currentType].color,
|
|
127
|
+
}
|
|
128
|
+
: {
|
|
129
|
+
backgroundColor: typeStyles[currentType].backgroundColor,
|
|
130
|
+
borderColor: "transparent",
|
|
131
|
+
color: typeStyles[currentType].color,
|
|
132
|
+
},
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (size) {
|
|
137
|
+
Object.assign(style, sizeStyles[size]);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (borderRadius) {
|
|
141
|
+
style.borderRadius = borderRadius;
|
|
142
|
+
} else if (shape) {
|
|
143
|
+
Object.assign(style, shapeStyles[shape]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return style;
|
|
147
|
+
}, [type, size, plain, borderRadius, shape, disabled]);
|
|
148
|
+
|
|
149
|
+
const textStyle = useMemo(() => {
|
|
150
|
+
return {
|
|
151
|
+
color: type ? typeStyles[type as keyof typeof typeStyles].color : undefined,
|
|
152
|
+
};
|
|
153
|
+
}, [type]);
|
|
154
|
+
|
|
155
|
+
const handleClose = (event: GestureResponderEvent) => {
|
|
156
|
+
if (!disabled) {
|
|
157
|
+
setVisible(false);
|
|
158
|
+
onClose && onClose(event);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
if (!visible) return null;
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<View style={[styles.tag, tagStyle]}>
|
|
166
|
+
<TouchableOpacity disabled={disabled} style={{ flexDirection: "row", alignItems: "center" }}>
|
|
167
|
+
{icon && <View style={{ marginRight: 3 }}>{icon}</View>}
|
|
168
|
+
{!content ? (
|
|
169
|
+
<Text style={textStyle}>{children}</Text>
|
|
170
|
+
) : (
|
|
171
|
+
<Text style={textStyle}>{typeof content === "function" ? content({}) : content}</Text>
|
|
172
|
+
)}
|
|
173
|
+
{afterIcon && <View style={{ marginLeft: 3 }}>{afterIcon}</View>}
|
|
174
|
+
</TouchableOpacity>
|
|
175
|
+
{closeabled && (
|
|
176
|
+
<TouchableOpacity onPress={handleClose} style={{ marginLeft: 3 }}>
|
|
177
|
+
{closeIcon}
|
|
178
|
+
</TouchableOpacity>
|
|
179
|
+
)}
|
|
180
|
+
</View>
|
|
181
|
+
);
|
|
182
|
+
}),
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const styles = StyleSheet.create({
|
|
186
|
+
tag: {
|
|
187
|
+
alignItems: "center",
|
|
188
|
+
borderWidth: 0.5,
|
|
189
|
+
borderColor: "transparent",
|
|
190
|
+
paddingHorizontal: 10,
|
|
191
|
+
paddingVertical: 5,
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
export default Tag;
|
|
@@ -130,11 +130,6 @@ export default function App() {
|
|
|
130
130
|
mark
|
|
131
131
|
</Tag>
|
|
132
132
|
</Text>
|
|
133
|
-
<Text style={styles.boxitem}>
|
|
134
|
-
<Tag shape="square" plain type="primary">
|
|
135
|
-
square
|
|
136
|
-
</Tag>
|
|
137
|
-
</Text>
|
|
138
133
|
<Text style={styles.boxitem}>
|
|
139
134
|
<Tag shape="round" plain type="primary">
|
|
140
135
|
round
|
|
@@ -147,25 +142,6 @@ export default function App() {
|
|
|
147
142
|
</Text>
|
|
148
143
|
</View>
|
|
149
144
|
<Br />
|
|
150
|
-
<Desc>选中状态</Desc>
|
|
151
|
-
<View style={styles.box}>
|
|
152
|
-
<Text style={styles.boxitem}>
|
|
153
|
-
<Tag shape="square" type="primary" disabled>
|
|
154
|
-
disabled
|
|
155
|
-
</Tag>
|
|
156
|
-
</Text>
|
|
157
|
-
<Text style={styles.boxitem}>
|
|
158
|
-
<Tag onCheck={handleCheck} checkable>
|
|
159
|
-
checkable
|
|
160
|
-
</Tag>
|
|
161
|
-
</Text>
|
|
162
|
-
<Text style={styles.boxitem}>
|
|
163
|
-
<Tag checkable checked plain={true} type="success">
|
|
164
|
-
已选中
|
|
165
|
-
</Tag>
|
|
166
|
-
</Text>
|
|
167
|
-
</View>
|
|
168
|
-
<Br />
|
|
169
145
|
{/* <Desc> icon</Desc>
|
|
170
146
|
<View style={styles.box}>
|
|
171
147
|
<Text style={styles.boxitem}><Tag type="primary">
|
|
@@ -10,26 +10,24 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
10
10
|
|
|
11
11
|
### Props
|
|
12
12
|
|
|
13
|
-
| 属性
|
|
14
|
-
|
|
|
15
|
-
| content
|
|
16
|
-
| type
|
|
17
|
-
| size
|
|
18
|
-
| plain
|
|
19
|
-
|
|
|
20
|
-
| disabled
|
|
21
|
-
| shape
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
| close-icon | 关闭按钮的图标(slot插槽)(暂不支持,等icon组件支持后补齐) | string | any | undefined |
|
|
28
|
-
| children | 内容 | string | any | undefined |
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| ------------ | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------- | --------- |
|
|
15
|
+
| content | 标签内容 | string | Function | undefined |
|
|
16
|
+
| type | 主题类型 | "primary" | "default" | "warning" | "success" | "info" | "ghost" | default |
|
|
17
|
+
| size | 大小 | "mini" | "small" | "medium" | "large" | medium |
|
|
18
|
+
| plain | 是否为空心样式 | boolean | false |
|
|
19
|
+
| borderRadius | 圆角值 | number | undefined |
|
|
20
|
+
| disabled | 是否禁用标签 | boolean | false |
|
|
21
|
+
| shape | 标签形状 | "square" | "round" | "mark" | square |
|
|
22
|
+
| closeabled | 是否为可关闭标签 | boolean | false |
|
|
23
|
+
| icon | 图标(slot插槽)(暂不支持,等icon组件支持后补齐) | string | any | undefined |
|
|
24
|
+
| afterIcon | 文字后图标(slot插槽)(暂不支持,等icon组件支持后补齐) | string | any | undefined |
|
|
25
|
+
| closeIcon | 关闭按钮的图标(slot插槽)(暂不支持,等icon组件支持后补齐) | string | any | undefined |
|
|
26
|
+
| children | 内容 | string | any | undefined |
|
|
29
27
|
|
|
30
28
|
### Events
|
|
31
29
|
|
|
32
|
-
| 事件
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
30
|
+
| 事件 | 描述 | 类型 | 默认值 |
|
|
31
|
+
| ------- | ------------ | ------------------------------------- | ------ |
|
|
32
|
+
| onClose | 点击时触发 | (value?: any) => any | |
|
|
33
|
+
| onClick | 被点击时触发 | (value: GestureResponderEvent) => any | |
|
|
@@ -9,15 +9,13 @@ export interface RedsTag {
|
|
|
9
9
|
borderRadius?: number;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
shape?: "square" | "round" | "mark";
|
|
12
|
-
checkable?: boolean;
|
|
13
|
-
checked?: boolean;
|
|
14
12
|
closeabled?: boolean;
|
|
15
13
|
icon?: string | any;
|
|
16
14
|
afterIcon?: string | any;
|
|
17
15
|
closeIcon?: string | any;
|
|
18
16
|
children?: string | any;
|
|
19
|
-
onCheck?: (value?: any) => any;
|
|
20
17
|
onClose?: (value?: any) => any;
|
|
18
|
+
onClick?: (value: GestureResponderEvent) => any;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
export interface RedsTagEvent {}
|
|
@@ -29,8 +27,6 @@ export const TagDefaultProps = {
|
|
|
29
27
|
borderRadius: undefined,
|
|
30
28
|
disabled: false,
|
|
31
29
|
shape: "square",
|
|
32
|
-
checkable: false,
|
|
33
|
-
checked: false,
|
|
34
30
|
closeabled: false,
|
|
35
31
|
icon: undefined,
|
|
36
32
|
afterIcon: undefined,
|
|
@@ -2,42 +2,14 @@ import { describe, it, expect } from "vitest";
|
|
|
2
2
|
import { render, fireEvent } from "@testing-library/react-native";
|
|
3
3
|
import "@testing-library/react-native/extend-expect";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { Text
|
|
5
|
+
import { Text } from "react-native";
|
|
6
6
|
import Tag from "../index";
|
|
7
7
|
|
|
8
8
|
describe("Tag", () => {
|
|
9
|
-
it(":base",
|
|
10
|
-
|
|
11
|
-
const wrapper = render(
|
|
12
|
-
<Tag checkable onCheck={(v) => (isChecked = v)}>
|
|
13
|
-
Tag Content
|
|
14
|
-
</Tag>,
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
expect(isChecked).toBe(false);
|
|
18
|
-
|
|
19
|
-
await fireEvent.press(wrapper.getByText("Tag Content"));
|
|
20
|
-
expect(isChecked).toBe(true);
|
|
21
|
-
|
|
22
|
-
await fireEvent.press(wrapper.getByText("Tag Content"));
|
|
23
|
-
expect(isChecked).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it(":controlled", async () => {
|
|
27
|
-
let isChecked = false;
|
|
28
|
-
const wrapper = render(
|
|
29
|
-
<Tag checkable checked={false} onCheck={(v) => (isChecked = v)}>
|
|
30
|
-
Tag Content
|
|
31
|
-
</Tag>,
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
expect(wrapper.UNSAFE_getByType(Tag).props.checked).toBe(false);
|
|
35
|
-
|
|
36
|
-
await fireEvent.press(wrapper.getByText("Tag Content"));
|
|
37
|
-
expect(isChecked).toBe(true);
|
|
9
|
+
it(":base", () => {
|
|
10
|
+
const wrapper = render(<Tag>Tag Content</Tag>);
|
|
38
11
|
|
|
39
|
-
|
|
40
|
-
expect(isChecked).toBe(false);
|
|
12
|
+
expect(wrapper.getByText("Tag Content")).toBeTruthy();
|
|
41
13
|
});
|
|
42
14
|
|
|
43
15
|
it(":closeabled", async () => {
|
|
@@ -43,23 +43,23 @@ import TextCustomEmojiStyle from "!!raw-loader!../demo/TextCustomEmojiStyle.tsx"
|
|
|
43
43
|
|
|
44
44
|
### Props
|
|
45
45
|
|
|
46
|
-
| 属性
|
|
47
|
-
|
|
|
48
|
-
| strikethrough
|
|
49
|
-
| underline
|
|
50
|
-
| italic
|
|
51
|
-
| rows
|
|
52
|
-
| expandable
|
|
53
|
-
|
|
|
54
|
-
| collapsible
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
46
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
47
|
+
| --------------- | ---------------------- | ------- | ------ |
|
|
48
|
+
| strikethrough | 删除线 | boolean | false |
|
|
49
|
+
| underline | 下划线 | boolean | false |
|
|
50
|
+
| italic | 倾斜角度 | boolean | false |
|
|
51
|
+
| rows | 省略配置默认展示行数 | number | 1 |
|
|
52
|
+
| expandable | 是否可展开 | boolean | true |
|
|
53
|
+
| expandText | 展开按钮文字 | string | 展开 |
|
|
54
|
+
| collapsible | 展开后是否可以重新收起 | boolean | true |
|
|
55
|
+
| collapseText | 收起按钮文字 | string | 收起 |
|
|
56
|
+
| textStyle | 定制文字样式 | any | |
|
|
57
|
+
| emojiStyle | 定制 emoji 样式 | any | |
|
|
58
|
+
| actionStyle | 定制按钮样式 | any | |
|
|
59
|
+
| actionTextStyle | 定制按钮文字样式 | any | |
|
|
60
60
|
|
|
61
61
|
### Events
|
|
62
62
|
|
|
63
|
-
| 事件
|
|
64
|
-
|
|
|
65
|
-
|
|
|
63
|
+
| 事件 | 描述 | 类型 | 默认值 |
|
|
64
|
+
| ------- | -------- | ----------------------- | ------ |
|
|
65
|
+
| onClick | 点击回调 | (value: string) => void | |
|