tera-system-ui 0.0.2 → 0.0.5

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 (133) hide show
  1. package/dist/actions/clickOutside.d.ts +6 -0
  2. package/dist/{components/side-navigation → actions}/clickOutside.js +3 -2
  3. package/dist/components/button/Button.d.ts +2 -2
  4. package/dist/components/button/Button.js +5 -5
  5. package/dist/components/button/Button.svelte +10 -8
  6. package/dist/components/button/Button.svelte.d.ts +3 -1
  7. package/dist/components/combobox/Combobox.d.ts +8 -0
  8. package/dist/components/combobox/Combobox.js +7 -0
  9. package/dist/components/combobox/Combobox.svelte +8 -0
  10. package/dist/components/combobox/Combobox.svelte.d.ts +3 -0
  11. package/dist/components/combobox/index.d.ts +1 -0
  12. package/dist/components/combobox/index.js +1 -0
  13. package/dist/components/command/command.d.ts +33 -0
  14. package/dist/components/command/command.js +512 -0
  15. package/dist/components/command/command.scss +73 -0
  16. package/dist/components/command/components/Command.svelte +120 -0
  17. package/dist/components/command/components/Command.svelte.d.ts +3 -0
  18. package/dist/components/command/components/CommandEmpty.svelte +30 -0
  19. package/dist/components/command/components/CommandEmpty.svelte.d.ts +3 -0
  20. package/dist/components/command/components/CommandGroup.svelte +110 -0
  21. package/dist/components/command/components/CommandGroup.svelte.d.ts +3 -0
  22. package/dist/components/command/components/CommandInput.svelte +93 -0
  23. package/dist/components/command/components/CommandInput.svelte.d.ts +7 -0
  24. package/dist/components/command/components/CommandItem.svelte +110 -0
  25. package/dist/components/command/components/CommandItem.svelte.d.ts +3 -0
  26. package/dist/components/command/components/CommandList.svelte +56 -0
  27. package/dist/components/command/components/CommandList.svelte.d.ts +5 -0
  28. package/dist/components/command/components/CommandLoading.svelte +29 -0
  29. package/dist/components/command/components/CommandLoading.svelte.d.ts +8 -0
  30. package/dist/components/command/components/CommandSeparator.svelte +21 -0
  31. package/dist/components/command/components/CommandSeparator.svelte.d.ts +3 -0
  32. package/dist/components/command/index.d.ts +12 -0
  33. package/dist/components/command/index.js +19 -0
  34. package/dist/components/command/types.d.ts +227 -0
  35. package/dist/components/command/types.js +1 -0
  36. package/dist/components/dialog/Dialog.d.ts +52 -0
  37. package/dist/components/dialog/Dialog.js +6 -0
  38. package/dist/components/dialog/Dialog.svelte +71 -118
  39. package/dist/components/dialog/Dialog.svelte.d.ts +2 -8
  40. package/dist/components/dialog/dialog.scss +78 -0
  41. package/dist/components/icons/IconArrowBigRightFilled.svelte +10 -0
  42. package/dist/components/icons/IconArrowBigRightFilled.svelte.d.ts +4 -0
  43. package/dist/components/icons/IconBookmarkPlus.svelte +10 -0
  44. package/dist/components/icons/IconBookmarkPlus.svelte.d.ts +4 -0
  45. package/dist/components/icons/IconChevronDown.svelte +10 -0
  46. package/dist/components/icons/IconChevronDown.svelte.d.ts +4 -0
  47. package/dist/components/icons/IconCopy.svelte +10 -0
  48. package/dist/components/icons/IconCopy.svelte.d.ts +4 -0
  49. package/dist/components/icons/IconCopyCheckFilled.svelte +10 -0
  50. package/dist/components/icons/IconCopyCheckFilled.svelte.d.ts +4 -0
  51. package/dist/components/icons/IconLoader2.svelte +10 -0
  52. package/dist/components/icons/IconLoader2.svelte.d.ts +4 -0
  53. package/dist/components/icons/IconPointFilled.svelte +10 -0
  54. package/dist/components/icons/IconPointFilled.svelte.d.ts +4 -0
  55. package/dist/components/icons/IconSearch.svelte +10 -0
  56. package/dist/components/icons/IconSearch.svelte.d.ts +4 -0
  57. package/dist/components/icons/IconSwitchHorizontal.svelte +10 -0
  58. package/dist/components/icons/IconSwitchHorizontal.svelte.d.ts +4 -0
  59. package/dist/components/icons/IconSwitchVertical.svelte +10 -0
  60. package/dist/components/icons/IconSwitchVertical.svelte.d.ts +4 -0
  61. package/dist/components/icons/index.d.ts +17 -0
  62. package/dist/components/icons/index.js +17 -0
  63. package/dist/components/input/Input.d.ts +116 -0
  64. package/dist/components/input/Input.js +36 -0
  65. package/dist/components/input/Input.svelte +19 -8
  66. package/dist/components/input/Input.svelte.d.ts +2 -22
  67. package/dist/components/language-picker-button/LanguagePickerButton.svelte +13 -10
  68. package/dist/components/language-picker-button/LanguagePickerButton.svelte.d.ts +0 -2
  69. package/dist/components/light-dark-toggle/LightDarkToggle.svelte +10 -10
  70. package/dist/components/popover/Popover.d.ts +15 -0
  71. package/dist/components/popover/Popover.js +8 -0
  72. package/dist/components/popover/Popover.svelte +137 -0
  73. package/dist/components/popover/Popover.svelte.d.ts +3 -0
  74. package/dist/components/popover/index.d.ts +1 -0
  75. package/dist/components/popover/index.js +1 -0
  76. package/dist/components/popover-responsive/PopoverResponsive.d.ts +8 -0
  77. package/dist/components/popover-responsive/PopoverResponsive.js +7 -0
  78. package/dist/components/popover-responsive/PopoverResponsive.svelte +87 -0
  79. package/dist/components/popover-responsive/PopoverResponsive.svelte.d.ts +11 -0
  80. package/dist/components/popover-responsive/index.d.ts +1 -0
  81. package/dist/components/popover-responsive/index.js +1 -0
  82. package/dist/components/side-navigation/SideNavigation.d.ts +2 -1
  83. package/dist/components/side-navigation/SideNavigation.js +8 -6
  84. package/dist/components/side-navigation/SideNavigation.svelte +44 -24
  85. package/dist/components/tera-ui-context/TeraUiContext.d.ts +11 -0
  86. package/dist/components/tera-ui-context/TeraUiContext.js +1 -0
  87. package/dist/components/tera-ui-context/TeraUiContext.svelte +21 -0
  88. package/dist/components/tera-ui-context/TeraUiContext.svelte.d.ts +3 -0
  89. package/dist/components/tera-ui-context/global-context.d.ts +3 -0
  90. package/dist/components/tera-ui-context/global-context.js +15 -0
  91. package/dist/components/tera-ui-context/index.d.ts +1 -0
  92. package/dist/components/tera-ui-context/index.js +1 -0
  93. package/dist/i18n/index.d.ts +1 -0
  94. package/dist/i18n/index.js +1 -0
  95. package/dist/i18n/language.d.ts +2 -0
  96. package/dist/i18n/language.js +10 -0
  97. package/dist/i18n.d.ts +1 -0
  98. package/dist/i18n.js +4 -0
  99. package/dist/index.d.ts +14 -1
  100. package/dist/index.js +14 -2
  101. package/dist/internal/command-score.d.ts +1 -0
  102. package/dist/internal/command-score.js +119 -0
  103. package/dist/internal/helpers/callbacks.d.ts +12 -0
  104. package/dist/internal/helpers/callbacks.js +15 -0
  105. package/dist/internal/helpers/event.d.ts +14 -0
  106. package/dist/internal/helpers/event.js +17 -0
  107. package/dist/internal/helpers/id.d.ts +1 -0
  108. package/dist/internal/helpers/id.js +4 -0
  109. package/dist/internal/helpers/index.d.ts +8 -0
  110. package/dist/internal/helpers/index.js +8 -0
  111. package/dist/internal/helpers/is.d.ts +4 -0
  112. package/dist/internal/helpers/is.js +10 -0
  113. package/dist/internal/helpers/kbd.d.ts +35 -0
  114. package/dist/internal/helpers/kbd.js +35 -0
  115. package/dist/internal/helpers/object.d.ts +2 -0
  116. package/dist/internal/helpers/object.js +19 -0
  117. package/dist/internal/helpers/sleep.d.ts +1 -0
  118. package/dist/internal/helpers/sleep.js +3 -0
  119. package/dist/internal/helpers/store.d.ts +29 -0
  120. package/dist/internal/helpers/store.js +80 -0
  121. package/dist/internal/helpers/style.d.ts +12 -0
  122. package/dist/internal/helpers/style.js +18 -0
  123. package/dist/internal/index.d.ts +3 -0
  124. package/dist/internal/index.js +3 -0
  125. package/dist/internal/types.d.ts +18 -0
  126. package/dist/internal/types.js +1 -0
  127. package/dist/themes/scrollbar.scss +37 -0
  128. package/dist/themes/tera-ui-base.css +25 -0
  129. package/package.json +39 -18
  130. package/scripts/generate-ts-index.js +137 -0
  131. package/dist/components/input/input.d.ts +0 -49
  132. package/dist/components/input/input.js +0 -14
  133. package/dist/components/side-navigation/clickOutside.d.ts +0 -4
