@mortenbrudvik/waveui 0.8.0 → 0.10.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 +634 -167
- package/dist/components/data-display/InfoButton.cjs +2 -0
- package/dist/components/data-display/InfoButton.cjs.map +1 -0
- package/dist/components/data-display/InfoButton.mjs +173 -0
- package/dist/components/data-display/InfoButton.mjs.map +1 -0
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +39 -96
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/input/Calendar.cjs +2 -0
- package/dist/components/input/Calendar.cjs.map +1 -0
- package/dist/components/input/Calendar.mjs +352 -0
- package/dist/components/input/Calendar.mjs.map +1 -0
- package/dist/components/input/Calendar.views.cjs +2 -0
- package/dist/components/input/Calendar.views.cjs.map +1 -0
- package/dist/components/input/Calendar.views.mjs +194 -0
- package/dist/components/input/Calendar.views.mjs.map +1 -0
- package/dist/components/input/Checkbox.cjs +1 -1
- package/dist/components/input/Checkbox.cjs.map +1 -1
- package/dist/components/input/Checkbox.mjs +91 -75
- package/dist/components/input/Checkbox.mjs.map +1 -1
- package/dist/components/input/ColorArea.cjs +1 -1
- package/dist/components/input/ColorArea.cjs.map +1 -1
- package/dist/components/input/ColorArea.mjs +18 -18
- package/dist/components/input/ColorArea.mjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.cjs +1 -1
- package/dist/components/input/ColorPicker.parts.cjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.mjs +1 -1
- package/dist/components/input/ColorPicker.parts.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +20 -20
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +219 -138
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Combobox.text.cjs +2 -0
- package/dist/components/input/Combobox.text.cjs.map +1 -0
- package/dist/components/input/Combobox.text.mjs +24 -0
- package/dist/components/input/Combobox.text.mjs.map +1 -0
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +205 -286
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +137 -105
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Field.cjs +1 -1
- package/dist/components/input/Field.cjs.map +1 -1
- package/dist/components/input/Field.mjs +99 -66
- package/dist/components/input/Field.mjs.map +1 -1
- package/dist/components/input/Input.cjs +1 -1
- package/dist/components/input/Input.cjs.map +1 -1
- package/dist/components/input/Input.mjs +79 -55
- package/dist/components/input/Input.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +19 -13
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +2 -0
- package/dist/components/input/Listbox.cjs.map +1 -0
- package/dist/components/input/Listbox.mjs +134 -0
- package/dist/components/input/Listbox.mjs.map +1 -0
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +158 -97
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/Rating.cjs +1 -1
- package/dist/components/input/Rating.cjs.map +1 -1
- package/dist/components/input/Rating.item.cjs +2 -0
- package/dist/components/input/Rating.item.cjs.map +1 -0
- package/dist/components/input/Rating.item.mjs +255 -0
- package/dist/components/input/Rating.item.mjs.map +1 -0
- package/dist/components/input/Rating.mjs +150 -151
- package/dist/components/input/Rating.mjs.map +1 -1
- package/dist/components/input/SearchBox.cjs +1 -1
- package/dist/components/input/SearchBox.cjs.map +1 -1
- package/dist/components/input/SearchBox.mjs +146 -115
- package/dist/components/input/SearchBox.mjs.map +1 -1
- package/dist/components/input/Select.cjs +1 -1
- package/dist/components/input/Select.cjs.map +1 -1
- package/dist/components/input/Select.mjs +34 -25
- package/dist/components/input/Select.mjs.map +1 -1
- package/dist/components/input/Slider.cjs +1 -1
- package/dist/components/input/Slider.cjs.map +1 -1
- package/dist/components/input/Slider.mjs +77 -54
- package/dist/components/input/Slider.mjs.map +1 -1
- package/dist/components/input/SpinButton.cjs +1 -1
- package/dist/components/input/SpinButton.cjs.map +1 -1
- package/dist/components/input/SpinButton.mjs +198 -96
- package/dist/components/input/SpinButton.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.cjs +2 -0
- package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.context.mjs +35 -0
- package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
- package/dist/components/input/SwatchPicker.mjs +131 -103
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
- package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
- package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
- package/dist/components/input/Switch.cjs +1 -1
- package/dist/components/input/Switch.cjs.map +1 -1
- package/dist/components/input/Switch.mjs +71 -55
- package/dist/components/input/Switch.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.mjs +154 -123
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/Textarea.cjs +1 -1
- package/dist/components/input/Textarea.cjs.map +1 -1
- package/dist/components/input/Textarea.mjs +28 -21
- package/dist/components/input/Textarea.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +204 -199
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/input/dateUtils.cjs +1 -1
- package/dist/components/input/dateUtils.cjs.map +1 -1
- package/dist/components/input/dateUtils.mjs +114 -96
- package/dist/components/input/dateUtils.mjs.map +1 -1
- package/dist/components/input/fieldLabel.cjs +2 -0
- package/dist/components/input/fieldLabel.cjs.map +1 -0
- package/dist/components/input/fieldLabel.mjs +17 -0
- package/dist/components/input/fieldLabel.mjs.map +1 -0
- package/dist/components/input/inputLook.cjs +2 -0
- package/dist/components/input/inputLook.cjs.map +1 -0
- package/dist/components/input/inputLook.mjs +28 -0
- package/dist/components/input/inputLook.mjs.map +1 -0
- package/dist/components/input/pickerLabels.cjs +2 -0
- package/dist/components/input/pickerLabels.cjs.map +1 -0
- package/dist/components/input/pickerLabels.mjs +16 -0
- package/dist/components/input/pickerLabels.mjs.map +1 -0
- package/dist/components/input/pickerStyles.cjs +1 -1
- package/dist/components/input/pickerStyles.cjs.map +1 -1
- package/dist/components/input/pickerStyles.mjs +42 -4
- package/dist/components/input/pickerStyles.mjs.map +1 -1
- package/dist/components/input/pickerValues.cjs +2 -0
- package/dist/components/input/pickerValues.cjs.map +1 -0
- package/dist/components/input/pickerValues.mjs +24 -0
- package/dist/components/input/pickerValues.mjs.map +1 -0
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +10 -10
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +10 -10
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +203 -208
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/Popover.shared.cjs +1 -1
- package/dist/components/overlays/Popover.shared.cjs.map +1 -1
- package/dist/components/overlays/Popover.shared.mjs +82 -77
- package/dist/components/overlays/Popover.shared.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +25 -19
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +67 -70
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/hooks/useActiveDescendant.cjs +2 -0
- package/dist/hooks/useActiveDescendant.cjs.map +1 -0
- package/dist/hooks/useActiveDescendant.mjs +56 -0
- package/dist/hooks/useActiveDescendant.mjs.map +1 -0
- package/dist/hooks/useFieldControl.cjs.map +1 -1
- package/dist/hooks/useFieldControl.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +250 -210
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useRovingGrid.cjs +2 -0
- package/dist/hooks/useRovingGrid.cjs.map +1 -0
- package/dist/hooks/useRovingGrid.mjs +69 -0
- package/dist/hooks/useRovingGrid.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2901 -203
- package/dist/index.d.ts +2901 -203
- package/dist/index.mjs +107 -99
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +111 -67
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/date.cjs +2 -0
- package/dist/lib/date.cjs.map +1 -0
- package/dist/lib/date.mjs +44 -0
- package/dist/lib/date.mjs.map +1 -0
- package/dist/lib/focus.cjs +1 -1
- package/dist/lib/focus.cjs.map +1 -1
- package/dist/lib/focus.mjs +5 -2
- package/dist/lib/focus.mjs.map +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/lib/styles.cjs +1 -1
- package/dist/lib/styles.cjs.map +1 -1
- package/dist/lib/styles.mjs +21 -4
- package/dist/lib/styles.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +13 -0
package/dist/index.d.ts
CHANGED
|
@@ -199,6 +199,19 @@ export declare interface AccordionTriggerProps extends React_2.ButtonHTMLAttribu
|
|
|
199
199
|
ref?: React_2.Ref<HTMLButtonElement>;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
/**
|
|
203
|
+
* `date` plus `amount` calendar days (negative to go back), at local midnight; the time of day is
|
|
204
|
+
* dropped.
|
|
205
|
+
*/
|
|
206
|
+
export declare function addDays(date: Date, amount: number): Date;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* `date` plus `amount` months (negative to go back), at local midnight; the time of day is dropped.
|
|
210
|
+
* The day is clamped to the length of the target month: January 31 plus one month is February 28
|
|
211
|
+
* (29 in a leap year), never a day of the following month.
|
|
212
|
+
*/
|
|
213
|
+
export declare function addMonths(date: Date, amount: number): Date;
|
|
214
|
+
|
|
202
215
|
/**
|
|
203
216
|
* A slider for a color's opacity, drawn over a checkerboard, horizontal (mirrored in right-to-left
|
|
204
217
|
* layouts) or vertical (bottom to top); `transparency` shows transparency instead. The arrow keys
|
|
@@ -765,6 +778,291 @@ export declare interface ButtonOwnProps {
|
|
|
765
778
|
*/
|
|
766
779
|
export declare type ButtonProps<C extends React_2.ElementType = 'button'> = PolymorphicProps<C, ButtonOwnProps>;
|
|
767
780
|
|
|
781
|
+
/**
|
|
782
|
+
* A month calendar for picking one day, without a text input: the grid of DatePicker's dialog,
|
|
783
|
+
* placed in the page (APG date picker grid).
|
|
784
|
+
*
|
|
785
|
+
* - **Structure**: a `role="group"` root, named with `aria-label`/`aria-labelledby` or by a
|
|
786
|
+
* surrounding `Field`, around the previous-month button, the month text (a polite live region
|
|
787
|
+
* that labels the grid), the next-month button and a `role="grid"` table of six weeks, with an
|
|
788
|
+
* optional leading column of week numbers (`showWeekNumbers`, `firstWeekOfYear`) and an
|
|
789
|
+
* optional footer button, "Go to today" (`showGoToToday`), which shows today's month and focuses
|
|
790
|
+
* today without selecting it. The month text is no heading, since a component cannot know the
|
|
791
|
+
* page's heading levels.
|
|
792
|
+
* - **Month and year views** (`showMonthPicker`, on by default): the month text is a button
|
|
793
|
+
* (named by that text, its hint `labels.chooseMonth`) that shows the 12 months of the year; their
|
|
794
|
+
* heading, the year, is a button to the year view, a decade with the year before and after it
|
|
795
|
+
* (muted). The header buttons move by a year, then by a decade. A picked year shows its months
|
|
796
|
+
* and a picked month its days (the focused day keeps its day of the month, clamped); Escape
|
|
797
|
+
* goes back a level to the period shown before. Each view change moves focus into the new
|
|
798
|
+
* grid. Months and years wholly outside `minDate`/`maxDate` stay focusable, `aria-disabled`.
|
|
799
|
+
* - **Keyboard**: one tab stop in the grid, the focused day (the selected day of the shown month,
|
|
800
|
+
* else today, else the first day of the month in range, which may be unavailable). Arrow keys
|
|
801
|
+
* move by day and week (mirrored in RTL), PageUp/PageDown by month, Shift+PageUp/PageDown by
|
|
802
|
+
* year (the day is clamped to the month), Home/End to the start and end of the week; Enter,
|
|
803
|
+
* Space and a click pick the day. Unavailable days (`minDate`, `maxDate`, `disabledDates`) stay
|
|
804
|
+
* focusable and are `aria-disabled`. In the month and year views the arrows move by a cell and a
|
|
805
|
+
* row of four, Home/End to the row's ends, PageUp/PageDown by a year (months) or ten (years).
|
|
806
|
+
* - **Value**: `onValueChange` fires only when the day changes, with local midnight and `details`;
|
|
807
|
+
* picking the selected day again does nothing. A value that moves to another month shows that
|
|
808
|
+
* month. The selected day is `aria-selected` on its gridcell and `aria-pressed` on its button;
|
|
809
|
+
* today is `aria-current="date"`. With `selectionRange` a pick selects the day's week, work
|
|
810
|
+
* week (`workWeekDays`) or month: every available day of it is drawn and marked selected, the
|
|
811
|
+
* value is the picked day, and `details.range` lists the selected days in order.
|
|
812
|
+
* - **Marked days and custom content**: `markedDates` draws a dot in the text colour under the
|
|
813
|
+
* number, sets `data-marked` and says "marked" in the day's name; `renderDay` replaces the
|
|
814
|
+
* content of the day button (non-interactive content only) and `dayLabel` sets its name.
|
|
815
|
+
* - **Forms and Field**: `name`/`required` add a hidden input (ISO `yyyy-mm-dd`) that resets with
|
|
816
|
+
* its form (to `defaultValue`); a required calendar that the form reports missing focuses its
|
|
817
|
+
* tab stop. Inside a `Field` the group takes the label, the description and `aria-invalid`; it
|
|
818
|
+
* says "required" in its description (`labels.required`), since a group cannot carry
|
|
819
|
+
* `aria-required`.
|
|
820
|
+
* - **Server rendering**: pass `locale`, and `today`, `initialVisibleDate` or a value, so the
|
|
821
|
+
* server and the browser render the same month. Only `today` marks a day in the server HTML:
|
|
822
|
+
* without it the server HTML marks none and the browser marks today once hydrated. Without any
|
|
823
|
+
* of the three the month shown first comes from the server's clock (development warning).
|
|
824
|
+
*
|
|
825
|
+
* @example
|
|
826
|
+
* <Calendar aria-label="Due date" defaultValue={new Date(2025, 5, 12)} onValueChange={setDue} />
|
|
827
|
+
*/
|
|
828
|
+
export declare const Calendar: {
|
|
829
|
+
({ value: valueProp, defaultValue, onValueChange, minDate, maxDate, disabledDates, firstDayOfWeek, locale, today: todayProp, initialVisibleDate, showMonthPicker, showWeekNumbers, firstWeekOfYear, showGoToToday, markedDates, renderDay, dayLabel, selectionRange, workWeekDays, labels, name, form, required, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, className, ref, ...rest }: CalendarProps): React_2.JSX.Element;
|
|
830
|
+
displayName: string;
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Calendar: `root` on the `role="group"` element; `header` on the row of the navigation buttons
|
|
835
|
+
* and the heading; `previousButton` and `nextButton` on the navigation buttons (by a month, a
|
|
836
|
+
* year or a decade); `heading` on the month, year or decade text (a `<div>`, which labels the
|
|
837
|
+
* grid); `headingButton` on the heading's button to the month and year views; `grid` on the
|
|
838
|
+
* `role="grid"` element of every view; `weekday` on each weekday header cell; `weekNumberHeader`
|
|
839
|
+
* on the header cell of the week-number column and `weekNumber` on each week's row header
|
|
840
|
+
* (`showWeekNumbers`); `day`, `month` and `year` on each day, month and year button; `markedDot`
|
|
841
|
+
* on the dot inside a marked day's button; `footer` on the row of the footer buttons, with
|
|
842
|
+
* `todayButton` on "Go to today" (`showGoToToday`).
|
|
843
|
+
*/
|
|
844
|
+
export declare const calendarClassNames: {
|
|
845
|
+
readonly root: "wave-calendar";
|
|
846
|
+
readonly header: "wave-calendar__header";
|
|
847
|
+
readonly previousButton: "wave-calendar__previous-button";
|
|
848
|
+
readonly heading: "wave-calendar__heading";
|
|
849
|
+
readonly headingButton: "wave-calendar__heading-button";
|
|
850
|
+
readonly nextButton: "wave-calendar__next-button";
|
|
851
|
+
readonly grid: "wave-calendar__grid";
|
|
852
|
+
readonly weekday: "wave-calendar__weekday";
|
|
853
|
+
readonly weekNumberHeader: "wave-calendar__week-number-header";
|
|
854
|
+
readonly weekNumber: "wave-calendar__week-number";
|
|
855
|
+
readonly day: "wave-calendar__day";
|
|
856
|
+
readonly markedDot: "wave-calendar__marked-dot";
|
|
857
|
+
readonly month: "wave-calendar__month";
|
|
858
|
+
readonly year: "wave-calendar__year";
|
|
859
|
+
readonly footer: "wave-calendar__footer";
|
|
860
|
+
readonly todayButton: "wave-calendar__today-button";
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* The built-in texts of the calendar, for localization: the names of the navigation buttons in
|
|
865
|
+
* the day, month and year views, the hints of the heading button, the "Go to today" button, the
|
|
866
|
+
* week-number column and the marked days, and (Calendar only) the required hint. Each member is
|
|
867
|
+
* optional and falls back to its English default. Month and weekday names and the day labels follow
|
|
868
|
+
* `locale`. DatePicker's labels extend this type.
|
|
869
|
+
*/
|
|
870
|
+
export declare interface CalendarLabels {
|
|
871
|
+
/** Name of the previous-month button.
|
|
872
|
+
* @default 'Previous month'
|
|
873
|
+
*/
|
|
874
|
+
previousMonth?: string;
|
|
875
|
+
/** Name of the next-month button.
|
|
876
|
+
* @default 'Next month'
|
|
877
|
+
*/
|
|
878
|
+
nextMonth?: string;
|
|
879
|
+
/** Name of the previous-year button of the month view.
|
|
880
|
+
* @default 'Previous year'
|
|
881
|
+
*/
|
|
882
|
+
previousYear?: string;
|
|
883
|
+
/** Name of the next-year button of the month view.
|
|
884
|
+
* @default 'Next year'
|
|
885
|
+
*/
|
|
886
|
+
nextYear?: string;
|
|
887
|
+
/** Name of the previous-decade button of the year view.
|
|
888
|
+
* @default 'Previous decade'
|
|
889
|
+
*/
|
|
890
|
+
previousDecade?: string;
|
|
891
|
+
/** Name of the next-decade button of the year view.
|
|
892
|
+
* @default 'Next decade'
|
|
893
|
+
*/
|
|
894
|
+
nextDecade?: string;
|
|
895
|
+
/** Description of the heading button that shows the month view.
|
|
896
|
+
* @default 'Choose a month'
|
|
897
|
+
*/
|
|
898
|
+
chooseMonth?: string;
|
|
899
|
+
/** Description of the heading button that shows the year view.
|
|
900
|
+
* @default 'Choose a year'
|
|
901
|
+
*/
|
|
902
|
+
chooseYear?: string;
|
|
903
|
+
/** Name of the "Go to today" button.
|
|
904
|
+
* @default 'Go to today'
|
|
905
|
+
*/
|
|
906
|
+
goToToday?: string;
|
|
907
|
+
/** Hidden text of the week-number column header.
|
|
908
|
+
* @default 'Week'
|
|
909
|
+
*/
|
|
910
|
+
week?: string;
|
|
911
|
+
/** Name of a week-number row header.
|
|
912
|
+
* @default (week) => `Week ${week}`
|
|
913
|
+
*/
|
|
914
|
+
weekNumber?: (week: number) => string;
|
|
915
|
+
/** Name of a marked day, built from its default name.
|
|
916
|
+
* @default (dayLabel) => `${dayLabel}, marked`
|
|
917
|
+
*/
|
|
918
|
+
markedDay?: (dayLabel: string) => string;
|
|
919
|
+
/**
|
|
920
|
+
* Said in the calendar's description while it is required (`required`, a required Field, or a
|
|
921
|
+
* consumer `aria-required` alone), since its role cannot carry `aria-required`.
|
|
922
|
+
* @default 'Required'
|
|
923
|
+
*/
|
|
924
|
+
required?: string;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/** Properties for the Calendar component. */
|
|
928
|
+
export declare interface CalendarProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
929
|
+
/** Controlled selected day (`null` for none). */
|
|
930
|
+
value?: Date | null;
|
|
931
|
+
/**
|
|
932
|
+
* Initial selected day for uncontrolled usage.
|
|
933
|
+
* @default null
|
|
934
|
+
*/
|
|
935
|
+
defaultValue?: Date | null;
|
|
936
|
+
/**
|
|
937
|
+
* Called with the new day (local midnight) when the selected day changes: a pick of another day
|
|
938
|
+
* or a form reset (Fluent's `onSelectDate` fires on every pick). Picking the selected day again
|
|
939
|
+
* does nothing. WaveUI always passes `details`.
|
|
940
|
+
*/
|
|
941
|
+
onValueChange?: (date: Date | null, details?: CalendarValueChangeDetails) => void;
|
|
942
|
+
/** Earliest available day (the whole day is included). */
|
|
943
|
+
minDate?: Date;
|
|
944
|
+
/** Latest available day (the whole day is included). */
|
|
945
|
+
maxDate?: Date;
|
|
946
|
+
/** Returns `true` for days that cannot be picked (called with local-midnight dates). */
|
|
947
|
+
disabledDates?: (date: Date) => boolean;
|
|
948
|
+
/**
|
|
949
|
+
* First day of the week (0 = Sunday, 1 = Monday, etc.).
|
|
950
|
+
* @default 0
|
|
951
|
+
*/
|
|
952
|
+
firstDayOfWeek?: DayOfWeek;
|
|
953
|
+
/**
|
|
954
|
+
* BCP 47 locale of the month text, the weekday names and the day labels. Pass it when rendering
|
|
955
|
+
* on the server, so the server and the browser render the same text. The grid is Gregorian, as
|
|
956
|
+
* in DatePicker. A tag `Intl` rejects (the POSIX `de_DE`, a typo) falls back to the runtime
|
|
957
|
+
* default locale (development warning).
|
|
958
|
+
* @default the runtime default locale
|
|
959
|
+
*/
|
|
960
|
+
locale?: string;
|
|
961
|
+
/**
|
|
962
|
+
* The day marked as today (`aria-current="date"`), and the tab stop when no day is selected in
|
|
963
|
+
* the shown month. Without it, the server HTML and the hydration render mark no day and the
|
|
964
|
+
* browser applies the current date once hydrated: pass it when rendering on the server, so the
|
|
965
|
+
* mark is in the HTML.
|
|
966
|
+
* @default the current date (applied after hydration when not passed)
|
|
967
|
+
*/
|
|
968
|
+
today?: Date;
|
|
969
|
+
/**
|
|
970
|
+
* The month shown first when there is no value (Fluent's `initialPickerDate`), clamped into
|
|
971
|
+
* `minDate`/`maxDate` like the value's month and today's.
|
|
972
|
+
* @default today's month
|
|
973
|
+
*/
|
|
974
|
+
initialVisibleDate?: Date;
|
|
975
|
+
/**
|
|
976
|
+
* Turns the month text into a button that shows the month view (the 12 months of the year),
|
|
977
|
+
* whose heading, the year, is a button to the year view (a decade with the year before and
|
|
978
|
+
* after it). A picked year shows its months and a picked month its days; Escape goes back a
|
|
979
|
+
* level to the period shown before. Fluent's `isMonthPickerVisible`, here as a drill-down in one
|
|
980
|
+
* pane.
|
|
981
|
+
* @default true
|
|
982
|
+
*/
|
|
983
|
+
showMonthPicker?: boolean;
|
|
984
|
+
/**
|
|
985
|
+
* Adds a leading column of week numbers: a row header per week (`Week 23`, from
|
|
986
|
+
* `labels.weekNumber`) under a header cell named `labels.week`. The numbers follow
|
|
987
|
+
* `firstDayOfWeek` and `firstWeekOfYear`; the column is not focusable and the keys skip it.
|
|
988
|
+
* @default false
|
|
989
|
+
*/
|
|
990
|
+
showWeekNumbers?: boolean;
|
|
991
|
+
/**
|
|
992
|
+
* Which week is week 1 of a year. ISO 8601 is `'first-four-day-week'` with `firstDayOfWeek={1}`.
|
|
993
|
+
* @default 'first-day'
|
|
994
|
+
*/
|
|
995
|
+
firstWeekOfYear?: FirstWeekOfYear;
|
|
996
|
+
/**
|
|
997
|
+
* Adds a footer button that shows today's month in the day view and focuses today without
|
|
998
|
+
* selecting it. It is disabled while today is outside `minDate`/`maxDate`.
|
|
999
|
+
* @default false
|
|
1000
|
+
*/
|
|
1001
|
+
showGoToToday?: boolean;
|
|
1002
|
+
/**
|
|
1003
|
+
* Days that draw a dot under the number (in the text colour of the day) and say "marked" in
|
|
1004
|
+
* their name (`labels.markedDay`); also `data-marked` on the day's button (Fluent's
|
|
1005
|
+
* `getMarkedDays`). Called with local-midnight dates.
|
|
1006
|
+
*/
|
|
1007
|
+
markedDates?: (date: Date) => boolean;
|
|
1008
|
+
/**
|
|
1009
|
+
* Replaces the content inside a day's button, which keeps its role, state and keys;
|
|
1010
|
+
* `defaultContent` is the day number. The content must be non-interactive (no buttons or links),
|
|
1011
|
+
* and the button's name does not follow it: set the name with `dayLabel`. The marked-day dot is
|
|
1012
|
+
* drawn next to the content.
|
|
1013
|
+
*/
|
|
1014
|
+
renderDay?: (date: Date, defaultContent: React_2.ReactNode) => React_2.ReactNode;
|
|
1015
|
+
/**
|
|
1016
|
+
* The accessible name of a day, from its default name (the date in words, `Monday, June 2,
|
|
1017
|
+
* 2025`, with `labels.markedDay` applied for a marked day). Use it to say what `renderDay` shows.
|
|
1018
|
+
*/
|
|
1019
|
+
dayLabel?: (date: Date, defaultLabel: string) => string;
|
|
1020
|
+
/**
|
|
1021
|
+
* What a pick selects: the day, or its week, work week (`workWeekDays`) or month. The value is
|
|
1022
|
+
* the picked day, `details.range` the selected days, and every day of the range is
|
|
1023
|
+
* `aria-selected`, `aria-pressed` and `data-selected`. Days that are not available are left
|
|
1024
|
+
* out. Fluent's `dateRangeType`.
|
|
1025
|
+
* @default 'day'
|
|
1026
|
+
*/
|
|
1027
|
+
selectionRange?: CalendarSelectionRange;
|
|
1028
|
+
/**
|
|
1029
|
+
* The days of `selectionRange="work-week"` (0 = Sunday), within the week that starts on
|
|
1030
|
+
* `firstDayOfWeek`.
|
|
1031
|
+
* @default [1, 2, 3, 4, 5]
|
|
1032
|
+
*/
|
|
1033
|
+
workWeekDays?: readonly DayOfWeek[];
|
|
1034
|
+
/**
|
|
1035
|
+
* Names of the navigation buttons, the heading button's hints, the "Go to today" button, the
|
|
1036
|
+
* week-number column, the marked days and the required hint, for localization.
|
|
1037
|
+
*/
|
|
1038
|
+
labels?: CalendarLabels;
|
|
1039
|
+
/** Form field name: the day is submitted as ISO `yyyy-mm-dd` (hidden input). */
|
|
1040
|
+
name?: string;
|
|
1041
|
+
/** Id of the `<form>` the value belongs to, when the calendar is outside it. */
|
|
1042
|
+
form?: string;
|
|
1043
|
+
/**
|
|
1044
|
+
* Blocks form submission while no day is selected; the form's report focuses the calendar's
|
|
1045
|
+
* tab stop. Said in the description (`labels.required`), as the group cannot carry
|
|
1046
|
+
* `aria-required`. A consumer `aria-required` alone also shows that hint (assistive technology
|
|
1047
|
+
* only: it does not block submission).
|
|
1048
|
+
*/
|
|
1049
|
+
required?: boolean;
|
|
1050
|
+
/** Ref to the root element. */
|
|
1051
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/** What a pick selects (the Calendar's `selectionRange`). */
|
|
1055
|
+
export declare type CalendarSelectionRange = 'day' | 'week' | 'work-week' | 'month';
|
|
1056
|
+
|
|
1057
|
+
/** Second argument of `Calendar`'s `onValueChange`. */
|
|
1058
|
+
export declare interface CalendarValueChangeDetails {
|
|
1059
|
+
/**
|
|
1060
|
+
* The selected days in order (local midnight): the picked day, or with `selectionRange` its
|
|
1061
|
+
* week, work week or month (the days that are not available left out); `[]` for `null`.
|
|
1062
|
+
*/
|
|
1063
|
+
range: Date[];
|
|
1064
|
+
}
|
|
1065
|
+
|
|
768
1066
|
/**
|
|
769
1067
|
* A surface that groups related content, with `Card.Header`, `Card.Body` and `Card.Footer`.
|
|
770
1068
|
*
|
|
@@ -1116,9 +1414,12 @@ export declare interface CarouselProps extends React_2.HTMLAttributes<HTMLDivEle
|
|
|
1116
1414
|
* `labelPosition="before"` (the root carries `data-label-position`). The box lines up with the
|
|
1117
1415
|
* first line of a label that wraps or has a second line. `children` are not rendered (a
|
|
1118
1416
|
* development warning says so).
|
|
1417
|
+
* - `size` (`medium`, `large`) and `shape` (`square`, `circular`) set the box's dimensions and
|
|
1418
|
+
* corners; the root carries `data-size` and `data-shape`. Checkbox does not read a surrounding
|
|
1419
|
+
* `Field`'s size or a `WaveProvider`'s input defaults.
|
|
1119
1420
|
*/
|
|
1120
1421
|
export declare const Checkbox: {
|
|
1121
|
-
({ checked: checkedProp, defaultChecked, indeterminate, onCheckedChange, onChange, disabled, disabledFocusable, label, labelPosition, name, value, required, form, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, "aria-details": ariaDetails, "aria-disabled": ariaDisabled, autoFocus, tabIndex, onClick, onFocus, onBlur, onKeyDown, onKeyUp, controlRef, className, children, ref, ...rest }: CheckboxProps): React_2.JSX.Element;
|
|
1422
|
+
({ checked: checkedProp, defaultChecked, indeterminate, onCheckedChange, onChange, disabled, disabledFocusable, label, labelPosition, size, shape, name, value, required, form, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, "aria-details": ariaDetails, "aria-disabled": ariaDisabled, autoFocus, tabIndex, onClick, onFocus, onBlur, onKeyDown, onKeyUp, controlRef, className, children, ref, ...rest }: CheckboxProps): React_2.JSX.Element;
|
|
1122
1423
|
displayName: string;
|
|
1123
1424
|
};
|
|
1124
1425
|
|
|
@@ -1188,6 +1489,18 @@ export declare interface CheckboxProps extends Omit<React_2.HTMLAttributes<HTMLL
|
|
|
1188
1489
|
* @default 'after'
|
|
1189
1490
|
*/
|
|
1190
1491
|
labelPosition?: CheckboxLabelPosition;
|
|
1492
|
+
/**
|
|
1493
|
+
* Size of the box: an 18px box (the 0.7 look) or a 22px box with a bigger glyph. Unlike the
|
|
1494
|
+
* text controls and pickers, Checkbox does not read a surrounding Field's size or a
|
|
1495
|
+
* WaveProvider's input defaults: this prop is the only source of its size.
|
|
1496
|
+
* @default 'medium'
|
|
1497
|
+
*/
|
|
1498
|
+
size?: CheckboxSize;
|
|
1499
|
+
/**
|
|
1500
|
+
* Shape of the box: square corners (the 0.7 look) or a circular, round box.
|
|
1501
|
+
* @default 'square'
|
|
1502
|
+
*/
|
|
1503
|
+
shape?: CheckboxShape;
|
|
1191
1504
|
/**
|
|
1192
1505
|
* Form field name. With a name, the checkbox takes part in native form submission: it submits
|
|
1193
1506
|
* `name=value` while checked.
|
|
@@ -1217,6 +1530,12 @@ export declare interface CheckboxProps extends Omit<React_2.HTMLAttributes<HTMLL
|
|
|
1217
1530
|
ref?: React_2.Ref<HTMLLabelElement>;
|
|
1218
1531
|
}
|
|
1219
1532
|
|
|
1533
|
+
/** Shape of the box: square corners (the 0.7 look) or a circular, round box. */
|
|
1534
|
+
export declare type CheckboxShape = Extract<Shape, 'square' | 'circular'>;
|
|
1535
|
+
|
|
1536
|
+
/** Size of the box: an 18px box (the 0.7 look) or a 22px box with a bigger glyph. */
|
|
1537
|
+
export declare type CheckboxSize = Extract<Size, 'medium' | 'large'>;
|
|
1538
|
+
|
|
1220
1539
|
/**
|
|
1221
1540
|
* Checked items of a menu or toolbar, per group `name`: `{ sort: ['date'], view: ['ruler', 'grid'] }`.
|
|
1222
1541
|
* A checkbox or switch item (or a toolbar toggle) is checked while its `value` is in
|
|
@@ -1258,6 +1577,21 @@ export declare type CheckedValuesChangeHandler = (checkedValues: Record<string,
|
|
|
1258
1577
|
*/
|
|
1259
1578
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
1260
1579
|
|
|
1580
|
+
/**
|
|
1581
|
+
* Reads option labels from `children` during render (read-only), for display text before the
|
|
1582
|
+
* options have registered: on the server, in the first client render and during hydration
|
|
1583
|
+
* (layout effects have not run yet). Walks elements of components marked with
|
|
1584
|
+
* {@link markListboxElement}: `'option'` elements give `value → label` (`label` prop →
|
|
1585
|
+
* `textValue` → the text of their string/number children and host elements → `value` when they
|
|
1586
|
+
* have no children); `'group'` elements and Fragments are walked into. Other components are
|
|
1587
|
+
* opaque (their options resolve after registration). The first option of a value wins. A lazy
|
|
1588
|
+
* element type (an option or group written in a React Server Component) is unwrapped first.
|
|
1589
|
+
*
|
|
1590
|
+
* Display text = `listbox.getItem(value)?.label ?? collectOptionLabels(children).get(value)`
|
|
1591
|
+
* (`?? value` for freeform input only).
|
|
1592
|
+
*/
|
|
1593
|
+
export declare function collectOptionLabels(children: React_2.ReactNode): Map<string, string>;
|
|
1594
|
+
|
|
1261
1595
|
/**
|
|
1262
1596
|
* A 2-D color field: saturation from left to right (mirrored in right-to-left layouts) and
|
|
1263
1597
|
* brightness from bottom to top, at the value's hue. ArrowLeft and ArrowRight move saturation by
|
|
@@ -1751,6 +2085,71 @@ export declare interface ColorSliderProps extends Omit<React_2.HTMLAttributes<HT
|
|
|
1751
2085
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
1752
2086
|
}
|
|
1753
2087
|
|
|
2088
|
+
/**
|
|
2089
|
+
* One color swatch of a `SwatchPicker`, read from `items` or rendered directly as a child.
|
|
2090
|
+
* Outside a `SwatchPicker` it throws in development and renders inertly in production.
|
|
2091
|
+
*
|
|
2092
|
+
* **Naming**: give it `aria-label`, or wrap it in a `Tooltip` with `relationship="label"` (its
|
|
2093
|
+
* `aria-labelledby` reaches this element, since every rest prop lands on the swatch's own
|
|
2094
|
+
* button). Without either it is named by its `color` value and a development warning is logged.
|
|
2095
|
+
*
|
|
2096
|
+
* **Disabled**: `disabled` is native (out of the arrow keys and the tab order, never selected);
|
|
2097
|
+
* the swatch is dimmed and crossed by a diagonal slash, so the state does not rely on its color.
|
|
2098
|
+
*
|
|
2099
|
+
* @example
|
|
2100
|
+
* <SwatchPicker aria-label="Accent color">
|
|
2101
|
+
* <ColorSwatch value="red" color="#d13438" aria-label="Red" />
|
|
2102
|
+
* </SwatchPicker>
|
|
2103
|
+
*/
|
|
2104
|
+
export declare const ColorSwatch: {
|
|
2105
|
+
({ color, borderColor, ...rest }: ColorSwatchProps): React_2.JSX.Element;
|
|
2106
|
+
displayName: string;
|
|
2107
|
+
};
|
|
2108
|
+
|
|
2109
|
+
/**
|
|
2110
|
+
* ColorSwatch (also the swatches of SwatchPicker's `items`; carries SwatchPicker's `swatch`):
|
|
2111
|
+
* `root` on the swatch `<button>`, where `className` lands in every layout; `icon` on the span of
|
|
2112
|
+
* your `icon`.
|
|
2113
|
+
*/
|
|
2114
|
+
export declare const colorSwatchClassNames: {
|
|
2115
|
+
readonly root: "wave-color-swatch";
|
|
2116
|
+
readonly icon: "wave-color-swatch__icon";
|
|
2117
|
+
};
|
|
2118
|
+
|
|
2119
|
+
/** Properties for the ColorSwatch component. */
|
|
2120
|
+
export declare interface ColorSwatchProps extends Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'color'> {
|
|
2121
|
+
/** Unique identifier for the swatch (the value the picker selects and a form submits). */
|
|
2122
|
+
value: string;
|
|
2123
|
+
/** CSS color value (e.g., hex, rgb) used as the swatch background (a runtime user color). */
|
|
2124
|
+
color: string;
|
|
2125
|
+
/**
|
|
2126
|
+
* Decorative glyph (`aria-hidden`) shown while the swatch is not selected; the check replaces it
|
|
2127
|
+
* while selected. A `<button>` or `Button` passed here is not nested: its children become the
|
|
2128
|
+
* glyph and a one-time development warning is logged.
|
|
2129
|
+
*/
|
|
2130
|
+
icon?: Slot<'span'>;
|
|
2131
|
+
/**
|
|
2132
|
+
* CSS color of the swatch's border, for a color close to the page background (set by hand, as
|
|
2133
|
+
* in Fluent). In forced colors the system border color replaces it.
|
|
2134
|
+
*/
|
|
2135
|
+
borderColor?: string;
|
|
2136
|
+
/**
|
|
2137
|
+
* Size of the swatch (20, 24, 32 or 40px).
|
|
2138
|
+
* @default the picker's
|
|
2139
|
+
*/
|
|
2140
|
+
size?: SwatchPickerSize;
|
|
2141
|
+
/**
|
|
2142
|
+
* Shape of the swatch.
|
|
2143
|
+
* @default the picker's
|
|
2144
|
+
*/
|
|
2145
|
+
shape?: Shape;
|
|
2146
|
+
/**
|
|
2147
|
+
* Ref to the swatch button: `role="radio"` in the row layout, inside its cell in the grid
|
|
2148
|
+
* layout, a toggle button in tab mode.
|
|
2149
|
+
*/
|
|
2150
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
1754
2153
|
/**
|
|
1755
2154
|
* An editable combobox: a text input with a filterable listbox of `Option`s (APG combobox with
|
|
1756
2155
|
* list autocomplete). Typing filters the options; ArrowDown/ArrowUp move the highlight
|
|
@@ -1758,9 +2157,27 @@ export declare interface ColorSliderProps extends Omit<React_2.HTMLAttributes<HT
|
|
|
1758
2157
|
* filter: its first match becomes active while typing, and the input shows the selected option's
|
|
1759
2158
|
* label again when the listbox closes. With `freeform` the text itself is the value. Text that
|
|
1760
2159
|
* matches no option shows "No matches" (`labels.noMatches`), announced through a status region.
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
2160
|
+
* `filter` replaces the match (it may keep options that do not contain the text, for a server-side
|
|
2161
|
+
* search or a "Create …" entry), and `query`/`defaultQuery`/`onQueryChange` control the typed
|
|
2162
|
+
* text (not with `freeform`), which resets to `''` on a commit, a close, a blur, Escape, the clear
|
|
2163
|
+
* button and a form reset. The expand button at the end of the input (a chevron, see
|
|
2164
|
+
* `expandIcon`) opens and closes the list without taking focus from the input and is not a tab
|
|
2165
|
+
* stop; `clearable` adds a clear button, a tab stop after the input. Both sit with the input in a
|
|
2166
|
+
* wrapper `<div>` inside the root.
|
|
2167
|
+
*
|
|
2168
|
+
* `multiselect` turns the value into an array (Fluent's `selectedOptions`): options draw a
|
|
2169
|
+
* checkbox; Enter and a click toggle an option and keep the list open (Tab, Escape and
|
|
2170
|
+
* Alt+ArrowUp close without committing), and every toggle the user makes is announced
|
|
2171
|
+
* (`labels.added`/`labels.removed`, never for a controlled change, a clear or a form reset).
|
|
2172
|
+
* While no text is typed the input shows the selected labels in selection order
|
|
2173
|
+
* (`labels.selection`, values without an option left out) instead of the placeholder. Focusing
|
|
2174
|
+
* the input selects them, and so does their return to the focused input (a toggle, a close, a
|
|
2175
|
+
* form reset), so typing, pasting or composing text replaces them with a query that filters the
|
|
2176
|
+
* options; text inserted into them queries only what was inserted, an undo or a redo back to them
|
|
2177
|
+
* shows them again, and a toggle, a close or a blur clears the query. Backspace and Delete only
|
|
2178
|
+
* edit the text: the options, the clear button (which clears every value) and a form reset change
|
|
2179
|
+
* the value. `freeform` is not available with `multiselect`, and a non-literal
|
|
2180
|
+
* `multiselect={flag}` is a type error: render two elements, one for each mode.
|
|
1764
2181
|
*
|
|
1765
2182
|
* The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,
|
|
1766
2183
|
* `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,
|
|
@@ -1769,19 +2186,20 @@ export declare interface ColorSliderProps extends Omit<React_2.HTMLAttributes<HT
|
|
|
1769
2186
|
* `ref`, `className`, `style`, other `aria-*` attributes and the remaining props stay on the root
|
|
1770
2187
|
* `<div>`. Inside a `Field` the input is labelled and described by it. It shows the error look
|
|
1771
2188
|
* whenever it ends up `aria-invalid` (its own `aria-invalid` or a `Field` error). With
|
|
1772
|
-
* `name`/`required` the value takes part in form submission
|
|
1773
|
-
*
|
|
2189
|
+
* `name`/`required` the value takes part in form submission (one hidden input per value with
|
|
2190
|
+
* `multiselect`), validation and reset (a `multiselect` reset is compared by content, so restoring
|
|
2191
|
+
* the same values reports nothing). The open listbox renders in a portal; while closed it stays
|
|
2192
|
+
* in the DOM, hidden.
|
|
2193
|
+
*
|
|
2194
|
+
* **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
2195
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own prop,
|
|
2196
|
+
* then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and
|
|
2197
|
+
* `data-appearance` on the root `<div>`. The listbox keeps its size.
|
|
1774
2198
|
*
|
|
1775
2199
|
* Sub-components: `Combobox.Option`, `Combobox.OptionGroup`. React Server Components import the
|
|
1776
2200
|
* flat names `ComboboxOption` / `ComboboxOptionGroup` (dotted access needs a client file).
|
|
1777
2201
|
*/
|
|
1778
|
-
export declare const Combobox:
|
|
1779
|
-
(props: ComboboxProps): React_2.JSX.Element;
|
|
1780
|
-
displayName: string;
|
|
1781
|
-
} & {
|
|
1782
|
-
Option: React_2.NamedExoticComponent<OptionProps>;
|
|
1783
|
-
OptionGroup: React_2.FC<OptionGroupProps>;
|
|
1784
|
-
};
|
|
2202
|
+
export declare const Combobox: ComboboxComponent;
|
|
1785
2203
|
|
|
1786
2204
|
/**
|
|
1787
2205
|
* Combobox: `root` on the outer element; `input` on the `role="combobox"` input; `clearButton` on
|
|
@@ -1800,6 +2218,17 @@ export declare const comboboxClassNames: {
|
|
|
1800
2218
|
readonly emptyMessage: "wave-combobox__empty-message";
|
|
1801
2219
|
};
|
|
1802
2220
|
|
|
2221
|
+
/** The Combobox component's type: a multi-select signature, then the single-select one. */
|
|
2222
|
+
export declare interface ComboboxComponent {
|
|
2223
|
+
(props: ComboboxProps<true> & {
|
|
2224
|
+
multiselect: true;
|
|
2225
|
+
}): React_2.ReactNode;
|
|
2226
|
+
(props: ComboboxProps): React_2.ReactNode;
|
|
2227
|
+
displayName?: string;
|
|
2228
|
+
Option: typeof Option_2;
|
|
2229
|
+
OptionGroup: typeof OptionGroup;
|
|
2230
|
+
}
|
|
2231
|
+
|
|
1803
2232
|
/**
|
|
1804
2233
|
* The Combobox's built-in texts, for localization. Each member is optional and falls back to its
|
|
1805
2234
|
* English default.
|
|
@@ -1817,6 +2246,24 @@ export declare interface ComboboxLabels {
|
|
|
1817
2246
|
* @default 'Show options'
|
|
1818
2247
|
*/
|
|
1819
2248
|
expand?: string;
|
|
2249
|
+
/**
|
|
2250
|
+
* The text of the selected labels the input shows with `multiselect` while no text is typed, in
|
|
2251
|
+
* selection order; values without an option are left out.
|
|
2252
|
+
* @default (labels) => labels.join(', ')
|
|
2253
|
+
*/
|
|
2254
|
+
selection?: (labels: string[]) => string;
|
|
2255
|
+
/**
|
|
2256
|
+
* Announced when a `multiselect` toggle selects an option; `count` is the number of values
|
|
2257
|
+
* selected after the change.
|
|
2258
|
+
* @default (label, count) => `${label} added, ${count} selected`
|
|
2259
|
+
*/
|
|
2260
|
+
added?: (label: string, count: number) => string;
|
|
2261
|
+
/**
|
|
2262
|
+
* Announced when a `multiselect` toggle deselects an option; `count` is the number of values
|
|
2263
|
+
* selected after the change.
|
|
2264
|
+
* @default (label, count) => `${label} removed, ${count} selected`
|
|
2265
|
+
*/
|
|
2266
|
+
removed?: (label: string, count: number) => string;
|
|
1820
2267
|
}
|
|
1821
2268
|
|
|
1822
2269
|
/** Flat name of `Combobox.Option` for React Server Components. */
|
|
@@ -1826,22 +2273,38 @@ export declare const ComboboxOption: React_2.NamedExoticComponent<OptionProps>;
|
|
|
1826
2273
|
export declare const ComboboxOptionGroup: React_2.FC<OptionGroupProps>;
|
|
1827
2274
|
|
|
1828
2275
|
/** Properties for the Combobox component. */
|
|
1829
|
-
export declare interface ComboboxProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | RoutedHandlers> {
|
|
1830
|
-
/**
|
|
1831
|
-
|
|
2276
|
+
export declare interface ComboboxProps<M extends boolean = false> extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | RoutedHandlers> {
|
|
2277
|
+
/**
|
|
2278
|
+
* Several options can be selected (Fluent's `multiselect`): the value is an array, options show
|
|
2279
|
+
* a checkbox, Enter and a click toggle an option and keep the list open, and each toggle is
|
|
2280
|
+
* announced. While no text is typed the input shows the selected labels, selected whenever the
|
|
2281
|
+
* input gains focus or they return to it, so typing replaces them with text that filters the
|
|
2282
|
+
* options. Not available with `freeform`. A non-literal `multiselect={flag}` is a type error:
|
|
2283
|
+
* render two elements, one for each mode.
|
|
2284
|
+
* @default false
|
|
2285
|
+
*/
|
|
2286
|
+
multiselect?: M;
|
|
2287
|
+
/**
|
|
2288
|
+
* Controlled selected value (`''` for none), or with `multiselect` the selected values (Fluent's
|
|
2289
|
+
* `selectedOptions`).
|
|
2290
|
+
*/
|
|
2291
|
+
value?: M extends true ? readonly string[] : string;
|
|
1832
2292
|
/**
|
|
1833
2293
|
* Initial selected value for uncontrolled usage.
|
|
1834
|
-
* @default ''
|
|
2294
|
+
* @default '' (`[]` with `multiselect`)
|
|
1835
2295
|
*/
|
|
1836
|
-
defaultValue?: string;
|
|
2296
|
+
defaultValue?: M extends true ? readonly string[] : string;
|
|
1837
2297
|
/**
|
|
1838
|
-
* Called with the new value when it changes: an option is selected
|
|
1839
|
-
*
|
|
2298
|
+
* Called with the new value when it changes: an option is selected (toggled with `multiselect`,
|
|
2299
|
+
* which passes a new array), or (with `freeform`) the text changes. Without `multiselect` it is
|
|
2300
|
+
* not called when the current option is selected again; with it, activating a selected option
|
|
2301
|
+
* deselects it, which is a change. Fluent's `onOptionSelect`, under WaveUI's value/onValueChange
|
|
2302
|
+
* naming.
|
|
1840
2303
|
*/
|
|
1841
|
-
onValueChange?: (value: string) => void;
|
|
2304
|
+
onValueChange?: M extends true ? (value: string[]) => void : (value: string) => void;
|
|
1842
2305
|
/**
|
|
1843
|
-
* Called on every option activation, also when the current option is selected again (
|
|
1844
|
-
* `freeform`,
|
|
2306
|
+
* Called on every option activation, also when the current option is selected again (every
|
|
2307
|
+
* toggle with `multiselect`; with `freeform`, every text change).
|
|
1845
2308
|
* @deprecated Use `onValueChange`.
|
|
1846
2309
|
*/
|
|
1847
2310
|
onOptionSelect?: (value: string) => void;
|
|
@@ -1859,23 +2322,91 @@ export declare interface ComboboxProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
1859
2322
|
defaultOpen?: boolean;
|
|
1860
2323
|
/** Called when the listbox opens or closes. */
|
|
1861
2324
|
onOpenChange?: (open: boolean) => void;
|
|
1862
|
-
/**
|
|
2325
|
+
/**
|
|
2326
|
+
* Placeholder text shown when no value is selected; with `multiselect`, whenever the input shows
|
|
2327
|
+
* no selected labels (no value is selected, or no selected value has an option).
|
|
2328
|
+
*/
|
|
1863
2329
|
placeholder?: string;
|
|
1864
2330
|
/**
|
|
1865
2331
|
* Whether the combobox is disabled and non-interactive.
|
|
1866
2332
|
* @default false
|
|
1867
2333
|
*/
|
|
1868
2334
|
disabled?: boolean;
|
|
2335
|
+
/**
|
|
2336
|
+
* Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the
|
|
2337
|
+
* surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`. The
|
|
2338
|
+
* listbox keeps its size.
|
|
2339
|
+
*/
|
|
2340
|
+
size?: CoreSize;
|
|
2341
|
+
/**
|
|
2342
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
2343
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
2344
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
2345
|
+
*/
|
|
2346
|
+
appearance?: InputAppearance;
|
|
1869
2347
|
/**
|
|
1870
2348
|
* Whether the typed text is itself the value. Without it, typing only filters the options (the
|
|
1871
2349
|
* first match becomes active, so Enter selects it) and the input shows the selected option's
|
|
1872
2350
|
* label again when the listbox closes or loses focus. With it, the input shows typed text as
|
|
1873
2351
|
* typed (also when it equals an option's value), a selected option's label, and a controlled
|
|
1874
|
-
* `value` as soon as the parent sets it (a parent that normalizes or rejects the text).
|
|
2352
|
+
* `value` as soon as the parent sets it (a parent that normalizes or rejects the text). Not
|
|
2353
|
+
* available with `multiselect` (a type error there): free text cannot be one of several values.
|
|
1875
2354
|
* @default false
|
|
1876
2355
|
*/
|
|
1877
|
-
freeform?: boolean;
|
|
1878
|
-
/**
|
|
2356
|
+
freeform?: M extends true ? never : boolean;
|
|
2357
|
+
/**
|
|
2358
|
+
* Whether an option matches the typed text (the query, or with `freeform` the typed value).
|
|
2359
|
+
* Called with every option that is not hidden (its `value`, `label` and `textValue`) and the
|
|
2360
|
+
* text whenever the text is not empty; an option it returns `false` for is filtered out. It may
|
|
2361
|
+
* keep options that do not contain the text: `filter={() => true}` with `query` and
|
|
2362
|
+
* `onQueryChange` leaves the matching to you (a server-side search that replaces the options),
|
|
2363
|
+
* and a filter that always keeps an option of your own gives a "Create …" entry. With a
|
|
2364
|
+
* server-side search, keep the selected option among the children, `hidden` while the results
|
|
2365
|
+
* leave it out: a value without an option shows no label (the "Async search" story does this).
|
|
2366
|
+
* @default a case-insensitive substring match on the option's `textValue`, else its `label`
|
|
2367
|
+
*/
|
|
2368
|
+
filter?: (option: ListboxItem, query: string) => boolean;
|
|
2369
|
+
/**
|
|
2370
|
+
* Controlled query: the text typed since the last commit, which filters the options. A
|
|
2371
|
+
* non-empty query shows in the input (hidden while `disabled` or `readOnly`); `''` shows the
|
|
2372
|
+
* selected option's label (the selected labels with `multiselect`), except while the user edits
|
|
2373
|
+
* the text, so erased text stays empty. Not used with `freeform`, where the typed text is the
|
|
2374
|
+
* value.
|
|
2375
|
+
*/
|
|
2376
|
+
query?: string;
|
|
2377
|
+
/**
|
|
2378
|
+
* Initial query for uncontrolled usage. A Combobox that starts disabled or read-only starts
|
|
2379
|
+
* without it (as it starts closed). Not used with `freeform`.
|
|
2380
|
+
* @default ''
|
|
2381
|
+
*/
|
|
2382
|
+
defaultQuery?: string;
|
|
2383
|
+
/**
|
|
2384
|
+
* Called with the new query when it changes: as the user types, and with `''` when it resets (a
|
|
2385
|
+
* commit, a close, a blur, Escape, the clear button, a form reset, or `disabled` or `readOnly`
|
|
2386
|
+
* turned on while text is typed). A Combobox that mounts disabled or read-only reports nothing:
|
|
2387
|
+
* it keeps a controlled query, which shows once it unlocks. Never called with `freeform`.
|
|
2388
|
+
*/
|
|
2389
|
+
onQueryChange?: (query: string) => void;
|
|
2390
|
+
/**
|
|
2391
|
+
* Called after the active (highlighted) option changes — opening, arrow keys, the pointer, a
|
|
2392
|
+
* filter change that moves it — and with `null` when the list closes. It reports what
|
|
2393
|
+
* `aria-activedescendant` points at, from an effect once the change commits. Fluent's
|
|
2394
|
+
* `onActiveOptionChange` reports neither the pointer (its options have no hover highlight) nor
|
|
2395
|
+
* the close.
|
|
2396
|
+
*/
|
|
2397
|
+
onActiveOptionChange?: (value: string | null) => void;
|
|
2398
|
+
/**
|
|
2399
|
+
* Keeps disabled options in the arrow-key order (the first match highlighted while typing may
|
|
2400
|
+
* then be a disabled one too); they still cannot be selected (Enter and a click do nothing and
|
|
2401
|
+
* the list stays open). Unlike Fluent, which always keeps disabled options reachable, WaveUI
|
|
2402
|
+
* skips them by default.
|
|
2403
|
+
* @default false
|
|
2404
|
+
*/
|
|
2405
|
+
disabledOptionsFocusable?: boolean;
|
|
2406
|
+
/**
|
|
2407
|
+
* Name of the value in form submissions (renders a hidden input; one per value with
|
|
2408
|
+
* `multiselect`).
|
|
2409
|
+
*/
|
|
1879
2410
|
name?: string;
|
|
1880
2411
|
/** Id of the form the value belongs to, when the Combobox is outside it. */
|
|
1881
2412
|
form?: string;
|
|
@@ -1890,7 +2421,11 @@ export declare interface ComboboxProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
1890
2421
|
* @default 'off'
|
|
1891
2422
|
*/
|
|
1892
2423
|
autoComplete?: string;
|
|
1893
|
-
/**
|
|
2424
|
+
/**
|
|
2425
|
+
* The maximum length of the typed text (`maxlength` of the `<input role="combobox">`). With
|
|
2426
|
+
* `multiselect` the input has no limit while it shows the selected labels, so the limit applies
|
|
2427
|
+
* to the typed query only.
|
|
2428
|
+
*/
|
|
1894
2429
|
maxLength?: number;
|
|
1895
2430
|
/**
|
|
1896
2431
|
* The value cannot be changed: the input is read-only and the listbox neither opens (click,
|
|
@@ -1901,8 +2436,8 @@ export declare interface ComboboxProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
1901
2436
|
/**
|
|
1902
2437
|
* Shows a clear button while a value is selected (not while `readOnly`; while `disabled` it is
|
|
1903
2438
|
* shown disabled, as in DatePicker and TimePicker). It clears the value
|
|
1904
|
-
* (`onValueChange('')`), drops typed text,
|
|
1905
|
-
* a tab stop after the input.
|
|
2439
|
+
* (`onValueChange('')`; every value with `multiselect`, `onValueChange([])`), drops typed text,
|
|
2440
|
+
* closes the list and moves focus to the input. It is a tab stop after the input.
|
|
1906
2441
|
* @default false
|
|
1907
2442
|
*/
|
|
1908
2443
|
clearable?: boolean;
|
|
@@ -1916,11 +2451,16 @@ export declare interface ComboboxProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
1916
2451
|
*/
|
|
1917
2452
|
expandIcon?: Slot<'span'>;
|
|
1918
2453
|
/**
|
|
1919
|
-
* The built-in texts (the "No matches" status
|
|
1920
|
-
*
|
|
2454
|
+
* The built-in texts (the "No matches" status, the names of the clear and expand buttons and,
|
|
2455
|
+
* with `multiselect`, the selected-labels text and the toggle announcements), for localization.
|
|
2456
|
+
* Unset members keep their English defaults.
|
|
1921
2457
|
*/
|
|
1922
2458
|
labels?: ComboboxLabels;
|
|
1923
|
-
/**
|
|
2459
|
+
/**
|
|
2460
|
+
* Called when the `<input role="combobox">` receives focus (the root keeps other handlers).
|
|
2461
|
+
* With `multiselect`, a focus while the input shows the selected labels then selects them;
|
|
2462
|
+
* `event.preventDefault()` skips that.
|
|
2463
|
+
*/
|
|
1924
2464
|
onFocus?: React_2.FocusEventHandler<HTMLInputElement>;
|
|
1925
2465
|
/** Called when the `<input role="combobox">` loses focus. */
|
|
1926
2466
|
onBlur?: React_2.FocusEventHandler<HTMLInputElement>;
|
|
@@ -2047,6 +2587,12 @@ export declare interface CompoundButtonOwnProps {
|
|
|
2047
2587
|
*/
|
|
2048
2588
|
export declare type CompoundButtonProps<C extends React_2.ElementType = 'button'> = PolymorphicProps<C, CompoundButtonOwnProps>;
|
|
2049
2589
|
|
|
2590
|
+
/**
|
|
2591
|
+
* The three-step size of text inputs, pickers, Field and Label (Fluent's field sizes): `small`
|
|
2592
|
+
* (24px tall), `medium` (32px) and `large` (40px).
|
|
2593
|
+
*/
|
|
2594
|
+
export declare type CoreSize = Extract<Size, 'small' | 'medium' | 'large'>;
|
|
2595
|
+
|
|
2050
2596
|
/**
|
|
2051
2597
|
* A small pill showing a count (unread messages, notifications), or with `dot` a small dot
|
|
2052
2598
|
* without a number. Renders nothing for a count of 0 (unless `showZero`) or less, and
|
|
@@ -2503,9 +3049,14 @@ export declare interface DataGridUncontrolledSortProps extends NoDeprecatedSortP
|
|
|
2503
3049
|
* modal dialog labelled by the month heading. Focus moves to the selected day (else today, else
|
|
2504
3050
|
* the first available day of the month) and Tab stays inside. Arrow keys move by day/week
|
|
2505
3051
|
* (mirrored in RTL), PageUp/PageDown by month, Shift+PageUp/PageDown by year (the day is clamped
|
|
2506
|
-
* to the month), Home/End to the start/end of the week, Enter/Space select.
|
|
2507
|
-
*
|
|
2508
|
-
*
|
|
3052
|
+
* to the month), Home/End to the start/end of the week, Enter/Space select. The month text is a
|
|
3053
|
+
* button (the heading button, `showMonthPicker`) that shows the month view, whose heading, the
|
|
3054
|
+
* year, leads to the year view; Escape steps back from the year view to the month view and from
|
|
3055
|
+
* there to the days, and closes only from the day view, returning focus to where the calendar
|
|
3056
|
+
* was opened from (the toggle, or the input after Alt+ArrowDown); a press outside closes it too.
|
|
3057
|
+
* `showCloseButton` adds a Close button that closes as Escape does from the day view, and
|
|
3058
|
+
* `showGoToToday` a button that shows today's month. `showWeekNumbers`, `markedDates`,
|
|
3059
|
+
* `renderDay` and `dayLabel` shape the day grid as in `Calendar`. Unavailable days stay focusable
|
|
2509
3060
|
* (`aria-disabled`); a day focused by pointer becomes the starting point of the arrow keys. The
|
|
2510
3061
|
* selected day is `aria-selected` on its gridcell and `aria-pressed` on its focusable button, so
|
|
2511
3062
|
* the state is announced when focus lands on it; today is `aria-current="date"`.
|
|
@@ -2516,6 +3067,10 @@ export declare interface DataGridUncontrolledSortProps extends NoDeprecatedSortP
|
|
|
2516
3067
|
* clear button that disappears.
|
|
2517
3068
|
* - Every emitted date is local midnight. The calendar opens on the month of the selected date or
|
|
2518
3069
|
* today, clamped into `minDate`/`maxDate`.
|
|
3070
|
+
* - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
3071
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own
|
|
3072
|
+
* prop, then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as
|
|
3073
|
+
* `data-size` and `data-appearance` on the root `<div>`. The calendar keeps its size.
|
|
2519
3074
|
* - The input (`controlRef`) receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,
|
|
2520
3075
|
* `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`,
|
|
2521
3076
|
* `autoFocus`, `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes
|
|
@@ -2538,9 +3093,15 @@ export declare const DatePicker: {
|
|
|
2538
3093
|
* DatePicker: `root` on the outer element; `input` on the text input; `clearButton` on the clear
|
|
2539
3094
|
* button; `openCalendarButton` on the calendar button; `errorMessage` on the `role="alert"`
|
|
2540
3095
|
* message; `surface` on the portaled `role="dialog"` calendar; `header` on its month row;
|
|
2541
|
-
* `previousMonthButton` and `nextMonthButton` on the
|
|
2542
|
-
*
|
|
2543
|
-
* `
|
|
3096
|
+
* `previousMonthButton` and `nextMonthButton` on the navigation buttons (by a month, and in the
|
|
3097
|
+
* month and year views by a year and a decade); `heading` on the `<h2>` (the month, year or
|
|
3098
|
+
* decade); `headingButton` on its button to the month and year views; `grid` on the calendar's
|
|
3099
|
+
* `role="grid"` element of every view; `weekday` on each weekday header cell; `weekNumberHeader`
|
|
3100
|
+
* on the header cell of the week-number column and `weekNumber` on each week's row header
|
|
3101
|
+
* (`showWeekNumbers`); `day`, `month` and `year` on each day, month and year button; `markedDot`
|
|
3102
|
+
* on the dot inside a marked day's button; `footer` on the row of the footer buttons
|
|
3103
|
+
* (`showGoToToday`, `showCloseButton`), with `todayButton` on "Go to today" and `closeButton` on
|
|
3104
|
+
* "Close".
|
|
2544
3105
|
*/
|
|
2545
3106
|
export declare const datePickerClassNames: {
|
|
2546
3107
|
readonly root: "wave-date-picker";
|
|
@@ -2552,21 +3113,33 @@ export declare const datePickerClassNames: {
|
|
|
2552
3113
|
readonly header: "wave-date-picker__header";
|
|
2553
3114
|
readonly previousMonthButton: "wave-date-picker__previous-month-button";
|
|
2554
3115
|
readonly heading: "wave-date-picker__heading";
|
|
3116
|
+
readonly headingButton: "wave-date-picker__heading-button";
|
|
2555
3117
|
readonly nextMonthButton: "wave-date-picker__next-month-button";
|
|
2556
3118
|
readonly grid: "wave-date-picker__grid";
|
|
2557
3119
|
readonly weekday: "wave-date-picker__weekday";
|
|
3120
|
+
readonly weekNumberHeader: "wave-date-picker__week-number-header";
|
|
3121
|
+
readonly weekNumber: "wave-date-picker__week-number";
|
|
2558
3122
|
readonly day: "wave-date-picker__day";
|
|
3123
|
+
readonly markedDot: "wave-date-picker__marked-dot";
|
|
3124
|
+
readonly month: "wave-date-picker__month";
|
|
3125
|
+
readonly year: "wave-date-picker__year";
|
|
3126
|
+
readonly footer: "wave-date-picker__footer";
|
|
3127
|
+
readonly todayButton: "wave-date-picker__today-button";
|
|
3128
|
+
readonly closeButton: "wave-date-picker__close-button";
|
|
2559
3129
|
};
|
|
2560
3130
|
|
|
2561
3131
|
/** Why typed text was not accepted (see {@link DatePickerProps.onInvalidInput}). */
|
|
2562
3132
|
export declare type DatePickerInvalidReason = 'unparseable' | 'out-of-range' | 'disabled';
|
|
2563
3133
|
|
|
2564
3134
|
/**
|
|
2565
|
-
* The DatePicker's built-in button names and error texts, for localization
|
|
3135
|
+
* The DatePicker's built-in button names and error texts, for localization: its own (clear, open
|
|
3136
|
+
* calendar, the errors of typed text, Close) and those of the calendar in its dialog
|
|
3137
|
+
* ({@link CalendarLabels}: the navigation buttons, the heading button's hints, "Go to today", the
|
|
3138
|
+
* week-number column and the marked days; its `required` hint does not apply). Each member is
|
|
2566
3139
|
* optional and falls back to its English default. Month and weekday names and the day labels
|
|
2567
3140
|
* follow `locale`.
|
|
2568
3141
|
*/
|
|
2569
|
-
export declare interface DatePickerLabels {
|
|
3142
|
+
export declare interface DatePickerLabels extends CalendarLabels {
|
|
2570
3143
|
/** Name of the clear button.
|
|
2571
3144
|
* @default 'Clear date'
|
|
2572
3145
|
*/
|
|
@@ -2575,14 +3148,10 @@ export declare interface DatePickerLabels {
|
|
|
2575
3148
|
* @default 'Open calendar'
|
|
2576
3149
|
*/
|
|
2577
3150
|
openCalendar?: string;
|
|
2578
|
-
/** Name of the calendar
|
|
2579
|
-
* @default '
|
|
2580
|
-
*/
|
|
2581
|
-
previousMonth?: string;
|
|
2582
|
-
/** Name of the calendar's next-month button.
|
|
2583
|
-
* @default 'Next month'
|
|
3151
|
+
/** Name of the footer button that closes the calendar (`showCloseButton`).
|
|
3152
|
+
* @default 'Close'
|
|
2584
3153
|
*/
|
|
2585
|
-
|
|
3154
|
+
close?: string;
|
|
2586
3155
|
/**
|
|
2587
3156
|
* Error text for typed text that is not a date. `pattern` is the default format of `locale`
|
|
2588
3157
|
* written with English field letters (`'MM/DD/YYYY'`, `'DD.MM.YYYY'`), or `undefined` with a
|
|
@@ -2657,6 +3226,18 @@ export declare interface DatePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
2657
3226
|
* @default false
|
|
2658
3227
|
*/
|
|
2659
3228
|
disabled?: boolean;
|
|
3229
|
+
/**
|
|
3230
|
+
* Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the
|
|
3231
|
+
* surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`. The
|
|
3232
|
+
* calendar keeps its size.
|
|
3233
|
+
*/
|
|
3234
|
+
size?: CoreSize;
|
|
3235
|
+
/**
|
|
3236
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
3237
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
3238
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
3239
|
+
*/
|
|
3240
|
+
appearance?: InputAppearance;
|
|
2660
3241
|
/**
|
|
2661
3242
|
* Makes the input read-only: the calendar does not open and the value cannot change. Turning it
|
|
2662
3243
|
* (or `disabled`) on while the user is typing drops the typed text.
|
|
@@ -2673,7 +3254,63 @@ export declare interface DatePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
2673
3254
|
* First day of the week (0 = Sunday, 1 = Monday, etc.).
|
|
2674
3255
|
* @default 0
|
|
2675
3256
|
*/
|
|
2676
|
-
firstDayOfWeek?:
|
|
3257
|
+
firstDayOfWeek?: DayOfWeek;
|
|
3258
|
+
/**
|
|
3259
|
+
* The day marked as today in the calendar (`aria-current="date"`) and the start of its keys when
|
|
3260
|
+
* no day is selected. See `Calendar`'s `today`.
|
|
3261
|
+
* @default the current date
|
|
3262
|
+
*/
|
|
3263
|
+
today?: Date;
|
|
3264
|
+
/**
|
|
3265
|
+
* The month the calendar shows first when there is no value, clamped into `minDate`/`maxDate`.
|
|
3266
|
+
* @default today's month
|
|
3267
|
+
*/
|
|
3268
|
+
initialVisibleDate?: Date;
|
|
3269
|
+
/**
|
|
3270
|
+
* Turns the calendar's month text into a button that shows the month view, whose heading, the
|
|
3271
|
+
* year, is a button to the year view. Escape steps back from the year view to the month view
|
|
3272
|
+
* and from there to the days; it closes the calendar only from the day view.
|
|
3273
|
+
* @default true
|
|
3274
|
+
*/
|
|
3275
|
+
showMonthPicker?: boolean;
|
|
3276
|
+
/**
|
|
3277
|
+
* Adds a leading column of week numbers to the calendar.
|
|
3278
|
+
* @default false
|
|
3279
|
+
*/
|
|
3280
|
+
showWeekNumbers?: boolean;
|
|
3281
|
+
/**
|
|
3282
|
+
* Which week is week 1 of a year. ISO 8601 is `'first-four-day-week'` with `firstDayOfWeek={1}`.
|
|
3283
|
+
* @default 'first-day'
|
|
3284
|
+
*/
|
|
3285
|
+
firstWeekOfYear?: FirstWeekOfYear;
|
|
3286
|
+
/**
|
|
3287
|
+
* Adds a "Go to today" button to the calendar's footer: it shows today's month and focuses
|
|
3288
|
+
* today without selecting it, and is disabled while today is outside `minDate`/`maxDate`.
|
|
3289
|
+
* @default false
|
|
3290
|
+
*/
|
|
3291
|
+
showGoToToday?: boolean;
|
|
3292
|
+
/**
|
|
3293
|
+
* Adds a Close button to the calendar's footer; it closes the calendar as Escape does from the
|
|
3294
|
+
* day view (focus returns to the toggle, or to the input after Alt+ArrowDown).
|
|
3295
|
+
* @default false
|
|
3296
|
+
*/
|
|
3297
|
+
showCloseButton?: boolean;
|
|
3298
|
+
/**
|
|
3299
|
+
* Days that draw a dot and say "marked" in their name in the calendar (`labels.markedDay`).
|
|
3300
|
+
* Called with local-midnight dates.
|
|
3301
|
+
*/
|
|
3302
|
+
markedDates?: (date: Date) => boolean;
|
|
3303
|
+
/**
|
|
3304
|
+
* Replaces the content inside a calendar day's button; `defaultContent` is the day number. The
|
|
3305
|
+
* content must be non-interactive, and the button's name does not follow it: set the name with
|
|
3306
|
+
* `dayLabel`.
|
|
3307
|
+
*/
|
|
3308
|
+
renderDay?: (date: Date, defaultContent: React_2.ReactNode) => React_2.ReactNode;
|
|
3309
|
+
/**
|
|
3310
|
+
* The accessible name of a calendar day, from its default name (the date in words, with
|
|
3311
|
+
* `labels.markedDay` applied for a marked day).
|
|
3312
|
+
*/
|
|
3313
|
+
dayLabel?: (date: Date, defaultLabel: string) => string;
|
|
2677
3314
|
/**
|
|
2678
3315
|
* Controlled open state of the calendar. The calendar renders only in the browser: an open
|
|
2679
3316
|
* picker is closed in the server HTML and opens once it has hydrated.
|
|
@@ -2726,6 +3363,9 @@ export declare interface DatePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
2726
3363
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
2727
3364
|
}
|
|
2728
3365
|
|
|
3366
|
+
/** A day of the week, as `Date.prototype.getDay()` numbers them: 0 is Sunday, 6 is Saturday. */
|
|
3367
|
+
export declare type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3368
|
+
|
|
2729
3369
|
/**
|
|
2730
3370
|
* A modal dialog (Fluent UI v2 style): `Dialog` holds the open state; `Dialog.Trigger` opens it and
|
|
2731
3371
|
* `Dialog.Content` renders the surface in a portal while open.
|
|
@@ -3032,6 +3672,9 @@ export declare interface DialogTriggerRenderProps extends React_2.HTMLAttributes
|
|
|
3032
3672
|
ref: React_2.RefCallback<HTMLElement>;
|
|
3033
3673
|
}
|
|
3034
3674
|
|
|
3675
|
+
/** Why a popup layer is dismissed: Escape, a press outside it, or focus moving outside it. */
|
|
3676
|
+
export declare type DismissReason = 'escape' | 'outside-press' | 'focus-outside';
|
|
3677
|
+
|
|
3035
3678
|
/**
|
|
3036
3679
|
* A line that separates content, horizontally or vertically, optionally with a label in the middle.
|
|
3037
3680
|
*
|
|
@@ -3342,8 +3985,18 @@ export declare interface DrawerTriggerRenderProps extends React_2.HTMLAttributes
|
|
|
3342
3985
|
* A select-only combobox (APG): a button that opens a listbox of `Option`s. Enter, Space,
|
|
3343
3986
|
* ArrowDown/ArrowUp, Home/End and typing a character open it and move the highlight
|
|
3344
3987
|
* (`aria-activedescendant`); Enter/Space select, Tab selects the highlighted option and moves on,
|
|
3345
|
-
* Escape closes.
|
|
3346
|
-
*
|
|
3988
|
+
* Escape closes. The button's chevron (see `expandIcon`) turns while the list is open, and
|
|
3989
|
+
* `renderValue` replaces its content while a value is selected. `clearable` adds a clear button,
|
|
3990
|
+
* a tab stop after the combobox button; both sit in a wrapper `<div>` inside the root.
|
|
3991
|
+
*
|
|
3992
|
+
* `multiselect` turns the value into an array (Fluent's `selectedOptions`): options draw a
|
|
3993
|
+
* checkbox; Enter and Space toggle the highlighted option, a click toggles the clicked option, and
|
|
3994
|
+
* the list stays open (Tab, Escape and Alt+ArrowUp close without committing); the button shows the
|
|
3995
|
+
* selected labels in selection order (`labels.selection`, replacing the placeholder while any are
|
|
3996
|
+
* selected, values without an option left out) and every toggle the user makes is announced
|
|
3997
|
+
* (`labels.added`/`labels.removed`, never for a controlled change, a clear or a form reset).
|
|
3998
|
+
* `clearable` then clears every value. A non-literal `multiselect={flag}` is a type error: render
|
|
3999
|
+
* two elements, one for each mode.
|
|
3347
4000
|
*
|
|
3348
4001
|
* The `<button>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,
|
|
3349
4002
|
* `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`
|
|
@@ -3351,19 +4004,20 @@ export declare interface DrawerTriggerRenderProps extends React_2.HTMLAttributes
|
|
|
3351
4004
|
* attributes and the remaining props stay on the root `<div>`. Inside a `Field` the button is
|
|
3352
4005
|
* labelled and described by it — otherwise give it an `aria-label`. It shows the error look
|
|
3353
4006
|
* whenever it ends up `aria-invalid` (its own `aria-invalid` or a `Field` error). With
|
|
3354
|
-
* `name`/`required` the value takes part in form submission
|
|
3355
|
-
*
|
|
4007
|
+
* `name`/`required` the value takes part in form submission (one hidden input per value with
|
|
4008
|
+
* `multiselect`), validation and reset (a `multiselect` reset is compared by content, so restoring
|
|
4009
|
+
* the same values reports nothing). The open listbox renders in a portal; while closed it stays
|
|
4010
|
+
* in the DOM, hidden.
|
|
4011
|
+
*
|
|
4012
|
+
* **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
4013
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own prop,
|
|
4014
|
+
* then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and
|
|
4015
|
+
* `data-appearance` on the root `<div>`. The listbox keeps its size.
|
|
3356
4016
|
*
|
|
3357
4017
|
* Sub-components: `Dropdown.Option`, `Dropdown.OptionGroup`. React Server Components import the
|
|
3358
4018
|
* flat names `DropdownOption` / `DropdownOptionGroup` (dotted access needs a client file).
|
|
3359
4019
|
*/
|
|
3360
|
-
export declare const Dropdown:
|
|
3361
|
-
(props: DropdownProps): React_2.JSX.Element;
|
|
3362
|
-
displayName: string;
|
|
3363
|
-
} & {
|
|
3364
|
-
Option: React_2.NamedExoticComponent<OptionProps>;
|
|
3365
|
-
OptionGroup: React_2.FC<OptionGroupProps>;
|
|
3366
|
-
};
|
|
4020
|
+
export declare const Dropdown: DropdownComponent;
|
|
3367
4021
|
|
|
3368
4022
|
/**
|
|
3369
4023
|
* Dropdown: `root` on the outer element; `button` on the `role="combobox"` button; `value` on the
|
|
@@ -3380,6 +4034,17 @@ export declare const dropdownClassNames: {
|
|
|
3380
4034
|
readonly surface: "wave-dropdown__surface";
|
|
3381
4035
|
};
|
|
3382
4036
|
|
|
4037
|
+
/** The Dropdown component's type: a multi-select signature, then the single-select one. */
|
|
4038
|
+
export declare interface DropdownComponent {
|
|
4039
|
+
(props: DropdownProps<true> & {
|
|
4040
|
+
multiselect: true;
|
|
4041
|
+
}): React_2.ReactNode;
|
|
4042
|
+
(props: DropdownProps): React_2.ReactNode;
|
|
4043
|
+
displayName?: string;
|
|
4044
|
+
Option: typeof Option_2;
|
|
4045
|
+
OptionGroup: typeof OptionGroup;
|
|
4046
|
+
}
|
|
4047
|
+
|
|
3383
4048
|
/**
|
|
3384
4049
|
* The Dropdown's built-in texts, for localization. Each member is optional and falls back to its
|
|
3385
4050
|
* English default.
|
|
@@ -3389,6 +4054,24 @@ export declare interface DropdownLabels {
|
|
|
3389
4054
|
* @default 'Clear selection'
|
|
3390
4055
|
*/
|
|
3391
4056
|
clear?: string;
|
|
4057
|
+
/**
|
|
4058
|
+
* The text of the selected labels shown in the combobox with `multiselect`, in selection order;
|
|
4059
|
+
* values without an option are left out. Replaces the button's joined value text.
|
|
4060
|
+
* @default (labels) => labels.join(', ')
|
|
4061
|
+
*/
|
|
4062
|
+
selection?: (labels: string[]) => string;
|
|
4063
|
+
/**
|
|
4064
|
+
* Announced when a `multiselect` toggle selects an option; `count` is the number of values
|
|
4065
|
+
* selected after the change.
|
|
4066
|
+
* @default (label, count) => `${label} added, ${count} selected`
|
|
4067
|
+
*/
|
|
4068
|
+
added?: (label: string, count: number) => string;
|
|
4069
|
+
/**
|
|
4070
|
+
* Announced when a `multiselect` toggle deselects an option; `count` is the number of values
|
|
4071
|
+
* selected after the change.
|
|
4072
|
+
* @default (label, count) => `${label} removed, ${count} selected`
|
|
4073
|
+
*/
|
|
4074
|
+
removed?: (label: string, count: number) => string;
|
|
3392
4075
|
}
|
|
3393
4076
|
|
|
3394
4077
|
/** Flat name of `Dropdown.Option` for React Server Components. */
|
|
@@ -3398,18 +4081,33 @@ export declare const DropdownOption: React_2.NamedExoticComponent<OptionProps>;
|
|
|
3398
4081
|
export declare const DropdownOptionGroup: React_2.FC<OptionGroupProps>;
|
|
3399
4082
|
|
|
3400
4083
|
/** Properties for the Dropdown component. */
|
|
3401
|
-
export declare interface DropdownProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | RoutedHandlers> {
|
|
3402
|
-
/**
|
|
3403
|
-
|
|
4084
|
+
export declare interface DropdownProps<M extends boolean = false> extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | RoutedHandlers> {
|
|
4085
|
+
/**
|
|
4086
|
+
* Several options can be selected (Fluent's `multiselect`): the value is an array, options show
|
|
4087
|
+
* a checkbox, Enter and Space toggle the highlighted option, a click toggles the clicked
|
|
4088
|
+
* option, the list stays open, and each toggle is announced. A non-literal `multiselect={flag}`
|
|
4089
|
+
* is a type error: render two elements, one for each mode.
|
|
4090
|
+
* @default false
|
|
4091
|
+
*/
|
|
4092
|
+
multiselect?: M;
|
|
4093
|
+
/**
|
|
4094
|
+
* Controlled selected value (`''` for none), or with `multiselect` the selected values (Fluent's
|
|
4095
|
+
* `selectedOptions`).
|
|
4096
|
+
*/
|
|
4097
|
+
value?: M extends true ? readonly string[] : string;
|
|
3404
4098
|
/**
|
|
3405
4099
|
* Initial selected value for uncontrolled usage.
|
|
3406
|
-
* @default ''
|
|
4100
|
+
* @default '' (`[]` with `multiselect`)
|
|
3407
4101
|
*/
|
|
3408
|
-
defaultValue?: string;
|
|
3409
|
-
/**
|
|
3410
|
-
|
|
4102
|
+
defaultValue?: M extends true ? readonly string[] : string;
|
|
4103
|
+
/**
|
|
4104
|
+
* Called with the new value when it changes (a new array with `multiselect`; Fluent's
|
|
4105
|
+
* `onOptionSelect`, under WaveUI's value/onValueChange naming).
|
|
4106
|
+
*/
|
|
4107
|
+
onValueChange?: M extends true ? (value: string[]) => void : (value: string) => void;
|
|
3411
4108
|
/**
|
|
3412
|
-
* Called on every option activation, also when the current option is selected again
|
|
4109
|
+
* Called on every option activation, also when the current option is selected again (every
|
|
4110
|
+
* toggle with `multiselect`).
|
|
3413
4111
|
* @deprecated Use `onValueChange`.
|
|
3414
4112
|
*/
|
|
3415
4113
|
onOptionSelect?: (value: string) => void;
|
|
@@ -3427,19 +4125,58 @@ export declare interface DropdownProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
3427
4125
|
defaultOpen?: boolean;
|
|
3428
4126
|
/** Called when the listbox opens or closes. */
|
|
3429
4127
|
onOpenChange?: (open: boolean) => void;
|
|
4128
|
+
/**
|
|
4129
|
+
* Called after the active (highlighted) option changes — opening, arrow keys, typeahead, the
|
|
4130
|
+
* pointer — and with `null` when the list closes. It reports what `aria-activedescendant` points
|
|
4131
|
+
* at, from an effect once the change commits. Fluent's `onActiveOptionChange` reports neither the
|
|
4132
|
+
* pointer (its options have no hover highlight) nor the close.
|
|
4133
|
+
*/
|
|
4134
|
+
onActiveOptionChange?: (value: string | null) => void;
|
|
4135
|
+
/**
|
|
4136
|
+
* Keeps disabled options in the arrow-key, Home/End, PageUp/PageDown and typeahead order (the
|
|
4137
|
+
* highlighted-by-default option may then be a disabled one too); they still cannot be selected
|
|
4138
|
+
* (Enter, Space and a click do nothing and the list stays open), and in single-select mode,
|
|
4139
|
+
* reaching one with Tab or Alt+ArrowUp closes the list without selecting it. Unlike Fluent,
|
|
4140
|
+
* which always keeps disabled options reachable, WaveUI skips them by default.
|
|
4141
|
+
* @default false
|
|
4142
|
+
*/
|
|
4143
|
+
disabledOptionsFocusable?: boolean;
|
|
3430
4144
|
/**
|
|
3431
4145
|
* Placeholder text shown when no value is selected. It is not an accessible name: label the
|
|
3432
4146
|
* Dropdown with a `Field`, `aria-label` or `aria-labelledby`.
|
|
3433
4147
|
* @default 'Select an option'
|
|
3434
4148
|
*/
|
|
3435
4149
|
placeholder?: string;
|
|
4150
|
+
/**
|
|
4151
|
+
* Renders the button's content while a value is selected (the placeholder shows otherwise), in
|
|
4152
|
+
* place of the selected label (`labels.selection` with `multiselect`). It receives the raw
|
|
4153
|
+
* value(s), never a label; the content must be non-interactive, and its text is the combobox's
|
|
4154
|
+
* value, so image-only content leaves the value empty.
|
|
4155
|
+
* @default the selected label (`labels.selection` with `multiselect`)
|
|
4156
|
+
*/
|
|
4157
|
+
renderValue?: M extends true ? (value: string[]) => React_2.ReactNode : (value: string) => React_2.ReactNode;
|
|
3436
4158
|
/**
|
|
3437
4159
|
* Whether the dropdown is disabled and non-interactive. Turning it on while the listbox is open
|
|
3438
4160
|
* closes it (`onOpenChange(false)`).
|
|
3439
4161
|
* @default false
|
|
3440
4162
|
*/
|
|
3441
4163
|
disabled?: boolean;
|
|
3442
|
-
/**
|
|
4164
|
+
/**
|
|
4165
|
+
* Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the
|
|
4166
|
+
* surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`. The
|
|
4167
|
+
* listbox keeps its size; the multi-select value text and clear button follow it.
|
|
4168
|
+
*/
|
|
4169
|
+
size?: CoreSize;
|
|
4170
|
+
/**
|
|
4171
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
4172
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
4173
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
4174
|
+
*/
|
|
4175
|
+
appearance?: InputAppearance;
|
|
4176
|
+
/**
|
|
4177
|
+
* Name of the value in form submissions (renders a hidden input; one per value with
|
|
4178
|
+
* `multiselect`).
|
|
4179
|
+
*/
|
|
3443
4180
|
name?: string;
|
|
3444
4181
|
/** Id of the form the value belongs to, when the Dropdown is outside it. */
|
|
3445
4182
|
form?: string;
|
|
@@ -3447,11 +4184,23 @@ export declare interface DropdownProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
3447
4184
|
required?: boolean;
|
|
3448
4185
|
/**
|
|
3449
4186
|
* Shows a clear button while a value is selected (shown disabled while `disabled`). It clears
|
|
3450
|
-
* the value, closes the list and moves focus to the combobox
|
|
4187
|
+
* the value (every value with `multiselect`), closes the list and moves focus to the combobox
|
|
4188
|
+
* button. It is a tab stop after it.
|
|
3451
4189
|
* @default false
|
|
3452
4190
|
*/
|
|
3453
4191
|
clearable?: boolean;
|
|
3454
|
-
/**
|
|
4192
|
+
/**
|
|
4193
|
+
* The glyph at the end of the button (default: a chevron). `null` or `undefined` keep it;
|
|
4194
|
+
* `false`, or a value that renders nothing, hides it (the button's end padding follows,
|
|
4195
|
+
* together with `clearable`). The default chevron's size and the glyph's offset follow
|
|
4196
|
+
* `size`. Decorative content rendered inside the button: a `<button>` or `Button` passed
|
|
4197
|
+
* here is not nested (its children become the glyph, with a development warning).
|
|
4198
|
+
*/
|
|
4199
|
+
expandIcon?: Slot<'span'>;
|
|
4200
|
+
/**
|
|
4201
|
+
* The clear button's name and, with `multiselect`, the selected-labels text and the toggle
|
|
4202
|
+
* announcements, for localization. Unset members keep their English defaults.
|
|
4203
|
+
*/
|
|
3455
4204
|
labels?: DropdownLabels;
|
|
3456
4205
|
/** Called when the `<button role="combobox">` receives focus (the root keeps other handlers). */
|
|
3457
4206
|
onFocus?: React_2.FocusEventHandler<HTMLButtonElement>;
|
|
@@ -3470,6 +4219,60 @@ export declare interface DropdownProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
3470
4219
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
3471
4220
|
}
|
|
3472
4221
|
|
|
4222
|
+
/**
|
|
4223
|
+
* An "add" button inside a `SwatchPicker` (for example to open a color dialog): it has no value
|
|
4224
|
+
* and is never selected. In the row layout it is a plain button with its own tab stop, outside
|
|
4225
|
+
* the radio group's arrow order, and arrow keys pressed on it do nothing. In the grid layout it
|
|
4226
|
+
* is a cell like the others, in the arrow order (without `aria-selected`). Outside a
|
|
4227
|
+
* `SwatchPicker` it throws in development and renders inertly in production.
|
|
4228
|
+
*
|
|
4229
|
+
* @example
|
|
4230
|
+
* <SwatchPicker aria-label="Accent color" items={items}>
|
|
4231
|
+
* <EmptySwatch onClick={openColorDialog} />
|
|
4232
|
+
* </SwatchPicker>
|
|
4233
|
+
*/
|
|
4234
|
+
export declare const EmptySwatch: {
|
|
4235
|
+
({ icon, size: sizeProp, shape: shapeProp, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...rest }: EmptySwatchProps): React_2.JSX.Element;
|
|
4236
|
+
displayName: string;
|
|
4237
|
+
};
|
|
4238
|
+
|
|
4239
|
+
/**
|
|
4240
|
+
* EmptySwatch (carries SwatchPicker's `swatch`): `root` on the `<button>`; `icon` on the span of
|
|
4241
|
+
* its glyph (the plus, or your `icon`).
|
|
4242
|
+
*/
|
|
4243
|
+
export declare const emptySwatchClassNames: {
|
|
4244
|
+
readonly root: "wave-empty-swatch";
|
|
4245
|
+
readonly icon: "wave-empty-swatch__icon";
|
|
4246
|
+
};
|
|
4247
|
+
|
|
4248
|
+
/** Properties for the EmptySwatch component. */
|
|
4249
|
+
export declare interface EmptySwatchProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4250
|
+
/**
|
|
4251
|
+
* Accessible name of the button.
|
|
4252
|
+
* @default 'Add color'
|
|
4253
|
+
*/
|
|
4254
|
+
'aria-label'?: string;
|
|
4255
|
+
/**
|
|
4256
|
+
* Decorative glyph (`aria-hidden`). `null` and `undefined` keep the plus glyph; `false` or
|
|
4257
|
+
* anything that renders nothing shows none. A `<button>` or `Button` passed here is not nested:
|
|
4258
|
+
* its children become the glyph and a one-time development warning is logged.
|
|
4259
|
+
* @default a plus glyph
|
|
4260
|
+
*/
|
|
4261
|
+
icon?: Slot<'span'>;
|
|
4262
|
+
/**
|
|
4263
|
+
* Size of the swatch (20, 24, 32 or 40px).
|
|
4264
|
+
* @default the picker's
|
|
4265
|
+
*/
|
|
4266
|
+
size?: SwatchPickerSize;
|
|
4267
|
+
/**
|
|
4268
|
+
* Shape of the swatch.
|
|
4269
|
+
* @default the picker's
|
|
4270
|
+
*/
|
|
4271
|
+
shape?: Shape;
|
|
4272
|
+
/** Ref to the button. */
|
|
4273
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
4274
|
+
}
|
|
4275
|
+
|
|
3473
4276
|
/**
|
|
3474
4277
|
* Lays out a form control with a label, a validation message, a hint and a required indicator,
|
|
3475
4278
|
* and wires them to the control.
|
|
@@ -3483,6 +4286,17 @@ export declare interface DropdownProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
3483
4286
|
* - `orientation="horizontal"` puts the label in a start column beside the control, with the
|
|
3484
4287
|
* message and the hint below the control. The label lines up with the first line of the
|
|
3485
4288
|
* control (a Checkbox, Switch or RadioGroup gets 6px of padding above and below for it).
|
|
4289
|
+
* - `size` sets the label's type ramp and, in the horizontal layout, its top padding and the
|
|
4290
|
+
* padding that lines a Checkbox, Switch or RadioGroup row up with it, so the label's first
|
|
4291
|
+
* line keeps lining up with a 24, 32 or 40px control. The message and the hint stay small.
|
|
4292
|
+
* Controls inside read the prop from `FieldContext` as their own default `size` (their own
|
|
4293
|
+
* `size` wins); the Field's own label falls back to `WaveProvider inputDefaults.size`, else
|
|
4294
|
+
* `medium`, and the root always renders that resolved value as `data-size`.
|
|
4295
|
+
* - `label` also takes a `Label` or `InfoLabel` element, which renders in place of Field's own
|
|
4296
|
+
* `<label>` with the Field's wiring (see `label`); an InfoLabel's info button sits next to the
|
|
4297
|
+
* label text, outside the `<label>`, so the control is named by the text alone. A group control
|
|
4298
|
+
* (RadioGroup, your own `<div role="radiogroup">`) is named through `aria-labelledby` pointing
|
|
4299
|
+
* at that `<label>`.
|
|
3486
4300
|
* - Provides `FieldContext`: the library's inputs (Input, Select, Textarea, Slider, SearchBox,
|
|
3487
4301
|
* Checkbox, Switch, RadioGroup, Rating, SpinButton, pickers, …) read it wherever they are inside
|
|
3488
4302
|
* the Field and are named by the label, described by the message and the hint and marked
|
|
@@ -3543,6 +4357,13 @@ export declare interface DropdownProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
3543
4357
|
* </Field>
|
|
3544
4358
|
*
|
|
3545
4359
|
* @example
|
|
4360
|
+
* // An InfoLabel as the label: the input is named "Password", the info button
|
|
4361
|
+
* // "Password Information".
|
|
4362
|
+
* <Field label={<InfoLabel info="Use 12 characters or more.">Password</InfoLabel>} required>
|
|
4363
|
+
* <Input type="password" />
|
|
4364
|
+
* </Field>
|
|
4365
|
+
*
|
|
4366
|
+
* @example
|
|
3546
4367
|
* // A wrapper component goes inside a plain element.
|
|
3547
4368
|
* <Field label="Name" required>
|
|
3548
4369
|
* <div>
|
|
@@ -3553,7 +4374,7 @@ export declare interface DropdownProps extends Omit<React_2.HTMLAttributes<HTMLD
|
|
|
3553
4374
|
* </Field>
|
|
3554
4375
|
*/
|
|
3555
4376
|
export declare const Field: {
|
|
3556
|
-
({ label, hint, error, validationState, validationMessage, validationMessageIcon, orientation, required, htmlFor, className, children, ref, ...rest }: FieldProps): React_2.JSX.Element;
|
|
4377
|
+
({ label, hint, error, validationState, validationMessage, validationMessageIcon, orientation, size, required, htmlFor, className, children, ref, ...rest }: FieldProps): React_2.JSX.Element;
|
|
3557
4378
|
displayName: string;
|
|
3558
4379
|
};
|
|
3559
4380
|
|
|
@@ -3621,6 +4442,12 @@ export declare interface FieldContextValue {
|
|
|
3621
4442
|
* `errorId` is set only while that message is an error.
|
|
3622
4443
|
*/
|
|
3623
4444
|
validationMessageId?: string;
|
|
4445
|
+
/**
|
|
4446
|
+
* The Field's own `size` prop, when set: the default size of the text inputs and pickers inside
|
|
4447
|
+
* it (their own `size` wins). Absent when the Field has no `size` (the controls then fall back to
|
|
4448
|
+
* `WaveProvider inputDefaults`) and in contexts built before 0.9.
|
|
4449
|
+
*/
|
|
4450
|
+
size?: CoreSize;
|
|
3624
4451
|
}
|
|
3625
4452
|
|
|
3626
4453
|
/**
|
|
@@ -3683,6 +4510,18 @@ export declare interface FieldProps extends React_2.HTMLAttributes<HTMLDivElemen
|
|
|
3683
4510
|
/**
|
|
3684
4511
|
* Label displayed above the control (beside it with `orientation="horizontal"`); names the
|
|
3685
4512
|
* control.
|
|
4513
|
+
*
|
|
4514
|
+
* A `Label` or `InfoLabel` element passed as `label` renders in place of Field's own `<label>`,
|
|
4515
|
+
* never inside it, and names the control by its label text alone (an InfoLabel's info button
|
|
4516
|
+
* sits next to the `<label>`, outside it). Field always points it at the control (`htmlFor`),
|
|
4517
|
+
* and gives it the Field's label id, `required`, label `size` and `weight="semibold"` (the look
|
|
4518
|
+
* of Field's own label), each only where the element leaves it unset; Field's layout classes go
|
|
4519
|
+
* before the element's `className`, so the element's classes win. The element's own `htmlFor`
|
|
4520
|
+
* is read like the Field's `htmlFor` (which wins over it): it becomes the control's id when the
|
|
4521
|
+
* control has none, and one that points at another element is replaced, with a development
|
|
4522
|
+
* warning. Field shows no asterisk of its own next to such an element: the element shows its
|
|
4523
|
+
* `required` indicator. Only the element itself is recognized, not one inside a Fragment, an
|
|
4524
|
+
* array or another element.
|
|
3686
4525
|
*/
|
|
3687
4526
|
label?: React_2.ReactNode;
|
|
3688
4527
|
/** Hint shown below the control, after any validation message; describes the control. */
|
|
@@ -3725,6 +4564,12 @@ export declare interface FieldProps extends React_2.HTMLAttributes<HTMLDivElemen
|
|
|
3725
4564
|
* @default 'vertical'
|
|
3726
4565
|
*/
|
|
3727
4566
|
orientation?: Orientation;
|
|
4567
|
+
/**
|
|
4568
|
+
* The label's size and the default `size` of the text inputs and pickers inside the Field
|
|
4569
|
+
* (their own `size` wins; choice controls keep theirs). The message and the hint stay small.
|
|
4570
|
+
* @default `WaveProvider` `inputDefaults.size`, else `'medium'`.
|
|
4571
|
+
*/
|
|
4572
|
+
size?: CoreSize;
|
|
3728
4573
|
/**
|
|
3729
4574
|
* Whether the field is required: shows a decorative asterisk next to the label, sets
|
|
3730
4575
|
* `aria-required`, and turns on native constraint validation. `<input>`, `<select>`,
|
|
@@ -3737,13 +4582,21 @@ export declare interface FieldProps extends React_2.HTMLAttributes<HTMLDivElemen
|
|
|
3737
4582
|
required?: boolean;
|
|
3738
4583
|
/**
|
|
3739
4584
|
* The id of the control the label points at, when the control has no `id` of its own
|
|
3740
|
-
* (default: a
|
|
4585
|
+
* (default: the `htmlFor` of a `Label` or `InfoLabel` element passed as `label`, else a
|
|
4586
|
+
* generated id).
|
|
3741
4587
|
*/
|
|
3742
4588
|
htmlFor?: string;
|
|
3743
4589
|
/** Ref to the root `<div>`. */
|
|
3744
4590
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
3745
4591
|
}
|
|
3746
4592
|
|
|
4593
|
+
/**
|
|
4594
|
+
* Which week is week 1 of a year: the week of January 1 (`'first-day'`), the first week that lies
|
|
4595
|
+
* wholly in the year (`'first-full-week'`), or the first week with at least four days in the year
|
|
4596
|
+
* (`'first-four-day-week'`, ISO 8601 when weeks start on Monday).
|
|
4597
|
+
*/
|
|
4598
|
+
export declare type FirstWeekOfYear = 'first-day' | 'first-full-week' | 'first-four-day-week';
|
|
4599
|
+
|
|
3747
4600
|
/**
|
|
3748
4601
|
* A flexbox layout container with token-based gaps.
|
|
3749
4602
|
*
|
|
@@ -3816,6 +4669,30 @@ export declare type FlexProps<C extends React_2.ElementType = 'div'> = Polymorph
|
|
|
3816
4669
|
*/
|
|
3817
4670
|
export declare function getThemeClassName(theme: WaveTheme): string;
|
|
3818
4671
|
|
|
4672
|
+
/**
|
|
4673
|
+
* The week number (1–53) of `date`'s calendar day (time of day ignored): days before a year's week
|
|
4674
|
+
* 1 belong to the previous year's last week, and days in the next year's week 1 are week 1. ISO 8601
|
|
4675
|
+
* is `{ firstDayOfWeek: 1, firstWeekOfYear: 'first-four-day-week' }`.
|
|
4676
|
+
*
|
|
4677
|
+
* @param options Defaults to Sunday weeks, week 1 being the week of January 1.
|
|
4678
|
+
* @default `{ firstDayOfWeek: 0, firstWeekOfYear: 'first-day' }`
|
|
4679
|
+
*/
|
|
4680
|
+
export declare function getWeekNumber(date: Date, options?: GetWeekNumberOptions): number;
|
|
4681
|
+
|
|
4682
|
+
/** Options of {@link getWeekNumber}. */
|
|
4683
|
+
export declare interface GetWeekNumberOptions {
|
|
4684
|
+
/**
|
|
4685
|
+
* The weekday weeks start on (0 is Sunday).
|
|
4686
|
+
* @default 0
|
|
4687
|
+
*/
|
|
4688
|
+
firstDayOfWeek?: DayOfWeek;
|
|
4689
|
+
/**
|
|
4690
|
+
* Which week is week 1 of a year.
|
|
4691
|
+
* @default 'first-day'
|
|
4692
|
+
*/
|
|
4693
|
+
firstWeekOfYear?: FirstWeekOfYear;
|
|
4694
|
+
}
|
|
4695
|
+
|
|
3819
4696
|
/**
|
|
3820
4697
|
* A CSS grid layout with a fixed column count and token gaps.
|
|
3821
4698
|
*
|
|
@@ -3973,50 +4850,215 @@ export declare interface ImageProps extends React_2.ImgHTMLAttributes<HTMLImageE
|
|
|
3973
4850
|
export declare type ImageShape = Shape;
|
|
3974
4851
|
|
|
3975
4852
|
/**
|
|
3976
|
-
*
|
|
4853
|
+
* One image swatch of a `SwatchPicker`: a pattern or texture drawn as a covering background
|
|
4854
|
+
* image. Outside a `SwatchPicker` it throws in development and renders inertly in production.
|
|
4855
|
+
*
|
|
4856
|
+
* **Naming**: give it `aria-label`, or wrap it in a `Tooltip` with `relationship="label"`.
|
|
4857
|
+
* Without either it is named by its `value` and a development warning is logged.
|
|
4858
|
+
*
|
|
4859
|
+
* **Selected and disabled**: an image has no single luminance, so the check and the disabled slash
|
|
4860
|
+
* are the theme's foreground glyph over a background halo. Unlike `ColorSwatch` it does not opt
|
|
4861
|
+
* out of forced colors (a background image stays).
|
|
4862
|
+
*
|
|
4863
|
+
* @example
|
|
4864
|
+
* <SwatchPicker aria-label="Pattern">
|
|
4865
|
+
* <ImageSwatch value="dots" src="/dots.png" aria-label="Dots" />
|
|
4866
|
+
* </SwatchPicker>
|
|
4867
|
+
*/
|
|
4868
|
+
export declare const ImageSwatch: {
|
|
4869
|
+
({ src, ...rest }: ImageSwatchProps): React_2.JSX.Element;
|
|
4870
|
+
displayName: string;
|
|
4871
|
+
};
|
|
4872
|
+
|
|
4873
|
+
/** ImageSwatch (carries SwatchPicker's `swatch`): `root` on the swatch `<button>`. */
|
|
4874
|
+
export declare const imageSwatchClassNames: {
|
|
4875
|
+
readonly root: "wave-image-swatch";
|
|
4876
|
+
};
|
|
4877
|
+
|
|
4878
|
+
/** Properties for the ImageSwatch component. */
|
|
4879
|
+
export declare interface ImageSwatchProps extends Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
4880
|
+
/** Unique identifier for the swatch (the value the picker selects and a form submits). */
|
|
4881
|
+
value: string;
|
|
4882
|
+
/** URL of the image (drawn as a covering background image). */
|
|
4883
|
+
src: string;
|
|
4884
|
+
/**
|
|
4885
|
+
* Size of the swatch (20, 24, 32 or 40px).
|
|
4886
|
+
* @default the picker's
|
|
4887
|
+
*/
|
|
4888
|
+
size?: SwatchPickerSize;
|
|
4889
|
+
/**
|
|
4890
|
+
* Shape of the swatch.
|
|
4891
|
+
* @default the picker's
|
|
4892
|
+
*/
|
|
4893
|
+
shape?: Shape;
|
|
4894
|
+
/**
|
|
4895
|
+
* Ref to the swatch button: `role="radio"` in the row layout, inside its cell in the grid
|
|
4896
|
+
* layout, a toggle button in tab mode.
|
|
4897
|
+
*/
|
|
4898
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4901
|
+
/**
|
|
4902
|
+
* A button with the info glyph that shows `info` in a note next to it: text, links or other rich
|
|
4903
|
+
* content, placed above the button with a beak (a toggletip).
|
|
4904
|
+
*
|
|
4905
|
+
* - **Naming.** The button is named "Information" (`aria-label`, which localizes it). Next to a
|
|
4906
|
+
* heading or other text, pass `aria-labelledby` with that text's id and the button's own `id`:
|
|
4907
|
+
* the button is then named "‹text› Information", so several info buttons on a page are told
|
|
4908
|
+
* apart. The note (`role="note"`) is labelled like the button: by the same `aria-labelledby`
|
|
4909
|
+
* ids, else by the button. The button has `aria-expanded`, and `aria-controls` while the note is
|
|
4910
|
+
* open, but no `aria-haspopup`: a note is none of the popup kinds it names.
|
|
4911
|
+
* - **Opening.** A click pins the note open, and a click on a pinned note closes it. With
|
|
4912
|
+
* `openOnHover` (the default) a mouse pointer resting on the button opens it after 250 ms, and
|
|
4913
|
+
* it closes 250 ms after the pointer has left the button and the note (a pointer moving
|
|
4914
|
+
* diagonally from the button into the note keeps it open; touch and pen never hover); keyboard
|
|
4915
|
+
* focus on the button opens it too, while focus that comes from a pointer press waits for the
|
|
4916
|
+
* click. A hover close moves no focus, and a note that keyboard focus opened or keeps never
|
|
4917
|
+
* closes because of pointer movement. Opening never moves focus. Escape, a press outside and
|
|
4918
|
+
* focus moving outside the button and the note close it; Escape returns focus to the button when
|
|
4919
|
+
* it was in the note, and a dismissed note opens again on keyboard focus only once focus has
|
|
4920
|
+
* left both.
|
|
4921
|
+
* - **Tab path.** The note is portaled, but it keeps its place right after the button in the
|
|
4922
|
+
* keyboard order: Tab from the open button enters the note's first element (a link in it), Tab
|
|
4923
|
+
* past its last element continues after the button, and Shift+Tab from its first element
|
|
4924
|
+
* returns to the button.
|
|
4925
|
+
* - **One copy of `info`.** While the note is closed, `info` renders next to the button in an
|
|
4926
|
+
* element that is not displayed and describes the button (`aria-describedby`), so it is in the
|
|
4927
|
+
* server HTML and is read when the button takes focus. While the note is shown, `info` renders
|
|
4928
|
+
* only inside it, in an unnamed element that describes the button. `info` is never in the
|
|
4929
|
+
* document twice, so content with ids or effects is safe; it remounts each time the note opens
|
|
4930
|
+
* and closes, so state inside it starts over and its effects run again.
|
|
4931
|
+
* - **Structure.** The button is the root element: `ref`, `className`, `style` and every other
|
|
4932
|
+
* attribute go to it, the consumer's handlers first. The description and the note render next
|
|
4933
|
+
* to it, never inside it. Its box is 24×24px at every `size` and renders `data-size`. The note
|
|
4934
|
+
* mounts through the presence core: it carries `data-presence`, `data-state` (`open`, and
|
|
4935
|
+
* `closed` while it exits, `inert`) and the `data-wave-infolabel-surface` marker; it ships no
|
|
4936
|
+
* motion of its own.
|
|
4937
|
+
*
|
|
4938
|
+
* Fluent's InfoButton takes the same `info` and `size`. It opens on click only
|
|
4939
|
+
* (`openOnHover={false}` here), renders its note in place, and moves focus into the note; this one
|
|
4940
|
+
* keeps focus on the button and renders the note in a portal. Fluent's `popover` props and a
|
|
4941
|
+
* controlled open state are not offered.
|
|
3977
4942
|
*
|
|
3978
|
-
*
|
|
3979
|
-
*
|
|
3980
|
-
*
|
|
3981
|
-
*
|
|
3982
|
-
*
|
|
3983
|
-
*
|
|
3984
|
-
*
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
4943
|
+
* @example
|
|
4944
|
+
* <h2 id="billing">Billing</h2>
|
|
4945
|
+
* <InfoButton
|
|
4946
|
+
* id="billing-info"
|
|
4947
|
+
* aria-labelledby="billing billing-info"
|
|
4948
|
+
* info={<>Invoices are sent monthly. <a href="/help/billing">Learn more</a></>}
|
|
4949
|
+
* />
|
|
4950
|
+
*/
|
|
4951
|
+
export declare const InfoButton: {
|
|
4952
|
+
({ info, size: sizeProp, openOnHover, id: idProp, type, "aria-label": ariaLabelProp, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, className, disabled, onClick, onFocus, onBlur, onKeyDown, onPointerDown, onMouseDown, onPointerEnter, onPointerMove, onPointerLeave, ref, ...rest }: InfoButtonProps): React_2.JSX.Element;
|
|
4953
|
+
displayName: string;
|
|
4954
|
+
};
|
|
4955
|
+
|
|
4956
|
+
/**
|
|
4957
|
+
* InfoButton: `root` on the `<button>`; `info` on the `role="note"` popup that shows your `info`
|
|
4958
|
+
* (Fluent's `info` slot, the popover surface); `beak` on its arrow.
|
|
4959
|
+
*/
|
|
4960
|
+
export declare const infoButtonClassNames: {
|
|
4961
|
+
readonly root: "wave-info-button";
|
|
4962
|
+
readonly info: "wave-info-button__info";
|
|
4963
|
+
readonly beak: "wave-info-button__beak";
|
|
4964
|
+
};
|
|
4965
|
+
|
|
4966
|
+
/** Properties for the InfoButton component. */
|
|
4967
|
+
export declare interface InfoButtonProps extends Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
4968
|
+
/**
|
|
4969
|
+
* The information the note shows: text, links or other content. It also describes the button
|
|
4970
|
+
* (`aria-describedby`), from the server HTML on. It is rendered once: next to the button, not
|
|
4971
|
+
* displayed, while the note is closed, and inside the note while it is shown.
|
|
4972
|
+
*/
|
|
4973
|
+
info: React_2.ReactNode;
|
|
4974
|
+
/**
|
|
4975
|
+
* Size of the glyph: 12, 16 or 20px. The button box stays 24×24px at every size, with negative
|
|
4976
|
+
* margins above and below, so it never makes a row that centres its items (as InfoLabel does)
|
|
4977
|
+
* taller.
|
|
4978
|
+
* @default 'medium'
|
|
4979
|
+
*/
|
|
4980
|
+
size?: CoreSize;
|
|
4981
|
+
/**
|
|
4982
|
+
* Open the note when a mouse pointer rests on the button (after 250 ms; it closes 250 ms after
|
|
4983
|
+
* the pointer has left the button and the note, touch and pen never hover), and when the button
|
|
4984
|
+
* receives keyboard focus. `false` opens it only on a click, and so on Enter and Space (Fluent's
|
|
4985
|
+
* InfoButton opens on click only). A click always toggles the note: it pins a note that hover or
|
|
4986
|
+
* keyboard focus opened, and closes a pinned one.
|
|
4987
|
+
* @default true
|
|
4988
|
+
*/
|
|
4989
|
+
openOnHover?: boolean;
|
|
4990
|
+
/**
|
|
4991
|
+
* Accessible name of the button, and of the note, which is labelled like the button. Localize it
|
|
4992
|
+
* here. With `aria-labelledby` listing the id of your text and the button's own `id`, the name is
|
|
4993
|
+
* your text followed by this one ("Billing Information").
|
|
4994
|
+
* @default 'Information'
|
|
4995
|
+
*/
|
|
4996
|
+
'aria-label'?: string;
|
|
4997
|
+
/** Ref to the button. */
|
|
4998
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
4999
|
+
}
|
|
5000
|
+
|
|
5001
|
+
/**
|
|
5002
|
+
* A label followed by a button that reveals more information about it (Fluent's InfoLabel): the
|
|
5003
|
+
* label renders in a real `<label htmlFor>`, and the button shows `info` — text, links or other
|
|
5004
|
+
* rich content — in a note next to it, rendered once whether the note is open or closed (see
|
|
5005
|
+
* `InfoButton`, which owns that note and its opening, closing and Tab order).
|
|
5006
|
+
*
|
|
5007
|
+
* - `children` is the label content; `label` is a deprecated alias (a warning fires once, and
|
|
5008
|
+
* `children` wins when both are given).
|
|
5009
|
+
* - `htmlFor`, `required`, `size`, `weight` and `disabled` route to the `<label>`; `disabled` dims
|
|
5010
|
+
* only the label text, and the info button stays usable.
|
|
5011
|
+
* - The button is named "‹label text› ‹infoButtonLabel›" through `aria-labelledby`, which points
|
|
5012
|
+
* at the `<label>` and at the button's own id (whose `aria-label` supplies the second half), so
|
|
5013
|
+
* several InfoLabels on a page are told apart; `infoButtonLabel` localizes that second half.
|
|
5014
|
+
* `openOnHover` and `size` reach the button too.
|
|
5015
|
+
* - No `controlRef`: InfoLabel is a label, not a form control, so C-ROUTING's composite-control
|
|
5016
|
+
* routing does not apply to it; a layout that needs the button's own element renders `InfoButton`
|
|
5017
|
+
* next to a `Label` instead.
|
|
3989
5018
|
*
|
|
3990
5019
|
* @example
|
|
3991
|
-
* <InfoLabel
|
|
5020
|
+
* <InfoLabel info="Use at least 8 characters.">Password</InfoLabel>
|
|
3992
5021
|
*/
|
|
3993
5022
|
export declare const InfoLabel: {
|
|
3994
|
-
({ label, info, infoButtonLabel, className, ref, ...
|
|
5023
|
+
({ children, label, info, infoButtonLabel, openOnHover, id, htmlFor, required, size, weight, disabled, className, ref, ...rest }: InfoLabelProps): React_2.JSX.Element;
|
|
3995
5024
|
displayName: string;
|
|
3996
5025
|
};
|
|
3997
5026
|
|
|
3998
|
-
/**
|
|
5027
|
+
/**
|
|
5028
|
+
* InfoLabel: `root` on the outer span; `label` on its Label (which also carries Label's root);
|
|
5029
|
+
* `infoButton` on its InfoButton (which also carries InfoButton's root); `info` on the popup, the
|
|
5030
|
+
* InfoButton's note (which also carries InfoButton's `info`).
|
|
5031
|
+
*/
|
|
3999
5032
|
export declare const infoLabelClassNames: {
|
|
4000
5033
|
readonly root: "wave-info-label";
|
|
5034
|
+
readonly label: "wave-info-label__label";
|
|
4001
5035
|
readonly infoButton: "wave-info-label__info-button";
|
|
4002
5036
|
readonly info: "wave-info-label__info";
|
|
4003
5037
|
};
|
|
4004
5038
|
|
|
4005
5039
|
/** Properties for the InfoLabel component. */
|
|
4006
|
-
export declare interface InfoLabelProps extends React_2.HTMLAttributes<HTMLSpanElement> {
|
|
4007
|
-
/**
|
|
4008
|
-
|
|
5040
|
+
export declare interface InfoLabelProps extends Omit<React_2.HTMLAttributes<HTMLSpanElement>, 'children'>, Pick<LabelProps, 'htmlFor' | 'required' | 'size' | 'weight' | 'disabled'> {
|
|
5041
|
+
/** The label content (Fluent's `children`). */
|
|
5042
|
+
children?: React_2.ReactNode;
|
|
4009
5043
|
/**
|
|
4010
|
-
*
|
|
4011
|
-
*
|
|
4012
|
-
* keyboard focus or click.
|
|
5044
|
+
* The label content.
|
|
5045
|
+
* @deprecated Use `children`.
|
|
4013
5046
|
*/
|
|
4014
|
-
|
|
5047
|
+
label?: React_2.ReactNode;
|
|
5048
|
+
/** The information the info button's note shows: text, links or other rich content. */
|
|
5049
|
+
info: React_2.ReactNode;
|
|
4015
5050
|
/**
|
|
4016
|
-
* Accessible name of the info button
|
|
5051
|
+
* Accessible name of the info button: the second half of its name, after the label text
|
|
5052
|
+
* ("Password Information"). Localize it here.
|
|
4017
5053
|
* @default 'Information'
|
|
4018
5054
|
*/
|
|
4019
5055
|
infoButtonLabel?: string;
|
|
5056
|
+
/**
|
|
5057
|
+
* Opens the note on a mouse hover, after a short delay, and on keyboard focus, next to a click
|
|
5058
|
+
* (see `InfoButton`'s `openOnHover`, which this passes through unchanged).
|
|
5059
|
+
* @default true
|
|
5060
|
+
*/
|
|
5061
|
+
openOnHover?: boolean;
|
|
4020
5062
|
/** Ref to the root `<span>`. */
|
|
4021
5063
|
ref?: React_2.Ref<HTMLSpanElement>;
|
|
4022
5064
|
}
|
|
@@ -4027,6 +5069,12 @@ export declare interface InfoLabelProps extends React_2.HTMLAttributes<HTMLSpanE
|
|
|
4027
5069
|
* optional error message. Inside a `Field` it picks up the label, hint, error, `required` (native
|
|
4028
5070
|
* attribute) and invalid state automatically.
|
|
4029
5071
|
*
|
|
5072
|
+
* `size` resolves from its own prop, then the surrounding `Field`'s `size`, then
|
|
5073
|
+
* `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own prop, then
|
|
5074
|
+
* `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and
|
|
5075
|
+
* `data-appearance` on the element that draws the field (the `<input>`, or the wrapper with slot
|
|
5076
|
+
* content).
|
|
5077
|
+
*
|
|
4030
5078
|
* Every prop reaches the `<input>`, except with slot content: then a bordered `<span>` wrapper
|
|
4031
5079
|
* draws the field and receives `className`, `style` and `hidden` (`ref` stays on the input).
|
|
4032
5080
|
*
|
|
@@ -4036,10 +5084,16 @@ export declare interface InfoLabelProps extends React_2.HTMLAttributes<HTMLSpanE
|
|
|
4036
5084
|
* </Field>
|
|
4037
5085
|
*/
|
|
4038
5086
|
export declare const Input: {
|
|
4039
|
-
({ error, errorMessageProps, contentBefore, contentAfter, onChange, onValueChange, className, ref, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, required, ...props }: InputProps): React_2.JSX.Element;
|
|
5087
|
+
({ error, errorMessageProps, size: sizeProp, htmlSize, appearance: appearanceProp, contentBefore, contentAfter, onChange, onValueChange, className, ref, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, required, ...props }: InputProps): React_2.JSX.Element;
|
|
4040
5088
|
displayName: string;
|
|
4041
5089
|
};
|
|
4042
5090
|
|
|
5091
|
+
/**
|
|
5092
|
+
* Look of a text input or picker: `outline` (a full border), `underline` (a bottom stroke only),
|
|
5093
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke).
|
|
5094
|
+
*/
|
|
5095
|
+
export declare type InputAppearance = 'outline' | 'underline' | 'filled-darker' | 'filled-lighter';
|
|
5096
|
+
|
|
4043
5097
|
/**
|
|
4044
5098
|
* Input: `root` on the `<input>`, or, with `contentBefore` or `contentAfter` content, on the
|
|
4045
5099
|
* wrapper that draws the field; `input` on the `<input>` (also when it is the root);
|
|
@@ -4054,6 +5108,14 @@ export declare const inputClassNames: {
|
|
|
4054
5108
|
readonly errorMessage: "wave-input__error-message";
|
|
4055
5109
|
};
|
|
4056
5110
|
|
|
5111
|
+
/** Default size and appearance of the text inputs and pickers in a subtree. */
|
|
5112
|
+
export declare interface InputDefaults {
|
|
5113
|
+
/** Default `size` of Input, Textarea, Select, SearchBox, SpinButton and the pickers. */
|
|
5114
|
+
size?: CoreSize;
|
|
5115
|
+
/** Default `appearance` of the same controls. */
|
|
5116
|
+
appearance?: InputAppearance;
|
|
5117
|
+
}
|
|
5118
|
+
|
|
4057
5119
|
/**
|
|
4058
5120
|
* Props of the error message element that {@link Input}, `Select` and `Textarea` render after the
|
|
4059
5121
|
* control for a string `error` (`id`, `className`, `role`, data attributes, …).
|
|
@@ -4066,7 +5128,7 @@ export declare interface InputErrorMessageProps extends React_2.HTMLAttributes<H
|
|
|
4066
5128
|
}
|
|
4067
5129
|
|
|
4068
5130
|
/** Properties for the Input component. */
|
|
4069
|
-
export declare interface InputProps extends React_2.InputHTMLAttributes<HTMLInputElement> {
|
|
5131
|
+
export declare interface InputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
4070
5132
|
/**
|
|
4071
5133
|
* Validation error.
|
|
4072
5134
|
* - A non-empty string renders the message in a `role="alert"` element **after** the field (a
|
|
@@ -4084,6 +5146,24 @@ export declare interface InputProps extends React_2.InputHTMLAttributes<HTMLInpu
|
|
|
4084
5146
|
error?: string | boolean;
|
|
4085
5147
|
/** Props of the error message element (`id`, `className`, …) rendered for a string `error`. */
|
|
4086
5148
|
errorMessageProps?: InputErrorMessageProps;
|
|
5149
|
+
/**
|
|
5150
|
+
* Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the
|
|
5151
|
+
* surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`.
|
|
5152
|
+
*
|
|
5153
|
+
* A number is the native `size` attribute (the visible width in characters), as in 0.8: it
|
|
5154
|
+
* still renders, warns once in development and is removed in 1.0. Use `htmlSize` for it.
|
|
5155
|
+
* A string of digits only (`size="20"` from untyped code) counts as that number. Any other value
|
|
5156
|
+
* outside the three sizes renders as if `size` were not set.
|
|
5157
|
+
*/
|
|
5158
|
+
size?: CoreSize | number;
|
|
5159
|
+
/** The native `size` attribute: the visible width of the field in characters. */
|
|
5160
|
+
htmlSize?: number;
|
|
5161
|
+
/**
|
|
5162
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
5163
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
5164
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
5165
|
+
*/
|
|
5166
|
+
appearance?: InputAppearance;
|
|
4087
5167
|
/**
|
|
4088
5168
|
* Slot rendered before the input text (e.g., an icon). With content in either slot, a bordered
|
|
4089
5169
|
* `<span>` around the input draws the field: it receives `className`, `style` and `hidden`,
|
|
@@ -4102,9 +5182,12 @@ export declare interface InputProps extends React_2.InputHTMLAttributes<HTMLInpu
|
|
|
4102
5182
|
ref?: React_2.Ref<HTMLInputElement>;
|
|
4103
5183
|
}
|
|
4104
5184
|
|
|
5185
|
+
/** Whether both dates are on the same calendar day (time of day ignored); `false` when either is missing. */
|
|
5186
|
+
export declare function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
|
|
5187
|
+
|
|
4105
5188
|
/**
|
|
4106
5189
|
* A text label for a form control (`htmlFor`), on the Fluent type ramp. The optional required
|
|
4107
|
-
*
|
|
5190
|
+
* indicator is decorative (`aria-hidden`). `Field` renders its own label; use `Label` for custom
|
|
4108
5191
|
* layouts.
|
|
4109
5192
|
*
|
|
4110
5193
|
* @example
|
|
@@ -4131,11 +5214,12 @@ export declare type LabelPosition = 'before' | 'after' | 'above' | 'below';
|
|
|
4131
5214
|
|
|
4132
5215
|
/** Properties for the Label component. */
|
|
4133
5216
|
export declare interface LabelProps extends React_2.LabelHTMLAttributes<HTMLLabelElement> {
|
|
4134
|
-
/** Whether to show a required indicator
|
|
4135
|
-
*
|
|
5217
|
+
/** Whether to show a required indicator. `true` shows a decorative asterisk; other content
|
|
5218
|
+
* replaces it (for example a `(required)` text). Decorative (`aria-hidden`), so it must not be
|
|
5219
|
+
* focusable; mark the control itself `required`.
|
|
4136
5220
|
* @default false
|
|
4137
5221
|
*/
|
|
4138
|
-
required?: boolean;
|
|
5222
|
+
required?: boolean | React_2.ReactNode;
|
|
4139
5223
|
/** Whether the label is visually dimmed.
|
|
4140
5224
|
* @default false
|
|
4141
5225
|
*/
|
|
@@ -4143,7 +5227,7 @@ export declare interface LabelProps extends React_2.LabelHTMLAttributes<HTMLLabe
|
|
|
4143
5227
|
/** Text size of the label: `small` = caption-1, `medium` = body-1, `large` = body-2.
|
|
4144
5228
|
* @default 'medium'
|
|
4145
5229
|
*/
|
|
4146
|
-
size?:
|
|
5230
|
+
size?: CoreSize;
|
|
4147
5231
|
/** Font weight of the label (the shared `TextWeight` vocabulary).
|
|
4148
5232
|
* @default 'regular'
|
|
4149
5233
|
*/
|
|
@@ -4276,6 +5360,475 @@ export declare const List: {
|
|
|
4276
5360
|
};
|
|
4277
5361
|
};
|
|
4278
5362
|
|
|
5363
|
+
/**
|
|
5364
|
+
* A list of options that holds focus itself (APG listbox): one `<ul role="listbox">` of
|
|
5365
|
+
* `Option`s, whose `aria-activedescendant` points at the active option while the list has focus.
|
|
5366
|
+
* It is the picker option model shown in the page — typeahead, groups, disabled options and the
|
|
5367
|
+
* option look of Dropdown and Combobox. Use `List` with `selectable` (`selectionMode`) instead
|
|
5368
|
+
* when each item needs real focus, actions of its own or interactive content.
|
|
5369
|
+
*
|
|
5370
|
+
* - **Focus.** One tab stop. The active option exists only while the list has focus, and a
|
|
5371
|
+
* switch to another window keeps it: the selected option (with `multiselect`, the first
|
|
5372
|
+
* selected one in list order), else the first. While no option can be active (an empty list,
|
|
5373
|
+
* every option hidden, or every option disabled without `disabledOptionsFocusable`), and while
|
|
5374
|
+
* the active option is scrolled out of the list's view, the list draws its own focus ring. A
|
|
5375
|
+
* press on an option with the primary button focuses the list and makes that option active
|
|
5376
|
+
* without scrolling, so the click selects it even while the selected option is scrolled out of
|
|
5377
|
+
* view; a right or middle press is left to the browser. `autoFocus` focuses the list when it
|
|
5378
|
+
* mounts.
|
|
5379
|
+
* - **Keys.** ArrowDown and ArrowUp move without wrapping, Home and End go to the first and last
|
|
5380
|
+
* option, PageUp and PageDown move ten options, and typing moves to the matching option
|
|
5381
|
+
* (typeahead). Space and Enter select the active option: the selection does not follow the
|
|
5382
|
+
* active option. Tab, Escape and Alt+Arrow keys are left to the page, so an enclosing Dialog
|
|
5383
|
+
* closes on Escape.
|
|
5384
|
+
* - **Selection.** `value`, `defaultValue` and `onValueChange` are Fluent's `selectedOptions`,
|
|
5385
|
+
* `defaultSelectedOptions` and `onOptionSelect` under WaveUI's value naming. A single-select
|
|
5386
|
+
* Listbox keeps the selected option when it is selected again (no deselection). `multiselect`
|
|
5387
|
+
* turns the value into an array: options draw a checkbox, Space, Enter and a click toggle an
|
|
5388
|
+
* option, the value keeps selection order, and every toggle the user makes is announced
|
|
5389
|
+
* (`labels.added`/`labels.removed`; never a controlled change or a form reset). A non-literal
|
|
5390
|
+
* `multiselect={flag}` is a type error: render two elements, one for each mode.
|
|
5391
|
+
* - **Disabled.** `disabled` takes the list out of the tab order (a click does not focus it
|
|
5392
|
+
* either), dims it, takes pointer input off its options, selects nothing and submits nothing.
|
|
5393
|
+
* Disabled options are skipped by the keys unless `disabledOptionsFocusable`, and are never
|
|
5394
|
+
* selected.
|
|
5395
|
+
* - **Forms and Field.** With `name` the value is submitted with its form (one entry, or one per
|
|
5396
|
+
* value with `multiselect`), and `required` needs a value (native validation; a missing value
|
|
5397
|
+
* moves focus to the list). A reset of its form restores `defaultValue`, with or without a
|
|
5398
|
+
* `name` (a `multiselect` reset is compared by content, so restoring the same values reports
|
|
5399
|
+
* nothing). Inside a `Field` the list is labelled by its label, described by its message and
|
|
5400
|
+
* hint, and takes its invalid and required state; otherwise name it with `aria-label` or
|
|
5401
|
+
* `aria-labelledby` (development warns once when it has no name).
|
|
5402
|
+
* - It has no built-in height: give it one through `className` and it scrolls.
|
|
5403
|
+
*
|
|
5404
|
+
* Every prop, the `ref` and the handlers go to the `<ul>`. Sub-components: `Listbox.Option`,
|
|
5405
|
+
* `Listbox.OptionGroup`. React Server Components import the flat names `ListboxOption` /
|
|
5406
|
+
* `ListboxOptionGroup` (dotted access needs a client file).
|
|
5407
|
+
*
|
|
5408
|
+
* @example
|
|
5409
|
+
* <Listbox aria-label="Fruit" name="fruit" defaultValue="banana">
|
|
5410
|
+
* <Listbox.Option value="apple">Apple</Listbox.Option>
|
|
5411
|
+
* <Listbox.Option value="banana">Banana</Listbox.Option>
|
|
5412
|
+
* </Listbox>
|
|
5413
|
+
*/
|
|
5414
|
+
export declare const Listbox: ListboxComponent;
|
|
5415
|
+
|
|
5416
|
+
/** Listbox: `root` on the `role="listbox"` list (its options carry Option's classes). */
|
|
5417
|
+
export declare const listboxClassNames: {
|
|
5418
|
+
readonly root: "wave-listbox";
|
|
5419
|
+
};
|
|
5420
|
+
|
|
5421
|
+
/** Props for the combobox element (spread them; see {@link UseListboxResult.getComboboxProps}). */
|
|
5422
|
+
export declare interface ListboxComboboxProps {
|
|
5423
|
+
role: 'combobox';
|
|
5424
|
+
/** {@link UseListboxOptions.open}. */
|
|
5425
|
+
'aria-expanded': boolean;
|
|
5426
|
+
/** The listbox's id ({@link UseListboxResult.listboxId}). */
|
|
5427
|
+
'aria-controls': string;
|
|
5428
|
+
/** The active option's id, while the listbox is open and an option is active. */
|
|
5429
|
+
'aria-activedescendant'?: string;
|
|
5430
|
+
'aria-haspopup': 'listbox';
|
|
5431
|
+
/** Editable mode: typing filters the options. */
|
|
5432
|
+
'aria-autocomplete'?: 'list';
|
|
5433
|
+
}
|
|
5434
|
+
|
|
5435
|
+
/** The Listbox component's type: a multi-select signature, then the single-select one. */
|
|
5436
|
+
export declare interface ListboxComponent {
|
|
5437
|
+
(props: ListboxProps<true> & {
|
|
5438
|
+
multiselect: true;
|
|
5439
|
+
}): React_2.ReactNode;
|
|
5440
|
+
(props: ListboxProps): React_2.ReactNode;
|
|
5441
|
+
displayName?: string;
|
|
5442
|
+
Option: typeof Option_2;
|
|
5443
|
+
OptionGroup: typeof OptionGroup;
|
|
5444
|
+
}
|
|
5445
|
+
|
|
5446
|
+
/**
|
|
5447
|
+
* The context a listbox provides to its options (`useListbox(...).context`; pass it to
|
|
5448
|
+
* `ListboxProvider` for a list rendered without `ListboxSurface`).
|
|
5449
|
+
*/
|
|
5450
|
+
export declare interface ListboxContextValue {
|
|
5451
|
+
/** The listbox element's id, which the option ids start with. */
|
|
5452
|
+
listboxId: string;
|
|
5453
|
+
/** The per-option state and the registration of the options. */
|
|
5454
|
+
store: ListboxStore;
|
|
5455
|
+
/** Whether the listbox is {@link UseListboxOptions.multiselect}. */
|
|
5456
|
+
multiselect: boolean;
|
|
5457
|
+
/** The listbox's {@link UseListboxOptions.mode}: standalone options add the pointer press. */
|
|
5458
|
+
mode: 'editable' | 'select-only' | 'standalone';
|
|
5459
|
+
/**
|
|
5460
|
+
* Commits `value` (an option click): `item` stands for the option while it has not registered
|
|
5461
|
+
* yet, and `event` is the click behind the commit. A disabled option is never committed.
|
|
5462
|
+
*/
|
|
5463
|
+
select(value: string, item: ListboxItem, event: Event): void;
|
|
5464
|
+
/** Highlights `value` (pointer movement); not scrolled into view, so the list stays put. */
|
|
5465
|
+
highlight(value: string): void;
|
|
5466
|
+
/**
|
|
5467
|
+
* Standalone mode: a pointer press on option `value` (its `mousedown`, whose default the option
|
|
5468
|
+
* prevents). Focuses the list without scrolling and makes the option active without scrolling
|
|
5469
|
+
* it into view, in one update, so the click that follows commits the pressed option even when
|
|
5470
|
+
* focus would have scrolled another option into view. A press on an option that cannot be
|
|
5471
|
+
* active (a disabled one, unless {@link UseListboxOptions.disabledOptionsFocusable}) keeps a
|
|
5472
|
+
* focused list's active option, and an unfocused list starts on its `autoHighlight` option,
|
|
5473
|
+
* not scrolled into view either. Development warns once when the list element is unknown
|
|
5474
|
+
* (the `ref` of {@link UseListboxResult.getListboxProps} was not passed on).
|
|
5475
|
+
*/
|
|
5476
|
+
press(value: string): void;
|
|
5477
|
+
}
|
|
5478
|
+
|
|
5479
|
+
/**
|
|
5480
|
+
* What {@link collectOptionLabels} does with the elements of a component marked by
|
|
5481
|
+
* {@link markListboxElement}: `'option'` reads a value and its label, `'group'` walks the children.
|
|
5482
|
+
*/
|
|
5483
|
+
export declare type ListboxElementKind = 'option' | 'group';
|
|
5484
|
+
|
|
5485
|
+
/**
|
|
5486
|
+
* One option of a listbox: an entry of {@link UseListboxOptions.items} (data mode), or what an
|
|
5487
|
+
* option registers (registration mode, {@link useListboxOption}).
|
|
5488
|
+
*/
|
|
5489
|
+
export declare interface ListboxItem {
|
|
5490
|
+
/** Unique value within the listbox. */
|
|
5491
|
+
value: string;
|
|
5492
|
+
/** Display label (Combobox input text, Dropdown trigger text). */
|
|
5493
|
+
label: string;
|
|
5494
|
+
/** Text matched by typeahead and filters instead of `label`. */
|
|
5495
|
+
textValue?: string;
|
|
5496
|
+
/**
|
|
5497
|
+
* Disabled options are rendered but skipped by navigation, unless
|
|
5498
|
+
* {@link UseListboxOptions.disabledOptionsFocusable}, and never committed.
|
|
5499
|
+
* @default false
|
|
5500
|
+
*/
|
|
5501
|
+
disabled?: boolean;
|
|
5502
|
+
/**
|
|
5503
|
+
* Hidden options are left out of navigation and rendering like filtered-out ones: never
|
|
5504
|
+
* highlighted, reached by typeahead or committed with the keyboard (registered options render
|
|
5505
|
+
* `hidden`). Their label stays known ({@link UseListboxResult.getItem}). In data mode (`items`)
|
|
5506
|
+
* it is the item's own flag; a registered option is hidden by its own `hidden` attribute or by a
|
|
5507
|
+
* hidden group around it.
|
|
5508
|
+
* @default false
|
|
5509
|
+
*/
|
|
5510
|
+
hidden?: boolean;
|
|
5511
|
+
}
|
|
5512
|
+
|
|
5513
|
+
/**
|
|
5514
|
+
* The Listbox's built-in texts, for localization: the announcements of a `multiselect` toggle.
|
|
5515
|
+
* Each member is optional and falls back to its English default.
|
|
5516
|
+
*/
|
|
5517
|
+
export declare interface ListboxLabels {
|
|
5518
|
+
/**
|
|
5519
|
+
* Announced when a `multiselect` toggle selects an option; `count` is the number of values
|
|
5520
|
+
* selected after the change.
|
|
5521
|
+
* @default (label, count) => `${label} added, ${count} selected`
|
|
5522
|
+
*/
|
|
5523
|
+
added?: (label: string, count: number) => string;
|
|
5524
|
+
/**
|
|
5525
|
+
* Announced when a `multiselect` toggle deselects an option; `count` is the number of values
|
|
5526
|
+
* selected after the change.
|
|
5527
|
+
* @default (label, count) => `${label} removed, ${count} selected`
|
|
5528
|
+
*/
|
|
5529
|
+
removed?: (label: string, count: number) => string;
|
|
5530
|
+
}
|
|
5531
|
+
|
|
5532
|
+
/** Props for the listbox element (see {@link UseListboxResult.getListboxProps}). */
|
|
5533
|
+
export declare interface ListboxListProps {
|
|
5534
|
+
/** {@link UseListboxResult.listboxId}. */
|
|
5535
|
+
id: string;
|
|
5536
|
+
role: 'listbox';
|
|
5537
|
+
/** With {@link UseListboxOptions.multiselect}. */
|
|
5538
|
+
'aria-multiselectable'?: true;
|
|
5539
|
+
/** `-1` in the combobox modes (focus stays on the combobox); `0` in standalone mode. */
|
|
5540
|
+
tabIndex: 0 | -1;
|
|
5541
|
+
/** The combobox modes: keeps focus on the combobox while options are clicked. */
|
|
5542
|
+
onMouseDown?(event: React_2.MouseEvent): void;
|
|
5543
|
+
/** Standalone mode: the active option's id while the list has focus and an option is active. */
|
|
5544
|
+
'aria-activedescendant'?: string;
|
|
5545
|
+
/**
|
|
5546
|
+
* Standalone mode: the list element, which a pointer press on an option focuses. Merge it with
|
|
5547
|
+
* your own ref (a press warns in development when it was dropped).
|
|
5548
|
+
*/
|
|
5549
|
+
ref?: React_2.RefCallback<HTMLElement>;
|
|
5550
|
+
}
|
|
5551
|
+
|
|
5552
|
+
/**
|
|
5553
|
+
* Why {@link UseListboxOptions.onOpenChange} was called: `'keyboard'` (a key opens the listbox, or
|
|
5554
|
+
* closes it without a commit), `'select'` (a commit closes it), `'escape'` or `'tab'` (Tab closes
|
|
5555
|
+
* it, after committing the active option in single-select select-only mode).
|
|
5556
|
+
*/
|
|
5557
|
+
export declare type ListboxOpenChangeReason = 'keyboard' | 'select' | 'escape' | 'tab';
|
|
5558
|
+
|
|
5559
|
+
/** Flat name of `Listbox.Option` for React Server Components. */
|
|
5560
|
+
export declare const ListboxOption: React_2.NamedExoticComponent<OptionProps>;
|
|
5561
|
+
|
|
5562
|
+
/**
|
|
5563
|
+
* Props for an option element (spread them onto the `<li>`; compose `onClick`, and `onMouseDown`
|
|
5564
|
+
* in standalone mode, with yours).
|
|
5565
|
+
*/
|
|
5566
|
+
export declare interface ListboxOptionElementProps<E extends HTMLElement = HTMLElement> {
|
|
5567
|
+
/**
|
|
5568
|
+
* The option's stable id ({@link UseListboxResult.getOptionId}), which `aria-activedescendant`
|
|
5569
|
+
* points at while the option is active.
|
|
5570
|
+
*/
|
|
5571
|
+
id: string;
|
|
5572
|
+
role: 'option';
|
|
5573
|
+
'aria-selected': boolean;
|
|
5574
|
+
/** While disabled. */
|
|
5575
|
+
'aria-disabled'?: true;
|
|
5576
|
+
/** While filtered out or hidden. */
|
|
5577
|
+
hidden?: boolean;
|
|
5578
|
+
/** While the option is active, for styling. */
|
|
5579
|
+
'data-active'?: '';
|
|
5580
|
+
/** While selected, for styling. */
|
|
5581
|
+
'data-selected'?: '';
|
|
5582
|
+
/** While disabled, for styling. */
|
|
5583
|
+
'data-disabled'?: '';
|
|
5584
|
+
/** Commits the option (a disabled one does nothing). */
|
|
5585
|
+
onClick(event: React_2.MouseEvent<E>): void;
|
|
5586
|
+
/** Makes the option under the pointer active (not a disabled one), without scrolling the list. */
|
|
5587
|
+
onPointerMove(event: React_2.PointerEvent<E>): void;
|
|
5588
|
+
/** Standalone mode only: the pointer press ({@link ListboxContextValue.press}). */
|
|
5589
|
+
onMouseDown?(event: React_2.MouseEvent<E>): void;
|
|
5590
|
+
/** Registers the element; it also sets the `ref` passed to {@link useListboxOption}. */
|
|
5591
|
+
ref: React_2.RefCallback<E>;
|
|
5592
|
+
}
|
|
5593
|
+
|
|
5594
|
+
/** Flat name of `Listbox.OptionGroup` for React Server Components. */
|
|
5595
|
+
export declare const ListboxOptionGroup: React_2.FC<OptionGroupProps>;
|
|
5596
|
+
|
|
5597
|
+
/** Properties for the Listbox component. */
|
|
5598
|
+
export declare interface ListboxProps<M extends boolean = false> extends Omit<React_2.HTMLAttributes<HTMLUListElement>, 'onChange' | 'defaultValue'> {
|
|
5599
|
+
/**
|
|
5600
|
+
* Several options can be selected (Fluent's `multiselect`; List's `selectionMode="multiple"` is
|
|
5601
|
+
* the other widget): the value is an array, options draw a checkbox, Space, Enter and a click
|
|
5602
|
+
* toggle an option, and each toggle is announced. A non-literal `multiselect={flag}` is a type
|
|
5603
|
+
* error: render two elements, one for each mode.
|
|
5604
|
+
* @default false
|
|
5605
|
+
*/
|
|
5606
|
+
multiselect?: M;
|
|
5607
|
+
/**
|
|
5608
|
+
* Controlled selected value (`''` for none), or with `multiselect` the selected values in
|
|
5609
|
+
* selection order (Fluent's `selectedOptions`).
|
|
5610
|
+
*/
|
|
5611
|
+
value?: M extends true ? readonly string[] : string;
|
|
5612
|
+
/**
|
|
5613
|
+
* Initial selected value for uncontrolled usage, which a form reset restores.
|
|
5614
|
+
* @default '' (`[]` with `multiselect`)
|
|
5615
|
+
*/
|
|
5616
|
+
defaultValue?: M extends true ? readonly string[] : string;
|
|
5617
|
+
/**
|
|
5618
|
+
* Called with the new value when it changes (a new array with `multiselect`; Fluent's
|
|
5619
|
+
* `onOptionSelect`, under WaveUI's value/onValueChange naming). In single-select mode, selecting
|
|
5620
|
+
* the selected option again changes nothing: the Listbox never deselects it.
|
|
5621
|
+
*/
|
|
5622
|
+
onValueChange?: M extends true ? (value: string[]) => void : (value: string) => void;
|
|
5623
|
+
/**
|
|
5624
|
+
* Called after the active (highlighted) option changes — focus, arrow keys, typeahead, the
|
|
5625
|
+
* pointer — and with `null` when focus leaves the list (a switch to another window keeps the
|
|
5626
|
+
* active option). It reports what `aria-activedescendant` points at, from an effect once the
|
|
5627
|
+
* change commits. Fluent's `onActiveOptionChange` reports neither the pointer (its options have
|
|
5628
|
+
* no hover highlight) nor the loss of focus.
|
|
5629
|
+
*/
|
|
5630
|
+
onActiveOptionChange?: (value: string | null) => void;
|
|
5631
|
+
/**
|
|
5632
|
+
* Takes the list out of the tab order (a click does not focus it either, as a disabled native
|
|
5633
|
+
* `<select>`) and dims it: its options take no pointer input, nothing can be selected, and
|
|
5634
|
+
* nothing is submitted or validated. Renders `aria-disabled` and `data-disabled`. An
|
|
5635
|
+
* `aria-disabled` of your own without `disabled` is passed through as it is: the list stays
|
|
5636
|
+
* interactive.
|
|
5637
|
+
* @default false
|
|
5638
|
+
*/
|
|
5639
|
+
disabled?: boolean;
|
|
5640
|
+
/**
|
|
5641
|
+
* Focuses the list when it mounts in the browser (React focuses only form controls itself), not
|
|
5642
|
+
* while `disabled`. Server-rendered HTML carries the `autofocus` attribute for the browser's own
|
|
5643
|
+
* autofocus, so a hydrating list takes no focus, as React leaves a hydrated form control alone.
|
|
5644
|
+
* @default false
|
|
5645
|
+
*/
|
|
5646
|
+
autoFocus?: boolean;
|
|
5647
|
+
/**
|
|
5648
|
+
* Keeps disabled options in the arrow-key, Home/End, PageUp/PageDown and typeahead order (the
|
|
5649
|
+
* option that is active on focus may then be a disabled one too); they still cannot be
|
|
5650
|
+
* selected (Space, Enter and a click do nothing). Unlike Fluent, which always keeps disabled
|
|
5651
|
+
* options reachable, WaveUI skips them by default.
|
|
5652
|
+
* @default false
|
|
5653
|
+
*/
|
|
5654
|
+
disabledOptionsFocusable?: boolean;
|
|
5655
|
+
/** The `multiselect` toggle announcements, for localization. Unset members keep their English defaults. */
|
|
5656
|
+
labels?: ListboxLabels;
|
|
5657
|
+
/**
|
|
5658
|
+
* Name of the value in form submissions (renders a hidden input inside the list; one per value
|
|
5659
|
+
* with `multiselect`).
|
|
5660
|
+
*/
|
|
5661
|
+
name?: string;
|
|
5662
|
+
/** Id of the form the value belongs to, when the Listbox is outside it. */
|
|
5663
|
+
form?: string;
|
|
5664
|
+
/**
|
|
5665
|
+
* A value is required to submit the form (native constraint validation); when validation finds
|
|
5666
|
+
* it empty, focus moves to the list.
|
|
5667
|
+
*/
|
|
5668
|
+
required?: boolean;
|
|
5669
|
+
/**
|
|
5670
|
+
* Called on a key press on the list, before the built-in keys; `event.preventDefault()` skips
|
|
5671
|
+
* them.
|
|
5672
|
+
*/
|
|
5673
|
+
onKeyDown?: React_2.KeyboardEventHandler<HTMLUListElement>;
|
|
5674
|
+
/** Ref to the `<ul role="listbox">`. */
|
|
5675
|
+
ref?: React_2.Ref<HTMLUListElement>;
|
|
5676
|
+
}
|
|
5677
|
+
|
|
5678
|
+
/**
|
|
5679
|
+
* Provides a listbox's context to its options, for a custom picker that renders its list without
|
|
5680
|
+
* `ListboxSurface`: `<ListboxProvider value={listbox.context}><ul {...listbox.getListboxProps()}>…</ul></ListboxProvider>`.
|
|
5681
|
+
*/
|
|
5682
|
+
export declare function ListboxProvider({ value, children }: ListboxProviderProps): React_2.JSX.Element;
|
|
5683
|
+
|
|
5684
|
+
export declare namespace ListboxProvider {
|
|
5685
|
+
var displayName: string;
|
|
5686
|
+
}
|
|
5687
|
+
|
|
5688
|
+
/** Props of {@link ListboxProvider}. */
|
|
5689
|
+
export declare interface ListboxProviderProps {
|
|
5690
|
+
/** The context of a listbox: `useListbox(...).context`. */
|
|
5691
|
+
value: ListboxContextValue;
|
|
5692
|
+
/** The options (`Option`, `OptionGroup` or options of your own on `useListboxOption`). */
|
|
5693
|
+
children?: React_2.ReactNode;
|
|
5694
|
+
}
|
|
5695
|
+
|
|
5696
|
+
/**
|
|
5697
|
+
* Second argument of {@link UseListboxOptions.onSelect}: the committed option and the event behind
|
|
5698
|
+
* the commit.
|
|
5699
|
+
*/
|
|
5700
|
+
export declare interface ListboxSelectDetails {
|
|
5701
|
+
/** The committed option. */
|
|
5702
|
+
item: ListboxItem;
|
|
5703
|
+
/** The key or click event behind the commit. */
|
|
5704
|
+
event: Event;
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5707
|
+
/**
|
|
5708
|
+
* The per-option state of a listbox ({@link ListboxContextValue.store}) and the contract of option
|
|
5709
|
+
* components: {@link useListboxOption} is built on it, and so can an option component of your own
|
|
5710
|
+
* be. `register` adds an option, `getIndex` gives its stable id, and the flags say how to draw it:
|
|
5711
|
+
* subscribe with `useSyncExternalStore` and read one value (`() => store.isActive(value)`), so only
|
|
5712
|
+
* the options whose answer changed re-render.
|
|
5713
|
+
*/
|
|
5714
|
+
export declare interface ListboxStore {
|
|
5715
|
+
/** Calls `listener` after a flag of any option changed. Returns the unsubscribe function. */
|
|
5716
|
+
subscribe(listener: () => void): () => void;
|
|
5717
|
+
/** Whether `value` is the active option, the one `aria-activedescendant` points at. */
|
|
5718
|
+
isActive(value: string): boolean;
|
|
5719
|
+
/** Whether `value` is selected. */
|
|
5720
|
+
isSelected(value: string): boolean;
|
|
5721
|
+
/** Whether `value` is filtered out or hidden: render its option `hidden`. */
|
|
5722
|
+
isHidden(value: string): boolean;
|
|
5723
|
+
/**
|
|
5724
|
+
* The stable per-listbox index of `value`, assigned the first time the value is seen: the
|
|
5725
|
+
* option's id is `${listboxId}-opt-${getIndex(value)}` ({@link UseListboxResult.getOptionId}),
|
|
5726
|
+
* the same across filtering and remounts.
|
|
5727
|
+
*/
|
|
5728
|
+
getIndex(value: string): number;
|
|
5729
|
+
/**
|
|
5730
|
+
* Registers an option and its element (registration mode): call it from a layout effect, as
|
|
5731
|
+
* {@link useListboxOption} does, and call the returned function to unregister, when the option
|
|
5732
|
+
* unmounts or before it registers a changed item. The options are ordered by their elements'
|
|
5733
|
+
* DOM position. The registrations of a commit are published once from the listbox's layout
|
|
5734
|
+
* effect (later ones once per microtask).
|
|
5735
|
+
*/
|
|
5736
|
+
register(item: ListboxItem, element: React_2.RefObject<HTMLElement | null>): () => void;
|
|
5737
|
+
}
|
|
5738
|
+
|
|
5739
|
+
/**
|
|
5740
|
+
* The option list of a custom picker and the popup it opens in: a `<ul role="listbox">` with the
|
|
5741
|
+
* options (spread from `listbox.getListboxProps()`), rendered `hidden` in place inside your
|
|
5742
|
+
* picker while the list is not shown, so the options register and their ids exist from the first
|
|
5743
|
+
* render, and in a portaled surface placed by {@link useListboxPopup} while it is, never in both.
|
|
5744
|
+
* While the listbox is open with nothing to show, the surface shows `emptyContent` instead, if
|
|
5745
|
+
* any. A press on the surface keeps focus on your combobox. It provides the listbox's context to
|
|
5746
|
+
* the options, so it needs no {@link ListboxProvider}.
|
|
5747
|
+
*
|
|
5748
|
+
* @example
|
|
5749
|
+
* <ListboxSurface
|
|
5750
|
+
* listbox={listbox}
|
|
5751
|
+
* layerId={layerId}
|
|
5752
|
+
* surfaceRef={surfaceRef}
|
|
5753
|
+
* floatingProps={floatingProps}
|
|
5754
|
+
* open={open}
|
|
5755
|
+
* expanded={expanded}
|
|
5756
|
+
* aria-labelledby={labelId}
|
|
5757
|
+
* >
|
|
5758
|
+
* <Option value="georgia">Georgia</Option>
|
|
5759
|
+
* </ListboxSurface>
|
|
5760
|
+
*/
|
|
5761
|
+
export declare function ListboxSurface(props: ListboxSurfaceProps): React_2.JSX.Element;
|
|
5762
|
+
|
|
5763
|
+
export declare namespace ListboxSurface {
|
|
5764
|
+
var displayName: string;
|
|
5765
|
+
}
|
|
5766
|
+
|
|
5767
|
+
/**
|
|
5768
|
+
* ListboxSurface: `root` on the portaled popup around the list, while it shows the list or the
|
|
5769
|
+
* empty content; `list` on the `role="listbox"` list, also while it renders in place inside your
|
|
5770
|
+
* picker. In Combobox, Dropdown and TagPicker these elements also carry the picker's own
|
|
5771
|
+
* `surface` and `listbox` classes.
|
|
5772
|
+
*/
|
|
5773
|
+
export declare const listboxSurfaceClassNames: {
|
|
5774
|
+
readonly root: "wave-listbox-surface";
|
|
5775
|
+
readonly list: "wave-listbox-surface__list";
|
|
5776
|
+
};
|
|
5777
|
+
|
|
5778
|
+
/**
|
|
5779
|
+
* Props of {@link ListboxSurface}. The options of one listbox live in one list at a time, and this
|
|
5780
|
+
* surface renders that list: render every option of the listbox inside it, never in a second list
|
|
5781
|
+
* of your own, not even for an exit animation.
|
|
5782
|
+
*/
|
|
5783
|
+
export declare interface ListboxSurfaceProps {
|
|
5784
|
+
/** The listbox: the result of `useListbox` in select-only or editable mode. */
|
|
5785
|
+
listbox: UseListboxResult;
|
|
5786
|
+
/** `layerId` from {@link useListboxPopup}: the surface joins the popup's dismiss layer. */
|
|
5787
|
+
layerId: string;
|
|
5788
|
+
/** `surfaceRef` from {@link useListboxPopup}. */
|
|
5789
|
+
surfaceRef: React_2.RefCallback<HTMLElement>;
|
|
5790
|
+
/** `floatingProps` from {@link useListboxPopup}: the surface's placement. */
|
|
5791
|
+
floatingProps: UseListboxPopupResult['floatingProps'];
|
|
5792
|
+
/** The listbox is open (your open state). `emptyContent` shows only while it is. */
|
|
5793
|
+
open: boolean;
|
|
5794
|
+
/**
|
|
5795
|
+
* The list is shown: the listbox is open and has options to show (`open &&
|
|
5796
|
+
* listbox.items.length > 0`). The list then renders in the surface, and otherwise `hidden`, in
|
|
5797
|
+
* place inside your picker. Set your combobox's `aria-expanded` to this value after spreading
|
|
5798
|
+
* `getComboboxProps()`, which reports `open`, so the combobox is not announced as expanded while
|
|
5799
|
+
* nothing is shown.
|
|
5800
|
+
*/
|
|
5801
|
+
expanded: boolean;
|
|
5802
|
+
/**
|
|
5803
|
+
* Shown in the surface while the listbox is open but not expanded, such as a "No matches"
|
|
5804
|
+
* message. `undefined` and `null` show no surface; any other value shows one, so `false` and
|
|
5805
|
+
* `''` show an empty surface.
|
|
5806
|
+
*/
|
|
5807
|
+
emptyContent?: React_2.ReactNode;
|
|
5808
|
+
/** Names the list. Name it with this or `aria-labelledby`, usually your picker's label. */
|
|
5809
|
+
'aria-label'?: string;
|
|
5810
|
+
/** Ids of the elements that name the list, usually your picker's label. */
|
|
5811
|
+
'aria-labelledby'?: string;
|
|
5812
|
+
/**
|
|
5813
|
+
* Options draw a check while selected (in a multi-select list, a checkbox square). Turn it off
|
|
5814
|
+
* for a list that never shows selected options, such as the suggestions of a tag picker.
|
|
5815
|
+
* @default true
|
|
5816
|
+
*/
|
|
5817
|
+
showCheck?: boolean;
|
|
5818
|
+
/**
|
|
5819
|
+
* Classes merged last onto the list: they replace the list's own classes they conflict with,
|
|
5820
|
+
* its maximum height included.
|
|
5821
|
+
*/
|
|
5822
|
+
listClassName?: string;
|
|
5823
|
+
/**
|
|
5824
|
+
* Classes merged last onto the surface, the popup around the list: they replace its own
|
|
5825
|
+
* classes they conflict with.
|
|
5826
|
+
*/
|
|
5827
|
+
surfaceClassName?: string;
|
|
5828
|
+
/** The options (`Option`, `OptionGroup` or options of your own on `useListboxOption`). */
|
|
5829
|
+
children?: React_2.ReactNode;
|
|
5830
|
+
}
|
|
5831
|
+
|
|
4279
5832
|
/** List: `root` on the `<ul>` (the `role="grid"` element of a selectable list with actions). */
|
|
4280
5833
|
export declare const listClassNames: {
|
|
4281
5834
|
readonly root: "wave-list";
|
|
@@ -4373,6 +5926,22 @@ export declare interface ListProps<M extends ListSelectionMode = ListSelectionMo
|
|
|
4373
5926
|
/** Selection modes of {@link List}: the shared `SelectionMode` plus the deprecated `'multi'`. */
|
|
4374
5927
|
export declare type ListSelectionMode = SelectionMode_2 | 'multi';
|
|
4375
5928
|
|
|
5929
|
+
/**
|
|
5930
|
+
* Marks a component so {@link collectOptionLabels} recognises its elements: `'option'` (reads its
|
|
5931
|
+
* `value` prop and its label: the `label` prop, else `textValue`, else its text children, as
|
|
5932
|
+
* `Option`'s) or `'group'` (walks its `children`). Returns the component (function, `memo` or
|
|
5933
|
+
* `forwardRef` components). Mark every option or group component of your own that is rendered in
|
|
5934
|
+
* a listbox (`Option` and `OptionGroup` are marked): unmarked components are opaque to
|
|
5935
|
+
* {@link collectOptionLabels}, so their labels are unknown on the server and in the first client
|
|
5936
|
+
* render.
|
|
5937
|
+
*
|
|
5938
|
+
* @example
|
|
5939
|
+
* // Option components of your own, built on useListboxOption:
|
|
5940
|
+
* export const ColorOption = markListboxElement(ColorOptionImpl, 'option');
|
|
5941
|
+
* export const ColorGroup = markListboxElement(ColorGroupImpl, 'group');
|
|
5942
|
+
*/
|
|
5943
|
+
export declare function markListboxElement<C extends object>(component: C, kind: ListboxElementKind): C;
|
|
5944
|
+
|
|
4376
5945
|
/**
|
|
4377
5946
|
* A menu of actions (`role="menu"`), in one of two forms:
|
|
4378
5947
|
*
|
|
@@ -5785,9 +7354,12 @@ export declare interface OpenChangeDetails<R extends string = string> {
|
|
|
5785
7354
|
}
|
|
5786
7355
|
|
|
5787
7356
|
/**
|
|
5788
|
-
* An option of a `
|
|
5789
|
-
*
|
|
5790
|
-
*
|
|
7357
|
+
* An option of a listbox: a `Listbox`, `Combobox` or `Dropdown` (and `TagPicker`'s generated
|
|
7358
|
+
* list), or a custom picker's list, rendered through `ListboxSurface` or under a
|
|
7359
|
+
* `ListboxProvider`. Renders `<li role="option">` with a stable id (`aria-activedescendant`
|
|
7360
|
+
* target), `aria-selected`, a check mark while selected (`checkIcon` replaces it; in a
|
|
7361
|
+
* multi-select list it sits in a checkbox square) and `data-active`/`data-selected`/
|
|
7362
|
+
* `data-disabled` attributes for styling.
|
|
5791
7363
|
*
|
|
5792
7364
|
* Options register with the surrounding listbox (in DOM order, groups included), so they can be
|
|
5793
7365
|
* wrapped, grouped or rendered conditionally. The option is memoized: moving the highlight
|
|
@@ -5798,31 +7370,37 @@ export declare interface OpenChangeDetails<R extends string = string> {
|
|
|
5798
7370
|
* use its data variant (`data-[active]:bg-…`, `data-[selected]:bg-…`). The active option keeps
|
|
5799
7371
|
* its focus outline.
|
|
5800
7372
|
*
|
|
5801
|
-
* Use it inside a
|
|
7373
|
+
* Use it inside a listbox only; it throws in development elsewhere.
|
|
5802
7374
|
*/
|
|
5803
7375
|
declare const Option_2: React_2.NamedExoticComponent<OptionProps>;
|
|
5804
7376
|
export { Option_2 as Option }
|
|
5805
7377
|
|
|
5806
7378
|
/**
|
|
5807
|
-
* Option (also Combobox.Option and
|
|
5808
|
-
* `
|
|
7379
|
+
* Option (also Combobox.Option, Dropdown.Option and Listbox.Option): `root` on the `role="option"`
|
|
7380
|
+
* element; `indicator` on the checkbox square of a multi-select list; `checkIcon` on the check
|
|
7381
|
+
* `<svg>`, or on the span of your `checkIcon` (inside the square in a multi-select list);
|
|
7382
|
+
* `content` on the content span.
|
|
5809
7383
|
*/
|
|
5810
7384
|
export declare const optionClassNames: {
|
|
5811
7385
|
readonly root: "wave-option";
|
|
7386
|
+
readonly indicator: "wave-option__indicator";
|
|
5812
7387
|
readonly checkIcon: "wave-option__check-icon";
|
|
5813
7388
|
readonly content: "wave-option__content";
|
|
5814
7389
|
};
|
|
5815
7390
|
|
|
5816
7391
|
/**
|
|
5817
|
-
* Groups options under
|
|
5818
|
-
* `<ul role="group"
|
|
5819
|
-
*
|
|
7392
|
+
* Groups options under an optional heading: `<li role="presentation">` with the heading and a
|
|
7393
|
+
* `<ul role="group">` of the options, named by the heading (`label`) or by your `aria-label` or
|
|
7394
|
+
* `aria-labelledby`, which win over it. Hidden while a filter (or their own `hidden`) hides all
|
|
7395
|
+
* its options, also options wrapped in a component or in nested groups. Use it inside a listbox,
|
|
7396
|
+
* as `Option`.
|
|
5820
7397
|
*/
|
|
5821
7398
|
export declare const OptionGroup: React_2.FC<OptionGroupProps>;
|
|
5822
7399
|
|
|
5823
7400
|
/**
|
|
5824
|
-
* OptionGroup (also Combobox.OptionGroup and
|
|
5825
|
-
* in the list; `label` on its heading
|
|
7401
|
+
* OptionGroup (also Combobox.OptionGroup, Dropdown.OptionGroup and Listbox.OptionGroup): `root`
|
|
7402
|
+
* on the group's entry in the list; `label` on its heading (rendered only for a `label`); `list`
|
|
7403
|
+
* on the `role="group"` list of its options.
|
|
5826
7404
|
*/
|
|
5827
7405
|
export declare const optionGroupClassNames: {
|
|
5828
7406
|
readonly root: "wave-option-group";
|
|
@@ -5830,10 +7408,28 @@ export declare const optionGroupClassNames: {
|
|
|
5830
7408
|
readonly list: "wave-option-group__list";
|
|
5831
7409
|
};
|
|
5832
7410
|
|
|
5833
|
-
/**
|
|
7411
|
+
/**
|
|
7412
|
+
* Props of {@link OptionGroup}. `aria-label` and `aria-labelledby` go to the group's
|
|
7413
|
+
* `role="group"` list; the other props go to its `<li role="presentation">` item.
|
|
7414
|
+
*/
|
|
5834
7415
|
export declare interface OptionGroupProps extends React_2.LiHTMLAttributes<HTMLLIElement> {
|
|
5835
|
-
/**
|
|
5836
|
-
|
|
7416
|
+
/**
|
|
7417
|
+
* The group's heading, which names the group. Keep it text (an icon next to the text is fine): a
|
|
7418
|
+
* label cannot be interactive, since nothing in it is reachable inside a listbox. Without a
|
|
7419
|
+
* label no heading renders; name the group with `aria-label` or `aria-labelledby` then. A group
|
|
7420
|
+
* without a name logs a development warning.
|
|
7421
|
+
*/
|
|
7422
|
+
label?: React_2.ReactNode;
|
|
7423
|
+
/**
|
|
7424
|
+
* Names the group's list in place of the label (the heading still shows). A prop that holds
|
|
7425
|
+
* `undefined`, as from a wrapper that forwards it, leaves the label in charge.
|
|
7426
|
+
*/
|
|
7427
|
+
'aria-label'?: string;
|
|
7428
|
+
/**
|
|
7429
|
+
* Ids of the elements that name the group's list, in place of the label (the heading still
|
|
7430
|
+
* shows). A prop that holds `undefined` leaves the label in charge.
|
|
7431
|
+
*/
|
|
7432
|
+
'aria-labelledby'?: string;
|
|
5837
7433
|
/**
|
|
5838
7434
|
* Hides the group and every option in it (see `Option`'s `hidden`): keyboard navigation and
|
|
5839
7435
|
* typeahead skip its options.
|
|
@@ -5844,7 +7440,10 @@ export declare interface OptionGroupProps extends React_2.LiHTMLAttributes<HTMLL
|
|
|
5844
7440
|
ref?: React_2.Ref<HTMLLIElement>;
|
|
5845
7441
|
}
|
|
5846
7442
|
|
|
5847
|
-
/**
|
|
7443
|
+
/**
|
|
7444
|
+
* Props of {@link Option}, an option of a listbox (Listbox, Combobox, Dropdown or a custom
|
|
7445
|
+
* picker's list).
|
|
7446
|
+
*/
|
|
5848
7447
|
export declare interface OptionProps extends Omit<React_2.LiHTMLAttributes<HTMLLIElement>, 'value'> {
|
|
5849
7448
|
/** Value associated with this option. Unique within its listbox. */
|
|
5850
7449
|
value: string;
|
|
@@ -5857,11 +7456,25 @@ export declare interface OptionProps extends Omit<React_2.LiHTMLAttributes<HTMLL
|
|
|
5857
7456
|
/** Text matched by typeahead and filtering instead of the label. */
|
|
5858
7457
|
textValue?: string;
|
|
5859
7458
|
/**
|
|
5860
|
-
* Whether the option is disabled: it stays
|
|
5861
|
-
*
|
|
7459
|
+
* Whether the option is disabled: it stays in the list but can never be selected (a click, Enter
|
|
7460
|
+
* and Space do nothing). Keyboard navigation and typeahead skip it, unless the listbox keeps
|
|
7461
|
+
* disabled options focusable (`disabledOptionsFocusable`), where they reach it. It is drawn in
|
|
7462
|
+
* the muted text colour, its check included: in a multi-select list the checkbox square takes
|
|
7463
|
+
* that colour instead of the brand colour, checked or not.
|
|
5862
7464
|
* @default false
|
|
5863
7465
|
*/
|
|
5864
7466
|
disabled?: boolean;
|
|
7467
|
+
/**
|
|
7468
|
+
* Replaces the check glyph that marks the option while it is selected (decorative,
|
|
7469
|
+
* `aria-hidden`); in a multi-select list the glyph is drawn inside the option's 16px checkbox
|
|
7470
|
+
* square. The check is a required indicator, the sign of the selection that does not rely on
|
|
7471
|
+
* colour: `null` and `undefined` keep the default glyph, and so does a value that renders
|
|
7472
|
+
* nothing (`false`, `''`, an empty array), which also logs a development warning. Unlike
|
|
7473
|
+
* `Combobox.expandIcon`, a value that renders nothing does not hide the indicator (Fluent's
|
|
7474
|
+
* `checkIcon={null}` removes it).
|
|
7475
|
+
* @default a check mark
|
|
7476
|
+
*/
|
|
7477
|
+
checkIcon?: Slot<'span'>;
|
|
5865
7478
|
/**
|
|
5866
7479
|
* Hides the option, like a native `<option hidden>`: it is not shown, keyboard navigation and
|
|
5867
7480
|
* typeahead skip it, and it never becomes the active option. Its label stays known, so a
|
|
@@ -6852,29 +8465,51 @@ export declare interface RadioItemProps extends Omit<React_2.ButtonHTMLAttribute
|
|
|
6852
8465
|
/**
|
|
6853
8466
|
* A star rating input (`role="radiogroup"` of `role="radio"` stars).
|
|
6854
8467
|
*
|
|
6855
|
-
* - One tab stop (the chosen
|
|
6856
|
-
* move focus to the chosen
|
|
6857
|
-
* (Left/Right mirrored under `dir="rtl"`), Home
|
|
6858
|
-
*
|
|
6859
|
-
*
|
|
8468
|
+
* - One tab stop (the radio of the chosen value, else the first). Keys choose relative to the
|
|
8469
|
+
* current rating and move focus to the chosen radio, as in 0.4: Right/Up one `step` more (a
|
|
8470
|
+
* star, or half a star), Left/Down one fewer (Left/Right mirrored under `dir="rtl"`), Home the
|
|
8471
|
+
* smallest value (`step`) and End `max`. From an empty rating, Right/Up/Home choose `step`.
|
|
8472
|
+
* Keys at the ends (and Left/Down while empty) emit nothing.
|
|
8473
|
+
* - The keyboard cannot clear a rating: Left/Down stop at `step` (APG radio group; 0.4 went down
|
|
6860
8474
|
* to 0). Only a controlled `value={0}` (or a form reset while `defaultValue` is 0) clears it.
|
|
8475
|
+
* - `step={0.5}` offers half stars. Each star stays one pointer target, which chooses by the
|
|
8476
|
+
* pointer's position (its half from the inline start, else its full value) and then focuses
|
|
8477
|
+
* the radio it chose; it holds two transparent radios ("2.5 stars", "3 stars") for the
|
|
8478
|
+
* keyboard and screen readers, and draws the focus ring of either. A controlled value between
|
|
8479
|
+
* two steps checks no radio and is drawn as the step below it; the keys move it to the next or
|
|
8480
|
+
* previous step.
|
|
6861
8481
|
* - `onValueChange` (and the deprecated `onChange` alias) fire only when the rating changes, so
|
|
6862
8482
|
* choosing the current star again calls neither.
|
|
6863
|
-
* - Hovering previews a value
|
|
8483
|
+
* - Hovering previews a value (half stars preview by the pointer's position); the preview never
|
|
8484
|
+
* outlives the hover or a disabled state.
|
|
8485
|
+
* - `color` colors the filled stars (`marigold`, the default, `brand` or `neutral`; the root
|
|
8486
|
+
* carries `data-color`); `iconFilled` and `iconOutline` replace the star glyphs, as a pair.
|
|
6864
8487
|
* - Inside a `Field` it is named by the Field label (instead of the default "Rating") and
|
|
6865
|
-
* described by its hint and error. The stars are named "1 star", "2 stars",
|
|
6866
|
-
* localizes these names.
|
|
8488
|
+
* described by its hint and error. The stars are named "1 star", "2 stars", … (and a half value
|
|
8489
|
+
* "2.5 stars"); `labels` localizes these names.
|
|
6867
8490
|
* - With `name` (or `required`) it takes part in native forms; a form reset restores
|
|
6868
8491
|
* `defaultValue`.
|
|
8492
|
+
* - The stars are generated from `max`. Children that render content replace them: one
|
|
8493
|
+
* `Rating.Item` per value from 1 to `max`, chosen, previewed, roved and named as the generated
|
|
8494
|
+
* stars are (`max` still sets the key range and the star names).
|
|
8495
|
+
*
|
|
8496
|
+
* Sub-component: `Rating.Item` (the same component as `RatingDisplay.Item`). React Server
|
|
8497
|
+
* Components import its flat name `RatingItem` (dotted access needs a client file).
|
|
6869
8498
|
*/
|
|
6870
8499
|
export declare const Rating: {
|
|
6871
|
-
({ value: valueProp, defaultValue, onValueChange, onChange, max, size, disabled, name, required, form, labels, className, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, onKeyDown, onFocus, onMouseLeave, ref, ...rest }: RatingProps): React_2.JSX.Element;
|
|
8500
|
+
({ value: valueProp, defaultValue, onValueChange, onChange, max, step: stepProp, size, color, iconFilled, iconOutline, disabled, name, required, form, labels, className, children, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, onKeyDown, onFocus, onMouseLeave, ref, ...rest }: RatingProps): React_2.JSX.Element;
|
|
6872
8501
|
displayName: string;
|
|
8502
|
+
} & {
|
|
8503
|
+
Item: {
|
|
8504
|
+
({ value, iconFilled, iconOutline, className, ref, ...rest }: RatingItemProps): React_2.JSX.Element;
|
|
8505
|
+
displayName: string;
|
|
8506
|
+
};
|
|
6873
8507
|
};
|
|
6874
8508
|
|
|
6875
8509
|
/**
|
|
6876
|
-
* Rating: `root` on the `role="radiogroup"` element; `star` on each
|
|
6877
|
-
* on each
|
|
8510
|
+
* Rating: `root` on the `role="radiogroup"` element; `star` on each star (a RatingItem: the
|
|
8511
|
+
* `role="radio"` button, or with `step={0.5}` the span around its two radios); `icon` on each
|
|
8512
|
+
* star glyph (the default `<svg>`, or the span of your `iconFilled`/`iconOutline`).
|
|
6878
8513
|
*/
|
|
6879
8514
|
export declare const ratingClassNames: {
|
|
6880
8515
|
readonly root: "wave-rating";
|
|
@@ -6882,6 +8517,9 @@ export declare const ratingClassNames: {
|
|
|
6882
8517
|
readonly icon: "wave-rating__icon";
|
|
6883
8518
|
};
|
|
6884
8519
|
|
|
8520
|
+
/** Color of a rating's filled stars. */
|
|
8521
|
+
export declare type RatingColor = 'neutral' | 'brand' | 'marigold';
|
|
8522
|
+
|
|
6885
8523
|
/**
|
|
6886
8524
|
* A read-only star rating (`role="img"` named "Rating: <value> out of <max>"). A fractional value
|
|
6887
8525
|
* is drawn with a partly filled star, so the stars and the name show the same value.
|
|
@@ -6891,15 +8529,29 @@ export declare const ratingClassNames: {
|
|
|
6891
8529
|
* stars (the root carries `data-compact`). Without them only the stars show.
|
|
6892
8530
|
* - The value (up to one decimal) and the count are formatted with `locale`, in the text and in
|
|
6893
8531
|
* the name; `labels` localizes the name. Pass `locale` when rendering on the server.
|
|
8532
|
+
* - `color` colors the filled stars (`marigold`, the default, `brand` or `neutral`; the root
|
|
8533
|
+
* carries `data-color`); `iconFilled` and `iconOutline` replace the star glyphs, as a pair.
|
|
8534
|
+
* - The stars are generated from `max`. Children that render content replace them: one
|
|
8535
|
+
* `RatingDisplay.Item` per value from 1 to `max`. A `compact` display ignores them.
|
|
8536
|
+
*
|
|
8537
|
+
* Sub-component: `RatingDisplay.Item` (the same component as `Rating.Item`). React Server
|
|
8538
|
+
* Components import its flat name `RatingDisplayItem`, or `RatingItem` (dotted access needs a
|
|
8539
|
+
* client file).
|
|
6894
8540
|
*/
|
|
6895
8541
|
export declare const RatingDisplay: {
|
|
6896
|
-
({ value, max, size, showValue, count, compact, locale, labels, className, ref, ...rest }: RatingDisplayProps): React_2.JSX.Element;
|
|
8542
|
+
({ value, max, size, color, iconFilled, iconOutline, showValue, count, compact, locale, labels, className, children, ref, ...rest }: RatingDisplayProps): React_2.JSX.Element;
|
|
6897
8543
|
displayName: string;
|
|
8544
|
+
} & {
|
|
8545
|
+
Item: {
|
|
8546
|
+
({ value, iconFilled, iconOutline, className, ref, ...rest }: RatingItemProps): React_2.JSX.Element;
|
|
8547
|
+
displayName: string;
|
|
8548
|
+
};
|
|
6898
8549
|
};
|
|
6899
8550
|
|
|
6900
8551
|
/**
|
|
6901
|
-
* RatingDisplay: `root` on the `role="img"` element; `star` on each star span
|
|
6902
|
-
*
|
|
8552
|
+
* RatingDisplay: `root` on the `role="img"` element; `star` on each star span (a RatingItem, and
|
|
8553
|
+
* the one star of `compact`); `icon` on the star glyphs; `value` on the value span; `count` on the
|
|
8554
|
+
* count span.
|
|
6903
8555
|
*/
|
|
6904
8556
|
export declare const ratingDisplayClassNames: {
|
|
6905
8557
|
readonly root: "wave-rating-display";
|
|
@@ -6909,6 +8561,15 @@ export declare const ratingDisplayClassNames: {
|
|
|
6909
8561
|
readonly count: "wave-rating-display__count";
|
|
6910
8562
|
};
|
|
6911
8563
|
|
|
8564
|
+
/**
|
|
8565
|
+
* Flat name of `RatingDisplay.Item` for React Server Components (the same component as
|
|
8566
|
+
* `RatingItem`).
|
|
8567
|
+
*/
|
|
8568
|
+
export declare const RatingDisplayItem: {
|
|
8569
|
+
({ value, iconFilled, iconOutline, className, ref, ...rest }: RatingItemProps): React_2.JSX.Element;
|
|
8570
|
+
displayName: string;
|
|
8571
|
+
};
|
|
8572
|
+
|
|
6912
8573
|
/** Built-in texts of RatingDisplay, for localization. */
|
|
6913
8574
|
export declare interface RatingDisplayLabels {
|
|
6914
8575
|
/**
|
|
@@ -6924,7 +8585,7 @@ export declare interface RatingDisplayLabels {
|
|
|
6924
8585
|
}
|
|
6925
8586
|
|
|
6926
8587
|
/** Properties for the RatingDisplay (read-only) component. */
|
|
6927
|
-
export declare interface RatingDisplayProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
8588
|
+
export declare interface RatingDisplayProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'color'> {
|
|
6928
8589
|
/**
|
|
6929
8590
|
* Rating value to display. A fraction is drawn as a partly filled star (`4.6` fills 60% of the
|
|
6930
8591
|
* fifth star), so the stars show the value the accessible name reports.
|
|
@@ -6938,6 +8599,36 @@ export declare interface RatingDisplayProps extends React_2.HTMLAttributes<HTMLD
|
|
|
6938
8599
|
* @default 'medium'
|
|
6939
8600
|
*/
|
|
6940
8601
|
size?: Size;
|
|
8602
|
+
/**
|
|
8603
|
+
* Color of the filled stars: `marigold` (default), `brand` or `neutral`; unfilled stars keep a
|
|
8604
|
+
* 3:1 outline. Fluent's default is `neutral`. A value outside the three (from untyped code)
|
|
8605
|
+
* renders as `marigold`; the root carries `data-color` with the resolved value.
|
|
8606
|
+
* @default 'marigold'
|
|
8607
|
+
*/
|
|
8608
|
+
color?: RatingColor;
|
|
8609
|
+
/**
|
|
8610
|
+
* The glyph of a filled star. `iconFilled` and `iconOutline` are the glyphs of a filled and an
|
|
8611
|
+
* unfilled star, as a pair; decorative. Fluent's RatingDisplay takes one `icon`; here a filled
|
|
8612
|
+
* and an unfilled star must differ by shape, not by color alone.
|
|
8613
|
+
*
|
|
8614
|
+
* - Each glyph is sized by `size` (an SVG child fills the star) and takes the star's color
|
|
8615
|
+
* (paint it with `currentColor`). A partly filled star clips the filled glyph over the
|
|
8616
|
+
* unfilled one from the inline start, and the `compact` star is the filled glyph.
|
|
8617
|
+
* - `null`, `undefined` and a value that renders nothing draw the default star. A value that
|
|
8618
|
+
* renders nothing, and a pair with only one of the two set, log a development warning.
|
|
8619
|
+
* - A `<button>` or `Button` element (or a slot object whose `as` is one) is not nested in the
|
|
8620
|
+
* star: its children become the glyph (the default star when they render nothing), its props
|
|
8621
|
+
* are dropped, and a development warning says so (in place of the warning for a value that
|
|
8622
|
+
* renders nothing).
|
|
8623
|
+
* - A `RatingDisplay.Item` that sets its own pair draws that one instead.
|
|
8624
|
+
*/
|
|
8625
|
+
iconFilled?: Slot<'span'>;
|
|
8626
|
+
/**
|
|
8627
|
+
* The glyph of an unfilled star, as a pair with `iconFilled` (its rules apply); decorative.
|
|
8628
|
+
* Fluent's RatingDisplay takes one `icon`; here a filled and an unfilled star must differ by
|
|
8629
|
+
* shape, not by color alone.
|
|
8630
|
+
*/
|
|
8631
|
+
iconOutline?: Slot<'span'>;
|
|
6941
8632
|
/**
|
|
6942
8633
|
* Shows the value as text after the stars, formatted with `locale` (up to one decimal).
|
|
6943
8634
|
* @default false
|
|
@@ -6962,25 +8653,105 @@ export declare interface RatingDisplayProps extends React_2.HTMLAttributes<HTMLD
|
|
|
6962
8653
|
locale?: string;
|
|
6963
8654
|
/** Built-in texts, for localization. */
|
|
6964
8655
|
labels?: RatingDisplayLabels;
|
|
8656
|
+
/**
|
|
8657
|
+
* Custom stars: one `RatingDisplay.Item` per value from 1 to `max`, in place of the generated
|
|
8658
|
+
* stars (when the children render content). A `compact` display ignores them.
|
|
8659
|
+
*/
|
|
8660
|
+
children?: React_2.ReactNode;
|
|
6965
8661
|
/** Ref to the root element. */
|
|
6966
8662
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
6967
8663
|
}
|
|
6968
8664
|
|
|
8665
|
+
/**
|
|
8666
|
+
* One star of a `Rating` or a `RatingDisplay`, drawn from its root: pass one per value from 1 to
|
|
8667
|
+
* `max` as the root's children, in place of the stars it generates.
|
|
8668
|
+
*
|
|
8669
|
+
* - In a `Rating` it is a `role="radio"` button named by the root's `labels.star` ("2 stars"),
|
|
8670
|
+
* chosen, previewed and roved as a generated star is. With the root's `step={0.5}` it is a star
|
|
8671
|
+
* `<span>`, one pointer target that chooses by the pointer's position, holding two transparent
|
|
8672
|
+
* radios: its half value, then its full value ("1.5 stars", "2 stars"). In a `RatingDisplay` it
|
|
8673
|
+
* is a star filled, partly filled or empty by the root's value.
|
|
8674
|
+
* - It draws the root's `color` and glyph pair, or its own `iconFilled`/`iconOutline` pair when it
|
|
8675
|
+
* sets one.
|
|
8676
|
+
* - `className`, `style`, `data-*`, the other attributes, the handlers and `ref` go to that star
|
|
8677
|
+
* element, the consumer's handlers first. The role, name, checked state and tab stop of its
|
|
8678
|
+
* radio (or radios) come from the root.
|
|
8679
|
+
* - At `step={1}` the consumer's `onClick` and `onMouseEnter` compose onto the radio itself, so a
|
|
8680
|
+
* `preventDefault()` in either vetoes that star's own activation or hover preview. At
|
|
8681
|
+
* `step={0.5}` `onClick` and `onPointerMove` compose onto the star `<span>` instead: its two
|
|
8682
|
+
* radios run their own `onClick` first and choose their own value directly (Space, Enter, a
|
|
8683
|
+
* screen reader, or `radio.click()`), before the click bubbles to the span's composed handler,
|
|
8684
|
+
* so a `preventDefault()` there vetoes only a pointer-chosen value, never a keyboard or
|
|
8685
|
+
* assistive-technology activation.
|
|
8686
|
+
* - Outside a `Rating` or `RatingDisplay` it throws in development.
|
|
8687
|
+
*/
|
|
8688
|
+
export declare const RatingItem: {
|
|
8689
|
+
({ value, iconFilled, iconOutline, className, ref, ...rest }: RatingItemProps): React_2.JSX.Element;
|
|
8690
|
+
displayName: string;
|
|
8691
|
+
};
|
|
8692
|
+
|
|
8693
|
+
/**
|
|
8694
|
+
* RatingItem (also Rating.Item, RatingDisplay.Item and RatingDisplayItem): `root` on the star
|
|
8695
|
+
* element (the `role="radio"` button in a Rating, the span around its two radios with
|
|
8696
|
+
* `step={0.5}`, the star span in a RatingDisplay), which also carries its rating's `star` class;
|
|
8697
|
+
* `icon` on each glyph it draws (the default `<svg>`, or the span of an `iconFilled`/`iconOutline`
|
|
8698
|
+
* glyph), which also carries its rating's `icon` class.
|
|
8699
|
+
*/
|
|
8700
|
+
export declare const ratingItemClassNames: {
|
|
8701
|
+
readonly root: "wave-rating-item";
|
|
8702
|
+
readonly icon: "wave-rating-item__icon";
|
|
8703
|
+
};
|
|
8704
|
+
|
|
8705
|
+
/** Properties for the RatingItem component (`Rating.Item`, `RatingDisplay.Item`). */
|
|
8706
|
+
export declare interface RatingItemProps extends Omit<React_2.HTMLAttributes<HTMLElement>, 'role' | 'aria-checked' | 'aria-label' | 'aria-labelledby' | 'tabIndex' | 'children' | 'onChange'> {
|
|
8707
|
+
/**
|
|
8708
|
+
* The star's full value, from 1 to the root's `max`: the rating it chooses (with the root's
|
|
8709
|
+
* `step={0.5}` also its half, `value - 0.5`), or shows.
|
|
8710
|
+
*/
|
|
8711
|
+
value: number;
|
|
8712
|
+
/**
|
|
8713
|
+
* The glyph of this star when filled, as a pair with `iconOutline`, following the rules of the
|
|
8714
|
+
* root's `iconFilled` (a button is unwrapped, its children becoming the glyph, and a value or
|
|
8715
|
+
* button children that render nothing draw the default star). An item that sets either glyph
|
|
8716
|
+
* of the pair (`null` included) draws its own pair instead of its root's, and a glyph it leaves
|
|
8717
|
+
* unset is the default star (a development warning says so).
|
|
8718
|
+
*/
|
|
8719
|
+
iconFilled?: Slot<'span'>;
|
|
8720
|
+
/**
|
|
8721
|
+
* The glyph of this star when unfilled, as a pair with `iconFilled`, following the rules of the
|
|
8722
|
+
* root's `iconOutline` (a button is unwrapped, its children becoming the glyph, and a value or
|
|
8723
|
+
* button children that render nothing draw the default star). An item that sets either glyph
|
|
8724
|
+
* of the pair (`null` included) draws its own pair instead of its root's, and a glyph it leaves
|
|
8725
|
+
* unset is the default star (a development warning says so).
|
|
8726
|
+
*/
|
|
8727
|
+
iconOutline?: Slot<'span'>;
|
|
8728
|
+
/**
|
|
8729
|
+
* Ref to the star element: the `role="radio"` button in a Rating, the star `<span>` in a Rating
|
|
8730
|
+
* with `step={0.5}` and in a RatingDisplay.
|
|
8731
|
+
*/
|
|
8732
|
+
ref?: React_2.Ref<HTMLElement>;
|
|
8733
|
+
}
|
|
8734
|
+
|
|
6969
8735
|
/**
|
|
6970
8736
|
* The Rating's built-in star names, for localization. Each member is optional and falls back to
|
|
6971
8737
|
* its English default.
|
|
6972
8738
|
*/
|
|
6973
8739
|
export declare interface RatingLabels {
|
|
6974
8740
|
/**
|
|
6975
|
-
* Accessible name of the
|
|
8741
|
+
* Accessible name of the radio that chooses `value`: a whole star (1 to `max`), and with
|
|
8742
|
+
* `step={0.5}` a half value too ("2.5 stars").
|
|
6976
8743
|
* @default (value) => value === 1 ? '1 star' : `${value} stars`
|
|
6977
8744
|
*/
|
|
6978
8745
|
star?: (value: number, max: number) => string;
|
|
6979
8746
|
}
|
|
6980
8747
|
|
|
6981
8748
|
/** Properties for the Rating component. */
|
|
6982
|
-
export declare interface RatingProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
6983
|
-
/**
|
|
8749
|
+
export declare interface RatingProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'color'> {
|
|
8750
|
+
/**
|
|
8751
|
+
* Controlled rating value (`0` = no rating): a whole number of stars, or with `step={0.5}` a
|
|
8752
|
+
* multiple of 0.5. A value between two steps (2.7) checks no radio, is drawn as the step below
|
|
8753
|
+
* it (2.5) and holds the tab stop there; the keys move it to the next or previous step.
|
|
8754
|
+
*/
|
|
6984
8755
|
value?: number;
|
|
6985
8756
|
/** Initial rating for uncontrolled usage (also the value a form reset restores).
|
|
6986
8757
|
* @default 0
|
|
@@ -6998,10 +8769,50 @@ export declare interface RatingProps extends Omit<React_2.HTMLAttributes<HTMLDiv
|
|
|
6998
8769
|
* @default 5
|
|
6999
8770
|
*/
|
|
7000
8771
|
max?: number;
|
|
8772
|
+
/**
|
|
8773
|
+
* The grain of the rating: `1` (whole stars) or `0.5` (half stars). With `0.5`, each star stays
|
|
8774
|
+
* one pointer target of at least 24×24px (a larger `size` keeps a larger one): the half is
|
|
8775
|
+
* chosen by the pointer's position over it (the half at the inline start, which mirrors under
|
|
8776
|
+
* `dir="rtl"`), and two transparent radios per star, the half value then the full value, serve
|
|
8777
|
+
* the keyboard and screen readers. The keys then move by half a star. A value other than `0.5`
|
|
8778
|
+
* (from untyped code) counts as `1`. RatingDisplay has no `step`: it draws any fraction.
|
|
8779
|
+
* @default 1
|
|
8780
|
+
*/
|
|
8781
|
+
step?: 0.5 | 1;
|
|
7001
8782
|
/** Size of the star icons. Every size keeps a target of at least 24×24px.
|
|
7002
8783
|
* @default 'medium'
|
|
7003
8784
|
*/
|
|
7004
8785
|
size?: Size;
|
|
8786
|
+
/**
|
|
8787
|
+
* Color of the filled stars: `marigold` (default), `brand` or `neutral`; unfilled stars keep a
|
|
8788
|
+
* 3:1 outline. Fluent's default is `neutral`. A value outside the three (from untyped code)
|
|
8789
|
+
* renders as `marigold`; the root carries `data-color` with the resolved value.
|
|
8790
|
+
* @default 'marigold'
|
|
8791
|
+
*/
|
|
8792
|
+
color?: RatingColor;
|
|
8793
|
+
/**
|
|
8794
|
+
* The glyph of a filled star. `iconFilled` and `iconOutline` are the glyphs of a filled and an
|
|
8795
|
+
* unfilled star, as a pair; decorative. Fluent's RatingDisplay takes one `icon`; here a filled
|
|
8796
|
+
* and an unfilled star must differ by shape, not by color alone.
|
|
8797
|
+
*
|
|
8798
|
+
* - Each glyph is sized by `size` (an SVG child fills the star) and takes the star's color
|
|
8799
|
+
* (paint it with `currentColor`). A half-filled star (`step={0.5}`) clips the filled glyph
|
|
8800
|
+
* over the unfilled one from the inline start.
|
|
8801
|
+
* - `null`, `undefined` and a value that renders nothing draw the default star. A value that
|
|
8802
|
+
* renders nothing, and a pair with only one of the two set, log a development warning.
|
|
8803
|
+
* - A `<button>` or `Button` element (or a slot object whose `as` is one) is not nested in the
|
|
8804
|
+
* star: its children become the glyph (the default star when they render nothing), its props
|
|
8805
|
+
* are dropped, and a development warning says so (in place of the warning for a value that
|
|
8806
|
+
* renders nothing).
|
|
8807
|
+
* - A `Rating.Item` that sets its own pair draws that one instead.
|
|
8808
|
+
*/
|
|
8809
|
+
iconFilled?: Slot<'span'>;
|
|
8810
|
+
/**
|
|
8811
|
+
* The glyph of an unfilled star, as a pair with `iconFilled` (its rules apply); decorative.
|
|
8812
|
+
* Fluent's RatingDisplay takes one `icon`; here a filled and an unfilled star must differ by
|
|
8813
|
+
* shape, not by color alone.
|
|
8814
|
+
*/
|
|
8815
|
+
iconOutline?: Slot<'span'>;
|
|
7005
8816
|
/** Whether the rating is disabled and non-interactive.
|
|
7006
8817
|
* @default false
|
|
7007
8818
|
*/
|
|
@@ -7016,10 +8827,16 @@ export declare interface RatingProps extends Omit<React_2.HTMLAttributes<HTMLDiv
|
|
|
7016
8827
|
/** Id of the form the rating belongs to, when it is rendered outside that form. */
|
|
7017
8828
|
form?: string;
|
|
7018
8829
|
/**
|
|
7019
|
-
* Names of the stars ("1 star", "2 stars",
|
|
7020
|
-
* `aria-label` (default "Rating"). Unset members keep
|
|
8830
|
+
* Names of the stars ("1 star", "2 stars", …, and "2.5 stars" for a half value), for
|
|
8831
|
+
* localization. The group's own name is `aria-label` (default "Rating"). Unset members keep
|
|
8832
|
+
* their English defaults.
|
|
7021
8833
|
*/
|
|
7022
8834
|
labels?: RatingLabels;
|
|
8835
|
+
/**
|
|
8836
|
+
* Custom stars: one `Rating.Item` per value from 1 to `max`, in place of the generated stars
|
|
8837
|
+
* (when the children render content). `max` still sets the key range and the star names.
|
|
8838
|
+
*/
|
|
8839
|
+
children?: React_2.ReactNode;
|
|
7023
8840
|
/** Ref to the `role="radiogroup"` element. */
|
|
7024
8841
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
7025
8842
|
}
|
|
@@ -7110,12 +8927,16 @@ export declare interface RovingContainerProps {
|
|
|
7110
8927
|
* the label, hint, error and required state automatically.
|
|
7111
8928
|
* - **Forms**: with `name` the text is submitted with the form; a form reset restores
|
|
7112
8929
|
* `defaultValue`.
|
|
8930
|
+
* - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
8931
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own
|
|
8932
|
+
* prop, then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as
|
|
8933
|
+
* `data-size` and `data-appearance` on the root `<div>`.
|
|
7113
8934
|
*
|
|
7114
8935
|
* @example
|
|
7115
8936
|
* <SearchBox aria-label="Search files" value={query} onValueChange={setQuery} />
|
|
7116
8937
|
*/
|
|
7117
8938
|
export declare const SearchBox: {
|
|
7118
|
-
({ value: controlledValue, defaultValue, onValueChange, onChange, onClear, placeholder, disabled, contentBefore, contentAfter, dismiss, className, ref, controlRef, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, "aria-details": ariaDetails, required, name, form, readOnly, autoComplete, autoFocus, autoCapitalize, autoCorrect, inputMode, enterKeyHint, spellCheck, maxLength, minLength, pattern, tabIndex, onFocus, onBlur, onKeyDown, onKeyUp, onMouseDown, hidden, ...rest }: SearchBoxProps): React_2.JSX.Element;
|
|
8939
|
+
({ value: controlledValue, defaultValue, onValueChange, onChange, onClear, placeholder, disabled, size: sizeProp, appearance: appearanceProp, contentBefore, contentAfter, dismiss, className, ref, controlRef, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, "aria-details": ariaDetails, required, name, form, readOnly, autoComplete, autoFocus, autoCapitalize, autoCorrect, inputMode, enterKeyHint, spellCheck, maxLength, minLength, pattern, tabIndex, onFocus, onBlur, onKeyDown, onKeyUp, onMouseDown, hidden, ...rest }: SearchBoxProps): React_2.JSX.Element;
|
|
7119
8940
|
displayName: string;
|
|
7120
8941
|
};
|
|
7121
8942
|
|
|
@@ -7166,6 +8987,17 @@ export declare interface SearchBoxProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
7166
8987
|
placeholder?: string;
|
|
7167
8988
|
/** Whether the search box is disabled and non-interactive. */
|
|
7168
8989
|
disabled?: boolean;
|
|
8990
|
+
/**
|
|
8991
|
+
* Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the
|
|
8992
|
+
* surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`.
|
|
8993
|
+
*/
|
|
8994
|
+
size?: CoreSize;
|
|
8995
|
+
/**
|
|
8996
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
8997
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
8998
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
8999
|
+
*/
|
|
9000
|
+
appearance?: InputAppearance;
|
|
7169
9001
|
/**
|
|
7170
9002
|
* Slot rendered before the text (replaces the default search icon). It takes the room it needs;
|
|
7171
9003
|
* the text starts after it. A value that renders nothing (`null`, `false`, `''`, an empty array
|
|
@@ -7218,6 +9050,11 @@ export declare interface SearchBoxProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
7218
9050
|
* `Field` label, `aria-label` or `aria-labelledby`. Inside a `Field` it picks up the label, hint,
|
|
7219
9051
|
* error, `required` (native attribute) and invalid state automatically.
|
|
7220
9052
|
*
|
|
9053
|
+
* `size` resolves from its own prop, then the surrounding `Field`'s `size`, then
|
|
9054
|
+
* `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own prop, then
|
|
9055
|
+
* `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and
|
|
9056
|
+
* `data-appearance` on the `<select>`.
|
|
9057
|
+
*
|
|
7221
9058
|
* @example
|
|
7222
9059
|
* <Field label="Country" required>
|
|
7223
9060
|
* <Select defaultValue="">
|
|
@@ -7227,7 +9064,7 @@ export declare interface SearchBoxProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
7227
9064
|
* </Field>
|
|
7228
9065
|
*/
|
|
7229
9066
|
export declare const Select: {
|
|
7230
|
-
({ error, errorMessageProps, className, children, ref, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, required, ...props }: SelectProps): React_2.JSX.Element;
|
|
9067
|
+
({ error, errorMessageProps, size: sizeProp, htmlSize, appearance: appearanceProp, className, children, ref, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, required, ...props }: SelectProps): React_2.JSX.Element;
|
|
7231
9068
|
displayName: string;
|
|
7232
9069
|
};
|
|
7233
9070
|
|
|
@@ -7242,7 +9079,7 @@ declare type SelectionMode_2 = 'single' | 'multiple';
|
|
|
7242
9079
|
export { SelectionMode_2 as SelectionMode }
|
|
7243
9080
|
|
|
7244
9081
|
/** Properties for the Select component. */
|
|
7245
|
-
export declare interface SelectProps extends React_2.SelectHTMLAttributes<HTMLSelectElement> {
|
|
9082
|
+
export declare interface SelectProps extends Omit<React_2.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
7246
9083
|
/**
|
|
7247
9084
|
* Validation error.
|
|
7248
9085
|
* - A non-empty string renders the message in a `role="alert"` element **after** the select
|
|
@@ -7259,6 +9096,24 @@ export declare interface SelectProps extends React_2.SelectHTMLAttributes<HTMLSe
|
|
|
7259
9096
|
error?: string | boolean;
|
|
7260
9097
|
/** Props of the error message element (`id`, `className`, …) rendered for a string `error`. */
|
|
7261
9098
|
errorMessageProps?: InputErrorMessageProps;
|
|
9099
|
+
/**
|
|
9100
|
+
* Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the
|
|
9101
|
+
* surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`.
|
|
9102
|
+
*
|
|
9103
|
+
* A number is the native `size` attribute (the number of visible rows), as in 0.8: it still
|
|
9104
|
+
* renders, warns once in development and is removed in 1.0. Use `htmlSize` for it.
|
|
9105
|
+
* A string of digits only (`size="20"` from untyped code) counts as that number. Any other value
|
|
9106
|
+
* outside the three sizes renders as if `size` were not set.
|
|
9107
|
+
*/
|
|
9108
|
+
size?: CoreSize | number;
|
|
9109
|
+
/** The native `size` attribute: the number of visible rows. */
|
|
9110
|
+
htmlSize?: number;
|
|
9111
|
+
/**
|
|
9112
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
9113
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
9114
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
9115
|
+
*/
|
|
9116
|
+
appearance?: InputAppearance;
|
|
7262
9117
|
/** Ref to the `<select>` element. */
|
|
7263
9118
|
ref?: React_2.Ref<HTMLSelectElement>;
|
|
7264
9119
|
}
|
|
@@ -7357,11 +9212,14 @@ export declare interface SkeletonProps extends React_2.HTMLAttributes<HTMLDivEle
|
|
|
7357
9212
|
* The fill follows the value through the `--wave-slider-progress` variable on the input (also in
|
|
7358
9213
|
* the server HTML), including the browser's snapping to `step` and a form reset.
|
|
7359
9214
|
*
|
|
9215
|
+
* `size` (`small`, `medium`) sets the thumb and rail dimensions; the input carries `data-size`.
|
|
9216
|
+
* Slider does not read a surrounding `Field`'s size or a `WaveProvider`'s input defaults.
|
|
9217
|
+
*
|
|
7360
9218
|
* @example
|
|
7361
9219
|
* <Slider label="Volume" min={0} max={100} value={volume} onValueChange={setVolume} />
|
|
7362
9220
|
*/
|
|
7363
9221
|
export declare const Slider: {
|
|
7364
|
-
({ className, style, label, value, defaultValue, min, max, step, form, onChange, onValueChange, ref, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, required, ...props }: SliderProps): React_2.JSX.Element;
|
|
9222
|
+
({ className, style, label, value, defaultValue, min, max, step, size: sizeProp, form, onChange, onValueChange, ref, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, required, ...props }: SliderProps): React_2.JSX.Element;
|
|
7365
9223
|
displayName: string;
|
|
7366
9224
|
};
|
|
7367
9225
|
|
|
@@ -7371,7 +9229,7 @@ export declare const sliderClassNames: {
|
|
|
7371
9229
|
};
|
|
7372
9230
|
|
|
7373
9231
|
/** Properties for the Slider component. */
|
|
7374
|
-
export declare interface SliderProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
9232
|
+
export declare interface SliderProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
|
|
7375
9233
|
/** Controlled slider value. */
|
|
7376
9234
|
value?: number;
|
|
7377
9235
|
/** Initial value for uncontrolled usage. */
|
|
@@ -7391,10 +9249,25 @@ export declare interface SliderProps extends Omit<React_2.InputHTMLAttributes<HT
|
|
|
7391
9249
|
* `Field`, leave it out so the Field's label names the slider.
|
|
7392
9250
|
*/
|
|
7393
9251
|
label?: string;
|
|
9252
|
+
/**
|
|
9253
|
+
* Size of the thumb and rail: the 0.7 20px thumb on a 4px rail, or a small 16px thumb on a 2px
|
|
9254
|
+
* rail in a 24px-tall input. Unlike the text controls and pickers, Slider does not read a
|
|
9255
|
+
* surrounding `Field`'s size or a `WaveProvider`'s input defaults: this prop is the only source
|
|
9256
|
+
* of its size.
|
|
9257
|
+
*
|
|
9258
|
+
* `SliderProps` inherited the native HTML `size` attribute, which a range input ignores anyway.
|
|
9259
|
+
* A number is deprecated: it renders nothing (not even the native attribute), is reported once
|
|
9260
|
+
* in development, and is a type error from 1.0.
|
|
9261
|
+
* @default 'medium'
|
|
9262
|
+
*/
|
|
9263
|
+
size?: SliderSize | number;
|
|
7394
9264
|
/** Ref to the `<input type="range">` element. */
|
|
7395
9265
|
ref?: React_2.Ref<HTMLInputElement>;
|
|
7396
9266
|
}
|
|
7397
9267
|
|
|
9268
|
+
/** Size of the thumb and rail: a small 16px thumb on a 2px rail, or the 0.7 20px thumb on a 4px rail. */
|
|
9269
|
+
export declare type SliderSize = Extract<Size, 'small' | 'medium'>;
|
|
9270
|
+
|
|
7398
9271
|
/**
|
|
7399
9272
|
* Slot definition — a customisable sub-element of a component. Accepts:
|
|
7400
9273
|
*
|
|
@@ -7442,14 +9315,26 @@ export declare type SortDirection = 'ascending' | 'descending';
|
|
|
7442
9315
|
* A numeric input with decrement/increment buttons (APG spinbutton pattern).
|
|
7443
9316
|
*
|
|
7444
9317
|
* - **Keyboard** on the input: ArrowUp/ArrowDown step by `step`, PageUp/PageDown by `largeStep`
|
|
7445
|
-
* (default ten steps), Home/End jump to `min`/`max` when they are finite
|
|
7446
|
-
*
|
|
7447
|
-
* announce the new
|
|
9318
|
+
* (default ten steps), Home/End jump to `min`/`max` when they are finite (Shift+Home and
|
|
9319
|
+
* Shift+End keep their native text-selection instead). The −/+ buttons are not tab stops and
|
|
9320
|
+
* never take focus, so focus stays on the spinbutton and screen readers announce the new
|
|
9321
|
+
* value.
|
|
9322
|
+
* - **Pointer** on the −/+ buttons (mouse, touch or pen): a short press steps once, on release
|
|
9323
|
+
* (its click), never on the press alone, so a finger that starts a scroll on a button changes
|
|
9324
|
+
* nothing. Holding a button repeats the step: the first after 300ms, then faster, every 80ms
|
|
9325
|
+
* after about a second (Fluent's timing). A hold stops when the button is released, the
|
|
9326
|
+
* pointer leaves it or the press turns into a scroll, at the bound, when the window loses
|
|
9327
|
+
* focus, and when the spin button becomes disabled or read-only. Only the primary button of a
|
|
9328
|
+
* primary pointer holds: a second finger, a secondary button or a Ctrl+press with a mouse (the
|
|
9329
|
+
* secondary click on macOS) neither starts a hold nor ends one. A click without a press (a
|
|
9330
|
+
* screen reader, `element.click()`) steps once. The buttons open no context menu (a long press
|
|
9331
|
+
* on touch would), show no iOS callout, and allow no text selection or double-tap zoom.
|
|
7448
9332
|
* - **Typing** edits a draft: the value is parsed, clamped and committed on blur or Enter
|
|
7449
9333
|
* (Escape reverts). Text that is not a number is flagged with `aria-invalid` and reverted on
|
|
7450
9334
|
* blur. Steps (keys and buttons) start from the typed number, and the −/+ buttons are disabled
|
|
7451
9335
|
* when that number is at `min`/`max`. Steps are rounded to the precision of `step` and of the
|
|
7452
|
-
* value, so `0.1 + 0.2` is `0.3
|
|
9336
|
+
* value, so `0.1 + 0.2` is `0.3`; `precision` rounds every committed value, typed or stepped,
|
|
9337
|
+
* to a fixed number of decimals instead, without padding it (pad with `displayValue`).
|
|
7453
9338
|
* - **Routing**: `id`, ARIA, native input attributes and focus/keyboard handlers go to the
|
|
7454
9339
|
* `<input role="spinbutton">`; `className`, `style`, `data-*`, other handlers and `ref` stay on
|
|
7455
9340
|
* the root (`controlRef` reaches the input). Inside a `Field` it picks up the label, hint, error
|
|
@@ -7457,16 +9342,119 @@ export declare type SortDirection = 'ascending' | 'descending';
|
|
|
7457
9342
|
* or use a label (development warning otherwise).
|
|
7458
9343
|
* - **Forms**: with `name` the committed value is submitted; `required` makes the input natively
|
|
7459
9344
|
* required; a form reset restores `defaultValue`.
|
|
9345
|
+
* - **Empty values**: `allowEmpty` lets the value become `null` (an empty field). Clearing the
|
|
9346
|
+
* text and committing it (blur or Enter) sets the value to `null`, uncontrolled too; stepping
|
|
9347
|
+
* up or down from an empty value starts at 0 and clamps to the nearest bound. `required` (its
|
|
9348
|
+
* own, or a required Field's) still blocks submitting an empty value: the check runs on the
|
|
9349
|
+
* `HiddenInput` that carries the committed value, not on the shown text, so it keeps working
|
|
9350
|
+
* even when the shown text is not empty.
|
|
9351
|
+
* - **Display text**: `displayValue` shows formatted text (`$1.00`) for the value while the field
|
|
9352
|
+
* is not being edited, and as its `aria-valuetext`; while the field has focus and can be
|
|
9353
|
+
* edited it shows the plain number instead, so typing still edits the number (a consumer
|
|
9354
|
+
* `aria-valuetext` always wins). It applies only while `value` is controlled: an uncontrolled
|
|
9355
|
+
* spin button ignores it and warns once in development.
|
|
9356
|
+
* - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
9357
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own
|
|
9358
|
+
* prop, then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as
|
|
9359
|
+
* `data-size` and `data-appearance` on the root. SpinButton takes every size the other fields
|
|
9360
|
+
* do, and unlike 0.7 its root is now exactly as tall as theirs, with its step buttons and
|
|
9361
|
+
* input taking up that height; sizing the root wider widens the input instead of leaving
|
|
9362
|
+
* empty space inside it. The step buttons keep a 1px separator from the input only in
|
|
9363
|
+
* `outline`; the other appearances have none.
|
|
7460
9364
|
* - The −/+ buttons are named "Decrement"/"Increment"; `labels` localizes the names.
|
|
7461
9365
|
*
|
|
7462
9366
|
* @example
|
|
7463
9367
|
* <SpinButton aria-label="Quantity" min={1} max={10} value={qty} onValueChange={setQty} />
|
|
7464
9368
|
*/
|
|
7465
9369
|
export declare const SpinButton: {
|
|
7466
|
-
(
|
|
9370
|
+
(props: SpinButtonProps | SpinButtonAllowEmptyProps): React_2.ReactNode;
|
|
7467
9371
|
displayName: string;
|
|
7468
9372
|
};
|
|
7469
9373
|
|
|
9374
|
+
/** SpinButton props with `allowEmpty`: the value may be `null` (an empty field). */
|
|
9375
|
+
export declare interface SpinButtonAllowEmptyProps extends SpinButtonBaseProps {
|
|
9376
|
+
/** The value may be `null`: clearing the text and committing it empties the field. */
|
|
9377
|
+
allowEmpty: true;
|
|
9378
|
+
/** Controlled value; `null` is an empty field. */
|
|
9379
|
+
value?: number | null;
|
|
9380
|
+
/** Initial value for uncontrolled usage (also what a form reset restores).
|
|
9381
|
+
* @default null
|
|
9382
|
+
*/
|
|
9383
|
+
defaultValue?: number | null;
|
|
9384
|
+
/** Called with the new value when it changes, `null` when the field is emptied. */
|
|
9385
|
+
onValueChange?: (value: number | null) => void;
|
|
9386
|
+
/** Not available with `allowEmpty` (the deprecated alias of `onValueChange`). */
|
|
9387
|
+
onChange?: never;
|
|
9388
|
+
}
|
|
9389
|
+
|
|
9390
|
+
/**
|
|
9391
|
+
* Properties every SpinButton mode shares (every member of {@link SpinButtonProps} and
|
|
9392
|
+
* {@link SpinButtonAllowEmptyProps} except the value members, which differ between them).
|
|
9393
|
+
*/
|
|
9394
|
+
export declare interface SpinButtonBaseProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | keyof SpinButtonInputProps>, SpinButtonInputProps {
|
|
9395
|
+
/** Minimum allowed value.
|
|
9396
|
+
* @default -Infinity
|
|
9397
|
+
*/
|
|
9398
|
+
min?: number;
|
|
9399
|
+
/** Maximum allowed value.
|
|
9400
|
+
* @default Infinity
|
|
9401
|
+
*/
|
|
9402
|
+
max?: number;
|
|
9403
|
+
/** Step of the increment/decrement buttons and of ArrowUp/ArrowDown.
|
|
9404
|
+
* @default 1
|
|
9405
|
+
*/
|
|
9406
|
+
step?: number;
|
|
9407
|
+
/** Step of PageUp/PageDown.
|
|
9408
|
+
* @default step * 10
|
|
9409
|
+
*/
|
|
9410
|
+
largeStep?: number;
|
|
9411
|
+
/**
|
|
9412
|
+
* Decimals every committed value is rounded to, typed or stepped (0–20); the number is not
|
|
9413
|
+
* padded (use `displayValue` for `1.00`). Default: steps round to the decimals of `step` and
|
|
9414
|
+
* the value, typed values are kept as typed.
|
|
9415
|
+
*/
|
|
9416
|
+
precision?: number;
|
|
9417
|
+
/** Whether the spin button is disabled and non-interactive. */
|
|
9418
|
+
disabled?: boolean;
|
|
9419
|
+
/** Form field name. With a name, the committed value is submitted with the form. */
|
|
9420
|
+
name?: string;
|
|
9421
|
+
/** Id of the form the spin button belongs to, when it is rendered outside that form. */
|
|
9422
|
+
form?: string;
|
|
9423
|
+
/**
|
|
9424
|
+
* Names of the −/+ step buttons (not tab stops, but in the accessibility tree), for
|
|
9425
|
+
* localization. Unset members keep their English defaults.
|
|
9426
|
+
*/
|
|
9427
|
+
labels?: SpinButtonLabels;
|
|
9428
|
+
/**
|
|
9429
|
+
* Text shown for the value while the field is not being edited, and its `aria-valuetext` (a
|
|
9430
|
+
* `$1.00` for 1). While the field has focus and can be edited it shows the plain number, so
|
|
9431
|
+
* typing edits the number. Applies only while `value` is controlled (update it with the
|
|
9432
|
+
* value); Fluent's `displayValue`.
|
|
9433
|
+
*/
|
|
9434
|
+
displayValue?: string;
|
|
9435
|
+
/**
|
|
9436
|
+
* Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the
|
|
9437
|
+
* surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`.
|
|
9438
|
+
*
|
|
9439
|
+
* SpinButton is 24, 32 or 40px tall like every field; its buttons are square-ish, 24, 32 or
|
|
9440
|
+
* 40px wide.
|
|
9441
|
+
*/
|
|
9442
|
+
size?: CoreSize;
|
|
9443
|
+
/**
|
|
9444
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
9445
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a
|
|
9446
|
+
* visible label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
9447
|
+
*
|
|
9448
|
+
* The step buttons keep a 1px separator from the input only in `outline`; the other
|
|
9449
|
+
* appearances have none.
|
|
9450
|
+
*/
|
|
9451
|
+
appearance?: InputAppearance;
|
|
9452
|
+
/** Ref to the root `<div>`. */
|
|
9453
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
9454
|
+
/** Ref to the `<input role="spinbutton">` (the focusable control). */
|
|
9455
|
+
controlRef?: React_2.Ref<HTMLInputElement>;
|
|
9456
|
+
}
|
|
9457
|
+
|
|
7470
9458
|
/**
|
|
7471
9459
|
* SpinButton: `root` on the outer element; `decrementButton` on the − button; `input` on the
|
|
7472
9460
|
* `role="spinbutton"` input; `incrementButton` on the + button.
|
|
@@ -7499,8 +9487,14 @@ export declare interface SpinButtonLabels {
|
|
|
7499
9487
|
decrement?: string;
|
|
7500
9488
|
}
|
|
7501
9489
|
|
|
7502
|
-
/**
|
|
7503
|
-
export declare interface SpinButtonProps extends
|
|
9490
|
+
/** SpinButton props with a number value (the 0.7 shape). */
|
|
9491
|
+
export declare interface SpinButtonProps extends SpinButtonBaseProps {
|
|
9492
|
+
/**
|
|
9493
|
+
* Allows an empty value (`null`). Takes the literal `true`: a `boolean` variable fits neither
|
|
9494
|
+
* member of the props, so branch the JSX or spread `{ allowEmpty: true, value }`.
|
|
9495
|
+
* @default false
|
|
9496
|
+
*/
|
|
9497
|
+
allowEmpty?: false;
|
|
7504
9498
|
/** Controlled numeric value. */
|
|
7505
9499
|
value?: number;
|
|
7506
9500
|
/** Initial value for uncontrolled usage (also what a form reset restores).
|
|
@@ -7518,37 +9512,6 @@ export declare interface SpinButtonProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
7518
9512
|
* @deprecated Use `onValueChange`. (`onChange` is reserved for native change events.)
|
|
7519
9513
|
*/
|
|
7520
9514
|
onChange?: (value: number) => void;
|
|
7521
|
-
/** Minimum allowed value.
|
|
7522
|
-
* @default -Infinity
|
|
7523
|
-
*/
|
|
7524
|
-
min?: number;
|
|
7525
|
-
/** Maximum allowed value.
|
|
7526
|
-
* @default Infinity
|
|
7527
|
-
*/
|
|
7528
|
-
max?: number;
|
|
7529
|
-
/** Step of the increment/decrement buttons and of ArrowUp/ArrowDown.
|
|
7530
|
-
* @default 1
|
|
7531
|
-
*/
|
|
7532
|
-
step?: number;
|
|
7533
|
-
/** Step of PageUp/PageDown.
|
|
7534
|
-
* @default step * 10
|
|
7535
|
-
*/
|
|
7536
|
-
largeStep?: number;
|
|
7537
|
-
/** Whether the spin button is disabled and non-interactive. */
|
|
7538
|
-
disabled?: boolean;
|
|
7539
|
-
/** Form field name. With a name, the committed value is submitted with the form. */
|
|
7540
|
-
name?: string;
|
|
7541
|
-
/** Id of the form the spin button belongs to, when it is rendered outside that form. */
|
|
7542
|
-
form?: string;
|
|
7543
|
-
/**
|
|
7544
|
-
* Names of the −/+ step buttons (not tab stops, but in the accessibility tree), for
|
|
7545
|
-
* localization. Unset members keep their English defaults.
|
|
7546
|
-
*/
|
|
7547
|
-
labels?: SpinButtonLabels;
|
|
7548
|
-
/** Ref to the root `<div>`. */
|
|
7549
|
-
ref?: React_2.Ref<HTMLDivElement>;
|
|
7550
|
-
/** Ref to the `<input role="spinbutton">` (the focusable control). */
|
|
7551
|
-
controlRef?: React_2.Ref<HTMLInputElement>;
|
|
7552
9515
|
}
|
|
7553
9516
|
|
|
7554
9517
|
/**
|
|
@@ -7819,6 +9782,14 @@ export declare interface StackOwnProps {
|
|
|
7819
9782
|
*/
|
|
7820
9783
|
export declare type StackProps<C extends React_2.ElementType = 'div'> = PolymorphicProps<C, StackOwnProps>;
|
|
7821
9784
|
|
|
9785
|
+
/**
|
|
9786
|
+
* The first day of `date`'s week, at local midnight; the time of day is dropped.
|
|
9787
|
+
*
|
|
9788
|
+
* @param firstDayOfWeek The weekday weeks start on (0 is Sunday).
|
|
9789
|
+
* @default 0
|
|
9790
|
+
*/
|
|
9791
|
+
export declare function startOfWeek(date: Date, firstDayOfWeek?: DayOfWeek): Date;
|
|
9792
|
+
|
|
7822
9793
|
/** Semantic status used for alerts, messages, and status indicators. */
|
|
7823
9794
|
export declare type Status = 'success' | 'warning' | 'error' | 'info';
|
|
7824
9795
|
|
|
@@ -7983,37 +9954,87 @@ export declare interface SwatchItem {
|
|
|
7983
9954
|
}
|
|
7984
9955
|
|
|
7985
9956
|
/**
|
|
7986
|
-
* A single-select
|
|
9957
|
+
* A single-select set of color swatches: a radio group (the default row layout) or a grid of rows
|
|
9958
|
+
* (`layout="grid"`).
|
|
7987
9959
|
*
|
|
7988
|
-
* - **
|
|
7989
|
-
* arrow keys move focus and select (Left/Right
|
|
7990
|
-
* ends; Home/End jump to the first/last swatch.
|
|
9960
|
+
* - **Row layout** (APG radio group, `role="radiogroup"` of `role="radio"` buttons): one tab stop,
|
|
9961
|
+
* the selected swatch, else the first. All four arrow keys move focus and select (Left/Right
|
|
9962
|
+
* mirrored under `dir="rtl"`), wrapping at the ends; Home/End jump to the first/last swatch.
|
|
9963
|
+
* - **Grid layout** (APG grid, `role="grid"` of `SwatchPicker.Row` rows whose cells hold the
|
|
9964
|
+
* swatch buttons, the selected one `aria-selected` and pressed): the arrow keys move focus only.
|
|
9965
|
+
* Left/Right go through the cells in reading order across rows (mirrored under `dir="rtl"`) and
|
|
9966
|
+
* stop at the grid's first and last cell; Up/Down go to the nearest enabled cell of the
|
|
9967
|
+
* previous/next row; Home/End to the first/last cell of the row, Ctrl+Home/End of the grid.
|
|
9968
|
+
* Space, Enter and a click select. One tab stop: the last focused cell, starting at the
|
|
9969
|
+
* selected swatch, else the first. `items`, and every run of children that are not rows, render
|
|
9970
|
+
* in a row of their own; rows do not wrap.
|
|
7991
9971
|
* - **Selected indicator**: an offset ring in the foreground color (drawn on the page background,
|
|
7992
9972
|
* not on the swatch) plus a check glyph whose color is picked by the swatch's luminance, so the
|
|
7993
9973
|
* selection never relies on color alone.
|
|
7994
|
-
* - **Naming**: give the
|
|
9974
|
+
* - **Naming**: give the picker a name with `aria-label`/`aria-labelledby` or render it inside a
|
|
7995
9975
|
* `Field`, and give every item a `label`; both are reported in development when missing.
|
|
7996
9976
|
* - **Forms**: with `name` (or `required`) it takes part in native forms; a form reset restores
|
|
7997
|
-
* `defaultValue`.
|
|
9977
|
+
* `defaultValue`. A required grid says so in its description (`labels.required`), since its
|
|
9978
|
+
* role does not allow `aria-required`.
|
|
9979
|
+
* - **Composition**: `items` render as `ColorSwatch` elements before `children`. A `ColorSwatch`,
|
|
9980
|
+
* `ImageSwatch` or `EmptySwatch` rendered directly as a child lets you wrap it, for example in
|
|
9981
|
+
* a `Tooltip` with `relationship="label"` to name and describe it. A swatch rendered outside any
|
|
9982
|
+
* `SwatchPicker` throws in development. React Server Components use the flat `SwatchPickerRow`
|
|
9983
|
+
* name for `SwatchPicker.Row`.
|
|
7998
9984
|
*
|
|
7999
9985
|
* @example
|
|
8000
9986
|
* <SwatchPicker aria-label="Accent color" items={[{ value: 'red', color: '#d13438', label: 'Red' }]} />
|
|
9987
|
+
*
|
|
9988
|
+
* @example
|
|
9989
|
+
* <SwatchPicker layout="grid" aria-label="Accent color">
|
|
9990
|
+
* <SwatchPicker.Row>
|
|
9991
|
+
* <ColorSwatch value="red" color="#d13438" aria-label="Red" />
|
|
9992
|
+
* <ColorSwatch value="blue" color="#0f6cbd" aria-label="Blue" />
|
|
9993
|
+
* </SwatchPicker.Row>
|
|
9994
|
+
* <SwatchPicker.Row>
|
|
9995
|
+
* <ColorSwatch value="green" color="#107c10" aria-label="Green" />
|
|
9996
|
+
* <EmptySwatch onClick={openColorDialog} />
|
|
9997
|
+
* </SwatchPicker.Row>
|
|
9998
|
+
* </SwatchPicker>
|
|
8001
9999
|
*/
|
|
8002
10000
|
export declare const SwatchPicker: {
|
|
8003
|
-
({ items, value: valueProp, defaultValue, onValueChange, onChange, size, shape, name, required, form, className, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, onKeyDown, onFocus, ref, ...rest }: SwatchPickerProps): React_2.JSX.Element;
|
|
10001
|
+
({ items, value: valueProp, defaultValue, onValueChange, onChange, children, layout, focusMode, labels, size, shape, spacing, name, required, form, className, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, onKeyDown, onFocus, ref, ...rest }: SwatchPickerProps): React_2.JSX.Element;
|
|
8004
10002
|
displayName: string;
|
|
10003
|
+
} & {
|
|
10004
|
+
Row: {
|
|
10005
|
+
({ className, ref, ...rest }: SwatchPickerRowProps): React_2.JSX.Element;
|
|
10006
|
+
displayName: string;
|
|
10007
|
+
};
|
|
8005
10008
|
};
|
|
8006
10009
|
|
|
8007
|
-
/**
|
|
10010
|
+
/**
|
|
10011
|
+
* SwatchPicker: `root` on the picker element (`role="radiogroup"`, or `role="grid"` in the grid
|
|
10012
|
+
* layout); `swatch` on the button of every swatch in it (`items`, and the `ColorSwatch`,
|
|
10013
|
+
* `ImageSwatch` and `EmptySwatch` children, next to their own classes).
|
|
10014
|
+
*/
|
|
8008
10015
|
export declare const swatchPickerClassNames: {
|
|
8009
10016
|
readonly root: "wave-swatch-picker";
|
|
8010
10017
|
readonly swatch: "wave-swatch-picker__swatch";
|
|
8011
10018
|
};
|
|
8012
10019
|
|
|
10020
|
+
/** Built-in strings of the SwatchPicker component (C-NAMING). */
|
|
10021
|
+
export declare interface SwatchPickerLabels {
|
|
10022
|
+
/**
|
|
10023
|
+
* Said where the picker's role cannot carry `aria-required` (the grid layout, and the group of
|
|
10024
|
+
* `focusMode="tab"`): a hidden text
|
|
10025
|
+
* joined into the picker's description while it is required.
|
|
10026
|
+
* @default 'Required'
|
|
10027
|
+
*/
|
|
10028
|
+
required?: string;
|
|
10029
|
+
}
|
|
10030
|
+
|
|
8013
10031
|
/** Properties for the SwatchPicker component. */
|
|
8014
10032
|
export declare interface SwatchPickerProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
8015
|
-
/**
|
|
8016
|
-
|
|
10033
|
+
/**
|
|
10034
|
+
* The swatches to display, in order (a readonly array is accepted; it is never modified):
|
|
10035
|
+
* rendered as `ColorSwatch` elements, before `children`.
|
|
10036
|
+
*/
|
|
10037
|
+
items?: readonly SwatchItem[];
|
|
8017
10038
|
/** Controlled selected swatch value (`''` = nothing selected). */
|
|
8018
10039
|
value?: string;
|
|
8019
10040
|
/** Initial selected value for uncontrolled usage (also what a form reset restores).
|
|
@@ -8027,11 +10048,46 @@ export declare interface SwatchPickerProps extends Omit<React_2.HTMLAttributes<H
|
|
|
8027
10048
|
* @deprecated Use `onValueChange`.
|
|
8028
10049
|
*/
|
|
8029
10050
|
onChange?: (value: string) => void;
|
|
8030
|
-
/**
|
|
10051
|
+
/**
|
|
10052
|
+
* Swatches rendered directly, in order, after `items` (e.g. `ColorSwatch`): read the picker's
|
|
10053
|
+
* context, so they may be wrapped in a `Tooltip` or another element that forwards its own props.
|
|
10054
|
+
* `SwatchPicker.Row` elements start rows; in the grid layout every run of other children (and
|
|
10055
|
+
* `items`, with the children that follow them) renders in a row of its own. A `SwatchPicker.Row`
|
|
10056
|
+
* must be a direct child or inside a Fragment: a wrapper component around a Row lands in an
|
|
10057
|
+
* implicit row, and nested rows are reported in development.
|
|
10058
|
+
*/
|
|
10059
|
+
children?: React_2.ReactNode;
|
|
10060
|
+
/**
|
|
10061
|
+
* `'row'`: a radio group whose arrow keys select (and wrap). `'grid'`: rows of cells
|
|
10062
|
+
* (`SwatchPicker.Row`) whose arrow keys move focus in two dimensions without selecting; Space,
|
|
10063
|
+
* Enter and a click select. Changing it while mounted remounts the swatches, so focus falls
|
|
10064
|
+
* back to the page.
|
|
10065
|
+
* @default 'row'
|
|
10066
|
+
*/
|
|
10067
|
+
layout?: 'row' | 'grid';
|
|
10068
|
+
/**
|
|
10069
|
+
* `'arrow'`: one tab stop and arrow keys, with the radio group (row layout) or grid (grid
|
|
10070
|
+
* layout) semantics. `'tab'`: every enabled swatch is its own tab stop and the arrow keys do
|
|
10071
|
+
* nothing, so the picker is a `role="group"` of toggle buttons (`aria-pressed`, the selected
|
|
10072
|
+
* one pressed) in both layouts; rows have no role, and Space, Enter and a click select
|
|
10073
|
+
* (pressing the selected swatch again keeps it selected). The required hint (`labels.required`)
|
|
10074
|
+
* applies, as the group cannot carry `aria-required`.
|
|
10075
|
+
* @default 'arrow'
|
|
10076
|
+
*/
|
|
10077
|
+
focusMode?: 'arrow' | 'tab';
|
|
10078
|
+
/** Built-in strings, for localization. */
|
|
10079
|
+
labels?: SwatchPickerLabels;
|
|
10080
|
+
/** Size of each swatch button (20, 24, 32 or 40px). A 20px swatch passes the target-size bar
|
|
10081
|
+
* through its spacing; a swatch's own `size` overrides this.
|
|
8031
10082
|
* @default 'medium'
|
|
8032
10083
|
*/
|
|
8033
10084
|
size?: SwatchPickerSize;
|
|
8034
|
-
/**
|
|
10085
|
+
/** Gap between swatches (and between rows): 4px or 8px. At `'small'` the focus outline's offset shrinks from 4px to
|
|
10086
|
+
* 2px, so it does not cover the neighbour.
|
|
10087
|
+
* @default 'medium'
|
|
10088
|
+
*/
|
|
10089
|
+
spacing?: 'small' | 'medium';
|
|
10090
|
+
/** Shape of each swatch button (a swatch's own `shape` overrides this).
|
|
8035
10091
|
* @default 'circular'
|
|
8036
10092
|
*/
|
|
8037
10093
|
shape?: Shape;
|
|
@@ -8040,16 +10096,61 @@ export declare interface SwatchPickerProps extends Omit<React_2.HTMLAttributes<H
|
|
|
8040
10096
|
* (nothing while no swatch is selected).
|
|
8041
10097
|
*/
|
|
8042
10098
|
name?: string;
|
|
8043
|
-
/**
|
|
10099
|
+
/**
|
|
10100
|
+
* A swatch must be selected before the form can be submitted (native validation). The row
|
|
10101
|
+
* layout says so with `aria-required`; the grid layout and tab mode, whose roles do not allow
|
|
10102
|
+
* it, with the hidden `labels.required` text in the description (which a consumer
|
|
10103
|
+
* `aria-required` alone also shows).
|
|
10104
|
+
*/
|
|
8044
10105
|
required?: boolean;
|
|
8045
10106
|
/** Id of the form the picker belongs to, when it is rendered outside that form. */
|
|
8046
10107
|
form?: string;
|
|
8047
|
-
/**
|
|
10108
|
+
/**
|
|
10109
|
+
* Ref to the root element: `role="radiogroup"`, `role="grid"` in the grid layout, or
|
|
10110
|
+
* `role="group"` in tab mode.
|
|
10111
|
+
*/
|
|
10112
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
10113
|
+
}
|
|
10114
|
+
|
|
10115
|
+
/**
|
|
10116
|
+
* One row of swatches in a `SwatchPicker` (also exported as the flat `SwatchPickerRow`, for React
|
|
10117
|
+
* Server Components). In the grid layout it is a `role="row"` element whose swatches are its
|
|
10118
|
+
* cells; Up and Down move between rows, and the row does not wrap (a wrapped swatch would sit
|
|
10119
|
+
* where Up and Down do not reach it): size it yourself. In the row layout and in tab mode
|
|
10120
|
+
* (`focusMode="tab"`) it is a full-width line without a role, and its swatches stay radios of the
|
|
10121
|
+
* one group (row layout) or toggle buttons. Place it as a direct child of the `SwatchPicker` or
|
|
10122
|
+
* inside a Fragment: a wrapper component around a Row lands in an implicit row, and a Row inside
|
|
10123
|
+
* a Row is reported in development. Outside a `SwatchPicker` it throws in development.
|
|
10124
|
+
*
|
|
10125
|
+
* @example
|
|
10126
|
+
* <SwatchPicker layout="grid" aria-label="Accent color">
|
|
10127
|
+
* <SwatchPicker.Row>
|
|
10128
|
+
* <ColorSwatch value="red" color="#d13438" aria-label="Red" />
|
|
10129
|
+
* <ColorSwatch value="blue" color="#0f6cbd" aria-label="Blue" />
|
|
10130
|
+
* </SwatchPicker.Row>
|
|
10131
|
+
* </SwatchPicker>
|
|
10132
|
+
*/
|
|
10133
|
+
export declare const SwatchPickerRow: {
|
|
10134
|
+
({ className, ref, ...rest }: SwatchPickerRowProps): React_2.JSX.Element;
|
|
10135
|
+
displayName: string;
|
|
10136
|
+
};
|
|
10137
|
+
|
|
10138
|
+
/**
|
|
10139
|
+
* SwatchPicker.Row: `root` on the row element (`role="row"` in the grid layout), also on the rows
|
|
10140
|
+
* the picker adds around `items` and loose swatches.
|
|
10141
|
+
*/
|
|
10142
|
+
export declare const swatchPickerRowClassNames: {
|
|
10143
|
+
readonly root: "wave-swatch-picker-row";
|
|
10144
|
+
};
|
|
10145
|
+
|
|
10146
|
+
/** Properties for the SwatchPicker.Row component. */
|
|
10147
|
+
export declare interface SwatchPickerRowProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
10148
|
+
/** Ref to the row element. */
|
|
8048
10149
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
8049
10150
|
}
|
|
8050
10151
|
|
|
8051
|
-
/** Size of the swatches. */
|
|
8052
|
-
export declare type SwatchPickerSize = Extract<Size, 'small' | 'medium' | 'large'>;
|
|
10152
|
+
/** Size of the swatches: 20, 24, 32 or 40px. */
|
|
10153
|
+
export declare type SwatchPickerSize = Extract<Size, 'extra-small' | 'small' | 'medium' | 'large'>;
|
|
8053
10154
|
|
|
8054
10155
|
/**
|
|
8055
10156
|
* An on/off toggle drawn as a `role="switch"` button inside a `<label>`.
|
|
@@ -8069,9 +10170,11 @@ export declare type SwatchPickerSize = Extract<Size, 'small' | 'medium' | 'large
|
|
|
8069
10170
|
* `labelPosition` (the root carries `data-label-position`). Beside the label, the switch lines
|
|
8070
10171
|
* up with the first line of a label that wraps or has a second line. `children` are not
|
|
8071
10172
|
* rendered (a development warning says so).
|
|
10173
|
+
* - `size` (`small`, `medium`) sets the track and thumb dimensions; the root carries `data-size`.
|
|
10174
|
+
* Switch does not read a surrounding `Field`'s size or a `WaveProvider`'s input defaults.
|
|
8072
10175
|
*/
|
|
8073
10176
|
export declare const Switch: {
|
|
8074
|
-
({ checked: checkedProp, defaultChecked, onCheckedChange, onChange, disabled, disabledFocusable, label, labelPosition, name, value, required, form, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, "aria-details": ariaDetails, "aria-disabled": ariaDisabled, autoFocus, tabIndex, onClick, onFocus, onBlur, onKeyDown, onKeyUp, controlRef, className, children, ref, ...rest }: SwitchProps): React_2.JSX.Element;
|
|
10177
|
+
({ checked: checkedProp, defaultChecked, onCheckedChange, onChange, disabled, disabledFocusable, label, labelPosition, size, name, value, required, form, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, "aria-details": ariaDetails, "aria-disabled": ariaDisabled, autoFocus, tabIndex, onClick, onFocus, onBlur, onKeyDown, onKeyUp, controlRef, className, children, ref, ...rest }: SwitchProps): React_2.JSX.Element;
|
|
8075
10178
|
displayName: string;
|
|
8076
10179
|
};
|
|
8077
10180
|
|
|
@@ -8134,6 +10237,14 @@ export declare interface SwitchProps extends Omit<React_2.HTMLAttributes<HTMLLab
|
|
|
8134
10237
|
* @default 'after'
|
|
8135
10238
|
*/
|
|
8136
10239
|
labelPosition?: SwitchLabelPosition;
|
|
10240
|
+
/**
|
|
10241
|
+
* Size of the track: the 0.7 40x20 track with a 14px thumb, or a small 32x16 track with a 10px
|
|
10242
|
+
* thumb and a 24px-tall pointer target. Unlike the text controls and pickers, Switch does not
|
|
10243
|
+
* read a surrounding Field's size or a WaveProvider's input defaults: this prop is the only
|
|
10244
|
+
* source of its size.
|
|
10245
|
+
* @default 'medium'
|
|
10246
|
+
*/
|
|
10247
|
+
size?: SwitchSize;
|
|
8137
10248
|
/**
|
|
8138
10249
|
* Form field name. With a name, the switch takes part in native form submission: it submits
|
|
8139
10250
|
* `name=value` while on.
|
|
@@ -8163,6 +10274,9 @@ export declare interface SwitchProps extends Omit<React_2.HTMLAttributes<HTMLLab
|
|
|
8163
10274
|
ref?: React_2.Ref<HTMLLabelElement>;
|
|
8164
10275
|
}
|
|
8165
10276
|
|
|
10277
|
+
/** Size of the track: a 32x16 track with a 10px thumb, or the 0.7 40x20 track with a 14px thumb. */
|
|
10278
|
+
export declare type SwitchSize = Extract<Size, 'small' | 'medium'>;
|
|
10279
|
+
|
|
8166
10280
|
/**
|
|
8167
10281
|
* A non-interactive data table with an optional striped body. The table sits in a horizontally
|
|
8168
10282
|
* scrollable wrapper; while it scrolls, the wrapper is a focusable region (named by
|
|
@@ -8619,7 +10733,10 @@ export declare interface TagOwnProps {
|
|
|
8619
10733
|
* surrounding form), Escape closes the list (and then clears the typed text). Backspace in the
|
|
8620
10734
|
* empty input moves focus to the last tag; Backspace or Delete there removes it. Additions and
|
|
8621
10735
|
* removals are announced ("Cherry removed, 2 selected"), and so is "No matches" for text that
|
|
8622
|
-
* matches no option.
|
|
10736
|
+
* matches no option. `filter` replaces the match (it may keep options that do not contain the
|
|
10737
|
+
* text, for a server-side search or a "Create …" entry), and `query`/`defaultQuery`/
|
|
10738
|
+
* `onQueryChange` control the typed text, which resets to `''` when a tag is added, on Escape and
|
|
10739
|
+
* on a form reset, and stays on a blur.
|
|
8623
10740
|
*
|
|
8624
10741
|
* The tags form a list named "Selected"; the input is described by a summary of the selected
|
|
8625
10742
|
* labels ("Selected: Apple, Banana"). These built-in texts are English; `labels` localizes them.
|
|
@@ -8634,6 +10751,12 @@ export declare interface TagOwnProps {
|
|
|
8634
10751
|
* Selected values without a matching option are shown with their raw value. The open list renders
|
|
8635
10752
|
* only in the browser: an open list (`defaultOpen`, `open`) is closed in the server HTML and opens
|
|
8636
10753
|
* once the picker has hydrated.
|
|
10754
|
+
*
|
|
10755
|
+
* **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
10756
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'` (a Field or provider `small`
|
|
10757
|
+
* gives `'medium'` too, since TagPicker has no `small`); `appearance` from its own prop, then
|
|
10758
|
+
* `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and
|
|
10759
|
+
* `data-appearance` on the root `<div>`. The option list keeps its size.
|
|
8637
10760
|
*/
|
|
8638
10761
|
export declare const TagPicker: {
|
|
8639
10762
|
(props: TagPickerProps): React_2.JSX.Element;
|
|
@@ -8740,12 +10863,55 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
8740
10863
|
* @default 'Select...'
|
|
8741
10864
|
*/
|
|
8742
10865
|
placeholder?: string;
|
|
10866
|
+
/**
|
|
10867
|
+
* Whether an option matches the typed text (the query). Called with every listed option (its
|
|
10868
|
+
* `value` and `label`; selected options are not listed) and the text whenever the text is not
|
|
10869
|
+
* empty; an option it returns `false` for is filtered out. It may keep options that do not
|
|
10870
|
+
* contain the text: `filter={() => true}` with `query` and `onQueryChange` leaves the matching
|
|
10871
|
+
* to you (a server-side search that replaces `options`), and a filter that always keeps an
|
|
10872
|
+
* option of your own gives a "Create …" entry. With a server-side search, keep the selected
|
|
10873
|
+
* options in `options` (they are never listed): a selected value without an option shows its raw
|
|
10874
|
+
* value as the tag label, with a development warning (the "Async search" story does this).
|
|
10875
|
+
* @default a case-insensitive substring match on the option's `label`
|
|
10876
|
+
*/
|
|
10877
|
+
filter?: (option: ListboxItem, query: string) => boolean;
|
|
10878
|
+
/**
|
|
10879
|
+
* Controlled query: the text typed since the last tag was added, which filters the options and
|
|
10880
|
+
* shows in the input (hidden while `disabled` or `readOnly`).
|
|
10881
|
+
*/
|
|
10882
|
+
query?: string;
|
|
10883
|
+
/**
|
|
10884
|
+
* Initial query for uncontrolled usage. A TagPicker that starts disabled or read-only starts
|
|
10885
|
+
* without it (as it starts closed).
|
|
10886
|
+
* @default ''
|
|
10887
|
+
*/
|
|
10888
|
+
defaultQuery?: string;
|
|
10889
|
+
/**
|
|
10890
|
+
* Called with the new query when it changes: as the user types, and with `''` when it resets (a
|
|
10891
|
+
* tag added, Escape on the closed list, a form reset, or `disabled` or `readOnly` turned on
|
|
10892
|
+
* while text is typed). A blur or a close keeps the text. A TagPicker that mounts disabled or
|
|
10893
|
+
* read-only reports nothing: it keeps a controlled query, which shows once it unlocks.
|
|
10894
|
+
*/
|
|
10895
|
+
onQueryChange?: (query: string) => void;
|
|
8743
10896
|
/**
|
|
8744
10897
|
* Whether the tag picker is disabled: nothing can be added or removed, and the remove buttons
|
|
8745
10898
|
* leave the tab order.
|
|
8746
10899
|
* @default false
|
|
8747
10900
|
*/
|
|
8748
10901
|
disabled?: boolean;
|
|
10902
|
+
/**
|
|
10903
|
+
* Size of the tags and the field: `medium` (the 0.7 look), `large` or `extra-large` (Fluent's
|
|
10904
|
+
* union; TagPicker has no `small`). Default: the surrounding Field's `size`, else `WaveProvider
|
|
10905
|
+
* inputDefaults.size`, else `'medium'`; a Field or provider `small` gives `'medium'` too. The
|
|
10906
|
+
* option list keeps its size.
|
|
10907
|
+
*/
|
|
10908
|
+
size?: TagPickerSize;
|
|
10909
|
+
/**
|
|
10910
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
10911
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
10912
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
10913
|
+
*/
|
|
10914
|
+
appearance?: InputAppearance;
|
|
8749
10915
|
/** Name of the values in form submissions (one hidden input per value). */
|
|
8750
10916
|
name?: string;
|
|
8751
10917
|
/** Id of the form the values belong to, when the TagPicker is outside it. */
|
|
@@ -8793,6 +10959,9 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
8793
10959
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
8794
10960
|
}
|
|
8795
10961
|
|
|
10962
|
+
/** Sizes of TagPicker (Fluent's): medium (the 0.7 look), large and extra-large. */
|
|
10963
|
+
export declare type TagPickerSize = Extract<Size, 'medium' | 'large' | 'extra-large'>;
|
|
10964
|
+
|
|
8796
10965
|
/**
|
|
8797
10966
|
* Props of {@link Tag} rendered as `C` (default `'span'`). `TagProps` without a type argument is
|
|
8798
10967
|
* the 0.4 name.
|
|
@@ -8975,13 +11144,18 @@ export { Text_2 as Text }
|
|
|
8975
11144
|
* bottom border while focused). Inside a `Field` it picks up the label, hint, error, `required`
|
|
8976
11145
|
* (native attribute) and invalid state automatically.
|
|
8977
11146
|
*
|
|
11147
|
+
* `size` resolves from its own prop, then the surrounding `Field`'s `size`, then
|
|
11148
|
+
* `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own prop, then
|
|
11149
|
+
* `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and
|
|
11150
|
+
* `data-appearance` on the textarea element.
|
|
11151
|
+
*
|
|
8978
11152
|
* @example
|
|
8979
11153
|
* <Field label="Description" hint="Markdown is supported">
|
|
8980
11154
|
* <Textarea rows={4} />
|
|
8981
11155
|
* </Field>
|
|
8982
11156
|
*/
|
|
8983
11157
|
export declare const Textarea: {
|
|
8984
|
-
({ error, errorMessageProps, className, ref, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, required, ...props }: TextareaProps): React_2.JSX.Element;
|
|
11158
|
+
({ error, errorMessageProps, size: sizeProp, appearance: appearanceProp, className, ref, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-errormessage": ariaErrorMessage, required, ...props }: TextareaProps): React_2.JSX.Element;
|
|
8985
11159
|
displayName: string;
|
|
8986
11160
|
};
|
|
8987
11161
|
|
|
@@ -9009,6 +11183,18 @@ export declare interface TextareaProps extends React_2.TextareaHTMLAttributes<HT
|
|
|
9009
11183
|
error?: string | boolean;
|
|
9010
11184
|
/** Props of the error message element (`id`, `className`, …) rendered for a string `error`. */
|
|
9011
11185
|
errorMessageProps?: InputErrorMessageProps;
|
|
11186
|
+
/**
|
|
11187
|
+
* Size of the field, a minimum height with its type ramp: `small` (64px, Caption 1 text),
|
|
11188
|
+
* `medium` (80px, Body 1) or `large` (96px, Body 2). Default: the surrounding Field's `size`,
|
|
11189
|
+
* else `WaveProvider inputDefaults.size`, else `'medium'`.
|
|
11190
|
+
*/
|
|
11191
|
+
size?: CoreSize;
|
|
11192
|
+
/**
|
|
11193
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
11194
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
11195
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
11196
|
+
*/
|
|
11197
|
+
appearance?: InputAppearance;
|
|
9012
11198
|
/** Ref to the `<textarea>` element. */
|
|
9013
11199
|
ref?: React_2.Ref<HTMLTextAreaElement>;
|
|
9014
11200
|
}
|
|
@@ -9076,6 +11262,10 @@ export declare type TextWeight = 'regular' | 'semibold' | 'bold';
|
|
|
9076
11262
|
* picker instead of to the clear button that disappears.
|
|
9077
11263
|
* - The value is `HH:mm` (24-hour) whatever the display `format`; values off the `step` grid or
|
|
9078
11264
|
* outside the bounds are still displayed in `format`.
|
|
11265
|
+
* - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
11266
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own
|
|
11267
|
+
* prop, then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as
|
|
11268
|
+
* `data-size` and `data-appearance` on the root `<div>`. The time list keeps its size.
|
|
9079
11269
|
* - The input (`controlRef`) receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,
|
|
9080
11270
|
* `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`,
|
|
9081
11271
|
* `autoFocus`, `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes
|
|
@@ -9204,6 +11394,18 @@ export declare interface TimePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
9204
11394
|
* @default false
|
|
9205
11395
|
*/
|
|
9206
11396
|
disabled?: boolean;
|
|
11397
|
+
/**
|
|
11398
|
+
* Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the
|
|
11399
|
+
* surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`. The time
|
|
11400
|
+
* list keeps its size.
|
|
11401
|
+
*/
|
|
11402
|
+
size?: CoreSize;
|
|
11403
|
+
/**
|
|
11404
|
+
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
11405
|
+
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
11406
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
11407
|
+
*/
|
|
11408
|
+
appearance?: InputAppearance;
|
|
9207
11409
|
/**
|
|
9208
11410
|
* Makes the input read-only: the list does not open and the value cannot change. Turning it (or
|
|
9209
11411
|
* `disabled`) on while the user is typing drops the typed text.
|
|
@@ -10479,6 +12681,94 @@ export declare interface TreeProps extends React_2.HTMLAttributes<HTMLDivElement
|
|
|
10479
12681
|
/** Typography scale variant mapping to Fluent UI type ramp tokens. */
|
|
10480
12682
|
export declare type TypographyVariant = 'caption-2' | 'caption-1' | 'body-1' | 'body-2' | 'subtitle-2' | 'subtitle-1' | 'title-3' | 'title-2' | 'title-1' | 'large-title' | 'display';
|
|
10481
12683
|
|
|
12684
|
+
/**
|
|
12685
|
+
* The active (virtually focused) item of a composite that keeps DOM focus on one element and points
|
|
12686
|
+
* `aria-activedescendant` at the active item: a combobox, a listbox that holds focus, a command
|
|
12687
|
+
* palette. The state is React state, so the active id is derived during render (server HTML
|
|
12688
|
+
* included) and nothing reads the DOM during render.
|
|
12689
|
+
*
|
|
12690
|
+
* - The moved-to item is dropped when it leaves `items` or while `enabled` is `false`, and does not
|
|
12691
|
+
* come back without a user action; `fallback` is active while nothing was moved to.
|
|
12692
|
+
* - Keyboard and programmatic moves are scrolled into view (`{ block: 'nearest' }`); pointer moves
|
|
12693
|
+
* (`highlight`) and `setActiveValue(value, { scroll: false })` are not.
|
|
12694
|
+
* - `onActiveValueChange` reports every change after the commit, once (StrictMode included).
|
|
12695
|
+
*
|
|
12696
|
+
* `useListbox` is built on it; use it directly for composites that are not listboxes.
|
|
12697
|
+
*
|
|
12698
|
+
* @example
|
|
12699
|
+
* const ad = useActiveDescendant({ items: results.map((r) => r.id), getId: (id) => `cmd-${id}`, enabled: open });
|
|
12700
|
+
* <input aria-activedescendant={ad.activeDescendantId} onKeyDown={(e) => { if (e.key === 'ArrowDown') ad.next(); }} />
|
|
12701
|
+
*/
|
|
12702
|
+
export declare function useActiveDescendant(options: UseActiveDescendantOptions): UseActiveDescendantResult;
|
|
12703
|
+
|
|
12704
|
+
/** Options of {@link useActiveDescendant}. */
|
|
12705
|
+
export declare interface UseActiveDescendantOptions {
|
|
12706
|
+
/** The values that can become active, in navigation order. */
|
|
12707
|
+
items: readonly string[];
|
|
12708
|
+
/** The DOM id of an item's element: the `aria-activedescendant` target. */
|
|
12709
|
+
getId: (value: string) => string;
|
|
12710
|
+
/**
|
|
12711
|
+
* While `false`, no item is active and the moved-to item is forgotten (a closed popup, an
|
|
12712
|
+
* unfocused list). A move made in the same update that enables the hook is kept.
|
|
12713
|
+
* @default true
|
|
12714
|
+
*/
|
|
12715
|
+
enabled?: boolean;
|
|
12716
|
+
/**
|
|
12717
|
+
* The active item while none was moved to, or after the moved-to item left `items` (the
|
|
12718
|
+
* selected option, for example). Ignored when it is not in `items`.
|
|
12719
|
+
* @default null
|
|
12720
|
+
*/
|
|
12721
|
+
fallback?: string | null;
|
|
12722
|
+
/** `next()` and `prev()` wrap at the ends. @default false */
|
|
12723
|
+
loop?: boolean;
|
|
12724
|
+
/**
|
|
12725
|
+
* Whenever `items` changes while the hook is enabled (compared by content), its first item
|
|
12726
|
+
* becomes active — also when the change comes with enabling (the keystroke that opens a
|
|
12727
|
+
* filtered list). Enabling with unchanged items keeps the fallback. It wins over a move made in
|
|
12728
|
+
* the same update.
|
|
12729
|
+
* @default false
|
|
12730
|
+
*/
|
|
12731
|
+
activateFirstOnChange?: boolean;
|
|
12732
|
+
/** The element of an item, for scrolling it into view. @default document.getElementById(getId(value)) */
|
|
12733
|
+
getElement?: (value: string) => HTMLElement | null;
|
|
12734
|
+
/** Called after the active item changed (from an effect), `null` included. */
|
|
12735
|
+
onActiveValueChange?: (value: string | null) => void;
|
|
12736
|
+
}
|
|
12737
|
+
|
|
12738
|
+
/** Result of {@link useActiveDescendant}. The methods have stable identities. */
|
|
12739
|
+
export declare interface UseActiveDescendantResult {
|
|
12740
|
+
/** The moved-to item, else the fallback; `null` while disabled. Derived during render. */
|
|
12741
|
+
activeValue: string | null;
|
|
12742
|
+
/** `getId(activeValue)`, or `undefined`: spread as `aria-activedescendant`. */
|
|
12743
|
+
activeDescendantId: string | undefined;
|
|
12744
|
+
/**
|
|
12745
|
+
* Moves to `value`, or back to the fallback with `null`. The value is kept as it is; the next
|
|
12746
|
+
* render drops it when it is not in that render's `items` or the hook is disabled, clearing any
|
|
12747
|
+
* earlier move. Scrolled into view unless `scroll` is `false`.
|
|
12748
|
+
*/
|
|
12749
|
+
setActiveValue: (value: string | null, options?: {
|
|
12750
|
+
scroll?: boolean;
|
|
12751
|
+
}) => void;
|
|
12752
|
+
/**
|
|
12753
|
+
* Moves to `value` for pointer movement, not scrolled into view; ignored while disabled, when
|
|
12754
|
+
* `value` is not in `items` or is already active.
|
|
12755
|
+
*/
|
|
12756
|
+
highlight: (value: string) => void;
|
|
12757
|
+
/** Moves to the first item. */
|
|
12758
|
+
first: () => void;
|
|
12759
|
+
/** Moves to the last item. */
|
|
12760
|
+
last: () => void;
|
|
12761
|
+
/** The item after the active one (the first when none is active); wraps with `loop`. */
|
|
12762
|
+
next: () => void;
|
|
12763
|
+
/** The item before the active one (the last when none is active); wraps with `loop`. */
|
|
12764
|
+
prev: () => void;
|
|
12765
|
+
/**
|
|
12766
|
+
* Moves `delta` items (PageDown: `move(10)`), clamped at the ends, never wrapping; from no active
|
|
12767
|
+
* item, a positive delta goes to the first item and a negative one to the last.
|
|
12768
|
+
*/
|
|
12769
|
+
move: (delta: number) => void;
|
|
12770
|
+
}
|
|
12771
|
+
|
|
10482
12772
|
/**
|
|
10483
12773
|
* Returns {@link announce} and keeps the shared live regions alive while the caller is mounted
|
|
10484
12774
|
* (they are created on mount and removed when the last caller unmounts).
|
|
@@ -10652,6 +12942,401 @@ export declare function useIsOverflowing(target: React_2.RefObject<HTMLElement |
|
|
|
10652
12942
|
*/
|
|
10653
12943
|
export declare function useIsOverflowItemVisible(itemId: string): boolean;
|
|
10654
12944
|
|
|
12945
|
+
/**
|
|
12946
|
+
* The listbox behaviour of Listbox, Combobox, Dropdown, TagPicker and TimePicker, and the base of a
|
|
12947
|
+
* custom picker: one navigable option list drives the highlight, `aria-activedescendant` and the
|
|
12948
|
+
* commit, so the highlighted option is always the one Enter selects. The highlight is
|
|
12949
|
+
* {@link useActiveDescendant}'s.
|
|
12950
|
+
*
|
|
12951
|
+
* - **Items.** Data mode (`items`) or registration mode: `Option`s, or option components of your
|
|
12952
|
+
* own on {@link useListboxOption}, register inside the listbox's context (`context`, which
|
|
12953
|
+
* `ListboxSurface` and `ListboxProvider` provide) in DOM order, `OptionGroup`s included. The
|
|
12954
|
+
* registrations of one commit are published once from this hook's layout effect (which runs
|
|
12955
|
+
* after the options'); later additions/removals are published once per microtask. A keyed
|
|
12956
|
+
* reorder of the same options re-sorts them: the DOM order is re-checked after a commit of this
|
|
12957
|
+
* hook's component that moved option elements (a highlight move moves none, so it costs O(1))
|
|
12958
|
+
* and, while it is mounted, whenever option elements move (a `MutationObserver` on their
|
|
12959
|
+
* common ancestor) — so memoized options or hoisted elements that a wrapper component inside
|
|
12960
|
+
* the listbox reorders are re-sorted too, although neither the options nor this component
|
|
12961
|
+
* render. Options register even when filtered out or hidden (they render `hidden` and are not
|
|
12962
|
+
* navigable), so labels are always known — use {@link collectOptionLabels} for the display text
|
|
12963
|
+
* before registration (SSR/first render). `filter` is the navigability predicate, which a
|
|
12964
|
+
* picker builds from its query.
|
|
12965
|
+
* - **Active option** is derived during render: the highlighted value, else the `autoHighlight`
|
|
12966
|
+
* fallback. The highlight is reset on close and after a single-select commit that closes the
|
|
12967
|
+
* listbox, and dropped once it is not navigable any more (filtered out, hidden, removed by an
|
|
12968
|
+
* update, or disabled without `disabledOptionsFocusable`), so it does not come back without a
|
|
12969
|
+
* user action when the option returns. With
|
|
12970
|
+
* `highlightOnFilter` the first option becomes active whenever the options change while open
|
|
12971
|
+
* (`useActiveDescendant`'s `activateFirstOnChange`). Editable: a text-editing key (printable
|
|
12972
|
+
* characters, Backspace/Delete, cut/paste/undo/redo) clears the highlight — visual focus
|
|
12973
|
+
* returns to the textbox (APG) — so Enter after typing never commits an option highlighted
|
|
12974
|
+
* before the edit; with `highlightOnFilter` the key makes the first option active instead.
|
|
12975
|
+
* - **Ids** `${listboxId}-opt-${n}` are stable per value (across filtering and remounts between
|
|
12976
|
+
* an inline closed list and a portaled open list).
|
|
12977
|
+
* - **Store.** Options read their active/selected/hidden flags through a store, so moving the
|
|
12978
|
+
* highlight re-renders only the old and the new option.
|
|
12979
|
+
* - **Keys (APG).** Editable: ArrowDown/ArrowUp open (selected, else first/last) and move;
|
|
12980
|
+
* Alt+ArrowDown opens without moving; Alt+ArrowUp closes; Enter commits the active option (with
|
|
12981
|
+
* the listbox closed Enter is not prevented, so forms submit); Escape closes (closed + text:
|
|
12982
|
+
* `onClearDraft`); Tab closes; Home/End/printable keys stay with the input (text-editing keys
|
|
12983
|
+
* clear the highlight, see above). Select-only:
|
|
12984
|
+
* ArrowDown/ArrowUp/Home/End/typeahead open and position (a closed typeahead starts from the
|
|
12985
|
+
* selected option; characters typed with AltGr, i.e. Ctrl+Alt on Windows, count); PageUp/PageDown
|
|
12986
|
+
* jump 10; Enter/Space open or commit (always prevented on keydown, Space also on keyup, so a
|
|
12987
|
+
* `<button>` combobox is not clicked again; a Space typed within 500 ms of a typeahead character
|
|
12988
|
+
* continues the search instead); Alt+ArrowUp and Tab commit and close in single-select mode
|
|
12989
|
+
* (with `multiselect` they only close; Tab is not prevented); Escape closes. Standalone (the
|
|
12990
|
+
* list has focus; nothing opens or closes): ArrowDown/ArrowUp move (from no active option to
|
|
12991
|
+
* the first/last), Home/End, PageUp/PageDown (10) and typeahead move; Enter and Space commit
|
|
12992
|
+
* and keep the committed option active (a Space typed within 500 ms of a typeahead character
|
|
12993
|
+
* continues the search instead); Tab, Escape and Alt+Arrow keys are not handled and not
|
|
12994
|
+
* prevented, so the page and enclosing layers get them.
|
|
12995
|
+
* "Selected" means the first selected navigable option in list order. Disabled options are
|
|
12996
|
+
* skipped unless `disabledOptionsFocusable`, and never committed; hidden options are not
|
|
12997
|
+
* navigable at all.
|
|
12998
|
+
* - The active option is scrolled into view (`{ block: 'nearest' }`) in a layout effect, except
|
|
12999
|
+
* after a pointer highlight or a pointer press (the list would scroll under the pointer).
|
|
13000
|
+
*
|
|
13001
|
+
* **Consumer contract** (Listbox, Combobox, Dropdown, TagPicker, TimePicker and custom pickers):
|
|
13002
|
+
* - All options of a listbox live in a single container at a time (inline only while closed,
|
|
13003
|
+
* portaled only while open — never both, not even for an exit animation; `ListboxSurface` does
|
|
13004
|
+
* this). Options split over two containers are watched from `<body>` and registered twice
|
|
13005
|
+
* (development warns).
|
|
13006
|
+
* - Spread `getComboboxProps()` onto the combobox element and attach **both** `onKeyDown` and
|
|
13007
|
+
* `onKeyUp` to it (compose them with your own handlers). `onKeyUp` is required for a
|
|
13008
|
+
* `<button>` combobox (select-only): without it the button's native click on Space keyup
|
|
13009
|
+
* toggles the listbox again after a keydown commit.
|
|
13010
|
+
* - Registration mode: mark option and group components of your own with
|
|
13011
|
+
* {@link markListboxElement} (`Option` and `OptionGroup` are marked; memo components can be
|
|
13012
|
+
* marked too). {@link collectOptionLabels} walks only marked components, so without the marks
|
|
13013
|
+
* the server render and the first client render have no display text.
|
|
13014
|
+
* - Display text: `getItem(value)?.label ?? collectOptionLabels(children).get(value)` (`?? value`
|
|
13015
|
+
* for freeform input only). Editable pickers pass `onClearDraft` for Escape on a closed list.
|
|
13016
|
+
* - A popup list renders in `ListboxSurface`, placed and dismissed by `useListboxPopup`; a list
|
|
13017
|
+
* rendered without it gets the options' context from `ListboxProvider`.
|
|
13018
|
+
* - Standalone mode (a listbox that holds focus): spread `getListboxProps()` onto the list and
|
|
13019
|
+
* merge its `ref` with yours (a pointer press on an option focuses the list through it), attach
|
|
13020
|
+
* `onKeyDown` to the list and pass the list's focus state as `open`. `getComboboxProps()` is not
|
|
13021
|
+
* used.
|
|
13022
|
+
*/
|
|
13023
|
+
export declare function useListbox(options: UseListboxOptions): UseListboxResult;
|
|
13024
|
+
|
|
13025
|
+
/**
|
|
13026
|
+
* An option of the surrounding listbox, for option components of your own: the listbox's context
|
|
13027
|
+
* comes from `ListboxSurface` or `ListboxProvider` ({@link UseListboxResult.context}). Registers
|
|
13028
|
+
* the option (registration mode) and its element, and reads its flags from the listbox store, so
|
|
13029
|
+
* it re-renders only when its own active/selected/hidden state changes. Spread `optionProps` onto
|
|
13030
|
+
* the `<li>` (`id`, `role="option"`, `aria-selected`, `aria-disabled`, `hidden`, and
|
|
13031
|
+
* `data-active`/`data-selected`/`data-disabled` for styling) and compose its `onClick` — and in
|
|
13032
|
+
* standalone mode its `onMouseDown`, the pointer press — with your own handlers. Mark the
|
|
13033
|
+
* component with {@link markListboxElement}, so its label is known before it registers.
|
|
13034
|
+
*
|
|
13035
|
+
* Throws in development when used outside a listbox; in production it logs the error once and
|
|
13036
|
+
* renders an inert option.
|
|
13037
|
+
*
|
|
13038
|
+
* @typeParam E The option element type (`HTMLLIElement` for an `<li>`), so `ref` needs no cast.
|
|
13039
|
+
*/
|
|
13040
|
+
export declare function useListboxOption<E extends HTMLElement = HTMLElement>(props: UseListboxOptionProps, ref?: React_2.Ref<E>): UseListboxOptionResult<E>;
|
|
13041
|
+
|
|
13042
|
+
/**
|
|
13043
|
+
* Props of {@link useListboxOption}. The option's position in the listbox follows its element's
|
|
13044
|
+
* DOM position, also when the option is memoized and only moved (see {@link useListbox}).
|
|
13045
|
+
*/
|
|
13046
|
+
export declare interface UseListboxOptionProps {
|
|
13047
|
+
/** The option's value, unique within the listbox. */
|
|
13048
|
+
value: string;
|
|
13049
|
+
/**
|
|
13050
|
+
* Display label; falls back to `textValue`, then the element's text content, then `value`. The
|
|
13051
|
+
* text content is re-read after every render of the option. Text that a child component changes
|
|
13052
|
+
* from its own state (without the option re-rendering) is not seen; pass `label` or `textValue`
|
|
13053
|
+
* for such options.
|
|
13054
|
+
*/
|
|
13055
|
+
label?: string;
|
|
13056
|
+
/** Text matched by typeahead and filters instead of the label. */
|
|
13057
|
+
textValue?: string;
|
|
13058
|
+
/**
|
|
13059
|
+
* The option can never be committed; the keys skip it unless the listbox has
|
|
13060
|
+
* {@link UseListboxOptions.disabledOptionsFocusable}.
|
|
13061
|
+
* @default false
|
|
13062
|
+
*/
|
|
13063
|
+
disabled?: boolean;
|
|
13064
|
+
/**
|
|
13065
|
+
* The option is hidden (its own `hidden` attribute, or a hidden group around it): it registers
|
|
13066
|
+
* as a hidden item ({@link ListboxItem.hidden}), so it is not navigable, and
|
|
13067
|
+
* `optionProps.hidden` is set from the first render (server included).
|
|
13068
|
+
* @default false
|
|
13069
|
+
*/
|
|
13070
|
+
hidden?: boolean;
|
|
13071
|
+
}
|
|
13072
|
+
|
|
13073
|
+
/** Result of {@link useListboxOption}. */
|
|
13074
|
+
export declare interface UseListboxOptionResult<E extends HTMLElement = HTMLElement> {
|
|
13075
|
+
/** The option's stable id. */
|
|
13076
|
+
id: string;
|
|
13077
|
+
/** Whether the option is selected. */
|
|
13078
|
+
selected: boolean;
|
|
13079
|
+
/** Whether the option is active (keyboard or pointer highlight). */
|
|
13080
|
+
active: boolean;
|
|
13081
|
+
/** Whether the option is disabled. */
|
|
13082
|
+
disabled: boolean;
|
|
13083
|
+
/** Filtered out, or hidden by its own props ({@link UseListboxOptionProps.hidden}). */
|
|
13084
|
+
hidden: boolean;
|
|
13085
|
+
/** Whether the surrounding listbox is {@link UseListboxOptions.multiselect}. */
|
|
13086
|
+
multiselect: boolean;
|
|
13087
|
+
/** Spread onto the option element (see {@link ListboxOptionElementProps}). */
|
|
13088
|
+
optionProps: ListboxOptionElementProps<E>;
|
|
13089
|
+
}
|
|
13090
|
+
|
|
13091
|
+
/** Options of {@link useListbox}. */
|
|
13092
|
+
export declare interface UseListboxOptions {
|
|
13093
|
+
/**
|
|
13094
|
+
* Whether the listbox is shown. You own the open state: `onOpenChange` asks you to change it.
|
|
13095
|
+
* Standalone mode: whether the list has focus — an option is active only while it does.
|
|
13096
|
+
*/
|
|
13097
|
+
open: boolean;
|
|
13098
|
+
/**
|
|
13099
|
+
* Called when a key (or a commit) wants to open or close the listbox. `details.reason` says why
|
|
13100
|
+
* (`'keyboard'`, `'select'` — a commit that closes the list —, `'escape'` or `'tab'`) and
|
|
13101
|
+
* `details.event` is the key or click event behind it. WaveUI always passes `details`; it is
|
|
13102
|
+
* typed optional until 1.0 so that code which calls this prop itself keeps compiling. Never
|
|
13103
|
+
* called in standalone mode.
|
|
13104
|
+
*/
|
|
13105
|
+
onOpenChange?: (open: boolean, details?: OpenChangeDetails<ListboxOpenChangeReason>) => void;
|
|
13106
|
+
/**
|
|
13107
|
+
* `'editable'`: a text input combobox (Combobox, TagPicker, TimePicker).
|
|
13108
|
+
* `'select-only'`: a button/div combobox without text entry (Dropdown).
|
|
13109
|
+
* `'standalone'`: a listbox that holds focus itself (Listbox), with nothing to open or close:
|
|
13110
|
+
* `open` is its focus state, the keys move and commit (a commit keeps the committed option
|
|
13111
|
+
* active), Tab, Escape and Alt+Arrow keys are left to the page, `onOpenChange` is never called,
|
|
13112
|
+
* and a pointer press on an option focuses the list and activates the option without scrolling
|
|
13113
|
+
* (see {@link UseListboxResult.getListboxProps}).
|
|
13114
|
+
*/
|
|
13115
|
+
mode: 'editable' | 'select-only' | 'standalone';
|
|
13116
|
+
/**
|
|
13117
|
+
* Several values can be selected: the list gets `aria-multiselectable`, and a commit keeps the
|
|
13118
|
+
* listbox open on the committed option (your `onSelect` adds or removes the value).
|
|
13119
|
+
* @default false
|
|
13120
|
+
*/
|
|
13121
|
+
multiselect?: boolean;
|
|
13122
|
+
/** The selected values (`[]` when nothing is selected). */
|
|
13123
|
+
selectedValues: readonly string[];
|
|
13124
|
+
/**
|
|
13125
|
+
* Called when an option is committed: click, Enter/Space, and in single-select select-only mode
|
|
13126
|
+
* also Tab and Alt+ArrowUp (with `multiselect` they close without committing). `details.item` is
|
|
13127
|
+
* the committed option and `details.event` the key or click event behind the commit. WaveUI
|
|
13128
|
+
* always passes `details`; it is typed optional until 1.0 so that code which calls this prop
|
|
13129
|
+
* itself keeps compiling.
|
|
13130
|
+
*/
|
|
13131
|
+
onSelect: (value: string, details?: ListboxSelectDetails) => void;
|
|
13132
|
+
/**
|
|
13133
|
+
* Data mode: the options, in list order. Omit it for registration mode, where the options
|
|
13134
|
+
* register themselves in DOM order: `Option`s, or option components of your own on
|
|
13135
|
+
* {@link useListboxOption}, rendered inside the listbox's context
|
|
13136
|
+
* ({@link UseListboxResult.context}, which `ListboxSurface` and `ListboxProvider` provide).
|
|
13137
|
+
*/
|
|
13138
|
+
items?: readonly ListboxItem[];
|
|
13139
|
+
/**
|
|
13140
|
+
* The navigability predicate: an item it returns `false` for is filtered out — left out of the
|
|
13141
|
+
* keys, typeahead and {@link UseListboxResult.items}, never active, and rendered `hidden` as a
|
|
13142
|
+
* registered option (its label stays known). It is never called for a hidden item, which stays
|
|
13143
|
+
* out anyway. A picker builds it from its query, the text typed so far: by default, Combobox
|
|
13144
|
+
* keeps the options whose `textValue ?? label` contains it, ignoring case, and a component with
|
|
13145
|
+
* a `filter(option, query)` prop builds this predicate by binding its current query to it.
|
|
13146
|
+
* Without it, every item that is not hidden is navigable.
|
|
13147
|
+
*/
|
|
13148
|
+
filter?: (item: ListboxItem) => boolean;
|
|
13149
|
+
/** Arrow keys wrap around at the ends. @default false */
|
|
13150
|
+
loop?: boolean;
|
|
13151
|
+
/**
|
|
13152
|
+
* Printable characters move to the matching option (on by default in select-only and standalone
|
|
13153
|
+
* mode).
|
|
13154
|
+
* @default mode !== 'editable'
|
|
13155
|
+
*/
|
|
13156
|
+
typeahead?: boolean;
|
|
13157
|
+
/**
|
|
13158
|
+
* Keeps disabled options in the arrow-key, Home/End, PageUp/PageDown and typeahead order: they
|
|
13159
|
+
* still cannot be committed (Enter, Space and a click do nothing and the list stays open), and
|
|
13160
|
+
* while one is active, Tab and Alt+ArrowUp in single-select select-only mode close the listbox
|
|
13161
|
+
* without a commit. The `autoHighlight` fallback may then be a disabled option too.
|
|
13162
|
+
* @default false
|
|
13163
|
+
*/
|
|
13164
|
+
disabledOptionsFocusable?: boolean;
|
|
13165
|
+
/**
|
|
13166
|
+
* The option that is active while no option is highlighted: `'selected'` — the first selected
|
|
13167
|
+
* navigable option in list order (not in `selectedValues` order), else the first option;
|
|
13168
|
+
* `'first'` — the first option; `false` — none. A highlighted option that leaves the navigable
|
|
13169
|
+
* set is dropped (the fallback takes over, also when the option returns); in editable mode a
|
|
13170
|
+
* text-editing key clears the highlight.
|
|
13171
|
+
* @default 'selected'
|
|
13172
|
+
*/
|
|
13173
|
+
autoHighlight?: 'selected' | 'first' | false;
|
|
13174
|
+
/**
|
|
13175
|
+
* Whenever the options the keys reach (the navigable ones, the disabled ones only with
|
|
13176
|
+
* `disabledOptionsFocusable`) change while open, compared by content — as when typing filters
|
|
13177
|
+
* them — the first of them becomes active, also when the update that opens the listbox changes
|
|
13178
|
+
* them (compared with those before opening, as the keystroke that opens a filtered list does).
|
|
13179
|
+
* Opening with unchanged options keeps the `autoHighlight` start. It sets
|
|
13180
|
+
* {@link useActiveDescendant}'s `activateFirstOnChange`. In editable mode every text-editing key
|
|
13181
|
+
* while open makes the first option active as well, also when the options stay the same.
|
|
13182
|
+
* @default false
|
|
13183
|
+
*/
|
|
13184
|
+
highlightOnFilter?: boolean;
|
|
13185
|
+
/**
|
|
13186
|
+
* Called after the active (highlighted) option changes — arrow keys, typeahead, the pointer, a
|
|
13187
|
+
* filter change, opening — and with `null` when the listbox closes. Passed straight through to
|
|
13188
|
+
* {@link useActiveDescendant}'s `onActiveValueChange`.
|
|
13189
|
+
*/
|
|
13190
|
+
onActiveValueChange?: (value: string | null) => void;
|
|
13191
|
+
/** Prefix of the generated listbox id. @default 'listbox' */
|
|
13192
|
+
idPrefix?: string;
|
|
13193
|
+
/**
|
|
13194
|
+
* Editable: Escape with the listbox closed and text in the input calls this (and prevents the
|
|
13195
|
+
* default), so you can clear the typed text. Not handled when omitted.
|
|
13196
|
+
*/
|
|
13197
|
+
onClearDraft?: () => void;
|
|
13198
|
+
}
|
|
13199
|
+
|
|
13200
|
+
/**
|
|
13201
|
+
* Dismissal and positioning of a custom picker's listbox popup, for {@link ListboxSurface}. The
|
|
13202
|
+
* popup is dismissed by Escape, by a press outside your picker and its surface, and by focus
|
|
13203
|
+
* leaving them (`onDismiss` says which). The surface opens below the anchor and as wide as it,
|
|
13204
|
+
* flips above it when there is no room below, and is limited to the space available; its
|
|
13205
|
+
* `data-side` and `data-align` attributes give the final placement.
|
|
13206
|
+
*
|
|
13207
|
+
* While the listbox is open with nothing to show (`surfaceOpen` is `false`), Escape is left to an
|
|
13208
|
+
* enclosing layer, such as a Dialog around the picker. Let your combobox's key handler leave it
|
|
13209
|
+
* too: on such an Escape, set your open state to `false` without calling `listbox.onKeyDown`,
|
|
13210
|
+
* which handles Escape (and prevents its default) whenever the listbox is open. Do so only when
|
|
13211
|
+
* `!event.nativeEvent.isComposing`, as Dropdown, Combobox and TagPicker do: an Escape that only
|
|
13212
|
+
* cancels an IME composition must not close the listbox, and `listbox.onKeyDown` ignores such
|
|
13213
|
+
* keys too.
|
|
13214
|
+
*
|
|
13215
|
+
* @example
|
|
13216
|
+
* const expanded = open && listbox.items.length > 0;
|
|
13217
|
+
* const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({
|
|
13218
|
+
* open,
|
|
13219
|
+
* surfaceOpen: expanded,
|
|
13220
|
+
* onDismiss: () => setOpen(false),
|
|
13221
|
+
* rootRef,
|
|
13222
|
+
* anchorRef: buttonRef,
|
|
13223
|
+
* });
|
|
13224
|
+
* const buttonMergedRef = useMergedRefs(buttonRef, setReference);
|
|
13225
|
+
*/
|
|
13226
|
+
export declare function useListboxPopup(options: UseListboxPopupOptions): UseListboxPopupResult;
|
|
13227
|
+
|
|
13228
|
+
/** Options of {@link useListboxPopup}. */
|
|
13229
|
+
export declare interface UseListboxPopupOptions {
|
|
13230
|
+
/**
|
|
13231
|
+
* The listbox is open (your open state). While it is, a press outside your picker and its
|
|
13232
|
+
* surface, and focus leaving them, dismiss it.
|
|
13233
|
+
*/
|
|
13234
|
+
open: boolean;
|
|
13235
|
+
/**
|
|
13236
|
+
* The surface is shown (the list, or the empty content of {@link ListboxSurface}): it is
|
|
13237
|
+
* positioned, and Escape dismisses it. While the listbox is open with nothing shown (no options
|
|
13238
|
+
* to show), Escape is left to an enclosing layer, such as a Dialog around the picker.
|
|
13239
|
+
*/
|
|
13240
|
+
surfaceOpen: boolean;
|
|
13241
|
+
/**
|
|
13242
|
+
* Called when the popup should close: set your open state to `false`. `reason` is `'escape'`,
|
|
13243
|
+
* `'outside-press'` or `'focus-outside'`.
|
|
13244
|
+
*/
|
|
13245
|
+
onDismiss: (reason: DismissReason) => void;
|
|
13246
|
+
/** Your picker's root element: presses and focus inside it are not outside the popup. */
|
|
13247
|
+
rootRef: React_2.RefObject<HTMLElement | null>;
|
|
13248
|
+
/**
|
|
13249
|
+
* The combobox element, which anchors the popup's dismiss layer. Pass the element to
|
|
13250
|
+
* `setReference` too (merged into its ref), which places the surface against it.
|
|
13251
|
+
*/
|
|
13252
|
+
anchorRef: React_2.RefObject<HTMLElement | null>;
|
|
13253
|
+
}
|
|
13254
|
+
|
|
13255
|
+
/**
|
|
13256
|
+
* Result of {@link useListboxPopup}. Destructure it: `eslint-plugin-react-hooks` treats an object
|
|
13257
|
+
* with a member passed to a `ref` prop as a ref, and rejects reading its other members during
|
|
13258
|
+
* render (`react-hooks/refs`).
|
|
13259
|
+
*/
|
|
13260
|
+
export declare interface UseListboxPopupResult {
|
|
13261
|
+
/** The popup's dismiss layer: pass it to {@link ListboxSurface}. */
|
|
13262
|
+
layerId: string;
|
|
13263
|
+
/**
|
|
13264
|
+
* Ref callback for the element the surface is placed against: merge it into your combobox's ref.
|
|
13265
|
+
*/
|
|
13266
|
+
setReference: (el: HTMLElement | null) => void;
|
|
13267
|
+
/** Ref callback for the surface: pass it to {@link ListboxSurface}. */
|
|
13268
|
+
surfaceRef: React_2.RefCallback<HTMLElement>;
|
|
13269
|
+
/** The surface's `data-side`, `data-align` and position style: pass them to {@link ListboxSurface}. */
|
|
13270
|
+
floatingProps: {
|
|
13271
|
+
'data-side': string;
|
|
13272
|
+
'data-align': string;
|
|
13273
|
+
style: React_2.CSSProperties;
|
|
13274
|
+
};
|
|
13275
|
+
}
|
|
13276
|
+
|
|
13277
|
+
/** Result of {@link useListbox}. */
|
|
13278
|
+
export declare interface UseListboxResult {
|
|
13279
|
+
/** Id of the listbox element. */
|
|
13280
|
+
listboxId: string;
|
|
13281
|
+
/**
|
|
13282
|
+
* The active (highlighted) option, derived during render; `null` while closed (in standalone
|
|
13283
|
+
* mode, while the list does not have focus).
|
|
13284
|
+
*/
|
|
13285
|
+
activeValue: string | null;
|
|
13286
|
+
/** `getOptionId(activeValue)` while open and an option is active. */
|
|
13287
|
+
activeDescendantId: string | undefined;
|
|
13288
|
+
/**
|
|
13289
|
+
* The navigable items in DOM/data order: without filtered-out and hidden items; disabled ones
|
|
13290
|
+
* are included (navigation skips them, unless
|
|
13291
|
+
* {@link UseListboxOptions.disabledOptionsFocusable}).
|
|
13292
|
+
*/
|
|
13293
|
+
items: ListboxItem[];
|
|
13294
|
+
/** Unfiltered lookup (registered options or `items`), e.g. for the selected option's label. */
|
|
13295
|
+
getItem(value: string): ListboxItem | undefined;
|
|
13296
|
+
/** `${listboxId}-opt-${n}`; `n` is assigned the first time a value is seen and never changes. */
|
|
13297
|
+
getOptionId(value: string): string;
|
|
13298
|
+
/**
|
|
13299
|
+
* Highlights `value` while open, scrolled into view like a keyboard highlight; `null` returns the
|
|
13300
|
+
* highlight to the `autoHighlight` option. The value is checked in the next render: if it is not
|
|
13301
|
+
* navigable then (disabled options count as not navigable unless
|
|
13302
|
+
* {@link UseListboxOptions.disabledOptionsFocusable}), it is dropped like `null`, and the
|
|
13303
|
+
* highlight returns to the `autoHighlight` option, or to none. A kept value is dropped when it
|
|
13304
|
+
* leaves the navigable set later. A value set while closed survives only when the same update
|
|
13305
|
+
* opens the listbox.
|
|
13306
|
+
*/
|
|
13307
|
+
setActiveValue(value: string | null): void;
|
|
13308
|
+
/**
|
|
13309
|
+
* Attach to the combobox element (to the list in standalone mode). Ignores key events a handler
|
|
13310
|
+
* of yours already prevented (compose yours first).
|
|
13311
|
+
*/
|
|
13312
|
+
onKeyDown(event: React_2.KeyboardEvent): void;
|
|
13313
|
+
/**
|
|
13314
|
+
* Attach to the combobox element next to `onKeyDown`. Required for a `<button>` combobox
|
|
13315
|
+
* (select-only): it prevents the Space keyup, so the native click does not toggle the listbox
|
|
13316
|
+
* again after the keydown opened or committed.
|
|
13317
|
+
*/
|
|
13318
|
+
onKeyUp(event: React_2.KeyboardEvent): void;
|
|
13319
|
+
/**
|
|
13320
|
+
* Props for the combobox element (spread them): its role, `aria-expanded`, `aria-controls`,
|
|
13321
|
+
* `aria-haspopup`, `aria-activedescendant` while an option is active and, in editable mode,
|
|
13322
|
+
* `aria-autocomplete`. Not used in standalone mode, where the list itself has focus.
|
|
13323
|
+
*/
|
|
13324
|
+
getComboboxProps(): ListboxComboboxProps;
|
|
13325
|
+
/**
|
|
13326
|
+
* Props for the listbox element (spread them). The combobox modes: `tabIndex: -1` and an
|
|
13327
|
+
* `onMouseDown` that keeps focus on the combobox while options are clicked. Standalone mode:
|
|
13328
|
+
* `tabIndex: 0`, `aria-activedescendant` while an option is active, and a `ref` (merge it with
|
|
13329
|
+
* yours: a pointer press on an option focuses the list through it), without `onMouseDown`.
|
|
13330
|
+
* Both: `aria-multiselectable` with `multiselect`.
|
|
13331
|
+
*/
|
|
13332
|
+
getListboxProps(): ListboxListProps;
|
|
13333
|
+
/**
|
|
13334
|
+
* The context of the listbox's options: `ListboxSurface` provides it; for a list you render
|
|
13335
|
+
* yourself, pass it to `ListboxProvider` around the options.
|
|
13336
|
+
*/
|
|
13337
|
+
context: ListboxContextValue;
|
|
13338
|
+
}
|
|
13339
|
+
|
|
10655
13340
|
/**
|
|
10656
13341
|
* Merges several refs into one callback ref whose identity never changes (React 19 cleanup-aware,
|
|
10657
13342
|
* like {@link mergeRefs}, which merges refs without a hook).
|
|
@@ -11015,6 +13700,8 @@ export declare interface WaveContextValue {
|
|
|
11015
13700
|
themeClassName: string;
|
|
11016
13701
|
/** Element portaled overlays render into; `null` means `document.body`. */
|
|
11017
13702
|
portalContainer: HTMLElement | null;
|
|
13703
|
+
/** The merged input defaults of the providers above (`{}` outside a provider). */
|
|
13704
|
+
inputDefaults: InputDefaults;
|
|
11018
13705
|
/** `false` when no {@link WaveProvider} is above the caller (the defaults are returned). */
|
|
11019
13706
|
hasProvider: boolean;
|
|
11020
13707
|
}
|
|
@@ -11038,9 +13725,12 @@ export declare type WaveDir = 'ltr' | 'rtl';
|
|
|
11038
13725
|
* enclosing provider, so `<WaveProvider theme="light">` inside an RTL app is a light panel that
|
|
11039
13726
|
* stays right-to-left and keeps the app's portal container. At the top level the defaults are
|
|
11040
13727
|
* `'light'`, `'ltr'` and `document.body`.
|
|
13728
|
+
* - `inputDefaults` nests differently: a nested provider's defined keys override the enclosing
|
|
13729
|
+
* provider's, and an omitted key is inherited, so setting only `appearance` in a nested provider
|
|
13730
|
+
* keeps the enclosing provider's `size`.
|
|
11041
13731
|
*/
|
|
11042
13732
|
export declare const WaveProvider: {
|
|
11043
|
-
({ theme: themeProp, dir: dirProp, portalContainer: portalContainerProp, children, className, ref, ...rest }: WaveProviderProps): React_2.JSX.Element;
|
|
13733
|
+
({ theme: themeProp, dir: dirProp, portalContainer: portalContainerProp, inputDefaults: inputDefaultsProp, children, className, ref, ...rest }: WaveProviderProps): React_2.JSX.Element;
|
|
11044
13734
|
displayName: string;
|
|
11045
13735
|
};
|
|
11046
13736
|
|
|
@@ -11068,6 +13758,14 @@ export declare interface WaveProviderProps extends React_2.HTMLAttributes<HTMLDi
|
|
|
11068
13758
|
* @default the enclosing WaveProvider's container, else document.body
|
|
11069
13759
|
*/
|
|
11070
13760
|
portalContainer?: HTMLElement | null;
|
|
13761
|
+
/**
|
|
13762
|
+
* Default `size` and `appearance` of the text inputs and pickers in the subtree (Input,
|
|
13763
|
+
* Textarea, Select, SearchBox, SpinButton, Combobox, Dropdown, DatePicker, TimePicker,
|
|
13764
|
+
* TagPicker). Their own props and a Field's `size` win. A nested provider merges its keys over
|
|
13765
|
+
* the enclosing provider's; an omitted key is inherited.
|
|
13766
|
+
* @default the enclosing WaveProvider's defaults, else none (`medium`, `outline`)
|
|
13767
|
+
*/
|
|
13768
|
+
inputDefaults?: InputDefaults;
|
|
11071
13769
|
/** Content rendered inside the themed container. */
|
|
11072
13770
|
children: React_2.ReactNode;
|
|
11073
13771
|
/** Ref to the themed root `<div>`. */
|