@dile/ui 2.21.4 → 2.22.1

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.
@@ -0,0 +1,3 @@
1
+ import { DileCardSlide } from "./src/DileCardSlide.js";
2
+
3
+ window.customElements.define("dile-card-slide", DileCardSlide);
@@ -1 +1,2 @@
1
- export { DileCard } from './src/DileCard.js';
1
+ export { DileCard } from './src/DileCard.js';
2
+ export { DileCardSlide } from './src/DileCardSlide.js';
@@ -0,0 +1,111 @@
1
+ import { html, css } from 'lit';
2
+ import { DileCard } from './DileCard.js';
3
+ import { DileSlideDown } from '../../../mixins/slide-down/index.js';
4
+ import { arrowDropDownIcon } from '@dile/icons';
5
+ import '@dile/ui/components/icon/icon.js';
6
+
7
+ export class DileCardSlide extends DileSlideDown(DileCard) {
8
+ static get properties() {
9
+ return {
10
+ opened: { type: Boolean },
11
+ icon: { type: Object },
12
+ }
13
+ }
14
+
15
+ static get styles() {
16
+ return [
17
+ ...super.styles,
18
+ css`
19
+ h1 {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ cursor: pointer;
24
+ padding-bottom: var(--dile-card-slide-title-padding-bottom, var(--dile-card-padding-y, 1rem));
25
+ }
26
+ #content {
27
+ height: 0;
28
+ overflow: hidden;
29
+ transition: height 0.5s ease-in;
30
+ -webkit-transition: height 0.5s ease-in;
31
+ }
32
+ dile-icon {
33
+ flex-shrink: 0;
34
+ transform: rotate(-90deg);
35
+ transition: transform 0.5s ease;
36
+ --dile-icon-color: var(--dile-card-slide-icon-color, var(--dile-primary-color, #303030));
37
+ }
38
+ h1.opened dile-icon {
39
+ transform: rotate(0deg);
40
+ }
41
+ main {
42
+ padding-top: var(--dile-card-slide-main-padding-top, var(--dile-card-padding-y, 1rem));
43
+ }
44
+ `
45
+ ];
46
+ }
47
+
48
+ constructor() {
49
+ super();
50
+ this.opened = false;
51
+ this.icon = arrowDropDownIcon;
52
+ }
53
+
54
+ firstUpdated() {
55
+ this.content = this.shadowRoot.getElementById('content');
56
+ }
57
+
58
+ updated(changedProperties) {
59
+ if (changedProperties.has('opened') && this.opened != undefined) {
60
+ if (this.opened) {
61
+ this.slideShow(this.content);
62
+ } else {
63
+ this.slideHide(this.content);
64
+ }
65
+ }
66
+ }
67
+
68
+ get titleTemplate() {
69
+ return this.title
70
+ ? html`
71
+ <h1 @click="${this.toggle}" class="${this.opened ? 'opened' : ''}">
72
+ ${this.title}
73
+ <dile-icon .icon=${this.icon}></dile-icon>
74
+ </h1>`
75
+ : ''
76
+ }
77
+
78
+ render() {
79
+ return html`
80
+ ${this.titleTemplate}
81
+ <div id="content">
82
+ <main>
83
+ <slot></slot>
84
+ </main>
85
+ ${this.footerTemplate}
86
+ </div>
87
+ `;
88
+ }
89
+
90
+ toggle() {
91
+ if (this.opened) {
92
+ this.close();
93
+ } else {
94
+ this.open();
95
+ }
96
+ }
97
+
98
+ open() {
99
+ if (!this.opened) {
100
+ this.slideShow(this.content);
101
+ this.opened = true;
102
+ }
103
+ }
104
+
105
+ close() {
106
+ if (this.opened) {
107
+ this.slideHide(this.content);
108
+ this.opened = false;
109
+ }
110
+ }
111
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/ui",
3
- "version": "2.21.4",
3
+ "version": "2.22.1",
4
4
  "description": "UI Core components from dile-components.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,5 +26,5 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "gitHead": "f3d7061476125162d6d9822928d40dc15e110c6c"
29
+ "gitHead": "20de388e2c9140eb18f37c5f4102efc1da4b955a"
30
30
  }