@epam/ai-dial-ui-kit 0.15.0-dev.4 → 0.15.0-dev.41
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 +190 -0
- package/dist/CHANGELOG.md +73 -0
- package/dist/DateCellRenderer-DFknFcs1.cjs +1 -0
- package/dist/{DateCellRenderer-BVM-Q8yx.cjs → DateCellRenderer-J9A5gyDz.cjs} +31 -31
- package/dist/IconButton-DHOFapLo.cjs +1 -0
- package/dist/{JsonEditor-qv1Z0dLX.cjs → JsonEditor-BDe6elKO.cjs} +1 -1
- package/dist/{MarkdownEditor-DHn2pYOJ.cjs → MarkdownEditor-C7BONfsl.cjs} +1 -1
- package/dist/{MarkdownEditor-jQ8nDJfx.cjs → MarkdownEditor-FVzYMdkC.cjs} +1 -1
- package/dist/{MarkdownEditorContainer-Bzcnoemw.cjs → MarkdownEditorContainer-GvlxX6kx.cjs} +1 -1
- package/dist/{Switch-CUKClcEz.cjs → Switch-DE6MrcqJ.cjs} +1 -1
- package/dist/components/Button/constants.js +9 -8
- package/dist/components/Dropdown/Dropdown.js +70 -65
- package/dist/components/Dropdown/DropdownSubMenuItem.js +63 -55
- package/dist/components/Dropdown/constants.js +16 -14
- package/dist/components/DropdownIcon/DropdownIcon.js +43 -32
- package/dist/components/FileManager/FileManager.js +373 -372
- package/dist/components/FileManager/FileManagerProvider.js +266 -264
- package/dist/components/FileManager/hooks/use-grid-context-menu.js +59 -59
- package/dist/components/New/Accordion/Accordion.js +87 -71
- package/dist/components/New/Avatar/Avatar.js +70 -0
- package/dist/components/New/Badge/Badge.js +45 -0
- package/dist/components/New/BottomSheet/BottomSheet.js +128 -0
- package/dist/components/New/Breadcrumbs/Breadcrumbs.js +159 -0
- package/dist/components/New/Breadcrumbs/constants.js +41 -0
- package/dist/components/New/Button/Button.js +32 -32
- package/dist/components/New/Button/ButtonWrappers.js +93 -37
- package/dist/components/New/Button/constants.js +3 -0
- package/dist/components/New/Button/utils.js +18 -8
- package/dist/components/New/ButtonDropdown/ButtonDropdown.js +26 -16
- package/dist/components/New/Calendar/Calendar.js +301 -265
- package/dist/components/New/Calendar/constants.js +5 -5
- package/dist/components/New/CaptionText/CaptionText.js +18 -15
- package/dist/components/New/CardShell/CardShell.js +5 -3
- package/dist/components/New/Checkbox/Checkbox.js +67 -56
- package/dist/components/New/Checkbox/CheckboxBox.js +5 -3
- package/dist/components/New/CloseButton/CloseButton.js +18 -16
- package/dist/components/New/CollapsibleSidebar/CollapsibleSidebar.js +39 -34
- package/dist/components/New/ConfirmationPopup/ConfirmationPopup.js +38 -37
- package/dist/components/New/ConfirmationPopup/constants.js +8 -11
- package/dist/components/New/Dropdown/Dropdown.js +112 -105
- package/dist/components/New/Dropdown/DropdownSubMenuItem.js +17 -17
- package/dist/components/New/Dropdown/constants.js +22 -17
- package/dist/components/New/EllipsisTooltip/EllipsisTooltip.js +20 -18
- package/dist/components/New/EntityIdentity/EntityIdentity.js +135 -0
- package/dist/components/New/FileDropzone/FileDropzone.js +27 -25
- package/dist/components/New/FileIcon/FileIcon.js +55 -0
- package/dist/components/New/FileIcon/constants.js +134 -0
- package/dist/components/New/FileIcon/icons/FileGlyph.js +150 -0
- package/dist/components/New/FileIcon/icons/FolderGlyph.js +50 -0
- package/dist/components/New/FileName/FileName.js +78 -0
- package/dist/components/New/FilterChips/FilterChips.js +43 -0
- package/dist/components/New/FilterChips/constants.js +5 -0
- package/dist/components/New/FolderName/FolderName.js +16 -0
- package/dist/components/New/FolderPath/FolderPath.js +29 -28
- package/dist/components/New/Highlight/Highlight.js +23 -30
- package/dist/components/New/IconButton/IconButton.js +30 -28
- package/dist/components/New/InfoButton/InfoButton.js +13 -11
- package/dist/components/New/InlineSelect/InlineSelect.js +74 -56
- package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +41 -39
- package/dist/components/New/InteractiveTooltip/constants.js +2 -2
- package/dist/components/New/Label/Label.js +13 -8
- package/dist/components/New/MenuItem/MenuItem.js +29 -27
- package/dist/components/New/MenuItem/constants.js +9 -8
- package/dist/components/New/NoDataContent/NoDataContent.js +21 -19
- package/dist/components/New/Notification/Notification.js +33 -29
- package/dist/components/New/NumberInput/NumberInput.js +42 -33
- package/dist/components/New/PasswordInput/PasswordInput.js +41 -35
- package/dist/components/New/Popup/Popup.js +46 -44
- package/dist/components/New/Popup/constants.js +3 -3
- package/dist/components/New/Radio/Radio.js +75 -64
- package/dist/components/New/RadioGroup/RadioGroup.js +76 -65
- package/dist/components/New/RadioGroupPopupField/RadioGroupPopupField.js +117 -106
- package/dist/components/New/ResizableContainer/ResizableContainer.js +42 -40
- package/dist/components/New/Search/Search.js +29 -27
- package/dist/components/New/SegmentedControl/SegmentedControl.js +29 -23
- package/dist/components/New/Select/CollapsedSelectTags.js +127 -0
- package/dist/components/New/Select/MultiSelectTags.js +18 -15
- package/dist/components/New/Select/Select.js +219 -197
- package/dist/components/New/Select/constants.js +23 -20
- package/dist/components/New/SharedEntityIndicator/SharedEntityIndicator.js +34 -0
- package/dist/components/New/SideDrawer/SideDrawer.js +148 -0
- package/dist/components/New/Switch/Switch.js +69 -58
- package/dist/components/New/Tabs/Tabs.js +125 -61
- package/dist/components/New/Tag/Tag.js +42 -40
- package/dist/components/New/TagInput/TagInput.js +48 -44
- package/dist/components/New/ToggleIconButton/ToggleIconButton.js +26 -24
- package/dist/components/New/Tooltip/TooltipContent.js +11 -9
- package/dist/components/New/Tooltip/constants.js +1 -1
- package/dist/components/New/TransferQueue/TransferQueue.js +124 -0
- package/dist/components/New/TransferQueue/TransferQueueHeader.js +71 -0
- package/dist/components/New/TransferQueue/TransferQueueRow.js +119 -0
- package/dist/components/New/TransferQueue/constants.js +24 -0
- package/dist/components/New/constants/overlay.js +17 -9
- package/dist/components/Popup/constants.js +8 -8
- package/dist/components/ProgressBar/ProgressBar.js +45 -33
- package/dist/components/SchemaRenderer/components/SchemaAdditionalPropertiesEditor.js +46 -31
- package/dist/components/SchemaRenderer/components/SchemaField.js +19 -19
- package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +18 -18
- package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +223 -135
- package/dist/components/SchemaRenderer/types.js +19 -8
- package/dist/components/SchemaRenderer/utils.js +122 -95
- package/dist/components/Skeleton/Skeleton.js +25 -19
- package/dist/components/Spinner/Spinner.js +7 -5
- package/dist/components/Tooltip/TooltipContent.js +11 -11
- package/dist/components-manifest.json +1478 -59
- package/dist/constants/public-class-names.js +208 -0
- package/dist/dial-ui-kit.cjs +2 -2
- package/dist/dial-ui-kit.js +337 -292
- package/dist/editors.cjs +1 -1
- package/dist/file-manager.cjs +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/index.css +2 -2
- package/dist/lazy-BEsZqouS.cjs +1 -0
- package/dist/merge-classes-BEJXjzkx.cjs +1 -0
- package/dist/migration-guides/0.15.0/legacy-theme-variable-fallbacks-removal.md +69 -0
- package/dist/migration-guides/README.md +1 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +419 -399
- package/dist/src/components/FileManager/FileManager.d.ts +2 -0
- package/dist/src/components/FileManager/FileManagerContext.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/use-grid-context-menu.d.ts +2 -1
- package/dist/src/components/New/Accordion/Accordion.d.ts +6 -1
- package/dist/src/components/New/Avatar/Avatar.d.ts +55 -0
- package/dist/src/components/New/Badge/Badge.d.ts +47 -0
- package/dist/src/components/New/BottomSheet/BottomSheet.d.ts +84 -0
- package/dist/src/components/New/Breadcrumbs/Breadcrumbs.d.ts +94 -0
- package/dist/src/components/New/Breadcrumbs/constants.d.ts +60 -0
- package/dist/src/components/New/Button/Button.d.ts +4 -1
- package/dist/src/components/New/Button/ButtonWrappers.d.ts +20 -0
- package/dist/src/components/New/Button/utils.d.ts +15 -0
- package/dist/src/components/New/ButtonDropdown/ButtonDropdown.d.ts +4 -0
- package/dist/src/components/New/Calendar/Calendar.d.ts +7 -1
- package/dist/src/components/New/Calendar/constants.d.ts +1 -1
- package/dist/src/components/New/ConfirmationPopup/constants.d.ts +0 -1
- package/dist/src/components/New/Dropdown/Dropdown.d.ts +9 -1
- package/dist/src/components/New/Dropdown/constants.d.ts +3 -0
- package/dist/src/components/New/EntityIdentity/EntityIdentity.d.ts +85 -0
- package/dist/src/components/New/FileIcon/FileIcon.d.ts +61 -0
- package/dist/src/components/New/FileIcon/constants.d.ts +16 -0
- package/dist/src/components/New/FileIcon/icons/FileGlyph.d.ts +18 -0
- package/dist/src/components/New/FileIcon/icons/FolderGlyph.d.ts +17 -0
- package/dist/src/components/New/FileName/FileName.d.ts +79 -0
- package/dist/src/components/New/FilterChips/FilterChips.d.ts +69 -0
- package/dist/src/components/New/FilterChips/constants.d.ts +13 -0
- package/dist/src/components/New/FolderName/FolderName.d.ts +37 -0
- package/dist/src/components/New/InlineSelect/InlineSelect.d.ts +16 -1
- package/dist/src/components/New/InteractiveTooltip/constants.d.ts +5 -4
- package/dist/src/components/New/Notification/Notification.d.ts +18 -0
- package/dist/src/components/New/Popup/constants.d.ts +1 -1
- package/dist/src/components/New/Select/CollapsedSelectTags.d.ts +22 -0
- package/dist/src/components/New/Select/MultiSelectTags.d.ts +5 -0
- package/dist/src/components/New/Select/Select.d.ts +9 -0
- package/dist/src/components/New/Select/constants.d.ts +3 -2
- package/dist/src/components/New/SharedEntityIndicator/SharedEntityIndicator.d.ts +35 -0
- package/dist/src/components/New/SideDrawer/SideDrawer.d.ts +100 -0
- package/dist/src/components/New/Tabs/Tabs.d.ts +54 -6
- package/dist/src/components/New/Tooltip/constants.d.ts +5 -3
- package/dist/src/components/New/TransferQueue/TransferQueue.d.ts +139 -0
- package/dist/src/components/New/TransferQueue/TransferQueueHeader.d.ts +16 -0
- package/dist/src/components/New/TransferQueue/TransferQueueRow.d.ts +10 -0
- package/dist/src/components/New/TransferQueue/constants.d.ts +6 -0
- package/dist/src/components/New/constants/overlay.d.ts +13 -0
- package/dist/src/components/Popup/constants.d.ts +1 -1
- package/dist/src/components/SchemaRenderer/types.d.ts +11 -0
- package/dist/src/components/SchemaRenderer/utils.d.ts +10 -1
- package/dist/src/constants/public-class-names.d.ts +199 -0
- package/dist/src/index.d.ts +34 -1
- package/dist/src/types/accordion.d.ts +7 -0
- package/dist/src/types/avatar.d.ts +7 -0
- package/dist/src/types/badge.d.ts +16 -0
- package/dist/src/types/breadcrumbs.d.ts +9 -0
- package/dist/src/types/button.d.ts +1 -0
- package/dist/src/types/entity-type.d.ts +9 -0
- package/dist/src/types/transfer-queue.d.ts +10 -0
- package/dist/src/utils/__tests__/avatar.spec.d.ts +1 -0
- package/dist/src/utils/avatar.d.ts +12 -0
- package/dist/src/utils/sub-menu-floating.d.ts +7 -4
- package/dist/types/accordion.js +4 -0
- package/dist/types/avatar.js +4 -0
- package/dist/types/badge.js +5 -0
- package/dist/types/breadcrumbs.js +4 -0
- package/dist/types/button.js +3 -3
- package/dist/types/entity-type.js +4 -0
- package/dist/types/transfer-queue.js +4 -0
- package/dist/use-file-manager-tabs-Bj_ENNKt.cjs +3 -0
- package/dist/utils/avatar.js +22 -0
- package/dist/utils/merge-classes.js +12 -5
- package/dist/utils/sub-menu-floating.js +99 -54
- package/package.json +4 -7
- package/dist/DateCellRenderer-ssp7eaZY.cjs +0 -1
- package/dist/IconButton-DWqoaBWf.cjs +0 -1
- package/dist/lazy-tfN4sKhq.cjs +0 -1
- package/dist/merge-classes-Dipy1Ih1.cjs +0 -1
- package/dist/use-file-manager-tabs-DjdR_mYM.cjs +0 -3
|
@@ -157,6 +157,7 @@ export interface DialFileManagerProps {
|
|
|
157
157
|
renameValidationMessages?: RenameValidationMessages;
|
|
158
158
|
forbiddenSymbolsRegExp?: RegExp;
|
|
159
159
|
forbiddenSymbolsTooltip?: ReactNode;
|
|
160
|
+
skipForbiddenSymbolsCheckForActions?: boolean;
|
|
160
161
|
onCreateFolder?: (file: DialUploadFileItem, folderPath: string, fileId: string) => void | Promise<void>;
|
|
161
162
|
onCreateFolderValidate?: (name: string, parentFolder: DialFile) => string | null;
|
|
162
163
|
folderCreationValidationMessages?: CreateFolderValidationMessages;
|
|
@@ -286,6 +287,7 @@ export interface DialFileManagerProps {
|
|
|
286
287
|
* @param [renameValidationMessages] - Optional custom validation messages for renaming files and folders. Note that you need to add `${NotificationVariant.Warning}__` prefix to the `hiddenItemWarning` message to display it as a warning with the warning icon.
|
|
287
288
|
* @param [forbiddenSymbolsRegExp] - Optional RegExp will be used in the validation for the files and folders names. The "g" and "y" flags are not allowed in this RegExp and will be ignored.
|
|
288
289
|
* @param [forbiddenSymbolsTooltip] - Optional tooltip displayed when a file or folder name contains forbidden characters
|
|
290
|
+
* @param [skipForbiddenSymbolsCheckForActions] - When provided, skips the forbidden-symbols check when building row action menus, so all actions are shown even for items whose names contain forbidden characters.
|
|
289
291
|
*
|
|
290
292
|
* @param [onDownloadFiles] - Callback fired when files are downloaded
|
|
291
293
|
*
|
|
@@ -85,6 +85,7 @@ export interface FileManagerContextValue {
|
|
|
85
85
|
getDisplayName: (item: DialFile) => string;
|
|
86
86
|
forbiddenSymbolsRegExp?: RegExp;
|
|
87
87
|
forbiddenSymbolsTooltip?: ReactNode;
|
|
88
|
+
skipForbiddenSymbolsCheckForActions?: boolean;
|
|
88
89
|
openDeleteConfirmation: (items: DialFile[], parentFolderPath: string) => void;
|
|
89
90
|
closeDeleteConfirmation: () => void;
|
|
90
91
|
confirmDelete: () => void;
|
|
@@ -37,7 +37,8 @@ export interface UseGridContextMenuProps {
|
|
|
37
37
|
isRenameFileAvailable?: boolean;
|
|
38
38
|
isDuplicateFolderAvailable?: boolean;
|
|
39
39
|
forbiddenSymbolsRegExp?: RegExp;
|
|
40
|
+
skipForbiddenSymbolsCheckForActions?: boolean;
|
|
40
41
|
onGridCreateSiblingFolder: (files: DialFile[]) => void;
|
|
41
42
|
onGridCreateChildFolder: (files: DialFile[]) => void;
|
|
42
43
|
}
|
|
43
|
-
export declare const useGridContextMenu: ({ actionLabels, onDuplicate, onCopy, onMove, onDownload, onRename, onDelete, onInfo, onUnshare, onRemoveAccess, sharedWithMeIds, sharedByMePaths, onManagePermissions, onPreview, onOpenInNewTab, previewExtensions, isRenameFileAvailable, isDuplicateFolderAvailable, forbiddenSymbolsRegExp, onGridCreateSiblingFolder, onGridCreateChildFolder, }: UseGridContextMenuProps) => (file: DialFile) => DropdownItem[];
|
|
44
|
+
export declare const useGridContextMenu: ({ actionLabels, onDuplicate, onCopy, onMove, onDownload, onRename, onDelete, onInfo, onUnshare, onRemoveAccess, sharedWithMeIds, sharedByMePaths, onManagePermissions, onPreview, onOpenInNewTab, previewExtensions, isRenameFileAvailable, isDuplicateFolderAvailable, forbiddenSymbolsRegExp, skipForbiddenSymbolsCheckForActions, onGridCreateSiblingFolder, onGridCreateChildFolder, }: UseGridContextMenuProps) => (file: DialFile) => DropdownItem[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { AccordionCaretPosition } from '../../../types/accordion';
|
|
2
3
|
export interface AccordionProps {
|
|
3
4
|
/** Title rendered in the header. */
|
|
4
5
|
title: ReactNode;
|
|
@@ -24,6 +25,8 @@ export interface AccordionProps {
|
|
|
24
25
|
ariaLabel?: string;
|
|
25
26
|
/** Fired when the header is clicked. Receives the next expanded state. */
|
|
26
27
|
onToggle?: (expanded: boolean) => void;
|
|
28
|
+
/** Where the header draws its caret. Defaults to `AccordionCaretPosition.End`. */
|
|
29
|
+
caretPosition?: AccordionCaretPosition;
|
|
27
30
|
/** Additional CSS classes for the outer container. */
|
|
28
31
|
className?: string;
|
|
29
32
|
/** Additional CSS classes for the header. */
|
|
@@ -41,7 +44,8 @@ export interface AccordionProps {
|
|
|
41
44
|
* expanded, a title, and an optional description stacked beneath it.
|
|
42
45
|
*
|
|
43
46
|
* The revealed content is a labelled `region`, so assistive tech announces it by the
|
|
44
|
-
* header it belongs to.
|
|
47
|
+
* header it belongs to. It stays mounted while collapsed so it can slide open and shut,
|
|
48
|
+
* and is `inert` then, out of both the tab order and the accessibility tree. `nonCollapsible` renders the header as static text instead of
|
|
45
49
|
* a permanently disabled button, which keeps a decorative panel out of the tab order.
|
|
46
50
|
*
|
|
47
51
|
* @example
|
|
@@ -64,6 +68,7 @@ export interface AccordionProps {
|
|
|
64
68
|
* @param [nonCollapsible] - Renders the panel permanently expanded, with a static header.
|
|
65
69
|
* @param [ariaLabel] - Accessible name for the header; needed when `title` carries no text.
|
|
66
70
|
* @param [onToggle] - Fired when the header is clicked. Receives the next expanded state.
|
|
71
|
+
* @param [caretPosition=AccordionCaretPosition.End] - Where the header draws its caret: before or after the title.
|
|
67
72
|
* @param [className] - Additional CSS classes for the outer container.
|
|
68
73
|
* @param [headerClassName] - Additional CSS classes for the header.
|
|
69
74
|
* @param [contentClassName] - Additional CSS classes for the content region.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FC, SyntheticEvent } from 'react';
|
|
2
|
+
import { AvatarShape } from '../../../types/avatar';
|
|
3
|
+
/** Props for `Avatar`. */
|
|
4
|
+
export interface AvatarProps {
|
|
5
|
+
/** Display name the initials and the colour are derived from. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Initials to show instead of the ones derived from `name`. */
|
|
8
|
+
initials?: string;
|
|
9
|
+
/** Image URL. The initials show instead while it is missing or fails to load. */
|
|
10
|
+
src?: string;
|
|
11
|
+
/** Accessible name. Leave it empty when a visible label beside the avatar already names it. */
|
|
12
|
+
alt?: string;
|
|
13
|
+
/** Width and height in px. */
|
|
14
|
+
size?: number;
|
|
15
|
+
/** Outline of the avatar. */
|
|
16
|
+
shape?: AvatarShape;
|
|
17
|
+
/** Additional CSS classes for the avatar. */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Type-scale class for the initials. When set, it replaces the font size derived from `size`. */
|
|
20
|
+
textClassName?: string;
|
|
21
|
+
/** Called when the image fails to load, after the avatar has switched to initials. */
|
|
22
|
+
onImageError?: (event: SyntheticEvent<HTMLImageElement>) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A person's or an entity's picture, or its initials on a colour picked from
|
|
26
|
+
* its name.
|
|
27
|
+
* aliases: UserAvatar|InitialsAvatar|ProfilePicture
|
|
28
|
+
* Design system 2.0
|
|
29
|
+
*
|
|
30
|
+
* The same name always gets the same colour, drawn from the theme's visual
|
|
31
|
+
* tokens, so a list of avatars stays stable between renders and sessions. An
|
|
32
|
+
* image that is missing or fails to load falls back to the initials; a new
|
|
33
|
+
* `src` tries the image again.
|
|
34
|
+
*
|
|
35
|
+
* An avatar with an `alt` is a `role="img"` named by it, whether it shows the
|
|
36
|
+
* image or the initials. Without one it is decorative and hidden from
|
|
37
|
+
* assistive technology, which is right when a visible name sits beside it.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <Avatar name="Ada Lovelace" src={photoUrl} alt="Ada Lovelace" />
|
|
42
|
+
* <Avatar name="Summarizer" shape={AvatarShape.Square} size={36} />
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param name - Display name the initials and the colour are derived from
|
|
46
|
+
* @param [initials] - Initials to show instead of the ones derived from `name`
|
|
47
|
+
* @param [src] - Image URL; the initials show while it is missing or broken
|
|
48
|
+
* @param [alt=''] - Accessible name; empty makes the avatar decorative
|
|
49
|
+
* @param [size=32] - Width and height in px
|
|
50
|
+
* @param [shape=AvatarShape.Circle] - Outline of the avatar
|
|
51
|
+
* @param [className] - Additional CSS classes for the avatar
|
|
52
|
+
* @param [textClassName] - Type-scale class for the initials, replacing the size-derived font size
|
|
53
|
+
* @param [onImageError] - Called when the image fails to load
|
|
54
|
+
*/
|
|
55
|
+
export declare const Avatar: FC<AvatarProps>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { BadgeColor, BadgeVariant } from '../../../types/badge';
|
|
3
|
+
/** Props for `Badge`. */
|
|
4
|
+
export interface BadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'color'> {
|
|
5
|
+
/** Text of the badge. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** How the badge is drawn. */
|
|
8
|
+
variant?: BadgeVariant;
|
|
9
|
+
/** Visual colour of a filled badge. Ignored by the outlined variant. */
|
|
10
|
+
color?: BadgeColor;
|
|
11
|
+
/** Decorative icon before the label. */
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
/** Type-scale class for the label, replacing the variant's own. */
|
|
14
|
+
textClassName?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A short, static label: a topic, a category, or a status that is not a
|
|
18
|
+
* control.
|
|
19
|
+
* aliases: Label|StatusLabel|Pill|Chip
|
|
20
|
+
* Design system 2.0
|
|
21
|
+
*
|
|
22
|
+
* Unlike `Tag`, a badge never responds to the pointer and never removes
|
|
23
|
+
* itself — reach for `Tag` when the label is something to select, filter by or
|
|
24
|
+
* dismiss. The badge is 24px tall and does not wrap; a long label keeps its
|
|
25
|
+
* width, so give the badge a `max-w-*` and a truncating `textClassName` where
|
|
26
|
+
* that matters.
|
|
27
|
+
*
|
|
28
|
+
* `BadgeVariant.Outlined` is the neutral label, bordered on the sunken layer.
|
|
29
|
+
* `BadgeVariant.Filled` is a pill in one of the theme's visual colours, for
|
|
30
|
+
* labels that are told apart by colour — so pair the colour with text that
|
|
31
|
+
* says the same thing, since colour alone does not reach every reader. The
|
|
32
|
+
* filled variant's type scale is a lead style, which uppercases itself: pass
|
|
33
|
+
* the label in sentence case.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Badge label="Translation" />
|
|
38
|
+
* <Badge label="Featured" variant={BadgeVariant.Filled} color={BadgeColor.Green} />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param label - Text of the badge
|
|
42
|
+
* @param [variant=BadgeVariant.Outlined] - How the badge is drawn
|
|
43
|
+
* @param [color=BadgeColor.Blue] - Visual colour of a filled badge
|
|
44
|
+
* @param [icon] - Decorative icon before the label
|
|
45
|
+
* @param [textClassName] - Type-scale class for the label, replacing the variant's own
|
|
46
|
+
*/
|
|
47
|
+
export declare const Badge: FC<BadgeProps>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
+
/** Props for `BottomSheet`. */
|
|
3
|
+
export interface BottomSheetProps {
|
|
4
|
+
/** Whether the sheet is shown. */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** Called when the sheet asks to close: the close button, Escape, or a press on the backdrop. */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/** Title of the header. A sheet without one has no header and needs `ariaLabel`. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Accessible name of the sheet when it has no `title`. */
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
/** Shows a back button at the start of the header when set. */
|
|
13
|
+
onBack?: () => void;
|
|
14
|
+
/** Accessible name of the back button. */
|
|
15
|
+
backAriaLabel?: string;
|
|
16
|
+
/** Accessible name of the close button. */
|
|
17
|
+
closeAriaLabel?: string;
|
|
18
|
+
/** Whether a press on the backdrop closes the sheet. */
|
|
19
|
+
closeOnOutsideClick?: boolean;
|
|
20
|
+
/** Content of the sheet, scrolled when it is taller than the sheet allows. */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/** Additional CSS classes for the sheet panel, e.g. a different maximum height. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Additional CSS classes for the backdrop. */
|
|
25
|
+
overlayClassName?: string;
|
|
26
|
+
/** Additional CSS classes for the header row. */
|
|
27
|
+
headerClassName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Inline style for the panel. It renders in a portal, so this is how custom
|
|
30
|
+
* properties reach the panel and its content.
|
|
31
|
+
*/
|
|
32
|
+
style?: CSSProperties;
|
|
33
|
+
/** Inline style for the backdrop, merged after its own positioning. */
|
|
34
|
+
overlayStyle?: CSSProperties;
|
|
35
|
+
/** Additional CSS classes for the scrolling body. */
|
|
36
|
+
bodyClassName?: string;
|
|
37
|
+
/** Type-scale class for the title, replacing its own. */
|
|
38
|
+
titleClassName?: string;
|
|
39
|
+
/** Id of the element to portal into, instead of the end of `<body>`. */
|
|
40
|
+
portalId?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A panel that slides up from the bottom edge over a dimmed page — the mobile
|
|
44
|
+
* counterpart of `Popup`.
|
|
45
|
+
* aliases: ActionSheet|Drawer|MobileSheet|BottomDrawer
|
|
46
|
+
* Design system 2.0
|
|
47
|
+
*
|
|
48
|
+
* It is a modal dialog: focus moves into it on open and stays there, returns
|
|
49
|
+
* to where it came from on close, and the page behind it does not scroll.
|
|
50
|
+
* Escape, the close button and a press on the backdrop all call `onClose`;
|
|
51
|
+
* the sheet itself stays controlled by `open`.
|
|
52
|
+
*
|
|
53
|
+
* With a `title` the header shows it centred, a close button at the end and,
|
|
54
|
+
* when `onBack` is set, a back button at the start for a sheet that drills
|
|
55
|
+
* into pages of its own; the title also names the dialog. Without one there is
|
|
56
|
+
* no header, and `ariaLabel` names the sheet instead. The body scrolls once
|
|
57
|
+
* the content is taller than 85% of the viewport.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <BottomSheet open={isOpen} title="Select model" onClose={() => setIsOpen(false)}>
|
|
62
|
+
* <ModelList />
|
|
63
|
+
* </BottomSheet>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param open - Whether the sheet is shown
|
|
67
|
+
* @param onClose - Called when the sheet asks to close
|
|
68
|
+
* @param [title] - Title of the header; without it the sheet has no header
|
|
69
|
+
* @param [ariaLabel] - Accessible name when there is no `title`
|
|
70
|
+
* @param [onBack] - Shows a back button at the start of the header
|
|
71
|
+
* @param [backAriaLabel='Back'] - Accessible name of the back button
|
|
72
|
+
* @param [closeAriaLabel='Close'] - Accessible name of the close button
|
|
73
|
+
* @param [closeOnOutsideClick=true] - Whether a press on the backdrop closes the sheet
|
|
74
|
+
* @param [children] - Content of the sheet
|
|
75
|
+
* @param [className] - Additional CSS classes for the sheet panel
|
|
76
|
+
* @param [overlayClassName] - Additional CSS classes for the backdrop
|
|
77
|
+
* @param [headerClassName] - Additional CSS classes for the header row
|
|
78
|
+
* @param [style] - Inline style for the panel, e.g. custom properties
|
|
79
|
+
* @param [overlayStyle] - Inline style for the backdrop
|
|
80
|
+
* @param [bodyClassName] - Additional CSS classes for the scrolling body
|
|
81
|
+
* @param [titleClassName] - Type-scale class for the title
|
|
82
|
+
* @param [portalId] - Id of the element to portal into
|
|
83
|
+
*/
|
|
84
|
+
export declare const BottomSheet: FC<BottomSheetProps>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { FC, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { BreadcrumbsSize } from '../../../types/breadcrumbs';
|
|
3
|
+
/** One step of the trail rendered by {@link Breadcrumbs}. */
|
|
4
|
+
export interface BreadcrumbsItem {
|
|
5
|
+
/**
|
|
6
|
+
* The segment's text. A plain string rather than a node, because it is both
|
|
7
|
+
* what is drawn and what the tooltip shows once the trail truncates it.
|
|
8
|
+
*/
|
|
9
|
+
label: string;
|
|
10
|
+
/** Where the segment navigates. Renders the segment as a link. */
|
|
11
|
+
href?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Fired when the segment is activated. Renders the segment as a button when
|
|
14
|
+
* there is no `href`, and runs before the browser follows one when there is —
|
|
15
|
+
* call `preventDefault()` on the event to keep the user where they are.
|
|
16
|
+
*/
|
|
17
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
18
|
+
/** Leading icon, e.g. a folder glyph on the root. Decorative: pass `aria-hidden`. */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export interface BreadcrumbsProps {
|
|
22
|
+
/** The trail, outermost first. The last entry is the current page. */
|
|
23
|
+
items: BreadcrumbsItem[];
|
|
24
|
+
/**
|
|
25
|
+
* How many segments are drawn before the middle collapses behind an
|
|
26
|
+
* ellipsis menu. Clamped to a floor of three — the root, the ellipsis and
|
|
27
|
+
* the current page.
|
|
28
|
+
*/
|
|
29
|
+
maxVisibleItems?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The trail's type scale: `dial-small-text` by default, or `dial-h2-text`
|
|
32
|
+
* for a trail that doubles as the page heading.
|
|
33
|
+
*/
|
|
34
|
+
size?: BreadcrumbsSize;
|
|
35
|
+
/** Node drawn between two segments. Defaults to a right chevron, mirrored in RTL. */
|
|
36
|
+
separator?: ReactNode;
|
|
37
|
+
/** Accessible name for the `<nav>`. */
|
|
38
|
+
ariaLabel?: string;
|
|
39
|
+
/** Accessible name for the ellipsis button that reveals the collapsed segments. */
|
|
40
|
+
overflowAriaLabel?: string;
|
|
41
|
+
/** Additional CSS classes for the `<nav>`. Must not shrink it to its content. */
|
|
42
|
+
className?: string;
|
|
43
|
+
/** Additional CSS classes applied to every segment. */
|
|
44
|
+
itemClassName?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A navigation trail: where the user is, and every level they can step back to.
|
|
48
|
+
* aliases: Breadcrumb|NavigationPath|BreadcrumbTrail
|
|
49
|
+
* Design system 2.0
|
|
50
|
+
*
|
|
51
|
+
* The last item is the current page — drawn semibold and primary, and never a
|
|
52
|
+
* control, since a link to the page you are already on does nothing. Every
|
|
53
|
+
* earlier item with an `href` or an `onClick` is a link; one with neither is
|
|
54
|
+
* drawn as plain text, which is how a read-only location path is built.
|
|
55
|
+
*
|
|
56
|
+
* The trail never wraps. Segments truncate instead, each revealing its full
|
|
57
|
+
* label in a tooltip only once it is actually clipped, and a trail longer than
|
|
58
|
+
* `maxVisibleItems` collapses its middle behind an ellipsis menu — the root and
|
|
59
|
+
* the current page, the two segments that carry the most meaning, always stay
|
|
60
|
+
* on screen.
|
|
61
|
+
*
|
|
62
|
+
* a11y: an `<ol>` inside a named `<nav>`, with `aria-current="page"` on the last
|
|
63
|
+
* segment. Separators are decorative and hidden from assistive tech, so the
|
|
64
|
+
* trail is announced as a list of links rather than a string of chevrons.
|
|
65
|
+
*
|
|
66
|
+
* The trail is drawn at `dial-small-text` by default; `size` switches it to
|
|
67
|
+
* `dial-h2-text` for a trail that doubles as the page heading, where the
|
|
68
|
+
* token's own semibold weight applies to every segment.
|
|
69
|
+
*
|
|
70
|
+
* Labels are the caller's to translate; the two accessible names default to
|
|
71
|
+
* English and take an override.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <Breadcrumbs
|
|
76
|
+
* ariaLabel={t('File path')}
|
|
77
|
+
* items={[
|
|
78
|
+
* { label: t('My files'), onClick: () => open('/') },
|
|
79
|
+
* { label: 'DK Test', onClick: () => open('/DK Test') },
|
|
80
|
+
* { label: 'DK Test with nested' },
|
|
81
|
+
* ]}
|
|
82
|
+
* />
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @param items - The trail, outermost first; the last entry is the current page
|
|
86
|
+
* @param [maxVisibleItems=4] - Segments drawn before the middle collapses behind an ellipsis menu
|
|
87
|
+
* @param [size=BreadcrumbsSize.Small] - The trail's type scale: `dial-small-text` or `dial-h2-text`
|
|
88
|
+
* @param [separator] - Node drawn between two segments; defaults to a right chevron
|
|
89
|
+
* @param [ariaLabel='Breadcrumb'] - Accessible name for the `<nav>`
|
|
90
|
+
* @param [overflowAriaLabel='Show hidden path segments'] - Accessible name for the ellipsis button
|
|
91
|
+
* @param [className] - Additional CSS classes for the `<nav>`
|
|
92
|
+
* @param [itemClassName] - Additional CSS classes applied to every segment
|
|
93
|
+
*/
|
|
94
|
+
export declare const Breadcrumbs: FC<BreadcrumbsProps>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BreadcrumbsSize } from '../../../types/breadcrumbs';
|
|
3
|
+
/**
|
|
4
|
+
* The `<nav>`. It clips rather than wraps: a breadcrumb that reflows onto a
|
|
5
|
+
* second line moves the content below it, so the trail truncates its segments
|
|
6
|
+
* instead (see `segmentWidthClassName`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const navClassName = "w-full overflow-hidden";
|
|
9
|
+
/** The `<ol>` holding the segments and their separators. */
|
|
10
|
+
export declare const listClassName = "flex min-w-0 flex-nowrap items-center gap-2 whitespace-nowrap";
|
|
11
|
+
/** One `<li>`: the segment and the separator that follows it. */
|
|
12
|
+
export declare const itemClassName = "flex min-w-0 items-center gap-2";
|
|
13
|
+
/**
|
|
14
|
+
* The trail's type scale. It sits on the `<li>`, so the segment, the
|
|
15
|
+
* separator and the tooltip trigger inside it all read from one declaration.
|
|
16
|
+
*/
|
|
17
|
+
export declare const sizeClassName: Record<BreadcrumbsSize, string>;
|
|
18
|
+
/**
|
|
19
|
+
* The current page is always semibold. `dial-h2-text` already is, so the
|
|
20
|
+
* heading trail repeats its own token rather than reaching for a semibold
|
|
21
|
+
* variant that does not exist.
|
|
22
|
+
*/
|
|
23
|
+
export declare const currentSizeClassName: Record<BreadcrumbsSize, string>;
|
|
24
|
+
/**
|
|
25
|
+
* How each segment gives up width when the trail does not fit. The root keeps
|
|
26
|
+
* its full label — it is the anchor the user navigates back to — the middle
|
|
27
|
+
* segments truncate first, and the current page keeps the largest share of
|
|
28
|
+
* what is left, since it names where the user actually is.
|
|
29
|
+
*/
|
|
30
|
+
export declare const segmentWidthClassName: Record<'first' | 'middle' | 'last', string>;
|
|
31
|
+
/** The box that draws a segment, around its icon and its label. */
|
|
32
|
+
export declare const segmentClassName = "flex min-w-0 flex-1 items-center gap-1 rounded-sm transition-colors";
|
|
33
|
+
/**
|
|
34
|
+
* A segment the user can follow. Secondary until hovered, then accent — the
|
|
35
|
+
* same pairing the kit's other inline links use.
|
|
36
|
+
*/
|
|
37
|
+
export declare const linkSegmentClassName = "text-secondary hover:text-accent focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus";
|
|
38
|
+
/**
|
|
39
|
+
* The last segment: where the user is. Semibold and primary, and never a
|
|
40
|
+
* link — a control that navigates to the page it is on has nothing to do.
|
|
41
|
+
*/
|
|
42
|
+
export declare const currentSegmentClassName = "cursor-default text-primary";
|
|
43
|
+
/** A segment with nowhere to go: rendered, but not a control. */
|
|
44
|
+
export declare const staticSegmentClassName = "cursor-default text-secondary";
|
|
45
|
+
/** The chevron between two segments. */
|
|
46
|
+
export declare const separatorClassName = "inline-flex flex-none items-center leading-none text-secondary";
|
|
47
|
+
/**
|
|
48
|
+
* The collapsed-middle trigger. `dial-kit-minimum-target` lifts the 16px
|
|
49
|
+
* glyph to the 24×24 of WCAG 2.5.8; the enhanced 44×44 target would overhang
|
|
50
|
+
* the segments on either side of it (see the README exception table).
|
|
51
|
+
*/
|
|
52
|
+
export declare const overflowButtonClassName = "dial-kit-minimum-target flex shrink-0 items-center rounded-sm text-secondary transition-colors hover:text-accent focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus";
|
|
53
|
+
/**
|
|
54
|
+
* Smallest trail the collapse can produce: the root, the ellipsis and the
|
|
55
|
+
* current page. Below that there is nothing left to hide behind the ellipsis.
|
|
56
|
+
*/
|
|
57
|
+
export declare const MIN_VISIBLE_ITEMS = 3;
|
|
58
|
+
/** Segments shown before the trail collapses. */
|
|
59
|
+
export declare const DEFAULT_MAX_VISIBLE_ITEMS = 4;
|
|
60
|
+
export declare const defaultSeparator: ReactNode;
|
|
@@ -58,7 +58,10 @@ export interface ButtonProps extends DetailedHTMLProps<ButtonHTMLAttributes<HTML
|
|
|
58
58
|
* `<button>`, so the control keeps the link role, middle-click, and
|
|
59
59
|
* "open in new tab". Pair it with `ButtonAppearance.Link` (or `LinkButton`)
|
|
60
60
|
* unless a button-shaped link is intended.
|
|
61
|
-
* @param [tooltipProps] - Props of the 2.0 {@link Tooltip} wrapping the button
|
|
61
|
+
* @param [tooltipProps] - Props of the 2.0 {@link Tooltip} wrapping the button.
|
|
62
|
+
* A disabled button with a visible tooltip is marked `aria-disabled` rather
|
|
63
|
+
* than natively `disabled`, so it stays focusable and hoverable and the
|
|
64
|
+
* tooltip can still explain why it is unavailable; its click does nothing.
|
|
62
65
|
* @param [target] - Anchor target, only meaningful alongside `href`
|
|
63
66
|
* @param [rel] - Anchor `rel`. Defaults to `noopener noreferrer` when
|
|
64
67
|
* `target="_blank"`.
|
|
@@ -43,6 +43,26 @@ export declare const NeutralButton: FC<ButtonVariantProps>;
|
|
|
43
43
|
* Inherits all properties from the `ButtonProps`
|
|
44
44
|
*/
|
|
45
45
|
export declare const DangerButton: FC<ButtonVariantProps>;
|
|
46
|
+
/** A Starter Button component — a conversation starter: an outlined neutral
|
|
47
|
+
* pill whose icons are stroked with the accent gradient
|
|
48
|
+
* Design system 2.0
|
|
49
|
+
*
|
|
50
|
+
* An SVG stroke cannot take a CSS gradient, so the button renders its own
|
|
51
|
+
* `linearGradient` with a per-instance id and hands it to its icons through
|
|
52
|
+
* the `--dial-kit-starter-icon-stroke` custom property. Any icon that strokes
|
|
53
|
+
* with `currentColor`, as Tabler icons do, picks it up.
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <StarterButton
|
|
57
|
+
* label="Summarize this document"
|
|
58
|
+
* iconBefore={<IconSparkles />}
|
|
59
|
+
* onClick={handleClick}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* Inherits all properties from the `ButtonProps`
|
|
64
|
+
*/
|
|
65
|
+
export declare const StarterButton: FC<ButtonVariantProps>;
|
|
46
66
|
/** A Link Button component with predefined link appearance
|
|
47
67
|
* @example
|
|
48
68
|
* ```tsx
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, MouseEventHandler, ReactNode } from 'react';
|
|
1
2
|
import { ButtonAppearance, ButtonVariant } from '../../../types/button';
|
|
3
|
+
/** The tooltip fields that decide whether a disabled button must stay reachable. */
|
|
4
|
+
interface DisabledTooltipFields {
|
|
5
|
+
tooltip?: ReactNode;
|
|
6
|
+
hideTooltip?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** The props a button element takes for its disabled state and its click. */
|
|
9
|
+
type DisabledButtonProps = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'disabled' | 'aria-disabled' | 'onClick'>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the disabled-state props for a button element: native `disabled`,
|
|
12
|
+
* or — for a disabled button that shows a tooltip — `aria-disabled` with the
|
|
13
|
+
* click swallowed, so the button stays hoverable and focusable.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getDisabledButtonProps: (disabled: boolean | undefined, tooltipProps: DisabledTooltipFields | undefined, onClick: MouseEventHandler<HTMLButtonElement> | undefined) => DisabledButtonProps;
|
|
2
16
|
export declare const getButtonClassNames: (variant?: ButtonVariant, appearance?: ButtonAppearance) => string;
|
|
17
|
+
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { DropdownItem } from '../../../models/dropdown';
|
|
3
3
|
import { ButtonProps } from '../Button/Button';
|
|
4
|
+
import { DropdownProps } from '../Dropdown/Dropdown';
|
|
4
5
|
export interface ButtonDropdownProps extends Omit<ButtonProps, 'iconAfter'> {
|
|
5
6
|
items: DropdownItem[];
|
|
7
|
+
/** Menu options forwarded to the underlying `Dropdown`: the panel class and whether the panel matches the button's width. */
|
|
8
|
+
dropdownProps?: Pick<DropdownProps, 'listClassName' | 'matchReferenceWidth'>;
|
|
6
9
|
}
|
|
7
10
|
/**
|
|
8
11
|
* A Button dropdown component based on the Dropdown component
|
|
@@ -20,5 +23,6 @@ export interface ButtonDropdownProps extends Omit<ButtonProps, 'iconAfter'> {
|
|
|
20
23
|
*
|
|
21
24
|
* Inherits all props from Button.
|
|
22
25
|
* @param [items] - DropdownItems with actions
|
|
26
|
+
* @param [dropdownProps] - `listClassName` and `matchReferenceWidth` forwarded to the menu `Dropdown`
|
|
23
27
|
*/
|
|
24
28
|
export declare const ButtonDropdown: FC<ButtonDropdownProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, FocusEventHandler } from 'react';
|
|
2
2
|
import { LabelProps } from '../Label/Label';
|
|
3
3
|
import { CalendarMode } from '../../../types/calendar';
|
|
4
4
|
export type CalendarValue = Date | string | null;
|
|
@@ -6,6 +6,11 @@ export interface CalendarProps {
|
|
|
6
6
|
mode?: CalendarMode;
|
|
7
7
|
value?: CalendarValue;
|
|
8
8
|
onChange?: (value: CalendarValue) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Called when the Calendar's input field loses focus, e.g. for on-blur
|
|
11
|
+
* validation.
|
|
12
|
+
*/
|
|
13
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
9
14
|
labelProps?: LabelProps;
|
|
10
15
|
placeholder?: string;
|
|
11
16
|
disabled?: boolean;
|
|
@@ -47,6 +52,7 @@ export interface CalendarProps {
|
|
|
47
52
|
* @param [mode=CalendarMode.Date] - Selection mode: date, datetime, time or weekday
|
|
48
53
|
* @param [value] - Controlled value: a `Date` for date/datetime, an `"HH:mm"` string for time, an ISO weekday number (`"1"`=Monday…`"7"`=Sunday) for weekday
|
|
49
54
|
* @param [onChange] - Callback fired with the next value when the selection changes
|
|
55
|
+
* @param [onBlur] - Called when the Calendar's input field loses focus, e.g. for on-blur validation
|
|
50
56
|
* @param [labelProps] - Props of the {@link Label} rendered above the control, including `label`, `required` and `caption`
|
|
51
57
|
* @param [placeholder] - Placeholder shown when there is no value; defaults to a mode-appropriate string ("Select date", "Select date and time", "--:--" or "Select day")
|
|
52
58
|
* @param [disabled=false] - Disables the control
|
|
@@ -4,7 +4,7 @@ export declare const calendarModeDefaultPlaceholder: Record<CalendarMode, string
|
|
|
4
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
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-
|
|
7
|
+
export declare const calendarPopoverClassName = "z-floating flex w-[248px] flex-col gap-4 rounded-lg bg-layer-raised px-2 py-4 shadow-md";
|
|
8
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";
|
|
@@ -6,7 +6,6 @@ export declare const loaderContainerClassName = "px-6 py-4 h-[120px]";
|
|
|
6
6
|
export declare const defaultCancelLabel = "Cancel";
|
|
7
7
|
export declare const defaultConfirmLabel = "Ok";
|
|
8
8
|
export declare const variantConfig: Record<ConfirmationPopupVariant, {
|
|
9
|
-
container?: string;
|
|
10
9
|
confirm: {
|
|
11
10
|
variant: ButtonVariant;
|
|
12
11
|
appearance: ButtonAppearance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Placement } from '@floating-ui/react';
|
|
2
|
-
import { FC, MouseEvent, ReactNode, RefObject } from 'react';
|
|
2
|
+
import { CSSProperties, FC, MouseEvent, ReactNode, RefObject } from 'react';
|
|
3
3
|
import { DropdownTrigger } from '../../../types/dropdown';
|
|
4
4
|
import { DropdownItem } from '../../../models/dropdown';
|
|
5
5
|
export interface DropdownProps {
|
|
@@ -25,6 +25,13 @@ export interface DropdownProps {
|
|
|
25
25
|
overlayContentClassName?: string;
|
|
26
26
|
separatorClassName?: string;
|
|
27
27
|
listClassName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Inline style for the floating overlay. The overlay renders in a portal, so
|
|
30
|
+
* this is the only way to hand it CSS custom properties from a caller's own
|
|
31
|
+
* scope — e.g. theme variables that its rows and header read. Positioning
|
|
32
|
+
* stays the dropdown's own: `floatingStyles` is applied on top of it.
|
|
33
|
+
*/
|
|
34
|
+
listStyle?: CSSProperties;
|
|
28
35
|
outsidePressIgnoreRef?: RefObject<HTMLElement | null>;
|
|
29
36
|
outsideClosable?: boolean;
|
|
30
37
|
anchorToMouse?: boolean;
|
|
@@ -97,6 +104,7 @@ export interface DropdownProps {
|
|
|
97
104
|
* @param [overlayContentClassName] - Additional CSS classes applied to the overlay content
|
|
98
105
|
* @param [separatorClassName] - Additional CSS classes applied to the separators between items
|
|
99
106
|
* @param [listClassName] - Additional CSS classes applied to the floating overlay
|
|
107
|
+
* @param [listStyle] - Inline style applied to the floating overlay, under the dropdown's own positioning styles
|
|
100
108
|
* @param [outsidePressIgnoreRef] - Ref to an element that should not trigger outside press behavior
|
|
101
109
|
* @param [outsideClosable=true] - Whether clicks outside the overlay should close it
|
|
102
110
|
* @param [anchorToMouse=false] - Whether to anchor the dropdown to the mouse position
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare const dropdownBaseClassName: string;
|
|
2
2
|
export declare const dropdownListBaseClassName: string;
|
|
3
3
|
export declare const dropdownSubMenuClassName: string;
|
|
4
|
+
export declare const dropdownSubMenuListClassName: string;
|
|
5
|
+
/** The top-level item list: rows 2px apart, inset from the panel edge. */
|
|
6
|
+
export declare const dropdownItemListClassName: string;
|
|
4
7
|
/**
|
|
5
8
|
* The row's own styling lives in {@link MenuItem}, which renders every item of
|
|
6
9
|
* the menu. This alias is what a fully custom overlay row can lean on to match
|