@casinogate/ui 1.4.0 → 1.5.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 (121) hide show
  1. package/README.md +4 -9
  2. package/dist/assets/css/root.css +403 -21
  3. package/dist/assets/css/theme.css +38 -0
  4. package/dist/components/badge/badge.stories.svelte +81 -0
  5. package/dist/components/badge/badge.stories.svelte.d.ts +19 -0
  6. package/dist/components/badge/badge.svelte +30 -0
  7. package/dist/components/badge/badge.svelte.d.ts +4 -0
  8. package/dist/components/badge/exports.d.ts +1 -0
  9. package/dist/components/badge/exports.js +1 -0
  10. package/dist/components/badge/index.d.ts +2 -0
  11. package/dist/components/badge/index.js +1 -0
  12. package/dist/components/badge/styles.d.ts +99 -0
  13. package/dist/components/badge/styles.js +126 -0
  14. package/dist/components/badge/types.d.ts +8 -0
  15. package/dist/components/badge/types.js +1 -0
  16. package/dist/components/breadcrumb/breadcrumb.stories.svelte +60 -0
  17. package/dist/components/breadcrumb/breadcrumb.stories.svelte.d.ts +19 -0
  18. package/dist/components/breadcrumb/breadcrumb.svelte +32 -0
  19. package/dist/components/breadcrumb/breadcrumb.svelte.d.ts +4 -0
  20. package/dist/components/breadcrumb/components/breadcrumb.item.svelte +16 -0
  21. package/dist/components/breadcrumb/components/breadcrumb.item.svelte.d.ts +4 -0
  22. package/dist/components/breadcrumb/components/breadcrumb.link.svelte +29 -0
  23. package/dist/components/breadcrumb/components/breadcrumb.link.svelte.d.ts +4 -0
  24. package/dist/components/breadcrumb/components/breadcrumb.list.svelte +16 -0
  25. package/dist/components/breadcrumb/components/breadcrumb.list.svelte.d.ts +4 -0
  26. package/dist/components/breadcrumb/components/breadcrumb.page.svelte +19 -0
  27. package/dist/components/breadcrumb/components/breadcrumb.page.svelte.d.ts +4 -0
  28. package/dist/components/breadcrumb/components/breadcrumb.root.svelte +22 -0
  29. package/dist/components/breadcrumb/components/breadcrumb.root.svelte.d.ts +4 -0
  30. package/dist/components/breadcrumb/components/breadcrumb.separator.svelte +24 -0
  31. package/dist/components/breadcrumb/components/breadcrumb.separator.svelte.d.ts +4 -0
  32. package/dist/components/breadcrumb/exports-primitive.d.ts +6 -0
  33. package/dist/components/breadcrumb/exports-primitive.js +6 -0
  34. package/dist/components/breadcrumb/exports.d.ts +1 -0
  35. package/dist/components/breadcrumb/exports.js +1 -0
  36. package/dist/components/breadcrumb/index.d.ts +3 -0
  37. package/dist/components/breadcrumb/index.js +2 -0
  38. package/dist/components/breadcrumb/styles.d.ts +62 -0
  39. package/dist/components/breadcrumb/styles.js +18 -0
  40. package/dist/components/breadcrumb/types.d.ts +19 -0
  41. package/dist/components/breadcrumb/types.js +1 -0
  42. package/dist/components/icons/caret-down.svelte +3 -3
  43. package/dist/components/icons/caret-up.svelte +3 -3
  44. package/dist/components/icons/check.svelte +3 -3
  45. package/dist/components/icons/checkmark.svelte +12 -0
  46. package/dist/components/icons/checkmark.svelte.d.ts +3 -0
  47. package/dist/components/icons/chevron-down.svelte +3 -3
  48. package/dist/components/icons/chevron-left.svelte +3 -3
  49. package/dist/components/icons/chevron-right.svelte +3 -3
  50. package/dist/components/icons/chevron-small-down.svelte +3 -3
  51. package/dist/components/icons/chevron-small-left.svelte +3 -3
  52. package/dist/components/icons/chevron-small-right.svelte +3 -3
  53. package/dist/components/icons/chevron-small-up.svelte +3 -3
  54. package/dist/components/icons/chevron-up.svelte +3 -3
  55. package/dist/components/icons/dots.svelte +5 -5
  56. package/dist/components/icons/error.svelte +3 -3
  57. package/dist/components/icons/exports.d.ts +2 -0
  58. package/dist/components/icons/exports.js +2 -0
  59. package/dist/components/icons/eye-crossed.svelte +3 -3
  60. package/dist/components/icons/eye.svelte +3 -3
  61. package/dist/components/icons/info.svelte +3 -3
  62. package/dist/components/icons/minus.svelte +3 -3
  63. package/dist/components/icons/sidebar-toggle.svelte +4 -4
  64. package/dist/components/icons/slash.svelte +9 -0
  65. package/dist/components/icons/slash.svelte.d.ts +3 -0
  66. package/dist/components/icons/sort.svelte +4 -4
  67. package/dist/components/icons/spinner.svelte +3 -3
  68. package/dist/components/icons/success.svelte +3 -3
  69. package/dist/components/icons/warning.svelte +3 -3
  70. package/dist/components/index.d.ts +2 -0
  71. package/dist/components/index.js +2 -0
  72. package/dist/components/navigation/components/navigation.content.svelte +2 -2
  73. package/dist/components/navigation/components/navigation.root.svelte +2 -0
  74. package/dist/components/navigation/components/navigation.sub-content.svelte +12 -5
  75. package/dist/components/navigation/components/navigation.svelte.d.ts +2 -0
  76. package/dist/components/navigation/navigation.stories.svelte +5 -5
  77. package/dist/components/navigation/styles.js +1 -2
  78. package/dist/components/navigation/types.d.ts +7 -1
  79. package/dist/components/popover/styles.d.ts +3 -3
  80. package/dist/components/popover/styles.js +1 -1
  81. package/dist/components/select/components/select.content.svelte +31 -0
  82. package/dist/components/select/components/select.content.svelte.d.ts +3 -25
  83. package/dist/components/select/components/select.group-heading.svelte +19 -0
  84. package/dist/components/select/components/select.group-heading.svelte.d.ts +4 -0
  85. package/dist/components/select/components/select.group.svelte +8 -0
  86. package/dist/components/select/components/select.group.svelte.d.ts +4 -0
  87. package/dist/components/select/components/select.item.svelte +38 -0
  88. package/dist/components/select/components/select.item.svelte.d.ts +3 -25
  89. package/dist/components/select/components/select.portal.svelte +10 -0
  90. package/dist/components/select/components/select.portal.svelte.d.ts +3 -0
  91. package/dist/components/select/components/select.trigger.svelte +28 -27
  92. package/dist/components/select/components/select.viewport.svelte +24 -0
  93. package/dist/components/select/components/select.viewport.svelte.d.ts +3 -25
  94. package/dist/components/select/exports-primitive.d.ts +6 -0
  95. package/dist/components/select/exports-primitive.js +6 -0
  96. package/dist/components/select/exports.d.ts +1 -0
  97. package/dist/components/select/exports.js +1 -0
  98. package/dist/components/select/index.d.ts +2 -1
  99. package/dist/components/select/index.js +1 -0
  100. package/dist/components/select/select.stories.svelte +178 -15
  101. package/dist/components/select/select.stories.svelte.d.ts +3 -17
  102. package/dist/components/select/select.svelte +141 -0
  103. package/dist/components/select/select.svelte.d.ts +4 -0
  104. package/dist/components/select/styles.d.ts +15 -3
  105. package/dist/components/select/styles.js +24 -8
  106. package/dist/components/select/types.d.ts +42 -4
  107. package/dist/components/textarea/exports.d.ts +1 -0
  108. package/dist/components/textarea/exports.js +1 -0
  109. package/dist/components/textarea/index.d.ts +2 -0
  110. package/dist/components/textarea/index.js +1 -0
  111. package/dist/components/textarea/styles.d.ts +54 -0
  112. package/dist/components/textarea/styles.js +39 -0
  113. package/dist/components/textarea/textarea.stories.svelte +36 -0
  114. package/dist/components/textarea/textarea.stories.svelte.d.ts +19 -0
  115. package/dist/components/textarea/textarea.svelte +22 -0
  116. package/dist/components/textarea/textarea.svelte.d.ts +4 -0
  117. package/dist/components/textarea/types.d.ts +6 -0
  118. package/dist/components/textarea/types.js +1 -0
  119. package/dist/internal/types/html-attributes.d.ts +2 -1
  120. package/dist/internal/utils/tailwindcss.js +16 -0
  121. package/package.json +2 -1
