@lavalogic/scoria 0.33.0 → 0.34.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/dist/Components/AccordionGroup.svelte +5 -24
- package/dist/Components/AccordionGroup.svelte.d.ts +2 -25
- package/dist/Components/AccordionGroupButton.svelte +41 -49
- 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/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
>
|
|
7
7
|
import AccordionGroupButton from './AccordionGroupButton.svelte';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { cubicOut } from 'svelte/easing';
|
|
10
|
+
import { slide } from 'svelte/transition';
|
|
10
11
|
import type { AccordionGroupProps } from './AccordionGroupProps.js';
|
|
11
12
|
|
|
12
13
|
let {
|
|
@@ -16,27 +17,6 @@
|
|
|
16
17
|
noRadius = false,
|
|
17
18
|
grow = false,
|
|
18
19
|
}: AccordionGroupProps<CommonDenominator> = $props();
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Animates the opacity and scale of an element. `in` transitions animate from the provided values, passed as parameters, to an element's current (default) values. `out` transitions animate from an element's default values to the provided values.
|
|
22
|
-
*
|
|
23
|
-
* @param {Element} node
|
|
24
|
-
* @param {ScaleParams} [params]
|
|
25
|
-
* @returns {TransitionConfig}
|
|
26
|
-
*/
|
|
27
|
-
export function scale(_node: Element, { delay = 0, duration = 400, easing = cubicInOut } = {}) {
|
|
28
|
-
// const transform = style.transform === 'none' ? '' : style.transform;
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
delay,
|
|
32
|
-
duration,
|
|
33
|
-
easing,
|
|
34
|
-
css: (t: number, _u: number) => {
|
|
35
|
-
return `max-height: ${t * 100}%;
|
|
36
|
-
opacity: ${t}`;
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
20
|
</script>
|
|
41
21
|
|
|
42
22
|
<div
|
|
@@ -52,7 +32,7 @@
|
|
|
52
32
|
selected={isSelected}
|
|
53
33
|
/>
|
|
54
34
|
{#if isSelected}
|
|
55
|
-
<div transition:
|
|
35
|
+
<div transition:slide={{ duration: 200, easing: cubicOut }}>
|
|
56
36
|
{@render selected.content(selected.args)}
|
|
57
37
|
</div>
|
|
58
38
|
{/if}
|
|
@@ -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;
|
|
@@ -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']>> & {
|
|
@@ -5,15 +5,20 @@
|
|
|
5
5
|
generics="Args"
|
|
6
6
|
>
|
|
7
7
|
import { devCatch } from '../Helpers/Helpers.svelte.js';
|
|
8
|
-
import { Colour } from '../scss/colours.js';
|
|
8
|
+
import { Colour, ColourSet } from '../scss/colours.js';
|
|
9
9
|
import { Size } from '../Types/Internal/Size.js';
|
|
10
|
+
import type { AccordionGroupButtonProps } from './AccordionGroupButtonProps.js';
|
|
11
|
+
import Action from './Action.svelte';
|
|
10
12
|
import Icon from './Icon.svelte';
|
|
11
|
-
import type { TabGroupButtonProps } from './TabGroupButtonProps.js';
|
|
12
13
|
|
|
13
|
-
let {
|
|
14
|
+
let {
|
|
15
|
+
option,
|
|
16
|
+
selected: isSelected,
|
|
17
|
+
noRadius = false,
|
|
18
|
+
}: AccordionGroupButtonProps<Args> = $props();
|
|
14
19
|
|
|
15
20
|
let disabled = $state(true);
|
|
16
|
-
let
|
|
21
|
+
let isVisible = $state(true);
|
|
17
22
|
let isValid = $state(true);
|
|
18
23
|
|
|
19
24
|
$effect(() => {
|
|
@@ -43,67 +48,59 @@
|
|
|
43
48
|
|
|
44
49
|
$effect(() => {
|
|
45
50
|
if (typeof option.visible === 'boolean') {
|
|
46
|
-
|
|
51
|
+
isVisible = option.visible;
|
|
47
52
|
} else if (option.visible == undefined) {
|
|
48
|
-
|
|
53
|
+
isVisible = true;
|
|
49
54
|
} else {
|
|
50
55
|
option.visible
|
|
51
56
|
.then((v) => {
|
|
52
|
-
|
|
57
|
+
isVisible = v;
|
|
53
58
|
})
|
|
54
59
|
.catch(devCatch);
|
|
55
60
|
}
|
|
56
61
|
});
|
|
57
62
|
</script>
|
|
58
63
|
|
|
59
|
-
<
|
|
60
|
-
class:
|
|
61
|
-
onclick={() => {
|
|
62
|
-
option.onclick();
|
|
63
|
-
}}
|
|
64
|
-
type="button"
|
|
64
|
+
<div
|
|
65
|
+
class:isSelected
|
|
65
66
|
class="tab"
|
|
66
67
|
class:invalid={!isValid}
|
|
67
|
-
{
|
|
68
|
-
class:hidden={!visible}
|
|
68
|
+
class:hidden={!isVisible}
|
|
69
69
|
class:no-radius={noRadius}
|
|
70
70
|
>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/> -->
|
|
71
|
+
{#if typeof option.label == 'string'}
|
|
72
|
+
{option.label}
|
|
73
|
+
{:else}
|
|
74
|
+
{@render option.label()}
|
|
75
|
+
{/if}
|
|
76
|
+
<div class="spacer"></div>
|
|
78
77
|
|
|
79
|
-
{option.
|
|
78
|
+
{#if option.extras}
|
|
79
|
+
{@render option.extras()}
|
|
80
|
+
{/if}
|
|
80
81
|
{#if !isValid}
|
|
81
82
|
<Icon
|
|
82
83
|
name="error"
|
|
83
84
|
colour={Colour['$error-border']}
|
|
84
85
|
size={Size.Small}
|
|
85
86
|
/>
|
|
86
|
-
<!-- {:else}
|
|
87
|
-
<Icon
|
|
88
|
-
name="nothing"
|
|
89
|
-
colour={Colour['$brand-primary']}
|
|
90
|
-
size={Size.Small}
|
|
91
|
-
{...option.iconRight}
|
|
92
|
-
/> -->
|
|
93
87
|
{/if}
|
|
94
|
-
|
|
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>
|
|
95
98
|
|
|
96
|
-
<style
|
|
97
|
-
display: none !important;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.tab {
|
|
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
|
-
|
|
120
|
+
.tab .spacer {
|
|
121
|
+
margin: auto;
|
|
130
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 {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as AccordionGroup } from './Components/AccordionGroup.svelte';
|
|
2
|
+
export type { AccordionGroupButtonProps, AccordionGroupOption, } from './Components/AccordionGroupButtonProps.js';
|
|
2
3
|
export type { AccordionGroupProps } from './Components/AccordionGroupProps.js';
|
|
3
4
|
export { default as Action } from './Components/Action.svelte';
|
|
4
5
|
export { default as AlertModal } from './Components/AlertModal.svelte';
|