noph-ui 0.16.14 → 0.16.16

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.
@@ -34,9 +34,9 @@
34
34
  </div>
35
35
  </div>
36
36
  {/if}
37
- {#if typeof option.label === 'function'}
37
+ {#if option.labelIcon}
38
38
  <div class="np-segmented-button-icon-label">
39
- {@render option.label()}
39
+ {@render option.labelIcon()}
40
40
  </div>
41
41
  {:else}
42
42
  {option.label}
@@ -85,7 +85,7 @@
85
85
  }}
86
86
  onblur={() => (hoverState = -1)}
87
87
  {name}
88
- aria-label={typeof option.label === 'function' ? `${name}-${i}` : option.label}
88
+ aria-label={option.label ?? `${name}-${i}`}
89
89
  value={option.label}
90
90
  disabled={option.disabled}
91
91
  checked={option.selected}
@@ -43,7 +43,8 @@ export interface SegmentedButtonProps extends HTMLAttributes<HTMLDivElement> {
43
43
  name: string;
44
44
  multiSelect?: boolean;
45
45
  options: {
46
- label: string | Snippet;
46
+ label?: string;
47
+ labelIcon?: Snippet;
47
48
  selected?: boolean;
48
49
  disabled?: boolean;
49
50
  icon?: Snippet;
@@ -42,7 +42,11 @@
42
42
  value = options.find((option) => option.selected)?.value
43
43
  }
44
44
  }
45
- let selectedOption = $state(options.filter((option) => option.selected))
45
+ let selectedOption: SelectOption[] = $state(
46
+ options
47
+ .filter((option) => option.selected || value?.includes(option.value))
48
+ .map((option) => ({ ...option, selected: true })),
49
+ )
46
50
 
47
51
  let useVirtualList = $derived(options.length > 4000)
48
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.16.14",
3
+ "version": "0.16.16",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {
@@ -52,27 +52,27 @@
52
52
  "svelte": "^5.20.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@eslint/js": "^9.23.0",
55
+ "@eslint/js": "^9.25.1",
56
56
  "@material/material-color-utilities": "^0.3.0",
57
- "@playwright/test": "^1.51.1",
58
- "@sveltejs/adapter-vercel": "^5.6.3",
59
- "@sveltejs/kit": "^2.20.2",
60
- "@sveltejs/package": "^2.3.10",
57
+ "@playwright/test": "^1.52.0",
58
+ "@sveltejs/adapter-vercel": "^5.7.0",
59
+ "@sveltejs/kit": "^2.20.7",
60
+ "@sveltejs/package": "^2.3.11",
61
61
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
62
62
  "@types/eslint": "^9.6.1",
63
- "eslint": "^9.23.0",
64
- "eslint-config-prettier": "^10.1.1",
65
- "eslint-plugin-svelte": "^3.3.3",
63
+ "eslint": "^9.25.1",
64
+ "eslint-config-prettier": "^10.1.2",
65
+ "eslint-plugin-svelte": "^3.5.1",
66
66
  "globals": "^16.0.0",
67
67
  "prettier": "^3.5.3",
68
68
  "prettier-plugin-svelte": "^3.3.3",
69
- "publint": "^0.3.9",
70
- "svelte": "^5.25.3",
71
- "svelte-check": "^4.1.5",
72
- "typescript": "^5.8.2",
73
- "typescript-eslint": "^8.28.0",
74
- "vite": "^6.2.3",
75
- "vitest": "^3.0.9"
69
+ "publint": "^0.3.12",
70
+ "svelte": "^5.28.2",
71
+ "svelte-check": "^4.1.6",
72
+ "typescript": "^5.8.3",
73
+ "typescript-eslint": "^8.31.0",
74
+ "vite": "^6.3.3",
75
+ "vitest": "^3.1.2"
76
76
  },
77
77
  "svelte": "./dist/index.js",
78
78
  "types": "./dist/index.d.ts",