@lavalogic/scoria 0.40.32 → 0.40.33
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 +28 -28
- package/dist/Components/AccordionGroupButton.svelte +60 -60
- package/dist/Components/Action.svelte +48 -48
- package/dist/Components/AlertModal.svelte +102 -102
- package/dist/Components/Base/ContextWrapper.svelte +45 -45
- package/dist/Components/Base/Pagination.svelte +135 -135
- package/dist/Components/Base/Snippets.svelte +25 -25
- package/dist/Components/BigRadioSet.svelte +34 -34
- package/dist/Components/Bubble.svelte +38 -38
- package/dist/Components/Button.svelte +83 -83
- package/dist/Components/Checkbox.svelte +71 -71
- package/dist/Components/CollapsibleCard.svelte +59 -59
- package/dist/Components/CollapsibleMenuGroup.svelte +43 -43
- package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +101 -101
- package/dist/Components/Contexts/ContextMenu.svelte +76 -76
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +38 -38
- package/dist/Components/Contexts/Toast.svelte +71 -71
- package/dist/Components/Contexts/ToastContainer.svelte +34 -34
- package/dist/Components/Contexts/Tooltip.svelte +32 -32
- package/dist/Components/DataMatrixIcon.svelte +37 -37
- package/dist/Components/DateInput.svelte +80 -80
- package/dist/Components/DatePicker.svelte +86 -86
- package/dist/Components/DesktopModal.svelte +65 -65
- package/dist/Components/Dial.svelte +35 -35
- package/dist/Components/DimensionInput.svelte +95 -95
- package/dist/Components/DragMenu/DragMenuHolder.svelte +53 -53
- package/dist/Components/DragMenu/DraggableCard.svelte +49 -49
- package/dist/Components/FileCard.svelte +18 -18
- package/dist/Components/FileUpload.svelte +115 -115
- package/dist/Components/GridInput.svelte +123 -123
- package/dist/Components/GridInputSet.svelte +21 -21
- package/dist/Components/HorizontalTabGroup.svelte +54 -54
- package/dist/Components/HorizontalTabGroupButton.svelte +32 -32
- package/dist/Components/Icon.svelte +68 -68
- package/dist/Components/InfoAlert.svelte +32 -32
- package/dist/Components/LoadingAnimation.svelte +228 -227
- package/dist/Components/LoadingModal.svelte +19 -19
- package/dist/Components/LoadingOverlay.svelte +20 -20
- package/dist/Components/Modal.svelte +127 -127
- package/dist/Components/MultiSelect.svelte +126 -126
- package/dist/Components/Nav/Nav.svelte +71 -71
- package/dist/Components/Nav/NavServiceMenuList.svelte +37 -37
- package/dist/Components/Nav/NavTab.svelte +46 -46
- package/dist/Components/Nav/ServiceMenuItem.svelte +62 -62
- package/dist/Components/Nav/ServicesNav.svelte +50 -50
- package/dist/Components/NumberInput.svelte +98 -98
- package/dist/Components/OptionCards.svelte +58 -58
- package/dist/Components/PageHeading.svelte +21 -21
- package/dist/Components/PasswordInput.svelte +61 -61
- package/dist/Components/PopoverButton.svelte +53 -53
- package/dist/Components/Portal.svelte +7 -7
- package/dist/Components/ProgressBubble.svelte +42 -42
- package/dist/Components/QuerySelect.svelte +102 -102
- package/dist/Components/ResourceCalendar/ResourceCalendar.svelte +241 -241
- package/dist/Components/SidebarPanel.svelte +32 -32
- package/dist/Components/SingleSelect.svelte +122 -122
- package/dist/Components/StepButton.svelte +48 -48
- package/dist/Components/StepForm.svelte +58 -58
- package/dist/Components/Switch.svelte +43 -43
- package/dist/Components/Table/ARCHITECTURE.md +298 -298
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +30 -30
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +24 -24
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +165 -165
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +13 -13
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +120 -120
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +81 -81
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +92 -92
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +110 -110
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +54 -54
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +35 -35
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +64 -64
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +82 -82
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +88 -88
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +90 -90
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +96 -96
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +71 -71
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +124 -124
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +91 -91
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +88 -88
- package/dist/Components/Table/Body/Rows/TableRow.svelte +127 -127
- package/dist/Components/Table/Body/TableBody.svelte +92 -92
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +25 -25
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +20 -20
- package/dist/Components/Table/Headers/TableHead.svelte +175 -175
- package/dist/Components/Table/Misc/ColumnPanel.svelte +32 -32
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +29 -29
- package/dist/Components/Table/Misc/FilterInput.svelte +326 -326
- package/dist/Components/Table/Misc/FilterPanel.svelte +79 -79
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +21 -21
- package/dist/Components/Table/Misc/ShareViewModal.svelte +118 -118
- package/dist/Components/Table/Misc/SidePanel.svelte +24 -24
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +318 -318
- package/dist/Components/Table/Misc/TableFooter.svelte +201 -201
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +112 -112
- package/dist/Components/Table/Misc/TableSidebar.svelte +116 -116
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +25 -25
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +60 -60
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +63 -63
- package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +101 -101
- package/dist/Components/Table/NestedTable.svelte +29 -29
- package/dist/Components/Table/Table.svelte +140 -140
- package/dist/Components/Test/TestContextConsumer.svelte +8 -8
- package/dist/Components/TextArea.svelte +92 -90
- package/dist/Components/TextInput.svelte +128 -117
- package/dist/Components/ThreeStateRadio.svelte +101 -101
- package/dist/Components/Touch/BoolCard.svelte +27 -27
- package/dist/Components/Touch/DateModal.svelte +98 -98
- package/dist/Components/Touch/EditCard.svelte +44 -44
- package/dist/Components/Touch/InfoCard.svelte +25 -25
- package/dist/Components/Touch/InfoTextCard.svelte +22 -22
- package/dist/Components/Touch/ModalExplanation.svelte +13 -13
- package/dist/Components/Touch/NumberKeyboard.svelte +81 -81
- package/dist/Components/Touch/NumberModal.svelte +49 -49
- package/dist/Components/Touch/PlusMinusCard.svelte +40 -40
- package/dist/Components/Touch/SelectModal.svelte +86 -86
- package/dist/Components/Touch/SummaryCard.svelte +74 -74
- package/dist/Components/Touch/TextAreaModal.svelte +53 -53
- package/dist/Components/Touch/TextModal.svelte +56 -56
- package/dist/Components/Touch/TouchCard.svelte +28 -28
- package/dist/Components/Touch/TouchModal.svelte +141 -141
- package/dist/Components/Touch/UtilityButton.svelte +63 -63
- package/dist/Components/VerticalTabGroup.svelte +38 -38
- package/dist/Components/VerticalTabGroupButton.svelte +46 -46
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Types/Examples/ExampleModal.svelte +27 -27
- package/dist/paraglide/README.md +1 -1
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +140 -140
- 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,5 +1,5 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
3
|
<script lang="ts">import { m as i18n } from "../paraglide/messages.js";
|
|
4
4
|
import { cssLength } from "../Helpers/Helpers.svelte.js";
|
|
5
5
|
import { InputVariant } from "../Types/Internal/InputVariant.js";
|
|
@@ -7,93 +7,95 @@ import { Size } from "../Types/Internal/Size.js";
|
|
|
7
7
|
import Icon from "./Icon.svelte";
|
|
8
8
|
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();
|
|
9
9
|
const isInvalid = $derived(showErrorColours && (required && value.trim() === "" || invalid));
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<label
|
|
13
|
-
class:for-modal={variant === InputVariant.Modal}
|
|
14
|
-
class:max-width={maxWidth}
|
|
15
|
-
>
|
|
16
|
-
{#if labelTop && variant !== InputVariant.Modal}
|
|
17
|
-
<span
|
|
18
|
-
class="top-label"
|
|
19
|
-
class:for-default={variant === InputVariant.Default}
|
|
20
|
-
class:invalid={isInvalid}
|
|
21
|
-
>{labelTop}{#if optional}<i> - {i18n['scoria.label.optional']()}</i>{/if}</span
|
|
22
|
-
>
|
|
23
|
-
{#if variant === InputVariant.Default}
|
|
24
|
-
<span
|
|
25
|
-
aria-hidden="true"
|
|
26
|
-
class="border"
|
|
27
|
-
class:invalid={isInvalid}
|
|
28
|
-
>{labelTop}{#if optional}<i> - {i18n['scoria.label.optional']()}</i>{/if}</span
|
|
29
|
-
>
|
|
30
|
-
{/if}
|
|
31
|
-
{/if}
|
|
32
|
-
<div
|
|
33
|
-
class="icon-container"
|
|
34
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
35
|
-
>
|
|
36
|
-
{#if leftIcon}
|
|
37
|
-
<Icon
|
|
38
|
-
name={leftIcon.name}
|
|
39
|
-
size={leftIcon.size ?? Size.Medium}
|
|
40
|
-
colour={leftIcon.colour}
|
|
41
|
-
float
|
|
42
|
-
left={cssLength('0.75rem')}
|
|
43
|
-
top={cssLength('50%')}
|
|
44
|
-
anchorX={cssLength('0')}
|
|
45
|
-
anchorY={cssLength('-50%')}
|
|
46
|
-
clickable={!!onLeftIconClick}
|
|
47
|
-
onclick={onLeftIconClick}
|
|
48
|
-
/>
|
|
49
|
-
{/if}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class:
|
|
53
|
-
class:
|
|
54
|
-
class:
|
|
55
|
-
class:
|
|
56
|
-
class:
|
|
57
|
-
class:
|
|
58
|
-
class:for-
|
|
59
|
-
class:
|
|
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
|
-
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<label
|
|
13
|
+
class:for-modal={variant === InputVariant.Modal}
|
|
14
|
+
class:max-width={maxWidth}
|
|
15
|
+
>
|
|
16
|
+
{#if labelTop && variant !== InputVariant.Modal}
|
|
17
|
+
<span
|
|
18
|
+
class="top-label"
|
|
19
|
+
class:for-default={variant === InputVariant.Default}
|
|
20
|
+
class:invalid={isInvalid}
|
|
21
|
+
>{labelTop}{#if optional}<i> - {i18n['scoria.label.optional']()}</i>{/if}</span
|
|
22
|
+
>
|
|
23
|
+
{#if variant === InputVariant.Default}
|
|
24
|
+
<span
|
|
25
|
+
aria-hidden="true"
|
|
26
|
+
class="border"
|
|
27
|
+
class:invalid={isInvalid}
|
|
28
|
+
>{labelTop}{#if optional}<i> - {i18n['scoria.label.optional']()}</i>{/if}</span
|
|
29
|
+
>
|
|
30
|
+
{/if}
|
|
31
|
+
{/if}
|
|
32
|
+
<div
|
|
33
|
+
class="icon-container"
|
|
34
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
35
|
+
>
|
|
36
|
+
{#if leftIcon}
|
|
37
|
+
<Icon
|
|
38
|
+
name={leftIcon.name}
|
|
39
|
+
size={leftIcon.size ?? Size.Medium}
|
|
40
|
+
colour={leftIcon.colour}
|
|
41
|
+
float
|
|
42
|
+
left={cssLength('0.75rem')}
|
|
43
|
+
top={cssLength('50%')}
|
|
44
|
+
anchorX={cssLength('0')}
|
|
45
|
+
anchorY={cssLength('-50%')}
|
|
46
|
+
clickable={!!onLeftIconClick}
|
|
47
|
+
onclick={onLeftIconClick}
|
|
48
|
+
/>
|
|
49
|
+
{/if}
|
|
50
|
+
<!-- See the note on `dir` in TextInput.svelte — auto only while there is a value. -->
|
|
51
|
+
<textarea
|
|
52
|
+
class:noresize
|
|
53
|
+
class:uppercase
|
|
54
|
+
class:invalid={isInvalid}
|
|
55
|
+
class:select-none={selectNone}
|
|
56
|
+
class:left-pad={leftIcon != undefined}
|
|
57
|
+
class:right-pad={rightIcon != undefined}
|
|
58
|
+
class:for-default={variant === InputVariant.Default}
|
|
59
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
60
|
+
class:max-width={maxWidth}
|
|
61
|
+
autocomplete={autocomplete ?? 'off'}
|
|
62
|
+
spellcheck={spellcheck ?? true}
|
|
63
|
+
dir={value ? 'auto' : null}
|
|
64
|
+
aria-invalid={isInvalid || undefined}
|
|
65
|
+
bind:value
|
|
66
|
+
{onblur}
|
|
67
|
+
{onfocus}
|
|
68
|
+
{onkeydown}
|
|
69
|
+
{oninput}
|
|
70
|
+
{rows}
|
|
71
|
+
bind:this={textAreaRef}
|
|
72
|
+
{placeholder}
|
|
73
|
+
{required}
|
|
74
|
+
{disabled}
|
|
75
|
+
></textarea>
|
|
76
|
+
{#if rightIcon}
|
|
77
|
+
<Icon
|
|
78
|
+
name={rightIcon.name}
|
|
79
|
+
size={rightIcon.size ?? Size.Medium}
|
|
80
|
+
colour={rightIcon.colour}
|
|
81
|
+
float
|
|
82
|
+
right={cssLength(variant == InputVariant.Modal ? '1rem' : '0.5rem')}
|
|
83
|
+
top={cssLength('50%')}
|
|
84
|
+
anchorX={cssLength('0')}
|
|
85
|
+
anchorY={cssLength('-50%')}
|
|
86
|
+
clickable={!!onRightIconClick}
|
|
87
|
+
onclick={onRightIconClick}
|
|
88
|
+
/>
|
|
89
|
+
{/if}
|
|
90
|
+
{#if labelRight}
|
|
91
|
+
<span
|
|
92
|
+
class="right-label"
|
|
93
|
+
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
94
|
+
>
|
|
95
|
+
{/if}
|
|
96
|
+
</div>
|
|
97
|
+
</label>
|
|
98
|
+
|
|
97
99
|
<style>textarea {
|
|
98
100
|
box-sizing: border-box;
|
|
99
101
|
height: 100%;
|
|
@@ -306,4 +308,4 @@ span.border.invalid {
|
|
|
306
308
|
.textarea-error-wrapper.for-modal {
|
|
307
309
|
position: relative;
|
|
308
310
|
height: 100%;
|
|
309
|
-
}</style>
|
|
311
|
+
}</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
3
|
<script lang="ts">import { m as i18n } from "../paraglide/messages.js";
|
|
4
4
|
import { cssLength, isValidEmailAddress } from "../Helpers/Helpers.svelte.js";
|
|
5
5
|
import { Colour, ColourSet } from "../scss/colours.js";
|
|
@@ -9,120 +9,131 @@ import Action from "./Action.svelte";
|
|
|
9
9
|
import Icon from "./Icon.svelte";
|
|
10
10
|
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();
|
|
11
11
|
const isInvalid = $derived(showErrorColours && !disabled && (required && (!value?.trim() || type == "email" && value.length >= 3 && value.includes("@") && !isValidEmailAddress(value)) || invalid));
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<div
|
|
15
|
-
class="error-wrapper"
|
|
16
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
17
|
-
class:for-table={variant == InputVariant.Table}
|
|
18
|
-
>
|
|
19
|
-
<label
|
|
20
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
21
|
-
class:for-table={variant == InputVariant.Table}
|
|
22
|
-
>
|
|
23
|
-
{#if labelTop}
|
|
24
|
-
<span
|
|
25
|
-
class="top-label"
|
|
26
|
-
class:for-default={variant === InputVariant.Default}
|
|
27
|
-
class:invalid={isInvalid}
|
|
28
|
-
>{labelTop}{#if optional}<i> - {i18n['scoria.label.optional']()}</i>{/if}</span
|
|
29
|
-
>
|
|
30
|
-
{#if variant === InputVariant.Default}
|
|
31
|
-
<span
|
|
32
|
-
aria-hidden="true"
|
|
33
|
-
class="border"
|
|
34
|
-
class:invalid={isInvalid}
|
|
35
|
-
>{labelTop}{#if optional}<i> - {i18n['scoria.label.optional']()}</i>{/if}</span
|
|
36
|
-
>
|
|
37
|
-
{/if}
|
|
38
|
-
{/if}
|
|
39
|
-
<div
|
|
40
|
-
class="icon-container"
|
|
41
|
-
class:for-modal={variant == InputVariant.Modal}
|
|
42
|
-
>
|
|
43
|
-
{#if leftIcon}
|
|
44
|
-
{#if onLeftIconClick}
|
|
45
|
-
<div class="left-icon">
|
|
46
|
-
<Action
|
|
47
|
-
noTabIndex
|
|
48
|
-
colourSet={ColourSet.Auxiliary}
|
|
49
|
-
icon={leftIcon}
|
|
50
|
-
size={Size.Medium}
|
|
51
|
-
onclick={onLeftIconClick}
|
|
52
|
-
/>
|
|
53
|
-
</div>
|
|
54
|
-
{:else}
|
|
55
|
-
<Icon
|
|
56
|
-
name={leftIcon.name}
|
|
57
|
-
size={leftIcon.size ?? Size.Medium}
|
|
58
|
-
colour={leftIcon.colour}
|
|
59
|
-
float
|
|
60
|
-
left={cssLength('0.75rem')}
|
|
61
|
-
top={cssLength('50%')}
|
|
62
|
-
anchorX={cssLength('0')}
|
|
63
|
-
anchorY={cssLength('-50%')}
|
|
64
|
-
/>
|
|
65
|
-
{/if}
|
|
66
|
-
{/if}
|
|
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
|
-
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div
|
|
15
|
+
class="error-wrapper"
|
|
16
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
17
|
+
class:for-table={variant == InputVariant.Table}
|
|
18
|
+
>
|
|
19
|
+
<label
|
|
20
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
21
|
+
class:for-table={variant == InputVariant.Table}
|
|
22
|
+
>
|
|
23
|
+
{#if labelTop}
|
|
24
|
+
<span
|
|
25
|
+
class="top-label"
|
|
26
|
+
class:for-default={variant === InputVariant.Default}
|
|
27
|
+
class:invalid={isInvalid}
|
|
28
|
+
>{labelTop}{#if optional}<i> - {i18n['scoria.label.optional']()}</i>{/if}</span
|
|
29
|
+
>
|
|
30
|
+
{#if variant === InputVariant.Default}
|
|
31
|
+
<span
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
class="border"
|
|
34
|
+
class:invalid={isInvalid}
|
|
35
|
+
>{labelTop}{#if optional}<i> - {i18n['scoria.label.optional']()}</i>{/if}</span
|
|
36
|
+
>
|
|
37
|
+
{/if}
|
|
38
|
+
{/if}
|
|
39
|
+
<div
|
|
40
|
+
class="icon-container"
|
|
41
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
42
|
+
>
|
|
43
|
+
{#if leftIcon}
|
|
44
|
+
{#if onLeftIconClick}
|
|
45
|
+
<div class="left-icon">
|
|
46
|
+
<Action
|
|
47
|
+
noTabIndex
|
|
48
|
+
colourSet={ColourSet.Auxiliary}
|
|
49
|
+
icon={leftIcon}
|
|
50
|
+
size={Size.Medium}
|
|
51
|
+
onclick={onLeftIconClick}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
{:else}
|
|
55
|
+
<Icon
|
|
56
|
+
name={leftIcon.name}
|
|
57
|
+
size={leftIcon.size ?? Size.Medium}
|
|
58
|
+
colour={leftIcon.colour}
|
|
59
|
+
float
|
|
60
|
+
left={cssLength('0.75rem')}
|
|
61
|
+
top={cssLength('50%')}
|
|
62
|
+
anchorX={cssLength('0')}
|
|
63
|
+
anchorY={cssLength('-50%')}
|
|
64
|
+
/>
|
|
65
|
+
{/if}
|
|
66
|
+
{/if}
|
|
67
|
+
<!--
|
|
68
|
+
`dir="auto"` lets the field follow what is actually typed: the caret
|
|
69
|
+
sits at the RTL edge under an RTL locale, then flips to LTR the moment
|
|
70
|
+
the first strong Latin character lands.
|
|
71
|
+
|
|
72
|
+
It is applied only while there IS a value. HTML resolves `dir="auto"`
|
|
73
|
+
on an EMPTY form control to `ltr` rather than to the inherited
|
|
74
|
+
direction, so applying it unconditionally would park the caret — and
|
|
75
|
+
a translated placeholder — on the wrong edge of every empty field.
|
|
76
|
+
-->
|
|
77
|
+
<input
|
|
78
|
+
{id}
|
|
79
|
+
class:for-default={variant === InputVariant.Default}
|
|
80
|
+
class:uppercase
|
|
81
|
+
class:invalid={isInvalid}
|
|
82
|
+
class:select-none={selectNone}
|
|
83
|
+
class:left-pad={leftIcon != undefined}
|
|
84
|
+
class:right-pad={rightIcon != undefined}
|
|
85
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
86
|
+
data-type={dataType}
|
|
87
|
+
type={type ?? 'text'}
|
|
88
|
+
dir={value ? 'auto' : null}
|
|
89
|
+
autocomplete={autocomplete ?? (type === 'email' ? 'email' : 'off')}
|
|
90
|
+
spellcheck={spellcheck ?? false}
|
|
91
|
+
aria-invalid={isInvalid || undefined}
|
|
92
|
+
bind:value
|
|
93
|
+
{onblur}
|
|
94
|
+
{onfocus}
|
|
95
|
+
{onkeydown}
|
|
96
|
+
{oninput}
|
|
97
|
+
bind:this={inputRef}
|
|
98
|
+
{placeholder}
|
|
99
|
+
{required}
|
|
100
|
+
{disabled}
|
|
101
|
+
/>
|
|
102
|
+
{#if rightIcon}
|
|
103
|
+
<div class="right-icon">
|
|
104
|
+
{#if onRightIconClick}
|
|
105
|
+
<Action
|
|
106
|
+
noTabIndex
|
|
107
|
+
colourSet={ColourSet.Auxiliary}
|
|
108
|
+
disabled={rightIconDisabled}
|
|
109
|
+
icon={rightIcon}
|
|
110
|
+
size={Size.Medium}
|
|
111
|
+
onclick={onRightIconClick}
|
|
112
|
+
/>
|
|
113
|
+
{:else}
|
|
114
|
+
<Icon
|
|
115
|
+
name={rightIcon.name}
|
|
116
|
+
size={rightIcon.size ?? Size.Medium}
|
|
117
|
+
colour={rightIcon.colour ?? Colour['$font-disabled']}
|
|
118
|
+
float
|
|
119
|
+
right={cssLength(variant == InputVariant.Modal ? '1rem' : '0.5rem')}
|
|
120
|
+
top={cssLength('50%')}
|
|
121
|
+
anchorX={cssLength('0')}
|
|
122
|
+
anchorY={cssLength('-50%')}
|
|
123
|
+
/>
|
|
124
|
+
{/if}
|
|
125
|
+
</div>
|
|
126
|
+
{/if}
|
|
127
|
+
{#if labelRight}
|
|
128
|
+
<span
|
|
129
|
+
class="right-label"
|
|
130
|
+
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
131
|
+
>
|
|
132
|
+
{/if}
|
|
133
|
+
</div>
|
|
134
|
+
</label>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
126
137
|
<style>input {
|
|
127
138
|
box-sizing: border-box;
|
|
128
139
|
height: 100%;
|
|
@@ -354,4 +365,4 @@ label.for-table input {
|
|
|
354
365
|
|
|
355
366
|
td {
|
|
356
367
|
--input-border: none;
|
|
357
|
-
}</style>
|
|
368
|
+
}</style>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
module
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
6
|
>import { m as i18n } from "../paraglide/messages.js";
|
|
7
7
|
import { Colour, ColourSet } from "../scss/colours.js";
|
|
8
8
|
import { Ternary } from "../Types/Internal/Ternary.js";
|
|
9
9
|
import Action from "./Action.svelte";
|
|
10
|
-
</script>
|
|
11
|
-
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
12
|
<script lang="ts">let { value = $bindable(Ternary.Neutral), label, disabled, isValid, onchange, noDisabled = false, yesDisabled = false, neutralDisabled = false, noLabel, yesLabel, neutralLabel, noIcon, yesIcon, neutralIcon } = $props();
|
|
13
13
|
function setValue(next) {
|
|
14
14
|
if (next === value) {
|
|
@@ -17,99 +17,99 @@ function setValue(next) {
|
|
|
17
17
|
value = next;
|
|
18
18
|
void onchange?.(next);
|
|
19
19
|
}
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<div
|
|
23
|
-
class="text-label"
|
|
24
|
-
class:invalid={isValid === false}
|
|
25
|
-
>
|
|
26
|
-
{#if label != undefined}
|
|
27
|
-
<span>{label}</span>
|
|
28
|
-
{/if}
|
|
29
|
-
|
|
30
|
-
<div
|
|
31
|
-
class="radios"
|
|
32
|
-
role="radiogroup"
|
|
33
|
-
aria-label={label}
|
|
34
|
-
>
|
|
35
|
-
<label class:disabled={disabled || noDisabled}>
|
|
36
|
-
<Action
|
|
37
|
-
disabled={disabled || noDisabled}
|
|
38
|
-
colourSet={value === Ternary.False ? ColourSet.Primary : ColourSet.Auxiliary}
|
|
39
|
-
icon={{
|
|
40
|
-
name: 'circle-cross',
|
|
41
|
-
...noIcon,
|
|
42
|
-
colour: value === Ternary.False ? undefined : Colour['$ui-blue-5'],
|
|
43
|
-
}}
|
|
44
|
-
label={noLabel ?? i18n['scoria.action.no']()}
|
|
45
|
-
onclick={() => {
|
|
46
|
-
setValue(Ternary.False);
|
|
47
|
-
}}
|
|
48
|
-
/>
|
|
49
|
-
<input
|
|
50
|
-
disabled={disabled || noDisabled}
|
|
51
|
-
type="radio"
|
|
52
|
-
value="0"
|
|
53
|
-
checked={value === Ternary.False}
|
|
54
|
-
aria-label={noLabel ?? i18n['scoria.action.no']()}
|
|
55
|
-
onchange={() => {
|
|
56
|
-
setValue(Ternary.False);
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
</label>
|
|
60
|
-
<label class:disabled={disabled || neutralDisabled}>
|
|
61
|
-
<Action
|
|
62
|
-
disabled={disabled || neutralDisabled}
|
|
63
|
-
colourSet={value === Ternary.Neutral ? ColourSet.Primary : ColourSet.Auxiliary}
|
|
64
|
-
icon={{
|
|
65
|
-
name: 'database',
|
|
66
|
-
...neutralIcon,
|
|
67
|
-
colour: value === Ternary.Neutral ? undefined : Colour['$ui-blue-5'],
|
|
68
|
-
}}
|
|
69
|
-
label={neutralLabel ?? i18n['scoria.label.allow_system_decide']()}
|
|
70
|
-
onclick={() => {
|
|
71
|
-
setValue(Ternary.Neutral);
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
<input
|
|
75
|
-
disabled={disabled || neutralDisabled}
|
|
76
|
-
type="radio"
|
|
77
|
-
value="-1"
|
|
78
|
-
checked={value === Ternary.Neutral}
|
|
79
|
-
aria-label={neutralLabel ?? i18n['scoria.label.allow_system_decide']()}
|
|
80
|
-
onchange={() => {
|
|
81
|
-
setValue(Ternary.Neutral);
|
|
82
|
-
}}
|
|
83
|
-
/>
|
|
84
|
-
</label>
|
|
85
|
-
<label class:disabled={disabled || yesDisabled}>
|
|
86
|
-
<Action
|
|
87
|
-
disabled={disabled || yesDisabled}
|
|
88
|
-
colourSet={value === Ternary.True ? ColourSet.Primary : ColourSet.Auxiliary}
|
|
89
|
-
icon={{
|
|
90
|
-
name: 'circle-tick',
|
|
91
|
-
...yesIcon,
|
|
92
|
-
colour: value === Ternary.True ? undefined : Colour['$ui-blue-5'],
|
|
93
|
-
}}
|
|
94
|
-
label={yesLabel ?? i18n['scoria.action.yes']()}
|
|
95
|
-
onclick={() => {
|
|
96
|
-
setValue(Ternary.True);
|
|
97
|
-
}}
|
|
98
|
-
/>
|
|
99
|
-
<input
|
|
100
|
-
disabled={disabled || yesDisabled}
|
|
101
|
-
type="radio"
|
|
102
|
-
value="1"
|
|
103
|
-
checked={value === Ternary.True}
|
|
104
|
-
aria-label={yesLabel ?? i18n['scoria.action.yes']()}
|
|
105
|
-
onchange={() => {
|
|
106
|
-
setValue(Ternary.True);
|
|
107
|
-
}}
|
|
108
|
-
/>
|
|
109
|
-
</label>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div
|
|
23
|
+
class="text-label"
|
|
24
|
+
class:invalid={isValid === false}
|
|
25
|
+
>
|
|
26
|
+
{#if label != undefined}
|
|
27
|
+
<span>{label}</span>
|
|
28
|
+
{/if}
|
|
29
|
+
|
|
30
|
+
<div
|
|
31
|
+
class="radios"
|
|
32
|
+
role="radiogroup"
|
|
33
|
+
aria-label={label}
|
|
34
|
+
>
|
|
35
|
+
<label class:disabled={disabled || noDisabled}>
|
|
36
|
+
<Action
|
|
37
|
+
disabled={disabled || noDisabled}
|
|
38
|
+
colourSet={value === Ternary.False ? ColourSet.Primary : ColourSet.Auxiliary}
|
|
39
|
+
icon={{
|
|
40
|
+
name: 'circle-cross',
|
|
41
|
+
...noIcon,
|
|
42
|
+
colour: value === Ternary.False ? undefined : Colour['$ui-blue-5'],
|
|
43
|
+
}}
|
|
44
|
+
label={noLabel ?? i18n['scoria.action.no']()}
|
|
45
|
+
onclick={() => {
|
|
46
|
+
setValue(Ternary.False);
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
<input
|
|
50
|
+
disabled={disabled || noDisabled}
|
|
51
|
+
type="radio"
|
|
52
|
+
value="0"
|
|
53
|
+
checked={value === Ternary.False}
|
|
54
|
+
aria-label={noLabel ?? i18n['scoria.action.no']()}
|
|
55
|
+
onchange={() => {
|
|
56
|
+
setValue(Ternary.False);
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
</label>
|
|
60
|
+
<label class:disabled={disabled || neutralDisabled}>
|
|
61
|
+
<Action
|
|
62
|
+
disabled={disabled || neutralDisabled}
|
|
63
|
+
colourSet={value === Ternary.Neutral ? ColourSet.Primary : ColourSet.Auxiliary}
|
|
64
|
+
icon={{
|
|
65
|
+
name: 'database',
|
|
66
|
+
...neutralIcon,
|
|
67
|
+
colour: value === Ternary.Neutral ? undefined : Colour['$ui-blue-5'],
|
|
68
|
+
}}
|
|
69
|
+
label={neutralLabel ?? i18n['scoria.label.allow_system_decide']()}
|
|
70
|
+
onclick={() => {
|
|
71
|
+
setValue(Ternary.Neutral);
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
<input
|
|
75
|
+
disabled={disabled || neutralDisabled}
|
|
76
|
+
type="radio"
|
|
77
|
+
value="-1"
|
|
78
|
+
checked={value === Ternary.Neutral}
|
|
79
|
+
aria-label={neutralLabel ?? i18n['scoria.label.allow_system_decide']()}
|
|
80
|
+
onchange={() => {
|
|
81
|
+
setValue(Ternary.Neutral);
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
</label>
|
|
85
|
+
<label class:disabled={disabled || yesDisabled}>
|
|
86
|
+
<Action
|
|
87
|
+
disabled={disabled || yesDisabled}
|
|
88
|
+
colourSet={value === Ternary.True ? ColourSet.Primary : ColourSet.Auxiliary}
|
|
89
|
+
icon={{
|
|
90
|
+
name: 'circle-tick',
|
|
91
|
+
...yesIcon,
|
|
92
|
+
colour: value === Ternary.True ? undefined : Colour['$ui-blue-5'],
|
|
93
|
+
}}
|
|
94
|
+
label={yesLabel ?? i18n['scoria.action.yes']()}
|
|
95
|
+
onclick={() => {
|
|
96
|
+
setValue(Ternary.True);
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
<input
|
|
100
|
+
disabled={disabled || yesDisabled}
|
|
101
|
+
type="radio"
|
|
102
|
+
value="1"
|
|
103
|
+
checked={value === Ternary.True}
|
|
104
|
+
aria-label={yesLabel ?? i18n['scoria.action.yes']()}
|
|
105
|
+
onchange={() => {
|
|
106
|
+
setValue(Ternary.True);
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
</label>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
113
|
<style>.text-label {
|
|
114
114
|
box-sizing: border-box;
|
|
115
115
|
height: max(var(--input-height, 3rem), 2rem);
|
|
@@ -184,4 +184,4 @@ input {
|
|
|
184
184
|
clip-path: rect(0 0 0 0);
|
|
185
185
|
white-space: nowrap;
|
|
186
186
|
border: 0;
|
|
187
|
-
}</style>
|
|
187
|
+
}</style>
|