lumiverse-spindle-types 0.5.3 → 0.5.4
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.
- package/package.json +1 -1
- package/src/components.ts +72 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
package/src/components.ts
CHANGED
|
@@ -206,6 +206,71 @@ export interface SpindleSwitchHandle extends SpindleMountedComponent<SpindleSwit
|
|
|
206
206
|
// Pickers & selects
|
|
207
207
|
// ──────────────────────────────────────────────────────────────────────────
|
|
208
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Declarative leading-cell content for a select option (avatar, icon, swatch, initial).
|
|
211
|
+
*
|
|
212
|
+
* Rendered by the host in the fixed leading slot of both the dropdown row and
|
|
213
|
+
* the selected-value trigger. Extensions describe what they want declaratively
|
|
214
|
+
* — they do not pass React nodes themselves.
|
|
215
|
+
*
|
|
216
|
+
* Common patterns:
|
|
217
|
+
* - Persona/character avatars with initial fallback: pick `{ type: "image", src, fallback }`.
|
|
218
|
+
* The host shows the image when it loads successfully; if `src` is empty or
|
|
219
|
+
* the image fails to load, the host falls back to the supplied initial.
|
|
220
|
+
* - Provider icons / brand marks: `{ type: "icon-svg" }` or `{ type: "icon-url" }`.
|
|
221
|
+
* - Color tags / category swatches: `{ type: "swatch", color }`.
|
|
222
|
+
* - Plain text bubble (initials, single emoji): `{ type: "initial", text }`.
|
|
223
|
+
*/
|
|
224
|
+
export type SpindleSelectOptionLeading =
|
|
225
|
+
| {
|
|
226
|
+
type: "image";
|
|
227
|
+
/** Image URL. Anything `<img src>` accepts, including data URLs. */
|
|
228
|
+
src: string;
|
|
229
|
+
/** Alt text for accessibility. Defaults to empty (decorative). */
|
|
230
|
+
alt?: string;
|
|
231
|
+
/** Render the image as a circle. Default: `true`. Useful for avatars. */
|
|
232
|
+
rounded?: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Fallback rendered when `src` is empty or fails to load. Typically a
|
|
235
|
+
* one-character initial. If omitted, the slot collapses on failure.
|
|
236
|
+
*/
|
|
237
|
+
fallback?: {
|
|
238
|
+
/** Fallback text — usually a single character / initial. */
|
|
239
|
+
text: string;
|
|
240
|
+
/** Optional background color for the fallback bubble. */
|
|
241
|
+
background?: string;
|
|
242
|
+
/** Optional text color for the fallback bubble. */
|
|
243
|
+
color?: string;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
| {
|
|
247
|
+
type: "icon-svg";
|
|
248
|
+
/** Inline SVG string. The host sanitizes and inlines the SVG. */
|
|
249
|
+
svg: string;
|
|
250
|
+
/** Optional foreground color applied via `currentColor`. */
|
|
251
|
+
color?: string;
|
|
252
|
+
}
|
|
253
|
+
| {
|
|
254
|
+
type: "icon-url";
|
|
255
|
+
/** URL to an icon image (PNG / SVG / WebP). */
|
|
256
|
+
url: string;
|
|
257
|
+
alt?: string;
|
|
258
|
+
}
|
|
259
|
+
| {
|
|
260
|
+
type: "swatch";
|
|
261
|
+
/** Any CSS color string. Rendered as a small filled circle. */
|
|
262
|
+
color: string;
|
|
263
|
+
}
|
|
264
|
+
| {
|
|
265
|
+
type: "initial";
|
|
266
|
+
/** Text shown inside the leading bubble — typically one character. */
|
|
267
|
+
text: string;
|
|
268
|
+
/** Background color for the bubble. */
|
|
269
|
+
background?: string;
|
|
270
|
+
/** Text color inside the bubble. */
|
|
271
|
+
color?: string;
|
|
272
|
+
};
|
|
273
|
+
|
|
209
274
|
/** A single option in a select-style picker. */
|
|
210
275
|
export interface SpindleSelectOption {
|
|
211
276
|
/** Stable value emitted to `onChange`. */
|
|
@@ -214,6 +279,13 @@ export interface SpindleSelectOption {
|
|
|
214
279
|
label: string;
|
|
215
280
|
/** Secondary text rendered beneath the label. */
|
|
216
281
|
sublabel?: string;
|
|
282
|
+
/**
|
|
283
|
+
* Optional leading-cell content rendered before the label in both the
|
|
284
|
+
* dropdown row and the selected-value trigger. See {@link SpindleSelectOptionLeading}
|
|
285
|
+
* for the supported variants (avatar image with initial fallback, inline
|
|
286
|
+
* SVG icon, icon URL, color swatch, plain initial bubble).
|
|
287
|
+
*/
|
|
288
|
+
leading?: SpindleSelectOptionLeading;
|
|
217
289
|
/** Group key. Options sharing a group are visually clustered with a header. */
|
|
218
290
|
group?: string;
|
|
219
291
|
/** Render as disabled. */
|