@warkypublic/svelix 0.2.1 → 0.2.2
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.
|
@@ -405,6 +405,9 @@ function onOptionPointerDown(e, index) {
|
|
|
405
405
|
function syncInsideDialogFlag() {
|
|
406
406
|
insideDialog = !!anchorEl?.closest("dialog, [role=\"dialog\"]");
|
|
407
407
|
}
|
|
408
|
+
function isSvgIcon(value) {
|
|
409
|
+
return value?.trimStart?.().startsWith?.("<svg");
|
|
410
|
+
}
|
|
408
411
|
// Public API via bind:this
|
|
409
412
|
export function clear() {
|
|
410
413
|
onClear();
|
|
@@ -625,6 +628,14 @@ $effect(() => {
|
|
|
625
628
|
type="checkbox"
|
|
626
629
|
/>
|
|
627
630
|
{/if}
|
|
631
|
+
{#if item?.icon}
|
|
632
|
+
{#if isSvgIcon(item.icon)}
|
|
633
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
634
|
+
<span class="size-4 flex items-center shrink-0">{@html item.icon}</span>
|
|
635
|
+
{:else}
|
|
636
|
+
<span class="shrink-0">{item.icon}</span>
|
|
637
|
+
{/if}
|
|
638
|
+
{/if}
|
|
628
639
|
<span>{item?.label}</span>
|
|
629
640
|
</div>
|
|
630
641
|
{/each}
|
|
@@ -42,6 +42,8 @@ export type BoxerItem = {
|
|
|
42
42
|
[key: string]: any;
|
|
43
43
|
label: string;
|
|
44
44
|
value: any;
|
|
45
|
+
/** Optional icon rendered before the label in the dropdown list. Accepts an SVG string (rendered raw) or plain text/emoji. */
|
|
46
|
+
icon?: string;
|
|
45
47
|
};
|
|
46
48
|
export interface BoxerProps {
|
|
47
49
|
/** Server adapter (ResolveSpec or HeaderSpec). Automatically sets `dataSource` to `'server'` when provided. */
|