plasma-svelte 0.0.1

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 (95) hide show
  1. package/README.md +65 -0
  2. package/dist/accordion/Accordion.svelte +28 -0
  3. package/dist/accordion/Accordion.svelte.d.ts +8 -0
  4. package/dist/accordion/AccordionItem.svelte +193 -0
  5. package/dist/accordion/AccordionItem.svelte.d.ts +14 -0
  6. package/dist/avatar/Avatar.svelte +178 -0
  7. package/dist/avatar/Avatar.svelte.d.ts +16 -0
  8. package/dist/badge/Badge.svelte +162 -0
  9. package/dist/badge/Badge.svelte.d.ts +16 -0
  10. package/dist/breadcrumb/Breadcrumb.svelte +59 -0
  11. package/dist/breadcrumb/Breadcrumb.svelte.d.ts +9 -0
  12. package/dist/breadcrumb/BreadcrumbItem.svelte +151 -0
  13. package/dist/breadcrumb/BreadcrumbItem.svelte.d.ts +14 -0
  14. package/dist/button/Button.svelte +274 -0
  15. package/dist/button/Button.svelte.d.ts +22 -0
  16. package/dist/button/ButtonGroup.svelte +98 -0
  17. package/dist/button/ButtonGroup.svelte.d.ts +12 -0
  18. package/dist/card/Card.svelte +191 -0
  19. package/dist/card/Card.svelte.d.ts +18 -0
  20. package/dist/checkbox/Checkbox.svelte +199 -0
  21. package/dist/checkbox/Checkbox.svelte.d.ts +12 -0
  22. package/dist/datepicker/DatePicker.svelte +509 -0
  23. package/dist/datepicker/DatePicker.svelte.d.ts +14 -0
  24. package/dist/divider/Divider.svelte +112 -0
  25. package/dist/divider/Divider.svelte.d.ts +13 -0
  26. package/dist/drawer/Drawer.svelte +330 -0
  27. package/dist/drawer/Drawer.svelte.d.ts +21 -0
  28. package/dist/dropzone/DropZone.svelte +282 -0
  29. package/dist/dropzone/DropZone.svelte.d.ts +17 -0
  30. package/dist/emptystate/EmptyState.svelte +169 -0
  31. package/dist/emptystate/EmptyState.svelte.d.ts +15 -0
  32. package/dist/headerbar/HeaderBar.svelte +210 -0
  33. package/dist/headerbar/HeaderBar.svelte.d.ts +17 -0
  34. package/dist/index.d.ts +44 -0
  35. package/dist/index.js +44 -0
  36. package/dist/input/Input.svelte +227 -0
  37. package/dist/input/Input.svelte.d.ts +14 -0
  38. package/dist/layout/Flex.svelte +110 -0
  39. package/dist/layout/Flex.svelte.d.ts +20 -0
  40. package/dist/layout/Grid.svelte +78 -0
  41. package/dist/layout/Grid.svelte.d.ts +19 -0
  42. package/dist/layout/Space.svelte +64 -0
  43. package/dist/layout/Space.svelte.d.ts +16 -0
  44. package/dist/layout/utils.d.ts +2 -0
  45. package/dist/layout/utils.js +19 -0
  46. package/dist/menu/Menu.svelte +156 -0
  47. package/dist/menu/Menu.svelte.d.ts +14 -0
  48. package/dist/menu/MenuDivider.svelte +19 -0
  49. package/dist/menu/MenuDivider.svelte.d.ts +6 -0
  50. package/dist/menu/MenuItem.svelte +126 -0
  51. package/dist/menu/MenuItem.svelte.d.ts +13 -0
  52. package/dist/message/InlineMessage.svelte +226 -0
  53. package/dist/message/InlineMessage.svelte.d.ts +15 -0
  54. package/dist/modal/ConfirmDialog.svelte +151 -0
  55. package/dist/modal/ConfirmDialog.svelte.d.ts +19 -0
  56. package/dist/modal/Modal.svelte +279 -0
  57. package/dist/modal/Modal.svelte.d.ts +18 -0
  58. package/dist/pagination/Pagination.svelte +258 -0
  59. package/dist/pagination/Pagination.svelte.d.ts +16 -0
  60. package/dist/progress/ProgressBar.svelte +179 -0
  61. package/dist/progress/ProgressBar.svelte.d.ts +15 -0
  62. package/dist/radio/Radio.svelte +161 -0
  63. package/dist/radio/Radio.svelte.d.ts +13 -0
  64. package/dist/searchfield/SearchField.svelte +246 -0
  65. package/dist/searchfield/SearchField.svelte.d.ts +15 -0
  66. package/dist/select/Select.svelte +392 -0
  67. package/dist/select/Select.svelte.d.ts +20 -0
  68. package/dist/sidebar/Sidebar.svelte +78 -0
  69. package/dist/sidebar/Sidebar.svelte.d.ts +11 -0
  70. package/dist/sidebar/SidebarGroup.svelte +51 -0
  71. package/dist/sidebar/SidebarGroup.svelte.d.ts +9 -0
  72. package/dist/sidebar/SidebarItem.svelte +185 -0
  73. package/dist/sidebar/SidebarItem.svelte.d.ts +16 -0
  74. package/dist/slider/Slider.svelte +204 -0
  75. package/dist/slider/Slider.svelte.d.ts +16 -0
  76. package/dist/spinbox/SpinBox.svelte +299 -0
  77. package/dist/spinbox/SpinBox.svelte.d.ts +20 -0
  78. package/dist/spinner/Spinner.svelte +130 -0
  79. package/dist/spinner/Spinner.svelte.d.ts +11 -0
  80. package/dist/style/base.css +178 -0
  81. package/dist/style/index.css +2 -0
  82. package/dist/style/token.css +230 -0
  83. package/dist/switch/Switch.svelte +199 -0
  84. package/dist/switch/Switch.svelte.d.ts +13 -0
  85. package/dist/table/Table.svelte +305 -0
  86. package/dist/table/Table.svelte.d.ts +32 -0
  87. package/dist/tabs/Tabs.svelte +216 -0
  88. package/dist/tabs/Tabs.svelte.d.ts +21 -0
  89. package/dist/textarea/TextArea.svelte +114 -0
  90. package/dist/textarea/TextArea.svelte.d.ts +14 -0
  91. package/dist/timepicker/TimePicker.svelte +452 -0
  92. package/dist/timepicker/TimePicker.svelte.d.ts +16 -0
  93. package/dist/tooltip/Tooltip.svelte +122 -0
  94. package/dist/tooltip/Tooltip.svelte.d.ts +12 -0
  95. package/package.json +66 -0
