@widergy/energy-ui 3.164.0 → 3.165.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 +15 -4
- package/dist/components/UTAlert/README.md +100 -0
- package/dist/components/UTAlert/stories/UTAlert.stories.js +239 -0
- package/dist/components/UTAlert/stories/storiesConstants.js +107 -0
- package/dist/components/UTBanner/index.js +11 -5
- package/dist/components/UTBanner/stories/UTBanner.stories.js +8 -0
- package/dist/components/UTBaseInputField/UTBaseInputField.stories.js +393 -0
- package/dist/components/UTSnackbar/README.md +105 -0
- package/dist/components/UTSnackbar/constants.js +134 -0
- package/dist/components/UTSnackbar/index.js +134 -0
- package/dist/components/UTSnackbar/stories/UTSnackbar.stories.js +350 -0
- package/dist/components/UTSnackbar/stories/storiesConstants.js +169 -0
- package/dist/components/UTSnackbar/styles.module.scss +82 -0
- package/dist/components/UTSnackbar/theme.js +57 -0
- package/dist/components/UTSnackbar/types.js +20 -0
- package/dist/components/UTSnackbar/utils.js +53 -0
- package/dist/components/UTTextArea/UTTextArea.stories.js +342 -0
- package/dist/components/UTTextInput/UTTextInput.stories.js +439 -0
- package/dist/constants/testIds.js +9 -0
- package/dist/esm/components/UTAlert/README.md +100 -0
- package/dist/esm/components/UTAlert/stories/UTAlert.stories.js +231 -0
- package/dist/esm/components/UTAlert/stories/storiesConstants.js +101 -0
- package/dist/esm/components/UTBanner/index.js +11 -5
- package/dist/esm/components/UTBanner/stories/UTBanner.stories.js +8 -0
- package/dist/esm/components/UTBaseInputField/UTBaseInputField.stories.js +385 -0
- package/dist/esm/components/UTSnackbar/README.md +105 -0
- package/dist/esm/components/UTSnackbar/constants.js +128 -0
- package/dist/esm/components/UTSnackbar/index.js +127 -0
- package/dist/esm/components/UTSnackbar/stories/UTSnackbar.stories.js +342 -0
- package/dist/esm/components/UTSnackbar/stories/storiesConstants.js +163 -0
- package/dist/esm/components/UTSnackbar/styles.module.scss +82 -0
- package/dist/esm/components/UTSnackbar/theme.js +50 -0
- package/dist/esm/components/UTSnackbar/types.js +14 -0
- package/dist/esm/components/UTSnackbar/utils.js +46 -0
- package/dist/esm/components/UTTextArea/UTTextArea.stories.js +334 -0
- package/dist/esm/components/UTTextInput/UTTextInput.stories.js +431 -0
- package/dist/esm/constants/testIds.js +9 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/utils/hooks/useCSSVariables/constants.js +9 -0
- package/dist/index.js +7 -0
- package/dist/utils/hooks/useCSSVariables/constants.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _Slide = _interopRequireDefault(require("@material-ui/core/Slide"));
|
|
10
|
+
var _Snackbar = _interopRequireDefault(require("@material-ui/core/Snackbar"));
|
|
11
|
+
var _UTButton = _interopRequireDefault(require("../UTButton"));
|
|
12
|
+
var _UTIcon = _interopRequireDefault(require("../UTIcon"));
|
|
13
|
+
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
14
|
+
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
15
|
+
var _testIds = require("../../constants/testIds");
|
|
16
|
+
var _constants = require("./constants");
|
|
17
|
+
var _utils = require("./utils");
|
|
18
|
+
var _theme = require("./theme");
|
|
19
|
+
var _types = require("./types");
|
|
20
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
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); }
|
|
23
|
+
const UTSnackbar = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
button,
|
|
26
|
+
colorTheme = _constants.DEFAULT_PROPS.colorTheme,
|
|
27
|
+
dataTestId,
|
|
28
|
+
description,
|
|
29
|
+
icon,
|
|
30
|
+
message,
|
|
31
|
+
onClose,
|
|
32
|
+
open = _constants.DEFAULT_PROPS.open,
|
|
33
|
+
position = _constants.DEFAULT_PROPS.position,
|
|
34
|
+
secondaryButton,
|
|
35
|
+
timeDuration,
|
|
36
|
+
variant = _constants.DEFAULT_PROPS.variant,
|
|
37
|
+
withoutIcon
|
|
38
|
+
} = _ref;
|
|
39
|
+
const handleClose = (_, reason) => {
|
|
40
|
+
if (reason === 'clickaway') return;
|
|
41
|
+
onClose === null || onClose === void 0 || onClose();
|
|
42
|
+
};
|
|
43
|
+
const variantKey = "".concat(colorTheme, "-").concat(variant);
|
|
44
|
+
const variantClassKey = _constants.VARIANT_CLASS_MAP[variantKey];
|
|
45
|
+
const variantClass = _stylesModule.default[variantClassKey] || '';
|
|
46
|
+
const labelColorConfig = _constants.LABEL_COLOR_MAP[variantClassKey] || _constants.LABEL_COLOR_MAP.successDark;
|
|
47
|
+
const actionButtonConfig = _constants.ACTION_BUTTON_CONFIG_MAP[variantClassKey];
|
|
48
|
+
const iconName = withoutIcon ? null : icon || _constants.ICON_NAME_MAP[colorTheme];
|
|
49
|
+
const {
|
|
50
|
+
anchor,
|
|
51
|
+
transition
|
|
52
|
+
} = (0, _utils.getAnchorAndTransition)(position);
|
|
53
|
+
const testIds = {
|
|
54
|
+
close: dataTestId ? "".concat(dataTestId, ".close") : undefined,
|
|
55
|
+
description: dataTestId ? "".concat(dataTestId, ".").concat(_testIds.ID_CONSTANTS.DESCRIPTION, ".").concat(_testIds.ID_CONSTANTS.LABEL) : undefined,
|
|
56
|
+
icon: dataTestId ? "".concat(dataTestId, ".").concat(_testIds.ID_CONSTANTS.ICON) : undefined,
|
|
57
|
+
label: dataTestId ? "".concat(dataTestId, ".").concat(_testIds.ID_CONSTANTS.LABEL) : undefined,
|
|
58
|
+
primaryButton: dataTestId ? "".concat(dataTestId, ".button.").concat(_testIds.ID_CONSTANTS.SECONDARY_ACTION) : undefined,
|
|
59
|
+
secondaryButton: dataTestId ? "".concat(dataTestId, ".secondaryButton.").concat(_testIds.ID_CONSTANTS.TERTIARY_ACTION) : undefined
|
|
60
|
+
};
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
62
|
+
action: [!!secondaryButton && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
63
|
+
key: "secondary",
|
|
64
|
+
colorTheme: actionButtonConfig.colorTheme
|
|
65
|
+
}, secondaryButton, {
|
|
66
|
+
dataTestId: testIds.secondaryButton
|
|
67
|
+
}), secondaryButton.title), !!button && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
68
|
+
key: "primary",
|
|
69
|
+
colorTheme: actionButtonConfig.colorTheme
|
|
70
|
+
}, button, {
|
|
71
|
+
dataTestId: testIds.primaryButton
|
|
72
|
+
}), button.title), /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
73
|
+
key: "close",
|
|
74
|
+
colorTheme: actionButtonConfig.closeColorTheme || actionButtonConfig.colorTheme,
|
|
75
|
+
dataTestId: testIds.close,
|
|
76
|
+
Icon: "IconX",
|
|
77
|
+
onClick: handleClose,
|
|
78
|
+
variant: actionButtonConfig.variant
|
|
79
|
+
})],
|
|
80
|
+
anchorOrigin: anchor,
|
|
81
|
+
autoHideDuration: timeDuration,
|
|
82
|
+
ContentProps: {
|
|
83
|
+
className: "".concat(_stylesModule.default.snackbarContent, " ").concat(variantClass),
|
|
84
|
+
classes: {
|
|
85
|
+
action: _stylesModule.default.action,
|
|
86
|
+
message: _stylesModule.default.message
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
message: /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
className: _stylesModule.default.messageContent
|
|
91
|
+
}, iconName && /*#__PURE__*/_react.default.createElement(_UTIcon.default, {
|
|
92
|
+
className: _stylesModule.default.icon,
|
|
93
|
+
colorTheme: labelColorConfig.colorTheme,
|
|
94
|
+
dataTestId: testIds.icon,
|
|
95
|
+
name: iconName,
|
|
96
|
+
shade: labelColorConfig.shade,
|
|
97
|
+
size: 20
|
|
98
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: _stylesModule.default.textContent
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
101
|
+
colorTheme: labelColorConfig.colorTheme,
|
|
102
|
+
dataTestId: testIds.label,
|
|
103
|
+
shade: labelColorConfig.shade,
|
|
104
|
+
variant: "body",
|
|
105
|
+
weight: "medium",
|
|
106
|
+
withMarkdown: true
|
|
107
|
+
}, message), description && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
108
|
+
colorTheme: labelColorConfig.colorTheme,
|
|
109
|
+
dataTestId: testIds.description,
|
|
110
|
+
shade: labelColorConfig.shade,
|
|
111
|
+
variant: "small"
|
|
112
|
+
}, description))),
|
|
113
|
+
onClose: handleClose,
|
|
114
|
+
open: open,
|
|
115
|
+
TransitionComponent: _Slide.default,
|
|
116
|
+
TransitionProps: transition
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
UTSnackbar.propTypes = {
|
|
120
|
+
button: _types.buttonType,
|
|
121
|
+
colorTheme: (0, _propTypes.oneOf)(Object.values(_constants.COLOR_THEMES)),
|
|
122
|
+
dataTestId: _propTypes.string,
|
|
123
|
+
description: _propTypes.string,
|
|
124
|
+
icon: _propTypes.string,
|
|
125
|
+
message: _propTypes.string,
|
|
126
|
+
onClose: _propTypes.func,
|
|
127
|
+
open: _propTypes.bool,
|
|
128
|
+
position: (0, _propTypes.oneOf)(Object.values(_constants.POSITIONS)),
|
|
129
|
+
secondaryButton: _types.buttonType,
|
|
130
|
+
timeDuration: _propTypes.number,
|
|
131
|
+
variant: (0, _propTypes.oneOf)(Object.values(_constants.VARIANTS)),
|
|
132
|
+
withoutIcon: _propTypes.bool
|
|
133
|
+
};
|
|
134
|
+
var _default = exports.default = (0, _WithTheme.default)(undefined, _theme.retrieveMuiTheme)(UTSnackbar);
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WhiteVariants = exports.TopRight = exports.TopLeft = exports.Test = exports.SinIcono = exports.SemanticLight = exports.SemanticDark = exports.Playground = exports.ConMarkdown = exports.ConDescripcion = exports.ConAcciones = exports.ConAccionPrimaria = exports.BottomRight = exports.AllVariants = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _UTButton = _interopRequireDefault(require("../../UTButton"));
|
|
9
|
+
var _ = _interopRequireDefault(require(".."));
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
var _storiesConstants = require("./storiesConstants");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
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); }
|
|
15
|
+
const SEMANTIC_COLOR_THEMES = [_constants.COLOR_THEMES.success, _constants.COLOR_THEMES.error, _constants.COLOR_THEMES.warning, _constants.COLOR_THEMES.info];
|
|
16
|
+
const AllTypesDemo = () => {
|
|
17
|
+
const [snackState, setSnackState] = (0, _react.useState)({
|
|
18
|
+
open: false
|
|
19
|
+
});
|
|
20
|
+
const show = function (colorTheme) {
|
|
21
|
+
let variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.VARIANTS.dark;
|
|
22
|
+
return setSnackState({
|
|
23
|
+
colorTheme,
|
|
24
|
+
message: "Alerta de tipo: ".concat(colorTheme),
|
|
25
|
+
open: true,
|
|
26
|
+
variant
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const handleClose = () => setSnackState(prev => ({
|
|
30
|
+
...prev,
|
|
31
|
+
open: false
|
|
32
|
+
}));
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
34
|
+
style: {
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
gap: '8px',
|
|
38
|
+
maxWidth: '400px'
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
41
|
+
style: {
|
|
42
|
+
fontSize: '12px',
|
|
43
|
+
fontWeight: 600,
|
|
44
|
+
margin: '0 0 4px'
|
|
45
|
+
}
|
|
46
|
+
}, "Dark"), /*#__PURE__*/_react.default.createElement("div", {
|
|
47
|
+
style: {
|
|
48
|
+
display: 'flex',
|
|
49
|
+
gap: '8px',
|
|
50
|
+
flexWrap: 'wrap'
|
|
51
|
+
}
|
|
52
|
+
}, SEMANTIC_COLOR_THEMES.map(colorTheme => /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
53
|
+
key: colorTheme,
|
|
54
|
+
onClick: () => show(colorTheme),
|
|
55
|
+
size: "small",
|
|
56
|
+
variant: "outlined"
|
|
57
|
+
}, colorTheme)), /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
58
|
+
onClick: () => show(_constants.COLOR_THEMES.white),
|
|
59
|
+
size: "small",
|
|
60
|
+
variant: "outlined"
|
|
61
|
+
}, "white")), /*#__PURE__*/_react.default.createElement("p", {
|
|
62
|
+
style: {
|
|
63
|
+
fontSize: '12px',
|
|
64
|
+
fontWeight: 600,
|
|
65
|
+
margin: '8px 0 4px'
|
|
66
|
+
}
|
|
67
|
+
}, "Light"), /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
+
style: {
|
|
69
|
+
display: 'flex',
|
|
70
|
+
gap: '8px',
|
|
71
|
+
flexWrap: 'wrap'
|
|
72
|
+
}
|
|
73
|
+
}, SEMANTIC_COLOR_THEMES.map(colorTheme => /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
74
|
+
key: colorTheme,
|
|
75
|
+
onClick: () => show(colorTheme, _constants.VARIANTS.light),
|
|
76
|
+
size: "small",
|
|
77
|
+
variant: "outlined"
|
|
78
|
+
}, colorTheme, " light")), /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
79
|
+
onClick: () => show(_constants.COLOR_THEMES.white, _constants.VARIANTS.light),
|
|
80
|
+
size: "small",
|
|
81
|
+
variant: "outlined"
|
|
82
|
+
}, "white light")), /*#__PURE__*/_react.default.createElement(_.default, _extends({}, snackState, {
|
|
83
|
+
onClose: handleClose
|
|
84
|
+
})));
|
|
85
|
+
};
|
|
86
|
+
var _default = exports.default = {
|
|
87
|
+
args: {
|
|
88
|
+
message: 'Operación realizada exitosamente.',
|
|
89
|
+
open: true,
|
|
90
|
+
colorTheme: _constants.DEFAULT_PROPS.colorTheme,
|
|
91
|
+
position: _constants.DEFAULT_PROPS.position,
|
|
92
|
+
variant: _constants.DEFAULT_PROPS.variant,
|
|
93
|
+
withoutIcon: false,
|
|
94
|
+
icon: undefined,
|
|
95
|
+
timeDuration: undefined,
|
|
96
|
+
button: undefined,
|
|
97
|
+
secondaryButton: undefined,
|
|
98
|
+
description: undefined
|
|
99
|
+
},
|
|
100
|
+
argTypes: _storiesConstants.ARG_TYPES,
|
|
101
|
+
component: _.default,
|
|
102
|
+
parameters: {
|
|
103
|
+
controls: {
|
|
104
|
+
exclude: ['dataTestId', 'onClose']
|
|
105
|
+
},
|
|
106
|
+
docs: {
|
|
107
|
+
description: {
|
|
108
|
+
component: 'Componente de notificación tipo Snackbar. Soporta cinco `colorTheme`: los cuatro semánticos (`success`, `error`, `warning`, `info`) y `white` para notificaciones neutras. La prop `variant` controla si el fondo es oscuro o claro.'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
title: 'Energy-UI/UTSnackbar'
|
|
113
|
+
};
|
|
114
|
+
const Playground = exports.Playground = {
|
|
115
|
+
name: 'Playground'
|
|
116
|
+
};
|
|
117
|
+
const AllVariants = exports.AllVariants = {
|
|
118
|
+
name: 'Todas las Variantes',
|
|
119
|
+
parameters: {
|
|
120
|
+
docs: {
|
|
121
|
+
description: {
|
|
122
|
+
story: 'Hacé clic en cada botón para ver la variante correspondiente.'
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
render: () => /*#__PURE__*/_react.default.createElement(AllTypesDemo, null)
|
|
127
|
+
};
|
|
128
|
+
const SemanticDark = exports.SemanticDark = {
|
|
129
|
+
args: {
|
|
130
|
+
message: 'El archivo fue guardado correctamente.',
|
|
131
|
+
open: true,
|
|
132
|
+
colorTheme: _constants.COLOR_THEMES.success,
|
|
133
|
+
variant: _constants.VARIANTS.dark
|
|
134
|
+
},
|
|
135
|
+
name: 'Semántico / Dark',
|
|
136
|
+
parameters: {
|
|
137
|
+
docs: {
|
|
138
|
+
description: {
|
|
139
|
+
story: 'Fondo con el color semántico saturado y texto blanco. Cambiá `colorTheme` en el panel de controls para ver los cuatro tipos semánticos.'
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const SemanticLight = exports.SemanticLight = {
|
|
145
|
+
args: {
|
|
146
|
+
message: 'El archivo fue guardado correctamente.',
|
|
147
|
+
open: true,
|
|
148
|
+
colorTheme: _constants.COLOR_THEMES.success,
|
|
149
|
+
variant: _constants.VARIANTS.light
|
|
150
|
+
},
|
|
151
|
+
name: 'Semántico / Light',
|
|
152
|
+
parameters: {
|
|
153
|
+
docs: {
|
|
154
|
+
description: {
|
|
155
|
+
story: 'Fondo claro con texto oscuro accesible. Cambiá `colorTheme` para ver los cuatro tipos semánticos.'
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const WhiteVariants = exports.WhiteVariants = {
|
|
161
|
+
args: {
|
|
162
|
+
message: 'Notificación sin semántica asociada.',
|
|
163
|
+
open: true,
|
|
164
|
+
colorTheme: _constants.COLOR_THEMES.white,
|
|
165
|
+
variant: _constants.VARIANTS.light
|
|
166
|
+
},
|
|
167
|
+
name: 'White',
|
|
168
|
+
parameters: {
|
|
169
|
+
docs: {
|
|
170
|
+
description: {
|
|
171
|
+
story: 'Variante neutra sin semántica de color. Con `variant="light"` el fondo es blanco; con `variant="dark"` el fondo es oscuro.'
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const ConAccionPrimaria = exports.ConAccionPrimaria = {
|
|
177
|
+
args: {
|
|
178
|
+
button: {
|
|
179
|
+
title: 'Deshacer'
|
|
180
|
+
},
|
|
181
|
+
message: 'Se eliminaron 3 elementos.',
|
|
182
|
+
open: true,
|
|
183
|
+
colorTheme: _constants.COLOR_THEMES.error,
|
|
184
|
+
variant: _constants.VARIANTS.dark
|
|
185
|
+
},
|
|
186
|
+
name: 'Con Acción Primaria',
|
|
187
|
+
parameters: {
|
|
188
|
+
docs: {
|
|
189
|
+
description: {
|
|
190
|
+
story: 'La prop `button` agrega un botón de texto a la derecha del mensaje. Pasar `onClick` dentro del objeto para manejar el evento.'
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const ConAcciones = exports.ConAcciones = {
|
|
196
|
+
args: {
|
|
197
|
+
button: {
|
|
198
|
+
title: 'Confirmar'
|
|
199
|
+
},
|
|
200
|
+
secondaryButton: {
|
|
201
|
+
title: 'Cancelar'
|
|
202
|
+
},
|
|
203
|
+
message: 'Se eliminaron 3 elementos.',
|
|
204
|
+
open: true,
|
|
205
|
+
colorTheme: _constants.COLOR_THEMES.error,
|
|
206
|
+
variant: _constants.VARIANTS.dark
|
|
207
|
+
},
|
|
208
|
+
name: 'Con Acciones Primaria y Secundaria',
|
|
209
|
+
parameters: {
|
|
210
|
+
docs: {
|
|
211
|
+
description: {
|
|
212
|
+
story: 'Con `button` y `secondaryButton` se muestran dos botones de acción. Cualquier prop de `UTButton` puede pasarse dentro del objeto para personalizar su comportamiento.'
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const ConDescripcion = exports.ConDescripcion = {
|
|
218
|
+
args: {
|
|
219
|
+
message: 'El archivo fue guardado correctamente.',
|
|
220
|
+
description: 'Los cambios se aplicarán en la próxima sesión.',
|
|
221
|
+
open: true,
|
|
222
|
+
colorTheme: _constants.COLOR_THEMES.success,
|
|
223
|
+
variant: _constants.VARIANTS.light
|
|
224
|
+
},
|
|
225
|
+
name: 'Con Descripción',
|
|
226
|
+
parameters: {
|
|
227
|
+
docs: {
|
|
228
|
+
description: {
|
|
229
|
+
story: 'La prop `description` agrega un texto secundario debajo del mensaje principal con tipografía `small`.'
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const ConMarkdown = exports.ConMarkdown = {
|
|
235
|
+
args: {
|
|
236
|
+
message: 'El archivo **reporte_enero.pdf** fue generado *exitosamente*.',
|
|
237
|
+
open: true,
|
|
238
|
+
colorTheme: _constants.COLOR_THEMES.success,
|
|
239
|
+
variant: _constants.VARIANTS.light
|
|
240
|
+
},
|
|
241
|
+
name: 'Con Markdown',
|
|
242
|
+
parameters: {
|
|
243
|
+
docs: {
|
|
244
|
+
description: {
|
|
245
|
+
story: 'El campo `message` soporta sintaxis markdown a través de `UTLabel`.'
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
const TopRight = exports.TopRight = {
|
|
251
|
+
args: {
|
|
252
|
+
message: 'Esta notificación aparece en la esquina superior derecha.',
|
|
253
|
+
open: true,
|
|
254
|
+
colorTheme: _constants.COLOR_THEMES.info,
|
|
255
|
+
position: _constants.POSITIONS.topRight,
|
|
256
|
+
variant: _constants.VARIANTS.dark
|
|
257
|
+
},
|
|
258
|
+
name: 'Posición Superior Derecha',
|
|
259
|
+
parameters: {
|
|
260
|
+
docs: {
|
|
261
|
+
description: {
|
|
262
|
+
story: 'Con `position="topRight"` el snackbar aparece en la esquina superior derecha con slide desde la derecha.'
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
const BottomRight = exports.BottomRight = {
|
|
268
|
+
args: {
|
|
269
|
+
message: 'Esta notificación aparece en la esquina inferior derecha.',
|
|
270
|
+
open: true,
|
|
271
|
+
colorTheme: _constants.COLOR_THEMES.success,
|
|
272
|
+
position: _constants.POSITIONS.bottomRight,
|
|
273
|
+
variant: _constants.VARIANTS.dark
|
|
274
|
+
},
|
|
275
|
+
name: 'Posición Inferior Derecha',
|
|
276
|
+
parameters: {
|
|
277
|
+
docs: {
|
|
278
|
+
description: {
|
|
279
|
+
story: 'Con `position="bottomRight"` el snackbar aparece en la esquina inferior derecha con slide desde abajo.'
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
const TopLeft = exports.TopLeft = {
|
|
285
|
+
args: {
|
|
286
|
+
message: 'Esta notificación aparece en la esquina superior izquierda.',
|
|
287
|
+
open: true,
|
|
288
|
+
colorTheme: _constants.COLOR_THEMES.warning,
|
|
289
|
+
position: _constants.POSITIONS.topLeft,
|
|
290
|
+
variant: _constants.VARIANTS.dark
|
|
291
|
+
},
|
|
292
|
+
name: 'Posición Superior Izquierda',
|
|
293
|
+
parameters: {
|
|
294
|
+
docs: {
|
|
295
|
+
description: {
|
|
296
|
+
story: 'Con `position="topLeft"` el snackbar aparece en la esquina superior izquierda con slide desde arriba.'
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const SinIcono = exports.SinIcono = {
|
|
302
|
+
args: {
|
|
303
|
+
message: 'Notificación sin ícono.',
|
|
304
|
+
open: true,
|
|
305
|
+
colorTheme: _constants.COLOR_THEMES.warning,
|
|
306
|
+
variant: _constants.VARIANTS.dark,
|
|
307
|
+
withoutIcon: true
|
|
308
|
+
},
|
|
309
|
+
name: 'Sin Ícono',
|
|
310
|
+
parameters: {
|
|
311
|
+
docs: {
|
|
312
|
+
description: {
|
|
313
|
+
story: 'Con `withoutIcon: true` se oculta el ícono.'
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
const Test = exports.Test = {
|
|
319
|
+
name: 'Test',
|
|
320
|
+
parameters: {
|
|
321
|
+
docs: {
|
|
322
|
+
description: {
|
|
323
|
+
story: 'Story para el Storybook Test Runner. Renderiza variantes simultáneas para verificar el correcto renderizado.'
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
render: () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_.default, {
|
|
328
|
+
colorTheme: _constants.COLOR_THEMES.success,
|
|
329
|
+
message: "success dark",
|
|
330
|
+
open: true
|
|
331
|
+
}), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
332
|
+
colorTheme: _constants.COLOR_THEMES.error,
|
|
333
|
+
message: "error light",
|
|
334
|
+
open: true,
|
|
335
|
+
variant: _constants.VARIANTS.light
|
|
336
|
+
}), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
337
|
+
colorTheme: _constants.COLOR_THEMES.white,
|
|
338
|
+
message: "white dark",
|
|
339
|
+
open: true,
|
|
340
|
+
variant: _constants.VARIANTS.dark
|
|
341
|
+
}), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
342
|
+
button: {
|
|
343
|
+
title: 'Acción'
|
|
344
|
+
},
|
|
345
|
+
colorTheme: _constants.COLOR_THEMES.info,
|
|
346
|
+
description: "Texto secundario de descripci\xF3n",
|
|
347
|
+
message: "Con descripci\xF3n",
|
|
348
|
+
open: true
|
|
349
|
+
}))
|
|
350
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ARG_TYPES = void 0;
|
|
7
|
+
var _utils = require("stories/utils");
|
|
8
|
+
var _constants = require("../constants");
|
|
9
|
+
const ARG_TYPES = exports.ARG_TYPES = {
|
|
10
|
+
button: {
|
|
11
|
+
control: 'object',
|
|
12
|
+
description: 'Configuración del botón de acción primaria. Se hace spread en UTButton — incluir `title` como label y `onClick` como callback.',
|
|
13
|
+
table: {
|
|
14
|
+
defaultValue: {
|
|
15
|
+
summary: 'undefined'
|
|
16
|
+
},
|
|
17
|
+
type: {
|
|
18
|
+
summary: 'shape'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
colorTheme: {
|
|
23
|
+
control: 'select',
|
|
24
|
+
description: 'Tipo de color de la notificación. `success`, `error`, `warning` e `info` usan colores semánticos con ícono asociado. `white` usa colores neutros sin semántica.',
|
|
25
|
+
options: Object.values(_constants.COLOR_THEMES),
|
|
26
|
+
table: {
|
|
27
|
+
defaultValue: {
|
|
28
|
+
summary: _constants.COLOR_THEMES.success
|
|
29
|
+
},
|
|
30
|
+
type: {
|
|
31
|
+
summary: (0, _utils.joinArgTypes)(Object.values(_constants.COLOR_THEMES))
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
icon: {
|
|
36
|
+
control: 'text',
|
|
37
|
+
description: 'Nombre del ícono Tabler para sobreescribir el ícono por defecto (ej: `IconStar`). Si no se indica, se usa el ícono correspondiente al `colorTheme`.',
|
|
38
|
+
table: {
|
|
39
|
+
defaultValue: {
|
|
40
|
+
summary: 'undefined'
|
|
41
|
+
},
|
|
42
|
+
type: {
|
|
43
|
+
summary: 'string'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
description: {
|
|
48
|
+
control: 'text',
|
|
49
|
+
description: 'Texto secundario debajo del mensaje principal.',
|
|
50
|
+
table: {
|
|
51
|
+
defaultValue: {
|
|
52
|
+
summary: 'undefined'
|
|
53
|
+
},
|
|
54
|
+
type: {
|
|
55
|
+
summary: 'string'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
dataTestId: {
|
|
60
|
+
control: false,
|
|
61
|
+
description: 'Identificador de test raíz. Los sub-elementos derivan su testId automáticamente: `.icon`, `.label`, `.description.label`, `.close`, `.button.secondaryAction`, `.secondaryButton.tertiaryAction`.',
|
|
62
|
+
table: {
|
|
63
|
+
defaultValue: {
|
|
64
|
+
summary: 'undefined'
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
summary: 'string'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
message: {
|
|
72
|
+
control: 'text',
|
|
73
|
+
description: 'Mensaje principal a mostrar. Soporta markdown.',
|
|
74
|
+
table: {
|
|
75
|
+
defaultValue: {
|
|
76
|
+
summary: 'undefined'
|
|
77
|
+
},
|
|
78
|
+
type: {
|
|
79
|
+
summary: 'string'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
onClose: {
|
|
84
|
+
control: false,
|
|
85
|
+
description: 'Callback ejecutado al cerrar el snackbar.',
|
|
86
|
+
table: {
|
|
87
|
+
defaultValue: {
|
|
88
|
+
summary: 'undefined'
|
|
89
|
+
},
|
|
90
|
+
type: {
|
|
91
|
+
summary: 'function'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
open: {
|
|
96
|
+
control: 'boolean',
|
|
97
|
+
description: 'Controla si el snackbar está visible.',
|
|
98
|
+
table: {
|
|
99
|
+
defaultValue: {
|
|
100
|
+
summary: 'false'
|
|
101
|
+
},
|
|
102
|
+
type: {
|
|
103
|
+
summary: 'boolean'
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
secondaryButton: {
|
|
108
|
+
control: 'object',
|
|
109
|
+
description: 'Configuración del botón de acción secundaria. Se hace spread en UTButton — incluir `title` como label y `onClick` como callback.',
|
|
110
|
+
table: {
|
|
111
|
+
defaultValue: {
|
|
112
|
+
summary: 'undefined'
|
|
113
|
+
},
|
|
114
|
+
type: {
|
|
115
|
+
summary: 'shape'
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
timeDuration: {
|
|
120
|
+
control: 'number',
|
|
121
|
+
description: 'Duración en milisegundos antes del cierre automático.',
|
|
122
|
+
table: {
|
|
123
|
+
defaultValue: {
|
|
124
|
+
summary: 'undefined'
|
|
125
|
+
},
|
|
126
|
+
type: {
|
|
127
|
+
summary: 'number'
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
position: {
|
|
132
|
+
control: 'select',
|
|
133
|
+
description: 'Posición del snackbar en la pantalla.',
|
|
134
|
+
options: Object.values(_constants.POSITIONS),
|
|
135
|
+
table: {
|
|
136
|
+
defaultValue: {
|
|
137
|
+
summary: _constants.POSITIONS.bottomLeft
|
|
138
|
+
},
|
|
139
|
+
type: {
|
|
140
|
+
summary: (0, _utils.joinArgTypes)(Object.values(_constants.POSITIONS))
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
variant: {
|
|
145
|
+
control: 'inline-radio',
|
|
146
|
+
description: '`dark` usa el color del `colorTheme` como fondo con texto blanco; `light` usa una versión clara con texto oscuro accesible.',
|
|
147
|
+
options: Object.values(_constants.VARIANTS),
|
|
148
|
+
table: {
|
|
149
|
+
defaultValue: {
|
|
150
|
+
summary: _constants.VARIANTS.dark
|
|
151
|
+
},
|
|
152
|
+
type: {
|
|
153
|
+
summary: (0, _utils.joinArgTypes)(Object.values(_constants.VARIANTS))
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
withoutIcon: {
|
|
158
|
+
control: 'boolean',
|
|
159
|
+
description: 'Si es `true`, oculta el ícono.',
|
|
160
|
+
table: {
|
|
161
|
+
defaultValue: {
|
|
162
|
+
summary: 'undefined'
|
|
163
|
+
},
|
|
164
|
+
type: {
|
|
165
|
+
summary: 'boolean'
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|