@websline/system-components 0.0.2 → 0.0.4
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/{form → actions}/button/Button.svelte +33 -11
- package/dist/components/atoms/{form → actions}/button/Button.svelte.d.ts +28 -4
- package/dist/components/atoms/actions/button/button.variants.d.ts +151 -0
- package/dist/components/atoms/actions/button/button.variants.js +143 -0
- package/dist/components/atoms/{closeButton → actions/closeButton}/CloseButton.svelte +8 -7
- package/dist/components/atoms/actions/closeButton/CloseButton.svelte.d.ts +49 -0
- package/dist/components/atoms/avatar/Avatar.svelte +4 -4
- package/dist/components/atoms/badge/Badge.svelte +44 -0
- package/dist/components/atoms/badge/Badge.svelte.d.ts +65 -0
- package/dist/components/atoms/badge/badge.variants.d.ts +85 -0
- package/dist/components/atoms/badge/badge.variants.js +59 -0
- package/dist/components/atoms/chip/Chip.svelte +52 -0
- package/dist/components/atoms/chip/Chip.svelte.d.ts +81 -0
- package/dist/components/atoms/chip/chip.variants.d.ts +61 -0
- package/dist/components/atoms/chip/chip.variants.js +118 -0
- package/dist/components/atoms/colorChip/ColorChip.svelte +33 -0
- package/dist/components/atoms/colorChip/ColorChip.svelte.d.ts +57 -0
- package/dist/components/atoms/colorChip/colorChip.variants.d.ts +40 -0
- package/dist/components/atoms/colorChip/colorChip.variants.js +27 -0
- package/dist/components/atoms/{loading → feedback}/spinner/Spinner.svelte +2 -16
- package/dist/components/atoms/feedback/spinner/spinner.variants.d.ts +19 -0
- package/dist/components/atoms/feedback/spinner/spinner.variants.js +17 -0
- package/dist/components/atoms/form/formField/FormField.svelte +2 -10
- package/dist/components/atoms/form/formField/FormField.svelte.d.ts +8 -0
- package/dist/components/atoms/form/formField/formField.variants.d.ts +13 -0
- package/dist/components/atoms/form/formField/formField.variants.js +12 -0
- package/dist/components/atoms/form/helperText/HelperText.svelte +9 -10
- package/dist/components/atoms/form/helperText/HelperText.svelte.d.ts +22 -4
- package/dist/components/atoms/form/helperText/helperText.variants.d.ts +13 -0
- package/dist/components/atoms/form/helperText/helperText.variants.js +12 -0
- package/dist/components/atoms/form/label/Label.svelte +6 -14
- package/dist/components/atoms/form/label/Label.svelte.d.ts +8 -0
- package/dist/components/atoms/form/label/label.variants.d.ts +22 -0
- package/dist/components/atoms/form/label/label.variants.js +15 -0
- package/dist/components/atoms/form/radio/Radio.svelte +58 -0
- package/dist/components/atoms/form/radio/Radio.svelte.d.ts +65 -0
- package/dist/components/atoms/form/radio/radio.variants.d.ts +22 -0
- package/dist/components/atoms/form/radio/radio.variants.js +15 -0
- package/dist/components/atoms/form/select/Select.svelte +91 -0
- package/dist/components/atoms/form/select/Select.svelte.d.ts +81 -0
- package/dist/components/atoms/form/select/select.variants.d.ts +58 -0
- package/dist/components/atoms/form/select/select.variants.js +66 -0
- package/dist/components/atoms/form/switch/Switch.svelte +57 -0
- package/dist/components/atoms/form/switch/Switch.svelte.d.ts +65 -0
- package/dist/components/atoms/form/switch/switch.variants.d.ts +22 -0
- package/dist/components/atoms/form/switch/switch.variants.js +15 -0
- package/dist/components/atoms/icon/Icon.svelte +8 -1
- package/dist/components/atoms/icon/components/Add.svelte +27 -0
- package/dist/components/atoms/icon/components/Add.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Check.svelte +27 -0
- package/dist/components/atoms/icon/components/Check.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/ChevronDown.svelte +27 -0
- package/dist/components/atoms/icon/components/ChevronDown.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/CloseSmall.svelte +27 -0
- package/dist/components/atoms/icon/components/CloseSmall.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Page.svelte +27 -0
- package/dist/components/atoms/icon/components/Page.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Redo.svelte +27 -0
- package/dist/components/atoms/icon/components/Redo.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/components/Undo.svelte +27 -0
- package/dist/components/atoms/icon/components/Undo.svelte.d.ts +41 -0
- package/dist/components/atoms/icon/index.d.ts +14 -0
- package/dist/components/atoms/icon/index.js +14 -0
- package/dist/components/molecules/navigationItem/NavigationItem.svelte +80 -0
- package/dist/components/molecules/navigationItem/NavigationItem.svelte.d.ts +81 -0
- package/dist/components/molecules/navigationItem/navigationItem.variants.d.ts +61 -0
- package/dist/components/molecules/navigationItem/navigationItem.variants.js +29 -0
- package/dist/components/molecules/notification/Notification.svelte +1 -1
- package/dist/components/molecules/pickers/colorSwatch/ColorSwatch.svelte +99 -0
- package/dist/components/molecules/pickers/colorSwatch/ColorSwatch.svelte.d.ts +57 -0
- package/dist/components/molecules/pickers/colorSwatch/ColorSwatchColor.svelte +13 -0
- package/dist/components/molecules/pickers/colorSwatch/ColorSwatchColor.svelte.d.ts +11 -0
- package/dist/components/molecules/pickers/colorSwatch/colorSwatch.variants.d.ts +49 -0
- package/dist/components/molecules/pickers/colorSwatch/colorSwatch.variants.js +46 -0
- package/dist/components/molecules/pickers/colorSwatch/index.d.ts +3 -0
- package/dist/components/molecules/pickers/colorSwatch/index.js +4 -0
- package/dist/components/molecules/richTextEditor/RichTextEditor.svelte +50 -21
- package/dist/components/molecules/richTextEditor/RichTextEditor.svelte.d.ts +56 -0
- package/dist/components/molecules/richTextEditor/richTextEditor.variants.js +25 -3
- package/dist/components/molecules/richTextEditor/toolbar/RichTextEditorToolbar.svelte +49 -0
- package/dist/components/molecules/richTextEditor/{RichTextEditorToolbar.svelte.d.ts → toolbar/RichTextEditorToolbar.svelte.d.ts} +2 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarBold.svelte +13 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarBold.svelte.d.ts +11 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarColor.svelte +27 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarColor.svelte.d.ts +15 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarItalic.svelte +13 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarItalic.svelte.d.ts +11 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarLink.svelte +34 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarLink.svelte.d.ts +13 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarList.svelte +13 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarList.svelte.d.ts +11 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarListOrdered.svelte +13 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarListOrdered.svelte.d.ts +11 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarRedo.svelte +13 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarRedo.svelte.d.ts +11 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarUnderline.svelte +13 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarUnderline.svelte.d.ts +11 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarUndo.svelte +13 -0
- package/dist/components/molecules/richTextEditor/toolbar/ToolbarUndo.svelte.d.ts +11 -0
- package/dist/components/molecules/selectorCard/SelectorCard.svelte +78 -0
- package/dist/components/molecules/selectorCard/SelectorCard.svelte.d.ts +105 -0
- package/dist/components/molecules/selectorCard/selectorCard.variants.d.ts +61 -0
- package/dist/components/molecules/selectorCard/selectorCard.variants.js +32 -0
- package/dist/components/molecules/toggleGroup/ToggleGroup.svelte +1 -0
- package/dist/components/molecules/toggleGroup/ToggleGroup.svelte.d.ts +8 -0
- package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte +1 -0
- package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte.d.ts +8 -0
- package/dist/components/organisms/notificationGroup/NotificationGroup.svelte +1 -1
- package/dist/components/organisms/popover/Popover.svelte +15 -0
- package/dist/components/organisms/popover/Popover.svelte.d.ts +18 -0
- package/dist/components/organisms/popover/PopoverContent.svelte +84 -0
- package/dist/components/organisms/popover/PopoverContent.svelte.d.ts +89 -0
- package/dist/components/organisms/popover/PopoverTrigger.svelte +14 -0
- package/dist/components/{atoms/closeButton/CloseButton.svelte.d.ts → organisms/popover/PopoverTrigger.svelte.d.ts} +3 -11
- package/dist/components/organisms/popover/index.d.ts +4 -0
- package/dist/components/organisms/popover/index.js +5 -0
- package/dist/components/organisms/popover/popover.variants.d.ts +39 -0
- package/dist/components/organisms/popover/popover.variants.js +15 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.js +14 -4
- package/dist/utils/colors.d.ts +9 -0
- package/dist/utils/colors.js +119 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/theme.svelte.d.ts +10 -0
- package/dist/utils/theme.svelte.js +31 -0
- package/package.json +38 -39
- package/dist/components/atoms/form/button/button.variants.d.ts +0 -58
- package/dist/components/atoms/form/button/button.variants.js +0 -82
- package/dist/components/molecules/richTextEditor/RichTextEditorToolbar.svelte +0 -5
- package/dist/components/atoms/{closeButton → actions/closeButton}/closeButton.variants.d.ts +0 -0
- package/dist/components/atoms/{closeButton → actions/closeButton}/closeButton.variants.js +0 -0
- package/dist/components/atoms/{form → actions}/iconButton/IconButton.svelte +0 -0
- package/dist/components/atoms/{form → actions}/iconButton/IconButton.svelte.d.ts +0 -0
- package/dist/components/atoms/{form → actions}/iconButton/iconButton.variants.d.ts +0 -0
- package/dist/components/atoms/{form → actions}/iconButton/iconButton.variants.js +0 -0
- package/dist/components/atoms/{loading → feedback}/spinner/Spinner.svelte.d.ts +6 -6
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export default SelectorCard;
|
|
2
|
+
type SelectorCard = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const SelectorCard: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Wether this card is checked or not, bound to the component
|
|
9
|
+
*/
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes to apply to the component
|
|
13
|
+
*/
|
|
14
|
+
class?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the card is disabled
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the form field has an error
|
|
21
|
+
*/
|
|
22
|
+
error?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The error text for the form field
|
|
25
|
+
*/
|
|
26
|
+
errorText?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The helper text for the card
|
|
29
|
+
*/
|
|
30
|
+
helperText?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The ID of the card element
|
|
33
|
+
*/
|
|
34
|
+
id?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Label to display in the card
|
|
37
|
+
*/
|
|
38
|
+
label?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The name of the card, used for form submission
|
|
41
|
+
*/
|
|
42
|
+
name?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the card is required
|
|
45
|
+
*/
|
|
46
|
+
required?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The type of card
|
|
49
|
+
*/
|
|
50
|
+
type?: "radio" | "switch";
|
|
51
|
+
/**
|
|
52
|
+
* The value of the card
|
|
53
|
+
*/
|
|
54
|
+
value?: string;
|
|
55
|
+
}, {}, "checked">;
|
|
56
|
+
type Props = {
|
|
57
|
+
/**
|
|
58
|
+
* Wether this card is checked or not, bound to the component
|
|
59
|
+
*/
|
|
60
|
+
checked?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Additional CSS classes to apply to the component
|
|
63
|
+
*/
|
|
64
|
+
class?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the card is disabled
|
|
67
|
+
*/
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the form field has an error
|
|
71
|
+
*/
|
|
72
|
+
error?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The error text for the form field
|
|
75
|
+
*/
|
|
76
|
+
errorText?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The helper text for the card
|
|
79
|
+
*/
|
|
80
|
+
helperText?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The ID of the card element
|
|
83
|
+
*/
|
|
84
|
+
id?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Label to display in the card
|
|
87
|
+
*/
|
|
88
|
+
label?: string;
|
|
89
|
+
/**
|
|
90
|
+
* The name of the card, used for form submission
|
|
91
|
+
*/
|
|
92
|
+
name?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Whether the card is required
|
|
95
|
+
*/
|
|
96
|
+
required?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* The type of card
|
|
99
|
+
*/
|
|
100
|
+
type?: "radio" | "switch";
|
|
101
|
+
/**
|
|
102
|
+
* The value of the card
|
|
103
|
+
*/
|
|
104
|
+
value?: string;
|
|
105
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const selectorCardVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
disabled: {
|
|
3
|
+
true: string;
|
|
4
|
+
false: string;
|
|
5
|
+
};
|
|
6
|
+
error: {
|
|
7
|
+
true: {
|
|
8
|
+
base: string;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type: {
|
|
13
|
+
switch: string;
|
|
14
|
+
};
|
|
15
|
+
}, {
|
|
16
|
+
base: string;
|
|
17
|
+
content: string;
|
|
18
|
+
helperText: string;
|
|
19
|
+
input: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}, undefined, {
|
|
22
|
+
disabled: {
|
|
23
|
+
true: string;
|
|
24
|
+
false: string;
|
|
25
|
+
};
|
|
26
|
+
error: {
|
|
27
|
+
true: {
|
|
28
|
+
base: string;
|
|
29
|
+
label: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
type: {
|
|
33
|
+
switch: string;
|
|
34
|
+
};
|
|
35
|
+
}, {
|
|
36
|
+
base: string;
|
|
37
|
+
content: string;
|
|
38
|
+
helperText: string;
|
|
39
|
+
input: string;
|
|
40
|
+
label: string;
|
|
41
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
42
|
+
disabled: {
|
|
43
|
+
true: string;
|
|
44
|
+
false: string;
|
|
45
|
+
};
|
|
46
|
+
error: {
|
|
47
|
+
true: {
|
|
48
|
+
base: string;
|
|
49
|
+
label: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
type: {
|
|
53
|
+
switch: string;
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
base: string;
|
|
57
|
+
content: string;
|
|
58
|
+
helperText: string;
|
|
59
|
+
input: string;
|
|
60
|
+
label: string;
|
|
61
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
|
|
3
|
+
const selectorCardVariants = tv({
|
|
4
|
+
slots: {
|
|
5
|
+
base: "flex cursor-pointer gap-3 rounded-sm border border-neutral-300 bg-white px-4 py-3 dark:border-neutral-700 dark:bg-neutral-800",
|
|
6
|
+
content: "flex grow flex-col items-start gap-1",
|
|
7
|
+
helperText: "body-small text-neutral-500",
|
|
8
|
+
input: "shrink-0",
|
|
9
|
+
label: "cursor-[inherit] heading-h6 text-neutral-900 dark:text-neutral-200",
|
|
10
|
+
},
|
|
11
|
+
variants: {
|
|
12
|
+
disabled: {
|
|
13
|
+
true: "cursor-not-allowed opacity-40 dark:opacity-60",
|
|
14
|
+
false:
|
|
15
|
+
"transition-[border,outline] duration-300 hover:border-blue-500 hover:outline-1 hover:outline-blue-500 dark:hover:border-blue-400 dark:hover:outline-blue-400",
|
|
16
|
+
},
|
|
17
|
+
error: {
|
|
18
|
+
true: {
|
|
19
|
+
base: "!border-red-500 outline-1 !outline-red-500",
|
|
20
|
+
label: "text-red-500 dark:text-red-500",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
type: {
|
|
24
|
+
switch: "items-center",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
compoundVariants: [
|
|
28
|
+
{ type: "radio", checked: true, class: "bg-neutral-100 dark:bg-neutral-700" },
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { selectorCardVariants };
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
/**
|
|
11
11
|
* @typedef {Object} Props
|
|
12
12
|
* @property {"default" | "raised"} [appearance="default"] The appearance variant of the component
|
|
13
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
13
14
|
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
14
15
|
* @property {"small" | "medium"} [size="medium"] The size variant of the component
|
|
15
16
|
* @property {string} [value=""] The value of the toggle group
|
|
@@ -8,6 +8,10 @@ declare const ToggleGroup: import("svelte").Component<{
|
|
|
8
8
|
* The appearance variant of the component
|
|
9
9
|
*/
|
|
10
10
|
appearance?: "default" | "raised";
|
|
11
|
+
/**
|
|
12
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
13
|
+
*/
|
|
14
|
+
children?: import("svelte").Snippet;
|
|
11
15
|
/**
|
|
12
16
|
* Additional CSS classes to apply to the component
|
|
13
17
|
*/
|
|
@@ -30,6 +34,10 @@ type Props = {
|
|
|
30
34
|
* The appearance variant of the component
|
|
31
35
|
*/
|
|
32
36
|
appearance?: "default" | "raised";
|
|
37
|
+
/**
|
|
38
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
39
|
+
*/
|
|
40
|
+
children?: import("svelte").Snippet;
|
|
33
41
|
/**
|
|
34
42
|
* Additional CSS classes to apply to the component
|
|
35
43
|
*/
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef {Object} Props
|
|
10
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
10
11
|
* @property {string} [class=""] Additional CSS classes to apply to the component
|
|
11
12
|
* @property {string} [value=""] The value of the toggle group item
|
|
12
13
|
*/
|
|
@@ -4,6 +4,10 @@ type ToggleGroupItem = {
|
|
|
4
4
|
$set?(props: Partial<Props>): void;
|
|
5
5
|
};
|
|
6
6
|
declare const ToggleGroupItem: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
7
11
|
/**
|
|
8
12
|
* Additional CSS classes to apply to the component
|
|
9
13
|
*/
|
|
@@ -14,6 +18,10 @@ declare const ToggleGroupItem: import("svelte").Component<{
|
|
|
14
18
|
value?: string;
|
|
15
19
|
}, {}, "">;
|
|
16
20
|
type Props = {
|
|
21
|
+
/**
|
|
22
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
23
|
+
*/
|
|
24
|
+
children?: import("svelte").Snippet;
|
|
17
25
|
/**
|
|
18
26
|
* Additional CSS classes to apply to the component
|
|
19
27
|
*/
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
let dataBottomLeft = $state([]);
|
|
27
27
|
let dataBottomRight = $state([]);
|
|
28
28
|
|
|
29
|
-
let { bottomLeft, bottomRight } = notificationGroupVariants();
|
|
29
|
+
let { bottomLeft, bottomRight } = $derived(notificationGroupVariants());
|
|
30
30
|
|
|
31
31
|
const MOVE_MS = 400;
|
|
32
32
|
const IN_MS = 220;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Popover } 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
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {Props} */
|
|
10
|
+
let { children, ...rest } = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Popover.Root {...rest}>
|
|
14
|
+
{@render children()}
|
|
15
|
+
</Popover.Root>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default Popover;
|
|
2
|
+
type Popover = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Popover: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
}, {}, "">;
|
|
12
|
+
import { Popover } from "bits-ui";
|
|
13
|
+
type Props = {
|
|
14
|
+
/**
|
|
15
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
16
|
+
*/
|
|
17
|
+
children?: import("svelte").Snippet;
|
|
18
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Popover } from "bits-ui";
|
|
3
|
+
import { scale } from "svelte/transition";
|
|
4
|
+
import { quintOut } from "svelte/easing";
|
|
5
|
+
import { CloseButton } from "../../../index.js";
|
|
6
|
+
import { popoverVariants } from "./popover.variants.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} Props
|
|
10
|
+
* @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
|
|
11
|
+
* @property {"start" | "center" | "end"} [align="center"] The preferred alignment of the anchor to render the floating element against when open. This may change when collisions occur.
|
|
12
|
+
* @property {number} [alignOffset=0] The distance in pixels from the anchor to the floating element.
|
|
13
|
+
* @property {boolean} [preventScroll=false] When true, prevents the body from scrolling when the content is open. This is useful when you want to use the content as a modal.
|
|
14
|
+
* @property {boolean} [portalDisabled=false] Whether the portal is disabled or not. When disabled, the content will be rendered in its original DOM location.
|
|
15
|
+
* @property {string} [portalTarget='body'] Where to render the content when it is open. Defaults to the body.
|
|
16
|
+
* @property {boolean} [showClose=false] Whether to show a close button in the popover header.
|
|
17
|
+
* @property {"top" | "right" | "bottom" | "left"} [side="bottom"] The preferred side of the anchor to render the floating element against when open. Will be reversed when collisions occur.
|
|
18
|
+
* @property {number} [sideOffset=8] The distance in pixels from the anchor to the floating element.
|
|
19
|
+
* @property {string} [title=''] The title text to display in the popover header.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** @type {Props} */
|
|
23
|
+
let {
|
|
24
|
+
align = "center",
|
|
25
|
+
alignOffset = 0,
|
|
26
|
+
children,
|
|
27
|
+
preventScroll = false,
|
|
28
|
+
portalDisabled = false,
|
|
29
|
+
portalTarget = "body",
|
|
30
|
+
showClose = false,
|
|
31
|
+
side = "bottom",
|
|
32
|
+
sideOffset = 8,
|
|
33
|
+
title = "",
|
|
34
|
+
...rest
|
|
35
|
+
} = $props();
|
|
36
|
+
|
|
37
|
+
let styles = $derived(popoverVariants());
|
|
38
|
+
|
|
39
|
+
let showHeader = $derived(showClose === true || title !== "");
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
{#snippet header()}
|
|
43
|
+
{#if showHeader}
|
|
44
|
+
<header class={styles.header()}>
|
|
45
|
+
{title}
|
|
46
|
+
{@render close()}
|
|
47
|
+
</header>
|
|
48
|
+
{/if}
|
|
49
|
+
{/snippet}
|
|
50
|
+
|
|
51
|
+
{#snippet close()}
|
|
52
|
+
{#if showClose}
|
|
53
|
+
<Popover.Close>
|
|
54
|
+
{#snippet child({ props })}
|
|
55
|
+
<CloseButton class={styles.close()} {...props} />
|
|
56
|
+
{/snippet}
|
|
57
|
+
</Popover.Close>
|
|
58
|
+
{/if}
|
|
59
|
+
{/snippet}
|
|
60
|
+
|
|
61
|
+
<Popover.Portal disabled={portalDisabled} to={portalTarget}>
|
|
62
|
+
<Popover.Content
|
|
63
|
+
{align}
|
|
64
|
+
{alignOffset}
|
|
65
|
+
class={styles.content()}
|
|
66
|
+
forceMount
|
|
67
|
+
{preventScroll}
|
|
68
|
+
{side}
|
|
69
|
+
{sideOffset}
|
|
70
|
+
{...rest}>
|
|
71
|
+
{#snippet child({ wrapperProps, props, open })}
|
|
72
|
+
{#if open}
|
|
73
|
+
<div {...wrapperProps}>
|
|
74
|
+
<div {...props} in:scale={{ duration: 300, easing: quintOut, start: 0.75 }}>
|
|
75
|
+
<div class={styles.body()}>
|
|
76
|
+
{@render children()}
|
|
77
|
+
</div>
|
|
78
|
+
{@render header()}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
{/if}
|
|
82
|
+
{/snippet}
|
|
83
|
+
</Popover.Content>
|
|
84
|
+
</Popover.Portal>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export default PopoverContent;
|
|
2
|
+
type PopoverContent = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const PopoverContent: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
9
|
+
*/
|
|
10
|
+
children?: import("svelte").Snippet;
|
|
11
|
+
/**
|
|
12
|
+
* The preferred alignment of the anchor to render the floating element against when open. This may change when collisions occur.
|
|
13
|
+
*/
|
|
14
|
+
align?: "start" | "center" | "end";
|
|
15
|
+
/**
|
|
16
|
+
* The distance in pixels from the anchor to the floating element.
|
|
17
|
+
*/
|
|
18
|
+
alignOffset?: number;
|
|
19
|
+
/**
|
|
20
|
+
* When true, prevents the body from scrolling when the content is open. This is useful when you want to use the content as a modal.
|
|
21
|
+
*/
|
|
22
|
+
preventScroll?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the portal is disabled or not. When disabled, the content will be rendered in its original DOM location.
|
|
25
|
+
*/
|
|
26
|
+
portalDisabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Where to render the content when it is open. Defaults to the body.
|
|
29
|
+
*/
|
|
30
|
+
portalTarget?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to show a close button in the popover header.
|
|
33
|
+
*/
|
|
34
|
+
showClose?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The preferred side of the anchor to render the floating element against when open. Will be reversed when collisions occur.
|
|
37
|
+
*/
|
|
38
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
39
|
+
/**
|
|
40
|
+
* The distance in pixels from the anchor to the floating element.
|
|
41
|
+
*/
|
|
42
|
+
sideOffset?: number;
|
|
43
|
+
/**
|
|
44
|
+
* The title text to display in the popover header.
|
|
45
|
+
*/
|
|
46
|
+
title?: string;
|
|
47
|
+
}, {}, "">;
|
|
48
|
+
type Props = {
|
|
49
|
+
/**
|
|
50
|
+
* Children content – can be text, HTML, or other Svelte components
|
|
51
|
+
*/
|
|
52
|
+
children?: import("svelte").Snippet;
|
|
53
|
+
/**
|
|
54
|
+
* The preferred alignment of the anchor to render the floating element against when open. This may change when collisions occur.
|
|
55
|
+
*/
|
|
56
|
+
align?: "start" | "center" | "end";
|
|
57
|
+
/**
|
|
58
|
+
* The distance in pixels from the anchor to the floating element.
|
|
59
|
+
*/
|
|
60
|
+
alignOffset?: number;
|
|
61
|
+
/**
|
|
62
|
+
* When true, prevents the body from scrolling when the content is open. This is useful when you want to use the content as a modal.
|
|
63
|
+
*/
|
|
64
|
+
preventScroll?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the portal is disabled or not. When disabled, the content will be rendered in its original DOM location.
|
|
67
|
+
*/
|
|
68
|
+
portalDisabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Where to render the content when it is open. Defaults to the body.
|
|
71
|
+
*/
|
|
72
|
+
portalTarget?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to show a close button in the popover header.
|
|
75
|
+
*/
|
|
76
|
+
showClose?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* The preferred side of the anchor to render the floating element against when open. Will be reversed when collisions occur.
|
|
79
|
+
*/
|
|
80
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
81
|
+
/**
|
|
82
|
+
* The distance in pixels from the anchor to the floating element.
|
|
83
|
+
*/
|
|
84
|
+
sideOffset?: number;
|
|
85
|
+
/**
|
|
86
|
+
* The title text to display in the popover header.
|
|
87
|
+
*/
|
|
88
|
+
title?: string;
|
|
89
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Popover } from "bits-ui";
|
|
3
|
+
import { popoverVariants } from "./popover.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
|
+
<Popover.Trigger class={popoverVariants().trigger({ class: className })} {...rest} />
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
export default
|
|
2
|
-
type
|
|
1
|
+
export default PopoverTrigger;
|
|
2
|
+
type PopoverTrigger = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
4
|
$set?(props: Partial<Props>): void;
|
|
5
5
|
};
|
|
6
|
-
declare const
|
|
6
|
+
declare const PopoverTrigger: import("svelte").Component<{
|
|
7
7
|
/**
|
|
8
8
|
* Additional CSS classes to apply to the component
|
|
9
9
|
*/
|
|
10
10
|
class?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Button shape
|
|
13
|
-
*/
|
|
14
|
-
shape?: "circle" | "square";
|
|
15
11
|
}, {}, "">;
|
|
16
12
|
type Props = {
|
|
17
13
|
/**
|
|
18
14
|
* Additional CSS classes to apply to the component
|
|
19
15
|
*/
|
|
20
16
|
class?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Button shape
|
|
23
|
-
*/
|
|
24
|
-
shape?: "circle" | "square";
|
|
25
17
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const popoverVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
[key: string]: {
|
|
3
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
4
|
+
close?: import("tailwind-variants").ClassValue;
|
|
5
|
+
content?: import("tailwind-variants").ClassValue;
|
|
6
|
+
body?: import("tailwind-variants").ClassValue;
|
|
7
|
+
header?: import("tailwind-variants").ClassValue;
|
|
8
|
+
trigger?: import("tailwind-variants").ClassValue;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
[x: string]: {
|
|
13
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
14
|
+
close?: import("tailwind-variants").ClassValue;
|
|
15
|
+
content?: import("tailwind-variants").ClassValue;
|
|
16
|
+
body?: import("tailwind-variants").ClassValue;
|
|
17
|
+
header?: import("tailwind-variants").ClassValue;
|
|
18
|
+
trigger?: import("tailwind-variants").ClassValue;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
body: string;
|
|
23
|
+
close: string;
|
|
24
|
+
content: string;
|
|
25
|
+
header: string;
|
|
26
|
+
trigger: string;
|
|
27
|
+
}, undefined, any, {
|
|
28
|
+
body: string;
|
|
29
|
+
close: string;
|
|
30
|
+
content: string;
|
|
31
|
+
header: string;
|
|
32
|
+
trigger: string;
|
|
33
|
+
}, import("tailwind-variants").TVReturnType<any, {
|
|
34
|
+
body: string;
|
|
35
|
+
close: string;
|
|
36
|
+
content: string;
|
|
37
|
+
header: string;
|
|
38
|
+
trigger: string;
|
|
39
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
|
|
3
|
+
const popoverVariants = tv({
|
|
4
|
+
slots: {
|
|
5
|
+
body: "p-3",
|
|
6
|
+
close: "ml-auto",
|
|
7
|
+
content:
|
|
8
|
+
"bg-white dark:bg-neutral-800 rounded-2xl flex flex-col-reverse shadow-sm",
|
|
9
|
+
header:
|
|
10
|
+
"p-3 border-b border-gray-300 heading-h6 flex items-center justify-between gap-3 dark:text-neutral-200",
|
|
11
|
+
trigger: "cursor-pointer",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { popoverVariants };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
export * as utils from "./utils/index.js";
|
|
2
2
|
export { default as Avatar } from "./components/atoms/avatar/Avatar.svelte";
|
|
3
|
-
export { default as
|
|
4
|
-
export { default as
|
|
3
|
+
export { default as Badge } from "./components/atoms/badge/Badge.svelte";
|
|
4
|
+
export { default as Button } from "./components/atoms/actions/button/Button.svelte";
|
|
5
|
+
export { default as Chip } from "./components/atoms/chip/Chip.svelte";
|
|
6
|
+
export { default as CloseButton } from "./components/atoms/actions/closeButton/CloseButton.svelte";
|
|
7
|
+
export { default as ColorChip } from "./components/atoms/colorChip/ColorChip.svelte";
|
|
5
8
|
export { default as FormField } from "./components/atoms/form/formField/FormField.svelte";
|
|
6
9
|
export { default as HelperText } from "./components/atoms/form/helperText/HelperText.svelte";
|
|
7
10
|
export { default as Icon } from "./components/atoms/icon/Icon.svelte";
|
|
8
|
-
export { default as IconButton } from "./components/atoms/
|
|
11
|
+
export { default as IconButton } from "./components/atoms/actions/iconButton/IconButton.svelte";
|
|
9
12
|
export { default as Input } from "./components/atoms/form/input/Input.svelte";
|
|
10
13
|
export { default as Label } from "./components/atoms/form/label/Label.svelte";
|
|
11
|
-
export { default as
|
|
14
|
+
export { default as Radio } from "./components/atoms/form/radio/Radio.svelte";
|
|
15
|
+
export { default as Select } from "./components/atoms/form/select/Select.svelte";
|
|
16
|
+
export { default as Spinner } from "./components/atoms/feedback/spinner/Spinner.svelte";
|
|
17
|
+
export { default as Switch } from "./components/atoms/form/switch/Switch.svelte";
|
|
12
18
|
export { default as Textarea } from "./components/atoms/form/textarea/Textarea.svelte";
|
|
19
|
+
export * as ColorSwatch from "./components/molecules/pickers/colorSwatch/index.js";
|
|
20
|
+
export { default as NavigationItem } from "./components/molecules/navigationItem/NavigationItem.svelte";
|
|
13
21
|
export { default as Notification } from "./components/molecules/notification/Notification.svelte";
|
|
14
22
|
export { default as RichTextEditor } from "./components/molecules/richTextEditor/RichTextEditor.svelte";
|
|
23
|
+
export { default as SelectorCard } from "./components/molecules/selectorCard/SelectorCard.svelte";
|
|
15
24
|
export { default as ToggleGroup } from "./components/molecules/toggleGroup/ToggleGroup.svelte";
|
|
16
25
|
export { default as ToggleGroupItem } from "./components/molecules/toggleGroup/ToggleGroupItem.svelte";
|
|
17
26
|
export { default as NotificationGroup } from "./components/organisms/notificationGroup/NotificationGroup.svelte";
|
|
27
|
+
export * as Popover from "./components/organisms/popover/index.js";
|
package/dist/index.js
CHANGED
|
@@ -5,23 +5,32 @@ export * as utils from "./utils/index.js";
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export { default as Avatar } from "./components/atoms/avatar/Avatar.svelte";
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
8
|
+
export { default as Badge } from "./components/atoms/badge/Badge.svelte";
|
|
9
|
+
export { default as Button } from "./components/atoms/actions/button/Button.svelte";
|
|
10
|
+
export { default as Chip } from "./components/atoms/chip/Chip.svelte";
|
|
11
|
+
export { default as CloseButton } from "./components/atoms/actions/closeButton/CloseButton.svelte";
|
|
12
|
+
export { default as ColorChip } from "./components/atoms/colorChip/ColorChip.svelte";
|
|
10
13
|
export { default as FormField } from "./components/atoms/form/formField/FormField.svelte";
|
|
11
14
|
export { default as HelperText } from "./components/atoms/form/helperText/HelperText.svelte";
|
|
12
15
|
export { default as Icon } from "./components/atoms/icon/Icon.svelte";
|
|
13
|
-
export { default as IconButton } from "./components/atoms/
|
|
16
|
+
export { default as IconButton } from "./components/atoms/actions/iconButton/IconButton.svelte";
|
|
14
17
|
export { default as Input } from "./components/atoms/form/input/Input.svelte";
|
|
15
18
|
export { default as Label } from "./components/atoms/form/label/Label.svelte";
|
|
16
|
-
export { default as
|
|
19
|
+
export { default as Radio } from "./components/atoms/form/radio/Radio.svelte";
|
|
20
|
+
export { default as Select } from "./components/atoms/form/select/Select.svelte";
|
|
21
|
+
export { default as Spinner } from "./components/atoms/feedback/spinner/Spinner.svelte";
|
|
22
|
+
export { default as Switch } from "./components/atoms/form/switch/Switch.svelte";
|
|
17
23
|
export { default as Textarea } from "./components/atoms/form/textarea/Textarea.svelte";
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
26
|
* Molecules
|
|
21
27
|
*/
|
|
22
28
|
|
|
29
|
+
export * as ColorSwatch from "./components/molecules/pickers/colorSwatch/index.js";
|
|
30
|
+
export { default as NavigationItem } from "./components/molecules/navigationItem/NavigationItem.svelte";
|
|
23
31
|
export { default as Notification } from "./components/molecules/notification/Notification.svelte";
|
|
24
32
|
export { default as RichTextEditor } from "./components/molecules/richTextEditor/RichTextEditor.svelte";
|
|
33
|
+
export { default as SelectorCard } from "./components/molecules/selectorCard/SelectorCard.svelte";
|
|
25
34
|
export { default as ToggleGroup } from "./components/molecules/toggleGroup/ToggleGroup.svelte";
|
|
26
35
|
export { default as ToggleGroupItem } from "./components/molecules/toggleGroup/ToggleGroupItem.svelte";
|
|
27
36
|
|
|
@@ -30,3 +39,4 @@ export { default as ToggleGroupItem } from "./components/molecules/toggleGroup/T
|
|
|
30
39
|
*/
|
|
31
40
|
|
|
32
41
|
export { default as NotificationGroup } from "./components/organisms/notificationGroup/NotificationGroup.svelte";
|
|
42
|
+
export * as Popover from "./components/organisms/popover/index.js";
|