@lavalogic/scoria 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +58 -58
  2. package/dist/Components/AccordionGroup.svelte +44 -63
  3. package/dist/Components/AccordionGroup.svelte.d.ts +2 -25
  4. package/dist/Components/AccordionGroupButton.svelte +106 -114
  5. package/dist/Components/AccordionGroupButton.svelte.d.ts +2 -2
  6. package/dist/Components/AccordionGroupButtonProps.d.ts +21 -0
  7. package/dist/Components/AccordionGroupButtonProps.js +1 -0
  8. package/dist/Components/Action.svelte +138 -138
  9. package/dist/Components/AlertModal.svelte +125 -125
  10. package/dist/Components/Base/ContextWrapper.svelte +50 -50
  11. package/dist/Components/Base/Pagination.svelte +190 -190
  12. package/dist/Components/Base/Snippets.svelte +29 -29
  13. package/dist/Components/BigRadioSet.svelte +29 -29
  14. package/dist/Components/Bubble.svelte +77 -77
  15. package/dist/Components/Button.svelte +197 -197
  16. package/dist/Components/Checkbox.svelte +68 -68
  17. package/dist/Components/CollapsibleCard.svelte +70 -70
  18. package/dist/Components/Contexts/ContextMenu.svelte +157 -157
  19. package/dist/Components/Contexts/ContextMenuDivider.svelte +11 -11
  20. package/dist/Components/Contexts/ContextMenuOption.svelte +52 -52
  21. package/dist/Components/Contexts/Toast.svelte +61 -61
  22. package/dist/Components/Contexts/ToastContainer.svelte +46 -46
  23. package/dist/Components/Contexts/Tooltip.svelte +26 -26
  24. package/dist/Components/DataMatrixIcon.svelte +41 -41
  25. package/dist/Components/DateInput.svelte +109 -109
  26. package/dist/Components/DatePicker.svelte +312 -312
  27. package/dist/Components/DesktopModal.svelte +106 -106
  28. package/dist/Components/Dial.svelte +151 -151
  29. package/dist/Components/DimensionInput.svelte +184 -184
  30. package/dist/Components/DragMenu/DragMenuHolder.svelte +106 -106
  31. package/dist/Components/DragMenu/DraggableCard.svelte +41 -41
  32. package/dist/Components/FileCard.svelte +20 -20
  33. package/dist/Components/FileUpload.svelte +196 -196
  34. package/dist/Components/GridInput.svelte +190 -190
  35. package/dist/Components/GridInputSet.svelte +22 -22
  36. package/dist/Components/HorizontalTabGroup.svelte +78 -78
  37. package/dist/Components/HorizontalTabGroupButton.svelte +96 -96
  38. package/dist/Components/Icon.svelte +97 -97
  39. package/dist/Components/Icons.js +357 -357
  40. package/dist/Components/LoadingAnimation.svelte +32 -32
  41. package/dist/Components/LoadingModal.svelte +47 -47
  42. package/dist/Components/LoadingOverlay.svelte +27 -27
  43. package/dist/Components/Modal.svelte +251 -251
  44. package/dist/Components/MultiSelect.svelte +197 -197
  45. package/dist/Components/Nav/Nav.svelte +97 -97
  46. package/dist/Components/Nav/NavServiceMenuList.svelte +34 -34
  47. package/dist/Components/Nav/NavTab.svelte +91 -91
  48. package/dist/Components/Nav/ServiceMenuItem.svelte +91 -91
  49. package/dist/Components/Nav/ServicesNav.svelte +53 -53
  50. package/dist/Components/NumberInput.svelte +144 -144
  51. package/dist/Components/PageHeading.svelte +36 -36
  52. package/dist/Components/PasswordInput.svelte +73 -73
  53. package/dist/Components/Portal.svelte +25 -25
  54. package/dist/Components/ProgressBubble.svelte +80 -80
  55. package/dist/Components/QuerySelect.svelte +411 -411
  56. package/dist/Components/SingleSelect.svelte +261 -261
  57. package/dist/Components/StepButton.svelte +120 -120
  58. package/dist/Components/StepForm.svelte +108 -108
  59. package/dist/Components/Switch.svelte +36 -36
  60. package/dist/Components/Table/Body/QuickSearchCell.svelte +632 -632
  61. package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +30 -30
  62. package/dist/Components/Table/Body/Rows/ColumnList.svelte +56 -56
  63. package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +179 -179
  64. package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +49 -49
  65. package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +180 -180
  66. package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +102 -102
  67. package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +119 -119
  68. package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +114 -114
  69. package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +96 -96
  70. package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +72 -72
  71. package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +131 -131
  72. package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +144 -144
  73. package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +238 -238
  74. package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +358 -358
  75. package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +338 -338
  76. package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +183 -183
  77. package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +309 -309
  78. package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +369 -369
  79. package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +170 -170
  80. package/dist/Components/Table/Body/Rows/TableRow.svelte +259 -259
  81. package/dist/Components/Table/Body/TableBody.svelte +67 -67
  82. package/dist/Components/Table/Headers/HighlightAllHeader.svelte +39 -39
  83. package/dist/Components/Table/Headers/SelectAllHeader.svelte +28 -28
  84. package/dist/Components/Table/Headers/TableHead.svelte +260 -260
  85. package/dist/Components/Table/Misc/ColumnPanel.svelte +78 -78
  86. package/dist/Components/Table/Misc/ColumnPanelModal.svelte +99 -99
  87. package/dist/Components/Table/Misc/FilterInput.svelte +556 -556
  88. package/dist/Components/Table/Misc/FilterPanel.svelte +46 -46
  89. package/dist/Components/Table/Misc/FilterPanelModal.svelte +67 -67
  90. package/dist/Components/Table/Misc/SidePanel.svelte +32 -32
  91. package/dist/Components/Table/Misc/TableFooter.svelte +304 -304
  92. package/dist/Components/Table/Misc/TableHorizontalBar.svelte +156 -156
  93. package/dist/Components/Table/Misc/TableSidebar.svelte +176 -176
  94. package/dist/Components/Table/Misc/ToolboxPanel.svelte +77 -77
  95. package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +91 -91
  96. package/dist/Components/Table/NestedTable.svelte +84 -84
  97. package/dist/Components/Table/Table.svelte +492 -492
  98. package/dist/Components/Test/TestContextConsumer.svelte +13 -13
  99. package/dist/Components/TextArea.svelte +108 -108
  100. package/dist/Components/TextInput.svelte +147 -147
  101. package/dist/Components/ThreeStateRadio.svelte +124 -124
  102. package/dist/Components/Touch/BoolCard.svelte +52 -52
  103. package/dist/Components/Touch/DateModal.svelte +217 -217
  104. package/dist/Components/Touch/EditCard.svelte +52 -52
  105. package/dist/Components/Touch/InfoCard.svelte +24 -24
  106. package/dist/Components/Touch/InfoTextCard.svelte +21 -21
  107. package/dist/Components/Touch/ModalExplanation.svelte +20 -20
  108. package/dist/Components/Touch/NumberKeyboard.svelte +268 -268
  109. package/dist/Components/Touch/NumberModal.svelte +69 -69
  110. package/dist/Components/Touch/PlusMinusCard.svelte +50 -50
  111. package/dist/Components/Touch/SelectModal.svelte +105 -105
  112. package/dist/Components/Touch/SummaryCard.svelte +65 -65
  113. package/dist/Components/Touch/TextAreaModal.svelte +86 -86
  114. package/dist/Components/Touch/TextModal.svelte +123 -123
  115. package/dist/Components/Touch/TouchCard.svelte +28 -28
  116. package/dist/Components/Touch/TouchModal.svelte +259 -259
  117. package/dist/Components/Touch/UtilityButton.svelte +91 -91
  118. package/dist/Components/VerticalTabGroup.svelte +66 -66
  119. package/dist/Components/VerticalTabGroupButton.svelte +97 -97
  120. package/dist/Helpers/Datamatrix.d.ts +10 -10
  121. package/dist/Helpers/Datamatrix.js +1 -1
  122. package/dist/Helpers/Helpers.svelte.js +6 -4
  123. package/dist/Types/Examples/ExampleModal.svelte +34 -34
  124. package/dist/index.d.ts +1 -0
  125. package/dist/scss/_basics.scss +12 -12
  126. package/dist/scss/_colours.scss +134 -134
  127. package/dist/scss/_mixins.scss +3016 -3016
  128. package/dist/scss/_sizing.scss +69 -69
  129. package/dist/scss/_transitions.scss +8 -8
  130. package/package.json +2 -2
