@lavalogic/scoria 0.40.13 → 0.40.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -58
- package/dist/Components/AccordionGroup.svelte +35 -46
- package/dist/Components/AccordionGroupButton.svelte +68 -76
- package/dist/Components/Action.svelte +103 -135
- package/dist/Components/AlertModal.svelte +171 -190
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +614 -697
- package/dist/Components/Base/BaseModal.svelte +90 -116
- package/dist/Components/Base/ContextWrapper.svelte +67 -72
- package/dist/Components/Base/Pagination.svelte +173 -196
- package/dist/Components/Base/Snippets.svelte +34 -36
- package/dist/Components/BigRadioSet.svelte +36 -38
- package/dist/Components/Bubble.svelte +78 -101
- package/dist/Components/Button.svelte +175 -208
- package/dist/Components/Checkbox.svelte +75 -86
- package/dist/Components/CollapsibleCard.svelte +72 -87
- package/dist/Components/CollapsibleMenuGroup.svelte +53 -57
- package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +39 -64
- package/dist/Components/Contexts/ContextMenu.svelte +141 -156
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +53 -60
- package/dist/Components/Contexts/Toast.svelte +81 -86
- package/dist/Components/Contexts/ToastContainer.svelte +58 -62
- package/dist/Components/Contexts/Tooltip.svelte +36 -37
- package/dist/Components/DataMatrixIcon.svelte +95 -108
- package/dist/Components/DateInput.svelte +118 -146
- package/dist/Components/DatePicker.svelte +255 -294
- package/dist/Components/DesktopModal.svelte +70 -90
- package/dist/Components/Dial.svelte +167 -197
- package/dist/Components/DimensionInput.svelte +124 -169
- package/dist/Components/DragMenu/DragMenuHolder.svelte +98 -114
- package/dist/Components/DragMenu/DraggableCard.svelte +64 -76
- package/dist/Components/FileCard.svelte +21 -24
- package/dist/Components/FileUpload.svelte +190 -225
- package/dist/Components/GridInput.svelte +159 -196
- package/dist/Components/GridInputSet.svelte +24 -29
- package/dist/Components/HorizontalTabGroup.svelte +73 -89
- package/dist/Components/HorizontalTabGroupButton.svelte +40 -44
- package/dist/Components/Icon.svelte +99 -128
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/InfoAlert.svelte +35 -38
- package/dist/Components/LoadingAnimation.svelte +691 -755
- package/dist/Components/LoadingModal.svelte +36 -44
- package/dist/Components/LoadingOverlay.svelte +22 -26
- package/dist/Components/Modal.svelte +204 -254
- package/dist/Components/MultiSelect.svelte +186 -216
- package/dist/Components/Nav/Nav.svelte +94 -110
- package/dist/Components/Nav/NavServiceMenuList.svelte +57 -61
- package/dist/Components/Nav/NavTab.svelte +58 -62
- package/dist/Components/Nav/ServiceMenuItem.svelte +103 -111
- package/dist/Components/Nav/ServicesNav.svelte +72 -79
- package/dist/Components/NumberInput.svelte +121 -155
- package/dist/Components/OptionCards.svelte +62 -73
- package/dist/Components/PageHeading.svelte +23 -25
- package/dist/Components/PasswordInput.svelte +69 -88
- package/dist/Components/PopoverButton.svelte +151 -0
- package/dist/Components/PopoverButton.svelte.d.ts +9 -0
- package/dist/Components/PopoverButtonProps.d.ts +21 -0
- package/dist/Components/PopoverButtonProps.js +1 -0
- package/dist/Components/Portal.svelte +29 -35
- package/dist/Components/ProgressBubble.svelte +91 -106
- package/dist/Components/QuerySelect.svelte +260 -346
- package/dist/Components/SidebarPanel.svelte +34 -36
- package/dist/Components/SingleSelect.svelte +196 -244
- package/dist/Components/StepButton.svelte +65 -70
- package/dist/Components/StepForm.svelte +115 -135
- package/dist/Components/Switch.svelte +57 -69
- package/dist/Components/Table/ARCHITECTURE.md +298 -298
- package/dist/Components/Table/Body/QuickSearchCell.svelte +578 -655
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +42 -51
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +42 -58
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +403 -442
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +51 -78
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +165 -184
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +110 -123
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +134 -160
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +190 -231
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +82 -104
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +52 -87
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +122 -150
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +132 -159
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +190 -236
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +173 -211
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +204 -244
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +140 -177
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +188 -217
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +173 -193
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +166 -187
- package/dist/Components/Table/Body/Rows/TableRow.svelte +245 -288
- package/dist/Components/Table/Body/TableBody.svelte +141 -154
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +35 -41
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +24 -30
- package/dist/Components/Table/Headers/TableHead.svelte +348 -402
- package/dist/Components/Table/Misc/ColumnPanel.svelte +37 -39
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +35 -39
- package/dist/Components/Table/Misc/FilterInput.svelte +556 -619
- package/dist/Components/Table/Misc/FilterPanel.svelte +170 -183
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +25 -31
- package/dist/Components/Table/Misc/ShareViewModal.svelte +252 -281
- package/dist/Components/Table/Misc/SidePanel.svelte +32 -35
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +574 -629
- package/dist/Components/Table/Misc/TableFooter.svelte +326 -332
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +134 -140
- package/dist/Components/Table/Misc/TableSidebar.svelte +183 -198
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +83 -103
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +83 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +88 -107
- package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +163 -190
- package/dist/Components/Table/NestedTable.svelte +102 -128
- package/dist/Components/Table/Table.svelte +531 -663
- package/dist/Components/Test/TestContextConsumer.svelte +11 -13
- package/dist/Components/TextArea.svelte +95 -130
- package/dist/Components/TextInput.svelte +125 -176
- package/dist/Components/ThreeStateRadio.svelte +111 -130
- package/dist/Components/Touch/BoolCard.svelte +33 -45
- package/dist/Components/Touch/DateModal.svelte +164 -204
- package/dist/Components/Touch/EditCard.svelte +48 -59
- package/dist/Components/Touch/InfoCard.svelte +28 -31
- package/dist/Components/Touch/InfoTextCard.svelte +26 -28
- package/dist/Components/Touch/ModalExplanation.svelte +15 -17
- package/dist/Components/Touch/NumberKeyboard.svelte +181 -218
- package/dist/Components/Touch/NumberModal.svelte +59 -79
- package/dist/Components/Touch/PlusMinusCard.svelte +43 -46
- package/dist/Components/Touch/SelectModal.svelte +111 -126
- package/dist/Components/Touch/SummaryCard.svelte +80 -93
- package/dist/Components/Touch/TextAreaModal.svelte +72 -94
- package/dist/Components/Touch/TextModal.svelte +77 -105
- package/dist/Components/Touch/TouchCard.svelte +31 -33
- package/dist/Components/Touch/TouchModal.svelte +214 -270
- package/dist/Components/Touch/UtilityButton.svelte +88 -109
- package/dist/Components/VerticalTabGroup.svelte +60 -78
- package/dist/Components/VerticalTabGroupButton.svelte +54 -58
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Types/Examples/ExampleModal.svelte +31 -35
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3392 -3392
- package/dist/scss/_motion.scss +57 -57
- package/dist/scss/_sizing.scss +85 -85
- package/dist/scss/_transitions.scss +8 -8
- package/package.json +1 -1
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
<p>
|
|
12
|
-
<h2>counter 2: {testContext.value2.value}</h2>
|
|
13
|
-
<p>ref wrapper 2 adds ref wrapper 1's value every time ref wrapper 1's value is divisible by 3</p>
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { TestContext } from "../../Contexts/TestContext.svelte.js";
|
|
4
|
+
import { getContext } from "svelte";
|
|
5
|
+
const testContext = getContext(TestContext.identifier);
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<h1>counter 1: {testContext.value1.value}</h1>
|
|
9
|
+
<p>Ref wrapper 1 is incremented every time you click the button</p>
|
|
10
|
+
<h2>counter 2: {testContext.value2.value}</h2>
|
|
11
|
+
<p>ref wrapper 2 adds ref wrapper 1's value every time ref wrapper 1's value is divisible by 3</p>
|
|
@@ -1,132 +1,97 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class=
|
|
53
|
-
class:
|
|
54
|
-
class:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
aria-invalid={isInvalid || undefined}
|
|
96
|
-
bind:value
|
|
97
|
-
{onblur}
|
|
98
|
-
{onfocus}
|
|
99
|
-
{onkeydown}
|
|
100
|
-
{oninput}
|
|
101
|
-
{rows}
|
|
102
|
-
bind:this={textAreaRef}
|
|
103
|
-
{placeholder}
|
|
104
|
-
{required}
|
|
105
|
-
{disabled}
|
|
106
|
-
></textarea>
|
|
107
|
-
{#if rightIcon}
|
|
108
|
-
<Icon
|
|
109
|
-
name={rightIcon.name}
|
|
110
|
-
size={rightIcon.size ?? Size.Medium}
|
|
111
|
-
colour={rightIcon.colour}
|
|
112
|
-
float
|
|
113
|
-
right={cssLength(variant == InputVariant.Modal ? '1rem' : '0.5rem')}
|
|
114
|
-
top={cssLength('50%')}
|
|
115
|
-
anchorX={cssLength('0')}
|
|
116
|
-
anchorY={cssLength('-50%')}
|
|
117
|
-
clickable={!!onRightIconClick}
|
|
118
|
-
onclick={onRightIconClick}
|
|
119
|
-
/>
|
|
120
|
-
{/if}
|
|
121
|
-
{#if labelRight}
|
|
122
|
-
<span
|
|
123
|
-
class="right-label"
|
|
124
|
-
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
125
|
-
>
|
|
126
|
-
{/if}
|
|
127
|
-
</div>
|
|
128
|
-
</label>
|
|
129
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { cssLength } from "../Helpers/Helpers.svelte.js";
|
|
4
|
+
import { InputVariant } from "../Types/Internal/InputVariant.js";
|
|
5
|
+
import { Size } from "../Types/Internal/Size.js";
|
|
6
|
+
import Icon from "./Icon.svelte";
|
|
7
|
+
let { value = $bindable(""), labelTop, labelRight, placeholder, maxWidth = false, required = false, variant = InputVariant.Default, selectNone = false, noresize = false, uppercase = false, disabled, invalid = false, showErrorColours = true, optional = false, leftIcon, rightIcon, onLeftIconClick, onRightIconClick, rows = 4, textAreaRef = $bindable(), autocomplete, spellcheck, onblur, onfocus, onkeydown, oninput } = $props();
|
|
8
|
+
const isInvalid = $derived(showErrorColours && (required && value.trim() === "" || invalid));
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<label
|
|
12
|
+
class:for-modal={variant === InputVariant.Modal}
|
|
13
|
+
class:max-width={maxWidth}
|
|
14
|
+
>
|
|
15
|
+
{#if labelTop && variant !== InputVariant.Modal}
|
|
16
|
+
<span
|
|
17
|
+
class="top-label"
|
|
18
|
+
class:for-default={variant === InputVariant.Default}
|
|
19
|
+
class:invalid={isInvalid}
|
|
20
|
+
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
21
|
+
>
|
|
22
|
+
{#if variant === InputVariant.Default}
|
|
23
|
+
<span
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
class="border"
|
|
26
|
+
class:invalid={isInvalid}
|
|
27
|
+
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
28
|
+
>
|
|
29
|
+
{/if}
|
|
30
|
+
{/if}
|
|
31
|
+
<div
|
|
32
|
+
class="icon-container"
|
|
33
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
34
|
+
>
|
|
35
|
+
{#if leftIcon}
|
|
36
|
+
<Icon
|
|
37
|
+
name={leftIcon.name}
|
|
38
|
+
size={leftIcon.size ?? Size.Medium}
|
|
39
|
+
colour={leftIcon.colour}
|
|
40
|
+
float
|
|
41
|
+
left={cssLength('0.75rem')}
|
|
42
|
+
top={cssLength('50%')}
|
|
43
|
+
anchorX={cssLength('0')}
|
|
44
|
+
anchorY={cssLength('-50%')}
|
|
45
|
+
clickable={!!onLeftIconClick}
|
|
46
|
+
onclick={onLeftIconClick}
|
|
47
|
+
/>
|
|
48
|
+
{/if}
|
|
49
|
+
<textarea
|
|
50
|
+
class:noresize
|
|
51
|
+
class:uppercase
|
|
52
|
+
class:invalid={isInvalid}
|
|
53
|
+
class:select-none={selectNone}
|
|
54
|
+
class:left-pad={leftIcon != undefined}
|
|
55
|
+
class:right-pad={rightIcon != undefined}
|
|
56
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
57
|
+
class:max-width={maxWidth}
|
|
58
|
+
autocomplete={autocomplete ?? 'off'}
|
|
59
|
+
spellcheck={spellcheck ?? true}
|
|
60
|
+
aria-invalid={isInvalid || undefined}
|
|
61
|
+
bind:value
|
|
62
|
+
{onblur}
|
|
63
|
+
{onfocus}
|
|
64
|
+
{onkeydown}
|
|
65
|
+
{oninput}
|
|
66
|
+
{rows}
|
|
67
|
+
bind:this={textAreaRef}
|
|
68
|
+
{placeholder}
|
|
69
|
+
{required}
|
|
70
|
+
{disabled}
|
|
71
|
+
></textarea>
|
|
72
|
+
{#if rightIcon}
|
|
73
|
+
<Icon
|
|
74
|
+
name={rightIcon.name}
|
|
75
|
+
size={rightIcon.size ?? Size.Medium}
|
|
76
|
+
colour={rightIcon.colour}
|
|
77
|
+
float
|
|
78
|
+
right={cssLength(variant == InputVariant.Modal ? '1rem' : '0.5rem')}
|
|
79
|
+
top={cssLength('50%')}
|
|
80
|
+
anchorX={cssLength('0')}
|
|
81
|
+
anchorY={cssLength('-50%')}
|
|
82
|
+
clickable={!!onRightIconClick}
|
|
83
|
+
onclick={onRightIconClick}
|
|
84
|
+
/>
|
|
85
|
+
{/if}
|
|
86
|
+
{#if labelRight}
|
|
87
|
+
<span
|
|
88
|
+
class="right-label"
|
|
89
|
+
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
90
|
+
>
|
|
91
|
+
{/if}
|
|
92
|
+
</div>
|
|
93
|
+
</label>
|
|
94
|
+
|
|
130
95
|
<style>textarea {
|
|
131
96
|
box-sizing: border-box;
|
|
132
97
|
height: 100%;
|
|
@@ -340,4 +305,4 @@ span.border.invalid {
|
|
|
340
305
|
.textarea-error-wrapper.for-modal {
|
|
341
306
|
position: relative;
|
|
342
307
|
height: 100%;
|
|
343
|
-
}</style>
|
|
308
|
+
}</style>
|
|
@@ -1,178 +1,127 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
variant
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
126
|
-
data-type={dataType}
|
|
127
|
-
type={type ?? 'text'}
|
|
128
|
-
autocomplete={autocomplete ?? (type === 'email' ? 'email' : 'off')}
|
|
129
|
-
spellcheck={spellcheck ?? false}
|
|
130
|
-
aria-invalid={isInvalid || undefined}
|
|
131
|
-
bind:value
|
|
132
|
-
{onblur}
|
|
133
|
-
{onfocus}
|
|
134
|
-
{onkeydown}
|
|
135
|
-
{oninput}
|
|
136
|
-
bind:this={inputRef}
|
|
137
|
-
{placeholder}
|
|
138
|
-
{required}
|
|
139
|
-
{disabled}
|
|
140
|
-
/>
|
|
141
|
-
{#if rightIcon}
|
|
142
|
-
<div class="right-icon">
|
|
143
|
-
{#if onRightIconClick}
|
|
144
|
-
<Action
|
|
145
|
-
noTabIndex
|
|
146
|
-
colourSet={ColourSet.Auxiliary}
|
|
147
|
-
disabled={rightIconDisabled}
|
|
148
|
-
icon={rightIcon}
|
|
149
|
-
size={Size.Medium}
|
|
150
|
-
onclick={onRightIconClick}
|
|
151
|
-
/>
|
|
152
|
-
{:else}
|
|
153
|
-
<Icon
|
|
154
|
-
name={rightIcon.name}
|
|
155
|
-
size={rightIcon.size ?? Size.Medium}
|
|
156
|
-
colour={rightIcon.colour ?? Colour['$font-disabled']}
|
|
157
|
-
float
|
|
158
|
-
right={cssLength(variant == InputVariant.Modal ? '1rem' : '0.5rem')}
|
|
159
|
-
top={cssLength('50%')}
|
|
160
|
-
anchorX={cssLength('0')}
|
|
161
|
-
anchorY={cssLength('-50%')}
|
|
162
|
-
/>
|
|
163
|
-
{/if}
|
|
164
|
-
</div>
|
|
165
|
-
{/if}
|
|
166
|
-
{#if labelRight}
|
|
167
|
-
<span
|
|
168
|
-
class="right-label"
|
|
169
|
-
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
170
|
-
>
|
|
171
|
-
{/if}
|
|
172
|
-
</div>
|
|
173
|
-
</label>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { cssLength, isValidEmailAddress } from "../Helpers/Helpers.svelte.js";
|
|
4
|
+
import { Colour, ColourSet } from "../scss/colours.js";
|
|
5
|
+
import { InputVariant } from "../Types/Internal/InputVariant.js";
|
|
6
|
+
import { Size } from "../Types/Internal/Size.js";
|
|
7
|
+
import Action from "./Action.svelte";
|
|
8
|
+
import Icon from "./Icon.svelte";
|
|
9
|
+
let { id, value = $bindable(""), labelTop, optional, labelRight, placeholder, required = false, variant = InputVariant.Default, selectNone = false, uppercase = false, disabled = false, invalid = false, showErrorColours = true, rightIconDisabled = false, leftIcon, rightIcon, type, onLeftIconClick, onRightIconClick, inputRef = $bindable(), "data-type": dataType, autocomplete, spellcheck, onblur, onfocus, onkeydown, oninput } = $props();
|
|
10
|
+
const isInvalid = $derived(showErrorColours && !disabled && (required && (!value?.trim() || type == "email" && value.length >= 3 && value.includes("@") && !isValidEmailAddress(value)) || invalid));
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class="error-wrapper"
|
|
15
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
16
|
+
class:for-table={variant == InputVariant.Table}
|
|
17
|
+
>
|
|
18
|
+
<label
|
|
19
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
20
|
+
class:for-table={variant == InputVariant.Table}
|
|
21
|
+
>
|
|
22
|
+
{#if labelTop}
|
|
23
|
+
<span
|
|
24
|
+
class="top-label"
|
|
25
|
+
class:for-default={variant === InputVariant.Default}
|
|
26
|
+
class:invalid={isInvalid}
|
|
27
|
+
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
28
|
+
>
|
|
29
|
+
{#if variant === InputVariant.Default}
|
|
30
|
+
<span
|
|
31
|
+
aria-hidden="true"
|
|
32
|
+
class="border"
|
|
33
|
+
class:invalid={isInvalid}
|
|
34
|
+
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
35
|
+
>
|
|
36
|
+
{/if}
|
|
37
|
+
{/if}
|
|
38
|
+
<div
|
|
39
|
+
class="icon-container"
|
|
40
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
41
|
+
>
|
|
42
|
+
{#if leftIcon}
|
|
43
|
+
{#if onLeftIconClick}
|
|
44
|
+
<div class="left-icon">
|
|
45
|
+
<Action
|
|
46
|
+
noTabIndex
|
|
47
|
+
colourSet={ColourSet.Auxiliary}
|
|
48
|
+
icon={leftIcon}
|
|
49
|
+
size={Size.Medium}
|
|
50
|
+
onclick={onLeftIconClick}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
{:else}
|
|
54
|
+
<Icon
|
|
55
|
+
name={leftIcon.name}
|
|
56
|
+
size={leftIcon.size ?? Size.Medium}
|
|
57
|
+
colour={leftIcon.colour}
|
|
58
|
+
float
|
|
59
|
+
left={cssLength('0.75rem')}
|
|
60
|
+
top={cssLength('50%')}
|
|
61
|
+
anchorX={cssLength('0')}
|
|
62
|
+
anchorY={cssLength('-50%')}
|
|
63
|
+
/>
|
|
64
|
+
{/if}
|
|
65
|
+
{/if}
|
|
66
|
+
<input
|
|
67
|
+
{id}
|
|
68
|
+
class:for-default={variant === InputVariant.Default}
|
|
69
|
+
class:uppercase
|
|
70
|
+
class:invalid={isInvalid}
|
|
71
|
+
class:select-none={selectNone}
|
|
72
|
+
class:left-pad={leftIcon != undefined}
|
|
73
|
+
class:right-pad={rightIcon != undefined}
|
|
74
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
75
|
+
data-type={dataType}
|
|
76
|
+
type={type ?? 'text'}
|
|
77
|
+
autocomplete={autocomplete ?? (type === 'email' ? 'email' : 'off')}
|
|
78
|
+
spellcheck={spellcheck ?? false}
|
|
79
|
+
aria-invalid={isInvalid || undefined}
|
|
80
|
+
bind:value
|
|
81
|
+
{onblur}
|
|
82
|
+
{onfocus}
|
|
83
|
+
{onkeydown}
|
|
84
|
+
{oninput}
|
|
85
|
+
bind:this={inputRef}
|
|
86
|
+
{placeholder}
|
|
87
|
+
{required}
|
|
88
|
+
{disabled}
|
|
89
|
+
/>
|
|
90
|
+
{#if rightIcon}
|
|
91
|
+
<div class="right-icon">
|
|
92
|
+
{#if onRightIconClick}
|
|
93
|
+
<Action
|
|
94
|
+
noTabIndex
|
|
95
|
+
colourSet={ColourSet.Auxiliary}
|
|
96
|
+
disabled={rightIconDisabled}
|
|
97
|
+
icon={rightIcon}
|
|
98
|
+
size={Size.Medium}
|
|
99
|
+
onclick={onRightIconClick}
|
|
100
|
+
/>
|
|
101
|
+
{:else}
|
|
102
|
+
<Icon
|
|
103
|
+
name={rightIcon.name}
|
|
104
|
+
size={rightIcon.size ?? Size.Medium}
|
|
105
|
+
colour={rightIcon.colour ?? Colour['$font-disabled']}
|
|
106
|
+
float
|
|
107
|
+
right={cssLength(variant == InputVariant.Modal ? '1rem' : '0.5rem')}
|
|
108
|
+
top={cssLength('50%')}
|
|
109
|
+
anchorX={cssLength('0')}
|
|
110
|
+
anchorY={cssLength('-50%')}
|
|
111
|
+
/>
|
|
112
|
+
{/if}
|
|
113
|
+
</div>
|
|
114
|
+
{/if}
|
|
115
|
+
{#if labelRight}
|
|
116
|
+
<span
|
|
117
|
+
class="right-label"
|
|
118
|
+
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
119
|
+
>
|
|
120
|
+
{/if}
|
|
121
|
+
</div>
|
|
122
|
+
</label>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
176
125
|
<style>input {
|
|
177
126
|
box-sizing: border-box;
|
|
178
127
|
height: 100%;
|
|
@@ -406,4 +355,4 @@ label.for-table input {
|
|
|
406
355
|
|
|
407
356
|
td {
|
|
408
357
|
--input-border: none;
|
|
409
|
-
}</style>
|
|
358
|
+
}</style>
|