@propellerads/editable-field 3.0.3 → 3.0.5
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,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { COLOR, SIZE } from '@propellerads/icon';
|
|
3
2
|
export declare const EDIT_ICON_COLOR: {
|
|
4
|
-
GRAY:
|
|
5
|
-
BLUE:
|
|
3
|
+
GRAY: "gray-dark";
|
|
4
|
+
BLUE: "blue";
|
|
6
5
|
};
|
|
7
6
|
export declare const EDIT_ICON_SIZE: {
|
|
8
|
-
SMALL:
|
|
9
|
-
MEDIUM:
|
|
7
|
+
SMALL: "small";
|
|
8
|
+
MEDIUM: "medium";
|
|
10
9
|
};
|
|
11
10
|
export declare const CONTAINER_DIRECTION: {
|
|
12
11
|
ROW: string;
|
|
@@ -13,4 +13,4 @@ declare const StyledEditableFieldInput: import("styled-components").StyledCompon
|
|
|
13
13
|
declare const StyledEditableFieldValue: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
14
|
declare const StyledEditableFieldIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
15
15
|
declare const StyledEditableFieldActions: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
|
-
export {
|
|
16
|
+
export { StyledEditableFieldActions, StyledEditableFieldIcon, StyledEditableFieldInput, StyledEditableFieldInputSpinner, StyledEditableFieldInputWrapper, StyledEditableFieldValue, StyledEditableFieldWrapper, };
|
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
-
var React = _interopDefault(require('react'));
|
|
8
|
-
var icon = require('@propellerads/icon');
|
|
9
7
|
var Button = require('@propellerads/button');
|
|
10
8
|
var Button__default = _interopDefault(Button);
|
|
11
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');
|
|
12
13
|
var styled = require('styled-components');
|
|
13
14
|
var styled__default = _interopDefault(styled);
|
|
14
|
-
var stylevariables = require('@propellerads/stylevariables');
|
|
15
15
|
|
|
16
16
|
function _taggedTemplateLiteralLoose(e, t) {
|
|
17
17
|
return t || (t = e.slice(0)), e.raw = t, e;
|
|
@@ -35,12 +35,12 @@ var StyledEditableFieldIcon = /*#__PURE__*/styled__default.div(_templateObject0
|
|
|
35
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
36
|
|
|
37
37
|
var EDIT_ICON_COLOR = {
|
|
38
|
-
GRAY: icon.
|
|
39
|
-
BLUE: icon.
|
|
38
|
+
GRAY: icon.Color.GrayDark,
|
|
39
|
+
BLUE: icon.Color.Blue
|
|
40
40
|
};
|
|
41
41
|
var EDIT_ICON_SIZE = {
|
|
42
|
-
SMALL: icon.
|
|
43
|
-
MEDIUM: icon.
|
|
42
|
+
SMALL: icon.Size.Small,
|
|
43
|
+
MEDIUM: icon.Size.Medium
|
|
44
44
|
};
|
|
45
45
|
var CONTAINER_DIRECTION = {
|
|
46
46
|
ROW: 'row',
|
|
@@ -99,15 +99,15 @@ var EditableField = function EditableField(_ref) {
|
|
|
99
99
|
type: Button.ButtonType.Plain,
|
|
100
100
|
onClick: onSave
|
|
101
101
|
}, React.createElement(icon.Check, {
|
|
102
|
-
color: icon.
|
|
103
|
-
size: icon.
|
|
102
|
+
color: icon.Color.GrayDark,
|
|
103
|
+
size: icon.Size.Small
|
|
104
104
|
})), React.createElement(Button__default, {
|
|
105
105
|
elementId: elementId + "-editable-field-cancel",
|
|
106
106
|
type: Button.ButtonType.Plain,
|
|
107
107
|
onClick: onCancel
|
|
108
108
|
}, React.createElement(icon.Close, {
|
|
109
|
-
color: icon.
|
|
110
|
-
size: icon.
|
|
109
|
+
color: icon.Color.GrayDark,
|
|
110
|
+
size: icon.Size.Small
|
|
111
111
|
}))));
|
|
112
112
|
};
|
|
113
113
|
|
|
@@ -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,t,
|
|
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
2
|
//# sourceMappingURL=editable-field.cjs.production.min.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { COLOR, SIZE, Edit, Check, Close } from '@propellerads/icon';
|
|
3
1
|
import Button, { ButtonType } from '@propellerads/button';
|
|
4
2
|
import ErrorLabel from '@propellerads/error-label';
|
|
5
|
-
import
|
|
3
|
+
import { Color, Size, Edit, Check, Close } from '@propellerads/icon';
|
|
4
|
+
import React from 'react';
|
|
6
5
|
import { borderRadius, gray80, white, spacing, lineHeight } from '@propellerads/stylevariables';
|
|
6
|
+
import styled, { css, keyframes } from 'styled-components';
|
|
7
7
|
|
|
8
8
|
function _taggedTemplateLiteralLoose(e, t) {
|
|
9
9
|
return t || (t = e.slice(0)), e.raw = t, e;
|
|
@@ -27,12 +27,12 @@ var StyledEditableFieldIcon = /*#__PURE__*/styled.div(_templateObject0 || (_temp
|
|
|
27
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
28
|
|
|
29
29
|
var EDIT_ICON_COLOR = {
|
|
30
|
-
GRAY:
|
|
31
|
-
BLUE:
|
|
30
|
+
GRAY: Color.GrayDark,
|
|
31
|
+
BLUE: Color.Blue
|
|
32
32
|
};
|
|
33
33
|
var EDIT_ICON_SIZE = {
|
|
34
|
-
SMALL:
|
|
35
|
-
MEDIUM:
|
|
34
|
+
SMALL: Size.Small,
|
|
35
|
+
MEDIUM: Size.Medium
|
|
36
36
|
};
|
|
37
37
|
var CONTAINER_DIRECTION = {
|
|
38
38
|
ROW: 'row',
|
|
@@ -91,15 +91,15 @@ var EditableField = function EditableField(_ref) {
|
|
|
91
91
|
type: ButtonType.Plain,
|
|
92
92
|
onClick: onSave
|
|
93
93
|
}, React.createElement(Check, {
|
|
94
|
-
color:
|
|
95
|
-
size:
|
|
94
|
+
color: Color.GrayDark,
|
|
95
|
+
size: Size.Small
|
|
96
96
|
})), React.createElement(Button, {
|
|
97
97
|
elementId: elementId + "-editable-field-cancel",
|
|
98
98
|
type: ButtonType.Plain,
|
|
99
99
|
onClick: onCancel
|
|
100
100
|
}, React.createElement(Close, {
|
|
101
|
-
color:
|
|
102
|
-
size:
|
|
101
|
+
color: Color.GrayDark,
|
|
102
|
+
size: Size.Small
|
|
103
103
|
}))));
|
|
104
104
|
};
|
|
105
105
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/editable-field",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "EditableField component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/editable-field.esm.js",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"homepage": "https://github.com/propellerads/ui-components#readme",
|
|
21
21
|
"private": false,
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@propellerads/button": "^9.0.
|
|
24
|
-
"@propellerads/error-label": "^5.0.
|
|
25
|
-
"@propellerads/icon": "^
|
|
23
|
+
"@propellerads/button": "^9.0.2",
|
|
24
|
+
"@propellerads/error-label": "^5.0.2",
|
|
25
|
+
"@propellerads/icon": "^7.1.1",
|
|
26
26
|
"@propellerads/stylevariables": "^2.0.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|