@widergy/energy-ui 3.138.2 → 3.138.4
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/CHANGELOG.md +14 -0
- package/dist/components/UTDataCategory/index.js +11 -2
- package/dist/components/UTRadioGroup/UTRadioGroup.mdx +1 -1
- package/dist/components/UTRadioGroup/UTRadioGroup.stories.js +292 -44
- package/dist/components/UTRadioGroup/versions/V0/index.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.138.4](https://github.com/widergy/energy-ui/compare/v3.138.3...v3.138.4) (2026-02-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* [CX-1935] Update test id support for UTRadioGroup v0 ([#766](https://github.com/widergy/energy-ui/issues/766)) ([6b5caae](https://github.com/widergy/energy-ui/commit/6b5caaeae33abdc1aaa3bd09a7133919b1a67be0))
|
|
7
|
+
|
|
8
|
+
## [3.138.3](https://github.com/widergy/energy-ui/compare/v3.138.2...v3.138.3) (2026-02-13)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* [OUG] data category fixes ([#765](https://github.com/widergy/energy-ui/issues/765)) ([5c7d558](https://github.com/widergy/energy-ui/commit/5c7d55817047e6ccb784809f2e16394f5f96b014))
|
|
14
|
+
|
|
1
15
|
## [3.138.2](https://github.com/widergy/energy-ui/compare/v3.138.1...v3.138.2) (2026-02-11)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -13,9 +13,11 @@ var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
|
13
13
|
var _UTButton = _interopRequireDefault(require("../UTButton"));
|
|
14
14
|
var _classesUtils = require("../../utils/classesUtils");
|
|
15
15
|
var _testIds = require("../../constants/testIds");
|
|
16
|
+
var _UTIcon = _interopRequireDefault(require("../UTIcon"));
|
|
16
17
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
18
|
var _theme = require("./theme");
|
|
18
19
|
var _constants = require("./constants");
|
|
20
|
+
var _MainAction = _interopRequireDefault(require("../UTDataElement/components/MainAction"));
|
|
19
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (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 (const 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); }
|
|
21
23
|
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); }
|
|
@@ -24,6 +26,7 @@ const {
|
|
|
24
26
|
} = _testIds.TEST_IDS;
|
|
25
27
|
const UTDataCategory = _ref => {
|
|
26
28
|
let {
|
|
29
|
+
action,
|
|
27
30
|
area,
|
|
28
31
|
classes: theme,
|
|
29
32
|
classNames,
|
|
@@ -32,9 +35,12 @@ const UTDataCategory = _ref => {
|
|
|
32
35
|
elements = [],
|
|
33
36
|
elementsProps = {},
|
|
34
37
|
expanded = false,
|
|
38
|
+
Icon,
|
|
39
|
+
iconProps,
|
|
35
40
|
title,
|
|
36
41
|
titleProps
|
|
37
42
|
} = _ref;
|
|
43
|
+
const IconComponent = typeof Icon === 'string' ? _UTIcon.default : Icon;
|
|
38
44
|
const showTitle = !!title;
|
|
39
45
|
const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(theme, classNames), [classNames, theme]);
|
|
40
46
|
const [isCollapsed, setIsCollapsed] = (0, _react.useState)(showTitle && collapsable && !expanded);
|
|
@@ -47,7 +53,10 @@ const UTDataCategory = _ref => {
|
|
|
47
53
|
"data-testid": dataTestId ? "".concat(dataTestId, ".").concat(dataCategory.container) : undefined
|
|
48
54
|
}, title && /*#__PURE__*/_react.default.createElement("div", {
|
|
49
55
|
className: _stylesModule.default.title
|
|
50
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
56
|
+
}, IconComponent && /*#__PURE__*/_react.default.createElement(IconComponent, _extends({
|
|
57
|
+
name: Icon,
|
|
58
|
+
colorTheme: "gray"
|
|
59
|
+
}, iconProps)), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
51
60
|
colorTheme: "gray",
|
|
52
61
|
weight: "medium"
|
|
53
62
|
}, titleProps), title), collapsable && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -58,7 +67,7 @@ const UTDataCategory = _ref => {
|
|
|
58
67
|
onClick: toggleCollapsed,
|
|
59
68
|
size: "small",
|
|
60
69
|
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(dataCategory.collapseButton) : undefined
|
|
61
|
-
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
70
|
+
})), action && /*#__PURE__*/_react.default.createElement(_MainAction.default, action)), /*#__PURE__*/_react.default.createElement("div", {
|
|
62
71
|
style: {
|
|
63
72
|
gridTemplateRows: isCollapsed ? '0fr' : '1fr',
|
|
64
73
|
marginTop: isCollapsed || !showTitle ? 0 : 16
|
|
@@ -12,6 +12,6 @@ import * as UTRadioGroupStories from './UTRadioGroup.stories';
|
|
|
12
12
|
|
|
13
13
|
Esta documentación corresponde a **UTRadioGroup V1**. La versión anterior (V0) no está documentada y se mantiene únicamente para compatibilidad hacia atrás.
|
|
14
14
|
|
|
15
|
-
<Canvas of={UTRadioGroupStories.
|
|
15
|
+
<Canvas of={UTRadioGroupStories.Playground} name="UTRadioGroup" version="V1" />
|
|
16
16
|
|
|
17
17
|
<ArgTypes exclude={['classes', 'style', 'title']} />
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.
|
|
6
|
+
exports.default = exports.V1Categorized = exports.V1CardVariant = exports.V1ButtonVariant = exports.V0WithField = exports.V0WithDividers = exports.V0Disabled = exports.V0Basic = exports.Playground = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _previewApi = require("@storybook/preview-api");
|
|
8
9
|
var _utils = require("stories/utils");
|
|
9
10
|
var _constants = require("../UTCheckbox/versions/V1/constants");
|
|
10
11
|
var _constants2 = require("./versions/V1/components/Radio/constants");
|
|
11
|
-
var
|
|
12
|
+
var _ = _interopRequireDefault(require("."));
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
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
15
|
const defaultOptions = [{
|
|
@@ -28,14 +29,28 @@ const defaultOptions = [{
|
|
|
28
29
|
}];
|
|
29
30
|
var _default = exports.default = {
|
|
30
31
|
args: {
|
|
32
|
+
version: 'V1',
|
|
31
33
|
options: defaultOptions,
|
|
32
34
|
title: 'Selecciona una opción',
|
|
33
35
|
value: ''
|
|
34
36
|
},
|
|
35
37
|
argTypes: {
|
|
38
|
+
version: {
|
|
39
|
+
control: 'inline-radio',
|
|
40
|
+
options: ['V0', 'V1'],
|
|
41
|
+
description: 'Versión del componente a utilizar.',
|
|
42
|
+
table: {
|
|
43
|
+
defaultValue: {
|
|
44
|
+
summary: 'V1'
|
|
45
|
+
},
|
|
46
|
+
type: {
|
|
47
|
+
summary: (0, _utils.joinArgTypes)(['V0', 'V1'])
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
36
51
|
title: {
|
|
37
52
|
control: 'text',
|
|
38
|
-
description: 'Título del campo.',
|
|
53
|
+
description: 'Título del campo (V1 only).',
|
|
39
54
|
table: {
|
|
40
55
|
defaultValue: {
|
|
41
56
|
summary: 'undefined'
|
|
@@ -43,6 +58,138 @@ var _default = exports.default = {
|
|
|
43
58
|
type: {
|
|
44
59
|
summary: 'string'
|
|
45
60
|
}
|
|
61
|
+
},
|
|
62
|
+
if: {
|
|
63
|
+
arg: 'version',
|
|
64
|
+
eq: 'V1'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
field: {
|
|
68
|
+
control: 'object',
|
|
69
|
+
description: 'Objeto de configuración del campo (V0 only). Contiene title, required, read_only, etc.',
|
|
70
|
+
table: {
|
|
71
|
+
defaultValue: {
|
|
72
|
+
summary: 'undefined'
|
|
73
|
+
},
|
|
74
|
+
type: {
|
|
75
|
+
summary: 'object'
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
if: {
|
|
79
|
+
arg: 'version',
|
|
80
|
+
eq: 'V0'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
input: {
|
|
84
|
+
control: 'object',
|
|
85
|
+
description: 'Objeto input con value y onChange (V0 only). Similar al patrón de Redux Form.',
|
|
86
|
+
table: {
|
|
87
|
+
defaultValue: {
|
|
88
|
+
summary: '{ value: "", onChange: () => {} }'
|
|
89
|
+
},
|
|
90
|
+
type: {
|
|
91
|
+
summary: 'object'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
if: {
|
|
95
|
+
arg: 'version',
|
|
96
|
+
eq: 'V0'
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
labelKey: {
|
|
100
|
+
control: 'text',
|
|
101
|
+
description: 'Clave para obtener la etiqueta de cada opción (V0 only).',
|
|
102
|
+
table: {
|
|
103
|
+
defaultValue: {
|
|
104
|
+
summary: 'name'
|
|
105
|
+
},
|
|
106
|
+
type: {
|
|
107
|
+
summary: 'string'
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
if: {
|
|
111
|
+
arg: 'version',
|
|
112
|
+
eq: 'V0'
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
valueKey: {
|
|
116
|
+
control: 'text',
|
|
117
|
+
description: 'Clave para obtener el valor de cada opción (V0 only).',
|
|
118
|
+
table: {
|
|
119
|
+
defaultValue: {
|
|
120
|
+
summary: 'value'
|
|
121
|
+
},
|
|
122
|
+
type: {
|
|
123
|
+
summary: 'string'
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
if: {
|
|
127
|
+
arg: 'version',
|
|
128
|
+
eq: 'V0'
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
divider: {
|
|
132
|
+
control: 'boolean',
|
|
133
|
+
description: 'Muestra divisores entre las opciones (V0 only).',
|
|
134
|
+
table: {
|
|
135
|
+
defaultValue: {
|
|
136
|
+
summary: 'false'
|
|
137
|
+
},
|
|
138
|
+
type: {
|
|
139
|
+
summary: 'bool'
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
if: {
|
|
143
|
+
arg: 'version',
|
|
144
|
+
eq: 'V0'
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
disableRipple: {
|
|
148
|
+
control: 'boolean',
|
|
149
|
+
description: 'Deshabilita el efecto ripple de Material-UI (V0 only).',
|
|
150
|
+
table: {
|
|
151
|
+
defaultValue: {
|
|
152
|
+
summary: 'false'
|
|
153
|
+
},
|
|
154
|
+
type: {
|
|
155
|
+
summary: 'bool'
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
if: {
|
|
159
|
+
arg: 'version',
|
|
160
|
+
eq: 'V0'
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
withUpperTitle: {
|
|
164
|
+
control: 'boolean',
|
|
165
|
+
description: 'Muestra el título en la parte superior usando UTFieldLabel (V0 only).',
|
|
166
|
+
table: {
|
|
167
|
+
defaultValue: {
|
|
168
|
+
summary: 'false'
|
|
169
|
+
},
|
|
170
|
+
type: {
|
|
171
|
+
summary: 'bool'
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
if: {
|
|
175
|
+
arg: 'version',
|
|
176
|
+
eq: 'V0'
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
hideLabels: {
|
|
180
|
+
control: 'boolean',
|
|
181
|
+
description: 'Oculta las etiquetas (V0 only).',
|
|
182
|
+
table: {
|
|
183
|
+
defaultValue: {
|
|
184
|
+
summary: 'false'
|
|
185
|
+
},
|
|
186
|
+
type: {
|
|
187
|
+
summary: 'bool'
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
if: {
|
|
191
|
+
arg: 'version',
|
|
192
|
+
eq: 'V0'
|
|
46
193
|
}
|
|
47
194
|
},
|
|
48
195
|
options: {
|
|
@@ -107,7 +254,7 @@ var _default = exports.default = {
|
|
|
107
254
|
},
|
|
108
255
|
variant: {
|
|
109
256
|
control: 'select',
|
|
110
|
-
description: 'Estilo de variante para el campo.',
|
|
257
|
+
description: 'Estilo de variante para el campo (V1 only).',
|
|
111
258
|
options: Object.values(_constants2.RADIO_VARIANTS),
|
|
112
259
|
table: {
|
|
113
260
|
defaultValue: {
|
|
@@ -116,11 +263,15 @@ var _default = exports.default = {
|
|
|
116
263
|
type: {
|
|
117
264
|
summary: (0, _utils.joinArgTypes)(Object.values(_constants2.RADIO_VARIANTS))
|
|
118
265
|
}
|
|
266
|
+
},
|
|
267
|
+
if: {
|
|
268
|
+
arg: 'version',
|
|
269
|
+
eq: 'V1'
|
|
119
270
|
}
|
|
120
271
|
},
|
|
121
272
|
horizontalSpacing: {
|
|
122
273
|
control: 'select',
|
|
123
|
-
description: 'Espaciado entre el botón de radio y el título horizontalmente.',
|
|
274
|
+
description: 'Espaciado entre el botón de radio y el título horizontalmente (V1 only).',
|
|
124
275
|
options: Object.values(_constants.SPACING),
|
|
125
276
|
table: {
|
|
126
277
|
defaultValue: {
|
|
@@ -129,11 +280,15 @@ var _default = exports.default = {
|
|
|
129
280
|
type: {
|
|
130
281
|
summary: (0, _utils.joinArgTypes)(Object.values(_constants.SPACING))
|
|
131
282
|
}
|
|
283
|
+
},
|
|
284
|
+
if: {
|
|
285
|
+
arg: 'version',
|
|
286
|
+
eq: 'V1'
|
|
132
287
|
}
|
|
133
288
|
},
|
|
134
289
|
verticalSpacing: {
|
|
135
290
|
control: 'select',
|
|
136
|
-
description: 'Espaciado entre los elementos de botones de radio verticalmente.',
|
|
291
|
+
description: 'Espaciado entre los elementos de botones de radio verticalmente (V1 only).',
|
|
137
292
|
options: Object.values(_constants.SPACING),
|
|
138
293
|
table: {
|
|
139
294
|
defaultValue: {
|
|
@@ -142,11 +297,15 @@ var _default = exports.default = {
|
|
|
142
297
|
type: {
|
|
143
298
|
summary: (0, _utils.joinArgTypes)(Object.values(_constants.SPACING))
|
|
144
299
|
}
|
|
300
|
+
},
|
|
301
|
+
if: {
|
|
302
|
+
arg: 'version',
|
|
303
|
+
eq: 'V1'
|
|
145
304
|
}
|
|
146
305
|
},
|
|
147
306
|
reversed: {
|
|
148
307
|
control: 'boolean',
|
|
149
|
-
description: 'Si es verdadero, invierte el orden del título y el botón de radio.',
|
|
308
|
+
description: 'Si es verdadero, invierte el orden del título y el botón de radio (V1 only).',
|
|
150
309
|
table: {
|
|
151
310
|
defaultValue: {
|
|
152
311
|
summary: 'false'
|
|
@@ -154,6 +313,10 @@ var _default = exports.default = {
|
|
|
154
313
|
type: {
|
|
155
314
|
summary: 'bool'
|
|
156
315
|
}
|
|
316
|
+
},
|
|
317
|
+
if: {
|
|
318
|
+
arg: 'version',
|
|
319
|
+
eq: 'V1'
|
|
157
320
|
}
|
|
158
321
|
},
|
|
159
322
|
dataTestId: {
|
|
@@ -205,28 +368,59 @@ var _default = exports.default = {
|
|
|
205
368
|
}
|
|
206
369
|
}
|
|
207
370
|
},
|
|
208
|
-
component:
|
|
371
|
+
component: _.default,
|
|
209
372
|
parameters: {
|
|
210
373
|
controls: {
|
|
211
374
|
exclude: ['classes', 'style']
|
|
212
375
|
},
|
|
213
376
|
docs: {
|
|
214
377
|
description: {
|
|
215
|
-
component: 'UTRadioGroup es un componente personalizable que renderiza un grupo de botones de radio, permitiendo a los usuarios seleccionar una sola opción de una lista proporcionada.
|
|
378
|
+
component: 'UTRadioGroup es un componente personalizable que renderiza un grupo de botones de radio, permitiendo a los usuarios seleccionar una sola opción de una lista proporcionada. Está disponible en dos versiones: V0 (basado en Material-UI con patrón de input similar a Redux Form) y V1 (versión moderna con características avanzadas como variantes card/button, categorización de opciones, y espaciado personalizable).'
|
|
216
379
|
}
|
|
217
380
|
}
|
|
218
381
|
},
|
|
219
382
|
title: 'Energy-UI/UTRadioGroup'
|
|
383
|
+
}; // Template for V1 stories
|
|
384
|
+
const V1Template = args => {
|
|
385
|
+
const [{
|
|
386
|
+
value
|
|
387
|
+
}, updateArgs] = (0, _previewApi.useArgs)();
|
|
388
|
+
const handleChange = newValue => {
|
|
389
|
+
updateArgs({
|
|
390
|
+
value: newValue
|
|
391
|
+
});
|
|
392
|
+
if (args.onChange) args.onChange(newValue);
|
|
393
|
+
};
|
|
394
|
+
return /*#__PURE__*/_react.default.createElement(_.default, _extends({}, args, {
|
|
395
|
+
value: value,
|
|
396
|
+
onChange: handleChange
|
|
397
|
+
}));
|
|
220
398
|
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
399
|
+
|
|
400
|
+
// Template for V0 stories
|
|
401
|
+
const V0Template = args => {
|
|
402
|
+
var _args$input;
|
|
403
|
+
const [{
|
|
404
|
+
value
|
|
405
|
+
}, updateArgs] = (0, _previewApi.useArgs)();
|
|
406
|
+
const handleChange = newValue => {
|
|
407
|
+
updateArgs({
|
|
408
|
+
value: newValue
|
|
409
|
+
});
|
|
410
|
+
if (args.onChange) args.onChange(newValue);
|
|
411
|
+
};
|
|
412
|
+
return /*#__PURE__*/_react.default.createElement(_.default, _extends({}, args, {
|
|
413
|
+
input: {
|
|
414
|
+
name: ((_args$input = args.input) === null || _args$input === void 0 ? void 0 : _args$input.name) || 'radio-group-v0',
|
|
415
|
+
value: value || '',
|
|
416
|
+
onChange: handleChange
|
|
417
|
+
}
|
|
418
|
+
}));
|
|
419
|
+
};
|
|
420
|
+
const Playground = exports.Playground = {
|
|
421
|
+
render: V1Template,
|
|
229
422
|
args: {
|
|
423
|
+
version: 'V1',
|
|
230
424
|
options: defaultOptions,
|
|
231
425
|
title: 'Selecciona una opción',
|
|
232
426
|
value: '',
|
|
@@ -239,15 +433,10 @@ const Default = exports.Default = {
|
|
|
239
433
|
},
|
|
240
434
|
name: 'Playground'
|
|
241
435
|
};
|
|
242
|
-
const
|
|
243
|
-
render:
|
|
244
|
-
const [value, setValue] = _react.default.useState(args.value || '');
|
|
245
|
-
return /*#__PURE__*/_react.default.createElement(_V.default, _extends({}, args, {
|
|
246
|
-
value: value,
|
|
247
|
-
onChange: setValue
|
|
248
|
-
}));
|
|
249
|
-
},
|
|
436
|
+
const V1Categorized = exports.V1Categorized = {
|
|
437
|
+
render: V1Template,
|
|
250
438
|
args: {
|
|
439
|
+
version: 'V1',
|
|
251
440
|
options: [{
|
|
252
441
|
name: 'Opción 1',
|
|
253
442
|
value: '1'
|
|
@@ -268,37 +457,96 @@ const Categorized = exports.Categorized = {
|
|
|
268
457
|
title: 'Opciones Categorizadas',
|
|
269
458
|
value: ''
|
|
270
459
|
},
|
|
271
|
-
name: 'Opciones Categorizadas'
|
|
460
|
+
name: 'V1 - Opciones Categorizadas'
|
|
272
461
|
};
|
|
273
|
-
const
|
|
274
|
-
render:
|
|
275
|
-
const [value, setValue] = _react.default.useState(args.value || '');
|
|
276
|
-
return /*#__PURE__*/_react.default.createElement(_V.default, _extends({}, args, {
|
|
277
|
-
value: value,
|
|
278
|
-
onChange: setValue
|
|
279
|
-
}));
|
|
280
|
-
},
|
|
462
|
+
const V1CardVariant = exports.V1CardVariant = {
|
|
463
|
+
render: V1Template,
|
|
281
464
|
args: {
|
|
465
|
+
version: 'V1',
|
|
282
466
|
options: defaultOptions,
|
|
283
467
|
title: 'Opciones de Estilo Card',
|
|
284
468
|
value: '',
|
|
285
469
|
variant: 'card'
|
|
286
470
|
},
|
|
287
|
-
name: 'Variante Card'
|
|
471
|
+
name: 'V1 - Variante Card'
|
|
288
472
|
};
|
|
289
|
-
const
|
|
290
|
-
render:
|
|
291
|
-
const [value, setValue] = _react.default.useState(args.value || '');
|
|
292
|
-
return /*#__PURE__*/_react.default.createElement(_V.default, _extends({}, args, {
|
|
293
|
-
value: value,
|
|
294
|
-
onChange: setValue
|
|
295
|
-
}));
|
|
296
|
-
},
|
|
473
|
+
const V1ButtonVariant = exports.V1ButtonVariant = {
|
|
474
|
+
render: V1Template,
|
|
297
475
|
args: {
|
|
476
|
+
version: 'V1',
|
|
298
477
|
options: defaultOptions,
|
|
299
478
|
title: 'Opciones de Estilo Button',
|
|
300
479
|
value: '',
|
|
301
480
|
variant: 'button'
|
|
302
481
|
},
|
|
303
|
-
name: 'Variante Button'
|
|
482
|
+
name: 'V1 - Variante Button'
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
// V0 Stories
|
|
486
|
+
const V0Basic = exports.V0Basic = {
|
|
487
|
+
render: V0Template,
|
|
488
|
+
args: {
|
|
489
|
+
version: 'V0',
|
|
490
|
+
options: defaultOptions,
|
|
491
|
+
value: '',
|
|
492
|
+
labelKey: 'name',
|
|
493
|
+
valueKey: 'value',
|
|
494
|
+
disabled: false,
|
|
495
|
+
divider: false,
|
|
496
|
+
disableRipple: false,
|
|
497
|
+
input: {
|
|
498
|
+
name: 'radio-group-v0'
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
name: 'V0 - Básico'
|
|
502
|
+
};
|
|
503
|
+
const V0WithField = exports.V0WithField = {
|
|
504
|
+
render: V0Template,
|
|
505
|
+
args: {
|
|
506
|
+
version: 'V0',
|
|
507
|
+
options: defaultOptions,
|
|
508
|
+
value: '',
|
|
509
|
+
labelKey: 'name',
|
|
510
|
+
valueKey: 'value',
|
|
511
|
+
withUpperTitle: true,
|
|
512
|
+
field: {
|
|
513
|
+
title: 'Selecciona una opción',
|
|
514
|
+
required: true,
|
|
515
|
+
read_only: false
|
|
516
|
+
},
|
|
517
|
+
input: {
|
|
518
|
+
name: 'radio-group-v0-field'
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
name: 'V0 - Con Campo y Título Superior'
|
|
522
|
+
};
|
|
523
|
+
const V0WithDividers = exports.V0WithDividers = {
|
|
524
|
+
render: V0Template,
|
|
525
|
+
args: {
|
|
526
|
+
version: 'V0',
|
|
527
|
+
options: defaultOptions,
|
|
528
|
+
value: '',
|
|
529
|
+
labelKey: 'name',
|
|
530
|
+
valueKey: 'value',
|
|
531
|
+
divider: true,
|
|
532
|
+
input: {
|
|
533
|
+
name: 'radio-group-v0-dividers'
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
name: 'V0 - Con Divisores'
|
|
537
|
+
};
|
|
538
|
+
const V0Disabled = exports.V0Disabled = {
|
|
539
|
+
render: V0Template,
|
|
540
|
+
args: {
|
|
541
|
+
version: 'V0',
|
|
542
|
+
options: defaultOptions,
|
|
543
|
+
value: '1',
|
|
544
|
+
labelKey: 'name',
|
|
545
|
+
valueKey: 'value',
|
|
546
|
+
disabled: true,
|
|
547
|
+
input: {
|
|
548
|
+
name: 'radio-group-v0-disabled'
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
name: 'V0 - Deshabilitado'
|
|
304
552
|
};
|
|
@@ -52,6 +52,7 @@ class UTRadioGroup extends _react.PureComponent {
|
|
|
52
52
|
root: "\n ".concat(classes.root, "\n ").concat(isChecked && classes.checkedRoot, "\n ").concat(option.disabled && classes.disabledRoot, "\n "),
|
|
53
53
|
label: classes.label
|
|
54
54
|
},
|
|
55
|
+
"data-testid": dataTestId,
|
|
55
56
|
disabled: disabled || option.disabled,
|
|
56
57
|
label: CustomRadioLabel ? /*#__PURE__*/_react.default.createElement(CustomRadioLabel, {
|
|
57
58
|
option: option,
|
|
@@ -64,7 +65,7 @@ class UTRadioGroup extends _react.PureComponent {
|
|
|
64
65
|
checked: "".concat(classes.checked, " ").concat(classes.checkedIconRoot)
|
|
65
66
|
},
|
|
66
67
|
inputProps: {
|
|
67
|
-
'data-testid': dataTestId ? "".concat(dataTestId, ".")
|
|
68
|
+
'data-testid': dataTestId ? "".concat(dataTestId, ".input") : null
|
|
68
69
|
}
|
|
69
70
|
}),
|
|
70
71
|
className: "".concat(classes.formControlLabel, " \n ").concat(this.props.divider && index === 0 && classes.topDivider, " \n ").concat(this.props.divider && classes.divider, "\n ").concat(className)
|
|
@@ -87,7 +88,7 @@ class UTRadioGroup extends _react.PureComponent {
|
|
|
87
88
|
} = this.props;
|
|
88
89
|
const shouldShowUpperTitle = ((field === null || field === void 0 || (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.ignore_title) || hideLabels) && withUpperTitle && (field === null || field === void 0 ? void 0 : field.title);
|
|
89
90
|
const classes = (0, _classesUtils.mergeClasses)(themeClasses, classNames);
|
|
90
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, _extends({
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, _extends({
|
|
91
92
|
actions: actions,
|
|
92
93
|
className: classes.title,
|
|
93
94
|
readOnly: field.read_only,
|