@councilbox/councilbox-ui 2.0.52 → 2.0.54
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/overlayA11yStack.js +47 -0
- package/dist/HOCs/useA11yGuard.js +38 -0
- package/dist/HOCs/useDynamicStyles.js +18 -38
- package/dist/HOCs/useMenuNavigation.js +110 -0
- package/dist/HOCs/useOverlay.js +87 -0
- package/dist/HOCs/usePopoverPosition.js +228 -0
- package/dist/HOCs/useRipple.js +17 -35
- package/dist/HOCs/useWindowSize.js +24 -42
- package/dist/build-index.js +49 -99
- package/dist/components/1.Introduction.stories.mdx +1 -1
- package/dist/components/2.Changelog.stories.mdx +45 -0
- package/dist/components/3.Guide.stories.mdx +1 -1
- package/dist/components/Accordion/Accordion.css +7 -0
- package/dist/components/Accordion/Accordion.js +97 -102
- package/dist/components/Accordion/Accordion.stories.js +10 -12
- package/dist/components/Accordion/AccordionOld.js +32 -56
- package/dist/components/Accordion/DesignAccordion.stories.js +10 -21
- package/dist/components/Alert/Alert.js +55 -55
- package/dist/components/Alert/Alert.stories.js +10 -11
- package/dist/components/Avatar/Avatar.js +82 -74
- package/dist/components/Avatar/Avatar.stories.js +19 -23
- package/dist/components/Avatar/AvatarOld.js +46 -60
- package/dist/components/Avatar/DesignAvatar.stories.js +18 -26
- package/dist/components/Avatar/DesignAvatarText.stories.js +31 -40
- package/dist/components/AvatarGroup/AvatarGroup.js +7 -14
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +6 -13
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +34 -45
- package/dist/components/Block/Block.css +3 -3
- package/dist/components/Block/Block.js +31 -45
- package/dist/components/Block/Block.stories.js +5 -12
- package/dist/components/Block/DesignBlock.stories.js +7 -13
- package/dist/components/Button/Button.js +44 -66
- package/dist/components/Button/Button.stories.js +8 -14
- package/dist/components/Button/button.css +1 -1
- package/dist/components/ButtonBasic/ButtonBasic.css +6 -1
- package/dist/components/ButtonBasic/ButtonBasic.js +96 -118
- package/dist/components/ButtonBasic/ButtonBasic.stories.js +14 -15
- package/dist/components/ButtonBasic/ButtonBasicOld.js +57 -77
- package/dist/components/Checkbox/Checkbox.css +6 -0
- package/dist/components/Checkbox/Checkbox.js +81 -100
- package/dist/components/Checkbox/Checkbox.stories.js +10 -11
- package/dist/components/Checkbox/CheckboxOld.js +19 -35
- package/dist/components/DragDrop/DragDrop.css +20 -9
- package/dist/components/DragDrop/DragDrop.js +80 -76
- package/dist/components/DragDrop/DragDrop.stories.js +9 -16
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +35 -53
- package/dist/components/DrawerPanel/DrawerPanel.js +157 -146
- package/dist/components/DrawerPanel/DrawerPanel.stories.js +10 -12
- package/dist/components/DrawerPanel/DrawerPanelOld.js +76 -98
- package/dist/components/DropDown/DesignDropDown.stories.js +79 -97
- package/dist/components/DropDown/DropDown.js +168 -342
- package/dist/components/DropDown/DropDown.stories.js +6 -12
- package/dist/components/DropDown/DropDownOld.js +57 -89
- package/dist/components/DropDown/PopoverPlayground.js +68 -98
- package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +26 -36
- package/dist/components/EnhancedTable/EnhancedMyTable.js +16 -19
- package/dist/components/EnhancedTable/EnhancedTable.js +77 -136
- package/dist/components/EnhancedTable/EnhancedTable.stories.js +5 -12
- package/dist/components/EnhancedTable/EnhancedTableBody.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableCell.js +25 -34
- package/dist/components/EnhancedTable/EnhancedTableContainer.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableHead.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableRow.js +15 -18
- package/dist/components/EnhancedTable/EnhancedTableSortLabel.js +15 -18
- package/dist/components/FabButton/DesignFabButton.stories.js +9 -16
- package/dist/components/FabButton/FabButton.js +51 -54
- package/dist/components/FabButton/FabButton.stories.js +10 -12
- package/dist/components/Grid/DesignGrid.stories.js +7 -14
- package/dist/components/Grid/Grid.js +38 -46
- package/dist/components/Grid/Grid.stories.js +6 -13
- package/dist/components/Grid/GridItem.js +37 -39
- package/dist/components/Grid/GridItemOld.js +13 -18
- package/dist/components/Grid/GridOld.js +14 -21
- package/dist/components/Header/DesignHeader.stories.js +20 -24
- package/dist/components/Header/Header.js +201 -242
- package/dist/components/Header/Header.stories.js +9 -21
- package/dist/components/Header/header.css +10 -5
- package/dist/components/IconButton/DesignIconButton.stories.js +31 -36
- package/dist/components/IconButton/IconButton.css +6 -1
- package/dist/components/IconButton/IconButton.js +132 -138
- package/dist/components/IconButton/IconButton.stories.js +12 -13
- package/dist/components/IconButton/IconButtonOld.js +41 -57
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +5 -11
- package/dist/components/IconButtonSquare/IconButtonSquare.js +11 -25
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +7 -13
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +44 -62
- package/dist/components/IconFont/IconFont.js +27 -48
- package/dist/components/IconFont/IconFont.stories.js +5 -11
- package/dist/components/InputAutocomplete/InputAutocomplete.css +6 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +184 -260
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +5 -11
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +43 -62
- package/dist/components/InputPassword/InputPassword.css +0 -6
- package/dist/components/InputPassword/InputPassword.js +58 -73
- package/dist/components/InputPassword/InputPassword.stories.js +5 -11
- package/dist/components/InputText/InputText.css +86 -78
- package/dist/components/InputText/InputText.js +207 -211
- package/dist/components/InputText/InputText.stories.js +11 -11
- package/dist/components/InputText/InputTextOld.js +48 -74
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +38 -51
- package/dist/components/InputTextArea/InputTextArea.js +84 -93
- package/dist/components/InputTextArea/InputTextArea.stories.js +5 -12
- package/dist/components/LoadingSection/LoadingSection.js +44 -51
- package/dist/components/LoadingSection/LoadingSection.stories.js +5 -11
- package/dist/components/MenuItem/DesignMenuItem.stories.js +20 -34
- package/dist/components/MenuItem/MenuItem.css +7 -2
- package/dist/components/MenuItem/MenuItem.js +100 -113
- package/dist/components/MenuItem/MenuItem.stories.js +6 -15
- package/dist/components/MenuItem/MenuItemOld.js +40 -56
- package/dist/components/MenuLateralLeft/MenuLateralLeft.css +24 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +123 -160
- package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +5 -12
- package/dist/components/MenuLateralRight/MenuLateralRight.css +2 -2
- package/dist/components/MenuLateralRight/MenuLateralRight.js +73 -77
- package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +5 -12
- package/dist/components/Modal/DesignModal.stories.js +15 -30
- package/dist/components/Modal/Modal.css +35 -15
- package/dist/components/Modal/Modal.js +154 -145
- package/dist/components/Modal/Modal.stories.js +7 -16
- package/dist/components/Modal/ModalOld.js +73 -90
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +4 -10
- package/dist/components/PaginationFooter/PaginationFooter.css +10 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +99 -91
- package/dist/components/PaginationFooter/PaginationFooter.stories.js +5 -12
- package/dist/components/RadioButton/Radio.css +19 -18
- package/dist/components/RadioButton/Radio.js +65 -83
- package/dist/components/RadioButton/Radio.stories.js +27 -36
- package/dist/components/RadioButton/RadioOld.js +23 -39
- package/dist/components/Ripple/DesignRipple.js +25 -41
- package/dist/components/Ripple/Ripple.stories.js +5 -11
- package/dist/components/Scrollbar/DesignScrollbar.js +5 -10
- package/dist/components/Scrollbar/Scrollbar.js +37 -56
- package/dist/components/Scrollbar/Scrollbar.stories.js +5 -12
- package/dist/components/SelectInput/DesignSelectInput.js +22 -45
- package/dist/components/SelectInput/SelectInput.js +101 -155
- package/dist/components/SelectInput/SelectInput.stories.js +6 -15
- package/dist/components/SelectInput/SelectInputOld.js +52 -81
- package/dist/components/Slider/DesignSlider.js +8 -14
- package/dist/components/Slider/Slider.css +57 -37
- package/dist/components/Slider/Slider.js +85 -84
- package/dist/components/Slider/Slider.stories.js +5 -12
- package/dist/components/Spacing/Spacing.js +38 -45
- package/dist/components/Spacing/Spacing.stories.js +5 -11
- package/dist/components/Stars/DesignStars.js +17 -30
- package/dist/components/Stars/Stars.css +55 -104
- package/dist/components/Stars/Stars.js +89 -73
- package/dist/components/Stars/Stars.stories.js +5 -12
- package/dist/components/Stepper/DesignStepper.stories.js +16 -30
- package/dist/components/Stepper/Stepper.css +46 -10
- package/dist/components/Stepper/Stepper.js +118 -134
- package/dist/components/Stepper/Stepper.stories.js +5 -12
- package/dist/components/Table/DesignTable.stories.js +200 -211
- package/dist/components/Table/Table.css +33 -2
- package/dist/components/Table/Table.js +30 -38
- package/dist/components/Table/Table.stories.js +5 -12
- package/dist/components/Table/TableBody.js +22 -34
- package/dist/components/Table/TableCell.js +71 -61
- package/dist/components/Table/TableContainer.js +22 -34
- package/dist/components/Table/TableHead.js +22 -34
- package/dist/components/Table/TableOld.js +52 -84
- package/dist/components/Table/TableRow.js +33 -37
- package/dist/components/Table/TableSortLabel.js +42 -52
- package/dist/components/Tabs/DesignTabs.js +14 -28
- package/dist/components/Tabs/Tabs.css +30 -11
- package/dist/components/Tabs/Tabs.js +151 -137
- package/dist/components/Tabs/Tabs.stories.js +5 -12
- package/dist/components/Tabs/TabsOld.js +28 -42
- package/dist/components/Tag/DesignTags.stories.js +24 -39
- package/dist/components/Tag/Tag.css +61 -42
- package/dist/components/Tag/Tag.js +93 -91
- package/dist/components/Tag/Tag.stories.js +5 -12
- package/dist/components/TextInput/TextInput.js +38 -54
- package/dist/components/TextInput/TextInput.stories.js +5 -11
- package/dist/components/ThemeProvider/Colors.js +2 -2
- package/dist/components/ThemeProvider/CouncilboxThemeContext.js +7 -10
- package/dist/components/ThemeProvider/ThemeProvider.js +34 -52
- package/dist/components/Timeline/DesignTimeline.stories.js +4 -10
- package/dist/components/Timeline/Timeline.js +66 -46
- package/dist/components/Timeline/Timeline.stories.js +5 -12
- package/dist/components/Toggle/Toggle.css +10 -0
- package/dist/components/Toggle/Toggle.js +115 -98
- package/dist/components/Toggle/Toggle.stories.js +10 -11
- package/dist/components/Tooltip/DesignTooltip.stories.js +10 -16
- package/dist/components/Tooltip/Tooltip.css +17 -1
- package/dist/components/Tooltip/Tooltip.js +190 -366
- package/dist/components/Tooltip/Tooltip.stories.js +5 -12
- package/dist/components/Typography/Typography.css +57 -6
- package/dist/components/Typography/Typography.js +44 -97
- package/dist/components/Typography/Typography.stories.js +5 -11
- package/dist/components/Typography/TypographyOld.js +29 -42
- package/dist/index.js +2 -6
- package/dist/reportWebVitals.js +8 -14
- package/dist/storybook.test.js +2 -4
- package/dist/styles/colorConsts.css +4 -4
- package/dist/styles/main.css +16 -0
- package/dist/styles/stylesheet.js +10 -22
- package/dist/testing/TestAutocomplete.js +74 -97
- package/dist/testing/TestComponents.js +5 -10
- package/dist/testing/TestDropdown.js +33 -41
- package/dist/utils/autoDetectScroll.js +12 -35
- package/dist/utils/index.js +37 -63
- package/dist/utils/useFallbackId.js +19 -0
- package/package.json +5 -2
|
@@ -3,84 +3,70 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
require("../../styles/main.css");
|
|
11
|
-
|
|
12
9
|
var _Tag = _interopRequireDefault(require("./Tag"));
|
|
13
|
-
|
|
14
10
|
var _LoadingSection = _interopRequireDefault(require("../LoadingSection/LoadingSection"));
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
-
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
20
13
|
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."); }
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
28
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
-
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
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; }
|
|
16
|
+
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; } }
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
30
18
|
var DesignIconButton = function DesignIconButton(_ref) {
|
|
31
19
|
var variant = _ref.variant;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement("div", null, variant !== 'tertiary' && /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
var _React$useState = _react["default"].useState(false),
|
|
21
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
22
|
+
state = _React$useState2[0],
|
|
23
|
+
setState = _React$useState2[1];
|
|
24
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, variant !== 'tertiary' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
39
25
|
style: {
|
|
40
26
|
marginBottom: '1rem'
|
|
41
27
|
}
|
|
42
|
-
}, /*#__PURE__*/_react
|
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
43
29
|
text: 'Lorem',
|
|
44
30
|
variant: variant,
|
|
45
31
|
background: 'var(--info)',
|
|
46
32
|
iconText: 'P'
|
|
47
|
-
}), /*#__PURE__*/_react
|
|
33
|
+
}), /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
48
34
|
text: 'Lorem',
|
|
49
35
|
variant: variant,
|
|
50
36
|
background: 'var(--success)',
|
|
51
37
|
close: Function.prototype,
|
|
52
|
-
icon: /*#__PURE__*/_react
|
|
38
|
+
icon: /*#__PURE__*/_react["default"].createElement(_LoadingSection["default"], {
|
|
53
39
|
size: 20
|
|
54
40
|
})
|
|
55
|
-
}), /*#__PURE__*/_react
|
|
41
|
+
}), /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
56
42
|
text: 'Lorem',
|
|
57
43
|
variant: variant,
|
|
58
44
|
background: 'var(--success)',
|
|
59
45
|
close: Function.prototype,
|
|
60
46
|
icon: 'ri-check-fill'
|
|
61
|
-
}), /*#__PURE__*/_react
|
|
47
|
+
}), /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
62
48
|
text: 'Lorem',
|
|
63
49
|
variant: variant
|
|
64
|
-
}), /*#__PURE__*/_react
|
|
50
|
+
}), /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
65
51
|
text: 'Lorem',
|
|
66
52
|
variant: variant,
|
|
67
53
|
close: Function.prototype,
|
|
68
54
|
iconText: 'S'
|
|
69
|
-
}), /*#__PURE__*/_react
|
|
55
|
+
}), /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
70
56
|
text: 'Lorem',
|
|
71
57
|
variant: variant
|
|
72
|
-
}), /*#__PURE__*/_react
|
|
58
|
+
}), /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
73
59
|
text: 'Lorem',
|
|
74
60
|
variant: variant,
|
|
75
61
|
close: Function.prototype
|
|
76
|
-
}), /*#__PURE__*/_react
|
|
62
|
+
}), /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
77
63
|
text: 'Lorem',
|
|
78
64
|
variant: variant
|
|
79
|
-
}), /*#__PURE__*/_react
|
|
65
|
+
}), /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
80
66
|
text: 'Lorem',
|
|
81
67
|
variant: variant,
|
|
82
68
|
iconText: 'P'
|
|
83
|
-
})), variant === 'tertiary' && /*#__PURE__*/_react
|
|
69
|
+
})), variant === 'tertiary' && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
84
70
|
text: 'Lorem',
|
|
85
71
|
variant: 'tertiary',
|
|
86
72
|
onClick: function onClick() {
|
|
@@ -90,7 +76,6 @@ var DesignIconButton = function DesignIconButton(_ref) {
|
|
|
90
76
|
borderColor: state ? 'green' : 'red'
|
|
91
77
|
})));
|
|
92
78
|
};
|
|
93
|
-
|
|
94
79
|
DesignIconButton.displayName = "DesignIconButton";
|
|
95
80
|
var _default = DesignIconButton;
|
|
96
|
-
exports
|
|
81
|
+
exports["default"] = _default;
|
|
@@ -1,79 +1,98 @@
|
|
|
1
1
|
.cbx-tag-container {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
border-radius: 1.125rem;
|
|
3
|
+
background: var(--primary);
|
|
4
|
+
border: 0.063rem solid var(--primary);
|
|
5
|
+
display: inline-block;
|
|
6
|
+
margin-right: var(--spacing4);
|
|
7
|
+
margin-top: 0.125rem;
|
|
8
|
+
margin-bottom: 0.125rem;
|
|
9
|
+
height: 2.25rem;
|
|
10
|
+
max-height: 2.25rem;
|
|
11
|
+
min-height: 2.25rem;
|
|
12
|
+
overflow: hidden;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.cbx-tag-container-secondary {
|
|
16
|
-
|
|
16
|
+
background: var(--white);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.cbx-tag-container-secondary>div>div>p,
|
|
20
|
-
.cbx-tag-container-secondary>div>div>i {
|
|
21
|
-
|
|
19
|
+
.cbx-tag-container-secondary > div > div > p,
|
|
20
|
+
.cbx-tag-container-secondary > div > div > i {
|
|
21
|
+
color: var(--primary) !important;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.cbx-tag-container-tertiary {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
background: transparent;
|
|
27
|
+
transition: 0.3s;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.cbx-tag-container-tertiary>div>div>p,
|
|
31
|
-
.cbx-tag-container-tertiary>div>div>i {
|
|
32
|
-
|
|
30
|
+
.cbx-tag-container-tertiary > div > div > p,
|
|
31
|
+
.cbx-tag-container-tertiary > div > div > i {
|
|
32
|
+
transition: 0.3s;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.cbx-tag-block {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
height: 2.125rem;
|
|
37
|
+
max-height: 2.125rem;
|
|
38
|
+
min-height: 2.125rem;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.cbx-tag-block,
|
|
42
42
|
.cbx-tag-close {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.cbx-tag-iconText {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
padding: 0 0.438rem;
|
|
49
|
+
background: var(--primary75);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
.cbx-tag-iconText,
|
|
53
53
|
.cbx-tag-icon {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
margin-right: var(--spacing12);
|
|
56
|
+
margin-left: var(--spacing8);
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.cbx-tag-icon i {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
font-size: 1.5rem;
|
|
63
|
+
color: white;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.cbx-tag-close {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
margin-left: 0.875rem;
|
|
68
|
+
margin-right: var(--spacing8);
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
border: none;
|
|
71
|
+
background: transparent;
|
|
72
|
+
padding: 0;
|
|
73
|
+
font: inherit;
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.cbx-tag-close:focus-visible {
|
|
78
|
+
outline: 2px solid var(--accent);
|
|
79
|
+
outline-offset: 2px;
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
.cbx-tag-close-icon {
|
|
73
|
-
|
|
83
|
+
font-size: 1.25rem;
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
.cbx-tag-block-typography {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
87
|
+
min-height: 1.375rem;
|
|
88
|
+
max-height: 1.375rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.cbx-tag-container[role="button"] {
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.cbx-tag-container[role="button"]:focus-visible {
|
|
96
|
+
outline: 2px solid var(--accent);
|
|
97
|
+
outline-offset: 2px;
|
|
98
|
+
}
|
|
@@ -1,82 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
require("../../styles/main.css");
|
|
13
|
-
|
|
14
11
|
require("./Tag.css");
|
|
15
|
-
|
|
16
12
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
17
|
-
|
|
18
13
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
19
|
-
|
|
20
14
|
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
-
|
|
15
|
+
var _excluded = ["variant", "id", "className", "closeAriaLabel", "text", "close", "icon", "iconText", "background", "iconTypographyProps", "textTypographyProps", "styles", "borderColor", "colorText", "sx", "style", "onClick"];
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
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); }
|
|
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; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
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); }
|
|
23
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
36
24
|
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."); }
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
-
|
|
46
|
-
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; }
|
|
47
|
-
|
|
48
|
-
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; }
|
|
49
|
-
|
|
25
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
26
|
+
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; }
|
|
27
|
+
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; } }
|
|
28
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
29
|
+
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; }
|
|
30
|
+
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; }
|
|
50
31
|
var Tag = function Tag(_ref) {
|
|
51
32
|
var variant = _ref.variant,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var typographyRef = _react
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
_react.default.useEffect(function () {
|
|
33
|
+
id = _ref.id,
|
|
34
|
+
className = _ref.className,
|
|
35
|
+
closeAriaLabel = _ref.closeAriaLabel,
|
|
36
|
+
text = _ref.text,
|
|
37
|
+
close = _ref.close,
|
|
38
|
+
icon = _ref.icon,
|
|
39
|
+
iconText = _ref.iconText,
|
|
40
|
+
background = _ref.background,
|
|
41
|
+
iconTypographyProps = _ref.iconTypographyProps,
|
|
42
|
+
textTypographyProps = _ref.textTypographyProps,
|
|
43
|
+
styles = _ref.styles,
|
|
44
|
+
borderColor = _ref.borderColor,
|
|
45
|
+
colorText = _ref.colorText,
|
|
46
|
+
sx = _ref.sx,
|
|
47
|
+
style = _ref.style,
|
|
48
|
+
onClick = _ref.onClick,
|
|
49
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
51
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
52
|
+
prefixClass = _useDynamicStyles.prefixClass;
|
|
53
|
+
var typographyRef = _react["default"].useRef(null);
|
|
54
|
+
var _React$useState = _react["default"].useState(false),
|
|
55
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
56
|
+
isEllipsisActive = _React$useState2[0],
|
|
57
|
+
setIsEllipsisActive = _React$useState2[1];
|
|
58
|
+
_react["default"].useEffect(function () {
|
|
80
59
|
var timeout = setTimeout(function () {
|
|
81
60
|
if (typographyRef.current) {
|
|
82
61
|
var isEllipsis = typographyRef.current.scrollWidth > typographyRef.current.clientWidth;
|
|
@@ -87,8 +66,23 @@ var Tag = function Tag(_ref) {
|
|
|
87
66
|
return clearTimeout(timeout);
|
|
88
67
|
};
|
|
89
68
|
}, [text, typographyRef.current]);
|
|
90
|
-
|
|
91
|
-
|
|
69
|
+
var resolvedColorText = colorText || (variant === 'tertiary' ? 'var(--primary)' : 'var(--white)');
|
|
70
|
+
var isInteractive = typeof onClick === 'function';
|
|
71
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
72
|
+
if (!isInteractive) return;
|
|
73
|
+
if (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar') {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
onClick(event);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var handleCloseClick = function handleCloseClick(event) {
|
|
79
|
+
event.stopPropagation();
|
|
80
|
+
close(event);
|
|
81
|
+
};
|
|
82
|
+
var handleCloseKeyDown = function handleCloseKeyDown(event) {
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
};
|
|
85
|
+
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
92
86
|
id: id,
|
|
93
87
|
className: "".concat(prefixClass('cbx-tag-container'), " ").concat(variant === 'secondary' ? prefixClass('cbx-tag-container-secondary') : '', " ").concat(variant === 'tertiary' ? prefixClass('cbx-tag-container-tertiary') : '', " ").concat(className),
|
|
94
88
|
style: _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -96,14 +90,19 @@ var Tag = function Tag(_ref) {
|
|
|
96
90
|
paddingLeft: !(icon || iconText) && 'var(--spacing16)',
|
|
97
91
|
background: background,
|
|
98
92
|
borderColor: variant === 'tertiary' ? borderColor : background
|
|
99
|
-
}, styles), style), stylesInLine)
|
|
100
|
-
|
|
93
|
+
}, styles), style), stylesInLine),
|
|
94
|
+
onClick: onClick,
|
|
95
|
+
onKeyDown: isInteractive ? handleKeyDown : undefined,
|
|
96
|
+
role: isInteractive ? 'button' : undefined,
|
|
97
|
+
tabIndex: isInteractive ? 0 : undefined
|
|
98
|
+
}, props), /*#__PURE__*/_react["default"].createElement("div", {
|
|
101
99
|
className: prefixClass('cbx-tag-block')
|
|
102
|
-
}, (icon || iconText) && /*#__PURE__*/_react
|
|
100
|
+
}, (icon || iconText) && /*#__PURE__*/_react["default"].createElement("div", {
|
|
103
101
|
className: "".concat(prefixClass("cbx-tag-icon".concat(iconText ? 'Text' : '')))
|
|
104
|
-
}, typeof icon === 'string' ? /*#__PURE__*/_react
|
|
105
|
-
className: icon
|
|
106
|
-
|
|
102
|
+
}, typeof icon === 'string' ? /*#__PURE__*/_react["default"].createElement("i", {
|
|
103
|
+
className: icon,
|
|
104
|
+
"aria-hidden": "true"
|
|
105
|
+
}) : icon, iconText && /*#__PURE__*/_react["default"].createElement(_Typography["default"], _extends({
|
|
107
106
|
prefixClass: prefixClass,
|
|
108
107
|
component: 'div',
|
|
109
108
|
color: 'var(--white)',
|
|
@@ -112,39 +111,41 @@ var Tag = function Tag(_ref) {
|
|
|
112
111
|
display: 'flex',
|
|
113
112
|
alignItems: 'center'
|
|
114
113
|
}
|
|
115
|
-
}, iconTypographyProps), iconText)), /*#__PURE__*/_react
|
|
114
|
+
}, iconTypographyProps), iconText)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
116
115
|
className: prefixClass('cbx-tag-block-typography')
|
|
117
|
-
}, /*#__PURE__*/_react
|
|
116
|
+
}, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
118
117
|
title: isEllipsisActive ? text : '',
|
|
119
118
|
placement: "right"
|
|
120
|
-
}, /*#__PURE__*/_react
|
|
119
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], _extends({
|
|
121
120
|
prefixClass: prefixClass,
|
|
122
|
-
color:
|
|
121
|
+
color: resolvedColorText,
|
|
123
122
|
styles: {
|
|
124
123
|
lineHeight: '1.38rem'
|
|
125
124
|
},
|
|
126
125
|
ref: typographyRef
|
|
127
|
-
}, textTypographyProps), text))), close && /*#__PURE__*/_react
|
|
126
|
+
}, textTypographyProps), text))), close && /*#__PURE__*/_react["default"].createElement("button", {
|
|
127
|
+
type: "button",
|
|
128
128
|
className: prefixClass('cbx-tag-close'),
|
|
129
|
-
onClick:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}, /*#__PURE__*/_react
|
|
129
|
+
onClick: handleCloseClick,
|
|
130
|
+
onKeyDown: handleCloseKeyDown,
|
|
131
|
+
"aria-label": closeAriaLabel || (text ? "close ".concat(text) : 'close')
|
|
132
|
+
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
133
133
|
className: "ri-close-circle-line ".concat(prefixClass('cbx-tag-close-icon')),
|
|
134
134
|
style: {
|
|
135
135
|
color: 'var(--white)'
|
|
136
|
-
}
|
|
136
|
+
},
|
|
137
|
+
"aria-hidden": "true"
|
|
137
138
|
}))));
|
|
138
139
|
};
|
|
139
|
-
|
|
140
140
|
Tag.displayName = "Tag";
|
|
141
141
|
Tag.propTypes = {
|
|
142
|
-
variant: _propTypes
|
|
143
|
-
id: _propTypes
|
|
144
|
-
className: _propTypes
|
|
145
|
-
text: _propTypes
|
|
146
|
-
icon: _propTypes
|
|
147
|
-
close: _propTypes
|
|
142
|
+
variant: _propTypes["default"].string,
|
|
143
|
+
id: _propTypes["default"].string,
|
|
144
|
+
className: _propTypes["default"].string,
|
|
145
|
+
text: _propTypes["default"].string,
|
|
146
|
+
icon: _propTypes["default"].string,
|
|
147
|
+
close: _propTypes["default"].func,
|
|
148
|
+
closeAriaLabel: _propTypes["default"].string
|
|
148
149
|
};
|
|
149
150
|
Tag.defaultProps = {
|
|
150
151
|
variant: 'primary',
|
|
@@ -152,7 +153,8 @@ Tag.defaultProps = {
|
|
|
152
153
|
className: '',
|
|
153
154
|
text: '',
|
|
154
155
|
icon: '',
|
|
155
|
-
close: undefined
|
|
156
|
+
close: undefined,
|
|
157
|
+
closeAriaLabel: ''
|
|
156
158
|
};
|
|
157
159
|
var _default = Tag;
|
|
158
|
-
exports
|
|
160
|
+
exports["default"] = _default;
|
|
@@ -3,19 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = exports.DesignTagTemplate = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Tag = _interopRequireDefault(require("./Tag"));
|
|
11
|
-
|
|
12
9
|
var _DesignTags = _interopRequireDefault(require("./DesignTags.stories"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
11
|
var _default = {
|
|
17
12
|
title: 'Components/Tag',
|
|
18
|
-
component: _Tag
|
|
13
|
+
component: _Tag["default"],
|
|
19
14
|
argTypes: {
|
|
20
15
|
variant: {
|
|
21
16
|
control: {
|
|
@@ -39,12 +34,10 @@ var _default = {
|
|
|
39
34
|
}
|
|
40
35
|
}
|
|
41
36
|
};
|
|
42
|
-
exports
|
|
43
|
-
|
|
37
|
+
exports["default"] = _default;
|
|
44
38
|
var TemplateTag = function TemplateTag(args) {
|
|
45
|
-
return /*#__PURE__*/_react
|
|
39
|
+
return /*#__PURE__*/_react["default"].createElement(_DesignTags["default"], args);
|
|
46
40
|
};
|
|
47
|
-
|
|
48
41
|
TemplateTag.displayName = "TemplateTag";
|
|
49
42
|
var DesignTagTemplate = TemplateTag.bind({});
|
|
50
43
|
exports.DesignTagTemplate = DesignTagTemplate;
|