y200subcontrols 0.0.33 → 0.0.37
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/BooleanPresenter.svelte +38 -0
- package/dist/components/BooleanPresenter.svelte.d.ts +18 -0
- package/dist/components/Breadcrumb.svelte +27 -0
- package/dist/components/Breadcrumb.svelte.d.ts +24 -0
- package/dist/components/Button.svelte +1 -0
- package/dist/components/Button.svelte.d.ts +2 -2
- package/dist/components/CardHeader.svelte +1 -1
- package/dist/components/ConfirmModalDialog.svelte +15 -8
- package/dist/components/ConfirmModalDialog.svelte.d.ts +3 -0
- package/dist/components/DataTable.svelte +243 -0
- package/dist/components/DataTable.svelte.d.ts +35 -0
- package/dist/components/DataTableCell.svelte +28 -0
- package/dist/components/DataTableCell.svelte.d.ts +22 -0
- package/dist/components/DataTableMenuButton.svelte +134 -0
- package/dist/components/DataTableMenuButton.svelte.d.ts +27 -0
- package/dist/components/DataTablePaginator.svelte +118 -0
- package/dist/components/DataTablePaginator.svelte.d.ts +23 -0
- package/dist/components/DataTableRow.svelte +5 -0
- package/dist/components/DataTableRow.svelte.d.ts +18 -0
- package/dist/components/DatePresenter.svelte +15 -0
- package/dist/components/DatePresenter.svelte.d.ts +19 -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/HyperLink.svelte +15 -11
- package/dist/components/HyperLink.svelte.d.ts +2 -1
- package/dist/components/HyperlinkButton.svelte +25 -0
- package/dist/components/HyperlinkButton.svelte.d.ts +27 -0
- package/dist/components/LabeledDatePicker.svelte +103 -0
- package/dist/components/LabeledDatePicker.svelte.d.ts +35 -0
- package/dist/components/LabeledFormInput.svelte +21 -9
- package/dist/components/LabeledPasswordInput.svelte +6 -4
- 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/LabeledTextArea.svelte +64 -0
- package/dist/components/LabeledTextArea.svelte.d.ts +30 -0
- package/dist/components/Pill.svelte +20 -0
- package/dist/components/Pill.svelte.d.ts +22 -0
- package/dist/components/SegmentedControl.svelte +83 -0
- package/dist/components/SegmentedControl.svelte.d.ts +26 -0
- package/dist/components/SideNav.svelte +12 -0
- package/dist/components/SideNav.svelte.d.ts +20 -0
- package/dist/components/SideNavItem.svelte +64 -0
- package/dist/components/SideNavItem.svelte.d.ts +24 -0
- 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/ToggleButton.svelte +10 -2
- package/dist/components/ToggleButton.svelte.d.ts +5 -0
- package/dist/components/types.d.ts +11 -0
- package/dist/date-utils.d.ts +1 -0
- package/dist/date-utils.js +18 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +20 -1
- package/package.json +3 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
allowDelete?: boolean;
|
|
5
|
+
showEdit?: boolean;
|
|
6
|
+
showDelete?: boolean;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
menuWidth?: number;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
edit: CustomEvent<any>;
|
|
12
|
+
delete: CustomEvent<any>;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
default: {};
|
|
18
|
+
};
|
|
19
|
+
exports?: {} | undefined;
|
|
20
|
+
bindings?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
export type DataTableMenuButtonProps = typeof __propDef.props;
|
|
23
|
+
export type DataTableMenuButtonEvents = typeof __propDef.events;
|
|
24
|
+
export type DataTableMenuButtonSlots = typeof __propDef.slots;
|
|
25
|
+
export default class DataTableMenuButton extends SvelteComponent<DataTableMenuButtonProps, DataTableMenuButtonEvents, DataTableMenuButtonSlots> {
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import LabeledFormInput from "./LabeledFormInput.svelte";
|
|
3
|
+
import LabeledSelect from "./LabeledSelect.svelte";
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
5
|
+
export let recordsPerPageArray = [10, 25, 50, 100];
|
|
6
|
+
export let recordsPerPage = 10;
|
|
7
|
+
export let currentPage;
|
|
8
|
+
export let totalRecords;
|
|
9
|
+
let pagesCount = 0;
|
|
10
|
+
let _currentPage = 0;
|
|
11
|
+
$: {
|
|
12
|
+
pagesCount = Math.ceil(totalRecords / recordsPerPage);
|
|
13
|
+
_currentPage = currentPage + 1;
|
|
14
|
+
}
|
|
15
|
+
function handlePageIndexChanged(factor) {
|
|
16
|
+
currentPage += factor;
|
|
17
|
+
handlePageChanged();
|
|
18
|
+
}
|
|
19
|
+
function handleCurrentPageChanged(event) {
|
|
20
|
+
currentPage = _currentPage - 1;
|
|
21
|
+
handlePageChanged();
|
|
22
|
+
}
|
|
23
|
+
function handleRecordsPerPageChanged(event) {
|
|
24
|
+
const target = event.target;
|
|
25
|
+
if (!target) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const value = Number(target.value);
|
|
29
|
+
recordsPerPage = value;
|
|
30
|
+
handlePageChanged();
|
|
31
|
+
}
|
|
32
|
+
function handlePageChanged() {
|
|
33
|
+
if (currentPage < 0) {
|
|
34
|
+
currentPage = 0;
|
|
35
|
+
}
|
|
36
|
+
if (currentPage > pagesCount - 1) {
|
|
37
|
+
currentPage = pagesCount - 1;
|
|
38
|
+
}
|
|
39
|
+
dispatch("pagechanged", {
|
|
40
|
+
currentPage,
|
|
41
|
+
recordsPerPage
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<div class="border border-slate-300 rounded flex p-2">
|
|
47
|
+
<div class="my-auto flex space-x-2">
|
|
48
|
+
<label for="recordsPerPageSelect" class="text-sm my-auto text-slate-600">
|
|
49
|
+
Records per page
|
|
50
|
+
</label>
|
|
51
|
+
<LabeledSelect
|
|
52
|
+
value={recordsPerPage}
|
|
53
|
+
id="recordsPerPageSelect"
|
|
54
|
+
on:change={handleRecordsPerPageChanged}
|
|
55
|
+
>
|
|
56
|
+
{#each recordsPerPageArray as recperPage (recperPage)}
|
|
57
|
+
<option value={recperPage}>{recperPage}</option>
|
|
58
|
+
{/each}
|
|
59
|
+
</LabeledSelect>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div class="ml-auto flex space-x-3">
|
|
63
|
+
<span class="inline-block my-auto text-sm text-slate-500"> Page </span>
|
|
64
|
+
<div class="w-14">
|
|
65
|
+
<LabeledFormInput
|
|
66
|
+
numeric={true}
|
|
67
|
+
bind:value={_currentPage}
|
|
68
|
+
on:change={handleCurrentPageChanged}
|
|
69
|
+
size="md"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
<span class="inline-block my-auto text-sm text-slate-500 mr-10">
|
|
73
|
+
of {pagesCount} ( {totalRecords} records )
|
|
74
|
+
</span>
|
|
75
|
+
|
|
76
|
+
<button
|
|
77
|
+
on:click={() => handlePageIndexChanged(-1)}
|
|
78
|
+
type="button"
|
|
79
|
+
class="px-3 py-2 border border-teal-600 rounded text-teal-600 hover:bg-teal-600/10 active:bg-teal-600 active:text-teal-50
|
|
80
|
+
outline-none focus:outline-none
|
|
81
|
+
transition-all ease-in-out duration-300"
|
|
82
|
+
>
|
|
83
|
+
<svg
|
|
84
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
85
|
+
width="16"
|
|
86
|
+
height="16"
|
|
87
|
+
fill="currentColor"
|
|
88
|
+
viewBox="0 0 16 16"
|
|
89
|
+
>
|
|
90
|
+
<path
|
|
91
|
+
fill-rule="evenodd"
|
|
92
|
+
d="M9.224 1.553a.5.5 0 0 1 .223.67L6.56 8l2.888 5.776a.5.5 0 1 1-.894.448l-3-6a.5.5 0 0 1 0-.448l3-6a.5.5 0 0 1 .67-.223"
|
|
93
|
+
/>
|
|
94
|
+
</svg>
|
|
95
|
+
</button>
|
|
96
|
+
|
|
97
|
+
<button
|
|
98
|
+
on:click={() => handlePageIndexChanged(1)}
|
|
99
|
+
type="button"
|
|
100
|
+
class="px-3 py-2 border border-teal-600 rounded text-teal-600 hover:bg-teal-600/10 active:bg-teal-600 active:text-teal-50
|
|
101
|
+
outline-none focus:outline-none
|
|
102
|
+
transition-all ease-in-out duration-300"
|
|
103
|
+
>
|
|
104
|
+
<svg
|
|
105
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
106
|
+
width="16"
|
|
107
|
+
height="16"
|
|
108
|
+
fill="currentColor"
|
|
109
|
+
viewBox="0 0 16 16"
|
|
110
|
+
>
|
|
111
|
+
<path
|
|
112
|
+
fill-rule="evenodd"
|
|
113
|
+
d="M6.776 1.553a.5.5 0 0 1 .671.223l3 6a.5.5 0 0 1 0 .448l-3 6a.5.5 0 1 1-.894-.448L9.44 8 6.553 2.224a.5.5 0 0 1 .223-.671"
|
|
114
|
+
/>
|
|
115
|
+
</svg>
|
|
116
|
+
</button>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
recordsPerPageArray?: number[];
|
|
5
|
+
recordsPerPage?: number;
|
|
6
|
+
currentPage: number;
|
|
7
|
+
totalRecords: number;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
pagechanged: CustomEvent<any>;
|
|
11
|
+
} & {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
exports?: {} | undefined;
|
|
16
|
+
bindings?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type DataTablePaginatorProps = typeof __propDef.props;
|
|
19
|
+
export type DataTablePaginatorEvents = typeof __propDef.events;
|
|
20
|
+
export type DataTablePaginatorSlots = typeof __propDef.slots;
|
|
21
|
+
export default class DataTablePaginator extends SvelteComponent<DataTablePaginatorProps, DataTablePaginatorEvents, DataTablePaginatorSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {
|
|
8
|
+
default: {};
|
|
9
|
+
};
|
|
10
|
+
exports?: {} | undefined;
|
|
11
|
+
bindings?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type DataTableRowProps = typeof __propDef.props;
|
|
14
|
+
export type DataTableRowEvents = typeof __propDef.events;
|
|
15
|
+
export type DataTableRowSlots = typeof __propDef.slots;
|
|
16
|
+
export default class DataTableRow extends SvelteComponent<DataTableRowProps, DataTableRowEvents, DataTableRowSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script>import { formatDateTime } from "../date-utils.js";
|
|
2
|
+
export let date;
|
|
3
|
+
export let showTimeStamp = true;
|
|
4
|
+
let dateFormatted = "";
|
|
5
|
+
$: {
|
|
6
|
+
if (typeof date === "string") {
|
|
7
|
+
date = new Date(date);
|
|
8
|
+
}
|
|
9
|
+
dateFormatted = formatDateTime(date, showTimeStamp);
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<span>
|
|
14
|
+
{dateFormatted}
|
|
15
|
+
</span>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
date: Date | string;
|
|
5
|
+
showTimeStamp?: boolean;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type DatePresenterProps = typeof __propDef.props;
|
|
15
|
+
export type DatePresenterEvents = typeof __propDef.events;
|
|
16
|
+
export type DatePresenterSlots = typeof __propDef.slots;
|
|
17
|
+
export default class DatePresenter extends SvelteComponent<DatePresenterProps, DatePresenterEvents, DatePresenterSlots> {
|
|
18
|
+
}
|
|
19
|
+
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 />
|
|
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 name="buttons" />
|
|
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
|
+
default: {};
|
|
16
|
+
buttons: {};
|
|
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 {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>export let href;
|
|
2
|
-
export let linkStyle = "
|
|
2
|
+
export let linkStyle = "teal";
|
|
3
3
|
export let disabled = false;
|
|
4
4
|
export let id = void 0;
|
|
5
5
|
export let isButton = false;
|
|
@@ -16,10 +16,13 @@ $: {
|
|
|
16
16
|
aria-disabled={disabled}
|
|
17
17
|
class="px-1 py-1 {customCss} text-slate-600 dark:text-slate-200
|
|
18
18
|
{id}
|
|
19
|
-
{linkStyle === '
|
|
20
|
-
{linkStyle === '
|
|
21
|
-
{linkStyle === '
|
|
22
|
-
{linkStyle === '
|
|
19
|
+
{linkStyle === 'blue' ? 'hover:text-blue-500 active:text-blue-600' : ''}
|
|
20
|
+
{linkStyle === 'red' ? 'hover:text-red-500 active:text-red-600' : ''}
|
|
21
|
+
{linkStyle === 'teal' ? 'hover:text-teal-500 active:text-teal-600' : ''}
|
|
22
|
+
{linkStyle === 'indigo' ? 'hover:text-indigo-500 active:text-indigo-600' : ''}
|
|
23
|
+
{linkStyle === 'purple' ? 'hover:text-purple-500 active:text-purple-600' : ''}
|
|
24
|
+
|
|
25
|
+
|
|
23
26
|
aria-disabled:text-slate-300 dark:aria-disabled:text-slate-500
|
|
24
27
|
space-x-1 transition-colors ease-in-out duration-150"
|
|
25
28
|
>
|
|
@@ -32,14 +35,15 @@ $: {
|
|
|
32
35
|
aria-disabled={disabled}
|
|
33
36
|
class="px-1 py-1 {customCss} text-center
|
|
34
37
|
px-2 py-1.5 rounded-lg focus:outline-none focus:ring active:ring outline-none
|
|
35
|
-
{linkStyle === '
|
|
36
|
-
{linkStyle === '
|
|
38
|
+
{linkStyle === 'blue' ? 'bg-blue-500 text-blue-50 ring-blue-500/20 hover:bg-blue-600' : ''}
|
|
39
|
+
{linkStyle === 'slate'
|
|
37
40
|
? 'bg-slate-400 text-slate-50 ring-slate-500/20 hover:bg-slate-600 '
|
|
38
41
|
: ''}
|
|
39
|
-
{linkStyle === '
|
|
40
|
-
{linkStyle === '
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
{linkStyle === 'red' ? 'bg-red-500 text-red-50 ring-red-500/20 hover:bg-red-600' : ''}
|
|
43
|
+
{linkStyle === 'teal' ? 'bg-teal-500 text-teal-50 ring-teal-800/20 hover:bg-teal-600 ' : ''}
|
|
44
|
+
{linkStyle === 'indigo' ? 'bg-indigo-500 text-indigo-50 ring-indigo-800/20 hover:bg-indigo-600 ' : ''}
|
|
45
|
+
{linkStyle === 'purple' ? 'bg-purple-500 text-purple-50 ring-purple-800/20 hover:bg-purple-600 ' : ''}
|
|
46
|
+
{linkStyle === 'dark' ? 'bg-slate-950 text-slate-50 ring-slate-800/20 hover:bg-slate-800 ' : ''}
|
|
43
47
|
aria-disabled:cursor-default aria-disabled:text-slate-300 aria-disabled:bg-slate-100
|
|
44
48
|
space-x-1 transition-colors ease-in-out duration-150"
|
|
45
49
|
>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ColorThemes } from './types.js';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
href: string;
|
|
5
|
-
linkStyle?:
|
|
6
|
+
linkStyle?: ColorThemes;
|
|
6
7
|
disabled?: boolean;
|
|
7
8
|
id?: string | undefined;
|
|
8
9
|
isButton?: boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>import { expoIn } from "svelte/easing";
|
|
2
|
+
export let linkStyle = "teal";
|
|
3
|
+
export let disabled = false;
|
|
4
|
+
export let id = void 0;
|
|
5
|
+
export let type = "button";
|
|
6
|
+
export let customCss = "";
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<button
|
|
10
|
+
{type}
|
|
11
|
+
on:click
|
|
12
|
+
{disabled}
|
|
13
|
+
class="px-1 py-1 {customCss} text-slate-600 dark:text-slate-200
|
|
14
|
+
{id}
|
|
15
|
+
{linkStyle === 'blue' ? 'hover:text-blue-500 active:text-blue-600' : ''}
|
|
16
|
+
{linkStyle === 'red' ? 'hover:text-red-500 active:text-red-600' : ''}
|
|
17
|
+
{linkStyle === 'teal' ? 'hover:text-teal-500 active:text-teal-600' : ''}
|
|
18
|
+
{linkStyle === 'indigo' ? 'hover:text-indigo-500 active:text-indigo-600' : ''}
|
|
19
|
+
{linkStyle === 'purple' ? 'hover:text-purple-500 active:text-purple-600' : ''}
|
|
20
|
+
hover:underline underline-offset-4
|
|
21
|
+
disabled:text-slate-300 dark:disabled:text-slate-500
|
|
22
|
+
space-x-1 transition-colors ease-in-out duration-150"
|
|
23
|
+
>
|
|
24
|
+
<slot />
|
|
25
|
+
</button>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ColorThemes } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
linkStyle?: ColorThemes;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
id?: string | undefined;
|
|
8
|
+
type?: "button" | "submit" | "reset";
|
|
9
|
+
customCss?: string;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
click: MouseEvent;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
default: {};
|
|
18
|
+
};
|
|
19
|
+
exports?: {} | undefined;
|
|
20
|
+
bindings?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
export type HyperlinkButtonProps = typeof __propDef.props;
|
|
23
|
+
export type HyperlinkButtonEvents = typeof __propDef.events;
|
|
24
|
+
export type HyperlinkButtonSlots = typeof __propDef.slots;
|
|
25
|
+
export default class HyperlinkButton extends SvelteComponent<HyperlinkButtonProps, HyperlinkButtonEvents, HyperlinkButtonSlots> {
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<script>import { onMount, createEventDispatcher } from "svelte";
|
|
2
|
+
import LabeledFormInput from "./LabeledFormInput.svelte";
|
|
3
|
+
export let labelText = void 0;
|
|
4
|
+
export let id = void 0;
|
|
5
|
+
export let readonly = false;
|
|
6
|
+
export let required = false;
|
|
7
|
+
export let value = void 0;
|
|
8
|
+
export let name = void 0;
|
|
9
|
+
export let placeholder = void 0;
|
|
10
|
+
export let validationText = void 0;
|
|
11
|
+
export let autocomplete = "off";
|
|
12
|
+
export let input = void 0;
|
|
13
|
+
export let customCss = "";
|
|
14
|
+
export let visible = true;
|
|
15
|
+
export let inputType = "datetime-local";
|
|
16
|
+
export let disabled = false;
|
|
17
|
+
let _value = "";
|
|
18
|
+
function padZero(num) {
|
|
19
|
+
return num > 9 ? `${num}` : `0${num}`;
|
|
20
|
+
}
|
|
21
|
+
function setValueInternal(value2) {
|
|
22
|
+
if (value2) {
|
|
23
|
+
if (typeof value2 === "string") {
|
|
24
|
+
value2 = new Date(value2);
|
|
25
|
+
}
|
|
26
|
+
const year = value2.getFullYear();
|
|
27
|
+
const month = value2.getMonth() + 1;
|
|
28
|
+
const day = value2.getDate();
|
|
29
|
+
const hour = padZero(value2.getHours());
|
|
30
|
+
const minute = padZero(value2.getMinutes());
|
|
31
|
+
_value = `${year}-${padZero(month)}-${padZero(day)}T${hour}:${minute}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const dispatch = createEventDispatcher();
|
|
35
|
+
export let isValid = true;
|
|
36
|
+
function validateElement(event) {
|
|
37
|
+
if (input.dataset.validated !== "true") {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
isValid = input.checkValidity();
|
|
41
|
+
dispatch("validated", isValid);
|
|
42
|
+
}
|
|
43
|
+
function handleChange(event) {
|
|
44
|
+
const target = event.target;
|
|
45
|
+
let _value2 = target.value;
|
|
46
|
+
if (_value2 === "" || _value2 === void 0) {
|
|
47
|
+
value = void 0;
|
|
48
|
+
dispatch("dateChanged", {
|
|
49
|
+
date: void 0
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const parts = _value2.split("T");
|
|
54
|
+
const datePart = parts[0].split("-");
|
|
55
|
+
const year = Number(datePart[0]);
|
|
56
|
+
const month = Number(datePart[1]);
|
|
57
|
+
const dayOfMonth = Number(datePart[2]);
|
|
58
|
+
const timeParts = parts[1].split(":");
|
|
59
|
+
const hours = Number(timeParts[0]);
|
|
60
|
+
const minutes = Number(timeParts[1]);
|
|
61
|
+
const _date = new Date(year, month - 1, dayOfMonth, hours, minutes);
|
|
62
|
+
value = _date;
|
|
63
|
+
dispatch("dateChanged", {
|
|
64
|
+
date: _date
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
onMount(() => {
|
|
68
|
+
if (id === void 0) {
|
|
69
|
+
let r = (Math.random() + 1).toString(36).substring(2);
|
|
70
|
+
id = `input${r}`;
|
|
71
|
+
}
|
|
72
|
+
setValueInternal(value);
|
|
73
|
+
});
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<LabeledFormInput
|
|
77
|
+
{labelText}
|
|
78
|
+
{id}
|
|
79
|
+
{validationText}
|
|
80
|
+
bind:isValid
|
|
81
|
+
{name}
|
|
82
|
+
{required}
|
|
83
|
+
{placeholder}
|
|
84
|
+
on:validated={validateElement}
|
|
85
|
+
{customCss}
|
|
86
|
+
{visible}
|
|
87
|
+
autoApplyCss={true}
|
|
88
|
+
>
|
|
89
|
+
<input
|
|
90
|
+
bind:this={input}
|
|
91
|
+
{disabled}
|
|
92
|
+
{id}
|
|
93
|
+
data-input="true"
|
|
94
|
+
type={inputType}
|
|
95
|
+
{required}
|
|
96
|
+
{autocomplete}
|
|
97
|
+
{placeholder}
|
|
98
|
+
{name}
|
|
99
|
+
on:change={handleChange}
|
|
100
|
+
{readonly}
|
|
101
|
+
value={_value}
|
|
102
|
+
/>
|
|
103
|
+
</LabeledFormInput>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
labelText?: string | undefined;
|
|
5
|
+
id?: string | undefined;
|
|
6
|
+
readonly?: boolean;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
value?: Date | undefined;
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
placeholder?: string | undefined;
|
|
11
|
+
validationText?: string | undefined;
|
|
12
|
+
autocomplete?: string | undefined;
|
|
13
|
+
input?: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | any | undefined;
|
|
14
|
+
customCss?: string;
|
|
15
|
+
visible?: boolean;
|
|
16
|
+
inputType?: "date" | "datetime-local";
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
isValid?: boolean;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
validated: CustomEvent<any>;
|
|
22
|
+
dateChanged: CustomEvent<any>;
|
|
23
|
+
} & {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
};
|
|
26
|
+
slots: {};
|
|
27
|
+
exports?: {} | undefined;
|
|
28
|
+
bindings?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
export type LabeledDatePickerProps = typeof __propDef.props;
|
|
31
|
+
export type LabeledDatePickerEvents = typeof __propDef.events;
|
|
32
|
+
export type LabeledDatePickerSlots = typeof __propDef.slots;
|
|
33
|
+
export default class LabeledDatePicker extends SvelteComponent<LabeledDatePickerProps, LabeledDatePickerEvents, LabeledDatePickerSlots> {
|
|
34
|
+
}
|
|
35
|
+
export {};
|