@casinogate/ui 1.0.1 → 1.1.1

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 (50) hide show
  1. package/dist/assets/css/root.css +183 -5
  2. package/dist/components/button-group/button-group.stories.svelte +59 -0
  3. package/dist/components/button-group/button-group.stories.svelte.d.ts +19 -0
  4. package/dist/components/button-group/components/button-group.root.svelte +35 -0
  5. package/dist/components/button-group/components/button-group.root.svelte.d.ts +8 -0
  6. package/dist/components/button-group/components/button-group.separator.svelte +24 -0
  7. package/dist/components/button-group/components/button-group.separator.svelte.d.ts +13 -0
  8. package/dist/components/button-group/index.d.ts +16 -0
  9. package/dist/components/button-group/index.js +6 -0
  10. package/dist/components/button-group/styles.d.ts +47 -0
  11. package/dist/components/button-group/styles.js +27 -0
  12. package/dist/components/data-table/components/data-table.svelte.js +1 -1
  13. package/dist/components/field/components/field.control.svelte +24 -0
  14. package/dist/components/field/components/field.control.svelte.d.ts +10 -0
  15. package/dist/components/field/components/field.description.svelte +47 -0
  16. package/dist/components/field/components/field.description.svelte.d.ts +7 -0
  17. package/dist/components/field/components/field.error.svelte +49 -0
  18. package/dist/components/field/components/field.error.svelte.d.ts +7 -0
  19. package/dist/components/field/components/field.label.svelte +49 -0
  20. package/dist/components/field/components/field.label.svelte.d.ts +7 -0
  21. package/dist/components/field/components/field.root.svelte +63 -0
  22. package/dist/components/field/components/field.root.svelte.d.ts +12 -0
  23. package/dist/components/field/components/field.svelte.d.ts +83 -0
  24. package/dist/components/field/components/field.svelte.js +121 -0
  25. package/dist/components/field/field.stories.svelte +51 -0
  26. package/dist/components/field/field.stories.svelte.d.ts +19 -0
  27. package/dist/components/field/field.svelte +47 -0
  28. package/dist/components/field/field.svelte.d.ts +14 -0
  29. package/dist/components/field/index.d.ts +14 -0
  30. package/dist/components/field/index.js +14 -0
  31. package/dist/components/field/styles.d.ts +50 -0
  32. package/dist/components/field/styles.js +12 -0
  33. package/dist/components/input/input.svelte +1 -1
  34. package/dist/components/separator/index.d.ts +5 -0
  35. package/dist/components/separator/index.js +4 -0
  36. package/dist/components/separator/separator.stories.svelte +44 -0
  37. package/dist/components/separator/separator.stories.svelte.d.ts +19 -0
  38. package/dist/components/separator/separator.svelte +21 -0
  39. package/dist/components/separator/separator.svelte.d.ts +5 -0
  40. package/dist/components/skeleton/skeleton.stories.svelte +9 -1
  41. package/dist/components/skeleton/skeleton.svelte +8 -2
  42. package/dist/components/skeleton/skeleton.svelte.d.ts +3 -1
  43. package/dist/components/toast/index.d.ts +1 -0
  44. package/dist/components/toast/index.js +1 -0
  45. package/dist/index.d.ts +4 -0
  46. package/dist/index.js +4 -0
  47. package/dist/internal/constants/attrs.d.ts +1 -0
  48. package/dist/internal/constants/attrs.js +1 -0
  49. package/dist/internal/types/html-attributes.d.ts +1 -0
  50. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import { keyWithPrefix } from '../../internal/utils/common.js';
2
+ import { tv } from '../../internal/utils/tailwindcss.js';
3
+ import { Context } from 'runed';
4
+ export const fieldStyles = tv({
5
+ slots: {
6
+ root: 'cgui:flex cgui:flex-col cgui:gap-1',
7
+ label: 'cgui:text-fg-medium cgui:text-caption cgui:font-medium',
8
+ error: 'cgui:text-caption cgui:text-fg-error',
9
+ description: 'cgui:text-caption cgui:text-fg-medium',
10
+ },
11
+ });
12
+ export const FieldStylesContext = new Context(keyWithPrefix('field-styles'));
@@ -45,10 +45,10 @@
45
45
  {/if}
46
46
 
47
47
  <input
48
+ {id}
48
49
  bind:this={ref}
