@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,47 +1,39 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let dialog: HTMLDialogElement | undefined = $state();
|
|
10
|
-
|
|
11
|
-
$effect(() => {
|
|
12
|
-
if (!dialog) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (showModal && !dialog.open) {
|
|
16
|
-
dialog.showModal();
|
|
17
|
-
} else if (!showModal && dialog.open) {
|
|
18
|
-
dialog.close();
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
function uncloseable(
|
|
23
|
-
e: KeyboardEvent & { currentTarget: EventTarget & HTMLDialogElement }
|
|
24
|
-
): void {
|
|
25
|
-
if (e.key === 'Escape') {
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
}
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import LoadingAnimation from "./LoadingAnimation.svelte";
|
|
4
|
+
const { showModal, message, name, caption } = $props();
|
|
5
|
+
let dialog = $state();
|
|
6
|
+
$effect(() => {
|
|
7
|
+
if (!dialog) {
|
|
8
|
+
return;
|
|
28
9
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
10
|
+
if (showModal && !dialog.open) {
|
|
11
|
+
dialog.showModal();
|
|
12
|
+
} else if (!showModal && dialog.open) {
|
|
13
|
+
dialog.close();
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
function uncloseable(e) {
|
|
17
|
+
if (e.key === "Escape") {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<dialog
|
|
24
|
+
bind:this={dialog}
|
|
25
|
+
onkeydown={uncloseable}
|
|
26
|
+
aria-label={message ?? 'Loading'}
|
|
27
|
+
aria-live="polite"
|
|
28
|
+
>
|
|
29
|
+
<div class="modal-root">
|
|
30
|
+
<LoadingAnimation
|
|
31
|
+
{name}
|
|
32
|
+
caption={message ?? caption}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</dialog>
|
|
36
|
+
|
|
45
37
|
<style>dialog {
|
|
46
38
|
overflow: clip;
|
|
47
39
|
background-color: #e9ecf1;
|
|
@@ -306,4 +298,4 @@ dialog .modal-root {
|
|
|
306
298
|
align-items: center;
|
|
307
299
|
background: rgba(0, 0, 0, 0);
|
|
308
300
|
position: relative;
|
|
309
|
-
}</style>
|
|
301
|
+
}</style>
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
caption={message ?? caption}
|
|
23
|
-
/>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import LoadingAnimation from "./LoadingAnimation.svelte";
|
|
4
|
+
const { message, absolute, borderRadius, name, caption } = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div
|
|
8
|
+
class="loading-overlay"
|
|
9
|
+
class:absolute
|
|
10
|
+
role="status"
|
|
11
|
+
aria-live="polite"
|
|
12
|
+
style={borderRadius != null && borderRadius.length > 0
|
|
13
|
+
? `border-radius: ${borderRadius};`
|
|
14
|
+
: undefined}
|
|
15
|
+
>
|
|
16
|
+
<LoadingAnimation
|
|
17
|
+
{name}
|
|
18
|
+
caption={message ?? caption}
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
26
22
|
<style>.loading-overlay {
|
|
27
23
|
display: flex;
|
|
28
24
|
position: fixed;
|
|
@@ -41,4 +37,4 @@
|
|
|
41
37
|
}
|
|
42
38
|
.loading-overlay.absolute {
|
|
43
39
|
position: absolute;
|
|
44
|
-
}</style>
|
|
40
|
+
}</style>
|
|
@@ -1,260 +1,210 @@
|
|
|
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
|
-
|
|
42
|
-
}: ModalProps = $props();
|
|
43
|
-
|
|
44
|
-
// `open` drives BaseModal's bindable `value`. Default true (the
|
|
45
|
-
// legacy "open immediately on mount" semantic). Flipping it to
|
|
46
|
-
// false closes the dialog; BaseModal will fire `onclose` after
|
|
47
|
-
// the native `close` event.
|
|
48
|
-
let open = $state(true);
|
|
49
|
-
let form: HTMLFormElement | undefined = $state();
|
|
50
|
-
let timeout: ReturnType<typeof setTimeout> | undefined = undefined;
|
|
51
|
-
let paused = $state(false);
|
|
52
|
-
let isActive = $state(false);
|
|
53
|
-
|
|
54
|
-
// Pre-compute barcode SVGs once per `buttons` array. Building a DataMatrix
|
|
55
|
-
// barcode is non-trivial; rebuilding inside the each-block re-runs the
|
|
56
|
-
// encoder on every render.
|
|
57
|
-
//
|
|
58
|
-
// `DATAMatrix` calls `document.createElement` internally, which is
|
|
59
|
-
// undefined during SvelteKit's server render. Returning `null` on the
|
|
60
|
-
// server keeps the SVG slots empty for SSR; the client re-renders with
|
|
61
|
-
// the real encoded payload after hydration.
|
|
62
|
-
const barcodeIcons = $derived.by(
|
|
63
|
-
() =>
|
|
64
|
-
buttons?.map((b) =>
|
|
65
|
-
b.barcodeValue != null && browser ? DATAMatrix(b.barcodeValue) : null
|
|
66
|
-
) ?? []
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
onMount(() => {
|
|
70
|
-
// Fire onShowCallback after BaseModal has had a chance to call
|
|
71
|
-
// `showModal()`. BaseModal uses a tick() internally so we match
|
|
72
|
-
// that with a microtask here.
|
|
73
|
-
queueMicrotask(() => {
|
|
74
|
-
onShowCallback?.();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const activeTimer = setTimeout(() => {
|
|
78
|
-
isActive = true;
|
|
79
|
-
}, 200);
|
|
80
|
-
if (defaultTimer) {
|
|
81
|
-
timeout = setTimeout(() => {
|
|
82
|
-
if (open) {
|
|
83
|
-
if (defaultTimer.action === 'submit') {
|
|
84
|
-
form?.requestSubmit();
|
|
85
|
-
} else {
|
|
86
|
-
open = false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}, defaultTimer.time);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return () => {
|
|
93
|
-
clearTimeout(activeTimer);
|
|
94
|
-
clearTimer();
|
|
95
|
-
};
|
|
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 { passthrough } from "../Helpers/Helpers.svelte.js";
|
|
9
|
+
import { ColourSet } from "../scss/colours.js";
|
|
10
|
+
import { Size } from "../Types/Internal/Size.js";
|
|
11
|
+
import { onMount } from "svelte";
|
|
12
|
+
import Action from "./Action.svelte";
|
|
13
|
+
import BaseModal from "./Base/BaseModal.svelte";
|
|
14
|
+
import DataMatrixIcon from "./DataMatrixIcon.svelte";
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">let { header, buttons, mandatory = false, staticHeight = false, staticWidth = false, minWidth, minHeight, width, height, onShowCallback, submitRef = $bindable(), defaultTimer, isValid = true, noscroll = false, onsubmit, headerExtra, explanation, children, footer, onclose, autofocusSelector } = $props();
|
|
18
|
+
// `open` drives BaseModal's bindable `value`. Default true (the
|
|
19
|
+
// legacy "open immediately on mount" semantic). Flipping it to
|
|
20
|
+
// false closes the dialog; BaseModal will fire `onclose` after
|
|
21
|
+
// the native `close` event.
|
|
22
|
+
let open = $state(true);
|
|
23
|
+
let form = $state();
|
|
24
|
+
let timeout = undefined;
|
|
25
|
+
let paused = $state(false);
|
|
26
|
+
let isActive = $state(false);
|
|
27
|
+
// Pre-compute barcode SVGs once per `buttons` array. Building a DataMatrix
|
|
28
|
+
// barcode is non-trivial; rebuilding inside the each-block re-runs the
|
|
29
|
+
// encoder on every render.
|
|
30
|
+
//
|
|
31
|
+
// `DATAMatrix` calls `document.createElement` internally, which is
|
|
32
|
+
// undefined during SvelteKit's server render. Returning `null` on the
|
|
33
|
+
// server keeps the SVG slots empty for SSR; the client re-renders with
|
|
34
|
+
// the real encoded payload after hydration.
|
|
35
|
+
const barcodeIcons = $derived.by(() => buttons?.map((b) => b.barcodeValue != null && browser ? DATAMatrix(b.barcodeValue) : null) ?? []);
|
|
36
|
+
onMount(() => {
|
|
37
|
+
// Fire onShowCallback after BaseModal has had a chance to call
|
|
38
|
+
// `showModal()`. BaseModal uses a tick() internally so we match
|
|
39
|
+
// that with a microtask here.
|
|
40
|
+
queueMicrotask(() => {
|
|
41
|
+
onShowCallback?.();
|
|
96
42
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// than triggering the button's default activation.
|
|
109
|
-
e.stopPropagation();
|
|
110
|
-
if (e.key === 'Escape') {
|
|
111
|
-
e.preventDefault();
|
|
112
|
-
if (!mandatory) {
|
|
113
|
-
open = false;
|
|
43
|
+
const activeTimer = setTimeout(() => {
|
|
44
|
+
isActive = true;
|
|
45
|
+
}, 200);
|
|
46
|
+
if (defaultTimer) {
|
|
47
|
+
timeout = setTimeout(() => {
|
|
48
|
+
if (open) {
|
|
49
|
+
if (defaultTimer.action === "submit") {
|
|
50
|
+
form?.requestSubmit();
|
|
51
|
+
} else {
|
|
52
|
+
open = false;
|
|
53
|
+
}
|
|
114
54
|
}
|
|
115
|
-
}
|
|
55
|
+
}, defaultTimer.time);
|
|
116
56
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
57
|
+
return () => {
|
|
58
|
+
clearTimeout(activeTimer);
|
|
59
|
+
clearTimer();
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
function clearTimer() {
|
|
63
|
+
if (timeout != undefined) {
|
|
64
|
+
paused = true;
|
|
65
|
+
clearTimeout(timeout);
|
|
120
66
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
{
|
|
190
|
-
{@render
|
|
191
|
-
{/if}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{@render
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
67
|
+
}
|
|
68
|
+
function handleEsc(e) {
|
|
69
|
+
// Forwarded to the Action button's onkeydown so an Escape press
|
|
70
|
+
// while the close icon has focus still closes the dialog rather
|
|
71
|
+
// than triggering the button's default activation.
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
if (e.key === "Escape") {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
if (!mandatory) {
|
|
76
|
+
open = false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function requestClose() {
|
|
81
|
+
open = false;
|
|
82
|
+
}
|
|
83
|
+
const dialogClassNames = $derived([
|
|
84
|
+
staticHeight ? "static-height" : null,
|
|
85
|
+
staticWidth ? "static-width" : null,
|
|
86
|
+
noscroll ? "noscroll" : null
|
|
87
|
+
].filter((c) => c !== null).join(" "));
|
|
88
|
+
const dialogStyle = $derived(`--timer: ${defaultTimer ? defaultTimer.time.toString() + "ms" : "unset"};` + (minWidth != null ? `--dialog-min-width: ${minWidth};` : "") + (minHeight != null ? `--dialog-min-height: ${minHeight};` : "") + (height != null ? `--dialog-height: ${height};` : "") + (width != null ? `--dialog-width: ${width};` : ""));
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<BaseModal
|
|
92
|
+
bind:value={open}
|
|
93
|
+
{onclose}
|
|
94
|
+
{mandatory}
|
|
95
|
+
{autofocusSelector}
|
|
96
|
+
dialogClass={dialogClassNames}
|
|
97
|
+
{dialogStyle}
|
|
98
|
+
>
|
|
99
|
+
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
100
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
101
|
+
<form
|
|
102
|
+
method="dialog"
|
|
103
|
+
bind:this={form}
|
|
104
|
+
onsubmit={(e) => {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
clearTimer();
|
|
107
|
+
if (isActive) {
|
|
108
|
+
onsubmit?.(e);
|
|
109
|
+
}
|
|
110
|
+
}}
|
|
111
|
+
onclick={clearTimer}
|
|
112
|
+
class="modal-root"
|
|
113
|
+
>
|
|
114
|
+
<div class="modal-header">
|
|
115
|
+
{#if typeof header === 'string'}
|
|
116
|
+
{#if mandatory}
|
|
117
|
+
<h3 class="modal-heading">{header}</h3>
|
|
118
|
+
{:else}
|
|
119
|
+
<div class="title-wrapper">
|
|
120
|
+
<h3 class="modal-heading">{header}</h3>
|
|
121
|
+
<div class="close-button">
|
|
122
|
+
<Action
|
|
123
|
+
size={Size.DoubleXLarge}
|
|
124
|
+
onclick={requestClose}
|
|
125
|
+
icon={{
|
|
126
|
+
name: 'cross',
|
|
127
|
+
}}
|
|
128
|
+
onkeydown={handleEsc}
|
|
129
|
+
colourSet={ColourSet.Primary}
|
|
130
|
+
label="Close Modal"
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
{/if}
|
|
135
|
+
{:else if typeof header === 'function'}
|
|
136
|
+
{@render header()}
|
|
137
|
+
{/if}
|
|
138
|
+
|
|
139
|
+
{#if headerExtra}
|
|
140
|
+
{@render headerExtra()}
|
|
141
|
+
{/if}
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
{#if defaultTimer}
|
|
145
|
+
<div class="bar-container">
|
|
146
|
+
<div
|
|
147
|
+
class:paused
|
|
148
|
+
class="bar-timer"
|
|
149
|
+
></div>
|
|
150
|
+
</div>
|
|
151
|
+
{/if}
|
|
152
|
+
|
|
153
|
+
<div
|
|
154
|
+
class="modal-main"
|
|
155
|
+
class:noscroll
|
|
156
|
+
>
|
|
157
|
+
{#if explanation}
|
|
158
|
+
{@render explanation()}
|
|
159
|
+
{/if}
|
|
160
|
+
{@render children()}
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
{#if footer}
|
|
164
|
+
{@render footer()}
|
|
165
|
+
{:else if buttons?.length}
|
|
166
|
+
<div class="modal-footer">
|
|
167
|
+
{#each buttons as button, index (button.label)}
|
|
168
|
+
{#if button.callback}
|
|
169
|
+
<div class="button-barcode-set">
|
|
170
|
+
{#if barcodeIcons[index]}
|
|
171
|
+
<DataMatrixIcon
|
|
172
|
+
title={button.label}
|
|
173
|
+
icon={{ kind: 'svg', svg: barcodeIcons[index] }}
|
|
174
|
+
/>
|
|
175
|
+
{/if}
|
|
176
|
+
<button
|
|
177
|
+
onkeydown={passthrough}
|
|
178
|
+
class:margin-left={button.margin === 'left'}
|
|
179
|
+
class:margin-right={button.margin === 'right'}
|
|
180
|
+
type={button.type ?? 'button'}
|
|
181
|
+
onclick={button.callback}>{button.label}</button
|
|
182
|
+
>
|
|
183
|
+
</div>
|
|
184
|
+
{:else}
|
|
185
|
+
<div class="button-barcode-set">
|
|
186
|
+
{#if barcodeIcons[index]}
|
|
187
|
+
<DataMatrixIcon
|
|
188
|
+
title={button.label}
|
|
189
|
+
icon={{ kind: 'svg', svg: barcodeIcons[index] }}
|
|
190
|
+
/>
|
|
191
|
+
{/if}
|
|
192
|
+
<button
|
|
193
|
+
onkeydown={passthrough}
|
|
194
|
+
disabled={!isValid}
|
|
195
|
+
class:margin-left={button.margin === 'left'}
|
|
196
|
+
class:margin-right={button.margin === 'right'}
|
|
197
|
+
bind:this={submitRef}
|
|
198
|
+
type={button.type ?? 'submit'}>{button.label}</button
|
|
199
|
+
>
|
|
200
|
+
</div>
|
|
201
|
+
{/if}
|
|
202
|
+
{/each}
|
|
203
|
+
</div>
|
|
204
|
+
{/if}
|
|
205
|
+
</form>
|
|
206
|
+
</BaseModal>
|
|
207
|
+
|
|
258
208
|
<style>dialog {
|
|
259
209
|
overflow: clip;
|
|
260
210
|
background-color: #e9ecf1;
|
|
@@ -604,4 +554,4 @@ div.bar-container div.bar-timer.paused {
|
|
|
604
554
|
}
|
|
605
555
|
:global form > *:last-child {
|
|
606
556
|
border-radius: 0px 0px 4px 4px;
|
|
607
|
-
}</style>
|
|
557
|
+
}</style>
|