@laerdal/life-react-components 1.9.9-dev.2 → 1.9.9-dev.6
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/Breadcrumb/Breadcrumb.cjs +10 -46
- package/dist/Breadcrumb/Breadcrumb.cjs.map +1 -1
- package/dist/Breadcrumb/Breadcrumb.js +8 -43
- package/dist/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/Breadcrumb/styles.cjs +55 -0
- package/dist/Breadcrumb/styles.cjs.map +1 -0
- package/dist/Breadcrumb/styles.d.ts +7 -0
- package/dist/Breadcrumb/styles.js +39 -0
- package/dist/Breadcrumb/styles.js.map +1 -0
- package/dist/Button/DualFunctionButton.cjs +1 -0
- package/dist/Button/DualFunctionButton.cjs.map +1 -1
- package/dist/Button/DualFunctionButton.js +1 -0
- package/dist/Button/DualFunctionButton.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.cjs +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.js +1 -1
- package/dist/Card/HorizontalCard/HorizontalCard.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardActions.cjs +8 -2
- 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/HorizontalCardThumbnail.cjs +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.cjs.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.js.map +1 -1
- package/dist/ChipsInput/ChipInputField.cjs +2 -0
- package/dist/ChipsInput/ChipInputField.cjs.map +1 -1
- package/dist/ChipsInput/ChipInputField.js +2 -0
- package/dist/ChipsInput/ChipInputField.js.map +1 -1
- package/dist/Dropdown/BasicDropdown.cjs +57 -67
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.d.ts +7 -14
- package/dist/Dropdown/BasicDropdown.js +58 -67
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +1 -1
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js +1 -1
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/Footer/Components/FooterNavSection.cjs +1 -0
- package/dist/Footer/Components/FooterNavSection.cjs.map +1 -1
- package/dist/Footer/Components/FooterNavSection.js +1 -0
- package/dist/Footer/Components/FooterNavSection.js.map +1 -1
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs +1 -0
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.cjs.map +1 -1
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.js +1 -0
- package/dist/Footer/Components/FooterNewsletterAndSocialSection.js.map +1 -1
- package/dist/Footer/Components/FooterTop.cjs +1 -0
- package/dist/Footer/Components/FooterTop.cjs.map +1 -1
- package/dist/Footer/Components/FooterTop.js +1 -0
- package/dist/Footer/Components/FooterTop.js.map +1 -1
- package/dist/Footer/Footer.cjs +3 -1
- package/dist/Footer/Footer.cjs.map +1 -1
- package/dist/Footer/Footer.js +3 -1
- package/dist/Footer/Footer.js.map +1 -1
- package/dist/Footer/SiteFooter.cjs +1 -0
- package/dist/Footer/SiteFooter.cjs.map +1 -1
- package/dist/Footer/SiteFooter.js +1 -0
- package/dist/Footer/SiteFooter.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +8 -2
- 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/InputFields/DatepickerField.cjs +38 -44
- package/dist/InputFields/DatepickerField.cjs.map +1 -1
- package/dist/InputFields/DatepickerField.d.ts +20 -17
- package/dist/InputFields/DatepickerField.js +20 -33
- package/dist/InputFields/DatepickerField.js.map +1 -1
- package/dist/InputFields/NumberField.cjs +52 -63
- package/dist/InputFields/NumberField.cjs.map +1 -1
- package/dist/InputFields/NumberField.d.ts +19 -14
- package/dist/InputFields/NumberField.js +53 -60
- 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 +3 -5
- package/dist/InputFields/TextField.cjs.map +1 -1
- package/dist/InputFields/TextField.d.ts +1 -2
- package/dist/InputFields/TextField.js +4 -5
- package/dist/InputFields/TextField.js.map +1 -1
- package/dist/InputFields/index.cjs +0 -26
- package/dist/InputFields/index.cjs.map +1 -1
- package/dist/InputFields/index.d.ts +0 -1
- package/dist/InputFields/index.js +0 -1
- package/dist/InputFields/index.js.map +1 -1
- package/dist/Popover/Popover.cjs +2 -2
- package/dist/Popover/Popover.cjs.map +1 -1
- package/dist/Popover/Popover.js +2 -2
- package/dist/Popover/Popover.js.map +1 -1
- package/dist/Toggles/ToggleButton.cjs +2 -0
- package/dist/Toggles/ToggleButton.cjs.map +1 -1
- package/dist/Toggles/ToggleButton.d.ts +1 -0
- package/dist/Toggles/ToggleButton.js +2 -0
- package/dist/Toggles/ToggleButton.js.map +1 -1
- package/dist/Toggles/ToggleSwitch.cjs +18 -24
- package/dist/Toggles/ToggleSwitch.cjs.map +1 -1
- package/dist/Toggles/ToggleSwitch.d.ts +1 -5
- package/dist/Toggles/ToggleSwitch.js +13 -21
- package/dist/Toggles/ToggleSwitch.js.map +1 -1
- package/dist/Toggles/TogglerTypes.d.ts +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,8 @@ import { useFocusVisibleRef } from '../common';
|
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
var TextField = function TextField(_ref) {
|
|
12
13
|
var id = _ref.id,
|
|
13
14
|
disabled = _ref.disabled,
|
|
14
15
|
readOnly = _ref.readOnly,
|
|
@@ -28,9 +29,6 @@ var TextField = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
28
29
|
margin = _ref$margin === void 0 ? '4px 0' : _ref$margin,
|
|
29
30
|
note = _ref.note;
|
|
30
31
|
var elementRef = useFocusVisibleRef();
|
|
31
|
-
React.useImperativeHandle(ref, function () {
|
|
32
|
-
return elementRef.current;
|
|
33
|
-
}, [elementRef]);
|
|
34
32
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
35
33
|
children: /*#__PURE__*/_jsxs(InputWrapper, {
|
|
36
34
|
readOnly: readOnly,
|
|
@@ -80,7 +78,8 @@ var TextField = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
80
78
|
})]
|
|
81
79
|
})
|
|
82
80
|
});
|
|
83
|
-
}
|
|
81
|
+
};
|
|
82
|
+
|
|
84
83
|
TextField.propTypes = {
|
|
85
84
|
id: _pt.string.isRequired,
|
|
86
85
|
disabled: _pt.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/InputFields/TextField.tsx"],"names":["React","CheckMark","TechnicalWarning","COLORS","States","InputFieldStyling","InputWrapper","NoteMessage","ValidationMessage","useFocusVisibleRef","TextField","
|
|
1
|
+
{"version":3,"sources":["../../src/InputFields/TextField.tsx"],"names":["React","CheckMark","TechnicalWarning","COLORS","States","InputFieldStyling","InputWrapper","NoteMessage","ValidationMessage","useFocusVisibleRef","TextField","id","disabled","readOnly","onChange","value","validationMessage","type","autoComplete","placeholder","required","pattern","maxLength","withoutBorder","state","size","margin","note","elementRef","e","preventDefault","Invalid","undefined","target","Valid","correct_400","critical_400","icon","message"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,EAAoBC,gBAApB,QAA4C,kCAA5C;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAAeC,MAAf,QAA6B,UAA7B;AACA,SAAuBC,iBAAvB,EAA0CC,YAA1C,EAAwDC,WAAxD,EAAqEC,iBAArE,QAA8F,WAA9F;AACA,SAASC,kBAAT,QAAmC,WAAnC;;;;;AAuBA,IAAMC,SAAS,GAAG,SAAZA,SAAY,OAkBI;AAAA,MAjBpBC,EAiBoB,QAjBpBA,EAiBoB;AAAA,MAhBpBC,QAgBoB,QAhBpBA,QAgBoB;AAAA,MAfpBC,QAeoB,QAfpBA,QAeoB;AAAA,MAdpBC,SAcoB,QAdpBA,QAcoB;AAAA,MAbpBC,KAaoB,QAbpBA,KAaoB;AAAA,MAZpBC,iBAYoB,QAZpBA,iBAYoB;AAAA,MAXpBC,IAWoB,QAXpBA,IAWoB;AAAA,MAVpBC,YAUoB,QAVpBA,YAUoB;AAAA,MATpBC,WASoB,QATpBA,WASoB;AAAA,MARpBC,QAQoB,QARpBA,QAQoB;AAAA,MAPpBC,OAOoB,QAPpBA,OAOoB;AAAA,MANpBC,SAMoB,QANpBA,SAMoB;AAAA,MALpBC,aAKoB,QALpBA,aAKoB;AAAA,MAJpBC,KAIoB,QAJpBA,KAIoB;AAAA,MAHpBC,IAGoB,QAHpBA,IAGoB;AAAA,yBAFpBC,MAEoB;AAAA,MAFpBA,MAEoB,4BAFX,OAEW;AAAA,MADpBC,IACoB,QADpBA,IACoB;AACpB,MAAMC,UAAU,GAAGnB,kBAAkB,EAArC;AAEA,sBACE;AAAA,2BACE,MAAC,YAAD;AACE,MAAA,QAAQ,EAAEI,QADZ;AAEE,MAAA,QAAQ,EAAED,QAFZ;AAGE,MAAA,MAAM,EAAEc,MAHV;AAIE,M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AAWpB,MAAM,CAAC2B,OAAhE;AAAA,mBACGP,KAAK,KAAKpB,MAAM,CAAC8B,KAAjB,gBAAyB,KAAC,SAAD;AAAW,UAAA,KAAK,EAAE/B,MAAM,CAACgC;AAAzB,UAAzB,gBAAoE,KAAC,gBAAD;AAAkB,UAAA,KAAK,EAAEhC,MAAM,CAACiC;AAAhC,UADvE,eAEE;AAAA,oBAAOpB;AAAP,UAFF;AAAA,QA5BJ,EAiCGW,IAAI,IAAI,CAACf,QAAT,iBACC,MAAC,WAAD;AAAa,QAAA,SAAS,EAAEa,IAAxB;AAAA,mBACGE,IAAI,CAACU,IADR,eAEE;AAAA,oBAAOV,IAAI,CAACW;AAAZ,UAFF;AAAA,QAlCJ;AAAA;AADF,IADF;AA4CD,CAjED;;;AAnBE3B,EAAAA,E;AACAC,EAAAA,Q;AACAC,EAAAA,Q;AACAC,EAAAA,Q;AACAC,EAAAA,K;AACAC,EAAAA,iB;AACAC,EAAAA,I;AAEAC,EAAAA,Y;AACAC,EAAAA,W;AACAC,EAAAA,Q;AACAC,EAAAA,O;AACAC,EAAAA,S;AACAC,EAAAA,a;AAEAG,EAAAA,M;;AAuEF,eAAehB,SAAf","sourcesContent":["import * as React from 'react';\nimport { CheckMark, TechnicalWarning } from '../icons/systemicons/SystemIcons';\nimport { COLORS } from '../styles';\nimport { Size, States } from '../types';\nimport { ErrorMessage, InputFieldStyling, InputWrapper, NoteMessage, ValidationMessage } from './styling';\nimport { useFocusVisibleRef } from '../common';\nimport { TextFieldNote } from './types';\n\ntype TextFieldProps = {\n id: string;\n disabled?: boolean;\n readOnly?: boolean;\n onChange?: (text: string) => void;\n value?: string;\n validationMessage?: string;\n type?: string;\n state?: States.Invalid | States.Valid;\n autoComplete?: string;\n placeholder?: string;\n required?: boolean;\n pattern?: string;\n maxLength?: number;\n withoutBorder?: boolean;\n size?: Size.Small | Size.Medium;\n margin?: string;\n note?: TextFieldNote;\n};\n\nconst TextField = ({\n id,\n disabled,\n readOnly,\n onChange,\n value,\n validationMessage,\n type,\n autoComplete,\n placeholder,\n required,\n pattern,\n maxLength,\n withoutBorder,\n state,\n size,\n margin = '4px 0',\n note,\n}: TextFieldProps) => {\n const elementRef = useFocusVisibleRef();\n\n return (\n <>\n <InputWrapper\n readOnly={readOnly}\n disabled={disabled}\n margin={margin}\n onClick={(e: any) => {\n if (disabled || readOnly) {\n e.preventDefault();\n }\n }}>\n <InputFieldStyling\n id={id}\n ref={elementRef}\n type={type || 'text'}\n value={value}\n className={`${state || (validationMessage ? States.Invalid : '')} ${size || ''}`}\n tabIndex={readOnly || disabled ? -1 : 0}\n autoComplete={autoComplete}\n placeholder={disabled ? undefined : placeholder}\n disabled={disabled}\n readOnly={readOnly}\n onChange={(e: any) => onChange && onChange(e?.target?.value || '')}\n activeErrorMessage={!!validationMessage && state !== States.Valid}\n required={required}\n pattern={pattern}\n maxLength={maxLength}\n withoutBorder={withoutBorder}\n />\n {validationMessage && (\n <ValidationMessage className={size || ''} type={state ?? States.Invalid}>\n {state === States.Valid ? <CheckMark color={COLORS.correct_400} /> : <TechnicalWarning color={COLORS.critical_400} />}\n <span>{validationMessage}</span>\n </ValidationMessage>\n )}\n {note && !disabled && (\n <NoteMessage className={size}>\n {note.icon}\n <span>{note.message}</span>\n </NoteMessage>\n )}\n </InputWrapper>\n </>\n );\n};\n\nexport default TextField;\n"],"file":"TextField.js"}
|
|
@@ -5,18 +5,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
var _exportNames = {
|
|
9
|
-
TextField: true,
|
|
10
|
-
PasswordField: true,
|
|
11
|
-
Checkbox: true,
|
|
12
|
-
RadioButton: true,
|
|
13
|
-
SearchBar: true,
|
|
14
|
-
InputLabel: true,
|
|
15
|
-
DatepickerField: true,
|
|
16
|
-
Textarea: true,
|
|
17
|
-
QuickSearch: true,
|
|
18
|
-
NumberField: true
|
|
19
|
-
};
|
|
20
8
|
Object.defineProperty(exports, "Checkbox", {
|
|
21
9
|
enumerable: true,
|
|
22
10
|
get: function get() {
|
|
@@ -97,18 +85,4 @@ var _Textarea = _interopRequireDefault(require("./Textarea"));
|
|
|
97
85
|
var _QuickSearch = _interopRequireDefault(require("./QuickSearch"));
|
|
98
86
|
|
|
99
87
|
var _NumberField = _interopRequireDefault(require("./NumberField"));
|
|
100
|
-
|
|
101
|
-
var _styling = require("./styling");
|
|
102
|
-
|
|
103
|
-
Object.keys(_styling).forEach(function (key) {
|
|
104
|
-
if (key === "default" || key === "__esModule") return;
|
|
105
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
106
|
-
if (key in exports && exports[key] === _styling[key]) return;
|
|
107
|
-
Object.defineProperty(exports, key, {
|
|
108
|
-
enumerable: true,
|
|
109
|
-
get: function get() {
|
|
110
|
-
return _styling[key];
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
88
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/InputFields/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/InputFields/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["import TextField from './TextField';\nimport PasswordField from './PasswordField';\nimport Checkbox from './Checkbox';\nimport RadioButton from './RadioButton';\nimport SearchBar from './SearchBar';\nimport InputLabel from './Label';\nimport DatepickerField from './DatepickerField';\nimport Textarea from './Textarea';\nimport QuickSearch from './QuickSearch';\nimport NumberField from './NumberField';\n\nexport { TextField, PasswordField, Checkbox, RadioButton, SearchBar, InputLabel, DatepickerField, Textarea, QuickSearch, NumberField };\n"],"file":"index.cjs"}
|
|
@@ -8,5 +8,4 @@ import DatepickerField from './DatepickerField';
|
|
|
8
8
|
import Textarea from './Textarea';
|
|
9
9
|
import QuickSearch from './QuickSearch';
|
|
10
10
|
import NumberField from './NumberField';
|
|
11
|
-
export * from './styling';
|
|
12
11
|
export { TextField, PasswordField, Checkbox, RadioButton, SearchBar, InputLabel, DatepickerField, Textarea, QuickSearch, NumberField };
|
|
@@ -8,6 +8,5 @@ import DatepickerField from './DatepickerField';
|
|
|
8
8
|
import Textarea from './Textarea';
|
|
9
9
|
import QuickSearch from './QuickSearch';
|
|
10
10
|
import NumberField from './NumberField';
|
|
11
|
-
export * from './styling';
|
|
12
11
|
export { TextField, PasswordField, Checkbox, RadioButton, SearchBar, InputLabel, DatepickerField, Textarea, QuickSearch, NumberField };
|
|
13
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/InputFields/index.ts"],"names":["TextField","PasswordField","Checkbox","RadioButton","SearchBar","InputLabel","DatepickerField","Textarea","QuickSearch","NumberField"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,aAAtB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,OAAOC,UAAP,MAAuB,SAAvB;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAEA,
|
|
1
|
+
{"version":3,"sources":["../../src/InputFields/index.ts"],"names":["TextField","PasswordField","Checkbox","RadioButton","SearchBar","InputLabel","DatepickerField","Textarea","QuickSearch","NumberField"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,aAAtB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,OAAOC,UAAP,MAAuB,SAAvB;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAEA,SAAST,SAAT,EAAoBC,aAApB,EAAmCC,QAAnC,EAA6CC,WAA7C,EAA0DC,SAA1D,EAAqEC,UAArE,EAAiFC,eAAjF,EAAkGC,QAAlG,EAA4GC,WAA5G,EAAyHC,WAAzH","sourcesContent":["import TextField from './TextField';\nimport PasswordField from './PasswordField';\nimport Checkbox from './Checkbox';\nimport RadioButton from './RadioButton';\nimport SearchBar from './SearchBar';\nimport InputLabel from './Label';\nimport DatepickerField from './DatepickerField';\nimport Textarea from './Textarea';\nimport QuickSearch from './QuickSearch';\nimport NumberField from './NumberField';\n\nexport { TextField, PasswordField, Checkbox, RadioButton, SearchBar, InputLabel, DatepickerField, Textarea, QuickSearch, NumberField };\n"],"file":"index.js"}
|
package/dist/Popover/Popover.cjs
CHANGED
|
@@ -169,9 +169,9 @@ var Popover = function Popover(_ref) {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
document.addEventListener(
|
|
172
|
+
document.addEventListener('mousedown', checkIfClickedOutside);
|
|
173
173
|
return function () {
|
|
174
|
-
document.removeEventListener(
|
|
174
|
+
document.removeEventListener('mousedown', checkIfClickedOutside);
|
|
175
175
|
};
|
|
176
176
|
}, [showPopover]);
|
|
177
177
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Popover/Popover.tsx"],"names":["Container","styled","div","props","size","Size","Small","Large","COLORS","white","BOXSHADOWS","BOXSHADOW_CENTERED","Z_INDEXES","popover","position","Position","Bottom","Top","Left","Right","showArrowPointer","renderArrowStyles","TopContainer","MainContentWrapper","MiddleContainer","BottomContainer","TextContainer","renderMargins","note","NoteContainer","ComponentTextStyle","Regular","neutral_600","LabelContainer","Bold","CloseButtonContainer","TextButtonContainer","IconButtonContainer","Wrapper","showOnClick","showPopover","isNotePresent","Popover","Medium","topSectionProps","bottomSectionProps","mainContent","children","React","useState","setShowPopover","popoverRef","useRef","useEffect","checkIfClickedOutside","e","current","contains","target","document","addEventListener","removeEventListener","text","textButton","icon","action","label","iconButtons","map","iconButton"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,SAAS,GAAGC,0BAAOC,GAAV,mWACD,UAAAC,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaC,YAAKC,KAAlB,GAA0B,OAA1B,GAAqCH,KAAK,CAACC,IAAN,KAAaC,YAAKE,KAAlB,GAA0B,OAA1B,GAAoC,OAA3E;AAAA,CADJ,EAEA,UAAAJ,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaC,YAAKC,KAAlB,GAA0B,OAA1B,GAAqCH,KAAK,CAACC,IAAN,KAAaC,YAAKE,KAAlB,GAA0B,OAA1B,GAAoC,OAA3E;AAAA,CAFL,EAICC,SAAOC,KAJR,EAMCC,mBAAWC,kBANZ,EAWFC,kBAAUC,OAXR,EAaX,UAAAV,KAAK;AAAA,SAAKA,KAAK,CAACW,QAAN,IAAkBC,gBAASC,MAA3B,GAAoC,iEAApC,GAAwG,EAA7G;AAAA,CAbM,EAcX,UAAAb,KAAK;AAAA,SAAKA,KAAK,CAACW,QAAN,IAAkBC,gBAASE,GAA3B,GAAiC,oEAAjC,GAAwG,EAA7G;AAAA,CAdM,EAgBX,UAAAd,KAAK;AAAA,SAAKA,KAAK,CAACW,QAAN,IAAkBC,gBAASG,IAA3B,GAAkC,oEAAlC,GAAyG,EAA9G;AAAA,CAhBM,EAiBX,UAAAf,KAAK;AAAA,SAAKA,KAAK,CAACW,QAAN,IAAk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CA7FD;;;AATEH,EAAAA,e;AAjBAkB,IAAAA,I;AACAlC,IAAAA,I;;AAiBAiB,EAAAA,kB;AAPAsB,IAAAA,W;AANAH,MAAAA,I;AACAC,MAAAA,M;AACAC,MAAAA,K;;AAKAH,IAAAA,U;AAPAC,MAAAA,I;AACAC,MAAAA,M;AACAC,MAAAA,K;;;AAYApB,EAAAA,W;AACAC,EAAAA,Q;AAEAR,EAAAA,W;AACAnB,EAAAA,gB;;eAkGasB,O","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.cjs"}
|
|
1
|
+
{"version":3,"sources":["../../src/Popover/Popover.tsx"],"names":["Container","styled","div","props","size","Size","Small","Large","COLORS","white","BOXSHADOWS","BOXSHADOW_CENTERED","Z_INDEXES","popover","position","Position","Bottom","Top","Left","Right","showArrowPointer","renderArrowStyles","TopContainer","MainContentWrapper","MiddleContainer","BottomContainer","TextContainer","renderMargins","note","NoteContainer","ComponentTextStyle","Regular","neutral_600","LabelContainer","Bold","CloseButtonContainer","TextButtonContainer","IconButtonContainer","Wrapper","showOnClick","showPopover","isNotePresent","Popover","Medium","topSectionProps","bottomSectionProps","mainContent","children","React","useState","setShowPopover","popoverRef","useRef","useEffect","checkIfClickedOutside","e","current","contains","target","document","addEventListener","removeEventListener","text","textButton","icon","action","label","iconButtons","map","iconButton"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,SAAS,GAAGC,0BAAOC,GAAV,mWACD,UAACC,KAAD;AAAA,SAAYA,KAAK,CAACC,IAAN,KAAeC,YAAKC,KAApB,GAA4B,OAA5B,GAAsCH,KAAK,CAACC,IAAN,KAAeC,YAAKE,KAApB,GAA4B,OAA5B,GAAsC,OAAxF;AAAA,CADC,EAEA,UAACJ,KAAD;AAAA,SAAYA,KAAK,CAACC,IAAN,KAAeC,YAAKC,KAApB,GAA4B,OAA5B,GAAsCH,KAAK,CAACC,IAAN,KAAeC,YAAKE,KAApB,GAA4B,OAA5B,GAAsC,OAAxF;AAAA,CAFA,EAICC,SAAOC,KAJR,EAMCC,mBAAWC,kBANZ,EAWFC,kBAAUC,OAXR,EAaX,UAACV,KAAD;AAAA,SAAYA,KAAK,CAACW,QAAN,IAAkBC,gBAASC,MAA3B,GAAoC,iEAApC,GAAwG,EAApH;AAAA,CAbW,EAcX,UAACb,KAAD;AAAA,SAAYA,KAAK,CAACW,QAAN,IAAkBC,gBAASE,GAA3B,GAAiC,oEAAjC,GAAwG,EAApH;AAAA,CAdW,EAgBX,UAACd,KAAD;AAAA,SAAYA,KAAK,CAACW,QAAN,IAAkBC,gBAASG,IAA3B,GAAkC,oEAAlC,GAAyG,EAArH;AAAA,CAhBW,EAiBX,UAACf,KAAD;AAAA,SAAYA,KAAK,CAACW,QAAN,IAAkBC,gBAASI,KAA3B,GAAmC,mEAAnC,GAAyG,EAArH;AA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AANAH,MAAAA,I;AACAC,MAAAA,M;AACAC,MAAAA,K;;AAKAH,IAAAA,U;AAPAC,MAAAA,I;AACAC,MAAAA,M;AACAC,MAAAA,K;;;AAYApB,EAAAA,W;AACAC,EAAAA,Q;AAEAR,EAAAA,W;AACAnB,EAAAA,gB;;eAsFasB,O","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) =>\n props.size === Size.Small\n ? ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)\n : props.size === Size.Large\n ? ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)\n : ComponentXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n`;\n\nconst LabelContainer = styled.div<{ size: Size }>`\n ${(props) =>\n props.size === Size.Small\n ? ComponentSStyling(ComponentTextStyle.Bold, null)\n : props.size === Size.Large\n ? ComponentLStyling(ComponentTextStyle.Bold, null)\n : 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) =>\n props.showOnClick\n ? `${Container} {\n visibility: ${props.showPopover ? 'visible' : 'hidden'};\n opacity: ${props.showPopover ? '1' : '0'};\n }\n cursor: pointer;`\n : `&:hover {\n ${Container} {\n visibility: visible;\n opacity: 1;\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 } 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 size = Size.Medium,\n topSectionProps,\n bottomSectionProps,\n mainContent,\n children,\n position,\n showOnClick = false,\n showArrowPointer = false,\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 && <NoteContainer size={size}>{topSectionProps.note}</NoteContainer>}\n <LabelContainer size={size}>{topSectionProps?.text}</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}>{mainContent}</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 <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 </Wrapper>\n );\n};\n\nexport default Popover;\n"],"file":"Popover.cjs"}
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -134,9 +134,9 @@ var Popover = function Popover(_ref) {
|
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
document.addEventListener(
|
|
137
|
+
document.addEventListener('mousedown', checkIfClickedOutside);
|
|
138
138
|
return function () {
|
|
139
|
-
document.removeEventListener(
|
|
139
|
+
document.removeEventListener('mousedown', checkIfClickedOutside);
|
|
140
140
|
};
|
|
141
141
|
}, [showPopover]);
|
|
142
142
|
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
@@ -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","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,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,qVACD,UAAAC,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaJ,IAAI,CAACK,KAAlB,GAA0B,OA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qB,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"}
|
|
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,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,qVACD,UAACC,KAAD;AAAA,SAAYA,KAAK,CAACC,IAAN,KAAeJ,IAAI,CAACK,KAApB,GAA4B,OAA5B,GAAsCF,KAAK,CAACC,IAAN,KAAeJ,IAAI,CAACM,KAApB,GAA4B,OAA5B,GAAsC,OAAxF;AAAA,CADC,EAEA,UAACH,KAAD;AAAA,SAAYA,KAAK,CAACC,IAAN,KAAeJ,IAAI,CAACK,KAApB,GAA4B,OAA5B,GAAsCF,KAAK,CAACC,IAAN,KAAeJ,IAAI,CAACM,KAApB,GAA4B,OAA5B,GAAsC,OAAxF;AAAA,CAFA,EAICpB,MAAM,CAACqB,KAJR,EAMCf,UAAU,CAACgB,kBANZ,EAWFV,SAAS,CAACW,OAXR,EAaX,UAACN,KAAD;AAAA,SAAYA,KAAK,CAACO,QAAN,IAAkBX,QAAQ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K,UAAA,SAAS,EAAC;AAAf,UATF,eAWE,KAAC,mBAAD;AAAqB,UAAA,IAAI,EAAEvD,IAA3B;AAAiC,yBAAa,SAA9C;AAAA,oBACGmC,kBADH,aACGA,kBADH,gDACGA,kBAAkB,CAAEqB,WADvB,0DACG,sBAAiCC,GAAjC,CAAqC,UAACC,UAAD;AAAA,gCACpC,KAAC,UAAD;AAAY,cAAA,MAAM,EAAEA,UAAU,CAACJ,MAA/B;AAAuC,cAAA,OAAO,EAAC,WAA/C;AAA2D,cAAA,KAAK,EAAC,UAAjE;AAA4E,cAAA,wBAAwB,MAApG;AAAA,wBACGI,UAAU,CAACL;AADd,cADoC;AAAA,WAArC;AADH,UAXF;AAAA,QAvBJ;AAAA,MADF,eA8CE;AAAK,MAAA,OAAO,EAAE;AAAA,eAAMxB,WAAW,IAAIU,cAAc,CAAC,CAACT,WAAF,CAAnC;AAAA,OAAd;AAAA,iBACGO,QADH,eAGE;AAAK,QAAA,SAAS,EAAC;AAAf,QAHF;AAAA,MA9CF;AAAA,IADF;AAsDD,CAjFD;;;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;;AAsFF,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) =>\n props.size === Size.Small\n ? ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)\n : props.size === Size.Large\n ? ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)\n : ComponentXSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n`;\n\nconst LabelContainer = styled.div<{ size: Size }>`\n ${(props) =>\n props.size === Size.Small\n ? ComponentSStyling(ComponentTextStyle.Bold, null)\n : props.size === Size.Large\n ? ComponentLStyling(ComponentTextStyle.Bold, null)\n : 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) =>\n props.showOnClick\n ? `${Container} {\n visibility: ${props.showPopover ? 'visible' : 'hidden'};\n opacity: ${props.showPopover ? '1' : '0'};\n }\n cursor: pointer;`\n : `&:hover {\n ${Container} {\n visibility: visible;\n opacity: 1;\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 } 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 size = Size.Medium,\n topSectionProps,\n bottomSectionProps,\n mainContent,\n children,\n position,\n showOnClick = false,\n showArrowPointer = false,\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 && <NoteContainer size={size}>{topSectionProps.note}</NoteContainer>}\n <LabelContainer size={size}>{topSectionProps?.text}</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}>{mainContent}</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 <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 </Wrapper>\n );\n};\n\nexport default Popover;\n"],"file":"Popover.js"}
|
|
@@ -56,6 +56,7 @@ var ToggleButton = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
56
56
|
props.onChange(!active);
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
+
id: props.id,
|
|
59
60
|
iconColor: active ? (_props$activeState$co = (_props$activeState = props.activeState) === null || _props$activeState === void 0 ? void 0 : _props$activeState.color) !== null && _props$activeState$co !== void 0 ? _props$activeState$co : props.defaultState.color : props.defaultState.color,
|
|
60
61
|
disabled: props.disabled,
|
|
61
62
|
children: active ? (_props$activeState$ic = (_props$activeState2 = props.activeState) === null || _props$activeState2 === void 0 ? void 0 : _props$activeState2.icon) !== null && _props$activeState$ic !== void 0 ? _props$activeState$ic : props.defaultState.icon : props.defaultState.icon
|
|
@@ -65,6 +66,7 @@ var ToggleButton = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
65
66
|
|
|
66
67
|
exports.ToggleButton = ToggleButton;
|
|
67
68
|
ToggleButton.propTypes = {
|
|
69
|
+
id: _propTypes.default.string,
|
|
68
70
|
active: _propTypes.default.bool.isRequired,
|
|
69
71
|
onChange: _propTypes.default.func,
|
|
70
72
|
disabled: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Toggles/ToggleButton.tsx"],"names":["Wrapper","styled","div","IconButtonContent","COLORS","white","primary_500","neutral_300","ToggleButton","React","forwardRef","props","ref","useState","active","setActive","useEffect","cls","activeState","disabled","onChange","color","defaultState","icon"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,OAAO,GAAGC,0BAAOC,GAAV,okBACTC,6BADS,EAOPA,6BAPO,EAQOC,eAAOC,KARd,EAaPF,6BAbO,EAkBaC,eAAOE,WAlBpB,EA0BPH,6BA1BO,EA2BOC,eAAOG,WA3Bd,CAAb;;
|
|
1
|
+
{"version":3,"sources":["../../src/Toggles/ToggleButton.tsx"],"names":["Wrapper","styled","div","IconButtonContent","COLORS","white","primary_500","neutral_300","ToggleButton","React","forwardRef","props","ref","useState","active","setActive","useEffect","cls","activeState","disabled","onChange","id","color","defaultState","icon"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,OAAO,GAAGC,0BAAOC,GAAV,okBACTC,6BADS,EAOPA,6BAPO,EAQOC,eAAOC,KARd,EAaPF,6BAbO,EAkBaC,eAAOE,WAlBpB,EA0BPH,6BA1BO,EA2BOC,eAAOG,WA3Bd,CAAb;;AA+CO,IAAMC,YAAY,gBAAGC,eAAMC,UAAN,CAAiB,UAACC,KAAD,EAA2BC,GAA3B,EAAiE;AAAA;;AAC5G,wBAA4BH,eAAMI,QAAN,CAAe,KAAf,CAA5B;AAAA;AAAA,MAAOC,MAAP;AAAA,MAAeC,SAAf;;AAEAN,iBAAMO,SAAN,CAAgB;AAAA,WAAMD,SAAS,CAACJ,KAAK,CAACG,MAAP,CAAf;AAAA,GAAhB,EAA+C,CAACH,KAAK,CAACG,MAAP,CAA/C;;AAEA,MAAMG,GAAG,aAAMH,MAAM,GAAG,QAAH,GAAc,EAA1B,cAAgCH,KAAK,CAACO,WAAN,GAAoB,cAApB,GAAqC,EAArE,cAA2EP,KAAK,CAACQ,QAAN,GAAiB,UAAjB,GAA8B,EAAzG,CAAT;AAEA,sBACE,qBAAC,OAAD;AAAS,IAAA,SAAS,EAAEF,GAApB;AAAA,2BACE,qBAAC,kBAAD;AACE,MAAA,OAAO,EAAE,WADX;AAEE,MAAA,GAAG,EAAEL,GAFP;AAGE,MAAA,wBAAwB,EAAE,IAH5B;AAIE,MAAA,KAAK,EAAE,UAJT;AAKE,MAAA,MAAM,EAAE,kBAAM;AACZG,QAAAA,SAAS,CAAC,CAACD,MAAF,CAAT;;AACA,YAAIH,KAAK,CAACS,QAAV,EAAoB;AAClBT,UAAAA,KAAK,CAACS,QAAN,CAAe,CAACN,MAAhB;AACD;AACF,OAVH;AAWE,MAAA,EAAE,EAAEH,KAAK,CAACU,EAXZ;AAYE,MAAA,SAAS,EAAEP,MAAM,kDAAGH,KAAK,CAACO,WAAT,uDAAG,mBAAmBI,KAAtB,yEAA+BX,KAAK,CAACY,YAAN,CAAmBD,KAAlD,GAA0DX,KAAK,CAACY,YAAN,CAAmBD,KAZhG;AAaE,MAAA,QAAQ,EAAEX,KAAK,CAACQ,QAblB;AAAA,gBAcGL,MAAM,mDAAGH,KAAK,CAACO,WAAT,wDAAG,oBAAmBM,IAAtB,yEAA8Bb,KAAK,CAACY,YAAN,CAAmBC,IAAjD,GAAwDb,KAAK,CAACY,YAAN,CAAmBC;AAdpF;AADF,IADF;AAoBD,CA3B2B,CAArB;;;;AATLH,EAAAA,E;AACAP,EAAAA,M;AACAM,EAAAA,Q;AACAD,EAAAA,Q;AAEAI,EAAAA,Y;AAVAC,IAAAA,I;AACAF,IAAAA,K;;AAUAJ,EAAAA,W;AAXAM,IAAAA,I;AACAF,IAAAA,K;;;eA0Cad,Y","sourcesContent":["import React from 'react';\nimport { IconButton } from '../Button';\nimport styled from 'styled-components';\nimport { IconButtonContent } from '../Button/Iconbutton';\nimport { COLORS } from '../styles';\n\nconst Wrapper = styled.div`\n ${IconButtonContent} {\n transition: all 0.1s ease-in-out;\n }\n\n &.disabled,\n &.active:not(.state-change) {\n ${IconButtonContent} {\n background: ${COLORS.white};\n }\n }\n\n &.active:not(.state-change) {\n ${IconButtonContent}:after {\n content: '';\n position: absolute;\n left: 12px;\n bottom: 1px;\n background-color: ${COLORS.primary_500};\n border-radius: 4px;\n height: 4px;\n width: 24px;\n }\n }\n\n &.disabled:not(.state-change) {\n ${IconButtonContent}:after {\n background: ${COLORS.neutral_300};\n }\n }\n`;\n\nexport interface ToggleButtonState {\n icon: React.ReactNode;\n color?: string;\n}\n\nexport interface ToggleButtonProps {\n id?: string;\n active: boolean;\n onChange?: (value: boolean) => void;\n disabled?: boolean;\n\n defaultState: ToggleButtonState;\n activeState?: ToggleButtonState;\n}\n\nexport const ToggleButton = React.forwardRef((props: ToggleButtonProps, ref: React.Ref<HTMLButtonElement>) => {\n const [active, setActive] = React.useState(false);\n\n React.useEffect(() => setActive(props.active), [props.active]);\n\n const cls = `${active ? 'active' : ''} ${props.activeState ? 'state-change' : ''} ${props.disabled ? 'disabled' : ''}`;\n\n return (\n <Wrapper className={cls}>\n <IconButton\n variant={'secondary'}\n ref={ref}\n useTransparentBackground={true}\n shape={'circular'}\n action={() => {\n setActive(!active);\n if (props.onChange) {\n props.onChange(!active);\n }\n }}\n id={props.id}\n iconColor={active ? props.activeState?.color ?? props.defaultState.color : props.defaultState.color}\n disabled={props.disabled}>\n {active ? props.activeState?.icon ?? props.defaultState.icon : props.defaultState.icon}\n </IconButton>\n </Wrapper>\n );\n});\n\nexport default ToggleButton;\n"],"file":"ToggleButton.cjs"}
|
|
@@ -37,6 +37,7 @@ export var ToggleButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
37
37
|
props.onChange(!active);
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
+
id: props.id,
|
|
40
41
|
iconColor: active ? (_props$activeState$co = (_props$activeState = props.activeState) === null || _props$activeState === void 0 ? void 0 : _props$activeState.color) !== null && _props$activeState$co !== void 0 ? _props$activeState$co : props.defaultState.color : props.defaultState.color,
|
|
41
42
|
disabled: props.disabled,
|
|
42
43
|
children: active ? (_props$activeState$ic = (_props$activeState2 = props.activeState) === null || _props$activeState2 === void 0 ? void 0 : _props$activeState2.icon) !== null && _props$activeState$ic !== void 0 ? _props$activeState$ic : props.defaultState.icon : props.defaultState.icon
|
|
@@ -44,6 +45,7 @@ export var ToggleButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
44
45
|
});
|
|
45
46
|
});
|
|
46
47
|
ToggleButton.propTypes = {
|
|
48
|
+
id: _pt.string,
|
|
47
49
|
active: _pt.bool.isRequired,
|
|
48
50
|
onChange: _pt.func,
|
|
49
51
|
disabled: _pt.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Toggles/ToggleButton.tsx"],"names":["React","IconButton","styled","IconButtonContent","COLORS","Wrapper","div","white","primary_500","neutral_300","ToggleButton","forwardRef","props","ref","useState","active","setActive","useEffect","cls","activeState","disabled","onChange","color","defaultState","icon"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/Toggles/ToggleButton.tsx"],"names":["React","IconButton","styled","IconButtonContent","COLORS","Wrapper","div","white","primary_500","neutral_300","ToggleButton","forwardRef","props","ref","useState","active","setActive","useEffect","cls","activeState","disabled","onChange","id","color","defaultState","icon"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,iBAAT,QAAkC,sBAAlC;AACA,SAASC,MAAT,QAAuB,WAAvB;;AAEA,IAAMC,OAAO,GAAGH,MAAM,CAACI,GAAV,sjBACTH,iBADS,EAOPA,iBAPO,EAQOC,MAAM,CAACG,KARd,EAaPJ,iBAbO,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Q,QAblB;AAAA,gBAcGL,MAAM,mDAAGH,KAAK,CAACO,WAAT,wDAAG,oBAAmBM,IAAtB,yEAA8Bb,KAAK,CAACY,YAAN,CAAmBC,IAAjD,GAAwDb,KAAK,CAACY,YAAN,CAAmBC;AAdpF;AADF,IADF;AAoBD,CA3B2B,CAArB;;AATLH,EAAAA,E;AACAP,EAAAA,M;AACAM,EAAAA,Q;AACAD,EAAAA,Q;AAEAI,EAAAA,Y;AAVAC,IAAAA,I;AACAF,IAAAA,K;;AAUAJ,EAAAA,W;AAXAM,IAAAA,I;AACAF,IAAAA,K;;;AA0CF,eAAeb,YAAf","sourcesContent":["import React from 'react';\nimport { IconButton } from '../Button';\nimport styled from 'styled-components';\nimport { IconButtonContent } from '../Button/Iconbutton';\nimport { COLORS } from '../styles';\n\nconst Wrapper = styled.div`\n ${IconButtonContent} {\n transition: all 0.1s ease-in-out;\n }\n\n &.disabled,\n &.active:not(.state-change) {\n ${IconButtonContent} {\n background: ${COLORS.white};\n }\n }\n\n &.active:not(.state-change) {\n ${IconButtonContent}:after {\n content: '';\n position: absolute;\n left: 12px;\n bottom: 1px;\n background-color: ${COLORS.primary_500};\n border-radius: 4px;\n height: 4px;\n width: 24px;\n }\n }\n\n &.disabled:not(.state-change) {\n ${IconButtonContent}:after {\n background: ${COLORS.neutral_300};\n }\n }\n`;\n\nexport interface ToggleButtonState {\n icon: React.ReactNode;\n color?: string;\n}\n\nexport interface ToggleButtonProps {\n id?: string;\n active: boolean;\n onChange?: (value: boolean) => void;\n disabled?: boolean;\n\n defaultState: ToggleButtonState;\n activeState?: ToggleButtonState;\n}\n\nexport const ToggleButton = React.forwardRef((props: ToggleButtonProps, ref: React.Ref<HTMLButtonElement>) => {\n const [active, setActive] = React.useState(false);\n\n React.useEffect(() => setActive(props.active), [props.active]);\n\n const cls = `${active ? 'active' : ''} ${props.activeState ? 'state-change' : ''} ${props.disabled ? 'disabled' : ''}`;\n\n return (\n <Wrapper className={cls}>\n <IconButton\n variant={'secondary'}\n ref={ref}\n useTransparentBackground={true}\n shape={'circular'}\n action={() => {\n setActive(!active);\n if (props.onChange) {\n props.onChange(!active);\n }\n }}\n id={props.id}\n iconColor={active ? props.activeState?.color ?? props.defaultState.color : props.defaultState.color}\n disabled={props.disabled}>\n {active ? props.activeState?.icon ?? props.defaultState.icon : props.defaultState.icon}\n </IconButton>\n </Wrapper>\n );\n});\n\nexport default ToggleButton;\n"],"file":"ToggleButton.js"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
4
|
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -9,10 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
9
|
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
10
|
var React = _interopRequireWildcard(require("react"));
|
|
17
11
|
|
|
18
12
|
var _TogglerStyles = require("./TogglerStyles");
|
|
@@ -23,17 +17,18 @@ var _common = require("../common");
|
|
|
23
17
|
|
|
24
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
19
|
|
|
26
|
-
var _excluded = ["id", "disabled", "selected", "label", "isSemantic", "size", "onToggle", "className"];
|
|
27
|
-
|
|
28
20
|
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); }
|
|
29
21
|
|
|
30
22
|
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; }
|
|
31
23
|
|
|
32
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Import React libraries.
|
|
26
|
+
*/
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Import custom styles.
|
|
30
|
+
*/
|
|
31
|
+
var ToggleSwitch = function ToggleSwitch(_ref) {
|
|
37
32
|
var _size;
|
|
38
33
|
|
|
39
34
|
var id = _ref.id,
|
|
@@ -42,9 +37,7 @@ var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
42
37
|
label = _ref.label,
|
|
43
38
|
isSemantic = _ref.isSemantic,
|
|
44
39
|
size = _ref.size,
|
|
45
|
-
onToggle = _ref.onToggle
|
|
46
|
-
className = _ref.className,
|
|
47
|
-
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
40
|
+
onToggle = _ref.onToggle;
|
|
48
41
|
|
|
49
42
|
/**
|
|
50
43
|
* Does all required pre-requisites and toggles the switcher state.
|
|
@@ -56,21 +49,21 @@ var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
56
49
|
onToggle(!selected);
|
|
57
50
|
};
|
|
58
51
|
|
|
59
|
-
var focusVisibleRef = (0, _common.useFocusVisibleRef)(
|
|
52
|
+
var focusVisibleRef = (0, _common.useFocusVisibleRef)();
|
|
60
53
|
size = (_size = size) !== null && _size !== void 0 ? _size : _.Size.Medium;
|
|
61
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_TogglerStyles.StyledSwitch,
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_TogglerStyles.StyledSwitch, {
|
|
62
55
|
ref: focusVisibleRef,
|
|
63
56
|
onClick: function onClick(e) {
|
|
64
57
|
return toggle();
|
|
65
58
|
},
|
|
66
|
-
|
|
67
|
-
return
|
|
59
|
+
onKeyUp: function onKeyUp(e) {
|
|
60
|
+
return e.key === 'Enter' && toggle();
|
|
68
61
|
},
|
|
69
|
-
className: size.toString().toLowerCase().concat(disabled ? ' disabled' : '')
|
|
62
|
+
className: size.toString().toLowerCase().concat(disabled ? ' disabled' : ''),
|
|
70
63
|
selected: selected,
|
|
71
|
-
tabIndex: disabled ? -1 : 0
|
|
72
|
-
}, rest), {}, {
|
|
64
|
+
tabIndex: disabled ? -1 : 0,
|
|
73
65
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TogglerStyles.ToggleSwitchContainer, {
|
|
66
|
+
id: "switchContainer",
|
|
74
67
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TogglerStyles.ToggleSwitch, {
|
|
75
68
|
className: isSemantic ? 'semantic' : ''
|
|
76
69
|
})
|
|
@@ -79,8 +72,9 @@ var ToggleSwitch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
79
72
|
htmlFor: id,
|
|
80
73
|
children: label
|
|
81
74
|
})]
|
|
82
|
-
})
|
|
83
|
-
}
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
84
78
|
var _default = ToggleSwitch;
|
|
85
79
|
exports.default = _default;
|
|
86
80
|
//# sourceMappingURL=ToggleSwitch.cjs.map
|