@lavalogic/scoria 0.40.14 → 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 -86
- package/dist/Components/CollapsibleMenuGroup.svelte +52 -56
- 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 +69 -82
- 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/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
package/README.md
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
# Svelte library
|
|
2
|
-
|
|
3
|
-
Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
|
|
4
|
-
|
|
5
|
-
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
|
|
6
|
-
|
|
7
|
-
## Creating a project
|
|
8
|
-
|
|
9
|
-
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
# create a new project in the current directory
|
|
13
|
-
npx sv create
|
|
14
|
-
|
|
15
|
-
# create a new project in my-app
|
|
16
|
-
npx sv create my-app
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Developing
|
|
20
|
-
|
|
21
|
-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
npm run dev
|
|
25
|
-
|
|
26
|
-
# or start the server and open the app in a new browser tab
|
|
27
|
-
npm run dev -- --open
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
31
|
-
|
|
32
|
-
## Building
|
|
33
|
-
|
|
34
|
-
To build your library:
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
npm pack
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
To create a production version of your showcase app:
|
|
41
|
-
|
|
42
|
-
```sh
|
|
43
|
-
npm run build
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
You can preview the production build with `npm run preview`.
|
|
47
|
-
|
|
48
|
-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
49
|
-
|
|
50
|
-
## Publishing
|
|
51
|
-
|
|
52
|
-
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
53
|
-
|
|
54
|
-
To publish your library to [npm](https://www.npmjs.com):
|
|
55
|
-
|
|
56
|
-
```sh
|
|
57
|
-
npm publish
|
|
58
|
-
```
|
|
1
|
+
# Svelte library
|
|
2
|
+
|
|
3
|
+
Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
|
|
4
|
+
|
|
5
|
+
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
|
|
6
|
+
|
|
7
|
+
## Creating a project
|
|
8
|
+
|
|
9
|
+
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
# create a new project in the current directory
|
|
13
|
+
npx sv create
|
|
14
|
+
|
|
15
|
+
# create a new project in my-app
|
|
16
|
+
npx sv create my-app
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Developing
|
|
20
|
+
|
|
21
|
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm run dev
|
|
25
|
+
|
|
26
|
+
# or start the server and open the app in a new browser tab
|
|
27
|
+
npm run dev -- --open
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
31
|
+
|
|
32
|
+
## Building
|
|
33
|
+
|
|
34
|
+
To build your library:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm pack
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
To create a production version of your showcase app:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm run build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can preview the production build with `npm run preview`.
|
|
47
|
+
|
|
48
|
+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
49
|
+
|
|
50
|
+
## Publishing
|
|
51
|
+
|
|
52
|
+
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
53
|
+
|
|
54
|
+
To publish your library to [npm](https://www.npmjs.com):
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm publish
|
|
58
|
+
```
|
|
@@ -1,48 +1,37 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
generics="CommonDenominator"
|
|
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
|
-
{noRadius}
|
|
36
|
-
selected={isSelected}
|
|
37
|
-
/>
|
|
38
|
-
{#if isSelected}
|
|
39
|
-
<div transition:slide={{ duration: slideDuration, easing: cubicOut }}>
|
|
40
|
-
{@render selected.content(selected.args)}
|
|
41
|
-
</div>
|
|
42
|
-
{/if}
|
|
43
|
-
{/each}
|
|
44
|
-
</div>
|
|
45
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="CommonDenominator"
|
|
6
|
+
>import AccordionGroupButton from "./AccordionGroupButton.svelte";
|
|
7
|
+
import { cubicOut } from "svelte/easing";
|
|
8
|
+
import { slide } from "svelte/transition";
|
|
9
|
+
import { usePrefersReducedMotion } from "../Helpers/prefersReducedMotion.svelte.js";
|
|
10
|
+
let { tabs, selected, noRadius = false, grow = false } = $props();
|
|
11
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
12
|
+
const slideDuration = $derived(reducedMotion.matches ? 0 : 200);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
class="wrapper"
|
|
17
|
+
class:no-radius={noRadius}
|
|
18
|
+
class:grow
|
|
19
|
+
>
|
|
20
|
+
{#each tabs as option (option.label)}
|
|
21
|
+
{@const isSelected = selected === option}
|
|
22
|
+
<AccordionGroupButton
|
|
23
|
+
{option}
|
|
24
|
+
{noRadius}
|
|
25
|
+
selected={isSelected}
|
|
26
|
+
/>
|
|
27
|
+
{#if isSelected}
|
|
28
|
+
<div transition:slide={{ duration: slideDuration, easing: cubicOut }}>
|
|
29
|
+
{@render selected.content(selected.args)}
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
32
|
+
{/each}
|
|
33
|
+
</div>
|
|
34
|
+
|
|
46
35
|
<style>.wrapper {
|
|
47
36
|
box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.1333333333);
|
|
48
37
|
border-radius: 4px;
|
|
@@ -86,4 +75,4 @@
|
|
|
86
75
|
flex-grow: 1;
|
|
87
76
|
overflow: visible;
|
|
88
77
|
border-radius: 0 4px 0 4px;
|
|
89
|
-
}</style>
|
|
78
|
+
}</style>
|
|
@@ -1,78 +1,70 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
generics="Args"
|
|
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
|
-
</button>
|
|
69
|
-
{#if option.extras}
|
|
70
|
-
<div class="extras">
|
|
71
|
-
{@render option.extras()}
|
|
72
|
-
</div>
|
|
73
|
-
{/if}
|
|
74
|
-
</div>
|
|
75
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="Args"
|
|
6
|
+
>import { useAsyncFlag } from "../Helpers/AsyncFlag.svelte.js";
|
|
7
|
+
import { Colour } from "../scss/colours.js";
|
|
8
|
+
import { Size } from "../Types/Internal/Size.js";
|
|
9
|
+
import Icon from "./Icon.svelte";
|
|
10
|
+
const { option, selected: isSelected, noRadius = false } = $props();
|
|
11
|
+
const isValid = useAsyncFlag(() => option.isValid, true);
|
|
12
|
+
const disabled = useAsyncFlag(() => option.disabled, false);
|
|
13
|
+
const isVisible = useAsyncFlag(() => option.visible, true);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<!--
|
|
17
|
+
Single-button row: the whole header is one interactive element, with the
|
|
18
|
+
expand chevron rendered as decorative content of that same button. This
|
|
19
|
+
resolves the previous a11y issue (a nested toggle inside the row read as
|
|
20
|
+
two interactive elements). The `extras` snippet is intentionally placed
|
|
21
|
+
OUTSIDE the button so that consumers passing interactive content into
|
|
22
|
+
`extras` don't create nested-button markup.
|
|
23
|
+
-->
|
|
24
|
+
<div
|
|
25
|
+
class="tab-wrapper"
|
|
26
|
+
class:isSelected
|
|
27
|
+
class:invalid={!isValid.value}
|
|
28
|
+
class:hidden={!isVisible.value}
|
|
29
|
+
class:no-radius={noRadius}
|
|
30
|
+
>
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
class="tab"
|
|
34
|
+
disabled={disabled.value}
|
|
35
|
+
aria-expanded={isSelected}
|
|
36
|
+
aria-label={isSelected ? 'Collapse section' : 'Expand section'}
|
|
37
|
+
onclick={() => {
|
|
38
|
+
option.onclick();
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{#if typeof option.label == 'string'}
|
|
42
|
+
<span class="label">{option.label}</span>
|
|
43
|
+
{:else}
|
|
44
|
+
{@render option.label()}
|
|
45
|
+
{/if}
|
|
46
|
+
<div class="spacer"></div>
|
|
47
|
+
|
|
48
|
+
{#if !isValid.value}
|
|
49
|
+
<Icon
|
|
50
|
+
name="error"
|
|
51
|
+
colour={Colour['$error-border']}
|
|
52
|
+
size={Size.Small}
|
|
53
|
+
/>
|
|
54
|
+
{/if}
|
|
55
|
+
<Icon
|
|
56
|
+
name={isSelected ? 'circle-minus' : 'circle-plus'}
|
|
57
|
+
colour={Colour['$primary-blue-13']}
|
|
58
|
+
size={Size.Medium}
|
|
59
|
+
/>
|
|
60
|
+
</button>
|
|
61
|
+
{#if option.extras}
|
|
62
|
+
<div class="extras">
|
|
63
|
+
{@render option.extras()}
|
|
64
|
+
</div>
|
|
65
|
+
{/if}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
76
68
|
<style>.tab-wrapper {
|
|
77
69
|
position: relative;
|
|
78
70
|
background-color: #f4f7f9;
|
|
@@ -119,4 +111,4 @@
|
|
|
119
111
|
align-items: center;
|
|
120
112
|
gap: 1.5rem;
|
|
121
113
|
pointer-events: auto;
|
|
122
|
-
}</style>
|
|
114
|
+
}</style>
|
|
@@ -1,138 +1,106 @@
|
|
|
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
|
-
[Size.TripleXLarge]: 2.4375,
|
|
40
|
-
[Size.FillWidth]: -1,
|
|
41
|
-
[Size.FillHeight]: -1,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<script lang="ts">
|
|
47
|
-
const {
|
|
48
|
-
icon,
|
|
49
|
-
id,
|
|
50
|
-
border = false,
|
|
51
|
-
shape = Shape.Rectangle,
|
|
52
|
-
label,
|
|
53
|
-
colourSet = ColourSet.Secondary,
|
|
54
|
-
size = Size.Medium,
|
|
55
|
-
paddingSize,
|
|
56
|
-
type = 'button',
|
|
57
|
-
noTabIndex = false,
|
|
58
|
-
disabled,
|
|
59
|
-
backgroundColour,
|
|
60
|
-
hoverBackgroundColour,
|
|
61
|
-
'data-type': dataType,
|
|
62
|
-
onfocus,
|
|
63
|
-
onblur,
|
|
64
|
-
onclick,
|
|
65
|
-
onkeydown: onkeydownProp,
|
|
66
|
-
style = '',
|
|
67
|
-
side,
|
|
68
|
-
'aria-expanded': ariaExpanded,
|
|
69
|
-
'aria-controls': ariaControls,
|
|
70
|
-
}: ActionProps = $props();
|
|
71
|
-
|
|
72
|
-
const iconSize: Size = $derived(icon.size ?? size);
|
|
73
|
-
|
|
74
|
-
const pad: string = $derived.by(() => {
|
|
75
|
-
const padSize = paddingSize ?? size;
|
|
76
|
-
return padSize === Size.FillWidth ? '' : `${paddings[shape][padSize]}rem`;
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
function onkeydown(e: KeyboardEvent) {
|
|
80
|
-
passthrough(e);
|
|
81
|
-
|
|
82
|
-
if (document.activeElement === e.target) {
|
|
83
|
-
onkeydownProp?.(e);
|
|
84
|
-
}
|
|
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 { Shape } from "../Types/Internal/Shape.js";
|
|
9
|
+
import { Side } from "../Types/Internal/Side.js";
|
|
10
|
+
import { Size } from "../Types/Internal/Size.js";
|
|
11
|
+
import { ColourSet } from "../scss/colours.js";
|
|
12
|
+
import Icon from "./Icon.svelte";
|
|
13
|
+
const paddings = {
|
|
14
|
+
[Shape.Rectangle]: {
|
|
15
|
+
[Size.Tiny]: .125,
|
|
16
|
+
[Size.Small]: .1875,
|
|
17
|
+
[Size.MediumSmall]: .3125,
|
|
18
|
+
[Size.Medium]: .375,
|
|
19
|
+
[Size.MediumLarge]: .5,
|
|
20
|
+
[Size.Large]: .625,
|
|
21
|
+
[Size.XLarge]: .6875,
|
|
22
|
+
[Size.DoubleXLarge]: .8125,
|
|
23
|
+
[Size.TripleXLarge]: .875,
|
|
24
|
+
[Size.FillWidth]: -1,
|
|
25
|
+
[Size.FillHeight]: -1
|
|
26
|
+
},
|
|
27
|
+
[Shape.Circle]: {
|
|
28
|
+
[Size.Tiny]: .1875,
|
|
29
|
+
[Size.Small]: .5,
|
|
30
|
+
[Size.MediumSmall]: .875,
|
|
31
|
+
[Size.Medium]: 1.0625,
|
|
32
|
+
[Size.MediumLarge]: 1.375,
|
|
33
|
+
[Size.Large]: 1.75,
|
|
34
|
+
[Size.XLarge]: 1.9375,
|
|
35
|
+
[Size.DoubleXLarge]: 2.25,
|
|
36
|
+
[Size.TripleXLarge]: 2.4375,
|
|
37
|
+
[Size.FillWidth]: -1,
|
|
38
|
+
[Size.FillHeight]: -1
|
|
85
39
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
{
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<script lang="ts">const { icon, id, border = false, shape = Shape.Rectangle, label, colourSet = ColourSet.Secondary, size = Size.Medium, paddingSize, type = "button", noTabIndex = false, disabled, backgroundColour, hoverBackgroundColour, "data-type": dataType, onfocus, onblur, onclick, onkeydown: onkeydownProp, style = "", side, "aria-expanded": ariaExpanded, "aria-controls": ariaControls } = $props();
|
|
44
|
+
const iconSize = $derived(icon.size ?? size);
|
|
45
|
+
const pad = $derived.by(() => {
|
|
46
|
+
const padSize = paddingSize ?? size;
|
|
47
|
+
return padSize === Size.FillWidth ? "" : `${paddings[shape][padSize]}rem`;
|
|
48
|
+
});
|
|
49
|
+
function onkeydown(e) {
|
|
50
|
+
passthrough(e);
|
|
51
|
+
if (document.activeElement === e.target) {
|
|
52
|
+
onkeydownProp?.(e);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Shared tooltip lifecycle: hover handlers plus unmount-time teardown.
|
|
56
|
+
// Action lives inside short-lived hosts (table rows, modal panels,
|
|
57
|
+
// accordion content) so the cleanup is load-bearing - without it,
|
|
58
|
+
// churn leaves the global tooltip painting against a node that no
|
|
59
|
+
// longer exists.
|
|
60
|
+
const tt = useTooltip({
|
|
61
|
+
text: () => label,
|
|
62
|
+
arrow: () => side ?? Side.Left
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<button
|
|
67
|
+
{id}
|
|
68
|
+
onmouseenter={tt.onmouseenter}
|
|
69
|
+
onmouseleave={tt.onmouseleave}
|
|
70
|
+
tabindex={noTabIndex ? -1 : undefined}
|
|
71
|
+
data-type={dataType}
|
|
72
|
+
style="{pad ? `--pad: ${pad};` : ''} {backgroundColour
|
|
73
|
+
? `--background-colour: ${backgroundColour};`
|
|
74
|
+
: ``} {hoverBackgroundColour
|
|
75
|
+
? `--hover-background-colour: ${hoverBackgroundColour};`
|
|
76
|
+
: ``}{style}"
|
|
77
|
+
class:border
|
|
78
|
+
class:circular={shape === Shape.Circle}
|
|
79
|
+
class:primary={colourSet === ColourSet.Primary}
|
|
80
|
+
class:secondary={colourSet === ColourSet.Secondary}
|
|
81
|
+
class:auxiliary={colourSet === ColourSet.Auxiliary}
|
|
82
|
+
class:info={colourSet === ColourSet.Info}
|
|
83
|
+
class:error={colourSet === ColourSet.Error}
|
|
84
|
+
class:fill-width={size === Size.FillWidth}
|
|
85
|
+
class:fill-height={size === Size.FillHeight}
|
|
86
|
+
{type}
|
|
87
|
+
{disabled}
|
|
88
|
+
{onfocus}
|
|
89
|
+
{onblur}
|
|
90
|
+
{onkeydown}
|
|
91
|
+
onclick={(e) => {
|
|
92
|
+
tt.onclick();
|
|
93
|
+
onclick?.(e);
|
|
94
|
+
}}
|
|
95
|
+
aria-label={label}
|
|
96
|
+
aria-expanded={ariaExpanded}
|
|
97
|
+
aria-controls={ariaControls}
|
|
98
|
+
><Icon
|
|
99
|
+
{...icon}
|
|
100
|
+
size={iconSize}
|
|
101
|
+
/></button
|
|
102
|
+
>
|
|
103
|
+
|
|
136
104
|
<style>button {
|
|
137
105
|
color: #3a4952;
|
|
138
106
|
fill: #3a4952;
|
|
@@ -228,4 +196,4 @@ button.circular {
|
|
|
228
196
|
button {
|
|
229
197
|
padding: var(--pad);
|
|
230
198
|
cursor: pointer;
|
|
231
|
-
}</style>
|
|
199
|
+
}</style>
|