Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update text fields
dominik-zeglenf118594b2732
diff --git a/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx b/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsxindex 4d4a473bcb..b493f5d692 100644--- a/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx+++ b/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx@@ -42,7 +42,8 @@ const styles = (theme: Theme) =>appAction: {bottom: 0,gridColumn: 2,- position: "sticky"+ position: "sticky",+ zIndex: 1},appLoader: {height: appLoaderHeight,diff --git a/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx b/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsxindex b787a03a27..0feef511e3 100644--- a/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx+++ b/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx@@ -65,9 +65,22 @@ const styles = (theme: Theme) =>helperText: {marginTop: theme.spacing.unit * 0.75},+ input: {+ "&:hover": {+ borderBottomColor: theme.palette.primary.main+ },+ backgroundColor: theme.overrides.MuiFilledInput.root.backgroundColor,+ borderBottom: `1px rgba(0, 0, 0, 0) solid`,+ borderTopLeftRadius: 4,+ borderTopRightRadius: 4,+ padding: "27px 12px 10px",+ position: "relative",+ transition: theme.transitions.duration.shortest + "ms"+ },label: {fontSize: theme.typography.caption.fontSize,- marginBottom: theme.spacing.unit * 2+ marginBottom: theme.spacing.unit * 2,+ marginTop: -21},root: {"& .DraftEditor": {@@ -84,21 +97,15 @@ const styles = (theme: Theme) =>background: theme.palette.getContrastText(theme.palette.background.default),- bottom: -1,+ bottom: -11,content: "''",display: "block",height: 2,+ left: -12,position: "absolute",transform: "scaleX(0) scaleY(0)",- width: "100%"- },- "&:hover": {- "&:after": {- animationName: "hover"- }+ width: "calc(100% + 24px)"},- borderBottom: `1px ${theme.palette.grey[500]} solid`,- paddingBottom: theme.spacing.unit / 2,position: "relative"},"&-root": {@@ -183,7 +190,6 @@ const styles = (theme: Theme) =>}}},-"&$error": {"& .Draftail": {"&-Editor": {@@ -237,60 +243,67 @@ const RichTextEditor = withStyles(styles, { name: "RichTextEditor" })([classes.scroll]: scroll})}>- <Typography className={classes.label} variant="caption" color="primary">- {label}- </Typography>- <DraftailEditor- key={JSON.stringify(initial)}- rawContentState={- initial && Object.keys(initial).length > 0 ? initial : null- }- onSave={value =>- onChange({- target: {- name,- value- }- } as any)- }- blockTypes={[- { icon: <HeaderTwo />, type: BLOCK_TYPE.HEADER_TWO },- { icon: <HeaderThree />, type: BLOCK_TYPE.HEADER_THREE },- { icon: <QuotationIcon />, type: BLOCK_TYPE.BLOCKQUOTE },- { icon: <UnorderedListIcon />, type: BLOCK_TYPE.UNORDERED_LIST_ITEM },- { icon: <OrderedListIcon />, type: BLOCK_TYPE.ORDERED_LIST_ITEM }- ]}- inlineStyles={[- { icon: <BoldIcon />, type: INLINE_STYLE.BOLD },- { icon: <ItalicIcon />, type: INLINE_STYLE.ITALIC }- ]}- enableLineBreak- entityTypes={[- {- attributes: ["href"],- decorator: LinkEntity,- icon: <LinkIcon />,- source: LinkSource,- type: ENTITY_TYPE.LINK+ <div className={classes.input}>+ <Typography className={classes.label} variant="caption" color="primary">+ {label}+ </Typography>+ <DraftailEditor+ key={JSON.stringify(initial)}+ rawContentState={+ initial && Object.keys(initial).length > 0 ? initial : null+ }+ onSave={value =>+ onChange({+ target: {+ name,+ value+ }+ } as any)}- // {- // attributes: ["href"],- // decorator: ImageEntity,- // icon: <ImageIcon />,- // source: ImageSource,- // type: ENTITY_TYPE.IMAGE- // }- ]}- />- <Typography- className={classNames({- [classes.error]: error,- [classes.helperText]: true- })}- variant="caption"- >- {helperText}- </Typography>+ blockTypes={[+ { icon: <HeaderTwo />, type: BLOCK_TYPE.HEADER_TWO },+ { icon: <HeaderThree />, type: BLOCK_TYPE.HEADER_THREE },+ { icon: <QuotationIcon />, type: BLOCK_TYPE.BLOCKQUOTE },+ {+ icon: <UnorderedListIcon />,+ type: BLOCK_TYPE.UNORDERED_LIST_ITEM+ },+ { icon: <OrderedListIcon />, type: BLOCK_TYPE.ORDERED_LIST_ITEM }+ ]}+ inlineStyles={[+ { icon: <BoldIcon />, type: INLINE_STYLE.BOLD },+ { icon: <ItalicIcon />, type: INLINE_STYLE.ITALIC }+ ]}+ enableLineBreak+ entityTypes={[+ {+ attributes: ["href"],+ decorator: LinkEntity,+ icon: <LinkIcon />,+ source: LinkSource,+ type: ENTITY_TYPE.LINK+ }+ // {+ // attributes: ["href"],+ // decorator: ImageEntity,+ // icon: <ImageIcon />,+ // source: ImageSource,+ // type: ENTITY_TYPE.IMAGE+ // }+ ]}+ />+ </div>+ {helperText && (+ <Typography+ className={classNames({+ [classes.error]: error,+ [classes.helperText]: true+ })}+ variant="caption"+ >+ {helperText}+ </Typography>+ )}</div>));diff --git a/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx b/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsxindex 1dc29ea4dd..7959080bd6 100644--- a/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx+++ b/saleor/static/dashboard-next/components/Theme/ThemeProvider.tsx@@ -20,6 +20,11 @@ const dark: IThemeColors = {default: "#202124",disabled: "rgba(32, 33, 36, 0.6)"},+ input: {+ default: "#25262A",+ disabled: "#292A2D",+ focused: "#25262A"+ },paperBorder: "#252728",primary: "#13BEBB",secondary: "#21125E"@@ -39,6 +44,11 @@ const light: IThemeColors = {default: "#C8C8C8",disabled: "rgba(216, 216, 216, 0.3)"},+ input: {+ default: "#F1F6F6",+ disabled: "#EAEAEA",+ focused: "#DCEBEB"+ },paperBorder: "#EAEAEA",primary: "#13BEBB",secondary: "#21125E"diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.tsindex 6930c2ce60..2eb9814e81 100644--- a/saleor/static/dashboard-next/theme.ts+++ b/saleor/static/dashboard-next/theme.ts@@ -1,5 +1,6 @@import { createMuiTheme, Theme } from "@material-ui/core/styles";import { fade } from "@material-ui/core/styles/colorManipulator";+import TextField from "@material-ui/core/TextField";const createShadow = (pv, pb, ps, uv, ub, us, av, ab, as) =>[@@ -19,6 +20,8 @@ export type IThemeColors = Record<font: Record<"default" | "gray", string>;} & {gray: Record<"default" | "disabled", string>;+} & {+ input: Record<"default" | "focused" | "disabled", string>;};const fontFamily = '"Inter", "roboto", "sans-serif"';@@ -54,6 +57,41 @@ export default (colors: IThemeColors): Theme =>flexDirection: "row-reverse" as "row-reverse"}},+ MuiFilledInput: {+ root: {+ "&$disabled": {+ backgroundColor: colors.input.disabled+ },+ "&$focused": {+ backgroundColor: colors.input.focused+ },+ "&:hover": {+ backgroundColor: colors.input.default+ },+ backgroundColor: colors.input.default+ },+ underline: {+ "&$focused": {+ "&:after": {+ borderBottomColor: colors.primary+ }+ },+ "&:before": {+ borderBottomColor: "rgba(0, 0, 0, 0)"+ },+ "&:hover": {+ "&:not($disabled)": {+ "&:not($focused)": {+ "&:not($error)": {+ "&:before": {+ borderBottomColor: colors.primary+ }+ }+ }+ }+ }+ }+ },MuiInput: {input: {"&:-webkit-autofill": {@@ -78,6 +116,9 @@ export default (colors: IThemeColors): Theme =>}},MuiInputLabel: {+ filled: {+ transform: "translate(12px, 10px) scale(0.75)"+ },formControl: {transform: "translate(0, 1.5px) scale(0.75)",transformOrigin: "top left" as "top left",@@ -251,3 +292,8 @@ export default (colors: IThemeColors): Theme =>useNextVariants: true}});++TextField.defaultProps = {+ ...TextField.defaultProps,+ variant: "filled"+};diff --git a/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsLong.tsx b/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsLong.tsxindex 645d151758..e03d86f312 100644--- a/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsLong.tsx+++ b/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsLong.tsx@@ -33,7 +33,7 @@ const TranslationFieldsLong: React.FC<TranslationFieldsLongProps> = ({disabled={disabled}fullWidthmultiline- // label={i18n.t("Translation")}+ label={i18n.t("Translation")}name="translation"value={data.translation}onChange={change}diff --git a/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsRich.tsx b/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsRich.tsxindex 24a262a358..c5c867e7f8 100644--- a/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsRich.tsx+++ b/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsRich.tsx@@ -35,8 +35,7 @@ const TranslationFieldsRich: React.FC<TranslationFieldsRichProps> = ({error={undefined}helperText={undefined}initial={JSON.parse(initial)}- // label={i18n.t("Translation")}- label={undefined}+ label={i18n.t("Translation")}name="translation"onChange={change}/>diff --git a/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsShort.tsx b/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsShort.tsxindex 527fe45651..75fb41c125 100644--- a/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsShort.tsx+++ b/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFieldsShort.tsx@@ -32,7 +32,7 @@ const TranslationFieldsShort: React.FC<TranslationFieldsShortProps> = ({<TextFielddisabled={disabled}fullWidth- // label={i18n.t("Translation")}+ label={i18n.t("Translation")}name="translation"value={data.translation}onChange={change}