soda-heroui 0.4.3 → 0.5.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.
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ AutoRefresh: ()=>AutoRefresh
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const react_namespaceObject = require("@heroui/react");
31
+ const external_soda_hooks_namespaceObject = require("soda-hooks");
32
+ const AutoRefresh = ({ children, onRefresh, ...rest })=>{
33
+ if ("development" === process.env.NODE_ENV) return children;
34
+ function onPress(e) {
35
+ const closeButton = e.target.parentElement?.querySelector(`[aria-label="关闭"]`);
36
+ closeButton?.click();
37
+ onRefresh?.();
38
+ }
39
+ (0, external_soda_hooks_namespaceObject.useAutoRefresh)(()=>(0, react_namespaceObject.addToast)({
40
+ title: "检测到页面更新",
41
+ description: "为了最佳的体验,请刷新页面",
42
+ color: "warning",
43
+ timeout: 1 / 0,
44
+ endContent: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.Button, {
45
+ color: "warning",
46
+ size: "sm",
47
+ variant: "flat",
48
+ onPress: onPress,
49
+ children: "刷新"
50
+ }),
51
+ ...rest
52
+ }));
53
+ return children;
54
+ };
55
+ exports.AutoRefresh = __webpack_exports__.AutoRefresh;
56
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
57
+ "AutoRefresh"
58
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
59
+ Object.defineProperty(exports, '__esModule', {
60
+ value: true
61
+ });
@@ -0,0 +1,8 @@
1
+ import { FC, ReactNode } from "react";
2
+ import { addToast } from "@heroui/react";
3
+ import { FirstParameter } from "soda-type";
4
+ export interface AutoRefreshProps extends FirstParameter<typeof addToast> {
5
+ onRefresh?: () => void;
6
+ children?: ReactNode;
7
+ }
8
+ export declare const AutoRefresh: FC<AutoRefreshProps>;
@@ -0,0 +1,27 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__heroui_react_7b65ca80__ from "@heroui/react";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_soda_hooks_b1fef7dd__ from "soda-hooks";
4
+ const AutoRefresh = ({ children, onRefresh, ...rest })=>{
5
+ if ("development" === process.env.NODE_ENV) return children;
6
+ function onPress(e) {
7
+ const closeButton = e.target.parentElement?.querySelector(`[aria-label="关闭"]`);
8
+ closeButton?.click();
9
+ onRefresh?.();
10
+ }
11
+ (0, __WEBPACK_EXTERNAL_MODULE_soda_hooks_b1fef7dd__.useAutoRefresh)(()=>(0, __WEBPACK_EXTERNAL_MODULE__heroui_react_7b65ca80__.addToast)({
12
+ title: "检测到页面更新",
13
+ description: "为了最佳的体验,请刷新页面",
14
+ color: "warning",
15
+ timeout: 1 / 0,
16
+ endContent: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__heroui_react_7b65ca80__.Button, {
17
+ color: "warning",
18
+ size: "sm",
19
+ variant: "flat",
20
+ onPress: onPress,
21
+ children: "刷新"
22
+ }),
23
+ ...rest
24
+ }));
25
+ return children;
26
+ };
27
+ export { AutoRefresh };
package/dist/index.cjs CHANGED
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
  var __webpack_modules__ = {
3
+ "@/components/AutoRefresh": function(module) {
4
+ module.exports = require("./components/AutoRefresh.cjs");
5
+ },
3
6
  "@/components/ErrorMessage": function(module) {
4
7
  module.exports = require("./components/ErrorMessage.cjs");
5
8
  },
@@ -110,136 +113,142 @@ function __webpack_require__(moduleId) {
110
113
  var __webpack_exports__ = {};
111
114
  (()=>{
112
115
  __webpack_require__.r(__webpack_exports__);
113
- var _components_ErrorMessage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@/components/ErrorMessage");
116
+ var _components_AutoRefresh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@/components/AutoRefresh");
117
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
118
+ for(var __WEBPACK_IMPORT_KEY__ in _components_AutoRefresh__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
119
+ return _components_AutoRefresh__WEBPACK_IMPORTED_MODULE_0__[key];
120
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
121
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
122
+ var _components_ErrorMessage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@/components/ErrorMessage");
114
123
  var __WEBPACK_REEXPORT_OBJECT__ = {};
115
- for(var __WEBPACK_IMPORT_KEY__ in _components_ErrorMessage__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
116
- return _components_ErrorMessage__WEBPACK_IMPORTED_MODULE_0__[key];
124
+ for(var __WEBPACK_IMPORT_KEY__ in _components_ErrorMessage__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
125
+ return _components_ErrorMessage__WEBPACK_IMPORTED_MODULE_1__[key];
117
126
  }).bind(0, __WEBPACK_IMPORT_KEY__);
118
127
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
119
- var _components_FormAutocomplete__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@/components/FormAutocomplete");
128
+ var _components_FormAutocomplete__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@/components/FormAutocomplete");
120
129
  var __WEBPACK_REEXPORT_OBJECT__ = {};
121
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormAutocomplete__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
122
- return _components_FormAutocomplete__WEBPACK_IMPORTED_MODULE_1__[key];
130
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormAutocomplete__WEBPACK_IMPORTED_MODULE_2__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
131
+ return _components_FormAutocomplete__WEBPACK_IMPORTED_MODULE_2__[key];
123
132
  }).bind(0, __WEBPACK_IMPORT_KEY__);
124
133
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
125
- var _components_FormCalendar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@/components/FormCalendar");
134
+ var _components_FormCalendar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("@/components/FormCalendar");
126
135
  var __WEBPACK_REEXPORT_OBJECT__ = {};
127
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormCalendar__WEBPACK_IMPORTED_MODULE_2__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
128
- return _components_FormCalendar__WEBPACK_IMPORTED_MODULE_2__[key];
136
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormCalendar__WEBPACK_IMPORTED_MODULE_3__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
137
+ return _components_FormCalendar__WEBPACK_IMPORTED_MODULE_3__[key];
129
138
  }).bind(0, __WEBPACK_IMPORT_KEY__);
130
139
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
131
- var _components_FormCheckbox__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("@/components/FormCheckbox");
140
+ var _components_FormCheckbox__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("@/components/FormCheckbox");
132
141
  var __WEBPACK_REEXPORT_OBJECT__ = {};
133
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormCheckbox__WEBPACK_IMPORTED_MODULE_3__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
134
- return _components_FormCheckbox__WEBPACK_IMPORTED_MODULE_3__[key];
142
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormCheckbox__WEBPACK_IMPORTED_MODULE_4__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
143
+ return _components_FormCheckbox__WEBPACK_IMPORTED_MODULE_4__[key];
135
144
  }).bind(0, __WEBPACK_IMPORT_KEY__);
