@adamosuiteservices/ui 1.2.5 → 1.4.5
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/accordion-rounded.cjs +1 -1
- package/dist/accordion-rounded.js +1 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.cjs +1 -0
- package/dist/breadcrumb.js +105 -0
- package/dist/{button-C1n6snOY.js → button-2GdKenQI.js} +1 -1
- package/dist/{button-BV-_FVKZ.cjs → button-DEQVHMrX.cjs} +1 -1
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.js +2 -2
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{checkbox-BrmXPKTn.js → checkbox-Dr487kAg.js} +3 -3
- package/dist/{checkbox-Lq-HvSgc.cjs → checkbox-YWAnswaW.cjs} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.js +1 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +6 -6
- package/dist/components/layout/sidebar/sidebar.d.ts +7 -3
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb/breadcrumb.stories.d.ts +26 -0
- package/dist/components/ui/breadcrumb/index.d.ts +1 -0
- package/dist/components/ui/button/button.d.ts +2 -2
- package/dist/components/ui/dialog/dialog.d.ts +2 -1
- package/dist/components/ui/input-group/input-group.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/typography/typography.d.ts +1 -1
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.js +2 -2
- package/dist/custom-layered-styles.css +1 -1
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +33 -19
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +3 -3
- package/dist/ellipsis-CryjZKZn.js +15 -0
- package/dist/ellipsis-Ct9VTDOG.cjs +6 -0
- package/dist/field.cjs +1 -1
- package/dist/field.js +2 -2
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +6 -6
- package/dist/{index-CAOY367Y.js → index-B0M7VOwp.js} +2 -2
- package/dist/{index-B-ZRqW0J.js → index-BBoIAjAs.js} +3 -3
- package/dist/{index-gO_QEiaK.cjs → index-BDs8lUfq.cjs} +1 -1
- package/dist/index-BFyr34mw.cjs +5 -0
- package/dist/index-BMWt1NBG.js +79 -0
- package/dist/{index-yR-v1A4G.js → index-BX9hz-JD.js} +1 -1
- package/dist/{index-BGiGvaq8.cjs → index-BcGMAmWE.cjs} +1 -1
- package/dist/{index-IKJMQref.cjs → index-Bd0gQB0k.cjs} +1 -1
- package/dist/{index-VIUqZjyP.cjs → index-BeWgla7c.cjs} +1 -1
- package/dist/{index-EUea2gfp.js → index-BpWB3aFK.js} +1 -1
- package/dist/index-BvLQnI56.js +59 -0
- package/dist/{index-CwUFT-GQ.js → index-C0YiLSjW.js} +4 -4
- package/dist/{index-o0sNTcKe.js → index-CBjZooac.js} +2 -2
- package/dist/{index-DnS_sBBe.cjs → index-COuvjZLM.cjs} +1 -1
- package/dist/index-CTjlbbt9.cjs +1 -0
- package/dist/index-CUWMxxKG.js +97 -0
- package/dist/{index-C329e3yQ.js → index-CZZ3llmi.js} +2 -2
- package/dist/index-CjyiloO7.cjs +1 -0
- package/dist/{index-D3wSWKST.cjs → index-Cmx9M9cZ.cjs} +1 -1
- package/dist/index-CocSS1YK.cjs +1 -0
- package/dist/index-CzRiuk60.cjs +1 -0
- package/dist/index-DFPDUUq7.js +658 -0
- package/dist/{index-D3S7dBDI.cjs → index-DIwmXz1u.cjs} +1 -1
- package/dist/index-DLcqcWxM.js +29 -0
- package/dist/index-DMLQL2aG.js +286 -0
- package/dist/{index-DXQ-7kNJ.cjs → index-DMs8RL3E.cjs} +1 -1
- package/dist/{index-Ce3QBKyj.cjs → index-Dbj9vHNq.cjs} +1 -1
- package/dist/{index-BRLtxFFr.cjs → index-DmGzwG2z.cjs} +1 -1
- package/dist/{index-P1sVIHE3.js → index-PYkEXTqJ.js} +1 -1
- package/dist/{index-DulPG3F9.js → index-Se4vRnIO.js} +3 -3
- package/dist/index-_XxjJPRD.cjs +1 -0
- package/dist/{index-B-cHTKrs.js → index-yWvyIlmA.js} +4 -4
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +1 -1
- package/dist/{label-Cne2J57f.cjs → label-BjXORCBM.cjs} +1 -1
- package/dist/{label-Ky8qBEC3.js → label-CmwGvhy1.js} +1 -1
- package/dist/label.cjs +1 -1
- package/dist/label.js +1 -1
- package/dist/pagination.cjs +1 -6
- package/dist/pagination.js +58 -69
- package/dist/popover-3rIoNCXs.js +306 -0
- package/dist/popover-FCKBtFo-.cjs +1 -0
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +5 -5
- package/dist/select.cjs +2 -2
- package/dist/select.js +585 -542
- package/dist/{separator-CGnu_jIu.cjs → separator-BaZqZZ9R.cjs} +1 -1
- package/dist/{separator-BH73A90k.js → separator-DR7lQjv9.js} +1 -1
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +1 -1
- package/dist/{sheet-CcxnJ6LH.cjs → sheet-CU-sFSaJ.cjs} +1 -1
- package/dist/{sheet-_DVpQIVF.js → sheet-UZWAbdXr.js} +1 -1
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.cjs +2 -2
- package/dist/sidebar.js +89 -78
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +3 -3
- package/dist/styles.css +1 -1
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +2 -2
- package/dist/tabs-underline.cjs +1 -1
- package/dist/tabs-underline.js +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/toaster.cjs +1 -1
- package/dist/toaster.js +1 -1
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +114 -108
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/docs/AI-GUIDE.md +321 -0
- package/docs/components/layout/sidebar.md +404 -0
- package/docs/components/layout/toaster.md +436 -0
- package/docs/components/ui/accordion-rounded.md +583 -0
- package/docs/components/ui/accordion.md +267 -0
- package/docs/components/ui/alert.md +671 -0
- package/docs/components/ui/avatar.md +588 -0
- package/docs/components/ui/badge.md +1024 -0
- package/docs/components/ui/breadcrumb.md +614 -0
- package/docs/components/ui/button-group.md +1002 -0
- package/docs/components/ui/button.md +1078 -0
- package/docs/components/ui/calendar.md +1159 -0
- package/docs/components/ui/card.md +1265 -0
- package/docs/components/ui/checkbox.md +292 -0
- package/docs/components/ui/collapsible.md +320 -0
- package/docs/components/ui/combobox.md +328 -0
- package/docs/components/ui/command.md +454 -0
- package/docs/components/ui/context-menu.md +540 -0
- package/docs/components/ui/dialog.md +628 -0
- package/docs/components/ui/dropdown-menu.md +731 -0
- package/docs/components/ui/field.md +706 -0
- package/docs/components/ui/hover-card.md +446 -0
- package/docs/components/ui/input-group.md +509 -0
- package/docs/components/ui/input.md +362 -0
- package/docs/components/ui/kbd.md +434 -0
- package/docs/components/ui/label.md +359 -0
- package/docs/components/ui/pagination.md +650 -0
- package/docs/components/ui/popover.md +536 -0
- package/docs/components/ui/progress.md +182 -0
- package/docs/components/ui/radio-group.md +311 -0
- package/docs/components/ui/select.md +352 -0
- package/docs/components/ui/separator.md +214 -0
- package/docs/components/ui/sheet.md +142 -0
- package/docs/components/ui/skeleton.md +140 -0
- package/docs/components/ui/slider.md +341 -0
- package/docs/components/ui/spinner.md +170 -0
- package/docs/components/ui/switch.md +402 -0
- package/docs/components/ui/table.md +183 -0
- package/docs/components/ui/tabs-underline.md +106 -0
- package/docs/components/ui/tabs.md +122 -0
- package/docs/components/ui/textarea.md +243 -0
- package/docs/components/ui/toggle.md +243 -0
- package/docs/components/ui/tooltip.md +320 -0
- package/docs/components/ui/typography.md +191 -0
- package/package.json +11 -5
- package/dist/index-6oTEokEx.js +0 -82
- package/dist/index-B-NyefE0.js +0 -243
- package/dist/index-BKbK2GzY.cjs +0 -1
- package/dist/index-BMitW9UR.cjs +0 -1
- package/dist/index-BpvjJ_T6.cjs +0 -5
- package/dist/index-C5wjudc-.js +0 -36
- package/dist/index-CezwiPd_.js +0 -615
- package/dist/index-D02K8KOB.js +0 -54
- package/dist/index-D7hQvndv.cjs +0 -1
- package/dist/index-DQvx1rG_.cjs +0 -1
- package/dist/popover-BjdTqaB8.cjs +0 -1
- package/dist/popover-EnVfE0YA.js +0 -263
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
Toggle binario on/off. Basado en Radix UI con animación de thumb.
|
|
4
|
+
|
|
5
|
+
## Descripción
|
|
6
|
+
|
|
7
|
+
El componente `Switch` es un control de toggle que representa un estado booleano (on/off).
|
|
8
|
+
|
|
9
|
+
## Importación
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Switch } from "@adamosuiteservices/ui/switch";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Anatomía
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
<Switch />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Componentes**: 1 (Switch) con thumb interno
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
| Prop | Tipo | Descripción |
|
|
26
|
+
| ----------------- | ---------------------------- | ----------------------------- |
|
|
27
|
+
| `defaultChecked` | `boolean` | Estado inicial (uncontrolled) |
|
|
28
|
+
| `checked` | `boolean` | Estado controlado |
|
|
29
|
+
| `onCheckedChange` | `(checked: boolean) => void` | Callback al cambiar |
|
|
30
|
+
| `disabled` | `boolean` | Deshabilita el switch |
|
|
31
|
+
| `required` | `boolean` | Campo requerido |
|
|
32
|
+
| `name` | `string` | Nombre (formularios) |
|
|
33
|
+
| `value` | `string` | Valor (formularios) |
|
|
34
|
+
| `id` | `string` | ID para asociar con Label |
|
|
35
|
+
| `className` | `string` | Clases CSS adicionales |
|
|
36
|
+
|
|
37
|
+
**Nota**: Acepta todas las props de Radix UI Switch.Root
|
|
38
|
+
|
|
39
|
+
## Patrones de Uso
|
|
40
|
+
|
|
41
|
+
### Básico
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { Switch } from "@adamosuiteservices/ui/switch";
|
|
45
|
+
|
|
46
|
+
<Switch />;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Con Label
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { Label } from "@adamosuiteservices/ui/label";
|
|
53
|
+
|
|
54
|
+
<div className="flex items-center space-x-2">
|
|
55
|
+
<Switch id="airplane-mode" />
|
|
56
|
+
<Label htmlFor="airplane-mode">Airplane Mode</Label>
|
|
57
|
+
</div>;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Controlado
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { useState } from "react";
|
|
64
|
+
|
|
65
|
+
function App() {
|
|
66
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div className="flex items-center space-x-2">
|
|
70
|
+
<Switch
|
|
71
|
+
id="controlled-switch"
|
|
72
|
+
checked={isChecked}
|
|
73
|
+
onCheckedChange={setIsChecked}
|
|
74
|
+
/>
|
|
75
|
+
<Label htmlFor="controlled-switch">
|
|
76
|
+
Notifications {isChecked ? "enabled" : "disabled"}
|
|
77
|
+
</Label>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Con Iconos y Badges
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { BellIcon, MoonIcon, WifiIcon } from "lucide-react";
|
|
87
|
+
import { Badge } from "@adamosuiteservices/ui/badge";
|
|
88
|
+
|
|
89
|
+
function Settings() {
|
|
90
|
+
const [settings, setSettings] = useState({
|
|
91
|
+
notifications: true,
|
|
92
|
+
darkMode: false,
|
|
93
|
+
wifi: true,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div className="space-y-4">
|
|
98
|
+
<div className="flex items-center space-x-3">
|
|
99
|
+
<BellIcon className="size-4 text-muted-foreground" />
|
|
100
|
+
<Switch
|
|
101
|
+
checked={settings.notifications}
|
|
102
|
+
onCheckedChange={(checked) =>
|
|
103
|
+
setSettings((prev) => ({ ...prev, notifications: checked }))
|
|
104
|
+
}
|
|
105
|
+
/>
|
|
106
|
+
<Label>Notifications</Label>
|
|
107
|
+
<Badge variant={settings.notifications ? "default" : "secondary"}>
|
|
108
|
+
{settings.notifications ? "On" : "Off"}
|
|
109
|
+
</Badge>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div className="flex items-center space-x-3">
|
|
113
|
+
<MoonIcon className="size-4 text-muted-foreground" />
|
|
114
|
+
<Switch
|
|
115
|
+
checked={settings.darkMode}
|
|
116
|
+
onCheckedChange={(checked) =>
|
|
117
|
+
setSettings((prev) => ({ ...prev, darkMode: checked }))
|
|
118
|
+
}
|
|
119
|
+
/>
|
|
120
|
+
<Label>Dark Mode</Label>
|
|
121
|
+
<Badge variant={settings.darkMode ? "default" : "secondary"}>
|
|
122
|
+
{settings.darkMode ? "On" : "Off"}
|
|
123
|
+
</Badge>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Device Controls
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import {
|
|
134
|
+
Card,
|
|
135
|
+
CardContent,
|
|
136
|
+
CardDescription,
|
|
137
|
+
CardHeader,
|
|
138
|
+
CardTitle,
|
|
139
|
+
} from "@adamosuiteservices/ui/card";
|
|
140
|
+
import { AirplayIcon, WifiIcon, BluetoothIcon } from "lucide-react";
|
|
141
|
+
|
|
142
|
+
function ControlCenter() {
|
|
143
|
+
const [deviceSettings, setDeviceSettings] = useState({
|
|
144
|
+
airplaneMode: false,
|
|
145
|
+
wifi: true,
|
|
146
|
+
bluetooth: false,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const updateSetting = (key: keyof typeof deviceSettings) => {
|
|
150
|
+
setDeviceSettings((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<Card className="w-full max-w-sm">
|
|
155
|
+
<CardHeader>
|
|
156
|
+
<CardTitle>Control Center</CardTitle>
|
|
157
|
+
<CardDescription>Quick access to device settings</CardDescription>
|
|
158
|
+
</CardHeader>
|
|
159
|
+
<CardContent className="space-y-4">
|
|
160
|
+
<div className="grid grid-cols-2 gap-4">
|
|
161
|
+
<div className="flex flex-col items-center space-y-2 p-3 border rounded-lg">
|
|
162
|
+
<AirplayIcon className="size-6 text-muted-foreground" />
|
|
163
|
+
<span className="text-sm font-medium">Airplane</span>
|
|
164
|
+
<Switch
|
|
165
|
+
checked={deviceSettings.airplaneMode}
|
|
166
|
+
onCheckedChange={() => updateSetting("airplaneMode")}
|
|
167
|
+
className="scale-75"
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div className="flex flex-col items-center space-y-2 p-3 border rounded-lg">
|
|
172
|
+
<WifiIcon className="size-6 text-muted-foreground" />
|
|
173
|
+
<span className="text-sm font-medium">Wi-Fi</span>
|
|
174
|
+
<Switch
|
|
175
|
+
checked={deviceSettings.wifi}
|
|
176
|
+
onCheckedChange={() => updateSetting("wifi")}
|
|
177
|
+
className="scale-75"
|
|
178
|
+
/>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div className="flex flex-col items-center space-y-2 p-3 border rounded-lg">
|
|
182
|
+
<BluetoothIcon className="size-6 text-muted-foreground" />
|
|
183
|
+
<span className="text-sm font-medium">Bluetooth</span>
|
|
184
|
+
<Switch
|
|
185
|
+
checked={deviceSettings.bluetooth}
|
|
186
|
+
onCheckedChange={() => updateSetting("bluetooth")}
|
|
187
|
+
className="scale-75"
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</CardContent>
|
|
192
|
+
</Card>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Privacy Settings
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import { ShieldIcon } from "lucide-react";
|
|
201
|
+
import { Button } from "@adamosuiteservices/ui/button";
|
|
202
|
+
|
|
203
|
+
function PrivacySettings() {
|
|
204
|
+
const [privacySettings, setPrivacySettings] = useState({
|
|
205
|
+
locationServices: true,
|
|
206
|
+
analyticsData: false,
|
|
207
|
+
crashReports: true,
|
|
208
|
+
personalizedAds: false,
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<Card className="w-full max-w-lg">
|
|
213
|
+
<CardHeader>
|
|
214
|
+
<CardTitle className="flex items-center space-x-2">
|
|
215
|
+
<ShieldIcon className="size-5" />
|
|
216
|
+
<span>Privacy & Security</span>
|
|
217
|
+
</CardTitle>
|
|
218
|
+
<CardDescription>
|
|
219
|
+
Control how your data is collected and used
|
|
220
|
+
</CardDescription>
|
|
221
|
+
</CardHeader>
|
|
222
|
+
<CardContent className="space-y-6">
|
|
223
|
+
<div className="space-y-4">
|
|
224
|
+
<div className="flex items-start justify-between space-x-4">
|
|
225
|
+
<div className="flex-1">
|
|
226
|
+
<Label className="text-sm font-medium">Location Services</Label>
|
|
227
|
+
<p className="text-xs text-muted-foreground mt-1">
|
|
228
|
+
Allow apps to access your location for personalized experiences
|
|
229
|
+
</p>
|
|
230
|
+
</div>
|
|
231
|
+
<Switch
|
|
232
|
+
checked={privacySettings.locationServices}
|
|
233
|
+
onCheckedChange={(checked) =>
|
|
234
|
+
setPrivacySettings((prev) => ({
|
|
235
|
+
...prev,
|
|
236
|
+
locationServices: checked,
|
|
237
|
+
}))
|
|
238
|
+
}
|
|
239
|
+
/>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
<div className="flex items-start justify-between space-x-4">
|
|
243
|
+
<div className="flex-1">
|
|
244
|
+
<Label className="text-sm font-medium">
|
|
245
|
+
Analytics & Diagnostics
|
|
246
|
+
</Label>
|
|
247
|
+
<p className="text-xs text-muted-foreground mt-1">
|
|
248
|
+
Share analytics data to help improve our products
|
|
249
|
+
</p>
|
|
250
|
+
</div>
|
|
251
|
+
<Switch
|
|
252
|
+
checked={privacySettings.analyticsData}
|
|
253
|
+
onCheckedChange={(checked) =>
|
|
254
|
+
setPrivacySettings((prev) => ({
|
|
255
|
+
...prev,
|
|
256
|
+
analyticsData: checked,
|
|
257
|
+
}))
|
|
258
|
+
}
|
|
259
|
+
/>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<div className="flex justify-end space-x-2 pt-4 border-t">
|
|
264
|
+
<Button variant="outline" size="sm">
|
|
265
|
+
Reset to Defaults
|
|
266
|
+
</Button>
|
|
267
|
+
<Button size="sm">Save Changes</Button>
|
|
268
|
+
</div>
|
|
269
|
+
</CardContent>
|
|
270
|
+
</Card>
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Feature Toggles
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
function FeatureToggles() {
|
|
279
|
+
const [features, setFeatures] = useState({
|
|
280
|
+
newDashboard: false,
|
|
281
|
+
betaFeatures: false,
|
|
282
|
+
experimentalUI: false,
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const updateFeature = (key: keyof typeof features) => {
|
|
286
|
+
setFeatures((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
return (
|
|
290
|
+
<Card className="w-full max-w-lg">
|
|
291
|
+
<CardHeader>
|
|
292
|
+
<CardTitle>Feature Toggles</CardTitle>
|
|
293
|
+
<CardDescription>
|
|
294
|
+
Enable or disable experimental features
|
|
295
|
+
</CardDescription>
|
|
296
|
+
</CardHeader>
|
|
297
|
+
<CardContent className="space-y-4">
|
|
298
|
+
<div className="flex items-start justify-between space-x-4 p-3 border rounded-lg">
|
|
299
|
+
<div className="flex-1 space-y-1">
|
|
300
|
+
<div className="flex items-center space-x-2">
|
|
301
|
+
<Label className="text-sm font-medium">New Dashboard</Label>
|
|
302
|
+
<Badge variant="default" className="text-xs">
|
|
303
|
+
New
|
|
304
|
+
</Badge>
|
|
305
|
+
</div>
|
|
306
|
+
<p className="text-xs text-muted-foreground">
|
|
307
|
+
Try our redesigned dashboard interface
|
|
308
|
+
</p>
|
|
309
|
+
</div>
|
|
310
|
+
<Switch
|
|
311
|
+
checked={features.newDashboard}
|
|
312
|
+
onCheckedChange={() => updateFeature("newDashboard")}
|
|
313
|
+
/>
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
<div className="flex items-start justify-between space-x-4 p-3 border rounded-lg">
|
|
317
|
+
<div className="flex-1 space-y-1">
|
|
318
|
+
<div className="flex items-center space-x-2">
|
|
319
|
+
<Label className="text-sm font-medium">Beta Features</Label>
|
|
320
|
+
<Badge variant="secondary" className="text-xs">
|
|
321
|
+
Beta
|
|
322
|
+
</Badge>
|
|
323
|
+
</div>
|
|
324
|
+
<p className="text-xs text-muted-foreground">
|
|
325
|
+
Access features currently in beta testing
|
|
326
|
+
</p>
|
|
327
|
+
</div>
|
|
328
|
+
<Switch
|
|
329
|
+
checked={features.betaFeatures}
|
|
330
|
+
onCheckedChange={() => updateFeature("betaFeatures")}
|
|
331
|
+
/>
|
|
332
|
+
</div>
|
|
333
|
+
</CardContent>
|
|
334
|
+
</Card>
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Deshabilitado
|
|
340
|
+
|
|
341
|
+
```tsx
|
|
342
|
+
<div className="space-y-4">
|
|
343
|
+
<div className="flex items-center space-x-2">
|
|
344
|
+
<Switch disabled />
|
|
345
|
+
<Label className="text-muted-foreground">Disabled (off)</Label>
|
|
346
|
+
</div>
|
|
347
|
+
<div className="flex items-center space-x-2">
|
|
348
|
+
<Switch disabled checked />
|
|
349
|
+
<Label className="text-muted-foreground">Disabled (on)</Label>
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Casos de Uso
|
|
355
|
+
|
|
356
|
+
**Settings**: On/off toggles para configuración
|
|
357
|
+
**Feature flags**: Activar/desactivar features
|
|
358
|
+
**Notifications**: Habilitar/deshabilitar notificaciones
|
|
359
|
+
**Privacy**: Controles de privacidad y permisos
|
|
360
|
+
**Device controls**: Wi-Fi, Bluetooth, Airplane mode
|
|
361
|
+
**Filters**: Mostrar/ocultar contenido
|
|
362
|
+
|
|
363
|
+
## Estilos Base
|
|
364
|
+
|
|
365
|
+
- **Size**: `h-5 w-8`
|
|
366
|
+
- **Checked bg**: `bg-primary`
|
|
367
|
+
- **Unchecked bg**: `bg-input` (dark: `bg-input/80`)
|
|
368
|
+
- **Thumb**: `size-4` con `bg-background`
|
|
369
|
+
- **Thumb checked**: `translate-x-[calc(100%-2px)]`
|
|
370
|
+
- **Thumb unchecked**: `translate-x-0`
|
|
371
|
+
- **Focus**: `ring-ring/50` con `ring-[3px]`
|
|
372
|
+
- **Transition**: `transition-all` en thumb y background
|
|
373
|
+
|
|
374
|
+
## Accesibilidad
|
|
375
|
+
|
|
376
|
+
- ✅ **Role**: `role="switch"` con `aria-checked`
|
|
377
|
+
- ✅ **Keyboard**: Space/Enter para toggle
|
|
378
|
+
- ✅ **Focus**: Focus ring visible
|
|
379
|
+
- ✅ **Label**: Asociar con `htmlFor` e `id`
|
|
380
|
+
- ✅ **State**: Screen readers anuncian checked/unchecked
|
|
381
|
+
|
|
382
|
+
## Notas de Implementación
|
|
383
|
+
|
|
384
|
+
- **Radix UI**: Basado en `@radix-ui/react-switch`
|
|
385
|
+
- **Peer class**: Usa `peer` para estilos relacionados con Label
|
|
386
|
+
- **Data states**: `data-state="checked|unchecked"` para estilos
|
|
387
|
+
- **Controlled**: Usa `checked` + `onCheckedChange`
|
|
388
|
+
- **Uncontrolled**: Usa `defaultChecked`
|
|
389
|
+
- **Dark mode**: Thumb color cambia automáticamente
|
|
390
|
+
|
|
391
|
+
## Troubleshooting
|
|
392
|
+
|
|
393
|
+
**No cambia estado**: En modo controlado usa `checked` + `onCheckedChange`, no `defaultChecked`
|
|
394
|
+
**Label no clickeable**: Asegura `htmlFor` en Label coincida con `id` del Switch
|
|
395
|
+
**Thumb no anima**: Verifica que estilos de `transition-transform` no estén sobrescritos
|
|
396
|
+
**Color incorrecto**: Switch usa `bg-primary` checked, `bg-input` unchecked
|
|
397
|
+
**Disabled no funciona**: Prop `disabled` deshabilita interacción
|
|
398
|
+
|
|
399
|
+
## Referencias
|
|
400
|
+
|
|
401
|
+
- **Radix UI Switch**: <https://www.radix-ui.com/primitives/docs/components/switch>
|
|
402
|
+
- **shadcn/ui Switch**: <https://ui.shadcn.com/docs/components/switch>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
Tabla HTML semántica con estilos. 8 componentes para estructura completa.
|
|
4
|
+
|
|
5
|
+
## Descripción
|
|
6
|
+
|
|
7
|
+
El componente `Table` muestra datos en formato tabular.
|
|
8
|
+
|
|
9
|
+
## Importación
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import {
|
|
13
|
+
Table,
|
|
14
|
+
TableBody,
|
|
15
|
+
TableCaption,
|
|
16
|
+
TableCell,
|
|
17
|
+
TableHead,
|
|
18
|
+
TableHeader,
|
|
19
|
+
TableRow,
|
|
20
|
+
TableFooter,
|
|
21
|
+
} from "@adamosuiteservices/ui/table";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Anatomía
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<Table>
|
|
28
|
+
<TableCaption>A list of your recent invoices.</TableCaption>
|
|
29
|
+
<TableHeader>
|
|
30
|
+
<TableRow>
|
|
31
|
+
<TableHead>Invoice</TableHead>
|
|
32
|
+
<TableHead>Status</TableHead>
|
|
33
|
+
<TableHead>Method</TableHead>
|
|
34
|
+
<TableHead className="text-right">Amount</TableHead>
|
|
35
|
+
</TableRow>
|
|
36
|
+
</TableHeader>
|
|
37
|
+
<TableBody>
|
|
38
|
+
<TableRow>
|
|
39
|
+
<TableCell className="font-medium">INV001</TableCell>
|
|
40
|
+
<TableCell>Paid</TableCell>
|
|
41
|
+
<TableCell>Credit Card</TableCell>
|
|
42
|
+
<TableCell className="text-right">$250.00</TableCell>
|
|
43
|
+
</TableRow>
|
|
44
|
+
</TableBody>
|
|
45
|
+
<TableFooter>
|
|
46
|
+
<TableRow>
|
|
47
|
+
<TableCell colSpan={3}>Total</TableCell>
|
|
48
|
+
<TableCell className="text-right">$2,500.00</TableCell>
|
|
49
|
+
</TableRow>
|
|
50
|
+
</TableFooter>
|
|
51
|
+
</Table>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Componentes**: 8 (Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption)
|
|
55
|
+
|
|
56
|
+
## Props
|
|
57
|
+
|
|
58
|
+
Todos los componentes aceptan sus props HTML estándar más `className` para personalización.
|
|
59
|
+
|
|
60
|
+
## Patrones de Uso
|
|
61
|
+
|
|
62
|
+
### Tabla Simple
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<Table>
|
|
66
|
+
<TableHeader>
|
|
67
|
+
<TableRow>
|
|
68
|
+
<TableHead>Invoice</TableHead>
|
|
69
|
+
<TableHead>Status</TableHead>
|
|
70
|
+
<TableHead>Amount</TableHead>
|
|
71
|
+
</TableRow>
|
|
72
|
+
</TableHeader>
|
|
73
|
+
<TableBody>
|
|
74
|
+
<TableRow>
|
|
75
|
+
<TableCell>INV001</TableCell>
|
|
76
|
+
<TableCell>Paid</TableCell>
|
|
77
|
+
<TableCell>$250.00</TableCell>
|
|
78
|
+
</TableRow>
|
|
79
|
+
<TableRow>
|
|
80
|
+
<TableCell>INV002</TableCell>
|
|
81
|
+
<TableCell>Pending</TableCell>
|
|
82
|
+
<TableCell>$150.00</TableCell>
|
|
83
|
+
</TableRow>
|
|
84
|
+
</TableBody>
|
|
85
|
+
</Table>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Con Footer
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<Table>
|
|
92
|
+
<TableHeader>
|
|
93
|
+
<TableRow>
|
|
94
|
+
<TableHead>Item</TableHead>
|
|
95
|
+
<TableHead>Quantity</TableHead>
|
|
96
|
+
<TableHead className="text-right">Price</TableHead>
|
|
97
|
+
</TableRow>
|
|
98
|
+
</TableHeader>
|
|
99
|
+
<TableBody>
|
|
100
|
+
<TableRow>
|
|
101
|
+
<TableCell>Product A</TableCell>
|
|
102
|
+
<TableCell>10</TableCell>
|
|
103
|
+
<TableCell className="text-right">$100.00</TableCell>
|
|
104
|
+
</TableRow>
|
|
105
|
+
</TableBody>
|
|
106
|
+
<TableFooter>
|
|
107
|
+
<TableRow>
|
|
108
|
+
<TableCell colSpan={2}>Total</TableCell>
|
|
109
|
+
<TableCell className="text-right">$2,500.00</TableCell>
|
|
110
|
+
</TableRow>
|
|
111
|
+
</TableFooter>
|
|
112
|
+
</Table>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Con Caption
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
<Table>
|
|
119
|
+
<TableCaption>A list of your recent invoices.</TableCaption>
|
|
120
|
+
<TableHeader>
|
|
121
|
+
<TableRow>
|
|
122
|
+
<TableHead>Invoice</TableHead>
|
|
123
|
+
<TableHead>Status</TableHead>
|
|
124
|
+
<TableHead>Amount</TableHead>
|
|
125
|
+
</TableRow>
|
|
126
|
+
</TableHeader>
|
|
127
|
+
<TableBody>
|
|
128
|
+
<TableRow>
|
|
129
|
+
<TableCell>INV001</TableCell>
|
|
130
|
+
<TableCell>Paid</TableCell>
|
|
131
|
+
<TableCell>$250.00</TableCell>
|
|
132
|
+
</TableRow>
|
|
133
|
+
</TableBody>
|
|
134
|
+
</Table>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Con Datos Dinámicos
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
const invoices = [
|
|
141
|
+
{ id: "INV001", status: "Paid", method: "Credit Card", amount: "$250.00" },
|
|
142
|
+
{ id: "INV002", status: "Pending", method: "PayPal", amount: "$150.00" },
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
<Table>
|
|
146
|
+
<TableHeader>
|
|
147
|
+
<TableRow>
|
|
148
|
+
<TableHead>Invoice</TableHead>
|
|
149
|
+
<TableHead>Status</TableHead>
|
|
150
|
+
<TableHead>Method</TableHead>
|
|
151
|
+
<TableHead className="text-right">Amount</TableHead>
|
|
152
|
+
</TableRow>
|
|
153
|
+
</TableHeader>
|
|
154
|
+
<TableBody>
|
|
155
|
+
{invoices.map((invoice) => (
|
|
156
|
+
<TableRow key={invoice.id}>
|
|
157
|
+
<TableCell>{invoice.id}</TableCell>
|
|
158
|
+
<TableCell>{invoice.status}</TableCell>
|
|
159
|
+
<TableCell>{invoice.method}</TableCell>
|
|
160
|
+
<TableCell className="text-right">{invoice.amount}</TableCell>
|
|
161
|
+
</TableRow>
|
|
162
|
+
))}
|
|
163
|
+
</TableBody>
|
|
164
|
+
</Table>;
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Casos de Uso
|
|
168
|
+
|
|
169
|
+
**Data tables**: Listados de datos
|
|
170
|
+
**Invoices**: Facturas
|
|
171
|
+
**Users**: Lista de usuarios
|
|
172
|
+
**Reports**: Reportes tabulares
|
|
173
|
+
|
|
174
|
+
## Estilos Base
|
|
175
|
+
|
|
176
|
+
- **Container**: `rounded-xl border` con `overflow-x-auto`
|
|
177
|
+
- **Head**: `bg-neutrals-50 text-neutrals-500 uppercase`
|
|
178
|
+
- **Row hover**: `hover:bg-muted/50`
|
|
179
|
+
- **Cell**: `p-4 text-neutrals-500`
|
|
180
|
+
|
|
181
|
+
## Referencias
|
|
182
|
+
|
|
183
|
+
- **shadcn/ui Table**: <https://ui.shadcn.com/docs/components/table>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Tabs Underline
|
|
2
|
+
|
|
3
|
+
Pestañas con underline. Variante de tabs sin background.
|
|
4
|
+
|
|
5
|
+
## Descripción
|
|
6
|
+
|
|
7
|
+
Variante del componente Tabs con estilo de subrayado en lugar de fondo.
|
|
8
|
+
|
|
9
|
+
## Importación
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import {
|
|
13
|
+
TabsUnderline,
|
|
14
|
+
TabsUnderlineList,
|
|
15
|
+
TabsUnderlineTrigger,
|
|
16
|
+
TabsUnderlineContent,
|
|
17
|
+
} from "@adamosuiteservices/ui/tabs-underline";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Anatomía
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
<TabsUnderline defaultValue="account">
|
|
24
|
+
<TabsUnderlineList>
|
|
25
|
+
<TabsUnderlineTrigger value="account">Account</TabsUnderlineTrigger>
|
|
26
|
+
<TabsUnderlineTrigger value="password">Password</TabsUnderlineTrigger>
|
|
27
|
+
</TabsUnderlineList>
|
|
28
|
+
<TabsUnderlineContent value="account">Account content</TabsUnderlineContent>
|
|
29
|
+
<TabsUnderlineContent value="password">Password content</TabsUnderlineContent>
|
|
30
|
+
</TabsUnderline>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Componentes**: 4 (TabsUnderline, TabsUnderlineList, TabsUnderlineTrigger, TabsUnderlineContent)
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
Idéntico a `tabs` component. Ver documentación de tabs para props completas.
|
|
38
|
+
|
|
39
|
+
## Patrones de Uso
|
|
40
|
+
|
|
41
|
+
### Básico
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<TabsUnderline defaultValue="overview">
|
|
45
|
+
<TabsUnderlineList>
|
|
46
|
+
<TabsUnderlineTrigger value="overview">Overview</TabsUnderlineTrigger>
|
|
47
|
+
<TabsUnderlineTrigger value="analytics">Analytics</TabsUnderlineTrigger>
|
|
48
|
+
<TabsUnderlineTrigger value="reports">Reports</TabsUnderlineTrigger>
|
|
49
|
+
</TabsUnderlineList>
|
|
50
|
+
<TabsUnderlineContent value="overview">Overview content</TabsUnderlineContent>
|
|
51
|
+
<TabsUnderlineContent value="analytics">
|
|
52
|
+
Analytics content
|
|
53
|
+
</TabsUnderlineContent>
|
|
54
|
+
<TabsUnderlineContent value="reports">Reports content</TabsUnderlineContent>
|
|
55
|
+
</TabsUnderline>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Con Iconos
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { BarChartIcon, TableIcon, FileTextIcon } from "lucide-react";
|
|
62
|
+
|
|
63
|
+
<TabsUnderlineList>
|
|
64
|
+
<TabsUnderlineTrigger value="charts">
|
|
65
|
+
<BarChartIcon />
|
|
66
|
+
Charts
|
|
67
|
+
</TabsUnderlineTrigger>
|
|
68
|
+
<TabsUnderlineTrigger value="table">
|
|
69
|
+
<TableIcon />
|
|
70
|
+
Table
|
|
71
|
+
</TabsUnderlineTrigger>
|
|
72
|
+
<TabsUnderlineTrigger value="report">
|
|
73
|
+
<FileTextIcon />
|
|
74
|
+
Report
|
|
75
|
+
</TabsUnderlineTrigger>
|
|
76
|
+
</TabsUnderlineList>;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Diferencias con Tabs Regular
|
|
80
|
+
|
|
81
|
+
- Subrayado animado en lugar de fondo
|
|
82
|
+
- Estilo más minimalista
|
|
83
|
+
- API idéntica a Tabs regular
|
|
84
|
+
|
|
85
|
+
## Diferencia vs Tabs
|
|
86
|
+
|
|
87
|
+
**tabs**: Background `bg-muted` con `rounded-lg`, active usa `bg-primary`
|
|
88
|
+
**tabs-underline**: Sin background, active usa `border-b-2 border-b-primary`
|
|
89
|
+
|
|
90
|
+
## Casos de Uso
|
|
91
|
+
|
|
92
|
+
**Navigation**: Navegación principal
|
|
93
|
+
**Content sections**: Secciones de contenido
|
|
94
|
+
**Data views**: Diferentes visualizaciones
|
|
95
|
+
|
|
96
|
+
## Estilos Base
|
|
97
|
+
|
|
98
|
+
- **List**: Sin background, `h-9`
|
|
99
|
+
- **Trigger active**: `border-b-2 border-b-primary text-primary`
|
|
100
|
+
- **Trigger inactive**: `border-b-2 border-b-transparent`
|
|
101
|
+
|
|
102
|
+
## Referencias
|
|
103
|
+
|
|
104
|
+
- Ver [Tabs](./tabs.md) para documentación completa
|
|
105
|
+
- **Radix UI Tabs**: <https://www.radix-ui.com/primitives/docs/components/tabs>
|
|
106
|
+
- **shadcn/ui Tabs**: <https://ui.shadcn.com/docs/components/tabs>
|