@@ -0,0 +1,227 @@
1
+ import type { Expand, HTMLDivAttributes } from '../../internal/index.js';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+ import type { Writable } from 'svelte/store';
4
+ import type { Snippet } from "svelte";
5
+ export type LoadingProps = {
6
+ /** Estimated loading progress */
7
+ progress?: number;
8
+ /**
9
+ * Whether to delegate rendering to a custom element.
10
+ *
11
+ * The contents within the `Loading` component should be marked
12
+ * as `aria-hidden` to prevent screen readers from reading the
13
+ * contents while loading.
14
+ */
15
+ asChild?: boolean;
16
+ } & HTMLDivAttributes;
17
+ export type EmptyProps = {
18
+ /**
19
+ * Whether to delegate rendering to a custom element.
20
+ *
21
+ * Only receives `attrs`, no `action`.
22
+ */
23
+ asChild?: boolean;
24
+ } & HTMLDivAttributes;
25
+ export type SeparatorProps = {
26
+ /**
27
+ * Whether this separator is always rendered, regardless
28
+ * of the filter.
29
+ */
30
+ alwaysRender?: boolean;
31
+ /**
32
+ * Whether to delegate rendering to a custom element.
33
+ */
34
+ asChild?: boolean;
35
+ } & HTMLDivAttributes;
36
+ type BaseCommandProps = {
37
+ /**
38
+ * Controlled state store for the command menu.
39
+ * Initialize state using the `createState` function.
40
+ */
41
+ state?: Writable<State>;
42
+ /**
43
+ * An accessible label for the command menu.
44
+ * Not visible & only used for screen readers.
45
+ */
46
+ label?: string;
47
+ /**
48
+ * Optionally set to `false` to turn off the automatic filtering
49
+ * and sorting. If `false`, you must conditionally render valid
50
+ * items yourself.
51
+ */
52
+ shouldFilter?: boolean;
53
+ /**
54
+ * A custom filter function for whether each command item should
55
+ * match the query. It should return a number between `0` and `1`,
56
+ * with `1` being a perfect match, and `0` being no match, resulting
57
+ * in the item being hidden entirely.
58
+ *
59
+ * By default, it will use the `command-score` package to score.
60
+ */
61
+ filter?: (value: string, search: string) => number;
62
+ /**
63
+ * Optionally provide or bind to the selected command menu item.
64
+ */
65
+ value?: string;
66
+ /**
67
+ * A function that is called when the selected command menu item
68
+ * changes. It receives the new value as an argument.
69
+ */
70
+ onValueChange?: (value: string) => void;
71
+ /**
72
+ * Optionally set to `true` to enable looping through the items
73
+ * when the user reaches the end of the list using the keyboard.
74
+ */
75
+ loop?: boolean;
76
+ childrenWithProps?: Snippet<[any]>;
77
+ };
78
+ export type CommandProps = Expand<BaseCommandProps & {
79
+ /**
80
+ * Optionally provide custom ids for the command menu
81
+ * elements. These ids should be unique and are only
82
+ * necessary in very specific cases. Use with caution.
83
+ */
84
+ ids?: Partial<CommandIds>;
85
+ }> & HTMLDivAttributes & {
86
+ onKeydown?: (e: KeyboardEvent) => void;
87
+ onRequestCloseCommand?: () => void;
88
+ asChild?: boolean;
89
+ };
90
+ export type ListProps = {
91
+ /**
92
+ * The list element
93
+ */
94
+ el?: HTMLElement;
95
+ /**
96
+ * Whether to delegate rendering to a custom element.
97
+ *
98
+ * Provides 2 slot props: `container` & `list`.
99
+ * Container only has an `attrs` property, while `list` has
100
+ * `attrs` & `action` to be applied to the respective elements.
101
+ *
102
+ * The `list` wraps the `sizer`, and the `sizer` wraps the `items`, and
103
+ * is responsible for measuring the height of the items and setting the
104
+ * CSS variable to the height of the items.
105
+ */
106
+ asChild?: boolean;
107
+ } & HTMLDivAttributes;
108
+ export type InputProps = {
109
+ /**
110
+ * The input element
111
+ */
112
+ el?: HTMLInputElement;
113
+ /**
114
+ * Whether to delegate rendering to a custom element.
115
+ */
116
+ asChild?: boolean;
117
+ } & HTMLInputAttributes;
118
+ export type GroupProps = {
119
+ /**
120
+ * Optional heading to render for the group
121
+ */
122
+ heading?: string;
123
+ /**
124
+ * If heading isn't provided, you must provide a unique
125
+ * value for the group.
126
+ */
127
+ value?: string;
128
+ /**
129
+ * Whether or not this group is always rendered,
130
+ * regardless of filtering.
131
+ */
132
+ alwaysRender?: boolean;
133
+ /**
134
+ * Whether to delegate rendering to custom elements.
135
+ *
136
+ * Provides 3 slot props: `container`, `heading`, and `group`.
137
+ * Container has `attrs` & `action`, while `heading` & `group`
138
+ * only have `attrs` to be applied to the respective elements.
139
+ */
140
+ asChild?: boolean;
141
+ } & HTMLDivAttributes;
142
+ export type ItemProps = {
143
+ /**
144
+ * Whether this item is disabled.
145
+ */
146
+ disabled?: boolean;
147
+ /**
148
+ * A function called when this item is selected, either
149
+ * via click or keyboard selection.
150
+ */
151
+ onSelect?: (value: string) => void;
152
+ /**
153
+ * A unique value for this item.
154
+ * If not provided, it will be inferred from the rendered
155
+ * `textContent`. If your `textContent` is dynamic, you must
156
+ * provide a stable unique `value`.
157
+ */
158
+ value?: string;
159
+ /**
160
+ * Whether or not this item is always rendered,
161
+ * regardless of filtering.
162
+ */
163
+ alwaysRender?: boolean;
164
+ /**
165
+ * Whether to delegate rendering to a custom element.
166
+ * Will pass the `attrs` & `action` to be applied to the custom element.
167
+ */
168
+ asChild?: boolean;
169
+ /**
170
+ * Optionally override the default `id` generated for this item.
171
+ * NOTE: This must be unique across all items and is only necessary
172
+ * in very specific cases.
173
+ */
174
+ id?: string;
175
+ childrenWithProps?: Snippet<[{
176
+ action: (node: HTMLElement) => {
177
+ destroy(): void;
178
+ };
179
+ attrs: any;
180
+ }]>;
181
+ } & HTMLDivAttributes;
182
+ export type InputEvents = {
183
+ keydown: KeyboardEvent;
184
+ blur: FocusEvent;
185
+ input: Event;
186
+ focus: FocusEvent;
187
+ change: Event;
188
+ };
189
+ export type CommandOptionStores = {
190
+ [K in keyof Omit<Required<BaseCommandProps>, 'value'>]: Writable<CommandProps[K]>;
191
+ };
192
+ export type State = {
193
+ /** The value of the search query */
194
+ search: string;
195
+ /** The value of the selected command menu item */
196
+ value: string;
197
+ /** The filtered items */
198
+ filtered: {
199
+ /** The count of all visible items. */
200
+ count: number;
201
+ /** Map from visible item id to its search store. */
202
+ items: Map<string, number>;
203
+ /** Set of groups with at least one visible item. */
204
+ groups: Set<string>;
205
+ };
206
+ };
207
+ export type CommandIds = Record<'root' | 'label' | 'input' | 'list', string>;
208
+ export type Context = {
209
+ value: (id: string, value: string) => void;
210
+ item: (id: string, groupId: string | undefined) => () => void;
211
+ group: (id: string) => () => void;
212
+ filter: () => boolean;
213
+ label: string;
214
+ commandEl: Writable<HTMLElement | null>;
215
+ ids: CommandIds;
216
+ updateState: UpdateState;
217
+ };
218
+ type UpdateState = <K extends keyof State>(key: K, value: State[K], preventScroll?: boolean) => void;
219
+ export type ConextStore = Writable<Context>;
220
+ export type StateStore = Writable<State> & {
221
+ updateState: UpdateState;
222
+ };
223
+ export type Group = {
224
+ id: string;
225
+ alwaysRender: boolean;
226
+ };
227
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -17,6 +17,12 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
17
17
  dialog: string;
