@progressive-development/pd-content 0.5.9 → 0.6.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.
Files changed (58) hide show
  1. package/dist/generated/locale-codes.d.ts +14 -0
  2. package/dist/generated/locale-codes.d.ts.map +1 -0
  3. package/dist/generated/locales/be.d.ts +5 -0
  4. package/dist/generated/locales/be.d.ts.map +1 -0
  5. package/dist/generated/locales/de.d.ts +5 -0
  6. package/dist/generated/locales/de.d.ts.map +1 -0
  7. package/dist/generated/locales/en.d.ts +5 -0
  8. package/dist/generated/locales/en.d.ts.map +1 -0
  9. package/dist/index.d.ts +10 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +5 -5
  12. package/dist/locales/be.d.ts +2 -0
  13. package/dist/locales/de.d.ts +2 -0
  14. package/dist/locales/en.d.ts +2 -0
  15. package/dist/pd-box-view.d.ts +6 -0
  16. package/dist/pd-box-view.d.ts.map +1 -0
  17. package/dist/pd-box-view.js +33 -4
  18. package/dist/pd-collapse.d.ts +31 -0
  19. package/dist/pd-collapse.d.ts.map +1 -0
  20. package/dist/pd-collapse.js +151 -4
  21. package/dist/pd-edit-content.d.ts +29 -0
  22. package/dist/pd-edit-content.d.ts.map +1 -0
  23. package/dist/pd-edit-content.js +224 -4
  24. package/dist/pd-more-info.d.ts +23 -0
  25. package/dist/pd-more-info.d.ts.map +1 -0
  26. package/dist/pd-more-info.js +83 -4
  27. package/dist/pd-panel-viewer.d.ts +17 -0
  28. package/dist/pd-panel-viewer.d.ts.map +1 -0
  29. package/dist/pd-panel-viewer.js +207 -0
  30. package/dist/pd-panel.d.ts +6 -0
  31. package/dist/pd-panel.d.ts.map +1 -0
  32. package/dist/pd-panel.js +48 -0
  33. package/dist/pd-resize-content.d.ts +25 -0
  34. package/dist/pd-resize-content.d.ts.map +1 -0
  35. package/dist/pd-resize-content.js +64 -4
  36. package/dist/pd-tab.d.ts +19 -0
  37. package/dist/pd-tab.d.ts.map +1 -0
  38. package/dist/pd-tab.js +182 -0
  39. package/dist/stories/pd-box-view.stories.d.ts +10 -0
  40. package/dist/stories/pd-box-view.stories.d.ts.map +1 -0
  41. package/dist/stories/pd-collapse.stories.d.ts +21 -0
  42. package/dist/stories/pd-collapse.stories.d.ts.map +1 -0
  43. package/dist/stories/pd-edit-content.stories.d.ts +11 -0
  44. package/dist/stories/pd-edit-content.stories.d.ts.map +1 -0
  45. package/dist/stories/pd-more-info.stories.d.ts +6 -0
  46. package/dist/stories/pd-more-info.stories.d.ts.map +1 -0
  47. package/dist/stories/pd-resize-content.stories.d.ts +5 -0
  48. package/dist/stories/pd-resize-content.stories.d.ts.map +1 -0
  49. package/dist/stories/pd-tab.stories.d.ts +23 -0
  50. package/dist/stories/pd-tab.stories.d.ts.map +1 -0
  51. package/dist/types.d.ts +21 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/package.json +34 -45
  54. package/dist/src/PdBoxView.js +0 -24
  55. package/dist/src/PdCollapse.js +0 -135
  56. package/dist/src/PdEditContent.js +0 -223
  57. package/dist/src/PdMoreInfo.js +0 -77
  58. package/dist/src/PdResizeContent.js +0 -67
