rimecms 0.25.14 → 0.26.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 (50) hide show
  1. package/dist/adapter-sqlite/where.js +12 -4
  2. package/dist/core/collections/api/get.server.js +6 -2
  3. package/dist/core/i18n/en/common.js +1 -1
  4. package/dist/core/i18n/en/fields.d.ts +2 -0
  5. package/dist/core/i18n/en/fields.js +3 -1
  6. package/dist/core/i18n/fr/fields.d.ts +2 -0
  7. package/dist/core/i18n/fr/fields.js +3 -1
  8. package/dist/fields/link/component/Link.svelte +4 -1
  9. package/dist/fields/relation/component/upload/Browse.svelte +133 -28
  10. package/dist/fields/select/component/Select.svelte +11 -6
  11. package/dist/fields/slug/component/Slug.svelte +8 -4
  12. package/dist/fields/textarea/component/TextArea.svelte +15 -10
  13. package/dist/fields/toggle/component/Toggle.svelte +8 -4
  14. package/dist/panel/components/fields/Error.svelte +13 -7
  15. package/dist/panel/components/sections/collection/{grid/grid-item → folder}/Folder.svelte +14 -6
  16. package/dist/panel/components/sections/collection/{grid/grid-item → folder}/FolderEdit.svelte +11 -11
  17. package/dist/panel/components/sections/collection/{grid/grid-item → folder}/FolderEdit.svelte.d.ts +2 -2
  18. package/dist/panel/components/sections/collection/{grid/grid-item → folder}/FolderWithActions.svelte +64 -23
  19. package/dist/panel/components/sections/collection/{grid/grid-item → folder}/FolderWithActions.svelte.d.ts +3 -2
  20. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +71 -29
  21. package/dist/panel/components/sections/collection/{header/create-folder/CreateFolder.svelte → grid/create-directory-dialog/CreateDirectoryDialog.svelte} +3 -17
  22. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte.d.ts +8 -0
  23. package/dist/panel/components/sections/collection/header/Header.svelte +0 -6
  24. package/dist/panel/components/sections/collection/header/SearchInput.svelte +23 -22
  25. package/dist/panel/components/sections/collection/header/SelectUI.svelte +16 -3
  26. package/dist/panel/components/sections/collection/list/CollectionList.svelte +35 -2
  27. package/dist/panel/components/sections/document/Document.svelte +17 -10
  28. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +24 -18
  29. package/dist/panel/components/ui/button/button.svelte +75 -51
  30. package/dist/panel/components/ui/command/command-input.svelte +2 -4
  31. package/dist/panel/components/ui/command/command-item.css +2 -4
  32. package/dist/panel/components/ui/context-menu/ContextMenuItem.svelte +10 -13
  33. package/dist/panel/components/ui/context-menu/ContextMenuItem.svelte.d.ts +2 -2
  34. package/dist/panel/components/ui/context-menu/context-menu-item.css +2 -4
  35. package/dist/panel/components/ui/dialog/dialog-content.css +12 -3
  36. package/dist/panel/components/ui/dialog/dialog-content.svelte +5 -1
  37. package/dist/panel/components/ui/dialog/dialog-content.svelte.d.ts +1 -1
  38. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +9 -5
  39. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +2 -4
  40. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +1 -2
  41. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +1 -2
  42. package/dist/panel/components/ui/input/input.svelte +55 -14
  43. package/dist/panel/components/ui/input/input.svelte.d.ts +8 -2
  44. package/dist/panel/components/ui/page-header/PageHeader.svelte +14 -9
  45. package/dist/panel/context/collection.svelte.d.ts +2 -0
  46. package/dist/panel/context/collection.svelte.js +9 -4
  47. package/dist/panel/style/mixins/index.css +0 -4
  48. package/package.json +1 -1
  49. package/dist/panel/components/sections/collection/header/create-folder/CreateFolder.svelte.d.ts +0 -7
  50. /package/dist/panel/components/sections/collection/{grid/grid-item → folder}/Folder.svelte.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Props } from './index.js';
