@casinogate/ui 1.1.3 → 1.2.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 (75) hide show
  1. package/dist/assets/css/root.css +127 -20
  2. package/dist/assets/css/theme.css +2 -2
  3. package/dist/components/app-shell/app-shell.stories.svelte +107 -0
  4. package/dist/components/app-shell/app-shell.stories.svelte.d.ts +18 -0
  5. package/dist/components/app-shell/components/app-shell.content.svelte +45 -0
  6. package/dist/components/app-shell/components/app-shell.content.svelte.d.ts +7 -0
  7. package/dist/components/app-shell/components/app-shell.header.svelte +45 -0
  8. package/dist/components/app-shell/components/app-shell.header.svelte.d.ts +7 -0
  9. package/dist/components/app-shell/components/app-shell.nav-bar.svelte +45 -0
  10. package/dist/components/app-shell/components/app-shell.nav-bar.svelte.d.ts +7 -0
  11. package/dist/components/app-shell/components/app-shell.root.svelte +70 -0
  12. package/dist/components/app-shell/components/app-shell.root.svelte.d.ts +13 -0
  13. package/dist/components/app-shell/components/app-shell.sidebar-footer.svelte +45 -0
  14. package/dist/components/app-shell/components/app-shell.sidebar-footer.svelte.d.ts +7 -0
  15. package/dist/components/app-shell/components/app-shell.sidebar-head.svelte +45 -0
  16. package/dist/components/app-shell/components/app-shell.sidebar-head.svelte.d.ts +7 -0
  17. package/dist/components/app-shell/components/app-shell.sidebar-toggle.svelte +55 -0
  18. package/dist/components/app-shell/components/app-shell.sidebar-toggle.svelte.d.ts +7 -0
  19. package/dist/components/app-shell/components/app-shell.sidebar.svelte +45 -0
  20. package/dist/components/app-shell/components/app-shell.sidebar.svelte.d.ts +7 -0
  21. package/dist/components/app-shell/components/app-shell.svelte.d.ts +122 -0
  22. package/dist/components/app-shell/components/app-shell.svelte.js +184 -0
  23. package/dist/components/app-shell/components/app-shell.viewport.svelte +45 -0
  24. package/dist/components/app-shell/components/app-shell.viewport.svelte.d.ts +7 -0
  25. package/dist/components/app-shell/index.d.ts +20 -0
  26. package/dist/components/app-shell/index.js +20 -0
  27. package/dist/components/app-shell/styles.d.ts +83 -0
  28. package/dist/components/app-shell/styles.js +67 -0
  29. package/dist/components/app-shell/types.d.ts +7 -0
  30. package/dist/components/app-shell/types.js +1 -0
  31. package/dist/components/button-group/components/button-group.root.svelte +1 -2
  32. package/dist/components/checkbox/components/checkbox.root.svelte +2 -1
  33. package/dist/components/collapsible/components/collapsaible.content.svelte +1 -2
  34. package/dist/components/collapsible/components/collapsaible.root.svelte +1 -2
  35. package/dist/components/collapsible/components/collapsaible.trigger.svelte +1 -2
  36. package/dist/components/data-table/components/data-table.body.svelte +2 -2
  37. package/dist/components/data-table/components/data-table.cell.svelte +1 -2
  38. package/dist/components/data-table/components/data-table.head.svelte +1 -2
  39. package/dist/components/data-table/components/data-table.header.svelte +1 -2
  40. package/dist/components/data-table/components/data-table.resize-handler.svelte +1 -2
  41. package/dist/components/data-table/components/data-table.root.svelte +2 -3
  42. package/dist/components/data-table/components/data-table.root.svelte.d.ts +1 -2
  43. package/dist/components/data-table/components/data-table.row.svelte +1 -2
  44. package/dist/components/data-table/components/data-table.sort-button.svelte +1 -2
  45. package/dist/components/data-table/components/data-table.table.svelte +2 -3
  46. package/dist/components/data-table/components/data-table.table.svelte.d.ts +1 -2
  47. package/dist/components/field/components/field.control.svelte +1 -1
  48. package/dist/components/field/components/field.description.svelte +1 -2
  49. package/dist/components/field/components/field.error.svelte +1 -2
  50. package/dist/components/field/components/field.label.svelte +1 -2
  51. package/dist/components/field/components/field.root.svelte +1 -2
  52. package/dist/components/icons/index.d.ts +1 -0
  53. package/dist/components/icons/index.js +1 -0
  54. package/dist/components/icons/sidebar-toggle.svelte +16 -0
  55. package/dist/components/icons/sidebar-toggle.svelte.d.ts +3 -0
  56. package/dist/components/input/input.password.svelte +1 -0
  57. package/dist/components/input/input.svelte +2 -3
  58. package/dist/components/segment/components/segment.item.svelte +1 -2
  59. package/dist/components/segment/components/segment.root.svelte +1 -2
  60. package/dist/components/select/components/select.trigger.svelte +2 -2
  61. package/dist/components/skeleton/skeleton.svelte +9 -3
  62. package/dist/components/skeleton/skeleton.svelte.d.ts +1 -0
  63. package/dist/components/skeleton/styles.d.ts +14 -2
  64. package/dist/components/skeleton/styles.js +5 -1
  65. package/dist/components/switch/components/switch.root.svelte +2 -2
  66. package/dist/components/switch/components/switch.thumb.svelte +2 -2
  67. package/dist/index.d.ts +1 -0
  68. package/dist/index.js +1 -0
  69. package/dist/internal/utils/attrs.d.ts +1 -0
  70. package/dist/internal/utils/attrs.js +3 -0
  71. package/dist/internal/utils/common.d.ts +1 -0
  72. package/dist/internal/utils/common.js +2 -0
  73. package/dist/internal/utils/styles.d.ts +2 -0
  74. package/dist/internal/utils/styles.js +2 -0
  75. package/package.json +1 -1
