@lavalogic/scoria 0.33.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 +44 -63
- package/dist/Components/AccordionGroup.svelte.d.ts +2 -25
- package/dist/Components/AccordionGroupButton.svelte +106 -114
- package/dist/Components/AccordionGroupButton.svelte.d.ts +2 -2
- package/dist/Components/AccordionGroupButtonProps.d.ts +21 -0
- package/dist/Components/AccordionGroupButtonProps.js +1 -0
- 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/index.d.ts +1 -0
- 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,13 +1,13 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { TestContext } from '../../Contexts/TestContext.svelte.js';
|
|
5
|
-
import { getContext } from 'svelte';
|
|
6
|
-
|
|
7
|
-
const testContext = getContext<TestContext>(TestContext.identifier);
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<h1>counter 1: {testContext.value1.value}</h1>
|
|
11
|
-
<p>Ref wrapper 1 is incremented every time you click the button</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">
|
|
4
|
+
import { TestContext } from '../../Contexts/TestContext.svelte.js';
|
|
5
|
+
import { getContext } from 'svelte';
|
|
6
|
+
|
|
7
|
+
const testContext = getContext<TestContext>(TestContext.identifier);
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<h1>counter 1: {testContext.value1.value}</h1>
|
|
11
|
+
<p>Ref wrapper 1 is incremented every time you click the button</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,110 +1,110 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { InputVariant } from '../Types/Internal/InputVariant.js';
|
|
5
|
-
import { Size } from '../Types/Internal/Size.js';
|
|
6
|
-
import Icon from './Icon.svelte';
|
|
7
|
-
import type { TextAreaProps } from './TextAreaProps.js';
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
value = $bindable(''),
|
|
11
|
-
labelTop,
|
|
12
|
-
labelRight,
|
|
13
|
-
placeholder,
|
|
14
|
-
maxWidth = false,
|
|
15
|
-
required = false,
|
|
16
|
-
variant = InputVariant.Default,
|
|
17
|
-
selectNone = false,
|
|
18
|
-
noresize = false,
|
|
19
|
-
uppercase = false,
|
|
20
|
-
disabled,
|
|
21
|
-
invalid = false,
|
|
22
|
-
showErrorColours = false,
|
|
23
|
-
optional = false,
|
|
24
|
-
leftIcon,
|
|
25
|
-
rightIcon,
|
|
26
|
-
onLeftIconClick,
|
|
27
|
-
onRightIconClick,
|
|
28
|
-
rows = 4,
|
|
29
|
-
|
|
30
|
-
textAreaRef = $bindable(),
|
|
31
|
-
onblur,
|
|
32
|
-
onfocus
|
|
33
|
-
}: TextAreaProps = $props();
|
|
34
|
-
|
|
35
|
-
let isInvalid = $derived(showErrorColours && ((required && value.trim() === '') || invalid));
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<label class:for-modal={variant === InputVariant.Modal} class:max-width={maxWidth}>
|
|
39
|
-
<!-- HACK removed label for modals for now because I couldn't think of a decent style that doesn't interfere with scrolling -->
|
|
40
|
-
{#if labelTop && variant !== InputVariant.Modal}
|
|
41
|
-
<!-- <span class="top-label" class:invalid={isInvalid}>{labelTop}{#if optional}<i> - optional</i>{/if}</span> -->
|
|
42
|
-
<span
|
|
43
|
-
class="top-label"
|
|
44
|
-
class:for-default={variant === InputVariant.Default}
|
|
45
|
-
class:invalid={isInvalid}
|
|
46
|
-
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
47
|
-
>
|
|
48
|
-
{#if variant === InputVariant.Default}
|
|
49
|
-
<span class="border" class:invalid={isInvalid}
|
|
50
|
-
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
51
|
-
>
|
|
52
|
-
{/if}
|
|
53
|
-
{/if}
|
|
54
|
-
<!-- style="--background-colour: {leftIcon?.backgroundColour ?? rightIcon?.backgroundColour};" -->
|
|
55
|
-
<div class="icon-container" class:for-modal={variant == InputVariant.Modal}>
|
|
56
|
-
{#if leftIcon}
|
|
57
|
-
<Icon
|
|
58
|
-
name={leftIcon.name}
|
|
59
|
-
size={leftIcon.size ?? Size.Medium}
|
|
60
|
-
colour={leftIcon.colour}
|
|
61
|
-
float
|
|
62
|
-
left="0.75rem"
|
|
63
|
-
top="50%"
|
|
64
|
-
anchorX="0"
|
|
65
|
-
anchorY="-50%"
|
|
66
|
-
clickable={!!onLeftIconClick}
|
|
67
|
-
onclick={onLeftIconClick}
|
|
68
|
-
/>
|
|
69
|
-
{/if}
|
|
70
|
-
<textarea
|
|
71
|
-
class:noresize
|
|
72
|
-
class:uppercase
|
|
73
|
-
class:invalid={isInvalid}
|
|
74
|
-
class:select-none={selectNone}
|
|
75
|
-
class:left-pad={leftIcon != undefined}
|
|
76
|
-
class:right-pad={rightIcon != undefined}
|
|
77
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
78
|
-
class:max-width={maxWidth}
|
|
79
|
-
bind:value
|
|
80
|
-
{onblur}
|
|
81
|
-
{onfocus}
|
|
82
|
-
{rows}
|
|
83
|
-
bind:this={textAreaRef}
|
|
84
|
-
{placeholder}
|
|
85
|
-
{required}
|
|
86
|
-
{disabled}
|
|
87
|
-
></textarea>
|
|
88
|
-
{#if rightIcon}
|
|
89
|
-
<Icon
|
|
90
|
-
name={rightIcon.name}
|
|
91
|
-
size={rightIcon.size ?? Size.Medium}
|
|
92
|
-
colour={rightIcon.colour}
|
|
93
|
-
float
|
|
94
|
-
right={variant == InputVariant.Modal ? '1rem' : '0.5rem'}
|
|
95
|
-
top="50%"
|
|
96
|
-
anchorX="0"
|
|
97
|
-
anchorY="-50%"
|
|
98
|
-
clickable={!!onRightIconClick}
|
|
99
|
-
onclick={onRightIconClick}
|
|
100
|
-
/>
|
|
101
|
-
{/if}
|
|
102
|
-
{#if labelRight}
|
|
103
|
-
<span class="right-label" class:for-modal={variant == InputVariant.Modal}>{labelRight}</span>
|
|
104
|
-
{/if}
|
|
105
|
-
</div>
|
|
106
|
-
</label>
|
|
107
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import { InputVariant } from '../Types/Internal/InputVariant.js';
|
|
5
|
+
import { Size } from '../Types/Internal/Size.js';
|
|
6
|
+
import Icon from './Icon.svelte';
|
|
7
|
+
import type { TextAreaProps } from './TextAreaProps.js';
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
value = $bindable(''),
|
|
11
|
+
labelTop,
|
|
12
|
+
labelRight,
|
|
13
|
+
placeholder,
|
|
14
|
+
maxWidth = false,
|
|
15
|
+
required = false,
|
|
16
|
+
variant = InputVariant.Default,
|
|
17
|
+
selectNone = false,
|
|
18
|
+
noresize = false,
|
|
19
|
+
uppercase = false,
|
|
20
|
+
disabled,
|
|
21
|
+
invalid = false,
|
|
22
|
+
showErrorColours = false,
|
|
23
|
+
optional = false,
|
|
24
|
+
leftIcon,
|
|
25
|
+
rightIcon,
|
|
26
|
+
onLeftIconClick,
|
|
27
|
+
onRightIconClick,
|
|
28
|
+
rows = 4,
|
|
29
|
+
|
|
30
|
+
textAreaRef = $bindable(),
|
|
31
|
+
onblur,
|
|
32
|
+
onfocus
|
|
33
|
+
}: TextAreaProps = $props();
|
|
34
|
+
|
|
35
|
+
let isInvalid = $derived(showErrorColours && ((required && value.trim() === '') || invalid));
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<label class:for-modal={variant === InputVariant.Modal} class:max-width={maxWidth}>
|
|
39
|
+
<!-- HACK removed label for modals for now because I couldn't think of a decent style that doesn't interfere with scrolling -->
|
|
40
|
+
{#if labelTop && variant !== InputVariant.Modal}
|
|
41
|
+
<!-- <span class="top-label" class:invalid={isInvalid}>{labelTop}{#if optional}<i> - optional</i>{/if}</span> -->
|
|
42
|
+
<span
|
|
43
|
+
class="top-label"
|
|
44
|
+
class:for-default={variant === InputVariant.Default}
|
|
45
|
+
class:invalid={isInvalid}
|
|
46
|
+
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
47
|
+
>
|
|
48
|
+
{#if variant === InputVariant.Default}
|
|
49
|
+
<span class="border" class:invalid={isInvalid}
|
|
50
|
+
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
51
|
+
>
|
|
52
|
+
{/if}
|
|
53
|
+
{/if}
|
|
54
|
+
<!-- style="--background-colour: {leftIcon?.backgroundColour ?? rightIcon?.backgroundColour};" -->
|
|
55
|
+
<div class="icon-container" class:for-modal={variant == InputVariant.Modal}>
|
|
56
|
+
{#if leftIcon}
|
|
57
|
+
<Icon
|
|
58
|
+
name={leftIcon.name}
|
|
59
|
+
size={leftIcon.size ?? Size.Medium}
|
|
60
|
+
colour={leftIcon.colour}
|
|
61
|
+
float
|
|
62
|
+
left="0.75rem"
|
|
63
|
+
top="50%"
|
|
64
|
+
anchorX="0"
|
|
65
|
+
anchorY="-50%"
|
|
66
|
+
clickable={!!onLeftIconClick}
|
|
67
|
+
onclick={onLeftIconClick}
|
|
68
|
+
/>
|
|
69
|
+
{/if}
|
|
70
|
+
<textarea
|
|
71
|
+
class:noresize
|
|
72
|
+
class:uppercase
|
|
73
|
+
class:invalid={isInvalid}
|
|
74
|
+
class:select-none={selectNone}
|
|
75
|
+
class:left-pad={leftIcon != undefined}
|
|
76
|
+
class:right-pad={rightIcon != undefined}
|
|
77
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
78
|
+
class:max-width={maxWidth}
|
|
79
|
+
bind:value
|
|
80
|
+
{onblur}
|
|
81
|
+
{onfocus}
|
|
82
|
+
{rows}
|
|
83
|
+
bind:this={textAreaRef}
|
|
84
|
+
{placeholder}
|
|
85
|
+
{required}
|
|
86
|
+
{disabled}
|
|
87
|
+
></textarea>
|
|
88
|
+
{#if rightIcon}
|
|
89
|
+
<Icon
|
|
90
|
+
name={rightIcon.name}
|
|
91
|
+
size={rightIcon.size ?? Size.Medium}
|
|
92
|
+
colour={rightIcon.colour}
|
|
93
|
+
float
|
|
94
|
+
right={variant == InputVariant.Modal ? '1rem' : '0.5rem'}
|
|
95
|
+
top="50%"
|
|
96
|
+
anchorX="0"
|
|
97
|
+
anchorY="-50%"
|
|
98
|
+
clickable={!!onRightIconClick}
|
|
99
|
+
onclick={onRightIconClick}
|
|
100
|
+
/>
|
|
101
|
+
{/if}
|
|
102
|
+
{#if labelRight}
|
|
103
|
+
<span class="right-label" class:for-modal={variant == InputVariant.Modal}>{labelRight}</span>
|
|
104
|
+
{/if}
|
|
105
|
+
</div>
|
|
106
|
+
</label>
|
|
107
|
+
|
|
108
108
|
<style>textarea {
|
|
109
109
|
box-sizing: border-box;
|
|
110
110
|
height: 100%;
|
|
@@ -318,4 +318,4 @@ span.border.invalid {
|
|
|
318
318
|
.textarea-error-wrapper.for-modal {
|
|
319
319
|
position: relative;
|
|
320
320
|
height: 100%;
|
|
321
|
-
}</style>
|
|
321
|
+
}</style>
|
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { isValidEmailAddress } from '../Helpers/Helpers.svelte.js';
|
|
5
|
-
import { Colour, ColourSet } from '../scss/colours.js';
|
|
6
|
-
import { InputVariant } from '../Types/Internal/InputVariant.js';
|
|
7
|
-
import { Size } from '../Types/Internal/Size.js';
|
|
8
|
-
import Action from './Action.svelte';
|
|
9
|
-
import Icon from './Icon.svelte';
|
|
10
|
-
import type { TextInputProps } from './TextInputProps.js';
|
|
11
|
-
let {
|
|
12
|
-
id,
|
|
13
|
-
value = $bindable(''),
|
|
14
|
-
labelTop,
|
|
15
|
-
optional,
|
|
16
|
-
labelRight,
|
|
17
|
-
placeholder,
|
|
18
|
-
required = false,
|
|
19
|
-
variant = InputVariant.Default,
|
|
20
|
-
selectNone = false,
|
|
21
|
-
uppercase = false,
|
|
22
|
-
disabled = false,
|
|
23
|
-
invalid = false,
|
|
24
|
-
showErrorColours = true,
|
|
25
|
-
rightIconDisabled = false,
|
|
26
|
-
// leftIconDisabled = false,
|
|
27
|
-
leftIcon,
|
|
28
|
-
rightIcon,
|
|
29
|
-
type,
|
|
30
|
-
onLeftIconClick,
|
|
31
|
-
onRightIconClick,
|
|
32
|
-
inputRef = $bindable(),
|
|
33
|
-
'data-type': dataType,
|
|
34
|
-
onblur,
|
|
35
|
-
onfocus,
|
|
36
|
-
onkeydown,
|
|
37
|
-
oninput,
|
|
38
|
-
}: TextInputProps = $props();
|
|
39
|
-
|
|
40
|
-
let isInvalid = $derived(
|
|
41
|
-
showErrorColours &&
|
|
42
|
-
!disabled &&
|
|
43
|
-
((required && (!value?.trim() || (type == 'email' && !isValidEmailAddress(value)))) ||
|
|
44
|
-
invalid)
|
|
45
|
-
);
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<div
|
|
49
|
-
class="error-wrapper"
|
|
50
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
51
|
-
class:for-table={variant == InputVariant.Table}
|
|
52
|
-
>
|
|
53
|
-
<label
|
|
54
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
55
|
-
class:for-table={variant == InputVariant.Table}
|
|
56
|
-
>
|
|
57
|
-
{#if labelTop}
|
|
58
|
-
<span
|
|
59
|
-
class="top-label"
|
|
60
|
-
class:for-default={variant === InputVariant.Default}
|
|
61
|
-
class:invalid={isInvalid}
|
|
62
|
-
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
63
|
-
>
|
|
64
|
-
{#if variant === InputVariant.Default}
|
|
65
|
-
<span
|
|
66
|
-
class="border"
|
|
67
|
-
class:invalid={isInvalid}
|
|
68
|
-
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
69
|
-
>
|
|
70
|
-
{/if}
|
|
71
|
-
{/if}
|
|
72
|
-
<div
|
|
73
|
-
class="icon-container"
|
|
74
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
75
|
-
>
|
|
76
|
-
{#if leftIcon}
|
|
77
|
-
<!-- TODO make this identical to right icon -->
|
|
78
|
-
<Icon
|
|
79
|
-
name={leftIcon.name}
|
|
80
|
-
size={leftIcon.size ?? Size.Medium}
|
|
81
|
-
colour={leftIcon.colour}
|
|
82
|
-
float
|
|
83
|
-
left="0.75rem"
|
|
84
|
-
top="50%"
|
|
85
|
-
anchorX="0"
|
|
86
|
-
anchorY="-50%"
|
|
87
|
-
clickable={!!onLeftIconClick}
|
|
88
|
-
onclick={() => onLeftIconClick?.()}
|
|
89
|
-
/>
|
|
90
|
-
{/if}
|
|
91
|
-
<input
|
|
92
|
-
{id}
|
|
93
|
-
class:for-default={variant === InputVariant.Default}
|
|
94
|
-
class:uppercase
|
|
95
|
-
class:invalid={isInvalid}
|
|
96
|
-
class:select-none={selectNone}
|
|
97
|
-
class:left-pad={leftIcon != undefined}
|
|
98
|
-
class:right-pad={rightIcon != undefined}
|
|
99
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
100
|
-
data-type={dataType}
|
|
101
|
-
type={type ?? 'text'}
|
|
102
|
-
bind:value
|
|
103
|
-
{onblur}
|
|
104
|
-
{onfocus}
|
|
105
|
-
{onkeydown}
|
|
106
|
-
{oninput}
|
|
107
|
-
bind:this={inputRef}
|
|
108
|
-
{placeholder}
|
|
109
|
-
{required}
|
|
110
|
-
{disabled}
|
|
111
|
-
/>
|
|
112
|
-
{#if rightIcon}
|
|
113
|
-
<div class="right-icon">
|
|
114
|
-
{#if onRightIconClick}
|
|
115
|
-
<Action
|
|
116
|
-
noTabIndex
|
|
117
|
-
colourSet={ColourSet.Auxiliary}
|
|
118
|
-
disabled={rightIconDisabled}
|
|
119
|
-
icon={rightIcon}
|
|
120
|
-
size={Size.Medium}
|
|
121
|
-
onclick={onRightIconClick}
|
|
122
|
-
/>
|
|
123
|
-
{:else}
|
|
124
|
-
<Icon
|
|
125
|
-
name={rightIcon.name}
|
|
126
|
-
size={rightIcon.size ?? Size.Medium}
|
|
127
|
-
colour={rightIcon.colour ?? Colour['$font-disabled']}
|
|
128
|
-
float
|
|
129
|
-
right={variant == InputVariant.Modal ? '1rem' : '0.5rem'}
|
|
130
|
-
top="50%"
|
|
131
|
-
anchorX="0"
|
|
132
|
-
anchorY="-50%"
|
|
133
|
-
/>
|
|
134
|
-
{/if}
|
|
135
|
-
</div>
|
|
136
|
-
{/if}
|
|
137
|
-
{#if labelRight}
|
|
138
|
-
<span
|
|
139
|
-
class="right-label"
|
|
140
|
-
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
141
|
-
>
|
|
142
|
-
{/if}
|
|
143
|
-
</div>
|
|
144
|
-
</label>
|
|
145
|
-
</div>
|
|
146
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import { isValidEmailAddress } from '../Helpers/Helpers.svelte.js';
|
|
5
|
+
import { Colour, ColourSet } from '../scss/colours.js';
|
|
6
|
+
import { InputVariant } from '../Types/Internal/InputVariant.js';
|
|
7
|
+
import { Size } from '../Types/Internal/Size.js';
|
|
8
|
+
import Action from './Action.svelte';
|
|
9
|
+
import Icon from './Icon.svelte';
|
|
10
|
+
import type { TextInputProps } from './TextInputProps.js';
|
|
11
|
+
let {
|
|
12
|
+
id,
|
|
13
|
+
value = $bindable(''),
|
|
14
|
+
labelTop,
|
|
15
|
+
optional,
|
|
16
|
+
labelRight,
|
|
17
|
+
placeholder,
|
|
18
|
+
required = false,
|
|
19
|
+
variant = InputVariant.Default,
|
|
20
|
+
selectNone = false,
|
|
21
|
+
uppercase = false,
|
|
22
|
+
disabled = false,
|
|
23
|
+
invalid = false,
|
|
24
|
+
showErrorColours = true,
|
|
25
|
+
rightIconDisabled = false,
|
|
26
|
+
// leftIconDisabled = false,
|
|
27
|
+
leftIcon,
|
|
28
|
+
rightIcon,
|
|
29
|
+
type,
|
|
30
|
+
onLeftIconClick,
|
|
31
|
+
onRightIconClick,
|
|
32
|
+
inputRef = $bindable(),
|
|
33
|
+
'data-type': dataType,
|
|
34
|
+
onblur,
|
|
35
|
+
onfocus,
|
|
36
|
+
onkeydown,
|
|
37
|
+
oninput,
|
|
38
|
+
}: TextInputProps = $props();
|
|
39
|
+
|
|
40
|
+
let isInvalid = $derived(
|
|
41
|
+
showErrorColours &&
|
|
42
|
+
!disabled &&
|
|
43
|
+
((required && (!value?.trim() || (type == 'email' && !isValidEmailAddress(value)))) ||
|
|
44
|
+
invalid)
|
|
45
|
+
);
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
class="error-wrapper"
|
|
50
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
51
|
+
class:for-table={variant == InputVariant.Table}
|
|
52
|
+
>
|
|
53
|
+
<label
|
|
54
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
55
|
+
class:for-table={variant == InputVariant.Table}
|
|
56
|
+
>
|
|
57
|
+
{#if labelTop}
|
|
58
|
+
<span
|
|
59
|
+
class="top-label"
|
|
60
|
+
class:for-default={variant === InputVariant.Default}
|
|
61
|
+
class:invalid={isInvalid}
|
|
62
|
+
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
63
|
+
>
|
|
64
|
+
{#if variant === InputVariant.Default}
|
|
65
|
+
<span
|
|
66
|
+
class="border"
|
|
67
|
+
class:invalid={isInvalid}
|
|
68
|
+
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
69
|
+
>
|
|
70
|
+
{/if}
|
|
71
|
+
{/if}
|
|
72
|
+
<div
|
|
73
|
+
class="icon-container"
|
|
74
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
75
|
+
>
|
|
76
|
+
{#if leftIcon}
|
|
77
|
+
<!-- TODO make this identical to right icon -->
|
|
78
|
+
<Icon
|
|
79
|
+
name={leftIcon.name}
|
|
80
|
+
size={leftIcon.size ?? Size.Medium}
|
|
81
|
+
colour={leftIcon.colour}
|
|
82
|
+
float
|
|
83
|
+
left="0.75rem"
|
|
84
|
+
top="50%"
|
|
85
|
+
anchorX="0"
|
|
86
|
+
anchorY="-50%"
|
|
87
|
+
clickable={!!onLeftIconClick}
|
|
88
|
+
onclick={() => onLeftIconClick?.()}
|
|
89
|
+
/>
|
|
90
|
+
{/if}
|
|
91
|
+
<input
|
|
92
|
+
{id}
|
|
93
|
+
class:for-default={variant === InputVariant.Default}
|
|
94
|
+
class:uppercase
|
|
95
|
+
class:invalid={isInvalid}
|
|
96
|
+
class:select-none={selectNone}
|
|
97
|
+
class:left-pad={leftIcon != undefined}
|
|
98
|
+
class:right-pad={rightIcon != undefined}
|
|
99
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
100
|
+
data-type={dataType}
|
|
101
|
+
type={type ?? 'text'}
|
|
102
|
+
bind:value
|
|
103
|
+
{onblur}
|
|
104
|
+
{onfocus}
|
|
105
|
+
{onkeydown}
|
|
106
|
+
{oninput}
|
|
107
|
+
bind:this={inputRef}
|
|
108
|
+
{placeholder}
|
|
109
|
+
{required}
|
|
110
|
+
{disabled}
|
|
111
|
+
/>
|
|
112
|
+
{#if rightIcon}
|
|
113
|
+
<div class="right-icon">
|
|
114
|
+
{#if onRightIconClick}
|
|
115
|
+
<Action
|
|
116
|
+
noTabIndex
|
|
117
|
+
colourSet={ColourSet.Auxiliary}
|
|
118
|
+
disabled={rightIconDisabled}
|
|
119
|
+
icon={rightIcon}
|
|
120
|
+
size={Size.Medium}
|
|
121
|
+
onclick={onRightIconClick}
|
|
122
|
+
/>
|
|
123
|
+
{:else}
|
|
124
|
+
<Icon
|
|
125
|
+
name={rightIcon.name}
|
|
126
|
+
size={rightIcon.size ?? Size.Medium}
|
|
127
|
+
colour={rightIcon.colour ?? Colour['$font-disabled']}
|
|
128
|
+
float
|
|
129
|
+
right={variant == InputVariant.Modal ? '1rem' : '0.5rem'}
|
|
130
|
+
top="50%"
|
|
131
|
+
anchorX="0"
|
|
132
|
+
anchorY="-50%"
|
|
133
|
+
/>
|
|
134
|
+
{/if}
|
|
135
|
+
</div>
|
|
136
|
+
{/if}
|
|
137
|
+
{#if labelRight}
|
|
138
|
+
<span
|
|
139
|
+
class="right-label"
|
|
140
|
+
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
141
|
+
>
|
|
142
|
+
{/if}
|
|
143
|
+
</div>
|
|
144
|
+
</label>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
147
|
<style>input {
|
|
148
148
|
box-sizing: border-box;
|
|
149
149
|
height: 100%;
|
|
@@ -377,4 +377,4 @@ label.for-table input {
|
|
|
377
377
|
|
|
378
378
|
td {
|
|
379
379
|
--input-border: none;
|
|
380
|
-
}</style>
|
|
380
|
+
}</style>
|