@lavalogic/scoria 0.35.0 → 0.36.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/README.md +58 -58
- package/dist/Components/AccordionGroup.svelte +42 -42
- package/dist/Components/AccordionGroupButton.svelte +99 -99
- package/dist/Components/Action.svelte +138 -138
- package/dist/Components/AlertModal.svelte +125 -125
- package/dist/Components/Base/ContextWrapper.svelte +50 -50
- package/dist/Components/Base/Pagination.svelte +190 -190
- package/dist/Components/Base/Snippets.svelte +29 -29
- package/dist/Components/BigRadioSet.svelte +29 -29
- package/dist/Components/Bubble.svelte +77 -77
- package/dist/Components/Button.svelte +197 -197
- package/dist/Components/Checkbox.svelte +68 -68
- package/dist/Components/CollapsibleCard.svelte +70 -70
- package/dist/Components/Contexts/ContextMenu.svelte +157 -157
- package/dist/Components/Contexts/ContextMenuDivider.svelte +11 -11
- package/dist/Components/Contexts/ContextMenuOption.svelte +52 -52
- package/dist/Components/Contexts/Toast.svelte +61 -61
- package/dist/Components/Contexts/ToastContainer.svelte +46 -46
- package/dist/Components/Contexts/Tooltip.svelte +26 -26
- package/dist/Components/DataMatrixIcon.svelte +41 -41
- package/dist/Components/DateInput.svelte +109 -109
- package/dist/Components/DatePicker.svelte +312 -312
- package/dist/Components/DesktopModal.svelte +106 -106
- package/dist/Components/Dial.svelte +151 -151
- package/dist/Components/DimensionInput.svelte +184 -184
- package/dist/Components/DragMenu/DragMenuHolder.svelte +106 -106
- package/dist/Components/DragMenu/DraggableCard.svelte +41 -41
- package/dist/Components/FileCard.svelte +20 -20
- package/dist/Components/FileUpload.svelte +196 -196
- package/dist/Components/GridInput.svelte +190 -190
- package/dist/Components/GridInputSet.svelte +22 -22
- package/dist/Components/HorizontalTabGroup.svelte +78 -78
- package/dist/Components/HorizontalTabGroupButton.svelte +96 -96
- package/dist/Components/Icon.svelte +97 -97
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/LoadingAnimation.svelte +32 -32
- package/dist/Components/LoadingModal.svelte +47 -47
- package/dist/Components/LoadingOverlay.svelte +27 -27
- package/dist/Components/Modal.svelte +251 -251
- package/dist/Components/MultiSelect.svelte +197 -197
- package/dist/Components/Nav/Nav.svelte +97 -97
- package/dist/Components/Nav/NavServiceMenuList.svelte +34 -34
- package/dist/Components/Nav/NavTab.svelte +91 -91
- package/dist/Components/Nav/ServiceMenuItem.svelte +91 -91
- package/dist/Components/Nav/ServicesNav.svelte +53 -53
- package/dist/Components/NumberInput.svelte +144 -144
- package/dist/Components/PageHeading.svelte +36 -36
- package/dist/Components/PasswordInput.svelte +73 -73
- package/dist/Components/Portal.svelte +25 -25
- package/dist/Components/ProgressBubble.svelte +80 -80
- package/dist/Components/QuerySelect.svelte +411 -411
- package/dist/Components/SingleSelect.svelte +261 -261
- package/dist/Components/StepButton.svelte +120 -120
- package/dist/Components/StepForm.svelte +108 -108
- package/dist/Components/Switch.svelte +36 -36
- package/dist/Components/Table/Body/QuickSearchCell.svelte +632 -632
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +30 -30
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +56 -56
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +179 -179
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +49 -49
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +180 -180
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +102 -102
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +119 -119
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +114 -114
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +96 -96
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +72 -72
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +131 -131
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +144 -144
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +238 -238
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +358 -358
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +338 -338
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +183 -183
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +309 -309
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +369 -369
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +170 -170
- package/dist/Components/Table/Body/Rows/TableRow.svelte +259 -259
- package/dist/Components/Table/Body/TableBody.svelte +67 -67
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +39 -39
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +28 -28
- package/dist/Components/Table/Headers/TableHead.svelte +260 -260
- package/dist/Components/Table/Misc/ColumnPanel.svelte +78 -78
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +99 -99
- package/dist/Components/Table/Misc/FilterInput.svelte +556 -556
- package/dist/Components/Table/Misc/FilterPanel.svelte +46 -46
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +67 -67
- package/dist/Components/Table/Misc/SidePanel.svelte +32 -32
- package/dist/Components/Table/Misc/TableFooter.svelte +304 -304
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +156 -156
- package/dist/Components/Table/Misc/TableSidebar.svelte +176 -176
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +77 -77
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +91 -91
- package/dist/Components/Table/NestedTable.svelte +84 -84
- package/dist/Components/Table/Table.svelte +492 -492
- package/dist/Components/Test/TestContextConsumer.svelte +13 -13
- package/dist/Components/TextArea.svelte +108 -108
- package/dist/Components/TextInput.svelte +147 -147
- package/dist/Components/ThreeStateRadio.svelte +124 -124
- package/dist/Components/Touch/BoolCard.svelte +52 -52
- package/dist/Components/Touch/DateModal.svelte +217 -217
- package/dist/Components/Touch/EditCard.svelte +52 -52
- package/dist/Components/Touch/InfoCard.svelte +24 -24
- package/dist/Components/Touch/InfoTextCard.svelte +21 -21
- package/dist/Components/Touch/ModalExplanation.svelte +20 -20
- package/dist/Components/Touch/NumberKeyboard.svelte +268 -268
- package/dist/Components/Touch/NumberModal.svelte +69 -69
- package/dist/Components/Touch/PlusMinusCard.svelte +50 -50
- package/dist/Components/Touch/SelectModal.svelte +105 -105
- package/dist/Components/Touch/SummaryCard.svelte +65 -65
- package/dist/Components/Touch/TextAreaModal.svelte +86 -86
- package/dist/Components/Touch/TextModal.svelte +123 -123
- package/dist/Components/Touch/TouchCard.svelte +28 -28
- package/dist/Components/Touch/TouchModal.svelte +259 -259
- package/dist/Components/Touch/UtilityButton.svelte +91 -91
- package/dist/Components/VerticalTabGroup.svelte +66 -66
- package/dist/Components/VerticalTabGroupButton.svelte +97 -97
- package/dist/Helpers/Datamatrix.d.ts +10 -10
- package/dist/Helpers/Datamatrix.js +1 -1
- package/dist/Helpers/Helpers.svelte.d.ts +1 -0
- package/dist/Helpers/Helpers.svelte.js +15 -0
- package/dist/Types/Examples/ExampleModal.svelte +34 -34
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3016 -3016
- package/dist/scss/_sizing.scss +69 -69
- package/dist/scss/_transitions.scss +8 -8
- package/package.json +30 -30
|
@@ -1,261 +1,261 @@
|
|
|
1
|
-
<!-- eslint-disable prefer-const -->
|
|
2
|
-
<svelte:options runes />
|
|
3
|
-
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
import { DATAMatrix } from '../../Helpers/Datamatrix.js';
|
|
6
|
-
import { passthrough } from '../../Helpers/Helpers.svelte.js';
|
|
7
|
-
import { ColourSet } from '../../scss/colours.js';
|
|
8
|
-
import { Size } from '../../Types/Internal/Size.js';
|
|
9
|
-
import { onMount } from 'svelte';
|
|
10
|
-
import Action from '../Action.svelte';
|
|
11
|
-
import DataMatrixIcon from '../DataMatrixIcon.svelte';
|
|
12
|
-
import type { TouchModalProps } from './TouchModalProps.js';
|
|
13
|
-
|
|
14
|
-
let {
|
|
15
|
-
header,
|
|
16
|
-
buttons,
|
|
17
|
-
mandatory = false,
|
|
18
|
-
staticHeight = false,
|
|
19
|
-
staticWidth = false,
|
|
20
|
-
minWidth = '400px',
|
|
21
|
-
minHeight = '280px',
|
|
22
|
-
width,
|
|
23
|
-
height,
|
|
24
|
-
onShowCallback,
|
|
25
|
-
defaultTimer,
|
|
26
|
-
isValid = true,
|
|
27
|
-
noscroll = false,
|
|
28
|
-
onsubmit,
|
|
29
|
-
headerExtra,
|
|
30
|
-
explanation,
|
|
31
|
-
children,
|
|
32
|
-
footer,
|
|
33
|
-
onclose,
|
|
34
|
-
row,
|
|
35
|
-
wrap,
|
|
36
|
-
submitRef = $bindable(),
|
|
37
|
-
}: TouchModalProps = $props();
|
|
38
|
-
|
|
39
|
-
let dialog: HTMLDialogElement | undefined;
|
|
40
|
-
let form: HTMLFormElement;
|
|
41
|
-
let timeout: ReturnType<typeof setTimeout> | undefined = undefined;
|
|
42
|
-
let paused = $state(false);
|
|
43
|
-
|
|
44
|
-
$effect(() => {
|
|
45
|
-
if (dialog) {
|
|
46
|
-
dialog.showModal();
|
|
47
|
-
onShowCallback?.();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
let isActive = false;
|
|
52
|
-
|
|
53
|
-
onMount(() => {
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
isActive = true;
|
|
56
|
-
}, 200);
|
|
57
|
-
|
|
58
|
-
if (defaultTimer) {
|
|
59
|
-
timeout = setTimeout(() => {
|
|
60
|
-
if (dialog && dialog.open) {
|
|
61
|
-
if (defaultTimer.action === 'submit') {
|
|
62
|
-
form.requestSubmit();
|
|
63
|
-
defaultTimer.callback?.();
|
|
64
|
-
} else {
|
|
65
|
-
dialog.close();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, defaultTimer.time);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return clearTimer;
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
function clearTimer() {
|
|
75
|
-
if (timeout != undefined) {
|
|
76
|
-
paused = true;
|
|
77
|
-
clearTimeout(timeout);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function handleEsc(e: KeyboardEvent) {
|
|
82
|
-
// e.stopPropagation();
|
|
83
|
-
|
|
84
|
-
if (e.key === 'Escape') {
|
|
85
|
-
e.preventDefault();
|
|
86
|
-
if (!mandatory) {
|
|
87
|
-
dialog?.close();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
</script>
|
|
92
|
-
|
|
93
|
-
<dialog
|
|
94
|
-
style="--timer: {defaultTimer && defaultTimer.time.toString() + 'ms'}; {minWidth &&
|
|
95
|
-
`--dialog-min-width: ${minWidth};`} {minHeight &&
|
|
96
|
-
`--dialog-min-height: ${minHeight};`} {height && `--dialog-height: ${height};`} {width &&
|
|
97
|
-
`--dialog-width: ${width};`}"
|
|
98
|
-
class:static-height={staticHeight}
|
|
99
|
-
class:static-width={staticWidth}
|
|
100
|
-
class:noscroll
|
|
101
|
-
bind:this={dialog}
|
|
102
|
-
{onclose}
|
|
103
|
-
onkeydown={handleEsc}
|
|
104
|
-
onclick={(e) => {
|
|
105
|
-
if (e.target === dialog) {
|
|
106
|
-
if (!mandatory) {
|
|
107
|
-
dialog.close();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
clearTimer();
|
|
111
|
-
}}
|
|
112
|
-
>
|
|
113
|
-
<form
|
|
114
|
-
method="dialog"
|
|
115
|
-
bind:this={form}
|
|
116
|
-
onsubmit={(e) => {
|
|
117
|
-
e.preventDefault();
|
|
118
|
-
if (isActive) {
|
|
119
|
-
onsubmit?.(e);
|
|
120
|
-
}
|
|
121
|
-
}}
|
|
122
|
-
class="modal-root"
|
|
123
|
-
>
|
|
124
|
-
<div class="modal-header">
|
|
125
|
-
{#if mandatory}
|
|
126
|
-
<div class="title-wrapper">
|
|
127
|
-
<h3 class="modal-heading">{header}</h3>
|
|
128
|
-
</div>
|
|
129
|
-
{:else}
|
|
130
|
-
<div class="title-wrapper">
|
|
131
|
-
<h3 class="modal-heading padded">{header}</h3>
|
|
132
|
-
<div class="close-button">
|
|
133
|
-
<Action
|
|
134
|
-
size={Size.Large}
|
|
135
|
-
onclick={() => {
|
|
136
|
-
dialog?.close();
|
|
137
|
-
}}
|
|
138
|
-
icon={{
|
|
139
|
-
name: 'cross',
|
|
140
|
-
size: Size.DoubleXLarge,
|
|
141
|
-
}}
|
|
142
|
-
onkeydown={handleEsc}
|
|
143
|
-
colourSet={ColourSet.Primary}
|
|
144
|
-
label="Close Modal"
|
|
145
|
-
/>
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
{/if}
|
|
149
|
-
|
|
150
|
-
{#if headerExtra}
|
|
151
|
-
{@render headerExtra()}
|
|
152
|
-
{/if}
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
{#if defaultTimer}
|
|
156
|
-
<!-- class:paused -->
|
|
157
|
-
<div class="bar-container">
|
|
158
|
-
<div
|
|
159
|
-
class:paused
|
|
160
|
-
class="bar-timer"
|
|
161
|
-
></div>
|
|
162
|
-
</div>
|
|
163
|
-
{/if}
|
|
164
|
-
|
|
165
|
-
<div
|
|
166
|
-
class="modal-main"
|
|
167
|
-
class:row
|
|
168
|
-
class:wrap
|
|
169
|
-
class:noscroll
|
|
170
|
-
>
|
|
171
|
-
{#if explanation}
|
|
172
|
-
{@render explanation()}
|
|
173
|
-
{/if}
|
|
174
|
-
{@render children()}
|
|
175
|
-
</div>
|
|
176
|
-
|
|
177
|
-
{#if footer}
|
|
178
|
-
{@render footer()}
|
|
179
|
-
{:else if buttons?.length}
|
|
180
|
-
<div class="modal-footer">
|
|
181
|
-
{#each buttons as button (button)}
|
|
182
|
-
{#if button.callback}
|
|
183
|
-
<div class="button-barcode-set">
|
|
184
|
-
{#if button.barcodeValue}
|
|
185
|
-
{@const icon = DATAMatrix(button.barcodeValue)}
|
|
186
|
-
<DataMatrixIcon
|
|
187
|
-
title={button.label}
|
|
188
|
-
{icon}
|
|
189
|
-
/>
|
|
190
|
-
{/if}
|
|
191
|
-
{#await button.isValid}
|
|
192
|
-
<button
|
|
193
|
-
onkeydown={passthrough}
|
|
194
|
-
disabled
|
|
195
|
-
class:margin-left={button.margin === 'left'}
|
|
196
|
-
class:margin-right={button.margin === 'right'}
|
|
197
|
-
type={button.type ?? 'button'}
|
|
198
|
-
onclick={button.callback}>{button.label}</button
|
|
199
|
-
>
|
|
200
|
-
{:then buttonIsValid}
|
|
201
|
-
<button
|
|
202
|
-
class:call-to-action={button.colourSet === ColourSet.CallToAction}
|
|
203
|
-
class:primary={button.colourSet === ColourSet.Primary}
|
|
204
|
-
class:secondary-colour={button.colourSet === ColourSet.Secondary}
|
|
205
|
-
class:warning={button.colourSet === ColourSet.Warning}
|
|
206
|
-
class:error={button.colourSet === ColourSet.Error}
|
|
207
|
-
class:info={button.colourSet === ColourSet.Info}
|
|
208
|
-
onkeydown={passthrough}
|
|
209
|
-
disabled={buttonIsValid === false}
|
|
210
|
-
class:margin-left={button.margin === 'left'}
|
|
211
|
-
class:margin-right={button.margin === 'right'}
|
|
212
|
-
type={button.type ?? 'button'}
|
|
213
|
-
onclick={button.callback}>{button.label}</button
|
|
214
|
-
>
|
|
215
|
-
{/await}
|
|
216
|
-
</div>
|
|
217
|
-
{:else}
|
|
218
|
-
<div class="button-barcode-set">
|
|
219
|
-
{#if button.barcodeValue}
|
|
220
|
-
{@const icon = DATAMatrix(button.barcodeValue)}
|
|
221
|
-
<DataMatrixIcon
|
|
222
|
-
title={button.label}
|
|
223
|
-
{icon}
|
|
224
|
-
/>
|
|
225
|
-
{/if}
|
|
226
|
-
{#await button.isValid}
|
|
227
|
-
<button
|
|
228
|
-
onkeydown={passthrough}
|
|
229
|
-
disabled
|
|
230
|
-
class:margin-left={button.margin === 'left'}
|
|
231
|
-
class:margin-right={button.margin === 'right'}
|
|
232
|
-
bind:this={submitRef}
|
|
233
|
-
type={button.type ?? 'submit'}>{button.label}await</button
|
|
234
|
-
>
|
|
235
|
-
{:then buttonIsValid}
|
|
236
|
-
<button
|
|
237
|
-
class:call-to-action={button.colourSet === ColourSet.CallToAction}
|
|
238
|
-
class:primary={button.colourSet === ColourSet.Primary}
|
|
239
|
-
class:secondary-colour={button.colourSet === ColourSet.Secondary}
|
|
240
|
-
class:warning={button.colourSet === ColourSet.Warning}
|
|
241
|
-
class:error={button.colourSet === ColourSet.Error}
|
|
242
|
-
class:info={button.colourSet === ColourSet.Info}
|
|
243
|
-
onkeydown={passthrough}
|
|
244
|
-
disabled={buttonIsValid === false || !isValid}
|
|
245
|
-
class:margin-left={button.margin === 'left'}
|
|
246
|
-
class:margin-right={button.margin === 'right'}
|
|
247
|
-
bind:this={submitRef}
|
|
248
|
-
type={button.type ?? 'submit'}>{button.label}</button
|
|
249
|
-
>
|
|
250
|
-
{/await}
|
|
251
|
-
</div>
|
|
252
|
-
{/if}
|
|
253
|
-
{/each}
|
|
254
|
-
</div>
|
|
255
|
-
{/if}
|
|
256
|
-
</form>
|
|
257
|
-
</dialog>
|
|
258
|
-
|
|
1
|
+
<!-- eslint-disable prefer-const -->
|
|
2
|
+
<svelte:options runes />
|
|
3
|
+
|
|
4
|
+
<script lang="ts">
|
|
5
|
+
import { DATAMatrix } from '../../Helpers/Datamatrix.js';
|
|
6
|
+
import { passthrough } from '../../Helpers/Helpers.svelte.js';
|
|
7
|
+
import { ColourSet } from '../../scss/colours.js';
|
|
8
|
+
import { Size } from '../../Types/Internal/Size.js';
|
|
9
|
+
import { onMount } from 'svelte';
|
|
10
|
+
import Action from '../Action.svelte';
|
|
11
|
+
import DataMatrixIcon from '../DataMatrixIcon.svelte';
|
|
12
|
+
import type { TouchModalProps } from './TouchModalProps.js';
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
header,
|
|
16
|
+
buttons,
|
|
17
|
+
mandatory = false,
|
|
18
|
+
staticHeight = false,
|
|
19
|
+
staticWidth = false,
|
|
20
|
+
minWidth = '400px',
|
|
21
|
+
minHeight = '280px',
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
onShowCallback,
|
|
25
|
+
defaultTimer,
|
|
26
|
+
isValid = true,
|
|
27
|
+
noscroll = false,
|
|
28
|
+
onsubmit,
|
|
29
|
+
headerExtra,
|
|
30
|
+
explanation,
|
|
31
|
+
children,
|
|
32
|
+
footer,
|
|
33
|
+
onclose,
|
|
34
|
+
row,
|
|
35
|
+
wrap,
|
|
36
|
+
submitRef = $bindable(),
|
|
37
|
+
}: TouchModalProps = $props();
|
|
38
|
+
|
|
39
|
+
let dialog: HTMLDialogElement | undefined;
|
|
40
|
+
let form: HTMLFormElement;
|
|
41
|
+
let timeout: ReturnType<typeof setTimeout> | undefined = undefined;
|
|
42
|
+
let paused = $state(false);
|
|
43
|
+
|
|
44
|
+
$effect(() => {
|
|
45
|
+
if (dialog) {
|
|
46
|
+
dialog.showModal();
|
|
47
|
+
onShowCallback?.();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
let isActive = false;
|
|
52
|
+
|
|
53
|
+
onMount(() => {
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
isActive = true;
|
|
56
|
+
}, 200);
|
|
57
|
+
|
|
58
|
+
if (defaultTimer) {
|
|
59
|
+
timeout = setTimeout(() => {
|
|
60
|
+
if (dialog && dialog.open) {
|
|
61
|
+
if (defaultTimer.action === 'submit') {
|
|
62
|
+
form.requestSubmit();
|
|
63
|
+
defaultTimer.callback?.();
|
|
64
|
+
} else {
|
|
65
|
+
dialog.close();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, defaultTimer.time);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return clearTimer;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
function clearTimer() {
|
|
75
|
+
if (timeout != undefined) {
|
|
76
|
+
paused = true;
|
|
77
|
+
clearTimeout(timeout);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function handleEsc(e: KeyboardEvent) {
|
|
82
|
+
// e.stopPropagation();
|
|
83
|
+
|
|
84
|
+
if (e.key === 'Escape') {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
if (!mandatory) {
|
|
87
|
+
dialog?.close();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<dialog
|
|
94
|
+
style="--timer: {defaultTimer && defaultTimer.time.toString() + 'ms'}; {minWidth &&
|
|
95
|
+
`--dialog-min-width: ${minWidth};`} {minHeight &&
|
|
96
|
+
`--dialog-min-height: ${minHeight};`} {height && `--dialog-height: ${height};`} {width &&
|
|
97
|
+
`--dialog-width: ${width};`}"
|
|
98
|
+
class:static-height={staticHeight}
|
|
99
|
+
class:static-width={staticWidth}
|
|
100
|
+
class:noscroll
|
|
101
|
+
bind:this={dialog}
|
|
102
|
+
{onclose}
|
|
103
|
+
onkeydown={handleEsc}
|
|
104
|
+
onclick={(e) => {
|
|
105
|
+
if (e.target === dialog) {
|
|
106
|
+
if (!mandatory) {
|
|
107
|
+
dialog.close();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
clearTimer();
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<form
|
|
114
|
+
method="dialog"
|
|
115
|
+
bind:this={form}
|
|
116
|
+
onsubmit={(e) => {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
if (isActive) {
|
|
119
|
+
onsubmit?.(e);
|
|
120
|
+
}
|
|
121
|
+
}}
|
|
122
|
+
class="modal-root"
|
|
123
|
+
>
|
|
124
|
+
<div class="modal-header">
|
|
125
|
+
{#if mandatory}
|
|
126
|
+
<div class="title-wrapper">
|
|
127
|
+
<h3 class="modal-heading">{header}</h3>
|
|
128
|
+
</div>
|
|
129
|
+
{:else}
|
|
130
|
+
<div class="title-wrapper">
|
|
131
|
+
<h3 class="modal-heading padded">{header}</h3>
|
|
132
|
+
<div class="close-button">
|
|
133
|
+
<Action
|
|
134
|
+
size={Size.Large}
|
|
135
|
+
onclick={() => {
|
|
136
|
+
dialog?.close();
|
|
137
|
+
}}
|
|
138
|
+
icon={{
|
|
139
|
+
name: 'cross',
|
|
140
|
+
size: Size.DoubleXLarge,
|
|
141
|
+
}}
|
|
142
|
+
onkeydown={handleEsc}
|
|
143
|
+
colourSet={ColourSet.Primary}
|
|
144
|
+
label="Close Modal"
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
{/if}
|
|
149
|
+
|
|
150
|
+
{#if headerExtra}
|
|
151
|
+
{@render headerExtra()}
|
|
152
|
+
{/if}
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{#if defaultTimer}
|
|
156
|
+
<!-- class:paused -->
|
|
157
|
+
<div class="bar-container">
|
|
158
|
+
<div
|
|
159
|
+
class:paused
|
|
160
|
+
class="bar-timer"
|
|
161
|
+
></div>
|
|
162
|
+
</div>
|
|
163
|
+
{/if}
|
|
164
|
+
|
|
165
|
+
<div
|
|
166
|
+
class="modal-main"
|
|
167
|
+
class:row
|
|
168
|
+
class:wrap
|
|
169
|
+
class:noscroll
|
|
170
|
+
>
|
|
171
|
+
{#if explanation}
|
|
172
|
+
{@render explanation()}
|
|
173
|
+
{/if}
|
|
174
|
+
{@render children()}
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
{#if footer}
|
|
178
|
+
{@render footer()}
|
|
179
|
+
{:else if buttons?.length}
|
|
180
|
+
<div class="modal-footer">
|
|
181
|
+
{#each buttons as button (button)}
|
|
182
|
+
{#if button.callback}
|
|
183
|
+
<div class="button-barcode-set">
|
|
184
|
+
{#if button.barcodeValue}
|
|
185
|
+
{@const icon = DATAMatrix(button.barcodeValue)}
|
|
186
|
+
<DataMatrixIcon
|
|
187
|
+
title={button.label}
|
|
188
|
+
{icon}
|
|
189
|
+
/>
|
|
190
|
+
{/if}
|
|
191
|
+
{#await button.isValid}
|
|
192
|
+
<button
|
|
193
|
+
onkeydown={passthrough}
|
|
194
|
+
disabled
|
|
195
|
+
class:margin-left={button.margin === 'left'}
|
|
196
|
+
class:margin-right={button.margin === 'right'}
|
|
197
|
+
type={button.type ?? 'button'}
|
|
198
|
+
onclick={button.callback}>{button.label}</button
|
|
199
|
+
>
|
|
200
|
+
{:then buttonIsValid}
|
|
201
|
+
<button
|
|
202
|
+
class:call-to-action={button.colourSet === ColourSet.CallToAction}
|
|
203
|
+
class:primary={button.colourSet === ColourSet.Primary}
|
|
204
|
+
class:secondary-colour={button.colourSet === ColourSet.Secondary}
|
|
205
|
+
class:warning={button.colourSet === ColourSet.Warning}
|
|
206
|
+
class:error={button.colourSet === ColourSet.Error}
|
|
207
|
+
class:info={button.colourSet === ColourSet.Info}
|
|
208
|
+
onkeydown={passthrough}
|
|
209
|
+
disabled={buttonIsValid === false}
|
|
210
|
+
class:margin-left={button.margin === 'left'}
|
|
211
|
+
class:margin-right={button.margin === 'right'}
|
|
212
|
+
type={button.type ?? 'button'}
|
|
213
|
+
onclick={button.callback}>{button.label}</button
|
|
214
|
+
>
|
|
215
|
+
{/await}
|
|
216
|
+
</div>
|
|
217
|
+
{:else}
|
|
218
|
+
<div class="button-barcode-set">
|
|
219
|
+
{#if button.barcodeValue}
|
|
220
|
+
{@const icon = DATAMatrix(button.barcodeValue)}
|
|
221
|
+
<DataMatrixIcon
|
|
222
|
+
title={button.label}
|
|
223
|
+
{icon}
|
|
224
|
+
/>
|
|
225
|
+
{/if}
|
|
226
|
+
{#await button.isValid}
|
|
227
|
+
<button
|
|
228
|
+
onkeydown={passthrough}
|
|
229
|
+
disabled
|
|
230
|
+
class:margin-left={button.margin === 'left'}
|
|
231
|
+
class:margin-right={button.margin === 'right'}
|
|
232
|
+
bind:this={submitRef}
|
|
233
|
+
type={button.type ?? 'submit'}>{button.label}await</button
|
|
234
|
+
>
|
|
235
|
+
{:then buttonIsValid}
|
|
236
|
+
<button
|
|
237
|
+
class:call-to-action={button.colourSet === ColourSet.CallToAction}
|
|
238
|
+
class:primary={button.colourSet === ColourSet.Primary}
|
|
239
|
+
class:secondary-colour={button.colourSet === ColourSet.Secondary}
|
|
240
|
+
class:warning={button.colourSet === ColourSet.Warning}
|
|
241
|
+
class:error={button.colourSet === ColourSet.Error}
|
|
242
|
+
class:info={button.colourSet === ColourSet.Info}
|
|
243
|
+
onkeydown={passthrough}
|
|
244
|
+
disabled={buttonIsValid === false || !isValid}
|
|
245
|
+
class:margin-left={button.margin === 'left'}
|
|
246
|
+
class:margin-right={button.margin === 'right'}
|
|
247
|
+
bind:this={submitRef}
|
|
248
|
+
type={button.type ?? 'submit'}>{button.label}</button
|
|
249
|
+
>
|
|
250
|
+
{/await}
|
|
251
|
+
</div>
|
|
252
|
+
{/if}
|
|
253
|
+
{/each}
|
|
254
|
+
</div>
|
|
255
|
+
{/if}
|
|
256
|
+
</form>
|
|
257
|
+
</dialog>
|
|
258
|
+
|
|
259
259
|
<style>dialog {
|
|
260
260
|
overflow: clip;
|
|
261
261
|
background-color: #e9ecf1;
|
|
@@ -497,4 +497,4 @@ div.bar-container div.bar-timer.paused {
|
|
|
497
497
|
animation-play-state: paused;
|
|
498
498
|
opacity: 0%;
|
|
499
499
|
transition: opacity 300ms 0s ease-out;
|
|
500
|
-
}</style>
|
|
500
|
+
}</style>
|