vhx-quartz 0.8.18 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vhx/quartz/version.rb +1 -1
- data/vendor/assets/javascripts/vhx-quartz.modal.js +126 -0
- data/vendor/assets/javascripts/vhx-quartz.radio.js +41 -5
- data/vendor/assets/javascripts/vhx-quartz.scope.js +7 -1
- data/vendor/assets/javascripts/vhx-quartz.tag.js +39 -0
- data/vendor/assets/stylesheets/vhx-quartz.css +68 -447
- data/vendor/assets/stylesheets/vhx-quartz.min.css +1 -1
- data/vendor/assets/stylesheets/vhx-quartz.modal.css +134 -0
- data/vendor/assets/stylesheets/vhx-quartz.radio.css +22 -4
- data/vendor/assets/stylesheets/vhx-quartz.tag.css +18 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27f84c0ef67a554a6562b3a114b33606f5606210
|
4
|
+
data.tar.gz: 5c73f121351900d47af862c463a2b271cecfed9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b1338f7a378d9675cd4ca6cf86fb5865e34811bb7cee0ce02d671cf4e033163597ea729a570267ead467026db7ec3176ee95872cdd9e9d79f4797af98b7b1ff
|
7
|
+
data.tar.gz: 8e03b979186dfe16ec3628f795ac7443e7a617b8a7c0a217254221bf185d68666ce98563153b63191daae4bf13dd4eb1a9dbe51ecb6b72f8b32d9da0d257921b
|
data/lib/vhx/quartz/version.rb
CHANGED
@@ -0,0 +1,126 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
vhxm.components.shared.modal.controller = function (opts) {
|
4
|
+
var self = this;
|
5
|
+
|
6
|
+
self.setupStateType = function (type, opts) {
|
7
|
+
if (type && opts[type]) {
|
8
|
+
$.each(opts[type], function (key, item) {
|
9
|
+
if (key.match(/Callback/)) {
|
10
|
+
vhxm.components.shared.modal.state[type][key] = item;
|
11
|
+
} else {
|
12
|
+
vhxm.components.shared.modal.state[type][key](item);
|
13
|
+
}
|
14
|
+
});
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
self.setupState = function (opts) {
|
19
|
+
$.each(opts, function (key, item) {
|
20
|
+
if (!key.match(/content|actions/)) {
|
21
|
+
vhxm.components.shared.modal.state[key](item);
|
22
|
+
}
|
23
|
+
});
|
24
|
+
|
25
|
+
self.setupStateType('actions', opts);
|
26
|
+
self.setupStateType('content', opts);
|
27
|
+
};
|
28
|
+
};
|
29
|
+
vhxm.components.shared.modal.open = function () {
|
30
|
+
vhxm.components.shared.modal.state.onOpen()();
|
31
|
+
vhxm.components.shared.modal.state.isOpen(true);
|
32
|
+
m.redraw();
|
33
|
+
};
|
34
|
+
|
35
|
+
vhxm.components.shared.modal.close = function () {
|
36
|
+
vhxm.components.shared.modal.state.isOpen(false);
|
37
|
+
m.redraw();
|
38
|
+
vhxm.components.shared.modal.state.onClose()();
|
39
|
+
};
|
40
|
+
|
41
|
+
vhxm.components.shared.modal.setTo = function (opts) {
|
42
|
+
var ctrl = new vhxm.components.shared.modal.controller();
|
43
|
+
m.startComputation();
|
44
|
+
ctrl.setupState(opts);
|
45
|
+
m.endComputation();
|
46
|
+
};
|
47
|
+
|
48
|
+
$(document).on('keyup', function (ev) {
|
49
|
+
if (ev.keyCode === 27 && vhxm.components.shared.modal.state.isOpen()) {
|
50
|
+
vhxm.components.shared.modal.close();
|
51
|
+
}
|
52
|
+
});
|
53
|
+
|
54
|
+
vhxm.components.shared.modal.state = {
|
55
|
+
isOpen: m.prop(false),
|
56
|
+
size: m.prop('medium'),
|
57
|
+
hasActions: m.prop(2),
|
58
|
+
onOpen: m.prop(function () {}),
|
59
|
+
onClose: m.prop(function () {}),
|
60
|
+
content: {
|
61
|
+
title: m.prop(null),
|
62
|
+
body: m.prop(null)
|
63
|
+
},
|
64
|
+
actions: {
|
65
|
+
left: m.prop('Cancel'),
|
66
|
+
right: m.prop('OK'),
|
67
|
+
single: m.prop('OK'),
|
68
|
+
template: m.prop(null),
|
69
|
+
leftCallback: vhxm.components.shared.modal.close,
|
70
|
+
rightCallback: function rightCallback() {},
|
71
|
+
singleCallback: vhxm.components.shared.modal.close
|
72
|
+
}
|
73
|
+
};
|
74
|
+
vhxm.components.shared.modal.ui.container = {
|
75
|
+
controller: function controller(opts) {
|
76
|
+
var ctrl = new vhxm.components.shared.modal.controller();
|
77
|
+
ctrl.setupState(opts);
|
78
|
+
},
|
79
|
+
view: function view(ctrl, opts) {
|
80
|
+
var size = '.c-modal--' + vhxm.components.shared.modal.state.size();
|
81
|
+
|
82
|
+
return m('.c-modal' + (vhxm.components.shared.modal.state.isOpen() ? '.is-open' : ''), [m('.c-modal-container' + (vhxm.components.shared.modal.state.hasActions() ? '.c-modal--has-actions' : '') + size, {
|
83
|
+
config: function config(el) {
|
84
|
+
var margin = -$(el).outerHeight() / 2;
|
85
|
+
$(el).css('marginBottom', margin + 'px');
|
86
|
+
}
|
87
|
+
}, [vhxm.components.shared.modal.state.content.title() ? m.component(vhxm.components.shared.modal.ui.header) : '', vhxm.components.shared.modal.state.content.body() ? m.component(vhxm.components.shared.modal.ui.body) : '', vhxm.components.shared.modal.state.hasActions() ? m.component(vhxm.components.shared.modal.ui.actions) : '', m.component(vhxm.components.shared.modal.ui.close)]), vhxm.components.shared.modal.state.isOpen() ? m('.c-modal-bg', {
|
88
|
+
onclick: vhxm.components.shared.modal.close
|
89
|
+
}) : '']);
|
90
|
+
}
|
91
|
+
};
|
92
|
+
|
93
|
+
vhxm.components.shared.modal.ui.close = {
|
94
|
+
view: function view() {
|
95
|
+
return m('.c-modal--close' + (vhxm.components.shared.size.state.smallOnly() ? '.is-hidden' : ''), {
|
96
|
+
onclick: vhxm.components.shared.modal.close
|
97
|
+
}, [m('i.icon.icon--xsmall.icon-x-white')]);
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
vhxm.components.shared.modal.ui.header = {
|
102
|
+
view: function view() {
|
103
|
+
return m('.c-modal--header.padding-medium', [m('span', [m('.h2.head-4.head.secondary.text-left', vhxm.components.shared.modal.state.content.title())])]);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
vhxm.components.shared.modal.ui.body = {
|
108
|
+
view: function view() {
|
109
|
+
return m('.c-modal--body.padding-medium', [m.component(vhxm.components.shared.modal.state.content.body())]);
|
110
|
+
}
|
111
|
+
};
|
112
|
+
|
113
|
+
vhxm.components.shared.modal.ui.actions = {
|
114
|
+
view: function view() {
|
115
|
+
var singleAction = parseInt(vhxm.components.shared.modal.state.hasActions(), 10) === 1;
|
116
|
+
if (vhxm.components.shared.modal.state.actions.template()) {
|
117
|
+
return m('.c-modal--actions', [m.component(vhxm.components.shared.modal.state.actions.template())]);
|
118
|
+
} else {
|
119
|
+
return m('.c-modal--actions', [m('.padding-small.text-center', [!singleAction ? m('.btn.btn--' + (singleAction ? 'fill' : 'half') + '.btn-gray', {
|
120
|
+
onclick: vhxm.components.shared.modal.state.actions.leftCallback
|
121
|
+
}, vhxm.components.shared.modal.state.actions.left()) : '', m('.btn.btn--' + (singleAction ? 'fill' : 'half') + '.btn-teal', {
|
122
|
+
onclick: vhxm.components.shared.modal.state.actions[singleAction ? 'singleCallback' : 'rightCallback']
|
123
|
+
}, vhxm.components.shared.modal.state.actions[singleAction ? 'single' : 'right']())])]);
|
124
|
+
}
|
125
|
+
}
|
126
|
+
};
|
@@ -1,18 +1,54 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
vhxm.components.shared.radio.controller = function (opts) {
|
4
|
+
var self = this;
|
5
|
+
|
6
|
+
self.state = new vhxm.components.shared.radio.state();
|
7
|
+
|
8
|
+
opts.items.map(function (item) {
|
9
|
+
if (item.checked) {
|
10
|
+
self.state.isChecked(item.value);
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
if (!self.state.isChecked()) {
|
15
|
+
self.state.isChecked(opts.items[0].value);
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
vhxm.components.shared.radio.state = function () {
|
20
|
+
this.isChecked = m.prop(null);
|
21
|
+
};
|
3
22
|
vhxm.components.shared.radio.ui.container = {
|
23
|
+
controller: vhxm.components.shared.radio.controller,
|
4
24
|
view: function view(ctrl, opts) {
|
5
|
-
return m('form.form', [m('ul.radio-' + (opts.color ? opts.color : 'teal') + (opts.stacked ? '.radio--stacked' : ''), [opts.items.map(function (item, index) {
|
25
|
+
return m('form.form', [m('ul.radio-' + (opts.color ? opts.color : 'teal') + (opts.stacked ? '.radio--stacked' : opts.buttons ? '.radio--buttons' : ''), [opts.items.map(function (item, index) {
|
26
|
+
var is_checked = ctrl.state.isChecked() === item.value;
|
6
27
|
return m('li', [m('input', {
|
7
28
|
id: opts.name + '-' + index,
|
8
29
|
type: 'radio',
|
9
|
-
onchange:
|
30
|
+
onchange: function onchange() {
|
31
|
+
ctrl.state.isChecked(item.value);
|
32
|
+
if (opts.onchange) {
|
33
|
+
opts.onchange(arguments);
|
34
|
+
}
|
35
|
+
},
|
10
36
|
name: opts.name,
|
11
37
|
value: item.value,
|
12
|
-
checked:
|
13
|
-
}), m('label', {
|
38
|
+
checked: is_checked
|
39
|
+
}), m('label' + (opts.buttons ? '.btn-' + (is_checked ? 'teal' : 'gray') + '.btn--fill.btn-radio.margin-bottom-medium' : ''), {
|
14
40
|
for: opts.name + '-' + index
|
15
|
-
}, [m(
|
41
|
+
}, [m.component(vhxm.components.shared.radio.ui.icon), m('span.radio--label.text-left' + (opts.buttons ? '.padding-left-small' : ''), {
|
42
|
+
style: {
|
43
|
+
marginTop: !opts.buttons || opts.buttons && item.label.title ? '0px' : '8px'
|
44
|
+
}
|
45
|
+
}, opts.buttons ? [m('strong.head-5' + (is_checked ? '.text--white' : '.text--navy'), item.label.title ? item.label.title : item.label), item.label.descriptor ? m('p.text-4' + (is_checked ? '.text--white' : ''), item.label.descriptor) : ''] : item.label)]), item.template ? m('div.clear.padding-top-xsmall', [item.template]) : '']);
|
16
46
|
})])]);
|
17
47
|
}
|
18
48
|
};
|
49
|
+
|
50
|
+
vhxm.components.shared.radio.ui.icon = {
|
51
|
+
view: function view() {
|
52
|
+
return m('span.radio--icon', [m('i.circle-top', [m('span')]), m('i.circle-bottom', [m('span')])]);
|
53
|
+
}
|
54
|
+
};
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
if (typeof vhxm !== 'undefined') {
|
4
4
|
vhxm.components.shared = {
|
5
|
+
modal: {
|
6
|
+
ui: {}
|
7
|
+
},
|
5
8
|
radio: {
|
6
9
|
ui: {}
|
7
10
|
},
|
@@ -36,6 +39,9 @@ if (typeof vhxm !== 'undefined') {
|
|
36
39
|
ui: {}
|
37
40
|
},
|
38
41
|
avatar: {},
|
39
|
-
size: {}
|
42
|
+
size: {},
|
43
|
+
tag: {
|
44
|
+
ui: {}
|
45
|
+
}
|
40
46
|
};
|
41
47
|
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
vhxm.components.shared.tag.controller = function (opts) {
|
4
|
+
var self = this;
|
5
|
+
|
6
|
+
self.state = new vhxm.components.shared.tag.state();
|
7
|
+
};
|
8
|
+
vhxm.components.shared.tag.state = function () {
|
9
|
+
this.isHover = m.prop(false);
|
10
|
+
this.isRemoveHover = m.prop(false);
|
11
|
+
};
|
12
|
+
|
13
|
+
vhxm.components.shared.tag.ui.container = {
|
14
|
+
controller: vhxm.components.shared.tag.controller,
|
15
|
+
view: function view(ctrl, opts) {
|
16
|
+
return m('span.inline.relative.c-tag' + (ctrl.state.isHover() ? '.is-hover' : ''), {
|
17
|
+
onmouseover: function onmouseover() {
|
18
|
+
ctrl.state.isHover(true);
|
19
|
+
},
|
20
|
+
onmouseout: function onmouseout() {
|
21
|
+
ctrl.state.isHover(false);
|
22
|
+
}
|
23
|
+
}, [m('button.c-tag--button' + (ctrl.state.isHover() ? '.btn-teal.is-hover' : '.btn-gray'), {
|
24
|
+
onclick: function onclick() {
|
25
|
+
ctrl.state.onShow();
|
26
|
+
}
|
27
|
+
}, 'Tag'), m('a.c-tag--remove.icon--center.icon-x-white.icon--xxsmall' + (ctrl.state.isRemoveHover() ? '.btn-red' : '.btn-teal'), {
|
28
|
+
onclick: function onclick() {
|
29
|
+
ctrl.state.onRemove();
|
30
|
+
},
|
31
|
+
onmouseover: function onmouseover() {
|
32
|
+
ctrl.state.isRemoveHover(true);
|
33
|
+
},
|
34
|
+
onmouseout: function onmouseout() {
|
35
|
+
ctrl.state.isRemoveHover(false);
|
36
|
+
}
|
37
|
+
})]);
|
38
|
+
}
|
39
|
+
};
|