@casinogate/ui 0.0.4 → 1.0.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 (216) hide show
  1. package/dist/app.d.ts +1 -1
  2. package/dist/app.html +9 -9
  3. package/dist/assets/css/root.css +585 -0
  4. package/dist/assets/css/theme.css +2 -0
  5. package/dist/components/button/button.stories.svelte +2 -2
  6. package/dist/components/checkbox/checkbox.stories.svelte +2 -2
  7. package/dist/components/checkbox/components/checkbox.root.svelte +2 -2
  8. package/dist/components/checkbox/index.js +1 -1
  9. package/dist/components/collapsible/collapsible.stories.svelte +2 -2
  10. package/dist/components/collapsible/components/collapsaible.svelte.js +1 -1
  11. package/dist/components/collapsible/components/collapsaible.trigger.svelte +2 -2
  12. package/dist/components/data-table/components/data-table.body.svelte +33 -0
  13. package/dist/components/data-table/components/data-table.body.svelte.d.ts +8 -0
  14. package/dist/components/data-table/components/data-table.cell.svelte +48 -0
  15. package/dist/components/data-table/components/data-table.cell.svelte.d.ts +10 -0
  16. package/dist/components/data-table/components/data-table.head.svelte +48 -0
  17. package/dist/components/data-table/components/data-table.head.svelte.d.ts +10 -0
  18. package/dist/components/data-table/components/data-table.header.svelte +41 -0
  19. package/dist/components/data-table/components/data-table.header.svelte.d.ts +7 -0
  20. package/dist/components/data-table/components/data-table.resize-handler.svelte +31 -0
  21. package/dist/components/data-table/components/data-table.resize-handler.svelte.d.ts +7 -0
  22. package/dist/components/data-table/components/data-table.root.svelte +55 -0
  23. package/dist/components/data-table/components/data-table.root.svelte.d.ts +34 -0
  24. package/dist/components/data-table/components/data-table.row.svelte +35 -0
  25. package/dist/components/data-table/components/data-table.row.svelte.d.ts +7 -0
  26. package/dist/components/data-table/components/data-table.sort-button.svelte +51 -0
  27. package/dist/components/data-table/components/data-table.sort-button.svelte.d.ts +7 -0
  28. package/dist/components/data-table/components/data-table.svelte.d.ts +139 -0
  29. package/dist/components/data-table/components/data-table.svelte.js +248 -0
  30. package/dist/components/data-table/components/data-table.table.svelte +33 -0
  31. package/dist/components/data-table/components/data-table.table.svelte.d.ts +8 -0
  32. package/dist/components/data-table/components/flex-render.svelte +32 -0
  33. package/dist/components/data-table/components/flex-render.svelte.d.ts +30 -0
  34. package/dist/components/data-table/data-table.stories.svelte +327 -0
  35. package/dist/components/data-table/data-table.stories.svelte.d.ts +4 -0
  36. package/dist/components/data-table/data-table.svelte +118 -0
  37. package/dist/components/data-table/data-table.svelte.d.ts +32 -0
  38. package/dist/components/data-table/index.js +26 -0
  39. package/dist/components/data-table/models/create-table.svelte.d.ts +19 -0
  40. package/dist/components/data-table/models/create-table.svelte.js +35 -0
  41. package/dist/components/data-table/models/index.d.ts +1 -0
  42. package/dist/components/data-table/models/index.js +1 -0
  43. package/dist/components/data-table/styles.d.ts +176 -0
  44. package/dist/components/data-table/styles.js +83 -0
  45. package/dist/components/data-table/types.d.ts +1 -0
  46. package/dist/components/data-table/types.js +1 -0
  47. package/dist/components/data-table/utils/index.d.ts +4 -0
  48. package/dist/components/data-table/utils/index.js +4 -0
  49. package/dist/components/data-table/utils/pagination-state.svelte.d.ts +10 -0
  50. package/dist/components/data-table/utils/pagination-state.svelte.js +26 -0
  51. package/dist/components/data-table/utils/render-helper.d.ts +90 -0
  52. package/dist/components/data-table/utils/render-helper.js +99 -0
  53. package/dist/components/data-table/utils/resize-state.svelte.d.ts +10 -0
  54. package/dist/components/data-table/utils/resize-state.svelte.js +23 -0
  55. package/dist/components/data-table/utils/row-models.d.ts +7 -0
  56. package/dist/components/data-table/utils/row-models.js +7 -0
  57. package/dist/components/data-table/utils/row-selection-state.svelte.d.ts +10 -0
  58. package/dist/components/data-table/utils/row-selection-state.svelte.js +23 -0
  59. package/dist/components/icons/caret-down.svelte +12 -0
  60. package/dist/components/icons/caret-down.svelte.d.ts +3 -0
  61. package/dist/components/icons/caret-up.svelte +12 -0
  62. package/dist/components/icons/caret-up.svelte.d.ts +3 -0
  63. package/dist/components/icons/check.svelte +12 -0
  64. package/dist/components/icons/check.svelte.d.ts +3 -0
  65. package/dist/components/icons/chevron-down.svelte +12 -0
  66. package/dist/components/icons/chevron-down.svelte.d.ts +3 -0
  67. package/dist/components/icons/chevron-left.svelte +12 -0
  68. package/dist/components/icons/chevron-left.svelte.d.ts +3 -0
  69. package/dist/components/icons/chevron-right.svelte +12 -0
  70. package/dist/components/icons/chevron-right.svelte.d.ts +3 -0
  71. package/dist/components/icons/chevron-small-down.svelte +14 -0
  72. package/dist/components/icons/chevron-small-down.svelte.d.ts +3 -0
  73. package/dist/components/icons/chevron-small-left.svelte +14 -0
  74. package/dist/components/icons/chevron-small-left.svelte.d.ts +3 -0
  75. package/dist/components/icons/chevron-small-right.svelte +14 -0
  76. package/dist/components/icons/chevron-small-right.svelte.d.ts +3 -0
  77. package/dist/components/icons/chevron-small-up.svelte +14 -0
  78. package/dist/components/icons/chevron-small-up.svelte.d.ts +3 -0
  79. package/dist/components/icons/chevron-up.svelte +12 -0
  80. package/dist/components/icons/chevron-up.svelte.d.ts +3 -0
  81. package/dist/components/icons/dots.svelte +20 -0
  82. package/dist/components/icons/dots.svelte.d.ts +3 -0
  83. package/dist/components/icons/error.svelte +12 -0
  84. package/dist/components/icons/error.svelte.d.ts +3 -0
  85. package/dist/components/icons/eye-crossed.svelte +14 -0
  86. package/dist/components/icons/eye-crossed.svelte.d.ts +3 -0
  87. package/dist/components/icons/eye.svelte +17 -0
  88. package/dist/components/icons/eye.svelte.d.ts +3 -0
  89. package/dist/components/icons/index.d.ts +22 -0
  90. package/dist/components/icons/index.js +21 -0
  91. package/dist/components/icons/info.svelte +12 -0
  92. package/dist/components/icons/info.svelte.d.ts +3 -0
  93. package/dist/components/icons/minus.svelte +12 -0
  94. package/dist/components/icons/minus.svelte.d.ts +3 -0
  95. package/dist/components/icons/sort.svelte +16 -0
  96. package/dist/components/icons/sort.svelte.d.ts +3 -0
  97. package/dist/components/icons/spinner.svelte +9 -0
  98. package/dist/components/icons/spinner.svelte.d.ts +3 -0
  99. package/dist/components/icons/success.svelte +12 -0
  100. package/dist/components/icons/success.svelte.d.ts +3 -0
  101. package/dist/components/icons/types.d.ts +2 -0
  102. package/dist/components/icons/types.js +1 -0
  103. package/dist/components/icons/warning.svelte +12 -0
  104. package/dist/components/icons/warning.svelte.d.ts +3 -0
  105. package/dist/components/input/index.d.ts +6 -0
  106. package/dist/components/input/index.js +5 -0
  107. package/dist/components/input/input.password.svelte +38 -0
  108. package/dist/components/input/input.password.svelte.d.ts +7 -0
  109. package/dist/components/input/input.stories.svelte +41 -0
  110. package/dist/components/input/input.stories.svelte.d.ts +19 -0
  111. package/dist/components/input/input.svelte +65 -0
  112. package/dist/components/input/input.svelte.d.ts +12 -0
  113. package/dist/components/input/styles.d.ts +141 -0
  114. package/dist/components/input/styles.js +64 -0
  115. package/dist/components/pagination/components/pagination.ellipsis.svelte +27 -0
  116. package/dist/components/pagination/components/pagination.ellipsis.svelte.d.ts +7 -0
  117. package/dist/components/pagination/components/pagination.item.svelte +16 -0
  118. package/dist/components/pagination/components/pagination.item.svelte.d.ts +5 -0
  119. package/dist/components/pagination/components/pagination.next-button.svelte +28 -0
  120. package/dist/components/pagination/components/pagination.next-button.svelte.d.ts +5 -0
  121. package/dist/components/pagination/components/pagination.prev-button.svelte +28 -0
  122. package/dist/components/pagination/components/pagination.prev-button.svelte.d.ts +5 -0
  123. package/dist/components/pagination/components/pagination.root.svelte +29 -0
  124. package/dist/components/pagination/components/pagination.root.svelte.d.ts +6 -0
  125. package/dist/components/pagination/index.d.ts +16 -0
  126. package/dist/components/pagination/index.js +16 -0
  127. package/dist/components/pagination/pagination.stories.svelte +69 -0
  128. package/dist/components/pagination/pagination.stories.svelte.d.ts +19 -0
  129. package/dist/components/pagination/presets/basic.svelte +31 -0
  130. package/dist/components/pagination/presets/basic.svelte.d.ts +5 -0
  131. package/dist/components/pagination/presets/index.d.ts +1 -0
  132. package/dist/components/pagination/presets/index.js +1 -0
  133. package/dist/components/pagination/styles.d.ts +98 -0
  134. package/dist/components/pagination/styles.js +51 -0
  135. package/dist/components/segment/components/segment.item.svelte +38 -0
  136. package/dist/components/segment/components/segment.item.svelte.d.ts +9 -0
  137. package/dist/components/segment/components/segment.root.svelte +66 -0
  138. package/dist/components/segment/components/segment.root.svelte.d.ts +13 -0
  139. package/dist/components/segment/components/segment.thumb.svelte +0 -0
  140. package/dist/components/segment/components/segment.thumb.svelte.d.ts +26 -0
  141. package/dist/components/segment/components/segmet.svelte.d.ts +43 -0
  142. package/dist/components/segment/components/segmet.svelte.js +74 -0
  143. package/dist/components/segment/index.d.ts +7 -0
  144. package/dist/components/segment/index.js +6 -0
  145. package/dist/components/segment/segment.stories.svelte +43 -0
  146. package/dist/components/segment/segment.stories.svelte.d.ts +18 -0
  147. package/dist/components/segment/styles.d.ts +107 -0
  148. package/dist/components/segment/styles.js +58 -0
  149. package/dist/components/select/components/select.content.svelte +0 -0
  150. package/dist/components/select/components/select.content.svelte.d.ts +26 -0
  151. package/dist/components/select/components/select.item.svelte +0 -0
  152. package/dist/components/select/components/select.item.svelte.d.ts +26 -0
  153. package/dist/components/select/components/select.root.svelte +27 -0
  154. package/dist/components/select/components/select.root.svelte.d.ts +6 -0
  155. package/dist/components/select/components/select.trigger.svelte +52 -0
  156. package/dist/components/select/components/select.trigger.svelte.d.ts +10 -0
  157. package/dist/components/select/components/select.viewport.svelte +0 -0
  158. package/dist/components/select/components/select.viewport.svelte.d.ts +26 -0
  159. package/dist/components/select/index.d.ts +7 -0
  160. package/dist/components/select/index.js +6 -0
  161. package/dist/components/select/select.stories.svelte +53 -0
  162. package/dist/components/select/select.stories.svelte.d.ts +18 -0
  163. package/dist/components/select/styles.d.ts +149 -0
  164. package/dist/components/select/styles.js +93 -0
  165. package/dist/components/skeleton/index.d.ts +1 -0
  166. package/dist/components/skeleton/index.js +1 -0
  167. package/dist/components/skeleton/skeleton.stories.svelte +121 -0
  168. package/dist/components/skeleton/skeleton.stories.svelte.d.ts +19 -0
  169. package/dist/components/skeleton/skeleton.svelte +25 -0
  170. package/dist/components/skeleton/skeleton.svelte.d.ts +8 -0
  171. package/dist/components/skeleton/styles.d.ts +78 -0
  172. package/dist/components/skeleton/styles.js +30 -0
  173. package/dist/components/spinner/index.d.ts +1 -0
  174. package/dist/components/spinner/index.js +1 -0
  175. package/dist/components/spinner/spinner.stories.svelte +29 -0
  176. package/dist/components/spinner/spinner.stories.svelte.d.ts +19 -0
  177. package/dist/components/spinner/spinner.svelte +24 -0
  178. package/dist/components/spinner/spinner.svelte.d.ts +9 -0
  179. package/dist/components/switch/index.d.ts +7 -2
  180. package/dist/components/switch/index.js +6 -3
  181. package/dist/components/switch/model/index.d.ts +1 -1
  182. package/dist/components/switch/model/index.js +1 -1
  183. package/dist/components/switch/model/switch-model.svelte.d.ts +1 -1
  184. package/dist/components/switch/model/switch-model.svelte.js +1 -1
  185. package/dist/components/switch/presets/basic.svelte +14 -0
  186. package/dist/components/switch/presets/basic.svelte.d.ts +5 -0
  187. package/dist/components/switch/switch.stories.svelte +16 -9
  188. package/dist/components/switch/switch.stories.svelte.d.ts +1 -0
  189. package/dist/components/toast/toast.component.svelte +2 -5
  190. package/dist/components/toast/toast.stories.svelte +2 -2
  191. package/dist/index.d.ts +10 -1
  192. package/dist/index.js +10 -1
  193. package/dist/internal/mocks/data-table.d.ts +9 -0
  194. package/dist/internal/mocks/data-table.js +146 -0
  195. package/dist/internal/types/common.d.ts +1 -0
  196. package/dist/internal/utils/attrs.d.ts +3 -0
  197. package/dist/internal/utils/attrs.js +9 -0
  198. package/dist/internal/utils/objects.d.ts +12 -0
  199. package/dist/internal/utils/objects.js +52 -0
  200. package/package.json +9 -2
  201. package/dist/assets/icons/check.svg +0 -4
  202. package/dist/assets/icons/chevron-down.svg +0 -4
  203. package/dist/assets/icons/chevron-left.svg +0 -4
  204. package/dist/assets/icons/chevron-right.svg +0 -4
  205. package/dist/assets/icons/chevron-small-down.svg +0 -4
  206. package/dist/assets/icons/chevron-small-left.svg +0 -4
  207. package/dist/assets/icons/chevron-small-right.svg +0 -4
  208. package/dist/assets/icons/chevron-small-up.svg +0 -4
  209. package/dist/assets/icons/chevron-up.svg +0 -4
  210. package/dist/assets/icons/error.svg +0 -4
  211. package/dist/assets/icons/info.svg +0 -4
  212. package/dist/assets/icons/minus.svg +0 -4
  213. package/dist/assets/icons/success.svg +0 -4
  214. package/dist/assets/icons/warning.svg +0 -3
  215. package/dist/internal/types/attrs.d.ts +0 -1
  216. package/dist/internal/types/attrs.js +0 -3
