ywana-core8 0.1.102 → 0.2.1
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/index.css +4941 -324
- package/dist/index.js +42338 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +37458 -31678
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +39634 -34010
- package/dist/index.umd.js.map +1 -1
- package/package.json +26 -29
- package/src/Test.stories.jsx +28 -0
- package/src/desktop/Desktop.stories.jsx +110 -0
- package/src/desktop/WindowContext.js +135 -0
- package/src/desktop/WindowManager.js +355 -0
- package/src/desktop/desktop.css +55 -4
- package/src/desktop/desktop.js +312 -6
- package/src/desktop/index.js +7 -0
- package/src/desktop/window.css +229 -36
- package/src/desktop/window.js +254 -20
- package/src/desktop.backup/desktop.css +6 -0
- package/src/desktop.backup/desktop.js +13 -0
- package/src/desktop.backup/window.css +58 -0
- package/src/desktop.backup/window.js +27 -0
- package/src/html/Accordion.stories.jsx +178 -0
- package/src/html/Button.stories.jsx +175 -0
- package/src/html/Checkbox.stories.jsx +131 -0
- package/src/html/Chip.stories.jsx +189 -0
- package/src/html/Color.stories.jsx +234 -0
- package/src/html/Form.stories.jsx +271 -0
- package/src/html/Icon.stories.jsx +233 -0
- package/src/html/Progress.stories.jsx +247 -0
- package/src/html/Radio.stories.jsx +289 -0
- package/src/html/StyleTest.stories.jsx +81 -0
- package/src/html/Switch.stories.jsx +329 -0
- package/src/html/Tab.stories.jsx +239 -0
- package/src/html/Table.stories.jsx +188 -0
- package/src/html/Table2.stories.jsx +238 -0
- package/src/html/TextField2.stories.jsx +337 -0
- package/src/html/Tree.stories.jsx +285 -0
- package/src/html/accordion.example.js +0 -74
- package/src/html/accordion.js +1 -6
- package/src/html/button.js +2 -13
- package/src/html/checkbox.js +1 -9
- package/src/html/chip.js +2 -19
- package/src/html/color.js +1 -14
- package/src/html/form.js +4 -15
- package/src/html/header2.js +1 -12
- package/src/html/icon.js +1 -7
- package/src/html/index.js +1 -1
- package/src/html/list.js +1 -19
- package/src/html/menu.js +9 -5
- package/src/html/progress.js +5 -53
- package/src/html/property.js +6 -22
- package/src/html/radio.js +2 -16
- package/src/html/section.js +1 -6
- package/src/html/selector.js +2 -19
- package/src/html/switch.css +134 -100
- package/src/html/switch.example.js +46 -36
- package/src/html/switch.js +43 -192
- package/src/html/tab.js +3 -24
- package/src/html/text.js +1 -12
- package/src/html/textfield2.js +5 -42
- package/src/html/thumbnail.js +1 -12
- package/src/html/tokenfield.js +2 -21
- package/src/html/tree.js +3 -35
- package/src/index.js +1 -0
- package/__previewjs__/Wrapper.tsx +0 -14
- package/build-doc.sh +0 -10
- package/db/db.json +0 -89
- package/db/routes.json +0 -0
- package/dist/index.cjs +0 -36722
- package/dist/index.cjs.map +0 -1
- package/dist/index.css.map +0 -1
- package/doc/README.md +0 -196
- package/doc/evalulations/ACCORDION_EVALUATION.md +0 -583
- package/doc/evalulations/CHECKBOX_EVALUATION.md +0 -273
- package/doc/evalulations/CHIP_EVALUATION.md +0 -542
- package/doc/evalulations/COLOR_EVALUATION.md +0 -524
- package/doc/evalulations/COMPONENTS_EVALUATION.md +0 -477
- package/doc/evalulations/FORM_EVALUATION.md +0 -459
- package/doc/evalulations/HEADER_EVALUATION.md +0 -436
- package/doc/evalulations/ICON_EVALUATION.md +0 -254
- package/doc/evalulations/LIST_EVALUATION.md +0 -574
- package/doc/evalulations/PROGRESS_EVALUATION.md +0 -450
- package/doc/evalulations/RADIO_EVALUATION.md +0 -439
- package/doc/evalulations/RADIO_VISUAL_FIX.md +0 -183
- package/doc/evalulations/SECTION_IMPROVEMENTS.md +0 -153
- package/doc/evalulations/SWITCH_EVALUATION.md +0 -335
- package/doc/evalulations/SWITCH_VISUAL_FIX.md +0 -232
- package/doc/evalulations/TAB_EVALUATION.md +0 -626
- package/doc/evalulations/TEXTFIELD_EVALUATION.md +0 -747
- package/doc/evalulations/TOOLTIP_FIX.md +0 -157
- package/doc/evalulations/TREE_EVALUATION.md +0 -708
- package/doc/index.html +0 -0
- package/doc/package-lock.json +0 -17298
- package/doc/package.json +0 -34
- package/doc/public/index.html +0 -24
- package/doc/scripts/generate-examples.js +0 -129
- package/doc/src/App.css +0 -171
- package/doc/src/App.js +0 -114
- package/doc/src/components/ExamplePage.js +0 -129
- package/doc/src/components/WelcomePage.js +0 -84
- package/doc/src/index.css +0 -246
- package/doc/src/index.js +0 -17
- package/doc/src/theme.css +0 -256
- package/jest.config.js +0 -24
- package/preview.config.js +0 -38
- package/publish.sh +0 -6
- package/src/desktop/dektop.test.js +0 -11
- package/src/domain/CollectionAPI.test.js +0 -19
- package/src/domain/ContentEditor.test.js +0 -52
- package/src/domain2/CollectionAPI.test.js +0 -19
- package/src/domain2/CollectionContext.test.js +0 -71
- package/src/domain2/CollectionPage.test.js +0 -112
- package/src/domain2/DynamicForm.test.js +0 -47
- package/src/html/accordion.test.js +0 -37
- package/src/html/accordion.unit.test.js +0 -334
- package/src/html/button.example.new.js +0 -416
- package/src/html/button.test.js +0 -422
- package/src/html/checkbox.test.js +0 -285
- package/src/html/chip.test.js +0 -425
- package/src/html/color.example.js.backup +0 -527
- package/src/html/color.test.js +0 -377
- package/src/html/components.example.js.backup +0 -492
- package/src/html/components_enhanced.test.js +0 -581
- package/src/html/form.example.js.backup +0 -385
- package/src/html/form.test.js +0 -369
- package/src/html/header2.example.js.backup +0 -411
- package/src/html/header2.test.js +0 -377
- package/src/html/icon.example.js.backup +0 -268
- package/src/html/icon.test.js +0 -231
- package/src/html/label.test.js +0 -0
- package/src/html/list.example.js.backup +0 -404
- package/src/html/list.test.js +0 -383
- package/src/html/progress.example.js.backup +0 -424
- package/src/html/progress.test.js +0 -313
- package/src/html/property.example.js.backup +0 -553
- package/src/html/property.test.js +0 -371
- package/src/html/radio.example.js.backup +0 -389
- package/src/html/radio.test.js +0 -318
- package/src/html/section.example.js.backup +0 -99
- package/src/html/section.test.js +0 -131
- package/src/html/selector.test.js +0 -20
- package/src/html/switch.example.js.backup +0 -461
- package/src/html/switch.test.js +0 -355
- package/src/html/tab.example.js.backup +0 -446
- package/src/html/tab.test.js +0 -25
- package/src/html/tab_enhanced.test.js +0 -504
- package/src/html/table.test.js +0 -70
- package/src/html/table2.test.js +0 -582
- package/src/html/text.test.js +0 -15
- package/src/html/textfield.test.js +0 -51
- package/src/html/textfield2.example.js.backup +0 -1370
- package/src/html/textfield2.test.js +0 -950
- package/src/html/tokenfield.example.js.backup +0 -503
- package/src/html/tokenfield.test.js +0 -423
- package/src/html/tree.example.js.backup +0 -475
- package/src/html/tree.test.js +0 -43
- package/src/html/tree_enhanced.test.js +0 -495
- package/src/http/token.test.js +0 -50
- package/src/incubator/pdfViewer.js +0 -33
- package/src/incubator/wizard.test.js +0 -127
- package/src/site/site.test.js +0 -230
- package/src/site/view.test.js +0 -41
- package/src/widgets/calendar/Calendar.test.js +0 -28
- package/src/widgets/explorer/Explorer.test.js +0 -121
- package/src/widgets/ide/editor.test.js +0 -33
- package/src/widgets/kanban/Kanban.test.js +0 -78
- package/src/widgets/login/LoginBox.test.js +0 -12
- package/src/widgets/login/ResetPasswordBox.test.js +0 -34
- package/src/widgets/login/validations.test.js +0 -51
- package/src/widgets/planner/Planner.test.js +0 -60
- package/src/widgets/upload/Upload.test.js +0 -32
- package/table2.test.js +0 -454
@@ -0,0 +1,175 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Button, ActionButton } from './button.js'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Botón básico
|
6
|
+
*/
|
7
|
+
export const BasicButton = () => (
|
8
|
+
<div style={{ padding: '20px' }}>
|
9
|
+
<h3>Botones Básicos</h3>
|
10
|
+
<div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap' }}>
|
11
|
+
<Button
|
12
|
+
label="Botón Normal"
|
13
|
+
action={() => alert('¡Hola!')}
|
14
|
+
/>
|
15
|
+
<Button
|
16
|
+
label="Botón Outlined"
|
17
|
+
outlined={true}
|
18
|
+
action={() => alert('¡Outlined!')}
|
19
|
+
/>
|
20
|
+
<Button
|
21
|
+
label="Botón Raised"
|
22
|
+
raised={true}
|
23
|
+
action={() => alert('¡Raised!')}
|
24
|
+
/>
|
25
|
+
<Button
|
26
|
+
label="Botón con Icono"
|
27
|
+
icon="favorite"
|
28
|
+
action={() => alert('¡Con icono!')}
|
29
|
+
/>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
)
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Botones con estados
|
36
|
+
*/
|
37
|
+
export const ButtonStates = () => {
|
38
|
+
const [loading, setLoading] = useState(false)
|
39
|
+
|
40
|
+
const handleAsyncAction = async () => {
|
41
|
+
setLoading(true)
|
42
|
+
await new Promise(resolve => setTimeout(resolve, 2000))
|
43
|
+
setLoading(false)
|
44
|
+
alert('¡Completado!')
|
45
|
+
}
|
46
|
+
|
47
|
+
return (
|
48
|
+
<div style={{ padding: '20px' }}>
|
49
|
+
<h3>Estados de Botones</h3>
|
50
|
+
<div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap' }}>
|
51
|
+
<Button
|
52
|
+
label="Deshabilitado"
|
53
|
+
disabled={true}
|
54
|
+
/>
|
55
|
+
<Button
|
56
|
+
label={loading ? 'Cargando...' : 'Acción Async'}
|
57
|
+
loading={loading}
|
58
|
+
action={handleAsyncAction}
|
59
|
+
/>
|
60
|
+
<Button
|
61
|
+
label="Pequeño"
|
62
|
+
size="small"
|
63
|
+
action={() => alert('¡Pequeño!')}
|
64
|
+
/>
|
65
|
+
<Button
|
66
|
+
label="Grande"
|
67
|
+
size="large"
|
68
|
+
action={() => alert('¡Grande!')}
|
69
|
+
/>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
)
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Action Buttons
|
77
|
+
*/
|
78
|
+
export const ActionButtons = () => {
|
79
|
+
const [uploadState, setUploadState] = useState('normal')
|
80
|
+
|
81
|
+
const uploadStates = {
|
82
|
+
normal: {
|
83
|
+
icon: "cloud_upload",
|
84
|
+
label: "Subir Archivo",
|
85
|
+
action: async () => {
|
86
|
+
setUploadState('uploading')
|
87
|
+
// Simular subida
|
88
|
+
await new Promise(resolve => setTimeout(resolve, 2000))
|
89
|
+
setUploadState('success')
|
90
|
+
setTimeout(() => setUploadState('normal'), 2000)
|
91
|
+
}
|
92
|
+
},
|
93
|
+
uploading: {
|
94
|
+
icon: "hourglass_empty",
|
95
|
+
label: "Subiendo...",
|
96
|
+
disabled: true
|
97
|
+
},
|
98
|
+
success: {
|
99
|
+
icon: "check_circle",
|
100
|
+
label: "Subida Completa",
|
101
|
+
action: () => setUploadState('normal')
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
return (
|
106
|
+
<div style={{ padding: '20px' }}>
|
107
|
+
<h3>Action Buttons</h3>
|
108
|
+
<div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap' }}>
|
109
|
+
<ActionButton
|
110
|
+
states={uploadStates}
|
111
|
+
state={uploadState}
|
112
|
+
onStateChange={setUploadState}
|
113
|
+
/>
|
114
|
+
|
115
|
+
<Button
|
116
|
+
label="Eliminar"
|
117
|
+
icon="delete"
|
118
|
+
action={() => confirm('¿Estás seguro?') && alert('¡Eliminado!')}
|
119
|
+
/>
|
120
|
+
|
121
|
+
<Button
|
122
|
+
label="Descargar"
|
123
|
+
icon="download"
|
124
|
+
outlined={true}
|
125
|
+
action={() => alert('Descargando...')}
|
126
|
+
/>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
)
|
130
|
+
}
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Botones con iconos
|
134
|
+
*/
|
135
|
+
export const IconButtons = () => (
|
136
|
+
<div style={{ padding: '20px' }}>
|
137
|
+
<h3>Botones con Iconos</h3>
|
138
|
+
<div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap' }}>
|
139
|
+
<Button
|
140
|
+
label="Inicio"
|
141
|
+
icon="home"
|
142
|
+
action={() => alert('Home')}
|
143
|
+
/>
|
144
|
+
<Button
|
145
|
+
label="Configuración"
|
146
|
+
icon="settings"
|
147
|
+
outlined={true}
|
148
|
+
action={() => alert('Configuración')}
|
149
|
+
/>
|
150
|
+
<Button
|
151
|
+
label="Añadir"
|
152
|
+
icon="add"
|
153
|
+
raised={true}
|
154
|
+
action={() => alert('Añadir')}
|
155
|
+
/>
|
156
|
+
<Button
|
157
|
+
icon="search"
|
158
|
+
ariaLabel="Buscar"
|
159
|
+
action={() => alert('Buscar')}
|
160
|
+
/>
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
)
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Todos los ejemplos juntos
|
167
|
+
*/
|
168
|
+
export const AllExamples = () => (
|
169
|
+
<div style={{ padding: '20px' }}>
|
170
|
+
<BasicButton />
|
171
|
+
<ButtonStates />
|
172
|
+
<ActionButtons />
|
173
|
+
<IconButtons />
|
174
|
+
</div>
|
175
|
+
)
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { CheckBox } from './checkbox.js'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Checkbox básico
|
6
|
+
*/
|
7
|
+
export const BasicCheckbox = () => {
|
8
|
+
const [formData, setFormData] = useState({})
|
9
|
+
|
10
|
+
const handleChange = (id, value) => {
|
11
|
+
setFormData(prev => ({ ...prev, [id]: value }))
|
12
|
+
}
|
13
|
+
|
14
|
+
return (
|
15
|
+
<div style={{ padding: '20px' }}>
|
16
|
+
<h3>Checkbox Básico</h3>
|
17
|
+
<CheckBox
|
18
|
+
id="basic1"
|
19
|
+
label="Acepto los términos y condiciones"
|
20
|
+
value={formData.basic1 || false}
|
21
|
+
onChange={handleChange}
|
22
|
+
/>
|
23
|
+
<p>Estado: {formData.basic1 ? 'Marcado' : 'No marcado'}</p>
|
24
|
+
</div>
|
25
|
+
)
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Checkbox con diferentes estados
|
30
|
+
*/
|
31
|
+
export const CheckboxStates = () => {
|
32
|
+
const [formData, setFormData] = useState({
|
33
|
+
normal: false,
|
34
|
+
disabled: false,
|
35
|
+
readonly: true,
|
36
|
+
indeterminate: false
|
37
|
+
})
|
38
|
+
|
39
|
+
const handleChange = (id, value) => {
|
40
|
+
setFormData(prev => ({ ...prev, [id]: value }))
|
41
|
+
}
|
42
|
+
|
43
|
+
return (
|
44
|
+
<div style={{ padding: '20px' }}>
|
45
|
+
<h3>Estados de Checkbox</h3>
|
46
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
47
|
+
<CheckBox
|
48
|
+
id="normal"
|
49
|
+
label="Checkbox normal"
|
50
|
+
value={formData.normal}
|
51
|
+
onChange={handleChange}
|
52
|
+
/>
|
53
|
+
|
54
|
+
<CheckBox
|
55
|
+
id="disabled"
|
56
|
+
label="Checkbox deshabilitado"
|
57
|
+
value={formData.disabled}
|
58
|
+
disabled={true}
|
59
|
+
onChange={handleChange}
|
60
|
+
/>
|
61
|
+
|
62
|
+
<CheckBox
|
63
|
+
id="readonly"
|
64
|
+
label="Checkbox solo lectura (marcado)"
|
65
|
+
value={formData.readonly}
|
66
|
+
readOnly={true}
|
67
|
+
onChange={handleChange}
|
68
|
+
/>
|
69
|
+
|
70
|
+
<CheckBox
|
71
|
+
id="indeterminate"
|
72
|
+
label="Checkbox indeterminado"
|
73
|
+
value={formData.indeterminate}
|
74
|
+
indeterminate={true}
|
75
|
+
onChange={handleChange}
|
76
|
+
/>
|
77
|
+
</div>
|
78
|
+
</div>
|
79
|
+
)
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Lista de checkboxes
|
84
|
+
*/
|
85
|
+
export const CheckboxList = () => {
|
86
|
+
const [formData, setFormData] = useState({
|
87
|
+
item2: true // Elemento 2 marcado por defecto
|
88
|
+
})
|
89
|
+
|
90
|
+
const items = [
|
91
|
+
{ id: 'item1', label: 'Elemento 1' },
|
92
|
+
{ id: 'item2', label: 'Elemento 2' },
|
93
|
+
{ id: 'item3', label: 'Elemento 3' },
|
94
|
+
{ id: 'item4', label: 'Elemento 4' }
|
95
|
+
]
|
96
|
+
|
97
|
+
const handleChange = (id, value) => {
|
98
|
+
setFormData(prev => ({ ...prev, [id]: value }))
|
99
|
+
}
|
100
|
+
|
101
|
+
const selectedItems = Object.keys(formData).filter(key => formData[key])
|
102
|
+
|
103
|
+
return (
|
104
|
+
<div style={{ padding: '20px' }}>
|
105
|
+
<h3>Lista de Checkboxes</h3>
|
106
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
107
|
+
{items.map(item => (
|
108
|
+
<CheckBox
|
109
|
+
key={item.id}
|
110
|
+
id={item.id}
|
111
|
+
label={item.label}
|
112
|
+
value={formData[item.id] || false}
|
113
|
+
onChange={handleChange}
|
114
|
+
/>
|
115
|
+
))}
|
116
|
+
</div>
|
117
|
+
<p>Seleccionados: {selectedItems.join(', ')}</p>
|
118
|
+
</div>
|
119
|
+
)
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Todos los ejemplos
|
124
|
+
*/
|
125
|
+
export const AllExamples = () => (
|
126
|
+
<div>
|
127
|
+
<BasicCheckbox />
|
128
|
+
<CheckboxStates />
|
129
|
+
<CheckboxList />
|
130
|
+
</div>
|
131
|
+
)
|
@@ -0,0 +1,189 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Chip, Chips } from './chip.js'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Chips básicos
|
6
|
+
*/
|
7
|
+
export const BasicChips = () => {
|
8
|
+
const handleChipDelete = (chip) => {
|
9
|
+
console.log('Chip deleted:', chip)
|
10
|
+
alert(`Chip "${chip.label}" eliminado`)
|
11
|
+
}
|
12
|
+
|
13
|
+
return (
|
14
|
+
<div style={{ padding: '20px' }}>
|
15
|
+
<h3>Chips Básicos</h3>
|
16
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem' }}>
|
17
|
+
<Chip label="Normal" />
|
18
|
+
<Chip label="Outlined" outlined={true} />
|
19
|
+
<Chip label="Selected" selected={true} />
|
20
|
+
<Chip label="Con Icono" icon="star" />
|
21
|
+
<Chip icon="favorite" ariaLabel="Favorito" />
|
22
|
+
<Chip label="Deletable" deletable={true} onDelete={handleChipDelete} />
|
23
|
+
<Chip label="Disabled" disabled={true} />
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
)
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Tamaños y variantes
|
31
|
+
*/
|
32
|
+
export const ChipSizesAndVariants = () => (
|
33
|
+
<div style={{ padding: '20px' }}>
|
34
|
+
<h3>Tamaños</h3>
|
35
|
+
<div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '0.5rem', marginBottom: '2rem' }}>
|
36
|
+
<Chip label="Pequeño" size="small" />
|
37
|
+
<Chip label="Normal" size="normal" />
|
38
|
+
<Chip label="Grande" size="large" />
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<h3>Variantes de Color</h3>
|
42
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem' }}>
|
43
|
+
<Chip label="Default" variant="default" />
|
44
|
+
<Chip label="Primary" variant="primary" />
|
45
|
+
<Chip label="Secondary" variant="secondary" />
|
46
|
+
<Chip label="Success" variant="success" />
|
47
|
+
<Chip label="Warning" variant="warning" />
|
48
|
+
<Chip label="Error" variant="error" />
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
)
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Chips con selección múltiple
|
55
|
+
*/
|
56
|
+
export const ChipsMultiSelect = () => {
|
57
|
+
const [selectedTags, setSelectedTags] = useState(['react', 'javascript'])
|
58
|
+
|
59
|
+
const tagItems = [
|
60
|
+
{ id: 'react', label: 'React', icon: 'code' },
|
61
|
+
{ id: 'javascript', label: 'JavaScript', icon: 'code' },
|
62
|
+
{ id: 'css', label: 'CSS', icon: 'palette' },
|
63
|
+
{ id: 'html', label: 'HTML', icon: 'web' },
|
64
|
+
{ id: 'nodejs', label: 'Node.js', icon: 'storage' }
|
65
|
+
]
|
66
|
+
|
67
|
+
const handleTagChange = (selected) => {
|
68
|
+
setSelectedTags(selected)
|
69
|
+
console.log('Selected tags:', selected)
|
70
|
+
}
|
71
|
+
|
72
|
+
return (
|
73
|
+
<div style={{ padding: '20px' }}>
|
74
|
+
<h3>Selección Múltiple</h3>
|
75
|
+
<p>Seleccionados: {selectedTags.join(', ')}</p>
|
76
|
+
<Chips
|
77
|
+
items={tagItems}
|
78
|
+
selected={selectedTags}
|
79
|
+
multiSelect={true}
|
80
|
+
onChange={handleTagChange}
|
81
|
+
size="normal"
|
82
|
+
variant="primary"
|
83
|
+
/>
|
84
|
+
</div>
|
85
|
+
)
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Chips con selección única
|
90
|
+
*/
|
91
|
+
export const ChipsSingleSelect = () => {
|
92
|
+
const [selectedCategory, setSelectedCategory] = useState(['frontend'])
|
93
|
+
|
94
|
+
const categoryItems = [
|
95
|
+
{ id: 'frontend', label: 'Frontend', icon: 'web' },
|
96
|
+
{ id: 'backend', label: 'Backend', icon: 'storage' },
|
97
|
+
{ id: 'mobile', label: 'Mobile', icon: 'phone_android' },
|
98
|
+
{ id: 'desktop', label: 'Desktop', icon: 'desktop_windows' }
|
99
|
+
]
|
100
|
+
|
101
|
+
const handleCategoryChange = (selected) => {
|
102
|
+
setSelectedCategory(selected)
|
103
|
+
console.log('Selected category:', selected)
|
104
|
+
}
|
105
|
+
|
106
|
+
return (
|
107
|
+
<div style={{ padding: '20px' }}>
|
108
|
+
<h3>Selección Única</h3>
|
109
|
+
<p>Seleccionado: {selectedCategory.join(', ')}</p>
|
110
|
+
<Chips
|
111
|
+
items={categoryItems}
|
112
|
+
selected={selectedCategory}
|
113
|
+
multiSelect={false}
|
114
|
+
onChange={handleCategoryChange}
|
115
|
+
size="normal"
|
116
|
+
variant="secondary"
|
117
|
+
/>
|
118
|
+
</div>
|
119
|
+
)
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Chips avanzados
|
124
|
+
*/
|
125
|
+
export const AdvancedChips = () => {
|
126
|
+
const handleChipDelete = (chip) => {
|
127
|
+
console.log('Chip deleted:', chip)
|
128
|
+
}
|
129
|
+
|
130
|
+
return (
|
131
|
+
<div style={{ padding: '20px' }}>
|
132
|
+
<h3>Características Avanzadas</h3>
|
133
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '1rem' }}>
|
134
|
+
<div>
|
135
|
+
<h4>Con Tooltip</h4>
|
136
|
+
<Chip
|
137
|
+
label="Hover me"
|
138
|
+
tooltip={{ content: 'Este es un tooltip informativo' }}
|
139
|
+
/>
|
140
|
+
</div>
|
141
|
+
<div>
|
142
|
+
<h4>Con Badge</h4>
|
143
|
+
<Chip
|
144
|
+
label="Con Badge"
|
145
|
+
action={<span style={{
|
146
|
+
background: '#dc3545',
|
147
|
+
color: 'white',
|
148
|
+
borderRadius: '50%',
|
149
|
+
padding: '2px 6px',
|
150
|
+
fontSize: '0.75rem'
|
151
|
+
}}>5</span>}
|
152
|
+
/>
|
153
|
+
</div>
|
154
|
+
<div>
|
155
|
+
<h4>Outlined + Selected</h4>
|
156
|
+
<Chip
|
157
|
+
label="Outlined Selected"
|
158
|
+
outlined={true}
|
159
|
+
selected={true}
|
160
|
+
icon="check_circle"
|
161
|
+
/>
|
162
|
+
</div>
|
163
|
+
<div>
|
164
|
+
<h4>Large + Deletable</h4>
|
165
|
+
<Chip
|
166
|
+
label="Large Deletable"
|
167
|
+
size="large"
|
168
|
+
deletable={true}
|
169
|
+
variant="primary"
|
170
|
+
onDelete={handleChipDelete}
|
171
|
+
/>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
)
|
176
|
+
}
|
177
|
+
|
178
|
+
/**
|
179
|
+
* Todos los ejemplos
|
180
|
+
*/
|
181
|
+
export const AllExamples = () => (
|
182
|
+
<div>
|
183
|
+
<BasicChips />
|
184
|
+
<ChipSizesAndVariants />
|
185
|
+
<ChipsMultiSelect />
|
186
|
+
<ChipsSingleSelect />
|
187
|
+
<AdvancedChips />
|
188
|
+
</div>
|
189
|
+
)
|