@glasshome/ui 1.21.1 → 1.22.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.
Files changed (146) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/lib/use-is-mobile.d.ts +3 -1
  4. package/dist/solid/index.d.ts +9 -9
  5. package/dist/solid/index.js +5431 -5424
  6. package/dist/solid/sonner.d.ts +1 -0
  7. package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
  8. package/package.json +128 -126
  9. package/scripts/check-gallery.ts +142 -142
  10. package/scripts/check-pack.ts +13 -13
  11. package/scripts/check-structural-classes.ts +20 -20
  12. package/scripts/check-tokens.ts +27 -27
  13. package/scripts/check-ui-drift.mjs +103 -103
  14. package/src/index.ts +75 -80
  15. package/src/lib/alert-tones.ts +41 -41
  16. package/src/lib/anchor-placement.ts +21 -21
  17. package/src/lib/button-variants.ts +28 -28
  18. package/src/lib/card-classes.ts +9 -9
  19. package/src/lib/carousel-classes.ts +14 -14
  20. package/src/lib/glass-tone.ts +11 -11
  21. package/src/lib/input-classes.ts +6 -6
  22. package/src/lib/layers.ts +4 -4
  23. package/src/lib/logo-lockup.ts +8 -8
  24. package/src/lib/menu-classes.ts +2 -2
  25. package/src/lib/motion-classes.ts +8 -8
  26. package/src/lib/motion-window.ts +24 -24
  27. package/src/lib/overlay-classes.ts +6 -6
  28. package/src/lib/pill-classes.ts +3 -3
  29. package/src/lib/position-bar-classes.ts +1 -1
  30. package/src/lib/spotlight-geometry.ts +67 -67
  31. package/src/lib/thumb-classes.ts +2 -2
  32. package/src/lib/tier-badge.ts +16 -16
  33. package/src/lib/use-is-mobile.ts +17 -14
  34. package/src/lib/utils.ts +1 -1
  35. package/src/solid/accordion.tsx +41 -41
  36. package/src/solid/alert-dialog.tsx +95 -95
  37. package/src/solid/alert.tsx +88 -88
  38. package/src/solid/area-picker.tsx +204 -204
  39. package/src/solid/aspect-ratio.tsx +13 -13
  40. package/src/solid/avatar.tsx +27 -27
  41. package/src/solid/badge.tsx +49 -49
  42. package/src/solid/bottom-sheet/arbitration.ts +22 -22
  43. package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
  44. package/src/solid/bottom-sheet/drag-controller.ts +201 -201
  45. package/src/solid/bottom-sheet/focus-trap.ts +51 -47
  46. package/src/solid/bottom-sheet/index.ts +12 -12
  47. package/src/solid/bottom-sheet/keyboard.ts +25 -25
  48. package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
  49. package/src/solid/bottom-sheet/state-machine.ts +28 -28
  50. package/src/solid/bottom-sheet/velocity.ts +29 -29
  51. package/src/solid/breadcrumb.tsx +76 -76
  52. package/src/solid/button-group.tsx +46 -46
  53. package/src/solid/button.tsx +19 -19
  54. package/src/solid/card.tsx +67 -67
  55. package/src/solid/carousel.tsx +246 -246
  56. package/src/solid/charts.tsx +253 -253
  57. package/src/solid/checkbox.tsx +51 -51
  58. package/src/solid/collapsible.tsx +22 -22
  59. package/src/solid/color-disc.tsx +213 -213
  60. package/src/solid/color-slider.tsx +81 -81
  61. package/src/solid/color-wheel.tsx +61 -61
  62. package/src/solid/context-menu.tsx +63 -63
  63. package/src/solid/copy-button.tsx +31 -31
  64. package/src/solid/count-pill.tsx +11 -11
  65. package/src/solid/dashboard-preview.tsx +104 -104
  66. package/src/solid/data-table.tsx +228 -228
  67. package/src/solid/dialog-parts.tsx +127 -127
  68. package/src/solid/dialog.tsx +113 -113
  69. package/src/solid/dock-paging.ts +9 -9
  70. package/src/solid/dock.tsx +339 -339
  71. package/src/solid/docked-panel.tsx +35 -35
  72. package/src/solid/dropdown-menu.tsx +77 -77
  73. package/src/solid/empty.tsx +70 -70
  74. package/src/solid/entity-data.ts +38 -38
  75. package/src/solid/entity-selector.tsx +634 -634
  76. package/src/solid/field.tsx +205 -205
  77. package/src/solid/form.tsx +159 -159
  78. package/src/solid/hero-action.tsx +85 -85
  79. package/src/solid/hover-card.tsx +11 -11
  80. package/src/solid/icon-picker.tsx +401 -401
  81. package/src/solid/icon.tsx +101 -78
  82. package/src/solid/image-picker.tsx +416 -414
  83. package/src/solid/index.ts +265 -304
  84. package/src/solid/input-group.tsx +123 -123
  85. package/src/solid/input-otp.tsx +143 -143
  86. package/src/solid/input.tsx +4 -4
  87. package/src/solid/item.tsx +130 -130
  88. package/src/solid/kbd.tsx +20 -20
  89. package/src/solid/label.tsx +12 -12
  90. package/src/solid/list-reorder.ts +122 -122
  91. package/src/solid/logo.tsx +60 -60
  92. package/src/solid/media-copy.ts +21 -21
  93. package/src/solid/media-store.ts +56 -56
  94. package/src/solid/media-tile.tsx +85 -85
  95. package/src/solid/menu-parts.tsx +164 -164
  96. package/src/solid/number-field.tsx +56 -56
  97. package/src/solid/option-card.tsx +164 -164
  98. package/src/solid/ornament.tsx +43 -43
  99. package/src/solid/overlay.tsx +4 -4
  100. package/src/solid/page-header.tsx +75 -75
  101. package/src/solid/pagination.tsx +80 -80
  102. package/src/solid/password-input.tsx +51 -51
  103. package/src/solid/picker-row.tsx +83 -83
  104. package/src/solid/picker-search.tsx +65 -63
  105. package/src/solid/picker-trigger.tsx +59 -57
  106. package/src/solid/popover.tsx +54 -54
  107. package/src/solid/preview-tile.tsx +67 -67
  108. package/src/solid/progress.tsx +21 -21
  109. package/src/solid/radio-group.tsx +51 -51
  110. package/src/solid/resizable.tsx +128 -128
  111. package/src/solid/responsive-dialog.tsx +134 -134
  112. package/src/solid/schema-form.tsx +743 -743
  113. package/src/solid/scope-indicator.tsx +5 -5
  114. package/src/solid/scroll-area.tsx +16 -16
  115. package/src/solid/section-card.tsx +281 -281
  116. package/src/solid/select.tsx +101 -101
  117. package/src/solid/separator.tsx +25 -25
  118. package/src/solid/settings-row.tsx +122 -122
  119. package/src/solid/sheet.tsx +96 -96
  120. package/src/solid/skeleton.tsx +8 -8
  121. package/src/solid/slider.tsx +132 -132
  122. package/src/solid/sliding-indicator.tsx +280 -265
  123. package/src/solid/sonner.tsx +165 -164
  124. package/src/solid/spinner.tsx +12 -12
  125. package/src/solid/spotlight.tsx +140 -140
  126. package/src/solid/step-indicator.tsx +18 -18
  127. package/src/solid/swatch-picker.tsx +38 -38
  128. package/src/solid/switch.tsx +52 -52
  129. package/src/solid/table.tsx +63 -63
  130. package/src/solid/tabs.tsx +93 -93
  131. package/src/solid/textarea.tsx +8 -8
  132. package/src/solid/toggle-group.tsx +83 -83
  133. package/src/solid/toggle.tsx +33 -33
  134. package/src/solid/tooltip.tsx +16 -16
  135. package/src/solid/widget-card.tsx +90 -90
  136. package/src/solid/widget-identity.tsx +99 -99
  137. package/src/solid/widget-trust-badge.tsx +20 -20
  138. package/src/styles/globals.css +316 -319
  139. package/src/styles/theme.css +448 -448
  140. package/src/tokens/hex.ts +29 -29
  141. package/src/tokens/material.ts +75 -75
  142. package/src/tokens/presets.ts +303 -303
  143. package/src/tokens/readability.ts +32 -32
  144. package/src/tokens/theme-colors.ts +95 -95
  145. package/src/tokens/theme-css.ts +22 -22
  146. package/src/tokens/theme-recipe.ts +106 -106
