@casinogate/ui 1.5.6 → 1.6.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 (78) hide show
  1. package/dist/assets/css/root.css +52 -0
  2. package/dist/assets/css/theme.css +2 -0
  3. package/dist/components/breadcrumb/breadcrumb.stories.svelte +0 -2
  4. package/dist/components/data-table/utils/render-helper.d.ts +0 -77
  5. package/dist/components/data-table/utils/render-helper.js +0 -77
  6. package/dist/components/dialog/_ui/basic-dialog/basic-dialog.svelte +89 -0
  7. package/dist/components/dialog/_ui/basic-dialog/basic-dialog.svelte.d.ts +6 -0
  8. package/dist/components/dialog/_ui/basic-dialog/index.d.ts +1 -0
  9. package/dist/components/dialog/_ui/basic-dialog/index.js +1 -0
  10. package/dist/components/dialog/_ui/nested-dialog/index.d.ts +1 -0
  11. package/dist/components/dialog/_ui/nested-dialog/index.js +1 -0
  12. package/dist/components/dialog/_ui/nested-dialog/nested-dialog.svelte +26 -0
  13. package/dist/components/dialog/_ui/nested-dialog/nested-dialog.svelte.d.ts +18 -0
  14. package/dist/components/dialog/components/dialog.close.svelte +17 -0
  15. package/dist/components/dialog/components/dialog.close.svelte.d.ts +4 -0
  16. package/dist/components/dialog/components/dialog.content.svelte +36 -0
  17. package/dist/components/dialog/components/dialog.content.svelte.d.ts +4 -0
  18. package/dist/components/dialog/components/dialog.overlay.svelte +32 -0
  19. package/dist/components/dialog/components/dialog.overlay.svelte.d.ts +4 -0
  20. package/dist/components/dialog/components/dialog.portal.svelte +10 -0
  21. package/dist/components/dialog/components/dialog.portal.svelte.d.ts +3 -0
  22. package/dist/components/dialog/components/dialog.positioner.svelte +34 -0
  23. package/dist/components/dialog/components/dialog.positioner.svelte.d.ts +4 -0
  24. package/dist/components/dialog/components/dialog.root.svelte +21 -0
  25. package/dist/components/dialog/components/dialog.root.svelte.d.ts +3 -0
  26. package/dist/components/dialog/components/dialog.svelte.d.ts +46 -0
  27. package/dist/components/dialog/components/dialog.svelte.js +72 -0
  28. package/dist/components/dialog/dialog-host-item.svelte +61 -0
  29. package/dist/components/dialog/dialog-host-item.svelte.d.ts +5 -0
  30. package/dist/components/dialog/dialog-host.svelte +38 -0
  31. package/dist/components/dialog/dialog-host.svelte.d.ts +5 -0
  32. package/dist/components/dialog/dialog.stories.svelte +102 -0
  33. package/dist/components/dialog/dialog.stories.svelte.d.ts +3 -0
  34. package/dist/components/dialog/exports-primitive.d.ts +6 -0
  35. package/dist/components/dialog/exports-primitive.js +6 -0
  36. package/dist/components/dialog/exports.d.ts +1 -0
  37. package/dist/components/dialog/exports.js +1 -0
  38. package/dist/components/dialog/index.d.ts +5 -0
  39. package/dist/components/dialog/index.js +4 -0
  40. package/dist/components/dialog/model/dialog-manager.svelte.d.ts +28 -0
  41. package/dist/components/dialog/model/dialog-manager.svelte.js +156 -0
  42. package/dist/components/dialog/model/index.d.ts +1 -0
  43. package/dist/components/dialog/model/index.js +1 -0
  44. package/dist/components/dialog/styles.d.ts +60 -0
  45. package/dist/components/dialog/styles.js +54 -0
  46. package/dist/components/dialog/types.d.ts +76 -0
  47. package/dist/components/dialog/types.js +1 -0
  48. package/dist/components/icons/cross.svelte +12 -0
  49. package/dist/components/icons/cross.svelte.d.ts +3 -0
  50. package/dist/components/icons/exports.d.ts +1 -0
  51. package/dist/components/icons/exports.js +1 -0
  52. package/dist/components/icons/sort.svelte +1 -1
  53. package/dist/components/index.d.ts +1 -0
  54. package/dist/components/index.js +1 -0
  55. package/dist/components/input-group/components/input-group.root.svelte +0 -0
  56. package/dist/components/input-group/components/input-group.root.svelte.d.ts +26 -0
  57. package/dist/components/input-group/exports-primitive.d.ts +1 -0
  58. package/dist/components/input-group/exports-primitive.js +1 -0
  59. package/dist/components/input-group/index.d.ts +1 -0
  60. package/dist/components/input-group/index.js +1 -0
  61. package/dist/components/input-group/styles.d.ts +1 -0
  62. package/dist/components/input-group/styles.js +1 -0
  63. package/dist/components/input-group/types.d.ts +1 -0
  64. package/dist/components/input-group/types.js +1 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js +1 -0
  67. package/dist/internal/index.d.ts +1 -0
  68. package/dist/internal/index.js +1 -0
  69. package/dist/internal/types/common.d.ts +1 -1
  70. package/dist/internal/utils/attrs.d.ts +1 -0
  71. package/dist/internal/utils/attrs.js +3 -0
  72. package/dist/internal/utils/event-dispatcher.d.ts +12 -0
  73. package/dist/internal/utils/event-dispatcher.js +50 -0
  74. package/dist/internal/utils/index.d.ts +2 -0
  75. package/dist/internal/utils/index.js +2 -0
  76. package/dist/internal/utils/render.d.ts +13 -0
  77. package/dist/internal/utils/render.js +22 -0
  78. package/package.json +1 -1
