@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
package/SafeHtml.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./dist/components/SafeHtml/SafeHtml');
@@ -11,7 +11,7 @@ var applyInertState = function applyInertState() {
11
11
  var topOverlay = overlayStack[overlayStack.length - 1];
12
12
  var children = Array.from(document.body.children);
13
13
  children.forEach(function (child) {
14
- var shouldBeInert = topOverlay ? child !== topOverlay : false;
14
+ var shouldBeInert = topOverlay ? child !== topOverlay && !child.hasAttribute('data-overlay-persistent') : false;
15
15
  if (shouldBeInert) {
16
16
  if (!currentlyModified.has(child)) {
17
17
  originalAriaHidden.set(child, child.getAttribute('aria-hidden'));
@@ -12,6 +12,31 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
12
12
  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; }
13
13
  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; } }
14
14
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
15
+ /**
16
+ * Hook interno que convierte la prop `sx` de un componente en:
17
+ * - estilos inline (keys que NO empiezan por `.`)
18
+ * - reglas CSS prefijadas con un identificador único de instancia
19
+ * (keys que empiezan por `.`, p.ej. `.cbx-card-body` o `.cbx-card:hover`)
20
+ *
21
+ * SEGURIDAD
22
+ * ---------
23
+ * La prop `sx` SOLO debe venir de código del propio consumidor, nunca de
24
+ * datos no confiables. Los consumidores la escriben como object literal en
25
+ * el JSX, por lo que su contenido no es atacable en la práctica. El único
26
+ * vector relevante es el HTML injection a través del `<style>`: un
27
+ * `</style>` dentro de un valor cerraría el nodo y permitiría contenido
28
+ * HTML arbitrario a continuación.
29
+ *
30
+ * Mitigación: el `<style>` se construye con
31
+ * `appendChild(document.createTextNode(css))` en vez de `innerHTML`. El
32
+ * navegador trata el contenido como nodo de texto puro y lo entrega al
33
+ * parser CSS sin pasar por el parser HTML, con lo que no es posible cerrar
34
+ * el `<style>` desde dentro.
35
+ *
36
+ * No se filtran selectores ni propiedades: cualquier cadena que fuera
37
+ * aceptada por la implementación previa sigue siendo aceptada ahora.
38
+ */
39
+
15
40
  var useDynamicStyles = function useDynamicStyles() {
16
41
  var styles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
42
  var _React$useState = _react["default"].useState({}),
@@ -33,7 +58,7 @@ var useDynamicStyles = function useDynamicStyles() {
33
58
  }, []);
34
59
  var css = '';
35
60
  var inlineStyles = {};
36
- Object.keys(styles).forEach(function (selector) {
61
+ Object.keys(styles || {}).forEach(function (selector) {
37
62
  var rules = styles[selector];
38
63
  var uniqueSelector = selector.startsWith('.') ? ".".concat(uniqueIdentifier, "-").concat(selector.slice(1)) : selector;
39
64
  if (selector.startsWith('.')) {
@@ -55,12 +80,22 @@ var useDynamicStyles = function useDynamicStyles() {
55
80
  }, [inlineStyles]);
56
81
  _react["default"].useEffect(function () {
57
82
  if (!css) return undefined;
83
+ // Guard SSR: si no hay `document` (Node SSR, tests sin jsdom) no hay
84
+ // nada que inyectar; el consumidor sigue recibiendo `stylesInLine`.
85
+ if (typeof document === 'undefined') return undefined;
58
86
  var styleElement = document.createElement('style');
59
- styleElement.type = 'text/css';
60
- styleElement.innerHTML = css;
87
+ // `appendChild(createTextNode(...))` evita el parser HTML (a diferencia
88
+ // de `innerHTML`): el contenido del <style> queda como texto puro y el
89
+ // navegador lo entrega directamente al parser CSS. Elimina la
90
+ // posibilidad de que un `</style>` accidental cierre el nodo.
91
+ styleElement.appendChild(document.createTextNode(css));
61
92
  document.head.appendChild(styleElement);
62
93
  return function () {
63
- document.head.removeChild(styleElement);
94
+ // Cleanup defensivo: si el nodo fue movido/eliminado por otro
95
+ // código, `removeChild` lanzaría. Comprobamos primero el padre.
96
+ if (styleElement.parentNode) {
97
+ styleElement.parentNode.removeChild(styleElement);
98
+ }
64
99
  };
65
100
  }, [css, uniqueIdentifier]);
66
101
  var prefixClass = _react["default"].useCallback(function (className) {
@@ -189,6 +189,12 @@ Object.defineProperty(exports, "RichTextInput", {
189
189
  return _RichTextInput["default"];
190
190
  }
191
191
  });
192
+ Object.defineProperty(exports, "SafeHtml", {
193
+ enumerable: true,
194
+ get: function get() {
195
+ return _SafeHtml["default"];
196
+ }
197
+ });
192
198
  Object.defineProperty(exports, "Scrollbar", {
193
199
  enumerable: true,
194
200
  get: function get() {
@@ -333,6 +339,12 @@ Object.defineProperty(exports, "Typography", {
333
339
  return _Typography["default"];
334
340
  }
335
341
  });
342
+ Object.defineProperty(exports, "sanitizeEditorHtml", {
343
+ enumerable: true,
344
+ get: function get() {
345
+ return _sanitizeHtml.sanitizeEditorHtml;
346
+ }
347
+ });
336
348
  Object.defineProperty(exports, "toast", {
337
349
  enumerable: true,
338
350
  get: function get() {
@@ -406,7 +418,9 @@ var _TimePicker = _interopRequireDefault(require("./components/TimePicker/TimePi
406
418
  var _Scrollbar = _interopRequireDefault(require("./components/Scrollbar/Scrollbar"));
407
419
  var _ScrollbarOld = _interopRequireDefault(require("./components/ScrollbarOld/ScrollbarOld"));
408
420
  var _RichTextInput = _interopRequireDefault(require("./components/RichTextInput/RichTextInput"));
421
+ var _SafeHtml = _interopRequireDefault(require("./components/SafeHtml/SafeHtml"));
409
422
  var _ToastProvider = _interopRequireDefault(require("./components/Toast/ToastProvider"));
410
423
  var _useToast = require("./components/Toast/useToast");
411
424
  var _toastStore = require("./components/Toast/toastStore");
425
+ var _sanitizeHtml = require("./utils/sanitizeHtml");
412
426
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
@@ -44,7 +44,13 @@
44
44
  background-color: white;
45
45
  max-height: 0;
46
46
  overflow: hidden;
47
- transition: max-height 0.2s ease-out;
47
+ visibility: hidden;
48
+ transition: max-height 0.2s ease-out, visibility 0s linear 0.2s;
49
+ }
50
+
51
+ .cbx-Accordion-block.expanded>.cbx-Accordion-expand-content {
52
+ visibility: visible;
53
+ transition: max-height 0.2s ease-out, visibility 0s linear 0s;
48
54
  }
49
55
 
50
56
  .cbx-Accordion-expand-content>div {
@@ -57,7 +57,7 @@ var Accordion = function Accordion(_ref) {
57
57
  disabled: disabled
58
58
  }
59
59
  });
60
- var _React$useState = _react["default"].useState(defaultExpanded),
60
+ var _React$useState = _react["default"].useState(defaultExpanded && !disabled),
61
61
  _React$useState2 = _slicedToArray(_React$useState, 2),
62
62
  expanded = _React$useState2[0],
63
63
  setExpanded = _React$useState2[1];
@@ -78,7 +78,7 @@ var Accordion = function Accordion(_ref) {
78
78
  }
79
79
  };
80
80
  _react["default"].useEffect(function () {
81
- closePanel();
81
+ if (disabled) closePanel();
82
82
  }, [disabled]);
83
83
  var handleAccordionClick = function handleAccordionClick(e) {
84
84
  e.stopPropagation();
@@ -7,14 +7,12 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports["default"] = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _Button = _interopRequireDefault(require("@mui/material/Button"));
11
10
  require("../../styles/main.css");
12
11
  require("./button.css");
13
- var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
14
- var _styled = _interopRequireDefault(require("@mui/material/styles/styled"));
15
- var _Typography = _interopRequireDefault(require("../Typography/Typography"));
12
+ var _ButtonBasic = _interopRequireDefault(require("../ButtonBasic/ButtonBasic"));
13
+ var _LoadingSection = _interopRequireDefault(require("../LoadingSection/LoadingSection"));
16
14
  var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
17
- var _excluded = ["id", "text", "onClick", "disabled", "loading", "variant", "fullWidth", "icon", "endIcon", "variantText", "stylesButton", "stylesText", "darkMode"];
15
+ var _excluded = ["id", "text", "onClick", "disabled", "loading", "variant", "fullWidth", "icon", "endIcon", "startIcon", "variantText", "stylesButton", "stylesText", "darkMode", "className", "style", "size"];
18
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
19
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); }
20
18
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -24,36 +22,12 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
24
22
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
25
23
  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; }
26
24
  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; }
27
- var CssButton = (0, _styled["default"])(_Button["default"])(function () {
28
- return {
29
- '& MuiButton-root': {
30
- paddingTop: 'var(--spacing12)',
31
- paddingBottom: 'var(--spacing12)',
32
- paddingLeft: 'var(--spacing24)'
33
- },
34
- '& MuiButton-containedPrimary': {
35
- paddingRight: 'var(--spacing16)'
36
- },
37
- '& MuiButton-outlinedPrimary': {
38
- paddingRight: 'var(--spacing24)',
39
- '&:hover': {
40
- boxShadow: '0 0 0 1px var(--primary)'
41
- }
42
- },
43
- '& MuiButton-textPrimary': {
44
- paddingRight: 'var(--spacing24)',
45
- '&:hover': {
46
- backgroundColor: '#FFF',
47
- boxShadow: '0 0 0 1px white, 0 2px 6px 2px rgba(0,0,0,0.38)'
48
- }
49
- },
50
- '& MuiButton-startIcon': {
51
- paddingRight: 'var(--spacing8)',
52
- margin: '0'
53
- }
54
- };
55
- });
56
- var Button = function Button(_ref) {
25
+ var renderIcon = function renderIcon(iconProp, arrowClass) {
26
+ return iconProp === 'arrow' ? /*#__PURE__*/_react["default"].createElement("i", {
27
+ className: arrowClass
28
+ }) : iconProp;
29
+ };
30
+ var Button = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
57
31
  var id = _ref.id,
58
32
  text = _ref.text,
59
33
  onClick = _ref.onClick,
@@ -63,10 +37,14 @@ var Button = function Button(_ref) {
63
37
  fullWidth = _ref.fullWidth,
64
38
  icon = _ref.icon,
65
39
  endIcon = _ref.endIcon,
40
+ startIcon = _ref.startIcon,
66
41
  variantText = _ref.variantText,
67
42
  stylesButton = _ref.stylesButton,
68
43
  stylesText = _ref.stylesText,
69
44
  darkMode = _ref.darkMode,
45
+ className = _ref.className,
46
+ style = _ref.style,
47
+ size = _ref.size,
70
48
  props = _objectWithoutProperties(_ref, _excluded);
71
49
  var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
72
50
  requireAccessibleText = _useA11yGuard.requireAccessibleText;
@@ -104,7 +82,6 @@ var Button = function Button(_ref) {
104
82
  border = 'var(--white)';
105
83
  }
106
84
  } else if (variant === 'error') {
107
- // this better as an state, not a variant
108
85
  buttonVariant = 'contained';
109
86
  background = 'var(--error)';
110
87
  buttonColor = 'var(--gray1)';
@@ -120,59 +97,68 @@ var Button = function Button(_ref) {
120
97
  buttonVariant = 'text';
121
98
  buttonColor = 'var(--primary)';
122
99
  }
123
- var shouldAnimateArrow = function shouldAnimateArrow(variantBtn) {
124
- return variantBtn === 'secondary' || variantBtn === 'tertiary' || endIcon || icon;
100
+ var shouldAnimateArrow = variant === 'secondary' || variant === 'tertiary' || !!endIcon || !!icon;
101
+ var resolvedStartIcon = startIcon || icon && renderIcon(icon, 'ri-arrow-left-s-line');
102
+ var getEndContent = function getEndContent() {
103
+ if (loading) {
104
+ return /*#__PURE__*/_react["default"].createElement("span", {
105
+ className: "cbx-button-containerLoading"
106
+ }, /*#__PURE__*/_react["default"].createElement(_LoadingSection["default"], {
107
+ size: 13,
108
+ thickness: 3.6,
109
+ color: elementsColor
110
+ }));
111
+ }
112
+ if (endIcon) {
113
+ return /*#__PURE__*/_react["default"].createElement("span", {
114
+ className: "cbx-button-endIcon"
115
+ }, renderIcon(endIcon, 'ri-arrow-right-s-line'));
116
+ }
117
+ if (buttonVariant === 'contained') {
118
+ return /*#__PURE__*/_react["default"].createElement("span", {
119
+ className: "cbx-button-containerArrow"
120
+ }, /*#__PURE__*/_react["default"].createElement("i", {
121
+ className: "ri-arrow-right-s-line arrow-primary",
122
+ style: {
123
+ color: elementsColor
124
+ }
125
+ }));
126
+ }
127
+ return undefined;
125
128
  };
126
- return /*#__PURE__*/_react["default"].createElement(CssButton, _extends({
129
+ var computedStyle = _objectSpread(_objectSpread({
130
+ backgroundColor: background,
131
+ color: buttonColor,
132
+ borderColor: border
133
+ }, stylesButton), disabled || loading ? {
134
+ opacity: '0.4'
135
+ } : {});
136
+ var classes = ['cbx-button', "cbx-button-".concat(buttonVariant), buttonVariant, size && size !== 'medium' ? "cbx-button-size-".concat(size) : '', shouldAnimateArrow ? 'cbx-button-compact' : '', shouldAnimateArrow && disabled ? 'cbx-button-outlined-disabled' : '', icon ? 'cbx-button-with-icon' : '', endIcon ? 'cbx-button-with-end-icon' : '', !shouldAnimateArrow ? "cbx-button-hoverAndAnimation".concat(fullWidth ? '-fullWidth' : '') : '', className || ''].filter(Boolean).join(' ');
137
+ return /*#__PURE__*/_react["default"].createElement(_ButtonBasic["default"], _extends({
138
+ ref: ref,
127
139
  id: id,
128
- sx: {
129
- minWidth: !shouldAnimateArrow(variant) ? '8.75rem' : '6.25rem',
130
- minHeight: 'var(--spacing48)',
131
- boxShadow: 'none',
132
- letterSpacing: '1px',
133
- lineHeight: 'normal'
134
- },
135
- className: "cbx-button ".concat(shouldAnimateArrow(variant) && disabled ? 'cbx-button-outlined-disabled' : '', " ").concat(buttonVariant, " ").concat(icon ? 'cbx-button-with-icon' : '', " ").concat(endIcon ? 'cbx-button-with-end-icon' : '', " ").concat(!shouldAnimateArrow(variant) && "cbx-button-hoverAndAnimation".concat(fullWidth ? '-fullWidth' : '')),
136
- disabled: loading || disabled,
137
- variant: buttonVariant,
138
- style: _objectSpread(_objectSpread({
139
- backgroundColor: background,
140
- color: buttonColor,
141
- lineHeight: 'normal',
142
- borderColor: border
143
- }, stylesButton), disabled || loading ? {
144
- opacity: '0.4'
145
- } : {}),
146
- disableFocusRipple: true,
140
+ text: text,
141
+ variant: "muiButton-".concat(buttonVariant),
142
+ variantText: variantText,
143
+ className: classes,
144
+ disabled: disabled || loading,
147
145
  fullWidth: fullWidth,
148
146
  onClick: onClick,
149
- startIcon: icon && icon === 'arrow' ? /*#__PURE__*/_react["default"].createElement("i", {
150
- className: "ri-arrow-left-s-line"
151
- }) : icon,
152
- endIcon: !loading && (endIcon && endIcon === 'arrow' ? /*#__PURE__*/_react["default"].createElement("i", {
153
- className: "ri-arrow-right-s-line"
154
- }) : endIcon)
155
- }, props), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
156
- color: buttonColor,
157
- variant: variantText,
158
- styles: _objectSpread({}, stylesText)
159
- }, text), buttonVariant === 'contained' && !loading && !endIcon && /*#__PURE__*/_react["default"].createElement("span", {
160
- className: "cbx-button-containerArrow"
161
- }, /*#__PURE__*/_react["default"].createElement("i", {
162
- className: "ri-arrow-right-s-line arrow-primary",
163
- style: {
164
- color: elementsColor
165
- }
166
- })), loading && /*#__PURE__*/_react["default"].createElement("span", {
167
- className: "cbx-button-containerLoading"
168
- }, /*#__PURE__*/_react["default"].createElement(_CircularProgress["default"], {
169
- sx: {
170
- color: elementsColor
171
- },
172
- size: 13
173
- })));
174
- };
175
- Button.displayName = "Button";
147
+ startIcon: resolvedStartIcon ? /*#__PURE__*/_react["default"].createElement("span", {
148
+ className: "cbx-button-startIcon"
149
+ }, resolvedStartIcon) : undefined,
150
+ endIcon: getEndContent(),
151
+ "aria-busy": loading || undefined,
152
+ stylesButton: _objectSpread({
153
+ color: buttonColor,
154
+ fontWeight: 400
155
+ }, stylesText),
156
+ style: _objectSpread({
157
+ paddingLeft: undefined,
158
+ paddingRight: undefined
159
+ }, style !== undefined ? style : computedStyle)
160
+ }, props));
161
+ });
176
162
  Button.propTypes = {
177
163
  text: _propTypes["default"].node,
178
164
  onClick: _propTypes["default"].func,
@@ -182,8 +168,11 @@ Button.propTypes = {
182
168
  fullWidth: _propTypes["default"].bool,
183
169
  icon: _propTypes["default"].node,
184
170
  endIcon: _propTypes["default"].node,
171
+ startIcon: _propTypes["default"].node,
185
172
  variantText: _propTypes["default"].string,
186
- darkMode: _propTypes["default"].bool
173
+ darkMode: _propTypes["default"].bool,
174
+ size: _propTypes["default"].oneOf(['small', 'medium', 'large']),
175
+ type: _propTypes["default"].string
187
176
  };
188
177
  Button.defaultProps = {
189
178
  text: null,
@@ -194,8 +183,11 @@ Button.defaultProps = {
194
183
  fullWidth: false,
195
184
  icon: null,
196
185
  endIcon: null,
186
+ startIcon: null,
197
187
  variantText: '',
198
- darkMode: false
188
+ darkMode: false,
189
+ size: undefined,
190
+ type: 'button'
199
191
  };
200
192
  var _default = Button;
201
193
  exports["default"] = _default;
@@ -1,3 +1,152 @@
1
+ .cbx-button.cbx-buttonBasic {
2
+ height: auto;
3
+ min-height: var(--spacing48);
4
+ min-width: 8.75rem;
5
+ padding: 6px 8px;
6
+ border: 0;
7
+ border-radius: 4px;
8
+ background-color: transparent;
9
+ box-shadow: none;
10
+ font-family: var(--font-primary);
11
+ font-weight: 500;
12
+ font-size: 1rem;
13
+ line-height: normal;
14
+ letter-spacing: 1px;
15
+ text-transform: uppercase;
16
+ -webkit-tap-highlight-color: transparent;
17
+ appearance: none;
18
+ transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
19
+ }
20
+
21
+ .cbx-button.cbx-buttonBasic::-moz-focus-inner {
22
+ border-style: none;
23
+ }
24
+
25
+ .cbx-button.cbx-buttonBasic.cbx-button-compact {
26
+ min-width: 6.25rem;
27
+ }
28
+
29
+ .cbx-button.cbx-buttonBasic:disabled {
30
+ pointer-events: none;
31
+ cursor: default;
32
+ }
33
+
34
+ .cbx-button.cbx-buttonBasic .cbx-buttonBasic-container {
35
+ position: static;
36
+ justify-content: flex-start;
37
+ }
38
+
39
+ .cbx-button.cbx-buttonBasic .cbx-buttonBasic-container-start-icon,
40
+ .cbx-button.cbx-buttonBasic .cbx-buttonBasic-container-end-icon {
41
+ display: contents;
42
+ }
43
+
44
+ .cbx-button.cbx-buttonBasic .cbx-buttonBasic-container-start-icon i,
45
+ .cbx-button.cbx-buttonBasic .cbx-buttonBasic-container-end-icon i {
46
+ font-size: inherit !important;
47
+ vertical-align: baseline !important;
48
+ }
49
+
50
+ .cbx-button.cbx-buttonBasic .cbx-button-startIcon > *:nth-of-type(1),
51
+ .cbx-button.cbx-buttonBasic .cbx-button-endIcon > *:nth-of-type(1) {
52
+ font-size: 20px !important;
53
+ }
54
+
55
+ .cbx-button.cbx-buttonBasic .ripple {
56
+ background-color: currentColor !important;
57
+ }
58
+
59
+ .cbx-button.cbx-buttonBasic.cbx-button-contained {
60
+ padding: 6px 16px;
61
+ background-color: var(--primary);
62
+ color: var(--white);
63
+ }
64
+
65
+ .cbx-button.cbx-buttonBasic.cbx-button-contained:hover {
66
+ box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
67
+ }
68
+
69
+ .cbx-button.cbx-buttonBasic.cbx-button-contained:active {
70
+ box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
71
+ }
72
+
73
+ .cbx-button.cbx-buttonBasic.cbx-button-contained:disabled {
74
+ background-color: rgba(0, 0, 0, 0.12);
75
+ color: rgba(0, 0, 0, 0.26);
76
+ }
77
+
78
+ .cbx-button.cbx-buttonBasic.cbx-button-outlined {
79
+ padding: 5px 15px;
80
+ border: 1px solid var(--primary50);
81
+ color: var(--primary);
82
+ }
83
+
84
+ .cbx-button.cbx-buttonBasic.cbx-button-outlined:hover {
85
+ border-color: var(--primary);
86
+ background-color: rgba(56, 57, 140, 0.04);
87
+ background-color: color-mix(in srgb, var(--primary) 4%, transparent);
88
+ }
89
+
90
+ .cbx-button.cbx-buttonBasic.cbx-button-outlined:disabled {
91
+ border-color: rgba(0, 0, 0, 0.12);
92
+ color: rgba(0, 0, 0, 0.26);
93
+ }
94
+
95
+ .cbx-button.cbx-buttonBasic.cbx-button-text {
96
+ color: var(--primary);
97
+ }
98
+
99
+ .cbx-button.cbx-buttonBasic.cbx-button-text:hover {
100
+ background-color: rgba(56, 57, 140, 0.04);
101
+ background-color: color-mix(in srgb, var(--primary) 4%, transparent);
102
+ }
103
+
104
+ .cbx-button.cbx-buttonBasic.cbx-button-text:disabled {
105
+ color: rgba(0, 0, 0, 0.26);
106
+ }
107
+
108
+ .cbx-button.cbx-buttonBasic.cbx-button-size-small.cbx-button-contained {
109
+ padding: 4px 10px;
110
+ font-size: 0.8125rem;
111
+ }
112
+
113
+ .cbx-button.cbx-buttonBasic.cbx-button-size-small.cbx-button-outlined {
114
+ padding: 3px 9px;
115
+ font-size: 0.8125rem;
116
+ }
117
+
118
+ .cbx-button.cbx-buttonBasic.cbx-button-size-small.cbx-button-text {
119
+ padding: 4px 5px;
120
+ font-size: 0.8125rem;
121
+ }
122
+
123
+ .cbx-button.cbx-buttonBasic.cbx-button-size-large.cbx-button-contained {
124
+ padding: 8px 22px;
125
+ font-size: 0.9375rem;
126
+ }
127
+
128
+ .cbx-button.cbx-buttonBasic.cbx-button-size-large.cbx-button-outlined {
129
+ padding: 7px 21px;
130
+ font-size: 0.9375rem;
131
+ }
132
+
133
+ .cbx-button.cbx-buttonBasic.cbx-button-size-large.cbx-button-text {
134
+ padding: 8px 11px;
135
+ font-size: 0.9375rem;
136
+ }
137
+
138
+ .cbx-button-startIcon {
139
+ display: inline-flex;
140
+ margin-right: 8px;
141
+ margin-left: -4px;
142
+ }
143
+
144
+ .cbx-button-endIcon {
145
+ display: inline-flex;
146
+ margin-right: -4px;
147
+ margin-left: 8px;
148
+ }
149
+
1
150
  .cbx-button-with-icon {
2
151
  padding-left: var(--spacing20) !important;
3
152
  }
@@ -7,52 +156,58 @@
7
156
  margin-bottom: var(--spacing4);
8
157
  }
9
158
 
10
- .cbx-button:focus-visible {
159
+ .cbx-button.cbx-buttonBasic:focus-visible {
160
+ outline: none;
11
161
  box-shadow: inset 0 0 0 2px white, 0px 0px 5px 3px var(--accent);
12
162
  }
13
163
 
14
- .cbx-button-hoverAndAnimation{
15
- justify-content: start!important;
164
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation {
165
+ justify-content: start !important;
16
166
  }
17
167
 
18
- .cbx-button-hoverAndAnimation-fullWidth{
168
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation-fullWidth {
19
169
  justify-content: center;
20
170
  }
21
171
 
22
172
  .cbx-button-containerArrow {
23
173
  display: flex;
24
- height: 100%;
25
- align-items: center;
174
+ height: 100%;
175
+ align-items: center;
26
176
  margin-bottom: var(--spacing4);
27
177
  margin-left: var(--spacing20);
28
178
  }
29
179
 
30
180
  .cbx-button-containerLoading {
31
181
  display: flex;
32
- height: 100%;
33
- align-items: center;
182
+ height: 100%;
183
+ align-items: center;
34
184
  margin-bottom: var(--spacing4);
35
185
  margin-left: var(--spacing12);
36
186
  }
37
187
 
38
- .cbx-button-hoverAndAnimation .cbx-button-containerArrow, .cbx-button-hoverAndAnimation-fullWidth .cbx-button-containerArrow, .cbx-button-hoverAndAnimation .cbx-button-containerLoading, .cbx-button-hoverAndAnimation-fullWidth .cbx-button-containerLoading {
188
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation .cbx-button-containerArrow,
189
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation-fullWidth .cbx-button-containerArrow,
190
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation .cbx-button-containerLoading,
191
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation-fullWidth .cbx-button-containerLoading {
39
192
  margin-left: var(--spacing24);
40
193
  margin-right: var(--spacing8);
41
194
  position: relative;
42
195
  transition: padding .4s ease-in-out;
43
196
  }
44
197
 
45
- .cbx-button-hoverAndAnimation span i , .cbx-button-hoverAndAnimation-fullWidth span i {
198
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation span i,
199
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation-fullWidth span i {
46
200
  position: absolute;
47
201
  transition: .4s ease-in-out;
48
202
  left: 0;
49
203
  }
50
204
 
51
- .cbx-button-hoverAndAnimation:hover span i , .cbx-button-hoverAndAnimation-fullWidth:hover span i {
52
- padding-left: var(--spacing8);
53
- }
205
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation:hover span i,
206
+ .cbx-button.cbx-buttonBasic.cbx-button-hoverAndAnimation-fullWidth:hover span i {
207
+ padding-left: var(--spacing8) !important;
208
+ }
54
209
 
55
- .cbx-button-outlined-disabled{
56
- color: var(--gray5)!important;
57
- border-color: var(--primary)!important;
210
+ .cbx-button-outlined-disabled {
211
+ color: var(--gray5) !important;
212
+ border-color: var(--primary) !important;
58
213
  }
@@ -110,8 +110,7 @@ var Calendar = function Calendar(_ref) {
110
110
  return /*#__PURE__*/_react["default"].createElement("span", {
111
111
  key: "".concat(dayLabel, "-").concat(dayIndex),
112
112
  className: prefixClass('cbx-calendar-weekday'),
113
- "aria-hidden": "true",
114
- title: dayLabel
113
+ "aria-hidden": "true"
115
114
  }, dayLabel);
116
115
  })), /*#__PURE__*/_react["default"].createElement("div", {
117
116
  className: prefixClass('cbx-calendar-grid'),
@@ -160,7 +159,7 @@ var Calendar = function Calendar(_ref) {
160
159
  return /*#__PURE__*/_react["default"].createElement("button", {
161
160
  type: "button",
162
161
  key: resolvedMonths[monthIndex],
163
- title: resolvedMonths[monthIndex],
162
+ title: resolvedMonths[monthIndex] !== monthLabel ? resolvedMonths[monthIndex] : undefined,
164
163
  className: prefixClass("cbx-calendar-monthCell ".concat(viewDate.getMonth() === monthIndex ? 'cbx-calendar-monthCell-selected' : '')),
165
164
  onClick: function onClick() {
166
165
  return handleMonthSelect(monthIndex);
@@ -206,8 +205,7 @@ var Calendar = function Calendar(_ref) {
206
205
  variant: "M",
207
206
  fontWeight: 600,
208
207
  className: prefixClass('cbx-calendar-headerLabel'),
209
- onClick: headerLabelClickable ? handleHeaderLabelClick : undefined,
210
- title: headerLabel
208
+ onClick: headerLabelClickable ? handleHeaderLabelClick : undefined
211
209
  }, headerLabel), /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
212
210
  prefixClass: prefixClass,
213
211
  className: "cbx-calendar-navButton",
@@ -141,7 +141,7 @@ button.cbx-calendar-headerLabel:hover {
141
141
  }
142
142
 
143
143
  .cbx-calendar-day-outside {
144
- color: var(--gray2);
144
+ color: var(--gray4);
145
145
  }
146
146
 
147
147
  .cbx-calendar-day-today {
@@ -76,8 +76,7 @@ var RangeCalendar = function RangeCalendar(_ref) {
76
76
  component: "span",
77
77
  variant: "M",
78
78
  fontWeight: 600,
79
- className: prefixClass('cbx-calendar-headerLabel'),
80
- title: "".concat(resolvedMonths[panelDate.getMonth()], " ").concat(panelDate.getFullYear())
79
+ className: prefixClass('cbx-calendar-headerLabel')
81
80
  }, "".concat(resolvedMonths[panelDate.getMonth()], " ").concat(panelDate.getFullYear())), isLastPanel ? /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
82
81
  prefixClass: prefixClass,
83
82
  className: "cbx-calendar-navButton",
@@ -98,8 +97,7 @@ var RangeCalendar = function RangeCalendar(_ref) {
98
97
  return /*#__PURE__*/_react["default"].createElement("span", {
99
98
  key: "".concat(dayLabel, "-").concat(dayIndex),
100
99
  className: prefixClass('cbx-calendar-weekday'),
101
- "aria-hidden": "true",
102
- title: dayLabel
100
+ "aria-hidden": "true"
103
101
  }, dayLabel);
104
102
  })), /*#__PURE__*/_react["default"].createElement("div", {
105
103
  className: prefixClass('cbx-calendar-grid'),