@@ -1,63 +1,63 @@
1
- <svelte:options runes />
2
-
3
- <script
4
- lang="ts"
5
- module
6
- >
7
- import { ColourSet } from '../../scss/colours.js';
8
- import { Size } from '../../Types/Internal/Size.js';
9
- import { Validity } from '../../Types/Internal/Validity.js';
10
- import { slide } from 'svelte/transition';
11
- import Action from '../Action.svelte';
12
- import Icon from '../Icon.svelte';
13
- import type { ToastProps } from './ToastProps.js';
14
- </script>
15
-
16
- <script lang="ts">
17
- let { toast, copy }: ToastProps = $props();
18
- </script>
19
-
20
- <output
21
- role={toast.result == Validity.Invalid ? 'alert' : 'status'}
22
- aria-live={toast.result == Validity.Invalid ? 'assertive' : 'polite'}
23
- class:info={toast.result == Validity.Info}
24
- class:success={toast.result == Validity.Valid}
25
- class:warning={toast.result == Validity.Warning}
26
- class:error={toast.result == Validity.Invalid}
27
- transition:slide={{ axis: 'x', duration: 500 }}
28
- >
29
- <div>
30
- <div class="noshrink">
31
- {#if toast.copyable != false && navigator.clipboard}
32
- <Action
33
- onclick={copy}
34
- icon={{ name: 'copy' }}
35
- size={Size.MediumLarge}
36
- colourSet={ColourSet.Auxiliary}
37
- />
38
- {:else}
39
- <Icon
40
- name="info"
41
- size={Size.MediumLarge}
42
- />
43
- {/if}
44
- </div>
45
- <span>{toast.message}</span>
46
- {#if toast.closeable}
47
- <div class="noshrink">
48
- <Action
49
- size={Size.MediumLarge}
50
- icon={{ name: 'cross' }}
51
- onclick={() => {
52
- toast.close?.();
53
- }}
54
- colourSet={ColourSet.Auxiliary}
55
- />
56
- </div>
57
- {/if}
58
- </div>
59
- </output>
60
-
1
+ <svelte:options runes />
2
+
3
+ <script
4
+ lang="ts"
5
+ module
6
+ >
7
+ import { ColourSet } from '../../scss/colours.js';
8
+ import { Size } from '../../Types/Internal/Size.js';
9
+ import { Validity } from '../../Types/Internal/Validity.js';
10
+ import { slide } from 'svelte/transition';
11
+ import Action from '../Action.svelte';
12
+ import Icon from '../Icon.svelte';
13
+ import type { ToastProps } from './ToastProps.js';
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ let { toast, copy }: ToastProps = $props();
18
+ </script>
19
+
20
+ <output
21
+ role={toast.result == Validity.Invalid ? 'alert' : 'status'}
22
+ aria-live={toast.result == Validity.Invalid ? 'assertive' : 'polite'}
23
+ class:info={toast.result == Validity.Info}
24
+ class:success={toast.result == Validity.Valid}
25
+ class:warning={toast.result == Validity.Warning}
26
+ class:error={toast.result == Validity.Invalid}
27
+ transition:slide={{ axis: 'x', duration: 500 }}
28
+ >
29
+ <div>
30
+ <div class="noshrink">
31
+ {#if toast.copyable != false && navigator.clipboard}
32
+ <Action
33
+ onclick={copy}
34
+ icon={{ name: 'copy' }}
35
+ size={Size.MediumLarge}
36
+ colourSet={ColourSet.Auxiliary}
37
+ />
38
+ {:else}
39
+ <Icon
40
+ name="info"
41
+ size={Size.MediumLarge}
42
+ />
43
+ {/if}
44
+ </div>
45
+ <span>{toast.message}</span>
46
+ {#if toast.closeable}
47
+ <div class="noshrink">
48
+ <Action
49
+ size={Size.MediumLarge}
50
+ icon={{ name: 'cross' }}
51
+ onclick={() => {
52
+ toast.close?.();
53
+ }}
54
+ colourSet={ColourSet.Auxiliary}
55
+ />
56
+ </div>
57
+ {/if}
58
+ </div>
59
+ </output>
60
+
61
61
  <style>output {
62
62
  font-weight: 700;
63
63
  font-size: 1.125rem;
@@ -89,4 +89,4 @@ output span {
89
89
  text-wrap: nowrap;
90
90
  word-break: keep-all;
91
91
  overflow: hidden;
92
- }</style>
92
+ }</style>
@@ -1,48 +1,48 @@
1
- <svelte:options runes />
2
-
3
- <script lang="ts">
4
- import { ToastContext } from '../../Contexts/ToastContext.svelte.js';
5
- import { devCatch } from '../../Helpers/Helpers.svelte.js';
6
- import { Validity } from '../../Types/Internal/Validity.js';
7
- import { getContext } from 'svelte';
8
- import Toast from './Toast.svelte';
9
-
10
- const toastContext = getContext<ToastContext>(ToastContext.identifier);
11
-
12
- function copyDataToClipboard(text: string) {
13
- //clipboard doesn't exist in http connections. This may be redundant now but you never know
14
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
15
- if (!navigator.clipboard) {
16
- toastContext.toast({
17
- result: Validity.Invalid,
18
- message: 'Cannot Copy in an Insecure Connection',
19
- copyable: false
20
- });
21
- return;
22
- }
23
-
24
- // copy plain value
25
-
26
- navigator.clipboard.writeText(text).catch(devCatch);
27
- toastContext.toast({
28
- result: Validity.Info,
29
- message: 'Message copied to clipboard',
30
- copyable: false
31
- });
32
- }
33
- </script>
34
-
35
- <section>
36
- {#each toastContext.toasts as toast (toast)}
37
- <Toast
38
- {toast}
39
- copy={() => {
40
- copyDataToClipboard(toast.getVerbose?.() ?? toast.message);
41
- }}
42
- />
43
- {/each}
44
- </section>
45
-
1
+ <svelte:options runes />
2
+
3
+ <script lang="ts">
4
+ import { ToastContext } from '../../Contexts/ToastContext.svelte.js';
5
+ import { devCatch } from '../../Helpers/Helpers.svelte.js';
6
+ import { Validity } from '../../Types/Internal/Validity.js';
7
+ import { getContext } from 'svelte';
8
+ import Toast from './Toast.svelte';
9
+
10
+ const toastContext = getContext<ToastContext>(ToastContext.identifier);
11
+
12
+ function copyDataToClipboard(text: string) {
13
+ //clipboard doesn't exist in http connections. This may be redundant now but you never know
14
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
15
+ if (!navigator.clipboard) {
16
+ toastContext.toast({
17
+ result: Validity.Invalid,
18
+ message: 'Cannot Copy in an Insecure Connection',
19
+ copyable: false
20
+ });
21
+ return;
22
+ }
23
+
24
+ // copy plain value
25
+
26
+ navigator.clipboard.writeText(text).catch(devCatch);
27
+ toastContext.toast({
28
+ result: Validity.Info,
29
+ message: 'Message copied to clipboard',
30
+ copyable: false
31
+ });
32
+ }
33
+ </script>
34
+
35
+ <section>
36
+ {#each toastContext.toasts as toast (toast)}
37
+ <Toast
38
+ {toast}
39
+ copy={() => {
40
+ copyDataToClipboard(toast.getVerbose?.() ?? toast.message);
41
+ }}
42
+ />
43
+ {/each}
44
+ </section>
45
+
46
46
  <style>section {
47
47
  user-select: none;
48
48
  gap: 0.5rem;
@@ -54,4 +54,4 @@
54
54
  justify-content: flex-end;
55
55
  align-items: flex-end;
56
56
  z-index: 9999;
57
- }</style>
57
+ }</style>
@@ -1,28 +1,28 @@
1
- <svelte:options runes />
2
-
3
- <script lang="ts">
4
- import { TooltipContext } from '../../Contexts/TooltipContext.svelte.js';
5
- import { Side } from '../../Types/Internal/Side.js';
6
- import { getContext } from 'svelte';
7
- const tooltipContext = getContext<TooltipContext>(TooltipContext.identifier);
8
- </script>
9
-
10
- {#if tooltipContext.isShowingTooltip}
11
- <div
12
- role="tooltip"
13
- style="--y: {tooltipContext.y}px; --x: {tooltipContext.x}px;"
14
- class="tooltip-wrapper"
15
- class:top-arrow={tooltipContext.anchor === Side.Top}
16
- class:bottom-arrow={tooltipContext.anchor === Side.Bottom}
17
- class:left-arrow={tooltipContext.anchor === Side.Left}
18
- class:right-arrow={tooltipContext.anchor === Side.Right}
19
- >
20
- <div class="tooltip">
21
- {tooltipContext.text}
22
- </div>
23
- </div>
24
- {/if}
25
-
1
+ <svelte:options runes />
2
+
3
+ <script lang="ts">
4
+ import { TooltipContext } from '../../Contexts/TooltipContext.svelte.js';
5
+ import { Side } from '../../Types/Internal/Side.js';
6
+ import { getContext } from 'svelte';
7
+ const tooltipContext = getContext<TooltipContext>(TooltipContext.identifier);
8
+ </script>
9
+
10
+ {#if tooltipContext.isShowingTooltip}
11
+ <div
12
+ role="tooltip"
13
+ style="--y: {tooltipContext.y}px; --x: {tooltipContext.x}px;"
14
+ class="tooltip-wrapper"
15
+ class:top-arrow={tooltipContext.anchor === Side.Top}
16
+ class:bottom-arrow={tooltipContext.anchor === Side.Bottom}
17
+ class:left-arrow={tooltipContext.anchor === Side.Left}
18
+ class:right-arrow={tooltipContext.anchor === Side.Right}
19
+ >
20
+ <div class="tooltip">
21
+ {tooltipContext.text}
22
+ </div>
23
+ </div>
24
+ {/if}
25
+
26
26
  <style>.tooltip-wrapper {
27
27
  position: fixed;
28
28
  z-index: 9999;
@@ -110,4 +110,4 @@
110
110
  transform: rotate(45deg);
111
111
  background-color: black;
112
112
  border: solid 2px #dae0e5;
113
- }</style>
113
+ }</style>
@@ -1,43 +1,43 @@
1
- <svelte:options runes />
2
-
3
- <script lang="ts">
4
- import { passthrough } from '../Helpers/Helpers.svelte.js';
5
- import type { DataMatrixIconProps } from './DataMatrixIconProps.js';
6
-
7
- const { icon, interactive = false, title, oncontextmenu }: DataMatrixIconProps = $props();
8
-
9
- let svgContainer = $state<HTMLDivElement | null>(null);
10
-
11
- $effect(() => {
12
- if (svgContainer != null) {
13
- // eslint-disable-next-line svelte/no-dom-manipulating
14
- svgContainer.innerHTML = '';
15
- icon.setAttribute('width', '64');
16
- icon.setAttribute('height', '64');
17
- // eslint-disable-next-line svelte/no-dom-manipulating
18
- svgContainer.appendChild(icon);
19
- }
20
- });
21
- </script>
22
-
23
- {#if interactive}
24
- <button
25
- aria-label="Edit Barcode Value"
26
- onkeydown={passthrough}
27
- title="Right click to edit barcode value for the {title} command"
28
- oncontextmenu={(e) => {
29
- if (oncontextmenu) {
30
- e.preventDefault();
31
- oncontextmenu(e);
32
- }
33
- }}
34
- >
35
- <div class="fit" bind:this={svgContainer}></div>
36
- </button>
37
- {:else}
38
- <div class="fit" bind:this={svgContainer}></div>
39
- {/if}
40
-
1
+ <svelte:options runes />
2
+
3
+ <script lang="ts">
4
+ import { passthrough } from '../Helpers/Helpers.svelte.js';
5
+ import type { DataMatrixIconProps } from './DataMatrixIconProps.js';
6
+
7
+ const { icon, interactive = false, title, oncontextmenu }: DataMatrixIconProps = $props();
8
+
9
+ let svgContainer = $state<HTMLDivElement | null>(null);
10
+
11
+ $effect(() => {
12
+ if (svgContainer != null) {
13
+ // eslint-disable-next-line svelte/no-dom-manipulating
14
+ svgContainer.innerHTML = '';
15
+ icon.setAttribute('width', '64');
16
+ icon.setAttribute('height', '64');
17
+ // eslint-disable-next-line svelte/no-dom-manipulating
18
+ svgContainer.appendChild(icon);
19
+ }
20
+ });
21
+ </script>
22
+
23
+ {#if interactive}
24
+ <button
25
+ aria-label="Edit Barcode Value"
26
+ onkeydown={passthrough}
27
+ title="Right click to edit barcode value for the {title} command"
28
+ oncontextmenu={(e) => {
29
+ if (oncontextmenu) {
30
+ e.preventDefault();
31
+ oncontextmenu(e);
32
+ }
33
+ }}
34
+ >
35
+ <div class="fit" bind:this={svgContainer}></div>
36
+ </button>
37
+ {:else}
38
+ <div class="fit" bind:this={svgContainer}></div>
39
+ {/if}
40
+
41
41
  <style>button {
42
42
  display: contents;
43
43
  cursor: pointer;
@@ -47,4 +47,4 @@ div.fit {
47
47
  background-color: #ffffff;
48
48
  display: flex;
49
49
  padding: 8px;
50
- }</style>
50
+ }</style>
@@ -1,111 +1,111 @@
1
- <svelte:options runes />
2
-
3
- <script lang="ts" module>
4
- import { InputVariant } from '../Types/Internal/InputVariant.js';
5
- import type { InputDate } from '../Types/Internal/Misc.js';
6
- import { Size } from '../Types/Internal/Size.js';
7
- import type { DateInputProps } from './DateInputProps.js';
8
- import Icon from './Icon.svelte';
9
- </script>
10
-
11
- <script lang="ts">
12
- let {
13
- value = $bindable('' as InputDate),
14
- label,
15
- placeholder,
16
- required = false,
17
- optional,
18
- variant = InputVariant.Default,
19
- min,
20
- max,
21
- type = 'date',
22
- disabled,
23
- leftIcon,
24
- rightIcon,
25
- inputRef,
26
- invalid,
27
- onblur,
28
- onfocus
29
- }: DateInputProps = $props();
30
-
31
- let isInvalid = $derived((required && !value?.trim()) || invalid);
32
- </script>
33
-
34
- <div
35
- class="error-wrapper"
36
- class:for-modal={variant == InputVariant.Modal}
37
- class:for-table={variant == InputVariant.Table}
38
- >
39
- <label class:for-modal={variant == InputVariant.Modal}>
40
- {#if label}
41
- <span
42
- class="top-label"
43
- class:for-default={variant === InputVariant.Default}
44
- class:invalid={isInvalid}
45
- >{label}{#if optional}<i>&nbsp;- optional</i>{/if}</span
46
- >
47
- {#if variant === InputVariant.Default}
48
- <span class="border" class:invalid={isInvalid}
49
- >{label}{#if optional}<i>&nbsp;- optional</i>{/if}</span
50
- >
51
- {/if}
52
- {/if}
53
- <div class="icon-container">
54
- {#if leftIcon}
55
- <Icon
56
- name={leftIcon.name}
57
- size={leftIcon.size ?? Size.Medium}
58
- float
59
- left="0.75rem"
60
- top="50%"
61
- anchorX="0"
62
- anchorY="-50%"
63
- />
64
- {/if}
65
- <input
66
- step={type === 'datetime-local' ? 1 : 'any'}
67
- class:invalid={isInvalid}
68
- class:left-pad={leftIcon != undefined}
69
- class:right-pad={rightIcon != undefined}
70
- {type}
71
- bind:value
72
- {onblur}
73
- {onfocus}
74
- ondblclick={() => inputRef?.showPicker()}
75
- onauxclick={(e) => {
76
- e.preventDefault();
77
- inputRef?.showPicker();
78
- }}
79
- bind:this={inputRef}
80
- {min}
81
- {max}
82
- {placeholder}
83
- {required}
84
- {disabled}
85
- onkeydown={(e) => {
86
- if (e.key === 'Enter') {
87
- e.preventDefault();
88
- (
89
- (e.target as HTMLElement | undefined)?.closest('form') as HTMLFormElement | undefined
90
- )?.requestSubmit();
91
- }
92
- }}
93
- />
94
- {#if rightIcon}
95
- <Icon
96
- name={rightIcon.name}
97
- size={rightIcon.size ?? Size.Medium}
98
- float
99
- right="0.5rem"
100
- top="50%"
101
- anchorX="0"
102
- anchorY="-50%"
103
- />
104
- {/if}
105
- </div>
106
- </label>
107
- </div>
108
-
1
+ <svelte:options runes />
2
+
3
+ <script lang="ts" module>
4
+ import { InputVariant } from '../Types/Internal/InputVariant.js';
5
+ import type { InputDate } from '../Types/Internal/Misc.js';
6
+ import { Size } from '../Types/Internal/Size.js';
7
+ import type { DateInputProps } from './DateInputProps.js';
8
+ import Icon from './Icon.svelte';
9
+ </script>
10
+
11
+ <script lang="ts">
12
+ let {
13
+ value = $bindable('' as InputDate),
14
+ label,
15
+ placeholder,
16
+ required = false,
17
+ optional,
18
+ variant = InputVariant.Default,
19
+ min,
20
+ max,
21
+ type = 'date',
22
+ disabled,
23
+ leftIcon,
24
+ rightIcon,
25
+ inputRef,
26
+ invalid,
27
+ onblur,
28
+ onfocus
29
+ }: DateInputProps = $props();
30
+
31
+ let isInvalid = $derived((required && !value?.trim()) || invalid);
32
+ </script>
33
+
34
+ <div
35
+ class="error-wrapper"
36
+ class:for-modal={variant == InputVariant.Modal}
37
+ class:for-table={variant == InputVariant.Table}
38
+ >
39
+ <label class:for-modal={variant == InputVariant.Modal}>
40
+ {#if label}
41
+ <span
42
+ class="top-label"
43
+ class:for-default={variant === InputVariant.Default}
44
+ class:invalid={isInvalid}
45
+ >{label}{#if optional}<i>&nbsp;- optional</i>{/if}</span
46
+ >
47
+ {#if variant === InputVariant.Default}
48
+ <span class="border" class:invalid={isInvalid}
49
+ >{label}{#if optional}<i>&nbsp;- optional</i>{/if}</span
50
+ >
51
+ {/if}
52
+ {/if}
53
+ <div class="icon-container">
54
+ {#if leftIcon}
55
+ <Icon
56
+ name={leftIcon.name}
57
+ size={leftIcon.size ?? Size.Medium}
58
+ float
59
+ left="0.75rem"
60
+ top="50%"
61
+ anchorX="0"
62
+ anchorY="-50%"
63
+ />
64
+ {/if}
65
+ <input
66
+ step={type === 'datetime-local' ? 1 : 'any'}
67
+ class:invalid={isInvalid}
68
+ class:left-pad={leftIcon != undefined}
69
+ class:right-pad={rightIcon != undefined}
70
+ {type}
71
+ bind:value
72
+ {onblur}
73
+ {onfocus}
74
+ ondblclick={() => inputRef?.showPicker()}
75
+ onauxclick={(e) => {
76
+ e.preventDefault();
77
+ inputRef?.showPicker();
78
+ }}
79
+ bind:this={inputRef}
80
+ {min}
81
+ {max}
82
+ {placeholder}
83
+ {required}
84
+ {disabled}
85
+ onkeydown={(e) => {
86
+ if (e.key === 'Enter') {
87
+ e.preventDefault();
88
+ (
89
+ (e.target as HTMLElement | undefined)?.closest('form') as HTMLFormElement | undefined
90
+ )?.requestSubmit();
91
+ }
92
+ }}
93
+ />
94
+ {#if rightIcon}
95
+ <Icon
96
+ name={rightIcon.name}
97
+ size={rightIcon.size ?? Size.Medium}
98
+ float
99
+ right="0.5rem"
100
+ top="50%"
101
+ anchorX="0"
102
+ anchorY="-50%"
103
+ />
104
+ {/if}
105
+ </div>
106
+ </label>
107
+ </div>
108
+
109
109
  <style>input {
110
110
  box-sizing: border-box;
111
111
  height: 100%;
@@ -335,4 +335,4 @@ label.for-table {
335
335
  }
336
336
  label.for-table input {
337
337
  height: unset;
338
- }</style>
338
+ }</style>