@yup/taro-ui 0.0.8 → 1.0.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.
Files changed (149) hide show
  1. package/README.md +228 -1
  2. package/es/_virtual/_rollupPluginBabelHelpers.js +3 -1
  3. package/es/components/avatar/index.d.ts +18 -0
  4. package/es/components/avatar/index.js +1 -0
  5. package/es/components/avatar/style/index.css +28 -0
  6. package/es/components/avatar/style/index.d.ts +2 -0
  7. package/es/components/avatar/style/index.js +2 -0
  8. package/es/components/button/index.d.ts +19 -3
  9. package/es/components/button/index.js +1 -1
  10. package/es/components/button/style/index.css +118 -48
  11. package/es/components/button/style/index.d.ts +1 -0
  12. package/es/components/button/style/index.js +1 -0
  13. package/es/components/checkbox/checkbox-group.d.ts +6 -2
  14. package/es/components/checkbox/checkbox-group.js +1 -1
  15. package/es/components/checkbox/index.js +1 -1
  16. package/es/components/checkbox/style/index.css +2 -24
  17. package/es/components/checkbox/style/index.d.ts +1 -0
  18. package/es/components/checkbox/style/index.js +1 -0
  19. package/es/components/city-selector/hooks/useLevel2Multiple.d.ts +24 -0
  20. package/es/components/city-selector/hooks/useLevel2Multiple.js +1 -0
  21. package/es/components/city-selector/hooks/useLevel2Single.d.ts +19 -0
  22. package/es/components/city-selector/hooks/useLevel2Single.js +1 -0
  23. package/es/components/city-selector/hooks/useMultiple.d.ts +28 -0
  24. package/es/components/city-selector/hooks/useMultiple.js +1 -0
  25. package/es/components/city-selector/hooks/useSingle.d.ts +23 -0
  26. package/es/components/city-selector/hooks/useSingle.js +1 -0
  27. package/es/components/city-selector/index.d.ts +5 -0
  28. package/es/components/city-selector/index.js +1 -0
  29. package/es/components/city-selector/style/index.css +153 -0
  30. package/es/components/city-selector/style/index.d.ts +2 -0
  31. package/es/components/city-selector/util.d.ts +2 -0
  32. package/es/components/city-selector/util.js +1 -0
  33. package/es/components/date-picker-view/index.d.ts +40 -0
  34. package/es/components/date-picker-view/index.js +1 -0
  35. package/es/components/date-picker-view/style/index.css +3 -0
  36. package/es/components/date-picker-view/style/index.d.ts +2 -0
  37. package/es/components/date-picker-view/style/index.js +2 -0
  38. package/es/components/date-picker-view/util.d.ts +7 -0
  39. package/es/components/date-picker-view/util.js +1 -0
  40. package/es/components/dialog/context.d.ts +4 -0
  41. package/es/components/dialog/index.d.ts +31 -0
  42. package/es/components/dialog/index.js +1 -0
  43. package/es/components/dialog/style/index.css +113 -0
  44. package/es/components/dialog/style/index.d.ts +2 -0
  45. package/es/components/dialog/style/index.js +2 -0
  46. package/es/components/form/form-item.js +1 -1
  47. package/es/components/form/index.js +1 -1
  48. package/es/components/form/style/index.css +0 -22
  49. package/es/components/form/style/index.d.ts +1 -0
  50. package/es/components/form/style/index.js +1 -0
  51. package/es/components/icon/index.d.ts +12 -0
  52. package/es/components/icon/index.js +1 -0
  53. package/es/components/icon/style/iconfont.css +72 -0
  54. package/es/components/icon/style/iconfont.ttf +0 -0
  55. package/es/components/icon/style/iconfont.woff +0 -0
  56. package/es/components/icon/style/iconfont.woff2 +0 -0
  57. package/es/components/icon/style/index.d.ts +1 -0
  58. package/es/components/icon/style/index.js +1 -0
  59. package/es/components/input/index.d.ts +12 -0
  60. package/es/components/input/index.js +1 -1
  61. package/es/components/input/style/index.css +33 -32
  62. package/es/components/input/style/index.d.ts +2 -0
  63. package/es/components/input/style/index.js +2 -0
  64. package/es/components/input/style/search.css +21 -0
  65. package/es/components/media-uploader/index.d.ts +123 -0
  66. package/es/components/media-uploader/index.js +1 -0
  67. package/es/components/media-uploader/style/index.css +93 -0
  68. package/es/components/media-uploader/style/index.d.ts +2 -0
  69. package/es/components/media-uploader/style/index.js +2 -0
  70. package/es/components/picker-view/index.d.ts +25 -0
  71. package/es/components/picker-view/index.js +1 -0
  72. package/es/components/picker-view/style/index.css +62 -0
  73. package/es/components/picker-view/style/index.d.ts +2 -0
  74. package/es/components/picker-view/style/index.js +2 -0
  75. package/es/components/popup/index.d.ts +62 -0
  76. package/es/components/popup/index.js +1 -0
  77. package/es/components/popup/style/index.css +91 -0
  78. package/es/components/popup/style/index.d.ts +2 -0
  79. package/es/components/popup/style/index.js +2 -0
  80. package/es/components/radio/context.d.ts +5 -0
  81. package/es/components/radio/context.js +1 -0
  82. package/es/components/radio/index.js +1 -1
  83. package/es/components/radio/radio-group.js +1 -1
  84. package/es/components/radio/style/group.css +0 -22
  85. package/es/components/radio/style/index.d.ts +1 -0
  86. package/es/components/radio/style/index.js +1 -0
  87. package/es/components/radio/style/radio.css +11 -24
  88. package/es/components/safe-area/index.d.ts +13 -0
  89. package/es/components/safe-area/index.js +1 -0
  90. package/es/components/safe-area/style/index.css +3 -0
  91. package/es/components/safe-area/style/index.d.ts +2 -0
  92. package/es/components/safe-area/style/index.js +2 -0
  93. package/es/components/safe-area/util.d.ts +5 -0
  94. package/es/components/safe-area/util.js +1 -0
  95. package/es/components/switch/index.d.ts +6 -0
  96. package/es/components/switch/index.js +1 -0
  97. package/es/components/switch/style/index.css +38 -0
  98. package/es/components/switch/style/index.d.ts +2 -0
  99. package/es/components/switch/style/index.js +2 -0
  100. package/es/components/tag/index.d.ts +18 -0
  101. package/es/components/tag/index.js +1 -0
  102. package/es/components/tag/style/index.css +92 -0
  103. package/es/components/tag/style/index.d.ts +2 -0
  104. package/es/components/tag/style/index.js +2 -0
  105. package/es/components/toast/style/index.css +0 -22
  106. package/es/components/toast/style/index.d.ts +1 -0
  107. package/es/components/toast/style/index.js +1 -0
  108. package/es/components/toast/toast.js +1 -1
  109. package/es/components/toast/withToast.js +1 -1
  110. package/es/global/global.css +21 -0
  111. package/es/global/index.d.ts +2 -1
  112. package/es/global/theme-default.css +21 -0
  113. package/es/global/variables.css +0 -0
  114. package/es/hooks/useRefState.d.ts +7 -0
  115. package/es/hooks/useRefState.js +1 -0
  116. package/es/index.d.ts +26 -0
  117. package/es/index.js +1 -1
  118. package/es/node_modules/@yup/taro-checkbox/dist/_virtual/_rollupPluginBabelHelpers.js +1 -0
  119. package/es/node_modules/@yup/taro-checkbox/dist/checkbox-group.js +1 -0
  120. package/es/node_modules/@yup/taro-checkbox/dist/context.js +1 -0
  121. package/es/node_modules/@yup/taro-checkbox/dist/index.js +1 -0
  122. package/es/node_modules/@yup/taro-form/dist/_virtual/_rollupPluginBabelHelpers.js +3 -0
  123. package/es/node_modules/@yup/taro-form/dist/context.js +1 -0
  124. package/es/node_modules/@yup/taro-form/dist/formItem.js +1 -0
  125. package/es/node_modules/@yup/taro-form/dist/fromStore.js +1 -0
  126. package/es/node_modules/@yup/taro-form/dist/index.js +1 -0
  127. package/es/node_modules/@yup/taro-form/dist/useForm.js +1 -0
  128. package/es/node_modules/@yup/taro-form/dist/useWatch.js +1 -0
  129. package/es/node_modules/@yup/taro-radio/dist/_virtual/_rollupPluginBabelHelpers.js +1 -0
  130. package/es/node_modules/@yup/taro-radio/dist/context.js +1 -0
  131. package/es/node_modules/@yup/taro-radio/dist/index.js +1 -0
  132. package/es/node_modules/@yup/taro-radio/dist/radio-group.js +1 -0
  133. package/es/style/iconfont.ttf +0 -0
  134. package/es/style/iconfont.woff +0 -0
  135. package/es/style/iconfont.woff2 +0 -0
  136. package/es/style/index.css +282 -227
  137. package/es/utils/is.js +1 -1
  138. package/package.json +16 -9
  139. package/es/_virtual/_commonjsHelpers.js +0 -1
  140. package/es/_virtual/index.js +0 -1
  141. package/es/_virtual/jsx-runtime.js +0 -1
  142. package/es/_virtual/react-jsx-runtime.development.js +0 -1
  143. package/es/_virtual/react-jsx-runtime.production.min.js +0 -1
  144. package/es/global.css +0 -22
  145. package/es/node_modules/classnames/index.js +0 -1
  146. package/es/node_modules/react/cjs/react-jsx-runtime.development.js +0 -1
  147. package/es/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -10
  148. package/es/node_modules/react/jsx-runtime.js +0 -1
  149. package/es/utils/react.d.ts +0 -2
