@casinogate/ui 1.11.8 → 1.11.10

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 (39) hide show
  1. package/dist/assets/css/root.css +36 -0
  2. package/dist/components/index.d.ts +1 -0
  3. package/dist/components/index.js +1 -0
  4. package/dist/components/pagination/components/index.d.ts +6 -0
  5. package/dist/components/pagination/components/index.js +6 -0
  6. package/dist/components/pagination/components/pagination.ellipsis.svelte +2 -5
  7. package/dist/components/pagination/components/pagination.item.svelte +10 -6
  8. package/dist/components/pagination/components/pagination.item.svelte.d.ts +2 -2
  9. package/dist/components/pagination/components/pagination.next-button.svelte +3 -8
  10. package/dist/components/pagination/components/pagination.page-size.svelte +40 -0
  11. package/dist/components/pagination/components/pagination.page-size.svelte.d.ts +4 -0
  12. package/dist/components/pagination/components/pagination.prev-button.svelte +2 -4
  13. package/dist/components/pagination/components/pagination.root.svelte +15 -6
  14. package/dist/components/pagination/components/pagination.root.svelte.d.ts +1 -1
  15. package/dist/components/pagination/components/state.svelte.d.ts +15 -0
  16. package/dist/components/pagination/components/state.svelte.js +11 -0
  17. package/dist/components/pagination/composed/index.d.ts +1 -0
  18. package/dist/components/pagination/composed/index.js +1 -0
  19. package/dist/components/pagination/composed/root/index.d.ts +1 -0
  20. package/dist/components/pagination/composed/root/index.js +1 -0
  21. package/dist/components/pagination/composed/root/pagination.root.svelte +42 -0
  22. package/dist/components/pagination/composed/root/pagination.root.svelte.d.ts +4 -0
  23. package/dist/components/pagination/index.d.ts +3 -3
  24. package/dist/components/pagination/index.js +3 -2
  25. package/dist/components/pagination/styles.d.ts +51 -82
  26. package/dist/components/pagination/styles.js +39 -41
  27. package/dist/components/pagination/types.d.ts +18 -4
  28. package/dist/components/select/components/select.trigger.svelte +3 -0
  29. package/dist/components/select/select.svelte +5 -2
  30. package/dist/components/select/styles.d.ts +10 -1
  31. package/dist/components/select/styles.js +16 -2
  32. package/dist/components/select/types.d.ts +2 -0
  33. package/package.json +1 -1
  34. package/dist/components/pagination/exports-primitive.d.ts +0 -5
  35. package/dist/components/pagination/exports-primitive.js +0 -5
  36. package/dist/components/pagination/exports.d.ts +0 -1
  37. package/dist/components/pagination/exports.js +0 -1
  38. package/dist/components/pagination/pagination.svelte +0 -28
  39. package/dist/components/pagination/pagination.svelte.d.ts +0 -3
@@ -499,12 +499,21 @@
499
499
  .cgui\:max-h-80 {
500
500
  max-height: calc(var(--cgui-spacing) * 80);
501
501
  }
502
+ .cgui\:min-h-6 {
503
+ min-height: calc(var(--cgui-spacing) * 6);
504
+ }
502
505
  .cgui\:min-h-7\.5 {
503
506
  min-height: calc(var(--cgui-spacing) * 7.5);
504
507
  }
508
+ .cgui\:min-h-8 {
509
+ min-height: calc(var(--cgui-spacing) * 8);
510
+ }
505
511
  .cgui\:min-h-9 {
506
512
  min-height: calc(var(--cgui-spacing) * 9);
507
513
  }
514
+ .cgui\:min-h-10 {
515
+ min-height: calc(var(--cgui-spacing) * 10);
516
+ }
508
517
  .cgui\:min-h-11 {
509
518
  min-height: calc(var(--cgui-spacing) * 11);
510
519
  }
@@ -631,6 +640,18 @@
631
640
  .cgui\:min-w-5 {
632
641
  min-width: calc(var(--cgui-spacing) * 5);
633
642
  }
643
+ .cgui\:min-w-6 {
644
+ min-width: calc(var(--cgui-spacing) * 6);
645
+ }
646
+ .cgui\:min-w-8 {
647
+ min-width: calc(var(--cgui-spacing) * 8);
648
+ }
649
+ .cgui\:min-w-10 {
650
+ min-width: calc(var(--cgui-spacing) * 10);
651
+ }
652
+ .cgui\:min-w-15 {
653
+ min-width: calc(var(--cgui-spacing) * 15);
654
+ }
634
655
  .cgui\:min-w-35 {
635
656
  min-width: calc(var(--cgui-spacing) * 35);
636
657
  }
@@ -1858,6 +1879,21 @@
1858
1879
  padding-right: calc(var(--cgui-spacing) * 14);
1859
1880
  }
1860
1881
  }
