@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.
- package/README.md +58 -58
- package/dist/Components/AccordionGroup.svelte +44 -63
- package/dist/Components/AccordionGroup.svelte.d.ts +2 -25
- package/dist/Components/AccordionGroupButton.svelte +106 -114
- package/dist/Components/AccordionGroupButton.svelte.d.ts +2 -2
- package/dist/Components/AccordionGroupButtonProps.d.ts +21 -0
- package/dist/Components/AccordionGroupButtonProps.js +1 -0
- package/dist/Components/Action.svelte +138 -138
- package/dist/Components/AlertModal.svelte +125 -125
- package/dist/Components/Base/ContextWrapper.svelte +50 -50
- package/dist/Components/Base/Pagination.svelte +190 -190
- package/dist/Components/Base/Snippets.svelte +29 -29
- package/dist/Components/BigRadioSet.svelte +29 -29
- package/dist/Components/Bubble.svelte +77 -77
- package/dist/Components/Button.svelte +197 -197
- package/dist/Components/Checkbox.svelte +68 -68
- package/dist/Components/CollapsibleCard.svelte +70 -70
- package/dist/Components/Contexts/ContextMenu.svelte +157 -157
- package/dist/Components/Contexts/ContextMenuDivider.svelte +11 -11
- package/dist/Components/Contexts/ContextMenuOption.svelte +52 -52
- package/dist/Components/Contexts/Toast.svelte +61 -61
- package/dist/Components/Contexts/ToastContainer.svelte +46 -46
- package/dist/Components/Contexts/Tooltip.svelte +26 -26
- package/dist/Components/DataMatrixIcon.svelte +41 -41
- package/dist/Components/DateInput.svelte +109 -109
- package/dist/Components/DatePicker.svelte +312 -312
- package/dist/Components/DesktopModal.svelte +106 -106
- package/dist/Components/Dial.svelte +151 -151
- package/dist/Components/DimensionInput.svelte +184 -184
- package/dist/Components/DragMenu/DragMenuHolder.svelte +106 -106
- package/dist/Components/DragMenu/DraggableCard.svelte +41 -41
- package/dist/Components/FileCard.svelte +20 -20
- package/dist/Components/FileUpload.svelte +196 -196
- package/dist/Components/GridInput.svelte +190 -190
- package/dist/Components/GridInputSet.svelte +22 -22
- package/dist/Components/HorizontalTabGroup.svelte +78 -78
- package/dist/Components/HorizontalTabGroupButton.svelte +96 -96
- package/dist/Components/Icon.svelte +97 -97
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/LoadingAnimation.svelte +32 -32
- package/dist/Components/LoadingModal.svelte +47 -47
- package/dist/Components/LoadingOverlay.svelte +27 -27
- package/dist/Components/Modal.svelte +251 -251
- package/dist/Components/MultiSelect.svelte +197 -197
- package/dist/Components/Nav/Nav.svelte +97 -97
- package/dist/Components/Nav/NavServiceMenuList.svelte +34 -34
- package/dist/Components/Nav/NavTab.svelte +91 -91
- package/dist/Components/Nav/ServiceMenuItem.svelte +91 -91
- package/dist/Components/Nav/ServicesNav.svelte +53 -53
- package/dist/Components/NumberInput.svelte +144 -144
- package/dist/Components/PageHeading.svelte +36 -36
- package/dist/Components/PasswordInput.svelte +73 -73
- package/dist/Components/Portal.svelte +25 -25
- package/dist/Components/ProgressBubble.svelte +80 -80
- package/dist/Components/QuerySelect.svelte +411 -411
- package/dist/Components/SingleSelect.svelte +261 -261
- package/dist/Components/StepButton.svelte +120 -120
- package/dist/Components/StepForm.svelte +108 -108
- package/dist/Components/Switch.svelte +36 -36
- package/dist/Components/Table/Body/QuickSearchCell.svelte +632 -632
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +30 -30
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +56 -56
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +179 -179
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +49 -49
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +180 -180
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +102 -102
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +119 -119
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +114 -114
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +96 -96
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +72 -72
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +131 -131
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +144 -144
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +238 -238
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +358 -358
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +338 -338
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +183 -183
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +309 -309
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +369 -369
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +170 -170
- package/dist/Components/Table/Body/Rows/TableRow.svelte +259 -259
- package/dist/Components/Table/Body/TableBody.svelte +67 -67
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +39 -39
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +28 -28
- package/dist/Components/Table/Headers/TableHead.svelte +260 -260
- package/dist/Components/Table/Misc/ColumnPanel.svelte +78 -78
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +99 -99
- package/dist/Components/Table/Misc/FilterInput.svelte +556 -556
- package/dist/Components/Table/Misc/FilterPanel.svelte +46 -46
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +67 -67
- package/dist/Components/Table/Misc/SidePanel.svelte +32 -32
- package/dist/Components/Table/Misc/TableFooter.svelte +304 -304
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +156 -156
- package/dist/Components/Table/Misc/TableSidebar.svelte +176 -176
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +77 -77
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +91 -91
- package/dist/Components/Table/NestedTable.svelte +84 -84
- package/dist/Components/Table/Table.svelte +492 -492
- package/dist/Components/Test/TestContextConsumer.svelte +13 -13
- package/dist/Components/TextArea.svelte +108 -108
- package/dist/Components/TextInput.svelte +147 -147
- package/dist/Components/ThreeStateRadio.svelte +124 -124
- package/dist/Components/Touch/BoolCard.svelte +52 -52
- package/dist/Components/Touch/DateModal.svelte +217 -217
- package/dist/Components/Touch/EditCard.svelte +52 -52
- package/dist/Components/Touch/InfoCard.svelte +24 -24
- package/dist/Components/Touch/InfoTextCard.svelte +21 -21
- package/dist/Components/Touch/ModalExplanation.svelte +20 -20
- package/dist/Components/Touch/NumberKeyboard.svelte +268 -268
- package/dist/Components/Touch/NumberModal.svelte +69 -69
- package/dist/Components/Touch/PlusMinusCard.svelte +50 -50
- package/dist/Components/Touch/SelectModal.svelte +105 -105
- package/dist/Components/Touch/SummaryCard.svelte +65 -65
- package/dist/Components/Touch/TextAreaModal.svelte +86 -86
- package/dist/Components/Touch/TextModal.svelte +123 -123
- package/dist/Components/Touch/TouchCard.svelte +28 -28
- package/dist/Components/Touch/TouchModal.svelte +259 -259
- package/dist/Components/Touch/UtilityButton.svelte +91 -91
- package/dist/Components/VerticalTabGroup.svelte +66 -66
- package/dist/Components/VerticalTabGroupButton.svelte +97 -97
- package/dist/Helpers/Datamatrix.d.ts +10 -10
- package/dist/Helpers/Datamatrix.js +1 -1
- package/dist/Helpers/Helpers.svelte.js +6 -4
- package/dist/Types/Examples/ExampleModal.svelte +34 -34
- package/dist/index.d.ts +1 -0
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3016 -3016
- package/dist/scss/_sizing.scss +69 -69
- package/dist/scss/_transitions.scss +8 -8
- package/package.json +2 -2
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,64 +1,44 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
generics="CommonDenominator"
|
|
6
|
-
>
|
|
7
|
-
import AccordionGroupButton from './AccordionGroupButton.svelte';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
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
|
-
<div
|
|
43
|
-
class="wrapper"
|
|
44
|
-
class:no-radius={noRadius}
|
|
45
|
-
class:grow
|
|
46
|
-
>
|
|
47
|
-
{#each tabs as option (option)}
|
|
48
|
-
{@const isSelected = selected === option}
|
|
49
|
-
<AccordionGroupButton
|
|
50
|
-
{option}
|
|
51
|
-
{noRadius}
|
|
52
|
-
selected={isSelected}
|
|
53
|
-
/>
|
|
54
|
-
{#if isSelected}
|
|
55
|
-
<div transition:scale={{ duration: 300, easing: linear }}>
|
|
56
|
-
{@render selected.content(selected.args)}
|
|
57
|
-
</div>
|
|
58
|
-
{/if}
|
|
59
|
-
{/each}
|
|
60
|
-
</div>
|
|
61
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="CommonDenominator"
|
|
6
|
+
>
|
|
7
|
+
import AccordionGroupButton from './AccordionGroupButton.svelte';
|
|
8
|
+
|
|
9
|
+
import { cubicOut } from 'svelte/easing';
|
|
10
|
+
import { slide } from 'svelte/transition';
|
|
11
|
+
import type { AccordionGroupProps } from './AccordionGroupProps.js';
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
// name: _name, //FIXME why is this not implemented?
|
|
15
|
+
tabs,
|
|
16
|
+
selected,
|
|
17
|
+
noRadius = false,
|
|
18
|
+
grow = false,
|
|
19
|
+
}: AccordionGroupProps<CommonDenominator> = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div
|
|
23
|
+
class="wrapper"
|
|
24
|
+
class:no-radius={noRadius}
|
|
25
|
+
class:grow
|
|
26
|
+
>
|
|
27
|
+
{#each tabs as option (option)}
|
|
28
|
+
{@const isSelected = selected === option}
|
|
29
|
+
<AccordionGroupButton
|
|
30
|
+
{option}
|
|
31
|
+
{noRadius}
|
|
32
|
+
selected={isSelected}
|
|
33
|
+
/>
|
|
34
|
+
{#if isSelected}
|
|
35
|
+
<div transition:slide={{ duration: 200, easing: cubicOut }}>
|
|
36
|
+
{@render selected.content(selected.args)}
|
|
37
|
+
</div>
|
|
38
|
+
{/if}
|
|
39
|
+
{/each}
|
|
40
|
+
</div>
|
|
41
|
+
|
|
62
42
|
<style>.wrapper {
|
|
63
43
|
box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.1333333333);
|
|
64
44
|
border-radius: 4px;
|
|
@@ -90,9 +70,10 @@
|
|
|
90
70
|
border-radius: 4px 0 0 4px;
|
|
91
71
|
display: flex;
|
|
92
72
|
flex-flow: column nowrap;
|
|
73
|
+
padding: 1px;
|
|
93
74
|
gap: 1px;
|
|
75
|
+
background-color: #cbd4da;
|
|
94
76
|
min-width: 10rem;
|
|
95
|
-
background-color: #e9ecf1;
|
|
96
77
|
border-right: solid 1px #cbd4da;
|
|
97
78
|
overflow: auto;
|
|
98
79
|
flex-shrink: 0;
|
|
@@ -101,4 +82,4 @@
|
|
|
101
82
|
flex-grow: 1;
|
|
102
83
|
overflow: visible;
|
|
103
84
|
border-radius: 0 4px 0 4px;
|
|
104
|
-
}</style>
|
|
85
|
+
}</style>
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import { cubicInOut } from 'svelte/easing';
|
|
2
1
|
import type { AccordionGroupProps } from './AccordionGroupProps.js';
|
|
3
2
|
declare function $$render<CommonDenominator>(): {
|
|
4
3
|
props: AccordionGroupProps<CommonDenominator>;
|
|
5
|
-
exports: {
|
|
6
|
-
scale: (_node: Element, { delay, duration, easing }?: {
|
|
7
|
-
delay?: number | undefined;
|
|
8
|
-
duration?: number | undefined;
|
|
9
|
-
easing?: typeof cubicInOut | undefined;
|
|
10
|
-
}) => {
|
|
11
|
-
delay: number;
|
|
12
|
-
duration: number;
|
|
13
|
-
easing: typeof cubicInOut;
|
|
14
|
-
css: (t: number, _u: number) => string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
4
|
+
exports: {};
|
|
17
5
|
bindings: "";
|
|
18
6
|
slots: {};
|
|
19
7
|
events: {};
|
|
@@ -23,18 +11,7 @@ declare class __sveltets_Render<CommonDenominator> {
|
|
|
23
11
|
events(): ReturnType<typeof $$render<CommonDenominator>>['events'];
|
|
24
12
|
slots(): ReturnType<typeof $$render<CommonDenominator>>['slots'];
|
|
25
13
|
bindings(): "";
|
|
26
|
-
exports(): {
|
|
27
|
-
scale: (_node: Element, { delay, duration, easing }?: {
|
|
28
|
-
delay?: number | undefined;
|
|
29
|
-
duration?: number | undefined;
|
|
30
|
-
easing?: typeof cubicInOut | undefined;
|
|
31
|
-
}) => {
|
|
32
|
-
delay: number;
|
|
33
|
-
duration: number;
|
|
34
|
-
easing: typeof cubicInOut;
|
|
35
|
-
css: (t: number, _u: number) => string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
14
|
+
exports(): {};
|
|
38
15
|
}
|
|
39
16
|
interface $$IsomorphicComponent {
|
|
40
17
|
new <CommonDenominator>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<CommonDenominator>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<CommonDenominator>['props']>, ReturnType<__sveltets_Render<CommonDenominator>['events']>, ReturnType<__sveltets_Render<CommonDenominator>['slots']>> & {
|
|
@@ -1,109 +1,106 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
generics="Args"
|
|
6
|
-
>
|
|
7
|
-
import { devCatch } from '../Helpers/Helpers.svelte.js';
|
|
8
|
-
import { Colour } from '../scss/colours.js';
|
|
9
|
-
import { Size } from '../Types/Internal/Size.js';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
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
|
-
class
|
|
66
|
-
class
|
|
67
|
-
{
|
|
68
|
-
class:hidden={!
|
|
69
|
-
class:no-radius={noRadius}
|
|
70
|
-
>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.tab {
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="Args"
|
|
6
|
+
>
|
|
7
|
+
import { devCatch } from '../Helpers/Helpers.svelte.js';
|
|
8
|
+
import { Colour, ColourSet } from '../scss/colours.js';
|
|
9
|
+
import { Size } from '../Types/Internal/Size.js';
|
|
10
|
+
import type { AccordionGroupButtonProps } from './AccordionGroupButtonProps.js';
|
|
11
|
+
import Action from './Action.svelte';
|
|
12
|
+
import Icon from './Icon.svelte';
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
option,
|
|
16
|
+
selected: isSelected,
|
|
17
|
+
noRadius = false,
|
|
18
|
+
}: AccordionGroupButtonProps<Args> = $props();
|
|
19
|
+
|
|
20
|
+
let disabled = $state(true);
|
|
21
|
+
let isVisible = $state(true);
|
|
22
|
+
let isValid = $state(true);
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
if (typeof option.isValid === 'boolean') {
|
|
26
|
+
isValid = option.isValid;
|
|
27
|
+
} else {
|
|
28
|
+
option.isValid
|
|
29
|
+
?.then((v) => {
|
|
30
|
+
isValid = v;
|
|
31
|
+
})
|
|
32
|
+
.catch(devCatch);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
$effect(() => {
|
|
36
|
+
if (typeof option.disabled === 'boolean') {
|
|
37
|
+
disabled = option.disabled;
|
|
38
|
+
} else if (option.disabled == undefined) {
|
|
39
|
+
disabled = false;
|
|
40
|
+
} else {
|
|
41
|
+
option.disabled
|
|
42
|
+
.then((v) => {
|
|
43
|
+
disabled = v;
|
|
44
|
+
})
|
|
45
|
+
.catch(devCatch);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
$effect(() => {
|
|
50
|
+
if (typeof option.visible === 'boolean') {
|
|
51
|
+
isVisible = option.visible;
|
|
52
|
+
} else if (option.visible == undefined) {
|
|
53
|
+
isVisible = true;
|
|
54
|
+
} else {
|
|
55
|
+
option.visible
|
|
56
|
+
.then((v) => {
|
|
57
|
+
isVisible = v;
|
|
58
|
+
})
|
|
59
|
+
.catch(devCatch);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<div
|
|
65
|
+
class:isSelected
|
|
66
|
+
class="tab"
|
|
67
|
+
class:invalid={!isValid}
|
|
68
|
+
class:hidden={!isVisible}
|
|
69
|
+
class:no-radius={noRadius}
|
|
70
|
+
>
|
|
71
|
+
{#if typeof option.label == 'string'}
|
|
72
|
+
{option.label}
|
|
73
|
+
{:else}
|
|
74
|
+
{@render option.label()}
|
|
75
|
+
{/if}
|
|
76
|
+
<div class="spacer"></div>
|
|
77
|
+
|
|
78
|
+
{#if option.extras}
|
|
79
|
+
{@render option.extras()}
|
|
80
|
+
{/if}
|
|
81
|
+
{#if !isValid}
|
|
82
|
+
<Icon
|
|
83
|
+
name="error"
|
|
84
|
+
colour={Colour['$error-border']}
|
|
85
|
+
size={Size.Small}
|
|
86
|
+
/>
|
|
87
|
+
{/if}
|
|
88
|
+
<Action
|
|
89
|
+
icon={{ name: isSelected ? 'circle-minus' : 'circle-plus' }}
|
|
90
|
+
backgroundColour="transparent"
|
|
91
|
+
colourSet={ColourSet.Info}
|
|
92
|
+
{disabled}
|
|
93
|
+
onclick={() => {
|
|
94
|
+
option.onclick();
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<style>.tab {
|
|
101
100
|
color: #3a4952;
|
|
102
|
-
cursor: pointer;
|
|
103
101
|
font-size: 1rem;
|
|
104
102
|
font-weight: 500;
|
|
105
103
|
padding: 1rem;
|
|
106
|
-
background-color: #ffffff;
|
|
107
104
|
border: none;
|
|
108
105
|
text-align: start;
|
|
109
106
|
display: flex;
|
|
@@ -111,20 +108,15 @@
|
|
|
111
108
|
flex-shrink: 1;
|
|
112
109
|
align-items: center;
|
|
113
110
|
width: 100%;
|
|
114
|
-
gap:
|
|
111
|
+
gap: 1.5rem;
|
|
115
112
|
position: relative;
|
|
116
113
|
transition: border-color ease-out 0.15s 0s, background-color ease-out 0.15s 0s, color ease-out 0.15s 0s, fill ease-out 0.15s 0s;
|
|
117
|
-
}
|
|
118
|
-
.tab.selected {
|
|
119
|
-
color: #259fc7;
|
|
120
|
-
}
|
|
121
|
-
.tab:hover, .tab.selected:hover {
|
|
122
|
-
color: #49b8dc;
|
|
123
114
|
background-color: #f4f7f9;
|
|
115
|
+
border-bottom: solid 1px #cbd4da;
|
|
124
116
|
}
|
|
125
|
-
.tab
|
|
126
|
-
|
|
117
|
+
.tab.hidden {
|
|
118
|
+
display: none !important;
|
|
127
119
|
}
|
|
128
|
-
.tab
|
|
129
|
-
|
|
130
|
-
}</style>
|
|
120
|
+
.tab .spacer {
|
|
121
|
+
margin: auto;
|
|
122
|
+
}</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AccordionGroupButtonProps } from './AccordionGroupButtonProps.js';
|
|
2
2
|
declare function $$render<Args>(): {
|
|
3
|
-
props:
|
|
3
|
+
props: AccordionGroupButtonProps<Args>;
|
|
4
4
|
exports: {};
|
|
5
5
|
bindings: "";
|
|
6
6
|
slots: {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { IconProps } from './IconProps.js';
|
|
3
|
+
export interface AccordionGroupButtonProps<Args> {
|
|
4
|
+
option: AccordionGroupOption<Args>;
|
|
5
|
+
selected: boolean;
|
|
6
|
+
noRadius?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AccordionGroupOption<Args> {
|
|
9
|
+
label: string | Snippet;
|
|
10
|
+
content: Snippet<[Args]>;
|
|
11
|
+
extras?: Snippet;
|
|
12
|
+
onclick: () => void;
|
|
13
|
+
args: Args;
|
|
14
|
+
iconLeft?: IconProps;
|
|
15
|
+
iconRight?: IconProps;
|
|
16
|
+
isValid?: boolean | Promise<boolean>;
|
|
17
|
+
/** default false */
|
|
18
|
+
disabled?: boolean | Promise<boolean>;
|
|
19
|
+
/** default true */
|
|
20
|
+
visible?: boolean | Promise<boolean>;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|