@@ -55,6 +55,7 @@
55
55
  --color-fg-white: var(--cg-ui-palette-neutral-0);
56
56
  --color-fg-error: var(--cg-ui-palette-system-error-100);
57
57
  --color-fg-success: var(--cg-ui-palette-system-success-100);
58
+ --color-fg-warning: var(--cg-ui-palette-system-warning-100);
58
59
 
59
60
  /* Stroke */
60
61
  --color-stroke-default: var(--cg-ui-palette-neutral-40);
@@ -120,6 +121,7 @@
120
121
  --shadow-switch-thumb: var(--cg-ui-shadow-switch-thumb);
121
122
  --shadow-segment-thumb: var(--cg-ui-shadow-segment-item);
122
123
  --shadow-popover: var(--cg-ui-shadow-popover);
124
+ --shadow-select: var(--cg-ui-shadow-select);
123
125
 
124
126
  /* Font sizes, Line heights */
125
127
  --text-heading: var(--cg-ui-fz-heading);
@@ -200,6 +202,7 @@
200
202
  --cg-ui-shadow-switch-thumb: 0px 1px 1px 0px hsla(0, 0%, 0%, 0.25);
201
203
  --cg-ui-shadow-segment-item: 0px 0px 4px 0px hsla(0, 0%, 0%, 0.1);
