@lavalogic/scoria 0.38.12 → 0.38.13

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.
Files changed (94) hide show
  1. package/dist/Components/AccordionGroup.svelte +46 -46
  2. package/dist/Components/AccordionGroupButton.svelte +76 -76
  3. package/dist/Components/Action.svelte +136 -136
  4. package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +712 -702
  5. package/dist/Components/Base/BaseModal.svelte +125 -125
  6. package/dist/Components/Base/ContextWrapper.svelte +72 -72
  7. package/dist/Components/Base/Pagination.svelte +198 -198
  8. package/dist/Components/Base/Snippets.svelte +36 -36
  9. package/dist/Components/BigRadioSet.svelte +38 -38
  10. package/dist/Components/Bubble.svelte +101 -101
  11. package/dist/Components/Button.svelte +209 -209
  12. package/dist/Components/Checkbox.svelte +86 -86
  13. package/dist/Components/Contexts/ContextMenu.svelte +164 -164
  14. package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
  15. package/dist/Components/Contexts/ContextMenuOption.svelte +60 -60
  16. package/dist/Components/Contexts/ToastContainer.svelte +65 -65
  17. package/dist/Components/Contexts/Tooltip.svelte +37 -37
  18. package/dist/Components/DataMatrixIcon.svelte +112 -112
  19. package/dist/Components/DateInput.svelte +148 -148
  20. package/dist/Components/DatePicker.svelte +300 -300
  21. package/dist/Components/DesktopModal.svelte +90 -90
  22. package/dist/Components/Dial.svelte +204 -204
  23. package/dist/Components/DimensionInput.svelte +170 -170
  24. package/dist/Components/DragMenu/DragMenuHolder.svelte +119 -119
  25. package/dist/Components/DragMenu/DraggableCard.svelte +77 -77
  26. package/dist/Components/FileCard.svelte +24 -24
  27. package/dist/Components/FileUpload.svelte +236 -236
  28. package/dist/Components/GridInputSet.svelte +29 -29
  29. package/dist/Components/HorizontalTabGroup.svelte +82 -82
  30. package/dist/Components/HorizontalTabGroupButton.svelte +44 -44
  31. package/dist/Components/Icon.svelte +128 -128
  32. package/dist/Components/Icons.js +357 -357
  33. package/dist/Components/LoadingAnimation.svelte +29 -29
  34. package/dist/Components/LoadingModal.svelte +45 -45
  35. package/dist/Components/LoadingOverlay.svelte +25 -25
  36. package/dist/Components/Modal.svelte +258 -258
  37. package/dist/Components/MultiSelect.svelte +220 -220
  38. package/dist/Components/Nav/NavServiceMenuList.svelte +43 -43
  39. package/dist/Components/Nav/NavTab.svelte +62 -62
  40. package/dist/Components/Nav/ServicesNav.svelte +80 -80
  41. package/dist/Components/NumberInput.svelte +157 -157
  42. package/dist/Components/PageHeading.svelte +25 -25
  43. package/dist/Components/PasswordInput.svelte +88 -88
  44. package/dist/Components/Portal.svelte +36 -36
  45. package/dist/Components/QuerySelect.svelte +366 -366
  46. package/dist/Components/SingleSelect.svelte +250 -250
  47. package/dist/Components/StepButton.svelte +70 -70
  48. package/dist/Components/StepForm.svelte +140 -140
  49. package/dist/Components/Switch.svelte +69 -69
  50. package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +51 -51
  51. package/dist/Components/Table/Body/Rows/ColumnList.svelte +59 -59
  52. package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +79 -79
  53. package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +120 -120
  54. package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +105 -105
  55. package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +87 -87
  56. package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +126 -126
  57. package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +159 -159
  58. package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +246 -246
  59. package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +216 -216
  60. package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +179 -179
  61. package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +197 -197
  62. package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +190 -190
  63. package/dist/Components/Table/Body/Rows/TableRow.svelte +290 -290
  64. package/dist/Components/Table/Headers/HighlightAllHeader.svelte +41 -41
  65. package/dist/Components/Table/Headers/SelectAllHeader.svelte +30 -30
  66. package/dist/Components/Table/Misc/SidePanel.svelte +35 -35
  67. package/dist/Components/Table/Misc/ToolboxPanel.svelte +100 -100
  68. package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +107 -107
  69. package/dist/Components/TextArea.svelte +130 -130
  70. package/dist/Components/TextInput.svelte +176 -176
  71. package/dist/Components/ThreeStateRadio.svelte +131 -131
  72. package/dist/Components/Touch/BoolCard.svelte +45 -45
  73. package/dist/Components/Touch/DateModal.svelte +209 -209
  74. package/dist/Components/Touch/EditCard.svelte +59 -59
  75. package/dist/Components/Touch/InfoCard.svelte +31 -31
  76. package/dist/Components/Touch/InfoTextCard.svelte +28 -28
  77. package/dist/Components/Touch/ModalExplanation.svelte +17 -17
  78. package/dist/Components/Touch/NumberKeyboard.svelte +225 -225
  79. package/dist/Components/Touch/NumberModal.svelte +79 -79
  80. package/dist/Components/Touch/PlusMinusCard.svelte +46 -46
  81. package/dist/Components/Touch/SummaryCard.svelte +93 -93
  82. package/dist/Components/Touch/TextAreaModal.svelte +95 -95
  83. package/dist/Components/Touch/TextModal.svelte +106 -106
  84. package/dist/Components/Touch/TouchCard.svelte +33 -33
  85. package/dist/Components/Touch/TouchModal.svelte +274 -274
  86. package/dist/Components/Touch/UtilityButton.svelte +109 -109
  87. package/dist/Components/VerticalTabGroup.svelte +79 -79
  88. package/dist/Components/VerticalTabGroupButton.svelte +58 -58
  89. package/dist/Helpers/Datamatrix.d.ts +19 -19
  90. package/dist/Helpers/Datamatrix.js +291 -291
  91. package/dist/Types/Examples/ExampleModal.svelte +35 -35
  92. package/dist/scss/_motion.scss +57 -57
  93. package/dist/scss/_sizing.scss +85 -85
  94. package/package.json +30 -30