@@ -9,422 +9,422 @@ import { PickerTrigger } from "./picker-trigger.js";
9
9
  import { Popover, PopoverAnchor, PopoverContent } from "./popover.js";
10
10
 
11
11
  const ICON_LIBRARIES = [
12
- { prefix: "", label: "All" },
13
- { prefix: "mdi", label: "MDI" },
14
- { prefix: "lucide", label: "Lucide" },
15
- { prefix: "solar", label: "Solar" },
16
- { prefix: "tabler", label: "Tabler" },
17
- { prefix: "ph", label: "Phosphor" },
18
- { prefix: "fluent", label: "Fluent" },
12
+ { prefix: "", label: "All" },
13
+ { prefix: "mdi", label: "MDI" },
14
+ { prefix: "lucide", label: "Lucide" },
15
+ { prefix: "solar", label: "Solar" },
16
+ { prefix: "tabler", label: "Tabler" },
17
+ { prefix: "ph", label: "Phosphor" },
18
+ { prefix: "fluent", label: "Fluent" },
19
19
  ] as const;
20
20
 
21
21
  const COMMON_ICONS: Record<string, string[]> = {
22
- mdi: [
23
- "mdi:home",
24
- "mdi:home-outline",
25
- "mdi:lightbulb",
26
- "mdi:lightbulb-outline",
27
- "mdi:lamp",
28
- "mdi:ceiling-light",
29
- "mdi:floor-lamp",
30
- "mdi:led-strip",
31
- "mdi:power-plug",
32
- "mdi:power-socket",
33
- "mdi:toggle-switch",
34
- "mdi:thermometer",
35
- "mdi:thermostat",
36
- "mdi:air-conditioner",
37
- "mdi:fan",
38
- "mdi:water",
39
- "mdi:fire",
40
- "mdi:snowflake",
41
- "mdi:weather-partly-cloudy",
42
- "mdi:lock",
43
- "mdi:lock-open",
44
- "mdi:door",
45
- "mdi:door-open",
46
- "mdi:window-closed",
47
- "mdi:window-open",
48
- "mdi:garage",
49
- "mdi:gate",
50
- "mdi:blinds",
51
- "mdi:television",
52
- "mdi:speaker",
53
- "mdi:cast",
54
- "mdi:camera",
55
- "mdi:cctv",
56
- "mdi:motion-sensor",
57
- "mdi:smoke-detector",
58
- "mdi:bell",
59
- "mdi:battery",
60
- "mdi:solar-power",
61
- "mdi:robot-vacuum",
62
- "mdi:washing-machine",
63
- "mdi:fridge",
64
- "mdi:stove",
65
- "mdi:bed",
66
- "mdi:sofa",
67
- "mdi:shower",
68
- "mdi:car",
69
- "mdi:wifi",
70
- "mdi:router-wireless",
71
- "mdi:view-dashboard",
72
- "mdi:cog",
73
- "mdi:star",
74
- "mdi:heart",
75
- "mdi:shield-home",
76
- "mdi:home-floor-1",
77
- "mdi:home-floor-2",
78
- "mdi:home-floor-3",
79
- "mdi:home-group",
80
- "mdi:office-building",
81
- ],
82
- lucide: [
83
- "lucide:home",
84
- "lucide:lightbulb",
85
- "lucide:lamp",
86
- "lucide:lamp-desk",
87
- "lucide:plug",
88
- "lucide:power",
89
- "lucide:thermometer",
90
- "lucide:flame",
91
- "lucide:snowflake",
92
- "lucide:wind",
93
- "lucide:droplets",
94
- "lucide:sun",
95
- "lucide:cloud-sun",
96
- "lucide:lock",
97
- "lucide:lock-open",
98
- "lucide:door-open",
99
- "lucide:door-closed",
100
- "lucide:blinds",
101
- "lucide:tv",
102
- "lucide:speaker",
103
- "lucide:camera",
104
- "lucide:bell",
105
- "lucide:battery",
106
- "lucide:car",
107
- "lucide:wifi",
108
- "lucide:router",
109
- "lucide:layout-dashboard",
110
- "lucide:settings",
111
- "lucide:star",
112
- "lucide:heart",
113
- "lucide:shield",
114
- "lucide:eye",
115
- "lucide:zap",
116
- "lucide:clock",
117
- "lucide:calendar",
118
- "lucide:link",
119
- "lucide:image",
120
- "lucide:music",
121
- "lucide:map-pin",
122
- "lucide:user",
123
- ],
124
- solar: [
125
- "solar:home-bold",
126
- "solar:home-linear",
127
- "solar:lamp-bold",
128
- "solar:lightbulb-bolt-bold",
129
- "solar:plug-circle-bold",
130
- "solar:temperature-bold",
131
- "solar:fire-bold",
132
- "solar:snowflake-bold",
133
- "solar:lock-bold",
134
- "solar:lock-unlocked-bold",
135
- "solar:tv-bold",
136
- "solar:speaker-bold",
137
- "solar:camera-bold",
138
- "solar:bell-bold",
139
- "solar:battery-charge-bold",
140
- "solar:wi-fi-router-bold",
141
- "solar:widget-bold",
142
- "solar:settings-bold",
143
- "solar:star-bold",
144
- "solar:heart-bold",
145
- "solar:shield-bold",
146
- "solar:eye-bold",
147
- "solar:bolt-bold",
148
- "solar:clock-circle-bold",
149
- "solar:calendar-bold",
150
- "solar:link-bold",
151
- "solar:gallery-bold",
152
- "solar:music-note-bold",
153
- "solar:map-point-bold",
154
- "solar:user-bold",
155
- ],
156
- tabler: [
157
- "tabler:home",
158
- "tabler:bulb",
159
- "tabler:lamp",
160
- "tabler:plug",
161
- "tabler:power",
162
- "tabler:temperature",
163
- "tabler:flame",
164
- "tabler:snowflake",
165
- "tabler:wind",
166
- "tabler:droplet",
167
- "tabler:sun",
168
- "tabler:cloud",
169
- "tabler:lock",
170
- "tabler:lock-open",
171
- "tabler:door",
172
- "tabler:window",
173
- "tabler:device-tv",
174
- "tabler:speaker",
175
- "tabler:camera",
176
- "tabler:bell",
177
- "tabler:battery",
178
- "tabler:car",
179
- "tabler:wifi",
180
- "tabler:router",
181
- "tabler:dashboard",
182
- "tabler:settings",
183
- "tabler:star",
184
- "tabler:heart",
185
- "tabler:shield",
186
- "tabler:eye",
187
- ],
188
- ph: [
189
- "ph:house-bold",
190
- "ph:lightbulb-bold",
191
- "ph:lamp-bold",
192
- "ph:plug-bold",
193
- "ph:power-bold",
194
- "ph:thermometer-bold",
195
- "ph:fire-bold",
196
- "ph:snowflake-bold",
197
- "ph:wind-bold",
198
- "ph:drop-bold",
199
- "ph:sun-bold",
200
- "ph:cloud-sun-bold",
201
- "ph:lock-bold",
202
- "ph:lock-open-bold",
203
- "ph:door-bold",
204
- "ph:television-bold",
205
- "ph:speaker-high-bold",
206
- "ph:camera-bold",
207
- "ph:bell-bold",
208
- "ph:battery-charging-bold",
209
- "ph:car-bold",
210
- "ph:wifi-high-bold",
211
- "ph:squares-four-bold",
212
- "ph:gear-bold",
213
- "ph:star-bold",
214
- "ph:heart-bold",
215
- "ph:shield-bold",
216
- "ph:eye-bold",
217
- "ph:lightning-bold",
218
- "ph:clock-bold",
219
- ],
220
- fluent: [
221
- "fluent:home-24-filled",
222
- "fluent:lightbulb-24-filled",
223
- "fluent:plug-connected-24-filled",
224
- "fluent:power-24-filled",
225
- "fluent:temperature-24-filled",
226
- "fluent:fire-24-filled",
227
- "fluent:weather-snowflake-24-filled",
228
- "fluent:lock-closed-24-filled",
229
- "fluent:lock-open-24-filled",
230
- "fluent:door-24-filled",
231
- "fluent:tv-24-filled",
232
- "fluent:speaker-2-24-filled",
233
- "fluent:camera-24-filled",
234
- "fluent:alert-24-filled",
235
- "fluent:battery-charge-24-filled",
236
- "fluent:vehicle-car-24-filled",
237
- "fluent:wifi-1-24-filled",
238
- "fluent:board-24-filled",
239
- "fluent:settings-24-filled",
240
- "fluent:star-24-filled",
241
- "fluent:heart-24-filled",
242
- "fluent:shield-24-filled",
243
- "fluent:eye-24-filled",
244
- "fluent:flash-24-filled",
245
- "fluent:clock-24-filled",
246
- "fluent:calendar-24-filled",
247
- "fluent:link-24-filled",
248
- "fluent:image-24-filled",
249
- "fluent:music-note-1-24-filled",
250
- "fluent:person-24-filled",
251
- ],
22
+ mdi: [
23
+ "mdi:home",
24
+ "mdi:home-outline",
25
+ "mdi:lightbulb",
26
+ "mdi:lightbulb-outline",
27
+ "mdi:lamp",
28
+ "mdi:ceiling-light",
29
+ "mdi:floor-lamp",
30
+ "mdi:led-strip",
31
+ "mdi:power-plug",
32
+ "mdi:power-socket",
33
+ "mdi:toggle-switch",
34
+ "mdi:thermometer",
35
+ "mdi:thermostat",
36
+ "mdi:air-conditioner",
37
+ "mdi:fan",
38
+ "mdi:water",
39
+ "mdi:fire",
40
+ "mdi:snowflake",
41
+ "mdi:weather-partly-cloudy",
42
+ "mdi:lock",
43
+ "mdi:lock-open",
44
+ "mdi:door",
45
+ "mdi:door-open",
46
+ "mdi:window-closed",
47
+ "mdi:window-open",
48
+ "mdi:garage",
49
+ "mdi:gate",
50
+ "mdi:blinds",
51
+ "mdi:television",
52
+ "mdi:speaker",
53
+ "mdi:cast",
54
+ "mdi:camera",
55
+ "mdi:cctv",
56
+ "mdi:motion-sensor",
57
+ "mdi:smoke-detector",
58
+ "mdi:bell",
59
+ "mdi:battery",
60
+ "mdi:solar-power",
61
+ "mdi:robot-vacuum",
62
+ "mdi:washing-machine",
63
+ "mdi:fridge",
64
+ "mdi:stove",
65
+ "mdi:bed",
66
+ "mdi:sofa",
67
+ "mdi:shower",
68
+ "mdi:car",
69
+ "mdi:wifi",
70
+ "mdi:router-wireless",
71
+ "mdi:view-dashboard",
72
+ "mdi:cog",
73
+ "mdi:star",
74
+ "mdi:heart",
75
+ "mdi:shield-home",
76
+ "mdi:home-floor-1",
77
+ "mdi:home-floor-2",
78
+ "mdi:home-floor-3",
79
+ "mdi:home-group",
80
+ "mdi:office-building",
81
+ ],
82
+ lucide: [
83
+ "lucide:home",
84
+ "lucide:lightbulb",
85
+ "lucide:lamp",
86
+ "lucide:lamp-desk",
87
+ "lucide:plug",
88
+ "lucide:power",
89
+ "lucide:thermometer",
90
+ "lucide:flame",
91
+ "lucide:snowflake",
92
+ "lucide:wind",
93
+ "lucide:droplets",
94
+ "lucide:sun",
95
+ "lucide:cloud-sun",
96
+ "lucide:lock",
97
+ "lucide:lock-open",
98
+ "lucide:door-open",
99
+ "lucide:door-closed",
100
+ "lucide:blinds",
101
+ "lucide:tv",
102
+ "lucide:speaker",
103
+ "lucide:camera",
104
+ "lucide:bell",
105
+ "lucide:battery",
106
+ "lucide:car",
107
+ "lucide:wifi",
108
+ "lucide:router",
109
+ "lucide:layout-dashboard",
110
+ "lucide:settings",
111
+ "lucide:star",
112
+ "lucide:heart",
113
+ "lucide:shield",
114
+ "lucide:eye",
115
+ "lucide:zap",
116
+ "lucide:clock",
117
+ "lucide:calendar",
118
+ "lucide:link",
119
+ "lucide:image",
120
+ "lucide:music",
121
+ "lucide:map-pin",
122
+ "lucide:user",
123
+ ],
124
+ solar: [
125
+ "solar:home-bold",
126
+ "solar:home-linear",
127
+ "solar:lamp-bold",
128
+ "solar:lightbulb-bolt-bold",
129
+ "solar:plug-circle-bold",
130
+ "solar:temperature-bold",
131
+ "solar:fire-bold",
132
+ "solar:snowflake-bold",
133
+ "solar:lock-bold",
134
+ "solar:lock-unlocked-bold",
135
+ "solar:tv-bold",
136
+ "solar:speaker-bold",
137
+ "solar:camera-bold",
138
+ "solar:bell-bold",
139
+ "solar:battery-charge-bold",
140
+ "solar:wi-fi-router-bold",
141
+ "solar:widget-bold",
142
+ "solar:settings-bold",
143
+ "solar:star-bold",
144
+ "solar:heart-bold",
145
+ "solar:shield-bold",
146
+ "solar:eye-bold",
147
+ "solar:bolt-bold",
148
+ "solar:clock-circle-bold",
149
+ "solar:calendar-bold",
150
+ "solar:link-bold",
151
+ "solar:gallery-bold",
152
+ "solar:music-note-bold",
153
+ "solar:map-point-bold",
154
+ "solar:user-bold",
155
+ ],
156
+ tabler: [
157
+ "tabler:home",
158
+ "tabler:bulb",
159
+ "tabler:lamp",
160
+ "tabler:plug",
161
+ "tabler:power",
162
+ "tabler:temperature",
163
+ "tabler:flame",
164
+ "tabler:snowflake",
165
+ "tabler:wind",
166
+ "tabler:droplet",
167
+ "tabler:sun",
168
+ "tabler:cloud",
169
+ "tabler:lock",
170
+ "tabler:lock-open",
171
+ "tabler:door",
172
+ "tabler:window",
173
+ "tabler:device-tv",
174
+ "tabler:speaker",
175
+ "tabler:camera",
176
+ "tabler:bell",
177
+ "tabler:battery",
178
+ "tabler:car",
179
+ "tabler:wifi",
180
+ "tabler:router",
181
+ "tabler:dashboard",
182
+ "tabler:settings",
183
+ "tabler:star",
184
+ "tabler:heart",
185
+ "tabler:shield",
186
+ "tabler:eye",
187
+ ],
188
+ ph: [
189
+ "ph:house-bold",
190
+ "ph:lightbulb-bold",
191
+ "ph:lamp-bold",
192
+ "ph:plug-bold",
193
+ "ph:power-bold",
194
+ "ph:thermometer-bold",
195
+ "ph:fire-bold",
196
+ "ph:snowflake-bold",
197
+ "ph:wind-bold",
198
+ "ph:drop-bold",
199
+ "ph:sun-bold",
200
+ "ph:cloud-sun-bold",
201
+ "ph:lock-bold",
202
+ "ph:lock-open-bold",
203
+ "ph:door-bold",
204
+ "ph:television-bold",
205
+ "ph:speaker-high-bold",
206
+ "ph:camera-bold",
207
+ "ph:bell-bold",
208
+ "ph:battery-charging-bold",
209
+ "ph:car-bold",
210
+ "ph:wifi-high-bold",
211
+ "ph:squares-four-bold",
212
+ "ph:gear-bold",
213
+ "ph:star-bold",
214
+ "ph:heart-bold",
215
+ "ph:shield-bold",
216
+ "ph:eye-bold",
217
+ "ph:lightning-bold",
218
+ "ph:clock-bold",
219
+ ],
220
+ fluent: [
221
+ "fluent:home-24-filled",
222
+ "fluent:lightbulb-24-filled",
223
+ "fluent:plug-connected-24-filled",
224
+ "fluent:power-24-filled",
225
+ "fluent:temperature-24-filled",
226
+ "fluent:fire-24-filled",
227
+ "fluent:weather-snowflake-24-filled",
228
+ "fluent:lock-closed-24-filled",
229
+ "fluent:lock-open-24-filled",
230
+ "fluent:door-24-filled",
231
+ "fluent:tv-24-filled",
232
+ "fluent:speaker-2-24-filled",
233
+ "fluent:camera-24-filled",
234
+ "fluent:alert-24-filled",
235
+ "fluent:battery-charge-24-filled",
236
+ "fluent:vehicle-car-24-filled",
237
+ "fluent:wifi-1-24-filled",
238
+ "fluent:board-24-filled",
239
+ "fluent:settings-24-filled",
240
+ "fluent:star-24-filled",
241
+ "fluent:heart-24-filled",
242
+ "fluent:shield-24-filled",
243
+ "fluent:eye-24-filled",
244
+ "fluent:flash-24-filled",
245
+ "fluent:clock-24-filled",
246
+ "fluent:calendar-24-filled",
247
+ "fluent:link-24-filled",
248
+ "fluent:image-24-filled",
249
+ "fluent:music-note-1-24-filled",
250
+ "fluent:person-24-filled",
251
+ ],
252
252
  };
