@techsio/ui-kit 0.41.2 → 0.42.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 (40) hide show
  1. package/dist/internal/molecules/drawer.context.js +133 -0
  2. package/dist/internal/molecules/drawer.styles.js +107 -0
  3. package/dist/internal/organisms/sidebar.context.js +223 -0
  4. package/dist/internal/organisms/sidebar.focus.js +169 -0
  5. package/dist/internal/organisms/sidebar.styles.js +146 -0
  6. package/dist/molecules/drawer.js +262 -0
  7. package/dist/organisms/sidebar.js +448 -0
  8. package/dist/src/internal/molecules/drawer.context.d.ts +53 -0
  9. package/dist/src/internal/molecules/drawer.context.d.ts.map +1 -0
  10. package/dist/src/internal/molecules/drawer.styles.d.ts +115 -0
  11. package/dist/src/internal/molecules/drawer.styles.d.ts.map +1 -0
  12. package/dist/src/internal/organisms/sidebar.context.d.ts +83 -0
  13. package/dist/src/internal/organisms/sidebar.context.d.ts.map +1 -0
  14. package/dist/src/internal/organisms/sidebar.focus.d.ts +16 -0
  15. package/dist/src/internal/organisms/sidebar.focus.d.ts.map +1 -0
  16. package/dist/src/internal/organisms/sidebar.styles.d.ts +149 -0
  17. package/dist/src/internal/organisms/sidebar.styles.d.ts.map +1 -0
  18. package/dist/src/molecules/drawer.d.ts +112 -0
  19. package/dist/src/molecules/drawer.d.ts.map +1 -0
  20. package/dist/src/molecules/switch.d.ts +3 -3
  21. package/dist/src/molecules/toast.d.ts +6 -6
  22. package/dist/src/organisms/sidebar.d.ts +93 -0
  23. package/dist/src/organisms/sidebar.d.ts.map +1 -0
  24. package/dist/src/types/zag.d.ts +1 -0
  25. package/dist/src/types/zag.d.ts.map +1 -1
  26. package/dist/stories/changelog/changelog.stories.d.ts.map +1 -1
  27. package/dist/stories/molecules/drawer.stories.d.ts +158 -0
  28. package/dist/stories/molecules/drawer.stories.d.ts.map +1 -0
  29. package/dist/stories/organisms/sidebar.stories.d.ts +66 -0
  30. package/dist/stories/organisms/sidebar.stories.d.ts.map +1 -0
  31. package/dist/test/drawer.behavior.spec.d.ts +2 -0
  32. package/dist/test/drawer.behavior.spec.d.ts.map +1 -0
  33. package/dist/test/sidebar.behavior.spec.d.ts +2 -0
  34. package/dist/test/sidebar.behavior.spec.d.ts.map +1 -0
  35. package/dist/test/sidebar.ssr.bun.d.ts +2 -0
  36. package/dist/test/sidebar.ssr.bun.d.ts.map +1 -0
  37. package/package.json +25 -22
  38. package/src/tokens/components/components.css +2 -0
  39. package/src/tokens/components/molecules/_drawer.css +369 -0
  40. package/src/tokens/components/organisms/_sidebar.css +93 -0
