snice 1.14.3 → 2.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 (185) hide show
  1. package/bin/templates/base/tsconfig.json +5 -4
  2. package/components/accordion/demo.html +403 -0
  3. package/components/accordion/snice-accordion-item.css +85 -0
  4. package/components/accordion/snice-accordion-item.ts +226 -0
  5. package/components/accordion/snice-accordion.css +31 -0
  6. package/components/accordion/snice-accordion.ts +182 -0
  7. package/components/accordion/snice-accordion.types.ts +32 -0
  8. package/components/alert/demo.html +445 -0
  9. package/components/alert/snice-alert.css +195 -0
  10. package/components/alert/snice-alert.ts +141 -0
  11. package/components/alert/snice-alert.types.ts +12 -0
  12. package/components/avatar/demo.html +598 -0
  13. package/components/avatar/snice-avatar.css +131 -0
  14. package/components/avatar/snice-avatar.ts +136 -0
  15. package/components/avatar/snice-avatar.types.ts +13 -0
  16. package/components/badge/demo.html +523 -0
  17. package/components/badge/snice-badge.css +161 -0
  18. package/components/badge/snice-badge.ts +117 -0
  19. package/components/badge/snice-badge.types.ts +16 -0
  20. package/components/breadcrumbs/demo.html +404 -0
  21. package/components/breadcrumbs/snice-breadcrumbs.css +133 -0
  22. package/components/breadcrumbs/snice-breadcrumbs.ts +191 -0
  23. package/components/breadcrumbs/snice-breadcrumbs.types.ts +26 -0
  24. package/components/breadcrumbs/snice-crumb.ts +26 -0
  25. package/components/button/demo.html +42 -0
  26. package/components/button/snice-button.css +230 -0
  27. package/components/button/snice-button.ts +169 -0
  28. package/components/button/snice-button.types.ts +25 -0
  29. package/components/card/demo.html +525 -0
  30. package/components/card/snice-card.css +140 -0
  31. package/components/card/snice-card.ts +102 -0
  32. package/components/card/snice-card.types.ts +10 -0
  33. package/components/checkbox/demo.html +253 -0
  34. package/components/checkbox/snice-checkbox.css +164 -0
  35. package/components/checkbox/snice-checkbox.ts +223 -0
  36. package/components/checkbox/snice-checkbox.types.ts +22 -0
  37. package/components/chip/demo.html +383 -0
  38. package/components/chip/snice-chip.css +195 -0
  39. package/components/chip/snice-chip.ts +139 -0
  40. package/components/chip/snice-chip.types.ts +15 -0
  41. package/components/date-picker/README.md +233 -0
  42. package/components/date-picker/demo.html +191 -0
  43. package/components/date-picker/snice-date-picker.css +330 -0
  44. package/components/date-picker/snice-date-picker.ts +777 -0
  45. package/components/date-picker/snice-date-picker.types.ts +83 -0
  46. package/components/divider/demo.html +233 -0
  47. package/components/divider/snice-divider.css +155 -0
  48. package/components/divider/snice-divider.ts +69 -0
  49. package/components/divider/snice-divider.types.ts +15 -0
  50. package/components/drawer/demo.html +328 -0
  51. package/components/drawer/snice-drawer.css +476 -0
  52. package/components/drawer/snice-drawer.ts +287 -0
  53. package/components/drawer/snice-drawer.types.ts +17 -0
  54. package/components/global.d.ts +14 -0
  55. package/components/input/demo.html +303 -0
  56. package/components/input/snice-input.css +257 -0
  57. package/components/input/snice-input.ts +442 -0
  58. package/components/input/snice-input.types.ts +59 -0
  59. package/components/input/test.html +77 -0
  60. package/components/layout/README.md +260 -0
  61. package/components/layout/demo.html +538 -0
  62. package/components/layout/snice-layout-blog.css +129 -0
  63. package/components/layout/snice-layout-blog.ts +48 -0
  64. package/components/layout/snice-layout-card.css +104 -0
  65. package/components/layout/snice-layout-card.ts +35 -0
  66. package/components/layout/snice-layout-centered.css +51 -0
  67. package/components/layout/snice-layout-centered.ts +22 -0
  68. package/components/layout/snice-layout-dashboard.css +98 -0
  69. package/components/layout/snice-layout-dashboard.ts +45 -0
  70. package/components/layout/snice-layout-fullscreen.css +72 -0
  71. package/components/layout/snice-layout-fullscreen.ts +34 -0
  72. package/components/layout/snice-layout-landing.css +92 -0
  73. package/components/layout/snice-layout-landing.ts +47 -0
  74. package/components/layout/snice-layout-minimal.css +16 -0
  75. package/components/layout/snice-layout-minimal.ts +19 -0
  76. package/components/layout/snice-layout-sidebar.css +117 -0
  77. package/components/layout/snice-layout-sidebar.ts +48 -0
  78. package/components/layout/snice-layout-split.css +103 -0
  79. package/components/layout/snice-layout-split.ts +29 -0
  80. package/components/layout/snice-layout.css +72 -0
  81. package/components/layout/snice-layout.ts +35 -0
  82. package/components/layout/snice-layout.types.ts +5 -0
  83. package/components/login/demo-auth-controller.ts +185 -0
  84. package/components/login/demo.html +470 -0
  85. package/components/login/snice-login.css +204 -0
  86. package/components/login/snice-login.ts +337 -0
  87. package/components/login/snice-login.types.ts +34 -0
  88. package/components/modal/demo.html +291 -0
  89. package/components/modal/snice-modal.css +203 -0
  90. package/components/modal/snice-modal.ts +233 -0
  91. package/components/modal/snice-modal.types.ts +21 -0
  92. package/components/pagination/demo.html +395 -0
  93. package/components/pagination/snice-pagination.ts +333 -0
  94. package/components/pagination/snice-pagination.types.ts +21 -0
  95. package/components/progress/demo.html +510 -0
  96. package/components/progress/snice-progress.css +267 -0
  97. package/components/progress/snice-progress.ts +247 -0
  98. package/components/progress/snice-progress.types.ts +19 -0
  99. package/components/radio/demo.html +287 -0
  100. package/components/radio/snice-radio.css +171 -0
  101. package/components/radio/snice-radio.ts +218 -0
  102. package/components/radio/snice-radio.types.ts +21 -0
  103. package/components/select/demo.html +511 -0
  104. package/components/select/snice-option.ts +52 -0
  105. package/components/select/snice-option.types.ts +14 -0
  106. package/components/select/snice-select.css +392 -0
  107. package/components/select/snice-select.ts +796 -0
  108. package/components/select/snice-select.types.ts +55 -0
  109. package/components/skeleton/demo.html +514 -0
  110. package/components/skeleton/snice-skeleton.css +109 -0
  111. package/components/skeleton/snice-skeleton.ts +126 -0
  112. package/components/skeleton/snice-skeleton.types.ts +11 -0
  113. package/components/switch/demo.html +284 -0
  114. package/components/switch/snice-switch.css +221 -0
  115. package/components/switch/snice-switch.ts +229 -0
  116. package/components/switch/snice-switch.types.ts +23 -0
  117. package/components/symbols.ts +23 -0
  118. package/components/table/demo-table-controller.ts +100 -0
  119. package/components/table/demo.html +480 -0
  120. package/components/table/snice-cell-boolean.ts +112 -0
  121. package/components/table/snice-cell-date.ts +210 -0
  122. package/components/table/snice-cell-duration.ts +91 -0
  123. package/components/table/snice-cell-filesize.ts +90 -0
  124. package/components/table/snice-cell-number.ts +165 -0
  125. package/components/table/snice-cell-progress.ts +83 -0
  126. package/components/table/snice-cell-rating.ts +82 -0
  127. package/components/table/snice-cell-sparkline.ts +253 -0
  128. package/components/table/snice-cell-text.ts +125 -0
  129. package/components/table/snice-cell.css +296 -0
  130. package/components/table/snice-cell.ts +473 -0
  131. package/components/table/snice-column.ts +353 -0
  132. package/components/table/snice-header.css +243 -0
  133. package/components/table/snice-header.ts +261 -0
  134. package/components/table/snice-progress.ts +66 -0
  135. package/components/table/snice-rating.ts +45 -0
  136. package/components/table/snice-row.css +255 -0
  137. package/components/table/snice-row.ts +331 -0
  138. package/components/table/snice-table.css +241 -0
  139. package/components/table/snice-table.ts +737 -0
  140. package/components/table/snice-table.types.ts +158 -0
  141. package/components/tabs/demo.html +487 -0
  142. package/components/tabs/snice-tab-panel.css +264 -0
  143. package/components/tabs/snice-tab-panel.ts +47 -0
  144. package/components/tabs/snice-tab.css +96 -0
  145. package/components/tabs/snice-tab.ts +65 -0
  146. package/components/tabs/snice-tabs.css +189 -0
  147. package/components/tabs/snice-tabs.ts +332 -0
  148. package/components/tabs/snice-tabs.types.ts +28 -0
  149. package/components/theme/theme.css +234 -0
  150. package/components/toast/demo.html +329 -0
  151. package/components/toast/snice-toast-container.ts +256 -0
  152. package/components/toast/snice-toast.css +213 -0
  153. package/components/toast/snice-toast.ts +276 -0
  154. package/components/toast/snice-toast.types.ts +35 -0
  155. package/components/tooltip/demo.html +350 -0
  156. package/components/tooltip/snice-tooltip-portal.css +79 -0
  157. package/components/tooltip/snice-tooltip.css +117 -0
  158. package/components/tooltip/snice-tooltip.ts +612 -0
  159. package/components/tooltip/snice-tooltip.types.ts +32 -0
  160. package/components/transitions.ts +94 -0
  161. package/components/tsconfig.json +18 -0
  162. package/dist/index.cjs +441 -329
  163. package/dist/index.cjs.map +1 -1
  164. package/dist/index.cjs.min.map +1 -1
  165. package/dist/index.esm.js +441 -329
  166. package/dist/index.esm.js.map +1 -1
  167. package/dist/index.esm.min.js +3 -3
  168. package/dist/index.esm.min.js.map +1 -1
  169. package/dist/index.iife.js +441 -329
  170. package/dist/index.iife.js.map +1 -1
  171. package/dist/index.iife.min.js +3 -3
  172. package/dist/index.iife.min.js.map +1 -1
  173. package/dist/symbols.esm.js +1 -1
  174. package/dist/transitions.esm.js +1 -1
  175. package/dist/types/controller.d.ts +1 -1
  176. package/dist/types/element.d.ts +10 -10
  177. package/dist/types/events.d.ts +2 -2
  178. package/dist/types/index.d.ts +1 -1
  179. package/dist/types/observe.d.ts +1 -1
  180. package/dist/types/request-response.d.ts +2 -3
  181. package/dist/types/router.d.ts +1 -1
  182. package/package.json +9 -3
  183. package/dist/index.cjs.min +0 -15
  184. package/dist/symbols.cjs +0 -103
  185. package/dist/transitions.cjs +0 -219