49
50
  data-start-chevron={getDataActive(Boolean(startChevron))}
50
51
  data-end-chevron={getDataActive(Boolean(endChevron))}
51
- {id}
52
52
  data-slot="input"
53
53
  class={cn(variants.input(), className)}
54
54
  {...restProps}
@@ -0,0 +1,5 @@
1
+ import { type SeparatorProps } from './separator.svelte';
2
+ export declare const Separator: {
3
+ Root: import("svelte").Component<import("bits-ui").SeparatorRootProps, {}, "ref">;
4
+ };
5
+ export type { SeparatorProps };
@@ -0,0 +1,4 @@
1
+ import Root, {} from './separator.svelte';
2
+ export const Separator = {
3
+ Root,
4
+ };
@@ -0,0 +1,44 @@
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 Separator from './separator.svelte';
6
+
7
+ const parameters: Parameters = {
8
+ controls: {
9
+ include: ['orientation'],
10
+ },
11
+ };
12
+
13
+ const { Story } = defineMeta({
14
+ title: 'UI Kit/Separator',
15
+ component: Separator,
16
+ tags: ['autodocs'],
17
+ parameters,
18
+ });
19
+
20
+ type Args = ComponentProps<typeof Separator>;
21
+
22
+ const args: Args = {
23
+ orientation: 'horizontal',
24
+ };
25
+ </script>
26
+
27
+ <Story name="Basic" {args} {parameters}>
28
+ {#snippet template()}
29
+ <div>
30
+ <div class="cgui:space-y-1">
31
+ <h4 class="cgui:text-sm cgui:font-medium cgui:leading-none">CG UI</h4>
32
+ <p class="cgui:text-fg-semilight cgui:text-sm">Labore minim aliquip dolore ullamco sit laboris.</p>
33
+ </div>
34
+ <Separator class="cgui:my-4" />
35
+ <div class="cgui:flex cgui:h-5 cgui:items-center cgui:space-x-4 cgui:text-sm">
36
+ <div>Blog</div>
37
+ <Separator orientation="vertical" />
38
+ <div>Docs</div>
39
+ <Separator orientation="vertical" />
40
+ <div>Source</div>
41
+ </div>
42
+ </div>
43
+ {/snippet}
44
+ </Story>
@@ -0,0 +1,19 @@
1
+ import Separator from './separator.svelte';
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 Separator: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Separator = InstanceType<typeof Separator>;
19
+ export default Separator;
@@ -0,0 +1,21 @@
1
+ <script lang="ts" module>
2
+ export type SeparatorProps = SeparatorPrimitive.RootProps;
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import { SLOT_ATTR_NAME } from '../../internal/constants/attrs.js';
7
+ import { cn } from '../../internal/utils/common.js';
8
+ import { Separator as SeparatorPrimitive } from 'bits-ui';
9
+
10
+ let { ref = $bindable(null), class: className, ...restProps }: SeparatorProps = $props();
11
+ </script>
12
+
13
+ <SeparatorPrimitive.Root
14
+ bind:ref
15
+ class={cn(
16
+ 'cgui:bg-stroke-divider cgui:shrink-0 cgui:data-[orientation=horizontal]:h-px cgui:data-[orientation=vertical]:h-full cgui:data-[orientation=horizontal]:w-full cgui:data-[orientation=vertical]:w-px',
17
+ className
18
+ )}
19
+ {...{ [SLOT_ATTR_NAME]: 'separator' }}
20
+ {...restProps}
21
+ />
@@ -0,0 +1,5 @@
1
+ export type SeparatorProps = SeparatorPrimitive.RootProps;
2
+ import { Separator as SeparatorPrimitive } from 'bits-ui';
3
+ declare const Separator: import("svelte").Component<SeparatorPrimitive.RootProps, {}, "ref">;
4
+ type Separator = ReturnType<typeof Separator>;
5
+ export default Separator;
@@ -6,7 +6,7 @@
6
6
 
7
7
  const parameters: Parameters = {
8
8
  controls: {
9
- include: ['rounded', 'w', 'variant'],
9
+ include: ['rounded', 'w', 'variant', 'count'],
10
10
  },
11
11
  };
12
12
 
@@ -54,6 +54,14 @@
54
54
  {parameters}
55
55
  />
56
56
 
57
+ <Story name="Count" {args} {parameters}>
58
+ {#snippet template(args: Args)}
59
+ <div class="cgui:flex cgui:gap-2.5">
60
+ <Skeleton {...args} class="cgui:h-11" w="full" count={3} />
61
+ </div>
62
+ {/snippet}
63
+ </Story>
64
+
57
65
  <Story
58
66
  name="Avatar"
59
67
  args={{
@@ -4,7 +4,10 @@
4
4
  import type { WithElementRef, Without } from 'svelte-toolbelt';
5
5
  import { skeletonStyles, type SkeletonVariantProps } from './styles.js';
6
6
 
7
- type SkeletonPropsWithoutHTML = WithElementRef<{}> & SkeletonVariantProps;
7
+ type SkeletonPropsWithoutHTML = WithElementRef<{
8
+ count?: number;
9
+ }> &
10
+ SkeletonVariantProps;
8
11
 
9
12
  export type SkeletonProps = SkeletonPropsWithoutHTML & Without<PrimitiveDivAttributes, SkeletonPropsWithoutHTML>;
10
13
  </script>
@@ -16,10 +19,13 @@
16
19
  w = 'clear',
17
20
  rounded = 'md',
18
21
  variant = 'clear',
22
+ count = 1,
19
23
  ...restProps
20
24
  }: SkeletonProps = $props();
21
25
 
22
26
  const variants = $derived(skeletonStyles({ w, rounded, variant }));
23
27
  </script>
24
28
 
25
- <div class={cn(variants, className)} {...restProps}></div>
29
+ {#each Array.from({ length: count }) as i (i)}
30
+ <div class={cn(variants, className)} {...restProps}></div>
31
+ {/each}
@@ -1,7 +1,9 @@
1
1
  import type { PrimitiveDivAttributes } from '../../internal/types/html-attributes.js';
2
2
  import type { WithElementRef, Without } from 'svelte-toolbelt';
3
3
  import { type SkeletonVariantProps } from './styles.js';
4
- type SkeletonPropsWithoutHTML = WithElementRef<{}> & SkeletonVariantProps;
4
+ type SkeletonPropsWithoutHTML = WithElementRef<{
5
+ count?: number;
6
+ }> & SkeletonVariantProps;
5
7
  export type SkeletonProps = SkeletonPropsWithoutHTML & Without<PrimitiveDivAttributes, SkeletonPropsWithoutHTML>;
6
8
  declare const Skeleton: import("svelte").Component<SkeletonProps, {}, "ref">;
7
9
  type Skeleton = ReturnType<typeof Skeleton>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";
package/dist/index.d.ts CHANGED
@@ -8,3 +8,7 @@ export * from './components/segment/index.js';
8
8
  export * from './components/icons/index.js';
9
9
  export * from './components/input/index.js';
10
10
  export * from './components/spinner/index.js';
11
+ export * from './components/button-group/index.js';
12
+ export * from './components/skeleton/index.js';
13
+ export * from './components/field/index.js';
14
+ export * from './components/separator/index.js';
package/dist/index.js CHANGED
@@ -8,3 +8,7 @@ export * from './components/segment/index.js';
8
8
  export * from './components/icons/index.js';
9
9
  export * from './components/input/index.js';
10
10
  export * from './components/spinner/index.js';
11
+ export * from './components/button-group/index.js';
12
+ export * from './components/skeleton/index.js';
13
+ export * from './components/field/index.js';
14
+ export * from './components/separator/index.js';
@@ -0,0 +1 @@
1
+ export declare const SLOT_ATTR_NAME: "data-slot";
@@ -0,0 +1 @@
1
+ export const SLOT_ATTR_NAME = 'data-slot';
@@ -39,6 +39,7 @@ export type PrimitiveTrAttributes = Primitive<TableRowAttributes>;
39
39
  export type PrimitiveTheadAttributes = Primitive<TableSectionAttributes>;
40
40
  export type PrimitiveHeaderAttributes = Primitive<ElementAttributes>;
41
41
  export type PrimitiveFormAttributes = Primitive<FormAttributes>;
42
+ export type PrimitiveParagraphAttributes = Primitive<ParagraphAttributes>;
42
43
  export type ExtractPrimitiveEvents<Type extends Record<string, any>> = {
43
44
  [K in keyof Type as K extends `on${string}` ? K : never]: Type[K];
44
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casinogate/ui",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",