@@ -0,0 +1,369 @@
1
+ @theme static {
2
+ /* BASE COLOR MAPPING */
3
+ --color-drawer-surface: var(--color-fill-surface);
4
+ --color-drawer-foreground: var(--color-fg-primary);
5
+ --color-drawer-muted-foreground: var(--color-fg-secondary);
6
+ --color-drawer-border: var(--color-border-primary);
7
+ --color-drawer-overlay: var(--color-bg-scrim);
8
+ --color-drawer-focus: var(--color-primary);
9
+
10
+ /* DERIVED COLORS */
11
+ --color-drawer-content-bg: var(--color-drawer-surface);
12
+ --color-drawer-content-fg: var(--color-drawer-foreground);
13
+ --color-drawer-content-border: var(--color-drawer-border);
14
+ --color-drawer-title-fg: var(--color-drawer-foreground);
15
+ --color-drawer-description-fg: var(--color-drawer-muted-foreground);
16
+ --color-drawer-backdrop-bg: var(--color-drawer-overlay);
17
+ --color-drawer-grabber-bg: var(--color-drawer-border);
18
+ --color-drawer-ring: var(--color-drawer-focus);
19
+
20
+ /* SPACING */
21
+ --padding-drawer-header: var(--dimension-24);
22
+ --padding-drawer-body: var(--dimension-24);
23
+ --padding-drawer-footer: var(--dimension-24);
24
+ --padding-drawer-grabber: var(--dimension-8);
25
+ --spacing-drawer-bleed: var(--dimension-48);
26
+ --spacing-drawer-indent-offset: var(--dimension-8);
27
+ --gap-drawer-header: var(--dimension-8);
28
+ --gap-drawer-footer: var(--dimension-10);
29
+
30
+ /* TYPOGRAPHY */
31
+ --text-drawer-title: var(--text-md);
32
+ --font-weight-drawer-title: var(--font-weight-semibold);
33
+ --text-drawer-description: var(--text-sm);
34
+
35
+ /* BORDERS & RADIUS */
36
+ --border-width-drawer: var(--border-width-sm);
37
+ --radius-drawer-content: var(--radius-md);
38
+ --radius-drawer-grabber: var(--radius-full);
39
+
40
+ /* SHADOWS */
41
+ --shadow-drawer-content: var(--shadow-xl);
42
+
43
+ /* FOCUS RINGS */
44
+ --outline-drawer-focus-style: var(--default-ring-style);
45
+ --outline-drawer-focus-width: var(--default-ring-width);
46
+ --outline-drawer-focus-offset: var(--default-ring-offset);
47
+
48
+ /* MOTION */
49
+ --duration-drawer-backdrop-enter: 200ms;
50
+ --duration-drawer-backdrop-exit: 160ms;
51
+ --duration-drawer-enter: 240ms;
52
+ --duration-drawer-exit: 180ms;
53
+ --duration-drawer-stack: 240ms;
54
+
55
+ /* SIZES */
56
+ --container-drawer-xs: var(--container-xs);
57
+ --container-drawer-sm: var(--container-sm);
58
+ --container-drawer-md: var(--container-md);
59
+ --container-drawer-lg: var(--container-lg);
60
+ --container-drawer-xl: var(--container-xl);
61
+ --height-drawer-xs: var(--container-xs);
62
+ --height-drawer-sm: var(--container-sm);
63
+ --height-drawer-md: var(--container-md);
64
+ --height-drawer-lg: var(--container-lg);
65
+ --height-drawer-xl: var(--container-xl);
66
+ --height-drawer-grabber-thickness: var(--dimension-4);
67
+ --width-drawer-grabber-thickness: var(--dimension-4);
68
+ --height-drawer-grabber-length: var(--dimension-40);
69
+ --width-drawer-grabber-length: var(--dimension-40);
70
+ --height-drawer-swipe-area: var(--dimension-16);
71
+ --width-drawer-swipe-area: var(--dimension-16);
72
+
73
+ /* LAYERS */
74
+ --z-drawer-layer: 50;
75
+ --z-drawer-swipe-area: 49;
76
+ }
77
+
78
+ @utility token-icon-drawer-close {
79
+ @apply token-icon-close;
80
+ }
81
+
82
+ @utility drawer-physical-axis {
83
+ direction: ltr;
84
+ }
85
+
86
+ @utility drawer-focus-ring {
87
+ outline-color: var(--color-drawer-ring);
88
+ outline-offset: var(--outline-drawer-focus-offset);
89
+ outline-style: var(--outline-drawer-focus-style);
90
+ outline-width: var(--outline-drawer-focus-width);
91
+ }
92
+
93
+ @utility drawer-title-typography {
94
+ font-size: var(--text-drawer-title);
95
+ }
96
+
97
+ @utility drawer-description-typography {
98
+ font-size: var(--text-drawer-description);
99
+ }
100
+
101
+ /* Zag Presence 1.43.x completes lifecycle callbacks on animationend. */
102
+ @keyframes drawer-enter-presence {
103
+ from,
104
+ to {
105
+ opacity: 1;
106
+ }
107
+ }
108
+
109
+ @keyframes drawer-backdrop-out {
110
+ from {
111
+ opacity: calc(1 - var(--drawer-swipe-progress, 0));
112
+ }
113
+ to {
114
+ opacity: 0;
115
+ }
116
+ }
117
+
118
+ @keyframes drawer-exit-left {
119
+ to {
120
+ transform: translate3d(-100%, 0, 0);
121
+ }
122
+ }
123
+
124
+ @keyframes drawer-exit-right {
125
+ to {
126
+ transform: translate3d(100%, 0, 0);
127
+ }
128
+ }
129
+
130
+ @keyframes drawer-exit-up {
131
+ to {
132
+ transform: translate3d(0, -100%, 0);
133
+ }
134
+ }
135
+
136
+ @keyframes drawer-exit-down {
137
+ to {
138
+ transform: translate3d(0, 100%, 0);
139
+ }
140
+ }
141
+
142
+ @utility drawer-backdrop-motion {
143
+ opacity: calc(1 - var(--drawer-swipe-progress, 0));
144
+ transition-duration: calc(
145
+ var(--duration-drawer-backdrop-enter) *
146
+ var(--drawer-swipe-strength, 1)
147
+ );
148
+ transition-property: opacity;
149
+ transition-timing-function: ease-out;
150
+
151
+ &[data-state="open"] {
152
+ animation: drawer-enter-presence
153
+ calc(
154
+ var(--duration-drawer-backdrop-enter) *
155
+ var(--drawer-swipe-strength, 1)
156
+ )
157
+ linear;
158
+ }
159
+
160
+ &[data-state="closed"] {
161
+ animation: drawer-backdrop-out
162
+ calc(
163
+ var(--duration-drawer-backdrop-exit) *
164
+ var(--drawer-swipe-strength, 1)
165
+ )
166
+ ease-in both;
167
+ }
168
+
169
+ &[data-swiping] {
170
+ transition-duration: 0ms;
171
+ }
172
+
173
+ @starting-style {
174
+ &[data-state="open"]:not([data-swiping]) {
175
+ opacity: 0;
176
+ }
177
+ }
178
+
179
+ @media (prefers-reduced-motion: reduce) {
180
+ animation-duration: 0s !important;
181
+ transition-duration: 0s;
182
+ }
183
+ }
184
+
185
+ @utility drawer-content-motion {
186
+ translate: 0 0;
187
+ transition-duration: calc(
188
+ var(--duration-drawer-enter) *
189
+ var(--drawer-swipe-strength, 1)
190
+ );
191
+ transition-property: transform, translate;
192
+ transition-timing-function: ease-out;
193
+
194
+ &[data-state="open"] {
195
+ animation: drawer-enter-presence
196
+ calc(var(--duration-drawer-enter) * var(--drawer-swipe-strength, 1))
197
+ linear;
198
+ }
199
+
200
+ &[data-state="closed"][data-swipe-direction="left"] {
201
+ animation: drawer-exit-left
202
+ calc(var(--duration-drawer-exit) * var(--drawer-swipe-strength, 1))
203
+ ease-in both;
204
+ }
205
+
206
+ &[data-state="closed"][data-swipe-direction="right"] {
207
+ animation: drawer-exit-right
208
+ calc(var(--duration-drawer-exit) * var(--drawer-swipe-strength, 1))
209
+ ease-in both;
210
+ }
211
+
212
+ &[data-state="closed"][data-swipe-direction="up"] {
213
+ animation: drawer-exit-up
214
+ calc(var(--duration-drawer-exit) * var(--drawer-swipe-strength, 1))
215
+ ease-in both;
216
+ }
217
+
218
+ &[data-state="closed"][data-swipe-direction="down"] {
219
+ animation: drawer-exit-down
220
+ calc(var(--duration-drawer-exit) * var(--drawer-swipe-strength, 1))
221
+ ease-in both;
222
+ }
223
+
224
+ @starting-style {
225
+ &[data-state="open"][data-swipe-direction="left"]:not([data-swiping]) {
226
+ translate: -100% 0;
227
+ }
228
+
229
+ &[data-state="open"][data-swipe-direction="right"]:not([data-swiping]) {
230
+ translate: 100% 0;
231
+ }
232
+
233
+ &[data-state="open"][data-swipe-direction="up"]:not([data-swiping]) {
234
+ translate: 0 -100%;
235
+ }
236
+
237
+ &[data-state="open"][data-swipe-direction="down"]:not([data-swiping]) {
238
+ translate: 0 100%;
239
+ }
240
+ }
241
+
242
+ @media (prefers-reduced-motion: reduce) {
243
+ animation-duration: 0s !important;
244
+ transition-duration: 0s !important;
245
+ }
246
+ }
247
+
248
+ @utility drawer-backdrop-layer {
249
+ z-index: calc(var(--z-drawer-layer) + var(--layer-index, 0) - 1);
250
+ }
251
+
252
+ @utility drawer-positioner-layer {
253
+ z-index: calc(var(--z-drawer-layer) + var(--layer-index, 0));
254
+ }
255
+
256
+ @utility drawer-content-layer {
257
+ z-index: calc(var(--z-drawer-layer) + var(--layer-index, 0));
258
+ }
259
+
260
+ @utility drawer-swipe-area-layer {
261
+ z-index: var(--z-drawer-swipe-area);
262
+ }
263
+
264
+ @utility drawer-content-bleed {
265
+ --drawer-bleed: var(--spacing-drawer-bleed);
266
+
267
+ &::after {
268
+ position: absolute;
269
+ background: inherit;
270
+ content: "";
271
+ pointer-events: none;
272
+ }
273
+
274
+ &[data-swipe-direction="up"]::after {
275
+ right: 0;
276
+ bottom: 100%;
277
+ left: 0;
278
+ height: var(--drawer-bleed);
279
+ }
280
+
281
+ &[data-swipe-direction="down"]::after {
282
+ top: 100%;
283
+ right: 0;
284
+ left: 0;
285
+ height: var(--drawer-bleed);
286
+ }
287
+
288
+ &[data-swipe-direction="left"]::after {
289
+ top: 0;
290
+ right: 100%;
291
+ bottom: 0;
292
+ width: var(--drawer-bleed);
293
+ }
294
+
295
+ &[data-swipe-direction="right"]::after {
296
+ top: 0;
297
+ bottom: 0;
298
+ left: 100%;
299
+ width: var(--drawer-bleed);
300
+ }
301
+ }
302
+
303
+ @utility drawer-content-top {
304
+ border-radius: 0 0 var(--radius-drawer-content) var(--radius-drawer-content);
305
+ }
306
+
307
+ @utility drawer-content-bottom {
308
+ border-radius: var(--radius-drawer-content) var(--radius-drawer-content) 0 0;
309
+ }
310
+
311
+ @utility drawer-content-left {
312
+ border-radius: 0 var(--radius-drawer-content) var(--radius-drawer-content) 0;
313
+ }
314
+
315
+ @utility drawer-content-right {
316
+ border-radius: var(--radius-drawer-content) 0 0 var(--radius-drawer-content);
317
+ }
318
+
319
+ @utility drawer-indent {
320
+ --drawer-indent-progress: clamp(0, var(--drawer-swipe-progress, 0), 1);
321
+
322
+ position: relative;
323
+ transform-origin: center top;
324
+ transition:
325
+ transform var(--duration-drawer-stack) ease-out,
326
+ border-radius var(--duration-drawer-stack) ease-out;
327
+ will-change: transform;
328
+
329
+ &[data-active] {
330
+ border-radius: calc(
331
+ var(--radius-drawer-content) *
332
+ (1 - var(--drawer-indent-progress))
333
+ );
334
+ transform: scale(calc(0.97 + 0.03 * var(--drawer-indent-progress)))
335
+ translateY(
336
+ calc(
337
+ var(--spacing-drawer-indent-offset) *
338
+ (1 - var(--drawer-indent-progress))
339
+ )
340
+ );
341
+ }
342
+
343
+ &[data-inactive] {
344
+ border-radius: 0;
345
+ transform: none;
346
+ }
347
+
348
+ @media (prefers-reduced-motion: reduce) {
349
+ transition-duration: 0s;
350
+ }
351
+ }
352
+
353
+ @utility drawer-indent-background {
354
+ position: fixed;
355
+ inset: 0;
356
+ z-index: calc(var(--z-drawer-layer) - 1);
357
+ background: var(--color-drawer-content-bg);
358
+ opacity: 0;
359
+ pointer-events: none;
360
+ transition: opacity var(--duration-drawer-stack) ease-out;
361
+
362
+ &[data-active] {
363
+ opacity: 1;
364
+ }
365
+
366
+ @media (prefers-reduced-motion: reduce) {
367
+ transition-duration: 0s;
368
+ }
369
+ }
@@ -0,0 +1,93 @@
1
+ @theme static {
2
+ /* BASE COLOR MAPPING */
3
+ --color-sidebar-surface: var(--color-fill-surface);
4
+ --color-sidebar-base: var(--color-base);
5
+ --color-sidebar-foreground: var(--color-fg-primary);
6
+ --color-sidebar-muted-foreground: var(--color-fg-secondary);
7
+ --color-sidebar-border: var(--color-border-primary);
8
+ --color-sidebar-interactive: var(--color-fill-overlay);
9
+ --color-sidebar-focus: var(--color-primary);
10
+
11
+ /* DERIVED COLORS */
12
+ --color-sidebar-root-bg: var(--color-sidebar-base);
13
+ --color-sidebar-root-fg: var(--color-sidebar-foreground);
14
+ --color-sidebar-panel-bg: var(--color-sidebar-surface);
15
+ --color-sidebar-panel-fg: var(--color-sidebar-foreground);
16
+ --color-sidebar-panel-border: var(--color-sidebar-border);
17
+ --color-sidebar-inset-bg: var(--color-sidebar-base);
18
+ --color-sidebar-inset-fg: var(--color-sidebar-foreground);
19
+ --color-sidebar-group-label-fg: var(--color-sidebar-muted-foreground);
20
+ --color-sidebar-pane-border: var(--color-sidebar-border);
21
+ --color-sidebar-separator-bg: var(--color-sidebar-border);
22
+ --color-sidebar-trigger-bg: transparent;
23
+ --color-sidebar-trigger-bg-hover: var(--color-sidebar-interactive);
24
+ --color-sidebar-trigger-bg-active: var(--color-sidebar-interactive);
25
+ --color-sidebar-trigger-fg: var(--color-sidebar-foreground);
26
+ --color-sidebar-rail-bg-hover: var(--color-sidebar-interactive);
27
+ --color-sidebar-rail-fg: var(--color-sidebar-muted-foreground);
28
+ --color-sidebar-rail-indicator-bg: var(--color-sidebar-border);
29
+ --color-sidebar-ring: var(--color-sidebar-focus);
30
+
31
+ /* RESPONSIVE CONTRACT */
32
+ --breakpoint-sidebar-desktop: 64rem;
33
+
34
+ /* VIEWPORT AND WIDTHS */
35
+ --spacing-sidebar-offset: 0rem;
36
+ --height-sidebar-viewport: calc(100dvh - var(--spacing-sidebar-offset));
37
+ --width-sidebar-expanded: var(--container-3xs);
38
+ --width-sidebar-icon: var(--dimension-56);
39
+ --container-sidebar-mobile: var(--container-2xs);
40
+ --width-sidebar-rail: var(--dimension-12);
41
+ --width-sidebar-rail-indicator: var(--dimension-2);
42
+ --height-sidebar-rail-indicator: var(--dimension-32);
43
+ --height-sidebar-separator: var(--dimension-1);
44
+
45
+ /* SPACING */
46
+ --padding-sidebar-section: var(--dimension-16);
47
+ --padding-sidebar-section-compact: var(--dimension-8);
48
+ --padding-sidebar-content: var(--dimension-12);
49
+ --padding-sidebar-content-compact: var(--dimension-8);
50
+ --padding-sidebar-group-label: var(--dimension-8);
51
+ --gap-sidebar-section: var(--dimension-8);
52
+ --gap-sidebar-content: var(--dimension-16);
53
+ --gap-sidebar-group: var(--dimension-8);
54
+ --gap-sidebar-group-content: var(--dimension-4);
55
+ --gap-sidebar-menu: var(--dimension-4);
56
+ --spacing-sidebar-rail: 0rem;
57
+
58
+ /* TYPOGRAPHY */
59
+ --text-sidebar-group-label: var(--text-xs);
60
+ --font-weight-sidebar-group-label: var(--font-weight-semibold);
61
+
62
+ /* BORDER, RADIUS, MOTION, LAYER */
63
+ --border-width-sidebar: var(--border-width-sm);
64
+ --radius-sidebar-rail: var(--radius-full);
65
+ --outline-sidebar-focus-offset: var(--default-ring-offset);
66
+ --outline-sidebar-focus-style: var(--default-ring-style);
67
+ --outline-sidebar-focus-width: var(--default-ring-width);
68
+ --duration-sidebar: 200ms;
69
+ --z-sidebar-rail: 10;
70
+ }
71
+
72
+ @utility token-icon-sidebar-trigger {
73
+ @apply token-icon-menu;
74
+ }
75
+
76
+ @utility token-icon-sidebar-close {
77
+ @apply token-icon-close;
78
+ }
79
+
80
+ @utility sidebar-focus-ring {
81
+ outline-color: var(--color-sidebar-ring);
82
+ outline-offset: var(--outline-sidebar-focus-offset);
83
+ outline-style: var(--outline-sidebar-focus-style);
84
+ outline-width: var(--outline-sidebar-focus-width);
85
+ }
86
+
87
+ @utility sidebar-group-label-typography {
88
+ font-size: var(--text-sidebar-group-label);
89
+ }
90
+
91
+ @utility sidebar-rail-layer {
92
+ z-index: var(--z-sidebar-rail);
93
+ }