dlg-ui 1.0.5 → 1.0.7

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,21 +1,22 @@
1
- <div class="dropdown-wrapper {{@class}}" {{did-insert this.loadClickListener}}>
2
- <div class="dropdown-select {{if this.isOpen 'open'}}">
3
- {{#if this.selectedOption}}
4
- {{this.selectedOption.label}}
5
- {{!-- TODO - If there is no label, then they submitted just strings and we can use those for a dropdown --}}
6
- {{else}}
7
- <span class="dropdown-placeholder">
8
- {{this.placeholder}}
9
- </span>
10
- {{/if}}
11
- </div>
12
- {{#if this.isOpen}}
13
- <div class="dropdown-options">
14
- {{#each @options as |option|}}
15
- <div class="dropdown-option" {{on "click" (fn this.makeSelection option)}}>
16
- {{option.label}}
17
- </div>
18
- {{/each}}
19
- </div>
1
+ <div class='dropdown-wrapper {{@class}}' {{did-insert this.loadClickListener}}>
2
+ <div class='dropdown-select {{if this.isOpen "open"}}'>
3
+ {{#if this.selectedOption}}
4
+ {{this.selectedOption.label}}
5
+ {{! TODO - If there is no label, then they submitted just strings and we can use those for a dropdown }}
6
+ {{else}}
7
+ <span class='dropdown-placeholder'>
8
+ {{this.placeholder}}
9
+ </span>
20
10
  {{/if}}
11
+ </div>
12
+ <div class={{this.dropdownClass}}>
13
+ {{#each @options as |option|}}
14
+ <div
15
+ class='dropdown-option'
16
+ {{on 'click' (fn this.makeSelection option)}}
17
+ >
18
+ {{option.label}}
19
+ </div>
20
+ {{/each}}
21
+ </div>
21
22
  </div>
@@ -6,6 +6,14 @@ export default class DropdownComponent extends Component {
6
6
  @tracked isOpen = false;
7
7
  @tracked _selectedOption = this.args.selectedOption;
8
8
 
9
+ get dropdownClass() {
10
+ if (this.isOpen) {
11
+ return 'dropdown-options display';
12
+ } else {
13
+ return 'dropdown-options';
14
+ }
15
+ }
16
+
9
17
  get selectedOption() {
10
18
  if (this.args.selectedOption) {
11
19
  return this.args.selectedOption;
@@ -1,16 +1,23 @@
1
- <div class="header-dropdown-wrapper {{@class}}" {{did-insert this.loadClickListener}}>
2
- <div class="header-dropdown-select {{if this.isOpen 'open'}}">
3
- <span class="header-dropdown-selected">
4
- {{this.selectedOption.label}}
5
- </span>
6
- </div>
7
- {{#if this.isOpen}}
8
- <div class="header-dropdown-options {{if this.isOpen 'open'}}" {{did-insert this.setDropdownWidth}}>
9
- {{#each @options as |option|}}
10
- <div class="dropdown-option" {{on "click" (fn this.makeSelection option)}}>
11
- {{option.label}}
12
- </div>
13
- {{/each}}
14
- </div>
15
- {{/if}}
1
+ <div
2
+ class='header-dropdown-wrapper {{@class}}'
3
+ {{did-insert this.loadClickListener}}
4
+ >
5
+ <div class='header-dropdown-select {{if this.isOpen "open"}}'>
6
+ <span class='header-dropdown-selected'>
7
+ {{this.selectedOption.label}}
8
+ </span>
9
+ </div>
10
+ <div
11
+ class='header-dropdown-options {{if this.isOpen "open"}}'
12
+ {{did-insert this.setDropdownWidth}}
13
+ >
14
+ {{#each @options as |option|}}
15
+ <div
16
+ class='dropdown-option'
17
+ {{on 'click' (fn this.makeSelection option)}}
18
+ >
19
+ {{option.label}}
20
+ </div>
21
+ {{/each}}
22
+ </div>
16
23
  </div>
@@ -52,6 +52,7 @@ export default class DropdownComponent extends Component {
52
52
 
53
53
  element.addEventListener('click', (event) => {
54
54
  if (!event.target.classList.contains('dropdown-option')) {
55
+ this.setDropdownWidth();
55
56
  this.isOpen = !this.isOpen;
56
57
  }
57
58
  });
@@ -32,6 +32,8 @@
32
32
  </div>
33
33
  </div>
34
34
  <div class='navbar-yield'>
35
- {{yield}}
35
+ <div class='navbar-body'>
36
+ {{yield}}
37
+ </div>
36
38
  </div>
37
39
  </div>
@@ -22,12 +22,23 @@
22
22
 
23
23
  .dropdown-options {
24
24
  white-space: normal;
25
+ max-height: 0;
25
26
  overflow-wrap: break-word;
26
27
  border-style: solid;
27
28
  border-top-style: none;
28
29
  border-bottom-style: none;
29
30
  border-width: 2px;
30
31
  background-color: #f6f6f6;
32
+ transform: scaleY(0);
33
+ transform-origin: top;
34
+ transition: opacity 0.2s ease, transform 0.2s ease;
35
+ opacity: 0;
36
+ }
37
+
38
+ .dropdown-options.display {
39
+ opacity: 1;
40
+ max-height: 500px;
41
+ transform: scaleY(1);
31
42
  }
32
43
 
33
44
  .dropdown-placeholder {
@@ -83,10 +94,18 @@
83
94
  border-bottom-style: none;
84
95
  border-width: 2px;
85
96
  background-color: #f6f6f6;
97
+ max-height: 0;
98
+ opacity: 0;
99
+ transform: scaleY(0);
100
+ transform-origin: top;
101
+ transition: opacity 0.2s ease, transform 0.2s ease;
86
102
  }
87
103
 
88
104
  .header-dropdown-options.open {
89
105
  border-top-style: solid;
106
+ opacity: 1;
107
+ max-height: 500px;
108
+ transform: scaleY(1);
90
109
  }
91
110
 
92
111
  .header-dropdown-select {
@@ -136,18 +155,23 @@
136
155
  width: 100%;
137
156
  }
138
157
 
158
+ .navbar-body {
159
+ flex: 1 1 auto;
160
+ padding: 0 1em;
161
+ }
162
+
139
163
  .navbar-container {
140
164
  background-color: #eee;
141
165
  position: sticky;
142
166
  top: 0;
143
167
  left: 0;
144
- width: 100%;
145
168
  min-height: 5vh;
146
169
  height: fit-content;
147
170
  display: flex;
148
171
  justify-content: space-between;
149
172
  align-items: center;
150
173
  z-index: 10;
174
+ padding: 0 1em;
151
175
  }
152
176
 
153
177
  .navbar-dropdown .header-dropdown-options {
@@ -176,7 +200,6 @@
176
200
  display: flex;
177
201
  flex-wrap: wrap;
178
202
  width: fit-content;
179
- margin-right: 10px;
180
203
  }
181
204
 
182
205
  .navbar-selection {
@@ -185,9 +208,13 @@
185
208
  align-items: center;
186
209
  }
187
210
 
211
+ .navbar-selection:last-child {
212
+ margin-right: 0;
213
+ }
214
+
188
215
  .navbar-title {
189
216
  font-size: clamp(20px, 3vw, 30px);
190
- margin: 0px 8px 0px 8px;
217
+ margin-right: 1em;
191
218
  width: fit-content;
192
219
  white-space: nowrap;
193
220
  font-weight: bold;
@@ -200,6 +227,8 @@
200
227
  }
201
228
 
202
229
  .navbar-yield {
230
+ display: flex;
231
+ justify-content: center;
203
232
  flex: 1 1 auto;
204
233
  padding-top: 8px;
205
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlg-ui",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "The default blueprint for ember-cli addons.",
5
5
  "keywords": [
6
6
  "ember-addon"