@stubber/form-fields 1.0.5 → 1.0.8

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 (28) hide show
  1. package/dist/fields/components/Arraybuilder.svelte +1 -1
  2. package/dist/fields/components/Checkbox.svelte +5 -5
  3. package/dist/fields/components/Contactselector.svelte +49 -46
  4. package/dist/fields/components/Currency.svelte +1 -1
  5. package/dist/fields/components/Dataindication.svelte +9 -6
  6. package/dist/fields/components/Date.svelte +10 -8
  7. package/dist/fields/components/Datetime.svelte +10 -8
  8. package/dist/fields/components/Email.svelte +10 -7
  9. package/dist/fields/components/Fieldbuilder.svelte +1 -1
  10. package/dist/fields/components/Fieldsbuilder.svelte +3 -3
  11. package/dist/fields/components/File.svelte +1 -4
  12. package/dist/fields/components/Jsoneditor.svelte +3 -8
  13. package/dist/fields/components/Map.svelte +1 -1
  14. package/dist/fields/components/Note.svelte +1 -1
  15. package/dist/fields/components/Number.svelte +7 -6
  16. package/dist/fields/components/Objectbuilder.svelte +7 -5
  17. package/dist/fields/components/Qrcodescanner.svelte +4 -2
  18. package/dist/fields/components/Radio.svelte +3 -3
  19. package/dist/fields/components/Screenrecorder.svelte +4 -2
  20. package/dist/fields/components/Screenshot.svelte +4 -2
  21. package/dist/fields/components/Scrollandreaddisplay.svelte +2 -2
  22. package/dist/fields/components/Select.svelte +47 -31
  23. package/dist/fields/components/Selectresource.svelte +54 -37
  24. package/dist/fields/components/SmartText.svelte +30 -37
  25. package/dist/fields/components/Telephone.svelte +1 -1
  26. package/dist/fields/components/Text.svelte +1 -1
  27. package/dist/fields/components/Voicenote.svelte +4 -2
  28. package/package.json +1 -1
@@ -75,7 +75,7 @@
75
75
  </script>
76
76
 
