@lavalogic/scoria 0.34.0 → 0.35.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.js +6 -4
- 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 +2 -2
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
generics="Args"
|
|
6
|
-
>
|
|
7
|
-
import { devCatch } from '../Helpers/Helpers.svelte.js';
|
|
8
|
-
import { Colour } from '../scss/colours.js';
|
|
9
|
-
import { Size } from '../Types/Internal/Size.js';
|
|
10
|
-
import Icon from './Icon.svelte';
|
|
11
|
-
import type { TabGroupButtonProps } from './TabGroupButtonProps.js';
|
|
12
|
-
|
|
13
|
-
let { option, selected, noRadius = false }: TabGroupButtonProps<Args> = $props();
|
|
14
|
-
|
|
15
|
-
let disabled = $state(true);
|
|
16
|
-
let visible = $state(true);
|
|
17
|
-
let isValid = $state(true);
|
|
18
|
-
|
|
19
|
-
$effect(() => {
|
|
20
|
-
if (typeof option.isValid === 'boolean') {
|
|
21
|
-
isValid = option.isValid;
|
|
22
|
-
} else {
|
|
23
|
-
option.isValid
|
|
24
|
-
?.then((v) => {
|
|
25
|
-
isValid = v;
|
|
26
|
-
})
|
|
27
|
-
.catch(devCatch);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
$effect(() => {
|
|
31
|
-
if (typeof option.disabled === 'boolean') {
|
|
32
|
-
disabled = option.disabled;
|
|
33
|
-
} else if (option.disabled == undefined) {
|
|
34
|
-
disabled = false;
|
|
35
|
-
} else {
|
|
36
|
-
option.disabled
|
|
37
|
-
.then((v) => {
|
|
38
|
-
disabled = v;
|
|
39
|
-
})
|
|
40
|
-
.catch(devCatch);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
$effect(() => {
|
|
45
|
-
if (typeof option.visible === 'boolean') {
|
|
46
|
-
visible = option.visible;
|
|
47
|
-
} else if (option.visible == undefined) {
|
|
48
|
-
visible = true;
|
|
49
|
-
} else {
|
|
50
|
-
option.visible
|
|
51
|
-
.then((v) => {
|
|
52
|
-
visible = v;
|
|
53
|
-
})
|
|
54
|
-
.catch(devCatch);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
</script>
|
|
58
|
-
|
|
59
|
-
<button
|
|
60
|
-
class:selected
|
|
61
|
-
onclick={() => {
|
|
62
|
-
option.onclick();
|
|
63
|
-
}}
|
|
64
|
-
type="button"
|
|
65
|
-
class="tab"
|
|
66
|
-
class:invalid={!isValid}
|
|
67
|
-
{disabled}
|
|
68
|
-
class:hidden={!visible}
|
|
69
|
-
class:no-radius={noRadius}
|
|
70
|
-
>
|
|
71
|
-
<div class="selected-marker"></div>
|
|
72
|
-
<!-- <Icon
|
|
73
|
-
name="nothing"
|
|
74
|
-
colour={Colour['$brand-primary']}
|
|
75
|
-
size={Size.Small}
|
|
76
|
-
{...option.iconLeft}
|
|
77
|
-
/> -->
|
|
78
|
-
|
|
79
|
-
{option.label}
|
|
80
|
-
{#if !isValid}
|
|
81
|
-
<Icon
|
|
82
|
-
name="error"
|
|
83
|
-
colour={Colour['$error-border']}
|
|
84
|
-
size={Size.Small}
|
|
85
|
-
/>
|
|
86
|
-
<!-- {:else}
|
|
87
|
-
<Icon
|
|
88
|
-
name="nothing"
|
|
89
|
-
colour={Colour['$brand-primary']}
|
|
90
|
-
size={Size.Small}
|
|
91
|
-
{...option.iconRight}
|
|
92
|
-
/> -->
|
|
93
|
-
{/if}
|
|
94
|
-
</button>
|
|
95
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="Args"
|
|
6
|
+
>
|
|
7
|
+
import { devCatch } from '../Helpers/Helpers.svelte.js';
|
|
8
|
+
import { Colour } from '../scss/colours.js';
|
|
9
|
+
import { Size } from '../Types/Internal/Size.js';
|
|
10
|
+
import Icon from './Icon.svelte';
|
|
11
|
+
import type { TabGroupButtonProps } from './TabGroupButtonProps.js';
|
|
12
|
+
|
|
13
|
+
let { option, selected, noRadius = false }: TabGroupButtonProps<Args> = $props();
|
|
14
|
+
|
|
15
|
+
let disabled = $state(true);
|
|
16
|
+
let visible = $state(true);
|
|
17
|
+
let isValid = $state(true);
|
|
18
|
+
|
|
19
|
+
$effect(() => {
|
|
20
|
+
if (typeof option.isValid === 'boolean') {
|
|
21
|
+
isValid = option.isValid;
|
|
22
|
+
} else {
|
|
23
|
+
option.isValid
|
|
24
|
+
?.then((v) => {
|
|
25
|
+
isValid = v;
|
|
26
|
+
})
|
|
27
|
+
.catch(devCatch);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
$effect(() => {
|
|
31
|
+
if (typeof option.disabled === 'boolean') {
|
|
32
|
+
disabled = option.disabled;
|
|
33
|
+
} else if (option.disabled == undefined) {
|
|
34
|
+
disabled = false;
|
|
35
|
+
} else {
|
|
36
|
+
option.disabled
|
|
37
|
+
.then((v) => {
|
|
38
|
+
disabled = v;
|
|
39
|
+
})
|
|
40
|
+
.catch(devCatch);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
$effect(() => {
|
|
45
|
+
if (typeof option.visible === 'boolean') {
|
|
46
|
+
visible = option.visible;
|
|
47
|
+
} else if (option.visible == undefined) {
|
|
48
|
+
visible = true;
|
|
49
|
+
} else {
|
|
50
|
+
option.visible
|
|
51
|
+
.then((v) => {
|
|
52
|
+
visible = v;
|
|
53
|
+
})
|
|
54
|
+
.catch(devCatch);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<button
|
|
60
|
+
class:selected
|
|
61
|
+
onclick={() => {
|
|
62
|
+
option.onclick();
|
|
63
|
+
}}
|
|
64
|
+
type="button"
|
|
65
|
+
class="tab"
|
|
66
|
+
class:invalid={!isValid}
|
|
67
|
+
{disabled}
|
|
68
|
+
class:hidden={!visible}
|
|
69
|
+
class:no-radius={noRadius}
|
|
70
|
+
>
|
|
71
|
+
<div class="selected-marker"></div>
|
|
72
|
+
<!-- <Icon
|
|
73
|
+
name="nothing"
|
|
74
|
+
colour={Colour['$brand-primary']}
|
|
75
|
+
size={Size.Small}
|
|
76
|
+
{...option.iconLeft}
|
|
77
|
+
/> -->
|
|
78
|
+
|
|
79
|
+
{option.label}
|
|
80
|
+
{#if !isValid}
|
|
81
|
+
<Icon
|
|
82
|
+
name="error"
|
|
83
|
+
colour={Colour['$error-border']}
|
|
84
|
+
size={Size.Small}
|
|
85
|
+
/>
|
|
86
|
+
<!-- {:else}
|
|
87
|
+
<Icon
|
|
88
|
+
name="nothing"
|
|
89
|
+
colour={Colour['$brand-primary']}
|
|
90
|
+
size={Size.Small}
|
|
91
|
+
{...option.iconRight}
|
|
92
|
+
/> -->
|
|
93
|
+
{/if}
|
|
94
|
+
</button>
|
|
95
|
+
|
|
96
96
|
<style>button.tab.hidden {
|
|
97
97
|
display: none !important;
|
|
98
98
|
}
|
|
@@ -150,4 +150,4 @@
|
|
|
150
150
|
}
|
|
151
151
|
.tab.invalid {
|
|
152
152
|
color: #aa1414 !important;
|
|
153
|
-
}</style>
|
|
153
|
+
}</style>
|
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts" module>
|
|
4
|
-
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
5
|
-
import { Size } from '../Types/Internal/Size.js';
|
|
6
|
-
import { Variant } from '../Types/Internal/Variant.js';
|
|
7
|
-
import type { IconProps } from './IconProps.js';
|
|
8
|
-
import { icons } from './Icons.js';
|
|
9
|
-
|
|
10
|
-
const sizes: Record<Size, string> = {
|
|
11
|
-
[Size.Tiny]: '8',
|
|
12
|
-
[Size.Small]: '16',
|
|
13
|
-
[Size.MediumSmall]: '20',
|
|
14
|
-
[Size.Medium]: '24',
|
|
15
|
-
[Size.MediumLarge]: '28',
|
|
16
|
-
[Size.Large]: '34',
|
|
17
|
-
[Size.XLarge]: '36',
|
|
18
|
-
[Size.DoubleXLarge]: '40',
|
|
19
|
-
[Size.TripleXLarge]: '40',
|
|
20
|
-
[Size.FillHeight]: '24',
|
|
21
|
-
[Size.FillWidth]: '24'
|
|
22
|
-
};
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<script lang="ts">
|
|
26
|
-
const {
|
|
27
|
-
name,
|
|
28
|
-
size = Size.Medium,
|
|
29
|
-
label,
|
|
30
|
-
float = false,
|
|
31
|
-
variant,
|
|
32
|
-
invisible,
|
|
33
|
-
clickable = false,
|
|
34
|
-
clickableType = 'button',
|
|
35
|
-
zindex = 1,
|
|
36
|
-
anchorX,
|
|
37
|
-
anchorY,
|
|
38
|
-
left,
|
|
39
|
-
right,
|
|
40
|
-
top,
|
|
41
|
-
bottom,
|
|
42
|
-
colour,
|
|
43
|
-
onclick,
|
|
44
|
-
rotate
|
|
45
|
-
}: IconProps = $props();
|
|
46
|
-
|
|
47
|
-
const dim = $derived(sizes[size]);
|
|
48
|
-
const displayIcon = $derived(icons[name]);
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
{#if clickable}
|
|
52
|
-
<button
|
|
53
|
-
class="icon"
|
|
54
|
-
type={clickableType}
|
|
55
|
-
class:header-icon={variant === Variant.HeaderIcon}
|
|
56
|
-
class:fill-width={size === Size.FillWidth}
|
|
57
|
-
class:fill-height={size === Size.FillHeight}
|
|
58
|
-
style="--zindex: {zindex}; --left: {left}; --right: {right}; --top: {top}; --bottom: {bottom}; --anchorX: {anchorX}; --anchorY: {anchorY}; {colour
|
|
59
|
-
? `--colour: ${colour};`
|
|
60
|
-
: ''}"
|
|
61
|
-
class:absolute={float}
|
|
62
|
-
{onclick}
|
|
63
|
-
class:rotate
|
|
64
|
-
onkeydown={passthrough}
|
|
65
|
-
aria-label={label ?? name.toString()}
|
|
66
|
-
>
|
|
67
|
-
{#if displayIcon}
|
|
68
|
-
<!-- SECURITY both displayIcon and its svg property have been frozen. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze -->
|
|
69
|
-
<svg width={dim} height={dim} viewBox="0 0 {displayIcon.box} {displayIcon.box}"
|
|
70
|
-
>{@html displayIcon.svg}</svg
|
|
71
|
-
>
|
|
72
|
-
{:else}
|
|
73
|
-
<span>Invalid Icon</span>
|
|
74
|
-
{/if}
|
|
75
|
-
</button>
|
|
76
|
-
{:else if displayIcon}
|
|
77
|
-
<!-- SECURITY both displayIcon and its svg property have been frozen. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze -->
|
|
78
|
-
<svg
|
|
79
|
-
class="icon"
|
|
80
|
-
style="--zindex: {zindex}; --left: {left}; --right: {right}; --top: {top}; --bottom: {bottom}; --anchorX: {anchorX}; --anchorY: {anchorY}; {colour
|
|
81
|
-
? `--colour: ${colour};`
|
|
82
|
-
: ''}"
|
|
83
|
-
class:absolute={float}
|
|
84
|
-
class:invisible
|
|
85
|
-
class:header-icon={variant === Variant.HeaderIcon}
|
|
86
|
-
class:fill-width={size === Size.FillWidth}
|
|
87
|
-
class:fill-height={size === Size.FillHeight}
|
|
88
|
-
width={dim}
|
|
89
|
-
height={dim}
|
|
90
|
-
class:rotate
|
|
91
|
-
viewBox="0 0 {displayIcon.box} {displayIcon.box}">{@html displayIcon.svg}</svg
|
|
92
|
-
>
|
|
93
|
-
{:else}
|
|
94
|
-
<span>Invalid Icon</span>
|
|
95
|
-
{/if}
|
|
96
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts" module>
|
|
4
|
+
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
5
|
+
import { Size } from '../Types/Internal/Size.js';
|
|
6
|
+
import { Variant } from '../Types/Internal/Variant.js';
|
|
7
|
+
import type { IconProps } from './IconProps.js';
|
|
8
|
+
import { icons } from './Icons.js';
|
|
9
|
+
|
|
10
|
+
const sizes: Record<Size, string> = {
|
|
11
|
+
[Size.Tiny]: '8',
|
|
12
|
+
[Size.Small]: '16',
|
|
13
|
+
[Size.MediumSmall]: '20',
|
|
14
|
+
[Size.Medium]: '24',
|
|
15
|
+
[Size.MediumLarge]: '28',
|
|
16
|
+
[Size.Large]: '34',
|
|
17
|
+
[Size.XLarge]: '36',
|
|
18
|
+
[Size.DoubleXLarge]: '40',
|
|
19
|
+
[Size.TripleXLarge]: '40',
|
|
20
|
+
[Size.FillHeight]: '24',
|
|
21
|
+
[Size.FillWidth]: '24'
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
const {
|
|
27
|
+
name,
|
|
28
|
+
size = Size.Medium,
|
|
29
|
+
label,
|
|
30
|
+
float = false,
|
|
31
|
+
variant,
|
|
32
|
+
invisible,
|
|
33
|
+
clickable = false,
|
|
34
|
+
clickableType = 'button',
|
|
35
|
+
zindex = 1,
|
|
36
|
+
anchorX,
|
|
37
|
+
anchorY,
|
|
38
|
+
left,
|
|
39
|
+
right,
|
|
40
|
+
top,
|
|
41
|
+
bottom,
|
|
42
|
+
colour,
|
|
43
|
+
onclick,
|
|
44
|
+
rotate
|
|
45
|
+
}: IconProps = $props();
|
|
46
|
+
|
|
47
|
+
const dim = $derived(sizes[size]);
|
|
48
|
+
const displayIcon = $derived(icons[name]);
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{#if clickable}
|
|
52
|
+
<button
|
|
53
|
+
class="icon"
|
|
54
|
+
type={clickableType}
|
|
55
|
+
class:header-icon={variant === Variant.HeaderIcon}
|
|
56
|
+
class:fill-width={size === Size.FillWidth}
|
|
57
|
+
class:fill-height={size === Size.FillHeight}
|
|
58
|
+
style="--zindex: {zindex}; --left: {left}; --right: {right}; --top: {top}; --bottom: {bottom}; --anchorX: {anchorX}; --anchorY: {anchorY}; {colour
|
|
59
|
+
? `--colour: ${colour};`
|
|
60
|
+
: ''}"
|
|
61
|
+
class:absolute={float}
|
|
62
|
+
{onclick}
|
|
63
|
+
class:rotate
|
|
64
|
+
onkeydown={passthrough}
|
|
65
|
+
aria-label={label ?? name.toString()}
|
|
66
|
+
>
|
|
67
|
+
{#if displayIcon}
|
|
68
|
+
<!-- SECURITY both displayIcon and its svg property have been frozen. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze -->
|
|
69
|
+
<svg width={dim} height={dim} viewBox="0 0 {displayIcon.box} {displayIcon.box}"
|
|
70
|
+
>{@html displayIcon.svg}</svg
|
|
71
|
+
>
|
|
72
|
+
{:else}
|
|
73
|
+
<span>Invalid Icon</span>
|
|
74
|
+
{/if}
|
|
75
|
+
</button>
|
|
76
|
+
{:else if displayIcon}
|
|
77
|
+
<!-- SECURITY both displayIcon and its svg property have been frozen. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze -->
|
|
78
|
+
<svg
|
|
79
|
+
class="icon"
|
|
80
|
+
style="--zindex: {zindex}; --left: {left}; --right: {right}; --top: {top}; --bottom: {bottom}; --anchorX: {anchorX}; --anchorY: {anchorY}; {colour
|
|
81
|
+
? `--colour: ${colour};`
|
|
82
|
+
: ''}"
|
|
83
|
+
class:absolute={float}
|
|
84
|
+
class:invisible
|
|
85
|
+
class:header-icon={variant === Variant.HeaderIcon}
|
|
86
|
+
class:fill-width={size === Size.FillWidth}
|
|
87
|
+
class:fill-height={size === Size.FillHeight}
|
|
88
|
+
width={dim}
|
|
89
|
+
height={dim}
|
|
90
|
+
class:rotate
|
|
91
|
+
viewBox="0 0 {displayIcon.box} {displayIcon.box}">{@html displayIcon.svg}</svg
|
|
92
|
+
>
|
|
93
|
+
{:else}
|
|
94
|
+
<span>Invalid Icon</span>
|
|
95
|
+
{/if}
|
|
96
|
+
|
|
97
97
|
<style>.rotate {
|
|
98
98
|
animation: spin 1.5s forwards infinite linear;
|
|
99
99
|
transform-origin: center;
|
|
@@ -157,4 +157,4 @@ svg:hover {
|
|
|
157
157
|
.fill-width {
|
|
158
158
|
height: max-content;
|
|
159
159
|
width: 100%;
|
|
160
|
-
}</style>
|
|
160
|
+
}</style>
|