neo.mjs 4.6.3 → 4.6.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.
@@ -1,8 +1,9 @@
1
1
  import Button from '../../../src/button/Base.mjs';
2
2
  import CheckBox from '../../../src/form/field/CheckBox.mjs';
3
3
  import ConfigurationViewport from '../../ConfigurationViewport.mjs';
4
- import Radio from '../../../src/form/field/Radio.mjs';
5
4
  import NumberField from '../../../src/form/field/Number.mjs';
5
+ import Radio from '../../../src/form/field/Radio.mjs';
6
+ import SelectField from '../../../src/form/field/Select.mjs';
6
7
  import TextField from '../../../src/form/field/Text.mjs';
7
8
 
8
9
  /**
@@ -136,6 +137,21 @@ class MainContainer extends ConfigurationViewport {
136
137
  listeners : {change: me.onConfigChange.bind(me, 'text')},
137
138
  style : {marginTop: '10px'},
138
139
  value : me.exampleComponent.text
140
+ }, {
141
+ module : SelectField,
142
+ forceSelection: true,
143
+ labelText : 'ui',
144
+ listeners : {change: me.onConfigChange.bind(me, 'ui')},
145
+ style : {marginTop: '10px'},
146
+ value : me.exampleComponent.ui,
147
+
148
+ store: {
149
+ data: [
150
+ {id: 'primary', name: 'primary'},
151
+ {id: 'secondary', name: 'secondary'},
152
+ {id: 'tertiary', name: 'tertiary'}
153
+ ]
154
+ }
139
155
  }, {
140
156
  module : CheckBox,
141
157
  checked : me.exampleComponent.useRippleEffect,
@@ -162,6 +178,7 @@ class MainContainer extends ConfigurationViewport {
162
178
  height : 50,
163
179
  iconCls : 'fa fa-home',
164
180
  text : 'Hello World',
181
+ ui : 'primary',
165
182
  width : 150,
166
183
 
167
184
  handler: (data) => {
@@ -44,7 +44,7 @@ class MainContainer extends Viewport {
44
44
  style : {paddingBottom: '40px', marginLeft: '10px'}
45
45
  }, {
46
46
  module : TextField,
47
- labelText: 'tile',
47
+ labelText: 'title',
48
48
  name : 'title'
49
49
  }, {
50
50
  module : TextField,
@@ -57,7 +57,7 @@ class MainContainer extends Viewport {
57
57
  store : {data: [{name: 'tl'}, {name: 'tc'}, {name: 'tr'}, {name: 'bl'}, {name: 'bc'}, {name: 'br'}]}
58
58
  }, {
59
59
  module : SelectField,
60
- labelText: 'slideDirection = down',
60
+ labelText: 'slideDirection = right',
61
61
  name : 'slideDirection',
62
62
  store : {data: [{name: 'down'}, {name: 'up'}, {name: 'left'}, {name: 'right'}]}
63
63
  }, {
@@ -1,5 +1,5 @@
1
1
  import ComponentController from '../../src/controller/Component.mjs';
2
- import Toast from '../../src/dialog/Toast.mjs';
2
+ import Toast from '../../src/component/Toast.mjs';
3
3
 
4
4
  /**
5
5
  * @class Neo.examples.toast.MainContainerController
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.6.3",
3
+ "version": "4.6.5",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -10,29 +10,42 @@
10
10
  }
11
11
 
12
12
  .neo-disabled {
13
- .neo-button {
14
- cursor: default;
13
+ .neo-button,
14
+ &.neo-button {
15
+ background-color: v(button-background-color-disabled);
16
+ border-color : v(button-border-color-disabled);
17
+ cursor : default;
18
+ opacity : v(button-opacity-disabled);
19
+
20
+ .neo-button-glyph {
21
+ color: v(button-glyph-color-disabled);
22
+ }
23
+
24
+ .neo-button-text {
25
+ color: v(button-text-color-disabled);
26
+ }
15
27
  }
16
28
  }
17
29
 
18
30
  .neo-button {
19
- align-items : center;
20
- background-color : v(button-background-color);
21
- background-image : v(button-background-image);
22
- border : v(button-border);
23
- border-radius : v(button-border-radius);
24
- box-sizing : border-box;
25
- cursor : pointer;
26
- display : flex;
27
- flex-direction : row;
28
- justify-content : center;
29
- margin : v(button-margin);
30
- padding : v(button-padding);
31
- position : relative;
32
- text-decoration : none; // for url buttons => links
33
- user-select : none;
34
- white-space : nowrap;
35
- -webkit-appearance : button;
31
+ align-items : center;
32
+ background-color : v(button-background-color);
33
+ background-image : v(button-background-image);
34
+ border : v(button-border-width) solid v(button-border-color);
35
+ border-radius : v(button-border-radius);
36
+ box-sizing : border-box;
37
+ cursor : pointer;
38
+ display : flex;
39
+ flex-direction : row;
40
+ justify-content : center;
41
+ margin : v(button-margin);
42
+ padding : v(button-padding);
43
+ position : relative;
44
+ text-decoration : none; // for url buttons => links
45
+ transition : outline-width .1s ease-out;
46
+ user-select : none;
47
+ white-space : nowrap;
48
+ -webkit-appearance: button;
36
49
 
37
50
  &:active {
38
51
  background-color: v(button-active-background-color) !important;
@@ -41,6 +54,10 @@
41
54
  color : v(button-active-color) !important;
42
55
  }
43
56
 
57
+ &:focus {
58
+ outline: v(button-outline-active);
59
+ }
60
+
44
61
  &:hover {
45
62
  background-color: v(button-hover-background-color);
46
63
  background-image: none !important;
@@ -48,6 +65,30 @@
48
65
  color : v(button-hover-color);
49
66
  }
50
67
 
68
+ &.neo-button-secondary {
69
+ background-color: v(button-text-color);
70
+ background-image: none;
71
+
72
+ .neo-button-badge {
73
+ background-color: v(button-badge-color);
74
+ color : v(button-badge-background-color);
75
+ }
76
+
77
+ .neo-button-glyph {
78
+ color: v(button-background-color);
79
+ }
80
+
81
+ .neo-button-text {
82
+ color: v(button-background-color);
83
+ }
84
+ }
85
+
86
+ &.neo-button-tertiary {
87
+ background-color: transparent;
88
+ background-image: none;
89
+ border-width : 0;
90
+ }
91
+
51
92
  &.no-text {
52
93
  .neo-button-glyph {
53
94
  margin: 0 !important;
@@ -125,10 +166,6 @@
125
166
  z-index : 2;
126
167
  }
127
168
 
128
- &:focus {
129
- outline : 0;
130
- }
131
-
132
169
  &.icon-bottom {
133
170
  flex-direction: column-reverse;
134
171
 
@@ -0,0 +1,191 @@
1
+ .neo-toast {
2
+ z-index : 20; // ensure to be on top of table headers
3
+ align-items : center;
4
+ background-color: v(toast-background-color);
5
+ border-radius : 0.5rem;
6
+ box-shadow : 0 0.25rem 0.5rem v(toast-shadow-color);
7
+ color : v(toast-color);
8
+ display : flex;
9
+ position : fixed;
10
+ transition : bottom .3s ease-out, top .3s ease-out;
11
+
12
+ .neo-toast-inner {
13
+ align-items: center;
14
+ display : flex;
15
+
16
+ &.neo-toast-has-title {
17
+ .neo-toast-text {
18
+ text-align: left;
19
+ }
20
+ }
21
+
22
+ & > div {
23
+ padding: 0.25em 0.5em;
24
+ }
25
+
26
+ .neo-toast-icon {
27
+ border-right: 2px solid v(toast-color);
28
+ flex : 1;
29
+ font-size : 1.5em;
30
+ }
31
+
32
+ .neo-toast-text {
33
+ padding : 0.25em 1em;
34
+ text-align: center;
35
+
36
+ .neo-toast-msg {
37
+ font-size: 0.8em;
38
+ }
39
+
40
+ .neo-toast-title {
41
+ padding-bottom: 0.2em;
42
+ text-transform: uppercase;
43
+ }
44
+ }
45
+
46
+ .neo-toast-close {
47
+ background : transparent;
48
+ border : 0;
49
+ color : inherit;
50
+ cursor : pointer;
51
+ font-size : 1.5rem;
52
+ line-height: 1.5;
53
+ margin-left: auto;
54
+ }
55
+ }
56
+ }
57
+
58
+ // ui: danger
59
+ .neo-toast-danger {
60
+ background-color: v(toast-danger-background-color);
61
+ color: v(toast-danger-color);
62
+
63
+ & > div {
64
+
65
+ .neo-toast-inner {
66
+
67
+ .neo-toast-icon {
68
+ border-right: 2px solid v(toast-danger-color);
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ // ui: success
75
+ .neo-toast-success {
76
+ background-color: v(toast-success-background-color);
77
+ color: v(toast-success-color);
78
+
79
+ & > div {
80
+
81
+ .neo-toast-inner {
82
+
83
+ .neo-toast-icon {
84
+ border-right: 2px solid v(toast-success-color);
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ /* Toast positions */
91
+ .neo-toast-tr {
92
+ right: 1rem;
93
+ top : 1rem;
94
+ }
95
+
96
+ .neo-toast-tc {
97
+ left : 50%;
98
+ top : 1rem;
99
+ transform: translateX(-50%);
100
+ }
101
+
102
+ .neo-toast-tl {
103
+ left: 1rem;
104
+ top : 1rem;
105
+ }
106
+
107
+ .neo-toast-br {
108
+ bottom: 1rem;
109
+ right : 1rem;
110
+ }
111
+
112
+ .neo-toast-bc {
113
+ bottom : 1rem;
114
+ left : 50%;
115
+ transform: translateX(-50%);
116
+ }
117
+
118
+ .neo-toast-bl {
119
+ bottom: 1rem;
120
+ left : 1rem;
121
+ }
122
+
123
+ /* Toast slide-in animation */
124
+ @keyframes neo-toast-slide-down-in {
125
+ from {
126
+ transform: translateY(-150%);
127
+ }
128
+ to {
129
+ transform: translateY(0);
130
+ }
131
+ }
132
+
133
+ @keyframes neo-toast-slide-up-in {
134
+ from {
135
+ transform: translateY(150%);
136
+ }
137
+ to {
138
+ transform: translateY(0);
139
+ }
140
+ }
141
+
142
+ @keyframes neo-toast-slide-left-in {
143
+ from {
144
+ transform: translateX(-150%);
145
+ }
146
+ to {
147
+ transform: translateX(0);
148
+ }
149
+ }
150
+
151
+ @keyframes neo-toast-slide-right-in {
152
+ from {
153
+ transform: translateX(150%);
154
+ }
155
+ to {
156
+ transform: translateX(0);
157
+ }
158
+ }
159
+
160
+ /* Add the slide-in animation to the toast when the slide-in class is added */
161
+ .neo-toast-slide-down-in {
162
+ animation: neo-toast-slide-down-in 0.25s ease-out;
163
+ }
164
+
165
+ .neo-toast-slide-up-in {
166
+ animation: neo-toast-slide-up-in 0.25s ease-out;
167
+ }
168
+
169
+ .neo-toast-slide-left-in {
170
+ animation: neo-toast-slide-left-in 0.25s ease-out;
171
+ }
172
+
173
+ .neo-toast-slide-right-in {
174
+ animation: neo-toast-slide-right-in 0.25s ease-out;
175
+ }
176
+
177
+ /* Toast fade-out animation */
178
+ @keyframes neo-toast-fade-out {
179
+ from {
180
+ opacity: 1;
181
+ }
182
+ to {
183
+ opacity: 0;
184
+ }
185
+ }
186
+
187
+ /* Add the fade-out animation to the toast when the fade-out class is added */
188
+ .neo-toast-fade-out {
189
+ animation : neo-toast-fade-out 0.25s ease-out;
190
+ animation-fill-mode: forwards;
191
+ }
@@ -3,6 +3,7 @@ $neoMap: map-merge($neoMap, (
3
3
  'button-active-border-color' : #282828,
4
4
  'button-active-color' : #bbb,
5
5
  'button-background-color' : #3c3f41,
6
+ 'button-background-color-disabled': #3c3f41,
6
7
  'button-background-image' : linear-gradient(#434749, #323536),
7
8
  'button-background-gradient-end' : #323536,
8
9
  'button-background-gradient-start': #434749,
@@ -10,17 +11,23 @@ $neoMap: map-merge($neoMap, (
10
11
  'button-badge-color' : #282828,
11
12
  'button-badge-margin-left' : -10px,
12
13
  'button-badge-margin-top' : -10px,
13
- 'button-border' : 1px solid #2b2b2b,
14
+ 'button-border-color' : #2b2b2b,
15
+ 'button-border-color-disabled' : #2b2b2b,
14
16
  'button-border-radius' : 0,
17
+ 'button-border-width' : 1px,
15
18
  'button-glyph-color' : #bbb,
19
+ 'button-glyph-color-disabled' : #bbb,
16
20
  'button-hover-background-color' : #3a3c3e,
17
21
  'button-hover-border-color' : #292929,
18
22
  'button-hover-color' : #bbb,
19
23
  'button-margin' : 2px,
24
+ 'button-opacity-disabled' : #{neo(neo-disabled-opacity)},
25
+ 'button-outline-active' : none,
20
26
  'button-padding' : 5px 12px 5px 12px,
21
27
  'button-pressed-border-color' : #5d83a7,
22
28
  'button-ripple-background-color' : darken(#5d83a7, 10%),
23
29
  'button-text-color' : #bbb,
30
+ 'button-text-color-disabled' : #bbb,
24
31
  'button-text-font-family' : #{neo(neo-font-family)},
25
32
  'button-text-font-size' : 11px,
26
33
  'button-text-font-weight' : 600,
@@ -35,6 +42,7 @@ $neoMap: map-merge($neoMap, (
35
42
  --button-active-border-color : #{neo(button-active-border-color)};
36
43
  --button-active-color : #{neo(button-active-color)};
37
44
  --button-background-color : #{neo(button-background-color)};
45
+ --button-background-color-disabled: #{neo(button-background-color-disabled)};
38
46
  --button-background-image : #{neo(button-background-image)};
39
47
  --button-background-gradient-end : #{neo(button-background-gradient-end)};
40
48
  --button-background-gradient-start: #{neo(button-background-gradient-start)};
@@ -42,17 +50,23 @@ $neoMap: map-merge($neoMap, (
42
50
  --button-badge-color : #{neo(button-badge-color)};
43
51
  --button-badge-margin-left : #{neo(button-badge-margin-left)};
44
52
  --button-badge-margin-top : #{neo(button-badge-margin-top)};
45
- --button-border : #{neo(button-border)};
53
+ --button-border-color : #{neo(button-border-color)};
54
+ --button-border-color-disabled : #{neo(button-border-color-disabled)};
46
55
  --button-border-radius : #{neo(button-border-radius)};
56
+ --button-border-width : #{neo(button-border-width)};
47
57
  --button-glyph-color : #{neo(button-glyph-color)};
58
+ --button-glyph-color-disabled : #{neo(button-glyph-color-disabled)};
48
59
  --button-hover-background-color : #{neo(button-hover-background-color)};
49
60
  --button-hover-border-color : #{neo(button-hover-border-color)};
50
61
  --button-hover-color : #{neo(button-hover-color)};
51
62
  --button-margin : #{neo(button-margin)};
63
+ --button-opacity-disabled : #{neo(button-opacity-disabled)};
64
+ --button-outline-active : #{neo(button-outline-active)};
52
65
  --button-padding : #{neo(button-padding)};
53
66
  --button-pressed-border-color : #{neo(button-pressed-border-color)};
54
67
  --button-ripple-background-color : #{neo(button-ripple-background-color)};
55
68
  --button-text-color : #{neo(button-text-color)};
69
+ --button-text-color-disabled : #{neo(button-text-color-disabled)};
56
70
  --button-text-font-family : #{neo(button-text-font-family)};
57
71
  --button-text-font-size : #{neo(button-text-font-size)};
58
72
  --button-text-font-weight : #{neo(button-text-font-weight)};
@@ -0,0 +1,21 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'toast-background-color' : lightblue,
3
+ 'toast-color' : #083741,
4
+ 'toast-danger-background-color' : #e6adad,
5
+ 'toast-danger-color' : #410808,
6
+ 'toast-shadow-color' : rgba(255, 255, 255, 0.15),
7
+ 'toast-success-background-color': #b7e6ad,
8
+ 'toast-success-color' : #124108
9
+ ));
10
+
11
+ @if $useCssVars == true {
12
+ :root .neo-theme-dark { // .neo-toast
13
+ --toast-background-color : #{neo(toast-background-color)};
14
+ --toast-color : #{neo(toast-color)};
15
+ --toast-shadow-color : #{neo(toast-shadow-color)};
16
+ --toast-danger-background-color : #{neo(toast-danger-background-color)};
17
+ --toast-danger-color : #{neo(toast-danger-color)};
18
+ --toast-success-background-color: #{neo(toast-success-background-color)};
19
+ --toast-success-color : #{neo(toast-success-color)};
20
+ }
21
+ }
@@ -3,6 +3,7 @@ $neoMap: map-merge($neoMap, (
3
3
  'button-active-border-color' : #1c60a0,
4
4
  'button-active-color' : #1c60a0,
5
5
  'button-background-color' : #fff,
6
+ 'button-background-color-disabled': #fff,
6
7
  'button-background-image' : none,
7
8
  'button-background-gradient-end' : #323536,
8
9
  'button-background-gradient-start': #434749,
@@ -10,17 +11,23 @@ $neoMap: map-merge($neoMap, (
10
11
  'button-badge-color' : #fff,
11
12
  'button-badge-margin-left' : -10px,
12
13
  'button-badge-margin-top' : -10px,
13
- 'button-border' : 1px solid #ddd,
14
+ 'button-border-color' : #ddd,
15
+ 'button-border-color-disabled' : #ddd,
14
16
  'button-border-radius' : 3px,
17
+ 'button-border-width' : 1px,
15
18
  'button-glyph-color' : #1c60a0,
19
+ 'button-glyph-color-disabled' : #1c60a0,
16
20
  'button-hover-background-color' : #fff,
17
21
  'button-hover-border-color' : #1c60a0,
18
22
  'button-hover-color' : #bbb,
19
23
  'button-margin' : 2px,
24
+ 'button-opacity-disabled' : #{neo(neo-disabled-opacity)},
25
+ 'button-outline-active' : none,
20
26
  'button-padding' : 5px 12px 5px 12px,
21
27
  'button-pressed-border-color' : #1c60a0,
22
28
  'button-ripple-background-color' : lighten(#1c60a0, 50%),
23
29
  'button-text-color' : #1c60a0,
30
+ 'button-text-color-disabled' : #1c60a0,
24
31
  'button-text-font-family' : #{neo(neo-font-family)},
25
32
  'button-text-font-size' : 11px,
26
33
  'button-text-font-weight' : 600,
@@ -35,6 +42,7 @@ $neoMap: map-merge($neoMap, (
35
42
  --button-active-border-color : #{neo(button-active-border-color)};
36
43
  --button-active-color : #{neo(button-active-color)};
37
44
  --button-background-color : #{neo(button-background-color)};
45
+ --button-background-color-disabled: #{neo(button-background-color-disabled)};
38
46
  --button-background-image : #{neo(button-background-image)};
39
47
  --button-background-gradient-end : #{neo(button-background-gradient-end)};
40
48
  --button-background-gradient-start: #{neo(button-background-gradient-start)};
@@ -42,17 +50,23 @@ $neoMap: map-merge($neoMap, (
42
50
  --button-badge-color : #{neo(button-badge-color)};
43
51
  --button-badge-margin-left : #{neo(button-badge-margin-left)};
44
52
  --button-badge-margin-top : #{neo(button-badge-margin-top)};
45
- --button-border : #{neo(button-border)};
53
+ --button-border-color : #{neo(button-border-color)};
54
+ --button-border-color-disabled : #{neo(button-border-color-disabled)};
46
55
  --button-border-radius : #{neo(button-border-radius)};
56
+ --button-border-width : #{neo(button-border-width)};
47
57
  --button-glyph-color : #{neo(button-glyph-color)};
58
+ --button-glyph-color-disabled : #{neo(button-glyph-color-disabled)};
48
59
  --button-hover-background-color : #{neo(button-hover-background-color)};
49
60
  --button-hover-border-color : #{neo(button-hover-border-color)};
50
61
  --button-hover-color : #{neo(button-hover-color)};
51
62
  --button-margin : #{neo(button-margin)};
63
+ --button-opacity-disabled : #{neo(button-opacity-disabled)};
64
+ --button-outline-active : #{neo(button-outline-active)};
52
65
  --button-padding : #{neo(button-padding)};
53
66
  --button-pressed-border-color : #{neo(button-pressed-border-color)};
54
67
  --button-ripple-background-color : #{neo(button-ripple-background-color)};
55
68
  --button-text-color : #{neo(button-text-color)};
69
+ --button-text-color-disabled : #{neo(button-text-color-disabled)};
56
70
  --button-text-font-family : #{neo(button-text-font-family)};
57
71
  --button-text-font-size : #{neo(button-text-font-size)};
58
72
  --button-text-font-weight : #{neo(button-text-font-weight)};
@@ -0,0 +1,21 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'toast-background-color' : lightblue,
3
+ 'toast-color' : #083741,
4
+ 'toast-danger-background-color' : #e6adad,
5
+ 'toast-danger-color' : #410808,
6
+ 'toast-shadow-color' : rgba(0, 0, 0, 0.15),
7
+ 'toast-success-background-color': #b7e6ad,
8
+ 'toast-success-color' : #124108
9
+ ));
10
+
11
+ @if $useCssVars == true {
12
+ :root .neo-theme-light { // .neo-toast
13
+ --toast-background-color : #{neo(toast-background-color)};
14
+ --toast-color : #{neo(toast-color)};
15
+ --toast-shadow-color : #{neo(toast-shadow-color)};
16
+ --toast-danger-background-color : #{neo(toast-danger-background-color)};
17
+ --toast-danger-color : #{neo(toast-danger-color)};
18
+ --toast-success-background-color: #{neo(toast-success-background-color)};
19
+ --toast-success-color : #{neo(toast-success-color)};
20
+ }
21
+ }
@@ -1062,7 +1062,7 @@ class Base extends CoreBase {
1062
1062
  * Convenience shortcut for Neo.manager.Component.down
1063
1063
  * @param {Object|String} config
1064
1064
  * @param {Boolean} returnFirstMatch=true
1065
- * @returns {Neo.core.Base} The matching instance or null
1065
+ * @returns {Neo.component.Base|null} The matching instance or null
1066
1066
  */
1067
1067
  down(config, returnFirstMatch=true) {
1068
1068
  return ComponentManager.down(this, config, returnFirstMatch);
@@ -1187,6 +1187,15 @@ class Base extends CoreBase {
1187
1187
  return null;
1188
1188
  }
1189
1189
 
1190
+ /**
1191
+ * convenience shortcut
1192
+ * @param {String} value
1193
+ * @returns {Neo.component.Base|null}
1194
+ */
1195
+ getReference(value) {
1196
+ return this.down({reference: value})
1197
+ }
1198
+
1190
1199
  /**
1191
1200
  * Walks up the vdom tree and returns the closest theme found
1192
1201
  * @returns {String}