@casinogate/ui 1.0.1 → 1.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 (43) hide show
  1. package/dist/assets/css/root.css +183 -5
  2. package/dist/components/button-group/button-group.stories.svelte +59 -0
  3. package/dist/components/button-group/button-group.stories.svelte.d.ts +19 -0
  4. package/dist/components/button-group/components/button-group.root.svelte +35 -0
  5. package/dist/components/button-group/components/button-group.root.svelte.d.ts +8 -0
  6. package/dist/components/button-group/components/button-group.separator.svelte +24 -0
  7. package/dist/components/button-group/components/button-group.separator.svelte.d.ts +13 -0
  8. package/dist/components/button-group/index.d.ts +16 -0
  9. package/dist/components/button-group/index.js +6 -0
  10. package/dist/components/button-group/styles.d.ts +47 -0
  11. package/dist/components/button-group/styles.js +27 -0
  12. package/dist/components/data-table/components/data-table.svelte.js +1 -1
  13. package/dist/components/field/components/field.control.svelte +24 -0
  14. package/dist/components/field/components/field.control.svelte.d.ts +10 -0
  15. package/dist/components/field/components/field.description.svelte +47 -0
  16. package/dist/components/field/components/field.description.svelte.d.ts +7 -0
  17. package/dist/components/field/components/field.error.svelte +49 -0
  18. package/dist/components/field/components/field.error.svelte.d.ts +7 -0
  19. package/dist/components/field/components/field.label.svelte +49 -0
  20. package/dist/components/field/components/field.label.svelte.d.ts +7 -0
  21. package/dist/components/field/components/field.root.svelte +63 -0
  22. package/dist/components/field/components/field.root.svelte.d.ts +12 -0
  23. package/dist/components/field/components/field.svelte.d.ts +83 -0
  24. package/dist/components/field/components/field.svelte.js +121 -0
  25. package/dist/components/field/field.stories.svelte +51 -0
  26. package/dist/components/field/field.stories.svelte.d.ts +19 -0
  27. package/dist/components/field/field.svelte +47 -0
  28. package/dist/components/field/field.svelte.d.ts +14 -0
  29. package/dist/components/field/index.d.ts +14 -0
  30. package/dist/components/field/index.js +14 -0
  31. package/dist/components/field/styles.d.ts +50 -0
  32. package/dist/components/field/styles.js +12 -0
  33. package/dist/components/input/input.svelte +1 -1
  34. package/dist/components/separator/index.d.ts +5 -0
  35. package/dist/components/separator/index.js +4 -0
  36. package/dist/components/separator/separator.stories.svelte +44 -0
  37. package/dist/components/separator/separator.stories.svelte.d.ts +19 -0
  38. package/dist/components/separator/separator.svelte +21 -0
  39. package/dist/components/separator/separator.svelte.d.ts +5 -0
  40. package/dist/internal/constants/attrs.d.ts +1 -0
  41. package/dist/internal/constants/attrs.js +1 -0
  42. package/dist/internal/types/html-attributes.d.ts +1 -0
  43. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.1.15 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
4
  @layer theme {
@@ -8,6 +8,8 @@
8
8
  --cgui-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
9
9
  "Courier New", monospace;
10
10
  --cgui-spacing: 0.25rem;
11
+ --cgui-text-sm: 0.875rem;
12
+ --cgui-text-sm--line-height: calc(1.25 / 0.875);
11
13
  --cgui-font-weight-normal: 400;
12
14
  --cgui-font-weight-medium: 500;
13
15
  --cgui-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
@@ -128,7 +130,9 @@
128
130
  ::placeholder {
129
131
  color: currentcolor;
130
132
  @supports (color: color-mix(in lab, red, red)) {
131
- color: color-mix(in oklab, currentcolor 50%, transparent);
133
+ & {
134
+ color: color-mix(in oklab, currentcolor 50%, transparent);
135
+ }
132
136
  }
133
137
  }
134
138
  }