202
204
  --cg-ui-shadow-popover: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
205
+ --cg-ui-shadow-select: 0px 2px 8px 0px hsla(0, 0%, 0%, 0.25);
203
206
 
204
207
  /* Font sizes, Line heights */
205
208
  --cg-ui-fz-base: 16;
@@ -221,6 +224,41 @@
221
224
 
222
225
  --cg-ui-fz-caption-2: calc(12 / var(--cg-ui-fz-base) * 1rem);
223
226
  --cg-ui-lh-caption-2: calc(16 / var(--cg-ui-fz-base) * 1rem);
227
+
228
+ /* Z-index */
229
+ --cg-ui-z-index-base: 0;
230
+ --cg-ui-z-index-content: 1;
231
+
232
+ /* Sticky/Fixed elements */
233
+ --cg-ui-z-index-sticky: 10;
234
+ --cg-ui-z-index-fixed: 20;
235
+
236
+ /* Interactive overlays (low priority) */
237
+ --cg-ui-z-index-dropdown: 50;
238
+ --cg-ui-z-index-select: 50;
239
+
240
+ /* Interactive overlays (medium priority) */
241
+ --cg-ui-z-index-popover: 100;
242
+ --cg-ui-z-index-collapsible: 100;
243
+
244
+ /* Tooltips */
245
+ --cg-ui-z-index-tooltip: 200;
246
+
247
+ /* Navigation (if floating/overlay) */
248
+ --cg-ui-z-index-navigation: 250;
249
+
250
+ /* Modals & Dialogs */
251
+ --cg-ui-z-index-modal: 300;
252
+ --cg-ui-z-index-dialog: 300;
253
+ --cg-ui-z-index-backdrop: 300;
254
+
255
+ /* Notifications & Toasts */
256
+ --cg-ui-z-index-toast: 400;
257
+ --cg-ui-z-index-notification: 400;
258
+
259
+ /* Critical UI (highest priority) */
260
+ --cg-ui-z-index-critical: 500;
261
+ --cg-ui-z-index-loading: 500;
224
262
  }
225
263
 
226
264
  .dark,