18
18
  };
19
19
  };
20
+ padding: {
21
+ none: {
22
+ dialogContainer: string;
23
+ body: string;
24
+ };
25
+ };
20
26
  }, {
21
27
  base: string;
22
28
  dialog: string;
@@ -42,6 +48,12 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
42
48
  dialog: string;
43
49
  };
44
50
  };
51
+ padding: {
52
+ none: {
53
+ dialogContainer: string;
54
+ body: string;
55
+ };
56
+ };
45
57
  }, {
46
58
  size: {
47
59
  xs: {
@@ -60,6 +72,12 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
60
72
  dialog: string;
61
73
  };
62
74
  };
75
+ padding: {
76
+ none: {
77
+ dialogContainer: string;
78
+ body: string;
79
+ };
80
+ };
63
81
  }>, {
64
82
  size: {
65
83
  xs: {
@@ -78,6 +96,12 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
78
96
  dialog: string;
79
97
  };
80
98
  };
99
+ padding: {
100
+ none: {
101
+ dialogContainer: string;
102
+ body: string;
103
+ };
104
+ };
81
105
  }, {
82
106
  base: string;
83
107
  dialog: string;
@@ -103,6 +127,12 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
103
127
  dialog: string;
104
128
  };
105
129
  };
130
+ padding: {
131
+ none: {
132
+ dialogContainer: string;
133
+ body: string;
134
+ };
135
+ };
106
136
  }, {
107
137
  base: string;
108
138
  dialog: string;
@@ -128,6 +158,12 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
128
158
  dialog: string;
129
159
  };
