@asd20/ui-next 2.25.0 → 2.25.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.
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/components/molecules/Asd20ListItem/index.vue +18 -1
- package/src/components/molecules/Asd20PublicFormField/index.vue +70 -8
- package/src/components/organisms/Asd20PublicFormModal/index.vue +14 -6
- package/src/helpers/mapLinksToListItems.js +1 -0
- package/src/helpers/publicFormDefinition.js +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.25.2](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.25.1...ui-next-v2.25.2) (2026-09-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* refine public form presentation ([0e8d038](https://github.com/academydistrict20/asd20-ui-next/commit/0e8d0388783f522d65adeb6fb03f5c6a19c15456))
|
|
9
|
+
|
|
10
|
+
## [2.25.1](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.25.0...ui-next-v2.25.1) (2026-09-23)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* add public form activation to sidebar links ([2f82e94](https://github.com/academydistrict20/asd20-ui-next/commit/2f82e94d2249df42f695f9cfe4fbbd4e254c46b7))
|
|
16
|
+
|
|
3
17
|
# [2.25.0](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.24.4...ui-next-v2.25.0) (2026-09-21)
|
|
4
18
|
|
|
5
19
|
|
package/package.json
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
:is="tag"
|
|
4
4
|
:[hrefAttr]="hrefValue"
|
|
5
5
|
:[targetAttr]="targetValue"
|
|
6
|
+
:type="tag === 'button' ? 'button' : undefined"
|
|
7
|
+
:data-public-form="normalizedPublicFormId || undefined"
|
|
6
8
|
class="asd20-list-item"
|
|
7
9
|
:class="classes"
|
|
8
10
|
@click="onClick"
|
|
@@ -168,6 +170,7 @@ export default {
|
|
|
168
170
|
alignTop: { type: Boolean, default: false },
|
|
169
171
|
to: { type: [String, Object], default: '' },
|
|
170
172
|
link: { type: String, default: '' },
|
|
173
|
+
publicFormId: { type: String, default: '' },
|
|
171
174
|
sourceTitle: { type: String, default: '' },
|
|
172
175
|
logoUrl: { type: String, default: '' },
|
|
173
176
|
attribution: { type: Boolean, default: false },
|
|
@@ -186,6 +189,9 @@ export default {
|
|
|
186
189
|
}
|
|
187
190
|
},
|
|
188
191
|
tag() {
|
|
192
|
+
if (this.actionable && this.normalizedPublicFormId) {
|
|
193
|
+
return 'button'
|
|
194
|
+
}
|
|
189
195
|
if (this.actionable && this.usesRouterNavigation) {
|
|
190
196
|
return 'button'
|
|
191
197
|
}
|
|
@@ -201,8 +207,14 @@ export default {
|
|
|
201
207
|
return this.tag === 'a' ? 'href' : null
|
|
202
208
|
},
|
|
203
209
|
hrefValue() {
|
|
210
|
+
if (this.normalizedPublicFormId) return ''
|
|
204
211
|
return this.link || this.to
|
|
205
212
|
},
|
|
213
|
+
normalizedPublicFormId() {
|
|
214
|
+
if (!this.actionable) return ''
|
|
215
|
+
const formId = String(this.publicFormId || '').trim()
|
|
216
|
+
return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(formId) ? formId : ''
|
|
217
|
+
},
|
|
206
218
|
usesRouterNavigation() {
|
|
207
219
|
const router = resolveRouter(this)
|
|
208
220
|
if (!router || !this.to) return false
|
|
@@ -230,7 +242,12 @@ export default {
|
|
|
230
242
|
onClick(e) {
|
|
231
243
|
const router = resolveRouter(this)
|
|
232
244
|
|
|
233
|
-
if (
|
|
245
|
+
if (
|
|
246
|
+
!this.normalizedPublicFormId &&
|
|
247
|
+
this.usesRouterNavigation &&
|
|
248
|
+
router &&
|
|
249
|
+
typeof router.push === 'function'
|
|
250
|
+
) {
|
|
234
251
|
e.preventDefault()
|
|
235
252
|
router.push(this.to)
|
|
236
253
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
:required="field.required"
|
|
9
9
|
:minlength="field.minLength"
|
|
10
10
|
:maxlength="field.maxLength"
|
|
11
|
-
:show-character-count="
|
|
11
|
+
:show-character-count="false"
|
|
12
12
|
:show-pristine-validation-errors="showPristineValidationErrors"
|
|
13
13
|
:autocomplete="field.autocomplete || undefined"
|
|
14
14
|
:aria-describedby="describedBy"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
:minlength="field.minLength"
|
|
27
27
|
:maxlength="field.maxLength"
|
|
28
28
|
:max="dateMaximum"
|
|
29
|
-
:show-character-count="
|
|
29
|
+
:show-character-count="false"
|
|
30
30
|
:show-pristine-validation-errors="showPristineValidationErrors"
|
|
31
31
|
:autocomplete="field.autocomplete || undefined"
|
|
32
32
|
:aria-describedby="describedBy"
|
|
@@ -97,13 +97,22 @@
|
|
|
97
97
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
98
98
|
/>
|
|
99
99
|
|
|
100
|
-
<
|
|
101
|
-
v-if="field.helpText"
|
|
102
|
-
|
|
103
|
-
class="asd20-public-form-field__help"
|
|
100
|
+
<div
|
|
101
|
+
v-if="field.helpText || hasCharacterCount"
|
|
102
|
+
class="asd20-public-form-field__guidance"
|
|
104
103
|
>
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
<p
|
|
105
|
+
v-if="field.helpText"
|
|
106
|
+
:id="helpId"
|
|
107
|
+
class="asd20-public-form-field__help"
|
|
108
|
+
>
|
|
109
|
+
{{ field.helpText }}
|
|
110
|
+
</p>
|
|
111
|
+
<span
|
|
112
|
+
v-if="hasCharacterCount"
|
|
113
|
+
class="asd20-public-form-field__character-count"
|
|
114
|
+
>{{ characterCountText }}</span>
|
|
115
|
+
</div>
|
|
107
116
|
<ul
|
|
108
117
|
v-if="hasErrors"
|
|
109
118
|
:id="errorId"
|
|
@@ -174,6 +183,19 @@ export default {
|
|
|
174
183
|
hasErrors() {
|
|
175
184
|
return this.errors.length > 0
|
|
176
185
|
},
|
|
186
|
+
hasCharacterCount() {
|
|
187
|
+
return (
|
|
188
|
+
this.showCharacterCount &&
|
|
189
|
+
Number.isInteger(this.field.maxLength) &&
|
|
190
|
+
this.field.maxLength > 0 &&
|
|
191
|
+
typeof this.modelValue === 'string'
|
|
192
|
+
)
|
|
193
|
+
},
|
|
194
|
+
characterCountText() {
|
|
195
|
+
return this.hasCharacterCount
|
|
196
|
+
? `${this.modelValue.length}/${this.field.maxLength}`
|
|
197
|
+
: ''
|
|
198
|
+
},
|
|
177
199
|
describedBy() {
|
|
178
200
|
return (
|
|
179
201
|
[
|
|
@@ -226,15 +248,55 @@ export default {
|
|
|
226
248
|
}
|
|
227
249
|
|
|
228
250
|
&__help,
|
|
251
|
+
&__character-count,
|
|
229
252
|
&__errors {
|
|
230
253
|
color: var(--website-card__reverse-background-color);
|
|
231
254
|
font-size: 0.75rem;
|
|
232
255
|
margin: space(0.125) 0 0;
|
|
233
256
|
}
|
|
234
257
|
|
|
258
|
+
&__guidance {
|
|
259
|
+
align-items: flex-end;
|
|
260
|
+
display: flex;
|
|
261
|
+
gap: space(0.25);
|
|
262
|
+
justify-content: space-between;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
&__help {
|
|
266
|
+
flex: 1 1 auto;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
&__character-count {
|
|
270
|
+
flex: 0 0 auto;
|
|
271
|
+
margin-left: auto;
|
|
272
|
+
white-space: nowrap;
|
|
273
|
+
}
|
|
274
|
+
|
|
235
275
|
&__errors {
|
|
236
276
|
color: asd20-swatch('emergency', -1);
|
|
237
277
|
padding-left: space(1);
|
|
238
278
|
}
|
|
279
|
+
|
|
280
|
+
& :deep(.asd20-checkbox.asd20-checkbox__checkbox) {
|
|
281
|
+
align-items: flex-start;
|
|
282
|
+
gap: space(0.25);
|
|
283
|
+
|
|
284
|
+
input {
|
|
285
|
+
flex: 0 0 auto;
|
|
286
|
+
margin: 0.2rem 0 0;
|
|
287
|
+
opacity: 1;
|
|
288
|
+
position: static;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
label {
|
|
292
|
+
align-items: flex-start;
|
|
293
|
+
flex: 1 1 auto;
|
|
294
|
+
padding: 0;
|
|
295
|
+
|
|
296
|
+
span {
|
|
297
|
+
margin-right: 0;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
239
301
|
}
|
|
240
302
|
</style>
|
|
@@ -34,7 +34,11 @@
|
|
|
34
34
|
role="status"
|
|
35
35
|
aria-live="polite"
|
|
36
36
|
>
|
|
37
|
-
{{ formDefinition.successMessage }}
|
|
37
|
+
<p>{{ formDefinition.successMessage }}</p>
|
|
38
|
+
<template v-if="formDefinition.successDetails">
|
|
39
|
+
<hr />
|
|
40
|
+
<p>{{ formDefinition.successDetails }}</p>
|
|
41
|
+
</template>
|
|
38
42
|
</div>
|
|
39
43
|
|
|
40
44
|
<form
|
|
@@ -236,7 +240,7 @@ export default {
|
|
|
236
240
|
return this.formDefinition?.title || 'Public Form'
|
|
237
241
|
},
|
|
238
242
|
showPristineValidationErrors() {
|
|
239
|
-
return
|
|
243
|
+
return false
|
|
240
244
|
},
|
|
241
245
|
errorEntries() {
|
|
242
246
|
if (!this.formDefinition) return []
|
|
@@ -330,7 +334,7 @@ export default {
|
|
|
330
334
|
return `${this.instanceId}-${name}`
|
|
331
335
|
},
|
|
332
336
|
shouldShowCharacterCount(field) {
|
|
333
|
-
return
|
|
337
|
+
return field.showCharacterCount === true
|
|
334
338
|
},
|
|
335
339
|
updateValue(name, value) {
|
|
336
340
|
this.values[name] = value
|
|
@@ -459,8 +463,7 @@ export default {
|
|
|
459
463
|
}
|
|
460
464
|
|
|
461
465
|
&__error-summary,
|
|
462
|
-
&__feedback
|
|
463
|
-
&__success {
|
|
466
|
+
&__feedback {
|
|
464
467
|
font-weight: 600;
|
|
465
468
|
margin: space(0.5) 0;
|
|
466
469
|
}
|
|
@@ -476,7 +479,12 @@ export default {
|
|
|
476
479
|
|
|
477
480
|
&__success {
|
|
478
481
|
font-size: 1.1rem;
|
|
479
|
-
|
|
482
|
+
margin: space(0.5) 0;
|
|
483
|
+
text-align: left;
|
|
484
|
+
|
|
485
|
+
p {
|
|
486
|
+
margin: space(0.5) 0;
|
|
487
|
+
}
|
|
480
488
|
}
|
|
481
489
|
|
|
482
490
|
&__fallback {
|
|
@@ -40,6 +40,12 @@ function optionalMaxDate(value, type) {
|
|
|
40
40
|
throw new Error('Maximum date is invalid.')
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function optionalBoolean(value, label) {
|
|
44
|
+
if (value == null) return false
|
|
45
|
+
if (typeof value !== 'boolean') throw new Error(`${label} is invalid.`)
|
|
46
|
+
return value
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
function normalizeOptions(field) {
|
|
44
50
|
if (!['select', 'radio'].includes(field.type)) return undefined
|
|
45
51
|
if (
|
|
@@ -89,6 +95,10 @@ function normalizeField(field) {
|
|
|
89
95
|
maxLength: optionalLength(field.maxLength, 'Maximum length'),
|
|
90
96
|
maxDate: optionalMaxDate(field.maxDate, type),
|
|
91
97
|
autocomplete: boundedText(field.autocomplete, 'Autocomplete value', 100),
|
|
98
|
+
showCharacterCount: optionalBoolean(
|
|
99
|
+
field.showCharacterCount,
|
|
100
|
+
'Character-count visibility'
|
|
101
|
+
),
|
|
92
102
|
options: undefined,
|
|
93
103
|
}
|
|
94
104
|
|
|
@@ -99,6 +109,13 @@ function normalizeField(field) {
|
|
|
99
109
|
) {
|
|
100
110
|
throw new Error(`${normalized.label} has invalid length limits.`)
|
|
101
111
|
}
|
|
112
|
+
if (
|
|
113
|
+
normalized.showCharacterCount &&
|
|
114
|
+
(!['text', 'email', 'tel', 'textarea'].includes(type) ||
|
|
115
|
+
normalized.maxLength == null)
|
|
116
|
+
) {
|
|
117
|
+
throw new Error(`${normalized.label} has an invalid character count.`)
|
|
118
|
+
}
|
|
102
119
|
|
|
103
120
|
normalized.options = normalizeOptions({
|
|
104
121
|
...field,
|
|
@@ -170,6 +187,11 @@ export function normalizePublicFormDefinition(definition) {
|
|
|
170
187
|
1000,
|
|
171
188
|
true
|
|
172
189
|
),
|
|
190
|
+
successDetails: boundedText(
|
|
191
|
+
definition.successDetails,
|
|
192
|
+
'Success details',
|
|
193
|
+
2000
|
|
194
|
+
),
|
|
173
195
|
fallbackContact: normalizedFallback,
|
|
174
196
|
fields,
|
|
175
197
|
}
|