@studiocms/ui 0.3.2 → 0.4.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 (156) hide show
  1. package/dist/components/Accordion/Accordion.astro +23 -0
  2. package/dist/components/Accordion/Item.astro +21 -0
  3. package/dist/components/Accordion/accordion.css +64 -0
  4. package/dist/components/Accordion/accordion.d.ts +1 -0
  5. package/dist/components/Accordion/accordion.js +70 -0
  6. package/dist/components/Badge/Badge.astro +49 -0
  7. package/dist/components/Badge/badge.css +111 -0
  8. package/dist/components/Breadcrumbs/Breadcrumbs.astro +31 -0
  9. package/dist/components/Breadcrumbs/breadcrumbs.css +15 -0
  10. package/dist/components/Button/Button.astro +75 -0
  11. package/dist/components/Button/button.css +292 -0
  12. package/{src/components → dist/components/Card}/Card.astro +1 -48
  13. package/dist/components/Card/card.css +38 -0
  14. package/dist/components/Center/Center.astro +7 -0
  15. package/dist/components/Center/center.css +8 -0
  16. package/dist/components/Checkbox/Checkbox.astro +95 -0
  17. package/dist/components/Checkbox/checkbox.css +119 -0
  18. package/dist/components/Checkbox/checkbox.d.ts +2 -0
  19. package/dist/components/Checkbox/checkbox.js +20 -0
  20. package/{src/components → dist/components/Divider}/Divider.astro +2 -25
  21. package/dist/components/Divider/divider.css +21 -0
  22. package/dist/components/Dropdown/Dropdown.astro +116 -0
  23. package/dist/components/Dropdown/dropdown.css +180 -0
  24. package/dist/components/Dropdown/dropdown.d.ts +48 -0
  25. package/dist/components/Dropdown/dropdown.js +201 -0
  26. package/dist/components/Footer/Footer.astro +58 -0
  27. package/dist/components/Footer/footer.css +68 -0
  28. package/dist/components/Group/Group.astro +7 -0
  29. package/dist/components/Group/group.css +19 -0
  30. package/{src/utils → dist/components/Icon}/Icon.astro +1 -1
  31. package/{src/utils/iconType.ts → dist/components/Icon/iconType.d.ts} +0 -1
  32. package/dist/components/Icon/iconType.js +0 -0
  33. package/{src/components → dist/components/Input}/Input.astro +2 -48
  34. package/dist/components/Input/input.css +38 -0
  35. package/{src → dist}/components/Modal/Modal.astro +4 -122
  36. package/dist/components/Modal/modal.css +100 -0
  37. package/dist/components/Modal/modal.d.ts +48 -0
  38. package/dist/components/Modal/modal.js +129 -0
  39. package/dist/components/Progress/Progress.astro +21 -0
  40. package/dist/components/Progress/helper.d.ts +13 -0
  41. package/dist/components/Progress/helper.js +32 -0
  42. package/dist/components/Progress/progress.css +29 -0
  43. package/dist/components/Progress/progress.d.ts +1 -0
  44. package/dist/components/Progress/progress.js +10 -0
  45. package/dist/components/RadioGroup/RadioGroup.astro +124 -0
  46. package/dist/components/RadioGroup/radiogroup.css +96 -0
  47. package/dist/components/RadioGroup/radiogroup.d.ts +1 -0
  48. package/dist/components/RadioGroup/radiogroup.js +48 -0
  49. package/{src/components → dist/components/Row}/Row.astro +1 -24
  50. package/dist/components/Row/row.css +18 -0
  51. package/dist/components/SearchSelect/SearchSelect.astro +135 -0
  52. package/dist/components/SearchSelect/searchselect.css +95 -0
  53. package/dist/components/SearchSelect/searchselect.d.ts +6 -0
  54. package/dist/components/SearchSelect/searchselect.js +166 -0
  55. package/dist/components/Select/Select.astro +147 -0
  56. package/dist/components/Select/select.css +110 -0
  57. package/dist/components/Select/select.d.ts +1 -0
  58. package/dist/components/Select/select.js +143 -0
  59. package/dist/components/Sidebar/helpers.d.ts +76 -0
  60. package/dist/components/Sidebar/helpers.js +160 -0
  61. package/{src → dist}/components/Tabs/TabItem.astro +3 -3
  62. package/dist/components/Tabs/Tabs.astro +150 -0
  63. package/dist/components/Tabs/tabs.css +121 -0
  64. package/dist/components/Tabs/tabs.d.ts +1 -0
  65. package/dist/components/Tabs/tabs.js +82 -0
  66. package/{src/components → dist/components/Textarea}/Textarea.astro +2 -61
  67. package/dist/components/Textarea/textarea.css +49 -0
  68. package/dist/components/ThemeToggle/ThemeToggle.astro +21 -0
  69. package/dist/components/ThemeToggle/themetoggle.css +17 -0
  70. package/dist/components/ThemeToggle/themetoggle.d.ts +1 -0
  71. package/dist/components/ThemeToggle/themetoggle.js +4 -0
  72. package/dist/components/Toast/Toaster.astro +69 -0
  73. package/dist/components/Toast/toast.d.ts +8 -0
  74. package/dist/components/Toast/toast.js +9 -0
  75. package/dist/components/Toast/toaster.css +168 -0
  76. package/dist/components/Toast/toaster.d.ts +1 -0
  77. package/dist/components/Toast/toaster.js +160 -0
  78. package/dist/components/Toggle/Toggle.astro +84 -0
  79. package/dist/components/Toggle/toggle.css +93 -0
  80. package/dist/components/Toggle/toggle.d.ts +2 -0
  81. package/dist/components/Toggle/toggle.js +20 -0
  82. package/{src/components → dist/components/User}/User.astro +3 -43
  83. package/dist/components/User/user.css +35 -0
  84. package/dist/css/colors.css +95 -0
  85. package/dist/css/global.css +3 -0
  86. package/dist/css/radii.css +6 -0
  87. package/dist/css/resets.css +46 -0
  88. package/dist/index.d.ts +12 -0
  89. package/dist/index.js +379 -0
  90. package/dist/toolbar/ColorPicker.d.ts +7 -0
  91. package/dist/toolbar/ColorPicker.js +85 -0
  92. package/dist/toolbar/icon.d.ts +1 -0
  93. package/dist/toolbar/icon.js +4 -0
  94. package/dist/toolbar/index.d.ts +2 -0
  95. package/dist/toolbar/index.js +292 -0
  96. package/dist/types/index.d.ts +11 -0
  97. package/dist/types/index.js +0 -0
  98. package/dist/utils/ThemeHelper.d.ts +49 -0
  99. package/dist/utils/ThemeHelper.js +113 -0
  100. package/{src/utils/colors.ts → dist/utils/colors.d.ts} +1 -1
  101. package/dist/utils/colors.js +0 -0
  102. package/dist/utils/generateID.d.ts +2 -0
  103. package/dist/utils/generateID.js +6 -0
  104. package/dist/utils/headers.d.ts +43 -0
  105. package/dist/utils/headers.js +129 -0
  106. package/dist/utils/iconStrings.d.ts +4 -0
  107. package/dist/utils/iconStrings.js +13 -0
  108. package/dist/utils/integration-utils.d.ts +130 -0
  109. package/dist/utils/integration-utils.js +161 -0
  110. package/package.json +26 -10
  111. package/src/components/BaseHead.astro +0 -22
  112. package/src/components/Button.astro +0 -372
  113. package/src/components/Center.astro +0 -16
  114. package/src/components/Checkbox.astro +0 -250
  115. package/src/components/Dropdown/Dropdown.astro +0 -314
  116. package/src/components/Dropdown/dropdown.ts +0 -258
  117. package/src/components/Dropdown/index.ts +0 -2
  118. package/src/components/Footer.astro +0 -137
  119. package/src/components/Modal/index.ts +0 -2
  120. package/src/components/Modal/modal.ts +0 -163
  121. package/src/components/RadioGroup.astro +0 -299
  122. package/src/components/SearchSelect.astro +0 -486
  123. package/src/components/Select.astro +0 -467
  124. package/src/components/Sidebar/helpers.ts +0 -179
  125. package/src/components/Sidebar/index.ts +0 -3
  126. package/src/components/Tabs/Tabs.astro +0 -393
  127. package/src/components/Tabs/index.ts +0 -2
  128. package/src/components/ThemeToggle.astro +0 -46
  129. package/src/components/Toast/Toaster.astro +0 -470
  130. package/src/components/Toast/index.ts +0 -2
  131. package/src/components/Toast/toast.ts +0 -16
  132. package/src/components/Toggle.astro +0 -214
  133. package/src/components/index.ts +0 -27
  134. package/src/components.ts +0 -26
  135. package/src/css/colors.css +0 -106
  136. package/src/css/global.css +0 -2
  137. package/src/css/resets.css +0 -54
  138. package/src/env.d.ts +0 -15
  139. package/src/integration.ts +0 -31
  140. package/src/layouts/RootLayout.astro +0 -33
  141. package/src/layouts/index.ts +0 -2
  142. package/src/layouts.ts +0 -1
  143. package/src/types/index.ts +0 -11
  144. package/src/utils/ThemeHelper.ts +0 -145
  145. package/src/utils/create-resolver.ts +0 -30
  146. package/src/utils/generateID.ts +0 -5
  147. package/src/utils/headers.ts +0 -190
  148. package/src/utils/iconStrings.ts +0 -29
  149. package/src/utils/index.ts +0 -1
  150. package/src/utils/virtual-module-plugin-builder.ts +0 -37
  151. /package/{src → dist}/components/Sidebar/Double.astro +0 -0
  152. /package/{src → dist}/components/Sidebar/Single.astro +0 -0
  153. /package/{src → dist}/icons/Checkmark.astro +0 -0
  154. /package/{src → dist}/icons/ChevronUpDown.astro +0 -0
  155. /package/{src → dist}/icons/User.astro +0 -0
  156. /package/{src → dist}/icons/X-Mark.astro +0 -0
