sveltacular 0.0.41 → 0.0.42
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/combo/new-or-existing-combo.svelte +74 -0
- package/dist/forms/combo/new-or-existing-combo.svelte.d.ts +28 -0
- package/dist/forms/list-box/list-box.d.ts +2 -0
- package/dist/forms/list-box/list-box.js +1 -0
- package/dist/forms/list-box/list-box.svelte +14 -10
- package/dist/forms/list-box/list-box.svelte.d.ts +3 -1
- package/dist/forms/radio-group/radio-box.svelte +1 -0
- package/dist/forms/text-box/text-box.svelte +4 -1
- package/dist/generic/empty/empty.svelte +38 -0
- package/dist/generic/empty/empty.svelte.d.ts +18 -0
- package/dist/icons/folder-open-icon.svelte +12 -0
- package/dist/icons/folder-open-icon.svelte.d.ts +23 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/navigation/tabs/tab-group.svelte +4 -4
- package/dist/navigation/wizard/wizard.svelte +4 -0
- package/dist/tables/data-grid.svelte +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script>import {
|
|
2
|
+
FlexRow,
|
|
3
|
+
ListBox,
|
|
4
|
+
RadioBox,
|
|
5
|
+
TextBox
|
|
6
|
+
} from "../../index.js";
|
|
7
|
+
import FlexCol from "../../layout/flex-col.svelte";
|
|
8
|
+
export let mode = "existing";
|
|
9
|
+
export let newValue = "";
|
|
10
|
+
export let existingValue = "";
|
|
11
|
+
export let items = [];
|
|
12
|
+
export let size = "full";
|
|
13
|
+
export let disabled = false;
|
|
14
|
+
export let required = false;
|
|
15
|
+
export let searchable = false;
|
|
16
|
+
export let search = void 0;
|
|
17
|
+
export let searchPlaceholder = "Search";
|
|
18
|
+
export let newPlaceholder = "New";
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div class="group">
|
|
22
|
+
<FlexRow>
|
|
23
|
+
<div class="labels">
|
|
24
|
+
<FlexCol>
|
|
25
|
+
<div class="radio">
|
|
26
|
+
<RadioBox value="existing" bind:group={mode}>Existing:</RadioBox>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="radio">
|
|
29
|
+
<RadioBox value="new" bind:group={mode}>New:</RadioBox>
|
|
30
|
+
</div>
|
|
31
|
+
</FlexCol>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="inputs">
|
|
34
|
+
<FlexCol>
|
|
35
|
+
<div class="input">
|
|
36
|
+
<ListBox
|
|
37
|
+
bind:value={existingValue}
|
|
38
|
+
{searchable}
|
|
39
|
+
{search}
|
|
40
|
+
{required}
|
|
41
|
+
{items}
|
|
42
|
+
{size}
|
|
43
|
+
placeholder={searchPlaceholder}
|
|
44
|
+
disabled={disabled || mode == 'new'}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="input">
|
|
48
|
+
<TextBox
|
|
49
|
+
bind:value={newValue}
|
|
50
|
+
{size}
|
|
51
|
+
placeholder={newPlaceholder}
|
|
52
|
+
disabled={disabled || mode == 'existing'}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</FlexCol>
|
|
56
|
+
</div>
|
|
57
|
+
</FlexRow>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
.labels {
|
|
62
|
+
flex-shrink: 1;
|
|
63
|
+
}
|
|
64
|
+
.inputs {
|
|
65
|
+
flex-grow: 1;
|
|
66
|
+
}
|
|
67
|
+
.radio,
|
|
68
|
+
.input {
|
|
69
|
+
height: 2.5rem;
|
|
70
|
+
}
|
|
71
|
+
.radio {
|
|
72
|
+
padding-top: 0.1rem;
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type DropdownOption, type FormFieldSizeOptions } from '../../index.js';
|
|
3
|
+
import type { SearchFunction } from '../list-box/list-box.js';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
mode?: "new" | "existing" | undefined;
|
|
7
|
+
newValue?: string | undefined;
|
|
8
|
+
existingValue?: string | undefined;
|
|
9
|
+
items?: DropdownOption[] | undefined;
|
|
10
|
+
size?: FormFieldSizeOptions | undefined;
|
|
11
|
+
disabled?: boolean | undefined;
|
|
12
|
+
required?: boolean | undefined;
|
|
13
|
+
searchable?: boolean | undefined;
|
|
14
|
+
search?: SearchFunction | undefined;
|
|
15
|
+
searchPlaceholder?: string | undefined;
|
|
16
|
+
newPlaceholder?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export type NewOrExistingComboProps = typeof __propDef.props;
|
|
24
|
+
export type NewOrExistingComboEvents = typeof __propDef.events;
|
|
25
|
+
export type NewOrExistingComboSlots = typeof __propDef.slots;
|
|
26
|
+
export default class NewOrExistingCombo extends SvelteComponent<NewOrExistingComboProps, NewOrExistingComboEvents, NewOrExistingComboSlots> {
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,11 +13,12 @@ export let disabled = false;
|
|
|
13
13
|
export let required = false;
|
|
14
14
|
export let searchable = false;
|
|
15
15
|
export let search = void 0;
|
|
16
|
+
export let placeholder = "";
|
|
16
17
|
const id = uniqueId();
|
|
17
18
|
const dispatch = createEventDispatcher();
|
|
18
19
|
const getText = () => items.find((item) => item.value == value)?.name || "";
|
|
19
20
|
let text = getText();
|
|
20
|
-
let
|
|
21
|
+
let isMenuOpen = false;
|
|
21
22
|
let highlightIndex = -1;
|
|
22
23
|
let filteredItems = [];
|
|
23
24
|
$:
|
|
@@ -27,29 +28,29 @@ const onSelect = (e) => {
|
|
|
27
28
|
dispatch("change", value);
|
|
28
29
|
text = getText();
|
|
29
30
|
applyFilter();
|
|
30
|
-
|
|
31
|
+
isMenuOpen = false;
|
|
31
32
|
};
|
|
32
33
|
const focusOnInput = () => {
|
|
33
34
|
if (browser)
|
|
34
35
|
document.getElementById(id)?.focus();
|
|
35
36
|
};
|
|
36
|
-
const toggle = () =>
|
|
37
|
+
const toggle = () => isMenuOpen = !open;
|
|
37
38
|
const clickArrow = () => {
|
|
38
39
|
if (disabled)
|
|
39
40
|
return;
|
|
40
41
|
toggle();
|
|
41
|
-
if (
|
|
42
|
+
if (isMenuOpen)
|
|
42
43
|
focusOnInput();
|
|
43
44
|
};
|
|
44
45
|
const onInputKeyPress = (e) => {
|
|
45
46
|
if (disabled)
|
|
46
47
|
return;
|
|
47
48
|
if (e.key == "Escape") {
|
|
48
|
-
|
|
49
|
+
isMenuOpen = false;
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
52
|
if (e.key == "Enter" || e.key == "Tab") {
|
|
52
|
-
|
|
53
|
+
isMenuOpen = false;
|
|
53
54
|
if (highlightIndex > -1) {
|
|
54
55
|
onSelect(new CustomEvent("select", { detail: filteredItems[highlightIndex] }));
|
|
55
56
|
}
|
|
@@ -57,17 +58,17 @@ const onInputKeyPress = (e) => {
|
|
|
57
58
|
}
|
|
58
59
|
if (e.key == "ArrowDown") {
|
|
59
60
|
highlightIndex = Math.min(highlightIndex + 1, filteredItems.length - 1);
|
|
60
|
-
|
|
61
|
+
isMenuOpen = true;
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
64
|
if (e.key == "ArrowUp") {
|
|
64
65
|
highlightIndex = Math.max(highlightIndex - 1, -1);
|
|
65
66
|
if (highlightIndex == -1)
|
|
66
|
-
|
|
67
|
+
isMenuOpen = false;
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
70
|
if (e.key.length == 1 || e.key == "Backspace" || e.key == "Delete") {
|
|
70
|
-
|
|
71
|
+
isMenuOpen = true;
|
|
71
72
|
highlightIndex = 0;
|
|
72
73
|
triggerSearch();
|
|
73
74
|
}
|
|
@@ -99,6 +100,8 @@ const updateText = async () => {
|
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
102
|
triggerSearch();
|
|
103
|
+
$:
|
|
104
|
+
open = isMenuOpen && !disabled;
|
|
102
105
|
</script>
|
|
103
106
|
|
|
104
107
|
<FormField {size}>
|
|
@@ -112,8 +115,9 @@ triggerSearch();
|
|
|
112
115
|
bind:value={text}
|
|
113
116
|
{required}
|
|
114
117
|
{disabled}
|
|
118
|
+
{placeholder}
|
|
115
119
|
readonly={!isSeachable}
|
|
116
|
-
on:focus={() => (
|
|
120
|
+
on:focus={() => (isMenuOpen = true)}
|
|
117
121
|
on:keyup={onInputKeyPress}
|
|
118
122
|
data-value={value}
|
|
119
123
|
data-text={text}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { DropdownOption, FormFieldSizeOptions } from '../../types/form.js';
|
|
3
|
+
import type { SearchFunction } from './list-box.js';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
6
|
value?: string | undefined;
|
|
@@ -8,7 +9,8 @@ declare const __propDef: {
|
|
|
8
9
|
disabled?: boolean | undefined;
|
|
9
10
|
required?: boolean | undefined;
|
|
10
11
|
searchable?: boolean | undefined;
|
|
11
|
-
search?:
|
|
12
|
+
search?: SearchFunction | undefined;
|
|
13
|
+
placeholder?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
events: {
|
|
14
16
|
change: CustomEvent<string>;
|
|
@@ -46,7 +46,7 @@ const onInput = (e) => {
|
|
|
46
46
|
{#if $$slots.default}
|
|
47
47
|
<FormLabel {id} {required}><slot /></FormLabel>
|
|
48
48
|
{/if}
|
|
49
|
-
<div class="input">
|
|
49
|
+
<div class="input {disabled ? 'disabled' : 'enabled'}">
|
|
50
50
|
{#if prefix}
|
|
51
51
|
<div class="prefix">{prefix}</div>
|
|
52
52
|
{/if}
|
|
@@ -91,6 +91,9 @@ const onInput = (e) => {
|
|
|
91
91
|
user-select: none;
|
|
92
92
|
white-space: nowrap;
|
|
93
93
|
}
|
|
94
|
+
.input.disabled {
|
|
95
|
+
opacity: 0.5;
|
|
96
|
+
}
|
|
94
97
|
.input input {
|
|
95
98
|
background-color: transparent;
|
|
96
99
|
border: none;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script>export let text = "No data to display";
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<div class="empty">
|
|
5
|
+
{#if $$slots.default}
|
|
6
|
+
<div class="icon">
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
|
+
{/if}
|
|
10
|
+
<div class="text">
|
|
11
|
+
{text}
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<style>.empty {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
text-align: center;
|
|
21
|
+
color: var(--color-text-secondary, rgba(150, 150, 150, 0.5));
|
|
22
|
+
font-size: 1.5rem;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
line-height: 2rem;
|
|
25
|
+
margin: 2rem 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.icon {
|
|
29
|
+
height: 2rem;
|
|
30
|
+
width: 2rem;
|
|
31
|
+
margin-bottom: 1rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.text {
|
|
35
|
+
font-size: 1.5rem;
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
line-height: 2rem;
|
|
38
|
+
}</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
text?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {
|
|
10
|
+
default: {};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type EmptyProps = typeof __propDef.props;
|
|
14
|
+
export type EmptyEvents = typeof __propDef.events;
|
|
15
|
+
export type EmptySlots = typeof __propDef.slots;
|
|
16
|
+
export default class Empty extends SvelteComponent<EmptyProps, EmptyEvents, EmptySlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
class="w-6 h-6 text-gray-800 dark:text-white"
|
|
3
|
+
aria-hidden="true"
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
viewBox="0 0 20 18"
|
|
7
|
+
>
|
|
8
|
+
<path
|
|
9
|
+
d="M4.09 7.586A1 1 0 0 1 5 7h13V6a2 2 0 0 0-2-2h-4.557L9.043.8a2.009 2.009 0 0 0-1.6-.8H2a2 2 0 0 0-2 2v14c.001.154.02.308.058.457L4.09 7.586Z"
|
|
10
|
+
/>
|
|
11
|
+
<path d="M6.05 9 2 17.952c.14.031.281.047.424.048h12.95a.992.992 0 0 0 .909-.594L20 9H6.05Z" />
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} FolderOpenIconProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} FolderOpenIconEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} FolderOpenIconSlots */
|
|
4
|
+
export default class FolderOpenIcon extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type FolderOpenIconProps = typeof __propDef.props;
|
|
11
|
+
export type FolderOpenIconEvents = typeof __propDef.events;
|
|
12
|
+
export type FolderOpenIconSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponent } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { default as FormFooter } from './forms/form-footer.svelte';
|
|
|
20
20
|
export { default as FormSection } from './forms/form-section.svelte';
|
|
21
21
|
export { default as InfoBox } from './forms/info-box/info-box.svelte';
|
|
22
22
|
export { default as UrlBox } from './forms/url-box/url-box.svelte';
|
|
23
|
+
export { default as NewOrExistingCombo } from './forms/combo/new-or-existing-combo.svelte';
|
|
23
24
|
export { default as Card } from './generic/card/card.svelte';
|
|
24
25
|
export { default as CardContainer } from './generic/card/card-container.svelte';
|
|
25
26
|
export { default as Divider } from './generic/divider/divider.svelte';
|
|
@@ -36,6 +37,7 @@ export { default as Section } from './generic/section/section.svelte';
|
|
|
36
37
|
export { default as Header } from './generic/header/header.svelte';
|
|
37
38
|
export { default as Dot } from './generic/dot/dot.svelte';
|
|
38
39
|
export { default as Notice } from './generic/notice/notice.svelte';
|
|
40
|
+
export { default as Empty } from './generic/empty/empty.svelte';
|
|
39
41
|
export { default as FlexCol } from './layout/flex-col.svelte';
|
|
40
42
|
export { default as FlexRow } from './layout/flex-row.svelte';
|
|
41
43
|
export { default as FlexItem } from './layout/flex-item.svelte';
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { default as FormFooter } from './forms/form-footer.svelte';
|
|
|
21
21
|
export { default as FormSection } from './forms/form-section.svelte';
|
|
22
22
|
export { default as InfoBox } from './forms/info-box/info-box.svelte';
|
|
23
23
|
export { default as UrlBox } from './forms/url-box/url-box.svelte';
|
|
24
|
+
export { default as NewOrExistingCombo } from './forms/combo/new-or-existing-combo.svelte';
|
|
24
25
|
// Generic
|
|
25
26
|
export { default as Card } from './generic/card/card.svelte';
|
|
26
27
|
export { default as CardContainer } from './generic/card/card-container.svelte';
|
|
@@ -38,6 +39,7 @@ export { default as Section } from './generic/section/section.svelte';
|
|
|
38
39
|
export { default as Header } from './generic/header/header.svelte';
|
|
39
40
|
export { default as Dot } from './generic/dot/dot.svelte';
|
|
40
41
|
export { default as Notice } from './generic/notice/notice.svelte';
|
|
42
|
+
export { default as Empty } from './generic/empty/empty.svelte';
|
|
41
43
|
// Layout
|
|
42
44
|
export { default as FlexCol } from './layout/flex-col.svelte';
|
|
43
45
|
export { default as FlexRow } from './layout/flex-row.svelte';
|
|
@@ -88,11 +88,11 @@ setContext(tabContext, ctx);
|
|
|
88
88
|
}
|
|
89
89
|
.traditional .inactive button {
|
|
90
90
|
background: var(--tab-traditional-inactive-bg, transparent);
|
|
91
|
-
color: var(--tab-traditional-inactive-fg, rgb(
|
|
91
|
+
color: var(--tab-traditional-inactive-fg, rgb(150, 150, 150));
|
|
92
92
|
}
|
|
93
93
|
.traditional .inactive button:hover {
|
|
94
94
|
background: var(--tab-traditional-hover-bg, transparent);
|
|
95
|
-
color: var(--tab-traditional-hover-fg, rgb(
|
|
95
|
+
color: var(--tab-traditional-hover-fg, rgb(220, 220, 220));
|
|
96
96
|
}
|
|
97
97
|
.traditional .active button {
|
|
98
98
|
background: var(--tab-traditional-active-bg, rgb(220, 220, 230));
|
|
@@ -110,11 +110,11 @@ setContext(tabContext, ctx);
|
|
|
110
110
|
}
|
|
111
111
|
.underline .inactive button {
|
|
112
112
|
background: var(--tab-underline-inactive-bg, transparent);
|
|
113
|
-
color: var(--tab-underline-inactive-fg, rgb(
|
|
113
|
+
color: var(--tab-underline-inactive-fg, rgb(150, 150, 150));
|
|
114
114
|
}
|
|
115
115
|
.underline .inactive button:hover {
|
|
116
116
|
background: var(--tab-underline-hover-bg, transparent);
|
|
117
|
-
color: var(--tab-underline-hover-fg, rgb(
|
|
117
|
+
color: var(--tab-underline-hover-fg, rgb(220, 220, 220));
|
|
118
118
|
}
|
|
119
119
|
.underline .active button {
|
|
120
120
|
color: var(--tab-underline-active-fg, rgb(255, 134, 78));
|
|
@@ -8,6 +8,8 @@ import TableHeaderRow from "./table-header-row.svelte";
|
|
|
8
8
|
import TableHeader from "./table-header.svelte";
|
|
9
9
|
import TableRow from "./table-row.svelte";
|
|
10
10
|
import Table from "./table.svelte";
|
|
11
|
+
import Empty from "../generic/empty/empty.svelte";
|
|
12
|
+
import FolderOpenIcon from "../icons/folder-open-icon.svelte";
|
|
11
13
|
import Loading from "../placeholders/loading.svelte";
|
|
12
14
|
import Text from "../typography/text.svelte";
|
|
13
15
|
import TableCaption from "./table-caption.svelte";
|
|
@@ -72,7 +74,9 @@ $:
|
|
|
72
74
|
{#if rows === undefined}
|
|
73
75
|
<Loading />
|
|
74
76
|
{:else}
|
|
75
|
-
<
|
|
77
|
+
<Empty>
|
|
78
|
+
<FolderOpenIcon />
|
|
79
|
+
</Empty>
|
|
76
80
|
{/if}
|
|
77
81
|
</div>
|
|
78
82
|
</TableCell>
|