1882
+ .cgui\:data-\[has-chevron\]\:pr-8 {
1883
+ &[data-has-chevron] {
1884
+ padding-right: calc(var(--cgui-spacing) * 8);
1885
+ }
1886
+ }
1887
+ .cgui\:data-\[has-chevron\]\:pr-10 {
1888
+ &[data-has-chevron] {
1889
+ padding-right: calc(var(--cgui-spacing) * 10);
1890
+ }
1891
+ }
1892
+ .cgui\:data-\[has-chevron\]\:pr-14 {
1893
+ &[data-has-chevron] {
1894
+ padding-right: calc(var(--cgui-spacing) * 14);
1895
+ }
1896
+ }
1861
1897
  .cgui\:data-\[highlighted\]\:bg-surface-lightest {
1862
1898
  &[data-highlighted] {
1863
1899
  background-color: var(--cg-ui-color-surface-lightest);
@@ -12,6 +12,7 @@ export * from './dialog/index.js';
12
12
  export * from './drawer/index.js';
13
13
  export * from './dropdown/index.js';
14
14
  export * from './field/index.js';
15
+ export * from './file-upload/index.js';
15
16
  export * from './icons/index.js';
16
17
  export * from './input/index.js';
17
18
  export * from './kbd/index.js';
@@ -12,6 +12,7 @@ export * from './dialog/index.js';
12
12
  export * from './drawer/index.js';
13
13
  export * from './dropdown/index.js';
14
14
  export * from './field/index.js';
15
+ export * from './file-upload/index.js';
15
16
  export * from './icons/index.js';
16
17
  export * from './input/index.js';
17
18
  export * from './kbd/index.js';
@@ -0,0 +1,6 @@
1
+ export { default as Ellipsis } from './pagination.ellipsis.svelte';
2
+ export { default as Item } from './pagination.item.svelte';
3
+ export { default as NextButton } from './pagination.next-button.svelte';
4
+ export { default as PageSize } from './pagination.page-size.svelte';
5
+ export { default as PrevButton } from './pagination.prev-button.svelte';
6
+ export { default as Root } from './pagination.root.svelte';
@@ -0,0 +1,6 @@
1
+ export { default as Ellipsis } from './pagination.ellipsis.svelte';
2
+ export { default as Item } from './pagination.item.svelte';
3
+ export { default as NextButton } from './pagination.next-button.svelte';
4
+ export { default as PageSize } from './pagination.page-size.svelte';
5
+ export { default as PrevButton } from './pagination.prev-button.svelte';
6
+ export { default as Root } from './pagination.root.svelte';
@@ -1,15 +1,12 @@
1
1
  <script lang="ts">
2
- import { PaginationStylesContext } from '../styles.js';
3
-
4
2
  import { Icon } from '../../icons/index.js';
5
3
  import { cn } from '../../../internal/utils/common.js';
4
+ import { paginationEllipsisStyles } from '../styles.js';
6
5
  import type { PaginationEllipsisProps } from '../types.js';
7
6
 
8
7
  let { class: className, ref = $bindable(null), child, ...restProps }: PaginationEllipsisProps = $props();
9
8
 
10
- const variants = PaginationStylesContext.get();
11
-
12
- const classNames = $derived(cn(variants.current.ellipsis(), className));
9
+ const classNames = $derived(cn(paginationEllipsisStyles(), className));
13
10
  </script>
14
11
 
15
12
  {#if child}
@@ -1,13 +1,17 @@
1
1
  <script lang="ts">
2
2
  import { cn } from '../../../internal/utils/common.js';
3
- import { PaginationStylesContext } from '../styles.js';
4
- import type { PaginationItemProps } from '../types.js';
5
-
6
3
  import { Pagination as PaginationPrimitive } from 'bits-ui';
4
+ import { paginationItemStyles } from '../styles.js';
5
+ import type { PaginationItemProps } from '../types.js';
6
+ import { PaginationRootContext } from './state.svelte.js';
7
7
 
8
- let { page, class: className, ...props }: PaginationItemProps = $props();
8
+ let { page, class: className, size, ...props }: PaginationItemProps = $props();
9
9
 
10
- const variants = PaginationStylesContext.get();
10
+ const rootCtx$ = PaginationRootContext.get();
11
11
  </script>
12
12
 
13
- <PaginationPrimitive.Page {page} class={cn(variants.current.item(), className)} {...props} />
13
+ <PaginationPrimitive.Page
14
+ {page}
15
+ class={cn(paginationItemStyles({ size: size ?? rootCtx$.opts.size.current }), className)}
16
+ {...props}
17
+ />
@@ -1,4 +1,4 @@
1
- import { Pagination as PaginationPrimitive } from 'bits-ui';
2
- declare const Pagination: import("svelte").Component<PaginationPrimitive.PageProps, {}, "">;
1
+ import type { PaginationItemProps } from '../types.js';
2
+ declare const Pagination: import("svelte").Component<PaginationItemProps, {}, "">;
3
3
  type Pagination = ReturnType<typeof Pagination>;
4
4
  export default Pagination;
@@ -1,19 +1,14 @@
1
1
  <script lang="ts">
2
- import { cn } from '../../../internal/utils/common.js';
3
- import { PaginationStylesContext } from '../styles.js';
4
-
5
2
  import { Icon } from '../../icons/index.js';
3
+ import { cn } from '../../../internal/utils/common.js';
6
4
  import { Pagination as PaginationPrimitive } from 'bits-ui';
5
+ import { paginationButtonStyles } from '../styles.js';
7
6
  import type { PaginationNextButtonProps } from '../types.js';
8
7
 
9
8
  let { class: className, children, ref = $bindable(null), ...props }: PaginationNextButtonProps = $props();
10
-
11
- const variants = PaginationStylesContext.get();
12
-
13
- const classNames = $derived(cn(variants.current.button(), className));
14
9
  </script>
15
10
 
16
- <PaginationPrimitive.NextButton bind:ref class={classNames} {...props}>
11
+ <PaginationPrimitive.NextButton bind:ref class={cn(paginationButtonStyles(), className)} {...props}>
17
12
  {#if children}
18
13
  {@render children?.()}
19
14
  {:else}
@@ -0,0 +1,40 @@
1
+ <script lang="ts">
2
+ import { Select, type SelectCollection } from '../../select/index.js';
3
+ import { createSelectCollection } from '../../select/select.svelte';
4
+ import type { PaginationPageSizeProps } from '../types.js';
5
+
6
+ let { perPage = $bindable(10), perPageItems = [10, 20, 50, 100], ...restProps }: PaginationPageSizeProps = $props();
7
+
8
+ let value = $state(String(perPage));
9
+
10
+ const collection: SelectCollection = $derived(
11
+ createSelectCollection({
12
+ items: perPageItems.map((item) => ({
13
+ value: String(item),
14
+ label: String(item),
15
+ })),
16
+ })
17
+ );
18
+
19
+ $effect(() => {
20
+ value = String(perPage);
21
+ });
22
+
23
+ function onSelect(newValue: string | string[]) {
24
+ if (typeof newValue === 'string' && newValue) {
25
+ perPage = Number(newValue);
26
+ }
27
+ }
28
+ </script>
29
+
30
+ <Select.Root
31
+ {collection}
32
+ bind:value
33
+ type="single"
34
+ {onSelect}
35
+ triggerClass="cgui:min-w-15"
36
+ triggerProps={{
37
+ fullWidth: false,
38
+ }}
39
+ {...restProps}
40
+ />
@@ -0,0 +1,4 @@
1
+ import type { PaginationPageSizeProps } from '../types.js';
2
+ declare const Pagination: import("svelte").Component<PaginationPageSizeProps, {}, "perPage">;
3
+ type Pagination = ReturnType<typeof Pagination>;
4
+ export default Pagination;
@@ -2,14 +2,12 @@
2
2
  import { Icon } from '../../icons/index.js';
3
3
  import { cn } from '../../../internal/utils/common.js';
4
4
  import { Pagination as PaginationPrimitive } from 'bits-ui';
5
- import { PaginationStylesContext } from '../styles.js';
5
+ import { paginationButtonStyles } from '../styles.js';
6
6
  import type { PaginationPrevButtonProps } from '../types.js';
7
7
 
8
8
  let { class: className, children, ref = $bindable(null), ...props }: PaginationPrevButtonProps = $props();
9
9
 
10
- const variants = PaginationStylesContext.get();
11
-
12
- const classNames = $derived(cn(variants.current.button(), className));
10
+ const classNames = $derived(cn(paginationButtonStyles(), className));
13
11
  </script>
14
12
 
15
13
  <PaginationPrimitive.PrevButton bind:ref class={classNames} {...props}>
@@ -1,22 +1,31 @@
1
1
  <script lang="ts">
2
2
  import { cn } from '../../../internal/utils/common.js';
3
3
  import { Pagination as PaginationPrimitive } from 'bits-ui';
4
- import { box } from 'svelte-toolbelt';
5
- import { PaginationStylesContext, paginationStyles } from '../styles.js';
4
+ import { boxWith } from 'svelte-toolbelt';
5
+ import { paginationRootStyles } from '../styles.js';
6
6
  import type { PaginationRootProps } from '../types.js';
7
+ import { PaginationRootState } from './state.svelte.js';
7
8
 
8
9
  let {
9
10
  page = $bindable(1),
10
11
  orientation = 'horizontal',
11
12
  size = 'md',
12
13
  centered = false,
14
+ ref = $bindable(null),
13
15
  class: className,
14
16
  ...restProps
15
17
  }: PaginationRootProps = $props();
16
18
 
17
- const variants = $derived(paginationStyles({ orientation, size, centered }));
18
-
19
- PaginationStylesContext.set(box.with(() => variants));
19
+ PaginationRootState.create({
20
+ size: boxWith(() => size),
21
+ orientation: boxWith(() => orientation),
22
+ centered: boxWith(() => centered),
23
+ });
20
24
  </script>
21
25
 
22
- <PaginationPrimitive.Root bind:page class={cn(variants.root(), className)} {...restProps} />
26
+ <PaginationPrimitive.Root
27
+ bind:page
28
+ bind:ref
29
+ class={cn(paginationRootStyles({ size, orientation, centered }), className)}
30
+ {...restProps}
31
+ />
@@ -1,4 +1,4 @@
1
1
  import type { PaginationRootProps } from '../types.js';
2
- declare const Pagination: import("svelte").Component<PaginationRootProps, {}, "page">;
2
+ declare const Pagination: import("svelte").Component<PaginationRootProps, {}, "ref" | "page">;
3
3
  type Pagination = ReturnType<typeof Pagination>;
4
4
  export default Pagination;
@@ -0,0 +1,15 @@
1
+ import { Context } from 'runed';
2
+ import type { ReadableBoxedValues } from 'svelte-toolbelt';
3
+ import type { PaginationRootProps } from '../types.js';
4
+ export declare const PaginationRootContext: Context<PaginationRootState>;
5
+ type PaginationRootStateOpts = ReadableBoxedValues<{
6
+ size: PaginationRootProps['size'];
7
+ orientation: PaginationRootProps['orientation'];
8
+ centered: PaginationRootProps['centered'];
9
+ }>;
10
+ export declare class PaginationRootState {
11
+ static create(opts: PaginationRootStateOpts): PaginationRootState;
12
+ readonly opts: PaginationRootStateOpts;
13
+ constructor(opts: PaginationRootStateOpts);
14
+ }
15
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Context } from 'runed';
2
+ export const PaginationRootContext = new Context('pagination-root');
3
+ export class PaginationRootState {
4
+ static create(opts) {
5
+ return PaginationRootContext.set(new PaginationRootState(opts));
6
+ }
7
+ opts;
8
+ constructor(opts) {
9
+ this.opts = opts;
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ export { Root } from './root/index.js';
@@ -0,0 +1 @@
1
+ export { Root } from './root/index.js';
@@ -0,0 +1 @@
1
+ export { default as Root } from './pagination.root.svelte';
@@ -0,0 +1 @@
1
+ export { default as Root } from './pagination.root.svelte';
@@ -0,0 +1,42 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../../internal/utils/common.js';
3
+ import * as PaginationPrimitive from '../../components/index.js';
4
+ import type { PaginationProps } from '../../types.js';
5
+
6
+ let {
7
+ page = $bindable(1),
8
+ perPage = $bindable(10),
9
+ orientation = 'horizontal',
10
+ perPageItems = [10, 20, 50, 100],
11
+ hidePageSize = false,
12
+ ...restProps
13
+ }: PaginationProps = $props();
14
+ </script>
15
+
16
+ <PaginationPrimitive.Root bind:page {orientation} {...restProps}>
17
+ {#snippet children({ pages })}
18
+ {#if !hidePageSize}
19
+ <PaginationPrimitive.PageSize bind:perPage {perPageItems} />
20
+ {/if}
21
+
22
+ <div
23
+ class={cn('cgui:flex cgui:items-center cgui:justify-center cgui:gap-1 cgui:flex-1', {
24
+ 'cgui:flex-col': orientation === 'vertical',
25
+ })}
26
+ >
27
+ <PaginationPrimitive.PrevButton />
28
+
29
+ {#each pages as page (page.key)}
30
+ {#if page.type === 'ellipsis'}
31
+ <PaginationPrimitive.Ellipsis />
32
+ {:else}
33
+ <PaginationPrimitive.Item {page}>
34
+ {page.value}
35
+ </PaginationPrimitive.Item>
36
+ {/if}
37
+ {/each}
38
+
39
+ <PaginationPrimitive.NextButton />
40
+ </div>
41
+ {/snippet}
42
+ </PaginationPrimitive.Root>
@@ -0,0 +1,4 @@
1
+ import type { PaginationProps } from '../../types.js';
2
+ declare const Pagination: import("svelte").Component<PaginationProps, {}, "page" | "perPage">;
3
+ type Pagination = ReturnType<typeof Pagination>;
4
+ export default Pagination;
@@ -1,3 +1,3 @@
1
- export * as PaginationPrimitive from './exports-primitive.js';
2
- export * from './exports.js';
3
- export type { PaginationEllipsisProps, PaginationItemProps, PaginationNextButtonProps, PaginationPrevButtonProps, PaginationProps, PaginationRootProps, } from './types.js';
1
+ export * as PaginationPrimitive from './components/index.js';
2
+ export * as Pagination from './composed/index.js';
3
+ export * from './types.js';
@@ -1,2 +1,3 @@
1
- export * as PaginationPrimitive from './exports-primitive.js';
2
- export * from './exports.js';
1
+ export * as PaginationPrimitive from './components/index.js';
2
+ export * as Pagination from './composed/index.js';
3
+ export * from './types.js';
@@ -1,98 +1,67 @@
1
- import { Context } from 'runed';
2
- import type { ReadableBox } from 'svelte-toolbelt';
3
1
  import type { VariantProps } from 'tailwind-variants';
4
- export declare const paginationStyles: import("tailwind-variants").TVReturnType<{
2
+ export declare const paginationRootStyles: import("tailwind-variants").TVReturnType<{
5
3
  centered: {
6
- true: {
7
- root: string[];
8
- };
4
+ true: string;
5
+ };
6
+ size: {
7
+ sm: string[];
8
+ md: string[];
9
+ lg: string[];
9
10
  };
10
11
  orientation: {
11
- horizontal: {
12
- root: string[];
13
- };
14
- vertical: {
15
- root: string[];
16
- };
12
+ horizontal: string;
13
+ vertical: string;
14
+ };
15
+ }, undefined, string[], {
16
+ centered: {
17
+ true: string;
17
18
  };
18
19
  size: {
19
- sm: {
20
- item: string[];
21
- };
22
- md: {
23
- item: string[];
24
- };
25
- lg: {
26
- item: string[];
27
- };
20
+ sm: string[];
21
+ md: string[];
22
+ lg: string[];
23
+ };
24
+ orientation: {
25
+ horizontal: string;
26
+ vertical: string;
28
27
  };
29
- }, {
30
- root: string[];
31
- item: string[];
32
- button: string[];
33
- ellipsis: string[];
34
- }, undefined, {
28
+ }, undefined, import("tailwind-variants").TVReturnType<{
35
29
  centered: {
36
- true: {
37
- root: string[];
38
- };
30
+ true: string;
31
+ };
32
+ size: {
33
+ sm: string[];
34
+ md: string[];
35
+ lg: string[];
39
36
  };
40
37
  orientation: {
41
- horizontal: {
42
- root: string[];
43
- };
44
- vertical: {
45
- root: string[];
46
- };
38
+ horizontal: string;
39
+ vertical: string;
47
40
  };
41
+ }, undefined, string[], unknown, unknown, undefined>>;
42
+ export declare const paginationItemStyles: import("tailwind-variants").TVReturnType<{
48
43
  size: {
49
- sm: {
50
- item: string[];
51
- };
52
- md: {
53
- item: string[];
54
- };
55
- lg: {
56
- item: string[];
57
- };
58
- };
59
- }, {
60
- root: string[];
61
- item: string[];
62
- button: string[];
63
- ellipsis: string[];
64
- }, import("tailwind-variants").TVReturnType<{
65
- centered: {
66
- true: {
67
- root: string[];
68
- };
44
+ sm: string[];
45
+ md: string[];
46
+ lg: string[];
69
47
  };
70
- orientation: {
71
- horizontal: {
72
- root: string[];
73
- };
74
- vertical: {
75
- root: string[];
76
- };
48
+ }, undefined, string[], {
49
+ size: {
50
+ sm: string[];
51
+ md: string[];
52
+ lg: string[];
77
53
  };
54
+ }, undefined, import("tailwind-variants").TVReturnType<{
78
55
  size: {
79
- sm: {
80
- item: string[];
81
- };
82
- md: {
83
- item: string[];
84
- };
85
- lg: {
86
- item: string[];
87
- };
56
+ sm: string[];
57
+ md: string[];
58
+ lg: string[];
88
59
  };
89
- }, {
90
- root: string[];
91
- item: string[];
92
- button: string[];
93
- ellipsis: string[];
94
- }, undefined, unknown, unknown, undefined>>;
95
- export type PaginationVariantsProps = VariantProps<typeof paginationStyles>;
96
- type PaginationStylesContextValues = ReadableBox<ReturnType<typeof paginationStyles>>;
97
- export declare const PaginationStylesContext: Context<PaginationStylesContextValues>;
98
- export {};
60
+ }, undefined, string[], unknown, unknown, undefined>>;
61
+ export declare const paginationButtonStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
62
+ export declare const paginationEllipsisStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
63
+ export type PaginationRootVariants = VariantProps<typeof paginationRootStyles>;
64
+ export type PaginationItemVariants = VariantProps<typeof paginationItemStyles>;
65
+ export type PaginationButtonVariants = VariantProps<typeof paginationButtonStyles>;
66
+ export type PaginationEllipsisVariants = VariantProps<typeof paginationEllipsisStyles>;
67
+ export type PaginationVariantsProps = PaginationRootVariants & PaginationItemVariants;
@@ -1,51 +1,49 @@
1
- import { keyWithPrefix } from '../../internal/utils/common.js';
2
1
  import { tv } from '../../internal/utils/tailwindcss.js';
3
- import { Context } from 'runed';
4
- export const paginationStyles = tv({
5
- slots: {
6
- root: ['cgui:flex cgui:items-center cgui:gap-1'],
7
- item: [
8
- 'cgui:flex cgui:items-center cgui:justify-center',
9
- 'cgui:text-fg-dark cgui:text-body-2 cgui:font-normal',
10
- 'cgui:border cgui:border-transparent',
11
- 'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
12
- 'cgui:cursor-pointer cgui:select-none cgui:rounded-full',
13
- 'cgui:data-[selected=""]:text-fg-primary cgui:data-[selected=""]:border-stroke-primary',
14
- 'cgui:disabled:opacity-50 cgui:disabled:cursor-not-allowed cgui:disabled:pointer-events-none',
15
- ],
16
- button: [
17
- 'cgui:flex cgui:items-center cgui:justify-center cgui:shrink-0 cgui:size-6 cgui:text-icon-regular',
18
- 'cgui:select-none cgui:cursor-pointer',
19
- 'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
20
- 'cgui:disabled:opacity-50 cgui:disabled:cursor-not-allowed cgui:disabled:pointer-events-none',
21
- ],
22
- ellipsis: ['cgui:flex cgui:items-center cgui:justify-center cgui:shrink-0 cgui:size-6 cgui:text-icon-regular'],
23
- },
2
+ const PaginationSizes = ['sm', 'md', 'lg'];
3
+ const PaginationOrientations = ['horizontal', 'vertical'];
4
+ export const paginationRootStyles = tv({
5
+ base: ['cgui:flex cgui:items-center cgui:gap-1'],
24
6
  variants: {
25
7
  centered: {
26
- true: {
27
- root: ['cgui:justify-center'],
28
- },
8
+ true: 'cgui:justify-center',
9
+ },
10
+ size: {
11
+ sm: [''],
12
+ md: [''],
13
+ lg: [''],
29
14
  },
30
15
  orientation: {
31
- horizontal: {
32
- root: ['cgui:flex-row'],
33
- },
34
- vertical: {
35
- root: ['cgui:flex-col'],
36
- },
16
+ horizontal: 'cgui:flex-row',
17
+ vertical: 'cgui:flex-col',
37
18
  },
19
+ },
20
+ });
21
+ export const paginationItemStyles = tv({
22
+ base: [
23
+ 'cgui:flex cgui:items-center cgui:justify-center',
24
+ 'cgui:text-fg-dark cgui:text-body-2 cgui:font-normal',
25
+ 'cgui:border cgui:border-transparent',
26
+ 'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
27
+ 'cgui:cursor-pointer cgui:select-none cgui:rounded-full',
28
+ 'cgui:data-[selected=""]:text-fg-primary cgui:data-[selected=""]:border-stroke-primary',
29
+ 'cgui:disabled:opacity-50 cgui:disabled:cursor-not-allowed cgui:disabled:pointer-events-none',
30
+ ],
31
+ variants: {
38
32
  size: {
39
- sm: {
40
- item: ['cgui:size-6'],
41
- },
42
- md: {
43
- item: ['cgui:size-8'],
44
- },
45
- lg: {
46
- item: ['cgui:size-10'],
47
- },
33
+ sm: ['cgui:min-w-6 cgui:min-h-6 cgui:px-1'],
34
+ md: ['cgui:min-w-8 cgui:min-h-8 cgui:px-1'],
35
+ lg: ['cgui:min-w-10 cgui:min-h-10 cgui:px-1'],
48
36
  },
49
37
  },
50
38
  });
51
- export const PaginationStylesContext = new Context(keyWithPrefix('pagination-styles'));
39
+ export const paginationButtonStyles = tv({
40
+ base: [
41
+ 'cgui:flex cgui:items-center cgui:justify-center cgui:shrink-0 cgui:size-6 cgui:text-icon-regular',
42
+ 'cgui:select-none cgui:cursor-pointer',
43
+ 'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
44
+ 'cgui:disabled:opacity-50 cgui:disabled:cursor-not-allowed cgui:disabled:pointer-events-none',
45
+ ],
46
+ });
47
+ export const paginationEllipsisStyles = tv({
48
+ base: ['cgui:flex cgui:items-center cgui:justify-center cgui:shrink-0 cgui:size-6 cgui:text-icon-regular'],
49
+ });
@@ -1,10 +1,24 @@
1
+ import type { SelectContentProps } from '../select/types.js';
2
+ import type { WithVariants } from '../../internal/types/composition.js';
1
3
  import type { PrimitiveDivAttributes } from '../../internal/types/html-attributes.js';
2
4
  import { type PaginationNextButtonProps as PaginationNextButtonPropsPrimitive, type PaginationPageProps as PaginationPagePropsPrimitive, type PaginationPrevButtonProps as PaginationPrevButtonPropsPrimitive, type PaginationRootProps as PaginationRootPropsPrimitive } from 'bits-ui';
3
5
  import type { WithChild, WithElementRef } from 'svelte-toolbelt';
4
- import type { PaginationVariantsProps } from './styles.js';
5
- export type PaginationRootProps = PaginationRootPropsPrimitive & PaginationVariantsProps;
6
+ import type { PaginationItemVariants, PaginationVariantsProps } from './styles.js';
7
+ export type PaginationRootProps = WithVariants<PaginationRootPropsPrimitive, PaginationVariantsProps>;
6
8
  export type PaginationEllipsisProps = WithChild<WithElementRef<{} & PrimitiveDivAttributes>>;
7
- export type PaginationItemProps = PaginationPagePropsPrimitive;
9
+ export type PaginationItemProps = WithVariants<PaginationPagePropsPrimitive, PaginationItemVariants>;
8
10
  export type PaginationNextButtonProps = PaginationNextButtonPropsPrimitive;
9
11
  export type PaginationPrevButtonProps = PaginationPrevButtonPropsPrimitive;
10
- export type PaginationProps = PaginationRootProps;
12
+ export type PaginationPageSizeProps = {
13
+ perPage?: number;
14
+ perPageItems?: number[];
15
+ placeholder?: string;
16
+ contentProps?: Omit<SelectContentProps, 'class' | 'children' | 'child' | 'ref'>;
17
+ contentClass?: string;
18
+ disabled?: boolean;
19
+ };
20
+ export type PaginationProps = PaginationRootProps & {
21
+ perPage?: number;
22
+ perPageItems?: number[];
23
+ hidePageSize?: boolean;
24
+ };
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { Icon } from '../../icons/index.js';
3
+ import { boolAttr } from '../../../internal/utils/attrs.js';
3
4
  import { cn } from '../../../internal/utils/common.js';
4
5
  import { Select as SelectPrimitive } from 'bits-ui';
5
6
  import { selectTriggerStyles } from '../styles.js';
@@ -20,12 +21,14 @@
20
21
 
21
22
  const attrs = $derived({
22
23
  'data-slot': 'trigger',
24
+ 'data-has-chevron': boolAttr(hasChevron),
23
25
  class: cn(
24
26
  selectTriggerStyles({
25
27
  size,
26
28
  variant,
27
29
  rounded,
28
30
  fullWidth,
31
+ hasChevron,
29
32
  }),
30
33
  className
31
34
  ),
@@ -59,6 +59,9 @@
59
59
  contentClass,
60
60
  contentRef = $bindable(null),
61
61
 
62
+ triggerClass,
63
+ triggerProps,
64
+
62
65
  placeholder: placeholderProp,
63
66
  clearable = false,
64
67
 
@@ -198,13 +201,13 @@
198
201
 
199
202
  <Root bind:value={value as never} bind:open {...restProps}>
200
203
  {#if triggerSnippet}
201
- <Trigger>
204
+ <Trigger class={cn(triggerClass)} {...triggerProps}>
202
205
  {#snippet child({ props })}
203
206
  {@render triggerSnippet?.({ props, label: displayLabel })}
204
207
  {/snippet}
205
208
  </Trigger>
206
209
  {:else}
207
- <Trigger>
210
+ <Trigger class={cn(triggerClass)} {...triggerProps}>
208
211
  {#if labelSnippet}
209
212
  {@render labelSnippet?.({ placeholder: displayLabel, value, selectedItems })}
210
213
  {:else}
@@ -15,6 +15,9 @@ export declare const selectTriggerStyles: import("tailwind-variants").TVReturnTy
15
15
  md: string[];
16
16
  lg: string[];
17
17
  };
18
+ hasChevron: {
19
+ true: string[];
20
+ };
18
21
  fullWidth: {
19
22
  true: string[];
20
23
  };
@@ -34,6 +37,9 @@ export declare const selectTriggerStyles: import("tailwind-variants").TVReturnTy
34
37
  md: string[];
35
38
  lg: string[];
36
39
  };
40
+ hasChevron: {
41
+ true: string[];
42
+ };
37
43
  fullWidth: {
38
44
  true: string[];
39
45
  };
@@ -53,6 +59,9 @@ export declare const selectTriggerStyles: import("tailwind-variants").TVReturnTy
53
59
  md: string[];
54
60
  lg: string[];
55
61
  };
62
+ hasChevron: {
63
+ true: string[];
64
+ };
56
65
  fullWidth: {
57
66
  true: string[];
58
67
  };
@@ -62,7 +71,7 @@ export declare const selectViewportStyles: import("tailwind-variants").TVReturnT
62
71
  export declare const selectItemStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
63
72
  export declare const selectGroupStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, never[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, never[], unknown, unknown, undefined>>;
64
73
  export declare const selectGroupHeadingStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
65
- export type SelectTriggerVariantsProps = VariantProps<typeof selectTriggerStyles>;
74
+ export type SelectTriggerVariantsProps = Omit<VariantProps<typeof selectTriggerStyles>, 'hasChevron'>;
66
75
  export type SelectContentVariantsProps = VariantProps<typeof selectContentStyles>;
67
76
  export type SelectItemVariantsProps = VariantProps<typeof selectItemStyles>;
68
77
  export type SelectViewportVariantsProps = VariantProps<typeof selectViewportStyles>;
@@ -22,13 +22,24 @@ export const selectTriggerStyles = tv({
22
22
  clear: [],
23
23
  },
24
24
  size: {
25
- sm: ['cgui:min-h-7.5', 'cgui:px-2.5 cgui:py-1.5', 'cgui:data-[start-chevron]:pl-8 cgui:data-[end-chevron]:pr-8'],
26
- md: ['cgui:min-h-9', 'cgui:px-3 cgui:py-2', 'cgui:data-[start-chevron]:pl-10 cgui:data-[end-chevron]:pr-10'],
25
+ sm: [
26
+ 'cgui:min-h-7.5',
27
+ 'cgui:px-2.5 cgui:py-1.5',
28
+ 'cgui:data-[start-chevron]:pl-8 cgui:data-[end-chevron]:pr-8',
29
+ 'cgui:data-[has-chevron]:pr-8',
30
+ ],
31
+ md: [
32
+ 'cgui:min-h-9',
33
+ 'cgui:px-3 cgui:py-2',
34
+ 'cgui:data-[start-chevron]:pl-10 cgui:data-[end-chevron]:pr-10',
35
+ 'cgui:data-[has-chevron]:pr-10',
36
+ ],
27
37
  lg: [
28
38
  'cgui:min-h-11',
29
39
  'cgui:text-heading-2',
30
40
  'cgui:px-4 cgui:py-2.5',
31
41
  'cgui:data-[start-chevron]:pl-14 cgui:data-[end-chevron]:pr-14',
42
+ 'cgui:data-[has-chevron]:pr-14',
32
43
  ],
33
44
  },
34
45
  rounded: {
@@ -36,6 +47,9 @@ export const selectTriggerStyles = tv({
36
47
  md: ['cgui:rounded-md'],
37
48
  lg: ['cgui:rounded-lg'],
38
49
  },
50
+ hasChevron: {
51
+ true: [''],
52
+ },
39
53
  fullWidth: {
40
54
  true: ['cgui:w-full'],
41
55
  },
@@ -87,6 +87,8 @@ export type SelectProps = SelectRootProps & {
87
87
  contentProps?: Omit<SelectContentProps, 'class' | 'children' | 'child' | 'ref'>;
88
88
  contentRef?: HTMLDivElement | null;
89
89
  contentClass?: string;
90
+ triggerClass?: string;
91
+ triggerProps?: Omit<SelectTriggerProps, 'class' | 'children' | 'child' | 'ref'>;
90
92
  disabledPortal?: boolean;
91
93
  /** Callback when selection changes. Provides value(s) and the item that was just selected, or null on deselect. */
92
94
  onSelect?: (value: string | string[], item: SelectItem | null) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casinogate/ui",
3
- "version": "1.11.8",
3
+ "version": "1.11.10",
4
4
  "svelte": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -1,5 +0,0 @@
1
- export { default as Ellipsis } from './components/pagination.ellipsis.svelte';
2
- export { default as Item } from './components/pagination.item.svelte';
3
- export { default as NextButton } from './components/pagination.next-button.svelte';
4
- export { default as PrevButton } from './components/pagination.prev-button.svelte';
5
- export { default as Root } from './components/pagination.root.svelte';
@@ -1,5 +0,0 @@
1
- export { default as Ellipsis } from './components/pagination.ellipsis.svelte';
2
- export { default as Item } from './components/pagination.item.svelte';
3
- export { default as NextButton } from './components/pagination.next-button.svelte';
4
- export { default as PrevButton } from './components/pagination.prev-button.svelte';
5
- export { default as Root } from './components/pagination.root.svelte';
@@ -1 +0,0 @@
1
- export { default as Pagination } from './pagination.svelte';
@@ -1 +0,0 @@
1
- export { default as Pagination } from './pagination.svelte';
@@ -1,28 +0,0 @@
1
- <script lang="ts">
2
- import Ellipsis from './components/pagination.ellipsis.svelte';
3
- import Item from './components/pagination.item.svelte';
4
- import NextButton from './components/pagination.next-button.svelte';
5
- import PrevButton from './components/pagination.prev-button.svelte';
6
- import Root from './components/pagination.root.svelte';
7
- import type { PaginationProps } from './types.js';
8
-
9
- let { page = $bindable(1), ...restProps }: PaginationProps = $props();
10
- </script>
11
-
12
- <Root bind:page {...restProps}>
13
- {#snippet children({ pages })}
14
- <PrevButton />
15
-
16
- {#each pages as page (page.key)}
17
- {#if page.type === 'ellipsis'}
18
- <Ellipsis />
19
- {:else}
20
- <Item {page}>
21
- {page.value}
22
- </Item>
23
- {/if}
24
- {/each}
25
-
26
- <NextButton />
27
- {/snippet}
28
- </Root>
@@ -1,3 +0,0 @@
1
- declare const Pagination: import("svelte").Component<import("./types.js").PaginationRootProps, {}, "page">;
2
- type Pagination = ReturnType<typeof Pagination>;
3
- export default Pagination;