@lavalogic/scoria 0.40.13 → 0.40.15
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 +35 -46
- package/dist/Components/AccordionGroupButton.svelte +68 -76
- package/dist/Components/Action.svelte +103 -135
- package/dist/Components/AlertModal.svelte +171 -190
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +614 -697
- package/dist/Components/Base/BaseModal.svelte +90 -116
- package/dist/Components/Base/ContextWrapper.svelte +67 -72
- package/dist/Components/Base/Pagination.svelte +173 -196
- package/dist/Components/Base/Snippets.svelte +34 -36
- package/dist/Components/BigRadioSet.svelte +36 -38
- package/dist/Components/Bubble.svelte +78 -101
- package/dist/Components/Button.svelte +175 -208
- package/dist/Components/Checkbox.svelte +75 -86
- package/dist/Components/CollapsibleCard.svelte +72 -87
- package/dist/Components/CollapsibleMenuGroup.svelte +53 -57
- package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +39 -64
- package/dist/Components/Contexts/ContextMenu.svelte +141 -156
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +53 -60
- package/dist/Components/Contexts/Toast.svelte +81 -86
- package/dist/Components/Contexts/ToastContainer.svelte +58 -62
- package/dist/Components/Contexts/Tooltip.svelte +36 -37
- package/dist/Components/DataMatrixIcon.svelte +95 -108
- package/dist/Components/DateInput.svelte +118 -146
- package/dist/Components/DatePicker.svelte +255 -294
- package/dist/Components/DesktopModal.svelte +70 -90
- package/dist/Components/Dial.svelte +167 -197
- package/dist/Components/DimensionInput.svelte +124 -169
- package/dist/Components/DragMenu/DragMenuHolder.svelte +98 -114
- package/dist/Components/DragMenu/DraggableCard.svelte +64 -76
- package/dist/Components/FileCard.svelte +21 -24
- package/dist/Components/FileUpload.svelte +190 -225
- package/dist/Components/GridInput.svelte +159 -196
- package/dist/Components/GridInputSet.svelte +24 -29
- package/dist/Components/HorizontalTabGroup.svelte +73 -89
- package/dist/Components/HorizontalTabGroupButton.svelte +40 -44
- package/dist/Components/Icon.svelte +99 -128
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/InfoAlert.svelte +35 -38
- package/dist/Components/LoadingAnimation.svelte +691 -755
- package/dist/Components/LoadingModal.svelte +36 -44
- package/dist/Components/LoadingOverlay.svelte +22 -26
- package/dist/Components/Modal.svelte +204 -254
- package/dist/Components/MultiSelect.svelte +186 -216
- package/dist/Components/Nav/Nav.svelte +94 -110
- package/dist/Components/Nav/NavServiceMenuList.svelte +57 -61
- package/dist/Components/Nav/NavTab.svelte +58 -62
- package/dist/Components/Nav/ServiceMenuItem.svelte +103 -111
- package/dist/Components/Nav/ServicesNav.svelte +72 -79
- package/dist/Components/NumberInput.svelte +121 -155
- package/dist/Components/OptionCards.svelte +62 -73
- package/dist/Components/PageHeading.svelte +23 -25
- package/dist/Components/PasswordInput.svelte +69 -88
- package/dist/Components/PopoverButton.svelte +151 -0
- package/dist/Components/PopoverButton.svelte.d.ts +9 -0
- package/dist/Components/PopoverButtonProps.d.ts +21 -0
- package/dist/Components/PopoverButtonProps.js +1 -0
- package/dist/Components/Portal.svelte +29 -35
- package/dist/Components/ProgressBubble.svelte +91 -106
- package/dist/Components/QuerySelect.svelte +260 -346
- package/dist/Components/SidebarPanel.svelte +34 -36
- package/dist/Components/SingleSelect.svelte +196 -244
- package/dist/Components/StepButton.svelte +65 -70
- package/dist/Components/StepForm.svelte +115 -135
- package/dist/Components/Switch.svelte +57 -69
- package/dist/Components/Table/ARCHITECTURE.md +298 -298
- package/dist/Components/Table/Body/QuickSearchCell.svelte +578 -655
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +42 -51
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +42 -58
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +403 -442
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +51 -78
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +165 -184
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +110 -123
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +134 -160
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +190 -231
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +82 -104
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +52 -87
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +122 -150
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +132 -159
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +190 -236
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +173 -211
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +204 -244
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +140 -177
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +188 -217
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +173 -193
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +166 -187
- package/dist/Components/Table/Body/Rows/TableRow.svelte +245 -288
- package/dist/Components/Table/Body/TableBody.svelte +141 -154
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +35 -41
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +24 -30
- package/dist/Components/Table/Headers/TableHead.svelte +348 -402
- package/dist/Components/Table/Misc/ColumnPanel.svelte +37 -39
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +35 -39
- package/dist/Components/Table/Misc/FilterInput.svelte +556 -619
- package/dist/Components/Table/Misc/FilterPanel.svelte +170 -183
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +25 -31
- package/dist/Components/Table/Misc/ShareViewModal.svelte +252 -281
- package/dist/Components/Table/Misc/SidePanel.svelte +32 -35
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +574 -629
- package/dist/Components/Table/Misc/TableFooter.svelte +326 -332
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +134 -140
- package/dist/Components/Table/Misc/TableSidebar.svelte +183 -198
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +83 -103
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +83 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +88 -107
- package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +163 -190
- package/dist/Components/Table/NestedTable.svelte +102 -128
- package/dist/Components/Table/Table.svelte +531 -663
- package/dist/Components/Test/TestContextConsumer.svelte +11 -13
- package/dist/Components/TextArea.svelte +95 -130
- package/dist/Components/TextInput.svelte +125 -176
- package/dist/Components/ThreeStateRadio.svelte +111 -130
- package/dist/Components/Touch/BoolCard.svelte +33 -45
- package/dist/Components/Touch/DateModal.svelte +164 -204
- package/dist/Components/Touch/EditCard.svelte +48 -59
- package/dist/Components/Touch/InfoCard.svelte +28 -31
- package/dist/Components/Touch/InfoTextCard.svelte +26 -28
- package/dist/Components/Touch/ModalExplanation.svelte +15 -17
- package/dist/Components/Touch/NumberKeyboard.svelte +181 -218
- package/dist/Components/Touch/NumberModal.svelte +59 -79
- package/dist/Components/Touch/PlusMinusCard.svelte +43 -46
- package/dist/Components/Touch/SelectModal.svelte +111 -126
- package/dist/Components/Touch/SummaryCard.svelte +80 -93
- package/dist/Components/Touch/TextAreaModal.svelte +72 -94
- package/dist/Components/Touch/TextModal.svelte +77 -105
- package/dist/Components/Touch/TouchCard.svelte +31 -33
- package/dist/Components/Touch/TouchModal.svelte +214 -270
- package/dist/Components/Touch/UtilityButton.svelte +88 -109
- package/dist/Components/VerticalTabGroup.svelte +60 -78
- package/dist/Components/VerticalTabGroupButton.svelte +54 -58
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Types/Examples/ExampleModal.svelte +31 -35
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- 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,276 +1,220 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
module
|
|
5
|
-
lang="ts"
|
|
6
|
-
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
row,
|
|
42
|
-
wrap,
|
|
43
|
-
submitRef = $bindable(),
|
|
44
|
-
}: TouchModalProps = $props();
|
|
45
|
-
|
|
46
|
-
let open = $state(true);
|
|
47
|
-
let form: HTMLFormElement | undefined = $state();
|
|
48
|
-
let timeout: ReturnType<typeof setTimeout> | undefined = undefined;
|
|
49
|
-
let paused = $state(false);
|
|
50
|
-
let isActive = $state(false);
|
|
51
|
-
|
|
52
|
-
// Pre-compute barcode SVGs once per `buttons` array. Building a DataMatrix
|
|
53
|
-
// barcode is non-trivial; rebuilding inside the each-block re-runs the
|
|
54
|
-
// encoder on every render.
|
|
55
|
-
//
|
|
56
|
-
// `DATAMatrix` calls `document.createElement` internally, which is
|
|
57
|
-
// undefined during SvelteKit's server render. Returning `null` on the
|
|
58
|
-
// server keeps the SVG slots empty for SSR; the client re-renders with
|
|
59
|
-
// the real encoded payload after hydration.
|
|
60
|
-
const barcodeIcons = $derived.by(
|
|
61
|
-
() =>
|
|
62
|
-
buttons?.map((b) =>
|
|
63
|
-
b.barcodeValue != null && browser ? DATAMatrix(b.barcodeValue) : null
|
|
64
|
-
) ?? []
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
// Resolve each button's `isValid` once at the component level rather than
|
|
68
|
-
// inside the each-block. `useAsyncFlag` debounces stale resolutions, holds
|
|
69
|
-
// the previous value until a new Promise settles, and stops the
|
|
70
|
-
// `{#await}` flicker the previous implementation exhibited.
|
|
71
|
-
const buttonValidities = useAsyncFlag(
|
|
72
|
-
() => Promise.all((buttons ?? []).map((b) => Promise.resolve(b.isValid ?? true))),
|
|
73
|
-
[] as Array<boolean>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
onMount(() => {
|
|
77
|
-
queueMicrotask(() => {
|
|
78
|
-
onShowCallback?.();
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const activeTimer = setTimeout(() => {
|
|
82
|
-
isActive = true;
|
|
83
|
-
}, 200);
|
|
84
|
-
|
|
85
|
-
if (defaultTimer) {
|
|
86
|
-
timeout = setTimeout(() => {
|
|
87
|
-
if (open) {
|
|
88
|
-
if (defaultTimer.action === 'submit') {
|
|
89
|
-
form?.requestSubmit();
|
|
90
|
-
defaultTimer.callback?.();
|
|
91
|
-
} else {
|
|
92
|
-
open = false;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, defaultTimer.time);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return () => {
|
|
99
|
-
clearTimeout(activeTimer);
|
|
100
|
-
clearTimer();
|
|
101
|
-
};
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
module
|
|
5
|
+
lang="ts"
|
|
6
|
+
>import { browser } from "$app/environment";
|
|
7
|
+
import { DATAMatrix } from "../../Helpers/Datamatrix.js";
|
|
8
|
+
import { useAsyncFlag } from "../../Helpers/AsyncFlag.svelte.js";
|
|
9
|
+
import { passthrough } from "../../Helpers/Helpers.svelte.js";
|
|
10
|
+
import { ColourSet } from "../../scss/colours.js";
|
|
11
|
+
import { Size } from "../../Types/Internal/Size.js";
|
|
12
|
+
import { onMount } from "svelte";
|
|
13
|
+
import Action from "../Action.svelte";
|
|
14
|
+
import BaseModal from "../Base/BaseModal.svelte";
|
|
15
|
+
import DataMatrixIcon from "../DataMatrixIcon.svelte";
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">let { header, buttons, mandatory = false, staticHeight = false, staticWidth = false, minWidth = "400px", minHeight = "280px", width, height, onShowCallback, defaultTimer, isValid = true, noscroll = false, onsubmit, headerExtra, explanation, children, footer, onclose, row, wrap, submitRef = $bindable() } = $props();
|
|
19
|
+
let open = $state(true);
|
|
20
|
+
let form = $state();
|
|
21
|
+
let timeout = undefined;
|
|
22
|
+
let paused = $state(false);
|
|
23
|
+
let isActive = $state(false);
|
|
24
|
+
// Pre-compute barcode SVGs once per `buttons` array. Building a DataMatrix
|
|
25
|
+
// barcode is non-trivial; rebuilding inside the each-block re-runs the
|
|
26
|
+
// encoder on every render.
|
|
27
|
+
//
|
|
28
|
+
// `DATAMatrix` calls `document.createElement` internally, which is
|
|
29
|
+
// undefined during SvelteKit's server render. Returning `null` on the
|
|
30
|
+
// server keeps the SVG slots empty for SSR; the client re-renders with
|
|
31
|
+
// the real encoded payload after hydration.
|
|
32
|
+
const barcodeIcons = $derived.by(() => buttons?.map((b) => b.barcodeValue != null && browser ? DATAMatrix(b.barcodeValue) : null) ?? []);
|
|
33
|
+
// Resolve each button's `isValid` once at the component level rather than
|
|
34
|
+
// inside the each-block. `useAsyncFlag` debounces stale resolutions, holds
|
|
35
|
+
// the previous value until a new Promise settles, and stops the
|
|
36
|
+
// `{#await}` flicker the previous implementation exhibited.
|
|
37
|
+
const buttonValidities = useAsyncFlag(() => Promise.all((buttons ?? []).map((b) => Promise.resolve(b.isValid ?? true))), []);
|
|
38
|
+
onMount(() => {
|
|
39
|
+
queueMicrotask(() => {
|
|
40
|
+
onShowCallback?.();
|
|
102
41
|
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
open = false;
|
|
42
|
+
const activeTimer = setTimeout(() => {
|
|
43
|
+
isActive = true;
|
|
44
|
+
}, 200);
|
|
45
|
+
if (defaultTimer) {
|
|
46
|
+
timeout = setTimeout(() => {
|
|
47
|
+
if (open) {
|
|
48
|
+
if (defaultTimer.action === "submit") {
|
|
49
|
+
form?.requestSubmit();
|
|
50
|
+
defaultTimer.callback?.();
|
|
51
|
+
} else {
|
|
52
|
+
open = false;
|
|
53
|
+
}
|
|
116
54
|
}
|
|
117
|
-
}
|
|
55
|
+
}, defaultTimer.time);
|
|
118
56
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
57
|
+
return () => {
|
|
58
|
+
clearTimeout(activeTimer);
|
|
59
|
+
clearTimer();
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
function clearTimer() {
|
|
63
|
+
if (timeout != undefined) {
|
|
64
|
+
paused = true;
|
|
65
|
+
clearTimeout(timeout);
|
|
122
66
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
</script>
|
|
142
|
-
|
|
143
|
-
<BaseModal
|
|
144
|
-
bind:value={open}
|
|
145
|
-
{onclose}
|
|
146
|
-
{mandatory}
|
|
147
|
-
dialogClass={dialogClassNames}
|
|
148
|
-
{dialogStyle}
|
|
149
|
-
>
|
|
150
|
-
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
151
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
152
|
-
<form
|
|
153
|
-
method="dialog"
|
|
154
|
-
bind:this={form}
|
|
155
|
-
onsubmit={(e) => {
|
|
156
|
-
e.preventDefault();
|
|
157
|
-
clearTimer();
|
|
158
|
-
if (isActive) {
|
|
159
|
-
onsubmit?.(e);
|
|
160
|
-
}
|
|
161
|
-
}}
|
|
162
|
-
onclick={clearTimer}
|
|
163
|
-
class="modal-root"
|
|
164
|
-
>
|
|
165
|
-
<div class="modal-header">
|
|
166
|
-
{#if mandatory}
|
|
167
|
-
<div class="title-wrapper">
|
|
168
|
-
<h3 class="modal-heading">{header}</h3>
|
|
169
|
-
</div>
|
|
170
|
-
{:else}
|
|
171
|
-
<div class="title-wrapper">
|
|
172
|
-
<h3 class="modal-heading padded">{header}</h3>
|
|
173
|
-
<div class="close-button">
|
|
174
|
-
<Action
|
|
175
|
-
size={Size.Large}
|
|
176
|
-
onclick={requestClose}
|
|
177
|
-
icon={{
|
|
178
|
-
name: 'cross',
|
|
179
|
-
size: Size.DoubleXLarge,
|
|
180
|
-
}}
|
|
181
|
-
onkeydown={handleEsc}
|
|
182
|
-
colourSet={ColourSet.Primary}
|
|
183
|
-
label="Close Modal"
|
|
184
|
-
/>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
{/if}
|
|
188
|
-
|
|
189
|
-
{#if headerExtra}
|
|
190
|
-
{@render headerExtra()}
|
|
191
|
-
{/if}
|
|
192
|
-
</div>
|
|
193
|
-
|
|
194
|
-
{#if defaultTimer}
|
|
195
|
-
<div class="bar-container">
|
|
196
|
-
<div
|
|
197
|
-
class:paused
|
|
198
|
-
class="bar-timer"
|
|
199
|
-
></div>
|
|
200
|
-
</div>
|
|
201
|
-
{/if}
|
|
202
|
-
|
|
203
|
-
<div
|
|
204
|
-
class="modal-main"
|
|
205
|
-
class:row
|
|
206
|
-
class:wrap
|
|
207
|
-
class:noscroll
|
|
208
|
-
>
|
|
209
|
-
{#if explanation}
|
|
210
|
-
{@render explanation()}
|
|
211
|
-
{/if}
|
|
212
|
-
{@render children()}
|
|
213
|
-
</div>
|
|
214
|
-
|
|
215
|
-
{#if footer}
|
|
216
|
-
{@render footer()}
|
|
217
|
-
{:else if buttons?.length}
|
|
218
|
-
<div class="modal-footer">
|
|
219
|
-
{#each buttons as button, index (button.label)}
|
|
220
|
-
{@const buttonIsValid = buttonValidities.value[index] ?? true}
|
|
221
|
-
{#if button.callback}
|
|
222
|
-
<div class="button-barcode-set">
|
|
223
|
-
{#if barcodeIcons[index]}
|
|
224
|
-
<DataMatrixIcon
|
|
225
|
-
title={button.label}
|
|
226
|
-
icon={{ kind: 'svg', svg: barcodeIcons[index] }}
|
|
227
|
-
/>
|
|
228
|
-
{/if}
|
|
229
|
-
<button
|
|
230
|
-
class:call-to-action={button.colourSet === ColourSet.CallToAction}
|
|
231
|
-
class:primary={button.colourSet === ColourSet.Primary}
|
|
232
|
-
class:secondary-colour={button.colourSet === ColourSet.Secondary}
|
|
233
|
-
class:warning={button.colourSet === ColourSet.Warning}
|
|
234
|
-
class:error={button.colourSet === ColourSet.Error}
|
|
235
|
-
class:info={button.colourSet === ColourSet.Info}
|
|
236
|
-
onkeydown={passthrough}
|
|
237
|
-
disabled={!buttonIsValid}
|
|
238
|
-
class:margin-left={button.margin === 'left'}
|
|
239
|
-
class:margin-right={button.margin === 'right'}
|
|
240
|
-
type={button.type ?? 'button'}
|
|
241
|
-
onclick={button.callback}>{button.label}</button
|
|
242
|
-
>
|
|
243
|
-
</div>
|
|
244
|
-
{:else}
|
|
245
|
-
<div class="button-barcode-set">
|
|
246
|
-
{#if barcodeIcons[index]}
|
|
247
|
-
<DataMatrixIcon
|
|
248
|
-
title={button.label}
|
|
249
|
-
icon={{ kind: 'svg', svg: barcodeIcons[index] }}
|
|
250
|
-
/>
|
|
251
|
-
{/if}
|
|
252
|
-
<button
|
|
253
|
-
class:call-to-action={button.colourSet === ColourSet.CallToAction}
|
|
254
|
-
class:primary={button.colourSet === ColourSet.Primary}
|
|
255
|
-
class:secondary-colour={button.colourSet === ColourSet.Secondary}
|
|
256
|
-
class:warning={button.colourSet === ColourSet.Warning}
|
|
257
|
-
class:error={button.colourSet === ColourSet.Error}
|
|
258
|
-
class:info={button.colourSet === ColourSet.Info}
|
|
259
|
-
onkeydown={passthrough}
|
|
260
|
-
disabled={!buttonIsValid || !isValid}
|
|
261
|
-
class:margin-left={button.margin === 'left'}
|
|
262
|
-
class:margin-right={button.margin === 'right'}
|
|
263
|
-
bind:this={submitRef}
|
|
264
|
-
type={button.type ?? 'submit'}>{button.label}</button
|
|
265
|
-
>
|
|
266
|
-
</div>
|
|
267
|
-
{/if}
|
|
268
|
-
{/each}
|
|
269
|
-
</div>
|
|
270
|
-
{/if}
|
|
271
|
-
</form>
|
|
272
|
-
</BaseModal>
|
|
273
|
-
|
|
67
|
+
}
|
|
68
|
+
function handleEsc(e) {
|
|
69
|
+
if (e.key === "Escape") {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
if (!mandatory) {
|
|
72
|
+
open = false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function requestClose() {
|
|
77
|
+
open = false;
|
|
78
|
+
}
|
|
79
|
+
const dialogClassNames = $derived([
|
|
80
|
+
staticHeight ? "static-height" : null,
|
|
81
|
+
staticWidth ? "static-width" : null,
|
|
82
|
+
noscroll ? "noscroll" : null
|
|
83
|
+
].filter((c) => c !== null).join(" "));
|
|
84
|
+
const dialogStyle = $derived(`--timer: ${defaultTimer ? defaultTimer.time.toString() + "ms" : "unset"};` + `--dialog-min-width: ${minWidth};` + `--dialog-min-height: ${minHeight};` + (height != null ? `--dialog-height: ${height};` : "") + (width != null ? `--dialog-width: ${width};` : ""));
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<BaseModal
|
|
88
|
+
bind:value={open}
|
|
89
|
+
{onclose}
|
|
90
|
+
{mandatory}
|
|
91
|
+
dialogClass={dialogClassNames}
|
|
92
|
+
{dialogStyle}
|
|
93
|
+
>
|
|
94
|
+
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
95
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
96
|
+
<form
|
|
97
|
+
method="dialog"
|
|
98
|
+
bind:this={form}
|
|
99
|
+
onsubmit={(e) => {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
clearTimer();
|
|
102
|
+
if (isActive) {
|
|
103
|
+
onsubmit?.(e);
|
|
104
|
+
}
|
|
105
|
+
}}
|
|
106
|
+
onclick={clearTimer}
|
|
107
|
+
class="modal-root"
|
|
108
|
+
>
|
|
109
|
+
<div class="modal-header">
|
|
110
|
+
{#if mandatory}
|
|
111
|
+
<div class="title-wrapper">
|
|
112
|
+
<h3 class="modal-heading">{header}</h3>
|
|
113
|
+
</div>
|
|
114
|
+
{:else}
|
|
115
|
+
<div class="title-wrapper">
|
|
116
|
+
<h3 class="modal-heading padded">{header}</h3>
|
|
117
|
+
<div class="close-button">
|
|
118
|
+
<Action
|
|
119
|
+
size={Size.Large}
|
|
120
|
+
onclick={requestClose}
|
|
121
|
+
icon={{
|
|
122
|
+
name: 'cross',
|
|
123
|
+
size: Size.DoubleXLarge,
|
|
124
|
+
}}
|
|
125
|
+
onkeydown={handleEsc}
|
|
126
|
+
colourSet={ColourSet.Primary}
|
|
127
|
+
label="Close Modal"
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
{/if}
|
|
132
|
+
|
|
133
|
+
{#if headerExtra}
|
|
134
|
+
{@render headerExtra()}
|
|
135
|
+
{/if}
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
{#if defaultTimer}
|
|
139
|
+
<div class="bar-container">
|
|
140
|
+
<div
|
|
141
|
+
class:paused
|
|
142
|
+
class="bar-timer"
|
|
143
|
+
></div>
|
|
144
|
+
</div>
|
|
145
|
+
{/if}
|
|
146
|
+
|
|
147
|
+
<div
|
|
148
|
+
class="modal-main"
|
|
149
|
+
class:row
|
|
150
|
+
class:wrap
|
|
151
|
+
class:noscroll
|
|
152
|
+
>
|
|
153
|
+
{#if explanation}
|
|
154
|
+
{@render explanation()}
|
|
155
|
+
{/if}
|
|
156
|
+
{@render children()}
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
{#if footer}
|
|
160
|
+
{@render footer()}
|
|
161
|
+
{:else if buttons?.length}
|
|
162
|
+
<div class="modal-footer">
|
|
163
|
+
{#each buttons as button, index (button.label)}
|
|
164
|
+
{@const buttonIsValid = buttonValidities.value[index] ?? true}
|
|
165
|
+
{#if button.callback}
|
|
166
|
+
<div class="button-barcode-set">
|
|
167
|
+
{#if barcodeIcons[index]}
|
|
168
|
+
<DataMatrixIcon
|
|
169
|
+
title={button.label}
|
|
170
|
+
icon={{ kind: 'svg', svg: barcodeIcons[index] }}
|
|
171
|
+
/>
|
|
172
|
+
{/if}
|
|
173
|
+
<button
|
|
174
|
+
class:call-to-action={button.colourSet === ColourSet.CallToAction}
|
|
175
|
+
class:primary={button.colourSet === ColourSet.Primary}
|
|
176
|
+
class:secondary-colour={button.colourSet === ColourSet.Secondary}
|
|
177
|
+
class:warning={button.colourSet === ColourSet.Warning}
|
|
178
|
+
class:error={button.colourSet === ColourSet.Error}
|
|
179
|
+
class:info={button.colourSet === ColourSet.Info}
|
|
180
|
+
onkeydown={passthrough}
|
|
181
|
+
disabled={!buttonIsValid}
|
|
182
|
+
class:margin-left={button.margin === 'left'}
|
|
183
|
+
class:margin-right={button.margin === 'right'}
|
|
184
|
+
type={button.type ?? 'button'}
|
|
185
|
+
onclick={button.callback}>{button.label}</button
|
|
186
|
+
>
|
|
187
|
+
</div>
|
|
188
|
+
{:else}
|
|
189
|
+
<div class="button-barcode-set">
|
|
190
|
+
{#if barcodeIcons[index]}
|
|
191
|
+
<DataMatrixIcon
|
|
192
|
+
title={button.label}
|
|
193
|
+
icon={{ kind: 'svg', svg: barcodeIcons[index] }}
|
|
194
|
+
/>
|
|
195
|
+
{/if}
|
|
196
|
+
<button
|
|
197
|
+
class:call-to-action={button.colourSet === ColourSet.CallToAction}
|
|
198
|
+
class:primary={button.colourSet === ColourSet.Primary}
|
|
199
|
+
class:secondary-colour={button.colourSet === ColourSet.Secondary}
|
|
200
|
+
class:warning={button.colourSet === ColourSet.Warning}
|
|
201
|
+
class:error={button.colourSet === ColourSet.Error}
|
|
202
|
+
class:info={button.colourSet === ColourSet.Info}
|
|
203
|
+
onkeydown={passthrough}
|
|
204
|
+
disabled={!buttonIsValid || !isValid}
|
|
205
|
+
class:margin-left={button.margin === 'left'}
|
|
206
|
+
class:margin-right={button.margin === 'right'}
|
|
207
|
+
bind:this={submitRef}
|
|
208
|
+
type={button.type ?? 'submit'}>{button.label}</button
|
|
209
|
+
>
|
|
210
|
+
</div>
|
|
211
|
+
{/if}
|
|
212
|
+
{/each}
|
|
213
|
+
</div>
|
|
214
|
+
{/if}
|
|
215
|
+
</form>
|
|
216
|
+
</BaseModal>
|
|
217
|
+
|
|
274
218
|
<style>dialog {
|
|
275
219
|
overflow: clip;
|
|
276
220
|
background-color: #e9ecf1;
|
|
@@ -518,4 +462,4 @@ div.bar-container div.bar-timer.paused {
|
|
|
518
462
|
animation-play-state: paused;
|
|
519
463
|
opacity: 0%;
|
|
520
464
|
transition: opacity 300ms 0s ease-out;
|
|
521
|
-
}</style>
|
|
465
|
+
}</style>
|