@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,140 +1,140 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script module lang="ts">
|
|
4
|
-
import { TooltipContext } from '../Contexts/TooltipContext.svelte.js';
|
|
5
|
-
import { Delay } from '../Delay/Delay.js';
|
|
6
|
-
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
7
|
-
import { Shape } from '../Types/Internal/Shape.js';
|
|
8
|
-
import { Side } from '../Types/Internal/Side.js';
|
|
9
|
-
import { Size } from '../Types/Internal/Size.js';
|
|
10
|
-
import { ColourSet } from '../scss/colours.js';
|
|
11
|
-
import { getContext } from 'svelte';
|
|
12
|
-
import type { ActionProps } from './ActionProps.js';
|
|
13
|
-
import Icon from './Icon.svelte';
|
|
14
|
-
|
|
15
|
-
const paddings: Record<Shape, Record<Size, number>> = {
|
|
16
|
-
[Shape.Rectangle]: {
|
|
17
|
-
[Size.Tiny]: 0.125,
|
|
18
|
-
[Size.Small]: 0.1875,
|
|
19
|
-
[Size.MediumSmall]: 0.3125,
|
|
20
|
-
[Size.Medium]: 0.375,
|
|
21
|
-
[Size.MediumLarge]: 0.5,
|
|
22
|
-
[Size.Large]: 0.625,
|
|
23
|
-
[Size.XLarge]: 0.6875,
|
|
24
|
-
[Size.DoubleXLarge]: 0.8125,
|
|
25
|
-
[Size.TripleXLarge]: 0.875,
|
|
26
|
-
[Size.FillWidth]: -1,
|
|
27
|
-
[Size.FillHeight]: -1
|
|
28
|
-
},
|
|
29
|
-
[Shape.Circle]: {
|
|
30
|
-
[Size.Tiny]: 0.1875,
|
|
31
|
-
[Size.Small]: 0.5,
|
|
32
|
-
[Size.MediumSmall]: 0.875,
|
|
33
|
-
[Size.Medium]: 1.0625,
|
|
34
|
-
[Size.MediumLarge]: 1.375,
|
|
35
|
-
[Size.Large]: 1.75,
|
|
36
|
-
[Size.XLarge]: 1.9375,
|
|
37
|
-
[Size.DoubleXLarge]: 2.25,
|
|
38
|
-
[Size.TripleXLarge]: 2.4375,
|
|
39
|
-
[Size.FillWidth]: -1,
|
|
40
|
-
[Size.FillHeight]: -1
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<script lang="ts">
|
|
46
|
-
const {
|
|
47
|
-
icon,
|
|
48
|
-
id,
|
|
49
|
-
border = false,
|
|
50
|
-
shape = Shape.Rectangle,
|
|
51
|
-
label,
|
|
52
|
-
colourSet = ColourSet.Secondary,
|
|
53
|
-
size = Size.Medium,
|
|
54
|
-
paddingSize,
|
|
55
|
-
type = 'button',
|
|
56
|
-
noTabIndex = false,
|
|
57
|
-
disabled,
|
|
58
|
-
backgroundColour,
|
|
59
|
-
hoverBackgroundColour,
|
|
60
|
-
'data-type': dataType,
|
|
61
|
-
onfocus,
|
|
62
|
-
onblur,
|
|
63
|
-
onclick,
|
|
64
|
-
onkeydown: onkeydownProp,
|
|
65
|
-
style = '',
|
|
66
|
-
side
|
|
67
|
-
}: ActionProps = $props();
|
|
68
|
-
|
|
69
|
-
const iconSize: Size = $derived(icon.size ?? size);
|
|
70
|
-
|
|
71
|
-
const pad: string = $derived.by(() => {
|
|
72
|
-
const padSize = paddingSize ?? size;
|
|
73
|
-
return padSize === Size.FillWidth ? '' : `${paddings[shape][padSize]}rem`;
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
function onkeydown(e: KeyboardEvent) {
|
|
77
|
-
passthrough(e);
|
|
78
|
-
|
|
79
|
-
if (document.activeElement === e.target) {
|
|
80
|
-
onkeydownProp?.(e);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const tooltipContext = getContext<TooltipContext>(TooltipContext.identifier);
|
|
85
|
-
// const toastContext = getContext<ToastContext>(ToastContext.identifier);
|
|
86
|
-
</script>
|
|
87
|
-
|
|
88
|
-
<button
|
|
89
|
-
{id}
|
|
90
|
-
onmouseenter={(e) => {
|
|
91
|
-
if (label) {
|
|
92
|
-
// TODO test currentTarget here
|
|
93
|
-
const rect = (e.target as HTMLButtonElement).getBoundingClientRect();
|
|
94
|
-
tooltipContext.showTooltip({
|
|
95
|
-
text: label,
|
|
96
|
-
arrow: side ?? Side.Left,
|
|
97
|
-
delay: Delay.Default,
|
|
98
|
-
rect
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}}
|
|
102
|
-
onmouseleave={() => {
|
|
103
|
-
if (label) {
|
|
104
|
-
tooltipContext.hideTooltip(label);
|
|
105
|
-
}
|
|
106
|
-
}}
|
|
107
|
-
tabindex={noTabIndex ? -1 : undefined}
|
|
108
|
-
data-type={dataType}
|
|
109
|
-
style="{pad ? `--pad: ${pad};` : ''} {backgroundColour
|
|
110
|
-
? `--background-colour: ${backgroundColour};`
|
|
111
|
-
: ``} {hoverBackgroundColour
|
|
112
|
-
? `--hover-background-colour: ${hoverBackgroundColour};`
|
|
113
|
-
: ``}{style}"
|
|
114
|
-
class:border
|
|
115
|
-
class:circular={shape === Shape.Circle}
|
|
116
|
-
class:primary={colourSet === ColourSet.Primary}
|
|
117
|
-
class:secondary={colourSet === ColourSet.Secondary}
|
|
118
|
-
class:auxiliary={colourSet === ColourSet.Auxiliary}
|
|
119
|
-
class:info={colourSet === ColourSet.Info}
|
|
120
|
-
class:error={colourSet === ColourSet.Error}
|
|
121
|
-
class:fill-width={size === Size.FillWidth}
|
|
122
|
-
class:fill-height={size === Size.FillHeight}
|
|
123
|
-
{type}
|
|
124
|
-
{disabled}
|
|
125
|
-
{onfocus}
|
|
126
|
-
{onblur}
|
|
127
|
-
{onkeydown}
|
|
128
|
-
onclick={(e) => {
|
|
129
|
-
// toastContext.toast("clicked action")
|
|
130
|
-
if (label) {
|
|
131
|
-
tooltipContext.hideTooltip(label);
|
|
132
|
-
}
|
|
133
|
-
onclick?.(e);
|
|
134
|
-
}}
|
|
135
|
-
aria-label={label}><Icon {...icon} size={iconSize} /></button
|
|
136
|
-
>
|
|
137
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script module lang="ts">
|
|
4
|
+
import { TooltipContext } from '../Contexts/TooltipContext.svelte.js';
|
|
5
|
+
import { Delay } from '../Delay/Delay.js';
|
|
6
|
+
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
7
|
+
import { Shape } from '../Types/Internal/Shape.js';
|
|
8
|
+
import { Side } from '../Types/Internal/Side.js';
|
|
9
|
+
import { Size } from '../Types/Internal/Size.js';
|
|
10
|
+
import { ColourSet } from '../scss/colours.js';
|
|
11
|
+
import { getContext } from 'svelte';
|
|
12
|
+
import type { ActionProps } from './ActionProps.js';
|
|
13
|
+
import Icon from './Icon.svelte';
|
|
14
|
+
|
|
15
|
+
const paddings: Record<Shape, Record<Size, number>> = {
|
|
16
|
+
[Shape.Rectangle]: {
|
|
17
|
+
[Size.Tiny]: 0.125,
|
|
18
|
+
[Size.Small]: 0.1875,
|
|
19
|
+
[Size.MediumSmall]: 0.3125,
|
|
20
|
+
[Size.Medium]: 0.375,
|
|
21
|
+
[Size.MediumLarge]: 0.5,
|
|
22
|
+
[Size.Large]: 0.625,
|
|
23
|
+
[Size.XLarge]: 0.6875,
|
|
24
|
+
[Size.DoubleXLarge]: 0.8125,
|
|
25
|
+
[Size.TripleXLarge]: 0.875,
|
|
26
|
+
[Size.FillWidth]: -1,
|
|
27
|
+
[Size.FillHeight]: -1
|
|
28
|
+
},
|
|
29
|
+
[Shape.Circle]: {
|
|
30
|
+
[Size.Tiny]: 0.1875,
|
|
31
|
+
[Size.Small]: 0.5,
|
|
32
|
+
[Size.MediumSmall]: 0.875,
|
|
33
|
+
[Size.Medium]: 1.0625,
|
|
34
|
+
[Size.MediumLarge]: 1.375,
|
|
35
|
+
[Size.Large]: 1.75,
|
|
36
|
+
[Size.XLarge]: 1.9375,
|
|
37
|
+
[Size.DoubleXLarge]: 2.25,
|
|
38
|
+
[Size.TripleXLarge]: 2.4375,
|
|
39
|
+
[Size.FillWidth]: -1,
|
|
40
|
+
[Size.FillHeight]: -1
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<script lang="ts">
|
|
46
|
+
const {
|
|
47
|
+
icon,
|
|
48
|
+
id,
|
|
49
|
+
border = false,
|
|
50
|
+
shape = Shape.Rectangle,
|
|
51
|
+
label,
|
|
52
|
+
colourSet = ColourSet.Secondary,
|
|
53
|
+
size = Size.Medium,
|
|
54
|
+
paddingSize,
|
|
55
|
+
type = 'button',
|
|
56
|
+
noTabIndex = false,
|
|
57
|
+
disabled,
|
|
58
|
+
backgroundColour,
|
|
59
|
+
hoverBackgroundColour,
|
|
60
|
+
'data-type': dataType,
|
|
61
|
+
onfocus,
|
|
62
|
+
onblur,
|
|
63
|
+
onclick,
|
|
64
|
+
onkeydown: onkeydownProp,
|
|
65
|
+
style = '',
|
|
66
|
+
side
|
|
67
|
+
}: ActionProps = $props();
|
|
68
|
+
|
|
69
|
+
const iconSize: Size = $derived(icon.size ?? size);
|
|
70
|
+
|
|
71
|
+
const pad: string = $derived.by(() => {
|
|
72
|
+
const padSize = paddingSize ?? size;
|
|
73
|
+
return padSize === Size.FillWidth ? '' : `${paddings[shape][padSize]}rem`;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
function onkeydown(e: KeyboardEvent) {
|
|
77
|
+
passthrough(e);
|
|
78
|
+
|
|
79
|
+
if (document.activeElement === e.target) {
|
|
80
|
+
onkeydownProp?.(e);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const tooltipContext = getContext<TooltipContext>(TooltipContext.identifier);
|
|
85
|
+
// const toastContext = getContext<ToastContext>(ToastContext.identifier);
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<button
|
|
89
|
+
{id}
|
|
90
|
+
onmouseenter={(e) => {
|
|
91
|
+
if (label) {
|
|
92
|
+
// TODO test currentTarget here
|
|
93
|
+
const rect = (e.target as HTMLButtonElement).getBoundingClientRect();
|
|
94
|
+
tooltipContext.showTooltip({
|
|
95
|
+
text: label,
|
|
96
|
+
arrow: side ?? Side.Left,
|
|
97
|
+
delay: Delay.Default,
|
|
98
|
+
rect
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}}
|
|
102
|
+
onmouseleave={() => {
|
|
103
|
+
if (label) {
|
|
104
|
+
tooltipContext.hideTooltip(label);
|
|
105
|
+
}
|
|
106
|
+
}}
|
|
107
|
+
tabindex={noTabIndex ? -1 : undefined}
|
|
108
|
+
data-type={dataType}
|
|
109
|
+
style="{pad ? `--pad: ${pad};` : ''} {backgroundColour
|
|
110
|
+
? `--background-colour: ${backgroundColour};`
|
|
111
|
+
: ``} {hoverBackgroundColour
|
|
112
|
+
? `--hover-background-colour: ${hoverBackgroundColour};`
|
|
113
|
+
: ``}{style}"
|
|
114
|
+
class:border
|
|
115
|
+
class:circular={shape === Shape.Circle}
|
|
116
|
+
class:primary={colourSet === ColourSet.Primary}
|
|
117
|
+
class:secondary={colourSet === ColourSet.Secondary}
|
|
118
|
+
class:auxiliary={colourSet === ColourSet.Auxiliary}
|
|
119
|
+
class:info={colourSet === ColourSet.Info}
|
|
120
|
+
class:error={colourSet === ColourSet.Error}
|
|
121
|
+
class:fill-width={size === Size.FillWidth}
|
|
122
|
+
class:fill-height={size === Size.FillHeight}
|
|
123
|
+
{type}
|
|
124
|
+
{disabled}
|
|
125
|
+
{onfocus}
|
|
126
|
+
{onblur}
|
|
127
|
+
{onkeydown}
|
|
128
|
+
onclick={(e) => {
|
|
129
|
+
// toastContext.toast("clicked action")
|
|
130
|
+
if (label) {
|
|
131
|
+
tooltipContext.hideTooltip(label);
|
|
132
|
+
}
|
|
133
|
+
onclick?.(e);
|
|
134
|
+
}}
|
|
135
|
+
aria-label={label}><Icon {...icon} size={iconSize} /></button
|
|
136
|
+
>
|
|
137
|
+
|
|
138
138
|
<style>button {
|
|
139
139
|
color: #3a4952;
|
|
140
140
|
fill: #3a4952;
|
|
@@ -230,4 +230,4 @@ button.circular {
|
|
|
230
230
|
button {
|
|
231
231
|
padding: var(--pad);
|
|
232
232
|
cursor: pointer;
|
|
233
|
-
}</style>
|
|
233
|
+
}</style>
|
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { AlertContext } from '../Contexts/AlertContext.svelte.js';
|
|
5
|
-
import { UntypedInputContext } from '../Contexts/UntypedInputContext.svelte.js';
|
|
6
|
-
import { DATAMatrix } from '../Helpers/Datamatrix.js';
|
|
7
|
-
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
8
|
-
import { getContext, onMount } from 'svelte';
|
|
9
|
-
import DataMatrixIcon from './DataMatrixIcon.svelte';
|
|
10
|
-
import ModalExplanation from './Touch/ModalExplanation.svelte';
|
|
11
|
-
|
|
12
|
-
let dialog: HTMLDialogElement | undefined;
|
|
13
|
-
|
|
14
|
-
const alertContext = getContext<AlertContext>(AlertContext.identifier);
|
|
15
|
-
|
|
16
|
-
$effect(() => {
|
|
17
|
-
if (dialog) {
|
|
18
|
-
if (alertContext.showModal) {
|
|
19
|
-
dialog.showModal();
|
|
20
|
-
} else {
|
|
21
|
-
dialog.close();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const yesIcon = DATAMatrix('[YES]');
|
|
27
|
-
|
|
28
|
-
const { registerListener } = getContext<UntypedInputContext>(UntypedInputContext.identifier);
|
|
29
|
-
onMount(() =>
|
|
30
|
-
registerListener((value) => {
|
|
31
|
-
switch (value) {
|
|
32
|
-
case '[YES]': {
|
|
33
|
-
alertContext.onYes();
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
case '[NO]': {
|
|
37
|
-
alertContext.onNo();
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
case '[OTHER]': {
|
|
41
|
-
alertContext.onOther();
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
default: {
|
|
45
|
-
console.warn(`Uncaught command \`${value}\``);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return true;
|
|
50
|
-
})
|
|
51
|
-
);
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<!-- onclose={() => (alertContext.showModal = false)} -->
|
|
55
|
-
<dialog
|
|
56
|
-
bind:this={dialog}
|
|
57
|
-
onclose={() => {
|
|
58
|
-
alertContext.onNo();
|
|
59
|
-
}}
|
|
60
|
-
onclick={(e) => {
|
|
61
|
-
if (e.target === dialog) {
|
|
62
|
-
if (!alertContext.mandatory) {
|
|
63
|
-
dialog.close();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<div class="modal-root">
|
|
69
|
-
<h3 class="modal-heading">{alertContext.header}</h3>
|
|
70
|
-
|
|
71
|
-
<!-- <div class="modal-main pre-line">{$body}</div> -->
|
|
72
|
-
<div class="modal-main pre-line"><ModalExplanation>{alertContext.body}</ModalExplanation></div>
|
|
73
|
-
|
|
74
|
-
{#if alertContext.footer}
|
|
75
|
-
<!-- TODO either remove this part and make buttons the "footer", or allow consumer to pass an element -->
|
|
76
|
-
<span>{alertContext.footer}</span>
|
|
77
|
-
{/if}
|
|
78
|
-
|
|
79
|
-
<div class="modal-footer actions">
|
|
80
|
-
<div class="button-barcode-set">
|
|
81
|
-
<DataMatrixIcon
|
|
82
|
-
title="Yes"
|
|
83
|
-
icon={yesIcon}
|
|
84
|
-
/>
|
|
85
|
-
<button
|
|
86
|
-
type="submit"
|
|
87
|
-
onkeydown={passthrough}
|
|
88
|
-
onclick={alertContext.onYes}>{alertContext.yesLabel}</button
|
|
89
|
-
>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
{#if alertContext.otherLabel}
|
|
93
|
-
{@const otherIcon = DATAMatrix('[OTHER]')}
|
|
94
|
-
<div class="button-barcode-set">
|
|
95
|
-
<DataMatrixIcon
|
|
96
|
-
title="Other"
|
|
97
|
-
icon={otherIcon}
|
|
98
|
-
/>
|
|
99
|
-
<button
|
|
100
|
-
type="button"
|
|
101
|
-
onkeydown={passthrough}
|
|
102
|
-
onclick={alertContext.onOther}>{alertContext.otherLabel}</button
|
|
103
|
-
>
|
|
104
|
-
</div>
|
|
105
|
-
{/if}
|
|
106
|
-
|
|
107
|
-
{#if alertContext.noLabel}
|
|
108
|
-
{@const noIcon = DATAMatrix('[NO]')}
|
|
109
|
-
<div class="button-barcode-set">
|
|
110
|
-
<DataMatrixIcon
|
|
111
|
-
title="No"
|
|
112
|
-
icon={noIcon}
|
|
113
|
-
/>
|
|
114
|
-
<button
|
|
115
|
-
type="button"
|
|
116
|
-
onkeydown={passthrough}
|
|
117
|
-
onclick={alertContext.onNo}>{alertContext.noLabel}</button
|
|
118
|
-
>
|
|
119
|
-
</div>
|
|
120
|
-
{/if}
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</dialog>
|
|
124
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import { AlertContext } from '../Contexts/AlertContext.svelte.js';
|
|
5
|
+
import { UntypedInputContext } from '../Contexts/UntypedInputContext.svelte.js';
|
|
6
|
+
import { DATAMatrix } from '../Helpers/Datamatrix.js';
|
|
7
|
+
import { passthrough } from '../Helpers/Helpers.svelte.js';
|
|
8
|
+
import { getContext, onMount } from 'svelte';
|
|
9
|
+
import DataMatrixIcon from './DataMatrixIcon.svelte';
|
|
10
|
+
import ModalExplanation from './Touch/ModalExplanation.svelte';
|
|
11
|
+
|
|
12
|
+
let dialog: HTMLDialogElement | undefined;
|
|
13
|
+
|
|
14
|
+
const alertContext = getContext<AlertContext>(AlertContext.identifier);
|
|
15
|
+
|
|
16
|
+
$effect(() => {
|
|
17
|
+
if (dialog) {
|
|
18
|
+
if (alertContext.showModal) {
|
|
19
|
+
dialog.showModal();
|
|
20
|
+
} else {
|
|
21
|
+
dialog.close();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const yesIcon = DATAMatrix('[YES]');
|
|
27
|
+
|
|
28
|
+
const { registerListener } = getContext<UntypedInputContext>(UntypedInputContext.identifier);
|
|
29
|
+
onMount(() =>
|
|
30
|
+
registerListener((value) => {
|
|
31
|
+
switch (value) {
|
|
32
|
+
case '[YES]': {
|
|
33
|
+
alertContext.onYes();
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case '[NO]': {
|
|
37
|
+
alertContext.onNo();
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case '[OTHER]': {
|
|
41
|
+
alertContext.onOther();
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
default: {
|
|
45
|
+
console.warn(`Uncaught command \`${value}\``);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return true;
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<!-- onclose={() => (alertContext.showModal = false)} -->
|
|
55
|
+
<dialog
|
|
56
|
+
bind:this={dialog}
|
|
57
|
+
onclose={() => {
|
|
58
|
+
alertContext.onNo();
|
|
59
|
+
}}
|
|
60
|
+
onclick={(e) => {
|
|
61
|
+
if (e.target === dialog) {
|
|
62
|
+
if (!alertContext.mandatory) {
|
|
63
|
+
dialog.close();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<div class="modal-root">
|
|
69
|
+
<h3 class="modal-heading">{alertContext.header}</h3>
|
|
70
|
+
|
|
71
|
+
<!-- <div class="modal-main pre-line">{$body}</div> -->
|
|
72
|
+
<div class="modal-main pre-line"><ModalExplanation>{alertContext.body}</ModalExplanation></div>
|
|
73
|
+
|
|
74
|
+
{#if alertContext.footer}
|
|
75
|
+
<!-- TODO either remove this part and make buttons the "footer", or allow consumer to pass an element -->
|
|
76
|
+
<span>{alertContext.footer}</span>
|
|
77
|
+
{/if}
|
|
78
|
+
|
|
79
|
+
<div class="modal-footer actions">
|
|
80
|
+
<div class="button-barcode-set">
|
|
81
|
+
<DataMatrixIcon
|
|
82
|
+
title="Yes"
|
|
83
|
+
icon={yesIcon}
|
|
84
|
+
/>
|
|
85
|
+
<button
|
|
86
|
+
type="submit"
|
|
87
|
+
onkeydown={passthrough}
|
|
88
|
+
onclick={alertContext.onYes}>{alertContext.yesLabel}</button
|
|
89
|
+
>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
{#if alertContext.otherLabel}
|
|
93
|
+
{@const otherIcon = DATAMatrix('[OTHER]')}
|
|
94
|
+
<div class="button-barcode-set">
|
|
95
|
+
<DataMatrixIcon
|
|
96
|
+
title="Other"
|
|
97
|
+
icon={otherIcon}
|
|
98
|
+
/>
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
onkeydown={passthrough}
|
|
102
|
+
onclick={alertContext.onOther}>{alertContext.otherLabel}</button
|
|
103
|
+
>
|
|
104
|
+
</div>
|
|
105
|
+
{/if}
|
|
106
|
+
|
|
107
|
+
{#if alertContext.noLabel}
|
|
108
|
+
{@const noIcon = DATAMatrix('[NO]')}
|
|
109
|
+
<div class="button-barcode-set">
|
|
110
|
+
<DataMatrixIcon
|
|
111
|
+
title="No"
|
|
112
|
+
icon={noIcon}
|
|
113
|
+
/>
|
|
114
|
+
<button
|
|
115
|
+
type="button"
|
|
116
|
+
onkeydown={passthrough}
|
|
117
|
+
onclick={alertContext.onNo}>{alertContext.noLabel}</button
|
|
118
|
+
>
|
|
119
|
+
</div>
|
|
120
|
+
{/if}
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</dialog>
|
|
124
|
+
|
|
125
125
|
<style>dialog {
|
|
126
126
|
overflow: clip;
|
|
127
127
|
background-color: #e9ecf1;
|
|
@@ -392,4 +392,4 @@ div.button-barcode-set {
|
|
|
392
392
|
display: flex;
|
|
393
393
|
flex-flow: row nowrap;
|
|
394
394
|
gap: 1.5rem;
|
|
395
|
-
}</style>
|
|
395
|
+
}</style>
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
Sets Contexts expected to exist for internal functionalities:
|
|
4
|
-
Context Menu, Tooltip, Toast, Untyped Input.
|
|
5
|
-
|
|
6
|
-
It is meant to be used in a +page.svelte or a +layout.svelte as early as required.
|
|
7
|
-
|
|
8
|
-
### Usage
|
|
9
|
-
```svelte
|
|
10
|
-
<ContextWrapper>
|
|
11
|
-
{@render children()}
|
|
12
|
-
</ChontextWrapper>
|
|
13
|
-
```
|
|
14
|
-
-->
|
|
15
|
-
<script lang="ts">
|
|
16
|
-
import { AlertContext } from '../../Contexts/AlertContext.svelte.js';
|
|
17
|
-
import { ContextMenuContext } from '../../Contexts/ContextMenuContext.svelte.js';
|
|
18
|
-
import { ToastContext } from '../../Contexts/ToastContext.svelte.js';
|
|
19
|
-
import { TooltipContext } from '../../Contexts/TooltipContext.svelte.js';
|
|
20
|
-
import { UntypedInputContext } from '../../Contexts/UntypedInputContext.svelte.js';
|
|
21
|
-
import { setContext } from 'svelte';
|
|
22
|
-
import AlertModal from '../AlertModal.svelte';
|
|
23
|
-
import ContextMenu from '../Contexts/ContextMenu.svelte';
|
|
24
|
-
import ToastContainer from '../Contexts/ToastContainer.svelte';
|
|
25
|
-
import Tooltip from '../Contexts/Tooltip.svelte';
|
|
26
|
-
import type { ContextWrapperProps } from './ContextWrapperProps.js';
|
|
27
|
-
|
|
28
|
-
const { children, debug = false }: ContextWrapperProps = $props();
|
|
29
|
-
|
|
30
|
-
setContext(ContextMenuContext.identifier, new ContextMenuContext());
|
|
31
|
-
setContext(TooltipContext.identifier, new TooltipContext());
|
|
32
|
-
setContext(ToastContext.identifier, new ToastContext());
|
|
33
|
-
const alertContext = new AlertContext();
|
|
34
|
-
setContext(AlertContext.identifier, alertContext);
|
|
35
|
-
|
|
36
|
-
// NOTE known limitation. Not expected to mutate after instantiation
|
|
37
|
-
// svelte-ignore state_referenced_locally
|
|
38
|
-
const untypedListenerContext = new UntypedInputContext(debug);
|
|
39
|
-
setContext(UntypedInputContext.identifier, untypedListenerContext);
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<ContextMenu />
|
|
43
|
-
<Tooltip />
|
|
44
|
-
<ToastContainer />
|
|
45
|
-
{#if alertContext.showModal}
|
|
46
|
-
<AlertModal />
|
|
47
|
-
{/if}
|
|
48
|
-
<svelte:window onkeydown={untypedListenerContext.handleGlobalKeydown} />
|
|
49
|
-
{@render children()}
|
|
50
|
-
<!-- -->
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Sets Contexts expected to exist for internal functionalities:
|
|
4
|
+
Context Menu, Tooltip, Toast, Untyped Input.
|
|
5
|
+
|
|
6
|
+
It is meant to be used in a +page.svelte or a +layout.svelte as early as required.
|
|
7
|
+
|
|
8
|
+
### Usage
|
|
9
|
+
```svelte
|
|
10
|
+
<ContextWrapper>
|
|
11
|
+
{@render children()}
|
|
12
|
+
</ChontextWrapper>
|
|
13
|
+
```
|
|
14
|
+
-->
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { AlertContext } from '../../Contexts/AlertContext.svelte.js';
|
|
17
|
+
import { ContextMenuContext } from '../../Contexts/ContextMenuContext.svelte.js';
|
|
18
|
+
import { ToastContext } from '../../Contexts/ToastContext.svelte.js';
|
|
19
|
+
import { TooltipContext } from '../../Contexts/TooltipContext.svelte.js';
|
|
20
|
+
import { UntypedInputContext } from '../../Contexts/UntypedInputContext.svelte.js';
|
|
21
|
+
import { setContext } from 'svelte';
|
|
22
|
+
import AlertModal from '../AlertModal.svelte';
|
|
23
|
+
import ContextMenu from '../Contexts/ContextMenu.svelte';
|
|
24
|
+
import ToastContainer from '../Contexts/ToastContainer.svelte';
|
|
25
|
+
import Tooltip from '../Contexts/Tooltip.svelte';
|
|
26
|
+
import type { ContextWrapperProps } from './ContextWrapperProps.js';
|
|
27
|
+
|
|
28
|
+
const { children, debug = false }: ContextWrapperProps = $props();
|
|
29
|
+
|
|
30
|
+
setContext(ContextMenuContext.identifier, new ContextMenuContext());
|
|
31
|
+
setContext(TooltipContext.identifier, new TooltipContext());
|
|
32
|
+
setContext(ToastContext.identifier, new ToastContext());
|
|
33
|
+
const alertContext = new AlertContext();
|
|
34
|
+
setContext(AlertContext.identifier, alertContext);
|
|
35
|
+
|
|
36
|
+
// NOTE known limitation. Not expected to mutate after instantiation
|
|
37
|
+
// svelte-ignore state_referenced_locally
|
|
38
|
+
const untypedListenerContext = new UntypedInputContext(debug);
|
|
39
|
+
setContext(UntypedInputContext.identifier, untypedListenerContext);
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<ContextMenu />
|
|
43
|
+
<Tooltip />
|
|
44
|
+
<ToastContainer />
|
|
45
|
+
{#if alertContext.showModal}
|
|
46
|
+
<AlertModal />
|
|
47
|
+
{/if}
|
|
48
|
+
<svelte:window onkeydown={untypedListenerContext.handleGlobalKeydown} />
|
|
49
|
+
{@render children()}
|
|
50
|
+
<!-- -->
|