@@ -0,0 +1,81 @@
1
+ <script lang="ts" module>
2
+ import { Icon } from '../icons/index.js';
3
+ import { defineMeta } from '@storybook/addon-svelte-csf';
4
+ import type { Parameters } from '@storybook/sveltekit';
5
+ import type { ComponentProps } from 'svelte';
6
+ import { Badge } from './index.js';
7
+
8
+ const parameters: Parameters = {
9
+ controls: {
10
+ include: ['variant', 'rounded', 'color', 'size', 'disabled'],
11
+ },
12
+ };
13
+
14
+ const { Story } = defineMeta({
15
+ title: 'UI Kit/Badge',
16
+ component: Badge.Root,
17
+ tags: ['autodocs'],
18
+ parameters,
19
+ });
20
+
21
+ type Args = ComponentProps<typeof Badge.Root>;
22
+
23
+ const args: Args = {
24
+ rounded: 'full',
25
+ variant: 'fill',
26
+ color: 'neutral',
27
+ size: 'xs',
28
+ disabled: false,
29
+ };
30
+ </script>
31
+
32
+ <Story name="Basic" {args} {parameters}>
33
+ {#snippet template(args: Args)}
34
+ <Badge.Root {...args}>Badge</Badge.Root>
35
+ {/snippet}
36
+ </Story>
37
+
38
+ <Story name="Variants" {args} {parameters}>
39
+ {#snippet template(args: Args)}
40
+ <div class="cgui:flex cgui:gap-2 cgui:flex-col cgui:items-center">
41
+ <div class="cgui:flex cgui:gap-2 cgui:flex-wrap cgui:w-full">
42
+ <Badge.Root {...args} variant="fill">Badge</Badge.Root>
43
+ <Badge.Root {...args} variant="fill" color="destructive">Destructive</Badge.Root>
44
+ <Badge.Root {...args} variant="fill" color="warning">Warning</Badge.Root>
45
+ <Badge.Root {...args} variant="fill" color="success">Success</Badge.Root>
46
+ <Badge.Root {...args} variant="fill" color="info">Info</Badge.Root>
47
+ </div>
48
+
49
+ <div class="cgui:flex cgui:gap-2 cgui:flex-wrap cgui:w-full">
50
+ <Badge.Root {...args} variant="outline">Badge</Badge.Root>
51
+ <Badge.Root {...args} variant="outline" color="destructive">Destructive</Badge.Root>
52
+ <Badge.Root {...args} variant="outline" color="warning">Warning</Badge.Root>
53
+ <Badge.Root {...args} variant="outline" color="success">Success</Badge.Root>
54
+ <Badge.Root {...args} variant="outline" color="info">Info</Badge.Root>
55
+ </div>
56
+
57
+ <div class="cgui:flex cgui:gap-2 cgui:flex-wrap cgui:w-full">
58
+ <Badge.Root {...args} variant="soft">Badge</Badge.Root>
59
+ <Badge.Root {...args} variant="soft" color="destructive">Destructive</Badge.Root>
60
+ <Badge.Root {...args} variant="soft" color="warning">Warning</Badge.Root>
61
+ <Badge.Root {...args} variant="soft" color="success">Success</Badge.Root>
62
+ <Badge.Root {...args} variant="soft" color="info">Info</Badge.Root>
63
+ </div>
64
+ </div>
65
+ {/snippet}
66
+ </Story>
67
+
68
+ <Story name="Link" {args} {parameters}>
69
+ {#snippet template(args: Args)}
70
+ <Badge.Root {...args} variant="fill" color="neutral" href="https://www.google.com">GOOGLE</Badge.Root>
71
+ {/snippet}
72
+ </Story>
73
+
74
+ <Story name="With Icon" {args} {parameters}>
75
+ {#snippet template(args: Args)}
76
+ <Badge.Root {...args}>
77
+ GOOGLE
78
+ <Icon.Info />
79
+ </Badge.Root>
80
+ {/snippet}
81
+ </Story>
@@ -0,0 +1,19 @@
1
+ import { Badge } 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 Badge: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Badge = InstanceType<typeof Badge>;
19
+ export default Badge;
@@ -0,0 +1,30 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../internal/utils/common.js';
3
+ import { badgeVariants } from './styles.js';
4
+ import type { BadgeProps } from './types.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ href,
10
+ children,
11
+ as = 'span',
12
+ variant = 'fill',
13
+ color = 'neutral',
14
+ rounded = 'full',
15
+ size = 'xs',
16
+ disabled = false,
17
+ ...restProps
18
+ }: BadgeProps = $props();
19
+ </script>
20
+
21
+ <svelte:element
22
+ this={href ? 'a' : as}
23
+ bind:this={ref}
24
+ class={cn(badgeVariants({ variant, color, rounded, size, disabled }), className)}
25
+ {href}
26
+ data-slot="badge"
27
+ {...restProps}
28
+ >
29
+ {@render children?.()}
30
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { BadgeProps } from './types.js';
2
+ declare const Badge: import("svelte").Component<BadgeProps, {}, "ref">;
3
+ type Badge = ReturnType<typeof Badge>;
4
+ export default Badge;
@@ -0,0 +1 @@
1
+ export { default as Root } from './badge.svelte';
@@ -0,0 +1 @@
1
+ export { default as Root } from './badge.svelte';
@@ -0,0 +1,2 @@
1
+ export * as Badge from './exports.js';
2
+ export type { BadgeProps } from './types.js';
@@ -0,0 +1 @@
1
+ export * as Badge from './exports.js';
@@ -0,0 +1,99 @@
1
+ import type { VariantProps } from 'tailwind-variants';
2
+ export declare const badgeVariants: import("tailwind-variants").TVReturnType<{
3
+ variant: {
4
+ fill: never[];
5
+ outline: string[];
6
+ soft: string[];
7
+ };
8
+ color: {
9
+ neutral: never[];
10
+ destructive: never[];
11
+ warning: never[];
12
+ success: never[];
13
+ info: never[];
14
+ };
15
+ rounded: {
16
+ none: never[];
17
+ xs: string[];
18
+ sm: string[];
19
+ md: string[];
20
+ lg: string[];
21
+ xl: string[];
22
+ full: string[];
23
+ };
24
+ size: {
25
+ xs: string[];
26
+ sm: string[];
27
+ md: string[];
28
+ lg: string[];
29
+ xl: string[];
30
+ };
31
+ disabled: {
32
+ true: string[];
33
+ };
34
+ }, undefined, string[], {
35
+ variant: {
36
+ fill: never[];
37
+ outline: string[];
38
+ soft: string[];
39
+ };
40
+ color: {
41
+ neutral: never[];
42
+ destructive: never[];
43
+ warning: never[];
44
+ success: never[];
45
+ info: never[];
46
+ };
47
+ rounded: {
48
+ none: never[];
49
+ xs: string[];
50
+ sm: string[];
51
+ md: string[];
52
+ lg: string[];
53
+ xl: string[];
54
+ full: string[];
55
+ };
56
+ size: {
57
+ xs: string[];
58
+ sm: string[];
59
+ md: string[];
60
+ lg: string[];
61
+ xl: string[];
62
+ };
63
+ disabled: {
64
+ true: string[];
65
+ };
66
+ }, undefined, import("tailwind-variants").TVReturnType<{
67
+ variant: {
68
+ fill: never[];
69
+ outline: string[];
70
+ soft: string[];
71
+ };
72
+ color: {
73
+ neutral: never[];
74
+ destructive: never[];
75
+ warning: never[];
76
+ success: never[];
77
+ info: never[];
78
+ };
79
+ rounded: {
80
+ none: never[];
81
+ xs: string[];
82
+ sm: string[];
83
+ md: string[];
84
+ lg: string[];
85
+ xl: string[];
86
+ full: string[];
87
+ };
88
+ size: {
89
+ xs: string[];
90
+ sm: string[];
91
+ md: string[];
92
+ lg: string[];
93
+ xl: string[];
94
+ };
95
+ disabled: {
96
+ true: string[];
97
+ };
98
+ }, undefined, string[], unknown, unknown, undefined>>;
99
+ export type BadgeVariants = VariantProps<typeof badgeVariants>;
@@ -0,0 +1,126 @@
1
+ import { tv } from '../../internal/utils/tailwindcss.js';
2
+ export const badgeVariants = tv({
3
+ base: [
4
+ 'cgui:inline-flex cgui:items-center cgui:justify-center cgui:gap-1 cgui:text-center cgui:overflow-hidden cgui:shrink-0 cgui:w-fit cgui:whitespace-nowrap',
5
+ 'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
6
+ 'cgui:select-none cgui:font-normal cgui:text-caption-2',
7
+ 'cgui:[&>svg]:pointer-events-none',
8
+ ],
9
+ variants: {
10
+ variant: {
11
+ fill: [],
12
+ outline: ['cgui:border'],
13
+ soft: ['cgui:border'],
14
+ },
15
+ color: {
16
+ neutral: [],
17
+ destructive: [],
18
+ warning: [],
19
+ success: [],
20
+ info: [],
21
+ },
22
+ rounded: {
23
+ none: [],
24
+ xs: ['cgui:rounded-xs'],
25
+ sm: ['cgui:rounded-sm'],
26
+ md: ['cgui:rounded-md'],
27
+ lg: ['cgui:rounded-lg'],
28
+ xl: ['cgui:rounded-xl'],
29
+ full: ['cgui:rounded-full'],
30
+ },
31
+ size: {
32
+ xs: ['cgui:text-caption-2', 'cgui:px-1.5 cgui:py-0.5', 'cgui:[&>svg]:size-5'],
33
+ sm: ['cgui:text-caption', 'cgui:px-2 cgui:py-0.5', 'cgui:[&>svg]:size-5.5'],
34
+ md: ['cgui:text-body-2', 'cgui:px-2.5 cgui:py-0.5', 'cgui:[&>svg]:size-6'],
35
+ lg: ['cgui:text-body', 'cgui:px-3 cgui:py-1', 'cgui:[&>svg]:size-6.5'],
36
+ xl: ['cgui:text-heading-2', 'cgui:px-3.5 cgui:py-1', 'cgui:[&>svg]:size-7'],
37
+ },
38
+ disabled: {
39
+ true: ['cgui:opacity-50 cgui:cursor-not-allowed'],
40
+ },
41
+ },
42
+ compoundVariants: [
43
+ {
44
+ variant: 'fill',
45
+ color: 'neutral',
46
+ class: ['cgui:bg-surface-light cgui:text-fg-darkest'],
47
+ },
48
+ {
49
+ variant: 'soft',
50
+ color: 'neutral',
51
+ class: ['cgui:bg-surface-light/50 cgui:border-stroke-default cgui:text-fg-darkest'],
52
+ },
53
+ {
54
+ variant: 'outline',
55
+ color: 'neutral',
56
+ class: ['cgui:bg-transparent cgui:border-stroke-default cgui:text-fg-darkest'],
57
+ },
58
+ {
59
+ variant: 'fill',
60
+ color: 'destructive',
61
+ class: ['cgui:bg-state-error cgui:text-fg-white'],
62
+ },
63
+ {
64
+ variant: 'soft',
65
+ color: 'destructive',
66
+ class: ['cgui:bg-state-error-light cgui:border-stroke-error cgui:text-fg-error'],
67
+ },
68
+ {
69
+ variant: 'outline',
70
+ color: 'destructive',
71
+ class: ['cgui:bg-transparent cgui:border-stroke-error cgui:text-fg-error'],
72
+ },
73
+ {
74
+ variant: 'fill',
75
+ color: 'warning',
76
+ class: ['cgui:bg-state-warning cgui:text-fg-white'],
77
+ },
78
+ {
79
+ variant: 'soft',
80
+ color: 'warning',
81
+ class: ['cgui:bg-state-warning-light cgui:border-stroke-warning cgui:text-fg-warning'],
82
+ },
83
+ {
84
+ variant: 'outline',
85
+ color: 'warning',
86
+ class: ['cgui:bg-transparent cgui:border-stroke-warning cgui:text-fg-warning'],
87
+ },
88
+ {
89
+ variant: 'fill',
90
+ color: 'success',
91
+ class: ['cgui:bg-state-success cgui:text-fg-white'],
92
+ },
93
+ {
94
+ variant: 'soft',
95
+ color: 'success',
96
+ class: ['cgui:bg-state-success-light cgui:border-stroke-success cgui:text-fg-success'],
97
+ },
98
+ {
99
+ variant: 'outline',
100
+ color: 'success',
101
+ class: ['cgui:bg-transparent cgui:border-stroke-success cgui:text-fg-success'],
102
+ },
103
+ {
104
+ variant: 'fill',
105
+ color: 'info',
106
+ class: ['cgui:bg-state-info cgui:text-fg-white'],
107
+ },
108
+ {
109
+ variant: 'soft',
110
+ color: 'info',
111
+ class: ['cgui:bg-state-info-light cgui:border-stroke-info cgui:text-fg-info'],
112
+ },
113
+ {
114
+ variant: 'outline',
115
+ color: 'info',
116
+ class: ['cgui:bg-transparent cgui:border-stroke-info cgui:text-fg-info'],
117
+ },
118
+ ],
119
+ defaultVariants: {
120
+ variant: 'fill',
121
+ color: 'neutral',
122
+ rounded: 'full',
123
+ size: 'xs',
124
+ disabled: false,
125
+ },
126
+ });
@@ -0,0 +1,8 @@
1
+ import type { PrimitiveAnchorAttributes } from '../../internal/types/html-attributes.js';
2
+ import type { WithChildren, WithElementRef, Without } from 'svelte-toolbelt';
3
+ import type { BadgeVariants } from './styles.js';
4
+ type BadgePropsWithoutHTML = WithElementRef<WithChildren<{
5
+ as?: keyof HTMLElementTagNameMap;
6
+ }>> & BadgeVariants;
7
+ export type BadgeProps = BadgePropsWithoutHTML & Without<PrimitiveAnchorAttributes, BadgePropsWithoutHTML>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,60 @@
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 BreadcrumbRoot from './components/breadcrumb.root.svelte';
6
+ import { Breadcrumb, BreadcrumbPrimitive } from './index.js';
7
+
8
+ const parameters: Parameters = {
9
+ controls: {
10
+ include: [],
11
+ },
12
+ };
13
+
14
+ const { Story } = defineMeta({
15
+ title: 'UI Kit/Breadcrumb',
16
+ component: BreadcrumbRoot,
17
+ tags: ['autodocs'],
18
+ parameters,
19
+ });
20
+
21
+ type Args = ComponentProps<typeof BreadcrumbRoot>;
22
+
23
+ const args: Args = {};
24
+ </script>
25
+
26
+ <Story name="Primitive" {args} {parameters}>
27
+ {#snippet template(args: Args)}
28
+ <BreadcrumbPrimitive.Root {...args}>
29
+ <BreadcrumbPrimitive.List>
30
+ <BreadcrumbPrimitive.Item>
31
+ <BreadcrumbPrimitive.Link href="#">Home</BreadcrumbPrimitive.Link>
32
+ </BreadcrumbPrimitive.Item>
33
+ <BreadcrumbPrimitive.Separator />
34
+ <BreadcrumbPrimitive.Item>
35
+ <BreadcrumbPrimitive.Link href="#">Home 2</BreadcrumbPrimitive.Link>
36
+ </BreadcrumbPrimitive.Item>
37
+ <BreadcrumbPrimitive.Separator />
38
+ <BreadcrumbPrimitive.Item>
39
+ <BreadcrumbPrimitive.Link href="#">Home 3</BreadcrumbPrimitive.Link>
40
+ </BreadcrumbPrimitive.Item>
41
+ <BreadcrumbPrimitive.Separator />
42
+ <BreadcrumbPrimitive.Item>
43
+ <BreadcrumbPrimitive.Page>Home 4</BreadcrumbPrimitive.Page>
44
+ </BreadcrumbPrimitive.Item>
45
+ </BreadcrumbPrimitive.List>
46
+ </BreadcrumbPrimitive.Root>
47
+ {/snippet}
48
+ </Story>
49
+
50
+ <Story name="Preset" {args} {parameters}>
51
+ {#snippet template(args: Args)}
52
+ <Breadcrumb.Root {...args} path="Home/Home 2/Home 3/Home 4" />
53
+ {/snippet}
54
+ </Story>
55
+
56
+ <Story name="Preset With Array Path" {args} {parameters}>
57
+ {#snippet template(args: Args)}
58
+ <Breadcrumb.Root {...args} path={['Home', 'Home 2', 'Home 3', 'Home 4']} />
59
+ {/snippet}
60
+ </Story>
@@ -0,0 +1,19 @@
1
+ import { Breadcrumb } 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 Breadcrumb: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Breadcrumb = InstanceType<typeof Breadcrumb>;
19
+ export default Breadcrumb;
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import Item from './components/breadcrumb.item.svelte';
3
+ import Link from './components/breadcrumb.link.svelte';
4
+ import List from './components/breadcrumb.list.svelte';
5
+ import Page from './components/breadcrumb.page.svelte';
6
+ import Root from './components/breadcrumb.root.svelte';
7
+ import Separator from './components/breadcrumb.separator.svelte';
8
+ import type { BreadcrumbProps } from './types.js';
9
+
10
+ let { children, ref = $bindable(null), path, ...restProps }: BreadcrumbProps = $props();
11
+
12
+ const items = $derived(Array.isArray(path) ? path : path.split('/').filter(Boolean));
13
+ </script>
14
+
15
+ <Root bind:ref {...restProps}>
16
+ <List>
17
+ {#each items as item, idx}
18
+ {@const isLast = idx === items.length - 1}
19
+
20
+ {#if isLast}
21
+ <Item>
22
+ <Page>{item}</Page>
23
+ </Item>
24
+ {:else}
25
+ <Item>
26
+ <Link href={item}>{item}</Link>
27
+ </Item>
28
+ <Separator />
29
+ {/if}
30
+ {/each}
31
+ </List>
32
+ </Root>
@@ -0,0 +1,4 @@
1
+ import type { BreadcrumbProps } from './types.js';
2
+ declare const Breadcrumb: import("svelte").Component<BreadcrumbProps, {}, "ref">;
3
+ type Breadcrumb = ReturnType<typeof Breadcrumb>;
4
+ export default Breadcrumb;
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { BreadcrumbStylesContext } from '../styles.js';
4
+ import type { BreadcrumbItemProps } from '../types.js';
5
+
6
+ let { ref = $bindable(null), class: className, children, ...restProps }: BreadcrumbItemProps = $props();
7
+ </script>
8
+
9
+ <li
10
+ bind:this={ref}
11
+ data-slot="breadcrumb-item"
12
+ class={cn(BreadcrumbStylesContext.get().current.item(), className)}
13
+ {...restProps}
14
+ >
15
+ {@render children?.()}
16
+ </li>
@@ -0,0 +1,4 @@
1
+ import type { BreadcrumbItemProps } from '../types.js';
2
+ declare const Breadcrumb: import("svelte").Component<BreadcrumbItemProps, {}, "ref">;
3
+ type Breadcrumb = ReturnType<typeof Breadcrumb>;
4
+ export default Breadcrumb;
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { BreadcrumbStylesContext } from '../styles.js';
4
+ import type { BreadcrumbLinkProps } from '../types.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ href = undefined,
10
+ child,
11
+ children,
12
+ ...restProps
13
+ }: BreadcrumbLinkProps = $props();
14
+
15
+ const attrs = $derived({
16
+ 'data-slot': 'breadcrumb-link',
17
+ class: cn(BreadcrumbStylesContext.get().current.link(), className),
18
+ href,
19
+ ...restProps,
20
+ });
21
+ </script>
22
+
23
+ {#if child}
24
+ {@render child({ props: attrs })}
25
+ {:else}
26
+ <a bind:this={ref} {...attrs}>
27
+ {@render children?.()}
28
+ </a>
29
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { BreadcrumbLinkProps } from '../types.js';
2
+ declare const Breadcrumb: import("svelte").Component<BreadcrumbLinkProps, {}, "ref">;
3
+ type Breadcrumb = ReturnType<typeof Breadcrumb>;
4
+ export default Breadcrumb;
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { BreadcrumbStylesContext } from '../styles.js';
4
+ import type { BreadcrumbListProps } from '../types.js';
5
+
6
+ let { ref = $bindable(null), class: className, children, ...restProps }: BreadcrumbListProps = $props();
7
+ </script>
8
+
9
+ <ol
10
+ bind:this={ref}
11
+ data-slot="breadcrumb-list"
12
+ class={cn(BreadcrumbStylesContext.get().current.list(), className)}
13
+ {...restProps}
14
+ >
15
+ {@render children?.()}
16
+ </ol>
@@ -0,0 +1,4 @@
1
+ import type { BreadcrumbListProps } from '../types.js';
2
+ declare const Breadcrumb: import("svelte").Component<BreadcrumbListProps, {}, "ref">;
3
+ type Breadcrumb = ReturnType<typeof Breadcrumb>;
4
+ export default Breadcrumb;