3
-
3
+
4
4
  let {
5
5
  class: className,
6
6
  variant = 'default',
@@ -30,7 +30,12 @@
30
30
  {/snippet}
31
31
 
32
32
  {#if href}
33
- <a bind:this={ref} {href} class="rz-button rz-button--size-{size} rz-button--{variant} {className}" {...restProps}>
33
+ <a
34
+ bind:this={ref}
35
+ {href}
36
+ class="rz-button rz-button--size-{size} rz-button--{variant} {className}"
37
+ {...restProps}
38
+ >
34
39
  {@render iconProp()}
35
40
  {@render children?.()}
36
41
  </a>
@@ -46,9 +51,13 @@
46
51
  </button>
47
52
  {/if}
48
53
 
49
- <style>
50
- :root {
54
+ <style>/**************************************/
55
+
56
+ /* Font */
57
+
58
+ /**************************************/
51
59
 
60
+ :root {
52
61
  --rz-button-tl-radius: var(--rz-radius-md);
53
62
  --rz-button-tr-radius: var(--rz-radius-md);
54
63
  --rz-button-br-radius: var(--rz-radius-md);
@@ -59,16 +68,16 @@
59
68
  --rz-button-default-bg-hover: light-dark(hsl(var(--rz-gray-2)), hsl(var(--rz-gray-19)));
60
69
  --rz-button-default-bg-disabled: light-dark(hsl(var(--rz-gray-3)), hsl(var(--rz-gray-12)));
61
70
  --rz-button-default-fg: light-dark(hsl(var(--rz-gray-13)), hsl(var(--rz-gray-2)));
62
-
71
+
63
72
  /* Success variant */
64
73
  --rz-button-success-bg: hsl(var(--rz-color-spot) / 1);
65
74
  --rz-button-success-bg-hover: hsl(var(--rz-color-spot) / 0.6);
66
75
  --rz-button-success-bg-disabled: hsl(var(--rz-color-spot) / 0.3);
67
76
  --rz-button-success-fg: hsl(var(--rz-color-spot-fg) / 1);
68
-
77
+
69
78
  /* Outline variant */
70
79
  --rz-button-outline-bg: transparent;
71
- --rz-button-outline-fg: light-dark(hsl(var(--rz-gray-4)), hsl(var(--rz-gray-12))) ;
80
+ --rz-button-outline-fg: light-dark(hsl(var(--rz-gray-4)), hsl(var(--rz-gray-12)));
72
81
  --rz-button-outline-border: light-dark(hsl(var(--rz-gray-14)), hsl(var(--rz-gray-8)));
73
82
  --rz-button-outline-bg-hover: light-dark(hsl(var(--rz-gray-16)), hsl(var(--rz-gray-4)));
74
83
  /* border-width */
@@ -76,17 +85,17 @@
76
85
  --rz-button-outline-border-top-width: 1px;
77
86
  --rz-button-outline-border-right-width: 1px;
78
87
  --rz-button-outline-border-bottom-width: 1px;
79
-
88
+
80
89
  /* Ghost variant */
81
90
  --rz-button-ghost-bg: transparent;
82
- --rz-button-ghost-bg-hover: light-dark( hsl(var(--rz-gray-16)), hsl(var(--rz-gray-4)));
91
+ --rz-button-ghost-bg-hover: light-dark(hsl(var(--rz-gray-16)), hsl(var(--rz-gray-4)));
83
92
  --rz-button-ghost-fg: hsl(var(--rz-color-fg));
84
-
93
+
85
94
  /* Secondary variant */
86
95
  --rz-button-secondary-bg: light-dark(hsl(var(--rz-gray-16)), hsl(var(--rz-gray-3)));
87
96
  --rz-button-secondary-bg-hover: light-dark(
88
97
  hsl(var(--rz-gray-16)),
89
- color-mix( in hsl, white 3%, hsl(var(--rz-gray-3)))
98
+ color-mix(in hsl, white 3%, hsl(var(--rz-gray-3)))
90
99
  );
91
100
  --rz-button-secondary-fg: hsl(var(--rz-color-fg));
92
101
 
@@ -102,22 +111,24 @@
102
111
  --rz-button-text-fg-disabled: hsl(var(--rz-color-fg) / 0.4);
103
112
  }
104
113
 
105
- .rz-button {
114
+ .rz-button {
106
115
  flex-shrink: var(--rz-flex-shrink, unset);
107
116
  display: inline-flex;
108
117
  align-items: center;
109
118
  justify-content: center;
110
- border-radius: var(--rz-button-tl-radius) var(--rz-button-tr-radius) var(--rz-button-br-radius) var(--rz-button-bl-radius);
119
+ border-radius: var(--rz-button-tl-radius) var(--rz-button-tr-radius) var(--rz-button-br-radius)
120
+ var(--rz-button-bl-radius);
111
121
  white-space: nowrap;
112
122
  font-variation-settings: 'wght' 500;
113
123
  font-weight: 500;
114
- transition-property: box-shadow, color, background-color, border-color, text-decoration-color, fill, stroke;
124
+ transition-property:
125
+ box-shadow, color, background-color, border-color, text-decoration-color, fill, stroke;
115
126
  transition-duration: 0.25s;
116
127
  gap: var(--rz-size-2);
117
128
  fill: currentColor;
118
129
  }
119
130
 
120
- .rz-button:focus-visible {
131
+ .rz-button:focus-visible {
121
132
  /* --rz-ring-offset: 1px; */
122
133
  outline: none;
123
134
  box-shadow:
@@ -125,68 +136,73 @@
125
136
  0 0 0 calc(var(--rz-ring-offset, 0px) + 1px) hsl(var(--rz-color-ring) / var(--rz-ring-opacity, 1));
126
137
  }
127
138
 
128
- .rz-button:disabled,
139
+ .rz-button:disabled,
129
140
  .rz-button[disabled='true'] {
130
141
  opacity: 0.5;
131
142
  cursor: no-drop !important;
132
143
  }
133
144
 
134
- /**************************************/
135
- /* Sizes */
136
- /**************************************/
145
+ /**************************************/
137
146
 
138
- .rz-button--size-default {
147
+ /* Sizes */
148
+
149
+ /**************************************/
150
+
151
+ .rz-button--size-default {
139
152
  font-size: var(--rz-text-md);
140
153
  height: var(--rz-size-9);
141
154
  padding: var(--rz-size-2) var(--rz-size-4);
142
155
  }
143
156
 
144
- .rz-button--size-xs {
157
+ .rz-button--size-xs {
145
158
  height: var(--rz-size-6);
146
159
  padding: var(--rz-size-1) var(--rz-size-2);
147
160
  font-size: var(--rz-text-2xs);
148
161
  border-radius: var(--rz-radius-md);
149
162
  }
150
163
 
151
- .rz-button--size-sm {
164
+ .rz-button--size-sm {
152
165
  font-size: var(--rz-text-md);
153
166
  height: var(--rz-size-8);
154
167
  padding: var(--rz-size-2) var(--rz-size-3);
155
168
  border-radius: var(--rz-radius-md);
156
169
  }
157
170
 
158
- .rz-button--size-lg {
171
+ .rz-button--size-lg {
159
172
  font-size: var(--rz-text-md);
160
173
  height: var(--rz-size-12);
161
174
  padding: var(--rz-size-2) var(--rz-size-8);
162
175
  border-radius: var(--rz-radius-md);
163
176
  }
164
177
 
165
- .rz-button--size-xl {
178
+ .rz-button--size-xl {
166
179
  height: var(--rz-size-14);
167
180
  font-size: var(--rz-text-md);
168
181
  padding: var(--rz-size-2) var(--rz-size-8);
169
182
  border-radius: var(--rz-radius-md);
170
183
  }
171
184
 
172
- .rz-button--size-icon {
185
+ .rz-button--size-icon {
173
186
  border-radius: var(--rz-radius-lg);
174
187
  height: var(--rz-size-9);
175
188
  width: var(--rz-size-9);
176
189
  padding: var(--rz-size-1);
177
190
  }
178
191
 
179
- .rz-button--size-icon-sm {
192
+ .rz-button--size-icon-sm {
180
193
  height: var(--rz-size-8);
181
194
  width: var(--rz-size-8);
182
195
  }
183
196
 
184
- /**************************************/
185
- /* Variants */
186
- /**************************************/
197
+ /**************************************/
198
+
199
+ /* Variants */
187
200
 
188
- /** Default */
189
- .rz-button--default {
201
+ /**************************************/
202
+
203
+ /** Default */
204
+
205
+ .rz-button--default {
190
206
  background-color: var(--rz-button-default-bg);
191
207
  color: var(--rz-button-default-fg);
192
208
  &:hover:not(:disabled) {
@@ -197,8 +213,9 @@
197
213
  }
198
214
  }
199
215
 
200
- /** Success */
201
- .rz-button--success {
216
+ /** Success */
217
+
218
+ .rz-button--success {
202
219
  background-color: var(--rz-button-success-bg);
203
220
  color: var(--rz-button-success-fg);
204
221
  &:hover {
@@ -209,27 +226,29 @@
209
226
  }
210
227
  }
211
228
 
212
- /** Outline */
213
- .rz-button--outline {
229
+ /** Outline */
230
+
231
+ .rz-button--outline {
214
232
  border-style: solid;
215
233
  border-color: var(--rz-button-outline-border);
216
-
234
+
217
235
  border-left-width: var(--rz-button-outline-border-left-width);
218
236
  border-top-width: var(--rz-button-outline-border-top-width);
219
237
  border-right-width: var(--rz-button-outline-border-right-width);
220
238
  border-bottom-width: var(--rz-button-outline-border-bottom-width);
221
-
239
+
222
240
  background-color: var(--rz-button-outline-bg);
223
241
  color: var(--rz-button-outline-fg);
224
-
242
+
225
243
  &:hover:not(:disabled) {
226
244
  /* border-color: var(--rz-button-outline-border-hover); */
227
245
  background-color: var(--rz-button-outline-bg-hover);
228
246
  }
229
247
  }
230
248
 
231
- /** Ghost */
232
- .rz-button--ghost {
249
+ /** Ghost */
250
+
251
+ .rz-button--ghost {
233
252
  background-color: var(--rz-button-ghost-bg);
234
253
  color: var(--rz-button-ghost-fg);
235
254
 
@@ -238,8 +257,9 @@
238
257
  }
239
258
  }
240
259
 
241
- /** Secondary */
242
- .rz-button--secondary {
260
+ /** Secondary */
261
+
262
+ .rz-button--secondary {
243
263
  background-color: var(--rz-button-secondary-bg);
244
264
  color: var(--rz-button-secondary-fg);
245
265
 
@@ -248,8 +268,9 @@
248
268
  }
249
269
  }
250
270
 
251
- /** Link */
252
- .rz-button--link {
271
+ /** Link */
272
+
273
+ .rz-button--link {
253
274
  background: var(--rz-button-link-bg);
254
275
  color: var(--rz-button-link-fg);
255
276
  text-underline-offset: 4px;
@@ -260,15 +281,16 @@
260
281
  }
261
282
  }
262
283
 
263
- /** Text */
264
- .rz-button--text {
284
+ /** Text */
285
+
286
+ .rz-button--text {
265
287
  padding-left: 0;
266
288
  padding-right: 0;
267
289
  background-color: var(--rz-button-text-bg);
268
290
  color: var(--rz-button-text-fg);
269
291
  font-variation-settings: 'wght' 600;
270
292
  font-weight: 600;
271
- gap: var(-rz-size-2);
293
+ gap: var(--rz-size-2);
272
294
 
273
295
  &:hover {
274
296
  color: var(--rz-button-text-fg-hover);
@@ -279,11 +301,13 @@
279
301
  }
280
302
  }
281
303
 
282
- /**************************************/
283
- /* With Icon */
284
- /**************************************/
304
+ /**************************************/
305
+
306
+ /* With Icon */
307
+
308
+ /**************************************/
285
309
 
286
- .rz-button__icon,
310
+ .rz-button__icon,
287
311
  .rz-button--text__icon {
288
312
  display: grid;
289
313
  place-content: center;
@@ -27,10 +27,8 @@
27
27
  align-items: center;
28
28
  border-top-left-radius: var(--rz-radius-md);
29
29
  border-top-right-radius: var(--rz-radius-md);
30
- padding-left: var(--rz-size-3);
31
- padding-right: var(--rz-size-3);
32
- padding-top: var(--rz-size-1);
33
- padding-bottom: var(--rz-size-1);
30
+ padding-inline: var(--rz-size-3);
31
+ padding-block: var(--rz-size-1);
34
32
 
35
33
  &:global([data-focused]) {
36
34
  box-shadow:
@@ -8,10 +8,8 @@
8
8
  min-height: var(--rz-input-height);
9
9
  align-items: center;
10
10
  gap: var(--rz-size-2);
11
- padding-left: var(--rz-size-2);
12
- padding-right: var(--rz-size-2);
13
- padding-top: var(--rz-size-1-5);
14
- padding-bottom: var(--rz-size-1-5);
11
+ padding-inline: var(--rz-size-2);
12
+ padding-block: var(--rz-size-1-5);
15
13
  font-size: var(--rz-text-sm);
16
14
  outline: none;
17
15
  }
@@ -1,17 +1,14 @@
1
1
  <script lang="ts">
2
- import type { Snippet } from "svelte";
3
- import { ContextMenu, type ContextMenuItemProps, type WithoutChild } from "bits-ui";
4
- import './context-menu-item.css'
2
+ import { ContextMenu, type ContextMenuItemProps } from 'bits-ui';
3
+ import type { Snippet } from 'svelte';
4
+ import './context-menu-item.css';
5
5
 
6
- type Props = ContextMenuItemProps & {
7
- children: Snippet;
8
- };
9
- let {
10
- children,
11
- ...restProps
12
- }: Props = $props();
6
+ type Props = ContextMenuItemProps & {
7
+ children: Snippet;
8
+ };
9
+ let { children, ...restProps }: Props = $props();
13
10
  </script>
14
-
11
+
15
12
  <ContextMenu.Item class="rz-context-menu-item" {...restProps}>
16
- {@render children()}
17
- </ContextMenu.Item>
13
+ {@render children()}
14
+ </ContextMenu.Item>
@@ -1,5 +1,5 @@
1
- import type { Snippet } from "svelte";
2
- import { type ContextMenuItemProps } from "bits-ui";
1
+ import { type ContextMenuItemProps } from 'bits-ui';
2
+ import type { Snippet } from 'svelte';
3
3
  import './context-menu-item.css';
4
4
  type Props = ContextMenuItemProps & {
5
5
  children: Snippet;
@@ -10,10 +10,8 @@
10
10
  border-radius: var(--rz-radius-md);
11
11
  outline: none;
12
12
  color: hsl(var(--rz-color-fg));
13
- padding-top: var(--rz-size-1);
14
- padding-bottom: var(--rz-size-1);
15
- padding-left: var(--rz-size-2);
16
- padding-right: var(--rz-size-2);
13
+ padding-block: var(--rz-size-2);
14
+ padding-inline: var(--rz-size-3);
17
15
  &[data-highlighted] {
18
16
  background-color: var(--rz-popover-highlight-bg);
19
17
  }
@@ -14,6 +14,12 @@
14
14
  box-shadow: var(--rz-shadow-lg);
15
15
  border-radius: var(--rz-radius-lg);
16
16
  margin: 0 var(--gutter);
17
+
18
+ &.rz-dialog-content--xl {
19
+ height: calc(100vh - 4 * var(--gutter));
20
+ overflow-y: auto;
21
+ top: 50%;
22
+ }
17
23
  }
18
24
 
19
25
  @media (min-width: 768px) {
@@ -26,9 +32,12 @@
26
32
  .rz-dialog-content--lg {
27
33
  width: var(--rz-size-lg);
28
34
  }
35
+ .rz-dialog-content--xl {
36
+ width: calc(100vw - 4 * var(--gutter));
37
+ }
29
38
  }
30
39
 
31
- .rz-dialog-content__close {
40
+ [data-dialog-close] {
32
41
  color: hsl(var(--rz-color-fg) / 0.7);
33
42
  position: absolute;
34
43
  right: var(--rz-size-4);
@@ -38,7 +47,7 @@
38
47
  transition: opacity 0.2s;
39
48
  }
40
49
 
41
- .rz-dialog-content__close:focus {
50
+ [data-dialog-close]:focus {
42
51
  outline: none;
43
52
  /* --rz-ring-offset-2: 2px; */
44
53
  box-shadow:
@@ -46,6 +55,6 @@
46
55
  0 0 0 calc(var(--rz-ring-offset, 0px) + 1px) hsl(var(--rz-color-ring) / var(--rz-ring-opacity, 1));
47
56
  }
48
57
 
49
- .rz-dialog-content__close:disabled {
58
+ [data-dialog-close]:disabled {
50
59
  pointer-events: none;
51
60
  }
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { X } from '@lucide/svelte';
2
3
  import {
3
4
  Dialog as DialogPrimitive,
4
5
  type DialogContentSnippetProps,
@@ -23,7 +24,7 @@
23
24
  }
24
25
  ]
25
26
  >;
26
- size?: 'sm' | 'default' | 'lg';
27
+ size?: 'sm' | 'default' | 'lg' | 'xl';
27
28
  } = $props();
28
29
  </script>
29
30
 
@@ -34,6 +35,9 @@
34
35
  class="rz-dialog-content rz-dialog-content--{size} {className}"
35
36
  {...restProps}
36
37
  >
38
+ <Dialog.Close>
39
+ <X size="18" />
40
+ </Dialog.Close>
37
41
  {@render children?.()}
38
42
  </DialogPrimitive.Content>
39
43
  </Dialog.Portal>
@@ -8,7 +8,7 @@ type $$ComponentProps = WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
8
8
  props: Record<string, unknown>;
9
9
  }
10
10
  ]>;
11
- size?: 'sm' | 'default' | 'lg';
11
+ size?: 'sm' | 'default' | 'lg' | 'xl';
12
12
  };
13
13
  declare const DialogContent: import("svelte").Component<$$ComponentProps, {}, "ref">;
14
14
  type DialogContent = ReturnType<typeof DialogContent>;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
+ import { Check, Minus } from '@lucide/svelte';
2
3
  import { DropdownMenu as DropdownMenuPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
3
- import { Minus, Check } from '@lucide/svelte';
4
4
 
5
5
  import type { Snippet } from 'svelte';
6
6
 
@@ -35,8 +35,13 @@
35
35
  {/snippet}
36
36
  </DropdownMenuPrimitive.CheckboxItem>
37
37
 
38
- <style>
39
- :global {
38
+ <style>/**************************************/
39
+
40
+ /* Font */
41
+
42
+ /**************************************/
43
+
44
+ :global {
40
45
  .rz-dropdown-checkbox {
41
46
  position: relative;
42
47
  display: flex;
@@ -49,8 +54,7 @@
49
54
  padding-left: var(--rz-size-8);
50
55
  font-size: var(--rz-text-sm);
51
56
  outline: none;
52
- padding-top: var(--rz-size-1-5);
53
- padding-bottom: var(--rz-size-1-5);
57
+ padding-block: var(--rz-size-1-5);
54
58
  & [data-disabled] {
55
59
  pointer-events: none;
56
60
  opacity: 0.5;
@@ -9,10 +9,8 @@
9
9
  gap: var(--rz-size-2);
10
10
  border-radius: var(--rz-radius-md);
11
11
  outline: none;
12
- padding-top: var(--rz-size-1-5);
13
- padding-bottom: var(--rz-size-1-5);
14
- padding-left: var(--rz-size-2);
15
- padding-right: var(--rz-size-2);
12
+ padding-block: var(--rz-size-1-5);
13
+ padding-inline: var(--rz-size-2);
16
14
 
17
15
  &[data-highlighted] {
18
16
  background-color: var(--rz-popover-highlight-bg);
@@ -10,8 +10,7 @@
10
10
  padding-left: var(--rz-size-8);
11
11
  font-size: var(--rz-text-sm);
12
12
  outline: none;
13
- padding-top: var(--rz-size-1-5);
14
- padding-bottom: var(--rz-size-1-5);
13
+ padding-block: var(--rz-size-1-5);
15
14
  }
16
15
 
17
16
  .rz-dropdown-radio[data-disabled] {
@@ -1,6 +1,5 @@
1
1
  .rz-dropdown-separator {
2
2
  background-color: hsl(var(--rz-color-border));
3
- margin-top: var(--rz-size-1);
4
- margin-bottom: var(--rz-size-1);
3
+ margin-block: var(--rz-size-1);
5
4
  height: 1px;
6
5
  }
@@ -1,5 +1,7 @@
1
1
  <script lang="ts">
2
+ import type { IconProps } from '@lucide/svelte';
2
3
  import type { WithElementRef, WithoutChildren } from 'bits-ui';
4
+ import type { Component } from 'svelte';
3
5
  import type { HTMLInputAttributes } from 'svelte/elements';
4
6
 
5
7
  type PrimitiveInputAttributes = WithElementRef<HTMLInputAttributes>;
@@ -8,20 +10,34 @@
8
10
  ref = $bindable(null),
9
11
  value = $bindable(),
10
12
  class: className,
13
+ icon,
11
14
  ...restProps
12
- }: WithoutChildren<PrimitiveInputAttributes> = $props();
15
+ }: WithoutChildren<PrimitiveInputAttributes> & { icon?: Component<IconProps> } = $props();
13
16
  </script>
14
17
 
15
- <input bind:this={ref} class="rz-input {className}" bind:value {...restProps} />
18
+ <div class="rz-input-wrapper {className}">
19
+ {#if icon}
20
+ {@const Icon = icon}
21
+ <div class="rz-input__icon">
22
+ <Icon size={14} strokeWidth="2px" />
23
+ </div>
24
+ {/if}
25
+ <input bind:this={ref} class="rz-input" bind:value {...restProps} />
26
+ </div>
16
27
 
17
- <style>
18
- :root {
28
+ <style>/**************************************/
29
+
30
+ /* Font */
31
+
32
+ /**************************************/
33
+
34
+ :root {
19
35
  --rz-input-border-color: light-dark(hsl(var(--rz-gray-14)), hsl(var(--rz-gray-6) / 0.6));
20
36
  --rz-input-padding-x: var(--rz-size-3);
21
37
  --rz-input-padding-y: var(--rz-size-1);
22
38
  }
23
39
 
24
- .rz-input {
40
+ .rz-input {
25
41
  border: 1px solid var(--rz-input-border-color);
26
42
  background-color: hsl(var(--rz-input-bg));
27
43
  display: flex;
@@ -32,7 +48,11 @@
32
48
  padding: var(--rz-input-padding-y) var(--rz-input-padding-x);
33
49
  }
34
50
 
35
- input.rz-input:is(:-webkit-autofill, :-webkit-autofill) {
51
+ .rz-input__icon + .rz-input {
52
+ padding-left: calc(var(--rz-input-padding-x) + var(--rz-size-6));
53
+ }
54
+
55
+ input.rz-input:is(:-webkit-autofill, :-webkit-autofill) {
36
56
  --color: color-mix(in lch, hsl(var(--rz-input-bg)), hsl(var(--rz-color-spot)) 12%);
37
57
  background-color: var(--color) !important;
38
58
  box-shadow: 0 0 0 1000px var(--color) inset !important;
@@ -40,21 +60,23 @@
40
60
  -webkit-text-fill-color: hsl(var(--rz-color-fg) / 1) !important;
41
61
  }
42
62
 
43
- input.rz-input:is(:-webkit-autofill, :autofill) {
63
+ input.rz-input:is(:-webkit-autofill, :autofill) {
44
64
  --color: color-mix(in lch, hsl(var(--rz-input-bg)), hsl(var(--rz-color-spot)) 12%);
45
65
  background-color: var(--color) !important;
46
66
  box-shadow: 0 0 0 1000px var(--color) inset !important;
47
67
  color: hsl(var(--rz-color-fg) / 1) !important;
48
68
  -webkit-text-fill-color: hsl(var(--rz-color-fg) / 1) !important;
49
69
  }
50
- input.rz-input:is(:-webkit-autofill, :-webkit-autofill):focus {
70
+
71
+ input.rz-input:is(:-webkit-autofill, :-webkit-autofill):focus {
51
72
  --color: color-mix(in lch, hsl(var(--rz-input-bg)), hsl(var(--rz-color-spot)) 24%);
52
73
  background-color: var(--color) !important;
53
74
  box-shadow: 0 0 0 1000px var(--color) inset !important;
54
75
  color: hsl(var(--rz-color-fg) / 1) !important;
55
76
  -webkit-text-fill-color: hsl(var(--rz-color-fg) / 1) !important;
56
77
  }
57
- input.rz-input:is(:-webkit-autofill, :autofill):focus {
78
+
79
+ input.rz-input:is(:-webkit-autofill, :autofill):focus {
58
80
  --color: color-mix(in lch, hsl(var(--rz-input-bg)), hsl(var(--rz-color-spot)) 24%);
59
81
  background-color: var(--color) !important;
60
82
  box-shadow: 0 0 0 1000px var(--color) inset !important;
@@ -62,18 +84,20 @@
62
84
  -webkit-text-fill-color: hsl(var(--rz-color-fg) / 1) !important;
63
85
  }
64
86
 
65
- .rz-input:disabled {
87
+ .rz-input:disabled {
66
88
  opacity: 0.5;
67
89
  cursor: not-allowed;
68
90
  }
69
- .rz-input::-moz-placeholder {
91
+
92
+ .rz-input::-moz-placeholder {
70
93
  color: hsl(var(--rz-color-fg) / 0.5);
71
94
  }
72
- .rz-input::placeholder {
95
+
96
+ .rz-input::placeholder {
73
97
  color: hsl(var(--rz-color-fg) / 0.5);
74
98
  }
75
99
 
76
- .rz-input:focus-visible {
100
+ .rz-input:focus-visible {
77
101
  outline: none;
78
102
  /* --rz-ring-offset: 1px; */
79
103
  box-shadow:
@@ -81,10 +105,27 @@
81
105
  0 0 0 calc(var(--rz-ring-offset, 0px) + 1px) hsl(var(--rz-color-ring) / var(--rz-ring-opacity, 1));
82
106
  }
83
107
 
84
- .rz-input[data-error] {
108
+ .rz-input[data-error] {
85
109
  outline: none;
86
110
  box-shadow:
87
111
  0 0 0 var(--rz-ring-offset, 0px) hsl(var(--rz-ring-offset-bg, var(--rz-gray-6)) / 1),
88
112
  0 0 0 calc(var(--rz-ring-offset, 0px) + 1px) hsl(var(--rz-color-alert) / var(--rz-ring-opacity, 1));
89
113
  }
114
+
115
+ .rz-input-wrapper {
116
+ position: relative;
117
+
118
+ .rz-input__icon {
119
+ position: absolute;
120
+ left: var(--rz-size-3);
121
+ top: 50%;
122
+ transform: translateY(-50%);
123
+ pointer-events: none;
124
+ color: hsl(var(--rz-color-fg) / 0.4);
125
+ }
126
+
127
+ .rz-input__icon:has(+ .rz-input:focus-visible) {
128
+ color: hsl(var(--rz-color-fg));
129
+ }
130
+ }
90
131
  </style>
@@ -1,5 +1,11 @@
1
- import type { WithElementRef } from 'bits-ui';
1
+ import type { IconProps } from '@lucide/svelte';
2
+ import type { WithElementRef, WithoutChildren } from 'bits-ui';
3
+ import type { Component } from 'svelte';
2
4
  import type { HTMLInputAttributes } from 'svelte/elements';
3
- declare const Input: import("svelte").Component<Omit<WithElementRef<HTMLInputAttributes>, "children">, {}, "value" | "ref">;
5
+ type PrimitiveInputAttributes = WithElementRef<HTMLInputAttributes>;
6
+ type $$ComponentProps = WithoutChildren<PrimitiveInputAttributes> & {
7
+ icon?: Component<IconProps>;
8
+ };
9
+ declare const Input: Component<$$ComponentProps, {}, "value" | "ref">;
4
10
  type Input = ReturnType<typeof Input>;
5
11
  export default Input;