@laerdal/life-react-components 1.4.1-dev.20.full → 1.4.1-dev.23
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/Banners/Banner.cjs +83 -184
- package/dist/Banners/Banner.cjs.map +1 -1
- package/dist/Banners/Banner.d.ts +1 -0
- package/dist/Banners/Banner.js +83 -188
- package/dist/Banners/Banner.js.map +1 -1
- package/dist/Banners/styles.cjs +43 -7
- package/dist/Banners/styles.cjs.map +1 -1
- package/dist/Banners/styles.js +43 -7
- package/dist/Banners/styles.js.map +1 -1
- package/dist/Button/Button.cjs +27 -101
- package/dist/Button/Button.cjs.map +1 -1
- package/dist/Button/Button.js +27 -101
- package/dist/Button/Button.js.map +1 -1
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/ChipDropdownInput.cjs +2 -6
- package/dist/Dropdown/ChipDropdownInput.cjs.map +1 -1
- package/dist/Dropdown/ChipDropdownInput.js +2 -4
- package/dist/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/Dropdown/CommonStyling.cjs +3 -17
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.d.ts +0 -5
- package/dist/Dropdown/CommonStyling.js +3 -10
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +18 -52
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.js +19 -54
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/MenuItem/MenuItem.cjs +104 -0
- package/dist/MenuItem/MenuItem.cjs.map +1 -0
- package/dist/MenuItem/MenuItem.d.ts +21 -0
- package/dist/MenuItem/MenuItem.js +64 -0
- package/dist/MenuItem/MenuItem.js.map +1 -0
- package/dist/QuizButton/QuizButton.cjs +6 -6
- package/dist/QuizButton/QuizButton.cjs.map +1 -1
- package/dist/QuizButton/QuizButton.js +6 -6
- package/dist/QuizButton/QuizButton.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = exports.ItemLabel = exports.ItemIconOld = exports.ItemIcon = exports.ItemContent = exports.DropdownButtonCSS = exports.DropdownButton = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var React = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _styles = require("../styles");
|
|
21
|
+
|
|
22
|
+
var _types = require("../types");
|
|
23
|
+
|
|
24
|
+
var _typography = require("../styles/typography");
|
|
25
|
+
|
|
26
|
+
var _common = require("../common");
|
|
27
|
+
|
|
28
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
+
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
var DropdownButton = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n"])), function (props) {
|
|
37
|
+
return DropdownButtonCSS(props.size);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
exports.DropdownButton = DropdownButton;
|
|
41
|
+
|
|
42
|
+
var ItemLabel = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)([""])));
|
|
43
|
+
|
|
44
|
+
exports.ItemLabel = ItemLabel;
|
|
45
|
+
|
|
46
|
+
var ItemIcon = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)([""])));
|
|
47
|
+
|
|
48
|
+
exports.ItemIcon = ItemIcon;
|
|
49
|
+
|
|
50
|
+
var ItemIconOld = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)([""])));
|
|
51
|
+
|
|
52
|
+
exports.ItemIconOld = ItemIconOld;
|
|
53
|
+
|
|
54
|
+
var ItemContent = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n ", " {\n flex: 1 0 calc(100% - 40px); \n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n ", " {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n"])), ItemLabel, ItemIcon, ItemIconOld);
|
|
55
|
+
|
|
56
|
+
exports.ItemContent = ItemContent;
|
|
57
|
+
|
|
58
|
+
var DropdownButtonCSS = function DropdownButtonCSS(size) {
|
|
59
|
+
return (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n ", "\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ", ";\n background-color: ", ";\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ", ";\n\n &.active {\n background: ", ";\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ", ";\n\n border-radius: 2px;\n }\n }\n\n &:disabled {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n "])), size == _types.Size.Small && (0, _typography.ComponentSStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Medium && (0, _typography.ComponentMStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Large && (0, _typography.ComponentLStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Large ? '64px' : size == _types.Size.Medium ? '56px' : '48px', _styles.COLORS.white, _common.CommonInteractionStyling, _styles.COLORS.neutral_20, _styles.COLORS.primary_500, _styles.COLORS.neutral_200, _styles.COLORS.primary_20, _styles.COLORS.primary_600, _styles.COLORS.primary_500, _styles.COLORS.primary_100, _styles.COLORS.primary_800, _styles.COLORS.primary_500);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
exports.DropdownButtonCSS = DropdownButtonCSS;
|
|
63
|
+
var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
64
|
+
var _item$displayLabel;
|
|
65
|
+
|
|
66
|
+
var active = _ref.active,
|
|
67
|
+
item = _ref.item,
|
|
68
|
+
onClickHandler = _ref.onClickHandler,
|
|
69
|
+
key = _ref.key,
|
|
70
|
+
size = _ref.size,
|
|
71
|
+
id = _ref.id;
|
|
72
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DropdownButton, {
|
|
73
|
+
type: "button",
|
|
74
|
+
size: size,
|
|
75
|
+
disabled: item.disabled,
|
|
76
|
+
ref: ref,
|
|
77
|
+
onClick: onClickHandler,
|
|
78
|
+
className: (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
|
|
79
|
+
id: id,
|
|
80
|
+
children: [item.showDividerAbove && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
81
|
+
className: "divider"
|
|
82
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ItemContent, {
|
|
83
|
+
children: [item.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemIcon, {
|
|
84
|
+
children: item.icon
|
|
85
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ItemLabel, {
|
|
86
|
+
children: [(_item$displayLabel = item.displayLabel) !== null && _item$displayLabel !== void 0 ? _item$displayLabel : item.value, item.noteLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
87
|
+
style: {
|
|
88
|
+
fontSize: '12px'
|
|
89
|
+
},
|
|
90
|
+
children: item.noteLabel
|
|
91
|
+
})]
|
|
92
|
+
})]
|
|
93
|
+
})]
|
|
94
|
+
}, key);
|
|
95
|
+
});
|
|
96
|
+
MenuItem.propTypes = {
|
|
97
|
+
onClickHandler: _propTypes.default.func.isRequired,
|
|
98
|
+
active: _propTypes.default.bool.isRequired,
|
|
99
|
+
id: _propTypes.default.string.isRequired,
|
|
100
|
+
key: _propTypes.default.string.isRequired
|
|
101
|
+
};
|
|
102
|
+
var _default = MenuItem;
|
|
103
|
+
exports.default = _default;
|
|
104
|
+
//# sourceMappingURL=MenuItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["DropdownButton","styled","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","ItemIconOld","ItemContent","css","Size","Small","ComponentTextStyle","Regular","COLORS","neutral_600","Medium","Large","white","CommonInteractionStyling","neutral_20","primary_500","neutral_200","primary_20","primary_600","primary_100","primary_800","MenuItem","React","forwardRef","ref","active","item","onClickHandler","key","id","disabled","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;;;;;;;;;;AAWO,IAAMA,cAAc,GAAGC,0BAAOC,MAAV,8FACvB,UAACC,KAAD;AAAA,SAAWC,iBAAiB,CAACD,KAAK,CAACE,IAAP,CAA5B;AAAA,CADuB,CAApB;;;;AAIA,IAAMC,SAAS,GAAGL,0BAAOM,GAAV,qFAAf;;;;AACA,IAAMC,QAAQ,GAAGP,0BAAOM,GAAV,qFAAd;;;;AACA,IAAME,WAAW,GAAGR,0BAAOM,GAAV,qFAAjB;;;;AAEA,IAAMG,WAAW,GAAGT,0BAAOM,GAAV,ybAKlBD,SALkB,EASlBE,QATkB,EAgBlBC,WAhBkB,CAAjB;;;;AAuBA,IAAML,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,IAAD,EAAiB;AAChD,aAAOM,qBAAP,gtCACIN,IAAI,IAAIO,YAAKC,KAAb,IAAsB,mCAAkBC,2BAAmBC,OAArC,EAA8CC,eAAOC,WAArD,CAD1B,EAE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hB;AAQI,IAAA,EAAE,EAAEI,EARR;AAAA,eASKH,IAAI,CAACK,gBAAL,iBAAyB;AAAK,MAAA,SAAS,EAAC;AAAf,MAT9B,eAUI,sBAAC,WAAD;AAAA,iBACGL,IAAI,CAACM,IAAL,iBAAa,qBAAC,QAAD;AAAA,kBAAWN,IAAI,CAACM;AAAhB,QADhB,eAEE,sBAAC,SAAD;AAAA,yCACKN,IAAI,CAACO,YADV,mEAC0BP,IAAI,CAACQ,KAD/B,EAEKR,IAAI,CAACS,SAAL,iBAAkB;AAAK,UAAA,KAAK,EAAE;AAAEC,YAAAA,QAAQ,EAAE;AAAZ,WAAZ;AAAA,oBAAmCV,IAAI,CAACS;AAAxC,UAFvB;AAAA,QAFF;AAAA,MAVJ;AAAA,KAOSP,GAPT,CADF;AAoBD,CA3BgB,CAAjB;;AAhHGD,EAAAA,c;AACAF,EAAAA,M;AACAI,EAAAA,E;AACAD,EAAAA,G;;eA0IYP,Q","sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ChevronRight} from '../icons/systemicons/SystemIcons';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport { CommonInteractionStyling } from '../common';\n\nexport interface MenuItemProps {\n item: DropdownItem;\n onClickHandler: (e: any) => void;\n active: boolean;\n id: string;\n key: string;\n size?: Size;\n}\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n ${(props) => DropdownButtonCSS(props.size)}\n`;\n\nexport const ItemLabel = styled.div``;\nexport const ItemIcon = styled.div``;\nexport const ItemIconOld = styled.div``;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px); \n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n ${ItemIconOld} {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n`;\n\nexport const DropdownButtonCSS = (size?: Size) => {\n return css`\n ${size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 2px;\n }\n }\n\n &:disabled {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_200};\n }\n\n &.active:hover {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n `;\n};\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n key,\n size,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled}\n ref={ref}\n onClick={onClickHandler}\n className={ (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : '')}\n key={key}\n id={id}>\n {item.showDividerAbove && <div className=\"divider\" />}\n <ItemContent>\n {item.icon && <ItemIcon>{item.icon}</ItemIcon>}\n <ItemLabel>\n {item.displayLabel ?? item.value}\n {item.noteLabel && <div style={{ fontSize: '12px' }}>{item.noteLabel}</div>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.cjs"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Size } from '../types';
|
|
3
|
+
import { DropdownItem } from '../Dropdown/DropdownContent';
|
|
4
|
+
export interface MenuItemProps {
|
|
5
|
+
item: DropdownItem;
|
|
6
|
+
onClickHandler: (e: any) => void;
|
|
7
|
+
active: boolean;
|
|
8
|
+
id: string;
|
|
9
|
+
key: string;
|
|
10
|
+
size?: Size;
|
|
11
|
+
}
|
|
12
|
+
export declare const DropdownButton: import("styled-components").StyledComponent<"button", any, {
|
|
13
|
+
size?: Size | undefined;
|
|
14
|
+
}, never>;
|
|
15
|
+
export declare const ItemLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
|
+
export declare const ItemIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
+
export declare const ItemIconOld: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const ItemContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
+
export declare const DropdownButtonCSS: (size?: Size | undefined) => import("styled-components").FlattenSimpleInterpolation;
|
|
20
|
+
declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
export default MenuItem;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
import _pt from "prop-types";
|
|
3
|
+
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
5
|
+
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { COLORS, ComponentTextStyle } from '../styles';
|
|
9
|
+
import { Size } from '../types';
|
|
10
|
+
import { ComponentLStyling, ComponentMStyling, ComponentSStyling } from '../styles/typography';
|
|
11
|
+
import { CommonInteractionStyling } from '../common';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
export var DropdownButton = styled.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (props) {
|
|
15
|
+
return DropdownButtonCSS(props.size);
|
|
16
|
+
});
|
|
17
|
+
export var ItemLabel = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
|
|
18
|
+
export var ItemIcon = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
|
19
|
+
export var ItemIconOld = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral([""])));
|
|
20
|
+
export var ItemContent = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n ", " {\n flex: 1 0 calc(100% - 40px); \n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n ", " {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n"])), ItemLabel, ItemIcon, ItemIconOld);
|
|
21
|
+
export var DropdownButtonCSS = function DropdownButtonCSS(size) {
|
|
22
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ", ";\n background-color: ", ";\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ", ";\n\n &.active {\n background: ", ";\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ", ";\n\n border-radius: 2px;\n }\n }\n\n &:disabled {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n "])), size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px', COLORS.white, CommonInteractionStyling, COLORS.neutral_20, COLORS.primary_500, COLORS.neutral_200, COLORS.primary_20, COLORS.primary_600, COLORS.primary_500, COLORS.primary_100, COLORS.primary_800, COLORS.primary_500);
|
|
23
|
+
};
|
|
24
|
+
var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
25
|
+
var _item$displayLabel;
|
|
26
|
+
|
|
27
|
+
var active = _ref.active,
|
|
28
|
+
item = _ref.item,
|
|
29
|
+
onClickHandler = _ref.onClickHandler,
|
|
30
|
+
key = _ref.key,
|
|
31
|
+
size = _ref.size,
|
|
32
|
+
id = _ref.id;
|
|
33
|
+
return /*#__PURE__*/_jsxs(DropdownButton, {
|
|
34
|
+
type: "button",
|
|
35
|
+
size: size,
|
|
36
|
+
disabled: item.disabled,
|
|
37
|
+
ref: ref,
|
|
38
|
+
onClick: onClickHandler,
|
|
39
|
+
className: (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
|
|
40
|
+
id: id,
|
|
41
|
+
children: [item.showDividerAbove && /*#__PURE__*/_jsx("div", {
|
|
42
|
+
className: "divider"
|
|
43
|
+
}), /*#__PURE__*/_jsxs(ItemContent, {
|
|
44
|
+
children: [item.icon && /*#__PURE__*/_jsx(ItemIcon, {
|
|
45
|
+
children: item.icon
|
|
46
|
+
}), /*#__PURE__*/_jsxs(ItemLabel, {
|
|
47
|
+
children: [(_item$displayLabel = item.displayLabel) !== null && _item$displayLabel !== void 0 ? _item$displayLabel : item.value, item.noteLabel && /*#__PURE__*/_jsx("div", {
|
|
48
|
+
style: {
|
|
49
|
+
fontSize: '12px'
|
|
50
|
+
},
|
|
51
|
+
children: item.noteLabel
|
|
52
|
+
})]
|
|
53
|
+
})]
|
|
54
|
+
})]
|
|
55
|
+
}, key);
|
|
56
|
+
});
|
|
57
|
+
MenuItem.propTypes = {
|
|
58
|
+
onClickHandler: _pt.func.isRequired,
|
|
59
|
+
active: _pt.bool.isRequired,
|
|
60
|
+
id: _pt.string.isRequired,
|
|
61
|
+
key: _pt.string.isRequired
|
|
62
|
+
};
|
|
63
|
+
export default MenuItem;
|
|
64
|
+
//# sourceMappingURL=MenuItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["React","styled","css","COLORS","ComponentTextStyle","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","CommonInteractionStyling","DropdownButton","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","ItemIconOld","ItemContent","Small","Regular","neutral_600","Medium","Large","white","neutral_20","primary_500","neutral_200","primary_20","primary_600","primary_100","primary_800","MenuItem","forwardRef","ref","active","item","onClickHandler","key","id","disabled","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,MAAP,IAAiBC,GAAjB,QAA4B,mBAA5B;AACA,SAAqBC,MAArB,EAA6BC,kBAA7B,QAAsD,WAAtD;AAEA,SAAiBC,IAAjB,QAA4B,UAA5B;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,QAAsE,sBAAtE;AAEA,SAASC,wBAAT,QAAyC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A,MAVJ;AAAA,KAOSP,GAPT,CADF;AAoBD,CA3BgB,CAAjB;;AAhHGD,EAAAA,c;AACAF,EAAAA,M;AACAI,EAAAA,E;AACAD,EAAAA,G;;AA0IH,eAAeN,QAAf","sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ChevronRight} from '../icons/systemicons/SystemIcons';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport { CommonInteractionStyling } from '../common';\n\nexport interface MenuItemProps {\n item: DropdownItem;\n onClickHandler: (e: any) => void;\n active: boolean;\n id: string;\n key: string;\n size?: Size;\n}\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n ${(props) => DropdownButtonCSS(props.size)}\n`;\n\nexport const ItemLabel = styled.div``;\nexport const ItemIcon = styled.div``;\nexport const ItemIconOld = styled.div``;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px); \n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n ${ItemIconOld} {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n`;\n\nexport const DropdownButtonCSS = (size?: Size) => {\n return css`\n ${size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 2px;\n }\n }\n\n &:disabled {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_200};\n }\n\n &.active:hover {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n `;\n};\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n key,\n size,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled}\n ref={ref}\n onClick={onClickHandler}\n className={ (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : '')}\n key={key}\n id={id}>\n {item.showDividerAbove && <div className=\"divider\" />}\n <ItemContent>\n {item.icon && <ItemIcon>{item.icon}</ItemIcon>}\n <ItemLabel>\n {item.displayLabel ?? item.value}\n {item.noteLabel && <div style={{ fontSize: '12px' }}>{item.noteLabel}</div>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.js"}
|
|
@@ -37,13 +37,13 @@ var TextContainer = _styledComponents.default.div(_templateObject || (_templateO
|
|
|
37
37
|
|
|
38
38
|
var TextWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)([""])));
|
|
39
39
|
|
|
40
|
-
var ButtonContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 8px 0 0 8px;\n display: flex;\n background: ", ";\n\n width: ", ";\n\n transition: background 100ms ease-in-out;\n\n .quiz-button-result-icon {\n height: ", ";\n width: ", ";\n }\n\n .radio-button-icon, .checkbox-icon {\n margin: auto;\n min-width: unset;\n background: transparent;\n\n &:hover {\n background: transparent;\n }\n\n &:focus {\n background: transparent;\n }\n\n &:active {\n background: transparent;\n }\n }\n\n .small
|
|
40
|
+
var ButtonContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 8px 0 0 8px;\n display: flex;\n background: ", ";\n\n width: ", ";\n\n transition: background 100ms ease-in-out;\n\n .quiz-button-result-icon {\n height: ", ";\n width: ", ";\n }\n\n .radio-button-icon, .checkbox-icon {\n margin: auto;\n min-width: unset;\n background: transparent;\n\n svg {\n color: ", ";\n }\n\n &:hover {\n background: transparent;\n }\n\n &:focus {\n background: transparent;\n }\n\n &:active {\n background: transparent;\n }\n }\n\n .small {\n min-width: 32px;\n min-height: 32px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 16px;\n width: 16px;\n }\n }\n }\n\n .medium {\n min-width: 48px;\n min-height: 48px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 24px;\n width: 24px;\n }\n }\n }\n\n .large {\n min-width: 64px;\n min-height: 64px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 32px;\n width: 32px;\n }\n }\n }\n"])), _.COLORS.accent1_100, function (props) {
|
|
41
41
|
return props.size === _.Size.Small ? '32px' : props.size === _.Size.Large ? '64px' : '48px';
|
|
42
42
|
}, function (props) {
|
|
43
43
|
return props.size === _.Size.Small ? '16px' : props.size === _.Size.Large ? '32px' : '24px';
|
|
44
44
|
}, function (props) {
|
|
45
|
-
return props.size === _.Size.Small ? '
|
|
46
|
-
});
|
|
45
|
+
return props.size === _.Size.Small ? '32px' : props.size === _.Size.Large ? '64px' : '48px';
|
|
46
|
+
}, _.COLORS.accent1_600);
|
|
47
47
|
|
|
48
48
|
var OptionContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n cursor: pointer;\n max-width: 65ch; \n word-break: break-word;\n\n min-height: ", ";\n margin-bottom: ", ";\n\n &.selected {\n ", " {\n background: ", ";\n }\n ", " {\n background: ", ";\n }\n }\n \n &.disabled {\n cursor: not-allowed;\n \n ", " {\n pointer-events: none;\n background: ", ";\n }\n ", " {\n pointer-events: none;\n background: ", ";\n color: ", ";\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &.correct {\n ", " { \n background: ", ";\n }\n ", " {\n background: ", ";\n svg {\n margin: auto;\n }\n }\n }\n\n &.incorrect {\n ", " { \n background: ", ";\n }\n ", " {\n background: ", ";\n svg {\n margin: auto;\n }\n }\n }\n\n &.partial {\n ", " { \n background: ", ";\n }\n ", " {\n background: ", ";\n svg {\n margin: auto;\n }\n }\n } \n\n &:hover,\n &.hover-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:focus,\n &.focus-state {\n box-shadow: 0px 4px 12px ", ", 0px 0px 8px ", ";\n border-radius: 8px;\n outline: none;\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active,\n &.active-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:hover:not(.disabled):not(.result),\n &.hover-state {\n ", " {\n background: ", ";\n }\n ", " {\n background: ", ";\n }\n \n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ", ";\n }\n }\n }\n\n &:focus:not(.disabled):not(.result),\n &.focus-state {\n ", " {\n background: ", ";\n }\n ", " {\n background: ", ";\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active:not(.disabled):not(.result),\n &.active-state {\n ", " {\n background: ", ";\n transition: none;\n }\n ", " {\n background: ", ";\n transition: none;\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ", ";\n }\n }\n }\n"])), function (props) {
|
|
49
49
|
return props.size === _.Size.Small ? '32px' : props.size === _.Size.Large ? '64px' : '48px';
|
|
@@ -51,13 +51,13 @@ var OptionContainer = _styledComponents.default.div(_templateObject4 || (_templa
|
|
|
51
51
|
return props.size === _.Size.Small ? '16px' : props.size === _.Size.Large ? '32px' : '24px';
|
|
52
52
|
}, TextContainer, _.COLORS.accent1_100, ButtonContainer, _.COLORS.accent1_200, ButtonContainer, _.COLORS.neutral_100, TextContainer, _.COLORS.neutral_20, _.COLORS.neutral_300, TextContainer, _.COLORS.correct_20, ButtonContainer, _.COLORS.correct_400, TextContainer, _.COLORS.critical_20, ButtonContainer, _.COLORS.critical_500, TextContainer, _.COLORS.warning_20, ButtonContainer, _.COLORS.warning_400, _.COLORS.focus_25, _.COLORS.focus, ButtonContainer, _.COLORS.accent1_300, TextContainer, function (props) {
|
|
53
53
|
return props.isSelected ? _.COLORS.accent1_200 : _.COLORS.accent1_100;
|
|
54
|
-
}, _.COLORS.
|
|
54
|
+
}, _.COLORS.accent1_700, ButtonContainer, function (props) {
|
|
55
55
|
return props.isSelected ? _.COLORS.accent1_200 : _.COLORS.accent1_100;
|
|
56
56
|
}, TextContainer, function (props) {
|
|
57
57
|
return props.isSelected ? _.COLORS.accent1_100 : _.COLORS.accent1_20;
|
|
58
58
|
}, ButtonContainer, _.COLORS.accent1_400, TextContainer, function (props) {
|
|
59
59
|
return props.isSelected ? _.COLORS.accent1_300 : _.COLORS.accent1_200;
|
|
60
|
-
}, _.COLORS.
|
|
60
|
+
}, _.COLORS.accent1_800);
|
|
61
61
|
|
|
62
62
|
var renderResultContent = function renderResultContent(resultType) {
|
|
63
63
|
switch (resultType) {
|
|
@@ -97,7 +97,7 @@ var QuizButton = function QuizButton(_ref) {
|
|
|
97
97
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(OptionContainer, {
|
|
98
98
|
onClick: onClick,
|
|
99
99
|
isSelected: selected,
|
|
100
|
-
tabIndex: disabled || resultType ? -1 :
|
|
100
|
+
tabIndex: disabled || resultType ? -1 : 0,
|
|
101
101
|
onMouseDown: function onMouseDown(e) {
|
|
102
102
|
return e.preventDefault();
|
|
103
103
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/QuizButton/QuizButton.tsx"],"names":["TextContainer","styled","div","COLORS","accent1_20","props","size","Size","Small","Large","ComponentTextStyle","Regular","TextWrapper","ButtonContainer","accent1_100","OptionContainer","accent1_200","neutral_100","neutral_20","neutral_300","correct_20","correct_400","critical_20","critical_500","warning_20","warning_400","focus_25","focus","accent1_300","isSelected","primary_700","accent1_400","primary_800","renderResultContent","resultType","white","QuizButton","text","type","onClick","id","className","selected","disabled","Medium","e","preventDefault","concat"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,aAAa,GAAGC,0BAAOC,GAAV,+QAGHC,SAAOC,UAHJ,EASN,UAAAC,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaC,OAAKC,KAAlB,GAAwB,SAAxB,GAAmCH,KAAK,CAACC,IAAN,KAAaC,OAAKE,KAAlB,GAAwB,WAAxB,GAAoC,WAAzE;AAAA,CATC,EAUf,UAAAJ,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaC,OAAKC,KAAlB,GAA0B,mCAAkBE,+BAAmBC,OAArC,EAA6C,IAA7C,CAA1B,GAAgFN,KAAK,CAACC,IAAN,KAAaC,OAAKE,KAAlB,GAA0B,mCAAkBC,+BAAmBC,OAArC,EAA6C,IAA7C,CAA1B,GAA+E,mCAAkBD,+BAAmBC,OAArC,EAA6C,IAA7C,CAAjK;AAAA,CAVU,CAAnB;;AAaA,IAAMC,WAAW,GAAGX,0BAAOC,GAAV,qFAAjB;;AAEA,IAAMW,eAAe,GAAGZ,0BAAOC,GAAV,kjCAGLC,SAAOW,WAHF,EAKV,UAAAT,KAAK;AAA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gBAEI4B,UAAU,GAAGD,mBAAmB,CAACC,UAAD,CAAtB,GACUI,IAAI,KAAG,OAAP,gBAAiB,qBAAC,aAAD;AAAa,QAAA,QAAQ,EAAEI,QAAvB;AAAiC,QAAA,QAAQ,EAAEC,QAA3C;AAAqD,QAAA,IAAI,EAAErC,IAA3D;AAAiE,QAAA,WAAW,EAAE,CAAC,CAA/E;AACjB,QAAA,MAAM,EAAE,kBAAI,CAAE,CADG;AACD,QAAA,EAAE,EAAEkC;AADH,QAAjB,gBAC4B,qBAAC,UAAD;AAAU,QAAA,QAAQ,EAAEE,QAApB;AAA8B,QAAA,QAAQ,EAAEC,QAAxC;AAAkD,QAAA,IAAI,EAAErC,IAAxD;AAA8D,QAAA,WAAW,EAAE,CAAC,CAA5E;AAC5B,QAAA,MAAM,EAAE,kBAAI,CAAE,CADc;AACZ,QAAA,EAAE,EAAEkC;AADQ;AAJpD,MANJ,eAgBI,qBAAC,aAAD;AAAe,qBAAa,cAA5B;AAA4C,MAAA,SAAS,EAAE,kBAAvD;AAA2E,MAAA,IAAI,EAAElC,IAAjF;AAAA,6BACE,qBAAC,WAAD;AAAa,QAAA,IAAI,EAAEA,IAAnB;AAAA,kBACG+B;AADH;AADF,MAhBJ;AAAA,IADF;AAwBD,CAzBD;;;AAXEH,EAAAA,U,4BAAa,S,EAAY,W,EAAc,S;AACvCG,EAAAA,I;AACAE,EAAAA,O;AACAC,EAAAA,E;AACAE,EAAAA,Q;AACAC,EAAAA,Q;AAEAL,EAAAA,I,4BAAM,O,EAAU,U;AAChBG,EAAAA,S;;eA8BaL,U","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { Checkbox, COLORS, RadioButton, Size, SystemIcons } from '..';\nimport { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\nconst TextContainer = styled.div<{size: Size}>`\n border-radius: 0 8px 8px 0;\n display: flex;\n background: ${COLORS.accent1_20};\n width: 100%;\n\n transition: background 100ms ease-in-out;\n align-items: center;\n\n padding: ${props=>props.size===Size.Small?'6px 8px':(props.size===Size.Large?'20px 16px':'12px 16px')};\n ${props=>props.size===Size.Small ? ComponentSStyling(ComponentTextStyle.Regular,null) : (props.size===Size.Large ? ComponentLStyling(ComponentTextStyle.Regular,null) : ComponentMStyling(ComponentTextStyle.Regular,null))}\n`;\n\nconst TextWrapper = styled.div<{size:Size}>``;\n\nconst ButtonContainer = styled.div<{size: Size}>`\n border-radius: 8px 0 0 8px;\n display: flex;\n background: ${COLORS.accent1_100};\n\n width: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n\n transition: background 100ms ease-in-out;\n\n .quiz-button-result-icon {\n height: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n width: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n }\n\n .radio-button-icon, .checkbox-icon {\n margin: auto;\n min-width: unset;\n background: transparent;\n\n &:hover {\n background: transparent;\n }\n\n &:focus {\n background: transparent;\n }\n\n &:active {\n background: transparent;\n }\n }\n\n .small, .medium, .large {\n min-height: unset;\n min-width: unset;\n }\n\n .small {\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 16px;\n width: 16px;\n }\n }\n }\n\n .medium {\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 24px;\n width: 24px;\n }\n }\n }\n\n .large {\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 32px;\n width: 32px;\n }\n }\n }\n`;\n\nconst OptionContainer = styled.div<{isSelected:boolean, size:Size}>`\n display: flex;\n flex-direction: row;\n cursor: pointer;\n max-width: 65ch; \n word-break: break-word;\n\n min-height: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n margin-bottom: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n\n &.selected {\n ${TextContainer} {\n background: ${COLORS.accent1_100};\n }\n ${ButtonContainer} {\n background: ${COLORS.accent1_200};\n }\n }\n \n &.disabled {\n cursor: not-allowed;\n \n ${ButtonContainer} {\n pointer-events: none;\n background: ${COLORS.neutral_100};\n }\n ${TextContainer} {\n pointer-events: none;\n background: ${COLORS.neutral_20};\n color: ${COLORS.neutral_300};\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &.correct {\n ${TextContainer} { \n background: ${COLORS.correct_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.correct_400};\n svg {\n margin: auto;\n }\n }\n }\n\n &.incorrect {\n ${TextContainer} { \n background: ${COLORS.critical_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.critical_500};\n svg {\n margin: auto;\n }\n }\n }\n\n &.partial {\n ${TextContainer} { \n background: ${COLORS.warning_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.warning_400};\n svg {\n margin: auto;\n }\n }\n } \n\n &:hover,\n &.hover-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:focus,\n &.focus-state {\n box-shadow: 0px 4px 12px ${COLORS.focus_25}, 0px 0px 8px ${COLORS.focus};\n border-radius: 8px;\n outline: none;\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active,\n &.active-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:hover:not(.disabled):not(.result),\n &.hover-state {\n ${ButtonContainer} {\n background: ${COLORS.accent1_300};\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100};\n }\n \n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ${COLORS.primary_700};\n }\n }\n }\n\n &:focus:not(.disabled):not(.result),\n &.focus-state {\n ${ButtonContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100};\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_100 : COLORS.accent1_20};\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active:not(.disabled):not(.result),\n &.active-state {\n ${ButtonContainer} {\n background: ${COLORS.accent1_400};\n transition: none;\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_300 : COLORS.accent1_200};\n transition: none;\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ${COLORS.primary_800};\n }\n }\n }\n`;\n\nconst renderResultContent = (resultType: string) => {\n switch(resultType){\n case 'correct' : return <SystemIcons.CheckComplete color={COLORS.white} className={'quiz-button-result-icon'}/>;\n\n case 'incorrect' : return <SystemIcons.Close color={COLORS.white} className={'quiz-button-result-icon'}/>;\n\n default : return <SystemIcons.Close color={COLORS.white} className={'quiz-button-result-icon'}/>;\n }\n};\n\ntype QuizButtonProps = {\n resultType?: 'correct' | 'incorrect' | 'partial';\n text: string;\n onClick?: (arg:any)=>void;\n id: string;\n selected?: boolean;\n disabled?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n type: 'radio' | 'checkbox';\n className?: string;\n}\n\nconst QuizButton: React.FunctionComponent<QuizButtonProps> = ({text, type, onClick, resultType, id, className, selected=false, disabled=false, size=Size.Medium}) => {\n return ( \n <OptionContainer onClick={onClick} isSelected={selected} tabIndex={(disabled || resultType )?-1 : 1} onMouseDown={e=>e.preventDefault()} size={size}\n className={'quiz-button '.concat(selected?' selected':'')\n .concat(disabled?' disabled':'')\n .concat(resultType?' result '+resultType:'')\n .concat(className?' ' + className:'')}\n data-testid={'container'}>\n <ButtonContainer data-testid={'btnContainer'} className={'quiz-button-icon'} size={size}>\n {\n resultType ? renderResultContent(resultType) : (\n type==='radio' ? <RadioButton selected={selected} disabled={disabled} size={size} tabIndexVal={-1}\n select={()=>{}} id={id}/> : <Checkbox selected={selected} disabled={disabled} size={size} tabIndexVal={-1}\n select={()=>{}} id={id}/>\n )\n }\n </ButtonContainer>\n\n <TextContainer data-testid={'txtContainer'} className={'quiz-button-text'} size={size}>\n <TextWrapper size={size}>\n {text}\n </TextWrapper>\n </TextContainer>\n </OptionContainer>\n );\n};\n\nexport default QuizButton;"],"file":"QuizButton.cjs"}
|
|
1
|
+
{"version":3,"sources":["../../src/QuizButton/QuizButton.tsx"],"names":["TextContainer","styled","div","COLORS","accent1_20","props","size","Size","Small","Large","ComponentTextStyle","Regular","TextWrapper","ButtonContainer","accent1_100","accent1_600","OptionContainer","accent1_200","neutral_100","neutral_20","neutral_300","correct_20","correct_400","critical_20","critical_500","warning_20","warning_400","focus_25","focus","accent1_300","isSelected","accent1_700","accent1_400","accent1_800","renderResultContent","resultType","white","QuizButton","text","type","onClick","id","className","selected","disabled","Medium","e","preventDefault","concat"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,aAAa,GAAGC,0BAAOC,GAAV,+QAGHC,SAAOC,UAHJ,EASN,UAAAC,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaC,OAAKC,KAAlB,GAAwB,SAAxB,GAAmCH,KAAK,CAACC,IAAN,KAAaC,OAAKE,KAAlB,GAAwB,WAAxB,GAAoC,WAAzE;AAAA,CATC,EAUf,UAAAJ,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaC,OAAKC,KAAlB,GAA0B,mCAAkBE,+BAAmBC,OAArC,EAA6C,IAA7C,CAA1B,GAAgFN,KAAK,CAACC,IAAN,KAAaC,OAAKE,KAAlB,GAA0B,mCAAkBC,+BAAmBC,OAArC,EAA6C,IAA7C,CAA1B,GAA+E,mCAAkBD,+BAAmBC,OAArC,EAA6C,IAA7C,CAAjK;AAAA,CAVU,CAAnB;;AAaA,IAAMC,WAAW,GAAGX,0BAAOC,GAAV,qFAAjB;;AAEA,IAAMW,eAAe,GAAGZ,0BAAOC,GAAV,8oCAGLC,SAAOW,WAHF,EAKV,UAAAT,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaC,OAAKC,KAAlB,GAAwB,MAAxB,GAAgCH,KAAK,CAACC,IAAN,KAAaC,OAAKE,KAAlB,GAAwB,MAAxB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QAAA,QAAQ,EAAEI,QAAvB;AAAiC,QAAA,QAAQ,EAAEC,QAA3C;AAAqD,QAAA,IAAI,EAAEtC,IAA3D;AAAiE,QAAA,WAAW,EAAE,CAAC,CAA/E;AACjB,QAAA,MAAM,EAAE,kBAAI,CAAE,CADG;AACD,QAAA,EAAE,EAAEmC;AADH,QAAjB,gBAC4B,qBAAC,UAAD;AAAU,QAAA,QAAQ,EAAEE,QAApB;AAA8B,QAAA,QAAQ,EAAEC,QAAxC;AAAkD,QAAA,IAAI,EAAEtC,IAAxD;AAA8D,QAAA,WAAW,EAAE,CAAC,CAA5E;AAC5B,QAAA,MAAM,EAAE,kBAAI,CAAE,CADc;AACZ,QAAA,EAAE,EAAEmC;AADQ;AAJpD,MANJ,eAgBI,qBAAC,aAAD;AAAe,qBAAa,cAA5B;AAA4C,MAAA,SAAS,EAAE,kBAAvD;AAA2E,MAAA,IAAI,EAAEnC,IAAjF;AAAA,6BACE,qBAAC,WAAD;AAAa,QAAA,IAAI,EAAEA,IAAnB;AAAA,kBACGgC;AADH;AADF,MAhBJ;AAAA,IADF;AAwBD,CAzBD;;;AAXEH,EAAAA,U,4BAAa,S,EAAY,W,EAAc,S;AACvCG,EAAAA,I;AACAE,EAAAA,O;AACAC,EAAAA,E;AACAE,EAAAA,Q;AACAC,EAAAA,Q;AAEAL,EAAAA,I,4BAAM,O,EAAU,U;AAChBG,EAAAA,S;;eA8BaL,U","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { Checkbox, COLORS, RadioButton, Size, SystemIcons } from '..';\nimport { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\nconst TextContainer = styled.div<{size: Size}>`\n border-radius: 0 8px 8px 0;\n display: flex;\n background: ${COLORS.accent1_20};\n width: 100%;\n\n transition: background 100ms ease-in-out;\n align-items: center;\n\n padding: ${props=>props.size===Size.Small?'6px 8px':(props.size===Size.Large?'20px 16px':'12px 16px')};\n ${props=>props.size===Size.Small ? ComponentSStyling(ComponentTextStyle.Regular,null) : (props.size===Size.Large ? ComponentLStyling(ComponentTextStyle.Regular,null) : ComponentMStyling(ComponentTextStyle.Regular,null))}\n`;\n\nconst TextWrapper = styled.div<{size:Size}>``;\n\nconst ButtonContainer = styled.div<{size: Size}>`\n border-radius: 8px 0 0 8px;\n display: flex;\n background: ${COLORS.accent1_100};\n\n width: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n\n transition: background 100ms ease-in-out;\n\n .quiz-button-result-icon {\n height: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n width: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n }\n\n .radio-button-icon, .checkbox-icon {\n margin: auto;\n min-width: unset;\n background: transparent;\n\n svg {\n color: ${COLORS.accent1_600};\n }\n\n &:hover {\n background: transparent;\n }\n\n &:focus {\n background: transparent;\n }\n\n &:active {\n background: transparent;\n }\n }\n\n .small {\n min-width: 32px;\n min-height: 32px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 16px;\n width: 16px;\n }\n }\n }\n\n .medium {\n min-width: 48px;\n min-height: 48px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 24px;\n width: 24px;\n }\n }\n }\n\n .large {\n min-width: 64px;\n min-height: 64px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 32px;\n width: 32px;\n }\n }\n }\n`;\n\nconst OptionContainer = styled.div<{isSelected:boolean, size:Size}>`\n display: flex;\n flex-direction: row;\n cursor: pointer;\n max-width: 65ch; \n word-break: break-word;\n\n min-height: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n margin-bottom: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n\n &.selected {\n ${TextContainer} {\n background: ${COLORS.accent1_100};\n }\n ${ButtonContainer} {\n background: ${COLORS.accent1_200};\n }\n }\n \n &.disabled {\n cursor: not-allowed;\n \n ${ButtonContainer} {\n pointer-events: none;\n background: ${COLORS.neutral_100};\n }\n ${TextContainer} {\n pointer-events: none;\n background: ${COLORS.neutral_20};\n color: ${COLORS.neutral_300};\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &.correct {\n ${TextContainer} { \n background: ${COLORS.correct_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.correct_400};\n svg {\n margin: auto;\n }\n }\n }\n\n &.incorrect {\n ${TextContainer} { \n background: ${COLORS.critical_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.critical_500};\n svg {\n margin: auto;\n }\n }\n }\n\n &.partial {\n ${TextContainer} { \n background: ${COLORS.warning_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.warning_400};\n svg {\n margin: auto;\n }\n }\n } \n\n &:hover,\n &.hover-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:focus,\n &.focus-state {\n box-shadow: 0px 4px 12px ${COLORS.focus_25}, 0px 0px 8px ${COLORS.focus};\n border-radius: 8px;\n outline: none;\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active,\n &.active-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:hover:not(.disabled):not(.result),\n &.hover-state {\n ${ButtonContainer} {\n background: ${COLORS.accent1_300};\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100};\n }\n \n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ${COLORS.accent1_700};\n }\n }\n }\n\n &:focus:not(.disabled):not(.result),\n &.focus-state {\n ${ButtonContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100};\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_100 : COLORS.accent1_20};\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active:not(.disabled):not(.result),\n &.active-state {\n ${ButtonContainer} {\n background: ${COLORS.accent1_400};\n transition: none;\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_300 : COLORS.accent1_200};\n transition: none;\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ${COLORS.accent1_800};\n }\n }\n }\n`;\n\nconst renderResultContent = (resultType: string) => {\n switch(resultType){\n case 'correct' : return <SystemIcons.CheckComplete color={COLORS.white} className={'quiz-button-result-icon'}/>;\n\n case 'incorrect' : return <SystemIcons.Close color={COLORS.white} className={'quiz-button-result-icon'}/>;\n\n default : return <SystemIcons.Close color={COLORS.white} className={'quiz-button-result-icon'}/>;\n }\n};\n\ntype QuizButtonProps = {\n resultType?: 'correct' | 'incorrect' | 'partial';\n text: string;\n onClick?: (arg:any)=>void;\n id: string;\n selected?: boolean;\n disabled?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n type: 'radio' | 'checkbox';\n className?: string;\n}\n\nconst QuizButton: React.FunctionComponent<QuizButtonProps> = ({text, type, onClick, resultType, id, className, selected=false, disabled=false, size=Size.Medium}) => {\n return ( \n <OptionContainer onClick={onClick} isSelected={selected} tabIndex={(disabled || resultType )?-1 : 0} onMouseDown={e=>e.preventDefault()} size={size}\n className={'quiz-button '.concat(selected?' selected':'')\n .concat(disabled?' disabled':'')\n .concat(resultType?' result '+resultType:'')\n .concat(className?' ' + className:'')}\n data-testid={'container'}>\n <ButtonContainer data-testid={'btnContainer'} className={'quiz-button-icon'} size={size}>\n {\n resultType ? renderResultContent(resultType) : (\n type==='radio' ? <RadioButton selected={selected} disabled={disabled} size={size} tabIndexVal={-1}\n select={()=>{}} id={id}/> : <Checkbox selected={selected} disabled={disabled} size={size} tabIndexVal={-1}\n select={()=>{}} id={id}/>\n )\n }\n </ButtonContainer>\n\n <TextContainer data-testid={'txtContainer'} className={'quiz-button-text'} size={size}>\n <TextWrapper size={size}>\n {text}\n </TextWrapper>\n </TextContainer>\n </OptionContainer>\n );\n};\n\nexport default QuizButton;"],"file":"QuizButton.cjs"}
|
|
@@ -15,26 +15,26 @@ var TextContainer = styled.div(_templateObject || (_templateObject = _taggedTemp
|
|
|
15
15
|
return props.size === Size.Small ? ComponentSStyling(ComponentTextStyle.Regular, null) : props.size === Size.Large ? ComponentLStyling(ComponentTextStyle.Regular, null) : ComponentMStyling(ComponentTextStyle.Regular, null);
|
|
16
16
|
});
|
|
17
17
|
var TextWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
|
|
18
|
-
var ButtonContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-radius: 8px 0 0 8px;\n display: flex;\n background: ", ";\n\n width: ", ";\n\n transition: background 100ms ease-in-out;\n\n .quiz-button-result-icon {\n height: ", ";\n width: ", ";\n }\n\n .radio-button-icon, .checkbox-icon {\n margin: auto;\n min-width: unset;\n background: transparent;\n\n &:hover {\n background: transparent;\n }\n\n &:focus {\n background: transparent;\n }\n\n &:active {\n background: transparent;\n }\n }\n\n .small
|
|
18
|
+
var ButtonContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-radius: 8px 0 0 8px;\n display: flex;\n background: ", ";\n\n width: ", ";\n\n transition: background 100ms ease-in-out;\n\n .quiz-button-result-icon {\n height: ", ";\n width: ", ";\n }\n\n .radio-button-icon, .checkbox-icon {\n margin: auto;\n min-width: unset;\n background: transparent;\n\n svg {\n color: ", ";\n }\n\n &:hover {\n background: transparent;\n }\n\n &:focus {\n background: transparent;\n }\n\n &:active {\n background: transparent;\n }\n }\n\n .small {\n min-width: 32px;\n min-height: 32px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 16px;\n width: 16px;\n }\n }\n }\n\n .medium {\n min-width: 48px;\n min-height: 48px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 24px;\n width: 24px;\n }\n }\n }\n\n .large {\n min-width: 64px;\n min-height: 64px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 32px;\n width: 32px;\n }\n }\n }\n"])), COLORS.accent1_100, function (props) {
|
|
19
19
|
return props.size === Size.Small ? '32px' : props.size === Size.Large ? '64px' : '48px';
|
|
20
20
|
}, function (props) {
|
|
21
21
|
return props.size === Size.Small ? '16px' : props.size === Size.Large ? '32px' : '24px';
|
|
22
22
|
}, function (props) {
|
|
23
|
-
return props.size === Size.Small ? '
|
|
24
|
-
});
|
|
23
|
+
return props.size === Size.Small ? '32px' : props.size === Size.Large ? '64px' : '48px';
|
|
24
|
+
}, COLORS.accent1_600);
|
|
25
25
|
var OptionContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n cursor: pointer;\n max-width: 65ch; \n word-break: break-word;\n\n min-height: ", ";\n margin-bottom: ", ";\n\n &.selected {\n ", " {\n background: ", ";\n }\n ", " {\n background: ", ";\n }\n }\n \n &.disabled {\n cursor: not-allowed;\n \n ", " {\n pointer-events: none;\n background: ", ";\n }\n ", " {\n pointer-events: none;\n background: ", ";\n color: ", ";\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &.correct {\n ", " { \n background: ", ";\n }\n ", " {\n background: ", ";\n svg {\n margin: auto;\n }\n }\n }\n\n &.incorrect {\n ", " { \n background: ", ";\n }\n ", " {\n background: ", ";\n svg {\n margin: auto;\n }\n }\n }\n\n &.partial {\n ", " { \n background: ", ";\n }\n ", " {\n background: ", ";\n svg {\n margin: auto;\n }\n }\n } \n\n &:hover,\n &.hover-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:focus,\n &.focus-state {\n box-shadow: 0px 4px 12px ", ", 0px 0px 8px ", ";\n border-radius: 8px;\n outline: none;\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active,\n &.active-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:hover:not(.disabled):not(.result),\n &.hover-state {\n ", " {\n background: ", ";\n }\n ", " {\n background: ", ";\n }\n \n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ", ";\n }\n }\n }\n\n &:focus:not(.disabled):not(.result),\n &.focus-state {\n ", " {\n background: ", ";\n }\n ", " {\n background: ", ";\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active:not(.disabled):not(.result),\n &.active-state {\n ", " {\n background: ", ";\n transition: none;\n }\n ", " {\n background: ", ";\n transition: none;\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ", ";\n }\n }\n }\n"])), function (props) {
|
|
26
26
|
return props.size === Size.Small ? '32px' : props.size === Size.Large ? '64px' : '48px';
|
|
27
27
|
}, function (props) {
|
|
28
28
|
return props.size === Size.Small ? '16px' : props.size === Size.Large ? '32px' : '24px';
|
|
29
29
|
}, TextContainer, COLORS.accent1_100, ButtonContainer, COLORS.accent1_200, ButtonContainer, COLORS.neutral_100, TextContainer, COLORS.neutral_20, COLORS.neutral_300, TextContainer, COLORS.correct_20, ButtonContainer, COLORS.correct_400, TextContainer, COLORS.critical_20, ButtonContainer, COLORS.critical_500, TextContainer, COLORS.warning_20, ButtonContainer, COLORS.warning_400, COLORS.focus_25, COLORS.focus, ButtonContainer, COLORS.accent1_300, TextContainer, function (props) {
|
|
30
30
|
return props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100;
|
|
31
|
-
}, COLORS.
|
|
31
|
+
}, COLORS.accent1_700, ButtonContainer, function (props) {
|
|
32
32
|
return props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100;
|
|
33
33
|
}, TextContainer, function (props) {
|
|
34
34
|
return props.isSelected ? COLORS.accent1_100 : COLORS.accent1_20;
|
|
35
35
|
}, ButtonContainer, COLORS.accent1_400, TextContainer, function (props) {
|
|
36
36
|
return props.isSelected ? COLORS.accent1_300 : COLORS.accent1_200;
|
|
37
|
-
}, COLORS.
|
|
37
|
+
}, COLORS.accent1_800);
|
|
38
38
|
|
|
39
39
|
var renderResultContent = function renderResultContent(resultType) {
|
|
40
40
|
switch (resultType) {
|
|
@@ -74,7 +74,7 @@ var QuizButton = function QuizButton(_ref) {
|
|
|
74
74
|
return /*#__PURE__*/_jsxs(OptionContainer, {
|
|
75
75
|
onClick: onClick,
|
|
76
76
|
isSelected: selected,
|
|
77
|
-
tabIndex: disabled || resultType ? -1 :
|
|
77
|
+
tabIndex: disabled || resultType ? -1 : 0,
|
|
78
78
|
onMouseDown: function onMouseDown(e) {
|
|
79
79
|
return e.preventDefault();
|
|
80
80
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/QuizButton/QuizButton.tsx"],"names":["React","styled","Checkbox","COLORS","RadioButton","Size","SystemIcons","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentTextStyle","TextContainer","div","accent1_20","props","size","Small","Large","Regular","TextWrapper","ButtonContainer","accent1_100","OptionContainer","accent1_200","neutral_100","neutral_20","neutral_300","correct_20","correct_400","critical_20","critical_500","warning_20","warning_400","focus_25","focus","accent1_300","isSelected","primary_700","accent1_400","primary_800","renderResultContent","resultType","white","QuizButton","text","type","onClick","id","className","selected","disabled","Medium","e","preventDefault","concat"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,WAA3B,EAAwCC,IAAxC,EAA8CC,WAA9C,QAAiE,IAAjE;AACA,SAASC,iBAAT,EAA4BC,iBAA5B,EAA+CC,iBAA/C,EAAkEC,kBAAlE,QAA4F,sBAA5F;;;AAEA,IAAMC,aAAa,GAAGV,MAAM,CAACW,GAAV,iQAGHT,MAAM,CAACU,UAHJ,EASN,UAAAC,KAAK;AAAA,SAAEA,KAAK,CAACC,IAAN,KAAaV,IAAI,CAACW,KAAlB,GAAwB,SAAxB,GAAmCF,KAAK,CAACC,IAAN,KAAaV,IAAI,CAACY,KAAlB,GAAwB,WAAxB,GAAoC,WAAzE;AAAA,CATC,EAUf,UA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,QAAA,EAAE,EAAEgC;AADQ;AAJpD,MANJ,eAgBI,KAAC,aAAD;AAAe,qBAAa,cAA5B;AAA4C,MAAA,SAAS,EAAE,kBAAvD;AAA2E,MAAA,IAAI,EAAEhC,IAAjF;AAAA,6BACE,KAAC,WAAD;AAAa,QAAA,IAAI,EAAEA,IAAnB;AAAA,kBACG6B;AADH;AADF,MAhBJ;AAAA,IADF;AAwBD,CAzBD;;;AAXEH,EAAAA,U,aAAa,S,EAAY,W,EAAc,S;AACvCG,EAAAA,I;AACAE,EAAAA,O;AACAC,EAAAA,E;AACAE,EAAAA,Q;AACAC,EAAAA,Q;AAEAL,EAAAA,I,aAAM,O,EAAU,U;AAChBG,EAAAA,S;;AA8BF,eAAeL,UAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { Checkbox, COLORS, RadioButton, Size, SystemIcons } from '..';\nimport { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\nconst TextContainer = styled.div<{size: Size}>`\n border-radius: 0 8px 8px 0;\n display: flex;\n background: ${COLORS.accent1_20};\n width: 100%;\n\n transition: background 100ms ease-in-out;\n align-items: center;\n\n padding: ${props=>props.size===Size.Small?'6px 8px':(props.size===Size.Large?'20px 16px':'12px 16px')};\n ${props=>props.size===Size.Small ? ComponentSStyling(ComponentTextStyle.Regular,null) : (props.size===Size.Large ? ComponentLStyling(ComponentTextStyle.Regular,null) : ComponentMStyling(ComponentTextStyle.Regular,null))}\n`;\n\nconst TextWrapper = styled.div<{size:Size}>``;\n\nconst ButtonContainer = styled.div<{size: Size}>`\n border-radius: 8px 0 0 8px;\n display: flex;\n background: ${COLORS.accent1_100};\n\n width: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n\n transition: background 100ms ease-in-out;\n\n .quiz-button-result-icon {\n height: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n width: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n }\n\n .radio-button-icon, .checkbox-icon {\n margin: auto;\n min-width: unset;\n background: transparent;\n\n &:hover {\n background: transparent;\n }\n\n &:focus {\n background: transparent;\n }\n\n &:active {\n background: transparent;\n }\n }\n\n .small, .medium, .large {\n min-height: unset;\n min-width: unset;\n }\n\n .small {\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 16px;\n width: 16px;\n }\n }\n }\n\n .medium {\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 24px;\n width: 24px;\n }\n }\n }\n\n .large {\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 32px;\n width: 32px;\n }\n }\n }\n`;\n\nconst OptionContainer = styled.div<{isSelected:boolean, size:Size}>`\n display: flex;\n flex-direction: row;\n cursor: pointer;\n max-width: 65ch; \n word-break: break-word;\n\n min-height: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n margin-bottom: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n\n &.selected {\n ${TextContainer} {\n background: ${COLORS.accent1_100};\n }\n ${ButtonContainer} {\n background: ${COLORS.accent1_200};\n }\n }\n \n &.disabled {\n cursor: not-allowed;\n \n ${ButtonContainer} {\n pointer-events: none;\n background: ${COLORS.neutral_100};\n }\n ${TextContainer} {\n pointer-events: none;\n background: ${COLORS.neutral_20};\n color: ${COLORS.neutral_300};\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &.correct {\n ${TextContainer} { \n background: ${COLORS.correct_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.correct_400};\n svg {\n margin: auto;\n }\n }\n }\n\n &.incorrect {\n ${TextContainer} { \n background: ${COLORS.critical_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.critical_500};\n svg {\n margin: auto;\n }\n }\n }\n\n &.partial {\n ${TextContainer} { \n background: ${COLORS.warning_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.warning_400};\n svg {\n margin: auto;\n }\n }\n } \n\n &:hover,\n &.hover-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:focus,\n &.focus-state {\n box-shadow: 0px 4px 12px ${COLORS.focus_25}, 0px 0px 8px ${COLORS.focus};\n border-radius: 8px;\n outline: none;\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active,\n &.active-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:hover:not(.disabled):not(.result),\n &.hover-state {\n ${ButtonContainer} {\n background: ${COLORS.accent1_300};\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100};\n }\n \n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ${COLORS.primary_700};\n }\n }\n }\n\n &:focus:not(.disabled):not(.result),\n &.focus-state {\n ${ButtonContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100};\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_100 : COLORS.accent1_20};\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active:not(.disabled):not(.result),\n &.active-state {\n ${ButtonContainer} {\n background: ${COLORS.accent1_400};\n transition: none;\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_300 : COLORS.accent1_200};\n transition: none;\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ${COLORS.primary_800};\n }\n }\n }\n`;\n\nconst renderResultContent = (resultType: string) => {\n switch(resultType){\n case 'correct' : return <SystemIcons.CheckComplete color={COLORS.white} className={'quiz-button-result-icon'}/>;\n\n case 'incorrect' : return <SystemIcons.Close color={COLORS.white} className={'quiz-button-result-icon'}/>;\n\n default : return <SystemIcons.Close color={COLORS.white} className={'quiz-button-result-icon'}/>;\n }\n};\n\ntype QuizButtonProps = {\n resultType?: 'correct' | 'incorrect' | 'partial';\n text: string;\n onClick?: (arg:any)=>void;\n id: string;\n selected?: boolean;\n disabled?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n type: 'radio' | 'checkbox';\n className?: string;\n}\n\nconst QuizButton: React.FunctionComponent<QuizButtonProps> = ({text, type, onClick, resultType, id, className, selected=false, disabled=false, size=Size.Medium}) => {\n return ( \n <OptionContainer onClick={onClick} isSelected={selected} tabIndex={(disabled || resultType )?-1 : 1} onMouseDown={e=>e.preventDefault()} size={size}\n className={'quiz-button '.concat(selected?' selected':'')\n .concat(disabled?' disabled':'')\n .concat(resultType?' result '+resultType:'')\n .concat(className?' ' + className:'')}\n data-testid={'container'}>\n <ButtonContainer data-testid={'btnContainer'} className={'quiz-button-icon'} size={size}>\n {\n resultType ? renderResultContent(resultType) : (\n type==='radio' ? <RadioButton selected={selected} disabled={disabled} size={size} tabIndexVal={-1}\n select={()=>{}} id={id}/> : <Checkbox selected={selected} disabled={disabled} size={size} tabIndexVal={-1}\n select={()=>{}} id={id}/>\n )\n }\n </ButtonContainer>\n\n <TextContainer data-testid={'txtContainer'} className={'quiz-button-text'} size={size}>\n <TextWrapper size={size}>\n {text}\n </TextWrapper>\n </TextContainer>\n </OptionContainer>\n );\n};\n\nexport default QuizButton;"],"file":"QuizButton.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/QuizButton/QuizButton.tsx"],"names":["React","styled","Checkbox","COLORS","RadioButton","Size","SystemIcons","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentTextStyle","TextContainer","div","accent1_20","props","size","Small","Large","Regular","TextWrapper","ButtonContainer","accent1_100","accent1_600","OptionContainer","accent1_200","neutral_100","neutral_20","neutral_300","correct_20","correct_400","critical_20","critical_500","warning_20","warning_400","focus_25","focus","accent1_300","isSelected","accent1_700","accent1_400","accent1_800","renderResultContent","resultType","white","QuizButton","text","type","onClick","id","className","selected","disabled","Medium","e","preventDefault","concat"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAS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AG,OAAP,gBAAiB,KAAC,WAAD;AAAa,QAAA,QAAQ,EAAEI,QAAvB;AAAiC,QAAA,QAAQ,EAAEC,QAA3C;AAAqD,QAAA,IAAI,EAAEpC,IAA3D;AAAiE,QAAA,WAAW,EAAE,CAAC,CAA/E;AACjB,QAAA,MAAM,EAAE,kBAAI,CAAE,CADG;AACD,QAAA,EAAE,EAAEiC;AADH,QAAjB,gBAC4B,KAAC,QAAD;AAAU,QAAA,QAAQ,EAAEE,QAApB;AAA8B,QAAA,QAAQ,EAAEC,QAAxC;AAAkD,QAAA,IAAI,EAAEpC,IAAxD;AAA8D,QAAA,WAAW,EAAE,CAAC,CAA5E;AAC5B,QAAA,MAAM,EAAE,kBAAI,CAAE,CADc;AACZ,QAAA,EAAE,EAAEiC;AADQ;AAJpD,MANJ,eAgBI,KAAC,aAAD;AAAe,qBAAa,cAA5B;AAA4C,MAAA,SAAS,EAAE,kBAAvD;AAA2E,MAAA,IAAI,EAAEjC,IAAjF;AAAA,6BACE,KAAC,WAAD;AAAa,QAAA,IAAI,EAAEA,IAAnB;AAAA,kBACG8B;AADH;AADF,MAhBJ;AAAA,IADF;AAwBD,CAzBD;;;AAXEH,EAAAA,U,aAAa,S,EAAY,W,EAAc,S;AACvCG,EAAAA,I;AACAE,EAAAA,O;AACAC,EAAAA,E;AACAE,EAAAA,Q;AACAC,EAAAA,Q;AAEAL,EAAAA,I,aAAM,O,EAAU,U;AAChBG,EAAAA,S;;AA8BF,eAAeL,UAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport { Checkbox, COLORS, RadioButton, Size, SystemIcons } from '..';\nimport { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';\n\nconst TextContainer = styled.div<{size: Size}>`\n border-radius: 0 8px 8px 0;\n display: flex;\n background: ${COLORS.accent1_20};\n width: 100%;\n\n transition: background 100ms ease-in-out;\n align-items: center;\n\n padding: ${props=>props.size===Size.Small?'6px 8px':(props.size===Size.Large?'20px 16px':'12px 16px')};\n ${props=>props.size===Size.Small ? ComponentSStyling(ComponentTextStyle.Regular,null) : (props.size===Size.Large ? ComponentLStyling(ComponentTextStyle.Regular,null) : ComponentMStyling(ComponentTextStyle.Regular,null))}\n`;\n\nconst TextWrapper = styled.div<{size:Size}>``;\n\nconst ButtonContainer = styled.div<{size: Size}>`\n border-radius: 8px 0 0 8px;\n display: flex;\n background: ${COLORS.accent1_100};\n\n width: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n\n transition: background 100ms ease-in-out;\n\n .quiz-button-result-icon {\n height: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n width: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n }\n\n .radio-button-icon, .checkbox-icon {\n margin: auto;\n min-width: unset;\n background: transparent;\n\n svg {\n color: ${COLORS.accent1_600};\n }\n\n &:hover {\n background: transparent;\n }\n\n &:focus {\n background: transparent;\n }\n\n &:active {\n background: transparent;\n }\n }\n\n .small {\n min-width: 32px;\n min-height: 32px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 16px;\n width: 16px;\n }\n }\n }\n\n .medium {\n min-width: 48px;\n min-height: 48px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 24px;\n width: 24px;\n }\n }\n }\n\n .large {\n min-width: 64px;\n min-height: 64px;\n .radio-button-icon, .checkbox-icon {\n svg {\n height: 32px;\n width: 32px;\n }\n }\n }\n`;\n\nconst OptionContainer = styled.div<{isSelected:boolean, size:Size}>`\n display: flex;\n flex-direction: row;\n cursor: pointer;\n max-width: 65ch; \n word-break: break-word;\n\n min-height: ${props=>props.size===Size.Small?'32px':(props.size===Size.Large?'64px':'48px')};\n margin-bottom: ${props=>props.size===Size.Small?'16px':(props.size===Size.Large?'32px':'24px')};\n\n &.selected {\n ${TextContainer} {\n background: ${COLORS.accent1_100};\n }\n ${ButtonContainer} {\n background: ${COLORS.accent1_200};\n }\n }\n \n &.disabled {\n cursor: not-allowed;\n \n ${ButtonContainer} {\n pointer-events: none;\n background: ${COLORS.neutral_100};\n }\n ${TextContainer} {\n pointer-events: none;\n background: ${COLORS.neutral_20};\n color: ${COLORS.neutral_300};\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &.correct {\n ${TextContainer} { \n background: ${COLORS.correct_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.correct_400};\n svg {\n margin: auto;\n }\n }\n }\n\n &.incorrect {\n ${TextContainer} { \n background: ${COLORS.critical_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.critical_500};\n svg {\n margin: auto;\n }\n }\n }\n\n &.partial {\n ${TextContainer} { \n background: ${COLORS.warning_20};\n }\n ${ButtonContainer} {\n background: ${COLORS.warning_400};\n svg {\n margin: auto;\n }\n }\n } \n\n &:hover,\n &.hover-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:focus,\n &.focus-state {\n box-shadow: 0px 4px 12px ${COLORS.focus_25}, 0px 0px 8px ${COLORS.focus};\n border-radius: 8px;\n outline: none;\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active,\n &.active-state {\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:hover:not(.disabled):not(.result),\n &.hover-state {\n ${ButtonContainer} {\n background: ${COLORS.accent1_300};\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100};\n }\n \n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ${COLORS.accent1_700};\n }\n }\n }\n\n &:focus:not(.disabled):not(.result),\n &.focus-state {\n ${ButtonContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_200 : COLORS.accent1_100};\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_100 : COLORS.accent1_20};\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n }\n }\n\n &:active:not(.disabled):not(.result),\n &.active-state {\n ${ButtonContainer} {\n background: ${COLORS.accent1_400};\n transition: none;\n }\n ${TextContainer} {\n background: ${props=>props.isSelected ? COLORS.accent1_300 : COLORS.accent1_200};\n transition: none;\n }\n\n .radio-button-icon, .checkbox-icon {\n background: transparent;\n svg {\n color: ${COLORS.accent1_800};\n }\n }\n }\n`;\n\nconst renderResultContent = (resultType: string) => {\n switch(resultType){\n case 'correct' : return <SystemIcons.CheckComplete color={COLORS.white} className={'quiz-button-result-icon'}/>;\n\n case 'incorrect' : return <SystemIcons.Close color={COLORS.white} className={'quiz-button-result-icon'}/>;\n\n default : return <SystemIcons.Close color={COLORS.white} className={'quiz-button-result-icon'}/>;\n }\n};\n\ntype QuizButtonProps = {\n resultType?: 'correct' | 'incorrect' | 'partial';\n text: string;\n onClick?: (arg:any)=>void;\n id: string;\n selected?: boolean;\n disabled?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n type: 'radio' | 'checkbox';\n className?: string;\n}\n\nconst QuizButton: React.FunctionComponent<QuizButtonProps> = ({text, type, onClick, resultType, id, className, selected=false, disabled=false, size=Size.Medium}) => {\n return ( \n <OptionContainer onClick={onClick} isSelected={selected} tabIndex={(disabled || resultType )?-1 : 0} onMouseDown={e=>e.preventDefault()} size={size}\n className={'quiz-button '.concat(selected?' selected':'')\n .concat(disabled?' disabled':'')\n .concat(resultType?' result '+resultType:'')\n .concat(className?' ' + className:'')}\n data-testid={'container'}>\n <ButtonContainer data-testid={'btnContainer'} className={'quiz-button-icon'} size={size}>\n {\n resultType ? renderResultContent(resultType) : (\n type==='radio' ? <RadioButton selected={selected} disabled={disabled} size={size} tabIndexVal={-1}\n select={()=>{}} id={id}/> : <Checkbox selected={selected} disabled={disabled} size={size} tabIndexVal={-1}\n select={()=>{}} id={id}/>\n )\n }\n </ButtonContainer>\n\n <TextContainer data-testid={'txtContainer'} className={'quiz-button-text'} size={size}>\n <TextWrapper size={size}>\n {text}\n </TextWrapper>\n </TextContainer>\n </OptionContainer>\n );\n};\n\nexport default QuizButton;"],"file":"QuizButton.js"}
|