@@ -176,6 +176,9 @@
176
176
  .cgui\:absolute {
177
177
  position: absolute;
178
178
  }
179
+ .cgui\:fixed {
180
+ position: fixed;
181
+ }
179
182
  .cgui\:relative {
180
183
  position: relative;
181
184
  }
@@ -203,6 +206,9 @@
203
206
  .cgui\:bottom-0 {
204
207
  bottom: calc(var(--cgui-spacing) * 0);
205
208
  }
209
+ .cgui\:left-0 {
210
+ left: calc(var(--cgui-spacing) * 0);
211
+ }
206
212
  .cgui\:left-1\/2 {
207
213
  left: calc(1/2 * 100%);
208
214
  }
@@ -291,6 +297,9 @@
291
297
  width: 100%;
292
298
  height: 100%;
293
299
  }
300
+ .cgui\:h-\(--app-shell-header-height\) {
301
+ height: var(--app-shell-header-height);
302
+ }
294
303
  .cgui\:h-3 {
295
304
  height: calc(var(--cgui-spacing) * 3);
296
305
  }
@@ -333,6 +342,9 @@
333
342
  .cgui\:h-14 {
334
343
  height: calc(var(--cgui-spacing) * 14);
335
344
  }
345
+ .cgui\:h-20 {
346
+ height: calc(var(--cgui-spacing) * 20);
347
+ }
336
348
  .cgui\:h-34 {
337
349
  height: calc(var(--cgui-spacing) * 34);
338
350
  }
@@ -354,6 +366,9 @@
354
366
  .cgui\:min-h-11 {
355
367
  min-height: calc(var(--cgui-spacing) * 11);
356
368
  }
369
+ .cgui\:w-\(--app-shell-sidebar-width\) {
370
+ width: var(--app-shell-sidebar-width);
371
+ }
357
372
  .cgui\:w-1\.5 {
358
373
  width: calc(var(--cgui-spacing) * 1.5);
359
374
  }
@@ -414,6 +429,9 @@
414
429
  .cgui\:shrink-0 {
415
430
  flex-shrink: 0;
416
431
  }
432
+ .cgui\:grow {
433
+ flex-grow: 1;
434
+ }
417
435
  .cgui\:-translate-x-1\/2 {
418
436
  --tw-translate-x: calc(calc(1/2 * 100%) * -1);
419
437
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -422,6 +440,10 @@
422
440
  --tw-translate-y: calc(calc(1/2 * 100%) * -1);
423
441
  translate: var(--tw-translate-x) var(--tw-translate-y);
424
442
  }
443
+ .cgui\:-scale-x-\[1\] {
444
+ --tw-scale-x: calc(1 * -1);
445
+ scale: var(--tw-scale-x) var(--tw-scale-y);
446
+ }
425
447
  .cgui\:animate-pulse {
426
448
  animation: var(--cgui-animate-pulse);
427
449
  }
@@ -455,6 +477,9 @@
455
477
  .cgui\:justify-center {
456
478
  justify-content: center;
457
479
  }
480
+ .cgui\:justify-end {
481
+ justify-content: flex-end;
482
+ }
458
483
  .cgui\:justify-start {
459
484
  justify-content: flex-start;
460
485
  }
@@ -496,6 +521,9 @@
496
521
  .cgui\:overflow-hidden {
497
522
  overflow: hidden;
498
523
  }
