dlg-ui 1.0.6 → 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
  });
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlg-ui",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "The default blueprint for ember-cli addons.",
5
5
  "keywords": [
6
6
  "ember-addon"