@glasshome/ui 1.26.2 → 1.27.0

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.
@@ -49,7 +49,7 @@ interface SchemaFormProps {
49
49
  data: Record<string, unknown>;
50
50
  onChange: (data: Record<string, unknown>) => void;
51
51
  errors?: string[];
52
- /** Passed through to IconPicker for formType: "icon-picker" fields. */
52
+ /** @deprecated Pass `search` to `provideIcons` once; removed in 2.0.0. */
53
53
  searchIcons?: IconPickerProps["searchIcons"];
54
54
  class?: string;
55
55
  }
@@ -26,6 +26,7 @@ export declare function LabeledIconPicker(props: {
26
26
  value: string;
27
27
  onChange: (value: string) => void;
28
28
  placeholder?: string;
29
+ /** @deprecated Pass `search` to `provideIcons` once; removed in 2.0.0. */
29
30
  searchIcons?: IconPickerProps["searchIcons"];
30
31
  }): JSX.Element;
31
32
  export declare function LabeledInput(props: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/ui",
3
- "version": "1.26.2",
3
+ "version": "1.27.0",
4
4
  "description": "SolidJS component library for GlassHome, built on Kobalte",
5
5
  "keywords": [
6
6
  "components",
@@ -3,7 +3,7 @@ import { STAGGER } from "../lib/motion-classes.js";
3
3
  import { PICKER_LIST } from "../lib/picker-classes.js";
4
4
  import { CHIP, ICON_PILL_TINT } from "../lib/pill-classes.js";
5
5
  import { cn } from "../lib/utils.js";
6
- import { Icon } from "./icon.js";
6
+ import { Icon, iconSearch } from "./icon.js";
7
7
  import { PickerSearch } from "./picker-search.js";
8
8
  import { PickerTrigger } from "./picker-trigger.js";
9
9
  import { Popover, PopoverAnchor, PopoverContent } from "./popover.js";
@@ -256,12 +256,7 @@ export interface IconPickerProps {
256
256
  onChange: (value: string) => void;
257
257
  placeholder?: string;
258
258
  class?: string;
259
- /**
260
- * Host-provided icon search. The design system carries no network or CSP
261
- * policy of its own: dash proxies the Iconify API same-origin so its
262
- * connect-src allowlist stays free of third-party origins. Without this the
263
- * picker still works, showing the curated set only.
264
- */
259
+ /** @deprecated Pass `search` to `provideIcons` once; removed in 2.0.0. */
265
260
  searchIcons?: (query: string, prefix: string) => Promise<string[]>;
266
261
  /** Id of the element naming the trigger, for forms that label it outside. */
267
262
  "aria-labelledby"?: string;
@@ -283,12 +278,19 @@ export function IconPicker(props: IconPickerProps) {
283
278
  setApiResults([]);
284
279
  return;
285
280
  }
286
- const search = props.searchIcons;
287
- if (!search) return;
281
+ const legacy = props.searchIcons;
282
+ const hosted = iconSearch();
283
+ const prefixes = prefix ? [prefix] : ICON_LIBRARIES.map((lib) => lib.prefix).filter(Boolean);
284
+ const run = legacy
285
+ ? () => legacy(query, prefix)
286
+ : hosted
287
+ ? () => hosted(query, prefixes)
288
+ : undefined;
289
+ if (!run) return;
288
290
  setLoading(true);
289
291
  debounceTimer = setTimeout(async () => {
290
292
  try {
291
- setApiResults(await search(query, prefix));
293
+ setApiResults(await run());
292
294
  } catch {
293
295
  setApiResults([]);
294
296
  } finally {
@@ -9,6 +9,8 @@ export interface IconSource {
9
9
  bundled: Record<string, IconData>;
10
10
  /** Resolves the rest in one batch; a name the source does not have maps to null. */
11
11
  load?: (names: string[]) => Promise<Record<string, IconData | null>>;
12
+ /** `prefix:name` matches for `query` across `prefixes`; powers every IconPicker. */
13
+ search?: (query: string, prefixes: string[]) => Promise<string[]>;
12
14
  }
13
15
 
14
16
  /**
@@ -42,6 +44,10 @@ export function provideIcons(next: IconSource): void {
42
44
  setGeneration((g) => g + 1);
43
45
  }
44
46
 
47
+ export function iconSearch(): IconSource["search"] {
48
+ return source?.search;
49
+ }
50
+
45
51
  function request(name: string): void {
46
52
  const load = source?.load;
47
53
  if (!load || requested.has(name)) return;
@@ -188,7 +188,7 @@ interface SchemaFormProps {
188
188
  data: Record<string, unknown>;
189
189
  onChange: (data: Record<string, unknown>) => void;
190
190
  errors?: string[];
191
- /** Passed through to IconPicker for formType: "icon-picker" fields. */
191
+ /** @deprecated Pass `search` to `provideIcons` once; removed in 2.0.0. */
192
192
  searchIcons?: IconPickerProps["searchIcons"];
193
193
  class?: string;
194
194
  }
@@ -72,6 +72,7 @@ export function LabeledIconPicker(props: {
72
72
  value: string;
73
73
  onChange: (value: string) => void;
74
74
  placeholder?: string;
75
+ /** @deprecated Pass `search` to `provideIcons` once; removed in 2.0.0. */
75
76
  searchIcons?: IconPickerProps["searchIcons"];
76
77
  }) {
77
78
  return (