136
145
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
137
- var _components_FormCheckboxGroup__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("@/components/FormCheckboxGroup");
146
+ var _components_FormCheckboxGroup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("@/components/FormCheckboxGroup");
138
147
  var __WEBPACK_REEXPORT_OBJECT__ = {};
139
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormCheckboxGroup__WEBPACK_IMPORTED_MODULE_4__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
140
- return _components_FormCheckboxGroup__WEBPACK_IMPORTED_MODULE_4__[key];
148
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormCheckboxGroup__WEBPACK_IMPORTED_MODULE_5__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
149
+ return _components_FormCheckboxGroup__WEBPACK_IMPORTED_MODULE_5__[key];
141
150
  }).bind(0, __WEBPACK_IMPORT_KEY__);
142
151
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
143
- var _components_FormDateInput__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("@/components/FormDateInput");
152
+ var _components_FormDateInput__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("@/components/FormDateInput");
144
153
  var __WEBPACK_REEXPORT_OBJECT__ = {};
145
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormDateInput__WEBPACK_IMPORTED_MODULE_5__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
146
- return _components_FormDateInput__WEBPACK_IMPORTED_MODULE_5__[key];
154
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormDateInput__WEBPACK_IMPORTED_MODULE_6__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
155
+ return _components_FormDateInput__WEBPACK_IMPORTED_MODULE_6__[key];
147
156
  }).bind(0, __WEBPACK_IMPORT_KEY__);
148
157
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
149
- var _components_FormDatePicker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("@/components/FormDatePicker");
158
+ var _components_FormDatePicker__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("@/components/FormDatePicker");
150
159
  var __WEBPACK_REEXPORT_OBJECT__ = {};
151
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormDatePicker__WEBPACK_IMPORTED_MODULE_6__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
152
- return _components_FormDatePicker__WEBPACK_IMPORTED_MODULE_6__[key];
160
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormDatePicker__WEBPACK_IMPORTED_MODULE_7__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
161
+ return _components_FormDatePicker__WEBPACK_IMPORTED_MODULE_7__[key];
153
162
  }).bind(0, __WEBPACK_IMPORT_KEY__);
154
163
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
155
- var _components_FormDateRangePicker__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("@/components/FormDateRangePicker");
164
+ var _components_FormDateRangePicker__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("@/components/FormDateRangePicker");
156
165
  var __WEBPACK_REEXPORT_OBJECT__ = {};
