@wireapp/react-ui-kit 8.17.3 → 8.17.4
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/package.json +2 -7
- package/src/Form/Button.js +8 -8
- package/src/Form/Button.js.map +1 -1
- package/src/Form/ButtonLink.js +7 -7
- package/src/Form/ButtonLink.js.map +1 -1
- package/src/Form/Checkbox.js +19 -19
- package/src/Form/Checkbox.js.map +1 -1
- package/src/Form/CodeInput.js +13 -9
- package/src/Form/CodeInput.js.map +1 -1
- package/src/Form/DropFileInput.js +15 -10
- package/src/Form/DropFileInput.js.map +1 -1
- package/src/Form/ErrorMessage.js +8 -8
- package/src/Form/ErrorMessage.js.map +1 -1
- package/src/Form/Form.js +3 -3
- package/src/Form/Form.js.map +1 -1
- package/src/Form/Input.js +16 -10
- package/src/Form/Input.js.map +1 -1
- package/src/Form/InputBlock.js +6 -27
- package/src/Form/InputBlock.js.map +1 -1
- package/src/Form/InputLabel.js +6 -5
- package/src/Form/InputLabel.js.map +1 -1
- package/src/Form/InputSubmitCombo.js +10 -10
- package/src/Form/InputSubmitCombo.js.map +1 -1
- package/src/Form/RangeInput.js +7 -6
- package/src/Form/RangeInput.js.map +1 -1
- package/src/Form/RangeInput.styles.js +3 -4
- package/src/Form/RangeInput.styles.js.map +1 -1
- package/src/Form/RoundIconButton.js +8 -7
- package/src/Form/RoundIconButton.js.map +1 -1
- package/src/Form/Select.js +8 -7
- package/src/Form/Select.js.map +1 -1
- package/src/Form/SelectComponents.js +9 -8
- package/src/Form/SelectComponents.js.map +1 -1
- package/src/Form/SelectStyles.js +2 -3
- package/src/Form/SelectStyles.js.map +1 -1
- package/src/Form/ShakeBox.js +8 -25
- package/src/Form/ShakeBox.js.map +1 -1
- package/src/Form/Switch.js +6 -6
- package/src/Form/Switch.js.map +1 -1
- package/src/Form/TextArea.js +5 -5
- package/src/Form/TextArea.js.map +1 -1
- package/src/Form/Tooltip.js +6 -5
- package/src/Form/Tooltip.js.map +1 -1
- package/src/GlobalStyle.js +3 -3
- package/src/GlobalStyle.js.map +1 -1
- package/src/Icon/AddPeopleIcon.js +4 -26
- package/src/Icon/AddPeopleIcon.js.map +1 -1
- package/src/Icon/ArchiveIcon.js +2 -24
- package/src/Icon/ArchiveIcon.js.map +1 -1
- package/src/Icon/ArrowDown.js +5 -24
- package/src/Icon/ArrowDown.js.map +1 -1
- package/src/Icon/ArrowIcon.js +5 -5
- package/src/Icon/ArrowIcon.js.map +1 -1
- package/src/Icon/AttachmentIcon.js +2 -24
- package/src/Icon/AttachmentIcon.js.map +1 -1
- package/src/Icon/AudioVideoIcon.js +2 -24
- package/src/Icon/AudioVideoIcon.js.map +1 -1
- package/src/Icon/BlockIcon.js +2 -24
- package/src/Icon/BlockIcon.js.map +1 -1
- package/src/Icon/Brand/AndroidIcon.js +2 -24
- package/src/Icon/Brand/AndroidIcon.js.map +1 -1
- package/src/Icon/Brand/AppleIcon.js +2 -24
- package/src/Icon/Brand/AppleIcon.js.map +1 -1
- package/src/Icon/Brand/ChromeIcon.js +2 -24
- package/src/Icon/Brand/ChromeIcon.js.map +1 -1
- package/src/Icon/Brand/FacebookIcon.js +2 -24
- package/src/Icon/Brand/FacebookIcon.js.map +1 -1
- package/src/Icon/Brand/GitHubIcon.js +2 -24
- package/src/Icon/Brand/GitHubIcon.js.map +1 -1
- package/src/Icon/Brand/LinkedInIcon.js +2 -24
- package/src/Icon/Brand/LinkedInIcon.js.map +1 -1
- package/src/Icon/Brand/LinuxIcon.js +2 -24
- package/src/Icon/Brand/LinuxIcon.js.map +1 -1
- package/src/Icon/Brand/MicrosoftIcon.js +2 -24
- package/src/Icon/Brand/MicrosoftIcon.js.map +1 -1
- package/src/Icon/Brand/TwitterIcon.js +2 -24
- package/src/Icon/Brand/TwitterIcon.js.map +1 -1
- package/src/Icon/CallIcon.js +2 -24
- package/src/Icon/CallIcon.js.map +1 -1
- package/src/Icon/CamIcon.js +2 -24
- package/src/Icon/CamIcon.js.map +1 -1
- package/src/Icon/CameraIcon.js +4 -26
- package/src/Icon/CameraIcon.js.map +1 -1
- package/src/Icon/CheckIcon.js +2 -24
- package/src/Icon/CheckIcon.js.map +1 -1
- package/src/Icon/CheckRoundIcon.js +2 -24
- package/src/Icon/CheckRoundIcon.js.map +1 -1
- package/src/Icon/ChevronIcon.js +5 -5
- package/src/Icon/ChevronIcon.js.map +1 -1
- package/src/Icon/CloseIcon.js +2 -24
- package/src/Icon/CloseIcon.js.map +1 -1
- package/src/Icon/CopyIcon.js +2 -24
- package/src/Icon/CopyIcon.js.map +1 -1
- package/src/Icon/DeviceIcon.js +2 -24
- package/src/Icon/DeviceIcon.js.map +1 -1
- package/src/Icon/DownloadIcon.js +2 -24
- package/src/Icon/DownloadIcon.js.map +1 -1
- package/src/Icon/EditDocumentIcon.js +4 -26
- package/src/Icon/EditDocumentIcon.js.map +1 -1
- package/src/Icon/EditIcon.js +2 -24
- package/src/Icon/EditIcon.js.map +1 -1
- package/src/Icon/EnterIcon.js +2 -24
- package/src/Icon/EnterIcon.js.map +1 -1
- package/src/Icon/ErrorIcon.js +2 -24
- package/src/Icon/ErrorIcon.js.map +1 -1
- package/src/Icon/FileIcon.js +2 -24
- package/src/Icon/FileIcon.js.map +1 -1
- package/src/Icon/GifIcon.js +2 -24
- package/src/Icon/GifIcon.js.map +1 -1
- package/src/Icon/GridIcon.js +4 -26
- package/src/Icon/GridIcon.js.map +1 -1
- package/src/Icon/GroupIcon.js +2 -24
- package/src/Icon/GroupIcon.js.map +1 -1
- package/src/Icon/HangupIcon.js +2 -24
- package/src/Icon/HangupIcon.js.map +1 -1
- package/src/Icon/HideIcon.js +2 -24
- package/src/Icon/HideIcon.js.map +1 -1
- package/src/Icon/ImageIcon.js +2 -24
- package/src/Icon/ImageIcon.js.map +1 -1
- package/src/Icon/InfoIcon.js +2 -24
- package/src/Icon/InfoIcon.js.map +1 -1
- package/src/Icon/InviteIcon.js +2 -24
- package/src/Icon/InviteIcon.js.map +1 -1
- package/src/Icon/LeaveIcon.js +2 -24
- package/src/Icon/LeaveIcon.js.map +1 -1
- package/src/Icon/LinkIcon.js +4 -26
- package/src/Icon/LinkIcon.js.map +1 -1
- package/src/Icon/ListIcon.js +2 -24
- package/src/Icon/ListIcon.js.map +1 -1
- package/src/Icon/LockIcon.js +2 -24
- package/src/Icon/LockIcon.js.map +1 -1
- package/src/Icon/MessageIcon.js +2 -24
- package/src/Icon/MessageIcon.js.map +1 -1
- package/src/Icon/MinusIcon.js +2 -24
- package/src/Icon/MinusIcon.js.map +1 -1
- package/src/Icon/MoreIcon.js +2 -24
- package/src/Icon/MoreIcon.js.map +1 -1
- package/src/Icon/MuteIcon.js +2 -24
- package/src/Icon/MuteIcon.js.map +1 -1
- package/src/Icon/NotificationIcon.js +2 -24
- package/src/Icon/NotificationIcon.js.map +1 -1
- package/src/Icon/NotificationOffIcon.js +2 -24
- package/src/Icon/NotificationOffIcon.js.map +1 -1
- package/src/Icon/OptionsIcon.js +2 -24
- package/src/Icon/OptionsIcon.js.map +1 -1
- package/src/Icon/PeopleIcon.js +4 -26
- package/src/Icon/PeopleIcon.js.map +1 -1
- package/src/Icon/PingIcon.js +2 -24
- package/src/Icon/PingIcon.js.map +1 -1
- package/src/Icon/PlaneIcon.js +2 -24
- package/src/Icon/PlaneIcon.js.map +1 -1
- package/src/Icon/PlusIcon.js +2 -24
- package/src/Icon/PlusIcon.js.map +1 -1
- package/src/Icon/ProfileIcon.js +2 -24
- package/src/Icon/ProfileIcon.js.map +1 -1
- package/src/Icon/RecordBoldIcon.js +5 -5
- package/src/Icon/RecordBoldIcon.js.map +1 -1
- package/src/Icon/RecordIcon.js +2 -24
- package/src/Icon/RecordIcon.js.map +1 -1
- package/src/Icon/RecordPendingIcon.js +2 -24
- package/src/Icon/RecordPendingIcon.js.map +1 -1
- package/src/Icon/ReloadIcon.js +2 -24
- package/src/Icon/ReloadIcon.js.map +1 -1
- package/src/Icon/SVGIcon.js +6 -5
- package/src/Icon/SVGIcon.js.map +1 -1
- package/src/Icon/ScreenshareIcon.js +2 -24
- package/src/Icon/ScreenshareIcon.js.map +1 -1
- package/src/Icon/SearchIcon.js +2 -24
- package/src/Icon/SearchIcon.js.map +1 -1
- package/src/Icon/ServicesIcon.js +2 -24
- package/src/Icon/ServicesIcon.js.map +1 -1
- package/src/Icon/SettingsIcon.js +2 -24
- package/src/Icon/SettingsIcon.js.map +1 -1
- package/src/Icon/ShowIcon.js +2 -24
- package/src/Icon/ShowIcon.js.map +1 -1
- package/src/Icon/SignIcon.js +2 -24
- package/src/Icon/SignIcon.js.map +1 -1
- package/src/Icon/SpeakerIcon.js +2 -24
- package/src/Icon/SpeakerIcon.js.map +1 -1
- package/src/Icon/SupportIcon.js +2 -24
- package/src/Icon/SupportIcon.js.map +1 -1
- package/src/Icon/TeamIcon.js +2 -24
- package/src/Icon/TeamIcon.js.map +1 -1
- package/src/Icon/TimedIcon.js +2 -24
- package/src/Icon/TimedIcon.js.map +1 -1
- package/src/Icon/TrashCrossIcon.js +2 -24
- package/src/Icon/TrashCrossIcon.js.map +1 -1
- package/src/Icon/TrashIcon.js +2 -24
- package/src/Icon/TrashIcon.js.map +1 -1
- package/src/Icon/TriangleIcon.js +5 -5
- package/src/Icon/TriangleIcon.js.map +1 -1
- package/src/Icon/UploadIcon.js +2 -24
- package/src/Icon/UploadIcon.js.map +1 -1
- package/src/Icon/WireIcon.js +2 -24
- package/src/Icon/WireIcon.js.map +1 -1
- package/src/Identity/Animation.js +18 -17
- package/src/Identity/Animation.js.map +1 -1
- package/src/Identity/Avatar.js +10 -27
- package/src/Identity/Avatar.js.map +1 -1
- package/src/Identity/AvatarGrid.js +8 -7
- package/src/Identity/AvatarGrid.js.map +1 -1
- package/src/Identity/Logo.js +7 -7
- package/src/Identity/Logo.js.map +1 -1
- package/src/Identity/colors-v2.js +2 -3
- package/src/Identity/colors-v2.js.map +1 -1
- package/src/Identity/colors.js +11 -6
- package/src/Identity/colors.js.map +1 -1
- package/src/Identity/motions.js +6 -7
- package/src/Identity/motions.js.map +1 -1
- package/src/Layout/Box.js +3 -24
- package/src/Layout/Box.js.map +1 -1
- package/src/Layout/Column.js +6 -27
- package/src/Layout/Column.js.map +1 -1
- package/src/Layout/Container.js +10 -31
- package/src/Layout/Container.js.map +1 -1
- package/src/Layout/Content.js +3 -24
- package/src/Layout/Content.js.map +1 -1
- package/src/Layout/FlexBox.js +3 -24
- package/src/Layout/FlexBox.js.map +1 -1
- package/src/Layout/Footer.js +1 -1
- package/src/Layout/Footer.js.map +1 -1
- package/src/Layout/Header.js +3 -24
- package/src/Layout/Header.js.map +1 -1
- package/src/Layout/MatchMedia.js +17 -35
- package/src/Layout/MatchMedia.js.map +1 -1
- package/src/Layout/Spacer.js +1 -1
- package/src/Layout/Spacer.js.map +1 -1
- package/src/Layout/StyledApp.js +6 -5
- package/src/Layout/StyledApp.js.map +1 -1
- package/src/Layout/Theme.js +7 -7
- package/src/Layout/Theme.js.map +1 -1
- package/src/Layout/headerMenu/HeaderMenu.js +13 -8
- package/src/Layout/headerMenu/HeaderMenu.js.map +1 -1
- package/src/Layout/headerMenu/HeaderSubMenu.js +10 -9
- package/src/Layout/headerMenu/HeaderSubMenu.js.map +1 -1
- package/src/Layout/headerMenu/MenuContent.js +4 -5
- package/src/Layout/headerMenu/MenuContent.js.map +1 -1
- package/src/Layout/headerMenu/MenuItems.js +5 -26
- package/src/Layout/headerMenu/MenuItems.js.map +1 -1
- package/src/Layout/headerMenu/MenuLink.js +10 -10
- package/src/Layout/headerMenu/MenuLink.js.map +1 -1
- package/src/Layout/headerMenu/MenuOpenButton.js +6 -27
- package/src/Layout/headerMenu/MenuOpenButton.js.map +1 -1
- package/src/Layout/headerMenu/MenuScrollableItems.js +5 -26
- package/src/Layout/headerMenu/MenuScrollableItems.js.map +1 -1
- package/src/Layout/headerMenu/MenuSubLink.js +6 -7
- package/src/Layout/headerMenu/MenuSubLink.js.map +1 -1
- package/src/Menu/MenuModal.js +14 -13
- package/src/Menu/MenuModal.js.map +1 -1
- package/src/Menu/TabBar.js +13 -12
- package/src/Menu/TabBar.js.map +1 -1
- package/src/Misc/ButtonGroup.js +7 -7
- package/src/Misc/ButtonGroup.js.map +1 -1
- package/src/Misc/IconButton.js +7 -7
- package/src/Misc/IconButton.js.map +1 -1
- package/src/Misc/IsInViewport.js +13 -8
- package/src/Misc/IsInViewport.js.map +1 -1
- package/src/Misc/Loading.js +8 -7
- package/src/Misc/Loading.js.map +1 -1
- package/src/Misc/Pagination.js +6 -5
- package/src/Misc/Pagination.js.map +1 -1
- package/src/Misc/Pill.js +7 -7
- package/src/Misc/Pill.js.map +1 -1
- package/src/Misc/childrenWithDefaultProps.js +3 -3
- package/src/Misc/childrenWithDefaultProps.js.map +1 -1
- package/src/Misc/useTimeout.js +7 -22
- package/src/Misc/useTimeout.js.map +1 -1
- package/src/Modal/Modal.js +13 -12
- package/src/Modal/Modal.js.map +1 -1
- package/src/Modal/Overlay.js +11 -10
- package/src/Modal/Overlay.js.map +1 -1
- package/src/Text/Heading.js +16 -16
- package/src/Text/Heading.js.map +1 -1
- package/src/Text/Label.js +9 -9
- package/src/Text/Label.js.map +1 -1
- package/src/Text/Line.js +3 -24
- package/src/Text/Line.js.map +1 -1
- package/src/Text/Link.js +8 -8
- package/src/Text/Link.js.map +1 -1
- package/src/Text/Paragraph.js +10 -10
- package/src/Text/Paragraph.js.map +1 -1
- package/src/Text/Text.js +8 -29
- package/src/Text/Text.js.map +1 -1
- package/src/Text/TextLink.js +7 -7
- package/src/Text/TextLink.js.map +1 -1
- package/src/Text/Title.js +7 -7
- package/src/Text/Title.js.map +1 -1
- package/src/mediaQueries.js +11 -7
- package/src/mediaQueries.js.map +1 -1
- package/src/util.js +10 -6
- package/src/util.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropFileInput.js","names":["visuallyHiddenStyles","clip","clipPath","height","overflow","position","whiteSpace","width","dropFileWrapperStyle","maxWidth","dropFileZoneWrapperStyle","theme","isDraggedOver","padding","border","general","primaryColor","borderBottomWidth","borderRadius","textAlign","backgroundColor","COLOR","WHITE","fontWeight","fontSize","lineHeight","color","GRAY","dropFileZoneLabelStyle","cursor","outline","textDecoration","dropFileZoneHeadingStyle","display","dropFileZonDescriptionStyle","marginTop","DropFileInput","forwardRef","ref","onFilesUploaded","onInvalidFilesDropError","dropFileZoneWrapperCSS","labelText","headingText","description","accept","multiple","inputProps","useState","setIsDraggedOver","resetDraggedOver","handleDragOver","event","preventDefault","stopPropagation","dataTransfer","dropEffect","items","length","handleDrop","files","filesArr","Array","from","areFilesValid","every","file","split","map","v","trim","includes","type","handleChange","target"],"sources":["DropFileInput.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2022 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\nimport React, {useState, FC, forwardRef, DragEvent} from 'react';\n\nimport {COLOR} from '../Identity';\nimport {Theme} from '../Layout';\nimport {TextProps} from '../Text';\nimport {UploadIcon} from '../Icon';\nimport {FlexBox} from '../Layout';\n\nexport interface DropFileInputProps<T = HTMLInputElement> extends TextProps<T> {\n onFilesUploaded: (files: File[]) => void;\n onInvalidFilesDropError: () => void;\n labelText: string;\n headingText: string;\n description?: string;\n dropFileZoneWrapperCSS?: CSSObject;\n}\n\nconst visuallyHiddenStyles: CSSObject = {\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n overflow: 'hidden',\n position: 'absolute',\n whiteSpace: 'nowrap',\n width: '1px',\n};\n\nexport const dropFileWrapperStyle: CSSObject = {\n maxWidth: '330px',\n};\n\nexport const dropFileZoneWrapperStyle: <T>(theme: Theme, isDraggedOver: boolean) => CSSObject = (\n theme,\n isDraggedOver,\n) => ({\n width: '100%',\n padding: '28px 12px',\n border: `1px dashed ${theme.general.primaryColor}`,\n borderBottomWidth: '2px',\n borderRadius: '6px',\n textAlign: 'center',\n backgroundColor: isDraggedOver ? theme.general.backgroundColor : COLOR.WHITE,\n fontWeight: 400,\n fontSize: '12px',\n lineHeight: '13px',\n color: COLOR.GRAY,\n});\n\nexport const dropFileZoneLabelStyle: <T>(theme: Theme) => CSSObject = theme => ({\n color: theme.general.primaryColor,\n cursor: 'pointer',\n ':focus-within': {\n outline: `1px solid ${theme.general.primaryColor}`,\n },\n ':hover': {\n textDecoration: 'underline',\n },\n});\n\nexport const dropFileZoneHeadingStyle: CSSObject = {\n display: 'block',\n whiteSpace: 'pre-line',\n};\n\nexport const dropFileZonDescriptionStyle: CSSObject = {\n marginTop: '12px',\n fontWeight: 400,\n fontSize: '10px',\n lineHeight: '13px',\n color: COLOR.GRAY,\n whiteSpace: 'pre-line',\n};\n\nexport const DropFileInput: FC<DropFileInputProps<HTMLInputElement>> = forwardRef<\n HTMLInputElement,\n DropFileInputProps<HTMLInputElement>\n>(\n (\n {\n onFilesUploaded,\n onInvalidFilesDropError,\n dropFileZoneWrapperCSS,\n labelText,\n headingText,\n description,\n accept,\n multiple,\n ...inputProps\n },\n ref,\n ) => {\n const [isDraggedOver, setIsDraggedOver] = useState(false);\n\n const resetDraggedOver = () => setIsDraggedOver(false);\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n event.dataTransfer.dropEffect = 'copy';\n\n if (event.dataTransfer.items.length > 0) {\n setIsDraggedOver(true);\n }\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n resetDraggedOver();\n\n const {files} = event.dataTransfer;\n if (files.length < 1) {\n return;\n }\n\n const filesArr = multiple ? Array.from(files) : [files[0]];\n\n const areFilesValid = !!accept\n ? filesArr.every(file =>\n accept\n .split(',')\n .map(v => v.trim())\n .includes(file.type),\n )\n : true;\n\n if (!areFilesValid) {\n onInvalidFilesDropError();\n return;\n }\n\n onFilesUploaded(filesArr);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const {files} = event.target;\n\n if (files.length < 1) {\n return;\n }\n\n onFilesUploaded(Array.from(files));\n };\n\n return (\n <div css={dropFileWrapperStyle}>\n <div\n css={(theme: Theme) => ({\n ...dropFileZoneWrapperStyle(theme, isDraggedOver),\n ...dropFileZoneWrapperCSS,\n })}\n data-testid=\"dropzone\"\n onDragOver={handleDragOver}\n onDragLeave={resetDraggedOver}\n onDrop={handleDrop}\n >\n <FlexBox align=\"center\" justify=\"center\" flexWrap=\"wrap\" css={{maxWidth: '280px', margin: '0 auto'}}>\n <UploadIcon css={{margin: '12px 0'}} />\n <div css={{maxWidth: '160px', margin: '0 25px'}}>\n <span css={dropFileZoneHeadingStyle}>{headingText}</span>\n <label\n aria-label={`${headingText} ${labelText} (${description})`}\n css={(theme: Theme) => dropFileZoneLabelStyle(theme)}\n >\n <span>{labelText}</span>\n <input\n data-testid=\"file-input\"\n ref={ref}\n accept={accept}\n multiple={multiple}\n css={visuallyHiddenStyles}\n onChange={handleChange}\n type=\"file\"\n {...inputProps}\n />\n </label>\n </div>\n </FlexBox>\n </div>\n {description && <p css={dropFileZonDescriptionStyle}>{description}</p>}\n </div>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;AAoBA;AACA;AAEA;AAGA;AACA;AAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAWlC,IAAMA,oBAA+B,GAAG;EACtCC,IAAI,EAAE,eAAe;EACrBC,QAAQ,EAAE,YAAY;EACtBC,MAAM,EAAE,KAAK;EACbC,QAAQ,EAAE,QAAQ;EAClBC,QAAQ,EAAE,UAAU;EACpBC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;IACE,wBAAeA,WAAW,cAAID,SAAS,eAAKE,WAAW,MAAI;IAC3D,GAAG,EAAE,aAACjC,KAAY;MAAA,OAAKiB,sBAAsB,CAACjB,KAAK,CAAC;IAAA;EAAC,GAErD,8BAAO+B,SAAS,CAAQ,EACxB;IACE,eAAY,YAAY;IACxB,GAAG,EAAEJ,GAAI;IACT,MAAM,EAAEO,MAAO;IACf,QAAQ,EAAEC,QAAS;IACnB,GAAG,EAAE9C,oBAAqB;IAC1B,QAAQ,EAAEyE,YAAa;IACvB,IAAI,EAAC;EAAM,GACP1B,UAAU,EACd,CACI,CACJ,CACE,CACN,EACLH,WAAW,IAAI;IAAG,GAAG,EAAEV;EAA4B,GAAEU,WAAW,CAAK,CAClE;AAEV,CAAC,CACF;AAAC"}
|
|
1
|
+
{"version":3,"file":"DropFileInput.js","names":["visuallyHiddenStyles","clip","clipPath","height","overflow","position","whiteSpace","width","dropFileWrapperStyle","maxWidth","dropFileZoneWrapperStyle","theme","isDraggedOver","padding","border","general","primaryColor","borderBottomWidth","borderRadius","textAlign","backgroundColor","COLOR","WHITE","fontWeight","fontSize","lineHeight","color","GRAY","dropFileZoneLabelStyle","cursor","outline","textDecoration","dropFileZoneHeadingStyle","display","dropFileZonDescriptionStyle","marginTop","DropFileInput","forwardRef","ref","onFilesUploaded","onInvalidFilesDropError","dropFileZoneWrapperCSS","labelText","headingText","description","accept","multiple","inputProps","useState","setIsDraggedOver","resetDraggedOver","handleDragOver","event","preventDefault","stopPropagation","dataTransfer","dropEffect","items","length","handleDrop","files","filesArr","Array","from","areFilesValid","every","file","split","map","v","trim","includes","type","handleChange","target"],"sources":["DropFileInput.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2022 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\nimport React, {useState, FC, forwardRef, DragEvent} from 'react';\n\nimport {COLOR} from '../Identity';\nimport {Theme} from '../Layout';\nimport {TextProps} from '../Text';\nimport {UploadIcon} from '../Icon';\nimport {FlexBox} from '../Layout';\n\nexport interface DropFileInputProps<T = HTMLInputElement> extends TextProps<T> {\n onFilesUploaded: (files: File[]) => void;\n onInvalidFilesDropError: () => void;\n labelText: string;\n headingText: string;\n description?: string;\n dropFileZoneWrapperCSS?: CSSObject;\n}\n\nconst visuallyHiddenStyles: CSSObject = {\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n overflow: 'hidden',\n position: 'absolute',\n whiteSpace: 'nowrap',\n width: '1px',\n};\n\nexport const dropFileWrapperStyle: CSSObject = {\n maxWidth: '330px',\n};\n\nexport const dropFileZoneWrapperStyle: <T>(theme: Theme, isDraggedOver: boolean) => CSSObject = (\n theme,\n isDraggedOver,\n) => ({\n width: '100%',\n padding: '28px 12px',\n border: `1px dashed ${theme.general.primaryColor}`,\n borderBottomWidth: '2px',\n borderRadius: '6px',\n textAlign: 'center',\n backgroundColor: isDraggedOver ? theme.general.backgroundColor : COLOR.WHITE,\n fontWeight: 400,\n fontSize: '12px',\n lineHeight: '13px',\n color: COLOR.GRAY,\n});\n\nexport const dropFileZoneLabelStyle: <T>(theme: Theme) => CSSObject = theme => ({\n color: theme.general.primaryColor,\n cursor: 'pointer',\n ':focus-within': {\n outline: `1px solid ${theme.general.primaryColor}`,\n },\n ':hover': {\n textDecoration: 'underline',\n },\n});\n\nexport const dropFileZoneHeadingStyle: CSSObject = {\n display: 'block',\n whiteSpace: 'pre-line',\n};\n\nexport const dropFileZonDescriptionStyle: CSSObject = {\n marginTop: '12px',\n fontWeight: 400,\n fontSize: '10px',\n lineHeight: '13px',\n color: COLOR.GRAY,\n whiteSpace: 'pre-line',\n};\n\nexport const DropFileInput: FC<DropFileInputProps<HTMLInputElement>> = forwardRef<\n HTMLInputElement,\n DropFileInputProps<HTMLInputElement>\n>(\n (\n {\n onFilesUploaded,\n onInvalidFilesDropError,\n dropFileZoneWrapperCSS,\n labelText,\n headingText,\n description,\n accept,\n multiple,\n ...inputProps\n },\n ref,\n ) => {\n const [isDraggedOver, setIsDraggedOver] = useState(false);\n\n const resetDraggedOver = () => setIsDraggedOver(false);\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n event.dataTransfer.dropEffect = 'copy';\n\n if (event.dataTransfer.items.length > 0) {\n setIsDraggedOver(true);\n }\n };\n\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n resetDraggedOver();\n\n const {files} = event.dataTransfer;\n if (files.length < 1) {\n return;\n }\n\n const filesArr = multiple ? Array.from(files) : [files[0]];\n\n const areFilesValid = !!accept\n ? filesArr.every(file =>\n accept\n .split(',')\n .map(v => v.trim())\n .includes(file.type),\n )\n : true;\n\n if (!areFilesValid) {\n onInvalidFilesDropError();\n return;\n }\n\n onFilesUploaded(filesArr);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const {files} = event.target;\n\n if (files.length < 1) {\n return;\n }\n\n onFilesUploaded(Array.from(files));\n };\n\n return (\n <div css={dropFileWrapperStyle}>\n <div\n css={(theme: Theme) => ({\n ...dropFileZoneWrapperStyle(theme, isDraggedOver),\n ...dropFileZoneWrapperCSS,\n })}\n data-testid=\"dropzone\"\n onDragOver={handleDragOver}\n onDragLeave={resetDraggedOver}\n onDrop={handleDrop}\n >\n <FlexBox align=\"center\" justify=\"center\" flexWrap=\"wrap\" css={{maxWidth: '280px', margin: '0 auto'}}>\n <UploadIcon css={{margin: '12px 0'}} />\n <div css={{maxWidth: '160px', margin: '0 25px'}}>\n <span css={dropFileZoneHeadingStyle}>{headingText}</span>\n <label\n aria-label={`${headingText} ${labelText} (${description})`}\n css={(theme: Theme) => dropFileZoneLabelStyle(theme)}\n >\n <span>{labelText}</span>\n <input\n data-testid=\"file-input\"\n ref={ref}\n accept={accept}\n multiple={multiple}\n css={visuallyHiddenStyles}\n onChange={handleChange}\n type=\"file\"\n {...inputProps}\n />\n </label>\n </div>\n </FlexBox>\n </div>\n {description && <p css={dropFileZonDescriptionStyle}>{description}</p>}\n </div>\n );\n },\n);\n"],"mappings":";;;;;;;AAoBA;AACA;AAEA;AAGA;AACA;AAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWlC,IAAMA,oBAA+B,GAAG;EACtCC,IAAI,EAAE,eAAe;EACrBC,QAAQ,EAAE,YAAY;EACtBC,MAAM,EAAE,KAAK;EACbC,QAAQ,EAAE,QAAQ;EAClBC,QAAQ,EAAE,UAAU;EACpBC,UAAU,EAAE,QAAQ;EACpBC,KAAK,EAAE;AACT,CAAC;AAEM,IAAMC,oBAA+B,GAAG;EAC7CC,QAAQ,EAAE;AACZ,CAAC;AAAC;AAEK,IAAMC,wBAAgF,GAAG,SAAnFA,wBAAgF,CAC3FC,KAAK,EACLC,aAAa;EAAA,OACT;IACJL,KAAK,EAAE,MAAM;IACbM,OAAO,EAAE,WAAW;IACpBC,MAAM,uBAAgBH,KAAK,CAACI,OAAO,CAACC,YAAY,CAAE;IAClDC,iBAAiB,EAAE,KAAK;IACxBC,YAAY,EAAE,KAAK;IACnBC,SAAS,EAAE,QAAQ;IACnBC,eAAe,EAAER,aAAa,GAAGD,KAAK,CAACI,OAAO,CAACK,eAAe,GAAGC,eAAK,CAACC,KAAK;IAC5EC,UAAU,EAAE,GAAG;IACfC,QAAQ,EAAE,MAAM;IAChBC,UAAU,EAAE,MAAM;IAClBC,KAAK,EAA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
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.filterErrorMessageProps = exports.errorMessageStyle = exports.ErrorMessage = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
7
|
var _react = require("@emotion/react");
|
|
12
8
|
var _Identity = require("../Identity");
|
|
13
9
|
var _Layout = require("../Layout");
|
|
@@ -15,15 +11,19 @@ var _Text = require("../Text");
|
|
|
15
11
|
var _util = require("../util");
|
|
16
12
|
var _excluded = ["justify", "align"],
|
|
17
13
|
_excluded2 = ["children"];
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
15
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
19
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
21
|
var errorMessageStyle = function errorMessageStyle(theme, _ref) {
|
|
22
22
|
var _ref$justify = _ref.justify,
|
|
23
23
|
justify = _ref$justify === void 0 ? 'flex-start' : _ref$justify,
|
|
24
24
|
_ref$align = _ref.align,
|
|
25
25
|
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
26
|
-
props = (
|
|
26
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
27
|
return _objectSpread(_objectSpread({}, (0, _Layout.flexBoxStyle)(_objectSpread({
|
|
28
28
|
align: align,
|
|
29
29
|
justify: justify
|
|
@@ -52,8 +52,8 @@ var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
|
52
52
|
};
|
|
53
53
|
var ErrorMessage = function ErrorMessage(_ref2) {
|
|
54
54
|
var children = _ref2.children,
|
|
55
|
-
props = (
|
|
56
|
-
return (0, _react.jsx)(_Layout.FlexBox, (
|
|
55
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
56
|
+
return (0, _react.jsx)(_Layout.FlexBox, _extends({
|
|
57
57
|
css: function css(theme) {
|
|
58
58
|
return errorMessageStyle(theme, props);
|
|
59
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorMessage.js","names":["errorMessageStyle","theme","justify","align","props","flexBoxStyle","a","linkStyle","bold","fontSize","textTransform","marginBottom","filterErrorMessageProps","filterProps","filterFlexBoxProps","ErrorMessage","children","COLOR_V2","RED_LIGHT_500"],"sources":["ErrorMessage.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\n\nimport {COLOR_V2} from '../Identity';\nimport {FlexBox, FlexBoxProps, flexBoxStyle, filterFlexBoxProps, Theme} from '../Layout';\nimport {Text, linkStyle} from '../Text';\nimport {filterProps} from '../util';\n\ntype ErrorMessageProps<T = HTMLDivElement> = FlexBoxProps<T>;\n\nexport const errorMessageStyle: <T>(theme: Theme, props: ErrorMessageProps<T>) => CSSObject = (\n theme,\n {justify = 'flex-start', align = 'center', ...props},\n) => ({\n ...flexBoxStyle({align, justify, ...props}),\n a: {\n ...linkStyle(theme, {bold: false, fontSize: '12px', textTransform: 'none', ...props}),\n },\n marginBottom: '12px',\n});\n\nexport const filterErrorMessageProps = (props: ErrorMessageProps) => {\n return filterProps(filterFlexBoxProps(props) as ErrorMessageProps, []);\n};\n\nexport const ErrorMessage = ({children, ...props}: ErrorMessageProps) => (\n <FlexBox css={(theme: Theme) => errorMessageStyle(theme, props)} {...props}>\n <Text color={COLOR_V2.RED_LIGHT_500} fontSize={'12px'} css={{fontWeight: 400}}>\n {children}\n </Text>\n </FlexBox>\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorMessage.js","names":["errorMessageStyle","theme","justify","align","props","flexBoxStyle","a","linkStyle","bold","fontSize","textTransform","marginBottom","filterErrorMessageProps","filterProps","filterFlexBoxProps","ErrorMessage","children","COLOR_V2","RED_LIGHT_500"],"sources":["ErrorMessage.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\n\nimport {COLOR_V2} from '../Identity';\nimport {FlexBox, FlexBoxProps, flexBoxStyle, filterFlexBoxProps, Theme} from '../Layout';\nimport {Text, linkStyle} from '../Text';\nimport {filterProps} from '../util';\n\ntype ErrorMessageProps<T = HTMLDivElement> = FlexBoxProps<T>;\n\nexport const errorMessageStyle: <T>(theme: Theme, props: ErrorMessageProps<T>) => CSSObject = (\n theme,\n {justify = 'flex-start', align = 'center', ...props},\n) => ({\n ...flexBoxStyle({align, justify, ...props}),\n a: {\n ...linkStyle(theme, {bold: false, fontSize: '12px', textTransform: 'none', ...props}),\n },\n marginBottom: '12px',\n});\n\nexport const filterErrorMessageProps = (props: ErrorMessageProps) => {\n return filterProps(filterFlexBoxProps(props) as ErrorMessageProps, []);\n};\n\nexport const ErrorMessage = ({children, ...props}: ErrorMessageProps) => (\n <FlexBox css={(theme: Theme) => errorMessageStyle(theme, props)} {...props}>\n <Text color={COLOR_V2.RED_LIGHT_500} fontSize={'12px'} css={{fontWeight: 400}}>\n {children}\n </Text>\n </FlexBox>\n);\n"],"mappings":";;;;;;AAoBA;AAEA;AACA;AACA;AACA;AAAoC;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAI7B,IAAMA,iBAA8E,GAAG,SAAjFA,iBAA8E,CACzFC,KAAK;EAAA,wBACJC,OAAO;IAAPA,OAAO,6BAAG,YAAY;IAAA,kBAAEC,KAAK;IAALA,KAAK,2BAAG,QAAQ;IAAKC,KAAK;EAAA,uCAEhD,IAAAC,oBAAY;IAAEF,KAAK,EAALA,KAAK;IAAED,OAAO,EAAPA;EAAO,GAAKE,KAAK,EAAE;IAC3CE,CAAC,oBACI,IAAAC,eAAS,EAACN,KAAK;MAAGO,IAAI,EAAE,KAAK;MAAEC,QAAQ,EAAE,MAAM;MAAEC,aAAa,EAAE;IAAM,GAAKN,KAAK,EAAE,CACtF;IACDO,YAAY,EAAE;EAAM;AAAA,CACpB;AAAC;AAEI,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuB,CAAIR,KAAwB,EAAK;EACnE,OAAO,IAAAS,iBAAW,EAAC,IAAAC,0BAAkB,EAACV,KAAK,CAAC,EAAuB,EAAE,CAAC;AACxE,CAAC;AAAC;AAAA;EAAA;EAAA;AAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAEK,IAAMW,YAAY,GAAG,SAAfA,YAAY;EAAA,IAAKC,QAAQ,SAARA,QAAQ;IAAKZ,KAAK;EAAA,OAC9C,gBAAC,eAAO;IAAC,GAAG,EAAE,aAACH,KAAY;MAAA,OAAKD,iBAAiB,CAACC,KAAK,EAAEG,KAAK,CAAC;IAAA;EAAC,GAAKA,KAAK,GACxE,gBAAC,UAAI;IAAC,KAAK,EAAEa,kBAAQ,CAACC,aAAc;IAAC,QAAQ,EAAE,MAAO;IAAC,GAAG;EAAoB,GAC3EF,QAAQ,CACJ,CACC;AAAA,CACX;AAAC"}
|
package/src/Form/Form.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.Form = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
7
|
var _react = require("@emotion/react");
|
|
10
8
|
var _react2 = _interopRequireDefault(require("react"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
11
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
12
12
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
13
|
name: "y2mk5a",
|
|
@@ -19,7 +19,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
19
19
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
20
20
|
};
|
|
21
21
|
var Form = function Form(props) {
|
|
22
|
-
return (0, _react.jsx)("form", (
|
|
22
|
+
return (0, _react.jsx)("form", _extends({
|
|
23
23
|
css: _ref
|
|
24
24
|
}, props));
|
|
25
25
|
};
|
package/src/Form/Form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","names":["Form","props"],"sources":["Form.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {jsx} from '@emotion/react';\nimport React from 'react';\n\nexport const Form = (props: React.HTMLProps<HTMLFormElement>) => (\n <form\n css={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n marginBottom: 0,\n width: '100%',\n }}\n {...props}\n />\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Form.js","names":["Form","props"],"sources":["Form.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {jsx} from '@emotion/react';\nimport React from 'react';\n\nexport const Form = (props: React.HTMLProps<HTMLFormElement>) => (\n <form\n css={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n marginBottom: 0,\n width: '100%',\n }}\n {...props}\n />\n);\n"],"mappings":";;;;;;AAoBA;AACA;AAA0B;AAAA;AAAA;AAAA;EAAA;EAAA;AAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAEnB,IAAMA,IAAI,GAAG,SAAPA,IAAI,CAAIC,KAAuC;EAAA,OAC1D;IACE,GAAG;EAMD,GACEA,KAAK,EACT;AAAA,CACH;AAAC"}
|
package/src/Form/Input.js
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.inputStyle = exports.Input = exports.INPUT_GROUP = exports.INPUT_CLASSNAME = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
8
|
var _react = require("@emotion/react");
|
|
11
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
9
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
15
10
|
var _util = require("../util");
|
|
16
11
|
var _Icon = require("../Icon");
|
|
17
12
|
var _InputLabel = _interopRequireDefault(require("./InputLabel"));
|
|
18
13
|
var _excluded = ["type", "label", "error", "helperText", "wrapperCSS", "className"];
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
22
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (
|
|
27
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
28
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
29
|
var inputStyle = function inputStyle(theme, _ref) {
|
|
24
30
|
var _ref$markInvalid = _ref.markInvalid,
|
|
25
31
|
markInvalid = _ref$markInvalid === void 0 ? false : _ref$markInvalid,
|
|
@@ -84,9 +90,9 @@ var Input = /*#__PURE__*/_react2["default"].forwardRef(function (_ref2, ref) {
|
|
|
84
90
|
wrapperCSS = _ref2$wrapperCSS === void 0 ? {} : _ref2$wrapperCSS,
|
|
85
91
|
_ref2$className = _ref2.className,
|
|
86
92
|
className = _ref2$className === void 0 ? '' : _ref2$className,
|
|
87
|
-
props = (
|
|
93
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
88
94
|
var _useState = (0, _react2.useState)(false),
|
|
89
|
-
_useState2 = (
|
|
95
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
90
96
|
togglePassword = _useState2[0],
|
|
91
97
|
setTogglePassword = _useState2[1];
|
|
92
98
|
var hasError = !!error;
|
|
@@ -118,7 +124,7 @@ var Input = /*#__PURE__*/_react2["default"].forwardRef(function (_ref2, ref) {
|
|
|
118
124
|
marginBottom: hasError && '8px',
|
|
119
125
|
position: 'relative'
|
|
120
126
|
}, process.env.NODE_ENV === "production" ? "" : ";label:Input;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,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ICAgICAgICB9LFxuICAgICAgICAuLi53cmFwcGVyQ1NTLFxuICAgICAgfSl9XG4gICAgPlxuICAgICAge2xhYmVsICYmIChcbiAgICAgICAgPElucHV0TGFiZWwgaHRtbEZvcj17cHJvcHMuaWR9IGlzUmVxdWlyZWQ9e3Byb3BzLnJlcXVpcmVkfSBtYXJrSW52YWxpZD17cHJvcHMubWFya0ludmFsaWR9PlxuICAgICAgICAgIHtsYWJlbH1cbiAgICAgICAgPC9JbnB1dExhYmVsPlxuICAgICAgKX1cblxuICAgICAgPGRpdiBjc3M9e3ttYXJnaW5Cb3R0b206IGhhc0Vycm9yICYmICc4cHgnLCBwb3NpdGlvbjogJ3JlbGF0aXZlJ319PlxuICAgICAgICA8aW5wdXRcbiAgICAgICAgICBjbGFzc05hbWU9e0lOUFVUX0NMQVNTTkFNRX1cbiAgICAgICAgICBjc3M9eyh0aGVtZTogVGhlbWUpID0+IGlucHV0U3R5bGUodGhlbWUsIHByb3BzLCBoYXNFcnJvcil9XG4gICAgICAgICAgcmVmPXtyZWZ9XG4gICAgICAgICAgdHlwZT17aXNQYXNzd29yZElucHV0ID8gdG9nZ2xlZFBhc3N3b3JkVHlwZSA6IHR5cGV9XG4gICAgICAgICAgYXJpYS1yZXF1aXJlZD17cHJvcHMucmVxdWlyZWR9XG4gICAgICAgICAgey4uLmZpbHRlcklucHV0UHJvcHMocHJvcHMpfVxuICAgICAgICAvPlxuXG4gICAgICAgIHtoYXNFcnJvciAmJiAhaXNQYXNzd29yZElucHV0ICYmIChcbiAgICAgICAgICA8RXJyb3JJY29uIGNzcz17Y2VudGVySW5wdXRBY3Rpb259IHdpZHRoPXsxNn0gaGVpZ2h0PXsxNn0gYXJpYS1oaWRkZW49XCJ0cnVlXCIgLz5cbiAgICAgICAgKX1cblxuICAgICAgICB7aXNQYXNzd29yZElucHV0ICYmIChcbiAgICAgICAgICA8YnV0dG9uXG4gICAgICAgICAgICB0eXBlPVwiYnV0dG9uXCJcbiAgICAgICAgICAgIGRhdGEtdWllLW5hbWU9eyF0b2dnbGVQYXNzd29yZCA/ICdkby1zaG93LXBhc3N3b3JkJyA6ICdkby1oaWRlLXBhc3N3b3JkJ31cbiAgICAgICAgICAgIGNzcz17ey4uLmNlbnRlcklucHV0QWN0aW9uLCBiYWNrZ3JvdW5kOiAndHJhbnNwYXJlbnQnLCBib3JkZXI6ICdub25lJywgY3Vyc29yOiAncG9pbnRlcicsIHBhZGRpbmc6IDB9fVxuICAgICAgICAgICAgb25DbGljaz17dG9nZ2xlU2V0UGFzc3dvcmR9XG4gICAgICAgICAgICB0aXRsZT1cIlRvZ2dsZSBwYXNzd29yZCB2aXNpYmlsaXR5XCJcbiAgICAgICAgICAgIGFyaWEtY29udHJvbHM9e3Byb3BzLmlkfVxuICAgICAgICAgICAgYXJpYS1leHBhbmRlZD17dG9nZ2xlUGFzc3dvcmR9XG4gICAgICAgICAgPlxuICAgICAgICAgICAge3RvZ2dsZVBhc3N3b3JkID8gPEhpZGVJY29uIC8+IDogPFNob3dJY29uIC8+fVxuICAgICAgICAgIDwvYnV0dG9uPlxuICAgICAgICApfVxuICAgICAgPC9kaXY+XG5cbiAgICAgIHshaGFzRXJyb3IgJiYgaGVscGVyVGV4dCAmJiAoXG4gICAgICAgIDxwXG4gICAgICAgICAgY3NzPXsodGhlbWU6IFRoZW1lKSA9PiAoe1xuICAgICAgICAgICAgZm9udFNpemU6ICcxMnB4JyxcbiAgICAgICAgICAgIGZvbnRXZWlnaHQ6IDQwMCxcbiAgICAgICAgICAgIGNvbG9yOiB0aGVtZS5JbnB1dC5wbGFjZWhvbGRlckNvbG9yLFxuICAgICAgICAgICAgbWFyZ2luVG9wOiA4LFxuICAgICAgICAgIH0pfVxuICAgICAgICA+XG4gICAgICAgICAge2hlbHBlclRleHR9XG4gICAgICAgIDwvcD5cbiAgICAgICl9XG5cbiAgICAgIHtlcnJvcn1cbiAgICA8L2Rpdj5cbiAgKTtcbn0pO1xuIl19 */")
|
|
121
|
-
}, (0, _react.jsx)("input", (
|
|
127
|
+
}, (0, _react.jsx)("input", _extends({
|
|
122
128
|
className: INPUT_CLASSNAME,
|
|
123
129
|
css: function css(theme) {
|
|
124
130
|
return inputStyle(theme, props, hasError);
|
package/src/Form/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["inputStyle","theme","markInvalid","placeholderTextTransform","disabled","placeholderStyle","color","Input","placeholderColor","fontSize","textTransform","opacity","boxShadow","borderHover","general","primaryColor","Select","borderColor","background","backgroundColorDisabled","backgroundColor","border","borderRadius","dangerColor","caretColor","fontWeight","height","lineHeight","outline","padding","width","INPUT_CLASSNAME","INPUT_GROUP","filterInputProps","props","filterProps","centerInputAction","position","right","top","transform","React","forwardRef","ref","type","label","error","helperText","wrapperCSS","className","useState","togglePassword","setTogglePassword","hasError","isPasswordInput","toggledPasswordType","toggleSetPassword","prevState","useTheme","marginBottom","id","required","cursor","marginTop"],"sources":["Input.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx, useTheme} from '@emotion/react';\nimport {Property} from 'csstype';\nimport React, {ReactElement, useState} from 'react';\n\nimport {Theme} from '../Layout';\nimport {TextProps} from '../Text';\nimport {filterProps} from '../util';\nimport {ErrorIcon, HideIcon, ShowIcon} from '../Icon';\nimport InputLabel from './InputLabel';\n\nexport interface InputProps<T = HTMLInputElement> extends TextProps<T> {\n label?: string;\n error?: ReactElement;\n markInvalid?: boolean;\n helperText?: string;\n placeholderTextTransform?: Property.TextTransform;\n wrapperCSS?: CSSObject;\n}\n\nexport const inputStyle: <T>(theme: Theme, props: InputProps<T>, hasError?: boolean) => CSSObject = (\n theme,\n {markInvalid = false, placeholderTextTransform = 'none', disabled = false},\n) => {\n const placeholderStyle = {\n color: theme.Input.placeholderColor,\n fontSize: '16px',\n textTransform: placeholderTextTransform,\n };\n\n return {\n '&::-moz-placeholder': {\n ...placeholderStyle,\n opacity: 1,\n },\n '&::-ms-input-placeholder': {\n ...placeholderStyle,\n },\n '&::-webkit-input-placeholder': {\n ...placeholderStyle,\n },\n '&:hover': {\n boxShadow: !disabled && `0 0 0 1px ${theme.Input.borderHover}`,\n },\n '&:focus-visible, &:focus, &:active': {\n boxShadow: `0 0 0 1px ${theme.general.primaryColor}`,\n },\n '&:invalid:not(:focus, :hover)': !markInvalid\n ? {\n boxShadow: `0 0 0 1px ${theme.Select.borderColor}`,\n }\n : {},\n background: disabled ? theme.Input.backgroundColorDisabled : theme.Input.backgroundColor,\n border: 'none',\n borderRadius: '12px',\n boxShadow: markInvalid ? `0 0 0 1px ${theme.general.dangerColor}` : `0 0 0 1px ${theme.Select.borderColor}`,\n caretColor: theme.general.primaryColor,\n color: theme.general.color,\n fontWeight: 300,\n height: '48px',\n lineHeight: '24px',\n outline: 'none',\n padding: '0 16px',\n width: '100%',\n };\n};\n\nexport const INPUT_CLASSNAME = 'wireinput';\nexport const INPUT_GROUP = 'input-group';\n\nconst filterInputProps = (props: InputProps) => filterProps(props, ['markInvalid', 'placeholderTextTransform']);\n\nconst centerInputAction: CSSObject = {\n position: 'absolute',\n right: '16px',\n top: '50%',\n transform: 'translateY(-50%)',\n};\n\nexport const Input: React.FC<InputProps<HTMLInputElement>> = React.forwardRef<\n HTMLInputElement,\n InputProps<HTMLInputElement>\n>(({type, label, error, helperText, wrapperCSS = {}, className = '', ...props}, ref) => {\n const [togglePassword, setTogglePassword] = useState<boolean>(false);\n\n const hasError = !!error;\n const isPasswordInput = type === 'password';\n const toggledPasswordType = togglePassword ? 'text' : 'password';\n\n const toggleSetPassword = () => setTogglePassword(prevState => !prevState);\n\n const theme = useTheme();\n\n return (\n <div\n className={INPUT_GROUP}\n css={(theme: Theme) => ({\n marginBottom: hasError ? '2px' : '20px',\n width: '100%',\n '&:focus-within label': {\n color: theme.general.primaryColor,\n },\n ...wrapperCSS,\n })}\n >\n {label && (\n <InputLabel htmlFor={props.id} isRequired={props.required} markInvalid={props.markInvalid}>\n {label}\n </InputLabel>\n )}\n\n <div css={{marginBottom: hasError && '8px', position: 'relative'}}>\n <input\n className={INPUT_CLASSNAME}\n css={(theme: Theme) => inputStyle(theme, props, hasError)}\n ref={ref}\n type={isPasswordInput ? toggledPasswordType : type}\n aria-required={props.required}\n {...filterInputProps(props)}\n />\n\n {hasError && !isPasswordInput && (\n <ErrorIcon css={centerInputAction} width={16} height={16} aria-hidden=\"true\" />\n )}\n\n {isPasswordInput && (\n <button\n type=\"button\"\n data-uie-name={!togglePassword ? 'do-show-password' : 'do-hide-password'}\n css={{...centerInputAction, background: 'transparent', border: 'none', cursor: 'pointer', padding: 0}}\n onClick={toggleSetPassword}\n title=\"Toggle password visibility\"\n aria-controls={props.id}\n aria-expanded={togglePassword}\n >\n {togglePassword ? <HideIcon /> : <ShowIcon />}\n </button>\n )}\n </div>\n\n {!hasError && helperText && (\n <p\n css={(theme: Theme) => ({\n fontSize: '12px',\n fontWeight: 400,\n color: theme.Input.placeholderColor,\n marginTop: 8,\n })}\n >\n {helperText}\n </p>\n )}\n\n {error}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;AAoBA;AAAwD;AAAA;AAAA;AAExD;AAIA;AACA;AACA;AAAsC;AAAA;AAAA;AAAA;AAAA;AAW/B,IAAMA,UAAoF,GAAG,SAAvFA,UAAoF,CAC/FC,KAAK,QAEF;EAAA,4BADFC,WAAW;IAAXA,WAAW,iCAAG,KAAK;IAAA,6BAAEC,wBAAwB;IAAxBA,wBAAwB,sCAAG,MA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UAAU,IACtB;IACE,GAAG,EAAE,aAAC9C,KAAY;MAAA,OAAM;QACtBQ,QAAQ,EAAE,MAAM;QAChBgB,UAAU,EAAE,GAAG;QACfnB,KAAK,EAAEL,KAAK,CAACM,KAAK,CAACC,gBAAgB;QACnCuD,SAAS,EAAE;MACb,CAAC;IAAA;EAAE,GAEFhB,UAAU,CAEd,EAEAD,KAAK,CACF;AAEV,CAAC,CAAC;AAAC"}
|
|
1
|
+
{"version":3,"file":"Input.js","names":["inputStyle","theme","markInvalid","placeholderTextTransform","disabled","placeholderStyle","color","Input","placeholderColor","fontSize","textTransform","opacity","boxShadow","borderHover","general","primaryColor","Select","borderColor","background","backgroundColorDisabled","backgroundColor","border","borderRadius","dangerColor","caretColor","fontWeight","height","lineHeight","outline","padding","width","INPUT_CLASSNAME","INPUT_GROUP","filterInputProps","props","filterProps","centerInputAction","position","right","top","transform","React","forwardRef","ref","type","label","error","helperText","wrapperCSS","className","useState","togglePassword","setTogglePassword","hasError","isPasswordInput","toggledPasswordType","toggleSetPassword","prevState","useTheme","marginBottom","id","required","cursor","marginTop"],"sources":["Input.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx, useTheme} from '@emotion/react';\nimport {Property} from 'csstype';\nimport React, {ReactElement, useState} from 'react';\n\nimport {Theme} from '../Layout';\nimport {TextProps} from '../Text';\nimport {filterProps} from '../util';\nimport {ErrorIcon, HideIcon, ShowIcon} from '../Icon';\nimport InputLabel from './InputLabel';\n\nexport interface InputProps<T = HTMLInputElement> extends TextProps<T> {\n label?: string;\n error?: ReactElement;\n markInvalid?: boolean;\n helperText?: string;\n placeholderTextTransform?: Property.TextTransform;\n wrapperCSS?: CSSObject;\n}\n\nexport const inputStyle: <T>(theme: Theme, props: InputProps<T>, hasError?: boolean) => CSSObject = (\n theme,\n {markInvalid = false, placeholderTextTransform = 'none', disabled = false},\n) => {\n const placeholderStyle = {\n color: theme.Input.placeholderColor,\n fontSize: '16px',\n textTransform: placeholderTextTransform,\n };\n\n return {\n '&::-moz-placeholder': {\n ...placeholderStyle,\n opacity: 1,\n },\n '&::-ms-input-placeholder': {\n ...placeholderStyle,\n },\n '&::-webkit-input-placeholder': {\n ...placeholderStyle,\n },\n '&:hover': {\n boxShadow: !disabled && `0 0 0 1px ${theme.Input.borderHover}`,\n },\n '&:focus-visible, &:focus, &:active': {\n boxShadow: `0 0 0 1px ${theme.general.primaryColor}`,\n },\n '&:invalid:not(:focus, :hover)': !markInvalid\n ? {\n boxShadow: `0 0 0 1px ${theme.Select.borderColor}`,\n }\n : {},\n background: disabled ? theme.Input.backgroundColorDisabled : theme.Input.backgroundColor,\n border: 'none',\n borderRadius: '12px',\n boxShadow: markInvalid ? `0 0 0 1px ${theme.general.dangerColor}` : `0 0 0 1px ${theme.Select.borderColor}`,\n caretColor: theme.general.primaryColor,\n color: theme.general.color,\n fontWeight: 300,\n height: '48px',\n lineHeight: '24px',\n outline: 'none',\n padding: '0 16px',\n width: '100%',\n };\n};\n\nexport const INPUT_CLASSNAME = 'wireinput';\nexport const INPUT_GROUP = 'input-group';\n\nconst filterInputProps = (props: InputProps) => filterProps(props, ['markInvalid', 'placeholderTextTransform']);\n\nconst centerInputAction: CSSObject = {\n position: 'absolute',\n right: '16px',\n top: '50%',\n transform: 'translateY(-50%)',\n};\n\nexport const Input: React.FC<InputProps<HTMLInputElement>> = React.forwardRef<\n HTMLInputElement,\n InputProps<HTMLInputElement>\n>(({type, label, error, helperText, wrapperCSS = {}, className = '', ...props}, ref) => {\n const [togglePassword, setTogglePassword] = useState<boolean>(false);\n\n const hasError = !!error;\n const isPasswordInput = type === 'password';\n const toggledPasswordType = togglePassword ? 'text' : 'password';\n\n const toggleSetPassword = () => setTogglePassword(prevState => !prevState);\n\n const theme = useTheme();\n\n return (\n <div\n className={INPUT_GROUP}\n css={(theme: Theme) => ({\n marginBottom: hasError ? '2px' : '20px',\n width: '100%',\n '&:focus-within label': {\n color: theme.general.primaryColor,\n },\n ...wrapperCSS,\n })}\n >\n {label && (\n <InputLabel htmlFor={props.id} isRequired={props.required} markInvalid={props.markInvalid}>\n {label}\n </InputLabel>\n )}\n\n <div css={{marginBottom: hasError && '8px', position: 'relative'}}>\n <input\n className={INPUT_CLASSNAME}\n css={(theme: Theme) => inputStyle(theme, props, hasError)}\n ref={ref}\n type={isPasswordInput ? toggledPasswordType : type}\n aria-required={props.required}\n {...filterInputProps(props)}\n />\n\n {hasError && !isPasswordInput && (\n <ErrorIcon css={centerInputAction} width={16} height={16} aria-hidden=\"true\" />\n )}\n\n {isPasswordInput && (\n <button\n type=\"button\"\n data-uie-name={!togglePassword ? 'do-show-password' : 'do-hide-password'}\n css={{...centerInputAction, background: 'transparent', border: 'none', cursor: 'pointer', padding: 0}}\n onClick={toggleSetPassword}\n title=\"Toggle password visibility\"\n aria-controls={props.id}\n aria-expanded={togglePassword}\n >\n {togglePassword ? <HideIcon /> : <ShowIcon />}\n </button>\n )}\n </div>\n\n {!hasError && helperText && (\n <p\n css={(theme: Theme) => ({\n fontSize: '12px',\n fontWeight: 400,\n color: theme.Input.placeholderColor,\n marginTop: 8,\n })}\n >\n {helperText}\n </p>\n )}\n\n {error}\n </div>\n );\n});\n"],"mappings":";;;;;;;AAoBA;AAEA;AAIA;AACA;AACA;AAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAW/B,IAAMA,UAAoF,G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0B,EAAG;IACxB,iBAAeT;EAAe,GAE7BA,cAAc,GAAG,gBAAC,cAAQ,OAAG,GAAG,gBAAC,cAAQ,OAAG,CAEhD,CACG,EAEL,CAACE,QAAQ,IAAIN,UAAU,IACtB;IACE,GAAG,EAAE,aAAC9C,KAAY;MAAA,OAAM;QACtBQ,QAAQ,EAAE,MAAM;QAChBgB,UAAU,EAAE,GAAG;QACfnB,KAAK,EAAEL,KAAK,CAACM,KAAK,CAACC,gBAAgB;QACnCuD,SAAS,EAAE;MACb,CAAC;IAAA;EAAE,GAEFhB,UAAU,CAEd,EAEAD,KAAK,CACF;AAEV,CAAC,CAAC;AAAC"}
|
package/src/Form/InputBlock.js
CHANGED
|
@@ -1,38 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.InputBlock = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
7
|
var _react = _interopRequireDefault(require("react"));
|
|
11
8
|
var _react2 = require("@emotion/react");
|
|
12
9
|
var _Identity = require("../Identity");
|
|
13
10
|
var _Input = require("./Input");
|
|
14
11
|
var _InputSubmitCombo = require("./InputSubmitCombo");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* This program is free software: you can redistribute it and/or modify
|
|
20
|
-
* it under the terms of the GNU General Public License as published by
|
|
21
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
22
|
-
* (at your option) any later version.
|
|
23
|
-
*
|
|
24
|
-
* This program is distributed in the hope that it will be useful,
|
|
25
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
26
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
27
|
-
* GNU General Public License for more details.
|
|
28
|
-
*
|
|
29
|
-
* You should have received a copy of the GNU General Public License
|
|
30
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/** @jsx jsx */
|
|
35
|
-
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
36
15
|
var inputBlockStyle = function inputBlockStyle(props) {
|
|
37
16
|
var _ref;
|
|
38
17
|
return _ref = {
|
|
@@ -40,15 +19,15 @@ var inputBlockStyle = function inputBlockStyle(props) {
|
|
|
40
19
|
borderRadius: '4px',
|
|
41
20
|
boxShadow: "inset 16px 16px 0 ".concat(_Identity.COLOR.WHITE, ", inset -16px -16px 0 ").concat(_Identity.COLOR.WHITE),
|
|
42
21
|
marginBottom: '16px'
|
|
43
|
-
}, (
|
|
22
|
+
}, _defineProperty(_ref, ".".concat(_Input.INPUT_CLASSNAME, ", .").concat(_InputSubmitCombo.INPUT_SUBMIT_COMBO_CLASSNAME), {
|
|
44
23
|
marginBottom: '1px !important',
|
|
45
24
|
marginTop: '0 !important'
|
|
46
|
-
}), (
|
|
25
|
+
}), _defineProperty(_ref, ".".concat(_Input.INPUT_GROUP), {
|
|
47
26
|
marginBottom: 0
|
|
48
27
|
}), _ref;
|
|
49
28
|
};
|
|
50
29
|
var InputBlock = function InputBlock(props) {
|
|
51
|
-
return (0, _react2.jsx)("div", (
|
|
30
|
+
return (0, _react2.jsx)("div", _extends({
|
|
52
31
|
css: inputBlockStyle(props)
|
|
53
32
|
}, props));
|
|
54
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputBlock.js","names":["inputBlockStyle","props","backgroundColor","COLOR","GRAY_LIGHTEN_88","borderRadius","boxShadow","WHITE","marginBottom","INPUT_CLASSNAME","INPUT_SUBMIT_COMBO_CLASSNAME","marginTop","INPUT_GROUP","InputBlock"],"sources":["InputBlock.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport React from 'react';\nimport {CSSObject, jsx} from '@emotion/react';\n\nimport {COLOR} from '../Identity';\nimport {INPUT_CLASSNAME, INPUT_GROUP} from './Input';\nimport {INPUT_SUBMIT_COMBO_CLASSNAME} from './InputSubmitCombo';\n\nexport type InputBlockProps<T = HTMLDivElement> = React.HTMLProps<T>;\n\nconst inputBlockStyle: (props: InputBlockProps) => CSSObject = props => ({\n backgroundColor: COLOR.GRAY_LIGHTEN_88,\n borderRadius: '4px',\n boxShadow: `inset 16px 16px 0 ${COLOR.WHITE}, inset -16px -16px 0 ${COLOR.WHITE}`,\n marginBottom: '16px',\n [`.${INPUT_CLASSNAME}, .${INPUT_SUBMIT_COMBO_CLASSNAME}`]: {\n marginBottom: '1px !important',\n marginTop: '0 !important',\n },\n [`.${INPUT_GROUP}`]: {\n marginBottom: 0,\n },\n});\n\nexport const InputBlock = (props: InputBlockProps) => <div css={inputBlockStyle(props)} {...props} />;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputBlock.js","names":["inputBlockStyle","props","backgroundColor","COLOR","GRAY_LIGHTEN_88","borderRadius","boxShadow","WHITE","marginBottom","INPUT_CLASSNAME","INPUT_SUBMIT_COMBO_CLASSNAME","marginTop","INPUT_GROUP","InputBlock"],"sources":["InputBlock.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport React from 'react';\nimport {CSSObject, jsx} from '@emotion/react';\n\nimport {COLOR} from '../Identity';\nimport {INPUT_CLASSNAME, INPUT_GROUP} from './Input';\nimport {INPUT_SUBMIT_COMBO_CLASSNAME} from './InputSubmitCombo';\n\nexport type InputBlockProps<T = HTMLDivElement> = React.HTMLProps<T>;\n\nconst inputBlockStyle: (props: InputBlockProps) => CSSObject = props => ({\n backgroundColor: COLOR.GRAY_LIGHTEN_88,\n borderRadius: '4px',\n boxShadow: `inset 16px 16px 0 ${COLOR.WHITE}, inset -16px -16px 0 ${COLOR.WHITE}`,\n marginBottom: '16px',\n [`.${INPUT_CLASSNAME}, .${INPUT_SUBMIT_COMBO_CLASSNAME}`]: {\n marginBottom: '1px !important',\n marginTop: '0 !important',\n },\n [`.${INPUT_GROUP}`]: {\n marginBottom: 0,\n },\n});\n\nexport const InputBlock = (props: InputBlockProps) => <div css={inputBlockStyle(props)} {...props} />;\n"],"mappings":";;;;;;AAoBA;AACA;AAEA;AACA;AACA;AAAgE;AAAA;AAAA;AAIhE,IAAMA,eAAsD,GAAG,SAAzDA,eAAsD,CAAGC,KAAK;EAAA;EAAA;IAClEC,eAAe,EAAEC,eAAK,CAACC,eAAe;IACtCC,YAAY,EAAE,KAAK;IACnBC,SAAS,8BAAuBH,eAAK,CAACI,KAAK,mCAAyBJ,eAAK,CAACI,KAAK,CAAE;IACjFC,YAAY,EAAE;EAAM,oCACfC,sBAAe,gBAAMC,8CAA4B,GAAK;IACzDF,YAAY,EAAE,gBAAgB;IAC9BG,SAAS,EAAE;EACb,CAAC,oCACIC,kBAAW,GAAK;IACnBJ,YAAY,EAAE;EAChB,CAAC;AAAA,CACD;AAEK,IAAMK,UAAU,GAAG,SAAbA,UAAU,CAAIZ,KAAsB;EAAA,OAAK;IAAK,GAAG,EAAED,eAAe,CAACC,KAAK;EAAE,GAAKA,KAAK,EAAI;AAAA;AAAC"}
|
package/src/Form/InputLabel.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports["default"] = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
7
|
var _react = require("@emotion/react");
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
8
|
var _Identity = require("../Identity");
|
|
12
9
|
var _react2 = _interopRequireDefault(require("react"));
|
|
13
10
|
var _excluded = ["htmlFor", "markInvalid", "isRequired", "children"];
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
15
|
var InputLabel = function InputLabel(_ref) {
|
|
15
16
|
var htmlFor = _ref.htmlFor,
|
|
16
17
|
markInvalid = _ref.markInvalid,
|
|
17
18
|
isRequired = _ref.isRequired,
|
|
18
19
|
children = _ref.children,
|
|
19
|
-
props = (
|
|
20
|
-
return (0, _react.jsx)("label", (
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
return (0, _react.jsx)("label", _extends({
|
|
21
22
|
htmlFor: htmlFor,
|
|
22
23
|
css: function css(theme) {
|
|
23
24
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputLabel.js","names":["InputLabel","htmlFor","markInvalid","isRequired","children","props","theme","fontSize","fontWeight","lineHeight","color","COLOR_V2","RED_LIGHT_500","Input","labelColor","marginLeft"],"sources":["InputLabel.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2022 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {jsx} from '@emotion/react';\nimport {COLOR_V2} from '../Identity';\nimport {Theme} from '../Layout';\nimport React, {FC, ReactNode} from 'react';\n\nexport interface InputLabelProps {\n children: ReactNode | string;\n htmlFor?: string;\n markInvalid?: boolean;\n isRequired?: boolean;\n}\n\nconst InputLabel: FC<InputLabelProps> = ({htmlFor, markInvalid, isRequired, children, ...props}) => (\n <label\n htmlFor={htmlFor}\n css={(theme: Theme) => ({\n fontSize: '14px',\n fontWeight: 400,\n lineHeight: '16px',\n color: markInvalid ? COLOR_V2.RED_LIGHT_500 : theme.Input.labelColor,\n })}\n {...props}\n >\n {children}\n\n {isRequired && <span css={{fontSize: '16px', marginLeft: '4px', color: COLOR_V2.RED_LIGHT_500}}>*</span>}\n </label>\n);\n\nexport default InputLabel;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputLabel.js","names":["InputLabel","htmlFor","markInvalid","isRequired","children","props","theme","fontSize","fontWeight","lineHeight","color","COLOR_V2","RED_LIGHT_500","Input","labelColor","marginLeft"],"sources":["InputLabel.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2022 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {jsx} from '@emotion/react';\nimport {COLOR_V2} from '../Identity';\nimport {Theme} from '../Layout';\nimport React, {FC, ReactNode} from 'react';\n\nexport interface InputLabelProps {\n children: ReactNode | string;\n htmlFor?: string;\n markInvalid?: boolean;\n isRequired?: boolean;\n}\n\nconst InputLabel: FC<InputLabelProps> = ({htmlFor, markInvalid, isRequired, children, ...props}) => (\n <label\n htmlFor={htmlFor}\n css={(theme: Theme) => ({\n fontSize: '14px',\n fontWeight: 400,\n lineHeight: '16px',\n color: markInvalid ? COLOR_V2.RED_LIGHT_500 : theme.Input.labelColor,\n })}\n {...props}\n >\n {children}\n\n {isRequired && <span css={{fontSize: '16px', marginLeft: '4px', color: COLOR_V2.RED_LIGHT_500}}>*</span>}\n </label>\n);\n\nexport default InputLabel;\n"],"mappings":";;;;;;AAoBA;AACA;AAEA;AAA2C;AAAA;AAAA;AAAA;AAAA;AAS3C,IAAMA,UAA+B,GAAG,SAAlCA,UAA+B;EAAA,IAAKC,OAAO,QAAPA,OAAO;IAAEC,WAAW,QAAXA,WAAW;IAAEC,UAAU,QAAVA,UAAU;IAAEC,QAAQ,QAARA,QAAQ;IAAKC,KAAK;EAAA,OAC5F;IACE,OAAO,EAAEJ,OAAQ;IACjB,GAAG,EAAE,aAACK,KAAY;MAAA,OAAM;QACtBC,QAAQ,EAAE,MAAM;QAChBC,UAAU,EAAE,GAAG;QACfC,UAAU,EAAE,MAAM;QAClBC,KAAK,EAAER,WAAW,GAAGS,kBAAQ,CAACC,aAAa,GAAGN,KAAK,CAACO,KAAK,CAACC;MAC5D,CAAC;IAAA;EAAE,GACCT,KAAK,GAERD,QAAQ,EAERD,UAAU,IAAI;IAAM,GAAG,+BAAE;MAACI,QAAQ,EAAE,MAAM;MAAEQ,UAAU,EAAE,KAAK;MAAEL,KAAK,EAAEC,kBAAQ,CAACC;IAAa,CAAC;EAAC,OAAS,CAClG;AAAA,CACT;AAAC,eAEaZ,UAAU;AAAA"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.InputSubmitCombo = exports.INPUT_SUBMIT_COMBO_CLASSNAME = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
7
|
var _react = require("@emotion/react");
|
|
12
8
|
var _Input = require("./Input");
|
|
13
9
|
var _Identity = require("../Identity");
|
|
14
10
|
var _excluded = ["children"];
|
|
11
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
17
|
var INPUT_SUBMIT_COMBO_CLASSNAME = 'inputSubmitCombo';
|
|
18
18
|
exports.INPUT_SUBMIT_COMBO_CLASSNAME = INPUT_SUBMIT_COMBO_CLASSNAME;
|
|
19
19
|
var InputSubmitCombo = function InputSubmitCombo(_ref) {
|
|
20
20
|
var children = _ref.children,
|
|
21
|
-
props = (
|
|
22
|
-
return (0, _react.jsx)("div", (
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
return (0, _react.jsx)("div", _extends({
|
|
23
23
|
className: INPUT_SUBMIT_COMBO_CLASSNAME,
|
|
24
24
|
css: function css(theme) {
|
|
25
25
|
var _objectSpread2;
|
|
@@ -27,16 +27,16 @@ var InputSubmitCombo = function InputSubmitCombo(_ref) {
|
|
|
27
27
|
'&:focus-within': {
|
|
28
28
|
boxShadow: "0 0 0 1px ".concat(_Identity.COLOR_V2.BLUE)
|
|
29
29
|
}
|
|
30
|
-
}, (
|
|
30
|
+
}, _defineProperty(_objectSpread2, ".".concat(_Input.INPUT_GROUP), {
|
|
31
31
|
flexGrow: 1
|
|
32
|
-
}), (
|
|
32
|
+
}), _defineProperty(_objectSpread2, ".".concat(_Input.INPUT_CLASSNAME), {
|
|
33
33
|
'&:focus, &:invalid:not(:focus)': {
|
|
34
34
|
boxShadow: 'none'
|
|
35
35
|
},
|
|
36
36
|
boxShadow: 'none',
|
|
37
37
|
margin: '0 8px 0 0',
|
|
38
38
|
padding: '0 0 0 16px'
|
|
39
|
-
}), (
|
|
39
|
+
}), _defineProperty(_objectSpread2, "alignItems", 'center'), _defineProperty(_objectSpread2, "display", 'flex'), _defineProperty(_objectSpread2, "height", '49px'), _defineProperty(_objectSpread2, "justifyContent", 'space-between'), _defineProperty(_objectSpread2, "marginBottom", '4px'), _defineProperty(_objectSpread2, "paddingLeft", 0), _objectSpread2));
|
|
40
40
|
}
|
|
41
41
|
}, props), children);
|
|
42
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSubmitCombo.js","names":["INPUT_SUBMIT_COMBO_CLASSNAME","InputSubmitCombo","children","props","theme","inputStyle","boxShadow","COLOR_V2","BLUE","INPUT_GROUP","flexGrow","INPUT_CLASSNAME","margin","padding"],"sources":["InputSubmitCombo.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {jsx} from '@emotion/react';\n\nimport {INPUT_CLASSNAME, INPUT_GROUP, InputProps, inputStyle} from './Input';\nimport {COLOR_V2} from '../Identity';\nimport {Theme} from '../Layout';\n\nexport type InputSubmitComboProps<T = HTMLDivElement> = InputProps<T>;\n\nexport const INPUT_SUBMIT_COMBO_CLASSNAME = 'inputSubmitCombo';\n\nexport const InputSubmitCombo = ({children, ...props}: InputSubmitComboProps) => (\n <div\n className={INPUT_SUBMIT_COMBO_CLASSNAME}\n css={(theme: Theme) => ({\n ...inputStyle(theme, props),\n '&:focus-within': {\n boxShadow: `0 0 0 1px ${COLOR_V2.BLUE}`,\n },\n [`.${INPUT_GROUP}`]: {\n flexGrow: 1,\n },\n [`.${INPUT_CLASSNAME}`]: {\n '&:focus, &:invalid:not(:focus)': {\n boxShadow: 'none',\n },\n boxShadow: 'none',\n margin: '0 8px 0 0',\n padding: '0 0 0 16px',\n },\n alignItems: 'center',\n display: 'flex',\n height: '49px', // needs a bit more space to not overlap with the `boxShadow` from `:focus`\n justifyContent: 'space-between',\n marginBottom: '4px',\n paddingLeft: 0,\n })}\n {...props}\n >\n {children}\n </div>\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputSubmitCombo.js","names":["INPUT_SUBMIT_COMBO_CLASSNAME","InputSubmitCombo","children","props","theme","inputStyle","boxShadow","COLOR_V2","BLUE","INPUT_GROUP","flexGrow","INPUT_CLASSNAME","margin","padding"],"sources":["InputSubmitCombo.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {jsx} from '@emotion/react';\n\nimport {INPUT_CLASSNAME, INPUT_GROUP, InputProps, inputStyle} from './Input';\nimport {COLOR_V2} from '../Identity';\nimport {Theme} from '../Layout';\n\nexport type InputSubmitComboProps<T = HTMLDivElement> = InputProps<T>;\n\nexport const INPUT_SUBMIT_COMBO_CLASSNAME = 'inputSubmitCombo';\n\nexport const InputSubmitCombo = ({children, ...props}: InputSubmitComboProps) => (\n <div\n className={INPUT_SUBMIT_COMBO_CLASSNAME}\n css={(theme: Theme) => ({\n ...inputStyle(theme, props),\n '&:focus-within': {\n boxShadow: `0 0 0 1px ${COLOR_V2.BLUE}`,\n },\n [`.${INPUT_GROUP}`]: {\n flexGrow: 1,\n },\n [`.${INPUT_CLASSNAME}`]: {\n '&:focus, &:invalid:not(:focus)': {\n boxShadow: 'none',\n },\n boxShadow: 'none',\n margin: '0 8px 0 0',\n padding: '0 0 0 16px',\n },\n alignItems: 'center',\n display: 'flex',\n height: '49px', // needs a bit more space to not overlap with the `boxShadow` from `:focus`\n justifyContent: 'space-between',\n marginBottom: '4px',\n paddingLeft: 0,\n })}\n {...props}\n >\n {children}\n </div>\n);\n"],"mappings":";;;;;;AAoBA;AAEA;AACA;AAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAK9B,IAAMA,4BAA4B,GAAG,kBAAkB;AAAC;AAExD,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgB;EAAA,IAAKC,QAAQ,QAARA,QAAQ;IAAKC,KAAK;EAAA,OAClD;IACE,SAAS,EAAEH,4BAA6B;IACxC,GAAG,EAAE,aAACI,KAAY;MAAA;MAAA,uCACb,IAAAC,iBAAU,EAACD,KAAK,EAAED,KAAK,CAAC;QAC3B,gBAAgB,EAAE;UAChBG,SAAS,sBAAeC,kBAAQ,CAACC,IAAI;QACvC;MAAC,8CACIC,kBAAW,GAAK;QACnBC,QAAQ,EAAE;MACZ,CAAC,8CACIC,sBAAe,GAAK;QACvB,gCAAgC,EAAE;UAChCL,SAAS,EAAE;QACb,CAAC;QACDA,SAAS,EAAE,MAAM;QACjBM,MAAM,EAAE,WAAW;QACnBC,OAAO,EAAE;MACX,CAAC,iDACW,QAAQ,8CACX,MAAM,6CACP,MAAM,qDACE,eAAe,mDACjB,KAAK,kDACN,CAAC;IAAA;EACb,GACCV,KAAK,GAERD,QAAQ,CACL;AAAA,CACP;AAAC"}
|
package/src/Form/RangeInput.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.RangeInput = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
8
|
var _react = require("@emotion/react");
|
|
12
9
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
13
10
|
var _InputLabel = _interopRequireDefault(require("./InputLabel"));
|
|
14
11
|
var _RangeInput = require("./RangeInput.styles");
|
|
15
12
|
var _excluded = ["id", "label", "minValueLabel", "maxValueLabel", "min", "max", "value", "onChange", "wrapperCSS"];
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
19
|
var RangeInput = /*#__PURE__*/(0, _react2.forwardRef)(function (_ref, ref) {
|
|
19
20
|
var _ref$id = _ref.id,
|
|
20
21
|
id = _ref$id === void 0 ? Math.random().toString() : _ref$id,
|
|
@@ -29,7 +30,7 @@ var RangeInput = /*#__PURE__*/(0, _react2.forwardRef)(function (_ref, ref) {
|
|
|
29
30
|
value = _ref$value === void 0 ? '0' : _ref$value,
|
|
30
31
|
onChange = _ref.onChange,
|
|
31
32
|
wrapperCSS = _ref.wrapperCSS,
|
|
32
|
-
inputProps = (
|
|
33
|
+
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
33
34
|
var minNum = Number(min);
|
|
34
35
|
var maxNum = Number(max);
|
|
35
36
|
var valueNum = Number(value);
|
|
@@ -44,7 +45,7 @@ var RangeInput = /*#__PURE__*/(0, _react2.forwardRef)(function (_ref, ref) {
|
|
|
44
45
|
css: (0, _RangeInput.getValueLabelStyles)(_RangeInput.ValueLabelPosition.LEFT)
|
|
45
46
|
}, minValueLabel), maxValueLabel && (0, _react.jsx)("span", {
|
|
46
47
|
css: (0, _RangeInput.getValueLabelStyles)(_RangeInput.ValueLabelPosition.RIGHT)
|
|
47
|
-
}, maxValueLabel), (0, _react.jsx)("input", (
|
|
48
|
+
}, maxValueLabel), (0, _react.jsx)("input", _extends({
|
|
48
49
|
ref: ref,
|
|
49
50
|
css: function css(theme) {
|
|
50
51
|
return (0, _RangeInput.getImageCropZoomInputStyles)(theme, backgroundSize);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeInput.js","names":["RangeInput","forwardRef","ref","id","Math","random","toString","label","minValueLabel","maxValueLabel","min","max","value","onChange","wrapperCSS","inputProps","minNum","Number","maxNum","valueNum","backgroundSize","rangeInputWrapperStyles","getValueLabelStyles","ValueLabelPosition","LEFT","RIGHT","theme","getImageCropZoomInputStyles"],"sources":["RangeInput.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2022 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\nimport React, {FC, forwardRef} from 'react';\nimport {TextProps} from '../Text';\nimport {Theme} from '../Layout';\nimport InputLabel from './InputLabel';\nimport {\n getImageCropZoomInputStyles,\n getValueLabelStyles,\n rangeInputWrapperStyles,\n ValueLabelPosition,\n} from './RangeInput.styles';\n\nexport interface RangeInputProps<T = HTMLInputElement> extends TextProps<T> {\n label?: string;\n minValueLabel?: string;\n maxValueLabel?: string;\n wrapperCSS?: CSSObject;\n}\n\nexport const RangeInput: FC<RangeInputProps> = forwardRef<HTMLInputElement, RangeInputProps<HTMLInputElement>>(\n (\n {\n id = Math.random().toString(),\n label,\n minValueLabel,\n maxValueLabel,\n min = '0',\n max = '100',\n value = '0',\n onChange,\n wrapperCSS,\n ...inputProps\n },\n ref,\n ) => {\n const minNum = Number(min);\n const maxNum = Number(max);\n const valueNum = Number(value);\n\n const backgroundSize = `${((valueNum - minNum) * 100) / (maxNum - minNum)}% 100%` as const;\n\n return (\n <div css={wrapperCSS}>\n {label && <InputLabel htmlFor={id}>{label}</InputLabel>}\n <div css={rangeInputWrapperStyles}>\n {minValueLabel && <span css={getValueLabelStyles(ValueLabelPosition.LEFT)}>{minValueLabel}</span>}\n {maxValueLabel && <span css={getValueLabelStyles(ValueLabelPosition.RIGHT)}>{maxValueLabel}</span>}\n <input\n ref={ref}\n css={(theme: Theme) => getImageCropZoomInputStyles(theme, backgroundSize)}\n id={id}\n name={id}\n min={min}\n max={max}\n value={value}\n onChange={onChange}\n type=\"range\"\n {...inputProps}\n />\n </div>\n </div>\n );\n },\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RangeInput.js","names":["RangeInput","forwardRef","ref","id","Math","random","toString","label","minValueLabel","maxValueLabel","min","max","value","onChange","wrapperCSS","inputProps","minNum","Number","maxNum","valueNum","backgroundSize","rangeInputWrapperStyles","getValueLabelStyles","ValueLabelPosition","LEFT","RIGHT","theme","getImageCropZoomInputStyles"],"sources":["RangeInput.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2022 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\nimport React, {FC, forwardRef} from 'react';\nimport {TextProps} from '../Text';\nimport {Theme} from '../Layout';\nimport InputLabel from './InputLabel';\nimport {\n getImageCropZoomInputStyles,\n getValueLabelStyles,\n rangeInputWrapperStyles,\n ValueLabelPosition,\n} from './RangeInput.styles';\n\nexport interface RangeInputProps<T = HTMLInputElement> extends TextProps<T> {\n label?: string;\n minValueLabel?: string;\n maxValueLabel?: string;\n wrapperCSS?: CSSObject;\n}\n\nexport const RangeInput: FC<RangeInputProps> = forwardRef<HTMLInputElement, RangeInputProps<HTMLInputElement>>(\n (\n {\n id = Math.random().toString(),\n label,\n minValueLabel,\n maxValueLabel,\n min = '0',\n max = '100',\n value = '0',\n onChange,\n wrapperCSS,\n ...inputProps\n },\n ref,\n ) => {\n const minNum = Number(min);\n const maxNum = Number(max);\n const valueNum = Number(value);\n\n const backgroundSize = `${((valueNum - minNum) * 100) / (maxNum - minNum)}% 100%` as const;\n\n return (\n <div css={wrapperCSS}>\n {label && <InputLabel htmlFor={id}>{label}</InputLabel>}\n <div css={rangeInputWrapperStyles}>\n {minValueLabel && <span css={getValueLabelStyles(ValueLabelPosition.LEFT)}>{minValueLabel}</span>}\n {maxValueLabel && <span css={getValueLabelStyles(ValueLabelPosition.RIGHT)}>{maxValueLabel}</span>}\n <input\n ref={ref}\n css={(theme: Theme) => getImageCropZoomInputStyles(theme, backgroundSize)}\n id={id}\n name={id}\n min={min}\n max={max}\n value={value}\n onChange={onChange}\n type=\"range\"\n {...inputProps}\n />\n </div>\n </div>\n );\n },\n);\n"],"mappings":";;;;;;;AAoBA;AACA;AAGA;AACA;AAK6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAStB,IAAMA,UAA+B,gBAAG,IAAAC,kBAAU,EACvD,gBAaEC,GAAG,EACA;EAAA,mBAZDC,EAAE;IAAFA,EAAE,wBAAGC,IAAI,CAACC,MAAM,EAAE,CAACC,QAAQ,EAAE;IAC7BC,KAAK,QAALA,KAAK;IACLC,aAAa,QAAbA,aAAa;IACbC,aAAa,QAAbA,aAAa;IAAA,gBACbC,GAAG;IAAHA,GAAG,yBAAG,GAAG;IAAA,gBACTC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IAAA,kBACXC,KAAK;IAALA,KAAK,2BAAG,GAAG;IACXC,QAAQ,QAARA,QAAQ;IACRC,UAAU,QAAVA,UAAU;IACPC,UAAU;EAIf,IAAMC,MAAM,GAAGC,MAAM,CAACP,GAAG,CAAC;EAC1B,IAAMQ,MAAM,GAAGD,MAAM,CAACN,GAAG,CAAC;EAC1B,IAAMQ,QAAQ,GAAGF,MAAM,CAACL,KAAK,CAAC;EAE9B,IAAMQ,cAAc,aAAO,CAACD,QAAQ,GAAGH,MAAM,IAAI,GAAG,IAAKE,MAAM,GAAGF,MAAM,CAAC,WAAiB;EAE1F,OACE;IAAK,GAAG,EAAEF;EAAW,GAClBP,KAAK,IAAI,gBAAC,sBAAU;IAAC,OAAO,EAAEJ;EAAG,GAAEI,KAAK,CAAc,EACvD;IAAK,GAAG,EAAEc;EAAwB,GAC/Bb,aAAa,IAAI;IAAM,GAAG,EAAE,IAAAc,+BAAmB,EAACC,8BAAkB,CAACC,IAAI;EAAE,GAAEhB,aAAa,CAAQ,EAChGC,aAAa,IAAI;IAAM,GAAG,EAAE,IAAAa,+BAAmB,EAACC,8BAAkB,CAACE,KAAK;EAAE,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