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,191 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ type CardPadding = "none" | "sm" | "md" | "lg";
6
+ type CardVariant = "default" | "flat" | "sunken" | "floating";
7
+ type CardOrientation = "vertical" | "horizontal";
8
+
9
+ interface Props extends HTMLAttributes<HTMLDivElement> {
10
+ variant?: CardVariant;
11
+ padding?: CardPadding;
12
+ orientation?: CardOrientation;
13
+ hoverable?: boolean;
14
+ header?: Snippet;
15
+ footer?: Snippet;
16
+ children?: Snippet;
17
+ bodyClass?: string;
18
+ }
19
+
20
+ let {
21
+ variant = "default",
22
+ padding = "md",
23
+ orientation = "vertical",
24
+ hoverable = false,
25
+ header,
26
+ footer,
27
+ children,
28
+ class: customClass = "",
29
+ bodyClass = "",
30
+ ...restProps
31
+ }: Props = $props();
32
+ </script>
33
+
34
+ <div
35
+ class="plasma-card plasma-card--{variant} plasma-card--{orientation} plasma-card--padding-{padding} {customClass}"
36
+ class:plasma-card--hoverable={hoverable}
37
+ {...restProps}
38
+ >
39
+ {#if header}
40
+ <div class="plasma-card-header">
41
+ {@render header()}
42
+ </div>
43
+ {/if}
44
+
45
+ {#if children}
46
+ <div class="plasma-card-body {bodyClass}">
47
+ {@render children()}
48
+ </div>
49
+ {/if}
50
+
51
+ {#if footer}
52
+ <div class="plasma-card-footer">
53
+ {@render footer()}
54
+ </div>
55
+ {/if}
56
+ </div>
57
+
58
+ <style>
59
+ .plasma-card {
60
+ position: relative;
61
+ display: flex;
62
+ box-sizing: border-box;
63
+ font-family: var(--plasma-font-sans);
64
+ color: var(--plasma-color-text);
65
+ border-radius: var(--plasma-radius-lg);
66
+ border: 1px solid var(--plasma-color-border);
67
+ background-color: var(--plasma-color-surface);
68
+ transition: var(--plasma-transition-fast);
69
+ overflow: hidden;
70
+ }
71
+
72
+ .plasma-card--vertical {
73
+ flex-direction: column;
74
+ }
75
+
76
+ .plasma-card--horizontal {
77
+ flex-direction: row;
78
+ }
79
+
80
+ /* --------------------------------------------------------------------------
81
+ Variants
82
+ -------------------------------------------------------------------------- */
83
+ .plasma-card--default {
84
+ background-color: var(--plasma-color-surface);
85
+ box-shadow: var(--plasma-shadow-xs);
86
+ }
87
+
88
+ .plasma-card--flat {
89
+ background-color: transparent;
90
+ border-color: var(--plasma-color-border-subtle);
91
+ box-shadow: none;
92
+ }
93
+
94
+ .plasma-card--sunken {
95
+ background-color: var(--plasma-color-surface-sunken);
96
+ border-color: var(--plasma-color-border-subtle);
97
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
98
+ }
99
+
100
+ .plasma-card--floating {
101
+ background-color: var(--plasma-color-surface);
102
+ border-color: var(--plasma-color-border);
103
+ box-shadow: var(--plasma-shadow-lg);
104
+ border-radius: var(--plasma-radius-xl);
105
+ }
106
+
107
+ /* Hoverable */
108
+ .plasma-card--hoverable {
109
+ cursor: pointer;
110
+ }
111
+
112
+ .plasma-card--hoverable:hover {
113
+ border-color: var(--plasma-color-border-hover);
114
+ box-shadow: var(--plasma-shadow-md);
115
+ transform: translateY(-1px);
116
+ }
117
+
118
+ /* --------------------------------------------------------------------------
119
+ Padding Modes
120
+ -------------------------------------------------------------------------- */
121
+ .plasma-card--padding-none .plasma-card-body,
122
+ .plasma-card--padding-none .plasma-card-header,
123
+ .plasma-card--padding-none .plasma-card-footer {
124
+ padding: 0;
125
+ }
126
+
127
+ .plasma-card--padding-sm .plasma-card-body {
128
+ padding: var(--plasma-space-sm);
129
+ }
130
+ .plasma-card--padding-sm .plasma-card-header {
131
+ padding: var(--plasma-space-sm) var(--plasma-space-sm) 0 var(--plasma-space-sm);
132
+ }
133
+ .plasma-card--padding-sm .plasma-card-footer {
134
+ padding: 0 var(--plasma-space-sm) var(--plasma-space-sm) var(--plasma-space-sm);
135
+ }
136
+
137
+ .plasma-card--padding-md .plasma-card-body {
138
+ padding: var(--plasma-space-lg);
139
+ }
140
+ .plasma-card--padding-md .plasma-card-header {
141
+ padding: var(--plasma-space-lg) var(--plasma-space-lg) 0 var(--plasma-space-lg);
142
+ }
143
+ .plasma-card--padding-md .plasma-card-footer {
144
+ padding: 0 var(--plasma-space-lg) var(--plasma-space-lg) var(--plasma-space-lg);
145
+ }
146
+
147
+ .plasma-card--padding-lg .plasma-card-body {
148
+ padding: var(--plasma-space-xl);
149
+ }
150
+ .plasma-card--padding-lg .plasma-card-header {
151
+ padding: var(--plasma-space-xl) var(--plasma-space-xl) 0 var(--plasma-space-xl);
152
+ }
153
+ .plasma-card--padding-lg .plasma-card-footer {
154
+ padding: 0 var(--plasma-space-xl) var(--plasma-space-xl) var(--plasma-space-xl);
155
+ }
156
+
157
+ /* --------------------------------------------------------------------------
158
+ Sections
159
+ -------------------------------------------------------------------------- */
160
+ .plasma-card-header {
161
+ display: flex;
162
+ align-items: center;
163
+ justify-content: space-between;
164
+ font-weight: var(--plasma-font-weight-bold);
165
+ font-size: var(--plasma-font-size-md);
166
+ }
167
+
168
+ .plasma-card-body {
169
+ display: flex;
170
+ flex-direction: column;
171
+ flex: 1;
172
+ width: 100%;
173
+ height: 100%;
174
+ min-width: 0;
175
+ min-height: 0;
176
+ font-size: var(--plasma-font-size-base);
177
+ line-height: var(--plasma-line-height-base);
178
+ }
179
+
180
+ .plasma-card--horizontal > .plasma-card-body {
181
+ flex-direction: row;
182
+ align-items: stretch;
183
+ }
184
+
185
+ .plasma-card-footer {
186
+ display: flex;
187
+ align-items: center;
188
+ justify-content: flex-end;
189
+ gap: var(--plasma-space-sm);
190
+ }
191
+ </style>
@@ -0,0 +1,18 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ type CardPadding = "none" | "sm" | "md" | "lg";
4
+ type CardVariant = "default" | "flat" | "sunken" | "floating";
5
+ type CardOrientation = "vertical" | "horizontal";
6
+ interface Props extends HTMLAttributes<HTMLDivElement> {
7
+ variant?: CardVariant;
8
+ padding?: CardPadding;
9
+ orientation?: CardOrientation;
10
+ hoverable?: boolean;
11
+ header?: Snippet;
12
+ footer?: Snippet;
13
+ children?: Snippet;
14
+ bodyClass?: string;
15
+ }
16
+ declare const Card: import("svelte").Component<Props, {}, "">;
17
+ type Card = ReturnType<typeof Card>;
18
+ export default Card;
@@ -0,0 +1,199 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import type { HTMLInputAttributes } from "svelte/elements";
4
+
5
+ interface Props extends Omit<HTMLInputAttributes, "size" | "type"> {
6
+ checked?: boolean;
7
+ indeterminate?: boolean;
8
+ disabled?: boolean;
9
+ label?: string;
10
+ children?: Snippet;
11
+ }
12
+
13
+ let {
14
+ checked = $bindable(false),
15
+ indeterminate = $bindable(false),
16
+ disabled = false,
17
+ label,
18
+ children,
19
+ class: customClass = "",
20
+ id,
21
+ ...restProps
22
+ }: Props = $props();
23
+
24
+ let inputEl = $state<HTMLInputElement | null>(null);
25
+
26
+ $effect(() => {
27
+ if (inputEl) {
28
+ inputEl.indeterminate = indeterminate;
29
+ }
30
+ });
31
+
32
+ function handleChange(e: Event) {
33
+ const target = e.target as HTMLInputElement;
34
+ checked = target.checked;
35
+ if (indeterminate) {
36
+ indeterminate = false;
37
+ }
38
+ }
39
+ </script>
40
+
41
+ <label
42
+ class="plasma-checkbox-container {customClass}"
43
+ class:plasma-checkbox--disabled={disabled}
44
+ for={id}
45
+ >
46
+ <input
47
+ {id}
48
+ type="checkbox"
49
+ bind:this={inputEl}
50
+ {checked}
51
+ {disabled}
52
+ onchange={handleChange}
53
+ class="plasma-checkbox-input"
54
+ {...restProps}
55
+ />
56
+
57
+ <span
58
+ class="plasma-checkbox-box"
59
+ class:plasma-checkbox-box--checked={checked}
60
+ class:plasma-checkbox-box--indeterminate={indeterminate}
61
+ >
62
+ <!-- Always rendered in DOM to eliminate any layout reflow/shift and enable smooth scaling -->
63
+ <svg
64
+ role="img"
65
+ aria-label="indeterminate-icon"
66
+ viewBox="0 0 16 16"
67
+ width="10"
68
+ height="10"
69
+ fill="currentColor"
70
+ class="plasma-checkbox-icon plasma-checkbox-icon--indeterminate"
71
+ >
72
+ <rect x="2" y="6.5" width="12" height="3" rx="1" />
73
+ </svg>
74
+
75
+ <svg
76
+ role="img"
77
+ aria-label="checked-icon"
78
+ viewBox="0 0 16 16"
79
+ width="11"
80
+ height="11"
81
+ fill="none"
82
+ stroke="currentColor"
83
+ stroke-width="2.5"
84
+ stroke-linecap="round"
85
+ stroke-linejoin="round"
86
+ class="plasma-checkbox-icon plasma-checkbox-icon--check"
87
+ >
88
+ <path d="M3.5 8.5l3 3 6-6" />
89
+ </svg>
90
+ </span>
91
+
92
+ {#if children}
93
+ <span class="plasma-checkbox-label">
94
+ {@render children()}
95
+ </span>
96
+ {:else if label}
97
+ <span class="plasma-checkbox-label">
98
+ {label}
99
+ </span>
100
+ {/if}
101
+ </label>
102
+
103
+ <style>
104
+ .plasma-checkbox-container {
105
+ display: inline-flex;
106
+ align-items: center;
107
+ gap: var(--plasma-space-sm);
108
+ cursor: pointer;
109
+ font-family: var(--plasma-font-sans);
110
+ font-size: var(--plasma-font-size-base);
111
+ color: var(--plasma-color-text);
112
+ user-select: none;
113
+ line-height: 1.2;
114
+ }
115
+
116
+ .plasma-checkbox--disabled {
117
+ opacity: 0.45;
118
+ cursor: not-allowed;
119
+ }
120
+
121
+ /* Visually hide native input while keeping it accessible */
122
+ .plasma-checkbox-input {
123
+ position: absolute;
124
+ opacity: 0;
125
+ width: 0;
126
+ height: 0;
127
+ margin: 0;
128
+ pointer-events: none;
129
+ }
130
+
131
+ /* Custom Breeze Checkbox Box */
132
+ .plasma-checkbox-box {
133
+ position: relative;
134
+ display: inline-flex;
135
+ align-items: center;
136
+ justify-content: center;
137
+ width: 16px;
138
+ height: 16px;
139
+ border-radius: var(--plasma-radius-sm);
140
+ border: 1px solid var(--plasma-color-border);
141
+ background-color: var(--plasma-color-view-bg);
142
+ color: #ffffff;
143
+ flex-shrink: 0;
144
+ overflow: hidden;
145
+ transition: var(--plasma-transition-fast);
146
+ }
147
+
148
+ .plasma-checkbox-container:hover:not(.plasma-checkbox--disabled)
149
+ .plasma-checkbox-box {
150
+ border-color: var(--plasma-color-border-hover);
151
+ }
152
+
153
+ .plasma-checkbox-input:focus-visible + .plasma-checkbox-box {
154
+ outline: 2px solid var(--plasma-color-highlight);
155
+ outline-offset: 2px;
156
+ box-shadow: var(--plasma-shadow-focus);
157
+ }
158
+
159
+ /* Checked & Indeterminate box styling */
160
+ .plasma-checkbox-box--checked,
161
+ .plasma-checkbox-box--indeterminate {
162
+ background-color: var(--plasma-color-highlight);
163
+ border-color: var(--plasma-color-highlight-hover);
164
+ }
165
+
166
+ .plasma-checkbox-container:hover:not(.plasma-checkbox--disabled)
167
+ .plasma-checkbox-box--checked,
168
+ .plasma-checkbox-container:hover:not(.plasma-checkbox--disabled)
169
+ .plasma-checkbox-box--indeterminate {
170
+ background-color: var(--plasma-color-highlight-hover);
171
+ border-color: var(--plasma-color-highlight-active);
172
+ }
173
+
174
+ /* Icons: zero layout shift, smooth transform and opacity transitions */
175
+ .plasma-checkbox-icon {
176
+ position: absolute;
177
+ pointer-events: none;
178
+ transform: scale(0);
179
+ opacity: 0;
180
+ transition:
181
+ transform var(--plasma-duration-fast) var(--plasma-ease-default),
182
+ opacity var(--plasma-duration-fast) var(--plasma-ease-default);
183
+ }
184
+
185
+ .plasma-checkbox-box--checked:not(.plasma-checkbox-box--indeterminate)
186
+ .plasma-checkbox-icon--check {
187
+ transform: scale(1);
188
+ opacity: 1;
189
+ }
190
+
191
+ .plasma-checkbox-box--indeterminate .plasma-checkbox-icon--indeterminate {
192
+ transform: scale(1);
193
+ opacity: 1;
194
+ }
195
+
196
+ .plasma-checkbox-label {
197
+ display: inline-block;
198
+ }
199
+ </style>
@@ -0,0 +1,12 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLInputAttributes } from "svelte/elements";
3
+ interface Props extends Omit<HTMLInputAttributes, "size" | "type"> {
4
+ checked?: boolean;
5
+ indeterminate?: boolean;
6
+ disabled?: boolean;
7
+ label?: string;
8
+ children?: Snippet;
9
+ }
10
+ declare const Checkbox: import("svelte").Component<Props, {}, "checked" | "indeterminate">;
11
+ type Checkbox = ReturnType<typeof Checkbox>;
12
+ export default Checkbox;