@blocklet/payment-react 1.18.56 → 1.19.1

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 (251) hide show
  1. package/es/checkout/donate.d.ts +1 -15
  2. package/es/checkout/donate.js +301 -189
  3. package/es/checkout/form.d.ts +1 -15
  4. package/es/checkout/form.js +5 -13
  5. package/es/checkout/table.js +3 -3
  6. package/es/components/blockchain/gas.d.ts +1 -5
  7. package/es/components/blockchain/gas.js +10 -2
  8. package/es/components/blockchain/tx.d.ts +1 -8
  9. package/es/components/blockchain/tx.js +29 -10
  10. package/es/components/confirm.d.ts +1 -10
  11. package/es/components/confirm.js +4 -10
  12. package/es/components/country-select.d.ts +3 -2
  13. package/es/components/country-select.js +375 -352
  14. package/es/components/date-range-picker.d.ts +13 -0
  15. package/es/components/date-range-picker.js +279 -0
  16. package/es/components/input.d.ts +14 -20
  17. package/es/components/input.js +51 -44
  18. package/es/components/label.d.ts +7 -0
  19. package/es/components/label.js +49 -0
  20. package/es/components/lazy-loader.js +1 -2
  21. package/es/components/link.d.ts +2 -9
  22. package/es/components/link.js +9 -6
  23. package/es/components/livemode.d.ts +2 -8
  24. package/es/components/livemode.js +1 -5
  25. package/es/components/loading-button.d.ts +6 -1
  26. package/es/components/loading-button.js +56 -66
  27. package/es/components/over-due-invoice-payment.d.ts +0 -18
  28. package/es/components/over-due-invoice-payment.js +138 -95
  29. package/es/components/payment-beneficiaries.d.ts +2 -7
  30. package/es/components/payment-beneficiaries.js +86 -40
  31. package/es/components/pricing-item.d.ts +0 -5
  32. package/es/components/pricing-item.js +1 -4
  33. package/es/components/pricing-table.d.ts +2 -10
  34. package/es/components/pricing-table.js +8 -7
  35. package/es/components/resume-subscription.d.ts +0 -10
  36. package/es/components/resume-subscription.js +42 -21
  37. package/es/components/truncated-text.d.ts +2 -9
  38. package/es/components/truncated-text.js +0 -5
  39. package/es/contexts/donate.d.ts +0 -7
  40. package/es/contexts/donate.js +10 -8
  41. package/es/contexts/payment.d.ts +1 -4
  42. package/es/contexts/payment.js +7 -2
  43. package/es/history/credit/grants-list.d.ts +14 -0
  44. package/es/history/credit/grants-list.js +215 -0
  45. package/es/history/credit/transactions-list.d.ts +13 -0
  46. package/es/history/credit/transactions-list.js +255 -0
  47. package/es/history/invoice/list.d.ts +2 -18
  48. package/es/history/invoice/list.js +172 -74
  49. package/es/history/payment/list.js +115 -38
  50. package/es/hooks/keyboard.d.ts +1 -1
  51. package/es/hooks/keyboard.js +2 -4
  52. package/es/index.d.ts +5 -1
  53. package/es/index.js +10 -1
  54. package/es/libs/cached-request.js +2 -4
  55. package/es/libs/phone-validator.js +1 -2
  56. package/es/libs/util.d.ts +2 -0
  57. package/es/libs/util.js +14 -4
  58. package/es/libs/validator.js +2 -4
  59. package/es/locales/en.js +20 -2
  60. package/es/locales/zh.js +20 -2
  61. package/es/payment/amount.d.ts +2 -7
  62. package/es/payment/amount.js +1 -5
  63. package/es/payment/donation-form.d.ts +2 -10
  64. package/es/payment/donation-form.js +196 -160
  65. package/es/payment/error.d.ts +2 -8
  66. package/es/payment/error.js +40 -20
  67. package/es/payment/footer.d.ts +2 -3
  68. package/es/payment/footer.js +19 -6
  69. package/es/payment/form/addon.js +14 -4
  70. package/es/payment/form/address.d.ts +2 -9
  71. package/es/payment/form/address.js +3 -6
  72. package/es/payment/form/currency.js +45 -25
  73. package/es/payment/form/index.d.ts +2 -8
  74. package/es/payment/form/index.js +151 -71
  75. package/es/payment/form/phone.js +2 -4
  76. package/es/payment/form/stripe/form.d.ts +2 -8
  77. package/es/payment/form/stripe/form.js +1 -3
  78. package/es/payment/header.js +38 -16
  79. package/es/payment/index.d.ts +2 -9
  80. package/es/payment/index.js +23 -17
  81. package/es/payment/product-card.d.ts +2 -11
  82. package/es/payment/product-card.js +84 -50
  83. package/es/payment/product-donation.js +175 -114
  84. package/es/payment/product-item.d.ts +9 -9
  85. package/es/payment/product-item.js +320 -145
  86. package/es/payment/product-skeleton.js +2 -2
  87. package/es/payment/skeleton/donation.js +27 -7
  88. package/es/payment/skeleton/overview.js +22 -2
  89. package/es/payment/skeleton/payment.js +33 -5
  90. package/es/payment/success.d.ts +2 -9
  91. package/es/payment/success.js +41 -14
  92. package/es/payment/summary.d.ts +4 -17
  93. package/es/payment/summary.js +193 -111
  94. package/es/theme/index.d.ts +0 -5
  95. package/es/theme/index.js +2 -5
  96. package/es/theme/typography.d.ts +2 -2
  97. package/lib/checkout/donate.d.ts +1 -15
  98. package/lib/checkout/donate.js +75 -54
  99. package/lib/checkout/form.d.ts +1 -15
  100. package/lib/checkout/form.js +7 -15
  101. package/lib/checkout/table.js +4 -4
  102. package/lib/components/blockchain/gas.d.ts +1 -5
  103. package/lib/components/blockchain/gas.js +3 -2
  104. package/lib/components/blockchain/tx.d.ts +1 -8
  105. package/lib/components/blockchain/tx.js +15 -10
  106. package/lib/components/confirm.d.ts +1 -10
  107. package/lib/components/confirm.js +5 -11
  108. package/lib/components/country-select.d.ts +3 -2
  109. package/lib/components/country-select.js +23 -22
  110. package/lib/components/date-range-picker.d.ts +13 -0
  111. package/lib/components/date-range-picker.js +329 -0
  112. package/lib/components/input.d.ts +14 -20
  113. package/lib/components/input.js +28 -27
  114. package/lib/components/label.d.ts +7 -0
  115. package/lib/components/label.js +60 -0
  116. package/lib/components/lazy-loader.js +1 -1
  117. package/lib/components/link.d.ts +2 -9
  118. package/lib/components/link.js +3 -8
  119. package/lib/components/livemode.d.ts +2 -8
  120. package/lib/components/livemode.js +3 -7
  121. package/lib/components/loading-button.d.ts +6 -1
  122. package/lib/components/loading-button.js +9 -17
  123. package/lib/components/over-due-invoice-payment.d.ts +0 -18
  124. package/lib/components/over-due-invoice-payment.js +31 -33
  125. package/lib/components/payment-beneficiaries.d.ts +2 -7
  126. package/lib/components/payment-beneficiaries.js +12 -11
  127. package/lib/components/pricing-item.d.ts +0 -5
  128. package/lib/components/pricing-item.js +2 -5
  129. package/lib/components/pricing-table.d.ts +2 -10
  130. package/lib/components/pricing-table.js +5 -11
  131. package/lib/components/resume-subscription.d.ts +0 -10
  132. package/lib/components/resume-subscription.js +16 -16
  133. package/lib/components/table.js +1 -1
  134. package/lib/components/truncated-text.d.ts +2 -9
  135. package/lib/components/truncated-text.js +1 -6
  136. package/lib/contexts/donate.d.ts +0 -7
  137. package/lib/contexts/donate.js +4 -7
  138. package/lib/contexts/payment.d.ts +1 -4
  139. package/lib/contexts/payment.js +4 -7
  140. package/lib/history/credit/grants-list.d.ts +14 -0
  141. package/lib/history/credit/grants-list.js +277 -0
  142. package/lib/history/credit/transactions-list.d.ts +13 -0
  143. package/lib/history/credit/transactions-list.js +301 -0
  144. package/lib/history/invoice/list.d.ts +2 -18
  145. package/lib/history/invoice/list.js +73 -37
  146. package/lib/history/payment/list.js +30 -16
  147. package/lib/hooks/keyboard.d.ts +1 -1
  148. package/lib/hooks/mobile.js +1 -1
  149. package/lib/hooks/subscription.js +1 -1
  150. package/lib/index.d.ts +5 -1
  151. package/lib/index.js +41 -2
  152. package/lib/libs/api.js +1 -1
  153. package/lib/libs/dayjs.js +1 -1
  154. package/lib/libs/phone-validator.js +0 -2
  155. package/lib/libs/theme.js +1 -1
  156. package/lib/libs/util.d.ts +2 -0
  157. package/lib/libs/util.js +15 -1
  158. package/lib/libs/validator.js +1 -1
  159. package/lib/locales/en.js +21 -3
  160. package/lib/locales/index.js +1 -1
  161. package/lib/locales/zh.js +21 -3
  162. package/lib/payment/amount.d.ts +2 -7
  163. package/lib/payment/amount.js +2 -6
  164. package/lib/payment/donation-form.d.ts +2 -10
  165. package/lib/payment/donation-form.js +33 -38
  166. package/lib/payment/error.d.ts +2 -8
  167. package/lib/payment/error.js +11 -13
  168. package/lib/payment/footer.d.ts +2 -3
  169. package/lib/payment/footer.js +5 -5
  170. package/lib/payment/form/addon.js +5 -3
  171. package/lib/payment/form/address.d.ts +2 -9
  172. package/lib/payment/form/address.js +5 -8
  173. package/lib/payment/form/currency.js +3 -3
  174. package/lib/payment/form/index.d.ts +2 -8
  175. package/lib/payment/form/index.js +64 -21
  176. package/lib/payment/form/phone.js +1 -1
  177. package/lib/payment/form/stripe/form.d.ts +2 -8
  178. package/lib/payment/form/stripe/form.js +3 -6
  179. package/lib/payment/header.js +8 -4
  180. package/lib/payment/index.d.ts +2 -9
  181. package/lib/payment/index.js +27 -18
  182. package/lib/payment/product-card.d.ts +2 -11
  183. package/lib/payment/product-card.js +13 -20
  184. package/lib/payment/product-donation.js +71 -66
  185. package/lib/payment/product-item.d.ts +9 -9
  186. package/lib/payment/product-item.js +168 -29
  187. package/lib/payment/product-skeleton.js +2 -2
  188. package/lib/payment/skeleton/donation.js +8 -4
  189. package/lib/payment/skeleton/overview.js +6 -2
  190. package/lib/payment/skeleton/payment.js +9 -3
  191. package/lib/payment/success.d.ts +2 -9
  192. package/lib/payment/success.js +12 -15
  193. package/lib/payment/summary.d.ts +4 -17
  194. package/lib/payment/summary.js +53 -45
  195. package/lib/theme/index.d.ts +0 -5
  196. package/lib/theme/index.js +2 -5
  197. package/lib/theme/typography.d.ts +2 -2
  198. package/package.json +40 -40
  199. package/src/checkout/donate.tsx +103 -35
  200. package/src/checkout/form.tsx +5 -14
  201. package/src/checkout/table.tsx +3 -3
  202. package/src/components/blockchain/gas.tsx +5 -3
  203. package/src/components/blockchain/tx.tsx +19 -11
  204. package/src/components/confirm.tsx +4 -11
  205. package/src/components/country-select.tsx +391 -378
  206. package/src/components/date-range-picker.tsx +310 -0
  207. package/src/components/input.tsx +61 -46
  208. package/src/components/label.tsx +58 -0
  209. package/src/components/link.tsx +9 -7
  210. package/src/components/livemode.tsx +2 -6
  211. package/src/components/loading-button.tsx +63 -76
  212. package/src/components/over-due-invoice-payment.tsx +43 -28
  213. package/src/components/payment-beneficiaries.tsx +33 -14
  214. package/src/components/pricing-item.tsx +1 -4
  215. package/src/components/pricing-table.tsx +8 -8
  216. package/src/components/resume-subscription.tsx +20 -14
  217. package/src/components/table.tsx +2 -2
  218. package/src/components/truncated-text.tsx +0 -6
  219. package/src/contexts/donate.tsx +6 -7
  220. package/src/contexts/payment.tsx +7 -3
  221. package/src/history/credit/grants-list.tsx +276 -0
  222. package/src/history/credit/transactions-list.tsx +317 -0
  223. package/src/history/invoice/list.tsx +92 -36
  224. package/src/history/payment/list.tsx +53 -16
  225. package/src/hooks/keyboard.ts +1 -1
  226. package/src/index.ts +9 -0
  227. package/src/libs/util.ts +14 -0
  228. package/src/locales/en.tsx +20 -0
  229. package/src/locales/zh.tsx +19 -0
  230. package/src/payment/amount.tsx +1 -6
  231. package/src/payment/donation-form.tsx +47 -29
  232. package/src/payment/error.tsx +16 -8
  233. package/src/payment/footer.tsx +11 -3
  234. package/src/payment/form/addon.tsx +6 -1
  235. package/src/payment/form/address.tsx +3 -7
  236. package/src/payment/form/currency.tsx +12 -2
  237. package/src/payment/form/index.tsx +121 -45
  238. package/src/payment/form/stripe/form.tsx +1 -5
  239. package/src/payment/header.tsx +14 -2
  240. package/src/payment/index.tsx +27 -22
  241. package/src/payment/product-card.tsx +41 -18
  242. package/src/payment/product-donation.tsx +85 -47
  243. package/src/payment/product-item.tsx +198 -28
  244. package/src/payment/product-skeleton.tsx +3 -2
  245. package/src/payment/skeleton/donation.tsx +12 -2
  246. package/src/payment/skeleton/overview.tsx +12 -2
  247. package/src/payment/skeleton/payment.tsx +16 -3
  248. package/src/payment/success.tsx +26 -15
  249. package/src/payment/summary.tsx +87 -44
  250. package/src/theme/index.tsx +5 -8
  251. package/src/theme/typography.ts +2 -2
