@eyesee/ui-components 0.8.0 → 0.9.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/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 +209 -0
- package/dist/components/icons-v2/index.js +376 -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
package/README.md
CHANGED
|
@@ -76,6 +76,8 @@ Icons are exported from a separate entry point to keep bundles lean:
|
|
|
76
76
|
import { PlusIcon, DeleteIcon, EditIcon } from '@eyesee/ui-components/icons';
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
The package ships TypeScript declaration files generated from JSDoc. In Cursor, VS Code, or any editor with a TypeScript language service, hover a component and use autocomplete to see its props, types, defaults, and descriptions.
|
|
80
|
+
|
|
79
81
|
---
|
|
80
82
|
|
|
81
83
|
## Components
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {keyof typeof AVATAR_COLOR_PALETTE} AvatarColorKey
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* All props are optional. Invalid `type`, `size`, and `corners` fall back silently.
|
|
6
|
+
*
|
|
7
|
+
* @typedef {object} AvatarProps
|
|
8
|
+
*
|
|
9
|
+
* @property {'default'|'photo'} [type='default']
|
|
10
|
+
* `'default'` shows initials; `'photo'` renders `<img>` when `src` is set.
|
|
11
|
+
* Default `'default'`.
|
|
12
|
+
* @property {'3xs'|'2xs'|'xs'|'s'|'m'|'l'} [size='2xs']
|
|
13
|
+
* Visual size token. Default `'2xs'`.
|
|
14
|
+
* @property {'round'|'square'} [corners='round']
|
|
15
|
+
* Border radius variant. Default `'round'`.
|
|
16
|
+
* @property {string} [initials='JD']
|
|
17
|
+
* Up to two characters, uppercased. Default `'JD'`.
|
|
18
|
+
* @property {string} [src]
|
|
19
|
+
* Image URL when `type` is `'photo'`.
|
|
20
|
+
* @property {string} [alt='']
|
|
21
|
+
* Alt text for the photo. Default `''`.
|
|
22
|
+
* @property {AvatarColorKey} [color]
|
|
23
|
+
* Key from `AVATAR_COLOR_PALETTE`. Unrecognized values default to `'purple'`.
|
|
24
|
+
* @property {string} [className]
|
|
25
|
+
* Extra class on the root `<div>`.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Avatar with initials or photo. Invalid enum props fall back to defaults.
|
|
29
|
+
*
|
|
30
|
+
* ## Props
|
|
31
|
+
*
|
|
32
|
+
* All optional.
|
|
33
|
+
*
|
|
34
|
+
* **type** `'default' | 'photo'` — default `'default'`
|
|
35
|
+
* `'default'` shows initials; `'photo'` renders `<img>` when `src` is set.
|
|
36
|
+
*
|
|
37
|
+
* **size** `'3xs' | '2xs' | 'xs' | 's' | 'm' | 'l'` — default `'2xs'`
|
|
38
|
+
* Visual size token.
|
|
39
|
+
*
|
|
40
|
+
* **corners** `'round' | 'square'` — default `'round'`
|
|
41
|
+
* Border radius variant.
|
|
42
|
+
*
|
|
43
|
+
* **initials** `string` — default `'JD'`
|
|
44
|
+
* Up to two characters, uppercased.
|
|
45
|
+
*
|
|
46
|
+
* **src** `string` — no default
|
|
47
|
+
* Image URL when `type` is `'photo'`.
|
|
48
|
+
*
|
|
49
|
+
* **alt** `string` — default `''`
|
|
50
|
+
* Alt text for the photo.
|
|
51
|
+
*
|
|
52
|
+
* **color** `AvatarColorKey` — default `'purple'`
|
|
53
|
+
* Key from `AVATAR_COLOR_PALETTE` (`'purple'`, `'turquoise'`, `'red'`, `'green'`, `'yellow'`, `'orange'`, `'greenyellow'`, `'pink'`, `'blue'`).
|
|
54
|
+
*
|
|
55
|
+
* **className** `string` — no default
|
|
56
|
+
* Extra class on the root `<div>`.
|
|
57
|
+
*
|
|
58
|
+
* @param {AvatarProps} props
|
|
59
|
+
* @returns {import('react').ReactElement}
|
|
60
|
+
*
|
|
61
|
+
* @example <caption>Default</caption>
|
|
62
|
+
* import { Avatar } from '@eyesee/ui-components';
|
|
63
|
+
*
|
|
64
|
+
* <Avatar type="default" size="2xs" corners="round" initials="JD" color="purple" />
|
|
65
|
+
*
|
|
66
|
+
* @example <caption>Photo</caption>
|
|
67
|
+
* import { Avatar } from '@eyesee/ui-components';
|
|
68
|
+
*
|
|
69
|
+
* <Avatar
|
|
70
|
+
* type="photo"
|
|
71
|
+
* size="2xs"
|
|
72
|
+
* corners="round"
|
|
73
|
+
* src="https://example.com/avatar.jpg"
|
|
74
|
+
* alt="Avatar photo"
|
|
75
|
+
* color="purple"
|
|
76
|
+
* />
|
|
77
|
+
*
|
|
78
|
+
* @example <caption>All variants</caption>
|
|
79
|
+
* import { Avatar } from '@eyesee/ui-components';
|
|
80
|
+
*
|
|
81
|
+
* <Avatar type="default" corners="round" size="m" initials="JD" color="purple" />
|
|
82
|
+
* <Avatar type="photo" corners="square" size="s" src="https://example.com/avatar.jpg" color="blue" />
|
|
83
|
+
*/
|
|
84
|
+
export function Avatar({ type, size, corners, initials, src, alt, color, className, }: AvatarProps): import("react").ReactElement;
|
|
85
|
+
export const AVATAR_SIZES: readonly ["3xs", "2xs", "xs", "s", "m", "l"];
|
|
86
|
+
export const AVATAR_CORNERS: readonly ["round", "square"];
|
|
87
|
+
export const AVATAR_TYPES: readonly ["default", "photo"];
|
|
88
|
+
export namespace AVATAR_COLOR_PALETTE {
|
|
89
|
+
let purple: "var(--color--background--avatar--purple)";
|
|
90
|
+
let turquoise: "var(--color--background--avatar--turquoise)";
|
|
91
|
+
let red: "var(--color--background--avatar--red)";
|
|
92
|
+
let green: "var(--color--background--avatar--green)";
|
|
93
|
+
let yellow: "var(--color--background--avatar--yellow)";
|
|
94
|
+
let orange: "var(--color--background--avatar--orange)";
|
|
95
|
+
let greenyellow: "var(--color--background--avatar--greenyellow)";
|
|
96
|
+
let pink: "var(--color--background--avatar--pink)";
|
|
97
|
+
let blue: "var(--color--background--avatar--blue)";
|
|
98
|
+
}
|
|
99
|
+
/** @type {(keyof typeof AVATAR_COLOR_PALETTE)[]} */
|
|
100
|
+
export const AVATAR_COLOR_PALETTE_KEYS: (keyof typeof AVATAR_COLOR_PALETTE)[];
|
|
101
|
+
export type AvatarColorKey = keyof typeof AVATAR_COLOR_PALETTE;
|
|
102
|
+
/**
|
|
103
|
+
* All props are optional. Invalid `type`, `size`, and `corners` fall back silently.
|
|
104
|
+
*/
|
|
105
|
+
export type AvatarProps = {
|
|
106
|
+
/**
|
|
107
|
+
* `'default'` shows initials; `'photo'` renders `<img>` when `src` is set.
|
|
108
|
+
* Default `'default'`.
|
|
109
|
+
*/
|
|
110
|
+
type?: "default" | "photo";
|
|
111
|
+
/**
|
|
112
|
+
* Visual size token. Default `'2xs'`.
|
|
113
|
+
*/
|
|
114
|
+
size?: "3xs" | "2xs" | "xs" | "s" | "m" | "l";
|
|
115
|
+
/**
|
|
116
|
+
* Border radius variant. Default `'round'`.
|
|
117
|
+
*/
|
|
118
|
+
corners?: "round" | "square";
|
|
119
|
+
/**
|
|
120
|
+
* Up to two characters, uppercased. Default `'JD'`.
|
|
121
|
+
*/
|
|
122
|
+
initials?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Image URL when `type` is `'photo'`.
|
|
125
|
+
*/
|
|
126
|
+
src?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Alt text for the photo. Default `''`.
|
|
129
|
+
*/
|
|
130
|
+
alt?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Key from `AVATAR_COLOR_PALETTE`. Unrecognized values default to `'purple'`.
|
|
133
|
+
*/
|
|
134
|
+
color?: AvatarColorKey;
|
|
135
|
+
/**
|
|
136
|
+
* Extra class on the root `<div>`.
|
|
137
|
+
*/
|
|
138
|
+
className?: string;
|
|
139
|
+
};
|
|
@@ -26,17 +26,18 @@ const b = (
|
|
|
26
26
|
), T = (
|
|
27
27
|
/** @type {(keyof typeof AVATAR_COLOR_PALETTE)[]} */
|
|
28
28
|
Object.keys(y)
|
|
29
|
-
)
|
|
29
|
+
);
|
|
30
|
+
function _({
|
|
30
31
|
type: o = "default",
|
|
31
32
|
size: e = "2xs",
|
|
32
33
|
corners: n = "round",
|
|
33
|
-
initials:
|
|
34
|
+
initials: c = "JD",
|
|
34
35
|
src: t,
|
|
35
|
-
alt:
|
|
36
|
+
alt: s = "",
|
|
36
37
|
color: l,
|
|
37
38
|
className: u
|
|
38
|
-
})
|
|
39
|
-
const d = b.includes(e) ? e : "2xs", i = k.includes(n) ? n : "round", v = m.includes(o) ? o : "default", p = String(
|
|
39
|
+
}) {
|
|
40
|
+
const d = b.includes(e) ? e : "2xs", i = k.includes(n) ? n : "round", v = m.includes(o) ? o : "default", p = String(c || "").trim().slice(0, 2).toUpperCase(), g = T.includes(l) ? l : "purple";
|
|
40
41
|
return /* @__PURE__ */ a(
|
|
41
42
|
"div",
|
|
42
43
|
{
|
|
@@ -47,10 +48,10 @@ const b = (
|
|
|
47
48
|
u
|
|
48
49
|
),
|
|
49
50
|
style: { backgroundColor: g },
|
|
50
|
-
children: v === "photo" && t ? /* @__PURE__ */ a("img", { className: r.photo, src: t, alt:
|
|
51
|
+
children: v === "photo" && t ? /* @__PURE__ */ a("img", { className: r.photo, src: t, alt: s }) : /* @__PURE__ */ a("span", { className: r.initials, children: p })
|
|
51
52
|
}
|
|
52
53
|
);
|
|
53
|
-
}
|
|
54
|
+
}
|
|
54
55
|
export {
|
|
55
56
|
y as AVATAR_COLOR_PALETTE,
|
|
56
57
|
T as AVATAR_COLOR_PALETTE_KEYS,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} BadgeProps
|
|
3
|
+
*
|
|
4
|
+
* @property {string} [label]
|
|
5
|
+
* Label (e.g. `"+100"`). Renders nothing when empty or null.
|
|
6
|
+
* @property {'rectangle'|'pill'} [shape='rectangle']
|
|
7
|
+
* Corner style. Default `'rectangle'`.
|
|
8
|
+
* @property {'neutral'|'warning'|'error'} [state='neutral']
|
|
9
|
+
* Colour variant. Default `'neutral'`.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Compact count / overflow badge. Renders nothing when `label` is empty.
|
|
13
|
+
*
|
|
14
|
+
* ## Props
|
|
15
|
+
*
|
|
16
|
+
* **label** `string` — no default
|
|
17
|
+
* Label (e.g. `"+100"`). Renders nothing when empty or null.
|
|
18
|
+
*
|
|
19
|
+
* **shape** `'rectangle' | 'pill'` — default `'rectangle'`
|
|
20
|
+
* Rectangle uses subtle radius; pill uses full radius.
|
|
21
|
+
*
|
|
22
|
+
* **state** `'neutral' | 'warning' | 'error'` — default `'neutral'`
|
|
23
|
+
* Background and text colours from design tokens.
|
|
24
|
+
*
|
|
25
|
+
* @param {BadgeProps} props
|
|
26
|
+
* @returns {import('react').ReactElement|null}
|
|
27
|
+
*
|
|
28
|
+
* @example <caption>Default</caption>
|
|
29
|
+
* import { Badge } from '@eyesee/ui-components';
|
|
30
|
+
*
|
|
31
|
+
* <Badge label="+100" shape="rectangle" state="neutral" />
|
|
32
|
+
*
|
|
33
|
+
* @example <caption>All shapes and states</caption>
|
|
34
|
+
* import { Badge } from '@eyesee/ui-components';
|
|
35
|
+
*
|
|
36
|
+
* <Badge label="+100" shape="rectangle" state="neutral" />
|
|
37
|
+
* <Badge label="+100" shape="pill" state="warning" />
|
|
38
|
+
* <Badge label="+100" shape="rectangle" state="error" />
|
|
39
|
+
*
|
|
40
|
+
* @example <caption>On image (context)</caption>
|
|
41
|
+
* import { Badge } from '@eyesee/ui-components';
|
|
42
|
+
*
|
|
43
|
+
* <Badge label="+12" shape="rectangle" state="neutral" />
|
|
44
|
+
*/
|
|
45
|
+
export function Badge({ label, shape, state }: BadgeProps): import("react").ReactElement | null;
|
|
46
|
+
export type BadgeProps = {
|
|
47
|
+
/**
|
|
48
|
+
* Label (e.g. `"+100"`). Renders nothing when empty or null.
|
|
49
|
+
*/
|
|
50
|
+
label?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Corner style. Default `'rectangle'`.
|
|
53
|
+
*/
|
|
54
|
+
shape?: "rectangle" | "pill";
|
|
55
|
+
/**
|
|
56
|
+
* Colour variant. Default `'neutral'`.
|
|
57
|
+
*/
|
|
58
|
+
state?: "neutral" | "warning" | "error";
|
|
59
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { getBadgeStyles as a } from "./badgeVariants.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import u from "./Badge.module.scss.js";
|
|
4
|
+
function m({ label: r, shape: o = "rectangle", state: e = "neutral" }) {
|
|
5
5
|
if (r == null || r === "") return null;
|
|
6
|
-
const { backgroundColor: t, color: n, borderRadius:
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
}
|
|
6
|
+
const { backgroundColor: t, color: n, borderRadius: l } = a(o, e);
|
|
7
|
+
return /* @__PURE__ */ s("span", { className: u.badge, style: { backgroundColor: t, color: n, borderRadius: l }, children: r });
|
|
8
|
+
}
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
m as Badge
|
|
11
11
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {'rectangle'|'pill'} shape
|
|
3
|
+
* @param {'neutral'|'warning'|'error'} state
|
|
4
|
+
* @returns {{ backgroundColor: string; color: string; borderRadius: string }}
|
|
5
|
+
*/
|
|
6
|
+
export function getBadgeStyles(shape: "rectangle" | "pill", state: "neutral" | "warning" | "error"): {
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
color: string;
|
|
9
|
+
borderRadius: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Image overflow / count badge from Figma (Components for DEV).
|
|
13
|
+
* `shape`: rectangle (4px) | pill (full radius)
|
|
14
|
+
* `state`: neutral | warning | error
|
|
15
|
+
*/
|
|
16
|
+
export const SHAPES: string[];
|
|
17
|
+
export const STATES: string[];
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @callback ButtonClickHandler
|
|
3
|
+
* @param {ButtonOption} [option] Chosen dropdown item. Omitted on a plain click.
|
|
4
|
+
* @returns {void}
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Dropdown row. Extra fields are spread onto {@link ListItem}.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {object} ButtonOption
|
|
10
|
+
* @property {string} value - Unique React key.
|
|
11
|
+
* @property {string} label - Row text.
|
|
12
|
+
* @property {React.ReactNode} [icon] - Leading icon (`ListItem.controlItem`).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Extra {@link Tooltip} props. Used only when `tooltipContent` is set.
|
|
16
|
+
*
|
|
17
|
+
* @typedef {object} ButtonTooltipProps
|
|
18
|
+
* @property {'top'|'bottom'|'left'|'right'} [position='bottom']
|
|
19
|
+
* @property {'dark'|'light'} [variant='light']
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* All props are optional. Rest props go to the wrapper `<div>`.
|
|
23
|
+
*
|
|
24
|
+
* @typedef {object} ButtonProps
|
|
25
|
+
*
|
|
26
|
+
* @property {string} [text]
|
|
27
|
+
* Label. Omit with `icon` (no dropdown) for icon-only.
|
|
28
|
+
* @property {React.ReactNode} [icon]
|
|
29
|
+
* Leading icon. Default `null`.
|
|
30
|
+
*
|
|
31
|
+
* @property {'lg'|'md'|'sm'|'xs'|'xxs'|'xxxs'} [size='md']
|
|
32
|
+
* Height and padding. Default `'md'`.
|
|
33
|
+
* @property {'primary'|'secondary'|'neutral'|'destructive'} [variant='primary']
|
|
34
|
+
* Colour. Default `'primary'`.
|
|
35
|
+
* @property {'fill'|'outline'|'blank'} [type='fill']
|
|
36
|
+
* Visual style, not HTML `type`. Default `'fill'`.
|
|
37
|
+
* @property {boolean} [fullWidth=false]
|
|
38
|
+
* Stretch to 100% width. Default `false`.
|
|
39
|
+
* @property {string} [className]
|
|
40
|
+
* Extra class on the wrapper `<div>`.
|
|
41
|
+
*
|
|
42
|
+
* @property {boolean} [disabled=false]
|
|
43
|
+
* Native disabled. Blocks clicks and dropdown. Default `false`.
|
|
44
|
+
* @property {boolean} [pressed=false]
|
|
45
|
+
* Toggle / selected look (`aria-pressed`). Default `false`.
|
|
46
|
+
*
|
|
47
|
+
* @property {ButtonClickHandler} [onClick]
|
|
48
|
+
* Plain click: no args. Dropdown: fired with the chosen option, not on
|
|
49
|
+
* open/close. Default `() => {}`.
|
|
50
|
+
*
|
|
51
|
+
* @property {ButtonOption[]} [options=[]]
|
|
52
|
+
* Non-empty → {@link ListItem} dropdown. Default `[]`.
|
|
53
|
+
* @property {'start'|'end'} [dropdownAlign='start']
|
|
54
|
+
* `'start'` left edges, `'end'` right edges. Default `'start'`.
|
|
55
|
+
* @property {React.ReactNode} [dropdownCustomContent]
|
|
56
|
+
* Custom dropdown body. Enables dropdown even if `options` is empty.
|
|
57
|
+
* Default `null`.
|
|
58
|
+
* @property {'s'|'m'|'l'|'xl'|'xxl'|'4xl'} [iconSize='m']
|
|
59
|
+
* Dropdown chevron size only. Default `'m'`.
|
|
60
|
+
*
|
|
61
|
+
* @property {React.ReactNode} [tooltipContent]
|
|
62
|
+
* Wraps the button in {@link Tooltip} when set. Default `null`.
|
|
63
|
+
* @property {string} [tooltipTitle]
|
|
64
|
+
* Tooltip heading.
|
|
65
|
+
* @property {ButtonTooltipProps} [tooltipProps]
|
|
66
|
+
* Extra {@link Tooltip} props. Default `{ position: 'bottom', variant: 'light' }`.
|
|
67
|
+
*
|
|
68
|
+
* @see {@link Tooltip}
|
|
69
|
+
* @see {@link ListItem}
|
|
70
|
+
* @see {@link DropdownList}
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* Action button. Dropdown when `options` or `dropdownCustomContent` is set.
|
|
74
|
+
*
|
|
75
|
+
* ## Props
|
|
76
|
+
*
|
|
77
|
+
* All optional. Rest props go to the wrapper `<div>`.
|
|
78
|
+
*
|
|
79
|
+
* **text** `string` — no default
|
|
80
|
+
* Button label. Omit with `icon` (no dropdown) for icon-only.
|
|
81
|
+
*
|
|
82
|
+
* **icon** `ReactNode` — default `null`
|
|
83
|
+
* Leading icon.
|
|
84
|
+
*
|
|
85
|
+
* **size** `'lg' | 'md' | 'sm' | 'xs' | 'xxs' | 'xxxs'` — default `'md'`
|
|
86
|
+
* Height and padding.
|
|
87
|
+
*
|
|
88
|
+
* **variant** `'primary' | 'secondary' | 'neutral' | 'destructive'` — default `'primary'`
|
|
89
|
+
* Colour.
|
|
90
|
+
*
|
|
91
|
+
* **type** `'fill' | 'outline' | 'blank'` — default `'fill'`
|
|
92
|
+
* Visual style (not HTML `type`).
|
|
93
|
+
*
|
|
94
|
+
* **fullWidth** `boolean` — default `false`
|
|
95
|
+
* Stretch to 100% width.
|
|
96
|
+
*
|
|
97
|
+
* **className** `string` — no default
|
|
98
|
+
* Extra class on the wrapper `<div>`.
|
|
99
|
+
*
|
|
100
|
+
* **disabled** `boolean` — default `false`
|
|
101
|
+
* Native disabled. Blocks clicks and dropdown.
|
|
102
|
+
*
|
|
103
|
+
* **pressed** `boolean` — default `false`
|
|
104
|
+
* Toggle / selected look (`aria-pressed`).
|
|
105
|
+
*
|
|
106
|
+
* **onClick** `(option?: ButtonOption) => void` — default `() => {}`
|
|
107
|
+
* Plain click: no args. Dropdown: fired with the chosen option, not on open/close.
|
|
108
|
+
*
|
|
109
|
+
* **options** `ButtonOption[]` — default `[]`
|
|
110
|
+
* Non-empty → {@link ListItem} dropdown. Extra item fields go to ListItem.
|
|
111
|
+
* - `value` `string` — required. Unique React key.
|
|
112
|
+
* - `label` `string` — required. Row text.
|
|
113
|
+
* - `icon` `ReactNode` — optional. Leading icon.
|
|
114
|
+
*
|
|
115
|
+
* **dropdownAlign** `'start' | 'end'` — default `'start'`
|
|
116
|
+
* `'start'` left edges, `'end'` right edges.
|
|
117
|
+
*
|
|
118
|
+
* **dropdownCustomContent** `ReactNode` — default `null`
|
|
119
|
+
* Custom dropdown body. Enables dropdown even if `options` is empty.
|
|
120
|
+
*
|
|
121
|
+
* **iconSize** `'s' | 'm' | 'l' | 'xl' | 'xxl' | '4xl'` — default `'m'`
|
|
122
|
+
* Dropdown chevron size only.
|
|
123
|
+
*
|
|
124
|
+
* **tooltipContent** `ReactNode` — default `null`
|
|
125
|
+
* Wraps the button in {@link Tooltip} when set.
|
|
126
|
+
*
|
|
127
|
+
* **tooltipTitle** `string` — no default
|
|
128
|
+
* Tooltip heading.
|
|
129
|
+
*
|
|
130
|
+
* **tooltipProps** `ButtonTooltipProps` — default `{ position: 'bottom', variant: 'light' }`
|
|
131
|
+
* Extra {@link Tooltip} props. Used only when `tooltipContent` is set.
|
|
132
|
+
* - `position` `'top' | 'bottom' | 'left' | 'right'` — default `'bottom'`
|
|
133
|
+
* - `variant` `'dark' | 'light'` — default `'light'`
|
|
134
|
+
*
|
|
135
|
+
* @param {ButtonProps} props
|
|
136
|
+
* @returns {import('react').ReactElement}
|
|
137
|
+
*
|
|
138
|
+
* @example <caption>Default</caption>
|
|
139
|
+
* import { Button } from '@eyesee/ui-components';
|
|
140
|
+
*
|
|
141
|
+
* <Button text="Button" />
|
|
142
|
+
*
|
|
143
|
+
* @example <caption>With icon</caption>
|
|
144
|
+
* import { Button } from '@eyesee/ui-components';
|
|
145
|
+
* import { PlusIcon } from '@eyesee/ui-components/icons';
|
|
146
|
+
*
|
|
147
|
+
* <Button text="Button" icon={<PlusIcon />} />
|
|
148
|
+
*
|
|
149
|
+
* @example <caption>Icon-only with tooltip</caption>
|
|
150
|
+
* import { Button } from '@eyesee/ui-components';
|
|
151
|
+
* import { PlusIcon } from '@eyesee/ui-components/icons';
|
|
152
|
+
*
|
|
153
|
+
* <Button icon={<PlusIcon />} tooltipContent="Add item" />
|
|
154
|
+
*
|
|
155
|
+
* @example <caption>Dropdown</caption>
|
|
156
|
+
* import { Button } from '@eyesee/ui-components';
|
|
157
|
+
*
|
|
158
|
+
* <Button
|
|
159
|
+
* text="Button"
|
|
160
|
+
* options={[
|
|
161
|
+
* { value: 'edit', label: 'Edit' },
|
|
162
|
+
* { value: 'delete', label: 'Delete' },
|
|
163
|
+
* { value: 'export', label: 'Export' },
|
|
164
|
+
* ]}
|
|
165
|
+
* />
|
|
166
|
+
*
|
|
167
|
+
* @example <caption>Pressed</caption>
|
|
168
|
+
* import { Button } from '@eyesee/ui-components';
|
|
169
|
+
*
|
|
170
|
+
* <Button text="Button" pressed />
|
|
171
|
+
*
|
|
172
|
+
* @example <caption>Fill, outline, blank, disabled</caption>
|
|
173
|
+
* import { Button } from '@eyesee/ui-components';
|
|
174
|
+
*
|
|
175
|
+
* <Button text="Button" type="fill" />
|
|
176
|
+
* <Button text="Button" type="outline" />
|
|
177
|
+
* <Button text="Button" type="blank" />
|
|
178
|
+
* <Button text="Button" disabled />
|
|
179
|
+
*
|
|
180
|
+
* @example <caption>Full width</caption>
|
|
181
|
+
* import { Button } from '@eyesee/ui-components';
|
|
182
|
+
*
|
|
183
|
+
* <Button text="Button" fullWidth />
|
|
184
|
+
*
|
|
185
|
+
* @example <caption>Dropdown with custom content</caption>
|
|
186
|
+
* import { Button, ListItem } from '@eyesee/ui-components';
|
|
187
|
+
*
|
|
188
|
+
* <Button
|
|
189
|
+
* text="Actions"
|
|
190
|
+
* dropdownCustomContent={
|
|
191
|
+
* <>
|
|
192
|
+
* <ListItem role="menuitem" title="Edit" horizontalSpacing="xs" verticalSpacing="none" />
|
|
193
|
+
* <ListItem role="menuitem" title="Duplicate" horizontalSpacing="xs" verticalSpacing="none" />
|
|
194
|
+
* <ListItem role="menuitem" title="Delete" horizontalSpacing="xs" verticalSpacing="none" />
|
|
195
|
+
* </>
|
|
196
|
+
* }
|
|
197
|
+
* />
|
|
198
|
+
*/
|
|
199
|
+
export function Button({ text, options, onClick, className, iconSize, size, variant, type, pressed, icon, tooltipContent, tooltipTitle, disabled, fullWidth, dropdownAlign, tooltipProps, dropdownCustomContent, ...props }: ButtonProps): import("react").ReactElement;
|
|
200
|
+
export type ButtonClickHandler = (option?: ButtonOption) => void;
|
|
201
|
+
/**
|
|
202
|
+
* Dropdown row. Extra fields are spread onto {@link ListItem}.
|
|
203
|
+
*/
|
|
204
|
+
export type ButtonOption = {
|
|
205
|
+
/**
|
|
206
|
+
* - Unique React key.
|
|
207
|
+
*/
|
|
208
|
+
value: string;
|
|
209
|
+
/**
|
|
210
|
+
* - Row text.
|
|
211
|
+
*/
|
|
212
|
+
label: string;
|
|
213
|
+
/**
|
|
214
|
+
* - Leading icon (`ListItem.controlItem`).
|
|
215
|
+
*/
|
|
216
|
+
icon?: React.ReactNode;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* Extra {@link Tooltip} props. Used only when `tooltipContent` is set.
|
|
220
|
+
*/
|
|
221
|
+
export type ButtonTooltipProps = {
|
|
222
|
+
position?: "top" | "bottom" | "left" | "right";
|
|
223
|
+
variant?: "dark" | "light";
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* All props are optional. Rest props go to the wrapper `<div>`.
|
|
227
|
+
*/
|
|
228
|
+
export type ButtonProps = {
|
|
229
|
+
/**
|
|
230
|
+
* Label. Omit with `icon` (no dropdown) for icon-only.
|
|
231
|
+
*/
|
|
232
|
+
text?: string;
|
|
233
|
+
/**
|
|
234
|
+
* Leading icon. Default `null`.
|
|
235
|
+
*/
|
|
236
|
+
icon?: React.ReactNode;
|
|
237
|
+
/**
|
|
238
|
+
* Height and padding. Default `'md'`.
|
|
239
|
+
*/
|
|
240
|
+
size?: "lg" | "md" | "sm" | "xs" | "xxs" | "xxxs";
|
|
241
|
+
/**
|
|
242
|
+
* Colour. Default `'primary'`.
|
|
243
|
+
*/
|
|
244
|
+
variant?: "primary" | "secondary" | "neutral" | "destructive";
|
|
245
|
+
/**
|
|
246
|
+
* Visual style, not HTML `type`. Default `'fill'`.
|
|
247
|
+
*/
|
|
248
|
+
type?: "fill" | "outline" | "blank";
|
|
249
|
+
/**
|
|
250
|
+
* Stretch to 100% width. Default `false`.
|
|
251
|
+
*/
|
|
252
|
+
fullWidth?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Extra class on the wrapper `<div>`.
|
|
255
|
+
*/
|
|
256
|
+
className?: string;
|
|
257
|
+
/**
|
|
258
|
+
* Native disabled. Blocks clicks and dropdown. Default `false`.
|
|
259
|
+
*/
|
|
260
|
+
disabled?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Toggle / selected look (`aria-pressed`). Default `false`.
|
|
263
|
+
*/
|
|
264
|
+
pressed?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Plain click: no args. Dropdown: fired with the chosen option, not on
|
|
267
|
+
* open/close. Default `() => {}`.
|
|
268
|
+
*/
|
|
269
|
+
onClick?: ButtonClickHandler;
|
|
270
|
+
/**
|
|
271
|
+
* Non-empty → {@link ListItem} dropdown. Default `[]`.
|
|
272
|
+
*/
|
|
273
|
+
options?: ButtonOption[];
|
|
274
|
+
/**
|
|
275
|
+
* `'start'` left edges, `'end'` right edges. Default `'start'`.
|
|
276
|
+
*/
|
|
277
|
+
dropdownAlign?: "start" | "end";
|
|
278
|
+
/**
|
|
279
|
+
* Custom dropdown body. Enables dropdown even if `options` is empty.
|
|
280
|
+
* Default `null`.
|
|
281
|
+
*/
|
|
282
|
+
dropdownCustomContent?: React.ReactNode;
|
|
283
|
+
/**
|
|
284
|
+
* Dropdown chevron size only. Default `'m'`.
|
|
285
|
+
*/
|
|
286
|
+
iconSize?: "s" | "m" | "l" | "xl" | "xxl" | "4xl";
|
|
287
|
+
/**
|
|
288
|
+
* Wraps the button in {@link Tooltip} when set. Default `null`.
|
|
289
|
+
*/
|
|
290
|
+
tooltipContent?: React.ReactNode;
|
|
291
|
+
/**
|
|
292
|
+
* Tooltip heading.
|
|
293
|
+
*/
|
|
294
|
+
tooltipTitle?: string;
|
|
295
|
+
/**
|
|
296
|
+
* Extra {@link Tooltip} props. Default `{ position: 'bottom', variant: 'light' }`.
|
|
297
|
+
*/
|
|
298
|
+
tooltipProps?: ButtonTooltipProps;
|
|
299
|
+
};
|
|
@@ -8,7 +8,7 @@ import { ListItem as U } from "../ListItem/ListItem.js";
|
|
|
8
8
|
import { DropdownList as q } from "../DropdownList/DropdownList.js";
|
|
9
9
|
import { Tooltip as z } from "../Tooltip/Tooltip.js";
|
|
10
10
|
import e from "./Button.module.scss.js";
|
|
11
|
-
|
|
11
|
+
function Y({
|
|
12
12
|
text: l,
|
|
13
13
|
options: p = [],
|
|
14
14
|
onClick: u = () => {
|
|
@@ -28,7 +28,7 @@ const Y = ({
|
|
|
28
28
|
tooltipProps: k = { position: "bottom", variant: "light" },
|
|
29
29
|
dropdownCustomContent: s = null,
|
|
30
30
|
...B
|
|
31
|
-
})
|
|
31
|
+
}) {
|
|
32
32
|
const [o, i] = L(!1), b = R(null);
|
|
33
33
|
E(b, () => i(!1));
|
|
34
34
|
const T = (n) => {
|
|
@@ -95,7 +95,7 @@ const Y = ({
|
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
97
|
return C ? /* @__PURE__ */ r(z, { title: g, content: d, ...k, children: I }) : I;
|
|
98
|
-
}
|
|
98
|
+
}
|
|
99
99
|
export {
|
|
100
100
|
Y as Button
|
|
101
101
|
};
|