y200subcontrols 0.0.3549 → 0.0.3731
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/Button.svelte +2 -0
- package/dist/components/Button.svelte.d.ts +1 -0
- package/dist/components/CardHeader.svelte +1 -1
- package/dist/components/DataTableCell.svelte +3 -2
- package/dist/components/DataTableCell.svelte.d.ts +1 -0
- package/dist/components/DatePresenter.svelte +1 -1
- 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/HyperlinkButton.svelte +4 -4
- package/dist/components/HyperlinkButton.svelte.d.ts +1 -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/TabControl.svelte +28 -49
- package/dist/components/TabItem.svelte +2 -2
- package/dist/components/ToggleButton.svelte +7 -4
- package/dist/components/ToggleButton.svelte.d.ts +1 -0
- package/dist/date-utils.d.ts +1 -1
- package/dist/date-utils.js +10 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,9 +6,11 @@ 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}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>export let isHeader = false;
|
|
2
2
|
export let width = void 0;
|
|
3
3
|
export let breakpoint = void 0;
|
|
4
|
+
export let extendedCss = "";
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
7
|
{#if isHeader}
|
|
@@ -8,7 +9,7 @@ export let breakpoint = void 0;
|
|
|
8
9
|
class="px-2 py-1.5 border-r border-r-slate-300 last-of-type:border-r-0 text-left table-cell
|
|
9
10
|
{breakpoint === 'sm' ? 'sm:hidden' : ''}
|
|
10
11
|
{breakpoint === 'md' ? 'md:hidden' : ''}
|
|
11
|
-
{breakpoint === 'lg' ? 'lg:hidden' : ''}
|
|
12
|
+
{breakpoint === 'lg' ? 'lg:hidden' : ''} {extendedCss}
|
|
12
13
|
"
|
|
13
14
|
style={width === undefined ? '' : `width:${width}px`}
|
|
14
15
|
>
|
|
@@ -19,7 +20,7 @@ export let breakpoint = void 0;
|
|
|
19
20
|
class="px-2 py-1.5 border-r border-r-slate-300 last-of-type:border-r-0 table-cell
|
|
20
21
|
{breakpoint === 'sm' ? 'sm:hidden' : ''}
|
|
21
22
|
{breakpoint === 'md' ? 'md:hidden' : ''}
|
|
22
|
-
{breakpoint === 'lg' ? 'lg:hidden' : ''}
|
|
23
|
+
{breakpoint === 'lg' ? 'lg:hidden' : ''} {extendedCss}
|
|
23
24
|
"
|
|
24
25
|
style={width === undefined ? '' : `width:${width}px`}
|
|
25
26
|
>
|
|
@@ -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 {};
|
|
@@ -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}
|
|
@@ -35,7 +35,10 @@ function dialogClicked(event) {
|
|
|
35
35
|
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
|
36
36
|
<dialog
|
|
37
37
|
bind:this={dialog}
|
|
38
|
-
class="p-2 w-full
|
|
38
|
+
class="p-2 w-full
|
|
39
|
+
{dialogSize === 'sm' ? 'md:w-1/2' : ''}
|
|
40
|
+
{dialogSize === 'md' ? 'md:w-3/4 lg:w-2/3 xl:w-1/2' : ''}
|
|
41
|
+
{dialogSize === 'lg' ? 'md:w-3/4' : ''}
|
|
39
42
|
bg-transparent
|
|
40
43
|
|
|
41
44
|
backdrop:bg-black/20 dark:backdrop:bg-white/20
|
|
@@ -79,8 +82,8 @@ function dialogClicked(event) {
|
|
|
79
82
|
</div>
|
|
80
83
|
<slot />
|
|
81
84
|
|
|
82
|
-
<div slot="buttons" class="grid {allowSubmit ? 'grid-cols-2' : 'grid-cols-1'} gap-2 my-2"
|
|
83
|
-
<slot name="buttons"
|
|
85
|
+
<div slot="buttons" class="grid {allowSubmit ? 'grid-cols-2' : 'grid-cols-1'} gap-2 my-2">
|
|
86
|
+
<slot name="buttons">
|
|
84
87
|
{#if allowSubmit}
|
|
85
88
|
<Button type="submit" isLoading={busy}>
|
|
86
89
|
<span>Ok</span>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script>export let theme = "teal";
|
|
2
|
+
export let size = "md";
|
|
3
|
+
export let isLight = false;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
{#if !isLight}
|
|
7
|
+
<span
|
|
8
|
+
class="inline-block text-center
|
|
9
|
+
{size === 'sm' ? 'text-sm rounded-3xl px-3 py-1.5' : ''}
|
|
10
|
+
{size === 'md' ? 'text-base rounded-3xl px-4 py-2' : ''}
|
|
11
|
+
{size === 'lg' ? 'text-lg rounded-3xl px-6 py-3' : ''}
|
|
12
|
+
{theme === 'teal' ? 'bg-teal-500 text-teal-50' : ''}
|
|
13
|
+
{theme === 'slate' ? 'bg-slate-400 text-slate-50' : ''}
|
|
14
|
+
{theme === 'blue' ? 'bg-blue-600 text-blue-50' : ''}
|
|
15
|
+
{theme === 'indigo' ? 'bg-indigo-600 text-indigo-50' : ''}
|
|
16
|
+
{theme === 'red' ? 'bg-red-600 text-red-50' : ''}
|
|
17
|
+
{theme === 'dark' ? 'bg-slate-950 text-slate-50' : ''}
|
|
18
|
+
{theme === 'purple' ? 'bg-purple-950 text-purple-50' : ''}
|
|
19
|
+
"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</span>
|
|
23
|
+
{:else}
|
|
24
|
+
<span
|
|
25
|
+
class="inline-block text-center
|
|
26
|
+
{size === 'sm' ? 'text-sm rounded-3xl px-3 py-1.5' : ''}
|
|
27
|
+
{size === 'md' ? 'text-base rounded-3xl px-4 py-2' : ''}
|
|
28
|
+
{size === 'lg' ? 'text-lg rounded-3xl px-6 py-3' : ''}
|
|
29
|
+
|
|
30
|
+
{theme === 'teal' ? 'bg-teal-100 text-teal-500 border border-teal-500' : ''}
|
|
31
|
+
{theme === 'slate' ? 'bg-slate-100 text-slate-500 border border-slate-500' : ''}
|
|
32
|
+
{theme === 'blue' ? 'bg-blue-100 text-blue-500 border border-blue-500' : ''}
|
|
33
|
+
{theme === 'indigo' ? 'bg-indigo-100 text-indigo-500 border border-indigo-500' : ''}
|
|
34
|
+
{theme === 'red' ? 'bg-red-100 text-red-500 border border-red-500' : ''}
|
|
35
|
+
{theme === 'purple' ? 'bg-purple-100 text-purple-500 border border-purple-500' : ''}
|
|
36
|
+
{theme === 'dark' ? 'bg-slate-100 text-slate-950 border border-slate-950' : ''}
|
|
37
|
+
|
|
38
|
+
"
|
|
39
|
+
>
|
|
40
|
+
<slot />
|
|
41
|
+
</span>
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ColorThemes, Size } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
theme?: ColorThemes;
|
|
6
|
+
size?: Size;
|
|
7
|
+
isLight?: boolean;
|
|
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 PillProps = typeof __propDef.props;
|
|
19
|
+
export type PillEvents = typeof __propDef.events;
|
|
20
|
+
export type PillSlots = typeof __propDef.slots;
|
|
21
|
+
export default class Pill extends SvelteComponent<PillProps, PillEvents, PillSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script>import Pill from "./Pill.svelte";
|
|
2
|
+
export let theme = "teal";
|
|
3
|
+
export let size = "md";
|
|
4
|
+
export let isLight = false;
|
|
5
|
+
export let state = false;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
{#if state}
|
|
9
|
+
<Pill {theme} {size} {isLight}>
|
|
10
|
+
<div class="flex space-x-1">
|
|
11
|
+
<svg
|
|
12
|
+
class="w-5 h-5 my-auto"
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
width="24"
|
|
16
|
+
height="24"
|
|
17
|
+
fill="none"
|
|
18
|
+
viewBox="0 0 24 24"
|
|
19
|
+
>
|
|
20
|
+
<path
|
|
21
|
+
stroke="currentColor"
|
|
22
|
+
stroke-linecap="round"
|
|
23
|
+
stroke-linejoin="round"
|
|
24
|
+
stroke-width="2"
|
|
25
|
+
d="M5 11.917 9.724 16.5 19 7.5"
|
|
26
|
+
/>
|
|
27
|
+
</svg>
|
|
28
|
+
|
|
29
|
+
<div class="my-auto">
|
|
30
|
+
<slot />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</Pill>
|
|
34
|
+
{:else}
|
|
35
|
+
<Pill theme="slate" {size} {isLight}>
|
|
36
|
+
<div class="flex space-x-1">
|
|
37
|
+
<svg
|
|
38
|
+
class="w-5 h-5 my-auto"
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
width="24"
|
|
42
|
+
height="24"
|
|
43
|
+
fill="none"
|
|
44
|
+
viewBox="0 0 24 24"
|
|
45
|
+
>
|
|
46
|
+
<path
|
|
47
|
+
stroke="currentColor"
|
|
48
|
+
stroke-linecap="round"
|
|
49
|
+
stroke-linejoin="round"
|
|
50
|
+
stroke-width="2"
|
|
51
|
+
d="M6 18 17.94 6M18 18 6.06 6"
|
|
52
|
+
/>
|
|
53
|
+
</svg>
|
|
54
|
+
|
|
55
|
+
<div class="my-auto">
|
|
56
|
+
<slot />
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</Pill>
|
|
60
|
+
{/if}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ColorThemes, Size } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
theme?: ColorThemes;
|
|
6
|
+
size?: Size;
|
|
7
|
+
isLight?: boolean;
|
|
8
|
+
state?: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {
|
|
14
|
+
default: {};
|
|
15
|
+
};
|
|
16
|
+
exports?: {} | undefined;
|
|
17
|
+
bindings?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type PillBooleanProps = typeof __propDef.props;
|
|
20
|
+
export type PillBooleanEvents = typeof __propDef.events;
|
|
21
|
+
export type PillBooleanSlots = typeof __propDef.slots;
|
|
22
|
+
export default class PillBoolean extends SvelteComponent<PillBooleanProps, PillBooleanEvents, PillBooleanSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -7,20 +7,17 @@ let tabHeaders = [];
|
|
|
7
7
|
function setIndex(index) {
|
|
8
8
|
currentIndex = index;
|
|
9
9
|
let tabPages = pagesHolder.querySelectorAll('[data-tab-page="true"]');
|
|
10
|
-
const classes = ["hidden", "opacity-0"];
|
|
11
10
|
for (const tabPage of tabPages) {
|
|
12
11
|
let elem = tabPage;
|
|
13
12
|
const index2 = Number(elem.dataset.index);
|
|
14
13
|
if (index2 === currentIndex) {
|
|
15
14
|
elem.classList.remove("hidden");
|
|
16
|
-
elem.classList.remove("opacity-100");
|
|
17
|
-
elem.classList.add("opacity-0");
|
|
18
15
|
setTimeout(() => {
|
|
19
16
|
elem.classList.add("opacity-100");
|
|
20
|
-
|
|
21
|
-
}, 10);
|
|
17
|
+
}, 5);
|
|
22
18
|
} else {
|
|
23
19
|
elem.classList.add("hidden");
|
|
20
|
+
elem.classList.remove("opacity-100");
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
}
|
|
@@ -37,64 +34,46 @@ onMount(() => {
|
|
|
37
34
|
});
|
|
38
35
|
}
|
|
39
36
|
tabHeaders = [...tabHeaders];
|
|
40
|
-
pagesHolder.innerHTML = "";
|
|
41
|
-
const classes = ["transition-all", "ease-in-out", "duration-500", "hidden"];
|
|
42
|
-
for (const tabPage of pages) {
|
|
43
|
-
let elem = tabPage;
|
|
44
|
-
let parent = elem.parentElement;
|
|
45
|
-
parent?.removeChild(elem);
|
|
46
|
-
pagesHolder.appendChild(elem);
|
|
47
|
-
classes.forEach((cls) => elem.classList.add(cls));
|
|
48
|
-
}
|
|
49
37
|
setIndex(currentIndex);
|
|
50
38
|
});
|
|
51
39
|
</script>
|
|
52
40
|
|
|
53
41
|
<div bind:this={tabsHolder}>
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
<div class="border-b border-b-slate-300">
|
|
43
|
+
<ul class="flex flex-wrap -mb-px space-x-1">
|
|
44
|
+
{#each tabHeaders as tabHeader (tabHeader.key)}
|
|
45
|
+
<!-- svelte-ignore a11y-role-supports-aria-props -->
|
|
46
|
+
<button
|
|
47
|
+
on:click={() => setIndex(tabHeader.key)}
|
|
48
|
+
aria-checked={tabHeader.key === currentIndex ? 'true' : 'false'}
|
|
49
|
+
type="button"
|
|
50
|
+
class="p-3 md:px-4 lg:px-6 transition-all ease-in-out duration-150
|
|
63
51
|
text-slate-500 hover:text-slate-700
|
|
64
52
|
border-b-2 border-b-transparent hover:border-b-slate-400
|
|
65
53
|
{theme === 'teal'
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
? 'aria-checked:text-teal-500 aria-checked:border-b-teal-500'
|
|
55
|
+
: ''}
|
|
68
56
|
{theme === 'blue'
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
? 'aria-checked:text-blue-500 aria-checked:border-b-blue-500'
|
|
58
|
+
: ''}
|
|
71
59
|
{theme === 'purple'
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
? 'aria-checked:text-purple-500 aria-checked:border-b-purple-500'
|
|
61
|
+
: ''}
|
|
74
62
|
{theme === 'indigo'
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
? 'aria-checked:text-indigo-500 aria-checked:border-b-indigo-500'
|
|
64
|
+
: ''}
|
|
77
65
|
{theme === 'red'
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
? 'aria-checked:text-red-500 aria-checked:border-b-red-500'
|
|
67
|
+
: ''}
|
|
80
68
|
|
|
81
69
|
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<!-- {#each tabPages as tabPage (tabPage.key)}
|
|
90
|
-
<div class="{tabPage.key === currentIndex ? '' : 'hidden'} transition-all ease-in-out duration-150">
|
|
91
|
-
{@html tabPage.value}
|
|
92
|
-
</div>
|
|
93
|
-
{/each} -->
|
|
94
|
-
</div>
|
|
95
|
-
{/if}
|
|
96
|
-
|
|
97
|
-
<div class="hidden">
|
|
70
|
+
>
|
|
71
|
+
{@html tabHeader.value}
|
|
72
|
+
</button>
|
|
73
|
+
{/each}
|
|
74
|
+
</ul>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="my-2" bind:this={pagesHolder}>
|
|
98
77
|
<slot />
|
|
99
78
|
</div>
|
|
100
79
|
</div>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<div data-tab-header="true" class="hidden" data-index={index}>
|
|
6
6
|
<slot name="header" />
|
|
7
7
|
</div>
|
|
8
|
-
<div data-tab-page="true" data-index={index}>
|
|
9
|
-
<slot />
|
|
8
|
+
<div data-tab-page="true" data-index={index} class="transition-all ease-in-out duration-500 opacity-0">
|
|
9
|
+
<slot />
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
@@ -3,15 +3,17 @@ export let label = "";
|
|
|
3
3
|
export let id = void 0;
|
|
4
4
|
export let name = void 0;
|
|
5
5
|
export let theme = "teal";
|
|
6
|
+
export let disabled = false;
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
<label class="flex cursor-pointer">
|
|
9
|
-
<input type="checkbox" bind:checked class="hidden peer" {id} {name} on:change />
|
|
10
|
+
<input type="checkbox" bind:checked class="hidden peer" {id} {name} on:change {disabled} />
|
|
10
11
|
<div
|
|
11
12
|
class=" rounded-full h-5 w-10 flex my-auto bg-slate-300
|
|
12
|
-
{theme==='teal' ? 'peer-checked:bg-teal-600' : ''}
|
|
13
|
-
{theme==='indigo' ? 'peer-checked:bg-indigo-600' : ''}
|
|
14
|
-
{theme==='blue' ? 'peer-blue:bg-indigo-600' : ''}
|
|
13
|
+
{theme === 'teal' ? 'peer-checked:bg-teal-600' : ''}
|
|
14
|
+
{theme === 'indigo' ? 'peer-checked:bg-indigo-600' : ''}
|
|
15
|
+
{theme === 'blue' ? 'peer-blue:bg-indigo-600' : ''}
|
|
16
|
+
peer-disabled:bg-slate-100
|
|
15
17
|
|
|
16
18
|
transition-all duration-300"
|
|
17
19
|
>
|
|
@@ -19,6 +21,7 @@ export let theme = "teal";
|
|
|
19
21
|
class="w-5 h-5 rounded-full my-auto border border-slate-400 {!checked
|
|
20
22
|
? 'bg-slate-400 translate-x-0'
|
|
21
23
|
: ' translate-x-5 bg-slate-100 '} transition-all ease-in-out duration-300
|
|
24
|
+
|
|
22
25
|
"
|
|
23
26
|
/>
|
|
24
27
|
</div>
|
package/dist/date-utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function formatDateTime(dateTime: Date, showTimeStamp?: boolean): string;
|
|
1
|
+
export declare function formatDateTime(dateTime: Date | undefined | string, showTimeStamp?: boolean, timeStyle?: "full" | "long" | "medium" | "short" | undefined, dateStyle?: "full" | "long" | "medium" | "short" | undefined): string;
|
package/dist/date-utils.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
export function formatDateTime(dateTime, showTimeStamp = false) {
|
|
1
|
+
export function formatDateTime(dateTime, showTimeStamp = false, timeStyle = 'short', dateStyle = 'short') {
|
|
2
|
+
if (!dateTime) {
|
|
3
|
+
return 'N/A';
|
|
4
|
+
}
|
|
5
|
+
if (typeof dateTime === 'string') {
|
|
6
|
+
dateTime = new Date(dateTime);
|
|
7
|
+
}
|
|
8
|
+
timeStyle ??= 'short';
|
|
2
9
|
let dateFormatted = 'N/A';
|
|
3
10
|
if (dateTime) {
|
|
4
11
|
const formatter = new Intl.DateTimeFormat(undefined, {
|
|
5
|
-
dateStyle:
|
|
6
|
-
timeStyle: showTimeStamp ?
|
|
12
|
+
dateStyle: dateStyle,
|
|
13
|
+
timeStyle: showTimeStamp ? timeStyle : undefined
|
|
7
14
|
});
|
|
8
15
|
dateFormatted = formatter.format(dateTime);
|
|
9
16
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,5 +26,7 @@ import SideNavItem from "./components/SideNavItem.svelte";
|
|
|
26
26
|
import DataTablePaginator from "./components/DataTablePaginator.svelte";
|
|
27
27
|
import TabControl from "./components/TabControl.svelte";
|
|
28
28
|
import TabItem from "./components/TabItem.svelte";
|
|
29
|
+
import Pill from "./components/Pill.svelte";
|
|
30
|
+
import DropDownButton from "./components/DropDownButton.svelte";
|
|
29
31
|
import { formatDateTime } from "./date-utils.js";
|
|
30
|
-
export { Button, LoadingIndicator, Card, CardHeader, Form, ToggleButton, LabeledFormInput, LabeledPasswordInput, Alert, HyperLink, LabeledSelect, ModalDialog, BooleanPresenter, DataTable, DataTableCell, DataTableRow, DataTableMenuButton, DatePresenter, LabeledDatePicker, LabeledTextArea, Breadcrumb, SegmentedControl, HyperlinkButton, SideNav, SideNavItem, DataTablePaginator, TabControl, TabItem, formatDateTime };
|
|
32
|
+
export { Button, LoadingIndicator, Card, CardHeader, Form, ToggleButton, LabeledFormInput, LabeledPasswordInput, Alert, HyperLink, LabeledSelect, ModalDialog, BooleanPresenter, DataTable, DataTableCell, DataTableRow, DataTableMenuButton, DatePresenter, LabeledDatePicker, LabeledTextArea, Breadcrumb, SegmentedControl, HyperlinkButton, SideNav, SideNavItem, DataTablePaginator, TabControl, TabItem, Pill, DropDownButton, formatDateTime };
|
package/dist/index.js
CHANGED
|
@@ -27,5 +27,7 @@ import SideNavItem from "./components/SideNavItem.svelte";
|
|
|
27
27
|
import DataTablePaginator from "./components/DataTablePaginator.svelte";
|
|
28
28
|
import TabControl from "./components/TabControl.svelte";
|
|
29
29
|
import TabItem from "./components/TabItem.svelte";
|
|
30
|
+
import Pill from "./components/Pill.svelte";
|
|
31
|
+
import DropDownButton from "./components/DropDownButton.svelte";
|
|
30
32
|
import { formatDateTime } from "./date-utils.js";
|
|
31
|
-
export { Button, LoadingIndicator, Card, CardHeader, Form, ToggleButton, LabeledFormInput, LabeledPasswordInput, Alert, HyperLink, LabeledSelect, ModalDialog, BooleanPresenter, DataTable, DataTableCell, DataTableRow, DataTableMenuButton, DatePresenter, LabeledDatePicker, LabeledTextArea, Breadcrumb, SegmentedControl, HyperlinkButton, SideNav, SideNavItem, DataTablePaginator, TabControl, TabItem, formatDateTime };
|
|
33
|
+
export { Button, LoadingIndicator, Card, CardHeader, Form, ToggleButton, LabeledFormInput, LabeledPasswordInput, Alert, HyperLink, LabeledSelect, ModalDialog, BooleanPresenter, DataTable, DataTableCell, DataTableRow, DataTableMenuButton, DatePresenter, LabeledDatePicker, LabeledTextArea, Breadcrumb, SegmentedControl, HyperlinkButton, SideNav, SideNavItem, DataTablePaginator, TabControl, TabItem, Pill, DropDownButton, formatDateTime };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "y200subcontrols",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3731",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run package",
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"bootstrap-icons": "^1.11.3",
|
|
58
|
-
"y200subcontrols": "^0.0.
|
|
58
|
+
"y200subcontrols": "^0.0.355"
|
|
59
59
|
}
|
|
60
60
|
}
|