@lavalogic/scoria 0.40.1 → 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,95 +1,95 @@
1
- <svelte:options runes />
2
-
3
- <script
4
- module
5
- lang="ts"
6
- >
7
- import { passthrough } from '../../Helpers/Helpers.svelte.js';
8
- import { Size } from '../../Types/Internal/Size.js';
9
- import Icon from '../Icon.svelte';
10
- import type { SummaryCardProps } from './SummaryCardProps.js';
11
-
12
- // CSS handles the dot-leader rendering via a flex pseudo element. We no
13
- // longer interpolate a 108-character literal of dots into the markup.
14
- </script>
15
-
16
- <script lang="ts">
17
- const {
18
- bubbles,
19
- desktop = false,
20
- heading,
21
- icon,
22
- keyValues,
23
- editable = false,
24
- error = false,
25
- onclick,
26
- }: SummaryCardProps = $props();
27
- </script>
28
-
29
- {#snippet _heading()}
30
- {#if desktop}
31
- <span
32
- class="desktop-heading"
33
- class:invalid={error}>{heading}</span
34
- >
35
- <span
36
- class="desktop-heading-border"
37
- class:invalid={error}>{heading}</span
38
- >
39
- {:else}
40
- {#if bubbles}
41
- {#each bubbles as bubble (bubble)}
42
- <div class="card-detail">{bubble}</div>
43
- {/each}
44
- {/if}
45
-
46
- <div class="card-row heading">
47
- <h3>{heading}</h3>
48
- {#if editable}
49
- <Icon
50
- name="edit"
51
- size={Size.DoubleXLarge}
52
- />
53
- {/if}
54
- </div>
55
- {/if}
56
- {/snippet}
57
-
58
- <button
59
- class:desktop
60
- onkeydown={passthrough}
61
- {onclick}
62
- class="summary-card"
63
- class:error
64
- aria-label={onclick ? heading : undefined}
65
- type="button"
66
- >
67
- <!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
68
- {@render _heading()}
69
- <div class="columns">
70
- <div class="left">
71
- {#each keyValues as { key, value } (key)}
72
- <div class="card-row detail">
73
- <span class="key">{key}</span>
74
- <span
75
- class="leader"
76
- aria-hidden="true"
77
- ></span>
78
- <span class="value">{value}</span>
79
- </div>
80
- {/each}
81
- </div>
82
- {#if icon}
83
- <div class="right">
84
- <Icon
85
- name={icon}
86
- size={Size.Medium}
87
- />
88
- </div>
89
- {/if}
90
- </div>
91
- </button>
92
-
1
+ <svelte:options runes />
2
+
3
+ <script
4
+ module
5
+ lang="ts"
6
+ >
7
+ import { passthrough } from '../../Helpers/Helpers.svelte.js';
8
+ import { Size } from '../../Types/Internal/Size.js';
9
+ import Icon from '../Icon.svelte';
10
+ import type { SummaryCardProps } from './SummaryCardProps.js';
11
+
12
+ // CSS handles the dot-leader rendering via a flex pseudo element. We no
13
+ // longer interpolate a 108-character literal of dots into the markup.
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ const {
18
+ bubbles,
19
+ desktop = false,
20
+ heading,
21
+ icon,
22
+ keyValues,
23
+ editable = false,
24
+ error = false,
25
+ onclick,
26
+ }: SummaryCardProps = $props();
27
+ </script>
28
+
29
+ {#snippet _heading()}
30
+ {#if desktop}
31
+ <span
32
+ class="desktop-heading"
33
+ class:invalid={error}>{heading}</span
34
+ >
35
+ <span
36
+ class="desktop-heading-border"
37
+ class:invalid={error}>{heading}</span
38
+ >
39
+ {:else}
40
+ {#if bubbles}
41
+ {#each bubbles as bubble (bubble)}
42
+ <div class="card-detail">{bubble}</div>
43
+ {/each}
44
+ {/if}
45
+
46
+ <div class="card-row heading">
47
+ <h3>{heading}</h3>
48
+ {#if editable}
49
+ <Icon
50
+ name="edit"
51
+ size={Size.DoubleXLarge}
52
+ />
53
+ {/if}
54
+ </div>
55
+ {/if}
56
+ {/snippet}
57
+
58
+ <button
59
+ class:desktop
60
+ onkeydown={passthrough}
61
+ {onclick}
62
+ class="summary-card"
63
+ class:error
64
+ aria-label={onclick ? heading : undefined}
65
+ type="button"
66
+ >
67
+ <!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
68
+ {@render _heading()}
69
+ <div class="columns">
70
+ <div class="left">
71
+ {#each keyValues as { key, value } (key)}
72
+ <div class="card-row detail">
73
+ <span class="key">{key}</span>
74
+ <span
75
+ class="leader"
76
+ aria-hidden="true"
77
+ ></span>
78
+ <span class="value">{value}</span>
79
+ </div>
80
+ {/each}
81
+ </div>
82
+ {#if icon}
83
+ <div class="right">
84
+ <Icon
85
+ name={icon}
86
+ size={Size.Medium}
87
+ />
88
+ </div>
89
+ {/if}
90
+ </div>
91
+ </button>
92
+
93
93
  <style>ul {
94
94
  list-style: none;
95
95
  display: flex;
@@ -370,4 +370,4 @@ button.summary-card h3 {
370
370
  border-bottom: 1px dotted #647d8e;
371
371
  margin: 0 0.375rem;
372
372
  transform: translateY(-0.25em);
373
- }</style>
373
+ }</style>
@@ -1,97 +1,97 @@
1
- <svelte:options runes />
2
-
3
- <script lang="ts">
4
- import { useAsyncFlag } from '../../Helpers/AsyncFlag.svelte.js';
5
- import { devCatch, passthrough } from '../../Helpers/Helpers.svelte.js';
6
- import { Colour } from '../../scss/colours.js';
7
- import { InputVariant } from '../../Types/Internal/InputVariant.js';
8
- import { Size } from '../../Types/Internal/Size.js';
9
- import { onMount, tick } from 'svelte';
10
- import TextArea from '../TextArea.svelte';
11
- import type { TextAreaModalProps } from './TextAreaModalProps.js';
12
- import TouchModal from './TouchModal.svelte';
13
-
14
- let {
15
- header,
16
- value = $bindable(''),
17
- label,
18
- placeholder,
19
- cancelEditing,
20
- confirm,
21
- uppercase = false,
22
- textAreaRef = $bindable(),
23
- isValid: _isValid = true,
24
- explanation,
25
- }: TextAreaModalProps = $props();
26
-
27
- onMount(() => {
28
- tick()
29
- .then(() => {
30
- textAreaRef?.select();
31
- })
32
- .catch(devCatch);
33
- });
34
-
35
- async function resetValue() {
36
- value = '';
37
- await tick();
38
- textAreaRef?.select();
39
- }
40
-
41
- const isValid = useAsyncFlag(
42
- () => (typeof _isValid === 'function' ? _isValid(value) : _isValid),
43
- true
44
- );
45
- </script>
46
-
47
- <TouchModal
48
- onclose={() => {
49
- cancelEditing();
50
- }}
51
- {header}
52
- mandatory
53
- minHeight="400px"
54
- minWidth="600px"
55
- onsubmit={(e: SubmitEvent) => {
56
- e.preventDefault();
57
- confirm(value);
58
- }}
59
- {explanation}
60
- >
61
- <TextArea
62
- {uppercase}
63
- labelTop={label}
64
- {placeholder}
65
- bind:value
66
- variant={InputVariant.Modal}
67
- bind:textAreaRef
68
- invalid={!isValid.value}
69
- rightIcon={{
70
- name: 'cross',
71
- size: Size.Large,
72
- colour: Colour['$font-primary'],
73
- }}
74
- onRightIconClick={resetValue}
75
- />
76
-
77
- {#snippet footer()}
78
- <div class="modal-footer">
79
- <button
80
- onkeydown={passthrough}
81
- type="submit"
82
- disabled={!isValid.value}>Confirm</button
83
- >
84
- <button
85
- onkeydown={passthrough}
86
- type="button"
87
- onclick={() => {
88
- cancelEditing();
89
- }}>Cancel</button
90
- >
91
- </div>
92
- {/snippet}
93
- </TouchModal>
94
-
1
+ <svelte:options runes />
2
+
3
+ <script lang="ts">
4
+ import { useAsyncFlag } from '../../Helpers/AsyncFlag.svelte.js';
5
+ import { devCatch, passthrough } from '../../Helpers/Helpers.svelte.js';
6
+ import { Colour } from '../../scss/colours.js';
7
+ import { InputVariant } from '../../Types/Internal/InputVariant.js';
8
+ import { Size } from '../../Types/Internal/Size.js';
9
+ import { onMount, tick } from 'svelte';
10
+ import TextArea from '../TextArea.svelte';
11
+ import type { TextAreaModalProps } from './TextAreaModalProps.js';
12
+ import TouchModal from './TouchModal.svelte';
13
+
14
+ let {
15
+ header,
16
+ value = $bindable(''),
17
+ label,
18
+ placeholder,
19
+ cancelEditing,
20
+ confirm,
21
+ uppercase = false,
22
+ textAreaRef = $bindable(),
23
+ isValid: _isValid = true,
24
+ explanation,
25
+ }: TextAreaModalProps = $props();
26
+
27
+ onMount(() => {
28
+ tick()
29
+ .then(() => {
30
+ textAreaRef?.select();
31
+ })
32
+ .catch(devCatch);
33
+ });
34
+
35
+ async function resetValue() {
36
+ value = '';
37
+ await tick();
38
+ textAreaRef?.select();
39
+ }
40
+
41
+ const isValid = useAsyncFlag(
42
+ () => (typeof _isValid === 'function' ? _isValid(value) : _isValid),
43
+ true
44
+ );
45
+ </script>
46
+
47
+ <TouchModal
48
+ onclose={() => {
49
+ cancelEditing();
50
+ }}
51
+ {header}
52
+ mandatory
53
+ minHeight="400px"
54
+ minWidth="600px"
55
+ onsubmit={(e: SubmitEvent) => {
56
+ e.preventDefault();
57
+ confirm(value);
58
+ }}
59
+ {explanation}
60
+ >
61
+ <TextArea
62
+ {uppercase}
63
+ labelTop={label}
64
+ {placeholder}
65
+ bind:value
66
+ variant={InputVariant.Modal}
67
+ bind:textAreaRef
68
+ invalid={!isValid.value}
69
+ rightIcon={{
70
+ name: 'cross',
71
+ size: Size.Large,
72
+ colour: Colour['$font-primary'],
73
+ }}
74
+ onRightIconClick={resetValue}
75
+ />
76
+
77
+ {#snippet footer()}
78
+ <div class="modal-footer">
79
+ <button
80
+ onkeydown={passthrough}
81
+ type="submit"
82
+ disabled={!isValid.value}>Confirm</button
83
+ >
84
+ <button
85
+ onkeydown={passthrough}
86
+ type="button"
87
+ onclick={() => {
88
+ cancelEditing();
89
+ }}>Cancel</button
90
+ >
91
+ </div>
92
+ {/snippet}
93
+ </TouchModal>
94
+
95
95
  <style>dialog {
96
96
  overflow: clip;
97
97
  background-color: #e9ecf1;
@@ -339,4 +339,4 @@ button {
339
339
  display: block;
340
340
  border-width: 2px;
341
341
  border-radius: 4px;
342
- }</style>
342
+ }</style>
@@ -1,108 +1,108 @@
1
- <svelte:options runes />
2
-
3
- <script lang="ts">
4
- import { useAsyncFlag } from '../../Helpers/AsyncFlag.svelte.js';
5
- import { devCatch, passthrough } from '../../Helpers/Helpers.svelte.js';
6
- import { Colour } from '../../scss/colours.js';
7
- import { InputVariant } from '../../Types/Internal/InputVariant.js';
8
- import { Size } from '../../Types/Internal/Size.js';
9
- import { onMount, tick } from 'svelte';
10
- import TextInput from '../TextInput.svelte';
11
- import type { TextModalProps } from './TextModalProps.js';
12
- import TouchModal from './TouchModal.svelte';
13
-
14
- let {
15
- header,
16
- value = $bindable(''),
17
- label,
18
- placeholder,
19
- cancelEditing,
20
- confirm,
21
- uppercase = false,
22
- inputRef = $bindable(),
23
- isValid: _isValid = true,
24
- mandatory = true,
25
- explanation,
26
- width,
27
- minWidth,
28
- staticWidth,
29
- minHeight,
30
- height,
31
- }: TextModalProps = $props();
32
-
33
- onMount(() => {
34
- tick()
35
- .then(() => {
36
- inputRef?.select();
37
- })
38
- .catch(devCatch);
39
- });
40
-
41
- async function resetValue() {
42
- // Cleared back to empty: callers wanting reset-to-original semantics
43
- // should re-pass the original value via the bound prop.
44
- value = '';
45
- await tick();
46
- inputRef?.select();
47
- }
48
-
49
- const isValid = useAsyncFlag(
50
- () => (typeof _isValid === 'function' ? _isValid(value) : _isValid),
51
- true
52
- );
53
- </script>
54
-
55
- <TouchModal
56
- onclose={() => {
57
- cancelEditing();
58
- }}
59
- {header}
60
- {mandatory}
61
- {width}
62
- {minWidth}
63
- {staticWidth}
64
- {minHeight}
65
- {height}
66
- onsubmit={(e: SubmitEvent) => {
67
- e.preventDefault();
68
- confirm(value);
69
- }}
70
- {explanation}
71
- >
72
- <TextInput
73
- {uppercase}
74
- labelTop={label}
75
- {placeholder}
76
- variant={InputVariant.Modal}
77
- bind:inputRef
78
- bind:value
79
- showErrorColours
80
- invalid={!isValid.value}
81
- rightIcon={{
82
- name: 'cross',
83
- size: Size.Large,
84
- colour: Colour['$font-primary'],
85
- }}
86
- onRightIconClick={resetValue}
87
- />
88
- {#snippet footer()}
89
- <div class="modal-footer">
90
- <button
91
- onkeydown={passthrough}
92
- type="submit"
93
- disabled={!isValid.value}>Confirm</button
94
- >
95
- <button
96
- onkeydown={passthrough}
97
- type="button"
98
- onclick={() => {
99
- cancelEditing();
100
- }}>Cancel</button
101
- >
102
- </div>
103
- {/snippet}
104
- </TouchModal>
105
-
1
+ <svelte:options runes />
2
+
3
+ <script lang="ts">
4
+ import { useAsyncFlag } from '../../Helpers/AsyncFlag.svelte.js';
5
+ import { devCatch, passthrough } from '../../Helpers/Helpers.svelte.js';
6
+ import { Colour } from '../../scss/colours.js';
7
+ import { InputVariant } from '../../Types/Internal/InputVariant.js';
8
+ import { Size } from '../../Types/Internal/Size.js';
9
+ import { onMount, tick } from 'svelte';
10
+ import TextInput from '../TextInput.svelte';
11
+ import type { TextModalProps } from './TextModalProps.js';
12
+ import TouchModal from './TouchModal.svelte';
13
+
14
+ let {
15
+ header,
16
+ value = $bindable(''),
17
+ label,
18
+ placeholder,
19
+ cancelEditing,
20
+ confirm,
21
+ uppercase = false,
22
+ inputRef = $bindable(),
23
+ isValid: _isValid = true,
24
+ mandatory = true,
25
+ explanation,
26
+ width,
27
+ minWidth,
28
+ staticWidth,
29
+ minHeight,
30
+ height,
31
+ }: TextModalProps = $props();
32
+
33
+ onMount(() => {
34
+ tick()
35
+ .then(() => {
36
+ inputRef?.select();
37
+ })
38
+ .catch(devCatch);
39
+ });
40
+
41
+ async function resetValue() {
42
+ // Cleared back to empty: callers wanting reset-to-original semantics
43
+ // should re-pass the original value via the bound prop.
44
+ value = '';
45
+ await tick();
46
+ inputRef?.select();
47
+ }
48
+
49
+ const isValid = useAsyncFlag(
50
+ () => (typeof _isValid === 'function' ? _isValid(value) : _isValid),
51
+ true
52
+ );
53
+ </script>
54
+
55
+ <TouchModal
56
+ onclose={() => {
57
+ cancelEditing();
58
+ }}
59
+ {header}
60
+ {mandatory}
61
+ {width}
62
+ {minWidth}
63
+ {staticWidth}
64
+ {minHeight}
65
+ {height}
66
+ onsubmit={(e: SubmitEvent) => {
67
+ e.preventDefault();
68
+ confirm(value);
69
+ }}
70
+ {explanation}
71
+ >
72
+ <TextInput
73
+ {uppercase}
74
+ labelTop={label}
75
+ {placeholder}
76
+ variant={InputVariant.Modal}
77
+ bind:inputRef
78
+ bind:value
79
+ showErrorColours
80
+ invalid={!isValid.value}
81
+ rightIcon={{
82
+ name: 'cross',
83
+ size: Size.Large,
84
+ colour: Colour['$font-primary'],
85
+ }}
86
+ onRightIconClick={resetValue}
87
+ />
88
+ {#snippet footer()}
89
+ <div class="modal-footer">
90
+ <button
91
+ onkeydown={passthrough}
92
+ type="submit"
93
+ disabled={!isValid.value}>Confirm</button
94
+ >
95
+ <button
96
+ onkeydown={passthrough}
97
+ type="button"
98
+ onclick={() => {
99
+ cancelEditing();
100
+ }}>Cancel</button
101
+ >
102
+ </div>
103
+ {/snippet}
104
+ </TouchModal>
105
+
106
106
  <style>dialog {
107
107
  overflow: clip;
108
108
  background-color: #e9ecf1;
@@ -350,4 +350,4 @@ button {
350
350
  display: block;
351
351
  border-width: 2px;
352
352
  border-radius: 4px;
353
- }</style>
353
+ }</style>
@@ -1,35 +1,35 @@
1
- <svelte:options runes />
2
-
3
- <script lang="ts">
4
- import { Colour } from '../../scss/colours.js';
5
- import Action from '../Action.svelte';
6
- import type { TouchCardProps } from './TouchCardProps.js';
7
- let { children, additionalButtons, highlighted = $bindable(false) }: TouchCardProps = $props();
8
- </script>
9
-
10
- <div
11
- class="card"
12
- class:highlighted
13
- >
14
- <div class="float-right">
15
- {#if additionalButtons}
16
- {@render additionalButtons()}
17
- {/if}
18
- <Action
19
- icon={{
20
- name: 'star-banner',
21
- colour: highlighted ? Colour['$brand-primary'] : Colour['$ui-blue-4'],
22
- }}
23
- backgroundColour={Colour['$transparent-0']}
24
- label="Highlight Card"
25
- onclick={() => {
26
- highlighted = !highlighted;
27
- }}
28
- />
29
- </div>
30
- {@render children()}
31
- </div>
32
-
1
+ <svelte:options runes />
2
+
3
+ <script lang="ts">
4
+ import { Colour } from '../../scss/colours.js';
5
+ import Action from '../Action.svelte';
6
+ import type { TouchCardProps } from './TouchCardProps.js';
7
+ let { children, additionalButtons, highlighted = $bindable(false) }: TouchCardProps = $props();
8
+ </script>
9
+
10
+ <div
11
+ class="card"
12
+ class:highlighted
13
+ >
14
+ <div class="float-right">
15
+ {#if additionalButtons}
16
+ {@render additionalButtons()}
17
+ {/if}
18
+ <Action
19
+ icon={{
20
+ name: 'star-banner',
21
+ colour: highlighted ? Colour['$brand-primary'] : Colour['$ui-blue-4'],
22
+ }}
23
+ backgroundColour={Colour['$transparent-0']}
24
+ label="Highlight Card"
25
+ onclick={() => {
26
+ highlighted = !highlighted;
27
+ }}
28
+ />
29
+ </div>
30
+ {@render children()}
31
+ </div>
32
+
33
33
  <style>.card {
34
34
  color: #3a4952;
35
35
  fill: #3a4952;
@@ -119,4 +119,4 @@
119
119
  padding: 0.375rem 0.5rem;
120
120
  margin-left: 0;
121
121
  width: fit-content;
122
- }</style>
122
+ }</style>