@councilbox/councilbox-ui 2.0.59 → 2.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/SafeHtml.js +3 -0
  2. package/dist/HOCs/overlayA11yStack.js +1 -1
  3. package/dist/HOCs/useDynamicStyles.js +39 -4
  4. package/dist/build-index.js +14 -0
  5. package/dist/components/Accordion/Accordion.css +7 -1
  6. package/dist/components/Accordion/Accordion.js +2 -2
  7. package/dist/components/Button/Button.js +79 -87
  8. package/dist/components/Button/button.css +171 -16
  9. package/dist/components/DatePicker/Calendar.js +3 -5
  10. package/dist/components/DatePicker/DatePicker.css +1 -1
  11. package/dist/components/DateRangePicker/RangeCalendar.js +2 -4
  12. package/dist/components/IconButton/IconButton.js +1 -1
  13. package/dist/components/Modal/Modal.js +13 -3
  14. package/dist/components/RichTextInput/RichTextInput.js +28 -7
  15. package/dist/components/SafeHtml/SafeHtml.js +82 -0
  16. package/dist/components/SelectInput/SelectInput.js +1 -0
  17. package/dist/components/Stepper/Stepper.css +6 -1
  18. package/dist/components/Tabs/Tabs.js +1 -0
  19. package/dist/components/TextInput/TextInput.css +164 -1
  20. package/dist/components/TextInput/TextInput.js +171 -167
  21. package/dist/components/ThemeProvider/Colors.js +1 -1
  22. package/dist/components/ThemeProvider/ThemeProvider.js +1 -7
  23. package/dist/components/Toast/toastStore.js +1 -0
  24. package/dist/styles/colorConsts.css +1 -1
  25. package/dist/styles/stylesheet.js +2 -50
  26. package/dist/testing/TestAutocomplete.js +1 -105
  27. package/dist/utils/sanitizeHtml.js +199 -0
  28. package/package.json +17 -31
  29. package/dist/__snapshots__/storybook.test.js.snap +0 -104
  30. package/dist/components/1.Introduction.stories.mdx +0 -579
  31. package/dist/components/2.Changelog.stories.mdx +0 -1392
  32. package/dist/components/3.Guide.stories.mdx +0 -589
  33. package/dist/components/Accordion/Accordion.stories.js +0 -95
  34. package/dist/components/Accordion/DesignAccordion.stories.js +0 -27
  35. package/dist/components/Alert/Alert.stories.js +0 -101
  36. package/dist/components/Avatar/Avatar.stories.js +0 -159
  37. package/dist/components/Avatar/DesignAvatar.stories.js +0 -64
  38. package/dist/components/Avatar/DesignAvatarText.stories.js +0 -123
  39. package/dist/components/AvatarGroup/AvatarGroup.stories.js +0 -72
  40. package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +0 -118
  41. package/dist/components/Block/Block.stories.js +0 -66
  42. package/dist/components/Block/DesignBlock.stories.js +0 -35
  43. package/dist/components/Button/Button.stories.js +0 -98
  44. package/dist/components/ButtonBasic/ButtonBasic.stories.js +0 -161
  45. package/dist/components/Checkbox/Checkbox.stories.js +0 -110
  46. package/dist/components/DatePicker/DatePicker.stories.js +0 -180
  47. package/dist/components/DateRangePicker/DateRangePicker.stories.js +0 -147
  48. package/dist/components/DateTimePicker/DateTimePicker.stories.js +0 -144
  49. package/dist/components/DragDrop/DragDrop.stories.js +0 -155
  50. package/dist/components/DrawerPanel/DrawerPanel.stories.js +0 -277
  51. package/dist/components/DropDown/DesignDropDown.stories.js +0 -216
  52. package/dist/components/DropDown/DropDown.stories.js +0 -240
  53. package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +0 -128
  54. package/dist/components/EnhancedTable/EnhancedTable.stories.js +0 -259
  55. package/dist/components/FabButton/DesignFabButton.stories.js +0 -40
  56. package/dist/components/FabButton/FabButton.stories.js +0 -147
  57. package/dist/components/Grid/DesignGrid.stories.js +0 -45
  58. package/dist/components/Grid/Grid.stories.js +0 -211
  59. package/dist/components/Header/DesignHeader.stories.js +0 -65
  60. package/dist/components/Header/Header.stories.js +0 -674
  61. package/dist/components/IconButton/DesignIconButton.stories.js +0 -113
  62. package/dist/components/IconButton/IconButton.stories.js +0 -205
  63. package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +0 -21
  64. package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +0 -209
  65. package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +0 -433
  66. package/dist/components/InputPassword/InputPassword.stories.js +0 -185
  67. package/dist/components/InputText/InputText.stories.js +0 -261
  68. package/dist/components/InputTextArea/DesignInputTextArea.stories.js +0 -116
  69. package/dist/components/InputTextArea/InputTextArea.stories.js +0 -146
  70. package/dist/components/LoadingSection/LoadingSection.stories.js +0 -84
  71. package/dist/components/MenuItem/DesignMenuItem.stories.js +0 -54
  72. package/dist/components/MenuItem/MenuItem.stories.js +0 -138
  73. package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +0 -243
  74. package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +0 -228
  75. package/dist/components/Modal/DesignModal.stories.js +0 -39
  76. package/dist/components/Modal/Modal.stories.js +0 -229
  77. package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +0 -22
  78. package/dist/components/PaginationFooter/PaginationFooter.stories.js +0 -191
  79. package/dist/components/RadioButton/Radio.stories.js +0 -157
  80. package/dist/components/RichTextInput/DesignRichTextInput.stories.js +0 -119
  81. package/dist/components/RichTextInput/RichTextInput.stories.js +0 -38
  82. package/dist/components/Ripple/Ripple.stories.js +0 -107
  83. package/dist/components/Scrollbar/Scrollbar.stories.js +0 -42
  84. package/dist/components/ScrollbarOld/ScrollbarOld.stories.js +0 -140
  85. package/dist/components/SelectInput/SelectInput.stories.js +0 -212
  86. package/dist/components/Slider/Slider.stories.js +0 -128
  87. package/dist/components/Spacing/Spacing.stories.js +0 -37
  88. package/dist/components/Stars/Stars.stories.js +0 -138
  89. package/dist/components/Stepper/DesignStepper.stories.js +0 -130
  90. package/dist/components/Stepper/Stepper.stories.js +0 -131
  91. package/dist/components/Table/DesignTable.stories.js +0 -614
  92. package/dist/components/Table/Table.stories.js +0 -215
  93. package/dist/components/Tabs/Tabs.stories.js +0 -163
  94. package/dist/components/Tag/DesignTags.stories.js +0 -81
  95. package/dist/components/Tag/Tag.stories.js +0 -148
  96. package/dist/components/TextInput/TextInput.stories.js +0 -148
  97. package/dist/components/TimePicker/TimePicker.stories.js +0 -132
  98. package/dist/components/Timeline/DesignTimeline.stories.js +0 -19
  99. package/dist/components/Timeline/Timeline.stories.js +0 -128
  100. package/dist/components/Toast/DesignToast.stories.js +0 -174
  101. package/dist/components/Toast/Toast.stories.js +0 -39
  102. package/dist/components/Toggle/Toggle.stories.js +0 -118
  103. package/dist/components/Tooltip/DesignTooltip.stories.js +0 -45
  104. package/dist/components/Tooltip/Tooltip.stories.js +0 -135
  105. package/dist/components/Typography/Typography.stories.js +0 -114
  106. package/dist/reportWebVitals.js +0 -28
  107. package/dist/storybook.test.js +0 -5