130
160
  };
161
+ padding: {
162
+ none: {
163
+ dialogContainer: string;
164
+ body: string;
165
+ };
166
+ };
131
167
  }, {
132
168
  size: {
133
169
  xs: {
@@ -146,10 +182,26 @@ export declare const styles: import("tailwind-variants").TVReturnType<{
146
182
  dialog: string;
147
183
  };
148
184
  };
185
+ padding: {
186
+ none: {
187
+ dialogContainer: string;
188
+ body: string;
189
+ };
190
+ };
149
191
  }>, unknown, unknown, undefined>>;
150
192
  type DialogVariants = VariantProps<typeof styles>;
151
193
  export interface DialogProps extends DialogVariants {
152
194
  children?: any;
153
195
  class?: string;
196
+ id?: string;
197
+ open?: boolean;
198
+ closeOnClickOutside?: boolean;
199
+ closeButton?: boolean;
200
+ header?: any;
201
+ footer?: any;
202
+ position?: 'top' | 'center';
203
+ staticRender?: boolean;
204
+ triggerRef?: HTMLElement;
205
+ focusTriggerAfterClose?: boolean;
154
206
  }
155
207
  export {};
@@ -25,6 +25,12 @@ export const styles = tv({
25
25
  full: {
26
26
  dialog: 'w-screen !max-w-screen max-h-[100svh] !rounded-none'
27
27
  },
28
+ },
29
+ padding: {
30
+ none: {
31
+ dialogContainer: 'py-0',
32
+ body: 'px-0',
33
+ }
28
34
  }
29
35
  }
30
36
  });
