@casinogate/ui 1.10.18 → 1.11.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 (85) hide show
  1. package/dist/assets/css/root.css +175 -0
  2. package/dist/assets/css/tailwind/theme.css +1 -0
  3. package/dist/assets/css/theme.css +4 -0
  4. package/dist/assets/css/tokens/primitives.css +1 -0
  5. package/dist/components/field/components/field.description.svelte +2 -4
  6. package/dist/components/field/components/field.error.svelte +9 -12
  7. package/dist/components/field/components/field.label.svelte +2 -4
  8. package/dist/components/field/components/field.root.svelte +2 -6
  9. package/dist/components/field/components/field.svelte.d.ts +1 -0
  10. package/dist/components/field/components/field.svelte.js +2 -1
  11. package/dist/components/field/components/index.d.ts +5 -0
  12. package/dist/components/field/components/index.js +5 -0
  13. package/dist/components/field/composed/basic/basic.svelte +40 -0
  14. package/dist/components/field/composed/basic/basic.svelte.d.ts +4 -0
  15. package/dist/components/field/composed/basic/index.d.ts +1 -0
  16. package/dist/components/field/composed/basic/index.js +1 -0
  17. package/dist/components/field/composed/index.d.ts +1 -0
  18. package/dist/components/field/composed/index.js +1 -0
  19. package/dist/components/field/field.svelte +6 -6
  20. package/dist/components/field/index.d.ts +2 -2
  21. package/dist/components/field/index.js +2 -2
  22. package/dist/components/field/styles.d.ts +8 -49
  23. package/dist/components/field/styles.js +21 -15
  24. package/dist/components/field/types.d.ts +7 -5
  25. package/dist/components/index.d.ts +1 -0
  26. package/dist/components/index.js +1 -0
  27. package/dist/components/navigation/components/index.d.ts +7 -0
  28. package/dist/components/navigation/components/index.js +7 -0
  29. package/dist/components/navigation/components/navigation.sub-trigger.svelte +2 -0
  30. package/dist/components/navigation/components/navigation.svelte.d.ts +4 -0
  31. package/dist/components/navigation/components/navigation.svelte.js +2 -0
  32. package/dist/components/navigation/components/navigation.trigger.svelte +2 -0
  33. package/dist/components/navigation/{navigation.svelte → composed/basic/basic.svelte} +11 -25
  34. package/dist/components/navigation/composed/basic/basic.svelte.d.ts +4 -0
  35. package/dist/components/navigation/composed/basic/index.d.ts +1 -0
  36. package/dist/components/navigation/composed/basic/index.js +1 -0
  37. package/dist/components/navigation/composed/index.d.ts +1 -0
  38. package/dist/components/navigation/composed/index.js +1 -0
  39. package/dist/components/navigation/index.d.ts +4 -4
  40. package/dist/components/navigation/index.js +3 -3
  41. package/dist/components/navigation/model/create-nav-collection.d.ts +3 -0
  42. package/dist/components/navigation/model/create-nav-collection.js +14 -0
  43. package/dist/components/navigation/model/index.d.ts +1 -0
  44. package/dist/components/navigation/model/index.js +1 -0
  45. package/dist/components/navigation/styles.js +8 -2
  46. package/dist/components/navigation/types.d.ts +4 -0
  47. package/dist/components/slider/components/index.d.ts +5 -0
  48. package/dist/components/slider/components/index.js +5 -0
  49. package/dist/components/slider/components/slider.range.svelte +12 -0
  50. package/dist/components/slider/components/slider.range.svelte.d.ts +4 -0
  51. package/dist/components/slider/components/slider.root.svelte +35 -0
  52. package/dist/components/slider/components/slider.root.svelte.d.ts +4 -0
  53. package/dist/components/slider/components/slider.thumb.svelte +25 -0
  54. package/dist/components/slider/components/slider.thumb.svelte.d.ts +4 -0
  55. package/dist/components/slider/components/slider.tick.svelte +24 -0
  56. package/dist/components/slider/components/slider.tick.svelte.d.ts +4 -0
  57. package/dist/components/slider/components/slider.track.svelte +32 -0
  58. package/dist/components/slider/components/slider.track.svelte.d.ts +4 -0
  59. package/dist/components/slider/components/state.svelte.d.ts +15 -0
  60. package/dist/components/slider/components/state.svelte.js +11 -0
  61. package/dist/components/slider/composed/index.d.ts +1 -0
  62. package/dist/components/slider/composed/index.js +1 -0
  63. package/dist/components/slider/composed/root/index.d.ts +1 -0
  64. package/dist/components/slider/composed/root/index.js +1 -0
  65. package/dist/components/slider/composed/root/slider.root.svelte +41 -0
  66. package/dist/components/slider/composed/root/slider.root.svelte.d.ts +4 -0
  67. package/dist/components/slider/index.d.ts +3 -0
  68. package/dist/components/slider/index.js +3 -0
  69. package/dist/components/slider/styles.d.ts +107 -0
  70. package/dist/components/slider/styles.js +103 -0
  71. package/dist/components/slider/types.d.ts +16 -0
  72. package/dist/components/slider/types.js +1 -0
  73. package/dist/internal/constants/stories-namespace.d.ts +3 -0
  74. package/dist/internal/constants/stories-namespace.js +3 -0
  75. package/dist/internal/types/composition.d.ts +2 -2
  76. package/package.json +164 -9
  77. package/dist/components/field/exports-primitive.d.ts +0 -5
  78. package/dist/components/field/exports-primitive.js +0 -5
  79. package/dist/components/field/exports.d.ts +0 -1
  80. package/dist/components/field/exports.js +0 -1
  81. package/dist/components/navigation/exports-primitive.d.ts +0 -7
  82. package/dist/components/navigation/exports-primitive.js +0 -7
  83. package/dist/components/navigation/exports.d.ts +0 -1
  84. package/dist/components/navigation/exports.js +0 -1
  85. package/dist/components/navigation/navigation.svelte.d.ts +0 -7