@@ -0,0 +1,292 @@
1
+ .sui-button {
2
+ display: flex;
3
+ flex-direction: row;
4
+ align-items: center;
5
+ text-align: center;
6
+ position: relative;
7
+ gap: 0.5rem;
8
+ outline: none;
9
+ border: none;
10
+ font-weight: 400;
11
+ border-radius: var(--radius-md);
12
+ transition:
13
+ transform 0.15s,
14
+ background-color 0.15s,
15
+ border-color 0.15s,
16
+ color 0.15s;
17
+ transition-timing-function: ease;
18
+ cursor: pointer;
19
+ background-color: hsl(var(--default-base));
20
+ border-color: hsl(var(--border));
21
+ color: hsl(var(--text-normal));
22
+ min-width: fit-content;
23
+ will-change: transform;
24
+ text-decoration: none;
25
+ }
26
+ .sui-button.disabled {
27
+ pointer-events: none;
28
+ opacity: 0.5;
29
+ }
30
+ .sui-button.outlined {
31
+ border-width: 1px;
32
+ border-style: solid;
33
+ }
34
+ .sui-button.outlined:hover {
35
+ background-color: hsl(var(--default-hover));
36
+ }
37
+ .sui-button.outlined:active {
38
+ background-color: hsl(var(--default-hover));
39
+ }
40
+ .sui-button:hover {
41
+ background-color: hsl(var(--default-hover));
42
+ }
43
+ .sui-button:active {
44
+ background-color: hsl(var(--default-active));
45
+ transform: scale(0.95);
46
+ }
47
+ .sui-button.flat {
48
+ background: hsla(var(--default-flat));
49
+ }
50
+ .sui-button.flat:hover {
51
+ background: hsla(var(--default-flat-hover));
52
+ }
53
+ .sui-button.flat:active {
54
+ background: hsla(var(--default-flat-active));
55
+ }
56
+ .sui-button.sm {
57
+ height: 32px;
58
+ padding: 0.5rem 0.75rem;
59
+ font-size: 0.825em;
60
+ }
61
+ .sui-button.md {
62
+ height: 40px;
63
+ padding: 0.5rem 0.75rem;
64
+ font-size: 0.875em;
65
+ }
66
+ .sui-button.lg {
67
+ height: 48px;
68
+ padding: 0.75rem 1rem;
69
+ font-size: 1em;
70
+ }
71
+ .sui-button:focus-visible {
72
+ outline: 2px solid hsl(var(--text-normal));
73
+ outline-offset: 2px;
74
+ }
75
+ .sui-button.primary {
76
+ background-color: hsl(var(--primary-base));
77
+ border-color: hsl(var(--primary-base));
78
+ color: hsl(var(--text-inverted));
79
+ }
80
+ .sui-button.primary:hover {
81
+ background-color: hsl(var(--primary-hover));
82
+ }
83
+ .sui-button.primary:active {
84
+ background-color: hsl(var(--primary-active));
85
+ }
86
+ .sui-button.primary.outlined {
87
+ background-color: hsl(var(--default-base));
88
+ color: hsl(var(--text-normal));
89
+ }
90
+ .sui-button.primary.outlined:hover {
91
+ background-color: hsl(var(--default-hover));
92
+ }
93
+ .sui-button.primary.outlined:active {
94
+ background-color: hsl(var(--default-active));
95
+ }
96
+ .sui-button.primary.flat {
97
+ background-color: hsla(var(--primary-flat));
98
+ color: hsl(259, 96%, 79%);
99
+ }
100
+ .sui-button.primary.flat:hover {
101
+ background-color: hsla(var(--primary-flat-hover));
102
+ }
103
+ .sui-button.primary.flat:active {
104
+ background-color: hsla(var(--primary-flat-active));
105
+ }
106
+ .sui-button.success {
107
+ background-color: hsl(var(--success-base));
108
+ border-color: hsl(var(--success-base));
109
+ color: hsl(var(--text-dark));
110
+ }
111
+ .sui-button.success:hover {
112
+ background-color: hsl(var(--success-hover));
113
+ }
114
+ .sui-button.success:active {
115
+ background-color: hsl(var(--success-active));
116
+ }
117
+ .sui-button.success.outlined {
118
+ background-color: hsl(var(--default-base));
119
+ color: hsl(var(--text-normal));
120
+ }
121
+ .sui-button.success.outlined:hover {
122
+ background-color: hsl(var(--default-hover));
123
+ }
124
+ .sui-button.success.outlined:active {
125
+ background-color: hsl(var(--default-active));
126
+ }
127
+ .sui-button.success.flat {
128
+ background-color: hsla(var(--success-flat));
129
+ color: hsl(var(--success-base));
130
+ }
131
+ .sui-button.success.flat:hover {
132
+ background-color: hsla(var(--success-flat-hover));
133
+ }
134
+ .sui-button.success.flat:active {
135
+ background-color: hsla(var(--success-flat-active));
136
+ }
137
+ .sui-button.warning {
138
+ background-color: hsl(var(--warning-base));
139
+ border-color: hsl(var(--warning-base));
140
+ color: hsl(var(--text-dark));
141
+ }
142
+ .sui-button.warning:hover {
143
+ background-color: hsl(var(--warning-hover));
144
+ }
145
+ .sui-button.warning:active {
146
+ background-color: hsl(var(--warning-active));
147
+ }
148
+ .sui-button.warning.outlined {
149
+ background-color: hsl(var(--default-base));
150
+ color: hsl(var(--text-normal));
151
+ }
152
+ .sui-button.warning.outlined:hover {
153
+ background-color: hsl(var(--default-hover));
154
+ }
155
+ .sui-button.warning.outlined:active {
156
+ background-color: hsl(var(--default-active));
157
+ }
158
+ .sui-button.warning.flat {
159
+ background-color: hsla(var(--warning-flat));
160
+ color: hsl(var(--warning-base));
161
+ }
162
+ .sui-button.warning.flat:hover {
163
+ background-color: hsla(var(--warning-flat-hover));
164
+ }
165
+ .sui-button.warning.flat:active {
166
+ background-color: hsla(var(--warning-flat-active));
167
+ }
168
+ .sui-button.danger {
169
+ background-color: hsl(var(--danger-base));
170
+ border-color: hsl(var(--danger-base));
171
+ color: hsl(var(--text-light));
172
+ }
173
+ .sui-button.danger:hover {
174
+ background-color: hsl(var(--danger-hover));
175
+ }
176
+ .sui-button.danger:active {
177
+ background-color: hsl(var(--danger-active));
178
+ }
179
+ .sui-button.danger.outlined {
180
+ background-color: hsl(var(--default-base));
181
+ color: hsl(var(--text-normal));
182
+ }
183
+ .sui-button.danger.outlined:hover {
184
+ background-color: hsl(var(--default-hover));
185
+ }
186
+ .sui-button.danger.outlined:active {
187
+ background-color: hsl(var(--default-active));
188
+ }
189
+ .sui-button.danger.flat {
190
+ background-color: hsla(var(--danger-flat));
191
+ color: hsl(337, 92%, 71%);
192
+ }
193
+ .sui-button.danger.flat:hover {
194
+ background-color: hsla(var(--danger-flat-hover));
195
+ }
196
+ .sui-button.danger.flat:active {
197
+ background-color: hsla(var(--danger-flat-active));
198
+ }
199
+ .sui-button.info {
200
+ background-color: hsl(var(--info-base));
201
+ border-color: hsl(var(--info-base));
202
+ color: hsl(var(--text-light));
203
+ }
204
+ .sui-button.info:hover {
205
+ background-color: hsl(var(--info-hover));
206
+ }
207
+ .sui-button.info:active {
208
+ background-color: hsl(var(--info-active));
209
+ }
210
+ .sui-button.info.outlined {
211
+ background-color: hsl(var(--default-base));
212
+ color: hsl(var(--text-normal));
213
+ }
214
+ .sui-button.info.outlined:hover {
215
+ background-color: hsl(var(--default-hover));
216
+ }
217
+ .sui-button.info.outlined:active {
218
+ background-color: hsl(var(--default-active));
219
+ }
220
+ .sui-button.info.flat {
221
+ background-color: hsla(var(--info-flat));
222
+ color: hsl(var(--info-base));
223
+ }
224
+ .sui-button.info.flat:hover {
225
+ background-color: hsla(var(--info-flat-hover));
226
+ }
227
+ .sui-button.info.flat:active {
228
+ background-color: hsla(var(--info-flat-active));
229
+ }
230
+ .sui-button.mono {
231
+ background-color: hsl(var(--mono-base));
232
+ border-color: hsl(var(--mono-base));
233
+ color: hsl(var(--text-inverted));
234
+ }
235
+ .sui-button.mono:hover {
236
+ background-color: hsl(var(--mono-hover));
237
+ }
238
+ .sui-button.mono:active {
239
+ background-color: hsl(var(--mono-active));
240
+ }
241
+ .sui-button.mono.outlined {
242
+ background-color: hsl(var(--default-base));
243
+ color: hsl(var(--text-normal));
244
+ }
245
+ .sui-button.mono.outlined:hover {
246
+ background-color: hsl(var(--default-hover));
247
+ }
248
+ .sui-button.mono.outlined:active {
249
+ background-color: hsl(var(--default-active));
250
+ }
251
+ .sui-button.mono.flat {
252
+ background-color: hsla(var(--mono-flat));
253
+ color: hsl(var(--mono-base));
254
+ }
255
+ .sui-button.mono.flat:hover {
256
+ background-color: hsla(var(--mono-flat-hover));
257
+ }
258
+ .sui-button.mono.flat:active {
259
+ background-color: hsla(var(--mono-flat-active));
260
+ }
261
+ .sui-button.full {
262
+ width: 100%;
263
+ justify-content: center;
264
+ }
265
+ [data-theme=light] {
266
+ .sui-button.primary.flat {
267
+ color: hsl(259, 84%, 45%);
268
+ }
269
+ .sui-button.success.flat {
270
+ background-color: hsl(var(--success-base), 0.2);
271
+ color: hsl(143, 59%, 20%);
272
+ }
273
+ .sui-button.success.flat:hover {
274
+ background-color: hsla(var(--success-flat-hover));
275
+ }
276
+ .sui-button.success.flat:active {
277
+ background-color: hsla(var(--success-flat-active));
278
+ }
279
+ .sui-button.warning.flat {
280
+ background-color: hsla(var(--warning-base), 0.2);
281
+ color: hsl(48, 78%, 20%);
282
+ }
283
+ .sui-button.warning.flat:hover {
284
+ background-color: hsla(var(--warning-base), 0.25);
285
+ }
286
+ .sui-button.warning.flat:active {
287
+ background-color: hsla(var(--warning-base), 0.4);
288
+ }
289
+ .sui-button.danger.flat {
290
+ color: hsl(339, 97%, 29%);
291
+ }
292
+ }
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import './card.css';
3
4
 
