@borisj74/bv-ds 0.1.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/LICENSE +21 -0
- package/README.md +94 -0
- package/dist/index.cjs +33885 -0
- package/dist/index.d.cts +2715 -0
- package/dist/index.d.ts +2715 -0
- package/dist/index.js +33717 -0
- package/package.json +67 -0
- package/src/components/ActivityFeed/ActivityFeed.tsx +48 -0
- package/src/components/ActivityFeed/index.ts +2 -0
- package/src/components/ActivityGauge/ActivityGauge.tsx +155 -0
- package/src/components/ActivityGauge/index.ts +7 -0
- package/src/components/AdvancedFilterBar/AdvancedFilterBar.tsx +80 -0
- package/src/components/AdvancedFilterBar/index.ts +2 -0
- package/src/components/Alert/Alert.tsx +210 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/Avatar/Avatar.tsx +111 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/AvatarAddButton/AvatarAddButton.tsx +65 -0
- package/src/components/AvatarAddButton/index.ts +5 -0
- package/src/components/AvatarGroup/AvatarGroup.tsx +79 -0
- package/src/components/AvatarGroup/index.ts +6 -0
- package/src/components/AvatarLabelGroup/AvatarLabelGroup.tsx +62 -0
- package/src/components/AvatarLabelGroup/index.ts +5 -0
- package/src/components/AvatarProfilePhoto/AvatarProfilePhoto.tsx +117 -0
- package/src/components/AvatarProfilePhoto/index.ts +5 -0
- package/src/components/Badge/ColorBadge.tsx +36 -0
- package/src/components/Badge/ModernBadge.tsx +38 -0
- package/src/components/Badge/PillBadge.tsx +36 -0
- package/src/components/Badge/badgeShared.tsx +139 -0
- package/src/components/Badge/index.ts +7 -0
- package/src/components/BadgeCloseX/BadgeCloseX.tsx +64 -0
- package/src/components/BadgeCloseX/index.ts +2 -0
- package/src/components/BadgeGroup/BadgeGroup.tsx +61 -0
- package/src/components/BadgeGroup/index.ts +7 -0
- package/src/components/BreadcrumbButtonBase/BreadcrumbButtonBase.tsx +75 -0
- package/src/components/BreadcrumbButtonBase/index.ts +5 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +62 -0
- package/src/components/Breadcrumbs/index.ts +2 -0
- package/src/components/Button/Button.tsx +71 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/ButtonCloseX/ButtonCloseX.tsx +54 -0
- package/src/components/ButtonCloseX/index.ts +2 -0
- package/src/components/ButtonDestructive/ButtonDestructive.tsx +67 -0
- package/src/components/ButtonDestructive/index.ts +6 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +28 -0
- package/src/components/ButtonGroup/index.ts +2 -0
- package/src/components/ButtonGroupSegment/ButtonGroupSegment.tsx +54 -0
- package/src/components/ButtonGroupSegment/index.ts +5 -0
- package/src/components/ButtonUtility/ButtonUtility.tsx +67 -0
- package/src/components/ButtonUtility/index.ts +6 -0
- package/src/components/CalendarCell/CalendarCell.tsx +82 -0
- package/src/components/CalendarCell/index.ts +2 -0
- package/src/components/CalendarCellDayWeekView/CalendarCellDayWeekView.tsx +56 -0
- package/src/components/CalendarCellDayWeekView/index.ts +2 -0
- package/src/components/CalendarColumnHeader/CalendarColumnHeader.tsx +45 -0
- package/src/components/CalendarColumnHeader/index.ts +5 -0
- package/src/components/CalendarDateIcon/CalendarDateIcon.tsx +25 -0
- package/src/components/CalendarDateIcon/index.ts +2 -0
- package/src/components/CalendarEvent/CalendarEvent.tsx +76 -0
- package/src/components/CalendarEvent/index.ts +2 -0
- package/src/components/CalendarEventDayWeekView/CalendarEventDayWeekView.tsx +76 -0
- package/src/components/CalendarEventDayWeekView/index.ts +2 -0
- package/src/components/CalendarHeader/CalendarHeader.tsx +47 -0
- package/src/components/CalendarHeader/index.ts +2 -0
- package/src/components/CalendarRowLabel/CalendarRowLabel.tsx +21 -0
- package/src/components/CalendarRowLabel/index.ts +2 -0
- package/src/components/CalendarTimemarker/CalendarTimemarker.tsx +46 -0
- package/src/components/CalendarTimemarker/index.ts +5 -0
- package/src/components/CalendarViewDropdown/CalendarViewDropdown.tsx +101 -0
- package/src/components/CalendarViewDropdown/index.ts +6 -0
- package/src/components/CardHeader/CardHeader.tsx +57 -0
- package/src/components/CardHeader/index.ts +2 -0
- package/src/components/CarouselArrow/CarouselArrow.tsx +47 -0
- package/src/components/CarouselArrow/index.ts +6 -0
- package/src/components/CarouselImage/CarouselImage.tsx +60 -0
- package/src/components/CarouselImage/index.ts +2 -0
- package/src/components/Change/Change.tsx +73 -0
- package/src/components/Change/index.ts +2 -0
- package/src/components/ChartLegend/ChartLegend.tsx +38 -0
- package/src/components/ChartLegend/index.ts +2 -0
- package/src/components/ChartMarker/ChartMarker.tsx +54 -0
- package/src/components/ChartMarker/index.ts +2 -0
- package/src/components/ChartMini/ChartMini.tsx +86 -0
- package/src/components/ChartMini/index.ts +2 -0
- package/src/components/ChartTooltip/ChartTooltip.tsx +44 -0
- package/src/components/ChartTooltip/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.tsx +65 -0
- package/src/components/Checkbox/checkboxBase.tsx +81 -0
- package/src/components/Checkbox/index.ts +3 -0
- package/src/components/CodeSnippet/CodeSnippet.tsx +94 -0
- package/src/components/CodeSnippet/index.ts +2 -0
- package/src/components/CodeSnippetTabs/CodeSnippetTabs.tsx +44 -0
- package/src/components/CodeSnippetTabs/index.ts +2 -0
- package/src/components/CommandBar/CommandBar.tsx +80 -0
- package/src/components/CommandBar/index.ts +2 -0
- package/src/components/CommandBarFooter/CommandBarFooter.tsx +125 -0
- package/src/components/CommandBarFooter/index.ts +5 -0
- package/src/components/CommandBarMenuSection/CommandBarMenuSection.tsx +28 -0
- package/src/components/CommandBarMenuSection/index.ts +2 -0
- package/src/components/CommandBarNavigationIcon/CommandBarNavigationIcon.tsx +47 -0
- package/src/components/CommandBarNavigationIcon/index.ts +2 -0
- package/src/components/CommandDropdownMenuItem/CommandDropdownMenuItem.tsx +51 -0
- package/src/components/CommandDropdownMenuItem/index.ts +2 -0
- package/src/components/CommandInput/CommandInput.tsx +74 -0
- package/src/components/CommandInput/index.ts +2 -0
- package/src/components/CommandShortcut/CommandShortcut.tsx +26 -0
- package/src/components/CommandShortcut/index.ts +2 -0
- package/src/components/ContentDivider/ContentDivider.tsx +80 -0
- package/src/components/ContentDivider/index.ts +6 -0
- package/src/components/ContentFeatureText/ContentFeatureText.tsx +60 -0
- package/src/components/ContentFeatureText/index.ts +5 -0
- package/src/components/ContentHeading/ContentHeading.tsx +43 -0
- package/src/components/ContentHeading/index.ts +5 -0
- package/src/components/ContentParagraph/ContentParagraph.tsx +39 -0
- package/src/components/ContentParagraph/index.ts +5 -0
- package/src/components/ContentQuote/ContentQuote.tsx +114 -0
- package/src/components/ContentQuote/index.ts +6 -0
- package/src/components/ContentRule/ContentRule.tsx +31 -0
- package/src/components/ContentRule/index.ts +2 -0
- package/src/components/ContextMenu/ContextMenu.tsx +67 -0
- package/src/components/ContextMenu/index.ts +7 -0
- package/src/components/ContextMenu/useContextMenu.ts +41 -0
- package/src/components/DatePickerCell/DatePickerCell.tsx +77 -0
- package/src/components/DatePickerCell/index.ts +2 -0
- package/src/components/DatePickerListItem/DatePickerListItem.tsx +39 -0
- package/src/components/DatePickerListItem/index.ts +2 -0
- package/src/components/DatePickerMenu/DatePickerMenu.tsx +131 -0
- package/src/components/DatePickerMenu/index.ts +2 -0
- package/src/components/DropdownAccountListItem/DropdownAccountListItem.tsx +69 -0
- package/src/components/DropdownAccountListItem/index.ts +2 -0
- package/src/components/DropdownMenuFooter/DropdownMenuFooter.tsx +50 -0
- package/src/components/DropdownMenuFooter/index.ts +5 -0
- package/src/components/DropdownMenuHeader/DropdownMenuHeader.tsx +93 -0
- package/src/components/DropdownMenuHeader/index.ts +5 -0
- package/src/components/DropdownMenuItemInsetIcon/DropdownMenuItemInsetIcon.tsx +89 -0
- package/src/components/DropdownMenuItemInsetIcon/index.ts +5 -0
- package/src/components/DropdownMenuListItem/DropdownMenuListItem.tsx +84 -0
- package/src/components/DropdownMenuListItem/index.ts +2 -0
- package/src/components/EmptyState/EmptyState.tsx +65 -0
- package/src/components/EmptyState/index.ts +2 -0
- package/src/components/FeedItemBase/FeedItemBase.tsx +135 -0
- package/src/components/FeedItemBase/index.ts +2 -0
- package/src/components/FileUpload/FileUpload.tsx +112 -0
- package/src/components/FileUpload/index.ts +2 -0
- package/src/components/FileUploadBase/FileUploadBase.tsx +69 -0
- package/src/components/FileUploadBase/index.ts +2 -0
- package/src/components/FileUploadItemBase/FileUploadItemBase.tsx +190 -0
- package/src/components/FileUploadItemBase/index.ts +7 -0
- package/src/components/FilterBar/FilterBar.tsx +62 -0
- package/src/components/FilterBar/index.ts +2 -0
- package/src/components/FilterTabs/FilterTabs.tsx +41 -0
- package/src/components/FilterTabs/index.ts +2 -0
- package/src/components/FiltersDropdownMenu/FiltersDropdownMenu.tsx +104 -0
- package/src/components/FiltersDropdownMenu/index.ts +2 -0
- package/src/components/FiltersSlideoutMenu/FiltersSlideoutMenu.tsx +71 -0
- package/src/components/FiltersSlideoutMenu/index.ts +2 -0
- package/src/components/HeaderNavigation/HeaderNavigation.tsx +178 -0
- package/src/components/HeaderNavigation/index.ts +6 -0
- package/src/components/HelpIcon/HelpIcon.tsx +49 -0
- package/src/components/HelpIcon/index.ts +2 -0
- package/src/components/InputField/InputField.tsx +108 -0
- package/src/components/InputField/index.ts +3 -0
- package/src/components/InputField/inputFieldShared.tsx +68 -0
- package/src/components/LeadingInputField/LeadingInputField.tsx +60 -0
- package/src/components/LeadingInputField/index.ts +2 -0
- package/src/components/LineAndBarChart/LineAndBarChart.tsx +96 -0
- package/src/components/LineAndBarChart/index.ts +2 -0
- package/src/components/LinkMessage/LinkMessage.tsx +52 -0
- package/src/components/LinkMessage/index.ts +2 -0
- package/src/components/LoadingIndicator/LoadingIndicator.tsx +108 -0
- package/src/components/LoadingIndicator/index.ts +6 -0
- package/src/components/MediaMessage/MediaMessage.tsx +109 -0
- package/src/components/MediaMessage/index.ts +2 -0
- package/src/components/MegaInputFieldBase/MegaInputFieldBase.tsx +49 -0
- package/src/components/MegaInputFieldBase/index.ts +5 -0
- package/src/components/Message/Message.tsx +85 -0
- package/src/components/Message/index.ts +3 -0
- package/src/components/Message/messageShared.tsx +73 -0
- package/src/components/MessageAction/MessageAction.tsx +221 -0
- package/src/components/MessageAction/index.ts +2 -0
- package/src/components/MessageActionButton/MessageActionButton.tsx +36 -0
- package/src/components/MessageActionButton/index.ts +2 -0
- package/src/components/MessageActionPanel/MessageActionPanel.tsx +36 -0
- package/src/components/MessageActionPanel/index.ts +2 -0
- package/src/components/MessageReaction/MessageReaction.tsx +37 -0
- package/src/components/MessageReaction/index.ts +2 -0
- package/src/components/MessageStatusIcon/MessageStatusIcon.tsx +54 -0
- package/src/components/MessageStatusIcon/index.ts +2 -0
- package/src/components/MetricItem/MetricItem.tsx +147 -0
- package/src/components/MetricItem/index.ts +2 -0
- package/src/components/ModalActions/ModalActions.tsx +57 -0
- package/src/components/ModalActions/index.ts +2 -0
- package/src/components/ModalHeader/ModalHeader.tsx +99 -0
- package/src/components/ModalHeader/index.ts +2 -0
- package/src/components/MultiSelect/MultiSelect.tsx +118 -0
- package/src/components/MultiSelect/index.ts +2 -0
- package/src/components/NavAccountCard/NavAccountCard.tsx +124 -0
- package/src/components/NavAccountCard/index.ts +2 -0
- package/src/components/NavAccountCardMenuItem/NavAccountCardMenuItem.tsx +101 -0
- package/src/components/NavAccountCardMenuItem/index.ts +5 -0
- package/src/components/NavButton/NavButton.tsx +50 -0
- package/src/components/NavButton/index.ts +2 -0
- package/src/components/NavFeaturedCard/NavFeaturedCard.tsx +82 -0
- package/src/components/NavFeaturedCard/index.ts +2 -0
- package/src/components/NavItemBase/NavItemBase.tsx +79 -0
- package/src/components/NavItemBase/index.ts +2 -0
- package/src/components/NavItemDropdownBase/NavItemDropdownBase.tsx +74 -0
- package/src/components/NavItemDropdownBase/index.ts +2 -0
- package/src/components/NavMenuButton/NavMenuButton.tsx +47 -0
- package/src/components/NavMenuButton/index.ts +2 -0
- package/src/components/Notification/Notification.tsx +102 -0
- package/src/components/Notification/index.ts +2 -0
- package/src/components/NumberInput/NumberInput.tsx +114 -0
- package/src/components/NumberInput/index.ts +2 -0
- package/src/components/PageHeader/PageHeader.tsx +88 -0
- package/src/components/PageHeader/index.ts +2 -0
- package/src/components/Pagination/Pagination.tsx +124 -0
- package/src/components/Pagination/index.ts +2 -0
- package/src/components/PaginationButtonGroupBase/PaginationButtonGroupBase.tsx +69 -0
- package/src/components/PaginationButtonGroupBase/index.ts +5 -0
- package/src/components/PaginationCards/PaginationCards.tsx +72 -0
- package/src/components/PaginationCards/index.ts +2 -0
- package/src/components/PaginationDotGroup/PaginationDotGroup.tsx +66 -0
- package/src/components/PaginationDotGroup/index.ts +2 -0
- package/src/components/PaginationDotIndicator/PaginationDotIndicator.tsx +39 -0
- package/src/components/PaginationDotIndicator/index.ts +6 -0
- package/src/components/PaginationNumberBase/PaginationNumberBase.tsx +42 -0
- package/src/components/PaginationNumberBase/index.ts +5 -0
- package/src/components/PieChart/PieChart.tsx +73 -0
- package/src/components/PieChart/index.ts +2 -0
- package/src/components/ProgressBar/ProgressBar.tsx +75 -0
- package/src/components/ProgressBar/index.ts +2 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +89 -0
- package/src/components/ProgressCircle/index.ts +6 -0
- package/src/components/RadarChart/RadarChart.tsx +62 -0
- package/src/components/RadarChart/index.ts +2 -0
- package/src/components/Radio/Radio.tsx +55 -0
- package/src/components/Radio/index.ts +2 -0
- package/src/components/RadioGroup/RadioGroup.tsx +54 -0
- package/src/components/RadioGroup/index.ts +2 -0
- package/src/components/RadioGroupItem/RadioGroupItem.tsx +118 -0
- package/src/components/RadioGroupItem/index.ts +6 -0
- package/src/components/SectionFooter/SectionFooter.tsx +40 -0
- package/src/components/SectionFooter/index.ts +2 -0
- package/src/components/SectionHeader/SectionHeader.tsx +44 -0
- package/src/components/SectionHeader/index.ts +2 -0
- package/src/components/SectionLabel/SectionLabel.tsx +51 -0
- package/src/components/SectionLabel/index.ts +2 -0
- package/src/components/Select/Select.tsx +121 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/SelectMenuItem/SelectMenuItem.tsx +85 -0
- package/src/components/SelectMenuItem/index.ts +2 -0
- package/src/components/SidebarNavigation/SidebarNavigation.tsx +100 -0
- package/src/components/SidebarNavigation/index.ts +2 -0
- package/src/components/SlideOutMenuHeader/SlideOutMenuHeader.tsx +56 -0
- package/src/components/SlideOutMenuHeader/index.ts +2 -0
- package/src/components/Slider/Slider.tsx +125 -0
- package/src/components/Slider/index.ts +2 -0
- package/src/components/SocialButton/SocialButton.tsx +88 -0
- package/src/components/SocialButton/index.ts +2 -0
- package/src/components/StatusIcon/StatusIcon.tsx +75 -0
- package/src/components/StatusIcon/index.ts +2 -0
- package/src/components/StepBase/StepBase.tsx +90 -0
- package/src/components/StepBase/index.ts +2 -0
- package/src/components/StepIconBase/StepIconBase.tsx +65 -0
- package/src/components/StepIconBase/index.ts +7 -0
- package/src/components/TabButtonBase/TabButtonBase.tsx +88 -0
- package/src/components/TabButtonBase/index.ts +2 -0
- package/src/components/TableCell/TableCell.tsx +44 -0
- package/src/components/TableCell/index.ts +2 -0
- package/src/components/TableHeaderCell/TableHeaderCell.tsx +34 -0
- package/src/components/TableHeaderCell/index.ts +2 -0
- package/src/components/TableHeaderLabel/TableHeaderLabel.tsx +37 -0
- package/src/components/TableHeaderLabel/index.ts +2 -0
- package/src/components/Tabs/Tabs.tsx +80 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Tag/Tag.tsx +91 -0
- package/src/components/Tag/index.ts +2 -0
- package/src/components/TagsInputField/TagsInputField.tsx +90 -0
- package/src/components/TagsInputField/index.ts +2 -0
- package/src/components/TextEditorToolbar/TextEditorToolbar.tsx +33 -0
- package/src/components/TextEditorToolbar/index.ts +2 -0
- package/src/components/TextEditorTooltip/TextEditorTooltip.tsx +28 -0
- package/src/components/TextEditorTooltip/index.ts +2 -0
- package/src/components/TextareaInputField/TextareaInputField.tsx +45 -0
- package/src/components/TextareaInputField/index.ts +2 -0
- package/src/components/Toggle/Toggle.tsx +87 -0
- package/src/components/Toggle/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.tsx +59 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/TrailingInputField/TrailingInputField.tsx +62 -0
- package/src/components/TrailingInputField/index.ts +2 -0
- package/src/components/TreeView/TreeView.tsx +86 -0
- package/src/components/TreeView/index.ts +2 -0
- package/src/components/TreeViewConnector/TreeViewConnector.tsx +36 -0
- package/src/components/TreeViewConnector/index.ts +2 -0
- package/src/components/TreeViewItem/TreeViewItem.tsx +111 -0
- package/src/components/TreeViewItem/index.ts +2 -0
- package/src/components/VerificationCodeInput/VerificationCodeInput.tsx +114 -0
- package/src/components/VerificationCodeInput/index.ts +2 -0
- package/src/illustrations/BoxIllustration.tsx +13 -0
- package/src/illustrations/CloudIllustration.tsx +18 -0
- package/src/illustrations/CreditCardIllustration.tsx +13 -0
- package/src/illustrations/DocumentsIllustration.tsx +13 -0
- package/src/illustrations/index.ts +4 -0
- package/src/index.ts +147 -0
- package/src/internal/chartTheme.ts +30 -0
- package/src/internal/ringBase.tsx +82 -0
- package/src/styles.css +3 -0
- package/tailwind-preset.js +295 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { TreeViewConnector, type TreeViewConnectorSize } from "../TreeViewConnector";
|
|
4
|
+
|
|
5
|
+
export type TreeViewItemSize = TreeViewConnectorSize;
|
|
6
|
+
|
|
7
|
+
export interface TreeViewItemProps extends Omit<HTMLAttributes<HTMLDivElement>, "onToggle"> {
|
|
8
|
+
size?: TreeViewItemSize;
|
|
9
|
+
/** Nesting depth — renders this many leading connector guides. */
|
|
10
|
+
level?: number;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
/** Has children → renders an expand/collapse chevron. */
|
|
13
|
+
expandable?: boolean;
|
|
14
|
+
open?: boolean;
|
|
15
|
+
onToggle?: () => void;
|
|
16
|
+
/** Leading checkbox. */
|
|
17
|
+
checkbox?: boolean;
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
20
|
+
/** Leading icon slot (e.g. a folder). */
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
/** Show a drag handle on hover. */
|
|
23
|
+
dragHandle?: boolean;
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* One row of a `TreeView`. Composes `TreeViewConnector` for the `level` indent
|
|
29
|
+
* guides, plus an optional expand chevron, `checkbox`, `icon` and label. Selected
|
|
30
|
+
* → `bg-secondary`; hover → `bg-primary-hover`. Width is fluid (parent controls).
|
|
31
|
+
*/
|
|
32
|
+
export function TreeViewItem({
|
|
33
|
+
size = "sm",
|
|
34
|
+
level = 0,
|
|
35
|
+
selected = false,
|
|
36
|
+
expandable = false,
|
|
37
|
+
open = false,
|
|
38
|
+
onToggle,
|
|
39
|
+
checkbox = false,
|
|
40
|
+
checked = false,
|
|
41
|
+
onCheckedChange,
|
|
42
|
+
icon,
|
|
43
|
+
dragHandle = false,
|
|
44
|
+
children,
|
|
45
|
+
className,
|
|
46
|
+
...rest
|
|
47
|
+
}: TreeViewItemProps) {
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
className={clsx(
|
|
51
|
+
"group/tvi flex items-center gap-md rounded-sm",
|
|
52
|
+
size === "md" ? "p-md" : "px-md py-sm",
|
|
53
|
+
selected ? "bg-bg-secondary hover:bg-bg-secondary-hover" : "hover:bg-bg-primary-hover",
|
|
54
|
+
className,
|
|
55
|
+
)}
|
|
56
|
+
{...rest}
|
|
57
|
+
>
|
|
58
|
+
{Array.from({ length: level }).map((_, i) => (
|
|
59
|
+
<TreeViewConnector key={i} size={size} />
|
|
60
|
+
))}
|
|
61
|
+
|
|
62
|
+
{expandable ? (
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
onClick={onToggle}
|
|
66
|
+
aria-label={open ? "Collapse" : "Expand"}
|
|
67
|
+
aria-expanded={open}
|
|
68
|
+
className="flex size-4 shrink-0 items-center justify-center text-fg-quaternary"
|
|
69
|
+
>
|
|
70
|
+
<svg viewBox="0 0 16 16" fill="none" className={clsx("size-4 transition-transform", open && "rotate-90")} aria-hidden>
|
|
71
|
+
<path d="M6 4l4 4-4 4" stroke="currentColor" strokeWidth="1.33" strokeLinecap="round" strokeLinejoin="round" />
|
|
72
|
+
</svg>
|
|
73
|
+
</button>
|
|
74
|
+
) : (
|
|
75
|
+
<span className="size-4 shrink-0" />
|
|
76
|
+
)}
|
|
77
|
+
|
|
78
|
+
{checkbox && (
|
|
79
|
+
<button
|
|
80
|
+
type="button"
|
|
81
|
+
role="checkbox"
|
|
82
|
+
aria-checked={checked}
|
|
83
|
+
onClick={() => onCheckedChange?.(!checked)}
|
|
84
|
+
className={clsx(
|
|
85
|
+
"flex size-4 shrink-0 items-center justify-center rounded-xs border",
|
|
86
|
+
checked ? "border-transparent bg-bg-brand-solid" : "border-border-primary bg-bg-primary",
|
|
87
|
+
)}
|
|
88
|
+
>
|
|
89
|
+
{checked && (
|
|
90
|
+
<svg viewBox="0 0 16 16" fill="none" className="size-3 text-fg-white" aria-hidden>
|
|
91
|
+
<path d="M13.33 4 6 11.33 2.67 8" stroke="currentColor" strokeWidth="1.67" strokeLinecap="round" strokeLinejoin="round" />
|
|
92
|
+
</svg>
|
|
93
|
+
)}
|
|
94
|
+
</button>
|
|
95
|
+
)}
|
|
96
|
+
|
|
97
|
+
{icon && <span className="flex shrink-0 items-center text-fg-quaternary">{icon}</span>}
|
|
98
|
+
<span className="min-w-0 flex-1 truncate text-sm font-semibold text-text-tertiary">{children}</span>
|
|
99
|
+
|
|
100
|
+
{dragHandle && (
|
|
101
|
+
<span className="shrink-0 text-fg-quaternary opacity-0 transition-opacity group-hover/tvi:opacity-100" aria-hidden>
|
|
102
|
+
<svg viewBox="0 0 16 16" fill="currentColor" className="size-4">
|
|
103
|
+
<circle cx="6" cy="4" r="1" /><circle cx="10" cy="4" r="1" />
|
|
104
|
+
<circle cx="6" cy="8" r="1" /><circle cx="10" cy="8" r="1" />
|
|
105
|
+
<circle cx="6" cy="12" r="1" /><circle cx="10" cy="12" r="1" />
|
|
106
|
+
</svg>
|
|
107
|
+
</span>
|
|
108
|
+
)}
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { useRef, type ReactNode, type ClipboardEvent, type KeyboardEvent } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
|
|
4
|
+
export type VerificationCodeDigits = 4 | 6;
|
|
5
|
+
export type VerificationCodeSize = "sm" | "md" | "lg";
|
|
6
|
+
|
|
7
|
+
export interface VerificationCodeInputProps {
|
|
8
|
+
digits?: VerificationCodeDigits;
|
|
9
|
+
value?: string;
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
size?: VerificationCodeSize;
|
|
12
|
+
label?: ReactNode;
|
|
13
|
+
hint?: ReactNode;
|
|
14
|
+
destructive?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
"aria-label"?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CELL: Record<VerificationCodeSize, string> = {
|
|
21
|
+
sm: "size-16 rounded-lg text-display-lg",
|
|
22
|
+
md: "size-20 rounded-xl text-display-lg",
|
|
23
|
+
lg: "size-24 rounded-xl text-display-xl",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* OTP-style verification code input. `digits` 4 or 6 separate single-character
|
|
28
|
+
* cells (6 shows a centre "-" separator); large display typography
|
|
29
|
+
* (`display-lg`/`display-xl`). Controlled via `value`/`onChange`; auto-advances
|
|
30
|
+
* focus on entry and steps back on backspace. Cell borders use `border-primary`
|
|
31
|
+
* (= `utility-neutral-300` #d4d4d4, same value).
|
|
32
|
+
*/
|
|
33
|
+
export function VerificationCodeInput({
|
|
34
|
+
digits = 4,
|
|
35
|
+
value = "",
|
|
36
|
+
onChange,
|
|
37
|
+
size = "md",
|
|
38
|
+
label,
|
|
39
|
+
hint,
|
|
40
|
+
destructive = false,
|
|
41
|
+
disabled = false,
|
|
42
|
+
className,
|
|
43
|
+
"aria-label": ariaLabel,
|
|
44
|
+
}: VerificationCodeInputProps) {
|
|
45
|
+
const refs = useRef<(HTMLInputElement | null)[]>([]);
|
|
46
|
+
const chars = Array.from({ length: digits }, (_, i) => value[i] ?? "");
|
|
47
|
+
|
|
48
|
+
const setChar = (i: number, ch: string) => {
|
|
49
|
+
const next = chars.slice();
|
|
50
|
+
next[i] = ch;
|
|
51
|
+
onChange?.(next.join("").slice(0, digits));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const handleInput = (i: number, raw: string) => {
|
|
55
|
+
const ch = raw.replace(/\D/g, "").slice(-1);
|
|
56
|
+
setChar(i, ch);
|
|
57
|
+
if (ch && i < digits - 1) refs.current[i + 1]?.focus();
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handleKeyDown = (i: number, e: KeyboardEvent<HTMLInputElement>) => {
|
|
61
|
+
if (e.key === "Backspace" && !chars[i] && i > 0) refs.current[i - 1]?.focus();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handlePaste = (e: ClipboardEvent<HTMLInputElement>) => {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
const pasted = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, digits);
|
|
67
|
+
if (pasted) {
|
|
68
|
+
onChange?.(pasted);
|
|
69
|
+
refs.current[Math.min(pasted.length, digits - 1)]?.focus();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const cells = chars.map((ch, i) => (
|
|
74
|
+
<input
|
|
75
|
+
key={i}
|
|
76
|
+
ref={(el) => (refs.current[i] = el)}
|
|
77
|
+
inputMode="numeric"
|
|
78
|
+
maxLength={1}
|
|
79
|
+
value={ch}
|
|
80
|
+
disabled={disabled}
|
|
81
|
+
aria-label={`Digit ${i + 1}`}
|
|
82
|
+
onChange={(e) => handleInput(i, e.target.value)}
|
|
83
|
+
onKeyDown={(e) => handleKeyDown(i, e)}
|
|
84
|
+
onPaste={handlePaste}
|
|
85
|
+
className={clsx(
|
|
86
|
+
"border bg-bg-primary text-center font-display font-medium text-text-primary shadow-xs outline-none",
|
|
87
|
+
"focus:border-border-brand focus:ring-2 focus:ring-border-brand focus:ring-offset-0",
|
|
88
|
+
CELL[size],
|
|
89
|
+
destructive ? "border-border-error" : "border-border-primary",
|
|
90
|
+
disabled && "cursor-not-allowed opacity-60",
|
|
91
|
+
)}
|
|
92
|
+
/>
|
|
93
|
+
));
|
|
94
|
+
|
|
95
|
+
const mid = digits / 2;
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div className={clsx("flex flex-col gap-sm font-body", className)} aria-label={ariaLabel} role="group">
|
|
99
|
+
{label && <span className="text-sm font-medium text-text-secondary">{label}</span>}
|
|
100
|
+
<div className="flex items-center gap-lg">
|
|
101
|
+
{digits === 6 ? (
|
|
102
|
+
<>
|
|
103
|
+
{cells.slice(0, mid)}
|
|
104
|
+
<span className="text-display-xl font-medium text-utility-neutral-300">-</span>
|
|
105
|
+
{cells.slice(mid)}
|
|
106
|
+
</>
|
|
107
|
+
) : (
|
|
108
|
+
cells
|
|
109
|
+
)}
|
|
110
|
+
</div>
|
|
111
|
+
{hint && <span className={clsx("text-sm", destructive ? "text-text-error-primary" : "text-text-tertiary")}>{hint}</span>}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
/** Line-art open-box illustration (empty / archived states). */
|
|
4
|
+
export function BoxIllustration({ className, ...props }: SVGProps<SVGSVGElement>) {
|
|
5
|
+
return (
|
|
6
|
+
<svg viewBox="0 0 152 120" fill="none" className={className} aria-hidden {...props}>
|
|
7
|
+
<circle cx="76" cy="60" r="48" className="fill-bg-secondary" />
|
|
8
|
+
<path d="M44 56l32-16 32 16-32 16-32-16Z" className="fill-bg-primary" stroke="currentColor" strokeWidth="3" strokeLinejoin="round" />
|
|
9
|
+
<path d="M44 56v24l32 16 32-16V56" stroke="currentColor" strokeWidth="3" strokeLinejoin="round" />
|
|
10
|
+
<path d="M76 72v24" stroke="currentColor" strokeWidth="3" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
/** Line-art cloud illustration (empty-state / upload). Color via `currentColor`. */
|
|
4
|
+
export function CloudIllustration({ className, ...props }: SVGProps<SVGSVGElement>) {
|
|
5
|
+
return (
|
|
6
|
+
<svg viewBox="0 0 152 120" fill="none" className={className} aria-hidden {...props}>
|
|
7
|
+
<circle cx="76" cy="56" r="48" className="fill-bg-secondary" />
|
|
8
|
+
<path
|
|
9
|
+
d="M52 76a16 16 0 0 1-1-32 24 24 0 0 1 46-6 18 18 0 0 1 3 36H56"
|
|
10
|
+
stroke="currentColor"
|
|
11
|
+
strokeWidth="3"
|
|
12
|
+
strokeLinecap="round"
|
|
13
|
+
strokeLinejoin="round"
|
|
14
|
+
/>
|
|
15
|
+
<path d="M68 70l8-8 8 8M76 62v22" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
/** Line-art credit-card illustration (billing / payment empty states). */
|
|
4
|
+
export function CreditCardIllustration({ className, ...props }: SVGProps<SVGSVGElement>) {
|
|
5
|
+
return (
|
|
6
|
+
<svg viewBox="0 0 152 120" fill="none" className={className} aria-hidden {...props}>
|
|
7
|
+
<circle cx="76" cy="60" r="48" className="fill-bg-secondary" />
|
|
8
|
+
<rect x="40" y="44" width="72" height="48" rx="6" stroke="currentColor" strokeWidth="3" />
|
|
9
|
+
<path d="M40 58h72" stroke="currentColor" strokeWidth="3" />
|
|
10
|
+
<path d="M50 78h16M86 78h16" stroke="currentColor" strokeWidth="3" strokeLinecap="round" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SVGProps } from "react";
|
|
2
|
+
|
|
3
|
+
/** Line-art stacked-documents illustration (no files / empty list states). */
|
|
4
|
+
export function DocumentsIllustration({ className, ...props }: SVGProps<SVGSVGElement>) {
|
|
5
|
+
return (
|
|
6
|
+
<svg viewBox="0 0 152 120" fill="none" className={className} aria-hidden {...props}>
|
|
7
|
+
<circle cx="76" cy="60" r="48" className="fill-bg-secondary" />
|
|
8
|
+
<rect x="52" y="38" width="40" height="52" rx="4" className="fill-bg-primary" stroke="currentColor" strokeWidth="3" />
|
|
9
|
+
<rect x="62" y="46" width="40" height="52" rx="4" className="fill-bg-primary" stroke="currentColor" strokeWidth="3" />
|
|
10
|
+
<path d="M70 60h24M70 70h24M70 80h14" stroke="currentColor" strokeWidth="3" strokeLinecap="round" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export * from "./components/ActivityFeed";
|
|
2
|
+
export * from "./components/ActivityGauge";
|
|
3
|
+
export * from "./components/AdvancedFilterBar";
|
|
4
|
+
export * from "./components/Alert";
|
|
5
|
+
export * from "./components/Avatar";
|
|
6
|
+
export * from "./components/AvatarAddButton";
|
|
7
|
+
export * from "./components/AvatarGroup";
|
|
8
|
+
export * from "./components/AvatarLabelGroup";
|
|
9
|
+
export * from "./components/AvatarProfilePhoto";
|
|
10
|
+
export * from "./components/Badge";
|
|
11
|
+
export * from "./components/BadgeCloseX";
|
|
12
|
+
export * from "./components/BadgeGroup";
|
|
13
|
+
export * from "./components/BreadcrumbButtonBase";
|
|
14
|
+
export * from "./components/Breadcrumbs";
|
|
15
|
+
export * from "./components/Button";
|
|
16
|
+
export * from "./components/ButtonCloseX";
|
|
17
|
+
export * from "./components/ButtonDestructive";
|
|
18
|
+
export * from "./components/ButtonGroup";
|
|
19
|
+
export * from "./components/ButtonGroupSegment";
|
|
20
|
+
export * from "./components/ButtonUtility";
|
|
21
|
+
export * from "./components/CalendarCell";
|
|
22
|
+
export * from "./components/CalendarCellDayWeekView";
|
|
23
|
+
export * from "./components/CalendarColumnHeader";
|
|
24
|
+
export * from "./components/CalendarDateIcon";
|
|
25
|
+
export * from "./components/CalendarEvent";
|
|
26
|
+
export * from "./components/CalendarEventDayWeekView";
|
|
27
|
+
export * from "./components/CalendarHeader";
|
|
28
|
+
export * from "./components/CalendarRowLabel";
|
|
29
|
+
export * from "./components/CalendarTimemarker";
|
|
30
|
+
export * from "./components/CalendarViewDropdown";
|
|
31
|
+
export * from "./components/CardHeader";
|
|
32
|
+
export * from "./components/CarouselArrow";
|
|
33
|
+
export * from "./components/CarouselImage";
|
|
34
|
+
export * from "./components/Change";
|
|
35
|
+
export * from "./components/ChartLegend";
|
|
36
|
+
export * from "./components/ChartMarker";
|
|
37
|
+
export * from "./components/ChartMini";
|
|
38
|
+
export * from "./components/ChartTooltip";
|
|
39
|
+
export * from "./components/Checkbox";
|
|
40
|
+
export * from "./components/CodeSnippet";
|
|
41
|
+
export * from "./components/CodeSnippetTabs";
|
|
42
|
+
export * from "./components/CommandBar";
|
|
43
|
+
export * from "./components/CommandBarFooter";
|
|
44
|
+
export * from "./components/CommandBarMenuSection";
|
|
45
|
+
export * from "./components/CommandBarNavigationIcon";
|
|
46
|
+
export * from "./components/CommandDropdownMenuItem";
|
|
47
|
+
export * from "./components/CommandInput";
|
|
48
|
+
export * from "./components/CommandShortcut";
|
|
49
|
+
export * from "./components/ContentDivider";
|
|
50
|
+
export * from "./components/ContentFeatureText";
|
|
51
|
+
export * from "./components/ContentHeading";
|
|
52
|
+
export * from "./components/ContentParagraph";
|
|
53
|
+
export * from "./components/ContentQuote";
|
|
54
|
+
export * from "./components/ContentRule";
|
|
55
|
+
export * from "./components/ContextMenu";
|
|
56
|
+
export * from "./components/DatePickerCell";
|
|
57
|
+
export * from "./components/DatePickerListItem";
|
|
58
|
+
export * from "./components/DatePickerMenu";
|
|
59
|
+
export * from "./components/DropdownAccountListItem";
|
|
60
|
+
export * from "./components/DropdownMenuFooter";
|
|
61
|
+
export * from "./components/DropdownMenuHeader";
|
|
62
|
+
export * from "./components/DropdownMenuItemInsetIcon";
|
|
63
|
+
export * from "./components/DropdownMenuListItem";
|
|
64
|
+
export * from "./components/EmptyState";
|
|
65
|
+
export * from "./components/FeedItemBase";
|
|
66
|
+
export * from "./components/FileUpload";
|
|
67
|
+
export * from "./components/FileUploadBase";
|
|
68
|
+
export * from "./components/FileUploadItemBase";
|
|
69
|
+
export * from "./components/FilterBar";
|
|
70
|
+
export * from "./components/FilterTabs";
|
|
71
|
+
export * from "./components/FiltersDropdownMenu";
|
|
72
|
+
export * from "./components/FiltersSlideoutMenu";
|
|
73
|
+
export * from "./components/HeaderNavigation";
|
|
74
|
+
export * from "./components/HelpIcon";
|
|
75
|
+
export * from "./components/InputField";
|
|
76
|
+
export * from "./components/LeadingInputField";
|
|
77
|
+
export * from "./components/LineAndBarChart";
|
|
78
|
+
export * from "./components/LinkMessage";
|
|
79
|
+
export * from "./components/LoadingIndicator";
|
|
80
|
+
export * from "./components/MediaMessage";
|
|
81
|
+
export * from "./components/MegaInputFieldBase";
|
|
82
|
+
export * from "./components/Message";
|
|
83
|
+
export * from "./components/MessageAction";
|
|
84
|
+
export * from "./components/MessageActionButton";
|
|
85
|
+
export * from "./components/MessageActionPanel";
|
|
86
|
+
export * from "./components/MessageReaction";
|
|
87
|
+
export * from "./components/MessageStatusIcon";
|
|
88
|
+
export * from "./components/MetricItem";
|
|
89
|
+
export * from "./components/ModalActions";
|
|
90
|
+
export * from "./components/ModalHeader";
|
|
91
|
+
export * from "./components/MultiSelect";
|
|
92
|
+
export * from "./components/NavAccountCard";
|
|
93
|
+
export * from "./components/NavAccountCardMenuItem";
|
|
94
|
+
export * from "./components/NavButton";
|
|
95
|
+
export * from "./components/NavFeaturedCard";
|
|
96
|
+
export * from "./components/NavItemBase";
|
|
97
|
+
export * from "./components/NavItemDropdownBase";
|
|
98
|
+
export * from "./components/NavMenuButton";
|
|
99
|
+
export * from "./components/Notification";
|
|
100
|
+
export * from "./components/NumberInput";
|
|
101
|
+
export * from "./components/PageHeader";
|
|
102
|
+
export * from "./components/Pagination";
|
|
103
|
+
export * from "./components/PaginationButtonGroupBase";
|
|
104
|
+
export * from "./components/PaginationCards";
|
|
105
|
+
export * from "./components/PaginationDotGroup";
|
|
106
|
+
export * from "./components/PaginationDotIndicator";
|
|
107
|
+
export * from "./components/PaginationNumberBase";
|
|
108
|
+
export * from "./components/PieChart";
|
|
109
|
+
export * from "./components/ProgressBar";
|
|
110
|
+
export * from "./components/ProgressCircle";
|
|
111
|
+
export * from "./components/RadarChart";
|
|
112
|
+
export * from "./components/TagsInputField";
|
|
113
|
+
export * from "./components/TrailingInputField";
|
|
114
|
+
export * from "./components/Radio";
|
|
115
|
+
export * from "./components/RadioGroup";
|
|
116
|
+
export * from "./components/RadioGroupItem";
|
|
117
|
+
export * from "./components/SectionFooter";
|
|
118
|
+
export * from "./components/SectionHeader";
|
|
119
|
+
export * from "./components/SectionLabel";
|
|
120
|
+
export * from "./components/Select";
|
|
121
|
+
export * from "./components/SelectMenuItem";
|
|
122
|
+
export * from "./components/SidebarNavigation";
|
|
123
|
+
export * from "./components/SlideOutMenuHeader";
|
|
124
|
+
export * from "./components/Slider";
|
|
125
|
+
export * from "./components/SocialButton";
|
|
126
|
+
export * from "./components/StatusIcon";
|
|
127
|
+
export * from "./components/StepBase";
|
|
128
|
+
export * from "./components/StepIconBase";
|
|
129
|
+
export * from "./components/TabButtonBase";
|
|
130
|
+
export * from "./components/TableCell";
|
|
131
|
+
export * from "./components/TableHeaderCell";
|
|
132
|
+
export * from "./components/TableHeaderLabel";
|
|
133
|
+
export * from "./components/Tabs";
|
|
134
|
+
export * from "./components/Tag";
|
|
135
|
+
export * from "./components/TextEditorToolbar";
|
|
136
|
+
export * from "./components/TextEditorTooltip";
|
|
137
|
+
export * from "./components/TextareaInputField";
|
|
138
|
+
export * from "./components/Toggle";
|
|
139
|
+
export * from "./components/Tooltip";
|
|
140
|
+
export * from "./components/TreeView";
|
|
141
|
+
export * from "./components/TreeViewConnector";
|
|
142
|
+
export * from "./components/TreeViewItem";
|
|
143
|
+
export * from "./components/VerificationCodeInput";
|
|
144
|
+
// Illustration set — namespaced group (not individual barrel exports).
|
|
145
|
+
export * as illustrations from "./illustrations";
|
|
146
|
+
// figma-to-react appends one line here per new component, e.g.:
|
|
147
|
+
// export * from "./components/Input";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Shared theming for the Recharts-backed chart wrappers (LineAndBarChart /
|
|
2
|
+
// PieChart / RadarChart). PRIVATE — not exported from the barrel. Recharts needs
|
|
3
|
+
// real color strings (not Tailwind class names), so the design-token hexes are
|
|
4
|
+
// mirrored here from tailwind-preset.js. Keep in sync with the preset.
|
|
5
|
+
|
|
6
|
+
/** Categorical series palette — the `utility-brand` ramp + accents. */
|
|
7
|
+
export const CHART_COLORS = [
|
|
8
|
+
"#7f56d9", // utility-brand-600
|
|
9
|
+
"#9e77ed", // utility-brand-500
|
|
10
|
+
"#b692f6", // utility-brand-400
|
|
11
|
+
"#e9d7fe", // utility-brand-200
|
|
12
|
+
"#22c55e", // utility-success-500
|
|
13
|
+
"#0ea5e9", // utility-sky-500
|
|
14
|
+
"#eab308", // utility-yellow-500
|
|
15
|
+
"#f04438", // utility-error-500-ish
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
export const chartColor = (i: number) => CHART_COLORS[i % CHART_COLORS.length];
|
|
19
|
+
|
|
20
|
+
/** Axis grid line color (Figma `border-tertiary`). */
|
|
21
|
+
export const CHART_GRID = "#f5f5f5";
|
|
22
|
+
/** Axis tick label color (Figma `text-tertiary`). */
|
|
23
|
+
export const CHART_TICK = "#525252";
|
|
24
|
+
|
|
25
|
+
/** Default axis tick style for Recharts XAxis/YAxis. */
|
|
26
|
+
export const tickStyle = {
|
|
27
|
+
fill: CHART_TICK,
|
|
28
|
+
fontSize: 12,
|
|
29
|
+
fontFamily: "Inter, sans-serif",
|
|
30
|
+
} as const;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PRIVATE shared ring-geometry helper for SVG progress rings. Used by both
|
|
5
|
+
* `ActivityGauge` (multi concentric rings) and `ProgressCircle` (single ring /
|
|
6
|
+
* half-circle gauge). Not exported from the package barrel.
|
|
7
|
+
*/
|
|
8
|
+
export interface RingGeometry {
|
|
9
|
+
center: number;
|
|
10
|
+
radius: number;
|
|
11
|
+
circumference: number;
|
|
12
|
+
/** Length of the visible arc (= circumference × arcFraction). */
|
|
13
|
+
arc: number;
|
|
14
|
+
/** Filled length within the arc (= value/100 × arc). */
|
|
15
|
+
filled: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function ringGeometry(
|
|
19
|
+
diameter: number,
|
|
20
|
+
stroke: number,
|
|
21
|
+
value: number,
|
|
22
|
+
opts: { ringIndex?: number; ringGap?: number; arcFraction?: number } = {},
|
|
23
|
+
): RingGeometry {
|
|
24
|
+
const { ringIndex = 0, ringGap = 0, arcFraction = 1 } = opts;
|
|
25
|
+
const center = diameter / 2;
|
|
26
|
+
const radius = center - stroke / 2 - ringIndex * (stroke + ringGap);
|
|
27
|
+
const circumference = 2 * Math.PI * radius;
|
|
28
|
+
const arc = circumference * arcFraction;
|
|
29
|
+
const filled = (Math.max(0, Math.min(100, value)) / 100) * arc;
|
|
30
|
+
return { center, radius, circumference, arc, filled };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface RingPairProps {
|
|
34
|
+
geo: RingGeometry;
|
|
35
|
+
stroke: number;
|
|
36
|
+
/** Track (unfilled) stroke utility class, e.g. "stroke-utility-neutral-100". */
|
|
37
|
+
trackClass?: string;
|
|
38
|
+
/** Progress stroke utility class (omit when using `progressColor`). */
|
|
39
|
+
progressClass?: string;
|
|
40
|
+
/** Raw hex for the progress stroke (overrides `progressClass`). */
|
|
41
|
+
progressColor?: string;
|
|
42
|
+
linecap?: "round" | "butt";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Track + progress `<circle>` pair for one ring. Render inside an `<svg>` whose
|
|
47
|
+
* `<g>` is rotated so the arc starts where you want (gauges rotate the group).
|
|
48
|
+
*/
|
|
49
|
+
export function RingPair({
|
|
50
|
+
geo,
|
|
51
|
+
stroke,
|
|
52
|
+
trackClass = "stroke-utility-neutral-100",
|
|
53
|
+
progressClass,
|
|
54
|
+
progressColor,
|
|
55
|
+
linecap = "round",
|
|
56
|
+
}: RingPairProps) {
|
|
57
|
+
const { center, radius, circumference, arc, filled } = geo;
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<circle
|
|
61
|
+
cx={center}
|
|
62
|
+
cy={center}
|
|
63
|
+
r={radius}
|
|
64
|
+
fill="none"
|
|
65
|
+
className={trackClass}
|
|
66
|
+
strokeWidth={stroke}
|
|
67
|
+
strokeDasharray={`${arc} ${circumference}`}
|
|
68
|
+
/>
|
|
69
|
+
<circle
|
|
70
|
+
cx={center}
|
|
71
|
+
cy={center}
|
|
72
|
+
r={radius}
|
|
73
|
+
fill="none"
|
|
74
|
+
className={clsx(!progressColor && progressClass)}
|
|
75
|
+
stroke={progressColor}
|
|
76
|
+
strokeWidth={stroke}
|
|
77
|
+
strokeLinecap={linecap}
|
|
78
|
+
strokeDasharray={`${filled} ${circumference}`}
|
|
79
|
+
/>
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
}
|
package/src/styles.css
ADDED