@hearthscale/app-ui 0.2.4 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ButtonHTMLAttributes, ReactNode, MouseEvent, CSSProperties, InputHTMLAttributes, RefObject, FocusEvent, Key, Ref } from 'react';
2
+ import { ButtonHTMLAttributes, ReactNode, MouseEvent, CSSProperties, InputHTMLAttributes, FocusEvent, RefObject, Key, Ref } from 'react';
3
3
 
4
4
  type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
5
5
  type ButtonSize = 'sm' | 'md' | 'lg';
@@ -130,14 +130,15 @@ declare function StatusWord({ tone, live, children }: StatusWordProps): react.JS
130
130
  /**
131
131
  * A caption: the small label above a group, beside a value or under a
132
132
  * mark. It is set in the interface font, in sentence case; monospace is for
133
- * machine text only.
133
+ * code only.
134
134
  * @category Typography
135
135
  */
136
136
  declare function Label({ children }: {
137
137
  children: ReactNode;
138
138
  }): react.JSX.Element;
139
139
  /**
140
- * Machine text inside a sentence or a row: a key, an id, a hash, a path.
140
+ * Machine text inside a sentence or a row: a key, an id, a hash, a path,
141
+ * in the interface font with even digits.
141
142
  * @category Typography
142
143
  */
143
144
  declare function Mono({ children }: {
@@ -216,6 +217,94 @@ interface SegmentedControlProps<T extends string> {
216
217
  */
217
218
  declare function SegmentedControl<T extends string>({ value, options, onChange, label, disabled, }: SegmentedControlProps<T>): react.JSX.Element;
218
219
 
220
+ interface MenuAnchor {
221
+ key: string;
222
+ element: HTMLElement;
223
+ }
224
+ /** Keeps the clicked element as the menu's positioning reference. */
225
+ declare function anchorFrom(key: string, e: MouseEvent<HTMLElement>): MenuAnchor;
226
+ /** A count of the theme's `--space` unit, the length a menu's sizes take so
227
+ * that they follow the theme. @category Overlays */
228
+ type SpaceLength = `calc(var(--space) * ${number})`;
229
+ /** `n` units of the theme's `--space`. @category Overlays */
230
+ declare const spaces: (n: number) => SpaceLength;
231
+ /** The heavy-frost popup surface a context menu or picker sits on. It is
232
+ * drawn into the popup root, so no scroll container clips it and no glass
233
+ * surface it opens from keeps it from frosting what lies behind.
234
+ * @category Overlays */
235
+ declare function MenuSurface({ anchor, align, dir, minWidth, maxWidth, maxHeight, fit, keyboard, onDismiss, children, }: {
236
+ anchor: MenuAnchor;
237
+ align?: 'auto' | 'left' | 'right';
238
+ dir?: 'down' | 'up' | 'right';
239
+ /** The least width; the menu is never narrower than its anchor. */
240
+ minWidth?: SpaceLength;
241
+ /** The menu takes its anchor's width and corners exactly, as a picker
242
+ * that opens beneath its own field does. */
243
+ fit?: boolean;
244
+ keyboard?: boolean;
245
+ /** Caps a menu whose rows carry prose, which would otherwise stretch to
246
+ * the width of the longest sentence. */
247
+ maxWidth?: SpaceLength;
248
+ /** Caps a long list, which then scrolls, opened on its selected row. */
249
+ maxHeight?: SpaceLength;
250
+ onDismiss: () => void;
251
+ children: ReactNode;
252
+ }): react.ReactPortal;
253
+ /** One row of a shell menu: glyph, label, optional sub/chip/check. @category Overlays */
254
+ declare function MItem({ icon, label, sub, chip, checked, selected, danger, disabled, onClick, trailing, }: {
255
+ icon?: ReactNode;
256
+ label: string;
257
+ sub?: string;
258
+ chip?: string;
259
+ checked?: boolean;
260
+ selected?: boolean;
261
+ danger?: boolean;
262
+ /** Drawn dimmed and inert: the row stays visible so the reason for it
263
+ * being unavailable is readable beside it. */
264
+ disabled?: boolean;
265
+ onClick?: () => void;
266
+ /** What sits at the row's end: a switch, a chevron. */
267
+ trailing?: ReactNode;
268
+ }): react.JSX.Element;
269
+ /** A row that opens a flyout on the side with space while hovered. The
270
+ * flyout closes as a menu does, with this row as its trigger, and a row
271
+ * opens its flyout only while no other row of its menu holds one.
272
+ * @category Overlays */
273
+ declare function MSub({ icon, label, minWidth, children, }: {
274
+ icon?: ReactNode;
275
+ label: string;
276
+ /** The flyout's least width. */
277
+ minWidth?: SpaceLength;
278
+ children: ReactNode;
279
+ }): react.JSX.Element;
280
+ /** Hairline between menu groups. @category Overlays */
281
+ declare function MDivider(): react.JSX.Element;
282
+ /** Mono-caps section label inside a menu. @category Overlays */
283
+ declare function MSection({ children }: {
284
+ children: ReactNode;
285
+ }): react.JSX.Element;
286
+ /** Where a floating tip sits against its mark. */
287
+ type TipPlacement = 'bottom-start' | 'bottom' | 'top' | 'right';
288
+ interface TipMore {
289
+ sub?: string | undefined;
290
+ chip?: string | undefined;
291
+ }
292
+ /** Spread `hover` on the mark and render `tip` inside it. `show` and `hide` open
293
+ * and close the tip with no pointer move, for words that arrive after a press.
294
+ * @category Overlays */
295
+ declare function useFloatingTips(placement?: TipPlacement): (key: string, text: string | undefined, more?: TipMore) => {
296
+ show: (anchor: HTMLElement) => void;
297
+ hide: () => void;
298
+ hover: {
299
+ onMouseEnter: (e: MouseEvent<HTMLElement>) => void;
300
+ onFocus: (e: FocusEvent<HTMLElement>) => void;
301
+ onBlur: () => void;
302
+ onMouseLeave: () => void;
303
+ onMouseDown: () => void;
304
+ };
305
+ tip: react.JSX.Element | null;
306
+ };
307
+
219
308
  /** One settings group, with a single border around its rows. @category Settings */
220
309
  declare function SettingsCard({ children }: {
221
310
  children: ReactNode;
@@ -228,14 +317,15 @@ declare function SettingsSection({ children, first, action, }: {
228
317
  }): react.JSX.Element;
229
318
  /** The settings surface's search field: the shell's address-field recipe,
230
319
  * whose placeholder sits centred and slides left on focus. @category Settings */
231
- declare function SettingsSearch({ value, placeholder, onChange, }: {
320
+ declare function SettingsSearch({ value, placeholder, onChange, autoFocus, }: {
232
321
  value: string;
233
322
  placeholder: string;
234
323
  onChange: (value: string) => void;
324
+ autoFocus?: boolean;
235
325
  }): react.JSX.Element;
236
326
  /** A picker on the shell's own menu, in place of a native select.
237
327
  * @category Settings */
238
- declare function SettingsSelect<T extends string>({ value, options, onPick, minWidth, menuHeight, menuWidth, placeholder, disabled, label, }: {
328
+ declare function SettingsSelect<T extends string>({ value, options, onPick, minWidth, menuHeight, menuWidth, placeholder, disabled, label, note, }: {
239
329
  value: T;
240
330
  /** `disabled` keeps an entry visible and inert, so the reason it cannot
241
331
  * be picked is readable where the pick is made. */
@@ -247,23 +337,30 @@ declare function SettingsSelect<T extends string>({ value, options, onPick, minW
247
337
  disabled?: boolean;
248
338
  }[];
249
339
  onPick: (value: T) => void;
250
- minWidth?: number;
340
+ /** The menu's least width. */
341
+ minWidth?: SpaceLength;
251
342
  /** Caps the menu of a long list, which then scrolls. */
252
- menuHeight?: number;
343
+ menuHeight?: SpaceLength;
253
344
  /** Caps the menu of rows whose sub lines carry prose, which then wraps. */
254
- menuWidth?: number;
345
+ menuWidth?: SpaceLength;
255
346
  placeholder?: string;
256
347
  disabled?: boolean;
257
348
  label?: string;
349
+ /** Quiet words at the button's end, which give way before the row grows. */
350
+ note?: string | undefined;
258
351
  }): react.JSX.Element;
259
352
  /** A labelled row with a toggle at its end. @category Settings */
260
- declare function ToggleRow({ id, title, sub, help, on, onFlip, }: {
353
+ declare function ToggleRow({ id, mark, title, sub, help, actions, on, onFlip, }: {
261
354
  id?: string;
355
+ /** What stands at the start of the row, such as a model's logo. */
356
+ mark?: ReactNode;
262
357
  title: string;
263
358
  /** Only where the label cannot carry the meaning on its own. */
264
359
  sub?: string;
265
360
  /** An explanation behind a question mark, for the same case. */
266
361
  help?: string;
362
+ /** Presses on what the switch governs, beside it. */
363
+ actions?: ReactNode;
267
364
  on: boolean;
268
365
  onFlip?: () => void;
269
366
  }): react.JSX.Element;
@@ -325,82 +422,46 @@ declare function SettingsTabs<T extends string>({ label, value, tabs, onPick, pa
325
422
  panelRef?: RefObject<HTMLElement | null>;
326
423
  }): react.JSX.Element;
327
424
 
328
- interface MenuAnchor {
329
- key: string;
330
- element: HTMLElement;
331
- }
332
- /** Keeps the clicked element as the menu's positioning reference. */
333
- declare function anchorFrom(key: string, e: MouseEvent<HTMLElement>): MenuAnchor;
334
- /** The heavy-frost popup surface a context menu or picker sits on. It is
335
- * drawn into the popup root, so no scroll container clips it and no glass
336
- * surface it opens from keeps it from frosting what lies behind.
337
- * @category Overlays */
338
- declare function MenuSurface({ anchor, align, dir, minWidth, maxWidth, maxHeight, fit, keyboard, onDismiss, children, }: {
339
- anchor: MenuAnchor;
340
- align?: 'auto' | 'left' | 'right';
341
- dir?: 'down' | 'up' | 'right';
342
- minWidth?: number;
343
- /** The menu takes its anchor's width and corners exactly, as a picker
344
- * that opens beneath its own field does. */
345
- fit?: boolean;
346
- keyboard?: boolean;
347
- /** Caps a menu whose rows carry prose, which would otherwise stretch to
348
- * the width of the longest sentence. */
349
- maxWidth?: number;
350
- /** Caps a long list, which then scrolls, opened on its selected row. */
351
- maxHeight?: number;
352
- onDismiss: () => void;
425
+ interface ModalProps {
426
+ title: string;
353
427
  children: ReactNode;
354
- }): react.ReactPortal;
355
- /** One row of a shell menu: glyph, label, optional sub/chip/check. @category Overlays */
356
- declare function MItem({ icon, label, sub, chip, checked, selected, danger, disabled, onClick, trailing, }: {
357
- icon?: ReactNode;
358
- label: string;
359
- sub?: string;
360
- chip?: string;
361
- checked?: boolean;
362
- selected?: boolean;
363
- danger?: boolean;
364
- /** Drawn dimmed and inert: the row stays visible so the reason for it
365
- * being unavailable is readable beside it. */
366
- disabled?: boolean;
367
- onClick?: () => void;
368
- /** What sits at the row's end: a switch, a chevron. */
369
- trailing?: ReactNode;
370
- }): react.JSX.Element;
371
- /** A row that opens a flyout on the side with space while hovered. The
372
- * flyout closes as a menu does, with this row as its trigger, and a row
373
- * opens its flyout only while no other row of its menu holds one.
374
- * @category Overlays */
375
- declare function MSub({ icon, label, minWidth, children, }: {
376
- icon?: ReactNode;
428
+ onClose: () => void;
429
+ /** 460px is the settings dialog; widen only for genuinely wider content. */
430
+ width?: number;
431
+ /** Dims the page behind the card. A view in a modal draws with `false`, for
432
+ * the host has dimmed its tile. */
433
+ scrim?: boolean;
434
+ }
435
+ /**
436
+ * The desktop dialog: a centred `--win` card over a dimmed page. The close
437
+ * press, Escape and a press outside the card close it.
438
+ * @category Overlays
439
+ */
440
+ declare function Modal({ title, children, onClose, width, scrim }: ModalProps): react.JSX.Element;
441
+
442
+ interface MultiSelectProps {
443
+ /** What the choice is of, as a person reads it: `Languages`. */
377
444
  label: string;
378
- minWidth?: number;
379
- children: ReactNode;
380
- }): react.JSX.Element;
381
- /** Hairline between menu groups. @category Overlays */
382
- declare function MDivider(): react.JSX.Element;
383
- /** Mono-caps section label inside a menu. @category Overlays */
384
- declare function MSection({ children }: {
385
- children: ReactNode;
386
- }): react.JSX.Element;
387
- /** Where a floating tip sits against its mark. */
388
- type TipPlacement = 'bottom-start' | 'bottom' | 'top' | 'right';
389
- interface TipMore {
390
- sub?: string | undefined;
391
- chip?: string | undefined;
445
+ /** The values to offer, in their order. */
446
+ options: string[];
447
+ labelOf: (value: string) => string;
448
+ picked: string[];
449
+ onPick: (picked: string[]) => void;
450
+ searchWords: string;
451
+ /** The word of several values in the button: `languages`. */
452
+ countWord: string;
453
+ onOpen?: () => void;
454
+ align?: 'auto' | 'left' | 'right';
455
+ /** The words of having none chosen, which the menu then offers. Without them,
456
+ * the last value stays chosen. */
457
+ all?: string;
392
458
  }
393
- /** Spread `hover` on the mark and render `tip` inside it. @category Overlays */
394
- declare function useFloatingTips(placement?: TipPlacement): (key: string, text: string | undefined, more?: TipMore) => {
395
- hover: {
396
- onMouseEnter: (e: MouseEvent<HTMLElement>) => void;
397
- onFocus: (e: FocusEvent<HTMLElement>) => void;
398
- onBlur: () => void;
399
- onMouseLeave: () => void;
400
- onMouseDown: () => void;
401
- };
402
- tip: react.JSX.Element | null;
403
- };
459
+ /**
460
+ * A choice of several values: a select whose menu holds the shell's search field
461
+ * and a check beside each value it keeps open for the next one.
462
+ * @category Settings
463
+ */
464
+ declare function MultiSelect({ label, options, labelOf, picked, onPick, searchWords, countWord, onOpen, align, all, }: MultiSelectProps): react.JSX.Element;
404
465
 
405
466
  interface ShellConfirmProps {
406
467
  title: string;
@@ -408,7 +469,7 @@ interface ShellConfirmProps {
408
469
  /** The action's label, in the imperative: "Regenerate", "Delete 3 sessions". */
409
470
  action: string;
410
471
  /** The action's look: `danger` where the action destroys something,
411
- * `primary` where it installs or buys. */
472
+ * `primary` for any other action. */
412
473
  tone?: 'danger' | 'primary';
413
474
  /** The mark before the action's label. A `danger` action without one
414
475
  * carries the delete mark. */
@@ -642,6 +703,12 @@ interface PersonMarkProps {
642
703
  */
643
704
  declare function PersonMark({ name, picture, size, swatch }: PersonMarkProps): react.JSX.Element;
644
705
 
706
+ /**
707
+ * Control: the first-party half of the inference contract — everything the
708
+ * OpenAI shape cannot express. Served by the Server (`hearthd`) beside the
709
+ * generation routes.
710
+ */
711
+
645
712
  /** Resolved publisher identity, independent of the model architecture.
646
713
  * `GET /v1/publishers/{owner}/picture` answers the picture of the Hub
647
714
  * user or organisation `repository` names first: its bytes as
@@ -748,5 +815,5 @@ interface IconProps {
748
815
  */
749
816
  declare function Icon({ name, size, className, style }: IconProps): react.JSX.Element;
750
817
 
751
- export { Button, Card, Chip, DateGrid, DatePicker, EmptyState, FactRow, Icon, IconButton, InfoRow, Kbd, Label, Lightbox, LinkRow, ListRow, MDivider, MItem, MSection, MSub, MenuSurface, Meter, ModelAvatar, Mono, Notice, OverlayScroll, PageTitle, PersonMark, PictureCompare, Popover, PublisherPicturesContext, SWATCHES, SegmentedControl, SettingsCard, SettingsSearch, SettingsSection, SettingsSelect, SettingsTabs, ShellConfirm, Slider, StatusWord, SwatchPicker, TextField, TextInput, TimePicker, Toast, Toggle, ToggleRow, VirtualList, anchorFrom, useFloatingTips };
752
- export type { ButtonProps, ButtonSize, ButtonVariant, CardProps, ChipProps, ChipTone, ComparedPicture, DateGridProps, DatePickerProps, EmptyStateProps, IconButtonProps, IconButtonSize, IconName, IconProps, LightboxItem, LightboxProps, MenuAnchor, MeterProps, OverlayScrollProps, OwnIconName, PageTitleProps, PersonMarkProps, PictureCompareProps, PlainDate, PlainTime, PopoverPlacement, PopoverProps, PublisherPictures, SegmentedControlProps, ShellConfirmProps, SliderProps, StatusTone, StatusWordProps, Swatch, SwatchPickerProps, TextFieldProps, TextInputProps, TimePickerProps, ToastProps, ToggleProps, VirtualListHandle, VirtualListProps };
818
+ export { Button, Card, Chip, DateGrid, DatePicker, EmptyState, FactRow, Icon, IconButton, InfoRow, Kbd, Label, Lightbox, LinkRow, ListRow, MDivider, MItem, MSection, MSub, MenuSurface, Meter, Modal, ModelAvatar, Mono, MultiSelect, Notice, OverlayScroll, PageTitle, PersonMark, PictureCompare, Popover, PublisherPicturesContext, SWATCHES, SegmentedControl, SettingsCard, SettingsSearch, SettingsSection, SettingsSelect, SettingsTabs, ShellConfirm, Slider, StatusWord, SwatchPicker, TextField, TextInput, TimePicker, Toast, Toggle, ToggleRow, VirtualList, anchorFrom, spaces, useFloatingTips };
819
+ export type { ButtonProps, ButtonSize, ButtonVariant, CardProps, ChipProps, ChipTone, ComparedPicture, DateGridProps, DatePickerProps, EmptyStateProps, IconButtonProps, IconButtonSize, IconName, IconProps, LightboxItem, LightboxProps, MenuAnchor, MeterProps, ModalProps, MultiSelectProps, OverlayScrollProps, OwnIconName, PageTitleProps, PersonMarkProps, PictureCompareProps, PlainDate, PlainTime, PopoverPlacement, PopoverProps, PublisherPictures, SegmentedControlProps, ShellConfirmProps, SliderProps, SpaceLength, StatusTone, StatusWordProps, Swatch, SwatchPickerProps, TextFieldProps, TextInputProps, TimePickerProps, ToastProps, ToggleProps, VirtualListHandle, VirtualListProps };