@stubber/form-fields 1.0.2 → 1.0.4

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.
@@ -6,6 +6,8 @@
6
6
  import { writable } from "svelte/store";
7
7
  import { JSONEditor } from "svelte-jsoneditor";
8
8
 
9
+ import { Label } from "@stubber/ui/label";
10
+
9
11
  export let field;
10
12
 
11
13
  const internal = writable();
@@ -82,126 +84,55 @@
82
84
  </label>
83
85
  <JSONEditor bind:content={$internal.content} {readOnly} bind:mode={$internal.mode} />
84
86
  {#if validationMessage}
85
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
86
- {validationMessage}
87
- </p>
87
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
88
88
  {/if}
89
89
  </div>
90
90
  {/if}
91
91
 
92
- <style>.jse-theme-dark {
93
- --jse-theme: dark;
94
-
95
- /* over all fonts, sizes, and colors */
96
- --jse-theme-color: #2f6dd0;
97
- --jse-theme-color-highlight: #467cd2;
98
- --jse-background-color: #1e1e1e;
99
- --jse-text-color: #d4d4d4;
100
- --jse-text-color-inverse: #4d4d4d;
101
-
102
- /* main, menu, modal */
103
- --jse-main-border: 1px solid #4f4f4f;
104
- --jse-menu-color: #fff;
105
- --jse-modal-background: #2f2f2f;
106
- --jse-modal-overlay-background: rgba(0, 0, 0, 0.5);
107
- --jse-modal-code-background: #2f2f2f;
108
-
109
- /* tooltip in text mode */
110
- --jse-tooltip-color: var(--jse-text-color);
111
- --jse-tooltip-background: #4b4b4b;
112
- --jse-tooltip-border: 1px solid #737373;
113
- --jse-tooltip-action-button-color: inherit;
114
- --jse-tooltip-action-button-background: #737373;
115
-
116
- /* panels: navigation bar, gutter, search box */
117
- --jse-panel-background: #333333;
118
- --jse-panel-background-border: 1px solid #464646;
119
- --jse-panel-color: var(--jse-text-color);
120
- --jse-panel-color-readonly: #737373;
121
- --jse-panel-border: 1px solid #3c3c3c;
122
- --jse-panel-button-color-highlight: #e5e5e5;
123
- --jse-panel-button-background-highlight: #464646;
124
-
125
- /* navigation-bar */
126
- --jse-navigation-bar-background: #656565;
127
- --jse-navigation-bar-background-highlight: #7e7e7e;
128
- --jse-navigation-bar-dropdown-color: var(--jse-text-color);
129
-
130
- /* context menu */
131
- --jse-context-menu-background: #4b4b4b;
132
- --jse-context-menu-background-highlight: #595959;
133
- --jse-context-menu-separator-color: #595959;
134
- --jse-context-menu-color: var(--jse-text-color);
135
- --jse-context-menu-pointer-background: #737373;
136
- --jse-context-menu-pointer-background-highlight: #818181;
137
- --jse-context-menu-pointer-color: var(--jse-context-menu-color);
138
-
139
- /* contents: json key and values */
140
- --jse-key-color: #9cdcfe;
141
- --jse-value-color: var(--jse-text-color);
142
- --jse-value-color-number: #b5cea8;
143
- --jse-value-color-boolean: #569cd6;
144
- --jse-value-color-null: #569cd6;
145
- --jse-value-color-string: #ce9178;
146
- --jse-value-color-url: #ce9178;
147
- --jse-delimiter-color: #949494;
148
- --jse-edit-outline: 2px solid var(--jse-text-color);
149
-
150
- /* contents: selected or hovered */
151
- --jse-selection-background-color: #464646;
152
- --jse-selection-background-inactive-color: #333333;
153
- --jse-hover-background-color: #343434;
154
- --jse-active-line-background-color: rgba(255, 255, 255, 0.06);
155
- --jse-search-match-background-color: #343434;
156
-
157
- /* contents: section of collapsed items in an array */
158
- --jse-collapsed-items-background-color: #333333;
159
- --jse-collapsed-items-selected-background-color: #565656;
160
- --jse-collapsed-items-link-color: #b2b2b2;
161
- --jse-collapsed-items-link-color-highlight: #ec8477;
162
-
163
- /* contents: highlighting of search results */
164
- --jse-search-match-color: #724c27;
165
- --jse-search-match-outline: 1px solid #966535;
166
- --jse-search-match-active-color: #9f6c39;
167
- --jse-search-match-active-outline: 1px solid #bb7f43;
168
-
169
- /* contents: inline tags inside the JSON document */
170
- --jse-tag-background: #444444;
171
- --jse-tag-color: #bdbdbd;
172
-
173
- /* contents: table */
174
- --jse-table-header-background: #333333;
175
- --jse-table-header-background-highlight: #424242;
176
- --jse-table-row-odd-background: rgba(255, 255, 255, 0.1);
177
-
178
- /* controls in modals: inputs, buttons, and `a` */
179
- --jse-input-background: #3d3d3d;
180
- --jse-input-border: var(--jse-main-border);
181
- --jse-button-background: #808080;
182
- --jse-button-background-highlight: #7a7a7a;
183
- --jse-button-color: #e0e0e0;
184
- --jse-button-secondary-background: #494949;
185
- --jse-button-secondary-background-highlight: #5d5d5d;
186
- --jse-button-secondary-background-disabled: #9d9d9d;
187
- --jse-button-secondary-color: var(--jse-text-color);
188
- --jse-a-color: #55abff;
189
- --jse-a-color-highlight: #4387c9;
190
-
191
- /* svelte-select */
192
- --jse-svelte-select-background: #3d3d3d;
193
- --jse-svelte-select-border: 1px solid #4f4f4f;
194
- --list-background: #3d3d3d;
195
- --item-hover-bg: #505050;
196
- --multi-item-bg: #5b5b5b;
197
- --input-color: #d4d4d4;
198
- --multi-clear-bg: #8a8a8a;
199
- --multi-item-clear-icon-color: #d4d4d4;
200
- --multi-item-outline: 1px solid #696969;
201
- --list-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.4);
202
-
203
- /* color picker */
204
- --jse-color-picker-background: #656565;
205
- --jse-color-picker-border-box-shadow: #8c8c8c 0 0 0 1px;
206
- }
207
- </style>
92
+ <style>
93
+ /* :global(.jsoneditor),
94
+ :global(.jsoneditor div) {
95
+ border-bottom-right-radius: 10px !important;
96
+ border-bottom-left-radius: 10px !important;
97
+
98
+ } */
99
+
100
+ :global(.jse-button.jse-group-button) {
101
+ border-radius: 6px !important;
102
+ color: #000000 !important;
103
+ height: 1.5rem !important;
104
+ width: 3rem !important;
105
+ border: 0px !important;
106
+ margin: 5px !important;
107
+ padding: 12px !important;
108
+ }
109
+
110
+ :global(.jse-button) {
111
+ border-radius: 6px !important;
112
+ color: #000000 !important;
113
+ background-color: #efeff0 !important;
114
+ }
115
+
116
+ :global(.jse-button.jse-selected) {
117
+ background-color: #ffffff !important;
118
+ color: #000000 !important;
119
+ box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
120
+ }
121
+
122
+ :global(.jse-menu) {
123
+ color: #000000 !important;
124
+ background-color: #efeff0 !important;
125
+ margin-top: 10px;
126
+ margin-bottom: 20px;
127
+ border-radius: 10px !important;
128
+ }
129
+
130
+ :global(.jse-contents) {
131
+ background-color: #efeff0 !important;
132
+ border-radius: 0px !important;
133
+ }
134
+
135
+ :global(.jse-navigation-bar) {
136
+ border-radius: 0px !important;
137
+ }
138
+ </style>
@@ -5,6 +5,9 @@
5
5
  import { onMount } from "svelte";
