benivo-ui-library 1.2.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.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # benivo-ui-library
2
+
3
+ [![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger)
4
+
5
+ `benivo-ui-library` is a collection of react hooks and components for faster development.
6
+
7
+ # Installation
8
+
9
+ ```sh
10
+ $npm install benivo-ui-library --save
11
+ ```
12
+ # Basic usage
13
+
14
+ ```js
15
+ import React from 'react';
16
+ import { Input, Select, Checkbox, Button } from 'benivo-ui-library';
17
+ import { useInput, useSelect, useCheckbox } from 'benivo-ui-library';
18
+ import { withTransition } from 'benivo-ui-library';
19
+
20
+ function MyApp() {
21
+ const email = useInput('initialvalue@gmail.com');
22
+ const agree = useCheckbox(false);
23
+ const event= useSelect('all');
24
+ const eventOptions=['all', 'news', 'promotional'];
25
+ const handleSubmit=()=>{
26
+ //some smart code here
27
+ };
28
+
29
+ return (
30
+ <form>
31
+ <Input label="Email" {...email.bind} />
32
+ <Select label="Events" options={eventOptions} {...event.bind}/>
33
+ <Checkbox label="I agree" {...agree.bind} />
34
+ <Button onClick={handleSubmit}>Subscribe</Button>
35
+ </form>
36
+ );
37
+ }
38
+ ```
@@ -0,0 +1,8 @@
1
+ /*@import "./input.less";
2
+ @import "./tooltip.less";
3
+ @import './button.less';
4
+ @import './checkbox.less';
5
+ @import './radiobutton.less';
6
+ @import './select.less';*/
7
+ /*@import './navigation.less';
8
+ @import './swiper.less';*/
package/button.less ADDED
@@ -0,0 +1,353 @@
1
+ //
2
+ // Buttons
3
+ //
4
+
5
+ .btn {
6
+ position: relative;
7
+ display: inline-block;
8
+ min-width: @btn-min-width;
9
+ text-align: center;
10
+ white-space: nowrap;
11
+ vertical-align: middle;
12
+ -ms-touch-action: manipulation;
13
+ touch-action: manipulation;
14
+ cursor: pointer;
15
+ background: transparent;
16
+ color: inherit;
17
+ outline: none;
18
+ margin-right: @btn-mrg-right;
19
+ padding: @btn-padding;
20
+ font-family: @btn-font-family;
21
+ font-weight: @btn-font-weight;
22
+ font-size: @btn-font-size;
23
+ line-height: @btn-line-height;
24
+ font-style: @btn-text-style;
25
+ text-decoration: @btn-text-decoration;
26
+ text-transform: @btn-text-transform;
27
+ border: @btn-border;
28
+ letter-spacing: @btn-letter-spaceing;
29
+ .border-radius(@btn-brd-radius);
30
+ .user-select(none);
31
+ .appearance(none);
32
+ .transition(@btn-transition);
33
+
34
+ &:hover {
35
+ text-decoration: @btn-text-decoration;
36
+ }
37
+
38
+ &:last-child,
39
+ &.btn-block {
40
+ margin-right: 0;
41
+ }
42
+
43
+ &.no-border {
44
+ border: 0 !important;
45
+ }
46
+
47
+ &.btn-block {
48
+ width: 100%;
49
+ }
50
+
51
+ @media @md-max {
52
+ &.btn-sm-block {
53
+ width: 100%;
54
+ }
55
+ }
56
+
57
+ &.btn-xs {
58
+ padding: @btn-xs-padding;
59
+ }
60
+
61
+ &.btn-sm {
62
+ padding: @btn-sm-padding;
63
+ }
64
+
65
+ &.btn-md {
66
+ padding: @btn-md-padding;
67
+ }
68
+
69
+ &.btn-lg {
70
+ padding: @btn-lg-padding;
71
+ height: auto;
72
+ }
73
+
74
+ &.btn-xl {
75
+ padding: @btn-xl-padding;
76
+ font-size: 1.25rem;
77
+ }
78
+
79
+ &.disabled {
80
+ opacity: 0.5;
81
+ cursor: not-allowed;
82
+ pointer-events: none;
83
+
84
+ label {
85
+ cursor: not-allowed;
86
+ }
87
+ }
88
+
89
+ &.loading {
90
+ cursor: not-allowed;
91
+ pointer-events: none;
92
+ display: flex;
93
+ justify-content: center;
94
+ align-items: center;
95
+
96
+ label {
97
+ cursor: not-allowed;
98
+ }
99
+
100
+ .btn-text {
101
+ padding-right: 0.5rem;
102
+ padding-left: 0.5rem;
103
+ }
104
+
105
+ &.btn-with-icon {
106
+ .btn-icon {
107
+ display: none;
108
+ }
109
+ }
110
+ }
111
+
112
+ &.btn-grey {
113
+ border: 1px solid rgba(0, 0, 0, 0.12) !important;
114
+ background-color: #f2f4f7 !important;
115
+ background-image: linear-gradient(to top, #f2f4f7, #ffffff);
116
+ text-transform: none;
117
+ padding: 10px 0;
118
+ text-align: center;
119
+ font-family: proxima-nova, sans-serif;
120
+ font-weight: @font-weight-medium;
121
+ min-width: 160px;
122
+ margin-right: 1.5rem;
123
+ color: #4f5a65 !important;
124
+ .border-radius(4px) !important;
125
+
126
+ &:before {
127
+ content: "";
128
+ position: absolute;
129
+ height: 100%;
130
+ width: 1px;
131
+ background: rgba(0, 0, 0, 0.12);
132
+ left: 32px;
133
+ top: 0;
134
+ }
135
+
136
+ &.btn-with-icon {
137
+ .btn-icon {
138
+ border-right: 0;
139
+ font-size: @extra-small-font-size !important;
140
+ margin: -0.5rem 0.7rem -0.5rem 0.7rem;
141
+ }
142
+
143
+ .btn-text {
144
+ width: 100%;
145
+ text-align: center;
146
+ }
147
+ }
148
+
149
+ &:hover {
150
+ color: #4f5a65 !important;
151
+ }
152
+ }
153
+
154
+ &.btn-with-icon {
155
+ padding-left: 0;
156
+ padding-right: 0;
157
+ display: inline-flex;
158
+ align-items: center;
159
+ text-align: left;
160
+ white-space: inherit;
161
+
162
+ &.btn-content-center {
163
+ justify-content: center;
164
+ }
165
+
166
+ .btn-icon {
167
+ font-size: 1rem;
168
+ margin: -0.5rem 0 -0.5rem 0.5rem;
169
+
170
+ &.mirror {
171
+ .transform(scaleX(-1));
172
+ }
173
+ }
174
+
175
+ .btn-text {
176
+ padding-right: 0.5rem;
177
+ padding-left: 0.5rem;
178
+ }
179
+ }
180
+
181
+ .bn-spinner-overlay {
182
+ position: absolute;
183
+ top: 0;
184
+ left: 0;
185
+ .border-radius(@btn-brd-radius);
186
+ }
187
+
188
+ span {
189
+ &.hide {
190
+ visibility: hidden;
191
+ }
192
+ }
193
+
194
+ &.bold {
195
+ font-weight: @font-weight-bold;
196
+ }
197
+
198
+ .bn-spinner {
199
+ div {
200
+ border-color: #fff transparent transparent transparent;
201
+ }
202
+ }
203
+
204
+ &.btn-with-icon-place {
205
+ padding: 0;
206
+ display: flex;
207
+ background: transparent;
208
+ border: none;
209
+
210
+ .btn-icon {
211
+ display: block;
212
+ width: 40px;
213
+ height: 40px;
214
+ .border-radius(@btn-brd-radius 0 0 @btn-brd-radius);
215
+ border: solid 1px rgba(0, 0, 0, 0.1);
216
+ background: darken(transparent, 10%);
217
+ color: inherit;
218
+ font-size: 24px;
219
+ line-height: 40px;
220
+ margin-right: -1px;
221
+ cursor: pointer;
222
+ }
223
+
224
+ .btn-text {
225
+ display: block;
226
+ flex-grow: 1;
227
+ height: 40px;
228
+ padding: 0 30px;
229
+ .border-radius(0 @btn-brd-radius @btn-brd-radius 0);
230
+ border: solid 1px rgba(0, 0, 0, 0.1);
231
+ background: transparent;
232
+ color: inherit;
233
+ font-weight: 600;
234
+ line-height: 40px;
235
+ white-space: nowrap;
236
+ cursor: pointer;
237
+ }
238
+ }
239
+ }
240
+
241
+ .btn-default:not(.btn-with-icon-place),
242
+ .download-btn:not(.btn-with-icon-place) {
243
+ background: @default-btn-bg-color;
244
+ background-image: @default-btn-bg-gradient;
245
+ color: @default-btn-text-color;
246
+ border-color: @default-btn-brd-color;
247
+
248
+ &:not(.no-hover) {
249
+ &:hover, &:active, &:focus, &:active:focus {
250
+ background: @default-btn-hover-bg-color;
251
+ background-image: @default-btn-hover-bg-gradient;
252
+ color: @default-btn-hover-text-color;
253
+ border-color: @default-btn-hover-brd-color;
254
+ }
255
+ }
256
+
257
+ .bn-spinner {
258
+ div {
259
+ border-color: @default-btn-text-color transparent transparent transparent;
260
+ }
261
+ }
262
+ }
263
+
264
+ .btn-default.btn-with-icon-place,
265
+ .download-btn.btn-with-icon-place {
266
+ .btn-text {
267
+ background: @default-btn-bg-color;
268
+ background-image: @default-btn-bg-gradient;
269
+ color: @default-btn-text-color;
270
+ }
271
+
272
+ .btn-icon {
273
+ background: darken(@default-btn-bg-color, 10%);
274
+ color: @default-btn-text-color;
275
+ }
276
+
277
+ &:not(.no-hover) {
278
+ &:hover, &:active, &:focus, &:active:focus {
279
+ .btn-text {
280
+ background: @default-btn-hover-bg-color;
281
+ background-image: @default-btn-hover-bg-gradient;
282
+ color: @default-btn-hover-text-color;
283
+ }
284
+
285
+ .btn-icon {
286
+ background: darken(@default-btn-bg-color, 10%);
287
+ color: @default-btn-text-color;
288
+ }
289
+ }
290
+ }
291
+
292
+ .bn-spinner {
293
+ div {
294
+ border-color: @default-btn-text-color transparent transparent transparent;
295
+ }
296
+ }
297
+ }
298
+
299
+ .btn-secondary:not(.btn-with-icon-place) {
300
+ background: @secondary-btn-bg;
301
+ background-image: @secondary-btn-bg-gradient;
302
+ border-color: @secondary-btn-brd-color;
303
+ color: @secondary-btn-text-color;
304
+
305
+ &:not(.no-hover) {
306
+ &:hover, &:active, &:focus, &:active:focus {
307
+ background: @secondary-btn-hover-bg;
308
+ background-image: @secondary-btn-hover-bg-gradient;
309
+ border-color: @secondary-btn-hover-brd-color;
310
+ color: @secondary-btn-hover-text-color;
311
+ }
312
+ }
313
+
314
+ .bn-spinner {
315
+ div {
316
+ border-color: @secondary-btn-text-color transparent transparent transparent;
317
+ }
318
+ }
319
+ }
320
+
321
+ .btn-secondary.btn-with-icon-place {
322
+ .btn-text {
323
+ background: @secondary-btn-bg;
324
+ background-image: @secondary-btn-bg-gradient;
325
+ color: @secondary-btn-text-color;
326
+ }
327
+
328
+ .btn-icon {
329
+ background: darken(@secondary-btn-hover-bg, 10%);
330
+ color: @secondary-btn-hover-text-color;
331
+ }
332
+
333
+ &:not(.no-hover) {
334
+ &:hover, &:active, &:focus, &:active:focus {
335
+ .btn-text {
336
+ background: @secondary-btn-hover-bg;
337
+ background-image: @secondary-btn-hover-bg-gradient;
338
+ color: @secondary-btn-hover-text-color;
339
+ }
340
+
341
+ .btn-icon {
342
+ background: darken(@secondary-btn-hover-bg, 10%);
343
+ color: @secondary-btn-hover-text-color;
344
+ }
345
+ }
346
+ }
347
+
348
+ .bn-spinner {
349
+ div {
350
+ border-color: @secondary-btn-text-color transparent transparent transparent;
351
+ }
352
+ }
353
+ }
package/checkbox.less ADDED
@@ -0,0 +1,201 @@
1
+ //
2
+ //Checkbox
3
+ //
4
+ .form-check {
5
+ position: relative;
6
+ font-size: 1rem;
7
+ padding-left: 1.75rem;
8
+ margin-bottom: @spacer;
9
+ min-height: 1.5rem;
10
+ min-width: 1rem;
11
+
12
+ &.round-checkbox {
13
+ padding-left: 46px;
14
+
15
+ label {
16
+ &:before {
17
+ height: 20px;
18
+ width: 36px;
19
+ .border-radius(100px);
20
+ background-color: #d9d9d9;
21
+ border: 1px solid #d9d9d9;
22
+ top: 0;
23
+ }
24
+
25
+ &:after {
26
+ position: absolute;
27
+ top: 2px;
28
+ left: 3px;
29
+ content: '';
30
+ height: 16px;
31
+ width: 16px;
32
+ .border-radius(50%);
33
+ background-color: #ffffff;
34
+ }
35
+ }
36
+
37
+ label:hover {
38
+
39
+ &:after {
40
+ top: 2px;
41
+ left: 3px;
42
+ }
43
+ }
44
+
45
+ input {
46
+ &:checked {
47
+ & + label:after {
48
+ content: '';
49
+ top: 2px;
50
+ left: 18px;
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ &.disabled {
57
+ pointer-events: none;
58
+
59
+ input {
60
+ &:checked {
61
+ & + label:before {
62
+ background-color: @form-placeholder-color;
63
+ border-color: @form-placeholder-color;
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+ input {
70
+ display: none;
71
+
72
+ &:checked {
73
+ & + label:before {
74
+ background-color: @form-checkbox-active-color;
75
+ border-color: @form-checkbox-active-color;
76
+ }
77
+
78
+ & + label:after {
79
+ display: inline-block;
80
+ position: absolute;
81
+ left: 0.25rem;
82
+ top: 0.4rem;
83
+ content: '\e91a';
84
+ font-family: 'icomoon';
85
+ font-size: 0.5rem;
86
+ color: #ffffff;
87
+ }
88
+ }
89
+ }
90
+
91
+ label:hover {
92
+ &:before {
93
+ background-color: @form-checkbox-active-color;
94
+ border-color: @form-checkbox-active-color;
95
+ }
96
+
97
+ &:after {
98
+ display: inline-block;
99
+ position: absolute;
100
+ left: ~"calc(@{gatter} + .25rem)";
101
+ top: 0.4rem;
102
+ content: '\e91a';
103
+ font-family: 'icomoon';
104
+ font-size: 0.5rem;
105
+ color: #ffffff;
106
+ }
107
+ }
108
+
109
+ label:before {
110
+ content: "";
111
+ position: absolute;
112
+ left: 0;
113
+ top: 0.25rem;
114
+ height: 1rem;
115
+ width: 1rem;
116
+ border: @form-checkbox-brd;
117
+ margin-right: .25px;
118
+ color: #ffffff;
119
+ display: flex;
120
+ justify-content: center;
121
+ align-items: center;
122
+ .border-radius(.25rem);
123
+ }
124
+ // Validation
125
+ input {
126
+ &.field-invalid {
127
+ & + label:before {
128
+ border-color: @error-color;
129
+ }
130
+
131
+ & + label {
132
+ color: @error-color;
133
+ }
134
+ }
135
+ }
136
+
137
+ small {
138
+ display: block;
139
+ }
140
+
141
+ label {
142
+ cursor: pointer;
143
+ }
144
+
145
+ &.right-side {
146
+ text-align: right;
147
+ padding-left: 0;
148
+ padding-right: 1.75rem;
149
+
150
+ label:before {
151
+ left: inherit;
152
+ right: 0;
153
+ }
154
+
155
+ input {
156
+ &:checked {
157
+ & + label:after {
158
+ left: inherit;
159
+ right: 0.25rem;
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+ .form-row {
167
+ .form-check {
168
+ padding-left: ~"calc(@{gatter} + 1.75rem)";
169
+
170
+ label:before {
171
+ left: @gatter;
172
+ }
173
+
174
+ input {
175
+ &:checked {
176
+ & + label:after {
177
+ left: ~"calc(@{gatter} + .25rem)";
178
+ }
179
+ }
180
+ }
181
+
182
+ &.right-side {
183
+ padding-left: 0;
184
+ padding-right: ~"calc(@{gatter} + 1.75rem)";
185
+
186
+ label:before {
187
+ left: initial;
188
+ right: @gatter;
189
+ }
190
+
191
+ input {
192
+ &:checked {
193
+ & + label:after {
194
+ left: initial;
195
+ right: ~"calc(@{gatter} + .25rem)";
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }