nish-ui 2.1.3 → 3.0.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/README.md +6 -2
- package/dist/chart.js +1 -1
- package/dist/elements-all.js +58 -58
- package/dist/elements-charts.js +1 -1
- package/dist/elements-data.js +1 -1
- package/dist/elements-forms.js +1 -1
- package/dist/elements.js +4 -4
- package/dist/esm/components/accordion.js +3 -2
- package/dist/esm/components/app-shell.js +3 -2
- package/dist/esm/components/avatar.js +4 -3
- package/dist/esm/components/breadcrumbs.js +3 -2
- package/dist/esm/components/calendar-base.js +292 -0
- package/dist/esm/components/calendar-classes.js +78 -0
- package/dist/esm/components/calendar.js +22 -254
- package/dist/esm/components/canvas/legend.js +3 -2
- package/dist/esm/components/canvas/node.js +3 -2
- package/dist/esm/components/canvas/system-canvas.js +3 -2
- package/dist/esm/components/carousel.js +3 -2
- package/dist/esm/components/charts.js +8 -7
- package/dist/esm/components/combobox.js +3 -2
- package/dist/esm/components/command.js +4 -3
- package/dist/esm/components/context-menu.js +3 -2
- package/dist/esm/components/data.js +4 -3
- package/dist/esm/components/date-picker.js +4 -3
- package/dist/esm/components/date-range-picker.js +214 -0
- package/dist/esm/components/display.js +7 -6
- package/dist/esm/components/drawer.js +3 -2
- package/dist/esm/components/error-boundary.js +4 -2
- package/dist/esm/components/feedback.js +7 -6
- package/dist/esm/components/file-dropzone.js +3 -2
- package/dist/esm/components/filters.js +4 -3
- package/dist/esm/components/flow.js +6 -5
- package/dist/esm/components/forms.js +14 -8
- package/dist/esm/components/hooks.js +2 -2
- package/dist/esm/components/hover-card.js +2 -2
- package/dist/esm/components/inbox.js +4 -2
- package/dist/esm/components/layout.js +5 -4
- package/dist/esm/components/media.js +3 -2
- package/dist/esm/components/menu.js +5 -4
- package/dist/esm/components/modal.js +4 -3
- package/dist/esm/components/more-sheet.js +3 -2
- package/dist/esm/components/multi-select.js +3 -2
- package/dist/esm/components/nav-items.js +4 -3
- package/dist/esm/components/nav.js +5 -4
- package/dist/esm/components/overlay-dialog.js +3 -2
- package/dist/esm/components/pagination.js +3 -2
- package/dist/esm/components/popover.js +2 -2
- package/dist/esm/components/portal.js +2 -2
- package/dist/esm/components/progress.js +3 -2
- package/dist/esm/components/provider.js +34 -5
- package/dist/esm/components/range-calendar.js +123 -0
- package/dist/esm/components/service-tokens.js +4 -3
- package/dist/esm/components/settings.js +4 -3
- package/dist/esm/components/slider.js +3 -2
- package/dist/esm/components/split.js +4 -3
- package/dist/esm/components/strings.js +178 -60
- package/dist/esm/components/tag-input.js +3 -2
- package/dist/esm/components/theme-toggle.js +3 -2
- package/dist/esm/components/time-field-classes.js +110 -0
- package/dist/esm/components/time-field.js +309 -0
- package/dist/esm/components/toast-card.js +155 -0
- package/dist/esm/components/toast-store.js +136 -0
- package/dist/esm/components/toast.js +38 -241
- package/dist/esm/components/tooltip.js +2 -2
- package/dist/esm/components/tree-view.js +40 -46
- package/dist/esm/components/virtual-table.js +3 -2
- package/dist/esm/index.js +6 -20
- package/dist/esm/runtime.js +1 -1
- package/dist/esm/system-canvas.js +4 -0
- package/dist/esm/theme.js +7 -7
- package/dist/format.js +1 -1
- package/dist/index.d.ts +172 -24
- package/dist/system-canvas.d.ts +183 -2
- package/dist/theme.d.ts +21 -3
- package/dist/theme.global.js +21 -136
- package/dist/theme.js +21 -136
- package/package.json +1 -1
- package/dist/system-canvas-BLuWd69H.d.ts +0 -183
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, useLayoutEffect, HTMLAttributes, Ref, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, FieldsetHTMLAttributes, ChangeEvent,
|
|
4
|
-
export { C as CanvasEdge, a as CanvasEdgeKind, b as CanvasGroup, c as CanvasHue, d as CanvasLabels, e as CanvasLayout, f as CanvasLayoutMode, g as CanvasNode, h as CanvasNodeKind, D as DEFAULT_CANVAS_LABELS, L as LayoutOptions, R as RoutedEdge, S as SystemCanvas, i as SystemCanvasProps, l as layoutSystem, p as pickLayout, r as routeEdges } from './system-canvas-BLuWd69H.js';
|
|
5
|
-
export { DEFAULT_INBOX_LABELS, INBOX_ACTION_HEADER, INBOX_ACTION_TIMEOUT_MS, INBOX_DEFAULT_SETTINGS, INBOX_SOURCE_LABELS, Inbox, InboxAction, InboxActionCall, InboxActionResult, InboxItem, InboxLabels, InboxListResponse, InboxProps, InboxSettings, InboxSeverity, InboxView } from './inbox.js';
|
|
6
|
-
export { ServiceTokenListResponse, ServiceTokenView, ServiceTokensSection, ServiceTokensSectionProps, useServiceTokens } from './service-tokens.js';
|
|
3
|
+
import { ReactNode, useLayoutEffect, HTMLAttributes, Ref, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, FieldsetHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, ComponentPropsWithoutRef, RefObject, ReactElement, ComponentProps, ElementType, ComponentPropsWithRef, SVGProps, MouseEvent } from 'react';
|
|
7
4
|
|
|
8
5
|
/** Conditional Tailwind classes with conflict resolution. */
|
|
9
6
|
declare function cn(...inputs: ClassValue[]): string;
|
|
@@ -104,6 +101,24 @@ interface NishStrings {
|
|
|
104
101
|
monthToken: string;
|
|
105
102
|
/** DatePicker: year token in the placeholder. */
|
|
106
103
|
yearToken: string;
|
|
104
|
+
/** DateRangePicker: calendar button name while empty, and the popover name. */
|
|
105
|
+
chooseDates: string;
|
|
106
|
+
/** DateRangePicker: calendar button name once a range is set. */
|
|
107
|
+
changeDates: (range: string) => string;
|
|
108
|
+
/** RangeCalendar, DateRangePicker: two dates read as a range. */
|
|
109
|
+
dateRange: (from: string, to: string) => string;
|
|
110
|
+
/** RangeCalendar: live-region text after the first day is picked. */
|
|
111
|
+
rangeStarted: (start: string) => string;
|
|
112
|
+
/** DateRangePicker: custom validity message for text that is not a range. */
|
|
113
|
+
invalidDateRange: string;
|
|
114
|
+
/** TimeField: name of the hour box. */
|
|
115
|
+
hour: string;
|
|
116
|
+
/** TimeField: name of the minute box. */
|
|
117
|
+
minute: string;
|
|
118
|
+
/** TimeField: name of the AM/PM select. */
|
|
119
|
+
dayPeriod: string;
|
|
120
|
+
/** TimeField: custom validity message for a time that is incomplete or not allowed. */
|
|
121
|
+
invalidTime: string;
|
|
107
122
|
/** MultiSelect: announcement after a value is added. */
|
|
108
123
|
optionAdded: (label: string) => string;
|
|
109
124
|
/** MultiSelect: announcement after a value is removed. */
|
|
@@ -315,6 +330,7 @@ interface NishStrings {
|
|
|
315
330
|
/** Progress: label of an indeterminate bar. */
|
|
316
331
|
progressIndeterminate: string;
|
|
317
332
|
}
|
|
333
|
+
/** Every English default. Built from the groups; components read their own groups through `useStrings`. */
|
|
318
334
|
declare const DEFAULT_STRINGS: NishStrings;
|
|
319
335
|
|
|
320
336
|
/** Theme switching shared by every nish.software page.
|
|
@@ -367,7 +383,7 @@ interface MountThemeToggleOptions {
|
|
|
367
383
|
/** Replace the words "System", "Light" and "Dark" in the button's label, e.g. for
|
|
368
384
|
* another language. The label reads "Theme: Light. Switch to Dark". */
|
|
369
385
|
labels?: ThemeToggleLabels;
|
|
370
|
-
/** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to
|
|
386
|
+
/** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to THEME_STRINGS. */
|
|
371
387
|
strings?: Partial<Pick<NishStrings, 'themeToggleLabel'>>;
|
|
372
388
|
/** The words after a preset saved on another site: "Theme: Mocha (set on another site). …".
|
|
373
389
|
* Default "set on another site". */
|
|
@@ -412,7 +428,7 @@ interface ShowToastOptions {
|
|
|
412
428
|
href?: string;
|
|
413
429
|
onClick?: () => void;
|
|
414
430
|
};
|
|
415
|
-
/** Accessible name of the dismiss button. Default
|
|
431
|
+
/** Accessible name of the dismiss button. Default DISPLAY_STRINGS.dismiss ("Dismiss"). */
|
|
416
432
|
dismissLabel?: string;
|
|
417
433
|
/** Strings for this toast (another language): `dismiss`. `dismissLabel` wins when both are given. */
|
|
418
434
|
strings?: Partial<Pick<NishStrings, 'dismiss'>>;
|
|
@@ -430,7 +446,7 @@ interface ConfirmDialogOptions {
|
|
|
430
446
|
body?: string | Node;
|
|
431
447
|
/** The confirm button's label: a verb that names the action. Default "Confirm". */
|
|
432
448
|
confirmLabel?: string;
|
|
433
|
-
/** The cancel button's label. Default
|
|
449
|
+
/** The cancel button's label. Default OVERLAY_STRINGS.cancel ("Cancel"). */
|
|
434
450
|
cancelLabel?: string;
|
|
435
451
|
/** Strings for this dialog (another language): `cancel`. `cancelLabel` wins when both are given. */
|
|
436
452
|
strings?: Partial<Pick<NishStrings, 'cancel'>>;
|
|
@@ -877,11 +893,9 @@ interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
|
|
|
877
893
|
checked?: boolean;
|
|
878
894
|
/** The starting state of an uncontrolled switch (no `checked`). */
|
|
879
895
|
defaultChecked?: boolean;
|
|
880
|
-
/** Called with the new value
|
|
881
|
-
*
|
|
882
|
-
|
|
883
|
-
/** Called with the new value. The form-library friendly callback: use it with
|
|
884
|
-
* react-hook-form's Controller (`onCheckedChange={field.onChange}`). */
|
|
896
|
+
/** Called with the new value when the switch is clicked or toggled with Space or Enter.
|
|
897
|
+
* Use it with react-hook-form's Controller (`onCheckedChange={field.onChange}`). Need the
|
|
898
|
+
* click event? Use `onClick`. */
|
|
885
899
|
onCheckedChange?: (checked: boolean) => void;
|
|
886
900
|
/** Field name for a native form. With it, a hidden checkbox mirrors the state, so
|
|
887
901
|
* FormData and `<form action>` carry the value. */
|
|
@@ -908,7 +922,7 @@ interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
|
|
|
908
922
|
* waits for Save; use Checkbox for that). A `<button role="switch" aria-checked>`; with a
|
|
909
923
|
* `name` it also posts in native forms. `ref` and the remaining props go to the button;
|
|
910
924
|
* `className` goes to the row (or to the button when there is no label). */
|
|
911
|
-
declare function Switch({ ref, checked: checkedProp, defaultChecked,
|
|
925
|
+
declare function Switch({ ref, checked: checkedProp, defaultChecked, onCheckedChange, name, value, required, form, label, description, size, labelSide, disabled, className, id, onClick, ...allRest }: SwitchProps): react.JSX.Element;
|
|
912
926
|
interface FieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
913
927
|
/** The wrapper element. */
|
|
914
928
|
ref?: Ref<HTMLDivElement>;
|
|
@@ -1306,6 +1320,7 @@ type ToastFn = ToastCall & {
|
|
|
1306
1320
|
declare const toast: ToastFn;
|
|
1307
1321
|
/** Same API as a hook, for code that prefers one. */
|
|
1308
1322
|
declare function useToast(): ToastFn;
|
|
1323
|
+
|
|
1309
1324
|
interface ToasterProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'children'> {
|
|
1310
1325
|
/** Extra classes for the stack, e.g. to lift it above a bottom nav: sm:bottom-20. */
|
|
1311
1326
|
className?: string;
|
|
@@ -2639,7 +2654,7 @@ interface ThemeToggleProps {
|
|
|
2639
2654
|
ref?: Ref<HTMLElement>;
|
|
2640
2655
|
}
|
|
2641
2656
|
/** System / Light / Dark as a Segmented radio group, optionally with a preset picker,
|
|
2642
|
-
* or one cycling icon button when compact. Words come from `
|
|
2657
|
+
* or one cycling icon button when compact. Words come from `useStrings(THEME_STRINGS)`. Other props
|
|
2643
2658
|
* (id, data-*, aria-*, style) go on the root element. */
|
|
2644
2659
|
declare function ThemeToggle({ ref, presets, labels, block, size, compact, variant, phone, collapse, className, elsewhereLabel, ...rest }: ThemeToggleProps & Omit<HTMLAttributes<HTMLElement>, 'children' | 'onChange'>): react.JSX.Element;
|
|
2645
2660
|
|
|
@@ -3767,16 +3782,18 @@ interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'
|
|
|
3767
3782
|
declare function Combobox({ ref, options, value: valueProp, defaultValue, onChange, onValueChange, filter, allowCustom, placeholder, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, invalid, id, name, form, required, disabled, emptyText, onQueryChange, loading, size, clearLabel, loadingText, resultsText, className, ...rest }: ComboboxProps): react.JSX.Element;
|
|
3768
3783
|
|
|
3769
3784
|
type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3785
|
+
/** A span of days, both ends included, as YYYY-MM-DD. from is never after to. */
|
|
3786
|
+
interface DateRange {
|
|
3787
|
+
/** The first day. */
|
|
3788
|
+
from: string;
|
|
3789
|
+
/** The last day, included; equal to from for a one-day range. */
|
|
3790
|
+
to: string;
|
|
3791
|
+
}
|
|
3770
3792
|
|
|
3771
|
-
|
|
3793
|
+
/** Props Calendar and RangeCalendar share. */
|
|
3794
|
+
interface CalendarSharedProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children'> {
|
|
3772
3795
|
/** The root element. */
|
|
3773
3796
|
ref?: Ref<HTMLDivElement>;
|
|
3774
|
-
/** The picked day as YYYY-MM-DD (controlled), or null for none. */
|
|
3775
|
-
value?: string | null;
|
|
3776
|
-
/** The first picked day of an uncontrolled calendar. */
|
|
3777
|
-
defaultValue?: string | null;
|
|
3778
|
-
/** Called with the day the reader picks (YYYY-MM-DD). */
|
|
3779
|
-
onValueChange?: (value: string) => void;
|
|
3780
3797
|
/** The month shown, as YYYY-MM (controlled). Pair with onMonthChange. */
|
|
3781
3798
|
month?: string;
|
|
3782
3799
|
/** The first month shown when uncontrolled. Default: the value's month, else this month. */
|
|
@@ -3806,10 +3823,19 @@ interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'
|
|
|
3806
3823
|
/** Accessible name of the next-month button. Default "Next month". */
|
|
3807
3824
|
nextMonthLabel?: string;
|
|
3808
3825
|
}
|
|
3826
|
+
|
|
3827
|
+
interface CalendarProps extends CalendarSharedProps {
|
|
3828
|
+
/** The picked day as YYYY-MM-DD (controlled), or null for none. */
|
|
3829
|
+
value?: string | null;
|
|
3830
|
+
/** The first picked day of an uncontrolled calendar. */
|
|
3831
|
+
defaultValue?: string | null;
|
|
3832
|
+
/** Called with the day the reader picks (YYYY-MM-DD). */
|
|
3833
|
+
onValueChange?: (value: string) => void;
|
|
3834
|
+
}
|
|
3809
3835
|
/** A month grid that picks one day. Arrow keys move by day and week, Page Up and Page Down by
|
|
3810
3836
|
* month (with Shift, by year), Home and End to the ends of the week. Values are YYYY-MM-DD
|
|
3811
3837
|
* strings, the same as `<input type="date">`. */
|
|
3812
|
-
declare function Calendar({ value, defaultValue, onValueChange,
|
|
3838
|
+
declare function Calendar({ value, defaultValue, onValueChange, ...rest }: CalendarProps): react.JSX.Element;
|
|
3813
3839
|
|
|
3814
3840
|
interface DatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'id' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'role'> {
|
|
3815
3841
|
/** The text input. The remaining div attributes go to the wrapper. */
|
|
@@ -3867,6 +3893,128 @@ interface DatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange
|
|
|
3867
3893
|
* go to the wrapper. */
|
|
3868
3894
|
declare function DatePicker({ ref, value: valueProp, defaultValue, onValueChange, min: minProp, max: maxProp, isDateDisabled, locale, weekStartsOn, captionLayout, placeholder, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, invalid, id, name, form, required, disabled, size, calendarLabel, className, ...rest }: DatePickerProps): react.JSX.Element;
|
|
3869
3895
|
|
|
3896
|
+
interface RangeCalendarProps extends CalendarSharedProps {
|
|
3897
|
+
/** The picked range as { from, to } in YYYY-MM-DD (controlled), or null for none. */
|
|
3898
|
+
value?: DateRange | null;
|
|
3899
|
+
/** The first range of an uncontrolled calendar. */
|
|
3900
|
+
defaultValue?: DateRange | null;
|
|
3901
|
+
/** Called with { from, to } once the second day is picked; from is never after to. A half-picked range is not reported. */
|
|
3902
|
+
onValueChange?: (value: DateRange) => void;
|
|
3903
|
+
/** Let a range cover days isDateDisabled returns true for (weekends inside a vacation). Default false: a second press that would cover one starts a new range there. */
|
|
3904
|
+
allowDisabledInRange?: boolean;
|
|
3905
|
+
}
|
|
3906
|
+
/** A month grid that picks a range of days: the first press sets the start, the second the end, and the days
|
|
3907
|
+
* between light up as the pointer or focus moves. Same keys as Calendar; Escape drops a start with no end. */
|
|
3908
|
+
declare function RangeCalendar({ value, defaultValue, onValueChange, allowDisabledInRange, ...shared }: RangeCalendarProps): react.JSX.Element;
|
|
3909
|
+
|
|
3910
|
+
interface DateRangePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'id' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'role'> {
|
|
3911
|
+
/** The text input. The remaining div attributes go to the wrapper. */
|
|
3912
|
+
ref?: Ref<HTMLInputElement>;
|
|
3913
|
+
/** The range as { from, to } in YYYY-MM-DD, or null for none (controlled). */
|
|
3914
|
+
value?: DateRange | null;
|
|
3915
|
+
/** The starting range of an uncontrolled picker. */
|
|
3916
|
+
defaultValue?: DateRange | null;
|
|
3917
|
+
/** Called with { from, to }, or null when the field is cleared. */
|
|
3918
|
+
onValueChange?: (value: DateRange | null) => void;
|
|
3919
|
+
/** Earliest date that can be picked or typed (YYYY-MM-DD). */
|
|
3920
|
+
min?: string;
|
|
3921
|
+
/** Latest date that can be picked or typed (YYYY-MM-DD). */
|
|
3922
|
+
max?: string;
|
|
3923
|
+
/** Return true to disable a date in the calendar and refuse a typed range that ends on or covers it. */
|
|
3924
|
+
isDateDisabled?: (date: string) => boolean;
|
|
3925
|
+
/** Let a range cover days isDateDisabled returns true for (weekends inside a vacation). Default false: a second press that would cover one starts a new range there. */
|
|
3926
|
+
allowDisabledInRange?: boolean;
|
|
3927
|
+
/** BCP 47 tag for the field format and the calendar. Default NishProvider locale, then setDefaultLocale(). */
|
|
3928
|
+
locale?: string;
|
|
3929
|
+
/** First column of the calendar: 0 Sunday to 6 Saturday. Default from the locale's region. */
|
|
3930
|
+
weekStartsOn?: WeekDay;
|
|
3931
|
+
/** Passed to the RangeCalendar: 'dropdowns' adds month and year selects (birth dates). */
|
|
3932
|
+
captionLayout?: 'label' | 'dropdowns';
|
|
3933
|
+
/** Shown while empty. Default the locale's pattern twice, e.g. "MM/DD/YYYY – MM/DD/YYYY". */
|
|
3934
|
+
placeholder?: string;
|
|
3935
|
+
/** Accessible name when there is no visible <label htmlFor={id}>. */
|
|
3936
|
+
'aria-label'?: string;
|
|
3937
|
+
/** Names the field by another element's id. */
|
|
3938
|
+
'aria-labelledby'?: string;
|
|
3939
|
+
/** Ids of help or error text; reaches the input (Field sets it). */
|
|
3940
|
+
'aria-describedby'?: string;
|
|
3941
|
+
/** Reaches the input (Field sets it on error). */
|
|
3942
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
3943
|
+
/** Same as aria-invalid="true". */
|
|
3944
|
+
invalid?: boolean;
|
|
3945
|
+
/** The id of the text input, so a <label htmlFor> and Field reach it. */
|
|
3946
|
+
id?: string;
|
|
3947
|
+
/** Field name for a native form: a hidden input posts from/to (2026-11-05/2026-11-09), or an empty string. */
|
|
3948
|
+
name?: string;
|
|
3949
|
+
/** The id of the <form> the hidden input belongs to, when it is not an ancestor. */
|
|
3950
|
+
form?: string;
|
|
3951
|
+
/** Marks the field required. */
|
|
3952
|
+
required?: boolean;
|
|
3953
|
+
/** Turns off the text input and the calendar button. */
|
|
3954
|
+
disabled?: boolean;
|
|
3955
|
+
/** md h-9 (default) or sm h-8. Both grow to 44px on touch screens. */
|
|
3956
|
+
size?: 'sm' | 'md';
|
|
3957
|
+
/** Accessible name of the calendar button. Default "Choose dates", or "Change dates, <from> to <to>" once set. */
|
|
3958
|
+
calendarLabel?: string;
|
|
3959
|
+
/** Extra classes for the wrapper around the input and the calendar button. */
|
|
3960
|
+
className?: string;
|
|
3961
|
+
}
|
|
3962
|
+
/** A date range field: type both dates in the reader's own numeric order (or ISO), or pick them
|
|
3963
|
+
* from a RangeCalendar in a Popover. The value is { from, to } as YYYY-MM-DD strings. `ref`,
|
|
3964
|
+
* `id`, `aria-*`, `name` and `required` belong to the input; `className` and other attributes
|
|
3965
|
+
* go to the wrapper. */
|
|
3966
|
+
declare function DateRangePicker({ ref, value: valueProp, defaultValue, onValueChange, min: minProp, max: maxProp, isDateDisabled, allowDisabledInRange, locale, weekStartsOn, captionLayout, placeholder, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, invalid, id, name, form, required, disabled, size, calendarLabel, className, ...rest }: DateRangePickerProps): react.JSX.Element;
|
|
3967
|
+
|
|
3968
|
+
type HourCycle = 12 | 24;
|
|
3969
|
+
|
|
3970
|
+
interface TimeFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'id' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'role'> {
|
|
3971
|
+
/** The hour box. The remaining div attributes go to the group. */
|
|
3972
|
+
ref?: Ref<HTMLInputElement>;
|
|
3973
|
+
/** The time as HH:mm in 24-hour time, or null for none (controlled). */
|
|
3974
|
+
value?: string | null;
|
|
3975
|
+
/** The starting time of an uncontrolled field. */
|
|
3976
|
+
defaultValue?: string | null;
|
|
3977
|
+
/** Called with HH:mm when both boxes hold a valid time inside min and max, or null when both are emptied. */
|
|
3978
|
+
onValueChange?: (value: string | null) => void;
|
|
3979
|
+
/** Earliest allowed time (HH:mm). An earlier time marks the field invalid and is not reported. */
|
|
3980
|
+
min?: string;
|
|
3981
|
+
/** Latest allowed time (HH:mm). */
|
|
3982
|
+
max?: string;
|
|
3983
|
+
/** Minutes per ArrowUp or ArrowDown on the minute box, 1 to 60. Default 1. Typed minutes are kept as typed. */
|
|
3984
|
+
step?: number;
|
|
3985
|
+
/** 12 shows 1-12 and an AM/PM select, 24 shows 00-23. Default from the locale (12 in en-US, 24 in de-DE). */
|
|
3986
|
+
hourCycle?: 12 | 24;
|
|
3987
|
+
/** BCP 47 tag for the clock and the AM/PM words. Default NishProvider locale, then setDefaultLocale(). */
|
|
3988
|
+
locale?: string;
|
|
3989
|
+
/** Accessible name when there is no Field or visible label; each box is named "<name> Hour", "<name> Minute". */
|
|
3990
|
+
'aria-label'?: string;
|
|
3991
|
+
/** Names the field by another element's id. */
|
|
3992
|
+
'aria-labelledby'?: string;
|
|
3993
|
+
/** Ids of help or error text; reaches both boxes (Field sets it). */
|
|
3994
|
+
'aria-describedby'?: string;
|
|
3995
|
+
/** Reaches both boxes (Field sets it on error). */
|
|
3996
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
3997
|
+
/** Same as aria-invalid="true". */
|
|
3998
|
+
invalid?: boolean;
|
|
3999
|
+
/** The id of the hour box, so a <label htmlFor> and Field reach it. */
|
|
4000
|
+
id?: string;
|
|
4001
|
+
/** Field name for a native form: a hidden input posts HH:mm, or an empty string. */
|
|
4002
|
+
name?: string;
|
|
4003
|
+
/** The id of the <form> the hidden input belongs to, when it is not an ancestor. */
|
|
4004
|
+
form?: string;
|
|
4005
|
+
/** Marks both boxes required. */
|
|
4006
|
+
required?: boolean;
|
|
4007
|
+
/** Turns off both boxes and the AM/PM select. */
|
|
4008
|
+
disabled?: boolean;
|
|
4009
|
+
/** md h-9 (default) or sm h-8. Both grow to 44px on touch screens. */
|
|
4010
|
+
size?: 'sm' | 'md';
|
|
4011
|
+
/** Extra classes for the group. */
|
|
4012
|
+
className?: string;
|
|
4013
|
+
}
|
|
4014
|
+
/** A time field: an hour box and a minute box (and AM/PM where the locale uses it). Arrow keys step the focused
|
|
4015
|
+
* box, typing moves on to the minutes, and the value is HH:mm in 24-hour time, like <input type="time">. */
|
|
4016
|
+
declare function TimeField({ ref, value: valueProp, defaultValue, onValueChange, min, max, step, hourCycle, locale, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, invalid, id, name, form, required, disabled, size, className, ...rest }: TimeFieldProps): react.JSX.Element;
|
|
4017
|
+
|
|
3870
4018
|
interface MultiSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'id' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'role'> {
|
|
3871
4019
|
/** The text input (the combobox element). The remaining div attributes go to the wrapper. */
|
|
3872
4020
|
ref?: Ref<HTMLInputElement>;
|
|
@@ -4652,5 +4800,5 @@ interface VisuallyHiddenProps extends ComponentPropsWithoutRef<'span'> {
|
|
|
4652
4800
|
* without Tailwind or any stylesheet. A `style` prop is merged after the hiding styles. */
|
|
4653
4801
|
declare function VisuallyHidden({ as, style, ref, ...rest }: VisuallyHiddenProps): react.JSX.Element;
|
|
4654
4802
|
|
|
4655
|
-
export { Accordion, AccordionItem, ActivityFeed, AgentNode, AlertTriangleIcon, AnimatedList, ApiError, AppErrorBoundary, AppHeader, AppShell, AsyncPanel, Avatar, AvatarGroup, BREAKPOINTS, Badge, BarChart, BellIcon, BottomNav, Breadcrumbs, Button, COLOR_ROLES, Calendar, CalendarIcon, Callout, Card, CardHeader, CardListSkeleton, Carousel, ChartLegend, CheckCircleIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, Chip, ChipGroup, ClockIcon, Combobox, CommandPalette, ConfirmDialog, ConnectionBanner, ContextMenu, CopyButton, DEFAULT_STRINGS, DEFAULT_THEME, DatePicker, Disclosure, Drawer, DropdownMenu, EmptyState, ErrorState, Favicon, Field, FieldGroup, FileDropzone, FilterBar, FilterSheet, FlowSteps, HUE_ROLES, HoverCard, IconButton, InfoIcon, Input, Kbd, KeyValueList, Label, LayoutPresetIcon, LayoutPresetPicker, LineChart, LinkCard, ListRow, LoaderIcon, LoadingBar, MAX_PANES, MediaChip, MediaRow, MediaThumb, MenuItem, MenuLabel, MenuSeparator, MenuSubHeader, Meter, Modal, MonitorIcon, MoonIcon, MoreIcon, MoreSheet, MultiSelect, NARROW_BREAKPOINT, NARROW_MAX, NARROW_QUERY, NavRail, NishProvider, NumberField, PHONE_QUERY, PRESETS, PageContainer, PageHeader, Pagination, PanelLeftCloseIcon, PanelLeftOpenIcon, PauseIcon, PlayIcon, Popover, Portal, Progress, Radio, RadioGroup, RangeBar, RelativeTime, ResponsiveTable, RotateIcon, SCALE, SHADOWS, SOFT_ROLES, ScrollRow, SearchInput, SectionHeader, SectionNav, Segmented, Select, Separator, SettingRow, SettingsIcon, SettingsSection, Skeleton, SkeletonCard, SkeletonLines, SkeletonRows, Slider, Sparkline, Spinner, SplitDividers, SplitStage, Stat, StatGrid, StatGridSkeleton, StatusDot, StepBar, StickyActionBar, StickyBar, SunIcon, Switch, THEMES, TOGGLE_ORDER, TabPanel, Table, TableWrap, Tabs, TagInput, Td, Textarea, Th, ThemeToggle, TickerText, Toaster, Tooltip, Tr, TreeView, VERSION, VirtualList, VirtualTable, VisuallyHidden, WorkflowBoard, XIcon, addSlot, apiFetch, applyTheme, avatarHueIndex, avatarInitials, badgeClass, buttonClass, cardClass, chipClass, cn, computeDividers, computeRects, configureApi, configureFavicons, confirmDialog, copyText, countLeaves, cycleTheme, defaultPreset, dismissToast, equalize, fieldClass, getDefaultLocale, getThemeChoice, googleFavicon, iconButtonClass, initTheme, isRtl, isThemeName, isValidLayout, linkClass, locationAdapter, menuItemClass, mountChecklist, mountHeightVar, mountScrollspy, mountStuck, mountThemeToggle, mountTooltips, narrowLayout, navigateFromLayer, onThemeChange, openSheet, paginationRange, presetOptions, presetsFor, readToken, registerThemes, removeSlot, resizeAt, resolveTheme, revealClass, safeUrl, schemeOf, setDefaultLocale, setThemeChoice, showToast, signTone, swapSlots, tabClass, tableClass, toast, toneFor, useBreakpoint, useCommandHotkey, useDocumentTitle, useHeightVar, useIsClient, useIsoLayoutEffect, useLocalStorage, useMediaQuery, useNarrow, useNishConfig, useNishStrings, useNow, useOnline, usePhone, usePrefersReducedMotion, useResource, useSaveStatus, useScrollEdges, useScrollSpy, useStuck, useTheme, useToast, useUrlState };
|
|
4656
|
-
export type { AccordionHeadingLevel, AccordionItemProps, AccordionMultipleProps, AccordionProps, AccordionSingleProps, ActivityFeedProps, ActivityItem, AgentNodeProps, AgentNodeState, AgoOptions, AnimatedListProps, ApiConfig, ApiFetchOptions, AppErrorBoundaryProps, AppHeaderHub, AppHeaderProps, AppShellProps, AppShellSidebar, AsyncPanelProps, AvatarGroupProps, AvatarProps, AvatarShape, AvatarSize, BadgeClassOptions, BadgeHue, BadgeProps, BadgeTone, BarChartProps, BottomNavProps, BreadcrumbItem, BreadcrumbLinkProps, BreadcrumbsProps, Breakpoint, ButtonClassOptions, ButtonProps, ButtonSize, ButtonVariant, CalendarProps, CalloutProps, CalloutTone, CardClassOptions, CardElement, CardHeaderProps, CardListSkeletonProps, CardPadding, CardProps, CarouselProps, ChartLegendItem, ChartLegendProps, ChartLegendTone, ChartTone, CheckboxProps, ChipClassOptions, ChipGroupProps, ChipProps, ChipVariant, Column, ComboboxOption, ComboboxProps, CommandItem, CommandPaletteProps, ConfirmDialogOptions, ConfirmDialogProps, ConnectionBannerProps, ContextMenuProps, CopyButtonProps, DateOptions, DatePickerProps, DisclosureProps, Divider, DrawerProps, DropdownMenuProps, EmptyStateProps, ErrorStateProps, FaviconProps, FaviconResolver, FieldClassOptions, FieldGroupProps, FieldProps, FieldSize, FileDropzoneProps, FilterBarProps, FilterSheetProps, FlowStepItem, FlowStepStatus, FlowStepsProps, HoverCardProps, IconButtonClassOptions, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, KbdProps, KeyValueItem, KeyValueListProps, LabelProps, LayoutNode, LayoutPresetIconProps, LayoutPresetOption, LayoutPresetPickerProps, LineChartProps, LinePoint, LineSeries, LinkCardAccent, LinkCardProps, LinkClassOptions, ListRowProps, LoadingBarProps, LocaleOptions, MediaChipProps, MediaRowProps, MediaThumbProps, MediaThumbShape, MediaThumbSize, MenuItemClassOptions, MenuItemProps, MenuSubHeaderProps, MeterProps, MeterTone, ModalProps, MoreSheetProps, MountScrollspyOptions, MountThemeToggleOptions, MultiSelectProps, NarrowLayout, NavItem, NavRailProps, NishConfig, NishProviderProps, NishStrings, NumberFieldProps, PageContainerProps, PageHeaderProps, PaginationLinkProps, PaginationProps, PaginationSize, PopoverCloseReason, PopoverProps, PortalProps, Preset, ProgressProps, ProgressTone, RadioGroupProps, RadioOption, RadioProps, RangeBarProps, Rect, RejectedFile, RelativeTimeProps, RenderLink, Resource, ResponsiveTableProps, SaveStatus, ScrollAlign, ScrollRowProps, ScrollToIndexOptions, SearchInputProps, SectionHeaderProps, SectionNavItem, SectionNavProps, SegmentedOption, SegmentedProps, SegmentedTone, SelectProps, SeparatorProps, SettingRowProps, SettingsSectionProps, ShowToastOptions, SkeletonCardProps, SkeletonLinesProps, SkeletonProps, SkeletonRowsProps, SliderProps, SliderValue, Sort, SortText, SparklineProps, SparklineTone, SpinnerProps, SplitDividersProps, SplitStageProps, StatGridProps, StatGridSkeletonProps, StatProps, StaticToastTone, StatusDotProps, StatusTone, StepBarProps, StickyActionBarProps, StickyBarProps, SwitchProps, TabItem, TabPanelProps, TableProps, TableWrapProps, TabsBreakpoint, TabsProps, TabsSize, TabsVariant, TagInputProps, TdProps, TextareaProps, ThProps, ThemeChoice, ThemeName, ThemePreset, ThemeState, ThemeToggleLabels, ThemeToggleProps, TickerTextProps, ToastAction, ToastItem, ToastOptions, ToastPromiseMessages, ToastTone, ToasterProps, TooltipProps, TrProps, TreeNode, TreeViewProps, UrlStateAdapter, UrlStateShape, UseResourceOptions, VirtualListHandle, VirtualListProps, VirtualTableProps, VisuallyHiddenProps, WeekDay, WorkflowBoardAgent, WorkflowBoardPhase, WorkflowBoardProps };
|
|
4803
|
+
export { Accordion, AccordionItem, ActivityFeed, AgentNode, AlertTriangleIcon, AnimatedList, ApiError, AppErrorBoundary, AppHeader, AppShell, AsyncPanel, Avatar, AvatarGroup, BREAKPOINTS, Badge, BarChart, BellIcon, BottomNav, Breadcrumbs, Button, COLOR_ROLES, Calendar, CalendarIcon, Callout, Card, CardHeader, CardListSkeleton, Carousel, ChartLegend, CheckCircleIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, Chip, ChipGroup, ClockIcon, Combobox, CommandPalette, ConfirmDialog, ConnectionBanner, ContextMenu, CopyButton, DEFAULT_STRINGS, DEFAULT_THEME, DatePicker, DateRangePicker, Disclosure, Drawer, DropdownMenu, EmptyState, ErrorState, Favicon, Field, FieldGroup, FileDropzone, FilterBar, FilterSheet, FlowSteps, HUE_ROLES, HoverCard, IconButton, InfoIcon, Input, Kbd, KeyValueList, Label, LayoutPresetIcon, LayoutPresetPicker, LineChart, LinkCard, ListRow, LoaderIcon, LoadingBar, MAX_PANES, MediaChip, MediaRow, MediaThumb, MenuItem, MenuLabel, MenuSeparator, MenuSubHeader, Meter, Modal, MonitorIcon, MoonIcon, MoreIcon, MoreSheet, MultiSelect, NARROW_BREAKPOINT, NARROW_MAX, NARROW_QUERY, NavRail, NishProvider, NumberField, PHONE_QUERY, PRESETS, PageContainer, PageHeader, Pagination, PanelLeftCloseIcon, PanelLeftOpenIcon, PauseIcon, PlayIcon, Popover, Portal, Progress, Radio, RadioGroup, RangeBar, RangeCalendar, RelativeTime, ResponsiveTable, RotateIcon, SCALE, SHADOWS, SOFT_ROLES, ScrollRow, SearchInput, SectionHeader, SectionNav, Segmented, Select, Separator, SettingRow, SettingsIcon, SettingsSection, Skeleton, SkeletonCard, SkeletonLines, SkeletonRows, Slider, Sparkline, Spinner, SplitDividers, SplitStage, Stat, StatGrid, StatGridSkeleton, StatusDot, StepBar, StickyActionBar, StickyBar, SunIcon, Switch, THEMES, TOGGLE_ORDER, TabPanel, Table, TableWrap, Tabs, TagInput, Td, Textarea, Th, ThemeToggle, TickerText, TimeField, Toaster, Tooltip, Tr, TreeView, VERSION, VirtualList, VirtualTable, VisuallyHidden, WorkflowBoard, XIcon, addSlot, apiFetch, applyTheme, avatarHueIndex, avatarInitials, badgeClass, buttonClass, cardClass, chipClass, cn, computeDividers, computeRects, configureApi, configureFavicons, confirmDialog, copyText, countLeaves, cycleTheme, defaultPreset, dismissToast, equalize, fieldClass, getDefaultLocale, getThemeChoice, googleFavicon, iconButtonClass, initTheme, isRtl, isThemeName, isValidLayout, linkClass, locationAdapter, menuItemClass, mountChecklist, mountHeightVar, mountScrollspy, mountStuck, mountThemeToggle, mountTooltips, narrowLayout, navigateFromLayer, onThemeChange, openSheet, paginationRange, presetOptions, presetsFor, readToken, registerThemes, removeSlot, resizeAt, resolveTheme, revealClass, safeUrl, schemeOf, setDefaultLocale, setThemeChoice, showToast, signTone, swapSlots, tabClass, tableClass, toast, toneFor, useBreakpoint, useCommandHotkey, useDocumentTitle, useHeightVar, useIsClient, useIsoLayoutEffect, useLocalStorage, useMediaQuery, useNarrow, useNishConfig, useNishStrings, useNow, useOnline, usePhone, usePrefersReducedMotion, useResource, useSaveStatus, useScrollEdges, useScrollSpy, useStuck, useTheme, useToast, useUrlState };
|
|
4804
|
+
export type { AccordionHeadingLevel, AccordionItemProps, AccordionMultipleProps, AccordionProps, AccordionSingleProps, ActivityFeedProps, ActivityItem, AgentNodeProps, AgentNodeState, AgoOptions, AnimatedListProps, ApiConfig, ApiFetchOptions, AppErrorBoundaryProps, AppHeaderHub, AppHeaderProps, AppShellProps, AppShellSidebar, AsyncPanelProps, AvatarGroupProps, AvatarProps, AvatarShape, AvatarSize, BadgeClassOptions, BadgeHue, BadgeProps, BadgeTone, BarChartProps, BottomNavProps, BreadcrumbItem, BreadcrumbLinkProps, BreadcrumbsProps, Breakpoint, ButtonClassOptions, ButtonProps, ButtonSize, ButtonVariant, CalendarProps, CalloutProps, CalloutTone, CardClassOptions, CardElement, CardHeaderProps, CardListSkeletonProps, CardPadding, CardProps, CarouselProps, ChartLegendItem, ChartLegendProps, ChartLegendTone, ChartTone, CheckboxProps, ChipClassOptions, ChipGroupProps, ChipProps, ChipVariant, Column, ComboboxOption, ComboboxProps, CommandItem, CommandPaletteProps, ConfirmDialogOptions, ConfirmDialogProps, ConnectionBannerProps, ContextMenuProps, CopyButtonProps, DateOptions, DatePickerProps, DateRange, DateRangePickerProps, DisclosureProps, Divider, DrawerProps, DropdownMenuProps, EmptyStateProps, ErrorStateProps, FaviconProps, FaviconResolver, FieldClassOptions, FieldGroupProps, FieldProps, FieldSize, FileDropzoneProps, FilterBarProps, FilterSheetProps, FlowStepItem, FlowStepStatus, FlowStepsProps, HourCycle, HoverCardProps, IconButtonClassOptions, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, KbdProps, KeyValueItem, KeyValueListProps, LabelProps, LayoutNode, LayoutPresetIconProps, LayoutPresetOption, LayoutPresetPickerProps, LineChartProps, LinePoint, LineSeries, LinkCardAccent, LinkCardProps, LinkClassOptions, ListRowProps, LoadingBarProps, LocaleOptions, MediaChipProps, MediaRowProps, MediaThumbProps, MediaThumbShape, MediaThumbSize, MenuItemClassOptions, MenuItemProps, MenuSubHeaderProps, MeterProps, MeterTone, ModalProps, MoreSheetProps, MountScrollspyOptions, MountThemeToggleOptions, MultiSelectProps, NarrowLayout, NavItem, NavRailProps, NishConfig, NishProviderProps, NishStrings, NumberFieldProps, PageContainerProps, PageHeaderProps, PaginationLinkProps, PaginationProps, PaginationSize, PopoverCloseReason, PopoverProps, PortalProps, Preset, ProgressProps, ProgressTone, RadioGroupProps, RadioOption, RadioProps, RangeBarProps, RangeCalendarProps, Rect, RejectedFile, RelativeTimeProps, RenderLink, Resource, ResponsiveTableProps, SaveStatus, ScrollAlign, ScrollRowProps, ScrollToIndexOptions, SearchInputProps, SectionHeaderProps, SectionNavItem, SectionNavProps, SegmentedOption, SegmentedProps, SegmentedTone, SelectProps, SeparatorProps, SettingRowProps, SettingsSectionProps, ShowToastOptions, SkeletonCardProps, SkeletonLinesProps, SkeletonProps, SkeletonRowsProps, SliderProps, SliderValue, Sort, SortText, SparklineProps, SparklineTone, SpinnerProps, SplitDividersProps, SplitStageProps, StatGridProps, StatGridSkeletonProps, StatProps, StaticToastTone, StatusDotProps, StatusTone, StepBarProps, StickyActionBarProps, StickyBarProps, SwitchProps, TabItem, TabPanelProps, TableProps, TableWrapProps, TabsBreakpoint, TabsProps, TabsSize, TabsVariant, TagInputProps, TdProps, TextareaProps, ThProps, ThemeChoice, ThemeName, ThemePreset, ThemeState, ThemeToggleLabels, ThemeToggleProps, TickerTextProps, TimeFieldProps, ToastAction, ToastItem, ToastOptions, ToastPromiseMessages, ToastTone, ToasterProps, TooltipProps, TrProps, TreeNode, TreeViewProps, UrlStateAdapter, UrlStateShape, UseResourceOptions, VirtualListHandle, VirtualListProps, VirtualTableProps, VisuallyHiddenProps, WeekDay, WorkflowBoardAgent, WorkflowBoardPhase, WorkflowBoardProps };
|
package/dist/system-canvas.d.ts
CHANGED
|
@@ -1,2 +1,183 @@
|
|
|
1
|
-
|
|
2
|
-
import 'react';
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ComponentPropsWithoutRef, Ref } from 'react';
|
|
3
|
+
|
|
4
|
+
type CanvasHue = 'indigo' | 'emerald' | 'amber' | 'lime' | 'rose' | 'sky' | 'violet' | 'teal';
|
|
5
|
+
type CanvasNodeKind = 'ui' | 'service' | 'worker' | 'library' | 'infra' | 'data' | 'tool' | 'docs';
|
|
6
|
+
interface CanvasNode {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
kind?: CanvasNodeKind;
|
|
10
|
+
detail?: string;
|
|
11
|
+
/** 0..1 afterglow */
|
|
12
|
+
heat?: number;
|
|
13
|
+
/** live work here now */
|
|
14
|
+
active?: boolean;
|
|
15
|
+
/** When the newest activity here happened, ms. Follow mode visits the newest first. */
|
|
16
|
+
activeAt?: number;
|
|
17
|
+
/** shown under an active node, max ~48 chars */
|
|
18
|
+
note?: string;
|
|
19
|
+
/** sessions/agents here */
|
|
20
|
+
count?: number;
|
|
21
|
+
}
|
|
22
|
+
interface CanvasGroup {
|
|
23
|
+
id: string;
|
|
24
|
+
title: string;
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
hue?: CanvasHue;
|
|
27
|
+
/** Left-to-right layer in the "columns" layout; also orders groups inside a band. */
|
|
28
|
+
column: number;
|
|
29
|
+
/** Top-to-bottom band in the "bands" layout. Default: `column`. */
|
|
30
|
+
band?: number;
|
|
31
|
+
badge?: ReactNode;
|
|
32
|
+
nodes: CanvasNode[];
|
|
33
|
+
}
|
|
34
|
+
interface CanvasEdge {
|
|
35
|
+
id: string;
|
|
36
|
+
/** node or group id */
|
|
37
|
+
from: string;
|
|
38
|
+
/** node or group id */
|
|
39
|
+
to: string;
|
|
40
|
+
/** Overrides the kind's line style with a dashed line. */
|
|
41
|
+
dashed?: boolean;
|
|
42
|
+
label?: string;
|
|
43
|
+
/** A `CanvasEdgeKind` id: sets the line style and which legend toggle shows or hides it. */
|
|
44
|
+
kind?: string;
|
|
45
|
+
}
|
|
46
|
+
/** One entry of the line legend. */
|
|
47
|
+
interface CanvasEdgeKind {
|
|
48
|
+
id: string;
|
|
49
|
+
/** Legend text ("Traffic", "Deploys"). */
|
|
50
|
+
label: string;
|
|
51
|
+
/** Default "solid". */
|
|
52
|
+
line?: 'solid' | 'dashed' | 'dotted';
|
|
53
|
+
/** Hidden until the viewer turns it on in the legend. */
|
|
54
|
+
hidden?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** "columns": layers left to right. "bands": bands top to bottom, each wrapping its groups into
|
|
57
|
+
* rows. "auto": whichever shows the map biggest in the current viewport. */
|
|
58
|
+
type CanvasLayoutMode = 'columns' | 'bands' | 'auto';
|
|
59
|
+
/** Text of the canvas that has no key in `NishStrings`. Each one wins over its English default. */
|
|
60
|
+
interface CanvasLabels {
|
|
61
|
+
/** Added to the "Lines" button when kinds are hidden: "· 2 hidden". */
|
|
62
|
+
hidden: (count: number) => string;
|
|
63
|
+
/** Follow caption when nothing is active. */
|
|
64
|
+
followIdle: string;
|
|
65
|
+
/** Follow caption for one node. */
|
|
66
|
+
followOne: (group: string, label: string) => string;
|
|
67
|
+
/** Follow caption for several nodes. */
|
|
68
|
+
followMany: (count: number) => string;
|
|
69
|
+
}
|
|
70
|
+
declare const DEFAULT_CANVAS_LABELS: CanvasLabels;
|
|
71
|
+
interface SystemCanvasProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onSelect' | 'children' | 'aria-label'> {
|
|
72
|
+
ref?: Ref<HTMLDivElement>;
|
|
73
|
+
groups: CanvasGroup[];
|
|
74
|
+
edges: CanvasEdge[];
|
|
75
|
+
/** Faint titles above each column ("Edge", "Infra", "Apps", ...), by column index. */
|
|
76
|
+
columns?: string[];
|
|
77
|
+
/** Titles of the bands in the "bands" layout, by band index. Falls back to `columns`. */
|
|
78
|
+
bands?: string[];
|
|
79
|
+
/** Default "auto". */
|
|
80
|
+
layout?: CanvasLayoutMode;
|
|
81
|
+
/** The line legend. Edges whose kind is hidden are left out of the layout and routing. */
|
|
82
|
+
edgeKinds?: CanvasEdgeKind[];
|
|
83
|
+
/** Follow mode: the view flies to where work is happening. Controlled when set. */
|
|
84
|
+
follow?: boolean;
|
|
85
|
+
onFollowChange?: (on: boolean) => void;
|
|
86
|
+
/** Overview map in a corner on viewports 600 px wide or more. Default true. */
|
|
87
|
+
minimap?: boolean;
|
|
88
|
+
selected?: string | null;
|
|
89
|
+
onSelect?: (id: string, type: 'node' | 'group') => void;
|
|
90
|
+
/** CSS height of the viewport. Default "100%". */
|
|
91
|
+
height?: string;
|
|
92
|
+
/** aria-label. Default: the `systemMap` string ("System map"). */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** Text without a key in the provider's strings (follow caption, hidden-lines count). */
|
|
95
|
+
labels?: Partial<CanvasLabels>;
|
|
96
|
+
className?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** A pannable, zoomable graph-paper canvas of grouped nodes joined by edges. Nodes with
|
|
100
|
+
* `active` pulse in their group's hue, edges into them flow, and `heat` leaves a fading
|
|
101
|
+
* glow behind. Drag or scroll to pan, ctrl+scroll or pinch to zoom, arrow keys, `+`, `-`
|
|
102
|
+
* and `0` from the keyboard. */
|
|
103
|
+
declare function SystemCanvas({ groups, edges, columns, bands, layout: layoutMode, edgeKinds, follow, onFollowChange, minimap, selected, onSelect, height, label: labelProp, labels: labelOverrides, className, style, ref: forwardedRef, ...rest }: SystemCanvasProps): react.JSX.Element;
|
|
104
|
+
|
|
105
|
+
interface CanvasLayout {
|
|
106
|
+
mode: "columns" | "bands";
|
|
107
|
+
width: number;
|
|
108
|
+
height: number;
|
|
109
|
+
/** World px above y = 0 taken by the headers: 36 in "columns" (titles sit above the cards), 0 in "bands" (titles sit inside). */
|
|
110
|
+
titleRoom: number;
|
|
111
|
+
/** Top-left of each column's ("columns") or band's ("bands") title, world px; `index` is the column or band value. */
|
|
112
|
+
headers: {
|
|
113
|
+
index: number;
|
|
114
|
+
x: number;
|
|
115
|
+
y: number;
|
|
116
|
+
}[];
|
|
117
|
+
groups: Record<string, {
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
w: number;
|
|
121
|
+
h: number;
|
|
122
|
+
}>;
|
|
123
|
+
nodes: Record<string, {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
w: number;
|
|
127
|
+
h: number;
|
|
128
|
+
}>;
|
|
129
|
+
}
|
|
130
|
+
/** Where every group and node sits, in world units (px at zoom 1). Pure and deterministic.
|
|
131
|
+
*
|
|
132
|
+
* "columns" (default): columns are the distinct `column` values in ascending order, groups
|
|
133
|
+
* stack in the order given, nodes sit in a 2-column grid inside their group (1 column for a
|
|
134
|
+
* group of one), and each column is centered against the tallest. The first sub-column starts
|
|
135
|
+
* 60 px in and `width` includes 60 px after the last, which is room for the edge lanes
|
|
136
|
+
* outside the cards.
|
|
137
|
+
*
|
|
138
|
+
* "bands": bands are the distinct `band ?? column` values in ascending order, stacked top to
|
|
139
|
+
* bottom; each band wraps its groups (by `column`, then input order) into rows no wider than
|
|
140
|
+
* `width`. The gaps between rows grow with the number of edge ends that need lanes there. */
|
|
141
|
+
interface LayoutOptions {
|
|
142
|
+
/** Default "columns". */
|
|
143
|
+
mode?: "columns" | "bands";
|
|
144
|
+
/** "bands" only: the widest a row of groups may get, world px (at least one group per row). */
|
|
145
|
+
width?: number;
|
|
146
|
+
/** "bands" only: used to size the gaps between rows for the edge lanes. */
|
|
147
|
+
edges?: CanvasEdge[];
|
|
148
|
+
columnGap?: number;
|
|
149
|
+
rowGap?: number;
|
|
150
|
+
}
|
|
151
|
+
declare function layoutSystem(groups: CanvasGroup[], o?: LayoutOptions): CanvasLayout;
|
|
152
|
+
/** The layout to show in a viewport of `viewport` px. "columns" and "bands" use that mode;
|
|
153
|
+
* "auto" picks whichever candidate shows the map biggest. Pure and deterministic. */
|
|
154
|
+
declare function pickLayout(groups: CanvasGroup[], edges: CanvasEdge[], viewport: {
|
|
155
|
+
w: number;
|
|
156
|
+
h: number;
|
|
157
|
+
}, mode?: CanvasLayoutMode): CanvasLayout;
|
|
158
|
+
|
|
159
|
+
interface RoutedEdge {
|
|
160
|
+
id: string;
|
|
161
|
+
/** The corners of the line, source port first. Every segment is horizontal or vertical. */
|
|
162
|
+
points: [number, number][];
|
|
163
|
+
/** The same line as an SVG path with rounded corners; also valid for CSS `offset-path`. */
|
|
164
|
+
d: string;
|
|
165
|
+
/** Direction of travel of the last segment: "right" in "columns", "down" in "bands". */
|
|
166
|
+
dir: 'right' | 'down';
|
|
167
|
+
}
|
|
168
|
+
/** Routes every edge as an orthogonal line (horizontal and vertical segments, rounded corners)
|
|
169
|
+
* from the right border of its source card to the left border of its target card. A node
|
|
170
|
+
* attaches at its own center height, a group at its card's middle. Group boxes are clustered
|
|
171
|
+
* into sub-columns by x; the gaps between them (and 60 px outside the first and last) are
|
|
172
|
+
* channels, where vertical lanes run: one lane per source port (edges from a port share a
|
|
173
|
+
* trunk) and one per target port (edges into a port merge). An edge to a sub-column further
|
|
174
|
+
* right than the next travels along a horizontal corridor free of cards; backward edges and
|
|
175
|
+
* edges inside one sub-column do the same, mirrored. Two edges share a line only at a shared
|
|
176
|
+
* source or target port. Pure and deterministic; the result is keyed by edge id and skips
|
|
177
|
+
* edges with an unknown end. In a "bands" layout the same router runs on the transposed layout
|
|
178
|
+
* (x and y swapped) and the points are swapped back: lines leave the bottom border of the
|
|
179
|
+
* source card and enter the top border of the target card, and `dir` is "down". */
|
|
180
|
+
declare function routeEdges(layout: CanvasLayout, groups: CanvasGroup[], edges: CanvasEdge[]): Record<string, RoutedEdge>;
|
|
181
|
+
|
|
182
|
+
export { DEFAULT_CANVAS_LABELS, SystemCanvas, layoutSystem, pickLayout, routeEdges };
|
|
183
|
+
export type { CanvasEdge, CanvasEdgeKind, CanvasGroup, CanvasHue, CanvasLabels, CanvasLayout, CanvasLayoutMode, CanvasNode, CanvasNodeKind, LayoutOptions, RoutedEdge, SystemCanvasProps };
|
package/dist/theme.d.ts
CHANGED
|
@@ -73,6 +73,24 @@ interface NishStrings {
|
|
|
73
73
|
monthToken: string;
|
|
74
74
|
/** DatePicker: year token in the placeholder. */
|
|
75
75
|
yearToken: string;
|
|
76
|
+
/** DateRangePicker: calendar button name while empty, and the popover name. */
|
|
77
|
+
chooseDates: string;
|
|
78
|
+
/** DateRangePicker: calendar button name once a range is set. */
|
|
79
|
+
changeDates: (range: string) => string;
|
|
80
|
+
/** RangeCalendar, DateRangePicker: two dates read as a range. */
|
|
81
|
+
dateRange: (from: string, to: string) => string;
|
|
82
|
+
/** RangeCalendar: live-region text after the first day is picked. */
|
|
83
|
+
rangeStarted: (start: string) => string;
|
|
84
|
+
/** DateRangePicker: custom validity message for text that is not a range. */
|
|
85
|
+
invalidDateRange: string;
|
|
86
|
+
/** TimeField: name of the hour box. */
|
|
87
|
+
hour: string;
|
|
88
|
+
/** TimeField: name of the minute box. */
|
|
89
|
+
minute: string;
|
|
90
|
+
/** TimeField: name of the AM/PM select. */
|
|
91
|
+
dayPeriod: string;
|
|
92
|
+
/** TimeField: custom validity message for a time that is incomplete or not allowed. */
|
|
93
|
+
invalidTime: string;
|
|
76
94
|
/** MultiSelect: announcement after a value is added. */
|
|
77
95
|
optionAdded: (label: string) => string;
|
|
78
96
|
/** MultiSelect: announcement after a value is removed. */
|
|
@@ -335,7 +353,7 @@ interface MountThemeToggleOptions {
|
|
|
335
353
|
/** Replace the words "System", "Light" and "Dark" in the button's label, e.g. for
|
|
336
354
|
* another language. The label reads "Theme: Light. Switch to Dark". */
|
|
337
355
|
labels?: ThemeToggleLabels;
|
|
338
|
-
/** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to
|
|
356
|
+
/** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to THEME_STRINGS. */
|
|
339
357
|
strings?: Partial<Pick<NishStrings, 'themeToggleLabel'>>;
|
|
340
358
|
/** The words after a preset saved on another site: "Theme: Mocha (set on another site). …".
|
|
341
359
|
* Default "set on another site". */
|
|
@@ -380,7 +398,7 @@ interface ShowToastOptions {
|
|
|
380
398
|
href?: string;
|
|
381
399
|
onClick?: () => void;
|
|
382
400
|
};
|
|
383
|
-
/** Accessible name of the dismiss button. Default
|
|
401
|
+
/** Accessible name of the dismiss button. Default DISPLAY_STRINGS.dismiss ("Dismiss"). */
|
|
384
402
|
dismissLabel?: string;
|
|
385
403
|
/** Strings for this toast (another language): `dismiss`. `dismissLabel` wins when both are given. */
|
|
386
404
|
strings?: Partial<Pick<NishStrings, 'dismiss'>>;
|
|
@@ -398,7 +416,7 @@ interface ConfirmDialogOptions {
|
|
|
398
416
|
body?: string | Node;
|
|
399
417
|
/** The confirm button's label: a verb that names the action. Default "Confirm". */
|
|
400
418
|
confirmLabel?: string;
|
|
401
|
-
/** The cancel button's label. Default
|
|
419
|
+
/** The cancel button's label. Default OVERLAY_STRINGS.cancel ("Cancel"). */
|
|
402
420
|
cancelLabel?: string;
|
|
403
421
|
/** Strings for this dialog (another language): `cancel`. `cancelLabel` wins when both are given. */
|
|
404
422
|
strings?: Partial<Pick<NishStrings, 'cancel'>>;
|