6
6
  import { writable } from "svelte/store";
7
7
 
8
+ import { Checkbox } from "@stubber/ui/checkbox";
9
+ import { Label } from "@stubber/ui/label";
10
+
8
11
  export let field;
9
12
 
10
13
  const internal = writable({
@@ -92,7 +95,7 @@
92
95
  <div class="flex flex-col w-full {!isValid ? `text-danger-500` : `text-surface-900`}">
93
96
  {#each items as item, index}
94
97
  <div class="flex space-x-3 relative mt-2">
95
- <input
98
+ <Checkbox
96
99
  on:keydown={(e) => {
97
100
  if (e.key === "Enter") {
98
101
  e.preventDefault();
@@ -101,19 +104,17 @@
101
104
  type="checkbox"
102
105
  id="input_{state_key}_{index}"
103
106
  placeholder={label}
104
- class="block w-5 h-5 rounded-md text-label focus:outline-primary-400"
105
107
  name={state_key}
106
108
  bind:checked={$internal.checks[index]}
107
109
  />
108
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
110
+
111
+ <Label for="input_{state_key}" class=" {hide_label ? 'hidden' : ''}">
109
112
  {item._label}
110
- </label>
113
+ </Label>
111
114
  </div>
112
115
  {/each}
113
116
  {#if validationMessage}
114
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
115
- {validationMessage}
116
- </p>
117
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
117
118
  {/if}
118
119
  </div>
119
120
  {/if}
@@ -5,6 +5,10 @@
5
5
  import { onMount } from "svelte";
6
6
  import { writable } from "svelte/store";
7
7
 
8
+ import { Textarea } from "@stubber/ui/textarea";
9
+ import { Label } from "@stubber/ui/label";
10
+ import { Button } from "@stubber/ui/button";
11
+
8
12
  export let field;
9
13
 
10
14
  const internal = writable();
@@ -63,11 +67,11 @@
63
67
 
64
68
  {#if $internal}
65
69
  <div class="flex flex-col w-full text-surface-900">
66
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
70
+ <Label for="input_{state_key}" class=" {hide_label ? 'hidden' : ''}">
67
71
  {label}
68
- </label>
69
- <div class="relative mt-2 rounded-md">
70
- <textarea
72
+ </Label>
73
+ <div class="relative mt-2">
74
+ <Textarea
71
75
  on:keydown={(e) => {
72
76
  if (e.key === "Enter") {
73
77
  e.stopPropagation();
@@ -76,17 +80,13 @@
76
80
  rows="3"
77
81
  id="input_{state_key}"
78
82
  placeholder={label}
79
- class="block w-full text-field rounded-md border-0 py-2 pl-3 text-surface-900 ring-1 ring-inset {!isValid
80
- ? 'ring-danger-500'
81
- : 'ring-surface-300 focus:ring-primary-400'} focus:outline-none placeholder:text-surface-400 focus:ring-2 focus:ring-inset"
83
+ class="block w-full {!isValid ? 'ring-danger-500' : 'ring-surface-300 '} "
82
84
  name={state_key}
83
85
  bind:value={$internal.raw}
84
86
  />
85
87
  </div>
86
88
  {#if validationMessage}
87
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
88
- {validationMessage}
89
- </p>
89
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
90
90
  {/if}
91
91
  </div>
92
92
  {/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();
@@ -110,9 +112,7 @@
110
112
  />
111
113
  </div>
112
114
  {#if validationMessage}
113
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
114
- {validationMessage}
115
- </p>
115
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
116
116
  {/if}
117
117
  </div>
118
118
  {/if}
@@ -5,6 +5,9 @@
5
5
  import { onMount } from "svelte";
6
6
  import { writable } from "svelte/store";
7
7
 
8
+ import * as RadioGroup from "@stubber/ui/radio-group";
9
+ import { Label } from "@stubber/ui/label";
10
+
8
11
  export let field;
9
12
 
10
13
  const internal = writable();
@@ -83,9 +86,9 @@
83
86
 
84
87
  {#if $internal}
85
88
  <div class="flex flex-col w-full text-surface-900">
86
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
89
+ <Label for="input_{state_key}" class=" {hide_label ? 'hidden' : ''}">
87
90
  {label}
88
- </label>
91
+ </Label>
89
92
  {#if items?.length}
90
93
  <fieldset
91
94
  class="flex flex-col border {!isValid
@@ -95,22 +98,20 @@
95
98
  >
96
99
  {#each items as item}
97
100
  <div class="py-1">
98
- <input
99
- id="input_{item._key}"
100
- name={state_key}
101
- bind:group={$internal.selected_item_key}
102
- type="radio"
103
- value={item._key}
104
- />
105
- <label for="input_{item._key}" class="text-field">{item._label}</label>
101
+ <RadioGroup.Root bind:value={$internal.selected_item_key} name={state_key}>
102
+ <div class="flex items-center space-x-2">
103
+ <RadioGroup.Item value={item._key} id="input_{item._key}" />
104
+ <Label for="input_{item._key}">{item._label}</Label>
105
+ </div>
106
+
107
+ <RadioGroup.Input name={state_key} />
108
+ </RadioGroup.Root>
106
109
  </div>
107
110
  {/each}
108
111
  </fieldset>
109
112
  {/if}
110
113
  {#if validationMessage}
111
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
112
- {validationMessage}
113
- </p>
114
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
114
115
  {/if}
115
116
  </div>
116
117
  {/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 { Checkbox } from "@stubber/ui/checkbox";
10
+
8
11
  export let field;
9
12
 
10
13
  const internal = writable();
@@ -93,9 +96,11 @@
93
96
  <div
94
97
  class="{!$internal.scrolled_to_bottom
95
98
  ? 'opacity-20'
96
- : ''} flex space-x-3 relative mt-2 {!isValid ? 'border-b border-warning-500' : ''}"
99
+ : ''} flex space-x-3 relative mt-2 items-center {!isValid
100
+ ? 'border-b border-warning-500'
101
+ : ''}"
97
102
  >
98
- <input
103
+ <Checkbox
99
104
  disabled={!$internal.scrolled_to_bottom}
100
105
  on:keydown={(e) => {
101
106
  if (e.key === "Enter") {
@@ -105,18 +110,15 @@
105
110
  type="checkbox"
106
111
  id="input_{state_key}"
107
112
  placeholder={label}
108
- class="block w-5 h-5 rounded-md text-label focus:outline-primary-400"
109
113
  name={state_key}
110
114
  bind:checked={$internal.checked}
111
115
  />
112
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
116
+ <Label for="input_{state_key}" class="block {hide_label ? 'hidden' : ''}">
113
117
  {label}
114
- </label>
118
+ </Label>
115
119
  </div>
116
120
  {#if validationMessage}
117
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
118
- {validationMessage}
119
- </p>
121
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
120
122
  {/if}
121
123
  </div>
122
124
  {/if}
@@ -1,5 +1,6 @@
1
1
  <script>
2
- import _ from "lodash-es";
2
+ import * as Accordion from "@stubber/ui/accordion";
3
+ import { Label } from "@stubber/ui/label";
3
4
  import Field from "../../Field.svelte";
4
5
  import * as utils from "../../utils/index.js";
5
6
 
@@ -15,6 +16,7 @@
15
16
  $: validationMessage = $field.state?.validation?.message;
16
17
  $: collapsible = $field.spec?.params?.collapsible ?? false;
17
18
  $: fields = utils.getFieldsToRender($field.spec?.fields);
19
+
18
20
  $: allChildrenConditionsChecked = Object.values($form?.state || {})
19
21
  ?.filter((s) => s && s.parent_field_state_key === state_key)
20
22
  ?.reduce((acc, child_state) => {
@@ -23,42 +25,63 @@
23
25
  }, true);
24
26
 
25
27
  $: section_class = $field.spec?.params?.section_class ?? "pl-4";
26
- $: label_class = $field.spec?.params?.label_class ?? "font-semibold text-primary-700 text-sm";
28
+ $: label_class = $field.spec?.params?.label_class ?? "font-regular text-sm";
29
+
30
+ // Hook the Accordion's value up to collapse logic
31
+ let accordionValue = collapsed ? "" : "item-1";
27
32
 
28
- function toggleCollapsed() {
29
- collapsed = !collapsed;
33
+ function handleValueChange(value) {
34
+ console.log("Accordion value changed to:", value);
35
+ collapsed = value !== "item-1";
30
36
  }
37
+
38
+ // Debug: Track changes in your reactive variables.
39
+ $: console.log("allChildrenConditionsChecked =>", allChildrenConditionsChecked);
40
+ $: console.log("collapsed =>", collapsed);
41
+ $: console.log("accordionValue =>", accordionValue);
31
42
  </script>
32
43
 
33
- <div class={!allChildrenConditionsChecked ? "invisible absolute" : ""}>
34
- <div class="flex flex-col w-full text-surface-900">
35
- <button
36
- disabled={!collapsible}
37
- type="button"
38
- class="{collapsible ? 'hover:bg-surface-100' : ''} flex items-center justify-between"
39
- on:click={toggleCollapsed}
40
- >
41
- <label
42
- for="input_{state_key}"
43
- class="block text-label {label_class} {hide_label ? 'hidden' : ''}"
44
- >
45
- {label}
46
- </label>
47
- {#if collapsible}
48
- <i class="fa-regular {collapsed ? 'fa-angle-down' : 'fa-angle-up'} text-surface-500 mr-2" />
49
- {/if}
50
- </button>
51
- <div class={collapsed ? "absolute invisible" : section_class}>
52
- {#if fields}
53
- {#each fields as initial_field_spec (initial_field_spec.__key)}
54
- <Field {form} {initial_field_spec} parent_field={field} />
55
- {/each}
56
- {/if}
57
- </div>
58
- {#if validationMessage}
59
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
60
- {validationMessage}
61
- </p>
62
- {/if}
63
- </div>
44
+ <div class="fade-container {!allChildrenConditionsChecked ? 'fade-hidden' : ''}">
45
+ <Accordion.Root
46
+ bind:value={accordionValue}
47
+ on:valueChange={handleValueChange}
48
+ type="single"
49
+ {collapsible}
50
+ class="flex flex-col w-full text-surface-900"
51
+ >
52
+ <Accordion.Item value="item-1">
53
+ <Accordion.Trigger class="flex items-center justify-between py-1">
54
+ <Label for="input_{state_key}" class="block {label_class} {hide_label ? 'hidden' : ''}">
55
+ {label}
56
+ </Label>
57
+ </Accordion.Trigger>
58
+ <Accordion.Content class="{section_class} -pl-4 pt-2">
59
+ {#if fields}
60
+ {#each fields as initial_field_spec (initial_field_spec.__key)}
61
+ <Field {form} {initial_field_spec} parent_field={field} />
62
+ {/each}
63
+ {/if}
64
+
65
+ {#if validationMessage}
66
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}
67
+ >{validationMessage}</Label
68
+ >
69
+ {/if}
70
+ </Accordion.Content>
71
+ </Accordion.Item>
72
+ </Accordion.Root>
64
73
  </div>
74
+
75
+ <style>
76
+ /*
77
+ 1. .fade-container: By default visible, but transitions changes in opacity.
78
+ 2. .fade-hidden: Sets opacity to 0, so it fades out over 0.3s.
79
+ */
80
+ .fade-container {
81
+ transition: opacity 0.5s ease-in-out;
82
+ opacity: 1; /* fully visible by default */
83
+ }
84
+ .fade-hidden {
85
+ opacity: 0; /* hidden via fade */
86
+ }
87
+ </style>
@@ -6,6 +6,8 @@
6
6
  import { writable } from "svelte/store";
7
7
  import * as utils from "../../utils/index.js";
8
8
 
9
+ import { Label } from "@stubber/ui/label";
10
+
9
11
  export let field;
10
12
 
11
13
  const internal = writable();
@@ -183,9 +185,12 @@
183
185
  type="select"
184
186
  id="input_{state_key}"
185
187
  placeholder={label}
186
- 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
187
- ? 'ring-danger-500'
188
- : 'ring-surface-300 focus:ring-primary-400'} focus:outline-none placeholder:text-surface-400 focus:ring-2 focus:ring-inset"
188
+ class="bg-gradient-to-b from-[#2727271F] to-[#27272719] shadow-select
189
+ flex h-7 w-full items-center justify-between rounded px-3 py-2
190
+ text-sm
191
+ [&>span]:line-clamp-1 aria-[invalid]:border-destructive
192
+ placeholder:text-black
193
+ {!isValid ? 'ring-danger-500' : 'ring-surface-300 focus:ring-primary-400'}"
189
194
  name={state_key}
190
195
  bind:value={filter_text}
191
196
  autocomplete="off"
@@ -197,22 +202,27 @@
197
202
  {#if is_focused}
198
203
  <div use:teleport class="z-10 w-full inset-y-[70px]">
199
204
  <ul
200
- class="items block max-h-[200px] overflow-y-auto w-full bg-white shadow-lg rounded-md ring-1 ring-surface-300"
205
+ 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"
201
208
  >
202
209
  {#each filteritems as item, index (item._key)}
203
- <li
204
- class="group {$internal.focused_index === index
205
- ? 'bg-primary-400'
206
- : ''} hover:bg-primary-400 focus-within:bg-primary-400 text-field cursor-default"
207
- >
210
+ <li class="group {$internal.focused_index === index ? 'bg-primary-400' : ''} ">
208
211
  <button
209
212
  type="button"
210
213
  on:click|preventDefault={() => setSelected(item)}
211
- 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"
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"
212
222
  >
213
223
  {item._label}
214
224
  {#if item._key === $internal?.selected_item_key}
215
- <i class="text-primary-400 ml-auto fa-regular fa-check" />
225
+ <i class="absolute left-2 h-3.5 w-3.5 fa-regular fa-check" />
216
226
  {/if}
217
227
  </button>
218
228
  </li>
@@ -221,9 +231,7 @@
221
231
  </div>
222
232
  {/if}
223
233
  {#if validationMessage}
224
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
225
- {validationMessage}
226
- </p>
234
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
227
235
  {/if}
228
236
  </div>
229
237
  {/if}
@@ -6,6 +6,9 @@
6
6
  import { writable } from "svelte/store";
7
7
  import { syncStoreToStore } from "../../utils/syncing";
8
8
 
9
+ import { Label } from "@stubber/ui/label";
10
+ import { Button } from "@stubber/ui/button";
11
+
9
12
  export let form;
10
13
  export let field;
11
14
 
@@ -123,9 +126,9 @@
123
126
 
124
127
  {#if $internal}
125
128
  <div class="flex flex-col w-full text-surface-900">
126
- <label for="input_{state_key}" class="block text-label {hide_label ? 'hidden' : ''}">
129
+ <Label for="input_{state_key}" class=" {hide_label ? 'hidden' : ''}">
127
130
  {label}
128
- </label>
131
+ </Label>
129
132
  <div bind:this={canvasContainer}>
130
133
  <canvas
131
134
  bind:this={pad}
@@ -134,20 +137,12 @@
134
137
  width={canvasWidth}
135
138
  height={200}
136
139
  />
137
- <div class="mt-0 text-sm">
138
- <button
139
- on:click={clear}
140
- type="button"
141
- class="text-surface-500 text-sm hover:text-surface-700"
142
- >
143
- Clear
144
- </button>
140
+ <div class="mt-1">
141
+ <Button variant="ghost" on:click={clear} type="button">Clear</Button>
145
142
  </div>
146
143
  </div>
147
144
  {#if validationMessage}
148
- <p class="text-label {!isValid ? `text-danger-500` : `text-success-500`}">
149
- {validationMessage}
150
- </p>
145
+ <Label class={!isValid ? `text-danger-500` : `text-success-500`}>{validationMessage}</Label>
151
146
  {/if}
152
147
  </div>
153
148
  {/if}