@asd20/ui-next 2.25.1 → 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 CHANGED
@@ -1,5 +1,12 @@
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
+
3
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)
4
11
 
5
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asd20/ui-next",
3
- "version": "2.25.1",
3
+ "version": "2.25.2",
4
4
  "private": false,
5
5
  "description": "ASD20 UI component library for Vue 3.",
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@
8
8
  :required="field.required"
9
9
  :minlength="field.minLength"
10
10
  :maxlength="field.maxLength"
11
- :show-character-count="showCharacterCount"
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="showCharacterCount"
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
- <p
101
- v-if="field.helpText"
102
- :id="helpId"
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
- {{ field.helpText }}
106
- </p>
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 this.formDefinition?.id !== 'accessibility-issue'
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 this.formDefinition.id !== 'accessibility-issue' || field.name === 'issue'
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
- text-align: center;
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
  }