@propellerads/editable-field 3.0.0 → 3.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.
@@ -1,5 +1,13 @@
1
- declare const StyledEditableFieldWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- declare const StyledEditableFieldInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
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>;
3
11
  declare const StyledEditableFieldInputSpinner: import("styled-components").StyledComponent<"div", any, {}, never>;
4
12
  declare const StyledEditableFieldInput: import("styled-components").StyledComponent<"input", any, {}, never>;
5
13
  declare const StyledEditableFieldValue: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -83,6 +83,7 @@ var EditableField = function EditableField(_ref) {
83
83
  disabled: isLoading,
84
84
  onChange: onChange
85
85
  }), !isEditable && React.createElement(StyledEditableFieldValue, {
86
+ className: fieldClassName,
86
87
  onClick: onFocus
87
88
  }, value), errors && React.createElement(ErrorLabel, {
88
89
  elementId: elementId,
@@ -92,7 +93,9 @@ var EditableField = function EditableField(_ref) {
92
93
  elementId: elementId + "-editable-field-icon",
93
94
  type: Button.BUTTON_TYPE.PLAIN,
94
95
  onClick: onFocus
95
- }, React.createElement(StyledEditableFieldIcon, null, React.createElement(icon.Edit, {
96
+ }, React.createElement(StyledEditableFieldIcon, {
97
+ className: fieldClassName
98
+ }, React.createElement(icon.Edit, {
96
99
  color: editIconColor,
97
100
  size: editIconSize
98
101
  })))), isEditable && !isLoading && React.createElement(StyledEditableFieldActions, null, React.createElement(Button__default, {
@@ -1 +1 @@
1
- {"version":3,"file":"editable-field.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"editable-field.cjs.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
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=e(require("react")),m=require("@propellerads/icon"),E=require("@propellerads/button"),g=e(E),x=e(require("@propellerads/error-label")),b=require("styled-components"),f=e(b),h=require("@propellerads/stylevariables");function v(e,n){return n||(n=e.slice(0)),e.raw=n,e}var C=b.keyframes(n||(n=v(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"]))),I=f.div(i||(i=v(["\n display: flex;\n width: fit-content;\n\n ","\n"])),(function(e){return e.isEditable&&b.css(r||(r=v(["\n align-items: flex-end;\n flex-direction: ",";\n width: 100%;\n "])),e.direction===T.COLUMN?"column":"row")})),L=f.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"])),h.borderRadius,h.gray80,(function(e){var n;return e.isEditable&&b.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&&b.css(a||(a=v(["\n box-shadow: inset 0 0 0 1px "," !important;\n padding-right: 20px;\n "])),h.gray80)})),O=f.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"])),h.white,h.gray80,h.gray80,C),y=f.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*h.spacing,h.lineHeight),w=f.div(s||(s=v(["\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ","px;\n"])),2*h.spacing),R=f.div(c||(c=v(["\n pointer-events: none;\n"]))),A=f.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*h.spacing,2*h.spacing,h.borderRadius,h.gray80),N={GRAY:m.COLOR.GRAY_DARK,BLUE:m.COLOR.BLUE},M={SMALL:m.SIZE.SMALL,MEDIUM:m.SIZE.MEDIUM},T={ROW:"row",COLUMN:"column"};exports.CONTAINER_DIRECTION=T,exports.EDIT_ICON_COLOR=N,exports.EDIT_ICON_SIZE=M,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=e.onCancel,s=e.onSave,c=e.onErrorClick,p=void 0===c?void 0:c,b=e.editIconColor,f=void 0===b?N.GRAY:b,h=e.editIconSize,v=void 0===h?M.MEDIUM:h,C=e.containerDirection,_=e.elementId;return u.createElement(I,{isEditable:o,direction:void 0===C?T.COLUMN:C},u.createElement(L,{isEditable:o,isLoading:t},o&&u.createElement(y,{className:void 0===l?"":l,value:n,disabled:t,onChange:e.onChange}),!o&&u.createElement(w,{onClick:a},n),r&&u.createElement(x,{elementId:_,errors:r,onClick:p}),t&&u.createElement(O,null),!o&&!t&&u.createElement(g,{elementId:_+"-editable-field-icon",type:E.BUTTON_TYPE.PLAIN,onClick:a},u.createElement(R,null,u.createElement(m.Edit,{color:f,size:v})))),o&&!t&&u.createElement(A,null,u.createElement(g,{elementId:_+"-editable-field-save",type:E.BUTTON_TYPE.PLAIN,onClick:s},u.createElement(m.Check,{color:m.COLOR.GRAY_DARK,size:m.SIZE.SMALL})),u.createElement(g,{elementId:_+"-editable-field-cancel",type:E.BUTTON_TYPE.PLAIN,onClick:d},u.createElement(m.Close,{color:m.COLOR.GRAY_DARK,size:m.SIZE.SMALL}))))};
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=e(require("react")),m=require("@propellerads/icon"),E=require("@propellerads/button"),g=e(E),x=e(require("@propellerads/error-label")),b=require("styled-components"),f=e(b),h=require("@propellerads/stylevariables");function v(e,n){return n||(n=e.slice(0)),e.raw=n,e}var C=b.keyframes(n||(n=v(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"]))),I=f.div(i||(i=v(["\n display: flex;\n width: fit-content;\n\n ","\n"])),(function(e){return e.isEditable&&b.css(r||(r=v(["\n align-items: flex-end;\n flex-direction: ",";\n width: 100%;\n "])),e.direction===T.COLUMN?"column":"row")})),L=f.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"])),h.borderRadius,h.gray80,(function(e){var n;return e.isEditable&&b.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&&b.css(a||(a=v(["\n box-shadow: inset 0 0 0 1px "," !important;\n padding-right: 20px;\n "])),h.gray80)})),O=f.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"])),h.white,h.gray80,h.gray80,C),y=f.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*h.spacing,h.lineHeight),w=f.div(s||(s=v(["\n outline: none;\n width: 100%;\n background: transparent;\n border: 0;\n resize: none;\n padding: ","px;\n"])),2*h.spacing),N=f.div(c||(c=v(["\n pointer-events: none;\n"]))),R=f.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*h.spacing,2*h.spacing,h.borderRadius,h.gray80),A={GRAY:m.COLOR.GRAY_DARK,BLUE:m.COLOR.BLUE},M={SMALL:m.SIZE.SMALL,MEDIUM:m.SIZE.MEDIUM},T={ROW:"row",COLUMN:"column"};exports.CONTAINER_DIRECTION=T,exports.EDIT_ICON_COLOR=A,exports.EDIT_ICON_SIZE=M,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,b=void 0===p?void 0:p,f=e.editIconColor,h=void 0===f?A.GRAY:f,v=e.editIconSize,C=void 0===v?M.MEDIUM:v,_=e.containerDirection,k=e.elementId;return u.createElement(I,{isEditable:o,direction:void 0===_?T.COLUMN:_},u.createElement(L,{isEditable:o,isLoading:t},o&&u.createElement(y,{className:d,value:n,disabled:t,onChange:e.onChange}),!o&&u.createElement(w,{className:d,onClick:a},n),r&&u.createElement(x,{elementId:k,errors:r,onClick:b}),t&&u.createElement(O,null),!o&&!t&&u.createElement(g,{elementId:k+"-editable-field-icon",type:E.BUTTON_TYPE.PLAIN,onClick:a},u.createElement(N,{className:d},u.createElement(m.Edit,{color:h,size:C})))),o&&!t&&u.createElement(R,null,u.createElement(g,{elementId:k+"-editable-field-save",type:E.BUTTON_TYPE.PLAIN,onClick:c},u.createElement(m.Check,{color:m.COLOR.GRAY_DARK,size:m.SIZE.SMALL})),u.createElement(g,{elementId:k+"-editable-field-cancel",type:E.BUTTON_TYPE.PLAIN,onClick:s},u.createElement(m.Close,{color:m.COLOR.GRAY_DARK,size:m.SIZE.SMALL}))))};
2
2
  //# sourceMappingURL=editable-field.cjs.production.min.js.map
@@ -75,6 +75,7 @@ var EditableField = function EditableField(_ref) {
75
75
  disabled: isLoading,
76
76
  onChange: onChange
77
77
  }), !isEditable && React.createElement(StyledEditableFieldValue, {
78
+ className: fieldClassName,
78
79
  onClick: onFocus
79
80
  }, value), errors && React.createElement(ErrorLabel, {
80
81
  elementId: elementId,
@@ -84,7 +85,9 @@ var EditableField = function EditableField(_ref) {
84
85
  elementId: elementId + "-editable-field-icon",
85
86
  type: BUTTON_TYPE.PLAIN,
86
87
  onClick: onFocus
87
- }, React.createElement(StyledEditableFieldIcon, null, React.createElement(Edit, {
88
+ }, React.createElement(StyledEditableFieldIcon, {
89
+ className: fieldClassName
90
+ }, React.createElement(Edit, {
88
91
  color: editIconColor,
89
92
  size: editIconSize
90
93
  })))), isEditable && !isLoading && React.createElement(StyledEditableFieldActions, null, React.createElement(Button, {
@@ -1 +1 @@
1
- {"version":3,"file":"editable-field.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"editable-field.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/editable-field",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "EditableField component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/editable-field.esm.js",