@@ -0,0 +1,329 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = DateRangePicker;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _react = require("react");
9
+ var _material = require("@mui/material");
10
+ var _iconsMaterial = require("@mui/icons-material");
11
+ var _context = require("@arcblock/ux/lib/Locale/context");
12
+ var _label = _interopRequireDefault(require("./label"));
13
+ var _util = require("../libs/util");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function DatePickerContent({
16
+ tempValue,
17
+ setTempValue,
18
+ handleCancel,
19
+ handleApply,
20
+ handleClear
21
+ }) {
22
+ const {
23
+ t
24
+ } = (0, _context.useLocaleContext)();
25
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
26
+ sx: {
27
+ p: 2,
28
+ minWidth: 320
29
+ },
30
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
31
+ spacing: 2,
32
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
33
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_label.default, {
34
+ children: t("common.startDate")
35
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
36
+ type: "date",
37
+ value: tempValue.startDate,
38
+ onChange: e => setTempValue(prev => ({
39
+ ...prev,
40
+ startDate: e.target.value
41
+ })),
42
+ size: "small",
43
+ fullWidth: true,
44
+ slotProps: {
45
+ inputLabel: {
46
+ shrink: true
47
+ }
48
+ }
49
+ })]
50
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
51
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_label.default, {
52
+ children: t("common.endDate")
53
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
54
+ type: "date",
55
+ value: tempValue.endDate,
56
+ onChange: e => setTempValue(prev => ({
57
+ ...prev,
58
+ endDate: e.target.value
59
+ })),
60
+ size: "small",
61
+ fullWidth: true,
62
+ slotProps: {
63
+ inputLabel: {
64
+ shrink: true
65
+ }
66
+ }
67
+ })]
68
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
69
+ direction: "row",
70
+ spacing: 1,
71
+ sx: {
72
+ justifyContent: "space-between"
73
+ },
74
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
75
+ variant: "text",
76
+ onClick: handleClear,
77
+ size: "small",
78
+ color: "secondary",
79
+ sx: {
80
+ px: 0.5,
81
+ minWidth: 0
82
+ },
83
+ children: t("common.clear")
84
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
85
+ direction: "row",
86
+ spacing: 1,
87
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
88
+ variant: "outlined",
89
+ onClick: handleCancel,
90
+ size: "small",
91
+ children: t("common.cancel")
92
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
93
+ variant: "contained",
94
+ onClick: handleApply,
95
+ size: "small",
96
+ children: t("common.confirm")
97
+ })]
98
+ })]
99
+ })]
100
+ })
101
+ });
102
+ }
103
+ const DateFormat = "YYYY-MM-DD";
104
+ function DateRangePicker({
105
+ value,
106
+ onChange,
107
+ label = "",
108
+ size = "small",
109
+ fullWidth = false,
110
+ disabled = false
111
+ }) {
112
+ const theme = (0, _material.useTheme)();
113
+ const isMobile = (0, _material.useMediaQuery)(theme.breakpoints.down("sm"));
114
+ const [open, setOpen] = (0, _react.useState)(false);
115
+ const {
116
+ t,
117
+ locale
118
+ } = (0, _context.useLocaleContext)();
119
+ const [tempValue, setTempValue] = (0, _react.useState)({
120
+ startDate: value.start ? (0, _util.formatToDate)(value.start * 1e3, locale, DateFormat) : "",
121
+ endDate: value.end ? (0, _util.formatToDate)(value.end * 1e3, locale, DateFormat) : ""
122
+ });
123
+ const anchorRef = (0, _react.useRef)(null);
124
+ const formatDisplayValue = (startUnix, endUnix) => {
125
+ if (!startUnix || !endUnix) return t("common.selectTimeRange");
126
+ const start = (0, _util.formatToDate)(startUnix * 1e3, locale, DateFormat);
127
+ const end = (0, _util.formatToDate)(endUnix * 1e3, locale, DateFormat);
128
+ return `${start} ~ ${end}`;
129
+ };
130
+ const handleOpen = () => {
131
+ if (disabled) return;
132
+ setTempValue({
133
+ startDate: value.start ? (0, _util.formatToDate)(value.start * 1e3, locale, DateFormat) : "",
134
+ endDate: value.end ? (0, _util.formatToDate)(value.end * 1e3, locale, DateFormat) : ""
135
+ });
136
+ setOpen(true);
137
+ };
138
+ const handleClose = () => {
139
+ setOpen(false);
140
+ };
141
+ const handleApply = () => {
142
+ const unixValue = {
143
+ start: tempValue.startDate ? Math.floor((/* @__PURE__ */new Date(`${tempValue.startDate}T00:00:00`)).getTime() / 1e3) : 0,
144
+ end: tempValue.endDate ? Math.floor((/* @__PURE__ */new Date(`${tempValue.endDate}T23:59:59`)).getTime() / 1e3) : 0
145
+ };
146
+ onChange(unixValue);
147
+ setOpen(false);
148
+ };
149
+ const handleCancel = () => {
150
+ setTempValue({
151
+ startDate: value.start ? (0, _util.formatToDate)(value.start * 1e3, locale, DateFormat) : "",
152
+ endDate: value.end ? (0, _util.formatToDate)(value.end * 1e3, locale, DateFormat) : ""
153
+ });
154
+ setOpen(false);
155
+ };
156
+ const handleClear = () => {
157
+ const emptyValue = {
158
+ start: void 0,
159
+ end: void 0
160
+ };
161
+ onChange(emptyValue);
162
+ setTempValue({
163
+ startDate: "",
164
+ endDate: ""
165
+ });
166
+ setOpen(false);
167
+ };
168
+ const hasValue = !!value.start && !!value.end;
169
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
170
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
171
+ ref: anchorRef,
172
+ label,
173
+ value: formatDisplayValue(value.start, value.end),
174
+ size,
175
+ fullWidth,
176
+ disabled,
177
+ sx: {
178
+ "& .MuiInputBase-input": {
179
+ cursor: disabled ? "default" : "pointer"
180
+ }
181
+ },
182
+ onClick: handleOpen,
183
+ placeholder: t("common.selectTimeRange"),
184
+ slotProps: {
185
+ input: {
186
+ readOnly: true,
187
+ startAdornment: /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.DateRange, {
188
+ fontSize: "small",
189
+ sx: {
190
+ mr: 1,
191
+ color: "text.secondary"
192
+ }
193
+ }),
194
+ endAdornment: hasValue && !disabled && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.IconButton, {
195
+ size: "small",
196
+ onClick: e => {
197
+ e.stopPropagation();
198
+ handleClear();
199
+ },
200
+ sx: {
201
+ color: "text.secondary",
202
+ "&:hover": {
203
+ color: "text.primary"
204
+ }
205
+ },
206
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.Clear, {
207
+ fontSize: "small"
208
+ })
209
+ })
210
+ },
211
+ inputLabel: {
212
+ shrink: true
213
+ }
214
+ }
215
+ }), !isMobile && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Popover, {
216
+ open,
217
+ anchorEl: anchorRef.current,
218
+ onClose: handleClose,
219
+ anchorOrigin: {
220
+ vertical: "bottom",
221
+ horizontal: "left"
222
+ },
223
+ transformOrigin: {
224
+ vertical: "top",
225
+ horizontal: "left"
226
+ },
227
+ sx: {
228
+ "& .MuiPaper-root": {
229
+ boxShadow: theme.shadows[8],
230
+ border: `1px solid ${theme.palette.divider}`
231
+ }
232
+ },
233
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(DatePickerContent, {
234
+ tempValue,
235
+ setTempValue,
236
+ handleCancel,
237
+ handleApply,
238
+ handleClear
239
+ })
240
+ }), isMobile && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Dialog, {
241
+ open,
242
+ onClose: handleClose,
243
+ fullWidth: true,
244
+ maxWidth: "sm",
245
+ PaperProps: {
246
+ sx: {
247
+ m: 1,
248
+ maxHeight: "calc(100% - 64px)"
249
+ }
250
+ },
251
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.DialogTitle, {
252
+ sx: {
253
+ display: "flex",
254
+ justifyContent: "space-between",
255
+ alignItems: "center",
256
+ pb: 1
257
+ },
258
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
259
+ variant: "h6",
260
+ children: t("common.selectTimeRange")
261
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.IconButton, {
262
+ edge: "end",
263
+ color: "inherit",
264
+ onClick: handleClose,
265
+ "aria-label": "close",
266
+ size: "small",
267
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.Close, {})
268
+ })]
269
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.DialogContent, {
270
+ sx: {
271
+ pb: 1
272
+ },
273
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
274
+ spacing: 2,
275
+ sx: {
276
+ mt: 1
277
+ },
278
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_label.default, {
279
+ children: t("common.startDate")
280
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
281
+ type: "date",
282
+ value: tempValue.startDate,
283
+ onChange: e => setTempValue(prev => ({
284
+ ...prev,
285
+ startDate: e.target.value
286
+ })),
287
+ size: "small",
288
+ fullWidth: true,
289
+ slotProps: {
290
+ inputLabel: {
291
+ shrink: true
292
+ }
293
+ }
294
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_label.default, {
295
+ children: t("common.endDate")
296
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
297
+ type: "date",
298
+ value: tempValue.endDate,
299
+ onChange: e => setTempValue(prev => ({
300
+ ...prev,
301
+ endDate: e.target.value
302
+ })),
303
+ size: "small",
304
+ fullWidth: true,
305
+ slotProps: {
306
+ inputLabel: {
307
+ shrink: true
308
+ }
309
+ }
310
+ })]
311
+ })
312
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.DialogActions, {
313
+ sx: {
314
+ px: 3,
315
+ pb: 2
316
+ },
317
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
318
+ onClick: handleCancel,
319
+ color: "inherit",
320
+ children: t("common.cancel")
321
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
322
+ onClick: handleApply,
323
+ variant: "contained",
324
+ children: t("common.confirm")
325
+ })]
326
+ })]
327
+ })]
328
+ });
329
+ }
@@ -1,25 +1,19 @@
1
- import { type ReactNode } from 'react';
1
+ import React, { type ReactNode } from 'react';
2
+ import type { TextFieldProps } from '@mui/material';
2
3
  import type { RegisterOptions } from 'react-hook-form';