@@ -0,0 +1,91 @@
1
+ :root,
2
+ page {
3
+ --ypmini-popup-background: #fff;
4
+ --ypmini-popup-border-radius: calc(12px * var(--ypmini-hd));
5
+ --ypmini-popup-mask-background: rgba(0, 0, 0, 0.5);
6
+ --ypmini-popup-z-index: 1000;
7
+ --ypmini-popup-duration: 300ms;
8
+ --ypmini-popup-title-font-size: var(--ypmini-font-size-large);
9
+ --ypmini-popup-title-font-color: rgba(0, 0, 0, 0.85);
10
+ --ypmini-popup-confirm-text-font-color: var(--ypmini-primary-color);
11
+ --ypmini-popup-cancel-text-font-color: rgba(0, 0, 0, 0.65);
12
+ --ypmini-popup-confirm-text-font-size: var(--ypmini-font-size-default);
13
+ --ypmini-popup-cancel-text-font-size: var(--ypmini-font-size-default);
14
+ }
15
+ .ypmini-popup-wrapper {
16
+ position: fixed;
17
+ top: 0;
18
+ left: 0;
19
+ right: 0;
20
+ bottom: 0;
21
+ z-index: var(--ypmini-popup-z-index);
22
+ pointer-events: none;
23
+ }
24
+ .ypmini-popup-wrapper-visible {
25
+ pointer-events: auto;
26
+ }
27
+ .ypmini-popup-mask {
28
+ position: absolute;
29
+ top: 0;
30
+ left: 0;
31
+ right: 0;
32
+ bottom: 0;
33
+ background: var(--ypmini-popup-mask-background);
34
+ opacity: 0;
35
+ transition: opacity var(--ypmini-popup-duration) ease;
36
+ }
37
+ .ypmini-popup-mask-visible {
38
+ opacity: 1;
39
+ }
40
+ .ypmini-popup {
41
+ position: absolute;
42
+ left: 0;
43
+ right: 0;
44
+ bottom: 0;
45
+ background: var(--ypmini-popup-background);
46
+ transform: translateY(100%);
47
+ transition: transform var(--ypmini-popup-duration) ease;
48
+ max-height: 80vh;
49
+ overflow-y: auto;
50
+ }
51
+ .ypmini-popup-visible {
52
+ transform: translateY(0);
53
+ }
54
+ .ypmini-popup-round {
55
+ border-radius: var(--ypmini-popup-border-radius) var(--ypmini-popup-border-radius) 0 0;
56
+ }
57
+ .ypmini-popup-header {
58
+ padding: 16px;
59
+ display: flex;
60
+ max-width: 100%;
61
+ align-items: center;
62
+ justify-content: space-between;
63
+ }
64
+ .ypmini-popup-header-cancel {
65
+ color: var(--ypmini-popup-cancel-text-font-color);
66
+ font-weight: 400;
67
+ font-size: var(--ypmini-popup-cancel-text-fontsize);
68
+ flex: 0 0 56px;
69
+ white-space: nowrap;
70
+ text-align: left;
71
+ }
72
+ .ypmini-popup-header-title {
73
+ flex: 1;
74
+ text-align: center;
75
+ color: var(--ypmini-popup-title-font-color);
76
+ font-weight: 500;
77
+ font-size: var(--ypmini-font-size-large);
78
+ margin-left: 44px;
79
+ margin-right: 44px;
80
+ white-space: nowrap;
81
+ overflow: hidden;
82
+ text-overflow: ellipsis;
83
+ }
84
+ .ypmini-popup-header-confirm {
85
+ color: var(--ypmini-popup-confirm-text-font-color);
86
+ font-weight: 400;
87
+ font-size: var(--ypmini-popup-confirm-text-fontsize);
88
+ flex: 0 0 56px;
89
+ white-space: nowrap;
90
+ text-align: right;
91
+ }
@@ -0,0 +1,2 @@
1
+ import '../../../global/theme-default.less';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../../../global/theme-default.css';
2
+ import './index.css';
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const RadioContext: React.Context<{
3
+ type?: "button" | "default";
4
+ }>;
5
+ export default RadioContext;
@@ -0,0 +1 @@
1
+ import t from"react";var e=t.createContext({});export{e as default};
@@ -1 +1 @@
1
- import{objectWithoutProperties as o,objectSpread2 as r}from"../../_virtual/_rollupPluginBabelHelpers.js";import{j as t}from"../../node_modules/react/jsx-runtime.js";import{View as i}from"@tarojs/components";import e from"../../node_modules/classnames/index.js";import n from"@yup/taro-radio";import a from"./radio-group.js";var s=["children","type"],m=function(a){var m=a.children,p=a.type,u=void 0===p?"button":p,d=o(a,s);return t.jsx(n,r({className:e("ypmini-taro-radio",{"ypmini-taro-radio-button":"button"===u}),icon:function(o){return t.jsx(i,{className:e("ypmini-taro-radio-button-inner",{"ypmini-taro-radio-button-inner-checked":o}),children:m})}},d))};m.Group=a;export{m as default};
1
+ import{objectWithoutProperties as r,objectSpread2 as o}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as t}from"react/jsx-runtime";import{View as i}from"@tarojs/components";import e from"classnames";import a from"react";import n from"../../node_modules/@yup/taro-radio/dist/index.js";import m from"./radio-group.js";import d from"./context.js";var p=["children","type"],u=function(m){var u=m.children,s=m.type,c=void 0===s?"button":s,l=r(m,p),f=a.useContext(d).type;return t(n,o({className:e("ypmini-taro-radio",{"ypmini-taro-radio-default":"default"===(f||c),"ypmini-taro-radio-button":"button"===(f||c)}),icon:function(r){return t(i,"default"===c?{className:e("ypmini-taro-radio-default-inner",{"ypmini-taro-radio-default-inner-checked":r}),children:u}:{className:e("ypmini-taro-radio-button-inner",{"ypmini-taro-radio-button-inner-checked":r}),children:u})}},l))};u.Group=m;export{u as default};
@@ -1 +1 @@
1
- import{objectWithoutProperties as o,objectSpread2 as r}from"../../_virtual/_rollupPluginBabelHelpers.js";import{j as e}from"../../node_modules/react/jsx-runtime.js";import i from"../../node_modules/classnames/index.js";import t from"@yup/taro-radio";var a=["children","type","block"],p=function(p){var s=p.children,l=p.type,n=p.block,u=void 0!==n&&n,m=o(p,a);return e.jsx(t.Group,r(r({className:i("ypmini-radio-group",{"ypmini-radio-group-button":"button"===l,"ypmini-radio-group-block":u})},m),{},{children:s}))};export{p as default};
1
+ import{objectWithoutProperties as r,objectSpread2 as o}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as i}from"react/jsx-runtime";import e from"classnames";import t from"../../node_modules/@yup/taro-radio/dist/index.js";import p from"./context.js";var a=["children","type","block"],l=function(l){var n=l.children,m=l.type,u=l.block,d=void 0!==u&&u,s=r(l,a);return i(p.Provider,{value:{type:m},children:i(t.Group,o(o({className:e("ypmini-radio-group",{"ypmini-radio-group-button":"button"===m,"ypmini-radio-group-block":d})},s),{},{children:n}))})};export{l as default};
@@ -1,25 +1,3 @@
1
- :root,
2
- page {
3
- --ypmini-hd: 2;
4
- --yp-color-primary: #0092ff;
5
- --yp-color-text: rgba(0, 0, 0, 0.85);
6
- --yp-color-text-light: #0092ff;
7
- --yp-color-text-weak: rgba(0, 0, 0, 0.45);
8
- --yp-border-color: #e9edf3;
9
- --yp-color-text-primary: #333;
10
- --yp-color-text-link: var(--yp-color-primary);
11
- --yp-color-text-secondary: #666;
12
- --yp-color-text-disabled: #ccc;
13
- --yp-color-text-placeholder: #999;
14
- --yp-font-size-default: calc(17px * var(--ypmini-hd));
15
- --yp-radio-circle-checked-color: var(--yp-color-primary);
16
- --yp-radio-button-checked-color: var(--yp-color-primary);
17
- --yp-checkbox-circle-checked-color: var(--yp-color-primary);
18
- --yp-checkbox-button-checked-color: var(--yp-color-primary);
19
- --yp-border-radius-base: calc(4px * var(--ypmini-hd));
20
- --yp-border-radius-button: calc(8px * var(--ypmini-hd));
21
- --yp-space-horizontal-base: calc(12px * var(--ypmini-hd));
22
- }
23
1
  .ypmini-radio-group {
24
2
  display: flex;
25
3
  width: 100%;
@@ -1,2 +1,3 @@
1
+ import '../../../global/theme-default.less';
1
2
  import './radio.less';
2
3
  import './group.less';
@@ -1,2 +1,3 @@
1
+ import '../../../global/theme-default.css';
1
2
  import './radio.css';
2
3
  import './group.css';
@@ -1,35 +1,22 @@
1
1
  :root,
2
- page {
3
- --ypmini-hd: 2;
4
- --yp-color-primary: #0092ff;
5
- --yp-color-text: rgba(0, 0, 0, 0.85);
6
- --yp-color-text-light: #0092ff;
7
- --yp-color-text-weak: rgba(0, 0, 0, 0.45);
8
- --yp-border-color: #e9edf3;
9
- --yp-color-text-primary: #333;
10
- --yp-color-text-link: var(--yp-color-primary);
11
- --yp-color-text-secondary: #666;
12
- --yp-color-text-disabled: #ccc;
13
- --yp-color-text-placeholder: #999;
14
- --yp-font-size-default: calc(17px * var(--ypmini-hd));
15
- --yp-radio-circle-checked-color: var(--yp-color-primary);
16
- --yp-radio-button-checked-color: var(--yp-color-primary);
17
- --yp-checkbox-circle-checked-color: var(--yp-color-primary);
18
- --yp-checkbox-button-checked-color: var(--yp-color-primary);
19
- --yp-border-radius-base: calc(4px * var(--ypmini-hd));
20
- --yp-border-radius-button: calc(8px * var(--ypmini-hd));
21
- --yp-space-horizontal-base: calc(12px * var(--ypmini-hd));
22
- }
23
- :root,
24
2
  page {
25
3
  --radio-button-font-size: calc(17px * var(--ypmini-hd));
26
4
  --radio-button-border-radius: calc(8px * var(--ypmini-hd));
27
5
  --radio-button-background-color: #f5f7fc;
28
6
  --radio-button-text-color: #000000d9;
29
7
  --radio-button-checked-background-color: #e0f3ff;
30
- --radio-button-checked-text-color: var(--yp-color-primary);
31
- --radio-button-checked-border-color: var(--yp-color-primary);
8
+ --radio-button-checked-text-color: var(--ypmini-primary-color);
9
+ --radio-button-checked-border-color: var(--ypmini-primary-color);
32
10
  --radio-button-height: calc(52px * var(--ypmini-hd));
11
+ --radio-default-size: calc(16px * var(--ypmini-hd));
12
+ }
13
+ .ypmini-taro-radio-default-inner {
14
+ width: var(--radio-default-size);
15
+ height: var(--radio-default-size);
16
+ border-radius: 100%;
17
+ }
18
+ .ypmini-taro-radio-default-inner-checked::before {
19
+ content: "☑️";
33
20
  }
34
21
  .ypmini-taro-radio-button-inner {
35
22
  background-color: var(--radio-button-background-color);
@@ -0,0 +1,13 @@
1
+ import { ViewProps } from '@tarojs/components';
2
+ import React from 'react';
3
+ export interface SafeAreaProps extends ViewProps {
4
+ /**
5
+ * 安全距离位置 top 顶部,bottom 底部
6
+ */
7
+ position?: 'top' | 'bottom';
8
+ }
9
+ /**
10
+ * 安全区域组件 用于安全区域占位
11
+ */
12
+ declare const SafeArea: React.FC<SafeAreaProps>;
13
+ export default SafeArea;
@@ -0,0 +1 @@
1
+ import{objectWithoutProperties as t,slicedToArray as o,objectSpread2 as r}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as e}from"react/jsx-runtime";import{View as a}from"@tarojs/components";import{useState as i,useEffect as s}from"react";import m from"classnames";import{getSystemInfo as p}from"./util.js";var l=["position","className","style","children"],n=function(n){var c=n.position,d=void 0===c?"bottom":c,f=n.className,u=n.style,b=n.children,h=t(n,l),j=i({top:0,bottom:0}),v=o(j,2),g=v[0],y=v[1];return s(function(){var t=p(),o=t.bottomSafeAreaHeight,r=t.statusBarHeight;y({top:r,bottom:o})},[]),e(a,r(r({className:m("ypmini-safe-area-view",f),style:r({paddingTop:"top"===d?g.top:0,paddingBottom:"bottom"===d?g.bottom:0},u)},h),{},{children:b}))};export{n as default};
@@ -0,0 +1,3 @@
1
+ .ypmini-safe-area-view {
2
+ box-sizing: border-box;
3
+ }
@@ -0,0 +1,2 @@
1
+ import '../../../global/theme-default.less';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../../../global/theme-default.css';
2
+ import './index.css';
@@ -0,0 +1,5 @@
1
+ export declare const getSystemInfo: () => {
2
+ /** 顶部距离 */
3
+ statusBarHeight: number;
4
+ bottomSafeAreaHeight: number;
5
+ };
@@ -0,0 +1 @@
1
+ import t from"@tarojs/taro";var e=function(){try{var e,a=null==t||null===(e=t.getSystemInfoSync)||void 0===e?void 0:e.call(t);return{statusBarHeight:a.statusBarHeight||0,bottomSafeAreaHeight:null!=a&&a.safeArea&&a.safeArea.bottom>0?a.screenHeight-a.safeArea.bottom:0}}catch(t){return{statusBarHeight:0,bottomSafeAreaHeight:0}}};export{e as getSystemInfo};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { SwitchProps as TaroSwitchProps } from '@tarojs/components';
3
+ export interface SwitchProps extends TaroSwitchProps {
4
+ }
5
+ declare const Switch: React.FC<SwitchProps>;
6
+ export default Switch;
@@ -0,0 +1 @@
1
+ import{objectWithoutProperties as r,objectSpread2 as a}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as o}from"react/jsx-runtime";import s from"classnames";import{Switch as t}from"@tarojs/components";var e=["className"],m=function(m){var i=m.className,c=r(m,e);return o(t,a({className:s("ypmini-switch",i),color:"#0092ff"},c))};export{m as default};
@@ -0,0 +1,38 @@
1
+ :root,
2
+ page {
3
+ --ypmini-witch-defalt-background-color: #e9edf3;
4
+ --ypmini-switch-inner-size: calc(var(--ypmini-hd) * 16px);
5
+ --yomini-switch-border-radius: calc(var(--ypmini-hd) * 12px);
6
+ --yomini-switch-width: calc(var(--ypmini-hd) * 24px);
7
+ --yomini-switch-height: calc(var(--ypmini-hd) * 48px);
8
+ }
9
+ .ypmini-switch {
10
+ height: var(--yomini-switch-width);
11
+ width: var(--yomini-switch-height);
12
+ border-radius: var(--yomini-switch-border-radius);
13
+ }
14
+ .ypmini-switch .weui-switch {
15
+ height: var(--yomini-switch-width);
16
+ width: var(--yomini-switch-height);
17
+ border-radius: var(--yomini-switch-border-radius);
18
+ }
19
+ .ypmini-switch .weui-switch:checked {
20
+ background-color: var(--ypmini-primary-color);
21
+ }
22
+ .ypmini-switch .weui-switch:checked:after {
23
+ transform: translate(46px);
24
+ }
25
+ .ypmini-switch .weui-switch::before,
26
+ .ypmini-switch .weui-switch::after {
27
+ width: var(--ypmini-switch-inner-size);
28
+ height: var(--ypmini-switch-inner-size);
29
+ border-radius: var(--ypmini-switch-inner-size);
30
+ left: 8px;
31
+ }
32
+ .ypmini-switch .weui-switch:before {
33
+ display: none;
34
+ background-color: var(--ypmini-witch-defalt-background-color);
35
+ }
36
+ .ypmini-switch .weui-switch::after {
37
+ top: 6px;
38
+ }
@@ -0,0 +1,2 @@
1
+ import '../../../global/theme-default.less';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../../../global/theme-default.css';
2
+ import './index.css';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { ViewProps } from '@tarojs/components';
3
+ export interface TagProps extends ViewProps {
4
+ /**
5
+ * 颜色类型
6
+ */
7
+ color?: 'default' | 'primary' | 'warning' | 'success';
8
+ /**
9
+ * 大小规格
10
+ */
11
+ size?: 'default' | 'small';
12
+ /**
13
+ * 填充样式 outlined 外边框填充, solid 无外边框
14
+ */
15
+ variant?: "outlined" | 'solid';
16
+ }
17
+ declare const Tag: React.FC<TagProps>;
18
+ export default Tag;
@@ -0,0 +1 @@
1
+ import{objectWithoutProperties as a,objectSpread2 as i}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as t}from"react/jsx-runtime";import o from"classnames";import{View as r}from"@tarojs/components";var e=["color","variant","size","className","children"],c=function(c){var n=c.color,s=void 0===n?"default":n,l=c.variant,m=void 0===l?"solid":l,p=c.size,d=void 0===p?"default":p,u=c.className,f=c.children,v=a(c,e);return t(r,i(i({className:o("ypmini-tag","ypmini-tag-".concat(s),"ypmini-tag-".concat(m),"ypmini-tag-".concat(s,"--").concat(m),"ypmini-tag-size-".concat(d),u)},v),{},{children:f}))};export{c as default};
@@ -0,0 +1,92 @@
1
+ page,
2
+ :root {
3
+ --ypmini-tag-size-default-height: calc(var(--ypmini-hd) * 22px);
4
+ --ypmini-tag-size-default-font-size: calc(var(--ypmini-hd) * 12px);
5
+ --ypmini-tag-size-small-height: calc(var(--ypmini-hd) * 18px);
6
+ --ypmini-tag-size-small-font-size: calc(var(--ypmini-hd) * 12px);
7
+ --ypmini-tag-default-background-color: #f5f7fc;
8
+ --ypmini-tag-primary-background-color: var(--ypmini-primary-secondary-color);
9
+ --ypmini-tag-success-background-color: #dff2ec;
10
+ --ypmini-tag-warning-background-color: #ffebec;
11
+ --ypmini-tag-default-font-color: rgba(0, 0, 0, 0.65);
12
+ --ypmini-tag-primary-font-color: var(--ypmini-primary-color);
13
+ --ypmini-tag-success-font-color: #06b578;
14
+ --ypmini-tag-warning-font-color: #e8362e;
15
+ --ypmini-tag-default-font-size: calc(var(--ypmini-hd) * 12px);
16
+ --ypmini-tag-small-font-size: calc(var(--ypmini-hd) * 10px);
17
+ }
18
+ .ypmini-tag {
19
+ display: inline-flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ height: var(--ypmini-tag-size-default-height);
23
+ padding: 0px 12px;
24
+ font-weight: 400;
25
+ border-radius: 8px;
26
+ font-size: var(--ypmini-tag-size-default-font-size);
27
+ }
28
+ .ypmini-tag-size-default {
29
+ padding: 0px 12px;
30
+ font-size: var(--ypmini-tag-size-default-font-size);
31
+ height: var(--ypmini-tag-size-default-height);
32
+ }
33
+ .ypmini-tag-size-small {
34
+ padding: 0px 8px;
35
+ font-size: var(--ypmini-tag-size-small-font-size);
36
+ height: var(--ypmini-tag-size-small-height);
37
+ }
38
+ .ypmini-tag-outlined {
39
+ box-sizing: border-box;
40
+ }
41
+ .ypmini-tag-default {
42
+ background: var(--ypmini-tag-default-background-color);
43
+ color: var(--ypmini-tag-default-font-color);
44
+ }
45
+ .ypmini-tag-default--outlined {
46
+ --ypmini-tag-default-outlined-border-color: var(--ypmini-tag-default-font-color);
47
+ border: 1px solid var(--ypmini-tag-default-outlined-border-color);
48
+ }
49
+ .ypmini-tag-default--solid {
50
+ border: unset;
51
+ background: var(--ypmini-tag-default-background-color);
52
+ color: var(--ypmini-tag-default-font-color);
53
+ }
54
+ .ypmini-tag-primary {
55
+ background: var(--ypmini-tag-primary-background-color);
56
+ color: var(--ypmini-tag-primary-font-color);
57
+ }
58
+ .ypmini-tag-primary--outlined {
59
+ --ypmini-tag-primary-outlined-border-color: var(--ypmini-tag-primary-font-color);
60
+ border: 1px solid var(--ypmini-tag-primary-outlined-border-color);
61
+ }
62
+ .ypmini-tag-primary--solid {
63
+ border: unset;
64
+ background: var(--ypmini-tag-primary-background-color);
65
+ color: var(--ypmini-tag-primary-font-color);
66
+ }
67
+ .ypmini-tag-warning {
68
+ background: var(--ypmini-tag-warning-background-color);
69
+ color: var(--ypmini-tag-warning-font-color);
70
+ }
71
+ .ypmini-tag-warning--outlined {
72
+ --ypmini-tag-warning-outlined-border-color: var(--ypmini-tag-warning-font-color);
73
+ border: 1px solid var(--ypmini-tag-warning-outlined-border-color);
74
+ }
75
+ .ypmini-tag-warning--solid {
76
+ border: unset;
77
+ background: var(--ypmini-tag-warning-background-color);
78
+ color: var(--ypmini-tag-warning-font-color);
79
+ }
80
+ .ypmini-tag-success {
81
+ background: var(--ypmini-tag-success-background-color);
82
+ color: var(--ypmini-tag-success-font-color);
83
+ }
84
+ .ypmini-tag-success--outlined {
85
+ --ypmini-tag-success-outlined-border-color: var(--ypmini-tag-success-font-color);
86
+ border: 1px solid var(--ypmini-tag-success-outlined-border-color);
87
+ }
88
+ .ypmini-tag-success--solid {
89
+ border: unset;
90
+ background: var(--ypmini-tag-success-background-color);
91
+ color: var(--ypmini-tag-success-font-color);
92
+ }
@@ -0,0 +1,2 @@
1
+ import '../../../global/theme-default.less';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../../../global/theme-default.css';
2
+ import './index.css';
@@ -1,26 +1,4 @@
1
1
  :root,
