soda-heroui 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -63,9 +63,6 @@ var __webpack_modules__ = {
63
63
  "@/utils/getTimeValue": function(module) {
64
64
  module.exports = require("./utils/getTimeValue.cjs");
65
65
  },
66
- "@/utils/isFieldInvalid": function(module) {
67
- module.exports = require("./utils/isFieldInvalid.cjs");
68
- },
69
66
  "@/utils/parseTime": function(module) {
70
67
  module.exports = require("./utils/parseTime.cjs");
71
68
  }
@@ -239,16 +236,10 @@ var __webpack_exports__ = {};
239
236
  return _utils_getTimeValue__WEBPACK_IMPORTED_MODULE_20__[key];
240
237
  }).bind(0, __WEBPACK_IMPORT_KEY__);
241
238
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
242
- var _utils_isFieldInvalid__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__("@/utils/isFieldInvalid");
243
- var __WEBPACK_REEXPORT_OBJECT__ = {};
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];
246
- }).bind(0, __WEBPACK_IMPORT_KEY__);
247
- __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
248
- var _utils_parseTime__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__("@/utils/parseTime");
239
+ var _utils_parseTime__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__("@/utils/parseTime");
249
240
  var __WEBPACK_REEXPORT_OBJECT__ = {};
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];
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];
252
243
  }).bind(0, __WEBPACK_IMPORT_KEY__);
253
244
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
254
245
  })();
package/dist/index.d.ts CHANGED
@@ -19,5 +19,4 @@ export * from "./components/FormTextarea";
19
19
  export * from "./components/FormTimeInput";
20
20
  export * from "./utils/getFieldProps";
21
21
  export * from "./utils/getTimeValue";
22
- export * from "./utils/isFieldInvalid";
23
22
  export * from "./utils/parseTime";
package/dist/index.js CHANGED
@@ -19,5 +19,4 @@ export * from "./components/FormTextarea.js";
19
19
  export * from "./components/FormTimeInput.js";
20
20
  export * from "./utils/getFieldProps.js";
21
21
  export * from "./utils/getTimeValue.js";
22
- export * from "./utils/isFieldInvalid.js";
23
22
  export * from "./utils/parseTime.js";
@@ -27,18 +27,18 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  getFieldProps: ()=>getFieldProps
28
28
  });
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const external_soda_tanstack_form_namespaceObject = require("soda-tanstack-form");
30
31
  const ErrorMessage_cjs_namespaceObject = require("../components/ErrorMessage.cjs");
31
- const external_isFieldInvalid_cjs_namespaceObject = require("./isFieldInvalid.cjs");
32
32
  function getFieldProps(field, noErrorMessage) {
33
33
  return noErrorMessage ? {
34
34
  onBlur: field.handleBlur,
35
- isInvalid: (0, external_isFieldInvalid_cjs_namespaceObject.isFieldInvalid)(field)
35
+ isInvalid: (0, external_soda_tanstack_form_namespaceObject.isFieldInvalid)(field)
36
36
  } : {
37
37
  onBlur: field.handleBlur,
38
38
  errorMessage: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ErrorMessage_cjs_namespaceObject.ErrorMessage, {
39
39
  data: field.state.meta.errors
40
40
  }),
41
- isInvalid: (0, external_isFieldInvalid_cjs_namespaceObject.isFieldInvalid)(field)
41
+ isInvalid: (0, external_soda_tanstack_form_namespaceObject.isFieldInvalid)(field)
42
42
  };
43
43
  }
44
44
  exports.getFieldProps = __webpack_exports__.getFieldProps;
@@ -1,16 +1,16 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_soda_tanstack_form_406de417__ from "soda-tanstack-form";
2
3
  import * as __WEBPACK_EXTERNAL_MODULE__components_ErrorMessage_js_8cec684c__ from "../components/ErrorMessage.js";
3
- import * as __WEBPACK_EXTERNAL_MODULE__isFieldInvalid_js_3e6d6d85__ from "./isFieldInvalid.js";
4
4
  function getFieldProps(field, noErrorMessage) {
5
5
  return noErrorMessage ? {
6
6
  onBlur: field.handleBlur,
7
- isInvalid: (0, __WEBPACK_EXTERNAL_MODULE__isFieldInvalid_js_3e6d6d85__.isFieldInvalid)(field)
7
+ isInvalid: (0, __WEBPACK_EXTERNAL_MODULE_soda_tanstack_form_406de417__.isFieldInvalid)(field)
8
8
  } : {
9
9
  onBlur: field.handleBlur,
10
10
  errorMessage: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__components_ErrorMessage_js_8cec684c__.ErrorMessage, {
11
11
  data: field.state.meta.errors
12
12
  }),
13
- isInvalid: (0, __WEBPACK_EXTERNAL_MODULE__isFieldInvalid_js_3e6d6d85__.isFieldInvalid)(field)
13
+ isInvalid: (0, __WEBPACK_EXTERNAL_MODULE_soda_tanstack_form_406de417__.isFieldInvalid)(field)
14
14
  };
15
15
  }
16
16
  export { getFieldProps };
