@websline/system-components 0.0.3 → 0.0.5

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.
Files changed (84) hide show
  1. package/dist/components/atoms/actions/closeButton/CloseButton.svelte +8 -5
  2. package/dist/components/atoms/actions/closeButton/CloseButton.svelte.d.ts +2 -2
  3. package/dist/components/atoms/feedback/progressBar/ProgressBar.svelte +47 -0
  4. package/dist/components/atoms/feedback/progressBar/ProgressBar.svelte.d.ts +41 -0
  5. package/dist/components/atoms/feedback/progressBar/progressBar.variants.d.ts +29 -0
  6. package/dist/components/atoms/feedback/progressBar/progressBar.variants.js +11 -0
  7. package/dist/components/molecules/formActions/formActions.svelte +25 -0
  8. package/dist/components/molecules/formActions/formActions.svelte.d.ts +41 -0
  9. package/dist/components/molecules/formActions/formActions.variants.d.ts +22 -0
  10. package/dist/components/molecules/formActions/formActions.variants.js +16 -0
  11. package/dist/components/{atoms/form → molecules}/formField/FormField.svelte +2 -2
  12. package/dist/components/{atoms/form → molecules}/formField/FormField.svelte.d.ts +2 -2
  13. package/dist/components/molecules/formLayout/FormLayout.svelte +17 -0
  14. package/dist/components/molecules/formLayout/FormLayout.svelte.d.ts +33 -0
  15. package/dist/components/molecules/formLayout/formLayout.variants.d.ts +31 -0
  16. package/dist/components/molecules/formLayout/formLayout.variants.js +18 -0
  17. package/dist/components/organisms/dialog/Dialog.svelte +17 -0
  18. package/dist/components/organisms/dialog/Dialog.svelte.d.ts +34 -0
  19. package/dist/components/organisms/dialog/DialogAction.svelte +72 -0
  20. package/dist/components/organisms/dialog/DialogAction.svelte.d.ts +33 -0
  21. package/dist/components/organisms/dialog/DialogActions.svelte +19 -0
  22. package/dist/components/organisms/dialog/DialogActions.svelte.d.ts +25 -0
  23. package/dist/components/organisms/dialog/DialogBody.svelte +18 -0
  24. package/dist/components/organisms/dialog/DialogBody.svelte.d.ts +25 -0
  25. package/dist/components/organisms/dialog/DialogContent.svelte +57 -0
  26. package/dist/components/organisms/dialog/DialogContent.svelte.d.ts +57 -0
  27. package/dist/components/organisms/dialog/DialogTrigger.svelte +14 -0
  28. package/dist/components/organisms/dialog/DialogTrigger.svelte.d.ts +17 -0
  29. package/dist/components/organisms/dialog/dialog.variants.d.ts +85 -0
  30. package/dist/components/organisms/dialog/dialog.variants.js +30 -0
  31. package/dist/components/organisms/dialog/index.d.ts +7 -0
  32. package/dist/components/organisms/dialog/index.js +8 -0
  33. package/dist/components/organisms/modal/Modal.svelte +17 -0
  34. package/dist/components/organisms/modal/Modal.svelte.d.ts +33 -0
  35. package/dist/components/organisms/modal/ModalBody.svelte +19 -0
  36. package/dist/components/organisms/modal/ModalBody.svelte.d.ts +33 -0
  37. package/dist/components/organisms/modal/ModalContent.svelte +70 -0
  38. package/dist/components/organisms/modal/ModalContent.svelte.d.ts +57 -0
  39. package/dist/components/organisms/modal/ModalHeader.svelte +28 -0
  40. package/dist/components/organisms/modal/ModalHeader.svelte.d.ts +33 -0
  41. package/dist/components/organisms/modal/ModalTrigger.svelte +14 -0
  42. package/dist/components/organisms/modal/ModalTrigger.svelte.d.ts +17 -0
  43. package/dist/components/organisms/modal/index.d.ts +6 -0
  44. package/dist/components/organisms/modal/index.js +7 -0
  45. package/dist/components/organisms/modal/modal.variants.d.ts +112 -0
  46. package/dist/components/organisms/modal/modal.variants.js +30 -0
  47. package/dist/components/organisms/popover/popover.variants.js +1 -1
  48. package/dist/index.d.ts +13 -8
  49. package/dist/index.js +13 -8
  50. package/dist/utils/a11y.d.ts +1 -0
  51. package/dist/utils/a11y.js +5 -0
  52. package/dist/utils/index.d.ts +1 -0
  53. package/dist/utils/index.js +1 -0
  54. package/package.json +34 -34
  55. /package/dist/components/atoms/{form/helperText → helperText}/HelperText.svelte +0 -0
  56. /package/dist/components/atoms/{form/helperText → helperText}/HelperText.svelte.d.ts +0 -0
  57. /package/dist/components/atoms/{form/helperText → helperText}/helperText.variants.d.ts +0 -0
  58. /package/dist/components/atoms/{form/helperText → helperText}/helperText.variants.js +0 -0
  59. /package/dist/components/atoms/{form/input → input}/Input.svelte +0 -0
  60. /package/dist/components/atoms/{form/input → input}/Input.svelte.d.ts +0 -0
  61. /package/dist/components/atoms/{form/input → input}/input.variants.d.ts +0 -0
  62. /package/dist/components/atoms/{form/input → input}/input.variants.js +0 -0
  63. /package/dist/components/atoms/{form/label → label}/Label.svelte +0 -0
  64. /package/dist/components/atoms/{form/label → label}/Label.svelte.d.ts +0 -0
  65. /package/dist/components/atoms/{form/label → label}/label.variants.d.ts +0 -0
  66. /package/dist/components/atoms/{form/label → label}/label.variants.js +0 -0
  67. /package/dist/components/atoms/{form/radio → radio}/Radio.svelte +0 -0
  68. /package/dist/components/atoms/{form/radio → radio}/Radio.svelte.d.ts +0 -0
  69. /package/dist/components/atoms/{form/radio → radio}/radio.variants.d.ts +0 -0
  70. /package/dist/components/atoms/{form/radio → radio}/radio.variants.js +0 -0
  71. /package/dist/components/atoms/{form/select → select}/Select.svelte +0 -0
  72. /package/dist/components/atoms/{form/select → select}/Select.svelte.d.ts +0 -0
  73. /package/dist/components/atoms/{form/select → select}/select.variants.d.ts +0 -0
  74. /package/dist/components/atoms/{form/select → select}/select.variants.js +0 -0
  75. /package/dist/components/atoms/{form/switch → switch}/Switch.svelte +0 -0
  76. /package/dist/components/atoms/{form/switch → switch}/Switch.svelte.d.ts +0 -0
  77. /package/dist/components/atoms/{form/switch → switch}/switch.variants.d.ts +0 -0
  78. /package/dist/components/atoms/{form/switch → switch}/switch.variants.js +0 -0
  79. /package/dist/components/atoms/{form/textarea → textarea}/Textarea.svelte +0 -0
  80. /package/dist/components/atoms/{form/textarea → textarea}/Textarea.svelte.d.ts +0 -0
  81. /package/dist/components/atoms/{form/textarea → textarea}/textarea.variants.d.ts +0 -0
  82. /package/dist/components/atoms/{form/textarea → textarea}/textarea.variants.js +0 -0
  83. /package/dist/components/{atoms/form → molecules}/formField/formField.variants.d.ts +0 -0
  84. /package/dist/components/{atoms/form → molecules}/formField/formField.variants.js +0 -0
