@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.
Files changed (135) hide show
  1. package/README.md +58 -58
  2. package/dist/Components/AccordionGroup.svelte +28 -28
  3. package/dist/Components/AccordionGroupButton.svelte +60 -60
  4. package/dist/Components/Action.svelte +48 -48
  5. package/dist/Components/AlertModal.svelte +102 -102
  6. package/dist/Components/Base/ContextWrapper.svelte +45 -45
  7. package/dist/Components/Base/Pagination.svelte +135 -135
  8. package/dist/Components/Base/Snippets.svelte +25 -25
  9. package/dist/Components/BigRadioSet.svelte +34 -34
  10. package/dist/Components/Bubble.svelte +38 -38
  11. package/dist/Components/Button.svelte +83 -83
  12. package/dist/Components/Checkbox.svelte +71 -71
  13. package/dist/Components/CollapsibleCard.svelte +59 -59
  14. package/dist/Components/CollapsibleMenuGroup.svelte +43 -43
  15. package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +101 -101
  16. package/dist/Components/Contexts/ContextMenu.svelte +76 -76
  17. package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
  18. package/dist/Components/Contexts/ContextMenuOption.svelte +38 -38
  19. package/dist/Components/Contexts/Toast.svelte +71 -71
  20. package/dist/Components/Contexts/ToastContainer.svelte +34 -34
  21. package/dist/Components/Contexts/Tooltip.svelte +32 -32
  22. package/dist/Components/DataMatrixIcon.svelte +37 -37
  23. package/dist/Components/DateInput.svelte +80 -80
  24. package/dist/Components/DatePicker.svelte +86 -86
  25. package/dist/Components/DesktopModal.svelte +65 -65
  26. package/dist/Components/Dial.svelte +35 -35
  27. package/dist/Components/DimensionInput.svelte +95 -95
  28. package/dist/Components/DragMenu/DragMenuHolder.svelte +53 -53
  29. package/dist/Components/DragMenu/DraggableCard.svelte +49 -49
  30. package/dist/Components/FileCard.svelte +18 -18
  31. package/dist/Components/FileUpload.svelte +115 -115
  32. package/dist/Components/GridInput.svelte +123 -123
  33. package/dist/Components/GridInputSet.svelte +21 -21
  34. package/dist/Components/HorizontalTabGroup.svelte +54 -54
  35. package/dist/Components/HorizontalTabGroupButton.svelte +32 -32
  36. package/dist/Components/Icon.svelte +68 -68
  37. package/dist/Components/InfoAlert.svelte +32 -32
  38. package/dist/Components/LoadingAnimation.svelte +228 -227
  39. package/dist/Components/LoadingModal.svelte +19 -19
  40. package/dist/Components/LoadingOverlay.svelte +20 -20
  41. package/dist/Components/Modal.svelte +127 -127
  42. package/dist/Components/MultiSelect.svelte +126 -126
  43. package/dist/Components/Nav/Nav.svelte +71 -71
  44. package/dist/Components/Nav/NavServiceMenuList.svelte +37 -37
  45. package/dist/Components/Nav/NavTab.svelte +46 -46
  46. package/dist/Components/Nav/ServiceMenuItem.svelte +62 -62
  47. package/dist/Components/Nav/ServicesNav.svelte +50 -50
  48. package/dist/Components/NumberInput.svelte +98 -98
  49. package/dist/Components/OptionCards.svelte +58 -58
  50. package/dist/Components/PageHeading.svelte +21 -21
  51. package/dist/Components/PasswordInput.svelte +61 -61
  52. package/dist/Components/PopoverButton.svelte +53 -53
  53. package/dist/Components/Portal.svelte +7 -7
  54. package/dist/Components/ProgressBubble.svelte +42 -42
  55. package/dist/Components/QuerySelect.svelte +102 -102
  56. package/dist/Components/ResourceCalendar/ResourceCalendar.svelte +241 -241
  57. package/dist/Components/SidebarPanel.svelte +32 -32
  58. package/dist/Components/SingleSelect.svelte +122 -122
  59. package/dist/Components/StepButton.svelte +48 -48
  60. package/dist/Components/StepForm.svelte +58 -58
  61. package/dist/Components/Switch.svelte +43 -43
  62. package/dist/Components/Table/ARCHITECTURE.md +298 -298
  63. package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +30 -30
  64. package/dist/Components/Table/Body/Rows/ColumnList.svelte +24 -24
  65. package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +165 -165
  66. package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +13 -13
  67. package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +120 -120
  68. package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +81 -81
  69. package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +92 -92
  70. package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +110 -110
  71. package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +54 -54
  72. package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +35 -35
  73. package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +64 -64
  74. package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +82 -82
  75. package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +88 -88
  76. package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +90 -90
  77. package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +96 -96
  78. package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +71 -71
  79. package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +124 -124
  80. package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +91 -91
  81. package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +88 -88
  82. package/dist/Components/Table/Body/Rows/TableRow.svelte +127 -127
  83. package/dist/Components/Table/Body/TableBody.svelte +92 -92
  84. package/dist/Components/Table/Headers/HighlightAllHeader.svelte +25 -25
  85. package/dist/Components/Table/Headers/SelectAllHeader.svelte +20 -20
  86. package/dist/Components/Table/Headers/TableHead.svelte +175 -175
  87. package/dist/Components/Table/Misc/ColumnPanel.svelte +32 -32
  88. package/dist/Components/Table/Misc/ColumnPanelModal.svelte +29 -29
  89. package/dist/Components/Table/Misc/FilterInput.svelte +326 -326
  90. package/dist/Components/Table/Misc/FilterPanel.svelte +79 -79
  91. package/dist/Components/Table/Misc/FilterPanelModal.svelte +21 -21
  92. package/dist/Components/Table/Misc/ShareViewModal.svelte +118 -118
  93. package/dist/Components/Table/Misc/SidePanel.svelte +24 -24
  94. package/dist/Components/Table/Misc/TableConfigurationModal.svelte +318 -318
  95. package/dist/Components/Table/Misc/TableFooter.svelte +201 -201
  96. package/dist/Components/Table/Misc/TableHorizontalBar.svelte +112 -112
  97. package/dist/Components/Table/Misc/TableSidebar.svelte +116 -116
  98. package/dist/Components/Table/Misc/TableViewDropdown.svelte +25 -25
  99. package/dist/Components/Table/Misc/ToolboxPanel.svelte +60 -60
  100. package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +63 -63
  101. package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +101 -101
  102. package/dist/Components/Table/NestedTable.svelte +29 -29
  103. package/dist/Components/Table/Table.svelte +140 -140
  104. package/dist/Components/Test/TestContextConsumer.svelte +8 -8
  105. package/dist/Components/TextArea.svelte +92 -90
  106. package/dist/Components/TextInput.svelte +128 -117
  107. package/dist/Components/ThreeStateRadio.svelte +101 -101
  108. package/dist/Components/Touch/BoolCard.svelte +27 -27
  109. package/dist/Components/Touch/DateModal.svelte +98 -98
  110. package/dist/Components/Touch/EditCard.svelte +44 -44
  111. package/dist/Components/Touch/InfoCard.svelte +25 -25
  112. package/dist/Components/Touch/InfoTextCard.svelte +22 -22
  113. package/dist/Components/Touch/ModalExplanation.svelte +13 -13
  114. package/dist/Components/Touch/NumberKeyboard.svelte +81 -81
  115. package/dist/Components/Touch/NumberModal.svelte +49 -49
  116. package/dist/Components/Touch/PlusMinusCard.svelte +40 -40
  117. package/dist/Components/Touch/SelectModal.svelte +86 -86
  118. package/dist/Components/Touch/SummaryCard.svelte +74 -74
  119. package/dist/Components/Touch/TextAreaModal.svelte +53 -53
  120. package/dist/Components/Touch/TextModal.svelte +56 -56
  121. package/dist/Components/Touch/TouchCard.svelte +28 -28
  122. package/dist/Components/Touch/TouchModal.svelte +141 -141
  123. package/dist/Components/Touch/UtilityButton.svelte +63 -63
  124. package/dist/Components/VerticalTabGroup.svelte +38 -38
  125. package/dist/Components/VerticalTabGroupButton.svelte +46 -46
  126. package/dist/Helpers/Datamatrix.d.ts +19 -19
  127. package/dist/Helpers/Datamatrix.js +291 -291
  128. package/dist/Types/Examples/ExampleModal.svelte +27 -27
  129. package/dist/paraglide/README.md +1 -1
  130. package/dist/scss/_basics.scss +12 -12
  131. package/dist/scss/_colours.scss +140 -140
  132. package/dist/scss/_motion.scss +57 -57
  133. package/dist/scss/_sizing.scss +85 -85
  134. package/dist/scss/_transitions.scss +8 -8
  135. 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>&nbsp;- {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>&nbsp;- {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
- <textarea
51
- class:noresize
52
- class:uppercase
53
- class:invalid={isInvalid}
54
- class:select-none={selectNone}
55
- class:left-pad={leftIcon != undefined}
56
- class:right-pad={rightIcon != undefined}
57
- class:for-default={variant === InputVariant.Default}
58
- class:for-modal={variant == InputVariant.Modal}
59
- class:max-width={maxWidth}
60
- autocomplete={autocomplete ?? 'off'}
61
- spellcheck={spellcheck ?? true}
62
- aria-invalid={isInvalid || undefined}
63
- bind:value
64
- {onblur}
65
- {onfocus}
66
- {onkeydown}
67
- {oninput}
68
- {rows}
69
- bind:this={textAreaRef}
70
- {placeholder}
71
- {required}
72
- {disabled}
73
- ></textarea>
74
- {#if rightIcon}
75
- <Icon
76
- name={rightIcon.name}
77
- size={rightIcon.size ?? Size.Medium}
78
- colour={rightIcon.colour}
79
- float
80
- right={cssLength(variant == InputVariant.Modal ? '1rem' : '0.5rem')}
81
- top={cssLength('50%')}
82
- anchorX={cssLength('0')}
83
- anchorY={cssLength('-50%')}
84
- clickable={!!onRightIconClick}
85
- onclick={onRightIconClick}
86
- />
87
- {/if}
88
- {#if labelRight}
89
- <span
90
- class="right-label"
91
- class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
92
- >
93
- {/if}
94
- </div>
95
- </label>
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>&nbsp;- {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>&nbsp;- {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>&nbsp;- {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>&nbsp;- {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
- <input
68
- {id}
69
- class:for-default={variant === InputVariant.Default}
70
- class:uppercase
71
- class:invalid={isInvalid}
72
- class:select-none={selectNone}
73
- class:left-pad={leftIcon != undefined}
74
- class:right-pad={rightIcon != undefined}
75
- class:for-modal={variant == InputVariant.Modal}
76
- data-type={dataType}
77
- type={type ?? 'text'}
78
- autocomplete={autocomplete ?? (type === 'email' ? 'email' : 'off')}
79
- spellcheck={spellcheck ?? false}
80
- aria-invalid={isInvalid || undefined}
81
- bind:value
82
- {onblur}
83
- {onfocus}
84
- {onkeydown}
85
- {oninput}
86
- bind:this={inputRef}
87
- {placeholder}
88
- {required}
89
- {disabled}
90
- />
91
- {#if rightIcon}
92
- <div class="right-icon">
93
- {#if onRightIconClick}
94
- <Action
95
- noTabIndex
96
- colourSet={ColourSet.Auxiliary}
97
- disabled={rightIconDisabled}
98
- icon={rightIcon}
99
- size={Size.Medium}
100
- onclick={onRightIconClick}
101
- />
102
- {:else}
103
- <Icon
104
- name={rightIcon.name}
105
- size={rightIcon.size ?? Size.Medium}
106
- colour={rightIcon.colour ?? Colour['$font-disabled']}
107
- float
108
- right={cssLength(variant == InputVariant.Modal ? '1rem' : '0.5rem')}
109
- top={cssLength('50%')}
110
- anchorX={cssLength('0')}
111
- anchorY={cssLength('-50%')}
112
- />
113
- {/if}
114
- </div>
115
- {/if}
116
- {#if labelRight}
117
- <span
118
- class="right-label"
119
- class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
120
- >
121
- {/if}
122
- </div>
123
- </label>
124
- </div>
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>&nbsp;- {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>&nbsp;- {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>