77
77
  {#if new_entry}
78
- <div class="flex flex-col w-full text-surface-900">
78
+ <div class="flex flex-col w-full text-surface-900 my-2">
79
79
  <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
80
80
  {label}
81
81
  </Label>
@@ -76,11 +76,7 @@
76
76
 
77
77
  {#if $internal}
78
78
  <div class="flex flex-col w-full {!isValid ? `text-danger-500` : `text-surface-900`}">
79
- <div class="flex space-x-3 relative mt-2 items-center">
80
- <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
81
- {label}
82
- </Label>
83
-
79
+ <div class="flex space-x-3 relative my-1 items-center">
84
80
  <Checkbox
85
81
  on:keydown={(e) => {
86
82
  if (e.key === "Enter") {
@@ -93,6 +89,10 @@
93
89
  name={state_key}
94
90
  bind:checked={$internal.checked}
95
91
  />
92
+
93
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
94
+ {label}
95
+ </Label>
96
96
  </div>
97
97
  {#if validationMessage}
98
98
  <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
@@ -6,6 +6,7 @@
6
6
  import { writable } from "svelte/store";
7
7
  import { syncStoreToStore } from "../../utils/syncing";
8
8
 
9
+ import { scale } from "svelte/transition";
9
10
  import { Label } from "@stubber/ui/label";
10
11
  import { Button } from "@stubber/ui/button";
11
12
 
@@ -276,10 +277,10 @@
276
277
  placeholder={label}
277
278
  class="bg-gradient-to-b from-[#2727271F] to-[#27272719] shadow-select
278
279
  flex h-7 w-full items-center justify-between rounded px-3 py-2
279
- text-sm
280
+ text-sm focus:outline-none
280
281
  [&>span]:line-clamp-1 aria-[invalid]:border-destructive
281
282
  placeholder:text-black
282
- {!isValid ? 'ring-danger-500' : 'ring-surface-300 focus:ring-primary-400'}"
283
+ {!isValid ? 'ring-danger-500' : 'ring-surface-300 focus:ring-transparent'}"
283
284
  bind:value={filter_text}
284
285
  autocomplete="off"
285
286
  />
@@ -298,50 +299,52 @@
298
299
  {/if}
299
300
  </div>
300
301
  {#if is_focused}
301
- <div use:teleport class="z-10 w-full absolute inset-y-[70px]">
302
- {#if items?.length > 0}
303
- <ul
304
- class="bg-popover text-popover-foreground relative min-w-[8rem]
305
- overflow-hidden rounded-md border shadow-md outline-none
306
- max-h-[200px] overflow-y-auto w-full p-1"
307
- >
308
- {#each items as item, index (item?._value?._key)}
309
- <li
310
- class="group {$internal.focused_index === index
311
- ? 'bg-primary-400'
312
- : ''} hover:bg-primary-400 focus-within:bg-primary-400 text-field cursor-default"
313
- >
314
- <button
315
- on:click|preventDefault={() => setSelected(item)}
316
- class="selectitem relative flex w-full cursor-default
317
- select-none items-center rounded-sm py-1 pl-8 pr-2
318
- text-sm outline-none hover:bg-accent
319
- hover:text-accent-foreground
320
- data-[highlighted]:bg-accent
321
- data-[highlighted]:text-accent-foreground
322
- data-[disabled]:pointer-events-none
323
- data-[disabled]:opacity-50"
324
- >
325
- {item._label}
326
- {#if item.is_personal}
327
- <div class="mx-2 bg-surface-300 rounded-full text-xs p-0.5 px-2 text-white">
328
- Import from personal
329
- </div>
330
- {/if}
331
- {#if item?._value?._key == $internal?.selected_item?._value?._key}
332
- <i class="absolute left-2 h-3.5 w-3.5 fa-regular fa-check" />
333
- {/if}
334
- </button>
335
- </li>
336
- {/each}
337
- </ul>
338
- {:else}
339
- <div
340
- class="h-[100px] flex items-center justify-center w-full bg-white shadow-lg rounded-md ring-1 ring-surface-300"
341
- >
342
- <span class="text-paragraph text-surface-400">Start typing to search...</span>
343
- </div>
344
- {/if}
302
+ <div use:teleport class="z-10 w-full inset-y-[70px] mt-1">
303
+ <div
304
+ transition:scale={{
305
+ start: 0.95,
306
+ opacity: 0,
307
+ duration: 50,
308
+ }}
309
+ class="bg-popover text-popover-foreground relative min-w-[8rem]
310
+ overflow-hidden rounded-md border shadow-md outline-none
311
+ max-h-[200px] overflow-y-auto w-full p-1"
312
+ >
313
+ {#if items?.length > 0}
314
+ <ul>
315
+ {#each items as item, index (item?._value?._key)}
316
+ <li class="group {$internal.focused_index === index ? 'bg-primary-400' : ''}">
317
+ <button
318
+ type="button"
319
+ on:click|preventDefault={() => setSelected(item)}
320
+ class="selectitem relative flex w-full cursor-default
321
+ select-none items-center rounded-sm py-1 pl-8 pr-2
322
+ text-sm outline-none hover:bg-accent
323
+ hover:text-accent-foreground
324
+ data-[highlighted]:bg-accent
325
+ data-[highlighted]:text-accent-foreground
326
+ data-[disabled]:pointer-events-none
327
+ data-[disabled]:opacity-50"
328
+ >
329
+ {item._label}
330
+ {#if item.is_personal}
331
+ <div class="mx-2 bg-surface-300 rounded-full text-xs p-0.5 px-2 text-white">
332
+ Import from personal
333
+ </div>
334
+ {/if}
335
+ {#if item?._value?._key == $internal?.selected_item?._value?._key}
336
+ <i class="absolute left-2 h-3.5 w-3.5 fa-regular fa-check" />
337
+ {/if}
338
+ </button>
339
+ </li>
340
+ {/each}
341
+ </ul>
342
+ {:else}
343
+ <div class="flex items-center justify-center py-4">
344
+ <span class="text-sm text-surface-400">Start typing to search...</span>
345
+ </div>
346
+ {/if}
347
+ </div>
345
348
  </div>
346
349
  {/if}
347
350
  <div class="mt-1 ml-auto">
@@ -179,7 +179,7 @@
179
179
  }}
180
180
  class="flex flex-col w-full text-surface-900"
181
181
  >
182
- <Label for="input_{state_key}" class={hide_label ? "hidden" : ""}>
182
+ <Label for="input_{state_key}" class="block py-2{hide_label ? 'hidden' : ''}">
183
183
  {label}
184
184
  </Label>
185
185
  <div
@@ -1,6 +1,8 @@
1
1
  <script>
2
2
  import _ from "lodash-es";
3
3
 
4
+ import { Label } from "@stubber/ui/label";
5
+
4
6
  export let field;
5
7
 
6
8
  $: state_key = $field.state?.state_key;
@@ -12,13 +14,13 @@
12
14
  $: value = !value_is_string ? JSON.stringify($field.data?.base, null, 2) : $field.data?.base;
13
15
  </script>
14
16
 
15
- <div class="flex flex-col w-full text-surface-900">
16
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
17
+ <div class="flex flex-col w-full text-surface-900 my-2">
18
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
17
19
  {label}
18
- </label>
20
+ </Label>
19
21
  <div class="relative mt-2 rounded-md">
20
22
  <div
21
- class="block bg-surface-50 w-full text-field rounded-md border-0 py-2 pl-3 text-surface-900 ring-1 ring-inset ring-surface-100 focus:ring-primary-400 focus:outline-none placeholder:text-surface-400 focus:ring-2 focus:ring-inset"
23
+ class="bg-gradient-to-b from-[#2727271F] to-[#27272719] shadow-select flex items-center h-7 w-full rounded px-3 py-2 text-sm focus:outline-none placeholder:text-black"
22
24
  >
23
25
  {#if value_is_string}
24
26
  {value}
@@ -27,9 +29,10 @@
27
29
  {/if}
28
30
  </div>
29
31
  </div>
32
+
30
33
  {#if validationMessage}
31
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
34
+ <Label class=" {!isValid ? `text-danger-500` : `text-success-500`}">
32
35
  {validationMessage}
33
- </p>
36
+ </Label>
34
37
  {/if}
35
38
  </div>
@@ -5,6 +5,8 @@
5
5
  import { onMount } from "svelte";
6
6
  import { writable } from "svelte/store";
7
7
 
8
+ import { Label } from "@stubber/ui/label";
9
+
8
10
  export let field;
9
11
 
10
12
  const internal = writable();
@@ -64,10 +66,10 @@
64
66
  </script>
65
67
 
66
68
  {#if $internal}
67
- <div class="flex flex-col w-full text-surface-900">
68
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
69
+ <div class="flex flex-col w-full text-surface-900 my-2">
70
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
69
71
  {label}
70
- </label>
72
+ </Label>
71
73
  <div class="relative mt-2 rounded-md">
72
74
  <input
73
75
  on:keydown={(e) => {
@@ -78,17 +80,17 @@
78
80
  type="date"
79
81
  id="input_{state_key}"
80
82
  placeholder={label}
81
- class="block w-full rounded-md border-0 py-2 pl-3 pr-2 text-surface-900 ring-1 ring-inset {!isValid
82
- ? 'ring-danger-500'
83
- : 'ring-surface-300 focus:ring-primary-400'} focus:outline-none placeholder:text-surface-400 focus:ring-2 focus:ring-inset"
83
+ class="bg-gradient-to-b from-[#2727271F] to-[#27272719] shadow-select block h-7 w-full rounded px-3 py-2 text-sm focus:outline-none
84
+ placeholder:text-black
85
+ {!isValid ? 'ring-danger-500' : 'ring-surface-300 focus:ring-transparent'}"
84
86
  name={state_key}
85
87
  bind:value={$internal.raw}
86
88
  />
87
89
  </div>
88
90
  {#if validationMessage}
89
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
91
+ <Label class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
90
92
  {validationMessage}
91
- </p>
93
+ </Label>
92
94
  {/if}
93
95
  </div>
94
96
  {/if}
@@ -5,6 +5,8 @@
5
5
  import { onMount } from "svelte";
6
6
  import { writable } from "svelte/store";
7
7
 
8
+ import { Label } from "@stubber/ui/label";
9
+
8
10
  export let field;
9
11
 
10
12
  const internal = writable();
@@ -64,10 +66,10 @@
64
66
  </script>
65
67
 
66
68
  {#if $internal}
67
- <div class="flex flex-col w-full text-surface-900">
68
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
69
+ <div class="flex flex-col w-full text-surface-900 my-2">
70
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
69
71
  {label}
70
- </label>
72
+ </Label>
71
73
  <div class="relative mt-2 rounded-md">
72
74
  <input
73
75
  on:keydown={(e) => {
@@ -78,17 +80,17 @@
78
80
  type="datetime-local"
79
81
  id="input_{state_key}"
80
82
  placeholder={label}
81
- class="block w-full text-field rounded-md border-0 py-2 pl-3 pr-2 text-surface-900 ring-1 ring-inset {!isValid
82
- ? 'ring-danger-500'
83
- : 'ring-surface-300 focus:ring-primary-400'} focus:outline-none placeholder:text-surface-400 focus:ring-2 focus:ring-inset"
83
+ class="bg-gradient-to-b from-[#2727271F] to-[#27272719] shadow-select block h-7 w-full rounded px-3 py-2 text-sm focus:outline-none
84
+ placeholder:text-black
85
+ {!isValid ? 'ring-danger-500' : 'ring-surface-300 focus:ring-transparent'}"
84
86
  name={state_key}
85
87
  bind:value={$internal.raw}
86
88
  />
87
89
  </div>
88
90
  {#if validationMessage}
89
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
91
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>
90
92
  {validationMessage}
91
- </p>
93
+ </Label>
92
94
  {/if}
93
95
  </div>
94
96
  {/if}
@@ -5,6 +5,9 @@
5
5
  import { onMount } from "svelte";
6
6
  import { writable } from "svelte/store";
7
7
 
8
+ import { Label } from "@stubber/ui/label";
9
+ import { Input } from "@stubber/ui/input";
10
+
8
11
  export let field;
9
12
 
10
13
  const internal = writable();
@@ -94,12 +97,12 @@
94
97
  </script>
95
98
 
96
99
  {#if $internal}
97
- <div class="flex flex-col w-full text-surface-900">
98
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
100
+ <div class="flex flex-col w-full text-surface-900 my-2">
101
+ <Label for="input_{state_key}" class="block py-2 {hide_label ? 'hidden' : ''}">
99
102
  {label}
100
- </label>
103
+ </Label>
101
104
  <div class="relative rounded-md">
102
- <input
105
+ <Input
103
106
  on:keydown={(e) => {
104
107
  if (e.key === "Enter") {
105
108
  e.preventDefault();
@@ -108,7 +111,7 @@
108
111
  type="text"
109
112
  id="input_{state_key}"
110
113
  placeholder={label}
111
- class="block w-full text-field rounded-md border-0 py-2 pl-3 text-surface-900 ring-1 ring-inset {!isValid
114
+ class="block w-full {!isValid
112
115
  ? 'ring-danger-500'
113
116
  : 'ring-surface-300 focus:ring-primary-400'} focus:outline-none placeholder:text-surface-400 focus:ring-2 focus:ring-inset"
114
117
  name={state_key}
@@ -116,9 +119,9 @@
116
119
  />
117
120
  </div>
118
121
  {#if validationMessage}
119
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
122
+ <Label class=" {!isValid ? `text-danger-500` : `text-success-500`}">
120
123
  {validationMessage}
121
- </p>
124
+ </Label>
122
125
  {/if}
123
126
  </div>
124
127
  {/if}
@@ -213,7 +213,7 @@
213
213
  });
214
214
  </script>
215
215
 
216
- <div class="flex flex-col w-full text-surface-900">
216
+ <div class="flex flex-col w-full text-surface-900 my-2">
217
217
  <Label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
218
218
  {label}
219
219
  </Label>
@@ -109,10 +109,10 @@
109
109
  });
110
110
  </script>
111
111
 
112
- <div class="flex flex-col w-full text-surface-900">
113
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
112
+ <div class="flex flex-col w-full text-surface-900 my-2">
113
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
114
114
  {label}
115
- </label>
115
+ </Label>
116
116
  {#if initial_form}
117
117
  <Form bind:form={settings_form} {initial_form} {dependencies} />
118
118
  {/if}
@@ -166,10 +166,7 @@
166
166
  </script>
167
167
 
168
168
  {#if $internal}
169
- <Label
170
- for="input_{state_key}"
171
- class="block text-label text-surface-900 {hide_label ? 'hidden' : ''}"
172
- >
169
+ <Label for="input_{state_key}" class="block py-2 text-surface-900 {hide_label ? 'hidden' : ''}">
173
170
  {label}
174
171
  </Label>
175
172
  <div class="w-full flex flex-col {!isValid ? 'border-b border-warning-500' : ''}">
@@ -78,10 +78,10 @@
78
78
  </script>
79
79
 
80
80
  {#if $internal && $internal}
81
- <div class="flex flex-col w-full text-surface-900 jse-theme-dark">
82
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
81
+ <div class="flex flex-col w-full text-surface-900 my-2 jse-theme-dark">
82
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
83
83
  {label}
84
- </label>
84
+ </Label>
85
85
  <JSONEditor bind:content={$internal.content} {readOnly} bind:mode={$internal.mode} />
86
86
  {#if validationMessage}
87
87
  <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
@@ -127,11 +127,6 @@
127
127
  border-radius: 10px !important;
128
128
  }
129
129
 
130
- :global(.jse-contents) {
131
- background-color: #efeff0 !important;
132
- border-radius: 0px !important;
133
- }
134
-
135
130
  :global(.jse-navigation-bar) {
136
131
  border-radius: 0px !important;
137
132
  }
@@ -127,7 +127,7 @@
127
127
  </script>
128
128
 
129
129
  {#if $internal}
130
- <div class="flex flex-col w-full text-surface-900">
130
+ <div class="flex flex-col w-full text-surface-900 my-2">
131
131
  <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
132
132
  {label}
133
133
  </label>
@@ -66,7 +66,7 @@
66
66
  </script>
67
67
 
68
68
  {#if $internal}
69
- <div class="flex flex-col w-full text-surface-900">
69
+ <div class="flex flex-col w-full text-surface-900 my-2">
70
70
  <Label for="input_{state_key}" class=" {hide_label ? 'hidden' : ''}">
71
71
  {label}
72
72
  </Label>
@@ -6,6 +6,7 @@
6
6
  import { writable } from "svelte/store";
7
7
 
8
8
  import { Label } from "@stubber/ui/label";
9
+ import { Input } from "@stubber/ui/input";
9
10
 
10
11
  export let field;
11
12
 
@@ -87,12 +88,12 @@
87
88
  </script>
88
89
 
89
90
  {#if $internal}
90
- <div class="flex flex-col w-full text-surface-900">
91
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
91
+ <div class="flex flex-col w-full text-surface-900 my-2">
92
+ <Label for="input_{state_key}" class="block py-2{hide_label ? 'hidden' : ''}">
92
93
  {label}
93
- </label>
94
+ </Label>
94
95
  <div class="relative rounded-md">
95
- <input
96
+ <Input
96
97
  on:keydown={(e) => {
97
98
  if (e.key === "Enter") {
98
99
  e.preventDefault();
@@ -101,9 +102,9 @@
101
102
  type="number"
102
103
  id="input_{state_key}"
103
104
  placeholder={label}
104
- class="block w-full text-field rounded-md border-0 py-2 pl-3 text-surface-900 ring-1 ring-inset {!isValid
105
+ class="block w-full {!isValid
105
106
  ? 'ring-danger-500'
106
- : 'ring-surface-300 focus:ring-primary-400'} focus:outline-none placeholder:text-surface-400 focus:ring-2 focus:ring-inset"
107
+ : 'ring-surface-300 focus:ring-primary-400'} "
107
108
  name={state_key}
108
109
  min={min_setting}
109
110
  max={max_setting}
@@ -6,6 +6,8 @@
6
6
  import { onMount } from "svelte";
7
7
  import { deepEqual } from "fast-equals";
8
8
 
9
+ import { Label } from "@stubber/ui/label";
10
+
9
11
  export let form;
10
12
  export let field;
11
13
 
@@ -137,16 +139,16 @@
137
139
  });
138
140
  </script>
139
141
 
140
- <div class="flex flex-col w-full text-surface-900">
141
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
142
+ <div class="flex flex-col w-full text-surface-900 my-2">
143
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
142
144
  {label}
143
- </label>
145
+ </Label>
144
146
  {#if initial_form}
145
147
  <Form bind:form={settings_form} {initial_form} {dependencies} />
146
148
  {/if}
147
149
  {#if validationMessage}
148
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
150
+ <Label class=" {!isValid ? `text-danger-500` : `text-success-500`}">
149
151
  {validationMessage}
150
- </p>
152
+ </Label>
151
153
  {/if}
152
154
  </div>
@@ -8,6 +8,8 @@
8
8
  import { Html5Qrcode } from "html5-qrcode";
9
9
  import { Button } from "@stubber/ui/button";
10
10
 
11
+ import { Label } from "@stubber/ui/label";
12
+
11
13
  export let field;
12
14
 
13
15
  const internal = writable();
@@ -162,9 +164,9 @@
162
164
  {/if}
163
165
 
164
166
  <div class="flex flex-col w-full text-surface-900">
165
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
167
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
166
168
  {label}
167
- </label>
169
+ </Label>
168
170
  <div class="relative mt-2 rounded-md">
169
171
  <div class="flex items-center space-x-3">
170
172
  {#if $internal.raw}
@@ -85,15 +85,15 @@
85
85
  </script>
86
86
 
87
87
  {#if $internal}
88
- <div class="flex flex-col w-full text-surface-900">
89
- <Label for="input_{state_key}" class=" {hide_label ? 'hidden' : ''}">
88
+ <div class="flex flex-col w-full text-surface-900 my-2">
89
+ <Label for="input_{state_key}" class=" block py-2 {hide_label ? 'hidden' : ''}">
90
90
  {label}
91
91
  </Label>
92
92
  {#if items?.length}
93
93
  <fieldset
94
94
  class="flex flex-col border {!isValid
95
95
  ? 'border-warning-500'
96
- : 'border-surface-300'} rounded-md px-2 py-1"
96
+ : 'border-surface-100'} rounded-md px-2 py-1"
97
97
  id="input_{state_key}"
98
98
  >
99
99
  {#each items as item}
@@ -6,6 +6,8 @@
6
6
  import { writable } from "svelte/store";
7
7
  import { syncStoreToStore } from "../../utils/syncing";
8
8
 
9
+ import { Label } from "@stubber/ui/label";
10
+
9
11
  export let form;
10
12
  export let field;
11
13
 
@@ -210,9 +212,9 @@
210
212
 
211
213
  {#if $internal}
212
214
  <div class="flex flex-col w-full text-surface-900">
213
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
215
+ <Label for="input_{state_key}" class="block py-2 {hide_label ? 'hidden' : ''}">
214
216
  {label}
215
- </label>
217
+ </Label>
216
218
  <div>
217
219
  <Button variant={isRecording ? "destructive" : "default"} on:click={toggleRecording}>
218
220
  {#if isRecording}
@@ -6,6 +6,8 @@
6
6
  import { writable } from "svelte/store";
7
7
  import { syncStoreToStore } from "../../utils/syncing";
8
8
 
9
+ import { Label } from "@stubber/ui/label";
10
+
9
11
  export let form;
10
12
  export let field;
11
13
 
@@ -212,9 +214,9 @@
212
214
 
213
215
  {#if $internal}
214
216
  <div class="flex flex-col w-full text-surface-900">
215
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
217
+ <Label for="input_{state_key}" class="block py-2 {hide_label ? 'hidden' : ''}">
216
218
  {label}
217
- </label>
219
+ </Label>
218
220
  <div>
219
221
  <Button variant={isRecording ? "destructive" : "default"} on:click={toggleRecording}>
220
222
  {#if isRecording}
@@ -82,11 +82,11 @@
82
82
  </script>
83
83
 
84
84
  {#if $internal}
85
- <div class="flex flex-col w-full text-surface-900">
85
+ <div class="flex flex-col w-full text-surface-900 my-2">
86
86
  <!-- div with inner shadow -->
87
87
  <div
88
88
  bind:this={outer}
89
- class="border max-h-[300px] overflow-y-scroll shadow-inner"
89
+ class="border max-h-[300px] overflow-y-scroll shadow-inner rounded-md"
90
90
  on:scroll={handleScroll}
91
91
  >
92
92
  <div class="p-6 px-2">
@@ -7,6 +7,7 @@
7
7
  import * as utils from "../../utils/index.js";
8
8
 
9
9
  import { Label } from "@stubber/ui/label";
10
+ import { scale } from "svelte/transition";
10
11
 
11
12
  export let field;
12
13
 
@@ -150,11 +151,11 @@
150
151
  filter_text = $field?.data?.base_label ?? "";
151
152
  }
152
153
  }}
153
- class="relative flex flex-col w-full text-surface-900"
154
+ class="relative flex flex-col w-full text-surface-900 my-2"
154
155
  >
155
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
156
+ <Label for="input_{state_key}" class="block py-2{hide_label ? 'hidden' : ''}">
156
157
  {label}
157
- </label>
158
+ </Label>
158
159
  <div class="relative flex rounded-md">
159
160
  <input
160
161
  on:keydown={(e) => {
@@ -187,10 +188,10 @@
187
188
  placeholder={label}
188
189
  class="bg-gradient-to-b from-[#2727271F] to-[#27272719] shadow-select
189
190
  flex h-7 w-full items-center justify-between rounded px-3 py-2
190
- text-sm
191
+ text-sm focus:outline-none
191
192
  [&>span]:line-clamp-1 aria-[invalid]:border-destructive
192
193
  placeholder:text-black
193
- {!isValid ? 'ring-danger-500' : 'ring-surface-300 focus:ring-primary-400'}"
194
+ {!isValid ? 'ring-danger-500' : 'ring-surface-300 focus:ring-transparent'}"
194
195
  name={state_key}
195
196
  bind:value={filter_text}
196
197
  autocomplete="off"
@@ -200,34 +201,49 @@
200
201
  </div>
201
202
  </div>
202
203
  {#if is_focused}
203
- <div use:teleport class="z-10 w-full inset-y-[70px]">
204
- <ul
204
+ <div use:teleport class="z-10 w-full inset-y-[70px] mt-1">
205
+ <div
206
+ transition:scale={{
207
+ start: 0.95,
208
+ opacity: 0,
209
+ duration: 50,
210
+ }}
205
211
  class="bg-popover text-popover-foreground relative min-w-[8rem]
206
- overflow-hidden rounded-md border shadow-md outline-none
207
- max-h-[200px] overflow-y-auto w-full p-1"
212
+ overflow-hidden rounded-md border shadow-md outline-none
213
+ max-h-[200px] overflow-y-auto w-full p-1"
208
214
  >
209
- {#each filteritems as item, index (item._key)}
210
- <li class="group {$internal.focused_index === index ? 'bg-primary-400' : ''} ">
211
- <button
212
- type="button"
213
- on:click|preventDefault={() => setSelected(item)}
214
- class="selectitem relative flex w-full cursor-default
215
- select-none items-center rounded-sm py-1 pl-8 pr-2
216
- text-sm outline-none hover:bg-accent
217
- hover:text-accent-foreground
218
- data-[highlighted]:bg-accent
219
- data-[highlighted]:text-accent-foreground
220
- data-[disabled]:pointer-events-none
221
- data-[disabled]:opacity-50"
222
- >
223
- {item._label}
224
- {#if item._key === $internal?.selected_item_key}
225
- <i class="absolute left-2 h-3.5 w-3.5 fa-regular fa-check" />
226
- {/if}
227
- </button>
228
- </li>
229
- {/each}
230
- </ul>
215
+ {#if filteritems.length > 0}
216
+ <ul>
217
+ {#each filteritems as item, index (item._key)}
218
+ <li class="group {$internal.focused_index === index ? 'bg-primary-400' : ''} ">
219
+ <button
220
+ type="button"
221
+ on:click|preventDefault={() => setSelected(item)}
222
+ class="selectitem relative flex w-full cursor-default
223
+ select-none items-center rounded-sm py-1 pl-8 pr-2
224
+ text-sm outline-none hover:bg-accent
225
+ hover:text-accent-foreground
226
+ data-[highlighted]:bg-accent
227
+ data-[highlighted]:text-accent-foreground
228
+ data-[disabled]:pointer-events-none
229
+ data-[disabled]:opacity-50"
230
+ >
231
+ {item._label}
232
+ {#if item._key === $internal?.selected_item_key}
233
+ <i class="absolute left-2 h-3.5 w-3.5 fa-regular fa-check" />
234
+ {/if}
235
+ </button>
236
+ </li>
237
+ {/each}
238
+ </ul>
239
+ {:else}
240
+ <div class="flex items-center justify-center py-4">
241
+ <span class="text-sm text-surface-400">
242
+ {filter_text ? "No results found" : "Start typing to search..."}
243
+ </span>
244
+ </div>
245
+ {/if}
246
+ </div>
231
247
  </div>
232
248
  {/if}
233
249
  {#if validationMessage}
@@ -6,6 +6,9 @@
6
6
  import { writable } from "svelte/store";
7
7
  import { syncStoreToStore } from "../../utils/syncing";
8
8
 
9
+ import { scale } from "svelte/transition";
10
+ import { Label } from "@stubber/ui/label";
11
+
9
12
  export let form;
10
13
  export let field;
11
14
 
@@ -196,9 +199,9 @@
196
199
  }}
197
200
  class="relative flex flex-col w-full text-surface-900"
198
201
  >
199
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
202
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
200
203
  {label}
201
- </label>
204
+ </Label>
202
205
  <div class="relative flex mt-2 rounded-md">
203
206
  <input
204
207
  on:keydown={(e) => {
@@ -229,9 +232,12 @@
229
232
  type="select"
230
233
  id="input_mask{state_key}"
231
234
  placeholder={label}
232
- class="block w-full rounded-md border-0 py-1.5 pl-3 pr-9 text-field text-surface-900 ring-1 ring-inset {!isValid
233
- ? 'ring-danger-500'
234
- : 'ring-surface-300 focus:ring-primary-400'} focus:outline-none placeholder:text-surface-400 focus:ring-2 focus:ring-inset"
235
+ class="bg-gradient-to-b from-[#2727271F] to-[#27272719] shadow-select
236
+ flex h-7 w-full items-center justify-between rounded px-3 py-2
237
+ text-sm focus:outline-none
238
+ [&>span]:line-clamp-1 aria-[invalid]:border-destructive
239
+ placeholder:text-black
240
+ {!isValid ? 'ring-danger-500' : 'ring-surface-300 focus:ring-transparent'}"
235
241
  bind:value={filter_text}
236
242
  autocomplete="off"
237
243
  />
@@ -250,42 +256,53 @@
250
256
  {/if}
251
257
  </div>
252
258
  {#if is_focused}
253
- <div use:teleport class="z-10 w-full absolute inset-y-[70px]">
254
- {#if items?.length > 0}
255
- <ul
256
- class="block max-h-[200px] overflow-y-auto w-full bg-white shadow-lg rounded-md ring-1 ring-surface-300"
257
- >
258
- {#each items as item, index (item?._value?._key)}
259
- <li
260
- class="group {$internal.focused_index === index
261
- ? 'bg-primary-400'
262
- : ''} hover:bg-primary-400 focus-within:bg-primary-400 text-field cursor-default"
263
- >
264
- <button
265
- on:click|preventDefault={() => setSelected(item)}
266
- class="selectitem text-surface-900 group-hover:text-white focus:text-white focus:outline-none px-4 py-1.5 w-full flex items-center"
267
- >
268
- {item._label}
269
- {#if item?._value?._key == $internal?.selected_item?._value?._key}
270
- <i class="text-primary-400 ml-auto fa-regular fa-check" />
271
- {/if}
272
- </button>
273
- </li>
274
- {/each}
275
- </ul>
276
- {:else}
277
- <div
278
- class="h-[100px] flex items-center justify-center w-full bg-white shadow-lg rounded-md ring-1 ring-surface-300"
279
- >
280
- <span class="text-paragraph text-surface-400">Start typing to search...</span>
281
- </div>
282
- {/if}
259
+ <div use:teleport class="z-10 w-full inset-y-[70px] mt-1">
260
+ <div
261
+ transition:scale={{
262
+ start: 0.95,
263
+ opacity: 0,
264
+ duration: 50,
265
+ }}
266
+ class="bg-popover text-popover-foreground relative min-w-[8rem]
267
+ overflow-hidden rounded-md border shadow-md outline-none
268
+ max-h-[200px] overflow-y-auto w-full p-1"
269
+ >
270
+ {#if items?.length > 0}
271
+ <ul>
272
+ {#each items as item, index (item?._value?._key)}
273
+ <li class="group {$internal.focused_index === index ? 'bg-primary-400' : ''}">
274
+ <button
275
+ type="button"
276
+ on:click|preventDefault={() => setSelected(item)}
277
+ class="selectitem relative flex w-full cursor-default
278
+ select-none items-center rounded-sm py-1 pl-8 pr-2
279
+ text-sm outline-none hover:bg-accent
280
+ hover:text-accent-foreground
281
+ data-[highlighted]:bg-accent
282
+ data-[highlighted]:text-accent-foreground
283
+ data-[disabled]:pointer-events-none
284
+ data-[disabled]:opacity-50"
285
+ >
286
+ {item._label}
287
+ {#if item?._value?._key == $internal?.selected_item?._value?._key}
288
+ <i class="absolute left-2 h-3.5 w-3.5 fa-regular fa-check" />
289
+ {/if}
290
+ </button>
291
+ </li>
292
+ {/each}
293
+ </ul>
294
+ {:else}
295
+ <div class="flex items-center justify-center py-4">
296
+ <span class="text-sm text-surface-400">Start typing to search...</span>
297
+ </div>
298
+ {/if}
299
+ </div>
283
300
  </div>
284
301
  {/if}
285
302
  {#if validationMessage}
286
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
303
+ <Label class=" {!isValid ? `text-danger-500` : `text-success-500`}">
287
304
  {validationMessage}
288
- </p>
305
+ </Label>
289
306
  {/if}
290
307
  </div>
291
308
  {/if}
@@ -248,13 +248,13 @@
248
248
  </script>
249
249
 
250
250
  {#if $internal && is_string}
251
- <div class="flex flex-col w-full text-surface-900">
252
- <Label for="input_{state_key}" class="block{hide_label ? 'hidden' : ''}">
251
+ <div class="flex flex-col w-full text-surface-900 my-2">
252
+ <Label for="input_{state_key}" class="block py-2 {hide_label ? 'hidden' : ''}">
253
253
  {label}
254
254
  </Label>
255
255
  <div
256
256
  bind:this={editor_parent}
257
- class="stubber-cm text-field {isValid ? 'stubber-valid' : 'stubber-invalid'}"
257
+ class=" stubber-cm text-sm {isValid ? 'stubber-valid' : 'stubber-invalid'}"
258
258
  />
259
259
  {#if validationMessage}
260
260
  <Label class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
@@ -273,41 +273,32 @@
273
273
 
274
274
  <style>
275
275
  .stubber-cm :global(.cm-editor) {
276
- /* @apply rounded-md border-0 text-surface-900 ring-1 ring-inset ring-surface-300; */
276
+ /* Base styles */
277
+ background-color: rgba(255, 255, 255, 0.85);
277
278
  border-radius: 0.375rem;
278
- border-width: 0px;
279
+ --tw-border-opacity: 1;
280
+ border-color: hsl(var(--input) / var(--tw-border-opacity, 1));
281
+ border-width: 1px;
282
+ border-style: solid;
283
+ width: 100%;
279
284
  color: rgb(31 41 51);
280
- --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width)
281
- var(--tw-ring-offset-color);
282
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width))
283
- var(--tw-ring-color);
284
- box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
285
- --tw-ring-inset: inset;
286
- --tw-ring-opacity: 1;
287
- --tw-ring-color: rgb(188 191 194 / var(--tw-ring-opacity));
288
- background-color: white;
285
+
286
+ /* Top inset shadow only */
287
+ box-shadow: inset 0px 16px 16px -16px rgba(0, 0, 0, 0.1333);
289
288
  }
290
289
 
291
290
  .stubber-cm :global(.cm-editor.cm-focused) {
292
291
  outline: none;
293
- /* @apply ring-2; */
294
- --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width)
295
- var(--tw-ring-offset-color);
296
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width))
297
- var(--tw-ring-color);
298
- box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
292
+ border-width: 1px;
293
+ border-color: var(--ring);
299
294
  }
300
295
 
301
296
  .stubber-cm.stubber-valid :global(.cm-editor.cm-focused) {
302
- /* @apply ring-primary-400; */
303
- --tw-ring-opacity: 1;
304
- --tw-ring-color: rgb(33 134 235 / var(--tw-ring-opacity));
297
+ border-color: rgb(170, 170, 170, 0.5);
305
298
  }
306
299
 
307
300
  .stubber-cm.stubber-invalid :global(.cm-editor) {
308
- /* @apply ring-danger-500; */
309
- --tw-ring-opacity: 1;
310
- --tw-ring-color: rgb(225 45 57 / var(--tw-ring-opacity));
301
+ border-color: rgb(225 45 57);
311
302
  }
312
303
 
313
304
  .stubber-cm :global(.cm-editor .cm-scroller) {
@@ -317,26 +308,28 @@
317
308
 
318
309
  .stubber-cm :global(.cm-editor .cm-content) {
319
310
  padding: 0;
320
- /* @apply py-2; */
321
- padding-top: 8px;
322
- padding-bottom: 8px;
311
+ padding-top: 0.5rem;
312
+ padding-bottom: 0.5rem;
323
313
  }
324
314
 
325
315
  .stubber-cm :global(.cm-editor .cm-line) {
326
316
  padding: 0;
327
- /* @apply pl-3; */
328
- padding-left: 12px;
317
+ padding-left: 0.75rem;
329
318
  }
330
319
 
331
320
  .stubber-cm :global(.cm-editor .cm-placeholder) {
332
- /* @apply text-surface-400; */
333
- --tw-text-opacity: 1;
334
- color: rgb(165 169 173 / var(--tw-text-opacity));
321
+ color: var(--muted-foreground, rgb(165 169 173));
335
322
  }
336
323
 
337
324
  .stubber-cm :global(.curly-braces-highlight) {
338
- /* @apply text-primary-500; */
339
- --tw-text-opacity: 1;
340
- color: rgb(9 103 210 / var(--tw-text-opacity));
325
+ color: rgb(9 103 210);
326
+ }
327
+
328
+ /* CSS Custom Properties */
329
+ :root {
330
+ --ring: rgb(98, 98, 98);
331
+ --muted-foreground: rgb(165 169 173);
332
+ --input: 214.3 31.8% 91.4%;
333
+ --border: 214.3 31.8% 91.4%;
341
334
  }
342
335
  </style>
@@ -129,7 +129,7 @@
129
129
  </script>
130
130
 
131
131
  {#if $internal}
132
- <div class="flex flex-col w-full text-surface-900">
132
+ <div class="flex flex-col w-full text-surface-900 my-2">
133
133
  <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
134
134
  {label}
135
135
  </Label>
@@ -79,7 +79,7 @@
79
79
  </script>
80
80
 
81
81
  {#if $internal}
82
- <div class="flex flex-col w-full text-surface-900">
82
+ <div class="flex flex-col w-full text-surface-900 my-2">
83
83
  <Label for="input_{state_key}" class="block py-2 {hide_label ? 'hidden' : ''}">
84
84
  {label}
85
85
  </Label>
@@ -6,6 +6,8 @@
6
6
  import { writable } from "svelte/store";
7
7
  import { syncStoreToStore } from "../../utils/syncing";
8
8
 
9
+ import { Label } from "@stubber/ui/label";
10
+
9
11
  export let form;
10
12
  export let field;
11
13
 
@@ -204,9 +206,9 @@
204
206
 
205
207
  {#if $internal}
206
208
  <div class="flex flex-col w-full text-surface-900">
207
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
209
+ <Label for="input_{state_key}" class="block py-2 {hide_label ? 'hidden' : ''}">
208
210
  {label}
209
- </label>
211
+ </Label>
210
212
  <div>
211
213
  <Button variant={isRecording ? "destructive" : "default"} on:click={toggleRecording}>
212
214
  {#if isRecording}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stubber/form-fields",
3
- "version": "1.0.5",
3
+ "version": "1.0.8",
4
4
  "description": "An automatic form builder based on field specifications",
5
5
  "keywords": [
6
6
  "components",