@aiaiai-pt/design-system 0.56.0 → 0.58.0
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/components/ActionFormRenderer.svelte +61 -11
- package/components/ActionFormRenderer.svelte.d.ts +28 -0
- package/components/Calendar.svelte +18 -6
- package/components/Calendar.svelte.d.ts +12 -0
- package/components/Combobox.svelte +6 -2
- package/components/Combobox.svelte.d.ts +4 -0
- package/components/DataTable.svelte +5 -1
- package/components/FileUpload.svelte +3 -1
- package/components/FileUpload.svelte.d.ts +2 -0
- package/components/FilterPanel.svelte +12 -4
- package/components/FilterPanel.svelte.d.ts +8 -0
- package/components/Modal.svelte +3 -1
- package/components/Modal.svelte.d.ts +2 -0
- package/components/MultiSelectCombobox.svelte +12 -2
- package/components/MultiSelectCombobox.svelte.d.ts +8 -0
- package/components/Pagination.svelte +9 -4
- package/components/Pagination.svelte.d.ts +4 -0
- package/components/Tag.svelte +3 -1
- package/components/Tag.svelte.d.ts +2 -0
- package/package.json +1 -1
|
@@ -176,6 +176,37 @@
|
|
|
176
176
|
* complete payload (incl. attachment_keys) to review and submit. Read-only
|
|
177
177
|
* consumers omit it. */
|
|
178
178
|
onchange?: (payload: Record<string, unknown>) => void;
|
|
179
|
+
|
|
180
|
+
// #2672 L4 — consumer-overridable labels for i18n. Each has today's
|
|
181
|
+
// English as the default so no consumer changes behaviour.
|
|
182
|
+
/** Hint appended to required file-param labels, e.g. " (required)". */
|
|
183
|
+
requiredLabel?: string;
|
|
184
|
+
/** Placeholder for choice-type selects. */
|
|
185
|
+
selectPlaceholder?: string;
|
|
186
|
+
/** Shown in a choice select while options load. */
|
|
187
|
+
loadingOptionsLabel?: string;
|
|
188
|
+
/** Shown in a choice select when no options exist. */
|
|
189
|
+
noOptionsLabel?: string;
|
|
190
|
+
/** Boolean toggle "yes" option label. */
|
|
191
|
+
booleanYesLabel?: string;
|
|
192
|
+
/** Boolean toggle "no" option label. */
|
|
193
|
+
booleanNoLabel?: string;
|
|
194
|
+
/** Hint shown when a file param has a stored file on edit. */
|
|
195
|
+
fileReplaceLabel?: string;
|
|
196
|
+
/** Hint shown below a required field (submit modes). */
|
|
197
|
+
requiredHintLabel?: string;
|
|
198
|
+
/** Combobox: shown when search returns nothing (passed through). */
|
|
199
|
+
noResultsLabel?: string;
|
|
200
|
+
/** Combobox: shown while searching / debouncing (passed through). */
|
|
201
|
+
searchingLabel?: string;
|
|
202
|
+
/** FileUpload: drop-zone instruction text (passed through). */
|
|
203
|
+
dropLabel?: string;
|
|
204
|
+
/** Default section heading when no section label is declared. */
|
|
205
|
+
defaultSectionLabel?: string;
|
|
206
|
+
/** A11y hint shown when the submit button is disabled because required
|
|
207
|
+
* fields are empty. Rendered as a polite `role="status"` so screen
|
|
208
|
+
* readers announce why the form cannot be submitted. */
|
|
209
|
+
requiredFieldsMessage?: string;
|
|
179
210
|
}
|
|
180
211
|
|
|
181
212
|
let {
|
|
@@ -200,6 +231,19 @@
|
|
|
200
231
|
activeSectionKey = null,
|
|
201
232
|
hideSubmit = false,
|
|
202
233
|
onchange = undefined,
|
|
234
|
+
requiredLabel = " (required)",
|
|
235
|
+
selectPlaceholder = "Select value",
|
|
236
|
+
loadingOptionsLabel = "Loading options...",
|
|
237
|
+
noOptionsLabel = "No options available",
|
|
238
|
+
booleanYesLabel = "Yes",
|
|
239
|
+
booleanNoLabel = "No",
|
|
240
|
+
fileReplaceLabel = "Current file — uploading replaces it",
|
|
241
|
+
requiredHintLabel = "Required",
|
|
242
|
+
noResultsLabel = "No results found",
|
|
243
|
+
searchingLabel = "Searching…",
|
|
244
|
+
dropLabel = "Drop files here or click to browse",
|
|
245
|
+
defaultSectionLabel = "Details",
|
|
246
|
+
requiredFieldsMessage = "Fill in all required fields to submit.",
|
|
203
247
|
}: Props = $props();
|
|
204
248
|
|
|
205
249
|
let values = $state<Record<string, unknown>>({});
|
|
@@ -377,7 +421,7 @@
|
|
|
377
421
|
const section = row.section_label || row.section;
|
|
378
422
|
if (section) return String(section);
|
|
379
423
|
}
|
|
380
|
-
return
|
|
424
|
+
return defaultSectionLabel;
|
|
381
425
|
}
|
|
382
426
|
|
|
383
427
|
function groupIntoSections(items: Entity[]): Array<{ name: string; items: Entity[] }> {
|
|
@@ -403,7 +447,7 @@
|
|
|
403
447
|
// predicate, and `order` (the server emits sections pre-sorted; the
|
|
404
448
|
// sort below is a defensive mirror, stable via declaration index).
|
|
405
449
|
return {
|
|
406
|
-
name: String(section.label ?? section.key ??
|
|
450
|
+
name: String(section.label ?? section.key ?? defaultSectionLabel),
|
|
407
451
|
key: section.key ? String(section.key) : undefined,
|
|
408
452
|
columns: Number(section.columns ?? 1),
|
|
409
453
|
visibleWhen:
|
|
@@ -842,13 +886,13 @@
|
|
|
842
886
|
name={key}
|
|
843
887
|
value={String(values[key] ?? initialValue(parameter) ?? "")}
|
|
844
888
|
{options}
|
|
845
|
-
placeholder=
|
|
889
|
+
placeholder={selectPlaceholder}
|
|
846
890
|
disabled={fieldDisabled || !editable || options.length === 0}
|
|
847
891
|
error={fieldError}
|
|
848
892
|
help={parameter.loading === true
|
|
849
|
-
?
|
|
893
|
+
? loadingOptionsLabel
|
|
850
894
|
: options.length === 0
|
|
851
|
-
?
|
|
895
|
+
? noOptionsLabel
|
|
852
896
|
: undefined}
|
|
853
897
|
onchange={(value: string) => setValue(key, value)}
|
|
854
898
|
aria-required={ariaRequired}
|
|
@@ -874,8 +918,8 @@
|
|
|
874
918
|
name={key}
|
|
875
919
|
value={values[key] ? "true" : "false"}
|
|
876
920
|
options={[
|
|
877
|
-
{ value: "true", label:
|
|
878
|
-
{ value: "false", label:
|
|
921
|
+
{ value: "true", label: booleanYesLabel },
|
|
922
|
+
{ value: "false", label: booleanNoLabel },
|
|
879
923
|
]}
|
|
880
924
|
disabled={fieldDisabled || !editable}
|
|
881
925
|
error={fieldError}
|
|
@@ -919,6 +963,9 @@
|
|
|
919
963
|
disabled={!searchEntities || !editable || fieldDisabled}
|
|
920
964
|
loading={(referenceLoading[key] ?? false) || parameter.loading === true}
|
|
921
965
|
error={fieldError}
|
|
966
|
+
{noResultsLabel}
|
|
967
|
+
{searchingLabel}
|
|
968
|
+
requiredLabel={requiredLabel}
|
|
922
969
|
onsearch={(query: string) => handleReferenceSearch(parameter, query)}
|
|
923
970
|
onadd={(value: string) => addRelId(key, value)}
|
|
924
971
|
onremove={(value: string) => removeRelId(key, value)}
|
|
@@ -932,6 +979,8 @@
|
|
|
932
979
|
disabled={!searchEntities || !editable || fieldDisabled}
|
|
933
980
|
loading={(referenceLoading[key] ?? false) || parameter.loading === true}
|
|
934
981
|
error={fieldError}
|
|
982
|
+
{noResultsLabel}
|
|
983
|
+
{searchingLabel}
|
|
935
984
|
onsearch={(query: string) => handleReferenceSearch(parameter, query)}
|
|
936
985
|
onchange={(value: string) => pickSingleRel(key, value)}
|
|
937
986
|
/>
|
|
@@ -947,7 +996,7 @@
|
|
|
947
996
|
<div class="afr-file-param" role="group" aria-labelledby={`${key}-file-label`}>
|
|
948
997
|
<span id={`${key}-file-label`} class="afr-file-label"
|
|
949
998
|
>{String(parameter.label ?? key)}{parameter.required
|
|
950
|
-
?
|
|
999
|
+
? requiredLabel
|
|
951
1000
|
: ""}</span
|
|
952
1001
|
>
|
|
953
1002
|
<!-- #40 — REPLACE semantics: the stored current shows until a pending
|
|
@@ -966,7 +1015,7 @@
|
|
|
966
1015
|
{:else}
|
|
967
1016
|
<span class="afr-file-current-name">{storedFile.name}</span>
|
|
968
1017
|
{/if}
|
|
969
|
-
<span class="afr-file-current-hint">
|
|
1018
|
+
<span class="afr-file-current-hint">{fileReplaceLabel}</span>
|
|
970
1019
|
</div>
|
|
971
1020
|
{/if}
|
|
972
1021
|
{#each fileUploads[key] ?? [] as f (f.key)}
|
|
@@ -981,6 +1030,7 @@
|
|
|
981
1030
|
maxSize={fileMaxBytes(parameter)}
|
|
982
1031
|
multiple={!replaceMode}
|
|
983
1032
|
disabled={!uploadFile || fileBusy[key]}
|
|
1033
|
+
{dropLabel}
|
|
984
1034
|
onfiles={(files: File[]) => handleFiles(key, files, replaceMode)}
|
|
985
1035
|
onreject={() => {
|
|
986
1036
|
fileError = {
|
|
@@ -1063,7 +1113,7 @@
|
|
|
1063
1113
|
<!-- EXECUTE surfaces (citizen public-submit AND staff admin-execute,
|
|
1064
1114
|
#629 follow-up): just a quiet required hint — the "Required / type"
|
|
1065
1115
|
line is operator DEBUG chrome, preview modes only. -->
|
|
1066
|
-
{#if parameter.required}<p class="field-meta">
|
|
1116
|
+
{#if parameter.required}<p class="field-meta">{requiredHintLabel}</p>{/if}
|
|
1067
1117
|
{:else}
|
|
1068
1118
|
<p class="field-meta">
|
|
1069
1119
|
{String(parameter.required ? "Required" : "Optional")} / {type}
|
|
@@ -1134,7 +1184,7 @@
|
|
|
1134
1184
|
`aria-required` that marks which fields are needed. -->
|
|
1135
1185
|
{#if !canSubmit && !submitting}
|
|
1136
1186
|
<p class="submit-hint" role="status">
|
|
1137
|
-
|
|
1187
|
+
{requiredFieldsMessage}
|
|
1138
1188
|
</p>
|
|
1139
1189
|
{/if}
|
|
1140
1190
|
<Button
|
|
@@ -118,6 +118,34 @@ interface Props {
|
|
|
118
118
|
* complete payload (incl. attachment_keys) to review and submit. Read-only
|
|
119
119
|
* consumers omit it. */
|
|
120
120
|
onchange?: (payload: Record<string, unknown>) => void;
|
|
121
|
+
/** Hint appended to required file-param labels, e.g. " (required)". */
|
|
122
|
+
requiredLabel?: string;
|
|
123
|
+
/** Placeholder for choice-type selects. */
|
|
124
|
+
selectPlaceholder?: string;
|
|
125
|
+
/** Shown in a choice select while options load. */
|
|
126
|
+
loadingOptionsLabel?: string;
|
|
127
|
+
/** Shown in a choice select when no options exist. */
|
|
128
|
+
noOptionsLabel?: string;
|
|
129
|
+
/** Boolean toggle "yes" option label. */
|
|
130
|
+
booleanYesLabel?: string;
|
|
131
|
+
/** Boolean toggle "no" option label. */
|
|
132
|
+
booleanNoLabel?: string;
|
|
133
|
+
/** Hint shown when a file param has a stored file on edit. */
|
|
134
|
+
fileReplaceLabel?: string;
|
|
135
|
+
/** Hint shown below a required field (submit modes). */
|
|
136
|
+
requiredHintLabel?: string;
|
|
137
|
+
/** Combobox: shown when search returns nothing (passed through). */
|
|
138
|
+
noResultsLabel?: string;
|
|
139
|
+
/** Combobox: shown while searching / debouncing (passed through). */
|
|
140
|
+
searchingLabel?: string;
|
|
141
|
+
/** FileUpload: drop-zone instruction text (passed through). */
|
|
142
|
+
dropLabel?: string;
|
|
143
|
+
/** Default section heading when no section label is declared. */
|
|
144
|
+
defaultSectionLabel?: string;
|
|
145
|
+
/** A11y hint shown when the submit button is disabled because required
|
|
146
|
+
* fields are empty. Rendered as a polite `role="status"` so screen
|
|
147
|
+
* readers announce why the form cannot be submitted. */
|
|
148
|
+
requiredFieldsMessage?: string;
|
|
121
149
|
}
|
|
122
150
|
declare const ActionFormRenderer: import("svelte").Component<Props, {}, "">;
|
|
123
151
|
type ActionFormRenderer = ReturnType<typeof ActionFormRenderer>;
|
|
@@ -60,6 +60,18 @@
|
|
|
60
60
|
ondateclick = undefined,
|
|
61
61
|
/** @type {import('svelte').Snippet<[CalendarEvent]> | undefined} */
|
|
62
62
|
event: eventSnippet = undefined,
|
|
63
|
+
/** @type {string} — "Today" button label */
|
|
64
|
+
todayLabel = 'Today',
|
|
65
|
+
/** @type {string} — "Month" view toggle label */
|
|
66
|
+
monthLabel = 'Month',
|
|
67
|
+
/** @type {string} — "Week" view toggle label */
|
|
68
|
+
weekLabel = 'Week',
|
|
69
|
+
/** @type {string} — "Day" view toggle label */
|
|
70
|
+
dayLabel = 'Day',
|
|
71
|
+
/** @type {string} — aria-label on the "previous" nav button */
|
|
72
|
+
prevAriaLabel = 'Previous',
|
|
73
|
+
/** @type {string} — aria-label on the "next" nav button */
|
|
74
|
+
nextAriaLabel = 'Next',
|
|
63
75
|
/** @type {string} */
|
|
64
76
|
class: className = '',
|
|
65
77
|
...rest
|
|
@@ -268,17 +280,17 @@
|
|
|
268
280
|
<!-- Toolbar buttons blur() on click to prevent stale focus rings when user presses keys afterward -->
|
|
269
281
|
<div class="calendar-toolbar">
|
|
270
282
|
<div class="calendar-toolbar-left">
|
|
271
|
-
<button type="button" class="calendar-nav-btn" onclick={(e) => { prev(); /** @type {HTMLElement} */ (e.currentTarget).blur(); }} aria-label=
|
|
283
|
+
<button type="button" class="calendar-nav-btn" onclick={(e) => { prev(); /** @type {HTMLElement} */ (e.currentTarget).blur(); }} aria-label={prevAriaLabel}>
|
|
272
284
|
<svg viewBox="0 0 256 256" aria-hidden="true">
|
|
273
285
|
<polyline points="160,208 80,128 160,48" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" />
|
|
274
286
|
</svg>
|
|
275
287
|
</button>
|
|
276
|
-
<button type="button" class="calendar-nav-btn" onclick={(e) => { next(); /** @type {HTMLElement} */ (e.currentTarget).blur(); }} aria-label=
|
|
288
|
+
<button type="button" class="calendar-nav-btn" onclick={(e) => { next(); /** @type {HTMLElement} */ (e.currentTarget).blur(); }} aria-label={nextAriaLabel}>
|
|
277
289
|
<svg viewBox="0 0 256 256" aria-hidden="true">
|
|
278
290
|
<polyline points="96,48 176,128 96,208" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" />
|
|
279
291
|
</svg>
|
|
280
292
|
</button>
|
|
281
|
-
<button type="button" class="calendar-today-btn" onclick={(e) => { goToday(); /** @type {HTMLElement} */ (e.currentTarget).blur(); }}>
|
|
293
|
+
<button type="button" class="calendar-today-btn" onclick={(e) => { goToday(); /** @type {HTMLElement} */ (e.currentTarget).blur(); }}>{todayLabel}</button>
|
|
282
294
|
<h2 class="calendar-title">
|
|
283
295
|
{#if view === 'month'}
|
|
284
296
|
{format(date, 'LLLL yyyy', { locale })}
|
|
@@ -296,19 +308,19 @@
|
|
|
296
308
|
class="calendar-toggle-btn"
|
|
297
309
|
class:calendar-toggle-active={view === 'month'}
|
|
298
310
|
onclick={(e) => { view = 'month'; /** @type {HTMLElement} */ (e.currentTarget).blur(); }}
|
|
299
|
-
>
|
|
311
|
+
>{monthLabel}</button>
|
|
300
312
|
<button
|
|
301
313
|
type="button"
|
|
302
314
|
class="calendar-toggle-btn"
|
|
303
315
|
class:calendar-toggle-active={view === 'week'}
|
|
304
316
|
onclick={(e) => { view = 'week'; /** @type {HTMLElement} */ (e.currentTarget).blur(); }}
|
|
305
|
-
>
|
|
317
|
+
>{weekLabel}</button>
|
|
306
318
|
<button
|
|
307
319
|
type="button"
|
|
308
320
|
class="calendar-toggle-btn"
|
|
309
321
|
class:calendar-toggle-active={view === 'day'}
|
|
310
322
|
onclick={(e) => { view = 'day'; /** @type {HTMLElement} */ (e.currentTarget).blur(); }}
|
|
311
|
-
>
|
|
323
|
+
>{dayLabel}</button>
|
|
312
324
|
</div>
|
|
313
325
|
</div>
|
|
314
326
|
</div>
|
|
@@ -34,6 +34,12 @@ declare const Calendar: import("svelte").Component<{
|
|
|
34
34
|
oneventclick?: any;
|
|
35
35
|
ondateclick?: any;
|
|
36
36
|
event?: any;
|
|
37
|
+
todayLabel?: string;
|
|
38
|
+
monthLabel?: string;
|
|
39
|
+
weekLabel?: string;
|
|
40
|
+
dayLabel?: string;
|
|
41
|
+
prevAriaLabel?: string;
|
|
42
|
+
nextAriaLabel?: string;
|
|
37
43
|
class?: string;
|
|
38
44
|
} & Record<string, any>, {}, "view" | "date">;
|
|
39
45
|
type $$ComponentProps = {
|
|
@@ -45,6 +51,12 @@ type $$ComponentProps = {
|
|
|
45
51
|
oneventclick?: any;
|
|
46
52
|
ondateclick?: any;
|
|
47
53
|
event?: any;
|
|
54
|
+
todayLabel?: string;
|
|
55
|
+
monthLabel?: string;
|
|
56
|
+
weekLabel?: string;
|
|
57
|
+
dayLabel?: string;
|
|
58
|
+
prevAriaLabel?: string;
|
|
59
|
+
nextAriaLabel?: string;
|
|
48
60
|
class?: string;
|
|
49
61
|
} & Record<string, any>;
|
|
50
62
|
import { enUS } from 'date-fns/locale';
|
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
onsearch = undefined,
|
|
58
58
|
/** @type {boolean} */
|
|
59
59
|
loading = false,
|
|
60
|
+
/** @type {string} — shown when loading (async search debounce) */
|
|
61
|
+
searchingLabel = 'Searching…',
|
|
62
|
+
/** @type {string} — shown when the filtered list is empty */
|
|
63
|
+
noResultsLabel = 'No results found',
|
|
60
64
|
/** @type {string} */
|
|
61
65
|
class: className = '',
|
|
62
66
|
...rest
|
|
@@ -247,11 +251,11 @@
|
|
|
247
251
|
>
|
|
248
252
|
{#if loading}
|
|
249
253
|
<li class="combobox-empty" role="option" aria-selected="false" aria-disabled="true">
|
|
250
|
-
|
|
254
|
+
{searchingLabel}
|
|
251
255
|
</li>
|
|
252
256
|
{:else if filtered.length === 0}
|
|
253
257
|
<li class="combobox-empty" role="option" aria-selected="false" aria-disabled="true">
|
|
254
|
-
|
|
258
|
+
{noResultsLabel}
|
|
255
259
|
</li>
|
|
256
260
|
{:else}
|
|
257
261
|
{#each [...grouped.entries()] as [group, groupItems]}
|
|
@@ -46,6 +46,8 @@ declare const Combobox: import("svelte").Component<{
|
|
|
46
46
|
onchange?: any;
|
|
47
47
|
onsearch?: any;
|
|
48
48
|
loading?: boolean;
|
|
49
|
+
searchingLabel?: string;
|
|
50
|
+
noResultsLabel?: string;
|
|
49
51
|
class?: string;
|
|
50
52
|
} & Record<string, any>, {}, "value">;
|
|
51
53
|
type $$ComponentProps = {
|
|
@@ -60,5 +62,7 @@ type $$ComponentProps = {
|
|
|
60
62
|
onchange?: any;
|
|
61
63
|
onsearch?: any;
|
|
62
64
|
loading?: boolean;
|
|
65
|
+
searchingLabel?: string;
|
|
66
|
+
noResultsLabel?: string;
|
|
63
67
|
class?: string;
|
|
64
68
|
} & Record<string, any>;
|
|
@@ -447,7 +447,11 @@
|
|
|
447
447
|
background: var(--color-surface-secondary);
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
-
.
|
|
450
|
+
/* #2668 P3b — only clickable rows highlight on hover. A list whose rows
|
|
451
|
+
go nowhere (no on_row_click) looked clickable because .table-row:hover
|
|
452
|
+
highlighted all rows. Selectable rows keep their .table-row-selected
|
|
453
|
+
affordance (the checkbox cell has its own click handler). */
|
|
454
|
+
.table-row-clickable:hover {
|
|
451
455
|
background: var(--color-surface-tertiary);
|
|
452
456
|
}
|
|
453
457
|
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
icon = undefined,
|
|
37
37
|
/** @type {import('svelte').Snippet | undefined} */
|
|
38
38
|
children = undefined,
|
|
39
|
+
/** @type {string} — drop-zone instruction text */
|
|
40
|
+
dropLabel = 'Drop files here or click to browse',
|
|
39
41
|
/** @type {string} */
|
|
40
42
|
class: className = '',
|
|
41
43
|
...rest
|
|
@@ -192,7 +194,7 @@
|
|
|
192
194
|
{#if icon}
|
|
193
195
|
<span class="fileupload-icon">{@render icon()}</span>
|
|
194
196
|
{/if}
|
|
195
|
-
<span class="fileupload-text">
|
|
197
|
+
<span class="fileupload-text">{dropLabel}</span>
|
|
196
198
|
{#if accept || maxSize}
|
|
197
199
|
<span class="fileupload-hint">
|
|
198
200
|
{#if accept}{accept}{/if}
|
|
@@ -32,6 +32,7 @@ declare const FileUpload: import("svelte").Component<{
|
|
|
32
32
|
onreject?: any;
|
|
33
33
|
icon?: any;
|
|
34
34
|
children?: any;
|
|
35
|
+
dropLabel?: string;
|
|
35
36
|
class?: string;
|
|
36
37
|
} & Record<string, any>, {}, "">;
|
|
37
38
|
type $$ComponentProps = {
|
|
@@ -43,5 +44,6 @@ type $$ComponentProps = {
|
|
|
43
44
|
onreject?: any;
|
|
44
45
|
icon?: any;
|
|
45
46
|
children?: any;
|
|
47
|
+
dropLabel?: string;
|
|
46
48
|
class?: string;
|
|
47
49
|
} & Record<string, any>;
|
|
@@ -47,6 +47,14 @@
|
|
|
47
47
|
onchange = undefined,
|
|
48
48
|
/** @type {(() => void) | undefined} */
|
|
49
49
|
onclear = undefined,
|
|
50
|
+
/** @type {string} — default option label in select filters */
|
|
51
|
+
allLabel = 'All',
|
|
52
|
+
/** @type {string} — clear-all button label */
|
|
53
|
+
clearLabel = 'Clear all',
|
|
54
|
+
/** @type {string} — boolean filter "yes" label */
|
|
55
|
+
booleanYesLabel = 'Yes',
|
|
56
|
+
/** @type {string} — boolean filter "no" label */
|
|
57
|
+
booleanNoLabel = 'No',
|
|
50
58
|
/** @type {string} */
|
|
51
59
|
class: className = '',
|
|
52
60
|
...rest
|
|
@@ -102,7 +110,7 @@
|
|
|
102
110
|
value={value[filter.key] ?? ''}
|
|
103
111
|
onchange={(e) => setFilter(filter.key, /** @type {HTMLSelectElement} */ (e.currentTarget).value)}
|
|
104
112
|
>
|
|
105
|
-
<option value="">
|
|
113
|
+
<option value="">{allLabel}</option>
|
|
106
114
|
{#each filter.options as opt (opt.value)}
|
|
107
115
|
<option value={opt.value}>{opt.label}</option>
|
|
108
116
|
{/each}
|
|
@@ -112,7 +120,7 @@
|
|
|
112
120
|
</span>
|
|
113
121
|
</div>
|
|
114
122
|
{:else if filter.type === 'boolean'}
|
|
115
|
-
{@const opts = filter.options ?? [{ value: 'true', label:
|
|
123
|
+
{@const opts = filter.options ?? [{ value: 'true', label: booleanYesLabel }, { value: 'false', label: booleanNoLabel }]}
|
|
116
124
|
<span class="filter-field-label">{filter.label}</span>
|
|
117
125
|
<div class="filter-bool-chips">
|
|
118
126
|
{#each opts as opt (opt.value)}
|
|
@@ -130,7 +138,7 @@
|
|
|
130
138
|
<Combobox
|
|
131
139
|
size="sm"
|
|
132
140
|
label={filter.label}
|
|
133
|
-
placeholder=
|
|
141
|
+
placeholder={allLabel}
|
|
134
142
|
items={filter.searchItems ?? []}
|
|
135
143
|
value={value[filter.key] ?? ''}
|
|
136
144
|
onchange={(val) => setFilter(filter.key, val)}
|
|
@@ -147,7 +155,7 @@
|
|
|
147
155
|
onclick={clearAll}
|
|
148
156
|
type="button"
|
|
149
157
|
>
|
|
150
|
-
|
|
158
|
+
{clearLabel}
|
|
151
159
|
</button>
|
|
152
160
|
{/if}
|
|
153
161
|
</div>
|
|
@@ -43,6 +43,10 @@ declare const FilterPanel: import("svelte").Component<{
|
|
|
43
43
|
value?: Record<string, any>;
|
|
44
44
|
onchange?: any;
|
|
45
45
|
onclear?: any;
|
|
46
|
+
allLabel?: string;
|
|
47
|
+
clearLabel?: string;
|
|
48
|
+
booleanYesLabel?: string;
|
|
49
|
+
booleanNoLabel?: string;
|
|
46
50
|
class?: string;
|
|
47
51
|
} & Record<string, any>, {}, "value">;
|
|
48
52
|
type $$ComponentProps = {
|
|
@@ -50,5 +54,9 @@ type $$ComponentProps = {
|
|
|
50
54
|
value?: Record<string, any>;
|
|
51
55
|
onchange?: any;
|
|
52
56
|
onclear?: any;
|
|
57
|
+
allLabel?: string;
|
|
58
|
+
clearLabel?: string;
|
|
59
|
+
booleanYesLabel?: string;
|
|
60
|
+
booleanNoLabel?: string;
|
|
53
61
|
class?: string;
|
|
54
62
|
} & Record<string, any>;
|
package/components/Modal.svelte
CHANGED
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
width = 'default',
|
|
38
38
|
/** @type {(() => void) | undefined} */
|
|
39
39
|
onclose,
|
|
40
|
+
/** @type {string} — aria-label for the close button */
|
|
41
|
+
closeLabel = 'Close',
|
|
40
42
|
/** @type {string} */
|
|
41
43
|
class: className = '',
|
|
42
44
|
/** @type {import('svelte').Snippet | undefined} */
|
|
@@ -124,7 +126,7 @@
|
|
|
124
126
|
<button
|
|
125
127
|
class="modal-close"
|
|
126
128
|
onclick={onclose}
|
|
127
|
-
aria-label=
|
|
129
|
+
aria-label={closeLabel}
|
|
128
130
|
>
|
|
129
131
|
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
130
132
|
<path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -29,6 +29,7 @@ declare const Modal: import("svelte").Component<{
|
|
|
29
29
|
title: any;
|
|
30
30
|
width?: string;
|
|
31
31
|
onclose: any;
|
|
32
|
+
closeLabel?: string;
|
|
32
33
|
class?: string;
|
|
33
34
|
header?: any;
|
|
34
35
|
footer?: any;
|
|
@@ -39,6 +40,7 @@ type $$ComponentProps = {
|
|
|
39
40
|
title: any;
|
|
40
41
|
width?: string;
|
|
41
42
|
onclose: any;
|
|
43
|
+
closeLabel?: string;
|
|
42
44
|
class?: string;
|
|
43
45
|
header?: any;
|
|
44
46
|
footer?: any;
|
|
@@ -56,6 +56,14 @@
|
|
|
56
56
|
onremove = undefined,
|
|
57
57
|
/** @type {((query: string) => void) | undefined} — async search; parent owns items */
|
|
58
58
|
onsearch = undefined,
|
|
59
|
+
/** @type {string} — shown when search returns nothing (forwarded to Combobox) */
|
|
60
|
+
noResultsLabel = 'No results found',
|
|
61
|
+
/** @type {string} — shown while searching (forwarded to Combobox) */
|
|
62
|
+
searchingLabel = 'Searching…',
|
|
63
|
+
/** @type {string} — aria-label for chip remove buttons (forwarded to Tag) */
|
|
64
|
+
removeLabel = 'Remove tag',
|
|
65
|
+
/** @type {string} — hint appended to the label when required */
|
|
66
|
+
requiredLabel = ' (required)',
|
|
59
67
|
/** @type {string} */
|
|
60
68
|
class: className = '',
|
|
61
69
|
...rest
|
|
@@ -89,14 +97,14 @@
|
|
|
89
97
|
>
|
|
90
98
|
{#if label}
|
|
91
99
|
<span id={`${mscId}-label`} class="msc-label"
|
|
92
|
-
>{label}{required ?
|
|
100
|
+
>{label}{required ? requiredLabel : ''}</span
|
|
93
101
|
>
|
|
94
102
|
{/if}
|
|
95
103
|
|
|
96
104
|
{#if selected.length}
|
|
97
105
|
<div class="msc-chips">
|
|
98
106
|
{#each selected as entry (entry.value)}
|
|
99
|
-
<Tag removable={!disabled} onremove={() => onremove?.(entry.value)}>
|
|
107
|
+
<Tag removable={!disabled} {removeLabel} onremove={() => onremove?.(entry.value)}>
|
|
100
108
|
{entry.label}
|
|
101
109
|
</Tag>
|
|
102
110
|
{/each}
|
|
@@ -112,6 +120,8 @@
|
|
|
112
120
|
{error}
|
|
113
121
|
{help}
|
|
114
122
|
{size}
|
|
123
|
+
{noResultsLabel}
|
|
124
|
+
{searchingLabel}
|
|
115
125
|
onsearch={onsearch}
|
|
116
126
|
onchange={handlePick}
|
|
117
127
|
/>
|
|
@@ -42,6 +42,10 @@ declare const MultiSelectCombobox: import("svelte").Component<{
|
|
|
42
42
|
onadd?: any;
|
|
43
43
|
onremove?: any;
|
|
44
44
|
onsearch?: any;
|
|
45
|
+
noResultsLabel?: string;
|
|
46
|
+
searchingLabel?: string;
|
|
47
|
+
removeLabel?: string;
|
|
48
|
+
requiredLabel?: string;
|
|
45
49
|
class?: string;
|
|
46
50
|
} & Record<string, any>, {}, "">;
|
|
47
51
|
type $$ComponentProps = {
|
|
@@ -58,5 +62,9 @@ type $$ComponentProps = {
|
|
|
58
62
|
onadd?: any;
|
|
59
63
|
onremove?: any;
|
|
60
64
|
onsearch?: any;
|
|
65
|
+
noResultsLabel?: string;
|
|
66
|
+
searchingLabel?: string;
|
|
67
|
+
removeLabel?: string;
|
|
68
|
+
requiredLabel?: string;
|
|
61
69
|
class?: string;
|
|
62
70
|
} & Record<string, any>;
|
|
@@ -61,6 +61,11 @@
|
|
|
61
61
|
/** @type {((size: number) => void) | undefined} */
|
|
62
62
|
on_page_size_change = undefined,
|
|
63
63
|
|
|
64
|
+
/** @type {string} — label for the "previous" nav button */
|
|
65
|
+
prevLabel = 'PREV',
|
|
66
|
+
/** @type {string} — label for the "next" nav button */
|
|
67
|
+
nextLabel = 'NEXT',
|
|
68
|
+
|
|
64
69
|
/** @type {string} */
|
|
65
70
|
class: className = '',
|
|
66
71
|
...rest
|
|
@@ -146,15 +151,15 @@
|
|
|
146
151
|
|
|
147
152
|
{#if mode === 'cursor'}
|
|
148
153
|
<button class="pagination-nav" disabled={!has_prev} onclick={on_prev} aria-label="Previous page">
|
|
149
|
-
{@render chevronLeft()}<span>
|
|
154
|
+
{@render chevronLeft()}<span>{prevLabel}</span>
|
|
150
155
|
</button>
|
|
151
156
|
<button class="pagination-nav" disabled={!has_next} onclick={on_next} aria-label="Next page">
|
|
152
|
-
<span>
|
|
157
|
+
<span>{nextLabel}</span>{@render chevronRight()}
|
|
153
158
|
</button>
|
|
154
159
|
|
|
155
160
|
{:else}
|
|
156
161
|
<button class="pagination-nav" disabled={current_page <= 1} onclick={() => on_page_change?.(current_page - 1)} aria-label="Previous page">
|
|
157
|
-
{@render chevronLeft()}<span>
|
|
162
|
+
{@render chevronLeft()}<span>{prevLabel}</span>
|
|
158
163
|
</button>
|
|
159
164
|
|
|
160
165
|
<div class="pagination-pages">
|
|
@@ -177,7 +182,7 @@
|
|
|
177
182
|
</div>
|
|
178
183
|
|
|
179
184
|
<button class="pagination-nav" disabled={current_page >= (total_pages ?? current_page)} onclick={() => on_page_change?.(current_page + 1)} aria-label="Next page">
|
|
180
|
-
<span>
|
|
185
|
+
<span>{nextLabel}</span>{@render chevronRight()}
|
|
181
186
|
</button>
|
|
182
187
|
{/if}
|
|
183
188
|
</div>
|
|
@@ -44,6 +44,8 @@ declare const Pagination: import("svelte").Component<{
|
|
|
44
44
|
page_size?: number;
|
|
45
45
|
page_sizes?: any;
|
|
46
46
|
on_page_size_change?: any;
|
|
47
|
+
prevLabel?: string;
|
|
48
|
+
nextLabel?: string;
|
|
47
49
|
class?: string;
|
|
48
50
|
} & Record<string, any>, {}, "">;
|
|
49
51
|
type $$ComponentProps = {
|
|
@@ -59,5 +61,7 @@ type $$ComponentProps = {
|
|
|
59
61
|
page_size?: number;
|
|
60
62
|
page_sizes?: any;
|
|
61
63
|
on_page_size_change?: any;
|
|
64
|
+
prevLabel?: string;
|
|
65
|
+
nextLabel?: string;
|
|
62
66
|
class?: string;
|
|
63
67
|
} & Record<string, any>;
|
package/components/Tag.svelte
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
removable = false,
|
|
17
17
|
/** @type {(() => void) | undefined} */
|
|
18
18
|
onremove = undefined,
|
|
19
|
+
/** @type {string} — aria-label for the remove button */
|
|
20
|
+
removeLabel = 'Remove tag',
|
|
19
21
|
/** @type {string} */
|
|
20
22
|
class: className = '',
|
|
21
23
|
/** @type {import('svelte').Snippet | undefined} */
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
<button
|
|
40
42
|
type="button"
|
|
41
43
|
class="tag-remove"
|
|
42
|
-
aria-label=
|
|
44
|
+
aria-label={removeLabel}
|
|
43
45
|
onclick={(e) => {
|
|
44
46
|
e.stopPropagation();
|
|
45
47
|
onremove?.();
|
|
@@ -18,12 +18,14 @@ type Tag = {
|
|
|
18
18
|
declare const Tag: import("svelte").Component<{
|
|
19
19
|
removable?: boolean;
|
|
20
20
|
onremove?: any;
|
|
21
|
+
removeLabel?: string;
|
|
21
22
|
class?: string;
|
|
22
23
|
children?: any;
|
|
23
24
|
} & Record<string, any>, {}, "">;
|
|
24
25
|
type $$ComponentProps = {
|
|
25
26
|
removable?: boolean;
|
|
26
27
|
onremove?: any;
|
|
28
|
+
removeLabel?: string;
|
|
27
29
|
class?: string;
|
|
28
30
|
children?: any;
|
|
29
31
|
} & Record<string, any>;
|