sveltacular 0.0.39 → 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/list-box/list-box.svelte +17 -4
- 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>
|
|
@@ -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;
|
|
@@ -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 {};
|