@auvyx/ui 0.0.0-stage → 0.1.0

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 (143) hide show
  1. package/LICENSE +48 -0
  2. package/README.md +43 -2
  3. package/dist/auvyx.bundle.css +5941 -0
  4. package/dist/auvyx.chart.min.js +2 -0
  5. package/dist/auvyx.corners.min.js +2 -0
  6. package/dist/auvyx.css +10880 -0
  7. package/dist/auvyx.js +3222 -0
  8. package/dist/auvyx.min.css +2 -0
  9. package/dist/auvyx.min.js +19 -0
  10. package/dist/custom-elements.json +948 -0
  11. package/dist/elements/calendar.min.js +2 -0
  12. package/dist/elements/context-menu.min.js +2 -0
  13. package/dist/elements/data-table.min.js +2 -0
  14. package/dist/elements/date-picker.min.js +2 -0
  15. package/dist/elements/index.min.js +2 -0
  16. package/dist/elements/menu.min.js +2 -0
  17. package/dist/elements/resizable.min.js +2 -0
  18. package/dist/js/accordion.min.js +2 -0
  19. package/dist/js/calendar.min.js +2 -0
  20. package/dist/js/combobox.min.js +2 -0
  21. package/dist/js/command.min.js +2 -0
  22. package/dist/js/context-menu.min.js +2 -0
  23. package/dist/js/copy.min.js +2 -0
  24. package/dist/js/data-table.min.js +2 -0
  25. package/dist/js/date-picker.min.js +2 -0
  26. package/dist/js/drawer.min.js +2 -0
  27. package/dist/js/dropdown-menu.min.js +2 -0
  28. package/dist/js/manifest.json +114 -0
  29. package/dist/js/menu.min.js +2 -0
  30. package/dist/js/popover.min.js +2 -0
  31. package/dist/js/resizable.min.js +2 -0
  32. package/dist/js/select.min.js +2 -0
  33. package/dist/js/sidebar.min.js +2 -0
  34. package/dist/js/slider.min.js +2 -0
  35. package/dist/js/tabs.min.js +2 -0
  36. package/dist/js/toast.min.js +19 -0
  37. package/dist/styles/auvyx-luma.min.css +3 -0
  38. package/dist/styles/auvyx-lyra.min.css +3 -0
  39. package/dist/styles/auvyx-maia.min.css +3 -0
  40. package/dist/styles/auvyx-mira.min.css +3 -0
  41. package/dist/styles/auvyx-nova.min.css +3 -0
  42. package/dist/styles/auvyx-rhea.min.css +3 -0
  43. package/dist/styles/auvyx-sera.min.css +3 -0
  44. package/dist/styles/auvyx-vega.min.css +3 -0
  45. package/dist/types/elements.d.ts +262 -0
  46. package/dist/types/react.d.ts +181 -0
  47. package/dist/types/vue.d.ts +155 -0
  48. package/dist/ui/accordion.css +91 -0
  49. package/dist/ui/accordion.js +249 -0
  50. package/dist/ui/accordion.native.css +24 -0
  51. package/dist/ui/alert.css +119 -0
  52. package/dist/ui/aspect-ratio.css +38 -0
  53. package/dist/ui/attachment.css +211 -0
  54. package/dist/ui/avatar.css +204 -0
  55. package/dist/ui/badge.css +183 -0
  56. package/dist/ui/base.css +1200 -0
  57. package/dist/ui/breadcrumb.css +90 -0
  58. package/dist/ui/bubble.css +171 -0
  59. package/dist/ui/button-group.css +110 -0
  60. package/dist/ui/button.css +328 -0
  61. package/dist/ui/calendar.css +260 -0
  62. package/dist/ui/calendar.js +317 -0
  63. package/dist/ui/card.css +126 -0
  64. package/dist/ui/carousel.css +172 -0
  65. package/dist/ui/chart.css +130 -0
  66. package/dist/ui/checkbox.css +119 -0
  67. package/dist/ui/code-block.css +235 -0
  68. package/dist/ui/combobox.css +500 -0
  69. package/dist/ui/combobox.js +757 -0
  70. package/dist/ui/command.css +366 -0
  71. package/dist/ui/command.js +382 -0
  72. package/dist/ui/context-menu.css +17 -0
  73. package/dist/ui/context-menu.js +52 -0
  74. package/dist/ui/copy.js +56 -0
  75. package/dist/ui/data-table.css +114 -0
  76. package/dist/ui/data-table.js +140 -0
  77. package/dist/ui/date-picker.css +14 -0
  78. package/dist/ui/date-picker.js +101 -0
  79. package/dist/ui/dialog.css +363 -0
  80. package/dist/ui/dialog.native.css +6 -0
  81. package/dist/ui/drawer.css +238 -0
  82. package/dist/ui/drawer.js +265 -0
  83. package/dist/ui/dropdown-menu.css +193 -0
  84. package/dist/ui/dropdown-menu.js +388 -0
  85. package/dist/ui/empty.css +111 -0
  86. package/dist/ui/field.css +293 -0
  87. package/dist/ui/hover-card.css +85 -0
  88. package/dist/ui/input-group.css +269 -0
  89. package/dist/ui/input-otp.css +101 -0
  90. package/dist/ui/input.css +117 -0
  91. package/dist/ui/item.css +223 -0
  92. package/dist/ui/kbd.css +50 -0
  93. package/dist/ui/label.css +48 -0
  94. package/dist/ui/manifest.json +667 -0
  95. package/dist/ui/marker.css +66 -0
  96. package/dist/ui/menu.js +161 -0
  97. package/dist/ui/menubar.css +55 -0
  98. package/dist/ui/message-scroller.css +83 -0
  99. package/dist/ui/message.css +69 -0
  100. package/dist/ui/native-select.css +130 -0
  101. package/dist/ui/navigation-menu.css +166 -0
  102. package/dist/ui/popover.css +154 -0
  103. package/dist/ui/popover.js +268 -0
  104. package/dist/ui/popover.native.css +84 -0
  105. package/dist/ui/progress.css +29 -0
  106. package/dist/ui/questionnaire.css +188 -0
  107. package/dist/ui/radio-group.css +115 -0
  108. package/dist/ui/resizable.css +94 -0
  109. package/dist/ui/resizable.js +95 -0
  110. package/dist/ui/scroll-area.css +43 -0
  111. package/dist/ui/select.css +289 -0
  112. package/dist/ui/select.js +646 -0
  113. package/dist/ui/sheet.css +219 -0
  114. package/dist/ui/sidebar.css +716 -0
  115. package/dist/ui/sidebar.js +287 -0
  116. package/dist/ui/skeleton.css +13 -0
  117. package/dist/ui/slider.css +184 -0
  118. package/dist/ui/slider.js +206 -0
  119. package/dist/ui/switch.css +156 -0
  120. package/dist/ui/table.css +157 -0
  121. package/dist/ui/tabs.css +240 -0
  122. package/dist/ui/tabs.js +288 -0
  123. package/dist/ui/textarea.css +91 -0
  124. package/dist/ui/toast.css +110 -0
  125. package/dist/ui/toast.js +378 -0
  126. package/dist/ui/toggle-group.css +42 -0
  127. package/dist/ui/toggle.css +150 -0
  128. package/dist/ui/tooltip.css +319 -0
  129. package/dist/ui/trace.css +142 -0
  130. package/dist/ui/typography.css +184 -0
  131. package/dist/wc/accordion.min.js +2 -0
  132. package/dist/wc/combobox.min.js +2 -0
  133. package/dist/wc/command.min.js +2 -0
  134. package/dist/wc/drawer.min.js +2 -0
  135. package/dist/wc/dropdown-menu.min.js +2 -0
  136. package/dist/wc/manifest.json +154 -0
  137. package/dist/wc/popover.min.js +2 -0
  138. package/dist/wc/select.min.js +2 -0
  139. package/dist/wc/sidebar.min.js +2 -0
  140. package/dist/wc/slider.min.js +2 -0
  141. package/dist/wc/tabs.min.js +2 -0
  142. package/dist/wc/toast.min.js +19 -0
  143. package/package.json +62 -4
