uisv 0.0.17 → 0.0.18
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.
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
value?: string;
|
|
42
42
|
icon?: string | Component;
|
|
43
43
|
iconposition?: 'leading' | 'trailing';
|
|
44
|
-
leading?: string | Component;
|
|
45
|
-
trailing?: string | Component;
|
|
44
|
+
leading?: string | Component | Snippet;
|
|
45
|
+
trailing?: string | Component | Snippet;
|
|
46
46
|
loading?: boolean;
|
|
47
47
|
loadingicon?: string | Component;
|
|
48
48
|
mask?: string | MaskInputOptions;
|
|
@@ -259,11 +259,11 @@
|
|
|
259
259
|
{#if !!trailing}
|
|
260
260
|
{#if typeof trailing === 'string'}
|
|
261
261
|
{trailing}
|
|
262
|
-
{:else if isSnippet(trailing)}
|
|
263
|
-
{@render trailing()}
|
|
264
262
|
{:else if isComponent(trailing)}
|
|
265
263
|
{@const Trailing = trailing}
|
|
266
264
|
<Trailing />
|
|
265
|
+
{:else if isSnippet(trailing)}
|
|
266
|
+
{@render trailing()}
|
|
267
267
|
{/if}
|
|
268
268
|
{:else if typeof icon === 'string'}
|
|
269
269
|
<div
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PropColor, type PropVariant } from '../index.js';
|
|
2
|
-
import type { Component } from 'svelte';
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
import { type MaskInputOptions } from 'maska';
|
|
@@ -37,8 +37,8 @@ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
|
|
|
37
37
|
value?: string;
|
|
38
38
|
icon?: string | Component;
|
|
39
39
|
iconposition?: 'leading' | 'trailing';
|
|
40
|
-
leading?: string | Component;
|
|
41
|
-
trailing?: string | Component;
|
|
40
|
+
leading?: string | Component | Snippet;
|
|
41
|
+
trailing?: string | Component | Snippet;
|
|
42
42
|
loading?: boolean;
|
|
43
43
|
loadingicon?: string | Component;
|
|
44
44
|
mask?: string | MaskInputOptions;
|
package/dist/utilities.svelte.js
CHANGED
|
@@ -5,7 +5,7 @@ import { extract, useMutationObserver, useResizeObserver, } from 'runed';
|
|
|
5
5
|
* @returns true if the value is a component, false otherwise
|
|
6
6
|
*/
|
|
7
7
|
export function isComponent(v) {
|
|
8
|
-
return typeof v === 'function'
|
|
8
|
+
return typeof v === 'function' && 'render' in v;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Checks if a value is a Svelte snippet
|
|
@@ -13,7 +13,7 @@ export function isComponent(v) {
|
|
|
13
13
|
* @returns true if the value is a snippet, false otherwise
|
|
14
14
|
*/
|
|
15
15
|
export function isSnippet(v) {
|
|
16
|
-
return typeof v === '
|
|
16
|
+
return typeof v === 'function' && !('render' in v);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Returns a reactive value holding the dom rect of `node`s.
|