@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.
Files changed (95) hide show
  1. package/dist/bot/Bot.d.ts +15 -0
  2. package/dist/bot/Cache.d.ts +13 -0
  3. package/dist/bot/Config.d.ts +13 -0
  4. package/dist/bot/ContentFetcher.d.ts +9 -0
  5. package/dist/bot/DocuCode.d.ts +19 -0
  6. package/dist/bot/FileHandler.d.ts +39 -0
  7. package/dist/bot/ai/AnthropicConnector.d.ts +6 -0
  8. package/dist/bot/ai/GeminiConnector.d.ts +7 -0
  9. package/dist/bot/ai/GroqConnector.d.ts +7 -0
  10. package/dist/bot/ai/HuggingFaceConnector.d.ts +6 -0
  11. package/dist/bot/ai/OpenAIConnector.d.ts +11 -0
  12. package/dist/bot/ai/ReplicateConnector.d.ts +7 -0
  13. package/dist/bot/ai/SambaNovaConnector.d.ts +6 -0
  14. package/dist/bot/ai/ai.config.d.ts +12 -0
  15. package/dist/bot/ai/ai.service.d.ts +36 -0
  16. package/dist/bot/data.d.ts +19 -0
  17. package/dist/bot/extractors.d.ts +8 -0
  18. package/dist/bot/index.d.ts +1 -0
  19. package/dist/bot/prompt/1-project.d.ts +1 -0
  20. package/dist/bot/prompt/2-response.d.ts +1 -0
  21. package/dist/bot/prompt/3-comment.d.ts +1 -0
  22. package/docs/components/Accordion.mdx +74 -121
  23. package/docs/components/Alert.mdx +18 -69
  24. package/docs/components/AspectRatio.mdx +11 -9
  25. package/docs/components/AudioInput.mdx +43 -0
  26. package/docs/components/Avatar.mdx +17 -42
  27. package/docs/components/Background.mdx +99 -491
  28. package/docs/components/Badge.mdx +37 -122
  29. package/docs/components/Button.mdx +71 -123
  30. package/docs/components/Calendar.mdx +7 -7
  31. package/docs/components/Card.mdx +238 -281
  32. package/docs/components/Carousel.mdx +88 -315
  33. package/docs/components/Center.mdx +22 -22
  34. package/docs/components/Chart.mdx +171 -26
  35. package/docs/components/ChatInput.mdx +327 -275
  36. package/docs/components/Checkbox.mdx +3 -5
  37. package/docs/components/ColorInput.mdx +10 -10
  38. package/docs/components/ColorPicker.mdx +452 -0
  39. package/docs/components/ComboBox.mdx +14 -14
  40. package/docs/components/Command.mdx +140 -188
  41. package/docs/components/ContextMenu.mdx +47 -171
  42. package/docs/components/CookieConsent.mdx +53 -0
  43. package/docs/components/CountryPicker.mdx +10 -10
  44. package/docs/components/DatePicker.mdx +4 -4
  45. package/docs/components/DragAndDrop.mdx +279 -463
  46. package/docs/components/Drawer.mdx +401 -100
  47. package/docs/components/DropdownMenu.mdx +37 -155
  48. package/docs/components/EmojiPicker.mdx +84 -0
  49. package/docs/components/File.mdx +130 -4
  50. package/docs/components/Flow.mdx +3 -3
  51. package/docs/components/Form.mdx +4 -4
  52. package/docs/components/Formik.mdx +41 -41
  53. package/docs/components/Gradient.mdx +355 -178
  54. package/docs/components/Horizontal.mdx +1 -2
  55. package/docs/components/HoverCard.mdx +57 -125
  56. package/docs/components/Icon.mdx +10 -10
  57. package/docs/components/KanbanBoard.mdx +12 -12
  58. package/docs/components/Label.mdx +8 -8
  59. package/docs/components/Link.mdx +19 -27
  60. package/docs/components/Loader.mdx +224 -407
  61. package/docs/components/Menubar.mdx +71 -67
  62. package/docs/components/Message.mdx +211 -526
  63. package/docs/components/Modal.mdx +351 -475
  64. package/docs/components/NavigationMenu.mdx +8 -8
  65. package/docs/components/OTPInput.mdx +194 -0
  66. package/docs/components/Pagination.mdx +451 -107
  67. package/docs/components/Password.mdx +8 -8
  68. package/docs/components/ProgressBar.mdx +460 -0
  69. package/docs/components/Resizable.mdx +103 -102
  70. package/docs/components/Select.mdx +5 -5
  71. package/docs/components/Separator.mdx +11 -98
  72. package/docs/components/ShareButton.mdx +29 -0
  73. package/docs/components/Sidebar.mdx +70 -131
  74. package/docs/components/Slider.mdx +99 -185
  75. package/docs/components/StatusIndicator.mdx +373 -0
  76. package/docs/components/Switch.mdx +3 -3
  77. package/docs/components/Table.mdx +25 -105
  78. package/docs/components/Tabs.mdx +40 -143
  79. package/docs/components/TagInput.mdx +32 -32
  80. package/docs/components/Text.mdx +3 -3
  81. package/docs/components/TextArea.mdx +9 -9
  82. package/docs/components/TextField.mdx +17 -17
  83. package/docs/components/Title.mdx +267 -525
  84. package/docs/components/Toast.mdx +65 -142
  85. package/docs/components/Toggle.mdx +34 -46
  86. package/docs/components/ToggleGroup.mdx +29 -50
  87. package/docs/components/Tooltip.mdx +500 -137
  88. package/docs/components/Tree.mdx +4 -4
  89. package/docs/components/Uploader.mdx +205 -351
  90. package/docs/components/Vertical.mdx +22 -22
  91. package/package.json +1 -1
  92. package/dist/components/AuthGuard/AuthGuard.d.ts +0 -35
  93. package/dist/components/AuthGuard/index.d.ts +0 -1
  94. package/docs/adk-components.md +0 -319
  95. package/docs/adk-quick-start.md +0 -268
