y200subcontrols 0.0.339 → 0.0.340
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 +2 -0
- package/dist/components/Breadcrumb.svelte +17 -12
- package/dist/components/Breadcrumb.svelte.d.ts +3 -1
- package/dist/components/Button.svelte +11 -3
- package/dist/components/Button.svelte.d.ts +1 -0
- package/dist/components/CardHeader.svelte +1 -1
- package/dist/components/CodePresenter.svelte +135 -0
- package/dist/components/CodePresenter.svelte.d.ts +26 -0
- package/dist/components/DataTable.svelte +6 -6
- package/dist/components/DataTable.svelte.d.ts +1 -0
- package/dist/components/DataTableCell.svelte +15 -2
- package/dist/components/DataTableCell.svelte.d.ts +3 -0
- package/dist/components/DataTableMenuButton.svelte +3 -3
- package/dist/components/DataTablePaginator.svelte +4 -5
- package/dist/components/DatePresenter.svelte +5 -10
- package/dist/components/DatePresenter.svelte.d.ts +2 -0
- package/dist/components/Divider.svelte +8 -0
- package/dist/components/Divider.svelte.d.ts +18 -0
- package/dist/components/Drawer.svelte +87 -0
- package/dist/components/Drawer.svelte.d.ts +23 -0
- package/dist/components/DropDownButton.svelte +82 -0
- package/dist/components/DropDownButton.svelte.d.ts +27 -0
- package/dist/components/Form.svelte +13 -2
- package/dist/components/Form.svelte.d.ts +4 -0
- package/dist/components/HeadlessMenu.svelte +60 -0
- package/dist/components/HeadlessMenu.svelte.d.ts +25 -0
- package/dist/components/HyperLink.svelte +8 -2
- package/dist/components/HyperLink.svelte.d.ts +2 -0
- package/dist/components/HyperlinkButton.svelte +4 -4
- package/dist/components/HyperlinkButton.svelte.d.ts +1 -0
- package/dist/components/LabeledDatePicker.svelte +2 -0
- package/dist/components/LabeledDatePicker.svelte.d.ts +2 -0
- package/dist/components/LabeledFormInput.svelte +4 -1
- package/dist/components/LabeledPasswordInput.svelte +4 -2
- package/dist/components/LabeledPasswordInput.svelte.d.ts +1 -0
- package/dist/components/LabeledSelect.svelte +11 -3
- package/dist/components/LabeledSelect.svelte.d.ts +2 -0
- package/dist/components/ListBox.svelte +135 -0
- package/dist/components/ListBox.svelte.d.ts +24 -0
- package/dist/components/LoadingIndicator.svelte +14 -0
- package/dist/components/LoadingIndicator.svelte.d.ts +3 -2
- package/dist/components/ModalDialog.svelte +22 -5
- package/dist/components/Pill.svelte +42 -0
- package/dist/components/Pill.svelte.d.ts +23 -0
- package/dist/components/PillBoolean.svelte +60 -0
- package/dist/components/PillBoolean.svelte.d.ts +24 -0
- package/dist/components/SegmentedControl.svelte +10 -2
- package/dist/components/TabControl.svelte +79 -0
- package/dist/components/TabControl.svelte.d.ts +22 -0
- package/dist/components/TabItem.svelte +11 -0
- package/dist/components/TabItem.svelte.d.ts +21 -0
- package/dist/components/Table.svelte +18 -0
- package/dist/components/Table.svelte.d.ts +22 -0
- package/dist/components/ToggleButton.svelte +7 -4
- package/dist/components/ToggleButton.svelte.d.ts +3 -0
- package/dist/components/types.d.ts +2 -2
- package/dist/date-utils.d.ts +5 -0
- package/dist/date-utils.js +29 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +15 -1
- package/dist/number-utils.d.ts +1 -0
- package/dist/number-utils.js +10 -0
- package/package.json +3 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script>import { onMount } from "svelte";
|
|
2
|
+
import Button from "./Button.svelte";
|
|
3
|
+
export let buttonStyle = "teal";
|
|
4
|
+
export let buttonSize = "md";
|
|
5
|
+
export let id = void 0;
|
|
6
|
+
export let disabled = false;
|
|
7
|
+
let isMenuOpen = false;
|
|
8
|
+
let menuItemContainer;
|
|
9
|
+
export const dataPrefix = 'data-menu-item="true"';
|
|
10
|
+
const menuButtonStyle = `space-x-1 px-2 text-slate-600 hover:bg-slate-500/20
|
|
11
|
+
block w-full py-1 text-left active:text-slate-50 active:bg-slate-500
|
|
12
|
+
transition-all ease-in-out duration-300 focus:outline-none outline-none
|
|
13
|
+
disabled:text-slate-300 disabled:hover:bg-transparent
|
|
14
|
+
`;
|
|
15
|
+
function openMenu() {
|
|
16
|
+
isMenuOpen = true;
|
|
17
|
+
}
|
|
18
|
+
function closeMenu() {
|
|
19
|
+
isMenuOpen = false;
|
|
20
|
+
}
|
|
21
|
+
onMount(() => {
|
|
22
|
+
const buttons = menuItemContainer.querySelectorAll('[data-menu-item="true"]');
|
|
23
|
+
for (const button of buttons) {
|
|
24
|
+
button.addEventListener("click", () => closeMenu());
|
|
25
|
+
if (button.className === "") {
|
|
26
|
+
button.className = menuButtonStyle;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<div class="relative grid">
|
|
33
|
+
<Button type="button" {disabled} {buttonStyle} {id} {buttonSize} on:click={openMenu}>
|
|
34
|
+
<div class="w-full flex">
|
|
35
|
+
<div class="flex-grow">
|
|
36
|
+
<slot name="title" />
|
|
37
|
+
</div>
|
|
38
|
+
<div class="w-5 flex-shrink-0 ml-auto my-auto">
|
|
39
|
+
<svg
|
|
40
|
+
class="w-5 h-5 block rotate-0 {isMenuOpen ? 'rotate-180' :''} transition-all duration-300"
|
|
41
|
+
aria-hidden="true"
|
|
42
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
43
|
+
width="24"
|
|
44
|
+
height="24"
|
|
45
|
+
fill="none"
|
|
46
|
+
viewBox="0 0 24 24"
|
|
47
|
+
>
|
|
48
|
+
<path
|
|
49
|
+
stroke="currentColor"
|
|
50
|
+
stroke-linecap="round"
|
|
51
|
+
stroke-linejoin="round"
|
|
52
|
+
stroke-width="2"
|
|
53
|
+
d="m19 9-7 7-7-7"
|
|
54
|
+
/>
|
|
55
|
+
</svg>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</Button>
|
|
59
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
60
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
61
|
+
<div
|
|
62
|
+
class="fixed {isMenuOpen ? 'block' : 'hidden'} inset-0 bg-black/10 z-[1000]"
|
|
63
|
+
on:click={closeMenu}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<div
|
|
67
|
+
class="absolute right-0 left-0 top-[100%]
|
|
68
|
+
bg-white border border-slate-300 shadow-md rounded z-[1001]
|
|
69
|
+
transition-all ease-linear duration-300
|
|
70
|
+
grid
|
|
71
|
+
"
|
|
72
|
+
style="visibility: {isMenuOpen ? 'visible' : 'hidden'};grid-template-rows:{isMenuOpen
|
|
73
|
+
? '1fr'
|
|
74
|
+
: '0fr'}; top:calc(100% + 5px)"
|
|
75
|
+
>
|
|
76
|
+
<div class="overflow-hidden">
|
|
77
|
+
<ul class="py-2" bind:this={menuItemContainer}>
|
|
78
|
+
<slot />
|
|
79
|
+
</ul>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ColorThemes, Size } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
buttonStyle?: ColorThemes;
|
|
6
|
+
buttonSize?: Size;
|
|
7
|
+
id?: string | undefined;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
dataPrefix?: "data-menu-item=\"true\"";
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {
|
|
15
|
+
title: {};
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
exports?: {} | undefined;
|
|
19
|
+
bindings?: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type DropDownButtonProps = typeof __propDef.props;
|
|
22
|
+
export type DropDownButtonEvents = typeof __propDef.events;
|
|
23
|
+
export type DropDownButtonSlots = typeof __propDef.slots;
|
|
24
|
+
export default class DropDownButton extends SvelteComponent<DropDownButtonProps, DropDownButtonEvents, DropDownButtonSlots> {
|
|
25
|
+
get dataPrefix(): "data-menu-item=\"true\"";
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -10,6 +10,8 @@ export let isCard = true;
|
|
|
10
10
|
export let id = void 0;
|
|
11
11
|
export let buttonSize = "md";
|
|
12
12
|
export let method = "post";
|
|
13
|
+
export let showSubmit = true;
|
|
14
|
+
export let paddingVertical = "lg";
|
|
13
15
|
let dispatch = createEventDispatcher();
|
|
14
16
|
function handleSubmit(event) {
|
|
15
17
|
event.preventDefault();
|
|
@@ -26,6 +28,9 @@ function handleSubmit(event) {
|
|
|
26
28
|
const formData = new FormData(form);
|
|
27
29
|
dispatch("submit", formData);
|
|
28
30
|
}
|
|
31
|
+
export function submit() {
|
|
32
|
+
form.submit();
|
|
33
|
+
}
|
|
29
34
|
</script>
|
|
30
35
|
|
|
31
36
|
<Card stylingDisabled={!isCard} {extendedCss}>
|
|
@@ -42,11 +47,17 @@ function handleSubmit(event) {
|
|
|
42
47
|
on:submit={handleSubmit}
|
|
43
48
|
{method}
|
|
44
49
|
>
|
|
45
|
-
<div
|
|
50
|
+
<div
|
|
51
|
+
class="{paddingVertical === 'sm' ? 'py-1' : ''}
|
|
52
|
+
{paddingVertical === 'md' ? 'py-2' : ''}
|
|
53
|
+
{paddingVertical === 'lg' ? 'py-4' : ''}
|
|
54
|
+
|
|
55
|
+
"
|
|
56
|
+
>
|
|
46
57
|
<slot />
|
|
47
58
|
</div>
|
|
48
59
|
<slot name="buttons">
|
|
49
|
-
<div class="my-2 grid">
|
|
60
|
+
<div class="my-2 grid {showSubmit ? '' : 'hidden'}">
|
|
50
61
|
<Button type="submit" {isLoading} {buttonSize}>
|
|
51
62
|
<span>{@html defaultButtonContent}</span>
|
|
52
63
|
</Button>
|
|
@@ -10,6 +10,9 @@ declare const __propDef: {
|
|
|
10
10
|
id?: string | undefined;
|
|
11
11
|
buttonSize?: Size;
|
|
12
12
|
method?: "get" | "post" | "dialog";
|
|
13
|
+
showSubmit?: boolean;
|
|
14
|
+
paddingVertical?: Size;
|
|
15
|
+
submit?: () => void;
|
|
13
16
|
};
|
|
14
17
|
events: {
|
|
15
18
|
click: MouseEvent;
|
|
@@ -33,5 +36,6 @@ export type FormProps = typeof __propDef.props;
|
|
|
33
36
|
export type FormEvents = typeof __propDef.events;
|
|
34
37
|
export type FormSlots = typeof __propDef.slots;
|
|
35
38
|
export default class Form extends SvelteComponent<FormProps, FormEvents, FormSlots> {
|
|
39
|
+
get submit(): () => void;
|
|
36
40
|
}
|
|
37
41
|
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script>import { onMount } from "svelte";
|
|
2
|
+
export let menuButtonStyle = `space-x-1 px-2 text-slate-600 hover:bg-slate-500/20
|
|
3
|
+
block w-full py-1 text-left active:text-slate-50 active:bg-slate-500
|
|
4
|
+
transition-all ease-in-out duration-300 focus:outline-none outline-none
|
|
5
|
+
disabled:text-slate-300 disabled:hover:bg-transparent
|
|
6
|
+
`;
|
|
7
|
+
export let menuStyle = "";
|
|
8
|
+
export let menuWidth = 200;
|
|
9
|
+
export let maxMenuHeight = 350;
|
|
10
|
+
export let disabled = false;
|
|
11
|
+
let menuItemContainer;
|
|
12
|
+
let menuOpen = false;
|
|
13
|
+
function openMenu(event) {
|
|
14
|
+
const buttons = menuItemContainer.querySelectorAll('[data-menu-item="true"]');
|
|
15
|
+
for (const button of buttons) {
|
|
16
|
+
button.addEventListener("click", () => closeMenu());
|
|
17
|
+
if (button.className === "") {
|
|
18
|
+
button.className = menuButtonStyle;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
menuOpen = true;
|
|
22
|
+
}
|
|
23
|
+
function closeMenu() {
|
|
24
|
+
menuOpen = false;
|
|
25
|
+
}
|
|
26
|
+
onMount(() => {
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div class="relative">
|
|
31
|
+
<button type="button" class="group {menuStyle}" {disabled} on:click={openMenu}>
|
|
32
|
+
<slot name="menu" />
|
|
33
|
+
</button>
|
|
34
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
35
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
36
|
+
<div
|
|
37
|
+
class="fixed {menuOpen ? 'block' : 'hidden'} inset-0 bg-black/20 z-[1000]"
|
|
38
|
+
on:click={closeMenu}
|
|
39
|
+
/>
|
|
40
|
+
<div
|
|
41
|
+
class="absolute right-0
|
|
42
|
+
bg-white border border-slate-300 shadow-md rounded z-[1001]
|
|
43
|
+
transition-all ease-in-out duration-300
|
|
44
|
+
grid
|
|
45
|
+
"
|
|
46
|
+
style="visibility: {menuOpen ? 'visible' : 'hidden'};grid-template-rows:{menuOpen
|
|
47
|
+
? '1fr'
|
|
48
|
+
: '0fr'}; width:{menuWidth}px;"
|
|
49
|
+
>
|
|
50
|
+
<div class="overflow-hidden">
|
|
51
|
+
<ul
|
|
52
|
+
class="py-2 overflow-y-auto"
|
|
53
|
+
bind:this={menuItemContainer}
|
|
54
|
+
style="max-height: {maxMenuHeight}px; scrollbar-width: thin;"
|
|
55
|
+
>
|
|
56
|
+
<slot />
|
|
57
|
+
</ul>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
menuButtonStyle?: string;
|
|
5
|
+
menuStyle?: string;
|
|
6
|
+
menuWidth?: number;
|
|
7
|
+
maxMenuHeight?: number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {
|
|
14
|
+
menu: {};
|
|
15
|
+
default: {};
|
|
16
|
+
};
|
|
17
|
+
exports?: {} | undefined;
|
|
18
|
+
bindings?: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type HeadlessMenuProps = typeof __propDef.props;
|
|
21
|
+
export type HeadlessMenuEvents = typeof __propDef.events;
|
|
22
|
+
export type HeadlessMenuSlots = typeof __propDef.slots;
|
|
23
|
+
export default class HeadlessMenu extends SvelteComponent<HeadlessMenuProps, HeadlessMenuEvents, HeadlessMenuSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -4,6 +4,7 @@ export let disabled = false;
|
|
|
4
4
|
export let id = void 0;
|
|
5
5
|
export let isButton = false;
|
|
6
6
|
export let customCss = "";
|
|
7
|
+
export let traget = "_self";
|
|
7
8
|
let hrefInternal = href;
|
|
8
9
|
$: {
|
|
9
10
|
hrefInternal = disabled ? void 0 : href;
|
|
@@ -12,6 +13,7 @@ $: {
|
|
|
12
13
|
|
|
13
14
|
{#if !isButton}
|
|
14
15
|
<a
|
|
16
|
+
target={traget}
|
|
15
17
|
href={hrefInternal}
|
|
16
18
|
aria-disabled={disabled}
|
|
17
19
|
class="px-1 py-1 {customCss} text-slate-600 dark:text-slate-200
|
|
@@ -41,8 +43,12 @@ $: {
|
|
|
41
43
|
: ''}
|
|
42
44
|
{linkStyle === 'red' ? 'bg-red-500 text-red-50 ring-red-500/20 hover:bg-red-600' : ''}
|
|
43
45
|
{linkStyle === 'teal' ? 'bg-teal-500 text-teal-50 ring-teal-800/20 hover:bg-teal-600 ' : ''}
|
|
44
|
-
{linkStyle === 'indigo'
|
|
45
|
-
|
|
46
|
+
{linkStyle === 'indigo'
|
|
47
|
+
? 'bg-indigo-500 text-indigo-50 ring-indigo-800/20 hover:bg-indigo-600 '
|
|
48
|
+
: ''}
|
|
49
|
+
{linkStyle === 'purple'
|
|
50
|
+
? 'bg-purple-500 text-purple-50 ring-purple-800/20 hover:bg-purple-600 '
|
|
51
|
+
: ''}
|
|
46
52
|
{linkStyle === 'dark' ? 'bg-slate-950 text-slate-50 ring-slate-800/20 hover:bg-slate-800 ' : ''}
|
|
47
53
|
aria-disabled:cursor-default aria-disabled:text-slate-300 aria-disabled:bg-slate-100
|
|
48
54
|
space-x-1 transition-colors ease-in-out duration-150"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { HTMLAttributeAnchorTarget } from 'svelte/elements';
|
|
2
3
|
import type { ColorThemes } from './types.js';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
@@ -8,6 +9,7 @@ declare const __propDef: {
|
|
|
8
9
|
id?: string | undefined;
|
|
9
10
|
isButton?: boolean;
|
|
10
11
|
customCss?: string;
|
|
12
|
+
traget?: HTMLAttributeAnchorTarget;
|
|
11
13
|
};
|
|
12
14
|
events: {
|
|
13
15
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import { expoIn } from "svelte/easing";
|
|
2
|
+
export let linkStyle = "teal";
|
|
2
3
|
export let disabled = false;
|
|
3
4
|
export let id = void 0;
|
|
5
|
+
export let type = "button";
|
|
4
6
|
export let customCss = "";
|
|
5
7
|
</script>
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
9
|
<button
|
|
10
|
+
{type}
|
|
10
11
|
on:click
|
|
11
|
-
type="button"
|
|
12
12
|
{disabled}
|
|
13
13
|
class="px-1 py-1 {customCss} text-slate-600 dark:text-slate-200
|
|
14
14
|
{id}
|
|
@@ -14,6 +14,7 @@ export let customCss = "";
|
|
|
14
14
|
export let visible = true;
|
|
15
15
|
export let inputType = "datetime-local";
|
|
16
16
|
export let disabled = false;
|
|
17
|
+
export let size = "lg";
|
|
17
18
|
let _value = "";
|
|
18
19
|
function padZero(num) {
|
|
19
20
|
return num > 9 ? `${num}` : `0${num}`;
|
|
@@ -84,6 +85,7 @@ onMount(() => {
|
|
|
84
85
|
on:validated={validateElement}
|
|
85
86
|
{customCss}
|
|
86
87
|
{visible}
|
|
88
|
+
{size}
|
|
87
89
|
autoApplyCss={true}
|
|
88
90
|
>
|
|
89
91
|
<input
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { Size } from './types.js';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
labelText?: string | undefined;
|
|
@@ -15,6 +16,7 @@ declare const __propDef: {
|
|
|
15
16
|
visible?: boolean;
|
|
16
17
|
inputType?: "date" | "datetime-local";
|
|
17
18
|
disabled?: boolean;
|
|
19
|
+
size?: Size;
|
|
18
20
|
isValid?: boolean;
|
|
19
21
|
};
|
|
20
22
|
events: {
|
|
@@ -26,9 +26,11 @@ let inputCss = `
|
|
|
26
26
|
focus:outline-none focus:ring
|
|
27
27
|
read-only:bg-neutral-100
|
|
28
28
|
dark:read-only:bg-neutral-800
|
|
29
|
+
disabled:text-slate-500
|
|
29
30
|
placeholder:text-sm placeholder:font-thin
|
|
30
31
|
dark:bg-slate-900 dark:text-neutral-100 {numeric ? 'hide-browser-appearance' : ''}
|
|
31
32
|
${!isValid ? "border-pink-600 dark:border-pink-500 focus:ring-pink-600/20 dark:focus:ring-pink-600/40" : "dark:border-slate-600 border-slate-300 focus:ring-teal-500/20 dark:focus:ring-teal-500/30"}
|
|
33
|
+
disabled:text-slate-400
|
|
32
34
|
${customCss}`;
|
|
33
35
|
let inputContainer;
|
|
34
36
|
function validateElement(event) {
|
|
@@ -94,7 +96,7 @@ onMount(() => {
|
|
|
94
96
|
type="text"
|
|
95
97
|
{required}
|
|
96
98
|
{autocomplete}
|
|
97
|
-
class="border peer block w-full rounded shadow-sm bg-white text-neutral-900
|
|
99
|
+
class="border peer block w-full rounded shadow-sm bg-white text-neutral-900
|
|
98
100
|
{size === 'sm' ? 'py-1 px-2 text-sm' : ''}
|
|
99
101
|
{size === 'md' ? 'py-1.5 px-2 text-base' : ''}
|
|
100
102
|
{size === 'lg' ? 'py-2 px-2 text-lg' : ''}
|
|
@@ -106,6 +108,7 @@ onMount(() => {
|
|
|
106
108
|
{!isValid
|
|
107
109
|
? 'border-pink-600 dark:border-pink-500 focus:ring-pink-600/20 dark:focus:ring-pink-600/40'
|
|
108
110
|
: 'dark:border-slate-600 border-slate-300 focus:ring-teal-500/20 dark:focus:ring-teal-500/30'}
|
|
111
|
+
disabled:text-slate-400
|
|
109
112
|
{customCss}"
|
|
110
113
|
bind:value
|
|
111
114
|
{placeholder}
|
|
@@ -12,6 +12,7 @@ export let validationText = void 0;
|
|
|
12
12
|
export let customCss = "";
|
|
13
13
|
export let customValidation = void 0;
|
|
14
14
|
export let disabled = false;
|
|
15
|
+
export let visible = true;
|
|
15
16
|
let input;
|
|
16
17
|
let isValid = true;
|
|
17
18
|
let inputType = "password";
|
|
@@ -44,9 +45,10 @@ onMount(() => {
|
|
|
44
45
|
{name}
|
|
45
46
|
{required}
|
|
46
47
|
{placeholder}
|
|
48
|
+
{visible}
|
|
47
49
|
on:validated={handleValidated}
|
|
48
50
|
>
|
|
49
|
-
<div class="relative group">
|
|
51
|
+
<div class="relative group {visible ? '' : 'hidden'}">
|
|
50
52
|
<input
|
|
51
53
|
type="password"
|
|
52
54
|
bind:this={input}
|
|
@@ -62,7 +64,7 @@ onMount(() => {
|
|
|
62
64
|
{!isValid
|
|
63
65
|
? 'border-pink-600 dark:border-pink-500 focus:ring-pink-600/20 dark:focus:ring-pink-600/40'
|
|
64
66
|
: 'dark:border-slate-600 border-slate-300 focus:ring-teal-500/20 dark:focus:ring-teal-500/30'}
|
|
65
|
-
{customCss}"
|
|
67
|
+
{customCss} pr-8"
|
|
66
68
|
{placeholder}
|
|
67
69
|
{id}
|
|
68
70
|
{name}
|
|
@@ -7,6 +7,7 @@ export let name = void 0;
|
|
|
7
7
|
export let placeholder = void 0;
|
|
8
8
|
export let validationText = void 0;
|
|
9
9
|
export let theme = "teal";
|
|
10
|
+
export let size = "lg";
|
|
10
11
|
export let input = void 0;
|
|
11
12
|
export let visible = true;
|
|
12
13
|
export let disabled = false;
|
|
@@ -52,7 +53,7 @@ onMount(() => {
|
|
|
52
53
|
{#if labelText}
|
|
53
54
|
<label
|
|
54
55
|
for={id}
|
|
55
|
-
class="mb-1
|
|
56
|
+
class="inline-block mb-1 text-slate-600 dark:text-neutral-200 font-thin text-lg"
|
|
56
57
|
>
|
|
57
58
|
{labelText}
|
|
58
59
|
{#if required}
|
|
@@ -70,23 +71,30 @@ onMount(() => {
|
|
|
70
71
|
{placeholder}
|
|
71
72
|
{name}
|
|
72
73
|
on:change
|
|
73
|
-
class="border peer block w-full
|
|
74
|
+
class="border peer block w-full rounded-md shadow-sm bg-white text-neutral-900
|
|
75
|
+
|
|
74
76
|
focus:outline-none focus:ring
|
|
75
77
|
placeholder:text-sm placeholder:font-thin
|
|
76
78
|
dark:bg-slate-900 dark:text-neutral-100 appearance-none
|
|
77
|
-
|
|
79
|
+
{size === 'sm' ? 'py-1 px-2 text-sm' : ''}
|
|
80
|
+
{size === 'md' ? 'py-1.5 px-2 text-base' : ''}
|
|
81
|
+
{size === 'lg' ? 'py-2 px-2 text-lg' : ''}
|
|
82
|
+
pr-10
|
|
78
83
|
{!isValid
|
|
79
84
|
? 'border-pink-600 dark:border-pink-500 focus:ring-pink-600/20 dark:focus:ring-pink-600/40'
|
|
80
85
|
: 'dark:border-slate-600 border-slate-300'}
|
|
81
86
|
{isValid && theme === 'teal' ? ' focus:ring-teal-600/20 dark:focus:ring-teal-600/30' : ''}
|
|
87
|
+
disabled:bg-neutral-100 disabled:text-slate-500 dark:disabled:bg-neutral-800
|
|
82
88
|
"
|
|
83
89
|
>
|
|
90
|
+
|
|
84
91
|
<slot />
|
|
85
92
|
</select>
|
|
86
93
|
<span
|
|
87
94
|
class="absolute right-0 inset-y-0 w-8 flex text-slate-500 pointer-events-none
|
|
88
95
|
{theme === 'teal' ? 'peer-hover:text-teal-600 peer-focus:text-teal-600' : ''}
|
|
89
96
|
{theme === 'blue' ? 'peer-hover:text-blue-500 peer-focus:text-blue-500' : ''}
|
|
97
|
+
peer-disabled:text-slate-500
|
|
90
98
|
"
|
|
91
99
|
>
|
|
92
100
|
<svg
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { ColorThemes } from './types.js';
|
|
3
|
+
import type { Size } from './types.js';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
6
|
labelText?: string | undefined;
|
|
@@ -10,6 +11,7 @@ declare const __propDef: {
|
|
|
10
11
|
placeholder?: string | undefined;
|
|
11
12
|
validationText?: string | undefined;
|
|
12
13
|
theme?: ColorThemes;
|
|
14
|
+
size?: Size;
|
|
13
15
|
input?: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | any | undefined;
|
|
14
16
|
visible?: boolean;
|
|
15
17
|
disabled?: boolean;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<script>import { createEventDispatcher, onMount } from "svelte";
|
|
2
|
+
export let value = "";
|
|
3
|
+
export let name = void 0;
|
|
4
|
+
export let searchQuery = "";
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
6
|
+
let list;
|
|
7
|
+
let select;
|
|
8
|
+
let elements = [];
|
|
9
|
+
let elementsFilterd = [];
|
|
10
|
+
function selectELement(element) {
|
|
11
|
+
select.value = element.value;
|
|
12
|
+
dispatch("change", element);
|
|
13
|
+
}
|
|
14
|
+
function filterElements() {
|
|
15
|
+
if (!searchQuery) {
|
|
16
|
+
elementsFilterd = elements;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const _searchQuery = searchQuery.toLowerCase();
|
|
20
|
+
let _elements = [];
|
|
21
|
+
for (const element of elements) {
|
|
22
|
+
if (element.content.toLowerCase().includes(_searchQuery)) {
|
|
23
|
+
_elements.push(element);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
elementsFilterd = _elements;
|
|
27
|
+
}
|
|
28
|
+
function handleKeyDown(event) {
|
|
29
|
+
if (event.key === "Enter") {
|
|
30
|
+
filterElements();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
onMount(() => {
|
|
34
|
+
let options = select.querySelectorAll("option");
|
|
35
|
+
elements = [];
|
|
36
|
+
for (const option of options) {
|
|
37
|
+
elements.push({
|
|
38
|
+
value: option.value,
|
|
39
|
+
content: option.innerText
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
filterElements();
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<div class="w-full h-full py-2 flex flex-col">
|
|
47
|
+
<select
|
|
48
|
+
bind:this={select}
|
|
49
|
+
class="hidden"
|
|
50
|
+
bind:value
|
|
51
|
+
{name}
|
|
52
|
+
>
|
|
53
|
+
<slot />
|
|
54
|
+
</select>
|
|
55
|
+
<div class="flex px-1">
|
|
56
|
+
<input
|
|
57
|
+
type="text"
|
|
58
|
+
class="flex-grow border peer block w-full rounded-l shadow-sm bg-white text-neutral-900
|
|
59
|
+
py-1.5 px-2 text-base
|
|
60
|
+
outline-none
|
|
61
|
+
focus:outline-none focus:ring
|
|
62
|
+
read-only:bg-neutral-100
|
|
63
|
+
dark:read-only:bg-neutral-800
|
|
64
|
+
disabled:text-slate-500
|
|
65
|
+
placeholder:text-sm placeholder:font-thin
|
|
66
|
+
dark:bg-slate-900
|
|
67
|
+
dark:border-slate-600 border-slate-300 focus:ring-teal-500/20 dark:focus:ring-teal-500/30
|
|
68
|
+
"
|
|
69
|
+
placeholder="Search"
|
|
70
|
+
bind:value={searchQuery}
|
|
71
|
+
on:keydown={handleKeyDown}
|
|
72
|
+
/>
|
|
73
|
+
<button
|
|
74
|
+
type="button"
|
|
75
|
+
class="px-2 py-1.5 rounded-r bg-teal-500 text-teal-50"
|
|
76
|
+
on:click={filterElements}
|
|
77
|
+
>
|
|
78
|
+
<svg
|
|
79
|
+
class="w-5 h-5"
|
|
80
|
+
aria-hidden="true"
|
|
81
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
82
|
+
width="24"
|
|
83
|
+
height="24"
|
|
84
|
+
fill="none"
|
|
85
|
+
viewBox="0 0 24 24"
|
|
86
|
+
>
|
|
87
|
+
<path
|
|
88
|
+
stroke="currentColor"
|
|
89
|
+
stroke-linecap="round"
|
|
90
|
+
stroke-width="2"
|
|
91
|
+
d="m21 21-3.5-3.5M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"
|
|
92
|
+
/>
|
|
93
|
+
</svg>
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
<ul bind:this={list} class="overflow-y-scroll h-full mt-2 pt-1 border-t border-t-slate-300">
|
|
97
|
+
{#each elementsFilterd as element (element.value)}
|
|
98
|
+
<li>
|
|
99
|
+
<button
|
|
100
|
+
data-checked={select.value === element.value ? 'true' : 'false'}
|
|
101
|
+
type="button"
|
|
102
|
+
on:click={() => selectELement(element)}
|
|
103
|
+
class="w-full flex text-left px-2 py-1.5 space-x-1
|
|
104
|
+
hover:bg-teal-500/10 hover:text-teal-700
|
|
105
|
+
data-[checked='true']:bg-teal-500
|
|
106
|
+
data-[checked='true']:text-teal-50
|
|
107
|
+
|
|
108
|
+
"
|
|
109
|
+
>
|
|
110
|
+
<svg
|
|
111
|
+
class="w-4 h-4 my-auto {select.value === element.value ? '' : 'invisible'}"
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
114
|
+
width="24"
|
|
115
|
+
height="24"
|
|
116
|
+
fill="none"
|
|
117
|
+
viewBox="0 0 24 24"
|
|
118
|
+
>
|
|
119
|
+
<path
|
|
120
|
+
stroke="currentColor"
|
|
121
|
+
stroke-linecap="round"
|
|
122
|
+
stroke-linejoin="round"
|
|
123
|
+
stroke-width="2"
|
|
124
|
+
d="M5 11.917 9.724 16.5 19 7.5"
|
|
125
|
+
/>
|
|
126
|
+
</svg>
|
|
127
|
+
|
|
128
|
+
<span class="my-auto">
|
|
129
|
+
{element.content}
|
|
130
|
+
</span>
|
|
131
|
+
</button>
|
|
132
|
+
</li>
|
|
133
|
+
{/each}
|
|
134
|
+
</ul>
|
|
135
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
value?: string;
|
|
5
|
+
name?: string | undefined;
|
|
6
|
+
searchQuery?: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
change: CustomEvent<any>;
|
|
10
|
+
} & {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {
|
|
14
|
+
default: {};
|
|
15
|
+
};
|
|
16
|
+
exports?: {} | undefined;
|
|
17
|
+
bindings?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type ListBoxProps = typeof __propDef.props;
|
|
20
|
+
export type ListBoxEvents = typeof __propDef.events;
|
|
21
|
+
export type ListBoxSlots = typeof __propDef.slots;
|
|
22
|
+
export default class ListBox extends SvelteComponent<ListBoxProps, ListBoxEvents, ListBoxSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -8,8 +8,22 @@ export let textColor = "white";
|
|
|
8
8
|
{size === 'sm' ? 'h-5 w-5' : ''}
|
|
9
9
|
{size === 'md' ? 'h-8 w-8' : ''}
|
|
10
10
|
{size === 'lg' ? 'h-10 w-10' : ''}
|
|
11
|
+
{size === 'xl' ? 'h-16 w-16' : ''}
|
|
12
|
+
{textColor === 'red' ? 'text-red-500' : ''}
|
|
13
|
+
{textColor === 'dark' ? 'text-slate-950' : ''}
|
|
14
|
+
{textColor === 'indigo' ? 'text-indigo-500' : ''}
|
|
15
|
+
{textColor === 'teal' ? 'text-teal-500' : ''}
|
|
11
16
|
{textColor === 'blue' ? 'text-blue-500' : ''}
|
|
17
|
+
{textColor === 'purple' ? 'text-purple-500' : ''}
|
|
18
|
+
{textColor === 'slate' ? 'text-slate-500' : ''}
|
|
19
|
+
{textColor === 'orange' ? 'text-orange-500' : ''}
|
|
20
|
+
{textColor === 'amber' ? 'text-amber-500' : ''}
|
|
21
|
+
{textColor === 'cyan' ? 'text-cyan-500' : ''}
|
|
22
|
+
{textColor === 'sky' ? 'text-sky-500' : ''}
|
|
12
23
|
{textColor === 'white' ? 'text-white' : ''}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
13
27
|
"
|
|
14
28
|
xmlns="http://www.w3.org/2000/svg"
|
|
15
29
|
fill="none"
|