3
- declare const FormInput: import("react").ForwardRefExoticComponent<(Omit<import("@mui/material").OutlinedTextFieldProps & {
4
+ type InputProps = TextFieldProps & {
4
5
  name: string;
5
6
  label?: ReactNode;
6
7
  placeholder?: string;
7
- errorPosition?: "right" | "bottom";
8
+ errorPosition?: 'right' | 'bottom';
8
9
  rules?: RegisterOptions;
9
- wrapperStyle?: any;
10
- }, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
11
- name: string;
12
- label?: ReactNode;
13
- placeholder?: string;
14
- errorPosition?: "right" | "bottom";
15
- rules?: RegisterOptions;
16
- wrapperStyle?: any;
17
- }, "ref"> | Omit<import("@mui/material").StandardTextFieldProps & {
18
- name: string;
19
- label?: ReactNode;
20
- placeholder?: string;
21
- errorPosition?: "right" | "bottom";
22
- rules?: RegisterOptions;
23
- wrapperStyle?: any;
24
- }, "ref">) & import("react").RefAttributes<HTMLInputElement>>;
25
- export default FormInput;
10
+ wrapperStyle?: React.CSSProperties;
11
+ required?: boolean;
12
+ tooltip?: ReactNode | string;
13
+ description?: ReactNode | string;
14
+ };
15
+ export default function FormInput({ ref, name, label, placeholder, rules, errorPosition, wrapperStyle, inputProps, required, tooltip, description, ...rest }: InputProps & {
16
+ ref?: React.RefObject<HTMLInputElement | null>;
17
+ inputProps?: TextFieldProps['inputProps'];
18
+ }): JSX.Element;
19
+ export {};
@@ -3,13 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
6
+ module.exports = FormInput;
7
7
  var _jsxRuntime = require("react/jsx-runtime");