@@ -0,0 +1,59 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ interface Props extends HTMLAttributes<HTMLElement> {
6
+ separator?: string | Snippet;
7
+ children?: Snippet;
8
+ }
9
+
10
+ let {
11
+ separator,
12
+ children,
13
+ class: customClass = "",
14
+ ...restProps
15
+ }: Props = $props();
16
+ </script>
17
+
18
+ <nav
19
+ aria-label="Breadcrumb"
20
+ class="plasma-breadcrumb {customClass}"
21
+ {...restProps}
22
+ >
23
+ <ol class="plasma-breadcrumb-list">
24
+ {@render children?.()}
25
+ </ol>
26
+ </nav>
27
+
28
+ <style>
29
+ .plasma-breadcrumb {
30
+ display: inline-flex;
31
+ align-items: center;
32
+ box-sizing: border-box;
33
+ }
34
+
35
+ .plasma-breadcrumb-list {
36
+ display: flex;
37
+ align-items: center;
38
+ flex-wrap: wrap;
39
+ gap: 2px;
40
+ margin: 0;
41
+ padding: 2px 6px;
42
+ list-style: none;
43
+ background-color: var(--plasma-color-view-bg);
44
+ border: 1px solid var(--plasma-color-border);
45
+ border-radius: var(--plasma-radius-md);
46
+ }
47
+
48
+ /* Default Dolphin Chevron Separator */
49
+ :global(.plasma-breadcrumb-list > li + li::before) {
50
+ content: "›";
51
+ display: inline-block;
52
+ padding: 0 4px;
53
+ font-size: 14px;
54
+ font-weight: bold;
55
+ color: var(--plasma-color-text-muted);
56
+ opacity: 0.7;
57
+ user-select: none;
58
+ }
59
+ </style>
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ interface Props extends HTMLAttributes<HTMLElement> {
4
+ separator?: string | Snippet;
5
+ children?: Snippet;
6
+ }
7
+ declare const Breadcrumb: import("svelte").Component<Props, {}, "">;
8
+ type Breadcrumb = ReturnType<typeof Breadcrumb>;
9
+ export default Breadcrumb;
@@ -0,0 +1,151 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ interface Props extends HTMLAttributes<HTMLLIElement> {
6
+ href?: string;
7
+ active?: boolean;
8
+ disabled?: boolean;
9
+ icon?: Snippet;
10
+ children?: Snippet;
11
+ label?: string;
12
+ onclick?: (e: MouseEvent) => void;
13
+ }
14
+
15
+ let {
16
+ href,
17
+ active = false,
18
+ disabled = false,
19
+ icon,
20
+ children,
21
+ label = "",
22
+ class: customClass = "",
23
+ onclick,
24
+ ...restProps
25
+ }: Props = $props();
26
+
27
+ function handleClick(e: MouseEvent) {
28
+ if (disabled || active) {
29
+ e.preventDefault();
30
+ return;
31
+ }
32
+ onclick?.(e);
33
+ }
34
+ </script>
35
+
36
+ <li
37
+ class="plasma-breadcrumb-item {customClass}"
38
+ class:plasma-breadcrumb-item--active={active}
39
+ class:plasma-breadcrumb-item--disabled={disabled}
40
+ aria-current={active ? "page" : undefined}
41
+ {...restProps}
42
+ >
43
+ {#if href && !active}
44
+ <a
45
+ {href}
46
+ class="plasma-breadcrumb-link"
47
+ onclick={handleClick}
48
+ >
49
+ {#if icon}
50
+ <span class="plasma-breadcrumb-icon">
51
+ {@render icon()}
52
+ </span>
53
+ {/if}
54
+ <span>
55
+ {#if children}
56
+ {@render children()}
57
+ {:else}
58
+ {label}
59
+ {/if}
60
+ </span>
61
+ </a>
62
+ {:else if !active}
63
+ <button
64
+ type="button"
65
+ {disabled}
66
+ class="plasma-breadcrumb-btn"
67
+ onclick={handleClick}
68
+ >
69
+ {#if icon}
70
+ <span class="plasma-breadcrumb-icon">
71
+ {@render icon()}
72
+ </span>
73
+ {/if}
74
+ <span>
75
+ {#if children}
76
+ {@render children()}
77
+ {:else}
78
+ {label}
79
+ {/if}
80
+ </span>
81
+ </button>
82
+ {:else}
83
+ <span class="plasma-breadcrumb-current">
84
+ {#if icon}
85
+ <span class="plasma-breadcrumb-icon">
86
+ {@render icon()}
87
+ </span>
88
+ {/if}
89
+ <span>
90
+ {#if children}
91
+ {@render children()}
92
+ {:else}
93
+ {label}
94
+ {/if}
95
+ </span>
96
+ </span>
97
+ {/if}
98
+ </li>
99
+
100
+ <style>
101
+ .plasma-breadcrumb-item {
102
+ display: inline-flex;
103
+ align-items: center;
104
+ font-family: var(--plasma-font-sans);
105
+ font-size: var(--plasma-font-size-sm);
106
+ }
107
+
108
+ .plasma-breadcrumb-link,
109
+ .plasma-breadcrumb-btn {
110
+ display: inline-flex;
111
+ align-items: center;
112
+ gap: 4px;
113
+ padding: 3px 8px;
114
+ border: none;
115
+ border-radius: var(--plasma-radius-sm);
116
+ background: transparent;
117
+ color: var(--plasma-color-text-muted);
118
+ text-decoration: none;
119
+ cursor: pointer;
120
+ user-select: none;
121
+ transition: var(--plasma-transition-fast);
122
+ }
123
+
124
+ .plasma-breadcrumb-link:hover,
125
+ .plasma-breadcrumb-btn:hover:not(:disabled) {
126
+ background-color: var(--plasma-color-surface-hover);
127
+ color: var(--plasma-color-highlight);
128
+ }
129
+
130
+ .plasma-breadcrumb-current {
131
+ display: inline-flex;
132
+ align-items: center;
133
+ gap: 4px;
134
+ padding: 3px 8px;
135
+ color: var(--plasma-color-text);
136
+ font-weight: var(--plasma-font-weight-bold);
137
+ }
138
+
139
+ .plasma-breadcrumb-icon {
140
+ display: inline-flex;
141
+ align-items: center;
142
+ justify-content: center;
143
+ color: inherit;
144
+ flex-shrink: 0;
145
+ }
146
+
147
+ .plasma-breadcrumb-item--disabled {
148
+ opacity: 0.45;
149
+ cursor: not-allowed;
150
+ }
151
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ interface Props extends HTMLAttributes<HTMLLIElement> {
4
+ href?: string;
5
+ active?: boolean;
6
+ disabled?: boolean;
7
+ icon?: Snippet;
8
+ children?: Snippet;
9
+ label?: string;
10
+ onclick?: (e: MouseEvent) => void;
11
+ }
12
+ declare const BreadcrumbItem: import("svelte").Component<Props, {}, "">;
13
+ type BreadcrumbItem = ReturnType<typeof BreadcrumbItem>;
14
+ export default BreadcrumbItem;
@@ -0,0 +1,274 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import type { HTMLAttributes, HTMLButtonAttributes } from "svelte/elements";
4
+
5
+ type ButtonVariant = "default" | "secondary" | "primary" | "flat" | "tool" | "danger";
6
+ type ButtonSize = "sm" | "md" | "lg" | "small" | "medium" | "large";
7
+
8
+ interface Props extends HTMLAttributes<HTMLAnchorElement | HTMLButtonElement> {
9
+ variant?: ButtonVariant;
10
+ primary?: boolean;
11
+ size?: ButtonSize;
12
+ disabled?: boolean;
13
+ loading?: boolean;
14
+ type?: HTMLButtonAttributes["type"];
15
+ form?: string;
16
+ href?: string;
17
+ target?: string;
18
+ rel?: string;
19
+ download?: boolean | string;
20
+ label?: string;
21
+ children?: Snippet;
22
+ }
23
+
24
+ let {
25
+ variant = "default",
26
+ primary = false,
27
+ size = "md",
28
+ disabled = false,
29
+ loading = false,
30
+ type = "button",
31
+ form,
32
+ href,
33
+ target,
34
+ rel,
35
+ download,
36
+ label,
37
+ children,
38
+ class: customClass = "",
39
+ onclick,
40
+ ...restProps
41
+ }: Props = $props();
42
+
43
+ // Normalize size strings
44
+ const resolvedSize = $derived(
45
+ size === "small" ? "sm" : size === "large" ? "lg" : size === "medium" ? "md" : size
46
+ );
47
+
48
+ // Normalize variant strings (primary prop overrides, secondary maps to default, tool maps to flat)
49
+ const resolvedVariant = $derived(
50
+ primary
51
+ ? "primary"
52
+ : variant === "secondary"
53
+ ? "default"
54
+ : variant === "tool"
55
+ ? "flat"
56
+ : variant
57
+ );
58
+
59
+ const isInteractiveDisabled = $derived(disabled || loading);
60
+
61
+ function handleClick(e: MouseEvent) {
62
+ if (isInteractiveDisabled) {
63
+ e.preventDefault();
64
+ return;
65
+ }
66
+ (onclick as ((e: MouseEvent) => void) | undefined)?.(e);
67
+ }
68
+ </script>
69
+
70
+ {#if href}
71
+ <a
72
+ {href}
73
+ {target}
74
+ {download}
75
+ rel={target === "_blank" && !rel ? "noopener noreferrer" : rel}
76
+ class="plasma-btn plasma-btn--{resolvedVariant} plasma-btn--{resolvedSize} {customClass}"
77
+ class:plasma-btn--loading={loading}
78
+ class:plasma-btn--disabled={isInteractiveDisabled}
79
+ aria-disabled={isInteractiveDisabled ? "true" : undefined}
80
+ aria-busy={loading ? "true" : undefined}
81
+ onclick={handleClick}
82
+ {...restProps}
83
+ >
84
+ {#if loading}
85
+ <span class="plasma-btn-spinner" aria-hidden="true"></span>
86
+ {/if}
87
+ {#if children}
88
+ {@render children()}
89
+ {:else if label}
90
+ {label}
91
+ {/if}
92
+ </a>
93
+ {:else}
94
+ <button
95
+ {type}
96
+ {form}
97
+ class="plasma-btn plasma-btn--{resolvedVariant} plasma-btn--{resolvedSize} {customClass}"
98
+ class:plasma-btn--loading={loading}
99
+ disabled={isInteractiveDisabled}
100
+ aria-busy={loading ? "true" : undefined}
101
+ onclick={handleClick}
102
+ {...restProps}
103
+ >
104
+ {#if loading}
105
+ <span class="plasma-btn-spinner" aria-hidden="true"></span>
106
+ {/if}
107
+ {#if children}
108
+ {@render children()}
109
+ {:else if label}
110
+ {label}
111
+ {/if}
112
+ </button>
113
+ {/if}
114
+
115
+
116
+ <style>
117
+ .plasma-btn {
118
+ position: relative;
119
+ display: inline-flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ gap: var(--plasma-space-xs);
123
+ font-family: var(--plasma-font-sans);
124
+ font-weight: var(--plasma-font-weight-medium);
125
+ line-height: 1;
126
+ white-space: nowrap;
127
+ border-radius: var(--plasma-radius-md);
128
+ cursor: pointer;
129
+ user-select: none;
130
+ border: 1px solid transparent;
131
+ transition: var(--plasma-transition-fast);
132
+ }
133
+
134
+ /* --------------------------------------------------------------------------
135
+ Sizing
136
+ -------------------------------------------------------------------------- */
137
+ .plasma-btn--sm {
138
+ height: var(--plasma-control-height-sm);
139
+ padding: 0 var(--plasma-space-sm);
140
+ font-size: var(--plasma-font-size-xs);
141
+ }
142
+
143
+ .plasma-btn--md {
144
+ height: var(--plasma-control-height-md);
145
+ padding: 0 var(--plasma-space-md);
146
+ font-size: var(--plasma-font-size-base);
147
+ }
148
+
149
+ .plasma-btn--lg {
150
+ height: var(--plasma-control-height-lg);
151
+ padding: 0 var(--plasma-space-lg);
152
+ font-size: var(--plasma-font-size-md);
153
+ }
154
+
155
+ /* --------------------------------------------------------------------------
156
+ Variant: Default (Breeze Standard PushButton)
157
+ -------------------------------------------------------------------------- */
158
+ .plasma-btn--default {
159
+ background-color: var(--plasma-color-surface);
160
+ border-color: var(--plasma-color-border);
161
+ color: var(--plasma-color-text);
162
+ box-shadow: var(--plasma-shadow-xs);
163
+ }
164
+
165
+ .plasma-btn--default:hover:not(:disabled) {
166
+ background-color: var(--plasma-color-surface-hover);
167
+ border-color: var(--plasma-color-border-hover);
168
+ }
169
+
170
+ .plasma-btn--default:active:not(:disabled) {
171
+ background-color: var(--plasma-color-surface-active);
172
+ border-color: var(--plasma-color-border-focus);
173
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
174
+ }
175
+
176
+ /* --------------------------------------------------------------------------
177
+ Variant: Primary (Breeze Default/Highlight Action)
178
+ -------------------------------------------------------------------------- */
179
+ .plasma-btn--primary {
180
+ background-color: var(--plasma-color-highlight);
181
+ border-color: var(--plasma-color-highlight-hover);
182
+ color: var(--plasma-color-highlight-text);
183
+ box-shadow: var(--plasma-shadow-xs);
184
+ }
185
+
186
+ .plasma-btn--primary:hover:not(:disabled) {
187
+ background-color: var(--plasma-color-highlight-hover);
188
+ border-color: var(--plasma-color-highlight-active);
189
+ }
190
+
191
+ .plasma-btn--primary:active:not(:disabled) {
192
+ background-color: var(--plasma-color-highlight-active);
193
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
194
+ }
195
+
196
+ /* --------------------------------------------------------------------------
197
+ Variant: Flat / ToolButton (KDE Toolbar style)
198
+ -------------------------------------------------------------------------- */
199
+ .plasma-btn--flat {
200
+ background-color: transparent;
201
+ border-color: transparent;
202
+ color: var(--plasma-color-text);
203
+ }
204
+
205
+ .plasma-btn--flat:hover:not(:disabled) {
206
+ background-color: var(--plasma-color-surface-hover);
207
+ border-color: var(--plasma-color-border-subtle);
208
+ }
209
+
210
+ .plasma-btn--flat:active:not(:disabled) {
211
+ background-color: var(--plasma-color-surface-active);
212
+ border-color: var(--plasma-color-border);
213
+ }
214
+
215
+ /* --------------------------------------------------------------------------
216
+ Variant: Danger (Destructive Action)
217
+ -------------------------------------------------------------------------- */
218
+ .plasma-btn--danger {
219
+ background-color: var(--plasma-color-negative);
220
+ border-color: var(--plasma-color-negative-hover);
221
+ color: #ffffff;
222
+ box-shadow: var(--plasma-shadow-xs);
223
+ }
224
+
225
+ .plasma-btn--danger:hover:not(:disabled) {
226
+ background-color: var(--plasma-color-negative-hover);
227
+ border-color: var(--plasma-color-negative-hover);
228
+ }
229
+
230
+ .plasma-btn--danger:active:not(:disabled) {
231
+ background-color: #ba2837;
232
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
233
+ }
234
+
235
+ /* --------------------------------------------------------------------------
236
+ Focus & Disabled States
237
+ -------------------------------------------------------------------------- */
238
+ .plasma-btn:focus-visible {
239
+ outline: 2px solid var(--plasma-color-highlight);
240
+ outline-offset: 1px;
241
+ box-shadow: var(--plasma-shadow-focus);
242
+ }
243
+
244
+ .plasma-btn:disabled,
245
+ .plasma-btn--disabled {
246
+ opacity: 0.45;
247
+ cursor: not-allowed;
248
+ box-shadow: none;
249
+ pointer-events: none;
250
+ }
251
+
252
+ /* --------------------------------------------------------------------------
253
+ Spinner for loading button
254
+ -------------------------------------------------------------------------- */
255
+ .plasma-btn-spinner {
256
+ width: 1em;
257
+ height: 1em;
258
+ border: 2px solid currentColor;
259
+ border-right-color: transparent;
260
+ border-radius: var(--plasma-radius-full);
261
+ animation: plasma-btn-spin 0.75s linear infinite;
262
+ display: inline-block;
263
+ flex-shrink: 0;
264
+ }
265
+
266
+ @keyframes plasma-btn-spin {
267
+ from {
268
+ transform: rotate(0deg);
269
+ }
270
+ to {
271
+ transform: rotate(360deg);
272
+ }
273
+ }
274
+ </style>
@@ -0,0 +1,22 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLAttributes, HTMLButtonAttributes } from "svelte/elements";
3
+ type ButtonVariant = "default" | "secondary" | "primary" | "flat" | "tool" | "danger";
4
+ type ButtonSize = "sm" | "md" | "lg" | "small" | "medium" | "large";
5
+ interface Props extends HTMLAttributes<HTMLAnchorElement | HTMLButtonElement> {
6
+ variant?: ButtonVariant;
7
+ primary?: boolean;
8
+ size?: ButtonSize;
9
+ disabled?: boolean;
10
+ loading?: boolean;
11
+ type?: HTMLButtonAttributes["type"];
12
+ form?: string;
13
+ href?: string;
14
+ target?: string;
15
+ rel?: string;
16
+ download?: boolean | string;
17
+ label?: string;
18
+ children?: Snippet;
19
+ }
20
+ declare const Button: import("svelte").Component<Props, {}, "">;
21
+ type Button = ReturnType<typeof Button>;
22
+ export default Button;
@@ -0,0 +1,98 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ type ButtonGroupOrientation = "horizontal" | "vertical";
6
+ type ButtonGroupSize = "sm" | "md" | "lg" | "small" | "medium" | "large";
7
+
8
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "size"> {
9
+ orientation?: ButtonGroupOrientation;
10
+ size?: ButtonGroupSize;
11
+ children?: Snippet;
12
+ }
13
+
14
+ let {
15
+ orientation = "horizontal",
16
+ size = "md",
17
+ children,
18
+ class: customClass = "",
19
+ ...restProps
20
+ }: Props = $props();
21
+
22
+ const resolvedSize = $derived(
23
+ size === "small"
24
+ ? "sm"
25
+ : size === "large"
26
+ ? "lg"
27
+ : size === "medium"
28
+ ? "md"
29
+ : size
30
+ );
31
+ </script>
32
+
33
+ <div
34
+ role="group"
35
+ class="plasma-button-group plasma-button-group--{orientation} plasma-button-group--{resolvedSize} {customClass}"
36
+ {...restProps}
37
+ >
38
+ {@render children?.()}
39
+ </div>
40
+
41
+ <style>
42
+ .plasma-button-group {
43
+ display: inline-flex;
44
+ vertical-align: middle;
45
+ box-sizing: border-box;
46
+ }
47
+
48
+ /* --------------------------------------------------------------------------
49
+ Horizontal Grouping
50
+ -------------------------------------------------------------------------- */
51
+ .plasma-button-group--horizontal {
52
+ flex-direction: row;
53
+ }
54
+
55
+ .plasma-button-group--horizontal > :global(.plasma-button:not(:first-child)),
56
+ .plasma-button-group--horizontal > :global(button:not(:first-child)) {
57
+ margin-left: -1px;
58
+ border-top-left-radius: 0;
59
+ border-bottom-left-radius: 0;
60
+ }
61
+
62
+ .plasma-button-group--horizontal > :global(.plasma-button:not(:last-child)),
63
+ .plasma-button-group--horizontal > :global(button:not(:last-child)) {
64
+ border-top-right-radius: 0;
65
+ border-bottom-right-radius: 0;
66
+ }
67
+
68
+ /* --------------------------------------------------------------------------
69
+ Vertical Grouping
70
+ -------------------------------------------------------------------------- */
71
+ .plasma-button-group--vertical {
72
+ flex-direction: column;
73
+ }
74
+
75
+ .plasma-button-group--vertical > :global(.plasma-button:not(:first-child)),
76
+ .plasma-button-group--vertical > :global(button:not(:first-child)) {
77
+ margin-top: -1px;
78
+ border-top-left-radius: 0;
79
+ border-top-right-radius: 0;
80
+ }
81
+
82
+ .plasma-button-group--vertical > :global(.plasma-button:not(:last-child)),
83
+ .plasma-button-group--vertical > :global(button:not(:last-child)) {
84
+ border-bottom-left-radius: 0;
85
+ border-bottom-right-radius: 0;
86
+ }
87
+
88
+ /* --------------------------------------------------------------------------
89
+ Hover & Focus Layering
90
+ -------------------------------------------------------------------------- */
91
+ .plasma-button-group > :global(.plasma-button:hover),
92
+ .plasma-button-group > :global(button:hover),
93
+ .plasma-button-group > :global(.plasma-button:focus-visible),
94
+ .plasma-button-group > :global(button:focus-visible),
95
+ .plasma-button-group > :global(.plasma-button--primary) {
96
+ z-index: 1;
97
+ }
98
+ </style>
@@ -0,0 +1,12 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ type ButtonGroupOrientation = "horizontal" | "vertical";
4
+ type ButtonGroupSize = "sm" | "md" | "lg" | "small" | "medium" | "large";
5
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "size"> {
6
+ orientation?: ButtonGroupOrientation;
7
+ size?: ButtonGroupSize;
8
+ children?: Snippet;
9
+ }
10
+ declare const ButtonGroup: import("svelte").Component<Props, {}, "">;
11
+ type ButtonGroup = ReturnType<typeof ButtonGroup>;
12
+ export default ButtonGroup;