@desynova-digital/components 8.6.0 → 8.7.0
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.
|
@@ -31,6 +31,10 @@ var _switch = require("../switch");
|
|
|
31
31
|
|
|
32
32
|
var _switch2 = _interopRequireDefault(_switch);
|
|
33
33
|
|
|
34
|
+
var _icon = require("../icon");
|
|
35
|
+
|
|
36
|
+
var _icon2 = _interopRequireDefault(_icon);
|
|
37
|
+
|
|
34
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
39
|
|
|
36
40
|
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
@@ -139,7 +143,14 @@ var Checkbox = function Checkbox(props) {
|
|
|
139
143
|
console.log(value);
|
|
140
144
|
}
|
|
141
145
|
})
|
|
142
|
-
) : null
|
|
146
|
+
) : null,
|
|
147
|
+
props.type === 'icon' && _react2.default.createElement(_icon2.default, {
|
|
148
|
+
name: props.value,
|
|
149
|
+
value: props.value,
|
|
150
|
+
width: props.width,
|
|
151
|
+
height: props.height,
|
|
152
|
+
fillRule: props.fillRule,
|
|
153
|
+
color: props.checked ? "#00CEC6" : "#AFB2BA" })
|
|
143
154
|
);
|
|
144
155
|
};
|
|
145
156
|
|
|
@@ -156,7 +167,10 @@ var CheckboxGroup = function CheckboxGroup(props) {
|
|
|
156
167
|
readOnly: props.readOnly || child.props.readOnly,
|
|
157
168
|
onChange: child.props.isDisabled ? props.onChange : function () {},
|
|
158
169
|
theme: props.theme,
|
|
159
|
-
type: props.type
|
|
170
|
+
type: props.type,
|
|
171
|
+
width: props.width || 16,
|
|
172
|
+
height: props.height || 24,
|
|
173
|
+
fillRule: props.fillRule || ''
|
|
160
174
|
}) : null;
|
|
161
175
|
})
|
|
162
176
|
);
|
|
@@ -173,7 +187,10 @@ Checkbox.propTypes = {
|
|
|
173
187
|
readOnly: _propTypes2.default.bool,
|
|
174
188
|
/** Callback function which is called when the user selects an option */
|
|
175
189
|
onChange: _propTypes2.default.func,
|
|
176
|
-
type: _propTypes2.default.oneOf(["default", "label", "switch"])
|
|
190
|
+
type: _propTypes2.default.oneOf(["default", "label", "switch"]),
|
|
191
|
+
width: _propTypes2.default.number,
|
|
192
|
+
height: _propTypes2.default.number,
|
|
193
|
+
fillRule: _propTypes2.default.string
|
|
177
194
|
};
|
|
178
195
|
|
|
179
196
|
Checkbox.defaultProps = {
|
|
@@ -208,6 +208,41 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
208
208
|
{ value: "four" },
|
|
209
209
|
"Option 4"
|
|
210
210
|
)
|
|
211
|
+
),
|
|
212
|
+
_react2.default.createElement(
|
|
213
|
+
_components.Checkbox.Group,
|
|
214
|
+
{
|
|
215
|
+
theme: "dark",
|
|
216
|
+
name: "example5",
|
|
217
|
+
onChange: function onChange(e) {
|
|
218
|
+
console.log(e.target.value, e.target.checked);
|
|
219
|
+
},
|
|
220
|
+
align: "horizontal",
|
|
221
|
+
selected: ["text_aligned_left"],
|
|
222
|
+
type: "icon"
|
|
223
|
+
},
|
|
224
|
+
_react2.default.createElement(_components.Checkbox, { value: "text_aligned_left" }),
|
|
225
|
+
_react2.default.createElement(_components.Checkbox, { value: "text_aligned_center" }),
|
|
226
|
+
_react2.default.createElement(_components.Checkbox, { value: "text_aligned_right" })
|
|
227
|
+
),
|
|
228
|
+
_react2.default.createElement(
|
|
229
|
+
_components.Checkbox.Group,
|
|
230
|
+
{
|
|
231
|
+
theme: "dark",
|
|
232
|
+
name: "example6",
|
|
233
|
+
onChange: function onChange(e) {
|
|
234
|
+
console.log(e.target.value, e.target.checked);
|
|
235
|
+
},
|
|
236
|
+
align: "horizontal",
|
|
237
|
+
selected: ["text_position_bottom"],
|
|
238
|
+
type: "icon",
|
|
239
|
+
width: 24,
|
|
240
|
+
height: 16,
|
|
241
|
+
fillRule: "evenodd"
|
|
242
|
+
},
|
|
243
|
+
_react2.default.createElement(_components.Checkbox, { value: "text_position_top" }),
|
|
244
|
+
_react2.default.createElement(_components.Checkbox, { value: "text_position_center" }),
|
|
245
|
+
_react2.default.createElement(_components.Checkbox, { value: "text_position_bottom" })
|
|
211
246
|
)
|
|
212
247
|
);
|
|
213
248
|
});
|
package/atoms/icon/icon.js
CHANGED
|
@@ -40,7 +40,7 @@ var Icon = function Icon(props) {
|
|
|
40
40
|
{
|
|
41
41
|
width: props.width || icon.width,
|
|
42
42
|
height: props.height || icon.height,
|
|
43
|
-
viewBox: '0 0 ' + icon.width + ' ' + icon.height,
|
|
43
|
+
viewBox: '0 0 ' + (props.width || icon.width) + ' ' + (props.height || icon.height),
|
|
44
44
|
color: props.color
|
|
45
45
|
},
|
|
46
46
|
icon.paths.map(function (path, index) {
|
|
@@ -51,7 +51,7 @@ var Icon = function Icon(props) {
|
|
|
51
51
|
fill: props.color,
|
|
52
52
|
stroke: props.stroke,
|
|
53
53
|
strokeWidth: icon.strokeWidth,
|
|
54
|
-
fillRule:
|
|
54
|
+
fillRule: props.fillRule
|
|
55
55
|
});
|
|
56
56
|
})
|
|
57
57
|
)
|
package/atoms/icon/icons.json
CHANGED
|
@@ -561,7 +561,7 @@
|
|
|
561
561
|
},
|
|
562
562
|
"subtitle": {
|
|
563
563
|
"paths": [
|
|
564
|
-
"
|
|
564
|
+
"M10.8 0H1.2C0.54 0 0 0.54 0 1.2V8.4C0 9.06 0.54 9.6 1.2 9.6H10.8C11.46 9.6 12 9.06 12 8.4V1.2C12 0.54 11.46 0 10.8 0ZM1.2 4.8H3.6V6H1.2V4.8ZM1.2 8.4H7.2V7.2H1.2V8.4ZM10.8 8.4H8.4V7.2H10.8V8.4ZM4.8 6H10.8V4.8H4.8V6Z"
|
|
565
565
|
],
|
|
566
566
|
"width": 20,
|
|
567
567
|
"height": 16
|
|
@@ -1111,6 +1111,42 @@
|
|
|
1111
1111
|
],
|
|
1112
1112
|
"width": 16,
|
|
1113
1113
|
"height": 18
|
|
1114
|
+
},
|
|
1115
|
+
"text_aligned_right": {
|
|
1116
|
+
"paths":[
|
|
1117
|
+
"M0 1.77778V0H16V1.77778H0ZM5.33333 5.33333H16V3.55556H5.33333V5.33333ZM16 8.88889H0V7.11111H16V8.88889ZM5.33333 12.4444H16V10.6667H5.33333V12.4444ZM0 16H16V14.2222H0V16Z"
|
|
1118
|
+
],
|
|
1119
|
+
"width": 16,
|
|
1120
|
+
"height": 16
|
|
1121
|
+
},
|
|
1122
|
+
"text_aligned_center": {
|
|
1123
|
+
"paths":[
|
|
1124
|
+
"M0 1.77778V0H16V1.77778H0ZM3.55556 3.55556V5.33333H12.4444V3.55556H3.55556ZM16 8.88889H0V7.11111H16V8.88889ZM3.55556 10.6667V12.4444H12.4444V10.6667H3.55556ZM0 16H16V14.2222H0V16Z"
|
|
1125
|
+
],
|
|
1126
|
+
"width": 16,
|
|
1127
|
+
"height": 16
|
|
1128
|
+
},
|
|
1129
|
+
"text_aligned_left": {
|
|
1130
|
+
"paths":[
|
|
1131
|
+
"M0 1.77778V0H16V1.77778H0ZM10.6667 3.55556H0V5.33333H10.6667V3.55556ZM10.6667 10.6667H0V12.4444H10.6667V10.6667ZM16 8.88889H0V7.11111H16V8.88889ZM0 16H16V14.2222H0V16Z"
|
|
1132
|
+
],
|
|
1133
|
+
"width": 16,
|
|
1134
|
+
"height": 16
|
|
1135
|
+
},
|
|
1136
|
+
"text_position_top": {
|
|
1137
|
+
"paths": ["M0 0H24V16H0V0ZM2 2H22V14H2V2ZM4 5.77778V4H20V5.77778H4Z"],
|
|
1138
|
+
"width": 16,
|
|
1139
|
+
"height": 16
|
|
1140
|
+
},
|
|
1141
|
+
"text_position_center": {
|
|
1142
|
+
"paths": ["M0 0H24V16H0V0ZM2 2H22V14H2V2ZM4 8.77778V7H20V8.77778H4Z"],
|
|
1143
|
+
"width": 16,
|
|
1144
|
+
"height": 16
|
|
1145
|
+
},
|
|
1146
|
+
"text_position_bottom": {
|
|
1147
|
+
"paths": ["M0 0H24V16H0V0ZM2 2H22V14H2V2ZM4 11.7778V10H20V11.7778H4Z"],
|
|
1148
|
+
"width": 16,
|
|
1149
|
+
"height": 16
|
|
1114
1150
|
}
|
|
1115
1151
|
}
|
|
1116
1152
|
}
|
|
@@ -11,7 +11,8 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = [
|
|
|
11
11
|
var _templateObject = _taggedTemplateLiteral(['\n background: transparent;\n font-family: \'SFUIText-Medium\';\n position: relative;\n width: 100%;\n display: block;\n\n > label {\n color: #999999;\n font-size: 14px;\n\n font-family: inherit;\n position: absolute;\n pointer-events: none;\n left: 0px;\n top: 5px;\n transition: 0.2s ease all;\n -moz-transition: 0.2s ease all;\n -webkit-transition: 0.2s ease all;\n }\n > input:focus ~ label {\n top: -10px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n\n > input ~ label.floaton {\n top: -5px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n'], ['\n background: transparent;\n font-family: \'SFUIText-Medium\';\n position: relative;\n width: 100%;\n display: block;\n\n > label {\n color: #999999;\n font-size: 14px;\n\n font-family: inherit;\n position: absolute;\n pointer-events: none;\n left: 0px;\n top: 5px;\n transition: 0.2s ease all;\n -moz-transition: 0.2s ease all;\n -webkit-transition: 0.2s ease all;\n }\n > input:focus ~ label {\n top: -10px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n\n > input ~ label.floaton {\n top: -5px;\n left: 0px;\n font-size: 10px;\n color: #999999;\n text-transform: capitalize;\n }\n']),
|
|
12
12
|
_templateObject2 = _taggedTemplateLiteral(['\n color: ', ';\n padding-top: 5px;\n display: inline-block;\n font-size: 12px;\n font-family: inherit;\n width: 100%;\n text-align: left;\n'], ['\n color: ', ';\n padding-top: 5px;\n display: inline-block;\n font-size: 12px;\n font-family: inherit;\n width: 100%;\n text-align: left;\n']),
|
|
13
13
|
_templateObject3 = _taggedTemplateLiteral(['\n background: none;\n border: none;\n cursor: pointer;\n position: absolute;\n right: 0;\n top: 5px;\n &:focus {\n outline: none;\n }\n'], ['\n background: none;\n border: none;\n cursor: pointer;\n position: absolute;\n right: 0;\n top: 5px;\n &:focus {\n outline: none;\n }\n']),
|
|
14
|
-
_templateObject4 = _taggedTemplateLiteral(['\n
|
|
14
|
+
_templateObject4 = _taggedTemplateLiteral(['\n position: absolute;\n right: 0px;\n top: 0px;\n background-color: #303F51;\n border-radius: 12px;\n font-size: 12px;\n padding: 5px 10px;\n color: #FFFFFF;\n'], ['\n position: absolute;\n right: 0px;\n top: 0px;\n background-color: #303F51;\n border-radius: 12px;\n font-size: 12px;\n padding: 5px 10px;\n color: #FFFFFF;\n']),
|
|
15
|
+
_templateObject5 = _taggedTemplateLiteral(['\n width: 100%;\n box-sizing: border-box;\n\n background: ', ';\n\n border: none;\n border-radius: 0px;\n -webkit-appearance: none;\n border-bottom: 1px solid\n ', ';\n\n font-family: \'SFUIText-Medium\';\n color: ', ';\n\n cursor: ', ';\n\n font-size: 14px;\n padding: 7px 0px 2px;\n margin-top: 15px;\n display: block;\n\n &:hover {\n border-color: ', ';\n }\n &:disabled:hover {\n border-color: ', ';\n }\n &:disabled {\n border-color: ', ';\n color: ', ';\n }\n &:focus {\n outline: none;\n }\n &::placeholder {\n color: ', ';\n\n opacity: ', ';\n transition: 0.2s ease all;\n }\n\n &:focus::placeholder {\n color: ', ';\n\n opacity: ', ';\n }\n'], ['\n width: 100%;\n box-sizing: border-box;\n\n background: ', ';\n\n border: none;\n border-radius: 0px;\n -webkit-appearance: none;\n border-bottom: 1px solid\n ', ';\n\n font-family: \'SFUIText-Medium\';\n color: ', ';\n\n cursor: ', ';\n\n font-size: 14px;\n padding: 7px 0px 2px;\n margin-top: 15px;\n display: block;\n\n &:hover {\n border-color: ', ';\n }\n &:disabled:hover {\n border-color: ', ';\n }\n &:disabled {\n border-color: ', ';\n color: ', ';\n }\n &:focus {\n outline: none;\n }\n &::placeholder {\n color: ', ';\n\n opacity: ', ';\n transition: 0.2s ease all;\n }\n\n &:focus::placeholder {\n color: ', ';\n\n opacity: ', ';\n }\n']);
|
|
15
16
|
|
|
16
17
|
var _react = require('react');
|
|
17
18
|
|
|
@@ -45,10 +46,14 @@ var InputError = _styledComponents2.default.span(_templateObject2, function (pro
|
|
|
45
46
|
|
|
46
47
|
var PasswordToggleButton = _styledComponents2.default.div(_templateObject3);
|
|
47
48
|
|
|
49
|
+
var CountWrappper = _styledComponents2.default.div(_templateObject4);
|
|
50
|
+
|
|
48
51
|
var InputText = function InputText(_ref) {
|
|
49
|
-
var
|
|
52
|
+
var maxlength = _ref.maxlength,
|
|
53
|
+
defaultValue = _ref.defaultValue,
|
|
50
54
|
type = _ref.type,
|
|
51
|
-
|
|
55
|
+
showLengthCount = _ref.showLengthCount,
|
|
56
|
+
props = _objectWithoutProperties(_ref, ['maxlength', 'defaultValue', 'type', 'showLengthCount']);
|
|
52
57
|
|
|
53
58
|
var _useState = (0, _react.useState)(true),
|
|
54
59
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -81,7 +86,7 @@ var InputText = function InputText(_ref) {
|
|
|
81
86
|
return _react2.default.createElement(
|
|
82
87
|
InputTextDiv,
|
|
83
88
|
{ theme: props.theme },
|
|
84
|
-
_react2.default.createElement(InputText.Element, _extends({ type: hidden ? type : 'text', value: props.value, defaultValue: defaultValue }, props)),
|
|
89
|
+
_react2.default.createElement(InputText.Element, _extends({ type: hidden ? type : 'text', value: props.value, defaultValue: defaultValue }, props, { maxLength: maxlength || '' })),
|
|
85
90
|
props.label ? _react2.default.createElement(
|
|
86
91
|
'label',
|
|
87
92
|
{
|
|
@@ -95,6 +100,13 @@ var InputText = function InputText(_ref) {
|
|
|
95
100
|
{ value: props.value, theme: props.theme, error: props.error },
|
|
96
101
|
errorMesssage
|
|
97
102
|
) : '',
|
|
103
|
+
maxlength && showLengthCount && _react2.default.createElement(
|
|
104
|
+
CountWrappper,
|
|
105
|
+
null,
|
|
106
|
+
props.value.length,
|
|
107
|
+
'/',
|
|
108
|
+
maxlength
|
|
109
|
+
),
|
|
98
110
|
type == 'password' || passwordButton ? _react2.default.createElement(
|
|
99
111
|
PasswordToggleButton,
|
|
100
112
|
{
|
|
@@ -120,7 +132,7 @@ var InputText = function InputText(_ref) {
|
|
|
120
132
|
);
|
|
121
133
|
};
|
|
122
134
|
|
|
123
|
-
InputText.Element = _styledComponents2.default.input(
|
|
135
|
+
InputText.Element = _styledComponents2.default.input(_templateObject5, function (props) {
|
|
124
136
|
return _tokens.colors[props.theme].inputCommon.background;
|
|
125
137
|
}, function (props) {
|
|
126
138
|
if (props.error) {
|
|
@@ -182,7 +194,7 @@ InputText.propTypes = {
|
|
|
182
194
|
value: _propTypes2.default.string,
|
|
183
195
|
/** The (HTML) maxlength for the input. */
|
|
184
196
|
maxlength: _propTypes2.default.number,
|
|
185
|
-
|
|
197
|
+
showLengthCount: _propTypes2.default.bool,
|
|
186
198
|
theme: _propTypes2.default.oneOf(['light', 'dark'])
|
|
187
199
|
|
|
188
200
|
/** deprecate error string prop */
|
|
@@ -197,7 +209,8 @@ InputText.defaultProps = {
|
|
|
197
209
|
type: 'text',
|
|
198
210
|
maxlength: 50,
|
|
199
211
|
theme: 'light',
|
|
200
|
-
value: ''
|
|
212
|
+
value: '',
|
|
213
|
+
showLengthCount: false
|
|
201
214
|
};
|
|
202
215
|
|
|
203
216
|
exports.default = InputText;
|
|
@@ -19,9 +19,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
_react2.default.createElement(
|
|
20
20
|
_storyHelpers.Stack,
|
|
21
21
|
null,
|
|
22
|
-
_react2.default.createElement(_components.InputText, { type: 'text', label: 'First Name',
|
|
22
|
+
_react2.default.createElement(_components.InputText, { type: 'text', label: 'First Name', onKeyPress: function onKeyPress(e) {
|
|
23
|
+
return undefined.value = e.target.value;
|
|
24
|
+
}, onChange: function onChange(e) {
|
|
23
25
|
return console.log(e.target.value);
|
|
24
|
-
}, placeholder: 'Enter Name max 10', value: '', required: true }),
|
|
26
|
+
}, placeholder: 'Enter Name max 10', value: 'asd', required: true }),
|
|
25
27
|
_react2.default.createElement(_components.InputText, { type: 'password', label: 'Middle Name', minLength: 3, maxLength: 6, placeholder: 'Show as password', required: true }),
|
|
26
28
|
_react2.default.createElement(_components.InputText, { type: 'text', value: "hello", label: 'Label and default value', required: true })
|
|
27
29
|
),
|
|
@@ -60,7 +62,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
60
62
|
_react2.default.createElement(
|
|
61
63
|
_storyHelpers.Stack,
|
|
62
64
|
null,
|
|
63
|
-
_react2.default.createElement(_components.InputText, { theme: 'dark', type: 'text', label: 'First Name', maxLength: 3, onChange: function onChange(e) {
|
|
65
|
+
_react2.default.createElement(_components.InputText, { theme: 'dark', type: 'text', label: 'First Name', showLengthCount: true, maxLength: 3, onChange: function onChange(e) {
|
|
64
66
|
return console.log(e.target.value);
|
|
65
67
|
}, placeholder: 'Enter Name max 10', required: true }),
|
|
66
68
|
_react2.default.createElement(_components.InputText, { theme: 'dark', type: 'password', label: 'Middle Name', minLength: 3, maxLength: 6, placeholder: 'Show as password', required: true }),
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desynova-digital/components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"description": "Components for Desynova Digital",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "desynova-digital",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": "desynova-digital",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@desynova-digital/tokens": "8.
|
|
10
|
+
"@desynova-digital/tokens": "8.7.0",
|
|
11
11
|
"prop-types": "^15.7.2",
|
|
12
12
|
"styled-components": "^4.3.2"
|
|
13
13
|
},
|