@steroidsjs/bootstrap 3.0.0-beta.25 → 3.0.0-beta.27
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.
- package/content/Accordion/AccordionItemView.js +1 -1
- package/content/Accordion/AccordionItemView.scss +11 -2
- package/content/Accordion/AccordionView.scss +2 -2
- package/content/Alert/AlertView.scss +13 -4
- package/content/Avatar/AvatarView.scss +0 -1
- package/content/Badge/BadgeView.scss +19 -1
- package/content/Calendar/CaptionElement.scss +4 -5
- package/content/Detail/DetailView.scss +74 -52
- package/content/Icon/IconView.js +2 -2
- package/form/Button/ButtonView.js +5 -2
- package/form/Button/ButtonView.scss +41 -3
- package/form/CheckboxField/CheckboxFieldView.scss +10 -11
- package/form/FieldLayout/FieldLayoutView.js +11 -3
- package/form/FieldLayout/FieldLayoutView.scss +128 -24
- package/form/InputField/InputFieldView.js +32 -13
- package/form/InputField/InputFieldView.scss +270 -98
- package/form/NumberField/NumberFieldView.js +19 -13
- package/form/NumberField/NumberFieldView.scss +213 -88
- package/form/RadioListField/RadioListFieldView.js +7 -3
- package/form/RadioListField/RadioListFieldView.scss +133 -1
- package/form/TextField/TextFieldView.js +10 -2
- package/form/TextField/TextFieldView.scss +145 -2
- package/icons/index.d.ts +1 -1
- package/icons/index.js +16 -2
- package/icons/svgs/arrow.svg +3 -0
- package/icons/svgs/field-close.svg +4 -0
- package/icons/svgs/user.svg +4 -0
- package/package.json +4 -3
- package/scss/mixins/button.scss +8 -8
- package/scss/variables/common/colors.scss +41 -38
- package/scss/variables/components/input.scss +1 -1
- package/scss/variables/index.scss +1 -0
- package/scss/variables/normalize.scss +21 -0
|
@@ -1,26 +1,130 @@
|
|
|
1
1
|
.FieldLayoutView {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
$root: &;
|
|
3
|
+
font-family: $font-family-nunito;
|
|
4
|
+
|
|
5
|
+
&__label {
|
|
6
|
+
font-size: $font-size-sm;
|
|
7
|
+
line-height: 24px;
|
|
8
|
+
font-weight: $font-weight-sm;
|
|
9
|
+
color: $text-color;
|
|
10
|
+
margin-bottom: 8px;
|
|
11
|
+
|
|
12
|
+
&_size {
|
|
13
|
+
&_sm {
|
|
14
|
+
font-size: $font-size-sm;
|
|
15
|
+
}
|
|
16
|
+
&_md {
|
|
17
|
+
font-size: $font-size-base;
|
|
18
|
+
}
|
|
19
|
+
&_lg {
|
|
20
|
+
font-size: $font-size-lg;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&_required:after {
|
|
25
|
+
display: inline-block;
|
|
26
|
+
content: "*";
|
|
27
|
+
color: $danger;
|
|
28
|
+
margin: 0 0 0 3px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__invalid-feedback {
|
|
33
|
+
display: block !important;
|
|
34
|
+
margin-top: 4.83px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__error-message {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-flow: row nowrap;
|
|
40
|
+
align-items: center;
|
|
41
|
+
|
|
42
|
+
column-gap: 4px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__hint {
|
|
46
|
+
width: 100%;
|
|
47
|
+
margin-top: 4px;
|
|
48
|
+
font-size: 80%;
|
|
49
|
+
|
|
50
|
+
color: $text-color;
|
|
51
|
+
font-size: $font-size-sm;
|
|
52
|
+
line-height: 16px;
|
|
53
|
+
font-weight: $font-weight-sm;
|
|
54
|
+
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
column-gap: 4px;
|
|
58
|
+
|
|
59
|
+
&_size {
|
|
60
|
+
&_lg {
|
|
61
|
+
font-size: $font-size-base;
|
|
62
|
+
line-height: 22px;
|
|
63
|
+
font-weight: $font-weight-sm;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&_md {
|
|
67
|
+
font-size: $font-size-sm;
|
|
68
|
+
line-height: 18px;
|
|
69
|
+
font-weight: $font-weight-sm;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&_sm {
|
|
73
|
+
font-size: $font-size-xs;
|
|
74
|
+
line-height: 16px;
|
|
75
|
+
font-weight: $font-weight-sm;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@mixin svgSize() {
|
|
81
|
+
svg {
|
|
82
|
+
width: 16px;
|
|
83
|
+
height: 16px;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&__icon_error {
|
|
88
|
+
width: 16px;
|
|
89
|
+
height: 16px;
|
|
90
|
+
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
align-items: center;
|
|
94
|
+
@include svgSize;
|
|
95
|
+
|
|
96
|
+
svg rect {
|
|
97
|
+
color: $danger;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__error-text {
|
|
102
|
+
color: $danger;
|
|
103
|
+
&_size {
|
|
104
|
+
&_lg {
|
|
105
|
+
font-size: $font-size-base;
|
|
106
|
+
line-height: 22px;
|
|
107
|
+
font-weight: $font-weight-sm;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&_md {
|
|
111
|
+
font-size: $font-size-sm;
|
|
112
|
+
line-height: 18px;
|
|
113
|
+
font-weight: $font-weight-sm;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&_sm {
|
|
117
|
+
font-size: $font-size-xs;
|
|
118
|
+
line-height: 16px;
|
|
119
|
+
font-weight: $font-weight-sm;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&_layout_inline &__field {
|
|
125
|
+
.form-control,
|
|
126
|
+
input {
|
|
127
|
+
width: 100%;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
26
130
|
}
|
|
@@ -33,28 +33,47 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
33
33
|
__setModuleDefault(result, mod);
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
exports.__esModule = true;
|
|
37
40
|
var React = __importStar(require("react"));
|
|
38
41
|
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
42
|
+
var Icon_1 = __importDefault(require("@steroidsjs/core/ui/content/Icon"));
|
|
39
43
|
function InputFieldView(props) {
|
|
40
44
|
var bem = (0, hooks_1.useBem)('InputFieldView');
|
|
45
|
+
var renderLeadIcon = React.useCallback(function () {
|
|
46
|
+
var className = bem.element('lead-icon');
|
|
47
|
+
return typeof props.leadIcon === 'string'
|
|
48
|
+
? (React.createElement(Icon_1["default"], { name: props.leadIcon, className: className, tabIndex: -1 }))
|
|
49
|
+
: React.createElement("span", { className: className }, props.leadIcon);
|
|
50
|
+
}, [bem, props.leadIcon]);
|
|
41
51
|
return (React.createElement("div", { className: bem(bem.block({
|
|
42
52
|
disabled: props.inputProps.disabled,
|
|
43
|
-
size: props.size
|
|
44
|
-
|
|
53
|
+
size: props.size,
|
|
54
|
+
hasError: !!props.errors,
|
|
55
|
+
hasLeadIcon: !!props.leadIcon,
|
|
56
|
+
hasClearIcon: props.showClear && !props.disabled,
|
|
57
|
+
filled: !!props.inputProps.value,
|
|
58
|
+
hasAddonAfter: !!props.addonAfter,
|
|
59
|
+
hasAddonBefore: !!props.addonBefore,
|
|
60
|
+
hasAddon: !!props.addonAfter || !!props.addonBefore,
|
|
61
|
+
hasTextAddon: !!props.textAfter || !!props.textBefore,
|
|
62
|
+
hasTextAddonBefore: !!props.textBefore,
|
|
63
|
+
hasTextAddonAfter: !!props.textAfter
|
|
64
|
+
}), props.className), style: props.style },
|
|
45
65
|
props.addonBefore && (React.createElement("span", { className: bem.element('addon-before') }, props.addonBefore)),
|
|
46
66
|
props.textBefore && (React.createElement("span", { className: bem.element('text-before') }, props.textBefore)),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}), !!props.errors && 'is-invalid') }, props.inputProps, { onChange: function (e) { return props.input.onChange(e.target.value); }, type: props.type, placeholder: props.placeholder, disabled: props.disabled, required: props.required }))),
|
|
67
|
+
React.createElement("div", { className: bem.element('input-wrapper') },
|
|
68
|
+
props.leadIcon && renderLeadIcon(),
|
|
69
|
+
props.maskProps
|
|
70
|
+
? (React.createElement("input", __assign({ onBlur: props.onBlur, onFocus: props.onFocus, onMouseDown: props.onMouseDown, className: bem(bem.element('input', {
|
|
71
|
+
size: props.size
|
|
72
|
+
})) }, props.inputProps, { type: props.type, placeholder: props.placeholder, disabled: props.disabled, required: props.required })))
|
|
73
|
+
: (React.createElement("input", __assign({ className: bem(bem.element('input', {
|
|
74
|
+
size: props.size
|
|
75
|
+
})) }, props.inputProps, { onChange: function (e) { return props.input.onChange(e.target.value); }, type: props.type, placeholder: props.placeholder, disabled: props.disabled, required: props.required }))),
|
|
76
|
+
!props.disabled && props.showClear && !props.maskProps && (React.createElement(Icon_1["default"], { name: "field-close", className: bem.element('icon-clear'), tabIndex: -1, onClick: props.onClear }))),
|
|
58
77
|
props.textAfter && (React.createElement("span", { className: bem.element('text-after') }, props.textAfter)),
|
|
59
78
|
props.addonAfter && (React.createElement("span", { className: bem.element('addon-after') }, props.addonAfter))));
|
|
60
79
|
}
|
|
@@ -1,135 +1,307 @@
|
|
|
1
|
-
|
|
1
|
+
:root {
|
|
2
|
+
--lead-icon-default-color: #e5e9eb;
|
|
3
|
+
--lead-icon-focus-color: #323232;
|
|
4
|
+
--lead-icon-disabled-color: rgba(0, 0, 0, 0.1);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
html[data-theme="dark"] {
|
|
8
|
+
--lead-icon-default-color: #5b5c6b;
|
|
9
|
+
--lead-icon-focus-color: #ffffff;
|
|
10
|
+
--lead-icon-disabled-color: rgba(255, 255, 255, 0.1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
$lead-icon-default-color: var(--lead-icon-default-color);
|
|
14
|
+
$lead-icon-focus-color: var(--lead-icon-focus-color);
|
|
15
|
+
$lead-icon-disabled-color: var(--lead-icon-disabled-color);
|
|
2
16
|
|
|
3
17
|
.InputFieldView {
|
|
4
|
-
|
|
18
|
+
$root: &;
|
|
5
19
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
border-radius: $input-border-radius;
|
|
20
|
+
position: relative;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-flow: row nowrap;
|
|
23
|
+
align-items: center;
|
|
11
24
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
width: 240px;
|
|
26
|
+
height: 34px;
|
|
27
|
+
|
|
28
|
+
color: $text-color;
|
|
29
|
+
font-family: $font-family-nunito;
|
|
30
|
+
font-weight: $font-weight-sm;
|
|
31
|
+
line-height: 24px;
|
|
32
|
+
|
|
33
|
+
&__input-wrapper {
|
|
34
|
+
position: relative;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
18
37
|
}
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
|
|
39
|
+
&__input {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
|
|
43
|
+
padding: 0 8px;
|
|
44
|
+
outline: none;
|
|
45
|
+
|
|
46
|
+
background-color: $element-background-color;
|
|
47
|
+
border: 1px solid $border-color;
|
|
48
|
+
border-radius: inherit;
|
|
49
|
+
|
|
50
|
+
&::placeholder {
|
|
51
|
+
color: $placeholder-color;
|
|
52
|
+
font-size: inherit;
|
|
53
|
+
}
|
|
21
54
|
}
|
|
22
|
-
}
|
|
23
55
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
56
|
+
|
|
57
|
+
//Statements
|
|
58
|
+
&::before {
|
|
59
|
+
content: '';
|
|
60
|
+
position: absolute;
|
|
61
|
+
z-index: 2;
|
|
62
|
+
top: 0;
|
|
63
|
+
left: 0;
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 100%;
|
|
29
66
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
opacity: 0;
|
|
69
|
+
transition: opacity 150ms ease-in-out;
|
|
70
|
+
}
|
|
34
71
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
72
|
+
&:not(#{$root}_disabled):focus-within::before {
|
|
73
|
+
border: 4px solid $primary-light;
|
|
74
|
+
transform: translateX(-4px) translateY(-4px);
|
|
75
|
+
border-radius: 16px;
|
|
76
|
+
opacity: 1;
|
|
77
|
+
}
|
|
39
78
|
|
|
40
|
-
|
|
41
|
-
|
|
79
|
+
&:not(#{$root}_disabled):active {
|
|
80
|
+
#{$root}__input {
|
|
81
|
+
border-color: transparent;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&::before {
|
|
85
|
+
transform: none;
|
|
86
|
+
border: 1px solid $primary;
|
|
87
|
+
opacity: 1;
|
|
88
|
+
}
|
|
42
89
|
}
|
|
43
90
|
|
|
44
|
-
|
|
45
|
-
|
|
91
|
+
&_disabled {
|
|
92
|
+
#{$root}__input {
|
|
93
|
+
background-color: $background-disabled-color;
|
|
94
|
+
border-color: transparent;
|
|
95
|
+
}
|
|
46
96
|
}
|
|
47
|
-
}
|
|
48
97
|
|
|
49
|
-
|
|
98
|
+
&_hasError {
|
|
99
|
+
#{$root}__input {
|
|
100
|
+
border-color: transparent;
|
|
101
|
+
}
|
|
50
102
|
|
|
51
|
-
}
|
|
52
103
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
104
|
+
&::before {
|
|
105
|
+
border: 1px solid $danger;
|
|
106
|
+
border-radius: 16px;
|
|
107
|
+
transform: translateX(-1px) translateY(-1px);
|
|
108
|
+
opacity: 1;
|
|
109
|
+
}
|
|
58
110
|
}
|
|
59
|
-
}
|
|
60
111
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
112
|
+
//Sizes
|
|
113
|
+
&_size {
|
|
114
|
+
&_lg {
|
|
115
|
+
height: $input-height-lg;
|
|
116
|
+
border-radius: $radius-large;
|
|
117
|
+
|
|
118
|
+
#{$root}__input {
|
|
119
|
+
font-size: $font-size-lg;
|
|
120
|
+
border-radius: $radius-large;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#{$root}__addon-before,
|
|
124
|
+
#{$root}__addon-after {
|
|
125
|
+
padding: 16px;
|
|
126
|
+
}
|
|
127
|
+
#{$root}__text-before,
|
|
128
|
+
#{$root}__text-after {
|
|
129
|
+
padding: 16px 3px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&::before {
|
|
133
|
+
border-radius: $radius-large;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&_md {
|
|
138
|
+
height: $input-height-md;
|
|
139
|
+
border-radius: $radius-large;
|
|
140
|
+
|
|
141
|
+
#{$root}__input {
|
|
142
|
+
border-radius: $radius-large;
|
|
143
|
+
font-size: $font-size-base;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#{$root}__addon-before,
|
|
147
|
+
#{$root}__addon-after,
|
|
148
|
+
#{$root}__text-before,
|
|
149
|
+
#{$root}__text-after {
|
|
150
|
+
padding: 11px 12px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
#{$root}__text-before,
|
|
154
|
+
#{$root}__text-after {
|
|
155
|
+
padding: 11px 3px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&::before {
|
|
159
|
+
border-radius: $radius-large;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&_sm {
|
|
164
|
+
height: $input-height-sm;
|
|
165
|
+
border-radius: $radius-small;
|
|
166
|
+
|
|
167
|
+
#{$root}__input {
|
|
168
|
+
font-size: $font-size-sm;
|
|
169
|
+
border-radius: $radius-small;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
#{$root}__addon-before,
|
|
173
|
+
#{$root}__addon-after {
|
|
174
|
+
padding: 5px 8px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#{$root}__text-before,
|
|
178
|
+
#{$root}__text-after {
|
|
179
|
+
padding: 5px 3px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&::before {
|
|
183
|
+
border-radius: $radius-small;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
66
186
|
}
|
|
67
|
-
}
|
|
68
187
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
color: $heading;
|
|
76
|
-
padding: $input-padding-y $input-padding-x;
|
|
77
|
-
border-radius: $input-border-radius;
|
|
188
|
+
//LEAD ICON
|
|
189
|
+
&_hasLeadIcon {
|
|
190
|
+
#{$root}__input {
|
|
191
|
+
padding-left: 40px;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
78
194
|
|
|
79
|
-
&
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
195
|
+
&__lead-icon {
|
|
196
|
+
width: 24px;
|
|
197
|
+
height: 24px;
|
|
198
|
+
position: absolute;
|
|
199
|
+
top: 50%;
|
|
200
|
+
left: 8px;
|
|
201
|
+
transform: translateY(-50%);
|
|
202
|
+
pointer-events: none;
|
|
203
|
+
outline: none;
|
|
83
204
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
205
|
+
svg circle,
|
|
206
|
+
path {
|
|
207
|
+
transition: stroke 150ms ease-in-out;
|
|
208
|
+
stroke: $lead-icon-default-color;
|
|
209
|
+
}
|
|
87
210
|
}
|
|
88
211
|
|
|
89
|
-
|
|
90
|
-
|
|
212
|
+
//CLEAR ICON
|
|
213
|
+
&_hasClearIcon {
|
|
214
|
+
#{$root}__input {
|
|
215
|
+
padding-right: 40px;
|
|
216
|
+
}
|
|
91
217
|
}
|
|
92
218
|
|
|
93
|
-
|
|
94
|
-
|
|
219
|
+
&__icon-clear {
|
|
220
|
+
width: 24px;
|
|
221
|
+
height: 24px;
|
|
222
|
+
position: absolute;
|
|
223
|
+
top: 50%;
|
|
224
|
+
right: 8px;
|
|
225
|
+
transform: translateY(-50%);
|
|
226
|
+
|
|
227
|
+
opacity: 0;
|
|
228
|
+
transition: opacity 150ms ease-in-out;
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
|
|
231
|
+
&:focus {
|
|
232
|
+
opacity: 1;
|
|
233
|
+
pointer-events: all;
|
|
234
|
+
}
|
|
95
235
|
}
|
|
96
|
-
|
|
97
|
-
|
|
236
|
+
|
|
237
|
+
&_filled {
|
|
238
|
+
#{$root}__icon-clear {
|
|
239
|
+
opacity: 1;
|
|
240
|
+
pointer-events: all;
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
#{$root}__lead-icon {
|
|
245
|
+
svg circle,
|
|
246
|
+
path {
|
|
247
|
+
stroke: $lead-icon-focus-color;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
98
250
|
}
|
|
99
|
-
}
|
|
100
251
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
252
|
+
//Addons
|
|
253
|
+
&_hasAddon,
|
|
254
|
+
&_hasTextAddon {
|
|
255
|
+
width: fit-content;
|
|
105
256
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
257
|
+
#{$root}__input-wrapper {
|
|
258
|
+
width: auto;
|
|
259
|
+
}
|
|
110
260
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
261
|
+
#{$root}__input {
|
|
262
|
+
&_size {
|
|
263
|
+
&_lg {
|
|
264
|
+
width: 206px;
|
|
265
|
+
}
|
|
115
266
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
267
|
+
&_md {
|
|
268
|
+
width: 200px;
|
|
269
|
+
}
|
|
120
270
|
|
|
271
|
+
&_sm {
|
|
272
|
+
width: 192px;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
121
277
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
278
|
+
&_hasAddonBefore {
|
|
279
|
+
#{$root}__input {
|
|
280
|
+
border-top-left-radius: 0;
|
|
281
|
+
border-bottom-left-radius: 0;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
126
284
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
285
|
+
&_hasAddonAfter {
|
|
286
|
+
#{$root}__input {
|
|
287
|
+
border-top-right-radius: 0;
|
|
288
|
+
border-bottom-right-radius: 0;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
130
291
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
292
|
+
&__addon-before,
|
|
293
|
+
&__addon-after {
|
|
294
|
+
padding: 11px 12px;
|
|
295
|
+
background-color: $background-disabled-color;
|
|
296
|
+
}
|
|
134
297
|
|
|
135
|
-
|
|
298
|
+
&__addon-before {
|
|
299
|
+
border-top-left-radius: inherit;
|
|
300
|
+
border-bottom-left-radius: inherit;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
&__addon-after {
|
|
304
|
+
border-top-right-radius: inherit;
|
|
305
|
+
border-bottom-right-radius: inherit;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
@@ -33,38 +33,44 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
33
33
|
__setModuleDefault(result, mod);
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
exports.__esModule = true;
|
|
37
40
|
var React = __importStar(require("react"));
|
|
38
41
|
var react_1 = require("react");
|
|
42
|
+
var isNumber_1 = __importDefault(require("lodash-es/isNumber"));
|
|
39
43
|
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
44
|
+
var Icon_1 = __importDefault(require("@steroidsjs/core/ui/content/Icon"));
|
|
40
45
|
function NumberFieldView(props) {
|
|
46
|
+
var _a;
|
|
41
47
|
// Input ref
|
|
42
48
|
var inputRef = (0, react_1.useRef)(null);
|
|
43
49
|
var onStepUp = (0, react_1.useCallback)(function () {
|
|
44
50
|
inputRef.current.stepUp();
|
|
45
51
|
props.inputProps.onChange(inputRef.current.value);
|
|
46
|
-
}, [
|
|
52
|
+
}, [props.inputProps]);
|
|
47
53
|
var onStepDown = (0, react_1.useCallback)(function () {
|
|
48
54
|
inputRef.current.stepDown();
|
|
49
55
|
props.inputProps.onChange(inputRef.current.value);
|
|
50
|
-
}, [
|
|
56
|
+
}, [props.inputProps]);
|
|
51
57
|
var bem = (0, hooks_1.useBem)('NumberFieldView');
|
|
52
58
|
return (React.createElement("div", { className: bem(bem.block({
|
|
53
|
-
disabled: props.inputProps.disabled
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
disabled: props.inputProps.disabled,
|
|
60
|
+
size: props.size,
|
|
61
|
+
hasErrors: !!props.errors,
|
|
62
|
+
filled: !!((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value)
|
|
63
|
+
}), props.className) },
|
|
64
|
+
React.createElement("input", __assign({ ref: inputRef, className: bem(bem.element('input')) }, props.inputProps, { onChange: function (e) { return props.input.onChange(e.target.value); } })),
|
|
58
65
|
!props.disabled && !props.errors && (React.createElement("div", { className: bem.element('arrows-container') },
|
|
59
66
|
React.createElement("button", { className: bem.element('arrow', {
|
|
60
|
-
disabled: props.inputProps.max && props.inputProps.value >= props.inputProps.max
|
|
67
|
+
disabled: (0, isNumber_1["default"])(props.inputProps.max) && props.inputProps.value >= props.inputProps.max
|
|
61
68
|
}), type: 'button', onClick: onStepUp },
|
|
62
|
-
React.createElement("
|
|
63
|
-
React.createElement("path", { d: 'M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140\n 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1\n 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z' }))),
|
|
69
|
+
React.createElement(Icon_1["default"], { name: 'arrow' })),
|
|
64
70
|
React.createElement("button", { className: bem.element('arrow', {
|
|
65
|
-
disabled: props.inputProps.min && props.inputProps.value <= props.inputProps.min
|
|
71
|
+
disabled: (0, isNumber_1["default"])(props.inputProps.min) && props.inputProps.value <= props.inputProps.min
|
|
66
72
|
}), type: 'button', onClick: onStepDown },
|
|
67
|
-
React.createElement("
|
|
68
|
-
|
|
73
|
+
React.createElement(Icon_1["default"], { name: 'arrow' })))),
|
|
74
|
+
React.createElement("span", { className: bem.element('input-effects') })));
|
|
69
75
|
}
|
|
70
76
|
exports["default"] = NumberFieldView;
|