@@ -207,6 +211,12 @@
207
211
  .cgui\:z-1 {
208
212
  z-index: 1;
209
213
  }
214
+ .cgui\:\!m-0 {
215
+ margin: calc(var(--cgui-spacing) * 0) !important;
216
+ }
217
+ .cgui\:my-4 {
218
+ margin-block: calc(var(--cgui-spacing) * 4);
219
+ }
210
220
  .cgui\:scrollbar-thin {
211
221
  &::-webkit-scrollbar-track {
212
222
  background-color: var(--scrollbar-track);
@@ -310,6 +320,9 @@
310
320
  .cgui\:h-8\.5 {
311
321
  height: calc(var(--cgui-spacing) * 8.5);
312
322
  }
323
+ .cgui\:h-9 {
324
+ height: calc(var(--cgui-spacing) * 9);
325
+ }
313
326
  .cgui\:h-10 {
314
327
  height: calc(var(--cgui-spacing) * 10);
315
328
  }
@@ -328,6 +341,9 @@
328
341
  .cgui\:h-\[300px\] {
329
342
  height: 300px;
330
343
  }
344
+ .cgui\:h-auto {
345
+ height: auto;
346
+ }
331
347
  .cgui\:h-full {
332
348
  height: 100%;
333
349
  }
@@ -435,6 +451,9 @@
435
451
  .cgui\:items-center {
436
452
  align-items: center;
437
453
  }
454
+ .cgui\:items-stretch {
455
+ align-items: stretch;
456
+ }
438
457
  .cgui\:justify-center {
439
458
  justify-content: center;
440
459
  }
@@ -456,6 +475,23 @@
456
475
  .cgui\:gap-4 {
457
476
  gap: calc(var(--cgui-spacing) * 4);
458
477
  }
478
+ .cgui\:space-y-1 {
479
+ :where(& > :not(:last-child)) {
480
+ --tw-space-y-reverse: 0;
481
+ margin-block-start: calc(calc(var(--cgui-spacing) * 1) * var(--tw-space-y-reverse));
482
+ margin-block-end: calc(calc(var(--cgui-spacing) * 1) * calc(1 - var(--tw-space-y-reverse)));
483
+ }
484
+ }
485
+ .cgui\:space-x-4 {
486
+ :where(& > :not(:last-child)) {
487
+ --tw-space-x-reverse: 0;
488
+ margin-inline-start: calc(calc(var(--cgui-spacing) * 4) * var(--tw-space-x-reverse));
489
+ margin-inline-end: calc(calc(var(--cgui-spacing) * 4) * calc(1 - var(--tw-space-x-reverse)));
490
+ }
491
+ }
492
+ .cgui\:self-stretch {
493
+ align-self: stretch;
494
+ }
459
495
  .cgui\:overflow-auto {
460
496
  overflow: auto;
461
497
  }
@@ -528,7 +564,9 @@
528
564
  .cgui\:bg-neutral-40\/50 {
529
565
  background-color: var(--cg-ui-palette-neutral-40);
530
566
  @supports (color: color-mix(in lab, red, red)) {
531
- background-color: color-mix(in oklab, var(--cg-ui-palette-neutral-40) 50%, transparent);
567
+ & {
568
+ background-color: color-mix(in oklab, var(--cg-ui-palette-neutral-40) 50%, transparent);
569
+ }
532
570
  }
533
571
  }
534
572
  .cgui\:bg-primary-10 {
@@ -537,6 +575,9 @@
537
575
  .cgui\:bg-primary-80 {
538
576
  background-color: var(--cg-ui-palette-primary-80);
539
577
  }
578
+ .cgui\:bg-stroke-divider {
579
+ background-color: var(--cg-ui-palette-neutral-20);
580
+ }
540
581
  .cgui\:bg-surface-light {
541
582
  background-color: var(--cg-ui-palette-neutral-20);
542
583
  }
@@ -568,14 +609,18 @@
568
609
  .cgui\:from-neutral-40\/30 {
569
610
  --tw-gradient-from: var(--cg-ui-palette-neutral-40);
570
611
  @supports (color: color-mix(in lab, red, red)) {
571
- --tw-gradient-from: color-mix(in oklab, var(--cg-ui-palette-neutral-40) 30%, transparent);
612
+ & {
613
+ --tw-gradient-from: color-mix(in oklab, var(--cg-ui-palette-neutral-40) 30%, transparent);
614
+ }
572
615
  }
573
616
  --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
574
617
  }
575
618
  .cgui\:to-neutral-10\/0 {
576
619
  --tw-gradient-to: var(--cg-ui-palette-neutral-10);
577
620
  @supports (color: color-mix(in lab, red, red)) {
578
- --tw-gradient-to: color-mix(in oklab, var(--cg-ui-palette-neutral-10) 0%, transparent);
621
+ & {
622
+ --tw-gradient-to: color-mix(in oklab, var(--cg-ui-palette-neutral-10) 0%, transparent);
623
+ }
579
624
  }
580
625
  --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
581
626
  }
@@ -662,10 +707,22 @@
662
707
  font-size: var(--cg-ui-fz-body-2);
663
708
  line-height: var(--tw-leading, var(--cg-ui-lh-body-2));
664
709
  }
710
+ .cgui\:text-caption {
711
+ font-size: var(--cg-ui-fz-caption);
712
+ line-height: var(--tw-leading, var(--cg-ui-lh-caption));
713
+ }
665
714
  .cgui\:text-caption-2 {
666
715
  font-size: var(--cg-ui-fz-caption-2);
667
716
  line-height: var(--tw-leading, var(--cg-ui-lh-caption-2));
668
717
  }
718
+ .cgui\:text-sm {
719
+ font-size: var(--cgui-text-sm);
720
+ line-height: var(--tw-leading, var(--cgui-text-sm--line-height));
721
+ }
722
+ .cgui\:leading-none {
723
+ --tw-leading: 1;
724
+ line-height: 1;
725
+ }
669
726
  .cgui\:font-medium {
670
727
  --tw-font-weight: var(--cgui-font-weight-medium);
671
728
  font-weight: var(--cgui-font-weight-medium);
@@ -683,12 +740,18 @@
683
740
  .cgui\:text-fg-darkest {
684
741
  color: var(--cg-ui-palette-neutral-100);
685
742
  }
743
+ .cgui\:text-fg-error {
744
+ color: var(--cg-ui-palette-system-error-100);
745
+ }
686
746
  .cgui\:text-fg-medium {
687
747
  color: var(--cg-ui-palette-neutral-60);
688
748
  }
689
749
  .cgui\:text-fg-regular {
690
750
  color: var(--cg-ui-palette-neutral-50);
691
751
  }
752
+ .cgui\:text-fg-semilight {
753
+ color: var(--cg-ui-palette-neutral-40);
754
+ }
692
755
  .cgui\:text-fg-white {
693
756
  color: var(--cg-ui-palette-neutral-0);
694
757
  }
@@ -921,6 +984,11 @@
921
984
  opacity: 50%;
922
985
  }
923
986
  }
987
+ .cgui\:has-\[\>\[data-slot\=button-group\]\]\:gap-2 {
988
+ &:has(>[data-slot=button-group]) {
989
+ gap: calc(var(--cgui-spacing) * 2);
990
+ }
991
+ }
924
992
  .cgui\:aria-invalid\:border-stroke-error {
925
993
  &[aria-invalid="true"] {
926
994
  border-color: var(--cg-ui-palette-system-error-100);
@@ -1012,6 +1080,31 @@
1012
1080
  padding-right: calc(var(--cgui-spacing) * 14);
1013
1081
  }
1014
1082
  }
1083
+ .cgui\:data-\[orientation\=horizontal\]\:h-px {
1084
+ &[data-orientation="horizontal"] {
1085
+ height: 1px;
1086
+ }
1087
+ }
1088
+ .cgui\:data-\[orientation\=horizontal\]\:w-full {
1089
+ &[data-orientation="horizontal"] {
1090
+ width: 100%;
1091
+ }
1092
+ }
1093
+ .cgui\:data-\[orientation\=vertical\]\:h-auto {
1094
+ &[data-orientation="vertical"] {
1095
+ height: auto;
1096
+ }
1097
+ }
1098
+ .cgui\:data-\[orientation\=vertical\]\:h-full {
1099
+ &[data-orientation="vertical"] {
1100
+ height: 100%;
1101
+ }
1102
+ }
1103
+ .cgui\:data-\[orientation\=vertical\]\:w-px {
1104
+ &[data-orientation="vertical"] {
1105
+ width: 1px;
1106
+ }
1107
+ }
1015
1108
  .cgui\:data-\[placeholder\]\:text-fg-regular {
1016
1109
  &[data-placeholder] {
1017
1110
  color: var(--cg-ui-palette-neutral-50);
@@ -1194,6 +1287,74 @@
1194
1287
  border-width: 0px;
1195
1288
  }
1196
1289
  }
1290
+ .cgui\:\[\&\>\*\]\:focus-visible\:relative {
1291
+ &>* {
1292
+ &:focus-visible {
1293
+ position: relative;
1294
+ }
1295
+ }
1296
+ }
1297
+ .cgui\:\[\&\>\*\]\:focus-visible\:z-10 {
1298
+ &>* {
1299
+ &:focus-visible {
1300
+ z-index: 10;
1301
+ }
1302
+ }
1303
+ }
1304
+ .cgui\:\[\&\>\*\:not\(\:first-child\)\]\:rounded-t-none {
1305
+ &>*:not(:first-child) {
1306
+ border-top-left-radius: 0;
1307
+ border-top-right-radius: 0;
1308
+ }
1309
+ }
1310
+ .cgui\:\[\&\>\*\:not\(\:first-child\)\]\:rounded-l-none {
1311
+ &>*:not(:first-child) {
1312
+ border-top-left-radius: 0;
1313
+ border-bottom-left-radius: 0;
1314
+ }
1315
+ }
1316
+ .cgui\:\[\&\>\*\:not\(\:first-child\)\]\:border-t-0 {
1317
+ &>*:not(:first-child) {
1318
+ border-top-style: var(--tw-border-style);
1319
+ border-top-width: 0px;
1320
+ }
1321
+ }
1322
+ .cgui\:\[\&\>\*\:not\(\:first-child\)\]\:border-l-0 {
1323
+ &>*:not(:first-child) {
1324
+ border-left-style: var(--tw-border-style);
1325
+ border-left-width: 0px;
1326
+ }
1327
+ }
1328
+ .cgui\:\[\&\>\*\:not\(\:last-child\)\]\:rounded-r-none {
1329
+ &>*:not(:last-child) {
1330
+ border-top-right-radius: 0;
1331
+ border-bottom-right-radius: 0;
1332
+ }
1333
+ }
1334
+ .cgui\:\[\&\>\*\:not\(\:last-child\)\]\:rounded-b-none {
1335
+ &>*:not(:last-child) {
1336
+ border-bottom-right-radius: 0;
1337
+ border-bottom-left-radius: 0;
1338
+ }
1339
+ }
1340
+ .cgui\:has-\[select\[aria-hidden\=true\]\:last-child\]\:\[\&\>\[data-slot\=select-trigger\]\:last-of-type\]\:rounded-r-md {
1341
+ &:has(*:is(select[aria-hidden=true]:last-child)) {
1342
+ &>[data-slot=select-trigger]:last-of-type {
1343
+ border-top-right-radius: calc(var(--cg-ui-number-md) * 1px);
1344
+ border-bottom-right-radius: calc(var(--cg-ui-number-md) * 1px);
1345
+ }
1346
+ }
1347
+ }
1348
+ .cgui\:\[\&\>\[data-slot\=select-trigger\]\:not\(\[class\*\=\'w-\'\]\)\]\:w-fit {
1349
+ &>[data-slot=select-trigger]:not([class*='w-']) {
1350
+ width: fit-content;
1351
+ }
1352
+ }
1353
+ .cgui\:\[\&\>input\]\:flex-1 {
1354
+ &>input {
1355
+ flex: 1;
1356
+ }
1357
+ }
1197
1358
  }
1198
1359
  :root {
1199
1360
  --cg-ui-primary-hue: 220;
@@ -1446,6 +1607,16 @@
1446
1607
  inherits: false;
1447
1608
  initial-value: 0;
1448
1609
  }
1610
+ @property --tw-space-y-reverse {
1611
+ syntax: "*";
1612
+ inherits: false;
1613
+ initial-value: 0;
1614
+ }
1615
+ @property --tw-space-x-reverse {
1616
+ syntax: "*";
1617
+ inherits: false;
1618
+ initial-value: 0;
1619
+ }
1449
1620
  @property --tw-border-style {
1450
1621
  syntax: "*";
1451
1622
  inherits: false;
@@ -1493,6 +1664,10 @@
1493
1664
  inherits: false;
1494
1665
  initial-value: 100%;
1495
1666
  }
1667
+ @property --tw-leading {
1668
+ syntax: "*";
1669
+ inherits: false;
1670
+ }
1496
1671
  @property --tw-font-weight {
1497
1672
  syntax: "*";
1498
1673
  inherits: false;
@@ -1606,6 +1781,8 @@
1606
1781
  --tw-translate-x: 0;
1607
1782
  --tw-translate-y: 0;
1608
1783
  --tw-translate-z: 0;
1784
+ --tw-space-y-reverse: 0;
1785
+ --tw-space-x-reverse: 0;
1609
1786
  --tw-border-style: solid;
1610
1787
  --tw-gradient-position: initial;
1611
1788
  --tw-gradient-from: #0000;
@@ -1616,6 +1793,7 @@
1616
1793
  --tw-gradient-from-position: 0%;
1617
1794
  --tw-gradient-via-position: 50%;
1618
1795
  --tw-gradient-to-position: 100%;
1796
+ --tw-leading: initial;
1619
1797
  --tw-font-weight: initial;
1620
1798
  --tw-shadow: 0 0 #0000;
1621
1799
  --tw-shadow-color: initial;
@@ -0,0 +1,59 @@
1
+ <script lang="ts" module>
2
+ import { Button } from '../button/index.js';
3
+ import { Input } from '../input/index.js';
4
+ import { defineMeta } from '@storybook/addon-svelte-csf';
5
+ import type { Parameters } from '@storybook/sveltekit';
6
+ import type { ComponentProps } from 'svelte';
7
+ import ButtonGroupRoot from './components/button-group.root.svelte';
8
+ import { ButtonGroup } from './index.js';
9
+
10
+ const parameters: Parameters = {
11
+ controls: {
12
+ include: ['orientation'],
13
+ },
14
+ };
15
+
16
+ const { Story } = defineMeta({
17
+ title: 'UI Kit/ButtonGroup',
18
+ component: ButtonGroupRoot,
19
+ tags: ['autodocs'],
20
+ parameters,
21
+ });
22
+
23
+ type Args = ComponentProps<typeof ButtonGroup.Root>;
24
+
25
+ const args: Args = {
26
+ orientation: 'horizontal',
27
+ };
28
+ </script>
29
+
30
+ <Story name="Basic" {args} {parameters}>
31
+ {#snippet template(args: Args)}
32
+ <ButtonGroup.Root {...args} class="cgui:w-full">
33
+ <Button class="cgui:flex-1">Button 1</Button>
34
+ <Button class="cgui:flex-1">Button 2</Button>
35
+ <Button class="cgui:flex-1">Button 3</Button>
36
+ </ButtonGroup.Root>
37
+ {/snippet}
38
+ </Story>
39
+
40
+ <Story name="Input with Button" {args} {parameters}>
41
+ {#snippet template(args: Args)}
42
+ <ButtonGroup.Root {...args} class="cgui:w-full">
43
+ <Input placeholder="Search" />
44
+ <Button w="clean" class="cgui:h-9">OK</Button>
45
+ </ButtonGroup.Root>
46
+ {/snippet}
47
+ </Story>
48
+
49
+ <Story name="With Separator" {args} {parameters}>
50
+ {#snippet template(args: Args)}
51
+ <ButtonGroup.Root {...args} class="cgui:w-full">
52
+ <Button class="cgui:flex-1">Button 1</Button>
53
+ <ButtonGroup.Separator />
54
+ <Button class="cgui:flex-1">Button 2</Button>
55
+ <ButtonGroup.Separator />
56
+ <Button class="cgui:flex-1">Button 3</Button>
57
+ </ButtonGroup.Root>
58
+ {/snippet}
59
+ </Story>
@@ -0,0 +1,19 @@
1
+ import { ButtonGroup } from './index.js';
2
+ 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> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const ButtonGroup: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type ButtonGroup = InstanceType<typeof ButtonGroup>;
19
+ export default ButtonGroup;
@@ -0,0 +1,35 @@
1
+ <script lang="ts" module>
2
+ type ButtonGroupRootPropsWithoutHTML = WithElementRef<WithChildren<{}>> & ButtonGroupVariantsProps;
3
+
4
+ export type ButtonGroupRootProps = ButtonGroupRootPropsWithoutHTML &
5
+ Without<PrimitiveDivAttributes, ButtonGroupRootPropsWithoutHTML>;
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { SLOT_ATTR_NAME } from '../../../internal/constants/attrs.js';
10
+ import type { PrimitiveDivAttributes } from '../../../internal/types/html-attributes.js';
11
+ import { cn } from '../../../internal/utils/common.js';
12
+ import { useId } from 'bits-ui';
13
+ import { box, type WithChildren, type WithElementRef, type Without } from 'svelte-toolbelt';
14
+ import type { ButtonGroupVariantsProps } from '../styles.js';
15
+ import { ButtonGroupStylesContext, buttonGroupStyles } from '../styles.js';
16
+
17
+ let {
18
+ children,
19
+ ref = $bindable(null),
20
+ id = useId(),
21
+ orientation = 'horizontal',
22
+ class: className,
23
+ ...restProps
24
+ }: ButtonGroupRootProps = $props();
25
+
26
+ const variants = $derived(buttonGroupStyles({ orientation }));
27
+
28
+ $inspect(orientation);
29
+
30
+ ButtonGroupStylesContext.set(box.with(() => variants));
31
+ </script>
32
+
33
+ <div bind:this={ref} class={cn(variants.root(), className)} {...restProps} {...{ [SLOT_ATTR_NAME]: 'button-group' }}>
34
+ {@render children?.()}
35
+ </div>
@@ -0,0 +1,8 @@
1
+ type ButtonGroupRootPropsWithoutHTML = WithElementRef<WithChildren<{}>> & ButtonGroupVariantsProps;
2
+ export type ButtonGroupRootProps = ButtonGroupRootPropsWithoutHTML & Without<PrimitiveDivAttributes, ButtonGroupRootPropsWithoutHTML>;
3
+ import type { PrimitiveDivAttributes } from '../../../internal/types/html-attributes.js';
4
+ import { type WithChildren, type WithElementRef, type Without } from 'svelte-toolbelt';
5
+ import type { ButtonGroupVariantsProps } from '../styles.js';
6
+ declare const ButtonGroup: import("svelte").Component<ButtonGroupRootProps, {}, "ref">;
7
+ type ButtonGroup = ReturnType<typeof ButtonGroup>;
8
+ export default ButtonGroup;
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import { Separator } from '../../separator/index.js';
3
+ import { SLOT_ATTR_NAME } from '../../../internal/constants/attrs.js';
4
+ import { cn } from '../../../internal/utils/common.js';
5
+ import type { ComponentProps } from 'svelte';
6
+ import { ButtonGroupStylesContext } from '../styles.js';
7
+
8
+ let {
9
+ ref = $bindable(null),
10
+ class: className,
11
+ orientation = 'vertical',
12
+ ...restProps
13
+ }: ComponentProps<typeof Separator.Root> = $props();
14
+
15
+ const styles = ButtonGroupStylesContext.get();
16
+ </script>
17
+
18
+ <Separator.Root
19
+ bind:ref
20
+ {orientation}
21
+ class={cn(styles.current.separator(), className)}
22
+ {...{ [SLOT_ATTR_NAME]: 'button-group-separator' }}
23
+ {...restProps}
24
+ />
@@ -0,0 +1,13 @@
1
+ declare const ButtonGroup: import("svelte").Component<Omit<{
2
+ orientation?: import("bits-ui").Orientation;
3
+ decorative?: boolean;
4
+ }, "child" | "children"> & {
5
+ child?: import("svelte").Snippet<[{
6
+ props: Record<string, unknown>;
7
+ }]> | undefined;
8
+ children?: import("svelte").Snippet<[]> | undefined;
9
+ style?: import("bits-ui").StyleProperties | string | null | undefined;
10
+ ref?: HTMLElement | null | undefined;
11
+ } & import("bits-ui").Without<import("bits-ui").BitsPrimitiveDivAttributes, import("bits-ui").SeparatorRootPropsWithoutHTML>, {}, "ref">;
12
+ type ButtonGroup = ReturnType<typeof ButtonGroup>;
13
+ export default ButtonGroup;
@@ -0,0 +1,16 @@
1
+ import { type ButtonGroupRootProps } from './components/button-group.root.svelte';
2
+ export declare const ButtonGroup: {
3
+ readonly Root: import("svelte").Component<ButtonGroupRootProps, {}, "ref">;
4
+ readonly Separator: import("svelte").Component<Omit<{
5
+ orientation?: import("bits-ui").Orientation;
6
+ decorative?: boolean;
7
+ }, "child" | "children"> & {
8
+ child?: import("svelte").Snippet<[{
9
+ props: Record<string, unknown>;
10
+ }]> | undefined;
11
+ children?: import("svelte").Snippet<[]> | undefined;
12
+ style?: import("bits-ui").StyleProperties | string | null | undefined;
13
+ ref?: HTMLElement | null | undefined;
14
+ } & import("bits-ui").Without<import("bits-ui").BitsPrimitiveDivAttributes, import("bits-ui").SeparatorRootPropsWithoutHTML>, {}, "ref">;
15
+ };
16
+ export type { ButtonGroupRootProps };
@@ -0,0 +1,6 @@
1
+ import Root, {} from './components/button-group.root.svelte';
2
+ import Separator from './components/button-group.separator.svelte';
3
+ export const ButtonGroup = {
4
+ Root,
5
+ Separator,
6
+ };
@@ -0,0 +1,47 @@
1
+ import { Context } from 'runed';
2
+ import type { ReadableBox } from 'svelte-toolbelt';
3
+ import type { VariantProps } from 'tailwind-variants';
4
+ export declare const buttonGroupStyles: import("tailwind-variants").TVReturnType<{
5
+ orientation: {
6
+ horizontal: {
7
+ root: string;
8
+ };
9
+ vertical: {
10
+ root: string;
11
+ separator: string;
12
+ };
13
+ };
14
+ }, {
15
+ root: string[];
16
+ separator: string;
17
+ }, undefined, {
18
+ orientation: {
19
+ horizontal: {
20
+ root: string;
21
+ };
22
+ vertical: {
23
+ root: string;
24
+ separator: string;
25
+ };
26
+ };
27
+ }, {
28
+ root: string[];
29
+ separator: string;
30
+ }, import("tailwind-variants").TVReturnType<{
31
+ orientation: {
32
+ horizontal: {
33
+ root: string;
34
+ };
35
+ vertical: {
36
+ root: string;
37
+ separator: string;
38
+ };
39
+ };
40
+ }, {
41
+ root: string[];
42
+ separator: string;
43
+ }, undefined, unknown, unknown, undefined>>;
44
+ export type ButtonGroupVariantsProps = VariantProps<typeof buttonGroupStyles>;
45
+ type ButtonGroupStylesContextValues = ReadableBox<ReturnType<typeof buttonGroupStyles>>;
46
+ export declare const ButtonGroupStylesContext: Context<ButtonGroupStylesContextValues>;
47
+ export {};
@@ -0,0 +1,27 @@
1
+ import { keyWithPrefix } from '../../internal/utils/common.js';
2
+ import { tv } from '../../internal/utils/tailwindcss.js';
3
+ import { Context } from 'runed';
4
+ export const buttonGroupStyles = tv({
5
+ slots: {
6
+ root: [
7
+ 'cgui:flex cgui:w-fit cgui:items-stretch',
8
+ 'cgui:has-[>[data-slot=button-group]]:gap-2',
9
+ 'cgui:[&>*]:focus-visible:relative cgui:[&>*]:focus-visible:z-10',
10
+ 'cgui:[&>input]:flex-1',
11
+ "cgui:has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md cgui:[&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit",
12
+ ],
13
+ separator: 'cgui:relative cgui:!m-0 cgui:self-stretch cgui:data-[orientation=vertical]:h-auto',
14
+ },
15
+ variants: {
16
+ orientation: {
17
+ horizontal: {
18
+ root: 'cgui:[&>*:not(:first-child)]:rounded-l-none cgui:[&>*:not(:first-child)]:border-l-0 cgui:[&>*:not(:last-child)]:rounded-r-none',
19
+ },
20
+ vertical: {
21
+ root: 'cgui:flex-col cgui:[&>*:not(:first-child)]:rounded-t-none cgui:[&>*:not(:first-child)]:border-t-0 cgui:[&>*:not(:last-child)]:rounded-b-none',
22
+ separator: 'cgui:h-auto',
23
+ },
24
+ },
25
+ },
26
+ });
27
+ export const ButtonGroupStylesContext = new Context(keyWithPrefix('button-group-styles'));
@@ -1,7 +1,7 @@
1
+ import { SLOT_ATTR_NAME } from '../../../internal/constants/attrs.js';
1
2
  import { keyWithPrefix } from '../../../internal/utils/common.js';
2
3
  import { Context, useMutationObserver, watch } from 'runed';
3
4
  import { attachRef } from 'svelte-toolbelt';
4
- const SLOT_ATTR_NAME = 'data-slot';
5
5
  const SLOT_ATTR_VALUES = {
6
6
  root: 'root',
7
7
  header: 'header',
@@ -0,0 +1,24 @@
1
+ <script lang="ts" module>
2
+ export type FieldControlProps = {
3
+ children?: Snippet<[{ props: Record<string, unknown> }]>;
4
+
5
+ id?: string;
6
+ };
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import { useId } from 'bits-ui';
11
+ import type { Snippet } from 'svelte';
12
+ import { box, mergeProps } from 'svelte-toolbelt';
13
+ import { FieldControlState } from './field.svelte.js';
14
+
15
+ let { children, id = useId(), ...restProps }: FieldControlProps = $props();
16
+
17
+ const controlState = FieldControlState.create({
18
+ id: box.with(() => id),
19
+ });
20
+
21
+ const mergedProps = $derived(mergeProps(restProps, controlState.props));
22
+ </script>
23
+
24
+ {@render children?.({ props: mergedProps })}
@@ -0,0 +1,10 @@
1
+ export type FieldControlProps = {
2
+ children?: Snippet<[{
3
+ props: Record<string, unknown>;
4
+ }]>;
5
+ id?: string;
6
+ };
7
+ import type { Snippet } from 'svelte';
8
+ declare const Field: import("svelte").Component<FieldControlProps, {}, "">;
9
+ type Field = ReturnType<typeof Field>;
10
+ export default Field;