4
5
  /**
5
6
  * Props for the card component.
@@ -36,51 +37,3 @@ const { as: As = 'div', fullWidth, fullHeight, variant = 'default', ...props } =
36
37
  <slot name="footer" />
37
38
  </div>
38
39
  </As>
39
- <style>
40
- .sui-card {
41
- border: 1px solid hsl(var(--border));
42
- background-color: hsl(var(--background-base));
43
- border-radius: .5rem;
44
- width: fit-content;
45
- height: fit-content;
46
- }
47
-
48
- .sui-card.filled {
49
- background-color: hsl(var(--background-step-3));
50
- border: none;
51
- }
52
-
53
- .sui-card.full-w {
54
- width: 100%;
55
- }
56
-
57
- .sui-card.full-h {
58
- height: 100%;
59
- }
60
-
61
- .sui-card-header:has(*) {
62
- padding: 1rem 1rem 0rem 1rem;
63
- * {
64
- margin: 0;
65
- }
66
- }
67
-
68
- .sui-card-body {
69
- padding: 1rem;
70
- }
71
-
72
- .sui-card-footer:has(*) {
73
- border-top: 1px solid hsl(var(--border));
74
- padding: 1rem;
75
- }
76
-
77
- .filled .sui-card-footer {
78
- border: none;
79
- }
80
-
81
- @media screen and (max-width: 840px) {
82
- .sui-card {
83
- width: 100%;
84
- }
85
- }
86
- </style>
@@ -0,0 +1,38 @@
1
+ .sui-card {
2
+ border: 1px solid hsl(var(--border));
3
+ background-color: hsl(var(--background-base));
4
+ border-radius: var(--radius-md);
5
+ width: fit-content;
6
+ height: fit-content;
7
+ }
8
+ .sui-card.filled {
9
+ background-color: hsl(var(--background-step-3));
10
+ border: none;
11
+ }
12
+ .sui-card.full-w {
13
+ width: 100%;
14
+ }
15
+ .sui-card.full-h {
16
+ height: 100%;
17
+ }
18
+ .sui-card-header:has(*) {
19
+ padding: 1rem 1rem 0rem 1rem;
20
+ * {
21
+ margin: 0;
22
+ }
23
+ }
24
+ .sui-card-body {
25
+ padding: 1rem;
26
+ }
27
+ .sui-card-footer:has(*) {
28
+ border-top: 1px solid hsl(var(--border));
29
+ padding: 1rem;
30
+ }
31
+ .filled .sui-card-footer {
32
+ border: none;
33
+ }
34
+ @media screen and (max-width: 840px) {
35
+ .sui-card {
36
+ width: 100%;
37
+ }
38
+ }
@@ -0,0 +1,7 @@
1
+ ---
2
+ import './center.css';
3
+ ---
4
+ <!-- This was made for Jumper, to keep him happy <3 -->
5
+ <div class="sui-center">
6
+ <slot />
7
+ </div>
@@ -0,0 +1,8 @@
1
+ .sui-center {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ width: 100%;
6
+ height: 100%;
7
+ text-align: center;
8
+ }
@@ -0,0 +1,95 @@
1
+ ---
2
+ import Checkmark from '../../icons/Checkmark.astro';
3
+ import type { StudioCMSColorway } from '../../utils/colors.js';
4
+ import { generateID } from '../../utils/generateID.js';
5
+ import './checkbox.css';
6
+
7
+ /**
8
+ * The props for the Checkbox component.
9
+ */
10
+ interface Props {
11
+ /**
12
+ * The label of the checkbox.
13
+ */
14
+ label: string;
15
+ /**
16
+ * The size of the checkbox. Defaults to `md`.
17
+ */
18
+ size?: 'sm' | 'md' | 'lg';
19
+ /**
20
+ * The color of the checkbox. Defaults to `default`.
21
+ */
22
+ color?: StudioCMSColorway;
23
+ /**
24
+ * Whether the checkbox is checked by default.
25
+ */
26
+ defaultChecked?: boolean;
27
+ /**
28
+ * Whether the checkbox is disabled.
29
+ */
30
+ disabled?: boolean;
31
+ /**
32
+ * The name of the checkbox.
33
+ */
34
+ name?: string;
35
+ /**
36
+ * Whether the checkbox is required.
37
+ */
38
+ isRequired?: boolean;
39
+ }
40
+
41
+ const {
42
+ size = 'md',
43
+ color = 'default',
44
+ defaultChecked,
45
+ disabled,
46
+ name = generateID('checkbox'),
47
+ label,
48
+ isRequired,
49
+ } = Astro.props;
50
+
51
+ const iconSizes = {
52
+ sm: 14,
53
+ md: 16,
54
+ lg: 24,
55
+ };
56
+ ---
57
+ <label
58
+ class="sui-checkmark-label"
59
+ for={name}
60
+ class:list={[
61
+ disabled && "disabled",
62
+ color,
63
+ size,
64
+ ]}
65
+ >
66
+ <div
67
+ class="sui-checkmark-container"
68
+ tabindex="0"
69
+ role="checkbox"
70
+ aria-checked={defaultChecked}
71
+ aria-labelledby={`label-${name}`}
72
+ >
73
+ <Checkmark
74
+ class={'sui-checkmark'}
75
+ width={iconSizes[size]}
76
+ height={iconSizes[size]}
77
+ />
78
+ <input
79
+ type="checkbox"
80
+ name={name}
81
+ id={name}
82
+ checked={defaultChecked}
83
+ disabled={disabled}
84
+ required={isRequired}
85
+ class="sui-checkbox"
86
+ hidden
87
+ />
88
+ </div>
89
+ <span id={`label-${name}`}>
90
+ {label} <span class="req-star">{isRequired && "*"}</span>
91
+ </span>
92
+ </label>
93
+ <script>
94
+ import "studiocms:ui/scripts/checkbox"
95
+ </script>
@@ -0,0 +1,119 @@
1
+ .sui-checkmark-label {
2
+ display: flex;
3
+ flex-direction: row;
4
+ align-items: center;
5
+ gap: .5rem;
6
+ position: relative;
7
+ margin: .25rem 0;
8
+ }
9
+ .sui-checkmark-label.disabled {
10
+ opacity: 0.5;
11
+ pointer-events: none;
12
+ color: hsl(var(--text-muted));
13
+ }
14
+ .sui-checkmark-container {
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ background-color: hsl(var(--default-base));
19
+ border: 2px solid hsl(var(--default-base));
20
+ border-radius: var(--radius-md);
21
+ cursor: pointer;
22
+ transition:
23
+ background-color .15s,
24
+ border .15s,
25
+ transform .15s;
26
+ transition-timing-function: ease;
27
+ }
28
+ .sui-checkmark-container:focus-visible {
29
+ outline: 2px solid hsl(var(--text-normal));
30
+ outline-offset: 2px;
31
+ }
32
+ .sui-checkmark-label:hover .sui-checkmark-container {
33
+ background-color: hsl(var(--default-hover));
34
+ }
35
+ .sui-checkmark-label:active .sui-checkmark-container {
36
+ background-color: hsl(var(--default-active));
37
+ scale: 0.9;
38
+ }
39
+ .sui-checkmark-label.sm {
40
+ font-size: .875em;
41
+ }
42
+ .sui-checkmark-label.sm .sui-checkmark-container {
43
+ width: 1.25rem;
44
+ height: 1.25rem;
45
+ }
46
+ .sui-checkmark-label.md .sui-checkmark-container {
47
+ width: 1.5rem;
48
+ height: 1.5rem;
49
+ }
50
+ .sui-checkmark-label.lg {
51
+ font-size: 1.125em;
52
+ }
53
+ .sui-checkmark-label.lg .sui-checkmark-container {
54
+ width: 1.75rem;
55
+ height: 1.75rem;
56
+ padding: .125rem;
57
+ }
58
+ .primary .sui-checkmark-container:has(.sui-checkbox:checked) {
59
+ border-color: hsl(var(--primary-base));
60
+ background-color: hsl(var(--primary-base));
61
+ }
62
+ .success .sui-checkmark-container:has(.sui-checkbox:checked) {
63
+ border-color: hsl(var(--success-base));
64
+ background-color: hsl(var(--success-base));
65
+ }
66
+ .warning .sui-checkmark-container:has(.sui-checkbox:checked) {
67
+ border-color: hsl(var(--warning-base));
68
+ background-color: hsl(var(--warning-base));
69
+ }
70
+ .danger .sui-checkmark-container:has(.sui-checkbox:checked) {
71
+ border-color: hsl(var(--danger-base));
72
+ background-color: hsl(var(--danger-base));
73
+ }
74
+ .info .sui-checkmark-container:has(.sui-checkbox:checked) {
75
+ border-color: hsl(var(--info-base));
76
+ background-color: hsl(var(--info-base));
77
+ }
78
+ .mono .sui-checkmark-container:has(.sui-checkbox:checked) {
79
+ border-color: hsl(var(--mono-base));
80
+ background-color: hsl(var(--mono-base));
81
+ }
82
+ .req-star {
83
+ color: hsl(var(--danger-base));
84
+ font-weight: 700;
85
+ }
86
+ .sui-checkbox {
87
+ width: 0;
88
+ height: 0;
89
+ visibility: hidden;
90
+ opacity: 0;
91
+ margin: 0;
92
+ }
93
+ .sui-checkmark polyline {
94
+ transition: all .15s ease;
95
+ color: hsl(var(--text-normal));
96
+ }
97
+ .primary .sui-checkmark polyline {
98
+ color: hsl(var(--text-inverted));
99
+ }
100
+ .success .sui-checkmark polyline {
101
+ color: hsl(var(--text-dark));
102
+ }
103
+ .warning .sui-checkmark polyline {
104
+ color: hsl(var(--text-dark));
105
+ }
106
+ .danger .sui-checkmark polyline {
107
+ color: hsl(var(--text-light));
108
+ }
109
+ .info .sui-checkmark polyline {
110
+ color: hsl(var(--text-light));
111
+ }
112
+ .mono .sui-checkmark polyline {
113
+ color: hsl(var(--text-inverted));
114
+ }
115
+ .sui-checkmark-container:has(.sui-checkbox:checked) {
116
+ .sui-checkmark polyline {
117
+ stroke-dashoffset: 44;
118
+ }
119
+ }
@@ -0,0 +1,2 @@
1
+ declare const allElements: NodeListOf<HTMLDivElement>;
2
+ declare const allCheckbox: NodeListOf<HTMLInputElement>;
@@ -0,0 +1,20 @@
1
+ const allElements = document.querySelectorAll(".sui-checkmark-container");
2
+ const allCheckbox = document.querySelectorAll(".sui-checkbox");
3
+ for (const element of allElements) {
4
+ if (element.dataset.initialized) continue;
5
+ element.dataset.initialized = "true";
6
+ element.addEventListener("keydown", (e) => {
7
+ if (e.key !== "Enter" && e.key !== " ") return;
8
+ e.preventDefault();
9
+ const checkbox = element.querySelector(".sui-checkbox");
10
+ if (!checkbox) return;
11
+ checkbox.click();
12
+ });
13
+ }
14
+ for (const box of allCheckbox) {
15
+ if (box.dataset.initialized) continue;
16
+ box.dataset.initialized = "true";
17
+ box.addEventListener("change", (e) => {
18
+ box.parentElement.ariaChecked = e.target.checked ? "true" : "false";
19
+ });
20
+ }
@@ -1,4 +1,6 @@
1
1
  ---
