@propellerads/editable-field 3.0.5 → 4.0.1

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.
@@ -0,0 +1,38 @@
1
+ import { ChangeEventHandler, FC } from 'react';
2
+
3
+ declare const EditIconColor: {
4
+ readonly Gray: "gray-dark";
5
+ readonly Blue: "blue";
6
+ };
7
+ type EditIconColor = (typeof EditIconColor)[keyof typeof EditIconColor];
8
+ declare const EditIconSize: {
9
+ readonly Small: "small";
10
+ readonly Medium: "medium";
11
+ };
12
+ type EditIconSize = (typeof EditIconSize)[keyof typeof EditIconSize];
13
+ declare const ContainerDirection: {
14
+ readonly Row: "row";
15
+ readonly Column: "column";
16
+ };
17
+ type ContainerDirection = (typeof ContainerDirection)[keyof typeof ContainerDirection];
18
+ type EditableFieldProps = {
19
+ errors?: string[];
20
+ value: string;
21
+ isLoading: boolean;
22
+ isEditable: boolean;
23
+ fieldClassName?: string;
24
+ editIconColor?: EditIconColor;
25
+ editIconSize?: EditIconSize;
26
+ containerDirection?: ContainerDirection;
27
+ elementId: string;
28
+ onFocus: () => void;
29
+ onCancel: () => void;
30
+ onSave: () => void;
31
+ onChange: ChangeEventHandler<HTMLInputElement>;
32
+ onErrorClick?: () => void;
33
+ };
34
+
35
+ declare const EditableField: FC<EditableFieldProps>;
36
+
37
+ export { ContainerDirection, EditIconColor, EditIconSize, EditableField as default };
38
+ export type { EditableFieldProps };
package/dist/index.js CHANGED
@@ -1,8 +1,143 @@
1
+ import { jsxs as p, jsx as e } from "react/jsx-runtime";
2
+ import m, { ButtonType as h } from "@propellerads/button";
3
+ import C from "@propellerads/error-label";
4
+ import { Color as l, Size as a, Edit as E, Check as z, Close as F } from "@propellerads/icon";
5
+ import { borderRadius as u, gray80 as r, white as I, lineHeight as G, spacing as s } from "@propellerads/stylevariables";
6
+ import t, { keyframes as B, css as x } from "styled-components";
7
+ const D = B`
8
+ 0% {
9
+ transform: rotate(0deg);
10
+ }
11
+ 100% {
12
+ transform: rotate(360deg);
13
+ }
14
+ `, j = t.div`
15
+ display: flex;
16
+ width: fit-content;
1
17
 
2
- 'use strict'
18
+ ${(i) => i.$isEditable && x`
19
+ align-items: flex-end;
20
+ flex-direction: ${i.$direction};
21
+ width: 100%;
22
+ `}
23
+ `, M = t.div`
24
+ box-shadow: inset 0 0 0 1px transparent;
25
+ transition: box-shadow 0.3s ease, width 0.3s ease;
26
+ border-radius: ${u}px;
27
+ display: inline-flex;
28
+ flex-direction: row;
29
+ align-items: center;
30
+ padding-right: 4px;
3
31
 
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./editable-field.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./editable-field.cjs.development.js')
8
- }
32
+ &:hover {
33
+ box-shadow: inset 0 0 0 1px ${r};
34
+ }
35
+
36
+ ${(i) => i.$isEditable && x`
37
+ box-shadow: inset 0 0 0 1px ${i?.theme?.actionColor?.main || "#1787fc"} !important;
38
+ width: 100%;
39
+ `}
40
+
41
+ ${(i) => i.$isLoading && x`
42
+ box-shadow: inset 0 0 0 1px ${r} !important;
43
+ padding-right: 20px;
44
+ `}
45
+ `, P = t.div`
46
+ position: relative;
47
+
48
+ &:after {
49
+ content: '';
50
+ position: absolute;
51
+ display: block;
52
+ height: 14px;
53
+ width: 14px;
54
+ border: 1px solid;
55
+ border-color: ${I} ${r} ${r};
56
+ border-radius: 50%;
57
+ animation: ${D} 0.5s linear infinite;
58
+ margin-top: -7px;
59
+ }
60
+ `, R = t.input`
61
+ outline: none;
62
+ width: 100%;
63
+ background: transparent;
64
+ border: 0;
65
+ resize: none;
66
+ padding: ${s * 2}px;
67
+ height: ${G}px;
68
+ `, W = t.div`
69
+ outline: none;
70
+ width: 100%;
71
+ background: transparent;
72
+ border: 0;
73
+ resize: none;
74
+ padding: ${s * 2}px;
75
+ `, A = t.div`
76
+ pointer-events: none;
77
+ `, H = t.div`
78
+ display: flex;
79
+ margin-top: ${s * 2}px;
80
+
81
+ button {
82
+ margin-left: ${s * 2}px;
83
+ width: 36px;
84
+ height: 36px;
85
+ border-radius: ${u}px;
86
+ border: solid 1px ${r};
87
+ padding: 0;
88
+ cursor: pointer;
89
+ outline: none;
90
+ display: inline-flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+
94
+ &:hover {
95
+ background-color: #e6e6e6;
96
+ border-color: gray;
97
+ color: #000;
98
+ }
99
+ }
100
+ `, N = {
101
+ Gray: l.GrayDark,
102
+ Blue: l.Blue
103
+ }, T = {
104
+ Small: a.Small,
105
+ Medium: a.Medium
106
+ }, V = {
107
+ Row: "row",
108
+ Column: "column"
109
+ }, X = ({
110
+ value: i,
111
+ errors: y = [],
112
+ isLoading: o,
113
+ isEditable: n,
114
+ onFocus: b,
115
+ fieldClassName: c = "",
116
+ onCancel: f,
117
+ onSave: g,
118
+ onChange: w,
119
+ onErrorClick: $,
120
+ editIconColor: S = N.Gray,
121
+ editIconSize: k = T.Medium,
122
+ containerDirection: v = V.Column,
123
+ elementId: d
124
+ }) => /* @__PURE__ */ p(j, { $isEditable: n, $direction: v, children: [
125
+ /* @__PURE__ */ p(M, { $isEditable: n, $isLoading: o, children: [
126
+ n && /* @__PURE__ */ e(R, { className: c, value: i, disabled: o, onChange: w }),
127
+ !n && /* @__PURE__ */ e(W, { className: c, onClick: b, children: i }),
128
+ /* @__PURE__ */ e(C, { elementId: d, errors: y, ...$ ? { onClick: $ } : {} }),
129
+ o && /* @__PURE__ */ e(P, {}),
130
+ !n && !o && /* @__PURE__ */ e(m, { elementId: `${d}-editable-field-icon`, type: h.Plain, onClick: b, children: /* @__PURE__ */ e(A, { className: c, children: /* @__PURE__ */ e(E, { color: S, size: k }) }) })
131
+ ] }),
132
+ n && !o && /* @__PURE__ */ p(H, { children: [
133
+ /* @__PURE__ */ e(m, { elementId: `${d}-editable-field-save`, type: h.Plain, onClick: g, children: /* @__PURE__ */ e(z, { color: l.GrayDark, size: a.Small }) }),
134
+ /* @__PURE__ */ e(m, { elementId: `${d}-editable-field-cancel`, type: h.Plain, onClick: f, children: /* @__PURE__ */ e(F, { color: l.GrayDark, size: a.Small }) })
135
+ ] })
136
+ ] });
137
+ export {
138
+ V as ContainerDirection,
139
+ N as EditIconColor,
140
+ T as EditIconSize,
141
+ X as default
142
+ };
143
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/style.tsx","../src/types.ts","../src/index.tsx"],"sourcesContent":["import {borderRadius, gray80, lineHeight, spacing, white} from '@propellerads/stylevariables';\nimport styled, {css, keyframes} from 'styled-components';\nimport {ContainerDirection} from './types';\n\nconst spin = keyframes`\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n`;\n\ntype StyledEditableFieldWrapperProps = {\n $isEditable: boolean;\n $direction: ContainerDirection;\n};\n\ntype StyledEditableFieldInputWrapperProps = {\n $isEditable: boolean;\n $isLoading: boolean;\n};\n\nconst StyledEditableFieldWrapper = styled.div<StyledEditableFieldWrapperProps>`\n display: flex;\n width: fit-content;\n\n ${(props) =>\n props.$isEditable &&\n css`\n align-items: flex-end;\n flex-direction: ${props.$direction};\n width: 100%;\n `}\n`;\n\nconst StyledEditableFieldInputWrapper = styled.div<StyledEditableFieldInputWrapperProps>`\n box-shadow: inset 0 0 0 1px transparent;\n transition: box-shadow 0.3s ease, width 0.3s ease;\n border-radius: ${borderRadius}px;\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n padding-right: 4px;\n\n &:hover {\n box-shadow: inset 0 0 0 1px ${gray80};\n }\n\n ${(props) =>\n props.$isEditable &&\n css`\n box-shadow: inset 0 0 0 1px ${props?.theme?.actionColor?.main || '#1787fc'} !important;\n width: 100%;\n `}\n\n ${(props) =>\n props.$isLoading &&\n css`\n box-shadow: inset 0 0 0 1px ${gray80} !important;\n padding-right: 20px;\n `}\n`;\n\nconst StyledEditableFieldInputSpinner = styled.div`\n position: relative;\n\n &:after {\n content: '';\n position: absolute;\n display: block;\n height: 14px;\n width: 14px;\n border: 1px solid;\n border-color: ${white} ${gray80} ${gray80};\n border-radius: 50%;\n animation: ${spin} 0.5s linear infinite;\n margin-top: -7px;\n }\n`;\n\nconst StyledEditableFieldInput = styled.input`\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ${spacing * 2}px;\n height: ${lineHeight}px;\n`;\n\nconst StyledEditableFieldValue = styled.div`\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ${spacing * 2}px;\n`;\n\nconst StyledEditableFieldIcon = styled.div`\n pointer-events: none;\n`;\n\nconst StyledEditableFieldActions = styled.div`\n display: flex;\n margin-top: ${spacing * 2}px;\n\n button {\n margin-left: ${spacing * 2}px;\n width: 36px;\n height: 36px;\n border-radius: ${borderRadius}px;\n border: solid 1px ${gray80};\n padding: 0;\n cursor: pointer;\n outline: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n background-color: #e6e6e6;\n border-color: gray;\n color: #000;\n }\n }\n`;\n\nexport {\n StyledEditableFieldActions,\n StyledEditableFieldIcon,\n StyledEditableFieldInput,\n StyledEditableFieldInputSpinner,\n StyledEditableFieldInputWrapper,\n StyledEditableFieldValue,\n StyledEditableFieldWrapper,\n};\n","import type {ChangeEventHandler} from 'react';\nimport {Color, Size} from '@propellerads/icon';\n\nexport const EditIconColor = {\n Gray: Color.GrayDark,\n Blue: Color.Blue,\n} as const;\nexport type EditIconColor = (typeof EditIconColor)[keyof typeof EditIconColor];\n\nexport const EditIconSize = {\n Small: Size.Small,\n Medium: Size.Medium,\n} as const;\nexport type EditIconSize = (typeof EditIconSize)[keyof typeof EditIconSize];\n\nexport const ContainerDirection = {\n Row: 'row',\n Column: 'column',\n} as const;\nexport type ContainerDirection = (typeof ContainerDirection)[keyof typeof ContainerDirection];\n\nexport type EditableFieldProps = {\n errors?: string[];\n value: string;\n isLoading: boolean;\n isEditable: boolean;\n fieldClassName?: string;\n editIconColor?: EditIconColor;\n editIconSize?: EditIconSize;\n containerDirection?: ContainerDirection;\n elementId: string;\n onFocus: () => void;\n onCancel: () => void;\n onSave: () => void;\n onChange: ChangeEventHandler<HTMLInputElement>;\n onErrorClick?: () => void;\n};\n","import Button, {ButtonType} from '@propellerads/button';\nimport ErrorLabel from '@propellerads/error-label';\nimport {Check, Close, Color, Edit, Size} from '@propellerads/icon';\nimport type {FC} from 'react';\nimport {\n StyledEditableFieldActions,\n StyledEditableFieldIcon,\n StyledEditableFieldInput,\n StyledEditableFieldInputSpinner,\n StyledEditableFieldInputWrapper,\n StyledEditableFieldValue,\n StyledEditableFieldWrapper,\n} from './style';\nimport {ContainerDirection, EditIconColor, EditIconSize, type EditableFieldProps} from './types';\n\nconst EditableField: FC<EditableFieldProps> = ({\n value,\n errors = [],\n isLoading,\n isEditable,\n onFocus,\n fieldClassName = '',\n onCancel,\n onSave,\n onChange,\n onErrorClick,\n editIconColor = EditIconColor.Gray,\n editIconSize = EditIconSize.Medium,\n containerDirection = ContainerDirection.Column,\n elementId,\n}) => (\n <StyledEditableFieldWrapper $isEditable={isEditable} $direction={containerDirection}>\n <StyledEditableFieldInputWrapper $isEditable={isEditable} $isLoading={isLoading}>\n {isEditable && (\n <StyledEditableFieldInput className={fieldClassName} value={value} disabled={isLoading} onChange={onChange} />\n )}\n {!isEditable && (\n <StyledEditableFieldValue className={fieldClassName} onClick={onFocus}>\n {value}\n </StyledEditableFieldValue>\n )}\n <ErrorLabel elementId={elementId} errors={errors} {...(onErrorClick ? {onClick: onErrorClick} : {})} />\n {isLoading && <StyledEditableFieldInputSpinner />}\n {!isEditable && !isLoading && (\n <Button elementId={`${elementId}-editable-field-icon`} type={ButtonType.Plain} onClick={onFocus}>\n <StyledEditableFieldIcon className={fieldClassName}>\n <Edit color={editIconColor} size={editIconSize} />\n </StyledEditableFieldIcon>\n </Button>\n )}\n </StyledEditableFieldInputWrapper>\n {isEditable && !isLoading && (\n <StyledEditableFieldActions>\n <Button elementId={`${elementId}-editable-field-save`} type={ButtonType.Plain} onClick={onSave}>\n <Check color={Color.GrayDark} size={Size.Small} />\n </Button>\n <Button elementId={`${elementId}-editable-field-cancel`} type={ButtonType.Plain} onClick={onCancel}>\n <Close color={Color.GrayDark} size={Size.Small} />\n </Button>\n </StyledEditableFieldActions>\n )}\n </StyledEditableFieldWrapper>\n);\n\nexport default EditableField;\nexport {ContainerDirection, EditIconColor, EditIconSize} from './types';\nexport type {EditableFieldProps} from './types';\n"],"names":["spin","keyframes","StyledEditableFieldWrapper","styled","props","css","StyledEditableFieldInputWrapper","borderRadius","gray80","StyledEditableFieldInputSpinner","white","StyledEditableFieldInput","spacing","lineHeight","StyledEditableFieldValue","StyledEditableFieldIcon","StyledEditableFieldActions","EditIconColor","Color","EditIconSize","Size","ContainerDirection","EditableField","value","errors","isLoading","isEditable","onFocus","fieldClassName","onCancel","onSave","onChange","onErrorClick","editIconColor","editIconSize","containerDirection","elementId","jsxs","jsx","ErrorLabel","Button","ButtonType","Edit","Check","Close"],"mappings":";;;;;;AAIA,MAAMA,IAAOC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAmBPC,IAA6BC,EAAO;AAAA;AAAA;AAAA;AAAA,IAItC,CAACC,MACDA,EAAM,eACNC;AAAA;AAAA,wBAEoBD,EAAM,UAAU;AAAA;AAAA,KAEnC;AAAA,GAGCE,IAAkCH,EAAO;AAAA;AAAA;AAAA,mBAG5BI,CAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAOGC,CAAM;AAAA;AAAA;AAAA,IAGpC,CAACJ,MACDA,EAAM,eACNC;AAAA,oCACgCD,GAAO,OAAO,aAAa,QAAQ,SAAS;AAAA;AAAA,KAE3E;AAAA;AAAA,IAED,CAACA,MACDA,EAAM,cACNC;AAAA,oCACgCG,CAAM;AAAA;AAAA,KAErC;AAAA,GAGCC,IAAkCN,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAU3BO,CAAK,IAAIF,CAAM,IAAIA,CAAM;AAAA;AAAA,iBAE5BR,CAAI;AAAA;AAAA;AAAA,GAKfW,IAA2BR,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAM3BS,IAAU,CAAC;AAAA,YACZC,CAAU;AAAA,GAGhBC,IAA2BX,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAM3BS,IAAU,CAAC;AAAA,GAGlBG,IAA0BZ,EAAO;AAAA;AAAA,GAIjCa,IAA6Bb,EAAO;AAAA;AAAA,gBAE1BS,IAAU,CAAC;AAAA;AAAA;AAAA,mBAGRA,IAAU,CAAC;AAAA;AAAA;AAAA,qBAGTL,CAAY;AAAA,wBACTC,CAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GC9GjBS,IAAgB;AAAA,EAC3B,MAAMC,EAAM;AAAA,EACZ,MAAMA,EAAM;AACd,GAGaC,IAAe;AAAA,EAC1B,OAAOC,EAAK;AAAA,EACZ,QAAQA,EAAK;AACf,GAGaC,IAAqB;AAAA,EAChC,KAAK;AAAA,EACL,QAAQ;AACV,GCHMC,IAAwC,CAAC;AAAA,EAC7C,OAAAC;AAAA,EACA,QAAAC,IAAS,CAAA;AAAA,EACT,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC,IAAgBhB,EAAc;AAAA,EAC9B,cAAAiB,IAAef,EAAa;AAAA,EAC5B,oBAAAgB,IAAqBd,EAAmB;AAAA,EACxC,WAAAe;AACF,MACE,gBAAAC,EAACnC,GAAA,EAA2B,aAAawB,GAAY,YAAYS,GAC/D,UAAA;AAAA,EAAA,gBAAAE,EAAC/B,GAAA,EAAgC,aAAaoB,GAAY,YAAYD,GACnE,UAAA;AAAA,IAAAC,uBACEf,GAAA,EAAyB,WAAWiB,GAAgB,OAAAL,GAAc,UAAUE,GAAW,UAAAM,GAAoB;AAAA,IAE7G,CAACL,KACA,gBAAAY,EAACxB,GAAA,EAAyB,WAAWc,GAAgB,SAASD,GAC3D,UAAAJ,GACH;AAAA,IAEF,gBAAAe,EAACC,GAAA,EAAW,WAAAH,GAAsB,QAAAZ,GAAiB,GAAIQ,IAAe,EAAC,SAASA,MAAgB,CAAA,GAAK;AAAA,IACpGP,uBAAchB,GAAA,EAAgC;AAAA,IAC9C,CAACiB,KAAc,CAACD,KACf,gBAAAa,EAACE,GAAA,EAAO,WAAW,GAAGJ,CAAS,wBAAwB,MAAMK,EAAW,OAAO,SAASd,GACtF,UAAA,gBAAAW,EAACvB,GAAA,EAAwB,WAAWa,GAClC,UAAA,gBAAAU,EAACI,GAAA,EAAK,OAAOT,GAAe,MAAMC,EAAA,CAAc,EAAA,CAClD,EAAA,CACF;AAAA,EAAA,GAEJ;AAAA,EACCR,KAAc,CAACD,KACd,gBAAAY,EAACrB,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAsB,EAACE,KAAO,WAAW,GAAGJ,CAAS,wBAAwB,MAAMK,EAAW,OAAO,SAASX,GACtF,UAAA,gBAAAQ,EAACK,KAAM,OAAOzB,EAAM,UAAU,MAAME,EAAK,OAAO,EAAA,CAClD;AAAA,sBACCoB,GAAA,EAAO,WAAW,GAAGJ,CAAS,0BAA0B,MAAMK,EAAW,OAAO,SAASZ,GACxF,UAAA,gBAAAS,EAACM,KAAM,OAAO1B,EAAM,UAAU,MAAME,EAAK,OAAO,EAAA,CAClD;AAAA,EAAA,EAAA,CACF;AAAA,EAAA,CAEJ;"}
package/package.json CHANGED
@@ -1,37 +1,45 @@
1
1
  {
2
2
  "name": "@propellerads/editable-field",
3
- "version": "3.0.5",
4
- "description": "EditableField component",
5
- "main": "dist/index.js",
6
- "module": "dist/editable-field.esm.js",
3
+ "version": "4.0.1",
4
+ "type": "module",
5
+ "types": "dist/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
7
12
  "files": [
8
13
  "dist"
9
14
  ],
10
- "repository": "git+https://github.com/propellerads/ui-components.git",
15
+ "repository": "https://github.com/propellerads/ui-components.git",
11
16
  "author": "i.pasyuk@propellerads.net",
12
17
  "license": "MIT",
13
18
  "bugs": {
14
19
  "url": "https://github.com/propellerads/ui-components/issues"
15
20
  },
16
21
  "scripts": {
17
- "start": "tsdx watch",
18
- "build": "tsdx build"
22
+ "build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
19
23
  },
20
24
  "homepage": "https://github.com/propellerads/ui-components#readme",
21
25
  "private": false,
22
26
  "dependencies": {
23
- "@propellerads/button": "^9.0.2",
27
+ "@propellerads/button": "^9.0.3",
24
28
  "@propellerads/error-label": "^5.0.2",
25
- "@propellerads/icon": "^7.1.1",
26
- "@propellerads/stylevariables": "^2.0.2"
27
- },
28
- "devDependencies": {
29
- "tsdx": "0.14.1",
30
- "tslib": "2.6.2",
31
- "typescript": "4.9.5"
29
+ "@propellerads/icon": "^7.2.1",
30
+ "@propellerads/stylevariables": "^2.0.2",
31
+ "@propellerads/theme-annotation": "^2.0.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "styled-components": "5.1.1",
35
- "react": ">=18 <19"
34
+ "react": "^18.0.0 || ^19.0.0",
35
+ "styled-components": "^5.1.1 || ^6.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/react": "^19.2.14",
39
+ "@vitejs/plugin-react": "^5.1.4",
40
+ "rollup": "^4.58.0",
41
+ "rollup-plugin-dts": "^6.3.0",
42
+ "typescript": "^5.9.3",
43
+ "vite": "^7.3.1"
36
44
  }
37
45
  }
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- export declare const EDIT_ICON_COLOR: {
3
- GRAY: "gray-dark";
4
- BLUE: "blue";
5
- };
6
- export declare const EDIT_ICON_SIZE: {
7
- SMALL: "small";
8
- MEDIUM: "medium";
9
- };
10
- export declare const CONTAINER_DIRECTION: {
11
- ROW: string;
12
- COLUMN: string;
13
- };
14
- interface IProps {
15
- errors?: string[];
16
- value: string;
17
- isLoading: boolean;
18
- isEditable: boolean;
19
- fieldClassName?: string;
20
- editIconColor?: (typeof EDIT_ICON_COLOR)[keyof typeof EDIT_ICON_COLOR];
21
- editIconSize?: (typeof EDIT_ICON_SIZE)[keyof typeof EDIT_ICON_SIZE];
22
- containerDirection?: (typeof CONTAINER_DIRECTION)[keyof typeof CONTAINER_DIRECTION];
23
- elementId: string;
24
- onFocus: () => void;
25
- onCancel: () => void;
26
- onSave: () => void;
27
- onChange: () => void;
28
- onErrorClick?: () => void;
29
- }
30
- declare const EditableField: ({ value, errors, isLoading, isEditable, onFocus, fieldClassName, onCancel, onSave, onChange, onErrorClick, editIconColor, editIconSize, containerDirection, elementId, }: IProps) => React.JSX.Element;
31
- export default EditableField;
@@ -1,16 +0,0 @@
1
- import { THEME } from '../../../ThemeComponent/types';
2
- declare const StyledEditableFieldWrapper: import("styled-components").StyledComponent<"div", any, {
3
- isEditable: boolean;
4
- direction: string;
5
- }, never>;
6
- declare const StyledEditableFieldInputWrapper: import("styled-components").StyledComponent<"div", any, {
7
- isEditable: boolean;
8
- isLoading: boolean;
9
- theme: THEME;
10
- }, never>;
11
- declare const StyledEditableFieldInputSpinner: import("styled-components").StyledComponent<"div", any, {}, never>;
12
- declare const StyledEditableFieldInput: import("styled-components").StyledComponent<"input", any, {}, never>;
13
- declare const StyledEditableFieldValue: import("styled-components").StyledComponent<"div", any, {}, never>;
14
- declare const StyledEditableFieldIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
15
- declare const StyledEditableFieldActions: import("styled-components").StyledComponent<"div", any, {}, never>;
16
- export { StyledEditableFieldActions, StyledEditableFieldIcon, StyledEditableFieldInput, StyledEditableFieldInputSpinner, StyledEditableFieldInputWrapper, StyledEditableFieldValue, StyledEditableFieldWrapper, };
@@ -1,118 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var Button = require('@propellerads/button');
8
- var Button__default = _interopDefault(Button);
9
- var ErrorLabel = _interopDefault(require('@propellerads/error-label'));
10
- var icon = require('@propellerads/icon');
11
- var React = _interopDefault(require('react'));
12
- var stylevariables = require('@propellerads/stylevariables');
13
- var styled = require('styled-components');
14
- var styled__default = _interopDefault(styled);
15
-
16
- function _taggedTemplateLiteralLoose(e, t) {
17
- return t || (t = e.slice(0)), e.raw = t, e;
18
- }
19
-
20
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1;
21
- var spin = /*#__PURE__*/styled.keyframes(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
22
- var StyledEditableFieldWrapper = /*#__PURE__*/styled__default.div(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: fit-content;\n\n ", "\n"])), function (props) {
23
- return props.isEditable && styled.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n align-items: flex-end;\n flex-direction: ", ";\n width: 100%;\n "])), props.direction === CONTAINER_DIRECTION.COLUMN ? 'column' : 'row');
24
- });
25
- var StyledEditableFieldInputWrapper = /*#__PURE__*/styled__default.div(_templateObject4 || (_templateObject4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n box-shadow: inset 0 0 0 1px transparent;\n transition: box-shadow 0.3s ease, width 0.3s ease;\n border-radius: ", "px;\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n padding-right: 4px;\n\n &:hover {\n box-shadow: inset 0 0 0 1px ", ";\n }\n\n ", "\n\n ", "\n"])), stylevariables.borderRadius, stylevariables.gray80, function (props) {
26
- var _props$theme;
27
- return props.isEditable && styled.css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n box-shadow: inset 0 0 0 1px ", " !important;\n width: 100%;\n "])), (props == null || (_props$theme = props.theme) == null || (_props$theme = _props$theme.actionColor) == null ? void 0 : _props$theme.main) || '#1787fc');
28
- }, function (props) {
29
- return props.isLoading && styled.css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n box-shadow: inset 0 0 0 1px ", " !important;\n padding-right: 20px;\n "])), stylevariables.gray80);
30
- });
31
- var StyledEditableFieldInputSpinner = /*#__PURE__*/styled__default.div(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n\n &:after {\n content: '';\n position: absolute;\n display: block;\n height: 14px;\n width: 14px;\n border: 1px solid;\n border-color: ", " ", " ", ";\n border-radius: 50%;\n animation: ", " 0.5s linear infinite;\n margin-top: -7px;\n }\n"])), stylevariables.white, stylevariables.gray80, stylevariables.gray80, spin);
32
- var StyledEditableFieldInput = /*#__PURE__*/styled__default.input(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ", "px;\n height: ", "px;\n"])), stylevariables.spacing * 2, stylevariables.lineHeight);
33
- var StyledEditableFieldValue = /*#__PURE__*/styled__default.div(_templateObject9 || (_templateObject9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ", "px;\n"])), stylevariables.spacing * 2);
34
- var StyledEditableFieldIcon = /*#__PURE__*/styled__default.div(_templateObject0 || (_templateObject0 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n pointer-events: none;\n"])));
35
- var StyledEditableFieldActions = /*#__PURE__*/styled__default.div(_templateObject1 || (_templateObject1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n margin-top: ", "px;\n\n button {\n margin-left: ", "px;\n width: 36px;\n height: 36px;\n border-radius: ", "px;\n border: solid 1px ", ";\n padding: 0;\n cursor: pointer;\n outline: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n background-color: #e6e6e6;\n border-color: gray;\n color: #000;\n }\n }\n"])), stylevariables.spacing * 2, stylevariables.spacing * 2, stylevariables.borderRadius, stylevariables.gray80);
36
-
37
- var EDIT_ICON_COLOR = {
38
- GRAY: icon.Color.GrayDark,
39
- BLUE: icon.Color.Blue
40
- };
41
- var EDIT_ICON_SIZE = {
42
- SMALL: icon.Size.Small,
43
- MEDIUM: icon.Size.Medium
44
- };
45
- var CONTAINER_DIRECTION = {
46
- ROW: 'row',
47
- COLUMN: 'column'
48
- };
49
- var EditableField = function EditableField(_ref) {
50
- var value = _ref.value,
51
- _ref$errors = _ref.errors,
52
- errors = _ref$errors === void 0 ? [] : _ref$errors,
53
- isLoading = _ref.isLoading,
54
- isEditable = _ref.isEditable,
55
- onFocus = _ref.onFocus,
56
- _ref$fieldClassName = _ref.fieldClassName,
57
- fieldClassName = _ref$fieldClassName === void 0 ? '' : _ref$fieldClassName,
58
- onCancel = _ref.onCancel,
59
- onSave = _ref.onSave,
60
- onChange = _ref.onChange,
61
- _ref$onErrorClick = _ref.onErrorClick,
62
- onErrorClick = _ref$onErrorClick === void 0 ? undefined : _ref$onErrorClick,
63
- _ref$editIconColor = _ref.editIconColor,
64
- editIconColor = _ref$editIconColor === void 0 ? EDIT_ICON_COLOR.GRAY : _ref$editIconColor,
65
- _ref$editIconSize = _ref.editIconSize,
66
- editIconSize = _ref$editIconSize === void 0 ? EDIT_ICON_SIZE.MEDIUM : _ref$editIconSize,
67
- _ref$containerDirecti = _ref.containerDirection,
68
- containerDirection = _ref$containerDirecti === void 0 ? CONTAINER_DIRECTION.COLUMN : _ref$containerDirecti,
69
- elementId = _ref.elementId;
70
- return React.createElement(StyledEditableFieldWrapper, {
71
- isEditable: isEditable,
72
- direction: containerDirection
73
- }, React.createElement(StyledEditableFieldInputWrapper, {
74
- isEditable: isEditable,
75
- isLoading: isLoading
76
- }, isEditable && React.createElement(StyledEditableFieldInput, {
77
- className: fieldClassName,
78
- value: value,
79
- disabled: isLoading,
80
- onChange: onChange
81
- }), !isEditable && React.createElement(StyledEditableFieldValue, {
82
- className: fieldClassName,
83
- onClick: onFocus
84
- }, value), errors && React.createElement(ErrorLabel, {
85
- elementId: elementId,
86
- errors: errors,
87
- onClick: onErrorClick
88
- }), isLoading && React.createElement(StyledEditableFieldInputSpinner, null), !isEditable && !isLoading && React.createElement(Button__default, {
89
- elementId: elementId + "-editable-field-icon",
90
- type: Button.ButtonType.Plain,
91
- onClick: onFocus
92
- }, React.createElement(StyledEditableFieldIcon, {
93
- className: fieldClassName
94
- }, React.createElement(icon.Edit, {
95
- color: editIconColor,
96
- size: editIconSize
97
- })))), isEditable && !isLoading && React.createElement(StyledEditableFieldActions, null, React.createElement(Button__default, {
98
- elementId: elementId + "-editable-field-save",
99
- type: Button.ButtonType.Plain,
100
- onClick: onSave
101
- }, React.createElement(icon.Check, {
102
- color: icon.Color.GrayDark,
103
- size: icon.Size.Small
104
- })), React.createElement(Button__default, {
105
- elementId: elementId + "-editable-field-cancel",
106
- type: Button.ButtonType.Plain,
107
- onClick: onCancel
108
- }, React.createElement(icon.Close, {
109
- color: icon.Color.GrayDark,
110
- size: icon.Size.Small
111
- }))));
112
- };
113
-
114
- exports.CONTAINER_DIRECTION = CONTAINER_DIRECTION;
115
- exports.EDIT_ICON_COLOR = EDIT_ICON_COLOR;
116
- exports.EDIT_ICON_SIZE = EDIT_ICON_SIZE;
117
- exports.default = EditableField;
118
- //# sourceMappingURL=editable-field.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editable-field.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n,i,r,t,o,a,l,d,s,c,p,u=require("@propellerads/button"),m=e(u),g=e(require("@propellerads/error-label")),x=require("@propellerads/icon"),b=e(require("react")),f=require("@propellerads/stylevariables"),h=require("styled-components"),E=e(h);function v(e,n){return n||(n=e.slice(0)),e.raw=n,e}var y=h.keyframes(n||(n=v(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"]))),C=E.div(i||(i=v(["\n display: flex;\n width: fit-content;\n\n ","\n"])),(function(e){return e.isEditable&&h.css(r||(r=v(["\n align-items: flex-end;\n flex-direction: ",";\n width: 100%;\n "])),e.direction===M.COLUMN?"column":"row")})),w=E.div(t||(t=v(["\n box-shadow: inset 0 0 0 1px transparent;\n transition: box-shadow 0.3s ease, width 0.3s ease;\n border-radius: ","px;\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n padding-right: 4px;\n\n &:hover {\n box-shadow: inset 0 0 0 1px ",";\n }\n\n ","\n\n ","\n"])),f.borderRadius,f.gray80,(function(e){var n;return e.isEditable&&h.css(o||(o=v(["\n box-shadow: inset 0 0 0 1px "," !important;\n width: 100%;\n "])),(null==e||null==(n=e.theme)||null==(n=n.actionColor)?void 0:n.main)||"#1787fc")}),(function(e){return e.isLoading&&h.css(a||(a=v(["\n box-shadow: inset 0 0 0 1px "," !important;\n padding-right: 20px;\n "])),f.gray80)})),I=E.div(l||(l=v(["\n position: relative;\n\n &:after {\n content: '';\n position: absolute;\n display: block;\n height: 14px;\n width: 14px;\n border: 1px solid;\n border-color: "," "," ",";\n border-radius: 50%;\n animation: "," 0.5s linear infinite;\n margin-top: -7px;\n }\n"])),f.white,f.gray80,f.gray80,y),k=E.input(d||(d=v(["\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ","px;\n height: ","px;\n"])),2*f.spacing,f.lineHeight),N=E.div(s||(s=v(["\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ","px;\n"])),2*f.spacing),O=E.div(c||(c=v(["\n pointer-events: none;\n"]))),S=E.div(p||(p=v(["\n display: flex;\n margin-top: ","px;\n\n button {\n margin-left: ","px;\n width: 36px;\n height: 36px;\n border-radius: ","px;\n border: solid 1px ",";\n padding: 0;\n cursor: pointer;\n outline: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n background-color: #e6e6e6;\n border-color: gray;\n color: #000;\n }\n }\n"])),2*f.spacing,2*f.spacing,f.borderRadius,f.gray80),z={GRAY:x.Color.GrayDark,BLUE:x.Color.Blue},L={SMALL:x.Size.Small,MEDIUM:x.Size.Medium},M={ROW:"row",COLUMN:"column"};exports.CONTAINER_DIRECTION=M,exports.EDIT_ICON_COLOR=z,exports.EDIT_ICON_SIZE=L,exports.default=function(e){var n=e.value,i=e.errors,r=void 0===i?[]:i,t=e.isLoading,o=e.isEditable,a=e.onFocus,l=e.fieldClassName,d=void 0===l?"":l,s=e.onCancel,c=e.onSave,p=e.onErrorClick,f=void 0===p?void 0:p,h=e.editIconColor,E=void 0===h?z.GRAY:h,v=e.editIconSize,y=void 0===v?L.MEDIUM:v,D=e.containerDirection,R=e.elementId;return b.createElement(C,{isEditable:o,direction:void 0===D?M.COLUMN:D},b.createElement(w,{isEditable:o,isLoading:t},o&&b.createElement(k,{className:d,value:n,disabled:t,onChange:e.onChange}),!o&&b.createElement(N,{className:d,onClick:a},n),r&&b.createElement(g,{elementId:R,errors:r,onClick:f}),t&&b.createElement(I,null),!o&&!t&&b.createElement(m,{elementId:R+"-editable-field-icon",type:u.ButtonType.Plain,onClick:a},b.createElement(O,{className:d},b.createElement(x.Edit,{color:E,size:y})))),o&&!t&&b.createElement(S,null,b.createElement(m,{elementId:R+"-editable-field-save",type:u.ButtonType.Plain,onClick:c},b.createElement(x.Check,{color:x.Color.GrayDark,size:x.Size.Small})),b.createElement(m,{elementId:R+"-editable-field-cancel",type:u.ButtonType.Plain,onClick:s},b.createElement(x.Close,{color:x.Color.GrayDark,size:x.Size.Small}))))};
2
- //# sourceMappingURL=editable-field.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editable-field.cjs.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,108 +0,0 @@
1
- import Button, { ButtonType } from '@propellerads/button';
2
- import ErrorLabel from '@propellerads/error-label';
3
- import { Color, Size, Edit, Check, Close } from '@propellerads/icon';
4
- import React from 'react';
5
- import { borderRadius, gray80, white, spacing, lineHeight } from '@propellerads/stylevariables';
6
- import styled, { css, keyframes } from 'styled-components';
7
-
8
- function _taggedTemplateLiteralLoose(e, t) {
9
- return t || (t = e.slice(0)), e.raw = t, e;
10
- }
11
-
12
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1;
13
- var spin = /*#__PURE__*/keyframes(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
14
- var StyledEditableFieldWrapper = /*#__PURE__*/styled.div(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: fit-content;\n\n ", "\n"])), function (props) {
15
- return props.isEditable && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n align-items: flex-end;\n flex-direction: ", ";\n width: 100%;\n "])), props.direction === CONTAINER_DIRECTION.COLUMN ? 'column' : 'row');
16
- });
17
- var StyledEditableFieldInputWrapper = /*#__PURE__*/styled.div(_templateObject4 || (_templateObject4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n box-shadow: inset 0 0 0 1px transparent;\n transition: box-shadow 0.3s ease, width 0.3s ease;\n border-radius: ", "px;\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n padding-right: 4px;\n\n &:hover {\n box-shadow: inset 0 0 0 1px ", ";\n }\n\n ", "\n\n ", "\n"])), borderRadius, gray80, function (props) {
18
- var _props$theme;
19
- return props.isEditable && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n box-shadow: inset 0 0 0 1px ", " !important;\n width: 100%;\n "])), (props == null || (_props$theme = props.theme) == null || (_props$theme = _props$theme.actionColor) == null ? void 0 : _props$theme.main) || '#1787fc');
20
- }, function (props) {
21
- return props.isLoading && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n box-shadow: inset 0 0 0 1px ", " !important;\n padding-right: 20px;\n "])), gray80);
22
- });
23
- var StyledEditableFieldInputSpinner = /*#__PURE__*/styled.div(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n\n &:after {\n content: '';\n position: absolute;\n display: block;\n height: 14px;\n width: 14px;\n border: 1px solid;\n border-color: ", " ", " ", ";\n border-radius: 50%;\n animation: ", " 0.5s linear infinite;\n margin-top: -7px;\n }\n"])), white, gray80, gray80, spin);
24
- var StyledEditableFieldInput = /*#__PURE__*/styled.input(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ", "px;\n height: ", "px;\n"])), spacing * 2, lineHeight);
25
- var StyledEditableFieldValue = /*#__PURE__*/styled.div(_templateObject9 || (_templateObject9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ", "px;\n"])), spacing * 2);
26
- var StyledEditableFieldIcon = /*#__PURE__*/styled.div(_templateObject0 || (_templateObject0 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n pointer-events: none;\n"])));
27
- var StyledEditableFieldActions = /*#__PURE__*/styled.div(_templateObject1 || (_templateObject1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n margin-top: ", "px;\n\n button {\n margin-left: ", "px;\n width: 36px;\n height: 36px;\n border-radius: ", "px;\n border: solid 1px ", ";\n padding: 0;\n cursor: pointer;\n outline: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n background-color: #e6e6e6;\n border-color: gray;\n color: #000;\n }\n }\n"])), spacing * 2, spacing * 2, borderRadius, gray80);
28
-
29
- var EDIT_ICON_COLOR = {
30
- GRAY: Color.GrayDark,
31
- BLUE: Color.Blue
32
- };
33
- var EDIT_ICON_SIZE = {
34
- SMALL: Size.Small,
35
- MEDIUM: Size.Medium
36
- };
37
- var CONTAINER_DIRECTION = {
38
- ROW: 'row',
39
- COLUMN: 'column'
40
- };
41
- var EditableField = function EditableField(_ref) {
42
- var value = _ref.value,
43
- _ref$errors = _ref.errors,
44
- errors = _ref$errors === void 0 ? [] : _ref$errors,
45
- isLoading = _ref.isLoading,
46
- isEditable = _ref.isEditable,
47
- onFocus = _ref.onFocus,
48
- _ref$fieldClassName = _ref.fieldClassName,
49
- fieldClassName = _ref$fieldClassName === void 0 ? '' : _ref$fieldClassName,
50
- onCancel = _ref.onCancel,
51
- onSave = _ref.onSave,
52
- onChange = _ref.onChange,
53
- _ref$onErrorClick = _ref.onErrorClick,
54
- onErrorClick = _ref$onErrorClick === void 0 ? undefined : _ref$onErrorClick,
55
- _ref$editIconColor = _ref.editIconColor,
56
- editIconColor = _ref$editIconColor === void 0 ? EDIT_ICON_COLOR.GRAY : _ref$editIconColor,
57
- _ref$editIconSize = _ref.editIconSize,
58
- editIconSize = _ref$editIconSize === void 0 ? EDIT_ICON_SIZE.MEDIUM : _ref$editIconSize,
59
- _ref$containerDirecti = _ref.containerDirection,
60
- containerDirection = _ref$containerDirecti === void 0 ? CONTAINER_DIRECTION.COLUMN : _ref$containerDirecti,
61
- elementId = _ref.elementId;
62
- return React.createElement(StyledEditableFieldWrapper, {
63
- isEditable: isEditable,
64
- direction: containerDirection
65
- }, React.createElement(StyledEditableFieldInputWrapper, {
66
- isEditable: isEditable,
67
- isLoading: isLoading
68
- }, isEditable && React.createElement(StyledEditableFieldInput, {
69
- className: fieldClassName,
70
- value: value,
71
- disabled: isLoading,
72
- onChange: onChange
73
- }), !isEditable && React.createElement(StyledEditableFieldValue, {
74
- className: fieldClassName,
75
- onClick: onFocus
76
- }, value), errors && React.createElement(ErrorLabel, {
77
- elementId: elementId,
78
- errors: errors,
79
- onClick: onErrorClick
80
- }), isLoading && React.createElement(StyledEditableFieldInputSpinner, null), !isEditable && !isLoading && React.createElement(Button, {
81
- elementId: elementId + "-editable-field-icon",
82
- type: ButtonType.Plain,
83
- onClick: onFocus
84
- }, React.createElement(StyledEditableFieldIcon, {
85
- className: fieldClassName
86
- }, React.createElement(Edit, {
87
- color: editIconColor,
88
- size: editIconSize
89
- })))), isEditable && !isLoading && React.createElement(StyledEditableFieldActions, null, React.createElement(Button, {
90
- elementId: elementId + "-editable-field-save",
91
- type: ButtonType.Plain,
92
- onClick: onSave
93
- }, React.createElement(Check, {
94
- color: Color.GrayDark,
95
- size: Size.Small
96
- })), React.createElement(Button, {
97
- elementId: elementId + "-editable-field-cancel",
98
- type: ButtonType.Plain,
99
- onClick: onCancel
100
- }, React.createElement(Close, {
101
- color: Color.GrayDark,
102
- size: Size.Small
103
- }))));
104
- };
105
-
106
- export default EditableField;
107
- export { CONTAINER_DIRECTION, EDIT_ICON_COLOR, EDIT_ICON_SIZE };
108
- //# sourceMappingURL=editable-field.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editable-field.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}