8
8
  var _react = require("react");
9
9
  var _material = require("@mui/material");
10
10
  var _get = _interopRequireDefault(require("lodash/get"));
11
11
  var _reactHookForm = require("react-hook-form");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ var _label = _interopRequireDefault(require("./label"));
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
14
  function FormInputError({
14
15
  error
15
16
  }) {
@@ -22,15 +23,20 @@ function FormInputError({
22
23
  })
23
24
  });
24
25
  }
25
- const FormInput = (0, _react.forwardRef)(({
26
+ function FormInput({
27
+ ref = void 0,
26
28
  name,
27
- label,
28
- placeholder,
29
- rules,
30
- errorPosition,
31
- wrapperStyle,
29
+ label = "",
30
+ placeholder = "",
31
+ rules = {},
32
+ errorPosition = "bottom",
33
+ wrapperStyle = {},
34
+ inputProps = {},
35
+ required = false,
36
+ tooltip = "",
37
+ description = "",
32
38
  ...rest
33
- }, ref) => {
39
+ }) {
34
40
  const {
35
41
  control,
36
42
  formState
@@ -51,10 +57,10 @@ const FormInput = (0, _react.forwardRef)(({
51
57
  width: "100%",
52
58
  ...wrapperStyle
53
59
  },
54
- children: [!!label && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.FormLabel, {
55
- sx: {
56
- color: "text.primary"
57
- },
60
+ children: [!!label && /* @__PURE__ */(0, _jsxRuntime.jsx)(_label.default, {
61
+ required,
62
+ tooltip,
63
+ description,
58
64
  children: label
59
65
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
60
66
  fullWidth: true,
@@ -65,20 +71,15 @@ const FormInput = (0, _react.forwardRef)(({
65
71
  ...field,
66
72
  ...rest,
67
73
  inputRef,
68
- InputProps: Object.assign(rest.InputProps || {}, errorPosition === "right" && error ? {
69
- endAdornment: /* @__PURE__ */(0, _jsxRuntime.jsx)(FormInputError, {
70
- error
71
- })
72
- } : {})
74
+ slotProps: {
75
+ htmlInput: inputProps,
76
+ input: Object.assign(rest.InputProps || {}, errorPosition === "right" && error ? {
77
+ endAdornment: /* @__PURE__ */(0, _jsxRuntime.jsx)(FormInputError, {
78
+ error
79
+ })
80
+ } : {})
81
+ }
73
82
  })]
74
83
  })
75
84
  });
76
- });
77
- FormInput.defaultProps = {
78
- label: "",
79
- placeholder: "",
80
- errorPosition: "bottom",
81
- rules: {},
82
- wrapperStyle: {}
83
- };
84
- module.exports = FormInput;
85
+ }
@@ -0,0 +1,7 @@
1
+ import type { FormLabelProps } from '@mui/material';
2
+ import type { ReactNode } from 'react';
3
+ export default function CustomFormLabel({ children, required, tooltip, description, ...props }: FormLabelProps & {
4
+ required?: boolean;
5
+ tooltip?: ReactNode | string;
6
+ description?: ReactNode | string;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = CustomFormLabel;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _iconsMaterial = require("@mui/icons-material");
9
+ var _material = require("@mui/material");
10
+ function CustomFormLabel({
11
+ children,
12
+ required = false,
13
+ tooltip = "",
14
+ description = "",
15
+ ...props
16
+ }) {
17
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
18
+ sx: {
19
+ mb: 1,
20
+ width: "100%"
21
+ },
22
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.FormLabel, {
23
+ ...props,
24
+ sx: {
25
+ display: "flex",
26
+ alignItems: "center",
27
+ gap: 0.5,
28
+ fontWeight: 500,
29
+ color: "text.primary",
30
+ "&.MuiFormLabel-root": {
31
+ display: "flex",
32
+ alignItems: "center",
33
+ gap: 0.5,
34
+ fontWeight: 500,
35
+ color: "text.primary"
36
+ },
37
+ ...(props.sx || {})
38
+ },
39
+ children: [children, required && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
40
+ component: "span",
41
+ color: "error",
42
+ children: "*"
43
+ }), tooltip && (typeof tooltip === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Tooltip, {
44
+ title: tooltip,
45
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.InfoOutlined, {
46
+ fontSize: "small",
47
+ sx: {
48
+ opacity: 0.7
49
+ }
50
+ })
51
+ }) : tooltip)]
52
+ }), description && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
53
+ variant: "caption",
54
+ sx: {
55
+ color: "text.secondary"
56
+ },
57
+ children: description
58
+ })]
59
+ });
60
+ }
@@ -8,7 +8,7 @@ var _jsxRuntime = require("react/jsx-runtime");
8
8
  var _react = require("react");
