@conform-to/valibot 1.16.0 → 1.17.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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ╚══════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
8
8
  ```
9
9
 
10
- Version 1.16.0 / License MIT / Copyright (c) 2025 Edmund Hung
10
+ Version 1.17.0 / License MIT / Copyright (c) 2025 Edmund Hung
11
11
 
12
12
  Progressively enhance HTML forms with React. Build resilient, type-safe forms with no hassle using web standards.
13
13
 
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
6
6
 
7
- var keys = ['required', 'minLength', 'maxLength', 'min', 'max', 'step', 'multiple', 'pattern'];
7
+ var keys = ['required', 'minLength', 'maxLength', 'min', 'max', 'step', 'multiple', 'pattern', 'accept'];
8
8
  function getValibotConstraint(schema) {
9
9
  function updateConstraint(schema, data) {
10
10
  var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
@@ -119,6 +119,16 @@ function getValibotConstraint(schema) {
119
119
  // @ts-expect-error
120
120
  updateConstraint(schema.items[i], data, "".concat(name, "[").concat(i, "]"));
121
121
  }
122
+ } else if (schema.type === 'file' || schema.type === 'blob') {
123
+ var _schema$pipe5;
124
+ // @ts-expect-error
125
+ var mimeTypeValidation = (_schema$pipe5 = schema.pipe) === null || _schema$pipe5 === void 0 ? void 0 : _schema$pipe5.find(
126
+ // @ts-expect-error
127
+ v => 'type' in v && v.type === 'mime_type');
128
+ if (mimeTypeValidation && 'requirement' in mimeTypeValidation) {
129
+ var requirement = mimeTypeValidation.requirement;
130
+ constraint.accept = requirement.join();
131
+ }
122
132
  } else ;
123
133
  }
124
134
  var result = {};
@@ -1,6 +1,6 @@
1
1
  import { objectSpread2 as _objectSpread2 } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
2
 
3
- var keys = ['required', 'minLength', 'maxLength', 'min', 'max', 'step', 'multiple', 'pattern'];
3
+ var keys = ['required', 'minLength', 'maxLength', 'min', 'max', 'step', 'multiple', 'pattern', 'accept'];
4
4
  function getValibotConstraint(schema) {
5
5
  function updateConstraint(schema, data) {
6
6
  var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
@@ -115,6 +115,16 @@ function getValibotConstraint(schema) {
115
115
  // @ts-expect-error
116
116
  updateConstraint(schema.items[i], data, "".concat(name, "[").concat(i, "]"));
117
117
  }
118
+ } else if (schema.type === 'file' || schema.type === 'blob') {
119
+ var _schema$pipe5;
120
+ // @ts-expect-error
121
+ var mimeTypeValidation = (_schema$pipe5 = schema.pipe) === null || _schema$pipe5 === void 0 ? void 0 : _schema$pipe5.find(
122
+ // @ts-expect-error
123
+ v => 'type' in v && v.type === 'mime_type');
124
+ if (mimeTypeValidation && 'requirement' in mimeTypeValidation) {
125
+ var requirement = mimeTypeValidation.requirement;
126
+ constraint.accept = requirement.join();
127
+ }
118
128
  } else ;
119
129
  }
120
130
  var result = {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Conform helpers for integrating with Valibot",
4
4
  "homepage": "https://conform.guide",
5
5
  "license": "MIT",
6
- "version": "1.16.0",
6
+ "version": "1.17.0",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.mjs",
9
9
  "types": "./dist/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "url": "https://github.com/edmundhung/conform/issues"
37
37
  },
38
38
  "dependencies": {
39
- "@conform-to/dom": "1.16.0"
39
+ "@conform-to/dom": "1.17.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "valibot": ">= 0.32.0"