@@ -1,260 +1,260 @@
1
- <svelte:options runes />
2
-
3
- <script
4
- module
5
- lang="ts"
6
- >
7
- import { browser } from '$app/environment';
8
- import { DATAMatrix } from '../Helpers/Datamatrix.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
- import type { ModalProps } from './ModalProps.js';
17
- </script>
18
-
19
- <script lang="ts">
20
- let {
21
- header,
22
- buttons,
23
- mandatory = false,
24
- staticHeight = false,
25
- staticWidth = false,
26
- minWidth,
27
- minHeight,
28
- width,
29
- height,
30
- onShowCallback,
31
- submitRef = $bindable(),
32
- defaultTimer,
33
- isValid = true,
34
- noscroll = false,
35
- onsubmit,
36
- headerExtra,
37
- explanation,
38
- children,
39
- footer,
40
- onclose,
41
- autofocusSelector,
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
- };
96
- });
97
-
98
- function clearTimer() {
99
- if (timeout != undefined) {
100
- paused = true;
101
- clearTimeout(timeout);
102
- }
103
- }
104
-
105
- function handleEsc(e: KeyboardEvent) {
106
- // Forwarded to the Action button's onkeydown so an Escape press
107
- // while the close icon has focus still closes the dialog rather
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;
114
- }
115
- }
116
- }
117
-
118
- function requestClose() {
119
- open = false;
120
- }
121
-
122
- const dialogClassNames = $derived(
123
- [
124
- staticHeight ? 'static-height' : null,
125
- staticWidth ? 'static-width' : null,
126
- noscroll ? 'noscroll' : null,
127
- ]
128
- .filter((c): c is string => c !== null)
129
- .join(' ')
130
- );
131
-
132
- const dialogStyle = $derived(
133
- `--timer: ${defaultTimer ? defaultTimer.time.toString() + 'ms' : 'unset'};` +
134
- (minWidth != null ? `--dialog-min-width: ${minWidth};` : '') +
135
- (minHeight != null ? `--dialog-min-height: ${minHeight};` : '') +
136
- (height != null ? `--dialog-height: ${height};` : '') +
137
- (width != null ? `--dialog-width: ${width};` : '')
138
- );
139
- </script>
140
-
141
- <BaseModal
142
- bind:value={open}
143
- {onclose}
144
- {mandatory}
145
- {autofocusSelector}
146
- dialogClass={dialogClassNames}
147
- {dialogStyle}
148
- >
149
- <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
150
- <!-- svelte-ignore a11y_click_events_have_key_events -->
151
- <form
152
- method="dialog"
153
- bind:this={form}
154
- onsubmit={(e) => {
155
- e.preventDefault();
156
- clearTimer();
157
- if (isActive) {
158
- onsubmit?.(e);
159
- }
160
- }}
161
- onclick={clearTimer}
162
- class="modal-root"
163
- >
164
- <div class="modal-header">
165
- {#if typeof header === 'string'}
166
- {#if mandatory}
167
- <h3 class="modal-heading">{header}</h3>
168
- {:else}
169
- <div class="title-wrapper">
170
- <h3 class="modal-heading">{header}</h3>
171
- <div class="close-button">
172
- <Action
173
- size={Size.DoubleXLarge}
174
- onclick={requestClose}
175
- icon={{
176
- name: 'cross',
177
- }}
178
- onkeydown={handleEsc}
179
- colourSet={ColourSet.Primary}
180
- label="Close Modal"
181
- />
182
- </div>
183
- </div>
184
- {/if}
185
- {:else if typeof header === 'function'}
186
- {@render header()}
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:noscroll
206
- >
207
- {#if explanation}
208
- {@render explanation()}
209
- {/if}
210
- {@render children()}
211
- </div>
212
-
213
- {#if footer}
214
- {@render footer()}
215
- {:else if buttons?.length}
216
- <div class="modal-footer">
217
- {#each buttons as button, index (button.label)}
218
- {#if button.callback}
219
- <div class="button-barcode-set">
220
- {#if barcodeIcons[index]}
221
- <DataMatrixIcon
222
- title={button.label}
223
- icon={{ kind: 'svg', svg: barcodeIcons[index] }}
224
- />
225
- {/if}
226
- <button
227
- onkeydown={passthrough}
228
- class:margin-left={button.margin === 'left'}
229
- class:margin-right={button.margin === 'right'}
230
- type={button.type ?? 'button'}
231
- onclick={button.callback}>{button.label}</button
232
- >
233
- </div>
234
- {:else}
235
- <div class="button-barcode-set">
236
- {#if barcodeIcons[index]}
237
- <DataMatrixIcon
238
- title={button.label}
239
- icon={{ kind: 'svg', svg: barcodeIcons[index] }}
240
- />
241
- {/if}
242
- <button
243
- onkeydown={passthrough}
244
- disabled={!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
- </div>
251
- {/if}
252
- {/each}
253
- </div>
254
- {/if}
255
- </form>
256
- </BaseModal>
257
-
1
+ <svelte:options runes />
2
+
3
+ <script
4
+ module
5
+ lang="ts"
6
+ >
7
+ import { browser } from '$app/environment';
8
+ import { DATAMatrix } from '../Helpers/Datamatrix.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
+ import type { ModalProps } from './ModalProps.js';
17
+ </script>
18
+
19
+ <script lang="ts">
20
+ let {
21
+ header,
22
+ buttons,
23
+ mandatory = false,
24
+ staticHeight = false,
25
+ staticWidth = false,
26
+ minWidth,
27
+ minHeight,
28
+ width,
29
+ height,
30
+ onShowCallback,
31
+ submitRef = $bindable(),
32
+ defaultTimer,
33
+ isValid = true,
34
+ noscroll = false,
35
+ onsubmit,
36
+ headerExtra,
37
+ explanation,
38
+ children,
39
+ footer,
40
+ onclose,
41
+ autofocusSelector,
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
+ };
96
+ });
97
+
98
+ function clearTimer() {
99
+ if (timeout != undefined) {
100
+ paused = true;
101
+ clearTimeout(timeout);
102
+ }
103
+ }
104
+
105
+ function handleEsc(e: KeyboardEvent) {
106
+ // Forwarded to the Action button's onkeydown so an Escape press
107
+ // while the close icon has focus still closes the dialog rather
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;
114
+ }
115
+ }
116
+ }
117
+
118
+ function requestClose() {
119
+ open = false;
120
+ }
121
+
122
+ const dialogClassNames = $derived(
123
+ [
124
+ staticHeight ? 'static-height' : null,
125
+ staticWidth ? 'static-width' : null,
126
+ noscroll ? 'noscroll' : null,
127
+ ]
128
+ .filter((c): c is string => c !== null)
129
+ .join(' ')
130
+ );
131
+
132
+ const dialogStyle = $derived(
133
+ `--timer: ${defaultTimer ? defaultTimer.time.toString() + 'ms' : 'unset'};` +
134
+ (minWidth != null ? `--dialog-min-width: ${minWidth};` : '') +
135
+ (minHeight != null ? `--dialog-min-height: ${minHeight};` : '') +
136
+ (height != null ? `--dialog-height: ${height};` : '') +
137
+ (width != null ? `--dialog-width: ${width};` : '')
138
+ );
139
+ </script>
140
+
141
+ <BaseModal
142
+ bind:value={open}
143
+ {onclose}
144
+ {mandatory}
145
+ {autofocusSelector}
146
+ dialogClass={dialogClassNames}
147
+ {dialogStyle}
148
+ >
149
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
150
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
151
+ <form
152
+ method="dialog"
153
+ bind:this={form}
154
+ onsubmit={(e) => {
155
+ e.preventDefault();
156
+ clearTimer();
157
+ if (isActive) {
158
+ onsubmit?.(e);
159
+ }
160
+ }}
161
+ onclick={clearTimer}
162
+ class="modal-root"
163
+ >
164
+ <div class="modal-header">
165
+ {#if typeof header === 'string'}
166
+ {#if mandatory}
167
+ <h3 class="modal-heading">{header}</h3>
168
+ {:else}
169
+ <div class="title-wrapper">
170
+ <h3 class="modal-heading">{header}</h3>
171
+ <div class="close-button">
172
+ <Action
173
+ size={Size.DoubleXLarge}
174
+ onclick={requestClose}
175
+ icon={{
176
+ name: 'cross',
177
+ }}
178
+ onkeydown={handleEsc}
179
+ colourSet={ColourSet.Primary}
180
+ label="Close Modal"
181
+ />
182
+ </div>
183
+ </div>
184
+ {/if}
185
+ {:else if typeof header === 'function'}
186
+ {@render header()}
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:noscroll
206
+ >
207
+ {#if explanation}
208
+ {@render explanation()}
209
+ {/if}
210
+ {@render children()}
211
+ </div>
212
+
213
+ {#if footer}
214
+ {@render footer()}
215
+ {:else if buttons?.length}
216
+ <div class="modal-footer">
217
+ {#each buttons as button, index (button.label)}
218
+ {#if button.callback}
219
+ <div class="button-barcode-set">
220
+ {#if barcodeIcons[index]}
221
+ <DataMatrixIcon
222
+ title={button.label}
223
+ icon={{ kind: 'svg', svg: barcodeIcons[index] }}
224
+ />
225
+ {/if}
226
+ <button
227
+ onkeydown={passthrough}
228
+ class:margin-left={button.margin === 'left'}
229
+ class:margin-right={button.margin === 'right'}
230
+ type={button.type ?? 'button'}
231
+ onclick={button.callback}>{button.label}</button
232
+ >
233
+ </div>
234
+ {:else}
235
+ <div class="button-barcode-set">
236
+ {#if barcodeIcons[index]}
237
+ <DataMatrixIcon
238
+ title={button.label}
239
+ icon={{ kind: 'svg', svg: barcodeIcons[index] }}
240
+ />
241
+ {/if}
242
+ <button
243
+ onkeydown={passthrough}
244
+ disabled={!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
+ </div>
251
+ {/if}
252
+ {/each}
253
+ </div>
254
+ {/if}
255
+ </form>
256
+ </BaseModal>
257
+
258
258
  <style>dialog {
259
259
  overflow: clip;
260
260
  background-color: #e9ecf1;
@@ -604,4 +604,4 @@ div.bar-container div.bar-timer.paused {
604
604
  }
605
605
  :global form > *:last-child {
606
606
  border-radius: 0px 0px 4px 4px;
607
- }</style>
607
+ }</style>