fluid-ui-svelte 0.0.5 → 0.0.7
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 +105 -1
- package/dist/components/Avatar/Avatar.svelte +1 -1
- package/dist/components/Modal/ModalContainer.svelte +20 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/primitives/Button/Button.svelte +13 -0
- package/dist/primitives/Button/Button.svelte.d.ts +2 -0
- package/dist/primitives/Container/Container.svelte +16 -0
- package/dist/primitives/Container/Container.svelte.d.ts +2 -0
- package/dist/primitives/Input/ColorInput.svelte +2 -0
- package/dist/primitives/Input/ColorInput.svelte.d.ts +1 -0
- package/dist/primitives/Input/DateTimeInput.svelte +4 -4
- package/dist/primitives/Input/DateTimeInput.svelte.d.ts +1 -2
- package/dist/primitives/Input/FileInput.svelte +2 -7
- package/dist/primitives/Input/FileInput.svelte.d.ts +0 -2
- package/dist/primitives/Input/PasswordInput.svelte +11 -0
- package/dist/primitives/Input/PasswordInput.svelte.d.ts +19 -0
- package/dist/primitives/Input/TextInput.svelte +4 -4
- package/dist/primitives/Input/TextInput.svelte.d.ts +1 -2
- package/dist/primitives/Input/ToggleInput.svelte +10 -9
- package/dist/primitives/Input/ToggleInput.svelte.d.ts +1 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,107 @@
|
|
|
1
|
+
# This package is under development, you can check the version number. I would not recommend using it before I reach at least v.0.5.x
|
|
2
|
+
|
|
1
3
|
# Fluid UI for Svelte/SvelteKit
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
Fluid UI is a UI library with minimal styling and layout. All of the primitives are basic abstractions of html elements and components are just building blocks for the actual component. You will need to build components yourself using those building blocks.
|
|
6
|
+
|
|
7
|
+
# Getting Started
|
|
8
|
+
|
|
9
|
+
Install the library.
|
|
10
|
+
```
|
|
11
|
+
npm i fluid-ui-svelte
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Import a component to your UI.
|
|
15
|
+
```
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import '../app.css';
|
|
18
|
+
import {Button} from '$lib/index.js';
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Button></Button>
|
|
22
|
+
```
|
|
23
|
+
Success :)
|
|
24
|
+
|
|
25
|
+
# Tailwind "app.css" Template.
|
|
26
|
+
```
|
|
27
|
+
@tailwind base;
|
|
28
|
+
@tailwind components;
|
|
29
|
+
@tailwind utilities;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
.fluid-audio {
|
|
33
|
+
@apply m-2 p-2
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.fluid-button {
|
|
37
|
+
@apply m-2 p-2 disabled:bg-opacity-25
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.fluid-container {
|
|
41
|
+
@apply m-2 p-2
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.fluid-form {
|
|
45
|
+
@apply m-2 p-2
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.fluid-image {
|
|
49
|
+
@apply m-2 p-2
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.fluid-color-input {
|
|
53
|
+
@apply m-2 p-2
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.fluid-date-time-input {
|
|
57
|
+
@apply m-2 p-2
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.fluid-file-input {
|
|
61
|
+
@apply m-2 p-2
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.fluid-color-input {
|
|
65
|
+
@apply m-2 p-2
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.fluid-color-input {
|
|
69
|
+
@apply m-2 p-2
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.fluid-label {
|
|
73
|
+
@apply m-2 p-2
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.fluid-link {
|
|
77
|
+
@apply m-2 p-2
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.fluid-select {
|
|
81
|
+
@apply m-2 p-2
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.fluid-option {
|
|
85
|
+
@apply m-2 p-2
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.fluid-table {
|
|
89
|
+
@apply m-2 p-2
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.fluid-text {
|
|
93
|
+
@apply m-2 p-2
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.fluid-video {
|
|
97
|
+
@apply m-2 p-2
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.fluid-avatar {
|
|
101
|
+
@apply m-2 p-2 rounded-full w-full h-full aspect-square
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.fluid-toggle {
|
|
105
|
+
@apply bg-gray after:bg-graylight after:border-graylight w-11 h-6 rounded-full after:absolute after:top-[2px] after:left-[2px] after:border after:rounded-full after:h-5 after:w-5 after:transition-all
|
|
106
|
+
}
|
|
107
|
+
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import Image from "../../primitives/Image/Image.svelte";
|
|
2
|
-
export let avatarClass = "
|
|
2
|
+
export let avatarClass = "";
|
|
3
3
|
export let defaultClass = "fluid-avatar";
|
|
4
4
|
export let overrideClass = false;
|
|
5
5
|
export let avatarUrl;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
<script>import Container from "../../primitives/Container/Container.svelte";
|
|
2
2
|
export let modalClass = "absolute w-screen h-screen left-0 bottom-0 bg-gray flex flex-col bg-opacity-50 justify-center items-center z-0";
|
|
3
3
|
export let isVisible = true;
|
|
4
|
+
const closeOnEscape = (event) => {
|
|
5
|
+
if (event.key == "Escape") {
|
|
6
|
+
isVisible = false;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
4
9
|
</script>
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
{#if isVisible}
|
|
12
|
+
<Container
|
|
13
|
+
containerType="div"
|
|
14
|
+
overrideClass={true}
|
|
15
|
+
containerClass={modalClass}
|
|
16
|
+
registerMount={() => {
|
|
17
|
+
document.addEventListener('keydown', closeOnEscape);
|
|
18
|
+
}}
|
|
19
|
+
registerDestroy={() => {
|
|
20
|
+
document.removeEventListener('keydown', closeOnEscape);
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</Container>
|
|
25
|
+
{/if}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { default as ColorInput } from "./primitives/Input/ColorInput.svelte";
|
|
|
7
7
|
export { default as DateTimeInput } from "./primitives/Input/DateTimeInput.svelte";
|
|
8
8
|
export { default as FileInput } from "./primitives/Input/FileInput.svelte";
|
|
9
9
|
export { default as TextInput } from "./primitives/Input/TextInput.svelte";
|
|
10
|
+
export { default as PasswordInput } from "./primitives/Input/PasswordInput.svelte";
|
|
10
11
|
export { default as ToggleInput } from "./primitives/Input/ToggleInput.svelte";
|
|
11
12
|
export { default as Label } from "./primitives/Label/Label.svelte";
|
|
12
13
|
export { default as Link } from "./primitives/Link/Link.svelte";
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { default as ColorInput } from './primitives/Input/ColorInput.svelte';
|
|
|
8
8
|
export { default as DateTimeInput } from './primitives/Input/DateTimeInput.svelte';
|
|
9
9
|
export { default as FileInput } from './primitives/Input/FileInput.svelte';
|
|
10
10
|
export { default as TextInput } from './primitives/Input/TextInput.svelte';
|
|
11
|
+
export { default as PasswordInput } from './primitives/Input/PasswordInput.svelte';
|
|
11
12
|
export { default as ToggleInput } from './primitives/Input/ToggleInput.svelte';
|
|
12
13
|
export { default as Label } from './primitives/Label/Label.svelte';
|
|
13
14
|
export { default as Link } from "./primitives/Link/Link.svelte";
|
|
@@ -5,9 +5,22 @@ export let buttonType = "button";
|
|
|
5
5
|
export let isDisabled = false;
|
|
6
6
|
export let buttonName = "";
|
|
7
7
|
export let buttonValue = "";
|
|
8
|
+
export let registerMount = () => {
|
|
9
|
+
};
|
|
10
|
+
export let registerDestroy = () => {
|
|
11
|
+
};
|
|
12
|
+
function registerAction(node) {
|
|
13
|
+
registerMount(node);
|
|
14
|
+
return {
|
|
15
|
+
destroy() {
|
|
16
|
+
registerDestroy(node);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
8
20
|
</script>
|
|
9
21
|
|
|
10
22
|
<button
|
|
23
|
+
use:registerAction
|
|
11
24
|
on:click
|
|
12
25
|
type={buttonType}
|
|
13
26
|
class={overrideClass ? buttonClass : defaultClass + ' ' + buttonClass}
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
isDisabled?: boolean | undefined;
|
|
10
10
|
buttonName?: string | undefined;
|
|
11
11
|
buttonValue?: string | undefined;
|
|
12
|
+
registerMount?: ((node: Node) => void) | undefined;
|
|
13
|
+
registerDestroy?: ((node: Node) => void) | undefined;
|
|
12
14
|
};
|
|
13
15
|
events: {
|
|
14
16
|
click: MouseEvent;
|
|
@@ -2,10 +2,23 @@
|
|
|
2
2
|
export let defaultClass = "fluid-container";
|
|
3
3
|
export let overrideClass = false;
|
|
4
4
|
export let containerType = "div";
|
|
5
|
+
export let registerMount = () => {
|
|
6
|
+
};
|
|
7
|
+
export let registerDestroy = () => {
|
|
8
|
+
};
|
|
9
|
+
function registerAction(node) {
|
|
10
|
+
registerMount(node);
|
|
11
|
+
return {
|
|
12
|
+
destroy() {
|
|
13
|
+
registerDestroy();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
5
17
|
</script>
|
|
6
18
|
|
|
7
19
|
{#if containerType == 'div'}
|
|
8
20
|
<div
|
|
21
|
+
use:registerAction
|
|
9
22
|
class={overrideClass ? containerClass : defaultClass + ' ' + containerClass}
|
|
10
23
|
{...$$restProps}
|
|
11
24
|
>
|
|
@@ -13,6 +26,7 @@ export let containerType = "div";
|
|
|
13
26
|
</div>
|
|
14
27
|
{:else if containerType == 'section'}
|
|
15
28
|
<section
|
|
29
|
+
use:registerAction
|
|
16
30
|
class={overrideClass ? containerClass : defaultClass + ' ' + containerClass}
|
|
17
31
|
{...$$restProps}
|
|
18
32
|
>
|
|
@@ -20,6 +34,7 @@ export let containerType = "div";
|
|
|
20
34
|
</section>
|
|
21
35
|
{:else if containerType == 'nav'}
|
|
22
36
|
<nav
|
|
37
|
+
use:registerAction
|
|
23
38
|
class={overrideClass ? containerClass : defaultClass + ' ' + containerClass}
|
|
24
39
|
{...$$restProps}
|
|
25
40
|
>
|
|
@@ -27,6 +42,7 @@ export let containerType = "div";
|
|
|
27
42
|
</nav>
|
|
28
43
|
{:else if containerType == 'footer'}
|
|
29
44
|
<nav
|
|
45
|
+
use:registerAction
|
|
30
46
|
class={overrideClass ? containerClass : defaultClass + ' ' + containerClass}
|
|
31
47
|
{...$$restProps}
|
|
32
48
|
>
|
|
@@ -6,6 +6,8 @@ declare const __propDef: {
|
|
|
6
6
|
defaultClass?: string | undefined;
|
|
7
7
|
overrideClass?: boolean | undefined;
|
|
8
8
|
containerType?: "div" | "section" | "nav" | "footer" | undefined;
|
|
9
|
+
registerMount?: Function | undefined;
|
|
10
|
+
registerDestroy?: Function | undefined;
|
|
9
11
|
};
|
|
10
12
|
events: {
|
|
11
13
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script>export let inputClass = "input";
|
|
2
2
|
export let defaultClass = "fluid-color-input";
|
|
3
3
|
export let overrideClass = false;
|
|
4
|
+
export let value = "";
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
7
|
<input
|
|
8
|
+
bind:value
|
|
7
9
|
type="color"
|
|
8
10
|
class={overrideClass ? inputClass : defaultClass + ' ' + inputClass}
|
|
9
11
|
{...$$restProps}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<script>export let
|
|
2
|
-
export let inputClass = "";
|
|
1
|
+
<script>export let inputClass = "";
|
|
3
2
|
export let defaultClass = "fluid-date-time-input";
|
|
4
3
|
export let overrideClass = false;
|
|
4
|
+
export let value = "";
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<input
|
|
8
|
-
|
|
8
|
+
bind:value
|
|
9
|
+
type="date"
|
|
9
10
|
class={overrideClass ? inputClass : defaultClass + ' ' + inputClass}
|
|
10
|
-
{...$$restProps}
|
|
11
11
|
/>
|
|
12
12
|
a
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
inputType?: "date" | "datetime-local" | "month" | "time" | "week" | undefined;
|
|
6
4
|
inputClass?: string | undefined;
|
|
7
5
|
defaultClass?: string | undefined;
|
|
8
6
|
overrideClass?: boolean | undefined;
|
|
7
|
+
value?: string | undefined;
|
|
9
8
|
};
|
|
10
9
|
events: {
|
|
11
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
<script>export let
|
|
2
|
-
export let inputClass = "";
|
|
1
|
+
<script>export let inputClass = "";
|
|
3
2
|
export let defaultClass = "fluid-file-input";
|
|
4
3
|
export let overrideClass = false;
|
|
5
4
|
</script>
|
|
6
5
|
|
|
7
|
-
<input
|
|
8
|
-
type={inputType}
|
|
9
|
-
class={overrideClass ? inputClass : defaultClass + ' ' + inputClass}
|
|
10
|
-
{...$$restProps}
|
|
11
|
-
/>
|
|
6
|
+
<input type="file" class={overrideClass ? inputClass : defaultClass + ' ' + inputClass} />
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script>export let inputClass = "";
|
|
2
|
+
export let defaultClass = "fluid-text-input";
|
|
3
|
+
export let overrideClass = false;
|
|
4
|
+
export let value = "";
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<input
|
|
8
|
+
bind:value
|
|
9
|
+
type="password"
|
|
10
|
+
class={overrideClass ? inputClass : defaultClass + ' ' + inputClass}
|
|
11
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
inputClass?: string | undefined;
|
|
5
|
+
defaultClass?: string | undefined;
|
|
6
|
+
overrideClass?: boolean | undefined;
|
|
7
|
+
value?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type PasswordInputProps = typeof __propDef.props;
|
|
15
|
+
export type PasswordInputEvents = typeof __propDef.events;
|
|
16
|
+
export type PasswordInputSlots = typeof __propDef.slots;
|
|
17
|
+
export default class PasswordInput extends SvelteComponent<PasswordInputProps, PasswordInputEvents, PasswordInputSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<script>export let
|
|
2
|
-
export let inputClass = "";
|
|
1
|
+
<script>export let inputClass = "";
|
|
3
2
|
export let defaultClass = "fluid-text-input";
|
|
4
3
|
export let overrideClass = false;
|
|
4
|
+
export let value = "";
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<input
|
|
8
|
-
|
|
8
|
+
bind:value
|
|
9
|
+
type="text"
|
|
9
10
|
class={overrideClass ? inputClass : defaultClass + ' ' + inputClass}
|
|
10
|
-
{...$$restProps}
|
|
11
11
|
/>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
inputType?: "number" | "email" | "password" | "search" | "tel" | "text" | "url" | undefined;
|
|
6
4
|
inputClass?: string | undefined;
|
|
7
5
|
defaultClass?: string | undefined;
|
|
8
6
|
overrideClass?: boolean | undefined;
|
|
7
|
+
value?: string | undefined;
|
|
9
8
|
};
|
|
10
9
|
events: {
|
|
11
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
<script>export let
|
|
2
|
-
export let
|
|
3
|
-
export let defaultClass = "fluid-toggle-input";
|
|
4
|
-
export let overrideClass = false;
|
|
1
|
+
<script>export let defaultClass = "fluid-toggle";
|
|
2
|
+
export let isChecked = false;
|
|
5
3
|
</script>
|
|
6
4
|
|
|
7
|
-
<
|
|
8
|
-
type={
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
<label class="relative inline-flex items-center cursor-pointer">
|
|
6
|
+
<input type="checkbox" bind:value={isChecked} class="sr-only peer" />
|
|
7
|
+
<div
|
|
8
|
+
class={defaultClass +
|
|
9
|
+
' ' +
|
|
10
|
+
"peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] peer-checked:bg-green"}
|
|
11
|
+
/>
|
|
12
|
+
</label>
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
inputType?: "checkbox" | "radio" | undefined;
|
|
6
|
-
inputClass?: string | undefined;
|
|
7
4
|
defaultClass?: string | undefined;
|
|
8
|
-
|
|
5
|
+
isChecked?: boolean | undefined;
|
|
9
6
|
};
|
|
10
7
|
events: {
|
|
11
8
|
[evt: string]: CustomEvent<any>;
|