9
9
  var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
10
10
  var _material = require("@mui/material");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function createLazyComponent(loader, options = {}) {
13
13
  let loadPromise = null;
14
14
  const {
@@ -6,12 +6,5 @@ interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
6
6
  target?: string;
7
7
  outLink?: boolean;
8
8
  }
9
- declare function Link({ to, children, onClick, replace, target, outLink, ...props }: LinkProps): JSX.Element;
10
- declare namespace Link {
11
- var defaultProps: {
12
- replace: boolean;
13
- target: undefined;
14
- outLink: boolean;
15
- };
16
- }
17
- export default Link;
9
+ export default function Link({ to, children, onClick, replace, target, outLink, ...props }: LinkProps): JSX.Element;
10
+ export {};
@@ -10,8 +10,8 @@ function Link({
10
10
  to,
11
11
  children,
12
12
  onClick,
13
- replace,
14
- target,
13
+ replace = false,
14
+ target = void 0,
15
15
  outLink = false,
16
16
  ...props
17
17
  }) {
@@ -38,9 +38,4 @@ function Link({
38
38
  ...props,
39
39
  children
40
40
  });
41
- }
42
- Link.defaultProps = {
43
- replace: false,
44
- target: void 0,
45
- outLink: false
46
- };
41
+ }
@@ -3,11 +3,5 @@ type Props = {
3
3
  color?: string;
4
4
  backgroundColor?: string;
5
5
  } & ChipOwnProps;
