taro-ui 3.3.3 → 3.4.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/LICENSE +1 -1
- package/README.md +85 -0
- package/dist/common/utils.d.ts +2 -1
- package/dist/common/utils.js +3 -0
- package/dist/common/utils.js.map +1 -1
- package/dist/components/accordion/index.d.ts +16 -13
- package/dist/components/accordion/index.js +77 -97
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/action-sheet/body/index.d.ts +2 -4
- package/dist/components/action-sheet/body/index.js +8 -6
- package/dist/components/action-sheet/body/index.js.map +1 -1
- package/dist/components/action-sheet/body/item/index.d.ts +7 -7
- package/dist/components/action-sheet/body/item/index.js +14 -14
- package/dist/components/action-sheet/body/item/index.js.map +1 -1
- package/dist/components/action-sheet/footer/index.d.ts +7 -7
- package/dist/components/action-sheet/footer/index.js +14 -17
- package/dist/components/action-sheet/footer/index.js.map +1 -1
- package/dist/components/action-sheet/header/index.d.ts +2 -4
- package/dist/components/action-sheet/header/index.js +8 -9
- package/dist/components/action-sheet/header/index.js.map +1 -1
- package/dist/components/action-sheet/index.d.ts +12 -13
- package/dist/components/action-sheet/index.js +53 -57
- package/dist/components/action-sheet/index.js.map +1 -1
- package/dist/components/activity-indicator/index.d.ts +12 -6
- package/dist/components/activity-indicator/index.js +19 -22
- package/dist/components/activity-indicator/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +14 -8
- package/dist/components/avatar/index.js +36 -43
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +11 -8
- package/dist/components/badge/index.js +18 -34
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/button/index.d.ts +29 -14
- package/dist/components/button/index.js +97 -112
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/body/index.d.ts +3 -26
- package/dist/components/calendar/body/index.js +215 -235
- package/dist/components/calendar/body/index.js.map +1 -1
- package/dist/components/calendar/controller/index.d.ts +3 -5
- package/dist/components/calendar/controller/index.js +47 -43
- package/dist/components/calendar/controller/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +3 -20
- package/dist/components/calendar/index.js +219 -201
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar/ui/date-list/index.d.ts +2 -6
- package/dist/components/calendar/ui/date-list/index.js +36 -41
- package/dist/components/calendar/ui/date-list/index.js.map +1 -1
- package/dist/components/calendar/ui/day-list/index.d.ts +2 -4
- package/dist/components/calendar/ui/day-list/index.js +6 -5
- package/dist/components/calendar/ui/day-list/index.js.map +1 -1
- package/dist/components/card/index.d.ts +15 -7
- package/dist/components/card/index.js +42 -43
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +11 -7
- package/dist/components/checkbox/index.js +30 -35
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/config-provider/context.d.ts +6 -0
- package/dist/components/config-provider/context.js +13 -0
- package/dist/components/config-provider/context.js.map +1 -0
- package/dist/components/config-provider/index.d.ts +7 -0
- package/dist/components/config-provider/index.js +15 -0
- package/dist/components/config-provider/index.js.map +1 -0
- package/dist/components/countdown/index.d.ts +19 -19
- package/dist/components/countdown/index.js +183 -118
- package/dist/components/countdown/index.js.map +1 -1
- package/dist/components/countdown/item/index.d.ts +8 -7
- package/dist/components/countdown/item/index.js +10 -13
- package/dist/components/countdown/item/index.js.map +1 -1
- package/dist/components/curtain/index.d.ts +11 -8
- package/dist/components/curtain/index.js +36 -45
- package/dist/components/curtain/index.js.map +1 -1
- package/dist/components/divider/index.d.ts +13 -6
- package/dist/components/divider/index.js +29 -38
- package/dist/components/divider/index.js.map +1 -1
- package/dist/components/drawer/index.d.ts +13 -15
- package/dist/components/drawer/index.js +100 -93
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +8 -7
- package/dist/components/fab/index.js +16 -16
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/flex/index.d.ts +11 -5
- package/dist/components/flex/index.js +17 -18
- package/dist/components/flex/index.js.map +1 -1
- package/dist/components/flex/item/index.d.ts +11 -5
- package/dist/components/flex/item/index.js +17 -18
- package/dist/components/flex/item/index.js.map +1 -1
- package/dist/components/float-layout/index.d.ts +20 -12
- package/dist/components/float-layout/index.js +56 -72
- package/dist/components/float-layout/index.js.map +1 -1
- package/dist/components/form/index.d.ts +11 -8
- package/dist/components/form/index.js +28 -28
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/grid/index.d.ts +22 -7
- package/dist/components/grid/index.js +61 -66
- package/dist/components/grid/index.js.map +1 -1
- package/dist/components/icon/index.d.ts +13 -7
- package/dist/components/icon/index.js +24 -34
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/image-picker/index.d.ts +19 -9
- package/dist/components/image-picker/index.js +83 -102
- package/dist/components/image-picker/index.js.map +1 -1
- package/dist/components/indexes/index.d.ts +16 -28
- package/dist/components/indexes/index.js +198 -209
- package/dist/components/indexes/index.js.map +1 -1
- package/dist/components/input/index.d.ts +37 -15
- package/dist/components/input/index.js +152 -161
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input-number/index.d.ts +20 -11
- package/dist/components/input-number/index.js +107 -126
- package/dist/components/input-number/index.js.map +1 -1
- package/dist/components/list/index.d.ts +7 -6
- package/dist/components/list/index.js +15 -15
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list/item/index.d.ts +27 -9
- package/dist/components/list/item/index.js +89 -117
- package/dist/components/list/item/index.js.map +1 -1
- package/dist/components/load-more/index.d.ts +15 -7
- package/dist/components/load-more/index.js +29 -50
- package/dist/components/load-more/index.js.map +1 -1
- package/dist/components/loading/index.d.ts +8 -7
- package/dist/components/loading/index.js +14 -20
- package/dist/components/loading/index.js.map +1 -1
- package/dist/components/message/index.d.ts +9 -14
- package/dist/components/message/index.js +45 -59
- package/dist/components/message/index.js.map +1 -1
- package/dist/components/modal/action/index.d.ts +7 -6
- package/dist/components/modal/action/index.js +15 -15
- package/dist/components/modal/action/index.js.map +1 -1
- package/dist/components/modal/content/index.d.ts +2 -4
- package/dist/components/modal/content/index.js +8 -6
- package/dist/components/modal/content/index.js.map +1 -1
- package/dist/components/modal/header/index.d.ts +2 -4
- package/dist/components/modal/header/index.js +8 -6
- package/dist/components/modal/header/index.js.map +1 -1
- package/dist/components/modal/index.d.ts +16 -14
- package/dist/components/modal/index.js +63 -77
- package/dist/components/modal/index.js.map +1 -1
- package/dist/components/nav-bar/index.d.ts +20 -10
- package/dist/components/nav-bar/index.js +146 -162
- package/dist/components/nav-bar/index.js.map +1 -1
- package/dist/components/noticebar/index.d.ts +17 -15
- package/dist/components/noticebar/index.js +115 -128
- package/dist/components/noticebar/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +13 -11
- package/dist/components/pagination/index.js +64 -120
- package/dist/components/pagination/index.js.map +1 -1
- package/dist/components/progress/index.d.ts +11 -5
- package/dist/components/progress/index.js +39 -36
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/radio/index.d.ts +11 -7
- package/dist/components/radio/index.js +29 -33
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/range/index.d.ts +19 -21
- package/dist/components/range/index.js +146 -153
- package/dist/components/range/index.js.map +1 -1
- package/dist/components/rate/index.d.ts +13 -7
- package/dist/components/rate/index.js +47 -62
- package/dist/components/rate/index.js.map +1 -1
- package/dist/components/search-bar/index.d.ts +23 -15
- package/dist/components/search-bar/index.js +120 -146
- package/dist/components/search-bar/index.js.map +1 -1
- package/dist/components/segmented-control/index.d.ts +14 -7
- package/dist/components/segmented-control/index.js +52 -66
- package/dist/components/segmented-control/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +21 -12
- package/dist/components/slider/index.js +66 -90
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/steps/index.d.ts +11 -7
- package/dist/components/steps/index.js +43 -48
- package/dist/components/steps/index.js.map +1 -1
- package/dist/components/swipe-action/index.d.ts +12 -25
- package/dist/components/swipe-action/index.js +118 -115
- package/dist/components/swipe-action/index.js.map +1 -1
- package/dist/components/swipe-action/options/index.d.ts +2 -4
- package/dist/components/swipe-action/options/index.js +18 -17
- package/dist/components/swipe-action/options/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +14 -7
- package/dist/components/switch/index.js +36 -41
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tab-bar/index.d.ts +17 -7
- package/dist/components/tab-bar/index.js +108 -135
- package/dist/components/tab-bar/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +17 -23
- package/dist/components/tabs/index.js +185 -174
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tabs-pane/index.d.ts +11 -6
- package/dist/components/tabs-pane/index.js +26 -28
- package/dist/components/tabs-pane/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +14 -7
- package/dist/components/tag/index.js +31 -40
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/textarea/index.d.ts +29 -11
- package/dist/components/textarea/index.js +72 -92
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/timeline/index.d.ts +9 -6
- package/dist/components/timeline/index.js +50 -56
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/toast/img.json +3 -6
- package/dist/components/toast/index.d.ts +16 -15
- package/dist/components/toast/index.js +85 -94
- package/dist/components/toast/index.js.map +1 -1
- package/dist/hooks/useComponentLocale.d.ts +2 -0
- package/dist/hooks/useComponentLocale.js +12 -0
- package/dist/hooks/useComponentLocale.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +4006 -4404
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4032 -4434
- package/dist/index.js.map +1 -1
- package/dist/locale/en_US.d.ts +3 -0
- package/dist/locale/en_US.js +34 -0
- package/dist/locale/en_US.js.map +1 -0
- package/dist/locale/index.d.ts +4 -0
- package/dist/locale/index.js +10 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/locale/types.d.ts +34 -0
- package/dist/locale/types.js +1 -0
- package/dist/locale/types.js.map +1 -0
- package/dist/locale/zh_CN.d.ts +3 -0
- package/dist/locale/zh_CN.js +34 -0
- package/dist/locale/zh_CN.js.map +1 -0
- package/dist/style/components/avatar.scss +1 -1
- package/dist/style/components/badge.scss +7 -2
- package/dist/style/components/calendar.scss +1 -1
- package/dist/style/components/countdown.scss +2 -1
- package/dist/style/components/flex.scss +1 -1
- package/dist/style/components/grid.scss +2 -2
- package/dist/style/components/icon.scss +302 -101
- package/dist/style/components/input.scss +2 -2
- package/dist/style/components/progress.scss +1 -1
- package/dist/style/components/search-bar.scss +1 -1
- package/dist/style/components/steps.scss +2 -2
- package/dist/style/components/tabs.scss +1 -1
- package/dist/style/components/tag.scss +1 -1
- package/dist/style/components/timeline.scss +1 -1
- package/dist/style/components/toast.scss +7 -3
- package/dist/style/index.css +176 -176
- package/dist/style/index.css.map +1 -1
- package/dist/style/mixins/libs/hairline.scss +4 -19
- package/dist/style/mixins/libs/shade.scss +3 -6
- package/dist/style/mixins/libs/tint.scss +4 -7
- package/dist/style/themes/purple.scss +15 -15
- package/dist/style/themes/red.scss +16 -13
- package/dist/style/variables/default.scss +69 -73
- package/package.json +5 -3
- package/rn/components/accordion/index.tsx +2 -9
- package/rn/components/action-sheet/body/index.tsx +1 -3
- package/rn/components/action-sheet/body/item/index.tsx +1 -3
- package/rn/components/action-sheet/footer/index.tsx +1 -3
- package/rn/components/action-sheet/header/index.tsx +1 -3
- package/rn/components/activity-indicator/index.tsx +1 -3
- package/rn/components/avatar/index.tsx +5 -5
- package/rn/components/calendar/controller/index.tsx +2 -7
- package/rn/components/card/index.tsx +4 -4
- package/rn/components/countdown/index.scss +5 -4
- package/rn/components/countdown/item/index.tsx +1 -3
- package/rn/components/curtain/index.tsx +5 -5
- package/rn/components/flex/index.scss +2 -2
- package/rn/components/flex/item/index.scss +2 -2
- package/rn/components/grid/index.tsx +15 -15
- package/rn/components/icon/index.tsx +4 -4
- package/rn/components/image-picker/index.tsx +7 -7
- package/rn/components/pagination/index.tsx +7 -7
- package/rn/components/progress/index.tsx +5 -5
- package/rn/components/radio/index.tsx +7 -7
- package/rn/components/rate/index.tsx +4 -4
- package/rn/components/segmented-control/index.tsx +8 -8
- package/rn/components/slider/index.tsx +9 -9
- package/rn/components/steps/index.tsx +8 -8
- package/rn/components/swipe-action/options/index.tsx +1 -3
- package/rn/components/switch/index.tsx +2 -9
- package/rn/components/toast/img.json +3 -6
- package/rn/components/toast/index.tsx +8 -8
- package/rn/style/components/accordion.scss +1 -1
- package/rn/style/components/action-sheet.scss +1 -1
- package/rn/style/components/avatar.scss +1 -1
- package/rn/style/components/badge.scss +8 -3
- package/rn/style/components/button.scss +1 -1
- package/rn/style/components/calendar.scss +1 -1
- package/rn/style/components/checkbox.scss +1 -1
- package/rn/style/components/curtain.scss +1 -1
- package/rn/style/components/fab.scss +1 -4
- package/rn/style/components/flex.scss +1 -1
- package/rn/style/components/grid.scss +2 -6
- package/rn/style/components/icon.scss +302 -101
- package/rn/style/components/index.scss +41 -41
- package/rn/style/components/input.scss +1 -1
- package/rn/style/components/list.scss +2 -4
- package/rn/style/components/loading.scss +4 -4
- package/rn/style/components/message.scss +1 -1
- package/rn/style/components/modal.scss +0 -2
- package/rn/style/components/nav-bar.scss +3 -3
- package/rn/style/components/noticebar.scss +0 -4
- package/rn/style/components/progress.scss +1 -1
- package/rn/style/components/radio.scss +2 -2
- package/rn/style/components/range.scss +1 -1
- package/rn/style/components/search-bar.scss +1 -1
- package/rn/style/components/segmented-control.scss +4 -1
- package/rn/style/components/slider.scss +0 -1
- package/rn/style/components/steps.scss +3 -3
- package/rn/style/components/switch.scss +0 -1
- package/rn/style/components/tabs.scss +2 -2
- package/rn/style/components/tag.scss +1 -1
- package/rn/style/components/timeline.scss +0 -2
- package/rn/style/components/toast.scss +5 -2
- package/rn/style/index.scss +1 -1
- package/rn/style/mixins/libs/hairline.scss +4 -22
- package/rn/style/mixins/libs/shade.scss +1 -4
- package/rn/style/mixins/libs/tint.scss +2 -5
- package/rn/style/themes/purple.scss +15 -15
- package/rn/style/themes/red.scss +16 -13
- package/rn/style/variables/default.scss +69 -73
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/action-sheet/footer/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/action-sheet/footer/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { AtActionSheetFooterProps } from '../../../../types/action-sheet'\n\nfunction AtActionSheetFooter({\n className,\n children,\n onClick\n}: AtActionSheetFooterProps): JSX.Element {\n const handleClick = (...args: any[]): void => {\n if (typeof onClick === 'function') {\n onClick(...args)\n }\n }\n\n const rootClass = classNames('at-action-sheet__footer', className)\n\n return (\n <View onClick={handleClick} className={rootClass}>\n {children}\n </View>\n )\n}\n\nAtActionSheetFooter.propTypes = {\n onClick: PropTypes.func\n}\n\nexport default AtActionSheetFooter\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,YAAY;AAGrB,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACF,GAA0C;AACxC,QAAM,cAAc,IAAI,SAAsB;AAC5C,QAAI,OAAO,YAAY,YAAY;AACjC,cAAQ,GAAG,IAAI;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,YAAY,WAAW,2BAA2B,SAAS;AAEjE,SACE,oCAAC,QAAK,SAAS,aAAa,WAAW,aACpC,QACH;AAEJ;AAEA,oBAAoB,YAAY;AAAA,EAC9B,SAAS,UAAU;AACrB;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { AtActionSheetHeaderProps } from '../../../../types/action-sheet';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
declare function AtActionSheetHeader({ className, children }: AtActionSheetHeaderProps): JSX.Element;
|
|
3
|
+
export default AtActionSheetHeader;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import classNames from "classnames";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { View } from "@tarojs/components";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return /* @__PURE__ */ React.createElement(View, { className: rootClass }, this.props.children);
|
|
11
|
-
}
|
|
4
|
+
function AtActionSheetHeader({
|
|
5
|
+
className,
|
|
6
|
+
children
|
|
7
|
+
}) {
|
|
8
|
+
const rootClass = classNames("at-action-sheet__header", className);
|
|
9
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootClass }, children);
|
|
12
10
|
}
|
|
11
|
+
var header_default = AtActionSheetHeader;
|
|
13
12
|
export {
|
|
14
|
-
|
|
13
|
+
header_default as default
|
|
15
14
|
};
|
|
16
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/action-sheet/header/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { AtActionSheetHeaderProps } from '../../../../types/action-sheet'\n\
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/action-sheet/header/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { AtActionSheetHeaderProps } from '../../../../types/action-sheet'\n\nfunction AtActionSheetHeader({\n className,\n children\n}: AtActionSheetHeaderProps): JSX.Element {\n const rootClass = classNames('at-action-sheet__header', className)\n\n return <View className={rootClass}>{children}</View>\n}\n\nexport default AtActionSheetHeader\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,SAAS,YAAY;AAGrB,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AACF,GAA0C;AACxC,QAAM,YAAY,WAAW,2BAA2B,SAAS;AAEjE,SAAO,oCAAC,QAAK,WAAW,aAAY,QAAS;AAC/C;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
private handleTouchMove;
|
|
13
|
-
render(): JSX.Element;
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { AtActionSheetProps } from '../../../types/action-sheet';
|
|
3
|
+
declare function AtActionSheet({ title, cancelText, isOpened, className, children, onClose, onCancel }: AtActionSheetProps): JSX.Element;
|
|
4
|
+
declare namespace AtActionSheet {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
title: PropTypes.Requireable<string>;
|
|
7
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
8
|
+
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
+
isOpened: PropTypes.Validator<boolean>;
|
|
10
|
+
cancelText: PropTypes.Requireable<string>;
|
|
11
|
+
};
|
|
14
12
|
}
|
|
13
|
+
export default AtActionSheet;
|
|
@@ -1,68 +1,63 @@
|
|
|
1
1
|
import classNames from "classnames";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { View } from "@tarojs/components";
|
|
5
5
|
import AtActionSheetBody from "./body/index";
|
|
6
6
|
import AtActionSheetFooter from "./footer/index";
|
|
7
7
|
import AtActionSheetHeader from "./header/index";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const { isOpened } = props;
|
|
35
|
-
this.state = {
|
|
36
|
-
_isOpened: isOpened
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
40
|
-
const { isOpened } = nextProps;
|
|
41
|
-
if (isOpened !== this.state._isOpened) {
|
|
42
|
-
this.setState({
|
|
43
|
-
_isOpened: isOpened
|
|
8
|
+
function AtActionSheet({
|
|
9
|
+
title = "",
|
|
10
|
+
cancelText = "",
|
|
11
|
+
isOpened = false,
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
onClose,
|
|
15
|
+
onCancel
|
|
16
|
+
}) {
|
|
17
|
+
const [_isOpened, setIsOpened] = useState(isOpened);
|
|
18
|
+
const prevIsOpenedPropRef = useRef(isOpened);
|
|
19
|
+
const handleClose = () => {
|
|
20
|
+
if (typeof onClose === "function") {
|
|
21
|
+
onClose();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (prevIsOpenedPropRef.current !== isOpened) {
|
|
26
|
+
setIsOpened((prev) => {
|
|
27
|
+
if (isOpened !== prev) {
|
|
28
|
+
if (!isOpened) {
|
|
29
|
+
handleClose();
|
|
30
|
+
}
|
|
31
|
+
return isOpened;
|
|
32
|
+
}
|
|
33
|
+
return prev;
|
|
44
34
|
});
|
|
45
|
-
|
|
35
|
+
prevIsOpenedPropRef.current = isOpened;
|
|
36
|
+
}
|
|
37
|
+
}, [isOpened]);
|
|
38
|
+
const close = () => {
|
|
39
|
+
setIsOpened(false);
|
|
40
|
+
handleClose();
|
|
41
|
+
};
|
|
42
|
+
const handleCancel = () => {
|
|
43
|
+
if (typeof onCancel === "function") {
|
|
44
|
+
return onCancel();
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
close();
|
|
47
|
+
};
|
|
48
|
+
const handleTouchMove = (e) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
};
|
|
52
|
+
const rootClass = classNames(
|
|
53
|
+
"at-action-sheet",
|
|
54
|
+
{
|
|
55
|
+
"at-action-sheet--active": _isOpened
|
|
56
|
+
},
|
|
57
|
+
className
|
|
58
|
+
);
|
|
59
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootClass, onTouchMove: handleTouchMove }, /* @__PURE__ */ React.createElement(View, { onClick: close, className: "at-action-sheet__overlay" }), /* @__PURE__ */ React.createElement(View, { className: "at-action-sheet__container" }, title && /* @__PURE__ */ React.createElement(AtActionSheetHeader, null, title), /* @__PURE__ */ React.createElement(AtActionSheetBody, null, children), cancelText && /* @__PURE__ */ React.createElement(AtActionSheetFooter, { onClick: handleCancel }, cancelText)));
|
|
60
60
|
}
|
|
61
|
-
AtActionSheet.defaultProps = {
|
|
62
|
-
title: "",
|
|
63
|
-
cancelText: "",
|
|
64
|
-
isOpened: false
|
|
65
|
-
};
|
|
66
61
|
AtActionSheet.propTypes = {
|
|
67
62
|
title: PropTypes.string,
|
|
68
63
|
onClose: PropTypes.func,
|
|
@@ -70,7 +65,8 @@ AtActionSheet.propTypes = {
|
|
|
70
65
|
isOpened: PropTypes.bool.isRequired,
|
|
71
66
|
cancelText: PropTypes.string
|
|
72
67
|
};
|
|
68
|
+
var action_sheet_default = AtActionSheet;
|
|
73
69
|
export {
|
|
74
|
-
|
|
70
|
+
action_sheet_default as default
|
|
75
71
|
};
|
|
76
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/action-sheet/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/action-sheet/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React, { useEffect, useRef, useState } from 'react'\nimport { View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtActionSheetProps } from '../../../types/action-sheet'\nimport AtActionSheetBody from './body/index'\nimport AtActionSheetFooter from './footer/index'\nimport AtActionSheetHeader from './header/index'\n\nfunction AtActionSheet({\n title = '',\n cancelText = '',\n isOpened = false,\n className,\n children,\n onClose,\n onCancel\n}: AtActionSheetProps): JSX.Element {\n const [_isOpened, setIsOpened] = useState(isOpened)\n const prevIsOpenedPropRef = useRef(isOpened)\n\n const handleClose = (): void => {\n if (typeof onClose === 'function') {\n onClose()\n }\n }\n\n useEffect(() => {\n if (prevIsOpenedPropRef.current !== isOpened) {\n setIsOpened(prev => {\n if (isOpened !== prev) {\n if (!isOpened) {\n handleClose()\n }\n return isOpened\n }\n return prev\n })\n prevIsOpenedPropRef.current = isOpened\n }\n }, [isOpened])\n\n const close = (): void => {\n setIsOpened(false)\n handleClose()\n }\n\n const handleCancel = (): void => {\n if (typeof onCancel === 'function') {\n return onCancel()\n }\n close()\n }\n\n const handleTouchMove = (e: CommonEvent): void => {\n e.stopPropagation()\n e.preventDefault()\n }\n\n const rootClass = classNames(\n 'at-action-sheet',\n {\n 'at-action-sheet--active': _isOpened\n },\n className\n )\n\n return (\n <View className={rootClass} onTouchMove={handleTouchMove}>\n <View onClick={close} className='at-action-sheet__overlay' />\n <View className='at-action-sheet__container'>\n {title && <AtActionSheetHeader>{title}</AtActionSheetHeader>}\n <AtActionSheetBody>{children}</AtActionSheetBody>\n {cancelText && (\n <AtActionSheetFooter onClick={handleCancel}>\n {cancelText}\n </AtActionSheetFooter>\n )}\n </View>\n </View>\n )\n}\n\nAtActionSheet.propTypes = {\n title: PropTypes.string,\n onClose: PropTypes.func,\n onCancel: PropTypes.func,\n isOpened: PropTypes.bool.isRequired,\n cancelText: PropTypes.string\n}\n\nexport default AtActionSheet\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,QAAQ,gBAAgB;AACnD,SAAS,YAAY;AAGrB,OAAO,uBAAuB;AAC9B,OAAO,yBAAyB;AAChC,OAAO,yBAAyB;AAEhC,SAAS,cAAc;AAAA,EACrB,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoC;AAClC,QAAM,CAAC,WAAW,WAAW,IAAI,SAAS,QAAQ;AAClD,QAAM,sBAAsB,OAAO,QAAQ;AAE3C,QAAM,cAAc,MAAY;AAC9B,QAAI,OAAO,YAAY,YAAY;AACjC,cAAQ;AAAA,IACV;AAAA,EACF;AAEA,YAAU,MAAM;AACd,QAAI,oBAAoB,YAAY,UAAU;AAC5C,kBAAY,UAAQ;AAClB,YAAI,aAAa,MAAM;AACrB,cAAI,CAAC,UAAU;AACb,wBAAY;AAAA,UACd;AACA,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,MACT,CAAC;AACD,0BAAoB,UAAU;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,QAAQ,MAAY;AACxB,gBAAY,KAAK;AACjB,gBAAY;AAAA,EACd;AAEA,QAAM,eAAe,MAAY;AAC/B,QAAI,OAAO,aAAa,YAAY;AAClC,aAAO,SAAS;AAAA,IAClB;AACA,UAAM;AAAA,EACR;AAEA,QAAM,kBAAkB,CAAC,MAAyB;AAChD,MAAE,gBAAgB;AAClB,MAAE,eAAe;AAAA,EACnB;AAEA,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,MACE,2BAA2B;AAAA,IAC7B;AAAA,IACA;AAAA,EACF;AAEA,SACE,oCAAC,QAAK,WAAW,WAAW,aAAa,mBACvC,oCAAC,QAAK,SAAS,OAAO,WAAU,4BAA2B,GAC3D,oCAAC,QAAK,WAAU,gCACb,SAAS,oCAAC,2BAAqB,KAAM,GACtC,oCAAC,yBAAmB,QAAS,GAC5B,cACC,oCAAC,uBAAoB,SAAS,gBAC3B,UACH,CAEJ,CACF;AAEJ;AAEA,cAAc,YAAY;AAAA,EACxB,OAAO,UAAU;AAAA,EACjB,SAAS,UAAU;AAAA,EACnB,UAAU,UAAU;AAAA,EACpB,UAAU,UAAU,KAAK;AAAA,EACzB,YAAY,UAAU;AACxB;AAEA,IAAO,uBAAQ;","names":[]}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
3
2
|
import { AtActivityIndicatorProps } from '../../../types/activity-indicator';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
declare function AtActivityIndicator({ color, size, mode, content, className, isOpened }: AtActivityIndicatorProps): JSX.Element;
|
|
4
|
+
declare namespace AtActivityIndicator {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
size: PropTypes.Requireable<number>;
|
|
7
|
+
mode: PropTypes.Requireable<string>;
|
|
8
|
+
color: PropTypes.Requireable<string>;
|
|
9
|
+
content: PropTypes.Requireable<string>;
|
|
10
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
11
|
+
isOpened: PropTypes.Requireable<boolean>;
|
|
12
|
+
};
|
|
8
13
|
}
|
|
14
|
+
export default AtActivityIndicator;
|
|
@@ -3,28 +3,24 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Text, View } from "@tarojs/components";
|
|
5
5
|
import AtLoading from "../loading/index";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
function AtActivityIndicator({
|
|
7
|
+
color = "",
|
|
8
|
+
size = 0,
|
|
9
|
+
mode = "normal",
|
|
10
|
+
content = "",
|
|
11
|
+
className = "",
|
|
12
|
+
isOpened = true
|
|
13
|
+
}) {
|
|
14
|
+
const rootClass = classNames(
|
|
15
|
+
"at-activity-indicator",
|
|
16
|
+
{
|
|
17
|
+
"at-activity-indicator--center": mode === "center",
|
|
18
|
+
"at-activity-indicator--isopened": isOpened
|
|
19
|
+
},
|
|
20
|
+
className
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootClass }, /* @__PURE__ */ React.createElement(View, { className: "at-activity-indicator__body" }, /* @__PURE__ */ React.createElement(AtLoading, { size, color })), content && /* @__PURE__ */ React.createElement(Text, { className: "at-activity-indicator__content" }, content));
|
|
19
23
|
}
|
|
20
|
-
AtActivityIndicator.defaultProps = {
|
|
21
|
-
size: 0,
|
|
22
|
-
mode: "normal",
|
|
23
|
-
color: "",
|
|
24
|
-
content: "",
|
|
25
|
-
className: "",
|
|
26
|
-
isOpened: true
|
|
27
|
-
};
|
|
28
24
|
AtActivityIndicator.propTypes = {
|
|
29
25
|
size: PropTypes.number,
|
|
30
26
|
mode: PropTypes.string,
|
|
@@ -33,7 +29,8 @@ AtActivityIndicator.propTypes = {
|
|
|
33
29
|
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
34
30
|
isOpened: PropTypes.bool
|
|
35
31
|
};
|
|
32
|
+
var activity_indicator_default = AtActivityIndicator;
|
|
36
33
|
export {
|
|
37
|
-
|
|
34
|
+
activity_indicator_default as default
|
|
38
35
|
};
|
|
39
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/activity-indicator/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/activity-indicator/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { AtActivityIndicatorProps } from '../../../types/activity-indicator'\nimport AtLoading from '../loading/index'\n\nfunction AtActivityIndicator({\n color = '',\n size = 0,\n mode = 'normal',\n content = '',\n className = '',\n isOpened = true\n}: AtActivityIndicatorProps): JSX.Element {\n const rootClass = classNames(\n 'at-activity-indicator',\n {\n 'at-activity-indicator--center': mode === 'center',\n 'at-activity-indicator--isopened': isOpened\n },\n className\n )\n\n return (\n <View className={rootClass}>\n <View className='at-activity-indicator__body'>\n <AtLoading size={size} color={color} />\n </View>\n {content && (\n <Text className='at-activity-indicator__content'>{content}</Text>\n )}\n </View>\n )\n}\n\nAtActivityIndicator.propTypes = {\n size: PropTypes.number,\n mode: PropTypes.string,\n color: PropTypes.string,\n content: PropTypes.string,\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n isOpened: PropTypes.bool\n}\n\nexport default AtActivityIndicator\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAE3B,OAAO,eAAe;AAEtB,SAAS,oBAAoB;AAAA,EAC3B,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AACb,GAA0C;AACxC,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,MACE,iCAAiC,SAAS;AAAA,MAC1C,mCAAmC;AAAA,IACrC;AAAA,IACA;AAAA,EACF;AAEA,SACE,oCAAC,QAAK,WAAW,aACf,oCAAC,QAAK,WAAU,iCACd,oCAAC,aAAU,MAAY,OAAc,CACvC,GACC,WACC,oCAAC,QAAK,WAAU,oCAAkC,OAAQ,CAE9D;AAEJ;AAEA,oBAAoB,YAAY;AAAA,EAC9B,MAAM,UAAU;AAAA,EAChB,MAAM,UAAU;AAAA,EAChB,OAAO,UAAU;AAAA,EACjB,SAAS,UAAU;AAAA,EACnB,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,UAAU,UAAU;AACtB;AAEA,IAAO,6BAAQ;","names":[]}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { AtAvatarProps } from '../../../types/avatar';
|
|
3
|
+
declare function AtAvatar({ size, circle, text, image, customStyle, className, openData }: AtAvatarProps): JSX.Element;
|
|
4
|
+
declare namespace AtAvatar {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
size: PropTypes.Requireable<string>;
|
|
7
|
+
circle: PropTypes.Requireable<boolean>;
|
|
8
|
+
text: PropTypes.Requireable<string>;
|
|
9
|
+
image: PropTypes.Requireable<string>;
|
|
10
|
+
openData: PropTypes.Requireable<object>;
|
|
11
|
+
customStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
12
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
13
|
+
};
|
|
9
14
|
}
|
|
15
|
+
export default AtAvatar;
|
|
@@ -9,50 +9,42 @@ const SIZE_CLASS = {
|
|
|
9
9
|
normal: "normal",
|
|
10
10
|
small: "small"
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
return /* @__PURE__ */ React.createElement(
|
|
39
|
-
View,
|
|
40
|
-
{
|
|
41
|
-
className: classNames(rootClassName, classObject, this.props.className),
|
|
42
|
-
style: customStyle
|
|
43
|
-
},
|
|
44
|
-
elem
|
|
45
|
-
);
|
|
12
|
+
function AtAvatar({
|
|
13
|
+
size = "normal",
|
|
14
|
+
circle = false,
|
|
15
|
+
text = "",
|
|
16
|
+
image = "",
|
|
17
|
+
customStyle = {},
|
|
18
|
+
className = "",
|
|
19
|
+
openData
|
|
20
|
+
}) {
|
|
21
|
+
const isWEAPP = Taro.getEnv() === Taro.ENV_TYPE.WEAPP;
|
|
22
|
+
const rootClassName = ["at-avatar"];
|
|
23
|
+
const iconSize = SIZE_CLASS[size || "normal"];
|
|
24
|
+
const classObject = {
|
|
25
|
+
[`at-avatar--${iconSize}`]: iconSize,
|
|
26
|
+
"at-avatar--circle": circle
|
|
27
|
+
};
|
|
28
|
+
let letter = "";
|
|
29
|
+
if (text) letter = text[0];
|
|
30
|
+
let elem;
|
|
31
|
+
if (openData && openData.type === "userAvatarUrl" && isWEAPP && Taro.canIUse("open-data")) {
|
|
32
|
+
const OpenData = TaroComponents.OpenData;
|
|
33
|
+
elem = /* @__PURE__ */ React.createElement(OpenData, { type: openData.type });
|
|
34
|
+
} else if (image) {
|
|
35
|
+
elem = /* @__PURE__ */ React.createElement(Image, { className: "at-avatar__img", src: image });
|
|
36
|
+
} else {
|
|
37
|
+
elem = /* @__PURE__ */ React.createElement(Text, { className: "at-avatar__text" }, letter);
|
|
46
38
|
}
|
|
39
|
+
return /* @__PURE__ */ React.createElement(
|
|
40
|
+
View,
|
|
41
|
+
{
|
|
42
|
+
className: classNames(rootClassName, classObject, className),
|
|
43
|
+
style: customStyle
|
|
44
|
+
},
|
|
45
|
+
elem
|
|
46
|
+
);
|
|
47
47
|
}
|
|
48
|
-
AtAvatar.defaultProps = {
|
|
49
|
-
size: "normal",
|
|
50
|
-
circle: false,
|
|
51
|
-
text: "",
|
|
52
|
-
image: "",
|
|
53
|
-
customStyle: {},
|
|
54
|
-
className: ""
|
|
55
|
-
};
|
|
56
48
|
AtAvatar.propTypes = {
|
|
57
49
|
size: PropTypes.oneOf(["large", "normal", "small"]),
|
|
58
50
|
circle: PropTypes.bool,
|
|
@@ -62,7 +54,8 @@ AtAvatar.propTypes = {
|
|
|
62
54
|
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
63
55
|
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string])
|
|
64
56
|
};
|
|
57
|
+
var avatar_default = AtAvatar;
|
|
65
58
|
export {
|
|
66
|
-
|
|
59
|
+
avatar_default as default
|
|
67
60
|
};
|
|
68
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { Image, Text, View } from '@tarojs/components'\nimport * as TaroComponents from '@tarojs/components'\nimport Taro from '@tarojs/taro'\nimport { AtAvatarProps } from '../../../types/avatar'\n\nconst SIZE_CLASS = {\n large: 'large',\n normal: 'normal',\n small: 'small'\n}\n\nfunction AtAvatar({\n size = 'normal',\n circle = false,\n text = '',\n image = '',\n customStyle = {},\n className = '',\n openData\n}: AtAvatarProps): JSX.Element {\n const isWEAPP = Taro.getEnv() === Taro.ENV_TYPE.WEAPP\n const rootClassName = ['at-avatar']\n const iconSize = SIZE_CLASS[size || 'normal']\n const classObject = {\n [`at-avatar--${iconSize}`]: iconSize,\n 'at-avatar--circle': circle\n }\n\n let letter = ''\n if (text) letter = text[0]\n\n let elem: React.ReactNode\n if (\n openData &&\n openData.type === 'userAvatarUrl' &&\n isWEAPP &&\n Taro.canIUse('open-data')\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const OpenData = (TaroComponents as any).OpenData\n elem = <OpenData type={openData.type}></OpenData>\n } else if (image) {\n elem = <Image className='at-avatar__img' src={image} />\n } else {\n elem = <Text className='at-avatar__text'>{letter}</Text>\n }\n return (\n <View\n className={classNames(rootClassName, classObject, className)}\n style={customStyle}\n >\n {elem}\n </View>\n )\n}\n\nAtAvatar.propTypes = {\n size: PropTypes.oneOf(['large', 'normal', 'small']),\n circle: PropTypes.bool,\n text: PropTypes.string,\n image: PropTypes.string,\n openData: PropTypes.object,\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string])\n}\n\nexport default AtAvatar\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,OAAO,MAAM,YAAY;AAClC,YAAY,oBAAoB;AAChC,OAAO,UAAU;AAGjB,MAAM,aAAa;AAAA,EACjB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT;AAEA,SAAS,SAAS;AAAA,EAChB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,cAAc,CAAC;AAAA,EACf,YAAY;AAAA,EACZ;AACF,GAA+B;AAC7B,QAAM,UAAU,KAAK,OAAO,MAAM,KAAK,SAAS;AAChD,QAAM,gBAAgB,CAAC,WAAW;AAClC,QAAM,WAAW,WAAW,QAAQ,QAAQ;AAC5C,QAAM,cAAc;AAAA,IAClB,CAAC,cAAc,QAAQ,EAAE,GAAG;AAAA,IAC5B,qBAAqB;AAAA,EACvB;AAEA,MAAI,SAAS;AACb,MAAI,KAAM,UAAS,KAAK,CAAC;AAEzB,MAAI;AACJ,MACE,YACA,SAAS,SAAS,mBAClB,WACA,KAAK,QAAQ,WAAW,GACxB;AAEA,UAAM,WAAY,eAAuB;AACzC,WAAO,oCAAC,YAAS,MAAM,SAAS,MAAM;AAAA,EACxC,WAAW,OAAO;AAChB,WAAO,oCAAC,SAAM,WAAU,kBAAiB,KAAK,OAAO;AAAA,EACvD,OAAO;AACL,WAAO,oCAAC,QAAK,WAAU,qBAAmB,MAAO;AAAA,EACnD;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,WAAW,eAAe,aAAa,SAAS;AAAA,MAC3D,OAAO;AAAA;AAAA,IAEN;AAAA,EACH;AAEJ;AAEA,SAAS,YAAY;AAAA,EACnB,MAAM,UAAU,MAAM,CAAC,SAAS,UAAU,OAAO,CAAC;AAAA,EAClD,QAAQ,UAAU;AAAA,EAClB,MAAM,UAAU;AAAA,EAChB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU;AAAA,EACpB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AACpE;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
3
2
|
import { AtBadgeProps } from '../../../types/badge';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
declare function AtBadge({ dot, value, maxValue, customStyle, className, children }: AtBadgeProps): JSX.Element;
|
|
4
|
+
declare namespace AtBadge {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
dot: PropTypes.Requireable<boolean>;
|
|
7
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
8
|
+
maxValue: PropTypes.Requireable<number>;
|
|
9
|
+
customStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
10
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
11
|
+
};
|
|
10
12
|
}
|
|
13
|
+
export default AtBadge;
|
|
@@ -2,42 +2,26 @@ import classNames from "classnames";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { View } from "@tarojs/components";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
formatValue(value, maxValue) {
|
|
11
|
-
if (value === "" || value === null || typeof value === "undefined")
|
|
12
|
-
return "";
|
|
13
|
-
const numValue = +value;
|
|
14
|
-
if (Number.isNaN(numValue)) {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
return numValue > maxValue ? `${maxValue}+` : numValue;
|
|
18
|
-
}
|
|
19
|
-
render() {
|
|
20
|
-
const { dot, value, maxValue = 99, customStyle } = this.props;
|
|
21
|
-
const rootClassName = ["at-badge"];
|
|
22
|
-
const val = this.formatValue(value, maxValue);
|
|
23
|
-
return /* @__PURE__ */ React.createElement(
|
|
24
|
-
View,
|
|
25
|
-
{
|
|
26
|
-
className: classNames(rootClassName, this.props.className),
|
|
27
|
-
style: customStyle
|
|
28
|
-
},
|
|
29
|
-
this.props.children,
|
|
30
|
-
dot ? /* @__PURE__ */ React.createElement(View, { className: "at-badge__dot" }) : val !== "" && /* @__PURE__ */ React.createElement(View, { className: "at-badge__num" }, val)
|
|
31
|
-
);
|
|
5
|
+
function formatValue(value, maxValue) {
|
|
6
|
+
if (value === "" || value === null || typeof value === "undefined") return "";
|
|
7
|
+
const numValue = +value;
|
|
8
|
+
if (Number.isNaN(numValue)) {
|
|
9
|
+
return value;
|
|
32
10
|
}
|
|
11
|
+
return numValue > maxValue ? `${maxValue}+` : numValue;
|
|
12
|
+
}
|
|
13
|
+
function AtBadge({
|
|
14
|
+
dot = false,
|
|
15
|
+
value = "",
|
|
16
|
+
maxValue = 99,
|
|
17
|
+
customStyle = {},
|
|
18
|
+
className = "",
|
|
19
|
+
children
|
|
20
|
+
}) {
|
|
21
|
+
const rootClassName = ["at-badge"];
|
|
22
|
+
const val = formatValue(value, maxValue);
|
|
23
|
+
return /* @__PURE__ */ React.createElement(View, { className: classNames(rootClassName, className), style: customStyle }, children, dot ? /* @__PURE__ */ React.createElement(View, { className: "at-badge__dot" }) : val !== "" && /* @__PURE__ */ React.createElement(View, { className: "at-badge__num" }, val));
|
|
33
24
|
}
|
|
34
|
-
AtBadge.defaultProps = {
|
|
35
|
-
dot: false,
|
|
36
|
-
value: "",
|
|
37
|
-
maxValue: 99,
|
|
38
|
-
customStyle: {},
|
|
39
|
-
className: ""
|
|
40
|
-
};
|
|
41
25
|
AtBadge.propTypes = {
|
|
42
26
|
dot: PropTypes.bool,
|
|
43
27
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/badge/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/badge/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { AtBadgeProps } from '../../../types/badge'\n\nfunction formatValue(\n value: string | number | undefined,\n maxValue: number\n): string | number {\n if (value === '' || value === null || typeof value === 'undefined') return ''\n const numValue = +value\n if (Number.isNaN(numValue)) {\n return value\n }\n return numValue > maxValue ? `${maxValue}+` : numValue\n}\n\nexport default function AtBadge({\n dot = false,\n value = '',\n maxValue = 99,\n customStyle = {},\n className = '',\n children\n}: AtBadgeProps): JSX.Element {\n const rootClassName = ['at-badge']\n\n const val = formatValue(value, maxValue)\n\n return (\n <View className={classNames(rootClassName, className)} style={customStyle}>\n {children}\n {dot ? (\n <View className='at-badge__dot'></View>\n ) : (\n val !== '' && <View className='at-badge__num'>{val}</View>\n )}\n </View>\n )\n}\n\nAtBadge.propTypes = {\n dot: PropTypes.bool,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n maxValue: PropTypes.number,\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string])\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,YAAY;AAGrB,SAAS,YACP,OACA,UACiB;AACjB,MAAI,UAAU,MAAM,UAAU,QAAQ,OAAO,UAAU,YAAa,QAAO;AAC3E,QAAM,WAAW,CAAC;AAClB,MAAI,OAAO,MAAM,QAAQ,GAAG;AAC1B,WAAO;AAAA,EACT;AACA,SAAO,WAAW,WAAW,GAAG,QAAQ,MAAM;AAChD;AAEe,SAAR,QAAyB;AAAA,EAC9B,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc,CAAC;AAAA,EACf,YAAY;AAAA,EACZ;AACF,GAA8B;AAC5B,QAAM,gBAAgB,CAAC,UAAU;AAEjC,QAAM,MAAM,YAAY,OAAO,QAAQ;AAEvC,SACE,oCAAC,QAAK,WAAW,WAAW,eAAe,SAAS,GAAG,OAAO,eAC3D,UACA,MACC,oCAAC,QAAK,WAAU,iBAAgB,IAEhC,QAAQ,MAAM,oCAAC,QAAK,WAAU,mBAAiB,GAAI,CAEvD;AAEJ;AAEA,QAAQ,YAAY;AAAA,EAClB,KAAK,UAAU;AAAA,EACf,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EAC/D,UAAU,UAAU;AAAA,EACpB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AACpE;","names":[]}
|