@ostack.tech/ui 0.8.2 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{en-BfgHKQwn.js → en-Dem8nwZz.js} +20 -6
- package/dist/chunks/en-Dem8nwZz.js.map +1 -0
- package/dist/chunks/platformUtils-C3IHCr90.js +6 -0
- package/dist/chunks/platformUtils-C3IHCr90.js.map +1 -0
- package/dist/locales/en-GB.js +4 -4
- package/dist/locales/en-GB.js.map +1 -1
- package/dist/locales/en-US.js +4 -4
- package/dist/locales/en-US.js.map +1 -1
- package/dist/locales/fr-FR.js +49 -8
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +35 -8
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +39 -10
- package/dist/ostack-ui.css.map +1 -1
- package/dist/ostack-ui.js +804 -352
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +1 -1
- package/dist/types/components/Button/Button.d.ts +20 -0
- package/dist/types/components/Calendar/Calendar.d.ts +9 -6
- package/dist/types/components/Calendar/CalendarContext.d.ts +4 -1
- package/dist/types/components/Calendar/{CalendarMonthCaption.d.ts → CalendarHeader.d.ts} +1 -1
- package/dist/types/components/CheckboxGroup/CheckboxGroupContext.d.ts +62 -4
- package/dist/types/components/CommandMenu/CommandMenuItem.d.ts +1 -1
- package/dist/types/components/DateInput/DateInput.d.ts +10 -17
- package/dist/types/components/DateRangeInput/DateRangeInput.d.ts +11 -13
- package/dist/types/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuItem.d.ts +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuRadioItem.d.ts +1 -1
- package/dist/types/components/IconButton/IconButton.d.ts +24 -7
- package/dist/types/components/Keybinds/Key.d.ts +9 -0
- package/dist/types/components/Keybinds/KeyPress.d.ts +7 -0
- package/dist/types/components/Keybinds/Keybind.d.ts +7 -0
- package/dist/types/components/Keybinds/Keybinds.d.ts +20 -0
- package/dist/types/components/Keybinds/index.d.ts +1 -0
- package/dist/types/components/Label/Label.d.ts +0 -2
- package/dist/types/components/MenuList/MenuListItem.d.ts +15 -0
- package/dist/types/components/Spinner/Spinner.d.ts +2 -8
- package/dist/types/components/Tabs/TabList.d.ts +10 -1
- package/dist/types/components/Toast/Toast.d.ts +9 -0
- package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts +20 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/locales/en.d.ts +1 -1
- package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +10 -6
- package/dist/types/utils/intersperse.d.ts +8 -0
- package/dist/types/utils/keyboardShortcut.d.ts +21 -8
- package/dist/types/utils/parseDateStrict.d.ts +3 -1
- package/dist/types/utils/platformUtils.d.ts +2 -0
- package/dist/types/utils/useDateTransformer.d.ts +10 -31
- package/package.json +4 -4
- package/scss/_utils.scss +1 -0
- package/scss/components/Button/_Button.scss +5 -0
- package/scss/components/Calendar/_Calendar-variables.scss +16 -16
- package/scss/components/Calendar/_Calendar.scss +16 -16
- package/scss/components/IconButton/_IconButton.scss +5 -0
- package/scss/components/Keyboard/_Keyboard-variables.scss +18 -0
- package/scss/components/Keyboard/_Keyboard.scss +13 -10
- package/scss/components/Link/_Link-variables.scss +7 -0
- package/scss/components/Link/_Link.scss +7 -0
- package/scss/components/MenuList/_MenuList.scss +4 -0
- package/scss/components/Tooltip/_Tooltip-variables.scss +4 -0
- package/scss/components/Tooltip/_Tooltip.scss +1 -0
- package/scss/scss/helpers/_visually-hidden.scss +14 -2
- package/scss/scss/placeholders/button/_button-variables.scss +4 -0
- package/scss/scss/placeholders/button/_button.scss +4 -0
- package/scss/scss/placeholders/menu/_menu-variables.scss +92 -1
- package/scss/scss/placeholders/menu/_menu.scss +61 -1
- package/dist/chunks/en-BfgHKQwn.js.map +0 -1
|
@@ -58,7 +58,7 @@ export interface AlertProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
58
58
|
closeButtonProps?: ComponentPropsWithRef<typeof CloseButton>;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* The alert component can be used to attract the user's
|
|
61
|
+
* The alert component can be used to attract the user's attention.
|
|
62
62
|
*
|
|
63
63
|
* It has the following subcomponent:
|
|
64
64
|
*
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { AccentColor } from '../../utils/accent.ts';
|
|
3
|
+
import { KeyboardShortcutKeybinds } from '../../utils/keyboardShortcut.ts';
|
|
3
4
|
import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
|
|
4
5
|
import { Icon, IconProp } from '../Icon';
|
|
6
|
+
import { Keybinds } from '../Keybinds';
|
|
5
7
|
import { Spinner } from '../Spinner';
|
|
8
|
+
import { Tooltip } from '../Tooltip';
|
|
6
9
|
/** Elements a button can be rendered as. */
|
|
7
10
|
export type ButtonAs = "button" | "a";
|
|
8
11
|
/** Button variants. */
|
|
@@ -119,10 +122,27 @@ export interface ButtonOwnProps {
|
|
|
119
122
|
* @default loading
|
|
120
123
|
*/
|
|
121
124
|
showSpinner?: boolean;
|
|
125
|
+
/** Content to display in a tooltip when hovering over or focusing the button. */
|
|
126
|
+
tooltipContent?: ReactNode;
|
|
127
|
+
/**
|
|
128
|
+
* [`tinykeys`](https://jamiebuilds.github.io/tinykeys) keyboard shortcut
|
|
129
|
+
* keybinds used to trigger the action performed by the button. Rendered at
|
|
130
|
+
* the end of the button's tooltip for visual users and announced to screen
|
|
131
|
+
* readers via `aria-keyshortcuts`.
|
|
132
|
+
*
|
|
133
|
+
* **Note:** This property does **not** automatically register a keyboard
|
|
134
|
+
* shortcut to run the button's action. This should be done manually via
|
|
135
|
+
* _e.g._ the `useKeyboardShortcut` hook.
|
|
136
|
+
*/
|
|
137
|
+
keybinds?: KeyboardShortcutKeybinds;
|
|
122
138
|
/** Properties to pass to the icon component. */
|
|
123
139
|
iconProps?: Omit<ComponentPropsWithRef<typeof Icon>, "icon">;
|
|
124
140
|
/** Properties to pass to the spinner component. */
|
|
125
141
|
spinnerProps?: ComponentPropsWithRef<typeof Spinner>;
|
|
142
|
+
/** Properties to pass to the tooltip component. */
|
|
143
|
+
tooltipProps?: Omit<ComponentPropsWithRef<typeof Tooltip>, "content" | "children">;
|
|
144
|
+
/** Properties to pass to the keybinds component. */
|
|
145
|
+
keybindsProps?: ComponentPropsWithRef<typeof Keybinds>;
|
|
126
146
|
}
|
|
127
147
|
/**
|
|
128
148
|
* The button component is used to trigger actions or events, such as opening a
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Locale } from 'date-fns';
|
|
2
1
|
import { ComponentPropsWithRef } from 'react';
|
|
3
2
|
import { DayPickerProps } from 'react-day-picker';
|
|
4
3
|
import { IconButton } from '../IconButton';
|
|
@@ -17,14 +16,18 @@ export interface CalendarProps extends Omit<DayPickerProps, "mode" | "selected"
|
|
|
17
16
|
minYear?: number;
|
|
18
17
|
/** Maximum year allowed. */
|
|
19
18
|
maxYear?: number;
|
|
20
|
-
/**
|
|
21
|
-
|
|
19
|
+
/** Label of the "month" select. */
|
|
20
|
+
monthSelectLabel?: string;
|
|
21
|
+
/** Label of the "year" select. */
|
|
22
|
+
yearSelectLabel?: string;
|
|
22
23
|
/** Label of the "previous month" button. */
|
|
23
24
|
previousMonthLabel?: string;
|
|
24
25
|
/** Label of the "next month" button. */
|
|
25
26
|
nextMonthLabel?: string;
|
|
26
|
-
/** Properties to pass to the
|
|
27
|
-
|
|
27
|
+
/** Properties to pass to the header element. */
|
|
28
|
+
headerProps?: ComponentPropsWithRef<"header">;
|
|
29
|
+
/** Properties to pass to the header label element. */
|
|
30
|
+
headerLabelProps?: ComponentPropsWithRef<"span">;
|
|
28
31
|
/** Properties to pass to the previous button component. */
|
|
29
32
|
previousButtonProps?: ComponentPropsWithRef<typeof IconButton<"button">>;
|
|
30
33
|
/** Properties to pass to the next button component. */
|
|
@@ -38,4 +41,4 @@ export interface CalendarProps extends Omit<DayPickerProps, "mode" | "selected"
|
|
|
38
41
|
* Calendar component built on top of [React
|
|
39
42
|
* DayPicker](https://react-day-picker.js.org).
|
|
40
43
|
*/
|
|
41
|
-
export declare function Calendar({ required, minDate, maxDate, minMonth, maxMonth, minYear, maxYear, previousMonthLabel, nextMonthLabel, defaultMonth, month: controlledMonth, onMonthChange, onDayClick, numberOfMonths, showOutsideDays, fixedWeeks, disableNavigation,
|
|
44
|
+
export declare function Calendar({ required, minDate, maxDate, minMonth, maxMonth, minYear, maxYear, monthSelectLabel, yearSelectLabel, previousMonthLabel, nextMonthLabel, defaultMonth, month: controlledMonth, onMonthChange, onDayClick, numberOfMonths, showOutsideDays, fixedWeeks, disableNavigation, disabled, modifiers, headerProps, headerLabelProps, previousButtonProps, nextButtonProps, monthSelectProps, yearSelectProps, pagedNavigation, ...otherProps }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,9 +3,12 @@ import { CalendarProps } from './Calendar.tsx';
|
|
|
3
3
|
export interface CalendarContextValue {
|
|
4
4
|
minAllowedDate: Date | undefined;
|
|
5
5
|
maxAllowedDate: Date | undefined;
|
|
6
|
+
monthSelectLabel: CalendarProps["monthSelectLabel"];
|
|
7
|
+
yearSelectLabel: CalendarProps["yearSelectLabel"];
|
|
6
8
|
previousMonthLabel: CalendarProps["previousMonthLabel"];
|
|
7
9
|
nextMonthLabel: CalendarProps["nextMonthLabel"];
|
|
8
|
-
|
|
10
|
+
headerProps: CalendarProps["headerProps"];
|
|
11
|
+
headerLabelProps: CalendarProps["headerLabelProps"];
|
|
9
12
|
previousButtonProps: CalendarProps["previousButtonProps"];
|
|
10
13
|
nextButtonProps: CalendarProps["nextButtonProps"];
|
|
11
14
|
monthSelectProps: CalendarProps["monthSelectProps"];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Reimplementation of the React Day Picker's caption component to provide both
|
|
3
3
|
* navigation arrows and dropdown selections.
|
|
4
4
|
*/
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const CalendarHeader: import('react').NamedExoticComponent<{
|
|
6
6
|
calendarMonth: import('react-day-picker').CalendarMonth;
|
|
7
7
|
displayIndex: number;
|
|
8
8
|
} & import('react').HTMLAttributes<HTMLDivElement>>;
|
|
@@ -1,11 +1,69 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { CheckboxGroupProps } from './CheckboxGroup.tsx';
|
|
3
|
+
/** Value of the checkbox group's context. */
|
|
1
4
|
export interface CheckboxGroupContextValue {
|
|
2
5
|
name?: string;
|
|
3
|
-
|
|
4
|
-
onCheckedChange: (value: string, checked: boolean) => void;
|
|
6
|
+
required?: boolean;
|
|
5
7
|
loadingDescriptionId?: string;
|
|
6
8
|
errorMessageIds?: string[];
|
|
7
|
-
ariaDescribedBy?: string;
|
|
8
9
|
descriptionIds?: string[];
|
|
10
|
+
store: CheckboxGroupStore;
|
|
11
|
+
}
|
|
12
|
+
/** State of the checkbox group. */
|
|
13
|
+
export interface CheckboxGroupState {
|
|
14
|
+
value: string[];
|
|
15
|
+
firstCheckboxId: string | undefined;
|
|
16
|
+
actions: CheckboxGroupActions;
|
|
9
17
|
}
|
|
10
|
-
/**
|
|
18
|
+
/** State of the checkbox group. */
|
|
19
|
+
interface CheckboxGroupActions {
|
|
20
|
+
handleCheckedChange: (checkboxValue: string, checked: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
/** Checkbox group's store. */
|
|
23
|
+
export type CheckboxGroupStore = ReturnType<typeof useCreateCheckboxGroupContext>["store"];
|
|
24
|
+
/** Checkbox group's context. */
|
|
11
25
|
export declare const CheckboxGroupContext: import('react').Context<CheckboxGroupContextValue | null>;
|
|
26
|
+
/** Options for the `useCreateCheckboxGroupContext` hook. */
|
|
27
|
+
export interface UseCreateCheckboxGroupContextOptions extends Omit<CheckboxGroupContextValue, "store">, Pick<CheckboxGroupProps, "defaultValue" | "value" | "onValueChange"> {
|
|
28
|
+
checkboxGroupRef: RefObject<HTMLDivElement | null>;
|
|
29
|
+
}
|
|
30
|
+
/** Hook which creates the checkbox group's store. */
|
|
31
|
+
export declare function useCreateCheckboxGroupContext({ defaultValue, value, onValueChange, name, required, loadingDescriptionId, errorMessageIds, descriptionIds, checkboxGroupRef, }: UseCreateCheckboxGroupContextOptions): {
|
|
32
|
+
name: string | undefined;
|
|
33
|
+
required: boolean | undefined;
|
|
34
|
+
loadingDescriptionId: string | undefined;
|
|
35
|
+
errorMessageIds: string[] | undefined;
|
|
36
|
+
descriptionIds: string[] | undefined;
|
|
37
|
+
store: Omit<import('zustand').StoreApi<CheckboxGroupState>, "subscribe"> & {
|
|
38
|
+
subscribe: {
|
|
39
|
+
(listener: (selectedState: CheckboxGroupState, previousSelectedState: CheckboxGroupState) => void): () => void;
|
|
40
|
+
<U>(selector: (state: CheckboxGroupState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
41
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
42
|
+
fireImmediately?: boolean;
|
|
43
|
+
} | undefined): () => void;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/** Hook returning the checkbox group's context value. */
|
|
48
|
+
export declare function useCheckboxGroupContext(): CheckboxGroupContextValue | null;
|
|
49
|
+
/**
|
|
50
|
+
* Hook which returns the checked state of a checkbox in a checkbox group and a
|
|
51
|
+
* function to mark it as checked or unchecked.
|
|
52
|
+
*/
|
|
53
|
+
export declare function useIsCheckedInGroup(checkboxValue: string): [boolean | undefined, ((checked: boolean) => void) | undefined];
|
|
54
|
+
/**
|
|
55
|
+
* Returns whether a checkbox within a group should be marked as required.
|
|
56
|
+
*
|
|
57
|
+
* All checkboxes within a group are marked as required when the group itself is
|
|
58
|
+
* required and no checkboxes have been checked.
|
|
59
|
+
*/
|
|
60
|
+
export declare function useIsRequiredInGroup(): boolean | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the description ids to set on a checkbox of a checkbox group.
|
|
63
|
+
*
|
|
64
|
+
* Description ids are set on the first checkbox of the group.
|
|
65
|
+
*
|
|
66
|
+
* @param checkboxId Id of the checkbox.
|
|
67
|
+
*/
|
|
68
|
+
export declare function useCheckboxGroupDescriptionIds(checkboxId: string): string[] | undefined;
|
|
69
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command as CommandPrimitive } from 'cmdk';
|
|
2
2
|
import { ComponentPropsWithoutRef } from 'react';
|
|
3
3
|
import { MenuListItemProps } from '../MenuList';
|
|
4
|
-
export interface CommandMenuItemProps extends Omit<ComponentPropsWithoutRef<typeof CommandPrimitive.Item>, "asChild" | "color">, Pick<MenuListItemProps, "selected" | "color" | "loading" | "loadingContent" | "showSpinner" | "icon" | "iconPlacement" | "href" | "target" | "rel" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
|
|
4
|
+
export interface CommandMenuItemProps extends Omit<ComponentPropsWithoutRef<typeof CommandPrimitive.Item>, "asChild" | "color">, Pick<MenuListItemProps, "selected" | "color" | "loading" | "loadingContent" | "showSpinner" | "icon" | "iconPlacement" | "keybinds" | "href" | "target" | "rel" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps" | "keybindsProps"> {
|
|
5
5
|
/**
|
|
6
6
|
* Render the item as a link. When set, you can pass `href`, `target`, and
|
|
7
7
|
* `rel` properties to the item.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode } from 'react';
|
|
3
2
|
import { DatePicker } from '../DatePicker';
|
|
4
3
|
import { Input } from '../Input';
|
|
5
4
|
import { PopoverContent } from '../Popover';
|
|
@@ -27,30 +26,24 @@ export interface DateInputProps extends Omit<ComponentPropsWithoutRef<typeof Inp
|
|
|
27
26
|
minYear?: number;
|
|
28
27
|
/** Maximum year allowed. */
|
|
29
28
|
maxYear?: number;
|
|
30
|
-
/** `date-fns` locale to format dates and to be used by the date picker. */
|
|
31
|
-
locale?: Locale;
|
|
32
29
|
/**
|
|
33
|
-
*
|
|
30
|
+
* Format of the date, as supported by
|
|
34
31
|
* [`date-fns`](https://date-fns.org/docs/format), used for the written input
|
|
35
32
|
* text.
|
|
36
33
|
*/
|
|
37
|
-
|
|
34
|
+
format?: string;
|
|
38
35
|
/**
|
|
39
|
-
*
|
|
36
|
+
* Announced format of the date, as supported by
|
|
40
37
|
* [`date-fns`](https://date-fns.org/docs/format), used to announce the date
|
|
41
38
|
* to assistive technologies.
|
|
42
39
|
*/
|
|
43
|
-
|
|
40
|
+
announcedFormat?: string;
|
|
44
41
|
/** Description of the short format provided to assistive technologies. */
|
|
45
|
-
formatDescription?:
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* @param selectedDate Currently selected date.
|
|
51
|
-
* @param editable Whether the calendar is editable.
|
|
52
|
-
*/
|
|
53
|
-
calendarButtonLabel?: (selectedDate: string | null, editable: boolean) => string;
|
|
42
|
+
formatDescription?: ReactNode;
|
|
43
|
+
/** Description of the selected date, announced to assistive technologies. */
|
|
44
|
+
selectedDateDescription?: (date: string) => ReactNode;
|
|
45
|
+
/** Label of the button that opens the input's calendar. */
|
|
46
|
+
calendarButtonLabel?: ReactNode;
|
|
54
47
|
/** Function called whenever the popover's open state changes. */
|
|
55
48
|
onPopoverOpenChange?: (open: boolean) => void;
|
|
56
49
|
/** Properties to pass to the date picker component. */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Locale } from 'date-fns';
|
|
2
1
|
import { ComponentPropsWithoutRef, ComponentPropsWithRef, CSSProperties, FocusEvent, ReactNode } from 'react';
|
|
3
2
|
import { ControlStatus, ControlVariant } from '../../utils/control.ts';
|
|
4
3
|
import { Responsive } from '../../utils/useResponsiveValues.ts';
|
|
@@ -124,20 +123,18 @@ export interface DateRangeInputProps extends Omit<ComponentPropsWithoutRef<"div"
|
|
|
124
123
|
showClearButtons?: ShowClearButton;
|
|
125
124
|
/** Label of the clear buttons announced to assistive technologies. */
|
|
126
125
|
clearButtonsLabel?: string;
|
|
127
|
-
/** `date-fns` locale to format dates and to be used by the date-range picker. */
|
|
128
|
-
locale?: Locale;
|
|
129
126
|
/**
|
|
130
|
-
*
|
|
127
|
+
* Format of the dates, as supported by
|
|
131
128
|
* [`date-fns`](https://date-fns.org/docs/format), used for the written input
|
|
132
129
|
* text.
|
|
133
130
|
*/
|
|
134
|
-
|
|
131
|
+
format?: string;
|
|
135
132
|
/**
|
|
136
|
-
*
|
|
133
|
+
* Announced format of the dates, as supported by
|
|
137
134
|
* [`date-fns`](https://date-fns.org/docs/format), used to announce the dates
|
|
138
135
|
* to assistive technologies.
|
|
139
136
|
*/
|
|
140
|
-
|
|
137
|
+
announcedFormat?: string;
|
|
141
138
|
/** Description of the short format provided to assistive technologies. */
|
|
142
139
|
formatDescription?: ReactNode;
|
|
143
140
|
/**
|
|
@@ -150,14 +147,15 @@ export interface DateRangeInputProps extends Omit<ComponentPropsWithoutRef<"div"
|
|
|
150
147
|
* user knows that they are interacting with the end input).
|
|
151
148
|
*/
|
|
152
149
|
endInputLabel?: ReactNode;
|
|
150
|
+
/** Prefix used when announcing a selected date to assistive technologies. */
|
|
151
|
+
selectedDateDescription?: (date: string) => ReactNode;
|
|
153
152
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @param selectedDateRange Currently selected date-range.
|
|
158
|
-
* @param editable Whether the calendar is editable.
|
|
153
|
+
* Prefix used when announcing the selected date-range to assistive
|
|
154
|
+
* technologies.
|
|
159
155
|
*/
|
|
160
|
-
|
|
156
|
+
selectedDateRangeDescription?: (dateRange: StringRange) => ReactNode;
|
|
157
|
+
/** Label of the button that opens the input's calendar. */
|
|
158
|
+
calendarButtonLabel?: ReactNode;
|
|
161
159
|
/** Placeholder for both start and end inputs. */
|
|
162
160
|
placeholder?: string;
|
|
163
161
|
/** Placeholder for the start input (defaults to `placeholder`). */
|
|
@@ -4,7 +4,7 @@ import { CheckboxChecked } from '../Checkbox';
|
|
|
4
4
|
import { Icon } from '../Icon';
|
|
5
5
|
import { MenuListItemProps } from '../MenuList';
|
|
6
6
|
/** Properties of the dropdown menu checkbox item. */
|
|
7
|
-
export interface DropdownMenuCheckboxItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "loading" | "loadingContent" | "showSpinner" | "iconPlacement" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
|
|
7
|
+
export interface DropdownMenuCheckboxItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "loading" | "loadingContent" | "showSpinner" | "iconPlacement" | "keybinds" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps" | "keybindsProps"> {
|
|
8
8
|
/**
|
|
9
9
|
* Whether to show the checkbox.
|
|
10
10
|
*
|
|
@@ -2,7 +2,7 @@ import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
|
|
|
2
2
|
import { ComponentPropsWithoutRef } from 'react';
|
|
3
3
|
import { MenuListItemProps } from '../MenuList';
|
|
4
4
|
/** Properties of the dropdown menu item. */
|
|
5
|
-
export interface DropdownMenuItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>, "asChild" | "color">, Pick<MenuListItemProps, "selected" | "color" | "loading" | "loadingContent" | "showSpinner" | "icon" | "iconPlacement" | "href" | "target" | "rel" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
|
|
5
|
+
export interface DropdownMenuItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>, "asChild" | "color">, Pick<MenuListItemProps, "selected" | "color" | "loading" | "loadingContent" | "showSpinner" | "icon" | "iconPlacement" | "keybinds" | "href" | "target" | "rel" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps" | "keybindsProps"> {
|
|
6
6
|
/**
|
|
7
7
|
* Render the item as a link. When set, you can pass `href`, `target`, and
|
|
8
8
|
* `rel` properties to the item.
|
|
@@ -2,7 +2,7 @@ import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
|
|
|
2
2
|
import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
|
|
3
3
|
import { MenuListItemProps } from '../MenuList';
|
|
4
4
|
/** Properties of the dropdown menu radio item. */
|
|
5
|
-
export interface DropdownMenuRadioItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "loading" | "loadingContent" | "showSpinner" | "iconPlacement" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
|
|
5
|
+
export interface DropdownMenuRadioItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "loading" | "loadingContent" | "showSpinner" | "iconPlacement" | "keybinds" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps" | "keybindsProps"> {
|
|
6
6
|
/**
|
|
7
7
|
* Whether to show the radio.
|
|
8
8
|
*
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { KeyboardShortcutKeybinds } from '../../utils/keyboardShortcut.ts';
|
|
2
3
|
import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
|
|
3
4
|
import { ButtonAs, ButtonColor, ButtonSize, ButtonVariant } from '../Button';
|
|
4
5
|
import { Icon, IconProp } from '../Icon';
|
|
5
6
|
import { Spinner } from '../Spinner';
|
|
6
7
|
import { Tooltip } from '../Tooltip';
|
|
8
|
+
import { VisuallyHidden } from '../VisuallyHidden';
|
|
7
9
|
/** Elements an icon button can be rendered as. */
|
|
8
10
|
export type IconButtonAs = ButtonAs;
|
|
9
11
|
/** Icon button variants. */
|
|
@@ -46,11 +48,11 @@ export interface IconButtonOwnProps {
|
|
|
46
48
|
/** Icon to show within the button. */
|
|
47
49
|
icon: IconProp | ReactElement;
|
|
48
50
|
/**
|
|
49
|
-
*
|
|
50
|
-
* element inside the button.
|
|
51
|
+
* Accessible label of the icon button. This label is rendered as a visually
|
|
52
|
+
* hidden element inside the button.
|
|
51
53
|
*
|
|
52
54
|
* By default, and for sighted users, it is also displayed as a tooltip
|
|
53
|
-
* (
|
|
55
|
+
* (overridable via `tooltipContent`).
|
|
54
56
|
*/
|
|
55
57
|
label: ReactNode;
|
|
56
58
|
/**
|
|
@@ -111,18 +113,33 @@ export interface IconButtonOwnProps {
|
|
|
111
113
|
*/
|
|
112
114
|
showSpinner?: boolean;
|
|
113
115
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
+
* Content to display in a tooltip when hovering over or focusing the icon
|
|
117
|
+
* button. By default, the icon button's label is displayed.
|
|
116
118
|
*
|
|
117
|
-
*
|
|
119
|
+
* Set to `null` to not render any content (other than the `keybinds`).
|
|
120
|
+
*/
|
|
121
|
+
tooltipContent?: ReactNode;
|
|
122
|
+
/**
|
|
123
|
+
* [`tinykeys`](https://jamiebuilds.github.io/tinykeys) keyboard shortcut
|
|
124
|
+
* keybinds used to trigger the action performed by the icon button. Rendered
|
|
125
|
+
* at the end of the icon button's tooltip for visual users and announced to
|
|
126
|
+
* screen readers via `aria-keyshortcuts`.
|
|
127
|
+
*
|
|
128
|
+
* **Note:** This property does **not** automatically register a keyboard
|
|
129
|
+
* shortcut to run the icon button's action. This should be done manually via
|
|
130
|
+
* _e.g._ the `useKeyboardShortcut` hook.
|
|
118
131
|
*/
|
|
119
|
-
|
|
132
|
+
keybinds?: KeyboardShortcutKeybinds;
|
|
120
133
|
/** Properties to pass to the `Icon` component. */
|
|
121
134
|
iconProps?: Omit<ComponentPropsWithRef<typeof Icon>, "icon" | "label">;
|
|
135
|
+
/** Properties to pass to the `VisuallyHidden` label component. */
|
|
136
|
+
labelProps?: Omit<ComponentPropsWithRef<typeof VisuallyHidden>, "children">;
|
|
122
137
|
/** Properties to pass to the `Spinner` component. */
|
|
123
138
|
spinnerProps?: ComponentPropsWithRef<typeof Spinner>;
|
|
124
139
|
/** Properties to pass to the `Tooltip` component. */
|
|
125
140
|
tooltipProps?: Omit<ComponentPropsWithRef<typeof Tooltip>, "content" | "children">;
|
|
141
|
+
/** Properties to pass to the keybinds component. */
|
|
142
|
+
keybindsProps?: ComponentPropsWithRef<"div">;
|
|
126
143
|
}
|
|
127
144
|
/**
|
|
128
145
|
* The icon button component renders a button containing a single icon. Use it
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { KeybindsProps } from './Keybinds.tsx';
|
|
3
|
+
/** Properties of the key component. */
|
|
4
|
+
export interface KeyProps extends Pick<KeybindsProps, "keySymbols" | "keyLabels"> {
|
|
5
|
+
/** Name of the key. */
|
|
6
|
+
keyName: string;
|
|
7
|
+
}
|
|
8
|
+
/** Component representing a single (normalised) key. */
|
|
9
|
+
export declare function Key({ keyName, keyLabels, keySymbols }: KeyProps): ReactNode;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { KeybindsProps } from './Keybinds.tsx';
|
|
3
|
+
export interface KeyPressProps extends Pick<KeybindsProps, "keySymbols" | "keyLabels"> {
|
|
4
|
+
/** Key press. */
|
|
5
|
+
keyPress: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function KeyPress({ keyPress, keySymbols, keyLabels, }: KeyPressProps): ReactNode;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { KeybindsProps } from './Keybinds.tsx';
|
|
3
|
+
export interface KeybindProps extends Pick<KeybindsProps, "keyPressesSeparatorLabel" | "keySymbols" | "keyLabels"> {
|
|
4
|
+
/** Keybind. */
|
|
5
|
+
keybind: string[][];
|
|
6
|
+
}
|
|
7
|
+
export declare function Keybind({ keybind, keyPressesSeparatorLabel, keySymbols, keyLabels, }: KeybindProps): ReactNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export interface KeybindsProps extends Omit<ComponentPropsWithoutRef<"span">, "children"> {
|
|
3
|
+
keybinds: string | string[] | null | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Limits the number of keybinds to display. Must be >= 1. By default, all
|
|
6
|
+
* keybinds are displayed.
|
|
7
|
+
*/
|
|
8
|
+
limit?: number;
|
|
9
|
+
/** Accessible label used to separate keybinds. */
|
|
10
|
+
keybindsSeparatorLabel?: ReactNode;
|
|
11
|
+
/** Accessible label used to separate key presses. */
|
|
12
|
+
keyPressesSeparatorLabel?: ReactNode;
|
|
13
|
+
/** Accessible label used to separate keys. */
|
|
14
|
+
keysSeparatorLabel?: ReactNode;
|
|
15
|
+
/** Key symbols to use instead of the default ones. */
|
|
16
|
+
keySymbols?: Record<string, ReactNode>;
|
|
17
|
+
/** Accessible key labels to use instead of the default ones. */
|
|
18
|
+
keyLabels?: Record<string, ReactNode>;
|
|
19
|
+
}
|
|
20
|
+
export declare const Keybinds: import('react').ForwardRefExoticComponent<KeybindsProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Keybinds.tsx';
|
|
@@ -9,8 +9,6 @@ export interface LabelProps extends ComponentPropsWithoutRef<typeof LabelPrimiti
|
|
|
9
9
|
required?: boolean;
|
|
10
10
|
/** Optional helper text displayed as a popover triggered by an icon button. */
|
|
11
11
|
helperText?: ReactNode;
|
|
12
|
-
/** Label of the required icon announced to assistive technologies. */
|
|
13
|
-
requiredIconLabel?: string;
|
|
14
12
|
/** Label of the helper button announced to assistive technologies. */
|
|
15
13
|
helperButtonLabel?: string;
|
|
16
14
|
/** Properties to pass to the container element. */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ComponentProps, ComponentPropsWithoutRef, ComponentPropsWithRef, MouseEvent, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { AccentColor } from '../../utils/accent.ts';
|
|
3
|
+
import { KeyboardShortcutKeybinds } from '../../utils/keyboardShortcut.ts';
|
|
3
4
|
import { Icon, IconProp } from '../Icon';
|
|
5
|
+
import { Keybinds } from '../Keybinds';
|
|
4
6
|
import { Spinner } from '../Spinner';
|
|
5
7
|
import { MenuListIconPlacement } from './MenuList.tsx';
|
|
6
8
|
/** Elements a menu list item's action can be rendered as. */
|
|
@@ -86,6 +88,17 @@ export interface MenuListItemProps extends Omit<ComponentPropsWithoutRef<"li">,
|
|
|
86
88
|
* @default start
|
|
87
89
|
*/
|
|
88
90
|
iconPlacement?: MenuListIconPlacement;
|
|
91
|
+
/**
|
|
92
|
+
* [`tinykeys`](https://jamiebuilds.github.io/tinykeys) keyboard shortcut
|
|
93
|
+
* keybinds used to trigger the action performed by the item. Rendered next to
|
|
94
|
+
* the item for visual users and announced to screen readers via
|
|
95
|
+
* `aria-keyshortcuts`.
|
|
96
|
+
*
|
|
97
|
+
* **Note:** This property does **not** automatically register a keyboard
|
|
98
|
+
* shortcut to run the item's action. This should be done manually via _e.g._
|
|
99
|
+
* the `useKeyboardShortcut` hook.
|
|
100
|
+
*/
|
|
101
|
+
keybinds?: KeyboardShortcutKeybinds;
|
|
89
102
|
/** Href for the link, when `type` is set to `"link"`. */
|
|
90
103
|
href?: ComponentProps<"a">["href"];
|
|
91
104
|
/** Target of the link, when `type` is set to `"link"`. */
|
|
@@ -100,6 +113,8 @@ export interface MenuListItemProps extends Omit<ComponentPropsWithoutRef<"li">,
|
|
|
100
113
|
iconProps?: Omit<ComponentPropsWithRef<typeof Icon>, "icon">;
|
|
101
114
|
/** Properties to pass to the spinner component. */
|
|
102
115
|
spinnerProps?: ComponentPropsWithRef<typeof Spinner>;
|
|
116
|
+
/** Properties to pass to the keybinds component. */
|
|
117
|
+
keybindsProps?: ComponentPropsWithRef<typeof Keybinds>;
|
|
103
118
|
}
|
|
104
119
|
/** Menu list item component. */
|
|
105
120
|
export declare const MenuListItem: import('react').ForwardRefExoticComponent<MenuListItemProps & import('react').RefAttributes<HTMLLIElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
import { AccentColor } from '../../utils/accent.ts';
|
|
3
3
|
/** Possible sizes of the spinner. */
|
|
4
4
|
export type SpinnerSize = "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl";
|
|
@@ -6,12 +6,6 @@ export type SpinnerSize = "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2x
|
|
|
6
6
|
export type SpinnerColor = AccentColor;
|
|
7
7
|
/** Properties of the spinner component. */
|
|
8
8
|
export interface SpinnerProps extends ComponentPropsWithoutRef<"span"> {
|
|
9
|
-
/**
|
|
10
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
11
|
-
* This will merge the original component props with the props of the supplied
|
|
12
|
-
* element/component and change the underlying DOM node.
|
|
13
|
-
*/
|
|
14
|
-
asChild?: boolean;
|
|
15
9
|
/**
|
|
16
10
|
* Size of the spinner. By default, the spinner will be sized according to the
|
|
17
11
|
* current font size.
|
|
@@ -28,7 +22,7 @@ export interface SpinnerProps extends ComponentPropsWithoutRef<"span"> {
|
|
|
28
22
|
* When provided, a visually hidden label is added so that assistive
|
|
29
23
|
* technologies correctly announce it.
|
|
30
24
|
*/
|
|
31
|
-
label?:
|
|
25
|
+
label?: ReactNode;
|
|
32
26
|
}
|
|
33
27
|
/**
|
|
34
28
|
* The spinner component provides a visual cue that an action is currently being
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { Tabs as TabsPrimitive } from 'radix-ui';
|
|
2
|
-
import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode } from 'react';
|
|
3
|
+
import { IconButton } from '../IconButton';
|
|
3
4
|
/** Properties of the tab list component. */
|
|
4
5
|
export interface TabListProps extends ComponentPropsWithoutRef<typeof TabsPrimitive.List> {
|
|
6
|
+
/** Label of the scroll left button. */
|
|
7
|
+
scrollLeftButtonLabel?: ReactNode;
|
|
8
|
+
/** Label of the scroll right button. */
|
|
9
|
+
scrollRightButtonLabel?: ReactNode;
|
|
5
10
|
/** Properties to pass to the root element. */
|
|
6
11
|
rootProps?: ComponentPropsWithRef<"div">;
|
|
7
12
|
/** Properties to pass to the container element. */
|
|
8
13
|
containerProps?: ComponentPropsWithRef<"div">;
|
|
14
|
+
/** Properties to pass to the scroll left button component. */
|
|
15
|
+
scrollLeftButtonProps?: Omit<Partial<ComponentPropsWithRef<typeof IconButton>>, "label">;
|
|
16
|
+
/** Properties to pass to the scroll right button component. */
|
|
17
|
+
scrollRightButtonProps?: Omit<Partial<ComponentPropsWithRef<typeof IconButton>>, "label">;
|
|
9
18
|
}
|
|
10
19
|
/** Component containing all tabs. */
|
|
11
20
|
export declare const TabList: import('react').ForwardRefExoticComponent<TabListProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -48,6 +48,15 @@ export interface ToastPropsBase extends Pick<ComponentPropsWithoutRef<typeof Toa
|
|
|
48
48
|
* `action` is not specified.
|
|
49
49
|
*/
|
|
50
50
|
showCloseButton?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the toast should be visually hidden. _I.e._ it provides a
|
|
53
|
+
* notification only to screen readers.
|
|
54
|
+
*
|
|
55
|
+
* This is useful when sighted users can easily see that something has
|
|
56
|
+
* happened, but nothing would be announced to assistive technology
|
|
57
|
+
* otherwise.
|
|
58
|
+
*/
|
|
59
|
+
visuallyHidden?: boolean;
|
|
51
60
|
/** Properties to pass to the root component. */
|
|
52
61
|
rootProps?: Omit<ComponentPropsWithRef<"li">, "onPause">;
|
|
53
62
|
/** Properties to pass to the container component. */
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
|
|
2
|
+
/** Elements a visually hidden component can be rendered as. */
|
|
3
|
+
export type VisuallyHiddenAs = "span" | "div";
|
|
4
|
+
/** Properties of the visually hidden component. */
|
|
5
|
+
export type VisuallyHiddenProps<TAs extends VisuallyHiddenAs = "span"> = PolymorphicProps<VisuallyHiddenAs, TAs, "span", VisuallyHiddenOwnProps>;
|
|
6
|
+
/** Own properties of the visually hidden component. */
|
|
7
|
+
export interface VisuallyHiddenOwnProps {
|
|
8
|
+
/**
|
|
9
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
10
|
+
* This will merge the original component props with the props of the supplied
|
|
11
|
+
* element/component and change the underlying DOM node.
|
|
12
|
+
*/
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Marks this component as focusable, in which case the content is visible
|
|
16
|
+
* when it receives focus.
|
|
17
|
+
*/
|
|
18
|
+
focusable?: boolean;
|
|
19
|
+
}
|
|
2
20
|
/** Component that hides content from the screen in an accessible way. */
|
|
3
|
-
export declare const VisuallyHidden:
|
|
21
|
+
export declare const VisuallyHidden: PolymorphicComponent<VisuallyHiddenAs, "span", VisuallyHiddenOwnProps>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export * from './components/HelperText';
|
|
|
35
35
|
export * from './components/Icon';
|
|
36
36
|
export * from './components/IconButton';
|
|
37
37
|
export * from './components/Input';
|
|
38
|
+
export * from './components/Keybinds';
|
|
38
39
|
export * from './components/Keyboard';
|
|
39
40
|
export * from './components/Label';
|
|
40
41
|
export * from './components/Link';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LocalizationObject } from '../providers/LocalizationProvider';
|
|
2
2
|
/** `en` locale (partial). */
|
|
3
|
-
export declare const en: Omit<LocalizationObject, "languageTag" | "
|
|
3
|
+
export declare const en: Omit<LocalizationObject, "languageTag" | "dayPickerLocale">;
|