2
- page {
3
- --ypmini-hd: 2;
4
- --yp-color-primary: #0092ff;
5
- --yp-color-text: rgba(0, 0, 0, 0.85);
6
- --yp-color-text-light: #0092ff;
7
- --yp-color-text-weak: rgba(0, 0, 0, 0.45);
8
- --yp-border-color: #e9edf3;
9
- --yp-color-text-primary: #333;
10
- --yp-color-text-link: var(--yp-color-primary);
11
- --yp-color-text-secondary: #666;
12
- --yp-color-text-disabled: #ccc;
13
- --yp-color-text-placeholder: #999;
14
- --yp-font-size-default: calc(17px * var(--ypmini-hd));
15
- --yp-radio-circle-checked-color: var(--yp-color-primary);
16
- --yp-radio-button-checked-color: var(--yp-color-primary);
17
- --yp-checkbox-circle-checked-color: var(--yp-color-primary);
18
- --yp-checkbox-button-checked-color: var(--yp-color-primary);
19
- --yp-border-radius-base: calc(4px * var(--ypmini-hd));
20
- --yp-border-radius-button: calc(8px * var(--ypmini-hd));
21
- --yp-space-horizontal-base: calc(12px * var(--ypmini-hd));
22
- }
23
- :root,
24
2
  page {
25
3
  --toast-z-index: 9999;
26
4
  }