253
253
 
254
254
  export interface IconPickerProps {
255
- value: string;
256
- onChange: (value: string) => void;
257
- placeholder?: string;
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
- */
265
- searchIcons?: (query: string, prefix: string) => Promise<string[]>;
266
- /** Id of the element naming the trigger, for forms that label it outside. */
267
- "aria-labelledby"?: string;
255
+ value: string;
256
+ onChange: (value: string) => void;
257
+ placeholder?: string;
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
+ */
265
+ searchIcons?: (query: string, prefix: string) => Promise<string[]>;
266
+ /** Id of the element naming the trigger, for forms that label it outside. */
267
+ "aria-labelledby"?: string;
268
268
  }
269
269
 
270
270
  export function IconPicker(props: IconPickerProps) {
271
- const [open, setOpen] = createSignal(false);
272
- const [search, setSearch] = createSignal("");
273
- const [activeLib, setActiveLib] = createSignal("");
274
- const [apiResults, setApiResults] = createSignal<string[]>([]);
275
- const [loading, setLoading] = createSignal(false);
271
+ const [open, setOpen] = createSignal(false);
272
+ const [search, setSearch] = createSignal("");
273
+ const [activeLib, setActiveLib] = createSignal("");
274
+ const [apiResults, setApiResults] = createSignal<string[]>([]);
275
+ const [loading, setLoading] = createSignal(false);
276
276
 
277
- let debounceTimer: ReturnType<typeof setTimeout> | undefined;
278
- let searchRef: HTMLInputElement | undefined;
277
+ let debounceTimer: ReturnType<typeof setTimeout> | undefined;
278
+ let searchRef: HTMLInputElement | undefined;
279
279
 
280
- const searchIcons = (query: string, prefix: string) => {
281
- clearTimeout(debounceTimer);
282
- if (!query.trim()) {
283
- setApiResults([]);
284
- return;
285
- }
286
- const search = props.searchIcons;
287
- if (!search) return;
288
- setLoading(true);
289
- debounceTimer = setTimeout(async () => {
290
- try {
291
- setApiResults(await search(query, prefix));
292
- } catch {
293
- setApiResults([]);
294
- } finally {
295
- setLoading(false);
296
- }
297
- }, 300);
298
- };
280
+ const searchIcons = (query: string, prefix: string) => {
281
+ clearTimeout(debounceTimer);
282
+ if (!query.trim()) {
283
+ setApiResults([]);
284
+ return;
285
+ }
286
+ const search = props.searchIcons;
287
+ if (!search) return;
288
+ setLoading(true);
289
+ debounceTimer = setTimeout(async () => {
290
+ try {
291
+ setApiResults(await search(query, prefix));
292
+ } catch {
293
+ setApiResults([]);
294
+ } finally {
295
+ setLoading(false);
296
+ }
297
+ }, 300);
298
+ };
299
299
 
300
- const defaultIcons = createMemo(() => {
301
- const lib = activeLib();
302
- if (!lib) {
303
- return Object.values(COMMON_ICONS).flat().slice(0, 60);
304
- }
305
- return COMMON_ICONS[lib] ?? [];
306
- });
300
+ const defaultIcons = createMemo(() => {
301
+ const lib = activeLib();
302
+ if (!lib) {
303
+ return Object.values(COMMON_ICONS).flat().slice(0, 60);
304
+ }
305
+ return COMMON_ICONS[lib] ?? [];
306
+ });
307
307
 
308
- const displayIcons = createMemo(() => {
309
- const q = search().toLowerCase().trim();
310
- if (!q) return defaultIcons();
311
- if (apiResults().length > 0) return apiResults();
312
- return defaultIcons().filter((icon) => icon.toLowerCase().includes(q));
313
- });
308
+ const displayIcons = createMemo(() => {
309
+ const q = search().toLowerCase().trim();
310
+ if (!q) return defaultIcons();
311
+ if (apiResults().length > 0) return apiResults();
312
+ return defaultIcons().filter((icon) => icon.toLowerCase().includes(q));
313
+ });
314
314
 
315
- // A re-tap on the picked icon clears it, the way every picker toggles.
316
- const selectIcon = (icon: string) => {
317
- props.onChange(icon === props.value.trim() ? "" : icon);
318
- setOpen(false);
319
- setSearch("");
320
- };
315
+ // A re-tap on the picked icon clears it, the way every picker toggles.
316
+ const selectIcon = (icon: string) => {
317
+ props.onChange(icon === props.value.trim() ? "" : icon);
318
+ setOpen(false);
319
+ setSearch("");
320
+ };
321
321
 
322
- const clearIcon = () => props.onChange("");
322
+ const clearIcon = () => props.onChange("");
323
323
 
324
- const handleLibChange = (prefix: string) => {
325
- setActiveLib(prefix);
326
- setApiResults([]);
327
- if (search().trim()) {
328
- searchIcons(search(), prefix);
329
- }
330
- };
324
+ const handleLibChange = (prefix: string) => {
325
+ setActiveLib(prefix);
326
+ setApiResults([]);
327
+ if (search().trim()) {
328
+ searchIcons(search(), prefix);
329
+ }
330
+ };
331
331
 
332
- return (
333
- <Popover surface="field" open={open()} onOpenChange={setOpen} modal>
334
- <PopoverAnchor as="div" class={props.class}>
335
- <PickerTrigger
336
- slot="icon-picker-trigger"
337
- open={open()}
338
- onToggle={() => setOpen(!open())}
339
- aria-labelledby={props["aria-labelledby"]}
340
- onClear={props.value.trim() ? clearIcon : undefined}
341
- clearLabel="Clear icon"
342
- >
343
- <Show
344
- when={props.value.trim()}
345
- fallback={
346
- <span class="flex-1 text-left text-muted-foreground">
347
- {props.placeholder ?? "mdi:home"}
348
- </span>
349
- }
350
- >
351
- <Icon icon={props.value.trim()} width={18} height={18} class="shrink-0" />
352
- <span class="flex-1 truncate text-left">{props.value}</span>
353
- </Show>
354
- </PickerTrigger>
355
- </PopoverAnchor>
356
- <PopoverContent
357
- onOpenAutoFocus={(e) => {
358
- e.preventDefault();
359
- // preventScroll: the panel is portalled at (0,0) until the popper places it,
360
- // so a plain focus() scrolls the page to the top.
361
- searchRef?.focus({ preventScroll: true });
362
- }}
363
- onInteractOutside={() => setOpen(false)}
364
- >
365
- <div class="flex flex-col">
366
- <PickerSearch
367
- inputRef={(el) => {
368
- searchRef = el;
369
- }}
370
- value={search()}
371
- onValueChange={(next) => {
372
- setSearch(next);
373
- searchIcons(next, activeLib());
374
- }}
375
- placeholder="Search icons..."
376
- aria-label="Search icons"
377
- />
378
- <div class="flex flex-wrap gap-1 border-border/50 border-b px-2 py-1.5">
379
- <For each={ICON_LIBRARIES}>
380
- {(lib) => (
381
- <button
382
- type="button"
383
- data-slot="icon-picker-library"
384
- aria-pressed={activeLib() === lib.prefix}
385
- class={cn(
386
- CHIP,
387
- "cursor-pointer transition-glass",
388
- activeLib() === lib.prefix
389
- ? "[--glass-tone:var(--primary)]"
390
- : "text-muted-foreground [--glass-base:transparent] [--glass-edge:transparent] [--glass-light:0] [--glass-rim:0] hover:text-foreground",
391
- )}
392
- onClick={() => handleLibChange(lib.prefix)}
393
- >
394
- {lib.label}
395
- </button>
396
- )}
397
- </For>
398
- </div>
399
- <div class={cn(PICKER_LIST, "p-2")}>
400
- <Show when={loading() && displayIcons().length === 0}>
401
- <div class="py-4 text-center text-muted-foreground text-sm">Searching...</div>
402
- </Show>
403
- <Show when={!loading() && search().trim() && displayIcons().length === 0}>
404
- <div class="py-4 text-center text-muted-foreground text-sm">No icons found</div>
405
- </Show>
406
- <div class={cn("grid grid-cols-6 gap-1", STAGGER)}>
407
- <For each={displayIcons()}>
408
- {(icon) => (
409
- <button
410
- type="button"
411
- aria-pressed={props.value === icon}
412
- class={cn(
413
- "mx-auto flex size-11 cursor-pointer items-center justify-center rounded-lg transition-glass hover:bg-accent",
414
- props.value === icon &&
415
- `${ICON_PILL_TINT} text-foreground [--glass-tone:var(--primary)] hover:bg-transparent`,
416
- )}
417
- onClick={() => selectIcon(icon)}
418
- title={icon}
419
- >
420
- <Icon icon={icon} width={22} height={22} />
421
- </button>
422
- )}
423
- </For>
424
- </div>
425
- </div>
426
- </div>
427
- </PopoverContent>
428
- </Popover>
429
- );
332
+ return (
333
+ <Popover surface="field" open={open()} onOpenChange={setOpen} modal>
334
+ <PopoverAnchor as="div" class={props.class}>
335
+ <PickerTrigger
336
+ slot="icon-picker-trigger"
337
+ open={open()}
338
+ onToggle={() => setOpen(!open())}
339
+ aria-labelledby={props["aria-labelledby"]}
340
+ onClear={props.value.trim() ? clearIcon : undefined}
341
+ clearLabel="Clear icon"
342
+ >
343
+ <Show
344
+ when={props.value.trim()}
345
+ fallback={
346
+ <span class="text-muted-foreground flex-1 text-left">
347
+ {props.placeholder ?? "mdi:home"}
348
+ </span>
349
+ }
350
+ >
351
+ <Icon icon={props.value.trim()} width={18} height={18} class="shrink-0" />
352
+ <span class="flex-1 truncate text-left">{props.value}</span>
353
+ </Show>
354
+ </PickerTrigger>
355
+ </PopoverAnchor>
356
+ <PopoverContent
357
+ onOpenAutoFocus={(e) => {
358
+ e.preventDefault();
359
+ // preventScroll: the panel is portalled at (0,0) until the popper places it,
360
+ // so a plain focus() scrolls the page to the top.
361
+ searchRef?.focus({ preventScroll: true });
362
+ }}
363
+ onInteractOutside={() => setOpen(false)}
364
+ >
365
+ <div class="flex flex-col">
366
+ <PickerSearch
367
+ inputRef={(el) => {
368
+ searchRef = el;
369
+ }}
370
+ value={search()}
371
+ onValueChange={(next) => {
372
+ setSearch(next);
373
+ searchIcons(next, activeLib());
374
+ }}
375
+ placeholder="Search icons..."
376
+ aria-label="Search icons"
377
+ />
378
+ <div class="border-border/50 flex flex-wrap gap-1 border-b px-2 py-1.5">
379
+ <For each={ICON_LIBRARIES}>
380
+ {(lib) => (
381
+ <button
382
+ type="button"
383
+ data-slot="icon-picker-library"
384
+ aria-pressed={activeLib() === lib.prefix}
385
+ class={cn(
386
+ CHIP,
387
+ "transition-glass cursor-pointer",
388
+ activeLib() === lib.prefix
389
+ ? "[--glass-tone:var(--primary)]"
390
+ : "text-muted-foreground hover:text-foreground [--glass-base:transparent] [--glass-edge:transparent] [--glass-light:0] [--glass-rim:0]",
391
+ )}
392
+ onClick={() => handleLibChange(lib.prefix)}
393
+ >
394
+ {lib.label}
395
+ </button>
396
+ )}
397
+ </For>
398
+ </div>
399
+ <div class={cn(PICKER_LIST, "p-2")}>
400
+ <Show when={loading() && displayIcons().length === 0}>
401
+ <div class="text-muted-foreground py-4 text-center text-sm">Searching...</div>
402
+ </Show>
403
+ <Show when={!loading() && search().trim() && displayIcons().length === 0}>
404
+ <div class="text-muted-foreground py-4 text-center text-sm">No icons found</div>
405
+ </Show>
406
+ <div class={cn("grid grid-cols-6 gap-1", STAGGER)}>
407
+ <For each={displayIcons()}>
408
+ {(icon) => (
409
+ <button
410
+ type="button"
411
+ aria-pressed={props.value === icon}
412
+ class={cn(
413
+ "transition-glass hover:bg-accent mx-auto flex size-11 cursor-pointer items-center justify-center rounded-lg",
414
+ props.value === icon &&
415
+ `${ICON_PILL_TINT} text-foreground [--glass-tone:var(--primary)] hover:bg-transparent`,
416
+ )}
417
+ onClick={() => selectIcon(icon)}
418
+ title={icon}
419
+ >
420
+ <Icon icon={icon} width={22} height={22} />
421
+ </button>
422
+ )}
423
+ </For>
424
+ </div>
425
+ </div>
426
+ </div>
427
+ </PopoverContent>
428
+ </Popover>
429
+ );
430
430
  }