package/package.json CHANGED
@@ -1,63 +1,64 @@
1
1
  {
2
- "name": "soda-heroui",
3
- "version": "0.5.4",
4
- "description": "",
5
- "type": "module",
6
- "exports": {
7
- ".": {
8
- "types": "./dist/index.d.ts",
9
- "import": "./dist/index.js",
10
- "require": "./dist/index.cjs"
2
+ "name": "soda-heroui",
3
+ "version": "0.6.0",
4
+ "description": "",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.cjs"
11
+ }
12
+ },
13
+ "main": "./dist/index.cjs",
14
+ "module": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "sideEffects": false,
17
+ "scripts": {
18
+ "dev": "rslib build --watch",
19
+ "build": "rslib build",
20
+ "prebuild": "tsx scripts/export.ts",
21
+ "prepublishOnly": "npm run build",
22
+ "lint": "prettier --write ."
23
+ },
24
+ "keywords": [],
25
+ "authors": [
26
+ "lurongv@qq.com"
27
+ ],
28
+ "license": "MIT",
29
+ "files": [
30
+ "compiled",
31
+ "dist",
32
+ "src",
33
+ "tsconfig.json"
34
+ ],
35
+ "publishConfig": {
36
+ "access": "public",
37
+ "registry": "https://registry.npmjs.com/"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/1adybug/deepsea.git"
42
+ },
43
+ "homepage": "https://github.com/1adybug/deepsea/tree/main/packages/soda-heroui",
44
+ "dependencies": {
45
+ "@internationalized/date": "^3.7.0",
46
+ "@tanstack/react-form": "^1.3.0",
47
+ "deepsea-tools": "workspace:*",
48
+ "soda-hooks": "workspace:*",
49
+ "soda-tanstack-form": "workspace:*",
50
+ "soda-type": "workspace:*"
51
+ },
52
+ "devDependencies": {
53
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
54
+ "@react-types/shared": "^3.28.0",
55
+ "glob": "^11.0.1",
56
+ "prettier": "^3.5.3",
57
+ "typescript": "^5.8.3"
58
+ },
59
+ "peerDependencies": {
60
+ "@heroui/react": ">=2",
61
+ "@types/react": ">=18.3.18",
62
+ "react": ">=18.3.1"
11
63
  }
12
- },
13
- "main": "./dist/index.cjs",
14
- "module": "./dist/index.js",
15
- "types": "./dist/index.d.ts",
16
- "sideEffects": false,
17
- "keywords": [],
18
- "authors": [
19
- "lurongv@qq.com"
20
- ],
21
- "license": "MIT",
22
- "files": [
23
- "compiled",
24
- "dist",
25
- "src",
26
- "tsconfig.json"
27
- ],
28
- "publishConfig": {
29
- "access": "public",
30
- "registry": "https://registry.npmjs.com/"
31
- },
32
- "repository": {
33
- "type": "git",
34
- "url": "git+https://github.com/1adybug/deepsea.git"
35
- },
36
- "homepage": "https://github.com/1adybug/deepsea/tree/main/packages/soda-heroui",
37
- "dependencies": {
38
- "@internationalized/date": "^3.7.0",
39
- "@tanstack/react-form": "^1.3.0",
40
- "deepsea-tools": "5.26.1",
41
- "soda-type": "6.2.0",
42
- "soda-hooks": "6.8.2",
43
- "soda-tanstack-form": "0.1.0"
44
- },
45
- "devDependencies": {
46
- "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
47
- "@react-types/shared": "^3.28.0",
48
- "glob": "^11.0.1",
49
- "prettier": "^3.5.3",
50
- "typescript": "^5.8.3"
51
- },
52
- "peerDependencies": {
53
- "@heroui/react": ">=2",
54
- "@types/react": ">=18.3.18",
55
- "react": ">=18.3.1"
56
- },
57
- "scripts": {
58
- "dev": "rslib build --watch",
59
- "build": "rslib build",
60
- "prebuild": "tsx scripts/export.ts",
61
- "lint": "prettier --write ."
62
- }
63
- }
64
+ }
@@ -1,36 +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
- }
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
@@ -19,5 +19,4 @@ export * from "@/components/FormTextarea"
19
19
  export * from "@/components/FormTimeInput"
20
20
  export * from "@/utils/getFieldProps"
21
21
  export * from "@/utils/getTimeValue"
22
- export * from "@/utils/isFieldInvalid"
23
22
  export * from "@/utils/parseTime"
@@ -1,10 +1,8 @@
1
1
  import { JSX } from "react"
2
- import { Field } from "soda-tanstack-form"
2
+ import { Field, isFieldInvalid } from "soda-tanstack-form"
3
3
 
4
4
  import { ErrorMessage } from "@/components/ErrorMessage"
5
5
 
6
- import { isFieldInvalid } from "./isFieldInvalid"
7
-
8
6
  export interface FieldProps {
9
7
  onBlur: () => void
10
8
  errorMessage: JSX.Element
@@ -1,38 +0,0 @@
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
- isFieldInvalid: ()=>isFieldInvalid
28
- });
29
- function isFieldInvalid(field) {
30
- return field.state.meta.errors.some(Boolean);
31
- }
32
- exports.isFieldInvalid = __webpack_exports__.isFieldInvalid;
33
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
34
- "isFieldInvalid"
35
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
36
- Object.defineProperty(exports, '__esModule', {
37
- value: true
38
- });
@@ -1,2 +0,0 @@
1
- import { Field } from "soda-tanstack-form";
2
- export declare function isFieldInvalid(field: Field<any>): boolean;
@@ -1,4 +0,0 @@
1
- function isFieldInvalid(field) {
2
- return field.state.meta.errors.some(Boolean);
3
- }
4
- export { isFieldInvalid };
@@ -1,5 +0,0 @@
1
- import { Field } from "soda-tanstack-form"
2
-
3
- export function isFieldInvalid(field: Field<any>) {
4
- return field.state.meta.errors.some(Boolean)
5
- }