@epam/ai-dial-ui-kit 0.13.0 → 0.14.0-dev.11
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 +7 -1
- package/dist/CHANGELOG.md +56 -1
- package/dist/{JsonEditor-BSP5Z3Xw.js → JsonEditor-B-EMx5BY.js} +1 -1
- package/dist/{JsonEditor-CcU9RmZg.cjs → JsonEditor-BAWk7XXc.cjs} +1 -1
- package/dist/{MarkdownEditor-DF_jStOx.cjs → MarkdownEditor-B4VOwIVY.cjs} +1 -1
- package/dist/{MarkdownEditor-DjKuq5lz.js → MarkdownEditor-BJnJ74CN.js} +1 -1
- package/dist/{MarkdownEditor-9XU06KHN.cjs → MarkdownEditor-BkkQlx9o.cjs} +1 -1
- package/dist/{MarkdownEditor-ClquLQAD.js → MarkdownEditor-DPlMgApq.js} +1 -1
- package/dist/components-manifest.json +1434 -206
- package/dist/dial-ui-kit.cjs.js +1 -1
- package/dist/dial-ui-kit.es.js +214 -194
- package/dist/{index-Hb-5oCTq.js → index-C30-CsGh.js} +14418 -13205
- package/dist/{index-ZeU1Gm87.cjs → index-DL9rE-US.cjs} +31 -31
- package/dist/index.css +2 -2
- package/dist/migration-guides/0.14.0/button-tooltip-2-0.md +111 -0
- 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/0.14.0/select-multiselect-option-row.md +99 -0
- package/dist/migration-guides/0.14.0/shadow-token-per-step-rename.md +104 -0
- package/dist/migration-guides/0.14.0/tag-single-size.md +121 -0
- package/dist/migration-guides/README.md +6 -0
- package/dist/src/components/Analytics/Card/Card.d.ts +2 -1
- package/dist/src/components/Analytics/Histogram/Histogram.d.ts +6 -4
- package/dist/src/components/Analytics/Histogram/utils.d.ts +10 -0
- package/dist/src/components/New/Button/Button.d.ts +4 -3
- package/dist/src/components/New/Calendar/constants.d.ts +5 -5
- package/dist/src/components/New/Checkbox/Checkbox.d.ts +50 -0
- package/dist/src/components/New/Checkbox/CheckboxBox.d.ts +30 -0
- package/dist/src/components/New/Checkbox/constants.d.ts +10 -0
- package/dist/src/components/New/CollapsibleSidebar/CollapsibleSidebar.d.ts +82 -0
- package/dist/src/components/New/Dropdown/constants.d.ts +3 -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/Highlight/Highlight.d.ts +1 -1
- package/dist/src/components/New/IconButton/IconButton.d.ts +4 -4
- package/dist/src/components/New/Input/Button/constants.d.ts +1 -1
- package/dist/src/components/New/Label/Label.d.ts +5 -0
- 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/Popup/Popup.d.ts +48 -9
- package/dist/src/components/New/Popup/constants.d.ts +7 -0
- package/dist/src/components/New/Radio/Radio.d.ts +48 -0
- package/dist/src/components/New/RadioGroup/RadioGroup.d.ts +78 -0
- package/dist/src/components/New/RadioGroup/constants.d.ts +11 -0
- package/dist/src/components/New/RadioGroupPopupField/RadioGroupPopupField.d.ts +93 -0
- package/dist/src/components/New/RadioGroupPopupField/constants.d.ts +22 -0
- package/dist/src/components/New/ResizableContainer/ConditionalResizableContainer.d.ts +34 -0
- package/dist/src/components/New/ResizableContainer/ResizableContainer.d.ts +76 -0
- package/dist/src/components/New/ResizableContainer/components/ResizeHandle.d.ts +21 -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 +2 -2
- package/dist/src/components/New/Slider/Slider.d.ts +70 -0
- package/dist/src/components/New/Tag/Tag.d.ts +26 -4
- package/dist/src/components/New/Tag/constants.d.ts +23 -0
- 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 +30 -0
- package/dist/src/components/New/constants/overlay.d.ts +12 -3
- package/dist/src/index.d.ts +34 -1
- package/dist/src/models/dropdown.d.ts +10 -0
- package/dist/src/types/notification.d.ts +2 -1
- package/dist/src/types/tag.d.ts +4 -0
- package/dist/src/types/tooltip.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { FC, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
export interface CollapsibleSidebarProps {
|
|
3
|
+
/** Content shown while the sidebar is expanded. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Name of the panel, rendered as vertical text while collapsed. */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** Width in px while expanded. Defaults to `280`. */
|
|
8
|
+
width?: number;
|
|
9
|
+
/** Width in px while collapsed. Defaults to `48`. */
|
|
10
|
+
collapsedWidth?: number;
|
|
11
|
+
/** Controlled open state. When provided, the component becomes controlled. */
|
|
12
|
+
isOpened?: boolean;
|
|
13
|
+
/** Initial open state when uncontrolled. Defaults to `true`. */
|
|
14
|
+
defaultOpened?: boolean;
|
|
15
|
+
/** Fired when the toggle is clicked. Receives the next open state. */
|
|
16
|
+
onToggle?: (nextOpened: boolean, e: MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
/** Extra controls rendered in the footer next to the toggle, expanded only. */
|
|
18
|
+
additionalButtons?: ReactNode;
|
|
19
|
+
/** Accessible name of the sidebar region. Defaults to `'Sidebar'`. */
|
|
20
|
+
ariaLabel?: string;
|
|
21
|
+
/** Name and tooltip of the toggle while expanded. Defaults to `'Collapse sidebar'`. */
|
|
22
|
+
collapseLabel?: string;
|
|
23
|
+
/** Name and tooltip of the toggle while collapsed. Defaults to `'Expand sidebar'`. */
|
|
24
|
+
expandLabel?: string;
|
|
25
|
+
/** Additional CSS classes for the outer container. */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Additional CSS classes for the vertical title. */
|
|
28
|
+
titleClassName?: string;
|
|
29
|
+
/** Additional CSS classes for the content region. */
|
|
30
|
+
contentClassName?: string;
|
|
31
|
+
/** Additional CSS classes for the footer holding the toggle. */
|
|
32
|
+
footerClassName?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A side panel that collapses to a narrow rail carrying its title vertically.
|
|
36
|
+
* aliases: ToggleSidebar|CollapsiblePanel|SidePanel
|
|
37
|
+
* Design system 2.0
|
|
38
|
+
*
|
|
39
|
+
* Works as a controlled component when `isOpened` is provided, otherwise it keeps
|
|
40
|
+
* its own state from `defaultOpened`. The width is derived from the open state, so
|
|
41
|
+
* changing `width` on an open sidebar takes effect immediately.
|
|
42
|
+
*
|
|
43
|
+
* The panel is an `aside` named by `ariaLabel`, and the toggle is a real
|
|
44
|
+
* `aria-expanded` control pointing at the content region. Content stays mounted
|
|
45
|
+
* while collapsed — hidden with `display: none` — so scroll position and any
|
|
46
|
+
* form state inside it survive a collapse.
|
|
47
|
+
*
|
|
48
|
+
* The container paints no background and no radius: it is meant to sit on the
|
|
49
|
+
* surface it belongs to. Pass `className` for either.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <CollapsibleSidebar title="Filters" width={320}>
|
|
54
|
+
* <FilterForm />
|
|
55
|
+
* </CollapsibleSidebar>
|
|
56
|
+
*
|
|
57
|
+
* <CollapsibleSidebar
|
|
58
|
+
* title="Filters"
|
|
59
|
+
* isOpened={opened}
|
|
60
|
+
* onToggle={setOpened}
|
|
61
|
+
* >
|
|
62
|
+
* <FilterForm />
|
|
63
|
+
* </CollapsibleSidebar>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param children - Content shown while the sidebar is expanded.
|
|
67
|
+
* @param title - Name of the panel, rendered as vertical text while collapsed.
|
|
68
|
+
* @param [width=280] - Width in px while expanded.
|
|
69
|
+
* @param [collapsedWidth=48] - Width in px while collapsed.
|
|
70
|
+
* @param [isOpened] - Controlled open state.
|
|
71
|
+
* @param [defaultOpened=true] - Initial open state when uncontrolled.
|
|
72
|
+
* @param [onToggle] - Fired when the toggle is clicked. Receives the next open state.
|
|
73
|
+
* @param [additionalButtons] - Extra footer controls, rendered while expanded.
|
|
74
|
+
* @param [ariaLabel='Sidebar'] - Accessible name of the sidebar region.
|
|
75
|
+
* @param [collapseLabel='Collapse sidebar'] - Name and tooltip of the toggle while expanded.
|
|
76
|
+
* @param [expandLabel='Expand sidebar'] - Name and tooltip of the toggle while collapsed.
|
|
77
|
+
* @param [className] - Additional CSS classes for the outer container.
|
|
78
|
+
* @param [titleClassName] - Additional CSS classes for the vertical title.
|
|
79
|
+
* @param [contentClassName] - Additional CSS classes for the content region.
|
|
80
|
+
* @param [footerClassName] - Additional CSS classes for the footer.
|
|
81
|
+
*/
|
|
82
|
+
export declare const CollapsibleSidebar: FC<CollapsibleSidebarProps>;
|
|
@@ -2,8 +2,10 @@ export declare const dropdownBaseClassName: string;
|
|
|
2
2
|
export declare const dropdownListBaseClassName: string;
|
|
3
3
|
export declare const dropdownSubMenuClassName: string;
|
|
4
4
|
export declare const dropdownItemBaseClassName: string;
|
|
5
|
+
/** Tint marking a checked multiselect row. */
|
|
6
|
+
export declare const dropdownItemSelectedClassName = "bg-control-accent-alpha";
|
|
5
7
|
export declare const dropdownItemDisabledClassName: string;
|
|
6
8
|
export declare const dropdownItemDangerClassName = "text-error";
|
|
7
|
-
export declare const dropdownDividerClassName = "my-1 border-t border-
|
|
9
|
+
export declare const dropdownDividerClassName = "my-1 border-t border-tertiary";
|
|
8
10
|
export declare const dropdownGap = 4;
|
|
9
11
|
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
|
+
};
|
|
@@ -7,7 +7,7 @@ export interface HighlightProps {
|
|
|
7
7
|
query: string;
|
|
8
8
|
/** Optional class name for the highlighted segment. */
|
|
9
9
|
markClassName?: string;
|
|
10
|
-
/** Optional class name forwarded to the `
|
|
10
|
+
/** Optional class name forwarded to the `EllipsisTooltip` container. */
|
|
11
11
|
className?: string;
|
|
12
12
|
/** Maximum number of lines to display before truncating. Use `1` for single-line ellipsis truncation (e.g. list rows). Defaults to `2`. */
|
|
13
13
|
maxLines?: number;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, DetailedHTMLProps, FC, ReactNode } from 'react';
|
|
2
2
|
import { ButtonAppearance, ButtonVariant } from '../../../types/button';
|
|
3
|
-
import { DialTooltipProps } from '../../Tooltip/Tooltip';
|
|
4
3
|
import { ElementSize } from '../../../types/size';
|
|
5
|
-
|
|
4
|
+
import { TooltipProps } from '../Tooltip/Tooltip';
|
|
5
|
+
type IconButtonTooltipProps = Omit<TooltipProps, 'children'>;
|
|
6
6
|
export interface IconButtonProps extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
7
7
|
variant?: ButtonVariant;
|
|
8
8
|
size?: ElementSize;
|
|
9
9
|
appearance?: ButtonAppearance;
|
|
10
10
|
icon: ReactNode;
|
|
11
|
-
tooltipProps?:
|
|
11
|
+
tooltipProps?: IconButtonTooltipProps;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* A Icon Button component with flexible icon and text positioning
|
|
@@ -41,7 +41,7 @@ export interface IconButtonProps extends DetailedHTMLProps<ButtonHTMLAttributes<
|
|
|
41
41
|
* @param [variant] - Defines the visual style of the button
|
|
42
42
|
* @param [appearance=ButtonAppearance.Solid] - Defines the type of the button
|
|
43
43
|
* @param [size=ElementSize.Standard] - Defines the size of the button
|
|
44
|
-
* @param [
|
|
44
|
+
* @param [tooltipProps] - Props of the 2.0 {@link Tooltip} wrapping the button
|
|
45
45
|
* @param icon - Icon display
|
|
46
46
|
*/
|
|
47
47
|
export declare const IconButton: FC<IconButtonProps>;
|
|
@@ -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";
|
|
@@ -6,6 +6,7 @@ export interface LabelProps extends NativeLabelProps {
|
|
|
6
6
|
required?: boolean;
|
|
7
7
|
caption?: string;
|
|
8
8
|
size?: ElementSize;
|
|
9
|
+
containerClassName?: string;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* A label component
|
|
@@ -28,6 +29,10 @@ export interface LabelProps extends NativeLabelProps {
|
|
|
28
29
|
* plus visually hidden text so the requirement is announced too.
|
|
29
30
|
* @param [caption] - Explanatory text, exposed through an info button next to the label
|
|
30
31
|
* @param [size] - The size of the label, which can be 'small', 'medium', or 'large'.
|
|
32
|
+
* @param [containerClassName] - Additional classes for the wrapper holding the
|
|
33
|
+
* `<label>` and its info button. Needed when the label is a flex item that has
|
|
34
|
+
* to shrink: a wrapper left at `min-width: auto` cannot, so its text overflows
|
|
35
|
+
* instead of truncating.
|
|
31
36
|
*/
|
|
32
37
|
export declare const Label: FC<LabelProps>;
|
|
33
38
|
export {};
|
|
@@ -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 {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FC, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button/Button';
|
|
2
3
|
import { PopupSize } from '../../../types/popup';
|
|
3
4
|
export interface PopupProps {
|
|
4
5
|
open?: boolean;
|
|
@@ -13,7 +14,16 @@ export interface PopupProps {
|
|
|
13
14
|
bodyClassName?: string;
|
|
14
15
|
children?: ReactNode;
|
|
15
16
|
footer?: ReactNode;
|
|
17
|
+
footerClassName?: string;
|
|
16
18
|
onClose?: (e?: MouseEvent<HTMLButtonElement> | null) => void;
|
|
19
|
+
onBack?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
20
|
+
backAriaLabel?: string;
|
|
21
|
+
headerActions?: ReactNode;
|
|
22
|
+
headerDivider?: boolean;
|
|
23
|
+
mainButtons?: ButtonProps[];
|
|
24
|
+
additionalButtons?: ButtonProps[];
|
|
25
|
+
additionalButtonsOnLeft?: boolean;
|
|
26
|
+
footerDivider?: boolean;
|
|
17
27
|
size?: PopupSize;
|
|
18
28
|
hideClose?: boolean;
|
|
19
29
|
closeAriaLabel?: string;
|
|
@@ -27,8 +37,18 @@ export interface PopupProps {
|
|
|
27
37
|
*
|
|
28
38
|
* Renders in a portal with a scrim overlay, focus management, a header with the
|
|
29
39
|
* title and close control, a scrollable body and an optional footer. Sections
|
|
30
|
-
* are separated by spacing rather than rules;
|
|
31
|
-
* `
|
|
40
|
+
* are separated by spacing rather than rules; opt into a rule with
|
|
41
|
+
* `headerDivider` / `footerDivider`.
|
|
42
|
+
*
|
|
43
|
+
* The header grows from the title alone: `onBack` prepends a back control,
|
|
44
|
+
* `headerActions` sits between the title and the close button.
|
|
45
|
+
*
|
|
46
|
+
* The footer is declared as data, not markup: `mainButtons` and
|
|
47
|
+
* `additionalButtons` take {@link ButtonProps} and the popup renders the
|
|
48
|
+
* {@link Button}s itself, so spacing, order and the neutral default are the
|
|
49
|
+
* same on every dialog. `additionalButtonsOnLeft` moves the secondary group to
|
|
50
|
+
* the opposite edge. A `footer` node still wins over both, for the rare surface
|
|
51
|
+
* that needs something other than a row of buttons.
|
|
32
52
|
*
|
|
33
53
|
* A string `header` names the dialog automatically. A `header` node cannot —
|
|
34
54
|
* pass `ariaLabel` in that case, or the dialog opens unnamed.
|
|
@@ -39,12 +59,22 @@ export interface PopupProps {
|
|
|
39
59
|
* open
|
|
40
60
|
* header="Title"
|
|
41
61
|
* size={PopupSize.Md}
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
62
|
+
* onBack={() => setStep(step - 1)}
|
|
63
|
+
* headerActions={<InfoButton caption="What is this?" />}
|
|
64
|
+
* additionalButtonsOnLeft
|
|
65
|
+
* additionalButtons={[
|
|
66
|
+
* {
|
|
67
|
+
* label: 'Back',
|
|
68
|
+
* variant: ButtonVariant.Primary,
|
|
69
|
+
* appearance: ButtonAppearance.Link,
|
|
70
|
+
* iconBefore: <IconArrowLeft />,
|
|
71
|
+
* onClick: goBack,
|
|
72
|
+
* },
|
|
73
|
+
* ]}
|
|
74
|
+
* mainButtons={[
|
|
75
|
+
* { label: 'Cancel', onClick: () => setOpen(false) },
|
|
76
|
+
* { label: 'Confirm', variant: ButtonVariant.Primary, onClick: submit },
|
|
77
|
+
* ]}
|
|
48
78
|
* onClose={() => setOpen(false)}
|
|
49
79
|
* >
|
|
50
80
|
* <div className="px-6 py-4">Dialog content goes here…</div>
|
|
@@ -61,7 +91,16 @@ export interface PopupProps {
|
|
|
61
91
|
* @param [headerClassName] - Additional CSS classes applied to the popup header container
|
|
62
92
|
* @param [bodyClassName] - Additional CSS classes applied to the scrollable body wrapper around `children`
|
|
63
93
|
* @param [children] - Body content
|
|
64
|
-
* @param [footer] -
|
|
94
|
+
* @param [footer] - Custom footer node; overrides `mainButtons` and `additionalButtons`
|
|
95
|
+
* @param [footerClassName] - Additional CSS classes applied to the built-in footer container
|
|
96
|
+
* @param [onBack] - Callback for the header back button; the button renders only when set
|
|
97
|
+
* @param [backAriaLabel="Back"] - Accessible name of the back button
|
|
98
|
+
* @param [headerActions] - Controls rendered between the title and the close button
|
|
99
|
+
* @param [headerDivider=false] - Whether a rule is drawn under the header
|
|
100
|
+
* @param [mainButtons] - Primary footer buttons, aligned to the trailing edge; each defaults to `ButtonVariant.Neutral`
|
|
101
|
+
* @param [additionalButtons] - Secondary footer buttons, next to `mainButtons` unless moved left
|
|
102
|
+
* @param [additionalButtonsOnLeft=false] - Whether `additionalButtons` sit on the leading edge
|
|
103
|
+
* @param [footerDivider=false] - Whether a rule is drawn above the footer
|
|
65
104
|
* @param [onClose] - Callback fired when the popup requests to close
|
|
66
105
|
* @param [size=PopupSize.Md] - Sets the max-width of the popup
|
|
67
106
|
* @param [hideClose=false] - Whether the close button is hidden in the header
|
|
@@ -3,6 +3,13 @@ export declare const popupOverlayBaseClassName = "z-[52] flex items-center justi
|
|
|
3
3
|
export declare const popupBaseClassName = "relative flex w-full max-h-full flex-col rounded-xl bg-layer-raised md:h-auto";
|
|
4
4
|
export declare const popupHeaderClassName = "flex flex-row items-center justify-between px-6 py-4";
|
|
5
5
|
export declare const popupTitleClassName = "flex-1 min-w-0 mr-3 truncate dial-h1-text text-primary";
|
|
6
|
+
/** Rule under the header. Opt-in: by default sections are separated by spacing. */
|
|
7
|
+
export declare const popupHeaderDividerClassName = "border-b border-tertiary";
|
|
8
|
+
export declare const popupFooterClassName = "flex flex-row items-center gap-2 px-6 py-4";
|
|
9
|
+
/** Rule above the footer, mirroring the header. */
|
|
10
|
+
export declare const popupFooterDividerClassName = "border-t border-tertiary";
|
|
11
|
+
/** Groups the controls sitting on one side of the header or footer. */
|
|
12
|
+
export declare const popupActionsGroupClassName = "flex shrink-0 flex-row items-center gap-2";
|
|
6
13
|
/**
|
|
7
14
|
* Max widths per size. Full width below the `md` breakpoint, where the popup
|
|
8
15
|
* fills the screen.
|
|
@@ -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,78 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { LabelProps } from '../Label/Label';
|
|
3
|
+
import { RadioGroupOrientation } from '../../../types/radio-group';
|
|
4
|
+
export interface RadioGroupItem {
|
|
5
|
+
value: string;
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
/** Explanatory text rendered under the option's label. */
|
|
8
|
+
caption?: string;
|
|
9
|
+
/** Content revealed under the option while it is the selected one. */
|
|
10
|
+
content?: ReactNode;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Names the option when its `label` is not a string (or absent). */
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RadioGroupProps {
|
|
16
|
+
items: RadioGroupItem[];
|
|
17
|
+
value?: string;
|
|
18
|
+
onChange: (value: string) => void;
|
|
19
|
+
name?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
orientation?: RadioGroupOrientation;
|
|
22
|
+
labelProps?: LabelProps;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
error?: string;
|
|
25
|
+
caption?: string;
|
|
26
|
+
ariaLabel?: string;
|
|
27
|
+
className?: string;
|
|
28
|
+
optionsClassName?: string;
|
|
29
|
+
radioClassName?: string;
|
|
30
|
+
contentClassName?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A set of mutually exclusive {@link Radio} options with one group label.
|
|
34
|
+
* aliases: SelectionGroup|OptionGroup|RadioList
|
|
35
|
+
* Design system 2.0
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <RadioGroup
|
|
40
|
+
* labelProps={{ label: 'Delivery' }}
|
|
41
|
+
* value={delivery}
|
|
42
|
+
* onChange={setDelivery}
|
|
43
|
+
* items={[
|
|
44
|
+
* { value: 'pickup', label: 'Pickup', caption: 'Free, ready today' },
|
|
45
|
+
* { value: 'courier', label: 'Courier', content: <AddressForm /> },
|
|
46
|
+
* ]}
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* The options are native radios sharing one `name`, so the browser gives the
|
|
51
|
+
* group a single tab stop and moves the selection with the arrow keys — no
|
|
52
|
+
* roving `tabindex` is needed. The wrapper still takes `role="radiogroup"` so
|
|
53
|
+
* the group's own name is announced before the options.
|
|
54
|
+
*
|
|
55
|
+
* An option's `content` is mounted only while that option is selected, so a
|
|
56
|
+
* form or an input inside it never holds focus for an option the user has moved
|
|
57
|
+
* away from.
|
|
58
|
+
*
|
|
59
|
+
* The group is named by `labelProps.label` when that is a string, and by
|
|
60
|
+
* `ariaLabel` otherwise — a group whose label is a node has no other name.
|
|
61
|
+
*
|
|
62
|
+
* @param items - Options to render; each needs a unique `value` and may carry a `label`, `caption`, `content` and `disabled` flag
|
|
63
|
+
* @param [value] - The `value` of the selected option
|
|
64
|
+
* @param onChange - Callback fired with the newly selected `value`
|
|
65
|
+
* @param [name] - The `name` shared by the underlying radios; defaults to the group id
|
|
66
|
+
* @param [id] - Base id for the group; option ids are derived from it
|
|
67
|
+
* @param [orientation=RadioGroupOrientation.Column] - Whether the options stack or sit in a row
|
|
68
|
+
* @param [labelProps] - Props of the {@link Label} rendered above the options
|
|
69
|
+
* @param [disabled] - Disables every option
|
|
70
|
+
* @param [error] - Error message rendered below the options
|
|
71
|
+
* @param [caption] - Helper text rendered below the options when there is no `error`
|
|
72
|
+
* @param [ariaLabel] - Names the group when there is no string `labelProps.label`
|
|
73
|
+
* @param [className] - Additional classes for the outer container
|
|
74
|
+
* @param [optionsClassName] - Additional classes for the options wrapper
|
|
75
|
+
* @param [radioClassName] - Additional classes for every option's control row
|
|
76
|
+
* @param [contentClassName] - Additional classes for the selected option's content
|
|
77
|
+
*/
|
|
78
|
+
export declare const RadioGroup: FC<RadioGroupProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RadioGroupOrientation } from '../../../types/radio-group';
|
|
2
|
+
/** Label, options and caption/error stack, matching the 2.0 field rhythm. */
|
|
3
|
+
export declare const groupBaseClassName = "flex flex-col gap-2";
|
|
4
|
+
export declare const optionsWrapperBaseClassName = "flex";
|
|
5
|
+
/**
|
|
6
|
+
* Content revealed under the selected option. The inline offset is the one
|
|
7
|
+
* `Radio` gives its own caption, so the content lines up with the option's
|
|
8
|
+
* label text rather than with its circle.
|
|
9
|
+
*/
|
|
10
|
+
export declare const selectedContentClassName = "mt-2 ml-[26px]";
|
|
11
|
+
export declare const orientationClassMap: Record<RadioGroupOrientation, string>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { LabelProps } from '../Label/Label';
|
|
3
|
+
import { RadioGroupItem } from '../RadioGroup/RadioGroup';
|
|
4
|
+
import { PopupSize } from '../../../types/popup';
|
|
5
|
+
export interface RadioGroupPopupFieldProps {
|
|
6
|
+
items: RadioGroupItem[];
|
|
7
|
+
value?: string;
|
|
8
|
+
customValue?: string;
|
|
9
|
+
header: ReactNode;
|
|
10
|
+
onApply: (value?: string) => void;
|
|
11
|
+
id?: string;
|
|
12
|
+
labelProps?: LabelProps;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
selectedValue?: string;
|
|
15
|
+
onSelectionChange?: (value: string) => void;
|
|
16
|
+
onCancel?: () => void;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
isValid?: boolean;
|
|
19
|
+
applyButtonLabel?: string;
|
|
20
|
+
cancelButtonLabel?: string;
|
|
21
|
+
size?: PopupSize;
|
|
22
|
+
portalId?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
invalid?: boolean;
|
|
25
|
+
error?: string;
|
|
26
|
+
caption?: string;
|
|
27
|
+
ariaLabel?: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
fieldClassName?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A field whose value is picked from a {@link RadioGroup} inside a {@link Popup}.
|
|
33
|
+
* aliases: PopupRadio|ChoicePopup|RadioPopupField
|
|
34
|
+
* Design system 2.0
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <RadioGroupPopupField
|
|
39
|
+
* labelProps={{ label: 'Status' }}
|
|
40
|
+
* header="Select status"
|
|
41
|
+
* placeholder="None"
|
|
42
|
+
* items={[
|
|
43
|
+
* { value: 'draft', label: 'Draft' },
|
|
44
|
+
* { value: 'published', label: 'Published' },
|
|
45
|
+
* ]}
|
|
46
|
+
* value={status}
|
|
47
|
+
* onApply={(next) => setStatus(next)}
|
|
48
|
+
* />
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* The collapsed field is a `<button>` rather than a read-only `<input>`: it
|
|
52
|
+
* opens a dialog and holds no text of its own, so the button role and its
|
|
53
|
+
* `Enter` / `Space` activation come from the element itself instead of being
|
|
54
|
+
* re-implemented on an input that would also invite typing.
|
|
55
|
+
*
|
|
56
|
+
* The selection inside the popup is a draft. Uncontrolled, it is seeded from
|
|
57
|
+
* `value` each time the popup opens, so an edit the user cancelled never leaks
|
|
58
|
+
* into the next one, and `onApply` is the only callback reporting a committed
|
|
59
|
+
* value. Pass `selectedValue` with `onSelectionChange` to drive the draft
|
|
60
|
+
* yourself — needed when `isValid` depends on what is currently selected.
|
|
61
|
+
*
|
|
62
|
+
* The field's accessible name is its label followed by the current value, so it
|
|
63
|
+
* announces like a collapsed picker ("Status, Draft"). With no `labelProps`,
|
|
64
|
+
* pass `ariaLabel`: it is exposed through a visually hidden element rather than
|
|
65
|
+
* as `aria-label`, which would replace the value in the name instead of
|
|
66
|
+
* preceding it.
|
|
67
|
+
*
|
|
68
|
+
* @param items - Options offered inside the popup
|
|
69
|
+
* @param [value] - The committed value, shown in the collapsed field
|
|
70
|
+
* @param [customValue] - Text shown in the field in place of the selected option's label
|
|
71
|
+
* @param header - Title of the popup
|
|
72
|
+
* @param onApply - Callback fired with the selected value when Apply is clicked
|
|
73
|
+
* @param [id] - Base id for the field; the label and the options derive theirs from it
|
|
74
|
+
* @param [labelProps] - Props of the {@link Label} rendered above the field
|
|
75
|
+
* @param [placeholder] - Text shown in the field while no value is selected
|
|
76
|
+
* @param [selectedValue] - Controlled draft selection inside the popup
|
|
77
|
+
* @param [onSelectionChange] - Callback fired when the draft selection changes
|
|
78
|
+
* @param [onCancel] - Callback fired when Cancel is clicked, before the popup closes
|
|
79
|
+
* @param [onClose] - Callback fired whenever the popup closes
|
|
80
|
+
* @param [isValid=true] - Whether Apply is enabled
|
|
81
|
+
* @param [applyButtonLabel="Apply"] - Label of the Apply button
|
|
82
|
+
* @param [cancelButtonLabel="Cancel"] - Label of the Cancel button
|
|
83
|
+
* @param [size=PopupSize.Md] - Size of the popup
|
|
84
|
+
* @param [portalId] - Portal container id for the popup
|
|
85
|
+
* @param [disabled] - Disables the field, so the popup cannot be opened
|
|
86
|
+
* @param [invalid] - Paints the field with the error border
|
|
87
|
+
* @param [error] - Error message rendered below the field
|
|
88
|
+
* @param [caption] - Helper text rendered below the field when there is no `error`
|
|
89
|
+
* @param [ariaLabel] - Names the field when there is no string `labelProps.label`
|
|
90
|
+
* @param [className] - Additional classes for the outer container
|
|
91
|
+
* @param [fieldClassName] - Additional classes for the collapsed field
|
|
92
|
+
*/
|
|
93
|
+
export declare const RadioGroupPopupField: FC<RadioGroupPopupFieldProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The collapsed field. `dial-kit-input` gives it the 2.0 field box — 40px tall,
|
|
3
|
+
* raised surface, accent border on hover, accent outline on focus, and the
|
|
4
|
+
* sunken disabled treatment through its own `:disabled` rule, which a `<button>`
|
|
5
|
+
* matches. The utilities after it only lay the row out; the SCSS class is
|
|
6
|
+
* unlayered, so anything it already sets (`truncate`, `w-full`, the height)
|
|
7
|
+
* cannot be overridden from here.
|
|
8
|
+
*
|
|
9
|
+
* No `dial-kit-enhanced-target`: `truncate` puts `overflow: hidden` on the
|
|
10
|
+
* field, which would clip the 44px pseudo-element back to the field's own 40px,
|
|
11
|
+
* and being unlayered it cannot be undone with a utility. The field takes the
|
|
12
|
+
* same documented 2.5.5 exception as `Input` and `Select` — full-width target,
|
|
13
|
+
* 4px short of 44 vertically.
|
|
14
|
+
*/
|
|
15
|
+
export declare const fieldBaseClassName = "dial-kit-input flex flex-row items-center justify-between gap-x-2 px-3 text-left";
|
|
16
|
+
export declare const fieldValueClassName = "min-w-0 flex-1 truncate text-primary";
|
|
17
|
+
export declare const fieldPlaceholderClassName = "min-w-0 flex-1 truncate text-secondary";
|
|
18
|
+
export declare const fieldIconClassName = "shrink-0 text-secondary";
|
|
19
|
+
export declare const popupBodyClassName = "px-6 pb-4";
|
|
20
|
+
export declare const popupFooterClassName = "flex justify-end gap-2 px-6 py-4 border-t border-tertiary";
|
|
21
|
+
export declare const defaultCancelLabel = "Cancel";
|
|
22
|
+
export declare const defaultApplyLabel = "Apply";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ResizableContainerProps } from './ResizableContainer';
|
|
3
|
+
export interface ConditionalResizableContainerProps extends ResizableContainerProps {
|
|
4
|
+
/** Whether resizing is enabled. Defaults to `true`. */
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Renders its children inside a {@link ResizableContainer} only while `enabled`.
|
|
9
|
+
* aliases: OptionalResize|ConditionalPanel
|
|
10
|
+
* Design system 2.0
|
|
11
|
+
*
|
|
12
|
+
* When `enabled` is false the children are rendered on their own, with no
|
|
13
|
+
* wrapper element and no resize behaviour — useful for a panel that is only
|
|
14
|
+
* resizable while it is expanded. Every other prop is passed straight through;
|
|
15
|
+
* see {@link ResizableContainer} for controlled and uncontrolled sizing, sides
|
|
16
|
+
* and callbacks.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <ConditionalResizableContainer
|
|
21
|
+
* enabled={isExpanded}
|
|
22
|
+
* minWidth={180}
|
|
23
|
+
* maxWidth={520}
|
|
24
|
+
* defaultWidth={260}
|
|
25
|
+
* >
|
|
26
|
+
* <Sidebar />
|
|
27
|
+
* </ConditionalResizableContainer>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param [enabled=true] - Whether resizing is enabled.
|
|
31
|
+
* @param children - Content to render inside the container.
|
|
32
|
+
* @see ResizableContainer
|
|
33
|
+
*/
|
|
34
|
+
export declare const ConditionalResizableContainer: FC<ConditionalResizableContainerProps>;
|