@@ -1 +1,2 @@
1
+ import '../../../global/theme-default.less';
1
2
  import './index.less';
@@ -1 +1,2 @@
1
+ import '../../../global/theme-default.css';
1
2
  import './index.css';
@@ -1 +1 @@
1
- import{slicedToArray as r,objectWithoutProperties as e,objectSpread2 as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import{j as n}from"../../node_modules/react/jsx-runtime.js";import o,{useState as i}from"react";import{View as a,Text as u}from"@tarojs/components";import s from"../../node_modules/classnames/index.js";import{isNumber as l}from"../../utils/is.js";var c=["content","duration"],f=["className"],m={},d=o.forwardRef(function(m,d){var v=i(!1),p=r(v,2),j=p[0],h=p[1],x=i(""),T=r(x,2),w=T[0],y=T[1],N=o.useState(),R=r(N,2),_=R[0],b=R[1],g=o.useRef(2e3),H=o.useRef(null);if(o.useImperativeHandle(d,function(){return{show:function(r){if("string"==typeof r)y(r);else{var t=r.content,n=r.duration,o=void 0===n?2e3:n,i=e(r,c);l(o)&&(g.current=o),b(i),y(t)}H.current&&clearTimeout(H.current),h(!0);var a=setTimeout(function(){h(!1)},g.current);H.current=a},hide:function(){clearTimeout(H.current),h(!1)}}}),!j)return null;var P=_||{},S=P.className,W=e(P,f);return n.jsx(a,t(t({className:s("ypmini-toast-container",S)},W),{},{children:n.jsx(u,{className:"ypmini-toast-content",children:w})}))});var v={createToast:function(){var r;if(null===(r=m)||void 0===r||!r.ref){var e=o.createRef();m={ref:e,ToastWrapper:function(){return n.jsx(d,{ref:e})}}}return m},show:function(r){var e;null===(e=m)||void 0===e||null===(e=e.ref)||void 0===e||null===(e=e.current)||void 0===e||e.show(r)},hide:function(){var r;null===(r=m)||void 0===r||null===(r=r.ref)||void 0===r||null===(r=r.current)||void 0===r||r.hide()}};export{v as default};
1
+ import{slicedToArray as r,objectWithoutProperties as e,objectSpread2 as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as n}from"react/jsx-runtime";import o,{useState as i}from"react";import{View as a,Text as u}from"@tarojs/components";import s from"classnames";import{isNumber as c}from"../../utils/is.js";var l=["content","duration"],f=["className"],m={},d=o.forwardRef(function(m,d){var v=i(!1),p=r(v,2),h=p[0],j=p[1],T=i(""),w=r(T,2),y=w[0],N=w[1],R=o.useState(),b=r(R,2),g=b[0],x=b[1],H=o.useRef(2e3),P=o.useRef(null);if(o.useImperativeHandle(d,function(){return{show:function(r){if("string"==typeof r)N(r);else{var t=r.content,n=r.duration,o=void 0===n?2e3:n,i=e(r,l);c(o)&&(H.current=o),x(i),N(t)}P.current&&clearTimeout(P.current),j(!0);var a=setTimeout(function(){j(!1)},H.current);P.current=a},hide:function(){clearTimeout(P.current),j(!1)}}}),!h)return null;var S=g||{},W=S.className,_=e(S,f);return n(a,t(t({className:s("ypmini-toast-container",W)},_),{},{children:n(u,{className:"ypmini-toast-content",children:y})}))});var v={createToast:function(){var r;if(null===(r=m)||void 0===r||!r.ref){var e=o.createRef();m={ref:e,ToastWrapper:function(){return n(d,{ref:e})}}}return m},show:function(r){var e;null===(e=m)||void 0===e||null===(e=e.ref)||void 0===e||null===(e=e.current)||void 0===e||e.show(r)},hide:function(){var r;null===(r=m)||void 0===r||null===(r=r.ref)||void 0===r||null===(r=r.current)||void 0===r||r.hide()}};export{v as default};
@@ -1 +1 @@
1
- import{objectSpread2 as r}from"../../_virtual/_rollupPluginBabelHelpers.js";import{j as t}from"../../node_modules/react/jsx-runtime.js";import e from"./toast.js";function o(o){var s=e.createToast().ToastWrapper;return function(e){return t.jsxs(t.Fragment,{children:[t.jsx(s,{}),t.jsx(o,r({},e))]})}}export{o as default};
1
+ import{objectSpread2 as r}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import a from"./toast.js";function i(i){var n=a.createToast().ToastWrapper;return function(a){return t(e,{children:[o(n,{}),o(i,r({},a))]})}}export{i as default};
@@ -0,0 +1,21 @@
1
+ :root,
2
+ page {
3
+ --ypmini-hd: 2;
4
+ --ypmini-primary-color: #0092ff;
5
+ --ypmini-primary-secondary-color: #e0f3ff;
6
+ --ypmini-color-text: rgba(0, 0, 0, 0.85);
7
+ --ypmini-color-text-light: var(--ypmini-primary-color);
8
+ --ypmini-color-text-weak: rgba(0, 0, 0, 0.45);
9
+ --ypmini-color-text-primary: #333;
10
+ --ypmini-color-text-link: var(--ypmini-primary-color);
11
+ --ypmini-color-text-secondary: #666;
12
+ --ypmini-color-text-disabled: #ccc;
13
+ --ypmini-color-text-placeholder: #00000040;
14
+ --ypmini-border-color: #e9edf3;
15
+ --ypmini-font-size-max: calc(19px * var(--ypmini-hd));
16
+ --ypmini-font-size-large: calc(17px * var(--ypmini-hd));
17
+ --ypmini-font-size-default: calc(15px * var(--ypmini-hd));
18
+ --ypmini-font-size-middle: calc(14px * var(--ypmini-hd));
19
+ --ypmini-font-size-mini: calc(13px * var(--ypmini-hd));
20
+ --ypmini-mask-background: rgba(0, 0, 0, 0.65);
21
+ }
@@ -1 +1,2 @@
1
- import './global.less';
1
+ import './variables.less';
2
+ import './theme-default.less';
@@ -0,0 +1,21 @@
1
+ :root,
2
+ page {
3
+ --ypmini-hd: 2;
4
+ --ypmini-primary-color: #0092ff;
5
+ --ypmini-primary-secondary-color: #e0f3ff;
6
+ --ypmini-color-text: rgba(0, 0, 0, 0.85);
7
+ --ypmini-color-text-light: var(--ypmini-primary-color);
8
+ --ypmini-color-text-weak: rgba(0, 0, 0, 0.45);
9
+ --ypmini-color-text-primary: #333;
10
+ --ypmini-color-text-link: var(--ypmini-primary-color);
11
+ --ypmini-color-text-secondary: #666;
12
+ --ypmini-color-text-disabled: #ccc;
13
+ --ypmini-color-text-placeholder: #00000040;
14
+ --ypmini-border-color: #e9edf3;
15
+ --ypmini-font-size-max: calc(19px * var(--ypmini-hd));
16
+ --ypmini-font-size-large: calc(17px * var(--ypmini-hd));
17
+ --ypmini-font-size-default: calc(15px * var(--ypmini-hd));
18
+ --ypmini-font-size-middle: calc(14px * var(--ypmini-hd));
19
+ --ypmini-font-size-mini: calc(13px * var(--ypmini-hd));
20
+ --ypmini-mask-background: rgba(0, 0, 0, 0.65);
21
+ }
File without changes
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ declare function useRefState<T = any>(initialValue: T | ((prev: T) => T)): [
3
+ state: T,
4
+ setCustomState: (newValue: T | ((v: T) => T)) => void,
5
+ stateRef: React.MutableRefObject<T>
6
+ ];
7
+ export default useRefState;
@@ -0,0 +1 @@
1
+ import{slicedToArray as r}from"../_virtual/_rollupPluginBabelHelpers.js";import e from"react";function t(t){var u=e.useState(t),n=r(u,2),o=n[0],a=n[1],c=e.useRef(o);return[o,function(r){var e=r;"function"==typeof r&&(e=r(c.current)),e!==c.current&&(c.current=e,a(r))},c]}export{t as default};
package/es/index.d.ts CHANGED
@@ -4,3 +4,29 @@ export { default as Input } from './components/input';
4
4
  export { default as Radio } from './components/radio';
5
5
  export { default as Form } from './components/form';
6
6
  export { default as Toast } from './components/toast';
7
+ export { default as Icon } from './components/icon';
8
+ export { default as PickerView } from './components/picker-view';
9
+ export { default as DatePickerView } from './components/date-picker-view';
10
+ export { default as Switch } from './components/switch';
11
+ export { default as Popup } from './components/popup';
12
+ export { default as SafeArea } from './components/safe-area';
13
+ export { default as MediaUploader } from './components/media-uploader';
14
+ export { default as Dialog } from './components/dialog';
15
+ export { default as CitySelector } from './components/city-selector';
16
+ export { default as Tag } from './components/tag';
17
+ export { default as Avatar } from './components/avatar';
18
+ export type * from './components/media-uploader';
19
+ export type * from './components/dialog';
20
+ export type * from './components/button';
21
+ export type * from './components/popup';
22
+ export type * from './components/date-picker-view';
23
+ export type * from './components/picker-view';
24
+ export type * from './components/form';
25
+ export type * from './components/radio';
26
+ export type * from './components/input';
27
+ export type * from './components/checkbox';
28
+ export type * from './components/icon';
29
+ export type * from './components/switch';
30
+ export type * from './components/city-selector';
31
+ export type * from './components/tag';
32
+ export type * from './components/avatar';
package/es/index.js CHANGED
@@ -1 +1 @@
1
- import"./global.css";export{default as Button}from"./components/button/index.js";export{default as Checkbox}from"./components/checkbox/index.js";export{default as Input}from"./components/input/index.js";export{default as Radio}from"./components/radio/index.js";export{default as Form}from"./components/form/index.js";import"./components/toast/index.js";export{default as Toast}from"./components/toast/toast.js";
1
+ export{default as Button}from"./components/button/index.js";export{default as Checkbox}from"./components/checkbox/index.js";export{default as Input}from"./components/input/index.js";export{default as Radio}from"./components/radio/index.js";export{default as Form}from"./components/form/index.js";import"./components/toast/index.js";export{default as Icon}from"./components/icon/index.js";export{default as PickerView}from"./components/picker-view/index.js";export{default as DatePickerView}from"./components/date-picker-view/index.js";export{default as Switch}from"./components/switch/index.js";export{default as Popup}from"./components/popup/index.js";export{default as SafeArea}from"./components/safe-area/index.js";export{default as MediaUploader}from"./components/media-uploader/index.js";export{default as Dialog}from"./components/dialog/index.js";export{default as CitySelector}from"./components/city-selector/index.js";export{default as Tag}from"./components/tag/index.js";export{default as Avatar}from"./components/avatar/index.js";export{default as Toast}from"./components/toast/toast.js";
@@ -0,0 +1 @@
1
+ function r(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}function t(r){if(Array.isArray(r))return r}function e(t){if(Array.isArray(t))return r(t)}function n(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function o(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=a.call(e)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(r){s=!0,o=r}finally{try{if(!u&&null!=e.return&&(i=e.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(r,t){if(null==r)return{};var e,n,o=u(r,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(n=0;n<a.length;n++)e=a[n],-1===t.indexOf(e)&&{}.propertyIsEnumerable.call(r,e)&&(o[e]=r[e])}return o}function u(r,t){if(null==r)return{};var e={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==t.indexOf(n))continue;e[n]=r[n]}return e}function s(r,e){return t(r)||o(r,e)||y(r,e)||a()}function f(r){return e(r)||n(r)||y(r)||i()}function y(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}export{r as arrayLikeToArray,t as arrayWithHoles,e as arrayWithoutHoles,n as iterableToArray,o as iterableToArrayLimit,a as nonIterableRest,i as nonIterableSpread,l as objectWithoutProperties,u as objectWithoutPropertiesLoose,s as slicedToArray,f as toConsumableArray,y as unsupportedIterableToArray};
@@ -0,0 +1 @@
1
+ import{slicedToArray as e,toConsumableArray as o}from"./_virtual/_rollupPluginBabelHelpers.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.set.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/web.dom-collections.iterator.js";import r from"react";import s from"classnames";import{View as t}from"@tarojs/components";import{CheckboxGroupContext as a}from"./context.js";var c=function(c){var l=c.value,i=c.disabled,m=c.children,n=c.className,u=c.block,p=c.onChange,d=r.useState(l||[]),j=e(d,2),b=j[0],f=j[1];return r.createElement(a.Provider,{value:{value:b,onCheckboxChange:function(e,r){if(!i){if(e){var s=o(new Set([].concat(o(b),[r])));return f(s),void(p&&p(s))}var t=b.filter(function(e){return e!==r});f(t),p&&p(t)}},disabled:i,block:u}},r.createElement(t,{className:s("yp-checkbox-group",{"yp-checkbox-group-disabled":i,"yp-checkbox-group-block":u},n)},m))};c.displayName="CheckboxGroup";export{c as default};
@@ -0,0 +1 @@
1
+ import r from"react";var t=r.createContext({});export{t as CheckboxGroupContext};
@@ -0,0 +1 @@
1
+ import{objectWithoutProperties as e,slicedToArray as o}from"./_virtual/_rollupPluginBabelHelpers.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import c from"react";import s from"classnames";import{View as r}from"@tarojs/components";import{CheckboxGroupContext as a}from"./context.js";import l from"./checkbox-group.js";var i=["icon","checked","value","disabled","children","onChange","className","block"],t=function(l){var t=l.icon,n=l.checked,d=void 0!==n&&n,m=l.value,u=l.disabled,p=l.children,b=l.onChange,h=l.className,k=l.block,f=e(l,i),x=c.useContext(a),j=x.value,v=x.onCheckboxChange,y=x.disabled,C=x.block,g=c.useState(d),N=o(g,2),E=N[0],P=N[1];c.useEffect(function(){"checked"in f?P(d):v&&P(!(null==j||!j.includes(m)))},[f,j]);return c.createElement(r,{onClick:function(){if(!u&&!y){var e=!E;P(e),b&&b(e,m),v&&v(e,m)}},className:s("yp-checkbox",{"yp-checkbox-checked":E,"yp-checkbox-block":k||C,"yp-checkbox-disabled":y||u},h)},t?t(E):p)};t.Group=l,t.displayName="Checkbox";export{t as default};