Skip to content

Commit

Permalink
Extract from 4e215ad27938820b812c863770dfe9892b55bb08
Browse files Browse the repository at this point in the history
  • Loading branch information
akeneo committed Jan 20, 2025
1 parent 67c5651 commit 7a79e61
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 451 deletions.
1 change: 0 additions & 1 deletion lib/components/Input/TextAreaInput/RichTextEditor.js

This file was deleted.

64 changes: 17 additions & 47 deletions lib/components/Input/TextAreaInput/TextAreaInput.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,46 @@
"use strict";var j=Object.defineProperty,z=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var g=(e,r,o)=>r in e?j(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,p=(e,r)=>{for(var o in r||(r={}))c.call(r,o)&&g(e,o,r[o]);if(l)for(var o of l(r))u.call(r,o)&&g(e,o,r[o]);return e},h=(e,r)=>z(e,_(r));var f=(e,r)=>{var o={};for(var t in e)c.call(e,t)&&r.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&l)for(var t of l(e))r.indexOf(t)<0&&u.call(e,t)&&(o[t]=e[t]);return o};var d=require("react/jsx-runtime"),w=require("react"),b=require("styled-components"),q=require("../../../icons/LockIcon.js"),i=require("../../../theme/theme.js"),I=require("./RichTextEditor.js");function m(e){return e&&e.__esModule?e:{default:e}}var k=m(w),a=m(b);const A=a.default.div`
"use strict";var w=Object.defineProperty;var i=Object.getOwnPropertySymbols;var c=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var u=(e,t,o)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,x=(e,t)=>{for(var o in t||(t={}))c.call(t,o)&&u(e,o,t[o]);if(i)for(var o of i(t))g.call(t,o)&&u(e,o,t[o]);return e};var f=(e,t)=>{var o={};for(var r in e)c.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&i)for(var r of i(e))t.indexOf(r)<0&&g.call(e,r)&&(o[r]=e[r]);return o};var a=require("react/jsx-runtime"),p=require("react"),h=require("styled-components"),m=require("../../../icons/LockIcon.js"),l=require("../../../theme/theme.js");function C(e){return e&&e.__esModule?e:{default:e}}var z=C(p),n=C(h);const _=n.default.div`
position: relative;
display: flex;
flex-direction: column;
width: 100%;
`,C=b.css`
border: 1px solid ${({invalid:e})=>e?i.getColor("red",100):i.getColor("grey",80)};
`,I=h.css`
border: 1px solid ${({invalid:e})=>e?l.getColor("red",100):l.getColor("grey",80)};
border-radius: 2px;
color: ${({readOnly:e})=>e?i.getColor("grey",100):i.getColor("grey",140)};
font-size: ${i.getFontSize("default")};
color: ${({readOnly:e})=>e?l.getColor("grey",100):l.getColor("grey",140)};
font-size: ${l.getFontSize("default")};
line-height: 20px;
width: 100%;
box-sizing: border-box;
font-family: inherit;
outline-style: none;
background: ${({readOnly:e})=>e?i.getColor("grey",20):i.getColor("white")};
background: ${({readOnly:e})=>e?l.getColor("grey",20):l.getColor("white")};
cursor: ${({readOnly:e})=>e?"not-allowed":"auto"};
&:focus-within {
box-shadow: 0 0 0 2px ${i.getColor("blue",40)};
box-shadow: 0 0 0 2px ${l.getColor("blue",40)};
}
a.rdw-dropdown-selectedtext > span {
color: ${({readOnly:e})=>e?i.getColor("grey",100):i.getColor("grey",140)};
color: ${({readOnly:e})=>e?l.getColor("grey",100):l.getColor("grey",140)};
}
`,E=a.default.div`
${C}
padding: 0;
padding-bottom: 10px;
& .rdw-editor-main {
min-height: 200px;
max-height: 400px;
padding: 0 30px 10px 15px;
}
& .rdw-option-wrapper {
min-width: 30px;
height: 30px;
}
& .rdw-editor-toolbar {
border: none;
padding: 0;
margin: 0;
padding: 5px 30px 0 0;
border-radius: 0;
border-bottom: 1px solid ${({invalid:e})=>e?i.getColor("red",100):i.getColor("grey",80)};
}
& .rdw-dropdown-wrapper:hover,
& .rdw-option-wrapper:hover,
& .rdw-dropdown-optionwrapper:hover {
box-shadow: none;
}
`,S=a.default.textarea`
${C}
`,j=n.default.textarea`
${I}
resize: none;
height: 200px;
padding: 10px 30px 10px 15px;
&::placeholder {
opacity: 1;
color: ${i.getColor("grey",100)};
color: ${l.getColor("grey",100)};
}
`,F=a.default(q.LockIcon)`
`,q=n.default(m.LockIcon)`
position: absolute;
right: 0;
top: 0;
margin: 12px;
color: ${i.getColor("grey",100)};
`,L=a.default.div`
font-size: ${i.getFontSize("small")};
color: ${l.getColor("grey",100)};
`,R=n.default.div`
font-size: ${l.getFontSize("small")};
align-self: flex-end;
color: ${i.getColor("grey",100)};
`,D=k.default.forwardRef((M,R)=>{var x=M,{value:e,invalid:r,onChange:o,readOnly:t,characterLeftLabel:s,isRichText:v=!1,richTextEditorProps:$}=x,y=f(x,["value","invalid","onChange","readOnly","characterLeftLabel","isRichText","richTextEditorProps"]);const T=w.useCallback(n=>{!t&&o&&o(n.currentTarget.value)},[t,o]);return d.jsxs(A,{children:[v?d.jsx(E,{readOnly:t,invalid:r,children:d.jsx(I.RichTextEditor,h(p({readOnly:t,value:e},$),{onChange:n=>o==null?void 0:o(n)}))}):d.jsx(S,p({ref:R,value:e,onChange:T,type:"text",readOnly:t,disabled:t,"aria-invalid":r,invalid:r},y)),t&&d.jsx(F,{size:16}),s&&d.jsx(L,{children:s})]})});exports.TextAreaInput=D;
color: ${l.getColor("grey",100)};
`,T=z.default.forwardRef((k,$)=>{var d=k,{value:e,invalid:t,onChange:o,readOnly:r,characterLeftLabel:s}=d,y=f(d,["value","invalid","onChange","readOnly","characterLeftLabel"]);const b=p.useCallback(v=>{!r&&o&&o(v.currentTarget.value)},[r,o]);return a.jsxs(_,{children:[a.jsx(j,x({ref:$,value:e,onChange:b,type:"text",readOnly:r,disabled:r,"aria-invalid":t,invalid:t},y)),r&&a.jsx(q,{size:16}),s&&a.jsx(R,{children:s})]})});exports.TextAreaInput=T;
3 changes: 0 additions & 3 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ButtonHTMLAttributes } from 'react';
import { default as default_2 } from 'react';
import { DefaultTheme } from 'styled-components';
import { DependencyList } from 'react';
import { EditorProps } from 'react-draft-wysiwyg';
import { FC } from 'react';
import { FlattenInterpolation } from 'styled-components';
import { FlattenSimpleInterpolation } from 'styled-components';
Expand Down Expand Up @@ -1597,8 +1596,6 @@ export declare type TextAreaInputProps = Override<Override<default_2.InputHTMLAt
placeholder?: string;
invalid?: boolean;
characterLeftLabel?: string;
isRichText?: boolean;
richTextEditorProps?: EditorProps;
}>;

export declare const TextInput: default_2.ForwardRefExoticComponent<TextInputProps & default_2.RefAttributes<HTMLInputElement>>;
Expand Down
1 change: 0 additions & 1 deletion lib/style.css

This file was deleted.

Loading

0 comments on commit 7a79e61

Please sign in to comment.