@laerdal/life-react-components 1.10.3-dev.2 → 1.10.3-dev.4
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/Accordion/AccordionItem.cjs +22 -6
- package/dist/Accordion/AccordionItem.cjs.map +1 -1
- package/dist/Accordion/AccordionItem.js +21 -6
- package/dist/Accordion/AccordionItem.js.map +1 -1
- package/dist/Accordion/AccordionMenu.cjs +40 -21
- package/dist/Accordion/AccordionMenu.cjs.map +1 -1
- package/dist/Accordion/AccordionMenu.d.ts +2 -2
- package/dist/Accordion/AccordionMenu.js +39 -21
- package/dist/Accordion/AccordionMenu.js.map +1 -1
- package/dist/Accordion/ContentAccordion.cjs +56 -29
- package/dist/Accordion/ContentAccordion.cjs.map +1 -1
- package/dist/Accordion/ContentAccordion.d.ts +2 -2
- package/dist/Accordion/ContentAccordion.js +54 -29
- package/dist/Accordion/ContentAccordion.js.map +1 -1
- package/dist/Banners/Banner.cjs +64 -46
- package/dist/Banners/Banner.cjs.map +1 -1
- package/dist/Banners/Banner.d.ts +3 -2
- package/dist/Banners/Banner.js +63 -42
- package/dist/Banners/Banner.js.map +1 -1
- package/dist/Banners/OverviewBanner.cjs +14 -3
- package/dist/Banners/OverviewBanner.cjs.map +1 -1
- package/dist/Banners/OverviewBanner.d.ts +3 -2
- package/dist/Banners/OverviewBanner.js +12 -3
- package/dist/Banners/OverviewBanner.js.map +1 -1
- package/dist/Breadcrumb/Breadcrumb.cjs +16 -4
- package/dist/Breadcrumb/Breadcrumb.cjs.map +1 -1
- package/dist/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/Breadcrumb/Breadcrumb.js +15 -4
- package/dist/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/Button/Iconbutton.cjs +20 -14
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.d.ts +1 -4
- package/dist/Button/Iconbutton.js +17 -14
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.cjs +8 -2
- package/dist/Card/HorizontalCard/HorizontalCard.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.js +6 -2
- package/dist/Card/HorizontalCard/HorizontalCard.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardActions.cjs +2 -8
- package/dist/Card/HorizontalCard/HorizontalCardActions.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardActions.js +2 -2
- package/dist/Card/HorizontalCard/HorizontalCardActions.js.map +1 -1
- package/dist/Card/HorizontalCard/types.d.ts +1 -1
- package/dist/Card/VerticalCard/Card.cjs +12 -5
- package/dist/Card/VerticalCard/Card.cjs.map +1 -1
- package/dist/Card/VerticalCard/Card.d.ts +1 -1
- package/dist/Card/VerticalCard/Card.js +10 -5
- package/dist/Card/VerticalCard/Card.js.map +1 -1
- package/dist/Chips/ActionChip.cjs +18 -14
- package/dist/Chips/ActionChip.cjs.map +1 -1
- package/dist/Chips/ActionChip.js +16 -5
- package/dist/Chips/ActionChip.js.map +1 -1
- package/dist/Chips/ChipTypes.d.ts +5 -3
- package/dist/Chips/ChoiceChips.cjs +24 -16
- package/dist/Chips/ChoiceChips.cjs.map +1 -1
- package/dist/Chips/ChoiceChips.js +22 -9
- package/dist/Chips/ChoiceChips.js.map +1 -1
- package/dist/Chips/FilterChip.cjs +18 -14
- package/dist/Chips/FilterChip.cjs.map +1 -1
- package/dist/Chips/FilterChip.js +16 -5
- package/dist/Chips/FilterChip.js.map +1 -1
- package/dist/Chips/InputChip.cjs +18 -14
- package/dist/Chips/InputChip.cjs.map +1 -1
- package/dist/Chips/InputChip.js +17 -5
- package/dist/Chips/InputChip.js.map +1 -1
- package/dist/ChipsInput/ChipDropdownInput.cjs +14 -7
- package/dist/ChipsInput/ChipDropdownInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipDropdownInput.d.ts +1 -1
- package/dist/ChipsInput/ChipDropdownInput.js +12 -6
- package/dist/ChipsInput/ChipDropdownInput.js.map +1 -1
- package/dist/ChipsInput/ChipInput.cjs +16 -12
- package/dist/ChipsInput/ChipInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipInput.d.ts +1 -1
- package/dist/ChipsInput/ChipInput.js +14 -7
- package/dist/ChipsInput/ChipInput.js.map +1 -1
- package/dist/ChipsInput/ChipInputField.cjs +22 -4
- package/dist/ChipsInput/ChipInputField.cjs.map +1 -1
- package/dist/ChipsInput/ChipInputField.d.ts +1 -1
- package/dist/ChipsInput/ChipInputField.js +18 -4
- package/dist/ChipsInput/ChipInputField.js.map +1 -1
- package/dist/ChipsInput/ChipInputTypes.d.ts +2 -1
- package/dist/Dropdown/BasicDropdown.cjs +88 -64
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.d.ts +13 -8
- package/dist/Dropdown/BasicDropdown.js +87 -65
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +30 -14
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.d.ts +3 -3
- package/dist/Dropdown/DropdownFilter.js +26 -13
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/Footer/SiteFooter.cjs +16 -4
- package/dist/Footer/SiteFooter.cjs.map +1 -1
- package/dist/Footer/SiteFooter.d.ts +6 -2
- package/dist/Footer/SiteFooter.js +14 -4
- package/dist/Footer/SiteFooter.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +2 -8
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js +2 -2
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js.map +1 -1
- package/dist/Image/ImageWithFallbacks.cjs +10 -2
- package/dist/Image/ImageWithFallbacks.cjs.map +1 -1
- package/dist/Image/ImageWithFallbacks.d.ts +1 -1
- package/dist/Image/ImageWithFallbacks.js +9 -2
- package/dist/Image/ImageWithFallbacks.js.map +1 -1
- package/dist/InputFields/Checkbox.cjs +16 -4
- package/dist/InputFields/Checkbox.cjs.map +1 -1
- package/dist/InputFields/Checkbox.d.ts +1 -1
- package/dist/InputFields/Checkbox.js +13 -4
- package/dist/InputFields/Checkbox.js.map +1 -1
- package/dist/InputFields/DatepickerField.cjs +44 -38
- package/dist/InputFields/DatepickerField.cjs.map +1 -1
- package/dist/InputFields/DatepickerField.d.ts +17 -20
- package/dist/InputFields/DatepickerField.js +33 -20
- package/dist/InputFields/DatepickerField.js.map +1 -1
- package/dist/InputFields/NumberField.cjs +63 -52
- package/dist/InputFields/NumberField.cjs.map +1 -1
- package/dist/InputFields/NumberField.d.ts +14 -19
- package/dist/InputFields/NumberField.js +60 -53
- package/dist/InputFields/NumberField.js.map +1 -1
- package/dist/InputFields/PasswordField.cjs +25 -8
- package/dist/InputFields/PasswordField.cjs.map +1 -1
- package/dist/InputFields/PasswordField.d.ts +14 -14
- package/dist/InputFields/PasswordField.js +22 -9
- package/dist/InputFields/PasswordField.js.map +1 -1
- package/dist/InputFields/RadioButton.cjs +17 -5
- package/dist/InputFields/RadioButton.cjs.map +1 -1
- package/dist/InputFields/RadioButton.d.ts +2 -2
- package/dist/InputFields/RadioButton.js +14 -5
- package/dist/InputFields/RadioButton.js.map +1 -1
- package/dist/InputFields/TextField.cjs +23 -8
- package/dist/InputFields/TextField.cjs.map +1 -1
- package/dist/InputFields/TextField.d.ts +20 -20
- package/dist/InputFields/TextField.js +22 -9
- package/dist/InputFields/TextField.js.map +1 -1
- package/dist/InputFields/Textarea.cjs +20 -7
- package/dist/InputFields/Textarea.cjs.map +1 -1
- package/dist/InputFields/Textarea.d.ts +16 -2
- package/dist/InputFields/Textarea.js +18 -8
- package/dist/InputFields/Textarea.js.map +1 -1
- package/dist/InputFields/components/SearchBarInput.cjs +4 -1
- package/dist/InputFields/components/SearchBarInput.cjs.map +1 -1
- package/dist/InputFields/components/SearchBarInput.js +4 -1
- package/dist/InputFields/components/SearchBarInput.js.map +1 -1
- package/dist/InputFields/index.cjs +26 -0
- package/dist/InputFields/index.cjs.map +1 -1
- package/dist/InputFields/index.d.ts +1 -0
- package/dist/InputFields/index.js +1 -0
- package/dist/InputFields/index.js.map +1 -1
- package/dist/InputFields/types.d.ts +1 -1
- package/dist/LinearProgress/LinearProgress.cjs +17 -4
- package/dist/LinearProgress/LinearProgress.cjs.map +1 -1
- package/dist/LinearProgress/LinearProgress.d.ts +1 -1
- package/dist/LinearProgress/LinearProgress.js +14 -4
- package/dist/LinearProgress/LinearProgress.js.map +1 -1
- package/dist/List/ListRow.cjs +15 -8
- package/dist/List/ListRow.cjs.map +1 -1
- package/dist/List/ListRow.d.ts +1 -1
- package/dist/List/ListRow.js +13 -8
- package/dist/List/ListRow.js.map +1 -1
- package/dist/MenuItem/MenuItem.cjs +16 -6
- package/dist/MenuItem/MenuItem.cjs.map +1 -1
- package/dist/MenuItem/MenuItem.d.ts +1 -3
- package/dist/MenuItem/MenuItem.js +14 -6
- package/dist/MenuItem/MenuItem.js.map +1 -1
- package/dist/ProfileButton/ProfileButton.cjs +17 -8
- package/dist/ProfileButton/ProfileButton.cjs.map +1 -1
- package/dist/ProfileButton/ProfileButton.d.ts +8 -12
- package/dist/ProfileButton/ProfileButton.js +14 -8
- package/dist/ProfileButton/ProfileButton.js.map +1 -1
- package/dist/QuizButton/QuizButton.cjs +17 -6
- package/dist/QuizButton/QuizButton.cjs.map +1 -1
- package/dist/QuizButton/QuizButton.d.ts +1 -2
- package/dist/QuizButton/QuizButton.js +15 -6
- package/dist/QuizButton/QuizButton.js.map +1 -1
- package/dist/SegmentControl/SegmentControl.cjs +28 -8
- package/dist/SegmentControl/SegmentControl.cjs.map +1 -1
- package/dist/SegmentControl/SegmentControl.d.ts +2 -2
- package/dist/SegmentControl/SegmentControl.js +26 -8
- package/dist/SegmentControl/SegmentControl.js.map +1 -1
- package/dist/SideMenu/SideMenu.cjs +11 -4
- package/dist/SideMenu/SideMenu.cjs.map +1 -1
- package/dist/SideMenu/SideMenu.js +10 -4
- package/dist/SideMenu/SideMenu.js.map +1 -1
- package/dist/SideMenu/types.d.ts +1 -1
- package/dist/Table/TableFooter.cjs +10 -7
- package/dist/Table/TableFooter.cjs.map +1 -1
- package/dist/Table/TableFooter.js +10 -7
- package/dist/Table/TableFooter.js.map +1 -1
- package/dist/Tabs/HorizontalTabs.cjs +32 -13
- package/dist/Tabs/HorizontalTabs.cjs.map +1 -1
- package/dist/Tabs/HorizontalTabs.d.ts +7 -4
- package/dist/Tabs/HorizontalTabs.js +30 -13
- package/dist/Tabs/HorizontalTabs.js.map +1 -1
- package/dist/Tag/Tag.cjs +16 -4
- package/dist/Tag/Tag.cjs.map +1 -1
- package/dist/Tag/Tag.d.ts +1 -1
- package/dist/Tag/Tag.js +14 -4
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Tile/Tile.cjs +11 -4
- package/dist/Tile/Tile.cjs.map +1 -1
- package/dist/Tile/Tile.js +10 -4
- package/dist/Tile/Tile.js.map +1 -1
- package/dist/Tile/TileTypes.d.ts +1 -1
- package/dist/Toasters/Toast.cjs.map +1 -1
- package/dist/Toasters/Toast.js.map +1 -1
- package/dist/Toggles/ToggleButton.cjs +36 -17
- package/dist/Toggles/ToggleButton.cjs.map +1 -1
- package/dist/Toggles/ToggleButton.d.ts +1 -2
- package/dist/Toggles/ToggleButton.js +33 -17
- package/dist/Toggles/ToggleButton.js.map +1 -1
- package/dist/Toggles/ToggleSwitch.cjs +27 -17
- package/dist/Toggles/ToggleSwitch.cjs.map +1 -1
- package/dist/Toggles/ToggleSwitch.d.ts +5 -1
- package/dist/Toggles/ToggleSwitch.js +24 -12
- package/dist/Toggles/ToggleSwitch.js.map +1 -1
- package/dist/Toggles/TogglerTypes.d.ts +1 -1
- package/dist/common/FocusVisible.cjs.map +1 -1
- package/dist/common/FocusVisible.d.ts +1 -1
- package/dist/common/FocusVisible.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.StyledSecondaryIconButton = exports.StyledPrimaryIconButton = exports.StyledIconButton = exports.IconButtonContent = void 0;
|
|
9
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
10
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
15
|
|
|
12
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -21,8 +25,14 @@ var _common = require("../common");
|
|
|
21
25
|
|
|
22
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
27
|
|
|
28
|
+
var _excluded = ["id", "variant", "shape", "action", "hideOnLowWidth", "isInMobileMenu", "children", "useTransparentBackground", "shouldNotInteract", "disabled", "iconColor", "unsetIconSize", "tabIndex", "flatEdge", "borderRadius", "focusBackgroundColor", "type", "hidden", "invertFocus"];
|
|
29
|
+
|
|
24
30
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
31
|
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
35
|
+
|
|
26
36
|
var getBorderRadius = function getBorderRadius(props) {
|
|
27
37
|
return props.borderRadius ? "".concat(props.borderRadius, "px") : '4px';
|
|
28
38
|
};
|
|
@@ -97,17 +107,16 @@ var IconButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
97
107
|
tabIndex = _ref.tabIndex,
|
|
98
108
|
flatEdge = _ref.flatEdge,
|
|
99
109
|
borderRadius = _ref.borderRadius,
|
|
100
|
-
onKeyPress = _ref.onKeyPress,
|
|
101
110
|
focusBackgroundColor = _ref.focusBackgroundColor,
|
|
102
111
|
type = _ref.type,
|
|
103
112
|
hidden = _ref.hidden,
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
invertFocus = _ref.invertFocus,
|
|
114
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
106
115
|
|
|
107
116
|
// Let's render button
|
|
108
117
|
switch (variant) {
|
|
109
118
|
case 'secondary':
|
|
110
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSecondaryIconButton, {
|
|
119
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSecondaryIconButton, _objectSpread(_objectSpread({
|
|
111
120
|
id: id,
|
|
112
121
|
type: type !== null && type !== void 0 ? type : 'button',
|
|
113
122
|
"data-testid": id,
|
|
@@ -126,19 +135,18 @@ var IconButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
126
135
|
tabIndex: tabIndex || 0,
|
|
127
136
|
borderRadius: borderRadius || shape === 'circular' ? 18 : 0,
|
|
128
137
|
onMouseDown: _common.defaultOnMouseDownHandler,
|
|
129
|
-
onKeyPress: onKeyPress,
|
|
130
138
|
hidden: hidden,
|
|
131
|
-
style: style,
|
|
132
139
|
invertFocus: invertFocus,
|
|
133
|
-
focusBackgroundColor: focusBackgroundColor
|
|
140
|
+
focusBackgroundColor: focusBackgroundColor
|
|
141
|
+
}, rest), {}, {
|
|
134
142
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButtonContent, {
|
|
135
143
|
children: children
|
|
136
144
|
})
|
|
137
|
-
});
|
|
145
|
+
}));
|
|
138
146
|
|
|
139
147
|
case 'primary':
|
|
140
148
|
default:
|
|
141
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPrimaryIconButton, {
|
|
149
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPrimaryIconButton, _objectSpread(_objectSpread({
|
|
142
150
|
id: id,
|
|
143
151
|
type: type !== null && type !== void 0 ? type : 'button',
|
|
144
152
|
"data-testid": id,
|
|
@@ -157,15 +165,14 @@ var IconButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
157
165
|
tabIndex: tabIndex || 0,
|
|
158
166
|
borderRadius: borderRadius || shape === 'circular' ? 18 : 0,
|
|
159
167
|
onMouseDown: _common.defaultOnMouseDownHandler,
|
|
160
|
-
onKeyPress: onKeyPress,
|
|
161
168
|
hidden: hidden,
|
|
162
|
-
style: style,
|
|
163
169
|
invertFocus: invertFocus,
|
|
164
|
-
focusBackgroundColor: focusBackgroundColor
|
|
170
|
+
focusBackgroundColor: focusBackgroundColor
|
|
171
|
+
}, rest), {}, {
|
|
165
172
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButtonContent, {
|
|
166
173
|
children: children
|
|
167
174
|
})
|
|
168
|
-
});
|
|
175
|
+
}));
|
|
169
176
|
}
|
|
170
177
|
});
|
|
171
178
|
|
|
@@ -184,7 +191,6 @@ IconButton.propTypes = {
|
|
|
184
191
|
unsetIconSize: _propTypes.default.bool,
|
|
185
192
|
tabIndex: _propTypes.default.number,
|
|
186
193
|
borderRadius: _propTypes.default.number,
|
|
187
|
-
onKeyPress: _propTypes.default.func,
|
|
188
194
|
focusBackgroundColor: _propTypes.default.string,
|
|
189
195
|
children: _propTypes.default.node,
|
|
190
196
|
hidden: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Button/Iconbutton.tsx"],"names":["getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","IconButtonContent","styled","div","StyledIconButton","button","hideOnLowWidth","BREAKPOINTS","MEDIUM","unsetIconSize","invertFocus","invertedFocusStyles","focusStyles","StyledPrimaryIconButton","useTransparentBackground","COLORS","primary_500","iconColor","white","primary_700","primary_800","neutral_200","StyledSecondaryIconButton","neutral_600","shouldNotInteract","primary_20","primary_100","neutral_300","IconButton","React","forwardRef","ref","id","variant","shape","action","isInMobileMenu","children","disabled","tabIndex","onKeyPress","focusBackgroundColor","type","hidden","style","event","stopPropagation","defaultOnMouseDownHandler","className"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;AAgBA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;AAAA,SAA6BA,KAAK,CAACC,YAAN,aAAwBD,KAAK,CAACC,YAA9B,UAAiD,KAA9E;AAAA,CAAxB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACF,KAAD,EAA4B;AACvD,MAAMG,MAAM,GAAGJ,eAAe,CAACC,KAAD,CAA9B;;AACA,UAAQA,KAAK,CAACI,QAAd;AACE,SAAK,MAAL;AACE,2BAAcD,MAAd,cAAwBA,MAAxB;;AAEF,SAAK,OAAL;AACE,uBAAUA,MAAV,sBAA4BA,MAA5B;;AAEF,SAAK,MAAL;AACA;AACE,uBAAUA,MAAV;AATJ;AAWD,CAbD;;AAeO,IAAME,iBAAiB,GAAGC,0BAAOC,GAAV,mFAAvB;;;;AAEA,IAAMC,gBAAgB,GAAGF,0BAAOG,MAAV,koBAQhB,UAACT,KAAD;AAAA,SAAYA,KAAK,CAACU,cAAN,GAAuB,MAAvB,GAAgC,OAA5C;AAAA,CARgB,EASzBC,oBAAYC,MATa,EAaV,UAACZ,KAAD;AAAA,SAAYA,KAAK,C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AAA,a;AACA8B,EAAAA,Q;AACA1C,EAAAA,Y;AACA2C,EAAAA,U;AACAC,EAAAA,oB;AAEAJ,EAAAA,Q;AACAM,EAAAA,M;AAEAjC,EAAAA,W;;eA+FakB,U","sourcesContent":["import React from 'react';\nimport styled, { css, CSSProperties } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';\nimport { defaultOnMouseDownHandler } from '../common';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n focusBackgroundColor?: string;\n invertFocus?: boolean;\n shouldNotInteract?: boolean;\n}\n\nconst getBorderRadius = (props: HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px');\n\nconst getBorderRadiusStyle = (props: HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch (props.flatEdge) {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n\n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nexport const IconButtonContent = styled.div``;\n\nexport const StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n position: relative;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n ${IconButtonContent} {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n\n &:focus {\n ${(props) => (props.invertFocus ? invertedFocusStyles : focusStyles)}\n }\n`;\n\nexport const StyledPrimaryIconButton = styled(StyledIconButton)`\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:hover:not(:disabled),\n &.hover-state {\n ${IconButtonContent} {\n background-color: ${COLORS.primary_700};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled),\n &.active-state {\n ${IconButtonContent} {\n background: ${COLORS.primary_800};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n`;\n\nexport const StyledSecondaryIconButton = styled(StyledIconButton)`\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n\n pointer-events: ${(props) => (props.shouldNotInteract ? 'none' : 'auto')};\n\n &:hover:not(:disabled) {\n ${IconButtonContent} {\n background-color: ${COLORS.primary_20};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled),\n &.active-state {\n ${IconButtonContent} {\n background: ${COLORS.primary_100};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n`;\n\nexport interface IconButtonProps {\n id?: string;\n className?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n shouldNotInteract?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;\n focusBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n style?: CSSProperties | undefined;\n invertFocus?: boolean;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n shouldNotInteract,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n onKeyPress,\n focusBackgroundColor,\n type,\n hidden,\n style,\n invertFocus,\n }: IconButtonProps,\n ref,\n ) => {\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n action(event);\n }}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n shouldNotInteract={shouldNotInteract}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n style={style}\n invertFocus={invertFocus}\n focusBackgroundColor={focusBackgroundColor}>\n <IconButtonContent>{children}</IconButtonContent>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n action(event);\n }}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n style={style}\n invertFocus={invertFocus}\n focusBackgroundColor={focusBackgroundColor}>\n <IconButtonContent>{children}</IconButtonContent>\n </StyledPrimaryIconButton>\n );\n }\n },\n);\n\nexport default IconButton;\n"],"file":"Iconbutton.cjs"}
|
|
1
|
+
{"version":3,"sources":["../../src/Button/Iconbutton.tsx"],"names":["getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","IconButtonContent","styled","div","StyledIconButton","button","hideOnLowWidth","BREAKPOINTS","MEDIUM","unsetIconSize","invertFocus","invertedFocusStyles","focusStyles","StyledPrimaryIconButton","useTransparentBackground","COLORS","primary_500","iconColor","white","primary_700","primary_800","neutral_200","StyledSecondaryIconButton","neutral_600","shouldNotInteract","primary_20","primary_100","neutral_300","IconButton","React","forwardRef","ref","id","variant","shape","action","isInMobileMenu","children","disabled","tabIndex","focusBackgroundColor","type","hidden","rest","event","stopPropagation","defaultOnMouseDownHandler","className"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;;;AAgBA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;AAAA,SAA6BA,KAAK,CAACC,YAAN,aAAwBD,KAAK,CAACC,YAA9B,UAAiD,KAA9E;AAAA,CAAxB;;AAEA,IAAMC,oB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AAEhC,WApBf;AAqBE,QAAA,oBAAoB,EAAE8B;AArBxB,SAsBMG,IAtBN;AAAA,+BAuBE,qBAAC,iBAAD;AAAA,oBAAoBN;AAApB;AAvBF,SADF;AA/BJ;AA2DD,CAtFgB,CAAnB;;;AAtBEL,EAAAA,E;AACAe,EAAAA,S;AACAd,EAAAA,O,4BAAU,S,EAAY,W;AACtBC,EAAAA,K,4BAAQ,Q,EAAW,U;AACnBC,EAAAA,M;AACA7B,EAAAA,c;AAEA8B,EAAAA,c;AACAE,EAAAA,Q;AACAxB,EAAAA,wB;AACAU,EAAAA,iB;AACAP,EAAAA,S;AACAR,EAAAA,a;AACA8B,EAAAA,Q;AACA1C,EAAAA,Y;AACA2C,EAAAA,oB;AAEAH,EAAAA,Q;AACAK,EAAAA,M;AACAhC,EAAAA,W;;eA4FakB,U","sourcesContent":["import React from 'react';\nimport styled, { css, CSSProperties } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';\nimport { defaultOnMouseDownHandler } from '../common';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n focusBackgroundColor?: string;\n invertFocus?: boolean;\n shouldNotInteract?: boolean;\n}\n\nconst getBorderRadius = (props: HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px');\n\nconst getBorderRadiusStyle = (props: HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch (props.flatEdge) {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n\n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nexport const IconButtonContent = styled.div``;\n\nexport const StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n position: relative;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n ${IconButtonContent} {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n\n &:focus {\n ${(props) => (props.invertFocus ? invertedFocusStyles : focusStyles)}\n }\n`;\n\nexport const StyledPrimaryIconButton = styled(StyledIconButton)`\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:hover:not(:disabled),\n &.hover-state {\n ${IconButtonContent} {\n background-color: ${COLORS.primary_700};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled),\n &.active-state {\n ${IconButtonContent} {\n background: ${COLORS.primary_800};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n`;\n\nexport const StyledSecondaryIconButton = styled(StyledIconButton)`\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n\n pointer-events: ${(props) => (props.shouldNotInteract ? 'none' : 'auto')};\n\n &:hover:not(:disabled) {\n ${IconButtonContent} {\n background-color: ${COLORS.primary_20};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled),\n &.active-state {\n ${IconButtonContent} {\n background: ${COLORS.primary_100};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n`;\n\nexport interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'id' | 'className' | 'onClick' | 'hidden' | 'tabIndex' | 'disabled' | 'onMouseDown'> {\n id?: string;\n className?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n shouldNotInteract?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n focusBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n invertFocus?: boolean;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n shouldNotInteract,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n focusBackgroundColor,\n type,\n hidden,\n invertFocus,\n ...rest\n }: IconButtonProps,\n ref,\n ) => {\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n action(event);\n }}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n shouldNotInteract={shouldNotInteract}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n hidden={hidden}\n invertFocus={invertFocus}\n focusBackgroundColor={focusBackgroundColor}\n {...rest}>\n <IconButtonContent>{children}</IconButtonContent>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n action(event);\n }}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n hidden={hidden}\n invertFocus={invertFocus}\n focusBackgroundColor={focusBackgroundColor}\n {...rest}>\n <IconButtonContent>{children}</IconButtonContent>\n </StyledPrimaryIconButton>\n );\n }\n },\n);\n\nexport default IconButton;\n"],"file":"Iconbutton.cjs"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CSSProperties } from 'styled-components';
|
|
3
2
|
interface HeaderItemProps {
|
|
4
3
|
hideOnLowWidth: boolean;
|
|
5
4
|
inMobileMenu?: boolean;
|
|
@@ -17,7 +16,7 @@ export declare const IconButtonContent: import("styled-components").StyledCompon
|
|
|
17
16
|
export declare const StyledIconButton: import("styled-components").StyledComponent<"button", any, HeaderItemProps, never>;
|
|
18
17
|
export declare const StyledPrimaryIconButton: import("styled-components").StyledComponent<"button", any, HeaderItemProps, never>;
|
|
19
18
|
export declare const StyledSecondaryIconButton: import("styled-components").StyledComponent<"button", any, HeaderItemProps, never>;
|
|
20
|
-
export interface IconButtonProps {
|
|
19
|
+
export interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'id' | 'className' | 'onClick' | 'hidden' | 'tabIndex' | 'disabled' | 'onMouseDown'> {
|
|
21
20
|
id?: string;
|
|
22
21
|
className?: string;
|
|
23
22
|
variant?: 'primary' | 'secondary';
|
|
@@ -33,12 +32,10 @@ export interface IconButtonProps {
|
|
|
33
32
|
unsetIconSize?: boolean;
|
|
34
33
|
tabIndex?: number;
|
|
35
34
|
borderRadius?: number;
|
|
36
|
-
onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
37
35
|
focusBackgroundColor?: string;
|
|
38
36
|
type?: 'submit' | 'reset' | 'button' | undefined;
|
|
39
37
|
children?: React.ReactNode;
|
|
40
38
|
hidden?: boolean;
|
|
41
|
-
style?: CSSProperties | undefined;
|
|
42
39
|
invertFocus?: boolean;
|
|
43
40
|
}
|
|
44
41
|
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
1
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
4
|
import _pt from "prop-types";
|
|
5
|
+
var _excluded = ["id", "variant", "shape", "action", "hideOnLowWidth", "isInMobileMenu", "children", "useTransparentBackground", "shouldNotInteract", "disabled", "iconColor", "unsetIconSize", "tabIndex", "flatEdge", "borderRadius", "focusBackgroundColor", "type", "hidden", "invertFocus"];
|
|
3
6
|
|
|
4
7
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
5
8
|
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
12
|
+
|
|
6
13
|
import React from 'react';
|
|
7
14
|
import styled from 'styled-components';
|
|
8
15
|
import { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';
|
|
@@ -75,17 +82,16 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
75
82
|
tabIndex = _ref.tabIndex,
|
|
76
83
|
flatEdge = _ref.flatEdge,
|
|
77
84
|
borderRadius = _ref.borderRadius,
|
|
78
|
-
onKeyPress = _ref.onKeyPress,
|
|
79
85
|
focusBackgroundColor = _ref.focusBackgroundColor,
|
|
80
86
|
type = _ref.type,
|
|
81
87
|
hidden = _ref.hidden,
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
invertFocus = _ref.invertFocus,
|
|
89
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
84
90
|
|
|
85
91
|
// Let's render button
|
|
86
92
|
switch (variant) {
|
|
87
93
|
case 'secondary':
|
|
88
|
-
return /*#__PURE__*/_jsx(StyledSecondaryIconButton, {
|
|
94
|
+
return /*#__PURE__*/_jsx(StyledSecondaryIconButton, _objectSpread(_objectSpread({
|
|
89
95
|
id: id,
|
|
90
96
|
type: type !== null && type !== void 0 ? type : 'button',
|
|
91
97
|
"data-testid": id,
|
|
@@ -104,19 +110,18 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
104
110
|
tabIndex: tabIndex || 0,
|
|
105
111
|
borderRadius: borderRadius || shape === 'circular' ? 18 : 0,
|
|
106
112
|
onMouseDown: defaultOnMouseDownHandler,
|
|
107
|
-
onKeyPress: onKeyPress,
|
|
108
113
|
hidden: hidden,
|
|
109
|
-
style: style,
|
|
110
114
|
invertFocus: invertFocus,
|
|
111
|
-
focusBackgroundColor: focusBackgroundColor
|
|
115
|
+
focusBackgroundColor: focusBackgroundColor
|
|
116
|
+
}, rest), {}, {
|
|
112
117
|
children: /*#__PURE__*/_jsx(IconButtonContent, {
|
|
113
118
|
children: children
|
|
114
119
|
})
|
|
115
|
-
});
|
|
120
|
+
}));
|
|
116
121
|
|
|
117
122
|
case 'primary':
|
|
118
123
|
default:
|
|
119
|
-
return /*#__PURE__*/_jsx(StyledPrimaryIconButton, {
|
|
124
|
+
return /*#__PURE__*/_jsx(StyledPrimaryIconButton, _objectSpread(_objectSpread({
|
|
120
125
|
id: id,
|
|
121
126
|
type: type !== null && type !== void 0 ? type : 'button',
|
|
122
127
|
"data-testid": id,
|
|
@@ -135,15 +140,14 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
135
140
|
tabIndex: tabIndex || 0,
|
|
136
141
|
borderRadius: borderRadius || shape === 'circular' ? 18 : 0,
|
|
137
142
|
onMouseDown: defaultOnMouseDownHandler,
|
|
138
|
-
onKeyPress: onKeyPress,
|
|
139
143
|
hidden: hidden,
|
|
140
|
-
style: style,
|
|
141
144
|
invertFocus: invertFocus,
|
|
142
|
-
focusBackgroundColor: focusBackgroundColor
|
|
145
|
+
focusBackgroundColor: focusBackgroundColor
|
|
146
|
+
}, rest), {}, {
|
|
143
147
|
children: /*#__PURE__*/_jsx(IconButtonContent, {
|
|
144
148
|
children: children
|
|
145
149
|
})
|
|
146
|
-
});
|
|
150
|
+
}));
|
|
147
151
|
}
|
|
148
152
|
});
|
|
149
153
|
IconButton.propTypes = {
|
|
@@ -161,7 +165,6 @@ IconButton.propTypes = {
|
|
|
161
165
|
unsetIconSize: _pt.bool,
|
|
162
166
|
tabIndex: _pt.number,
|
|
163
167
|
borderRadius: _pt.number,
|
|
164
|
-
onKeyPress: _pt.func,
|
|
165
168
|
focusBackgroundColor: _pt.string,
|
|
166
169
|
children: _pt.node,
|
|
167
170
|
hidden: _pt.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Button/Iconbutton.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","focusStyles","invertedFocusStyles","defaultOnMouseDownHandler","getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","IconButtonContent","div","StyledIconButton","button","hideOnLowWidth","MEDIUM","unsetIconSize","invertFocus","StyledPrimaryIconButton","useTransparentBackground","primary_500","iconColor","white","primary_700","primary_800","neutral_200","StyledSecondaryIconButton","neutral_600","shouldNotInteract","primary_20","primary_100","neutral_300","IconButton","forwardRef","ref","id","variant","shape","action","isInMobileMenu","children","disabled","tabIndex","onKeyPress","focusBackgroundColor","type","hidden","style","event","stopPropagation","className"],"mappings":";;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAA2C,mBAA3C;AAEA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,WAA9B,EAA2CC,mBAA3C,QAAsE,WAAtE;AACA,SAASC,yBAAT,QAA0C,WAA1C;;;AAgBA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;AAAA,SAA6BA,KAAK,CAACC,YAAN,aAAwBD,KAAK,CAACC,YAA9B,UAAiD,KAA9E;AAAA,CAAxB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACF,KAAD,EAA4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gBE,QAAA,QAAQ,EAAE0B,QAAQ,IAAI,CAhBxB;AAiBE,QAAA,YAAY,EAAEpC,YAAY,IAAI+B,KAAK,KAAK,UAA1B,GAAuC,EAAvC,GAA4C,CAjB5D;AAkBE,QAAA,WAAW,EAAElC,yBAlBf;AAmBE,QAAA,UAAU,EAAEwC,UAnBd;AAoBE,QAAA,MAAM,EAAEG,MApBV;AAqBE,QAAA,KAAK,EAAEC,KArBT;AAsBE,QAAA,WAAW,EAAE9B,WAtBf;AAuBE,QAAA,oBAAoB,EAAE2B,oBAvBxB;AAAA,+BAwBE,KAAC,iBAAD;AAAA,oBAAoBJ;AAApB;AAxBF,QADF;AAhCJ;AA6DD,CAzFgB,CAAnB;;AAxBEL,EAAAA,E;AACAe,EAAAA,S;AACAd,EAAAA,O,aAAU,S,EAAY,W;AACtBC,EAAAA,K,aAAQ,Q,EAAW,U;AACnBC,EAAAA,M;AACAxB,EAAAA,c;AAEAyB,EAAAA,c;AACAE,EAAAA,Q;AACAtB,EAAAA,wB;AACAS,EAAAA,iB;AACAP,EAAAA,S;AACAL,EAAAA,a;AACA0B,EAAAA,Q;AACApC,EAAAA,Y;AACAqC,EAAAA,U;AACAC,EAAAA,oB;AAEAJ,EAAAA,Q;AACAM,EAAAA,M;AAEA7B,EAAAA,W;;AA+FF,eAAee,UAAf","sourcesContent":["import React from 'react';\nimport styled, { css, CSSProperties } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';\nimport { defaultOnMouseDownHandler } from '../common';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n focusBackgroundColor?: string;\n invertFocus?: boolean;\n shouldNotInteract?: boolean;\n}\n\nconst getBorderRadius = (props: HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px');\n\nconst getBorderRadiusStyle = (props: HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch (props.flatEdge) {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n\n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nexport const IconButtonContent = styled.div``;\n\nexport const StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n position: relative;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n ${IconButtonContent} {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n\n &:focus {\n ${(props) => (props.invertFocus ? invertedFocusStyles : focusStyles)}\n }\n`;\n\nexport const StyledPrimaryIconButton = styled(StyledIconButton)`\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:hover:not(:disabled),\n &.hover-state {\n ${IconButtonContent} {\n background-color: ${COLORS.primary_700};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled),\n &.active-state {\n ${IconButtonContent} {\n background: ${COLORS.primary_800};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n`;\n\nexport const StyledSecondaryIconButton = styled(StyledIconButton)`\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n\n pointer-events: ${(props) => (props.shouldNotInteract ? 'none' : 'auto')};\n\n &:hover:not(:disabled) {\n ${IconButtonContent} {\n background-color: ${COLORS.primary_20};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled),\n &.active-state {\n ${IconButtonContent} {\n background: ${COLORS.primary_100};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n`;\n\nexport interface IconButtonProps {\n id?: string;\n className?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n shouldNotInteract?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement>;\n focusBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n style?: CSSProperties | undefined;\n invertFocus?: boolean;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n shouldNotInteract,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n onKeyPress,\n focusBackgroundColor,\n type,\n hidden,\n style,\n invertFocus,\n }: IconButtonProps,\n ref,\n ) => {\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n action(event);\n }}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n shouldNotInteract={shouldNotInteract}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n style={style}\n invertFocus={invertFocus}\n focusBackgroundColor={focusBackgroundColor}>\n <IconButtonContent>{children}</IconButtonContent>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n action(event);\n }}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={onKeyPress}\n hidden={hidden}\n style={style}\n invertFocus={invertFocus}\n focusBackgroundColor={focusBackgroundColor}>\n <IconButtonContent>{children}</IconButtonContent>\n </StyledPrimaryIconButton>\n );\n }\n },\n);\n\nexport default IconButton;\n"],"file":"Iconbutton.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/Button/Iconbutton.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","focusStyles","invertedFocusStyles","defaultOnMouseDownHandler","getBorderRadius","props","borderRadius","getBorderRadiusStyle","radius","flatEdge","IconButtonContent","div","StyledIconButton","button","hideOnLowWidth","MEDIUM","unsetIconSize","invertFocus","StyledPrimaryIconButton","useTransparentBackground","primary_500","iconColor","white","primary_700","primary_800","neutral_200","StyledSecondaryIconButton","neutral_600","shouldNotInteract","primary_20","primary_100","neutral_300","IconButton","forwardRef","ref","id","variant","shape","action","isInMobileMenu","children","disabled","tabIndex","focusBackgroundColor","type","hidden","rest","event","stopPropagation","className"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAA2C,mBAA3C;AAEA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,WAA9B,EAA2CC,mBAA3C,QAAsE,WAAtE;AACA,SAASC,yBAAT,QAA0C,WAA1C;;;AAgBA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;AAAA,SAA6BA,KAAK,CAACC,YAAN,aAAwBD,KAAK,CAACC,YAA9B,UAAiD,KAA9E;AAAA,CAAxB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACF,KAAD,EAA4B;AACvD,MAAMG,MAAM,GAAGJ,eAAe,CAACC,KAAD,CAA9B;;AACA,UAAQA,KAAK,CAACI,QAAd;AACE,SAAK,MAAL;AACE,2BAAcD,MAAd,cAAwBA,MAAxB;;AAEF,SAAK,OAAL;AACE,uBAAUA,MAAV,sBAA4BA,MAA5B;;AAEF,SAAK,MAAL;AACA;AACE,uBAAUA,MAAV;AATJ;AAWD,CAbD;;AAeA,OAAO,IAAME,iBAAiB,GAAGZ,MAAM,CAACa,GAAV,qEAAvB;AAEP,OAAO,IAAMC,gBAAgB,GAAGd,MAAM,CAACe,MAAV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Q,Q,EAAW,U;AACnBC,EAAAA,M;AACAxB,EAAAA,c;AAEAyB,EAAAA,c;AACAE,EAAAA,Q;AACAtB,EAAAA,wB;AACAS,EAAAA,iB;AACAP,EAAAA,S;AACAL,EAAAA,a;AACA0B,EAAAA,Q;AACApC,EAAAA,Y;AACAqC,EAAAA,oB;AAEAH,EAAAA,Q;AACAK,EAAAA,M;AACA5B,EAAAA,W;;AA4FF,eAAee,UAAf","sourcesContent":["import React from 'react';\nimport styled, { css, CSSProperties } from 'styled-components';\n\nimport { BREAKPOINTS, COLORS, focusStyles, invertedFocusStyles } from '../styles';\nimport { defaultOnMouseDownHandler } from '../common';\n\ninterface HeaderItemProps {\n hideOnLowWidth: boolean;\n inMobileMenu?: boolean;\n useTransparentBackground?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n borderRadius?: number;\n shape?: string;\n flatEdge?: string;\n focusBackgroundColor?: string;\n invertFocus?: boolean;\n shouldNotInteract?: boolean;\n}\n\nconst getBorderRadius = (props: HeaderItemProps) => (props.borderRadius ? `${props.borderRadius}px` : '4px');\n\nconst getBorderRadiusStyle = (props: HeaderItemProps) => {\n const radius = getBorderRadius(props);\n switch (props.flatEdge) {\n case 'left':\n return `0px ${radius} ${radius} 0px`;\n\n case 'right':\n return `${radius} 0px 0px ${radius}`;\n\n case 'none':\n default:\n return `${radius}`;\n }\n};\n\nexport const IconButtonContent = styled.div``;\n\nexport const StyledIconButton = styled.button<HeaderItemProps>`\n border-width: 0;\n cursor: pointer;\n height: 48px;\n width: 48px;\n background: transparent;\n position: relative;\n\n display: ${(props) => (props.hideOnLowWidth ? 'none' : 'block')};\n ${BREAKPOINTS.MEDIUM} {\n display: block;\n }\n\n border-radius: ${(props) => (props.borderRadius ? `${props.borderRadius}px` : '4px')};\n ${IconButtonContent} {\n height: 36px;\n width: 36px;\n border-radius: ${getBorderRadiusStyle};\n display: flex;\n justify-content: center;\n align-items: center;\n svg {\n height: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n width: ${(props) => (props.unsetIconSize ? 'unset' : '24px')};\n padding: 0;\n }\n }\n &:only-child {\n margin: 0;\n }\n &:disabled {\n cursor: not-allowed;\n }\n\n &:focus {\n ${(props) => (props.invertFocus ? invertedFocusStyles : focusStyles)}\n }\n`;\n\nexport const StyledPrimaryIconButton = styled(StyledIconButton)`\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.primary_500)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.white};\n path {\n fill: ${(props) => props.iconColor || COLORS.white};\n }\n }\n }\n &:hover:not(:disabled),\n &.hover-state {\n ${IconButtonContent} {\n background-color: ${COLORS.primary_700};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.white};\n }\n }\n &:active:not(:disabled),\n &.active-state {\n ${IconButtonContent} {\n background: ${COLORS.primary_800};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.white};\n }\n }\n &:disabled {\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_200};\n }\n svg {\n path {\n fill: ${COLORS.white};\n }\n fill: ${COLORS.white};\n }\n }\n`;\n\nexport const StyledSecondaryIconButton = styled(StyledIconButton)`\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n\n svg {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n path {\n fill: ${(props) => props.iconColor || COLORS.neutral_600};\n }\n }\n }\n\n pointer-events: ${(props) => (props.shouldNotInteract ? 'none' : 'auto')};\n\n &:hover:not(:disabled) {\n ${IconButtonContent} {\n background-color: ${COLORS.primary_20};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.primary_700};\n }\n }\n &:active:not(:disabled),\n &.active-state {\n ${IconButtonContent} {\n background: ${COLORS.primary_100};\n }\n ${IconButtonContent} svg path,\n ${IconButtonContent} svg {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:disabled {\n ${IconButtonContent} {\n background-color: ${(props) => (props.useTransparentBackground ? 'transparent' : COLORS.white)};\n }\n svg {\n path {\n fill: ${COLORS.neutral_300};\n }\n fill: ${COLORS.neutral_300};\n }\n }\n`;\n\nexport interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'id' | 'className' | 'onClick' | 'hidden' | 'tabIndex' | 'disabled' | 'onMouseDown'> {\n id?: string;\n className?: string;\n variant?: 'primary' | 'secondary';\n shape?: 'square' | 'circular';\n action: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n hideOnLowWidth?: boolean;\n flatEdge?: 'right' | 'left' | 'none' | undefined;\n isInMobileMenu?: boolean;\n disabled?: boolean;\n useTransparentBackground?: boolean;\n shouldNotInteract?: boolean;\n iconColor?: string;\n unsetIconSize?: boolean;\n tabIndex?: number;\n borderRadius?: number;\n focusBackgroundColor?: string;\n type?: 'submit' | 'reset' | 'button' | undefined;\n children?: React.ReactNode;\n hidden?: boolean;\n invertFocus?: boolean;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n id,\n variant,\n shape,\n action,\n hideOnLowWidth,\n isInMobileMenu,\n children,\n useTransparentBackground,\n shouldNotInteract,\n disabled,\n iconColor,\n unsetIconSize,\n tabIndex,\n flatEdge,\n borderRadius,\n focusBackgroundColor,\n type,\n hidden,\n invertFocus,\n ...rest\n }: IconButtonProps,\n ref,\n ) => {\n // Let's render button\n switch (variant) {\n case 'secondary':\n return (\n <StyledSecondaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n action(event);\n }}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n shouldNotInteract={shouldNotInteract}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n hidden={hidden}\n invertFocus={invertFocus}\n focusBackgroundColor={focusBackgroundColor}\n {...rest}>\n <IconButtonContent>{children}</IconButtonContent>\n </StyledSecondaryIconButton>\n );\n case 'primary':\n default:\n return (\n <StyledPrimaryIconButton\n id={id}\n type={type ?? 'button'}\n data-testid={id}\n flatEdge={flatEdge}\n ref={ref}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n action(event);\n }}\n disabled={disabled}\n hideOnLowWidth={hideOnLowWidth || false}\n inMobileMenu={isInMobileMenu}\n useTransparentBackground={useTransparentBackground}\n iconColor={iconColor}\n unsetIconSize={unsetIconSize}\n tabIndex={tabIndex || 0}\n borderRadius={borderRadius || shape === 'circular' ? 18 : 0}\n onMouseDown={defaultOnMouseDownHandler}\n hidden={hidden}\n invertFocus={invertFocus}\n focusBackgroundColor={focusBackgroundColor}\n {...rest}>\n <IconButtonContent>{children}</IconButtonContent>\n </StyledPrimaryIconButton>\n );\n }\n },\n);\n\nexport default IconButton;\n"],"file":"Iconbutton.js"}
|
|
@@ -9,6 +9,8 @@ exports.default = exports.HorizontalCard = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
12
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
15
|
|
|
14
16
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -27,6 +29,8 @@ var _common = require("../../common");
|
|
|
27
29
|
|
|
28
30
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
31
|
|
|
32
|
+
var _excluded = ["title", "description", "tags", "progress", "icon", "variant", "image", "action", "actions", "disabled", "className"];
|
|
33
|
+
|
|
30
34
|
var _templateObject, _templateObject2;
|
|
31
35
|
|
|
32
36
|
var ContentContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: flex;\n flex: 1;\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n border-radius: 8px;\n"])), _styles.COLORS.white);
|
|
@@ -44,7 +48,9 @@ var HorizontalCard = function HorizontalCard(_ref) {
|
|
|
44
48
|
image = _ref.image,
|
|
45
49
|
action = _ref.action,
|
|
46
50
|
actions = _ref.actions,
|
|
47
|
-
disabled = _ref.disabled
|
|
51
|
+
disabled = _ref.disabled,
|
|
52
|
+
className = _ref.className,
|
|
53
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
48
54
|
|
|
49
55
|
var _React$useState = _react.default.useState([]),
|
|
50
56
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
@@ -54,7 +60,7 @@ var HorizontalCard = function HorizontalCard(_ref) {
|
|
|
54
60
|
var containerRef = _react.default.useRef(null);
|
|
55
61
|
|
|
56
62
|
(0, _common.useActionWithin)(containerRef, actionsRefs);
|
|
57
|
-
var cls = "".concat(variant, " ").concat(action ? 'clickable' : '', " ").concat(disabled ? 'disabled' : '');
|
|
63
|
+
var cls = "".concat(variant, " ").concat(action ? 'clickable' : '', " ").concat(disabled ? 'disabled' : '', " ").concat(className || '');
|
|
58
64
|
|
|
59
65
|
var handleClick = function handleClick() {
|
|
60
66
|
!disabled && action && action();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Card/HorizontalCard/HorizontalCard.tsx"],"names":["ContentContainer","styled","div","COLORS","white","Container","neutral_200","BOXSHADOWS","BOXSHADOW_L1","primary_20","BOXSHADOW_L3","primary_100","BOXSHADOW_L2","focusStyles","neutral_100","HorizontalCard","title","description","tags","progress","icon","variant","image","action","actions","disabled","React","useState","actionsRefs","setActionsRefs","containerRef","useRef","cls","handleClick","handleButtonPress","e","key","defaultOnMouseDownHandler","instance"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/Card/HorizontalCard/HorizontalCard.tsx"],"names":["ContentContainer","styled","div","COLORS","white","Container","neutral_200","BOXSHADOWS","BOXSHADOW_L1","primary_20","BOXSHADOW_L3","primary_100","BOXSHADOW_L2","focusStyles","neutral_100","HorizontalCard","title","description","tags","progress","icon","variant","image","action","actions","disabled","className","rest","React","useState","actionsRefs","setActionsRefs","containerRef","useRef","cls","handleClick","handleButtonPress","e","key","defaultOnMouseDownHandler","instance"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,gBAAgB,GAAGC,0BAAOC,GAAV,6OAMAC,eAAOC,KANP,CAAtB;;AAUA,IAAMC,SAAS,GAAGJ,0BAAOC,GAAV,ghCAKTF,gBALS,EAMqBG,eAAOG,WAN5B,EAWTN,gBAXS,EAYKO,mBAAWC,YAZhB,EAqBLR,gBArBK,EAsBeG,eAAOM,UAtBtB,EA2BLT,gBA3BK,EA4BSO,mBAAWG,YA5BpB,EAmCLV,gBAnCK,EAoCeG,eAAOQ,WApCtB,EAyCLX,gBAzCK,EA0CSO,mBAAWK,YA1CpB,EAgDPC,mBAhDO,EAwDPb,gBAxDO,EAyDOO,mBAAWC,YAzDlB,EA8DPR,gBA9DO,EA+DuBG,eAAOW,WA/D9B,CAAf;;AAqEO,IAAMC,cAA4D,GAAG,SAA/DA,cAA+D,OAaO;AAAA,MAZJC,KAYI,QAZJA,KAYI;AAAA,MAXJC,WAWI,QAXJA,WAWI;AAAA,MAVJC,IAUI,QAVJA,IAUI;AAAA,MATJC,QASI,QATJA,QASI;AAAA,MARJC,IAQI,QARJA,IAQI;AAAA,0BAPJC,OAOI;AAAA,MAPJA,OAOI,6BAPM,SAON;AAAA,MANJC,KAMI,QANJA,KAMI;AAAA,MALJC,MAKI,QALJA,MAKI;AAAA,MAJJC,OA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EAAEC;AAH9B,QALF,eAUE,qBAAC,4CAAD;AAAuB,QAAA,GAAG,EAAE,aAAAqB,QAAQ;AAAA,iBAAIT,cAAc,CAACS,QAAD,aAACA,QAAD,cAACA,QAAD,GAAa,EAAb,CAAlB;AAAA,SAApC;AACuB,QAAA,OAAO,EAAEhB,OADhC;AAEuB,QAAA,QAAQ,EAAEC;AAFjC,QAVF;AAAA;AANF,IADF;AAwBD,CAtDM;;;eAwDQV,c","sourcesContent":["import React, {useEffect} from 'react';\nimport {HorizontalCardProps} from './types';\nimport styled from 'styled-components';\nimport {BOXSHADOWS, COLORS, focusStyles} from '../../styles';\nimport {HorizontalCardThumbnail} from './HorizontalCardThumbnail';\nimport {HorizontalCardBody} from './HorizontalCardBody';\nimport {HorizontalCardActions} from './HorizontalCardActions';\nimport {defaultOnMouseDownHandler, useActionWithin} from '../../common';\n\nconst ContentContainer = styled.div`\n position: relative;\n display: flex;\n flex: 1;\n flex-direction: row;\n align-items: center;\n background-color: ${COLORS.white};\n border-radius: 8px;\n`;\n\nconst Container = styled.div`\n display: flex;\n flex: 1;\n\n &.outline {\n ${ContentContainer} {\n box-shadow: inset 0 0 0 1px ${COLORS.neutral_200};\n }\n }\n\n &.elevated {\n ${ContentContainer} {\n box-shadow: ${BOXSHADOWS.BOXSHADOW_L1};\n }\n }\n\n &.clickable {\n cursor: pointer;\n\n &:hover:not(.action-within):not(.disabled) {\n &.outline {\n ${ContentContainer} {\n background-color: ${COLORS.primary_20};\n }\n }\n\n &.elevated {\n ${ContentContainer} {\n box-shadow: ${BOXSHADOWS.BOXSHADOW_L3};\n }\n }\n }\n\n &:active:not(.action-within):not(.disabled) {\n &.outline {\n ${ContentContainer} {\n background-color: ${COLORS.primary_100};\n }\n }\n\n &.elevated {\n ${ContentContainer} {\n box-shadow: ${BOXSHADOWS.BOXSHADOW_L2};\n }\n }\n }\n\n &:focus {\n ${focusStyles}\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n\n &.elevated {\n ${ContentContainer} {\n box-shadow: ${BOXSHADOWS.BOXSHADOW_L1};\n }\n }\n\n &.outline {\n ${ContentContainer} {\n box-shadow: inset 0 0 0 1px ${COLORS.neutral_100};\n }\n }\n }\n`;\n\nexport const HorizontalCard: React.FunctionComponent<HorizontalCardProps> = ({\n title,\n description,\n tags,\n progress,\n icon,\n variant = 'outline',\n image,\n action,\n actions,\n disabled,\n className,\n ...rest\n }) => {\n\n const [actionsRefs, setActionsRefs] = React.useState<React.RefObject<HTMLButtonElement>[]>([]);\n const containerRef = React.useRef<HTMLDivElement>(null);\n\n useActionWithin(containerRef, actionsRefs);\n\n const cls = `${variant} ${action ? 'clickable' : ''} ${disabled ? 'disabled' : ''} ${className || ''}`;\n\n const handleClick = () => {\n !disabled && action && action();\n }\n\n const handleButtonPress = (e: React.KeyboardEvent) => {\n e.key === 'Enter' && handleClick();\n };\n\n return (\n <Container ref={containerRef}\n tabIndex={action && !disabled ? 0 : -1}\n className={cls}\n onKeyDown={handleButtonPress}\n onClick={handleClick}\n onMouseDown={defaultOnMouseDownHandler}>\n <ContentContainer>\n\n <HorizontalCardThumbnail image={image}\n icon={icon}/>\n\n <HorizontalCardBody title={title}\n description={description}\n tags={tags}\n progress={progress}/>\n\n <HorizontalCardActions ref={instance => setActionsRefs(instance ?? [])}\n actions={actions}\n disabled={disabled}/>\n\n </ContentContainer>\n </Container>\n )\n};\n\nexport default HorizontalCard;\n"],"file":"HorizontalCard.cjs"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
+
var _excluded = ["title", "description", "tags", "progress", "icon", "variant", "image", "action", "actions", "disabled", "className"];
|
|
3
5
|
|
|
4
6
|
var _templateObject, _templateObject2;
|
|
5
7
|
|
|
@@ -25,7 +27,9 @@ export var HorizontalCard = function HorizontalCard(_ref) {
|
|
|
25
27
|
image = _ref.image,
|
|
26
28
|
action = _ref.action,
|
|
27
29
|
actions = _ref.actions,
|
|
28
|
-
disabled = _ref.disabled
|
|
30
|
+
disabled = _ref.disabled,
|
|
31
|
+
className = _ref.className,
|
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
33
|
|
|
30
34
|
var _React$useState = React.useState([]),
|
|
31
35
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -34,7 +38,7 @@ export var HorizontalCard = function HorizontalCard(_ref) {
|
|
|
34
38
|
|
|
35
39
|
var containerRef = React.useRef(null);
|
|
36
40
|
useActionWithin(containerRef, actionsRefs);
|
|
37
|
-
var cls = "".concat(variant, " ").concat(action ? 'clickable' : '', " ").concat(disabled ? 'disabled' : '');
|
|
41
|
+
var cls = "".concat(variant, " ").concat(action ? 'clickable' : '', " ").concat(disabled ? 'disabled' : '', " ").concat(className || '');
|
|
38
42
|
|
|
39
43
|
var handleClick = function handleClick() {
|
|
40
44
|
!disabled && action && action();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Card/HorizontalCard/HorizontalCard.tsx"],"names":["React","styled","BOXSHADOWS","COLORS","focusStyles","HorizontalCardThumbnail","HorizontalCardBody","HorizontalCardActions","defaultOnMouseDownHandler","useActionWithin","ContentContainer","div","white","Container","neutral_200","BOXSHADOW_L1","primary_20","BOXSHADOW_L3","primary_100","BOXSHADOW_L2","neutral_100","HorizontalCard","title","description","tags","progress","icon","variant","image","action","actions","disabled","useState","actionsRefs","setActionsRefs","containerRef","useRef","cls","handleClick","handleButtonPress","e","key","instance"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/Card/HorizontalCard/HorizontalCard.tsx"],"names":["React","styled","BOXSHADOWS","COLORS","focusStyles","HorizontalCardThumbnail","HorizontalCardBody","HorizontalCardActions","defaultOnMouseDownHandler","useActionWithin","ContentContainer","div","white","Container","neutral_200","BOXSHADOW_L1","primary_20","BOXSHADOW_L3","primary_100","BOXSHADOW_L2","neutral_100","HorizontalCard","title","description","tags","progress","icon","variant","image","action","actions","disabled","className","rest","useState","actionsRefs","setActionsRefs","containerRef","useRef","cls","handleClick","handleButtonPress","e","key","instance"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAA+B,OAA/B;AAEA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,UAAR,EAAoBC,MAApB,EAA4BC,WAA5B,QAA8C,cAA9C;AACA,SAAQC,uBAAR,QAAsC,2BAAtC;AACA,SAAQC,kBAAR,QAAiC,sBAAjC;AACA,SAAQC,qBAAR,QAAoC,yBAApC;AACA,SAAQC,yBAAR,EAAmCC,eAAnC,QAAyD,cAAzD;;;AAEA,IAAMC,gBAAgB,GAAGT,MAAM,CAACU,GAAV,+NAMAR,MAAM,CAACS,KANP,CAAtB;AAUA,IAAMC,SAAS,GAAGZ,MAAM,CAACU,GAAV,kgCAKTD,gBALS,EAMqBP,MAAM,CAACW,WAN5B,EAWTJ,gBAXS,EAYKR,UAAU,CAACa,YAZhB,EAqBLL,gBArBK,EAsBeP,MAAM,CAACa,UAtBtB,EA2BLN,gBA3BK,EA4BSR,UAAU,CAACe,YA5BpB,EAmCLP,gBAnCK,EAoCeP,MAAM,CAACe,WApCtB,EAyCLR,gBAzCK,EA0CSR,UAAU,CAACiB,YA1CpB,EAgDPf,WAhDO,EAwDPM,gBAxDO,EAyDOR,UAAU,CAACa,YAzDlB,EA8DPL,gBA9DO,EA+DuBP,MAAM,CAACiB,WA/D9B,CAAf;AAqEA,OAAO,IAAMC,cAA4D,GAAG,SAA/DA,cAA+D,OAaO;AAAA,MAZJC,KAYI,QAZJA,KAYI;AAAA,MAXJC,WAWI,QAXJA,WAWI;AAAA,MAVJC,IAUI,QAVJA,IAUI;AAAA,MATJC,QASI,QATJA,QASI;AAAA,MARJC,IAQI,QARJA,IAQI;AAAA,0BAPJC,OAOI;AAAA,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AC,kBAAD;AAAoB,QAAA,KAAK,EAAEJ,KAA3B;AACoB,QAAA,WAAW,EAAEC,WADjC;AAEoB,QAAA,IAAI,EAAEC,IAF1B;AAGoB,QAAA,QAAQ,EAAEC;AAH9B,QALF,eAUE,KAAC,qBAAD;AAAuB,QAAA,GAAG,EAAE,aAAAmB,QAAQ;AAAA,iBAAIR,cAAc,CAACQ,QAAD,aAACA,QAAD,cAACA,QAAD,GAAa,EAAb,CAAlB;AAAA,SAApC;AACuB,QAAA,OAAO,EAAEd,OADhC;AAEuB,QAAA,QAAQ,EAAEC;AAFjC,QAVF;AAAA;AANF,IADF;AAwBD,CAtDM;AAwDP,eAAeV,cAAf","sourcesContent":["import React, {useEffect} from 'react';\nimport {HorizontalCardProps} from './types';\nimport styled from 'styled-components';\nimport {BOXSHADOWS, COLORS, focusStyles} from '../../styles';\nimport {HorizontalCardThumbnail} from './HorizontalCardThumbnail';\nimport {HorizontalCardBody} from './HorizontalCardBody';\nimport {HorizontalCardActions} from './HorizontalCardActions';\nimport {defaultOnMouseDownHandler, useActionWithin} from '../../common';\n\nconst ContentContainer = styled.div`\n position: relative;\n display: flex;\n flex: 1;\n flex-direction: row;\n align-items: center;\n background-color: ${COLORS.white};\n border-radius: 8px;\n`;\n\nconst Container = styled.div`\n display: flex;\n flex: 1;\n\n &.outline {\n ${ContentContainer} {\n box-shadow: inset 0 0 0 1px ${COLORS.neutral_200};\n }\n }\n\n &.elevated {\n ${ContentContainer} {\n box-shadow: ${BOXSHADOWS.BOXSHADOW_L1};\n }\n }\n\n &.clickable {\n cursor: pointer;\n\n &:hover:not(.action-within):not(.disabled) {\n &.outline {\n ${ContentContainer} {\n background-color: ${COLORS.primary_20};\n }\n }\n\n &.elevated {\n ${ContentContainer} {\n box-shadow: ${BOXSHADOWS.BOXSHADOW_L3};\n }\n }\n }\n\n &:active:not(.action-within):not(.disabled) {\n &.outline {\n ${ContentContainer} {\n background-color: ${COLORS.primary_100};\n }\n }\n\n &.elevated {\n ${ContentContainer} {\n box-shadow: ${BOXSHADOWS.BOXSHADOW_L2};\n }\n }\n }\n\n &:focus {\n ${focusStyles}\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n\n &.elevated {\n ${ContentContainer} {\n box-shadow: ${BOXSHADOWS.BOXSHADOW_L1};\n }\n }\n\n &.outline {\n ${ContentContainer} {\n box-shadow: inset 0 0 0 1px ${COLORS.neutral_100};\n }\n }\n }\n`;\n\nexport const HorizontalCard: React.FunctionComponent<HorizontalCardProps> = ({\n title,\n description,\n tags,\n progress,\n icon,\n variant = 'outline',\n image,\n action,\n actions,\n disabled,\n className,\n ...rest\n }) => {\n\n const [actionsRefs, setActionsRefs] = React.useState<React.RefObject<HTMLButtonElement>[]>([]);\n const containerRef = React.useRef<HTMLDivElement>(null);\n\n useActionWithin(containerRef, actionsRefs);\n\n const cls = `${variant} ${action ? 'clickable' : ''} ${disabled ? 'disabled' : ''} ${className || ''}`;\n\n const handleClick = () => {\n !disabled && action && action();\n }\n\n const handleButtonPress = (e: React.KeyboardEvent) => {\n e.key === 'Enter' && handleClick();\n };\n\n return (\n <Container ref={containerRef}\n tabIndex={action && !disabled ? 0 : -1}\n className={cls}\n onKeyDown={handleButtonPress}\n onClick={handleClick}\n onMouseDown={defaultOnMouseDownHandler}>\n <ContentContainer>\n\n <HorizontalCardThumbnail image={image}\n icon={icon}/>\n\n <HorizontalCardBody title={title}\n description={description}\n tags={tags}\n progress={progress}/>\n\n <HorizontalCardActions ref={instance => setActionsRefs(instance ?? [])}\n actions={actions}\n disabled={disabled}/>\n\n </ContentContainer>\n </Container>\n )\n};\n\nexport default HorizontalCard;\n"],"file":"HorizontalCard.js"}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -13,7 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
11
|
|
|
14
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
13
|
|
|
16
|
-
var _react =
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
15
|
|
|
18
16
|
var _Button = require("../../Button");
|
|
19
17
|
|
|
@@ -27,10 +25,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
27
25
|
|
|
28
26
|
var _templateObject;
|
|
29
27
|
|
|
30
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
28
|
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n"])));
|
|
35
29
|
|
|
36
30
|
var HorizontalCardActions = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
@@ -50,7 +44,7 @@ var HorizontalCardActions = /*#__PURE__*/_react.default.forwardRef(function (_re
|
|
|
50
44
|
}));
|
|
51
45
|
}, [length]);
|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
_react.default.useImperativeHandle(ref, function () {
|
|
54
48
|
return elRefs;
|
|
55
49
|
}, [elRefs]);
|
|
56
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Card/HorizontalCard/HorizontalCardActions.tsx"],"names":["Container","styled","div","HorizontalCardActions","React","forwardRef","ref","actions","disabled","useState","elRefs","setElRefs","length","useEffect","Array","fill","map","createRef","renderAction","item","index","componentType","action","icon","active","onChange","defaultState","activeState","items","itemsType","onClick","actionIcon","actionLabel","actionVariant","actionLoading","multiSelect","scrollable","pinTopItem","maxHeight"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/Card/HorizontalCard/HorizontalCardActions.tsx"],"names":["Container","styled","div","HorizontalCardActions","React","forwardRef","ref","actions","disabled","useState","elRefs","setElRefs","length","useEffect","Array","fill","map","createRef","useImperativeHandle","renderAction","item","index","componentType","action","icon","active","onChange","defaultState","activeState","items","itemsType","onClick","actionIcon","actionLabel","actionVariant","actionLoading","multiSelect","scrollable","pinTopItem","maxHeight"],"mappings":";;;;;;;;;;;;;AAAA;;AAOA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,SAAS,GAAGC,0BAAOC,GAAV,uGAAf;;AAMO,IAAMC,qBAAqB,gBAAGC,eAAMC,UAAN,CAAiB,gBACCC,GADD,EAC0D;AAAA,MADxDC,OACwD,QADxDA,OACwD;AAAA,MAD/CC,QAC+C,QAD/CA,QAC+C;;AAE9G,wBAA4BJ,eAAMK,QAAN,CAAqD,EAArD,CAA5B;AAAA;AAAA,MAAOC,MAAP;AAAA,MAAeC,SAAf;;AACA,MAAMC,MAAM,GAAG,CAAAL,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEK,MAAT,KAAmB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;AACf,8BAAO,qBAAC,wBAAD;AAAgB,YAAA,GAAG,EAAEX,MAAM,CAACW,KAAD,CAA3B;AAEgB,YAAA,IAAI,EAAE,MAFtB;AAGgB,YAAA,KAAK,EAAED,IAAI,CAACS,KAH5B;AAIgB,YAAA,SAAS,EAAET,IAAI,CAACU,SAJhC;AAKgB,YAAA,OAAO,EAAEV,IAAI,CAACW,OAL9B;AAMgB,YAAA,IAAI,EAAEX,IAAI,CAACI,IAN3B;AAOgB,YAAA,MAAM,EAAEJ,IAAI,CAACG,MAP7B;AAQgB,YAAA,UAAU,EAAEH,IAAI,CAACY,UARjC;AASgB,YAAA,WAAW,EAAEZ,IAAI,CAACa,WATlC;AAUgB,YAAA,aAAa,EAAEb,IAAI,CAACc,aAVpC;AAWgB,YAAA,aAAa,EAAEd,IAAI,CAACe,aAXpC;AAYgB,YAAA,WAAW,EAAEf,IAAI,CAACgB,WAZlC;AAagB,YAAA,UAAU,EAAEhB,IAAI,CAACiB,UAbjC;AAcgB,YAAA,UAAU,EAAEjB,IAAI,CAACkB,UAdjC;AAegB,YAAA,SAAS,EAAElB,IAAI,CAACmB,SAfhC;AAgBgB,YAAA,QAAQ,qBAAEnB,IAAI,CAACZ,QAAP,6DAAmBA;AAhB3C,aACqBa,KADrB,CAAP;AAiBD;AAvCH;AAyCD,GA3CD;;AA8CA,sBACE;AAAA,cAEI,CAAAd,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEK,MAAT,kBACA,qBAAC,SAAD;AAAA,gBACGL,OADH,aACGA,OADH,uBACGA,OAAO,CAAES,GAAT,CAAa,UAACI,IAAD,EAAOC,KAAP;AAAA,eAAiBF,YAAY,CAACC,IAAD,EAAOC,KAAP,CAA7B;AAAA,OAAb;AADH;AAHJ,IADF;AAUD,CApEoC,CAA9B","sourcesContent":["import React from 'react';\nimport {\n HorizontalCardDropdownButton,\n HorizontalCardIconButton,\n HorizontalCardProps,\n HorizontalCardToggleButton\n} from './types';\nimport {IconButton} from '../../Button';\nimport {ToggleButton} from '../../Toggles';\nimport {DropdownButton} from '../../Dropdown';\nimport styled from 'styled-components';\n\nconst Container = styled.div`\n display: flex;\n`;\n\ntype Props = Pick<HorizontalCardProps, 'actions' | 'disabled'>;\n\nexport const HorizontalCardActions = React.forwardRef(({actions, disabled}: Props,\n ref: React.Ref<React.RefObject<HTMLButtonElement>[]>) => {\n\n const [elRefs, setElRefs] = React.useState<React.RefObject<HTMLButtonElement>[]>([]);\n const length = actions?.length || 0;\n\n React.useEffect(() => {\n setElRefs(Array(length || 0).fill(null).map(() => React.createRef<HTMLButtonElement>()));\n }, [length]);\n\n React.useImperativeHandle(ref, () => elRefs, [elRefs]);\n\n const renderAction = (item: HorizontalCardIconButton | HorizontalCardToggleButton | HorizontalCardDropdownButton,\n index: number) => {\n switch (item.componentType) {\n case 'icon': {\n return <IconButton ref={elRefs[index]}\n key={index}\n variant={'secondary'}\n useTransparentBackground={true}\n shape={'circular'}\n action={item.action}\n disabled={item.disabled ?? disabled}>\n {item.icon}\n </IconButton>\n }\n case 'toggle': {\n return <ToggleButton ref={elRefs[index]}\n key={index}\n active={item.active}\n onChange={item.onChange}\n defaultState={item.defaultState}\n activeState={item.activeState}\n disabled={item.disabled ?? disabled}/>\n }\n case 'dropdown': {\n return <DropdownButton ref={elRefs[index]}\n key={index}\n type={'icon'}\n items={item.items}\n itemsType={item.itemsType}\n onClick={item.onClick}\n icon={item.icon}\n action={item.action}\n actionIcon={item.actionIcon}\n actionLabel={item.actionLabel}\n actionVariant={item.actionVariant}\n actionLoading={item.actionLoading}\n multiSelect={item.multiSelect}\n scrollable={item.scrollable}\n pinTopItem={item.pinTopItem}\n maxHeight={item.maxHeight}\n disabled={item.disabled ?? disabled}/>\n }\n }\n }\n\n\n return (\n <>\n {\n actions?.length &&\n <Container>\n {actions?.map((item, index) => renderAction(item, index))}\n </Container>\n }\n </>\n )\n});\n"],"file":"HorizontalCardActions.cjs"}
|
|
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
|
|
|
3
3
|
|
|
4
4
|
var _templateObject;
|
|
5
5
|
|
|
6
|
-
import React
|
|
6
|
+
import React from 'react';
|
|
7
7
|
import { IconButton } from '../../Button';
|
|
8
8
|
import { ToggleButton } from '../../Toggles';
|
|
9
9
|
import { DropdownButton } from '../../Dropdown';
|
|
@@ -26,7 +26,7 @@ export var HorizontalCardActions = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
|
26
26
|
return /*#__PURE__*/React.createRef();
|
|
27
27
|
}));
|
|
28
28
|
}, [length]);
|
|
29
|
-
useImperativeHandle(ref, function () {
|
|
29
|
+
React.useImperativeHandle(ref, function () {
|
|
30
30
|
return elRefs;
|
|
31
31
|
}, [elRefs]);
|
|
32
32
|
|