@blockscout/ui-toolkit 2.8.1-alpha.1 → 2.8.1-alpha.2
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
import { FormFieldPropsBase } from './types';
|
|
4
|
+
import { UrlValidatorParams } from '../validators/url';
|
|
4
5
|
declare const FormFieldUrlContent: <FormFields extends FieldValues>(props: FormFieldPropsBase<FormFields> & {
|
|
5
|
-
|
|
6
|
+
urlValidatorParams?: UrlValidatorParams;
|
|
6
7
|
}) => React.JSX.Element;
|
|
7
8
|
export declare const FormFieldUrl: typeof FormFieldUrlContent;
|
|
8
9
|
export {};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type UrlScheme = 'http' | 'https' | 'ws' | 'wss';
|
|
2
|
+
export interface UrlValidatorParams {
|
|
3
|
+
loose?: boolean;
|
|
4
|
+
schemes?: Array<UrlScheme>;
|
|
5
|
+
}
|
|
6
|
+
export declare function urlValidator({ loose, schemes }?: UrlValidatorParams): (value: string | undefined) => true | "Incorrect URL";
|
|
2
7
|
export declare const DOMAIN_REGEXP: RegExp;
|
|
3
8
|
export declare function domainValidator(value: string | undefined): true | "Incorrect domain";
|
package/dist/index.js
CHANGED
|
@@ -2613,13 +2613,13 @@ const co = B("NEXT_PUBLIC_APP_PORT"), Us = B("NEXT_PUBLIC_APP_PROTOCOL"), Fs = B
|
|
|
2613
2613
|
enhancedDataEnabled: B("NEXT_PUBLIC_SEO_ENHANCED_DATA_ENABLED") === "true"
|
|
2614
2614
|
}
|
|
2615
2615
|
});
|
|
2616
|
-
function zo(e) {
|
|
2617
|
-
return function(
|
|
2618
|
-
if (!
|
|
2616
|
+
function zo({ loose: e, schemes: t = ["https", "http"] } = {}) {
|
|
2617
|
+
return function(r) {
|
|
2618
|
+
if (!r)
|
|
2619
2619
|
return !0;
|
|
2620
2620
|
try {
|
|
2621
|
-
const
|
|
2622
|
-
return new URL(
|
|
2621
|
+
const n = !e || t.findIndex((i) => r.startsWith(`${i}://`)) !== -1 ? r : `${t[0]}://${r}`;
|
|
2622
|
+
return new URL(n), !0;
|
|
2623
2623
|
} catch {
|
|
2624
2624
|
return "Incorrect URL";
|
|
2625
2625
|
}
|
|
@@ -15299,11 +15299,11 @@ const Nb = ({
|
|
|
15299
15299
|
...e.rules,
|
|
15300
15300
|
validate: {
|
|
15301
15301
|
...(r = e.rules) == null ? void 0 : r.validate,
|
|
15302
|
-
url: zo(e.
|
|
15302
|
+
url: zo(e.urlValidatorParams)
|
|
15303
15303
|
}
|
|
15304
15304
|
};
|
|
15305
15305
|
},
|
|
15306
|
-
[e.rules, e.
|
|
15306
|
+
[e.rules, e.urlValidatorParams]
|
|
15307
15307
|
);
|
|
15308
15308
|
return /* @__PURE__ */ h(An, { ...e, rules: t });
|
|
15309
15309
|
}, s3 = O.memo(Vb);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockscout/ui-toolkit",
|
|
3
|
-
"version": "2.8.1-alpha.
|
|
3
|
+
"version": "2.8.1-alpha.2",
|
|
4
4
|
"description": "A comprehensive collection of reusable Chakra UI components and theme system for Blockscout's projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|