y200subcontrols 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert.svelte +56 -0
- package/dist/components/Alert.svelte.d.ts +22 -0
- package/dist/components/Form.svelte +3 -3
- package/dist/components/Form.svelte.d.ts +2 -0
- package/dist/components/LabeledPasswordInput.svelte +37 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script>import { createEventDispatcher, onMount } from "svelte";
|
|
2
|
+
export let alertType = "info";
|
|
3
|
+
export let dismissable = true;
|
|
4
|
+
export let alertText;
|
|
5
|
+
let alert;
|
|
6
|
+
const dispatch = createEventDispatcher();
|
|
7
|
+
function dismissAlert() {
|
|
8
|
+
alert.style.borderWidth = "0";
|
|
9
|
+
alert.style.gridTemplateRows = "0fr";
|
|
10
|
+
setTimeout(() => {
|
|
11
|
+
dispatch("dismissed");
|
|
12
|
+
}, 300);
|
|
13
|
+
}
|
|
14
|
+
onMount(() => {
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
alert.style.gridTemplateRows = "1fr";
|
|
17
|
+
}, 10);
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
bind:this={alert}
|
|
23
|
+
class="grid border rounded transition-all ease-linear duration-300
|
|
24
|
+
{alertType === 'error' ? 'bg-red-100 text-red-700 border-red-600' : ''}
|
|
25
|
+
{alertType === 'info' ? 'bg-blue-100 text-blue-600 border-blue-600' : ''}
|
|
26
|
+
{alertType === 'warning' ? 'bg-orange-100 text-orange-700 border-orange-700' : ''}
|
|
27
|
+
{alertType === 'success' ? 'bg-green-100 text-green-700 border-green-700' : ''}
|
|
28
|
+
"
|
|
29
|
+
style="grid-template-rows: 0fr"
|
|
30
|
+
>
|
|
31
|
+
<div class="overflow-hidden">
|
|
32
|
+
<div class="p-2 flex space-x-1">
|
|
33
|
+
<div class="my-auto text-2xl">
|
|
34
|
+
{#if alertType === 'error' || alertType === 'warning'}
|
|
35
|
+
<i class="bi bi-exclamation-triangle"></i>
|
|
36
|
+
{:else if alertType === 'info'}
|
|
37
|
+
<i class="bi bi-info-circle"></i>
|
|
38
|
+
{:else if alertType === 'success'}
|
|
39
|
+
<i class="bi bi-check2-circle"></i>
|
|
40
|
+
{/if}
|
|
41
|
+
</div>
|
|
42
|
+
<div class="my-auto text-center flex-grow">
|
|
43
|
+
{alertText}
|
|
44
|
+
</div>
|
|
45
|
+
{#if dismissable}
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
class=" text-slate-500 hover:text-slate-800 mb-auto"
|
|
49
|
+
on:click={dismissAlert}
|
|
50
|
+
>
|
|
51
|
+
<i class="bi bi-x-lg"></i>
|
|
52
|
+
</button>
|
|
53
|
+
{/if}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
alertType?: "error" | "warning" | "success" | "info";
|
|
5
|
+
dismissable?: boolean;
|
|
6
|
+
alertText: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
dismissed: CustomEvent<any>;
|
|
10
|
+
} & {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
exports?: {} | undefined;
|
|
15
|
+
bindings?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export type AlertProps = typeof __propDef.props;
|
|
18
|
+
export type AlertEvents = typeof __propDef.events;
|
|
19
|
+
export type AlertSlots = typeof __propDef.slots;
|
|
20
|
+
export default class Alert extends SvelteComponent<AlertProps, AlertEvents, AlertSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -8,7 +8,7 @@ export let defaultButtonContent = "Save changes";
|
|
|
8
8
|
export let extendedCss = "";
|
|
9
9
|
export let isCard = true;
|
|
10
10
|
export let id = void 0;
|
|
11
|
-
let
|
|
11
|
+
export let buttonSize = "md";
|
|
12
12
|
let dispatch = createEventDispatcher();
|
|
13
13
|
function handleSubmit(event) {
|
|
14
14
|
event.preventDefault();
|
|
@@ -27,7 +27,7 @@ function handleSubmit(event) {
|
|
|
27
27
|
}
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
<Card stylingDisabled={!isCard}
|
|
30
|
+
<Card stylingDisabled={!isCard} {extendedCss}>
|
|
31
31
|
<slot slot="title" name="title" />
|
|
32
32
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
33
33
|
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
|
@@ -37,7 +37,7 @@ function handleSubmit(event) {
|
|
|
37
37
|
</div>
|
|
38
38
|
<slot name="buttons">
|
|
39
39
|
<div class="my-2 grid">
|
|
40
|
-
<Button type="submit" {isLoading}>
|
|
40
|
+
<Button type="submit" {isLoading} {buttonSize}>
|
|
41
41
|
<span>{@html defaultButtonContent}</span>
|
|
42
42
|
</Button>
|
|
43
43
|
</div>
|
|
@@ -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
|
isLoading?: boolean;
|
|
@@ -7,6 +8,7 @@ declare const __propDef: {
|
|
|
7
8
|
extendedCss?: string;
|
|
8
9
|
isCard?: boolean;
|
|
9
10
|
id?: string | undefined;
|
|
11
|
+
buttonSize?: Size;
|
|
10
12
|
};
|
|
11
13
|
events: {
|
|
12
14
|
click: MouseEvent;
|
|
@@ -49,7 +49,7 @@ onMount(() => {
|
|
|
49
49
|
<input
|
|
50
50
|
type="password"
|
|
51
51
|
bind:this={input}
|
|
52
|
-
class="border peer block w-full rounded shadow-sm bg-white text-neutral-900
|
|
52
|
+
class="border peer block w-full rounded shadow-sm bg-white text-neutral-900
|
|
53
53
|
{size === 'sm' ? 'py-1 px-2 text-sm' : ''}
|
|
54
54
|
{size === 'md' ? 'py-1.5 px-2 text-base' : ''}
|
|
55
55
|
{size === 'lg' ? 'py-2 px-2 text-lg' : ''}
|
|
@@ -77,7 +77,42 @@ onMount(() => {
|
|
|
77
77
|
text-slate-500 hover:text-teal-600 active:text-teal-700 focus:outline-none"
|
|
78
78
|
on:click={toggleInputType}
|
|
79
79
|
>
|
|
80
|
-
|
|
80
|
+
{#if inputType === 'password'}
|
|
81
|
+
<svg
|
|
82
|
+
class="w-5 h-5 "
|
|
83
|
+
aria-hidden="true"
|
|
84
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
85
|
+
width="24"
|
|
86
|
+
height="24"
|
|
87
|
+
fill="none"
|
|
88
|
+
viewBox="0 0 24 24"
|
|
89
|
+
>
|
|
90
|
+
<path
|
|
91
|
+
stroke="currentColor"
|
|
92
|
+
stroke-width="2"
|
|
93
|
+
d="M21 12c0 1.2-4.03 6-9 6s-9-4.8-9-6c0-1.2 4.03-6 9-6s9 4.8 9 6Z"
|
|
94
|
+
/>
|
|
95
|
+
<path stroke="currentColor" stroke-width="2" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
|
96
|
+
</svg>
|
|
97
|
+
{:else}
|
|
98
|
+
<svg
|
|
99
|
+
class="w-5 h-5 "
|
|
100
|
+
aria-hidden="true"
|
|
101
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
102
|
+
width="24"
|
|
103
|
+
height="24"
|
|
104
|
+
fill="none"
|
|
105
|
+
viewBox="0 0 24 24"
|
|
106
|
+
>
|
|
107
|
+
<path
|
|
108
|
+
stroke="currentColor"
|
|
109
|
+
stroke-linecap="round"
|
|
110
|
+
stroke-linejoin="round"
|
|
111
|
+
stroke-width="2"
|
|
112
|
+
d="M3.933 13.909A4.357 4.357 0 0 1 3 12c0-1 4-6 9-6m7.6 3.8A5.068 5.068 0 0 1 21 12c0 1-3 6-9 6-.314 0-.62-.014-.918-.04M5 19 19 5m-4 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"
|
|
113
|
+
/>
|
|
114
|
+
</svg>
|
|
115
|
+
{/if}
|
|
81
116
|
</button>
|
|
82
117
|
</div>
|
|
83
118
|
</LabeledFormInput>
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ import Form from "./components/Form.svelte";
|
|
|
6
6
|
import ToggleButton from "./components/ToggleButton.svelte";
|
|
7
7
|
import LabeledFormInput from "./components/LabeledFormInput.svelte";
|
|
8
8
|
import LabeledPasswordInput from "./components/LabeledPasswordInput.svelte";
|
|
9
|
-
|
|
9
|
+
import Alert from "./components/Alert.svelte";
|
|
10
|
+
export { Button, LoadingIndicator, Card, CardHeader, Form, ToggleButton, LabeledFormInput, LabeledPasswordInput, Alert };
|
package/dist/index.js
CHANGED
|
@@ -7,4 +7,5 @@ import Form from "./components/Form.svelte";
|
|
|
7
7
|
import ToggleButton from "./components/ToggleButton.svelte";
|
|
8
8
|
import LabeledFormInput from "./components/LabeledFormInput.svelte";
|
|
9
9
|
import LabeledPasswordInput from "./components/LabeledPasswordInput.svelte";
|
|
10
|
-
|
|
10
|
+
import Alert from "./components/Alert.svelte";
|
|
11
|
+
export { Button, LoadingIndicator, Card, CardHeader, Form, ToggleButton, LabeledFormInput, LabeledPasswordInput, Alert };
|