157
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormDateRangePicker__WEBPACK_IMPORTED_MODULE_7__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
158
- return _components_FormDateRangePicker__WEBPACK_IMPORTED_MODULE_7__[key];
166
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormDateRangePicker__WEBPACK_IMPORTED_MODULE_8__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
167
+ return _components_FormDateRangePicker__WEBPACK_IMPORTED_MODULE_8__[key];
159
168
  }).bind(0, __WEBPACK_IMPORT_KEY__);
160
169
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
161
- var _components_FormInput__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("@/components/FormInput");
170
+ var _components_FormInput__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("@/components/FormInput");
162
171
  var __WEBPACK_REEXPORT_OBJECT__ = {};
163
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormInput__WEBPACK_IMPORTED_MODULE_8__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
164
- return _components_FormInput__WEBPACK_IMPORTED_MODULE_8__[key];
172
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormInput__WEBPACK_IMPORTED_MODULE_9__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
173
+ return _components_FormInput__WEBPACK_IMPORTED_MODULE_9__[key];
165
174
  }).bind(0, __WEBPACK_IMPORT_KEY__);
166
175
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
167
- var _components_FormInputOtp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("@/components/FormInputOtp");
176
+ var _components_FormInputOtp__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("@/components/FormInputOtp");
168
177
  var __WEBPACK_REEXPORT_OBJECT__ = {};
169
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormInputOtp__WEBPACK_IMPORTED_MODULE_9__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
170
- return _components_FormInputOtp__WEBPACK_IMPORTED_MODULE_9__[key];
178
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormInputOtp__WEBPACK_IMPORTED_MODULE_10__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
179
+ return _components_FormInputOtp__WEBPACK_IMPORTED_MODULE_10__[key];
171
180
  }).bind(0, __WEBPACK_IMPORT_KEY__);
172
181
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
173
- var _components_FormNumberInput__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("@/components/FormNumberInput");
182
+ var _components_FormNumberInput__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("@/components/FormNumberInput");
174
183
  var __WEBPACK_REEXPORT_OBJECT__ = {};
175
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormNumberInput__WEBPACK_IMPORTED_MODULE_10__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
176
- return _components_FormNumberInput__WEBPACK_IMPORTED_MODULE_10__[key];
184
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormNumberInput__WEBPACK_IMPORTED_MODULE_11__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
185
+ return _components_FormNumberInput__WEBPACK_IMPORTED_MODULE_11__[key];
177
186
  }).bind(0, __WEBPACK_IMPORT_KEY__);
178
187
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
179
- var _components_FormPagination__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("@/components/FormPagination");
188
+ var _components_FormPagination__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("@/components/FormPagination");
180
189
  var __WEBPACK_REEXPORT_OBJECT__ = {};
181
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormPagination__WEBPACK_IMPORTED_MODULE_11__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
182
- return _components_FormPagination__WEBPACK_IMPORTED_MODULE_11__[key];
190
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormPagination__WEBPACK_IMPORTED_MODULE_12__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
191
+ return _components_FormPagination__WEBPACK_IMPORTED_MODULE_12__[key];
183
192
  }).bind(0, __WEBPACK_IMPORT_KEY__);
184
193
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
185
- var _components_FormRadioGroup__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("@/components/FormRadioGroup");
194
+ var _components_FormRadioGroup__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("@/components/FormRadioGroup");
186
195
  var __WEBPACK_REEXPORT_OBJECT__ = {};
187
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormRadioGroup__WEBPACK_IMPORTED_MODULE_12__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
188
- return _components_FormRadioGroup__WEBPACK_IMPORTED_MODULE_12__[key];
196
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormRadioGroup__WEBPACK_IMPORTED_MODULE_13__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
197
+ return _components_FormRadioGroup__WEBPACK_IMPORTED_MODULE_13__[key];
189
198
  }).bind(0, __WEBPACK_IMPORT_KEY__);
190
199
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
191
- var _components_FormRangeCalendar__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("@/components/FormRangeCalendar");
200
+ var _components_FormRangeCalendar__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("@/components/FormRangeCalendar");
192
201
  var __WEBPACK_REEXPORT_OBJECT__ = {};
193
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormRangeCalendar__WEBPACK_IMPORTED_MODULE_13__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
194
- return _components_FormRangeCalendar__WEBPACK_IMPORTED_MODULE_13__[key];
202
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormRangeCalendar__WEBPACK_IMPORTED_MODULE_14__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
203
+ return _components_FormRangeCalendar__WEBPACK_IMPORTED_MODULE_14__[key];
195
204
  }).bind(0, __WEBPACK_IMPORT_KEY__);
