@app-studio/web 0.9.41 → 0.9.44
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/dist/components/Title/Title/SlideEffect.d.ts +14 -0
- package/dist/components/Title/Title/Title.props.d.ts +20 -0
- package/dist/components/Title/Title/Title.state.d.ts +4 -0
- package/dist/web.cjs.development.js +265 -78
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +265 -78
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +265 -78
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/docs/components/Accordion.mdx +74 -121
- package/docs/components/Alert.mdx +19 -70
- package/docs/components/AspectRatio.mdx +13 -11
- package/docs/components/AudioInput.mdx +43 -0
- package/docs/components/Avatar.mdx +18 -43
- package/docs/components/Background.mdx +100 -492
- package/docs/components/Badge.mdx +45 -130
- package/docs/components/Button.mdx +76 -128
- package/docs/components/Calendar.mdx +7 -7
- package/docs/components/Card.mdx +247 -290
- package/docs/components/Carousel.mdx +94 -321
- 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 +6 -6
- package/docs/components/ColorPicker.mdx +452 -0
- package/docs/components/ComboBox.mdx +13 -13
- 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 +8 -8
- package/docs/components/DatePicker.mdx +3 -3
- package/docs/components/DragAndDrop.mdx +279 -463
- package/docs/components/Drawer.mdx +392 -231
- package/docs/components/DropdownMenu.mdx +37 -155
- package/docs/components/EmojiPicker.mdx +84 -0
- package/docs/components/File.mdx +130 -4
- package/docs/components/Formik.mdx +39 -39
- package/docs/components/Gradient.mdx +359 -182
- package/docs/components/Horizontal.mdx +1 -2
- package/docs/components/HoverCard.mdx +57 -125
- package/docs/components/KanbanBoard.mdx +9 -9
- package/docs/components/Link.mdx +22 -30
- package/docs/components/Loader.mdx +230 -413
- package/docs/components/Menubar.mdx +73 -69
- package/docs/components/Message.mdx +210 -525
- 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 +17 -17
- package/docs/components/Text.mdx +3 -3
- package/docs/components/TextArea.mdx +6 -6
- package/docs/components/TextField.mdx +12 -12
- package/docs/components/Title.mdx +267 -525
- package/docs/components/Toast.mdx +65 -142
- package/docs/components/Toggle.mdx +37 -49
- package/docs/components/ToggleGroup.mdx +36 -57
- package/docs/components/Tooltip.mdx +501 -138
- package/docs/components/Uploader.mdx +205 -351
- 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
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
# Command
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A versatile component for searching, filtering, and executing commands or actions.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { Command } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
9
|
|
|
10
10
|
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React, { useState } from 'react';
|
|
13
13
|
import { Command } from '@app-studio/web';
|
|
14
14
|
import { Button } from '@app-studio/web';
|
|
15
|
-
import { HomeIcon,
|
|
15
|
+
import { HomeIcon,
|
|
16
|
+
SettingsIcon,
|
|
17
|
+
UserIcon,
|
|
18
|
+
InfoIcon,
|
|
19
|
+
SearchIcon, } from '@app-studio/web';
|
|
16
20
|
|
|
17
21
|
export const DefaultCommand = () => {
|
|
18
22
|
const [open, setOpen] = useState(false);
|
|
@@ -42,6 +46,22 @@ export const DefaultCommand = () => {
|
|
|
42
46
|
shortcut: '⌘P',
|
|
43
47
|
onSelect: () => console.log('Profile selected'),
|
|
44
48
|
},
|
|
49
|
+
{
|
|
50
|
+
id: 'help',
|
|
51
|
+
name: 'Help',
|
|
52
|
+
description: 'Get help and support',
|
|
53
|
+
icon: <InfoIcon widthHeight={16} />,
|
|
54
|
+
shortcut: '⌘?',
|
|
55
|
+
onSelect: () => console.log('Help selected'),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'search',
|
|
59
|
+
name: 'Search',
|
|
60
|
+
description: 'Search for content',
|
|
61
|
+
icon: <SearchIcon widthHeight={16} />,
|
|
62
|
+
shortcut: '⌘K',
|
|
63
|
+
onSelect: () => console.log('Search selected'),
|
|
64
|
+
},
|
|
45
65
|
];
|
|
46
66
|
|
|
47
67
|
return (
|
|
@@ -58,195 +78,127 @@ export const DefaultCommand = () => {
|
|
|
58
78
|
};
|
|
59
79
|
```
|
|
60
80
|
|
|
61
|
-
### **
|
|
62
|
-
|
|
81
|
+
### **groups**
|
|
82
|
+
An optional array of command groups to be displayed.
|
|
63
83
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
id: 'navigation',
|
|
68
|
-
name: 'Navigation',
|
|
69
|
-
commands: [
|
|
70
|
-
{
|
|
71
|
-
id: 'home',
|
|
72
|
-
name: 'Home',
|
|
73
|
-
description: 'Go to home page',
|
|
74
|
-
icon: <HomeIcon widthHeight={16} />,
|
|
75
|
-
shortcut: '⌘H',
|
|
76
|
-
onSelect: () => console.log('Home selected'),
|
|
77
|
-
},
|
|
78
|
-
// More commands...
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: 'actions',
|
|
83
|
-
name: 'Actions',
|
|
84
|
-
commands: [
|
|
85
|
-
{
|
|
86
|
-
id: 'edit',
|
|
87
|
-
name: 'Edit',
|
|
88
|
-
description: 'Edit current document',
|
|
89
|
-
icon: <EditIcon widthHeight={16} />,
|
|
90
|
-
shortcut: '⌘E',
|
|
91
|
-
onSelect: () => console.log('Edit selected'),
|
|
92
|
-
},
|
|
93
|
-
// More commands...
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
];
|
|
97
|
-
|
|
98
|
-
<Command
|
|
99
|
-
open={open}
|
|
100
|
-
onOpenChange={setOpen}
|
|
101
|
-
groups={groups}
|
|
102
|
-
placeholder="Search commands..."
|
|
103
|
-
/>
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### **Variants**
|
|
107
|
-
The Command component supports different visual variants:
|
|
84
|
+
- **Type:** `CommandGroup[]`
|
|
85
|
+
- **Default:** ``
|
|
86
|
+
- **Possible Values:** ``
|
|
108
87
|
|
|
109
88
|
```tsx
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// Small size
|
|
125
|
-
<Command size="sm" />
|
|
126
|
-
|
|
127
|
-
// Medium size (default)
|
|
128
|
-
<Command size="md" />
|
|
129
|
-
|
|
130
|
-
// Large size
|
|
131
|
-
<Command size="lg" />
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### **Custom Empty State**
|
|
135
|
-
The Command component supports a custom empty state:
|
|
136
|
-
|
|
137
|
-
```tsx
|
|
138
|
-
const customEmptyState = (
|
|
139
|
-
<View
|
|
140
|
-
alignItems="center"
|
|
141
|
-
justifyContent="center"
|
|
142
|
-
padding="24px"
|
|
143
|
-
flexDirection="column"
|
|
144
|
-
>
|
|
145
|
-
<Text fontSize="16px" fontWeight="bold" color="color.gray.600">
|
|
146
|
-
No commands found
|
|
147
|
-
</Text>
|
|
148
|
-
<Text fontSize="14px" color="color.gray.500" marginTop="8px">
|
|
149
|
-
Try a different search term
|
|
150
|
-
</Text>
|
|
151
|
-
</View>
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
<Command
|
|
155
|
-
open={open}
|
|
156
|
-
onOpenChange={setOpen}
|
|
157
|
-
commands={commands}
|
|
158
|
-
emptyState={customEmptyState}
|
|
159
|
-
/>
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### **Custom Footer**
|
|
163
|
-
The Command component supports a custom footer:
|
|
164
|
-
|
|
165
|
-
```tsx
|
|
166
|
-
const customFooter = (
|
|
167
|
-
<Horizontal justifyContent="space-between" width="100%">
|
|
168
|
-
<Text fontSize="12px" color="color.gray.500">
|
|
169
|
-
Press ↑↓ to navigate
|
|
170
|
-
</Text>
|
|
171
|
-
<Text fontSize="12px" color="color.gray.500">
|
|
172
|
-
Press Enter to select
|
|
173
|
-
</Text>
|
|
174
|
-
<Text fontSize="12px" color="color.gray.500">
|
|
175
|
-
Press Esc to close
|
|
176
|
-
</Text>
|
|
177
|
-
</Horizontal>
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
<Command
|
|
181
|
-
open={open}
|
|
182
|
-
onOpenChange={setOpen}
|
|
183
|
-
commands={commands}
|
|
184
|
-
footer={customFooter}
|
|
185
|
-
/>
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### **Customization**
|
|
189
|
-
The Command component can be customized with the views prop:
|
|
89
|
+
import React, { useState } from 'react';
|
|
90
|
+
import { Command } from '@app-studio/web';
|
|
91
|
+
import { Button } from '@app-studio/web';
|
|
92
|
+
import { HomeIcon,
|
|
93
|
+
SettingsIcon,
|
|
94
|
+
UserIcon,
|
|
95
|
+
EditIcon,
|
|
96
|
+
DustBinIcon,
|
|
97
|
+
CopyIcon,
|
|
98
|
+
PlayIcon,
|
|
99
|
+
PauseIcon, } from '@app-studio/web';
|
|
100
|
+
|
|
101
|
+
export const GroupedCommand = () => {
|
|
102
|
+
const [open, setOpen] = useState(false);
|
|
190
103
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
backgroundColor: 'color.blue.200',
|
|
222
|
-
_hover: {
|
|
223
|
-
backgroundColor: 'color.blue.300',
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
name: {
|
|
227
|
-
color: 'color.blue.800',
|
|
228
|
-
fontWeight: 'bold',
|
|
229
|
-
},
|
|
230
|
-
description: {
|
|
231
|
-
color: 'color.blue.600',
|
|
104
|
+
const groups = [
|
|
105
|
+
{
|
|
106
|
+
id: 'navigation',
|
|
107
|
+
name: 'Navigation',
|
|
108
|
+
commands: [
|
|
109
|
+
{
|
|
110
|
+
id: 'home',
|
|
111
|
+
name: 'Home',
|
|
112
|
+
description: 'Go to home page',
|
|
113
|
+
icon: <HomeIcon widthHeight={16} />,
|
|
114
|
+
shortcut: '⌘H',
|
|
115
|
+
onSelect: () => console.log('Home selected'),
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: 'settings',
|
|
119
|
+
name: 'Settings',
|
|
120
|
+
description: 'Open settings page',
|
|
121
|
+
icon: <SettingsIcon widthHeight={16} />,
|
|
122
|
+
shortcut: '⌘S',
|
|
123
|
+
onSelect: () => console.log('Settings selected'),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'profile',
|
|
127
|
+
name: 'Profile',
|
|
128
|
+
description: 'View your profile',
|
|
129
|
+
icon: <UserIcon widthHeight={16} />,
|
|
130
|
+
shortcut: '⌘P',
|
|
131
|
+
onSelect: () => console.log('Profile selected'),
|
|
132
|
+
},
|
|
133
|
+
],
|
|
232
134
|
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
135
|
+
{
|
|
136
|
+
id: 'actions',
|
|
137
|
+
name: 'Actions',
|
|
138
|
+
commands: [
|
|
139
|
+
{
|
|
140
|
+
id: 'edit',
|
|
141
|
+
name: 'Edit',
|
|
142
|
+
description: 'Edit current document',
|
|
143
|
+
icon: <EditIcon widthHeight={16} />,
|
|
144
|
+
shortcut: '⌘E',
|
|
145
|
+
onSelect: () => console.log('Edit selected'),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: 'delete',
|
|
149
|
+
name: 'Delete',
|
|
150
|
+
description: 'Delete current document',
|
|
151
|
+
icon: <DustBinIcon widthHeight={16} />,
|
|
152
|
+
shortcut: '⌘⌫',
|
|
153
|
+
onSelect: () => console.log('Delete selected'),
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: 'copy',
|
|
157
|
+
name: 'Copy',
|
|
158
|
+
description: 'Copy to clipboard',
|
|
159
|
+
icon: <CopyIcon widthHeight={16} />,
|
|
160
|
+
shortcut: '⌘C',
|
|
161
|
+
onSelect: () => console.log('Copy selected'),
|
|
162
|
+
},
|
|
163
|
+
],
|
|
238
164
|
},
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
165
|
+
{
|
|
166
|
+
id: 'media',
|
|
167
|
+
name: 'Media Controls',
|
|
168
|
+
commands: [
|
|
169
|
+
{
|
|
170
|
+
id: 'play',
|
|
171
|
+
name: 'Play',
|
|
172
|
+
description: 'Play media',
|
|
173
|
+
icon: <PlayIcon widthHeight={16} />,
|
|
174
|
+
shortcut: 'Space',
|
|
175
|
+
onSelect: () => console.log('Play selected'),
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: 'pause',
|
|
179
|
+
name: 'Pause',
|
|
180
|
+
description: 'Pause media',
|
|
181
|
+
icon: <PauseIcon widthHeight={16} />,
|
|
182
|
+
shortcut: 'Space',
|
|
183
|
+
onSelect: () => console.log('Pause selected'),
|
|
184
|
+
},
|
|
185
|
+
],
|
|
242
186
|
},
|
|
243
|
-
|
|
244
|
-
/>
|
|
245
|
-
```
|
|
187
|
+
];
|
|
246
188
|
|
|
247
|
-
|
|
248
|
-
|
|
189
|
+
return (
|
|
190
|
+
<>
|
|
191
|
+
<Button onClick={() => setOpen(true)}>
|
|
192
|
+
Open Grouped Command Palette
|
|
193
|
+
</Button>
|
|
194
|
+
<Command
|
|
195
|
+
open={open}
|
|
196
|
+
onOpenChange={setOpen}
|
|
197
|
+
groups={groups}
|
|
198
|
+
placeholder="Search commands..."
|
|
199
|
+
/>
|
|
200
|
+
</>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
```
|
|
249
204
|
|
|
250
|
-
- `↑` and `↓` to navigate between commands
|
|
251
|
-
- `Enter` to select a command
|
|
252
|
-
- `Escape` to close the command palette
|
|
@@ -1,88 +1,53 @@
|
|
|
1
1
|
# ContextMenu
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A floating menu that appears upon user interaction, typically a right-click or long-press.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { ContextMenu } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
9
|
|
|
10
10
|
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import { ContextMenu } from '
|
|
14
|
-
import {
|
|
15
|
-
import { CopyIcon,
|
|
13
|
+
import { ContextMenu } from '@app-studio/web';
|
|
14
|
+
import { Text, Vertical, View } from 'app-studio';
|
|
15
|
+
import { CopyIcon,
|
|
16
|
+
EditIcon,
|
|
17
|
+
DeleteIcon,
|
|
18
|
+
DownloadIcon,
|
|
19
|
+
ShareIcon, } from '@app-studio/web';
|
|
20
|
+
import { ContextMenuItem } from '@app-studio/web';
|
|
16
21
|
|
|
17
22
|
export const DefaultContextMenu = () => {
|
|
18
|
-
const
|
|
23
|
+
const handleCopy = () => alert('Copy clicked');
|
|
24
|
+
const handleEdit = () => alert('Edit clicked');
|
|
25
|
+
const handleDelete = () => alert('Delete clicked');
|
|
26
|
+
const handleDownload = () => alert('Download clicked');
|
|
27
|
+
const handleShare = () => alert('Share clicked');
|
|
28
|
+
|
|
29
|
+
const items: ContextMenuItem[] = [
|
|
19
30
|
{
|
|
20
31
|
id: 'copy',
|
|
21
32
|
label: 'Copy',
|
|
22
33
|
icon: <CopyIcon widthHeight={16} />,
|
|
23
|
-
onClick:
|
|
34
|
+
onClick: handleCopy,
|
|
24
35
|
},
|
|
25
36
|
{
|
|
26
37
|
id: 'edit',
|
|
27
38
|
label: 'Edit',
|
|
28
39
|
icon: <EditIcon widthHeight={16} />,
|
|
29
|
-
onClick:
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: 'divider-1',
|
|
33
|
-
divider: true
|
|
40
|
+
onClick: handleEdit,
|
|
34
41
|
},
|
|
42
|
+
// {
|
|
43
|
+
// id: 'divider-1',
|
|
44
|
+
// divider: true
|
|
45
|
+
// },
|
|
35
46
|
{
|
|
36
47
|
id: 'delete',
|
|
37
48
|
label: 'Delete',
|
|
38
49
|
icon: <DeleteIcon widthHeight={16} />,
|
|
39
|
-
onClick:
|
|
40
|
-
}
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<ContextMenu items={items}>
|
|
45
|
-
<View
|
|
46
|
-
padding={20}
|
|
47
|
-
backgroundColor="color.gray.100"
|
|
48
|
-
borderRadius={8}
|
|
49
|
-
textAlign="center"
|
|
50
|
-
cursor="context-menu"
|
|
51
|
-
>
|
|
52
|
-
<Text>Right-click here to open the context menu</Text>
|
|
53
|
-
</View>
|
|
54
|
-
</ContextMenu>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### **Submenu**
|
|
60
|
-
Create nested context menus with submenus.
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
import React from 'react';
|
|
64
|
-
import { ContextMenu } from '../ContextMenu';
|
|
65
|
-
import { View, Text } from '@app-studio/web';
|
|
66
|
-
import {
|
|
67
|
-
CopyIcon,
|
|
68
|
-
EditIcon,
|
|
69
|
-
DownloadIcon,
|
|
70
|
-
ShareIcon
|
|
71
|
-
} from '../../Icon/Icon';
|
|
72
|
-
|
|
73
|
-
export const SubmenuContextMenu = () => {
|
|
74
|
-
const items = [
|
|
75
|
-
{
|
|
76
|
-
id: 'copy',
|
|
77
|
-
label: 'Copy',
|
|
78
|
-
icon: <CopyIcon widthHeight={16} />,
|
|
79
|
-
onClick: () => alert('Copy clicked')
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: 'edit',
|
|
83
|
-
label: 'Edit',
|
|
84
|
-
icon: <EditIcon widthHeight={16} />,
|
|
85
|
-
onClick: () => alert('Edit clicked')
|
|
50
|
+
onClick: handleDelete,
|
|
86
51
|
},
|
|
87
52
|
{
|
|
88
53
|
id: 'more',
|
|
@@ -92,128 +57,39 @@ export const SubmenuContextMenu = () => {
|
|
|
92
57
|
id: 'download',
|
|
93
58
|
label: 'Download',
|
|
94
59
|
icon: <DownloadIcon widthHeight={16} />,
|
|
95
|
-
onClick:
|
|
60
|
+
onClick: handleDownload,
|
|
96
61
|
},
|
|
97
62
|
{
|
|
98
63
|
id: 'share',
|
|
99
64
|
label: 'Share',
|
|
100
65
|
icon: <ShareIcon widthHeight={16} />,
|
|
101
|
-
onClick:
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<ContextMenu items={items}>
|
|
109
|
-
<View
|
|
110
|
-
padding={20}
|
|
111
|
-
backgroundColor="color.gray.100"
|
|
112
|
-
borderRadius={8}
|
|
113
|
-
textAlign="center"
|
|
114
|
-
cursor="context-menu"
|
|
115
|
-
>
|
|
116
|
-
<Text>Right-click here to open the context menu with submenu</Text>
|
|
117
|
-
</View>
|
|
118
|
-
</ContextMenu>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### **Variants**
|
|
124
|
-
Different visual styles for the context menu.
|
|
125
|
-
|
|
126
|
-
```tsx
|
|
127
|
-
import React from 'react';
|
|
128
|
-
import { ContextMenu } from '../ContextMenu';
|
|
129
|
-
import { View, Text } from '@app-studio/web';
|
|
130
|
-
import { CopyIcon, EditIcon } from '../../Icon/Icon';
|
|
131
|
-
|
|
132
|
-
export const ContextMenuVariants = () => {
|
|
133
|
-
const items = [
|
|
134
|
-
{
|
|
135
|
-
id: 'copy',
|
|
136
|
-
label: 'Copy',
|
|
137
|
-
icon: <CopyIcon widthHeight={16} />,
|
|
138
|
-
onClick: () => alert('Copy clicked')
|
|
66
|
+
onClick: handleShare,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
139
69
|
},
|
|
140
70
|
{
|
|
141
|
-
id: '
|
|
142
|
-
label: '
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
71
|
+
id: 'disabled',
|
|
72
|
+
label: 'Disabled Option',
|
|
73
|
+
disabled: true,
|
|
74
|
+
},
|
|
146
75
|
];
|
|
147
76
|
|
|
148
77
|
return (
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
78
|
+
<Vertical gap={20} width="100%" maxWidth={400}>
|
|
79
|
+
<Text marginBottom={10}>Default Context Menu</Text>
|
|
80
|
+
<ContextMenu items={items}>
|
|
81
|
+
<View
|
|
82
|
+
padding={20}
|
|
83
|
+
backgroundColor="color.gray.100"
|
|
84
|
+
borderRadius={8}
|
|
85
|
+
textAlign="center"
|
|
86
|
+
cursor="context-menu"
|
|
87
|
+
>
|
|
88
|
+
<Text>Right-click here to open the context menu</Text>
|
|
89
|
+
</View>
|
|
160
90
|
</ContextMenu>
|
|
161
|
-
|
|
91
|
+
</Vertical>
|
|
162
92
|
);
|
|
163
93
|
};
|
|
164
94
|
```
|
|
165
95
|
|
|
166
|
-
### **Custom Styling**
|
|
167
|
-
Customize the appearance of the context menu.
|
|
168
|
-
|
|
169
|
-
```tsx
|
|
170
|
-
import React from 'react';
|
|
171
|
-
import { ContextMenu } from '../ContextMenu';
|
|
172
|
-
import { View, Text } from '@app-studio/web';
|
|
173
|
-
import { CopyIcon, EditIcon } from '../../Icon/Icon';
|
|
174
|
-
|
|
175
|
-
export const CustomContextMenu = () => {
|
|
176
|
-
const items = [
|
|
177
|
-
{
|
|
178
|
-
id: 'copy',
|
|
179
|
-
label: 'Copy',
|
|
180
|
-
icon: <CopyIcon widthHeight={16} />,
|
|
181
|
-
onClick: () => alert('Copy clicked')
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
id: 'edit',
|
|
185
|
-
label: 'Edit',
|
|
186
|
-
icon: <EditIcon widthHeight={16} />,
|
|
187
|
-
onClick: () => alert('Edit clicked')
|
|
188
|
-
}
|
|
189
|
-
];
|
|
190
|
-
|
|
191
|
-
return (
|
|
192
|
-
<ContextMenu
|
|
193
|
-
items={items}
|
|
194
|
-
views={{
|
|
195
|
-
menu: {
|
|
196
|
-
backgroundColor: 'color.blue',
|
|
197
|
-
color: 'color.white',
|
|
198
|
-
borderRadius: '8px',
|
|
199
|
-
},
|
|
200
|
-
item: {
|
|
201
|
-
_hover: {
|
|
202
|
-
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}}
|
|
206
|
-
>
|
|
207
|
-
<View
|
|
208
|
-
padding={20}
|
|
209
|
-
backgroundColor="color.blue.100"
|
|
210
|
-
borderRadius={8}
|
|
211
|
-
textAlign="center"
|
|
212
|
-
cursor="context-menu"
|
|
213
|
-
>
|
|
214
|
-
<Text>Right-click here for custom styled menu</Text>
|
|
215
|
-
</View>
|
|
216
|
-
</ContextMenu>
|
|
217
|
-
);
|
|
218
|
-
};
|
|
219
|
-
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# CookieConsent
|
|
2
|
+
|
|
3
|
+
Displays a customizable banner to manage user consent for cookies, enhancing user experience.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { CookieConsent } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Button } from '@app-studio/web';
|
|
14
|
+
import { Text, View } from 'app-studio';
|
|
15
|
+
import { CookieConsent } from '@app-studio/web';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Default CookieConsent example
|
|
19
|
+
*/
|
|
20
|
+
export const DefaultCookieConsent = () => {
|
|
21
|
+
// State to control visibility for demo purposes
|
|
22
|
+
const [showConsent, setShowConsent] = React.useState(false);
|
|
23
|
+
|
|
24
|
+
// Reset cookie consent to show the banner
|
|
25
|
+
const handleShowConsent = () => {
|
|
26
|
+
// Clear localStorage to simulate a new visit
|
|
27
|
+
localStorage.removeItem('app-studio-cookie-consent');
|
|
28
|
+
localStorage.removeItem('app-studio-cookie-consent-expires');
|
|
29
|
+
setShowConsent(true);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<View width="100%" maxWidth={600}>
|
|
34
|
+
<Text marginBottom={16}>
|
|
35
|
+
Cliquez sur le bouton ci-dessous pour afficher la bannière de
|
|
36
|
+
consentement des cookies
|
|
37
|
+
</Text>
|
|
38
|
+
|
|
39
|
+
<Button onClick={handleShowConsent}>
|
|
40
|
+
Afficher le consentement des cookies
|
|
41
|
+
</Button>
|
|
42
|
+
|
|
43
|
+
{showConsent && (
|
|
44
|
+
<CookieConsent
|
|
45
|
+
onAccept={() => setShowConsent(false)}
|
|
46
|
+
onCustomize={() => alert('Préférences de personnalisation cliquées')}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
</View>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|