@@ -7,9 +7,12 @@
7
7
  "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
8
8
  --cgui-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
9
9
  "Courier New", monospace;
10
+ --cgui-color-black: #000;
10
11
  --cgui-spacing: 0.25rem;
11
12
  --cgui-text-sm: 0.875rem;
12
13
  --cgui-text-sm--line-height: calc(1.25 / 0.875);
14
+ --cgui-text-lg: 1.125rem;
15
+ --cgui-text-lg--line-height: calc(1.75 / 1.125);
13
16
  --cgui-font-weight-normal: 400;
14
17
  --cgui-font-weight-medium: 500;
15
18
  --cgui-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
@@ -218,6 +221,9 @@
218
221
  .cgui\:z-\(--cg-ui-z-index-select\) {
219
222
  z-index: var(--cg-ui-z-index-select);
220
223
  }
224
+ .cgui\:z-\(--z-index-dialog\) {
225
+ z-index: var(--z-index-dialog);
226
+ }
221
227
  .cgui\:z-1 {
222
228
  z-index: 1;
223
229
  }
@@ -230,6 +236,9 @@
230
236
  .cgui\:my-4 {
231
237
  margin-block: calc(var(--cgui-spacing) * 4);
232
238
  }
239
+ .cgui\:mt-4 {
240
+ margin-top: calc(var(--cgui-spacing) * 4);
241
+ }
233
242
  .cgui\:scrollbar-thin {
234
243
  &::-webkit-scrollbar-track {
235
244
  background-color: var(--scrollbar-track);
@@ -302,6 +311,10 @@
302
311
  width: calc(var(--cgui-spacing) * 14);
303
312
  height: calc(var(--cgui-spacing) * 14);
304
313
  }
314
+ .cgui\:size-40 {
315
+ width: calc(var(--cgui-spacing) * 40);
316
+ height: calc(var(--cgui-spacing) * 40);
317
+ }
305
318
  .cgui\:size-full {
306
319
  width: 100%;
307
320
  height: 100%;
@@ -432,6 +445,9 @@
432
445
  .cgui\:w-full {
433
446
  width: 100%;
434
447
  }
448
+ .cgui\:w-screen {
449
+ width: 100vw;
450
+ }
435
451
  .cgui\:max-w-32 {
436
452
  max-width: calc(var(--cgui-spacing) * 32);
437
453
  }
@@ -450,6 +466,12 @@
450
466
  .cgui\:max-w-100 {
451
467
  max-width: calc(var(--cgui-spacing) * 100);
452
468
  }
469
+ .cgui\:max-w-140 {
470
+ max-width: calc(var(--cgui-spacing) * 140);
471
+ }
472
+ .cgui\:max-w-200 {
473
+ max-width: calc(var(--cgui-spacing) * 200);
474
+ }
453
475
  .cgui\:min-w-\(--bits-select-anchor-width\) {
454
476
  min-width: var(--bits-select-anchor-width);
455
477
  }
@@ -690,6 +712,12 @@
690
712
  .cgui\:bg-bg-main {
691
713
  background-color: var(--cg-ui-palette-neutral-20);
692
714
  }
715
+ .cgui\:bg-black\/50 {
716
+ background-color: var(--cgui-color-black);
717
+ @supports (color: color-mix(in lab, red, red)) {
718
+ background-color: color-mix(in oklab, var(--cgui-color-black) 50%, transparent);
719
+ }
720
+ }
693
721
  .cgui\:bg-neutral-20 {
694
722
  background-color: var(--cg-ui-palette-neutral-20);
695
723
  }
@@ -902,6 +930,10 @@
902
930
  font-size: var(--cg-ui-fz-heading-2);
903
931
  line-height: var(--tw-leading, var(--cg-ui-lh-heading-2));
904
932
  }
933
+ .cgui\:text-lg {
934
+ font-size: var(--cgui-text-lg);
935
+ line-height: var(--tw-leading, var(--cgui-text-lg--line-height));
936
+ }
905
937
  .cgui\:text-sm {
906
938
  font-size: var(--cgui-text-sm);
907
939
  line-height: var(--tw-leading, var(--cgui-text-sm--line-height));
@@ -933,6 +965,9 @@
933
965
  .cgui\:text-fg-medium {
934
966
  color: var(--cg-ui-palette-neutral-60);
935
967
  }
968
+ .cgui\:text-fg-primary {
969
+ color: var(--cg-ui-palette-primary-80);
970
+ }
936
971
  .cgui\:text-fg-regular {
937
972
  color: var(--cg-ui-palette-neutral-50);
938
973
  }
@@ -981,6 +1016,10 @@
981
1016
  .cgui\:opacity-50 {
982
1017
  opacity: 50%;
983
1018
  }
1019
+ .cgui\:shadow-dialog {
1020
+ --tw-shadow: var(--cg-ui-shadow-dialog);
1021
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1022
+ }
984
1023
  .cgui\:shadow-none {
985
1024
  --tw-shadow: 0 0 #0000;
986
1025
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -1534,6 +1573,12 @@
1534
1573
  --tw-exit-opacity: 0;
1535
1574
  }
1536
1575
  }
1576
+ .cgui\:data-\[state\=closed\]\:slide-out-to-bottom-20 {
1577
+ &[data-state="closed"] {
1578
+ --tw-exit-translate-y: calc(20*var(--spacing));
1579
+ --tw-exit-translate-y: calc(.2*100%);
1580
+ }
1581
+ }
1537
1582
  .cgui\:data-\[state\=closed\]\:zoom-out-95 {
1538
1583
  &[data-state="closed"] {
1539
1584
  --tw-exit-scale: calc(95*1%);
@@ -1556,6 +1601,12 @@
1556
1601
  --tw-enter-opacity: 0;
1557
1602
  }
1558
1603
  }
1604
+ .cgui\:data-\[state\=open\]\:slide-in-from-bottom-20 {
1605
+ &[data-state="open"] {
1606
+ --tw-enter-translate-y: calc(20*var(--spacing));
1607
+ --tw-enter-translate-y: calc(.2*100%);
1608
+ }
1609
+ }
1559
1610
  .cgui\:data-\[state\=open\]\:zoom-in-95 {
1560
1611
  &[data-state="open"] {
1561
1612
  --tw-enter-scale: calc(95*1%);
@@ -1920,6 +1971,7 @@
1920
1971
  --cg-ui-shadow-segment-item: 0px 0px 4px 0px hsla(0, 0%, 0%, 0.1);
1921
1972
  --cg-ui-shadow-popover: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
1922
1973
  --cg-ui-shadow-select: 0px 2px 8px 0px hsla(0, 0%, 0%, 0.25);
1974
+ --cg-ui-shadow-dialog: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
1923
1975
  --cg-ui-fz-base: 16;
1924
1976
  --cg-ui-fz-heading: calc(16 / var(--cg-ui-fz-base) * 1rem);
1925
1977
  --cg-ui-lh-heading: calc(22 / var(--cg-ui-fz-base) * 1rem);
@@ -122,6 +122,7 @@
122
122
  --shadow-segment-thumb: var(--cg-ui-shadow-segment-item);
123
123
  --shadow-popover: var(--cg-ui-shadow-popover);
124
124
  --shadow-select: var(--cg-ui-shadow-select);
125
+ --shadow-dialog: var(--cg-ui-shadow-dialog);
125
126
 
126
127
  /* Font sizes, Line heights */
127
128
  --text-heading: var(--cg-ui-fz-heading);
@@ -203,6 +204,7 @@
203
204
  --cg-ui-shadow-segment-item: 0px 0px 4px 0px hsla(0, 0%, 0%, 0.1);
204
205
  --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
206
  --cg-ui-shadow-select: 0px 2px 8px 0px hsla(0, 0%, 0%, 0.25);
207
+ --cg-ui-shadow-dialog: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
206
208
 
207
209
  /* Font sizes, Line heights */
208
210
  --cg-ui-fz-base: 16;
@@ -28,8 +28,6 @@
28
28
  const pathname = '/organization/create';
29
29
  return pathname.split('/').filter(Boolean);
30
30
  });
31
-
32
- $inspect(path);
33
31
  </script>
34
32
 
35
33
  <Story name="Primitive" {args} {parameters}>
@@ -1,90 +1,13 @@
1
1
  import type { Component, ComponentProps, Snippet } from 'svelte';
2
- /**
3
- * A helper class to make it easy to identify Svelte components in
4
- * `columnDef.cell` and `columnDef.header` properties.
5
- *
6
- * > NOTE: This class should only be used internally by the adapter. If you're
7
- * reading this and you don't know what this is for, you probably don't need it.
8
- *
9
- * @example
10
- * ```svelte
11
- * {@const result = content(context as any)}
12
- * {#if result instanceof RenderComponentConfig}
13
- * {@const { component: Component, props } = result}
14
- * <Component {...props} />
15
- * {/if}
16
- * ```
17
- */
18
2
  export declare class RenderComponentConfig<TComponent extends Component> {
19
3
  component: TComponent;
20
4
  props: ComponentProps<TComponent> | Record<string, never>;
21
5
  constructor(component: TComponent, props?: ComponentProps<TComponent> | Record<string, never>);
22
6
  }
23
- /**
24
- * A helper class to make it easy to identify Svelte Snippets in `columnDef.cell` and `columnDef.header` properties.
25
- *
26
- * > NOTE: This class should only be used internally by the adapter. If you're
27
- * reading this and you don't know what this is for, you probably don't need it.
28
- *
29
- * @example
30
- * ```svelte
31
- * {@const result = content(context as any)}
32
- * {#if result instanceof RenderSnippetConfig}
33
- * {@const { snippet, params } = result}
34
- * {@render snippet(params)}
35
- * {/if}
36
- * ```
37
- */
38
7
  export declare class RenderSnippetConfig<TProps> {
39
8
  snippet: Snippet<[TProps]>;
40
9
  params: TProps;
41
10
  constructor(snippet: Snippet<[TProps]>, params: TProps);
42
11
  }
43
- /**
44
- * A helper function to help create cells from Svelte components through ColumnDef's `cell` and `header` properties.
45
- *
46
- * This is only to be used with Svelte Components - use `renderSnippet` for Svelte Snippets.
47
- *
48
- * @param component A Svelte component
49
- * @param props The props to pass to `component`
50
- * @returns A `RenderComponentConfig` object that helps svelte-table know how to render the header/cell component.
51
- * @example
52
- * ```ts
53
- * // +page.svelte
54
- * const defaultColumns = [
55
- * columnHelper.accessor('name', {
56
- * header: header => renderComponent(SortHeader, { label: 'Name', header }),
57
- * }),
58
- * columnHelper.accessor('state', {
59
- * header: header => renderComponent(SortHeader, { label: 'State', header }),
60
- * }),
61
- * ]
62
- * ```
63
- * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}
64
- */
65
12
  export declare function renderComponent<T extends Component<any>, Props extends ComponentProps<T>>(component: T, props?: Props): RenderComponentConfig<T>;
66
- /**
67
- * A helper function to help create cells from Svelte Snippets through ColumnDef's `cell` and `header` properties.
68
- *
69
- * The snippet must only take one parameter.
70
- *
71
- * This is only to be used with Snippets - use `renderComponent` for Svelte Components.
72
- *
73
- * @param snippet
74
- * @param params
75
- * @returns - A `RenderSnippetConfig` object that helps svelte-table know how to render the header/cell snippet.
76
- * @example
77
- * ```ts
78
- * // +page.svelte
79
- * const defaultColumns = [
80
- * columnHelper.accessor('name', {
81
- * cell: cell => renderSnippet(nameSnippet, { name: cell.row.name }),
82
- * }),
83
- * columnHelper.accessor('state', {
84
- * cell: cell => renderSnippet(stateSnippet, { state: cell.row.state }),
85
- * }),
86
- * ]
87
- * ```
88
- * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}
89
- */
90
13
  export declare function renderSnippet<TProps>(snippet: Snippet<[TProps]>, params?: TProps): RenderSnippetConfig<TProps>;
@@ -1,19 +1,3 @@
1
- /**
2
- * A helper class to make it easy to identify Svelte components in
3
- * `columnDef.cell` and `columnDef.header` properties.
4
- *
5
- * > NOTE: This class should only be used internally by the adapter. If you're
6
- * reading this and you don't know what this is for, you probably don't need it.
7
- *
8
- * @example
9
- * ```svelte
10
- * {@const result = content(context as any)}
11
- * {#if result instanceof RenderComponentConfig}
12
- * {@const { component: Component, props } = result}
13
- * <Component {...props} />
14
- * {/if}
15
- * ```
16
- */
17
1
  export class RenderComponentConfig {
18
2
  component;
19
3
  props;
@@ -22,21 +6,6 @@ export class RenderComponentConfig {
22
6
  this.props = props;
23
7
  }
24
8
  }
25
- /**
26
- * A helper class to make it easy to identify Svelte Snippets in `columnDef.cell` and `columnDef.header` properties.
27
- *
28
- * > NOTE: This class should only be used internally by the adapter. If you're
29
- * reading this and you don't know what this is for, you probably don't need it.
30
- *
31
- * @example
32
- * ```svelte
33
- * {@const result = content(context as any)}
34
- * {#if result instanceof RenderSnippetConfig}
35
- * {@const { snippet, params } = result}
36
- * {@render snippet(params)}
37
- * {/if}
38
- * ```
39
- */
40
9
  export class RenderSnippetConfig {
41
10
  snippet;
42
11
  params;
@@ -45,55 +14,9 @@ export class RenderSnippetConfig {
45
14
  this.params = params;
46
15
  }
47
16
  }
48
- /**
49
- * A helper function to help create cells from Svelte components through ColumnDef's `cell` and `header` properties.
50
- *
51
- * This is only to be used with Svelte Components - use `renderSnippet` for Svelte Snippets.
52
- *
53
- * @param component A Svelte component
54
- * @param props The props to pass to `component`
55
- * @returns A `RenderComponentConfig` object that helps svelte-table know how to render the header/cell component.
56
- * @example
57
- * ```ts
58
- * // +page.svelte
59
- * const defaultColumns = [
60
- * columnHelper.accessor('name', {
61
- * header: header => renderComponent(SortHeader, { label: 'Name', header }),
62
- * }),
63
- * columnHelper.accessor('state', {
64
- * header: header => renderComponent(SortHeader, { label: 'State', header }),
65
- * }),
66
- * ]
67
- * ```
68
- * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}
69
- */
70
17
  export function renderComponent(component, props = {}) {
71
18
  return new RenderComponentConfig(component, props);
72
19
  }
73
- /**
74
- * A helper function to help create cells from Svelte Snippets through ColumnDef's `cell` and `header` properties.
75
- *
76
- * The snippet must only take one parameter.
77
- *
78
- * This is only to be used with Snippets - use `renderComponent` for Svelte Components.
79
- *
80
- * @param snippet
81
- * @param params
82
- * @returns - A `RenderSnippetConfig` object that helps svelte-table know how to render the header/cell snippet.
83
- * @example
84
- * ```ts
85
- * // +page.svelte
86
- * const defaultColumns = [
87
- * columnHelper.accessor('name', {
88
- * cell: cell => renderSnippet(nameSnippet, { name: cell.row.name }),
89
- * }),
90
- * columnHelper.accessor('state', {
91
- * cell: cell => renderSnippet(stateSnippet, { state: cell.row.state }),
92
- * }),
93
- * ]
94
- * ```
95
- * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}
96
- */
97
20
  export function renderSnippet(snippet, params = {}) {
98
21
  return new RenderSnippetConfig(snippet, params);
99
22
  }
@@ -0,0 +1,89 @@
1
+ <script lang="ts">
2
+ import { useDialogItemContext } from '../../dialog-host-item.svelte';
3
+ import { dialogs } from '../../model/dialog-manager.svelte.js';
4
+ import { watch } from 'runed';
5
+ import { onMountEffect } from 'svelte-toolbelt';
6
+
7
+ const itemCtx = useDialogItemContext();
8
+
9
+ let {
10
+ name,
11
+ ...restProps
12
+ }: {
13
+ name: string;
14
+ } = $props();
15
+
16
+ let nameValue = $state('');
17
+
18
+ onMountEffect(() => {
19
+ nameValue = name;
20
+ });
21
+
22
+ watch(
23
+ () => nameValue,
24
+ () => {
25
+ itemCtx.update((currentProps, currentOptions) => {
26
+ return {
27
+ props: {
28
+ ...currentProps,
29
+ name: nameValue,
30
+ },
31
+ options: currentOptions,
32
+ };
33
+ });
34
+ }
35
+ );
36
+ </script>
37
+
38
+ <div class="cgui:max-w-200 cgui:w-screen cgui:p-4" {...restProps}>
39
+ <h2 class="cgui:text-lg cgui:font-medium cgui:text-fg-primary cgui:text-center">Basic Dialog</h2>
40
+
41
+ <p class="cgui:text-center cgui:p-4">
42
+ Hello {name}
43
+ </p>
44
+
45
+ <div>
46
+ <input type="text" bind:value={nameValue} />
47
+ </div>
48
+
49
+ <div class="cgui:flex cgui:flex-col cgui:gap-2">
50
+ <button
51
+ class="cgui:mt-4 cgui:w-full cgui:text-center cgui:bg-primary-80 cgui:text-fg-white cgui:p-2 cgui:rounded-md cgui:cursor-pointer"
52
+ onclick={() => {
53
+ dialogs.openRegistered({
54
+ key: 'nested',
55
+ props: {},
56
+ });
57
+ }}>Open Nested Dialog</button
58
+ >
59
+
60
+ <button
61
+ class="cgui:mt-4 cgui:w-full cgui:text-center cgui:bg-primary-80 cgui:text-fg-white cgui:p-2 cgui:rounded-md cgui:cursor-pointer"
62
+ onclick={() => {
63
+ const names = [
64
+ 'Alice Johnson',
65
+ 'Bob Smith',
66
+ 'Charlie Brown',
67
+ 'Diana Prince',
68
+ 'Ethan Hunt',
69
+ 'Fiona Green',
70
+ 'George Wilson',
71
+ 'Hannah Lee',
72
+ 'Isaac Newton',
73
+ 'Julia Roberts',
74
+ ];
75
+ const newName = names[Math.floor(Math.random() * names.length)];
76
+ nameValue = newName ?? '';
77
+ itemCtx.update((currentProps, currentOptions) => {
78
+ return {
79
+ props: {
80
+ ...currentProps,
81
+ name: newName,
82
+ },
83
+ options: currentOptions,
84
+ };
85
+ });
86
+ }}>Update Name</button
87
+ >
88
+ </div>
89
+ </div>
@@ -0,0 +1,6 @@
1
+ type $$ComponentProps = {
2
+ name: string;
3
+ };
4
+ declare const BasicDialog: import("svelte").Component<$$ComponentProps, {}, "">;
5
+ type BasicDialog = ReturnType<typeof BasicDialog>;
6
+ export default BasicDialog;
@@ -0,0 +1 @@
1
+ export { default as BasicDialog } from './basic-dialog.svelte';
@@ -0,0 +1 @@
1
+ export { default as BasicDialog } from './basic-dialog.svelte';
@@ -0,0 +1 @@
1
+ export { default as NestedDialog } from './nested-dialog.svelte';
@@ -0,0 +1 @@
1
+ export { default as NestedDialog } from './nested-dialog.svelte';
@@ -0,0 +1,26 @@
1
+ <script lang="ts">
2
+ import { dialogs } from '../../model/dialog-manager.svelte.js';
3
+ </script>
4
+
5
+ <div class="cgui:bg-surface-white cgui:max-w-140 cgui:p-4">
6
+ <h2 class="cgui:text-lg cgui:font-medium cgui:text-fg-primary cgui:text-center">Nested Dialog</h2>
7
+
8
+ <p>
9
+ Amet ullamco cupidatat dolor. Ut deserunt consequat enim elit ad aliqua aliqua dolore minim. Sint reprehenderit
10
+ commodo cillum ut laborum amet fugiat dolor incididunt laborum ut laboris irure qui veniam. Non officia
11
+ reprehenderit est tempor id. Minim ea qui consectetur. Incididunt fugiat enim ut veniam. Tempor labore eiusmod ut
12
+ ullamco esse nulla cupidatat et est amet. Ullamco velit sunt anim ex elit nostrud incididunt. Anim minim elit
13
+ laborum fugiat incididunt. Aute sit irure enim do ea id et tempor sunt sit ea id in excepteur. Non culpa consequat
14
+ Lorem est sit. Cillum culpa do nostrud. Ipsum aliquip fugiat cillum incididunt dolor occaecat eu et. Ipsum culpa
15
+ amet culpa culpa in id.
16
+ </p>
17
+
18
+ <button
19
+ onclick={() => {
20
+ dialogs.openRegistered({
21
+ key: 'basic',
22
+ props: {},
23
+ });
24
+ }}>Close</button
25
+ >
26
+ </div>
@@ -0,0 +1,18 @@
1
+ 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> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const NestedDialog: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type NestedDialog = InstanceType<typeof NestedDialog>;
18
+ export default NestedDialog;
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import { Icon } from '../../icons/index.js';
3
+ import { cn } from '../../../internal/utils/common.js';
4
+ import { Dialog as DialogPrimitive } from 'bits-ui';
5
+ import { dialogCloseStyles } from '../styles.js';
6
+ import type { DialogCloseProps } from '../types.js';
7
+
8
+ let { class: className, children, ...rest }: DialogCloseProps = $props();
9
+ </script>
10
+
11
+ <DialogPrimitive.Close class={cn(dialogCloseStyles(), className)} {...rest}>
12
+ {#if children}
13
+ {@render children?.()}
14
+ {:else}
15
+ <Icon.Cross width={24} height={24} class="cgui:size-6" />
16
+ {/if}
17
+ </DialogPrimitive.Close>
@@ -0,0 +1,4 @@
1
+ import type { DialogCloseProps } from '../types.js';
2
+ declare const Dialog: import("svelte").Component<DialogCloseProps, {}, "">;
3
+ type Dialog = ReturnType<typeof Dialog>;
4
+ export default Dialog;
@@ -0,0 +1,36 @@
1
+ <script lang="ts">
2
+ import { cn, useId } from '../../../internal/utils/common.js';
3
+ import { Dialog as DialogPrimitive } from 'bits-ui';
4
+ import { boxWith, mergeProps } from 'svelte-toolbelt';
5
+ import { dialogContentStyles } from '../styles.js';
6
+ import type { DialogContentProps } from '../types.js';
7
+ import { DialogContentState } from './dialog.svelte.js';
8
+
9
+ const uid = $props.id();
10
+
11
+ let {
12
+ children,
13
+ id = useId(uid),
14
+ ref = $bindable(null),
15
+ class: className,
16
+ variant = 'default',
17
+ rounded = 'default',
18
+ ...restProps
19
+ }: DialogContentProps = $props();
20
+
21
+ const contentState = DialogContentState.create({
22
+ ref: boxWith(
23
+ () => ref,
24
+ (v) => (ref = v)
25
+ ),
26
+ id: boxWith(() => id),
27
+ });
28
+
29
+ const mergedProps = $derived(
30
+ mergeProps(restProps, contentState.props, { class: cn(dialogContentStyles({ variant, rounded }), className) })
31
+ );
32
+ </script>
33
+
34
+ <DialogPrimitive.Content {...mergedProps}>
35
+ {@render children?.()}
36
+ </DialogPrimitive.Content>
@@ -0,0 +1,4 @@
1
+ import type { DialogContentProps } from '../types.js';
2
+ declare const Dialog: import("svelte").Component<DialogContentProps, {}, "ref">;
3
+ type Dialog = ReturnType<typeof Dialog>;
4
+ export default Dialog;
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import { cn, useId } from '../../../internal/utils/common.js';
3
+ import { Dialog as DialogPrimitive } from 'bits-ui';
4
+ import { boxWith, mergeProps } from 'svelte-toolbelt';
5
+ import { dialogOverlayStyles } from '../styles.js';
6
+ import type { DialogOverlayProps } from '../types.js';
7
+ import { DialogOverlayState } from './dialog.svelte.js';
8
+
9
+ const uid = $props.id();
10
+
11
+ let {
12
+ children,
13
+ id = useId(uid),
14
+ ref = $bindable(null),
15
+ class: className,
16
+ ...restProps
17
+ }: DialogOverlayProps = $props();
18
+
19
+ const overlayState = DialogOverlayState.create({
20
+ ref: boxWith(
21
+ () => ref,
22
+ (v) => (ref = v)
23
+ ),
24
+ id: boxWith(() => id),
25
+ });
26
+
27
+ const mergedProps = $derived(
28
+ mergeProps(restProps, overlayState.props, { class: cn(dialogOverlayStyles(), className) })
29
+ );
30
+ </script>
31
+
32
+ <DialogPrimitive.Overlay {...mergedProps} />
@@ -0,0 +1,4 @@
1
+ import type { DialogOverlayProps } from '../types.js';
2
+ declare const Dialog: import("svelte").Component<DialogOverlayProps, {}, "ref">;
3
+ type Dialog = ReturnType<typeof Dialog>;
4
+ export default Dialog;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { Dialog as DialogPrimitive } from 'bits-ui';
3
+ import type { DialogPortalProps } from '../types.js';
4
+
5
+ let { children, ...restProps }: DialogPortalProps = $props();
6
+ </script>
7
+
8
+ <DialogPrimitive.Portal {...restProps}>
9
+ {@render children?.()}
10
+ </DialogPrimitive.Portal>
@@ -0,0 +1,3 @@
1
+ declare const Dialog: import("svelte").Component<import("bits-ui").PortalProps, {}, "">;
2
+ type Dialog = ReturnType<typeof Dialog>;
3
+ export default Dialog;
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import { cn, useId } from '../../../internal/utils/common.js';
3
+ import { boxWith, mergeProps } from 'svelte-toolbelt';
4
+ import { dialogPositionerStyles } from '../styles.js';
5
+ import type { DialogPositionerProps } from '../types.js';
6
+ import { DialogPositionerState } from './dialog.svelte.js';
7
+
8
+ const uid = $props.id();
9
+
10
+ let {
11
+ children,
12
+ id = useId(uid),
13
+ ref = $bindable(null),
14
+ class: className,
15
+ align = 'center',
16
+ ...restProps
17
+ }: DialogPositionerProps = $props();
18
+
19
+ const positionerState = DialogPositionerState.create({
20
+ ref: boxWith(
21
+ () => ref,
22
+ (v) => (ref = v)
23
+ ),
24
+ id: boxWith(() => id),
25
+ });
26
+
27
+ const mergedProps = $derived(
28
+ mergeProps(restProps, positionerState.props, { class: cn(dialogPositionerStyles({ align }), className) })
29
+ );
30
+ </script>
31
+
32
+ <div {...mergedProps}>
33
+ {@render children?.()}
34
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { DialogPositionerProps } from '../types.js';
2
+ declare const Dialog: import("svelte").Component<DialogPositionerProps, {}, "ref">;
3
+ type Dialog = ReturnType<typeof Dialog>;
4
+ export default Dialog;