@steroidsjs/bootstrap 3.0.0-beta.3 → 3.0.0-beta.30
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/README.md +1 -2
- package/content/Accordion/AccordionItemView.d.ts +2 -0
- package/content/Accordion/AccordionItemView.js +96 -0
- package/content/Accordion/AccordionItemView.scss +209 -0
- package/content/Accordion/AccordionView.d.ts +2 -0
- package/content/{Collapse/CollapseView.js → Accordion/AccordionView.js} +3 -3
- package/content/{Collapse/CollapseView.scss → Accordion/AccordionView.scss} +3 -4
- package/content/Alert/AlertView.scss +19 -4
- package/content/Avatar/AvatarView.js +2 -3
- package/content/Avatar/AvatarView.scss +29 -36
- package/content/Badge/BadgeView.d.ts +3 -0
- package/content/Badge/BadgeView.js +25 -0
- package/content/Badge/BadgeView.scss +135 -0
- package/content/Calendar/CaptionElement.scss +5 -4
- package/content/Card/CardView.js +34 -14
- package/content/Card/CardView.scss +126 -110
- package/content/Detail/DetailView.scss +75 -52
- package/content/DropDown/DropDownView.js +6 -3
- package/content/DropDown/DropDownView.scss +196 -27
- package/content/Icon/IconView.js +2 -2
- package/form/Button/ButtonView.js +12 -8
- package/form/Button/ButtonView.scss +157 -71
- package/form/CheckboxField/CheckboxFieldView.js +6 -3
- package/form/CheckboxField/CheckboxFieldView.scss +185 -36
- package/form/DropDownField/DropDownFieldView.js +46 -47
- package/form/DropDownField/DropDownFieldView.scss +391 -181
- package/form/DropDownField/views/DropDownItem/DropDownItemView.d.ts +3 -0
- package/form/DropDownField/views/DropDownItem/DropDownItemView.js +80 -0
- package/form/DropDownField/views/DropDownItem/DropDownItemView.scss +217 -0
- package/form/DropDownField/views/DropDownItem/index.d.ts +2 -0
- package/form/DropDownField/views/DropDownItem/index.js +7 -0
- package/form/FieldLayout/FieldLayoutView.js +12 -4
- package/form/FieldLayout/FieldLayoutView.scss +128 -24
- package/form/Form/FormView.js +3 -3
- package/form/Form/FormView.scss +10 -14
- package/form/InputField/InputFieldView.js +32 -13
- package/form/InputField/InputFieldView.scss +245 -99
- package/form/NumberField/NumberFieldView.js +19 -13
- package/form/NumberField/NumberFieldView.scss +195 -89
- package/form/PasswordField/PasswordFieldView.js +11 -9
- package/form/PasswordField/PasswordFieldView.scss +231 -63
- package/form/RadioListField/RadioListFieldView.js +10 -3
- package/form/RadioListField/RadioListFieldView.scss +229 -1
- package/form/TextField/TextFieldView.js +10 -2
- package/form/TextField/TextFieldView.scss +143 -2
- package/icons/index.d.ts +2 -0
- package/{icon/fontawesome.js → icons/index.js} +37 -11
- package/icons/svgs/accordion-chevron.svg +4 -0
- package/icons/svgs/arrow.svg +3 -0
- package/icons/svgs/badge-close.svg +3 -0
- package/icons/svgs/close.svg +4 -0
- package/icons/svgs/crossed-out-eye.svg +5 -0
- package/icons/svgs/default.svg +11 -0
- package/icons/svgs/dots.svg +5 -0
- package/icons/svgs/error.svg +12 -0
- package/icons/svgs/field-close.svg +4 -0
- package/icons/svgs/info.svg +12 -0
- package/icons/svgs/loader.svg +3 -0
- package/icons/svgs/search.svg +4 -0
- package/icons/svgs/success.svg +4 -0
- package/icons/svgs/user.svg +4 -0
- package/icons/svgs/visible-eye.svg +4 -0
- package/icons/svgs/warning.svg +12 -0
- package/index.d.ts +11 -2
- package/index.js +13 -4
- package/index.scss +6 -3
- package/layout/Header/HeaderView.scss +3 -3
- package/layout/Tooltip/TooltipView.js +6 -6
- package/layout/Tooltip/TooltipView.scss +45 -37
- package/list/Grid/GridView.scss +28 -30
- package/nav/Tree/TreeView.scss +9 -10
- package/package.json +56 -56
- package/scss/fonts.scss +6 -0
- package/scss/mixins/button.scss +51 -25
- package/scss/mixins/index.scss +2 -1
- package/scss/mixins/scroll.scss +31 -0
- package/scss/mixins/typography.scss +26 -0
- package/scss/variables/common/colors.scss +87 -67
- package/scss/variables/common/media.scss +2 -0
- package/scss/variables/common/typography.scss +96 -28
- package/scss/variables/components/input.scss +7 -6
- package/scss/variables/index.scss +2 -2
- package/scss/variables/normalize.scss +21 -0
- package/typography/Text/TextView.d.ts +3 -0
- package/typography/Text/TextView.js +46 -0
- package/typography/Text/TextView.scss +16 -0
- package/typography/Title/TitleView.d.ts +3 -0
- package/typography/Title/TitleView.js +50 -0
- package/typography/Title/TitleView.scss +16 -0
- package/content/Collapse/CollapseItemView.d.ts +0 -2
- package/content/Collapse/CollapseItemView.js +0 -65
- package/content/Collapse/CollapseItemView.scss +0 -88
- package/content/Collapse/CollapseView.d.ts +0 -2
- package/content/Icon/IconView.scss +0 -25
- package/icon/fontawesome.d.ts +0 -2
- package/scss/mixins/card.scss +0 -26
- package/scss/variables/components/card.scss +0 -20
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
exports.__esModule = true;
|
|
17
|
+
var react_1 = __importDefault(require("react"));
|
|
18
|
+
var useBem_1 = __importDefault(require("@steroidsjs/core/hooks/useBem"));
|
|
19
|
+
var Icon_1 = __importDefault(require("@steroidsjs/core/ui/content/Icon"));
|
|
20
|
+
var form_1 = require("@steroidsjs/core/ui/form");
|
|
21
|
+
var content_1 = require("@steroidsjs/core/ui/content");
|
|
22
|
+
require("./DropDownItemView.scss");
|
|
23
|
+
var GROUP_CONTENT_TYPE = 'group';
|
|
24
|
+
function DropDownItemView(props) {
|
|
25
|
+
var bem = (0, useBem_1["default"])('DropDownItemView');
|
|
26
|
+
var groupProps = props;
|
|
27
|
+
var commonProps = {
|
|
28
|
+
className: bem.element('option', {
|
|
29
|
+
hover: props.hoveredId === props.item[props.primaryKey],
|
|
30
|
+
select: props.selectedIds.includes(props.item[props.primaryKey]),
|
|
31
|
+
size: props.size
|
|
32
|
+
}),
|
|
33
|
+
onFocus: function () { return props.onItemHover(props.item[props.primaryKey]); },
|
|
34
|
+
onMouseOver: function () { return props.onItemHover(props.item[props.primaryKey]); },
|
|
35
|
+
onClick: function (e) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
props.onItemSelect(props.item[props.primaryKey]);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var renderTypeCases = function (type, src) {
|
|
41
|
+
switch (type) {
|
|
42
|
+
case 'icon':
|
|
43
|
+
return (react_1["default"].createElement("div", __assign({}, commonProps),
|
|
44
|
+
typeof src === 'string' ? (react_1["default"].createElement(Icon_1["default"], { name: src, className: bem.element('icon') })) : (react_1["default"].createElement("span", { className: bem.element('icon') }, src)),
|
|
45
|
+
react_1["default"].createElement("span", null, props.item.label)));
|
|
46
|
+
case 'checkbox':
|
|
47
|
+
return (react_1["default"].createElement("div", __assign({}, commonProps),
|
|
48
|
+
react_1["default"].createElement(form_1.CheckboxField, { label: props.item.label, className: bem.element('checkbox'), size: props.size, inputProps: {
|
|
49
|
+
checked: props.selectedIds.includes(props.item[props.primaryKey])
|
|
50
|
+
} })));
|
|
51
|
+
case 'img':
|
|
52
|
+
return (react_1["default"].createElement("div", __assign({}, commonProps),
|
|
53
|
+
react_1["default"].createElement("span", { className: bem.element('img') },
|
|
54
|
+
react_1["default"].createElement("img", { src: src, alt: "custom source for item" })),
|
|
55
|
+
react_1["default"].createElement("span", null, props.item.label)));
|
|
56
|
+
case 'radio':
|
|
57
|
+
return (react_1["default"].createElement("div", __assign({}, commonProps),
|
|
58
|
+
react_1["default"].createElement(form_1.RadioListField, { items: [props.item], selectedIds: props.selectedIds, className: bem.element('radio', {
|
|
59
|
+
size: props.size
|
|
60
|
+
}), size: props.size })));
|
|
61
|
+
case 'group':
|
|
62
|
+
return (react_1["default"].createElement(content_1.AccordionItem, { childIndex: groupProps.childIndex, isShowMore: groupProps.isShowMore, toggleAccordion: groupProps.toggleAccordion, toggleCollapse: groupProps.toggleCollapse, title: props.item.label, position: "middle", className: bem.element('group', {
|
|
63
|
+
size: props.size
|
|
64
|
+
}) }, props.item[props.groupAttribute].map(function (subItem, itemIndex) { return (react_1["default"].createElement(DropDownItemView, __assign({}, props, { key: itemIndex, item: subItem }))); })));
|
|
65
|
+
default:
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
if (props.groupAttribute && Array.isArray(props.item[props.groupAttribute])) {
|
|
70
|
+
return renderTypeCases(GROUP_CONTENT_TYPE, props.item[props.groupAttribute]);
|
|
71
|
+
}
|
|
72
|
+
if (props.item.contentType) {
|
|
73
|
+
return renderTypeCases(props.item.contentType, props.item.contentSrc);
|
|
74
|
+
}
|
|
75
|
+
if (props.itemsContent) {
|
|
76
|
+
return renderTypeCases(props.itemsContent.type, props.itemsContent.src);
|
|
77
|
+
}
|
|
78
|
+
return (react_1["default"].createElement("div", __assign({}, commonProps), props.item.label));
|
|
79
|
+
}
|
|
80
|
+
exports["default"] = DropDownItemView;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
@import "style/variables";
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--drop-down-item-hover-background-color: #f5f8fa;
|
|
5
|
+
--drop-down-item-select-background-color: #eef1f2;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
html[data-theme="dark"] {
|
|
9
|
+
--drop-down-item-select-background-color: #5b5c6b;
|
|
10
|
+
--drop-down-item-hover-background-color: #4e4f57;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
$drop-down-item-select-background-color: var(--drop-down-item-select-background-color);
|
|
14
|
+
$drop-down-item-hover-background-color: var(--drop-down-item-hover-background-color);
|
|
15
|
+
|
|
16
|
+
@mixin statements {
|
|
17
|
+
&_select {
|
|
18
|
+
background-color: $drop-down-item-select-background-color;
|
|
19
|
+
}
|
|
20
|
+
&_hover {
|
|
21
|
+
background-color: $drop-down-item-hover-background-color;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
%fontProperties {
|
|
26
|
+
font-size: $font-size-base;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
line-height: 22px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.DropDownItemView {
|
|
32
|
+
$root: &;
|
|
33
|
+
|
|
34
|
+
&__icon {
|
|
35
|
+
display: inline-block;
|
|
36
|
+
width: 24px;
|
|
37
|
+
height: 24px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__option {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-flow: row wrap;
|
|
43
|
+
position: relative;
|
|
44
|
+
column-gap: 12px;
|
|
45
|
+
align-items: center;
|
|
46
|
+
background-color: $element-background-color;
|
|
47
|
+
color: $text-color;
|
|
48
|
+
|
|
49
|
+
&_size {
|
|
50
|
+
&_lg {
|
|
51
|
+
padding: 16px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&_md {
|
|
55
|
+
padding: 12px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&_sm {
|
|
59
|
+
padding: 8px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include statements;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&__checkbox {
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 24px;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
|
|
71
|
+
label {
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&__img {
|
|
77
|
+
width: 24px;
|
|
78
|
+
height: 24px;
|
|
79
|
+
border-radius: $radius-small;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
|
|
82
|
+
img {
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: 100%;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&__radio {
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
width: 100%;
|
|
91
|
+
|
|
92
|
+
div {
|
|
93
|
+
width: 100%;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
label {
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
label::before {
|
|
101
|
+
position: absolute;
|
|
102
|
+
right: 0;
|
|
103
|
+
margin-right: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
label::after {
|
|
107
|
+
position: absolute;
|
|
108
|
+
right: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.RadioListFieldView__ellipse {
|
|
112
|
+
left: auto;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&_size {
|
|
116
|
+
&_lg {
|
|
117
|
+
span {
|
|
118
|
+
right: 6px;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&_md {
|
|
123
|
+
span {
|
|
124
|
+
right: 5px;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&_sm {
|
|
129
|
+
span {
|
|
130
|
+
right: 4px;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&__group {
|
|
137
|
+
width: auto;
|
|
138
|
+
border-radius: none;
|
|
139
|
+
|
|
140
|
+
.AccordionItemView {
|
|
141
|
+
&__content {
|
|
142
|
+
padding: 0;
|
|
143
|
+
border: none;
|
|
144
|
+
|
|
145
|
+
&_visible {
|
|
146
|
+
border-bottom: 1px solid $border-color;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&__header-container {
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-flow: row nowrap;
|
|
153
|
+
justify-content: space-between;
|
|
154
|
+
align-items: center;
|
|
155
|
+
|
|
156
|
+
border: none;
|
|
157
|
+
background-color: $element-background-color;
|
|
158
|
+
|
|
159
|
+
&:hover {
|
|
160
|
+
background-color: $drop-down-item-hover-background-color;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&__title-container {
|
|
165
|
+
padding: inherit;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&__icon-wrapper {
|
|
169
|
+
position: static;
|
|
170
|
+
margin-right: 12px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&__icon-chevron {
|
|
174
|
+
box-shadow: none;
|
|
175
|
+
svg {
|
|
176
|
+
border: 1px solid $border-color;
|
|
177
|
+
border-radius: $radius-small;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&_size {
|
|
183
|
+
&_lg {
|
|
184
|
+
font-size: $font-size-lg;
|
|
185
|
+
line-height: 24px;
|
|
186
|
+
|
|
187
|
+
.AccordionItemView__title-container {
|
|
188
|
+
font-size: inherit;
|
|
189
|
+
line-height: inherit;
|
|
190
|
+
padding: 16px;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&_md {
|
|
195
|
+
font-size: $font-size-base;
|
|
196
|
+
line-height: 22px;
|
|
197
|
+
|
|
198
|
+
.AccordionItemView__title-container {
|
|
199
|
+
font-size: inherit;
|
|
200
|
+
line-height: inherit;
|
|
201
|
+
padding: 12px;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&_sm {
|
|
206
|
+
font-size: $font-size-sm;
|
|
207
|
+
line-height: 18px;
|
|
208
|
+
|
|
209
|
+
.AccordionItemView__title-container {
|
|
210
|
+
font-size: inherit;
|
|
211
|
+
line-height: inherit;
|
|
212
|
+
padding: 8px;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
var DropDownItemView_1 = __importDefault(require("./DropDownItemView"));
|
|
7
|
+
exports["default"] = DropDownItemView_1["default"];
|
|
@@ -29,17 +29,25 @@ exports.__esModule = true;
|
|
|
29
29
|
var React = __importStar(require("react"));
|
|
30
30
|
var isEmpty_1 = __importDefault(require("lodash-es/isEmpty"));
|
|
31
31
|
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
32
|
+
var Icon_1 = __importDefault(require("@steroidsjs/core/ui/content/Icon"));
|
|
32
33
|
function FieldLayoutView(props) {
|
|
33
34
|
var bem = (0, hooks_1.useBem)('FieldLayoutView');
|
|
34
35
|
return (React.createElement("div", { className: bem(bem.block({
|
|
35
36
|
layout: props.layout.layout
|
|
36
37
|
}), 'form-group', props.layout.className, props.layout.layout === 'horizontal' && 'row', props.layout.layout === 'inline' && 'form-inline mb-0'), style: props.layout.style },
|
|
37
|
-
props.label && (React.createElement("
|
|
38
|
-
required: props.required
|
|
38
|
+
props.label && (React.createElement("label", { htmlFor: props.id, className: bem(bem.element('label', {
|
|
39
|
+
required: props.required,
|
|
40
|
+
size: props.size
|
|
39
41
|
}), props.layout.layout === 'horizontal' && 'col-form-label text-right', props.layout.layout === 'horizontal' && 'col-' + props.layout.cols[0], props.layout.layout === 'inline' && 'sr-only') }, props.label + ':')),
|
|
40
42
|
React.createElement("div", { className: bem(bem.element('field'), props.layout.layout === 'horizontal' && 'col-' + props.layout.cols[1], props.layout.layout === 'horizontal' && !props.label && 'offset-' + props.layout.cols[0], props.layout.layout === 'inline' && 'w-100') },
|
|
41
43
|
props.children,
|
|
42
|
-
!(0, isEmpty_1["default"])(props.errors) && (React.createElement("div", { className: bem(bem.element('invalid-feedback'), 'invalid-feedback') }, [].concat(props.errors).filter(function (error) { return typeof error === 'string'; }).map(function (error, index) { return (React.createElement("div", { key: index
|
|
43
|
-
|
|
44
|
+
!(0, isEmpty_1["default"])(props.errors) && (React.createElement("div", { className: bem(bem.element('invalid-feedback'), 'invalid-feedback') }, [].concat(props.errors).filter(function (error) { return typeof error === 'string'; }).map(function (error, index) { return (React.createElement("div", { key: index, className: bem.element('error-message') },
|
|
45
|
+
React.createElement(Icon_1["default"], { name: "error", className: bem.element('icon_error'), tabIndex: -1 }),
|
|
46
|
+
React.createElement("span", { className: bem.element('error-text', {
|
|
47
|
+
size: !!props.size || 'md'
|
|
48
|
+
}) }, error))); }))),
|
|
49
|
+
(0, isEmpty_1["default"])(props.errors) && props.layout.layout !== 'inline' && props.hint && (React.createElement("div", { className: bem(bem.element('hint', {
|
|
50
|
+
size: props.size
|
|
51
|
+
})) }, props.hint)))));
|
|
44
52
|
}
|
|
45
53
|
exports["default"] = FieldLayoutView;
|
|
@@ -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
|
}
|
package/form/Form/FormView.js
CHANGED
|
@@ -59,9 +59,9 @@ function FormView(props) {
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
return (React.createElement("form", { ref: formRef, className: bem(bem.block({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}), props.className
|
|
62
|
+
inline: props.layout.layout === 'inline',
|
|
63
|
+
vertical: props.layout.layout === 'vertical'
|
|
64
|
+
}), props.className), onSubmit: props.onSubmit, style: props.style },
|
|
65
65
|
props.children,
|
|
66
66
|
(props.fields || []).map(function (field, index) { return (React.createElement(Field_1["default"], __assign({ key: index }, ((0, isString_1["default"])(field) ? { attribute: field } : field)))); }),
|
|
67
67
|
props.submitLabel && (React.createElement(Button_1["default"], { type: 'submit', label: props.submitLabel }))));
|
package/form/Form/FormView.scss
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
.FormView {
|
|
2
|
-
&_border {
|
|
3
|
-
padding: 20px;
|
|
4
|
-
border: 1px solid $border-default;
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
box-shadow: $shadow-default;
|
|
7
|
-
border-radius: 0.5rem;
|
|
8
|
-
}
|
|
9
|
-
&_inline {
|
|
10
2
|
display: flex;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
flex-flow: column nowrap;
|
|
4
|
+
|
|
5
|
+
&_inline {
|
|
6
|
+
column-gap: 12px;
|
|
7
|
+
flex-flow: row nowrap;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&_vertical {
|
|
11
|
+
row-gap: 24px;
|
|
12
|
+
}
|
|
17
13
|
}
|
|
@@ -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, id: props.id })))
|
|
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, id: props.id }))),
|
|
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
|
}
|