@laerdal/life-react-components 1.9.8-dev.9.full → 1.9.9-dev.2
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/ContentAccordion.cjs +5 -5
- package/dist/Accordion/ContentAccordion.cjs.map +1 -1
- package/dist/Accordion/ContentAccordion.js +6 -6
- package/dist/Accordion/ContentAccordion.js.map +1 -1
- package/dist/Accordion/styles.cjs +1 -1
- package/dist/Accordion/styles.cjs.map +1 -1
- package/dist/Accordion/styles.js +1 -1
- package/dist/Accordion/styles.js.map +1 -1
- package/dist/Button/Button.cjs +3 -3
- package/dist/Button/Button.cjs.map +1 -1
- package/dist/Button/Button.js +3 -3
- package/dist/Button/Button.js.map +1 -1
- package/dist/Button/Iconbutton.cjs +2 -1
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.d.ts +1 -0
- package/dist/Button/Iconbutton.js +1 -1
- package/dist/Button/Iconbutton.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/VerticalCard/Card.cjs +1 -0
- package/dist/Card/VerticalCard/Card.cjs.map +1 -1
- package/dist/Card/VerticalCard/Card.js +1 -0
- package/dist/Card/VerticalCard/Card.js.map +1 -1
- package/dist/Card/VerticalCard/CardBottomSection.cjs +2 -0
- package/dist/Card/VerticalCard/CardBottomSection.cjs.map +1 -1
- package/dist/Card/VerticalCard/CardBottomSection.js +2 -0
- package/dist/Card/VerticalCard/CardBottomSection.js.map +1 -1
- package/dist/Card/VerticalCard/CardMiddleSection.cjs +1 -0
- package/dist/Card/VerticalCard/CardMiddleSection.cjs.map +1 -1
- package/dist/Card/VerticalCard/CardMiddleSection.js +1 -0
- package/dist/Card/VerticalCard/CardMiddleSection.js.map +1 -1
- package/dist/Card/VerticalCard/CardTopSection.cjs +3 -0
- package/dist/Card/VerticalCard/CardTopSection.cjs.map +1 -1
- package/dist/Card/VerticalCard/CardTopSection.js +3 -0
- package/dist/Card/VerticalCard/CardTopSection.js.map +1 -1
- package/dist/Dropdown/BasicDropdown.cjs +67 -57
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.d.ts +14 -7
- package/dist/Dropdown/BasicDropdown.js +67 -58
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/GlobalNavigationBar/__tests__/GlobalNavigationBar.tests.d.ts +1 -0
- package/dist/GlobalNavigationBar/__tests__/Logo.tests.d.ts +1 -0
- 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/GlobalNavigationBar/mobile/MobileMenuContent.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs +5 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.d.ts +2 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js +2 -2
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.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/RadioButton.cjs +1 -1
- package/dist/InputFields/RadioButton.cjs.map +1 -1
- package/dist/InputFields/RadioButton.d.ts +1 -1
- package/dist/InputFields/RadioButton.js +1 -1
- package/dist/InputFields/RadioButton.js.map +1 -1
- package/dist/InputFields/TextField.cjs +5 -3
- package/dist/InputFields/TextField.cjs.map +1 -1
- package/dist/InputFields/TextField.d.ts +2 -1
- package/dist/InputFields/TextField.js +5 -4
- package/dist/InputFields/TextField.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/MenuItem/MenuItem.cjs +5 -3
- package/dist/MenuItem/MenuItem.cjs.map +1 -1
- package/dist/MenuItem/MenuItem.js +5 -3
- package/dist/MenuItem/MenuItem.js.map +1 -1
- package/dist/Popover/Popover.cjs +38 -24
- package/dist/Popover/Popover.cjs.map +1 -1
- package/dist/Popover/Popover.d.ts +1 -0
- package/dist/Popover/Popover.js +38 -24
- package/dist/Popover/Popover.js.map +1 -1
- package/dist/ProfileButton/ProfileButton.cjs +5 -3
- package/dist/ProfileButton/ProfileButton.cjs.map +1 -1
- package/dist/ProfileButton/ProfileButton.d.ts +3 -0
- package/dist/ProfileButton/ProfileButton.js +2 -2
- package/dist/ProfileButton/ProfileButton.js.map +1 -1
- package/dist/Toggles/ToggleSwitch.cjs +24 -17
- package/dist/Toggles/ToggleSwitch.cjs.map +1 -1
- package/dist/Toggles/ToggleSwitch.d.ts +5 -1
- package/dist/Toggles/ToggleSwitch.js +21 -12
- package/dist/Toggles/ToggleSwitch.js.map +1 -1
- package/dist/Toggles/TogglerTypes.d.ts +1 -1
- package/package.json +2 -1
|
@@ -21,6 +21,7 @@ declare type PopoverProps = {
|
|
|
21
21
|
children: React.ReactNode;
|
|
22
22
|
position: Position.Top | Position.Bottom | Position.Right | Position.Left;
|
|
23
23
|
showOnClick: boolean;
|
|
24
|
+
showArrowPointer?: boolean;
|
|
24
25
|
};
|
|
25
26
|
declare const Popover: React.FunctionComponent<PopoverProps>;
|
|
26
27
|
export default Popover;
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -13,43 +13,35 @@ import { BOXSHADOWS, ComponentLStyling, ComponentMStyling, ComponentSStyling, Co
|
|
|
13
13
|
import { Position, Size } from '../types';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", ";\n width: ", ";\n border-radius: 4px;\n background: ", ";\n cursor: default;\n box-shadow: ", ";\n\n position: absolute; \n visibility: hidden;\n opacity: 0;\n z-index: ", ";\n\n ", "\n ", "\n\n ", "\n ", "\n\n &::after {\n
|
|
16
|
+
var Container = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n //height: ", ";\n min-width: ", ";\n border-radius: 4px;\n background: ", ";\n cursor: default;\n box-shadow: ", ";\n\n position: absolute; \n visibility: hidden;\n opacity: 0;\n z-index: ", ";\n\n ", "\n ", "\n\n ", "\n ", "\n\n &::after {\n ", "\n"])), function (props) {
|
|
17
17
|
return props.size === Size.Small ? '240px' : props.size === Size.Large ? '480px' : '360px';
|
|
18
18
|
}, function (props) {
|
|
19
|
-
return props.size === Size.Small ? '
|
|
19
|
+
return props.size === Size.Small ? '320px' : props.size === Size.Large ? '640px' : '480px';
|
|
20
20
|
}, COLORS.white, BOXSHADOWS.BOXSHADOW_CENTERED, Z_INDEXES.popover, function (props) {
|
|
21
|
-
return props.position == Position.Bottom ? 'right: 50%; top: calc(100% +
|
|
22
|
-
}, function (props) {
|
|
23
|
-
return props.position == Position.Top ? 'right: 50%; bottom: calc(100% + 8px); transform: translateX(50%);' : '';
|
|
21
|
+
return props.position == Position.Bottom ? 'right: 50%; top: calc(100% + 16px); transform: translateX(50%);' : '';
|
|
24
22
|
}, function (props) {
|
|
25
|
-
return props.position == Position.
|
|
23
|
+
return props.position == Position.Top ? 'right: 50%; bottom: calc(100% + 16px); transform: translateX(50%);' : '';
|
|
26
24
|
}, function (props) {
|
|
27
|
-
return props.position == Position.
|
|
28
|
-
}, COLORS.white, function (props) {
|
|
29
|
-
return props.position == Position.Bottom ? 'right: 50%; bottom: 100%; transform: translateY(50%) rotate(45deg);' : '';
|
|
25
|
+
return props.position == Position.Left ? 'bottom: 50%; right: calc(100% + 16px); transform: translateY(50%);' : '';
|
|
30
26
|
}, function (props) {
|
|
31
|
-
return props.position == Position.
|
|
27
|
+
return props.position == Position.Right ? 'bottom: 50%; left: calc(100% + 16px); transform: translateY(50%);' : '';
|
|
32
28
|
}, function (props) {
|
|
33
|
-
return props.
|
|
34
|
-
}, function (props) {
|
|
35
|
-
return props.position == Position.Right ? 'bottom: 50%; right: 100%; transform: translateX(50%) rotate(45deg);' : '';
|
|
29
|
+
return props.showArrowPointer ? renderArrowStyles(props.position) : '';
|
|
36
30
|
});
|
|
37
|
-
var TopContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: ", ";\n width: ", ";\n display: flex;\n"])), function (props) {
|
|
31
|
+
var TopContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: ", ";\n max-width: ", ";\n display: flex;\n"])), function (props) {
|
|
38
32
|
return props.size === Size.Small ? '56px' : props.size === Size.Large ? '72px' : '64px';
|
|
39
33
|
}, function (props) {
|
|
40
34
|
return props.size === Size.Small ? '344px' : props.size === Size.Large ? '624px' : '464px';
|
|
41
35
|
});
|
|
42
|
-
var MainContentWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
var MiddleContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: ", ";\n width: ", ";\n padding-right: ", ";\n overflow-y: auto;\n ", "\n"])), function (props) {
|
|
36
|
+
var MainContentWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: 8px;\n"])));
|
|
37
|
+
var MiddleContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: ", ";\n max-width: ", ";\n padding: ", ";\n overflow-y: auto;\n ", "\n"])), function (props) {
|
|
46
38
|
return props.size === Size.Small ? '104px' : props.size === Size.Large ? '304px' : '208px';
|
|
47
39
|
}, function (props) {
|
|
48
40
|
return props.size === Size.Small ? '312px' : props.size === Size.Large ? '576px' : '424px';
|
|
49
41
|
}, function (props) {
|
|
50
|
-
return props.size === Size.Small ? '
|
|
42
|
+
return props.size === Size.Small ? '0 8px' : props.size === Size.Large ? '0 16px' : '0 12px';
|
|
51
43
|
}, scrollBarStyling(Size.Small));
|
|
52
|
-
var BottomContainer = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n height: ", ";\n width: ", ";\n display: flex;\n\n .bottom-flex {\n flex: 1;\n }\n"])), function (props) {
|
|
44
|
+
var BottomContainer = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n height: ", ";\n max-width: ", ";\n display: flex;\n\n .bottom-flex {\n flex: 1;\n }\n"])), function (props) {
|
|
53
45
|
return props.size === Size.Small ? '64px' : props.size === Size.Large ? '88px' : '72px';
|
|
54
46
|
}, function (props) {
|
|
55
47
|
return props.size === Size.Small ? '344px' : props.size === Size.Large ? '624px' : '464px';
|
|
@@ -73,9 +65,9 @@ var IconButtonContainer = styled.div(_templateObject11 || (_templateObject11 = _
|
|
|
73
65
|
return props.size === Size.Small ? '8px 16px 8px 0' : props.size === Size.Large ? '16px 24px 16px 0' : '12px 20px 12px 0';
|
|
74
66
|
});
|
|
75
67
|
var Wrapper = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n position: relative;\n\n .pointer-space {\n height: ", ";\n width: ", ";\n position: absolute;\n\n ", ";\n ", ";\n\n ", ";\n ", ";\n }\n\n ", "\n"])), function (props) {
|
|
76
|
-
return props.position === Position.Top || props.position === Position.Bottom ? '
|
|
68
|
+
return props.position === Position.Top || props.position === Position.Bottom ? '16px' : '100%';
|
|
77
69
|
}, function (props) {
|
|
78
|
-
return props.position === Position.Left || props.position === Position.Right ? '
|
|
70
|
+
return props.position === Position.Left || props.position === Position.Right ? '16px' : '100%';
|
|
79
71
|
}, function (props) {
|
|
80
72
|
return props.position === Position.Left ? 'right:100%; bottom: 0%' : '';
|
|
81
73
|
}, function (props) {
|
|
@@ -96,6 +88,24 @@ var renderMargins = function renderMargins(isNotePresent, size) {
|
|
|
96
88
|
}
|
|
97
89
|
};
|
|
98
90
|
|
|
91
|
+
var renderArrowStyles = function renderArrowStyles(position) {
|
|
92
|
+
if (position === Position.Bottom) {
|
|
93
|
+
return "height: 0px;\n width: 0px;\n border-top: 16px solid transparent;\n border-right: 12px solid transparent;\n border-bottom: 16px solid rgb(255,255,255);\n border-left: 12px solid transparent;\n content: \"\";\n position: absolute;\n right: calc(50% - 12px);\n bottom: calc(100% - 1px);";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (position === Position.Top) {
|
|
97
|
+
return "height: 0px;\n width: 0px;\n border-top: 16px solid rgb(255,255,255);\n border-right: 12px solid transparent;\n border-bottom: 16px solid transparent;\n border-left: 12px solid transparent;\n content: \"\";\n position: absolute;\n right: calc(50% - 12px);\n top: calc(100% - 1px);";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (position === Position.Left) {
|
|
101
|
+
return "height: 0px;\n width: 0px;\n border-top: 12px solid transparent;\n border-right: 16px solid transparent;\n border-bottom: 12px solid transparent;\n border-left: 16px solid rgb(255,255,255);\n content: \"\";\n position: absolute;\n left: calc(100% - 1px);\n bottom: calc(50% - 12px);";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (position === Position.Right) {
|
|
105
|
+
return "height: 0px;\n width: 0px;\n border-top: 12px solid transparent;\n border-right: 16px solid rgb(255,255,255);\n border-bottom: 12px solid transparent;\n border-left: 16px solid transparent;\n content: \"\";\n position: absolute;\n right: calc(100% - 1px);\n bottom: calc(50% - 12px);";
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
99
109
|
var Popover = function Popover(_ref) {
|
|
100
110
|
var _bottomSectionProps$t, _bottomSectionProps$i;
|
|
101
111
|
|
|
@@ -107,7 +117,9 @@ var Popover = function Popover(_ref) {
|
|
|
107
117
|
children = _ref.children,
|
|
108
118
|
position = _ref.position,
|
|
109
119
|
_ref$showOnClick = _ref.showOnClick,
|
|
110
|
-
showOnClick = _ref$showOnClick === void 0 ? false : _ref$showOnClick
|
|
120
|
+
showOnClick = _ref$showOnClick === void 0 ? false : _ref$showOnClick,
|
|
121
|
+
_ref$showArrowPointer = _ref.showArrowPointer,
|
|
122
|
+
showArrowPointer = _ref$showArrowPointer === void 0 ? false : _ref$showArrowPointer;
|
|
111
123
|
|
|
112
124
|
var _React$useState = React.useState(false),
|
|
113
125
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -135,6 +147,7 @@ var Popover = function Popover(_ref) {
|
|
|
135
147
|
size: size,
|
|
136
148
|
position: position,
|
|
137
149
|
ref: popoverRef,
|
|
150
|
+
showArrowPointer: showArrowPointer,
|
|
138
151
|
children: [!!topSectionProps && /*#__PURE__*/_jsxs(TopContainer, {
|
|
139
152
|
size: size,
|
|
140
153
|
children: [/*#__PURE__*/_jsxs(TextContainer, {
|
|
@@ -225,7 +238,8 @@ Popover.propTypes = {
|
|
|
225
238
|
}),
|
|
226
239
|
mainContent: _pt.node.isRequired,
|
|
227
240
|
children: _pt.node.isRequired,
|
|
228
|
-
showOnClick: _pt.bool.isRequired
|
|
241
|
+
showOnClick: _pt.bool.isRequired,
|
|
242
|
+
showArrowPointer: _pt.bool
|
|
229
243
|
};
|
|
230
244
|
export default Popover;
|
|
231
245
|
//# sourceMappingURL=Popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Popover/Popover.tsx"],"names":["React","styled","COLORS","ComponentTextStyle","ComponentXSStyling","Button","IconButton","SystemIcons","BOXSHADOWS","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentXXSStyling","scrollBarStyling","Z_INDEXES","Position","Size","Container","div","props","size","Small","Large","white","BOXSHADOW_CENTERED","popover","position","Bottom","Top","Left","Right","TopContainer","MainContentWrapper","MiddleContainer","BottomContainer","TextContainer","renderMargins","note","NoteContainer","Regular","neutral_600","LabelContainer","Bold","CloseButtonContainer","TextButtonContainer","IconButtonContainer","Wrapper","showOnClick","showPopover","isNotePresent","Popover","Medium","topSectionProps","bottomSectionProps","mainContent","children","useState","setShowPopover","popoverRef","useRef","useEffect","checkIfClickedOutside","e","current","contains","target","document","addEventListener","removeEventListener","text","textButton","icon","action","label","iconButtons","map","iconButton"],"mappings":";;;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,MAAT,EAAiBC,kBAAjB,EAAqCC,kBAArC,QAA+D,IAA/D;AACA,SAASC,MAAT,EAAiBC,UAAjB,QAAmC,WAAnC;AACA,SAASC,WAAT,QAA4B,UAA5B;AACA,SAASC,UAAT,EAAqBC,iBAArB,EAAwCC,iBAAxC,EAA2DC,iBAA3D,EAA8EC,mBAA9E,EAAmGC,gBAAnG,EAAqHC,SAArH,QAAsI,WAAtI;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,UAA/B;;;AAEA,IAAMC,SAAS,GAAGhB,MAAM,CAACiB,GAAV,0dACH,UAAAC,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaJ,IAAI,CAACK,KAAlB,GAA0B,OAA1B,GAAqCF,KAAK,CAACC,IAAN,KAAaJ,IAAI,CAACM,KAAlB,GAA0B,OAA1B,GAAoC,OAA3E;AAAA,CADF,EAEJ,UA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AhC,IAAAA,I;;AAiBAgB,EAAAA,kB;AAPAqB,IAAAA,W;AANAH,MAAAA,I;AACAC,MAAAA,M;AACAC,MAAAA,K;;AAKAH,IAAAA,U;AAPAC,MAAAA,I;AACAC,MAAAA,M;AACAC,MAAAA,K;;;AAYAnB,EAAAA,W;AACAC,EAAAA,Q;AAEAR,EAAAA,W;;AAiGF,eAAeG,OAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentTextStyle, ComponentXSStyling } from '..';\nimport { Button, IconButton } from '../Button';\nimport { SystemIcons } from '../icons';\nimport { BOXSHADOWS, ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentXXSStyling, scrollBarStyling, Z_INDEXES } from '../styles';\nimport { Position, Size } from '../types';\n\nconst Container = styled.div<{size: Size, position: Position}>`\n height: ${props=>props.size===Size.Small ? '240px' : (props.size===Size.Large ? '480px' : '360px')};\n width: ${props=>props.size===Size.Small ? '344px' : (props.size===Size.Large ? '624px' : '464px')};\n border-radius: 4px;\n background: ${COLORS.white};\n cursor: default;\n box-shadow: ${BOXSHADOWS.BOXSHADOW_CENTERED};\n\n position: absolute; \n visibility: hidden;\n opacity: 0;\n z-index: ${Z_INDEXES.popover};\n\n ${props => (props.position == Position.Bottom ? 'right: 50%; top: calc(100% + 8px); transform: translateX(50%);' : '')}\n ${props => (props.position == Position.Top ? 'right: 50%; bottom: calc(100% + 8px); transform: translateX(50%);' : '')}\n\n ${props => (props.position == Position.Left ? 'bottom: 50%; right: calc(100% + 8px); transform: translateY(50%);' : '')}\n ${props => (props.position == Position.Right ? 'bottom: 50%; left: calc(100% + 8px); transform: translateY(50%);' : '')}\n\n &::after {\n height: 16px;\n width: 16px;\n content: \"\";\n position: absolute;\n background: ${COLORS.white};\n\n ${props => (props.position == Position.Bottom ? 'right: 50%; bottom: 100%; transform: translateY(50%) rotate(45deg);' : '')}\n ${props => (props.position == Position.Top ? 'right: 50%; top: 100%; transform: translateY(-50%) rotate(45deg);' : '')}\n\n ${props => (props.position == Position.Left ? 'bottom: 50%; left: 100%; transform: translateX(-50%) rotate(45deg);' : '')}\n ${props => (props.position == Position.Right ? 'bottom: 50%; right: 100%; transform: translateX(50%) rotate(45deg);' : '')}\n`;\n\nconst TopContainer = styled.div<{size: Size}>`\n height: ${props=>props.size===Size.Small ? '56px' : (props.size===Size.Large ? '72px' : '64px')};\n width: ${props=>props.size===Size.Small ? '344px' : (props.size===Size.Large ? '624px' : '464px')};\n display: flex;\n`;\n\nconst MainContentWrapper = styled.div<{size: Size}>`\n padding: ${props=>props.size===Size.Small ? '8px 0 8px 16px' : (props.size===Size.Large ? '8px 0 8px 24px' : '8px 0 8px 20px')};\n`;\n\nconst MiddleContainer = styled.div<{size: Size}>`\n height: ${props=>props.size===Size.Small ? '104px' : (props.size===Size.Large ? '304px' : '208px')};\n width: ${props=>props.size===Size.Small ? '312px' : (props.size===Size.Large ? '576px' : '424px')};\n padding-right: ${props=>props.size===Size.Small ? '6px' : (props.size===Size.Large ? '14px' : '10px')};\n overflow-y: auto;\n ${scrollBarStyling(Size.Small)}\n`;\n\nconst BottomContainer = styled.div<{size: Size}>`\n height: ${props=>props.size===Size.Small ? '64px' : (props.size===Size.Large ? '88px' : '72px')};\n width: ${props=>props.size===Size.Small ? '344px' : (props.size===Size.Large ? '624px' : '464px')};\n display: flex;\n\n .bottom-flex {\n flex: 1;\n }\n`;\n\nconst TextContainer = styled.div<{note: boolean, size: Size}>`\n display: flex;\n flex-direction: column;\n margin: ${props=>renderMargins(props.note, props.size)};\n flex-grow: 1;\n`;\n\nconst NoteContainer = styled.div<{size: Size}>`\n ${props=>props.size===Size.Small ? ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600) : (props.size===Size.Large ? ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600) : ComponentXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600))}\n`;\n\nconst LabelContainer = styled.div<{size: Size}>`\n ${props=>props.size===Size.Small ? ComponentSStyling(ComponentTextStyle.Bold, null) : (props.size===Size.Large ? ComponentLStyling(ComponentTextStyle.Bold, null) : ComponentMStyling(ComponentTextStyle.Bold, null))}\n`;\n\nconst CloseButtonContainer = styled.div<{size: Size}>`\n margin: ${props=>props.size===Size.Small ? '4px 16px 4px 0' : (props.size===Size.Large ? '12px 24px 12px 0' : '8px 20px 8px 0')};\n`;\n\nconst TextButtonContainer = styled.div<{size: Size}>`\n margin: ${props=>props.size===Size.Small ? '8px 0 8px 16px' : (props.size===Size.Large ? '16px 0 16px 24px' : '12px 0 12px 20px')};\n`;\n\nconst IconButtonContainer = styled.div<{size: Size}>`\n margin: ${props=>props.size===Size.Small ? '8px 16px 8px 0' : (props.size===Size.Large ? '16px 24px 16px 0' : '12px 20px 12px 0')};\n display: flex;\n`;\n\nconst Wrapper = styled.div<{position: Position, showOnClick: boolean, showPopover: boolean}>`\n position: relative;\n\n .pointer-space {\n height: ${props=>props.position===Position.Top || props.position===Position.Bottom ? '8px' : '100%'};\n width: ${props=>props.position===Position.Left || props.position===Position.Right ? '8px' : '100%'};\n position: absolute;\n\n ${props=>props.position===Position.Left ? 'right:100%; bottom: 0%' : ''};\n ${props=>props.position===Position.Right ? 'left:100%; bottom: 0%' : ''};\n\n ${props=>props.position===Position.Top ? 'bottom: 100%' : ''};\n ${props=>props.position===Position.Bottom ? 'top: 100%' : ''};\n }\n\n ${props=>props.showOnClick ? \n `${Container} {\n visibility: ${props.showPopover ? 'visible' : 'hidden'};\n opacity: ${props.showPopover ? '1' : '0'};\n }\n cursor: pointer;` \n : \n `&:hover {\n ${Container} {\n visibility: visible;\n opacity: 1;\n }\n }`\n }\n`;\n\nconst renderMargins = (isNotePresent: boolean, size: Size): string => {\n if(isNotePresent){\n return (size===Size.Small ? '10px 16px' : (size===Size.Large ? '14px 24px' : '12px 20px'));\n }\n else{\n return (size===Size.Small ? '18px 16px' : (size===Size.Large ? '24px' : '20px'));\n }\n}\n\ntype topSectionProps = {\n text: string;\n note?: string;\n}\n\ntype actionButtonProps = {\n icon: React.ReactNode;\n action: ()=>void;\n label?: string;\n}\n\ntype bottomSectionProps = {\n iconButtons?: actionButtonProps[];\n textButton?: actionButtonProps;\n}\n\ntype PopoverProps = {\n size?: Size.Small | Size.Medium | Size.Large;\n topSectionProps?: topSectionProps;\n bottomSectionProps?: bottomSectionProps;\n mainContent: React.ReactNode;\n children: React.ReactNode;\n position: Position.Top | Position.Bottom | Position.Right | Position.Left;\n showOnClick: boolean;\n}\n\nconst Popover: React.FunctionComponent<PopoverProps> = \n({\n size=Size.Medium,\n topSectionProps,\n bottomSectionProps,\n mainContent,\n children,\n position,\n showOnClick=false\n}) => {\n\n const [showPopover, setShowPopover] = React.useState(false);\n const popoverRef = React.useRef<any>();\n\n React.useEffect(()=>{\n const checkIfClickedOutside = (e: { target: any; }) => {\n if (showPopover && popoverRef.current && !popoverRef.current.contains(e.target)) {\n setShowPopover(false);\n }\n }\n\n document.addEventListener(\"mousedown\", checkIfClickedOutside)\n\n return () => {\n document.removeEventListener(\"mousedown\", checkIfClickedOutside)\n }\n },[showPopover]);\n\n return (\n <Wrapper position={position} showOnClick={showOnClick} showPopover={showPopover}>\n <Container size={size} position={position} ref={popoverRef}>\n {!!topSectionProps && \n <TopContainer size={size}>\n <TextContainer note={!!topSectionProps?.note} size={size}>\n {topSectionProps?.note && \n <NoteContainer size={size}>\n {topSectionProps.note}\n </NoteContainer>\n }\n <LabelContainer size={size}>\n {topSectionProps?.text}\n </LabelContainer>\n </TextContainer>\n\n {showOnClick && \n <CloseButtonContainer size={size} data-testid={'closeBtn'}>\n <IconButton action={()=>setShowPopover(false)} useTransparentBackground iconColor={COLORS.neutral_600} variant='secondary' shape='circular'>\n <SystemIcons.Close />\n </IconButton>\n </CloseButtonContainer>\n }\n </TopContainer>\n }\n\n <MainContentWrapper size={size}>\n <MiddleContainer size={size}>\n {mainContent}\n </MiddleContainer>\n </MainContentWrapper>\n\n {!!bottomSectionProps && \n <BottomContainer size={size}>\n {!!bottomSectionProps?.textButton?.icon && \n <TextButtonContainer size={size} data-testid={'textBtn'}>\n <Button size={size} variant='secondary' icon={bottomSectionProps.textButton.icon} onClick={bottomSectionProps.textButton.action}>\n {bottomSectionProps.textButton.label}\n </Button>\n </TextButtonContainer>\n }\n\n <div className='bottom-flex'/>\n \n <IconButtonContainer size={size} data-testid={'iconBtn'}>\n {bottomSectionProps?.iconButtons?.map((iconButton) =>\n \n <IconButton action={iconButton.action} variant='secondary' shape='circular' useTransparentBackground>\n {iconButton.icon}\n </IconButton> \n )}\n </IconButtonContainer>\n </BottomContainer>\n }\n </Container>\n\n <div onClick={()=>showOnClick && setShowPopover(!showPopover)}>\n {children}\n\n <div className='pointer-space'/>\n </div>\n\n </Wrapper>\n );\n};\n\nexport default Popover;"],"file":"Popover.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/Popover/Popover.tsx"],"names":["React","styled","COLORS","ComponentTextStyle","ComponentXSStyling","Button","IconButton","SystemIcons","BOXSHADOWS","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentXXSStyling","scrollBarStyling","Z_INDEXES","Position","Size","Container","div","props","size","Small","Large","white","BOXSHADOW_CENTERED","popover","position","Bottom","Top","Left","Right","showArrowPointer","renderArrowStyles","TopContainer","MainContentWrapper","MiddleContainer","BottomContainer","TextContainer","renderMargins","note","NoteContainer","Regular","neutral_600","LabelContainer","Bold","CloseButtonContainer","TextButtonContainer","IconButtonContainer","Wrapper","showOnClick","showPopover","isNotePresent","Popover","Medium","topSectionProps","bottomSectionProps","mainContent","children","useState","setShowPopover","popoverRef","useRef","useEffect","checkIfClickedOutside","e","current","contains","target","document","addEventListener","removeEventListener","text","textButton","icon","action","label","iconButtons","map","iconButton"],"mappings":";;;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,MAAT,EAAiBC,kBAAjB,EAAqCC,kBAArC,QAA+D,IAA/D;AACA,SAASC,MAAT,EAAi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ApG;AAAA,wBACGI,UAAU,CAACL;AADd,cAFkC;AAAA,WAArC;AADH,UAXF;AAAA,QA/BJ;AAAA,MADF,eAuDE;AAAK,MAAA,OAAO,EAAE;AAAA,eAAIxB,WAAW,IAAIU,cAAc,CAAC,CAACT,WAAF,CAAjC;AAAA,OAAd;AAAA,iBACGO,QADH,eAGE;AAAK,QAAA,SAAS,EAAC;AAAf,QAHF;AAAA,MAvDF;AAAA,IADF;AAgED,CA7FD;;;AATEH,EAAAA,e;AAjBAiB,IAAAA,I;AACAhC,IAAAA,I;;AAiBAgB,EAAAA,kB;AAPAqB,IAAAA,W;AANAH,MAAAA,I;AACAC,MAAAA,M;AACAC,MAAAA,K;;AAKAH,IAAAA,U;AAPAC,MAAAA,I;AACAC,MAAAA,M;AACAC,MAAAA,K;;;AAYAnB,EAAAA,W;AACAC,EAAAA,Q;AAEAR,EAAAA,W;AACAlB,EAAAA,gB;;AAkGF,eAAeqB,OAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { COLORS, ComponentTextStyle, ComponentXSStyling } from '..';\nimport { Button, IconButton } from '../Button';\nimport { SystemIcons } from '../icons';\nimport { BOXSHADOWS, ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentXXSStyling, scrollBarStyling, Z_INDEXES } from '../styles';\nimport { Position, Size } from '../types';\n\nconst Container = styled.div<{size: Size, position: Position, showArrowPointer: boolean}>`\n //height: ${props=>props.size===Size.Small ? '240px' : (props.size===Size.Large ? '480px' : '360px')};\n min-width: ${props=>props.size===Size.Small ? '320px' : (props.size===Size.Large ? '640px' : '480px')};\n border-radius: 4px;\n background: ${COLORS.white};\n cursor: default;\n box-shadow: ${BOXSHADOWS.BOXSHADOW_CENTERED};\n\n position: absolute; \n visibility: hidden;\n opacity: 0;\n z-index: ${Z_INDEXES.popover};\n\n ${props => (props.position == Position.Bottom ? 'right: 50%; top: calc(100% + 16px); transform: translateX(50%);' : '')}\n ${props => (props.position == Position.Top ? 'right: 50%; bottom: calc(100% + 16px); transform: translateX(50%);' : '')}\n\n ${props => (props.position == Position.Left ? 'bottom: 50%; right: calc(100% + 16px); transform: translateY(50%);' : '')}\n ${props => (props.position == Position.Right ? 'bottom: 50%; left: calc(100% + 16px); transform: translateY(50%);' : '')}\n\n &::after {\n ${props => props.showArrowPointer ? renderArrowStyles(props.position) : ''}\n`;\n\nconst TopContainer = styled.div<{size: Size}>`\n height: ${props=>props.size===Size.Small ? '56px' : (props.size===Size.Large ? '72px' : '64px')};\n max-width: ${props=>props.size===Size.Small ? '344px' : (props.size===Size.Large ? '624px' : '464px')};\n display: flex;\n`;\n\nconst MainContentWrapper = styled.div<{size: Size}>`\n margin: 8px;\n`;\n\nconst MiddleContainer = styled.div<{size: Size}>`\n height: ${props=>props.size===Size.Small ? '104px' : (props.size===Size.Large ? '304px' : '208px')};\n max-width: ${props=>props.size===Size.Small ? '312px' : (props.size===Size.Large ? '576px' : '424px')};\n padding: ${props=>props.size===Size.Small ? '0 8px' : (props.size===Size.Large ? '0 16px' : '0 12px')};\n overflow-y: auto;\n ${scrollBarStyling(Size.Small)}\n`;\n\nconst BottomContainer = styled.div<{size: Size}>`\n height: ${props=>props.size===Size.Small ? '64px' : (props.size===Size.Large ? '88px' : '72px')};\n max-width: ${props=>props.size===Size.Small ? '344px' : (props.size===Size.Large ? '624px' : '464px')};\n display: flex;\n\n .bottom-flex {\n flex: 1;\n }\n`;\n\nconst TextContainer = styled.div<{note: boolean, size: Size}>`\n display: flex;\n flex-direction: column;\n margin: ${props=>renderMargins(props.note, props.size)};\n flex-grow: 1;\n`;\n\nconst NoteContainer = styled.div<{size: Size}>`\n ${props=>props.size===Size.Small ? ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600) : (props.size===Size.Large ? ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600) : ComponentXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600))}\n`;\n\nconst LabelContainer = styled.div<{size: Size}>`\n ${props=>props.size===Size.Small ? ComponentSStyling(ComponentTextStyle.Bold, null) : (props.size===Size.Large ? ComponentLStyling(ComponentTextStyle.Bold, null) : ComponentMStyling(ComponentTextStyle.Bold, null))}\n`;\n\nconst CloseButtonContainer = styled.div<{size: Size}>`\n margin: ${props=>props.size===Size.Small ? '4px 16px 4px 0' : (props.size===Size.Large ? '12px 24px 12px 0' : '8px 20px 8px 0')};\n`;\n\nconst TextButtonContainer = styled.div<{size: Size}>`\n margin: ${props=>props.size===Size.Small ? '8px 0 8px 16px' : (props.size===Size.Large ? '16px 0 16px 24px' : '12px 0 12px 20px')};\n`;\n\nconst IconButtonContainer = styled.div<{size: Size}>`\n margin: ${props=>props.size===Size.Small ? '8px 16px 8px 0' : (props.size===Size.Large ? '16px 24px 16px 0' : '12px 20px 12px 0')};\n display: flex;\n`;\n\nconst Wrapper = styled.div<{position: Position, showOnClick: boolean, showPopover: boolean}>`\n position: relative;\n\n .pointer-space {\n height: ${props=>props.position===Position.Top || props.position===Position.Bottom ? '16px' : '100%'};\n width: ${props=>props.position===Position.Left || props.position===Position.Right ? '16px' : '100%'};\n position: absolute;\n\n ${props=>props.position===Position.Left ? 'right:100%; bottom: 0%' : ''};\n ${props=>props.position===Position.Right ? 'left:100%; bottom: 0%' : ''};\n\n ${props=>props.position===Position.Top ? 'bottom: 100%' : ''};\n ${props=>props.position===Position.Bottom ? 'top: 100%' : ''};\n }\n\n ${props=>props.showOnClick ? \n `${Container} {\n visibility: ${props.showPopover ? 'visible' : 'hidden'};\n opacity: ${props.showPopover ? '1' : '0'};\n }\n cursor: pointer;` \n : \n `&:hover {\n ${Container} {\n visibility: visible;\n opacity: 1;\n }\n }`\n }\n`;\n\nconst renderMargins = (isNotePresent: boolean, size: Size): string => {\n if(isNotePresent){\n return (size===Size.Small ? '10px 16px' : (size===Size.Large ? '14px 24px' : '12px 20px'));\n }\n else{\n return (size===Size.Small ? '18px 16px' : (size===Size.Large ? '24px' : '20px'));\n }\n}\n\nconst renderArrowStyles = (position: Position) => {\n if(position === Position.Bottom){\n return `height: 0px;\n width: 0px;\n border-top: 16px solid transparent;\n border-right: 12px solid transparent;\n border-bottom: 16px solid rgb(255,255,255);\n border-left: 12px solid transparent;\n content: \"\";\n position: absolute;\n right: calc(50% - 12px);\n bottom: calc(100% - 1px);`\n }\n\n if(position === Position.Top){\n return `height: 0px;\n width: 0px;\n border-top: 16px solid rgb(255,255,255);\n border-right: 12px solid transparent;\n border-bottom: 16px solid transparent;\n border-left: 12px solid transparent;\n content: \"\";\n position: absolute;\n right: calc(50% - 12px);\n top: calc(100% - 1px);`\n }\n\n if(position === Position.Left){\n return `height: 0px;\n width: 0px;\n border-top: 12px solid transparent;\n border-right: 16px solid transparent;\n border-bottom: 12px solid transparent;\n border-left: 16px solid rgb(255,255,255);\n content: \"\";\n position: absolute;\n left: calc(100% - 1px);\n bottom: calc(50% - 12px);`\n }\n\n if(position === Position.Right){\n return `height: 0px;\n width: 0px;\n border-top: 12px solid transparent;\n border-right: 16px solid rgb(255,255,255);\n border-bottom: 12px solid transparent;\n border-left: 16px solid transparent;\n content: \"\";\n position: absolute;\n right: calc(100% - 1px);\n bottom: calc(50% - 12px);`\n }\n}\n\ntype topSectionProps = {\n text: string;\n note?: string;\n}\n\ntype actionButtonProps = {\n icon: React.ReactNode;\n action: ()=>void;\n label?: string;\n}\n\ntype bottomSectionProps = {\n iconButtons?: actionButtonProps[];\n textButton?: actionButtonProps;\n}\n\ntype PopoverProps = {\n size?: Size.Small | Size.Medium | Size.Large;\n topSectionProps?: topSectionProps;\n bottomSectionProps?: bottomSectionProps;\n mainContent: React.ReactNode;\n children: React.ReactNode;\n position: Position.Top | Position.Bottom | Position.Right | Position.Left;\n showOnClick: boolean;\n showArrowPointer?: boolean;\n}\n\nconst Popover: React.FunctionComponent<PopoverProps> = \n({\n size=Size.Medium,\n topSectionProps,\n bottomSectionProps,\n mainContent,\n children,\n position,\n showOnClick=false,\n showArrowPointer=false\n}) => {\n\n const [showPopover, setShowPopover] = React.useState(false);\n const popoverRef = React.useRef<any>();\n\n React.useEffect(()=>{\n const checkIfClickedOutside = (e: { target: any; }) => {\n if (showPopover && popoverRef.current && !popoverRef.current.contains(e.target)) {\n setShowPopover(false);\n }\n }\n\n document.addEventListener(\"mousedown\", checkIfClickedOutside)\n\n return () => {\n document.removeEventListener(\"mousedown\", checkIfClickedOutside)\n }\n },[showPopover]);\n\n return (\n <Wrapper position={position} showOnClick={showOnClick} showPopover={showPopover}>\n <Container size={size} position={position} ref={popoverRef} showArrowPointer={showArrowPointer}>\n {!!topSectionProps && \n <TopContainer size={size}>\n <TextContainer note={!!topSectionProps?.note} size={size}>\n {topSectionProps?.note && \n <NoteContainer size={size}>\n {topSectionProps.note}\n </NoteContainer>\n }\n <LabelContainer size={size}>\n {topSectionProps?.text}\n </LabelContainer>\n </TextContainer>\n\n {showOnClick && \n <CloseButtonContainer size={size} data-testid={'closeBtn'}>\n <IconButton action={()=>setShowPopover(false)} useTransparentBackground iconColor={COLORS.neutral_600} variant='secondary' shape='circular'>\n <SystemIcons.Close />\n </IconButton>\n </CloseButtonContainer>\n }\n </TopContainer>\n }\n\n <MainContentWrapper size={size}>\n <MiddleContainer size={size}>\n {mainContent}\n </MiddleContainer>\n </MainContentWrapper>\n\n {!!bottomSectionProps && \n <BottomContainer size={size}>\n {!!bottomSectionProps?.textButton?.icon && \n <TextButtonContainer size={size} data-testid={'textBtn'}>\n <Button size={size} variant='secondary' icon={bottomSectionProps.textButton.icon} onClick={bottomSectionProps.textButton.action}>\n {bottomSectionProps.textButton.label}\n </Button>\n </TextButtonContainer>\n }\n\n <div className='bottom-flex'/>\n \n <IconButtonContainer size={size} data-testid={'iconBtn'}>\n {bottomSectionProps?.iconButtons?.map((iconButton) =>\n \n <IconButton action={iconButton.action} variant='secondary' shape='circular' useTransparentBackground>\n {iconButton.icon}\n </IconButton> \n )}\n </IconButtonContainer>\n </BottomContainer>\n }\n </Container>\n\n <div onClick={()=>showOnClick && setShowPopover(!showPopover)}>\n {children}\n\n <div className='pointer-space'/>\n </div>\n\n </Wrapper>\n );\n};\n\nexport default Popover;"],"file":"Popover.js"}
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.default = void 0;
|
|
10
|
+
exports.default = exports.ProfileButtonContainer = void 0;
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
@@ -35,10 +35,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
|
|
36
36
|
var PortraitOverlay = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: ", ";\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n"])), _.COLORS.black);
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var ProfileButtonContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ", " {\n display: ", ";\n\n ", " {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ", " {\n background-color: ", ";\n\n svg, svg path {\n fill: ", ";\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ", " {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ", " {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n"])), _Iconbutton.StyledPrimaryIconButton, function (props) {
|
|
39
39
|
return props.hideOnLowWidth ? 'none' : 'inline';
|
|
40
40
|
}, _styles.BREAKPOINTS.MEDIUM, _Iconbutton.IconButtonContent, _.COLORS.neutral_100, _.COLORS.neutral_300, PortraitOverlay, PortraitOverlay);
|
|
41
41
|
|
|
42
|
+
exports.ProfileButtonContainer = ProfileButtonContainer;
|
|
43
|
+
|
|
42
44
|
var NotificationContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n left: 30px;\n bottom: 30px;\n"])));
|
|
43
45
|
|
|
44
46
|
var ImageWrapper = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius: 50%;\n object-fit: cover;\n }\n"])));
|
|
@@ -69,7 +71,7 @@ var ProfileButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
69
71
|
});
|
|
70
72
|
};
|
|
71
73
|
|
|
72
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ProfileButtonContainer, {
|
|
73
75
|
hideOnLowWidth: hideOnLowWidth,
|
|
74
76
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.IconButton, {
|
|
75
77
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["PortraitOverlay","styled","div","COLORS","black","
|
|
1
|
+
{"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["PortraitOverlay","styled","div","COLORS","black","ProfileButtonContainer","StyledPrimaryIconButton","props","hideOnLowWidth","BREAKPOINTS","MEDIUM","IconButtonContent","neutral_100","neutral_300","NotificationContainer","ImageWrapper","ProfileButton","React","forwardRef","ref","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","tabIndex","renderIcon","ComponentTextStyle","Bold","white","Size","Medium"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAcA,IAAMA,eAAe,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BACE,qBAAC,sBAAD;AAAwB,IAAA,cAAc,EAAEb,cAAxC;AAAA,2BACE,sBAAC,YAAD;AAAY,MAAA,GAAG,EAAEW,GAAjB;AACY,MAAA,SAAS,EAAEO,SADvB;AAEY,MAAA,QAAQ,EAAEF,QAFtB;AAGY,MAAA,MAAM,EAAED,OAHpB;AAIY,MAAA,OAAO,EAAC,SAJpB;AAKY,MAAA,QAAQ,EAAEI,QALtB;AAMY,MAAA,KAAK,EAAC,UANlB;AAOY,MAAA,cAAc,EAAEnB,cAP5B;AAAA,iBAQGoB,UAAU,EARb,EASGH,mBAAmB,iBAClB,qBAAC,qBAAD;AAAA,+BACE,qBAAC,gCAAD;AAAiB,UAAA,IAAI,EAAEO,OAAKC,MAA5B;AAAoC,UAAA,OAAO,EAAER;AAA7C;AADF,QAVJ;AAAA;AADF,IADF;AAmBD,CA/CqB,CAAtB;;AAtFEL,EAAAA,W;AACAC,EAAAA,I;AACAC,EAAAA,Q;AACAC,EAAAA,O;AACAC,EAAAA,Q;AACAC,EAAAA,mB,4BAAsB,U,EAAa,U;AACnCC,EAAAA,S;AACAlB,EAAAA,c;AACAmB,EAAAA,Q;;eA+HaX,a","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {COLORS, IconButton, Size} from '..';\nimport {IconButtonContent, StyledPrimaryIconButton} from '../Button/Iconbutton';\nimport {NotificationDot} from '../NotificationDot';\nimport {BREAKPOINTS, ComponentS, ComponentTextStyle} from '../styles';\n\ntype ProfileButtonProps = {\n portraitSrc?: string;\n icon?: React.ReactNode;\n initials?: string;\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n disabled?: boolean;\n notificationVariant?: 'positive' | 'critical';\n className?: string;\n hideOnLowWidth?: boolean;\n tabIndex?: number;\n};\n\nconst PortraitOverlay = styled.div`\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: ${COLORS.black};\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n`;\n\nexport const ProfileButtonContainer = styled.div<{ hideOnLowWidth?: boolean }>`\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ${StyledPrimaryIconButton} {\n display: ${props => (props.hideOnLowWidth ? 'none' : 'inline')};\n\n ${BREAKPOINTS.MEDIUM} {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_100};\n\n svg, svg path {\n fill: ${COLORS.neutral_300};\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ${PortraitOverlay} {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ${PortraitOverlay} {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n`;\n\nconst NotificationContainer = styled.div`\n position: absolute;\n left: 30px;\n bottom: 30px;\n`;\n\nconst ImageWrapper = styled.div`\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius: 50%;\n object-fit: cover;\n }\n`;\n\nconst ProfileButton = React.forwardRef<HTMLButtonElement, ProfileButtonProps>(({\n portraitSrc,\n icon,\n initials,\n onClick,\n hideOnLowWidth,\n disabled,\n notificationVariant,\n className,\n tabIndex\n }, ref) => {\n const renderIcon = () => {\n return (\n (portraitSrc && (\n <ImageWrapper>\n <img src={portraitSrc}/>\n <PortraitOverlay/>\n </ImageWrapper>\n )) ||\n (initials && (\n <ComponentS className=\"initials\" textStyle={ComponentTextStyle.Bold}\n color={disabled ? COLORS.neutral_300 : COLORS.white}>\n {initials}\n </ComponentS>\n )) || <>{icon}</>\n );\n };\n\n return (\n <ProfileButtonContainer hideOnLowWidth={hideOnLowWidth}>\n <IconButton ref={ref}\n className={className}\n disabled={disabled}\n action={onClick}\n variant=\"primary\"\n tabIndex={tabIndex}\n shape=\"circular\"\n hideOnLowWidth={hideOnLowWidth}>\n {renderIcon()}\n {notificationVariant && (\n <NotificationContainer>\n <NotificationDot size={Size.Medium} variant={notificationVariant}/>\n </NotificationContainer>\n )}\n </IconButton>\n </ProfileButtonContainer>\n );\n});\n\nexport default ProfileButton;\n"],"file":"ProfileButton.cjs"}
|
|
@@ -10,5 +10,8 @@ declare type ProfileButtonProps = {
|
|
|
10
10
|
hideOnLowWidth?: boolean;
|
|
11
11
|
tabIndex?: number;
|
|
12
12
|
};
|
|
13
|
+
export declare const ProfileButtonContainer: import("styled-components").StyledComponent<"div", any, {
|
|
14
|
+
hideOnLowWidth?: boolean | undefined;
|
|
15
|
+
}, never>;
|
|
13
16
|
declare const ProfileButton: React.ForwardRefExoticComponent<ProfileButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
17
|
export default ProfileButton;
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
15
|
var PortraitOverlay = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: ", ";\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n"])), COLORS.black);
|
|
16
|
-
var
|
|
16
|
+
export var ProfileButtonContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ", " {\n display: ", ";\n\n ", " {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ", " {\n background-color: ", ";\n\n svg, svg path {\n fill: ", ";\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ", " {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ", " {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n"])), StyledPrimaryIconButton, function (props) {
|
|
17
17
|
return props.hideOnLowWidth ? 'none' : 'inline';
|
|
18
18
|
}, BREAKPOINTS.MEDIUM, IconButtonContent, COLORS.neutral_100, COLORS.neutral_300, PortraitOverlay, PortraitOverlay);
|
|
19
19
|
var NotificationContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n left: 30px;\n bottom: 30px;\n"])));
|
|
@@ -44,7 +44,7 @@ var ProfileButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
return /*#__PURE__*/_jsx(
|
|
47
|
+
return /*#__PURE__*/_jsx(ProfileButtonContainer, {
|
|
48
48
|
hideOnLowWidth: hideOnLowWidth,
|
|
49
49
|
children: /*#__PURE__*/_jsxs(IconButton, {
|
|
50
50
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["React","styled","COLORS","IconButton","Size","IconButtonContent","StyledPrimaryIconButton","NotificationDot","BREAKPOINTS","ComponentS","ComponentTextStyle","PortraitOverlay","div","black","
|
|
1
|
+
{"version":3,"sources":["../../src/ProfileButton/ProfileButton.tsx"],"names":["React","styled","COLORS","IconButton","Size","IconButtonContent","StyledPrimaryIconButton","NotificationDot","BREAKPOINTS","ComponentS","ComponentTextStyle","PortraitOverlay","div","black","ProfileButtonContainer","props","hideOnLowWidth","MEDIUM","neutral_100","neutral_300","NotificationContainer","ImageWrapper","ProfileButton","forwardRef","ref","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","tabIndex","renderIcon","Bold","white","Medium"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,MAAR,EAAgBC,UAAhB,EAA4BC,IAA5B,QAAuC,IAAvC;AACA,SAAQC,iBAAR,EAA2BC,uBAA3B,QAAyD,sBAAzD;AACA,SAAQC,eAAR,QAA8B,oB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AAQ,GAAG3B,MAAM,CAACiB,WAAV,GAAwBjB,MAAM,CAACiC,KAD1D;AAAA,gBAEGR;AAFH,MAPF,iBAWM;AAAA,gBAAGD;AAAH,MAZR;AAcD,GAfD;;AAiBA,sBACE,KAAC,sBAAD;AAAwB,IAAA,cAAc,EAAEV,cAAxC;AAAA,2BACE,MAAC,UAAD;AAAY,MAAA,GAAG,EAAEQ,GAAjB;AACY,MAAA,SAAS,EAAEO,SADvB;AAEY,MAAA,QAAQ,EAAEF,QAFtB;AAGY,MAAA,MAAM,EAAED,OAHpB;AAIY,MAAA,OAAO,EAAC,SAJpB;AAKY,MAAA,QAAQ,EAAEI,QALtB;AAMY,MAAA,KAAK,EAAC,UANlB;AAOY,MAAA,cAAc,EAAEhB,cAP5B;AAAA,iBAQGiB,UAAU,EARb,EASGH,mBAAmB,iBAClB,KAAC,qBAAD;AAAA,+BACE,KAAC,eAAD;AAAiB,UAAA,IAAI,EAAE1B,IAAI,CAACgC,MAA5B;AAAoC,UAAA,OAAO,EAAEN;AAA7C;AADF,QAVJ;AAAA;AADF,IADF;AAmBD,CA/CqB,CAAtB;;AAtFEL,EAAAA,W;AACAC,EAAAA,I;AACAC,EAAAA,Q;AACAC,EAAAA,O;AACAC,EAAAA,Q;AACAC,EAAAA,mB,aAAsB,U,EAAa,U;AACnCC,EAAAA,S;AACAf,EAAAA,c;AACAgB,EAAAA,Q;;AA+HF,eAAeV,aAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {COLORS, IconButton, Size} from '..';\nimport {IconButtonContent, StyledPrimaryIconButton} from '../Button/Iconbutton';\nimport {NotificationDot} from '../NotificationDot';\nimport {BREAKPOINTS, ComponentS, ComponentTextStyle} from '../styles';\n\ntype ProfileButtonProps = {\n portraitSrc?: string;\n icon?: React.ReactNode;\n initials?: string;\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n disabled?: boolean;\n notificationVariant?: 'positive' | 'critical';\n className?: string;\n hideOnLowWidth?: boolean;\n tabIndex?: number;\n};\n\nconst PortraitOverlay = styled.div`\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: ${COLORS.black};\n opacity: 0;\n position: absolute;\n top: 0px;\n left: 0px;\n`;\n\nexport const ProfileButtonContainer = styled.div<{ hideOnLowWidth?: boolean }>`\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ${StyledPrimaryIconButton} {\n display: ${props => (props.hideOnLowWidth ? 'none' : 'inline')};\n\n ${BREAKPOINTS.MEDIUM} {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ${IconButtonContent} {\n background-color: ${COLORS.neutral_100};\n\n svg, svg path {\n fill: ${COLORS.neutral_300};\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ${PortraitOverlay} {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ${PortraitOverlay} {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n`;\n\nconst NotificationContainer = styled.div`\n position: absolute;\n left: 30px;\n bottom: 30px;\n`;\n\nconst ImageWrapper = styled.div`\n width: 36px;\n height: 36px;\n position: relative;\n\n img {\n width: 100%;\n height: 100%;\n border-radius: 50%;\n object-fit: cover;\n }\n`;\n\nconst ProfileButton = React.forwardRef<HTMLButtonElement, ProfileButtonProps>(({\n portraitSrc,\n icon,\n initials,\n onClick,\n hideOnLowWidth,\n disabled,\n notificationVariant,\n className,\n tabIndex\n }, ref) => {\n const renderIcon = () => {\n return (\n (portraitSrc && (\n <ImageWrapper>\n <img src={portraitSrc}/>\n <PortraitOverlay/>\n </ImageWrapper>\n )) ||\n (initials && (\n <ComponentS className=\"initials\" textStyle={ComponentTextStyle.Bold}\n color={disabled ? COLORS.neutral_300 : COLORS.white}>\n {initials}\n </ComponentS>\n )) || <>{icon}</>\n );\n };\n\n return (\n <ProfileButtonContainer hideOnLowWidth={hideOnLowWidth}>\n <IconButton ref={ref}\n className={className}\n disabled={disabled}\n action={onClick}\n variant=\"primary\"\n tabIndex={tabIndex}\n shape=\"circular\"\n hideOnLowWidth={hideOnLowWidth}>\n {renderIcon()}\n {notificationVariant && (\n <NotificationContainer>\n <NotificationDot size={Size.Medium} variant={notificationVariant}/>\n </NotificationContainer>\n )}\n </IconButton>\n </ProfileButtonContainer>\n );\n});\n\nexport default ProfileButton;\n"],"file":"ProfileButton.js"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7,6 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
9
|
});
|
|
8
10
|
exports.default = void 0;
|
|
9
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
10
16
|
var React = _interopRequireWildcard(require("react"));
|
|
11
17
|
|
|
12
18
|
var _TogglerStyles = require("./TogglerStyles");
|
|
@@ -17,18 +23,17 @@ var _common = require("../common");
|
|
|
17
23
|
|
|
18
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
25
|
|
|
26
|
+
var _excluded = ["id", "disabled", "selected", "label", "isSemantic", "size", "onToggle", "className"];
|
|
27
|
+
|
|
20
28
|
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); }
|
|
21
29
|
|
|
22
30
|
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; }
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
* Import React libraries.
|
|
26
|
-
*/
|
|
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; }
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
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
|
+
|
|
36
|
+
var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
32
37
|
var _size;
|
|
33
38
|
|
|
34
39
|
var id = _ref.id,
|
|
@@ -37,7 +42,9 @@ var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
|
37
42
|
label = _ref.label,
|
|
38
43
|
isSemantic = _ref.isSemantic,
|
|
39
44
|
size = _ref.size,
|
|
40
|
-
onToggle = _ref.onToggle
|
|
45
|
+
onToggle = _ref.onToggle,
|
|
46
|
+
className = _ref.className,
|
|
47
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
48
|
|
|
42
49
|
/**
|
|
43
50
|
* Does all required pre-requisites and toggles the switcher state.
|
|
@@ -49,19 +56,20 @@ var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
|
49
56
|
onToggle(!selected);
|
|
50
57
|
};
|
|
51
58
|
|
|
52
|
-
var focusVisibleRef = (0, _common.useFocusVisibleRef)();
|
|
59
|
+
var focusVisibleRef = (0, _common.useFocusVisibleRef)([], ref);
|
|
53
60
|
size = (_size = size) !== null && _size !== void 0 ? _size : _.Size.Medium;
|
|
54
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_TogglerStyles.StyledSwitch, {
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_TogglerStyles.StyledSwitch, _objectSpread(_objectSpread({
|
|
55
62
|
ref: focusVisibleRef,
|
|
56
63
|
onClick: function onClick(e) {
|
|
57
64
|
return toggle();
|
|
58
65
|
},
|
|
59
|
-
|
|
60
|
-
return e.key === 'Enter' && toggle();
|
|
66
|
+
onKeyDown: function onKeyDown(e) {
|
|
67
|
+
return (e.key === 'Enter' || e.key === ' ') && toggle();
|
|
61
68
|
},
|
|
62
|
-
className: size.toString().toLowerCase().concat(disabled ? ' disabled' : ''),
|
|
69
|
+
className: size.toString().toLowerCase().concat(disabled ? ' disabled' : '').concat(className ? " ".concat(className) : ''),
|
|
63
70
|
selected: selected,
|
|
64
|
-
tabIndex: disabled ? -1 : 0
|
|
71
|
+
tabIndex: disabled ? -1 : 0
|
|
72
|
+
}, rest), {}, {
|
|
65
73
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TogglerStyles.ToggleSwitchContainer, {
|
|
66
74
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TogglerStyles.ToggleSwitch, {
|
|
67
75
|
className: isSemantic ? 'semantic' : ''
|
|
@@ -71,9 +79,8 @@ var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
|
71
79
|
htmlFor: id,
|
|
72
80
|
children: label
|
|
73
81
|
})]
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
77
84
|
var _default = ToggleSwitch;
|
|
78
85
|
exports.default = _default;
|
|
79
86
|
//# sourceMappingURL=ToggleSwitch.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Toggles/ToggleSwitch.tsx"],"names":["ToggleSwitch","id","disabled","selected","label","isSemantic","size","onToggle","toggle","focusVisibleRef","Size","Medium","e","key","toString","toLowerCase","concat"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/Toggles/ToggleSwitch.tsx"],"names":["ToggleSwitch","React","forwardRef","ref","id","disabled","selected","label","isSemantic","size","onToggle","className","rest","toggle","focusVisibleRef","Size","Medium","e","key","toString","toLowerCase","concat"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAUA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAMA,YAAY,gBAAGC,KAAK,CAACC,UAAN,CAAiB,gBAUuBC,GAVvB,EAU+B;AAAA;;AAAA,MAT5BC,EAS4B,QAT5BA,EAS4B;AAAA,MAR5BC,QAQ4B,QAR5BA,QAQ4B;AAAA,MAP5BC,QAO4B,QAP5BA,QAO4B;AAAA,MAN5BC,KAM4B,QAN5BA,KAM4B;AAAA,MAL5BC,UAK4B,QAL5BA,UAK4B;AAAA,MAJ5BC,IAI4B,QAJ5BA,IAI4B;AAAA,MAH5BC,QAG4B,QAH5BA,QAG4B;AAAA,MAF5BC,SAE4B,QAF5BA,SAE4B;AAAA,MADzBC,IACyB;;AACnE;AACF;AACA;AACE,MAAMC,MAAM,GAAG,SAATA,MAAS,GAAM;AACnB;AACA,QAAIR,QAAJ,EAAc,OAFK,CAInB;;AACAK,IAAAA,QAAQ,CAAC,CAACJ,QAAF,CAAR;AACD,GAND;;AAQA,MAAMQ,eAAe,GAAG,gCAAmB,EAAnB,EAAuBX,GAAvB,CAAxB;AAEAM,EAAAA,IAAI,YAAGA,IAAH,yCAAWM,OAAKC,MAApB;AAEA,sBACE,sBAAC,2BAAD;AACE,IAAA,GAAG,EAAEF,eADP;AAEE,IAAA,OAAO,EAAE,iBAAAG,CAAC;AAAA,aAAIJ,MAAM,EAAV;AAAA,KAFZ;AAGE,IAAA,SAAS,EAAE,mBAAAI,CAAC;AAAA,aAAI,CAACA,CAAC,CAACC,GAAF,KAAU,OAAV,IAAqBD,CAAC,CAACC,GAAF,KAAU,GAAhC,KAAwCL,MAAM,EAAlD;AAAA,KAHd;AAIE,IAAA,SAAS,EAAEJ,IAAI,CACZU,QADQ,GAERC,WAFQ,GAGRC,MAHQ,CAGDhB,QAAQ,GAAG,WAAH,GAAiB,EAHxB,EAIRgB,MAJQ,CAIDV,SAAS,cAAOA,SAAP,IAAqB,EAJ7B,CAJb;AASE,IAAA,QAAQ,EAAEL,QATZ;AAUE,IAAA,QAAQ,EAAED,QAAQ,GAAG,CAAC,CAAJ,GAAQ;AAV5B,KAWMO,IAXN;AAAA,4BAYE,qBAAC,oCAAD;AAAA,6BACE,qBAAC,2BAAD;AAAQ,QAAA,SAAS,EAAEJ,UAAU,GAAG,UAAH,GAAgB;AAA7C;AADF,MAZF,EAeGD,KAAK,iBACJ;AAAO,MAAA,SAAS,EAAE,OAAlB;AAA2B,MAAA,OAAO,EAAEH,EAApC;AAAA,gBACGG;AADH,MAhBJ;AAAA,KADF;AAuBD,CAjDoB,CAArB;eAmDeP,Y","sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import custom types.\n */\nimport {ToggleSwitchProps} from './TogglerTypes';\n\n/**\n * Import custom styles.\n */\nimport {ToggleSwitchContainer, ToggleSwitch as Switch, StyledSwitch} from './TogglerStyles';\nimport {Size} from '..';\nimport {useFocusVisibleRef} from '../common';\n\nconst ToggleSwitch = React.forwardRef(({\n id,\n disabled,\n selected,\n label,\n isSemantic,\n size,\n onToggle,\n className,\n ...rest\n }: ToggleSwitchProps, ref) => {\n /**\n * Does all required pre-requisites and toggles the switcher state.\n */\n const toggle = () => {\n // If disabled, don't do anything\n if (disabled) return;\n\n // Toggle state change\n onToggle(!selected);\n };\n\n const focusVisibleRef = useFocusVisibleRef([], ref);\n\n size = size ?? Size.Medium;\n\n return (\n <StyledSwitch\n ref={focusVisibleRef}\n onClick={e => toggle()}\n onKeyDown={e => (e.key === 'Enter' || e.key === ' ') && toggle()}\n className={size\n .toString()\n .toLowerCase()\n .concat(disabled ? ' disabled' : '')\n .concat(className ? ` ${className}` : '')}\n selected={selected}\n tabIndex={disabled ? -1 : 0}\n {...rest}>\n <ToggleSwitchContainer>\n <Switch className={isSemantic ? 'semantic' : ''}/>\n </ToggleSwitchContainer>\n {label && (\n <label className={'label'} htmlFor={id}>\n {label}\n </label>\n )}\n </StyledSwitch>\n );\n});\n\nexport default ToggleSwitch;\n"],"file":"ToggleSwitch.cjs"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import React libraries.
|
|
3
|
+
*/
|
|
4
|
+
import * as React from 'react';
|
|
1
5
|
/**
|
|
2
6
|
* Import custom types.
|
|
3
7
|
*/
|
|
4
8
|
import { ToggleSwitchProps } from './TogglerTypes';
|
|
5
|
-
declare const ToggleSwitch:
|
|
9
|
+
declare const ToggleSwitch: React.ForwardRefExoticComponent<ToggleSwitchProps & React.RefAttributes<unknown>>;
|
|
6
10
|
export default ToggleSwitch;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["id", "disabled", "selected", "label", "isSemantic", "size", "onToggle", "className"];
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* Import React libraries.
|
|
3
11
|
*/
|
|
@@ -14,8 +22,7 @@ import { Size } from '..';
|
|
|
14
22
|
import { useFocusVisibleRef } from '../common';
|
|
15
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
|
|
18
|
-
var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
25
|
+
var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
19
26
|
var _size;
|
|
20
27
|
|
|
21
28
|
var id = _ref.id,
|
|
@@ -24,7 +31,9 @@ var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
|
24
31
|
label = _ref.label,
|
|
25
32
|
isSemantic = _ref.isSemantic,
|
|
26
33
|
size = _ref.size,
|
|
27
|
-
onToggle = _ref.onToggle
|
|
34
|
+
onToggle = _ref.onToggle,
|
|
35
|
+
className = _ref.className,
|
|
36
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
37
|
|
|
29
38
|
/**
|
|
30
39
|
* Does all required pre-requisites and toggles the switcher state.
|
|
@@ -36,19 +45,20 @@ var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
|
36
45
|
onToggle(!selected);
|
|
37
46
|
};
|
|
38
47
|
|
|
39
|
-
var focusVisibleRef = useFocusVisibleRef();
|
|
48
|
+
var focusVisibleRef = useFocusVisibleRef([], ref);
|
|
40
49
|
size = (_size = size) !== null && _size !== void 0 ? _size : Size.Medium;
|
|
41
|
-
return /*#__PURE__*/_jsxs(StyledSwitch, {
|
|
50
|
+
return /*#__PURE__*/_jsxs(StyledSwitch, _objectSpread(_objectSpread({
|
|
42
51
|
ref: focusVisibleRef,
|
|
43
52
|
onClick: function onClick(e) {
|
|
44
53
|
return toggle();
|
|
45
54
|
},
|
|
46
|
-
|
|
47
|
-
return e.key === 'Enter' && toggle();
|
|
55
|
+
onKeyDown: function onKeyDown(e) {
|
|
56
|
+
return (e.key === 'Enter' || e.key === ' ') && toggle();
|
|
48
57
|
},
|
|
49
|
-
className: size.toString().toLowerCase().concat(disabled ? ' disabled' : ''),
|
|
58
|
+
className: size.toString().toLowerCase().concat(disabled ? ' disabled' : '').concat(className ? " ".concat(className) : ''),
|
|
50
59
|
selected: selected,
|
|
51
|
-
tabIndex: disabled ? -1 : 0
|
|
60
|
+
tabIndex: disabled ? -1 : 0
|
|
61
|
+
}, rest), {}, {
|
|
52
62
|
children: [/*#__PURE__*/_jsx(ToggleSwitchContainer, {
|
|
53
63
|
children: /*#__PURE__*/_jsx(Switch, {
|
|
54
64
|
className: isSemantic ? 'semantic' : ''
|
|
@@ -58,8 +68,7 @@ var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
|
58
68
|
htmlFor: id,
|
|
59
69
|
children: label
|
|
60
70
|
})]
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
64
73
|
export default ToggleSwitch;
|
|
65
74
|
//# sourceMappingURL=ToggleSwitch.js.map
|