@eyesee/ui-components 0.8.0 → 0.10.0
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 +2 -0
- package/dist/components/Avatar/Avatar.d.ts +139 -0
- package/dist/components/Avatar/Avatar.js +8 -7
- package/dist/components/Badge/Badge.d.ts +59 -0
- package/dist/components/Badge/Badge.js +7 -7
- package/dist/components/Badge/badgeVariants.d.ts +17 -0
- package/dist/components/Button/Button.d.ts +299 -0
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Checkbox/Checkbox.d.ts +124 -0
- package/dist/components/Checkbox/Checkbox.js +13 -12
- package/dist/components/DropdownList/DropdownList.d.ts +153 -0
- package/dist/components/DropdownList/DropdownList.js +15 -15
- package/dist/components/EllipsisTooltip/EllipsisTooltip.d.ts +114 -0
- package/dist/components/EllipsisTooltip/EllipsisTooltip.js +3 -3
- package/dist/components/ExpandableItem/ExpandableItem.d.ts +89 -0
- package/dist/components/ExpandableItem/ExpandableItem.js +6 -6
- package/dist/components/Fields/InputField/InputField.d.ts +309 -0
- package/dist/components/Fields/InputField/InputField.js +54 -49
- package/dist/components/Fields/InputFieldContainer.d.ts +11 -0
- package/dist/components/Fields/SelectField/SelectField.d.ts +404 -0
- package/dist/components/Fields/SelectField/SelectField.js +61 -56
- package/dist/components/Fields/SelectField/SelectFieldTags.d.ts +6 -0
- package/dist/components/Fields/SelectField/selectOptionRow.d.ts +1 -0
- package/dist/components/Fields/SelectField/selectUtils.d.ts +35 -0
- package/dist/components/Fields/SelectField/useSelectFieldDropdownPosition.d.ts +7 -0
- package/dist/components/Fields/TextField/TextField.d.ts +272 -0
- package/dist/components/Fields/TextField/TextField.js +68 -61
- package/dist/components/FileType/FileType.d.ts +61 -0
- package/dist/components/FileType/FileType.js +6 -5
- package/dist/components/FileType/PaperIcon.d.ts +5 -0
- package/dist/components/ImagePlaceholder/ImageHoverPreview/ImageHoverPreview.d.ts +75 -0
- package/dist/components/ImagePlaceholder/ImageHoverPreview/ImageHoverPreview.js +13 -12
- package/dist/components/ImagePlaceholder/ImagePlaceholder.d.ts +606 -0
- package/dist/components/ImagePlaceholder/ImagePlaceholder.js +3 -3
- package/dist/components/ImagePlaceholder/constantsImgPh.d.ts +16 -0
- package/dist/components/ImagePlaceholder/utilsImgPh.d.ts +18 -0
- package/dist/components/ImageWithData/ImageWithData.d.ts +284 -0
- package/dist/components/ImageWithData/ImageWithData.js +11 -11
- package/dist/components/Infobox/Infobox.d.ts +90 -0
- package/dist/components/Infobox/Infobox.js +5 -5
- package/dist/components/Infobox/infoboxVariants.d.ts +8 -0
- package/dist/components/ListItem/ListItem.d.ts +311 -0
- package/dist/components/ListItem/ListItem.js +7 -7
- package/dist/components/ListItem/useListItems.d.ts +108 -0
- package/dist/components/ListItem/useListItems.js +18 -17
- package/dist/components/Modal/Modal.d.ts +239 -0
- package/dist/components/Modal/Modal.js +4 -3
- package/dist/components/Notifications/Notifications.d.ts +261 -0
- package/dist/components/Notifications/Notifications.js +4 -3
- package/dist/components/Notifications/useNotifications.d.ts +59 -0
- package/dist/components/Notifications/useNotifications.js +3 -2
- package/dist/components/Pill/Pill.d.ts +81 -0
- package/dist/components/Pill/Pill.js +7 -12
- package/dist/components/Pill/pillVariants.d.ts +16 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +111 -0
- package/dist/components/ProgressBar/ProgressBar.js +17 -16
- package/dist/components/Radio/Radio.d.ts +58 -0
- package/dist/components/Radio/Radio.js +12 -11
- package/dist/components/Tab/Tab.d.ts +204 -0
- package/dist/components/Tab/Tab.js +3 -3
- package/dist/components/Tabs/Tabs.d.ts +356 -0
- package/dist/components/Tabs/Tabs.js +3 -3
- package/dist/components/Tabs/tabsUtils.d.ts +33 -0
- package/dist/components/Tabs/tabsUtils.js +18 -12
- package/dist/components/Tag/Tag.d.ts +93 -0
- package/dist/components/Tag/Tag.js +4 -3
- package/dist/components/Tag/tagVariants.d.ts +7 -0
- package/dist/components/TextHoverable/TextHoverable.d.ts +46 -0
- package/dist/components/TextHoverable/TextHoverable.js +5 -3
- package/dist/components/Toggle/Toggle.d.ts +115 -0
- package/dist/components/Toggle/Toggle.js +6 -5
- package/dist/components/Tooltip/Tooltip.d.ts +294 -0
- package/dist/components/Tooltip/Tooltip.js +3 -3
- package/dist/components/Tooltip/useTooltipPositioning.d.ts +21 -0
- package/dist/components/icons-v2/AdIcon.d.ts +2 -0
- package/dist/components/icons-v2/AddMessageIcon.d.ts +13 -0
- package/dist/components/icons-v2/AddUserIcon.d.ts +13 -0
- package/dist/components/icons-v2/AdjustmentsIcon.d.ts +13 -0
- package/dist/components/icons-v2/AlertIcon.d.ts +13 -0
- package/dist/components/icons-v2/AlignCenterIcon.d.ts +13 -0
- package/dist/components/icons-v2/AlignHorizontallyIcon.d.ts +13 -0
- package/dist/components/icons-v2/AlignJustifyIcon.d.ts +13 -0
- package/dist/components/icons-v2/AlignLeftIcon.d.ts +13 -0
- package/dist/components/icons-v2/AlignRightIcon.d.ts +13 -0
- package/dist/components/icons-v2/AlignVerticallyIcon.d.ts +13 -0
- package/dist/components/icons-v2/AlphabetIcon.d.ts +20 -0
- package/dist/components/icons-v2/ArchiveIcon.d.ts +13 -0
- package/dist/components/icons-v2/ArrowDownIcon.d.ts +13 -0
- package/dist/components/icons-v2/ArrowDownRightIcon.d.ts +13 -0
- package/dist/components/icons-v2/ArrowLeftIcon.d.ts +13 -0
- package/dist/components/icons-v2/ArrowMoveDownIcon.d.ts +13 -0
- package/dist/components/icons-v2/ArrowRightIcon.d.ts +13 -0
- package/dist/components/icons-v2/ArrowUpIcon.d.ts +13 -0
- package/dist/components/icons-v2/AspectRatioIcon.d.ts +13 -0
- package/dist/components/icons-v2/AspectRatioIcon.js +15 -0
- package/dist/components/icons-v2/AttributesEvaluationIcon.d.ts +13 -0
- package/dist/components/icons-v2/BellIcon.d.ts +13 -0
- package/dist/components/icons-v2/BoldIcon.d.ts +13 -0
- package/dist/components/icons-v2/BoltIcon.d.ts +13 -0
- package/dist/components/icons-v2/BookIcon.d.ts +13 -0
- package/dist/components/icons-v2/BookmarkIcon.d.ts +13 -0
- package/dist/components/icons-v2/BooksIcon.d.ts +13 -0
- package/dist/components/icons-v2/BoxIcon.d.ts +13 -0
- package/dist/components/icons-v2/BugIcon.d.ts +13 -0
- package/dist/components/icons-v2/CalendarIcon.d.ts +13 -0
- package/dist/components/icons-v2/CameraPlusIcon.d.ts +13 -0
- package/dist/components/icons-v2/CardsIcon.d.ts +13 -0
- package/dist/components/icons-v2/CellIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChartbarIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChartbarOffIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChatBubbleIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChatbotIcon.d.ts +13 -0
- package/dist/components/icons-v2/CheckCircleIcon.d.ts +13 -0
- package/dist/components/icons-v2/CheckboxIcon.d.ts +13 -0
- package/dist/components/icons-v2/CheckmarkDoubleIcon.d.ts +13 -0
- package/dist/components/icons-v2/CheckmarkLargeIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChevronDownIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChevronLeftIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChevronRightIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChevronUpIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChevronsDownIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChevronsLeftIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChevronsRightIcon.d.ts +13 -0
- package/dist/components/icons-v2/ChevronsUpIcon.d.ts +13 -0
- package/dist/components/icons-v2/CircleIcon.d.ts +11 -0
- package/dist/components/icons-v2/CirclesIcon.d.ts +13 -0
- package/dist/components/icons-v2/ClickIcon.d.ts +13 -0
- package/dist/components/icons-v2/ClipboardIcon.d.ts +13 -0
- package/dist/components/icons-v2/ClockIcon.d.ts +13 -0
- package/dist/components/icons-v2/ClockShareIcon.d.ts +13 -0
- package/dist/components/icons-v2/CloseIcon.d.ts +13 -0
- package/dist/components/icons-v2/ColumnIcon.d.ts +1 -0
- package/dist/components/icons-v2/CopyIcon.d.ts +13 -0
- package/dist/components/icons-v2/CreditCardIcon.d.ts +13 -0
- package/dist/components/icons-v2/CropIcon.d.ts +13 -0
- package/dist/components/icons-v2/DashboardMeterIcon.d.ts +13 -0
- package/dist/components/icons-v2/DatabaseCheckIcon.d.ts +13 -0
- package/dist/components/icons-v2/DatabaseIcon.d.ts +13 -0
- package/dist/components/icons-v2/DeleteIcon.d.ts +12 -0
- package/dist/components/icons-v2/DetailsIcon.d.ts +13 -0
- package/dist/components/icons-v2/DevicesIcon.d.ts +13 -0
- package/dist/components/icons-v2/DislikeIcon.d.ts +13 -0
- package/dist/components/icons-v2/DollarIcon.d.ts +13 -0
- package/dist/components/icons-v2/DownloadIcon.d.ts +13 -0
- package/dist/components/icons-v2/DragToolIcon.d.ts +13 -0
- package/dist/components/icons-v2/DrawRectangleIcon.d.ts +13 -0
- package/dist/components/icons-v2/EditIcon.d.ts +12 -0
- package/dist/components/icons-v2/EmailIcon.d.ts +13 -0
- package/dist/components/icons-v2/EmojiNeutralIcon.d.ts +13 -0
- package/dist/components/icons-v2/EmojiSadIcon.d.ts +13 -0
- package/dist/components/icons-v2/EmojiSlightSmileyIcon.d.ts +13 -0
- package/dist/components/icons-v2/EmojiSmileyIcon.d.ts +13 -0
- package/dist/components/icons-v2/EmojiVerySadIcon.d.ts +13 -0
- package/dist/components/icons-v2/EraserIcon.d.ts +13 -0
- package/dist/components/icons-v2/EtShelfIcon.d.ts +13 -0
- package/dist/components/icons-v2/EtStandaloneIcon.d.ts +13 -0
- package/dist/components/icons-v2/ExternalLinkIcon.d.ts +13 -0
- package/dist/components/icons-v2/EyeSeeTokenIcon.d.ts +1 -0
- package/dist/components/icons-v2/FileExportIcon.d.ts +13 -0
- package/dist/components/icons-v2/FileIcon.d.ts +13 -0
- package/dist/components/icons-v2/FileImportIcon.d.ts +13 -0
- package/dist/components/icons-v2/FileNewIcon.d.ts +13 -0
- package/dist/components/icons-v2/FileRemoveIcon.d.ts +13 -0
- package/dist/components/icons-v2/FileTemplateIcon.d.ts +13 -0
- package/dist/components/icons-v2/FileUploadIcon.d.ts +13 -0
- package/dist/components/icons-v2/FilesIcon.d.ts +13 -0
- package/dist/components/icons-v2/FilterOffIcon.d.ts +13 -0
- package/dist/components/icons-v2/FilterOnIcon.d.ts +13 -0
- package/dist/components/icons-v2/FlagIcon.d.ts +13 -0
- package/dist/components/icons-v2/FolderIcon.d.ts +13 -0
- package/dist/components/icons-v2/FullscreenIcon.d.ts +13 -0
- package/dist/components/icons-v2/GridviewIcon.d.ts +13 -0
- package/dist/components/icons-v2/HelpIcon.d.ts +10 -0
- package/dist/components/icons-v2/HomeIcon.d.ts +13 -0
- package/dist/components/icons-v2/ImageIcon.d.ts +13 -0
- package/dist/components/icons-v2/ImageOffIcon.d.ts +13 -0
- package/dist/components/icons-v2/ImageStarIcon.d.ts +15 -0
- package/dist/components/icons-v2/ImageUploadIcon.d.ts +13 -0
- package/dist/components/icons-v2/ImagesIcon.d.ts +123 -0
- package/dist/components/icons-v2/ImagesIcon.js +15 -0
- package/dist/components/icons-v2/InfoIcon.d.ts +13 -0
- package/dist/components/icons-v2/ItalicIcon.d.ts +13 -0
- package/dist/components/icons-v2/LanguageIcon.d.ts +13 -0
- package/dist/components/icons-v2/LaunchIcon.d.ts +13 -0
- package/dist/components/icons-v2/LayersIcon.d.ts +13 -0
- package/dist/components/icons-v2/LeftSidebarCollapseIcon.d.ts +13 -0
- package/dist/components/icons-v2/LeftSidebarExpandIcon.d.ts +13 -0
- package/dist/components/icons-v2/LightDarkIcon.d.ts +13 -0
- package/dist/components/icons-v2/LightbulbIcon.d.ts +13 -0
- package/dist/components/icons-v2/LikeIcon.d.ts +13 -0
- package/dist/components/icons-v2/LinkIcon.d.ts +13 -0
- package/dist/components/icons-v2/ListCheckIcon.d.ts +1 -0
- package/dist/components/icons-v2/ListViewIcon.d.ts +13 -0
- package/dist/components/icons-v2/LoaderIcon.d.ts +14 -0
- package/dist/components/icons-v2/LoadingIcon.d.ts +14 -0
- package/dist/components/icons-v2/LockIcon.d.ts +13 -0
- package/dist/components/icons-v2/LockOffIcon.d.ts +13 -0
- package/dist/components/icons-v2/LoginIcon.d.ts +13 -0
- package/dist/components/icons-v2/LogoutIcon.d.ts +13 -0
- package/dist/components/icons-v2/MagicwandIcon.d.ts +13 -0
- package/dist/components/icons-v2/MaximizeIcon.d.ts +13 -0
- package/dist/components/icons-v2/MenuIcon.d.ts +13 -0
- package/dist/components/icons-v2/MessageIcon.d.ts +13 -0
- package/dist/components/icons-v2/MeterIcon.d.ts +13 -0
- package/dist/components/icons-v2/MinimizeIcon.d.ts +13 -0
- package/dist/components/icons-v2/MinusIcon.d.ts +13 -0
- package/dist/components/icons-v2/MoreHorizontalIcon.d.ts +13 -0
- package/dist/components/icons-v2/MoreIcon.d.ts +13 -0
- package/dist/components/icons-v2/MouseIcon.d.ts +13 -0
- package/dist/components/icons-v2/MoveIcon.d.ts +13 -0
- package/dist/components/icons-v2/Multiplier05Icon.d.ts +13 -0
- package/dist/components/icons-v2/Multiplier10Icon.d.ts +13 -0
- package/dist/components/icons-v2/Multiplier15Icon.d.ts +13 -0
- package/dist/components/icons-v2/Multiplier20Icon.d.ts +13 -0
- package/dist/components/icons-v2/NoteIcon.d.ts +13 -0
- package/dist/components/icons-v2/NoteOffIcon.d.ts +13 -0
- package/dist/components/icons-v2/NotifyIcon.d.ts +13 -0
- package/dist/components/icons-v2/PackAIIcon.d.ts +13 -0
- package/dist/components/icons-v2/PackseeIcon.d.ts +1 -0
- package/dist/components/icons-v2/PaperclipIcon.d.ts +13 -0
- package/dist/components/icons-v2/PauseIcon.d.ts +13 -0
- package/dist/components/icons-v2/PdfIcon.d.ts +13 -0
- package/dist/components/icons-v2/PentoolIcon.d.ts +13 -0
- package/dist/components/icons-v2/PiechartIcon.d.ts +13 -0
- package/dist/components/icons-v2/PinIcon.d.ts +13 -0
- package/dist/components/icons-v2/PinskewedIcon.d.ts +13 -0
- package/dist/components/icons-v2/PlayIcon.d.ts +13 -0
- package/dist/components/icons-v2/PlusIcon.d.ts +12 -0
- package/dist/components/icons-v2/PredictiveETIcon.d.ts +13 -0
- package/dist/components/icons-v2/RectanglesAddIcon.d.ts +1 -0
- package/dist/components/icons-v2/RedoIcon.d.ts +13 -0
- package/dist/components/icons-v2/RefreshAlertIcon.d.ts +13 -0
- package/dist/components/icons-v2/RefreshIcon.d.ts +13 -0
- package/dist/components/icons-v2/ReplaceIcon.d.ts +13 -0
- package/dist/components/icons-v2/ReplyIcon.d.ts +13 -0
- package/dist/components/icons-v2/SaveIcon.d.ts +12 -0
- package/dist/components/icons-v2/ScalesIcon.d.ts +13 -0
- package/dist/components/icons-v2/SearchIcon.d.ts +13 -0
- package/dist/components/icons-v2/SendIcon.d.ts +13 -0
- package/dist/components/icons-v2/SettingsIcon.d.ts +13 -0
- package/dist/components/icons-v2/ShareIcon.d.ts +13 -0
- package/dist/components/icons-v2/ShelfAddIcon.d.ts +13 -0
- package/dist/components/icons-v2/ShelfIcon.d.ts +13 -0
- package/dist/components/icons-v2/ShelfInfoIcon.d.ts +13 -0
- package/dist/components/icons-v2/ShoppingIcon.d.ts +13 -0
- package/dist/components/icons-v2/SlideshowIcon.d.ts +13 -0
- package/dist/components/icons-v2/SocialFacebookIcon.d.ts +13 -0
- package/dist/components/icons-v2/SocialInstagramIcon.d.ts +13 -0
- package/dist/components/icons-v2/SocialSnapchatIcon.d.ts +13 -0
- package/dist/components/icons-v2/SocialTiktok2Icon.d.ts +13 -0
- package/dist/components/icons-v2/SocialTiktokIcon.d.ts +13 -0
- package/dist/components/icons-v2/SocialXIcon.d.ts +13 -0
- package/dist/components/icons-v2/SocialYoutubeIcon.d.ts +13 -0
- package/dist/components/icons-v2/SortHorizontalIcon.d.ts +13 -0
- package/dist/components/icons-v2/SquareAddIcon.d.ts +1 -0
- package/dist/components/icons-v2/StarIcon.d.ts +20 -0
- package/dist/components/icons-v2/StopIcon.d.ts +11 -0
- package/dist/components/icons-v2/SurveyIcon.d.ts +13 -0
- package/dist/components/icons-v2/TableExportIcon.d.ts +13 -0
- package/dist/components/icons-v2/TableIcon.d.ts +13 -0
- package/dist/components/icons-v2/TableOptionsIcon.d.ts +13 -0
- package/dist/components/icons-v2/TagIcon.d.ts +13 -0
- package/dist/components/icons-v2/TargetArrowIcon.d.ts +13 -0
- package/dist/components/icons-v2/TargetIcon.d.ts +13 -0
- package/dist/components/icons-v2/TextRecognitionIcon.d.ts +13 -0
- package/dist/components/icons-v2/TriangleFlagIcon.d.ts +13 -0
- package/dist/components/icons-v2/TrophyIcon.d.ts +13 -0
- package/dist/components/icons-v2/UnderlineIcon.d.ts +13 -0
- package/dist/components/icons-v2/UndoIcon.d.ts +13 -0
- package/dist/components/icons-v2/UnitBuyRateIcon.d.ts +13 -0
- package/dist/components/icons-v2/UploadIcon.d.ts +13 -0
- package/dist/components/icons-v2/UserGroupIcon.d.ts +13 -0
- package/dist/components/icons-v2/UserIcon.d.ts +13 -0
- package/dist/components/icons-v2/UsersIcon.d.ts +13 -0
- package/dist/components/icons-v2/ValueBuyRateIcon.d.ts +13 -0
- package/dist/components/icons-v2/VideoIcon.d.ts +13 -0
- package/dist/components/icons-v2/ViewOffIcon.d.ts +13 -0
- package/dist/components/icons-v2/ViewOnIcon.d.ts +13 -0
- package/dist/components/icons-v2/VolumeOffIcon.d.ts +13 -0
- package/dist/components/icons-v2/VolumeOnIcon.d.ts +13 -0
- package/dist/components/icons-v2/WebIcon.d.ts +13 -0
- package/dist/components/icons-v2/XIcon.d.ts +13 -0
- package/dist/components/icons-v2/ZipFileIcon.d.ts +13 -0
- package/dist/components/icons-v2/ZonePercentageIcon.d.ts +1 -0
- package/dist/components/icons-v2/ZoomInIcon.d.ts +1 -0
- package/dist/components/icons-v2/ZoomOutIcon.d.ts +1 -0
- package/dist/components/icons-v2/constants.d.ts +61 -0
- package/dist/components/icons-v2/createIcon.d.ts +45 -0
- package/dist/components/icons-v2/index.d.ts +210 -0
- package/dist/components/icons-v2/index.js +378 -374
- package/dist/components/index.d.ts +30 -0
- package/dist/hooks/useClickOutside.d.ts +2 -0
- package/dist/hooks/useEscapeKey.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +17 -4
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @callback ModalCloseHandler
|
|
3
|
+
* @returns {void}
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Responsive width tokens for the dialog.
|
|
7
|
+
*
|
|
8
|
+
* @typedef {object} ModalWidth
|
|
9
|
+
* @property {string} [default='880px']
|
|
10
|
+
* Width below 1536px. Default `'880px'`.
|
|
11
|
+
* @property {string} [largeScreen='960px']
|
|
12
|
+
* Width at 1536px and above. Default `'960px'`.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Responsive height tokens for `bodyLayout='fixed'`.
|
|
16
|
+
*
|
|
17
|
+
* @typedef {object} ModalHeight
|
|
18
|
+
* @property {string} [default='480px']
|
|
19
|
+
* Height below 1536px. Default `'480px'`.
|
|
20
|
+
* @property {string} [largeScreen='600px']
|
|
21
|
+
* Height at 1536px and above. Default `'600px'`.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {object} ModalProps
|
|
25
|
+
*
|
|
26
|
+
* @property {React.ReactNode} [children=null]
|
|
27
|
+
* Scrollable body content. Default `null`.
|
|
28
|
+
* @property {ModalCloseHandler} [onClose]
|
|
29
|
+
* Dismiss handler (Escape, backdrop, X). Omit to hide the close button.
|
|
30
|
+
* @property {boolean} [visible=false]
|
|
31
|
+
* When `false`, renders nothing. Default `false`.
|
|
32
|
+
* @property {string} [title='']
|
|
33
|
+
* Header heading. Default `''`.
|
|
34
|
+
* @property {React.ReactNode} [icon=null]
|
|
35
|
+
* Icon left of the title. Default `null`.
|
|
36
|
+
* @property {React.ReactNode} [description=null]
|
|
37
|
+
* Subtitle below the title. Default `null`.
|
|
38
|
+
* @property {React.ReactNode} [footer=null]
|
|
39
|
+
* Sticky footer content (e.g. action buttons). Default `null`.
|
|
40
|
+
* @property {ModalWidth} [modalWidth]
|
|
41
|
+
* Dialog width tokens. Default `{ default: '880px', largeScreen: '960px' }`.
|
|
42
|
+
* @property {'scroll'|'fixed'} [bodyLayout='scroll']
|
|
43
|
+
* `scroll` — whole body scrolls; `fixed` — fixed height with independent footer.
|
|
44
|
+
* Default `'scroll'`.
|
|
45
|
+
* @property {ModalHeight} [modalHeight]
|
|
46
|
+
* Height tokens for `bodyLayout='fixed'`.
|
|
47
|
+
* Default `{ default: '480px', largeScreen: '600px' }`.
|
|
48
|
+
* @property {React.ReactNode} [loadingFallback]
|
|
49
|
+
* `<Suspense>` fallback. Default `<LoadingIcon iconSize="xl" />`.
|
|
50
|
+
* @property {Element} [portalContainer]
|
|
51
|
+
* Portal host. Default `#modal` element or `document.body`.
|
|
52
|
+
*
|
|
53
|
+
* @see {@link Button}
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Dialog overlay in a portal. Closes on Escape, backdrop click, or X button.
|
|
57
|
+
*
|
|
58
|
+
* ## Props
|
|
59
|
+
*
|
|
60
|
+
* **children** `ReactNode` — default `null`
|
|
61
|
+
* Scrollable body content.
|
|
62
|
+
*
|
|
63
|
+
* **onClose** `() => void` — no default
|
|
64
|
+
* Dismiss handler. Omit to hide the close button.
|
|
65
|
+
*
|
|
66
|
+
* **visible** `boolean` — default `false`
|
|
67
|
+
* When `false`, renders nothing.
|
|
68
|
+
*
|
|
69
|
+
* **title** `string` — default `''`
|
|
70
|
+
* Header heading.
|
|
71
|
+
*
|
|
72
|
+
* **icon** `ReactNode` — default `null`
|
|
73
|
+
* Icon left of the title.
|
|
74
|
+
*
|
|
75
|
+
* **description** `ReactNode` — default `null`
|
|
76
|
+
* Subtitle below the title.
|
|
77
|
+
*
|
|
78
|
+
* **footer** `ReactNode` — default `null`
|
|
79
|
+
* Sticky footer content (e.g. action buttons).
|
|
80
|
+
*
|
|
81
|
+
* **modalWidth** `ModalWidth` — default `{ default: '880px', largeScreen: '960px' }`
|
|
82
|
+
* Dialog width tokens.
|
|
83
|
+
* - `default` `string` — default `'880px'`
|
|
84
|
+
* - `largeScreen` `string` — default `'960px'`
|
|
85
|
+
*
|
|
86
|
+
* **bodyLayout** `'scroll' | 'fixed'` — default `'scroll'`
|
|
87
|
+
* `scroll` — whole body scrolls; `fixed` — fixed height with independent footer.
|
|
88
|
+
*
|
|
89
|
+
* **modalHeight** `ModalHeight` — default `{ default: '480px', largeScreen: '600px' }`
|
|
90
|
+
* Height tokens for `bodyLayout='fixed'`.
|
|
91
|
+
* - `default` `string` — default `'480px'`
|
|
92
|
+
* - `largeScreen` `string` — default `'600px'`
|
|
93
|
+
*
|
|
94
|
+
* **loadingFallback** `ReactNode` — default `<LoadingIcon iconSize="xl" />`
|
|
95
|
+
* `<Suspense>` fallback.
|
|
96
|
+
*
|
|
97
|
+
* **portalContainer** `Element` — default `#modal` or `document.body`
|
|
98
|
+
* Portal host.
|
|
99
|
+
*
|
|
100
|
+
* @param {ModalProps} props
|
|
101
|
+
* @returns {import('react').ReactElement|null}
|
|
102
|
+
*
|
|
103
|
+
* @example <caption>Default</caption>
|
|
104
|
+
* import { useState } from 'react';
|
|
105
|
+
* import { Button, Modal } from '@eyesee/ui-components';
|
|
106
|
+
*
|
|
107
|
+
* const [visible, setVisible] = useState(false);
|
|
108
|
+
*
|
|
109
|
+
* <>
|
|
110
|
+
* <Button text="Open modal" onClick={() => setVisible(true)} />
|
|
111
|
+
* <Modal
|
|
112
|
+
* visible={visible}
|
|
113
|
+
* onClose={() => setVisible(false)}
|
|
114
|
+
* title="Modal title"
|
|
115
|
+
* description="Optional supporting description."
|
|
116
|
+
* footer={
|
|
117
|
+
* <>
|
|
118
|
+
* <Button text="Cancel" variant="neutral" type="outline" onClick={() => setVisible(false)} />
|
|
119
|
+
* <Button text="Confirm" onClick={() => setVisible(false)} />
|
|
120
|
+
* </>
|
|
121
|
+
* }
|
|
122
|
+
* >
|
|
123
|
+
* <p>Modal content renders in a portal and inherits the selected application profile.</p>
|
|
124
|
+
* </Modal>
|
|
125
|
+
* </>
|
|
126
|
+
*
|
|
127
|
+
* @example <caption>Custom width</caption>
|
|
128
|
+
* import { useState } from 'react';
|
|
129
|
+
* import { Button, Modal } from '@eyesee/ui-components';
|
|
130
|
+
*
|
|
131
|
+
* const [visible, setVisible] = useState(false);
|
|
132
|
+
*
|
|
133
|
+
* <Modal
|
|
134
|
+
* visible={visible}
|
|
135
|
+
* onClose={() => setVisible(false)}
|
|
136
|
+
* title="Modal title"
|
|
137
|
+
* modalWidth={{ default: '560px', largeScreen: '640px' }}
|
|
138
|
+
* />
|
|
139
|
+
*
|
|
140
|
+
* @example <caption>Fixed body layout</caption>
|
|
141
|
+
* import { useState } from 'react';
|
|
142
|
+
* import { Button, Modal } from '@eyesee/ui-components';
|
|
143
|
+
*
|
|
144
|
+
* const [visible, setVisible] = useState(false);
|
|
145
|
+
*
|
|
146
|
+
* <Modal
|
|
147
|
+
* visible={visible}
|
|
148
|
+
* onClose={() => setVisible(false)}
|
|
149
|
+
* title="Create shelf"
|
|
150
|
+
* description="Fixed body with static input, two-column block, and scrollable list."
|
|
151
|
+
* bodyLayout="fixed"
|
|
152
|
+
* modalWidth={{ default: '640px', largeScreen: '720px' }}
|
|
153
|
+
* modalHeight={{ default: '400px', largeScreen: '520px' }}
|
|
154
|
+
* footer={<Button text="Confirm" onClick={() => setVisible(false)} />}
|
|
155
|
+
* >
|
|
156
|
+
* <p>Body content with fixed layout sections.</p>
|
|
157
|
+
* </Modal>
|
|
158
|
+
*/
|
|
159
|
+
export function Modal({ children, onClose, visible, title, icon, description, footer, modalWidth, bodyLayout, modalHeight, loadingFallback, portalContainer, }: ModalProps): import("react").ReactElement | null;
|
|
160
|
+
export type ModalCloseHandler = () => void;
|
|
161
|
+
/**
|
|
162
|
+
* Responsive width tokens for the dialog.
|
|
163
|
+
*/
|
|
164
|
+
export type ModalWidth = {
|
|
165
|
+
/**
|
|
166
|
+
* Width below 1536px. Default `'880px'`.
|
|
167
|
+
*/
|
|
168
|
+
default?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Width at 1536px and above. Default `'960px'`.
|
|
171
|
+
*/
|
|
172
|
+
largeScreen?: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Responsive height tokens for `bodyLayout='fixed'`.
|
|
176
|
+
*/
|
|
177
|
+
export type ModalHeight = {
|
|
178
|
+
/**
|
|
179
|
+
* Height below 1536px. Default `'480px'`.
|
|
180
|
+
*/
|
|
181
|
+
default?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Height at 1536px and above. Default `'600px'`.
|
|
184
|
+
*/
|
|
185
|
+
largeScreen?: string;
|
|
186
|
+
};
|
|
187
|
+
export type ModalProps = {
|
|
188
|
+
/**
|
|
189
|
+
* Scrollable body content. Default `null`.
|
|
190
|
+
*/
|
|
191
|
+
children?: React.ReactNode;
|
|
192
|
+
/**
|
|
193
|
+
* Dismiss handler (Escape, backdrop, X). Omit to hide the close button.
|
|
194
|
+
*/
|
|
195
|
+
onClose?: ModalCloseHandler;
|
|
196
|
+
/**
|
|
197
|
+
* When `false`, renders nothing. Default `false`.
|
|
198
|
+
*/
|
|
199
|
+
visible?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Header heading. Default `''`.
|
|
202
|
+
*/
|
|
203
|
+
title?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Icon left of the title. Default `null`.
|
|
206
|
+
*/
|
|
207
|
+
icon?: React.ReactNode;
|
|
208
|
+
/**
|
|
209
|
+
* Subtitle below the title. Default `null`.
|
|
210
|
+
*/
|
|
211
|
+
description?: React.ReactNode;
|
|
212
|
+
/**
|
|
213
|
+
* Sticky footer content (e.g. action buttons). Default `null`.
|
|
214
|
+
*/
|
|
215
|
+
footer?: React.ReactNode;
|
|
216
|
+
/**
|
|
217
|
+
* Dialog width tokens. Default `{ default: '880px', largeScreen: '960px' }`.
|
|
218
|
+
*/
|
|
219
|
+
modalWidth?: ModalWidth;
|
|
220
|
+
/**
|
|
221
|
+
* `scroll` — whole body scrolls; `fixed` — fixed height with independent footer.
|
|
222
|
+
* Default `'scroll'`.
|
|
223
|
+
*/
|
|
224
|
+
bodyLayout?: "scroll" | "fixed";
|
|
225
|
+
/**
|
|
226
|
+
* Height tokens for `bodyLayout='fixed'`.
|
|
227
|
+
* Default `{ default: '480px', largeScreen: '600px' }`.
|
|
228
|
+
*/
|
|
229
|
+
modalHeight?: ModalHeight;
|
|
230
|
+
/**
|
|
231
|
+
* `<Suspense>` fallback. Default `<LoadingIcon iconSize="xl" />`.
|
|
232
|
+
*/
|
|
233
|
+
loadingFallback?: React.ReactNode;
|
|
234
|
+
/**
|
|
235
|
+
* Portal host. Default `#modal` element or `document.body`.
|
|
236
|
+
*/
|
|
237
|
+
portalContainer?: Element;
|
|
238
|
+
};
|
|
239
|
+
import React from 'react';
|
|
@@ -16,7 +16,8 @@ const o = {
|
|
|
16
16
|
}, $ = {
|
|
17
17
|
scroll: e.content,
|
|
18
18
|
fixed: `${e.content} ${e.contentFixed}`
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
function z({
|
|
20
21
|
children: s = null,
|
|
21
22
|
onClose: t,
|
|
22
23
|
visible: m = !1,
|
|
@@ -30,7 +31,7 @@ const o = {
|
|
|
30
31
|
modalHeight: p = d,
|
|
31
32
|
loadingFallback: x = /* @__PURE__ */ l(H, { iconSize: "xl" }),
|
|
32
33
|
portalContainer: g
|
|
33
|
-
})
|
|
34
|
+
}) {
|
|
34
35
|
const { default: S, largeScreen: D } = {
|
|
35
36
|
...o,
|
|
36
37
|
...h
|
|
@@ -77,7 +78,7 @@ const o = {
|
|
|
77
78
|
] }),
|
|
78
79
|
g ?? document.getElementById("modal") ?? document.body
|
|
79
80
|
) : null;
|
|
80
|
-
}
|
|
81
|
+
}
|
|
81
82
|
export {
|
|
82
83
|
z as Modal
|
|
83
84
|
};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @callback NotificationsCloseHandler
|
|
3
|
+
* @returns {void}
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @callback NotificationsDismissHandler
|
|
7
|
+
* @returns {void}
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @callback NotificationsConfirmHandler
|
|
11
|
+
* @returns {void}
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* All props are optional.
|
|
15
|
+
*
|
|
16
|
+
* @typedef {object} NotificationsProps
|
|
17
|
+
*
|
|
18
|
+
* @property {string} [title='Notification title']
|
|
19
|
+
* Heading. Default `'Notification title'`.
|
|
20
|
+
* @property {string} [text='Notification text goes here and it should be kept short and simple whenever possible.']
|
|
21
|
+
* Body copy.
|
|
22
|
+
* @property {'neutral'|'error'|'success'|'primary'|'warning'} [status='neutral']
|
|
23
|
+
* Stripe and icon colour tokens. Default `'neutral'`.
|
|
24
|
+
* @property {boolean} [showStripe=false]
|
|
25
|
+
* Left status stripe. Default `false`.
|
|
26
|
+
* @property {boolean} [showIcon=true]
|
|
27
|
+
* Leading icon (or `icon` when set). Default `true`.
|
|
28
|
+
* @property {React.ReactNode} [icon]
|
|
29
|
+
* Custom leading icon. Falls back to `HelpIcon`.
|
|
30
|
+
* @property {NotificationsCloseHandler|null} [onClose=null]
|
|
31
|
+
* Close button handler. Omit to hide when `closeButton` is `false`. Default `null`.
|
|
32
|
+
* @property {string} [closeAriaLabel='Close notification']
|
|
33
|
+
* Close button `aria-label`. Default `'Close notification'`.
|
|
34
|
+
* @property {boolean} [closeButton=true]
|
|
35
|
+
* Show close control when `onClose` is set. Default `true`.
|
|
36
|
+
* @property {NotificationsDismissHandler|null} [onDismiss=null]
|
|
37
|
+
* Left action. Renders a {@link Button} when set. Default `null`.
|
|
38
|
+
* @property {string} [dismissLabel='Cancel']
|
|
39
|
+
* Dismiss button label. Default `'Cancel'`.
|
|
40
|
+
* @property {React.ReactNode} [dismissIcon]
|
|
41
|
+
* Dismiss button icon. Default `XIcon`.
|
|
42
|
+
* @property {NotificationsConfirmHandler|null} [onConfirm=null]
|
|
43
|
+
* Right action. Renders a {@link Button} when set. Default `null`.
|
|
44
|
+
* @property {string} [confirmLabel='Save']
|
|
45
|
+
* Confirm button label. Default `'Save'`.
|
|
46
|
+
* @property {React.ReactNode} [confirmIcon]
|
|
47
|
+
* Confirm button icon. Default `SaveIcon`.
|
|
48
|
+
* @property {number|null} [progress=null]
|
|
49
|
+
* Progress value. Non-`null` shows {@link ProgressBar}. Default `null`.
|
|
50
|
+
* @property {number|null} [maxProgress=null]
|
|
51
|
+
* Progress max. Shown in the label when both are numbers. Default `null`.
|
|
52
|
+
* @property {string} [progressLabel='In progress...']
|
|
53
|
+
* Progress row label. Default `'In progress...'`.
|
|
54
|
+
* @property {string} [className]
|
|
55
|
+
* Extra class on the root.
|
|
56
|
+
*
|
|
57
|
+
* @see {@link Button}
|
|
58
|
+
* @see {@link ProgressBar}
|
|
59
|
+
* @see {@link useNotifications}
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* Notification card with optional stripe, actions, and progress.
|
|
63
|
+
*
|
|
64
|
+
* ## Props
|
|
65
|
+
*
|
|
66
|
+
* All optional.
|
|
67
|
+
*
|
|
68
|
+
* **title** `string` — default `'Notification title'`
|
|
69
|
+
* Heading.
|
|
70
|
+
*
|
|
71
|
+
* **text** `string` — default `'Notification text goes here and it should be kept short and simple whenever possible.'`
|
|
72
|
+
* Body copy.
|
|
73
|
+
*
|
|
74
|
+
* **status** `'neutral' | 'error' | 'success' | 'primary' | 'warning'` — default `'neutral'`
|
|
75
|
+
* Stripe and icon colour tokens.
|
|
76
|
+
*
|
|
77
|
+
* **showStripe** `boolean` — default `false`
|
|
78
|
+
* Left status stripe.
|
|
79
|
+
*
|
|
80
|
+
* **showIcon** `boolean` — default `true`
|
|
81
|
+
* Leading icon (or `icon` when set).
|
|
82
|
+
*
|
|
83
|
+
* **icon** `ReactNode` — no default
|
|
84
|
+
* Custom leading icon. Falls back to `HelpIcon`.
|
|
85
|
+
*
|
|
86
|
+
* **onClose** `() => void | null` — default `null`
|
|
87
|
+
* Close button handler.
|
|
88
|
+
*
|
|
89
|
+
* **closeAriaLabel** `string` — default `'Close notification'`
|
|
90
|
+
* Close button `aria-label`.
|
|
91
|
+
*
|
|
92
|
+
* **closeButton** `boolean` — default `true`
|
|
93
|
+
* Show close control when `onClose` is set.
|
|
94
|
+
*
|
|
95
|
+
* **onDismiss** `() => void | null` — default `null`
|
|
96
|
+
* Left action. Renders a {@link Button} when set.
|
|
97
|
+
*
|
|
98
|
+
* **dismissLabel** `string` — default `'Cancel'`
|
|
99
|
+
* Dismiss button label.
|
|
100
|
+
*
|
|
101
|
+
* **dismissIcon** `ReactNode` — default `XIcon`
|
|
102
|
+
* Dismiss button icon.
|
|
103
|
+
*
|
|
104
|
+
* **onConfirm** `() => void | null` — default `null`
|
|
105
|
+
* Right action. Renders a {@link Button} when set.
|
|
106
|
+
*
|
|
107
|
+
* **confirmLabel** `string` — default `'Save'`
|
|
108
|
+
* Confirm button label.
|
|
109
|
+
*
|
|
110
|
+
* **confirmIcon** `ReactNode` — default `SaveIcon`
|
|
111
|
+
* Confirm button icon.
|
|
112
|
+
*
|
|
113
|
+
* **progress** `number | null` — default `null`
|
|
114
|
+
* Progress value. Non-`null` shows {@link ProgressBar}.
|
|
115
|
+
*
|
|
116
|
+
* **maxProgress** `number | null` — default `null`
|
|
117
|
+
* Progress max. Shown in the label when both are numbers.
|
|
118
|
+
*
|
|
119
|
+
* **progressLabel** `string` — default `'In progress...'`
|
|
120
|
+
* Progress row label.
|
|
121
|
+
*
|
|
122
|
+
* **className** `string` — no default
|
|
123
|
+
* Extra class on the root.
|
|
124
|
+
*
|
|
125
|
+
* @param {NotificationsProps} props
|
|
126
|
+
* @returns {import('react').ReactElement}
|
|
127
|
+
*
|
|
128
|
+
* @example <caption>Default</caption>
|
|
129
|
+
* import { Notifications } from '@eyesee/ui-components';
|
|
130
|
+
*
|
|
131
|
+
* <Notifications
|
|
132
|
+
* title="Notification title"
|
|
133
|
+
* text="Notification text goes here and it should be kept short and simple whenever possible."
|
|
134
|
+
* status="neutral"
|
|
135
|
+
* showIcon
|
|
136
|
+
* onClose={() => {}}
|
|
137
|
+
* />
|
|
138
|
+
*
|
|
139
|
+
* @example <caption>All Figma variants</caption>
|
|
140
|
+
* import { Notifications } from '@eyesee/ui-components';
|
|
141
|
+
*
|
|
142
|
+
* <Notifications
|
|
143
|
+
* title="Notification title"
|
|
144
|
+
* text="Notification text goes here and it should be kept short and simple whenever possible."
|
|
145
|
+
* status="neutral"
|
|
146
|
+
* showIcon
|
|
147
|
+
* onClose={() => {}}
|
|
148
|
+
* />
|
|
149
|
+
* <Notifications
|
|
150
|
+
* title="Notification title"
|
|
151
|
+
* text="Notification text goes here and it should be kept short and simple whenever possible."
|
|
152
|
+
* status="error"
|
|
153
|
+
* showStripe
|
|
154
|
+
* showIcon
|
|
155
|
+
* onClose={() => {}}
|
|
156
|
+
* />
|
|
157
|
+
* <Notifications
|
|
158
|
+
* title="Notification title"
|
|
159
|
+
* text="Notification text goes here and it should be kept short and simple whenever possible."
|
|
160
|
+
* status="neutral"
|
|
161
|
+
* showIcon
|
|
162
|
+
* onClose={() => {}}
|
|
163
|
+
* onDismiss={() => {}}
|
|
164
|
+
* dismissLabel="Cancel"
|
|
165
|
+
* onConfirm={() => {}}
|
|
166
|
+
* confirmLabel="Save"
|
|
167
|
+
* />
|
|
168
|
+
* <Notifications
|
|
169
|
+
* title="Notification title"
|
|
170
|
+
* text="Notification text goes here and it should be kept short and simple whenever possible."
|
|
171
|
+
* status="neutral"
|
|
172
|
+
* showIcon
|
|
173
|
+
* onClose={() => {}}
|
|
174
|
+
* progress={25}
|
|
175
|
+
* />
|
|
176
|
+
*/
|
|
177
|
+
export function Notifications({ title, text, status, showStripe, showIcon, icon, onClose, closeAriaLabel, onDismiss, dismissLabel, dismissIcon, onConfirm, confirmLabel, confirmIcon, progress, maxProgress, progressLabel, closeButton, className, }: NotificationsProps): import("react").ReactElement;
|
|
178
|
+
export type NotificationsCloseHandler = () => void;
|
|
179
|
+
export type NotificationsDismissHandler = () => void;
|
|
180
|
+
export type NotificationsConfirmHandler = () => void;
|
|
181
|
+
/**
|
|
182
|
+
* All props are optional.
|
|
183
|
+
*/
|
|
184
|
+
export type NotificationsProps = {
|
|
185
|
+
/**
|
|
186
|
+
* Heading. Default `'Notification title'`.
|
|
187
|
+
*/
|
|
188
|
+
title?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Body copy.
|
|
191
|
+
*/
|
|
192
|
+
text?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Stripe and icon colour tokens. Default `'neutral'`.
|
|
195
|
+
*/
|
|
196
|
+
status?: "neutral" | "error" | "success" | "primary" | "warning";
|
|
197
|
+
/**
|
|
198
|
+
* Left status stripe. Default `false`.
|
|
199
|
+
*/
|
|
200
|
+
showStripe?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Leading icon (or `icon` when set). Default `true`.
|
|
203
|
+
*/
|
|
204
|
+
showIcon?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Custom leading icon. Falls back to `HelpIcon`.
|
|
207
|
+
*/
|
|
208
|
+
icon?: React.ReactNode;
|
|
209
|
+
/**
|
|
210
|
+
* Close button handler. Omit to hide when `closeButton` is `false`. Default `null`.
|
|
211
|
+
*/
|
|
212
|
+
onClose?: NotificationsCloseHandler | null;
|
|
213
|
+
/**
|
|
214
|
+
* Close button `aria-label`. Default `'Close notification'`.
|
|
215
|
+
*/
|
|
216
|
+
closeAriaLabel?: string;
|
|
217
|
+
/**
|
|
218
|
+
* Show close control when `onClose` is set. Default `true`.
|
|
219
|
+
*/
|
|
220
|
+
closeButton?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Left action. Renders a {@link Button} when set. Default `null`.
|
|
223
|
+
*/
|
|
224
|
+
onDismiss?: NotificationsDismissHandler | null;
|
|
225
|
+
/**
|
|
226
|
+
* Dismiss button label. Default `'Cancel'`.
|
|
227
|
+
*/
|
|
228
|
+
dismissLabel?: string;
|
|
229
|
+
/**
|
|
230
|
+
* Dismiss button icon. Default `XIcon`.
|
|
231
|
+
*/
|
|
232
|
+
dismissIcon?: React.ReactNode;
|
|
233
|
+
/**
|
|
234
|
+
* Right action. Renders a {@link Button} when set. Default `null`.
|
|
235
|
+
*/
|
|
236
|
+
onConfirm?: NotificationsConfirmHandler | null;
|
|
237
|
+
/**
|
|
238
|
+
* Confirm button label. Default `'Save'`.
|
|
239
|
+
*/
|
|
240
|
+
confirmLabel?: string;
|
|
241
|
+
/**
|
|
242
|
+
* Confirm button icon. Default `SaveIcon`.
|
|
243
|
+
*/
|
|
244
|
+
confirmIcon?: React.ReactNode;
|
|
245
|
+
/**
|
|
246
|
+
* Progress value. Non-`null` shows {@link ProgressBar}. Default `null`.
|
|
247
|
+
*/
|
|
248
|
+
progress?: number | null;
|
|
249
|
+
/**
|
|
250
|
+
* Progress max. Shown in the label when both are numbers. Default `null`.
|
|
251
|
+
*/
|
|
252
|
+
maxProgress?: number | null;
|
|
253
|
+
/**
|
|
254
|
+
* Progress row label. Default `'In progress...'`.
|
|
255
|
+
*/
|
|
256
|
+
progressLabel?: string;
|
|
257
|
+
/**
|
|
258
|
+
* Extra class on the root.
|
|
259
|
+
*/
|
|
260
|
+
className?: string;
|
|
261
|
+
};
|
|
@@ -27,7 +27,8 @@ const K = ["neutral", "error", "success", "primary", "warning"], y = {
|
|
|
27
27
|
stripeColor: "var(--color--border--warning--default)",
|
|
28
28
|
iconColor: "var(--color--border--warning--default)"
|
|
29
29
|
}
|
|
30
|
-
}, b = (l) => K.includes(l) ? l : "neutral", R = (l) => y[b(l)] || y.neutral
|
|
30
|
+
}, b = (l) => K.includes(l) ? l : "neutral", R = (l) => y[b(l)] || y.neutral;
|
|
31
|
+
function Q({
|
|
31
32
|
title: l = "Notification title",
|
|
32
33
|
text: h = "Notification text goes here and it should be kept short and simple whenever possible.",
|
|
33
34
|
status: N = "neutral",
|
|
@@ -47,7 +48,7 @@ const K = ["neutral", "error", "success", "primary", "warning"], y = {
|
|
|
47
48
|
progressLabel: s = "In progress...",
|
|
48
49
|
closeButton: B = !0,
|
|
49
50
|
className: O
|
|
50
|
-
})
|
|
51
|
+
}) {
|
|
51
52
|
const $ = b(N), { stripeColor: u, iconColor: j } = R($), f = typeof c == "function", p = typeof a == "function", z = f || p, d = t !== null, m = k && (I || /* @__PURE__ */ o(H, { strokeColor: "currentColor", fill: "none" })), E = typeof t == "number" && typeof e == "number" ? `${s} ${t}/${e ?? ""}` : s;
|
|
52
53
|
return /* @__PURE__ */ n(
|
|
53
54
|
"div",
|
|
@@ -113,7 +114,7 @@ const K = ["neutral", "error", "success", "primary", "warning"], y = {
|
|
|
113
114
|
]
|
|
114
115
|
}
|
|
115
116
|
);
|
|
116
|
-
}
|
|
117
|
+
}
|
|
117
118
|
export {
|
|
118
119
|
Q as Notifications
|
|
119
120
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shows {@link Notifications} as react-toastify toasts. Mount `ToastContainer` in the app root.
|
|
3
|
+
*
|
|
4
|
+
* `notify(key, payload)` updates an existing toast with the same key. `dismiss` accepts the
|
|
5
|
+
* key or the returned toast id.
|
|
6
|
+
*
|
|
7
|
+
* @returns {UseNotificationsReturn}
|
|
8
|
+
*
|
|
9
|
+
* @example <caption>Keyed progress toast</caption>
|
|
10
|
+
* import { ToastContainer } from 'react-toastify';
|
|
11
|
+
* import { useNotifications } from '@eyesee/ui-components';
|
|
12
|
+
*
|
|
13
|
+
* const { notify, dismiss } = useNotifications();
|
|
14
|
+
*
|
|
15
|
+
* notify('upload', {
|
|
16
|
+
* title: 'Uploading report',
|
|
17
|
+
* text: 'Preparing and uploading your file.',
|
|
18
|
+
* status: 'neutral',
|
|
19
|
+
* showStripe: true,
|
|
20
|
+
* progress: 0,
|
|
21
|
+
* progressLabel: 'Uploading... 0%',
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* <ToastContainer position="bottom-right" closeButton={false} />
|
|
25
|
+
*
|
|
26
|
+
* @example <caption>One-off toast</caption>
|
|
27
|
+
* import { ToastContainer } from 'react-toastify';
|
|
28
|
+
* import { useNotifications } from '@eyesee/ui-components';
|
|
29
|
+
*
|
|
30
|
+
* const { notify } = useNotifications();
|
|
31
|
+
*
|
|
32
|
+
* notify({
|
|
33
|
+
* title: 'Saved',
|
|
34
|
+
* text: 'Your changes were saved.',
|
|
35
|
+
* status: 'success',
|
|
36
|
+
* showStripe: true,
|
|
37
|
+
* }, { autoClose: 3000 });
|
|
38
|
+
*/
|
|
39
|
+
export function useNotifications(): UseNotificationsReturn;
|
|
40
|
+
export type NotificationPayload = Omit<import("./Notifications").NotificationsProps, "onClose"> & {
|
|
41
|
+
key?: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* react-toastify options merged with library defaults.
|
|
45
|
+
*/
|
|
46
|
+
export type NotificationToastOptions = import("react-toastify").ToastOptions;
|
|
47
|
+
export type UseNotificationsReturn = {
|
|
48
|
+
/**
|
|
49
|
+
* Show or update a toast.
|
|
50
|
+
*/
|
|
51
|
+
notify: UseNotificationsNotify;
|
|
52
|
+
/**
|
|
53
|
+
* Dismiss by key or toast id.
|
|
54
|
+
*/
|
|
55
|
+
dismiss: UseNotificationsDismiss;
|
|
56
|
+
};
|
|
57
|
+
export type UseNotificationsDismiss = (keyOrToastId: string | number) => void;
|
|
58
|
+
export type UseNotificationsNotify = (key: string, payload?: NotificationPayload, options?: NotificationToastOptions) => import("react-toastify").Id;
|
|
59
|
+
export type UseNotificationsNotifyPayload = (payload?: NotificationPayload, options?: NotificationToastOptions) => import("react-toastify").Id;
|
|
@@ -66,7 +66,8 @@ const g = {
|
|
|
66
66
|
onClose: (...o) => {
|
|
67
67
|
typeof t.onClose == "function" && t.onClose(...o), typeof i == "function" && i(...o);
|
|
68
68
|
}
|
|
69
|
-
})
|
|
69
|
+
});
|
|
70
|
+
function S() {
|
|
70
71
|
const s = L(/* @__PURE__ */ new Map()), t = b((o) => {
|
|
71
72
|
if (!o)
|
|
72
73
|
return;
|
|
@@ -97,7 +98,7 @@ const g = {
|
|
|
97
98
|
},
|
|
98
99
|
[t]
|
|
99
100
|
), dismiss: t };
|
|
100
|
-
}
|
|
101
|
+
}
|
|
101
102
|
export {
|
|
102
103
|
S as useNotifications
|
|
103
104
|
};
|