@laerdal/life-react-components 5.0.0-dev.5 → 5.0.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/InputFields/QuickSearch.cjs +2 -2
- package/dist/InputFields/QuickSearch.cjs.map +1 -1
- package/dist/InputFields/QuickSearch.js +2 -2
- package/dist/InputFields/QuickSearch.js.map +1 -1
- package/dist/InputFields/RadioButton.cjs +6 -6
- package/dist/InputFields/RadioButton.cjs.map +1 -1
- package/dist/InputFields/RadioButton.js +6 -6
- package/dist/InputFields/RadioButton.js.map +1 -1
- package/dist/InputFields/TextField.d.ts +1 -1
- package/dist/Modals/ModalContainer.cjs +0 -3
- package/dist/Modals/ModalContainer.cjs.map +1 -1
- package/dist/Modals/ModalContainer.js +0 -3
- package/dist/Modals/ModalContainer.js.map +1 -1
- package/dist/ProfileButton/ProfileButton.cjs +1 -1
- package/dist/ProfileButton/ProfileButton.cjs.map +1 -1
- package/dist/ProfileButton/ProfileButton.d.ts +1 -1
- package/dist/ProfileButton/ProfileButton.js +1 -1
- package/dist/ProfileButton/ProfileButton.js.map +1 -1
- package/dist/Tabs/Tabs.cjs +6 -6
- package/dist/Tabs/Tabs.cjs.map +1 -1
- package/dist/Tabs/Tabs.js +6 -6
- package/dist/Tabs/Tabs.js.map +1 -1
- package/dist/Tabs/__tests__/Tablist.tests.d.ts +1 -1
- package/dist/styles/typography.cjs +63 -62
- package/dist/styles/typography.cjs.map +1 -1
- package/dist/styles/typography.d.ts +6 -9
- package/dist/styles/typography.js +63 -62
- package/dist/styles/typography.js.map +1 -1
- package/dist/test-utils.cjs +42 -0
- package/dist/test-utils.cjs.map +1 -0
- package/dist/test-utils.d.ts +5 -0
- package/dist/test-utils.js +22 -0
- package/dist/test-utils.js.map +1 -0
- package/package.json +10 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.cjs","names":["React","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_icons","_styles","_types","_common","_jsxRuntime","_excluded","_templateObject","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","StyledRadioButton","styled","div","_taggedTemplateLiteral2","props","margin","concat","COLORS","getColor","theme","selected","invalid","ComponentXXSStyling","ComponentTextStyle","Regular","ComponentSStyling","ComponentMStyling","ComponentLStyling","focusStyles","RadioButton","forwardRef","_ref","ref","_size","id","label","additionalLabel","select","disabled","iconPointerEventsTransparent","size","tabIndexVal","className","dataTestId","rest","_objectWithoutProperties2","onKeyPress","keyCode","Size","Medium","cls","jsxs","onClick","onMouseDown","defaultOnMouseDownHandler","onKeyDown","tabIndex","children","jsx","SystemIcons","RadioButtonOn","RadioButtonOff","htmlFor","undefined","propTypes","_propTypes","string","bool","isRequired","func","number","_default","exports"],"sources":["../../src/InputFields/RadioButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport {SystemIcons} from '../icons';\r\nimport {COLORS, ComponentTextStyle, focusStyles} from '../styles';\r\nimport {Size, Testable} from '../types';\r\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentXXSStyling} from '../styles';\r\nimport {defaultOnMouseDownHandler} from '../common';\r\n\r\nconst StyledRadioButton = styled.div<{ margin?: string, disabled?: boolean, invalid?: boolean, selected?: boolean }>`\r\n display: flex;\r\n width: 100%;\r\n min-height: 48px;\r\n min-width: 48px;\r\n\r\n ${props => (props.margin ? `margin: ${props.margin};` : '')}\r\n cursor: pointer;\r\n\r\n color: ${props => COLORS.getColor('black', props.theme)};\r\n\r\n .pointerTransparent {\r\n pointer-events: none;\r\n }\r\n\r\n .radio-button-icon {\r\n margin: 6px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n box-sizing: border-box;\r\n height: 36px;\r\n min-width: 36px;\r\n border-radius: 50%;\r\n\r\n svg {\r\n color: ${props => (props.selected ? COLORS.getColor('primary_500', props.theme) : props.invalid ? COLORS.getColor('critical_400', props.theme) : COLORS.getColor('neutral_600', props.theme))};\r\n }\r\n }\r\n\r\n .radio-button-label {\r\n user-select: none;\r\n display: flex;\r\n flex-direction: column;\r\n\r\n label {\r\n cursor: inherit;\r\n }\r\n\r\n span {\r\n ${props => ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n }\r\n }\r\n\r\n &.small {\r\n ${props => ComponentSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 14px;\r\n }\r\n }\r\n\r\n &.medium {\r\n ${props => ComponentMStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 12px;\r\n }\r\n }\r\n\r\n &.large {\r\n ${props => ComponentLStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 12px;\r\n }\r\n }\r\n\r\n &:not(.disabled):focus {\r\n ${focusStyles}\r\n }\r\n\r\n &:not(.disabled):hover {\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &:not(.disabled):active {\r\n .radio-button-icon {\r\n background: ${props => COLORS.getColor('primary_100', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_800', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &.disabled {\r\n cursor: not-allowed;\r\n\r\n color: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n\r\n .radio-button-icon,\r\n .radio-button-label {\r\n pointer-events: none;\r\n }\r\n\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n\r\n .radio-button-icon svg {\r\n color: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n\r\n &.dropdown-hover:not(.disabled) {\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport type RadioButtonProps = Testable & Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'className' | 'onClick' | 'onMouseDown' | 'onKeyDown'> & {\r\n /** Optional. Id of the component */\r\n id?: string;\r\n /** Required. Current state of the component. */\r\n selected: boolean;\r\n /** Required. Handler to be called when user selects/unselected the radio button. */\r\n select: (selected: boolean) => void;\r\n /** Optional. Label to be shown on the right side of the radio button. */\r\n label?: string;\r\n /** Optional. Secondary label to be shown under the main 'label' */\r\n additionalLabel?: string;\r\n /** Optional. If set, then if radiobutton is in unselected state it will be shown in invalid state. */\r\n invalid?: boolean;\r\n /** Optional. If disabled, user can not interact with the component. */\r\n disabled?: boolean;\r\n /** Optional. If set, then 'pointer-events: none' will be set on the component. */\r\n iconPointerEventsTransparent?: boolean;\r\n /** Optional. Margin style attribute to be set on the top level tag of the component. */\r\n margin?: string;\r\n /** Optional. Size of the radio button, defaults to 'medium'. */\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n /** Optional. TabIndex attribute to be set on the component. */\r\n tabIndexVal?: number;\r\n /** Optional. Extra classname to be set on the container of the component. */\r\n className?: string;\r\n}\r\n\r\nconst RadioButton = React.forwardRef<HTMLDivElement, RadioButtonProps>(({\r\n id,\r\n selected,\r\n label,\r\n additionalLabel,\r\n invalid,\r\n select,\r\n disabled,\r\n margin,\r\n iconPointerEventsTransparent,\r\n size,\r\n tabIndexVal,\r\n className,\r\n dataTestId,\r\n ...rest\r\n }: RadioButtonProps, ref) => {\r\n const onKeyPress = (e: any) => {\r\n if (e.keyCode === 13 && !disabled) {\r\n select(!selected);\r\n }\r\n };\r\n\r\n size = size ?? Size.Medium;\r\n\r\n const cls = `${size} ${className || ''} ${disabled ? ' disabled' : ''}`;\r\n\r\n return (\r\n <StyledRadioButton key={id}\r\n margin={margin}\r\n ref={ref}\r\n onClick={() => !disabled && select(!selected)}\r\n onMouseDown={defaultOnMouseDownHandler}\r\n onKeyDown={onKeyPress}\r\n disabled={disabled}\r\n className={cls}\r\n tabIndex={disabled ? -1 : (tabIndexVal ? tabIndexVal : 0)}\r\n invalid={invalid}\r\n selected={selected}\r\n {...rest}>\r\n <div className={'radio-button-icon'} id={id} data-testid={dataTestId}>\r\n {selected && <SystemIcons.RadioButtonOn className={iconPointerEventsTransparent ? 'pointerTransparent' : ''} size=\"24px\"/>}\r\n {!selected &&\r\n <SystemIcons.RadioButtonOff className={iconPointerEventsTransparent ? 'pointerTransparent' : ''} size=\"24px\"/>}\r\n </div>\r\n <div className={'radio-button-label'}>\r\n {label && <label htmlFor={id}>{label}</label>}\r\n {additionalLabel !== undefined && <span>{additionalLabel}</span>}\r\n </div>\r\n </StyledRadioButton>\r\n );\r\n});\r\n\r\nexport default RadioButton;\r\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,OAAA,GAAAN,OAAA;AAAoD,IAAAO,WAAA,GAAAP,OAAA;AAAA,IAAAQ,SAAA;AAAA,IAAAC,eAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,G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AAW,CAACE,cAAc;QAACnB,SAAS,EAAEH,4BAA4B,GAAG,oBAAoB,GAAG,EAAG;QAACC,IAAI,EAAC;MAAM,CAAC,CAAC;IAAA,CAC7G,CAAC,eACN,IAAApE,WAAA,CAAA+E,IAAA;MAAKT,SAAS,EAAE,oBAAqB;MAAAe,QAAA,GAClCtB,KAAK,iBAAI,IAAA/D,WAAA,CAAAsF,GAAA;QAAOI,OAAO,EAAE5B,EAAG;QAAAuB,QAAA,EAAEtB;MAAK,CAAQ,CAAC,EAC5CC,eAAe,KAAK2B,SAAS,iBAAI,IAAA3F,WAAA,CAAAsF,GAAA;QAAAD,QAAA,EAAOrB;MAAe,CAAO,CAAC;IAAA,CAC7D,CAAC;EAAA,IApBgBF,EAqBL,CAAC;AAExB,CAAC,CAAC;AAACL,WAAA,CAAAmC,SAAA;EA3ED9B,EAAE,EAAA+B,UAAA,YAAAC,MAAA;EAEF9C,QAAQ,EAAA6C,UAAA,YAAAE,IAAA,CAAAC,UAAA;EAER/B,MAAM,EAAA4B,UAAA,YAAAI,IAAA,CAAAD,UAAA;EAENjC,KAAK,EAAA8B,UAAA,YAAAC,MAAA;EAEL9B,eAAe,EAAA6B,UAAA,YAAAC,MAAA;EAEf7C,OAAO,EAAA4C,UAAA,YAAAE,IAAA;EAEP7B,QAAQ,EAAA2B,UAAA,YAAAE,IAAA;EAER5B,4BAA4B,EAAA0B,UAAA,YAAAE,IAAA;EAE5BpD,MAAM,EAAAkD,UAAA,YAAAC,MAAA;EAINzB,WAAW,EAAAwB,UAAA,YAAAK,MAAA;EAEX5B,SAAS,EAAAuB,UAAA,YAAAC;AAAA;AAAA,IAAAK,QAAA,GAuDI1C,WAAW;AAAA2C,OAAA,cAAAD,QAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"RadioButton.cjs","names":["React","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_icons","_styles","_types","_common","_jsxRuntime","_excluded","_templateObject","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","StyledRadioButton","styled","div","_taggedTemplateLiteral2","props","$margin","concat","COLORS","getColor","theme","$selected","$invalid","ComponentXXSStyling","ComponentTextStyle","Regular","ComponentSStyling","ComponentMStyling","ComponentLStyling","focusStyles","RadioButton","forwardRef","_ref","ref","_size","id","selected","label","additionalLabel","invalid","select","disabled","margin","iconPointerEventsTransparent","size","tabIndexVal","className","dataTestId","rest","_objectWithoutProperties2","onKeyPress","keyCode","Size","Medium","cls","jsxs","onClick","onMouseDown","defaultOnMouseDownHandler","onKeyDown","$disabled","tabIndex","children","jsx","SystemIcons","RadioButtonOn","RadioButtonOff","htmlFor","undefined","propTypes","_propTypes","string","bool","isRequired","func","number","_default","exports"],"sources":["../../src/InputFields/RadioButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport {SystemIcons} from '../icons';\r\nimport {COLORS, ComponentTextStyle, focusStyles} from '../styles';\r\nimport {Size, Testable} from '../types';\r\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentXXSStyling} from '../styles';\r\nimport {defaultOnMouseDownHandler} from '../common';\r\n\r\nconst StyledRadioButton = styled.div<{ $margin?: string, $disabled?: boolean, $invalid?: boolean, $selected?: boolean }>`\r\n display: flex;\r\n width: 100%;\r\n min-height: 48px;\r\n min-width: 48px;\r\n\r\n ${props => (props.$margin ? `margin: ${props.$margin};` : '')}\r\n cursor: pointer;\r\n\r\n color: ${props => COLORS.getColor('black', props.theme)};\r\n\r\n .pointerTransparent {\r\n pointer-events: none;\r\n }\r\n\r\n .radio-button-icon {\r\n margin: 6px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n box-sizing: border-box;\r\n height: 36px;\r\n min-width: 36px;\r\n border-radius: 50%;\r\n\r\n svg {\r\n color: ${props => (props.$selected ? COLORS.getColor('primary_500', props.theme) : props.$invalid ? COLORS.getColor('critical_400', props.theme) : COLORS.getColor('neutral_600', props.theme))};\r\n }\r\n }\r\n\r\n .radio-button-label {\r\n user-select: none;\r\n display: flex;\r\n flex-direction: column;\r\n\r\n label {\r\n cursor: inherit;\r\n }\r\n\r\n span {\r\n ${props => ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n }\r\n }\r\n\r\n &.small {\r\n ${props => ComponentSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 14px;\r\n }\r\n }\r\n\r\n &.medium {\r\n ${props => ComponentMStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 12px;\r\n }\r\n }\r\n\r\n &.large {\r\n ${props => ComponentLStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 12px;\r\n }\r\n }\r\n\r\n &:not(.disabled):focus {\r\n ${focusStyles}\r\n }\r\n\r\n &:not(.disabled):hover {\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &:not(.disabled):active {\r\n .radio-button-icon {\r\n background: ${props => COLORS.getColor('primary_100', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_800', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &.disabled {\r\n cursor: not-allowed;\r\n\r\n color: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n\r\n .radio-button-icon,\r\n .radio-button-label {\r\n pointer-events: none;\r\n }\r\n\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n\r\n .radio-button-icon svg {\r\n color: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n\r\n &.dropdown-hover:not(.disabled) {\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport type RadioButtonProps = Testable & Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'className' | 'onClick' | 'onMouseDown' | 'onKeyDown'> & {\r\n /** Optional. Id of the component */\r\n id?: string;\r\n /** Required. Current state of the component. */\r\n selected: boolean;\r\n /** Required. Handler to be called when user selects/unselected the radio button. */\r\n select: (selected: boolean) => void;\r\n /** Optional. Label to be shown on the right side of the radio button. */\r\n label?: string;\r\n /** Optional. Secondary label to be shown under the main 'label' */\r\n additionalLabel?: string;\r\n /** Optional. If set, then if radiobutton is in unselected state it will be shown in invalid state. */\r\n invalid?: boolean;\r\n /** Optional. If disabled, user can not interact with the component. */\r\n disabled?: boolean;\r\n /** Optional. If set, then 'pointer-events: none' will be set on the component. */\r\n iconPointerEventsTransparent?: boolean;\r\n /** Optional. Margin style attribute to be set on the top level tag of the component. */\r\n margin?: string;\r\n /** Optional. Size of the radio button, defaults to 'medium'. */\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n /** Optional. TabIndex attribute to be set on the component. */\r\n tabIndexVal?: number;\r\n /** Optional. Extra classname to be set on the container of the component. */\r\n className?: string;\r\n}\r\n\r\nconst RadioButton = React.forwardRef<HTMLDivElement, RadioButtonProps>(({\r\n id,\r\n selected,\r\n label,\r\n additionalLabel,\r\n invalid,\r\n select,\r\n disabled,\r\n margin,\r\n iconPointerEventsTransparent,\r\n size,\r\n tabIndexVal,\r\n className,\r\n dataTestId,\r\n ...rest\r\n }: RadioButtonProps, ref) => {\r\n const onKeyPress = (e: any) => {\r\n if (e.keyCode === 13 && !disabled) {\r\n select(!selected);\r\n }\r\n };\r\n\r\n size = size ?? Size.Medium;\r\n\r\n const cls = `${size} ${className || ''} ${disabled ? ' disabled' : ''}`;\r\n\r\n return (\r\n <StyledRadioButton key={id}\r\n $margin={margin}\r\n ref={ref}\r\n onClick={() => !disabled && select(!selected)}\r\n onMouseDown={defaultOnMouseDownHandler}\r\n onKeyDown={onKeyPress}\r\n $disabled={disabled}\r\n className={cls}\r\n tabIndex={disabled ? -1 : (tabIndexVal ? tabIndexVal : 0)}\r\n $invalid={invalid}\r\n $selected={selected}\r\n {...rest}>\r\n <div className={'radio-button-icon'} id={id} data-testid={dataTestId}>\r\n {selected && <SystemIcons.RadioButtonOn className={iconPointerEventsTransparent ? 'pointerTransparent' : ''} size=\"24px\"/>}\r\n {!selected &&\r\n <SystemIcons.RadioButtonOff className={iconPointerEventsTransparent ? 'pointerTransparent' : ''} size=\"24px\"/>}\r\n </div>\r\n <div className={'radio-button-label'}>\r\n {label && <label htmlFor={id}>{label}</label>}\r\n {additionalLabel !== undefined && <span>{additionalLabel}</span>}\r\n </div>\r\n </StyledRadioButton>\r\n );\r\n});\r\n\r\nexport default RadioButton;\r\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,OAAA,GAAAN,OAAA;AAAoD,IAAAO,WAAA,GAAAP,OAAA;AAAA,IAAAQ,SAAA;AAAA,IAAAC,eAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA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,CAAC;IAAA,CAC7G,CAAC,eACN,IAAAvE,WAAA,CAAAkF,IAAA;MAAKT,SAAS,EAAE,oBAAqB;MAAAgB,QAAA,GAClCzB,KAAK,iBAAI,IAAAhE,WAAA,CAAA0F,GAAA;QAAOI,OAAO,EAAEhC,EAAG;QAAA2B,QAAA,EAAEzB;MAAK,CAAQ,CAAC,EAC5CC,eAAe,KAAK8B,SAAS,iBAAI,IAAA/F,WAAA,CAAA0F,GAAA;QAAAD,QAAA,EAAOxB;MAAe,CAAO,CAAC;IAAA,CAC7D,CAAC;EAAA,IApBgBH,EAqBL,CAAC;AAExB,CAAC,CAAC;AAACL,WAAA,CAAAuC,SAAA;EA3EDlC,EAAE,EAAAmC,UAAA,YAAAC,MAAA;EAEFnC,QAAQ,EAAAkC,UAAA,YAAAE,IAAA,CAAAC,UAAA;EAERjC,MAAM,EAAA8B,UAAA,YAAAI,IAAA,CAAAD,UAAA;EAENpC,KAAK,EAAAiC,UAAA,YAAAC,MAAA;EAELjC,eAAe,EAAAgC,UAAA,YAAAC,MAAA;EAEfhC,OAAO,EAAA+B,UAAA,YAAAE,IAAA;EAEP/B,QAAQ,EAAA6B,UAAA,YAAAE,IAAA;EAER7B,4BAA4B,EAAA2B,UAAA,YAAAE,IAAA;EAE5B9B,MAAM,EAAA4B,UAAA,YAAAC,MAAA;EAIN1B,WAAW,EAAAyB,UAAA,YAAAK,MAAA;EAEX7B,SAAS,EAAAwB,UAAA,YAAAC;AAAA;AAAA,IAAAK,QAAA,GAuDI9C,WAAW;AAAA+C,OAAA,cAAAD,QAAA","ignoreList":[]}
|
|
@@ -16,11 +16,11 @@ import { defaultOnMouseDownHandler } from '../common';
|
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
18
|
var StyledRadioButton = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n min-height: 48px;\n min-width: 48px;\n\n ", "\n cursor: pointer;\n\n color: ", ";\n\n .pointerTransparent {\n pointer-events: none;\n }\n\n .radio-button-icon {\n margin: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n height: 36px;\n min-width: 36px;\n border-radius: 50%;\n\n svg {\n color: ", ";\n }\n }\n\n .radio-button-label {\n user-select: none;\n display: flex;\n flex-direction: column;\n\n label {\n cursor: inherit;\n }\n\n span {\n ", "\n }\n }\n\n &.small {\n ", "\n .radio-button-label {\n padding-top: 14px;\n }\n }\n\n &.medium {\n ", "\n .radio-button-label {\n padding-top: 12px;\n }\n }\n\n &.large {\n ", "\n .radio-button-label {\n padding-top: 12px;\n }\n }\n\n &:not(.disabled):focus {\n ", "\n }\n\n &:not(.disabled):hover {\n .radio-button-icon {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n }\n }\n\n &:not(.disabled):active {\n .radio-button-icon {\n background: ", ";\n\n svg {\n color: ", ";\n }\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n\n color: ", ";\n\n .radio-button-icon,\n .radio-button-label {\n pointer-events: none;\n }\n\n .radio-button-icon {\n background-color: ", ";\n }\n\n .radio-button-icon svg {\n color: ", ";\n }\n }\n\n &.dropdown-hover:not(.disabled) {\n .radio-button-icon {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n }\n }\n"])), function (props) {
|
|
19
|
-
return props
|
|
19
|
+
return props.$margin ? "margin: ".concat(props.$margin, ";") : '';
|
|
20
20
|
}, function (props) {
|
|
21
21
|
return COLORS.getColor('black', props.theme);
|
|
22
22
|
}, function (props) {
|
|
23
|
-
return props
|
|
23
|
+
return props.$selected ? COLORS.getColor('primary_500', props.theme) : props.$invalid ? COLORS.getColor('critical_400', props.theme) : COLORS.getColor('neutral_600', props.theme);
|
|
24
24
|
}, function (props) {
|
|
25
25
|
return ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme));
|
|
26
26
|
}, function (props) {
|
|
@@ -72,18 +72,18 @@ var RadioButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
72
72
|
size = (_size = size) !== null && _size !== void 0 ? _size : Size.Medium;
|
|
73
73
|
var cls = "".concat(size, " ").concat(className || '', " ").concat(disabled ? ' disabled' : '');
|
|
74
74
|
return /*#__PURE__*/_jsxs(StyledRadioButton, _objectSpread(_objectSpread({
|
|
75
|
-
margin: margin,
|
|
75
|
+
$margin: margin,
|
|
76
76
|
ref: ref,
|
|
77
77
|
onClick: function onClick() {
|
|
78
78
|
return !disabled && select(!selected);
|
|
79
79
|
},
|
|
80
80
|
onMouseDown: defaultOnMouseDownHandler,
|
|
81
81
|
onKeyDown: onKeyPress,
|
|
82
|
-
disabled: disabled,
|
|
82
|
+
$disabled: disabled,
|
|
83
83
|
className: cls,
|
|
84
84
|
tabIndex: disabled ? -1 : tabIndexVal ? tabIndexVal : 0,
|
|
85
|
-
invalid: invalid,
|
|
86
|
-
selected: selected
|
|
85
|
+
$invalid: invalid,
|
|
86
|
+
$selected: selected
|
|
87
87
|
}, rest), {}, {
|
|
88
88
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
89
89
|
className: 'radio-button-icon',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.js","names":["React","styled","SystemIcons","COLORS","ComponentTextStyle","focusStyles","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentXXSStyling","defaultOnMouseDownHandler","jsx","_jsx","jsxs","_jsxs","StyledRadioButton","div","_templateObject","_taggedTemplateLiteral","props","margin","concat","getColor","theme","selected","invalid","Regular","RadioButton","forwardRef","_ref","ref","_size","id","label","additionalLabel","select","disabled","iconPointerEventsTransparent","size","tabIndexVal","className","dataTestId","rest","_objectWithoutProperties","_excluded","onKeyPress","e","keyCode","Medium","cls","_objectSpread","onClick","onMouseDown","onKeyDown","tabIndex","children","RadioButtonOn","RadioButtonOff","htmlFor","undefined","propTypes","_pt","string","bool","isRequired","func","number"],"sources":["../../src/InputFields/RadioButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport {SystemIcons} from '../icons';\r\nimport {COLORS, ComponentTextStyle, focusStyles} from '../styles';\r\nimport {Size, Testable} from '../types';\r\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentXXSStyling} from '../styles';\r\nimport {defaultOnMouseDownHandler} from '../common';\r\n\r\nconst StyledRadioButton = styled.div<{ margin?: string, disabled?: boolean, invalid?: boolean, selected?: boolean }>`\r\n display: flex;\r\n width: 100%;\r\n min-height: 48px;\r\n min-width: 48px;\r\n\r\n ${props => (props.margin ? `margin: ${props.margin};` : '')}\r\n cursor: pointer;\r\n\r\n color: ${props => COLORS.getColor('black', props.theme)};\r\n\r\n .pointerTransparent {\r\n pointer-events: none;\r\n }\r\n\r\n .radio-button-icon {\r\n margin: 6px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n box-sizing: border-box;\r\n height: 36px;\r\n min-width: 36px;\r\n border-radius: 50%;\r\n\r\n svg {\r\n color: ${props => (props.selected ? COLORS.getColor('primary_500', props.theme) : props.invalid ? COLORS.getColor('critical_400', props.theme) : COLORS.getColor('neutral_600', props.theme))};\r\n }\r\n }\r\n\r\n .radio-button-label {\r\n user-select: none;\r\n display: flex;\r\n flex-direction: column;\r\n\r\n label {\r\n cursor: inherit;\r\n }\r\n\r\n span {\r\n ${props => ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n }\r\n }\r\n\r\n &.small {\r\n ${props => ComponentSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 14px;\r\n }\r\n }\r\n\r\n &.medium {\r\n ${props => ComponentMStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 12px;\r\n }\r\n }\r\n\r\n &.large {\r\n ${props => ComponentLStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 12px;\r\n }\r\n }\r\n\r\n &:not(.disabled):focus {\r\n ${focusStyles}\r\n }\r\n\r\n &:not(.disabled):hover {\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &:not(.disabled):active {\r\n .radio-button-icon {\r\n background: ${props => COLORS.getColor('primary_100', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_800', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &.disabled {\r\n cursor: not-allowed;\r\n\r\n color: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n\r\n .radio-button-icon,\r\n .radio-button-label {\r\n pointer-events: none;\r\n }\r\n\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n\r\n .radio-button-icon svg {\r\n color: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n\r\n &.dropdown-hover:not(.disabled) {\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport type RadioButtonProps = Testable & Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'className' | 'onClick' | 'onMouseDown' | 'onKeyDown'> & {\r\n /** Optional. Id of the component */\r\n id?: string;\r\n /** Required. Current state of the component. */\r\n selected: boolean;\r\n /** Required. Handler to be called when user selects/unselected the radio button. */\r\n select: (selected: boolean) => void;\r\n /** Optional. Label to be shown on the right side of the radio button. */\r\n label?: string;\r\n /** Optional. Secondary label to be shown under the main 'label' */\r\n additionalLabel?: string;\r\n /** Optional. If set, then if radiobutton is in unselected state it will be shown in invalid state. */\r\n invalid?: boolean;\r\n /** Optional. If disabled, user can not interact with the component. */\r\n disabled?: boolean;\r\n /** Optional. If set, then 'pointer-events: none' will be set on the component. */\r\n iconPointerEventsTransparent?: boolean;\r\n /** Optional. Margin style attribute to be set on the top level tag of the component. */\r\n margin?: string;\r\n /** Optional. Size of the radio button, defaults to 'medium'. */\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n /** Optional. TabIndex attribute to be set on the component. */\r\n tabIndexVal?: number;\r\n /** Optional. Extra classname to be set on the container of the component. */\r\n className?: string;\r\n}\r\n\r\nconst RadioButton = React.forwardRef<HTMLDivElement, RadioButtonProps>(({\r\n id,\r\n selected,\r\n label,\r\n additionalLabel,\r\n invalid,\r\n select,\r\n disabled,\r\n margin,\r\n iconPointerEventsTransparent,\r\n size,\r\n tabIndexVal,\r\n className,\r\n dataTestId,\r\n ...rest\r\n }: RadioButtonProps, ref) => {\r\n const onKeyPress = (e: any) => {\r\n if (e.keyCode === 13 && !disabled) {\r\n select(!selected);\r\n }\r\n };\r\n\r\n size = size ?? Size.Medium;\r\n\r\n const cls = `${size} ${className || ''} ${disabled ? ' disabled' : ''}`;\r\n\r\n return (\r\n <StyledRadioButton key={id}\r\n margin={margin}\r\n ref={ref}\r\n onClick={() => !disabled && select(!selected)}\r\n onMouseDown={defaultOnMouseDownHandler}\r\n onKeyDown={onKeyPress}\r\n disabled={disabled}\r\n className={cls}\r\n tabIndex={disabled ? -1 : (tabIndexVal ? tabIndexVal : 0)}\r\n invalid={invalid}\r\n selected={selected}\r\n {...rest}>\r\n <div className={'radio-button-icon'} id={id} data-testid={dataTestId}>\r\n {selected && <SystemIcons.RadioButtonOn className={iconPointerEventsTransparent ? 'pointerTransparent' : ''} size=\"24px\"/>}\r\n {!selected &&\r\n <SystemIcons.RadioButtonOff className={iconPointerEventsTransparent ? 'pointerTransparent' : ''} size=\"24px\"/>}\r\n </div>\r\n <div className={'radio-button-label'}>\r\n {label && <label htmlFor={id}>{label}</label>}\r\n {additionalLabel !== undefined && <span>{additionalLabel}</span>}\r\n </div>\r\n </StyledRadioButton>\r\n );\r\n});\r\n\r\nexport default Rad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EAqBL,CAAC;AAExB,CAAC,CAAC;AAACL,WAAA,CAAAiC,SAAA;EA3ED5B,EAAE,EAAA6B,GAAA,CAAAC,MAAA;EAEFtC,QAAQ,EAAAqC,GAAA,CAAAE,IAAA,CAAAC,UAAA;EAER7B,MAAM,EAAA0B,GAAA,CAAAI,IAAA,CAAAD,UAAA;EAEN/B,KAAK,EAAA4B,GAAA,CAAAC,MAAA;EAEL5B,eAAe,EAAA2B,GAAA,CAAAC,MAAA;EAEfrC,OAAO,EAAAoC,GAAA,CAAAE,IAAA;EAEP3B,QAAQ,EAAAyB,GAAA,CAAAE,IAAA;EAER1B,4BAA4B,EAAAwB,GAAA,CAAAE,IAAA;EAE5B3C,MAAM,EAAAyC,GAAA,CAAAC,MAAA;EAINvB,WAAW,EAAAsB,GAAA,CAAAK,MAAA;EAEX1B,SAAS,EAAAqB,GAAA,CAAAC;AAAA;AAuDX,eAAenC,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"RadioButton.js","names":["React","styled","SystemIcons","COLORS","ComponentTextStyle","focusStyles","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentXXSStyling","defaultOnMouseDownHandler","jsx","_jsx","jsxs","_jsxs","StyledRadioButton","div","_templateObject","_taggedTemplateLiteral","props","$margin","concat","getColor","theme","$selected","$invalid","Regular","RadioButton","forwardRef","_ref","ref","_size","id","selected","label","additionalLabel","invalid","select","disabled","margin","iconPointerEventsTransparent","size","tabIndexVal","className","dataTestId","rest","_objectWithoutProperties","_excluded","onKeyPress","e","keyCode","Medium","cls","_objectSpread","onClick","onMouseDown","onKeyDown","$disabled","tabIndex","children","RadioButtonOn","RadioButtonOff","htmlFor","undefined","propTypes","_pt","string","bool","isRequired","func","number"],"sources":["../../src/InputFields/RadioButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport {SystemIcons} from '../icons';\r\nimport {COLORS, ComponentTextStyle, focusStyles} from '../styles';\r\nimport {Size, Testable} from '../types';\r\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentXXSStyling} from '../styles';\r\nimport {defaultOnMouseDownHandler} from '../common';\r\n\r\nconst StyledRadioButton = styled.div<{ $margin?: string, $disabled?: boolean, $invalid?: boolean, $selected?: boolean }>`\r\n display: flex;\r\n width: 100%;\r\n min-height: 48px;\r\n min-width: 48px;\r\n\r\n ${props => (props.$margin ? `margin: ${props.$margin};` : '')}\r\n cursor: pointer;\r\n\r\n color: ${props => COLORS.getColor('black', props.theme)};\r\n\r\n .pointerTransparent {\r\n pointer-events: none;\r\n }\r\n\r\n .radio-button-icon {\r\n margin: 6px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n box-sizing: border-box;\r\n height: 36px;\r\n min-width: 36px;\r\n border-radius: 50%;\r\n\r\n svg {\r\n color: ${props => (props.$selected ? COLORS.getColor('primary_500', props.theme) : props.$invalid ? COLORS.getColor('critical_400', props.theme) : COLORS.getColor('neutral_600', props.theme))};\r\n }\r\n }\r\n\r\n .radio-button-label {\r\n user-select: none;\r\n display: flex;\r\n flex-direction: column;\r\n\r\n label {\r\n cursor: inherit;\r\n }\r\n\r\n span {\r\n ${props => ComponentXXSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n }\r\n }\r\n\r\n &.small {\r\n ${props => ComponentSStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 14px;\r\n }\r\n }\r\n\r\n &.medium {\r\n ${props => ComponentMStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 12px;\r\n }\r\n }\r\n\r\n &.large {\r\n ${props => ComponentLStyling(ComponentTextStyle.Regular, COLORS.getColor('black', props.theme))}\r\n .radio-button-label {\r\n padding-top: 12px;\r\n }\r\n }\r\n\r\n &:not(.disabled):focus {\r\n ${focusStyles}\r\n }\r\n\r\n &:not(.disabled):hover {\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &:not(.disabled):active {\r\n .radio-button-icon {\r\n background: ${props => COLORS.getColor('primary_100', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_800', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n &.disabled {\r\n cursor: not-allowed;\r\n\r\n color: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n\r\n .radio-button-icon,\r\n .radio-button-label {\r\n pointer-events: none;\r\n }\r\n\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('white', props.theme)};\r\n }\r\n\r\n .radio-button-icon svg {\r\n color: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n\r\n &.dropdown-hover:not(.disabled) {\r\n .radio-button-icon {\r\n background-color: ${props => COLORS.getColor('primary_20', props.theme)};\r\n\r\n svg {\r\n color: ${props => COLORS.getColor('primary_700', props.theme)};\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport type RadioButtonProps = Testable & Omit<React.HTMLAttributes<HTMLDivElement>, 'tabIndex' | 'className' | 'onClick' | 'onMouseDown' | 'onKeyDown'> & {\r\n /** Optional. Id of the component */\r\n id?: string;\r\n /** Required. Current state of the component. */\r\n selected: boolean;\r\n /** Required. Handler to be called when user selects/unselected the radio button. */\r\n select: (selected: boolean) => void;\r\n /** Optional. Label to be shown on the right side of the radio button. */\r\n label?: string;\r\n /** Optional. Secondary label to be shown under the main 'label' */\r\n additionalLabel?: string;\r\n /** Optional. If set, then if radiobutton is in unselected state it will be shown in invalid state. */\r\n invalid?: boolean;\r\n /** Optional. If disabled, user can not interact with the component. */\r\n disabled?: boolean;\r\n /** Optional. If set, then 'pointer-events: none' will be set on the component. */\r\n iconPointerEventsTransparent?: boolean;\r\n /** Optional. Margin style attribute to be set on the top level tag of the component. */\r\n margin?: string;\r\n /** Optional. Size of the radio button, defaults to 'medium'. */\r\n size?: Size.Small | Size.Medium | Size.Large;\r\n /** Optional. TabIndex attribute to be set on the component. */\r\n tabIndexVal?: number;\r\n /** Optional. Extra classname to be set on the container of the component. */\r\n className?: string;\r\n}\r\n\r\nconst RadioButton = React.forwardRef<HTMLDivElement, RadioButtonProps>(({\r\n id,\r\n selected,\r\n label,\r\n additionalLabel,\r\n invalid,\r\n select,\r\n disabled,\r\n margin,\r\n iconPointerEventsTransparent,\r\n size,\r\n tabIndexVal,\r\n className,\r\n dataTestId,\r\n ...rest\r\n }: RadioButtonProps, ref) => {\r\n const onKeyPress = (e: any) => {\r\n if (e.keyCode === 13 && !disabled) {\r\n select(!selected);\r\n }\r\n };\r\n\r\n size = size ?? Size.Medium;\r\n\r\n const cls = `${size} ${className || ''} ${disabled ? ' disabled' : ''}`;\r\n\r\n return (\r\n <StyledRadioButton key={id}\r\n $margin={margin}\r\n ref={ref}\r\n onClick={() => !disabled && select(!selected)}\r\n onMouseDown={defaultOnMouseDownHandler}\r\n onKeyDown={onKeyPress}\r\n $disabled={disabled}\r\n className={cls}\r\n tabIndex={disabled ? -1 : (tabIndexVal ? tabIndexVal : 0)}\r\n $invalid={invalid}\r\n $selected={selected}\r\n {...rest}>\r\n <div className={'radio-button-icon'} id={id} data-testid={dataTestId}>\r\n {selected && <SystemIcons.RadioButtonOn className={iconPointerEventsTransparent ? 'pointerTransparent' : ''} size=\"24px\"/>}\r\n {!selected &&\r\n <SystemIcons.RadioButtonOff className={iconPointerEventsTransparent ? 'pointerTransparent' : ''} size=\"24px\"/>}\r\n </div>\r\n <div className={'radio-button-label'}>\r\n {label && <label htmlFor={id}>{label}</label>}\r\n {additionalLabel !== undefined && <span>{additionalLabel}</span>}\r\n </div>\r\n </StyledRadioButton>\r\n );\r\n});\r\n\r\nexport default RadioButton;\r\n"],"mappings":";;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAAQC,WAAW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QAAQ,EAAAgC,GAAA,CAAAE,IAAA,CAAAC,UAAA;EAER/B,MAAM,EAAA4B,GAAA,CAAAI,IAAA,CAAAD,UAAA;EAENlC,KAAK,EAAA+B,GAAA,CAAAC,MAAA;EAEL/B,eAAe,EAAA8B,GAAA,CAAAC,MAAA;EAEf9B,OAAO,EAAA6B,GAAA,CAAAE,IAAA;EAEP7B,QAAQ,EAAA2B,GAAA,CAAAE,IAAA;EAER3B,4BAA4B,EAAAyB,GAAA,CAAAE,IAAA;EAE5B5B,MAAM,EAAA0B,GAAA,CAAAC,MAAA;EAINxB,WAAW,EAAAuB,GAAA,CAAAK,MAAA;EAEX3B,SAAS,EAAAsB,GAAA,CAAAC;AAAA;AAuDX,eAAevC,WAAW","ignoreList":[]}
|
|
@@ -76,7 +76,7 @@ export type TextFieldProps = Testable & Omit<React.InputHTMLAttributes<HTMLInput
|
|
|
76
76
|
*/
|
|
77
77
|
note?: TextFieldNote;
|
|
78
78
|
};
|
|
79
|
-
declare const TextField: React.ForwardRefExoticComponent<Testable & Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
79
|
+
declare const TextField: React.ForwardRefExoticComponent<Testable & Omit<React.InputHTMLAttributes<HTMLInputElement>, "id" | "onChange" | "size" | "disabled" | "pattern" | "type" | "value" | "autoComplete" | "maxLength" | "readOnly"> & {
|
|
80
80
|
/**
|
|
81
81
|
* Optional. The ID of the text field.
|
|
82
82
|
*/
|
|
@@ -96,9 +96,6 @@ var ModalContainer = function ModalContainer(props) {
|
|
|
96
96
|
head.appendChild(style);
|
|
97
97
|
style.appendChild(document.createTextNode(modalTransitions));
|
|
98
98
|
}
|
|
99
|
-
return function () {
|
|
100
|
-
return resetScroll();
|
|
101
|
-
};
|
|
102
99
|
}, []);
|
|
103
100
|
var id = props.id,
|
|
104
101
|
showModal = props.showModal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContainer.cjs","names":["React","_interopRequireWildcard","require","_reactModal","_interopRequireDefault","_styles","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","ModalContainerStyles","content","top","left","right","bottom","marginRight","width","height","borderRadius","boxSizing","margin","overflow","boxShadow","BOXSHADOWS","BOXSHADOW_L3","modalTransitions","concat","Z_INDEXES","backdrop","modal","Counter","openInstances","ModalContainer","props","_React$useState","useState","_React$useState2","_slicedToArray2","scroll","setScroll","_React$useState3","_React$useState4","wasOpened","setWasOpened","preventScroll","offset","document","body","style","position","resetScroll","window","scrollTo","useEffect","scrollY","showModal","ReactModal","defaultStyles","overlay","backgroundColor","querySelector","head","getElementsByTagName","createElement","setAttribute","appendChild","createTextNode","id","closeModal","children","_props$height","_props$width","_props$overflow","padding","_props$minWidth","minWidth","_props$maxWidth","maxWidth","_props$zIndex","zIndex","parseInt","zIndexValue","Math","min","max","toast","stylesConfiguration","assign","styles","setAppElement","jsx","isOpen","closeTimeoutMS","onRequestClose","propTypes","_propTypes","string","bool","isRequired","func","any","number","_default","exports"],"sources":["../../src/Modals/ModalContainer.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport ReactModal from 'react-modal';\r\nimport {BOXSHADOWS} from '../styles';\r\nimport {Z_INDEXES} from '../styles';\r\nimport styled, {keyframes} from 'styled-components';\r\n\r\nconst ModalContainerStyles = {\r\n content: {\r\n top: 'auto',\r\n left: 'auto',\r\n right: 'auto',\r\n bottom: 'auto',\r\n marginRight: '-50%',\r\n width: '640px',\r\n height: '320px',\r\n borderRadius: '8px',\r\n boxSizing: 'border-box' as any,\r\n margin: 0,\r\n overflow: 'auto',\r\n boxShadow: BOXSHADOWS.BOXSHADOW_L3,\r\n },\r\n};\r\n\r\n//override modal classes to define the animations\r\nconst modalTransitions = `\r\n\r\n@keyframes modalOpenAnimation {\r\n from{\r\n transform: scale(1.1, 1.1);\r\n }\r\n to {\r\n transform: scale(1, 1);\r\n }\r\n}\r\n\r\n.ReactModal__Overlay {\r\n opacity: 0;\r\n z-index: ${Z_INDEXES.backdrop};\r\n display:flex;\r\n justify-content: center;\r\n align-items: center;\r\n}\r\n\r\n.ReactModal__Overlay--after-open {\r\n opacity: 1;\r\n transition: opacity 150ms cubic-bezier(0.22, 0.61, 0.35, 1);\r\n}\r\n\r\n.ReactModal__Content{\r\n z-index: ${Z_INDEXES.modal};\r\n opacity:0;\r\n transition: opacity 150ms cubic-bezier(0.22, 0.61, 0.35, 1);\r\n}\r\n\r\n.ReactModal__Content--after-open{\r\n opacity: 1;\r\n animation: modalOpenAnimation 150ms ease-in-out;\r\n}\r\n\r\n.ReactModal__Overlay--before-close {\r\n opacity: 0;\r\n transition: opacity 120ms linear;\r\n}\r\n\r\n.ReactModal__Content--before-close{\r\n opacity: 0;\r\n transform: scale(1.1, 1.1);\r\n transition: transform 120ms ease-in-out, opacity 120ms cubic-bezier(0.55, 0.05, 0.67, 0.19);\r\n}\r\n`;\r\n\r\n\r\ntype ModalContainerProps = {\r\n id?: string;\r\n showModal: boolean;\r\n closeModal: () => void;\r\n children: any;\r\n height?: any;\r\n width?: any;\r\n overflow?: string;\r\n padding?: string;\r\n minWidth?: string;\r\n maxWidth?: string;\r\n zIndex?: number;\r\n};\r\n\r\nconst Counter = { openInstances : 0};\r\nconst ModalContainer: React.FC<ModalContainerProps> = (props: ModalContainerProps) => {\r\n\r\n const [scroll, setScroll] = React.useState<number>();\r\n const [wasOpened, setWasOpened] = React.useState<boolean>(false);\r\n \r\n const preventScroll = (offset: number) => {\r\n Counter.openInstances++;\r\n setWasOpened(true);\r\n if (document) {\r\n setScroll(offset);\r\n document.body.style.position = 'fixed';\r\n document.body.style.left = `0px`;\r\n document.body.style.right = `0px`;\r\n document.body.style.top = `-${offset}px`;\r\n }\r\n }\r\n\r\n const resetScroll = () => {\r\n Counter.openInstances--;\r\n if (!Counter.openInstances && document) {\r\n //@ts-ignore\r\n document.body.style.position = null;\r\n //@ts-ignore\r\n document.body.style.left = null;\r\n //@ts-ignore\r\n document.body.style.top = null;\r\n //@ts-ignore\r\n document.body.style.right = null;\r\n scroll && window.scrollTo(0, scroll);\r\n setScroll(0);\r\n }\r\n }\r\n\r\n React.useEffect(() => {\r\n window && setScroll(window.scrollY);\r\n });\r\n\r\n React.useEffect(() => {\r\n //modal was opened\r\n window && !props.showModal && wasOpened && resetScroll();\r\n //modal was closed\r\n window && props.showModal && preventScroll(window.scrollY);\r\n }, [props.showModal]);\r\n\r\n\r\n React.useEffect(() => {\r\n if (ReactModal.defaultStyles.overlay) {\r\n ReactModal.defaultStyles.overlay.backgroundColor = 'rgba(0,0,0,0.5)';\r\n }\r\n\r\n //append style node to override modal transition classes\r\n if (document && !document.querySelector('[modal-custom-styling=\"active\"]')) {\r\n const head = document.head || document.getElementsByTagName('head')[0];\r\n const style = document.createElement('style');\r\n style.setAttribute('modal-custom-styling', 'active');\r\n head.appendChild(style);\r\n style.appendChild(document.createTextNode(modalTransitions));\r\n }\r\n\r\n return () => resetScroll();\r\n }, []);\r\n\r\n const {\r\n id,\r\n showModal,\r\n closeModal,\r\n children,\r\n height = 'auto',\r\n width = 'auto',\r\n overflow = 'visible',\r\n padding,\r\n minWidth = '',\r\n maxWidth = '',\r\n zIndex = parseInt(Z_INDEXES.modal)\r\n } = props;\r\n\r\n // should be at least z-index of modal and below z-index of toast\r\n const zIndexValue = Math.min(Math.max(zIndex, +Z_INDEXES.modal), +Z_INDEXES.toast - 1);\r\n const stylesConfiguration = Object.assign({...ModalContainerStyles.content}, {\r\n height,\r\n width,\r\n padding,\r\n overflow,\r\n minWidth,\r\n maxWidth,\r\n zIndex: zIndexValue\r\n });\r\n const styles = {content: stylesConfiguration};\r\n ReactModal.setAppElement('body');\r\n return (\r\n <ReactModal id={id}\r\n isOpen={showModal}\r\n closeTimeoutMS={120}\r\n onRequest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,GAAA;EACL/E,QAAQ,EAAA0E,UAAA,YAAAC,MAAA;EACRvB,OAAO,EAAAsB,UAAA,YAAAC,MAAA;EACPrB,QAAQ,EAAAoB,UAAA,YAAAC,MAAA;EACRnB,QAAQ,EAAAkB,UAAA,YAAAC,MAAA;EACRjB,MAAM,EAAAgB,UAAA,YAAAM;AAAA;AAAA,IAAAC,QAAA,GAwGOtE,cAAc;AAAAuE,OAAA,cAAAD,QAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ModalContainer.cjs","names":["React","_interopRequireWildcard","require","_reactModal","_interopRequireDefault","_styles","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","ModalContainerStyles","content","top","left","right","bottom","marginRight","width","height","borderRadius","boxSizing","margin","overflow","boxShadow","BOXSHADOWS","BOXSHADOW_L3","modalTransitions","concat","Z_INDEXES","backdrop","modal","Counter","openInstances","ModalContainer","props","_React$useState","useState","_React$useState2","_slicedToArray2","scroll","setScroll","_React$useState3","_React$useState4","wasOpened","setWasOpened","preventScroll","offset","document","body","style","position","resetScroll","window","scrollTo","useEffect","scrollY","showModal","ReactModal","defaultStyles","overlay","backgroundColor","querySelector","head","getElementsByTagName","createElement","setAttribute","appendChild","createTextNode","id","closeModal","children","_props$height","_props$width","_props$overflow","padding","_props$minWidth","minWidth","_props$maxWidth","maxWidth","_props$zIndex","zIndex","parseInt","zIndexValue","Math","min","max","toast","stylesConfiguration","assign","styles","setAppElement","jsx","isOpen","closeTimeoutMS","onRequestClose","propTypes","_propTypes","string","bool","isRequired","func","any","number","_default","exports"],"sources":["../../src/Modals/ModalContainer.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport ReactModal from 'react-modal';\r\nimport {BOXSHADOWS} from '../styles';\r\nimport {Z_INDEXES} from '../styles';\r\nimport styled, {keyframes} from 'styled-components';\r\n\r\nconst ModalContainerStyles = {\r\n content: {\r\n top: 'auto',\r\n left: 'auto',\r\n right: 'auto',\r\n bottom: 'auto',\r\n marginRight: '-50%',\r\n width: '640px',\r\n height: '320px',\r\n borderRadius: '8px',\r\n boxSizing: 'border-box' as any,\r\n margin: 0,\r\n overflow: 'auto',\r\n boxShadow: BOXSHADOWS.BOXSHADOW_L3,\r\n },\r\n};\r\n\r\n//override modal classes to define the animations\r\nconst modalTransitions = `\r\n\r\n@keyframes modalOpenAnimation {\r\n from{\r\n transform: scale(1.1, 1.1);\r\n }\r\n to {\r\n transform: scale(1, 1);\r\n }\r\n}\r\n\r\n.ReactModal__Overlay {\r\n opacity: 0;\r\n z-index: ${Z_INDEXES.backdrop};\r\n display:flex;\r\n justify-content: center;\r\n align-items: center;\r\n}\r\n\r\n.ReactModal__Overlay--after-open {\r\n opacity: 1;\r\n transition: opacity 150ms cubic-bezier(0.22, 0.61, 0.35, 1);\r\n}\r\n\r\n.ReactModal__Content{\r\n z-index: ${Z_INDEXES.modal};\r\n opacity:0;\r\n transition: opacity 150ms cubic-bezier(0.22, 0.61, 0.35, 1);\r\n}\r\n\r\n.ReactModal__Content--after-open{\r\n opacity: 1;\r\n animation: modalOpenAnimation 150ms ease-in-out;\r\n}\r\n\r\n.ReactModal__Overlay--before-close {\r\n opacity: 0;\r\n transition: opacity 120ms linear;\r\n}\r\n\r\n.ReactModal__Content--before-close{\r\n opacity: 0;\r\n transform: scale(1.1, 1.1);\r\n transition: transform 120ms ease-in-out, opacity 120ms cubic-bezier(0.55, 0.05, 0.67, 0.19);\r\n}\r\n`;\r\n\r\n\r\ntype ModalContainerProps = {\r\n id?: string;\r\n showModal: boolean;\r\n closeModal: () => void;\r\n children: any;\r\n height?: any;\r\n width?: any;\r\n overflow?: string;\r\n padding?: string;\r\n minWidth?: string;\r\n maxWidth?: string;\r\n zIndex?: number;\r\n};\r\n\r\nconst Counter = { openInstances : 0};\r\nconst ModalContainer: React.FC<ModalContainerProps> = (props: ModalContainerProps) => {\r\n\r\n const [scroll, setScroll] = React.useState<number>();\r\n const [wasOpened, setWasOpened] = React.useState<boolean>(false);\r\n \r\n const preventScroll = (offset: number) => {\r\n Counter.openInstances++;\r\n setWasOpened(true);\r\n if (document) {\r\n setScroll(offset);\r\n document.body.style.position = 'fixed';\r\n document.body.style.left = `0px`;\r\n document.body.style.right = `0px`;\r\n document.body.style.top = `-${offset}px`;\r\n }\r\n }\r\n\r\n const resetScroll = () => {\r\n Counter.openInstances--;\r\n if (!Counter.openInstances && document) {\r\n //@ts-ignore\r\n document.body.style.position = null;\r\n //@ts-ignore\r\n document.body.style.left = null;\r\n //@ts-ignore\r\n document.body.style.top = null;\r\n //@ts-ignore\r\n document.body.style.right = null;\r\n scroll && window.scrollTo(0, scroll);\r\n setScroll(0);\r\n }\r\n }\r\n\r\n React.useEffect(() => {\r\n window && setScroll(window.scrollY);\r\n });\r\n\r\n React.useEffect(() => {\r\n //modal was opened\r\n window && !props.showModal && wasOpened && resetScroll();\r\n //modal was closed\r\n window && props.showModal && preventScroll(window.scrollY);\r\n }, [props.showModal]);\r\n\r\n\r\n React.useEffect(() => {\r\n if (ReactModal.defaultStyles.overlay) {\r\n ReactModal.defaultStyles.overlay.backgroundColor = 'rgba(0,0,0,0.5)';\r\n }\r\n\r\n //append style node to override modal transition classes\r\n if (document && !document.querySelector('[modal-custom-styling=\"active\"]')) {\r\n const head = document.head || document.getElementsByTagName('head')[0];\r\n const style = document.createElement('style');\r\n style.setAttribute('modal-custom-styling', 'active');\r\n head.appendChild(style);\r\n style.appendChild(document.createTextNode(modalTransitions));\r\n }\r\n \r\n }, []);\r\n\r\n const {\r\n id,\r\n showModal,\r\n closeModal,\r\n children,\r\n height = 'auto',\r\n width = 'auto',\r\n overflow = 'visible',\r\n padding,\r\n minWidth = '',\r\n maxWidth = '',\r\n zIndex = parseInt(Z_INDEXES.modal)\r\n } = props;\r\n\r\n // should be at least z-index of modal and below z-index of toast\r\n const zIndexValue = Math.min(Math.max(zIndex, +Z_INDEXES.modal), +Z_INDEXES.toast - 1);\r\n const stylesConfiguration = Object.assign({...ModalContainerStyles.content}, {\r\n height,\r\n width,\r\n padding,\r\n overflow,\r\n minWidth,\r\n maxWidth,\r\n zIndex: zIndexValue\r\n });\r\n const styles = {content: stylesConfiguration};\r\n ReactModal.setAppElement('body');\r\n return (\r\n <ReactModal id={id}\r\n isOpen={showModal}\r\n closeTimeoutMS={120}\r\n onRequestClose={() => closeModal()}\r\n style={styles}>\r\n {children}\r\n </ReactModal>\r\n );\r\n}\r\n\r\nexport default ModalContainer;\r\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAAqC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CA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A,CAAA8D,SAAA;EA/GC3B,EAAE,EAAA4B,UAAA,YAAAC,MAAA;EACFzC,SAAS,EAAAwC,UAAA,YAAAE,IAAA,CAAAC,UAAA;EACT9B,UAAU,EAAA2B,UAAA,YAAAI,IAAA,CAAAD,UAAA;EACV7B,QAAQ,EAAA0B,UAAA,YAAAK,GAAA,CAAAF,UAAA;EACRjF,MAAM,EAAA8E,UAAA,YAAAK,GAAA;EACNpF,KAAK,EAAA+E,UAAA,YAAAK,GAAA;EACL/E,QAAQ,EAAA0E,UAAA,YAAAC,MAAA;EACRvB,OAAO,EAAAsB,UAAA,YAAAC,MAAA;EACPrB,QAAQ,EAAAoB,UAAA,YAAAC,MAAA;EACRnB,QAAQ,EAAAkB,UAAA,YAAAC,MAAA;EACRjB,MAAM,EAAAgB,UAAA,YAAAM;AAAA;AAAA,IAAAC,QAAA,GAuGOtE,cAAc;AAAAuE,OAAA,cAAAD,QAAA","ignoreList":[]}
|
|
@@ -87,9 +87,6 @@ var ModalContainer = function ModalContainer(props) {
|
|
|
87
87
|
head.appendChild(style);
|
|
88
88
|
style.appendChild(document.createTextNode(modalTransitions));
|
|
89
89
|
}
|
|
90
|
-
return function () {
|
|
91
|
-
return resetScroll();
|
|
92
|
-
};
|
|
93
90
|
}, []);
|
|
94
91
|
var id = props.id,
|
|
95
92
|
showModal = props.showModal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContainer.js","names":["React","ReactModal","BOXSHADOWS","Z_INDEXES","jsx","_jsx","ModalContainerStyles","content","top","left","right","bottom","marginRight","width","height","borderRadius","boxSizing","margin","overflow","boxShadow","BOXSHADOW_L3","modalTransitions","concat","backdrop","modal","Counter","openInstances","ModalContainer","props","_React$useState","useState","_React$useState2","_slicedToArray","scroll","setScroll","_React$useState3","_React$useState4","wasOpened","setWasOpened","preventScroll","offset","document","body","style","position","resetScroll","window","scrollTo","useEffect","scrollY","showModal","defaultStyles","overlay","backgroundColor","querySelector","head","getElementsByTagName","createElement","setAttribute","appendChild","createTextNode","id","closeModal","children","_props$height","_props$width","_props$overflow","padding","_props$minWidth","minWidth","_props$maxWidth","maxWidth","_props$zIndex","zIndex","parseInt","zIndexValue","Math","min","max","toast","stylesConfiguration","Object","assign","_objectSpread","styles","setAppElement","isOpen","closeTimeoutMS","onRequestClose","propTypes","_pt","string","bool","isRequired","func","any","number"],"sources":["../../src/Modals/ModalContainer.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport ReactModal from 'react-modal';\r\nimport {BOXSHADOWS} from '../styles';\r\nimport {Z_INDEXES} from '../styles';\r\nimport styled, {keyframes} from 'styled-components';\r\n\r\nconst ModalContainerStyles = {\r\n content: {\r\n top: 'auto',\r\n left: 'auto',\r\n right: 'auto',\r\n bottom: 'auto',\r\n marginRight: '-50%',\r\n width: '640px',\r\n height: '320px',\r\n borderRadius: '8px',\r\n boxSizing: 'border-box' as any,\r\n margin: 0,\r\n overflow: 'auto',\r\n boxShadow: BOXSHADOWS.BOXSHADOW_L3,\r\n },\r\n};\r\n\r\n//override modal classes to define the animations\r\nconst modalTransitions = `\r\n\r\n@keyframes modalOpenAnimation {\r\n from{\r\n transform: scale(1.1, 1.1);\r\n }\r\n to {\r\n transform: scale(1, 1);\r\n }\r\n}\r\n\r\n.ReactModal__Overlay {\r\n opacity: 0;\r\n z-index: ${Z_INDEXES.backdrop};\r\n display:flex;\r\n justify-content: center;\r\n align-items: center;\r\n}\r\n\r\n.ReactModal__Overlay--after-open {\r\n opacity: 1;\r\n transition: opacity 150ms cubic-bezier(0.22, 0.61, 0.35, 1);\r\n}\r\n\r\n.ReactModal__Content{\r\n z-index: ${Z_INDEXES.modal};\r\n opacity:0;\r\n transition: opacity 150ms cubic-bezier(0.22, 0.61, 0.35, 1);\r\n}\r\n\r\n.ReactModal__Content--after-open{\r\n opacity: 1;\r\n animation: modalOpenAnimation 150ms ease-in-out;\r\n}\r\n\r\n.ReactModal__Overlay--before-close {\r\n opacity: 0;\r\n transition: opacity 120ms linear;\r\n}\r\n\r\n.ReactModal__Content--before-close{\r\n opacity: 0;\r\n transform: scale(1.1, 1.1);\r\n transition: transform 120ms ease-in-out, opacity 120ms cubic-bezier(0.55, 0.05, 0.67, 0.19);\r\n}\r\n`;\r\n\r\n\r\ntype ModalContainerProps = {\r\n id?: string;\r\n showModal: boolean;\r\n closeModal: () => void;\r\n children: any;\r\n height?: any;\r\n width?: any;\r\n overflow?: string;\r\n padding?: string;\r\n minWidth?: string;\r\n maxWidth?: string;\r\n zIndex?: number;\r\n};\r\n\r\nconst Counter = { openInstances : 0};\r\nconst ModalContainer: React.FC<ModalContainerProps> = (props: ModalContainerProps) => {\r\n\r\n const [scroll, setScroll] = React.useState<number>();\r\n const [wasOpened, setWasOpened] = React.useState<boolean>(false);\r\n \r\n const preventScroll = (offset: number) => {\r\n Counter.openInstances++;\r\n setWasOpened(true);\r\n if (document) {\r\n setScroll(offset);\r\n document.body.style.position = 'fixed';\r\n document.body.style.left = `0px`;\r\n document.body.style.right = `0px`;\r\n document.body.style.top = `-${offset}px`;\r\n }\r\n }\r\n\r\n const resetScroll = () => {\r\n Counter.openInstances--;\r\n if (!Counter.openInstances && document) {\r\n //@ts-ignore\r\n document.body.style.position = null;\r\n //@ts-ignore\r\n document.body.style.left = null;\r\n //@ts-ignore\r\n document.body.style.top = null;\r\n //@ts-ignore\r\n document.body.style.right = null;\r\n scroll && window.scrollTo(0, scroll);\r\n setScroll(0);\r\n }\r\n }\r\n\r\n React.useEffect(() => {\r\n window && setScroll(window.scrollY);\r\n });\r\n\r\n React.useEffect(() => {\r\n //modal was opened\r\n window && !props.showModal && wasOpened && resetScroll();\r\n //modal was closed\r\n window && props.showModal && preventScroll(window.scrollY);\r\n }, [props.showModal]);\r\n\r\n\r\n React.useEffect(() => {\r\n if (ReactModal.defaultStyles.overlay) {\r\n ReactModal.defaultStyles.overlay.backgroundColor = 'rgba(0,0,0,0.5)';\r\n }\r\n\r\n //append style node to override modal transition classes\r\n if (document && !document.querySelector('[modal-custom-styling=\"active\"]')) {\r\n const head = document.head || document.getElementsByTagName('head')[0];\r\n const style = document.createElement('style');\r\n style.setAttribute('modal-custom-styling', 'active');\r\n head.appendChild(style);\r\n style.appendChild(document.createTextNode(modalTransitions));\r\n }\r\n\r\n return () => resetScroll();\r\n }, []);\r\n\r\n const {\r\n id,\r\n showModal,\r\n closeModal,\r\n children,\r\n height = 'auto',\r\n width = 'auto',\r\n overflow = 'visible',\r\n padding,\r\n minWidth = '',\r\n maxWidth = '',\r\n zIndex = parseInt(Z_INDEXES.modal)\r\n } = props;\r\n\r\n // should be at least z-index of modal and below z-index of toast\r\n const zIndexValue = Math.min(Math.max(zIndex, +Z_INDEXES.modal), +Z_INDEXES.toast - 1);\r\n const stylesConfiguration = Object.assign({...ModalContainerStyles.content}, {\r\n height,\r\n width,\r\n padding,\r\n overflow,\r\n minWidth,\r\n maxWidth,\r\n zIndex: zIndexValue\r\n });\r\n const styles = {content: stylesConfiguration};\r\n ReactModal.setAppElement('body');\r\n return (\r\n <ReactModal id={id}\r\n isOpen={showModal}\r\n closeTimeoutMS={120}\r\n onRequestClose={() => closeModal()}\r\n style={styles}>\r\n {children}\r\n </ReactModal>\r\n );\r\n}\r\n\r\nexport default ModalContainer;\r\n"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,aAAa;AACpC,SAAQC,UAAU,QAAO,WAAW;AACpC,SAAQC,SAAS,QAAO,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGpC,IAAMC,oBAAoB,GAAG;EAC3BC,OAAO,EAAE;IACPC,GAAG,EAAE,MAAM;IACXC,IAAI,EAAE,MAAM;IACZC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,WAAW,EAAE,MAAM;IACnBC,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE,OAAO;IACfC,YAAY,EAAE,KAAK;IACnBC,SAAS,EAAE,YAAmB;IAC9BC,MAA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,CAAAM;AAAA;AAwGR,eAAerE,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ModalContainer.js","names":["React","ReactModal","BOXSHADOWS","Z_INDEXES","jsx","_jsx","ModalContainerStyles","content","top","left","right","bottom","marginRight","width","height","borderRadius","boxSizing","margin","overflow","boxShadow","BOXSHADOW_L3","modalTransitions","concat","backdrop","modal","Counter","openInstances","ModalContainer","props","_React$useState","useState","_React$useState2","_slicedToArray","scroll","setScroll","_React$useState3","_React$useState4","wasOpened","setWasOpened","preventScroll","offset","document","body","style","position","resetScroll","window","scrollTo","useEffect","scrollY","showModal","defaultStyles","overlay","backgroundColor","querySelector","head","getElementsByTagName","createElement","setAttribute","appendChild","createTextNode","id","closeModal","children","_props$height","_props$width","_props$overflow","padding","_props$minWidth","minWidth","_props$maxWidth","maxWidth","_props$zIndex","zIndex","parseInt","zIndexValue","Math","min","max","toast","stylesConfiguration","Object","assign","_objectSpread","styles","setAppElement","isOpen","closeTimeoutMS","onRequestClose","propTypes","_pt","string","bool","isRequired","func","any","number"],"sources":["../../src/Modals/ModalContainer.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport ReactModal from 'react-modal';\r\nimport {BOXSHADOWS} from '../styles';\r\nimport {Z_INDEXES} from '../styles';\r\nimport styled, {keyframes} from 'styled-components';\r\n\r\nconst ModalContainerStyles = {\r\n content: {\r\n top: 'auto',\r\n left: 'auto',\r\n right: 'auto',\r\n bottom: 'auto',\r\n marginRight: '-50%',\r\n width: '640px',\r\n height: '320px',\r\n borderRadius: '8px',\r\n boxSizing: 'border-box' as any,\r\n margin: 0,\r\n overflow: 'auto',\r\n boxShadow: BOXSHADOWS.BOXSHADOW_L3,\r\n },\r\n};\r\n\r\n//override modal classes to define the animations\r\nconst modalTransitions = `\r\n\r\n@keyframes modalOpenAnimation {\r\n from{\r\n transform: scale(1.1, 1.1);\r\n }\r\n to {\r\n transform: scale(1, 1);\r\n }\r\n}\r\n\r\n.ReactModal__Overlay {\r\n opacity: 0;\r\n z-index: ${Z_INDEXES.backdrop};\r\n display:flex;\r\n justify-content: center;\r\n align-items: center;\r\n}\r\n\r\n.ReactModal__Overlay--after-open {\r\n opacity: 1;\r\n transition: opacity 150ms cubic-bezier(0.22, 0.61, 0.35, 1);\r\n}\r\n\r\n.ReactModal__Content{\r\n z-index: ${Z_INDEXES.modal};\r\n opacity:0;\r\n transition: opacity 150ms cubic-bezier(0.22, 0.61, 0.35, 1);\r\n}\r\n\r\n.ReactModal__Content--after-open{\r\n opacity: 1;\r\n animation: modalOpenAnimation 150ms ease-in-out;\r\n}\r\n\r\n.ReactModal__Overlay--before-close {\r\n opacity: 0;\r\n transition: opacity 120ms linear;\r\n}\r\n\r\n.ReactModal__Content--before-close{\r\n opacity: 0;\r\n transform: scale(1.1, 1.1);\r\n transition: transform 120ms ease-in-out, opacity 120ms cubic-bezier(0.55, 0.05, 0.67, 0.19);\r\n}\r\n`;\r\n\r\n\r\ntype ModalContainerProps = {\r\n id?: string;\r\n showModal: boolean;\r\n closeModal: () => void;\r\n children: any;\r\n height?: any;\r\n width?: any;\r\n overflow?: string;\r\n padding?: string;\r\n minWidth?: string;\r\n maxWidth?: string;\r\n zIndex?: number;\r\n};\r\n\r\nconst Counter = { openInstances : 0};\r\nconst ModalContainer: React.FC<ModalContainerProps> = (props: ModalContainerProps) => {\r\n\r\n const [scroll, setScroll] = React.useState<number>();\r\n const [wasOpened, setWasOpened] = React.useState<boolean>(false);\r\n \r\n const preventScroll = (offset: number) => {\r\n Counter.openInstances++;\r\n setWasOpened(true);\r\n if (document) {\r\n setScroll(offset);\r\n document.body.style.position = 'fixed';\r\n document.body.style.left = `0px`;\r\n document.body.style.right = `0px`;\r\n document.body.style.top = `-${offset}px`;\r\n }\r\n }\r\n\r\n const resetScroll = () => {\r\n Counter.openInstances--;\r\n if (!Counter.openInstances && document) {\r\n //@ts-ignore\r\n document.body.style.position = null;\r\n //@ts-ignore\r\n document.body.style.left = null;\r\n //@ts-ignore\r\n document.body.style.top = null;\r\n //@ts-ignore\r\n document.body.style.right = null;\r\n scroll && window.scrollTo(0, scroll);\r\n setScroll(0);\r\n }\r\n }\r\n\r\n React.useEffect(() => {\r\n window && setScroll(window.scrollY);\r\n });\r\n\r\n React.useEffect(() => {\r\n //modal was opened\r\n window && !props.showModal && wasOpened && resetScroll();\r\n //modal was closed\r\n window && props.showModal && preventScroll(window.scrollY);\r\n }, [props.showModal]);\r\n\r\n\r\n React.useEffect(() => {\r\n if (ReactModal.defaultStyles.overlay) {\r\n ReactModal.defaultStyles.overlay.backgroundColor = 'rgba(0,0,0,0.5)';\r\n }\r\n\r\n //append style node to override modal transition classes\r\n if (document && !document.querySelector('[modal-custom-styling=\"active\"]')) {\r\n const head = document.head || document.getElementsByTagName('head')[0];\r\n const style = document.createElement('style');\r\n style.setAttribute('modal-custom-styling', 'active');\r\n head.appendChild(style);\r\n style.appendChild(document.createTextNode(modalTransitions));\r\n }\r\n \r\n }, []);\r\n\r\n const {\r\n id,\r\n showModal,\r\n closeModal,\r\n children,\r\n height = 'auto',\r\n width = 'auto',\r\n overflow = 'visible',\r\n padding,\r\n minWidth = '',\r\n maxWidth = '',\r\n zIndex = parseInt(Z_INDEXES.modal)\r\n } = props;\r\n\r\n // should be at least z-index of modal and below z-index of toast\r\n const zIndexValue = Math.min(Math.max(zIndex, +Z_INDEXES.modal), +Z_INDEXES.toast - 1);\r\n const stylesConfiguration = Object.assign({...ModalContainerStyles.content}, {\r\n height,\r\n width,\r\n padding,\r\n overflow,\r\n minWidth,\r\n maxWidth,\r\n zIndex: zIndexValue\r\n });\r\n const styles = {content: stylesConfiguration};\r\n ReactModal.setAppElement('body');\r\n return (\r\n <ReactModal id={id}\r\n isOpen={showModal}\r\n closeTimeoutMS={120}\r\n onRequestClose={() => closeModal()}\r\n style={styles}>\r\n {children}\r\n </ReactModal>\r\n );\r\n}\r\n\r\nexport default ModalContainer;\r\n"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC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AI,IAAA,CAAAD,UAAA;EACV9B,QAAQ,EAAA2B,GAAA,CAAAK,GAAA,CAAAF,UAAA;EACR/E,MAAM,EAAA4E,GAAA,CAAAK,GAAA;EACNlF,KAAK,EAAA6E,GAAA,CAAAK,GAAA;EACL7E,QAAQ,EAAAwE,GAAA,CAAAC,MAAA;EACRxB,OAAO,EAAAuB,GAAA,CAAAC,MAAA;EACPtB,QAAQ,EAAAqB,GAAA,CAAAC,MAAA;EACRpB,QAAQ,EAAAmB,GAAA,CAAAC,MAAA;EACRlB,MAAM,EAAAiB,GAAA,CAAAM;AAAA;AAuGR,eAAerE,cAAc","ignoreList":[]}
|
|
@@ -27,7 +27,7 @@ var PortraitOverlay = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
27
27
|
return _.COLORS.getColor('black', props.theme);
|
|
28
28
|
});
|
|
29
29
|
var ProfileButtonContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ", " {\n display: ", ";\n\n ", " {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ", " {\n background-color: ", ";\n\n svg, svg path {\n fill: ", ";\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ", " {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ", " {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n"])), _Iconbutton.IconButtonStyledPrimary, function (props) {
|
|
30
|
-
return props
|
|
30
|
+
return props.$hideOnLowWidth ? 'none' : 'inline';
|
|
31
31
|
}, _styles.BREAKPOINTS.MEDIUM, _Iconbutton.IconButtonContentStyles, function (props) {
|
|
32
32
|
return _.COLORS.getColor('neutral_100', props.theme);
|
|
33
33
|
}, function (props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileButton.cjs","names":["React","_interopRequireWildcard","require","_styledComponents","_","_Iconbutton","_NotificationDot","_styles","_jsxRuntime","_excluded","_templateObject","_templateObject2","_templateObject3","_templateObject4","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","PortraitOverlay","styled","div","_taggedTemplateLiteral2","props","COLORS","getColor","theme","ProfileButtonContainer","IconButtonStyledPrimary","hideOnLowWidth","BREAKPOINTS","MEDIUM","IconButtonContentStyles","exports","NotificationContainer","ImageWrapper","ProfileButton","forwardRef","_ref","ref","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","tabIndex","rest","_objectWithoutProperties2","useTheme","renderIcon","jsxs","children","jsx","src","ComponentS","textStyle","ComponentTextStyle","Bold","color","Fragment","IconButton","action","variant","shape","NotificationDot","size","Size","Medium","propTypes","_propTypes","string","node","func","isRequired","oneOf","_default"],"sources":["../../src/ProfileButton/ProfileButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled, { useTheme } from 'styled-components';\r\nimport {COLORS, IconButton, Size} from '..';\r\nimport {IconButtonContentStyles, IconButtonStyledPrimary} from '../Button/Iconbutton';\r\nimport {NotificationDot} from '../NotificationDot';\r\nimport {BREAKPOINTS, ComponentS, ComponentTextStyle} from '../styles';\r\n\r\nexport type ProfileButtonProps = {\r\n /**\r\n * Optional. The source URL of the profile picture.\r\n */\r\n portraitSrc?: string;\r\n\r\n /**\r\n * Optional. The icon of the profile to be displayed in absence of 'portraitSrc' and 'initials'.\r\n */\r\n icon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The initials of the user. If provided, these will be displayed in circle in the absence of a profile picture.\r\n */\r\n initials?: string;\r\n\r\n /**\r\n * Required. The handler function to be called when the button is clicked.\r\n */\r\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;\r\n\r\n /**\r\n * Optional. The variant of the notification dot. It can be 'positive' or 'critical'.\r\n */\r\n notificationVariant?: 'positive' | 'critical';\r\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> ;\r\n\r\nconst PortraitOverlay = styled.div`\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n background-color: ${props => COLORS.getColor('black', props.theme)};\r\n opacity: 0;\r\n position: absolute;\r\n top: 0px;\r\n left: 0px;\r\n`;\r\n\r\nexport const ProfileButtonContainer = styled.div<{ hideOnLowWidth?: boolean }>`\r\n width: 48px;\r\n height: 48px;\r\n display: inline;\r\n user-select: none;\r\n \r\n ${IconButtonStyledPrimary} {\r\n display: ${props => (props.hideOnLowWidth ? 'none' : 'inline')};\r\n\r\n ${BREAKPOINTS.MEDIUM} {\r\n display: inline;\r\n }\r\n\r\n :disabled {\r\n img {\r\n filter: grayscale(100%);\r\n }\r\n\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('neutral_100', props.theme)};\r\n\r\n svg, svg path {\r\n fill: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n :hover:not(:disabled):not(:active),\r\n &.hover-state {\r\n ${PortraitOverlay} {\r\n opacity: 0.25;\r\n transition: opacity 100ms ease-in-out;\r\n }\r\n }\r\n\r\n :active:not(:disabled),\r\n &.active-state {\r\n ${PortraitOverlay} {\r\n opacity: 0.5;\r\n transition: opacity 0ms ease-in-out;\r\n }\r\n }\r\n }\r\n`;\r\n\r\nconst NotificationContainer = styled.div`\r\n position: absolute;\r\n left: 30px;\r\n bottom: 30px;\r\n`;\r\n\r\nconst ImageWrapper = styled.div`\r\n width: 36px;\r\n height: 36px;\r\n position: relative;\r\n\r\n img {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n object-fit: cover;\r\n }\r\n`;\r\n\r\nconst ProfileButton = React.forwardRef<HTMLButtonElement, ProfileButtonProps>(({\r\n portraitSrc,\r\n icon,\r\n initials,\r\n onClick,\r\n disabled,\r\n notificationVariant,\r\n className,\r\n tabIndex,\r\n ...rest\r\n }, ref) => {\r\n const theme = useTheme();\r\n const renderIcon = () => {\r\n return (\r\n (portraitSrc && (\r\n <ImageWrapper>\r\n <img src={portraitSrc}/>\r\n <PortraitOverlay/>\r\n </ImageWrapper>\r\n )) ||\r\n (initials && (\r\n <ComponentS className=\"initials\" textStyle={ComponentTextStyle.Bold}\r\n color={disabled ? COLORS.getColor('neutral_300', theme) : COLORS.getColor('white', theme)}>\r\n {initials}\r\n </ComponentS>\r\n )) || <>{icon}</>\r\n );\r\n };\r\n\r\n return (\r\n <ProfileButtonContainer>\r\n <IconButton ref={ref}\r\n className={className}\r\n disabled={disabled}\r\n action={onClick}\r\n variant=\"primary\"\r\n tabIndex={tabIndex}\r\n shape=\"circular\"\r\n {...rest}>\r\n {renderIcon()}\r\n {notificationVariant && (\r\n <NotificationContainer>\r\n <NotificationDot size={Size.Medium} variant={notificationVariant}/>\r\n </NotificationContainer>\r\n )}\r\n </IconButton>\r\n </ProfileButtonContainer>\r\n );\r\n});\r\n\r\nexport default ProfileButton;\r\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAsE,IAAAM,WAAA,GAAAN,OAAA;AAAA,IAAAO,SAAA;AAAA,IAAAC,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA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EAKJ/B,QAAQ,EAAA6B,UAAA,YAAAC,MAAA;EAKR7B,OAAO,EAAA4B,UAAA,YAAAG,IAAA,CAAAC,UAAA;EAKP9B,mBAAmB,EAAA0B,UAAA,YAAAK,KAAA,EAAG,UAAU,EAAG,UAAU;AAAA;AAAA,IAAAC,QAAA,GAgIhCzC,aAAa;AAAAH,OAAA,cAAA4C,QAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ProfileButton.cjs","names":["React","_interopRequireWildcard","require","_styledComponents","_","_Iconbutton","_NotificationDot","_styles","_jsxRuntime","_excluded","_templateObject","_templateObject2","_templateObject3","_templateObject4","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","PortraitOverlay","styled","div","_taggedTemplateLiteral2","props","COLORS","getColor","theme","ProfileButtonContainer","IconButtonStyledPrimary","$hideOnLowWidth","BREAKPOINTS","MEDIUM","IconButtonContentStyles","exports","NotificationContainer","ImageWrapper","ProfileButton","forwardRef","_ref","ref","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","tabIndex","rest","_objectWithoutProperties2","useTheme","renderIcon","jsxs","children","jsx","src","ComponentS","textStyle","ComponentTextStyle","Bold","color","Fragment","IconButton","action","variant","shape","NotificationDot","size","Size","Medium","propTypes","_propTypes","string","node","func","isRequired","oneOf","_default"],"sources":["../../src/ProfileButton/ProfileButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled, { useTheme } from 'styled-components';\r\nimport {COLORS, IconButton, Size} from '..';\r\nimport {IconButtonContentStyles, IconButtonStyledPrimary} from '../Button/Iconbutton';\r\nimport {NotificationDot} from '../NotificationDot';\r\nimport {BREAKPOINTS, ComponentS, ComponentTextStyle} from '../styles';\r\n\r\nexport type ProfileButtonProps = {\r\n /**\r\n * Optional. The source URL of the profile picture.\r\n */\r\n portraitSrc?: string;\r\n\r\n /**\r\n * Optional. The icon of the profile to be displayed in absence of 'portraitSrc' and 'initials'.\r\n */\r\n icon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The initials of the user. If provided, these will be displayed in circle in the absence of a profile picture.\r\n */\r\n initials?: string;\r\n\r\n /**\r\n * Required. The handler function to be called when the button is clicked.\r\n */\r\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;\r\n\r\n /**\r\n * Optional. The variant of the notification dot. It can be 'positive' or 'critical'.\r\n */\r\n notificationVariant?: 'positive' | 'critical';\r\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> ;\r\n\r\nconst PortraitOverlay = styled.div`\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n background-color: ${props => COLORS.getColor('black', props.theme)};\r\n opacity: 0;\r\n position: absolute;\r\n top: 0px;\r\n left: 0px;\r\n`;\r\n\r\nexport const ProfileButtonContainer = styled.div<{ $hideOnLowWidth?: boolean }>`\r\n width: 48px;\r\n height: 48px;\r\n display: inline;\r\n user-select: none;\r\n \r\n ${IconButtonStyledPrimary} {\r\n display: ${props => (props.$hideOnLowWidth ? 'none' : 'inline')};\r\n\r\n ${BREAKPOINTS.MEDIUM} {\r\n display: inline;\r\n }\r\n\r\n :disabled {\r\n img {\r\n filter: grayscale(100%);\r\n }\r\n\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('neutral_100', props.theme)};\r\n\r\n svg, svg path {\r\n fill: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n :hover:not(:disabled):not(:active),\r\n &.hover-state {\r\n ${PortraitOverlay} {\r\n opacity: 0.25;\r\n transition: opacity 100ms ease-in-out;\r\n }\r\n }\r\n\r\n :active:not(:disabled),\r\n &.active-state {\r\n ${PortraitOverlay} {\r\n opacity: 0.5;\r\n transition: opacity 0ms ease-in-out;\r\n }\r\n }\r\n }\r\n`;\r\n\r\nconst NotificationContainer = styled.div`\r\n position: absolute;\r\n left: 30px;\r\n bottom: 30px;\r\n`;\r\n\r\nconst ImageWrapper = styled.div`\r\n width: 36px;\r\n height: 36px;\r\n position: relative;\r\n\r\n img {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n object-fit: cover;\r\n }\r\n`;\r\n\r\nconst ProfileButton = React.forwardRef<HTMLButtonElement, ProfileButtonProps>(({\r\n portraitSrc,\r\n icon,\r\n initials,\r\n onClick,\r\n disabled,\r\n notificationVariant,\r\n className,\r\n tabIndex,\r\n ...rest\r\n }, ref) => {\r\n const theme = useTheme();\r\n const renderIcon = () => {\r\n return (\r\n (portraitSrc && (\r\n <ImageWrapper>\r\n <img src={portraitSrc}/>\r\n <PortraitOverlay/>\r\n </ImageWrapper>\r\n )) ||\r\n (initials && (\r\n <ComponentS className=\"initials\" textStyle={ComponentTextStyle.Bold}\r\n color={disabled ? COLORS.getColor('neutral_300', theme) : COLORS.getColor('white', theme)}>\r\n {initials}\r\n </ComponentS>\r\n )) || <>{icon}</>\r\n );\r\n };\r\n\r\n return (\r\n <ProfileButtonContainer>\r\n <IconButton ref={ref}\r\n className={className}\r\n disabled={disabled}\r\n action={onClick}\r\n variant=\"primary\"\r\n tabIndex={tabIndex}\r\n shape=\"circular\"\r\n {...rest}>\r\n {renderIcon()}\r\n {notificationVariant && (\r\n <NotificationContainer>\r\n <NotificationDot size={Size.Medium} variant={notificationVariant}/>\r\n </NotificationContainer>\r\n )}\r\n </IconButton>\r\n </ProfileButtonContainer>\r\n );\r\n});\r\n\r\nexport default ProfileButton;\r\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ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CAAA4E,GAAA,EAAC9E,gBAAA,CAAA0F,eAAe;UAACC,IAAI,EAAEC,MAAI,CAACC,MAAO;UAACL,OAAO,EAAEnB;QAAoB,CAAC;MAAC,CAC9C,CACxB;IAAA,EACS;EAAC,CACS,CAAC;AAE7B,CAAC,CAAC;AAACT,aAAA,CAAAkC,SAAA;EAlJD9B,WAAW,EAAA+B,UAAA,YAAAC,MAAA;EAKX/B,IAAI,EAAA8B,UAAA,YAAAE,IAAA;EAKJ/B,QAAQ,EAAA6B,UAAA,YAAAC,MAAA;EAKR7B,OAAO,EAAA4B,UAAA,YAAAG,IAAA,CAAAC,UAAA;EAKP9B,mBAAmB,EAAA0B,UAAA,YAAAK,KAAA,EAAG,UAAU,EAAG,UAAU;AAAA;AAAA,IAAAC,QAAA,GAgIhCzC,aAAa;AAAAH,OAAA,cAAA4C,QAAA","ignoreList":[]}
|
|
@@ -22,7 +22,7 @@ export type ProfileButtonProps = {
|
|
|
22
22
|
notificationVariant?: 'positive' | 'critical';
|
|
23
23
|
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>;
|
|
24
24
|
export declare const ProfileButtonContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
25
|
-
hideOnLowWidth?: boolean | undefined;
|
|
25
|
+
$hideOnLowWidth?: boolean | undefined;
|
|
26
26
|
}>> & string;
|
|
27
27
|
declare const ProfileButton: React.ForwardRefExoticComponent<{
|
|
28
28
|
/**
|
|
@@ -19,7 +19,7 @@ var PortraitOverlay = styled.div(_templateObject || (_templateObject = _taggedTe
|
|
|
19
19
|
return COLORS.getColor('black', props.theme);
|
|
20
20
|
});
|
|
21
21
|
export var ProfileButtonContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 48px;\n height: 48px;\n display: inline;\n user-select: none;\n \n ", " {\n display: ", ";\n\n ", " {\n display: inline;\n }\n\n :disabled {\n img {\n filter: grayscale(100%);\n }\n\n ", " {\n background-color: ", ";\n\n svg, svg path {\n fill: ", ";\n }\n }\n }\n\n :hover:not(:disabled):not(:active),\n &.hover-state {\n ", " {\n opacity: 0.25;\n transition: opacity 100ms ease-in-out;\n }\n }\n\n :active:not(:disabled),\n &.active-state {\n ", " {\n opacity: 0.5;\n transition: opacity 0ms ease-in-out;\n }\n }\n }\n"])), IconButtonStyledPrimary, function (props) {
|
|
22
|
-
return props
|
|
22
|
+
return props.$hideOnLowWidth ? 'none' : 'inline';
|
|
23
23
|
}, BREAKPOINTS.MEDIUM, IconButtonContentStyles, function (props) {
|
|
24
24
|
return COLORS.getColor('neutral_100', props.theme);
|
|
25
25
|
}, function (props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileButton.js","names":["React","styled","useTheme","COLORS","IconButton","Size","IconButtonContentStyles","IconButtonStyledPrimary","NotificationDot","BREAKPOINTS","ComponentS","ComponentTextStyle","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PortraitOverlay","div","_templateObject","_taggedTemplateLiteral","props","getColor","theme","ProfileButtonContainer","_templateObject2","hideOnLowWidth","MEDIUM","NotificationContainer","_templateObject3","ImageWrapper","_templateObject4","ProfileButton","forwardRef","_ref","ref","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","tabIndex","rest","_objectWithoutProperties","_excluded","renderIcon","children","src","textStyle","Bold","color","_objectSpread","action","variant","shape","size","Medium","propTypes","_pt","string","node","func","isRequired","oneOf"],"sources":["../../src/ProfileButton/ProfileButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled, { useTheme } from 'styled-components';\r\nimport {COLORS, IconButton, Size} from '..';\r\nimport {IconButtonContentStyles, IconButtonStyledPrimary} from '../Button/Iconbutton';\r\nimport {NotificationDot} from '../NotificationDot';\r\nimport {BREAKPOINTS, ComponentS, ComponentTextStyle} from '../styles';\r\n\r\nexport type ProfileButtonProps = {\r\n /**\r\n * Optional. The source URL of the profile picture.\r\n */\r\n portraitSrc?: string;\r\n\r\n /**\r\n * Optional. The icon of the profile to be displayed in absence of 'portraitSrc' and 'initials'.\r\n */\r\n icon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The initials of the user. If provided, these will be displayed in circle in the absence of a profile picture.\r\n */\r\n initials?: string;\r\n\r\n /**\r\n * Required. The handler function to be called when the button is clicked.\r\n */\r\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;\r\n\r\n /**\r\n * Optional. The variant of the notification dot. It can be 'positive' or 'critical'.\r\n */\r\n notificationVariant?: 'positive' | 'critical';\r\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> ;\r\n\r\nconst PortraitOverlay = styled.div`\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n background-color: ${props => COLORS.getColor('black', props.theme)};\r\n opacity: 0;\r\n position: absolute;\r\n top: 0px;\r\n left: 0px;\r\n`;\r\n\r\nexport const ProfileButtonContainer = styled.div<{ hideOnLowWidth?: boolean }>`\r\n width: 48px;\r\n height: 48px;\r\n display: inline;\r\n user-select: none;\r\n \r\n ${IconButtonStyledPrimary} {\r\n display: ${props => (props
|
|
1
|
+
{"version":3,"file":"ProfileButton.js","names":["React","styled","useTheme","COLORS","IconButton","Size","IconButtonContentStyles","IconButtonStyledPrimary","NotificationDot","BREAKPOINTS","ComponentS","ComponentTextStyle","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PortraitOverlay","div","_templateObject","_taggedTemplateLiteral","props","getColor","theme","ProfileButtonContainer","_templateObject2","$hideOnLowWidth","MEDIUM","NotificationContainer","_templateObject3","ImageWrapper","_templateObject4","ProfileButton","forwardRef","_ref","ref","portraitSrc","icon","initials","onClick","disabled","notificationVariant","className","tabIndex","rest","_objectWithoutProperties","_excluded","renderIcon","children","src","textStyle","Bold","color","_objectSpread","action","variant","shape","size","Medium","propTypes","_pt","string","node","func","isRequired","oneOf"],"sources":["../../src/ProfileButton/ProfileButton.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled, { useTheme } from 'styled-components';\r\nimport {COLORS, IconButton, Size} from '..';\r\nimport {IconButtonContentStyles, IconButtonStyledPrimary} from '../Button/Iconbutton';\r\nimport {NotificationDot} from '../NotificationDot';\r\nimport {BREAKPOINTS, ComponentS, ComponentTextStyle} from '../styles';\r\n\r\nexport type ProfileButtonProps = {\r\n /**\r\n * Optional. The source URL of the profile picture.\r\n */\r\n portraitSrc?: string;\r\n\r\n /**\r\n * Optional. The icon of the profile to be displayed in absence of 'portraitSrc' and 'initials'.\r\n */\r\n icon?: React.ReactNode;\r\n\r\n /**\r\n * Optional. The initials of the user. If provided, these will be displayed in circle in the absence of a profile picture.\r\n */\r\n initials?: string;\r\n\r\n /**\r\n * Required. The handler function to be called when the button is clicked.\r\n */\r\n onClick: (event?: React.MouseEvent<HTMLButtonElement>) => void;\r\n\r\n /**\r\n * Optional. The variant of the notification dot. It can be 'positive' or 'critical'.\r\n */\r\n notificationVariant?: 'positive' | 'critical';\r\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> ;\r\n\r\nconst PortraitOverlay = styled.div`\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n background-color: ${props => COLORS.getColor('black', props.theme)};\r\n opacity: 0;\r\n position: absolute;\r\n top: 0px;\r\n left: 0px;\r\n`;\r\n\r\nexport const ProfileButtonContainer = styled.div<{ $hideOnLowWidth?: boolean }>`\r\n width: 48px;\r\n height: 48px;\r\n display: inline;\r\n user-select: none;\r\n \r\n ${IconButtonStyledPrimary} {\r\n display: ${props => (props.$hideOnLowWidth ? 'none' : 'inline')};\r\n\r\n ${BREAKPOINTS.MEDIUM} {\r\n display: inline;\r\n }\r\n\r\n :disabled {\r\n img {\r\n filter: grayscale(100%);\r\n }\r\n\r\n ${IconButtonContentStyles} {\r\n background-color: ${props => COLORS.getColor('neutral_100', props.theme)};\r\n\r\n svg, svg path {\r\n fill: ${props => COLORS.getColor('neutral_300', props.theme)};\r\n }\r\n }\r\n }\r\n\r\n :hover:not(:disabled):not(:active),\r\n &.hover-state {\r\n ${PortraitOverlay} {\r\n opacity: 0.25;\r\n transition: opacity 100ms ease-in-out;\r\n }\r\n }\r\n\r\n :active:not(:disabled),\r\n &.active-state {\r\n ${PortraitOverlay} {\r\n opacity: 0.5;\r\n transition: opacity 0ms ease-in-out;\r\n }\r\n }\r\n }\r\n`;\r\n\r\nconst NotificationContainer = styled.div`\r\n position: absolute;\r\n left: 30px;\r\n bottom: 30px;\r\n`;\r\n\r\nconst ImageWrapper = styled.div`\r\n width: 36px;\r\n height: 36px;\r\n position: relative;\r\n\r\n img {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 50%;\r\n object-fit: cover;\r\n }\r\n`;\r\n\r\nconst ProfileButton = React.forwardRef<HTMLButtonElement, ProfileButtonProps>(({\r\n portraitSrc,\r\n icon,\r\n initials,\r\n onClick,\r\n disabled,\r\n notificationVariant,\r\n className,\r\n tabIndex,\r\n ...rest\r\n }, ref) => {\r\n const theme = useTheme();\r\n const renderIcon = () => {\r\n return (\r\n (portraitSrc && (\r\n <ImageWrapper>\r\n <img src={portraitSrc}/>\r\n <PortraitOverlay/>\r\n </ImageWrapper>\r\n )) ||\r\n (initials && (\r\n <ComponentS className=\"initials\" textStyle={ComponentTextStyle.Bold}\r\n color={disabled ? COLORS.getColor('neutral_300', theme) : COLORS.getColor('white', theme)}>\r\n {initials}\r\n </ComponentS>\r\n )) || <>{icon}</>\r\n );\r\n };\r\n\r\n return (\r\n <ProfileButtonContainer>\r\n <IconButton ref={ref}\r\n className={className}\r\n disabled={disabled}\r\n action={onClick}\r\n variant=\"primary\"\r\n tabIndex={tabIndex}\r\n shape=\"circular\"\r\n {...rest}>\r\n {renderIcon()}\r\n {notificationVariant && (\r\n <NotificationContainer>\r\n <NotificationDot size={Size.Medium} variant={notificationVariant}/>\r\n </NotificationContainer>\r\n )}\r\n </IconButton>\r\n </ProfileBut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zB,IAAA,CAACY,sBAAsB;IAAAwB,QAAA,eACrBlC,KAAA,CAACX,UAAU,EAAAkD,aAAA,CAAAA,aAAA;MAAClB,GAAG,EAAEA,GAAI;MACTO,SAAS,EAAEA,SAAU;MACrBF,QAAQ,EAAEA,QAAS;MACnBc,MAAM,EAAEf,OAAQ;MAChBgB,OAAO,EAAC,SAAS;MACjBZ,QAAQ,EAAEA,QAAS;MACnBa,KAAK,EAAC;IAAU,GACZZ,IAAI;MAAAI,QAAA,GACjBD,UAAU,CAAC,CAAC,EACZN,mBAAmB,iBAClB7B,IAAA,CAACgB,qBAAqB;QAAAoB,QAAA,eACpBpC,IAAA,CAACL,eAAe;UAACkD,IAAI,EAAErD,IAAI,CAACsD,MAAO;UAACH,OAAO,EAAEd;QAAoB,CAAC;MAAC,CAC9C,CACxB;IAAA,EACS;EAAC,CACS,CAAC;AAE7B,CAAC,CAAC;AAACT,aAAA,CAAA2B,SAAA;EAlJDvB,WAAW,EAAAwB,GAAA,CAAAC,MAAA;EAKXxB,IAAI,EAAAuB,GAAA,CAAAE,IAAA;EAKJxB,QAAQ,EAAAsB,GAAA,CAAAC,MAAA;EAKRtB,OAAO,EAAAqB,GAAA,CAAAG,IAAA,CAAAC,UAAA;EAKPvB,mBAAmB,EAAAmB,GAAA,CAAAK,KAAA,EAAG,UAAU,EAAG,UAAU;AAAA;AAgI/C,eAAejC,aAAa","ignoreList":[]}
|
package/dist/Tabs/Tabs.cjs
CHANGED
|
@@ -64,22 +64,22 @@ var getBottomMargin = function getBottomMargin(size) {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
var Nav = _styledComponents["default"].nav(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n\n a {\n height: ", ";\n }\n\n a > div:last-of-type {\n font-size: 12px;\n margin: 0 0 8px 16px;\n }\n a > div:first-child {\n font-size: ", ";\n margin: ", " 0 ", " 16px;\n }\n a > div:only-of-type {\n font-size: ", ";\n margin: auto 0 auto 16px;\n }\n\n @media print {\n display: none;\n }\n"])), function (props) {
|
|
67
|
-
return getHeight(props
|
|
67
|
+
return getHeight(props.$size);
|
|
68
68
|
}, function (props) {
|
|
69
|
-
return getFontSize(props
|
|
69
|
+
return getFontSize(props.$size);
|
|
70
70
|
}, function (props) {
|
|
71
|
-
return getTopMargin(props
|
|
71
|
+
return getTopMargin(props.$size);
|
|
72
72
|
}, function (props) {
|
|
73
|
-
return getBottomMargin(props
|
|
73
|
+
return getBottomMargin(props.$size);
|
|
74
74
|
}, function (props) {
|
|
75
|
-
return getFontSize(props
|
|
75
|
+
return getFontSize(props.$size);
|
|
76
76
|
});
|
|
77
77
|
var Tabs = function Tabs(_ref) {
|
|
78
78
|
var children = _ref.children,
|
|
79
79
|
size = _ref.size;
|
|
80
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Nav, {
|
|
81
81
|
role: "tablist",
|
|
82
|
-
size: size,
|
|
82
|
+
$size: size,
|
|
83
83
|
children: children
|
|
84
84
|
});
|
|
85
85
|
};
|
package/dist/Tabs/Tabs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.cjs","names":["React","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_types","_jsxRuntime","_templateObject","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getHeight","size","Size","Small","Medium","Large","getFontSize","getTopMargin","getBottomMargin","Nav","styled","nav","_taggedTemplateLiteral2","props","Tabs","_ref","children","jsx","role","propTypes","_propTypes","any","_default","exports"],"sources":["../../src/Tabs/Tabs.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport { Size } from '../types';\r\n\r\ntype TabsProps = {\r\n children?: any;\r\n size: Size;\r\n};\r\n\r\nconst getHeight = (size: Size) => {\r\n switch (size) {\r\n case Size.Small:\r\n return '48px';\r\n case Size.Medium:\r\n return '56px';\r\n case Size.Large:\r\n return '64px';\r\n default:\r\n return '48px';\r\n }\r\n};\r\n\r\nconst getFontSize = (size: Size) => {\r\n switch (size) {\r\n case Size.Small:\r\n return '16px';\r\n case Size.Medium:\r\n return '18px';\r\n case Size.Large:\r\n return '20px';\r\n default:\r\n return '20px';\r\n }\r\n};\r\n\r\nconst getTopMargin = (size: Size) => {\r\n switch (size) {\r\n case Size.Small:\r\n return '6px';\r\n case Size.Medium:\r\n return '10px';\r\n case Size.Large:\r\n return '12px';\r\n default:\r\n return '12px';\r\n }\r\n};\r\n\r\nconst getBottomMargin = (size: Size) => {\r\n switch (size) {\r\n case Size.Small:\r\n return '2px';\r\n case Size.Medium:\r\n return '3px';\r\n case Size.Large:\r\n return '4px';\r\n default:\r\n return '4px';\r\n }\r\n};\r\n\r\nconst Nav = styled.nav<{size: Size}>`\r\n display: flex;\r\n flex-direction: column;\r\n\r\n a {\r\n height: ${(props) => getHeight(props
|
|
1
|
+
{"version":3,"file":"Tabs.cjs","names":["React","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_types","_jsxRuntime","_templateObject","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getHeight","size","Size","Small","Medium","Large","getFontSize","getTopMargin","getBottomMargin","Nav","styled","nav","_taggedTemplateLiteral2","props","$size","Tabs","_ref","children","jsx","role","propTypes","_propTypes","any","_default","exports"],"sources":["../../src/Tabs/Tabs.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport { Size } from '../types';\r\n\r\ntype TabsProps = {\r\n children?: any;\r\n size: Size;\r\n};\r\n\r\nconst getHeight = (size: Size) => {\r\n switch (size) {\r\n case Size.Small:\r\n return '48px';\r\n case Size.Medium:\r\n return '56px';\r\n case Size.Large:\r\n return '64px';\r\n default:\r\n return '48px';\r\n }\r\n};\r\n\r\nconst getFontSize = (size: Size) => {\r\n switch (size) {\r\n case Size.Small:\r\n return '16px';\r\n case Size.Medium:\r\n return '18px';\r\n case Size.Large:\r\n return '20px';\r\n default:\r\n return '20px';\r\n }\r\n};\r\n\r\nconst getTopMargin = (size: Size) => {\r\n switch (size) {\r\n case Size.Small:\r\n return '6px';\r\n case Size.Medium:\r\n return '10px';\r\n case Size.Large:\r\n return '12px';\r\n default:\r\n return '12px';\r\n }\r\n};\r\n\r\nconst getBottomMargin = (size: Size) => {\r\n switch (size) {\r\n case Size.Small:\r\n return '2px';\r\n case Size.Medium:\r\n return '3px';\r\n case Size.Large:\r\n return '4px';\r\n default:\r\n return '4px';\r\n }\r\n};\r\n\r\nconst Nav = styled.nav<{$size: Size}>`\r\n display: flex;\r\n flex-direction: column;\r\n\r\n a {\r\n height: ${(props) => getHeight(props.$size)};\r\n }\r\n\r\n a > div:last-of-type {\r\n font-size: 12px;\r\n margin: 0 0 8px 16px;\r\n }\r\n a > div:first-child {\r\n font-size: ${(props) => getFontSize(props.$size)};\r\n margin: ${(props) => getTopMargin(props.$size)} 0 ${(props) => getBottomMargin(props.$size)} 16px;\r\n }\r\n a > div:only-of-type {\r\n font-size: ${(props) => getFontSize(props.$size)};\r\n margin: auto 0 auto 16px;\r\n }\r\n\r\n @media print {\r\n display: none;\r\n }\r\n`;\r\n\r\nconst Tabs: React.FunctionComponent<TabsProps> = ({ children, size }) => (\r\n <Nav role=\"tablist\" $size={size}>\r\n {children}\r\n </Nav>\r\n);\r\n\r\nexport default Tabs;\r\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAgC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,IAAAK,eAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,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