@lavalogic/scoria 0.40.13 → 0.40.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -58
- package/dist/Components/AccordionGroup.svelte +35 -46
- package/dist/Components/AccordionGroupButton.svelte +68 -76
- package/dist/Components/Action.svelte +103 -135
- package/dist/Components/AlertModal.svelte +171 -190
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +614 -697
- package/dist/Components/Base/BaseModal.svelte +90 -116
- package/dist/Components/Base/ContextWrapper.svelte +67 -72
- package/dist/Components/Base/Pagination.svelte +173 -196
- package/dist/Components/Base/Snippets.svelte +34 -36
- package/dist/Components/BigRadioSet.svelte +36 -38
- package/dist/Components/Bubble.svelte +78 -101
- package/dist/Components/Button.svelte +175 -208
- package/dist/Components/Checkbox.svelte +75 -86
- package/dist/Components/CollapsibleCard.svelte +72 -87
- package/dist/Components/CollapsibleMenuGroup.svelte +53 -57
- package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +39 -64
- package/dist/Components/Contexts/ContextMenu.svelte +141 -156
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +53 -60
- package/dist/Components/Contexts/Toast.svelte +81 -86
- package/dist/Components/Contexts/ToastContainer.svelte +58 -62
- package/dist/Components/Contexts/Tooltip.svelte +36 -37
- package/dist/Components/DataMatrixIcon.svelte +95 -108
- package/dist/Components/DateInput.svelte +118 -146
- package/dist/Components/DatePicker.svelte +255 -294
- package/dist/Components/DesktopModal.svelte +70 -90
- package/dist/Components/Dial.svelte +167 -197
- package/dist/Components/DimensionInput.svelte +124 -169
- package/dist/Components/DragMenu/DragMenuHolder.svelte +98 -114
- package/dist/Components/DragMenu/DraggableCard.svelte +64 -76
- package/dist/Components/FileCard.svelte +21 -24
- package/dist/Components/FileUpload.svelte +190 -225
- package/dist/Components/GridInput.svelte +159 -196
- package/dist/Components/GridInputSet.svelte +24 -29
- package/dist/Components/HorizontalTabGroup.svelte +73 -89
- package/dist/Components/HorizontalTabGroupButton.svelte +40 -44
- package/dist/Components/Icon.svelte +99 -128
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/InfoAlert.svelte +35 -38
- package/dist/Components/LoadingAnimation.svelte +691 -755
- package/dist/Components/LoadingModal.svelte +36 -44
- package/dist/Components/LoadingOverlay.svelte +22 -26
- package/dist/Components/Modal.svelte +204 -254
- package/dist/Components/MultiSelect.svelte +186 -216
- package/dist/Components/Nav/Nav.svelte +94 -110
- package/dist/Components/Nav/NavServiceMenuList.svelte +57 -61
- package/dist/Components/Nav/NavTab.svelte +58 -62
- package/dist/Components/Nav/ServiceMenuItem.svelte +103 -111
- package/dist/Components/Nav/ServicesNav.svelte +72 -79
- package/dist/Components/NumberInput.svelte +121 -155
- package/dist/Components/OptionCards.svelte +62 -73
- package/dist/Components/PageHeading.svelte +23 -25
- package/dist/Components/PasswordInput.svelte +69 -88
- package/dist/Components/PopoverButton.svelte +151 -0
- package/dist/Components/PopoverButton.svelte.d.ts +9 -0
- package/dist/Components/PopoverButtonProps.d.ts +21 -0
- package/dist/Components/PopoverButtonProps.js +1 -0
- package/dist/Components/Portal.svelte +29 -35
- package/dist/Components/ProgressBubble.svelte +91 -106
- package/dist/Components/QuerySelect.svelte +260 -346
- package/dist/Components/SidebarPanel.svelte +34 -36
- package/dist/Components/SingleSelect.svelte +196 -244
- package/dist/Components/StepButton.svelte +65 -70
- package/dist/Components/StepForm.svelte +115 -135
- package/dist/Components/Switch.svelte +57 -69
- package/dist/Components/Table/ARCHITECTURE.md +298 -298
- package/dist/Components/Table/Body/QuickSearchCell.svelte +578 -655
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +42 -51
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +42 -58
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +403 -442
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +51 -78
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +165 -184
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +110 -123
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +134 -160
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +190 -231
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +82 -104
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +52 -87
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +122 -150
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +132 -159
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +190 -236
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +173 -211
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +204 -244
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +140 -177
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +188 -217
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +173 -193
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +166 -187
- package/dist/Components/Table/Body/Rows/TableRow.svelte +245 -288
- package/dist/Components/Table/Body/TableBody.svelte +141 -154
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +35 -41
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +24 -30
- package/dist/Components/Table/Headers/TableHead.svelte +348 -402
- package/dist/Components/Table/Misc/ColumnPanel.svelte +37 -39
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +35 -39
- package/dist/Components/Table/Misc/FilterInput.svelte +556 -619
- package/dist/Components/Table/Misc/FilterPanel.svelte +170 -183
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +25 -31
- package/dist/Components/Table/Misc/ShareViewModal.svelte +252 -281
- package/dist/Components/Table/Misc/SidePanel.svelte +32 -35
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +574 -629
- package/dist/Components/Table/Misc/TableFooter.svelte +326 -332
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +134 -140
- package/dist/Components/Table/Misc/TableSidebar.svelte +183 -198
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +83 -103
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +83 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +88 -107
- package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +163 -190
- package/dist/Components/Table/NestedTable.svelte +102 -128
- package/dist/Components/Table/Table.svelte +531 -663
- package/dist/Components/Test/TestContextConsumer.svelte +11 -13
- package/dist/Components/TextArea.svelte +95 -130
- package/dist/Components/TextInput.svelte +125 -176
- package/dist/Components/ThreeStateRadio.svelte +111 -130
- package/dist/Components/Touch/BoolCard.svelte +33 -45
- package/dist/Components/Touch/DateModal.svelte +164 -204
- package/dist/Components/Touch/EditCard.svelte +48 -59
- package/dist/Components/Touch/InfoCard.svelte +28 -31
- package/dist/Components/Touch/InfoTextCard.svelte +26 -28
- package/dist/Components/Touch/ModalExplanation.svelte +15 -17
- package/dist/Components/Touch/NumberKeyboard.svelte +181 -218
- package/dist/Components/Touch/NumberModal.svelte +59 -79
- package/dist/Components/Touch/PlusMinusCard.svelte +43 -46
- package/dist/Components/Touch/SelectModal.svelte +111 -126
- package/dist/Components/Touch/SummaryCard.svelte +80 -93
- package/dist/Components/Touch/TextAreaModal.svelte +72 -94
- package/dist/Components/Touch/TextModal.svelte +77 -105
- package/dist/Components/Touch/TouchCard.svelte +31 -33
- package/dist/Components/Touch/TouchModal.svelte +214 -270
- package/dist/Components/Touch/UtilityButton.svelte +88 -109
- package/dist/Components/VerticalTabGroup.svelte +60 -78
- package/dist/Components/VerticalTabGroupButton.svelte +54 -58
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Types/Examples/ExampleModal.svelte +31 -35
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3392 -3392
- package/dist/scss/_motion.scss +57 -57
- package/dist/scss/_sizing.scss +85 -85
- package/dist/scss/_transitions.scss +8 -8
- package/package.json +1 -1
|
@@ -1,103 +1,80 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
module
|
|
6
|
-
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
</
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
class="contents"
|
|
79
|
-
{onclick}
|
|
80
|
-
>
|
|
81
|
-
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
82
|
-
{@render bubble()}
|
|
83
|
-
</button>
|
|
84
|
-
{:else}
|
|
85
|
-
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
86
|
-
{@render bubble()}
|
|
87
|
-
{/if}
|
|
88
|
-
|
|
89
|
-
{#snippet bubble()}
|
|
90
|
-
<span
|
|
91
|
-
class="bubble"
|
|
92
|
-
class:bold
|
|
93
|
-
class:hoverable={!!onclick}
|
|
94
|
-
style={wrapperStyle}
|
|
95
|
-
>{#if label}{label}: {/if}{displayLabel}{#if icon}<div class="icon">
|
|
96
|
-
<Icon {...icon} />
|
|
97
|
-
</div>{/if}</span
|
|
98
|
-
>
|
|
99
|
-
{/snippet}
|
|
100
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>import { Size } from "../Types/Internal/Size.js";
|
|
7
|
+
import Icon from "./Icon.svelte";
|
|
8
|
+
// Per-size padding/typography. Only `Size.Large` has explicit overrides;
|
|
9
|
+
// other sizes fall back to the medium defaults handled in $derived blocks
|
|
10
|
+
// below. Replaced the previous one-key `Partial<Record<Size, string>>`
|
|
11
|
+
// lookup tables with a simple `size === Size.Large` branch.
|
|
12
|
+
const LARGE_HORIZONTAL_WITH_VALUE = "1rem";
|
|
13
|
+
const LARGE_HORIZONTAL_WITHOUT_VALUE = "1.25rem";
|
|
14
|
+
const LARGE_VERTICAL = "0.5rem";
|
|
15
|
+
const LARGE_FONT_SIZE = "1.12rem";
|
|
16
|
+
const LARGE_BORDER_RADIUS = "1.75rem";
|
|
17
|
+
const DEFAULT_VERTICAL = "0.18rem";
|
|
18
|
+
const DEFAULT_HORIZONTAL_WITH_VALUE = "0.5rem";
|
|
19
|
+
const DEFAULT_HORIZONTAL_WITHOUT_VALUE = "0.75rem";
|
|
20
|
+
const DEFAULT_FONT_SIZE = "1rem";
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script
|
|
24
|
+
lang="ts"
|
|
25
|
+
generics="T = unknown"
|
|
26
|
+
>// `BubbleProps<T>` is intentionally annotated with `<T>` even though
|
|
27
|
+
// the interface declares `T = unknown` as a default; the explicit
|
|
28
|
+
// substitution flows the generic from `<Bubble<MyType> ...>` consumers
|
|
29
|
+
// into the destructured `options` array type. The lint rule
|
|
30
|
+
// `@typescript-eslint/no-unnecessary-type-arguments` flags this as
|
|
31
|
+
// redundant when `T` resolves to `unknown` at the lint pass, hence
|
|
32
|
+
// the disable.
|
|
33
|
+
const { options, value, colours, label, size = Size.Medium, bold, icon, onclick } = $props();
|
|
34
|
+
const isLarge = $derived(size === Size.Large);
|
|
35
|
+
const verticalPadding = $derived(isLarge ? LARGE_VERTICAL : DEFAULT_VERTICAL);
|
|
36
|
+
const horizontalPadding = $derived.by(() => {
|
|
37
|
+
if (value.length === 1) {
|
|
38
|
+
return isLarge ? LARGE_HORIZONTAL_WITH_VALUE : DEFAULT_HORIZONTAL_WITH_VALUE;
|
|
39
|
+
}
|
|
40
|
+
return isLarge ? LARGE_HORIZONTAL_WITHOUT_VALUE : DEFAULT_HORIZONTAL_WITHOUT_VALUE;
|
|
41
|
+
});
|
|
42
|
+
const fontSize = $derived(isLarge ? LARGE_FONT_SIZE : DEFAULT_FONT_SIZE);
|
|
43
|
+
// Precompute the label lookup once per `options`/`value` change.
|
|
44
|
+
const displayLabel = $derived(options?.length ? options.find((it) => it.value === value)?.label ?? value : value);
|
|
45
|
+
// Precompute the inline style string once per reactive input change.
|
|
46
|
+
const wrapperStyle = $derived.by(() => {
|
|
47
|
+
const colourPart = colours ? `background-color: ${colours.backgroundColour}; color: ${colours.colour};` : "";
|
|
48
|
+
const radiusPart = isLarge ? `border-radius: ${LARGE_BORDER_RADIUS};` : "";
|
|
49
|
+
return `${colourPart} padding: var(--bubble-padding, ${verticalPadding} ${horizontalPadding}); font-size: ${fontSize}; ${radiusPart}`;
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
{#if onclick}
|
|
54
|
+
<button
|
|
55
|
+
class="contents"
|
|
56
|
+
{onclick}
|
|
57
|
+
>
|
|
58
|
+
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
59
|
+
{@render bubble()}
|
|
60
|
+
</button>
|
|
61
|
+
{:else}
|
|
62
|
+
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
63
|
+
{@render bubble()}
|
|
64
|
+
{/if}
|
|
65
|
+
|
|
66
|
+
{#snippet bubble()}
|
|
67
|
+
<span
|
|
68
|
+
class="bubble"
|
|
69
|
+
class:bold
|
|
70
|
+
class:hoverable={!!onclick}
|
|
71
|
+
style={wrapperStyle}
|
|
72
|
+
>{#if label}{label}: {/if}{displayLabel}{#if icon}<div class="icon">
|
|
73
|
+
<Icon {...icon} />
|
|
74
|
+
</div>{/if}</span
|
|
75
|
+
>
|
|
76
|
+
{/snippet}
|
|
77
|
+
|
|
101
78
|
<style>button.contents {
|
|
102
79
|
display: contents;
|
|
103
80
|
cursor: pointer;
|
|
@@ -128,4 +105,4 @@
|
|
|
128
105
|
}
|
|
129
106
|
.bubble.bold {
|
|
130
107
|
font-weight: 700;
|
|
131
|
-
}</style>
|
|
108
|
+
}</style>
|
|
@@ -1,211 +1,178 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
module
|
|
5
|
-
lang="ts"
|
|
6
|
-
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<script lang="ts">
|
|
87
|
-
const {
|
|
88
|
-
type = 'button',
|
|
89
|
-
variant = Variant.Default,
|
|
90
|
-
toggled = false,
|
|
91
|
-
iconLeft,
|
|
92
|
-
iconTop,
|
|
93
|
-
iconRight,
|
|
94
|
-
iconBottom,
|
|
95
|
-
nowrap = false,
|
|
96
|
-
side,
|
|
97
|
-
size = Size.Medium,
|
|
98
|
-
label,
|
|
99
|
-
colourSet = ColourSet.Secondary,
|
|
100
|
-
dashed = false,
|
|
101
|
-
disabled = false,
|
|
102
|
-
fullWidth = false,
|
|
103
|
-
onclick,
|
|
104
|
-
onfocus,
|
|
105
|
-
onblur,
|
|
106
|
-
onkeydown: onkeydownProp,
|
|
107
|
-
children,
|
|
108
|
-
relative,
|
|
109
|
-
noninteractive,
|
|
110
|
-
}: ButtonProps = $props();
|
|
111
|
-
function onkeydown(e: KeyboardEvent): void {
|
|
112
|
-
passthrough(e);
|
|
113
|
-
if (document.activeElement === e.target) {
|
|
114
|
-
onkeydownProp?.(e);
|
|
115
|
-
}
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
module
|
|
5
|
+
lang="ts"
|
|
6
|
+
>import { passthrough } from "../Helpers/Helpers.svelte.js";
|
|
7
|
+
import { useTooltip } from "../Helpers/useTooltip.svelte.js";
|
|
8
|
+
import { Colour, ColourSet } from "../scss/colours.js";
|
|
9
|
+
import { Side } from "../Types/Internal/Side.js";
|
|
10
|
+
import { Size } from "../Types/Internal/Size.js";
|
|
11
|
+
import { Variant } from "../Types/Internal/Variant.js";
|
|
12
|
+
import Icon from "./Icon.svelte";
|
|
13
|
+
const paddingSizesVertical = {
|
|
14
|
+
[Size.Tiny]: "0.25rem",
|
|
15
|
+
[Size.Small]: "0.375rem",
|
|
16
|
+
[Size.MediumSmall]: "0.5rem",
|
|
17
|
+
[Size.Medium]: "0.90625rem",
|
|
18
|
+
[Size.MediumLarge]: "0.90625rem",
|
|
19
|
+
[Size.Large]: "0.925rem",
|
|
20
|
+
[Size.XLarge]: "1.0125rem",
|
|
21
|
+
[Size.DoubleXLarge]: "1.1rem",
|
|
22
|
+
[Size.TripleXLarge]: "1.2975rem",
|
|
23
|
+
[Size.FillWidth]: "0.75rem",
|
|
24
|
+
[Size.FillHeight]: "0"
|
|
25
|
+
};
|
|
26
|
+
// TODO alter the values for these if required
|
|
27
|
+
const paddingSizesHorizontal = {
|
|
28
|
+
[Size.Tiny]: "0.4875rem",
|
|
29
|
+
[Size.Small]: "0.8rem",
|
|
30
|
+
[Size.MediumSmall]: "0.6625rem",
|
|
31
|
+
[Size.Medium]: "0.75rem",
|
|
32
|
+
[Size.MediumLarge]: "0.8375rem",
|
|
33
|
+
[Size.Large]: "0.925rem",
|
|
34
|
+
[Size.XLarge]: "1.0125rem",
|
|
35
|
+
[Size.DoubleXLarge]: "1.1rem",
|
|
36
|
+
[Size.TripleXLarge]: "1.2975rem",
|
|
37
|
+
[Size.FillWidth]: "0.75rem",
|
|
38
|
+
[Size.FillHeight]: "0.75rem"
|
|
39
|
+
};
|
|
40
|
+
// const fontSizes: Record<Size, string> = {
|
|
41
|
+
// [Size.Tiny]: '0.8rem',
|
|
42
|
+
// [Size.Small]: '0.85rem',
|
|
43
|
+
// [Size.MediumSmall]: '0.94rem',
|
|
44
|
+
// [Size.Medium]: '1rem',
|
|
45
|
+
// [Size.MediumLarge]: '1rem',
|
|
46
|
+
// [Size.Large]: '1.16rem',
|
|
47
|
+
// [Size.XLarge]: '1.32rem',
|
|
48
|
+
// [Size.DoubleXLarge]: '1.48rem',
|
|
49
|
+
// [Size.TripleXLarge]: '1.64rem',
|
|
50
|
+
// [Size.FillWidth]: '1rem', // TODO decide
|
|
51
|
+
// [Size.FillHeight]: '1rem' // TODO decide
|
|
52
|
+
// };
|
|
53
|
+
// TODO
|
|
54
|
+
const borderSizes = {
|
|
55
|
+
[Size.Tiny]: "0.1875rem",
|
|
56
|
+
[Size.Small]: "0.1875rem",
|
|
57
|
+
[Size.MediumSmall]: "0.1875rem",
|
|
58
|
+
[Size.Medium]: "0.1875rem",
|
|
59
|
+
[Size.MediumLarge]: "0.1875rem",
|
|
60
|
+
[Size.Large]: "0.1875rem",
|
|
61
|
+
[Size.XLarge]: "0.1875rem",
|
|
62
|
+
[Size.DoubleXLarge]: "0.1875rem",
|
|
63
|
+
[Size.TripleXLarge]: "0.1875rem",
|
|
64
|
+
[Size.FillWidth]: "0.1875rem",
|
|
65
|
+
[Size.FillHeight]: "0.1875rem"
|
|
66
|
+
};
|
|
67
|
+
const iconColours = {
|
|
68
|
+
[ColourSet.Primary]: Colour["$ui-white"],
|
|
69
|
+
[ColourSet.CallToAction]: Colour["$ui-white"],
|
|
70
|
+
[ColourSet.Secondary]: Colour["$ui-blue-14"],
|
|
71
|
+
[ColourSet.Auxiliary]: Colour["$font-primary"],
|
|
72
|
+
[ColourSet.Warning]: Colour["$error-border"],
|
|
73
|
+
[ColourSet.Error]: Colour["$error-border"],
|
|
74
|
+
[ColourSet.Info]: Colour["$primary-blue-13"]
|
|
75
|
+
};
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<script lang="ts">const { type = "button", variant = Variant.Default, toggled = false, iconLeft, iconTop, iconRight, iconBottom, nowrap = false, side, size = Size.Medium, label, colourSet = ColourSet.Secondary, dashed = false, disabled = false, fullWidth = false, onclick, onfocus, onblur, onkeydown: onkeydownProp, children, relative, noninteractive } = $props();
|
|
79
|
+
function onkeydown(e) {
|
|
80
|
+
passthrough(e);
|
|
81
|
+
if (document.activeElement === e.target) {
|
|
82
|
+
onkeydownProp?.(e);
|
|
116
83
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
</script>
|
|
135
|
-
|
|
136
|
-
<!-- title={label} -->
|
|
137
|
-
<!-- style="--font-size: {fontSizes[
|
|
138
|
-
size
|
|
139
|
-
]};" -->
|
|
140
|
-
<button
|
|
141
|
-
onmouseenter={tt.onmouseenter}
|
|
142
|
-
onmouseleave={tt.onmouseleave}
|
|
143
|
-
class:noninteractive
|
|
144
|
-
class:relative
|
|
145
|
-
class:default={variant === Variant.Default}
|
|
146
|
-
class:card-inner={variant === Variant.CardInner}
|
|
147
|
-
class:card={variant === Variant.Card}
|
|
148
|
-
class:call-to-action={colourSet === ColourSet.CallToAction}
|
|
149
|
-
class:primary={colourSet === ColourSet.Primary}
|
|
150
|
-
class:secondary-colour={colourSet === ColourSet.Secondary}
|
|
151
|
-
class:secondary-variant={variant === Variant.Secondary}
|
|
152
|
-
class:warning={colourSet === ColourSet.Warning}
|
|
153
|
-
class:error={colourSet === ColourSet.Error}
|
|
154
|
-
class:info={colourSet === ColourSet.Info}
|
|
155
|
-
class:fill-height={size === Size.FillHeight}
|
|
156
|
-
class:fill-width={size === Size.FillWidth}
|
|
157
|
-
style="--fallback-padding-horizontal: {paddingSizesHorizontal[
|
|
158
|
-
size
|
|
159
|
-
]}; --fallback-padding-vertical: {paddingSizesVertical[size]}; --border-width: {borderSizes[
|
|
160
|
-
size
|
|
161
|
-
]};"
|
|
162
|
-
class:dashed
|
|
163
|
-
class:full-width={fullWidth}
|
|
164
|
-
class:toolbar={variant === Variant.Toolbar}
|
|
165
|
-
class:left={side === Side.Left}
|
|
166
|
-
class:right={side === Side.Right}
|
|
167
|
-
class:top={side === Side.Top}
|
|
168
|
-
class:bottom={side === Side.Bottom}
|
|
169
|
-
class:toggled
|
|
170
|
-
class:nowrap
|
|
171
|
-
{type}
|
|
172
|
-
aria-label={label}
|
|
173
|
-
{disabled}
|
|
174
|
-
onclick={(e) => {
|
|
175
|
-
tt.onclick();
|
|
176
|
-
onclick?.(e);
|
|
177
|
-
}}
|
|
178
|
-
{onfocus}
|
|
179
|
-
{onblur}
|
|
180
|
-
{onkeydown}
|
|
181
|
-
>
|
|
182
|
-
<div class="icon-container">
|
|
183
|
-
{#if iconLeft}
|
|
184
|
-
<Icon
|
|
185
|
-
{...iconLeft}
|
|
186
|
-
colour={iconColours[colourSet]}
|
|
187
|
-
size={iconLeft.size ?? size}
|
|
188
|
-
/>
|
|
189
|
-
{/if}
|
|
190
|
-
{#if iconTop}
|
|
191
|
-
<Icon {...iconTop} />
|
|
192
|
-
{/if}
|
|
193
|
-
{#if children}
|
|
194
|
-
<span>{@render children()}</span>
|
|
195
|
-
{/if}
|
|
196
|
-
{#if iconBottom}
|
|
197
|
-
<Icon {...iconBottom} />
|
|
198
|
-
{/if}
|
|
199
|
-
{#if iconRight}
|
|
200
|
-
<Icon
|
|
201
|
-
{...iconRight}
|
|
202
|
-
colour={iconColours[colourSet]}
|
|
203
|
-
size={iconRight.size ?? size}
|
|
204
|
-
/>
|
|
205
|
-
{/if}
|
|
206
|
-
</div>
|
|
207
|
-
</button>
|
|
208
|
-
|
|
84
|
+
}
|
|
85
|
+
// Shared tooltip lifecycle: hover handlers plus unmount-time teardown so
|
|
86
|
+
// a rapidly-churning host (toolbar, table row) does not leave the global
|
|
87
|
+
// tooltip host painting against a node that no longer exists. The helper
|
|
88
|
+
// also exposes an `onclick` hook that we compose with the consumer's
|
|
89
|
+
// `onclick`. The extra `$effect` dismisses the tooltip when `disabled`
|
|
90
|
+
// flips to true mid-hover - the disabled element will not fire its own
|
|
91
|
+
// `mouseleave`.
|
|
92
|
+
const tt = useTooltip({
|
|
93
|
+
text: () => label,
|
|
94
|
+
arrow: () => side ?? Side.Left
|
|
95
|
+
});
|
|
96
|
+
$effect(() => {
|
|
97
|
+
if (disabled) {
|
|
98
|
+
tt.onmouseleave();
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<!-- title={label} -->
|
|
104
|
+
<!-- style="--font-size: {fontSizes[
|
|
105
|
+
size
|
|
106
|
+
]};" -->
|
|
107
|
+
<button
|
|
108
|
+
onmouseenter={tt.onmouseenter}
|
|
109
|
+
onmouseleave={tt.onmouseleave}
|
|
110
|
+
class:noninteractive
|
|
111
|
+
class:relative
|
|
112
|
+
class:default={variant === Variant.Default}
|
|
113
|
+
class:card-inner={variant === Variant.CardInner}
|
|
114
|
+
class:card={variant === Variant.Card}
|
|
115
|
+
class:call-to-action={colourSet === ColourSet.CallToAction}
|
|
116
|
+
class:primary={colourSet === ColourSet.Primary}
|
|
117
|
+
class:secondary-colour={colourSet === ColourSet.Secondary}
|
|
118
|
+
class:secondary-variant={variant === Variant.Secondary}
|
|
119
|
+
class:warning={colourSet === ColourSet.Warning}
|
|
120
|
+
class:error={colourSet === ColourSet.Error}
|
|
121
|
+
class:info={colourSet === ColourSet.Info}
|
|
122
|
+
class:fill-height={size === Size.FillHeight}
|
|
123
|
+
class:fill-width={size === Size.FillWidth}
|
|
124
|
+
style="--fallback-padding-horizontal: {paddingSizesHorizontal[
|
|
125
|
+
size
|
|
126
|
+
]}; --fallback-padding-vertical: {paddingSizesVertical[size]}; --border-width: {borderSizes[
|
|
127
|
+
size
|
|
128
|
+
]};"
|
|
129
|
+
class:dashed
|
|
130
|
+
class:full-width={fullWidth}
|
|
131
|
+
class:toolbar={variant === Variant.Toolbar}
|
|
132
|
+
class:left={side === Side.Left}
|
|
133
|
+
class:right={side === Side.Right}
|
|
134
|
+
class:top={side === Side.Top}
|
|
135
|
+
class:bottom={side === Side.Bottom}
|
|
136
|
+
class:toggled
|
|
137
|
+
class:nowrap
|
|
138
|
+
{type}
|
|
139
|
+
aria-label={label}
|
|
140
|
+
{disabled}
|
|
141
|
+
onclick={(e) => {
|
|
142
|
+
tt.onclick();
|
|
143
|
+
onclick?.(e);
|
|
144
|
+
}}
|
|
145
|
+
{onfocus}
|
|
146
|
+
{onblur}
|
|
147
|
+
{onkeydown}
|
|
148
|
+
>
|
|
149
|
+
<div class="icon-container">
|
|
150
|
+
{#if iconLeft}
|
|
151
|
+
<Icon
|
|
152
|
+
{...iconLeft}
|
|
153
|
+
colour={iconColours[colourSet]}
|
|
154
|
+
size={iconLeft.size ?? size}
|
|
155
|
+
/>
|
|
156
|
+
{/if}
|
|
157
|
+
{#if iconTop}
|
|
158
|
+
<Icon {...iconTop} />
|
|
159
|
+
{/if}
|
|
160
|
+
{#if children}
|
|
161
|
+
<span>{@render children()}</span>
|
|
162
|
+
{/if}
|
|
163
|
+
{#if iconBottom}
|
|
164
|
+
<Icon {...iconBottom} />
|
|
165
|
+
{/if}
|
|
166
|
+
{#if iconRight}
|
|
167
|
+
<Icon
|
|
168
|
+
{...iconRight}
|
|
169
|
+
colour={iconColours[colourSet]}
|
|
170
|
+
size={iconRight.size ?? size}
|
|
171
|
+
/>
|
|
172
|
+
{/if}
|
|
173
|
+
</div>
|
|
174
|
+
</button>
|
|
175
|
+
|
|
209
176
|
<style>.card {
|
|
210
177
|
color: #3a4952;
|
|
211
178
|
fill: #3a4952;
|
|
@@ -519,4 +486,4 @@ button.toolbar:not([disabled]).toggled.bottom {
|
|
|
519
486
|
}
|
|
520
487
|
button.toolbar:not([disabled]).toggled svg {
|
|
521
488
|
fill: #259fc7;
|
|
522
|
-
}</style>
|
|
489
|
+
}</style>
|