@laerdal/life-react-components 1.5.1-dev.3 → 1.5.1-dev.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/ContentAccordion.cjs +3 -3
- package/dist/Accordion/ContentAccordion.cjs.map +1 -1
- package/dist/Accordion/ContentAccordion.js +2 -3
- package/dist/Accordion/ContentAccordion.js.map +1 -1
- package/dist/Card/Card.cjs +101 -0
- package/dist/Card/Card.cjs.map +1 -0
- package/dist/Card/Card.d.ts +23 -0
- package/dist/Card/Card.js +74 -0
- package/dist/Card/Card.js.map +1 -0
- package/dist/Card/CardBottomSection.cjs +139 -0
- package/dist/Card/CardBottomSection.cjs.map +1 -0
- package/dist/Card/CardBottomSection.d.ts +22 -0
- package/dist/Card/CardBottomSection.js +109 -0
- package/dist/Card/CardBottomSection.js.map +1 -0
- package/dist/Card/CardMiddleSection.cjs +104 -0
- package/dist/Card/CardMiddleSection.cjs.map +1 -0
- package/dist/Card/CardMiddleSection.d.ts +14 -0
- package/dist/Card/CardMiddleSection.js +80 -0
- package/dist/Card/CardMiddleSection.js.map +1 -0
- package/dist/Card/CardTopSection.cjs +106 -0
- package/dist/Card/CardTopSection.cjs.map +1 -0
- package/dist/Card/CardTopSection.d.ts +17 -0
- package/dist/Card/CardTopSection.js +80 -0
- package/dist/Card/CardTopSection.js.map +1 -0
- package/dist/Card/index.cjs +52 -0
- package/dist/Card/index.cjs.map +1 -0
- package/dist/Card/index.d.ts +5 -0
- package/dist/Card/index.js +6 -0
- package/dist/Card/index.js.map +1 -0
- package/dist/Dropdown/BasicDropdown.cjs +8 -2
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.js +8 -2
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/CommonStyling.cjs +9 -17
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.d.ts +0 -3
- package/dist/Dropdown/CommonStyling.js +8 -12
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +15 -3
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.d.ts +1 -0
- package/dist/Dropdown/DropdownContent.js +15 -3
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +1 -0
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js +1 -0
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/Dropdown/index.cjs +8 -0
- package/dist/Dropdown/index.cjs.map +1 -1
- package/dist/Dropdown/index.d.ts +2 -1
- package/dist/Dropdown/index.js +2 -1
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/InputFields/Checkbox.cjs +5 -4
- package/dist/InputFields/Checkbox.cjs.map +1 -1
- package/dist/InputFields/Checkbox.d.ts +6 -0
- package/dist/InputFields/Checkbox.js +3 -4
- package/dist/InputFields/Checkbox.js.map +1 -1
- package/dist/InputFields/DatepickerField.cjs +48 -17
- package/dist/InputFields/DatepickerField.cjs.map +1 -1
- package/dist/InputFields/DatepickerField.js +47 -16
- package/dist/InputFields/DatepickerField.js.map +1 -1
- package/dist/InputFields/RadioButton.cjs +3 -3
- package/dist/InputFields/RadioButton.cjs.map +1 -1
- package/dist/InputFields/RadioButton.js +2 -3
- package/dist/InputFields/RadioButton.js.map +1 -1
- package/dist/InputFields/styling.cjs +2 -2
- package/dist/InputFields/styling.cjs.map +1 -1
- package/dist/InputFields/styling.js +2 -2
- package/dist/InputFields/styling.js.map +1 -1
- package/dist/LinearProgress/LinearProgress.cjs +142 -0
- package/dist/LinearProgress/LinearProgress.cjs.map +1 -0
- package/dist/LinearProgress/LinearProgress.d.ts +25 -0
- package/dist/LinearProgress/LinearProgress.js +111 -0
- package/dist/LinearProgress/LinearProgress.js.map +1 -0
- package/dist/LinearProgress/index.cjs +32 -0
- package/dist/LinearProgress/index.cjs.map +1 -0
- package/dist/LinearProgress/index.d.ts +3 -0
- package/dist/LinearProgress/index.js +4 -0
- package/dist/LinearProgress/index.js.map +1 -0
- package/dist/MenuItem/MenuItem.cjs +28 -13
- package/dist/MenuItem/MenuItem.cjs.map +1 -1
- package/dist/MenuItem/MenuItem.d.ts +2 -1
- package/dist/MenuItem/MenuItem.js +25 -11
- package/dist/MenuItem/MenuItem.js.map +1 -1
- package/dist/MenuItem/index.cjs +16 -0
- package/dist/MenuItem/index.cjs.map +1 -0
- package/dist/MenuItem/index.d.ts +1 -0
- package/dist/MenuItem/index.js +2 -0
- package/dist/MenuItem/index.js.map +1 -0
- package/dist/Modals/ModalDialog.cjs +4 -7
- package/dist/Modals/ModalDialog.cjs.map +1 -1
- package/dist/Modals/ModalDialog.js +4 -7
- package/dist/Modals/ModalDialog.js.map +1 -1
- package/dist/QuizButton/QuizButton.cjs +1 -3
- package/dist/QuizButton/QuizButton.cjs.map +1 -1
- package/dist/QuizButton/QuizButton.js +2 -4
- package/dist/QuizButton/QuizButton.js.map +1 -1
- package/dist/SegmentControl/SegmentControl.cjs +99 -0
- package/dist/SegmentControl/SegmentControl.cjs.map +1 -0
- package/dist/SegmentControl/SegmentControl.d.ts +19 -0
- package/dist/SegmentControl/SegmentControl.js +71 -0
- package/dist/SegmentControl/SegmentControl.js.map +1 -0
- package/dist/SegmentControl/index.cjs +16 -0
- package/dist/SegmentControl/index.cjs.map +1 -0
- package/dist/SegmentControl/index.d.ts +3 -0
- package/dist/SegmentControl/index.js +3 -0
- package/dist/SegmentControl/index.js.map +1 -0
- package/dist/Table/Table.cjs +1 -1
- package/dist/Table/Table.cjs.map +1 -1
- package/dist/Table/Table.js +1 -1
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.cjs +27 -21
- package/dist/Table/TableBody.cjs.map +1 -1
- package/dist/Table/TableBody.js +26 -21
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableFooter.cjs +8 -7
- package/dist/Table/TableFooter.cjs.map +1 -1
- package/dist/Table/TableFooter.js +7 -7
- package/dist/Table/TableFooter.js.map +1 -1
- package/dist/Table/TableHeaders.cjs +6 -4
- package/dist/Table/TableHeaders.cjs.map +1 -1
- package/dist/Table/TableHeaders.js +5 -4
- package/dist/Table/TableHeaders.js.map +1 -1
- package/dist/Table/TableStyles.cjs +9 -7
- package/dist/Table/TableStyles.cjs.map +1 -1
- package/dist/Table/TableStyles.js +8 -7
- package/dist/Table/TableStyles.js.map +1 -1
- package/dist/Table/TableTypes.d.ts +2 -0
- package/dist/Tag/Tag.cjs +92 -0
- package/dist/Tag/Tag.cjs.map +1 -0
- package/dist/Tag/Tag.d.ts +9 -0
- package/dist/Tag/Tag.js +70 -0
- package/dist/Tag/Tag.js.map +1 -0
- package/dist/Tag/index.cjs +16 -0
- package/dist/Tag/index.cjs.map +1 -0
- package/dist/Tag/index.d.ts +1 -0
- package/dist/Tag/index.js +2 -0
- package/dist/Tag/index.js.map +1 -0
- package/dist/common/InputStyling.cjs +1 -1
- package/dist/common/InputStyling.cjs.map +1 -1
- package/dist/common/InputStyling.js +1 -1
- package/dist/common/InputStyling.js.map +1 -1
- package/dist/index.cjs +52 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/LinearProgress/LinearProgress.tsx"],"names":["Bar","styled","div","COLORS","neutral_100","accent1_400","accent1_800","neutral_600","white","Dot","neutral_400","accent1_600","LineFill","Line","neutral_500","accent1_500","neutral_700","Label","black","Content","Wrapper","ComponentTextStyle","Regular","LinearProgressType","LinearProgressVariant","LinearProgress","size","Size","Medium","type","variant","Normal","label","value","max","renderBars","Array","from","keys","map","i","Math","ceil","renderDots","renderLine","width","render","Bars","Dots"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;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c","sourcesContent":["import React from 'react';\nimport {Size} from '../types';\nimport styled from 'styled-components';\nimport {COLORS, ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle} from '../styles';\n\nexport const Bar = styled.div`\n flex: 1;\n height: 6px;\n\n &.small {\n height: 6px;\n }\n\n &.medium {\n height: 8px;\n }\n\n &.large {\n height: 12px;\n }\n\n background-color: ${COLORS.neutral_100};\n\n &.active {\n background-color: ${COLORS.accent1_400};\n }\n\n &.current {\n background-color: ${COLORS.accent1_800};\n }\n\n &.inverted {\n background-color: ${COLORS.neutral_600};\n }\n\n &.inverted.active {\n background-color: ${COLORS.accent1_400};\n }\n\n &.inverted.current {\n background-color: ${COLORS.white};\n }\n\n`;\n\nexport const Dot = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n\n\n &:after {\n content: '';\n display: block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: ${COLORS.neutral_400};\n }\n\n &.small {\n &:after {\n width: 6px;\n height: 6px;\n }\n\n &.current:after {\n width: 10px;\n height: 10px;\n }\n }\n\n &.medium {\n &:after {\n width: 8px;\n height: 8px;\n }\n\n &.current:after {\n width: 12px;\n height: 12px;\n }\n }\n\n &.large {\n &:after {\n width: 12px;\n height: 12px;\n }\n\n &.current:after {\n width: 16px;\n height: 16px;\n }\n }\n\n\n &.active:after {\n background-color: ${COLORS.accent1_600};\n }\n\n &.current:after {\n background-color: ${COLORS.accent1_800};\n }\n\n &.inverted:after {\n background-color: ${COLORS.neutral_400};\n }\n\n &.inverted.active:after {\n background-color: ${COLORS.accent1_400};\n }\n\n &.inverted.current:after {\n background-color: ${COLORS.white};\n }\n`;\n\nexport const LineFill = styled.div`\n height: 100%;\n max-width: 100%;\n position: absolute;\n z-index: 1;\n`;\n\nexport const Line = styled.div`\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n position: relative;\n\n &:after {\n content: '';\n display: block;\n height: 100%;\n background-color: ${COLORS.neutral_500};\n position: absolute;\n right: 0;\n }\n\n &:before {\n content: '';\n display: block;\n height: 100%;\n background-color: ${COLORS.neutral_500};\n position: absolute;\n left: 0;\n }\n\n &.small {\n height: 6px;\n border-radius: 4px;\n\n ${LineFill} {\n border-radius: 4px;\n }\n\n &:after {\n width: 3px;\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n }\n\n &:before {\n width: 3px;\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n }\n\n &.medium {\n height: 8px;\n border-radius: 4px;\n\n ${LineFill} {\n border-radius: 4px;\n }\n\n &:after {\n width: 4px;\n border-top-right-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n\n &:before {\n width: 4px;\n border-top-left-radius: 8px;\n border-bottom-left-radius: 8px;\n }\n }\n\n &.large {\n height: 12px;\n border-radius: 6px;\n\n ${LineFill} {\n border-radius: 6px;\n }\n\n &:after {\n width: 6px;\n border-top-right-radius: 12px;\n border-bottom-right-radius: 12px;\n }\n\n &:before {\n width: 6px;\n border-top-left-radius: 12px;\n border-bottom-left-radius: 12px;\n }\n }\n\n background-color: ${COLORS.neutral_100};\n\n ${LineFill} {\n background-color: ${COLORS.accent1_500};\n }\n\n &.inverted {\n background-color: ${COLORS.neutral_700};\n\n &:after,\n &:before {\n background-color: ${COLORS.neutral_400};\n }\n\n ${LineFill} {\n background-color: ${COLORS.accent1_400};\n }\n }\n`;\n\nconst Label = styled.div`\n color: ${COLORS.black};\n`;\n\nconst Content = styled.div`\n display: flex;\n align-items: center;\n flex-direction: row;\n height: 16px;\n`;\n\nconst Wrapper = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n &.inverted {\n ${Label} {\n color: ${COLORS.white};\n }\n }\n\n &.small {\n ${Label} {\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\n }\n\n ${Content} {\n gap: 4px;\n\n ${Bar}:first-of-type {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n ${Bar}:last-of-type {\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n }\n }\n }\n\n &.medium {\n ${Label} {\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\n }\n\n ${Content} {\n gap: 6px;\n\n ${Bar}:first-of-type {\n border-top-left-radius: 8px;\n border-bottom-left-radius: 8px;\n }\n\n ${Bar}:last-of-type {\n border-top-right-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n }\n }\n\n &.large {\n ${Label} {\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\n }\n\n ${Content} {\n gap: 8px;\n\n ${Bar}:first-of-type {\n border-top-left-radius: 12px;\n border-bottom-left-radius: 12px;\n }\n\n ${Bar}:last-of-type {\n border-top-right-radius: 12px;\n border-bottom-right-radius: 12px;\n }\n }\n }\n`;\n\n\nexport enum LinearProgressType {\n Dots = 'dots',\n Line = 'line',\n Bars = 'bars',\n}\n\nexport enum LinearProgressVariant {\n Normal = 'normal',\n Inverted = 'inverted',\n}\n\nexport interface LinearProgressProps {\n size?: Size.Small | Size.Medium | Size.Large;\n type?: LinearProgressType;\n variant?: LinearProgressVariant;\n\n label?: string;\n\n value: number;\n max: number;\n}\n\nconst LinearProgress: React.FunctionComponent<LinearProgressProps> = ({\n size = Size.Medium,\n type = LinearProgressType.Line,\n variant = LinearProgressVariant.Normal,\n label,\n value,\n max\n }) => {\n\n const renderBars = () =>\n <>\n {Array.from(Array(max).keys()).map(i => (\n <Bar key={i}\n className={`${Math.ceil(value) >= i + 1 ? 'active' : ''} ${Math.ceil(value) === i + 1 ? 'current' : ''} ${variant} ${size}`}/>\n ))}\n </>\n\n const renderDots = () =>\n <>\n {Array.from(Array(max).keys()).map(i => (\n <Dot key={i}\n className={`${Math.ceil(value) >= i + 1 ? 'active' : ''} ${Math.ceil(value) === i + 1 ? 'current' : ''} ${variant} ${size}`}/>\n ))}\n </>\n\n const renderLine = () =>\n <>\n <Line className={`${variant} ${size}`}>\n <LineFill style={{width: `${value / max * 100}%`}}/>\n </Line>\n </>\n\n\n const render = () => {\n switch (type) {\n case LinearProgressType.Bars:\n return renderBars();\n case LinearProgressType.Dots:\n return renderDots();\n case LinearProgressType.Line:\n default:\n return renderLine();\n }\n }\n\n return (\n <Wrapper className={`${size} ${type} ${variant}`}>\n {label && <Label>{label}</Label>}\n <Content>\n {render()}\n </Content>\n </Wrapper>\n )\n};\n\nexport default LinearProgress;\n"],"file":"LinearProgress.cjs"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Size } from '../types';
|
|
3
|
+
export declare const Bar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const Dot: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const LineFill: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const Line: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare enum LinearProgressType {
|
|
8
|
+
Dots = "dots",
|
|
9
|
+
Line = "line",
|
|
10
|
+
Bars = "bars"
|
|
11
|
+
}
|
|
12
|
+
export declare enum LinearProgressVariant {
|
|
13
|
+
Normal = "normal",
|
|
14
|
+
Inverted = "inverted"
|
|
15
|
+
}
|
|
16
|
+
export interface LinearProgressProps {
|
|
17
|
+
size?: Size.Small | Size.Medium | Size.Large;
|
|
18
|
+
type?: LinearProgressType;
|
|
19
|
+
variant?: LinearProgressVariant;
|
|
20
|
+
label?: string;
|
|
21
|
+
value: number;
|
|
22
|
+
max: number;
|
|
23
|
+
}
|
|
24
|
+
declare const LinearProgress: React.FunctionComponent<LinearProgressProps>;
|
|
25
|
+
export default LinearProgress;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
import _pt from "prop-types";
|
|
3
|
+
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Size } from '../types';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { COLORS, ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export var Bar = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 1;\n height: 6px;\n\n &.small {\n height: 6px;\n }\n\n &.medium {\n height: 8px;\n }\n\n &.large {\n height: 12px;\n }\n\n background-color: ", ";\n\n &.active {\n background-color: ", ";\n }\n\n &.current {\n background-color: ", ";\n }\n\n &.inverted {\n background-color: ", ";\n }\n\n &.inverted.active {\n background-color: ", ";\n }\n\n &.inverted.current {\n background-color: ", ";\n }\n\n"])), COLORS.neutral_100, COLORS.accent1_400, COLORS.accent1_800, COLORS.neutral_600, COLORS.accent1_400, COLORS.white);
|
|
14
|
+
export var Dot = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n\n\n &:after {\n content: '';\n display: block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: ", ";\n }\n\n &.small {\n &:after {\n width: 6px;\n height: 6px;\n }\n\n &.current:after {\n width: 10px;\n height: 10px;\n }\n }\n\n &.medium {\n &:after {\n width: 8px;\n height: 8px;\n }\n\n &.current:after {\n width: 12px;\n height: 12px;\n }\n }\n\n &.large {\n &:after {\n width: 12px;\n height: 12px;\n }\n\n &.current:after {\n width: 16px;\n height: 16px;\n }\n }\n\n\n &.active:after {\n background-color: ", ";\n }\n\n &.current:after {\n background-color: ", ";\n }\n\n &.inverted:after {\n background-color: ", ";\n }\n\n &.inverted.active:after {\n background-color: ", ";\n }\n\n &.inverted.current:after {\n background-color: ", ";\n }\n"])), COLORS.neutral_400, COLORS.accent1_600, COLORS.accent1_800, COLORS.neutral_400, COLORS.accent1_400, COLORS.white);
|
|
15
|
+
export var LineFill = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 100%;\n max-width: 100%;\n position: absolute;\n z-index: 1;\n"])));
|
|
16
|
+
export var Line = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n position: relative;\n\n &:after {\n content: '';\n display: block;\n height: 100%;\n background-color: ", ";\n position: absolute;\n right: 0;\n }\n\n &:before {\n content: '';\n display: block;\n height: 100%;\n background-color: ", ";\n position: absolute;\n left: 0;\n }\n\n &.small {\n height: 6px;\n border-radius: 4px;\n\n ", " {\n border-radius: 4px;\n }\n\n &:after {\n width: 3px;\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n }\n\n &:before {\n width: 3px;\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n }\n\n &.medium {\n height: 8px;\n border-radius: 4px;\n\n ", " {\n border-radius: 4px;\n }\n\n &:after {\n width: 4px;\n border-top-right-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n\n &:before {\n width: 4px;\n border-top-left-radius: 8px;\n border-bottom-left-radius: 8px;\n }\n }\n\n &.large {\n height: 12px;\n border-radius: 6px;\n\n ", " {\n border-radius: 6px;\n }\n\n &:after {\n width: 6px;\n border-top-right-radius: 12px;\n border-bottom-right-radius: 12px;\n }\n\n &:before {\n width: 6px;\n border-top-left-radius: 12px;\n border-bottom-left-radius: 12px;\n }\n }\n\n background-color: ", ";\n\n ", " {\n background-color: ", ";\n }\n\n &.inverted {\n background-color: ", ";\n\n &:after,\n &:before {\n background-color: ", ";\n }\n\n ", " {\n background-color: ", ";\n }\n }\n"])), COLORS.neutral_500, COLORS.neutral_500, LineFill, LineFill, LineFill, COLORS.neutral_100, LineFill, COLORS.accent1_500, COLORS.neutral_700, COLORS.neutral_400, LineFill, COLORS.accent1_400);
|
|
17
|
+
var Label = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n"])), COLORS.black);
|
|
18
|
+
var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n flex-direction: row;\n height: 16px;\n"])));
|
|
19
|
+
var Wrapper = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n &.inverted {\n ", " {\n color: ", ";\n }\n }\n\n &.small {\n ", " {\n ", "\n }\n\n ", " {\n gap: 4px;\n\n ", ":first-of-type {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n ", ":last-of-type {\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n }\n }\n }\n\n &.medium {\n ", " {\n ", "\n }\n\n ", " {\n gap: 6px;\n\n ", ":first-of-type {\n border-top-left-radius: 8px;\n border-bottom-left-radius: 8px;\n }\n\n ", ":last-of-type {\n border-top-right-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n }\n }\n\n &.large {\n ", " {\n ", "\n }\n\n ", " {\n gap: 8px;\n\n ", ":first-of-type {\n border-top-left-radius: 12px;\n border-bottom-left-radius: 12px;\n }\n\n ", ":last-of-type {\n border-top-right-radius: 12px;\n border-bottom-right-radius: 12px;\n }\n }\n }\n"])), Label, COLORS.white, Label, ComponentSStyling(ComponentTextStyle.Regular, null), Content, Bar, Bar, Label, ComponentMStyling(ComponentTextStyle.Regular, null), Content, Bar, Bar, Label, ComponentLStyling(ComponentTextStyle.Regular, null), Content, Bar, Bar);
|
|
20
|
+
export var LinearProgressType;
|
|
21
|
+
|
|
22
|
+
(function (LinearProgressType) {
|
|
23
|
+
LinearProgressType["Dots"] = "dots";
|
|
24
|
+
LinearProgressType["Line"] = "line";
|
|
25
|
+
LinearProgressType["Bars"] = "bars";
|
|
26
|
+
})(LinearProgressType || (LinearProgressType = {}));
|
|
27
|
+
|
|
28
|
+
export var LinearProgressVariant;
|
|
29
|
+
|
|
30
|
+
(function (LinearProgressVariant) {
|
|
31
|
+
LinearProgressVariant["Normal"] = "normal";
|
|
32
|
+
LinearProgressVariant["Inverted"] = "inverted";
|
|
33
|
+
})(LinearProgressVariant || (LinearProgressVariant = {}));
|
|
34
|
+
|
|
35
|
+
var LinearProgress = function LinearProgress(_ref) {
|
|
36
|
+
var _ref$size = _ref.size,
|
|
37
|
+
size = _ref$size === void 0 ? Size.Medium : _ref$size,
|
|
38
|
+
_ref$type = _ref.type,
|
|
39
|
+
type = _ref$type === void 0 ? LinearProgressType.Line : _ref$type,
|
|
40
|
+
_ref$variant = _ref.variant,
|
|
41
|
+
variant = _ref$variant === void 0 ? LinearProgressVariant.Normal : _ref$variant,
|
|
42
|
+
label = _ref.label,
|
|
43
|
+
value = _ref.value,
|
|
44
|
+
max = _ref.max;
|
|
45
|
+
|
|
46
|
+
var renderBars = function renderBars() {
|
|
47
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
48
|
+
children: Array.from(Array(max).keys()).map(function (i) {
|
|
49
|
+
return /*#__PURE__*/_jsx(Bar, {
|
|
50
|
+
className: "".concat(Math.ceil(value) >= i + 1 ? 'active' : '', " ").concat(Math.ceil(value) === i + 1 ? 'current' : '', " ").concat(variant, " ").concat(size)
|
|
51
|
+
}, i);
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var renderDots = function renderDots() {
|
|
57
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
58
|
+
children: Array.from(Array(max).keys()).map(function (i) {
|
|
59
|
+
return /*#__PURE__*/_jsx(Dot, {
|
|
60
|
+
className: "".concat(Math.ceil(value) >= i + 1 ? 'active' : '', " ").concat(Math.ceil(value) === i + 1 ? 'current' : '', " ").concat(variant, " ").concat(size)
|
|
61
|
+
}, i);
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var renderLine = function renderLine() {
|
|
67
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
68
|
+
children: /*#__PURE__*/_jsx(Line, {
|
|
69
|
+
className: "".concat(variant, " ").concat(size),
|
|
70
|
+
children: /*#__PURE__*/_jsx(LineFill, {
|
|
71
|
+
style: {
|
|
72
|
+
width: "".concat(value / max * 100, "%")
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var render = function render() {
|
|
80
|
+
switch (type) {
|
|
81
|
+
case LinearProgressType.Bars:
|
|
82
|
+
return renderBars();
|
|
83
|
+
|
|
84
|
+
case LinearProgressType.Dots:
|
|
85
|
+
return renderDots();
|
|
86
|
+
|
|
87
|
+
case LinearProgressType.Line:
|
|
88
|
+
default:
|
|
89
|
+
return renderLine();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
94
|
+
className: "".concat(size, " ").concat(type, " ").concat(variant),
|
|
95
|
+
children: [label && /*#__PURE__*/_jsx(Label, {
|
|
96
|
+
children: label
|
|
97
|
+
}), /*#__PURE__*/_jsx(Content, {
|
|
98
|
+
children: render()
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
LinearProgress.propTypes = {
|
|
104
|
+
type: _pt.oneOf(["dots", "line", "bars"]),
|
|
105
|
+
variant: _pt.oneOf(["normal", "inverted"]),
|
|
106
|
+
label: _pt.string,
|
|
107
|
+
value: _pt.number.isRequired,
|
|
108
|
+
max: _pt.number.isRequired
|
|
109
|
+
};
|
|
110
|
+
export default LinearProgress;
|
|
111
|
+
//# sourceMappingURL=LinearProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/LinearProgress/LinearProgress.tsx"],"names":["React","Size","styled","COLORS","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentTextStyle","Bar","div","neutral_100","accent1_400","accent1_800","neutral_600","white","Dot","neutral_400","accent1_600","LineFill","Line","neutral_500","accent1_500","neutral_700","Label","black","Content","Wrapper","Regular","LinearProgressType","LinearProgressVariant","LinearProgress","size","Medium","type","variant","Normal","label","value","max","renderBars","Array","from","keys","map","i","Math","ceil","renderDots","renderLine","width","render","Bars","Dots"],"mappings":";;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAQC,IAAR,QAAmB,UAAnB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,MAAR,EAAgBC,iBAAhB,EAAmCC,iBAAnC,EAAsDC,iBAAtD,EAAyEC,kBAAzE,QAAkG,WAAlG;;;;AAEA,OAAO,IAAMC,GAAG,GAAGN,MAAM,CAACO,GAAV,ugBAgBMN,MAAM,CAACO,WAhBb,EAmBQP,MAAM,CAACQ,WAnBf,EAuBQR,MAAM,CAACS,WAvBf,EA2BQT,MAAM,CAACU,WA3Bf,EA+BQV,MAAM,CAACQ,WA/Bf,EAmCQR,MAAM,CAACW,KAnCf,CAAT;AAwCP,OAAO,IAAMC,GAAG,GAAGb,MAAM,CAACO,GAAV,wkCAcQN,MAAM,CAACa,WAdf,EAuDQb,MAAM,CAACc,WAvDf,EA2DQd,MAAM,CAACS,WA3Df,EA+DQT,MAAM,CAACa,WA/Df,EAmEQb,MAAM,CAACQ,WAnEf,EAuEQR,MAAM,CAACW,KAvEf,CAAT;AA2EP,OAAO,IAAMI,QAAQ,GAAGhB,MAAM,CAACO,GAAV,oJAAd;AAOP,OAAO,IAAMU,IAAI,GAAGjB,MAAM,CAACO,GAAV,svDAWON,MAAM,CAACiB,WAXd,EAoBOjB,MAAM,CAACiB,WApBd,EA6BXF,QA7BW,EAkDXA,QAlDW,EAuEXA,QAvEW,EAwFKf,MAAM,CAACO,WAxFZ,EA0FbQ,QA1Fa,EA2FOf,MAAM,CAACkB,WA3Fd,EA+FOlB,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,KAAK,GAAGC,GAAR,GAAc,GAAnB;AAAN;AAAjB;AADF;AADF,MADiB;AAAA,GAAnB;;AAQA,MAAMY,MAAM,GAAG,SAATA,MAAS,GAAM;AACnB,YAAQjB,IAAR;AACE,WAAKL,kBAAkB,CAACuB,IAAxB;AACE,eAAOZ,UAAU,EAAjB;;AACF,WAAKX,kBAAkB,CAACwB,IAAxB;AACE,eAAOL,UAAU,EAAjB;;AACF,WAAKnB,kBAAkB,CAACT,IAAxB;AACA;AACE,eAAO6B,UAAU,EAAjB;AAPJ;AASD,GAVD;;AAYA,sBACE,MAAC,OAAD;AAAS,IAAA,SAAS,YAAKjB,IAAL,cAAaE,IAAb,cAAqBC,OAArB,CAAlB;AAAA,eACGE,KAAK,iBAAI,KAAC,KAAD;AAAA,gBAAQA;AAAR,MADZ,eAEE,KAAC,OAAD;AAAA,gBACGc,MAAM;AADT,MAFF;AAAA,IADF;AAQD,CArDD;;;AATEjB,EAAAA,I;AACAC,EAAAA,O;AAEAE,EAAAA,K;AAEAC,EAAAA,K;AACAC,EAAAA,G;;AA0DF,eAAeR,cAAf","sourcesContent":["import React from 'react';\nimport {Size} from '../types';\nimport styled from 'styled-components';\nimport {COLORS, ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle} from '../styles';\n\nexport const Bar = styled.div`\n flex: 1;\n height: 6px;\n\n &.small {\n height: 6px;\n }\n\n &.medium {\n height: 8px;\n }\n\n &.large {\n height: 12px;\n }\n\n background-color: ${COLORS.neutral_100};\n\n &.active {\n background-color: ${COLORS.accent1_400};\n }\n\n &.current {\n background-color: ${COLORS.accent1_800};\n }\n\n &.inverted {\n background-color: ${COLORS.neutral_600};\n }\n\n &.inverted.active {\n background-color: ${COLORS.accent1_400};\n }\n\n &.inverted.current {\n background-color: ${COLORS.white};\n }\n\n`;\n\nexport const Dot = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n\n\n &:after {\n content: '';\n display: block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: ${COLORS.neutral_400};\n }\n\n &.small {\n &:after {\n width: 6px;\n height: 6px;\n }\n\n &.current:after {\n width: 10px;\n height: 10px;\n }\n }\n\n &.medium {\n &:after {\n width: 8px;\n height: 8px;\n }\n\n &.current:after {\n width: 12px;\n height: 12px;\n }\n }\n\n &.large {\n &:after {\n width: 12px;\n height: 12px;\n }\n\n &.current:after {\n width: 16px;\n height: 16px;\n }\n }\n\n\n &.active:after {\n background-color: ${COLORS.accent1_600};\n }\n\n &.current:after {\n background-color: ${COLORS.accent1_800};\n }\n\n &.inverted:after {\n background-color: ${COLORS.neutral_400};\n }\n\n &.inverted.active:after {\n background-color: ${COLORS.accent1_400};\n }\n\n &.inverted.current:after {\n background-color: ${COLORS.white};\n }\n`;\n\nexport const LineFill = styled.div`\n height: 100%;\n max-width: 100%;\n position: absolute;\n z-index: 1;\n`;\n\nexport const Line = styled.div`\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n position: relative;\n\n &:after {\n content: '';\n display: block;\n height: 100%;\n background-color: ${COLORS.neutral_500};\n position: absolute;\n right: 0;\n }\n\n &:before {\n content: '';\n display: block;\n height: 100%;\n background-color: ${COLORS.neutral_500};\n position: absolute;\n left: 0;\n }\n\n &.small {\n height: 6px;\n border-radius: 4px;\n\n ${LineFill} {\n border-radius: 4px;\n }\n\n &:after {\n width: 3px;\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n }\n\n &:before {\n width: 3px;\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n }\n\n &.medium {\n height: 8px;\n border-radius: 4px;\n\n ${LineFill} {\n border-radius: 4px;\n }\n\n &:after {\n width: 4px;\n border-top-right-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n\n &:before {\n width: 4px;\n border-top-left-radius: 8px;\n border-bottom-left-radius: 8px;\n }\n }\n\n &.large {\n height: 12px;\n border-radius: 6px;\n\n ${LineFill} {\n border-radius: 6px;\n }\n\n &:after {\n width: 6px;\n border-top-right-radius: 12px;\n border-bottom-right-radius: 12px;\n }\n\n &:before {\n width: 6px;\n border-top-left-radius: 12px;\n border-bottom-left-radius: 12px;\n }\n }\n\n background-color: ${COLORS.neutral_100};\n\n ${LineFill} {\n background-color: ${COLORS.accent1_500};\n }\n\n &.inverted {\n background-color: ${COLORS.neutral_700};\n\n &:after,\n &:before {\n background-color: ${COLORS.neutral_400};\n }\n\n ${LineFill} {\n background-color: ${COLORS.accent1_400};\n }\n }\n`;\n\nconst Label = styled.div`\n color: ${COLORS.black};\n`;\n\nconst Content = styled.div`\n display: flex;\n align-items: center;\n flex-direction: row;\n height: 16px;\n`;\n\nconst Wrapper = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n &.inverted {\n ${Label} {\n color: ${COLORS.white};\n }\n }\n\n &.small {\n ${Label} {\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\n }\n\n ${Content} {\n gap: 4px;\n\n ${Bar}:first-of-type {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n ${Bar}:last-of-type {\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n }\n }\n }\n\n &.medium {\n ${Label} {\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\n }\n\n ${Content} {\n gap: 6px;\n\n ${Bar}:first-of-type {\n border-top-left-radius: 8px;\n border-bottom-left-radius: 8px;\n }\n\n ${Bar}:last-of-type {\n border-top-right-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n }\n }\n\n &.large {\n ${Label} {\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\n }\n\n ${Content} {\n gap: 8px;\n\n ${Bar}:first-of-type {\n border-top-left-radius: 12px;\n border-bottom-left-radius: 12px;\n }\n\n ${Bar}:last-of-type {\n border-top-right-radius: 12px;\n border-bottom-right-radius: 12px;\n }\n }\n }\n`;\n\n\nexport enum LinearProgressType {\n Dots = 'dots',\n Line = 'line',\n Bars = 'bars',\n}\n\nexport enum LinearProgressVariant {\n Normal = 'normal',\n Inverted = 'inverted',\n}\n\nexport interface LinearProgressProps {\n size?: Size.Small | Size.Medium | Size.Large;\n type?: LinearProgressType;\n variant?: LinearProgressVariant;\n\n label?: string;\n\n value: number;\n max: number;\n}\n\nconst LinearProgress: React.FunctionComponent<LinearProgressProps> = ({\n size = Size.Medium,\n type = LinearProgressType.Line,\n variant = LinearProgressVariant.Normal,\n label,\n value,\n max\n }) => {\n\n const renderBars = () =>\n <>\n {Array.from(Array(max).keys()).map(i => (\n <Bar key={i}\n className={`${Math.ceil(value) >= i + 1 ? 'active' : ''} ${Math.ceil(value) === i + 1 ? 'current' : ''} ${variant} ${size}`}/>\n ))}\n </>\n\n const renderDots = () =>\n <>\n {Array.from(Array(max).keys()).map(i => (\n <Dot key={i}\n className={`${Math.ceil(value) >= i + 1 ? 'active' : ''} ${Math.ceil(value) === i + 1 ? 'current' : ''} ${variant} ${size}`}/>\n ))}\n </>\n\n const renderLine = () =>\n <>\n <Line className={`${variant} ${size}`}>\n <LineFill style={{width: `${value / max * 100}%`}}/>\n </Line>\n </>\n\n\n const render = () => {\n switch (type) {\n case LinearProgressType.Bars:\n return renderBars();\n case LinearProgressType.Dots:\n return renderDots();\n case LinearProgressType.Line:\n default:\n return renderLine();\n }\n }\n\n return (\n <Wrapper className={`${size} ${type} ${variant}`}>\n {label && <Label>{label}</Label>}\n <Content>\n {render()}\n </Content>\n </Wrapper>\n )\n};\n\nexport default LinearProgress;\n"],"file":"LinearProgress.js"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "LinearProgress", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _LinearProgress.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "LinearProgressType", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _LinearProgress.LinearProgressType;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "LinearProgressVariant", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _LinearProgress.LinearProgressVariant;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
var _LinearProgress = _interopRequireWildcard(require("./LinearProgress"));
|
|
28
|
+
|
|
29
|
+
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); }
|
|
30
|
+
|
|
31
|
+
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; }
|
|
32
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/LinearProgress/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["import LinearProgress, {LinearProgressType, LinearProgressVariant} from './LinearProgress';\n\nexport {LinearProgressType, LinearProgressVariant};\nexport {LinearProgress}\n"],"file":"index.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/LinearProgress/index.ts"],"names":["LinearProgress","LinearProgressType","LinearProgressVariant"],"mappings":"AAAA,OAAOA,cAAP,IAAwBC,kBAAxB,EAA4CC,qBAA5C,QAAwE,kBAAxE;AAEA,SAAQD,kBAAR,EAA4BC,qBAA5B;AACA,SAAQF,cAAR","sourcesContent":["import LinearProgress, {LinearProgressType, LinearProgressVariant} from './LinearProgress';\n\nexport {LinearProgressType, LinearProgressVariant};\nexport {LinearProgress}\n"],"file":"index.js"}
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.default = exports.
|
|
10
|
+
exports.default = exports.LockedIconContainer = exports.ItemLabel = exports.ItemIcon = exports.ItemContent = exports.DropdownButtonCSS = exports.DropdownButton = void 0;
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
@@ -19,6 +19,8 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
19
19
|
|
|
20
20
|
var _styles = require("../styles");
|
|
21
21
|
|
|
22
|
+
var _SystemIcons = require("../icons/systemicons/SystemIcons");
|
|
23
|
+
|
|
22
24
|
var _types = require("../types");
|
|
23
25
|
|
|
24
26
|
var _typography = require("../styles/typography");
|
|
@@ -47,16 +49,16 @@ var ItemIcon = _styledComponents.default.div(_templateObject3 || (_templateObjec
|
|
|
47
49
|
|
|
48
50
|
exports.ItemIcon = ItemIcon;
|
|
49
51
|
|
|
50
|
-
var
|
|
52
|
+
var LockedIconContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\n"])));
|
|
51
53
|
|
|
52
|
-
exports.
|
|
54
|
+
exports.LockedIconContainer = LockedIconContainer;
|
|
53
55
|
|
|
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)
|
|
56
|
+
var ItemContent = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ", " {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ", " {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n"])), ItemLabel, ItemIcon, LockedIconContainer);
|
|
55
57
|
|
|
56
58
|
exports.ItemContent = ItemContent;
|
|
57
59
|
|
|
58
60
|
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:
|
|
61
|
+
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: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ", ";\n\n border-radius: 4px;\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active, &.active-active-state {\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.neutral_500, _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
62
|
};
|
|
61
63
|
|
|
62
64
|
exports.DropdownButtonCSS = DropdownButtonCSS;
|
|
@@ -68,14 +70,15 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
68
70
|
onClickHandler = _ref.onClickHandler,
|
|
69
71
|
key = _ref.key,
|
|
70
72
|
size = _ref.size,
|
|
73
|
+
className = _ref.className,
|
|
71
74
|
id = _ref.id;
|
|
72
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DropdownButton, {
|
|
73
76
|
type: "button",
|
|
74
77
|
size: size,
|
|
75
|
-
disabled: item.disabled,
|
|
78
|
+
disabled: item.disabled || item.locked,
|
|
76
79
|
ref: ref,
|
|
77
80
|
onClick: onClickHandler,
|
|
78
|
-
className: (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
|
|
81
|
+
className: className + ' ' + (item.locked ? 'locked' : '') + ' ' + (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
|
|
79
82
|
id: id,
|
|
80
83
|
children: [item.showDividerAbove && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
81
84
|
className: "divider"
|
|
@@ -83,11 +86,22 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
83
86
|
children: [item.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemIcon, {
|
|
84
87
|
children: item.icon
|
|
85
88
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ItemLabel, {
|
|
86
|
-
children: [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
|
|
89
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
90
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
91
|
+
children: (_item$displayLabel = item.displayLabel) !== null && _item$displayLabel !== void 0 ? _item$displayLabel : item.value
|
|
92
|
+
}), item.noteLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
93
|
+
style: {
|
|
94
|
+
fontSize: '12px',
|
|
95
|
+
lineHeight: '16px'
|
|
96
|
+
},
|
|
97
|
+
children: item.noteLabel
|
|
98
|
+
})]
|
|
99
|
+
}), item.locked && /*#__PURE__*/(0, _jsxRuntime.jsx)(LockedIconContainer, {
|
|
100
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.LockedOn, {
|
|
101
|
+
color: _styles.COLORS.neutral_400,
|
|
102
|
+
className: "extraMargin",
|
|
103
|
+
size: "24px"
|
|
104
|
+
})
|
|
91
105
|
})]
|
|
92
106
|
})]
|
|
93
107
|
})]
|
|
@@ -97,7 +111,8 @@ MenuItem.propTypes = {
|
|
|
97
111
|
onClickHandler: _propTypes.default.func.isRequired,
|
|
98
112
|
active: _propTypes.default.bool.isRequired,
|
|
99
113
|
id: _propTypes.default.string.isRequired,
|
|
100
|
-
key: _propTypes.default.string.isRequired
|
|
114
|
+
key: _propTypes.default.string.isRequired,
|
|
115
|
+
className: _propTypes.default.string
|
|
101
116
|
};
|
|
102
117
|
var _default = MenuItem;
|
|
103
118
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["DropdownButton","styled","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","
|
|
1
|
+
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["DropdownButton","styled","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","LockedIconContainer","ItemContent","css","Size","Small","ComponentTextStyle","Regular","COLORS","neutral_600","Medium","Large","white","CommonInteractionStyling","neutral_20","primary_500","neutral_200","neutral_500","primary_20","primary_600","primary_100","primary_800","MenuItem","React","forwardRef","ref","active","item","onClickHandler","key","className","id","disabled","locked","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize","lineHeight","neutral_400"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAYO,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,qF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UALpB;AAAA,QAFF;AAAA,MAVJ;AAAA,KAOSZ,GAPT,CADF;AAyBD,CAjCgB,CAAjB;;AAlIGD,EAAAA,c;AACAF,EAAAA,M;AACAK,EAAAA,E;AACAF,EAAAA,G;AAEAC,EAAAA,S;;eAgKYR,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, LockedOn} 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 className?: string;\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``;\n\nexport const LockedIconContainer = styled.div`\n\n`;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ${LockedIconContainer} {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\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: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 4px;\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_200};\n }\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_500};\n }\n\n &.active:hover, &.active-hover-state {\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, &.active-active-state {\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 className,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled || item.locked}\n ref={ref}\n onClick={onClickHandler}\n className={ className + ' ' + (item.locked ? 'locked' : '') + ' ' + (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 <div>\n <div>{item.displayLabel ?? item.value}</div>\n {item.noteLabel && <div style={{ fontSize: '12px', lineHeight: '16px' }}>{item.noteLabel}</div>}\n </div>\n {item.locked && <LockedIconContainer>\n <LockedOn color={COLORS.neutral_400} className=\"extraMargin\" size=\"24px\" />\n </LockedIconContainer>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.cjs"}
|
|
@@ -8,13 +8,14 @@ export interface MenuItemProps {
|
|
|
8
8
|
id: string;
|
|
9
9
|
key: string;
|
|
10
10
|
size?: Size;
|
|
11
|
+
className?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare const DropdownButton: import("styled-components").StyledComponent<"button", any, {
|
|
13
14
|
size?: Size | undefined;
|
|
14
15
|
}, never>;
|
|
15
16
|
export declare const ItemLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
17
|
export declare const ItemIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
-
export declare const
|
|
18
|
+
export declare const LockedIconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
19
|
export declare const ItemContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
20
|
export declare const DropdownButtonCSS: (size?: Size | undefined) => import("styled-components").FlattenSimpleInterpolation;
|
|
20
21
|
declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -6,6 +6,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { COLORS, ComponentTextStyle } from '../styles';
|
|
9
|
+
import { LockedOn } from '../icons/systemicons/SystemIcons';
|
|
9
10
|
import { Size } from '../types';
|
|
10
11
|
import { ComponentLStyling, ComponentMStyling, ComponentSStyling } from '../styles/typography';
|
|
11
12
|
import { CommonInteractionStyling } from '../common';
|
|
@@ -16,10 +17,10 @@ export var DropdownButton = styled.button(_templateObject || (_templateObject =
|
|
|
16
17
|
});
|
|
17
18
|
export var ItemLabel = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
|
|
18
19
|
export var ItemIcon = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
|
19
|
-
export var
|
|
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)
|
|
20
|
+
export var LockedIconContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n\n"])));
|
|
21
|
+
export var ItemContent = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ", " {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ", " {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n"])), ItemLabel, ItemIcon, LockedIconContainer);
|
|
21
22
|
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:
|
|
23
|
+
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: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ", ";\n\n border-radius: 4px;\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active, &.active-active-state {\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.neutral_500, COLORS.primary_20, COLORS.primary_600, COLORS.primary_500, COLORS.primary_100, COLORS.primary_800, COLORS.primary_500);
|
|
23
24
|
};
|
|
24
25
|
var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
25
26
|
var _item$displayLabel;
|
|
@@ -29,14 +30,15 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
29
30
|
onClickHandler = _ref.onClickHandler,
|
|
30
31
|
key = _ref.key,
|
|
31
32
|
size = _ref.size,
|
|
33
|
+
className = _ref.className,
|
|
32
34
|
id = _ref.id;
|
|
33
35
|
return /*#__PURE__*/_jsxs(DropdownButton, {
|
|
34
36
|
type: "button",
|
|
35
37
|
size: size,
|
|
36
|
-
disabled: item.disabled,
|
|
38
|
+
disabled: item.disabled || item.locked,
|
|
37
39
|
ref: ref,
|
|
38
40
|
onClick: onClickHandler,
|
|
39
|
-
className: (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
|
|
41
|
+
className: className + ' ' + (item.locked ? 'locked' : '') + ' ' + (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
|
|
40
42
|
id: id,
|
|
41
43
|
children: [item.showDividerAbove && /*#__PURE__*/_jsx("div", {
|
|
42
44
|
className: "divider"
|
|
@@ -44,11 +46,22 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
44
46
|
children: [item.icon && /*#__PURE__*/_jsx(ItemIcon, {
|
|
45
47
|
children: item.icon
|
|
46
48
|
}), /*#__PURE__*/_jsxs(ItemLabel, {
|
|
47
|
-
children: [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
|
|
49
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
50
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
51
|
+
children: (_item$displayLabel = item.displayLabel) !== null && _item$displayLabel !== void 0 ? _item$displayLabel : item.value
|
|
52
|
+
}), item.noteLabel && /*#__PURE__*/_jsx("div", {
|
|
53
|
+
style: {
|
|
54
|
+
fontSize: '12px',
|
|
55
|
+
lineHeight: '16px'
|
|
56
|
+
},
|
|
57
|
+
children: item.noteLabel
|
|
58
|
+
})]
|
|
59
|
+
}), item.locked && /*#__PURE__*/_jsx(LockedIconContainer, {
|
|
60
|
+
children: /*#__PURE__*/_jsx(LockedOn, {
|
|
61
|
+
color: COLORS.neutral_400,
|
|
62
|
+
className: "extraMargin",
|
|
63
|
+
size: "24px"
|
|
64
|
+
})
|
|
52
65
|
})]
|
|
53
66
|
})]
|
|
54
67
|
})]
|
|
@@ -58,7 +71,8 @@ MenuItem.propTypes = {
|
|
|
58
71
|
onClickHandler: _pt.func.isRequired,
|
|
59
72
|
active: _pt.bool.isRequired,
|
|
60
73
|
id: _pt.string.isRequired,
|
|
61
|
-
key: _pt.string.isRequired
|
|
74
|
+
key: _pt.string.isRequired,
|
|
75
|
+
className: _pt.string
|
|
62
76
|
};
|
|
63
77
|
export default MenuItem;
|
|
64
78
|
//# sourceMappingURL=MenuItem.js.map
|
|
@@ -1 +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","
|
|
1
|
+
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["React","styled","css","COLORS","ComponentTextStyle","LockedOn","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","CommonInteractionStyling","DropdownButton","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","LockedIconContainer","ItemContent","Small","Regular","neutral_600","Medium","Large","white","neutral_20","primary_500","neutral_200","neutral_500","primary_20","primary_600","primary_100","primary_800","MenuItem","forwardRef","ref","active","item","onClickHandler","key","className","id","disabled","locked","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize","lineHeight","neutral_400"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,MAAP,IAAiBC,GAAjB,QAA4B,mBAA5B;AACA,SAAqBC,MAArB,EAA6BC,kBAA7B,QAAsD,WAAtD;AACA,SAAsBC,QAAtB,QAAqC,kCAArC;AACA,SAAiBC,IAAjB,QAA4B,UAA5B;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,QAAsE,sBAAtE;AAEA,SAASC,wBAAT,QAAyC,WAAzC;;;AAYA,OAAO,IAAMC,cAAc,GAAGV,MAAM,CAACW,MAAV,gFACvB,UAACC,KAAD;AAAA,SAAWC,iBAAiB,CAACD,KAAK,CAACE,IAAP,CAA5B;AAAA,CADuB,CAApB;AAIP,OAAO,IAAMC,SAAS,GAAGf,MAAM,CAACgB,GAAV,uEAAf;AACP,OAAO,IAA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AAI,CAACW;AAA5D,YAFrB;AAAA,UADJ,EAKKX,IAAI,CAACM,MAAL,iBAAe,KAAC,mBAAD;AAAA,iCACd,KAAC,QAAD;AAAU,YAAA,KAAK,EAAE1C,MAAM,CAACkD,WAAxB;AAAqC,YAAA,SAAS,EAAC,aAA/C;AAA6D,YAAA,IAAI,EAAC;AAAlE;AADc,UALpB;AAAA,QAFF;AAAA,MAVJ;AAAA,KAOSZ,GAPT,CADF;AAyBD,CAjCgB,CAAjB;;AAlIGD,EAAAA,c;AACAF,EAAAA,M;AACAK,EAAAA,E;AACAF,EAAAA,G;AAEAC,EAAAA,S;;AAgKH,eAAeP,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, LockedOn} 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 className?: string;\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``;\n\nexport const LockedIconContainer = styled.div`\n\n`;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ${LockedIconContainer} {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\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: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 4px;\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_200};\n }\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_500};\n }\n\n &.active:hover, &.active-hover-state {\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, &.active-active-state {\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 className,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled || item.locked}\n ref={ref}\n onClick={onClickHandler}\n className={ className + ' ' + (item.locked ? 'locked' : '') + ' ' + (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 <div>\n <div>{item.displayLabel ?? item.value}</div>\n {item.noteLabel && <div style={{ fontSize: '12px', lineHeight: '16px' }}>{item.noteLabel}</div>}\n </div>\n {item.locked && <LockedIconContainer>\n <LockedOn color={COLORS.neutral_400} className=\"extraMargin\" size=\"24px\" />\n </LockedIconContainer>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.js"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "MenuItem", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _MenuItem.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
var _MenuItem = _interopRequireDefault(require("./MenuItem"));
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/MenuItem/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA","sourcesContent":["export {default as MenuItem} from './MenuItem';"],"file":"index.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MenuItem } from './MenuItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/MenuItem/index.tsx"],"names":["default","MenuItem"],"mappings":"AAAA,SAAQA,OAAO,IAAIC,QAAnB,QAAkC,YAAlC","sourcesContent":["export {default as MenuItem} from './MenuItem';"],"file":"index.js"}
|