@htmlbricks/hb-input-radio 0.71.32 → 0.71.33
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 +14 -54
- package/manifest.json +64 -17
- package/package.json +2 -2
- package/types/webcomponent.type.d.json +60 -14
- package/types/webcomponent.type.d.ts +11 -33
- package/types/webcomponent_events.type.d.json +2 -1
package/README.md
CHANGED
|
@@ -2,62 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## Description
|
|
4
4
|
|
|
5
|
-
Radio group built from
|
|
5
|
+
Radio group built from **`schemaentry.params`** as **`InputRadioParams`**: optional **`options`** array of **`InputRadioOption`** (`value`, optional `label`). The shared native `name` is derived from the field `id`. Parses JSON `schemaentry` for initial `value` and supports required validation with Bulma `help is-danger` when `show_validation` is `yes` and invalid. Dispatches **`setVal`** with the selected string `value`, `valid`, and `id` whenever the choice changes.
|
|
6
6
|
|
|
7
7
|
## Styling (Bulma)
|
|
8
8
|
|
|
9
9
|
Shadow bundle: `form/shared`, `form/input-textarea`, `form/checkbox-radio`, `form/tools`. Markup uses Bulma `radios` / `radio` and host outline when invalid.
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
label?: string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Optional default value.
|
|
28
|
-
*/
|
|
29
|
-
value?: string | number | boolean;
|
|
30
|
-
|
|
31
|
-
readonly?: boolean;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* This doesn't matter if the dependencies requirements aren't met.
|
|
35
|
-
*/
|
|
36
|
-
required?: boolean;
|
|
37
|
-
|
|
38
|
-
validationRegex?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Shows if value is not valid.
|
|
41
|
-
*/
|
|
42
|
-
validationTip?: string;
|
|
43
|
-
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Other parameters that may be specific to a certain kind of form control.
|
|
48
|
-
*/
|
|
49
|
-
params?: Record<string, any>;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type Component = {
|
|
53
|
-
id?: string;
|
|
54
|
-
style?: string;
|
|
55
|
-
|
|
56
|
-
show_validation?: "yes" | "no";
|
|
57
|
-
schemaentry: FormSchemaEntry | undefined;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export type Events = {
|
|
61
|
-
setVal: { value: string | undefined; valid: boolean; id: string | undefined };
|
|
62
|
-
};
|
|
63
|
-
```
|
|
11
|
+
## `schemaentry.params` (`InputRadioParams`)
|
|
12
|
+
|
|
13
|
+
| Key | Type | Description |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `options` | `InputRadioOption[]` | Each entry: **`value`**, optional **`label`** (falls back to `value` in the UI). |
|
|
16
|
+
|
|
17
|
+
## Typings
|
|
18
|
+
|
|
19
|
+
**`types/webcomponent.type.d.ts`** — `InputRadioParams`, `InputRadioOption`, `FormSchemaEntry`, `Component`, `Events`.
|
|
20
|
+
|
|
21
|
+
## Events
|
|
22
|
+
|
|
23
|
+
- **`setVal`** — `{ value: string | undefined; valid: boolean; id: string }`
|
package/manifest.json
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"required": [
|
|
24
|
-
"valid"
|
|
24
|
+
"valid",
|
|
25
|
+
"id"
|
|
25
26
|
],
|
|
26
27
|
"type": "object"
|
|
27
28
|
}
|
|
@@ -59,24 +60,48 @@
|
|
|
59
60
|
},
|
|
60
61
|
"type": "object"
|
|
61
62
|
},
|
|
63
|
+
"FormSchemaDependency": {
|
|
64
|
+
"additionalProperties": false,
|
|
65
|
+
"properties": {
|
|
66
|
+
"id": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
},
|
|
69
|
+
"values": {
|
|
70
|
+
"items": {
|
|
71
|
+
"type": [
|
|
72
|
+
"string",
|
|
73
|
+
"number",
|
|
74
|
+
"boolean"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"type": "array"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"required": [
|
|
81
|
+
"id"
|
|
82
|
+
],
|
|
83
|
+
"type": "object"
|
|
84
|
+
},
|
|
62
85
|
"FormSchemaEntry": {
|
|
63
86
|
"additionalProperties": false,
|
|
64
87
|
"properties": {
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"items": {
|
|
90
|
+
"$ref": "#/definitions/FormSchemaDependency"
|
|
91
|
+
},
|
|
92
|
+
"type": "array"
|
|
93
|
+
},
|
|
65
94
|
"disabled": {
|
|
66
|
-
"description": "When true, the native control is disabled and non-interactive.",
|
|
67
95
|
"type": "boolean"
|
|
68
96
|
},
|
|
69
97
|
"id": {
|
|
70
|
-
"description": "This will be both the key of the object when submitting the form's data, and also the id in the DOM.",
|
|
71
98
|
"type": "string"
|
|
72
99
|
},
|
|
73
100
|
"label": {
|
|
74
|
-
"description": "The descriptive label that will show alongside the form control.",
|
|
75
101
|
"type": "string"
|
|
76
102
|
},
|
|
77
103
|
"params": {
|
|
78
|
-
"
|
|
79
|
-
"type": "object"
|
|
104
|
+
"$ref": "#/definitions/InputRadioParams"
|
|
80
105
|
},
|
|
81
106
|
"placeholder": {
|
|
82
107
|
"type": "string"
|
|
@@ -85,34 +110,56 @@
|
|
|
85
110
|
"type": "boolean"
|
|
86
111
|
},
|
|
87
112
|
"required": {
|
|
88
|
-
"description": "This doesn't matter if the dependencies requirements aren't met.",
|
|
89
113
|
"type": "boolean"
|
|
90
114
|
},
|
|
115
|
+
"type": {
|
|
116
|
+
"description": "Discriminator for `hb-form` rows (`row`, `text`, `number`, …). May be omitted on a standalone `schemaentry` when implied by the host tag.",
|
|
117
|
+
"type": "string"
|
|
118
|
+
},
|
|
91
119
|
"validationRegex": {
|
|
92
120
|
"type": "string"
|
|
93
121
|
},
|
|
94
122
|
"validationTip": {
|
|
95
|
-
"
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
"value": {}
|
|
126
|
+
},
|
|
127
|
+
"required": [
|
|
128
|
+
"id"
|
|
129
|
+
],
|
|
130
|
+
"type": "object"
|
|
131
|
+
},
|
|
132
|
+
"InputRadioOption": {
|
|
133
|
+
"additionalProperties": false,
|
|
134
|
+
"properties": {
|
|
135
|
+
"label": {
|
|
96
136
|
"type": "string"
|
|
97
137
|
},
|
|
98
138
|
"value": {
|
|
99
|
-
"
|
|
100
|
-
"type": [
|
|
101
|
-
"string",
|
|
102
|
-
"number",
|
|
103
|
-
"boolean"
|
|
104
|
-
]
|
|
139
|
+
"type": "string"
|
|
105
140
|
}
|
|
106
141
|
},
|
|
107
142
|
"required": [
|
|
108
|
-
"
|
|
143
|
+
"value"
|
|
109
144
|
],
|
|
110
145
|
"type": "object"
|
|
146
|
+
},
|
|
147
|
+
"InputRadioParams": {
|
|
148
|
+
"additionalProperties": false,
|
|
149
|
+
"properties": {
|
|
150
|
+
"options": {
|
|
151
|
+
"items": {
|
|
152
|
+
"$ref": "#/definitions/InputRadioOption"
|
|
153
|
+
},
|
|
154
|
+
"type": "array"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"type": "object"
|
|
111
158
|
}
|
|
112
159
|
}
|
|
113
160
|
}
|
|
114
161
|
},
|
|
115
|
-
"description": "Radio group
|
|
162
|
+
"description": "Radio group from `schemaentry.params` as `InputRadioParams`: optional `options` array of `InputRadioOption` (`value`, optional `label`); the native `name` matches the field `id`. Initial `value` is stringified from `schemaentry`. Required + `show_validation` use Bulma `radios` / `radio` and `help is-danger`. Dispatches `setVal` `{ value, valid, id }` when the selection changes. Theme `--bulma-*` on `:host`. Typings: `InputRadioParams`, `InputRadioOption`, `FormSchemaEntry`, `Component`, `Events`.",
|
|
116
163
|
"storybookArgs": {
|
|
117
164
|
"schemaentry": {
|
|
118
165
|
"control": {
|
|
@@ -297,5 +344,5 @@
|
|
|
297
344
|
"size": {},
|
|
298
345
|
"iifePath": "main.iife.js",
|
|
299
346
|
"repoName": "@htmlbricks/hb-input-radio",
|
|
300
|
-
"version": "0.71.
|
|
347
|
+
"version": "0.71.33"
|
|
301
348
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htmlbricks/hb-input-radio",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.33",
|
|
4
4
|
"contributors": [],
|
|
5
|
-
"description": "Radio group
|
|
5
|
+
"description": "Radio group from `schemaentry.params` as `InputRadioParams`: optional `options` array of `InputRadioOption` (`value`, optional `label`); the native `name` matches the field `id`. Initial `value` is stringified from `schemaentry`. Required + `show_validation` use Bulma `radios` / `radio` and `help is-danger`. Dispatches `setVal` `{ value, valid, id }` when the selection changes. Theme `--bulma-*` on `:host`. Typings: `InputRadioParams`, `InputRadioOption`, `FormSchemaEntry`, `Component`, `Events`.",
|
|
6
6
|
"licenses": [
|
|
7
7
|
{
|
|
8
8
|
"type": "Apache-2.0",
|
|
@@ -24,24 +24,48 @@
|
|
|
24
24
|
},
|
|
25
25
|
"type": "object"
|
|
26
26
|
},
|
|
27
|
+
"FormSchemaDependency": {
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"properties": {
|
|
30
|
+
"id": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"values": {
|
|
34
|
+
"items": {
|
|
35
|
+
"type": [
|
|
36
|
+
"string",
|
|
37
|
+
"number",
|
|
38
|
+
"boolean"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"type": "array"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": [
|
|
45
|
+
"id"
|
|
46
|
+
],
|
|
47
|
+
"type": "object"
|
|
48
|
+
},
|
|
27
49
|
"FormSchemaEntry": {
|
|
28
50
|
"additionalProperties": false,
|
|
29
51
|
"properties": {
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"items": {
|
|
54
|
+
"$ref": "#/definitions/FormSchemaDependency"
|
|
55
|
+
},
|
|
56
|
+
"type": "array"
|
|
57
|
+
},
|
|
30
58
|
"disabled": {
|
|
31
|
-
"description": "When true, the native control is disabled and non-interactive.",
|
|
32
59
|
"type": "boolean"
|
|
33
60
|
},
|
|
34
61
|
"id": {
|
|
35
|
-
"description": "This will be both the key of the object when submitting the form's data, and also the id in the DOM.",
|
|
36
62
|
"type": "string"
|
|
37
63
|
},
|
|
38
64
|
"label": {
|
|
39
|
-
"description": "The descriptive label that will show alongside the form control.",
|
|
40
65
|
"type": "string"
|
|
41
66
|
},
|
|
42
67
|
"params": {
|
|
43
|
-
"
|
|
44
|
-
"type": "object"
|
|
68
|
+
"$ref": "#/definitions/InputRadioParams"
|
|
45
69
|
},
|
|
46
70
|
"placeholder": {
|
|
47
71
|
"type": "string"
|
|
@@ -50,29 +74,51 @@
|
|
|
50
74
|
"type": "boolean"
|
|
51
75
|
},
|
|
52
76
|
"required": {
|
|
53
|
-
"description": "This doesn't matter if the dependencies requirements aren't met.",
|
|
54
77
|
"type": "boolean"
|
|
55
78
|
},
|
|
79
|
+
"type": {
|
|
80
|
+
"description": "Discriminator for `hb-form` rows (`row`, `text`, `number`, …). May be omitted on a standalone `schemaentry` when implied by the host tag.",
|
|
81
|
+
"type": "string"
|
|
82
|
+
},
|
|
56
83
|
"validationRegex": {
|
|
57
84
|
"type": "string"
|
|
58
85
|
},
|
|
59
86
|
"validationTip": {
|
|
60
|
-
"
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"value": {}
|
|
90
|
+
},
|
|
91
|
+
"required": [
|
|
92
|
+
"id"
|
|
93
|
+
],
|
|
94
|
+
"type": "object"
|
|
95
|
+
},
|
|
96
|
+
"InputRadioOption": {
|
|
97
|
+
"additionalProperties": false,
|
|
98
|
+
"properties": {
|
|
99
|
+
"label": {
|
|
61
100
|
"type": "string"
|
|
62
101
|
},
|
|
63
102
|
"value": {
|
|
64
|
-
"
|
|
65
|
-
"type": [
|
|
66
|
-
"string",
|
|
67
|
-
"number",
|
|
68
|
-
"boolean"
|
|
69
|
-
]
|
|
103
|
+
"type": "string"
|
|
70
104
|
}
|
|
71
105
|
},
|
|
72
106
|
"required": [
|
|
73
|
-
"
|
|
107
|
+
"value"
|
|
74
108
|
],
|
|
75
109
|
"type": "object"
|
|
110
|
+
},
|
|
111
|
+
"InputRadioParams": {
|
|
112
|
+
"additionalProperties": false,
|
|
113
|
+
"properties": {
|
|
114
|
+
"options": {
|
|
115
|
+
"items": {
|
|
116
|
+
"$ref": "#/definitions/InputRadioOption"
|
|
117
|
+
},
|
|
118
|
+
"type": "array"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"type": "object"
|
|
76
122
|
}
|
|
77
123
|
}
|
|
78
124
|
}
|
|
@@ -1,42 +1,20 @@
|
|
|
1
|
-
|
|
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;
|
|
1
|
+
import type { FormSchemaEntryShared } from "../../form/types/webcomponent.type";
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
3
|
+
export type InputRadioOption = {
|
|
4
|
+
value: string;
|
|
11
5
|
label?: string;
|
|
6
|
+
};
|
|
12
7
|
|
|
8
|
+
export type InputRadioParams = {
|
|
9
|
+
options?: InputRadioOption[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type FormSchemaEntry = Omit<FormSchemaEntryShared, "params"> & {
|
|
13
13
|
/**
|
|
14
14
|
* Optional default value.
|
|
15
15
|
*/
|
|
16
16
|
value?: string | number | boolean;
|
|
17
|
-
|
|
18
|
-
readonly?: boolean;
|
|
19
|
-
|
|
20
|
-
/** When true, the native control is disabled and non-interactive. */
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* This doesn't matter if the dependencies requirements aren't met.
|
|
25
|
-
*/
|
|
26
|
-
required?: boolean;
|
|
27
|
-
|
|
28
|
-
validationRegex?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Shows if value is not valid.
|
|
31
|
-
*/
|
|
32
|
-
validationTip?: string;
|
|
33
|
-
|
|
34
|
-
placeholder?: string;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Other parameters that may be specific to a certain kind of form control.
|
|
38
|
-
*/
|
|
39
|
-
params?: Record<string, any>;
|
|
17
|
+
params?: InputRadioParams;
|
|
40
18
|
};
|
|
41
19
|
|
|
42
20
|
export type Component = {
|
|
@@ -51,6 +29,6 @@ export type Events = {
|
|
|
51
29
|
setVal: {
|
|
52
30
|
value: string | undefined;
|
|
53
31
|
valid: boolean;
|
|
54
|
-
id: string
|
|
32
|
+
id: string;
|
|
55
33
|
};
|
|
56
34
|
};
|