pixelize-design-library 2.2.191 → 3.0.1-beta.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/.claude/settings.local.json +9 -0
- package/MIGRATION.md +562 -0
- package/coverage/clover.xml +638 -0
- package/coverage/coverage-final.json +20 -0
- package/coverage/lcov-report/Table/CompactSelect.tsx.html +379 -0
- package/coverage/lcov-report/Table/Components/ActiveFilters.tsx.html +514 -0
- package/coverage/lcov-report/Table/Components/HeaderActions.tsx.html +373 -0
- package/coverage/lcov-report/Table/Components/Pagination.tsx.html +574 -0
- package/coverage/lcov-report/Table/Components/TableActions.tsx.html +574 -0
- package/coverage/lcov-report/Table/Components/TableBody.tsx.html +1027 -0
- package/coverage/lcov-report/Table/Components/TableFilters.tsx.html +397 -0
- package/coverage/lcov-report/Table/Components/TableHeader.tsx.html +1060 -0
- package/coverage/lcov-report/Table/Components/TableLoading.tsx.html +361 -0
- package/coverage/lcov-report/Table/Components/TableSearch.tsx.html +337 -0
- package/coverage/lcov-report/Table/Components/index.html +266 -0
- package/coverage/lcov-report/Table/Components/useDebounce.ts.html +178 -0
- package/coverage/lcov-report/Table/Components/useTable.ts.html +778 -0
- package/coverage/lcov-report/Table/LeftFilterPane.tsx.html +1810 -0
- package/coverage/lcov-report/Table/SelectOperationControls.tsx.html +178 -0
- package/coverage/lcov-report/Table/Table.tsx.html +1567 -0
- package/coverage/lcov-report/Table/TableProps.tsx.html +658 -0
- package/coverage/lcov-report/Table/TableSettings/ManageColumns.tsx.html +619 -0
- package/coverage/lcov-report/Table/TableSettings/TableFilters.tsx.html +229 -0
- package/coverage/lcov-report/Table/TableSettings/TableSettings.tsx.html +532 -0
- package/coverage/lcov-report/Table/TableSettings/index.html +146 -0
- package/coverage/lcov-report/Table/TableToDo.tsx.html +973 -0
- package/coverage/lcov-report/Table/TextOperationControls.tsx.html +271 -0
- package/coverage/lcov-report/Table/filterTypes.ts.html +97 -0
- package/coverage/lcov-report/Table/index.html +176 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +146 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +1836 -0
- package/dist/Assets/defaultLogo.tsx +31 -0
- package/dist/Components/Editor/Editor.d.ts +2 -1
- package/dist/Components/Editor/Editor.js +39 -5
- package/dist/Components/KanbanBoard/AccountCard.d.ts +2 -2
- package/dist/Components/KanbanBoard/AccountCard.js +37 -4
- package/dist/Components/KanbanBoard/KanbanBoard.js +72 -35
- package/dist/Components/MultiSelect/MultiSelect.js +10 -19
- package/dist/Components/SearchSelect/SearchSelect.js +23 -16
- package/dist/Components/Table/Components/ActiveFilters.js +66 -25
- package/dist/Components/Table/Components/Pagination.d.ts +1 -1
- package/dist/Components/Table/Components/Pagination.js +41 -9
- package/dist/Components/Table/Components/TableFilters.js +11 -5
- package/dist/Components/Table/Components/useTable.js +36 -24
- package/dist/Theme/Dark/palette.d.ts +370 -0
- package/dist/Theme/Dark/palette.js +372 -0
- package/dist/components-v2/AlertDialog/AlertDialog.d.ts +23 -0
- package/dist/components-v2/AlertDialog/AlertDialog.js +98 -0
- package/dist/components-v2/Breadcrumbs/Breadcrumbs.d.ts +14 -0
- package/dist/components-v2/Breadcrumbs/Breadcrumbs.js +66 -0
- package/dist/components-v2/Charts/AreaChart.d.ts +23 -0
- package/dist/components-v2/Charts/AreaChart.js +63 -0
- package/dist/components-v2/Charts/BarChart.d.ts +25 -0
- package/dist/components-v2/Charts/BarChart.js +57 -0
- package/dist/components-v2/Charts/LineChart.d.ts +23 -0
- package/dist/components-v2/Charts/LineChart.js +55 -0
- package/dist/components-v2/Charts/PieChart.d.ts +15 -0
- package/dist/components-v2/Charts/PieChart.js +54 -0
- package/dist/components-v2/Charts/PolarChart.d.ts +14 -0
- package/dist/components-v2/Charts/PolarChart.js +54 -0
- package/dist/components-v2/Charts/chartOptions.d.ts +7 -0
- package/dist/components-v2/Charts/chartOptions.js +41 -0
- package/dist/components-v2/Charts/useChartTheme.d.ts +22 -0
- package/dist/components-v2/Charts/useChartTheme.js +106 -0
- package/dist/components-v2/ContactForm/ContactForm.d.ts +25 -0
- package/dist/components-v2/ContactForm/ContactForm.js +116 -0
- package/dist/components-v2/DatePicker/Calendar.d.ts +19 -0
- package/dist/components-v2/DatePicker/Calendar.js +212 -0
- package/dist/components-v2/DatePicker/DatePicker.d.ts +46 -0
- package/dist/components-v2/DatePicker/DatePicker.js +189 -0
- package/dist/components-v2/DatePicker/TimePicker.d.ts +12 -0
- package/dist/components-v2/DatePicker/TimePicker.js +105 -0
- package/dist/components-v2/DatePicker/utils.d.ts +31 -0
- package/dist/components-v2/DatePicker/utils.js +109 -0
- package/dist/components-v2/Drawer/Drawer.d.ts +27 -0
- package/dist/components-v2/Drawer/Drawer.js +132 -0
- package/dist/components-v2/FeedbackForm/FeedbackForm.d.ts +26 -0
- package/dist/components-v2/FeedbackForm/FeedbackForm.js +112 -0
- package/dist/components-v2/FileUploader/FileUploader.d.ts +28 -0
- package/dist/components-v2/FileUploader/FileUploader.js +127 -0
- package/dist/components-v2/Input/TextInput.d.ts +41 -0
- package/dist/components-v2/Input/TextInput.js +169 -0
- package/dist/components-v2/KanbanBoard/KanbanBoard.d.ts +39 -0
- package/dist/components-v2/KanbanBoard/KanbanBoard.js +101 -0
- package/dist/components-v2/Layout/AppLayout.d.ts +22 -0
- package/dist/components-v2/Layout/AppLayout.js +53 -0
- package/dist/components-v2/Loading/Loading.d.ts +19 -0
- package/dist/components-v2/Loading/Loading.js +55 -0
- package/dist/components-v2/Modal/Modal.d.ts +30 -0
- package/dist/components-v2/Modal/Modal.js +82 -0
- package/dist/components-v2/NavigationBar/NavigationBar.d.ts +47 -0
- package/dist/components-v2/NavigationBar/NavigationBar.js +148 -0
- package/dist/components-v2/Notification/Notification.d.ts +22 -0
- package/dist/components-v2/Notification/Notification.js +113 -0
- package/dist/components-v2/NumberInput/NumberInput.d.ts +37 -0
- package/dist/components-v2/NumberInput/NumberInput.js +210 -0
- package/dist/components-v2/PinInput/PinInput.d.ts +26 -0
- package/dist/components-v2/PinInput/PinInput.js +138 -0
- package/dist/components-v2/ProfilePhotoViewer/ProfilePhotoViewer.d.ts +18 -0
- package/dist/components-v2/ProfilePhotoViewer/ProfilePhotoViewer.js +91 -0
- package/dist/components-v2/Select/Select.d.ts +41 -0
- package/dist/components-v2/Select/Select.js +284 -0
- package/dist/components-v2/Sidebar/Sidebar.d.ts +41 -0
- package/dist/components-v2/Sidebar/Sidebar.js +182 -0
- package/dist/components-v2/Slider/Slider.d.ts +18 -0
- package/dist/components-v2/Slider/Slider.js +101 -0
- package/dist/components-v2/Table/Table.d.ts +7 -0
- package/dist/components-v2/Table/Table.js +172 -0
- package/dist/components-v2/Table/TableProps.d.ts +139 -0
- package/dist/components-v2/Table/TableProps.js +9 -0
- package/dist/components-v2/Table/components/ActiveFilters.d.ts +10 -0
- package/dist/components-v2/Table/components/ActiveFilters.js +70 -0
- package/dist/components-v2/Table/components/BulkActionBar.d.ts +11 -0
- package/dist/components-v2/Table/components/BulkActionBar.js +92 -0
- package/dist/components-v2/Table/components/ColumnResizeHandle.d.ts +7 -0
- package/dist/components-v2/Table/components/ColumnResizeHandle.js +41 -0
- package/dist/components-v2/Table/components/Pagination.d.ts +11 -0
- package/dist/components-v2/Table/components/Pagination.js +92 -0
- package/dist/components-v2/Table/components/TableBody.d.ts +23 -0
- package/dist/components-v2/Table/components/TableBody.js +69 -0
- package/dist/components-v2/Table/components/TableCell.d.ts +14 -0
- package/dist/components-v2/Table/components/TableCell.js +63 -0
- package/dist/components-v2/Table/components/TableEmptyState.d.ts +12 -0
- package/dist/components-v2/Table/components/TableEmptyState.js +55 -0
- package/dist/components-v2/Table/components/TableErrorState.d.ts +6 -0
- package/dist/components-v2/Table/components/TableErrorState.js +52 -0
- package/dist/components-v2/Table/components/TableHeader.d.ts +21 -0
- package/dist/components-v2/Table/components/TableHeader.js +94 -0
- package/dist/components-v2/Table/components/TableRow.d.ts +20 -0
- package/dist/components-v2/Table/components/TableRow.js +64 -0
- package/dist/components-v2/Table/components/TableSearch.d.ts +8 -0
- package/dist/components-v2/Table/components/TableSearch.js +47 -0
- package/dist/components-v2/Table/filters/FilterChips.d.ts +6 -0
- package/dist/components-v2/Table/filters/FilterChips.js +9 -0
- package/dist/components-v2/Table/filters/LeftFilterPane.d.ts +17 -0
- package/dist/components-v2/Table/filters/LeftFilterPane.js +105 -0
- package/dist/components-v2/Table/filters/TableFilters.d.ts +12 -0
- package/dist/components-v2/Table/filters/TableFilters.js +127 -0
- package/dist/components-v2/Table/hooks/useColumnResize.d.ts +15 -0
- package/dist/components-v2/Table/hooks/useColumnResize.js +104 -0
- package/dist/components-v2/Table/hooks/useTable.d.ts +58 -0
- package/dist/components-v2/Table/hooks/useTable.js +254 -0
- package/dist/components-v2/Table/hooks/useTableKeyboard.d.ts +25 -0
- package/dist/components-v2/Table/hooks/useTableKeyboard.js +112 -0
- package/dist/components-v2/Table/hooks/useVirtualScroll.d.ts +29 -0
- package/dist/components-v2/Table/hooks/useVirtualScroll.js +83 -0
- package/dist/components-v2/Table/settings/ManageColumns.d.ts +12 -0
- package/dist/components-v2/Table/settings/ManageColumns.js +59 -0
- package/dist/components-v2/Table/settings/TableSettings.d.ts +12 -0
- package/dist/components-v2/Table/settings/TableSettings.js +57 -0
- package/dist/components-v2/Table/utils/filterUtils.d.ts +7 -0
- package/dist/components-v2/Table/utils/filterUtils.js +149 -0
- package/dist/components-v2/Table/utils/sortUtils.d.ts +6 -0
- package/dist/components-v2/Table/utils/sortUtils.js +65 -0
- package/dist/components-v2/Tag/Tag.d.ts +15 -0
- package/dist/components-v2/Tag/Tag.js +87 -0
- package/dist/components-v2/Timeline/Timeline.d.ts +18 -0
- package/dist/components-v2/Timeline/Timeline.js +76 -0
- package/dist/components-v2/Toaster/Toaster.d.ts +61 -0
- package/dist/components-v2/Toaster/Toaster.js +63 -0
- package/dist/components-v2/Toggle/Toggle.d.ts +28 -0
- package/dist/components-v2/Toggle/Toggle.js +90 -0
- package/dist/components-v2/ui/accordion.d.ts +12 -0
- package/dist/components-v2/ui/accordion.js +104 -0
- package/dist/components-v2/ui/alert.d.ts +18 -0
- package/dist/components-v2/ui/alert.js +99 -0
- package/dist/components-v2/ui/avatar.d.ts +12 -0
- package/dist/components-v2/ui/avatar.js +80 -0
- package/dist/components-v2/ui/badge.d.ts +10 -0
- package/dist/components-v2/ui/badge.js +76 -0
- package/dist/components-v2/ui/button.d.ts +18 -0
- package/dist/components-v2/ui/button.js +97 -0
- package/dist/components-v2/ui/checkbox.d.ts +15 -0
- package/dist/components-v2/ui/checkbox.js +86 -0
- package/dist/components-v2/ui/dialog.d.ts +30 -0
- package/dist/components-v2/ui/dialog.js +115 -0
- package/dist/components-v2/ui/dropdown-menu.d.ts +26 -0
- package/dist/components-v2/ui/dropdown-menu.js +121 -0
- package/dist/components-v2/ui/field.d.ts +32 -0
- package/dist/components-v2/ui/field.js +62 -0
- package/dist/components-v2/ui/form-field.d.ts +25 -0
- package/dist/components-v2/ui/form-field.js +96 -0
- package/dist/components-v2/ui/input.d.ts +9 -0
- package/dist/components-v2/ui/input.js +73 -0
- package/dist/components-v2/ui/label.d.ts +10 -0
- package/dist/components-v2/ui/label.js +70 -0
- package/dist/components-v2/ui/popover.d.ts +9 -0
- package/dist/components-v2/ui/popover.js +60 -0
- package/dist/components-v2/ui/progress.d.ts +12 -0
- package/dist/components-v2/ui/progress.js +75 -0
- package/dist/components-v2/ui/radio-group.d.ts +17 -0
- package/dist/components-v2/ui/radio-group.js +91 -0
- package/dist/components-v2/ui/select.d.ts +24 -0
- package/dist/components-v2/ui/select.js +122 -0
- package/dist/components-v2/ui/separator.d.ts +5 -0
- package/dist/components-v2/ui/separator.js +55 -0
- package/dist/components-v2/ui/skeleton.d.ts +9 -0
- package/dist/components-v2/ui/skeleton.js +68 -0
- package/dist/components-v2/ui/spinner.d.ts +16 -0
- package/dist/components-v2/ui/spinner.js +64 -0
- package/dist/components-v2/ui/switch.d.ts +10 -0
- package/dist/components-v2/ui/switch.js +81 -0
- package/dist/components-v2/ui/tabs.d.ts +13 -0
- package/dist/components-v2/ui/tabs.js +95 -0
- package/dist/components-v2/ui/textarea.d.ts +10 -0
- package/dist/components-v2/ui/textarea.js +96 -0
- package/dist/components-v2/ui/tooltip.d.ts +17 -0
- package/dist/components-v2/ui/tooltip.js +75 -0
- package/dist/index.d.ts +128 -64
- package/dist/index.js +246 -173
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +8 -0
- package/dist/theme-v2/ThemeProvider.d.ts +19 -0
- package/dist/theme-v2/ThemeProvider.js +149 -0
- package/dist/theme-v2/dark.css +47 -0
- package/dist/theme-v2/tokens.css +72 -0
- package/package.json +41 -20
- package/tailwind.config.ts +91 -0
- package/vite.config.ts +49 -10
- package/index.html +0 -13
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ApexOptions } from "apexcharts";
|
|
3
|
+
export interface BarSeriesPoint {
|
|
4
|
+
x: string | number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface BarSeries {
|
|
8
|
+
name: string;
|
|
9
|
+
data: BarSeriesPoint[] | number[];
|
|
10
|
+
}
|
|
11
|
+
export interface BarChartProps {
|
|
12
|
+
series: BarSeries[];
|
|
13
|
+
categories?: (string | number)[];
|
|
14
|
+
height?: number | string;
|
|
15
|
+
horizontal?: boolean;
|
|
16
|
+
stacked?: boolean;
|
|
17
|
+
showLegend?: boolean;
|
|
18
|
+
/** Extra Apex options merged on top of the themed base. */
|
|
19
|
+
options?: ApexOptions;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function BarChart({ series, categories, height, horizontal, stacked, showLegend, options, className, }: BarChartProps): React.ReactElement;
|
|
23
|
+
export declare namespace BarChart {
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.BarChart = BarChart;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const react_apexcharts_1 = __importDefault(require("react-apexcharts"));
|
|
42
|
+
const utils_1 = require("../../lib/utils");
|
|
43
|
+
const chartOptions_1 = require("./chartOptions");
|
|
44
|
+
const useChartTheme_1 = require("./useChartTheme");
|
|
45
|
+
function BarChart({ series, categories, height = 320, horizontal = false, stacked = false, showLegend = true, options, className, }) {
|
|
46
|
+
const theme = (0, useChartTheme_1.useChartTheme)();
|
|
47
|
+
const merged = React.useMemo(() => {
|
|
48
|
+
const base = (0, chartOptions_1.baseApexOptions)(theme);
|
|
49
|
+
return Object.assign(Object.assign(Object.assign({}, base), { chart: Object.assign(Object.assign({}, base.chart), { type: "bar", stacked }), plotOptions: {
|
|
50
|
+
bar: { horizontal, borderRadius: 4, columnWidth: "55%" },
|
|
51
|
+
}, xaxis: categories
|
|
52
|
+
? Object.assign(Object.assign({}, base.xaxis), { categories }) : base.xaxis, legend: Object.assign(Object.assign({}, base.legend), { show: showLegend }) }), options);
|
|
53
|
+
}, [theme, categories, horizontal, stacked, showLegend, options]);
|
|
54
|
+
return (React.createElement("div", { className: (0, utils_1.cn)("w-full", className) },
|
|
55
|
+
React.createElement(react_apexcharts_1.default, { key: `${theme.mode}-${theme.primary}`, options: merged, series: series, type: "bar", height: height })));
|
|
56
|
+
}
|
|
57
|
+
BarChart.displayName = "BarChart";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ApexOptions } from "apexcharts";
|
|
3
|
+
export interface LinePoint {
|
|
4
|
+
x: string | number | Date;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface LineSeries {
|
|
8
|
+
name: string;
|
|
9
|
+
data: LinePoint[] | number[];
|
|
10
|
+
}
|
|
11
|
+
export interface LineChartProps {
|
|
12
|
+
series: LineSeries[];
|
|
13
|
+
categories?: (string | number)[];
|
|
14
|
+
height?: number | string;
|
|
15
|
+
curve?: "smooth" | "straight" | "stepline";
|
|
16
|
+
showLegend?: boolean;
|
|
17
|
+
options?: ApexOptions;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function LineChart({ series, categories, height, curve, showLegend, options, className, }: LineChartProps): React.ReactElement;
|
|
21
|
+
export declare namespace LineChart {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.LineChart = LineChart;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const react_apexcharts_1 = __importDefault(require("react-apexcharts"));
|
|
42
|
+
const utils_1 = require("../../lib/utils");
|
|
43
|
+
const chartOptions_1 = require("./chartOptions");
|
|
44
|
+
const useChartTheme_1 = require("./useChartTheme");
|
|
45
|
+
function LineChart({ series, categories, height = 320, curve = "smooth", showLegend = true, options, className, }) {
|
|
46
|
+
const theme = (0, useChartTheme_1.useChartTheme)();
|
|
47
|
+
const merged = React.useMemo(() => {
|
|
48
|
+
const base = (0, chartOptions_1.baseApexOptions)(theme);
|
|
49
|
+
return Object.assign(Object.assign(Object.assign({}, base), { chart: Object.assign(Object.assign({}, base.chart), { type: "line" }), stroke: { curve, width: 2 }, markers: { size: 4 }, xaxis: categories
|
|
50
|
+
? Object.assign(Object.assign({}, base.xaxis), { categories }) : base.xaxis, legend: Object.assign(Object.assign({}, base.legend), { show: showLegend }) }), options);
|
|
51
|
+
}, [theme, categories, curve, showLegend, options]);
|
|
52
|
+
return (React.createElement("div", { className: (0, utils_1.cn)("w-full", className) },
|
|
53
|
+
React.createElement(react_apexcharts_1.default, { key: `${theme.mode}-${theme.primary}`, options: merged, series: series, type: "line", height: height })));
|
|
54
|
+
}
|
|
55
|
+
LineChart.displayName = "LineChart";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ApexOptions } from "apexcharts";
|
|
3
|
+
export interface PieChartProps {
|
|
4
|
+
series: number[];
|
|
5
|
+
labels: string[];
|
|
6
|
+
height?: number | string;
|
|
7
|
+
variant?: "pie" | "donut";
|
|
8
|
+
showLegend?: boolean;
|
|
9
|
+
options?: ApexOptions;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function PieChart({ series, labels, height, variant, showLegend, options, className, }: PieChartProps): React.ReactElement;
|
|
13
|
+
export declare namespace PieChart {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.PieChart = PieChart;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const react_apexcharts_1 = __importDefault(require("react-apexcharts"));
|
|
42
|
+
const utils_1 = require("../../lib/utils");
|
|
43
|
+
const chartOptions_1 = require("./chartOptions");
|
|
44
|
+
const useChartTheme_1 = require("./useChartTheme");
|
|
45
|
+
function PieChart({ series, labels, height = 320, variant = "pie", showLegend = true, options, className, }) {
|
|
46
|
+
const theme = (0, useChartTheme_1.useChartTheme)();
|
|
47
|
+
const merged = React.useMemo(() => {
|
|
48
|
+
const base = (0, chartOptions_1.baseApexOptions)(theme);
|
|
49
|
+
return Object.assign(Object.assign(Object.assign({}, base), { chart: Object.assign(Object.assign({}, base.chart), { type: variant }), labels, stroke: { width: 0 }, legend: Object.assign(Object.assign({}, base.legend), { show: showLegend, position: "bottom" }) }), options);
|
|
50
|
+
}, [theme, labels, variant, showLegend, options]);
|
|
51
|
+
return (React.createElement("div", { className: (0, utils_1.cn)("w-full", className) },
|
|
52
|
+
React.createElement(react_apexcharts_1.default, { key: `${theme.mode}-${theme.primary}-${variant}`, options: merged, series: series, type: variant, height: height })));
|
|
53
|
+
}
|
|
54
|
+
PieChart.displayName = "PieChart";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ApexOptions } from "apexcharts";
|
|
3
|
+
export interface PolarChartProps {
|
|
4
|
+
series: number[];
|
|
5
|
+
labels: string[];
|
|
6
|
+
height?: number | string;
|
|
7
|
+
showLegend?: boolean;
|
|
8
|
+
options?: ApexOptions;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function PolarChart({ series, labels, height, showLegend, options, className, }: PolarChartProps): React.ReactElement;
|
|
12
|
+
export declare namespace PolarChart {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.PolarChart = PolarChart;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const react_apexcharts_1 = __importDefault(require("react-apexcharts"));
|
|
42
|
+
const utils_1 = require("../../lib/utils");
|
|
43
|
+
const chartOptions_1 = require("./chartOptions");
|
|
44
|
+
const useChartTheme_1 = require("./useChartTheme");
|
|
45
|
+
function PolarChart({ series, labels, height = 320, showLegend = true, options, className, }) {
|
|
46
|
+
const theme = (0, useChartTheme_1.useChartTheme)();
|
|
47
|
+
const merged = React.useMemo(() => {
|
|
48
|
+
const base = (0, chartOptions_1.baseApexOptions)(theme);
|
|
49
|
+
return Object.assign(Object.assign(Object.assign({}, base), { chart: Object.assign(Object.assign({}, base.chart), { type: "polarArea" }), labels, stroke: { colors: [theme.border], width: 1 }, fill: { opacity: 0.85 }, legend: Object.assign(Object.assign({}, base.legend), { show: showLegend, position: "bottom" }) }), options);
|
|
50
|
+
}, [theme, labels, showLegend, options]);
|
|
51
|
+
return (React.createElement("div", { className: (0, utils_1.cn)("w-full", className) },
|
|
52
|
+
React.createElement(react_apexcharts_1.default, { key: `${theme.mode}-${theme.primary}`, options: merged, series: series, type: "polarArea", height: height })));
|
|
53
|
+
}
|
|
54
|
+
PolarChart.displayName = "PolarChart";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApexOptions } from "apexcharts";
|
|
2
|
+
import type { ChartTheme } from "./useChartTheme";
|
|
3
|
+
/**
|
|
4
|
+
* Shared Apex options derived from the active theme. Each chart wrapper merges
|
|
5
|
+
* additional config on top.
|
|
6
|
+
*/
|
|
7
|
+
export declare function baseApexOptions(theme: ChartTheme): ApexOptions;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.baseApexOptions = baseApexOptions;
|
|
4
|
+
/**
|
|
5
|
+
* Shared Apex options derived from the active theme. Each chart wrapper merges
|
|
6
|
+
* additional config on top.
|
|
7
|
+
*/
|
|
8
|
+
function baseApexOptions(theme) {
|
|
9
|
+
return {
|
|
10
|
+
chart: {
|
|
11
|
+
background: "transparent",
|
|
12
|
+
foreColor: theme.foreground,
|
|
13
|
+
fontFamily: "inherit",
|
|
14
|
+
toolbar: { show: false },
|
|
15
|
+
zoom: { enabled: false },
|
|
16
|
+
},
|
|
17
|
+
theme: { mode: theme.mode },
|
|
18
|
+
colors: theme.palette,
|
|
19
|
+
grid: {
|
|
20
|
+
borderColor: theme.border,
|
|
21
|
+
strokeDashArray: 3,
|
|
22
|
+
xaxis: { lines: { show: false } },
|
|
23
|
+
},
|
|
24
|
+
xaxis: {
|
|
25
|
+
labels: { style: { colors: theme.muted } },
|
|
26
|
+
axisBorder: { color: theme.border },
|
|
27
|
+
axisTicks: { color: theme.border },
|
|
28
|
+
},
|
|
29
|
+
yaxis: {
|
|
30
|
+
labels: { style: { colors: theme.muted } },
|
|
31
|
+
},
|
|
32
|
+
legend: {
|
|
33
|
+
labels: { colors: theme.foreground },
|
|
34
|
+
},
|
|
35
|
+
tooltip: {
|
|
36
|
+
theme: theme.mode,
|
|
37
|
+
},
|
|
38
|
+
dataLabels: { enabled: false },
|
|
39
|
+
stroke: { curve: "smooth", width: 2 },
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ChartTheme {
|
|
2
|
+
/** Series palette (hsl strings). */
|
|
3
|
+
palette: string[];
|
|
4
|
+
/** Primary color from current theme. */
|
|
5
|
+
primary: string;
|
|
6
|
+
/** Page foreground. */
|
|
7
|
+
foreground: string;
|
|
8
|
+
/** Muted text + axis labels. */
|
|
9
|
+
muted: string;
|
|
10
|
+
/** Border / grid lines. */
|
|
11
|
+
border: string;
|
|
12
|
+
/** Card background. */
|
|
13
|
+
background: string;
|
|
14
|
+
/** ApexCharts mode token. */
|
|
15
|
+
mode: "light" | "dark";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Reads computed CSS variables from `:root` so chart libraries get real colors
|
|
19
|
+
* (not `hsl(var(--*))` strings). Re-runs when the resolved light/dark mode
|
|
20
|
+
* changes so theme switches re-paint charts.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useChartTheme(): ChartTheme;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.useChartTheme = useChartTheme;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const ThemeProvider_1 = require("../../theme-v2/ThemeProvider");
|
|
39
|
+
/**
|
|
40
|
+
* Reads computed CSS variables from `:root` so chart libraries get real colors
|
|
41
|
+
* (not `hsl(var(--*))` strings). Re-runs when the resolved light/dark mode
|
|
42
|
+
* changes so theme switches re-paint charts.
|
|
43
|
+
*/
|
|
44
|
+
function useChartTheme() {
|
|
45
|
+
const { resolvedMode, theme } = (0, ThemeProvider_1.useTheme)();
|
|
46
|
+
const [colors, setColors] = React.useState(() => fallbackTheme());
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
if (typeof window === "undefined")
|
|
49
|
+
return;
|
|
50
|
+
const id = requestAnimationFrame(() => {
|
|
51
|
+
setColors(readThemeFromDocument(resolvedMode));
|
|
52
|
+
});
|
|
53
|
+
return () => cancelAnimationFrame(id);
|
|
54
|
+
}, [resolvedMode, theme]);
|
|
55
|
+
return colors;
|
|
56
|
+
}
|
|
57
|
+
function readThemeFromDocument(mode) {
|
|
58
|
+
const root = document.documentElement;
|
|
59
|
+
const styles = getComputedStyle(root);
|
|
60
|
+
const read = (variable) => {
|
|
61
|
+
const value = styles.getPropertyValue(variable).trim();
|
|
62
|
+
return value ? `hsl(${value})` : "";
|
|
63
|
+
};
|
|
64
|
+
const primary = read("--color-primary") || "#3b82f6";
|
|
65
|
+
const foreground = read("--color-foreground") || "#0f172a";
|
|
66
|
+
const muted = read("--color-muted-foreground") || "#64748b";
|
|
67
|
+
const border = read("--color-border") || "#e2e8f0";
|
|
68
|
+
const background = read("--color-card") || (mode === "dark" ? "#0f172a" : "#ffffff");
|
|
69
|
+
const palette = derivePalette(primary, mode);
|
|
70
|
+
return { palette, primary, foreground, muted, border, background, mode };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Derive a small categorical palette around the primary hue, plus a few
|
|
74
|
+
* complementary fixed hues for variety.
|
|
75
|
+
*/
|
|
76
|
+
function derivePalette(primary, mode) {
|
|
77
|
+
const baseHueMatch = primary.match(/hsl\(\s*(-?[\d.]+)/);
|
|
78
|
+
const hue = baseHueMatch ? parseFloat(baseHueMatch[1]) : 220;
|
|
79
|
+
const lightness = mode === "dark" ? 60 : 50;
|
|
80
|
+
return [
|
|
81
|
+
`hsl(${hue} 80% ${lightness}%)`,
|
|
82
|
+
`hsl(${(hue + 60) % 360} 70% ${lightness}%)`,
|
|
83
|
+
`hsl(${(hue + 120) % 360} 70% ${lightness}%)`,
|
|
84
|
+
`hsl(${(hue + 180) % 360} 70% ${lightness}%)`,
|
|
85
|
+
`hsl(${(hue + 240) % 360} 70% ${lightness}%)`,
|
|
86
|
+
`hsl(${(hue + 300) % 360} 70% ${lightness}%)`,
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
function fallbackTheme() {
|
|
90
|
+
return {
|
|
91
|
+
palette: [
|
|
92
|
+
"hsl(221 83% 53%)",
|
|
93
|
+
"hsl(168 76% 36%)",
|
|
94
|
+
"hsl(27 96% 54%)",
|
|
95
|
+
"hsl(346 77% 49%)",
|
|
96
|
+
"hsl(199 89% 48%)",
|
|
97
|
+
"hsl(248 53% 58%)",
|
|
98
|
+
],
|
|
99
|
+
primary: "hsl(221 83% 53%)",
|
|
100
|
+
foreground: "hsl(222 47% 11%)",
|
|
101
|
+
muted: "hsl(215 16% 47%)",
|
|
102
|
+
border: "hsl(214 32% 91%)",
|
|
103
|
+
background: "hsl(0 0% 100%)",
|
|
104
|
+
mode: "light",
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ContactFormValues {
|
|
3
|
+
name: string;
|
|
4
|
+
email: string;
|
|
5
|
+
subject?: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ContactFormProps {
|
|
9
|
+
onSubmit: (values: ContactFormValues) => void | Promise<void>;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
successMessage?: React.ReactNode;
|
|
12
|
+
/** Field visibility / required state. */
|
|
13
|
+
fields?: {
|
|
14
|
+
subject?: boolean | "required";
|
|
15
|
+
};
|
|
16
|
+
submitLabel?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Reset state to idle after a successful submission. */
|
|
19
|
+
isSubmitted?: boolean;
|
|
20
|
+
onReset?: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function ContactForm({ onSubmit, isLoading, successMessage, fields, submitLabel, className, isSubmitted, onReset, }: ContactFormProps): React.ReactElement;
|
|
23
|
+
export declare namespace ContactForm {
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ContactForm = ContactForm;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const lucide_react_1 = require("lucide-react");
|
|
39
|
+
const utils_1 = require("../../lib/utils");
|
|
40
|
+
const button_1 = require("../ui/button");
|
|
41
|
+
const TextInput_1 = require("../Input/TextInput");
|
|
42
|
+
const textarea_1 = require("../ui/textarea");
|
|
43
|
+
const field_1 = require("../ui/field");
|
|
44
|
+
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
45
|
+
function validate(values, requireSubject) {
|
|
46
|
+
var _a;
|
|
47
|
+
const errors = {};
|
|
48
|
+
if (!values.name.trim())
|
|
49
|
+
errors.name = "Name is required.";
|
|
50
|
+
if (!values.email.trim())
|
|
51
|
+
errors.email = "Email is required.";
|
|
52
|
+
else if (!EMAIL_RE.test(values.email))
|
|
53
|
+
errors.email = "Enter a valid email.";
|
|
54
|
+
if (requireSubject && !((_a = values.subject) !== null && _a !== void 0 ? _a : "").trim())
|
|
55
|
+
errors.subject = "Subject is required.";
|
|
56
|
+
if (!values.message.trim())
|
|
57
|
+
errors.message = "Message is required.";
|
|
58
|
+
return errors;
|
|
59
|
+
}
|
|
60
|
+
function ContactForm({ onSubmit, isLoading = false, successMessage, fields = { subject: true }, submitLabel = "Send message", className, isSubmitted = false, onReset, }) {
|
|
61
|
+
var _a;
|
|
62
|
+
const [values, setValues] = React.useState({
|
|
63
|
+
name: "",
|
|
64
|
+
email: "",
|
|
65
|
+
subject: "",
|
|
66
|
+
message: "",
|
|
67
|
+
});
|
|
68
|
+
const [errors, setErrors] = React.useState({});
|
|
69
|
+
const [touched, setTouched] = React.useState({
|
|
70
|
+
name: false,
|
|
71
|
+
email: false,
|
|
72
|
+
subject: false,
|
|
73
|
+
message: false,
|
|
74
|
+
});
|
|
75
|
+
const showSubject = fields.subject !== false;
|
|
76
|
+
const requireSubject = fields.subject === "required";
|
|
77
|
+
const update = (key) => (event) => {
|
|
78
|
+
setValues((prev) => (Object.assign(Object.assign({}, prev), { [key]: event.target.value })));
|
|
79
|
+
if (touched[key]) {
|
|
80
|
+
setErrors(validate(Object.assign(Object.assign({}, values), { [key]: event.target.value }), requireSubject));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const blur = (key) => () => {
|
|
84
|
+
setTouched((prev) => (Object.assign(Object.assign({}, prev), { [key]: true })));
|
|
85
|
+
setErrors(validate(values, requireSubject));
|
|
86
|
+
};
|
|
87
|
+
const handleSubmit = async (event) => {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
const next = validate(values, requireSubject);
|
|
90
|
+
setErrors(next);
|
|
91
|
+
setTouched({
|
|
92
|
+
name: true,
|
|
93
|
+
email: true,
|
|
94
|
+
subject: true,
|
|
95
|
+
message: true,
|
|
96
|
+
});
|
|
97
|
+
if (Object.keys(next).length > 0)
|
|
98
|
+
return;
|
|
99
|
+
await onSubmit(values);
|
|
100
|
+
};
|
|
101
|
+
if (isSubmitted && successMessage) {
|
|
102
|
+
return (React.createElement("div", { role: "status", className: (0, utils_1.cn)("flex flex-col items-center gap-3 rounded-lg border border-success/40 bg-success/10 p-6 text-center text-success", className) },
|
|
103
|
+
React.createElement(lucide_react_1.CheckCircle2, { "aria-hidden": "true", className: "h-8 w-8" }),
|
|
104
|
+
React.createElement("div", { className: "text-sm" }, successMessage),
|
|
105
|
+
onReset && (React.createElement(button_1.Button, { variant: "outline", size: "sm", onClick: onReset }, "Send another"))));
|
|
106
|
+
}
|
|
107
|
+
return (React.createElement("form", { onSubmit: handleSubmit, noValidate: true, className: (0, utils_1.cn)("space-y-4", className) },
|
|
108
|
+
React.createElement(TextInput_1.TextInput, { label: "Name", isRequired: true, value: values.name, onChange: update("name"), onBlur: blur("name"), error: !!errors.name && touched.name, errorMessage: errors.name, autoComplete: "name" }),
|
|
109
|
+
React.createElement(TextInput_1.TextInput, { label: "Email", type: "email", isRequired: true, value: values.email, onChange: update("email"), onBlur: blur("email"), error: !!errors.email && touched.email, errorMessage: errors.email, autoComplete: "email" }),
|
|
110
|
+
showSubject && (React.createElement(TextInput_1.TextInput, { label: "Subject", isRequired: requireSubject, value: (_a = values.subject) !== null && _a !== void 0 ? _a : "", onChange: update("subject"), onBlur: blur("subject"), error: !!errors.subject && touched.subject, errorMessage: errors.subject })),
|
|
111
|
+
React.createElement(field_1.Field, { label: "Message", isRequired: true, error: !!errors.message && touched.message, errorMessage: errors.message },
|
|
112
|
+
React.createElement(textarea_1.Textarea, { value: values.message, onChange: update("message"), onBlur: blur("message"), rows: 5, autoResize: true, minRows: 4, maxRows: 10 })),
|
|
113
|
+
React.createElement("div", { className: "flex justify-end" },
|
|
114
|
+
React.createElement(button_1.Button, { type: "submit", isLoading: isLoading, loadingText: "Sending\u2026" }, submitLabel))));
|
|
115
|
+
}
|
|
116
|
+
ContactForm.displayName = "ContactForm";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type DateConstraints, type DayOfWeek } from "./utils";
|
|
3
|
+
export interface CalendarProps {
|
|
4
|
+
/** Currently focused / displayed month. */
|
|
5
|
+
viewDate: Date;
|
|
6
|
+
onViewDateChange: (date: Date) => void;
|
|
7
|
+
/** Selected date(s). */
|
|
8
|
+
selected?: Date | null;
|
|
9
|
+
rangeStart?: Date | null;
|
|
10
|
+
rangeEnd?: Date | null;
|
|
11
|
+
onSelectDate: (date: Date) => void;
|
|
12
|
+
mode: "single" | "range";
|
|
13
|
+
constraints?: DateConstraints;
|
|
14
|
+
weekStartsOn?: DayOfWeek;
|
|
15
|
+
locale?: Intl.LocalesArgument;
|
|
16
|
+
/** Render compactly inside a Popover. */
|
|
17
|
+
compact?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<HTMLDivElement>>;
|