6
- declare function Livemode({ color, backgroundColor, sx }: Props): import("react").JSX.Element;
7
- declare namespace Livemode {
8
- var defaultProps: {
9
- color: string;
10
- backgroundColor: string;
11
- };
12
- }
13
- export default Livemode;
6
+ export default function Livemode({ color, backgroundColor, sx }: Props): import("react").JSX.Element;
7
+ export {};
@@ -8,8 +8,8 @@ var _jsxRuntime = require("react/jsx-runtime");
8
8
  var _context = require("@arcblock/ux/lib/Locale/context");
9
9
  var _material = require("@mui/material");
10
10
  function Livemode({
11
- color,
12
- backgroundColor,
11
+ color = "#bb5504",
12
+ backgroundColor = "#ffde92",
13
13
  sx
14
14
  }) {
15
15
  const {
@@ -32,8 +32,4 @@ function Livemode({
32
32
  ...sx
33
33
  }
34
34
  });
35
- }
36
- Livemode.defaultProps = {
37
- color: "#bb5504",
38
- backgroundColor: "#ffde92"
39
- };
35
+ }
@@ -6,5 +6,10 @@ export interface LoadingButtonProps extends ButtonProps {
6
6
  loadingProps?: Partial<CircularProgressProps>;
7
7
  loadingOnly?: boolean;
8
8
  }