@@ -0,0 +1,378 @@
1
+ /* @auvyx/ui v0.1.0 | MIT | based on Basecoat (MIT) */
2
+ // Basecoat core, once per page.
3
+ if (!window.basecoat) (() => {
4
+ const componentRegistry = {};
5
+ let observer = null;
6
+
7
+ const registerComponent = (name, selectorOrOptions, initFunction) => {
8
+ const options = typeof selectorOrOptions === 'object'
9
+ ? selectorOrOptions
10
+ : { selector: selectorOrOptions, init: initFunction };
11
+
12
+ componentRegistry[name] = {
13
+ selector: options.selector,
14
+ init: options.init,
15
+ refresh: options.refresh,
16
+ };
17
+ };
18
+
19
+ const initComponent = (element, componentName) => {
20
+ const component = componentRegistry[componentName];
21
+ if (!component) return;
22
+
23
+ try {
24
+ component.init(element);
25
+ if (element.hasAttribute(`data-${componentName}-initialized`)) {
26
+ element.dataset.basecoatComponent = componentName;
27
+ }
28
+ } catch (error) {
29
+ console.error(`Failed to initialize ${componentName}:`, error);
30
+ if (typeof element._destroy === 'function') {
31
+ try {
32
+ element._destroy();
33
+ } catch (destroyError) {
34
+ console.error(`Failed to clean up ${componentName} after initialization error:`, destroyError);
35
+ }
36
+ }
37
+ delete element._destroy;
38
+ element.removeAttribute(`data-${componentName}-initialized`);
39
+ delete element.dataset.basecoatComponent;
40
+ }
41
+ };
42
+
43
+ const destroyComponent = (element) => {
44
+ if (!element || element.nodeType !== Node.ELEMENT_NODE) return;
45
+ const componentName = element.dataset?.basecoatComponent;
46
+
47
+ if (typeof element._destroy === 'function') {
48
+ try {
49
+ element._destroy();
50
+ } catch (error) {
51
+ console.error('Failed to destroy Basecoat component:', error);
52
+ }
53
+ }
54
+
55
+ delete element._destroy;
56
+ if (componentName) element.removeAttribute(`data-${componentName}-initialized`);
57
+ delete element.dataset.basecoatComponent;
58
+ };
59
+
60
+ const destroyRemovedComponents = (node) => {
61
+ if (node.nodeType !== Node.ELEMENT_NODE) return;
62
+ if (node.isConnected) return;
63
+
64
+ if (node.dataset?.basecoatComponent) destroyComponent(node);
65
+ node.querySelectorAll('[data-basecoat-component]').forEach(destroyComponent);
66
+ };
67
+
68
+ const uniqueElements = (elements) => Array.from(new Set(elements));
69
+
70
+ const getComponentElements = (componentName, selector, force = false) => {
71
+ const elements = Array.from(document.querySelectorAll(selector));
72
+ if (force) {
73
+ elements.push(...document.querySelectorAll(`[data-basecoat-component="${componentName}"]`));
74
+ }
75
+ return uniqueElements(elements);
76
+ };
77
+
78
+ const initAllComponents = (options = {}) => {
79
+ const force = options.force === true;
80
+ Object.entries(componentRegistry).forEach(([name, { selector }]) => {
81
+ getComponentElements(name, selector, force).forEach((element) => {
82
+ const wasComponent = element.dataset?.basecoatComponent === name;
83
+ if (force) destroyComponent(element);
84
+ if (wasComponent || element.matches(selector)) initComponent(element, name);
85
+ });
86
+ });
87
+ };
88
+
89
+ const initNewComponents = (node) => {
90
+ if (node.nodeType !== Node.ELEMENT_NODE) return;
91
+
92
+ Object.entries(componentRegistry).forEach(([name, { selector }]) => {
93
+ if (node.matches(selector)) initComponent(node, name);
94
+ node.querySelectorAll(selector).forEach(element => initComponent(element, name));
95
+ });
96
+ };
97
+
98
+ const refreshComponent = (element) => {
99
+ if (!element) return;
100
+ if (typeof element.refresh === 'function') {
101
+ element.refresh();
102
+ return;
103
+ }
104
+
105
+ const componentName = element.dataset?.basecoatComponent;
106
+ const component = componentName ? componentRegistry[componentName] : null;
107
+ if (component?.refresh) {
108
+ component.refresh(element);
109
+ }
110
+ };
111
+
112
+ const startObserver = () => {
113
+ if (observer) return;
114
+
115
+ observer = new MutationObserver((mutations) => {
116
+ mutations.forEach((mutation) => {
117
+ mutation.addedNodes.forEach(initNewComponents);
118
+ mutation.removedNodes.forEach(destroyRemovedComponents);
119
+ });
120
+ });
121
+
122
+ observer.observe(document.body, { childList: true, subtree: true });
123
+ };
124
+
125
+ const stopObserver = () => {
126
+ if (!observer) return;
127
+ observer.disconnect();
128
+ observer = null;
129
+ };
130
+
131
+ const initRegisteredComponent = (componentName, options = {}) => {
132
+ const component = componentRegistry[componentName];
133
+ if (!component) {
134
+ console.warn(`Component '${componentName}' not found in registry`);
135
+ return;
136
+ }
137
+
138
+ const force = options.force === true;
139
+ getComponentElements(componentName, component.selector, force).forEach((element) => {
140
+ const wasComponent = element.dataset?.basecoatComponent === componentName;
141
+ if (force) destroyComponent(element);
142
+ if (wasComponent || element.matches(component.selector)) initComponent(element, componentName);
143
+ });
144
+ };
145
+
146
+ const initAllRegisteredComponents = (options = {}) => {
147
+ initAllComponents(options);
148
+ };
149
+
150
+ const setTheme = (mode) => {
151
+ const dark = mode === 'dark';
152
+ document.documentElement.classList.toggle('dark', dark);
153
+ try { localStorage.setItem('themeMode', dark ? 'dark' : 'light'); } catch (_) {}
154
+ document.dispatchEvent(new CustomEvent('basecoat:themechange', { detail: { mode: dark ? 'dark' : 'light' } }));
155
+ };
156
+
157
+ const getTheme = () => document.documentElement.classList.contains('dark') ? 'dark' : 'light';
158
+
159
+ window.basecoat = {
160
+ register: registerComponent,
161
+ init: initRegisteredComponent,
162
+ initAll: initAllRegisteredComponents,
163
+ refresh: refreshComponent,
164
+ start: startObserver,
165
+ stop: stopObserver,
166
+ theme: {
167
+ get: getTheme,
168
+ set: setTheme,
169
+ toggle: () => setTheme(getTheme() === 'dark' ? 'light' : 'dark'),
170
+ },
171
+ };
172
+
173
+ document.addEventListener('DOMContentLoaded', () => {
174
+ initAllComponents();
175
+ startObserver();
176
+ });
177
+ })();
178
+
179
+ (() => {
180
+ let toaster;
181
+ const toasts = new WeakMap();
182
+ let isPaused = false;
183
+ const ICONS = {
184
+ success: '<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>',
185
+ error: '<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>',
186
+ info: '<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>',
187
+ warning: '<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>'
188
+ };
189
+
190
+ function initToaster(toasterElement) {
191
+ if (toasterElement.dataset.toasterInitialized) return;
192
+ toaster = toasterElement;
193
+
194
+ const handleClick = (event) => {
195
+ const actionLink = event.target.closest('.toast footer a');
196
+ const actionButton = event.target.closest('.toast footer button');
197
+ if (actionLink || actionButton) {
198
+ closeToast(event.target.closest('.toast'));
199
+ }
200
+ };
201
+
202
+ toaster.addEventListener('mouseenter', pauseAllTimeouts);
203
+ toaster.addEventListener('mouseleave', resumeAllTimeouts);
204
+ toaster.addEventListener('click', handleClick);
205
+
206
+ toasterElement.toast = (config = {}) => {
207
+ const toastElement = createToast(config);
208
+ toasterElement.appendChild(toastElement);
209
+ initToast(toastElement);
210
+ return toastElement;
211
+ };
212
+ toasterElement.closeAll = () => {
213
+ toasterElement.querySelectorAll('.toast:not([aria-hidden="true"])').forEach(closeToast);
214
+ };
215
+
216
+ toaster.querySelectorAll('.toast:not([data-toast-initialized])').forEach(initToast);
217
+ toaster._destroy = () => {
218
+ toaster.removeEventListener('mouseenter', pauseAllTimeouts);
219
+ toaster.removeEventListener('mouseleave', resumeAllTimeouts);
220
+ toaster.removeEventListener('click', handleClick);
221
+ toaster.querySelectorAll('.toast[data-toast-initialized]').forEach(toast => toast._destroy?.());
222
+ delete toaster.toast;
223
+ delete toaster.closeAll;
224
+ if (toaster === toasterElement) toaster = null;
225
+ };
226
+ toaster.dataset.toasterInitialized = 'true';
227
+ toaster.dispatchEvent(new CustomEvent('basecoat:initialized'));
228
+ }
229
+
230
+ function initToast(element) {
231
+ if (element.dataset.toastInitialized) return;
232
+
233
+ const duration = parseInt(element.dataset.duration);
234
+ const timeoutDuration = duration !== -1
235
+ ? duration || (element.dataset.category === 'error' ? 5000 : 3000)
236
+ : -1;
237
+
238
+ const state = {
239
+ remainingTime: timeoutDuration,
240
+ timeoutId: null,
241
+ startTime: null,
242
+ };
243
+
244
+ if (timeoutDuration !== -1) {
245
+ if (isPaused) {
246
+ state.timeoutId = null;
247
+ } else {
248
+ state.startTime = Date.now();
249
+ state.timeoutId = setTimeout(() => closeToast(element), timeoutDuration);
250
+ }
251
+ }
252
+ toasts.set(element, state);
253
+
254
+ element.close = () => closeToast(element);
255
+ element._destroy = () => {
256
+ clearTimeout(state.timeoutId);
257
+ toasts.delete(element);
258
+ delete element.close;
259
+ };
260
+ element.dataset.toastInitialized = 'true';
261
+ }
262
+
263
+ function pauseAllTimeouts() {
264
+ if (isPaused || !toaster) return;
265
+
266
+ isPaused = true;
267
+
268
+ toaster.querySelectorAll('.toast:not([aria-hidden="true"])').forEach(element => {
269
+ if (!toasts.has(element)) return;
270
+
271
+ const state = toasts.get(element);
272
+ if (state.timeoutId) {
273
+ clearTimeout(state.timeoutId);
274
+ state.timeoutId = null;
275
+ state.remainingTime -= Date.now() - state.startTime;
276
+ }
277
+ });
278
+ }
279
+
280
+ function resumeAllTimeouts() {
281
+ if (!isPaused || !toaster) return;
282
+
283
+ isPaused = false;
284
+
285
+ toaster.querySelectorAll('.toast:not([aria-hidden="true"])').forEach(element => {
286
+ if (!toasts.has(element)) return;
287
+
288
+ const state = toasts.get(element);
289
+ if (state.remainingTime !== -1 && !state.timeoutId) {
290
+ if (state.remainingTime > 0) {
291
+ state.startTime = Date.now();
292
+ state.timeoutId = setTimeout(() => closeToast(element), state.remainingTime);
293
+ } else {
294
+ closeToast(element);
295
+ }
296
+ }
297
+ });
298
+ }
299
+
300
+ function closeToast(element) {
301
+ if (!element || !toasts.has(element)) return;
302
+
303
+ const state = toasts.get(element);
304
+ clearTimeout(state.timeoutId);
305
+ toasts.delete(element);
306
+
307
+ if (element.contains(document.activeElement)) document.activeElement.blur();
308
+ element.setAttribute('aria-hidden', 'true');
309
+ element.addEventListener('transitionend', () => element.remove(), { once: true });
310
+ }
311
+
312
+ const escapeHtml = (value) => String(value)
313
+ .replace(/&/g, '&amp;')
314
+ .replace(/</g, '&lt;')
315
+ .replace(/>/g, '&gt;')
316
+ .replace(/"/g, '&quot;')
317
+ .replace(/'/g, '&#39;');
318
+
319
+ function createToast(config) {
320
+ const {
321
+ category = 'info',
322
+ title,
323
+ description,
324
+ action,
325
+ cancel,
326
+ duration,
327
+ icon,
328
+ html: allowHtml = false,
329
+ } = config;
330
+
331
+ // Text is escaped unless `html: true`. `icon` is always raw markup (SVG).
332
+ const text = (value) => (allowHtml ? String(value) : escapeHtml(value));
333
+
334
+ const iconHtml = icon || (category && ICONS[category]) || '';
335
+ const titleHtml = title ? `<h2>${text(title)}</h2>` : '';
336
+ const descriptionHtml = description ? `<p>${text(description)}</p>` : '';
337
+ const actionHtml = action?.href
338
+ ? `<a href="${escapeHtml(action.href)}" class="btn" data-toast-action>${text(action.label)}</a>`
339
+ : action?.onclick
340
+ ? `<button type="button" class="btn" data-toast-action onclick="${escapeHtml(action.onclick)}">${text(action.label)}</button>`
341
+ : '';
342
+ const cancelHtml = cancel
343
+ ? `<button type="button" class="btn h-6 text-xs px-2.5 rounded-sm" data-variant="outline" data-toast-cancel onclick="${escapeHtml(cancel?.onclick || '')}">${text(cancel.label)}</button>`
344
+ : '';
345
+
346
+ const footerHtml = actionHtml || cancelHtml ? `<footer>${actionHtml}${cancelHtml}</footer>` : '';
347
+
348
+ const html = `
349
+ <div
350
+ class="toast"
351
+ role="${category === 'error' ? 'alert' : 'status'}"
352
+ aria-atomic="true"
353
+ ${category ? `data-category="${escapeHtml(category)}"` : ''}
354
+ ${duration !== undefined ? `data-duration="${escapeHtml(duration)}"` : ''}
355
+ >
356
+ <div class="toast-content">
357
+ ${iconHtml}
358
+ <section>
359
+ ${titleHtml}
360
+ ${descriptionHtml}
361
+ </section>
362
+ ${footerHtml}
363
+ </div>
364
+ </div>
365
+ `;
366
+ const template = document.createElement('template');
367
+ template.innerHTML = html.trim();
368
+ return template.content.firstChild;
369
+ }
370
+
371
+ if (window.basecoat) {
372
+ window.basecoat.register('toaster', '#toaster:not([data-toaster-initialized])', initToaster);
373
+ window.basecoat.register('toast', '.toast:not([data-toast-initialized])', initToast);
374
+ }
375
+ })();
376
+
377
+ // Loaded after the DOM is ready: initialize now.
378
+ if (document.readyState !== 'loading') { window.basecoat.initAll(); window.basecoat.start(); }
@@ -0,0 +1,42 @@
1
+ /* @auvyx/ui toggle-group | order 58 */
2
+ @layer components {
3
+ .toggle-group {
4
+ border-radius: var(--auvyx-r-control);
5
+ }
6
+ .toggle-group[data-variant='outline']:not([data-spacing]) {
7
+ --tw-shadow: var(--shadow-xs, 0 1px 2px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.05)));
8
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
9
+ }
10
+ .toggle-group:not([data-spacing]) > .toggle {
11
+ border-radius: 0;
12
+ padding-inline: calc(var(--spacing) * 2);
13
+ --tw-shadow: 0 0 #0000;
14
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
15
+ }
16
+ .toggle-group:not([data-spacing]):not([data-orientation='vertical']) > .toggle {
17
+ &:first-of-type {
18
+ border-start-start-radius: var(--auvyx-r-control);
19
+ border-end-start-radius: var(--auvyx-r-control);
20
+ }
21
+ &:last-of-type {
22
+ border-start-end-radius: var(--auvyx-r-control);
23
+ border-end-end-radius: var(--auvyx-r-control);
24
+ }
25
+ &:not(:first-of-type) {
26
+ border-inline-start-width: 0;
27
+ }
28
+ }
29
+ .toggle-group:not([data-spacing])[data-orientation='vertical'] > .toggle {
30
+ &:first-of-type {
31
+ border-top-left-radius: var(--auvyx-r-control);
32
+ border-top-right-radius: var(--auvyx-r-control);
33
+ }
34
+ &:last-of-type {
35
+ border-bottom-right-radius: var(--auvyx-r-control);
36
+ border-bottom-left-radius: var(--auvyx-r-control);
37
+ }
38
+ &:not(:first-of-type) {
39
+ border-block-start-width: 0;
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,150 @@
1
+ /* @auvyx/ui toggle | order 39 */
2
+ @layer components {
3
+ .toggle {
4
+ position: relative;
5
+ display: inline-flex;
6
+ flex-shrink: 0;
7
+ cursor: pointer;
8
+ align-items: center;
9
+ justify-content: center;
10
+ white-space: nowrap;
11
+ --tw-outline-style: none;
12
+ outline-style: none;
13
+ -webkit-user-select: none;
14
+ user-select: none;
15
+ & svg {
16
+ pointer-events: none;
17
+ }
18
+ & svg {
19
+ flex-shrink: 0;
20
+ }
21
+ > input:is([type='checkbox'], [type='radio']) {
22
+ position: absolute;
23
+ width: 1px;
24
+ height: 1px;
25
+ padding: 0;
26
+ margin: -1px;
27
+ overflow: hidden;
28
+ clip-path: inset(50%);
29
+ white-space: nowrap;
30
+ border-width: 0;
31
+ }
32
+ &:is(:disabled, [aria-disabled='true'], :has(> input:disabled)) {
33
+ pointer-events: none;
34
+ opacity: 50%;
35
+ }
36
+ }
37
+ .toggle-group {
38
+ margin: 0;
39
+ display: inline-flex;
40
+ width: fit-content;
41
+ min-width: 0;
42
+ align-items: center;
43
+ border-style: var(--tw-border-style);
44
+ border-width: 0px;
45
+ padding: 0;
46
+ > legend {
47
+ position: absolute;
48
+ width: 1px;
49
+ height: 1px;
50
+ padding: 0;
51
+ margin: -1px;
52
+ overflow: hidden;
53
+ clip-path: inset(50%);
54
+ white-space: nowrap;
55
+ border-width: 0;
56
+ }
57
+ > .toggle:is(:focus-visible, :has(> input:focus-visible)) {
58
+ z-index: 10;
59
+ }
60
+ &[data-orientation='vertical'] {
61
+ flex-direction: column;
62
+ align-items: stretch;
63
+ }
64
+ &[data-spacing='1'] {
65
+ gap: var(--spacing);
66
+ }
67
+ &[data-spacing='2'] {
68
+ gap: calc(var(--spacing) * 2);
69
+ }
70
+ }
71
+ }
72
+
73
+ @layer components {
74
+ .toggle {
75
+ height: calc(var(--spacing) * 9);
76
+ min-width: calc(var(--spacing) * 9);
77
+ gap: var(--spacing);
78
+ border-radius: var(--auvyx-r-control);
79
+ background-color: transparent;
80
+ padding-inline: calc(var(--spacing) * 2.5);
81
+ font-size: var(--text-sm);
82
+ line-height: var(--tw-leading, var(--text-sm--line-height));
83
+ --tw-font-weight: var(--font-weight-medium);
84
+ font-weight: var(--font-weight-medium);
85
+ transition-property: color,box-shadow;
86
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
87
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
88
+ &:hover {
89
+ @media (hover: hover) {
90
+ background-color: var(--color-muted);
91
+ }
92
+ }
93
+ &:hover {
94
+ @media (hover: hover) {
95
+ color: var(--color-foreground);
96
+ }
97
+ }
98
+ & svg:not([class*='size-']) {
99
+ width: calc(var(--spacing) * 4);
100
+ height: calc(var(--spacing) * 4);
101
+ }
102
+ }
103
+ .toggle:is([aria-pressed='true'], :has(> input:checked)) {
104
+ background-color: var(--color-muted);
105
+ }
106
+ .toggle:is(:focus-visible, :has(> input:focus-visible)) {
107
+ border-color: var(--color-ring);
108
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
109
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
110
+ --tw-ring-color: var(--color-ring);
111
+ @supports (color: color-mix(in lab, red, red)) {
112
+ --tw-ring-color: color-mix(in oklab, var(--color-ring) 50%, transparent);
113
+ }
114
+ }
115
+ .toggle:is([aria-invalid='true'], :has(> input[aria-invalid='true'])) {
116
+ border-color: var(--color-destructive);
117
+ --tw-ring-color: var(--color-destructive);
118
+ @supports (color: color-mix(in lab, red, red)) {
119
+ --tw-ring-color: color-mix(in oklab, var(--color-destructive) 20%, transparent);
120
+ }
121
+ &:is(html.dark *) {
122
+ --tw-ring-color: var(--color-destructive);
123
+ @supports (color: color-mix(in lab, red, red)) {
124
+ --tw-ring-color: color-mix(in oklab, var(--color-destructive) 40%, transparent);
125
+ }
126
+ }
127
+ }
128
+ .toggle[data-variant='outline'], .toggle-group[data-variant='outline'] > .toggle {
129
+ border-style: var(--tw-border-style);
130
+ border-width: 1px;
131
+ border-color: var(--color-input);
132
+ --tw-shadow: var(--shadow-xs, 0 1px 2px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.05)));
133
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
134
+ &:hover {
135
+ @media (hover: hover) {
136
+ background-color: var(--color-muted);
137
+ }
138
+ }
139
+ }
140
+ .toggle[data-size='sm'], .toggle-group[data-size='sm'] > .toggle {
141
+ height: calc(var(--spacing) * 8);
142
+ min-width: calc(var(--spacing) * 8);
143
+ padding-inline: calc(var(--spacing) * 2.5);
144
+ }
145
+ .toggle[data-size='lg'], .toggle-group[data-size='lg'] > .toggle {
146
+ height: calc(var(--spacing) * 10);
147
+ min-width: calc(var(--spacing) * 10);
148
+ padding-inline: calc(var(--spacing) * 2.5);
149
+ }
150
+ }