@epam/ai-dial-ui-kit 0.14.0-dev.2 → 0.14.0-dev.22
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-DPtZkKQi.cjs → JsonEditor-CLmDZqJH.cjs} +1 -1
- package/dist/{JsonEditor-CM-CG-FK.js → JsonEditor-DdYGciSl.js} +1 -1
- package/dist/{MarkdownEditor-cdq8UZxL.js → MarkdownEditor-B9Bs3UUs.js} +1 -1
- package/dist/MarkdownEditor-DXdBLiV3.cjs +1 -0
- package/dist/{MarkdownEditor-D4WuEafx.cjs → MarkdownEditor-DlAqXKw_.cjs} +1 -1
- package/dist/MarkdownEditor-YU-phCxT.js +69 -0
- package/dist/components-manifest.json +1795 -202
- package/dist/dial-ui-kit.cjs.js +1 -1
- package/dist/dial-ui-kit.es.js +231 -195
- package/dist/{index-CBk9P1Pa.js → index-CpVGPv8D.js} +15116 -13323
- package/dist/{index-A_KNCHda.cjs → index-DBHH26fT.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 +139 -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/Grid/comparators/base-column-comparator.d.ts +1 -4
- package/dist/src/components/Grid/renderers/utils.d.ts +1 -2
- 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 +26 -0
- package/dist/src/components/New/Grid/Grid.d.ts +124 -0
- package/dist/src/components/New/Grid/components/SelectionCell.d.ts +21 -0
- package/dist/src/components/New/Grid/components/SelectionHeader.d.ts +14 -0
- package/dist/src/components/New/Grid/constants.d.ts +61 -0
- package/dist/src/components/New/Grid/renderers/DateCellRenderer.d.ts +48 -0
- package/dist/src/components/New/Grid/renderers/constants.d.ts +5 -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/NoDataContent/NoDataContent.d.ts +48 -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 +77 -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/ThemeScope/ThemeScope.d.ts +46 -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/icon.d.ts +22 -0
- package/dist/src/components/New/constants/overlay.d.ts +12 -3
- package/dist/src/index.d.ts +47 -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/dist/src/utils/__tests__/element-size-observer.spec.d.ts +1 -0
- package/dist/src/utils/element-size-observer.d.ts +26 -0
- package/dist/src/utils/grid-comparators.d.ts +4 -0
- package/dist/src/utils/grid-date.d.ts +7 -0
- package/package.json +1 -1
- package/dist/MarkdownEditor-DRQoDnC-.js +0 -75
- package/dist/MarkdownEditor-DyIvPpmt.cjs +0 -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,26 @@
|
|
|
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
|
+
* All of that goes through the shared observer in
|
|
12
|
+
* `@/utils/element-size-observer`, so a screen full of truncating labels costs
|
|
13
|
+
* one `ResizeObserver`, one resize listener and one animation frame in total
|
|
14
|
+
* rather than a set per label.
|
|
15
|
+
*
|
|
16
|
+
* @param text - The rendered content; a change to it re-measures
|
|
17
|
+
* @returns `ref` to attach to the truncating element, whether it `isTruncated`,
|
|
18
|
+
* its `textContent` (the full string even when `text` is a node), and
|
|
19
|
+
* `remeasure` to force a fresh read before an interaction reads the result
|
|
20
|
+
*/
|
|
21
|
+
export declare const useTruncation: <T extends HTMLElement>(text: ReactNode) => {
|
|
22
|
+
ref: import('react').RefObject<T | null>;
|
|
23
|
+
isTruncated: boolean;
|
|
24
|
+
textContent: string;
|
|
25
|
+
remeasure: () => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { ColDef, GridApi, GridOptions } from 'ag-grid-community';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { DropdownItem } from '../../../models/dropdown';
|
|
4
|
+
import { GridSelectionMode } from '../../../models/selection-mode';
|
|
5
|
+
/** Column id of the selection column this component prepends itself. */
|
|
6
|
+
export declare const GRID_SELECTION_COLUMN_ID = "dial-kit-grid-selection";
|
|
7
|
+
export interface GridProps<T extends object = Record<string, unknown>> {
|
|
8
|
+
/** Column definitions, in ag-Grid `ColDef` format. */
|
|
9
|
+
columnDefs?: ColDef<T>[];
|
|
10
|
+
/** Rows to display. */
|
|
11
|
+
rowData?: T[];
|
|
12
|
+
/** Extra ag-Grid options, merged over the defaults. */
|
|
13
|
+
additionalGridOptions?: GridOptions<T>;
|
|
14
|
+
/** Items of the row context menu. Omit it to render no context menu at all. */
|
|
15
|
+
getContextMenuItems?: (row: T) => DropdownItem[];
|
|
16
|
+
/** Additional CSS classes for the grid container. */
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Accessible name of the grid region. Defaults to `'Data grid'`. */
|
|
19
|
+
ariaLabel?: string;
|
|
20
|
+
/** Whether custom cell renderers are wrapped with context-menu support. */
|
|
21
|
+
wrapCustomCellRenderers?: boolean | ((col: ColDef<T>) => boolean);
|
|
22
|
+
/** Rows that cannot be selected. Ids must match what `getRowId` returns. */
|
|
23
|
+
disabledRowIds?: Set<string>;
|
|
24
|
+
/** Controlled selection: ids of the selected rows. */
|
|
25
|
+
selectedRowIds?: Set<string>;
|
|
26
|
+
/** Fired when the grid API becomes available. */
|
|
27
|
+
onGridApiChange?: (api: GridApi<T>) => void;
|
|
28
|
+
/** Fired when the selection changes, with the selected ids and rows. */
|
|
29
|
+
onSelectionChange?: (selectedRowIds: Set<string>, selectedRows: T[]) => void;
|
|
30
|
+
/** Extracts the unique id of a row. Defaults to its `id` field. */
|
|
31
|
+
getRowId?: (row: T) => string;
|
|
32
|
+
/** Tints odd rows. Defaults to `false`. */
|
|
33
|
+
alternateOddRowColors?: boolean;
|
|
34
|
+
/** Placeholder of the column filter inputs. */
|
|
35
|
+
filterPlaceholder?: string;
|
|
36
|
+
/** Illustration of the empty state. */
|
|
37
|
+
emptyStateIcon?: ReactNode;
|
|
38
|
+
/** Headline of the empty state. */
|
|
39
|
+
emptyStateTitle?: string;
|
|
40
|
+
/** Secondary line of the empty state. */
|
|
41
|
+
emptyStateDescription?: string;
|
|
42
|
+
/** Shows the loading overlay. Defaults to `false`. */
|
|
43
|
+
loading?: boolean;
|
|
44
|
+
/** Draws a border around the grid. Defaults to `true`. */
|
|
45
|
+
wrapperBorder?: boolean;
|
|
46
|
+
/** Hides the vertical borders between header cells. Defaults to `false`. */
|
|
47
|
+
withoutHeaderBorders?: boolean;
|
|
48
|
+
/** Renders a selection column of checkboxes or radios. */
|
|
49
|
+
selectionMode?: GridSelectionMode;
|
|
50
|
+
/** Keeps the context menu on a row that cannot be selected. */
|
|
51
|
+
allowDisabledContextMenu?: boolean;
|
|
52
|
+
/** Accessible name of a row's selection control. Defaults to `'Select row'`. */
|
|
53
|
+
selectRowLabel?: (row: T) => string;
|
|
54
|
+
/** Accessible name of the select-all control. Defaults to `'Select all rows'`. */
|
|
55
|
+
selectAllLabel?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A data grid built on ag-Grid, wired to the 2.0 tokens and controls.
|
|
59
|
+
* aliases: DataTable|TableGrid|DataGrid
|
|
60
|
+
* Design system 2.0
|
|
61
|
+
*
|
|
62
|
+
* Comes preconfigured with case-insensitive sorting, floating column filters,
|
|
63
|
+
* columns sized to the available width, a row context menu, truncation
|
|
64
|
+
* tooltips, and an empty state.
|
|
65
|
+
*
|
|
66
|
+
* The selection column renders the 2.0 `Checkbox` and `Radio` instead of
|
|
67
|
+
* ag-Grid's own inputs, so selection looks and behaves like every other control
|
|
68
|
+
* in the kit and the select-all reaches the `mixed` state when the selection is
|
|
69
|
+
* partial. The column stays faded out until the row is hovered, something is
|
|
70
|
+
* selected, or the keyboard reaches it.
|
|
71
|
+
*
|
|
72
|
+
* Selection works controlled or uncontrolled: pass `selectedRowIds` to own it,
|
|
73
|
+
* or read `onSelectionChange` and let the grid keep its own. A `sort` declared
|
|
74
|
+
* on a column is honoured — 1.0 stripped it on startup.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* interface Product { id: string; name: string; price: number }
|
|
79
|
+
*
|
|
80
|
+
* const columns: ColDef<Product>[] = [
|
|
81
|
+
* { field: 'name', headerName: 'Product', flex: 1 },
|
|
82
|
+
* { field: 'price', headerName: 'Price', width: 120 },
|
|
83
|
+
* ];
|
|
84
|
+
*
|
|
85
|
+
* <Grid<Product> columnDefs={columns} rowData={products} />
|
|
86
|
+
*
|
|
87
|
+
* // With selection and a context menu
|
|
88
|
+
* <Grid<Product>
|
|
89
|
+
* columnDefs={columns}
|
|
90
|
+
* rowData={products}
|
|
91
|
+
* selectionMode={GridSelectionMode.MULTIPLE}
|
|
92
|
+
* selectedRowIds={selectedIds}
|
|
93
|
+
* onSelectionChange={(ids) => setSelectedIds(ids)}
|
|
94
|
+
* selectRowLabel={(row) => `Select ${row.name}`}
|
|
95
|
+
* getContextMenuItems={(row) => [{ key: 'edit', label: 'Edit' }]}
|
|
96
|
+
* />
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @param [columnDefs] - Column definitions, in ag-Grid `ColDef` format.
|
|
100
|
+
* @param [rowData] - Rows to display.
|
|
101
|
+
* @param [additionalGridOptions] - Extra ag-Grid options, merged over the defaults.
|
|
102
|
+
* @param [getContextMenuItems] - Items of the row context menu. Omit for no menu.
|
|
103
|
+
* @param [className] - Additional CSS classes for the grid container.
|
|
104
|
+
* @param [ariaLabel='Data grid'] - Accessible name of the grid region.
|
|
105
|
+
* @param [wrapCustomCellRenderers=true] - Whether custom renderers get context-menu support.
|
|
106
|
+
* @param [disabledRowIds] - Rows that cannot be selected.
|
|
107
|
+
* @param [selectedRowIds] - Controlled selection: ids of the selected rows.
|
|
108
|
+
* @param [onGridApiChange] - Fired when the grid API becomes available.
|
|
109
|
+
* @param [onSelectionChange] - Fired when the selection changes.
|
|
110
|
+
* @param [getRowId] - Extracts the unique id of a row. Defaults to its `id` field.
|
|
111
|
+
* @param [alternateOddRowColors=false] - Tints odd rows.
|
|
112
|
+
* @param [filterPlaceholder='Enter value'] - Placeholder of the column filter inputs.
|
|
113
|
+
* @param [emptyStateIcon] - Illustration of the empty state.
|
|
114
|
+
* @param [emptyStateTitle='No results found'] - Headline of the empty state.
|
|
115
|
+
* @param [emptyStateDescription] - Secondary line of the empty state.
|
|
116
|
+
* @param [loading=false] - Shows the loading overlay.
|
|
117
|
+
* @param [wrapperBorder=true] - Draws a border around the grid.
|
|
118
|
+
* @param [withoutHeaderBorders=false] - Hides the vertical borders between header cells.
|
|
119
|
+
* @param [selectionMode] - Renders a selection column of checkboxes or radios.
|
|
120
|
+
* @param [allowDisabledContextMenu=false] - Keeps the context menu on a non-selectable row.
|
|
121
|
+
* @param [selectRowLabel] - Accessible name of a row's selection control.
|
|
122
|
+
* @param [selectAllLabel='Select all rows'] - Accessible name of the select-all control.
|
|
123
|
+
*/
|
|
124
|
+
export declare const Grid: <T extends object>({ columnDefs, rowData, additionalGridOptions, getContextMenuItems, className, ariaLabel, wrapCustomCellRenderers, disabledRowIds, selectedRowIds, onSelectionChange, onGridApiChange, getRowId, alternateOddRowColors, filterPlaceholder, emptyStateIcon, emptyStateTitle, emptyStateDescription, loading, wrapperBorder, withoutHeaderBorders, allowDisabledContextMenu, selectionMode, selectRowLabel, selectAllLabel, }: GridProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ICellRendererParams } from 'ag-grid-community';
|
|
2
|
+
import { GridSelectionMode } from '../../../../models/selection-mode';
|
|
3
|
+
export interface SelectionCellProps<T> {
|
|
4
|
+
params: ICellRendererParams<T>;
|
|
5
|
+
mode: GridSelectionMode;
|
|
6
|
+
/** Accessible name of the control; a row-specific name is far more useful. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Shared radio group name, so single mode behaves as one group. */
|
|
9
|
+
radioName: string;
|
|
10
|
+
rowId: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The 2.0 {@link Checkbox} or {@link Radio} rendered in the selection column,
|
|
15
|
+
* in place of ag-Grid's own checkbox.
|
|
16
|
+
*
|
|
17
|
+
* The row node is the source of truth: the control subscribes to its
|
|
18
|
+
* `rowSelected` event, so a selection made anywhere — another cell, the header,
|
|
19
|
+
* or the `selectedRowIds` prop — is reflected here without refreshing the cell.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SelectionCell: <T>({ params, mode, label, radioName, rowId, disabled, }: SelectionCellProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IHeaderParams } from 'ag-grid-community';
|
|
2
|
+
export interface SelectionHeaderProps<T> extends IHeaderParams<T> {
|
|
3
|
+
/** Accessible name of the select-all control. */
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Select-all {@link Checkbox} for the selection column, in place of ag-Grid's
|
|
8
|
+
* own header checkbox.
|
|
9
|
+
*
|
|
10
|
+
* It derives its state from the grid rather than from a prop: partly selected
|
|
11
|
+
* rows put it in the `mixed` state, and disabled rows are excluded from the
|
|
12
|
+
* count so a grid whose selectable rows are all selected still reads as full.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SelectionHeader: <T>({ api, label, }: SelectionHeaderProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Root class of the 2.0 grid; every rule in `styles/grid.scss` sits under it. */
|
|
2
|
+
export declare const GRID_ROOT_CLASS = "dial-kit-grid";
|
|
3
|
+
/** Present only while a selection column is rendered. Drives its reveal. */
|
|
4
|
+
export declare const GRID_WITH_SELECTION_CLASS = "dial-kit-grid-with-selection";
|
|
5
|
+
export declare const GRID_WITHOUT_HEADER_BORDERS_CLASS = "dial-kit-grid-without-header-borders";
|
|
6
|
+
/** Cell of the selection column: faded out until the row is hovered. */
|
|
7
|
+
export declare const GRID_ROW_SELECT_CLASS = "dial-kit-grid-row-select";
|
|
8
|
+
/** Header of the selection column: faded out until the header is hovered. */
|
|
9
|
+
export declare const GRID_HEADER_SELECT_CLASS = "dial-kit-grid-header-select";
|
|
10
|
+
/**
|
|
11
|
+
* Pins the whole selection column visible — on touch, or once something is
|
|
12
|
+
* selected. It sits on the container rather than on the column definition:
|
|
13
|
+
* ag-Grid rebuilds every cell when a column definition changes, which would
|
|
14
|
+
* pull the DOM out from under the click that caused the selection.
|
|
15
|
+
*/
|
|
16
|
+
export declare const GRID_SELECTION_VISIBLE_CLASS = "dial-kit-grid-selection-visible";
|
|
17
|
+
/** Right-aligns a column. Applied by the consumer through `cellClass`. */
|
|
18
|
+
export declare const GRID_ALIGN_RIGHT_CLASS = "dial-kit-grid-align-right";
|
|
19
|
+
/** Height of both a body row and the header row. */
|
|
20
|
+
export declare const ROW_HEIGHT = 40;
|
|
21
|
+
/**
|
|
22
|
+
* ag-Grid theme parameters, resolved from the 2.0 colour tokens with the same
|
|
23
|
+
* literal fallbacks the Tailwind config carries, so a consumer that defines no
|
|
24
|
+
* CSS variables still gets the intended palette.
|
|
25
|
+
*
|
|
26
|
+
* Hover sits one step up the accent-alpha ramp from the selected tint, so a
|
|
27
|
+
* hovered selected row still reads as hovered — the same relationship the 2.0
|
|
28
|
+
* dropdown and select rows use.
|
|
29
|
+
*/
|
|
30
|
+
export declare const GRID_THEME_PARAMS: {
|
|
31
|
+
accentColor: string;
|
|
32
|
+
backgroundColor: string;
|
|
33
|
+
oddRowBackgroundColor: string;
|
|
34
|
+
selectedRowBackgroundColor: string;
|
|
35
|
+
rowHoverColor: string;
|
|
36
|
+
borderColor: string;
|
|
37
|
+
rowBorder: string;
|
|
38
|
+
headerRowBorder: string;
|
|
39
|
+
headerColumnBorder: string;
|
|
40
|
+
chromeBackgroundColor: string;
|
|
41
|
+
foregroundColor: string;
|
|
42
|
+
headerTextColor: string;
|
|
43
|
+
browserColorScheme: string;
|
|
44
|
+
headerFontSize: number;
|
|
45
|
+
headerFontWeight: number;
|
|
46
|
+
fontSize: number;
|
|
47
|
+
fontFamily: string;
|
|
48
|
+
spacing: number;
|
|
49
|
+
borderRadius: number;
|
|
50
|
+
wrapperBorderRadius: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Sources reported with a selection change. `checkboxSelected` marks the ones
|
|
54
|
+
* the user made in the selection column, the other two mark selections the
|
|
55
|
+
* component applied itself while syncing to `selectedRowIds` or new row data.
|
|
56
|
+
*/
|
|
57
|
+
export declare enum SelectionEventSourceType {
|
|
58
|
+
API = "api",
|
|
59
|
+
ROW_DATA_CHANGED = "rowDataChanged",
|
|
60
|
+
CHECKBOX_SELECTED = "checkboxSelected"
|
|
61
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ICellRendererParams } from 'ag-grid-community';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { DateValue } from '../../../../utils/grid-date';
|
|
4
|
+
export type { DateValue };
|
|
5
|
+
export interface DateCellRendererProps extends Partial<ICellRendererParams<Record<string, unknown>, DateValue>> {
|
|
6
|
+
/** The date to render. A pure integer string is read as epoch milliseconds. */
|
|
7
|
+
value?: DateValue | null;
|
|
8
|
+
/** Locale used for formatting. Defaults to `'en-US'`. */
|
|
9
|
+
locale?: string;
|
|
10
|
+
/** `Intl.DateTimeFormat` options. */
|
|
11
|
+
options?: Intl.DateTimeFormatOptions;
|
|
12
|
+
/** Rendered when the value carries no usable date. */
|
|
13
|
+
emptyPlaceholder?: string;
|
|
14
|
+
/** Additional CSS classes for the cell. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Suppresses the truncation tooltip. */
|
|
17
|
+
hideTooltip?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Date cell for the 2.0 {@link Grid}, usable as an ag-Grid `cellRenderer`.
|
|
21
|
+
* aliases: DateCell|TimestampCell
|
|
22
|
+
* Design system 2.0
|
|
23
|
+
*
|
|
24
|
+
* Formats the value with `Intl.DateTimeFormat` and wraps it in a
|
|
25
|
+
* {@link EllipsisTooltip}, so the full string is only offered when the column is
|
|
26
|
+
* too narrow to show it. A valid date is rendered inside a `<time datetime>`,
|
|
27
|
+
* which gives assistive tech and crawlers the machine-readable value next to
|
|
28
|
+
* the localised one.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // As a column renderer
|
|
33
|
+
* { field: 'createdAt', cellRenderer: DateCellRenderer,
|
|
34
|
+
* cellRendererParams: { options: { timeZone: 'UTC' } } }
|
|
35
|
+
*
|
|
36
|
+
* // Directly
|
|
37
|
+
* <DateCellRenderer value="2025-07-20T00:00:00Z" options={{ timeZone: 'UTC' }} />
|
|
38
|
+
* <DateCellRenderer value={1752969600000} /> // epoch milliseconds
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param [value] - The date to render.
|
|
42
|
+
* @param [locale='en-US'] - Locale used for formatting.
|
|
43
|
+
* @param [options] - `Intl.DateTimeFormat` options, e.g. `timeZone`.
|
|
44
|
+
* @param [emptyPlaceholder] - Rendered when the value carries no usable date.
|
|
45
|
+
* @param [className] - Additional CSS classes for the cell.
|
|
46
|
+
* @param [hideTooltip=false] - Suppresses the truncation tooltip.
|
|
47
|
+
*/
|
|
48
|
+
export declare const DateCellRenderer: FC<DateCellRendererProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ColDef } from 'ag-grid-community';
|
|
2
|
+
export declare const DEFAULT_LOCALE = "en-US";
|
|
3
|
+
export declare const DEFAULT_DATE_FORMAT_OPTIONS: Intl.DateTimeFormatOptions;
|
|
4
|
+
/** Fixed, unsortable and unfilterable: the column holds a control, not data. */
|
|
5
|
+
export declare const SELECTION_COL_DEF: ColDef;
|
|
@@ -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 {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export interface NoDataContentProps {
|
|
3
|
+
/** Headline of the empty state. */
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
/** Optional secondary line under the title. */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** Illustration above the title. Defaults to a struck-through clipboard. */
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Announces the empty state to assistive tech as it appears. Turn it on where
|
|
11
|
+
* the content replaces a list the user has just filtered or searched.
|
|
12
|
+
*/
|
|
13
|
+
live?: boolean;
|
|
14
|
+
/** Additional CSS classes for the container. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Additional CSS classes for the title. */
|
|
17
|
+
titleClassName?: string;
|
|
18
|
+
/** Additional CSS classes for the description. */
|
|
19
|
+
descriptionClassName?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Message shown in place of a list, table or grid that has nothing to show.
|
|
23
|
+
* aliases: EmptyState|NoResults|ZeroState
|
|
24
|
+
* Design system 2.0
|
|
25
|
+
*
|
|
26
|
+
* Fills its container and centres an illustration, a headline and an optional
|
|
27
|
+
* secondary line. The icon is decorative, so it is hidden from assistive tech
|
|
28
|
+
* and the text carries the message on its own.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <NoDataContent
|
|
33
|
+
* title="No results found"
|
|
34
|
+
* description="Try a different search term."
|
|
35
|
+
* />
|
|
36
|
+
*
|
|
37
|
+
* <NoDataContent title="Nothing here yet" icon={<IconInbox size={60} />} live />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param title - Headline of the empty state.
|
|
41
|
+
* @param [description] - Optional secondary line under the title.
|
|
42
|
+
* @param [icon] - Illustration above the title. Defaults to a struck-through clipboard.
|
|
43
|
+
* @param [live=false] - Announce the empty state to assistive tech as it appears.
|
|
44
|
+
* @param [className] - Additional CSS classes for the container.
|
|
45
|
+
* @param [titleClassName] - Additional CSS classes for the title.
|
|
46
|
+
* @param [descriptionClassName] - Additional CSS classes for the description.
|
|
47
|
+
*/
|
|
48
|
+
export declare const NoDataContent: FC<NoDataContentProps>;
|
|
@@ -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 {};
|