524
+ .cgui\:overflow-y-auto {
525
+ overflow-y: auto;
526
+ }
499
527
  .cgui\:rounded-\[inherit\] {
500
528
  border-radius: inherit;
501
529
  }
@@ -530,6 +558,14 @@
530
558
  border-style: var(--tw-border-style);
531
559
  border-width: 1px;
532
560
  }
561
+ .cgui\:border-t {
562
+ border-top-style: var(--tw-border-style);
563
+ border-top-width: 1px;
564
+ }
565
+ .cgui\:border-r {
566
+ border-right-style: var(--tw-border-style);
567
+ border-right-width: 1px;
568
+ }
533
569
  .cgui\:border-b {
534
570
  border-bottom-style: var(--tw-border-style);
535
571
  border-bottom-width: 1px;
@@ -553,9 +589,24 @@
553
589
  .cgui\:border-transparent {
554
590
  border-color: transparent;
555
591
  }
592
+ .cgui\:border-t-stroke-minimum\/10 {
593
+ border-top-color: var(--cg-ui-palette-neutral-10);
594
+ @supports (color: color-mix(in lab, red, red)) {
595
+ border-top-color: color-mix(in oklab, var(--cg-ui-palette-neutral-10) 10%, transparent);
596
+ }
597
+ }
556
598
  .cgui\:border-b-stroke-default {
557
599
  border-bottom-color: var(--cg-ui-palette-neutral-40);
558
600
  }
601
+ .cgui\:border-b-stroke-minimum\/10 {
602
+ border-bottom-color: var(--cg-ui-palette-neutral-10);
603
+ @supports (color: color-mix(in lab, red, red)) {
604
+ border-bottom-color: color-mix(in oklab, var(--cg-ui-palette-neutral-10) 10%, transparent);
605
+ }
606
+ }
607
+ .cgui\:bg-bg-main {
608
+ background-color: var(--cg-ui-palette-neutral-20);
609
+ }
559
610
  .cgui\:bg-neutral-20 {
560
611
  background-color: var(--cg-ui-palette-neutral-20);
561
612
  }
@@ -574,6 +625,9 @@
574
625
  .cgui\:bg-stroke-divider {
575
626
  background-color: var(--cg-ui-palette-neutral-20);
576
627
  }
628
+ .cgui\:bg-surface-darkest {
629
+ background-color: var(--cg-ui-palette-neutral-100);
630
+ }
577
631
  .cgui\:bg-surface-light {
578
632
  background-color: var(--cg-ui-palette-neutral-20);
579
633
  }
@@ -634,6 +688,9 @@
634
688
  .cgui\:p-3 {
635
689
  padding: calc(var(--cgui-spacing) * 3);
636
690
  }
691
+ .cgui\:p-4 {
692
+ padding: calc(var(--cgui-spacing) * 4);
693
+ }
637
694
  .cgui\:px-2 {
638
695
  padding-inline: calc(var(--cgui-spacing) * 2);
639
696
  }
@@ -658,6 +715,9 @@
658
715
  .cgui\:py-2\.5 {
659
716
  padding-block: calc(var(--cgui-spacing) * 2.5);
660
717
  }
718
+ .cgui\:pt-4 {
719
+ padding-top: calc(var(--cgui-spacing) * 4);
720
+ }
661
721
  .cgui\:pr-1\.5 {
662
722
  padding-right: calc(var(--cgui-spacing) * 1.5);
663
723
  }
@@ -670,6 +730,9 @@
670
730
  .cgui\:pb-1\.5 {
671
731
  padding-bottom: calc(var(--cgui-spacing) * 1.5);
672
732
  }
733
+ .cgui\:pb-3 {
734
+ padding-bottom: calc(var(--cgui-spacing) * 3);
735
+ }
673
736
  .cgui\:pl-2\.5 {
674
737
  padding-left: calc(var(--cgui-spacing) * 2.5);
675
738
  }
@@ -797,6 +860,11 @@
797
860
  transition-timing-function: var(--tw-ease, var(--cgui-default-transition-timing-function));
798
861
  transition-duration: var(--tw-duration, var(--cgui-default-transition-duration));
799
862
  }
