@htmlbricks/hb-input-checkbox 0.4.37 → 0.5.9

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@htmlbricks/hb-input-checkbox",
3
3
  "displayName": "Svelte-Bootstrap Checkbox Input WebComponent",
4
4
  "description": "Svelte-Bootstrap Checkbox Input WebComponent",
5
- "version": "0.4.37",
5
+ "version": "0.5.9",
6
6
  "main": "release/release.js",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -20,8 +20,9 @@
20
20
  "start": "sirv dist",
21
21
  "dev": "rm -rf ./dist && rollup -c -w",
22
22
  "build": "rm -rf ./dist && rollup -c",
23
- "copydest": "rm -rf release && mkdir -p release && cp dist/release.js ./release/ && cp dist/release.js.map ./release/",
24
- "build:release": "PRODUCTION=true npm run build && npm run copydest",
23
+ "generate-schema": "ts-json-schema-generator --path 'app/types/webcomponent.type.d.ts' --type 'Component' > app/types/webcomponent.type.d.json",
24
+ "copydest": "rm -rf release && mkdir -p release && mkdir -p release && cp dist/* ./release/",
25
+ "build:release": "PRODUCTION=true npm run build && npm run generate-schema && npm run copydest",
25
26
  "prepublish": "npm run build:release"
26
27
  },
27
28
  "devDependencies": {
@@ -66,5 +67,5 @@
66
67
  "webcomponents"
67
68
  ],
68
69
  "contributors": [],
69
- "gitHead": "9e8cca835d3d110d6ac6be1ba1e271cdd1e49cce"
70
+ "gitHead": "00824fc0d2bcdf1f4a8e9d9cc9edf12dd925bae4"
70
71
  }
@@ -0,0 +1,105 @@
1
+ {
2
+ "$ref": "#/definitions/Component",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "definitions": {
5
+ "Component": {
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "schemaentry": {
9
+ "$ref": "#/definitions/FormSchemaEntry"
10
+ },
11
+ "setvalid": {
12
+ "type": "boolean"
13
+ },
14
+ "setvalue": {
15
+ "type": "boolean"
16
+ },
17
+ "showvalidation": {
18
+ "enum": [
19
+ "yes",
20
+ "no"
21
+ ],
22
+ "type": "string"
23
+ }
24
+ },
25
+ "required": [
26
+ "setvalue",
27
+ "setvalid",
28
+ "showvalidation",
29
+ "schemaentry"
30
+ ],
31
+ "type": "object"
32
+ },
33
+ "FormSchemaEntry": {
34
+ "additionalProperties": false,
35
+ "properties": {
36
+ "dependencies": {
37
+ "description": "This form control will show only if these dependencies are satisfied.",
38
+ "items": {
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "id": {
42
+ "type": "string"
43
+ },
44
+ "values": {
45
+ "items": {},
46
+ "type": "array"
47
+ }
48
+ },
49
+ "required": [
50
+ "id"
51
+ ],
52
+ "type": "object"
53
+ },
54
+ "type": "array"
55
+ },
56
+ "id": {
57
+ "description": "This will be both the key of the object when submitting the form's data, and also the id in the DOM.",
58
+ "type": "string"
59
+ },
60
+ "label": {
61
+ "description": "The descriptive label that will show alongside the form control.",
62
+ "type": "string"
63
+ },
64
+ "params": {
65
+ "description": "Other parameters that may be specific to a certain kind of form control.",
66
+ "type": "object"
67
+ },
68
+ "placeholder": {
69
+ "type": "string"
70
+ },
71
+ "readonly": {
72
+ "type": "boolean"
73
+ },
74
+ "required": {
75
+ "description": "This doesn't matter if the dependencies requirements aren't met.",
76
+ "type": "boolean"
77
+ },
78
+ "type": {
79
+ "description": "Identifies the component type that will be used, available default ones are: - text - number - email - select \t- radio - checkbox - textarea",
80
+ "type": "string"
81
+ },
82
+ "validationRegex": {
83
+ "type": "string"
84
+ },
85
+ "validationTip": {
86
+ "description": "Shows if value is not valid.",
87
+ "type": "string"
88
+ },
89
+ "value": {
90
+ "description": "Optional default value.",
91
+ "type": [
92
+ "string",
93
+ "number",
94
+ "boolean"
95
+ ]
96
+ }
97
+ },
98
+ "required": [
99
+ "id",
100
+ "type"
101
+ ],
102
+ "type": "object"
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,70 @@
1
+ export type FormSchemaEntry = {
2
+ /**
3
+ * This will be both the key of the object when submitting the form's data,
4
+ * and also the id in the DOM.
5
+ */
6
+ id: string;
7
+
8
+ /**
9
+ * Identifies the component type that will be used,
10
+ * available default ones are:
11
+ * - text
12
+ * - number
13
+ * - email
14
+ * - select
15
+ * - radio
16
+ * - checkbox
17
+ * - textarea
18
+ */
19
+ type: string;
20
+
21
+ /**
22
+ * The descriptive label that will show alongside the form control.
23
+ */
24
+ label?: string;
25
+
26
+ /**
27
+ * Optional default value.
28
+ */
29
+ value?: string | number | boolean;
30
+
31
+ /**
32
+ * This form control will show only if these dependencies are satisfied.
33
+ */
34
+ dependencies?: {
35
+ id: string;
36
+ values?: any[];
37
+ }[];
38
+
39
+ readonly?: boolean;
40
+
41
+ /**
42
+ * This doesn't matter if the dependencies requirements aren't met.
43
+ */
44
+ required?: boolean;
45
+
46
+ validationRegex?: string;
47
+ /**
48
+ * Shows if value is not valid.
49
+ */
50
+ validationTip?: string;
51
+
52
+ placeholder?: string;
53
+
54
+ /**
55
+ * Other parameters that may be specific to a certain kind of form control.
56
+ */
57
+ params?: Record<string, any>;
58
+ };
59
+
60
+ export type FormSchema = FormSchemaEntry[];
61
+
62
+ export type FormRendererProps = {
63
+ schema: FormSchema;
64
+ };
65
+ export type Component = {
66
+ setvalue: boolean;
67
+ setvalid: boolean;
68
+ showvalidation: "yes" | "no";
69
+ schemaentry: FormSchemaEntry;
70
+ };