@websline/system-components 0.0.4 → 0.0.6
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/atoms/actions/closeButton/CloseButton.svelte +8 -5
- package/dist/components/atoms/actions/closeButton/CloseButton.svelte.d.ts +2 -2
- package/dist/components/atoms/feedback/progressBar/ProgressBar.svelte +47 -0
- package/dist/components/atoms/feedback/progressBar/ProgressBar.svelte.d.ts +41 -0
- package/dist/components/atoms/feedback/progressBar/progressBar.variants.d.ts +29 -0
- package/dist/components/atoms/feedback/progressBar/progressBar.variants.js +11 -0
- package/dist/components/atoms/icon/Icon.svelte +3 -1
- package/dist/components/atoms/icon/Icon.svelte.d.ts +2 -2
- package/dist/components/atoms/icon/components/Attach.svelte +27 -0
- package/dist/components/atoms/icon/components/Attach.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Block.svelte +27 -0
- package/dist/components/atoms/icon/components/Block.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Cogs.svelte +31 -0
- package/dist/components/atoms/icon/components/Cogs.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Controlling.svelte +27 -0
- package/dist/components/atoms/icon/components/Controlling.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Dashboard.svelte +41 -0
- package/dist/components/atoms/icon/components/Dashboard.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Database.svelte +27 -0
- package/dist/components/atoms/icon/components/Database.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Dragger.svelte +27 -0
- package/dist/components/atoms/icon/components/Dragger.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Globe.svelte +27 -0
- package/dist/components/atoms/icon/components/Globe.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Layout.svelte +27 -0
- package/dist/components/atoms/icon/components/Layout.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Menu.svelte +27 -0
- package/dist/components/atoms/icon/components/Menu.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Notifications.svelte +26 -0
- package/dist/components/atoms/icon/components/Notifications.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Picture.svelte +27 -0
- package/dist/components/atoms/icon/components/Picture.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Search.svelte +27 -0
- package/dist/components/atoms/icon/components/Search.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Settings.svelte +31 -0
- package/dist/components/atoms/icon/components/Settings.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Trash.svelte +27 -0
- package/dist/components/atoms/icon/components/Trash.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/index.d.ts +30 -0
- package/dist/components/atoms/icon/index.js +30 -0
- package/dist/components/molecules/formActions/formActions.svelte +25 -0
- package/dist/components/molecules/formActions/formActions.svelte.d.ts +41 -0
- package/dist/components/molecules/formActions/formActions.variants.d.ts +22 -0
- package/dist/components/molecules/formActions/formActions.variants.js +16 -0
- package/dist/components/{atoms/form → molecules}/formField/FormField.svelte +2 -2
- package/dist/components/{atoms/form → molecules}/formField/FormField.svelte.d.ts +2 -2
- package/dist/components/molecules/formLayout/FormLayout.svelte +17 -0
- package/dist/components/molecules/formLayout/FormLayout.svelte.d.ts +33 -0
- package/dist/components/molecules/formLayout/formLayout.variants.d.ts +31 -0
- package/dist/components/molecules/formLayout/formLayout.variants.js +18 -0
- package/dist/components/organisms/dialog/Dialog.svelte +17 -0
- package/dist/components/organisms/dialog/Dialog.svelte.d.ts +34 -0
- package/dist/components/organisms/dialog/DialogAction.svelte +72 -0
- package/dist/components/organisms/dialog/DialogAction.svelte.d.ts +33 -0
- package/dist/components/organisms/dialog/DialogActions.svelte +19 -0
- package/dist/components/organisms/dialog/DialogActions.svelte.d.ts +25 -0
- package/dist/components/organisms/dialog/DialogBody.svelte +18 -0
- package/dist/components/organisms/dialog/DialogBody.svelte.d.ts +25 -0
- package/dist/components/organisms/dialog/DialogContent.svelte +57 -0
- package/dist/components/organisms/dialog/DialogContent.svelte.d.ts +57 -0
- package/dist/components/organisms/dialog/DialogTrigger.svelte +14 -0
- package/dist/components/organisms/dialog/DialogTrigger.svelte.d.ts +17 -0
- package/dist/components/organisms/dialog/dialog.variants.d.ts +85 -0
- package/dist/components/organisms/dialog/dialog.variants.js +30 -0
- package/dist/components/organisms/dialog/index.d.ts +7 -0
- package/dist/components/organisms/dialog/index.js +8 -0
- package/dist/components/organisms/modal/Modal.svelte +17 -0
- package/dist/components/organisms/modal/Modal.svelte.d.ts +33 -0
- package/dist/components/organisms/modal/ModalBody.svelte +19 -0
- package/dist/components/organisms/modal/ModalBody.svelte.d.ts +33 -0
- package/dist/components/organisms/modal/ModalContent.svelte +70 -0
- package/dist/components/organisms/modal/ModalContent.svelte.d.ts +57 -0
- package/dist/components/organisms/modal/ModalHeader.svelte +28 -0
- package/dist/components/organisms/modal/ModalHeader.svelte.d.ts +33 -0
- package/dist/components/organisms/modal/ModalTrigger.svelte +14 -0
- package/dist/components/organisms/modal/ModalTrigger.svelte.d.ts +17 -0
- package/dist/components/organisms/modal/index.d.ts +6 -0
- package/dist/components/organisms/modal/index.js +7 -0
- package/dist/components/organisms/modal/modal.variants.d.ts +112 -0
- package/dist/components/organisms/modal/modal.variants.js +30 -0
- package/dist/index.d.ts +13 -9
- package/dist/index.js +13 -9
- package/dist/utils/a11y.d.ts +1 -0
- package/dist/utils/a11y.js +5 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +16 -16
- package/dist/components/molecules/navigationItem/NavigationItem.svelte +0 -80
- package/dist/components/molecules/navigationItem/NavigationItem.svelte.d.ts +0 -81
- package/dist/components/molecules/navigationItem/navigationItem.variants.d.ts +0 -61
- package/dist/components/molecules/navigationItem/navigationItem.variants.js +0 -29
- /package/dist/components/atoms/{form/helperText → helperText}/HelperText.svelte +0 -0
- /package/dist/components/atoms/{form/helperText → helperText}/HelperText.svelte.d.ts +0 -0
- /package/dist/components/atoms/{form/helperText → helperText}/helperText.variants.d.ts +0 -0
- /package/dist/components/atoms/{form/helperText → helperText}/helperText.variants.js +0 -0
- /package/dist/components/atoms/{form/input → input}/Input.svelte +0 -0
- /package/dist/components/atoms/{form/input → input}/Input.svelte.d.ts +0 -0
- /package/dist/components/atoms/{form/input → input}/input.variants.d.ts +0 -0
- /package/dist/components/atoms/{form/input → input}/input.variants.js +0 -0
- /package/dist/components/atoms/{form/label → label}/Label.svelte +0 -0
- /package/dist/components/atoms/{form/label → label}/Label.svelte.d.ts +0 -0
- /package/dist/components/atoms/{form/label → label}/label.variants.d.ts +0 -0
- /package/dist/components/atoms/{form/label → label}/label.variants.js +0 -0
- /package/dist/components/atoms/{form/radio → radio}/Radio.svelte +0 -0
- /package/dist/components/atoms/{form/radio → radio}/Radio.svelte.d.ts +0 -0
- /package/dist/components/atoms/{form/radio → radio}/radio.variants.d.ts +0 -0
- /package/dist/components/atoms/{form/radio → radio}/radio.variants.js +0 -0
- /package/dist/components/atoms/{form/select → select}/Select.svelte +0 -0
- /package/dist/components/atoms/{form/select → select}/Select.svelte.d.ts +0 -0
- /package/dist/components/atoms/{form/select → select}/select.variants.d.ts +0 -0
- /package/dist/components/atoms/{form/select → select}/select.variants.js +0 -0
- /package/dist/components/atoms/{form/switch → switch}/Switch.svelte +0 -0
- /package/dist/components/atoms/{form/switch → switch}/Switch.svelte.d.ts +0 -0
- /package/dist/components/atoms/{form/switch → switch}/switch.variants.d.ts +0 -0
- /package/dist/components/atoms/{form/switch → switch}/switch.variants.js +0 -0
- /package/dist/components/atoms/{form/textarea → textarea}/Textarea.svelte +0 -0
- /package/dist/components/atoms/{form/textarea → textarea}/Textarea.svelte.d.ts +0 -0
- /package/dist/components/atoms/{form/textarea → textarea}/textarea.variants.d.ts +0 -0
- /package/dist/components/atoms/{form/textarea → textarea}/textarea.variants.js +0 -0
- /package/dist/components/{atoms/form → molecules}/formField/formField.variants.d.ts +0 -0
- /package/dist/components/{atoms/form → molecules}/formField/formField.variants.js +0 -0
|
@@ -1,35 +1,65 @@
|
|
|
1
1
|
import Academy from "./components/Academy.svelte";
|
|
2
2
|
import Add from "./components/Add.svelte";
|
|
3
|
+
import Attach from "./components/Attach.svelte";
|
|
4
|
+
import Block from "./components/Block.svelte";
|
|
3
5
|
import Bold from "./components/Bold.svelte";
|
|
4
6
|
import Check from "./components/Check.svelte";
|
|
5
7
|
import ChevronDown from "./components/ChevronDown.svelte";
|
|
6
8
|
import Close from "./components/Close.svelte";
|
|
7
9
|
import CloseSmall from "./components/CloseSmall.svelte";
|
|
10
|
+
import Cogs from "./components/Cogs.svelte";
|
|
11
|
+
import Controlling from "./components/Controlling.svelte";
|
|
12
|
+
import Dashboard from "./components/Dashboard.svelte";
|
|
13
|
+
import Database from "./components/Database.svelte";
|
|
14
|
+
import Dragger from "./components/Dragger.svelte";
|
|
15
|
+
import Globe from "./components/Globe.svelte";
|
|
8
16
|
import Italic from "./components/Italic.svelte";
|
|
17
|
+
import Layout from "./components/Layout.svelte";
|
|
9
18
|
import Link from "./components/Link.svelte";
|
|
10
19
|
import ListOrdered from "./components/ListOrdered.svelte";
|
|
11
20
|
import ListUnordered from "./components/ListUnordered.svelte";
|
|
21
|
+
import Menu from "./components/Menu.svelte";
|
|
22
|
+
import Notifications from "./components/Notifications.svelte";
|
|
12
23
|
import Page from "./components/Page.svelte";
|
|
24
|
+
import Picture from "./components/Picture.svelte";
|
|
13
25
|
import Redo from "./components/Redo.svelte";
|
|
14
26
|
import Refresh from "./components/Refresh.svelte";
|
|
27
|
+
import Search from "./components/Search.svelte";
|
|
28
|
+
import Settings from "./components/Settings.svelte";
|
|
29
|
+
import Trash from "./components/Trash.svelte";
|
|
15
30
|
import Underline from "./components/Underline.svelte";
|
|
16
31
|
import Undo from "./components/Undo.svelte";
|
|
17
32
|
|
|
18
33
|
export const registry = {
|
|
19
34
|
academy: Academy,
|
|
20
35
|
add: Add,
|
|
36
|
+
attach: Attach,
|
|
37
|
+
block: Block,
|
|
21
38
|
bold: Bold,
|
|
22
39
|
check: Check,
|
|
23
40
|
chevronDown: ChevronDown,
|
|
24
41
|
close: Close,
|
|
25
42
|
closeSmall: CloseSmall,
|
|
43
|
+
cogs: Cogs,
|
|
44
|
+
controlling: Controlling,
|
|
45
|
+
dashboard: Dashboard,
|
|
46
|
+
database: Database,
|
|
47
|
+
dragger: Dragger,
|
|
48
|
+
globe: Globe,
|
|
26
49
|
italic: Italic,
|
|
50
|
+
layout: Layout,
|
|
27
51
|
link: Link,
|
|
28
52
|
listOrdered: ListOrdered,
|
|
29
53
|
listUnordered: ListUnordered,
|
|
54
|
+
menu: Menu,
|
|
55
|
+
notifications: Notifications,
|
|
30
56
|
page: Page,
|
|
57
|
+
picture: Picture,
|
|
31
58
|
redo: Redo,
|
|
32
59
|
refresh: Refresh,
|
|
60
|
+
search: Search,
|
|
61
|
+
settings: Settings,
|
|
62
|
+
trash: Trash,
|
|
33
63
|
underline: Underline,
|
|
34
64
|
undo: Undo,
|
|
35
65
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { formActionsVariants } from "./formActions.variants.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} Props
|
|
6
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
7
|
+
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
8
|
+
* @property {boolean} [customLayout=false] If true, the default layout is disabled
|
|
9
|
+
* @property {boolean} [fullWidth=false] If true, the form actions will take the full width of its container
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** @type {Props} */
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
class: className,
|
|
16
|
+
customLayout = false,
|
|
17
|
+
fullWidth = false,
|
|
18
|
+
} = $props();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
class={formActionsVariants({ class: className, customLayout, fullWidth })}
|
|
23
|
+
data-form-actions>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default FormActions;
|
|
2
|
+
type FormActions = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const FormActions: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes to apply to the component
|
|
13
|
+
*/
|
|
14
|
+
class?: string;
|
|
15
|
+
/**
|
|
16
|
+
* If true, the default layout is disabled
|
|
17
|
+
*/
|
|
18
|
+
customLayout?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* If true, the form actions will take the full width of its container
|
|
21
|
+
*/
|
|
22
|
+
fullWidth?: boolean;
|
|
23
|
+
}, {}, "">;
|
|
24
|
+
type Props = {
|
|
25
|
+
/**
|
|
26
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
27
|
+
*/
|
|
28
|
+
children?: import("svelte").Snippet;
|
|
29
|
+
/**
|
|
30
|
+
* Additional CSS classes to apply to the component
|
|
31
|
+
*/
|
|
32
|
+
class?: string;
|
|
33
|
+
/**
|
|
34
|
+
* If true, the default layout is disabled
|
|
35
|
+
*/
|
|
36
|
+
customLayout?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* If true, the form actions will take the full width of its container
|
|
39
|
+
*/
|
|
40
|
+
fullWidth?: boolean;
|
|
41
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const formActionsVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
customLayout: {
|
|
3
|
+
false: string;
|
|
4
|
+
};
|
|
5
|
+
fullWidth: {
|
|
6
|
+
true: string;
|
|
7
|
+
};
|
|
8
|
+
}, undefined, "flex items-center justify-end gap-2", {
|
|
9
|
+
customLayout: {
|
|
10
|
+
false: string;
|
|
11
|
+
};
|
|
12
|
+
fullWidth: {
|
|
13
|
+
true: string;
|
|
14
|
+
};
|
|
15
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
16
|
+
customLayout: {
|
|
17
|
+
false: string;
|
|
18
|
+
};
|
|
19
|
+
fullWidth: {
|
|
20
|
+
true: string;
|
|
21
|
+
};
|
|
22
|
+
}, undefined, "flex items-center justify-end gap-2", unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
|
|
3
|
+
const formActionsVariants = tv({
|
|
4
|
+
base: "flex items-center justify-end gap-2",
|
|
5
|
+
variants: {
|
|
6
|
+
customLayout: {
|
|
7
|
+
false:
|
|
8
|
+
"[&:has(>button:nth-of-type(3):last-of-type)>button:first-of-type]:mr-auto",
|
|
9
|
+
},
|
|
10
|
+
fullWidth: {
|
|
11
|
+
true: "[&>*]:w-full [&>*]:justify-center",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { formActionsVariants };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { setContext } from "svelte";
|
|
3
3
|
import { formFieldVariants } from "./formField.variants.js";
|
|
4
|
-
import { HelperText, Label } from "
|
|
4
|
+
import { HelperText, Label } from "../../../index.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {Object} Props
|
|
8
8
|
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
9
|
-
* @property {string} [class=""] Additional CSS classes
|
|
9
|
+
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
10
10
|
* @property {boolean} [error=false] Whether the form field has an error
|
|
11
11
|
* @property {string} [errorText=""] The error text for the form field
|
|
12
12
|
* @property {string} [helperText=""] The helper text for the form field
|
|
@@ -9,7 +9,7 @@ declare const FormField: import("svelte").Component<{
|
|
|
9
9
|
*/
|
|
10
10
|
children?: import("svelte").Snippet;
|
|
11
11
|
/**
|
|
12
|
-
* Additional CSS classes
|
|
12
|
+
* Additional CSS classes to apply to the component
|
|
13
13
|
*/
|
|
14
14
|
class?: string;
|
|
15
15
|
/**
|
|
@@ -47,7 +47,7 @@ type Props = {
|
|
|
47
47
|
*/
|
|
48
48
|
children?: import("svelte").Snippet;
|
|
49
49
|
/**
|
|
50
|
-
* Additional CSS classes
|
|
50
|
+
* Additional CSS classes to apply to the component
|
|
51
51
|
*/
|
|
52
52
|
class?: string;
|
|
53
53
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { formLayoutVariants } from "./formLayout.variants.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} Props
|
|
6
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
7
|
+
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
8
|
+
* @property {0|1|2|3|4|6|8} [gap=2] Gap between form elements (in Tailwind spacing scale)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** @type {Props} */
|
|
12
|
+
let { children, class: className, gap = 2 } = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class={formLayoutVariants({ class: className, gap })}>
|
|
16
|
+
{@render children?.()}
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default FormLayout;
|
|
2
|
+
type FormLayout = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const FormLayout: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes to apply to the component
|
|
13
|
+
*/
|
|
14
|
+
class?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Gap between form elements (in Tailwind spacing scale)
|
|
17
|
+
*/
|
|
18
|
+
gap?: 0 | 1 | 2 | 3 | 4 | 6 | 8;
|
|
19
|
+
}, {}, "">;
|
|
20
|
+
type Props = {
|
|
21
|
+
/**
|
|
22
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
23
|
+
*/
|
|
24
|
+
children?: import("svelte").Snippet;
|
|
25
|
+
/**
|
|
26
|
+
* Additional CSS classes to apply to the component
|
|
27
|
+
*/
|
|
28
|
+
class?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Gap between form elements (in Tailwind spacing scale)
|
|
31
|
+
*/
|
|
32
|
+
gap?: 0 | 1 | 2 | 3 | 4 | 6 | 8;
|
|
33
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const formLayoutVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
gap: {
|
|
3
|
+
0: string;
|
|
4
|
+
1: string;
|
|
5
|
+
2: string;
|
|
6
|
+
3: string;
|
|
7
|
+
4: string;
|
|
8
|
+
6: string;
|
|
9
|
+
8: string;
|
|
10
|
+
};
|
|
11
|
+
}, undefined, "grid gap-2 [&>[data-form-actions]]:mt-4", {
|
|
12
|
+
gap: {
|
|
13
|
+
0: string;
|
|
14
|
+
1: string;
|
|
15
|
+
2: string;
|
|
16
|
+
3: string;
|
|
17
|
+
4: string;
|
|
18
|
+
6: string;
|
|
19
|
+
8: string;
|
|
20
|
+
};
|
|
21
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
22
|
+
gap: {
|
|
23
|
+
0: string;
|
|
24
|
+
1: string;
|
|
25
|
+
2: string;
|
|
26
|
+
3: string;
|
|
27
|
+
4: string;
|
|
28
|
+
6: string;
|
|
29
|
+
8: string;
|
|
30
|
+
};
|
|
31
|
+
}, undefined, "grid gap-2 [&>[data-form-actions]]:mt-4", unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
|
|
3
|
+
const formLayoutVariants = tv({
|
|
4
|
+
base: "grid gap-2 [&>[data-form-actions]]:mt-4",
|
|
5
|
+
variants: {
|
|
6
|
+
gap: {
|
|
7
|
+
0: "gap-0",
|
|
8
|
+
1: "gap-1",
|
|
9
|
+
2: "gap-2",
|
|
10
|
+
3: "gap-3",
|
|
11
|
+
4: "gap-4",
|
|
12
|
+
6: "gap-6",
|
|
13
|
+
8: "gap-8",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { formLayoutVariants };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Dialog } from "bits-ui";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} Props
|
|
6
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
7
|
+
* @property {(open: boolean) => void} [onOpenChange] Callback fired when the open state of the dialog changes
|
|
8
|
+
* @property {boolean} [open=false] Wether this dialog is open or not, bound to the component
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** @type {Props} */
|
|
12
|
+
let { children, onOpenChange, open = $bindable(false), ...rest } = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Dialog.Root bind:open {onOpenChange} {...rest}>
|
|
16
|
+
{@render children?.()}
|
|
17
|
+
</Dialog.Root>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default Dialog;
|
|
2
|
+
type Dialog = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Dialog: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* Callback fired when the open state of the dialog changes
|
|
13
|
+
*/
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Wether this dialog is open or not, bound to the component
|
|
17
|
+
*/
|
|
18
|
+
open?: boolean;
|
|
19
|
+
}, {}, "open">;
|
|
20
|
+
import { Dialog } from "bits-ui";
|
|
21
|
+
type Props = {
|
|
22
|
+
/**
|
|
23
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
24
|
+
*/
|
|
25
|
+
children?: import("svelte").Snippet;
|
|
26
|
+
/**
|
|
27
|
+
* Callback fired when the open state of the dialog changes
|
|
28
|
+
*/
|
|
29
|
+
onOpenChange?: (open: boolean) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Wether this dialog is open or not, bound to the component
|
|
32
|
+
*/
|
|
33
|
+
open?: boolean;
|
|
34
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Dialog } from "bits-ui";
|
|
3
|
+
import { Button } from "../../../index.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines the semantic role of the button within a dialog.
|
|
7
|
+
*
|
|
8
|
+
* - "cta": The primary call-to-action. Represents the main decision the dialog is asking for.
|
|
9
|
+
* This can be constructive (e.g. "Save") or destructive (e.g. "Delete").
|
|
10
|
+
* There should be only one CTA per dialog.
|
|
11
|
+
*
|
|
12
|
+
* - "secondary": An alternative but relevant option besides the main action.
|
|
13
|
+
* Example: "Don't save" in a save confirmation dialog.
|
|
14
|
+
* Use only when the dialog provides more than two choices.
|
|
15
|
+
*
|
|
16
|
+
* - "dismiss": A cancel/close action that simply exits the dialog without
|
|
17
|
+
* committing to any of the main or secondary actions. Typically labeled
|
|
18
|
+
* "Cancel" or "Close". Should always be visually de-emphasized.
|
|
19
|
+
*
|
|
20
|
+
* Default: "cta"
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {Object} Props
|
|
25
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
26
|
+
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
27
|
+
* @property {"cta" | "secondary" | "dismiss"} [role="cta"] Semantic role of the button within a dialog
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** @type {Props} */
|
|
31
|
+
let {
|
|
32
|
+
children,
|
|
33
|
+
class: className = "",
|
|
34
|
+
color = "secondary",
|
|
35
|
+
role = "cta",
|
|
36
|
+
...rest
|
|
37
|
+
} = $props();
|
|
38
|
+
|
|
39
|
+
let buttonProps = $derived.by(
|
|
40
|
+
() =>
|
|
41
|
+
({
|
|
42
|
+
cta: {
|
|
43
|
+
color,
|
|
44
|
+
tabIndex: 3,
|
|
45
|
+
variant: "filled",
|
|
46
|
+
},
|
|
47
|
+
secondary: {
|
|
48
|
+
tabIndex: 2,
|
|
49
|
+
variant: "outlined",
|
|
50
|
+
},
|
|
51
|
+
dismiss: {
|
|
52
|
+
tabIndex: 1,
|
|
53
|
+
variant: "text",
|
|
54
|
+
},
|
|
55
|
+
})[role] || {
|
|
56
|
+
variant: "filled",
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<Dialog.Close
|
|
62
|
+
class={className}
|
|
63
|
+
color="secondary"
|
|
64
|
+
data-role={role}
|
|
65
|
+
size="large"
|
|
66
|
+
{...rest}>
|
|
67
|
+
{#snippet child({ props })}
|
|
68
|
+
<Button {...props} {...buttonProps}>
|
|
69
|
+
{@render children?.()}
|
|
70
|
+
</Button>
|
|
71
|
+
{/snippet}
|
|
72
|
+
</Dialog.Close>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default DialogAction;
|
|
2
|
+
type DialogAction = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const DialogAction: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes to apply to the component
|
|
13
|
+
*/
|
|
14
|
+
class?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Semantic role of the button within a dialog
|
|
17
|
+
*/
|
|
18
|
+
role?: "cta" | "secondary" | "dismiss";
|
|
19
|
+
}, {}, "">;
|
|
20
|
+
type Props = {
|
|
21
|
+
/**
|
|
22
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
23
|
+
*/
|
|
24
|
+
children?: import("svelte").Snippet;
|
|
25
|
+
/**
|
|
26
|
+
* Additional CSS classes to apply to the component
|
|
27
|
+
*/
|
|
28
|
+
class?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Semantic role of the button within a dialog
|
|
31
|
+
*/
|
|
32
|
+
role?: "cta" | "secondary" | "dismiss";
|
|
33
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { FormActions } from "../../../index.js";
|
|
3
|
+
import { dialogVariants } from "./dialog.variants.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} Props
|
|
7
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
8
|
+
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** @type {Props} */
|
|
12
|
+
let { children, class: className = "" } = $props();
|
|
13
|
+
|
|
14
|
+
let styles = $derived(dialogVariants());
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<FormActions class={styles.formActions({ class: className })} customLayout>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</FormActions>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default DialogActions;
|
|
2
|
+
type DialogActions = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const DialogActions: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes to apply to the component
|
|
13
|
+
*/
|
|
14
|
+
class?: string;
|
|
15
|
+
}, {}, "">;
|
|
16
|
+
type Props = {
|
|
17
|
+
/**
|
|
18
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
19
|
+
*/
|
|
20
|
+
children?: import("svelte").Snippet;
|
|
21
|
+
/**
|
|
22
|
+
* Additional CSS classes to apply to the component
|
|
23
|
+
*/
|
|
24
|
+
class?: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { dialogVariants } from "./dialog.variants.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} Props
|
|
6
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
7
|
+
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @type {Props} */
|
|
11
|
+
let { children, class: className = "", ...rest } = $props();
|
|
12
|
+
|
|
13
|
+
let styles = $derived(dialogVariants());
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div class={styles.body({ class: className })} {...rest}>
|
|
17
|
+
{@render children?.()}
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default DialogBody;
|
|
2
|
+
type DialogBody = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const DialogBody: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes to apply to the component
|
|
13
|
+
*/
|
|
14
|
+
class?: string;
|
|
15
|
+
}, {}, "">;
|
|
16
|
+
type Props = {
|
|
17
|
+
/**
|
|
18
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
19
|
+
*/
|
|
20
|
+
children?: import("svelte").Snippet;
|
|
21
|
+
/**
|
|
22
|
+
* Additional CSS classes to apply to the component
|
|
23
|
+
*/
|
|
24
|
+
class?: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { dialogVariants } from "./dialog.variants.js";
|
|
3
|
+
import { Dialog } from "bits-ui";
|
|
4
|
+
import { fade, scale } from "svelte/transition";
|
|
5
|
+
import { quintOut } from "svelte/easing";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} Props
|
|
9
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
10
|
+
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
11
|
+
* @property {boolean} [closeOnEscape=false] Whether the dialog should close when the Escape key is pressed
|
|
12
|
+
* @property {boolean} [closeOnOutsideClick=false] Whether the dialog should close when clicking outside of it
|
|
13
|
+
* @property {string} [overlayClass=""] Additional CSS classes to apply to the overlay
|
|
14
|
+
* @property {"sm" | "md" | "lg"} [size="sm"] The maximum size of the dialog content.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** @type {Props} */
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
class: className = "",
|
|
21
|
+
closeOnEscape = false,
|
|
22
|
+
closeOnOutsideClick = false,
|
|
23
|
+
overlayClass = "",
|
|
24
|
+
size = "sm",
|
|
25
|
+
...rest
|
|
26
|
+
} = $props();
|
|
27
|
+
|
|
28
|
+
let styles = $derived(dialogVariants({ size }));
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Dialog.Portal>
|
|
32
|
+
<Dialog.Overlay class={styles.overlay({ class: overlayClass })}>
|
|
33
|
+
{#snippet child({ props, open })}
|
|
34
|
+
{#if open}
|
|
35
|
+
<div {...props} in:fade={{ duration: 150 }}></div>
|
|
36
|
+
{/if}
|
|
37
|
+
{/snippet}
|
|
38
|
+
</Dialog.Overlay>
|
|
39
|
+
<Dialog.Content
|
|
40
|
+
class={styles.container({ class: className })}
|
|
41
|
+
escapeKeydownBehavior={closeOnEscape ? "close" : "ignore"}
|
|
42
|
+
forceMount
|
|
43
|
+
interactOutsideBehavior={closeOnOutsideClick ? "close" : "ignore"}
|
|
44
|
+
{...rest}>
|
|
45
|
+
{#snippet child({ props, open })}
|
|
46
|
+
{#if open}
|
|
47
|
+
<div class={styles.positioner()}>
|
|
48
|
+
<section
|
|
49
|
+
{...props}
|
|
50
|
+
in:scale={{ duration: 300, easing: quintOut, start: 0.75 }}>
|
|
51
|
+
{@render children?.()}
|
|
52
|
+
</section>
|
|
53
|
+
</div>
|
|
54
|
+
{/if}
|
|
55
|
+
{/snippet}
|
|
56
|
+
</Dialog.Content>
|
|
57
|
+
</Dialog.Portal>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export default DialogContent;
|
|
2
|
+
type DialogContent = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const DialogContent: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes to apply to the component
|
|
13
|
+
*/
|
|
14
|
+
class?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the dialog should close when the Escape key is pressed
|
|
17
|
+
*/
|
|
18
|
+
closeOnEscape?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the dialog should close when clicking outside of it
|
|
21
|
+
*/
|
|
22
|
+
closeOnOutsideClick?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Additional CSS classes to apply to the overlay
|
|
25
|
+
*/
|
|
26
|
+
overlayClass?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The maximum size of the dialog content.
|
|
29
|
+
*/
|
|
30
|
+
size?: "sm" | "md" | "lg";
|
|
31
|
+
}, {}, "">;
|
|
32
|
+
type Props = {
|
|
33
|
+
/**
|
|
34
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
35
|
+
*/
|
|
36
|
+
children?: import("svelte").Snippet;
|
|
37
|
+
/**
|
|
38
|
+
* Additional CSS classes to apply to the component
|
|
39
|
+
*/
|
|
40
|
+
class?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the dialog should close when the Escape key is pressed
|
|
43
|
+
*/
|
|
44
|
+
closeOnEscape?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the dialog should close when clicking outside of it
|
|
47
|
+
*/
|
|
48
|
+
closeOnOutsideClick?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Additional CSS classes to apply to the overlay
|
|
51
|
+
*/
|
|
52
|
+
overlayClass?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The maximum size of the dialog content.
|
|
55
|
+
*/
|
|
56
|
+
size?: "sm" | "md" | "lg";
|
|
57
|
+
};
|