@wakastellar/ui 3.3.3 → 3.5.2
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/dist/badge-BbwO7QeZ.js +1 -0
- package/dist/badge-BfiocODp.mjs +23 -0
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +1 -1
- package/dist/chunk-14q5BKub.js +1 -0
- package/dist/{chunk-BH6uBOac.mjs → chunk-Cr9pTUWm.mjs} +5 -5
- package/dist/cn-DEtaFQsA.js +1 -0
- package/dist/cn-DUn6aSIQ.mjs +24 -0
- package/dist/doc.cjs.js +2 -2
- package/dist/doc.es.js +19 -19
- package/dist/editor.cjs.js +48 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.es.js +6551 -0
- package/dist/{exceljs.min-DG9M8IZ1.mjs → exceljs.min-DL1XYDll.mjs} +1 -1
- package/dist/{exceljs.min-BuefmDRS.js → exceljs.min-qeIfSCbF.js} +1 -1
- package/dist/export.cjs.js +1 -1
- package/dist/export.es.js +1 -1
- package/dist/index.cjs.js +150 -150
- package/dist/index.es.js +25694 -26503
- package/dist/input-BfaSAGVw.js +1 -0
- package/dist/input-DVr_Qkl8.mjs +14 -0
- package/dist/rich-text.cjs.js +1 -1
- package/dist/rich-text.es.js +1 -1
- package/dist/security-CyBpuklN.mjs +122 -0
- package/dist/security-bFWwDrlg.js +1 -0
- package/dist/separator-NrkltulH.js +1 -0
- package/dist/separator-ibN2mycs.mjs +51 -0
- package/dist/src/blocks/login/index.d.ts +4 -4
- package/dist/src/components/editor/blocks/index.d.ts +51 -0
- package/dist/src/components/editor/blocks/waka-acceptance-criteria-block.d.ts +60 -0
- package/dist/src/components/editor/blocks/waka-ai-assist-block.d.ts +58 -0
- package/dist/src/components/editor/blocks/waka-api-endpoint-block.d.ts +63 -0
- package/dist/src/components/editor/blocks/waka-code-playground-block.d.ts +61 -0
- package/dist/src/components/editor/blocks/waka-comment-thread-block.d.ts +85 -0
- package/dist/src/components/editor/blocks/waka-diagram-block.d.ts +52 -0
- package/dist/src/components/editor/blocks/waka-embed-block.d.ts +58 -0
- package/dist/src/components/editor/blocks/waka-slash-menu-block.d.ts +67 -0
- package/dist/src/components/editor/blocks/waka-user-story-block.d.ts +79 -0
- package/dist/src/components/editor/blocks/waka-version-diff-block.d.ts +73 -0
- package/dist/src/components/editor/index.d.ts +66 -0
- package/dist/src/components/editor/waka-ai-writer.d.ts +80 -0
- package/dist/src/components/editor/waka-collaborative-editor.d.ts +93 -0
- package/dist/src/components/editor/waka-diff-viewer.d.ts +71 -0
- package/dist/src/components/editor/waka-dnd-editor.d.ts +64 -0
- package/dist/src/components/editor/waka-document-editor.d.ts +92 -0
- package/dist/src/components/editor/waka-editor-elements.d.ts +79 -0
- package/dist/src/components/editor/waka-editor-leaves.d.ts +39 -0
- package/dist/src/components/editor/waka-editor-plugins.d.ts +41 -0
- package/dist/src/components/editor/waka-editor-toolbar.d.ts +20 -0
- package/dist/src/components/editor/waka-editor.d.ts +59 -0
- package/dist/src/components/editor/waka-floating-toolbar.d.ts +47 -0
- package/dist/src/components/editor/waka-markdown-editor.d.ts +60 -0
- package/dist/src/components/editor/waka-mention-editor.d.ts +125 -0
- package/dist/src/components/editor/waka-slash-menu.d.ts +70 -0
- package/dist/src/components/editor/waka-spec-editor.d.ts +88 -0
- package/dist/src/components/index.d.ts +1 -15
- package/dist/src/editor.d.ts +26 -0
- package/dist/src/stories/editor/EditorStoryWrapper.d.ts +11 -0
- package/dist/textarea-CdQWggYG.js +1 -0
- package/dist/textarea-DJDXJ3nd.mjs +23 -0
- package/dist/types-C2St0wOW.js +1 -0
- package/dist/{types-B6GVaSIP.mjs → types-JnqoLyuv.mjs} +214 -211
- package/dist/{useDataTableImport-BPvfo--2.mjs → useDataTableImport-BWUFesPi.mjs} +3 -3
- package/dist/{useDataTableImport-Cm_pCKnO.js → useDataTableImport-T7ddpN5k.js} +3 -3
- package/dist/waka-doc-renderer-CTxC7Trf.js +3 -0
- package/dist/{waka-doc-renderer-BkIvas3z.mjs → waka-doc-renderer-Cw-Xnyen.mjs} +264 -281
- package/dist/waka-editor-plugins-CGojOMS5.js +1 -0
- package/dist/waka-editor-plugins-Dwh4Vreq.mjs +135 -0
- package/dist/waka-rich-text-editor-BlIdtknG.js +1 -0
- package/dist/waka-rich-text-editor-D1uA3zbB.js +1 -0
- package/dist/waka-rich-text-editor-DgSWiXMW.mjs +342 -0
- package/dist/waka-rich-text-editor-DndVJuDw.mjs +2 -0
- package/package.json +87 -2
- package/src/blocks/footer/index.tsx +4 -9
- package/src/blocks/login/index.tsx +14 -20
- package/src/blocks/profile/index.tsx +5 -8
- package/src/blocks/sidebar/index.tsx +0 -2
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +2 -2
- package/src/components/editor/blocks/index.ts +182 -0
- package/src/components/editor/blocks/waka-acceptance-criteria-block.tsx +326 -0
- package/src/components/editor/blocks/waka-ai-assist-block.tsx +284 -0
- package/src/components/editor/blocks/waka-api-endpoint-block.tsx +382 -0
- package/src/components/editor/blocks/waka-code-playground-block.tsx +331 -0
- package/src/components/editor/blocks/waka-comment-thread-block.tsx +448 -0
- package/src/components/editor/blocks/waka-diagram-block.tsx +293 -0
- package/src/components/editor/blocks/waka-embed-block.tsx +416 -0
- package/src/components/editor/blocks/waka-slash-menu-block.tsx +432 -0
- package/src/components/editor/blocks/waka-user-story-block.tsx +295 -0
- package/src/components/editor/blocks/waka-version-diff-block.tsx +426 -0
- package/src/components/editor/index.ts +279 -0
- package/src/components/editor/waka-ai-writer.tsx +434 -0
- package/src/components/editor/waka-collaborative-editor.tsx +426 -0
- package/src/components/editor/waka-diff-viewer.tsx +352 -0
- package/src/components/editor/waka-dnd-editor.tsx +284 -0
- package/src/components/editor/waka-document-editor.tsx +502 -0
- package/src/components/editor/waka-editor-elements.tsx +312 -0
- package/src/components/editor/waka-editor-leaves.tsx +101 -0
- package/src/components/editor/waka-editor-plugins.ts +207 -0
- package/src/components/editor/waka-editor-toolbar.tsx +358 -0
- package/src/components/editor/waka-editor.tsx +431 -0
- package/src/components/editor/waka-floating-toolbar.tsx +268 -0
- package/src/components/editor/waka-markdown-editor.tsx +395 -0
- package/src/components/editor/waka-mention-editor.tsx +459 -0
- package/src/components/editor/waka-slash-menu.tsx +392 -0
- package/src/components/editor/waka-spec-editor.tsx +657 -0
- package/src/components/index.ts +1 -18
- package/src/components/waka-approval-chain/WakaApprovalChain.stories.tsx +15 -17
- package/src/components/waka-compare-period/WakaComparePeriod.stories.tsx +35 -19
- package/src/components/waka-content-recommendation/WakaContentRecommendation.stories.tsx +18 -5
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +11 -34
- package/src/components/waka-streak-counter/WakaStreakCounter.stories.tsx +30 -30
- package/dist/chunk-BDDJmn7V.js +0 -1
- package/dist/cn-DnPbmOCy.js +0 -1
- package/dist/cn-DpLcAzrf.mjs +0 -22
- package/dist/separator-BDReXBvI.mjs +0 -59
- package/dist/separator-BKjNl9sI.js +0 -1
- package/dist/src/components/waka-actor-badge/index.d.ts +0 -8
- package/dist/src/components/waka-actors-list/index.d.ts +0 -18
- package/dist/src/components/waka-ai-assistant-button/index.d.ts +0 -8
- package/dist/src/components/waka-document-flyover/index.d.ts +0 -10
- package/dist/src/components/waka-document-preview-popup/index.d.ts +0 -26
- package/dist/src/components/waka-hour-balance-badge/index.d.ts +0 -8
- package/dist/src/components/waka-hour-consumption-table/index.d.ts +0 -15
- package/dist/src/components/waka-hour-pack-dialog/index.d.ts +0 -8
- package/dist/src/components/waka-project-stats-header/index.d.ts +0 -15
- package/dist/src/components/waka-step-comment-bubble/index.d.ts +0 -13
- package/dist/src/components/waka-step-comment-panel/index.d.ts +0 -20
- package/dist/src/components/waka-step-permission-matrix/index.d.ts +0 -12
- package/dist/src/components/waka-time-entry-dialog/index.d.ts +0 -16
- package/dist/src/components/waka-time-tracking-flyover/index.d.ts +0 -11
- package/dist/types-BH9cQRqZ.js +0 -1
- package/dist/waka-doc-renderer-BZ2-SqyT.js +0 -3
- package/dist/waka-rich-text-editor-BJGlQgpq.js +0 -1
- package/dist/waka-rich-text-editor-BJzzxeP1.mjs +0 -361
- package/dist/waka-rich-text-editor-wnXLwvUo.js +0 -1
- package/src/components/waka-actor-badge/index.tsx +0 -34
- package/src/components/waka-actors-list/index.tsx +0 -125
- package/src/components/waka-ai-assistant-button/index.tsx +0 -31
- package/src/components/waka-document-flyover/index.tsx +0 -36
- package/src/components/waka-document-preview-popup/index.tsx +0 -103
- package/src/components/waka-hour-balance-badge/index.tsx +0 -43
- package/src/components/waka-hour-consumption-table/index.tsx +0 -72
- package/src/components/waka-hour-pack-dialog/index.tsx +0 -72
- package/src/components/waka-project-stats-header/index.tsx +0 -69
- package/src/components/waka-step-comment-bubble/index.tsx +0 -71
- package/src/components/waka-step-comment-panel/index.tsx +0 -106
- package/src/components/waka-step-permission-matrix/index.tsx +0 -65
- package/src/components/waka-time-entry-dialog/index.tsx +0 -131
- package/src/components/waka-time-tracking-flyover/index.tsx +0 -41
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
/** A single slash command entry */
|
|
3
|
+
export interface SlashCommand {
|
|
4
|
+
/** Unique key used for filtering */
|
|
5
|
+
key: string;
|
|
6
|
+
/** Display label */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Optional description shown below the label */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Lucide icon component */
|
|
11
|
+
icon: LucideIcon;
|
|
12
|
+
/** Group name (commands are visually grouped) */
|
|
13
|
+
group: string;
|
|
14
|
+
/** Search keywords for filtering */
|
|
15
|
+
keywords?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Action to execute when the command is selected.
|
|
18
|
+
* Receives the Plate editor instance.
|
|
19
|
+
*/
|
|
20
|
+
action: (editor: any) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface WakaSlashMenuProps {
|
|
23
|
+
/** Commands to display in the menu */
|
|
24
|
+
commands?: SlashCommand[];
|
|
25
|
+
/** CSS class for the menu container */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Callback when a command is selected. Receives the command key. */
|
|
28
|
+
onSelect?: (key: string) => void;
|
|
29
|
+
}
|
|
30
|
+
/** Default slash commands for WakaStart editors */
|
|
31
|
+
export declare const DEFAULT_SLASH_COMMANDS: SlashCommand[];
|
|
32
|
+
/**
|
|
33
|
+
* WakaSlashMenu -- Configurable slash command palette.
|
|
34
|
+
*
|
|
35
|
+
* This component is designed to be used **inside** a Plate editor context
|
|
36
|
+
* as the combobox renderer for the `@platejs/combobox` SlashPlugin,
|
|
37
|
+
* or standalone as a command registry.
|
|
38
|
+
*
|
|
39
|
+
* When used standalone, provide `onSelect` to receive the selected command key.
|
|
40
|
+
* The consuming app is responsible for connecting it to the editor.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <WakaSlashMenu
|
|
45
|
+
* commands={[...DEFAULT_SLASH_COMMANDS, myCustomCommand]}
|
|
46
|
+
* onSelect={(key) => console.log("Selected:", key)}
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function WakaSlashMenu({ commands, className, onSelect, }: WakaSlashMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare namespace WakaSlashMenu {
|
|
52
|
+
var displayName: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates slash command plugin configuration for Plate.
|
|
56
|
+
* Call this function and spread the result into your plugins array.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { createSlashCommandPlugins } from "@wakastellar/ui/editor"
|
|
61
|
+
*
|
|
62
|
+
* const editor = usePlateEditor({
|
|
63
|
+
* plugins: [
|
|
64
|
+
* ...otherPlugins,
|
|
65
|
+
* ...await createSlashCommandPlugins(),
|
|
66
|
+
* ],
|
|
67
|
+
* })
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function createSlashCommandPlugins(commands?: SlashCommand[]): Promise<any[]>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type SlateNode = any;
|
|
4
|
+
/** A predefined spec block template */
|
|
5
|
+
export interface SpecBlockTemplate {
|
|
6
|
+
/** Unique key */
|
|
7
|
+
key: string;
|
|
8
|
+
/** Display label */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Description for the slash menu */
|
|
11
|
+
description: string;
|
|
12
|
+
/** Lucide icon */
|
|
13
|
+
icon: LucideIcon;
|
|
14
|
+
/** Category for grouping */
|
|
15
|
+
category: string;
|
|
16
|
+
/** Generates the Slate nodes for this block */
|
|
17
|
+
createNodes: () => SlateNode[];
|
|
18
|
+
}
|
|
19
|
+
export interface WakaSpecEditorProps {
|
|
20
|
+
/** Initial Slate content */
|
|
21
|
+
value?: SlateNode[];
|
|
22
|
+
/** Change callback */
|
|
23
|
+
onChange?: (value: SlateNode[]) => void;
|
|
24
|
+
/** Read-only mode */
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
/** Placeholder */
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/** CSS class */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Editor CSS class */
|
|
31
|
+
editorClassName?: string;
|
|
32
|
+
/** Minimum height in px */
|
|
33
|
+
minHeight?: number;
|
|
34
|
+
/** Label */
|
|
35
|
+
label?: string;
|
|
36
|
+
/** Description */
|
|
37
|
+
description?: string;
|
|
38
|
+
/** Error */
|
|
39
|
+
error?: string;
|
|
40
|
+
/** Custom spec block templates (merged with defaults) */
|
|
41
|
+
customTemplates?: SpecBlockTemplate[];
|
|
42
|
+
/** Show the template insertion sidebar */
|
|
43
|
+
showTemplateSidebar?: boolean;
|
|
44
|
+
/** Enable AI features for spec generation */
|
|
45
|
+
enableAI?: boolean;
|
|
46
|
+
/** AI endpoint */
|
|
47
|
+
aiEndpoint?: string;
|
|
48
|
+
/** Document title */
|
|
49
|
+
title?: string;
|
|
50
|
+
/** Title change callback */
|
|
51
|
+
onTitleChange?: (title: string) => void;
|
|
52
|
+
/** Extra Plate plugins */
|
|
53
|
+
extraPlugins?: any[];
|
|
54
|
+
/** Ref to editor instance */
|
|
55
|
+
editorRef?: React.MutableRefObject<any>;
|
|
56
|
+
}
|
|
57
|
+
/** Default specification block templates for WakaStart projects */
|
|
58
|
+
export declare const DEFAULT_SPEC_TEMPLATES: SpecBlockTemplate[];
|
|
59
|
+
/**
|
|
60
|
+
* WakaSpecEditor -- Specification-oriented document editor.
|
|
61
|
+
*
|
|
62
|
+
* Extends the standard WakaEditor with domain-specific block templates
|
|
63
|
+
* for functional specifications, technical specs, and project documentation.
|
|
64
|
+
*
|
|
65
|
+
* Templates include: User Story, Acceptance Criteria, Use Case, API Endpoint,
|
|
66
|
+
* Data Model, Security Requirements, Risk Assessment, and Spec Header.
|
|
67
|
+
*
|
|
68
|
+
* Each template generates pre-formatted Slate nodes with placeholders
|
|
69
|
+
* that the user can fill in. Apps can register custom templates.
|
|
70
|
+
*
|
|
71
|
+
* Designed for WakaStart (project specs), WakaSign (contract specs),
|
|
72
|
+
* WakaPress (content specs), and TopFlix (content guidelines).
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <WakaSpecEditor
|
|
77
|
+
* title="Specification fonctionnelle - Module HDS"
|
|
78
|
+
* onTitleChange={setTitle}
|
|
79
|
+
* showTemplateSidebar
|
|
80
|
+
* enableAI
|
|
81
|
+
* aiEndpoint="/api/ai/completion"
|
|
82
|
+
* value={content}
|
|
83
|
+
* onChange={setContent}
|
|
84
|
+
* />
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare const WakaSpecEditor: React.ForwardRefExoticComponent<WakaSpecEditorProps & React.RefAttributes<HTMLDivElement>>;
|
|
88
|
+
export {};
|
|
@@ -252,20 +252,6 @@ export * from './waka-doc-nav';
|
|
|
252
252
|
export * from './waka-doc-search';
|
|
253
253
|
export * from './waka-doc-version';
|
|
254
254
|
export * from './waka-doc-toolbar';
|
|
255
|
-
export
|
|
255
|
+
export * from './waka-doc-breadcrumb';
|
|
256
256
|
export * from './waka-doc-table';
|
|
257
257
|
export * from './waka-doc-renderer';
|
|
258
|
-
export * from './waka-hour-balance-badge';
|
|
259
|
-
export * from './waka-actor-badge';
|
|
260
|
-
export * from './waka-step-comment-bubble';
|
|
261
|
-
export * from './waka-step-comment-panel';
|
|
262
|
-
export * from './waka-time-entry-dialog';
|
|
263
|
-
export * from './waka-time-tracking-flyover';
|
|
264
|
-
export * from './waka-document-preview-popup';
|
|
265
|
-
export * from './waka-document-flyover';
|
|
266
|
-
export * from './waka-ai-assistant-button';
|
|
267
|
-
export * from './waka-step-permission-matrix';
|
|
268
|
-
export * from './waka-actors-list';
|
|
269
|
-
export * from './waka-project-stats-header';
|
|
270
|
-
export * from './waka-hour-pack-dialog';
|
|
271
|
-
export * from './waka-hour-consumption-table';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for WakaEditor (Plate.js)
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { WakaEditor } from "@wakastellar/ui/editor"
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Required peer dependencies:
|
|
10
|
+
* - platejs (>=52.0.0)
|
|
11
|
+
* - @platejs/basic-nodes (>=52.0.0)
|
|
12
|
+
* - @platejs/table (>=52.0.0)
|
|
13
|
+
* - @platejs/layout (>=52.0.0)
|
|
14
|
+
* - @platejs/callout (>=52.0.0)
|
|
15
|
+
*
|
|
16
|
+
* Installation:
|
|
17
|
+
* ```bash
|
|
18
|
+
* pnpm add platejs @platejs/basic-nodes @platejs/table @platejs/layout @platejs/callout
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Optional packages (install based on features):
|
|
22
|
+
* ```bash
|
|
23
|
+
* pnpm add @platejs/link @platejs/media @platejs/mention @platejs/dnd @platejs/toc @platejs/indent @platejs/markdown @platejs/selection @platejs/ai @platejs/combobox @platejs/floating @platejs/diff @platejs/emoji @platejs/resizable @platejs/yjs
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export * from './components/editor';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare function EditorStoryWrapper({ children }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a lazy-loaded wrapper component for editor components.
|
|
7
|
+
* This defers the import to render time so ErrorBoundary can catch failures.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createLazyEditor<P extends Record<string, unknown>>(importFn: () => Promise<{
|
|
10
|
+
default: React.ComponentType<P>;
|
|
11
|
+
}>): React.LazyExoticComponent<React.ComponentType<P>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-14q5BKub.js`),t=require(`./cn-DEtaFQsA.js`);let n=require(`react`);n=e.a(n);let r=require(`class-variance-authority`),i=require(`react/jsx-runtime`),a=require(`@radix-ui/react-label`);a=e.a(a),t.n();var o=(0,r.cva)(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),s=n.forwardRef(({className:e,...n},r)=>(0,i.jsx)(a.Root,{ref:r,className:t.t(o(),e),...n}));s.displayName=a.Root.displayName,t.n();var c=n.forwardRef(({className:e,...n},r)=>(0,i.jsx)(`textarea`,{className:t.t(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));c.displayName=`Textarea`,Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { n as e, t } from "./cn-DUn6aSIQ.mjs";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { cva as r } from "class-variance-authority";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
import * as a from "@radix-ui/react-label";
|
|
6
|
+
//#region src/components/label/index.tsx
|
|
7
|
+
e();
|
|
8
|
+
var o = r("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"), s = n.forwardRef(({ className: e, ...n }, r) => /* @__PURE__ */ i(a.Root, {
|
|
9
|
+
ref: r,
|
|
10
|
+
className: t(o(), e),
|
|
11
|
+
...n
|
|
12
|
+
}));
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/components/textarea/index.tsx
|
|
15
|
+
s.displayName = a.Root.displayName, e();
|
|
16
|
+
var c = n.forwardRef(({ className: e, ...n }, r) => /* @__PURE__ */ i("textarea", {
|
|
17
|
+
className: t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", e),
|
|
18
|
+
ref: r,
|
|
19
|
+
...n
|
|
20
|
+
}));
|
|
21
|
+
c.displayName = "Textarea";
|
|
22
|
+
//#endregion
|
|
23
|
+
export { s as n, c as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-14q5BKub.js`),t=require(`./cn-DEtaFQsA.js`);let n=require(`react`);n=e.a(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);t.n();function a({className:e,...n}){return(0,i.jsx)(`div`,{className:t.t(`animate-pulse rounded-md bg-muted`,e),...n})}function o(){let[e,t]=(0,n.useState)(null),[r,i]=(0,n.useState)(!0),[a,o]=(0,n.useState)(null);return(0,n.useEffect)(()=>{let e=!0;return(async()=>{try{let n=await import(`recharts`);e&&(t({ResponsiveContainer:n.ResponsiveContainer,BarChart:n.BarChart,LineChart:n.LineChart,AreaChart:n.AreaChart,PieChart:n.PieChart,Bar:n.Bar,Line:n.Line,Area:n.Area,Pie:n.Pie,Cell:n.Cell,XAxis:n.XAxis,YAxis:n.YAxis,CartesianGrid:n.CartesianGrid,Tooltip:n.Tooltip,Legend:n.Legend,defs:`defs`,linearGradient:`linearGradient`,stop:`stop`}),i(!1))}catch(t){e&&(o(t instanceof Error?t:Error(`Failed to load Recharts`)),i(!1))}})(),()=>{e=!1}},[]),{components:e,loading:r,error:a,isAvailable:!r&&!a&&e!==null}}var s={colors:[`hsl(var(--chart-1, 220 70% 50%))`,`hsl(var(--chart-2, 160 60% 45%))`,`hsl(var(--chart-3, 30 80% 55%))`,`hsl(var(--chart-4, 280 65% 60%))`,`hsl(var(--chart-5, 340 75% 55%))`],gridColor:`hsl(var(--border, 220 13% 91%))`,axisColor:`hsl(var(--muted-foreground, 220 9% 46%))`,textColor:`hsl(var(--foreground, 224 71% 4%))`,tooltipBackground:`hsl(var(--popover, 0 0% 100%))`,tooltipText:`hsl(var(--popover-foreground, 224 71% 4%))`,tooltipBorder:`hsl(var(--border, 220 13% 91%))`,fontFamily:`inherit`};function c(e,t=`default`){let r=(0,n.useMemo)(()=>({colors:e?.colors??s.colors,gridColor:e?.gridColor??s.gridColor,axisColor:e?.axisColor??s.axisColor,textColor:e?.textColor??s.textColor,tooltipBackground:e?.tooltipBackground??s.tooltipBackground,tooltipText:e?.tooltipText??s.tooltipText,tooltipBorder:e?.tooltipBorder??s.tooltipBorder,fontFamily:e?.fontFamily??s.fontFamily}),[e]);return{theme:r,getColor:(0,n.useMemo)(()=>e=>r.colors[e%r.colors.length],[r.colors]),tooltipStyles:(0,n.useMemo)(()=>({contentStyle:{backgroundColor:r.tooltipBackground,color:r.tooltipText,border:`1px solid ${r.tooltipBorder}`,borderRadius:`var(--radius, 0.5rem)`,padding:`8px 12px`,boxShadow:`0 2px 4px rgba(0,0,0,0.1)`,fontFamily:r.fontFamily},wrapperStyle:{outline:`none`},itemStyle:{color:r.tooltipText,padding:`2px 0`},labelStyle:{color:r.textColor,fontWeight:600,marginBottom:`4px`}}),[r]),containerClasses:(0,n.useMemo)(()=>{let e=`relative`;switch(t){case`gradient`:return`${e} bg-gradient-to-br from-background to-muted/20`;case`outline`:return`${e} border border-border rounded-lg p-4`;case`glass`:return`${e} bg-background/50 backdrop-blur-sm border border-border/50 rounded-lg p-4`;default:return e}},[t])}}t.n();var l={sm:{width:`100%`,height:150},md:{width:`100%`,height:250},lg:{width:`100%`,height:350},xl:{width:`100%`,height:450},auto:{width:`100%`,height:300}},u=n.forwardRef(({children:e,variant:n=`default`,size:r=`md`,height:s,width:u,theme:f,className:p,style:m,title:h,description:g,loading:_,error:v,responsive:y=!0},b)=>{let{components:x,loading:S,error:C,isAvailable:w}=o(),{containerClasses:T}=c(f,n),E=_||S,D=v||(C?`Recharts non disponible. Installez recharts pour utiliser les graphiques.`:null),O=l[r],k=u??O.width,A=s??O.height;if(E)return(0,i.jsxs)(`div`,{ref:b,className:t.t(T,p),style:m,children:[h&&(0,i.jsx)(d,{title:h,description:g}),(0,i.jsx)(a,{className:`w-full`,style:{height:A}})]});if(D||!w)return(0,i.jsxs)(`div`,{ref:b,className:t.t(T,p),style:m,children:[h&&(0,i.jsx)(d,{title:h,description:g}),(0,i.jsx)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg`,style:{height:A},children:(0,i.jsxs)(`div`,{className:`text-center p-4`,children:[(0,i.jsx)(`p`,{children:D||`Graphique non disponible`}),(0,i.jsx)(`p`,{className:`text-xs mt-1`,children:`Installez recharts: pnpm add recharts`})]})})]});let{ResponsiveContainer:j}=x;return(0,i.jsxs)(`div`,{ref:b,className:t.t(T,p),style:m,children:[h&&(0,i.jsx)(d,{title:h,description:g}),y?(0,i.jsx)(j,{width:k,height:A,children:e(x)}):(0,i.jsx)(`div`,{style:{width:k,height:A},children:e(x)})]})});u.displayName=`WakaChart`;function d({title:e,description:t}){return(0,i.jsxs)(`div`,{className:`mb-4`,children:[(0,i.jsx)(`h3`,{className:`text-lg font-semibold`,children:e}),t&&(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}var f=n.forwardRef(({data:e,dataKeys:t,series:r,variant:a=`default`,size:o=`md`,height:s,width:l,animation:d=!0,animationDuration:f=500,grid:p=!0,tooltip:m=!0,legend:h,axis:g,theme:_,className:v,style:y,title:b,description:x,loading:S,error:C,onClick:w,responsive:T=!0,layout:E=`vertical`,stacked:D=!1,radius:O=4,barSize:k,barGap:A=4,barCategoryGap:j=`20%`},M)=>{let{theme:N,getColor:P,tooltipStyles:F}=c(_,a),I=n.useMemo(()=>{if(r&&r.length>0)return r;if(t&&t.length>0)return t.map((e,t)=>({dataKey:e,label:e,color:P(t)}));if(e.length>0&&`value`in e[0])return[{dataKey:`value`,label:`Value`,color:P(0)}];let n=e[0];return n?Object.keys(n).filter(e=>e!==`name`&&typeof n[e]==`number`).map((e,t)=>({dataKey:e,label:e,color:P(t)})):[]},[r,t,e,P]),L=n.useMemo(()=>h?typeof h==`boolean`?{enabled:h,position:`bottom`,align:`center`}:h:null,[h]),R=n.useMemo(()=>m?typeof m==`boolean`?{enabled:m}:m:null,[m]);return(0,i.jsx)(u,{ref:M,variant:a,size:o,height:s,width:l,theme:_,className:v,style:y,title:b,description:x,loading:S,error:C,responsive:T,children:t=>{if(!t)return null;let{BarChart:n,Bar:r,XAxis:a,YAxis:o,CartesianGrid:s,Tooltip:c,Legend:l}=t;return(0,i.jsxs)(n,{data:e,layout:E===`horizontal`?`vertical`:`horizontal`,barGap:A,barCategoryGap:j,children:[p&&(0,i.jsx)(s,{strokeDasharray:`3 3`,stroke:N.gridColor,horizontal:!0,vertical:!1}),g?.showXAxis!==!1&&(0,i.jsx)(a,{dataKey:`name`,axisLine:{stroke:N.axisColor},tickLine:{stroke:N.axisColor},tick:{fill:N.textColor,fontSize:12},tickFormatter:g?.xAxisFormatter}),g?.showYAxis!==!1&&(0,i.jsx)(o,{axisLine:{stroke:N.axisColor},tickLine:{stroke:N.axisColor},tick:{fill:N.textColor,fontSize:12},tickFormatter:g?.yAxisFormatter,domain:g?.yAxisDomain,unit:g?.yAxisUnit}),R?.enabled!==!1&&m&&(0,i.jsx)(c,{...F,formatter:R&&typeof R!=`boolean`&&R.formatter?(t,n)=>R.formatter(t,n,e[0]):e=>`${R&&typeof R!=`boolean`&&R.valuePrefix||``}${e}${R&&typeof R!=`boolean`&&R.valueSuffix||``}`}),L?.enabled&&(0,i.jsx)(l,{align:L.align,verticalAlign:L.position===`top`?`top`:`bottom`,wrapperStyle:{paddingTop:L.position===`bottom`?16:0}}),I.map((e,t)=>(0,i.jsx)(r,{dataKey:e.dataKey,name:e.label,fill:e.color||P(t),radius:O,stackId:D?`stack`:void 0,barSize:k,animationDuration:f,isAnimationActive:d},e.dataKey))]})}})});f.displayName=`WakaBarChart`;var p=n.forwardRef(({data:e,dataKeys:t,series:r,variant:a=`default`,size:o=`md`,height:s,width:l,animation:d=!0,animationDuration:f=500,grid:p=!0,tooltip:m=!0,legend:h,axis:g,theme:_,className:v,style:y,title:b,description:x,loading:S,error:C,onClick:w,responsive:T=!0,curve:E=`monotone`,dots:D=!0,dotSize:O=4,activeDot:k=!0,strokeWidth:A=2},j)=>{let{theme:M,getColor:N,tooltipStyles:P}=c(_,a),F=n.useMemo(()=>{if(r&&r.length>0)return r;if(t&&t.length>0)return t.map((e,t)=>({dataKey:e,label:e,color:N(t),strokeWidth:A}));if(e.length>0&&`value`in e[0])return[{dataKey:`value`,label:`Value`,color:N(0),strokeWidth:A}];let n=e[0];return n?Object.keys(n).filter(e=>e!==`name`&&typeof n[e]==`number`).map((e,t)=>({dataKey:e,label:e,color:N(t),strokeWidth:A})):[]},[r,t,e,N,A]),I=n.useMemo(()=>h?typeof h==`boolean`?{enabled:h,position:`bottom`,align:`center`}:h:null,[h]),L=n.useMemo(()=>m?typeof m==`boolean`?{enabled:m}:m:null,[m]);return(0,i.jsx)(u,{ref:j,variant:a,size:o,height:s,width:l,theme:_,className:v,style:y,title:b,description:x,loading:S,error:C,responsive:T,children:t=>{if(!t)return null;let{LineChart:n,Line:r,XAxis:a,YAxis:o,CartesianGrid:s,Tooltip:c,Legend:l}=t;return(0,i.jsxs)(n,{data:e,children:[p&&(0,i.jsx)(s,{strokeDasharray:`3 3`,stroke:M.gridColor,horizontal:!0,vertical:!1}),g?.showXAxis!==!1&&(0,i.jsx)(a,{dataKey:`name`,axisLine:{stroke:M.axisColor},tickLine:{stroke:M.axisColor},tick:{fill:M.textColor,fontSize:12},tickFormatter:g?.xAxisFormatter}),g?.showYAxis!==!1&&(0,i.jsx)(o,{axisLine:{stroke:M.axisColor},tickLine:{stroke:M.axisColor},tick:{fill:M.textColor,fontSize:12},tickFormatter:g?.yAxisFormatter,domain:g?.yAxisDomain,unit:g?.yAxisUnit}),L?.enabled!==!1&&m&&(0,i.jsx)(c,{...P,formatter:L&&typeof L!=`boolean`&&L.formatter?(t,n)=>L.formatter(t,n,e[0]):e=>`${L&&typeof L!=`boolean`&&L.valuePrefix||``}${e}${L&&typeof L!=`boolean`&&L.valueSuffix||``}`}),I?.enabled&&(0,i.jsx)(l,{align:I.align,verticalAlign:I.position===`top`?`top`:`bottom`,wrapperStyle:{paddingTop:I.position===`bottom`?16:0}}),F.map((e,t)=>(0,i.jsx)(r,{dataKey:e.dataKey,name:e.label,stroke:e.color||N(t),strokeWidth:e.strokeWidth||A,strokeDasharray:e.strokeDasharray,type:E,dot:D?{r:O,fill:e.color||N(t)}:!1,activeDot:k?{r:O+2}:!1,animationDuration:f,isAnimationActive:d},e.dataKey))]})}})});p.displayName=`WakaLineChart`;var m=n.forwardRef(({data:e,dataKeys:t,series:r,variant:a=`default`,size:o=`md`,height:s,width:l,animation:d=!0,animationDuration:f=500,grid:p=!0,tooltip:m=!0,legend:h,axis:g,theme:_,className:v,style:y,title:b,description:x,loading:S,error:C,onClick:w,responsive:T=!0,curve:E=`monotone`,dots:D=!1,dotSize:O=4,activeDot:k=!0,strokeWidth:A=2,stacked:j=!1,fillOpacity:M=.3,gradientDirection:N=`vertical`},P)=>{let{theme:F,getColor:I,tooltipStyles:L}=c(_,a),R=n.useMemo(()=>{if(r&&r.length>0)return r;if(t&&t.length>0)return t.map((e,t)=>({dataKey:e,label:e,color:I(t),strokeWidth:A,fillOpacity:M}));if(e.length>0&&`value`in e[0])return[{dataKey:`value`,label:`Value`,color:I(0),strokeWidth:A,fillOpacity:M}];let n=e[0];return n?Object.keys(n).filter(e=>e!==`name`&&typeof n[e]==`number`).map((e,t)=>({dataKey:e,label:e,color:I(t),strokeWidth:A,fillOpacity:M})):[]},[r,t,e,I,A,M]),z=n.useMemo(()=>h?typeof h==`boolean`?{enabled:h,position:`bottom`,align:`center`}:h:null,[h]),B=n.useMemo(()=>m?typeof m==`boolean`?{enabled:m}:m:null,[m]);return(0,i.jsx)(u,{ref:P,variant:a,size:o,height:s,width:l,theme:_,className:v,style:y,title:b,description:x,loading:S,error:C,responsive:T,children:t=>{if(!t)return null;let{AreaChart:n,Area:r,XAxis:a,YAxis:o,CartesianGrid:s,Tooltip:c,Legend:l}=t;return(0,i.jsxs)(n,{data:e,children:[(0,i.jsx)(`defs`,{children:R.map((e,t)=>{let n=e.color||I(t),r=`gradient-${e.dataKey}-${t}`;return(0,i.jsxs)(`linearGradient`,{id:r,x1:`0`,y1:`0`,x2:N===`horizontal`?`1`:`0`,y2:N===`horizontal`?`0`:`1`,children:[(0,i.jsx)(`stop`,{offset:`5%`,stopColor:n,stopOpacity:.8}),(0,i.jsx)(`stop`,{offset:`95%`,stopColor:n,stopOpacity:.1})]},r)})}),p&&(0,i.jsx)(s,{strokeDasharray:`3 3`,stroke:F.gridColor,horizontal:!0,vertical:!1}),g?.showXAxis!==!1&&(0,i.jsx)(a,{dataKey:`name`,axisLine:{stroke:F.axisColor},tickLine:{stroke:F.axisColor},tick:{fill:F.textColor,fontSize:12},tickFormatter:g?.xAxisFormatter}),g?.showYAxis!==!1&&(0,i.jsx)(o,{axisLine:{stroke:F.axisColor},tickLine:{stroke:F.axisColor},tick:{fill:F.textColor,fontSize:12},tickFormatter:g?.yAxisFormatter,domain:g?.yAxisDomain,unit:g?.yAxisUnit}),B?.enabled!==!1&&m&&(0,i.jsx)(c,{...L,formatter:B&&typeof B!=`boolean`&&B.formatter?(t,n)=>B.formatter(t,n,e[0]):e=>`${B&&typeof B!=`boolean`&&B.valuePrefix||``}${e}${B&&typeof B!=`boolean`&&B.valueSuffix||``}`}),z?.enabled&&(0,i.jsx)(l,{align:z.align,verticalAlign:z.position===`top`?`top`:`bottom`,wrapperStyle:{paddingTop:z.position===`bottom`?16:0}}),R.map((e,t)=>{let n=e.color||I(t),a=`gradient-${e.dataKey}-${t}`;return(0,i.jsx)(r,{dataKey:e.dataKey,name:e.label,stroke:n,strokeWidth:e.strokeWidth||A,fill:`url(#${a})`,fillOpacity:e.fillOpacity??M,type:E,dot:D?{r:O,fill:n}:!1,stackId:j?`stack`:void 0,animationDuration:f,isAnimationActive:d},e.dataKey)})]})}})});m.displayName=`WakaAreaChart`;var h=n.forwardRef(({data:e,variant:t=`default`,size:r=`md`,height:a,width:o,animation:s=!0,animationDuration:l=500,tooltip:d=!0,legend:f=!0,theme:p,className:m,style:h,title:g,description:_,loading:v,error:y,onClick:b,responsive:x=!0,dataKey:S=`value`,nameKey:C=`name`,innerRadius:w=0,outerRadius:T=`80%`,startAngle:E=90,endAngle:D=-270,paddingAngle:O=2,label:k=!1,labelPosition:A=`outside`},j)=>{let{theme:M,getColor:N,tooltipStyles:P}=c(p,t),F=n.useMemo(()=>f?typeof f==`boolean`?{enabled:f,position:`bottom`,align:`center`}:f:null,[f]),I=n.useMemo(()=>d?typeof d==`boolean`?{enabled:d}:d:null,[d]),L=n.useCallback(e=>{if(!k)return null;let t=Math.PI/180,n=A===`inside`?e.innerRadius+(e.outerRadius-e.innerRadius)*.5:e.outerRadius*1.1,r=e.cx+n*Math.cos(-e.midAngle*t),a=e.cy+n*Math.sin(-e.midAngle*t),o=``;return o=k===`percent`?`${(e.percent*100).toFixed(0)}%`:k===`value`?String(e.value):k===`name`?e.name:`${(e.percent*100).toFixed(0)}%`,(0,i.jsx)(`text`,{x:r,y:a,fill:A===`inside`?`#fff`:M.textColor,textAnchor:r>e.cx?`start`:`end`,dominantBaseline:`central`,fontSize:12,children:o})},[k,A,M.textColor]);return(0,i.jsx)(u,{ref:j,variant:t,size:r,height:a,width:o,theme:p,className:m,style:h,title:g,description:_,loading:v,error:y,responsive:x,children:t=>{if(!t)return null;let{PieChart:n,Pie:r,Cell:a,Tooltip:o,Legend:c}=t;return(0,i.jsxs)(n,{children:[I?.enabled!==!1&&d&&(0,i.jsx)(o,{...P,formatter:I&&typeof I!=`boolean`&&I.formatter?(t,n)=>I.formatter(t,n,e[0]):e=>`${I&&typeof I!=`boolean`&&I.valuePrefix||``}${e}${I&&typeof I!=`boolean`&&I.valueSuffix||``}`}),F?.enabled&&(0,i.jsx)(c,{align:F.align,verticalAlign:F.position===`top`?`top`:`bottom`,layout:F.position===`left`||F.position===`right`?`vertical`:`horizontal`,wrapperStyle:{paddingTop:F.position===`bottom`?16:0}}),(0,i.jsx)(r,{data:e,dataKey:S,nameKey:C,cx:`50%`,cy:`50%`,innerRadius:w,outerRadius:T,startAngle:E,endAngle:D,paddingAngle:O,animationDuration:l,isAnimationActive:s,label:k?L:!1,labelLine:k&&A===`outside`,children:e.map((e,t)=>(0,i.jsx)(a,{fill:N(t),stroke:`transparent`},`cell-${t}`))})]})}})});h.displayName=`WakaPieChart`,t.n();var g=n.forwardRef(({data:e,type:r=`line`,width:a=100,height:s=30,color:c=`hsl(var(--chart-1))`,fillColor:l,fillOpacity:u=.3,showMinMax:d=!1,showValue:f=!1,className:p,animation:m=!0},h)=>{let{components:g,loading:v,isAvailable:y}=o(),b=n.useMemo(()=>e.map((e,t)=>({index:t,value:e})),[e]),{min:x,max:S,current:C}=n.useMemo(()=>{let t=e.filter(e=>typeof e==`number`&&!isNaN(e));return{min:Math.min(...t),max:Math.max(...t),current:t[t.length-1]}},[e]);if(v)return(0,i.jsx)(`div`,{ref:h,className:t.t(`inline-flex items-center gap-2`,p),children:(0,i.jsx)(`div`,{className:`bg-muted animate-pulse rounded`,style:{width:a,height:s}})});if(!y||!g)return(0,i.jsxs)(`div`,{ref:h,className:t.t(`inline-flex items-center gap-2`,p),children:[(0,i.jsx)(_,{data:e,width:a,height:s,color:c,type:r,fillColor:l,fillOpacity:u}),f&&(0,i.jsx)(`span`,{className:`text-sm font-medium`,children:C})]});let{ResponsiveContainer:w,LineChart:T,BarChart:E,AreaChart:D,Line:O,Bar:k,Area:A}=g;return(0,i.jsxs)(`div`,{ref:h,className:t.t(`inline-flex items-center gap-2`,p),children:[(0,i.jsx)(`div`,{style:{width:a,height:s},children:(0,i.jsx)(w,{width:`100%`,height:`100%`,children:r===`bar`?(0,i.jsx)(E,{data:b,children:(0,i.jsx)(k,{dataKey:`value`,fill:c,radius:1,isAnimationActive:m})}):r===`area`?(0,i.jsxs)(D,{data:b,children:[(0,i.jsx)(`defs`,{children:(0,i.jsxs)(`linearGradient`,{id:`sparkline-gradient-${c.replace(/[^a-z0-9]/gi,``)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`5%`,stopColor:l||c,stopOpacity:.8}),(0,i.jsx)(`stop`,{offset:`95%`,stopColor:l||c,stopOpacity:.1})]})}),(0,i.jsx)(A,{type:`monotone`,dataKey:`value`,stroke:c,fill:`url(#sparkline-gradient-${c.replace(/[^a-z0-9]/gi,``)})`,fillOpacity:u,strokeWidth:1.5,dot:!1,isAnimationActive:m})]}):(0,i.jsx)(T,{data:b,children:(0,i.jsx)(O,{type:`monotone`,dataKey:`value`,stroke:c,strokeWidth:1.5,dot:!1,isAnimationActive:m})})})}),d&&(0,i.jsxs)(`div`,{className:`flex flex-col text-xs text-muted-foreground`,children:[(0,i.jsxs)(`span`,{children:[`↑ `,S]}),(0,i.jsxs)(`span`,{children:[`↓ `,x]})]}),f&&(0,i.jsx)(`span`,{className:`text-sm font-medium`,children:C})]})});g.displayName=`WakaSparkline`;function _({data:e,width:t,height:n,color:r,type:a,fillColor:o,fillOpacity:s}){let c=t-4,l=n-4,u=Math.min(...e),d=Math.max(...e)-u||1,f=e.map((t,n)=>({x:2+n/(e.length-1||1)*c,y:2+l-(t-u)/d*l,value:t}));if(a===`bar`){let a=c/e.length-1;return(0,i.jsx)(`svg`,{width:t,height:n,children:e.map((e,t)=>{let n=(e-u)/d*l;return(0,i.jsx)(`rect`,{x:2+t*(a+1),y:2+l-n,width:a,height:n,fill:r,rx:1},t)})})}let p=f.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `);return a===`area`?(0,i.jsxs)(`svg`,{width:t,height:n,children:[(0,i.jsx)(`path`,{d:`${p} L ${f[f.length-1].x} ${n-2} L 2 ${n-2} Z`,fill:o||r,fillOpacity:s}),(0,i.jsx)(`path`,{d:p,fill:`none`,stroke:r,strokeWidth:1.5})]}):(0,i.jsx)(`svg`,{width:t,height:n,children:(0,i.jsx)(`path`,{d:p,fill:`none`,stroke:r,strokeWidth:1.5})})}t.n();var v=n.forwardRef(({data:e,type:a=`sparkline`,width:o=80,height:s=24,color:c,showTrend:l=!0,valueFormatter:u,className:d},f)=>{let p=n.useMemo(()=>!e||e.length===0?[]:typeof e[0]==`number`?e:e.map(e=>{let t=e.value??Object.values(e).find(e=>typeof e==`number`);return typeof t==`number`?t:0}),[e]),{trend:m,trendPercent:h,currentValue:_}=n.useMemo(()=>{if(p.length<2)return{trend:`neutral`,trendPercent:0,currentValue:p[0]??0};let e=p[0],t=p[p.length-1],n=t-e,r=e===0?0:n/e*100;return{trend:n>0?`up`:n<0?`down`:`neutral`,trendPercent:r,currentValue:t}},[p]),v=n.useMemo(()=>c||(m===`up`?`hsl(var(--chart-2, 142 76% 36%))`:m===`down`?`hsl(var(--destructive, 0 84% 60%))`:`hsl(var(--muted-foreground, 220 9% 46%))`),[c,m]);return p.length===0?(0,i.jsx)(`div`,{ref:f,className:t.t(`flex items-center gap-1 text-muted-foreground`,d),children:(0,i.jsx)(r.Minus,{className:`h-3 w-3`})}):(u?u(_):_.toLocaleString(),(0,i.jsxs)(`div`,{ref:f,className:t.t(`flex items-center gap-2`,d),children:[(0,i.jsx)(g,{data:p,type:a===`sparkline`?`line`:a,width:o,height:s,color:v,animation:!1}),l&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[m===`up`&&(0,i.jsx)(r.TrendingUp,{className:`h-3 w-3 text-green-600 dark:text-green-400`}),m===`down`&&(0,i.jsx)(r.TrendingDown,{className:`h-3 w-3 text-red-600 dark:text-red-400`}),m===`neutral`&&(0,i.jsx)(r.Minus,{className:`h-3 w-3 text-muted-foreground`}),(0,i.jsxs)(`span`,{className:t.t(`text-xs font-medium`,m===`up`&&`text-green-600 dark:text-green-400`,m===`down`&&`text-red-600 dark:text-red-400`,m===`neutral`&&`text-muted-foreground`),children:[m!==`neutral`&&(h>0?`+`:``),h.toFixed(1),`%`]})]})]}))});v.displayName=`WakaMiniChart`;function y(e){let{accessorKey:t,header:n=String(t),chartType:r=`sparkline`,width:i=100,height:a=24,color:o,showValue:s=!1,valueFormatter:c}=e;return{accessorKey:t,header:n,size:i+(s?60:0),enableSorting:!1,enableColumnFilter:!1,cell:e=>{let t=e.getValue(),n=[];return Array.isArray(t)&&(typeof t[0]==`number`?n=t:typeof t[0]==`object`&&t[0]!==null&&(n=t.map(e=>{let t=e.value??Object.values(e).find(e=>typeof e==`number`);return typeof t==`number`?t:0}))),{type:`chart`,chartType:r,data:n,width:i,height:a,color:o,showTrend:!0,valueFormatter:c}},meta:{isChartColumn:!0,chartConfig:e}}}var b={cell:e=>{if(!Array.isArray(e))return null;let t=[];return typeof e[0]==`number`?t=e:typeof e[0]==`object`&&e[0]!==null&&(t=e.map(e=>{let t=e.value??Object.values(e).find(e=>typeof e==`number`);return typeof t==`number`?t:0})),{type:`sparkline`,data:t}},size:100,enableSorting:!1,enableFiltering:!1},x=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],S={sm:{width:`100%`,height:150},md:{width:`100%`,height:250},lg:{width:`100%`,height:350},xl:{width:`100%`,height:450},auto:{width:`100%`,height:300}};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return f}});
|