@@ -0,0 +1,264 @@
1
+ :host {
2
+ display: block;
3
+ width: 100%;
4
+ }
5
+
6
+ :host([hidden]) {
7
+ display: none !important;
8
+ }
9
+
10
+ /* During transitions, position absolutely to overlap */
11
+ :host([transition-in]),
12
+ :host([transition-out]) {
13
+ position: absolute !important;
14
+ /* Use parent's padding variable, fallback to default */
15
+ --panel-padding: var(--snice-tabs-panel-padding, var(--snice-spacing-md, 1rem));
16
+ top: var(--panel-padding);
17
+ left: var(--panel-padding);
18
+ right: var(--panel-padding);
19
+ width: calc(100% - var(--panel-padding) * 2);
20
+ }
21
+
22
+ /* Outgoing panel should be behind incoming */
23
+ :host([transition-out]) {
24
+ z-index: 1;
25
+ }
26
+
27
+ :host([transition-in]) {
28
+ z-index: 2;
29
+ }
30
+
31
+ .tab-panel {
32
+ display: block;
33
+ width: 100%;
34
+ }
35
+
36
+ /* Get timing from parent or use defaults */
37
+ :host([transition-in]),
38
+ :host([transition-out]) {
39
+ --transition-duration: var(--snice-tabs-transition-duration, 300ms);
40
+ }
41
+
42
+ /* Fade transitions */
43
+ :host([transition-in="fade"]) {
44
+ animation: fadeIn var(--transition-duration, 200ms) ease-in-out;
45
+ }
46
+
47
+ :host([transition-out="fade"]) {
48
+ animation: fadeOut var(--transition-duration, 200ms) ease-in-out;
49
+ }
50
+
51
+ /* Scale transitions */
52
+ :host([transition-in="scale"]) {
53
+ animation: scaleIn var(--transition-duration, 250ms) ease-in-out;
54
+ }
55
+
56
+ :host([transition-out="scale"]) {
57
+ animation: scaleOut var(--transition-duration, 250ms) ease-in-out;
58
+ }
59
+
60
+ /* Slide transitions */
61
+ :host([transition-in="slide"]) {
62
+ animation: slideIn var(--transition-duration, 300ms) ease-in-out;
63
+ }
64
+
65
+ :host([transition-out="slide"]) {
66
+ animation: slideOut var(--transition-duration, 300ms) ease-in-out;
67
+ }
68
+
69
+ /* Slide right transitions */
70
+ :host([transition-in="slide-right"]) {
71
+ animation: slideRightIn var(--transition-duration, 300ms) ease-in-out;
72
+ }
73
+
74
+ :host([transition-out="slide-right"]) {
75
+ animation: slideRightOut var(--transition-duration, 300ms) ease-in-out;
76
+ }
77
+
78
+ /* Slide up transitions */
79
+ :host([transition-in="slide-up"]) {
80
+ animation: slideUpIn var(--transition-duration, 300ms) ease-in-out;
81
+ }
82
+
83
+ :host([transition-out="slide-up"]) {
84
+ animation: slideUpOut var(--transition-duration, 300ms) ease-in-out;
85
+ }
86
+
87
+ /* Slide down transitions */
88
+ :host([transition-in="slide-down"]) {
89
+ animation: slideDownIn var(--transition-duration, 300ms) ease-in-out;
90
+ }
91
+
92
+ :host([transition-out="slide-down"]) {
93
+ animation: slideDownOut var(--transition-duration, 300ms) ease-in-out;
94
+ }
95
+
96
+ /* Zoom transitions */
97
+ :host([transition-in="zoom"]) {
98
+ animation: zoomIn var(--transition-duration, 300ms) ease-in-out;
99
+ }
100
+
101
+ :host([transition-out="zoom"]) {
102
+ animation: zoomOut var(--transition-duration, 300ms) ease-in-out;
103
+ }
104
+
105
+ /* Rotate transitions */
106
+ :host([transition-in="rotate"]) {
107
+ animation: rotateIn var(--transition-duration, 400ms) ease-in-out;
108
+ }
109
+
110
+ :host([transition-out="rotate"]) {
111
+ animation: rotateOut var(--transition-duration, 400ms) ease-in-out;
112
+ }
113
+
114
+ /* Flip transitions */
115
+ :host([transition-in="flip"]) {
116
+ animation: flipIn var(--transition-duration, 400ms) ease-in-out;
117
+ }
118
+
119
+ :host([transition-out="flip"]) {
120
+ animation: flipOut var(--transition-duration, 400ms) ease-in-out;
121
+ }
122
+
123
+ /* Keyframes */
124
+ @keyframes fadeIn {
125
+ from { opacity: 0; }
126
+ to { opacity: 1; }
127
+ }
128
+
129
+ @keyframes fadeOut {
130
+ from { opacity: 1; }
131
+ to { opacity: 0; }
132
+ }
133
+
134
+ @keyframes scaleIn {
135
+ from {
136
+ transform: scale(0.9);
137
+ opacity: 0;
138
+ }
139
+ to {
140
+ transform: scale(1);
141
+ opacity: 1;
142
+ }
143
+ }
144
+
145
+ @keyframes scaleOut {
146
+ from {
147
+ transform: scale(1);
148
+ opacity: 1;
149
+ }
150
+ to {
151
+ transform: scale(0.9);
152
+ opacity: 0;
153
+ }
154
+ }
155
+
156
+ @keyframes slideIn {
157
+ from { transform: translateX(-100%); }
158
+ to { transform: translateX(0); }
159
+ }
160
+
161
+ @keyframes slideOut {
162
+ from { transform: translateX(0); }
163
+ to { transform: translateX(-100%); }
164
+ }
165
+
166
+ @keyframes slideRightIn {
167
+ from { transform: translateX(100%); }
168
+ to { transform: translateX(0); }
169
+ }
170
+
171
+ @keyframes slideRightOut {
172
+ from { transform: translateX(0); }
173
+ to { transform: translateX(100%); }
174
+ }
175
+
176
+ @keyframes slideUpIn {
177
+ from { transform: translateY(-100%); }
178
+ to { transform: translateY(0); }
179
+ }
180
+
181
+ @keyframes slideUpOut {
182
+ from { transform: translateY(0); }
183
+ to { transform: translateY(-100%); }
184
+ }
185
+
186
+ @keyframes slideDownIn {
187
+ from { transform: translateY(100%); }
188
+ to { transform: translateY(0); }
189
+ }
190
+
191
+ @keyframes slideDownOut {
192
+ from { transform: translateY(0); }
193
+ to { transform: translateY(100%); }
194
+ }
195
+
196
+ @keyframes zoomIn {
197
+ from {
198
+ transform: scale(2);
199
+ opacity: 0;
200
+ }
201
+ to {
202
+ transform: scale(1);
203
+ opacity: 1;
204
+ }
205
+ }
206
+
207
+ @keyframes zoomOut {
208
+ from {
209
+ transform: scale(1);
210
+ opacity: 1;
211
+ }
212
+ to {
213
+ transform: scale(2);
214
+ opacity: 0;
215
+ }
216
+ }
217
+
218
+ @keyframes rotateIn {
219
+ from {
220
+ transform: rotate(180deg) scale(0.5);
221
+ opacity: 0;
222
+ }
223
+ to {
224
+ transform: rotate(0) scale(1);
225
+ opacity: 1;
226
+ }
227
+ }
228
+
229
+ @keyframes rotateOut {
230
+ from {
231
+ transform: rotate(0) scale(1);
232
+ opacity: 1;
233
+ }
234
+ to {
235
+ transform: rotate(180deg) scale(0.5);
236
+ opacity: 0;
237
+ }
238
+ }
239
+
240
+ @keyframes flipIn {
241
+ from {
242
+ transform: rotateY(180deg);
243
+ opacity: 0;
244
+ }
245
+ to {
246
+ transform: rotateY(0);
247
+ opacity: 1;
248
+ }
249
+ }
250
+
251
+ @keyframes flipOut {
252
+ from {
253
+ transform: rotateY(0);
254
+ opacity: 1;
255
+ }
256
+ to {
257
+ transform: rotateY(180deg);
258
+ opacity: 0;
259
+ }
260
+ }
261
+
262
+ ::slotted(*) {
263
+ display: block;
264
+ }
@@ -0,0 +1,47 @@
1
+ import { element, property, watch } from 'snice';
2
+ import css from './snice-tab-panel.css?inline';
3
+ import type { SniceTabPanelElement } from './snice-tabs.types';
4
+
5
+ @element('snice-tab-panel')
6
+ export class SniceTabPanel extends HTMLElement implements SniceTabPanelElement {
7
+ @property({ reflect: true })
8
+ name = '';
9
+
10
+ @property({ reflect: true })
11
+ transitionIn = '';
12
+
13
+ @property({ reflect: true })
14
+ transitionOut = '';
15
+
16
+ @property({ reflect: true })
17
+ transitioning: 'in' | 'out' | '' = '';
18
+
19
+ @property({ type: Number, reflect: true })
20
+ transitionDuration = 300;
21
+
22
+ @watch('transitionIn')
23
+ handleTransitionIn() {
24
+ if (this.transitionIn) {
25
+ this.transitioning = 'in';
26
+ }
27
+ }
28
+
29
+ @watch('transitionOut')
30
+ handleTransitionOut() {
31
+ if (this.transitionOut) {
32
+ this.transitioning = 'out';
33
+ }
34
+ }
35
+
36
+ html() {
37
+ return /*html*/`
38
+ <div class="tab-panel" part="base">
39
+ <slot></slot>
40
+ </div>
41
+ `;
42
+ }
43
+
44
+ css() {
45
+ return css;
46
+ }
47
+ }
@@ -0,0 +1,96 @@
1
+ :host {
2
+ display: block;
3
+ position: relative;
4
+ cursor: pointer;
5
+ }
6
+
7
+ :host([disabled]) {
8
+ cursor: not-allowed;
9
+ }
10
+
11
+ .tab {
12
+ display: flex;
13
+ align-items: center;
14
+ gap: var(--snice-spacing-xs);
15
+ padding: var(--snice-spacing-sm) var(--snice-spacing-md);
16
+ min-height: 3rem; /* 48px */
17
+ color: var(--snice-color-text-secondary);
18
+ font-family: var(--snice-font-family);
19
+ font-size: var(--snice-font-size-md);
20
+ font-weight: var(--snice-font-weight-medium);
21
+ background: transparent;
22
+ border: none;
23
+ position: relative;
24
+ transition: color var(--snice-transition-fast) ease,
25
+ background-color var(--snice-transition-fast) ease;
26
+ user-select: none;
27
+ white-space: nowrap;
28
+ outline: none;
29
+ }
30
+
31
+ .tab:hover:not(.tab--disabled) {
32
+ color: var(--snice-color-text);
33
+ background-color: var(--snice-color-background-secondary);
34
+ }
35
+
36
+ .tab:focus-visible {
37
+ box-shadow: inset 0 0 0 2px var(--snice-color-primary);
38
+ border-radius: var(--snice-border-radius-md);
39
+ }
40
+
41
+ .tab--disabled {
42
+ opacity: 0.5;
43
+ color: var(--snice-color-text-tertiary);
44
+ }
45
+
46
+ :host(.snice-tab--active) .tab {
47
+ color: var(--snice-color-primary);
48
+ }
49
+
50
+ :host(.snice-tab--active) .tab:hover {
51
+ color: var(--snice-color-primary-hover);
52
+ background-color: rgb(var(--snice-color-blue-500) / 0.1);
53
+ }
54
+
55
+ .tab__label {
56
+ flex: 1;
57
+ display: flex;
58
+ align-items: center;
59
+ gap: var(--snice-spacing-xs);
60
+ }
61
+
62
+ .tab__close {
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: center;
66
+ width: 1.25rem; /* 20px */
67
+ height: 1.25rem; /* 20px */
68
+ padding: 0;
69
+ border: none;
70
+ border-radius: var(--snice-border-radius-sm);
71
+ background: transparent;
72
+ color: var(--snice-color-text-tertiary);
73
+ cursor: pointer;
74
+ transition: color var(--snice-transition-fast) ease,
75
+ background-color var(--snice-transition-fast) ease;
76
+ outline: none;
77
+ }
78
+
79
+ .tab__close:hover {
80
+ color: var(--snice-color-text);
81
+ background-color: var(--snice-color-background-tertiary);
82
+ }
83
+
84
+ .tab__close:focus-visible {
85
+ box-shadow: 0 0 0 2px var(--snice-color-primary);
86
+ }
87
+
88
+ .tab__close svg {
89
+ display: block;
90
+ }
91
+
92
+ ::slotted(*) {
93
+ display: flex;
94
+ align-items: center;
95
+ gap: var(--snice-spacing-xs);
96
+ }
@@ -0,0 +1,65 @@
1
+ import { element, property, query, on, dispatch } from 'snice';
2
+ import css from './snice-tab.css?inline';
3
+ import type { TabSelectDetail, TabCloseDetail, SniceTabElement } from './snice-tabs.types';
4
+
5
+ @element('snice-tab')
6
+ export class SniceTab extends HTMLElement implements SniceTabElement {
7
+ @property({ type: Boolean, reflect: true })
8
+ disabled = false;
9
+
10
+ @property({ type: Boolean, reflect: true })
11
+ closable = false;
12
+
13
+ @query('.tab')
14
+ tab?: HTMLElement;
15
+
16
+ @query('.tab__close')
17
+ closeButton?: HTMLButtonElement;
18
+
19
+ html() {
20
+ return /*html*/`
21
+ <div class="tab ${this.disabled ? 'tab--disabled' : ''}" part="base" tabindex="0">
22
+ <span class="tab__label" part="label">
23
+ <slot></slot>
24
+ </span>
25
+ ${this.closable ? /*html*/`
26
+ <button class="tab__close" part="close" tabindex="-1" aria-label="Close tab">
27
+ <svg viewBox="0 0 24 24" width="14" height="14">
28
+ <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" fill="currentColor"/>
29
+ </svg>
30
+ </button>
31
+ ` : ''}
32
+ </div>
33
+ `;
34
+ }
35
+
36
+ css() {
37
+ return css;
38
+ }
39
+
40
+ @on('click', '.tab__close')
41
+ @dispatch('@snice/close')
42
+ handleClose(event: MouseEvent): TabCloseDetail {
43
+ event.stopPropagation();
44
+ return { tab: this } as TabCloseDetail;
45
+ }
46
+
47
+ @on('click')
48
+ @dispatch('@snice/tab-select')
49
+ handleClick(event: MouseEvent): TabSelectDetail | undefined {
50
+ if (this.disabled) {
51
+ event.preventDefault();
52
+ event.stopPropagation();
53
+ return;
54
+ }
55
+ return { tab: this } as TabSelectDetail;
56
+ }
57
+
58
+ focus(options?: FocusOptions) {
59
+ this.tab?.focus(options);
60
+ }
61
+
62
+ blur() {
63
+ this.tab?.blur();
64
+ }
65
+ }
@@ -0,0 +1,189 @@
1
+ :host {
2
+ display: block;
3
+ position: relative;
4
+ /* CSS custom properties for child components */
5
+ --snice-tabs-panel-padding: var(--snice-spacing-md);
6
+ --snice-tabs-transition-duration: 300ms;
7
+ }
8
+
9
+ .tabs {
10
+ display: flex;
11
+ width: 100%;
12
+ }
13
+
14
+ .tabs--top {
15
+ flex-direction: column;
16
+ }
17
+
18
+ .tabs--bottom {
19
+ flex-direction: column-reverse;
20
+ }
21
+
22
+ .tabs--start {
23
+ flex-direction: row;
24
+ }
25
+
26
+ .tabs--end {
27
+ flex-direction: row-reverse;
28
+ }
29
+
30
+ .tabs__nav-container {
31
+ display: flex;
32
+ position: relative;
33
+ border-bottom: 1px solid var(--snice-color-border);
34
+ }
35
+
36
+ .tabs--bottom .tabs__nav-container {
37
+ border-bottom: none;
38
+ border-top: 1px solid var(--snice-color-border);
39
+ }
40
+
41
+ .tabs--start .tabs__nav-container,
42
+ .tabs--end .tabs__nav-container {
43
+ flex-direction: column;
44
+ border-bottom: none;
45
+ border-right: 1px solid var(--snice-color-border);
46
+ min-width: 12.5rem; /* 200px */
47
+ }
48
+
49
+ .tabs--end .tabs__nav-container {
50
+ border-right: none;
51
+ border-left: 1px solid var(--snice-color-border);
52
+ }
53
+
54
+ .tabs__nav {
55
+ flex: 1;
56
+ display: flex;
57
+ overflow-x: auto;
58
+ overflow-y: hidden;
59
+ scrollbar-width: none;
60
+ -ms-overflow-style: none;
61
+ position: relative;
62
+ }
63
+
64
+ .tabs__nav::-webkit-scrollbar {
65
+ display: none;
66
+ }
67
+
68
+ .tabs--start .tabs__nav,
69
+ .tabs--end .tabs__nav {
70
+ overflow-x: hidden;
71
+ overflow-y: auto;
72
+ }
73
+
74
+ .tabs__nav-track {
75
+ display: flex;
76
+ position: relative;
77
+ align-items: center;
78
+ min-height: 3rem; /* 48px */
79
+ }
80
+
81
+ .tabs--start .tabs__nav-track,
82
+ .tabs--end .tabs__nav-track {
83
+ flex-direction: column;
84
+ align-items: stretch;
85
+ width: 100%;
86
+ }
87
+
88
+ .tabs__indicator {
89
+ position: absolute;
90
+ background-color: var(--snice-color-primary);
91
+ transition: transform var(--snice-transition-medium) ease,
92
+ width var(--snice-transition-medium) ease,
93
+ height var(--snice-transition-medium) ease;
94
+ bottom: 0;
95
+ left: 0;
96
+ pointer-events: none;
97
+ }
98
+
99
+ .tabs--bottom .tabs__indicator {
100
+ bottom: auto;
101
+ top: 0;
102
+ }
103
+
104
+ .tabs--start .tabs__indicator,
105
+ .tabs--end .tabs__indicator {
106
+ bottom: auto;
107
+ top: 0;
108
+ right: 0;
109
+ left: auto;
110
+ }
111
+
112
+ .tabs--end .tabs__indicator {
113
+ right: auto;
114
+ left: 0;
115
+ }
116
+
117
+ .tabs__scroll-button {
118
+ display: none;
119
+ align-items: center;
120
+ justify-content: center;
121
+ width: 2rem; /* 32px */
122
+ height: 3rem; /* 48px */
123
+ padding: 0;
124
+ border: none;
125
+ background: var(--snice-color-background);
126
+ color: var(--snice-color-text-secondary);
127
+ cursor: pointer;
128
+ transition: color var(--snice-transition-fast) ease,
129
+ background-color var(--snice-transition-fast) ease,
130
+ opacity var(--snice-transition-fast) ease;
131
+ }
132
+
133
+ .tabs__scroll-button--visible {
134
+ display: flex;
135
+ }
136
+
137
+ .tabs--start .tabs__scroll-button--visible,
138
+ .tabs--end .tabs__scroll-button--visible {
139
+ display: flex;
140
+ width: 100%;
141
+ height: 2rem; /* 32px */
142
+ }
143
+
144
+ .tabs__scroll-button:hover:not(.tabs__scroll-button--disabled) {
145
+ color: var(--snice-color-text);
146
+ background: var(--snice-color-background-secondary);
147
+ }
148
+
149
+ .tabs__scroll-button:focus-visible {
150
+ outline: 2px solid var(--snice-color-primary);
151
+ outline-offset: -2px;
152
+ }
153
+
154
+ .tabs__scroll-button--disabled {
155
+ opacity: 0.3;
156
+ cursor: not-allowed;
157
+ }
158
+
159
+ .tabs__scroll-button svg {
160
+ display: block;
161
+ }
162
+
163
+ .tabs__panels {
164
+ flex: 1;
165
+ padding: var(--snice-tabs-panel-padding);
166
+ position: relative;
167
+ /* Prevent scrollbars during transitions */
168
+ overflow: hidden;
169
+ /* Maintain minimum height during transitions */
170
+ min-height: 12.5rem; /* 200px */
171
+ }
172
+
173
+ ::slotted(snice-tab) {
174
+ flex: 0 0 auto;
175
+ }
176
+
177
+ .tabs--start ::slotted(snice-tab),
178
+ .tabs--end ::slotted(snice-tab) {
179
+ width: 100%;
180
+ }
181
+
182
+ /* Base panel styles */
183
+ ::slotted(snice-tab-panel) {
184
+ display: block;
185
+ }
186
+
187
+ ::slotted(snice-tab-panel[hidden]) {
188
+ display: none !important;
189
+ }