@widergy/energy-ui 3.171.3 → 3.172.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -2
- package/dist/components/UTButton/constants.js +2 -0
- package/dist/components/UTButton/index.js +6 -3
- package/dist/components/UTButton/stories/UTButtonSizes.stories.js +16 -1
- package/dist/components/UTButton/stories/storiesConstants.js +26 -0
- package/dist/components/UTButton/styles.module.scss +10 -0
- package/dist/components/UTButton/theme.js +1 -1
- package/dist/components/UTButton/utils.js +1 -4
- package/dist/components/UTDataCategory/theme.js +1 -1
- package/dist/components/UTDataElement/README.md +1 -1
- package/dist/components/UTPaper/index.js +3 -1
- package/dist/components/UTSelect/UTSelectFixedBottomOption.stories.js +171 -0
- package/dist/components/UTSelect/versions/V1/README.md +19 -0
- package/dist/components/UTSelect/versions/V1/components/ListboxComponent/index.js +48 -16
- package/dist/components/UTSelect/versions/V1/components/ListboxComponent/styles.module.scss +11 -0
- package/dist/components/UTSelect/versions/V1/index.js +39 -15
- package/dist/components/UTSelect/versions/V1/types.js +6 -0
- package/dist/components/UTTracker/UTTracker.stories.js +332 -0
- package/dist/esm/components/UTButton/constants.js +2 -0
- package/dist/esm/components/UTButton/index.js +6 -3
- package/dist/esm/components/UTButton/stories/UTButtonSizes.stories.js +15 -0
- package/dist/esm/components/UTButton/stories/storiesConstants.js +26 -0
- package/dist/esm/components/UTButton/styles.module.scss +10 -0
- package/dist/esm/components/UTButton/theme.js +1 -1
- package/dist/esm/components/UTButton/utils.js +1 -4
- package/dist/esm/components/UTDataCategory/theme.js +2 -2
- package/dist/esm/components/UTDataElement/README.md +1 -1
- package/dist/esm/components/UTPaper/index.js +3 -1
- package/dist/esm/components/UTSelect/UTSelectFixedBottomOption.stories.js +163 -0
- package/dist/esm/components/UTSelect/versions/V1/README.md +19 -0
- package/dist/esm/components/UTSelect/versions/V1/components/ListboxComponent/index.js +49 -17
- package/dist/esm/components/UTSelect/versions/V1/components/ListboxComponent/styles.module.scss +11 -0
- package/dist/esm/components/UTSelect/versions/V1/index.js +39 -15
- package/dist/esm/components/UTSelect/versions/V1/types.js +6 -0
- package/dist/esm/components/UTTracker/UTTracker.stories.js +325 -0
- package/package.json +1 -1
|
@@ -37,7 +37,10 @@ const UTSelect = _ref => {
|
|
|
37
37
|
disableFilterOptions = false,
|
|
38
38
|
error,
|
|
39
39
|
errorDataTestId,
|
|
40
|
+
fixedBottomOption,
|
|
40
41
|
freeWidth = false,
|
|
42
|
+
hideSingleCategoryTitle = false,
|
|
43
|
+
paperClassName,
|
|
41
44
|
helpText,
|
|
42
45
|
icon,
|
|
43
46
|
inputSize,
|
|
@@ -72,26 +75,38 @@ const UTSelect = _ref => {
|
|
|
72
75
|
clonedOptions.forEach(option => {
|
|
73
76
|
if (!categoryOrder.has(option.category)) categoryOrder.set(option.category, categoryOrder.size);
|
|
74
77
|
});
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
const sorted = clonedOptions.sort((a, b) => categoryOrder.get(a.category) - categoryOrder.get(b.category));
|
|
79
|
+
if (hideSingleCategoryTitle && categoryOrder.size <= 1) {
|
|
80
|
+
return sorted.map(_ref2 => {
|
|
81
|
+
let {
|
|
82
|
+
category: _category,
|
|
83
|
+
...rest
|
|
84
|
+
} = _ref2;
|
|
85
|
+
return rest;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return sorted;
|
|
89
|
+
}, [options, hideSingleCategoryTitle]);
|
|
90
|
+
const displayOptions = (0, _react.useMemo)(() => fixedBottomOption ? [...optionsSortedByCategory, fixedBottomOption] : optionsSortedByCategory, [optionsSortedByCategory, fixedBottomOption]);
|
|
77
91
|
const [isPopperOpen, setIsPopperOpen] = (0, _react.useState)(false);
|
|
78
|
-
const [searchTerm, setSearchTerm] = (0, _react.useState)((0, _utils2.getDisplayValue)(value,
|
|
92
|
+
const [searchTerm, setSearchTerm] = (0, _react.useState)((0, _utils2.getDisplayValue)(value, displayOptions, multiple));
|
|
79
93
|
const [showClearButton, setShowClearButton] = (0, _react.useState)(!!searchTerm);
|
|
80
94
|
const [sortedOptions, setSortedOptions] = (0, _react.useState)(optionsSortedByCategory);
|
|
81
95
|
const inputRef = (0, _react.useRef)(null);
|
|
82
96
|
(0, _react.useEffect)(() => {
|
|
83
|
-
|
|
97
|
+
const fixedIsSelected = fixedBottomOption && (multiple ? Array.isArray(value) && value.includes(fixedBottomOption.value) : value === (fixedBottomOption === null || fixedBottomOption === void 0 ? void 0 : fixedBottomOption.value));
|
|
98
|
+
if (withAutoReset && !fixedIsSelected && (0, _utils2.shouldReset)(value, optionsSortedByCategory, multiple)) {
|
|
84
99
|
onChange(null);
|
|
85
100
|
setSortedOptions((0, _utils2.sortOptions)(optionsSortedByCategory, null, multiple));
|
|
86
101
|
}
|
|
87
|
-
}, [multiple, onChange, optionsSortedByCategory, value, withAutoReset]);
|
|
102
|
+
}, [multiple, onChange, optionsSortedByCategory, value, withAutoReset, fixedBottomOption]);
|
|
88
103
|
(0, _react.useEffect)(() => {
|
|
89
104
|
if (!isPopperOpen) {
|
|
90
|
-
const displayValue = (0, _utils2.getDisplayValue)(value,
|
|
105
|
+
const displayValue = (0, _utils2.getDisplayValue)(value, displayOptions, multiple);
|
|
91
106
|
setSearchTerm(displayValue);
|
|
92
107
|
setShowClearButton(displayValue);
|
|
93
108
|
}
|
|
94
|
-
}, [value,
|
|
109
|
+
}, [value, displayOptions, multiple, isPopperOpen]);
|
|
95
110
|
(0, _react.useEffect)(() => {
|
|
96
111
|
if (isPopperOpen) {
|
|
97
112
|
setSortedOptions((0, _utils2.sortOptions)(optionsSortedByCategory, value, multiple));
|
|
@@ -105,17 +120,21 @@ const UTSelect = _ref => {
|
|
|
105
120
|
}, [isPopperOpen]);
|
|
106
121
|
const validationData = (0, _react.useMemo)(() => error && (0, _utils.formatErrorToValidation)(error), [error]);
|
|
107
122
|
const isPicker = variant === _constants.VARIANTS.picker;
|
|
108
|
-
const filteredOptions = (0, _react.useMemo)(() =>
|
|
123
|
+
const filteredOptions = (0, _react.useMemo)(() => {
|
|
124
|
+
const base = disableFilterOptions || isPicker ? sortedOptions : sortedOptions.filter(option => "".concat(option.name).toLowerCase().includes(searchTerm.toLowerCase()));
|
|
125
|
+
if (!fixedBottomOption) return base;
|
|
126
|
+
return base.filter(opt => opt.value !== fixedBottomOption.value);
|
|
127
|
+
}, [sortedOptions, searchTerm, disableFilterOptions, isPicker, fixedBottomOption]);
|
|
109
128
|
const handleSearchChange = (0, _react.useCallback)(searchValue => {
|
|
110
129
|
onChangeSearchTerm === null || onChangeSearchTerm === void 0 || onChangeSearchTerm(searchValue);
|
|
111
130
|
setSearchTerm(searchValue);
|
|
112
131
|
}, [onChangeSearchTerm]);
|
|
113
132
|
const clearSearchInputValue = (0, _react.useCallback)(inputValue => {
|
|
114
133
|
setIsPopperOpen(false);
|
|
115
|
-
const displayValue = (0, _utils2.getDisplayValue)(inputValue,
|
|
134
|
+
const displayValue = (0, _utils2.getDisplayValue)(inputValue, displayOptions, multiple);
|
|
116
135
|
handleSearchChange(displayValue);
|
|
117
136
|
setShowClearButton(displayValue !== '');
|
|
118
|
-
}, [_utils2.getDisplayValue,
|
|
137
|
+
}, [_utils2.getDisplayValue, displayOptions, multiple, handleSearchChange]);
|
|
119
138
|
const handleSelectionChange = newValues => {
|
|
120
139
|
const selectedValue = multiple ? newValues : newValues.length > 0 ? newValues[0] : '';
|
|
121
140
|
onChange(selectedValue);
|
|
@@ -161,13 +180,14 @@ const UTSelect = _ref => {
|
|
|
161
180
|
CustomRow,
|
|
162
181
|
dataTestId: listDataTestId,
|
|
163
182
|
filteredOptions,
|
|
183
|
+
fixedBottomOption,
|
|
164
184
|
handleSelectionChange,
|
|
165
185
|
itemDataTestId,
|
|
166
186
|
multiple,
|
|
167
187
|
noMatchesText,
|
|
168
188
|
value,
|
|
169
189
|
...listProps
|
|
170
|
-
}), [CustomRow, filteredOptions, handleSelectionChange, multiple, noMatchesText, value, listProps]);
|
|
190
|
+
}), [CustomRow, filteredOptions, fixedBottomOption, handleSelectionChange, multiple, noMatchesText, value, listProps]);
|
|
171
191
|
const menuWidthRef = (0, _react.useRef)(menuWidth);
|
|
172
192
|
menuWidthRef.current = menuWidth;
|
|
173
193
|
const CustomPopper = (0, _react.useCallback)(props => {
|
|
@@ -191,11 +211,15 @@ const UTSelect = _ref => {
|
|
|
191
211
|
actions: titleActions,
|
|
192
212
|
required: required,
|
|
193
213
|
size: titleVariant
|
|
194
|
-
}, title), /*#__PURE__*/_react.default.createElement(_lab.Autocomplete, _extends({
|
|
214
|
+
}, title), /*#__PURE__*/_react.default.createElement(_lab.Autocomplete, _extends({
|
|
195
215
|
classes: {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
216
|
+
...(freeWidth && !menuWidth ? {
|
|
217
|
+
popper: _stylesModule.default.popper
|
|
218
|
+
} : {}),
|
|
219
|
+
...(paperClassName ? {
|
|
220
|
+
paper: paperClassName
|
|
221
|
+
} : {})
|
|
222
|
+
},
|
|
199
223
|
PopperComponent: CustomPopper,
|
|
200
224
|
disabled: disabled || readOnly,
|
|
201
225
|
getOptionLabel: option => "".concat(option.name),
|
|
@@ -24,7 +24,13 @@ const utselectTypes = exports.utselectTypes = {
|
|
|
24
24
|
disableFilterOptions: _propTypes.bool,
|
|
25
25
|
error: _propTypes.string,
|
|
26
26
|
errorDataTestId: _propTypes.string,
|
|
27
|
+
fixedBottomOption: (0, _propTypes.shape)({
|
|
28
|
+
name: _propTypes.string,
|
|
29
|
+
value: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number])
|
|
30
|
+
}),
|
|
27
31
|
freeWidth: _propTypes.bool,
|
|
32
|
+
hideSingleCategoryTitle: _propTypes.bool,
|
|
33
|
+
paperClassName: _propTypes.string,
|
|
28
34
|
helpText: _propTypes.string,
|
|
29
35
|
icon: _propTypes.string,
|
|
30
36
|
inputSize: _propTypes.string,
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithoutTitle = exports.WithoutDetailsTab = exports.FlatMode = exports.ErrorVariant = exports.Default = exports.CardMode = exports.AllVariants = exports.AllModes = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _utils = require("stories/utils");
|
|
9
|
+
var _constants = require("./constants");
|
|
10
|
+
var _ = _interopRequireDefault(require("."));
|
|
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
|
+
const subSteps = [{
|
|
14
|
+
id: 1,
|
|
15
|
+
subtitle: '02 noviembre 2023, 4:38 PM',
|
|
16
|
+
title: 'Description Step'
|
|
17
|
+
}, {
|
|
18
|
+
id: 2,
|
|
19
|
+
subtitle: '02 noviembre 2023, 4:38 PM',
|
|
20
|
+
title: 'Description Step'
|
|
21
|
+
}, {
|
|
22
|
+
id: 3,
|
|
23
|
+
subtitle: '02 noviembre 2023, 4:38 PM',
|
|
24
|
+
title: 'Description Step'
|
|
25
|
+
}];
|
|
26
|
+
const defaultSteps = [{
|
|
27
|
+
id: 1,
|
|
28
|
+
subSteps,
|
|
29
|
+
title: 'Solicitud confirmada'
|
|
30
|
+
}, {
|
|
31
|
+
id: 2,
|
|
32
|
+
subSteps,
|
|
33
|
+
title: 'En preparación'
|
|
34
|
+
}, {
|
|
35
|
+
id: 3,
|
|
36
|
+
title: 'En camino'
|
|
37
|
+
}, {
|
|
38
|
+
description: 'Fecha estimada 07 de agosto',
|
|
39
|
+
id: 4,
|
|
40
|
+
title: 'Entregado'
|
|
41
|
+
}];
|
|
42
|
+
var _default = exports.default = {
|
|
43
|
+
args: {
|
|
44
|
+
currentStep: 2,
|
|
45
|
+
description: 'Hora estimada de entrega 7:00 PM',
|
|
46
|
+
detailsTab: {
|
|
47
|
+
enabled: true,
|
|
48
|
+
title: 'Ver Detalle'
|
|
49
|
+
},
|
|
50
|
+
mode: _constants.CARD,
|
|
51
|
+
steps: defaultSteps,
|
|
52
|
+
subtitle: '',
|
|
53
|
+
title: 'Pedido en curso',
|
|
54
|
+
variant: _constants.STANDARD
|
|
55
|
+
},
|
|
56
|
+
argTypes: {
|
|
57
|
+
classes: {
|
|
58
|
+
control: false,
|
|
59
|
+
description: 'Objeto de clases CSS para personalizar estilos internos vía theming.',
|
|
60
|
+
table: {
|
|
61
|
+
defaultValue: {
|
|
62
|
+
summary: '{}'
|
|
63
|
+
},
|
|
64
|
+
type: {
|
|
65
|
+
summary: 'objectOf(string)'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
classNames: {
|
|
70
|
+
control: false,
|
|
71
|
+
description: 'Objeto de clases CSS para override de estilos internos.',
|
|
72
|
+
table: {
|
|
73
|
+
defaultValue: {
|
|
74
|
+
summary: 'undefined'
|
|
75
|
+
},
|
|
76
|
+
type: {
|
|
77
|
+
summary: 'objectOf(string)'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
currentStep: {
|
|
82
|
+
control: 'number',
|
|
83
|
+
description: 'Número del paso activo actualmente.',
|
|
84
|
+
table: {
|
|
85
|
+
defaultValue: {
|
|
86
|
+
summary: 'undefined'
|
|
87
|
+
},
|
|
88
|
+
type: {
|
|
89
|
+
summary: 'number'
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
description: {
|
|
94
|
+
control: 'text',
|
|
95
|
+
description: 'Texto descriptivo que aparece debajo del subtítulo.',
|
|
96
|
+
table: {
|
|
97
|
+
defaultValue: {
|
|
98
|
+
summary: 'undefined'
|
|
99
|
+
},
|
|
100
|
+
type: {
|
|
101
|
+
summary: 'string'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
detailsTab: {
|
|
106
|
+
control: 'object',
|
|
107
|
+
description: 'Configuración de la pestaña de detalle. `enabled` habilita el botón de colapsar; `title` es el texto del botón.',
|
|
108
|
+
table: {
|
|
109
|
+
defaultValue: {
|
|
110
|
+
summary: 'undefined'
|
|
111
|
+
},
|
|
112
|
+
type: {
|
|
113
|
+
summary: '{ enabled: boolean, title: string }'
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
mode: {
|
|
118
|
+
control: 'inline-radio',
|
|
119
|
+
description: 'Determina el modo visual del componente.',
|
|
120
|
+
options: [_constants.CARD, _constants.FLAT],
|
|
121
|
+
table: {
|
|
122
|
+
defaultValue: {
|
|
123
|
+
summary: _constants.CARD
|
|
124
|
+
},
|
|
125
|
+
type: {
|
|
126
|
+
summary: (0, _utils.joinArgTypes)([_constants.CARD, _constants.FLAT])
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
steps: {
|
|
131
|
+
control: 'object',
|
|
132
|
+
description: 'Array de pasos a mostrar. Cada paso puede tener `id`, `title`, `subtitle`, `description` y `subSteps`.',
|
|
133
|
+
table: {
|
|
134
|
+
defaultValue: {
|
|
135
|
+
summary: 'undefined'
|
|
136
|
+
},
|
|
137
|
+
type: {
|
|
138
|
+
summary: 'arrayOf({ id, title, subtitle, description, subSteps })'
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
subtitle: {
|
|
143
|
+
control: 'text',
|
|
144
|
+
description: 'Subtítulo que aparece junto al banner de error cuando `variant` es `error`.',
|
|
145
|
+
table: {
|
|
146
|
+
defaultValue: {
|
|
147
|
+
summary: 'undefined'
|
|
148
|
+
},
|
|
149
|
+
type: {
|
|
150
|
+
summary: 'string'
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
title: {
|
|
155
|
+
control: 'text',
|
|
156
|
+
description: 'Título del componente. En modo `flat` con `detailsTab` habilitado actúa como botón de colapsar.',
|
|
157
|
+
table: {
|
|
158
|
+
defaultValue: {
|
|
159
|
+
summary: 'undefined'
|
|
160
|
+
},
|
|
161
|
+
type: {
|
|
162
|
+
summary: 'string'
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
variant: {
|
|
167
|
+
control: 'inline-radio',
|
|
168
|
+
description: 'Determina la variante visual del componente.',
|
|
169
|
+
options: [_constants.STANDARD, _constants.ERROR],
|
|
170
|
+
table: {
|
|
171
|
+
defaultValue: {
|
|
172
|
+
summary: _constants.STANDARD
|
|
173
|
+
},
|
|
174
|
+
type: {
|
|
175
|
+
summary: (0, _utils.joinArgTypes)([_constants.STANDARD, _constants.ERROR])
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
component: _.default,
|
|
181
|
+
parameters: {
|
|
182
|
+
controls: {
|
|
183
|
+
exclude: ['classes']
|
|
184
|
+
},
|
|
185
|
+
docs: {
|
|
186
|
+
description: {
|
|
187
|
+
component: 'Componente para mostrar el seguimiento de un proceso paso a paso. Soporta dos modos visuales (`card` y `flat`), variantes de estado (`standard` y `error`), pasos con sub-pasos, y una pestaña de detalle colapsable.'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
title: 'Energy-UI/UTTracker'
|
|
192
|
+
};
|
|
193
|
+
const Default = exports.Default = {
|
|
194
|
+
name: 'Playground'
|
|
195
|
+
};
|
|
196
|
+
const CardMode = exports.CardMode = {
|
|
197
|
+
args: {
|
|
198
|
+
mode: _constants.CARD,
|
|
199
|
+
variant: _constants.STANDARD
|
|
200
|
+
},
|
|
201
|
+
name: 'Modo Card',
|
|
202
|
+
parameters: {
|
|
203
|
+
docs: {
|
|
204
|
+
description: {
|
|
205
|
+
story: 'UTTracker en modo `card`, con sombra y fondo blanco. Incluye la pestaña de detalle al pie.'
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const FlatMode = exports.FlatMode = {
|
|
211
|
+
args: {
|
|
212
|
+
mode: _constants.FLAT,
|
|
213
|
+
variant: _constants.STANDARD
|
|
214
|
+
},
|
|
215
|
+
name: 'Modo Flat',
|
|
216
|
+
parameters: {
|
|
217
|
+
docs: {
|
|
218
|
+
description: {
|
|
219
|
+
story: 'UTTracker en modo `flat`, con fondo transparente. El título actúa como botón de colapsar cuando `detailsTab` está habilitado.'
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const ErrorVariant = exports.ErrorVariant = {
|
|
225
|
+
args: {
|
|
226
|
+
description: 'Quería recargas catalíticas y pedí normales',
|
|
227
|
+
mode: _constants.CARD,
|
|
228
|
+
subtitle: 'Me equivoqué en el pedido',
|
|
229
|
+
variant: _constants.ERROR
|
|
230
|
+
},
|
|
231
|
+
name: 'Variante Error',
|
|
232
|
+
parameters: {
|
|
233
|
+
docs: {
|
|
234
|
+
description: {
|
|
235
|
+
story: 'UTTracker con `variant="error"`. Muestra el banner de error con `subtitle` y `description`.'
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
const WithoutDetailsTab = exports.WithoutDetailsTab = {
|
|
241
|
+
args: {
|
|
242
|
+
detailsTab: undefined,
|
|
243
|
+
mode: _constants.CARD,
|
|
244
|
+
variant: _constants.STANDARD
|
|
245
|
+
},
|
|
246
|
+
name: 'Sin Pestaña de Detalle',
|
|
247
|
+
parameters: {
|
|
248
|
+
docs: {
|
|
249
|
+
description: {
|
|
250
|
+
story: 'UTTracker sin la pestaña de detalle colapsable. Las esquinas inferiores quedan redondeadas.'
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const WithoutTitle = exports.WithoutTitle = {
|
|
256
|
+
args: {
|
|
257
|
+
mode: _constants.CARD,
|
|
258
|
+
title: undefined,
|
|
259
|
+
variant: _constants.STANDARD
|
|
260
|
+
},
|
|
261
|
+
name: 'Sin Título',
|
|
262
|
+
parameters: {
|
|
263
|
+
docs: {
|
|
264
|
+
description: {
|
|
265
|
+
story: 'UTTracker sin título.'
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
const AllModes = exports.AllModes = {
|
|
271
|
+
render: args => /*#__PURE__*/_react.default.createElement("div", {
|
|
272
|
+
style: {
|
|
273
|
+
display: 'flex',
|
|
274
|
+
gap: '24px',
|
|
275
|
+
flexWrap: 'wrap'
|
|
276
|
+
}
|
|
277
|
+
}, [_constants.CARD, _constants.FLAT].map(mode => /*#__PURE__*/_react.default.createElement("div", {
|
|
278
|
+
key: mode,
|
|
279
|
+
style: {
|
|
280
|
+
flex: 1,
|
|
281
|
+
minWidth: '300px'
|
|
282
|
+
}
|
|
283
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, _extends({}, args, {
|
|
284
|
+
mode: mode,
|
|
285
|
+
title: "Modo: ".concat(mode)
|
|
286
|
+
}))))),
|
|
287
|
+
name: 'Todos los Modos',
|
|
288
|
+
parameters: {
|
|
289
|
+
docs: {
|
|
290
|
+
description: {
|
|
291
|
+
story: 'Comparativa de los dos modos disponibles: `card` y `flat`.'
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const AllVariants = exports.AllVariants = {
|
|
297
|
+
render: args => /*#__PURE__*/_react.default.createElement("div", {
|
|
298
|
+
style: {
|
|
299
|
+
display: 'flex',
|
|
300
|
+
gap: '24px',
|
|
301
|
+
flexWrap: 'wrap'
|
|
302
|
+
}
|
|
303
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
304
|
+
style: {
|
|
305
|
+
flex: 1,
|
|
306
|
+
minWidth: '300px'
|
|
307
|
+
}
|
|
308
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, _extends({}, args, {
|
|
309
|
+
description: "Hora estimada de entrega 7:00 PM",
|
|
310
|
+
subtitle: "",
|
|
311
|
+
title: "Variante: standard",
|
|
312
|
+
variant: _constants.STANDARD
|
|
313
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
314
|
+
style: {
|
|
315
|
+
flex: 1,
|
|
316
|
+
minWidth: '300px'
|
|
317
|
+
}
|
|
318
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, _extends({}, args, {
|
|
319
|
+
description: "Quer\xEDa recargas catal\xEDticas y ped\xED normales",
|
|
320
|
+
subtitle: "Me equivoqu\xE9 en el pedido",
|
|
321
|
+
title: "Variante: error",
|
|
322
|
+
variant: _constants.ERROR
|
|
323
|
+
})))),
|
|
324
|
+
name: 'Todas las Variantes',
|
|
325
|
+
parameters: {
|
|
326
|
+
docs: {
|
|
327
|
+
description: {
|
|
328
|
+
story: 'Comparativa de las dos variantes disponibles: `standard` y `error`.'
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
};
|
|
@@ -21,6 +21,8 @@ const UTButton = _ref => {
|
|
|
21
21
|
count,
|
|
22
22
|
dataTestId,
|
|
23
23
|
disabled,
|
|
24
|
+
fullHeight,
|
|
25
|
+
fullWidth,
|
|
24
26
|
hideTextOnResponsive,
|
|
25
27
|
Icon,
|
|
26
28
|
iconPlacement,
|
|
@@ -50,7 +52,6 @@ const UTButton = _ref => {
|
|
|
50
52
|
} = useMemo(() => getIconProps({
|
|
51
53
|
className: icon,
|
|
52
54
|
colorTheme,
|
|
53
|
-
hasContent: !!children,
|
|
54
55
|
hideTextOnResponsive,
|
|
55
56
|
Icon,
|
|
56
57
|
iconPlacement,
|
|
@@ -58,7 +59,7 @@ const UTButton = _ref => {
|
|
|
58
59
|
RightIcon,
|
|
59
60
|
size,
|
|
60
61
|
variant
|
|
61
|
-
}), [colorTheme,
|
|
62
|
+
}), [colorTheme, hideTextOnResponsive, icon, Icon, iconPlacement, LeftIcon, RightIcon, size, variant]);
|
|
62
63
|
const LeftIconToShow = LeftIconComponent && /*#__PURE__*/React.createElement(LeftIconComponent, _extends({}, leftIconBaseProps, leftIconProps));
|
|
63
64
|
const RightIconToShow = RightIconComponent && /*#__PURE__*/React.createElement(RightIconComponent, _extends({}, rightIconBaseProps, rightIconProps));
|
|
64
65
|
const counterColorTheme = getCounterColorTheme(colorTheme, variant);
|
|
@@ -72,7 +73,7 @@ const UTButton = _ref => {
|
|
|
72
73
|
}), children), RightIconToShow);
|
|
73
74
|
return /*#__PURE__*/React.createElement(Button, {
|
|
74
75
|
classes: materialButtonClasses,
|
|
75
|
-
className: "\n ".concat(styles["padding".concat(capitalize(size))], "\n ").concat(hideTextOnResponsive && styles.hideTextOnResponsive, "\n ").concat(!hideTextOnResponsive && !children && styles.noChildren, "\n "),
|
|
76
|
+
className: "\n ".concat(styles["padding".concat(capitalize(size))], "\n ").concat(fullHeight && styles.fullHeight, "\n ").concat(fullWidth && styles.fullWidth, "\n ").concat(hideTextOnResponsive && styles.hideTextOnResponsive, "\n ").concat(!hideTextOnResponsive && !children && styles.noChildren, "\n "),
|
|
76
77
|
"data-testid": dataTestId,
|
|
77
78
|
disabled: disabled || loading,
|
|
78
79
|
onClick: onClick,
|
|
@@ -90,6 +91,8 @@ UTButton.propTypes = {
|
|
|
90
91
|
count: number,
|
|
91
92
|
dataTestId: string,
|
|
92
93
|
disabled: bool,
|
|
94
|
+
fullHeight: bool,
|
|
95
|
+
fullWidth: bool,
|
|
93
96
|
hideTextOnResponsive: bool,
|
|
94
97
|
/**
|
|
95
98
|
* @deprecated Use LeftIcon or RightIcon instead.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import UTButton from '..';
|
|
2
3
|
import { COMMON_ARG_TYPES, COMMON_ARGS, COMMON_PARAMETERS } from './storiesConstants';
|
|
3
4
|
export default {
|
|
@@ -30,4 +31,18 @@ export const Large = {
|
|
|
30
31
|
children: 'Large Size',
|
|
31
32
|
size: 'large'
|
|
32
33
|
}
|
|
34
|
+
};
|
|
35
|
+
export const FullHeight = {
|
|
36
|
+
args: {
|
|
37
|
+
children: 'Full Height',
|
|
38
|
+
fullHeight: true
|
|
39
|
+
},
|
|
40
|
+
render: args => /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
style: {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
height: 80,
|
|
44
|
+
border: '1px dashed #ccc',
|
|
45
|
+
padding: 8
|
|
46
|
+
}
|
|
47
|
+
}, /*#__PURE__*/React.createElement(UTButton, args))
|
|
33
48
|
};
|
|
@@ -88,6 +88,30 @@ export const COMMON_ARG_TYPES = {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
|
+
fullHeight: {
|
|
92
|
+
control: 'boolean',
|
|
93
|
+
description: 'Si es `true`, el botón ocupa el alto completo de su contenedor padre. Desactiva el `min-height` por tamaño.',
|
|
94
|
+
table: {
|
|
95
|
+
defaultValue: {
|
|
96
|
+
summary: DEFAULT_PROPS.fullHeight
|
|
97
|
+
},
|
|
98
|
+
type: {
|
|
99
|
+
summary: 'boolean'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
fullWidth: {
|
|
104
|
+
control: 'boolean',
|
|
105
|
+
description: 'Si es `true`, el botón ocupa el ancho completo de su contenedor padre. Desactiva el `min-width`.',
|
|
106
|
+
table: {
|
|
107
|
+
defaultValue: {
|
|
108
|
+
summary: DEFAULT_PROPS.fullWidth
|
|
109
|
+
},
|
|
110
|
+
type: {
|
|
111
|
+
summary: 'boolean'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
91
115
|
hideTextOnResponsive: {
|
|
92
116
|
control: 'boolean',
|
|
93
117
|
description: 'Si es `true` y hay ícono, el contenido del botón no se muestra en dispositivos móviles.',
|
|
@@ -217,6 +241,8 @@ export const COMMON_ARGS = {
|
|
|
217
241
|
colorTheme: DEFAULT_PROPS.colorTheme,
|
|
218
242
|
dataTestId: 'customButtonId',
|
|
219
243
|
disabled: DEFAULT_PROPS.disabled,
|
|
244
|
+
fullHeight: DEFAULT_PROPS.fullHeight,
|
|
245
|
+
fullWidth: DEFAULT_PROPS.fullWidth,
|
|
220
246
|
hideTextOnResponsive: DEFAULT_PROPS.hideTextOnResponsive,
|
|
221
247
|
loading: DEFAULT_PROPS.loading,
|
|
222
248
|
size: DEFAULT_PROPS.size,
|
|
@@ -65,6 +65,16 @@ $small-icon: var(--UT-button-icon-size-sm, 1.25rem);
|
|
|
65
65
|
padding: var(--UT-button-padding-xs, 0.25rem) var(--UT-button-padding-sm, 0.5rem);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
.fullHeight {
|
|
69
|
+
min-height: unset;
|
|
70
|
+
height: 100%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.fullWidth {
|
|
74
|
+
min-width: unset;
|
|
75
|
+
width: 100%;
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
.hideTextOnResponsive {
|
|
69
79
|
.textContainer {
|
|
70
80
|
@media #{$mobile} {
|
|
@@ -44,7 +44,7 @@ export const variantsColorTheme = (theme, colorTheme, variant) => {
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
[VARIANTS_NAMES.outlined]: {
|
|
47
|
-
border: "1px solid ".concat(
|
|
47
|
+
border: "1px solid ".concat(lightTheme['04']),
|
|
48
48
|
fill: colorTheme === COLORS_MAPPER.gray ? actionTheme['04'] : actionTheme['05'],
|
|
49
49
|
'&:hover': {
|
|
50
50
|
backgroundColor: colorTheme === COLORS_MAPPER.gray ? lightTheme['03'] : actionTheme['01'],
|
|
@@ -8,7 +8,6 @@ const buildSingleIconProps = _ref => {
|
|
|
8
8
|
let {
|
|
9
9
|
className,
|
|
10
10
|
colorTheme,
|
|
11
|
-
hasContent,
|
|
12
11
|
hideTextOnResponsive,
|
|
13
12
|
Icon,
|
|
14
13
|
size,
|
|
@@ -17,7 +16,7 @@ const buildSingleIconProps = _ref => {
|
|
|
17
16
|
if (!Icon) return null;
|
|
18
17
|
return {
|
|
19
18
|
IconComponent: isUTIcon(Icon) ? UTIcon : Icon,
|
|
20
|
-
className: "\n ".concat(styles.baseIcon, "\n ").concat(className, "\n ").concat(
|
|
19
|
+
className: "\n ".concat(styles.baseIcon, "\n ").concat(className, "\n ").concat(styles.icon, "\n ").concat(hideTextOnResponsive ? styles["adaptableIcon".concat(capitalize(size))] : '', "\n "),
|
|
21
20
|
...(isUTIcon(Icon) ? {
|
|
22
21
|
colorTheme: getButtonElementColorTheme(colorTheme, variant),
|
|
23
22
|
name: Icon
|
|
@@ -28,7 +27,6 @@ export const getIconProps = _ref2 => {
|
|
|
28
27
|
let {
|
|
29
28
|
className,
|
|
30
29
|
colorTheme,
|
|
31
|
-
hasContent,
|
|
32
30
|
hideTextOnResponsive,
|
|
33
31
|
Icon,
|
|
34
32
|
iconPlacement,
|
|
@@ -42,7 +40,6 @@ export const getIconProps = _ref2 => {
|
|
|
42
40
|
const commonParams = {
|
|
43
41
|
className,
|
|
44
42
|
colorTheme,
|
|
45
|
-
hasContent,
|
|
46
43
|
hideTextOnResponsive,
|
|
47
44
|
size,
|
|
48
45
|
variant
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { COLOR_THEMES } from '../../constants/Palette';
|
|
1
|
+
import { COLOR_THEMES, COLOR_SHADES } from '../../constants/Palette';
|
|
2
2
|
export const backgroundColor = function (theme, area) {
|
|
3
3
|
var _theme$Palette;
|
|
4
4
|
let areaProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
5
5
|
const colorTheme = areaProps.colorTheme || COLOR_THEMES.light;
|
|
6
6
|
const actionPaletteColors = ((_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette.actions) || theme.Palette;
|
|
7
7
|
const areaColor = actionPaletteColors[colorTheme];
|
|
8
|
-
const shade = areaProps.shade || (COLOR_THEMES.light === colorTheme ?
|
|
8
|
+
const shade = areaProps.shade || (COLOR_THEMES.light === colorTheme ? COLOR_SHADES.shade03 : COLOR_SHADES.shade01);
|
|
9
9
|
return {
|
|
10
10
|
backgroundColor: area ? areaColor[shade] : 'transparent'
|
|
11
11
|
};
|
|
@@ -8,15 +8,17 @@ const UTPaper = _ref => {
|
|
|
8
8
|
let {
|
|
9
9
|
children,
|
|
10
10
|
classes,
|
|
11
|
+
className,
|
|
11
12
|
...otherProps
|
|
12
13
|
} = _ref;
|
|
13
14
|
return /*#__PURE__*/React.createElement(Paper, _extends({}, otherProps, {
|
|
14
|
-
className: classes.paper
|
|
15
|
+
className: "".concat(classes.paper).concat(className ? " ".concat(className) : '')
|
|
15
16
|
}), children);
|
|
16
17
|
};
|
|
17
18
|
UTPaper.propTypes = {
|
|
18
19
|
children: object,
|
|
19
20
|
classes: objectOf(string),
|
|
21
|
+
className: string,
|
|
20
22
|
otherProps: object
|
|
21
23
|
};
|
|
22
24
|
export default WithTheme(retrieveStyle)(UTPaper);
|