@@ -1,18 +1,22 @@
1
1
  # Command
2
2
 
3
- A command palette for displaying a searchable list of commands.
3
+ A versatile component for searching, filtering, and executing commands or actions.
4
4
 
5
5
  ### **Import**
6
- ```tsx
7
- import { Command } from '@app-studio/web';
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, SettingsIcon, UserIcon } from '@app-studio/web';
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
- ### **Groups**
62
- The Command component supports grouping commands:
81
+ ### **groups**
82
+ An optional array of command groups to be displayed.
63
83
 
64
- ```tsx
65
- const groups = [
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
- // Default variant
111
- <Command variant="default" />
112
-
113
- // Filled variant
114
- <Command variant="filled" />
115
-
116
- // Outline variant
117
- <Command variant="outline" />
118
- ```
119
-
120
- ### **Sizes**
121
- The Command component supports different sizes:
122
-
123
- ```tsx
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
- ```tsx
192
- <Command
193
- open={open}
194
- onOpenChange={setOpen}
195
- commands={commands}
196
- views={{
197
- container: {
198
- backgroundColor: 'color.blue.50',
199
- borderColor: 'color.blue.200',
200
- borderWidth: '2px',
201
- borderRadius: '12px',
202
- },
203
- searchInput: {
204
- container: {
205
- backgroundColor: 'color.white',
206
- borderBottomColor: 'color.blue.200',
207
- },
208
- input: {
209
- color: 'color.blue.800',
210
- fontWeight: 'medium',
211
- },
212
- },
213
- item: {
214
- backgroundColor: 'transparent',
215
- borderRadius: '8px',
216
- _hover: {
217
- backgroundColor: 'color.blue.100',
218
- },
219
- },
220
- selectedItem: {
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
- shortcut: {
234
- backgroundColor: 'color.white',
235
- padding: '2px 6px',
236
- borderRadius: '4px',
237
- fontWeight: 'bold',
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
- footer: {
240
- backgroundColor: 'color.white',
241
- borderTopColor: 'color.blue.200',
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
- ### **Keyboard Navigation**
248
- The Command component supports keyboard navigation:
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 context menu component that appears when right-clicking on an element.
3
+ A floating menu that appears upon user interaction, typically a right-click or long-press.
4
4
 
5
5
  ### **Import**
6
- ```tsx
7
- import { ContextMenu } from '@app-studio/web';
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 '../ContextMenu';
14
- import { View, Text } from 'app-studio';
15
- import { CopyIcon, EditIcon, DeleteIcon } from '../../Icon/Icon';
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 items = [
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: () => alert('Copy clicked')
34
+ onClick: handleCopy,
24
35
  },
25
36
  {
26
37
  id: 'edit',
27
38
  label: 'Edit',
28
39
  icon: <EditIcon widthHeight={16} />,
29
- onClick: () => alert('Edit clicked')
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: () => alert('Delete clicked')
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';
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: () => alert('Download clicked')
60
+ onClick: handleDownload,
96
61
  },
97
62
  {
98
63
  id: 'share',
99
64
  label: 'Share',
100
65
  icon: <ShareIcon widthHeight={16} />,
101
- onClick: () => alert('Share clicked')
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';
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: 'edit',
142
- label: 'Edit',
143
- icon: <EditIcon widthHeight={16} />,
144
- onClick: () => alert('Edit clicked')
145
- }
71
+ id: 'disabled',
72
+ label: 'Disabled Option',
73
+ disabled: true,
74
+ },
146
75
  ];
147
76
 
148
77
  return (
149
- <>
150
- <ContextMenu items={items} variant="default">
151
- <Text>Default Variant</Text>
152
- </ContextMenu>
153
-
154
- <ContextMenu items={items} variant="filled">
155
- <Text>Filled Variant</Text>
156
- </ContextMenu>
157
-
158
- <ContextMenu items={items} variant="outline">
159
- <Text>Outline Variant</Text>
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';
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
+