@@ -1,4 +1,83 @@
1
- import { PdMoreInfo } from "./src/PdMoreInfo.js";
2
- if (!customElements.get("pd-more-info")) {
3
- window.customElements.define("pd-more-info", PdMoreInfo);
4
- }
1
+ import { css, LitElement, html } from "lit";
2
+ import { state, customElement } from "lit/decorators.js";
3
+ import { localized, msg } from "@lit/localize";
4
+ import { PdFontStyles } from "@progressive-development/pd-shared-styles";
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12
+ if (kind && result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ let PdMoreInfo = class extends LitElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this._lessInfo = true;
19
+ }
20
+ render() {
21
+ return html`
22
+ <p>
23
+ ${this._lessInfo ? html`
24
+ <slot name="small-view"></slot>
25
+ <a @click=${this._showMoreInfo}>
26
+ ${msg("Mehr Informationen", { id: "pd.moreInfo.more" })}
27
+ </a>
28
+ ` : html`
29
+ <slot name="large-view"></slot>
30
+ <a @click=${this._showLessInfo}>
31
+ ${msg("Text ausblenden", { id: "pd.moreInfo.less" })}
32
+ </a>
33
+ `}
34
+ </p>
35
+ `;
36
+ }
37
+ _showMoreInfo() {
38
+ this._lessInfo = false;
39
+ }
40
+ _showLessInfo() {
41
+ this._lessInfo = true;
42
+ const rect = this.getBoundingClientRect();
43
+ window.scrollBy({
44
+ top: rect.top - 150,
45
+ left: 0,
46
+ behavior: "smooth"
47
+ });
48
+ }
49
+ };
50
+ PdMoreInfo.styles = [
51
+ PdFontStyles,
52
+ css`
53
+ :host {
54
+ display: block;
55
+ }
56
+
57
+ p {
58
+ color: var(--pd-default-font-content-col);
59
+ font-size: var(--pd-default-font-content-size);
60
+ }
61
+
62
+ a {
63
+ cursor: pointer;
64
+ font-family: var(--pd-default-font-link-family);
65
+ font-size: var(--pd-default-font-link-size);
66
+ color: var(--pd-default-font-link-col);
67
+ }
68
+
69
+ a:hover {
70
+ color: var(--pd-default-font-link-col-hover);
71
+ }
72
+ `
73
+ ];
74
+ __decorateClass([
75
+ state()
76
+ ], PdMoreInfo.prototype, "_lessInfo", 2);
77
+ PdMoreInfo = __decorateClass([
78
+ customElement("pd-more-info"),
79
+ localized()
80
+ ], PdMoreInfo);
81
+ export {
82
+ PdMoreInfo
83
+ };
@@ -0,0 +1,17 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class PdPanelViewer extends LitElement {
3
+ withProgress: boolean;
4
+ deltaCalc: number;
5
+ _index: number;
6
+ _panData: any;
7
+ _update: {};
8
+ static styles: import('lit').CSSResult;
9
+ get index(): number;
10
+ set index(value: number);
11
+ render(): import('lit-html').TemplateResult<1>;
12
+ firstUpdated(): void;
13
+ update(changedProperties: any): void;
14
+ next(): void;
15
+ previous(): void;
16
+ }
17
+ //# sourceMappingURL=pd-panel-viewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-panel-viewer.d.ts","sourceRoot":"","sources":["../src/pd-panel-viewer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAM5C,OAAO,0CAA0C,CAAC;AAIlD,qBACa,aAAc,SAAQ,UAAU;IAE3C,YAAY,UAAS;IAGrB,SAAS,SAAK;IAGd,MAAM,SAAK;IAIX,QAAQ,EAAE,GAAG,CAAM;IAGnB,OAAO,KAAM;IAEb,MAAM,CAAC,MAAM,0BAkEX;IAEF,IAAI,KAAK,WAER;IAED,IAAI,KAAK,CAAC,KAAK,QAAA,EAId;IAED,MAAM;IAmCN,YAAY;IAoBZ,MAAM,CAAC,iBAAiB,EAAE,GAAG;IAkC7B,IAAI;IASJ,QAAQ;CAOT"}
@@ -0,0 +1,207 @@
1
+ import { css, LitElement, html } from "lit";
2
+ import { property, customElement } from "lit/decorators.js";
3
+ import { classMap } from "lit/directives/class-map.js";
4
+ import Hammer from "hammerjs";
5
+ import "@progressive-development/pd-icon/pd-icon";
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
+ if (kind && result) __defProp(target, key, result);
14
+ return result;
15
+ };
16
+ let timer;
17
+ let PdPanelViewer = class extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.withProgress = false;
21
+ this.deltaCalc = 3;
22
+ this._index = 0;
23
+ this._panData = {};
24
+ this._update = {};
25
+ }
26
+ get index() {
27
+ return this._index;
28
+ }
29
+ set index(value) {
30
+ this.children[this._index].dispatchEvent(new CustomEvent("exited"));
31
+ this.children[value].dispatchEvent(new CustomEvent("entered"));
32
+ this._index = value;
33
+ }
34
+ render() {
35
+ return html`
36
+ <div class="panel-container">
37
+ <slot></slot>
38
+ <pd-icon
39
+ id="prev"
40
+ icon="previousArrow"
41
+ activeIcon
42
+ ?disabled="${this.index <= 0}"
43
+ @click=${this.previous}
44
+ ></pd-icon>
45
+ <pd-icon
46
+ id="next"
47
+ icon="nextArrow"
48
+ activeIcon
49
+ ?disabled="${this.index === this.children.length - 1}"
50
+ @click=${this.next}
51
+ ></pd-icon>
52
+ </div>
53
+ ${this.withProgress ? html` <div id="progress">
54
+ ${Array.from(this.children).map(
55
+ (childEl, i) => html` <div
56
+ @click="${() => {
57
+ this._index = i;
58
+ }}"
59
+ class=${classMap({ watched: i <= this.index })}
60
+ ></div>`
61
+ )}
62
+ </div>` : ""}
63
+ `;
64
+ }
65
+ firstUpdated() {
66
+ const hammerVal = new Hammer(this);
67
+ hammerVal.on("pan", (panEvent) => {
68
+ this._panData = panEvent;
69
+ });
70
+ const ro = new ResizeObserver((entries) => {
71
+ entries.forEach(() => {
72
+ window.clearTimeout(timer);
73
+ timer = setTimeout(() => {
74
+ this.requestUpdate();
75
+ }, 100);
76
+ });
77
+ });
78
+ ro.observe(this);
79
+ }
80
+ update(changedProperties) {
81
+ const { isFinal = false } = this._panData;
82
+ let { deltaX = 0 } = this._panData;
83
+ const width = this.clientWidth;
84
+ const minScale = 0.8;
85
+ if (!changedProperties.has("_index") && isFinal) {
86
+ if (deltaX > width / this.deltaCalc) {
87
+ this.previous();
88
+ } else if (deltaX < -width / this.deltaCalc) {
89
+ this.next();
90
+ }
91
+ }
92
+ deltaX = isFinal ? 0 : deltaX;
93
+ Array.from(this.children).forEach((el, i) => {
94
+ const x = (i - this.index) * width + deltaX;
95
+ const u = deltaX / width + (i - this.index);
96
+ const v = -Math.abs(u * (1 - minScale)) + 1;
97
+ const scale = Math.max(v, minScale);
98
+ el.style.transform = `translate3d(${x}px,0,0) scale(${scale})`;
99
+ el.style.opacity = scale;
100
+ });
101
+ super.update(changedProperties);
102
+ }
103
+ /* Advance to the next story card if possible */
104
+ next() {
105
+ this.index = Math.max(
106
+ 0,
107
+ Math.min(this.children.length - 1, this.index + 1)
108
+ );
109
+ this._update = false;
110
+ }
111
+ /* Go back to the previous story card if possible */
112
+ previous() {
113
+ this.index = Math.max(
114
+ 0,
115
+ Math.min(this.children.length - 1, this.index - 1)
116
+ );
117
+ this._update = false;
118
+ }
119
+ };
120
+ PdPanelViewer.styles = css`
121
+ :host {
122
+ display: flex;
123
+ flex-direction: column;
124
+ width: 100%;
125
+ max-width: var(--pd-panel-width, 1170px);
126
+ overflow: var(--pd-panel-overflow, hidden);
127
+ background-color: var(--pd-panel-viewer-bg-col);
128
+ }
129
+
130
+ .panel-container {
131
+ position: relative;
132
+ height: var(--pd-panel-height, 60vh);
133
+ width: 100%;
134
+ display: flex;
135
+ flex-direction: column;
136
+ padding: 0 2rem;
137
+ box-sizing: border-box;
138
+ }
139
+
140
+ pd-icon {
141
+ position: absolute;
142
+ top: calc(50% - 25px);
143
+ height: 50px;
144
+ cursor: pointer;
145
+ }
146
+
147
+ #prev {
148
+ left: 0;
149
+ }
150
+
151
+ #next {
152
+ right: 0;
153
+ }
154
+
155
+ #progress {
156
+ position: relative;
157
+ height: 20px;
158
+ width: 50%;
159
+ margin: 0.5rem auto;
160
+ display: grid;
161
+ grid-auto-flow: column;
162
+ grid-auto-columns: 1fr;
163
+ grid-gap: 10px;
164
+ align-content: center;
165
+ align-self: flex-end;
166
+ }
167
+
168
+ #progress > div {
169
+ background: var(--pd-panel-progress-col, grey);
170
+ height: 4px;
171
+ transition: background 0.3s linear;
172
+ cursor: pointer;
173
+ }
174
+
175
+ #progress > div.watched {
176
+ background: var(--pd-panel-progress-col, yellow);
177
+ }
178
+
179
+ ::slotted(*) {
180
+ position: absolute;
181
+ width: 100%;
182
+ height: calc(100%);
183
+ transition: transform 0.35s ease-out;
184
+ left: 0;
185
+ }
186
+ `;
187
+ __decorateClass([
188
+ property({ type: Boolean })
189
+ ], PdPanelViewer.prototype, "withProgress", 2);
190
+ __decorateClass([
191
+ property({ type: Number })
192
+ ], PdPanelViewer.prototype, "deltaCalc", 2);
193
+ __decorateClass([
194
+ property({ type: Number, state: true })
195
+ ], PdPanelViewer.prototype, "_index", 2);
196
+ __decorateClass([
197
+ property({ type: Object, state: true })
198
+ ], PdPanelViewer.prototype, "_panData", 2);
199
+ __decorateClass([
200
+ property({ type: Boolean, state: true })
201
+ ], PdPanelViewer.prototype, "_update", 2);
202
+ PdPanelViewer = __decorateClass([
203
+ customElement("pd-panel-viewer")
204
+ ], PdPanelViewer);
205
+ export {
206
+ PdPanelViewer
207
+ };
@@ -0,0 +1,6 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class PdPanel extends LitElement {
3
+ static styles: import('lit').CSSResult;
4
+ render(): import('lit-html').TemplateResult<1>;
5
+ }
6
+ //# sourceMappingURL=pd-panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-panel.d.ts","sourceRoot":"","sources":["../src/pd-panel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,UAAU,EAAO,MAAM,KAAK,CAAC;AAG5C,qBACa,OAAQ,SAAQ,UAAU;IACrC,MAAM,CAAC,MAAM,0BAsBX;IAEF,MAAM;CAOP"}
@@ -0,0 +1,48 @@
1
+ import { css, LitElement, html } from "lit";
2
+ import { customElement } from "lit/decorators.js";
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __decorateClass = (decorators, target, key, kind) => {
5
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
6
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
7
+ if (decorator = decorators[i])
8
+ result = decorator(result) || result;
9
+ return result;
10
+ };
11
+ let PdPanel = class extends LitElement {
12
+ render() {
13
+ return html`
14
+ <div id="content">
15
+ <slot></slot>
16
+ </div>
17
+ `;
18
+ }
19
+ };
20
+ PdPanel.styles = css`
21
+ :host {
22
+ background: var(--pd-panel-bg, #afc1d2);
23
+ border-radius: var(--pd-panel-border-radius, 0.2em);
24
+ }
25
+
26
+ /* Default styles for content */
27
+ #content {
28
+ position: absolute;
29
+ top: 0;
30
+ right: 0;
31
+ bottom: 0;
32
+ left: 0;
33
+ padding: 2rem;
34
+ display: flex;
35
+ flex-direction: column;
36
+ align-items: center;
37
+ justify-content: flex-start;
38
+ }
39
+ #content > slot::slotted(*) {
40
+ margin: 0;
41
+ }
42
+ `;
43
+ PdPanel = __decorateClass([
44
+ customElement("pd-panel")
45
+ ], PdPanel);
46
+ export {
47
+ PdPanel
48
+ };
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * Komponente zur responsiven Darstellung von Inhalten.
4
+ * Wenn die Bildschirmbreite unter `resizeWidth` liegt, wird ein Popup angezeigt.
5
+ *
6
+ * @fires book-date – Wenn ein freier Termin ausgewählt wird (nicht aktiv)
7
+ * @fires edit-selection – Wenn der Nutzer Datum oder PLZ bearbeiten möchte (nicht aktiv)
8
+ *
9
+ * @slot resize-content - Der Hauptinhalt, der bei ausreichender Breite direkt angezeigt wird.
10
+ * @slot preview-content - Der Vorschauinhalt, der im Popup angezeigt wird, wenn die Breite nicht ausreicht.
11
+ */
12
+ export declare class PdResizeContent extends LitElement {
13
+ /**
14
+ * Minimale Breite, ab der der Inhalt direkt dargestellt wird. Darunter erscheint ein Popup.
15
+ */
16
+ resizeWidth: string;
17
+ /**
18
+ * Interner Zustand: Gibt an, ob der Inhalt versteckt werden soll und stattdessen ein Popup angezeigt wird.
19
+ */
20
+ private _hideContent;
21
+ static styles: import('lit').CSSResult;
22
+ connectedCallback(): void;
23
+ protected render(): import('lit-html').TemplateResult<1>;
24
+ }
25
+ //# sourceMappingURL=pd-resize-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-resize-content.d.ts","sourceRoot":"","sources":["../src/pd-resize-content.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,OAAO,6CAA6C,CAAC;AAErD;;;;;;;;;GASG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C;;OAEG;IAEH,WAAW,SAAY;IAEvB;;OAEG;IAEH,OAAO,CAAC,YAAY,CAAS;IAE7B,MAAM,CAAC,MAAM,0BAaX;IAEF,iBAAiB,IAAI,IAAI;IAUzB,SAAS,CAAC,MAAM;CAUjB"}
@@ -1,4 +1,64 @@
1
- import { PdResizeContent } from "./src/PdResizeContent.js";
2
- if (!customElements.get("pd-resize-content")) {
3
- window.customElements.define("pd-resize-content", PdResizeContent);
4
- }
1
+ import { css, LitElement, html } from "lit";
2
+ import { property, state, customElement } from "lit/decorators.js";
3
+ import { installMediaQueryWatcher } from "pwa-helpers/media-query.js";
4
+ import "@progressive-development/pd-dialog/pd-popup";
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12
+ if (kind && result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ let PdResizeContent = class extends LitElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.resizeWidth = "1232px";
19
+ this._hideContent = false;
20
+ }
21
+ connectedCallback() {
22
+ super.connectedCallback();
23
+ installMediaQueryWatcher(
24
+ `(min-width: ${this.resizeWidth})`,
25
+ (matches) => {
26
+ this._hideContent = !matches;
27
+ }
28
+ );
29
+ }
30
+ render() {
31
+ return this._hideContent ? html`
32
+ <pd-popup>
33
+ <div slot="small-view"><slot name="preview-content"></slot></div>
34
+ <div slot="content"><slot name="resize-content"></slot></div>
35
+ </pd-popup>
36
+ ` : html`<slot name="resize-content"></slot>`;
37
+ }
38
+ };
39
+ PdResizeContent.styles = css`
40
+ :host {
41
+ display: block;
42
+ }
43
+
44
+ h3 {
45
+ color: #084c61;
46
+ font-family: Oswald;
47
+ }
48
+
49
+ p {
50
+ color: #084c61;
51
+ }
52
+ `;
53
+ __decorateClass([
54
+ property({ type: String })
55
+ ], PdResizeContent.prototype, "resizeWidth", 2);
56
+ __decorateClass([
57
+ state()
58
+ ], PdResizeContent.prototype, "_hideContent", 2);
59
+ PdResizeContent = __decorateClass([
60
+ customElement("pd-resize-content")
61
+ ], PdResizeContent);
62
+ export {
63
+ PdResizeContent
64
+ };
@@ -0,0 +1,19 @@
1
+ import { LitElement, CSSResultGroup } from 'lit';
2
+ export interface TabHeader {
3
+ key: string;
4
+ name: string;
5
+ disabled?: boolean;
6
+ pdIcon?: string;
7
+ otherIcon?: any;
8
+ }
9
+ export declare class PdTab extends LitElement {
10
+ tabs: TabHeader[];
11
+ defaultTab?: string;
12
+ _activeTab?: string;
13
+ static styles: CSSResultGroup;
14
+ protected update(changedProperties: any): void;
15
+ render(): import('lit-html').TemplateResult<1>;
16
+ reset(): void;
17
+ private _tabSelected;
18
+ }
19
+ //# sourceMappingURL=pd-tab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-tab.d.ts","sourceRoot":"","sources":["../src/pd-tab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAO,cAAc,EAAE,MAAM,KAAK,CAAC;AAO5D,OAAO,0CAA0C,CAAC;AAElD,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB;AAED,qBACa,KAAM,SAAQ,UAAU;IAEnC,IAAI,EAAE,SAAS,EAAE,CAAM;IAGvB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,MAAM,CAAC,MAAM,EAmGR,cAAc,CAAC;IAEpB,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,GAAG,GAAG,IAAI;IAQ9C,MAAM;IAgCN,KAAK;IAKL,OAAO,CAAC,YAAY;CAQrB"}
package/dist/pd-tab.js ADDED
@@ -0,0 +1,182 @@
1
+ import { css, LitElement, html } from "lit";
2
+ import { property, customElement } from "lit/decorators.js";
3
+ import { PdColorStyles, PdFontStyles } from "@progressive-development/pd-shared-styles";
4
+ import "@progressive-development/pd-icon/pd-icon";
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12
+ if (kind && result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ let PdTab = class extends LitElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.tabs = [];
19
+ }
20
+ update(changedProperties) {
21
+ if (changedProperties.has("defaultTab") && this.defaultTab) {
22
+ console.log("PdTab: Set active from default selection", this.defaultTab);
23
+ this._activeTab = this.defaultTab;
24
+ }
25
+ super.update(changedProperties);
26
+ }
27
+ render() {
28
+ return html`
29
+ <div class="header-container">
30
+ ${this.tabs.map(
31
+ (t) => html`
32
+ <div
33
+ class="tab-header ${this._activeTab === t.key ? "active-header" : ""} ${t.disabled ? "disabled-header" : ""}"
34
+ data-key="${t.key}"
35
+ @click="${this._tabSelected}"
36
+ >
37
+ ${t.name}
38
+ </div>
39
+ `
40
+ )}
41
+ </div>
42
+ ${this.tabs.map(
43
+ (t) => html`
44
+ <div
45
+ id="${`slot${t.key}`}"
46
+ class="slot-container ${this._activeTab === t.key ? "active-slot" : ""}"
47
+ >
48
+ <slot name="${t.key}"></slot>
49
+ </div>
50
+ `
51
+ )}
52
+ `;
53
+ }
54
+ reset() {
55
+ this._activeTab = this.defaultTab;
56
+ }
57
+ // eslint-disable-next-line class-methods-use-this
58
+ _tabSelected(e) {
59
+ var _a, _b;
60
+ this._activeTab = (_b = (_a = e.target) == null ? void 0 : _a.dataset) == null ? void 0 : _b.key;
61
+ this.dispatchEvent(
62
+ new CustomEvent("tab-selected", {
63
+ detail: this._activeTab
64
+ })
65
+ );
66
+ }
67
+ };
68
+ PdTab.styles = [
69
+ PdColorStyles,
70
+ PdFontStyles,
71
+ css`
72
+ :host {
73
+ display: block;
74
+ }
75
+
76
+ .header-container {
77
+ display: flex;
78
+ }
79
+
80
+ .tab-header {
81
+ padding: var(--pd-tab-header-padding, 0.8em 1.5em);
82
+ background-color: var(--pd-tab-bg-col, var(--pd-default-light-col));
83
+ font-family: var(--pd-default-font-title-family);
84
+ color: var(--pd-tab-text-col, var(--pd-default-font-title-col));
85
+ cursor: pointer;
86
+ border: 2px solid var(--pd-tab-border-col, #ccc); /* Dünner Rahmen */
87
+ border-bottom: none; /* Tabs sollen nahtlos an den Inhalt anschließen */
88
+ border-radius: 8px 8px 0 0; /* Abgerundete obere Ecken */
89
+ display: inline-block; /* Tabs nebeneinander anzeigen */
90
+ margin-right: 5px; /* Abstand zwischen Tabs */
91
+ box-shadow: var(
92
+ --pd-tab-shadow,
93
+ 0 2px 4px rgba(0, 0, 0, 0.1)
94
+ ); /* Leichter Schatten für Tiefe */
95
+ transition:
96
+ background-color 0.3s,
97
+ box-shadow 0.3s; /* Weiche Übergänge bei Hover */
98
+ }
99
+
100
+ .tab-header:hover {
101
+ background-color: var(
102
+ --pd-tab-bg-hover-col,
103
+ var(--pd-default-hover-col)
104
+ );
105
+ box-shadow: var(
106
+ --pd-tab-shadow-hover,
107
+ 0 4px 8px rgba(0, 0, 0, 0.2)
108
+ ); /* Schattenintensität bei Hover erhöhen */
109
+ }
110
+
111
+ .tab-header.active-header {
112
+ background-color: var(--pd-tab-bg-active-col, var(--pd-default-col));
113
+ border-bottom: 2px solid
114
+ var(--pd-tab-border-active-col, var(--pd-default-col));
115
+ color: var(
116
+ --pd-tab-active-text-col,
117
+ var(--pd-default-bg-col)
118
+ ); /* Textfarbe für aktiven Tab */
119
+ box-shadow: none; /* Schatten entfernen, wenn Tab aktiv ist */
120
+ }
121
+
122
+ .tab-header.disabled-header {
123
+ background-color: var(--pd-tab-bg-active-col, var(--pd-default-col));
124
+ border-bottom: 2px solid
125
+ var(--pd-tab-border-active-col, var(--pd-default-col));
126
+ color: var(
127
+ --pd-tab-active-text-col,
128
+ var(--pd-default-bg-col)
129
+ ); /* Textfarbe für aktiven Tab */
130
+ box-shadow: none; /* Schatten entfernen, wenn Tab aktiv ist */
131
+ }
132
+
133
+ .tab-header.disabled-header {
134
+ pointer-events: none; /* Deaktiviert die Klickbarkeit */
135
+ background-color: var(
136
+ --pd-tab-disabled-bg-col,
137
+ #f0f0f0
138
+ ); /* Hellere Farbe für deaktivierte Tabs */
139
+ color: var(--pd-tab-disabled-text-col, #999); /* Hellere Textfarbe */
140
+ border-color: var(
141
+ --pd-tab-disabled-border-col,
142
+ #ddd
143
+ ); /* Angepasste Rahmenfarbe */
144
+ cursor: not-allowed; /* Zeigt an, dass der Tab nicht interaktiv ist */
145
+ opacity: 0.6; /* Reduziert die Sichtbarkeit für einen "deaktivierten" Look */
146
+ }
147
+
148
+ .tab-header:focus {
149
+ outline: none; /* Entfernt den Standardfokusrahmen */
150
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5); /* Fokusring für Tastaturnavigation */
151
+ }
152
+
153
+ .slot-container {
154
+ display: none;
155
+ }
156
+
157
+ .active-slot {
158
+ padding: var(--pd-tab-content-padding, 1em);
159
+ display: block;
160
+ border: var(--pd-tab-content-border, 1px solid var(--pd-default-col));
161
+ border-top: var(
162
+ --pd-tab-content-border-top,
163
+ 3px solid var(--pd-default-col)
164
+ );
165
+ }
166
+ `
167
+ ];
168
+ __decorateClass([
169
+ property({ type: Array })
170
+ ], PdTab.prototype, "tabs", 2);
171
+ __decorateClass([
172
+ property({ type: String })
173
+ ], PdTab.prototype, "defaultTab", 2);
174
+ __decorateClass([
175
+ property({ type: String, state: true })
176
+ ], PdTab.prototype, "_activeTab", 2);
177
+ PdTab = __decorateClass([
178
+ customElement("pd-tab")
179
+ ], PdTab);
180
+ export {
181
+ PdTab
182
+ };
@@ -0,0 +1,10 @@
1
+ import { StoryObj } from '@storybook/web-components';
2
+ declare const meta: {
3
+ title: string;
4
+ component: string;
5
+ render: () => import('lit-html').TemplateResult<1>;
6
+ };
7
+ export default meta;
8
+ type Story = StoryObj;
9
+ export declare const BoxView: Story;
10
+ //# sourceMappingURL=pd-box-view.stories.d.ts.map