@app-studio/web 0.9.39 → 0.9.43
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/bot/Bot.d.ts +15 -0
- package/dist/bot/Cache.d.ts +13 -0
- package/dist/bot/Config.d.ts +13 -0
- package/dist/bot/ContentFetcher.d.ts +9 -0
- package/dist/bot/DocuCode.d.ts +19 -0
- package/dist/bot/FileHandler.d.ts +39 -0
- package/dist/bot/ai/AnthropicConnector.d.ts +6 -0
- package/dist/bot/ai/GeminiConnector.d.ts +7 -0
- package/dist/bot/ai/GroqConnector.d.ts +7 -0
- package/dist/bot/ai/HuggingFaceConnector.d.ts +6 -0
- package/dist/bot/ai/OpenAIConnector.d.ts +11 -0
- package/dist/bot/ai/ReplicateConnector.d.ts +7 -0
- package/dist/bot/ai/SambaNovaConnector.d.ts +6 -0
- package/dist/bot/ai/ai.config.d.ts +12 -0
- package/dist/bot/ai/ai.service.d.ts +36 -0
- package/dist/bot/data.d.ts +19 -0
- package/dist/bot/extractors.d.ts +8 -0
- package/dist/bot/index.d.ts +1 -0
- package/dist/bot/prompt/1-project.d.ts +1 -0
- package/dist/bot/prompt/2-response.d.ts +1 -0
- package/dist/bot/prompt/3-comment.d.ts +1 -0
- package/docs/components/Accordion.mdx +74 -121
- package/docs/components/Alert.mdx +18 -69
- package/docs/components/AspectRatio.mdx +11 -9
- package/docs/components/AudioInput.mdx +43 -0
- package/docs/components/Avatar.mdx +17 -42
- package/docs/components/Background.mdx +99 -491
- package/docs/components/Badge.mdx +37 -122
- package/docs/components/Button.mdx +71 -123
- package/docs/components/Calendar.mdx +7 -7
- package/docs/components/Card.mdx +238 -281
- package/docs/components/Carousel.mdx +88 -315
- package/docs/components/Center.mdx +22 -22
- package/docs/components/Chart.mdx +171 -26
- package/docs/components/ChatInput.mdx +327 -275
- package/docs/components/Checkbox.mdx +3 -5
- package/docs/components/ColorInput.mdx +10 -10
- package/docs/components/ColorPicker.mdx +452 -0
- package/docs/components/ComboBox.mdx +14 -14
- package/docs/components/Command.mdx +140 -188
- package/docs/components/ContextMenu.mdx +47 -171
- package/docs/components/CookieConsent.mdx +53 -0
- package/docs/components/CountryPicker.mdx +10 -10
- package/docs/components/DatePicker.mdx +4 -4
- package/docs/components/DragAndDrop.mdx +279 -463
- package/docs/components/Drawer.mdx +401 -100
- package/docs/components/DropdownMenu.mdx +37 -155
- package/docs/components/EmojiPicker.mdx +84 -0
- package/docs/components/File.mdx +130 -4
- package/docs/components/Flow.mdx +3 -3
- package/docs/components/Form.mdx +4 -4
- package/docs/components/Formik.mdx +41 -41
- package/docs/components/Gradient.mdx +355 -178
- package/docs/components/Horizontal.mdx +1 -2
- package/docs/components/HoverCard.mdx +57 -125
- package/docs/components/Icon.mdx +10 -10
- package/docs/components/KanbanBoard.mdx +12 -12
- package/docs/components/Label.mdx +8 -8
- package/docs/components/Link.mdx +19 -27
- package/docs/components/Loader.mdx +224 -407
- package/docs/components/Menubar.mdx +71 -67
- package/docs/components/Message.mdx +211 -526
- package/docs/components/Modal.mdx +351 -475
- package/docs/components/NavigationMenu.mdx +8 -8
- package/docs/components/OTPInput.mdx +194 -0
- package/docs/components/Pagination.mdx +451 -107
- package/docs/components/Password.mdx +8 -8
- package/docs/components/ProgressBar.mdx +460 -0
- package/docs/components/Resizable.mdx +103 -102
- package/docs/components/Select.mdx +5 -5
- package/docs/components/Separator.mdx +11 -98
- package/docs/components/ShareButton.mdx +29 -0
- package/docs/components/Sidebar.mdx +70 -131
- package/docs/components/Slider.mdx +99 -185
- package/docs/components/StatusIndicator.mdx +373 -0
- package/docs/components/Switch.mdx +3 -3
- package/docs/components/Table.mdx +25 -105
- package/docs/components/Tabs.mdx +40 -143
- package/docs/components/TagInput.mdx +32 -32
- package/docs/components/Text.mdx +3 -3
- package/docs/components/TextArea.mdx +9 -9
- package/docs/components/TextField.mdx +17 -17
- package/docs/components/Title.mdx +267 -525
- package/docs/components/Toast.mdx +65 -142
- package/docs/components/Toggle.mdx +34 -46
- package/docs/components/ToggleGroup.mdx +29 -50
- package/docs/components/Tooltip.mdx +500 -137
- package/docs/components/Tree.mdx +4 -4
- package/docs/components/Uploader.mdx +205 -351
- package/docs/components/Vertical.mdx +22 -22
- package/package.json +1 -1
- package/dist/components/AuthGuard/AuthGuard.d.ts +0 -35
- package/dist/components/AuthGuard/index.d.ts +0 -1
- package/docs/adk-components.md +0 -319
- package/docs/adk-quick-start.md +0 -268
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AiService } from './ai/ai.service';
|
|
2
|
+
import { ProviderType } from './ai/ai.config';
|
|
3
|
+
import { FileHandler } from './FileHandler';
|
|
4
|
+
export declare class Bot {
|
|
5
|
+
readonly aiService: AiService;
|
|
6
|
+
readonly fileHandler: FileHandler;
|
|
7
|
+
private readonly cache;
|
|
8
|
+
private readonly cacheKey;
|
|
9
|
+
constructor(cacheKey: string);
|
|
10
|
+
generatePropsData(componentFolder: string, componentName: string, model?: string, provider?: ProviderType): Promise<any>;
|
|
11
|
+
isValidPropsStructure(data: any): boolean;
|
|
12
|
+
isObject(value: any): boolean;
|
|
13
|
+
generateMarkdown(componentFolder: string, componentName: string, propsData: any, // Accept generated props data
|
|
14
|
+
outputFilePath: string): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class Cache {
|
|
2
|
+
private readonly cacheDirectory;
|
|
3
|
+
constructor(cacheDirectory?: string);
|
|
4
|
+
generateCacheKey(prompt: string): string;
|
|
5
|
+
getFromCache(cacheKey: string): any | null;
|
|
6
|
+
getJsonFromCache(cacheKey: string): any;
|
|
7
|
+
saveJsonToCache(cacheKey: string, content: any): void;
|
|
8
|
+
saveToCache(cacheKey: string, content: string): void;
|
|
9
|
+
saveEachJsonToCache(cacheKey: string, content: any, fileNameKey: string): void;
|
|
10
|
+
cacheExist(cacheKey: string): boolean;
|
|
11
|
+
cacheFolderExist(cacheKey: string): boolean;
|
|
12
|
+
createFile(cacheKey: string, fileContent?: string, fileName?: string): Promise<string>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
API_CONFIG : Un objet contenant les paramètres de configuration pour l'API OpenAI, tels que la clé API et l'organisation. Ces valeurs peuvent être définies directement ou récupérées à partir de variables d'environnement.
|
|
3
|
+
APPLICATION_SETTINGS : Un objet pour les paramètres généraux de l'application. Vous pouvez inclure ici des configurations telles que le mode de débogage, les paramètres de journalisation, etc.
|
|
4
|
+
*/
|
|
5
|
+
export declare const API_CONFIG: {
|
|
6
|
+
openaiApiKey: string;
|
|
7
|
+
openaiOrganization: string;
|
|
8
|
+
defaultModel: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const APPLICATION_SETTINGS: {
|
|
11
|
+
debugMode: boolean;
|
|
12
|
+
cacheDirectory: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class ContentFetcher {
|
|
2
|
+
private readonly cache;
|
|
3
|
+
private readonly cacheKey;
|
|
4
|
+
constructor(cacheKey: string);
|
|
5
|
+
private static isLinkValid;
|
|
6
|
+
private fetchAndProcessContent;
|
|
7
|
+
processAllLinks(links: string[]): Promise<void>;
|
|
8
|
+
private urlToMarkdown;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class DocuCode {
|
|
2
|
+
private readonly fileHandler;
|
|
3
|
+
private readonly cache;
|
|
4
|
+
private readonly cacheKey;
|
|
5
|
+
private readonly aiService;
|
|
6
|
+
private selectedModel;
|
|
7
|
+
private selectedProvider;
|
|
8
|
+
constructor(cacheKey: string, model?: string, provider?: string);
|
|
9
|
+
commentCodeFile(filePath: string): Promise<void>;
|
|
10
|
+
processComments(filePath: string, code: string, commentsJson: any): Promise<void>;
|
|
11
|
+
removeCommentsAndCleanFile(filePath: string): Promise<void>;
|
|
12
|
+
processDirectory(dirPath: string): Promise<any>;
|
|
13
|
+
splitArrayToJSON(code: string): {
|
|
14
|
+
line: number;
|
|
15
|
+
code: string;
|
|
16
|
+
}[];
|
|
17
|
+
insertComments(code: string, comments: any[]): string;
|
|
18
|
+
compareStrings(line: string, codeSnippet: string): boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare class FileHandler {
|
|
2
|
+
/**
|
|
3
|
+
* Reads the content of a file as a string.
|
|
4
|
+
* @param filePath Path to the file
|
|
5
|
+
* @returns File content as a string
|
|
6
|
+
*/
|
|
7
|
+
readFile(filePath: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Reads all filenames in a directory, creating the directory if it doesn't exist.
|
|
10
|
+
* @param directory Directory path
|
|
11
|
+
* @returns Array of filenames
|
|
12
|
+
*/
|
|
13
|
+
readFiles(directory: string): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Writes content to a file, creating the parent directory if it doesn't exist.
|
|
16
|
+
* @param filePath Path to the file
|
|
17
|
+
* @param content Content to write
|
|
18
|
+
*/
|
|
19
|
+
writeFile(filePath: string, content: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Writes content to a file directly without checking or creating directories.
|
|
22
|
+
* @param filePath Path to the file
|
|
23
|
+
* @param content Content to write
|
|
24
|
+
*/
|
|
25
|
+
writeFileDirect(filePath: string, content: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a file or directory exists.
|
|
28
|
+
* @param filePath Path to check
|
|
29
|
+
* @returns True if the path exists, false otherwise
|
|
30
|
+
*/
|
|
31
|
+
pathExists(filePath: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Reads and parses a JSON file.
|
|
34
|
+
* @param filePath Path to the JSON file
|
|
35
|
+
* @returns Parsed JSON object
|
|
36
|
+
* @throws Error if the file doesn't exist or contains invalid JSON
|
|
37
|
+
*/
|
|
38
|
+
readJsonFile(filePath: string): any;
|
|
39
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class GeminiConnector {
|
|
2
|
+
private readonly apiKey;
|
|
3
|
+
private readonly googleAI;
|
|
4
|
+
constructor(apiKey: string);
|
|
5
|
+
sendChatMessage(GeminiModel: string, messages: any[], props?: {}, json?: boolean): Promise<string>;
|
|
6
|
+
token(GeminiModel: string, prompt: string, props?: {}): Promise<number>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TiktokenModel } from 'tiktoken';
|
|
2
|
+
export declare class OpenAIConnector {
|
|
3
|
+
private readonly openai;
|
|
4
|
+
constructor({ apiKey, baseURL, organization, }: {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
organization?: string;
|
|
7
|
+
baseURL?: string;
|
|
8
|
+
});
|
|
9
|
+
sendChatMessage(model: string, messages: any[], props?: {}, json?: boolean): Promise<any>;
|
|
10
|
+
token(model: TiktokenModel, messages: any[]): Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare type ModelInfos = {
|
|
2
|
+
creditCost: number;
|
|
3
|
+
tokenLimit: number;
|
|
4
|
+
cost?: {
|
|
5
|
+
prompt_token: number;
|
|
6
|
+
completion_token: number;
|
|
7
|
+
};
|
|
8
|
+
provider: string;
|
|
9
|
+
};
|
|
10
|
+
export declare type ProviderType = 'groq' | 'google' | 'openai' | 'huggingFace' | 'replicate' | 'openrouter' | 'anthropic' | 'deepseek' | 'mistralai' | 'sambaNova';
|
|
11
|
+
export declare const Providers: ProviderType[];
|
|
12
|
+
export declare const MODEL_INFO: Record<string, ModelInfos>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ProviderType } from './ai.config';
|
|
2
|
+
import { OpenAIConnector } from './OpenAIConnector';
|
|
3
|
+
import 'dotenv/config';
|
|
4
|
+
export declare const DEFAULT_IMAGE_MODEL = "black-forest-labs/flux-schnell";
|
|
5
|
+
export declare const MODEL_IMAGE_CREDIT_COST = 2;
|
|
6
|
+
export declare class AiService {
|
|
7
|
+
private models;
|
|
8
|
+
private config;
|
|
9
|
+
private readonly MAX_RETRIES;
|
|
10
|
+
private readonly RETRY_DELAY;
|
|
11
|
+
openRouter: OpenAIConnector;
|
|
12
|
+
constructor();
|
|
13
|
+
private addLanguageInstruction;
|
|
14
|
+
getProvider(provider: ProviderType, useOpenRouter?: boolean): any;
|
|
15
|
+
/**
|
|
16
|
+
* Simple delay utility function.
|
|
17
|
+
*/
|
|
18
|
+
private delay;
|
|
19
|
+
/**
|
|
20
|
+
* Enhanced send method with improved error handling and account verification.
|
|
21
|
+
*/
|
|
22
|
+
send({ model, provider, temperature, messages, props, options, json, }: {
|
|
23
|
+
model: string;
|
|
24
|
+
provider: ProviderType;
|
|
25
|
+
temperature?: Number;
|
|
26
|
+
messages: any[];
|
|
27
|
+
props?: {};
|
|
28
|
+
options?: {
|
|
29
|
+
retries?: number;
|
|
30
|
+
language?: string;
|
|
31
|
+
};
|
|
32
|
+
json?: boolean;
|
|
33
|
+
}): Promise<string>;
|
|
34
|
+
token(model: string, provider: ProviderType, messages: any[] | string, props?: {}): Promise<string>;
|
|
35
|
+
handleTokenLimitError(error: any): boolean;
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Sections {
|
|
2
|
+
[sectionTitle: string]: Chapter[];
|
|
3
|
+
}
|
|
4
|
+
export interface Chapter {
|
|
5
|
+
title: string;
|
|
6
|
+
subchapters: Subchapter[];
|
|
7
|
+
}
|
|
8
|
+
export interface Subchapter {
|
|
9
|
+
subtitle: string;
|
|
10
|
+
minWordCount: number;
|
|
11
|
+
maxWordCount: number;
|
|
12
|
+
summary: string;
|
|
13
|
+
points: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface NewsletterSettings {
|
|
16
|
+
language: string;
|
|
17
|
+
tone: string;
|
|
18
|
+
style: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
extractJsonCode : Extrait un bloc de code JSON d'une réponse. Utile si la réponse contient des blocs de code formatés.
|
|
3
|
+
extractTextResponse : Nettoie une réponse pour ne garder que le texte, en supprimant les blocs de code et les formattages spéciaux.
|
|
4
|
+
extractKeyValuePairs : Extrait des paires clé-valeur d'une réponse. Cette fonction peut être utile pour traiter des réponses formatées comme des listes de propriétés.
|
|
5
|
+
*/
|
|
6
|
+
export declare function extractJsonCode(response: string): any;
|
|
7
|
+
export declare const extractTextResponse: (response: string) => string;
|
|
8
|
+
export declare const extractKeyValuePairs: (response: string) => Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ProjectPrompt: () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RespondPrompt: (props: string, view: string, type?: string | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CommentPrompt: (componentName: string, fileName: string, codeContent: string) => string;
|
|
@@ -1,158 +1,111 @@
|
|
|
1
1
|
# Accordion
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Organizes content into collapsible sections for efficient space management.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { Accordion } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
9
|
|
|
10
10
|
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import { Accordion } from '
|
|
14
|
-
import { Text } from 'app-studio';
|
|
13
|
+
import { Accordion } from '@app-studio/web';
|
|
14
|
+
import { Text, Vertical } from 'app-studio';
|
|
15
15
|
|
|
16
16
|
export const DefaultAccordion = () => {
|
|
17
17
|
return (
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</Accordion.
|
|
34
|
-
<Accordion.Content>
|
|
35
|
-
<Text>
|
|
36
|
-
Hooks are functions that let you "hook into" React state and lifecycle features from function components.
|
|
37
|
-
</Text>
|
|
38
|
-
</Accordion.Content>
|
|
39
|
-
</Accordion.Item>
|
|
40
|
-
</Accordion>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### **Multiple**
|
|
46
|
-
Allow multiple items to be expanded at once.
|
|
18
|
+
<Vertical gap={20} width="100%" maxWidth={600}>
|
|
19
|
+
<Text marginBottom={10}>Default Accordion (Single)</Text>
|
|
20
|
+
<Accordion type="single" defaultValue="item-1">
|
|
21
|
+
<Accordion.Item value="item-1">
|
|
22
|
+
<Accordion.Trigger>
|
|
23
|
+
<Text fontWeight="bold">What is React?</Text>
|
|
24
|
+
</Accordion.Trigger>
|
|
25
|
+
<Accordion.Content>
|
|
26
|
+
<Text>
|
|
27
|
+
React is a JavaScript library for building user interfaces. It is
|
|
28
|
+
maintained by Facebook and a community of individual developers
|
|
29
|
+
and companies. React can be used as a base in the development of
|
|
30
|
+
single-page or mobile applications.
|
|
31
|
+
</Text>
|
|
32
|
+
</Accordion.Content>
|
|
33
|
+
</Accordion.Item>
|
|
47
34
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
<Accordion.Item value="item-2">
|
|
36
|
+
<Accordion.Trigger>
|
|
37
|
+
<Text fontWeight="bold">What are React Hooks?</Text>
|
|
38
|
+
</Accordion.Trigger>
|
|
39
|
+
<Accordion.Content>
|
|
40
|
+
<Text>
|
|
41
|
+
Hooks are functions that let you hook into React state and
|
|
42
|
+
lifecycle features from function components. Hooks dont work
|
|
43
|
+
inside classes — they let you use React without classes.
|
|
44
|
+
</Text>
|
|
45
|
+
</Accordion.Content>
|
|
46
|
+
</Accordion.Item>
|
|
52
47
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</
|
|
64
|
-
</Accordion.
|
|
65
|
-
</Accordion
|
|
66
|
-
|
|
67
|
-
<Accordion.Item id="item-2">
|
|
68
|
-
<Accordion.Header>
|
|
69
|
-
<Text fontWeight="bold">Second Item</Text>
|
|
70
|
-
</Accordion.Header>
|
|
71
|
-
<Accordion.Content>
|
|
72
|
-
<Text>
|
|
73
|
-
This is the second item. Try expanding this while the first item is still open.
|
|
74
|
-
</Text>
|
|
75
|
-
</Accordion.Content>
|
|
76
|
-
</Accordion.Item>
|
|
77
|
-
</Accordion>
|
|
48
|
+
<Accordion.Item value="item-3">
|
|
49
|
+
<Accordion.Trigger>
|
|
50
|
+
<Text fontWeight="bold">What is JSX?</Text>
|
|
51
|
+
</Accordion.Trigger>
|
|
52
|
+
<Accordion.Content>
|
|
53
|
+
<Text>
|
|
54
|
+
JSX is a syntax extension for JavaScript. It was written to be
|
|
55
|
+
used with React and looks a lot like HTML. Because JSX is
|
|
56
|
+
JavaScript, you can use variables inside it.
|
|
57
|
+
</Text>
|
|
58
|
+
</Accordion.Content>
|
|
59
|
+
</Accordion.Item>
|
|
60
|
+
</Accordion>
|
|
61
|
+
</Vertical>
|
|
78
62
|
);
|
|
79
63
|
};
|
|
80
64
|
```
|
|
81
65
|
|
|
82
|
-
### **
|
|
83
|
-
|
|
66
|
+
### **collapsible**
|
|
67
|
+
If true, allows all accordion items to be collapsed, meaning no item has to be open.
|
|
68
|
+
|
|
69
|
+
- **Type:** `boolean`
|
|
70
|
+
- **Default:** `false`
|
|
84
71
|
|
|
85
72
|
```tsx
|
|
86
73
|
import React from 'react';
|
|
87
|
-
import { Accordion } from '
|
|
88
|
-
import { Text } from 'app-studio';
|
|
74
|
+
import { Accordion } from '@app-studio/web';
|
|
75
|
+
import { Text, Vertical } from 'app-studio';
|
|
89
76
|
|
|
90
|
-
export const
|
|
77
|
+
export const CollapsibleAccordion = () => {
|
|
91
78
|
return (
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
79
|
+
<Vertical gap={20} width="100%" maxWidth={600}>
|
|
80
|
+
<Text marginBottom={10}>Collapsible Accordion (Single)</Text>
|
|
81
|
+
<Accordion type="single" defaultValue="item-1" collapsible>
|
|
82
|
+
<Accordion.Item value="item-1">
|
|
83
|
+
<Accordion.Trigger>
|
|
84
|
+
<Text fontWeight="bold">Question 1</Text>
|
|
85
|
+
</Accordion.Trigger>
|
|
98
86
|
<Accordion.Content>
|
|
99
87
|
<Text>
|
|
100
|
-
This is the
|
|
88
|
+
This is the answer to question 1. Since `collapsible` is true, you
|
|
89
|
+
can click the trigger again to close this item, even though its
|
|
90
|
+
the only one.
|
|
101
91
|
</Text>
|
|
102
92
|
</Accordion.Content>
|
|
103
93
|
</Accordion.Item>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<Text fontWeight="bold">Filled Variant</Text>
|
|
110
|
-
</Accordion.Header>
|
|
94
|
+
|
|
95
|
+
<Accordion.Item value="item-2">
|
|
96
|
+
<Accordion.Trigger>
|
|
97
|
+
<Text fontWeight="bold">Question 2</Text>
|
|
98
|
+
</Accordion.Trigger>
|
|
111
99
|
<Accordion.Content>
|
|
112
100
|
<Text>
|
|
113
|
-
This is the
|
|
101
|
+
This is the answer to question 2. Only one item can be open, but
|
|
102
|
+
it can be closed entirely.
|
|
114
103
|
</Text>
|
|
115
104
|
</Accordion.Content>
|
|
116
105
|
</Accordion.Item>
|
|
117
106
|
</Accordion>
|
|
118
|
-
|
|
107
|
+
</Vertical>
|
|
119
108
|
);
|
|
120
109
|
};
|
|
121
110
|
```
|
|
122
111
|
|
|
123
|
-
### **Disabled**
|
|
124
|
-
Disable specific accordion items.
|
|
125
|
-
|
|
126
|
-
```tsx
|
|
127
|
-
import React from 'react';
|
|
128
|
-
import { Accordion } from '../Accordion';
|
|
129
|
-
import { Text } from 'app-studio';
|
|
130
|
-
|
|
131
|
-
export const DisabledAccordion = () => {
|
|
132
|
-
return (
|
|
133
|
-
<Accordion>
|
|
134
|
-
<Accordion.Item id="regular-1">
|
|
135
|
-
<Accordion.Header>
|
|
136
|
-
<Text fontWeight="bold">Regular Item</Text>
|
|
137
|
-
</Accordion.Header>
|
|
138
|
-
<Accordion.Content>
|
|
139
|
-
<Text>
|
|
140
|
-
This is a regular accordion item that can be expanded and collapsed.
|
|
141
|
-
</Text>
|
|
142
|
-
</Accordion.Content>
|
|
143
|
-
</Accordion.Item>
|
|
144
|
-
|
|
145
|
-
<Accordion.Item id="disabled-1" isDisabled>
|
|
146
|
-
<Accordion.Header>
|
|
147
|
-
<Text fontWeight="bold">Disabled Item</Text>
|
|
148
|
-
</Accordion.Header>
|
|
149
|
-
<Accordion.Content>
|
|
150
|
-
<Text>
|
|
151
|
-
This content won't be accessible because the item is disabled.
|
|
152
|
-
</Text>
|
|
153
|
-
</Accordion.Content>
|
|
154
|
-
</Accordion.Item>
|
|
155
|
-
</Accordion>
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
```
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Alert
|
|
2
2
|
|
|
3
|
-
Displays
|
|
3
|
+
Displays important messages to users with various styles and states.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { Alert } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
9
|
|
|
10
10
|
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import { Alert } from '
|
|
13
|
+
import { Alert } from '@app-studio/web';
|
|
14
14
|
|
|
15
15
|
export const DefaultDemo = () => {
|
|
16
16
|
return (
|
|
@@ -20,37 +20,41 @@ export const DefaultDemo = () => {
|
|
|
20
20
|
/>
|
|
21
21
|
);
|
|
22
22
|
};
|
|
23
|
-
|
|
24
23
|
```
|
|
25
24
|
|
|
26
25
|
### **icon**
|
|
27
|
-
|
|
26
|
+
Custom icon element to display in the alert, overriding the default variant-based icon.
|
|
27
|
+
|
|
28
|
+
- **Type:** `ReactNode`
|
|
28
29
|
|
|
29
30
|
```tsx
|
|
30
31
|
import React from 'react';
|
|
31
|
-
import { EditIcon } from '
|
|
32
|
-
import { Alert } from '
|
|
32
|
+
import { EditIcon } from '@app-studio/web';
|
|
33
|
+
import { Alert } from '@app-studio/web';
|
|
33
34
|
|
|
34
35
|
export const IconDemo = () => {
|
|
35
36
|
return (
|
|
36
37
|
<Alert
|
|
37
38
|
title="Heads up!"
|
|
38
39
|
description="You can add components to your app using the cli."
|
|
39
|
-
icon={<EditIcon
|
|
40
|
+
icon={<EditIcon widthHeight={24} color="black" />}
|
|
40
41
|
/>
|
|
41
42
|
);
|
|
42
43
|
};
|
|
43
|
-
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
### **variant**
|
|
47
|
-
|
|
47
|
+
Determines the visual style and semantic meaning of the alert.
|
|
48
|
+
|
|
49
|
+
- **Type:** `string`
|
|
50
|
+
- **Default:** `default`
|
|
51
|
+
- **Possible Values:** `default, info, success, error, warning`
|
|
48
52
|
|
|
49
53
|
```tsx
|
|
50
54
|
import React from 'react';
|
|
51
55
|
import { Horizontal } from 'app-studio';
|
|
52
|
-
import { Alert } from '
|
|
53
|
-
import { Variant } from '
|
|
56
|
+
import { Alert } from '@app-studio/web';
|
|
57
|
+
import { Variant } from '@app-studio/web';
|
|
54
58
|
|
|
55
59
|
export const VariantDemo = () => (
|
|
56
60
|
<Horizontal gap={10}>
|
|
@@ -64,60 +68,5 @@ export const VariantDemo = () => (
|
|
|
64
68
|
))}
|
|
65
69
|
</Horizontal>
|
|
66
70
|
);
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### **styles**
|
|
71
|
-
Optional styles property to apply custom styles to the alert component
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import React from 'react';
|
|
75
|
-
import { Alert } from '../Alert';
|
|
76
|
-
|
|
77
|
-
export const StylesDemo = () => (
|
|
78
|
-
<Alert
|
|
79
|
-
title={'Heads Up!'}
|
|
80
|
-
description={'You can add components to your app using the cli.'}
|
|
81
|
-
views={{
|
|
82
|
-
container: { backgroundColor: 'black' },
|
|
83
|
-
title: { color: 'white' },
|
|
84
|
-
description: { color: 'white' },
|
|
85
|
-
icon: { color: 'white' },
|
|
86
|
-
}}
|
|
87
|
-
/>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### **Theme Mode Support**
|
|
93
|
-
The Alert component supports both light and dark themes through the `themeMode` prop.
|
|
94
|
-
|
|
95
|
-
```tsx
|
|
96
|
-
import React from 'react';
|
|
97
|
-
import { Alert } from '../Alert';
|
|
98
|
-
import { Vertical } from 'app-studio';
|
|
99
|
-
import { Text } from 'app-studio';
|
|
100
|
-
|
|
101
|
-
export const DarkModeDemo = () => {
|
|
102
|
-
return (
|
|
103
|
-
<Vertical gap={24}>
|
|
104
|
-
<Text fontSize={20} fontWeight="bold">Light Mode Alerts</Text>
|
|
105
|
-
<Alert
|
|
106
|
-
themeMode="light"
|
|
107
|
-
variant="info"
|
|
108
|
-
title="Info Alert (Light)"
|
|
109
|
-
description="This is an info alert in light mode."
|
|
110
|
-
/>
|
|
111
|
-
|
|
112
|
-
<Text fontSize={20} fontWeight="bold" marginTop={40}>Dark Mode Alerts</Text>
|
|
113
|
-
<Alert
|
|
114
|
-
themeMode="dark"
|
|
115
|
-
variant="info"
|
|
116
|
-
title="Info Alert (Dark)"
|
|
117
|
-
description="This is an info alert in dark mode."
|
|
118
|
-
/>
|
|
119
|
-
</Vertical>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
71
|
```
|
|
123
72
|
|