@@ -1,50 +1,9 @@
1
- import { Context } from 'runed';
2
- import type { ReadableBox } from 'svelte-toolbelt';
3
1
  import type { VariantProps } from 'tailwind-variants';
4
- export declare const fieldStyles: import("tailwind-variants").TVReturnType<{
5
- [key: string]: {
6
- [key: string]: import("tailwind-merge").ClassNameValue | {
7
- description?: import("tailwind-merge").ClassNameValue;
8
- root?: import("tailwind-merge").ClassNameValue;
9
- label?: import("tailwind-merge").ClassNameValue;
10
- error?: import("tailwind-merge").ClassNameValue;
11
- };
12
- };
13
- } | {
14
- [x: string]: {
15
- [x: string]: import("tailwind-merge").ClassNameValue | {
16
- description?: import("tailwind-merge").ClassNameValue;
17
- root?: import("tailwind-merge").ClassNameValue;
18
- label?: import("tailwind-merge").ClassNameValue;
19
- error?: import("tailwind-merge").ClassNameValue;
20
- };
21
- };
22
- } | {}, {
23
- root: string;
24
- label: string[];
25
- error: string;
26
- description: string;
27
- }, undefined, {
28
- [key: string]: {
29
- [key: string]: import("tailwind-merge").ClassNameValue | {
30
- description?: import("tailwind-merge").ClassNameValue;
31
- root?: import("tailwind-merge").ClassNameValue;
32
- label?: import("tailwind-merge").ClassNameValue;
33
- error?: import("tailwind-merge").ClassNameValue;
34
- };
35
- };
36
- } | {}, {
37
- root: string;
38
- label: string[];
39
- error: string;
40
- description: string;
41
- }, import("tailwind-variants").TVReturnType<unknown, {
42
- root: string;
43
- label: string[];
44
- error: string;
45
- description: string;
46
- }, undefined, unknown, unknown, undefined>>;
47
- export type FieldVariantsProps = VariantProps<typeof fieldStyles>;
48
- type FieldStylesContextValues = ReadableBox<ReturnType<typeof fieldStyles>>;
49
- export declare const FieldStylesContext: Context<FieldStylesContextValues>;
50
- export {};
2
+ export declare const fieldRootVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
3
+ export declare const fieldLabelVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
4
+ export declare const fieldErrorVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
5
+ export declare const fieldDescriptionVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
6
+ export type FieldRootVariants = VariantProps<typeof fieldRootVariants>;
7
+ export type FieldLabelVariants = VariantProps<typeof fieldLabelVariants>;
8
+ export type FieldErrorVariants = VariantProps<typeof fieldErrorVariants>;
9
+ export type FieldDescriptionVariants = VariantProps<typeof fieldDescriptionVariants>;
@@ -1,17 +1,23 @@
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 fieldStyles = tv({
5
- slots: {
6
- root: 'cgui:flex cgui:flex-col cgui:gap-1',
7
- label: [
8
- 'cgui:relative',
9
- 'cgui:w-fit',
10
- 'cgui:inline-flex cgui:items-center cgui:gap-0.5',
11
- 'cgui:text-fg-medium cgui:text-caption cgui:font-medium',
12
- ],
13
- error: 'cgui:text-caption cgui:text-fg-error',
14
- description: 'cgui:text-caption cgui:text-fg-medium',
15
- },
2
+ export const fieldRootVariants = tv({
3
+ base: ['cgui:flex cgui:flex-col cgui:gap-1'],
4
+ });
5
+ export const fieldLabelVariants = tv({
6
+ base: [
7
+ 'cgui:relative',
8
+ 'cgui:w-fit',
9
+ 'cgui:inline-flex cgui:items-center cgui:gap-0.5',
10
+ 'cgui:text-fg-medium cgui:text-caption cgui:font-medium',
11
+ ],
12
+ });
13
+ export const fieldErrorVariants = tv({
14
+ base: [
15
+ 'cgui:text-caption cgui:text-fg-error',
16
+ 'cgui:min-h-[1lh]',
17
+ 'cgui:invisible cgui:opacity-0 cgui:transition-opacity cgui:duration-200',
18
+ 'cgui:data-[invalid]:visible cgui:data-[invalid]:opacity-100',
19
+ ],
20
+ });
21
+ export const fieldDescriptionVariants = tv({
22
+ base: ['cgui:text-caption cgui:text-fg-medium'],
16
23
  });
17
- export const FieldStylesContext = new Context(keyWithPrefix('field-styles'));
@@ -1,7 +1,9 @@
1
+ import type { WithVariants } from '../../internal/types/composition.js';
1
2
  import type { PrimitiveDivAttributes, PrimitiveLabelAttributes, PrimitiveSpanAttributes } from '../../internal/types/html-attributes.js';
2
3
  import type { Snippet } from 'svelte';
3
4
  import type { WithChild, WithElementRef, Without, WithoutChildrenOrChild } from 'svelte-toolbelt';
4
- type FieldRootPropsWithoutHTML = WithElementRef<WithChild<{
5
+ import type { FieldDescriptionVariants, FieldErrorVariants, FieldLabelVariants, FieldRootVariants } from './styles.js';
6
+ type FieldRootPropsWithoutHTML = WithVariants<WithElementRef<WithChild<{
5
7
  invalid?: boolean;
6
8
  disabled?: boolean;
7
9
  readOnly?: boolean;
@@ -11,7 +13,7 @@ type FieldRootPropsWithoutHTML = WithElementRef<WithChild<{
11
13
  disabled: boolean;
12
14
  readOnly: boolean;
13
15
  required: boolean;
14
- }>>;
16
+ }>>, FieldRootVariants>;
15
17
  export type FieldRootProps = FieldRootPropsWithoutHTML & Without<PrimitiveDivAttributes, FieldRootPropsWithoutHTML>;
16
18
  export type FieldControlProps = {
17
19
  children?: Snippet<[{
@@ -19,11 +21,11 @@ export type FieldControlProps = {
19
21
  }]>;
20
22
  id?: string;
21
23
  };
22
- type FieldDescriptionPropsWithoutHTML = WithElementRef<WithChild<{}>>;
24
+ type FieldDescriptionPropsWithoutHTML = WithVariants<WithElementRef<WithChild<{}>>, FieldDescriptionVariants>;
23
25
  export type FieldDescriptionProps = FieldDescriptionPropsWithoutHTML & Without<PrimitiveSpanAttributes, FieldDescriptionPropsWithoutHTML>;
24
- type FieldErrorPropsWithoutHTML = WithElementRef<WithChild<{}>>;
26
+ type FieldErrorPropsWithoutHTML = WithVariants<WithElementRef<WithChild<{}>>, FieldErrorVariants>;
25
27
  export type FieldErrorProps = FieldErrorPropsWithoutHTML & Without<PrimitiveSpanAttributes, FieldErrorPropsWithoutHTML>;
26
- type FieldLabelPropsWithoutHTML = WithElementRef<WithChild<{}>>;
28
+ type FieldLabelPropsWithoutHTML = WithVariants<WithElementRef<WithChild<{}>>, FieldLabelVariants>;
27
29
  export type FieldLabelProps = FieldLabelPropsWithoutHTML & Without<PrimitiveLabelAttributes, FieldLabelPropsWithoutHTML>;
28
30
  export type FieldProps = WithoutChildrenOrChild<FieldRootProps> & {
29
31
  label?: string | Snippet;
@@ -23,6 +23,7 @@ export * from './segment/index.js';
23
23
  export * from './select/index.js';
24
24
  export * from './separator/index.js';
25
25
  export * from './skeleton/index.js';
26
+ export * from './slider/index.js';
26
27
  export * from './spinner/index.js';
27
28
  export * from './switch/index.js';
28
29
  export * from './textarea/index.js';
@@ -23,6 +23,7 @@ export * from './segment/index.js';
23
23
  export * from './select/index.js';
24
24
  export * from './separator/index.js';
25
25
  export * from './skeleton/index.js';
26
+ export * from './slider/index.js';
26
27
  export * from './spinner/index.js';
27
28
  export * from './switch/index.js';
28
29
  export * from './textarea/index.js';
@@ -0,0 +1,7 @@
1
+ export { default as Content } from './navigation.content.svelte';
2
+ export { default as Item } from './navigation.item.svelte';
3
+ export { default as Root } from './navigation.root.svelte';
4
+ export { default as SubContent } from './navigation.sub-content.svelte';
5
+ export { default as SubTrigger } from './navigation.sub-trigger.svelte';
6
+ export { default as Sub } from './navigation.sub.svelte';
7
+ export { default as Trigger } from './navigation.trigger.svelte';
@@ -0,0 +1,7 @@
1
+ export { default as Content } from './navigation.content.svelte';
2
+ export { default as Item } from './navigation.item.svelte';
3
+ export { default as Root } from './navigation.root.svelte';
4
+ export { default as SubContent } from './navigation.sub-content.svelte';
5
+ export { default as SubTrigger } from './navigation.sub-trigger.svelte';
6
+ export { default as Sub } from './navigation.sub.svelte';
7
+ export { default as Trigger } from './navigation.trigger.svelte';
@@ -20,6 +20,7 @@
20
20
  label,
21
21
  class: className,
22
22
  disabled = false,
23
+ active = false,
23
24
  ...restProps
24
25
  }: NavigationSubTriggerProps = $props();
25
26
 
@@ -30,6 +31,7 @@
30
31
  ),
31
32
  id: boxWith(() => id),
32
33
  disabled: boxWith(() => disabled),
34
+ active: boxWith(() => active),
33
35
  });
34
36
 
35
37
  const mergedProps = $derived(
@@ -49,6 +49,7 @@ export declare class NavigationItemState {
49
49
  }
50
50
  type NavigationTriggerStateOpts = WithRefProps<ReadableBoxedValues<{
51
51
  disabled: boolean;
52
+ active: boolean;
52
53
  }>>;
53
54
  export declare class NavigationTriggerState {
54
55
  static create(opts: NavigationTriggerStateOpts): NavigationTriggerState;
@@ -60,6 +61,7 @@ export declare class NavigationTriggerState {
60
61
  readonly id: string;
61
62
  readonly "data-slot": "trigger";
62
63
  readonly 'data-disabled': "" | undefined;
64
+ readonly 'data-active': "" | undefined;
63
65
  };
64
66
  }
65
67
  type NavigationSubStateOpts = WithRefProps<WritableBoxedValues<{
@@ -83,6 +85,7 @@ export declare class NavigationSubState {
83
85
  }
84
86
  type NavigationSubTriggerStateOpts = WithRefProps<ReadableBoxedValues<{
85
87
  disabled: boolean;
88
+ active: boolean;
86
89
  }>>;
87
90
  export declare class NavigationSubTriggerState {
88
91
  static create(opts: NavigationSubTriggerStateOpts): NavigationSubTriggerState;
@@ -95,6 +98,7 @@ export declare class NavigationSubTriggerState {
95
98
  readonly id: string;
96
99
  readonly "data-slot": "sub-trigger";
97
100
  readonly 'data-disabled': "" | undefined;
101
+ readonly 'data-active': "" | undefined;
98
102
  readonly 'data-state': "open" | "closed";
99
103
  readonly 'aria-expanded': boolean;
100
104
  readonly 'aria-haspopup': "menu";
@@ -89,6 +89,7 @@ export class NavigationTriggerState {
89
89
  id: this.opts.id.current,
90
90
  [SLOT_ATTR_NAME]: SLOT_ATTR_VALUES.trigger,
91
91
  'data-disabled': boolAttr(this.opts.disabled.current),
92
+ 'data-active': boolAttr(this.opts.active.current),
92
93
  ...this.attachment,
93
94
  }));
94
95
  }
@@ -142,6 +143,7 @@ export class NavigationSubTriggerState {
142
143
  id: this.opts.id.current,
143
144
  [SLOT_ATTR_NAME]: SLOT_ATTR_VALUES.subTrigger,
144
145
  'data-disabled': boolAttr(this.opts.disabled.current),
146
+ 'data-active': boolAttr(this.opts.active.current),
145
147
  'data-state': this.sub.isOpen ? 'open' : 'closed',
146
148
  'aria-expanded': this.sub.isOpen,
147
149
  'aria-haspopup': 'menu',
@@ -18,6 +18,7 @@
18
18
  class: className,
19
19
  href,
20
20
  disabled = false,
21
+ active = false,
21
22
  ...restProps
22
23
  }: NavigationTriggerProps = $props();
23
24
 
@@ -31,6 +32,7 @@
31
32
  ),
32
33
  id: boxWith(() => id),
33
34
  disabled: boxWith(() => disabled),
35
+ active: boxWith(() => active),
34
36
  });
