@lavalogic/scoria 0.40.1 → 0.40.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/README.md +58 -58
- package/dist/Components/AccordionGroup.svelte +46 -46
- package/dist/Components/AccordionGroupButton.svelte +76 -76
- package/dist/Components/Action.svelte +136 -136
- package/dist/Components/AlertModal.svelte +195 -195
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +729 -729
- package/dist/Components/Base/BaseModal.svelte +125 -125
- package/dist/Components/Base/ContextWrapper.svelte +72 -72
- package/dist/Components/Base/Pagination.svelte +198 -198
- package/dist/Components/Base/Snippets.svelte +36 -36
- package/dist/Components/BigRadioSet.svelte +38 -38
- package/dist/Components/Bubble.svelte +101 -101
- package/dist/Components/Button.svelte +209 -209
- package/dist/Components/Checkbox.svelte +86 -86
- package/dist/Components/CollapsibleCard.svelte +78 -78
- package/dist/Components/Contexts/ContextMenu.svelte +164 -164
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +60 -60
- package/dist/Components/Contexts/Toast.svelte +86 -86
- package/dist/Components/Contexts/ToastContainer.svelte +65 -65
- package/dist/Components/Contexts/Tooltip.svelte +37 -37
- package/dist/Components/DataMatrixIcon.svelte +112 -112
- package/dist/Components/DateInput.svelte +148 -148
- package/dist/Components/DatePicker.svelte +300 -300
- package/dist/Components/DesktopModal.svelte +90 -90
- package/dist/Components/Dial.svelte +204 -204
- package/dist/Components/DimensionInput.svelte +170 -170
- package/dist/Components/DragMenu/DragMenuHolder.svelte +119 -119
- package/dist/Components/DragMenu/DraggableCard.svelte +77 -77
- package/dist/Components/FileCard.svelte +24 -24
- package/dist/Components/FileUpload.svelte +236 -236
- package/dist/Components/GridInput.svelte +196 -196
- package/dist/Components/GridInputSet.svelte +29 -29
- package/dist/Components/HorizontalTabGroup.svelte +82 -82
- package/dist/Components/HorizontalTabGroupButton.svelte +44 -44
- package/dist/Components/Icon.svelte +128 -128
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/InfoAlert.svelte +35 -35
- package/dist/Components/LoadingAnimation.svelte +29 -29
- package/dist/Components/LoadingModal.svelte +45 -45
- package/dist/Components/LoadingOverlay.svelte +25 -25
- package/dist/Components/Modal.svelte +258 -258
- package/dist/Components/MultiSelect.svelte +220 -220
- package/dist/Components/Nav/Nav.svelte +110 -110
- package/dist/Components/Nav/NavServiceMenuList.svelte +43 -43
- package/dist/Components/Nav/NavTab.svelte +62 -62
- package/dist/Components/Nav/ServiceMenuItem.svelte +112 -112
- package/dist/Components/Nav/ServicesNav.svelte +80 -80
- package/dist/Components/NumberInput.svelte +157 -157
- package/dist/Components/PageHeading.svelte +25 -25
- package/dist/Components/PasswordInput.svelte +88 -88
- package/dist/Components/Portal.svelte +36 -36
- package/dist/Components/ProgressBubble.svelte +107 -107
- package/dist/Components/QuerySelect.svelte +366 -366
- package/dist/Components/SingleSelect.svelte +250 -250
- package/dist/Components/StepButton.svelte +70 -70
- package/dist/Components/StepForm.svelte +140 -140
- package/dist/Components/Switch.svelte +69 -69
- package/dist/Components/Table/ARCHITECTURE.md +298 -298
- package/dist/Components/Table/Body/QuickSearchCell.svelte +679 -679
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +51 -51
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +59 -59
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +454 -454
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +79 -79
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +185 -185
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +124 -124
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +131 -120
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +234 -234
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +105 -105
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +87 -87
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +126 -126
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +159 -159
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +246 -246
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +216 -216
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +252 -252
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +179 -179
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +221 -221
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +197 -197
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +190 -190
- package/dist/Components/Table/Body/Rows/TableRow.svelte +290 -290
- package/dist/Components/Table/Body/TableBody.svelte +155 -155
- package/dist/Components/Table/ColumnFactory.svelte.js +1 -0
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +41 -41
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +30 -30
- package/dist/Components/Table/Headers/TableHead.svelte +415 -415
- package/dist/Components/Table/Misc/ColumnPanel.svelte +39 -39
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +39 -39
- package/dist/Components/Table/Misc/FilterInput.svelte +641 -641
- package/dist/Components/Table/Misc/FilterPanel.svelte +190 -190
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +31 -31
- package/dist/Components/Table/Misc/ShareViewModal.svelte +291 -291
- package/dist/Components/Table/Misc/SidePanel.svelte +35 -35
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +644 -644
- package/dist/Components/Table/Misc/TableFooter.svelte +340 -340
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +140 -140
- package/dist/Components/Table/Misc/TableSidebar.svelte +200 -200
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +105 -105
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +100 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +107 -107
- package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +192 -192
- package/dist/Components/Table/NestedTable.svelte +130 -130
- package/dist/Components/Table/Table.svelte +692 -692
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.d.ts +5 -0
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.js +3 -0
- package/dist/Components/Table/Types/Public/ColumnOptions.d.ts +10 -0
- package/dist/Components/Test/TestContextConsumer.svelte +13 -13
- package/dist/Components/TextArea.svelte +130 -130
- package/dist/Components/TextInput.svelte +176 -176
- package/dist/Components/ThreeStateRadio.svelte +131 -131
- package/dist/Components/Touch/BoolCard.svelte +45 -45
- package/dist/Components/Touch/DateModal.svelte +209 -209
- package/dist/Components/Touch/EditCard.svelte +59 -59
- package/dist/Components/Touch/InfoCard.svelte +31 -31
- package/dist/Components/Touch/InfoTextCard.svelte +28 -28
- package/dist/Components/Touch/ModalExplanation.svelte +17 -17
- package/dist/Components/Touch/NumberKeyboard.svelte +225 -225
- package/dist/Components/Touch/NumberModal.svelte +79 -79
- package/dist/Components/Touch/PlusMinusCard.svelte +46 -46
- package/dist/Components/Touch/SelectModal.svelte +127 -127
- package/dist/Components/Touch/SummaryCard.svelte +93 -93
- package/dist/Components/Touch/TextAreaModal.svelte +95 -95
- package/dist/Components/Touch/TextModal.svelte +106 -106
- package/dist/Components/Touch/TouchCard.svelte +33 -33
- package/dist/Components/Touch/TouchModal.svelte +274 -274
- package/dist/Components/Touch/UtilityButton.svelte +109 -109
- package/dist/Components/VerticalTabGroup.svelte +79 -79
- package/dist/Components/VerticalTabGroupButton.svelte +58 -58
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Types/Examples/ExampleModal.svelte +35 -35
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3392 -3392
- package/dist/scss/_motion.scss +57 -57
- package/dist/scss/_sizing.scss +85 -85
- package/dist/scss/_transitions.scss +8 -8
- package/package.json +1 -1
|
@@ -1,197 +1,197 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
module
|
|
6
|
-
>
|
|
7
|
-
import { browser } from '$app/environment';
|
|
8
|
-
import { DATAMatrix } from '../Helpers/Datamatrix.js';
|
|
9
|
-
import type { DataMatrixSvg } from './DataMatrixIconProps.js';
|
|
10
|
-
|
|
11
|
-
// Frozen const map of scanner shortcut codes recognised by AlertModal.
|
|
12
|
-
// Using `Object.values` to drive comparisons keeps the strings off the
|
|
13
|
-
// hot path and gives us a single place to register new codes.
|
|
14
|
-
const AlertShortcuts = Object.freeze({
|
|
15
|
-
yes: '[YES]',
|
|
16
|
-
no: '[NO]',
|
|
17
|
-
other: '[OTHER]',
|
|
18
|
-
} as const);
|
|
19
|
-
type AlertShortcut = (typeof AlertShortcuts)[keyof typeof AlertShortcuts];
|
|
20
|
-
|
|
21
|
-
// Barcode icons are encoded once at module load (rather than per
|
|
22
|
-
// component instance) so opening multiple alerts is cheap.
|
|
23
|
-
//
|
|
24
|
-
// `DATAMatrix` calls `document.createElement` internally, which is not
|
|
25
|
-
// available during SvelteKit's server-render pass. We gate on `browser`
|
|
26
|
-
// and use `undefined` during SSR; the modal is hidden during SSR
|
|
27
|
-
// anyway, and each render site below guards with `{#if … }`.
|
|
28
|
-
const yesIcon: DataMatrixSvg | undefined = browser
|
|
29
|
-
? DATAMatrix(AlertShortcuts.yes)
|
|
30
|
-
: undefined;
|
|
31
|
-
const noIcon: DataMatrixSvg | undefined = browser
|
|
32
|
-
? DATAMatrix(AlertShortcuts.no)
|
|
33
|
-
: undefined;
|
|
34
|
-
const otherIcon: DataMatrixSvg | undefined = browser
|
|
35
|
-
? DATAMatrix(AlertShortcuts.other)
|
|
36
|
-
: undefined;
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<script lang="ts">
|
|
40
|
-
import { AlertContext } from '../Contexts/AlertContext.svelte.js';
|
|
41
|
-
import { ToastContext } from '../Contexts/ToastContext.svelte.js';
|
|
42
|
-
import { UntypedInputContext } from '../Contexts/UntypedInputContext.svelte.js';
|
|
43
|
-
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
44
|
-
import { dev } from '$app/environment';
|
|
45
|
-
import { getContext, onMount } from 'svelte';
|
|
46
|
-
import DataMatrixIcon from './DataMatrixIcon.svelte';
|
|
47
|
-
import ModalExplanation from './Touch/ModalExplanation.svelte';
|
|
48
|
-
|
|
49
|
-
let dialog: HTMLDialogElement | undefined = $state();
|
|
50
|
-
|
|
51
|
-
const alertContext = getContext<AlertContext>(AlertContext.identifier);
|
|
52
|
-
const untypedInputContext = getContext<UntypedInputContext>(UntypedInputContext.identifier);
|
|
53
|
-
const toastContext = getContext<ToastContext>(ToastContext.identifier);
|
|
54
|
-
|
|
55
|
-
$effect(() => {
|
|
56
|
-
if (!dialog) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (alertContext.showModal && !dialog.open) {
|
|
60
|
-
dialog.showModal();
|
|
61
|
-
} else if (!alertContext.showModal && dialog.open) {
|
|
62
|
-
dialog.close();
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
onMount(() => {
|
|
67
|
-
return untypedInputContext.registerListener((value) => {
|
|
68
|
-
// Only react when this AlertModal is the active dialog. This keeps
|
|
69
|
-
// stray scanner reads from being interpreted as a confirmation when
|
|
70
|
-
// the alert is not on-screen.
|
|
71
|
-
if (!alertContext.showModal) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const matched = (Object.values(AlertShortcuts) as ReadonlyArray<AlertShortcut>).find(
|
|
76
|
-
(code) => code === value
|
|
77
|
-
);
|
|
78
|
-
switch (matched) {
|
|
79
|
-
case AlertShortcuts.yes: {
|
|
80
|
-
alertContext.onYes();
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
case AlertShortcuts.no: {
|
|
84
|
-
alertContext.onNo();
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
case AlertShortcuts.other: {
|
|
88
|
-
alertContext.onOther();
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
default: {
|
|
92
|
-
if (dev) {
|
|
93
|
-
console.warn(`Uncaught command \`${value}\``);
|
|
94
|
-
}
|
|
95
|
-
toastContext.toast(`Unrecognised input: ${value}`);
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<dialog
|
|
104
|
-
bind:this={dialog}
|
|
105
|
-
aria-modal="true"
|
|
106
|
-
aria-labelledby="alert-modal-heading"
|
|
107
|
-
aria-describedby="alert-modal-body"
|
|
108
|
-
onclose={() => {
|
|
109
|
-
// Only auto-fire `onNo` if a "No" action was actually configured.
|
|
110
|
-
// Closing an alert (with no `noLabel`) should resolve cleanly without
|
|
111
|
-
// pretending the user rejected it.
|
|
112
|
-
if (alertContext.noLabel != null) {
|
|
113
|
-
alertContext.onNo();
|
|
114
|
-
} else {
|
|
115
|
-
alertContext.onYes();
|
|
116
|
-
}
|
|
117
|
-
}}
|
|
118
|
-
onclick={(e) => {
|
|
119
|
-
if (e.target === dialog) {
|
|
120
|
-
if (!alertContext.mandatory) {
|
|
121
|
-
dialog.close();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
<div class="modal-root">
|
|
127
|
-
<h3
|
|
128
|
-
id="alert-modal-heading"
|
|
129
|
-
class="modal-heading"
|
|
130
|
-
>
|
|
131
|
-
{alertContext.header}
|
|
132
|
-
</h3>
|
|
133
|
-
|
|
134
|
-
<div
|
|
135
|
-
id="alert-modal-body"
|
|
136
|
-
class="modal-main pre-line"
|
|
137
|
-
>
|
|
138
|
-
<ModalExplanation>{alertContext.body}</ModalExplanation>
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
{#if alertContext.footer}
|
|
142
|
-
<span>{alertContext.footer}</span>
|
|
143
|
-
{/if}
|
|
144
|
-
|
|
145
|
-
<div class="modal-footer actions">
|
|
146
|
-
<div class="button-barcode-set">
|
|
147
|
-
{#if yesIcon}
|
|
148
|
-
<DataMatrixIcon
|
|
149
|
-
title={alertContext.yesLabel}
|
|
150
|
-
icon={{ kind: 'svg', svg: yesIcon }}
|
|
151
|
-
/>
|
|
152
|
-
{/if}
|
|
153
|
-
<button
|
|
154
|
-
type="submit"
|
|
155
|
-
onkeydown={passthrough}
|
|
156
|
-
onclick={alertContext.onYes}>{alertContext.yesLabel}</button
|
|
157
|
-
>
|
|
158
|
-
</div>
|
|
159
|
-
|
|
160
|
-
{#if alertContext.otherLabel}
|
|
161
|
-
<div class="button-barcode-set">
|
|
162
|
-
{#if otherIcon}
|
|
163
|
-
<DataMatrixIcon
|
|
164
|
-
title={alertContext.otherLabel}
|
|
165
|
-
icon={{ kind: 'svg', svg: otherIcon }}
|
|
166
|
-
/>
|
|
167
|
-
{/if}
|
|
168
|
-
<button
|
|
169
|
-
type="button"
|
|
170
|
-
onkeydown={passthrough}
|
|
171
|
-
onclick={alertContext.onOther}>{alertContext.otherLabel}</button
|
|
172
|
-
>
|
|
173
|
-
</div>
|
|
174
|
-
{/if}
|
|
175
|
-
|
|
176
|
-
{#if alertContext.noLabel}
|
|
177
|
-
<div class="button-barcode-set">
|
|
178
|
-
{#if noIcon}
|
|
179
|
-
<DataMatrixIcon
|
|
180
|
-
title={alertContext.noLabel}
|
|
181
|
-
icon={{ kind: 'svg', svg: noIcon }}
|
|
182
|
-
/>
|
|
183
|
-
{/if}
|
|
184
|
-
<button
|
|
185
|
-
type="button"
|
|
186
|
-
onkeydown={passthrough}
|
|
187
|
-
onclick={alertContext.onNo}>{alertContext.noLabel}</button
|
|
188
|
-
>
|
|
189
|
-
</div>
|
|
190
|
-
{/if}
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
</dialog>
|
|
194
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>
|
|
7
|
+
import { browser } from '$app/environment';
|
|
8
|
+
import { DATAMatrix } from '../Helpers/Datamatrix.js';
|
|
9
|
+
import type { DataMatrixSvg } from './DataMatrixIconProps.js';
|
|
10
|
+
|
|
11
|
+
// Frozen const map of scanner shortcut codes recognised by AlertModal.
|
|
12
|
+
// Using `Object.values` to drive comparisons keeps the strings off the
|
|
13
|
+
// hot path and gives us a single place to register new codes.
|
|
14
|
+
const AlertShortcuts = Object.freeze({
|
|
15
|
+
yes: '[YES]',
|
|
16
|
+
no: '[NO]',
|
|
17
|
+
other: '[OTHER]',
|
|
18
|
+
} as const);
|
|
19
|
+
type AlertShortcut = (typeof AlertShortcuts)[keyof typeof AlertShortcuts];
|
|
20
|
+
|
|
21
|
+
// Barcode icons are encoded once at module load (rather than per
|
|
22
|
+
// component instance) so opening multiple alerts is cheap.
|
|
23
|
+
//
|
|
24
|
+
// `DATAMatrix` calls `document.createElement` internally, which is not
|
|
25
|
+
// available during SvelteKit's server-render pass. We gate on `browser`
|
|
26
|
+
// and use `undefined` during SSR; the modal is hidden during SSR
|
|
27
|
+
// anyway, and each render site below guards with `{#if … }`.
|
|
28
|
+
const yesIcon: DataMatrixSvg | undefined = browser
|
|
29
|
+
? DATAMatrix(AlertShortcuts.yes)
|
|
30
|
+
: undefined;
|
|
31
|
+
const noIcon: DataMatrixSvg | undefined = browser
|
|
32
|
+
? DATAMatrix(AlertShortcuts.no)
|
|
33
|
+
: undefined;
|
|
34
|
+
const otherIcon: DataMatrixSvg | undefined = browser
|
|
35
|
+
? DATAMatrix(AlertShortcuts.other)
|
|
36
|
+
: undefined;
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<script lang="ts">
|
|
40
|
+
import { AlertContext } from '../Contexts/AlertContext.svelte.js';
|
|
41
|
+
import { ToastContext } from '../Contexts/ToastContext.svelte.js';
|
|
42
|
+
import { UntypedInputContext } from '../Contexts/UntypedInputContext.svelte.js';
|
|
43
|
+
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
44
|
+
import { dev } from '$app/environment';
|
|
45
|
+
import { getContext, onMount } from 'svelte';
|
|
46
|
+
import DataMatrixIcon from './DataMatrixIcon.svelte';
|
|
47
|
+
import ModalExplanation from './Touch/ModalExplanation.svelte';
|
|
48
|
+
|
|
49
|
+
let dialog: HTMLDialogElement | undefined = $state();
|
|
50
|
+
|
|
51
|
+
const alertContext = getContext<AlertContext>(AlertContext.identifier);
|
|
52
|
+
const untypedInputContext = getContext<UntypedInputContext>(UntypedInputContext.identifier);
|
|
53
|
+
const toastContext = getContext<ToastContext>(ToastContext.identifier);
|
|
54
|
+
|
|
55
|
+
$effect(() => {
|
|
56
|
+
if (!dialog) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (alertContext.showModal && !dialog.open) {
|
|
60
|
+
dialog.showModal();
|
|
61
|
+
} else if (!alertContext.showModal && dialog.open) {
|
|
62
|
+
dialog.close();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
onMount(() => {
|
|
67
|
+
return untypedInputContext.registerListener((value) => {
|
|
68
|
+
// Only react when this AlertModal is the active dialog. This keeps
|
|
69
|
+
// stray scanner reads from being interpreted as a confirmation when
|
|
70
|
+
// the alert is not on-screen.
|
|
71
|
+
if (!alertContext.showModal) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const matched = (Object.values(AlertShortcuts) as ReadonlyArray<AlertShortcut>).find(
|
|
76
|
+
(code) => code === value
|
|
77
|
+
);
|
|
78
|
+
switch (matched) {
|
|
79
|
+
case AlertShortcuts.yes: {
|
|
80
|
+
alertContext.onYes();
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
case AlertShortcuts.no: {
|
|
84
|
+
alertContext.onNo();
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
case AlertShortcuts.other: {
|
|
88
|
+
alertContext.onOther();
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
default: {
|
|
92
|
+
if (dev) {
|
|
93
|
+
console.warn(`Uncaught command \`${value}\``);
|
|
94
|
+
}
|
|
95
|
+
toastContext.toast(`Unrecognised input: ${value}`);
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<dialog
|
|
104
|
+
bind:this={dialog}
|
|
105
|
+
aria-modal="true"
|
|
106
|
+
aria-labelledby="alert-modal-heading"
|
|
107
|
+
aria-describedby="alert-modal-body"
|
|
108
|
+
onclose={() => {
|
|
109
|
+
// Only auto-fire `onNo` if a "No" action was actually configured.
|
|
110
|
+
// Closing an alert (with no `noLabel`) should resolve cleanly without
|
|
111
|
+
// pretending the user rejected it.
|
|
112
|
+
if (alertContext.noLabel != null) {
|
|
113
|
+
alertContext.onNo();
|
|
114
|
+
} else {
|
|
115
|
+
alertContext.onYes();
|
|
116
|
+
}
|
|
117
|
+
}}
|
|
118
|
+
onclick={(e) => {
|
|
119
|
+
if (e.target === dialog) {
|
|
120
|
+
if (!alertContext.mandatory) {
|
|
121
|
+
dialog.close();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<div class="modal-root">
|
|
127
|
+
<h3
|
|
128
|
+
id="alert-modal-heading"
|
|
129
|
+
class="modal-heading"
|
|
130
|
+
>
|
|
131
|
+
{alertContext.header}
|
|
132
|
+
</h3>
|
|
133
|
+
|
|
134
|
+
<div
|
|
135
|
+
id="alert-modal-body"
|
|
136
|
+
class="modal-main pre-line"
|
|
137
|
+
>
|
|
138
|
+
<ModalExplanation>{alertContext.body}</ModalExplanation>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
{#if alertContext.footer}
|
|
142
|
+
<span>{alertContext.footer}</span>
|
|
143
|
+
{/if}
|
|
144
|
+
|
|
145
|
+
<div class="modal-footer actions">
|
|
146
|
+
<div class="button-barcode-set">
|
|
147
|
+
{#if yesIcon}
|
|
148
|
+
<DataMatrixIcon
|
|
149
|
+
title={alertContext.yesLabel}
|
|
150
|
+
icon={{ kind: 'svg', svg: yesIcon }}
|
|
151
|
+
/>
|
|
152
|
+
{/if}
|
|
153
|
+
<button
|
|
154
|
+
type="submit"
|
|
155
|
+
onkeydown={passthrough}
|
|
156
|
+
onclick={alertContext.onYes}>{alertContext.yesLabel}</button
|
|
157
|
+
>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
{#if alertContext.otherLabel}
|
|
161
|
+
<div class="button-barcode-set">
|
|
162
|
+
{#if otherIcon}
|
|
163
|
+
<DataMatrixIcon
|
|
164
|
+
title={alertContext.otherLabel}
|
|
165
|
+
icon={{ kind: 'svg', svg: otherIcon }}
|
|
166
|
+
/>
|
|
167
|
+
{/if}
|
|
168
|
+
<button
|
|
169
|
+
type="button"
|
|
170
|
+
onkeydown={passthrough}
|
|
171
|
+
onclick={alertContext.onOther}>{alertContext.otherLabel}</button
|
|
172
|
+
>
|
|
173
|
+
</div>
|
|
174
|
+
{/if}
|
|
175
|
+
|
|
176
|
+
{#if alertContext.noLabel}
|
|
177
|
+
<div class="button-barcode-set">
|
|
178
|
+
{#if noIcon}
|
|
179
|
+
<DataMatrixIcon
|
|
180
|
+
title={alertContext.noLabel}
|
|
181
|
+
icon={{ kind: 'svg', svg: noIcon }}
|
|
182
|
+
/>
|
|
183
|
+
{/if}
|
|
184
|
+
<button
|
|
185
|
+
type="button"
|
|
186
|
+
onkeydown={passthrough}
|
|
187
|
+
onclick={alertContext.onNo}>{alertContext.noLabel}</button
|
|
188
|
+
>
|
|
189
|
+
</div>
|
|
190
|
+
{/if}
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</dialog>
|
|
194
|
+
|
|
195
195
|
<style>dialog {
|
|
196
196
|
overflow: clip;
|
|
197
197
|
background-color: #e9ecf1;
|
|
@@ -468,4 +468,4 @@ div.button-barcode-set {
|
|
|
468
468
|
display: flex;
|
|
469
469
|
flex-flow: row nowrap;
|
|
470
470
|
gap: 1.5rem;
|
|
471
|
-
}</style>
|
|
471
|
+
}</style>
|