@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,227 +1,190 @@
|
|
|
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
|
-
let _value: string = $derived(
|
|
31
|
-
value != null && value % 1 == 0 ? value.toString() : getDecimalValue()
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
function getDecimalPlaces(value: number): number {
|
|
35
|
-
const str = value.toString();
|
|
36
|
-
if (!str.includes('.')) {
|
|
37
|
-
return decimal ? 2 : 0;
|
|
38
|
-
}
|
|
39
|
-
return str.split('.')[1].length;
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
module
|
|
5
|
+
lang="ts"
|
|
6
|
+
>import { devCatch, passthrough } from "../../Helpers/Helpers.svelte.js";
|
|
7
|
+
import { InputVariant } from "../../Types/Internal/InputVariant.js";
|
|
8
|
+
import { tick, untrack } from "svelte";
|
|
9
|
+
import Icon from "../Icon.svelte";
|
|
10
|
+
import TextInput from "../TextInput.svelte";
|
|
11
|
+
const DIGITS = Object.freeze([
|
|
12
|
+
1,
|
|
13
|
+
2,
|
|
14
|
+
3,
|
|
15
|
+
4,
|
|
16
|
+
5,
|
|
17
|
+
6,
|
|
18
|
+
7,
|
|
19
|
+
8,
|
|
20
|
+
9
|
|
21
|
+
]);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script lang="ts">let { value = $bindable(null), label, labelRight, placeholder, min, max, decimal = false, inputRef = $bindable(), coerceValue = false } = $props();
|
|
25
|
+
let _value = $derived(value != null && value % 1 == 0 ? value.toString() : getDecimalValue());
|
|
26
|
+
function getDecimalPlaces(value) {
|
|
27
|
+
const str = value.toString();
|
|
28
|
+
if (!str.includes(".")) {
|
|
29
|
+
return decimal ? 2 : 0;
|
|
40
30
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
31
|
+
return str.split(".")[1].length;
|
|
32
|
+
}
|
|
33
|
+
const decimalPlaces = $derived(min != null ? getDecimalPlaces(min) : max != null ? getDecimalPlaces(max) : decimal ? 2 : 0);
|
|
34
|
+
function getDecimalValue() {
|
|
35
|
+
// Use toFixed to bound decimal places, then parseFloat to drop trailing
|
|
36
|
+
// zeros without re-introducing scientific notation. There is no built-in
|
|
37
|
+
// "as many decimals as requested but no more" formatter.
|
|
38
|
+
return value ? parseFloat(value.toFixed(decimalPlaces)).toString() : "";
|
|
39
|
+
}
|
|
40
|
+
const newValue = $derived.by(() => {
|
|
41
|
+
const v = decimal ? parseFloat(_value) : parseInt(_value);
|
|
42
|
+
if (isNaN(v)) {
|
|
43
|
+
return null;
|
|
51
44
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
$effect(() => {
|
|
62
|
-
if (coerceValue) {
|
|
63
|
-
const v =
|
|
64
|
-
min != undefined && newValue != null && min > newValue
|
|
65
|
-
? min
|
|
66
|
-
: max != undefined && newValue != null && max < newValue
|
|
67
|
-
? max
|
|
68
|
-
: newValue;
|
|
69
|
-
|
|
70
|
-
value = v;
|
|
71
|
-
} else {
|
|
72
|
-
value = newValue;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
function refocus() {
|
|
77
|
-
tick()
|
|
78
|
-
.then(() => {
|
|
79
|
-
if (inputRef && document.activeElement !== inputRef) {
|
|
80
|
-
inputRef.focus();
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
.catch(devCatch);
|
|
45
|
+
return v;
|
|
46
|
+
});
|
|
47
|
+
$effect(() => {
|
|
48
|
+
if (coerceValue) {
|
|
49
|
+
const v = min != undefined && newValue != null && min > newValue ? min : max != undefined && newValue != null && max < newValue ? max : newValue;
|
|
50
|
+
value = v;
|
|
51
|
+
} else {
|
|
52
|
+
value = newValue;
|
|
84
53
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
54
|
+
});
|
|
55
|
+
function refocus() {
|
|
56
|
+
tick().then(() => {
|
|
57
|
+
if (inputRef && document.activeElement !== inputRef) {
|
|
58
|
+
inputRef.focus();
|
|
59
|
+
}
|
|
60
|
+
}).catch(devCatch);
|
|
61
|
+
}
|
|
62
|
+
function getPrevValue() {
|
|
63
|
+
if (inputRef) {
|
|
64
|
+
if (inputRef.selectionStart === 0 && inputRef.selectionEnd === _value.length || inputRef.selectionEnd === 0 && inputRef.selectionStart === _value.length) {
|
|
65
|
+
return "";
|
|
94
66
|
}
|
|
95
|
-
return _value;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function addDecimal() {
|
|
99
|
-
_value = getPrevValue() + '.';
|
|
100
|
-
untrack(refocus);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/* due to the fact that number inputs won't allow a leading dot, we have to use a text input
|
|
104
|
-
this doesn't add a number, but concatenated the digit to the end of the string
|
|
105
|
-
*/
|
|
106
|
-
function addDigit(digit: string) {
|
|
107
|
-
const prevValue = getPrevValue();
|
|
108
|
-
_value = prevValue + digit;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function backspace() {
|
|
112
|
-
const preVvalue = getPrevValue();
|
|
113
|
-
const v = preVvalue && _value.slice(0, _value.length - 1);
|
|
114
|
-
_value = v;
|
|
115
|
-
untrack(refocus);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function minus() {
|
|
119
|
-
const v = ((decimal ? parseFloat(_value) : parseInt(_value)) || 0) - 1;
|
|
120
|
-
|
|
121
|
-
_value = (min != null ? Math.max(min, v) : v).toString();
|
|
122
|
-
untrack(refocus);
|
|
123
67
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
68
|
+
return _value;
|
|
69
|
+
}
|
|
70
|
+
function addDecimal() {
|
|
71
|
+
_value = getPrevValue() + ".";
|
|
72
|
+
untrack(refocus);
|
|
73
|
+
}
|
|
74
|
+
/* due to the fact that number inputs won't allow a leading dot, we have to use a text input
|
|
75
|
+
this doesn't add a number, but concatenated the digit to the end of the string
|
|
76
|
+
*/
|
|
77
|
+
function addDigit(digit) {
|
|
78
|
+
const prevValue = getPrevValue();
|
|
79
|
+
_value = prevValue + digit;
|
|
80
|
+
}
|
|
81
|
+
function backspace() {
|
|
82
|
+
const preVvalue = getPrevValue();
|
|
83
|
+
const v = preVvalue && _value.slice(0, _value.length - 1);
|
|
84
|
+
_value = v;
|
|
85
|
+
untrack(refocus);
|
|
86
|
+
}
|
|
87
|
+
function minus() {
|
|
88
|
+
const v = ((decimal ? parseFloat(_value) : parseInt(_value)) || 0) - 1;
|
|
89
|
+
_value = (min != null ? Math.max(min, v) : v).toString();
|
|
90
|
+
untrack(refocus);
|
|
91
|
+
}
|
|
92
|
+
function plus() {
|
|
93
|
+
const v = ((decimal ? parseFloat(_value) : parseInt(_value)) || 0) + 1;
|
|
94
|
+
_value = (max != null ? Math.min(max, v) : v).toString();
|
|
95
|
+
untrack(refocus);
|
|
96
|
+
}
|
|
97
|
+
const lessThanMin = $derived(min != null && (value == null || value < min));
|
|
98
|
+
const moreThanMax = $derived(max != null && (value == null || value > max));
|
|
99
|
+
// Precompute disabled state per digit so the 10 buttons do not each evaluate
|
|
100
|
+
// the same arithmetic on every render.
|
|
101
|
+
const digitDisabled = $derived.by(() => {
|
|
102
|
+
const out = new Array(10);
|
|
103
|
+
const base = (value ?? 0) * 10;
|
|
104
|
+
for (let i = 0; i < 10; i++) {
|
|
105
|
+
out[i] = max != null && base + i > max;
|
|
130
106
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const digitDisabled = $derived.by(() => {
|
|
138
|
-
const out = new Array<boolean>(10);
|
|
139
|
-
const base = (value ?? 0) * 10;
|
|
140
|
-
for (let i = 0; i < 10; i++) {
|
|
141
|
-
out[i] = max != null && base + i > max;
|
|
142
|
-
}
|
|
143
|
-
return out;
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
function onDigitClick(e: MouseEvent) {
|
|
147
|
-
const digit = (e.currentTarget as HTMLButtonElement).dataset.digit;
|
|
148
|
-
if (digit != null) {
|
|
149
|
-
addDigit(digit);
|
|
150
|
-
}
|
|
107
|
+
return out;
|
|
108
|
+
});
|
|
109
|
+
function onDigitClick(e) {
|
|
110
|
+
const digit = e.currentTarget.dataset.digit;
|
|
111
|
+
if (digit != null) {
|
|
112
|
+
addDigit(digit);
|
|
151
113
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
{
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
bind:
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
</div>
|
|
224
|
-
|
|
114
|
+
}
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<div class="number-input-wrapper">
|
|
118
|
+
<div class="left-side">
|
|
119
|
+
<div class="value-container">
|
|
120
|
+
<!-- textInput is the only available option when you try to add a decimal point programmatically -->
|
|
121
|
+
<TextInput
|
|
122
|
+
labelTop={label}
|
|
123
|
+
{placeholder}
|
|
124
|
+
{labelRight}
|
|
125
|
+
bind:inputRef
|
|
126
|
+
bind:value={_value}
|
|
127
|
+
variant={InputVariant.Modal}
|
|
128
|
+
required
|
|
129
|
+
invalid={lessThanMin || moreThanMax}
|
|
130
|
+
/>
|
|
131
|
+
{#if max != undefined}
|
|
132
|
+
<TextInput
|
|
133
|
+
value={`${max}`}
|
|
134
|
+
labelTop="Maximum"
|
|
135
|
+
selectNone
|
|
136
|
+
disabled
|
|
137
|
+
variant={InputVariant.Modal}
|
|
138
|
+
/>
|
|
139
|
+
{/if}
|
|
140
|
+
</div>
|
|
141
|
+
<div class="plus-minus">
|
|
142
|
+
<button
|
|
143
|
+
onkeydown={passthrough}
|
|
144
|
+
type="button"
|
|
145
|
+
disabled={value != null && min != null && value <= min}
|
|
146
|
+
onclick={minus}><Icon name="minus" /></button
|
|
147
|
+
>
|
|
148
|
+
<button
|
|
149
|
+
onkeydown={passthrough}
|
|
150
|
+
type="button"
|
|
151
|
+
disabled={value != null && max != null && value >= max}
|
|
152
|
+
onclick={plus}><Icon name="plus" /></button
|
|
153
|
+
>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="number-grid">
|
|
157
|
+
{#each DIGITS as digit (digit)}
|
|
158
|
+
<button
|
|
159
|
+
onkeydown={passthrough}
|
|
160
|
+
type="button"
|
|
161
|
+
data-digit={digit}
|
|
162
|
+
disabled={digitDisabled[digit]}
|
|
163
|
+
onclick={onDigitClick}>{digit}</button
|
|
164
|
+
>
|
|
165
|
+
{/each}
|
|
166
|
+
<button
|
|
167
|
+
onkeydown={passthrough}
|
|
168
|
+
type="button"
|
|
169
|
+
disabled={!decimal || (value != null && value % 1 !== 0) || _value.endsWith('.')}
|
|
170
|
+
onclick={addDecimal}>.</button
|
|
171
|
+
>
|
|
172
|
+
<button
|
|
173
|
+
onkeydown={passthrough}
|
|
174
|
+
type="button"
|
|
175
|
+
data-digit="0"
|
|
176
|
+
disabled={digitDisabled[0]}
|
|
177
|
+
onclick={onDigitClick}>0</button
|
|
178
|
+
>
|
|
179
|
+
<button
|
|
180
|
+
onkeydown={passthrough}
|
|
181
|
+
type="button"
|
|
182
|
+
disabled={_value.length === 0}
|
|
183
|
+
onclick={backspace}>⌫</button
|
|
184
|
+
>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
225
188
|
<style>button {
|
|
226
189
|
color: #3a4952;
|
|
227
190
|
fill: #3a4952;
|
|
@@ -309,4 +272,4 @@ button {
|
|
|
309
272
|
}
|
|
310
273
|
.number-input-wrapper .number-grid {
|
|
311
274
|
flex-grow: 2;
|
|
312
|
-
}</style>
|
|
275
|
+
}</style>
|
|
@@ -1,81 +1,61 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
cancelEditing
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
{#snippet footer()}
|
|
62
|
-
<div class="modal-footer">
|
|
63
|
-
<button
|
|
64
|
-
onkeydown={passthrough}
|
|
65
|
-
type="submit"
|
|
66
|
-
disabled={!isAcceptableValue.value}>Confirm</button
|
|
67
|
-
>
|
|
68
|
-
<button
|
|
69
|
-
onkeydown={passthrough}
|
|
70
|
-
type="button"
|
|
71
|
-
onclick={() => {
|
|
72
|
-
cancelEditing();
|
|
73
|
-
}}>Cancel</button
|
|
74
|
-
>
|
|
75
|
-
</div>
|
|
76
|
-
{/snippet}
|
|
77
|
-
</TouchModal>
|
|
78
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { useAsyncFlag } from "../../Helpers/AsyncFlag.svelte.js";
|
|
4
|
+
import { passthrough } from "../../Helpers/Helpers.svelte.js";
|
|
5
|
+
import NumberKeyboard from "./NumberKeyboard.svelte";
|
|
6
|
+
import TouchModal from "./TouchModal.svelte";
|
|
7
|
+
let { coerceValue = false, header, value, label, placeholder, min, max, cancelEditing, confirm, decimal, isValid, explanation } = $props();
|
|
8
|
+
// Mirror external `value` snapshots into a writable derived. Reads from
|
|
9
|
+
// `value` are tracked; writes happen through the assignment binding
|
|
10
|
+
// fed back to `NumberKeyboard`.
|
|
11
|
+
let tempValue = $derived(value);
|
|
12
|
+
const isAcceptableValue = useAsyncFlag(() => tempValue == null ? false : isValid?.(tempValue) ?? true, false);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<TouchModal
|
|
16
|
+
onclose={() => {
|
|
17
|
+
cancelEditing();
|
|
18
|
+
}}
|
|
19
|
+
{header}
|
|
20
|
+
mandatory
|
|
21
|
+
onsubmit={(e: SubmitEvent) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
if (tempValue == null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
confirm(tempValue);
|
|
27
|
+
}}
|
|
28
|
+
{explanation}
|
|
29
|
+
>
|
|
30
|
+
<div class="number-input-wrapper">
|
|
31
|
+
<NumberKeyboard
|
|
32
|
+
{coerceValue}
|
|
33
|
+
{min}
|
|
34
|
+
{max}
|
|
35
|
+
{label}
|
|
36
|
+
{placeholder}
|
|
37
|
+
bind:value={tempValue}
|
|
38
|
+
{decimal}
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
{#snippet footer()}
|
|
42
|
+
<div class="modal-footer">
|
|
43
|
+
<button
|
|
44
|
+
onkeydown={passthrough}
|
|
45
|
+
type="submit"
|
|
46
|
+
disabled={!isAcceptableValue.value}>Confirm</button
|
|
47
|
+
>
|
|
48
|
+
<button
|
|
49
|
+
onkeydown={passthrough}
|
|
50
|
+
type="button"
|
|
51
|
+
onclick={() => {
|
|
52
|
+
cancelEditing();
|
|
53
|
+
}}>Cancel</button
|
|
54
|
+
>
|
|
55
|
+
</div>
|
|
56
|
+
{/snippet}
|
|
57
|
+
</TouchModal>
|
|
58
|
+
|
|
79
59
|
<style>dialog {
|
|
80
60
|
overflow: clip;
|
|
81
61
|
background-color: #e9ecf1;
|
|
@@ -342,4 +322,4 @@ button {
|
|
|
342
322
|
}
|
|
343
323
|
.modal-footer button[type=submit]:not([disabled]):focus {
|
|
344
324
|
outline-offset: -2px;
|
|
345
|
-
}</style>
|
|
325
|
+
}</style>
|
|
@@ -1,48 +1,45 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class="
|
|
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
|
-
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { Size } from "../../Types/Internal/Size.js";
|
|
4
|
+
import Action from "../Action.svelte";
|
|
5
|
+
let { callback, disabled = false, children } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div
|
|
9
|
+
class="card pad-right"
|
|
10
|
+
class:disabled
|
|
11
|
+
>
|
|
12
|
+
<div class="icon-left">
|
|
13
|
+
<Action
|
|
14
|
+
{disabled}
|
|
15
|
+
label="Decrement"
|
|
16
|
+
onclick={() => {
|
|
17
|
+
callback(-1);
|
|
18
|
+
}}
|
|
19
|
+
icon={{
|
|
20
|
+
name: 'circle-minus',
|
|
21
|
+
size: Size.DoubleXLarge,
|
|
22
|
+
}}
|
|
23
|
+
size={Size.DoubleXLarge}
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
<span class="value">{@render children()}</span>
|
|
27
|
+
<div class="icon-right">
|
|
28
|
+
<Action
|
|
29
|
+
{disabled}
|
|
30
|
+
label="Increment"
|
|
31
|
+
onclick={() => {
|
|
32
|
+
callback(1);
|
|
33
|
+
}}
|
|
34
|
+
icon={{
|
|
35
|
+
name: 'circle-plus',
|
|
36
|
+
size: Size.DoubleXLarge,
|
|
37
|
+
}}
|
|
38
|
+
size={Size.DoubleXLarge}
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
46
43
|
<style>.card {
|
|
47
44
|
color: #3a4952;
|
|
48
45
|
fill: #3a4952;
|
|
@@ -91,4 +88,4 @@
|
|
|
91
88
|
.card.disabled {
|
|
92
89
|
background-color: #f4f7f9;
|
|
93
90
|
color: #8096a5;
|
|
94
|
-
}</style>
|
|
91
|
+
}</style>
|