@epam/ai-dial-ui-kit 0.14.0-dev.2 → 0.14.0-dev.3
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 +3 -0
- package/dist/CHANGELOG.md +39 -1
- package/dist/{JsonEditor-CM-CG-FK.js → JsonEditor-0ZT9yNXj.js} +1 -1
- package/dist/{JsonEditor-DPtZkKQi.cjs → JsonEditor-EOISr6OE.cjs} +1 -1
- package/dist/{MarkdownEditor-D4WuEafx.cjs → MarkdownEditor-BfeV6-XV.cjs} +1 -1
- package/dist/{MarkdownEditor-DRQoDnC-.js → MarkdownEditor-Csbic0gz.js} +1 -1
- package/dist/{MarkdownEditor-cdq8UZxL.js → MarkdownEditor-D8p7zjZ1.js} +1 -1
- package/dist/{MarkdownEditor-DyIvPpmt.cjs → MarkdownEditor-vV5rCB3Y.cjs} +1 -1
- package/dist/components-manifest.json +468 -11
- package/dist/dial-ui-kit.cjs.js +1 -1
- package/dist/dial-ui-kit.es.js +186 -174
- package/dist/{index-CBk9P1Pa.js → index-BVZGIW7V.js} +8313 -7777
- package/dist/{index-A_KNCHda.cjs → index-Ho1ZjGNx.cjs} +29 -29
- package/dist/index.css +2 -2
- package/dist/migration-guides/0.14.0/control-color-token-rename.md +143 -0
- package/dist/migration-guides/0.14.0/focus-border-token-role-naming.md +87 -0
- package/dist/migration-guides/README.md +2 -0
- package/dist/src/components/New/Calendar/constants.d.ts +5 -5
- package/dist/src/components/New/Checkbox/Checkbox.d.ts +46 -0
- package/dist/src/components/New/Checkbox/constants.d.ts +10 -0
- package/dist/src/components/New/Dropdown/constants.d.ts +1 -1
- package/dist/src/components/New/EllipsisTooltip/EllipsisTooltip.d.ts +51 -0
- package/dist/src/components/New/EllipsisTooltip/use-truncation.d.ts +21 -0
- package/dist/src/components/New/Input/Button/constants.d.ts +1 -1
- package/dist/src/components/New/Notification/Notification.d.ts +7 -0
- package/dist/src/components/New/Notification/NotificationWrapper.d.ts +2 -0
- package/dist/src/components/New/Radio/Radio.d.ts +48 -0
- package/dist/src/components/New/SegmentedControl/SegmentedControl.d.ts +54 -0
- package/dist/src/components/New/SegmentedControl/constants.d.ts +16 -0
- package/dist/src/components/New/Select/constants.d.ts +1 -1
- package/dist/src/components/New/ToggleIconButton/ToggleIconButton.d.ts +47 -0
- package/dist/src/components/New/Tooltip/Tooltip.d.ts +43 -0
- package/dist/src/components/New/Tooltip/TooltipContainer.d.ts +32 -0
- package/dist/src/components/New/Tooltip/TooltipContent.d.ts +18 -0
- package/dist/src/components/New/Tooltip/TooltipContext.d.ts +115 -0
- package/dist/src/components/New/Tooltip/TooltipTrigger.d.ts +18 -0
- package/dist/src/components/New/Tooltip/constants.d.ts +25 -0
- package/dist/src/components/New/constants/overlay.d.ts +1 -1
- package/dist/src/index.d.ts +19 -1
- package/dist/src/types/notification.d.ts +2 -1
- package/dist/src/types/tooltip.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { CalendarMode } from '../../../types/calendar';
|
|
2
2
|
export declare const DEFAULT_CALENDAR_LOCALE = "en-GB";
|
|
3
3
|
export declare const calendarModeDefaultPlaceholder: Record<CalendarMode, string>;
|
|
4
|
-
export declare const calendarFieldBaseClassName = "flex w-full items-center justify-between gap-2 rounded-xl border border-secondary bg-layer-raised px-4 py-3 dial-small-text text-primary outline-none transition-colors hover:border-
|
|
5
|
-
export declare const calendarFieldDisabledClassName = "!cursor-not-allowed !border-transparent bg-layer-sunken text-control-disable-
|
|
4
|
+
export declare const calendarFieldBaseClassName = "flex w-full items-center justify-between gap-2 rounded-xl border border-secondary bg-layer-raised px-4 py-3 dial-small-text text-primary outline-none transition-colors hover:border-accent-alpha focus-within:border-accent-focus";
|
|
5
|
+
export declare const calendarFieldDisabledClassName = "!cursor-not-allowed !border-transparent bg-layer-sunken text-control-disable-primary hover:!border-transparent";
|
|
6
6
|
export declare const calendarFieldInvalidClassName = "!border-error";
|
|
7
|
-
export declare const calendarPopoverClassName = "z-[53] flex w-[248px] flex-col gap-4 rounded-lg bg-layer-raised px-
|
|
8
|
-
export declare const calendarDayButtonBaseClassName = "flex size-
|
|
7
|
+
export declare const calendarPopoverClassName = "z-[53] flex w-[248px] flex-col gap-4 rounded-lg bg-layer-raised px-2 py-4 shadow-md";
|
|
8
|
+
export declare const calendarDayButtonBaseClassName = "flex size-10 items-center justify-center rounded-full dial-small-text text-primary hover:bg-control-accent-alpha-hover hover:text-primary focus:outline-none focus-visible:outline focus-visible:outline-focus";
|
|
9
9
|
export declare const calendarDaySelectedClassName = "bg-control-accent text-control-permanent";
|
|
10
10
|
export declare const calendarDayTodayClassName = "text-accent dial-small-semi-text";
|
|
11
|
-
export declare const calendarDayOutsideClassName = "text-control-disable-
|
|
11
|
+
export declare const calendarDayOutsideClassName = "text-control-disable-primary";
|
|
12
12
|
export declare const calendarFieldIconClassName = "text-secondary";
|
|
13
13
|
export declare const calendarIcon: import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export declare const calendarNavIcons: {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { FC, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { LabelProps } from '../Label/Label';
|
|
3
|
+
type NativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'onChange' | 'size'>;
|
|
4
|
+
export interface CheckboxProps extends NativeInputProps {
|
|
5
|
+
labelProps?: LabelProps;
|
|
6
|
+
isSelected?: boolean;
|
|
7
|
+
isIndeterminate?: boolean;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onChange?: (value: boolean) => void;
|
|
11
|
+
caption?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A checkbox from the 2.0 design system.
|
|
15
|
+
* aliases: ToggleCheckbox|MultiSelectOption|TriStateCheckbox
|
|
16
|
+
* Design system 2.0
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Checkbox
|
|
21
|
+
* labelProps={{ label: 'Accept terms' }}
|
|
22
|
+
* isSelected={accepted}
|
|
23
|
+
* onChange={setAccepted}
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* `isIndeterminate` takes visual precedence over `isSelected` and announces the
|
|
28
|
+
* control as `mixed` — use it for a parent whose children are partly selected.
|
|
29
|
+
* It also sets the native `indeterminate` DOM property, which no React prop
|
|
30
|
+
* covers. Clicking an indeterminate checkbox selects it, as it does natively.
|
|
31
|
+
*
|
|
32
|
+
* The box and the label text are two sibling `<label for>` elements rather than
|
|
33
|
+
* one wrapper, so the {@link Label} keeps its own `required` marker and
|
|
34
|
+
* `caption` info button — a button nested in a label forwards its clicks to the
|
|
35
|
+
* labelled control. Clicking either one still toggles the checkbox.
|
|
36
|
+
*
|
|
37
|
+
* @param [labelProps] - Props of the {@link Label} rendered next to the control
|
|
38
|
+
* @param [isSelected=false] - The current value of the checkbox
|
|
39
|
+
* @param [isIndeterminate=false] - Whether the checkbox is in the mixed state
|
|
40
|
+
* @param [invalid=false] - Whether the checkbox failed validation (applies error styling)
|
|
41
|
+
* @param [disabled=false] - Whether the checkbox is disabled
|
|
42
|
+
* @param [onChange] - Callback fired with the new value when toggled
|
|
43
|
+
* @param [caption] - Caption text rendered below the label, and described by the checkbox
|
|
44
|
+
*/
|
|
45
|
+
export declare const Checkbox: FC<CheckboxProps>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The check and minus glyphs are decorative: the input's `checked` and
|
|
3
|
+
* `aria-checked` already carry the state, so the icon is hidden from assistive
|
|
4
|
+
* tech. Tabler renders a bare `<svg>` with no role, so `aria-hidden` is explicit.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CHECKBOX_ICON_PROPS: {
|
|
7
|
+
readonly size: 14;
|
|
8
|
+
readonly stroke: 3;
|
|
9
|
+
readonly 'aria-hidden': true;
|
|
10
|
+
};
|
|
@@ -4,6 +4,6 @@ export declare const dropdownSubMenuClassName: string;
|
|
|
4
4
|
export declare const dropdownItemBaseClassName: string;
|
|
5
5
|
export declare const dropdownItemDisabledClassName: string;
|
|
6
6
|
export declare const dropdownItemDangerClassName = "text-error";
|
|
7
|
-
export declare const dropdownDividerClassName = "my-1 border-t border-
|
|
7
|
+
export declare const dropdownDividerClassName = "my-1 border-t border-tertiary";
|
|
8
8
|
export declare const dropdownGap = 4;
|
|
9
9
|
export declare const submenuCaretIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { TooltipContainerOptions } from '../Tooltip/TooltipContext';
|
|
3
|
+
export interface EllipsisTooltipProps extends TooltipContainerOptions {
|
|
4
|
+
text: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
contentClassName?: string;
|
|
7
|
+
hideTooltip?: boolean;
|
|
8
|
+
id?: string;
|
|
9
|
+
customTooltipContent?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Single-line text with a CSS ellipsis that reveals the full string in a
|
|
13
|
+
* tooltip **only when it is actually clipped**.
|
|
14
|
+
* aliases: TruncatedText|TruncationTooltip
|
|
15
|
+
* Design system 2.0
|
|
16
|
+
*
|
|
17
|
+
* Text that fits gets no tooltip at all, so a row of labels does not sprout
|
|
18
|
+
* tooltips that repeat what is already on screen.
|
|
19
|
+
*
|
|
20
|
+
* The width has to be finite for anything to truncate: the element is a
|
|
21
|
+
* `min-w-0`, `flex-1` block, and `className` sets the width it should fit into.
|
|
22
|
+
*
|
|
23
|
+
* a11y: while truncated, the full string is exposed as the element's
|
|
24
|
+
* `aria-label`, so a screen reader reads the whole label even though the
|
|
25
|
+
* tooltip itself renders nothing on mobile screens.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <EllipsisTooltip text="Very long message that will be truncated" />
|
|
30
|
+
*
|
|
31
|
+
* <EllipsisTooltip
|
|
32
|
+
* text={<span className="dial-small-semi-text">Custom node</span>}
|
|
33
|
+
* className="max-w-[160px]"
|
|
34
|
+
* />
|
|
35
|
+
*
|
|
36
|
+
* <EllipsisTooltip text="Tooltip suppressed even when clipped" hideTooltip />
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param text - The text or node to display, truncated with an ellipsis when it does not fit
|
|
40
|
+
* @param [className] - Additional CSS classes for the text element, typically its width
|
|
41
|
+
* @param [contentClassName] - Additional CSS classes for the tooltip bubble
|
|
42
|
+
* @param [hideTooltip=false] - Suppress the tooltip even while the text is truncated
|
|
43
|
+
* @param [id] - `id` of the text element
|
|
44
|
+
* @param [customTooltipContent] - Shown instead of the full text while truncated
|
|
45
|
+
* @param [placement=TooltipPlacement.Bottom] - Side of the text the tooltip is placed on
|
|
46
|
+
* @param [initialOpen=false] - Whether the tooltip starts open (uncontrolled only)
|
|
47
|
+
* @param [isTriggerClickable=false] - Restrict hover handling to mouse input, ignoring touch
|
|
48
|
+
* @param [open] - Controlled open state; disables the hover and focus triggers
|
|
49
|
+
* @param [onOpenChange] - Callback fired when the open state should change
|
|
50
|
+
*/
|
|
51
|
+
export declare const EllipsisTooltip: FC<EllipsisTooltipProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Reports whether an element's text is being cut off by `text-overflow`, so a
|
|
4
|
+
* tooltip can carry the full string only when there is something to reveal.
|
|
5
|
+
*
|
|
6
|
+
* Truncation is a layout fact, not a prop: it depends on the width the element
|
|
7
|
+
* ends up with. The measurement therefore re-runs on every text change, on
|
|
8
|
+
* window resize, and — since a parent can resize without the window doing so —
|
|
9
|
+
* whenever the element's own box changes size.
|
|
10
|
+
*
|
|
11
|
+
* @param text - The rendered content; a change to it re-measures
|
|
12
|
+
* @returns `ref` to attach to the truncating element, whether it `isTruncated`,
|
|
13
|
+
* its `textContent` (the full string even when `text` is a node), and
|
|
14
|
+
* `remeasure` to force a fresh read before an interaction reads the result
|
|
15
|
+
*/
|
|
16
|
+
export declare const useTruncation: <T extends HTMLElement>(text: ReactNode) => {
|
|
17
|
+
ref: import('react').RefObject<T | null>;
|
|
18
|
+
isTruncated: boolean;
|
|
19
|
+
textContent: string;
|
|
20
|
+
remeasure: () => void;
|
|
21
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const inputButtonClassName = "bg-control-neutral-active flex items-center justify-center enabled:text-secondary enabled:hover:text-control-
|
|
1
|
+
export declare const inputButtonClassName = "bg-control-neutral-active flex items-center justify-center enabled:text-secondary enabled:hover:text-control-accent-hover enabled:active:bg-control-accent-alpha-active enabled:hover:bg-control-accent-alpha-hover enabled:active:text-control-accent-active";
|
|
@@ -50,6 +50,13 @@ export interface NotificationProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
50
50
|
* title="Processing"
|
|
51
51
|
* message="Please wait..."
|
|
52
52
|
* />
|
|
53
|
+
*
|
|
54
|
+
* <Notification
|
|
55
|
+
* variant={NotificationVariant.General}
|
|
56
|
+
* type={NotificationType.SectionMessage}
|
|
57
|
+
* title="Title"
|
|
58
|
+
* message="Description text example"
|
|
59
|
+
* />
|
|
53
60
|
* ```
|
|
54
61
|
*
|
|
55
62
|
* @param [variant=NotificationVariant.Info] - Defines the visual style and icon of the alert
|
|
@@ -7,9 +7,11 @@ export declare const InfoToastNotification: FC<NotificationVariantProps>;
|
|
|
7
7
|
export declare const SuccessToastNotification: FC<NotificationVariantProps>;
|
|
8
8
|
export declare const WarningToastNotification: FC<NotificationVariantProps>;
|
|
9
9
|
export declare const LoadingToastNotification: FC<NotificationVariantProps>;
|
|
10
|
+
export declare const GeneralToastNotification: FC<NotificationVariantProps>;
|
|
10
11
|
export declare const ErrorMessageNotification: FC<NotificationTypeProps>;
|
|
11
12
|
export declare const InfoMessageNotification: FC<NotificationTypeProps>;
|
|
12
13
|
export declare const SuccessMessageNotification: FC<NotificationTypeProps>;
|
|
13
14
|
export declare const WarningMessageNotification: FC<NotificationTypeProps>;
|
|
14
15
|
export declare const LoadingMessageNotification: FC<NotificationTypeProps>;
|
|
16
|
+
export declare const GeneralMessageNotification: FC<NotificationTypeProps>;
|
|
15
17
|
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FC, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { LabelProps } from '../Label/Label';
|
|
3
|
+
type NativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'onChange' | 'size' | 'value'>;
|
|
4
|
+
export interface RadioProps extends NativeInputProps {
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
labelProps?: LabelProps;
|
|
8
|
+
isSelected?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
caption?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A radio button from the 2.0 design system.
|
|
15
|
+
* aliases: RadioButton|ChoiceOption|RadioInput
|
|
16
|
+
* Design system 2.0
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Radio
|
|
21
|
+
* name="plan"
|
|
22
|
+
* value="pro"
|
|
23
|
+
* labelProps={{ label: 'Pro' }}
|
|
24
|
+
* isSelected={plan === 'pro'}
|
|
25
|
+
* onChange={setPlan}
|
|
26
|
+
* />
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Radios sharing a `name` form one group: the browser gives them a single tab
|
|
30
|
+
* stop and moves the selection with the arrow keys, so no `role="radiogroup"`
|
|
31
|
+
* wiring is needed here. Wrap a set in a `<fieldset>` with a `<legend>` when the
|
|
32
|
+
* group itself needs a name.
|
|
33
|
+
*
|
|
34
|
+
* The circle and the label text are two sibling `<label for>` elements rather
|
|
35
|
+
* than one wrapper, so the {@link Label} keeps its own `required` marker and
|
|
36
|
+
* `caption` info button — a button nested in a label forwards its clicks to the
|
|
37
|
+
* labelled control. Clicking either one still selects the radio.
|
|
38
|
+
*
|
|
39
|
+
* @param name - The group this radio belongs to; radios sharing it are mutually exclusive
|
|
40
|
+
* @param value - The value reported to `onChange` when this radio is selected
|
|
41
|
+
* @param [labelProps] - Props of the {@link Label} rendered next to the control
|
|
42
|
+
* @param [isSelected=false] - Whether this radio is the selected one of its group
|
|
43
|
+
* @param [disabled=false] - Whether the radio is disabled
|
|
44
|
+
* @param [onChange] - Callback fired with `value` when this radio becomes selected
|
|
45
|
+
* @param [caption] - Caption text rendered below the label, and described by the radio
|
|
46
|
+
*/
|
|
47
|
+
export declare const Radio: FC<RadioProps>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SegmentedControlItem<T extends string = string> {
|
|
3
|
+
value: T;
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SegmentedControlProps<T extends string> {
|
|
10
|
+
items: SegmentedControlItem<T>[];
|
|
11
|
+
value: T;
|
|
12
|
+
onChange: (value: T) => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
segmentClassName?: string;
|
|
16
|
+
'aria-label'?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A single-select switch between a few mutually exclusive, equally sized options.
|
|
20
|
+
* aliases: SegmentedButton|ViewSwitcher|ButtonGroup
|
|
21
|
+
* Design system 2.0
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <SegmentedControl
|
|
26
|
+
* aria-label="View"
|
|
27
|
+
* value={view}
|
|
28
|
+
* onChange={setView}
|
|
29
|
+
* items={[
|
|
30
|
+
* { value: 'list', icon: <IconList />, 'aria-label': 'List' },
|
|
31
|
+
* { value: 'grid', icon: <IconGrid />, 'aria-label': 'Grid' },
|
|
32
|
+
* ]}
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* This is a radio group, not a tab list: it selects a value rather than
|
|
37
|
+
* revealing a panel, so it takes `role="radiogroup"` with `role="radio"`
|
|
38
|
+
* segments. The group is a single tab stop — the selected segment holds it, and
|
|
39
|
+
* the arrow keys, `Home` and `End` move the selection, per the ARIA radio-group
|
|
40
|
+
* pattern. `DialSegmentedControl` (1.0) uses `tablist`/`tab` instead; that is
|
|
41
|
+
* the behaviour this replaces.
|
|
42
|
+
*
|
|
43
|
+
* An icon-only segment still needs a name: give it `aria-label`, since the icon
|
|
44
|
+
* carries no text. A segment with a string `label` is named by it.
|
|
45
|
+
*
|
|
46
|
+
* @param items - Segments to render; each needs a unique `value` and may carry a `label`, `icon` and `disabled` flag
|
|
47
|
+
* @param value - The currently selected `value`
|
|
48
|
+
* @param onChange - Callback fired with the newly selected `value`
|
|
49
|
+
* @param [disabled] - Disables every segment
|
|
50
|
+
* @param [className] - Additional classes for the track
|
|
51
|
+
* @param [segmentClassName] - Additional classes for every segment
|
|
52
|
+
* @param [aria-label] - Names the group as a whole
|
|
53
|
+
*/
|
|
54
|
+
export declare const SegmentedControl: <T extends string>({ items, value, onChange, disabled, className, segmentClassName: segmentClassNameProp, "aria-label": ariaLabel, }: SegmentedControlProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Keys that move the selection inside the group. */
|
|
2
|
+
export declare const NAVIGATION_KEYS: string[];
|
|
3
|
+
/** The sunken track the segments sit in. */
|
|
4
|
+
export declare const containerClassName = "inline-flex w-fit items-center gap-1 rounded-full bg-layer-sunken p-1";
|
|
5
|
+
export declare const segmentClassName = "flex h-8 min-w-8 flex-1 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-full px-4 dial-small-text transition-colors duration-200 outline-offset-0 focus-visible:outline focus-visible:outline-focus";
|
|
6
|
+
/** Selected lifts off the track on a raised surface and keeps the accent at rest. */
|
|
7
|
+
export declare const segmentSelectedClassName = "bg-layer-raised text-accent shadow-xs";
|
|
8
|
+
export declare const segmentUnselectedClassName = "bg-transparent text-secondary";
|
|
9
|
+
export declare const segmentSelectedInteractiveClassName = "cursor-pointer hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active";
|
|
10
|
+
export declare const segmentUnselectedInteractiveClassName = "cursor-pointer hover:bg-control-accent-alpha-hover hover:text-accent active:bg-control-accent-alpha-active";
|
|
11
|
+
/**
|
|
12
|
+
* A disabled segment keeps its shape so the group does not reflow, but drops the
|
|
13
|
+
* accent and the shadow.
|
|
14
|
+
*/
|
|
15
|
+
export declare const segmentDisabledSelectedClassName = "cursor-not-allowed bg-control-disable-primary text-control-disable-primary shadow-none";
|
|
16
|
+
export declare const segmentDisabledUnselectedClassName = "cursor-not-allowed bg-transparent text-control-disable-primary";
|
|
@@ -12,7 +12,7 @@ export declare const selectOptionSelectedClassName = "bg-control-accent-alpha-ho
|
|
|
12
12
|
* default this component relies on).
|
|
13
13
|
*/
|
|
14
14
|
export declare const selectListWidthClassName = "!max-w-[var(--reference-width)]";
|
|
15
|
-
export declare const selectOptionDisabledClassName = "
|
|
15
|
+
export declare const selectOptionDisabledClassName = "text-secondary";
|
|
16
16
|
export declare const dropdownMenuMaxHeight = 352;
|
|
17
17
|
export declare const selectSubMenuGap = 4;
|
|
18
18
|
export declare const selectSubMenuClassName: string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { IconButtonProps } from '../IconButton/IconButton';
|
|
3
|
+
import { TooltipProps } from '../Tooltip/Tooltip';
|
|
4
|
+
type ToggleTooltipProps = Omit<TooltipProps, 'children'>;
|
|
5
|
+
export interface ToggleIconButtonProps extends Omit<IconButtonProps, 'variant' | 'appearance' | 'tooltipProps' | 'onToggle'> {
|
|
6
|
+
icon: ReactNode;
|
|
7
|
+
selectedIcon?: ReactNode;
|
|
8
|
+
isSelected?: boolean;
|
|
9
|
+
onToggle?: (isSelected: boolean) => void;
|
|
10
|
+
tooltipProps?: ToggleTooltipProps;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An icon button that stays pressed, for a setting the icon itself represents.
|
|
14
|
+
* aliases: IconToggle|ToggleButton|BookmarkButton
|
|
15
|
+
* Design system 2.0
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ToggleIconButton
|
|
20
|
+
* icon={<IconBookmark />}
|
|
21
|
+
* selectedIcon={<IconBookmarkFilled />}
|
|
22
|
+
* isSelected={isBookmarked}
|
|
23
|
+
* onToggle={setIsBookmarked}
|
|
24
|
+
* tooltipProps={{ tooltip: 'Bookmark' }}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* This is a button, not a checkbox: the state rides on `aria-pressed`, so one
|
|
29
|
+
* unchanging accessible name covers both states and screen readers announce it
|
|
30
|
+
* as "pressed". Do not switch the name between them — a control that renames
|
|
31
|
+
* itself on click reads as a different control.
|
|
32
|
+
*
|
|
33
|
+
* Built on the primary ghost {@link IconButton}, which already supplies the
|
|
34
|
+
* whole unselected column of the design: a secondary-grey icon that turns
|
|
35
|
+
* accent on hover, an accent-alpha tint on hover and active, and a grey icon
|
|
36
|
+
* when disabled. Selected keeps that accent icon at rest and swaps in
|
|
37
|
+
* `selectedIcon` — usually the filled twin of `icon`.
|
|
38
|
+
*
|
|
39
|
+
* @param icon - Icon shown while unselected; rendered at 16px
|
|
40
|
+
* @param [selectedIcon] - Icon shown while selected; falls back to `icon`
|
|
41
|
+
* @param [isSelected=false] - Whether the toggle is on
|
|
42
|
+
* @param [onToggle] - Callback fired with the next value when clicked
|
|
43
|
+
* @param [size=ElementSize.Small] - Defines the size of the button
|
|
44
|
+
* @param [tooltipProps] - Props of the 2.0 {@link Tooltip} wrapping the button
|
|
45
|
+
*/
|
|
46
|
+
export declare const ToggleIconButton: FC<ToggleIconButtonProps>;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { TooltipContainerOptions } from './TooltipContext';
|
|
3
|
+
export interface TooltipProps extends TooltipContainerOptions {
|
|
4
|
+
hideTooltip?: boolean;
|
|
5
|
+
tooltip?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
triggerClassName?: string;
|
|
9
|
+
contentClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Shows a short explanation next to an element while it is hovered or focused.
|
|
13
|
+
* aliases: HoverPopover|InfoPopover
|
|
14
|
+
* Design system 2.0
|
|
15
|
+
*
|
|
16
|
+
* The tooltip is placed on one of the four sides of the trigger and follows it
|
|
17
|
+
* on scroll, flipping to the opposite side when it would not fit.
|
|
18
|
+
*
|
|
19
|
+
* Tooltip text does not reach assistive technology unless the trigger itself
|
|
20
|
+
* carries it: pass `asChild` so the `aria-describedby` lands on the control
|
|
21
|
+
* rather than on a wrapper `<span>`, and never let a tooltip be the only
|
|
22
|
+
* accessible name of a control — it renders nothing on mobile screens.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Tooltip tooltip="Tooltip text" placement={TooltipPlacement.Top} asChild>
|
|
27
|
+
* <button>Hover me</button>
|
|
28
|
+
* </Tooltip>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param [tooltip] - The content to display in the tooltip
|
|
32
|
+
* @param children - The element that triggers the tooltip
|
|
33
|
+
* @param [asChild=false] - Use the child as the trigger instead of wrapping it in a `<span>`
|
|
34
|
+
* @param [hideTooltip=false] - Suppress the tooltip while keeping the trigger rendered
|
|
35
|
+
* @param [triggerClassName] - Additional CSS classes for the trigger element
|
|
36
|
+
* @param [contentClassName] - Additional CSS classes for the tooltip bubble
|
|
37
|
+
* @param [initialOpen=false] - Whether the tooltip starts open (uncontrolled only)
|
|
38
|
+
* @param [placement=TooltipPlacement.Bottom] - Side of the trigger the tooltip is placed on
|
|
39
|
+
* @param [isTriggerClickable=false] - Restrict hover handling to mouse input, ignoring touch
|
|
40
|
+
* @param [open] - Controlled open state; disables the hover and focus triggers
|
|
41
|
+
* @param [onOpenChange] - Callback fired when the open state should change
|
|
42
|
+
*/
|
|
43
|
+
export declare const Tooltip: FC<TooltipProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { TooltipContainerOptions } from './TooltipContext';
|
|
3
|
+
interface Props {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Provides tooltip positioning and open state to a trigger and a content pair.
|
|
8
|
+
* aliases: TooltipProvider|TooltipRoot
|
|
9
|
+
* Design system 2.0
|
|
10
|
+
*
|
|
11
|
+
* Use it directly only when the trigger and the content cannot be rendered by
|
|
12
|
+
* `Tooltip` itself — for example when the content needs custom markup.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <TooltipContainer placement={TooltipPlacement.Top}>
|
|
17
|
+
* <TooltipTrigger asChild>
|
|
18
|
+
* <button>Hover me</button>
|
|
19
|
+
* </TooltipTrigger>
|
|
20
|
+
* <TooltipContent>Tooltip text</TooltipContent>
|
|
21
|
+
* </TooltipContainer>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param children - The tooltip trigger and content components
|
|
25
|
+
* @param [initialOpen=false] - Whether the tooltip starts open (uncontrolled only)
|
|
26
|
+
* @param [placement=TooltipPlacement.Bottom] - Side of the trigger the tooltip is placed on
|
|
27
|
+
* @param [isTriggerClickable=false] - Restrict hover handling to mouse input, ignoring touch
|
|
28
|
+
* @param [open] - Controlled open state; disables the hover and focus triggers
|
|
29
|
+
* @param [onOpenChange] - Callback fired when the open state should change
|
|
30
|
+
*/
|
|
31
|
+
export declare const TooltipContainer: FC<Props & TooltipContainerOptions>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties, FC, HTMLProps } from 'react';
|
|
2
|
+
export interface TooltipContentProps extends HTMLProps<HTMLDivElement> {
|
|
3
|
+
style?: CSSProperties;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The floating bubble that carries the tooltip text.
|
|
7
|
+
* Design system 2.0
|
|
8
|
+
*
|
|
9
|
+
* Rendered in a portal, above popups and dropdowns, with an arrow pointing back
|
|
10
|
+
* at the trigger. Renders nothing on a mobile screen, where there is no hover
|
|
11
|
+
* to reveal it — so a control must never depend on a tooltip alone to be
|
|
12
|
+
* understood, or to have an accessible name.
|
|
13
|
+
*
|
|
14
|
+
* @param children - The content to display inside the tooltip
|
|
15
|
+
* @param [className] - Additional CSS classes applied to the tooltip bubble
|
|
16
|
+
* @param [style] - Additional inline styles for the tooltip bubble
|
|
17
|
+
*/
|
|
18
|
+
export declare const TooltipContent: FC<TooltipContentProps>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { TooltipPlacement } from '../../../types/tooltip';
|
|
2
|
+
type ContextType = ReturnType<typeof useTooltip> | null;
|
|
3
|
+
export declare const TooltipContext: import('react').Context<ContextType>;
|
|
4
|
+
export interface TooltipContainerOptions {
|
|
5
|
+
initialOpen?: boolean;
|
|
6
|
+
placement?: TooltipPlacement;
|
|
7
|
+
isTriggerClickable?: boolean;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const useTooltipContext: () => {
|
|
12
|
+
placement: import('@floating-ui/utils').Placement;
|
|
13
|
+
strategy: import('@floating-ui/utils').Strategy;
|
|
14
|
+
middlewareData: import('@floating-ui/core').MiddlewareData;
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
isPositioned: boolean;
|
|
18
|
+
update: () => void;
|
|
19
|
+
floatingStyles: React.CSSProperties;
|
|
20
|
+
refs: {
|
|
21
|
+
reference: import('react').MutableRefObject<import('@floating-ui/react-dom').ReferenceType | null>;
|
|
22
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
23
|
+
setReference: (node: import('@floating-ui/react-dom').ReferenceType | null) => void;
|
|
24
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
25
|
+
} & import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
26
|
+
elements: {
|
|
27
|
+
reference: import('@floating-ui/react-dom').ReferenceType | null;
|
|
28
|
+
floating: HTMLElement | null;
|
|
29
|
+
} & import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
30
|
+
context: {
|
|
31
|
+
placement: import('@floating-ui/utils').Placement;
|
|
32
|
+
strategy: import('@floating-ui/utils').Strategy;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
middlewareData: import('@floating-ui/core').MiddlewareData;
|
|
36
|
+
isPositioned: boolean;
|
|
37
|
+
update: () => void;
|
|
38
|
+
floatingStyles: React.CSSProperties;
|
|
39
|
+
open: boolean;
|
|
40
|
+
onOpenChange: (open: boolean, event?: Event, reason?: import('@floating-ui/react').OpenChangeReason) => void;
|
|
41
|
+
events: import('@floating-ui/react').FloatingEvents;
|
|
42
|
+
dataRef: React.MutableRefObject<import('@floating-ui/react').ContextData>;
|
|
43
|
+
nodeId: string | undefined;
|
|
44
|
+
floatingId: string | undefined;
|
|
45
|
+
refs: import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
46
|
+
elements: import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
47
|
+
};
|
|
48
|
+
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
|
|
49
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
50
|
+
getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
|
|
51
|
+
active?: boolean;
|
|
52
|
+
selected?: boolean;
|
|
53
|
+
}) => Record<string, unknown>;
|
|
54
|
+
open: boolean;
|
|
55
|
+
setOpen: (open: boolean) => void;
|
|
56
|
+
arrowRef: import('react').RefObject<SVGSVGElement | null>;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Positioning and interaction state shared by the tooltip trigger and content.
|
|
60
|
+
* Design system 2.0
|
|
61
|
+
*
|
|
62
|
+
* @param [initialOpen=false] - Whether the tooltip starts open (uncontrolled only)
|
|
63
|
+
* @param [placement=TooltipPlacement.Bottom] - Side of the trigger the tooltip is placed on
|
|
64
|
+
* @param [isTriggerClickable=false] - Restrict hover handling to mouse input, ignoring touch
|
|
65
|
+
* @param [open] - Controlled open state; disables the hover and focus triggers
|
|
66
|
+
* @param [onOpenChange] - Callback fired when the open state should change
|
|
67
|
+
*/
|
|
68
|
+
export declare const useTooltip: ({ initialOpen, placement, isTriggerClickable, open: controlledOpen, onOpenChange: setControlledOpen, }?: TooltipContainerOptions) => {
|
|
69
|
+
placement: import('@floating-ui/utils').Placement;
|
|
70
|
+
strategy: import('@floating-ui/utils').Strategy;
|
|
71
|
+
middlewareData: import('@floating-ui/core').MiddlewareData;
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
isPositioned: boolean;
|
|
75
|
+
update: () => void;
|
|
76
|
+
floatingStyles: React.CSSProperties;
|
|
77
|
+
refs: {
|
|
78
|
+
reference: import('react').MutableRefObject<import('@floating-ui/react-dom').ReferenceType | null>;
|
|
79
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
80
|
+
setReference: (node: import('@floating-ui/react-dom').ReferenceType | null) => void;
|
|
81
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
82
|
+
} & import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
83
|
+
elements: {
|
|
84
|
+
reference: import('@floating-ui/react-dom').ReferenceType | null;
|
|
85
|
+
floating: HTMLElement | null;
|
|
86
|
+
} & import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
87
|
+
context: {
|
|
88
|
+
placement: import('@floating-ui/utils').Placement;
|
|
89
|
+
strategy: import('@floating-ui/utils').Strategy;
|
|
90
|
+
x: number;
|
|
91
|
+
y: number;
|
|
92
|
+
middlewareData: import('@floating-ui/core').MiddlewareData;
|
|
93
|
+
isPositioned: boolean;
|
|
94
|
+
update: () => void;
|
|
95
|
+
floatingStyles: React.CSSProperties;
|
|
96
|
+
open: boolean;
|
|
97
|
+
onOpenChange: (open: boolean, event?: Event, reason?: import('@floating-ui/react').OpenChangeReason) => void;
|
|
98
|
+
events: import('@floating-ui/react').FloatingEvents;
|
|
99
|
+
dataRef: React.MutableRefObject<import('@floating-ui/react').ContextData>;
|
|
100
|
+
nodeId: string | undefined;
|
|
101
|
+
floatingId: string | undefined;
|
|
102
|
+
refs: import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
103
|
+
elements: import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
104
|
+
};
|
|
105
|
+
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
|
|
106
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
107
|
+
getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
|
|
108
|
+
active?: boolean;
|
|
109
|
+
selected?: boolean;
|
|
110
|
+
}) => Record<string, unknown>;
|
|
111
|
+
open: boolean;
|
|
112
|
+
setOpen: (open: boolean) => void;
|
|
113
|
+
arrowRef: import('react').RefObject<SVGSVGElement | null>;
|
|
114
|
+
};
|
|
115
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, HTMLProps } from 'react';
|
|
2
|
+
interface TooltipTriggerProps extends HTMLProps<HTMLElement> {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The element a tooltip is anchored to and opened from.
|
|
7
|
+
* Design system 2.0
|
|
8
|
+
*
|
|
9
|
+
* Prefer `asChild` whenever the trigger is a single element: it puts the
|
|
10
|
+
* `aria-describedby` that names the tooltip on the control itself instead of on
|
|
11
|
+
* a wrapper `<span>`, which is the only way the tooltip text reaches assistive
|
|
12
|
+
* technology.
|
|
13
|
+
*
|
|
14
|
+
* @param children - The element that opens the tooltip
|
|
15
|
+
* @param [asChild=false] - Render the child as the trigger instead of wrapping it in a `<span>`
|
|
16
|
+
*/
|
|
17
|
+
export declare const TooltipTrigger: FC<TooltipTriggerProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip layout and styling constants.
|
|
3
|
+
* Design system 2.0
|
|
4
|
+
*/
|
|
5
|
+
/** Height of the `FloatingArrow` triangle, in px — its default `height`. */
|
|
6
|
+
export declare const ARROW_HEIGHT = 7;
|
|
7
|
+
/** Space left between the arrow tip and the trigger, in px. */
|
|
8
|
+
export declare const ARROW_GAP = 2;
|
|
9
|
+
/**
|
|
10
|
+
* Delay before an on-hover tooltip opens, in ms. Long enough that a pointer
|
|
11
|
+
* crossing the trigger on its way somewhere else does not flash a tooltip.
|
|
12
|
+
*/
|
|
13
|
+
export declare const HOVER_OPEN_DELAY = 500;
|
|
14
|
+
/**
|
|
15
|
+
* The arrow is an SVG outside the tooltip box, so it cannot inherit the box's
|
|
16
|
+
* background — keep this in sync with `bg-control-inverted` in
|
|
17
|
+
* `tooltipClassName`. A CSS fill beats the `fill` presentation attribute
|
|
18
|
+
* `FloatingArrow` puts on the `<svg>`, and the filled `<path>` inherits it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const arrowClassName = "fill-control-inverted";
|
|
21
|
+
/**
|
|
22
|
+
* Tooltips sit above popups, dropdowns and the calendar (all `z-[53]`), since
|
|
23
|
+
* they can be triggered by a control inside one of them.
|
|
24
|
+
*/
|
|
25
|
+
export declare const tooltipClassName = "z-[55] max-w-[300px] whitespace-pre-wrap break-words rounded-lg bg-control-inverted px-3 py-2 dial-small-text text-control-inverted";
|
|
@@ -19,6 +19,6 @@ export declare const overlaySubMenuClassName: string;
|
|
|
19
19
|
export declare const overlayItemClassName: string;
|
|
20
20
|
/** Tint marking the row that is currently selected. */
|
|
21
21
|
export declare const overlayItemSelectedClassName = "bg-control-accent-alpha-hover";
|
|
22
|
-
export declare const overlayItemDisabledClassName = "
|
|
22
|
+
export declare const overlayItemDisabledClassName = "text-secondary";
|
|
23
23
|
/** Distance between the trigger and its panel, and between nested panels. */
|
|
24
24
|
export declare const overlayGap = 4;
|