@app-studio/web 0.9.41 → 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 +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,165 +1,88 @@
|
|
|
1
1
|
# Toast
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Displays temporary, dismissible messages to inform users about actions, status, or events.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { Toast } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
9
|
|
|
10
10
|
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { Button } from '@app-studio/web';
|
|
14
|
+
import { Horizontal } from 'app-studio';
|
|
14
15
|
import { Toast } from '@app-studio/web';
|
|
15
16
|
|
|
16
17
|
export const DefaultToast = () => {
|
|
17
18
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
<Horizontal gap={10}>
|
|
20
|
+
<Button
|
|
21
|
+
onClick={() =>
|
|
22
|
+
Toast.success('Success', 'Your action was completed successfully.')
|
|
23
|
+
}
|
|
24
|
+
>
|
|
25
|
+
Show Success Toast
|
|
26
|
+
</Button>
|
|
27
|
+
</Horizontal>
|
|
25
28
|
);
|
|
26
29
|
};
|
|
27
30
|
```
|
|
28
31
|
|
|
29
|
-
### **
|
|
30
|
-
The
|
|
31
|
-
|
|
32
|
-
```tsx
|
|
33
|
-
// Info toast
|
|
34
|
-
Toast.info('Information', 'This is an informational message.');
|
|
35
|
-
|
|
36
|
-
// Success toast
|
|
37
|
-
Toast.success('Success', 'Your action was completed successfully.');
|
|
32
|
+
### **duration**
|
|
33
|
+
The time in milliseconds before the toast automatically closes. Default is usually 5000ms.
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
Toast.warning('Warning', 'Please be careful with this action.');
|
|
41
|
-
|
|
42
|
-
// Error toast
|
|
43
|
-
Toast.error('Error', 'An error occurred while processing your request.');
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### **Positions**
|
|
47
|
-
The Toast component can be positioned in different areas of the screen:
|
|
35
|
+
- **Type:** `number`
|
|
48
36
|
|
|
49
37
|
```tsx
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Toast.info('Top Right Toast', 'This toast appears at the top-right.', { position: 'top-right' });
|
|
55
|
-
|
|
56
|
-
// Top-left position
|
|
57
|
-
Toast.info('Top Left Toast', 'This toast appears at the top-left.', { position: 'top-left' });
|
|
58
|
-
|
|
59
|
-
// Bottom position
|
|
60
|
-
Toast.info('Bottom Toast', 'This toast appears at the bottom.', { position: 'bottom' });
|
|
61
|
-
|
|
62
|
-
// Bottom-right position
|
|
63
|
-
Toast.info('Bottom Right Toast', 'This toast appears at the bottom-right.', { position: 'bottom-right' });
|
|
64
|
-
|
|
65
|
-
// Bottom-left position
|
|
66
|
-
Toast.info('Bottom Left Toast', 'This toast appears at the bottom-left.', { position: 'bottom-left' });
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### **Duration**
|
|
70
|
-
The Toast component can be displayed for different durations:
|
|
71
|
-
|
|
72
|
-
```tsx
|
|
73
|
-
// Short duration (2 seconds)
|
|
74
|
-
Toast.info('Short Duration', 'This toast will disappear in 2 seconds.', {
|
|
75
|
-
duration: 2000,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Default duration (5 seconds)
|
|
79
|
-
Toast.info('Default Duration', 'This toast will disappear in 5 seconds.');
|
|
80
|
-
|
|
81
|
-
// Long duration (10 seconds)
|
|
82
|
-
Toast.info('Long Duration', 'This toast will disappear in 10 seconds.', {
|
|
83
|
-
duration: 10000,
|
|
84
|
-
});
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### **Actions**
|
|
88
|
-
The Toast component can include action buttons:
|
|
89
|
-
|
|
90
|
-
```tsx
|
|
91
|
-
// Toast with an undo action
|
|
92
|
-
Toast.success('Item Deleted', 'The item has been successfully deleted.', {
|
|
93
|
-
action: () => {
|
|
94
|
-
// Handle undo action
|
|
95
|
-
console.log('Undo action triggered');
|
|
96
|
-
},
|
|
97
|
-
actionText: 'Undo',
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Toast with a retry action
|
|
101
|
-
Toast.error('Failed to Save', 'There was an error saving your changes.', {
|
|
102
|
-
action: () => {
|
|
103
|
-
// Handle retry action
|
|
104
|
-
console.log('Retry action triggered');
|
|
105
|
-
},
|
|
106
|
-
actionText: 'Retry',
|
|
107
|
-
});
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### **Customization**
|
|
111
|
-
The Toast component can be customized:
|
|
112
|
-
|
|
113
|
-
```tsx
|
|
114
|
-
// Custom styled toast
|
|
115
|
-
Toast.info('Custom Styled Toast', 'This toast has custom styling.', {
|
|
116
|
-
views: {
|
|
117
|
-
container: {
|
|
118
|
-
backgroundColor: 'color.purple.50',
|
|
119
|
-
borderColor: 'color.purple.300',
|
|
120
|
-
borderRadius: '12px',
|
|
121
|
-
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)',
|
|
122
|
-
},
|
|
123
|
-
title: {
|
|
124
|
-
color: 'color.purple.700',
|
|
125
|
-
fontSize: '18px',
|
|
126
|
-
},
|
|
127
|
-
description: {
|
|
128
|
-
color: 'color.purple.600',
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
showIcon: false,
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// Toast without a close button
|
|
135
|
-
Toast.success('No Close Button', 'This toast does not have a close button.', {
|
|
136
|
-
isClosable: false,
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// Toast without an icon
|
|
140
|
-
Toast.warning('No Icon', 'This toast does not display an icon.', {
|
|
141
|
-
showIcon: false,
|
|
142
|
-
});
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### **Toast Container**
|
|
146
|
-
The Toast component requires a container to be rendered:
|
|
38
|
+
import React from 'react';
|
|
39
|
+
import { Button } from '@app-studio/web';
|
|
40
|
+
import { Horizontal } from 'app-studio';
|
|
41
|
+
import { Toast } from '@app-studio/web';
|
|
147
42
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<
|
|
43
|
+
export const ToastDurations = () => {
|
|
44
|
+
return (
|
|
45
|
+
<Horizontal gap={10}>
|
|
46
|
+
<Button
|
|
47
|
+
onClick={() =>
|
|
48
|
+
Toast.info(
|
|
49
|
+
'Short Duration',
|
|
50
|
+
'This toast will disappear in 2 seconds.',
|
|
51
|
+
{
|
|
52
|
+
duration: 2000,
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
>
|
|
57
|
+
2 Seconds
|
|
58
|
+
</Button>
|
|
59
|
+
|
|
60
|
+
<Button
|
|
61
|
+
onClick={() =>
|
|
62
|
+
Toast.info(
|
|
63
|
+
'Default Duration',
|
|
64
|
+
'This toast will disappear in 5 seconds.'
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
>
|
|
68
|
+
5 Seconds (Default)
|
|
69
|
+
</Button>
|
|
70
|
+
|
|
71
|
+
<Button
|
|
72
|
+
onClick={() =>
|
|
73
|
+
Toast.info(
|
|
74
|
+
'Long Duration',
|
|
75
|
+
'This toast will disappear in 10 seconds.',
|
|
76
|
+
{
|
|
77
|
+
duration: 10000,
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
10 Seconds
|
|
83
|
+
</Button>
|
|
84
|
+
</Horizontal>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
151
87
|
```
|
|
152
88
|
|
|
153
|
-
### **Programmatic Control**
|
|
154
|
-
The Toast component can be controlled programmatically:
|
|
155
|
-
|
|
156
|
-
```tsx
|
|
157
|
-
// Show a toast and get its ID
|
|
158
|
-
const toastId = Toast.info('Hello', 'This is a toast message');
|
|
159
|
-
|
|
160
|
-
// Remove a specific toast
|
|
161
|
-
Toast.remove(toastId);
|
|
162
|
-
|
|
163
|
-
// Remove all toasts
|
|
164
|
-
Toast.removeAll();
|
|
165
|
-
```
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
# Toggle
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A versatile control allowing users to switch between two states, enabling or disabling features.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { Toggle } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
9
|
|
|
10
10
|
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import { Toggle } from '
|
|
13
|
+
import { Toggle } from '@app-studio/web';
|
|
14
14
|
|
|
15
15
|
export const DefaultDemo = () => {
|
|
16
16
|
return <Toggle>Default</Toggle>;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
18
|
```
|
|
20
19
|
|
|
21
20
|
### **shape**
|
|
22
|
-
Optional property to determine the shape of the toggle component.
|
|
21
|
+
Optional 'shape' property to determine the shape of the toggle component.
|
|
22
|
+
|
|
23
|
+
- **Type:** `string`
|
|
24
|
+
- **Default:** `rounded`
|
|
25
|
+
- **Possible Values:** `sharp, rounded, pillShaped`
|
|
23
26
|
|
|
24
27
|
```tsx
|
|
25
28
|
import React from 'react';
|
|
26
|
-
import { Horizontal } from '
|
|
27
|
-
import { Toggle } from '
|
|
28
|
-
import { Shape } from '
|
|
29
|
-
import { View } from '
|
|
29
|
+
import { Horizontal } from 'app-studio';
|
|
30
|
+
import { Toggle } from '@app-studio/web';
|
|
31
|
+
import { Shape } from '@app-studio/web';
|
|
32
|
+
import { View } from 'app-studio';
|
|
30
33
|
export const ShapeDemo = () => (
|
|
31
34
|
<Horizontal gap={15}>
|
|
32
35
|
{['sharp', 'rounded', 'pillShaped'].map((border, index) => (
|
|
@@ -36,15 +39,18 @@ export const ShapeDemo = () => (
|
|
|
36
39
|
))}
|
|
37
40
|
</Horizontal>
|
|
38
41
|
);
|
|
39
|
-
|
|
40
42
|
```
|
|
41
43
|
|
|
42
44
|
### **isToggled**
|
|
43
45
|
Optional boolean to define the initial toggle state.
|
|
44
46
|
|
|
47
|
+
- **Type:** `boolean`
|
|
48
|
+
- **Default:** `undefined`
|
|
49
|
+
- **Possible Values:** `true, false`
|
|
50
|
+
|
|
45
51
|
```tsx
|
|
46
52
|
import React from 'react';
|
|
47
|
-
import { Toggle } from '
|
|
53
|
+
import { Toggle } from '@app-studio/web';
|
|
48
54
|
|
|
49
55
|
export const IsToggledDemo = () => {
|
|
50
56
|
return (
|
|
@@ -53,30 +59,36 @@ export const IsToggledDemo = () => {
|
|
|
53
59
|
</Toggle>
|
|
54
60
|
);
|
|
55
61
|
};
|
|
56
|
-
|
|
57
62
|
```
|
|
58
63
|
|
|
59
64
|
### **isDisabled**
|
|
60
65
|
Optional boolean to set the toggle component as disabled or not.
|
|
61
66
|
|
|
67
|
+
- **Type:** `boolean`
|
|
68
|
+
- **Default:** `undefined`
|
|
69
|
+
- **Possible Values:** `true, false`
|
|
70
|
+
|
|
62
71
|
```tsx
|
|
63
72
|
import React from 'react';
|
|
64
|
-
import { Toggle } from '
|
|
73
|
+
import { Toggle } from '@app-studio/web';
|
|
65
74
|
|
|
66
75
|
export const IsDisabledDemo = () => {
|
|
67
76
|
return <Toggle isDisabled>IsDisabled</Toggle>;
|
|
68
77
|
};
|
|
69
|
-
|
|
70
78
|
```
|
|
71
79
|
|
|
72
80
|
### **variant**
|
|
73
|
-
Optional
|
|
81
|
+
Optional 'variant' to style the toggle component with predefined sets of visual types.
|
|
82
|
+
|
|
83
|
+
- **Type:** `string`
|
|
84
|
+
- **Default:** `ghost`
|
|
85
|
+
- **Possible Values:** `outline, link, ghost`
|
|
74
86
|
|
|
75
87
|
```tsx
|
|
76
88
|
import React from 'react';
|
|
77
|
-
import { Toggle } from '
|
|
78
|
-
import { Vertical } from '
|
|
79
|
-
import { Variant } from '
|
|
89
|
+
import { Toggle } from '@app-studio/web';
|
|
90
|
+
import { Vertical } from 'app-studio';
|
|
91
|
+
import { Variant } from '@app-studio/web';
|
|
80
92
|
|
|
81
93
|
export const VariantDemo = () => (
|
|
82
94
|
<Vertical gap={15}>
|
|
@@ -87,42 +99,19 @@ export const VariantDemo = () => (
|
|
|
87
99
|
))}
|
|
88
100
|
</Vertical>
|
|
89
101
|
);
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### **colorScheme**
|
|
94
|
-
Optional string to set the color scheme for the toggle component's appearance.
|
|
95
|
-
|
|
96
|
-
```tsx
|
|
97
|
-
import React from 'react';
|
|
98
|
-
import { Toggle } from '../Toggle';
|
|
99
|
-
import { Horizontal } from '@app-studio/web';
|
|
100
|
-
|
|
101
|
-
export const ColorSchemeDemo = () => (
|
|
102
|
-
<Horizontal gap={10}>
|
|
103
|
-
{[
|
|
104
|
-
'theme.primary',
|
|
105
|
-
'theme.secondary',
|
|
106
|
-
'theme.warning',
|
|
107
|
-
'theme.success',
|
|
108
|
-
'theme.error',
|
|
109
|
-
].map((color, index) => (
|
|
110
|
-
<Toggle key={index} colorScheme={color}>
|
|
111
|
-
{color}
|
|
112
|
-
</Toggle>
|
|
113
|
-
))}
|
|
114
|
-
</Horizontal>
|
|
115
|
-
);
|
|
116
|
-
|
|
117
102
|
```
|
|
118
103
|
|
|
119
104
|
### **onToggle**
|
|
120
105
|
Optional function that triggers when the toggle state changes, receives the new state as an argument.
|
|
121
106
|
|
|
107
|
+
- **Type:** `(isToggled: boolean) => void`
|
|
108
|
+
- **Default:** `undefined`
|
|
109
|
+
- **Possible Values:** `N/A`
|
|
110
|
+
|
|
122
111
|
```tsx
|
|
123
112
|
import React from 'react';
|
|
124
113
|
import { useState } from 'react';
|
|
125
|
-
import { Toggle } from '
|
|
114
|
+
import { Toggle } from '@app-studio/web';
|
|
126
115
|
|
|
127
116
|
export const OnToggleDemo = () => {
|
|
128
117
|
const [isToggle, setIsToggled] = useState(false);
|
|
@@ -136,6 +125,5 @@ export const OnToggleDemo = () => {
|
|
|
136
125
|
</Toggle>
|
|
137
126
|
);
|
|
138
127
|
};
|
|
139
|
-
|
|
140
128
|
```
|
|
141
129
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# ToggleGroup
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A group of toggle buttons allowing users to select one or more options.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { ToggleGroup } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
9
|
|
|
10
10
|
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import { ToggleGroup } from '
|
|
13
|
+
import { ToggleGroup } from '@app-studio/web';
|
|
14
14
|
|
|
15
15
|
export const DefaultDemo = () => {
|
|
16
16
|
const items = [
|
|
@@ -20,25 +20,28 @@ export const DefaultDemo = () => {
|
|
|
20
20
|
];
|
|
21
21
|
return <ToggleGroup items={items} />;
|
|
22
22
|
};
|
|
23
|
-
|
|
24
23
|
```
|
|
25
24
|
|
|
26
25
|
### **shape**
|
|
27
26
|
Optional shape prop to define the shape of toggle elements.
|
|
28
27
|
|
|
28
|
+
- **Type:** `string`
|
|
29
|
+
- **Default:** `rounded`
|
|
30
|
+
- **Possible Values:** `sharp, rounded, pillShaped`
|
|
31
|
+
|
|
29
32
|
```tsx
|
|
30
33
|
import React from 'react';
|
|
31
|
-
import { DustBinIcon } from '
|
|
32
|
-
import { ToggleGroup } from '
|
|
33
|
-
import { Shape } from '
|
|
34
|
-
import { Horizontal } from '
|
|
35
|
-
import { View } from '
|
|
34
|
+
import { DustBinIcon } from '@app-studio/web';
|
|
35
|
+
import { ToggleGroup } from '@app-studio/web';
|
|
36
|
+
import { Shape } from '@app-studio/web';
|
|
37
|
+
import { Horizontal } from 'app-studio';
|
|
38
|
+
import { View } from 'app-studio';
|
|
36
39
|
|
|
37
40
|
export const ShapeDemo = () => {
|
|
38
41
|
const items = [
|
|
39
42
|
{
|
|
40
43
|
id: 'item',
|
|
41
|
-
value: <DustBinIcon
|
|
44
|
+
value: <DustBinIcon widthHeight={18} />,
|
|
42
45
|
isActive: true,
|
|
43
46
|
},
|
|
44
47
|
];
|
|
@@ -52,16 +55,19 @@ export const ShapeDemo = () => {
|
|
|
52
55
|
</Horizontal>
|
|
53
56
|
);
|
|
54
57
|
};
|
|
55
|
-
|
|
56
58
|
```
|
|
57
59
|
|
|
58
60
|
### **items**
|
|
59
61
|
Mandatory array of items defining each toggle in the group.
|
|
60
62
|
|
|
63
|
+
- **Type:** `array`
|
|
64
|
+
- **Default:** `undefined`
|
|
65
|
+
- **Possible Values:** `ToggleItem[]`
|
|
66
|
+
|
|
61
67
|
```tsx
|
|
62
68
|
import React from 'react';
|
|
63
|
-
import { ToggleGroup } from '
|
|
64
|
-
import { Text } from '
|
|
69
|
+
import { ToggleGroup } from '@app-studio/web';
|
|
70
|
+
import { Text } from 'app-studio';
|
|
65
71
|
|
|
66
72
|
export const ItemsDemo = () => {
|
|
67
73
|
const items = [
|
|
@@ -71,18 +77,21 @@ export const ItemsDemo = () => {
|
|
|
71
77
|
];
|
|
72
78
|
return <ToggleGroup items={items} />;
|
|
73
79
|
};
|
|
74
|
-
|
|
75
80
|
```
|
|
76
81
|
|
|
77
82
|
### **variant**
|
|
78
83
|
Optional variant prop to specify the visual style of the toggle group.
|
|
79
84
|
|
|
85
|
+
- **Type:** `string`
|
|
86
|
+
- **Default:** `ghost`
|
|
87
|
+
- **Possible Values:** `outline, link, ghost`
|
|
88
|
+
|
|
80
89
|
```tsx
|
|
81
90
|
import React from 'react';
|
|
82
|
-
import { Text } from '
|
|
83
|
-
import { ToggleGroup } from '
|
|
84
|
-
import { Variant } from '
|
|
85
|
-
import { Vertical } from '
|
|
91
|
+
import { Text } from 'app-studio';
|
|
92
|
+
import { ToggleGroup } from '@app-studio/web';
|
|
93
|
+
import { Variant } from '@app-studio/web';
|
|
94
|
+
import { Vertical } from 'app-studio';
|
|
86
95
|
|
|
87
96
|
export const VariantDemo = () => {
|
|
88
97
|
const items = [
|
|
@@ -98,49 +107,20 @@ export const VariantDemo = () => {
|
|
|
98
107
|
</Vertical>
|
|
99
108
|
);
|
|
100
109
|
};
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### **colorScheme**
|
|
105
|
-
Optional colorScheme prop for theming the toggle group.
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
import React from 'react';
|
|
109
|
-
import { ToggleGroup } from '../ToggleGroup';
|
|
110
|
-
import { Vertical } from '@app-studio/web';
|
|
111
|
-
import { Text } from '@app-studio/web';
|
|
112
|
-
|
|
113
|
-
export const ColorSchemeDemo = () => {
|
|
114
|
-
const items = [
|
|
115
|
-
{ id: 'B', value: <Text>B</Text> },
|
|
116
|
-
{ id: 'C', value: <Text>C</Text>, isActive: true },
|
|
117
|
-
{ id: 'D', value: <Text>D</Text>, isDisabled: true },
|
|
118
|
-
];
|
|
119
|
-
return (
|
|
120
|
-
<Vertical gap={10}>
|
|
121
|
-
{[
|
|
122
|
-
'theme.primary',
|
|
123
|
-
'theme.secondary',
|
|
124
|
-
'theme.warning',
|
|
125
|
-
'theme.success',
|
|
126
|
-
'theme.error',
|
|
127
|
-
].map((color, index) => (
|
|
128
|
-
<ToggleGroup key={index} items={items} colorScheme={color} />
|
|
129
|
-
))}
|
|
130
|
-
</Vertical>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
110
|
```
|
|
135
111
|
|
|
136
112
|
### **onToggleChange**
|
|
137
113
|
Optional callback function that fires when the active toggle changes, providing the IDs of active toggles.
|
|
138
114
|
|
|
115
|
+
- **Type:** `function`
|
|
116
|
+
- **Default:** `undefined`
|
|
117
|
+
- **Possible Values:** `(activeIds: string[]) => void`
|
|
118
|
+
|
|
139
119
|
```tsx
|
|
140
120
|
import React, { useState } from 'react';
|
|
141
|
-
import { ToggleGroup } from '
|
|
142
|
-
import { Text } from '
|
|
143
|
-
import { Vertical } from '
|
|
121
|
+
import { ToggleGroup } from '@app-studio/web';
|
|
122
|
+
import { Text } from 'app-studio';
|
|
123
|
+
import { Vertical } from 'app-studio';
|
|
144
124
|
|
|
145
125
|
export const OnToggleChangeDemo = () => {
|
|
146
126
|
const [newItems, setNewItems] = useState<any>([]);
|
|
@@ -160,6 +140,5 @@ export const OnToggleChangeDemo = () => {
|
|
|
160
140
|
</Vertical>
|
|
161
141
|
);
|
|
162
142
|
};
|
|
163
|
-
|
|
164
143
|
```
|
|
165
144
|
|