@councilbox/councilbox-ui 1.0.1 → 2.0.0
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/dist/HOCs/useDynamicStyles.js +99 -0
- package/dist/HOCs/useRipple.js +91 -0
- package/dist/build-index.js +8 -0
- package/dist/components/1.Introduction.stories.mdx +2 -1
- package/dist/components/2.Changelog.stories.mdx +3 -0
- package/dist/components/3.Guide.stories.mdx +56 -0
- package/dist/components/Accordion/Accordion.css +39 -1
- package/dist/components/Accordion/Accordion.js +84 -45
- package/dist/components/Accordion/Accordion.stories.js +4 -2
- package/dist/components/Accordion/AccordionOld.css +16 -0
- package/dist/components/Accordion/AccordionOld.js +115 -0
- package/dist/components/Accordion/DesignAccordion.stories.js +38 -0
- package/dist/components/Alert/Alert.css +5 -0
- package/dist/components/Alert/Alert.js +17 -6
- package/dist/components/Avatar/Avatar.css +3 -3
- package/dist/components/Avatar/Avatar.js +36 -20
- package/dist/components/Avatar/AvatarOld.js +138 -0
- package/dist/components/Avatar/DesignAvatar.stories.js +1 -1
- package/dist/components/Block/Block.js +17 -2
- package/dist/components/ButtonBasic/ButtonBasic.css +264 -20
- package/dist/components/ButtonBasic/ButtonBasic.js +85 -110
- package/dist/components/ButtonBasic/ButtonBasicOld.css +41 -0
- package/dist/components/ButtonBasic/ButtonBasicOld.js +231 -0
- package/dist/components/Checkbox/Checkbox.css +101 -22
- package/dist/components/Checkbox/Checkbox.js +119 -63
- package/dist/components/Checkbox/CheckboxOld.css +31 -0
- package/dist/components/Checkbox/CheckboxOld.js +112 -0
- package/dist/components/DragDrop/DragDrop.js +24 -9
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +4 -2
- package/dist/components/DrawerPanel/DrawerPanel.css +76 -36
- package/dist/components/DrawerPanel/DrawerPanel.js +137 -115
- package/dist/components/DrawerPanel/DrawerPanelOld.css +56 -0
- package/dist/components/DrawerPanel/DrawerPanelOld.js +233 -0
- package/dist/components/DropDown/DesignDropDown.stories.js +146 -17
- package/dist/components/DropDown/DropDown.css +96 -1
- package/dist/components/DropDown/DropDown.js +363 -82
- package/dist/components/DropDown/DropDown.stories.js +1 -0
- package/dist/components/DropDown/DropDownOld.css +3 -0
- package/dist/components/DropDown/DropDownOld.js +186 -0
- package/dist/components/DropDown/PopoverPlayground.css +22 -0
- package/dist/components/DropDown/PopoverPlayground.js +235 -0
- package/dist/components/EnhancedTable/EnhancedTable.js +5 -6
- package/dist/components/FabButton/DesignFabButton.stories.js +3 -1
- package/dist/components/FabButton/FabButton.js +25 -5
- package/dist/components/Grid/DesignGrid.stories.js +9 -3
- package/dist/components/Grid/Grid.css +325 -0
- package/dist/components/Grid/Grid.js +57 -16
- package/dist/components/Grid/GridItem.js +31 -13
- package/dist/components/Grid/GridItemOld.js +43 -0
- package/dist/components/Grid/GridOld.css +0 -0
- package/dist/components/Grid/GridOld.js +53 -0
- package/dist/components/Header/Header.js +95 -116
- package/dist/components/IconButton/DesignIconButton.stories.js +22 -2
- package/dist/components/IconButton/IconButton.css +121 -1
- package/dist/components/IconButton/IconButton.js +98 -53
- package/dist/components/IconButton/IconButtonOld.css +0 -0
- package/dist/components/IconButton/IconButtonOld.js +138 -0
- package/dist/components/IconButtonSquare/IconButtonSquare.js +20 -90
- package/dist/components/IconButtonSquare/IconButtonSquareOld.css +43 -0
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +133 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.css +109 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +316 -77
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +118 -6
- package/dist/components/InputAutocomplete/InputAutocompleteOld.css +5 -0
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +178 -0
- package/dist/components/InputPassword/InputPassword.js +10 -20
- package/dist/components/InputText/InputText.css +442 -1
- package/dist/components/InputText/InputText.js +298 -239
- package/dist/components/InputText/InputText.stories.js +12 -3
- package/dist/components/InputText/InputTextOld.css +10 -0
- package/dist/components/InputText/InputTextOld.js +340 -0
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +30 -4
- package/dist/components/InputTextArea/InputTextArea.js +13 -6
- package/dist/components/LoadingSection/LoadingSection.css +44 -2
- package/dist/components/LoadingSection/LoadingSection.js +63 -9
- package/dist/components/MenuItem/DesignMenuItem.stories.js +1 -0
- package/dist/components/MenuItem/MenuItem.css +31 -6
- package/dist/components/MenuItem/MenuItem.js +95 -50
- package/dist/components/MenuItem/MenuItemOld.js +139 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +60 -40
- package/dist/components/MenuLateralRight/MenuLateralRight.js +23 -8
- package/dist/components/Modal/DesignModal.stories.js +54 -0
- package/dist/components/Modal/Modal.css +81 -2
- package/dist/components/Modal/Modal.js +112 -80
- package/dist/components/Modal/Modal.stories.js +13 -2
- package/dist/components/Modal/ModalOld.css +3 -0
- package/dist/components/Modal/ModalOld.js +230 -0
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +9 -1
- package/dist/components/PaginationFooter/PaginationFooter.css +73 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +45 -87
- package/dist/components/RadioButton/Radio.css +115 -16
- package/dist/components/RadioButton/Radio.js +70 -94
- package/dist/components/RadioButton/Radio.stories.js +42 -18
- package/dist/components/RadioButton/RadioOld.css +31 -0
- package/dist/components/RadioButton/RadioOld.js +142 -0
- package/dist/components/Ripple/DesignRipple.js +77 -0
- package/dist/components/Ripple/Ripple.stories.js +45 -0
- package/dist/components/Scrollbar/Scrollbar.js +21 -6
- package/dist/components/SelectInput/DesignSelectInput.js +62 -23
- package/dist/components/SelectInput/SelectInput.css +128 -10
- package/dist/components/SelectInput/SelectInput.js +233 -246
- package/dist/components/SelectInput/SelectInputOld.css +17 -0
- package/dist/components/SelectInput/SelectInputOld.js +325 -0
- package/dist/components/Stars/Stars.css +28 -28
- package/dist/components/Stars/Stars.js +22 -12
- package/dist/components/Stepper/Stepper.css +1 -0
- package/dist/components/Stepper/Stepper.js +81 -24
- package/dist/components/Table/DesignTable.stories.js +1 -0
- package/dist/components/Table/Table.css +56 -53
- package/dist/components/Table/Table.js +55 -75
- package/dist/components/Table/TableOld.css +79 -0
- package/dist/components/Table/TableOld.js +165 -0
- package/dist/components/Tabs/DesignTabs.js +37 -12
- package/dist/components/Tabs/Tabs.css +39 -4
- package/dist/components/Tabs/Tabs.js +194 -30
- package/dist/components/Tabs/Tabs.stories.js +8 -1
- package/dist/components/Tabs/TabsOld.js +92 -0
- package/dist/components/Tag/Tag.js +19 -9
- package/dist/components/Toggle/Toggle.css +122 -3
- package/dist/components/Toggle/Toggle.js +95 -68
- package/dist/components/Tooltip/DesignTooltip.stories.js +48 -0
- package/dist/components/Tooltip/Tooltip.css +75 -0
- package/dist/components/Tooltip/Tooltip.js +126 -0
- package/dist/components/Tooltip/Tooltip.stories.js +40 -0
- package/dist/components/Typography/Typography.css +9 -0
- package/dist/components/Typography/Typography.js +30 -21
- package/dist/components/Typography/TypographyOld.js +132 -0
- package/dist/styles/colorConsts.css +24 -0
- package/dist/styles/main.css +41 -49
- package/dist/styles/scpacingConsts.css +26 -0
- package/dist/styles/zIndexConsts.css +9 -0
- package/package.json +2 -1
|
@@ -15,7 +15,9 @@ require("./Tag.css");
|
|
|
15
15
|
|
|
16
16
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
19
|
+
|
|
20
|
+
var _excluded = ["variant", "id", "className", "text", "close", "icon", "iconText", "background", "iconTypographyProps", "textTypographyProps", "styles", "borderColor", "colorText", "sx", "style"];
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
@@ -45,24 +47,31 @@ var Tag = function Tag(_ref) {
|
|
|
45
47
|
styles = _ref.styles,
|
|
46
48
|
borderColor = _ref.borderColor,
|
|
47
49
|
colorText = _ref.colorText,
|
|
50
|
+
sx = _ref.sx,
|
|
51
|
+
style = _ref.style,
|
|
48
52
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
49
53
|
|
|
54
|
+
var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
|
|
55
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
56
|
+
prefixClass = _useDynamicStyles.prefixClass;
|
|
57
|
+
|
|
50
58
|
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
51
59
|
id: id,
|
|
52
|
-
className: "cbx-tag-container ".concat(variant === 'secondary' ? 'cbx-tag-container-secondary' : '', " ").concat(variant === 'tertiary' ? 'cbx-tag-container-tertiary' : '', " ").concat(className),
|
|
53
|
-
style: _objectSpread({
|
|
60
|
+
className: "".concat(prefixClass('cbx-tag-container'), " ").concat(variant === 'secondary' ? prefixClass('cbx-tag-container-secondary') : '', " ").concat(variant === 'tertiary' ? prefixClass('cbx-tag-container-tertiary') : '', " ").concat(className),
|
|
61
|
+
style: _objectSpread(_objectSpread(_objectSpread({
|
|
54
62
|
paddingRight: !close && 'var(--spacing16)',
|
|
55
63
|
paddingLeft: !(icon || iconText) && 'var(--spacing16)',
|
|
56
64
|
background: background,
|
|
57
65
|
borderColor: variant === 'tertiary' ? borderColor : background
|
|
58
|
-
}, styles)
|
|
66
|
+
}, styles), style), stylesInLine)
|
|
59
67
|
}, props), /*#__PURE__*/_react.default.createElement("div", {
|
|
60
|
-
className:
|
|
68
|
+
className: prefixClass('cbx-tag-block')
|
|
61
69
|
}, (icon || iconText) && /*#__PURE__*/_react.default.createElement("div", {
|
|
62
|
-
className: "cbx-tag-icon".concat(iconText ? 'Text' : '')
|
|
70
|
+
className: "".concat(prefixClass("cbx-tag-icon".concat(iconText ? 'Text' : '')))
|
|
63
71
|
}, icon && /*#__PURE__*/_react.default.createElement("i", {
|
|
64
72
|
className: icon
|
|
65
73
|
}), iconText && /*#__PURE__*/_react.default.createElement(_Typography.default, _extends({
|
|
74
|
+
prefixClass: prefixClass,
|
|
66
75
|
component: 'div',
|
|
67
76
|
color: 'var(--white)',
|
|
68
77
|
styles: {
|
|
@@ -71,19 +80,20 @@ var Tag = function Tag(_ref) {
|
|
|
71
80
|
alignItems: 'center'
|
|
72
81
|
}
|
|
73
82
|
}, iconTypographyProps), iconText)), /*#__PURE__*/_react.default.createElement("div", {
|
|
74
|
-
className:
|
|
83
|
+
className: prefixClass('cbx-tag-block-typography')
|
|
75
84
|
}, /*#__PURE__*/_react.default.createElement(_Typography.default, _extends({
|
|
85
|
+
prefixClass: prefixClass,
|
|
76
86
|
color: colorText || 'var(--white)',
|
|
77
87
|
styles: {
|
|
78
88
|
lineHeight: '1.38rem'
|
|
79
89
|
}
|
|
80
90
|
}, textTypographyProps), text)), close && /*#__PURE__*/_react.default.createElement("div", {
|
|
81
|
-
className:
|
|
91
|
+
className: prefixClass('cbx-tag-close'),
|
|
82
92
|
onClick: function onClick() {
|
|
83
93
|
return close();
|
|
84
94
|
}
|
|
85
95
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
86
|
-
className: "ri-close-circle-line cbx-tag-close-icon
|
|
96
|
+
className: "ri-close-circle-line ".concat(prefixClass('cbx-tag-close-icon')),
|
|
87
97
|
style: {
|
|
88
98
|
color: 'var(--white)'
|
|
89
99
|
}
|
|
@@ -1,4 +1,123 @@
|
|
|
1
|
-
.cbx-switch
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
.cbx-switch {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.cbx-switch-label {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: flex;
|
|
9
|
+
min-height: 2.375rem;
|
|
10
|
+
align-items: center;
|
|
11
|
+
width: auto !important;
|
|
12
|
+
margin-bottom: 0px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cbx-switch-label>input {
|
|
16
|
+
appearance: none;
|
|
17
|
+
-moz-appearance: none;
|
|
18
|
+
-webkit-appearance: none;
|
|
19
|
+
z-index: -1;
|
|
20
|
+
position: absolute;
|
|
21
|
+
right: 0.375rem;
|
|
22
|
+
top: 0.5rem;
|
|
23
|
+
display: block;
|
|
24
|
+
margin: 0;
|
|
25
|
+
border-radius: 50%;
|
|
26
|
+
width: 2.5rem !important;
|
|
27
|
+
height: 2.5rem;
|
|
28
|
+
outline: none;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
transform: scale(1);
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
transition: opacity 0.3s 0.1s, transform 0.2s 0.1s;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.cbx-switch-label>span {
|
|
36
|
+
display: inline-block;
|
|
37
|
+
width: 2.25rem !important;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.cbx-switch-label>span::before {
|
|
42
|
+
content: "";
|
|
43
|
+
float: right;
|
|
44
|
+
display: inline-block;
|
|
45
|
+
border-radius: 0.438rem;
|
|
46
|
+
width: 2.25rem !important;
|
|
47
|
+
height: 0.25rem;
|
|
48
|
+
background-color: var(--gray2);
|
|
49
|
+
vertical-align: top;
|
|
50
|
+
transition: background-color 0.2s, opacity 0.2s;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.cbx-switch-label>span::after {
|
|
54
|
+
content: "";
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 0.563rem;
|
|
57
|
+
right: 1rem;
|
|
58
|
+
border-radius: 50%;
|
|
59
|
+
width: 1.25rem !important;
|
|
60
|
+
height: 1.25rem;
|
|
61
|
+
background-color: white;
|
|
62
|
+
transition: background-color 0.2s, transform 0.2s;
|
|
63
|
+
border: 0.125rem solid var(--gray4);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.cbx-switch-label>input:checked {
|
|
67
|
+
right: -0.625rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.cbx-switch-label>input:checked+span::after {
|
|
71
|
+
background-color: var(--primary);
|
|
72
|
+
border: 0.125rem solid var(--primary);
|
|
73
|
+
transform: translateX(16px);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.cbx-switch-label:hover>input {
|
|
77
|
+
opacity: 0.04;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.cbx-switch-label>input:focus {
|
|
81
|
+
opacity: 0.12;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.cbx-switch-label:hover>input:focus {
|
|
85
|
+
opacity: 0.16;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.cbx-switch-label>input:active {
|
|
89
|
+
opacity: 1;
|
|
90
|
+
transform: scale(0);
|
|
91
|
+
transition: transform 0s, opacity 0s;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.cbx-switch-label>input:disabled {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.cbx-switch-label>input:disabled+span {
|
|
99
|
+
cursor: default;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.cbx-switch-label>input:disabled+span::before {
|
|
103
|
+
background-color: var(--gray3);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.cbx-switch-label>input:disabled+span::after {
|
|
107
|
+
background-color: var(--gray3);
|
|
108
|
+
border-color: var(--gray3);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.cbx-switch-textStart, .cbx-switch-textEnd{
|
|
112
|
+
min-height: 2.375rem;
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.cbx-switch-textStart{
|
|
118
|
+
margin-right: 0.75rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.cbx-switch-textEnd{
|
|
122
|
+
margin-Left: 0.75rem;
|
|
4
123
|
}
|
|
@@ -13,89 +13,115 @@ require("../../styles/main.css");
|
|
|
13
13
|
|
|
14
14
|
require("./Toggle.css");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
19
19
|
|
|
20
|
-
var _excluded = ["value", "checked", "label", "disabled", "onChange", "labelPlacement"];
|
|
20
|
+
var _excluded = ["value", "checked", "label", "disabled", "onChange", "labelPlacement", "style", "sx", "variant", "onClick"];
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
24
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
25
|
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
|
+
|
|
30
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
+
|
|
32
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
33
|
+
|
|
34
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
35
|
+
|
|
36
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
37
|
+
|
|
38
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
39
|
+
|
|
40
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
41
|
+
|
|
42
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
+
|
|
26
44
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
45
|
|
|
28
46
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
47
|
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
'& .MuiSwitch-track': {
|
|
61
|
-
height: 'var(--spacing4)',
|
|
62
|
-
width: '2.75rem',
|
|
63
|
-
borderRadius: 2,
|
|
64
|
-
opacity: 1,
|
|
65
|
-
backgroundColor: 'var(--gray2)',
|
|
66
|
-
position: 'relative',
|
|
67
|
-
top: '0.313rem'
|
|
68
|
-
},
|
|
69
|
-
'&.MuiFormControlLabel-root .MuiFormControlLabel-label.Mui-disabled': {
|
|
70
|
-
color: 'var(--gray3)'
|
|
48
|
+
var Toggle = function Toggle(_ref) {
|
|
49
|
+
var value = _ref.value,
|
|
50
|
+
checkedProp = _ref.checked,
|
|
51
|
+
label = _ref.label,
|
|
52
|
+
disabled = _ref.disabled,
|
|
53
|
+
onChange = _ref.onChange,
|
|
54
|
+
labelPlacement = _ref.labelPlacement,
|
|
55
|
+
style = _ref.style,
|
|
56
|
+
sx = _ref.sx,
|
|
57
|
+
variant = _ref.variant,
|
|
58
|
+
onClick = _ref.onClick,
|
|
59
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
60
|
+
|
|
61
|
+
var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
|
|
62
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
63
|
+
prefixClass = _useDynamicStyles.prefixClass;
|
|
64
|
+
|
|
65
|
+
var _React$useState = _react.default.useState(checkedProp || false),
|
|
66
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
67
|
+
checked = _React$useState2[0],
|
|
68
|
+
setChecked = _React$useState2[1];
|
|
69
|
+
|
|
70
|
+
var handleChange = function handleChange(event) {
|
|
71
|
+
if (disabled) return;
|
|
72
|
+
var newChecked = event.target.checked;
|
|
73
|
+
setChecked(newChecked);
|
|
74
|
+
|
|
75
|
+
if (onChange) {
|
|
76
|
+
onChange(event, newChecked);
|
|
71
77
|
}
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
disabled = _ref2.disabled,
|
|
80
|
-
onChange = _ref2.onChange,
|
|
81
|
-
labelPlacement = _ref2.labelPlacement,
|
|
82
|
-
props = _objectWithoutProperties(_ref2, _excluded);
|
|
79
|
+
if (onClick) {
|
|
80
|
+
onClick(event, newChecked);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
_react.default.useEffect(function () {
|
|
85
|
+
setChecked(checkedProp);
|
|
86
|
+
}, [checkedProp]);
|
|
87
|
+
|
|
88
|
+
var containerStyle = _objectSpread(_objectSpread({
|
|
89
|
+
display: 'flex',
|
|
90
|
+
alignItems: 'center'
|
|
91
|
+
}, style), stylesInLine);
|
|
92
|
+
|
|
93
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: prefixClass('cbx-switch'),
|
|
95
|
+
style: containerStyle
|
|
96
|
+
}, labelPlacement === 'start' && /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
+
className: prefixClass('cbx-switch-textStart')
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
99
|
+
variant: variant || 'M',
|
|
100
|
+
color: disabled ? 'var(--gray3)' : checked && 'var(--primary)',
|
|
101
|
+
fontWeight: checked && '700',
|
|
102
|
+
prefixClass: prefixClass,
|
|
103
|
+
styles: {
|
|
104
|
+
transition: 'all 0.3s'
|
|
105
|
+
}
|
|
106
|
+
}, label)), /*#__PURE__*/_react.default.createElement("label", _extends({
|
|
107
|
+
className: prefixClass('cbx-switch-label')
|
|
108
|
+
}, props), /*#__PURE__*/_react.default.createElement("input", {
|
|
109
|
+
type: "checkbox",
|
|
110
|
+
value: value,
|
|
85
111
|
checked: checked,
|
|
86
112
|
disabled: disabled,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}));
|
|
113
|
+
onChange: handleChange
|
|
114
|
+
}), /*#__PURE__*/_react.default.createElement("span", null)), labelPlacement === 'end' && /*#__PURE__*/_react.default.createElement("div", {
|
|
115
|
+
className: prefixClass('cbx-switch-textEnd')
|
|
116
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
117
|
+
variant: variant || 'M',
|
|
118
|
+
color: disabled ? 'var(--gray3)' : checked && 'var(--primary)',
|
|
119
|
+
fontWeight: checked && '700',
|
|
120
|
+
prefixClass: prefixClass,
|
|
121
|
+
styles: {
|
|
122
|
+
transition: 'all 0.3s'
|
|
123
|
+
}
|
|
124
|
+
}, label))));
|
|
99
125
|
};
|
|
100
126
|
|
|
101
127
|
Toggle.propTypes = {
|
|
@@ -110,7 +136,8 @@ Toggle.defaultProps = {
|
|
|
110
136
|
label: '',
|
|
111
137
|
id: '',
|
|
112
138
|
onChange: undefined,
|
|
113
|
-
disabled: false
|
|
139
|
+
disabled: false,
|
|
140
|
+
labelPlacement: 'end'
|
|
114
141
|
};
|
|
115
142
|
var _default = Toggle;
|
|
116
143
|
exports.default = _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
require("../../styles/main.css");
|
|
11
|
+
|
|
12
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
13
|
+
|
|
14
|
+
var _Tooltip2 = _interopRequireDefault(require("./Tooltip"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
var DesignIconButton = function DesignIconButton() {
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
style: {
|
|
21
|
+
marginBottom: '2rem'
|
|
22
|
+
}
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip2.default, {
|
|
24
|
+
title: "\xA1Hola! Esto es un tooltip."
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement("pre", null, "\xA1Pasa el cursor sobre m\xED!"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
style: {
|
|
27
|
+
textAlign: 'right'
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip2.default, {
|
|
30
|
+
title: "\xA1Hola! Esto es un tooltip."
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("pre", null, "\xA1Pasa el cursor sobre m\xED!"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
style: {
|
|
33
|
+
marginBottom: '2rem'
|
|
34
|
+
}
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip2.default, {
|
|
36
|
+
title: "\xA1Hola! Esto es un tooltip."
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement("pre", null, "\xA1Pasa el cursor sobre m\xED!"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
+
style: {
|
|
39
|
+
marginTop: '6rem'
|
|
40
|
+
}
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
42
|
+
title: "Your tooltip content here adasdasdas dasd asd asd asd sad asd"
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, "hgoalasdadasdasdas dasd asd asd asd sad asd")), /*#__PURE__*/_react.default.createElement("div", null, "asasd")));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
DesignIconButton.displayName = "DesignIconButton";
|
|
47
|
+
var _default = DesignIconButton;
|
|
48
|
+
exports.default = _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@-webkit-keyframes tooltipFadeIn {
|
|
2
|
+
from {
|
|
3
|
+
opacity: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
to {
|
|
7
|
+
opacity: 1;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@keyframes tooltipFadeIn {
|
|
12
|
+
from {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
to {
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
body {
|
|
22
|
+
padding: 16px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tooltip {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
color: blue;
|
|
30
|
+
border-bottom: 1px dotted;
|
|
31
|
+
position: relative;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.tooltip__label:before {
|
|
35
|
+
content: "";
|
|
36
|
+
display: flex;
|
|
37
|
+
cursor: help;
|
|
38
|
+
position: absolute;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
z-index: 3;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.tooltip-dropdown {
|
|
45
|
+
display: none;
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 50%;
|
|
49
|
+
transform: translateX(-50%);
|
|
50
|
+
z-index: 2;
|
|
51
|
+
padding-top: 32px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.tooltip-dropdown__content {
|
|
55
|
+
color: white;
|
|
56
|
+
background-color: black;
|
|
57
|
+
border-radius: 4px;
|
|
58
|
+
padding: 8px 12px;
|
|
59
|
+
width: 300px;
|
|
60
|
+
text-align: left;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tooltip--open .tooltip-dropdown {
|
|
64
|
+
-webkit-animation: tooltipFadeIn 0.15s;
|
|
65
|
+
animation: tooltipFadeIn 0.15s;
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@media (hover: hover) {
|
|
70
|
+
.tooltip:hover .tooltip-dropdown {
|
|
71
|
+
-webkit-animation: tooltipFadeIn 0.15s;
|
|
72
|
+
animation: tooltipFadeIn 0.15s;
|
|
73
|
+
display: block;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
require("../../styles/main.css");
|
|
13
|
+
|
|
14
|
+
require("./Tooltip.css");
|
|
15
|
+
|
|
16
|
+
var _useDynamicStyles = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
/* eslint-disable no-unused-vars */
|
|
21
|
+
var Tooltip = function Tooltip(_ref) {
|
|
22
|
+
var children = _ref.children;
|
|
23
|
+
|
|
24
|
+
var placeholderRef = _react.default.useRef(null);
|
|
25
|
+
|
|
26
|
+
var dropdownRef = _react.default.useRef(null);
|
|
27
|
+
|
|
28
|
+
_react.default.useEffect(function () {
|
|
29
|
+
var screenPadding = 16;
|
|
30
|
+
|
|
31
|
+
var handleDropdownPosition = function handleDropdownPosition() {
|
|
32
|
+
var placeholderRect = placeholderRef.current.getBoundingClientRect();
|
|
33
|
+
var dropdownRect = dropdownRef.current.getBoundingClientRect();
|
|
34
|
+
var dropdownRightX = dropdownRect.x + dropdownRect.width;
|
|
35
|
+
var placeholderRightX = placeholderRect.x + placeholderRect.width;
|
|
36
|
+
|
|
37
|
+
if (dropdownRect.x < 0) {
|
|
38
|
+
dropdownRef.current.style.left = '0';
|
|
39
|
+
dropdownRef.current.style.right = 'auto';
|
|
40
|
+
dropdownRef.current.style.transform = "translateX(".concat(-placeholderRect.x + screenPadding, "px)");
|
|
41
|
+
} else if (dropdownRightX > window.outerWidth) {
|
|
42
|
+
dropdownRef.current.style.left = 'auto';
|
|
43
|
+
dropdownRef.current.style.right = '0';
|
|
44
|
+
dropdownRef.current.style.transform = "translateX(".concat(window.outerWidth - placeholderRightX - screenPadding, "px)");
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var handleMouseOver = function handleMouseOver() {
|
|
49
|
+
handleDropdownPosition();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var handleTouchStart = function handleTouchStart() {
|
|
53
|
+
toggle();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var toggle = function toggle() {
|
|
57
|
+
if (placeholderRef.current.classList.contains('tooltip--open')) {
|
|
58
|
+
close();
|
|
59
|
+
} else {
|
|
60
|
+
open();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var open = function open() {
|
|
65
|
+
placeholderRef.current.classList.add('tooltip--open');
|
|
66
|
+
handleDropdownPosition();
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var close = function close() {
|
|
70
|
+
placeholderRef.current.classList.remove('tooltip--open');
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var setup = function setup() {
|
|
74
|
+
placeholderRef.current.addEventListener('mouseover', handleMouseOver);
|
|
75
|
+
placeholderRef.current.addEventListener('touchstart', handleTouchStart);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
setup();
|
|
79
|
+
return function () {
|
|
80
|
+
placeholderRef.current.removeEventListener('mouseover', handleMouseOver);
|
|
81
|
+
placeholderRef.current.removeEventListener('touchstart', handleTouchStart);
|
|
82
|
+
};
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
var dismissAllTooltips = function dismissAllTooltips(event) {
|
|
86
|
+
if (typeof event.target.closest !== 'function') return;
|
|
87
|
+
var currentTooltip = event.target.closest('.tooltip');
|
|
88
|
+
document.querySelectorAll('.tooltip--open').forEach(function (tooltip) {
|
|
89
|
+
if (tooltip === currentTooltip) return;
|
|
90
|
+
tooltip.classList.remove('tooltip--open');
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
_react.default.useEffect(function () {
|
|
95
|
+
document.addEventListener('touchstart', dismissAllTooltips);
|
|
96
|
+
return function () {
|
|
97
|
+
var _document;
|
|
98
|
+
|
|
99
|
+
(_document = document) === null || _document === void 0 ? void 0 : _document.removeEventListener('touchstart', dismissAllTooltips);
|
|
100
|
+
};
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
+
className: "tooltip",
|
|
105
|
+
ref: placeholderRef,
|
|
106
|
+
"data-tooltip-placeholder": true
|
|
107
|
+
}, children, /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
className: "tooltip-dropdown",
|
|
109
|
+
ref: dropdownRef,
|
|
110
|
+
"data-tooltip-dropdown": true
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
className: "tooltip-dropdown__content"
|
|
113
|
+
}, "Your tooltip content here")));
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
Tooltip.displayName = "Tooltip";
|
|
117
|
+
Tooltip.propTypes = {
|
|
118
|
+
title: _propTypes.default.string,
|
|
119
|
+
direction: _propTypes.default.string
|
|
120
|
+
};
|
|
121
|
+
Tooltip.defaultProps = {
|
|
122
|
+
title: '',
|
|
123
|
+
direction: ''
|
|
124
|
+
};
|
|
125
|
+
var _default = Tooltip;
|
|
126
|
+
exports.default = _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _DesignTooltip = _interopRequireDefault(require("./DesignTooltip.stories"));
|
|
11
|
+
|
|
12
|
+
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
var _default = {
|
|
17
|
+
title: 'Components/Tooltip',
|
|
18
|
+
component: _Tooltip.default,
|
|
19
|
+
argTypes: {},
|
|
20
|
+
parameters: {
|
|
21
|
+
storybookCodePanel: {
|
|
22
|
+
disabled: false,
|
|
23
|
+
files: [{
|
|
24
|
+
fileName: 'Tooltip.js',
|
|
25
|
+
// eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
|
|
26
|
+
code: require('!!raw-loader!./Tooltip.jsx')
|
|
27
|
+
}]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.default = _default;
|
|
32
|
+
|
|
33
|
+
var Template = function Template(args) {
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_DesignTooltip.default, args);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
Template.displayName = "Template";
|
|
38
|
+
var Default = Template.bind({});
|
|
39
|
+
exports.Default = Default;
|
|
40
|
+
Default.args = {};
|