@progressive-development/pd-content 0.0.5 → 0.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.
package/index.js CHANGED
@@ -1 +1 @@
1
- export { PdContent } from './src/PdContent.js';
1
+
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Progressive Development content components. ",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "PD Progressive Development UG",
6
- "version": "0.0.5",
6
+ "version": "0.0.7",
7
7
  "main": "index.js",
8
8
  "module": "index.js",
9
9
  "scripts": {
@@ -18,7 +18,9 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "lit": "^2.0.2",
21
- "@progressive-development/pd-icon": "0.0.4"
21
+ "@progressive-development/pd-icon": "0.0.4",
22
+ "@progressive-development/pd-dialog": "0.0.7",
23
+ "pwa-helpers": "^0.9.0"
22
24
  },
23
25
  "devDependencies": {
24
26
  "@custom-elements-manifest/analyzer": "^0.4.17",
package/pd-box-view.js ADDED
@@ -0,0 +1,3 @@
1
+ import { PdBoxView } from './src/PdBoxView.js';
2
+
3
+ window.customElements.define('pd-box-view', PdBoxView);
@@ -0,0 +1,3 @@
1
+ import { PdMoreInfo } from './src/PdMoreInfo.js';
2
+
3
+ window.customElements.define('pd-more-info', PdMoreInfo);
@@ -0,0 +1,3 @@
1
+ import { PdResizeContent } from './src/PdResizeContent.js';
2
+
3
+ window.customElements.define('pd-resize-content', PdResizeContent);
@@ -0,0 +1,49 @@
1
+ import { html, css, LitElement } from 'lit';
2
+
3
+ export class PdBoxView extends LitElement {
4
+ static get styles() {
5
+ return [
6
+ css`
7
+ :host {
8
+ display: grid;
9
+ grid-template-columns: repeat(
10
+ var(--squi-box-columns, 4),
11
+ minmax(var(--squi-box-min-width, 100px), 1fr)
12
+ );
13
+ /*grid-auto-rows: minmax(var(--squi-box-min-height, 100px), 1fr); Für mobile 1 cloum auskommentiert, ging auch für große Ansicht, also eher hinderlich?*/
14
+ gap: var(--squi-box-gap, 25px);
15
+ }
16
+
17
+ @media (min-width: 580px) {
18
+ .button-icon squi-icon {
19
+ margin: 0 0.5rem;
20
+ }
21
+ .button-icon.small squi-icon {
22
+ padding-right: 0.5rem;
23
+ }
24
+ }
25
+ `,
26
+ ];
27
+ }
28
+
29
+ static get properties() {
30
+ return {
31
+ primary: { type: Boolean },
32
+ gradient: { type: Boolean },
33
+ disabled: { type: Boolean },
34
+ text: { type: String },
35
+ };
36
+ }
37
+
38
+ constructor() {
39
+ super();
40
+ this.primary = false;
41
+ this.gradient = true;
42
+ this.disabled = false;
43
+ this.text = 'Ok';
44
+ }
45
+
46
+ render() {
47
+ return html` <slot></slot> `;
48
+ }
49
+ }
@@ -0,0 +1,89 @@
1
+ /* eslint-disable lit-a11y/click-events-have-key-events */
2
+ /* eslint-disable lit-a11y/anchor-is-valid */
3
+ /**
4
+ * @license
5
+ * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
6
+ */
7
+
8
+ import { LitElement, html, css } from 'lit';
9
+
10
+ /**
11
+ * An example element.
12
+ *
13
+ * @slot - This element has a slot
14
+ * @csspart button - The button
15
+ */
16
+ export class PdMoreInfo extends LitElement {
17
+ static get styles() {
18
+ return css`
19
+ :host {
20
+ display: block;
21
+ }
22
+
23
+ p {
24
+ line-height: 1.3em;
25
+ margin: 10px;
26
+ margin-left: 0px;
27
+
28
+ color: #323031;
29
+ font-size: 1.1rem;
30
+ }
31
+
32
+ a {
33
+ font-size: 1.1rem;
34
+ color: blue;
35
+ }
36
+
37
+ a:hover {
38
+ color: purple;
39
+ cursor: pointer;
40
+ border-bottom: 1px solid purple;
41
+ }
42
+ `;
43
+ }
44
+
45
+ static get properties() {
46
+ return {
47
+ _lessInfo: { type: Boolean },
48
+ };
49
+ }
50
+
51
+ constructor() {
52
+ super();
53
+ this._lessInfo = true;
54
+ }
55
+
56
+ render() {
57
+ if (this._lessInfo) {
58
+ return html`
59
+ <p>
60
+ <slot name="small-view"></slot>
61
+ <a @click="${this._showMoreInfo}">Meer informatie</a>
62
+ </p>
63
+ `;
64
+ }
65
+ return html`
66
+ <p>
67
+ <slot name="large-view"></slot>
68
+ <a @click="${this._showLessInfo}">Minder informatie</a>
69
+ </p>
70
+ `;
71
+ }
72
+
73
+ _showMoreInfo() {
74
+ this._lessInfo = false;
75
+ }
76
+
77
+ _showLessInfo() {
78
+ this._lessInfo = true;
79
+
80
+ // scroll to position (otherwise on mobile lost in content...)
81
+ const rect = this.getBoundingClientRect();
82
+ // https://www.mediaevent.de/javascript/scroll.html
83
+ window.scrollBy({
84
+ top: rect.top - 150,
85
+ left: 0,
86
+ behavior: 'smooth',
87
+ });
88
+ }
89
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
4
+ */
5
+
6
+ import { LitElement, html, css } from 'lit';
7
+
8
+ import { installMediaQueryWatcher } from 'pwa-helpers/media-query.js';
9
+
10
+ import '@progressive-development/pd-dialog/pd-popup.js';
11
+
12
+ /**
13
+ * An example element.
14
+ *
15
+ * @slot - This element has a slot
16
+ * @csspart button - The button
17
+ */
18
+ export class PdResizeContent extends LitElement {
19
+ /**
20
+ * Fired when free date clicked => At the moment only for freeDates
21
+ * @event book-date
22
+ */
23
+
24
+ /**
25
+ * Fired when date or ZIP should edited by the user
26
+ * @event edit-selection
27
+ */
28
+
29
+ static get styles() {
30
+ return css`
31
+ :host {
32
+ display: block;
33
+ }
34
+
35
+ h3 {
36
+ color: #084c61;
37
+ font-family: Oswald;
38
+ }
39
+
40
+ p {
41
+ color: #084c61;
42
+ }
43
+ `;
44
+ }
45
+
46
+ static get properties() {
47
+ return {
48
+ resizeWidth: { type: String },
49
+ _hideContent: { type: Boolean },
50
+ };
51
+ }
52
+
53
+ constructor() {
54
+ super();
55
+ this.resizeWidth = '1232px';
56
+ this._hideContent = false;
57
+ }
58
+
59
+ firstUpdated() {
60
+ installMediaQueryWatcher(`(min-width: ${this.resizeWidth})`, matches => {
61
+ if (matches) {
62
+ this._hideContent = false;
63
+ } else {
64
+ this._hideContent = true;
65
+ }
66
+ });
67
+ }
68
+
69
+ render() {
70
+ if (this._hideContent) {
71
+ return html`
72
+ <pd-popup>
73
+ <div slot="small-view"><slot name="preview-content"></slot></div>
74
+ <div slot="content"><slot name="resize-content"></slot></div>
75
+ </pd-popup>
76
+ `;
77
+ }
78
+ return html` <slot name="resize-content"></slot> `;
79
+ }
80
+ }