@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,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @callback TabsChangeHandler
|
|
3
|
+
* @param {TabOption} tab Selected tab object (normalised).
|
|
4
|
+
* @returns {void}
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Tab definition. Plain strings in `options` are used as the label.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {object} TabOption
|
|
10
|
+
* @property {string} label - Display text. Key name configurable via `keyLabel`.
|
|
11
|
+
* @property {boolean} [hidden=false]
|
|
12
|
+
* When `true`, tab is not rendered. Default `false`.
|
|
13
|
+
* @property {boolean} [disabled=false]
|
|
14
|
+
* Tab is visible but not selectable. Default `false`.
|
|
15
|
+
* @property {string} [tooltipText]
|
|
16
|
+
* Tooltip body. Key name configurable via `keyTooltipText`.
|
|
17
|
+
* @property {string} [tooltipTitle]
|
|
18
|
+
* Tooltip title. Key name configurable via `keyTooltipTitle`.
|
|
19
|
+
* @property {React.ReactNode} [icon]
|
|
20
|
+
* Leading icon. Key name configurable via `keyIcon`.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {object} TabsProps
|
|
24
|
+
*
|
|
25
|
+
* @property {TabOption[]|string[]} options
|
|
26
|
+
* Tab definitions. Strings become labels.
|
|
27
|
+
* @property {TabsChangeHandler} [onTabChange]
|
|
28
|
+
* Fired when a non-disabled tab is clicked. Default `() => {}`.
|
|
29
|
+
* @property {TabOption|string} [selectedTab]
|
|
30
|
+
* Active tab. Defaults to `options[0]`. Matched on trimmed `label`.
|
|
31
|
+
* @property {'primary'|'secondary'} [variant='primary']
|
|
32
|
+
* Colour theme for all tabs. Default `'primary'`.
|
|
33
|
+
* @property {'outline'|'white'|'color'} [type='outline']
|
|
34
|
+
* Active indicator fill (`tabVariant="button"`). Default `'outline'`.
|
|
35
|
+
* @property {'text'|'button'} [tabVariant='text']
|
|
36
|
+
* `'text'` → `<span>`; `'button'` → segmented buttons. Default `'text'`.
|
|
37
|
+
* @property {'sm'|'md'|'lg'} [spacing='md']
|
|
38
|
+
* Tab padding. Default `'md'`.
|
|
39
|
+
* @property {'none'|'xs'|'sm'|'md'|'lg'|'xl'} [gapSpacing='none']
|
|
40
|
+
* Gap between tabs. `'none'` merges button borders. Default `'none'`.
|
|
41
|
+
* @property {boolean} [positionStandalone=false]
|
|
42
|
+
* Button mode: each tab as a standalone pill. Default `false`.
|
|
43
|
+
* @property {boolean} [underline=false]
|
|
44
|
+
* Underline on the active text tab. Default `false`.
|
|
45
|
+
* @property {string} [keyLabel='label']
|
|
46
|
+
* Option property for the label. Default `'label'`.
|
|
47
|
+
* @property {string} [keyTooltipText='tooltipText']
|
|
48
|
+
* Option property for tooltip body. Default `'tooltipText'`.
|
|
49
|
+
* @property {string} [keyTooltipTitle='tooltipTitle']
|
|
50
|
+
* Option property for tooltip title. Default `'tooltipTitle'`.
|
|
51
|
+
* @property {string} [keyIcon='icon']
|
|
52
|
+
* Option property for the icon. Default `'icon'`.
|
|
53
|
+
* @property {React.ReactNode} [startIcon=null]
|
|
54
|
+
* Fallback icon when the option has no `icon`. Default `null`.
|
|
55
|
+
* @property {boolean} [disabled=false]
|
|
56
|
+
* Disables every tab in the group. Default `false`.
|
|
57
|
+
*
|
|
58
|
+
* @see {@link Tab}
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Controlled tab group. Pass `selectedTab` and update it in `onTabChange`.
|
|
62
|
+
*
|
|
63
|
+
* ## Props
|
|
64
|
+
*
|
|
65
|
+
* **options** `TabOption[] | string[]` — no default
|
|
66
|
+
* Tab definitions. Strings become labels.
|
|
67
|
+
*
|
|
68
|
+
* **onTabChange** `(tab: TabOption) => void` — default `() => {}`
|
|
69
|
+
* Fired when a non-disabled tab is clicked.
|
|
70
|
+
*
|
|
71
|
+
* **selectedTab** `TabOption | string` — default `options[0]`
|
|
72
|
+
* Active tab. Matched on trimmed `label`.
|
|
73
|
+
*
|
|
74
|
+
* **variant** `'primary' | 'secondary'` — default `'primary'`
|
|
75
|
+
* Colour theme for all tabs.
|
|
76
|
+
*
|
|
77
|
+
* **type** `'outline' | 'white' | 'color'` — default `'outline'`
|
|
78
|
+
* Active indicator fill for `tabVariant="button"`.
|
|
79
|
+
*
|
|
80
|
+
* **tabVariant** `'text' | 'button'` — default `'text'`
|
|
81
|
+
* `'text'` renders spans; `'button'` renders segmented buttons.
|
|
82
|
+
*
|
|
83
|
+
* **spacing** `'sm' | 'md' | 'lg'` — default `'md'`
|
|
84
|
+
* Tab padding.
|
|
85
|
+
*
|
|
86
|
+
* **gapSpacing** `'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'` — default `'none'`
|
|
87
|
+
* Gap between tabs. `'none'` merges button borders.
|
|
88
|
+
*
|
|
89
|
+
* **positionStandalone** `boolean` — default `false`
|
|
90
|
+
* Button mode: render each tab as a standalone pill.
|
|
91
|
+
*
|
|
92
|
+
* **underline** `boolean` — default `false`
|
|
93
|
+
* Underline on the active text tab.
|
|
94
|
+
*
|
|
95
|
+
* **keyLabel** `string` — default `'label'`
|
|
96
|
+
* Option property used as the display label.
|
|
97
|
+
*
|
|
98
|
+
* **keyTooltipText** `string` — default `'tooltipText'`
|
|
99
|
+
* Option property for tooltip body text.
|
|
100
|
+
*
|
|
101
|
+
* **keyTooltipTitle** `string` — default `'tooltipTitle'`
|
|
102
|
+
* Option property for tooltip title.
|
|
103
|
+
*
|
|
104
|
+
* **keyIcon** `string` — default `'icon'`
|
|
105
|
+
* Option property for the tab icon.
|
|
106
|
+
*
|
|
107
|
+
* **startIcon** `ReactNode` — default `null`
|
|
108
|
+
* Fallback icon when the option has no `icon`.
|
|
109
|
+
*
|
|
110
|
+
* **disabled** `boolean` — default `false`
|
|
111
|
+
* Disables every tab in the group.
|
|
112
|
+
*
|
|
113
|
+
* @param {TabsProps} props
|
|
114
|
+
* @returns {import('react').ReactElement}
|
|
115
|
+
*
|
|
116
|
+
* @example <caption>Text (tab-default)</caption>
|
|
117
|
+
* import { Tabs } from '@eyesee/ui-components';
|
|
118
|
+
*
|
|
119
|
+
* <Tabs
|
|
120
|
+
* options={[
|
|
121
|
+
* { name: 'overview', label: 'Overview' },
|
|
122
|
+
* { name: 'details', label: 'Details' },
|
|
123
|
+
* { name: 'history', label: 'History', disabled: true },
|
|
124
|
+
* ]}
|
|
125
|
+
* selectedTab={{ name: 'overview', label: 'Overview' }}
|
|
126
|
+
* onTabChange={(tab) => {}}
|
|
127
|
+
* tabVariant="text"
|
|
128
|
+
* variant="secondary"
|
|
129
|
+
* underline
|
|
130
|
+
* />
|
|
131
|
+
*
|
|
132
|
+
* @example <caption>Button — outline (grouped)</caption>
|
|
133
|
+
* import { Tabs } from '@eyesee/ui-components';
|
|
134
|
+
*
|
|
135
|
+
* <Tabs
|
|
136
|
+
* options={[
|
|
137
|
+
* { name: 'all', label: 'All' },
|
|
138
|
+
* { name: 'drafts', label: 'Drafts' },
|
|
139
|
+
* { name: 'published', label: 'Published' },
|
|
140
|
+
* { name: 'archived', label: 'Archived' },
|
|
141
|
+
* ]}
|
|
142
|
+
* selectedTab={{ name: 'drafts', label: 'Drafts' }}
|
|
143
|
+
* onTabChange={(tab) => {}}
|
|
144
|
+
* tabVariant="button"
|
|
145
|
+
* type="outline"
|
|
146
|
+
* gapSpacing="none"
|
|
147
|
+
* />
|
|
148
|
+
*
|
|
149
|
+
* @example <caption>Button — white (grouped)</caption>
|
|
150
|
+
* import { Tabs } from '@eyesee/ui-components';
|
|
151
|
+
*
|
|
152
|
+
* <Tabs
|
|
153
|
+
* options={[
|
|
154
|
+
* { name: 'all', label: 'All' },
|
|
155
|
+
* { name: 'drafts', label: 'Drafts' },
|
|
156
|
+
* { name: 'published', label: 'Published' },
|
|
157
|
+
* { name: 'archived', label: 'Archived' },
|
|
158
|
+
* ]}
|
|
159
|
+
* selectedTab={{ name: 'drafts', label: 'Drafts' }}
|
|
160
|
+
* onTabChange={(tab) => {}}
|
|
161
|
+
* tabVariant="button"
|
|
162
|
+
* type="white"
|
|
163
|
+
* gapSpacing="none"
|
|
164
|
+
* />
|
|
165
|
+
*
|
|
166
|
+
* @example <caption>Button — color (grouped)</caption>
|
|
167
|
+
* import { Tabs } from '@eyesee/ui-components';
|
|
168
|
+
*
|
|
169
|
+
* <Tabs
|
|
170
|
+
* options={[
|
|
171
|
+
* { name: 'all', label: 'All' },
|
|
172
|
+
* { name: 'drafts', label: 'Drafts' },
|
|
173
|
+
* { name: 'published', label: 'Published' },
|
|
174
|
+
* { name: 'archived', label: 'Archived' },
|
|
175
|
+
* ]}
|
|
176
|
+
* selectedTab={{ name: 'drafts', label: 'Drafts' }}
|
|
177
|
+
* onTabChange={(tab) => {}}
|
|
178
|
+
* tabVariant="button"
|
|
179
|
+
* type="color"
|
|
180
|
+
* gapSpacing="none"
|
|
181
|
+
* />
|
|
182
|
+
*
|
|
183
|
+
* @example <caption>Button — standalone pills</caption>
|
|
184
|
+
* import { Tabs } from '@eyesee/ui-components';
|
|
185
|
+
*
|
|
186
|
+
* <Tabs
|
|
187
|
+
* options={[
|
|
188
|
+
* { name: 'summary', label: 'Summary' },
|
|
189
|
+
* { name: 'insights', label: 'Insights' },
|
|
190
|
+
* { name: 'settings', label: 'Settings', disabled: true },
|
|
191
|
+
* ]}
|
|
192
|
+
* selectedTab={{ name: 'summary', label: 'Summary' }}
|
|
193
|
+
* onTabChange={(tab) => {}}
|
|
194
|
+
* tabVariant="button"
|
|
195
|
+
* type="outline"
|
|
196
|
+
* positionStandalone
|
|
197
|
+
* gapSpacing="sm"
|
|
198
|
+
* />
|
|
199
|
+
*
|
|
200
|
+
* @example <caption>Button — with gap spacing</caption>
|
|
201
|
+
* import { Tabs } from '@eyesee/ui-components';
|
|
202
|
+
*
|
|
203
|
+
* <Tabs
|
|
204
|
+
* options={[
|
|
205
|
+
* { name: 'all', label: 'All' },
|
|
206
|
+
* { name: 'drafts', label: 'Drafts' },
|
|
207
|
+
* { name: 'published', label: 'Published' },
|
|
208
|
+
* { name: 'archived', label: 'Archived' },
|
|
209
|
+
* ]}
|
|
210
|
+
* selectedTab={{ name: 'all', label: 'All' }}
|
|
211
|
+
* onTabChange={(tab) => {}}
|
|
212
|
+
* tabVariant="button"
|
|
213
|
+
* type="outline"
|
|
214
|
+
* positionStandalone
|
|
215
|
+
* gapSpacing="md"
|
|
216
|
+
* />
|
|
217
|
+
*
|
|
218
|
+
* @example <caption>WithIcons</caption>
|
|
219
|
+
* import { Tabs } from '@eyesee/ui-components';
|
|
220
|
+
* import { HomeIcon, SettingsIcon } from '@eyesee/ui-components/icons';
|
|
221
|
+
*
|
|
222
|
+
* <Tabs
|
|
223
|
+
* options={[
|
|
224
|
+
* { name: 'overview', label: 'Overview', icon: <HomeIcon iconSize="m" /> },
|
|
225
|
+
* { name: 'details', label: 'Details' },
|
|
226
|
+
* { name: 'settings', label: 'Settings', icon: <SettingsIcon iconSize="m" />, disabled: true },
|
|
227
|
+
* ]}
|
|
228
|
+
* selectedTab={{ name: 'overview', label: 'Overview' }}
|
|
229
|
+
* onTabChange={(tab) => {}}
|
|
230
|
+
* tabVariant="button"
|
|
231
|
+
* variant="secondary"
|
|
232
|
+
* type="outline"
|
|
233
|
+
* />
|
|
234
|
+
*
|
|
235
|
+
* @example <caption>WithTooltips</caption>
|
|
236
|
+
* import { Tabs } from '@eyesee/ui-components';
|
|
237
|
+
*
|
|
238
|
+
* <Tabs
|
|
239
|
+
* options={[
|
|
240
|
+
* {
|
|
241
|
+
* name: 'overview',
|
|
242
|
+
* label: 'Overview',
|
|
243
|
+
* tooltipTitle: 'Overview',
|
|
244
|
+
* tooltipText: 'Summary of the current project.',
|
|
245
|
+
* },
|
|
246
|
+
* {
|
|
247
|
+
* name: 'details',
|
|
248
|
+
* label: 'Details',
|
|
249
|
+
* tooltipTitle: 'Details',
|
|
250
|
+
* tooltipText: 'Extended metadata and configuration.',
|
|
251
|
+
* },
|
|
252
|
+
* { name: 'history', label: 'History', disabled: true },
|
|
253
|
+
* ]}
|
|
254
|
+
* selectedTab={{ name: 'overview', label: 'Overview' }}
|
|
255
|
+
* onTabChange={(tab) => {}}
|
|
256
|
+
* tabVariant="text"
|
|
257
|
+
* underline
|
|
258
|
+
* />
|
|
259
|
+
*/
|
|
260
|
+
export function Tabs({ options, onTabChange, selectedTab, variant, type, spacing, gapSpacing, tabVariant, positionStandalone, underline, keyLabel, keyTooltipText, keyTooltipTitle, keyIcon, startIcon, disabled, }: TabsProps): import("react").ReactElement;
|
|
261
|
+
export type TabsChangeHandler = (tab: TabOption) => void;
|
|
262
|
+
/**
|
|
263
|
+
* Tab definition. Plain strings in `options` are used as the label.
|
|
264
|
+
*/
|
|
265
|
+
export type TabOption = {
|
|
266
|
+
/**
|
|
267
|
+
* - Display text. Key name configurable via `keyLabel`.
|
|
268
|
+
*/
|
|
269
|
+
label: string;
|
|
270
|
+
/**
|
|
271
|
+
* When `true`, tab is not rendered. Default `false`.
|
|
272
|
+
*/
|
|
273
|
+
hidden?: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Tab is visible but not selectable. Default `false`.
|
|
276
|
+
*/
|
|
277
|
+
disabled?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Tooltip body. Key name configurable via `keyTooltipText`.
|
|
280
|
+
*/
|
|
281
|
+
tooltipText?: string;
|
|
282
|
+
/**
|
|
283
|
+
* Tooltip title. Key name configurable via `keyTooltipTitle`.
|
|
284
|
+
*/
|
|
285
|
+
tooltipTitle?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Leading icon. Key name configurable via `keyIcon`.
|
|
288
|
+
*/
|
|
289
|
+
icon?: React.ReactNode;
|
|
290
|
+
};
|
|
291
|
+
export type TabsProps = {
|
|
292
|
+
/**
|
|
293
|
+
* Tab definitions. Strings become labels.
|
|
294
|
+
*/
|
|
295
|
+
options: TabOption[] | string[];
|
|
296
|
+
/**
|
|
297
|
+
* Fired when a non-disabled tab is clicked. Default `() => {}`.
|
|
298
|
+
*/
|
|
299
|
+
onTabChange?: TabsChangeHandler;
|
|
300
|
+
/**
|
|
301
|
+
* Active tab. Defaults to `options[0]`. Matched on trimmed `label`.
|
|
302
|
+
*/
|
|
303
|
+
selectedTab?: TabOption | string;
|
|
304
|
+
/**
|
|
305
|
+
* Colour theme for all tabs. Default `'primary'`.
|
|
306
|
+
*/
|
|
307
|
+
variant?: "primary" | "secondary";
|
|
308
|
+
/**
|
|
309
|
+
* Active indicator fill (`tabVariant="button"`). Default `'outline'`.
|
|
310
|
+
*/
|
|
311
|
+
type?: "outline" | "white" | "color";
|
|
312
|
+
/**
|
|
313
|
+
* `'text'` → `<span>`; `'button'` → segmented buttons. Default `'text'`.
|
|
314
|
+
*/
|
|
315
|
+
tabVariant?: "text" | "button";
|
|
316
|
+
/**
|
|
317
|
+
* Tab padding. Default `'md'`.
|
|
318
|
+
*/
|
|
319
|
+
spacing?: "sm" | "md" | "lg";
|
|
320
|
+
/**
|
|
321
|
+
* Gap between tabs. `'none'` merges button borders. Default `'none'`.
|
|
322
|
+
*/
|
|
323
|
+
gapSpacing?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
324
|
+
/**
|
|
325
|
+
* Button mode: each tab as a standalone pill. Default `false`.
|
|
326
|
+
*/
|
|
327
|
+
positionStandalone?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Underline on the active text tab. Default `false`.
|
|
330
|
+
*/
|
|
331
|
+
underline?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Option property for the label. Default `'label'`.
|
|
334
|
+
*/
|
|
335
|
+
keyLabel?: string;
|
|
336
|
+
/**
|
|
337
|
+
* Option property for tooltip body. Default `'tooltipText'`.
|
|
338
|
+
*/
|
|
339
|
+
keyTooltipText?: string;
|
|
340
|
+
/**
|
|
341
|
+
* Option property for tooltip title. Default `'tooltipTitle'`.
|
|
342
|
+
*/
|
|
343
|
+
keyTooltipTitle?: string;
|
|
344
|
+
/**
|
|
345
|
+
* Option property for the icon. Default `'icon'`.
|
|
346
|
+
*/
|
|
347
|
+
keyIcon?: string;
|
|
348
|
+
/**
|
|
349
|
+
* Fallback icon when the option has no `icon`. Default `null`.
|
|
350
|
+
*/
|
|
351
|
+
startIcon?: React.ReactNode;
|
|
352
|
+
/**
|
|
353
|
+
* Disables every tab in the group. Default `false`.
|
|
354
|
+
*/
|
|
355
|
+
disabled?: boolean;
|
|
356
|
+
};
|
|
@@ -4,7 +4,7 @@ import E from "clsx";
|
|
|
4
4
|
import { Tab as F } from "../Tab/Tab.js";
|
|
5
5
|
import { normalizeTabsOptions as G, normalizeTabOption as H, getTrimmedLabel as f } from "./tabsUtils.js";
|
|
6
6
|
import g from "./Tabs.module.scss.js";
|
|
7
|
-
|
|
7
|
+
function Y({
|
|
8
8
|
options: e,
|
|
9
9
|
onTabChange: A = () => {
|
|
10
10
|
},
|
|
@@ -22,7 +22,7 @@ const Y = ({
|
|
|
22
22
|
keyIcon: d = "icon",
|
|
23
23
|
startIcon: O = null,
|
|
24
24
|
disabled: P = !1
|
|
25
|
-
})
|
|
25
|
+
}) {
|
|
26
26
|
const u = v(
|
|
27
27
|
() => G(e, t, s, n, d),
|
|
28
28
|
[e, t, s, n, d]
|
|
@@ -57,7 +57,7 @@ const Y = ({
|
|
|
57
57
|
}
|
|
58
58
|
);
|
|
59
59
|
}) });
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
61
|
export {
|
|
62
62
|
Y as Tabs
|
|
63
63
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Normalises tab option shapes for {@link Tabs}.
|
|
3
|
+
* @module tabsUtils
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Maps a string or object option to a normalised tab shape with `label`, tooltip, and `icon` keys.
|
|
7
|
+
*
|
|
8
|
+
* @param {import('./Tabs').TabOption|string|null|undefined} option
|
|
9
|
+
* @param {string} labelKey Property used as `label`.
|
|
10
|
+
* @param {string} tooltipTextKey Property used as `tooltipText`.
|
|
11
|
+
* @param {string} tooltipTitleKey Property used as `tooltipTitle`.
|
|
12
|
+
* @param {string} iconKey Property used as `icon`.
|
|
13
|
+
* @returns {import('./Tabs').TabOption|undefined}
|
|
14
|
+
*/
|
|
15
|
+
export function normalizeTabOption(option: import("./Tabs").TabOption | string | null | undefined, labelKey: string, tooltipTextKey: string, tooltipTitleKey: string, iconKey: string): import("./Tabs").TabOption | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Normalises an array of tab options. Plain strings pass through unchanged.
|
|
18
|
+
*
|
|
19
|
+
* @param {import('./Tabs').TabOption[]|string[]} [options=[]]
|
|
20
|
+
* @param {string} labelKey
|
|
21
|
+
* @param {string} tooltipTextKey
|
|
22
|
+
* @param {string} tooltipTitleKey
|
|
23
|
+
* @param {string} iconKey
|
|
24
|
+
* @returns {import('./Tabs').TabOption[]}
|
|
25
|
+
*/
|
|
26
|
+
export function normalizeTabsOptions(options?: import("./Tabs").TabOption[] | string[], labelKey: string, tooltipTextKey: string, tooltipTitleKey: string, iconKey: string): import("./Tabs").TabOption[];
|
|
27
|
+
/**
|
|
28
|
+
* Lowercases and trims a tab label for active-state comparison.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} label
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
export function getTrimmedLabel(label: string): string;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
function m(r, t, n, e, c) {
|
|
2
2
|
if (!r) return r;
|
|
3
|
-
const
|
|
3
|
+
const i = r[t], s = r[n], u = r[e], a = r[c];
|
|
4
4
|
return {
|
|
5
5
|
...r,
|
|
6
|
-
label:
|
|
7
|
-
tooltipText:
|
|
8
|
-
tooltipTitle:
|
|
9
|
-
icon:
|
|
6
|
+
label: i,
|
|
7
|
+
tooltipText: s,
|
|
8
|
+
tooltipTitle: u,
|
|
9
|
+
icon: a
|
|
10
10
|
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
}
|
|
12
|
+
function o(r = [], t, n, e, c) {
|
|
13
|
+
return Array.isArray(r) ? r.map(
|
|
14
|
+
(i) => m(i, t, n, e, c)
|
|
15
|
+
) : [];
|
|
16
|
+
}
|
|
17
|
+
function T(r) {
|
|
18
|
+
return (r == null ? void 0 : r.toLowerCase().trim()) ?? "";
|
|
19
|
+
}
|
|
14
20
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
T as getTrimmedLabel,
|
|
22
|
+
m as normalizeTabOption,
|
|
23
|
+
o as normalizeTabsOptions
|
|
18
24
|
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @callback TagDismissHandler
|
|
3
|
+
* @returns {void}
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} TagProps
|
|
7
|
+
*
|
|
8
|
+
* @property {string} [label]
|
|
9
|
+
* Visible label. Renders nothing when empty or null.
|
|
10
|
+
* @property {'rectangle'|'pill'} [shape='rectangle']
|
|
11
|
+
* Rectangle (subtle radius) or pill. Default `'rectangle'`.
|
|
12
|
+
* @property {'default'|'secondary'|'disabled'} [state='default']
|
|
13
|
+
* Foreground only. Default `'default'`.
|
|
14
|
+
* @property {boolean} [showLeadingIcon=false]
|
|
15
|
+
* {@link HelpIcon} before the label. Default `false`.
|
|
16
|
+
* @property {boolean} [showDismiss=true]
|
|
17
|
+
* Show dismiss control when `onDismiss` is set. Default `true`.
|
|
18
|
+
* @property {TagDismissHandler} [onDismiss]
|
|
19
|
+
* Renders dismiss button when set. Default `undefined`.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Inline tag with neutral subtle background. Dismiss renders only when `onDismiss` is set.
|
|
23
|
+
*
|
|
24
|
+
* ## Props
|
|
25
|
+
*
|
|
26
|
+
* **label** `string` — no default
|
|
27
|
+
* Visible label. Renders nothing when empty or null.
|
|
28
|
+
*
|
|
29
|
+
* **shape** `'rectangle' | 'pill'` — default `'rectangle'`
|
|
30
|
+
* Rectangle (subtle radius) or pill.
|
|
31
|
+
*
|
|
32
|
+
* **state** `'default' | 'secondary' | 'disabled'` — default `'default'`
|
|
33
|
+
* Foreground only; background stays neutral subtle.
|
|
34
|
+
*
|
|
35
|
+
* **showLeadingIcon** `boolean` — default `false`
|
|
36
|
+
* {@link HelpIcon} before the label.
|
|
37
|
+
*
|
|
38
|
+
* **showDismiss** `boolean` — default `true`
|
|
39
|
+
* Show dismiss control when `onDismiss` is set.
|
|
40
|
+
*
|
|
41
|
+
* **onDismiss** `() => void` — no default
|
|
42
|
+
* Renders dismiss button when set.
|
|
43
|
+
*
|
|
44
|
+
* @param {TagProps} props
|
|
45
|
+
* @returns {import('react').ReactElement|null}
|
|
46
|
+
*
|
|
47
|
+
* @example <caption>Default</caption>
|
|
48
|
+
* import { Tag } from '@eyesee/ui-components';
|
|
49
|
+
*
|
|
50
|
+
* <Tag label="Tag" shape="rectangle" state="default" onDismiss={() => {}} />
|
|
51
|
+
*
|
|
52
|
+
* @example <caption>States</caption>
|
|
53
|
+
* import { Tag } from '@eyesee/ui-components';
|
|
54
|
+
*
|
|
55
|
+
* <Tag label="Tag" state="default" showLeadingIcon />
|
|
56
|
+
* <Tag label="Tag" state="secondary" showLeadingIcon />
|
|
57
|
+
* <Tag label="Tag" state="disabled" showLeadingIcon />
|
|
58
|
+
*
|
|
59
|
+
* @example <caption>Layouts</caption>
|
|
60
|
+
* import { Tag } from '@eyesee/ui-components';
|
|
61
|
+
*
|
|
62
|
+
* <Tag label="Tag" showLeadingIcon onDismiss={() => {}} />
|
|
63
|
+
* <Tag label="Tag" onDismiss={() => {}} />
|
|
64
|
+
* <Tag label="Tag" />
|
|
65
|
+
*/
|
|
66
|
+
export function Tag({ label, shape, state, showLeadingIcon, showDismiss, onDismiss, }: TagProps): import("react").ReactElement | null;
|
|
67
|
+
export type TagDismissHandler = () => void;
|
|
68
|
+
export type TagProps = {
|
|
69
|
+
/**
|
|
70
|
+
* Visible label. Renders nothing when empty or null.
|
|
71
|
+
*/
|
|
72
|
+
label?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Rectangle (subtle radius) or pill. Default `'rectangle'`.
|
|
75
|
+
*/
|
|
76
|
+
shape?: "rectangle" | "pill";
|
|
77
|
+
/**
|
|
78
|
+
* Foreground only. Default `'default'`.
|
|
79
|
+
*/
|
|
80
|
+
state?: "default" | "secondary" | "disabled";
|
|
81
|
+
/**
|
|
82
|
+
* {@link HelpIcon} before the label. Default `false`.
|
|
83
|
+
*/
|
|
84
|
+
showLeadingIcon?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Show dismiss control when `onDismiss` is set. Default `true`.
|
|
87
|
+
*/
|
|
88
|
+
showDismiss?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Renders dismiss button when set. Default `undefined`.
|
|
91
|
+
*/
|
|
92
|
+
onDismiss?: TagDismissHandler;
|
|
93
|
+
};
|
|
@@ -8,14 +8,15 @@ const f = {
|
|
|
8
8
|
default: e.stateDefault,
|
|
9
9
|
secondary: e.stateSecondary,
|
|
10
10
|
disabled: e.stateDisabled
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
function A({
|
|
12
13
|
label: s,
|
|
13
14
|
shape: l = "rectangle",
|
|
14
15
|
state: t = "default",
|
|
15
16
|
showLeadingIcon: i = !1,
|
|
16
17
|
showDismiss: r = !0,
|
|
17
18
|
onDismiss: n
|
|
18
|
-
})
|
|
19
|
+
}) {
|
|
19
20
|
if (s == null || s === "") return null;
|
|
20
21
|
const c = (u.includes(l) ? l : "rectangle") === "pill" ? e.shapePill : e.shapeRectangle;
|
|
21
22
|
return /* @__PURE__ */ o("span", { className: d(e.tag, c, f[t] ?? e.stateDefault), children: [
|
|
@@ -33,7 +34,7 @@ const f = {
|
|
|
33
34
|
}
|
|
34
35
|
) : null
|
|
35
36
|
] });
|
|
36
|
-
}
|
|
37
|
+
}
|
|
37
38
|
export {
|
|
38
39
|
A as Tag
|
|
39
40
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tag (Figma) — foreground-only states; background stays neutral subtle.
|
|
3
|
+
* `shape`: rectangle (4px radius) | pill
|
|
4
|
+
* `state`: default | secondary | disabled — affects label and icon colour only.
|
|
5
|
+
*/
|
|
6
|
+
export const TAG_SHAPES: string[];
|
|
7
|
+
export const TAG_STATES: string[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} TextHoverableProps
|
|
3
|
+
*
|
|
4
|
+
* @property {React.ReactNode} children
|
|
5
|
+
* Content inside the hoverable span.
|
|
6
|
+
* @property {string} [className]
|
|
7
|
+
* Extra class on the root `<span>`.
|
|
8
|
+
*
|
|
9
|
+
* Rest props go to the root `<span>`.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Inline text with dashed underline on hover.
|
|
13
|
+
*
|
|
14
|
+
* ## Props
|
|
15
|
+
*
|
|
16
|
+
* **children** `ReactNode` — no default
|
|
17
|
+
* Content inside the hoverable span.
|
|
18
|
+
*
|
|
19
|
+
* **className** `string` — no default
|
|
20
|
+
* Extra class on the root `<span>`.
|
|
21
|
+
*
|
|
22
|
+
* Rest props go to the root `<span>`.
|
|
23
|
+
*
|
|
24
|
+
* @param {TextHoverableProps & import('react').HTMLAttributes<HTMLSpanElement>} props
|
|
25
|
+
* @returns {import('react').ReactElement}
|
|
26
|
+
*
|
|
27
|
+
* @example <caption>Default</caption>
|
|
28
|
+
* import { TextHoverable, Tooltip } from '@eyesee/ui-components';
|
|
29
|
+
*
|
|
30
|
+
* <Tooltip content="Helpful additional context" showArrow>
|
|
31
|
+
* <TextHoverable>hoverable text</TextHoverable>
|
|
32
|
+
* </Tooltip>
|
|
33
|
+
*/
|
|
34
|
+
export function TextHoverable({ children, className, ...props }: TextHoverableProps & import("react").HTMLAttributes<HTMLSpanElement>): import("react").ReactElement;
|
|
35
|
+
export type TextHoverableProps = {
|
|
36
|
+
/**
|
|
37
|
+
* Content inside the hoverable span.
|
|
38
|
+
*/
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Extra class on the root `<span>`.
|
|
42
|
+
*
|
|
43
|
+
* Rest props go to the root `<span>`.
|
|
44
|
+
*/
|
|
45
|
+
className?: string;
|
|
46
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import a from "clsx";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import r from "./TextHoverable.module.scss.js";
|
|
4
|
+
function p({ children: t, className: o, ...s }) {
|
|
5
|
+
return /* @__PURE__ */ e("span", { className: a(r.textHoverable, o), ...s, children: /* @__PURE__ */ e("span", { className: r.text, children: t }) });
|
|
6
|
+
}
|
|
5
7
|
export {
|
|
6
|
-
|
|
8
|
+
p as TextHoverable
|
|
7
9
|
};
|