@raydenui/ui 0.9.7 → 0.10.1
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 +124 -49
- package/dist/Table-DCNSxua1.d.cts +31 -0
- package/dist/Table-DCNSxua1.d.ts +31 -0
- package/dist/blocks/ApplicationShellBlock.cjs +157 -0
- package/dist/blocks/ApplicationShellBlock.js +154 -0
- package/dist/blocks/CheckoutReviewBlock.cjs +16 -0
- package/dist/blocks/CheckoutReviewBlock.js +13 -0
- package/dist/blocks/CommandPaletteBlock.cjs +334 -0
- package/dist/blocks/CommandPaletteBlock.js +331 -0
- package/dist/blocks/CreateAccountBlock.cjs +147 -0
- package/dist/blocks/CreateAccountBlock.js +143 -0
- package/dist/blocks/EmptyStateBlock.cjs +19 -0
- package/dist/blocks/EmptyStateBlock.js +16 -0
- package/dist/blocks/FeatureOverviewBlock.cjs +54 -0
- package/dist/blocks/FeatureOverviewBlock.js +51 -0
- package/dist/blocks/HeaderBlock.cjs +230 -0
- package/dist/blocks/HeaderBlock.js +227 -0
- package/dist/blocks/KpiOverviewBlock.cjs +63 -0
- package/dist/blocks/KpiOverviewBlock.js +60 -0
- package/dist/blocks/LoginBlock.cjs +66 -0
- package/dist/blocks/LoginBlock.js +63 -0
- package/dist/blocks/NotificationsBlock.cjs +17 -0
- package/dist/blocks/NotificationsBlock.js +14 -0
- package/dist/blocks/PageHeaderBlock.cjs +121 -0
- package/dist/blocks/PageHeaderBlock.js +118 -0
- package/dist/blocks/PricingPlansBlock.cjs +146 -0
- package/dist/blocks/PricingPlansBlock.js +143 -0
- package/dist/blocks/ProductCollectionBlock.cjs +37 -0
- package/dist/blocks/ProductCollectionBlock.js +34 -0
- package/dist/blocks/ProductDetailBlock.cjs +30 -0
- package/dist/blocks/ProductDetailBlock.js +27 -0
- package/dist/blocks/ProductHeroBlock.cjs +83 -0
- package/dist/blocks/ProductHeroBlock.js +80 -0
- package/dist/blocks/ProfileSettingsBlock.cjs +130 -0
- package/dist/blocks/ProfileSettingsBlock.js +126 -0
- package/dist/blocks/QuickSendBlock.cjs +11 -0
- package/dist/blocks/QuickSendBlock.js +8 -0
- package/dist/blocks/RecentTransactionsBlock.cjs +13 -0
- package/dist/blocks/RecentTransactionsBlock.js +10 -0
- package/dist/blocks/SearchableTableBlock.cjs +91 -0
- package/dist/blocks/SearchableTableBlock.js +88 -0
- package/dist/blocks/ShoppingCartBlock.cjs +16 -0
- package/dist/blocks/ShoppingCartBlock.js +13 -0
- package/dist/blocks/SiteFooterBlock.cjs +69 -0
- package/dist/blocks/SiteFooterBlock.js +66 -0
- package/dist/blocks/TableBlock.cjs +20 -0
- package/dist/blocks/TableBlock.js +17 -0
- package/dist/blocks/TaskListBlock.cjs +198 -0
- package/dist/blocks/TaskListBlock.js +195 -0
- package/dist/blocks/WorkspaceSwitcherBlock.cjs +291 -0
- package/dist/blocks/WorkspaceSwitcherBlock.js +288 -0
- package/dist/blocks/commerce.cjs +44 -0
- package/dist/blocks/commerce.js +35 -0
- package/dist/blocks/index.cjs +53 -0
- package/dist/blocks/index.js +24 -0
- package/dist/blocks.d.cts +1820 -0
- package/dist/blocks.d.ts +1820 -0
- package/dist/chart.cjs +13 -0
- package/dist/chart.d.cts +59 -0
- package/dist/chart.d.ts +59 -0
- package/dist/chart.js +5 -0
- package/dist/components/Accordion/Accordion.cjs +94 -0
- package/dist/components/Accordion/Accordion.js +91 -0
- package/dist/components/Accordion/index.cjs +8 -0
- package/dist/components/Accordion/index.js +1 -0
- package/dist/components/ActivityFeed/ActivityContent.cjs +40 -0
- package/dist/components/ActivityFeed/ActivityContent.js +37 -0
- package/dist/components/ActivityFeed/ActivityItem.cjs +19 -0
- package/dist/components/ActivityFeed/ActivityItem.js +16 -0
- package/dist/components/ActivityFeed/index.cjs +7 -0
- package/dist/components/ActivityFeed/index.js +2 -0
- package/dist/components/Alert/Alert.cjs +42 -0
- package/dist/components/Alert/Alert.js +39 -0
- package/dist/components/Alert/index.cjs +5 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/Avatar/Avatar.cjs +101 -0
- package/dist/components/Avatar/Avatar.js +98 -0
- package/dist/components/Avatar/index.cjs +6 -0
- package/dist/components/Avatar/index.js +1 -0
- package/dist/components/Badge/Badge.cjs +53 -0
- package/dist/components/Badge/Badge.js +50 -0
- package/dist/components/Badge/index.cjs +5 -0
- package/dist/components/Badge/index.js +1 -0
- package/dist/components/Banner/Banner.cjs +83 -0
- package/dist/components/Banner/Banner.js +80 -0
- package/dist/components/Banner/index.cjs +5 -0
- package/dist/components/Banner/index.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs +31 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +28 -0
- package/dist/components/Breadcrumb/index.cjs +5 -0
- package/dist/components/Breadcrumb/index.js +1 -0
- package/dist/components/Button/Button.cjs +88 -0
- package/dist/components/Button/Button.js +85 -0
- package/dist/components/Button/index.cjs +5 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.cjs +8 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +5 -0
- package/dist/components/ButtonGroup/ButtonGroupItem.cjs +15 -0
- package/dist/components/ButtonGroup/ButtonGroupItem.js +12 -0
- package/dist/components/ButtonGroup/index.cjs +7 -0
- package/dist/components/ButtonGroup/index.js +2 -0
- package/dist/components/Card/Card.cjs +94 -0
- package/dist/components/Card/Card.js +91 -0
- package/dist/components/Card/index.cjs +9 -0
- package/dist/components/Card/index.js +1 -0
- package/dist/components/Chart/Chart.cjs +160 -0
- package/dist/components/Chart/Chart.js +153 -0
- package/dist/components/Chart/index.cjs +10 -0
- package/dist/components/Chart/index.js +2 -0
- package/dist/components/Chart/theme.cjs +67 -0
- package/dist/components/Chart/theme.js +62 -0
- package/dist/components/Chip/Chip.cjs +18 -0
- package/dist/components/Chip/Chip.js +15 -0
- package/dist/components/Chip/index.cjs +5 -0
- package/dist/components/Chip/index.js +1 -0
- package/dist/components/Counter/Counter.cjs +74 -0
- package/dist/components/Counter/Counter.js +71 -0
- package/dist/components/Counter/index.cjs +6 -0
- package/dist/components/Counter/index.js +1 -0
- package/dist/components/DatePicker/DatePicker.cjs +343 -0
- package/dist/components/DatePicker/DatePicker.js +340 -0
- package/dist/components/DatePicker/index.cjs +5 -0
- package/dist/components/DatePicker/index.js +1 -0
- package/dist/components/Divider/Divider.cjs +31 -0
- package/dist/components/Divider/Divider.js +28 -0
- package/dist/components/Divider/index.cjs +5 -0
- package/dist/components/Divider/index.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.cjs +108 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +105 -0
- package/dist/components/DropdownMenu/index.cjs +11 -0
- package/dist/components/DropdownMenu/index.js +1 -0
- package/dist/components/EmptyStateIllustration/EmptyStateIllustration.cjs +42 -0
- package/dist/components/EmptyStateIllustration/EmptyStateIllustration.js +39 -0
- package/dist/components/EmptyStateIllustration/illustrations.cjs +3322 -0
- package/dist/components/EmptyStateIllustration/illustrations.js +3319 -0
- package/dist/components/EmptyStateIllustration/index.cjs +7 -0
- package/dist/components/EmptyStateIllustration/index.js +2 -0
- package/dist/components/FileUpload/FileUpload.cjs +116 -0
- package/dist/components/FileUpload/FileUpload.js +113 -0
- package/dist/components/FileUpload/FileUploadDropZone.cjs +58 -0
- package/dist/components/FileUpload/FileUploadDropZone.js +55 -0
- package/dist/components/FileUpload/FileUploadIcons.cjs +55 -0
- package/dist/components/FileUpload/FileUploadIcons.js +50 -0
- package/dist/components/FileUpload/FileUploadItem.cjs +34 -0
- package/dist/components/FileUpload/FileUploadItem.js +31 -0
- package/dist/components/FileUpload/index.cjs +9 -0
- package/dist/components/FileUpload/index.js +3 -0
- package/dist/components/FormControl/Checkbox.cjs +27 -0
- package/dist/components/FormControl/Checkbox.js +24 -0
- package/dist/components/FormControl/Radio.cjs +15 -0
- package/dist/components/FormControl/Radio.js +12 -0
- package/dist/components/FormControl/Toggle.cjs +15 -0
- package/dist/components/FormControl/Toggle.js +12 -0
- package/dist/components/FormControl/index.cjs +9 -0
- package/dist/components/FormControl/index.js +3 -0
- package/dist/components/Icon/Icon.cjs +70 -0
- package/dist/components/Icon/Icon.js +34 -0
- package/dist/components/Icon/catalog.cjs +1672 -0
- package/dist/components/Icon/catalog.js +1669 -0
- package/dist/components/Icon/icons.cjs +5621 -0
- package/dist/components/Icon/icons.js +5610 -0
- package/dist/components/Icon/index.cjs +8 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Input/Input.cjs +64 -0
- package/dist/components/Input/Input.js +61 -0
- package/dist/components/Input/index.cjs +5 -0
- package/dist/components/Input/index.js +1 -0
- package/dist/components/MetricsCard/MetricsCard.cjs +107 -0
- package/dist/components/MetricsCard/MetricsCard.js +104 -0
- package/dist/components/MetricsCard/index.cjs +5 -0
- package/dist/components/MetricsCard/index.js +1 -0
- package/dist/components/Modal/Modal.cjs +126 -0
- package/dist/components/Modal/Modal.js +123 -0
- package/dist/components/Modal/index.cjs +5 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/Pagination/Pagination.cjs +42 -0
- package/dist/components/Pagination/Pagination.js +39 -0
- package/dist/components/Pagination/index.cjs +5 -0
- package/dist/components/Pagination/index.js +1 -0
- package/dist/components/ProgressBar/ProgressBar.cjs +34 -0
- package/dist/components/ProgressBar/ProgressBar.js +31 -0
- package/dist/components/ProgressBar/index.cjs +5 -0
- package/dist/components/ProgressBar/index.js +1 -0
- package/dist/components/ProgressCircle/ProgressCircle.cjs +34 -0
- package/dist/components/ProgressCircle/ProgressCircle.js +31 -0
- package/dist/components/ProgressCircle/index.cjs +5 -0
- package/dist/components/ProgressCircle/index.js +1 -0
- package/dist/components/Select/Select.cjs +84 -0
- package/dist/components/Select/Select.js +80 -0
- package/dist/components/Select/SelectOption.cjs +26 -0
- package/dist/components/Select/SelectOption.js +23 -0
- package/dist/components/Select/index.cjs +7 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/SidebarMenu/SidebarMenu.cjs +85 -0
- package/dist/components/SidebarMenu/SidebarMenu.js +81 -0
- package/dist/components/SidebarMenu/SidebarMenuItem.cjs +126 -0
- package/dist/components/SidebarMenu/SidebarMenuItem.js +122 -0
- package/dist/components/SidebarMenu/SidebarMenuSection.cjs +14 -0
- package/dist/components/SidebarMenu/SidebarMenuSection.js +11 -0
- package/dist/components/SidebarMenu/index.cjs +12 -0
- package/dist/components/SidebarMenu/index.js +4 -0
- package/dist/components/Slider/Slider.cjs +161 -0
- package/dist/components/Slider/Slider.js +158 -0
- package/dist/components/Slider/index.cjs +6 -0
- package/dist/components/Slider/index.js +1 -0
- package/dist/components/Spinner/Spinner.cjs +93 -0
- package/dist/components/Spinner/Spinner.js +90 -0
- package/dist/components/Spinner/index.cjs +5 -0
- package/dist/components/Spinner/index.js +1 -0
- package/dist/components/Stepper/Stepper.cjs +82 -0
- package/dist/components/Stepper/Stepper.js +79 -0
- package/dist/components/Stepper/index.cjs +7 -0
- package/dist/components/Stepper/index.js +1 -0
- package/dist/components/Table/Table.cjs +25 -0
- package/dist/components/Table/Table.js +22 -0
- package/dist/components/Table/index.cjs +10 -0
- package/dist/components/Table/index.js +1 -0
- package/dist/components/Table/useTableSelection.cjs +60 -0
- package/dist/components/Table/useTableSelection.js +57 -0
- package/dist/components/Tabs/Tab.cjs +70 -0
- package/dist/components/Tabs/Tab.js +67 -0
- package/dist/components/Tabs/Tabs.cjs +133 -0
- package/dist/components/Tabs/Tabs.js +129 -0
- package/dist/components/Tabs/index.cjs +7 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +101 -0
- package/dist/components/Tooltip/Tooltip.js +98 -0
- package/dist/components/Tooltip/index.cjs +5 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/context/ThemeContext.cjs +97 -0
- package/dist/context/ThemeContext.js +92 -0
- package/dist/fonts/README.md +13 -0
- package/dist/fonts/hanken-grotesk-cyrillic-ext-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-cyrillic-ext-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-ext-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-ext-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-vietnamese-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-vietnamese-normal.woff2 +0 -0
- package/dist/fonts/hankengrotesk-LICENSE.txt +94 -0
- package/dist/fonts/manrope-LICENSE.txt +93 -0
- package/dist/fonts/manrope-cyrillic-ext-normal.woff2 +0 -0
- package/dist/fonts/manrope-cyrillic-normal.woff2 +0 -0
- package/dist/fonts/manrope-greek-normal.woff2 +0 -0
- package/dist/fonts/manrope-latin-ext-normal.woff2 +0 -0
- package/dist/fonts/manrope-latin-normal.woff2 +0 -0
- package/dist/fonts/manrope-vietnamese-normal.woff2 +0 -0
- package/dist/fonts.css +148 -0
- package/dist/hooks/form/index.cjs +11 -0
- package/dist/hooks/form/index.js +3 -0
- package/dist/hooks/form/useRaydenFormControl.cjs +81 -0
- package/dist/hooks/form/useRaydenFormControl.js +76 -0
- package/dist/hooks/form/useRaydenInput.cjs +38 -0
- package/dist/hooks/form/useRaydenInput.js +35 -0
- package/dist/hooks/form/useRaydenSelect.cjs +45 -0
- package/dist/hooks/form/useRaydenSelect.js +42 -0
- package/dist/hooks/index.cjs +17 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useBodyScrollLock.cjs +24 -0
- package/dist/hooks/useBodyScrollLock.js +21 -0
- package/dist/hooks/useCollisionAwareSide.cjs +72 -0
- package/dist/hooks/useCollisionAwareSide.js +69 -0
- package/dist/hooks/useControllableValue.cjs +16 -0
- package/dist/hooks/useControllableValue.js +13 -0
- package/dist/hooks/useDismissableLayer.cjs +100 -0
- package/dist/hooks/useDismissableLayer.js +97 -0
- package/dist/hooks/usePopupList.cjs +101 -0
- package/dist/hooks/usePopupList.js +98 -0
- package/dist/icons-8yD7I5jO.d.cts +430 -0
- package/dist/icons-8yD7I5jO.d.ts +430 -0
- package/dist/icons.cjs +2111 -418
- package/dist/icons.d.cts +1256 -429
- package/dist/icons.d.ts +1256 -429
- package/dist/icons.js +2089 -1
- package/dist/index.cjs +128 -15046
- package/dist/index.d.cts +697 -662
- package/dist/index.d.ts +697 -662
- package/dist/index.js +43 -14962
- package/dist/motion/Collapse.cjs +28 -0
- package/dist/motion/Collapse.js +25 -0
- package/dist/motion/MotionProvider.cjs +43 -0
- package/dist/motion/MotionProvider.js +38 -0
- package/dist/motion/Pressable.cjs +46 -0
- package/dist/motion/Pressable.js +43 -0
- package/dist/motion/Reveal.cjs +19 -0
- package/dist/motion/Reveal.js +16 -0
- package/dist/motion/SharedLayout.cjs +46 -0
- package/dist/motion/SharedLayout.js +43 -0
- package/dist/motion/index.cjs +19 -0
- package/dist/motion/index.js +6 -0
- package/dist/motion/presence.cjs +58 -0
- package/dist/motion/presence.js +55 -0
- package/dist/motion/presets.cjs +88 -0
- package/dist/motion/presets.js +84 -0
- package/dist/motion.d.cts +51 -0
- package/dist/motion.d.ts +51 -0
- package/dist/preset.cjs +356 -195
- package/dist/preset.d.cts +111 -32
- package/dist/preset.d.ts +111 -32
- package/dist/preset.js +353 -187
- package/dist/presets-Ba5QndHg.d.cts +144 -0
- package/dist/presets-Ba5QndHg.d.ts +144 -0
- package/dist/styles.css +1 -1
- package/dist/utils/cn.cjs +38 -0
- package/dist/utils/cn.js +35 -0
- package/dist/utils/resolveIcon.cjs +18 -0
- package/dist/utils/resolveIcon.js +15 -0
- package/package.json +79 -21
package/dist/chart.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createGradientFill = exports.hexToRgba = exports.chartFont = exports.chartColors = exports.RaydenChart = void 0;
|
|
4
|
+
// Charts live behind their own subpath so that `chart.js` and `react-chartjs-2`
|
|
5
|
+
// — declared optional in peerDependenciesMeta — are only evaluated by consumers
|
|
6
|
+
// that actually import a chart. Re-exporting these from the package root made
|
|
7
|
+
// the optional peers mandatory for every Node/SSR import of `@raydenui/ui`.
|
|
8
|
+
var Chart_1 = require("./components/Chart/index.cjs");
|
|
9
|
+
Object.defineProperty(exports, "RaydenChart", { enumerable: true, get: function () { return Chart_1.RaydenChart; } });
|
|
10
|
+
Object.defineProperty(exports, "chartColors", { enumerable: true, get: function () { return Chart_1.chartColors; } });
|
|
11
|
+
Object.defineProperty(exports, "chartFont", { enumerable: true, get: function () { return Chart_1.chartFont; } });
|
|
12
|
+
Object.defineProperty(exports, "hexToRgba", { enumerable: true, get: function () { return Chart_1.hexToRgba; } });
|
|
13
|
+
Object.defineProperty(exports, "createGradientFill", { enumerable: true, get: function () { return Chart_1.createGradientFill; } });
|
package/dist/chart.d.cts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
import { ChartData, ChartOptions } from 'chart.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Rayna UI chart theme — color palette and defaults for Chart.js components.
|
|
7
|
+
*/
|
|
8
|
+
declare const chartColors: {
|
|
9
|
+
readonly primary: readonly ["#F56630", "#FA9874", "#FCB59A", "#FCD2C2", "#FFECE5"];
|
|
10
|
+
readonly semantic: readonly ["#F56630", "#0F973D", "#1671D9", "#F3A218", "#D42620", "#0BA5EC"];
|
|
11
|
+
readonly extended: readonly ["#F56630", "#0F973D", "#1671D9", "#F3A218", "#D42620", "#0BA5EC", "#475CCC", "#8D8484", "#F77A4A", "#40B869"];
|
|
12
|
+
readonly grey: {
|
|
13
|
+
readonly 50: "#F9FAFB";
|
|
14
|
+
readonly 100: "#F0F2F5";
|
|
15
|
+
readonly 200: "#E4E7EC";
|
|
16
|
+
readonly 300: "#D0D5DD";
|
|
17
|
+
readonly 400: "#98A2B3";
|
|
18
|
+
readonly 500: "#667185";
|
|
19
|
+
readonly 700: "#344054";
|
|
20
|
+
readonly 900: "#101928";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/** Default font for Chart.js */
|
|
24
|
+
declare const chartFont: {
|
|
25
|
+
family: string;
|
|
26
|
+
size: number;
|
|
27
|
+
weight: "normal";
|
|
28
|
+
};
|
|
29
|
+
/** Create an rgba version of a hex color */
|
|
30
|
+
declare function hexToRgba(hex: string, alpha: number): string;
|
|
31
|
+
/** Generate a gradient fill for area charts */
|
|
32
|
+
declare function createGradientFill(ctx: CanvasRenderingContext2D, color: string, height: number): CanvasGradient;
|
|
33
|
+
|
|
34
|
+
type ChartType = "line" | "bar" | "pie" | "doughnut" | "radar" | "scatter" | "bubble" | "polar-area";
|
|
35
|
+
interface RaydenChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
36
|
+
/** Chart type */
|
|
37
|
+
type: ChartType;
|
|
38
|
+
/** Chart.js data object */
|
|
39
|
+
data: ChartData<any>;
|
|
40
|
+
/** Chart.js options (merged with Rayna defaults) */
|
|
41
|
+
options?: ChartOptions<any>;
|
|
42
|
+
/** Chart height */
|
|
43
|
+
height?: number;
|
|
44
|
+
/** Chart width */
|
|
45
|
+
width?: number;
|
|
46
|
+
/** Accessible name for the chart. Without this the canvas is an unnamed role="img". */
|
|
47
|
+
title?: string;
|
|
48
|
+
/** Optional plain-language summary announced alongside the chart. */
|
|
49
|
+
summary?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Render a visually hidden data table equivalent to the chart. Defaults to true
|
|
52
|
+
* so the underlying numbers are never canvas-only. Set false when an equivalent
|
|
53
|
+
* table is already present elsewhere on the page.
|
|
54
|
+
*/
|
|
55
|
+
dataTable?: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare const RaydenChart: react.ForwardRefExoticComponent<RaydenChartProps & react.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
|
|
59
|
+
export { type ChartType, RaydenChart, type RaydenChartProps, chartColors, chartFont, createGradientFill, hexToRgba };
|
package/dist/chart.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
import { ChartData, ChartOptions } from 'chart.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Rayna UI chart theme — color palette and defaults for Chart.js components.
|
|
7
|
+
*/
|
|
8
|
+
declare const chartColors: {
|
|
9
|
+
readonly primary: readonly ["#F56630", "#FA9874", "#FCB59A", "#FCD2C2", "#FFECE5"];
|
|
10
|
+
readonly semantic: readonly ["#F56630", "#0F973D", "#1671D9", "#F3A218", "#D42620", "#0BA5EC"];
|
|
11
|
+
readonly extended: readonly ["#F56630", "#0F973D", "#1671D9", "#F3A218", "#D42620", "#0BA5EC", "#475CCC", "#8D8484", "#F77A4A", "#40B869"];
|
|
12
|
+
readonly grey: {
|
|
13
|
+
readonly 50: "#F9FAFB";
|
|
14
|
+
readonly 100: "#F0F2F5";
|
|
15
|
+
readonly 200: "#E4E7EC";
|
|
16
|
+
readonly 300: "#D0D5DD";
|
|
17
|
+
readonly 400: "#98A2B3";
|
|
18
|
+
readonly 500: "#667185";
|
|
19
|
+
readonly 700: "#344054";
|
|
20
|
+
readonly 900: "#101928";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/** Default font for Chart.js */
|
|
24
|
+
declare const chartFont: {
|
|
25
|
+
family: string;
|
|
26
|
+
size: number;
|
|
27
|
+
weight: "normal";
|
|
28
|
+
};
|
|
29
|
+
/** Create an rgba version of a hex color */
|
|
30
|
+
declare function hexToRgba(hex: string, alpha: number): string;
|
|
31
|
+
/** Generate a gradient fill for area charts */
|
|
32
|
+
declare function createGradientFill(ctx: CanvasRenderingContext2D, color: string, height: number): CanvasGradient;
|
|
33
|
+
|
|
34
|
+
type ChartType = "line" | "bar" | "pie" | "doughnut" | "radar" | "scatter" | "bubble" | "polar-area";
|
|
35
|
+
interface RaydenChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
36
|
+
/** Chart type */
|
|
37
|
+
type: ChartType;
|
|
38
|
+
/** Chart.js data object */
|
|
39
|
+
data: ChartData<any>;
|
|
40
|
+
/** Chart.js options (merged with Rayna defaults) */
|
|
41
|
+
options?: ChartOptions<any>;
|
|
42
|
+
/** Chart height */
|
|
43
|
+
height?: number;
|
|
44
|
+
/** Chart width */
|
|
45
|
+
width?: number;
|
|
46
|
+
/** Accessible name for the chart. Without this the canvas is an unnamed role="img". */
|
|
47
|
+
title?: string;
|
|
48
|
+
/** Optional plain-language summary announced alongside the chart. */
|
|
49
|
+
summary?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Render a visually hidden data table equivalent to the chart. Defaults to true
|
|
52
|
+
* so the underlying numbers are never canvas-only. Set false when an equivalent
|
|
53
|
+
* table is already present elsewhere on the page.
|
|
54
|
+
*/
|
|
55
|
+
dataTable?: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare const RaydenChart: react.ForwardRefExoticComponent<RaydenChartProps & react.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
|
|
59
|
+
export { type ChartType, RaydenChart, type RaydenChartProps, chartColors, chartFont, createGradientFill, hexToRgba };
|
package/dist/chart.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Charts live behind their own subpath so that `chart.js` and `react-chartjs-2`
|
|
2
|
+
// — declared optional in peerDependenciesMeta — are only evaluated by consumers
|
|
3
|
+
// that actually import a chart. Re-exporting these from the package root made
|
|
4
|
+
// the optional peers mandatory for every Node/SSR import of `@raydenui/ui`.
|
|
5
|
+
export { RaydenChart, chartColors, chartFont, hexToRgba, createGradientFill, } from "./components/Chart/index.js";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccordionContent = exports.AccordionTrigger = exports.AccordionItem = exports.Accordion = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const cn_1 = require("../../utils/cn.cjs");
|
|
7
|
+
const resolveIcon_1 = require("../../utils/resolveIcon.cjs");
|
|
8
|
+
const AccordionContext = (0, react_1.createContext)(null);
|
|
9
|
+
const AccordionItemContext = (0, react_1.createContext)(null);
|
|
10
|
+
function useAccordionContext() {
|
|
11
|
+
const ctx = (0, react_1.useContext)(AccordionContext);
|
|
12
|
+
if (!ctx)
|
|
13
|
+
throw new Error("Accordion compound components must be used within <Accordion>");
|
|
14
|
+
return ctx;
|
|
15
|
+
}
|
|
16
|
+
function useAccordionItemContext() {
|
|
17
|
+
const ctx = (0, react_1.useContext)(AccordionItemContext);
|
|
18
|
+
if (!ctx)
|
|
19
|
+
throw new Error("AccordionTrigger/Content must be used within <AccordionItem>");
|
|
20
|
+
return ctx;
|
|
21
|
+
}
|
|
22
|
+
/* ─── Chevron ──────────────────────────────────────────────────────────── */
|
|
23
|
+
function ChevronDown({ className }) {
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: (0, jsx_runtime_1.jsx)("path", { d: "M6 9l6 6 6-6" }) }));
|
|
25
|
+
}
|
|
26
|
+
/* ─── Accordion Root ───────────────────────────────────────────────────── */
|
|
27
|
+
exports.Accordion = (0, react_1.forwardRef)(({ type = "default", multiple = false, value: controlledValue, defaultValue = [], onValueChange, className, children, ...rest }, ref) => {
|
|
28
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, react_1.useState)(defaultValue);
|
|
29
|
+
const openItems = controlledValue ?? uncontrolledValue;
|
|
30
|
+
const toggle = (0, react_1.useCallback)((itemValue) => {
|
|
31
|
+
const next = openItems.includes(itemValue)
|
|
32
|
+
? openItems.filter((v) => v !== itemValue)
|
|
33
|
+
: multiple
|
|
34
|
+
? [...openItems, itemValue]
|
|
35
|
+
: [itemValue];
|
|
36
|
+
if (!controlledValue)
|
|
37
|
+
setUncontrolledValue(next);
|
|
38
|
+
onValueChange?.(next);
|
|
39
|
+
}, [openItems, multiple, controlledValue, onValueChange]);
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(AccordionContext.Provider, { value: { type, openItems, toggle }, children: (0, jsx_runtime_1.jsx)("div", { ref: ref, className: (0, cn_1.cn)("w-full", type === "nested" && "flex flex-col gap-3", className), ...rest, children: children }) }));
|
|
41
|
+
});
|
|
42
|
+
exports.Accordion.displayName = "Accordion";
|
|
43
|
+
/* ─── AccordionItem ────────────────────────────────────────────────────── */
|
|
44
|
+
exports.AccordionItem = (0, react_1.forwardRef)(({ value, disabled = false, className, children, ...rest }, ref) => {
|
|
45
|
+
const { type, openItems } = useAccordionContext();
|
|
46
|
+
const isOpen = openItems.includes(value);
|
|
47
|
+
const generatedId = (0, react_1.useId)();
|
|
48
|
+
const triggerId = `accordion-trigger-${generatedId}`;
|
|
49
|
+
const contentId = `accordion-content-${generatedId}`;
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(AccordionItemContext.Provider, { value: { value, isOpen, disabled, triggerId, contentId }, children: (0, jsx_runtime_1.jsx)("div", { ref: ref, className: (0, cn_1.cn)("border-solid transition-colors", type === "default"
|
|
51
|
+
? (0, cn_1.cn)("border-b", isOpen ? "border-primary-300" : "border-grey-100")
|
|
52
|
+
: (0, cn_1.cn)("border rounded-[10px]", isOpen ? "border-primary-300" : "border-grey-75"), className), ...rest, children: children }) }));
|
|
53
|
+
});
|
|
54
|
+
exports.AccordionItem.displayName = "AccordionItem";
|
|
55
|
+
/* ─── AccordionTrigger ─────────────────────────────────────────────────── */
|
|
56
|
+
exports.AccordionTrigger = (0, react_1.forwardRef)(({ leadingIcon, leadingNumber, leadingLogo, badge, hideChevron = false, className, children, onClick, ...rest }, ref) => {
|
|
57
|
+
const { toggle } = useAccordionContext();
|
|
58
|
+
// The internal handler is composed AFTER {...rest} so a consumer onClick
|
|
59
|
+
// cannot replace the toggle; calling preventDefault() cancels it.
|
|
60
|
+
const { value, isOpen, disabled, triggerId, contentId } = useAccordionItemContext();
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)("button", { ref: ref, id: triggerId, type: "button", disabled: disabled, "aria-expanded": isOpen, "aria-controls": contentId, className: (0, cn_1.cn)("flex items-center gap-3 px-4 py-6 w-full text-left transition-colors", !isOpen && !disabled && "hover:bg-grey-50 dark:hover:bg-grey-100", disabled && "opacity-50 cursor-not-allowed", className), ...rest, onClick: (event) => {
|
|
62
|
+
onClick?.(event);
|
|
63
|
+
if (!event.defaultPrevented)
|
|
64
|
+
toggle(value);
|
|
65
|
+
}, children: [leadingNumber && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0 flex items-center justify-center bg-grey-700 text-grey-50 text-base font-medium leading-[1.48] rounded-xl px-2 py-1 min-w-[37px]", children: leadingNumber })), leadingLogo && (0, jsx_runtime_1.jsx)("span", { className: "shrink-0", children: leadingLogo }), leadingIcon && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0 size-6 text-grey-500", children: (0, resolveIcon_1.resolveIcon)(leadingIcon, "md") })), (0, jsx_runtime_1.jsx)("span", { className: "flex-1 min-w-0 text-lg font-semibold text-grey-900 leading-[1.54]", children: children }), badge != null && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0 bg-primary-50 text-action-primary-text text-sm font-medium rounded-full px-3 py-2 leading-[1.45]", children: badge })), !hideChevron && ((0, jsx_runtime_1.jsx)(ChevronDown, { className: (0, cn_1.cn)("shrink-0 size-6 text-grey-500 transition-transform duration-200", isOpen && "rotate-180") }))] }));
|
|
66
|
+
});
|
|
67
|
+
exports.AccordionTrigger.displayName = "AccordionTrigger";
|
|
68
|
+
/* ─── AccordionContent ─────────────────────────────────────────────────── */
|
|
69
|
+
exports.AccordionContent = (0, react_1.forwardRef)(({ className, children, ...rest }, ref) => {
|
|
70
|
+
const { isOpen, triggerId, contentId } = useAccordionItemContext();
|
|
71
|
+
const regionRef = (0, react_1.useRef)(null);
|
|
72
|
+
const wasOpen = (0, react_1.useRef)(isOpen);
|
|
73
|
+
// Collapsing is a grid-rows transition, which hides the panel visually but
|
|
74
|
+
// leaves its descendants focusable and in the accessibility tree. `inert`
|
|
75
|
+
// closes that gap; if focus was already inside when the panel closed, send
|
|
76
|
+
// it back to the trigger rather than dropping it on the document.
|
|
77
|
+
(0, react_1.useEffect)(() => {
|
|
78
|
+
if (wasOpen.current && !isOpen) {
|
|
79
|
+
const node = regionRef.current;
|
|
80
|
+
if (node && node.contains(document.activeElement)) {
|
|
81
|
+
document.getElementById(triggerId)?.focus();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
wasOpen.current = isOpen;
|
|
85
|
+
}, [isOpen, triggerId]);
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: (node) => {
|
|
87
|
+
regionRef.current = node;
|
|
88
|
+
if (typeof ref === "function")
|
|
89
|
+
ref(node);
|
|
90
|
+
else if (ref)
|
|
91
|
+
ref.current = node;
|
|
92
|
+
}, id: contentId, role: "region", "aria-labelledby": triggerId, inert: !isOpen, className: (0, cn_1.cn)("grid transition-[grid-template-rows] duration-200 ease-out", isOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"), children: (0, jsx_runtime_1.jsx)("div", { className: "overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("px-4 pb-6 text-base text-grey-500 leading-[1.48]", className), ...rest, children: children }) }) }));
|
|
93
|
+
});
|
|
94
|
+
exports.AccordionContent.displayName = "AccordionContent";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useRef, useState, } from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { resolveIcon } from "../../utils/resolveIcon.js";
|
|
5
|
+
const AccordionContext = createContext(null);
|
|
6
|
+
const AccordionItemContext = createContext(null);
|
|
7
|
+
function useAccordionContext() {
|
|
8
|
+
const ctx = useContext(AccordionContext);
|
|
9
|
+
if (!ctx)
|
|
10
|
+
throw new Error("Accordion compound components must be used within <Accordion>");
|
|
11
|
+
return ctx;
|
|
12
|
+
}
|
|
13
|
+
function useAccordionItemContext() {
|
|
14
|
+
const ctx = useContext(AccordionItemContext);
|
|
15
|
+
if (!ctx)
|
|
16
|
+
throw new Error("AccordionTrigger/Content must be used within <AccordionItem>");
|
|
17
|
+
return ctx;
|
|
18
|
+
}
|
|
19
|
+
/* ─── Chevron ──────────────────────────────────────────────────────────── */
|
|
20
|
+
function ChevronDown({ className }) {
|
|
21
|
+
return (_jsx("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "M6 9l6 6 6-6" }) }));
|
|
22
|
+
}
|
|
23
|
+
/* ─── Accordion Root ───────────────────────────────────────────────────── */
|
|
24
|
+
export const Accordion = forwardRef(({ type = "default", multiple = false, value: controlledValue, defaultValue = [], onValueChange, className, children, ...rest }, ref) => {
|
|
25
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
26
|
+
const openItems = controlledValue ?? uncontrolledValue;
|
|
27
|
+
const toggle = useCallback((itemValue) => {
|
|
28
|
+
const next = openItems.includes(itemValue)
|
|
29
|
+
? openItems.filter((v) => v !== itemValue)
|
|
30
|
+
: multiple
|
|
31
|
+
? [...openItems, itemValue]
|
|
32
|
+
: [itemValue];
|
|
33
|
+
if (!controlledValue)
|
|
34
|
+
setUncontrolledValue(next);
|
|
35
|
+
onValueChange?.(next);
|
|
36
|
+
}, [openItems, multiple, controlledValue, onValueChange]);
|
|
37
|
+
return (_jsx(AccordionContext.Provider, { value: { type, openItems, toggle }, children: _jsx("div", { ref: ref, className: cn("w-full", type === "nested" && "flex flex-col gap-3", className), ...rest, children: children }) }));
|
|
38
|
+
});
|
|
39
|
+
Accordion.displayName = "Accordion";
|
|
40
|
+
/* ─── AccordionItem ────────────────────────────────────────────────────── */
|
|
41
|
+
export const AccordionItem = forwardRef(({ value, disabled = false, className, children, ...rest }, ref) => {
|
|
42
|
+
const { type, openItems } = useAccordionContext();
|
|
43
|
+
const isOpen = openItems.includes(value);
|
|
44
|
+
const generatedId = useId();
|
|
45
|
+
const triggerId = `accordion-trigger-${generatedId}`;
|
|
46
|
+
const contentId = `accordion-content-${generatedId}`;
|
|
47
|
+
return (_jsx(AccordionItemContext.Provider, { value: { value, isOpen, disabled, triggerId, contentId }, children: _jsx("div", { ref: ref, className: cn("border-solid transition-colors", type === "default"
|
|
48
|
+
? cn("border-b", isOpen ? "border-primary-300" : "border-grey-100")
|
|
49
|
+
: cn("border rounded-[10px]", isOpen ? "border-primary-300" : "border-grey-75"), className), ...rest, children: children }) }));
|
|
50
|
+
});
|
|
51
|
+
AccordionItem.displayName = "AccordionItem";
|
|
52
|
+
/* ─── AccordionTrigger ─────────────────────────────────────────────────── */
|
|
53
|
+
export const AccordionTrigger = forwardRef(({ leadingIcon, leadingNumber, leadingLogo, badge, hideChevron = false, className, children, onClick, ...rest }, ref) => {
|
|
54
|
+
const { toggle } = useAccordionContext();
|
|
55
|
+
// The internal handler is composed AFTER {...rest} so a consumer onClick
|
|
56
|
+
// cannot replace the toggle; calling preventDefault() cancels it.
|
|
57
|
+
const { value, isOpen, disabled, triggerId, contentId } = useAccordionItemContext();
|
|
58
|
+
return (_jsxs("button", { ref: ref, id: triggerId, type: "button", disabled: disabled, "aria-expanded": isOpen, "aria-controls": contentId, className: cn("flex items-center gap-3 px-4 py-6 w-full text-left transition-colors", !isOpen && !disabled && "hover:bg-grey-50 dark:hover:bg-grey-100", disabled && "opacity-50 cursor-not-allowed", className), ...rest, onClick: (event) => {
|
|
59
|
+
onClick?.(event);
|
|
60
|
+
if (!event.defaultPrevented)
|
|
61
|
+
toggle(value);
|
|
62
|
+
}, children: [leadingNumber && (_jsx("span", { className: "shrink-0 flex items-center justify-center bg-grey-700 text-grey-50 text-base font-medium leading-[1.48] rounded-xl px-2 py-1 min-w-[37px]", children: leadingNumber })), leadingLogo && _jsx("span", { className: "shrink-0", children: leadingLogo }), leadingIcon && (_jsx("span", { className: "shrink-0 size-6 text-grey-500", children: resolveIcon(leadingIcon, "md") })), _jsx("span", { className: "flex-1 min-w-0 text-lg font-semibold text-grey-900 leading-[1.54]", children: children }), badge != null && (_jsx("span", { className: "shrink-0 bg-primary-50 text-action-primary-text text-sm font-medium rounded-full px-3 py-2 leading-[1.45]", children: badge })), !hideChevron && (_jsx(ChevronDown, { className: cn("shrink-0 size-6 text-grey-500 transition-transform duration-200", isOpen && "rotate-180") }))] }));
|
|
63
|
+
});
|
|
64
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
65
|
+
/* ─── AccordionContent ─────────────────────────────────────────────────── */
|
|
66
|
+
export const AccordionContent = forwardRef(({ className, children, ...rest }, ref) => {
|
|
67
|
+
const { isOpen, triggerId, contentId } = useAccordionItemContext();
|
|
68
|
+
const regionRef = useRef(null);
|
|
69
|
+
const wasOpen = useRef(isOpen);
|
|
70
|
+
// Collapsing is a grid-rows transition, which hides the panel visually but
|
|
71
|
+
// leaves its descendants focusable and in the accessibility tree. `inert`
|
|
72
|
+
// closes that gap; if focus was already inside when the panel closed, send
|
|
73
|
+
// it back to the trigger rather than dropping it on the document.
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (wasOpen.current && !isOpen) {
|
|
76
|
+
const node = regionRef.current;
|
|
77
|
+
if (node && node.contains(document.activeElement)) {
|
|
78
|
+
document.getElementById(triggerId)?.focus();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
wasOpen.current = isOpen;
|
|
82
|
+
}, [isOpen, triggerId]);
|
|
83
|
+
return (_jsx("div", { ref: (node) => {
|
|
84
|
+
regionRef.current = node;
|
|
85
|
+
if (typeof ref === "function")
|
|
86
|
+
ref(node);
|
|
87
|
+
else if (ref)
|
|
88
|
+
ref.current = node;
|
|
89
|
+
}, id: contentId, role: "region", "aria-labelledby": triggerId, inert: !isOpen, className: cn("grid transition-[grid-template-rows] duration-200 ease-out", isOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"), children: _jsx("div", { className: "overflow-hidden", children: _jsx("div", { className: cn("px-4 pb-6 text-base text-grey-500 leading-[1.48]", className), ...rest, children: children }) }) }));
|
|
90
|
+
});
|
|
91
|
+
AccordionContent.displayName = "AccordionContent";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccordionContent = exports.AccordionTrigger = exports.AccordionItem = exports.Accordion = void 0;
|
|
4
|
+
var Accordion_1 = require("./Accordion.cjs");
|
|
5
|
+
Object.defineProperty(exports, "Accordion", { enumerable: true, get: function () { return Accordion_1.Accordion; } });
|
|
6
|
+
Object.defineProperty(exports, "AccordionItem", { enumerable: true, get: function () { return Accordion_1.AccordionItem; } });
|
|
7
|
+
Object.defineProperty(exports, "AccordionTrigger", { enumerable: true, get: function () { return Accordion_1.AccordionTrigger; } });
|
|
8
|
+
Object.defineProperty(exports, "AccordionContent", { enumerable: true, get: function () { return Accordion_1.AccordionContent; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "./Accordion.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActivityContent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const cn_1 = require("../../utils/cn.cjs");
|
|
7
|
+
const resolveIcon_1 = require("../../utils/resolveIcon.cjs");
|
|
8
|
+
const Icon_1 = require("../Icon/index.cjs");
|
|
9
|
+
// ─── Style wrapper classes ────────────────────────────────
|
|
10
|
+
const styleClasses = {
|
|
11
|
+
plain: "",
|
|
12
|
+
card: "bg-surface rounded-lg p-2 shadow-[0px_2px_5px_-2px_rgba(16,25,40,0.06),0px_2px_7px_0px_rgba(16,25,40,0.05),0px_0px_0px_1px_rgba(16,25,40,0.05)]",
|
|
13
|
+
container: "bg-grey-50 border border-grey-100 rounded-lg p-3",
|
|
14
|
+
};
|
|
15
|
+
exports.ActivityContent = (0, react_1.forwardRef)(({ variant, contentStyle = "card",
|
|
16
|
+
// File props
|
|
17
|
+
icon, title, size, fileType, date,
|
|
18
|
+
// Comment props
|
|
19
|
+
avatar, author, timestamp, comment, attachments, reactions, replies, onReply,
|
|
20
|
+
// CTA props
|
|
21
|
+
primaryAction, secondaryAction, className, ...rest }, ref) => {
|
|
22
|
+
// ─── File variant ─────────────────────────────────────
|
|
23
|
+
if (variant === "file") {
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, cn_1.cn)("flex min-w-0 items-center gap-2", styleClasses[contentStyle], className), ...rest, children: [(0, jsx_runtime_1.jsx)("div", { className: "flex shrink-0 items-center justify-center size-8 rounded-lg bg-primary-50", children: (0, jsx_runtime_1.jsx)("span", { className: "size-4", children: (0, resolveIcon_1.resolveIcon)(icon ?? "file", "sm") }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-col items-start", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "min-w-0 text-xs font-semibold text-on-surface-body break-words", children: title }), size && ((0, jsx_runtime_1.jsxs)("span", { className: "inline-flex max-w-full items-center gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "size-0.5 shrink-0 rounded-full bg-grey-400", "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-on-surface-muted whitespace-nowrap", children: size })] }))] }), (fileType || date) && ((0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-1", children: [fileType && ((0, jsx_runtime_1.jsx)("span", { className: "text-xs text-on-surface-muted whitespace-nowrap", children: fileType })), date && ((0, jsx_runtime_1.jsxs)("span", { className: "inline-flex max-w-full items-center gap-1", children: [fileType && ((0, jsx_runtime_1.jsx)("span", { className: "size-0.5 shrink-0 rounded-full bg-grey-400", "aria-hidden": "true" })), (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-on-surface-muted whitespace-nowrap", children: date })] }))] }))] })] }));
|
|
25
|
+
}
|
|
26
|
+
// ─── Comment variant ──────────────────────────────────
|
|
27
|
+
if (variant === "comment") {
|
|
28
|
+
const commentContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(avatar || author) && ((0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 items-center gap-2 w-full", children: [avatar && (0, jsx_runtime_1.jsx)("div", { className: "shrink-0 size-5", children: avatar }), (0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-wrap items-baseline", children: [author && ((0, jsx_runtime_1.jsx)("span", { className: "min-w-0 text-body-sm font-medium text-on-surface-body break-words", children: author })), timestamp && ((0, jsx_runtime_1.jsxs)("span", { className: "min-w-0 text-xs text-on-surface-muted break-words", children: ["\u30FB", timestamp] }))] })] })), comment && ((0, jsx_runtime_1.jsx)("p", { className: "w-full text-body-sm text-on-surface-secondary leading-5 break-words", children: comment })), attachments && attachments.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-wrap items-start gap-2", children: [attachments.slice(0, 2).map((file) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 max-w-full items-center gap-2 rounded-lg border border-grey-100 bg-surface pl-1 pr-2 py-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex shrink-0 items-center justify-center size-6 rounded bg-primary-50 border border-primary-50", children: (0, jsx_runtime_1.jsx)("span", { className: "size-3", children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "file", size: "xs" }) }) }), (0, jsx_runtime_1.jsxs)("span", { className: "min-w-0 truncate text-xs text-on-surface-body", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-semibold", children: file.name }), (0, jsx_runtime_1.jsxs)("span", { className: "text-on-surface-muted", children: [".", file.extension] })] })] }, `${file.name}.${file.extension}`))), attachments.length > 2 && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center size-8 rounded-lg border border-grey-100 bg-surface px-2 py-1", children: (0, jsx_runtime_1.jsxs)("span", { className: "text-xs font-semibold text-on-surface-body", children: ["+", attachments.length - 2] }) }))] })), (reactions != null || replies != null) && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-start gap-2", children: [reactions != null && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 rounded-lg border border-grey-100 bg-surface px-2 py-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs text-on-surface-body", children: "\uD83E\uDD1D\uD83D\uDD25" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-xs text-on-surface-body", children: [(0, jsx_runtime_1.jsxs)("span", { className: "font-semibold", children: [reactions, " "] }), "Reactions"] })] })), replies != null && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 rounded-lg border border-grey-100 bg-surface px-2 py-1 h-8", children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "message", size: "sm", className: "text-on-surface-muted" }), (0, jsx_runtime_1.jsxs)("span", { className: "text-xs text-on-surface-body", children: [(0, jsx_runtime_1.jsxs)("span", { className: "font-semibold", children: [replies, " "] }), "Replies"] })] }))] })), onReply && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onReply, className: "inline-flex items-center justify-center rounded-lg border border-control-border bg-surface px-3 py-1 text-xs font-semibold text-on-surface-body", children: "Reply" }))] }));
|
|
29
|
+
if (contentStyle === "plain") {
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, cn_1.cn)("flex gap-2 items-start", className), ...rest, children: [(0, jsx_runtime_1.jsx)("div", { className: "shrink-0 w-px self-stretch bg-grey-100" }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-2 items-start rounded-lg p-3", children: commentContent })] }));
|
|
31
|
+
}
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: (0, cn_1.cn)("flex flex-col gap-2 items-start", styleClasses[contentStyle], className), ...rest, children: commentContent }));
|
|
33
|
+
}
|
|
34
|
+
// ─── CTA variant ──────────────────────────────────────
|
|
35
|
+
if (variant === "cta") {
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, cn_1.cn)("flex flex-wrap items-start gap-3", className), ...rest, children: [primaryAction && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: primaryAction.onClick, className: "inline-flex items-center justify-center rounded-lg bg-action-primary px-4 py-2 text-body-sm font-semibold text-white", children: primaryAction.label })), secondaryAction && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: secondaryAction.onClick, className: "inline-flex items-center justify-center rounded-lg border border-control-border bg-surface px-4 py-2 text-body-sm font-semibold text-on-surface-body", children: secondaryAction.label }))] }));
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
});
|
|
40
|
+
exports.ActivityContent.displayName = "ActivityContent";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { resolveIcon } from "../../utils/resolveIcon.js";
|
|
5
|
+
import { Icon } from "../Icon/index.js";
|
|
6
|
+
// ─── Style wrapper classes ────────────────────────────────
|
|
7
|
+
const styleClasses = {
|
|
8
|
+
plain: "",
|
|
9
|
+
card: "bg-surface rounded-lg p-2 shadow-[0px_2px_5px_-2px_rgba(16,25,40,0.06),0px_2px_7px_0px_rgba(16,25,40,0.05),0px_0px_0px_1px_rgba(16,25,40,0.05)]",
|
|
10
|
+
container: "bg-grey-50 border border-grey-100 rounded-lg p-3",
|
|
11
|
+
};
|
|
12
|
+
export const ActivityContent = forwardRef(({ variant, contentStyle = "card",
|
|
13
|
+
// File props
|
|
14
|
+
icon, title, size, fileType, date,
|
|
15
|
+
// Comment props
|
|
16
|
+
avatar, author, timestamp, comment, attachments, reactions, replies, onReply,
|
|
17
|
+
// CTA props
|
|
18
|
+
primaryAction, secondaryAction, className, ...rest }, ref) => {
|
|
19
|
+
// ─── File variant ─────────────────────────────────────
|
|
20
|
+
if (variant === "file") {
|
|
21
|
+
return (_jsxs("div", { ref: ref, className: cn("flex min-w-0 items-center gap-2", styleClasses[contentStyle], className), ...rest, children: [_jsx("div", { className: "flex shrink-0 items-center justify-center size-8 rounded-lg bg-primary-50", children: _jsx("span", { className: "size-4", children: resolveIcon(icon ?? "file", "sm") }) }), _jsxs("div", { className: "flex min-w-0 flex-col items-start", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-1", children: [_jsx("span", { className: "min-w-0 text-xs font-semibold text-on-surface-body break-words", children: title }), size && (_jsxs("span", { className: "inline-flex max-w-full items-center gap-1", children: [_jsx("span", { className: "size-0.5 shrink-0 rounded-full bg-grey-400", "aria-hidden": "true" }), _jsx("span", { className: "text-xs text-on-surface-muted whitespace-nowrap", children: size })] }))] }), (fileType || date) && (_jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-1", children: [fileType && (_jsx("span", { className: "text-xs text-on-surface-muted whitespace-nowrap", children: fileType })), date && (_jsxs("span", { className: "inline-flex max-w-full items-center gap-1", children: [fileType && (_jsx("span", { className: "size-0.5 shrink-0 rounded-full bg-grey-400", "aria-hidden": "true" })), _jsx("span", { className: "text-xs text-on-surface-muted whitespace-nowrap", children: date })] }))] }))] })] }));
|
|
22
|
+
}
|
|
23
|
+
// ─── Comment variant ──────────────────────────────────
|
|
24
|
+
if (variant === "comment") {
|
|
25
|
+
const commentContent = (_jsxs(_Fragment, { children: [(avatar || author) && (_jsxs("div", { className: "flex min-w-0 items-center gap-2 w-full", children: [avatar && _jsx("div", { className: "shrink-0 size-5", children: avatar }), _jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline", children: [author && (_jsx("span", { className: "min-w-0 text-body-sm font-medium text-on-surface-body break-words", children: author })), timestamp && (_jsxs("span", { className: "min-w-0 text-xs text-on-surface-muted break-words", children: ["\u30FB", timestamp] }))] })] })), comment && (_jsx("p", { className: "w-full text-body-sm text-on-surface-secondary leading-5 break-words", children: comment })), attachments && attachments.length > 0 && (_jsxs("div", { className: "flex min-w-0 flex-wrap items-start gap-2", children: [attachments.slice(0, 2).map((file) => (_jsxs("div", { className: "flex min-w-0 max-w-full items-center gap-2 rounded-lg border border-grey-100 bg-surface pl-1 pr-2 py-1", children: [_jsx("div", { className: "flex shrink-0 items-center justify-center size-6 rounded bg-primary-50 border border-primary-50", children: _jsx("span", { className: "size-3", children: _jsx(Icon, { name: "file", size: "xs" }) }) }), _jsxs("span", { className: "min-w-0 truncate text-xs text-on-surface-body", children: [_jsx("span", { className: "font-semibold", children: file.name }), _jsxs("span", { className: "text-on-surface-muted", children: [".", file.extension] })] })] }, `${file.name}.${file.extension}`))), attachments.length > 2 && (_jsx("div", { className: "flex items-center justify-center size-8 rounded-lg border border-grey-100 bg-surface px-2 py-1", children: _jsxs("span", { className: "text-xs font-semibold text-on-surface-body", children: ["+", attachments.length - 2] }) }))] })), (reactions != null || replies != null) && (_jsxs("div", { className: "flex flex-wrap items-start gap-2", children: [reactions != null && (_jsxs("div", { className: "flex items-center gap-2 rounded-lg border border-grey-100 bg-surface px-2 py-1", children: [_jsx("span", { className: "text-xs text-on-surface-body", children: "\uD83E\uDD1D\uD83D\uDD25" }), _jsxs("span", { className: "text-xs text-on-surface-body", children: [_jsxs("span", { className: "font-semibold", children: [reactions, " "] }), "Reactions"] })] })), replies != null && (_jsxs("div", { className: "flex items-center gap-2 rounded-lg border border-grey-100 bg-surface px-2 py-1 h-8", children: [_jsx(Icon, { name: "message", size: "sm", className: "text-on-surface-muted" }), _jsxs("span", { className: "text-xs text-on-surface-body", children: [_jsxs("span", { className: "font-semibold", children: [replies, " "] }), "Replies"] })] }))] })), onReply && (_jsx("button", { type: "button", onClick: onReply, className: "inline-flex items-center justify-center rounded-lg border border-control-border bg-surface px-3 py-1 text-xs font-semibold text-on-surface-body", children: "Reply" }))] }));
|
|
26
|
+
if (contentStyle === "plain") {
|
|
27
|
+
return (_jsxs("div", { ref: ref, className: cn("flex gap-2 items-start", className), ...rest, children: [_jsx("div", { className: "shrink-0 w-px self-stretch bg-grey-100" }), _jsx("div", { className: "flex flex-col gap-2 items-start rounded-lg p-3", children: commentContent })] }));
|
|
28
|
+
}
|
|
29
|
+
return (_jsx("div", { ref: ref, className: cn("flex flex-col gap-2 items-start", styleClasses[contentStyle], className), ...rest, children: commentContent }));
|
|
30
|
+
}
|
|
31
|
+
// ─── CTA variant ──────────────────────────────────────
|
|
32
|
+
if (variant === "cta") {
|
|
33
|
+
return (_jsxs("div", { ref: ref, className: cn("flex flex-wrap items-start gap-3", className), ...rest, children: [primaryAction && (_jsx("button", { type: "button", onClick: primaryAction.onClick, className: "inline-flex items-center justify-center rounded-lg bg-action-primary px-4 py-2 text-body-sm font-semibold text-white", children: primaryAction.label })), secondaryAction && (_jsx("button", { type: "button", onClick: secondaryAction.onClick, className: "inline-flex items-center justify-center rounded-lg border border-control-border bg-surface px-4 py-2 text-body-sm font-semibold text-on-surface-body", children: secondaryAction.label }))] }));
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
});
|
|
37
|
+
ActivityContent.displayName = "ActivityContent";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActivityItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const cn_1 = require("../../utils/cn.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Meta row segments wrap as a group so a separator never starts a line on its own,
|
|
9
|
+
* and long labels break instead of overflowing into the timestamp.
|
|
10
|
+
*/
|
|
11
|
+
const metaSegmentClasses = "inline-flex max-w-full min-w-0 items-baseline gap-1";
|
|
12
|
+
const metaSeparatorClasses = "text-xs text-grey-500";
|
|
13
|
+
const metaActionClasses = "min-w-0 break-words text-left text-xs font-medium text-action-primary-text underline rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-action-primary-text";
|
|
14
|
+
exports.ActivityItem = (0, react_1.forwardRef)(({ avatar, text, unread = false, date, time, link, badge, connector, children, className, ...rest }, ref) => {
|
|
15
|
+
const hasConnectorAbove = connector === "middle" || connector === "last";
|
|
16
|
+
const hasConnectorBelow = connector === "top" || connector === "middle";
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("article", { ref: ref, className: (0, cn_1.cn)("flex gap-3 items-start", className), ...rest, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex flex-col items-center shrink-0 gap-1 self-stretch", (connector === "last" || !connector) && "justify-start"), children: [hasConnectorAbove && (0, jsx_runtime_1.jsx)("div", { className: "h-2 w-px bg-grey-100", "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("div", { className: "shrink-0 size-8", children: avatar }), hasConnectorBelow && (0, jsx_runtime_1.jsx)("div", { className: "flex-1 w-px bg-grey-100", "aria-hidden": "true" })] }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("@container flex flex-1 flex-col gap-3 items-start min-w-0", !connector && "", connector === "top" && "pb-4", (connector === "middle" || connector === "last") && "py-4"), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1 w-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-start justify-between gap-2 w-full", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 items-start gap-1 min-w-0", children: (0, jsx_runtime_1.jsx)("span", { className: "text-body-sm leading-5 text-grey-600 break-words", children: text }) }), unread && ((0, jsx_runtime_1.jsx)("span", { className: "mt-1.5 shrink-0 size-2 rounded-full bg-[#04802E] border-[1.5px] border-white", "aria-hidden": "true" })), unread && (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Unread" })] }), (date || time || link || badge) && ((0, jsx_runtime_1.jsxs)("div", { className: "flex w-full flex-col gap-0.5 @min-[20rem]:flex-row @min-[20rem]:items-start @min-[20rem]:gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex min-w-0 flex-1 flex-wrap items-baseline gap-x-1 gap-y-0.5", children: [date && (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-grey-500 whitespace-nowrap", children: date }), link && ((0, jsx_runtime_1.jsxs)("span", { className: metaSegmentClasses, children: [date && ((0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", className: metaSeparatorClasses, children: "\u30FB" })), link.href ? ((0, jsx_runtime_1.jsx)("a", { href: link.href, onClick: link.onClick, className: metaActionClasses, children: link.label })) : ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: link.onClick, className: metaActionClasses, children: link.label }))] })), badge && ((0, jsx_runtime_1.jsxs)("span", { className: metaSegmentClasses, children: [(date || link) && ((0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", className: metaSeparatorClasses, children: "\u30FB" })), (0, jsx_runtime_1.jsx)("span", { className: "inline-flex min-w-0 items-center justify-center break-words rounded-full bg-action-primary px-2 text-xs font-medium text-white", children: badge })] }))] }), time && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0 text-xs text-grey-500 whitespace-nowrap", children: time }))] }))] }), children] })] }));
|
|
18
|
+
});
|
|
19
|
+
exports.ActivityItem.displayName = "ActivityItem";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
/**
|
|
5
|
+
* Meta row segments wrap as a group so a separator never starts a line on its own,
|
|
6
|
+
* and long labels break instead of overflowing into the timestamp.
|
|
7
|
+
*/
|
|
8
|
+
const metaSegmentClasses = "inline-flex max-w-full min-w-0 items-baseline gap-1";
|
|
9
|
+
const metaSeparatorClasses = "text-xs text-grey-500";
|
|
10
|
+
const metaActionClasses = "min-w-0 break-words text-left text-xs font-medium text-action-primary-text underline rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-action-primary-text";
|
|
11
|
+
export const ActivityItem = forwardRef(({ avatar, text, unread = false, date, time, link, badge, connector, children, className, ...rest }, ref) => {
|
|
12
|
+
const hasConnectorAbove = connector === "middle" || connector === "last";
|
|
13
|
+
const hasConnectorBelow = connector === "top" || connector === "middle";
|
|
14
|
+
return (_jsxs("article", { ref: ref, className: cn("flex gap-3 items-start", className), ...rest, children: [_jsxs("div", { className: cn("flex flex-col items-center shrink-0 gap-1 self-stretch", (connector === "last" || !connector) && "justify-start"), children: [hasConnectorAbove && _jsx("div", { className: "h-2 w-px bg-grey-100", "aria-hidden": "true" }), _jsx("div", { className: "shrink-0 size-8", children: avatar }), hasConnectorBelow && _jsx("div", { className: "flex-1 w-px bg-grey-100", "aria-hidden": "true" })] }), _jsxs("div", { className: cn("@container flex flex-1 flex-col gap-3 items-start min-w-0", !connector && "", connector === "top" && "pb-4", (connector === "middle" || connector === "last") && "py-4"), children: [_jsxs("div", { className: "flex flex-col gap-1 w-full", children: [_jsxs("div", { className: "flex items-start justify-between gap-2 w-full", children: [_jsx("div", { className: "flex flex-1 items-start gap-1 min-w-0", children: _jsx("span", { className: "text-body-sm leading-5 text-grey-600 break-words", children: text }) }), unread && (_jsx("span", { className: "mt-1.5 shrink-0 size-2 rounded-full bg-[#04802E] border-[1.5px] border-white", "aria-hidden": "true" })), unread && _jsx("span", { className: "sr-only", children: "Unread" })] }), (date || time || link || badge) && (_jsxs("div", { className: "flex w-full flex-col gap-0.5 @min-[20rem]:flex-row @min-[20rem]:items-start @min-[20rem]:gap-2", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-baseline gap-x-1 gap-y-0.5", children: [date && _jsx("span", { className: "text-xs text-grey-500 whitespace-nowrap", children: date }), link && (_jsxs("span", { className: metaSegmentClasses, children: [date && (_jsx("span", { "aria-hidden": "true", className: metaSeparatorClasses, children: "\u30FB" })), link.href ? (_jsx("a", { href: link.href, onClick: link.onClick, className: metaActionClasses, children: link.label })) : (_jsx("button", { type: "button", onClick: link.onClick, className: metaActionClasses, children: link.label }))] })), badge && (_jsxs("span", { className: metaSegmentClasses, children: [(date || link) && (_jsx("span", { "aria-hidden": "true", className: metaSeparatorClasses, children: "\u30FB" })), _jsx("span", { className: "inline-flex min-w-0 items-center justify-center break-words rounded-full bg-action-primary px-2 text-xs font-medium text-white", children: badge })] }))] }), time && (_jsx("span", { className: "shrink-0 text-xs text-grey-500 whitespace-nowrap", children: time }))] }))] }), children] })] }));
|
|
15
|
+
});
|
|
16
|
+
ActivityItem.displayName = "ActivityItem";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActivityContent = exports.ActivityItem = void 0;
|
|
4
|
+
var ActivityItem_1 = require("./ActivityItem.cjs");
|
|
5
|
+
Object.defineProperty(exports, "ActivityItem", { enumerable: true, get: function () { return ActivityItem_1.ActivityItem; } });
|
|
6
|
+
var ActivityContent_1 = require("./ActivityContent.cjs");
|
|
7
|
+
Object.defineProperty(exports, "ActivityContent", { enumerable: true, get: function () { return ActivityContent_1.ActivityContent; } });
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Alert = Alert;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const cn_1 = require("../../utils/cn.cjs");
|
|
6
|
+
const resolveIcon_1 = require("../../utils/resolveIcon.cjs");
|
|
7
|
+
const Icon_1 = require("../Icon/index.cjs");
|
|
8
|
+
const stateStyles = {
|
|
9
|
+
information: {
|
|
10
|
+
border: "bg-secondary-500",
|
|
11
|
+
iconBg: "bg-secondary-50",
|
|
12
|
+
iconBorder: "border-secondary-75",
|
|
13
|
+
ctaBg: "bg-action-info",
|
|
14
|
+
ctaText: "text-white",
|
|
15
|
+
},
|
|
16
|
+
success: {
|
|
17
|
+
border: "bg-success-600",
|
|
18
|
+
iconBg: "bg-success-50",
|
|
19
|
+
iconBorder: "border-success-75",
|
|
20
|
+
ctaBg: "bg-action-success",
|
|
21
|
+
ctaText: "text-white",
|
|
22
|
+
},
|
|
23
|
+
warning: {
|
|
24
|
+
border: "bg-warning-500",
|
|
25
|
+
iconBg: "bg-warning-50",
|
|
26
|
+
iconBorder: "border-warning-75",
|
|
27
|
+
ctaBg: "bg-warning-400",
|
|
28
|
+
ctaText: "text-black",
|
|
29
|
+
},
|
|
30
|
+
error: {
|
|
31
|
+
border: "bg-error-500",
|
|
32
|
+
iconBg: "bg-error-50",
|
|
33
|
+
iconBorder: "border-error-75",
|
|
34
|
+
ctaBg: "bg-action-danger",
|
|
35
|
+
ctaText: "text-white",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
function Alert({ variant = "toast", state = "information", title, description, icon, showIcon = true, onClose, primaryAction, secondaryAction, className, ...rest }) {
|
|
39
|
+
const styles = stateStyles[state];
|
|
40
|
+
const isBanner = variant === "banner";
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex items-start overflow-hidden rounded bg-surface", className), role: "alert", ...rest, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("w-1.5 self-stretch shrink-0", styles.border) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex flex-1 items-start border-t border-r border-b border-grey-200 rounded-r", isBanner ? "gap-4 p-5" : "gap-3 px-4 py-3"), children: [showIcon && icon && ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("shrink-0 rounded-lg border flex items-center justify-center", styles.iconBg, styles.iconBorder, isBanner ? "size-8" : "size-6"), children: (0, jsx_runtime_1.jsx)("span", { className: isBanner ? "size-4" : "size-3", children: (0, resolveIcon_1.resolveIcon)(icon, "sm") }) })), isBanner ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-1 flex-col gap-4 justify-center", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1", children: [title && (0, jsx_runtime_1.jsx)("p", { className: "text-base font-semibold text-on-surface", children: title }), description && (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-on-surface-secondary", children: description })] }), (primaryAction || secondaryAction) && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [primaryAction && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: primaryAction.onClick, className: (0, cn_1.cn)("inline-flex items-center justify-center rounded-lg px-4 py-2 text-sm font-semibold cursor-pointer", styles.ctaBg, styles.ctaText), children: primaryAction.label })), secondaryAction && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: secondaryAction.onClick, className: "inline-flex items-center justify-center rounded-lg border border-control-border bg-surface px-4 py-2 text-sm font-semibold text-on-surface-body cursor-pointer hover:bg-grey-50", children: secondaryAction.label }))] }))] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-1 flex-col gap-0.5 self-stretch text-sm", children: [title && (0, jsx_runtime_1.jsx)("p", { className: "font-semibold text-on-surface", children: title }), description && (0, jsx_runtime_1.jsx)("p", { className: "text-on-surface-secondary", children: description })] })), onClose && ((0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("flex items-center self-stretch shrink-0", isBanner ? "gap-4" : "gap-3"), children: [(0, jsx_runtime_1.jsx)("div", { className: "w-px self-stretch bg-grey-100" }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, className: "shrink-0 inline-flex items-center justify-center text-on-surface-muted hover:text-on-surface-body cursor-pointer", "aria-label": "Close", children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "multiply", size: "md" }) })] }))] })] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { resolveIcon } from "../../utils/resolveIcon.js";
|
|
4
|
+
import { Icon } from "../Icon/index.js";
|
|
5
|
+
const stateStyles = {
|
|
6
|
+
information: {
|
|
7
|
+
border: "bg-secondary-500",
|
|
8
|
+
iconBg: "bg-secondary-50",
|
|
9
|
+
iconBorder: "border-secondary-75",
|
|
10
|
+
ctaBg: "bg-action-info",
|
|
11
|
+
ctaText: "text-white",
|
|
12
|
+
},
|
|
13
|
+
success: {
|
|
14
|
+
border: "bg-success-600",
|
|
15
|
+
iconBg: "bg-success-50",
|
|
16
|
+
iconBorder: "border-success-75",
|
|
17
|
+
ctaBg: "bg-action-success",
|
|
18
|
+
ctaText: "text-white",
|
|
19
|
+
},
|
|
20
|
+
warning: {
|
|
21
|
+
border: "bg-warning-500",
|
|
22
|
+
iconBg: "bg-warning-50",
|
|
23
|
+
iconBorder: "border-warning-75",
|
|
24
|
+
ctaBg: "bg-warning-400",
|
|
25
|
+
ctaText: "text-black",
|
|
26
|
+
},
|
|
27
|
+
error: {
|
|
28
|
+
border: "bg-error-500",
|
|
29
|
+
iconBg: "bg-error-50",
|
|
30
|
+
iconBorder: "border-error-75",
|
|
31
|
+
ctaBg: "bg-action-danger",
|
|
32
|
+
ctaText: "text-white",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export function Alert({ variant = "toast", state = "information", title, description, icon, showIcon = true, onClose, primaryAction, secondaryAction, className, ...rest }) {
|
|
36
|
+
const styles = stateStyles[state];
|
|
37
|
+
const isBanner = variant === "banner";
|
|
38
|
+
return (_jsxs("div", { className: cn("flex items-start overflow-hidden rounded bg-surface", className), role: "alert", ...rest, children: [_jsx("div", { className: cn("w-1.5 self-stretch shrink-0", styles.border) }), _jsxs("div", { className: cn("flex flex-1 items-start border-t border-r border-b border-grey-200 rounded-r", isBanner ? "gap-4 p-5" : "gap-3 px-4 py-3"), children: [showIcon && icon && (_jsx("div", { className: cn("shrink-0 rounded-lg border flex items-center justify-center", styles.iconBg, styles.iconBorder, isBanner ? "size-8" : "size-6"), children: _jsx("span", { className: isBanner ? "size-4" : "size-3", children: resolveIcon(icon, "sm") }) })), isBanner ? (_jsxs("div", { className: "flex flex-1 flex-col gap-4 justify-center", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [title && _jsx("p", { className: "text-base font-semibold text-on-surface", children: title }), description && _jsx("p", { className: "text-sm text-on-surface-secondary", children: description })] }), (primaryAction || secondaryAction) && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [primaryAction && (_jsx("button", { type: "button", onClick: primaryAction.onClick, className: cn("inline-flex items-center justify-center rounded-lg px-4 py-2 text-sm font-semibold cursor-pointer", styles.ctaBg, styles.ctaText), children: primaryAction.label })), secondaryAction && (_jsx("button", { type: "button", onClick: secondaryAction.onClick, className: "inline-flex items-center justify-center rounded-lg border border-control-border bg-surface px-4 py-2 text-sm font-semibold text-on-surface-body cursor-pointer hover:bg-grey-50", children: secondaryAction.label }))] }))] })) : (_jsxs("div", { className: "flex flex-1 flex-col gap-0.5 self-stretch text-sm", children: [title && _jsx("p", { className: "font-semibold text-on-surface", children: title }), description && _jsx("p", { className: "text-on-surface-secondary", children: description })] })), onClose && (_jsxs("div", { className: cn("flex items-center self-stretch shrink-0", isBanner ? "gap-4" : "gap-3"), children: [_jsx("div", { className: "w-px self-stretch bg-grey-100" }), _jsx("button", { type: "button", onClick: onClose, className: "shrink-0 inline-flex items-center justify-center text-on-surface-muted hover:text-on-surface-body cursor-pointer", "aria-label": "Close", children: _jsx(Icon, { name: "multiply", size: "md" }) })] }))] })] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Alert } from "./Alert.js";
|