@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,192 +1,192 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<!-- @component
|
|
4
|
-
Allows for automated pagination of local content in cases where a collection may become a performance concern
|
|
5
|
-
|
|
6
|
-
### Usage
|
|
7
|
-
```svelte
|
|
8
|
-
<Pagination snippet={itemSnippet} pageSize={20} items={dataWrapper.value} key="id" />
|
|
9
|
-
```
|
|
10
|
-
-->
|
|
11
|
-
<script
|
|
12
|
-
lang="ts"
|
|
13
|
-
generics="T extends object"
|
|
14
|
-
>
|
|
15
|
-
import { autoPluralise, generateShortUUID } from '../../Helpers/Helpers.svelte.js';
|
|
16
|
-
import { Colour } from '../../scss/colours.js';
|
|
17
|
-
import { Side } from '../../Types/Internal/Side.js';
|
|
18
|
-
import { Size } from '../../Types/Internal/Size.js';
|
|
19
|
-
import { Variant } from '../../Types/Internal/Variant.js';
|
|
20
|
-
import Button from '../Button.svelte';
|
|
21
|
-
import Icon from '../Icon.svelte';
|
|
22
|
-
import NumberInput from '../NumberInput.svelte';
|
|
23
|
-
import type { PaginationProps } from './PaginationProps.js';
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
items,
|
|
27
|
-
key,
|
|
28
|
-
pageSize = 20,
|
|
29
|
-
snippet,
|
|
30
|
-
itemName = 'Item',
|
|
31
|
-
border = false,
|
|
32
|
-
padding = '1.5rem', //sizing.$regular-padding
|
|
33
|
-
gap = '1.5rem', // sizing.$regular-gap
|
|
34
|
-
height,
|
|
35
|
-
}: PaginationProps<T> = $props();
|
|
36
|
-
|
|
37
|
-
const _uuid = generateShortUUID();
|
|
38
|
-
let pageIndex = $state(0);
|
|
39
|
-
let pageValue = $derived(pageIndex + 1);
|
|
40
|
-
const startIndex = $derived(pageIndex * pageSize);
|
|
41
|
-
const pageItems = $derived(items.slice(startIndex, startIndex + pageSize));
|
|
42
|
-
|
|
43
|
-
const lastPage = $derived(Math.ceil(items.length / pageSize));
|
|
44
|
-
const lastPageIndex = $derived(lastPage - 1);
|
|
45
|
-
|
|
46
|
-
let debounceTimeout = -1;
|
|
47
|
-
function onNumberInput(e: Event) {
|
|
48
|
-
const page = parseInt((e.target as HTMLInputElement).value);
|
|
49
|
-
|
|
50
|
-
clearTimeout(debounceTimeout);
|
|
51
|
-
if (!isNaN(page)) {
|
|
52
|
-
debounceTimeout = setTimeout(() => {
|
|
53
|
-
pageIndex = Math.max(page - 1, 0);
|
|
54
|
-
}, 400) as unknown as number;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let pageButtons: Array<number> = $state([]);
|
|
59
|
-
|
|
60
|
-
$effect(() => {
|
|
61
|
-
const startingPage = Math.min(lastPage - 2, pageIndex - 1);
|
|
62
|
-
const pageToStartWith = Math.max(1, Math.min(startingPage, lastPage - 4));
|
|
63
|
-
|
|
64
|
-
pageButtons = new Array<number>(Math.min(lastPage, 5))
|
|
65
|
-
.fill(pageToStartWith)
|
|
66
|
-
.map((item, index) => item + index);
|
|
67
|
-
});
|
|
68
|
-
</script>
|
|
69
|
-
|
|
70
|
-
<!-- PROPER -->
|
|
71
|
-
<!--
|
|
72
|
-
|
|
73
|
-
<div class="pagination">
|
|
74
|
-
<div>page {pageIndex}</div>
|
|
75
|
-
<button
|
|
76
|
-
onclick={() => {
|
|
77
|
-
pageIndex = Math.max(pageIndex - 1, 0);
|
|
78
|
-
}}>Previous</button
|
|
79
|
-
>
|
|
80
|
-
<button
|
|
81
|
-
onclick={() => {
|
|
82
|
-
pageIndex = Math.min(pageIndex + 1, lastPageIndex);
|
|
83
|
-
}}>Next</button
|
|
84
|
-
>
|
|
85
|
-
</div>
|
|
86
|
-
</div> -->
|
|
87
|
-
|
|
88
|
-
<!-- style={`${padding ? `padding: ${padding};` : ''}` +
|
|
89
|
-
`${gap ? `gap: ${gap};` : ''}` +
|
|
90
|
-
`${height ? `height: ${height};` : ''}`} -->
|
|
91
|
-
<div
|
|
92
|
-
class="wrapper"
|
|
93
|
-
class:border
|
|
94
|
-
style={(padding ? `padding: ${padding};` : '') +
|
|
95
|
-
(gap ? `gap: ${gap};` : '') +
|
|
96
|
-
(height ? `height: ${height};` : '')}
|
|
97
|
-
>
|
|
98
|
-
{#each pageItems as item, index (item[key])}
|
|
99
|
-
{@render snippet(item, index)}
|
|
100
|
-
{/each}
|
|
101
|
-
<div class="spread_row bottom_row">
|
|
102
|
-
<div class="block">
|
|
103
|
-
<span>{items.length} {autoPluralise(itemName, items.length)}</span>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<div class="block records-per-page">
|
|
107
|
-
<span>Records per Page: {pageSize}</span>
|
|
108
|
-
</div>
|
|
109
|
-
|
|
110
|
-
<div class="spacer"></div>
|
|
111
|
-
<!-- {/* TODO switch to a lib element for this */} -->
|
|
112
|
-
|
|
113
|
-
<div class="scrollable">
|
|
114
|
-
<div class="block">
|
|
115
|
-
<Icon
|
|
116
|
-
name="paper"
|
|
117
|
-
colour={Colour['$ui-blue-6']}
|
|
118
|
-
/>
|
|
119
|
-
<span>{lastPage} {autoPluralise('Page', lastPage)}</span>
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
<div class="block">
|
|
123
|
-
<label for="{_uuid}-jump-to-page"
|
|
124
|
-
><Icon
|
|
125
|
-
name="arrow-move-horizontal"
|
|
126
|
-
colour={Colour['$ui-blue-6']}
|
|
127
|
-
/></label
|
|
128
|
-
>
|
|
129
|
-
|
|
130
|
-
<label for="{_uuid}-jump-to-page">Jump to page:</label>
|
|
131
|
-
|
|
132
|
-
<NumberInput
|
|
133
|
-
id="{_uuid}-jump-to-page"
|
|
134
|
-
value={pageValue}
|
|
135
|
-
oninput={onNumberInput}
|
|
136
|
-
/>
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
<div class="block nopad page-arrow">
|
|
140
|
-
<Button
|
|
141
|
-
variant={Variant.Toolbar}
|
|
142
|
-
disabled={pageIndex === 0}
|
|
143
|
-
side={Side.Bottom}
|
|
144
|
-
onclick={() => {
|
|
145
|
-
pageIndex = Math.max(pageIndex - 1, 0);
|
|
146
|
-
}}
|
|
147
|
-
size={Size.FillHeight}
|
|
148
|
-
iconLeft={{
|
|
149
|
-
name: 'left-close',
|
|
150
|
-
size: Size.FillHeight,
|
|
151
|
-
}}>Previous Page</Button
|
|
152
|
-
>
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
{#key pageButtons}
|
|
156
|
-
{#each pageButtons as pageNumber (pageNumber)}
|
|
157
|
-
<div class="block nopad">
|
|
158
|
-
<Button
|
|
159
|
-
variant={Variant.Toolbar}
|
|
160
|
-
side={Side.Bottom}
|
|
161
|
-
size={Size.FillHeight}
|
|
162
|
-
toggled={pageIndex + 1 === pageNumber}
|
|
163
|
-
onclick={() => {
|
|
164
|
-
pageIndex = pageNumber - 1;
|
|
165
|
-
}}>{pageNumber}</Button
|
|
166
|
-
>
|
|
167
|
-
</div>
|
|
168
|
-
{/each}
|
|
169
|
-
{/key}
|
|
170
|
-
|
|
171
|
-
<div class="block nopad page-arrow">
|
|
172
|
-
<Button
|
|
173
|
-
variant={Variant.Toolbar}
|
|
174
|
-
side={Side.Bottom}
|
|
175
|
-
size={Size.FillHeight}
|
|
176
|
-
onclick={() => {
|
|
177
|
-
pageIndex = Math.min(pageIndex + 1, lastPageIndex);
|
|
178
|
-
}}
|
|
179
|
-
disabled={pageIndex == lastPageIndex}
|
|
180
|
-
iconRight={{
|
|
181
|
-
name: 'right-close',
|
|
182
|
-
size: Size.FillHeight,
|
|
183
|
-
}}>Next Page</Button
|
|
184
|
-
>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<!-- @component
|
|
4
|
+
Allows for automated pagination of local content in cases where a collection may become a performance concern
|
|
5
|
+
|
|
6
|
+
### Usage
|
|
7
|
+
```svelte
|
|
8
|
+
<Pagination snippet={itemSnippet} pageSize={20} items={dataWrapper.value} key="id" />
|
|
9
|
+
```
|
|
10
|
+
-->
|
|
11
|
+
<script
|
|
12
|
+
lang="ts"
|
|
13
|
+
generics="T extends object"
|
|
14
|
+
>
|
|
15
|
+
import { autoPluralise, generateShortUUID } from '../../Helpers/Helpers.svelte.js';
|
|
16
|
+
import { Colour } from '../../scss/colours.js';
|
|
17
|
+
import { Side } from '../../Types/Internal/Side.js';
|
|
18
|
+
import { Size } from '../../Types/Internal/Size.js';
|
|
19
|
+
import { Variant } from '../../Types/Internal/Variant.js';
|
|
20
|
+
import Button from '../Button.svelte';
|
|
21
|
+
import Icon from '../Icon.svelte';
|
|
22
|
+
import NumberInput from '../NumberInput.svelte';
|
|
23
|
+
import type { PaginationProps } from './PaginationProps.js';
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
items,
|
|
27
|
+
key,
|
|
28
|
+
pageSize = 20,
|
|
29
|
+
snippet,
|
|
30
|
+
itemName = 'Item',
|
|
31
|
+
border = false,
|
|
32
|
+
padding = '1.5rem', //sizing.$regular-padding
|
|
33
|
+
gap = '1.5rem', // sizing.$regular-gap
|
|
34
|
+
height,
|
|
35
|
+
}: PaginationProps<T> = $props();
|
|
36
|
+
|
|
37
|
+
const _uuid = generateShortUUID();
|
|
38
|
+
let pageIndex = $state(0);
|
|
39
|
+
let pageValue = $derived(pageIndex + 1);
|
|
40
|
+
const startIndex = $derived(pageIndex * pageSize);
|
|
41
|
+
const pageItems = $derived(items.slice(startIndex, startIndex + pageSize));
|
|
42
|
+
|
|
43
|
+
const lastPage = $derived(Math.ceil(items.length / pageSize));
|
|
44
|
+
const lastPageIndex = $derived(lastPage - 1);
|
|
45
|
+
|
|
46
|
+
let debounceTimeout = -1;
|
|
47
|
+
function onNumberInput(e: Event) {
|
|
48
|
+
const page = parseInt((e.target as HTMLInputElement).value);
|
|
49
|
+
|
|
50
|
+
clearTimeout(debounceTimeout);
|
|
51
|
+
if (!isNaN(page)) {
|
|
52
|
+
debounceTimeout = setTimeout(() => {
|
|
53
|
+
pageIndex = Math.max(page - 1, 0);
|
|
54
|
+
}, 400) as unknown as number;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let pageButtons: Array<number> = $state([]);
|
|
59
|
+
|
|
60
|
+
$effect(() => {
|
|
61
|
+
const startingPage = Math.min(lastPage - 2, pageIndex - 1);
|
|
62
|
+
const pageToStartWith = Math.max(1, Math.min(startingPage, lastPage - 4));
|
|
63
|
+
|
|
64
|
+
pageButtons = new Array<number>(Math.min(lastPage, 5))
|
|
65
|
+
.fill(pageToStartWith)
|
|
66
|
+
.map((item, index) => item + index);
|
|
67
|
+
});
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<!-- PROPER -->
|
|
71
|
+
<!--
|
|
72
|
+
|
|
73
|
+
<div class="pagination">
|
|
74
|
+
<div>page {pageIndex}</div>
|
|
75
|
+
<button
|
|
76
|
+
onclick={() => {
|
|
77
|
+
pageIndex = Math.max(pageIndex - 1, 0);
|
|
78
|
+
}}>Previous</button
|
|
79
|
+
>
|
|
80
|
+
<button
|
|
81
|
+
onclick={() => {
|
|
82
|
+
pageIndex = Math.min(pageIndex + 1, lastPageIndex);
|
|
83
|
+
}}>Next</button
|
|
84
|
+
>
|
|
85
|
+
</div>
|
|
86
|
+
</div> -->
|
|
87
|
+
|
|
88
|
+
<!-- style={`${padding ? `padding: ${padding};` : ''}` +
|
|
89
|
+
`${gap ? `gap: ${gap};` : ''}` +
|
|
90
|
+
`${height ? `height: ${height};` : ''}`} -->
|
|
91
|
+
<div
|
|
92
|
+
class="wrapper"
|
|
93
|
+
class:border
|
|
94
|
+
style={(padding ? `padding: ${padding};` : '') +
|
|
95
|
+
(gap ? `gap: ${gap};` : '') +
|
|
96
|
+
(height ? `height: ${height};` : '')}
|
|
97
|
+
>
|
|
98
|
+
{#each pageItems as item, index (item[key])}
|
|
99
|
+
{@render snippet(item, index)}
|
|
100
|
+
{/each}
|
|
101
|
+
<div class="spread_row bottom_row">
|
|
102
|
+
<div class="block">
|
|
103
|
+
<span>{items.length} {autoPluralise(itemName, items.length)}</span>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div class="block records-per-page">
|
|
107
|
+
<span>Records per Page: {pageSize}</span>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<div class="spacer"></div>
|
|
111
|
+
<!-- {/* TODO switch to a lib element for this */} -->
|
|
112
|
+
|
|
113
|
+
<div class="scrollable">
|
|
114
|
+
<div class="block">
|
|
115
|
+
<Icon
|
|
116
|
+
name="paper"
|
|
117
|
+
colour={Colour['$ui-blue-6']}
|
|
118
|
+
/>
|
|
119
|
+
<span>{lastPage} {autoPluralise('Page', lastPage)}</span>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div class="block">
|
|
123
|
+
<label for="{_uuid}-jump-to-page"
|
|
124
|
+
><Icon
|
|
125
|
+
name="arrow-move-horizontal"
|
|
126
|
+
colour={Colour['$ui-blue-6']}
|
|
127
|
+
/></label
|
|
128
|
+
>
|
|
129
|
+
|
|
130
|
+
<label for="{_uuid}-jump-to-page">Jump to page:</label>
|
|
131
|
+
|
|
132
|
+
<NumberInput
|
|
133
|
+
id="{_uuid}-jump-to-page"
|
|
134
|
+
value={pageValue}
|
|
135
|
+
oninput={onNumberInput}
|
|
136
|
+
/>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div class="block nopad page-arrow">
|
|
140
|
+
<Button
|
|
141
|
+
variant={Variant.Toolbar}
|
|
142
|
+
disabled={pageIndex === 0}
|
|
143
|
+
side={Side.Bottom}
|
|
144
|
+
onclick={() => {
|
|
145
|
+
pageIndex = Math.max(pageIndex - 1, 0);
|
|
146
|
+
}}
|
|
147
|
+
size={Size.FillHeight}
|
|
148
|
+
iconLeft={{
|
|
149
|
+
name: 'left-close',
|
|
150
|
+
size: Size.FillHeight,
|
|
151
|
+
}}>Previous Page</Button
|
|
152
|
+
>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{#key pageButtons}
|
|
156
|
+
{#each pageButtons as pageNumber (pageNumber)}
|
|
157
|
+
<div class="block nopad">
|
|
158
|
+
<Button
|
|
159
|
+
variant={Variant.Toolbar}
|
|
160
|
+
side={Side.Bottom}
|
|
161
|
+
size={Size.FillHeight}
|
|
162
|
+
toggled={pageIndex + 1 === pageNumber}
|
|
163
|
+
onclick={() => {
|
|
164
|
+
pageIndex = pageNumber - 1;
|
|
165
|
+
}}>{pageNumber}</Button
|
|
166
|
+
>
|
|
167
|
+
</div>
|
|
168
|
+
{/each}
|
|
169
|
+
{/key}
|
|
170
|
+
|
|
171
|
+
<div class="block nopad page-arrow">
|
|
172
|
+
<Button
|
|
173
|
+
variant={Variant.Toolbar}
|
|
174
|
+
side={Side.Bottom}
|
|
175
|
+
size={Size.FillHeight}
|
|
176
|
+
onclick={() => {
|
|
177
|
+
pageIndex = Math.min(pageIndex + 1, lastPageIndex);
|
|
178
|
+
}}
|
|
179
|
+
disabled={pageIndex == lastPageIndex}
|
|
180
|
+
iconRight={{
|
|
181
|
+
name: 'right-close',
|
|
182
|
+
size: Size.FillHeight,
|
|
183
|
+
}}>Next Page</Button
|
|
184
|
+
>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
190
|
<style>.wrapper {
|
|
191
191
|
display: flex;
|
|
192
192
|
flex: 1;
|
|
@@ -261,4 +261,4 @@
|
|
|
261
261
|
}
|
|
262
262
|
.spread_row .spacer {
|
|
263
263
|
flex-grow: 2;
|
|
264
|
-
}</style>
|
|
264
|
+
}</style>
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<!-- @component
|
|
4
|
-
An empty component that only exists to export common snippets
|
|
5
|
-
-->
|
|
6
|
-
<script
|
|
7
|
-
lang="ts"
|
|
8
|
-
module
|
|
9
|
-
>
|
|
10
|
-
import { getErrorMessage, loadingText } from '../../Helpers/Helpers.svelte.js';
|
|
11
|
-
import Button from '../Button.svelte';
|
|
12
|
-
|
|
13
|
-
export const pending = _pending;
|
|
14
|
-
export const failed = _failed;
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
{#snippet _pending()}
|
|
18
|
-
{loadingText}
|
|
19
|
-
{/snippet}
|
|
20
|
-
{#snippet _failed(e: unknown, retry?: () => void)}
|
|
21
|
-
Error: {getErrorMessage(e)}
|
|
22
|
-
{#if retry}
|
|
23
|
-
<Button
|
|
24
|
-
onclick={() => {
|
|
25
|
-
retry();
|
|
26
|
-
}}>Retry</Button
|
|
27
|
-
>
|
|
28
|
-
{/if}
|
|
29
|
-
{/snippet}
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<!-- @component
|
|
4
|
+
An empty component that only exists to export common snippets
|
|
5
|
+
-->
|
|
6
|
+
<script
|
|
7
|
+
lang="ts"
|
|
8
|
+
module
|
|
9
|
+
>
|
|
10
|
+
import { getErrorMessage, loadingText } from '../../Helpers/Helpers.svelte.js';
|
|
11
|
+
import Button from '../Button.svelte';
|
|
12
|
+
|
|
13
|
+
export const pending = _pending;
|
|
14
|
+
export const failed = _failed;
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#snippet _pending()}
|
|
18
|
+
{loadingText}
|
|
19
|
+
{/snippet}
|
|
20
|
+
{#snippet _failed(e: unknown, retry?: () => void)}
|
|
21
|
+
Error: {getErrorMessage(e)}
|
|
22
|
+
{#if retry}
|
|
23
|
+
<Button
|
|
24
|
+
onclick={() => {
|
|
25
|
+
retry();
|
|
26
|
+
}}>Retry</Button
|
|
27
|
+
>
|
|
28
|
+
{/if}
|
|
29
|
+
{/snippet}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts" generics="T">
|
|
4
|
-
import type { BigRadioOption } from '../Types/Internal/BigRadioOption.js';
|
|
5
|
-
import type { BigRadioSetProps } from './BigRadioSetProps.js';
|
|
6
|
-
let { name, options, selected = $bindable() }: BigRadioSetProps<T> = $props();
|
|
7
|
-
|
|
8
|
-
// let selected: T | undefined = $state();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<div class="wrapper">
|
|
12
|
-
{#each options as option (option)}
|
|
13
|
-
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
14
|
-
{@render radio(option)}
|
|
15
|
-
{/each}
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
{#snippet radio(option: BigRadioOption<T>)}
|
|
19
|
-
<!-- {@debug selected} -->
|
|
20
|
-
<label class:selected={selected === option.value}>
|
|
21
|
-
<input type="radio" {name} bind:group={selected} value={option.value} />
|
|
22
|
-
<div class="text">
|
|
23
|
-
<h5 class="title">{option.label}</h5>
|
|
24
|
-
<p class="note">{option.info}</p>
|
|
25
|
-
</div>
|
|
26
|
-
</label>
|
|
27
|
-
{/snippet}
|
|
28
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts" generics="T">
|
|
4
|
+
import type { BigRadioOption } from '../Types/Internal/BigRadioOption.js';
|
|
5
|
+
import type { BigRadioSetProps } from './BigRadioSetProps.js';
|
|
6
|
+
let { name, options, selected = $bindable() }: BigRadioSetProps<T> = $props();
|
|
7
|
+
|
|
8
|
+
// let selected: T | undefined = $state();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class="wrapper">
|
|
12
|
+
{#each options as option (option)}
|
|
13
|
+
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
14
|
+
{@render radio(option)}
|
|
15
|
+
{/each}
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
{#snippet radio(option: BigRadioOption<T>)}
|
|
19
|
+
<!-- {@debug selected} -->
|
|
20
|
+
<label class:selected={selected === option.value}>
|
|
21
|
+
<input type="radio" {name} bind:group={selected} value={option.value} />
|
|
22
|
+
<div class="text">
|
|
23
|
+
<h5 class="title">{option.label}</h5>
|
|
24
|
+
<p class="note">{option.info}</p>
|
|
25
|
+
</div>
|
|
26
|
+
</label>
|
|
27
|
+
{/snippet}
|
|
28
|
+
|
|
29
29
|
<style>.wrapper {
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-flow: row wrap;
|
|
@@ -78,4 +78,4 @@ label.selected {
|
|
|
78
78
|
}
|
|
79
79
|
label.selected h5 {
|
|
80
80
|
color: #ffffff;
|
|
81
|
-
}</style>
|
|
81
|
+
}</style>
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts" module>
|
|
4
|
-
import { Size } from '../Types/Internal/Size.js';
|
|
5
|
-
import type { BubbleProps } from './BubbleProps.js';
|
|
6
|
-
import Icon from './Icon.svelte';
|
|
7
|
-
|
|
8
|
-
const horizontalWithValue: Partial<Record<Size, string>> = {
|
|
9
|
-
[Size.Large]: '1rem'
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const horizontalWithoutValue: Partial<Record<Size, string>> = {
|
|
13
|
-
[Size.Large]: '1.25rem'
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const vertical: Partial<Record<Size, string>> = {
|
|
17
|
-
[Size.Large]: '0.5rem'
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const fontSizes: Partial<Record<Size, string>> = {
|
|
21
|
-
[Size.Large]: '1.12rem'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const borderRadii: Partial<Record<Size, string>> = {
|
|
25
|
-
[Size.Large]: '1.75rem'
|
|
26
|
-
};
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<script lang="ts">
|
|
30
|
-
const {
|
|
31
|
-
options,
|
|
32
|
-
value,
|
|
33
|
-
colours,
|
|
34
|
-
label,
|
|
35
|
-
size = Size.Medium,
|
|
36
|
-
bold,
|
|
37
|
-
icon,
|
|
38
|
-
onclick
|
|
39
|
-
}: BubbleProps = $props();
|
|
40
|
-
|
|
41
|
-
const verticalPadding = $derived(vertical[size] ?? '0.18rem');
|
|
42
|
-
const horizontalPadding = $derived.by(() => {
|
|
43
|
-
if (value.length === 1) {
|
|
44
|
-
return horizontalWithValue[size] ?? '0.5rem';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return horizontalWithoutValue[size] ?? '0.75rem';
|
|
48
|
-
});
|
|
49
|
-
const fontSize = $derived(fontSizes[size] ?? '1rem');
|
|
50
|
-
const borderRadius = $derived(borderRadii[size] ?? '12px');
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
{#if onclick}
|
|
54
|
-
<button class="contents" {onclick}>
|
|
55
|
-
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
56
|
-
{@render bubble()}
|
|
57
|
-
</button>
|
|
58
|
-
{:else}
|
|
59
|
-
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
60
|
-
{@render bubble()}
|
|
61
|
-
{/if}
|
|
62
|
-
|
|
63
|
-
{#snippet bubble()}
|
|
64
|
-
<span
|
|
65
|
-
class="bubble"
|
|
66
|
-
class:bold
|
|
67
|
-
class:hoverable={!!onclick}
|
|
68
|
-
style="{colours
|
|
69
|
-
? `background-color: ${colours.backgroundColour}; color: ${colours.colour};`
|
|
70
|
-
: ''} padding: var(--bubble-padding, {verticalPadding} {horizontalPadding}); font-size: {fontSize}; border-radius: {borderRadius}"
|
|
71
|
-
>{#if label}{label}: {/if}{options?.length
|
|
72
|
-
? options.find((it) => it.value === value)?.label
|
|
73
|
-
: value}{#if icon}<div class="icon"><Icon {...icon} /></div>{/if}</span
|
|
74
|
-
>
|
|
75
|
-
{/snippet}
|
|
76
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts" module>
|
|
4
|
+
import { Size } from '../Types/Internal/Size.js';
|
|
5
|
+
import type { BubbleProps } from './BubbleProps.js';
|
|
6
|
+
import Icon from './Icon.svelte';
|
|
7
|
+
|
|
8
|
+
const horizontalWithValue: Partial<Record<Size, string>> = {
|
|
9
|
+
[Size.Large]: '1rem'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const horizontalWithoutValue: Partial<Record<Size, string>> = {
|
|
13
|
+
[Size.Large]: '1.25rem'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const vertical: Partial<Record<Size, string>> = {
|
|
17
|
+
[Size.Large]: '0.5rem'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const fontSizes: Partial<Record<Size, string>> = {
|
|
21
|
+
[Size.Large]: '1.12rem'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const borderRadii: Partial<Record<Size, string>> = {
|
|
25
|
+
[Size.Large]: '1.75rem'
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
const {
|
|
31
|
+
options,
|
|
32
|
+
value,
|
|
33
|
+
colours,
|
|
34
|
+
label,
|
|
35
|
+
size = Size.Medium,
|
|
36
|
+
bold,
|
|
37
|
+
icon,
|
|
38
|
+
onclick
|
|
39
|
+
}: BubbleProps = $props();
|
|
40
|
+
|
|
41
|
+
const verticalPadding = $derived(vertical[size] ?? '0.18rem');
|
|
42
|
+
const horizontalPadding = $derived.by(() => {
|
|
43
|
+
if (value.length === 1) {
|
|
44
|
+
return horizontalWithValue[size] ?? '0.5rem';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return horizontalWithoutValue[size] ?? '0.75rem';
|
|
48
|
+
});
|
|
49
|
+
const fontSize = $derived(fontSizes[size] ?? '1rem');
|
|
50
|
+
const borderRadius = $derived(borderRadii[size] ?? '12px');
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
{#if onclick}
|
|
54
|
+
<button class="contents" {onclick}>
|
|
55
|
+
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
56
|
+
{@render bubble()}
|
|
57
|
+
</button>
|
|
58
|
+
{:else}
|
|
59
|
+
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
60
|
+
{@render bubble()}
|
|
61
|
+
{/if}
|
|
62
|
+
|
|
63
|
+
{#snippet bubble()}
|
|
64
|
+
<span
|
|
65
|
+
class="bubble"
|
|
66
|
+
class:bold
|
|
67
|
+
class:hoverable={!!onclick}
|
|
68
|
+
style="{colours
|
|
69
|
+
? `background-color: ${colours.backgroundColour}; color: ${colours.colour};`
|
|
70
|
+
: ''} padding: var(--bubble-padding, {verticalPadding} {horizontalPadding}); font-size: {fontSize}; border-radius: {borderRadius}"
|
|
71
|
+
>{#if label}{label}: {/if}{options?.length
|
|
72
|
+
? options.find((it) => it.value === value)?.label
|
|
73
|
+
: value}{#if icon}<div class="icon"><Icon {...icon} /></div>{/if}</span
|
|
74
|
+
>
|
|
75
|
+
{/snippet}
|
|
76
|
+
|
|
77
77
|
<style>button.contents {
|
|
78
78
|
display: contents;
|
|
79
79
|
cursor: pointer;
|
|
@@ -95,4 +95,4 @@
|
|
|
95
95
|
}
|
|
96
96
|
.bubble.bold {
|
|
97
97
|
font-weight: 700;
|
|
98
|
-
}</style>
|
|
98
|
+
}</style>
|