2
+ import './divider.css';
3
+
2
4
  /**
3
5
  * Props for the divider component.
4
6
  */
@@ -22,28 +24,3 @@ const { background = 'background-base' } = Astro.props;
22
24
  <slot />
23
25
  </div>
24
26
  </div>
25
- <style>
26
- .sui-divider-container {
27
- display: flex;
28
- width: 100%;
29
- align-items: center;
30
- justify-content: center;
31
- position: relative;
32
- }
33
-
34
- .sui-divider-line {
35
- position: absolute;
36
- left: 50%;
37
- transform: translate(-50%, 0);
38
- width: 100%;
39
- height: 1px;
40
- background-color: hsl(var(--border));
41
- z-index: 1;
42
- border: none;
43
- }
44
-
45
- .sui-divider-content {
46
- z-index: 2;
47
- color: hsl(var(--text-muted));
48
- }
49
- </style>
@@ -0,0 +1,21 @@
1
+ .sui-divider-container {
2
+ display: flex;
3
+ width: 100%;
4
+ align-items: center;
5
+ justify-content: center;
6
+ position: relative;
7
+ }
8
+ .sui-divider-line {
9
+ position: absolute;
10
+ left: 50%;
11
+ transform: translate(-50%, 0);
12
+ width: 100%;
13
+ height: 1px;
14
+ background-color: hsl(var(--border));
15
+ z-index: 1;
16
+ border: none;
17
+ }
18
+ .sui-divider-content {
19
+ z-index: 2;
20
+ color: hsl(var(--text-muted));
21
+ }