@@ -0,0 +1,141 @@
1
+ import type { VariantProps } from 'tailwind-variants';
2
+ export declare const inputStyles: import("tailwind-variants").TVReturnType<{
3
+ variant: {
4
+ primary: {
5
+ input: string[];
6
+ };
7
+ };
8
+ size: {
9
+ sm: {
10
+ input: string[];
11
+ };
12
+ md: {
13
+ input: string[];
14
+ };
15
+ lg: {
16
+ input: string[];
17
+ };
18
+ };
19
+ rounded: {
20
+ sm: {
21
+ input: string[];
22
+ };
23
+ md: {
24
+ input: string[];
25
+ };
26
+ lg: {
27
+ input: string[];
28
+ };
29
+ };
30
+ w: {
31
+ full: {
32
+ wrapper: string[];
33
+ input: string[];
34
+ };
35
+ auto: {
36
+ wrapper: string[];
37
+ input: string[];
38
+ };
39
+ fit: {
40
+ wrapper: string[];
41
+ input: string[];
42
+ };
43
+ };
44
+ }, {
45
+ wrapper: string[];
46
+ input: string[];
47
+ chevron: string[];
48
+ }, undefined, {
49
+ variant: {
50
+ primary: {
51
+ input: string[];
52
+ };
53
+ };
54
+ size: {
55
+ sm: {
56
+ input: string[];
57
+ };
58
+ md: {
59
+ input: string[];
60
+ };
61
+ lg: {
62
+ input: string[];
63
+ };
64
+ };
65
+ rounded: {
66
+ sm: {
67
+ input: string[];
68
+ };
69
+ md: {
70
+ input: string[];
71
+ };
72
+ lg: {
73
+ input: string[];
74
+ };
75
+ };
76
+ w: {
77
+ full: {
78
+ wrapper: string[];
79
+ input: string[];
80
+ };
81
+ auto: {
82
+ wrapper: string[];
83
+ input: string[];
84
+ };
85
+ fit: {
86
+ wrapper: string[];
87
+ input: string[];
88
+ };
89
+ };
90
+ }, {
91
+ wrapper: string[];
92
+ input: string[];
93
+ chevron: string[];
94
+ }, import("tailwind-variants").TVReturnType<{
95
+ variant: {
96
+ primary: {
97
+ input: string[];
98
+ };
99
+ };
100
+ size: {
101
+ sm: {
102
+ input: string[];
103
+ };
104
+ md: {
105
+ input: string[];
106
+ };
107
+ lg: {
108
+ input: string[];
109
+ };
110
+ };
111
+ rounded: {
112
+ sm: {
113
+ input: string[];
114
+ };
115
+ md: {
116
+ input: string[];
117
+ };
118
+ lg: {
119
+ input: string[];
120
+ };
121
+ };
122
+ w: {
123
+ full: {
124
+ wrapper: string[];
125
+ input: string[];
126
+ };
127
+ auto: {
128
+ wrapper: string[];
129
+ input: string[];
130
+ };
131
+ fit: {
132
+ wrapper: string[];
133
+ input: string[];
134
+ };
135
+ };
136
+ }, {
137
+ wrapper: string[];
138
+ input: string[];
139
+ chevron: string[];
140
+ }, undefined, unknown, unknown, undefined>>;
141
+ export type InputVariants = VariantProps<typeof inputStyles>;
@@ -0,0 +1,64 @@
1
+ import { tv } from '../../internal/utils/tailwindcss.js';
2
+ export const inputStyles = tv({
3
+ slots: {
4
+ wrapper: ['cgui:relative'],
5
+ input: [
6
+ 'cgui:outline-none',
7
+ 'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
8
+ 'cgui:text-body',
9
+ 'cgui:disabled:opacity-50 cgui:disabled:cursor-not-allowed',
10
+ ],
11
+ chevron: [
12
+ 'cgui:absolute cgui:top-1/2 cgui:-translate-y-1/2 cgui:flex cgui:items-center cgui:justify-center cgui:size-5',
13
+ 'cgui:text-fg-regular',
14
+ 'cgui:data-[slot=start-chevron]:left-2 cgui:data-[slot=end-chevron]:right-2',
15
+ ],
16
+ },
17
+ variants: {
18
+ variant: {
19
+ primary: {
20
+ input: [
21
+ 'cgui:border cgui:border-stroke-default cgui:bg-surface-lightest cgui:placeholder:text-fg-regular cgui:shadow-none',
22
+ 'cgui:focus:ring-stroke-default cgui:focus-visible:border-stroke-focus',
23
+ 'cgui:aria-invalid:ring-stroke-error cgui:aria-invalid:border-stroke-error',
24
+ ],
25
+ },
26
+ },
27
+ size: {
28
+ sm: {
29
+ input: ['cgui:py-1.5 cgui:pl-2.5 cgui:pr-1.5', ''],
30
+ },
31
+ md: {
32
+ input: ['cgui:py-2 cgui:pl-3 cgui:pr-2', 'cgui:data-[start-chevron]:pl-8 cgui:data-[end-chevron]:pr-7'],
33
+ },
34
+ lg: {
35
+ input: ['cgui:py-2.5 cgui:pl-4 cgui:pr-2.5', ''],
36
+ },
37
+ },
38
+ rounded: {
39
+ sm: {
40
+ input: ['cgui:rounded-sm'],
41
+ },
42
+ md: {
43
+ input: ['cgui:rounded-md'],
44
+ },
45
+ lg: {
46
+ input: ['cgui:rounded-lg'],
47
+ },
48
+ },
49
+ w: {
50
+ full: {
51
+ wrapper: ['cgui:w-full'],
52
+ input: ['cgui:w-full'],
53
+ },
54
+ auto: {
55
+ wrapper: ['cgui:w-auto'],
56
+ input: ['cgui:w-auto'],
57
+ },
58
+ fit: {
59
+ wrapper: ['cgui:w-fit'],
60
+ input: ['cgui:w-fit'],
61
+ },
62
+ },
63
+ },
64
+ });
@@ -0,0 +1,27 @@
1
+ <script lang="ts" module>
2
+ export type PaginationEllipsisProps = WithChild<WithElementRef<{} & PrimitiveDivAttributes>>;
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import { PaginationStylesContext } from '../styles.js';
7
+
8
+ import { DotsIcon } from '../../icons/index.js';
9
+ import type { WithChild } from '../../../internal/types/composition.js';
10
+ import type { PrimitiveDivAttributes } from '../../../internal/types/html-attributes.js';
11
+ import { cn } from '../../../internal/utils/common.js';
12
+ import type { WithElementRef } from 'svelte-toolbelt';
13
+
14
+ let { class: className, ref = $bindable(null), child, ...restProps }: PaginationEllipsisProps = $props();
15
+
16
+ const variants = PaginationStylesContext.get();
17
+
18
+ const classNames = $derived(cn(variants.current.ellipsis(), className));
19
+ </script>
20
+
21
+ {#if child}
22
+ {@render child?.({ props: { class: classNames, ...restProps } })}
23
+ {:else}
24
+ <div bind:this={ref} class={classNames} {...restProps}>
25
+ <DotsIcon width={16} height={16} />
26
+ </div>
27
+ {/if}
@@ -0,0 +1,7 @@
1
+ export type PaginationEllipsisProps = WithChild<WithElementRef<{} & PrimitiveDivAttributes>>;
2
+ import type { WithChild } from '../../../internal/types/composition.js';
3
+ import type { PrimitiveDivAttributes } from '../../../internal/types/html-attributes.js';
4
+ import type { WithElementRef } from 'svelte-toolbelt';
5
+ declare const Pagination: import("svelte").Component<PaginationEllipsisProps, {}, "ref">;
6
+ type Pagination = ReturnType<typeof Pagination>;
7
+ export default Pagination;
@@ -0,0 +1,16 @@
1
+ <script lang="ts" module>
2
+ export type PaginationItemProps = PaginationPagePropsPrimitive;
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import { cn } from '../../../internal/utils/common.js';
7
+ import { PaginationStylesContext } from '../styles.js';
8
+
9
+ import { Pagination as PaginationPrimitive, type PaginationPageProps as PaginationPagePropsPrimitive } from 'bits-ui';
10
+
11
+ let { page, class: className, ...props }: PaginationItemProps = $props();
12
+
13
+ const variants = PaginationStylesContext.get();
14
+ </script>
15
+
16
+ <PaginationPrimitive.Page {page} class={cn(variants.current.item(), className)} {...props} />
@@ -0,0 +1,5 @@
1
+ export type PaginationItemProps = PaginationPagePropsPrimitive;
2
+ import { Pagination as PaginationPrimitive, type PaginationPageProps as PaginationPagePropsPrimitive } from 'bits-ui';
3
+ declare const Pagination: import("svelte").Component<PaginationPrimitive.PageProps, {}, "">;
4
+ type Pagination = ReturnType<typeof Pagination>;
5
+ export default Pagination;
@@ -0,0 +1,28 @@
1
+ <script lang="ts" module>
2
+ export type PaginationNextButtonProps = PaginationNextButtonPropsPrimitive;
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import { cn } from '../../../internal/utils/common.js';
7
+ import { PaginationStylesContext } from '../styles.js';
8
+
9
+ import { ChevronRightIcon } from '../../icons/index.js';
10
+ import {
11
+ Pagination as PaginationPrimitive,
12
+ type PaginationNextButtonProps as PaginationNextButtonPropsPrimitive,
13
+ } from 'bits-ui';
14
+
15
+ let { class: className, children, ref = $bindable(null), ...props }: PaginationNextButtonProps = $props();
16
+
17
+ const variants = PaginationStylesContext.get();
18
+
19
+ const classNames = $derived(cn(variants.current.button(), className));
20
+ </script>
21
+
22
+ <PaginationPrimitive.NextButton bind:ref class={classNames} {...props}>
23
+ {#if children}
24
+ {@render children?.()}
25
+ {:else}
26
+ <ChevronRightIcon />
27
+ {/if}
28
+ </PaginationPrimitive.NextButton>
@@ -0,0 +1,5 @@
1
+ export type PaginationNextButtonProps = PaginationNextButtonPropsPrimitive;
2
+ import { Pagination as PaginationPrimitive, type PaginationNextButtonProps as PaginationNextButtonPropsPrimitive } from 'bits-ui';
3
+ declare const Pagination: import("svelte").Component<PaginationPrimitive.NextButtonProps, {}, "ref">;
4
+ type Pagination = ReturnType<typeof Pagination>;
5
+ export default Pagination;
@@ -0,0 +1,28 @@
1
+ <script lang="ts" module>
2
+ export type PaginationPrevButtonProps = PaginationPrevButtonPropsPrimitive;
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import { cn } from '../../../internal/utils/common.js';
7
+ import { PaginationStylesContext } from '../styles.js';
8
+
9
+ import { ChevronLeftIcon } from '../../icons/index.js';
10
+ import {
11
+ Pagination as PaginationPrimitive,
12
+ type PaginationPrevButtonProps as PaginationPrevButtonPropsPrimitive,
13
+ } from 'bits-ui';
14
+
15
+ let { class: className, children, ref = $bindable(null), ...props }: PaginationPrevButtonProps = $props();
16
+
17
+ const variants = PaginationStylesContext.get();
18
+
19
+ const classNames = $derived(cn(variants.current.button(), className));
20
+ </script>
21
+
22
+ <PaginationPrimitive.PrevButton bind:ref class={classNames} {...props}>
23
+ {#if children}
24
+ {@render children?.()}
25
+ {:else}
26
+ <ChevronLeftIcon />
27
+ {/if}
28
+ </PaginationPrimitive.PrevButton>
@@ -0,0 +1,5 @@
1
+ export type PaginationPrevButtonProps = PaginationPrevButtonPropsPrimitive;
2
+ import { Pagination as PaginationPrimitive, type PaginationPrevButtonProps as PaginationPrevButtonPropsPrimitive } from 'bits-ui';
3
+ declare const Pagination: import("svelte").Component<PaginationPrimitive.PrevButtonProps, {}, "ref">;
4
+ type Pagination = ReturnType<typeof Pagination>;
5
+ export default Pagination;
@@ -0,0 +1,29 @@
1
+ <script lang="ts" module>
2
+ export type PaginationRootProps = PaginationRootPropsPrimitive & PaginationVariantsProps;
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import {
7
+ PaginationStylesContext,
8
+ type PaginationVariantsProps,
9
+ paginationStyles,
10
+ } from '../styles.js';
11
+ import { cn } from '../../../internal/utils/common.js';
12
+ import { Pagination as PaginationPrimitive, type PaginationRootProps as PaginationRootPropsPrimitive } from 'bits-ui';
13
+ import { box } from 'svelte-toolbelt';
14
+
15
+ let {
16
+ page = $bindable(1),
17
+ orientation = 'horizontal',
18
+ size = 'md',
19
+ centered = false,
20
+ class: className,
21
+ ...restProps
22
+ }: PaginationRootProps = $props();
23
+
24
+ const variants = $derived(paginationStyles({ orientation, size, centered }));
25
+
26
+ PaginationStylesContext.set(box.with(() => variants));
27
+ </script>
28
+
29
+ <PaginationPrimitive.Root bind:page class={cn(variants.root(), className)} {...restProps} />
@@ -0,0 +1,6 @@
1
+ export type PaginationRootProps = PaginationRootPropsPrimitive & PaginationVariantsProps;
2
+ import { type PaginationVariantsProps } from '../styles.js';
3
+ import { type PaginationRootProps as PaginationRootPropsPrimitive } from 'bits-ui';
4
+ declare const Pagination: import("svelte").Component<PaginationRootProps, {}, "page">;
5
+ type Pagination = ReturnType<typeof Pagination>;
6
+ export default Pagination;
@@ -0,0 +1,16 @@
1
+ import { type PaginationEllipsisProps } from './components/pagination.ellipsis.svelte';
2
+ import { type PaginationItemProps } from './components/pagination.item.svelte';
3
+ import { type PaginationNextButtonProps } from './components/pagination.next-button.svelte';
4
+ import { type PaginationPrevButtonProps } from './components/pagination.prev-button.svelte';
5
+ import { type PaginationRootProps } from './components/pagination.root.svelte';
6
+ export declare const PaginationPrimitive: {
7
+ readonly Root: import("svelte").Component<PaginationRootProps, {}, "page">;
8
+ readonly Item: import("svelte").Component<import("bits-ui").PaginationPageProps, {}, "">;
9
+ readonly Ellipsis: import("svelte").Component<PaginationEllipsisProps, {}, "ref">;
10
+ readonly PrevButton: import("svelte").Component<import("bits-ui").PaginationPrevButtonProps, {}, "ref">;
11
+ readonly NextButton: import("svelte").Component<import("bits-ui").PaginationNextButtonProps, {}, "ref">;
12
+ };
13
+ export declare const Pagination: {
14
+ readonly Basic: import("svelte").Component<PaginationRootProps, {}, "page">;
15
+ };
16
+ export type { PaginationEllipsisProps, PaginationItemProps, PaginationNextButtonProps, PaginationPrevButtonProps, PaginationRootProps, };
@@ -0,0 +1,16 @@
1
+ import Ellipsis, {} from './components/pagination.ellipsis.svelte';
2
+ import Item, {} from './components/pagination.item.svelte';
3
+ import NextButton, {} from './components/pagination.next-button.svelte';
4
+ import PrevButton, {} from './components/pagination.prev-button.svelte';
5
+ import Root, {} from './components/pagination.root.svelte';
6
+ import Basic from './presets/basic.svelte';
7
+ export const PaginationPrimitive = {
8
+ Root,
9
+ Item,
10
+ Ellipsis,
11
+ PrevButton,
12
+ NextButton,
13
+ };
14
+ export const Pagination = {
15
+ Basic,
16
+ };
@@ -0,0 +1,69 @@
1
+ <script lang="ts" module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import type { Parameters } from '@storybook/sveltekit';
4
+ import type { ComponentProps } from 'svelte';
5
+ import { Pagination, PaginationPrimitive } from './index.js';
6
+
7
+ const parameters: Parameters = {
8
+ controls: {
9
+ include: ['page', 'count', 'perPage', 'siblingCount', 'orientation', 'size', 'centered'],
10
+ },
11
+ };
12
+
13
+ const { Story } = defineMeta({
14
+ title: 'UI Kit/Pagination',
15
+ component: PaginationPrimitive.Root,
16
+ render: template,
17
+ tags: ['autodocs'],
18
+
19
+ argTypes: {
20
+ page: {
21
+ table: {
22
+ type: { summary: 'number | $bindable(number)' },
23
+ },
24
+ },
25
+ },
26
+
27
+ parameters,
28
+ });
29
+
30
+ type Args = ComponentProps<typeof PaginationPrimitive.Root>;
31
+
32
+ const args: Args = {
33
+ page: 1,
34
+ count: 100,
35
+ perPage: 10,
36
+ siblingCount: 1,
37
+ orientation: 'horizontal',
38
+ size: 'md',
39
+ centered: true,
40
+ };
41
+ </script>
42
+
43
+ {#snippet template(args: Args)}
44
+ <PaginationPrimitive.Root {...args}>
45
+ {#snippet children({ pages })}
46
+ <PaginationPrimitive.PrevButton />
47
+
48
+ {#each pages as page (page.key)}
49
+ {#if page.type === 'ellipsis'}
50
+ <PaginationPrimitive.Ellipsis />
51
+ {:else}
52
+ <PaginationPrimitive.Item {page}>
53
+ {page.value}
54
+ </PaginationPrimitive.Item>
55
+ {/if}
56
+ {/each}
57
+
58
+ <PaginationPrimitive.NextButton />
59
+ {/snippet}
60
+ </PaginationPrimitive.Root>
61
+ {/snippet}
62
+
63
+ <Story name="Primitive" {args} {parameters} />
64
+
65
+ <Story name="Basic Preset" {args} {parameters}>
66
+ {#snippet template(args: Args)}
67
+ <Pagination.Basic {...args} />
68
+ {/snippet}
69
+ </Story>
@@ -0,0 +1,19 @@
1
+ import { Pagination } 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 Pagination: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Pagination = InstanceType<typeof Pagination>;
19
+ export default Pagination;
@@ -0,0 +1,31 @@
1
+ <script lang="ts" module>
2
+ export type PaginationBasicProps = PaginationRootProps;
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import Ellipsis from '../components/pagination.ellipsis.svelte';
7
+ import Item from '../components/pagination.item.svelte';
8
+ import NextButton from '../components/pagination.next-button.svelte';
9
+ import PrevButton from '../components/pagination.prev-button.svelte';
10
+ import Root, { type PaginationRootProps } from '../components/pagination.root.svelte';
11
+
12
+ let { page = $bindable(1), ...restProps }: PaginationBasicProps = $props();
13
+ </script>
14
+
15
+ <Root bind:page {...restProps}>
16
+ {#snippet children({ pages })}
17
+ <PrevButton />
18
+
19
+ {#each pages as page (page.key)}
20
+ {#if page.type === 'ellipsis'}
21
+ <Ellipsis />
22
+ {:else}
23
+ <Item {page}>
24
+ {page.value}
25
+ </Item>
26
+ {/if}
27
+ {/each}
28
+
29
+ <NextButton />
30
+ {/snippet}
31
+ </Root>
@@ -0,0 +1,5 @@
1
+ export type PaginationBasicProps = PaginationRootProps;
2
+ import { type PaginationRootProps } from '../components/pagination.root.svelte';
3
+ declare const Basic: import("svelte").Component<PaginationRootProps, {}, "page">;
4
+ type Basic = ReturnType<typeof Basic>;
5
+ export default Basic;
@@ -0,0 +1 @@
1
+ export { default as Basic } from './basic.svelte';
@@ -0,0 +1 @@
1
+ export { default as Basic } from './basic.svelte';
@@ -0,0 +1,98 @@
1
+ import { Context } from 'runed';
2
+ import type { ReadableBox } from 'svelte-toolbelt';
3
+ import type { VariantProps } from 'tailwind-variants';
4
+ export declare const paginationStyles: import("tailwind-variants").TVReturnType<{
5
+ centered: {
6
+ true: {
7
+ root: string[];
8
+ };
9
+ };
10
+ orientation: {
11
+ horizontal: {
12
+ root: string[];
13
+ };
14
+ vertical: {
15
+ root: string[];
16
+ };
17
+ };
18
+ size: {
19
+ sm: {
20
+ item: string[];
21
+ };
22
+ md: {
23
+ item: string[];
24
+ };
25
+ lg: {
26
+ item: string[];
27
+ };
28
+ };
29
+ }, {
30
+ root: string[];
31
+ item: string[];
32
+ button: string[];
33
+ ellipsis: string[];
34
+ }, undefined, {
35
+ centered: {
36
+ true: {
37
+ root: string[];
38
+ };
39
+ };
40
+ orientation: {
41
+ horizontal: {
42
+ root: string[];
43
+ };
44
+ vertical: {
45
+ root: string[];
46
+ };
47
+ };
48
+ 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
+ };
69
+ };
70
+ orientation: {
71
+ horizontal: {
72
+ root: string[];
73
+ };
74
+ vertical: {
75
+ root: string[];
76
+ };
77
+ };
78
+ size: {
79
+ sm: {
80
+ item: string[];
81
+ };
82
+ md: {
83
+ item: string[];
84
+ };
85
+ lg: {
86
+ item: string[];
87
+ };
88
+ };
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 {};