@lavalogic/scoria 0.40.1 → 0.40.2
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 +46 -46
- package/dist/Components/AccordionGroupButton.svelte +76 -76
- package/dist/Components/Action.svelte +136 -136
- package/dist/Components/AlertModal.svelte +195 -195
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +729 -729
- package/dist/Components/Base/BaseModal.svelte +125 -125
- package/dist/Components/Base/ContextWrapper.svelte +72 -72
- package/dist/Components/Base/Pagination.svelte +198 -198
- package/dist/Components/Base/Snippets.svelte +36 -36
- package/dist/Components/BigRadioSet.svelte +38 -38
- package/dist/Components/Bubble.svelte +101 -101
- package/dist/Components/Button.svelte +209 -209
- package/dist/Components/Checkbox.svelte +86 -86
- package/dist/Components/CollapsibleCard.svelte +78 -78
- package/dist/Components/Contexts/ContextMenu.svelte +164 -164
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +60 -60
- package/dist/Components/Contexts/Toast.svelte +86 -86
- package/dist/Components/Contexts/ToastContainer.svelte +65 -65
- package/dist/Components/Contexts/Tooltip.svelte +37 -37
- package/dist/Components/DataMatrixIcon.svelte +112 -112
- package/dist/Components/DateInput.svelte +148 -148
- package/dist/Components/DatePicker.svelte +300 -300
- package/dist/Components/DesktopModal.svelte +90 -90
- package/dist/Components/Dial.svelte +204 -204
- package/dist/Components/DimensionInput.svelte +170 -170
- package/dist/Components/DragMenu/DragMenuHolder.svelte +119 -119
- package/dist/Components/DragMenu/DraggableCard.svelte +77 -77
- package/dist/Components/FileCard.svelte +24 -24
- package/dist/Components/FileUpload.svelte +236 -236
- package/dist/Components/GridInput.svelte +196 -196
- package/dist/Components/GridInputSet.svelte +29 -29
- package/dist/Components/HorizontalTabGroup.svelte +82 -82
- package/dist/Components/HorizontalTabGroupButton.svelte +44 -44
- package/dist/Components/Icon.svelte +128 -128
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/InfoAlert.svelte +35 -35
- package/dist/Components/LoadingAnimation.svelte +29 -29
- package/dist/Components/LoadingModal.svelte +45 -45
- package/dist/Components/LoadingOverlay.svelte +25 -25
- package/dist/Components/Modal.svelte +258 -258
- package/dist/Components/MultiSelect.svelte +220 -220
- package/dist/Components/Nav/Nav.svelte +110 -110
- package/dist/Components/Nav/NavServiceMenuList.svelte +43 -43
- package/dist/Components/Nav/NavTab.svelte +62 -62
- package/dist/Components/Nav/ServiceMenuItem.svelte +112 -112
- package/dist/Components/Nav/ServicesNav.svelte +80 -80
- package/dist/Components/NumberInput.svelte +157 -157
- package/dist/Components/PageHeading.svelte +25 -25
- package/dist/Components/PasswordInput.svelte +88 -88
- package/dist/Components/Portal.svelte +36 -36
- package/dist/Components/ProgressBubble.svelte +107 -107
- package/dist/Components/QuerySelect.svelte +366 -366
- package/dist/Components/SingleSelect.svelte +250 -250
- package/dist/Components/StepButton.svelte +70 -70
- package/dist/Components/StepForm.svelte +140 -140
- package/dist/Components/Switch.svelte +69 -69
- package/dist/Components/Table/ARCHITECTURE.md +298 -298
- package/dist/Components/Table/Body/QuickSearchCell.svelte +679 -679
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +51 -51
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +59 -59
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +454 -454
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +79 -79
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +185 -185
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +124 -124
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +131 -120
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +234 -234
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +105 -105
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +87 -87
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +126 -126
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +159 -159
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +246 -246
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +216 -216
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +252 -252
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +179 -179
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +221 -221
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +197 -197
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +190 -190
- package/dist/Components/Table/Body/Rows/TableRow.svelte +290 -290
- package/dist/Components/Table/Body/TableBody.svelte +155 -155
- package/dist/Components/Table/ColumnFactory.svelte.js +1 -0
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +41 -41
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +30 -30
- package/dist/Components/Table/Headers/TableHead.svelte +415 -415
- package/dist/Components/Table/Misc/ColumnPanel.svelte +39 -39
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +39 -39
- package/dist/Components/Table/Misc/FilterInput.svelte +641 -641
- package/dist/Components/Table/Misc/FilterPanel.svelte +190 -190
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +31 -31
- package/dist/Components/Table/Misc/ShareViewModal.svelte +291 -291
- package/dist/Components/Table/Misc/SidePanel.svelte +35 -35
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +644 -644
- package/dist/Components/Table/Misc/TableFooter.svelte +340 -340
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +140 -140
- package/dist/Components/Table/Misc/TableSidebar.svelte +200 -200
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +105 -105
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +100 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +107 -107
- package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +192 -192
- package/dist/Components/Table/NestedTable.svelte +130 -130
- package/dist/Components/Table/Table.svelte +692 -692
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.d.ts +5 -0
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.js +3 -0
- package/dist/Components/Table/Types/Public/ColumnOptions.d.ts +10 -0
- package/dist/Components/Test/TestContextConsumer.svelte +13 -13
- package/dist/Components/TextArea.svelte +130 -130
- package/dist/Components/TextInput.svelte +176 -176
- package/dist/Components/ThreeStateRadio.svelte +131 -131
- package/dist/Components/Touch/BoolCard.svelte +45 -45
- package/dist/Components/Touch/DateModal.svelte +209 -209
- package/dist/Components/Touch/EditCard.svelte +59 -59
- package/dist/Components/Touch/InfoCard.svelte +31 -31
- package/dist/Components/Touch/InfoTextCard.svelte +28 -28
- package/dist/Components/Touch/ModalExplanation.svelte +17 -17
- package/dist/Components/Touch/NumberKeyboard.svelte +225 -225
- package/dist/Components/Touch/NumberModal.svelte +79 -79
- package/dist/Components/Touch/PlusMinusCard.svelte +46 -46
- package/dist/Components/Touch/SelectModal.svelte +127 -127
- package/dist/Components/Touch/SummaryCard.svelte +93 -93
- package/dist/Components/Touch/TextAreaModal.svelte +95 -95
- package/dist/Components/Touch/TextModal.svelte +106 -106
- package/dist/Components/Touch/TouchCard.svelte +33 -33
- package/dist/Components/Touch/TouchModal.svelte +274 -274
- package/dist/Components/Touch/UtilityButton.svelte +109 -109
- package/dist/Components/VerticalTabGroup.svelte +79 -79
- package/dist/Components/VerticalTabGroupButton.svelte +58 -58
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Types/Examples/ExampleModal.svelte +35 -35
- 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,46 +1,46 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
generics="Args"
|
|
6
|
-
>
|
|
7
|
-
import { useAsyncFlag } from '../Helpers/AsyncFlag.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
|
-
const { option, selected, noRadius = false }: TabGroupButtonProps<Args> = $props();
|
|
14
|
-
|
|
15
|
-
const isValid = useAsyncFlag(() => option.isValid, true);
|
|
16
|
-
const disabled = useAsyncFlag(() => option.disabled, false);
|
|
17
|
-
const visible = useAsyncFlag(() => option.visible, true);
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<button
|
|
21
|
-
class:selected
|
|
22
|
-
onclick={() => {
|
|
23
|
-
option.onclick();
|
|
24
|
-
}}
|
|
25
|
-
type="button"
|
|
26
|
-
class="tab"
|
|
27
|
-
class:invalid={!isValid.value}
|
|
28
|
-
disabled={disabled.value}
|
|
29
|
-
class:hidden={!visible.value}
|
|
30
|
-
class:no-radius={noRadius}
|
|
31
|
-
>
|
|
32
|
-
<div class="selected-marker"></div>
|
|
33
|
-
|
|
34
|
-
{option.label}
|
|
35
|
-
{#if !isValid.value}
|
|
36
|
-
<Icon
|
|
37
|
-
name="error"
|
|
38
|
-
colour={Colour['$error-border']}
|
|
39
|
-
size={Size.Small}
|
|
40
|
-
/>
|
|
41
|
-
{/if}
|
|
42
|
-
</button>
|
|
43
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="Args"
|
|
6
|
+
>
|
|
7
|
+
import { useAsyncFlag } from '../Helpers/AsyncFlag.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
|
+
const { option, selected, noRadius = false }: TabGroupButtonProps<Args> = $props();
|
|
14
|
+
|
|
15
|
+
const isValid = useAsyncFlag(() => option.isValid, true);
|
|
16
|
+
const disabled = useAsyncFlag(() => option.disabled, false);
|
|
17
|
+
const visible = useAsyncFlag(() => option.visible, true);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<button
|
|
21
|
+
class:selected
|
|
22
|
+
onclick={() => {
|
|
23
|
+
option.onclick();
|
|
24
|
+
}}
|
|
25
|
+
type="button"
|
|
26
|
+
class="tab"
|
|
27
|
+
class:invalid={!isValid.value}
|
|
28
|
+
disabled={disabled.value}
|
|
29
|
+
class:hidden={!visible.value}
|
|
30
|
+
class:no-radius={noRadius}
|
|
31
|
+
>
|
|
32
|
+
<div class="selected-marker"></div>
|
|
33
|
+
|
|
34
|
+
{option.label}
|
|
35
|
+
{#if !isValid.value}
|
|
36
|
+
<Icon
|
|
37
|
+
name="error"
|
|
38
|
+
colour={Colour['$error-border']}
|
|
39
|
+
size={Size.Small}
|
|
40
|
+
/>
|
|
41
|
+
{/if}
|
|
42
|
+
</button>
|
|
43
|
+
|
|
44
44
|
<style>button.tab.hidden {
|
|
45
45
|
display: none !important;
|
|
46
46
|
}
|
|
@@ -98,4 +98,4 @@
|
|
|
98
98
|
}
|
|
99
99
|
.tab:hover, .tab.selected:hover, .tab.invalid:hover {
|
|
100
100
|
background-color: #f4f7f9;
|
|
101
|
-
}</style>
|
|
101
|
+
}</style>
|
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
module
|
|
6
|
-
>
|
|
7
|
-
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
8
|
-
import { Size } from '../Types/Internal/Size.js';
|
|
9
|
-
import { Variant } from '../Types/Internal/Variant.js';
|
|
10
|
-
import type { IconProps } from './IconProps.js';
|
|
11
|
-
import { icons } from './Icons.js';
|
|
12
|
-
|
|
13
|
-
const sizes: Record<Size, string> = {
|
|
14
|
-
[Size.Tiny]: '8',
|
|
15
|
-
[Size.Small]: '16',
|
|
16
|
-
[Size.MediumSmall]: '20',
|
|
17
|
-
[Size.Medium]: '24',
|
|
18
|
-
[Size.MediumLarge]: '28',
|
|
19
|
-
[Size.Large]: '34',
|
|
20
|
-
[Size.XLarge]: '36',
|
|
21
|
-
[Size.DoubleXLarge]: '40',
|
|
22
|
-
[Size.TripleXLarge]: '40',
|
|
23
|
-
[Size.FillHeight]: '24',
|
|
24
|
-
[Size.FillWidth]: '24',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// SECURITY invariant: the `icons` map must remain frozen. The component
|
|
28
|
-
// inlines `displayIcon.svg` via `{@html}` and relies on the freeze to
|
|
29
|
-
// guarantee no runtime mutation of the SVG payload (XSS sink otherwise).
|
|
30
|
-
// This runtime check fires once at module evaluation; if it ever fails,
|
|
31
|
-
// the build/runtime should be considered compromised.
|
|
32
|
-
if (!Object.isFrozen(icons)) {
|
|
33
|
-
throw new Error('Icon: icons map is not frozen. Refusing to inline SVG fragments via {@html}.');
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<script lang="ts">
|
|
38
|
-
const {
|
|
39
|
-
name,
|
|
40
|
-
size = Size.Medium,
|
|
41
|
-
label,
|
|
42
|
-
float = false,
|
|
43
|
-
variant,
|
|
44
|
-
invisible,
|
|
45
|
-
clickable = false,
|
|
46
|
-
clickableType = 'button',
|
|
47
|
-
zindex = 1,
|
|
48
|
-
anchorX,
|
|
49
|
-
anchorY,
|
|
50
|
-
left,
|
|
51
|
-
right,
|
|
52
|
-
top,
|
|
53
|
-
bottom,
|
|
54
|
-
colour,
|
|
55
|
-
onclick,
|
|
56
|
-
rotate,
|
|
57
|
-
}: IconProps = $props();
|
|
58
|
-
|
|
59
|
-
const dim = $derived(sizes[size]);
|
|
60
|
-
const displayIcon = $derived(icons[name]);
|
|
61
|
-
|
|
62
|
-
// Build the inline style string once per reactive input change rather
|
|
63
|
-
// than on every render. Cheap allocation reduction for the many-Icon-
|
|
64
|
-
// per-screen case (toolbars, table cells, status indicators).
|
|
65
|
-
const styleString = $derived(
|
|
66
|
-
`--zindex: ${zindex.toString()}; --left: ${left ?? ''}; --right: ${right ?? ''}; --top: ${top ?? ''}; --bottom: ${bottom ?? ''}; --anchorX: ${anchorX ?? ''}; --anchorY: ${anchorY ?? ''};${colour ? ` --colour: ${colour};` : ''}`
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const ariaLabel = $derived(label ?? name.toString());
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
{#if clickable}
|
|
73
|
-
<button
|
|
74
|
-
class="icon"
|
|
75
|
-
type={clickableType}
|
|
76
|
-
class:header-icon={variant === Variant.HeaderIcon}
|
|
77
|
-
class:fill-width={size === Size.FillWidth}
|
|
78
|
-
class:fill-height={size === Size.FillHeight}
|
|
79
|
-
style={styleString}
|
|
80
|
-
class:absolute={float}
|
|
81
|
-
{onclick}
|
|
82
|
-
class:rotate
|
|
83
|
-
onkeydown={passthrough}
|
|
84
|
-
aria-label={ariaLabel}
|
|
85
|
-
>
|
|
86
|
-
{#if displayIcon}
|
|
87
|
-
<!-- SECURITY both displayIcon and its svg property have been frozen. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze -->
|
|
88
|
-
<svg
|
|
89
|
-
width={dim}
|
|
90
|
-
height={dim}
|
|
91
|
-
viewBox="0 0 {displayIcon.box} {displayIcon.box}"
|
|
92
|
-
>
|
|
93
|
-
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
94
|
-
{@html displayIcon.svg}</svg
|
|
95
|
-
>
|
|
96
|
-
{:else}
|
|
97
|
-
<span
|
|
98
|
-
aria-hidden="true"
|
|
99
|
-
class="invalid-icon"
|
|
100
|
-
></span>
|
|
101
|
-
{/if}
|
|
102
|
-
</button>
|
|
103
|
-
{:else if displayIcon}
|
|
104
|
-
<!-- SECURITY both displayIcon and its svg property have been frozen. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze -->
|
|
105
|
-
<svg
|
|
106
|
-
class="icon"
|
|
107
|
-
style={styleString}
|
|
108
|
-
class:absolute={float}
|
|
109
|
-
class:invisible
|
|
110
|
-
class:header-icon={variant === Variant.HeaderIcon}
|
|
111
|
-
class:fill-width={size === Size.FillWidth}
|
|
112
|
-
class:fill-height={size === Size.FillHeight}
|
|
113
|
-
width={dim}
|
|
114
|
-
height={dim}
|
|
115
|
-
class:rotate
|
|
116
|
-
viewBox="0 0 {displayIcon.box} {displayIcon.box}"
|
|
117
|
-
>
|
|
118
|
-
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
119
|
-
{@html displayIcon.svg}</svg
|
|
120
|
-
>
|
|
121
|
-
{:else}
|
|
122
|
-
<span
|
|
123
|
-
aria-hidden="true"
|
|
124
|
-
class="invalid-icon"
|
|
125
|
-
></span>
|
|
126
|
-
{/if}
|
|
127
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>
|
|
7
|
+
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
8
|
+
import { Size } from '../Types/Internal/Size.js';
|
|
9
|
+
import { Variant } from '../Types/Internal/Variant.js';
|
|
10
|
+
import type { IconProps } from './IconProps.js';
|
|
11
|
+
import { icons } from './Icons.js';
|
|
12
|
+
|
|
13
|
+
const sizes: Record<Size, string> = {
|
|
14
|
+
[Size.Tiny]: '8',
|
|
15
|
+
[Size.Small]: '16',
|
|
16
|
+
[Size.MediumSmall]: '20',
|
|
17
|
+
[Size.Medium]: '24',
|
|
18
|
+
[Size.MediumLarge]: '28',
|
|
19
|
+
[Size.Large]: '34',
|
|
20
|
+
[Size.XLarge]: '36',
|
|
21
|
+
[Size.DoubleXLarge]: '40',
|
|
22
|
+
[Size.TripleXLarge]: '40',
|
|
23
|
+
[Size.FillHeight]: '24',
|
|
24
|
+
[Size.FillWidth]: '24',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// SECURITY invariant: the `icons` map must remain frozen. The component
|
|
28
|
+
// inlines `displayIcon.svg` via `{@html}` and relies on the freeze to
|
|
29
|
+
// guarantee no runtime mutation of the SVG payload (XSS sink otherwise).
|
|
30
|
+
// This runtime check fires once at module evaluation; if it ever fails,
|
|
31
|
+
// the build/runtime should be considered compromised.
|
|
32
|
+
if (!Object.isFrozen(icons)) {
|
|
33
|
+
throw new Error('Icon: icons map is not frozen. Refusing to inline SVG fragments via {@html}.');
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
const {
|
|
39
|
+
name,
|
|
40
|
+
size = Size.Medium,
|
|
41
|
+
label,
|
|
42
|
+
float = false,
|
|
43
|
+
variant,
|
|
44
|
+
invisible,
|
|
45
|
+
clickable = false,
|
|
46
|
+
clickableType = 'button',
|
|
47
|
+
zindex = 1,
|
|
48
|
+
anchorX,
|
|
49
|
+
anchorY,
|
|
50
|
+
left,
|
|
51
|
+
right,
|
|
52
|
+
top,
|
|
53
|
+
bottom,
|
|
54
|
+
colour,
|
|
55
|
+
onclick,
|
|
56
|
+
rotate,
|
|
57
|
+
}: IconProps = $props();
|
|
58
|
+
|
|
59
|
+
const dim = $derived(sizes[size]);
|
|
60
|
+
const displayIcon = $derived(icons[name]);
|
|
61
|
+
|
|
62
|
+
// Build the inline style string once per reactive input change rather
|
|
63
|
+
// than on every render. Cheap allocation reduction for the many-Icon-
|
|
64
|
+
// per-screen case (toolbars, table cells, status indicators).
|
|
65
|
+
const styleString = $derived(
|
|
66
|
+
`--zindex: ${zindex.toString()}; --left: ${left ?? ''}; --right: ${right ?? ''}; --top: ${top ?? ''}; --bottom: ${bottom ?? ''}; --anchorX: ${anchorX ?? ''}; --anchorY: ${anchorY ?? ''};${colour ? ` --colour: ${colour};` : ''}`
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const ariaLabel = $derived(label ?? name.toString());
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
{#if clickable}
|
|
73
|
+
<button
|
|
74
|
+
class="icon"
|
|
75
|
+
type={clickableType}
|
|
76
|
+
class:header-icon={variant === Variant.HeaderIcon}
|
|
77
|
+
class:fill-width={size === Size.FillWidth}
|
|
78
|
+
class:fill-height={size === Size.FillHeight}
|
|
79
|
+
style={styleString}
|
|
80
|
+
class:absolute={float}
|
|
81
|
+
{onclick}
|
|
82
|
+
class:rotate
|
|
83
|
+
onkeydown={passthrough}
|
|
84
|
+
aria-label={ariaLabel}
|
|
85
|
+
>
|
|
86
|
+
{#if displayIcon}
|
|
87
|
+
<!-- SECURITY both displayIcon and its svg property have been frozen. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze -->
|
|
88
|
+
<svg
|
|
89
|
+
width={dim}
|
|
90
|
+
height={dim}
|
|
91
|
+
viewBox="0 0 {displayIcon.box} {displayIcon.box}"
|
|
92
|
+
>
|
|
93
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
94
|
+
{@html displayIcon.svg}</svg
|
|
95
|
+
>
|
|
96
|
+
{:else}
|
|
97
|
+
<span
|
|
98
|
+
aria-hidden="true"
|
|
99
|
+
class="invalid-icon"
|
|
100
|
+
></span>
|
|
101
|
+
{/if}
|
|
102
|
+
</button>
|
|
103
|
+
{:else if displayIcon}
|
|
104
|
+
<!-- SECURITY both displayIcon and its svg property have been frozen. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze -->
|
|
105
|
+
<svg
|
|
106
|
+
class="icon"
|
|
107
|
+
style={styleString}
|
|
108
|
+
class:absolute={float}
|
|
109
|
+
class:invisible
|
|
110
|
+
class:header-icon={variant === Variant.HeaderIcon}
|
|
111
|
+
class:fill-width={size === Size.FillWidth}
|
|
112
|
+
class:fill-height={size === Size.FillHeight}
|
|
113
|
+
width={dim}
|
|
114
|
+
height={dim}
|
|
115
|
+
class:rotate
|
|
116
|
+
viewBox="0 0 {displayIcon.box} {displayIcon.box}"
|
|
117
|
+
>
|
|
118
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
119
|
+
{@html displayIcon.svg}</svg
|
|
120
|
+
>
|
|
121
|
+
{:else}
|
|
122
|
+
<span
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
class="invalid-icon"
|
|
125
|
+
></span>
|
|
126
|
+
{/if}
|
|
127
|
+
|
|
128
128
|
<style>.rotate {
|
|
129
129
|
transform-origin: center;
|
|
130
130
|
}
|
|
@@ -198,4 +198,4 @@ svg:hover {
|
|
|
198
198
|
.fill-width {
|
|
199
199
|
height: max-content;
|
|
200
200
|
width: 100%;
|
|
201
|
-
}</style>
|
|
201
|
+
}</style>
|