@@ -1,433 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.Success = exports.Multiple = exports.Helper = exports.ErrorTemplate = exports.Disabled = exports.Default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _InputAutocomplete = _interopRequireDefault(require("./InputAutocomplete"));
9
- var _Checkbox = _interopRequireDefault(require("../Checkbox/Checkbox"));
10
- var _excluded = ["value", "onChange"],
11
- _excluded2 = ["onChange"];
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
14
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
16
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
17
- 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); }
18
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
19
- 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."); }
20
- 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; } }
21
- 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; }
22
- 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; } }
23
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
24
- 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; }
25
- 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; }
26
- var _default = {
27
- title: 'Components/Input Autocomplete',
28
- component: _InputAutocomplete["default"],
29
- argTypes: {
30
- label: {
31
- control: 'text'
32
- },
33
- placeholder: {
34
- control: 'text'
35
- },
36
- options: {
37
- control: 'object',
38
- description: 'Lista de opciones (textos u objetos con label/value).'
39
- },
40
- value: {
41
- control: 'object',
42
- description: 'Opción seleccionada (o array en modo múltiple).'
43
- },
44
- variant: {
45
- options: ['outlined', 'filled', 'standard'],
46
- control: {
47
- type: 'radio'
48
- }
49
- },
50
- required: {
51
- control: 'boolean'
52
- },
53
- disabled: {
54
- control: 'boolean'
55
- },
56
- fullWidth: {
57
- control: 'boolean'
58
- },
59
- clearable: {
60
- control: 'boolean'
61
- },
62
- freeSolo: {
63
- control: 'boolean',
64
- description: 'Permite texto que no es una opción.'
65
- },
66
- clearOnBlur: {
67
- control: 'boolean'
68
- },
69
- selectOnFocus: {
70
- control: 'boolean'
71
- },
72
- loading: {
73
- control: 'boolean'
74
- },
75
- loadingText: {
76
- control: 'text'
77
- },
78
- error: {
79
- control: 'text'
80
- },
81
- success: {
82
- control: 'boolean'
83
- },
84
- helper: {
85
- control: 'text'
86
- },
87
- autoComplete: {
88
- control: 'text'
89
- },
90
- 'aria-label': {
91
- control: 'text'
92
- },
93
- onChange: {
94
- action: 'onChange'
95
- },
96
- onInputChange: {
97
- action: 'onInputChange'
98
- },
99
- InputProps: {
100
- control: 'object'
101
- },
102
- id: {
103
- control: 'text'
104
- },
105
- className: {
106
- control: 'text'
107
- },
108
- style: {
109
- control: 'object'
110
- },
111
- styles: {
112
- control: 'object'
113
- },
114
- sx: {
115
- control: 'object'
116
- },
117
- multiple: {
118
- control: false,
119
- description: 'Ver la story "Multiple".'
120
- },
121
- inputValue: {
122
- control: false
123
- },
124
- defaultValue: {
125
- control: false
126
- },
127
- getOptionLabel: {
128
- control: false
129
- },
130
- getOptionValue: {
131
- control: false
132
- },
133
- getOptionSelected: {
134
- control: false
135
- },
136
- filterOptions: {
137
- control: false
138
- },
139
- renderValue: {
140
- control: false
141
- },
142
- renderOption: {
143
- control: false
144
- },
145
- noOptionsText: {
146
- table: {
147
- disable: true
148
- }
149
- },
150
- children: {
151
- table: {
152
- disable: true
153
- }
154
- },
155
- prefixClass: {
156
- table: {
157
- disable: true
158
- }
159
- }
160
- },
161
- parameters: {
162
- docs: {
163
- description: {
164
- component: "\n## InputAutocomplete\n\nCampo de texto con sugerencias: al escribir, filtra una lista de opciones y permite elegir una (o varias). Su API est\xE1 inspirada en el `Autocomplete` de MUI.\n\n## Funcionamiento\n\n### Opciones y valor\n\n- `options`: lista de opciones. Pueden ser textos u objetos.\n- `getOptionLabel(opci\xF3n)`: texto que se muestra de cada opci\xF3n. Por defecto usa `label`, `text`, `translation` o `value`.\n- `getOptionValue(opci\xF3n)`: valor de cada opci\xF3n. Por defecto usa `value` o `id`.\n- `getOptionSelected(opci\xF3n, valor)`: indica si una opci\xF3n est\xE1 seleccionada.\n- `value`, `defaultValue` y `onChange(evento, valor)`: valor seleccionado.\n- `multiple`: permite elegir varias opciones; `value` es un array.\n- `renderOption(opci\xF3n)`: personaliza c\xF3mo se pinta cada opci\xF3n.\n\n### Texto y filtrado\n\n- `inputValue` y `onInputChange(evento, texto)`: texto escrito en el campo (controlado o no).\n- `filterOptions(opciones, { inputValue })`: filtrado propio. Por defecto filtra las opciones cuyo texto contiene lo escrito.\n- `freeSolo`: permite dejar un texto que no coincide con ninguna opci\xF3n.\n- `clearOnBlur` (por defecto `true`) y `selectOnFocus`: comportamiento del texto al salir y entrar en el campo.\n\n### Carga y limpieza\n\n- `loading`: muestra un indicador de carga y el texto `loadingText` (\"Buscando resultados...\" por defecto) en la lista, \xFAtil para b\xFAsquedas en el servidor.\n- `clearable` (por defecto `true`): muestra un bot\xF3n para borrar el valor.\n\n## Accesibilidad\n\n### Campo\n\n- El campo tiene `role=\"combobox\"`, `aria-autocomplete=\"list\"`, `aria-expanded` y `aria-controls` apuntando a la lista.\n- Durante la carga lleva `aria-busy=\"true\"`.\n- Integra `useA11yGuard`: en modo estricto exige `label`, `aria-label` o `placeholder`.\n\n### Lista de sugerencias\n\n- La lista tiene `role=\"listbox\"` y cada sugerencia `role=\"option\"` con `aria-selected`.\n- El texto de carga es una regi\xF3n `role=\"status\"` con `aria-live=\"polite\"`, que se anuncia mientras se buscan resultados.\n\n### Teclado\n\n- **Flecha abajo** / **Flecha arriba**: abren la lista y mueven el foco entre las sugerencias.\n- **Enter**: abre la lista desde el campo; sobre una sugerencia, la elige.\n- **Escape**: cierra la lista (desde el campo o desde una sugerencia).\n- **Tab**: cierra la lista y devuelve el foco al campo.\n\n## Recomendaciones de uso\n\n- Usar siempre `label` visible y pasar `loadingText` traducido.\n- Si no hay resultados, mostrar un mensaje propio cerca del campo, ya que el componente no muestra ni anuncia \"sin resultados\" (ver Consideraciones).\n- Para listas cortas y cerradas, usar `SelectInput`.\n\n## Consideraciones\n\n- Cuando el filtro no devuelve ninguna opci\xF3n, la lista simplemente se cierra: no hay mensaje de \"sin resultados\" ni se anuncia.\n- El n\xFAmero de sugerencias disponibles no se anuncia al escribir.\n- El foco se mueve f\xEDsicamente a las sugerencias (no se usa `aria-activedescendant`), por lo que para seguir escribiendo hay que volver al campo.\n- El bot\xF3n de borrar est\xE1 fuera del orden de tabulaci\xF3n y no tiene `aria-label` propio (el `IconButton` usa el texto gen\xE9rico \"Bot\xF3n\")."
165
- }
166
- },
167
- storybookCodePanel: {
168
- disabled: false,
169
- files: [{
170
- fileName: 'InputAutocomplete.js',
171
- // eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
172
- code: require('!!raw-loader!./InputAutocomplete.jsx')
173
- }]
174
- }
175
- }
176
- };
177
- exports["default"] = _default;
178
- var Template = function Template(_ref) {
179
- var valueArg = _ref.value,
180
- _onChange = _ref.onChange,
181
- args = _objectWithoutProperties(_ref, _excluded);
182
- var _React$useState = _react["default"].useState(valueArg !== null && valueArg !== void 0 ? valueArg : null),
183
- _React$useState2 = _slicedToArray(_React$useState, 2),
184
- value = _React$useState2[0],
185
- setValue = _React$useState2[1];
186
- _react["default"].useEffect(function () {
187
- return setValue(valueArg !== null && valueArg !== void 0 ? valueArg : null);
188
- }, [valueArg]);
189
- return /*#__PURE__*/_react["default"].createElement(_InputAutocomplete["default"], _extends({}, args, {
190
- value: value,
191
- onChange: function onChange(event, newValue) {
192
- setValue(newValue);
193
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(event, newValue);
194
- }
195
- }));
196
- };
197
- Template.displayName = "Template";
198
- var Default = Template.bind({});
199
- exports.Default = Default;
200
- Default.args = {
201
- variant: 'outlined',
202
- options: [{
203
- translation: 'Todo',
204
- value: 'all'
205
- }, {
206
- translation: '4',
207
- value: 'statute_4166'
208
- }, {
209
- translation: '5',
210
- value: 'statute_4167'
211
- }, {
212
- translation: 'DemoTrámite',
213
- value: 'statute_4194'
214
- }, {
215
- translation: 'editado para docu required',
216
- value: 'statute_4136'
217
- }, {
218
- translation: 'Gestión de prueba para tener un ejemplo',
219
- value: 'statute_4226'
220
- }, {
221
- translation: 'ghjghjghj',
222
- value: 'statute_4243'
223
- }],
224
- label: 'Trámite',
225
- placeholder: 'Busca un trámite',
226
- value: null,
227
- required: false,
228
- disabled: false,
229
- fullWidth: false,
230
- clearable: true,
231
- freeSolo: false,
232
- loading: false,
233
- loadingText: 'Buscando resultados...',
234
- error: '',
235
- helper: ''
236
- };
237
- var Helper = Template.bind({});
238
- exports.Helper = Helper;
239
- Helper.args = {
240
- value: 'The Godfather',
241
- helper: 'Helper',
242
- variant: 'outlined',
243
- options: [{
244
- label: 'The Shawshank Redemption The Shawshank Redemption',
245
- value: 1994
246
- }, {
247
- label: 'The Godfather',
248
- value: 1972
249
- }, {
250
- label: 'The Godfather: Part II',
251
- value: 1974
252
- }, {
253
- label: 'The Dark Knight',
254
- value: 2008
255
- }, {
256
- label: '12 Angry Men',
257
- value: 1957
258
- }, {
259
- label: "Schindler's List",
260
- value: 1993
261
- }, {
262
- label: 'Pulp Fiction',
263
- value: 1994
264
- }]
265
- };
266
- var Success = Template.bind({});
267
- exports.Success = Success;
268
- Success.args = {
269
- value: 'Occaecat',
270
- success: true,
271
- options: [{
272
- label: 'The Shawshank Redemption The Shawshank Redemption',
273
- value: 1994
274
- }, {
275
- label: 'The Godfather',
276
- value: 1972
277
- }, {
278
- label: 'The Godfather: Part II',
279
- value: 1974
280
- }, {
281
- label: 'The Dark Knight',
282
- value: 2008
283
- }, {
284
- label: '12 Angry Men',
285
- value: 1957
286
- }, {
287
- label: "Schindler's List",
288
- value: 1993
289
- }, {
290
- label: 'Pulp Fiction',
291
- value: 1994
292
- }]
293
- };
294
- var Disabled = Template.bind({});
295
- exports.Disabled = Disabled;
296
- Disabled.args = {
297
- value: 'Occaecat',
298
- disabled: true,
299
- options: [{
300
- label: 'The Shawshank Redemption The Shawshank Redemption',
301
- value: 1994
302
- }, {
303
- label: 'The Godfather',
304
- value: 1972
305
- }, {
306
- label: 'The Godfather: Part II',
307
- value: 1974
308
- }, {
309
- label: 'The Dark Knight',
310
- value: 2008
311
- }, {
312
- label: '12 Angry Men',
313
- value: 1957
314
- }, {
315
- label: "Schindler's List",
316
- value: 1993
317
- }, {
318
- label: 'Pulp Fiction',
319
- value: 1994
320
- }]
321
- };
322
- var ErrorTemplate = Template.bind({});
323
- exports.ErrorTemplate = ErrorTemplate;
324
- ErrorTemplate.args = {
325
- value: 'Occaecat',
326
- error: 'Error',
327
- options: [{
328
- label: 'The Shawshank Redemption The Shawshank Redemption',
329
- value: 1994
330
- }, {
331
- label: 'The Godfather',
332
- value: 1972
333
- }, {
334
- label: 'The Godfather: Part II',
335
- value: 1974
336
- }, {
337
- label: 'The Dark Knight',
338
- value: 2008
339
- }, {
340
- label: '12 Angry Men',
341
- value: 1957
342
- }, {
343
- label: "Schindler's List",
344
- value: 1993
345
- }, {
346
- label: 'Pulp Fiction',
347
- value: 1994
348
- }]
349
- };
350
- var ALL = '__all__';
351
- var PEOPLE = [{
352
- id: 1,
353
- name: 'Ada Lovelace'
354
- }, {
355
- id: 2,
356
- name: 'Alan Turing'
357
- }, {
358
- id: 3,
359
- name: 'Grace Hopper'
360
- }, {
361
- id: 4,
362
- name: 'Katherine Johnson'
363
- }, {
364
- id: 5,
365
- name: 'Linus Torvalds'
366
- }];
367
- var multipleRowStyle = {
368
- display: 'flex',
369
- alignItems: 'center',
370
- width: '100%'
371
- };
372
- var MultipleTemplate = function MultipleTemplate(_ref2) {
373
- var onChange = _ref2.onChange,
374
- args = _objectWithoutProperties(_ref2, _excluded2);
375
- var _React$useState3 = _react["default"].useState(args.value || []),
376
- _React$useState4 = _slicedToArray(_React$useState3, 2),
377
- value = _React$useState4[0],
378
- setValue = _React$useState4[1];
379
- var allSelected = value.length === PEOPLE.length;
380
- var options = [].concat(_toConsumableArray(allSelected ? [] : [{
381
- id: ALL,
382
- isAllOption: true
383
- }]), PEOPLE);
384
- var handleChange = function handleChange(ev) {
385
- var newValues = ev.target.value;
386
- setValue(newValues.includes(ALL) ? PEOPLE.map(function (person) {
387
- return person.id;
388
- }) : newValues);
389
- onChange === null || onChange === void 0 ? void 0 : onChange(ev);
390
- };
391
- return /*#__PURE__*/_react["default"].createElement(_InputAutocomplete["default"], _extends({}, args, {
392
- multiple: true,
393
- options: options,
394
- value: value,
395
- onChange: handleChange,
396
- getOptionLabel: function getOptionLabel(option) {
397
- return option.isAllOption ? 'Select all' : option.name;
398
- },
399
- getOptionSelected: function getOptionSelected(option) {
400
- return option.isAllOption ? allSelected : value.includes(option.id);
401
- },
402
- renderValue: function renderValue(selected) {
403
- return selected.length === PEOPLE.length ? 'All' : selected.map(function (id) {
404
- var _PEOPLE$find;
405
- return (_PEOPLE$find = PEOPLE.find(function (person) {
406
- return person.id === id;
407
- })) === null || _PEOPLE$find === void 0 ? void 0 : _PEOPLE$find.name;
408
- }).join(', ');
409
- },
410
- renderOption: function renderOption(option) {
411
- var checked = option.isAllOption ? allSelected : value.includes(option.id);
412
- return /*#__PURE__*/_react["default"].createElement("div", {
413
- style: multipleRowStyle
414
- }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
415
- checked: checked,
416
- label: option.isAllOption ? 'Select all' : option.name
417
- }));
418
- }
419
- }));
420
- };
421
- MultipleTemplate.displayName = "MultipleTemplate";
422
- var Multiple = MultipleTemplate.bind({});
423
- exports.Multiple = Multiple;
424
- Multiple.args = {
425
- variant: 'outlined',
426
- label: 'People',
427
- value: [1, 3]
428
- };
429
- Multiple.parameters = {
430
- controls: {
431
- exclude: ['options', 'value']
432
- }
433
- };
@@ -1,185 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.Validation = exports.Helper = exports.ErrorTemplate = exports.Disabled = exports.Default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _InputPassword = _interopRequireDefault(require("./InputPassword"));
9
- var _excluded = ["value", "onChange"];
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
- 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); }
12
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
- 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."); }
14
- 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; } }
15
- 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; }
16
- 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; } }
17
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
18
- 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; }
19
- 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; }
20
- var _default = {
21
- title: 'Components/Input Password',
22
- component: _InputPassword["default"],
23
- argTypes: {
24
- label: {
25
- control: 'text'
26
- },
27
- value: {
28
- control: 'text'
29
- },
30
- placeholder: {
31
- control: 'text'
32
- },
33
- variant: {
34
- options: ['outlined', 'filled', 'standard'],
35
- control: {
36
- type: 'radio'
37
- }
38
- },
39
- required: {
40
- control: 'boolean'
41
- },
42
- disabled: {
43
- control: 'boolean'
44
- },
45
- fullWidth: {
46
- control: 'boolean'
47
- },
48
- error: {
49
- control: 'text',
50
- description: 'Mensaje de error (vacío para quitarlo).'
51
- },
52
- helper: {
53
- control: 'text'
54
- },
55
- validation: {
56
- control: 'boolean',
57
- description: 'Muestra la barra de seguridad.'
58
- },
59
- percentageError: {
60
- control: {
61
- type: 'range',
62
- min: 0,
63
- max: 100,
64
- step: 1
65
- },
66
- description: 'Seguridad de la contraseña (0-100).'
67
- },
68
- autoComplete: {
69
- control: 'select',
70
- options: ['off', 'current-password', 'new-password']
71
- },
72
- 'aria-label': {
73
- control: 'text'
74
- },
75
- onChange: {
76
- action: 'onChange'
77
- },
78
- onKeyUp: {
79
- action: 'onKeyUp'
80
- },
81
- onClick: {
82
- action: 'onClick'
83
- },
84
- id: {
85
- control: 'text'
86
- },
87
- className: {
88
- control: 'text'
89
- },
90
- width: {
91
- table: {
92
- disable: true
93
- }
94
- },
95
- helperText: {
96
- table: {
97
- disable: true
98
- }
99
- }
100
- },
101
- parameters: {
102
- docs: {
103
- description: {
104
- component: "\n## InputPassword\n\nCampo de contrase\xF1a basado en `InputText`, con un bot\xF3n para mostrar u ocultar el texto y una barra opcional que indica la seguridad de la contrase\xF1a.\n\n## Funcionamiento\n\n- Se comporta como un `InputText` de tipo `password`: admite `label`, `onChange`, `onKeyUp`, `error`, `helper`, `disabled`, `fullWidth` y el resto de props del campo.\n- **Mostrar / ocultar**: el bot\xF3n con el icono del ojo alterna el tipo del campo entre `password` y `text`.\n- **Barra de seguridad**: con `validation`, se muestra bajo el campo una barra que se rellena seg\xFAn `percentageError` (de 0 a 100):\n - Hasta 30: rojo, \"D\xE9bil\".\n - De 31 a 89: amarillo, \"Media\".\n - Desde 90: verde, \"Segura\".\n- El c\xE1lculo de `percentageError` lo hace el consumidor; el componente solo lo representa.\n\n## Accesibilidad\n\n### Etiqueta y nombre accesible\n\n- Hereda de `InputText` la vinculaci\xF3n del `label` con el campo, los mensajes de error y ayuda (`aria-describedby`, `aria-invalid`) y el anuncio del error con `role=\"alert\"`.\n- Integra `useA11yGuard`: en modo estricto exige `label` o `aria-label`.\n\n### Bot\xF3n de mostrar / ocultar\n\n- Es un `IconButton` accesible por teclado, con `aria-label` \"Mostrar contrase\xF1a\" u \"Ocultar contrase\xF1a\" seg\xFAn el estado.\n- Expone su estado con `aria-pressed` (activado cuando la contrase\xF1a se est\xE1 mostrando).\n- Se deshabilita junto con el campo.\n\n### Barra de seguridad\n\n- Se expone como `role=\"progressbar\"` con `aria-valuenow`, `aria-valuemin=\"0\"` y `aria-valuemax=\"100\"`.\n- Su nombre accesible indica el nivel en texto: \"Seguridad de la contrase\xF1a: D\xE9bil / Media / Segura\", de modo que no depende solo del color.\n\n## Recomendaciones de uso\n\n- Explicar los requisitos de la contrase\xF1a en `helper` antes de que el usuario escriba, no solo cuando falla.\n- Usar `autoComplete=\"new-password\"` en formularios de registro o cambio, y `autoComplete=\"current-password\"` en el inicio de sesi\xF3n, para que los gestores de contrase\xF1as funcionen bien.\n\n## Consideraciones\n\n- Los textos del bot\xF3n (\"Mostrar contrase\xF1a\" / \"Ocultar contrase\xF1a\") y de la barra de seguridad est\xE1n fijos en castellano y no se pueden traducir por props.\n- Los cambios de nivel de la barra de seguridad no se anuncian autom\xE1ticamente mientras se escribe; el lector solo los lee al llegar a la barra."
105
- }
106
- },
107
- storybookCodePanel: {
108
- disabled: false,
109
- files: [{
110
- fileName: 'InputPassword.js',
111
- // eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
112
- code: require('!!raw-loader!./InputPassword.jsx')
113
- }, {
114
- fileName: 'InputPassword.css',
115
- // eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
116
- code: require('!!raw-loader!./InputPassword.css')
117
- }]
118
- }
119
- }
120
- };
121
- exports["default"] = _default;
122
- var Template = function Template(_ref) {
123
- var valueArg = _ref.value,
124
- _onChange = _ref.onChange,
125
- args = _objectWithoutProperties(_ref, _excluded);
126
- var _React$useState = _react["default"].useState(valueArg !== null && valueArg !== void 0 ? valueArg : ''),
127
- _React$useState2 = _slicedToArray(_React$useState, 2),
128
- value = _React$useState2[0],
129
- setValue = _React$useState2[1];
130
- _react["default"].useEffect(function () {
131
- return setValue(valueArg !== null && valueArg !== void 0 ? valueArg : '');
132
- }, [valueArg]);
133
- return /*#__PURE__*/_react["default"].createElement(_InputPassword["default"], _extends({}, args, {
134
- value: value,
135
- onChange: function onChange(event) {
136
- setValue(event.target.value);
137
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(event);
138
- }
139
- }));
140
- };
141
- Template.displayName = "Template";
142
- var Default = Template.bind({});
143
- exports.Default = Default;
144
- Default.args = {
145
- variant: 'outlined',
146
- label: 'Contraseña',
147
- value: 'abc123.',
148
- required: false,
149
- disabled: false,
150
- fullWidth: false,
151
- error: '',
152
- helper: '',
153
- validation: false,
154
- percentageError: 0,
155
- autoComplete: 'current-password'
156
- };
157
- var Helper = Template.bind({});
158
- exports.Helper = Helper;
159
- Helper.args = {
160
- label: 'password',
161
- value: 'abc123.',
162
- helper: 'Enim anim occaecat'
163
- };
164
- var Validation = Template.bind({});
165
- exports.Validation = Validation;
166
- Validation.args = {
167
- label: 'password',
168
- value: 'abc123.',
169
- validation: true,
170
- percentageError: 54
171
- };
172
- var ErrorTemplate = Template.bind({});
173
- exports.ErrorTemplate = ErrorTemplate;
174
- ErrorTemplate.args = {
175
- label: 'password',
176
- value: 'abc123.',
177
- error: 'Enim anim occaecat'
178
- };
179
- var Disabled = Template.bind({});
180
- exports.Disabled = Disabled;
181
- Disabled.args = {
182
- label: 'Contraseña',
183
- value: 'Occaecat',
184
- disabled: true
185
- };