sveltacular 0.0.38 → 0.0.40
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/forms/form-label.svelte +6 -1
- package/dist/forms/form-label.svelte.d.ts +1 -0
- package/dist/forms/form.svelte +2 -1
- package/dist/forms/form.svelte.d.ts +2 -0
- package/dist/forms/list-box/list-box.svelte +17 -4
- package/dist/generic/card/card.svelte +3 -1
- package/dist/generic/scorecard/scorecard.svelte +8 -2
- package/dist/generic/section/section.svelte +17 -1
- package/dist/generic/section/section.svelte.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/layout/flex-row.svelte +1 -1
- package/dist/layout/grid.svelte +17 -0
- package/dist/layout/grid.svelte.d.ts +27 -0
- package/dist/navigation/wizard/wizard.svelte +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script>export let id = void 0;
|
|
2
2
|
export let required = false;
|
|
3
|
+
export let disabled = false;
|
|
3
4
|
</script>
|
|
4
5
|
|
|
5
|
-
<label for={id} class:required><slot /></label>
|
|
6
|
+
<label for={id} class:required class:disabled><slot /></label>
|
|
6
7
|
|
|
7
8
|
<style>label {
|
|
8
9
|
display: block;
|
|
@@ -11,4 +12,8 @@ export let required = false;
|
|
|
11
12
|
label.required::after {
|
|
12
13
|
content: "*";
|
|
13
14
|
margin-left: 0.25rem;
|
|
15
|
+
}
|
|
16
|
+
label.disabled {
|
|
17
|
+
opacity: 0.5;
|
|
18
|
+
cursor: not-allowed;
|
|
14
19
|
}</style>
|
package/dist/forms/form.svelte
CHANGED
|
@@ -3,6 +3,7 @@ import Section from "../generic/section/section.svelte";
|
|
|
3
3
|
export let method = "get";
|
|
4
4
|
export let title = void 0;
|
|
5
5
|
export let action = void 0;
|
|
6
|
+
export let size = "full";
|
|
6
7
|
const dispatch = createEventDispatcher();
|
|
7
8
|
const onSubmit = (e) => {
|
|
8
9
|
e.preventDefault();
|
|
@@ -10,7 +11,7 @@ const onSubmit = (e) => {
|
|
|
10
11
|
};
|
|
11
12
|
</script>
|
|
12
13
|
|
|
13
|
-
<Section {title}>
|
|
14
|
+
<Section {title} {size}>
|
|
14
15
|
<form {method} {action} on:submit={onSubmit}>
|
|
15
16
|
<slot />
|
|
16
17
|
</form>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { FormFieldSizeOptions } from '../index.js';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
method?: "get" | "post" | "put" | "delete" | undefined;
|
|
5
6
|
title?: string | undefined;
|
|
6
7
|
action?: string | undefined;
|
|
8
|
+
size?: FormFieldSizeOptions | undefined;
|
|
7
9
|
};
|
|
8
10
|
events: {
|
|
9
11
|
submit: CustomEvent<void>;
|
|
@@ -35,11 +35,15 @@ const focusOnInput = () => {
|
|
|
35
35
|
};
|
|
36
36
|
const toggle = () => open = !open;
|
|
37
37
|
const clickArrow = () => {
|
|
38
|
+
if (disabled)
|
|
39
|
+
return;
|
|
38
40
|
toggle();
|
|
39
41
|
if (open)
|
|
40
42
|
focusOnInput();
|
|
41
43
|
};
|
|
42
44
|
const onInputKeyPress = (e) => {
|
|
45
|
+
if (disabled)
|
|
46
|
+
return;
|
|
43
47
|
if (e.key == "Escape") {
|
|
44
48
|
open = false;
|
|
45
49
|
return;
|
|
@@ -80,6 +84,8 @@ const applyFilter = () => {
|
|
|
80
84
|
filteredItems = searchText && isSeachable ? items.map((item, index) => ({ ...item, index })).filter((item) => item.name.toLowerCase().includes(searchText)) : items.map((item, index) => ({ ...item, index }));
|
|
81
85
|
};
|
|
82
86
|
const clear = () => {
|
|
87
|
+
if (disabled)
|
|
88
|
+
return;
|
|
83
89
|
text = "";
|
|
84
90
|
value = "";
|
|
85
91
|
triggerSearch();
|
|
@@ -97,9 +103,9 @@ triggerSearch();
|
|
|
97
103
|
|
|
98
104
|
<FormField {size}>
|
|
99
105
|
{#if $$slots.default}
|
|
100
|
-
<FormLabel {id} {required}><slot /></FormLabel>
|
|
106
|
+
<FormLabel {id} {required} {disabled}><slot /></FormLabel>
|
|
101
107
|
{/if}
|
|
102
|
-
<div class:
|
|
108
|
+
<div class="{open ? 'open' : 'closed'} {disabled ? 'disabled' : 'enabled'}">
|
|
103
109
|
<input
|
|
104
110
|
type="text"
|
|
105
111
|
{id}
|
|
@@ -112,11 +118,13 @@ triggerSearch();
|
|
|
112
118
|
data-value={value}
|
|
113
119
|
data-text={text}
|
|
114
120
|
/>
|
|
115
|
-
<button type="button" class="icon" on:click={clickArrow} on:keydown={clickArrow}>
|
|
121
|
+
<button type="button" class="icon" on:click={clickArrow} on:keydown={clickArrow} {disabled}>
|
|
116
122
|
<AngleUpIcon />
|
|
117
123
|
</button>
|
|
118
124
|
{#if text && isSeachable}
|
|
119
|
-
<button type="button" class="clear" on:click={clear} on:keydown={clear}
|
|
125
|
+
<button type="button" class="clear" on:click={clear} on:keydown={clear} {disabled}>
|
|
126
|
+
X
|
|
127
|
+
</button>
|
|
120
128
|
{/if}
|
|
121
129
|
<div class="dropdown">
|
|
122
130
|
<Menu
|
|
@@ -136,6 +144,11 @@ triggerSearch();
|
|
|
136
144
|
<style>div {
|
|
137
145
|
position: relative;
|
|
138
146
|
}
|
|
147
|
+
div.disabled {
|
|
148
|
+
opacity: 0.5;
|
|
149
|
+
cursor: not-allowed;
|
|
150
|
+
pointer-events: none;
|
|
151
|
+
}
|
|
139
152
|
div input {
|
|
140
153
|
width: 100%;
|
|
141
154
|
padding: 0.5rem 1rem;
|
|
@@ -13,7 +13,9 @@ const onClick = () => {
|
|
|
13
13
|
navigateTo(href);
|
|
14
14
|
};
|
|
15
15
|
const container = getContext("CardContainer");
|
|
16
|
-
container
|
|
16
|
+
if (container) {
|
|
17
|
+
container.register(id);
|
|
18
|
+
}
|
|
17
19
|
</script>
|
|
18
20
|
|
|
19
21
|
<li {role} {id} on:click={onClick} class="{size} {role}">
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script>import { navigateTo } from "../../index.js";
|
|
1
|
+
<script>import { navigateTo, uniqueId } from "../../index.js";
|
|
2
|
+
import { getContext } from "svelte";
|
|
2
3
|
export let value;
|
|
3
4
|
export let caption = "below";
|
|
4
5
|
export let href = void 0;
|
|
@@ -7,13 +8,18 @@ const onClick = () => {
|
|
|
7
8
|
return;
|
|
8
9
|
navigateTo(href);
|
|
9
10
|
};
|
|
11
|
+
const id = uniqueId();
|
|
12
|
+
const container = getContext("CardContainer");
|
|
13
|
+
if (container) {
|
|
14
|
+
container.register(id);
|
|
15
|
+
}
|
|
10
16
|
$:
|
|
11
17
|
formattedValue = typeof value === "number" ? value.toLocaleString() : value;
|
|
12
18
|
$:
|
|
13
19
|
isLink = !!href;
|
|
14
20
|
</script>
|
|
15
21
|
|
|
16
|
-
<button on:click={onClick} class:isLink>
|
|
22
|
+
<button on:click={onClick} class:isLink {id}>
|
|
17
23
|
<figure class={caption}>
|
|
18
24
|
<span class="value">{formattedValue}</span>
|
|
19
25
|
<figcaption><slot /></figcaption>
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import Header from "../header/header.svelte";
|
|
3
3
|
export let title = void 0;
|
|
4
4
|
export let level = 2;
|
|
5
|
+
export let size = "full";
|
|
5
6
|
setContext("section", { level, title });
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
|
-
<section class="level-{level}">
|
|
9
|
+
<section class="level-{level} {size}">
|
|
9
10
|
{#if title}
|
|
10
11
|
<Header />
|
|
11
12
|
{/if}
|
|
@@ -17,4 +18,19 @@ setContext("section", { level, title });
|
|
|
17
18
|
margin-top: 1rem;
|
|
18
19
|
margin-bottom: 1rem;
|
|
19
20
|
font-family: var(--base-font-family, sans-serif);
|
|
21
|
+
}
|
|
22
|
+
section.sm {
|
|
23
|
+
max-width: 25rem;
|
|
24
|
+
}
|
|
25
|
+
section.md {
|
|
26
|
+
max-width: 35rem;
|
|
27
|
+
}
|
|
28
|
+
section.lg {
|
|
29
|
+
max-width: 50rem;
|
|
30
|
+
}
|
|
31
|
+
section.xl {
|
|
32
|
+
max-width: 65rem;
|
|
33
|
+
}
|
|
34
|
+
section.full {
|
|
35
|
+
width: 100%;
|
|
20
36
|
}</style>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { SectionLevel } from '../../types/generic.js';
|
|
3
|
+
import type { FormFieldSizeOptions } from '../../index.js';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
6
|
title?: string | undefined;
|
|
6
7
|
level?: SectionLevel | undefined;
|
|
8
|
+
size?: FormFieldSizeOptions | undefined;
|
|
7
9
|
};
|
|
8
10
|
events: {
|
|
9
11
|
[evt: string]: CustomEvent<any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { default as FileArea } from './forms/file-area/file-area.svelte';
|
|
|
9
9
|
export { default as NumberBox } from './forms/number-box/number-box.svelte';
|
|
10
10
|
export { default as MoneyBox } from './forms/money-box/money-box.svelte';
|
|
11
11
|
export { default as RadioGroup } from './forms/radio-group/radio-group.svelte';
|
|
12
|
+
export { default as RadioBox } from './forms/radio-group/radio-box.svelte';
|
|
12
13
|
export { default as TextArea } from './forms/text-area/text-area.svelte';
|
|
13
14
|
export { default as TextBox } from './forms/text-box/text-box.svelte';
|
|
14
15
|
export { default as FormField } from './forms/form-field.svelte';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as FileArea } from './forms/file-area/file-area.svelte';
|
|
|
10
10
|
export { default as NumberBox } from './forms/number-box/number-box.svelte';
|
|
11
11
|
export { default as MoneyBox } from './forms/money-box/money-box.svelte';
|
|
12
12
|
export { default as RadioGroup } from './forms/radio-group/radio-group.svelte';
|
|
13
|
+
export { default as RadioBox } from './forms/radio-group/radio-box.svelte';
|
|
13
14
|
export { default as TextArea } from './forms/text-area/text-area.svelte';
|
|
14
15
|
export { default as TextBox } from './forms/text-box/text-box.svelte';
|
|
15
16
|
export { default as FormField } from './forms/form-field.svelte';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<slot />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<style>
|
|
6
|
+
div {
|
|
7
|
+
display: grid;
|
|
8
|
+
width: 100%;
|
|
9
|
+
grid-template-columns: repeat(12, 1fr);
|
|
10
|
+
grid-template-rows: auto;
|
|
11
|
+
grid-gap: 1rem;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-items: center;
|
|
15
|
+
align-content: center;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} GridProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} GridEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} GridSlots */
|
|
4
|
+
export default class Grid extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
default: {};
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type GridProps = typeof __propDef.props;
|
|
13
|
+
export type GridEvents = typeof __propDef.events;
|
|
14
|
+
export type GridSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponent } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: never;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
default: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|