@xhsreds/reds-rn-next 0.1.2 → 0.1.3
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 +900 -820
- package/coverage/.tmp/coverage-0.json +1 -1
- package/coverage/.tmp/coverage-1.json +1 -1
- package/coverage/.tmp/coverage-10.json +1 -1
- package/coverage/.tmp/coverage-11.json +1 -1
- package/coverage/.tmp/coverage-12.json +1 -1
- package/coverage/.tmp/coverage-13.json +1 -1
- package/coverage/.tmp/coverage-14.json +1 -1
- package/coverage/.tmp/coverage-15.json +1 -1
- package/coverage/.tmp/coverage-16.json +1 -1
- package/coverage/.tmp/coverage-17.json +1 -1
- package/coverage/.tmp/coverage-18.json +1 -1
- package/coverage/.tmp/coverage-19.json +1 -1
- package/coverage/.tmp/coverage-2.json +1 -1
- package/coverage/.tmp/coverage-20.json +1 -1
- package/coverage/.tmp/coverage-21.json +1 -1
- package/coverage/.tmp/coverage-22.json +1 -1
- package/coverage/.tmp/coverage-23.json +1 -1
- package/coverage/.tmp/coverage-24.json +1 -1
- package/coverage/.tmp/coverage-25.json +1 -1
- package/coverage/.tmp/coverage-26.json +1 -1
- package/coverage/.tmp/coverage-27.json +1 -1
- package/coverage/.tmp/coverage-28.json +1 -1
- package/coverage/.tmp/coverage-29.json +1 -0
- package/coverage/.tmp/coverage-3.json +1 -1
- package/coverage/.tmp/coverage-30.json +1 -0
- package/coverage/.tmp/coverage-31.json +1 -0
- package/coverage/.tmp/coverage-4.json +1 -1
- package/coverage/.tmp/coverage-5.json +1 -1
- package/coverage/.tmp/coverage-6.json +1 -1
- package/coverage/.tmp/coverage-7.json +1 -1
- package/coverage/.tmp/coverage-8.json +1 -1
- package/coverage/.tmp/coverage-9.json +1 -1
- package/lib/cjs/_chunks/CkkZzOy_.js +23 -0
- package/lib/cjs/_chunks/CkkZzOy_.js.map +1 -0
- package/lib/cjs/_chunks/RPaDcSae.js +20 -0
- package/lib/cjs/_chunks/RPaDcSae.js.map +1 -0
- package/lib/cjs/_chunks/bwo-gq0b.js +66 -0
- package/lib/cjs/_chunks/bwo-gq0b.js.map +1 -0
- package/lib/cjs/components/ActionSheets/ActionSheets.js +99 -0
- package/lib/cjs/components/ActionSheets/ActionSheets.js.map +1 -0
- package/lib/cjs/components/ActionSheets/index.js +37 -0
- package/lib/cjs/components/ActionSheets/index.js.map +1 -0
- package/lib/cjs/components/ActionSheets/interface/index.js +9 -0
- package/lib/cjs/components/ActionSheets/interface/index.js.map +1 -0
- package/lib/cjs/components/ActionSheets/styles.js +59 -0
- package/lib/cjs/components/ActionSheets/styles.js.map +1 -0
- package/lib/cjs/components/AvatarGroup/AvatarGroup.js +10 -4
- package/lib/cjs/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/lib/cjs/components/AvatarGroup/index.js +17 -11
- package/lib/cjs/components/AvatarGroup/index.js.map +1 -1
- package/lib/cjs/components/ImagePreview/ImagePreview.js +11 -5
- package/lib/cjs/components/ImagePreview/ImagePreview.js.map +1 -1
- package/lib/cjs/components/ImagePreview/index.js +18 -12
- package/lib/cjs/components/ImagePreview/index.js.map +1 -1
- package/lib/cjs/components/List/ListItem/ListItem.js +11 -5
- package/lib/cjs/components/List/ListItem/ListItem.js.map +1 -1
- package/lib/cjs/components/List/index.js +16 -10
- package/lib/cjs/components/List/index.js.map +1 -1
- package/lib/cjs/components/Picker/Picker.js +6 -1
- package/lib/cjs/components/Picker/Picker.js.map +1 -1
- package/lib/cjs/components/Picker/index.js +6 -1
- package/lib/cjs/components/Picker/index.js.map +1 -1
- package/lib/cjs/components/Sheets/Sheets.js +168 -16
- package/lib/cjs/components/Sheets/Sheets.js.map +1 -1
- package/lib/cjs/components/Sheets/index.js +9 -3
- package/lib/cjs/components/Sheets/index.js.map +1 -1
- package/lib/cjs/components/Sheets/interface/index.js +6 -1
- package/lib/cjs/components/Sheets/interface/index.js.map +1 -1
- package/lib/cjs/components/Sheets/styles.js +39 -11
- package/lib/cjs/components/Sheets/styles.js.map +1 -1
- package/lib/cjs/components/Silder/Silder.js +71 -0
- package/lib/cjs/components/Silder/Silder.js.map +1 -0
- package/lib/cjs/components/Silder/index.js +18 -0
- package/lib/cjs/components/Silder/index.js.map +1 -0
- package/lib/cjs/components/Silder/interface/index.js +9 -0
- package/lib/cjs/components/Silder/interface/index.js.map +1 -0
- package/lib/cjs/components/Silder/styles.js +29 -0
- package/lib/cjs/components/Silder/styles.js.map +1 -0
- package/lib/cjs/components/TabBar/TabBar.js +10 -10
- package/lib/cjs/components/TabBar/TabBar.js.map +1 -1
- package/lib/cjs/index.js +12 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/_chunks/BJ2Kj1Vd.js +58 -0
- package/lib/esm/_chunks/BJ2Kj1Vd.js.map +1 -0
- package/lib/esm/_chunks/DHJk9lIr.js +19 -0
- package/lib/esm/_chunks/DHJk9lIr.js.map +1 -0
- package/lib/esm/_chunks/RRfNwNcs.js +17 -0
- package/lib/esm/_chunks/RRfNwNcs.js.map +1 -0
- package/lib/esm/components/ActionSheets/ActionSheets.js +95 -0
- package/lib/esm/components/ActionSheets/ActionSheets.js.map +1 -0
- package/lib/esm/components/ActionSheets/index.js +31 -0
- package/lib/esm/components/ActionSheets/index.js.map +1 -0
- package/lib/esm/components/ActionSheets/interface/index.js +2 -0
- package/lib/esm/components/ActionSheets/interface/index.js.map +1 -0
- package/lib/esm/components/ActionSheets/styles.js +55 -0
- package/lib/esm/components/ActionSheets/styles.js.map +1 -0
- package/lib/esm/components/AvatarGroup/AvatarGroup.js +10 -4
- package/lib/esm/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/lib/esm/components/AvatarGroup/index.js +17 -11
- package/lib/esm/components/AvatarGroup/index.js.map +1 -1
- package/lib/esm/components/ImagePreview/ImagePreview.js +11 -5
- package/lib/esm/components/ImagePreview/ImagePreview.js.map +1 -1
- package/lib/esm/components/ImagePreview/index.js +18 -12
- package/lib/esm/components/ImagePreview/index.js.map +1 -1
- package/lib/esm/components/List/ListItem/ListItem.js +11 -5
- package/lib/esm/components/List/ListItem/ListItem.js.map +1 -1
- package/lib/esm/components/List/index.js +16 -10
- package/lib/esm/components/List/index.js.map +1 -1
- package/lib/esm/components/Picker/Picker.js +6 -1
- package/lib/esm/components/Picker/Picker.js.map +1 -1
- package/lib/esm/components/Picker/index.js +6 -1
- package/lib/esm/components/Picker/index.js.map +1 -1
- package/lib/esm/components/Sheets/Sheets.js +170 -18
- package/lib/esm/components/Sheets/Sheets.js.map +1 -1
- package/lib/esm/components/Sheets/index.js +9 -3
- package/lib/esm/components/Sheets/index.js.map +1 -1
- package/lib/esm/components/Sheets/interface/index.js +1 -1
- package/lib/esm/components/Sheets/styles.js +39 -11
- package/lib/esm/components/Sheets/styles.js.map +1 -1
- package/lib/esm/components/Silder/Silder.js +67 -0
- package/lib/esm/components/Silder/Silder.js.map +1 -0
- package/lib/esm/components/Silder/index.js +12 -0
- package/lib/esm/components/Silder/index.js.map +1 -0
- package/lib/esm/components/Silder/interface/index.js +3 -0
- package/lib/esm/components/Silder/interface/index.js.map +1 -0
- package/lib/esm/components/Silder/styles.js +25 -0
- package/lib/esm/components/Silder/styles.js.map +1 -0
- package/lib/esm/components/TabBar/TabBar.js +10 -10
- package/lib/esm/components/TabBar/TabBar.js.map +1 -1
- package/lib/esm/index.js +8 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/types/components/ActionSheets/ActionSheets.d.ts +10 -0
- package/lib/types/components/ActionSheets/demo/index.d.ts +2 -0
- package/lib/types/components/ActionSheets/index.d.ts +4 -0
- package/lib/types/components/ActionSheets/interface/index.d.ts +23 -0
- package/lib/types/components/ActionSheets/styles.d.ts +51 -0
- package/lib/types/components/ActionSheets/test/index.bench.d.ts +1 -0
- package/lib/types/components/ActionSheets/test/index.test.d.ts +1 -0
- package/lib/types/components/ActionSheets/test/paper.bench.d.ts +1 -0
- package/lib/types/components/FAB/test/paper.bench.d.ts +1 -0
- package/lib/types/components/Sheets/Sheets.d.ts +17 -1
- package/lib/types/components/Sheets/interface/index.d.ts +45 -0
- package/lib/types/components/Sheets/styles.d.ts +38 -9
- package/lib/types/components/Sheets/test/index.test.d.ts +1 -1
- package/lib/types/components/Silder/Silder.d.ts +13 -0
- package/lib/types/components/Silder/demo/index.d.ts +2 -0
- package/lib/types/components/Silder/index.d.ts +4 -0
- package/lib/types/components/Silder/interface/index.d.ts +19 -0
- package/lib/types/components/Silder/styles.d.ts +20 -0
- package/lib/types/components/Silder/test/index.bench.d.ts +1 -0
- package/lib/types/components/Silder/test/index.test.d.ts +1 -0
- package/lib/types/index.d.ts +2 -0
- package/package.json +2 -3
- package/src/components/ActionSheets/ActionSheets.tsx +66 -0
- package/src/components/ActionSheets/demo/index.tsx +65 -0
- package/src/components/ActionSheets/doc/index.mdx +24 -0
- package/src/components/ActionSheets/index.ts +5 -0
- package/src/components/ActionSheets/interface/index.ts +27 -0
- package/src/components/ActionSheets/styles.ts +54 -0
- package/src/components/ActionSheets/test/index.bench.tsx +13 -0
- package/src/components/ActionSheets/test/index.test.tsx +81 -0
- package/src/components/ActionSheets/test/paper.bench.tsx +17 -0
- package/src/components/Avatar/test/__snapshots__/index.test.tsx.snap +32 -0
- package/src/components/Avatar/test/paper.bench.tsx +1 -1
- package/src/components/Button/test/__snapshots__/index.test.tsx.snap +0 -10
- package/src/components/Divider/test/__snapshots__/index.test.tsx.snap +420 -6
- package/src/components/Divider/test/index.test.tsx +43 -35
- package/src/components/FAB/test/__snapshots__/index.test.tsx.snap +0 -2
- package/src/components/FAB/test/paper.bench.tsx +12 -0
- package/src/components/Picker/test/index.test.tsx +17 -25
- package/src/components/Progress/test/__snapshots__/index.test.tsx.snap +332 -3
- package/src/components/Progress/test/index.test.tsx +29 -19
- package/src/components/PullRefresh/test/index.bench.tsx +1 -1
- package/src/components/Sheets/Sheets.tsx +293 -20
- package/src/components/Sheets/demo/index.tsx +191 -14
- package/src/components/Sheets/doc/index.mdx +16 -5
- package/src/components/Sheets/interface/index.ts +50 -0
- package/src/components/Sheets/styles.ts +38 -10
- package/src/components/Sheets/test/index.test.tsx +71 -48
- package/src/components/Sheets/test/paper.bench.tsx +1 -1
- package/src/components/Silder/Silder.tsx +49 -0
- package/src/components/Silder/demo/index.tsx +53 -0
- package/src/components/Silder/doc/index.mdx +26 -0
- package/src/components/Silder/index.ts +5 -0
- package/src/components/Silder/interface/index.ts +20 -0
- package/src/components/Silder/styles.ts +24 -0
- package/src/components/Silder/test/index.bench.tsx +13 -0
- package/src/components/Silder/test/index.test.tsx +18 -0
- package/src/components/TabBar/TabBar.tsx +17 -17
- package/src/components/Toast/test/paper.bench.tsx +9 -5
- package/src/index.ts +2 -0
- package/lib/cjs/_chunks/DIhBCUjt.js +0 -17
- package/lib/cjs/_chunks/DIhBCUjt.js.map +0 -1
- package/lib/esm/_chunks/B3_9dzWY.js +0 -14
- package/lib/esm/_chunks/B3_9dzWY.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.js","sources":["../../../../src/components/TabBar/TabBar.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, useMemo, useCallback } from \"react\";\nimport { View, Text, TouchableWithoutFeedback, Animated, GestureResponderEvent } from \"react-native\";\nimport { RedsTabBar, TabBarDefaultProps } from \"./interface/index\";\nimport styles from \"./styles\";\nimport Icon from \"../Icon\";\nimport { DataType, RedsBadge } from \"./interface\";\nimport Badge from \"../Badge\";\n/**\n * 默认icon大小\n */\nconst defaultIconSize = 20;\n\nconst TabBar = (props: RedsTabBar) => {\n /**\n * 计算文字class\n * @param item\n */\n const getTextClass = (item: DataType) => {\n return item?.iconProps?.icon\n ? props.activeTab === item.key\n ? styles.activeIconText\n : styles.iconText\n : props.activeTab === item.key\n ? styles.activeText\n : styles.text;\n };\n\n /**\n * 计算文字颜色\n * @param item\n */\n const getTextColor = (item: DataType) => {\n return {\n color: props.activeTab === item.key ? item.activeColor || \"rgba(0,0,0)\" : item.normalColor || \"rgba(0,0,0,0.45)\",\n };\n };\n\n /**\n * 计算Icon颜色\n */\n const getIconColor = (item: DataType) => {\n return (props.activeTab === item.key ? item.activeColor : item.normalColor) || item?.iconProps?.fill;\n };\n\n /**\n * 触发点击事件\n */\n const handleTabChange = (item: DataType) => {\n props?.onChange?.(item.key);\n };\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"TabBar.js","sources":["../../../../src/components/TabBar/TabBar.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, useMemo, useCallback } from \"react\";\nimport { View, Text, TouchableWithoutFeedback, Animated, GestureResponderEvent } from \"react-native\";\nimport { RedsTabBar, TabBarDefaultProps } from \"./interface/index\";\nimport styles from \"./styles\";\nimport Icon from \"../Icon\";\nimport { DataType, RedsBadge } from \"./interface\";\nimport Badge from \"../Badge\";\n/**\n * 默认icon大小\n */\nconst defaultIconSize = 20;\n\nconst TabBar = (props: RedsTabBar) => {\n /**\n * 渲染的tab数据\n */\n\n const renderTabs = useMemo(() => {\n if (props.customTabBar) {\n /** 记录插入位置 */\n const customIdx = Math.floor(props.list.length / 2);\n /** 插入数据 */\n return props.list.reduce((prev: DataType[], cur: DataType, index: number) => {\n return (index === customIdx ? [...prev, props.customTabBar, cur] : [...prev, cur]) as DataType[];\n }, [] as DataType[]);\n } else {\n return props.list;\n }\n }, [props.list, props.customTabBar]);\n\n /**\n * 计算文字class\n * @param item\n */\n const getTextClass = (item: DataType) => {\n return item?.iconProps?.icon\n ? props.activeTab === item.key\n ? styles.activeIconText\n : styles.iconText\n : props.activeTab === item.key\n ? styles.activeText\n : styles.text;\n };\n\n /**\n * 计算文字颜色\n * @param item\n */\n const getTextColor = (item: DataType) => {\n return {\n color: props.activeTab === item.key ? item.activeColor || \"rgba(0,0,0)\" : item.normalColor || \"rgba(0,0,0,0.45)\",\n };\n };\n\n /**\n * 计算Icon颜色\n */\n const getIconColor = (item: DataType) => {\n return (props.activeTab === item.key ? item.activeColor : item.normalColor) || item?.iconProps?.fill;\n };\n\n /**\n * 触发点击事件\n */\n const handleTabChange = (item: DataType) => {\n props?.onChange?.(item.key);\n };\n\n /**\n * 容器\n */\n const Wrapper = (wrapperProps: { badgeProps: RedsBadge; children: React.ReactNode }) => {\n return props?.badge ? (\n <View style={styles.badgeWrapper}>\n <Badge {...wrapperProps.badgeProps}>{wrapperProps.children}</Badge>\n </View>\n ) : (\n wrapperProps.children\n );\n };\n\n return (\n <View style={[styles.TabBarContainer, props.containerStyles]}>\n {renderTabs.map((item) => {\n return (\n <TouchableWithoutFeedback onPress={() => handleTabChange(item)} key={item.key}>\n <View style={styles.TabItemContainer}>\n <Wrapper badgeProps={item.badgeProps || {}} key={item.key}>\n <View style={styles.flexCenter}>\n {item.iconProps?.icon ? (\n <Icon\n icon={item.iconProps?.icon}\n fill={getIconColor(item) || \"pink\"}\n size={item?.iconProps?.size || defaultIconSize}\n onClick={() => handleTabChange(item)}\n />\n ) : (\n <></>\n )}\n {item.text ? <Text style={[getTextClass(item), getTextColor(item)]}>{item.text}</Text> : <></>}\n </View>\n </Wrapper>\n </View>\n </TouchableWithoutFeedback>\n );\n })}\n </View>\n );\n};\n\nTabBar.defaultProps = TabBarDefaultProps;\n\nexport default TabBar;\n"],"names":["defaultIconSize","TabBar","props","renderTabs","useMemo","customTabBar","customIdx","Math","floor","list","length","reduce","prev","cur","index","concat","_toConsumableArray","getTextClass","item","_item$iconProps","iconProps","icon","activeTab","key","styles","activeIconText","iconText","activeText","text","getTextColor","color","activeColor","normalColor","getIconColor","_item$iconProps2","fill","handleTabChange","_props$onChange","onChange","call","Wrapper","wrapperProps","badge","React","createElement","View","style","badgeWrapper","Badge","_objectSpread","badgeProps","children","TabBarContainer","containerStyles","map","_item$iconProps3","_item$iconProps4","_item$iconProps5","TouchableWithoutFeedback","onPress","TabItemContainer","flexCenter","Icon","size","onClick","Text","Fragment","defaultProps","TabBarDefaultProps"],"mappings":";;;;;;;;;;;;AAUA,IAAMA,eAAkB,GAAA,EAAA,CAAA;AAExB,IAAMC,MAAA,GAAS,SAATA,MAAA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AAf,IAAI,CAAK,IAAA,MAAA;AAC5B6C,MAAAA,IAAA,EAAM,CAAA7C,IAAM,aAANA,IAAM,KAAA,KAAA,CAAA,IAAA,CAAAuC,gBAAA,GAANvC,IAAM,CAAAE,SAAA,cAAAqC,gBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAANA,gBAAA,CAAiBM,IAAQ,KAAA/D,eAAA;MAC/BgE,OAAA,EAAS,SAATA,OAAAA,GAAA;QAAA,OAAe5B,eAAA,CAAgBlB,IAAI,CAAA,CAAA;AAAA,OAAA;KACrC,CAAA,4EAEE,CAEH,EAAAA,IAAA,CAAKU,sBAAQe,cAAA,CAAAC,aAAA,CAAAqB,IAAA,EAAA;MAAKnB,KAAO,EAAA,CAAC7B,YAAa,CAAAC,IAAI,GAAGW,YAAa,CAAAX,IAAI,CAAC,CAAA;KAAA,EAAIA,IAAK,CAAAU,IAAK,mBAAYe,cAAA,CAAAC,aAAA,CAAAD,cAAA,CAAAuB,QAAA,EAAA,IAAA,CAC7F,CACF,CACF,CACF,CAAA,CAAA;AAEJ,GAAC,CACH,CAAA,CAAA;AAEJ,EAAA;AAEAjE,MAAA,CAAOkE,YAAe,GAAAC,kBAAA;;;;"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export { default as ActionSheets } from './components/ActionSheets/ActionSheets.js';
|
|
2
|
+
export { i as ActionSheetsType } from './_chunks/DHJk9lIr.js';
|
|
3
|
+
export { default as Silder } from './components/Silder/Silder.js';
|
|
4
|
+
export { i as SilderType } from './_chunks/RRfNwNcs.js';
|
|
1
5
|
export { default as Sheets } from './components/Sheets/Sheets.js';
|
|
2
|
-
export { i as SheetsType } from './_chunks/
|
|
6
|
+
export { i as SheetsType } from './_chunks/BJ2Kj1Vd.js';
|
|
3
7
|
export { default as PickerView } from './components/PickerView/PickerView.js';
|
|
4
8
|
export { i as PickerViewType } from './_chunks/BCi0K_XP.js';
|
|
5
9
|
export { default as Picker } from './components/Picker/Picker.js';
|
|
@@ -73,15 +77,17 @@ export { default as Tab } from './components/Tab/Tab.js';
|
|
|
73
77
|
export { i as TabType } from './_chunks/5aBuaARv.js';
|
|
74
78
|
import 'react';
|
|
75
79
|
import 'react-native';
|
|
80
|
+
import './components/ActionSheets/styles.js';
|
|
76
81
|
import './components/ConfigProvider/hooks/ConfigCache/ConfigCache.js';
|
|
77
82
|
import './_chunks/D-HreRcG.js';
|
|
78
83
|
import '@xhsreds/reds-token-next';
|
|
84
|
+
import './components/Silder/styles.js';
|
|
79
85
|
import './components/Sheets/styles.js';
|
|
86
|
+
import '@xhs/reder-icon-svg';
|
|
80
87
|
import './components/PickerView/styles.js';
|
|
81
88
|
import './components/PickerView/Wheel.js';
|
|
82
89
|
import './components/FAB/styles.js';
|
|
83
90
|
import './components/Toast/Toast.js';
|
|
84
|
-
import '@xhs/reder-icon-svg';
|
|
85
91
|
import './components/Toast/styles.js';
|
|
86
92
|
import './components/DropDown/styles.js';
|
|
87
93
|
import './components/Progress/styles.js';
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ActionItem {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
type?: ActionType;
|
|
5
|
+
}
|
|
6
|
+
export declare const enum ActionType {
|
|
7
|
+
normal = "normal",
|
|
8
|
+
invalid = "invalid",
|
|
9
|
+
primary = "primary"
|
|
10
|
+
}
|
|
11
|
+
export interface RedsActionSheets {
|
|
12
|
+
data: ActionItem[];
|
|
13
|
+
description?: string;
|
|
14
|
+
visible: boolean;
|
|
15
|
+
onClose: () => any;
|
|
16
|
+
onChange: (value: string) => any;
|
|
17
|
+
}
|
|
18
|
+
export interface RedsActionSheetsEvent {
|
|
19
|
+
}
|
|
20
|
+
export declare const ActionSheetsDefaultProps: {
|
|
21
|
+
data: never[];
|
|
22
|
+
visible: boolean;
|
|
23
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const styles: {
|
|
2
|
+
ActionSheetsContainer: {
|
|
3
|
+
width: "100%";
|
|
4
|
+
overflowY: string;
|
|
5
|
+
borderTopLeftRadius: number;
|
|
6
|
+
borderTopRightRadius: number;
|
|
7
|
+
};
|
|
8
|
+
description: {
|
|
9
|
+
height: number;
|
|
10
|
+
boxSizing: string;
|
|
11
|
+
paddingLeft: number;
|
|
12
|
+
paddingRight: number;
|
|
13
|
+
width: "100%";
|
|
14
|
+
display: "flex";
|
|
15
|
+
alignItems: "center";
|
|
16
|
+
justifyContent: "center";
|
|
17
|
+
borderTopLeftRadius: number;
|
|
18
|
+
borderTopRightRadius: number;
|
|
19
|
+
};
|
|
20
|
+
descriptionText: {
|
|
21
|
+
fontSize: number;
|
|
22
|
+
fontWeight: "400";
|
|
23
|
+
};
|
|
24
|
+
action: {
|
|
25
|
+
height: number;
|
|
26
|
+
width: "100%";
|
|
27
|
+
paddingLeft: number;
|
|
28
|
+
paddingRight: number;
|
|
29
|
+
display: "flex";
|
|
30
|
+
alignItems: "center";
|
|
31
|
+
justifyContent: "center";
|
|
32
|
+
};
|
|
33
|
+
actionText: {
|
|
34
|
+
fontSize: number;
|
|
35
|
+
fontWeight: "400";
|
|
36
|
+
};
|
|
37
|
+
cancel: {
|
|
38
|
+
height: number;
|
|
39
|
+
width: "100%";
|
|
40
|
+
paddingLeft: number;
|
|
41
|
+
paddingRight: number;
|
|
42
|
+
boxSizing: string;
|
|
43
|
+
fontSize: number;
|
|
44
|
+
fontWeight: number;
|
|
45
|
+
display: "flex";
|
|
46
|
+
alignItems: "center";
|
|
47
|
+
justifyContent: "center";
|
|
48
|
+
marginTop: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export default styles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { RedsSheets } from "./interface/index";
|
|
2
|
+
import { RedsSheets, SheetsMaskMode, SheetsType, SheetsIconType, SheetsActionType, SheetsSize } from "./interface/index";
|
|
3
3
|
declare const Sheets: {
|
|
4
4
|
(props: RedsSheets): React.JSX.Element;
|
|
5
5
|
defaultProps: {
|
|
6
6
|
label: string;
|
|
7
|
+
mask: boolean;
|
|
8
|
+
maskMode: SheetsMaskMode; /**
|
|
9
|
+
* Sheets容器高度动画
|
|
10
|
+
*/
|
|
11
|
+
sheetsType: SheetsType;
|
|
12
|
+
cancel: boolean;
|
|
13
|
+
close: boolean;
|
|
14
|
+
cancelType: SheetsActionType;
|
|
15
|
+
closeType: SheetsActionType;
|
|
16
|
+
cancelText: string;
|
|
17
|
+
/**
|
|
18
|
+
* 底部操作区高度
|
|
19
|
+
*/
|
|
20
|
+
closeText: string;
|
|
21
|
+
iconType: SheetsIconType;
|
|
22
|
+
size: SheetsSize;
|
|
7
23
|
onCancel: () => void;
|
|
8
24
|
onConfirm: () => void;
|
|
9
25
|
visible: boolean;
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
export declare const enum SheetsMaskMode {
|
|
3
|
+
light = "light",
|
|
4
|
+
dark = "dark"
|
|
5
|
+
}
|
|
6
|
+
export declare const enum SheetsType {
|
|
7
|
+
normal = "narmal",
|
|
8
|
+
dragable = "dragable",
|
|
9
|
+
action = "action"
|
|
10
|
+
}
|
|
11
|
+
export declare const enum SheetsActionType {
|
|
12
|
+
text = "text",
|
|
13
|
+
icon = "icon"
|
|
14
|
+
}
|
|
15
|
+
export declare const enum SheetsIconType {
|
|
16
|
+
bg = "bg",
|
|
17
|
+
normal = "normal"
|
|
18
|
+
}
|
|
19
|
+
export declare const enum SheetsSize {
|
|
20
|
+
auto = "auto",
|
|
21
|
+
half = "half",
|
|
22
|
+
full = "full",
|
|
23
|
+
threeQuater = "threeQuater"
|
|
24
|
+
}
|
|
2
25
|
export interface RedsSheets {
|
|
3
26
|
label?: string;
|
|
27
|
+
mask?: boolean;
|
|
28
|
+
maskMode?: SheetsMaskMode;
|
|
29
|
+
sheetsType?: SheetsType;
|
|
30
|
+
cancel?: boolean;
|
|
31
|
+
close?: boolean;
|
|
32
|
+
cancelType?: SheetsActionType;
|
|
33
|
+
closeType?: SheetsActionType;
|
|
34
|
+
cancelText?: string;
|
|
35
|
+
closeText?: string;
|
|
36
|
+
iconType?: SheetsIconType;
|
|
37
|
+
size?: SheetsSize;
|
|
4
38
|
onCancel: () => any;
|
|
5
39
|
onConfirm: () => any;
|
|
6
40
|
visible: boolean;
|
|
@@ -10,6 +44,17 @@ export interface RedsSheetsEvent {
|
|
|
10
44
|
}
|
|
11
45
|
export declare const SheetsDefaultProps: {
|
|
12
46
|
label: string;
|
|
47
|
+
mask: boolean;
|
|
48
|
+
maskMode: SheetsMaskMode;
|
|
49
|
+
sheetsType: SheetsType;
|
|
50
|
+
cancel: boolean;
|
|
51
|
+
close: boolean;
|
|
52
|
+
cancelType: SheetsActionType;
|
|
53
|
+
closeType: SheetsActionType;
|
|
54
|
+
cancelText: string;
|
|
55
|
+
closeText: string;
|
|
56
|
+
iconType: SheetsIconType;
|
|
57
|
+
size: SheetsSize;
|
|
13
58
|
onCancel: () => void;
|
|
14
59
|
onConfirm: () => void;
|
|
15
60
|
visible: boolean;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
declare const styles: {
|
|
2
|
-
|
|
3
|
-
width: "100%";
|
|
4
|
-
height: "100%";
|
|
5
|
-
backgroundColor: string;
|
|
2
|
+
wrapper: {
|
|
6
3
|
position: "absolute";
|
|
7
4
|
bottom: number;
|
|
8
5
|
left: number;
|
|
@@ -12,7 +9,6 @@ declare const styles: {
|
|
|
12
9
|
mask: {
|
|
13
10
|
width: "100%";
|
|
14
11
|
height: "100%";
|
|
15
|
-
backgroundColor: string;
|
|
16
12
|
position: "absolute";
|
|
17
13
|
bottom: number;
|
|
18
14
|
left: number;
|
|
@@ -20,14 +16,12 @@ declare const styles: {
|
|
|
20
16
|
top: number;
|
|
21
17
|
};
|
|
22
18
|
picker: {
|
|
19
|
+
borderTopLeftRadius: number;
|
|
20
|
+
borderTopRightRadius: number;
|
|
23
21
|
position: "absolute";
|
|
24
22
|
bottom: number;
|
|
25
23
|
left: number;
|
|
26
24
|
right: number;
|
|
27
|
-
paddingTop: number;
|
|
28
|
-
paddingBottom: number;
|
|
29
|
-
borderTopLeftRadius: number;
|
|
30
|
-
borderTopRightRadius: number;
|
|
31
25
|
};
|
|
32
26
|
labelContainer: {
|
|
33
27
|
display: "flex";
|
|
@@ -52,5 +46,40 @@ declare const styles: {
|
|
|
52
46
|
fontSize: number;
|
|
53
47
|
fontWeight: "400";
|
|
54
48
|
};
|
|
49
|
+
iconBg: {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
borderRadius: number;
|
|
53
|
+
display: "flex";
|
|
54
|
+
justifyContent: "center";
|
|
55
|
+
alignItems: "center";
|
|
56
|
+
};
|
|
57
|
+
dragableContainer: {
|
|
58
|
+
width: "100%";
|
|
59
|
+
height: number;
|
|
60
|
+
display: "flex";
|
|
61
|
+
justifyContent: "center";
|
|
62
|
+
alignItems: "center";
|
|
63
|
+
};
|
|
64
|
+
dragable: {
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
borderRadius: number;
|
|
68
|
+
};
|
|
69
|
+
block: {
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
};
|
|
73
|
+
actionContainer: {
|
|
74
|
+
display: "flex";
|
|
75
|
+
justifyContent: "space-between";
|
|
76
|
+
alignItems: "center";
|
|
77
|
+
flexDirection: "row";
|
|
78
|
+
width: "100%";
|
|
79
|
+
};
|
|
80
|
+
action: {
|
|
81
|
+
flex: number;
|
|
82
|
+
marginHorizontal: number;
|
|
83
|
+
};
|
|
55
84
|
};
|
|
56
85
|
export default styles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { RedsSilder } from "./interface/index";
|
|
3
|
+
declare const Silder: {
|
|
4
|
+
({ value, defaultValue, onChange, onClick, trackOnColor, trackOffColor }: RedsSilder): React.JSX.Element;
|
|
5
|
+
defaultProps: {
|
|
6
|
+
value: undefined;
|
|
7
|
+
defaultValue: boolean;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
trackOnColor: string;
|
|
10
|
+
trackOffColor: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default Silder;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GestureResponderEvent } from "react-native";
|
|
2
|
+
export interface RedsSilder {
|
|
3
|
+
value?: boolean;
|
|
4
|
+
defaultValue?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
trackOnColor?: string;
|
|
7
|
+
trackOffColor?: string;
|
|
8
|
+
onChange?: (value: boolean) => any;
|
|
9
|
+
onClick?: (value: GestureResponderEvent) => any;
|
|
10
|
+
}
|
|
11
|
+
export interface RedsSilderEvent {
|
|
12
|
+
}
|
|
13
|
+
export declare const SilderDefaultProps: {
|
|
14
|
+
value: undefined;
|
|
15
|
+
defaultValue: boolean;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
trackOnColor: string;
|
|
18
|
+
trackOffColor: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const styles: {
|
|
2
|
+
SilderContainer: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
borderRadius: number;
|
|
6
|
+
justifyContent: "center";
|
|
7
|
+
alignItems: "center";
|
|
8
|
+
};
|
|
9
|
+
thumb: {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
borderRadius: number;
|
|
13
|
+
backgroundColor: string;
|
|
14
|
+
justifyContent: "center";
|
|
15
|
+
alignItems: "center";
|
|
16
|
+
position: "absolute";
|
|
17
|
+
left: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default styles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/react-native/extend-expect";
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xhsreds/reds-rn-next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"author": "贾斌(呀哈) <jiabin@xiaohongshu.com>",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@floating-ui/react-native": "~0.10.6",
|
|
8
8
|
"dayjs": "^1.10.7",
|
|
9
|
-
"@xhsreds/reds-token-next": "0.1.
|
|
9
|
+
"@xhsreds/reds-token-next": "0.1.2"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"@xhs/reder-icon-svg": "~1.0.1",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"test": "vitest --coverage",
|
|
35
|
-
"test:update-snapshots": "vitest --update",
|
|
36
35
|
"bench": "vitest bench --outputJson benchmarks/out.json",
|
|
37
36
|
"clear": "rm -rf ./node_modules && rm -rf ./lib",
|
|
38
37
|
"build": "rm -rf ./lib/* && rollup -c && npm run build:types",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
2
|
+
import { View, TouchableWithoutFeedback, Text } from "react-native";
|
|
3
|
+
import { RedsActionSheets, ActionSheetsDefaultProps } from "./interface/index";
|
|
4
|
+
import styles from "./styles";
|
|
5
|
+
import { useThemeColor } from "../ConfigProvider";
|
|
6
|
+
import Sheets, { SheetsType } from "../Sheets";
|
|
7
|
+
import { ActionType } from "./interface";
|
|
8
|
+
|
|
9
|
+
const ActionSheets = (props: RedsActionSheets) => {
|
|
10
|
+
const themeColor = useThemeColor();
|
|
11
|
+
|
|
12
|
+
const getActionStyles = (type: ActionType) => {
|
|
13
|
+
if (type === ActionType.invalid) {
|
|
14
|
+
return [styles.actionText, { color: themeColor.Disabled }];
|
|
15
|
+
} else if (type === ActionType.primary) {
|
|
16
|
+
return [styles.actionText, { color: themeColor.Primary }];
|
|
17
|
+
} else {
|
|
18
|
+
return styles.actionText;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const handleClick = (value: string) => {
|
|
23
|
+
props?.onChange?.(value);
|
|
24
|
+
props?.onClose?.();
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const handleClose = () => {
|
|
28
|
+
props?.onClose?.();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Sheets
|
|
33
|
+
visible={props.visible}
|
|
34
|
+
cancel={false}
|
|
35
|
+
close={false}
|
|
36
|
+
sheetsType={SheetsType.SheetsType.normal}
|
|
37
|
+
onCancel={handleClose}
|
|
38
|
+
>
|
|
39
|
+
<View style={[styles.ActionSheetsContainer, { backgroundColor: themeColor.Bg1 }]}>
|
|
40
|
+
{props.description ? (
|
|
41
|
+
<View style={[styles.description, { backgroundColor: themeColor.Bg2 }]}>
|
|
42
|
+
<Text style={styles.descriptionText}>{props.description}</Text>
|
|
43
|
+
</View>
|
|
44
|
+
) : (
|
|
45
|
+
<></>
|
|
46
|
+
)}
|
|
47
|
+
{props?.data?.map((item) => (
|
|
48
|
+
<TouchableWithoutFeedback onPress={() => handleClick(item.value)}>
|
|
49
|
+
<View style={[styles.action, { backgroundColor: themeColor.Bg2 }]}>
|
|
50
|
+
<Text style={getActionStyles(item.type as ActionType)}>{item.label}</Text>
|
|
51
|
+
</View>
|
|
52
|
+
</TouchableWithoutFeedback>
|
|
53
|
+
))}
|
|
54
|
+
<TouchableWithoutFeedback onPress={handleClose}>
|
|
55
|
+
<View style={[styles.cancel, { backgroundColor: themeColor.Bg2 }]}>
|
|
56
|
+
<Text style={{ color: themeColor.Title }}>取消</Text>
|
|
57
|
+
</View>
|
|
58
|
+
</TouchableWithoutFeedback>
|
|
59
|
+
</View>
|
|
60
|
+
</Sheets>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
ActionSheets.defaultProps = ActionSheetsDefaultProps;
|
|
65
|
+
|
|
66
|
+
export default ActionSheets;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState } from "react";
|
|
2
|
+
import { View, Text, StyleSheet, FlatList, ScrollView } from "react-native";
|
|
3
|
+
import { ActionSheets, Button, ActionSheetsType } from "@xhs/reds-rn-next";
|
|
4
|
+
|
|
5
|
+
export default function App() {
|
|
6
|
+
const [visible1, setVisible1] = useState(false);
|
|
7
|
+
const [visible2, setVisible2] = useState(false);
|
|
8
|
+
const list = [
|
|
9
|
+
{
|
|
10
|
+
label: "操作",
|
|
11
|
+
value: "1",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
label: "操作",
|
|
15
|
+
value: "2",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: "操作",
|
|
19
|
+
value: "3",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: "操作",
|
|
23
|
+
value: "4",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "操作",
|
|
27
|
+
value: "5",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const list1 = [
|
|
32
|
+
{
|
|
33
|
+
label: "操作",
|
|
34
|
+
value: "1",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "失效操作",
|
|
38
|
+
value: "2",
|
|
39
|
+
type: ActionSheetsType.ActionType.invalid,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "警告操作",
|
|
43
|
+
value: "3",
|
|
44
|
+
type: ActionSheetsType.ActionType.primary,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const handleChange = (value: string) => {
|
|
49
|
+
console.log("handleChange", value);
|
|
50
|
+
};
|
|
51
|
+
return (
|
|
52
|
+
<View>
|
|
53
|
+
<Button onClick={() => setVisible1(true)}>有描述的ActionSheet</Button>
|
|
54
|
+
<ActionSheets
|
|
55
|
+
visible={visible1}
|
|
56
|
+
data={list}
|
|
57
|
+
description={"一段描述"}
|
|
58
|
+
onClose={() => setVisible1(false)}
|
|
59
|
+
onChange={handleChange}
|
|
60
|
+
/>
|
|
61
|
+
<Button onClick={() => setVisible2(true)}>不同状态的ActionSheet</Button>
|
|
62
|
+
<ActionSheets visible={visible2} data={list1} onClose={() => setVisible2(false)} onChange={handleChange} />
|
|
63
|
+
</View>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -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
|
+
| data | 列表数据 | ActionItem[] | `[]` |
|
|
16
|
+
| description | 描述 | string | |
|
|
17
|
+
| visible | 是否展示列表 | boolean | false |
|
|
18
|
+
|
|
19
|
+
### Events
|
|
20
|
+
|
|
21
|
+
| 事件 | 描述 | 类型 | 默认值 |
|
|
22
|
+
| -------- | ---------- | ---------------------- | ------ |
|
|
23
|
+
| onClose | 关闭时触发 | () => any | |
|
|
24
|
+
| onChange | 点击时触发 | (value: string) => any | |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GestureResponderEvent } from "react-native";
|
|
2
|
+
import { lightColor } from "@xhs/reds-token-next";
|
|
3
|
+
|
|
4
|
+
export interface ActionItem {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
type?: ActionType;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const enum ActionType {
|
|
11
|
+
normal = "normal",
|
|
12
|
+
invalid = "invalid",
|
|
13
|
+
primary = "primary",
|
|
14
|
+
}
|
|
15
|
+
export interface RedsActionSheets {
|
|
16
|
+
data: ActionItem[];
|
|
17
|
+
description?: string;
|
|
18
|
+
visible: boolean;
|
|
19
|
+
onClose: () => any;
|
|
20
|
+
onChange: (value: string) => any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface RedsActionSheetsEvent {}
|
|
24
|
+
export const ActionSheetsDefaultProps = {
|
|
25
|
+
data: [],
|
|
26
|
+
visible: false,
|
|
27
|
+
};
|