@@ -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
+ };
@@ -0,0 +1,14 @@
1
+ <script>
2
+ import { Dialog } from "bits-ui";
3
+ import { dialogVariants } from "./dialog.variants.js";
4
+
5
+ /**
6
+ * @typedef {Object} Props
7
+ * @property {string} [class=""] Additional CSS classes to apply to the component
8
+ */
9
+
10
+ /** @type {Props} */
11
+ let { class: className = "", ...rest } = $props();
12
+ </script>
13
+
14
+ <Dialog.Trigger class={dialogVariants().trigger({ class: className })} {...rest} />
@@ -0,0 +1,17 @@
1
+ export default DialogTrigger;
2
+ type DialogTrigger = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const DialogTrigger: import("svelte").Component<{
7
+ /**
8
+ * Additional CSS classes to apply to the component
9
+ */
10
+ class?: string;
11
+ }, {}, "">;
12
+ type Props = {
13
+ /**
14
+ * Additional CSS classes to apply to the component
15
+ */
16
+ class?: string;
17
+ };
@@ -0,0 +1,85 @@
1
+ export const dialogVariants: import("tailwind-variants").TVReturnType<{
2
+ size: {
3
+ sm: {
4
+ container: string;
5
+ };
6
+ md: {
7
+ container: string;
8
+ };
9
+ lg: {
10
+ container: string;
11
+ };
12
+ xl: {
13
+ container: string;
14
+ };
15
+ "2xl": {
16
+ container: string;
17
+ };
18
+ full: {
19
+ container: string;
20
+ };
21
+ };
22
+ }, {
23
+ body: string;
24
+ container: string;
25
+ overlay: string;
26
+ positioner: string;
27
+ trigger: string;
28
+ formActions: string;
29
+ }, undefined, {
30
+ size: {
31
+ sm: {
32
+ container: string;
33
+ };
34
+ md: {
35
+ container: string;
36
+ };
37
+ lg: {
38
+ container: string;
39
+ };
40
+ xl: {
41
+ container: string;
42
+ };
43
+ "2xl": {
44
+ container: string;
45
+ };
46
+ full: {
47
+ container: string;
48
+ };
49
+ };
50
+ }, {
51
+ body: string;
52
+ container: string;
53
+ overlay: string;
54
+ positioner: string;
55
+ trigger: string;
56
+ formActions: string;
57
+ }, import("tailwind-variants").TVReturnType<{
58
+ size: {
59
+ sm: {
60
+ container: string;
61
+ };
62
+ md: {
63
+ container: string;
64
+ };
65
+ lg: {
66
+ container: string;
67
+ };
68
+ xl: {
69
+ container: string;
70
+ };
71
+ "2xl": {
72
+ container: string;
73
+ };
74
+ full: {
75
+ container: string;
76
+ };
77
+ };
78
+ }, {
79
+ body: string;
80
+ container: string;
81
+ overlay: string;
82
+ positioner: string;
83
+ trigger: string;
84
+ formActions: string;
85
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,30 @@
1
+ import { tv } from "tailwind-variants";
2
+
3
+ const dialogVariants = tv({
4
+ slots: {
5
+ body: "relative h-full overflow-auto",
6
+ container:
7
+ "my-4 grid max-h-[calc(100vh-32px)] w-[calc(100vw-32px)] min-w-xs grid-rows-[1fr_auto] gap-4 overflow-hidden rounded-lg bg-white px-4 py-3 leading-[1.486] shadow-sm dark:bg-neutral-800 dark:text-neutral-200",
8
+ overlay: "fixed inset-0 bg-black/25",
9
+ positioner:
10
+ "fixed inset-0 z-1 grid items-center justify-items-center overflow-auto",
11
+ trigger: "cursor-pointer",
12
+ formActions: `
13
+ [&>[data-role=dismiss]]:order-1 [&>[data-role=dismiss]]:mr-auto
14
+ [&>[data-role=secondary]]:order-2
15
+ [&>[data-role=cta]]:order-3
16
+ `,
17
+ },
18
+ variants: {
19
+ size: {
20
+ sm: { container: "max-w-[480px]" },
21
+ md: { container: "max-w-[640px]" },
22
+ lg: { container: "max-w-[960px]" },
23
+ xl: { container: "max-w-[1280px]" },
24
+ "2xl": { container: "max-w-[1920px]" },
25
+ full: { container: "max-w-none" },
26
+ },
27
+ },
28
+ });
29
+
30
+ export { dialogVariants };
@@ -0,0 +1,7 @@
1
+ import Root from "./Dialog.svelte";
2
+ import Body from "./DialogBody.svelte";
3
+ import Content from "./DialogContent.svelte";
4
+ import Actions from "./DialogActions.svelte";
5
+ import Action from "./DialogAction.svelte";
6
+ import Trigger from "./DialogTrigger.svelte";
7
+ export { Root, Body, Content, Actions, Action, Trigger };
@@ -0,0 +1,8 @@
1
+ import Root from "./Dialog.svelte";
2
+ import Body from "./DialogBody.svelte";
3
+ import Content from "./DialogContent.svelte";
4
+ import Actions from "./DialogActions.svelte";
5
+ import Action from "./DialogAction.svelte";
6
+ import Trigger from "./DialogTrigger.svelte";
7
+
8
+ export { Root, Body, Content, Actions, Action, Trigger };
@@ -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 modal changes
8
+ * @property {boolean} [open=false] Wether this modal 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,33 @@
1
+ export default Modal;
2
+ type Modal = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const Modal: 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 modal changes
13
+ */
14
+ onOpenChange?: (open: boolean) => void;
15
+ /**
16
+ * Wether this modal is open or not, bound to the component
17
+ */
18
+ open?: boolean;
19
+ }, {}, "open">;
20
+ type Props = {
21
+ /**
22
+ * Children content – can be text, HTML, or other Svelte components
23
+ */
24
+ children?: import("svelte").Snippet;
25
+ /**
26
+ * Callback fired when the open state of the modal changes
27
+ */
28
+ onOpenChange?: (open: boolean) => void;
29
+ /**
30
+ * Wether this modal is open or not, bound to the component
31
+ */
32
+ open?: boolean;
33
+ };
@@ -0,0 +1,19 @@
1
+ <script>
2
+ import { modalVariants } from "./modal.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} [noPadding=false] If true, removes the default padding from the modal body
9
+ */
10
+
11
+ /** @type {Props} */
12
+ let { children, class: className = "", noPadding = false, ...rest } = $props();
13
+
14
+ let styles = $derived(modalVariants());
15
+ </script>
16
+
17
+ <div class={styles.body({ class: className, noPadding })} {...rest}>
18
+ {@render children?.()}
19
+ </div>
@@ -0,0 +1,33 @@
1
+ export default ModalBody;
2
+ type ModalBody = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const ModalBody: 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, removes the default padding from the modal body
17
+ */
18
+ noPadding?: boolean;
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
+ * If true, removes the default padding from the modal body
31
+ */
32
+ noPadding?: boolean;
33
+ };
@@ -0,0 +1,70 @@
1
+ <script>
2
+ import { modalVariants } from "./modal.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=true] Whether the modal should close when the Escape key is pressed
12
+ * @property {boolean} [closeOnOutsideClick=true] Whether the modal should close when clicking outside of it
13
+ * @property {string} [overlayClass=""] Additional CSS classes to apply to the overlay
14
+ * @property {"sm" | "md" | "lg" | "xl" | "2xl" | "full"} [size="md"] The maximum size of the modal content.
15
+ */
16
+
17
+ /** @type {Props} */
18
+ let {
19
+ children,
20
+ class: className = "",
21
+ closeOnEscape = true,
22
+ closeOnOutsideClick = true,
23
+ overlayClass = "",
24
+ size = "md",
25
+ ...rest
26
+ } = $props();
27
+
28
+ let styles = $derived(modalVariants({ size }));
29
+ let ref = $state(null);
30
+
31
+ const handleAutoFocus = (e) => {
32
+ e.preventDefault();
33
+
34
+ // Focus the content element when the modal opens
35
+ const first = ref?.querySelector(
36
+ "input, select, textarea, button:not([data-dialog-close])",
37
+ );
38
+
39
+ if (first) first.focus();
40
+ };
41
+ </script>
42
+
43
+ <Dialog.Portal>
44
+ <Dialog.Overlay class={styles.overlay({ class: overlayClass })}>
45
+ {#snippet child({ props, open })}
46
+ {#if open}
47
+ <div {...props} in:fade={{ duration: 150 }}></div>
48
+ {/if}
49
+ {/snippet}
50
+ </Dialog.Overlay>
51
+ <Dialog.Content
52
+ class={styles.container({ class: className })}
53
+ escapeKeydownBehavior={closeOnEscape ? "close" : "ignore"}
54
+ forceMount
55
+ interactOutsideBehavior={closeOnOutsideClick ? "close" : "ignore"}
56
+ onOpenAutoFocus={handleAutoFocus}
57
+ {...rest}>
58
+ {#snippet child({ props, open })}
59
+ {#if open}
60
+ <div class={styles.positioner()} bind:this={ref}>
61
+ <section
62
+ {...props}
63
+ in:scale={{ duration: 300, easing: quintOut, start: 0.75 }}>
64
+ {@render children?.()}
65
+ </section>
66
+ </div>
67
+ {/if}
68
+ {/snippet}
69
+ </Dialog.Content>
70
+ </Dialog.Portal>
@@ -0,0 +1,57 @@
1
+ export default ModalContent;
2
+ type ModalContent = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const ModalContent: 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 modal should close when the Escape key is pressed
17
+ */
18
+ closeOnEscape?: boolean;
19
+ /**
20
+ * Whether the modal 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 modal content.
29
+ */
30
+ size?: "sm" | "md" | "lg" | "xl" | "2xl" | "full";
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 modal should close when the Escape key is pressed
43
+ */
44
+ closeOnEscape?: boolean;
45
+ /**
46
+ * Whether the modal 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 modal content.
55
+ */
56
+ size?: "sm" | "md" | "lg" | "xl" | "2xl" | "full";
57
+ };
@@ -0,0 +1,28 @@
1
+ <script>
2
+ import { Dialog } from "bits-ui";
3
+ import { CloseButton } from "../../../index.js";
4
+ import { modalVariants } from "./modal.variants.js";
5
+
6
+ /**
7
+ * @typedef {Object} Props
8
+ * @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
9
+ * @property {string} [class=""] Additional CSS classes to apply to the component
10
+ * @property {boolean} [showClose=false] Whether to show a close icon in the header
11
+ */
12
+
13
+ /** @type {Props} */
14
+ let { children, class: className = "", showClose = true, ...rest } = $props();
15
+
16
+ let styles = $derived(modalVariants());
17
+ </script>
18
+
19
+ <header class={styles.header({ class: className })} {...rest}>
20
+ {@render children?.()}
21
+ {#if showClose}
22
+ <Dialog.Close class={styles.close()}>
23
+ {#snippet child({ props })}
24
+ <CloseButton {...props} />
25
+ {/snippet}
26
+ </Dialog.Close>
27
+ {/if}
28
+ </header>
@@ -0,0 +1,33 @@
1
+ export default ModalHeader;
2
+ type ModalHeader = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const ModalHeader: 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 to show a close icon in the header
17
+ */
18
+ showClose?: boolean;
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
+ * Whether to show a close icon in the header
31
+ */
32
+ showClose?: boolean;
33
+ };
@@ -0,0 +1,14 @@
1
+ <script>
2
+ import { Dialog } from "bits-ui";
3
+ import { modalVariants } from "./modal.variants.js";
4
+
5
+ /**
6
+ * @typedef {Object} Props
7
+ * @property {string} [class=""] Additional CSS classes to apply to the component
8
+ */
9
+
10
+ /** @type {Props} */
11
+ let { class: className = "", ...rest } = $props();
12
+ </script>
13
+
14
+ <Dialog.Trigger class={modalVariants().trigger({ class: className })} {...rest} />
@@ -0,0 +1,17 @@
1
+ export default ModalTrigger;
2
+ type ModalTrigger = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const ModalTrigger: import("svelte").Component<{
7
+ /**
8
+ * Additional CSS classes to apply to the component
9
+ */
10
+ class?: string;
11
+ }, {}, "">;
12
+ type Props = {
13
+ /**
14
+ * Additional CSS classes to apply to the component
15
+ */
16
+ class?: string;
17
+ };
@@ -0,0 +1,6 @@
1
+ import Root from "./Modal.svelte";
2
+ import Body from "./ModalBody.svelte";
3
+ import Header from "./ModalHeader.svelte";
4
+ import Content from "./ModalContent.svelte";
5
+ import Trigger from "./ModalTrigger.svelte";
6
+ export { Root, Body, Header, Content, Trigger };
@@ -0,0 +1,7 @@
1
+ import Root from "./Modal.svelte";
2
+ import Body from "./ModalBody.svelte";
3
+ import Header from "./ModalHeader.svelte";
4
+ import Content from "./ModalContent.svelte";
5
+ import Trigger from "./ModalTrigger.svelte";
6
+
7
+ export { Root, Body, Header, Content, Trigger };