@@ -2,6 +2,8 @@
2
2
  import {type DialogProps, styles} from "./Dialog";
3
3
  import IconX from "../icons/IconX.svelte";
4
4
  import {Button} from "../button";
5
+ import './dialog.scss'
6
+ import {sleep} from "../../internal/helpers/sleep";
5
7
 
6
8
  let {
7
9
  children, open = $bindable(),
@@ -11,29 +13,42 @@
11
13
  header,
12
14
  footer,
13
15
  class: className,
16
+ position = 'center',
17
+ padding,
18
+ staticRender = false,
19
+ triggerRef,
20
+ focusTriggerAfterClose,
14
21
  ...props
15
- }: DialogProps & {
16
- id?: string
17
- open?: boolean
18
- closeOnClickOutside?: boolean
19
- closeButton?: boolean,
20
- header?: any,
21
- footer?: any,
22
- } = $props();
22
+ }: DialogProps = $props();
23
23
 
24
24
  let dialog;
25
25
 
26
+ let hasOpened = $state(false);
27
+
26
28
  // Watch for prop changes to open/close the dialog
27
29
  $effect(() => {
28
- if (open) dialog?.showModal();
29
- else dialog?.close();
30
+ if (open) {
31
+ stillAnimating = open
32
+ dialog?.showModal();
33
+
34
+ if (!hasOpened)
35
+ hasOpened = true
36
+ } else {
37
+ dialog?.close()
38
+ sleep(200).then(() => {
39
+ stillAnimating = open
40
+ console.log('stillAnimating', stillAnimating)
41
+ })
42
+
43
+ if (focusTriggerAfterClose && hasOpened && triggerRef) {
44
+ triggerRef.focus()
45
+ }
46
+ }
30
47
  })
