y200subcontrols 0.0.338 → 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 +10 -10
- 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 +35 -11
- package/dist/components/DataTablePaginator.svelte.d.ts +2 -1
- 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 +32 -10
- package/dist/components/LabeledSelect.svelte.d.ts +4 -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,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ColorThemes } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
theme?: ColorThemes;
|
|
6
|
+
direction?: "ltr" | "rtl";
|
|
7
|
+
sliderWidth?: number;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
default: {};
|
|
14
|
+
};
|
|
15
|
+
exports?: {} | undefined;
|
|
16
|
+
bindings?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type DrawerProps = typeof __propDef.props;
|
|
19
|
+
export type DrawerEvents = typeof __propDef.events;
|
|
20
|
+
export type DrawerSlots = typeof __propDef.slots;
|
|
21
|
+
export default class Drawer extends SvelteComponent<DrawerProps, DrawerEvents, DrawerSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -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}
|
|
@@ -6,6 +6,8 @@ export let value = void 0;
|
|
|
6
6
|
export let name = void 0;
|
|
7
7
|
export let placeholder = void 0;
|
|
8
8
|
export let validationText = void 0;
|
|
9
|
+
export let theme = "teal";
|
|
10
|
+
export let size = "lg";
|
|
9
11
|
export let input = void 0;
|
|
10
12
|
export let visible = true;
|
|
11
13
|
export let disabled = false;
|
|
@@ -51,8 +53,7 @@ onMount(() => {
|
|
|
51
53
|
{#if labelText}
|
|
52
54
|
<label
|
|
53
55
|
for={id}
|
|
54
|
-
class="mb-1
|
|
55
|
-
bind:this={inputContainer}
|
|
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}
|
|
@@ -60,7 +61,7 @@ onMount(() => {
|
|
|
60
61
|
{/if}
|
|
61
62
|
</label>
|
|
62
63
|
{/if}
|
|
63
|
-
<div class="relative">
|
|
64
|
+
<div class="relative" bind:this={inputContainer}>
|
|
64
65
|
<select
|
|
65
66
|
bind:this={select}
|
|
66
67
|
{disabled}
|
|
@@ -70,26 +71,47 @@ 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
|
|
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
|
|
77
83
|
{!isValid
|
|
78
84
|
? 'border-pink-600 dark:border-pink-500 focus:ring-pink-600/20 dark:focus:ring-pink-600/40'
|
|
79
|
-
: 'dark:border-slate-600 border-slate-300
|
|
85
|
+
: 'dark:border-slate-600 border-slate-300'}
|
|
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
|
|
80
88
|
"
|
|
81
89
|
>
|
|
90
|
+
|
|
82
91
|
<slot />
|
|
83
92
|
</select>
|
|
84
93
|
<span
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
class="absolute right-0 inset-y-0 w-8 flex text-slate-500 pointer-events-none
|
|
95
|
+
{theme === 'teal' ? 'peer-hover:text-teal-600 peer-focus:text-teal-600' : ''}
|
|
96
|
+
{theme === 'blue' ? 'peer-hover:text-blue-500 peer-focus:text-blue-500' : ''}
|
|
97
|
+
peer-disabled:text-slate-500
|
|
98
|
+
"
|
|
88
99
|
>
|
|
89
|
-
<
|
|
100
|
+
<svg
|
|
101
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
102
|
+
width="16"
|
|
103
|
+
height="16"
|
|
104
|
+
fill="currentColor"
|
|
105
|
+
class="w-4 h-4 block m-auto"
|
|
106
|
+
viewBox="0 0 16 16"
|
|
107
|
+
>
|
|
108
|
+
<path
|
|
109
|
+
fill-rule="evenodd"
|
|
110
|
+
d="M1.553 6.776a.5.5 0 0 1 .67-.223L8 9.44l5.776-2.888a.5.5 0 1 1 .448.894l-6 3a.5.5 0 0 1-.448 0l-6-3a.5.5 0 0 1-.223-.67"
|
|
111
|
+
/>
|
|
112
|
+
</svg>
|
|
90
113
|
</span>
|
|
91
114
|
</div>
|
|
92
|
-
|
|
93
115
|
|
|
94
116
|
{#if validationText && !isValid}
|
|
95
117
|
<div class="text-sm text-pink-600 dark:text-pink-500 my-2">
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ColorThemes } from './types.js';
|
|
3
|
+
import type { Size } from './types.js';
|
|
2
4
|
declare const __propDef: {
|
|
3
5
|
props: {
|
|
4
6
|
labelText?: string | undefined;
|
|
@@ -8,6 +10,8 @@ declare const __propDef: {
|
|
|
8
10
|
name?: string | undefined;
|
|
9
11
|
placeholder?: string | undefined;
|
|
10
12
|
validationText?: string | undefined;
|
|
13
|
+
theme?: ColorThemes;
|
|
14
|
+
size?: Size;
|
|
11
15
|
input?: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | any | undefined;
|
|
12
16
|
visible?: boolean;
|
|
13
17
|
disabled?: boolean;
|