@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,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @callback ListItemClickHandler
|
|
3
|
+
* @returns {void}
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @callback ListItemTrailingIconClickHandler
|
|
7
|
+
* @param {any} item Row `item` object.
|
|
8
|
+
* @returns {void}
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Trailing action icon slot.
|
|
12
|
+
*
|
|
13
|
+
* @typedef {object} ListItemIcon
|
|
14
|
+
* @property {string} type - Unique React key (`icon-${type}`).
|
|
15
|
+
* @property {React.ReactNode} icon - Icon element.
|
|
16
|
+
* @property {ListItemTrailingIconClickHandler} [onClick]
|
|
17
|
+
* Fired with the row `item`. Propagation stopped so the row `onClick` does not run.
|
|
18
|
+
* @property {'always'|'hover'} [trailingDisplay]
|
|
19
|
+
* Overrides row `trailingDisplay` for this icon.
|
|
20
|
+
* @property {'always'|'hover'} [trailingDisplayOnSelectedItem='always']
|
|
21
|
+
* Visibility when the row is `active`. Default `'always'`.
|
|
22
|
+
* @property {boolean} [disabled=false]
|
|
23
|
+
* Skips `onClick` and hover styles for this slot only. Default `false`.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* All props are optional.
|
|
27
|
+
*
|
|
28
|
+
* @typedef {object} ListItemProps
|
|
29
|
+
*
|
|
30
|
+
* @property {any} [item=null]
|
|
31
|
+
* Raw data object. Passed to each trailing icon `onClick`. Default `null`.
|
|
32
|
+
* @property {React.ReactNode} [controlItem=null]
|
|
33
|
+
* Leading control slot (e.g. {@link Checkbox}). Default `null`.
|
|
34
|
+
* @property {React.ReactNode} [customItem=null]
|
|
35
|
+
* Secondary leading slot (e.g. {@link Avatar}, {@link Pill}). Default `null`.
|
|
36
|
+
* @property {string} [title=null]
|
|
37
|
+
* Primary label. Truncated via {@link EllipsisTooltip}. Default `null`.
|
|
38
|
+
* @property {string} [description=null]
|
|
39
|
+
* Secondary label below `title`. Default `null`.
|
|
40
|
+
* @property {ListItemIcon[]} [trailing=[]]
|
|
41
|
+
* Trailing action icons. Default `[]`.
|
|
42
|
+
* @property {'always'|'hover'} [trailingDisplay='hover']
|
|
43
|
+
* Row-level trailing icon visibility. Default `'hover'`.
|
|
44
|
+
* @property {boolean} [active=false]
|
|
45
|
+
* Selected row (`data-active`). Default `false`.
|
|
46
|
+
* @property {ListItemClickHandler} [onClick]
|
|
47
|
+
* Row click. Suppressed when `disabled`.
|
|
48
|
+
* @property {'none'|'xs'|'sm'|'md'|'lg'} [verticalSpacing='xs']
|
|
49
|
+
* Vertical padding. `'none'` → `0`. Default `'xs'`.
|
|
50
|
+
* @property {'none'|'xs'|'sm'|'md'|'lg'} [horizontalSpacing='xs']
|
|
51
|
+
* Horizontal padding. `'none'` → `0`. Default `'xs'`.
|
|
52
|
+
* @property {'fill'|'outline'} [variant='fill']
|
|
53
|
+
* Row background style. Default `'fill'`.
|
|
54
|
+
* @property {boolean} [disabled=false]
|
|
55
|
+
* Suppresses row and trailing clicks. Default `false`.
|
|
56
|
+
* @property {string} [role]
|
|
57
|
+
* ARIA role on the root. Use `'menuitem'` inside {@link Button} dropdowns.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link EllipsisTooltip}
|
|
60
|
+
* @see {@link useListItems}
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* Presentational list row. Selection logic lives in the parent or {@link useListItems}.
|
|
64
|
+
*
|
|
65
|
+
* ## Props
|
|
66
|
+
*
|
|
67
|
+
* All optional.
|
|
68
|
+
*
|
|
69
|
+
* **item** `any` — default `null`
|
|
70
|
+
* Raw data object. Passed to each trailing icon `onClick`.
|
|
71
|
+
*
|
|
72
|
+
* **controlItem** `ReactNode` — default `null`
|
|
73
|
+
* Leading control slot (e.g. {@link Checkbox}).
|
|
74
|
+
*
|
|
75
|
+
* **customItem** `ReactNode` — default `null`
|
|
76
|
+
* Secondary leading slot (e.g. {@link Avatar}, {@link Pill}).
|
|
77
|
+
*
|
|
78
|
+
* **title** `string` — default `null`
|
|
79
|
+
* Primary label. Truncated via {@link EllipsisTooltip}.
|
|
80
|
+
*
|
|
81
|
+
* **description** `string` — default `null`
|
|
82
|
+
* Secondary label below `title`.
|
|
83
|
+
*
|
|
84
|
+
* **trailing** `ListItemIcon[]` — default `[]`
|
|
85
|
+
* Trailing action icons.
|
|
86
|
+
* - `type` `string` — required. Unique React key.
|
|
87
|
+
* - `icon` `ReactNode` — required. Icon element.
|
|
88
|
+
* - `onClick` `(item) => void` — optional. Receives row `item`.
|
|
89
|
+
* - `trailingDisplay` `'always' | 'hover'` — optional. Overrides row default.
|
|
90
|
+
* - `trailingDisplayOnSelectedItem` `'always' | 'hover'` — default `'always'`.
|
|
91
|
+
* - `disabled` `boolean` — default `false`.
|
|
92
|
+
*
|
|
93
|
+
* **trailingDisplay** `'always' | 'hover'` — default `'hover'`
|
|
94
|
+
* Row-level trailing icon visibility.
|
|
95
|
+
*
|
|
96
|
+
* **active** `boolean` — default `false`
|
|
97
|
+
* Selected row (`data-active`).
|
|
98
|
+
*
|
|
99
|
+
* **onClick** `() => void` — no default
|
|
100
|
+
* Row click. Suppressed when `disabled`.
|
|
101
|
+
*
|
|
102
|
+
* **verticalSpacing** `'none' | 'xs' | 'sm' | 'md' | 'lg'` — default `'xs'`
|
|
103
|
+
* Vertical padding. `'none'` collapses to `0`.
|
|
104
|
+
*
|
|
105
|
+
* **horizontalSpacing** `'none' | 'xs' | 'sm' | 'md' | 'lg'` — default `'xs'`
|
|
106
|
+
* Horizontal padding. `'none'` collapses to `0`.
|
|
107
|
+
*
|
|
108
|
+
* **variant** `'fill' | 'outline'` — default `'fill'`
|
|
109
|
+
* Row background style.
|
|
110
|
+
*
|
|
111
|
+
* **disabled** `boolean` — default `false`
|
|
112
|
+
* Suppresses row and trailing clicks.
|
|
113
|
+
*
|
|
114
|
+
* **role** `string` — no default
|
|
115
|
+
* ARIA role on the root. Use `'menuitem'` inside {@link Button} dropdowns.
|
|
116
|
+
*
|
|
117
|
+
* @param {ListItemProps} props
|
|
118
|
+
* @returns {import('react').ReactElement}
|
|
119
|
+
*
|
|
120
|
+
* @example <caption>Default</caption>
|
|
121
|
+
* import { ListItem } from '@eyesee/ui-components';
|
|
122
|
+
*
|
|
123
|
+
* <ListItem title="Item label" />
|
|
124
|
+
*
|
|
125
|
+
* @example <caption>With description</caption>
|
|
126
|
+
* import { ListItem } from '@eyesee/ui-components';
|
|
127
|
+
*
|
|
128
|
+
* <ListItem title="Item label" description="Secondary detail text" />
|
|
129
|
+
*
|
|
130
|
+
* @example <caption>Active (selected)</caption>
|
|
131
|
+
* import { ListItem } from '@eyesee/ui-components';
|
|
132
|
+
*
|
|
133
|
+
* <ListItem title="Selected item" description="This row is currently active" active />
|
|
134
|
+
*
|
|
135
|
+
* @example <caption>With trailing icons – always visible</caption>
|
|
136
|
+
* import { ListItem } from '@eyesee/ui-components';
|
|
137
|
+
* import { EditIcon, DeleteIcon } from '@eyesee/ui-components/icons';
|
|
138
|
+
*
|
|
139
|
+
* <ListItem
|
|
140
|
+
* title="Item with icons"
|
|
141
|
+
* description="Edit or delete this item"
|
|
142
|
+
* trailingDisplay="always"
|
|
143
|
+
* trailing={[
|
|
144
|
+
* { type: 'edit', icon: <EditIcon iconSize="s" strokeColor="currentColor" /> },
|
|
145
|
+
* { type: 'delete', icon: <DeleteIcon iconSize="s" strokeColor="currentColor" /> },
|
|
146
|
+
* ]}
|
|
147
|
+
* />
|
|
148
|
+
*
|
|
149
|
+
* @example <caption>With trailing icons – reveal on hover</caption>
|
|
150
|
+
* import { ListItem } from '@eyesee/ui-components';
|
|
151
|
+
* import { EditIcon, DeleteIcon } from '@eyesee/ui-components/icons';
|
|
152
|
+
*
|
|
153
|
+
* <ListItem
|
|
154
|
+
* title="Hover to reveal icons"
|
|
155
|
+
* description="Action icons appear on mouse-over"
|
|
156
|
+
* trailingDisplay="hover"
|
|
157
|
+
* trailing={[
|
|
158
|
+
* { type: 'edit', icon: <EditIcon iconSize="s" strokeColor="currentColor" /> },
|
|
159
|
+
* { type: 'delete', icon: <DeleteIcon iconSize="s" strokeColor="currentColor" /> },
|
|
160
|
+
* ]}
|
|
161
|
+
* />
|
|
162
|
+
*
|
|
163
|
+
* @example <caption>With leading avatar</caption>
|
|
164
|
+
* import { ListItem, Avatar } from '@eyesee/ui-components';
|
|
165
|
+
*
|
|
166
|
+
* <ListItem
|
|
167
|
+
* customItem={<Avatar initials="LA" color="green" />}
|
|
168
|
+
* title="Lina Adams"
|
|
169
|
+
* description="Design team"
|
|
170
|
+
* variant="outline"
|
|
171
|
+
* />
|
|
172
|
+
*
|
|
173
|
+
* @example <caption>With leading control</caption>
|
|
174
|
+
* import { ListItem, Checkbox } from '@eyesee/ui-components';
|
|
175
|
+
*
|
|
176
|
+
* <ListItem
|
|
177
|
+
* controlItem={<Checkbox checked={false} onChange={() => {}} size="md" />}
|
|
178
|
+
* title="Enable notifications"
|
|
179
|
+
* description="Receive updates for this list"
|
|
180
|
+
* />
|
|
181
|
+
*
|
|
182
|
+
* @example <caption>With custom status</caption>
|
|
183
|
+
* import { ListItem, Pill } from '@eyesee/ui-components';
|
|
184
|
+
* import { EditIcon, DeleteIcon } from '@eyesee/ui-components/icons';
|
|
185
|
+
*
|
|
186
|
+
* <ListItem
|
|
187
|
+
* customItem={
|
|
188
|
+
* <Pill
|
|
189
|
+
* label="In review"
|
|
190
|
+
* backgroundColor="var(--color--background--secondary--subtle)"
|
|
191
|
+
* color="var(--color--text--secondary--default)"
|
|
192
|
+
* />
|
|
193
|
+
* }
|
|
194
|
+
* title="Project Beta"
|
|
195
|
+
* description="Awaiting approval"
|
|
196
|
+
* variant="outline"
|
|
197
|
+
* trailingDisplay="always"
|
|
198
|
+
* trailing={[
|
|
199
|
+
* { type: 'edit', icon: <EditIcon iconSize="s" strokeColor="currentColor" /> },
|
|
200
|
+
* { type: 'delete', icon: <DeleteIcon iconSize="s" strokeColor="currentColor" /> },
|
|
201
|
+
* ]}
|
|
202
|
+
* />
|
|
203
|
+
*
|
|
204
|
+
* @example <caption>Outline variant</caption>
|
|
205
|
+
* import { ListItem } from '@eyesee/ui-components';
|
|
206
|
+
* import { EditIcon, DeleteIcon } from '@eyesee/ui-components/icons';
|
|
207
|
+
*
|
|
208
|
+
* <ListItem
|
|
209
|
+
* title="Outline list item"
|
|
210
|
+
* description="Border appears on interaction and active state"
|
|
211
|
+
* variant="outline"
|
|
212
|
+
* trailingDisplay="always"
|
|
213
|
+
* trailing={[
|
|
214
|
+
* { type: 'edit', icon: <EditIcon iconSize="s" strokeColor="currentColor" /> },
|
|
215
|
+
* { type: 'delete', icon: <DeleteIcon iconSize="s" strokeColor="currentColor" /> },
|
|
216
|
+
* ]}
|
|
217
|
+
* />
|
|
218
|
+
*/
|
|
219
|
+
export function ListItem({ item, controlItem, customItem, title, description, trailing, trailingDisplay, active, onClick, verticalSpacing, horizontalSpacing, variant, disabled, role, }: ListItemProps): import("react").ReactElement;
|
|
220
|
+
export type ListItemClickHandler = () => void;
|
|
221
|
+
export type ListItemTrailingIconClickHandler = (item: any) => void;
|
|
222
|
+
/**
|
|
223
|
+
* Trailing action icon slot.
|
|
224
|
+
*/
|
|
225
|
+
export type ListItemIcon = {
|
|
226
|
+
/**
|
|
227
|
+
* - Unique React key (`icon-${type}`).
|
|
228
|
+
*/
|
|
229
|
+
type: string;
|
|
230
|
+
/**
|
|
231
|
+
* - Icon element.
|
|
232
|
+
*/
|
|
233
|
+
icon: React.ReactNode;
|
|
234
|
+
/**
|
|
235
|
+
* Fired with the row `item`. Propagation stopped so the row `onClick` does not run.
|
|
236
|
+
*/
|
|
237
|
+
onClick?: ListItemTrailingIconClickHandler;
|
|
238
|
+
/**
|
|
239
|
+
* Overrides row `trailingDisplay` for this icon.
|
|
240
|
+
*/
|
|
241
|
+
trailingDisplay?: "always" | "hover";
|
|
242
|
+
/**
|
|
243
|
+
* Visibility when the row is `active`. Default `'always'`.
|
|
244
|
+
*/
|
|
245
|
+
trailingDisplayOnSelectedItem?: "always" | "hover";
|
|
246
|
+
/**
|
|
247
|
+
* Skips `onClick` and hover styles for this slot only. Default `false`.
|
|
248
|
+
*/
|
|
249
|
+
disabled?: boolean;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* All props are optional.
|
|
253
|
+
*/
|
|
254
|
+
export type ListItemProps = {
|
|
255
|
+
/**
|
|
256
|
+
* Raw data object. Passed to each trailing icon `onClick`. Default `null`.
|
|
257
|
+
*/
|
|
258
|
+
item?: any;
|
|
259
|
+
/**
|
|
260
|
+
* Leading control slot (e.g. {@link Checkbox}). Default `null`.
|
|
261
|
+
*/
|
|
262
|
+
controlItem?: React.ReactNode;
|
|
263
|
+
/**
|
|
264
|
+
* Secondary leading slot (e.g. {@link Avatar}, {@link Pill}). Default `null`.
|
|
265
|
+
*/
|
|
266
|
+
customItem?: React.ReactNode;
|
|
267
|
+
/**
|
|
268
|
+
* Primary label. Truncated via {@link EllipsisTooltip}. Default `null`.
|
|
269
|
+
*/
|
|
270
|
+
title?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Secondary label below `title`. Default `null`.
|
|
273
|
+
*/
|
|
274
|
+
description?: string;
|
|
275
|
+
/**
|
|
276
|
+
* Trailing action icons. Default `[]`.
|
|
277
|
+
*/
|
|
278
|
+
trailing?: ListItemIcon[];
|
|
279
|
+
/**
|
|
280
|
+
* Row-level trailing icon visibility. Default `'hover'`.
|
|
281
|
+
*/
|
|
282
|
+
trailingDisplay?: "always" | "hover";
|
|
283
|
+
/**
|
|
284
|
+
* Selected row (`data-active`). Default `false`.
|
|
285
|
+
*/
|
|
286
|
+
active?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Row click. Suppressed when `disabled`.
|
|
289
|
+
*/
|
|
290
|
+
onClick?: ListItemClickHandler;
|
|
291
|
+
/**
|
|
292
|
+
* Vertical padding. `'none'` → `0`. Default `'xs'`.
|
|
293
|
+
*/
|
|
294
|
+
verticalSpacing?: "none" | "xs" | "sm" | "md" | "lg";
|
|
295
|
+
/**
|
|
296
|
+
* Horizontal padding. `'none'` → `0`. Default `'xs'`.
|
|
297
|
+
*/
|
|
298
|
+
horizontalSpacing?: "none" | "xs" | "sm" | "md" | "lg";
|
|
299
|
+
/**
|
|
300
|
+
* Row background style. Default `'fill'`.
|
|
301
|
+
*/
|
|
302
|
+
variant?: "fill" | "outline";
|
|
303
|
+
/**
|
|
304
|
+
* Suppresses row and trailing clicks. Default `false`.
|
|
305
|
+
*/
|
|
306
|
+
disabled?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* ARIA role on the root. Use `'menuitem'` inside {@link Button} dropdowns.
|
|
309
|
+
*/
|
|
310
|
+
role?: string;
|
|
311
|
+
};
|
|
@@ -2,7 +2,7 @@ import { jsxs as x, jsx as e, Fragment as b } from "react/jsx-runtime";
|
|
|
2
2
|
import A from "clsx";
|
|
3
3
|
import { EllipsisTooltip as y } from "../EllipsisTooltip/EllipsisTooltip.js";
|
|
4
4
|
import a from "./ListItem.module.scss.js";
|
|
5
|
-
|
|
5
|
+
function F({
|
|
6
6
|
item: v = null,
|
|
7
7
|
controlItem: r = null,
|
|
8
8
|
customItem: n = null,
|
|
@@ -17,11 +17,11 @@ const F = ({
|
|
|
17
17
|
variant: D = "fill",
|
|
18
18
|
disabled: d = !1,
|
|
19
19
|
role: w
|
|
20
|
-
})
|
|
21
|
-
const o = (t == null ? void 0 : t.length) > 0,
|
|
20
|
+
}) {
|
|
21
|
+
const o = (t == null ? void 0 : t.length) > 0, u = !!i, h = !!s, N = [
|
|
22
22
|
r && "auto",
|
|
23
23
|
n && "auto",
|
|
24
|
-
(
|
|
24
|
+
(u || h) && "minmax(0, 3fr)",
|
|
25
25
|
o && "auto"
|
|
26
26
|
].filter(Boolean).join(" ");
|
|
27
27
|
return /* @__PURE__ */ x(
|
|
@@ -42,8 +42,8 @@ const F = ({
|
|
|
42
42
|
r && /* @__PURE__ */ e("div", { onClick: (l) => l.stopPropagation(), children: r }),
|
|
43
43
|
n && /* @__PURE__ */ e(b, { children: n }),
|
|
44
44
|
/* @__PURE__ */ x("div", { className: a.textWrapper, children: [
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
u && /* @__PURE__ */ e(y, { showArrow: !0, content: i, className: a.title, children: i }),
|
|
46
|
+
h && /* @__PURE__ */ e(y, { showArrow: !0, content: s, className: a.description, children: s })
|
|
47
47
|
] }),
|
|
48
48
|
o && /* @__PURE__ */ e("div", { className: a.trailing, children: t.map((l) => {
|
|
49
49
|
const k = (l == null ? void 0 : l.trailingDisplay) || c, j = (l == null ? void 0 : l.trailingDisplayOnSelectedItem) || "always", g = d || (l == null ? void 0 : l.disabled);
|
|
@@ -65,7 +65,7 @@ const F = ({
|
|
|
65
65
|
]
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
|
-
}
|
|
68
|
+
}
|
|
69
69
|
export {
|
|
70
70
|
F as ListItem
|
|
71
71
|
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a memoised `listItems` array from raw data for {@link ListItem}.
|
|
3
|
+
*
|
|
4
|
+
* `controlItem`, `customItem`, and `trailing` accept a static value or
|
|
5
|
+
* `(item) => value` for heterogeneous lists.
|
|
6
|
+
*
|
|
7
|
+
* @param {UseListItemsOptions} options
|
|
8
|
+
* @returns {UseListItemsReturn}
|
|
9
|
+
*
|
|
10
|
+
* @example <caption>Selectable list</caption>
|
|
11
|
+
* import { ListItem, useListItems } from '@eyesee/ui-components';
|
|
12
|
+
*
|
|
13
|
+
* const items = [
|
|
14
|
+
* { id: 1, name: 'Alpha', description: 'First' },
|
|
15
|
+
* { id: 2, name: 'Beta', description: 'Second' },
|
|
16
|
+
* ];
|
|
17
|
+
* const { listItems } = useListItems({
|
|
18
|
+
* items,
|
|
19
|
+
* activeItemId: 1,
|
|
20
|
+
* onItemSelect: (item) => console.log(item),
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* {listItems.map(({ id, ...props }) => (
|
|
24
|
+
* <ListItem key={id} {...props} />
|
|
25
|
+
* ))}
|
|
26
|
+
*
|
|
27
|
+
* @example <caption>Per-row trailing icons</caption>
|
|
28
|
+
* import { ListItem, useListItems } from '@eyesee/ui-components';
|
|
29
|
+
* import { DeleteIcon } from '@eyesee/ui-components/icons';
|
|
30
|
+
*
|
|
31
|
+
* const { listItems } = useListItems({
|
|
32
|
+
* items: [{ id: 'a', name: 'Row A' }],
|
|
33
|
+
* trailing: (item) => [
|
|
34
|
+
* {
|
|
35
|
+
* type: 'delete',
|
|
36
|
+
* icon: <DeleteIcon iconSize="s" strokeColor="currentColor" />,
|
|
37
|
+
* onClick: () => console.log('delete', item.id),
|
|
38
|
+
* },
|
|
39
|
+
* ],
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
42
|
+
export function useListItems({ items, controlItem, customItem, trailing, trailingDisplay, itemTitleKey, itemDescriptionKey, activeItemId, onItemSelect, verticalSpacing, horizontalSpacing, variant, }: UseListItemsOptions): UseListItemsReturn;
|
|
43
|
+
export type UseListItemsValueResolver<T> = (item: any) => T;
|
|
44
|
+
export type UseListItemsSelectHandler = (item: any) => void;
|
|
45
|
+
export type ListItemIcon = import("./ListItem").ListItemIcon;
|
|
46
|
+
/**
|
|
47
|
+
* Props spread onto {@link ListItem}, plus `id` for React keys.
|
|
48
|
+
*/
|
|
49
|
+
export type UseListItemsListItemProps = import("./ListItem").ListItemProps & {
|
|
50
|
+
id?: string | number;
|
|
51
|
+
internalNumber?: string | number;
|
|
52
|
+
};
|
|
53
|
+
export type UseListItemsOptions = {
|
|
54
|
+
/**
|
|
55
|
+
* Data objects. Each needs `id` for keys and active matching. Default `[]`.
|
|
56
|
+
*/
|
|
57
|
+
items?: any[];
|
|
58
|
+
/**
|
|
59
|
+
* Leading control per row, or static node. Default `null`.
|
|
60
|
+
*/
|
|
61
|
+
controlItem?: React.ReactNode | UseListItemsValueResolver<React.ReactNode>;
|
|
62
|
+
/**
|
|
63
|
+
* Custom leading slot per row, or static node. Default `null`.
|
|
64
|
+
*/
|
|
65
|
+
customItem?: React.ReactNode | UseListItemsValueResolver<React.ReactNode>;
|
|
66
|
+
/**
|
|
67
|
+
* Trailing icons per row, or static array. Default `[]`.
|
|
68
|
+
*/
|
|
69
|
+
trailing?: ListItemIcon[] | UseListItemsValueResolver<ListItemIcon[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Row-level trailing visibility. Default `'hover'`.
|
|
72
|
+
*/
|
|
73
|
+
trailingDisplay?: "always" | "hover";
|
|
74
|
+
/**
|
|
75
|
+
* Key on each item for `title`. Default `'name'`.
|
|
76
|
+
*/
|
|
77
|
+
itemTitleKey?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Key on each item for `description`. Default `'description'`.
|
|
80
|
+
*/
|
|
81
|
+
itemDescriptionKey?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Selected item `id`. Matching rows get `active: true`. Default `null`.
|
|
84
|
+
*/
|
|
85
|
+
activeItemId?: string | number | null;
|
|
86
|
+
/**
|
|
87
|
+
* Row click; adds `onClick` to each list item when set.
|
|
88
|
+
*/
|
|
89
|
+
onItemSelect?: UseListItemsSelectHandler;
|
|
90
|
+
/**
|
|
91
|
+
* Passed to every {@link ListItem}. Default `'xs'`.
|
|
92
|
+
*/
|
|
93
|
+
verticalSpacing?: "none" | "xs" | "sm" | "md" | "lg";
|
|
94
|
+
/**
|
|
95
|
+
* Passed to every {@link ListItem}. Default `'xs'`.
|
|
96
|
+
*/
|
|
97
|
+
horizontalSpacing?: "none" | "xs" | "sm" | "md" | "lg";
|
|
98
|
+
/**
|
|
99
|
+
* Passed to every {@link ListItem}. Default `'fill'`.
|
|
100
|
+
*/
|
|
101
|
+
variant?: "fill" | "outline";
|
|
102
|
+
};
|
|
103
|
+
export type UseListItemsReturn = {
|
|
104
|
+
/**
|
|
105
|
+
* Memoised {@link ListItem} props.
|
|
106
|
+
*/
|
|
107
|
+
listItems: UseListItemsListItemProps[];
|
|
108
|
+
};
|
|
@@ -1,58 +1,59 @@
|
|
|
1
1
|
import { useCallback as L, useMemo as M } from "react";
|
|
2
|
-
const
|
|
3
|
-
|
|
2
|
+
const f = (u, n) => typeof u == "function" ? u(n) : u;
|
|
3
|
+
function q({
|
|
4
|
+
items: u = [],
|
|
4
5
|
controlItem: n = null,
|
|
5
|
-
customItem:
|
|
6
|
-
trailing:
|
|
6
|
+
customItem: o = null,
|
|
7
|
+
trailing: d = [],
|
|
7
8
|
trailingDisplay: b = "hover",
|
|
8
9
|
itemTitleKey: x = "name",
|
|
9
10
|
itemDescriptionKey: k = "description",
|
|
10
11
|
activeItemId: r = null,
|
|
11
|
-
onItemSelect:
|
|
12
|
+
onItemSelect: l,
|
|
12
13
|
verticalSpacing: p = "xs",
|
|
13
14
|
horizontalSpacing: C = "xs",
|
|
14
15
|
variant: N = "fill"
|
|
15
|
-
})
|
|
16
|
+
}) {
|
|
16
17
|
const h = L(
|
|
17
18
|
(s) => {
|
|
18
|
-
|
|
19
|
+
l == null || l(s);
|
|
19
20
|
},
|
|
20
|
-
[
|
|
21
|
+
[l]
|
|
21
22
|
);
|
|
22
23
|
return { listItems: M(
|
|
23
|
-
() => (
|
|
24
|
+
() => (u || []).map((s) => ({
|
|
24
25
|
id: s == null ? void 0 : s.id,
|
|
25
26
|
title: (s == null ? void 0 : s[x]) ?? null,
|
|
26
27
|
description: (s == null ? void 0 : s[k]) ?? null,
|
|
27
28
|
item: s,
|
|
28
|
-
controlItem:
|
|
29
|
-
customItem: o
|
|
29
|
+
controlItem: f(n, s),
|
|
30
|
+
customItem: f(o, s),
|
|
30
31
|
internalNumber: s == null ? void 0 : s.internalNumber,
|
|
31
|
-
trailing:
|
|
32
|
+
trailing: f(d, s),
|
|
32
33
|
trailingDisplay: b,
|
|
33
34
|
verticalSpacing: p,
|
|
34
35
|
horizontalSpacing: C,
|
|
35
36
|
variant: N,
|
|
36
37
|
active: r != null && (s == null ? void 0 : s.id) === r,
|
|
37
|
-
...
|
|
38
|
+
...l && { onClick: () => h(s) }
|
|
38
39
|
})),
|
|
39
40
|
[
|
|
40
41
|
n,
|
|
42
|
+
o,
|
|
41
43
|
d,
|
|
42
|
-
f,
|
|
43
44
|
b,
|
|
44
|
-
|
|
45
|
+
u,
|
|
45
46
|
x,
|
|
46
47
|
k,
|
|
47
48
|
r,
|
|
48
|
-
|
|
49
|
+
l,
|
|
49
50
|
h,
|
|
50
51
|
p,
|
|
51
52
|
C,
|
|
52
53
|
N
|
|
53
54
|
]
|
|
54
55
|
) };
|
|
55
|
-
}
|
|
56
|
+
}
|
|
56
57
|
export {
|
|
57
58
|
q as useListItems
|
|
58
59
|
};
|