863
+ .cgui\:transition-transform {
864
+ transition-property: transform, translate, scale, rotate;
865
+ transition-timing-function: var(--tw-ease, var(--cgui-default-transition-timing-function));
866
+ transition-duration: var(--tw-duration, var(--cgui-default-transition-duration));
867
+ }
800
868
  .cgui\:duration-250 {
801
869
  --tw-duration: 250ms;
802
870
  transition-duration: 250ms;
@@ -829,6 +897,40 @@
829
897
  .cgui\:scrollbar-track-surface-lightest {
830
898
  --scrollbar-track: var(--cg-ui-palette-neutral-10);
831
899
  }
900
+ .cgui\:group-has-\[\[data-slot\=\"header\"\]\]\/appShell\:h-\[calc\(100\%-var\(--app-shell-header-height\)\)\] {
901
+ &:is(:where(.cgui\:group\/appShell):has(*:is([data-slot="header"])) *) {
902
+ height: calc(100% - var(--app-shell-header-height));
903
+ }
904
+ }
905
+ .cgui\:group-has-\[\[data-slot\=\"header\"\]\]\/appShell\:pt-\(--app-shell-header-height\) {
906
+ &:is(:where(.cgui\:group\/appShell):has(*:is([data-slot="header"])) *) {
907
+ padding-top: var(--app-shell-header-height);
908
+ }
909
+ }
910
+ .cgui\:group-has-\[\[data-slot\=\"sidebar\"\]\]\/appShell\:w-\[calc\(100\%-var\(--app-shell-sidebar-width\)\)\] {
911
+ &:is(:where(.cgui\:group\/appShell):has(*:is([data-slot="sidebar"])) *) {
912
+ width: calc(100% - var(--app-shell-sidebar-width));
913
+ }
914
+ }
915
+ .cgui\:group-has-\[\[data-slot\=\"sidebar\"\]\]\/appShell\:pl-\(--app-shell-sidebar-width\) {
916
+ &:is(:where(.cgui\:group\/appShell):has(*:is([data-slot="sidebar"])) *) {
917
+ padding-left: var(--app-shell-sidebar-width);
918
+ }
919
+ }
920
+ .cgui\:group-data-\[collapsed\]\/appShell\:group-has-\[\[data-slot\=\"sidebar\"\]\]\/appShell\:w-\[calc\(100\%-var\(--app-shell-sidebar-collapsed-width\)\)\] {
921
+ &:is(:where(.cgui\:group\/appShell)[data-collapsed] *) {
922
+ &:is(:where(.cgui\:group\/appShell):has(*:is([data-slot="sidebar"])) *) {
923
+ width: calc(100% - var(--app-shell-sidebar-collapsed-width));
924
+ }
925
+ }
926
+ }
927
+ .cgui\:group-data-\[collapsed\]\/appShell\:group-has-\[\[data-slot\=\"sidebar\"\]\]\/appShell\:pl-\(--app-shell-sidebar-collapsed-width\) {
928
+ &:is(:where(.cgui\:group\/appShell)[data-collapsed] *) {
929
+ &:is(:where(.cgui\:group\/appShell):has(*:is([data-slot="sidebar"])) *) {
930
+ padding-left: var(--app-shell-sidebar-collapsed-width);
931
+ }
932
+ }
933
+ }
832
934
  .cgui\:placeholder\:text-fg-regular {
833
935
  &::placeholder {
834
936
  color: var(--cg-ui-palette-neutral-50);
@@ -1007,6 +1109,11 @@
1007
1109
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1008
1110
  }
1009
1111
  }
1112
+ .cgui\:data-\[collapsed\]\:w-\(--app-shell-sidebar-collapsed-width\) {
1113
+ &[data-collapsed] {
1114
+ width: var(--app-shell-sidebar-collapsed-width);
1115
+ }
1116
+ }
1010
1117
  .cgui\:data-\[disabled\]\:pointer-events-none {
1011
1118
  &[data-disabled] {
1012
1119
  pointer-events: none;
@@ -1363,8 +1470,8 @@
1363
1470
  --cg-ui-palette-neutral-60: hsla(var(--cg-ui-neutral-hue), var(--cg-ui-neutral-saturation), 40%, 1);
1364
1471
  --cg-ui-palette-neutral-50: hsla(var(--cg-ui-neutral-hue), var(--cg-ui-neutral-saturation), 58%, 1);
1365
1472
  --cg-ui-palette-neutral-40: hsla(230, 20%, 78%, 1);
1366
- --cg-ui-palette-neutral-20: hsla(230, 20%, 95%, 1);
1367
- --cg-ui-palette-neutral-10: hsla(230, 20%, 98%, 1);
1473
+ --cg-ui-palette-neutral-20: hsla(230, 20%, 85%, 1);
1474
+ --cg-ui-palette-neutral-10: hsla(230, 20%, 95%, 1);
1368
1475
  --cg-ui-palette-neutral-0: hsla(0, 0%, 100%, 1);
1369
1476
  --cg-ui-palette-neutral-01: hsla(0, 0%, 100%, 0.1);
1370
1477
  --cg-ui-palette-system-error-100: hsla(2, 100%, 40%, 1);
@@ -1599,6 +1706,21 @@
1599
1706
  inherits: false;
1600
1707
  initial-value: 0;
1601
1708
  }
1709
+ @property --tw-scale-x {
1710
+ syntax: "*";
1711
+ inherits: false;
1712
+ initial-value: 1;
1713
+ }
1714
+ @property --tw-scale-y {
1715
+ syntax: "*";
1716
+ inherits: false;
1717
+ initial-value: 1;
1718
+ }
1719
+ @property --tw-scale-z {
1720
+ syntax: "*";
1721
+ inherits: false;
1722
+ initial-value: 1;
1723
+ }
1602
1724
  @property --tw-space-y-reverse {
1603
1725
  syntax: "*";
1604
1726
  inherits: false;
@@ -1742,21 +1864,6 @@
1742
1864
  initial-value: "";
1743
1865
  inherits: false;
1744
1866
  }
1745
- @property --tw-scale-x {
1746
- syntax: "*";
1747
- inherits: false;
1748
- initial-value: 1;
1749
- }
1750
- @property --tw-scale-y {
1751
- syntax: "*";
1752
- inherits: false;
1753
- initial-value: 1;
1754
- }
1755
- @property --tw-scale-z {
1756
- syntax: "*";
1757
- inherits: false;
1758
- initial-value: 1;
1759
- }
1760
1867
  @keyframes spin {
1761
1868
  to {
1762
1869
  transform: rotate(360deg);
@@ -1773,6 +1880,9 @@
1773
1880
  --tw-translate-x: 0;
1774
1881
  --tw-translate-y: 0;
1775
1882
  --tw-translate-z: 0;
1883
+ --tw-scale-x: 1;
1884
+ --tw-scale-y: 1;
1885
+ --tw-scale-z: 1;
1776
1886
  --tw-space-y-reverse: 0;
1777
1887
  --tw-space-x-reverse: 0;
1778
1888
  --tw-border-style: solid;
@@ -1804,9 +1914,6 @@
1804
1914
  --tw-duration: initial;
1805
1915
  --tw-ease: initial;
1806
1916
  --tw-content: "";
1807
- --tw-scale-x: 1;
1808
- --tw-scale-y: 1;
1809
- --tw-scale-z: 1;
1810
1917
  }
1811
1918
  }
1812
1919
  }
@@ -162,8 +162,8 @@
162
162
 
163
163
  /* Fixed colors */
164
164
  --cg-ui-palette-neutral-40: hsla(230, 20%, 78%, 1);
165
- --cg-ui-palette-neutral-20: hsla(230, 20%, 95%, 1);
166
- --cg-ui-palette-neutral-10: hsla(230, 20%, 98%, 1);
165
+ --cg-ui-palette-neutral-20: hsla(230, 20%, 85%, 1);
166
+ --cg-ui-palette-neutral-10: hsla(230, 20%, 95%, 1);
167
167
  --cg-ui-palette-neutral-0: hsla(0, 0%, 100%, 1);
168
168
  --cg-ui-palette-neutral-01: hsla(0, 0%, 100%, 0.1);
169
169
 
@@ -0,0 +1,107 @@
1
+ <script lang="ts" module>
2
+ import { Skeleton } from '../skeleton/index.js';
3
+ import { defineMeta } from '@storybook/addon-svelte-csf';
4
+ import type { Parameters } from '@storybook/sveltekit';
5
+ import type { ComponentProps } from 'svelte';
6
+ import Root from './components/app-shell.root.svelte';
7
+ import { AppShellPrimitive } from './index.js';
8
+
9
+ const parameters: Parameters = {
10
+ controls: {
11
+ include: ['collapsed', 'layout', 'sidebar', 'header', 'withBorder'],
12
+ },
13
+
14
+ docs: {
15
+ story: {
16
+ inline: false,
17
+ iframeHeight: 700,
18
+ },
19
+ },
20
+ };
21
+
22
+ const { Story } = defineMeta({
23
+ title: 'UI Kit/AppShell',
24
+ component: Root,
25
+ tags: ['autodocs'],
26
+ parameters,
27
+
28
+ argTypes: {
29
+ collapsed: {
30
+ table: {
31
+ defaultValue: { summary: 'false' },
32
+ },
33
+ },
34
+ },
35
+ });
36
+
37
+ type Args = ComponentProps<typeof Root>;
38
+
39
+ const args: Args = {
40
+ collapsed: false,
41
+ layout: 'adjacent',
42
+ withBorder: true,
43
+ sidebar: {
44
+ width: 256,
45
+ collapsedWidth: 80,
46
+ },
47
+ header: {
48
+ height: 48,
49
+ },
50
+ };
51
+
52
+ const items = Array.from({ length: 10 }).map((_, idx) => idx);
53
+
54
+ function formatDate(date: Date): string {
55
+ const formatter = new Intl.DateTimeFormat('en-GB', {
56
+ day: '2-digit',
57
+ month: '2-digit',
58
+ year: 'numeric',
59
+ hour: 'numeric',
60
+ minute: '2-digit',
61
+ timeZoneName: 'shortOffset',
62
+ hour12: false,
63
+ });
64
+
65
+ const parts = formatter.formatToParts(date);
66
+ const day = parts.find((p) => p.type === 'day')?.value;
67
+ const month = parts.find((p) => p.type === 'month')?.value;
68
+ const year = parts.find((p) => p.type === 'year')?.value;
69
+ const hour = parts.find((p) => p.type === 'hour')?.value;
70
+ const minute = parts.find((p) => p.type === 'minute')?.value;
71
+ const timeZone = parts.find((p) => p.type === 'timeZoneName')?.value;
72
+
73
+ return `${day}.${month}.${year} ${hour}:${minute} ${timeZone}`;
74
+ }
75
+ </script>
76
+
77
+ <Story name="Basic" {parameters} {args}>
78
+ {#snippet template(args: Args)}
79
+ <div class="cgui:fixed cgui:inset-0">
80
+ <AppShellPrimitive.Root {...args}>
81
+ <AppShellPrimitive.Header class="cgui:p-4">
82
+ <p class="cgui:text-caption cgui:text-fg-regular">
83
+ {formatDate(new Date())}
84
+ </p>
85
+ </AppShellPrimitive.Header>
86
+ <AppShellPrimitive.Sidebar>
87
+ <AppShellPrimitive.SidebarHead></AppShellPrimitive.SidebarHead>
88
+ <AppShellPrimitive.NavBar></AppShellPrimitive.NavBar>
89
+ <AppShellPrimitive.SidebarFooter class="cgui:justify-end">
90
+ <AppShellPrimitive.SidebarToggle />
91
+ </AppShellPrimitive.SidebarFooter>
92
+ </AppShellPrimitive.Sidebar>
93
+ <AppShellPrimitive.Viewport>
94
+ <AppShellPrimitive.Content class="cgui:p-4">
95
+ <div class="cgui:grow cgui:flex cgui:flex-col cgui:gap-4">
96
+ {#each items as item (item)}
97
+ <div class="cgui:flex cgui:items-center cgui:gap-4">
98
+ <Skeleton count={2} class="cgui:h-20 cgui:flex-1" color="surface" />
99
+ </div>
100
+ {/each}
101
+ </div>
102
+ </AppShellPrimitive.Content>
103
+ </AppShellPrimitive.Viewport>
104
+ </AppShellPrimitive.Root>
105
+ </div>
106
+ {/snippet}
107
+ </Story>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const AppShell: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type AppShell = InstanceType<typeof AppShell>;
18
+ export default AppShell;
@@ -0,0 +1,45 @@
1
+ <script lang="ts" module>
2
+ type AppShellContentPropsWithoutHTML = WithElementRef<WithChild<{}>>;
3
+
4
+ export type AppShellContentProps = AppShellContentPropsWithoutHTML &
5
+ Without<PrimitiveDivAttributes, AppShellContentPropsWithoutHTML>;
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { AppShellStylesContext } from '../styles.js';
10
+ import type { PrimitiveDivAttributes } from '../../../internal/types/html-attributes.js';
11
+ import { cn, useId } from '../../../internal/utils/common.js';
12
+ import { box, mergeProps, type WithChild, type WithElementRef, type Without } from 'svelte-toolbelt';
13
+ import { AppShellContentState } from './app-shell.svelte.js';
14
+
15
+ let {
16
+ ref = $bindable(null),
17
+ id = useId(),
18
+ children,
19
+ child,
20
+ class: className,
21
+ ...restProps
22
+ }: AppShellContentProps = $props();
23
+
24
+ const contentState = AppShellContentState.create({
25
+ ref: box.with(
26
+ () => ref,
27
+ (v) => (ref = v)
28
+ ),
29
+ id: box.with(() => id),
30
+ });
31
+
32
+ const variants = AppShellStylesContext.get();
33
+
34
+ const mergedProps = $derived(
35
+ mergeProps(restProps, contentState.props, { class: cn(variants.current.content(), className) })
36
+ );
37
+ </script>
38
+
39
+ {#if child}
40
+ {@render child({ props: mergedProps })}
41
+ {:else}
42
+ <div {...mergedProps}>
43
+ {@render children?.()}
44
+ </div>
45
+ {/if}
@@ -0,0 +1,7 @@
1
+ type AppShellContentPropsWithoutHTML = WithElementRef<WithChild<{}>>;
2
+ export type AppShellContentProps = AppShellContentPropsWithoutHTML & Without<PrimitiveDivAttributes, AppShellContentPropsWithoutHTML>;
3
+ import type { PrimitiveDivAttributes } from '../../../internal/types/html-attributes.js';
4
+ import { type WithChild, type WithElementRef, type Without } from 'svelte-toolbelt';
5
+ declare const AppShell: import("svelte").Component<AppShellContentProps, {}, "ref">;
6
+ type AppShell = ReturnType<typeof AppShell>;
7
+ export default AppShell;
@@ -0,0 +1,45 @@
1
+ <script lang="ts" module>
2
+ type AppShellHeaderPropsWithoutHTML = WithElementRef<WithChild<{}>>;
3
+
4
+ export type AppShellHeaderProps = AppShellHeaderPropsWithoutHTML &
5
+ Without<PrimitiveHeaderAttributes, AppShellHeaderPropsWithoutHTML>;
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import type { PrimitiveHeaderAttributes } from '../../../internal/types/html-attributes.js';
10
+ import { cn, useId } from '../../../internal/utils/common.js';
11
+ import { box, mergeProps, type WithChild, type WithElementRef, type Without } from 'svelte-toolbelt';
12
+ import { AppShellStylesContext } from '../styles.js';
13
+ import { AppShellHeaderState } from './app-shell.svelte.js';
14
+
15
+ let {
16
+ ref = $bindable(null),
17
+ id = useId(),
18
+ children,
19
+ child,
20
+ class: className,
21
+ ...restProps
22
+ }: AppShellHeaderProps = $props();
23
+
24
+ const headerState = AppShellHeaderState.create({
25
+ ref: box.with(
26
+ () => ref,
27
+ (v) => (ref = v)
28
+ ),
29
+ id: box.with(() => id),
30
+ });
31
+
32
+ const variants = AppShellStylesContext.get();
33
+
34
+ const mergedProps = $derived(
35
+ mergeProps(restProps, headerState.props, { class: cn(variants.current.header(), className) })
36
+ );
37
+ </script>
38
+
39
+ {#if child}
40
+ {@render child({ props: mergedProps })}
41
+ {:else}
42
+ <header {...mergedProps}>
43
+ {@render children?.()}
44
+ </header>
45
+ {/if}
@@ -0,0 +1,7 @@
1
+ type AppShellHeaderPropsWithoutHTML = WithElementRef<WithChild<{}>>;
2
+ export type AppShellHeaderProps = AppShellHeaderPropsWithoutHTML & Without<PrimitiveHeaderAttributes, AppShellHeaderPropsWithoutHTML>;
3
+ import type { PrimitiveHeaderAttributes } from '../../../internal/types/html-attributes.js';
4
+ import { type WithChild, type WithElementRef, type Without } from 'svelte-toolbelt';
5
+ declare const AppShell: import("svelte").Component<AppShellHeaderProps, {}, "ref">;
6
+ type AppShell = ReturnType<typeof AppShell>;
7
+ export default AppShell;
@@ -0,0 +1,45 @@
1
+ <script lang="ts" module>
2
+ type AppShellNavBarPropsWithoutHTML = WithElementRef<WithChild<{}>>;
3
+
4
+ export type AppShellNavBarProps = AppShellNavBarPropsWithoutHTML &
5
+ Without<PrimitiveHeaderAttributes, AppShellNavBarPropsWithoutHTML>;
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import type { PrimitiveHeaderAttributes } from '../../../internal/types/html-attributes.js';
10
+ import { cn, useId } from '../../../internal/utils/common.js';
11
+ import { box, mergeProps, type WithChild, type WithElementRef, type Without } from 'svelte-toolbelt';
12
+ import { AppShellStylesContext } from '../styles.js';
13
+ import { AppShellNavBarState } from './app-shell.svelte.js';
14
+
15
+ let {
16
+ ref = $bindable(null),
17
+ id = useId(),
18
+ children,
19
+ child,
20
+ class: className,
21
+ ...restProps
22
+ }: AppShellNavBarProps = $props();
23
+
24
+ const navBarState = AppShellNavBarState.create({
25
+ ref: box.with(
26
+ () => ref,
27
+ (v) => (ref = v)
28
+ ),
29
+ id: box.with(() => id),
30
+ });
31
+
32
+ const variants = AppShellStylesContext.get();
33
+
34
+ const mergedProps = $derived(
35
+ mergeProps(restProps, navBarState.props, { class: cn(variants.current.navBar(), className) })
36
+ );
37
+ </script>
38
+
39
+ {#if child}
40
+ {@render child({ props: mergedProps })}
41
+ {:else}
42
+ <nav {...mergedProps}>
43
+ {@render children?.()}
44
+ </nav>
45
+ {/if}
@@ -0,0 +1,7 @@
1
+ type AppShellNavBarPropsWithoutHTML = WithElementRef<WithChild<{}>>;
2
+ export type AppShellNavBarProps = AppShellNavBarPropsWithoutHTML & Without<PrimitiveHeaderAttributes, AppShellNavBarPropsWithoutHTML>;
3
+ import type { PrimitiveHeaderAttributes } from '../../../internal/types/html-attributes.js';
4
+ import { type WithChild, type WithElementRef, type Without } from 'svelte-toolbelt';
5
+ declare const AppShell: import("svelte").Component<AppShellNavBarProps, {}, "ref">;
6
+ type AppShell = ReturnType<typeof AppShell>;
7
+ export default AppShell;
@@ -0,0 +1,70 @@
1
+ <script lang="ts" module>
2
+ type AppShellRootPropsWithoutHTML = WithElementRef<
3
+ WithChildren<{
4
+ collapsed?: boolean;
5
+
6
+ sidebar?: AppShellSidebarConfiguration;
7
+
8
+ header?: AppShellHeaderConfiguration;
9
+ }>
10
+ > &
11
+ AppShellVariantsProps;
12
+
13
+ export type AppShellRootProps = AppShellRootPropsWithoutHTML &
14
+ Without<PrimitiveDivAttributes, AppShellRootPropsWithoutHTML>;
15
+ </script>
16
+
17
+ <script lang="ts">
18
+ import type { PrimitiveDivAttributes } from '../../../internal/types/html-attributes.js';
19
+ import { cn, useId } from '../../../internal/utils/common.js';
20
+ import { box, mergeProps, type WithChildren, type WithElementRef, type Without } from 'svelte-toolbelt';
21
+ import { AppShellStylesContext, appShellVariants, type AppShellVariantsProps } from '../styles.js';
22
+ import type { AppShellHeaderConfiguration, AppShellSidebarConfiguration } from '../types.js';
23
+ import { AppShellRootState } from './app-shell.svelte.js';
24
+
25
+ let {
26
+ children,
27
+ ref = $bindable(null),
28
+ id = useId(),
29
+ collapsed = $bindable(false),
30
+ class: className,
31
+ layout = 'adjacent',
32
+ withBorder = true,
33
+ sidebar = {
34
+ collapsedWidth: 80,
35
+ width: 256,
36
+ },
37
+ header = {
38
+ height: 48,
39
+ },
40
+ ...restProps
41
+ }: AppShellRootProps = $props();
42
+
43
+ const rootState = AppShellRootState.create({
44
+ ref: box.with(
45
+ () => ref,
46
+ (v) => (ref = v)
47
+ ),
48
+ collapsed: box.with(
49
+ () => collapsed,
50
+ (v) => (collapsed = v)
51
+ ),
52
+ id: box.with(() => id),
53
+ sidebar: box.with(() => sidebar),
54
+ header: box.with(() => header),
55
+ });
56
+
57
+ $inspect(collapsed);
58
+
59
+ const variants = $derived(appShellVariants({ layout, withBorder }));
60
+
61
+ $inspect(variants);
62
+
63
+ AppShellStylesContext.set(box.with(() => variants));
64
+
65
+ const mergedProps = $derived(mergeProps(restProps, rootState.props, { class: cn(variants.root(), className) }));
66
+ </script>
67
+
68
+ <div {...mergedProps}>
69
+ {@render children?.()}
70
+ </div>
@@ -0,0 +1,13 @@
1
+ type AppShellRootPropsWithoutHTML = WithElementRef<WithChildren<{
2
+ collapsed?: boolean;
3
+ sidebar?: AppShellSidebarConfiguration;
4
+ header?: AppShellHeaderConfiguration;
5
+ }>> & AppShellVariantsProps;
6
+ export type AppShellRootProps = AppShellRootPropsWithoutHTML & Without<PrimitiveDivAttributes, AppShellRootPropsWithoutHTML>;
7
+ import type { PrimitiveDivAttributes } from '../../../internal/types/html-attributes.js';
8
+ import { type WithChildren, type WithElementRef, type Without } from 'svelte-toolbelt';
9
+ import { type AppShellVariantsProps } from '../styles.js';
10
+ import type { AppShellHeaderConfiguration, AppShellSidebarConfiguration } from '../types.js';
11
+ declare const AppShell: import("svelte").Component<AppShellRootProps, {}, "ref" | "collapsed">;
12
+ type AppShell = ReturnType<typeof AppShell>;
13
+ export default AppShell;