196
205
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
197
- var _components_FormSelect__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("@/components/FormSelect");
206
+ var _components_FormSelect__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("@/components/FormSelect");
198
207
  var __WEBPACK_REEXPORT_OBJECT__ = {};
199
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormSelect__WEBPACK_IMPORTED_MODULE_14__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
200
- return _components_FormSelect__WEBPACK_IMPORTED_MODULE_14__[key];
208
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormSelect__WEBPACK_IMPORTED_MODULE_15__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
209
+ return _components_FormSelect__WEBPACK_IMPORTED_MODULE_15__[key];
201
210
  }).bind(0, __WEBPACK_IMPORT_KEY__);
202
211
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
203
- var _components_FormSwitch__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("@/components/FormSwitch");
212
+ var _components_FormSwitch__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("@/components/FormSwitch");
204
213
  var __WEBPACK_REEXPORT_OBJECT__ = {};
205
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormSwitch__WEBPACK_IMPORTED_MODULE_15__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
206
- return _components_FormSwitch__WEBPACK_IMPORTED_MODULE_15__[key];
214
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormSwitch__WEBPACK_IMPORTED_MODULE_16__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
215
+ return _components_FormSwitch__WEBPACK_IMPORTED_MODULE_16__[key];
207
216
  }).bind(0, __WEBPACK_IMPORT_KEY__);
208
217
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
209
- var _components_FormTextarea__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("@/components/FormTextarea");
218
+ var _components_FormTextarea__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("@/components/FormTextarea");
210
219
  var __WEBPACK_REEXPORT_OBJECT__ = {};
211
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormTextarea__WEBPACK_IMPORTED_MODULE_16__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
212
- return _components_FormTextarea__WEBPACK_IMPORTED_MODULE_16__[key];
220
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormTextarea__WEBPACK_IMPORTED_MODULE_17__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
221
+ return _components_FormTextarea__WEBPACK_IMPORTED_MODULE_17__[key];
213
222
  }).bind(0, __WEBPACK_IMPORT_KEY__);
214
223
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
215
- var _components_FormTimeInput__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("@/components/FormTimeInput");
224
+ var _components_FormTimeInput__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("@/components/FormTimeInput");
216
225
  var __WEBPACK_REEXPORT_OBJECT__ = {};
217
- for(var __WEBPACK_IMPORT_KEY__ in _components_FormTimeInput__WEBPACK_IMPORTED_MODULE_17__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
218
- return _components_FormTimeInput__WEBPACK_IMPORTED_MODULE_17__[key];
226
+ for(var __WEBPACK_IMPORT_KEY__ in _components_FormTimeInput__WEBPACK_IMPORTED_MODULE_18__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
227
+ return _components_FormTimeInput__WEBPACK_IMPORTED_MODULE_18__[key];
219
228
  }).bind(0, __WEBPACK_IMPORT_KEY__);
220
229
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
221
- var _utils_getFieldProps__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("@/utils/getFieldProps");
230
+ var _utils_getFieldProps__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("@/utils/getFieldProps");
222
231
  var __WEBPACK_REEXPORT_OBJECT__ = {};
223
- for(var __WEBPACK_IMPORT_KEY__ in _utils_getFieldProps__WEBPACK_IMPORTED_MODULE_18__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
224
- return _utils_getFieldProps__WEBPACK_IMPORTED_MODULE_18__[key];
232
+ for(var __WEBPACK_IMPORT_KEY__ in _utils_getFieldProps__WEBPACK_IMPORTED_MODULE_19__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
233
+ return _utils_getFieldProps__WEBPACK_IMPORTED_MODULE_19__[key];
225
234
  }).bind(0, __WEBPACK_IMPORT_KEY__);
226
235
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
227
- var _utils_getTimeValue__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__("@/utils/getTimeValue");
236
+ var _utils_getTimeValue__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__("@/utils/getTimeValue");
228
237
  var __WEBPACK_REEXPORT_OBJECT__ = {};
229
- for(var __WEBPACK_IMPORT_KEY__ in _utils_getTimeValue__WEBPACK_IMPORTED_MODULE_19__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
230
- return _utils_getTimeValue__WEBPACK_IMPORTED_MODULE_19__[key];
238
+ for(var __WEBPACK_IMPORT_KEY__ in _utils_getTimeValue__WEBPACK_IMPORTED_MODULE_20__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
239
+ return _utils_getTimeValue__WEBPACK_IMPORTED_MODULE_20__[key];
231
240
  }).bind(0, __WEBPACK_IMPORT_KEY__);
