y200subcontrols 0.0.34 → 0.0.38
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 +10 -3
- package/dist/components/Button.svelte.d.ts +1 -0
- package/dist/components/CardHeader.svelte +1 -1
- 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/DatePresenter.svelte +3 -10
- 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 +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/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 +10 -2
- package/dist/components/LabeledSelect.svelte.d.ts +2 -0
- package/dist/components/ListBox.svelte +134 -0
- package/dist/components/ListBox.svelte.d.ts +24 -0
- package/dist/components/ModalDialog.svelte +6 -3
- 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 +1 -0
- package/dist/date-utils.js +18 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +10 -1
- package/dist/number-utils.d.ts +1 -0
- package/dist/number-utils.js +10 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -4,19 +4,24 @@ export let currentPage;
|
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<div
|
|
7
|
-
class="px-2 py-1.5 border border-slate-300 dark:border-slate-600 rounded bg-white dark:bg-slate-950"
|
|
7
|
+
class="px-2 py-1.5 border border-slate-300 dark:border-slate-600 rounded bg-white dark:bg-slate-950 flex flex-row"
|
|
8
8
|
>
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
<i class="bi bi-chevron-compact-right text-slate-300 dark:text-slate-600"></i>
|
|
13
|
-
{#each breadcrumbs as crumb (crumb.href)}
|
|
14
|
-
<HyperLink href={crumb.href}>
|
|
15
|
-
{crumb.title}
|
|
9
|
+
<div class="my-auto">
|
|
10
|
+
<HyperLink href="/">
|
|
11
|
+
<i class="bi bi-house-fill" title="Home"></i>
|
|
16
12
|
</HyperLink>
|
|
17
13
|
<i class="bi bi-chevron-compact-right text-slate-300 dark:text-slate-600"></i>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
{#each breadcrumbs as crumb (crumb.href)}
|
|
15
|
+
<HyperLink href={crumb.href}>
|
|
16
|
+
{crumb.title}
|
|
17
|
+
</HyperLink>
|
|
18
|
+
<i class="bi bi-chevron-compact-right text-slate-300 dark:text-slate-600"></i>
|
|
19
|
+
{/each}
|
|
20
|
+
<span class="text-teal-600 dark:text-teal-400">
|
|
21
|
+
{currentPage}
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="ml-auto my-auto">
|
|
25
|
+
<slot />
|
|
26
|
+
</div>
|
|
22
27
|
</div>
|
|
@@ -6,24 +6,31 @@ export let id = void 0;
|
|
|
6
6
|
export let disabled = false;
|
|
7
7
|
export let customCss = "";
|
|
8
8
|
export let isLoading = false;
|
|
9
|
+
export let title = "";
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<button
|
|
13
|
+
{title}
|
|
12
14
|
disabled={disabled || isLoading}
|
|
13
15
|
data-loading={isLoading ? 'true' : 'false'}
|
|
14
16
|
{id}
|
|
15
17
|
{type}
|
|
16
18
|
class=" rounded hover:brightness-95 focus:outline-none focus:ring active:ring
|
|
17
19
|
space-x-1
|
|
18
|
-
{buttonSize === 'sm' ? 'px-
|
|
19
|
-
{buttonSize === 'md' ? 'px-2 py-1.5' : ''}
|
|
20
|
-
{buttonSize === 'lg' ? 'font-bold px-
|
|
20
|
+
{buttonSize === 'sm' ? 'px-2 py-1 text-sm' : ''}
|
|
21
|
+
{buttonSize === 'md' ? 'px-2.5 py-1.5' : ''}
|
|
22
|
+
{buttonSize === 'lg' ? 'font-bold px-3 py-3' : ''}
|
|
21
23
|
{buttonStyle === 'blue' ? 'bg-blue-500 text-blue-50 ring-blue-500/20 ' : ''}
|
|
22
24
|
{buttonStyle === 'red' ? 'bg-red-500 text-red-50 ring-red-500/20' : ''}
|
|
23
25
|
{buttonStyle === 'dark' ? 'bg-slate-950 text-slate-50 ring-slate-800/20 ' : ''}
|
|
24
26
|
{buttonStyle === 'indigo' ? 'bg-indigo-500 text-indigo-50 ring-indigo-500/20' : ''}
|
|
25
27
|
{buttonStyle === 'teal' ? 'bg-teal-600 text-teal-50 ring-teal-600/20' : ''}
|
|
26
28
|
{buttonStyle === 'purple' ? 'bg-purple-600 text-purple-50 ring-purple-600/20' : ''}
|
|
29
|
+
{buttonStyle === 'orange' ? 'bg-orange-600 text-orange-50 ring-orange-600/20' : ''}
|
|
30
|
+
{buttonStyle === 'amber' ? 'bg-amber-600 text-amber-50 ring-amber-600/20' : ''}
|
|
31
|
+
{buttonStyle === 'cyan' ? 'bg-cyan-600 text-cyan-50 ring-cyan-600/20' : ''}
|
|
32
|
+
{buttonStyle === 'sky' ? 'bg-sky-600 text-sky-50 ring-sky-600/20' : ''}
|
|
33
|
+
|
|
27
34
|
|
|
28
35
|
data-[loading='false']:disabled:bg-slate-100 data-[loading='false']:disabled:text-slate-300 disabled:ring-0
|
|
29
36
|
data-[loading='false']:disabled:brightness-100
|
|
@@ -6,8 +6,8 @@ export let isBusy = false;
|
|
|
6
6
|
export let popupMenuItems = void 0;
|
|
7
7
|
export let hasAdvancedSearch = false;
|
|
8
8
|
export let searchHint = "Search";
|
|
9
|
+
export let isAdvancedSearchOpen = false;
|
|
9
10
|
let isMenuOpen = false;
|
|
10
|
-
let isAdvancedSearchOpen = false;
|
|
11
11
|
const dispatch = createEventDispatcher();
|
|
12
12
|
function handleSearchRequested(event) {
|
|
13
13
|
const target = event.target;
|
|
@@ -45,14 +45,14 @@ function closeAdvancedSearch() {
|
|
|
45
45
|
</h1>
|
|
46
46
|
<div class="ml-auto my-auto flex">
|
|
47
47
|
{#if showSearch}
|
|
48
|
-
<div class="relative
|
|
48
|
+
<div class="relative">
|
|
49
49
|
<input
|
|
50
50
|
disabled={!allowSearch || isBusy}
|
|
51
51
|
type="text"
|
|
52
52
|
class="border border-slate-300 rounded-md pl-2 pr-8 py-1.5
|
|
53
53
|
focus:border-indigo-500 focus:ring ring-indigo-500/30 focus:outline-none
|
|
54
54
|
md:min-w-[250px] lg:min-w-[300px]
|
|
55
|
-
rounded-r-none disabled:bg-slate-200 disabled:text-slate-400
|
|
55
|
+
rounded-r-none disabled:bg-slate-200 disabled:text-slate-400 h-full
|
|
56
56
|
"
|
|
57
57
|
placeholder={searchHint}
|
|
58
58
|
on:keyup={handleSearchRequested}
|
|
@@ -149,7 +149,6 @@ function closeAdvancedSearch() {
|
|
|
149
149
|
>
|
|
150
150
|
<svg
|
|
151
151
|
xmlns="http://www.w3.org/2000/svg"
|
|
152
|
-
|
|
153
152
|
fill="currentColor"
|
|
154
153
|
class="w-3 h-3 pointer-events-none inline-block {isAdvancedSearchOpen
|
|
155
154
|
? 'rotate-0'
|
|
@@ -171,9 +170,10 @@ function closeAdvancedSearch() {
|
|
|
171
170
|
<button
|
|
172
171
|
type="button"
|
|
173
172
|
class="px-3 py-1.5 text-blue-500 border border-blue-500 rounded
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
hover:bg-blue-50 active:bg-blue-500 active:text-blue-50 outline-blue-600 h-full
|
|
174
|
+
disabled:text-slate-300 disabled:bg-slate-100 disabled:border-slate-400 disabled:outline-none"
|
|
176
175
|
on:click={() => (isMenuOpen = true)}
|
|
176
|
+
disabled={isBusy}
|
|
177
177
|
>
|
|
178
178
|
<i class="bi bi-three-dots"></i>
|
|
179
179
|
</button>
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
<script>export let isHeader = false;
|
|
2
2
|
export let width = void 0;
|
|
3
|
+
export let breakpoint = void 0;
|
|
4
|
+
export let extendedCss = "";
|
|
5
|
+
export let colspan = 0;
|
|
3
6
|
</script>
|
|
4
7
|
|
|
5
8
|
{#if isHeader}
|
|
6
9
|
<th
|
|
7
|
-
class="px-2 py-1.5 border-r border-r-slate-300 last-of-type:border-r-0 text-left
|
|
10
|
+
class="px-2 py-1.5 border-r border-r-slate-300 last-of-type:border-r-0 text-left table-cell
|
|
11
|
+
{breakpoint === 'sm' ? 'sm:hidden' : ''}
|
|
12
|
+
{breakpoint === 'md' ? 'md:hidden' : ''}
|
|
13
|
+
{breakpoint === 'lg' ? 'lg:hidden' : ''} {extendedCss}
|
|
14
|
+
"
|
|
8
15
|
style={width === undefined ? '' : `width:${width}px`}
|
|
16
|
+
{colspan}
|
|
9
17
|
>
|
|
10
18
|
<slot />
|
|
11
19
|
</th>
|
|
12
20
|
{:else}
|
|
13
21
|
<td
|
|
14
|
-
class="px-2 py-1.5 border-r border-r-slate-300 last-of-type:border-r-0
|
|
22
|
+
class="px-2 py-1.5 border-r border-r-slate-300 last-of-type:border-r-0 table-cell
|
|
23
|
+
{breakpoint === 'sm' ? 'sm:hidden' : ''}
|
|
24
|
+
{breakpoint === 'md' ? 'md:hidden' : ''}
|
|
25
|
+
{breakpoint === 'lg' ? 'lg:hidden' : ''} {extendedCss}
|
|
26
|
+
"
|
|
15
27
|
style={width === undefined ? '' : `width:${width}px`}
|
|
28
|
+
{colspan}
|
|
16
29
|
>
|
|
17
30
|
<slot />
|
|
18
31
|
</td>
|
|
@@ -14,7 +14,7 @@ const menuButtonStyle = `space-x-1 px-2 text-slate-600 hover:bg-slate-500/20
|
|
|
14
14
|
disabled:text-slate-300 disabled:hover:bg-transparent
|
|
15
15
|
`;
|
|
16
16
|
export let menuWidth = 200;
|
|
17
|
-
function openMenu() {
|
|
17
|
+
function openMenu(event) {
|
|
18
18
|
menuOpen = true;
|
|
19
19
|
}
|
|
20
20
|
function closeMenu() {
|
|
@@ -43,13 +43,13 @@ onMount(() => {
|
|
|
43
43
|
<div class="relative">
|
|
44
44
|
<button
|
|
45
45
|
type="button"
|
|
46
|
-
class="px-3 py-1 rounded bg-emerald-500 text-emerald-50
|
|
46
|
+
class="px-3 py-1 rounded bg-emerald-500 text-emerald-50
|
|
47
47
|
disabled:bg-slate-100 disabled:text-slate-300"
|
|
48
48
|
disabled={isDisabled}
|
|
49
49
|
on:click={openMenu}
|
|
50
50
|
>
|
|
51
51
|
<svg
|
|
52
|
-
class="w-6 h-6 text-white"
|
|
52
|
+
class="w-6 h-6 text-white pointer-events-none"
|
|
53
53
|
aria-hidden="true"
|
|
54
54
|
xmlns="http://www.w3.org/2000/svg"
|
|
55
55
|
width="24"
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import { formatDateTime } from "../date-utils.js";
|
|
2
|
+
export let date;
|
|
2
3
|
export let showTimeStamp = true;
|
|
3
4
|
let dateFormatted = "";
|
|
4
5
|
$: {
|
|
5
6
|
if (typeof date === "string") {
|
|
6
7
|
date = new Date(date);
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
const formatter = new Intl.DateTimeFormat(void 0, {
|
|
10
|
-
dateStyle: "short",
|
|
11
|
-
timeStyle: showTimeStamp ? "short" : void 0
|
|
12
|
-
});
|
|
13
|
-
dateFormatted = formatter.format(date);
|
|
14
|
-
} else {
|
|
15
|
-
dateFormatted = "N/A";
|
|
16
|
-
}
|
|
9
|
+
dateFormatted = formatDateTime(date, showTimeStamp);
|
|
17
10
|
}
|
|
18
11
|
</script>
|
|
19
12
|
|
|
@@ -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 {};
|
|
@@ -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}
|
|
@@ -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} pr-
|
|
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;
|
|
@@ -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;
|