@fils/sanity-components 0.0.2 → 0.0.3

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/lib/main.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './components/core/SEO';
2
2
  export * from './config/utils';
3
+ export * from './validators/utils';
package/lib/main.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './components/core/SEO';
2
2
  export * from './config/utils';
3
+ export * from './validators/utils';
@@ -0,0 +1,2 @@
1
+ import { TextRule, UrlRule } from "sanity";
2
+ export declare function urlValidation(): (rule: UrlRule | TextRule) => import("sanity").StringRule | UrlRule;
@@ -0,0 +1,9 @@
1
+ export function urlValidation() {
2
+ return (rule) => rule.custom((url) => {
3
+ if (typeof url === 'undefined') {
4
+ return true; // Allow undefined values
5
+ }
6
+ const regex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;
7
+ return regex.test(url) ? true : 'Not a valid URL';
8
+ });
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fils/sanity-components",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Fil's Components for Sanity Back-Ends",
5
5
  "main": "lib/main.js",
6
6
  "repository": "git@github.com:fil-studio/fils.git",