@lavalogic/scoria 0.40.0 → 0.40.2

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 (137) hide show
  1. package/README.md +58 -58
  2. package/dist/Components/AccordionGroup.svelte +46 -46
  3. package/dist/Components/AccordionGroupButton.svelte +76 -76
  4. package/dist/Components/Action.svelte +136 -136
  5. package/dist/Components/AlertModal.svelte +195 -195
  6. package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +729 -729
  7. package/dist/Components/Base/BaseModal.svelte +125 -125
  8. package/dist/Components/Base/ContextWrapper.svelte +72 -72
  9. package/dist/Components/Base/Pagination.svelte +198 -198
  10. package/dist/Components/Base/Snippets.svelte +36 -36
  11. package/dist/Components/BigRadioSet.svelte +38 -38
  12. package/dist/Components/Bubble.svelte +101 -101
  13. package/dist/Components/Button.svelte +209 -209
  14. package/dist/Components/Checkbox.svelte +86 -86
  15. package/dist/Components/CollapsibleCard.svelte +78 -78
  16. package/dist/Components/Contexts/ContextMenu.svelte +164 -164
  17. package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
  18. package/dist/Components/Contexts/ContextMenuOption.svelte +60 -60
  19. package/dist/Components/Contexts/Toast.svelte +86 -86
  20. package/dist/Components/Contexts/ToastContainer.svelte +65 -65
  21. package/dist/Components/Contexts/Tooltip.svelte +37 -37
  22. package/dist/Components/DataMatrixIcon.svelte +112 -112
  23. package/dist/Components/DateInput.svelte +148 -148
  24. package/dist/Components/DatePicker.svelte +300 -300
  25. package/dist/Components/DesktopModal.svelte +90 -90
  26. package/dist/Components/Dial.svelte +204 -204
  27. package/dist/Components/DimensionInput.svelte +170 -170
  28. package/dist/Components/DragMenu/DragMenuHolder.svelte +119 -119
  29. package/dist/Components/DragMenu/DraggableCard.svelte +77 -77
  30. package/dist/Components/FileCard.svelte +24 -24
  31. package/dist/Components/FileUpload.svelte +236 -236
  32. package/dist/Components/GridInput.svelte +196 -196
  33. package/dist/Components/GridInputSet.svelte +29 -29
  34. package/dist/Components/HorizontalTabGroup.svelte +82 -82
  35. package/dist/Components/HorizontalTabGroupButton.svelte +44 -44
  36. package/dist/Components/Icon.svelte +128 -128
  37. package/dist/Components/Icons.js +357 -357
  38. package/dist/Components/InfoAlert.svelte +35 -35
  39. package/dist/Components/LoadingAnimation.svelte +29 -29
  40. package/dist/Components/LoadingModal.svelte +45 -45
  41. package/dist/Components/LoadingOverlay.svelte +25 -25
  42. package/dist/Components/Modal.svelte +258 -258
  43. package/dist/Components/MultiSelect.svelte +220 -220
  44. package/dist/Components/Nav/Nav.svelte +110 -110
  45. package/dist/Components/Nav/NavServiceMenuList.svelte +43 -43
  46. package/dist/Components/Nav/NavTab.svelte +62 -62
  47. package/dist/Components/Nav/ServiceMenuItem.svelte +112 -112
  48. package/dist/Components/Nav/ServicesNav.svelte +80 -80
  49. package/dist/Components/NumberInput.svelte +157 -157
  50. package/dist/Components/PageHeading.svelte +25 -25
  51. package/dist/Components/PasswordInput.svelte +88 -88
  52. package/dist/Components/Portal.svelte +36 -36
  53. package/dist/Components/ProgressBubble.svelte +107 -107
  54. package/dist/Components/QuerySelect.svelte +366 -366
  55. package/dist/Components/SingleSelect.svelte +250 -250
  56. package/dist/Components/StepButton.svelte +70 -70
  57. package/dist/Components/StepForm.svelte +140 -140
  58. package/dist/Components/Switch.svelte +69 -69
  59. package/dist/Components/Table/ARCHITECTURE.md +298 -298
  60. package/dist/Components/Table/Body/QuickSearchCell.svelte +679 -679
  61. package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +51 -51
  62. package/dist/Components/Table/Body/Rows/ColumnList.svelte +59 -59
  63. package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +454 -454
  64. package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +79 -79
  65. package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +185 -185
  66. package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +124 -124
  67. package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +131 -120
  68. package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +234 -234
  69. package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +105 -105
  70. package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +87 -87
  71. package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +126 -126
  72. package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +159 -159
  73. package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +246 -246
  74. package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +216 -216
  75. package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +252 -252
  76. package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +179 -179
  77. package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +221 -221
  78. package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +197 -197
  79. package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +190 -190
  80. package/dist/Components/Table/Body/Rows/TableRow.svelte +290 -290
  81. package/dist/Components/Table/Body/TableBody.svelte +155 -155
  82. package/dist/Components/Table/ColumnFactory.svelte.js +1 -0
  83. package/dist/Components/Table/Headers/HighlightAllHeader.svelte +41 -41
  84. package/dist/Components/Table/Headers/SelectAllHeader.svelte +30 -30
  85. package/dist/Components/Table/Headers/TableHead.svelte +415 -415
  86. package/dist/Components/Table/Misc/ColumnPanel.svelte +39 -39
  87. package/dist/Components/Table/Misc/ColumnPanelModal.svelte +39 -39
  88. package/dist/Components/Table/Misc/FilterInput.svelte +641 -641
  89. package/dist/Components/Table/Misc/FilterPanel.svelte +190 -190
  90. package/dist/Components/Table/Misc/FilterPanelModal.svelte +31 -31
  91. package/dist/Components/Table/Misc/ShareViewModal.svelte +291 -291
  92. package/dist/Components/Table/Misc/SidePanel.svelte +35 -35
  93. package/dist/Components/Table/Misc/TableConfigurationModal.svelte +644 -644
  94. package/dist/Components/Table/Misc/TableFooter.svelte +340 -340
  95. package/dist/Components/Table/Misc/TableHorizontalBar.svelte +140 -140
  96. package/dist/Components/Table/Misc/TableSidebar.svelte +200 -200
  97. package/dist/Components/Table/Misc/TableViewDropdown.svelte +105 -105
  98. package/dist/Components/Table/Misc/ToolboxPanel.svelte +100 -100
  99. package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +107 -107
  100. package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +192 -192
  101. package/dist/Components/Table/NestedTable.svelte +130 -130
  102. package/dist/Components/Table/Table.svelte +692 -692
  103. package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.d.ts +5 -0
  104. package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.js +3 -0
  105. package/dist/Components/Table/Types/Public/ColumnOptions.d.ts +10 -0
  106. package/dist/Components/Test/TestContextConsumer.svelte +13 -13
  107. package/dist/Components/TextArea.svelte +130 -130
  108. package/dist/Components/TextInput.svelte +176 -176
  109. package/dist/Components/ThreeStateRadio.svelte +131 -131
  110. package/dist/Components/Touch/BoolCard.svelte +45 -45
  111. package/dist/Components/Touch/DateModal.svelte +209 -209
  112. package/dist/Components/Touch/EditCard.svelte +59 -59
  113. package/dist/Components/Touch/InfoCard.svelte +31 -31
  114. package/dist/Components/Touch/InfoTextCard.svelte +28 -28
  115. package/dist/Components/Touch/ModalExplanation.svelte +17 -17
  116. package/dist/Components/Touch/NumberKeyboard.svelte +225 -225
  117. package/dist/Components/Touch/NumberModal.svelte +79 -79
  118. package/dist/Components/Touch/PlusMinusCard.svelte +46 -46
  119. package/dist/Components/Touch/SelectModal.svelte +127 -127
  120. package/dist/Components/Touch/SummaryCard.svelte +93 -93
  121. package/dist/Components/Touch/TextAreaModal.svelte +95 -95
  122. package/dist/Components/Touch/TextModal.svelte +106 -106
  123. package/dist/Components/Touch/TouchCard.svelte +33 -33
  124. package/dist/Components/Touch/TouchModal.svelte +274 -274
  125. package/dist/Components/Touch/UtilityButton.svelte +109 -109
  126. package/dist/Components/VerticalTabGroup.svelte +79 -79
  127. package/dist/Components/VerticalTabGroupButton.svelte +58 -58
  128. package/dist/Helpers/Datamatrix.d.ts +19 -19
  129. package/dist/Helpers/Datamatrix.js +291 -291
  130. package/dist/Types/Examples/ExampleModal.svelte +35 -35
  131. package/dist/scss/_basics.scss +12 -12
  132. package/dist/scss/_colours.scss +134 -134
  133. package/dist/scss/_mixins.scss +3392 -3392
  134. package/dist/scss/_motion.scss +57 -57
  135. package/dist/scss/_sizing.scss +85 -85
  136. package/dist/scss/_transitions.scss +8 -8
  137. package/package.json +1 -1
