@avenirs-esr/avenirs-dsav 0.1.230 → 0.1.232

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.
@@ -3,11 +3,19 @@ export declare const AvRadioButtonSetStub: import("vue").DefineComponent<import(
3
3
  name: StringConstructor;
4
4
  inline: BooleanConstructor;
5
5
  small: BooleanConstructor;
6
+ errorMessage: {
7
+ type: StringConstructor;
8
+ required: false;
9
+ };
6
10
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
7
11
  modelValue: StringConstructor;
8
12
  name: StringConstructor;
9
13
  inline: BooleanConstructor;
10
14
  small: BooleanConstructor;
15
+ errorMessage: {
16
+ type: StringConstructor;
17
+ required: false;
18
+ };
11
19
  }>> & Readonly<{
12
20
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
13
21
  }>, {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),e=t.defineComponent({name:"AvRadioButtonSet",props:{modelValue:String,name:String,inline:Boolean,small:Boolean},emits:["update:modelValue"],template:'<div class="av-radio-button-set-stub" data-testid="av-radio-button-set-stub"><slot /></div>'});exports.AvRadioButtonSetStub=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),e=t.defineComponent({name:"AvRadioButtonSet",props:{modelValue:String,name:String,inline:Boolean,small:Boolean,errorMessage:{type:String,required:!1}},emits:["update:modelValue"],template:'<div class="av-radio-button-set-stub" data-testid="av-radio-button-set-stub"><slot /></div>'});exports.AvRadioButtonSetStub=e;
@@ -5,7 +5,8 @@ const o = t({
5
5
  modelValue: String,
6
6
  name: String,
7
7
  inline: Boolean,
8
- small: Boolean
8
+ small: Boolean,
9
+ errorMessage: { type: String, required: !1 }
9
10
  },
10
11
  emits: ["update:modelValue"],
11
12
  template: '<div class="av-radio-button-set-stub" data-testid="av-radio-button-set-stub"><slot /></div>'
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(t){const e=(t==null?void 0:t.trim())??"";if(!e)return!1;try{const r=new URL(e);return["http:","https:"].includes(r.protocol.toLowerCase())}catch{return!1}}exports.isValidLink=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(e){if(!e||e.includes(" "))return!1;try{const r=new URL(e);if(!["http:","https:"].includes(r.protocol))return!1;const t=r.hostname.toLowerCase().split(".");if(t.length<2||t[0]==="www"&&t.length<3||t.includes(""))return!1;const s=t.at(-1)??"";return/^[a-z]{2,63}$/.test(s)}catch{return!1}}exports.isValidLink=n;
@@ -1,14 +1,19 @@
1
- function o(t) {
2
- const r = (t == null ? void 0 : t.trim()) ?? "";
3
- if (!r)
1
+ function n(e) {
2
+ if (!e || e.includes(" "))
4
3
  return !1;
5
4
  try {
6
- const e = new URL(r);
7
- return ["http:", "https:"].includes(e.protocol.toLowerCase());
5
+ const r = new URL(e);
6
+ if (!["http:", "https:"].includes(r.protocol))
7
+ return !1;
8
+ const t = r.hostname.toLowerCase().split(".");
9
+ if (t.length < 2 || t[0] === "www" && t.length < 3 || t.includes(""))
10
+ return !1;
11
+ const s = t.at(-1) ?? "";
12
+ return /^[a-z]{2,63}$/.test(s);
8
13
  } catch {
9
14
  return !1;
10
15
  }
11
16
  }
12
17
  export {
13
- o as isValidLink
18
+ n as isValidLink
14
19
  };
@@ -1,20 +1,28 @@
1
1
  /**
2
2
  * Returns the link validation status.
3
- * By default, only absolute HTTP/HTTPS URLs are accepted.
3
+ * Only absolute HTTP/HTTPS URLs are accepted.
4
+ * The input must not contain spaces, the hostname must include at least one dot,
5
+ * and the final TLD must contain only letters with a length between 2 and 63.
6
+ * Hostnames starting with "www" must include at least 3 labels (e.g. www.example.com).
4
7
  *
5
8
  * @param {string} link - The URL string to validate.
6
9
  * @returns {boolean} True if the link is valid, false otherwise.
7
10
  *
8
11
  * @example
9
12
  * isValidLink('https://example.com') // returns true
13
+ * isValidLink('https://www.example.com') // returns true
14
+ * isValidLink('http://www.example') // returns false
10
15
  * isValidLink('http://example.com/path') // returns true
11
16
  * isValidLink('') // returns false
12
17
  * isValidLink('hello world') // returns false
18
+ * isValidLink(' https://example.com ') // returns false
19
+ * isValidLink('https://example .com ') // returns false
13
20
  * isValidLink('javascript:alert(1)') // returns false
21
+ * isValidLink('http://w.e') // returns false
14
22
  * isValidLink('/my-page') // returns false (relative URL not allowed by default)
15
23
  *
16
24
  * @remarks
17
- * The function uses the URL constructor for validation, which ensures that the link is well-formed.
18
- * It also checks that the protocol is either 'http:' or 'https:' to prevent potentially dangerous links (e.g., 'javascript:').
25
+ * The function uses the URL constructor for validation and then applies additional
26
+ * hostname/TLD checks to reject incomplete or malformed domains.
19
27
  */
20
28
  export declare function isValidLink(link?: string): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@avenirs-esr/avenirs-dsav",
3
3
  "type": "module",
4
- "version": "0.1.230",
4
+ "version": "0.1.232",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/avenirs-esr/avenirs-dsav.git"