232
241
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
233
- var _utils_isFieldInvalid__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__("@/utils/isFieldInvalid");
242
+ var _utils_isFieldInvalid__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__("@/utils/isFieldInvalid");
234
243
  var __WEBPACK_REEXPORT_OBJECT__ = {};
235
- for(var __WEBPACK_IMPORT_KEY__ in _utils_isFieldInvalid__WEBPACK_IMPORTED_MODULE_20__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
236
- return _utils_isFieldInvalid__WEBPACK_IMPORTED_MODULE_20__[key];
244
+ for(var __WEBPACK_IMPORT_KEY__ in _utils_isFieldInvalid__WEBPACK_IMPORTED_MODULE_21__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
245
+ return _utils_isFieldInvalid__WEBPACK_IMPORTED_MODULE_21__[key];
237
246
  }).bind(0, __WEBPACK_IMPORT_KEY__);
238
247
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
239
- var _utils_parseTime__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__("@/utils/parseTime");
248
+ var _utils_parseTime__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__("@/utils/parseTime");
240
249
  var __WEBPACK_REEXPORT_OBJECT__ = {};
241
- for(var __WEBPACK_IMPORT_KEY__ in _utils_parseTime__WEBPACK_IMPORTED_MODULE_21__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
242
- return _utils_parseTime__WEBPACK_IMPORTED_MODULE_21__[key];
250
+ for(var __WEBPACK_IMPORT_KEY__ in _utils_parseTime__WEBPACK_IMPORTED_MODULE_22__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
251
+ return _utils_parseTime__WEBPACK_IMPORTED_MODULE_22__[key];
243
252
  }).bind(0, __WEBPACK_IMPORT_KEY__);
244
253
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
245
254
  })();
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./components/AutoRefresh";
1
2
  export * from "./components/ErrorMessage";
2
3
  export * from "./components/FormAutocomplete";
3
4
  export * from "./components/FormCalendar";
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./components/AutoRefresh.js";
1
2
  export * from "./components/ErrorMessage.js";
2
3
  export * from "./components/FormAutocomplete.js";
3
4
  export * from "./components/FormCalendar.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soda-heroui",
3
- "version": "0.4.3",
3
+ "version": "0.5.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "publishConfig": {
29
29
  "access": "public",
30
- "registry": "https://registry.npmjs.org/"
30
+ "registry": "https://registry.npmjs.com/"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",
@@ -38,7 +38,8 @@
38
38
  "@internationalized/date": "^3.7.0",
39
39
  "@tanstack/react-form": "^1.3.0",
40
40
  "deepsea-tools": "5.25.1",
41
- "soda-type": "6.1.1",
41
+ "soda-type": "6.2.0",
42
+ "soda-hooks": "6.8.0",
42
43
  "soda-tanstack-form": "0.1.0"
43
44
  },
44
45
  "devDependencies": {
@@ -0,0 +1,36 @@
1
+ import { FC, ReactNode } from "react"
2
+ import { Button, PressEvent, addToast } from "@heroui/react"
3
+ import { useAutoRefresh } from "soda-hooks"
4
+ import { FirstParameter } from "soda-type"
5
+
6
+ export interface AutoRefreshProps extends FirstParameter<typeof addToast> {
7
+ onRefresh?: () => void
8
+ children?: ReactNode
9
+ }
10
+
11
+ export const AutoRefresh: FC<AutoRefreshProps> = ({ children, onRefresh, ...rest }) => {
12
+ if (process.env.NODE_ENV === "development") return children
13
+
14
+ function onPress(e: PressEvent) {
15
+ const closeButton = e.target.parentElement?.querySelector(`[aria-label="关闭"]`) as HTMLButtonElement
16
+ closeButton?.click()
17
+ onRefresh?.()
18
+ }
19
+
20
+ useAutoRefresh(() =>
21
+ addToast({
22
+ title: "检测到页面更新",
23
+ description: "为了最佳的体验,请刷新页面",
24
+ color: "warning",
25
+ timeout: Infinity,
26
+ endContent: (
27
+ <Button color="warning" size="sm" variant="flat" onPress={onPress}>
28
+ 刷新
29
+ </Button>
30
+ ),
31
+ ...rest,
32
+ }),
33
+ )
34
+
35
+ return children
36
+ }
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "@/components/AutoRefresh"
1
2
  export * from "@/components/ErrorMessage"
2
3
  export * from "@/components/FormAutocomplete"
3
4
  export * from "@/components/FormCalendar"
package/tsconfig.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "module": "ESNext",
10
10
  "moduleResolution": "Bundler",
11
11
  "paths": {
12
- "@/*": ["./src/*"]
12
+ "@/*": ["src/*"]
13
13
  }
14
14
  },
15
15
  "include": ["src"]