y200subcontrols 0.0.333 → 0.0.335
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/Breadcrumb.svelte +22 -0
- package/dist/components/Breadcrumb.svelte.d.ts +22 -0
- package/dist/components/ConfirmModalDialog.svelte +15 -8
- package/dist/components/ConfirmModalDialog.svelte.d.ts +3 -0
- package/dist/components/DataTableMenuButton.svelte +22 -3
- package/dist/components/HyperlinkButton.svelte +25 -0
- package/dist/components/HyperlinkButton.svelte.d.ts +26 -0
- package/dist/components/LabeledDatePicker.svelte +6 -10
- package/dist/components/SegmentedControl.svelte +50 -0
- package/dist/components/SegmentedControl.svelte.d.ts +25 -0
- package/dist/components/types.d.ts +4 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script>import HyperLink from "./HyperLink.svelte";
|
|
2
|
+
export let breadcrumbs = [];
|
|
3
|
+
export let currentPage;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class="px-2 py-1.5 border border-slate-300 dark:border-slate-600 rounded bg-white dark:bg-slate-950"
|
|
8
|
+
>
|
|
9
|
+
<HyperLink href="/">
|
|
10
|
+
<i class="bi bi-house-fill" title="Home"></i>
|
|
11
|
+
</HyperLink>
|
|
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}
|
|
16
|
+
</HyperLink>
|
|
17
|
+
<i class="bi bi-chevron-compact-right text-slate-300 dark:text-slate-600"></i>
|
|
18
|
+
{/each}
|
|
19
|
+
<span class="text-teal-600 dark:text-teal-400">
|
|
20
|
+
{currentPage}
|
|
21
|
+
</span>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
breadcrumbs?: {
|
|
5
|
+
title: string;
|
|
6
|
+
href: string;
|
|
7
|
+
}[];
|
|
8
|
+
currentPage: string;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
exports?: {} | undefined;
|
|
15
|
+
bindings?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export type BreadcrumbProps = typeof __propDef.props;
|
|
18
|
+
export type BreadcrumbEvents = typeof __propDef.events;
|
|
19
|
+
export type BreadcrumbSlots = typeof __propDef.slots;
|
|
20
|
+
export default class Breadcrumb extends SvelteComponent<BreadcrumbProps, BreadcrumbEvents, BreadcrumbSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { onMount } from "svelte";
|
|
2
|
+
import Button from "./Button.svelte";
|
|
2
3
|
import ModalDialog from "./ModalDialog.svelte";
|
|
3
4
|
export let message = "Message goes here";
|
|
4
5
|
export let style = "warning";
|
|
5
6
|
export let okButtonContent = "<span>Ok</span>";
|
|
6
|
-
export let cancelButtonContent = "<span>
|
|
7
|
+
export let cancelButtonContent = "<span>Cancel</span>";
|
|
7
8
|
let dialog;
|
|
9
|
+
let dialogId = "";
|
|
10
|
+
let buttonsContainer;
|
|
8
11
|
export async function showDialog() {
|
|
9
|
-
const okButton = document.getElementById(
|
|
10
|
-
const cancelButton = document.getElementById(
|
|
12
|
+
const okButton = document.getElementById(`okButtonDialog-${dialogId}`);
|
|
13
|
+
const cancelButton = document.getElementById(`cancelButtonDialog-${dialogId}`);
|
|
11
14
|
const p = new Promise((resolve) => {
|
|
12
15
|
function closeDialog(result) {
|
|
13
16
|
okButton?.removeEventListener("click", acceptDialog);
|
|
@@ -27,10 +30,14 @@ export async function showDialog() {
|
|
|
27
30
|
});
|
|
28
31
|
return p;
|
|
29
32
|
}
|
|
33
|
+
onMount(() => {
|
|
34
|
+
let r = (Math.random() + 1).toString(36).substring(2);
|
|
35
|
+
dialogId = `dialog-${r}`;
|
|
36
|
+
});
|
|
30
37
|
</script>
|
|
31
38
|
|
|
32
39
|
<ModalDialog bind:this={dialog} showCloseButton={false} allowSubmit={false}>
|
|
33
|
-
<slot slot="title" >Title goes here</slot>
|
|
40
|
+
<slot slot="title" name="title">Title goes here</slot>
|
|
34
41
|
<div
|
|
35
42
|
class="flex
|
|
36
43
|
{style === 'warning' ? 'text-amber-500' : ''}
|
|
@@ -98,11 +105,11 @@ export async function showDialog() {
|
|
|
98
105
|
{@html message}
|
|
99
106
|
</div>
|
|
100
107
|
</slot>
|
|
101
|
-
<div class="grid grid-cols-2 gap-2" slot="buttons">
|
|
102
|
-
<Button type="button" id="okButtonDialog">
|
|
108
|
+
<div class="grid grid-cols-2 gap-2" slot="buttons" bind:this={buttonsContainer}>
|
|
109
|
+
<Button type="button" id="okButtonDialog-{dialogId}">
|
|
103
110
|
{@html okButtonContent}
|
|
104
111
|
</Button>
|
|
105
|
-
<Button type="button" buttonStyle="dark" id="cancelButtonDialog">
|
|
112
|
+
<Button type="button" buttonStyle="dark" id="cancelButtonDialog-{dialogId}">
|
|
106
113
|
{@html cancelButtonContent}
|
|
107
114
|
</Button>
|
|
108
115
|
</div>
|
|
@@ -45,7 +45,22 @@ onMount(() => {
|
|
|
45
45
|
class="px-3 py-1 rounded bg-emerald-500 text-emerald-50"
|
|
46
46
|
on:click={openMenu}
|
|
47
47
|
>
|
|
48
|
-
<
|
|
48
|
+
<svg
|
|
49
|
+
class="w-6 h-6 text-white"
|
|
50
|
+
aria-hidden="true"
|
|
51
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
52
|
+
width="24"
|
|
53
|
+
height="24"
|
|
54
|
+
fill="none"
|
|
55
|
+
viewBox="0 0 24 24"
|
|
56
|
+
>
|
|
57
|
+
<path
|
|
58
|
+
stroke="currentColor"
|
|
59
|
+
stroke-linecap="round"
|
|
60
|
+
stroke-width="3"
|
|
61
|
+
d="M12 6h.01M12 12h.01M12 18h.01"
|
|
62
|
+
/>
|
|
63
|
+
</svg>
|
|
49
64
|
</button>
|
|
50
65
|
{#if true}
|
|
51
66
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
@@ -106,7 +121,11 @@ onMount(() => {
|
|
|
106
121
|
<ConfirmModalDialog
|
|
107
122
|
bind:this={deleteDialog}
|
|
108
123
|
style="danger"
|
|
109
|
-
|
|
124
|
+
okButtonContent="Yes, delete"
|
|
125
|
+
cancelButtonContent="Cancel"
|
|
110
126
|
>
|
|
111
|
-
<span> Confirm Delete </span>
|
|
127
|
+
<span slot="title"> Confirm Delete </span>
|
|
128
|
+
<div class="text-center my-2">
|
|
129
|
+
<span class="text-lg"> Are you sure you want to delete this record ?</span>
|
|
130
|
+
</div>
|
|
112
131
|
</ConfirmModalDialog>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>export let linkStyle = "teal";
|
|
2
|
+
export let disabled = false;
|
|
3
|
+
export let id = void 0;
|
|
4
|
+
export let customCss = "";
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<button
|
|
10
|
+
on:click
|
|
11
|
+
type="button"
|
|
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,26 @@
|
|
|
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
|
+
customCss?: string;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
click: MouseEvent;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
exports?: {} | undefined;
|
|
19
|
+
bindings?: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type HyperlinkButtonProps = typeof __propDef.props;
|
|
22
|
+
export type HyperlinkButtonEvents = typeof __propDef.events;
|
|
23
|
+
export type HyperlinkButtonSlots = typeof __propDef.slots;
|
|
24
|
+
export default class HyperlinkButton extends SvelteComponent<HyperlinkButtonProps, HyperlinkButtonEvents, HyperlinkButtonSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -28,34 +28,29 @@ function setValueInternal(value2) {
|
|
|
28
28
|
const day = value2.getDate();
|
|
29
29
|
const hour = padZero(value2.getHours());
|
|
30
30
|
const minute = padZero(value2.getMinutes());
|
|
31
|
-
|
|
32
|
-
_value = `${year}-${padZero(month)}-${padZero(day)}T${hour}:${minute}:${second}`;
|
|
31
|
+
_value = `${year}-${padZero(month)}-${padZero(day)}T${hour}:${minute}`;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
const dispatch = createEventDispatcher();
|
|
36
35
|
export let isValid = true;
|
|
37
|
-
let inputContainer;
|
|
38
36
|
function validateElement(event) {
|
|
39
37
|
if (input.dataset.validated !== "true") {
|
|
40
38
|
return;
|
|
41
39
|
}
|
|
42
|
-
if (!required) {
|
|
43
|
-
dispatch("validated", true);
|
|
44
|
-
}
|
|
45
40
|
isValid = input.checkValidity();
|
|
46
41
|
dispatch("validated", isValid);
|
|
47
42
|
}
|
|
48
43
|
function handleChange(event) {
|
|
49
44
|
const target = event.target;
|
|
50
|
-
|
|
51
|
-
if (
|
|
45
|
+
let _value2 = target.value;
|
|
46
|
+
if (_value2 === "" || _value2 === void 0) {
|
|
52
47
|
value = void 0;
|
|
53
48
|
dispatch("dateChanged", {
|
|
54
49
|
date: void 0
|
|
55
50
|
});
|
|
56
51
|
return;
|
|
57
52
|
}
|
|
58
|
-
const parts =
|
|
53
|
+
const parts = _value2.split("T");
|
|
59
54
|
const datePart = parts[0].split("-");
|
|
60
55
|
const year = Number(datePart[0]);
|
|
61
56
|
const month = Number(datePart[1]);
|
|
@@ -99,10 +94,11 @@ onMount(() => {
|
|
|
99
94
|
type={inputType}
|
|
100
95
|
{required}
|
|
101
96
|
{autocomplete}
|
|
102
|
-
value={_value}
|
|
103
97
|
{placeholder}
|
|
104
98
|
{name}
|
|
105
99
|
on:change={handleChange}
|
|
106
100
|
{readonly}
|
|
101
|
+
value={_value}
|
|
102
|
+
|
|
107
103
|
/>
|
|
108
104
|
</LabeledFormInput>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
const dispacth = createEventDispatcher();
|
|
3
|
+
export let value = void 0;
|
|
4
|
+
export let options = [];
|
|
5
|
+
export let labelText = void 0;
|
|
6
|
+
export let name = void 0;
|
|
7
|
+
export let disabled = false;
|
|
8
|
+
function handleValueChanged(newValue) {
|
|
9
|
+
value = newValue;
|
|
10
|
+
dispacth("change", {
|
|
11
|
+
value
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div>
|
|
17
|
+
{#if labelText}
|
|
18
|
+
<span class="mb-1 block text-slate-600 dark:text-neutral-200">
|
|
19
|
+
{labelText}
|
|
20
|
+
</span>
|
|
21
|
+
{/if}
|
|
22
|
+
<input type="hidden" {name} {value} />
|
|
23
|
+
<div class="grid" style="grid-template-columns: repeat({options.length}, minmax(0, 1fr));">
|
|
24
|
+
{#each options as option}
|
|
25
|
+
<!-- svelte-ignore a11y-role-supports-aria-props -->
|
|
26
|
+
<button
|
|
27
|
+
{disabled}
|
|
28
|
+
type="button"
|
|
29
|
+
data-selected={option.key === value ? 'true' : ''}
|
|
30
|
+
on:click={() => handleValueChanged(option.key)}
|
|
31
|
+
class="first:rounded-l-lg last-of-type:rounded-r-lg
|
|
32
|
+
border
|
|
33
|
+
border-blue-500
|
|
34
|
+
text-blue-500 dark:text-blue-100
|
|
35
|
+
enabled:hover:bg-blue-100 enabled:active:bg-blue-500 enabled:active:text-blue-50
|
|
36
|
+
enabled:active:ring ring-blue-500/40
|
|
37
|
+
data-[selected='true']:bg-blue-500 data-[selected='true']:text-blue-50
|
|
38
|
+
hover:data-[selected='true']:bg-blue-500 hover:data-[selected='true']:text-blue-50
|
|
39
|
+
px-2 py-1 transition-all ease-in-out duration-150
|
|
40
|
+
disabled:border-slate-300 disabled:text-slate-300
|
|
41
|
+
disabled:data-[selected='true']:bg-slate-300 disabled:data-[selected='true']:text-slate-50
|
|
42
|
+
dark:disabled:data-[selected='true']:text-slate-950
|
|
43
|
+
enabled:dark:hover:bg-blue-100/20 enabled:dark:hover:data-[selected='true']:bg-blue-500
|
|
44
|
+
"
|
|
45
|
+
>
|
|
46
|
+
{@html option.value}
|
|
47
|
+
</button>
|
|
48
|
+
{/each}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { KeyValue } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
value?: string | number | boolean | undefined;
|
|
6
|
+
options?: KeyValue<string | number | boolean, string>[];
|
|
7
|
+
labelText?: string | undefined;
|
|
8
|
+
name?: string | undefined;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
change: CustomEvent<any>;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
exports?: {} | undefined;
|
|
18
|
+
bindings?: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type SegmentedControlProps = typeof __propDef.props;
|
|
21
|
+
export type SegmentedControlEvents = typeof __propDef.events;
|
|
22
|
+
export type SegmentedControlSlots = typeof __propDef.slots;
|
|
23
|
+
export default class SegmentedControl extends SvelteComponent<SegmentedControlProps, SegmentedControlEvents, SegmentedControlSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -18,4 +18,7 @@ import DataTableRow from "./components/DataTableRow.svelte";
|
|
|
18
18
|
import DataTableMenuButton from "./components/DataTableMenuButton.svelte";
|
|
19
19
|
import LabeledDatePicker from "./components/LabeledDatePicker.svelte";
|
|
20
20
|
import LabeledTextArea from "./components/LabeledTextArea.svelte";
|
|
21
|
-
|
|
21
|
+
import Breadcrumb from "./components/Breadcrumb.svelte";
|
|
22
|
+
import SegmentedControl from "./components/SegmentedControl.svelte";
|
|
23
|
+
import HyperlinkButton from "./components/HyperlinkButton.svelte";
|
|
24
|
+
export { Button, LoadingIndicator, Card, CardHeader, Form, ToggleButton, LabeledFormInput, LabeledPasswordInput, Alert, HyperLink, LabeledSelect, ModalDialog, BooleanPresenter, DataTable, DataTableCell, DataTableRow, DataTableMenuButton, DatePresenter, LabeledDatePicker, LabeledTextArea, Breadcrumb, SegmentedControl, HyperlinkButton };
|
package/dist/index.js
CHANGED
|
@@ -19,4 +19,7 @@ import DataTableRow from "./components/DataTableRow.svelte";
|
|
|
19
19
|
import DataTableMenuButton from "./components/DataTableMenuButton.svelte";
|
|
20
20
|
import LabeledDatePicker from "./components/LabeledDatePicker.svelte";
|
|
21
21
|
import LabeledTextArea from "./components/LabeledTextArea.svelte";
|
|
22
|
-
|
|
22
|
+
import Breadcrumb from "./components/Breadcrumb.svelte";
|
|
23
|
+
import SegmentedControl from "./components/SegmentedControl.svelte";
|
|
24
|
+
import HyperlinkButton from "./components/HyperlinkButton.svelte";
|
|
25
|
+
export { Button, LoadingIndicator, Card, CardHeader, Form, ToggleButton, LabeledFormInput, LabeledPasswordInput, Alert, HyperLink, LabeledSelect, ModalDialog, BooleanPresenter, DataTable, DataTableCell, DataTableRow, DataTableMenuButton, DatePresenter, LabeledDatePicker, LabeledTextArea, Breadcrumb, SegmentedControl, HyperlinkButton };
|