@@ -1,178 +1,178 @@
1
- <svelte:options runes />
2
-
3
- <script lang="ts">
4
- import { cssLength, 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
- leftIcon,
27
- rightIcon,
28
- type,
29
- onLeftIconClick,
30
- onRightIconClick,
31
- inputRef = $bindable(),
32
- 'data-type': dataType,
33
- autocomplete,
34
- spellcheck,
35
- onblur,
36
- onfocus,
37
- // No default `onkeydown`. The legacy default was `passthrough`,
38
- // a helper that BLURS the target on every alphanumeric key (it is
39
- // a barcode-scanner aid intended for buttons - note the
40
- // `as HTMLButtonElement` cast inside it). Applied to a text input
41
- // it makes the field unusable: each keystroke blurs the input
42
- // before the value can update, so users see nothing as they type.
43
- // Inputs should accept keystrokes by default; consumers that want
44
- // the barcode-blur behaviour explicitly pass
45
- // `onkeydown={passthrough}` (preferably renamed to
46
- // `blurOnAlphanumeric` in a future patch).
47
- onkeydown,
48
- oninput,
49
- }: TextInputProps = $props();
50
-
51
- const isInvalid = $derived(
52
- showErrorColours &&
53
- !disabled &&
54
- ((required &&
55
- (!value?.trim() ||
56
- (type == 'email' &&
57
- value.length >= 3 &&
58
- value.includes('@') &&
59
- !isValidEmailAddress(value)))) ||
60
- invalid)
61
- );
62
- </script>
63
-
64
- <div
65
- class="error-wrapper"
66
- class:for-modal={variant == InputVariant.Modal}
67
- class:for-table={variant == InputVariant.Table}
68
- >
69
- <label
70
- class:for-modal={variant == InputVariant.Modal}
71
- class:for-table={variant == InputVariant.Table}
72
- >
73
- {#if labelTop}
74
- <span
75
- class="top-label"
76
- class:for-default={variant === InputVariant.Default}
77
- class:invalid={isInvalid}
78
- >{labelTop}{#if optional}<i>&nbsp;- optional</i>{/if}</span
79
- >
80
- {#if variant === InputVariant.Default}
81
- <span
82
- aria-hidden="true"
83
- class="border"
84
- class:invalid={isInvalid}
85
- >{labelTop}{#if optional}<i>&nbsp;- optional</i>{/if}</span
86
- >
87
- {/if}
88
- {/if}
89
- <div
90
- class="icon-container"
91
- class:for-modal={variant == InputVariant.Modal}
92
- >
93
- {#if leftIcon}
94
- {#if onLeftIconClick}
95
- <div class="left-icon">
96
- <Action
97
- noTabIndex
98
- colourSet={ColourSet.Auxiliary}
99
- icon={leftIcon}
100
- size={Size.Medium}
101
- onclick={onLeftIconClick}
102
- />
103
- </div>
104
- {:else}
105
- <Icon
106
- name={leftIcon.name}
107
- size={leftIcon.size ?? Size.Medium}
108
- colour={leftIcon.colour}
109
- float
110
- left={cssLength('0.75rem')}
111
- top={cssLength('50%')}
112
- anchorX={cssLength('0')}
113
- anchorY={cssLength('-50%')}
114
- />
115
- {/if}
116
- {/if}
117
- <input
118
- {id}
119
- class:for-default={variant === InputVariant.Default}
120
- class:uppercase
121
- class:invalid={isInvalid}
122
- class:select-none={selectNone}
123
- class:left-pad={leftIcon != undefined}
124
- class:right-pad={rightIcon != undefined}
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">
4
+ import { cssLength, 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
+ leftIcon,
27
+ rightIcon,
28
+ type,
29
+ onLeftIconClick,
30
+ onRightIconClick,
31
+ inputRef = $bindable(),
32
+ 'data-type': dataType,
33
+ autocomplete,
34
+ spellcheck,
35
+ onblur,
36
+ onfocus,
37
+ // No default `onkeydown`. The legacy default was `passthrough`,
38
+ // a helper that BLURS the target on every alphanumeric key (it is
39
+ // a barcode-scanner aid intended for buttons - note the
40
+ // `as HTMLButtonElement` cast inside it). Applied to a text input
41
+ // it makes the field unusable: each keystroke blurs the input
42
+ // before the value can update, so users see nothing as they type.
43
+ // Inputs should accept keystrokes by default; consumers that want
44
+ // the barcode-blur behaviour explicitly pass
45
+ // `onkeydown={passthrough}` (preferably renamed to
46
+ // `blurOnAlphanumeric` in a future patch).
47
+ onkeydown,
48
+ oninput,
49
+ }: TextInputProps = $props();
50
+
51
+ const isInvalid = $derived(
52
+ showErrorColours &&
53
+ !disabled &&
54
+ ((required &&
55
+ (!value?.trim() ||
56
+ (type == 'email' &&
57
+ value.length >= 3 &&
58
+ value.includes('@') &&
59
+ !isValidEmailAddress(value)))) ||
60
+ invalid)
61
+ );
62
+ </script>
63
+
64
+ <div
65
+ class="error-wrapper"
66
+ class:for-modal={variant == InputVariant.Modal}
67
+ class:for-table={variant == InputVariant.Table}
68
+ >
69
+ <label
70
+ class:for-modal={variant == InputVariant.Modal}
71
+ class:for-table={variant == InputVariant.Table}
72
+ >
73
+ {#if labelTop}
74
+ <span
75
+ class="top-label"
76
+ class:for-default={variant === InputVariant.Default}
77
+ class:invalid={isInvalid}
78
+ >{labelTop}{#if optional}<i>&nbsp;- optional</i>{/if}</span
79
+ >
80
+ {#if variant === InputVariant.Default}
81
+ <span
82
+ aria-hidden="true"
83
+ class="border"
84
+ class:invalid={isInvalid}
85
+ >{labelTop}{#if optional}<i>&nbsp;- optional</i>{/if}</span
86
+ >
87
+ {/if}
88
+ {/if}
89
+ <div
90
+ class="icon-container"
91
+ class:for-modal={variant == InputVariant.Modal}
92
+ >
93
+ {#if leftIcon}
94
+ {#if onLeftIconClick}
95
+ <div class="left-icon">
96
+ <Action
97
+ noTabIndex
98
+ colourSet={ColourSet.Auxiliary}
99
+ icon={leftIcon}
100
+ size={Size.Medium}
101
+ onclick={onLeftIconClick}
102
+ />
103
+ </div>
104
+ {:else}
105
+ <Icon
106
+ name={leftIcon.name}
107
+ size={leftIcon.size ?? Size.Medium}
108
+ colour={leftIcon.colour}
109
+ float
110
+ left={cssLength('0.75rem')}
111
+ top={cssLength('50%')}
112
+ anchorX={cssLength('0')}
113
+ anchorY={cssLength('-50%')}
114
+ />
115
+ {/if}
116
+ {/if}
117
+ <input
118
+ {id}
119
+ class:for-default={variant === InputVariant.Default}
120
+ class:uppercase
121
+ class:invalid={isInvalid}
122
+ class:select-none={selectNone}
123
+ class:left-pad={leftIcon != undefined}
124
+ class:right-pad={rightIcon != undefined}
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
+
176
176
  <style>input {
177
177
  box-sizing: border-box;
178
178
  height: 100%;
@@ -406,4 +406,4 @@ label.for-table input {
406
406
 
407
407
  td {
408
408
  --input-border: none;
409
- }</style>
409
+ }</style>
@@ -1,133 +1,133 @@
1
- <svelte:options runes />
2
-
3
- <script
4
- lang="ts"
5
- module
6
- >
7
- import { Colour, ColourSet } from '../scss/colours.js';
8
- import { Ternary } from '../Types/Internal/Ternary.js';
9
- import Action from './Action.svelte';
10
- import type { ThreeStateRadioProps } from './ThreeStateRadioProps.js';
11
- </script>
12
-
13
- <script lang="ts">
14
- let {
15
- value = $bindable(Ternary.Neutral),
16
- label,
17
- disabled,
18
- isValid,
19
- onchange,
20
- noDisabled = false,
21
- yesDisabled = false,
22
- neutralDisabled = false,
23
- noLabel,
24
- yesLabel,
25
- neutralLabel,
26
- noIcon,
27
- yesIcon,
28
- neutralIcon,
29
- }: ThreeStateRadioProps = $props();
30
-
31
- function setValue(next: Ternary): void {
32
- if (next === value) {
33
- return;
34
- }
35
- value = next;
36
- void onchange?.(next);
37
- }
38
- </script>
39
-
40
- <div
41
- class="text-label"
42
- class:invalid={isValid === false}
43
- >
44
- {#if label != undefined}
45
- <span>{label}</span>
46
- {/if}
47
-
48
- <div
49
- class="radios"
50
- role="radiogroup"
51
- aria-label={label}
52
- >
53
- <label>
54
- <Action
55
- disabled={disabled || noDisabled}
56
- colourSet={value === Ternary.False ? ColourSet.Primary : ColourSet.Auxiliary}
57
- icon={{
58
- name: 'circle-cross',
59
- ...noIcon,
60
- colour: value === Ternary.False ? undefined : Colour['$ui-blue-5'],
61
- }}
62
- label={noLabel ?? 'No'}
63
- onclick={() => {
64
- setValue(Ternary.False);
65
- }}
66
- />
67
- <input
68
- disabled={disabled || noDisabled}
69
- type="radio"
70
- value="0"
71
- checked={value === Ternary.False}
72
- aria-label={noLabel ?? 'No'}
73
- onchange={() => {
74
- setValue(Ternary.False);
75
- }}
76
- />
77
- </label>
78
- <label>
79
- <Action
80
- disabled={disabled || neutralDisabled}
81
- colourSet={value === Ternary.Neutral ? ColourSet.Primary : ColourSet.Auxiliary}
82
- icon={{
83
- name: 'database',
84
- ...neutralIcon,
85
- colour: value === Ternary.Neutral ? undefined : Colour['$ui-blue-5'],
86
- }}
87
- label={neutralLabel ?? 'Allow system to decide'}
88
- onclick={() => {
89
- setValue(Ternary.Neutral);
90
- }}
91
- />
92
- <input
93
- disabled={disabled || neutralDisabled}
94
- type="radio"
95
- value="-1"
96
- checked={value === Ternary.Neutral}
97
- aria-label={neutralLabel ?? 'Allow system to decide'}
98
- onchange={() => {
99
- setValue(Ternary.Neutral);
100
- }}
101
- />
102
- </label>
103
- <label>
104
- <Action
105
- disabled={disabled || yesDisabled}
106
- colourSet={value === Ternary.True ? ColourSet.Primary : ColourSet.Auxiliary}
107
- icon={{
108
- name: 'circle-tick',
109
- ...yesIcon,
110
- colour: value === Ternary.True ? undefined : Colour['$ui-blue-5'],
111
- }}
112
- label={yesLabel ?? 'Yes'}
113
- onclick={() => {
114
- setValue(Ternary.True);
115
- }}
116
- />
117
- <input
118
- disabled={disabled || yesDisabled}
119
- type="radio"
120
- value="1"
121
- checked={value === Ternary.True}
122
- aria-label={yesLabel ?? 'Yes'}
123
- onchange={() => {
124
- setValue(Ternary.True);
125
- }}
126
- />
127
- </label>
128
- </div>
129
- </div>
130
-
1
+ <svelte:options runes />
2
+
3
+ <script
4
+ lang="ts"
5
+ module
6
+ >
7
+ import { Colour, ColourSet } from '../scss/colours.js';
8
+ import { Ternary } from '../Types/Internal/Ternary.js';
9
+ import Action from './Action.svelte';
10
+ import type { ThreeStateRadioProps } from './ThreeStateRadioProps.js';
11
+ </script>
12
+
13
+ <script lang="ts">
14
+ let {
15
+ value = $bindable(Ternary.Neutral),
16
+ label,
17
+ disabled,
18
+ isValid,
19
+ onchange,
20
+ noDisabled = false,
21
+ yesDisabled = false,
22
+ neutralDisabled = false,
23
+ noLabel,
24
+ yesLabel,
25
+ neutralLabel,
26
+ noIcon,
27
+ yesIcon,
28
+ neutralIcon,
29
+ }: ThreeStateRadioProps = $props();
30
+
31
+ function setValue(next: Ternary): void {
32
+ if (next === value) {
33
+ return;
34
+ }
35
+ value = next;
36
+ void onchange?.(next);
37
+ }
38
+ </script>
39
+
40
+ <div
41
+ class="text-label"
42
+ class:invalid={isValid === false}
43
+ >
44
+ {#if label != undefined}
45
+ <span>{label}</span>
46
+ {/if}
47
+
48
+ <div
49
+ class="radios"
50
+ role="radiogroup"
51
+ aria-label={label}
52
+ >
53
+ <label>
54
+ <Action
55
+ disabled={disabled || noDisabled}
56
+ colourSet={value === Ternary.False ? ColourSet.Primary : ColourSet.Auxiliary}
57
+ icon={{
58
+ name: 'circle-cross',
59
+ ...noIcon,
60
+ colour: value === Ternary.False ? undefined : Colour['$ui-blue-5'],
61
+ }}
62
+ label={noLabel ?? 'No'}
63
+ onclick={() => {
64
+ setValue(Ternary.False);
65
+ }}
66
+ />
67
+ <input
68
+ disabled={disabled || noDisabled}
69
+ type="radio"
70
+ value="0"
71
+ checked={value === Ternary.False}
72
+ aria-label={noLabel ?? 'No'}
73
+ onchange={() => {
74
+ setValue(Ternary.False);
75
+ }}
76
+ />
77
+ </label>
78
+ <label>
79
+ <Action
80
+ disabled={disabled || neutralDisabled}
81
+ colourSet={value === Ternary.Neutral ? ColourSet.Primary : ColourSet.Auxiliary}
82
+ icon={{
83
+ name: 'database',
84
+ ...neutralIcon,
85
+ colour: value === Ternary.Neutral ? undefined : Colour['$ui-blue-5'],
86
+ }}
87
+ label={neutralLabel ?? 'Allow system to decide'}
88
+ onclick={() => {
89
+ setValue(Ternary.Neutral);
90
+ }}
91
+ />
92
+ <input
93
+ disabled={disabled || neutralDisabled}
94
+ type="radio"
95
+ value="-1"
96
+ checked={value === Ternary.Neutral}
97
+ aria-label={neutralLabel ?? 'Allow system to decide'}
98
+ onchange={() => {
99
+ setValue(Ternary.Neutral);
100
+ }}
101
+ />
102
+ </label>
103
+ <label>
104
+ <Action
105
+ disabled={disabled || yesDisabled}
106
+ colourSet={value === Ternary.True ? ColourSet.Primary : ColourSet.Auxiliary}
107
+ icon={{
108
+ name: 'circle-tick',
109
+ ...yesIcon,
110
+ colour: value === Ternary.True ? undefined : Colour['$ui-blue-5'],
111
+ }}
112
+ label={yesLabel ?? 'Yes'}
113
+ onclick={() => {
114
+ setValue(Ternary.True);
115
+ }}
116
+ />
117
+ <input
118
+ disabled={disabled || yesDisabled}
119
+ type="radio"
120
+ value="1"
121
+ checked={value === Ternary.True}
122
+ aria-label={yesLabel ?? 'Yes'}
123
+ onchange={() => {
124
+ setValue(Ternary.True);
125
+ }}
126
+ />
127
+ </label>
128
+ </div>
129
+ </div>
130
+
131
131
  <style>.text-label {
132
132
  box-sizing: border-box;
133
133
  height: max(var(--input-height, 3rem), 2rem);
@@ -198,4 +198,4 @@ input {
198
198
  clip-path: rect(0 0 0 0);
199
199
  white-space: nowrap;
200
200
  border: 0;
201
- }</style>
201
+ }</style>