31
48
 
32
-
33
49
  // Close dialog on clicking outside (optional)
34
- function handleClickOutside(event) {
35
- if (closeOnClickOutside && event.target === dialog) {
36
- open = false;
50
+ function handleClickOutside(e) {
51
+ if (closeOnClickOutside && e.target === dialog) {
37
52
  dialog?.close();
38
53
  }
39
54
  }
@@ -45,110 +60,48 @@
45
60
 
46
61
  // onmousedown={closeOnClickOutside ? 'event.target==this && this.close()' : ''}
47
62
 
48
- const {base, dialog: dialogStyle, dialogContainer, header: headerStyle, body, footer: footerStyle} = styles({size})
49
- </script>
50
-
51
- <dialog class={dialogStyle() + ` ${className}`}
52
- bind:this={dialog}
53
- onclose={handleClose}
54
- data-onclose="asdf"
55
- onmousedown={(e) => {
56
- if (closeOnClickOutside && e.target === dialog) {
57
- dialog?.close();
58
- }
59
- }}
60
- >
61
- <button class=""></button>
62
- <div class={"dialog-box " + dialogContainer()}>
63
- {#if (closeButton)}
64
- <form method="dialog">
65
- <Button class="absolute right-1 top-1 [&>svg]:opacity-45 [&>svg]:hover:opacity-90" icon variant="ghost"
66
- size="md">
67
- <IconX/>
68
- </Button>
69
- </form>
70
- {/if}
71
-
72
- {#if header}
73
- <header class={headerStyle()}>
74
- {@render header?.()}
75
- </header>
76
- {/if}
77
-
78
- <main class={body()}>
79
- {@render children?.()}
80
- </main>
81
- {#if footer}
82
- <footer class={footerStyle()}>
83
- {@render footer?.()}
84
- </footer>
85
- {/if}
86
- </div>
87
- </dialog>
88
-
89
-
90
- <style>
91
- .dialog-box {
92
- max-height: min(calc(100svh - 3rem), 50rem);
93
- overflow-y: auto;
94
- overscroll-behavior: contain;
95
- display: grid;
96
- grid-template-rows: auto 1fr auto;
97
- position: relative;
98
- background-color: hsl(var(--tw---token-color-neutral-token-1));
99
- }
100
-
101
- dialog, dialog:modal {
102
- max-width: calc(100vw - 1rem);
103
- max-height: 100svh;
104
- }
105
-
106
- dialog {
107
- --transition-duration: 0.2s;
108
-
109
- transform: translateY(0px);
110
-
111
- &, &::backdrop {
112
- transition: display var(--transition-duration) allow-discrete, overlay var(--transition-duration) allow-discrete, opacity var(--transition-duration), transform var(--transition-duration) allow-discrete;
113
- opacity: 0;
114
-
115
- }
116
-
117
- &[open] {
118
- opacity: 1;
119
- &::backdrop {
120
- opacity: 1;
121
- }
122
- }
123
-
124
- &:not([open]) {
125
- opacity: 0;
126
- transform: translateY(60px) scale(0.9); /* Reset to initial closed position */
127
-
128
- &::backdrop {
129
- opacity: 0; /* Fade-out backdrop */
130
- }
131
- }
132
-
133
- @starting-style {
134
- &[open] {
135
- transform: translateY(-60px) scale(0.9);
136
-
137
- }
138
-
139
- &[open],
140
- &[open]::backdrop {
141
- opacity: 0;
142
- }
143
- }
144
- }
63
+ const {base, dialog: dialogStyle, dialogContainer, header: headerStyle, body, footer: footerStyle} = styles({
64
+ size,
65
+ padding
66
+ })
145
67
 
68
+ let stillAnimating = $state()
146
69
 
147
- dialog::backdrop {
148
- background-color: hsl(var(--tw---token-color-neutral-token-13) / 0.2);
149
- --tw-backdrop-blur: blur(0.2rem);
150
- -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
151
- backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
152
- }
70
+ </script>
153
71
 
154
- </style>
72
+ {#if staticRender || (!staticRender && (open || stillAnimating))}
73
+ <dialog class={dialogStyle() + ` ${className}`}
74
+ data-position={position}
75
+ bind:this={dialog}
76
+ onclose={handleClose}
77
+ onmousedown={handleClickOutside}
78
+ >
79
+ <button class=""></button>
80
+ <div class={"dialog-box " + dialogContainer()}>
81
+ {#if (closeButton)}
82
+ <form method="dialog">
83
+ <Button class="absolute right-1 top-1 [&>svg]:opacity-45 [&>svg]:hover:opacity-90 z-10" icon
84
+ variant="ghost"
85
+ size="sm">
86
+ <IconX/>
87
+ </Button>
88
+ </form>
89
+ {/if}
90
+
91
+ {#if header}
92
+ <header class={headerStyle()}>
93
+ {@render header?.()}
94
+ </header>
95
+ {/if}
96
+
97
+ <main class={body()}>
98
+ {@render children?.()}
99
+ </main>
100
+ {#if footer}
101
+ <footer class={footerStyle()}>
102
+ {@render footer?.()}
103
+ </footer>
104
+ {/if}
105
+ </div>
106
+ </dialog>
107
+ {/if}
@@ -1,10 +1,4 @@
1
1
  import { type DialogProps } from "./Dialog";
2
- declare const Dialog: import("svelte").Component<DialogProps & {
3
- id?: string;
4
- open?: boolean;
5
- closeOnClickOutside?: boolean;
6
- closeButton?: boolean;
7
- header?: any;
8
- footer?: any;
9
- }, {}, "open">;
2
+ import './dialog.scss';
3
+ declare const Dialog: import("svelte").Component<DialogProps, {}, "open">;
10
4
  export default Dialog;
@@ -0,0 +1,78 @@
1
+ .dialog-box {
2
+ max-height: min(calc(100svh - 2rem), 50rem);
3
+ overflow-y: auto;
4
+ overscroll-behavior: contain;
5
+ display: grid;
6
+ grid-template-rows: auto 1fr auto;
7
+ @apply bg-neutral-token-1 relative;
8
+
9
+ }
10
+
11
+ dialog, dialog:modal {
12
+ max-width: calc(100vw - 1rem);
13
+ max-height: 100svh;
14
+ }
15
+
16
+ dialog {
17
+ &[data-position="top"] {
18
+ position: fixed;
19
+ top: 0;
20
+ left: 50%;
21
+ transform: translateX(-50%) translateY(-1rem);
22
+ margin: 0;
23
+ }
24
+
25
+
26
+ --transition-duration: 0.2s;
27
+ transform: translateY(0px);
28
+
29
+ &, &::backdrop {
30
+ transition: display var(--transition-duration) allow-discrete, overlay var(--transition-duration) allow-discrete, opacity var(--transition-duration), transform var(--transition-duration) allow-discrete,;
31
+ opacity: 0;
32
+ }
33
+
34
+ &[open] {
35
+ opacity: 1;
36
+ &::backdrop {
37
+ opacity: 1;
38
+ }
39
+ }
40
+
41
+ &:not([open]) {
42
+ transform: translateX(0) translateY(-40px);
43
+
44
+ &[data-position="top"] {
45
+ top: 0;
46
+ left: 50%;
47
+ transform: translateX(-50%) translateY(-40px);
48
+ }
49
+
50
+ opacity: 0;
51
+
52
+ &::backdrop {
53
+ opacity: 0; /* Fade-out backdrop */
54
+ }
55
+ }
56
+
57
+ @starting-style {
58
+ &[open] {
59
+ transform: translateX(0) translateY(-40px);
60
+
61
+ &[data-position="top"] {
62
+ top: 0;
63
+ left: 50%;
64
+ transform: translateX(-50%) translateY(-40px);
65
+ }
66
+ }
67
+
68
+ &[open],
69
+ &[open]::backdrop {
70
+ opacity: 0;
71
+ }
72
+ }
73
+ }
74
+
75
+
76
+ dialog::backdrop {
77
+ @apply backdrop-blur-[0.2rem] bg-neutral-token-13/20;
78
+ }
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import {type IconsProps, styles} from "./Icons";
3
+ import {IconArrowBigRightFilled} from "@tabler/icons-svelte";
4
+
5
+ let {children, ...props}: IconsProps = $props();
6
+
7
+ </script>
8
+
9
+ <IconArrowBigRightFilled class={styles({...props})}/>
10
+
@@ -0,0 +1,4 @@
1
+ import { type IconsProps } from "./Icons";
2
+ import { IconArrowBigRightFilled } from "@tabler/icons-svelte";
3
+ declare const IconArrowBigRightFilled: import("svelte").Component<IconsProps, {}, "">;
4
+ export default IconArrowBigRightFilled;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import {type IconsProps, styles} from "./Icons";
3
+ import {IconBookmarkPlus} from "@tabler/icons-svelte";
4
+
5
+ let {children, ...props}: IconsProps = $props();
6
+
7
+ </script>
8
+
9
+ <IconBookmarkPlus class={styles({...props})}/>
10
+
@@ -0,0 +1,4 @@
1
+ import { type IconsProps } from "./Icons";
2
+ import { IconBookmarkPlus } from "@tabler/icons-svelte";
3
+ declare const IconBookmarkPlus: import("svelte").Component<IconsProps, {}, "">;
4
+ export default IconBookmarkPlus;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import {type IconsProps, styles} from "./Icons";
3
+ import {IconChevronDown} from "@tabler/icons-svelte";
4
+
5
+ let {children, ...props}: IconsProps = $props();
6
+
7
+ </script>
8
+
9
+ <IconChevronDown class={styles({...props})}/>
10
+