35
37
 
36
38
  const mergedProps = $derived(
@@ -1,29 +1,10 @@
1
1
  <script lang="ts" module>
2
- import { createListCollection } from '../../internal/index.js';
3
- import type { ListCollection } from '../../internal/lib/collection/index.js';
4
2
  import type {
5
- NavigationCollectionOptions,
6
- NavigationItem,
7
3
  NavigationItemAction,
8
4
  NavigationItemLink,
9
5
  NavigationItemSub,
10
6
  NavigationSelectableItem,
11
- } from './types.js';
12
-
13
- export function createNavigationCollection(options: NavigationCollectionOptions): ListCollection<NavigationItem> {
14
- const { items } = options;
15
-
16
- return createListCollection({
17
- items,
18
- itemToValue: (item) => item.key,
19
- itemToString: (item) => {
20
- return item.label;
21
- },
22
- isItemDisabled: (item) => {
23
- return !!item.disabled;
24
- },
25
- });
26
- }
7
+ } from '../../types.js';
27
8
 
28
9
  function isLink(item: NavigationSelectableItem): item is NavigationItemLink {
29
10
  return item.type === 'link';
@@ -39,8 +20,8 @@
39
20
  </script>
40
21
 
41
22
  <script lang="ts">
42
- import * as Primitive from './exports-primitive.js';
43
- import type { NavigationProps } from './types.js';
23
+ import * as Primitive from '../../components/index.js';
24
+ import type { NavigationProps } from '../../types.js';
44
25
 
45
26
  let {
46
27
  collection,
@@ -48,6 +29,7 @@
48
29
  compact = $bindable(false),
49
30
  contentClass,
50
31
  item: itemSnippet,
32
+ activeKey,
51
33
  ...restProps
52
34
  }: NavigationProps = $props();
53
35
 
@@ -56,7 +38,11 @@
56
38
 
57
39
  {#snippet defaultSubRenderer(item: NavigationItemSub)}
58
40
  <Primitive.Sub>
59
- <Primitive.SubTrigger label={item.label} disabled={item.disabled}>
41
+ <Primitive.SubTrigger
42
+ label={item.label}
43
+ disabled={item.disabled}
44
+ active={item.children.some((child) => child.key === activeKey)}
45
+ >
60
46
  {#snippet icon()}
61
47
  {#if item.icon}
62
48
  <item.icon width={24} height={24} />
@@ -74,7 +60,7 @@
74
60
 
75
61
  {#snippet defaultLinkRenderer(item: NavigationItemLink)}
76
62
  <Primitive.Item>
77
- <Primitive.Trigger label={item.label} href={item.href} disabled={item.disabled}>
63
+ <Primitive.Trigger label={item.label} href={item.href} disabled={item.disabled} active={item.key === activeKey}>
78
64
  {#snippet icon()}
79
65
  {#if item.icon}
80
66
  <item.icon width={24} height={24} />
@@ -86,7 +72,7 @@
86
72
 
87
73
  {#snippet defaultActionRenderer(item: NavigationItemAction)}
88
74
  <Primitive.Item>
89
- <Primitive.Trigger label={item.label} disabled={item.disabled}>
75
+ <Primitive.Trigger label={item.label} disabled={item.disabled} active={item.key === activeKey}>
90
76
  {#snippet icon()}
91
77
  {#if item.icon}
92
78
  <item.icon width={24} height={24} />
@@ -0,0 +1,4 @@
1
+ import type { NavigationProps } from '../../types.js';
2
+ declare const Basic: import("svelte").Component<NavigationProps, {}, "ref" | "compact">;
3
+ type Basic = ReturnType<typeof Basic>;
4
+ 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 @@
1
+ export * from './basic/index.js';
@@ -0,0 +1 @@
1
+ export * from './basic/index.js';
@@ -1,4 +1,4 @@
1
- export * as NavigationPrimitive from './exports-primitive.js';
2
- export * as Navigation from './exports.js';
3
- export { createNavigationCollection } from './navigation.svelte';
4
- export type { NavigationCollection, NavigationCollectionOptions, NavigationContentProps, NavigationItem, NavigationItemAction, NavigationItemBase, NavigationItemLink, NavigationItemProps, NavigationItemSeparator, NavigationItemSub, NavigationProps, NavigationRootProps, NavigationSelectableItem, NavigationSubContentProps, NavigationSubProps, NavigationSubTriggerProps, NavigationTriggerProps, } from './types.js';
1
+ export * as NavigationPrimitive from './components/index.js';
2
+ export * as Navigation from './composed/index.js';
3
+ export { createNavCollection } from './model/index.js';
4
+ export type { NavigationCollection, NavigationCollectionOptions, NavigationContentProps, NavigationItem, NavigationItemAction, NavigationItemBase, NavigationItemLink, NavigationItemProps, NavigationItemSub, NavigationProps, NavigationRootProps, NavigationSelectableItem, NavigationSubContentProps, NavigationSubProps, NavigationSubTriggerProps, NavigationTriggerProps, } from './types.js';
@@ -1,3 +1,3 @@
1
- export * as NavigationPrimitive from './exports-primitive.js';
2
- export * as Navigation from './exports.js';
3
- export { createNavigationCollection } from './navigation.svelte';
1
+ export * as NavigationPrimitive from './components/index.js';
2
+ export * as Navigation from './composed/index.js';
3
+ export { createNavCollection } from './model/index.js';
@@ -0,0 +1,3 @@
1
+ import type { ListCollection } from '@zag-js/collection';
2
+ import type { NavigationCollectionOptions, NavigationItem } from '../types.js';
3
+ export declare const createNavCollection: (options: NavigationCollectionOptions) => ListCollection<NavigationItem>;
@@ -0,0 +1,14 @@
1
+ import { createListCollection } from '../../../internal/index.js';
2
+ export const createNavCollection = (options) => {
3
+ const { items } = options;
4
+ return createListCollection({
5
+ items,
6
+ itemToValue: (item) => item.key,
7
+ itemToString: (item) => {
8
+ return item.label;
9
+ },
10
+ isItemDisabled: (item) => {
11
+ return !!item.disabled;
12
+ },
13
+ });
14
+ };
@@ -0,0 +1 @@
1
+ export { createNavCollection } from './create-nav-collection.js';
@@ -0,0 +1 @@
1
+ export { createNavCollection } from './create-nav-collection.js';
@@ -20,13 +20,15 @@ export const navigationItemStyles = tv({
20
20
  export const navigationTriggerStyles = tv({
21
21
  base: [
22
22
  'cgui:flex cgui:items-center cgui:gap-2',
23
- 'cgui:overflow-hidden cgui:truncate',
23
+ 'cgui:overflow-hidden cgui:truncate cgui:rounded-xs',
24
24
  'cgui:w-full cgui:px-3 cgui:py-4',
25
25
  'cgui:group-data-[compact=true]/navigation:py-3 cgui:group-data-[compact=true]/navigation:justify-center',
26
26
  'cgui:text-fg-semilight cgui:text-body',
27
27
  'cgui:cursor-pointer cgui:transition-all cgui:duration-250 cgui:ease-in-out',
28
28
  'cgui:data-[disabled]:cursor-not-allowed cgui:data-[disabled]:opacity-50',
29
29
  'cgui:[&_svg]:size-6 cgui:[&_[data-slot="icon"]]:me-auto',
30
+ 'cgui:hover:text-fg-white',
31
+ 'cgui:data-[active]:bg-surface-dark cgui:data-[active]:text-fg-white',
30
32
  ],
31
33
  });
32
34
  export const navigationSubStyles = tv({
@@ -37,7 +39,11 @@ export const navigationSubTriggerStyles = tv({
37
39
  base: ['cgui:group-data-[compact=false]/navigation:data-[state=open]:[&_[data-slot="chevron"]]:rotate-180'],
38
40
  });
39
41
  export const navigationSubContentStyles = tv({
40
- base: ['cgui:data-[compact=false]:pl-10', 'cgui:data-[compact=false]:[&_[data-slot="trigger"]]:pl-0'],
42
+ base: [
43
+ 'cgui:data-[compact=false]:pl-10',
44
+ 'cgui:data-[compact=false]:[&_[data-slot="trigger"]]:pl-0',
45
+ 'cgui:[&_[data-slot="trigger"][data-active]]:bg-transparent',
46
+ ],
41
47
  });
42
48
  export const navigationDropdownContentStyles = tv({
43
49
  base: [
@@ -20,6 +20,7 @@ export type NavigationItemProps = NavigationItemPropsWithoutHTML & Without<Primi
20
20
  type NavigationTriggerPropsWithoutHTML = WithElementRef<WithoutChildren<WithChild<{
21
21
  href?: string;
22
22
  disabled?: boolean;
23
+ active?: boolean;
23
24
  icon?: Snippet;
24
25
  label?: string | Snippet<[{
25
26
  props: Record<string, unknown>;
@@ -36,6 +37,7 @@ type NavigationSubPropsWithoutHTML = WithElementRef<WithChild<{
36
37
  export type NavigationSubProps = NavigationSubPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationSubPropsWithoutHTML>;
37
38
  type NavigationSubTriggerPropsWithoutHTML = WithElementRef<WithoutChildren<WithChild<{
38
39
  disabled?: boolean;
40
+ active?: boolean;
39
41
  icon?: Snippet;
40
42
  label?: string | Snippet<[{
41
43
  props: Record<string, unknown>;
@@ -61,6 +63,7 @@ export type NavigationItemBase = {
61
63
  }>;
62
64
  /** Whether the item is disabled */
63
65
  disabled?: boolean;
66
+ [key: string]: unknown;
64
67
  };
65
68
  export type NavigationItemLink = NavigationItemBase & {
66
69
  type: 'link';
@@ -89,5 +92,6 @@ export type NavigationProps = WithoutChildrenOrChild<NavigationRootProps> & {
89
92
  props: Record<string, unknown>;
90
93
  }]>;
91
94
  contentClass?: string;
95
+ activeKey?: string;
92
96
  };
93
97
  export {};
@@ -0,0 +1,5 @@
1
+ export { default as Range } from './slider.range.svelte';
2
+ export { default as Root } from './slider.root.svelte';
3
+ export { default as Thumb } from './slider.thumb.svelte';
4
+ export { default as Tick } from './slider.tick.svelte';
5
+ export { default as Track } from './slider.track.svelte';
@@ -0,0 +1,5 @@
1
+ export { default as Range } from './slider.range.svelte';
2
+ export { default as Root } from './slider.root.svelte';
3
+ export { default as Thumb } from './slider.thumb.svelte';
4
+ export { default as Tick } from './slider.tick.svelte';
5
+ export { default as Track } from './slider.track.svelte';
@@ -0,0 +1,12 @@
1
+ <script lang="ts">
2
+ import { Slider as SliderPrimitive } from 'bits-ui';
3
+
4
+ import { sliderPrimitiveRangeStyles } from '../styles.js';
5
+
6
+ import { cn } from '../../../internal/utils/common.js';
7
+ import type { SliderPrimitiveRangeProps } from '../types.js';
8
+
9
+ let { ref = $bindable(null), class: className, ...restProps }: SliderPrimitiveRangeProps = $props();
10
+ </script>
11
+
12
+ <SliderPrimitive.Range class={cn(sliderPrimitiveRangeStyles({}), className)} bind:ref {...restProps} />
@@ -0,0 +1,4 @@
1
+ import type { SliderPrimitiveRangeProps } from '../types.js';
2
+ declare const Slider: import("svelte").Component<SliderPrimitiveRangeProps, {}, "ref">;
3
+ type Slider = ReturnType<typeof Slider>;
4
+ export default Slider;
@@ -0,0 +1,35 @@
1
+ <script lang="ts">
2
+ import { Slider as SliderPrimitive } from 'bits-ui';
3
+
4
+ import { sliderPrimitiveRootStyles } from '../styles.js';
5
+
6
+ import { cn } from '../../../internal/utils/common.js';
7
+ import { boxWith } from 'svelte-toolbelt';
8
+ import type { SliderPrimitiveRootProps } from '../types.js';
9
+ import { SliderPrimitiveRootState } from './state.svelte.js';
10
+
11
+ let {
12
+ ref = $bindable(null),
13
+ value = $bindable(),
14
+ orientation = 'horizontal',
15
+ class: className,
16
+ size = 'default',
17
+ disabled = false,
18
+ ...restProps
19
+ }: SliderPrimitiveRootProps = $props();
20
+
21
+ SliderPrimitiveRootState.create({
22
+ size: boxWith(() => size),
23
+ orientation: boxWith(() => orientation),
24
+ disabled: boxWith(() => disabled),
25
+ });
26
+ </script>
27
+
28
+ <SliderPrimitive.Root
29
+ class={cn(sliderPrimitiveRootStyles({ orientation }), className)}
30
+ bind:ref
31
+ bind:value={value as never}
32
+ {orientation}
33
+ {disabled}
34
+ {...restProps}
35
+ />
@@ -0,0 +1,4 @@
1
+ import type { SliderPrimitiveRootProps } from '../types.js';
2
+ declare const Slider: import("svelte").Component<SliderPrimitiveRootProps, {}, "value" | "ref">;
3
+ type Slider = ReturnType<typeof Slider>;
4
+ export default Slider;
@@ -0,0 +1,25 @@
1
+ <script lang="ts">
2
+ import { Slider as SliderPrimitive } from 'bits-ui';
3
+
4
+ import { sliderPrimitiveThumbStyles } from '../styles.js';
5
+
6
+ import { cn } from '../../../internal/utils/common.js';
7
+ import type { SliderPrimitiveThumbProps } from '../types.js';
8
+
9
+ import { SliderPrimitiveRootContext } from './state.svelte.js';
10
+
11
+ let { ref = $bindable(null), class: className, ...restProps }: SliderPrimitiveThumbProps = $props();
12
+
13
+ const rootContext = SliderPrimitiveRootContext.get();
14
+ </script>
15
+
16
+ <SliderPrimitive.Thumb
17
+ class={cn(
18
+ sliderPrimitiveThumbStyles({
19
+ size: rootContext.opts.size.current,
20
+ }),
21
+ className
22
+ )}
23
+ bind:ref
24
+ {...restProps}
25
+ />
@@ -0,0 +1,4 @@
1
+ import type { SliderPrimitiveThumbProps } from '../types.js';
2
+ declare const Slider: import("svelte").Component<SliderPrimitiveThumbProps, {}, "ref">;
3
+ type Slider = ReturnType<typeof Slider>;
4
+ export default Slider;
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import { Slider as SliderPrimitive } from 'bits-ui';
3
+
4
+ import { sliderPrimitiveTickStyles } from '../styles.js';
5
+
6
+ import { cn } from '../../../internal/utils/common.js';
7
+ import type { SliderPrimitiveTickProps } from '../types.js';
8
+ import { SliderPrimitiveRootContext } from './state.svelte.js';
9
+
10
+ let { ref = $bindable(null), class: className, ...restProps }: SliderPrimitiveTickProps = $props();
11
+
12
+ const rootContext = SliderPrimitiveRootContext.get();
13
+ </script>
14
+
15
+ <SliderPrimitive.Tick
16
+ class={cn(
17
+ sliderPrimitiveTickStyles({
18
+ size: rootContext.opts.size.current,
19
+ }),
20
+ className
21
+ )}
22
+ bind:ref
23
+ {...restProps}
24
+ />
@@ -0,0 +1,4 @@
1
+ import type { SliderPrimitiveTickProps } from '../types.js';
2
+ declare const Slider: import("svelte").Component<SliderPrimitiveTickProps, {}, "ref">;
3
+ type Slider = ReturnType<typeof Slider>;
4
+ export default Slider;
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import { boolAttr } from '../../../internal/utils/attrs.js';
3
+ import { cn } from '../../../internal/utils/common.js';
4
+ import { sliderPrimitiveTrackStyles } from '../styles.js';
5
+ import type { SliderPrimitiveTrackProps } from '../types.js';
6
+ import { SliderPrimitiveRootContext } from './state.svelte.js';
7
+
8
+ let { ref = $bindable(null), class: className, child, children, ...restProps }: SliderPrimitiveTrackProps = $props();
9
+
10
+ const rootContext = SliderPrimitiveRootContext.get();
11
+
12
+ const attrs = $derived({
13
+ 'data-slot': 'slider-track',
14
+ 'data-disabled': boolAttr(rootContext.opts.disabled.current),
15
+ class: cn(
16
+ sliderPrimitiveTrackStyles({
17
+ orientation: rootContext.opts.orientation.current,
18
+ size: rootContext.opts.size.current,
19
+ }),
20
+ className
21
+ ),
22
+ ...restProps,
23
+ });
24
+ </script>
25
+
26
+ {#if child}
27
+ {@render child({ props: attrs })}
28
+ {:else}
29
+ <span bind:this={ref} {...attrs}>
30
+ {@render children?.()}
31
+ </span>
32
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { SliderPrimitiveTrackProps } from '../types.js';
2
+ declare const Slider: import("svelte").Component<SliderPrimitiveTrackProps, {}, "ref">;
3
+ type Slider = ReturnType<typeof Slider>;
4
+ export default Slider;