@likable-hair/svelte 0.0.64 → 0.0.66
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.
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
textFieldLabel = "", textFieldPlaceholder = "", textFieldColor = null, textFieldVariant = 'boxed', textFieldMaxWidth = "min(100px, 90%)", textFieldMinWidth = undefined, textFieldHeight = "auto", textFieldTextColor = "black", textFieldBorderWeight = "2px", textFieldBorderRadius = "5px", textFieldBorderColor = null, textFieldFocusBorderColor = null, textFieldFocusedBoxShadow = undefined, textFieldBackgroundColor = null, textFieldPadding = undefined, textFieldPaddingLeft = undefined, textFieldPaddingRight = undefined, textFieldPaddingBottom = undefined, textFieldPaddingTop = undefined, textFieldFontSize = undefined,
|
|
6
6
|
// menu
|
|
7
7
|
menuBackgroundColor = "#FFF", menuBoxShadow = "rgba(149, 157, 165, 0.2) 0px 8px 24px", menuBorderRadius = "5px", focusItemBackgroundColor = "#EEEEEE", selectedItemBackgroundColor = "#D0D0D0", border = '1px solid black', borderRadius = '5px', chipColor = "#D0D0D0", chipTextColor = "black", chipHeight = "30px";
|
|
8
|
+
let dispatch = createEventDispatcher();
|
|
8
9
|
function select(item) {
|
|
9
10
|
const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
|
|
10
11
|
if (!alreadyPresent) {
|
|
@@ -13,11 +14,21 @@ function select(item) {
|
|
|
13
14
|
else
|
|
14
15
|
values = [item];
|
|
15
16
|
refreshMenuWidth();
|
|
17
|
+
dispatch('change', {
|
|
18
|
+
unselect: undefined,
|
|
19
|
+
select: item,
|
|
20
|
+
selection: values
|
|
21
|
+
});
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
function unselect(item) {
|
|
19
25
|
values = values.filter((i) => i.value != item.value);
|
|
20
26
|
refreshMenuWidth();
|
|
27
|
+
dispatch('change', {
|
|
28
|
+
unselect: item,
|
|
29
|
+
select: undefined,
|
|
30
|
+
selection: values
|
|
31
|
+
});
|
|
21
32
|
}
|
|
22
33
|
function toggle(item) {
|
|
23
34
|
const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
|
|
@@ -90,6 +101,7 @@ else {
|
|
|
90
101
|
import Textfield from "./Textfield.svelte";
|
|
91
102
|
import Chip from '../navigation/Chip.svelte';
|
|
92
103
|
import Menu from '../common/Menu.svelte';
|
|
104
|
+
import { createEventDispatcher } from 'svelte';
|
|
93
105
|
</script>
|
|
94
106
|
|
|
95
107
|
<svelte:window></svelte:window>
|
package/forms/Textfield.svelte
CHANGED
|
@@ -202,6 +202,29 @@ $: if (!!labelElement) {
|
|
|
202
202
|
on:keyup
|
|
203
203
|
bind:this={inputElement}
|
|
204
204
|
/>
|
|
205
|
+
{:else if type == 'number'}
|
|
206
|
+
<input
|
|
207
|
+
style:background-color={backgroundColor}
|
|
208
|
+
style:color={textColor}
|
|
209
|
+
style:font-size={fontSize}
|
|
210
|
+
id={inputId}
|
|
211
|
+
class="input-outlined"
|
|
212
|
+
type="number"
|
|
213
|
+
placeholder={placeholder}
|
|
214
|
+
disabled={disabled}
|
|
215
|
+
readonly={readonly}
|
|
216
|
+
bind:value={value}
|
|
217
|
+
on:change
|
|
218
|
+
on:input
|
|
219
|
+
on:focus={handleFocus}
|
|
220
|
+
on:focus
|
|
221
|
+
on:blur={handleBlur}
|
|
222
|
+
on:blur
|
|
223
|
+
on:keydown
|
|
224
|
+
on:keypress
|
|
225
|
+
on:keyup
|
|
226
|
+
bind:this={inputElement}
|
|
227
|
+
/>
|
|
205
228
|
{/if}
|
|
206
229
|
<div>
|
|
207
230
|
<slot name="append-inner"></slot>
|
|
@@ -260,6 +283,29 @@ $: if (!!labelElement) {
|
|
|
260
283
|
on:keyup
|
|
261
284
|
bind:this={inputElement}
|
|
262
285
|
/>
|
|
286
|
+
{:else if type == 'number'}
|
|
287
|
+
<input
|
|
288
|
+
style:background-color={backgroundColor}
|
|
289
|
+
style:color={textColor}
|
|
290
|
+
style:font-size={fontSize}
|
|
291
|
+
id={inputId}
|
|
292
|
+
class="input-boxed"
|
|
293
|
+
type="number"
|
|
294
|
+
placeholder={placeholder || label}
|
|
295
|
+
disabled={disabled}
|
|
296
|
+
readonly={readonly}
|
|
297
|
+
bind:value={value}
|
|
298
|
+
on:change
|
|
299
|
+
on:input
|
|
300
|
+
on:focus={handleFocus}
|
|
301
|
+
on:focus
|
|
302
|
+
on:blur={handleBlur}
|
|
303
|
+
on:blur
|
|
304
|
+
on:keydown
|
|
305
|
+
on:keypress
|
|
306
|
+
on:keyup
|
|
307
|
+
bind:this={inputElement}
|
|
308
|
+
/>
|
|
263
309
|
{/if}
|
|
264
310
|
<div>
|
|
265
311
|
<slot name="append-inner"></slot>
|