@councilbox/councilbox-ui 2.0.59 → 2.0.60
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/SafeHtml.js +3 -0
- package/dist/HOCs/overlayA11yStack.js +1 -1
- package/dist/HOCs/useDynamicStyles.js +39 -4
- package/dist/build-index.js +14 -0
- package/dist/components/Accordion/Accordion.css +7 -1
- package/dist/components/Button/Button.js +79 -87
- package/dist/components/Button/button.css +171 -16
- package/dist/components/DatePicker/Calendar.js +3 -5
- package/dist/components/DatePicker/DatePicker.css +1 -1
- package/dist/components/DateRangePicker/RangeCalendar.js +2 -4
- package/dist/components/IconButton/IconButton.js +1 -1
- package/dist/components/Modal/Modal.js +13 -3
- package/dist/components/RichTextInput/RichTextInput.js +28 -7
- package/dist/components/SafeHtml/SafeHtml.js +82 -0
- package/dist/components/SelectInput/SelectInput.js +1 -0
- package/dist/components/Stepper/Stepper.css +6 -1
- package/dist/components/Tabs/Tabs.js +1 -0
- package/dist/components/TextInput/TextInput.css +164 -1
- package/dist/components/TextInput/TextInput.js +171 -167
- package/dist/components/ThemeProvider/Colors.js +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.js +1 -7
- package/dist/components/Toast/toastStore.js +1 -0
- package/dist/styles/colorConsts.css +1 -1
- package/dist/styles/stylesheet.js +2 -50
- package/dist/testing/TestAutocomplete.js +1 -105
- package/dist/utils/sanitizeHtml.js +199 -0
- package/package.json +17 -31
- package/dist/__snapshots__/storybook.test.js.snap +0 -104
- package/dist/components/1.Introduction.stories.mdx +0 -579
- package/dist/components/2.Changelog.stories.mdx +0 -1392
- package/dist/components/3.Guide.stories.mdx +0 -589
- package/dist/components/Accordion/Accordion.stories.js +0 -95
- package/dist/components/Accordion/DesignAccordion.stories.js +0 -27
- package/dist/components/Alert/Alert.stories.js +0 -101
- package/dist/components/Avatar/Avatar.stories.js +0 -159
- package/dist/components/Avatar/DesignAvatar.stories.js +0 -64
- package/dist/components/Avatar/DesignAvatarText.stories.js +0 -123
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +0 -72
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +0 -118
- package/dist/components/Block/Block.stories.js +0 -66
- package/dist/components/Block/DesignBlock.stories.js +0 -35
- package/dist/components/Button/Button.stories.js +0 -98
- package/dist/components/ButtonBasic/ButtonBasic.stories.js +0 -161
- package/dist/components/Checkbox/Checkbox.stories.js +0 -110
- package/dist/components/DatePicker/DatePicker.stories.js +0 -180
- package/dist/components/DateRangePicker/DateRangePicker.stories.js +0 -147
- package/dist/components/DateTimePicker/DateTimePicker.stories.js +0 -144
- package/dist/components/DragDrop/DragDrop.stories.js +0 -155
- package/dist/components/DrawerPanel/DrawerPanel.stories.js +0 -277
- package/dist/components/DropDown/DesignDropDown.stories.js +0 -216
- package/dist/components/DropDown/DropDown.stories.js +0 -240
- package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +0 -128
- package/dist/components/EnhancedTable/EnhancedTable.stories.js +0 -259
- package/dist/components/FabButton/DesignFabButton.stories.js +0 -40
- package/dist/components/FabButton/FabButton.stories.js +0 -147
- package/dist/components/Grid/DesignGrid.stories.js +0 -45
- package/dist/components/Grid/Grid.stories.js +0 -211
- package/dist/components/Header/DesignHeader.stories.js +0 -65
- package/dist/components/Header/Header.stories.js +0 -674
- package/dist/components/IconButton/DesignIconButton.stories.js +0 -113
- package/dist/components/IconButton/IconButton.stories.js +0 -205
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +0 -21
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +0 -209
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +0 -433
- package/dist/components/InputPassword/InputPassword.stories.js +0 -185
- package/dist/components/InputText/InputText.stories.js +0 -261
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +0 -116
- package/dist/components/InputTextArea/InputTextArea.stories.js +0 -146
- package/dist/components/LoadingSection/LoadingSection.stories.js +0 -84
- package/dist/components/MenuItem/DesignMenuItem.stories.js +0 -54
- package/dist/components/MenuItem/MenuItem.stories.js +0 -138
- package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +0 -243
- package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +0 -228
- package/dist/components/Modal/DesignModal.stories.js +0 -39
- package/dist/components/Modal/Modal.stories.js +0 -229
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +0 -22
- package/dist/components/PaginationFooter/PaginationFooter.stories.js +0 -191
- package/dist/components/RadioButton/Radio.stories.js +0 -157
- package/dist/components/RichTextInput/DesignRichTextInput.stories.js +0 -119
- package/dist/components/RichTextInput/RichTextInput.stories.js +0 -38
- package/dist/components/Ripple/Ripple.stories.js +0 -107
- package/dist/components/Scrollbar/Scrollbar.stories.js +0 -42
- package/dist/components/ScrollbarOld/ScrollbarOld.stories.js +0 -140
- package/dist/components/SelectInput/SelectInput.stories.js +0 -212
- package/dist/components/Slider/Slider.stories.js +0 -128
- package/dist/components/Spacing/Spacing.stories.js +0 -37
- package/dist/components/Stars/Stars.stories.js +0 -138
- package/dist/components/Stepper/DesignStepper.stories.js +0 -130
- package/dist/components/Stepper/Stepper.stories.js +0 -131
- package/dist/components/Table/DesignTable.stories.js +0 -614
- package/dist/components/Table/Table.stories.js +0 -215
- package/dist/components/Tabs/Tabs.stories.js +0 -163
- package/dist/components/Tag/DesignTags.stories.js +0 -81
- package/dist/components/Tag/Tag.stories.js +0 -148
- package/dist/components/TextInput/TextInput.stories.js +0 -148
- package/dist/components/TimePicker/TimePicker.stories.js +0 -132
- package/dist/components/Timeline/DesignTimeline.stories.js +0 -19
- package/dist/components/Timeline/Timeline.stories.js +0 -128
- package/dist/components/Toast/DesignToast.stories.js +0 -174
- package/dist/components/Toast/Toast.stories.js +0 -39
- package/dist/components/Toggle/Toggle.stories.js +0 -118
- package/dist/components/Tooltip/DesignTooltip.stories.js +0 -45
- package/dist/components/Tooltip/Tooltip.stories.js +0 -135
- package/dist/components/Typography/Typography.stories.js +0 -114
- package/dist/reportWebVitals.js +0 -28
- package/dist/storybook.test.js +0 -5
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = exports.DesignModalTemplate = exports.Default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
9
|
-
var _DesignModal = _interopRequireDefault(require("./DesignModal.stories"));
|
|
10
|
-
var _ButtonBasic = _interopRequireDefault(require("../ButtonBasic/ButtonBasic"));
|
|
11
|
-
var _excluded = ["open", "requestClose", "acceptAction", "cancelAction"];
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
14
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
18
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
21
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
22
|
-
var _default = {
|
|
23
|
-
title: 'Components/Modal',
|
|
24
|
-
component: _Modal["default"],
|
|
25
|
-
argTypes: {
|
|
26
|
-
open: {
|
|
27
|
-
control: 'boolean'
|
|
28
|
-
},
|
|
29
|
-
title: {
|
|
30
|
-
control: 'text'
|
|
31
|
-
},
|
|
32
|
-
bodyText: {
|
|
33
|
-
control: 'text',
|
|
34
|
-
description: 'Contenido del modal.'
|
|
35
|
-
},
|
|
36
|
-
body: {
|
|
37
|
-
control: false,
|
|
38
|
-
description: 'Contenido como nodo (alternativa a bodyText).'
|
|
39
|
-
},
|
|
40
|
-
role: {
|
|
41
|
-
control: 'radio',
|
|
42
|
-
options: ['dialog', 'alertdialog']
|
|
43
|
-
},
|
|
44
|
-
buttonAccept: {
|
|
45
|
-
control: 'text'
|
|
46
|
-
},
|
|
47
|
-
buttonCancel: {
|
|
48
|
-
control: 'text'
|
|
49
|
-
},
|
|
50
|
-
hideAccept: {
|
|
51
|
-
control: 'boolean'
|
|
52
|
-
},
|
|
53
|
-
loadingAction: {
|
|
54
|
-
control: 'boolean'
|
|
55
|
-
},
|
|
56
|
-
buttonAcceptProps: {
|
|
57
|
-
control: 'object'
|
|
58
|
-
},
|
|
59
|
-
buttonCancelProps: {
|
|
60
|
-
control: 'object'
|
|
61
|
-
},
|
|
62
|
-
extraActions: {
|
|
63
|
-
control: 'text',
|
|
64
|
-
description: 'Contenido entre los dos botones.'
|
|
65
|
-
},
|
|
66
|
-
customButtons: {
|
|
67
|
-
control: 'text',
|
|
68
|
-
description: 'Contenido entre el cuerpo y los botones.'
|
|
69
|
-
},
|
|
70
|
-
actions: {
|
|
71
|
-
control: false,
|
|
72
|
-
description: 'Sustituye la fila de botones.'
|
|
73
|
-
},
|
|
74
|
-
breakpointsButtons: {
|
|
75
|
-
control: 'text',
|
|
76
|
-
description: 'Ancho (px) por debajo del cual los botones se apilan.'
|
|
77
|
-
},
|
|
78
|
-
disableBackdropClick: {
|
|
79
|
-
control: 'boolean'
|
|
80
|
-
},
|
|
81
|
-
fullWidth: {
|
|
82
|
-
control: 'boolean'
|
|
83
|
-
},
|
|
84
|
-
fullScreen: {
|
|
85
|
-
control: 'boolean'
|
|
86
|
-
},
|
|
87
|
-
hasScrollbar: {
|
|
88
|
-
control: 'boolean'
|
|
89
|
-
},
|
|
90
|
-
scrollbarHeight: {
|
|
91
|
-
control: 'text'
|
|
92
|
-
},
|
|
93
|
-
widthModal: {
|
|
94
|
-
control: 'object'
|
|
95
|
-
},
|
|
96
|
-
PaperProps: {
|
|
97
|
-
control: 'object'
|
|
98
|
-
},
|
|
99
|
-
requestClose: {
|
|
100
|
-
action: 'requestClose'
|
|
101
|
-
},
|
|
102
|
-
acceptAction: {
|
|
103
|
-
action: 'acceptAction'
|
|
104
|
-
},
|
|
105
|
-
cancelAction: {
|
|
106
|
-
action: 'cancelAction'
|
|
107
|
-
},
|
|
108
|
-
id: {
|
|
109
|
-
control: 'text'
|
|
110
|
-
},
|
|
111
|
-
className: {
|
|
112
|
-
control: 'text'
|
|
113
|
-
},
|
|
114
|
-
classNameDialog: {
|
|
115
|
-
control: 'text'
|
|
116
|
-
},
|
|
117
|
-
style: {
|
|
118
|
-
control: 'object'
|
|
119
|
-
},
|
|
120
|
-
styles: {
|
|
121
|
-
control: 'object'
|
|
122
|
-
},
|
|
123
|
-
sx: {
|
|
124
|
-
control: 'object'
|
|
125
|
-
},
|
|
126
|
-
loading: {
|
|
127
|
-
table: {
|
|
128
|
-
disable: true
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
prefixClass: {
|
|
132
|
-
table: {
|
|
133
|
-
disable: true
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
parameters: {
|
|
138
|
-
docs: {
|
|
139
|
-
description: {
|
|
140
|
-
component: "\n## Modal\n\nVentana de di\xE1logo que se muestra por encima del contenido para pedir una confirmaci\xF3n, mostrar informaci\xF3n o un formulario. Mientras est\xE1 abierta, el resto de la p\xE1gina queda inactivo.\n\n## Funcionamiento\n\n### Apertura y cierre\n\n- `open`: muestra u oculta el modal, con una transici\xF3n de entrada y salida.\n- `requestClose`: se llama al pulsar el bot\xF3n de cerrar (X), al pulsar **Escape** o al hacer clic fuera del modal.\n- `disableBackdropClick`: evita que el clic fuera lo cierre.\n\n### Contenido\n\n- `title`: t\xEDtulo del di\xE1logo.\n- `bodyText` o `body`: contenido.\n- `customButtons`: contenido adicional entre el cuerpo y los botones.\n\n### Botones\n\n- `buttonAccept` y `acceptAction`: texto y acci\xF3n del bot\xF3n principal. `loadingAction` muestra un indicador de carga en \xE9l.\n- `buttonCancel` y `cancelAction`: texto y acci\xF3n del bot\xF3n secundario. Si no hay `cancelAction`, se usa `requestClose`.\n- `hideAccept`: oculta el bot\xF3n principal.\n- `extraActions`: botones adicionales entre los dos.\n- `buttonAcceptProps` y `buttonCancelProps`: props extra de cada bot\xF3n (por ejemplo, `disabled`).\n- `actions`: sustituye por completo la fila de botones.\n- Por debajo de `breakpointsButtons` (800px por defecto), los botones se apilan en columna.\n\n### Tama\xF1o\n\n- `fullWidth`, `fullScreen`, `widthModal` y `PaperProps.style`: ajustan el tama\xF1o del di\xE1logo.\n- `hasScrollbar` y `scrollbarHeight`: limitan la altura del di\xE1logo para usar un scroll interno.\n\n## Accesibilidad\n\n### Rol y nombre\n\n- El di\xE1logo tiene `role=\"dialog\"` (o `role=\"alertdialog\"` con la prop `role`) y `aria-modal=\"true\"`.\n- El t\xEDtulo se vincula con `aria-labelledby` y el cuerpo con `aria-describedby`, de modo que el lector anuncia ambos al abrirse.\n- Integra `useA11yGuard`: en modo estricto exige `title`.\n\n### Gesti\xF3n del foco\n\n- Al abrirse, el foco pasa al primer elemento enfocable del contenido (salt\xE1ndose el bot\xF3n de cerrar); si no hay ninguno, al propio di\xE1logo.\n- Mientras est\xE1 abierto, **Tab** y **Shift + Tab** recorren solo los elementos del modal (el foco queda atrapado dentro).\n- Al cerrarse, el foco vuelve al elemento que lo ten\xEDa antes de abrirlo.\n- El resto de la p\xE1gina se marca como inerte (`inert` y `aria-hidden=\"true\"`), as\xED que ni el teclado ni el lector de pantalla pueden salir del modal. Con varios modales abiertos, solo el \xFAltimo queda activo.\n\n### Teclado y cierre\n\n- **Escape** cierra el modal (llama a `requestClose`).\n- El bot\xF3n de cerrar (X) es un `button` nativo con `aria-label=\"Cerrar\"`; su icono es decorativo.\n\n## Recomendaciones de uso\n\n- Usar siempre un `title` claro, ya que es lo primero que anuncia el lector de pantalla.\n- Usar `role=\"alertdialog\"` para confirmaciones importantes o destructivas (por ejemplo, \"\xBFEliminar la reuni\xF3n?\").\n- Pasar un `id` \xFAnico a cada modal (ver Consideraciones).\n- Si el primer elemento enfocable no es el adecuado (por ejemplo, un bot\xF3n de eliminar), reordenar el contenido para que el foco caiga en una opci\xF3n segura.\n\n## Consideraciones\n\n- `id` vale `'modal'` por defecto, as\xED que varios modales sin `id` comparten identificador (y tambi\xE9n los de t\xEDtulo y cuerpo), lo que puede hacer que el lector anuncie el t\xEDtulo equivocado.\n- El texto del bot\xF3n de cerrar (\"Cerrar\") est\xE1 fijo en castellano.\n- El modal se renderiza en un portal, pero los eventos de React (clics, teclas) siguen subiendo por el \xE1rbol de componentes: un **Enter** dentro del modal llega a los `onKeyDown` de sus componentes padre. Los componentes de la librer\xEDa (`TableRow`, `Grid`, `GridItem`) ya ignoran las teclas que vienen de sus hijos; en componentes propios, comprobar `event.target === event.currentTarget`."
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
storybookCodePanel: {
|
|
144
|
-
disabled: false,
|
|
145
|
-
files: [{
|
|
146
|
-
fileName: 'Modal.js',
|
|
147
|
-
// eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
|
|
148
|
-
code: require('!!raw-loader!./Modal.jsx')
|
|
149
|
-
}, {
|
|
150
|
-
fileName: 'Modal.css',
|
|
151
|
-
// eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
|
|
152
|
-
code: require('!!raw-loader!./Modal.css')
|
|
153
|
-
}]
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
exports["default"] = _default;
|
|
158
|
-
var Template = function Template(_ref) {
|
|
159
|
-
var openArg = _ref.open,
|
|
160
|
-
_requestClose = _ref.requestClose,
|
|
161
|
-
_acceptAction = _ref.acceptAction,
|
|
162
|
-
_cancelAction = _ref.cancelAction,
|
|
163
|
-
args = _objectWithoutProperties(_ref, _excluded);
|
|
164
|
-
var _React$useState = _react["default"].useState(openArg),
|
|
165
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
166
|
-
open = _React$useState2[0],
|
|
167
|
-
setOpen = _React$useState2[1];
|
|
168
|
-
_react["default"].useEffect(function () {
|
|
169
|
-
return setOpen(openArg);
|
|
170
|
-
}, [openArg]);
|
|
171
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_ButtonBasic["default"], {
|
|
172
|
-
text: "Abrir modal",
|
|
173
|
-
onClick: function onClick() {
|
|
174
|
-
return setOpen(true);
|
|
175
|
-
}
|
|
176
|
-
}), /*#__PURE__*/_react["default"].createElement(_Modal["default"], _extends({}, args, {
|
|
177
|
-
open: open,
|
|
178
|
-
requestClose: function requestClose() {
|
|
179
|
-
setOpen(false);
|
|
180
|
-
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
181
|
-
params[_key] = arguments[_key];
|
|
182
|
-
}
|
|
183
|
-
_requestClose === null || _requestClose === void 0 ? void 0 : _requestClose.apply(void 0, params);
|
|
184
|
-
},
|
|
185
|
-
acceptAction: function acceptAction() {
|
|
186
|
-
for (var _len2 = arguments.length, params = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
187
|
-
params[_key2] = arguments[_key2];
|
|
188
|
-
}
|
|
189
|
-
_acceptAction === null || _acceptAction === void 0 ? void 0 : _acceptAction.apply(void 0, params);
|
|
190
|
-
setOpen(false);
|
|
191
|
-
},
|
|
192
|
-
cancelAction: function cancelAction() {
|
|
193
|
-
for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
194
|
-
params[_key3] = arguments[_key3];
|
|
195
|
-
}
|
|
196
|
-
_cancelAction === null || _cancelAction === void 0 ? void 0 : _cancelAction.apply(void 0, params);
|
|
197
|
-
setOpen(false);
|
|
198
|
-
}
|
|
199
|
-
})));
|
|
200
|
-
};
|
|
201
|
-
var TemplateModal = function TemplateModal(args) {
|
|
202
|
-
return /*#__PURE__*/_react["default"].createElement(_DesignModal["default"], args);
|
|
203
|
-
};
|
|
204
|
-
TemplateModal.displayName = "TemplateModal";
|
|
205
|
-
var Default = Template.bind({});
|
|
206
|
-
exports.Default = Default;
|
|
207
|
-
Default.args = {
|
|
208
|
-
open: false,
|
|
209
|
-
title: 'Confirmar envío',
|
|
210
|
-
bodyText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
211
|
-
role: 'dialog',
|
|
212
|
-
buttonCancel: 'Cancelar',
|
|
213
|
-
buttonAccept: 'Aceptar',
|
|
214
|
-
hideAccept: false,
|
|
215
|
-
loadingAction: false,
|
|
216
|
-
disableBackdropClick: false,
|
|
217
|
-
fullWidth: false,
|
|
218
|
-
fullScreen: false,
|
|
219
|
-
hasScrollbar: false,
|
|
220
|
-
scrollbarHeight: '70%',
|
|
221
|
-
breakpointsButtons: '800'
|
|
222
|
-
};
|
|
223
|
-
var DesignModalTemplate = TemplateModal.bind({});
|
|
224
|
-
exports.DesignModalTemplate = DesignModalTemplate;
|
|
225
|
-
DesignModalTemplate.parameters = {
|
|
226
|
-
controls: {
|
|
227
|
-
disable: true
|
|
228
|
-
}
|
|
229
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
require("../../styles/main.css");
|
|
9
|
-
var _PaginationFooter = _interopRequireDefault(require("./PaginationFooter"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
-
var DesignPaginationFooter = function DesignPaginationFooter() {
|
|
12
|
-
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_PaginationFooter["default"], {
|
|
13
|
-
page: 1,
|
|
14
|
-
length: 20,
|
|
15
|
-
total: 30,
|
|
16
|
-
limit: 20,
|
|
17
|
-
changePage: null
|
|
18
|
-
}));
|
|
19
|
-
};
|
|
20
|
-
DesignPaginationFooter.displayName = "DesignPaginationFooter";
|
|
21
|
-
var _default = DesignPaginationFooter;
|
|
22
|
-
exports["default"] = _default;
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = exports.Playground = exports.DesignTemplatePaginationFooter = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _PaginationFooter = _interopRequireDefault(require("./PaginationFooter"));
|
|
9
|
-
var _DesignPaginationFooter = _interopRequireDefault(require("./DesignPaginationFooter.stories"));
|
|
10
|
-
var _excluded = ["page", "changePage"];
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
13
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
14
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
16
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
17
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
19
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
20
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
21
|
-
var _default = {
|
|
22
|
-
title: 'Components/PaginationFooter',
|
|
23
|
-
component: _PaginationFooter["default"],
|
|
24
|
-
argTypes: {
|
|
25
|
-
page: {
|
|
26
|
-
control: {
|
|
27
|
-
type: 'number',
|
|
28
|
-
min: 1
|
|
29
|
-
},
|
|
30
|
-
description: 'Página inicial (la demo la actualiza al navegar).'
|
|
31
|
-
},
|
|
32
|
-
total: {
|
|
33
|
-
control: {
|
|
34
|
-
type: 'number',
|
|
35
|
-
min: 0
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
limit: {
|
|
39
|
-
control: {
|
|
40
|
-
type: 'number',
|
|
41
|
-
min: 1
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
length: {
|
|
45
|
-
control: false,
|
|
46
|
-
description: 'Filas de la página actual (en la demo se calcula).'
|
|
47
|
-
},
|
|
48
|
-
isChangingPage: {
|
|
49
|
-
control: 'boolean'
|
|
50
|
-
},
|
|
51
|
-
isMobile: {
|
|
52
|
-
control: 'boolean'
|
|
53
|
-
},
|
|
54
|
-
translate: {
|
|
55
|
-
control: 'object'
|
|
56
|
-
},
|
|
57
|
-
ariaLabelNav: {
|
|
58
|
-
control: 'text'
|
|
59
|
-
},
|
|
60
|
-
ariaLabelPrevious: {
|
|
61
|
-
control: 'text'
|
|
62
|
-
},
|
|
63
|
-
ariaLabelNext: {
|
|
64
|
-
control: 'text'
|
|
65
|
-
},
|
|
66
|
-
ariaLabelPage: {
|
|
67
|
-
control: false,
|
|
68
|
-
description: 'Función (número) => texto.'
|
|
69
|
-
},
|
|
70
|
-
ariaLabelSelectPage: {
|
|
71
|
-
control: 'text'
|
|
72
|
-
},
|
|
73
|
-
xs: {
|
|
74
|
-
control: {
|
|
75
|
-
type: 'range',
|
|
76
|
-
min: 1,
|
|
77
|
-
max: 12,
|
|
78
|
-
step: 1
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
md: {
|
|
82
|
-
control: {
|
|
83
|
-
type: 'range',
|
|
84
|
-
min: 1,
|
|
85
|
-
max: 12,
|
|
86
|
-
step: 1
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
lg: {
|
|
90
|
-
control: {
|
|
91
|
-
type: 'range',
|
|
92
|
-
min: 1,
|
|
93
|
-
max: 12,
|
|
94
|
-
step: 1
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
changePage: {
|
|
98
|
-
action: 'changePage'
|
|
99
|
-
},
|
|
100
|
-
sx: {
|
|
101
|
-
control: 'object'
|
|
102
|
-
},
|
|
103
|
-
text: {
|
|
104
|
-
table: {
|
|
105
|
-
disable: true
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
label: {
|
|
109
|
-
table: {
|
|
110
|
-
disable: true
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
prefixClass: {
|
|
114
|
-
table: {
|
|
115
|
-
disable: true
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
parameters: {
|
|
120
|
-
docs: {
|
|
121
|
-
importStatement: "import PaginationFooter from '@councilbox/councilbox-ui/dist/components/PaginationFooter/PaginationFooter';",
|
|
122
|
-
description: {
|
|
123
|
-
component: "\n## PaginationFooter\n\nPie de paginaci\xF3n para tablas y listados: muestra el rango de resultados visibles (\"11 - 20 de 85\") y los controles para cambiar de p\xE1gina.\n\n## Funcionamiento\n\n### Datos\n\n- `page`: p\xE1gina actual (empieza en 1).\n- `limit`: resultados por p\xE1gina.\n- `total`: n\xFAmero total de resultados.\n- `length`: n\xFAmero de resultados de la p\xE1gina actual (para el texto del rango).\n- `changePage(p\xE1gina)`: se llama al pedir otra p\xE1gina.\n- `isChangingPage`: deshabilita los controles y muestra un indicador de carga mientras se cargan los datos.\n- `translate`: textos de la aplicaci\xF3n (`of`, `table_no_results`, `table_button_previous`, `table_button_next`).\n\n### Escritorio\n\n- Botones de p\xE1gina anterior y siguiente (solo cuando existen).\n- Botones con el n\xFAmero de cada p\xE1gina. Con m\xE1s de 6 p\xE1ginas se muestran las 3 primeras, las 3 \xFAltimas y, entre ellas, un desplegable con el resto.\n- `xs`, `md` y `lg`: columnas que ocupa cada parte (texto y controles), como en `GridItem`.\n\n### M\xF3vil (`isMobile`)\n\n- Botones de texto \"Anterior\" / \"Siguiente\" y un desplegable con todas las p\xE1ginas.\n\n## Accesibilidad\n\n### Navegaci\xF3n\n\n- En escritorio, los controles est\xE1n dentro de un `nav` con `aria-label` (\"Paginaci\xF3n de resultados\" por defecto, o `ariaLabelNav`).\n- Cada bot\xF3n de p\xE1gina es un `button` nativo con `aria-label` (\"P\xE1gina 3\" por defecto, o `ariaLabelPage(n\xFAmero)`).\n- La p\xE1gina actual lleva `aria-current=\"page\"`.\n- Los botones de anterior y siguiente tienen `aria-label` (\"P\xE1gina anterior\" / \"P\xE1gina siguiente\", o `ariaLabelPrevious` / `ariaLabelNext`) y sus iconos son decorativos.\n- Los desplegables de p\xE1ginas tienen `aria-label` (\"Ir a otra p\xE1gina\", o `ariaLabelSelectPage`).\n\n### Estados\n\n- Mientras `isChangingPage` est\xE1 activo, los botones se deshabilitan con el atributo nativo `disabled`.\n\n## Recomendaciones de uso\n\n- Pasar todos los `ariaLabel*` traducidos (`ariaLabelNav`, `ariaLabelPrevious`, `ariaLabelNext`, `ariaLabelPage`, `ariaLabelSelectPage`), ya que por defecto est\xE1n en castellano.\n- Tras cambiar de p\xE1gina, mover el foco al inicio de la tabla o anunciar el cambio, para que el usuario de lector de pantalla sepa que el contenido se ha actualizado.\n\n## Consideraciones\n\n- El texto del rango (\"11 - 20 de 85\") no es una regi\xF3n `aria-live`: el cambio de p\xE1gina no se anuncia autom\xE1ticamente.\n- En m\xF3vil no hay elemento `nav` y los botones \"Anterior\" / \"Siguiente\" dependen de `translate` para tener texto.\n- Al deshabilitarse los botones durante la carga, el bot\xF3n pulsado pierde el foco.\n- El indicador de carga usa el texto gen\xE9rico \"Cargando\"."
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
storybookCodePanel: {
|
|
127
|
-
disabled: false,
|
|
128
|
-
files: [{
|
|
129
|
-
fileName: 'PaginationFooter.js',
|
|
130
|
-
// eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
|
|
131
|
-
code: require('!!raw-loader!./PaginationFooter.jsx')
|
|
132
|
-
}]
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
exports["default"] = _default;
|
|
137
|
-
var PlaygroundTemplate = function PlaygroundTemplate(_ref) {
|
|
138
|
-
var pageArg = _ref.page,
|
|
139
|
-
_changePage = _ref.changePage,
|
|
140
|
-
args = _objectWithoutProperties(_ref, _excluded);
|
|
141
|
-
var _React$useState = _react["default"].useState(pageArg),
|
|
142
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
143
|
-
page = _React$useState2[0],
|
|
144
|
-
setPage = _React$useState2[1];
|
|
145
|
-
_react["default"].useEffect(function () {
|
|
146
|
-
return setPage(pageArg);
|
|
147
|
-
}, [pageArg]);
|
|
148
|
-
var length = Math.max(0, Math.min(args.limit, args.total - (page - 1) * args.limit));
|
|
149
|
-
return /*#__PURE__*/_react["default"].createElement(_PaginationFooter["default"], _extends({}, args, {
|
|
150
|
-
page: page,
|
|
151
|
-
length: length,
|
|
152
|
-
changePage: function changePage(newPage) {
|
|
153
|
-
setPage(Number(newPage));
|
|
154
|
-
_changePage === null || _changePage === void 0 ? void 0 : _changePage(newPage);
|
|
155
|
-
}
|
|
156
|
-
}));
|
|
157
|
-
};
|
|
158
|
-
PlaygroundTemplate.displayName = "PlaygroundTemplate";
|
|
159
|
-
var Playground = PlaygroundTemplate.bind({});
|
|
160
|
-
exports.Playground = Playground;
|
|
161
|
-
Playground.args = {
|
|
162
|
-
page: 1,
|
|
163
|
-
total: 85,
|
|
164
|
-
limit: 10,
|
|
165
|
-
isChangingPage: false,
|
|
166
|
-
isMobile: false,
|
|
167
|
-
translate: {
|
|
168
|
-
of: 'de',
|
|
169
|
-
table_no_results: 'Sin resultados',
|
|
170
|
-
table_button_previous: 'Anterior',
|
|
171
|
-
table_button_next: 'Siguiente'
|
|
172
|
-
},
|
|
173
|
-
ariaLabelNav: 'Paginación de resultados',
|
|
174
|
-
ariaLabelPrevious: 'Página anterior',
|
|
175
|
-
ariaLabelNext: 'Página siguiente',
|
|
176
|
-
ariaLabelSelectPage: 'Ir a otra página',
|
|
177
|
-
xs: 12,
|
|
178
|
-
md: 12,
|
|
179
|
-
lg: 12
|
|
180
|
-
};
|
|
181
|
-
var TemplatePaginationFooter = function TemplatePaginationFooter(args) {
|
|
182
|
-
return /*#__PURE__*/_react["default"].createElement(_DesignPaginationFooter["default"], args);
|
|
183
|
-
};
|
|
184
|
-
TemplatePaginationFooter.displayName = "TemplatePaginationFooter";
|
|
185
|
-
var DesignTemplatePaginationFooter = TemplatePaginationFooter.bind({});
|
|
186
|
-
exports.DesignTemplatePaginationFooter = DesignTemplatePaginationFooter;
|
|
187
|
-
DesignTemplatePaginationFooter.parameters = {
|
|
188
|
-
controls: {
|
|
189
|
-
disable: true
|
|
190
|
-
}
|
|
191
|
-
};
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = exports.Group = exports.Default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _Radio = _interopRequireDefault(require("./Radio"));
|
|
10
|
-
var _excluded = ["onChange"];
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
|
|
13
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
14
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
18
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
21
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
22
|
-
var _default = {
|
|
23
|
-
title: 'Components/Radio',
|
|
24
|
-
component: _Radio["default"],
|
|
25
|
-
argTypes: {
|
|
26
|
-
label: {
|
|
27
|
-
control: 'text'
|
|
28
|
-
},
|
|
29
|
-
checked: {
|
|
30
|
-
control: 'boolean'
|
|
31
|
-
},
|
|
32
|
-
disabled: {
|
|
33
|
-
control: 'boolean'
|
|
34
|
-
},
|
|
35
|
-
name: {
|
|
36
|
-
control: 'text'
|
|
37
|
-
},
|
|
38
|
-
value: {
|
|
39
|
-
control: 'text'
|
|
40
|
-
},
|
|
41
|
-
ariaLabel: {
|
|
42
|
-
control: 'text',
|
|
43
|
-
description: 'Nombre accesible si no hay label.'
|
|
44
|
-
},
|
|
45
|
-
onChange: {
|
|
46
|
-
action: 'onChange'
|
|
47
|
-
},
|
|
48
|
-
onClick: {
|
|
49
|
-
action: 'onClick'
|
|
50
|
-
},
|
|
51
|
-
id: {
|
|
52
|
-
control: 'text'
|
|
53
|
-
},
|
|
54
|
-
className: {
|
|
55
|
-
control: 'text'
|
|
56
|
-
},
|
|
57
|
-
style: {
|
|
58
|
-
control: 'object'
|
|
59
|
-
},
|
|
60
|
-
styles: {
|
|
61
|
-
control: 'object'
|
|
62
|
-
},
|
|
63
|
-
sx: {
|
|
64
|
-
control: 'object'
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
parameters: {
|
|
68
|
-
docs: {
|
|
69
|
-
description: {
|
|
70
|
-
component: "\n## Radio\n\nBot\xF3n de opci\xF3n para elegir un \xFAnico valor dentro de un grupo de opciones excluyentes. Usa el `input type=\"radio\"` nativo, con un dise\xF1o propio y efecto ripple al hacer clic.\n\n## Funcionamiento\n\n- `checked` y `onChange`: componente controlado. El consumidor decide qu\xE9 opci\xF3n est\xE1 marcada.\n- `name`: agrupa las opciones. Todos los `Radio` de un mismo grupo deben compartir `name`.\n- `label`: texto visible de la opci\xF3n.\n- `disabled`: deshabilita la opci\xF3n.\n- `id`: identificador del `input`. Si no se indica, se genera uno autom\xE1ticamente.\n- El resto de props se pasan al `input` nativo (`value`, `required`...).\n\n## Accesibilidad\n\n### Etiqueta y nombre accesible\n\n- Con `label`, el texto se renderiza en un `label` vinculado al `input` con `htmlFor`, as\xED que hacer clic en el texto tambi\xE9n marca la opci\xF3n.\n- Sin `label`, el nombre se toma de `ariaLabel` (`aria-label`), y tambi\xE9n se a\xF1ade como texto oculto (`sr-only`) en el `label`.\n- Integra `useA11yGuard`: en modo estricto exige `label` o `ariaLabel`.\n\n### Teclado y estados\n\n- Al ser un `input` nativo, mantiene el comportamiento est\xE1ndar: **Tab** entra en el grupo y las **flechas** cambian la opci\xF3n dentro de un mismo `name`.\n- `checked` y `disabled` usan los atributos nativos, de modo que el lector de pantalla anuncia \"marcado\" / \"no marcado\" y \"no disponible\".\n\n### Iconograf\xEDa\n\n- El c\xEDrculo visual es decorativo (`aria-hidden=\"true\"`); el estado lo comunica el `input` nativo.\n\n## Recomendaciones de uso\n\n- Agrupar las opciones relacionadas dentro de un `fieldset` con `legend` (o un contenedor con `role=\"radiogroup\"` y `aria-labelledby`), para que el lector anuncie la pregunta del grupo.\n- Usar siempre el mismo `name` en todas las opciones del grupo, o la navegaci\xF3n con flechas no funcionar\xE1.\n- Usar `Checkbox` si se pueden elegir varias opciones a la vez.\n\n## Consideraciones\n\n- El componente no crea el grupo: el `fieldset` o `radiogroup` lo debe poner el consumidor.\n- Si no se pasa `label` ni `ariaLabel`, el nombre accesible es el texto gen\xE9rico en ingl\xE9s \"Selection option\"."
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
storybookCodePanel: {
|
|
74
|
-
disabled: false,
|
|
75
|
-
files: [{
|
|
76
|
-
fileName: 'Radio.js',
|
|
77
|
-
// eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
|
|
78
|
-
code: require('!!raw-loader!./Radio.jsx')
|
|
79
|
-
}]
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
exports["default"] = _default;
|
|
84
|
-
var Template = function Template(_ref) {
|
|
85
|
-
var onChange = _ref.onChange,
|
|
86
|
-
args = _objectWithoutProperties(_ref, _excluded);
|
|
87
|
-
var _useState = (0, _react.useState)(args.checked),
|
|
88
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
89
|
-
checked = _useState2[0],
|
|
90
|
-
setChecked = _useState2[1];
|
|
91
|
-
var handleChange = function handleChange(event) {
|
|
92
|
-
setChecked(event.target.checked);
|
|
93
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
94
|
-
};
|
|
95
|
-
(0, _react.useEffect)(function () {
|
|
96
|
-
setChecked(args.checked);
|
|
97
|
-
}, [args.checked]);
|
|
98
|
-
return /*#__PURE__*/_react["default"].createElement(_Radio["default"], _extends({}, args, {
|
|
99
|
-
checked: checked,
|
|
100
|
-
onChange: handleChange
|
|
101
|
-
}));
|
|
102
|
-
};
|
|
103
|
-
Template.displayName = "Template";
|
|
104
|
-
var Default = Template.bind({});
|
|
105
|
-
exports.Default = Default;
|
|
106
|
-
Default.args = {
|
|
107
|
-
label: 'Radio button',
|
|
108
|
-
checked: true,
|
|
109
|
-
disabled: false,
|
|
110
|
-
name: 'demo',
|
|
111
|
-
value: 'demo'
|
|
112
|
-
};
|
|
113
|
-
var Group = function Group(_ref2) {
|
|
114
|
-
var disabled = _ref2.disabled;
|
|
115
|
-
var _useState3 = (0, _react.useState)('ordinary'),
|
|
116
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
117
|
-
selected = _useState4[0],
|
|
118
|
-
setSelected = _useState4[1];
|
|
119
|
-
var options = [{
|
|
120
|
-
value: 'ordinary',
|
|
121
|
-
label: 'Ordinaria'
|
|
122
|
-
}, {
|
|
123
|
-
value: 'extraordinary',
|
|
124
|
-
label: 'Extraordinaria'
|
|
125
|
-
}, {
|
|
126
|
-
value: 'universal',
|
|
127
|
-
label: 'Universal'
|
|
128
|
-
}];
|
|
129
|
-
return /*#__PURE__*/_react["default"].createElement("fieldset", {
|
|
130
|
-
style: {
|
|
131
|
-
border: 0,
|
|
132
|
-
padding: 0
|
|
133
|
-
}
|
|
134
|
-
}, /*#__PURE__*/_react["default"].createElement("legend", null, "Tipo de junta"), options.map(function (option) {
|
|
135
|
-
return /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
136
|
-
key: option.value,
|
|
137
|
-
name: "meeting-type",
|
|
138
|
-
value: option.value,
|
|
139
|
-
label: option.label,
|
|
140
|
-
checked: selected === option.value,
|
|
141
|
-
disabled: disabled,
|
|
142
|
-
onChange: function onChange(event) {
|
|
143
|
-
return setSelected(event.target.value);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}));
|
|
147
|
-
};
|
|
148
|
-
exports.Group = Group;
|
|
149
|
-
Group.displayName = "Group";
|
|
150
|
-
Group.args = {
|
|
151
|
-
disabled: false
|
|
152
|
-
};
|
|
153
|
-
Group.parameters = {
|
|
154
|
-
controls: {
|
|
155
|
-
include: ['disabled']
|
|
156
|
-
}
|
|
157
|
-
};
|