9
- declare const LoadingButton: import("react").ForwardRefExoticComponent<Omit<LoadingButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
9
+ declare function LoadingButton({ ref, children, loading, loadingPosition, loadingIndicator, loadingProps, loadingOnly, onClick, sx, ...props }: LoadingButtonProps & {
10
+ ref?: React.RefObject<HTMLButtonElement | null>;
11
+ }): import("react").JSX.Element;
12
+ declare namespace LoadingButton {
13
+ var displayName: string;
14
+ }
10
15
  export default LoadingButton;
@@ -3,21 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
6
+ module.exports = LoadingButton;
7
7
  var _jsxRuntime = require("react/jsx-runtime");
8
8
  var _material = require("@mui/material");
9
- var _react = require("react");
10
- const LoadingButton = (0, _react.forwardRef)(({
9
+ function LoadingButton({
10
+ ref = void 0,
11
11
  children,
12
- loading,
12
+ loading = false,
13
13
  loadingPosition = "start",
14
- loadingIndicator,
14
+ loadingIndicator = void 0,
15
15
  loadingProps = {},
16
+ loadingOnly = false,
16
17
  onClick,
17
18
  sx,
18
- loadingOnly = false,
19
19
  ...props
20
- }, ref) => {
20
+ }) {
21
21
  const handleClick = e => {
22
22
  if (loading) {
23
23
  return;
@@ -74,13 +74,5 @@ const LoadingButton = (0, _react.forwardRef)(({
74
74
  children
75
75
  }), loading && loadingPosition === "center" && indicator, loading && loadingPosition === "end" && indicator]
76
76
  });
77
- });
78
- LoadingButton.displayName = "LoadingButton";
79
- LoadingButton.defaultProps = {
80
- loading: false,
81
- loadingIndicator: void 0,
82
- loadingPosition: "start",
83
- loadingProps: {},
84
- loadingOnly: false
85
- };
86
- module.exports = LoadingButton;
77
+ }
78
+ LoadingButton.displayName = "LoadingButton";