@progressive-development/pd-dialog 1.0.3 → 1.1.0
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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/pd-assistant-dialog/PdAssistantDialog.d.ts +46 -0
- package/dist/pd-assistant-dialog/PdAssistantDialog.d.ts.map +1 -0
- package/dist/pd-assistant-dialog/PdAssistantDialog.js +193 -0
- package/dist/pd-assistant-dialog/pd-assistant-dialog.d.ts +3 -0
- package/dist/pd-assistant-dialog/pd-assistant-dialog.d.ts.map +1 -0
- package/dist/pd-assistant-dialog.d.ts +2 -0
- package/dist/pd-assistant-dialog.js +8 -0
- package/dist/pd-assistant-input-bar/PdAssistantInputBar.d.ts +30 -0
- package/dist/pd-assistant-input-bar/PdAssistantInputBar.d.ts.map +1 -0
- package/dist/pd-assistant-input-bar/PdAssistantInputBar.js +100 -0
- package/dist/pd-assistant-input-bar/pd-assistant-input-bar.d.ts +3 -0
- package/dist/pd-assistant-input-bar/pd-assistant-input-bar.d.ts.map +1 -0
- package/dist/pd-assistant-input-bar.d.ts +2 -0
- package/dist/pd-assistant-input-bar.js +8 -0
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export { BUTTON_KEY_CANCEL, BUTTON_KEY_CONFIRM, EVENT_CONFIRM, EVENT_CANCEL, } f
|
|
|
6
6
|
export type { PdDialogType } from './pd-confirm-dialog/pd-confirm-dialog.js';
|
|
7
7
|
export { PdFormDialog } from './pd-form-dialog/pd-form-dialog.js';
|
|
8
8
|
export { EVENT_FORM_SUBMIT } from './pd-form-dialog/pd-form-dialog.js';
|
|
9
|
+
export { PdAssistantInputBar } from './pd-assistant-input-bar/pd-assistant-input-bar.js';
|
|
10
|
+
export { PdAssistantDialog } from './pd-assistant-dialog/pd-assistant-dialog.js';
|
|
9
11
|
export type { PdDialogButton, PdSubmitDialogProps, PdSubmitDialogStatus, } from './types.js';
|
|
10
12
|
export { templates as beTemplates } from './generated/locales/be.js';
|
|
11
13
|
export { templates as deTemplates } from './generated/locales/de.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAGxE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,0CAA0C,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAGxE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,0CAA0C,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAGjF,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,13 @@ import './pd-popup-dialog.js';
|
|
|
3
3
|
import './pd-submit-dialog.js';
|
|
4
4
|
export { BUTTON_KEY_CANCEL, BUTTON_KEY_CONFIRM, EVENT_CANCEL, EVENT_CONFIRM, PdConfirmDialog } from './pd-confirm-dialog/PdConfirmDialog.js';
|
|
5
5
|
export { EVENT_FORM_SUBMIT, PdFormDialog } from './pd-form-dialog/PdFormDialog.js';
|
|
6
|
+
import './pd-assistant-input-bar.js';
|
|
7
|
+
import './pd-assistant-dialog.js';
|
|
6
8
|
export { templates as beTemplates } from './locales/be.js';
|
|
7
9
|
export { templates as deTemplates } from './locales/de.js';
|
|
8
10
|
export { templates as enTemplates } from './locales/en.js';
|
|
11
|
+
export { PdAssistantDialog } from './pd-assistant-dialog/PdAssistantDialog.js';
|
|
12
|
+
export { PdAssistantInputBar } from './pd-assistant-input-bar/PdAssistantInputBar.js';
|
|
9
13
|
export { PdPopup } from './pd-popup/PdPopup.js';
|
|
10
14
|
export { PdPopupDialog } from './pd-popup-dialog/PdPopupDialog.js';
|
|
11
15
|
export { PdSubmitDialog } from './pd-submit-dialog/PdSubmitDialog.js';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LitElement, CSSResultGroup, PropertyValues } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Assistant-style dialog shell with header, scrollable content area, and input bar footer.
|
|
4
|
+
* Wraps pd-popup via composition. Reusable for AI chat, image search, etc.
|
|
5
|
+
*
|
|
6
|
+
* @tagname pd-assistant-dialog
|
|
7
|
+
* @summary Assistant dialog with header, content slot, and input bar.
|
|
8
|
+
*
|
|
9
|
+
* @event pd-assistant-dialog-close - Fired when dialog is closed.
|
|
10
|
+
* @event pd-assistant-submit - Bubbles from the input bar on submit.
|
|
11
|
+
*
|
|
12
|
+
* @slot - Default slot for main content (results, messages, etc.).
|
|
13
|
+
*
|
|
14
|
+
* @cssprop --pd-assistant-dialog-width - Dialog width. Default: `min(520px, 90vw)`.
|
|
15
|
+
* @cssprop --pd-assistant-dialog-content-min-height - Min content height. Default: `120px`.
|
|
16
|
+
* @cssprop --pd-assistant-dialog-content-max-height - Max content height. Default: `50vh`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class PdAssistantDialog extends LitElement {
|
|
19
|
+
/** Whether the dialog is open. Reactive — controls pd-popup visibility. */
|
|
20
|
+
open: boolean;
|
|
21
|
+
/** Dialog title shown in the header. */
|
|
22
|
+
dialogTitle: string;
|
|
23
|
+
/** Icon displayed next to the title. */
|
|
24
|
+
dialogIcon: string;
|
|
25
|
+
/** Placeholder for the input bar. */
|
|
26
|
+
inputPlaceholder: string;
|
|
27
|
+
/** Button text for the input bar. */
|
|
28
|
+
inputButtonText: string;
|
|
29
|
+
/** Disable the input bar. */
|
|
30
|
+
inputDisabled: boolean;
|
|
31
|
+
/** Hide the input bar entirely. */
|
|
32
|
+
hideInput: boolean;
|
|
33
|
+
private _popup;
|
|
34
|
+
static styles: CSSResultGroup;
|
|
35
|
+
updated(changed: PropertyValues<this>): void;
|
|
36
|
+
render(): import('lit').TemplateResult<1>;
|
|
37
|
+
/** Open the dialog. */
|
|
38
|
+
show(): void;
|
|
39
|
+
/** Close the dialog. */
|
|
40
|
+
hide(): void;
|
|
41
|
+
/** Clear the input bar value. */
|
|
42
|
+
clearInput(): void;
|
|
43
|
+
private _onPopupClose;
|
|
44
|
+
private _onCloseKeyDown;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=PdAssistantDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdAssistantDialog.d.ts","sourceRoot":"","sources":["../../src/pd-assistant-dialog/PdAssistantDialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,UAAU,EAIV,cAAc,EACd,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAIb,OAAO,0CAA0C,CAAC;AAGlD,OAAO,yBAAyB,CAAC;AAEjC,OAAO,qDAAqD,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,2EAA2E;IAE3E,IAAI,UAAS;IAEb,wCAAwC;IAExC,WAAW,SAAM;IAEjB,wCAAwC;IAExC,UAAU,SAAM;IAEhB,qCAAqC;IAErC,gBAAgB,SAA6B;IAE7C,qCAAqC;IAErC,eAAe,SAAY;IAE3B,6BAA6B;IAE7B,aAAa,UAAS;IAEtB,mCAAmC;IAEnC,SAAS,UAAS;IAGlB,OAAO,CAAC,MAAM,CAAW;IAEzB,OAAgB,MAAM,EAAE,cAAc,CAsDpC;IAEO,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAU5C,MAAM;IAgDf,uBAAuB;IAChB,IAAI,IAAI,IAAI;IAInB,wBAAwB;IACjB,IAAI,IAAI,IAAI;IAInB,iCAAiC;IAC1B,UAAU,IAAI,IAAI;IAOzB,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,eAAe;CAMxB"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { LitElement, css, nothing, html } from 'lit';
|
|
2
|
+
import { property, query } from 'lit/decorators.js';
|
|
3
|
+
import { pdIcons } from '@progressive-development/pd-icon';
|
|
4
|
+
import '@progressive-development/pd-icon/pd-icon';
|
|
5
|
+
import '../pd-popup.js';
|
|
6
|
+
import '../pd-assistant-input-bar.js';
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = void 0 ;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (decorator(target, key, result) ) || result;
|
|
14
|
+
if (result) __defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
class PdAssistantDialog extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.open = false;
|
|
21
|
+
this.dialogTitle = "";
|
|
22
|
+
this.dialogIcon = "";
|
|
23
|
+
this.inputPlaceholder = "Suchbegriff eingeben...";
|
|
24
|
+
this.inputButtonText = "Suchen";
|
|
25
|
+
this.inputDisabled = false;
|
|
26
|
+
this.hideInput = false;
|
|
27
|
+
}
|
|
28
|
+
static {
|
|
29
|
+
this.styles = css`
|
|
30
|
+
:host {
|
|
31
|
+
display: contents;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
pd-popup {
|
|
35
|
+
--pd-popup-width: var(--pd-assistant-dialog-width, min(520px, 90vw));
|
|
36
|
+
--pd-popup-max-width: var(--pd-assistant-dialog-width, min(520px, 90vw));
|
|
37
|
+
--pd-popup-modal-padding: 0;
|
|
38
|
+
--pd-popup-modal-padding-bottom: 0;
|
|
39
|
+
--pd-popup-modal-padding-top: 10vh;
|
|
40
|
+
--pd-popup-border-radius: 12px;
|
|
41
|
+
--pd-popup-modal-slot-max-width: 100%;
|
|
42
|
+
--pd-popup-modal-slot-margin: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dialog-header {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
padding: 16px 20px;
|
|
50
|
+
border-bottom: 1px solid var(--pd-default-light-col, #e0e0e0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.dialog-header h3 {
|
|
54
|
+
margin: 0;
|
|
55
|
+
font-size: 1rem;
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
flex: 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.dialog-header .header-icon {
|
|
61
|
+
--pd-icon-size: 1.25rem;
|
|
62
|
+
color: var(--pd-default-col, #0066cc);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.close-icon {
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
--pd-icon-size: 1.25rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.close-icon:focus {
|
|
71
|
+
outline: 2px solid var(--pd-default-col);
|
|
72
|
+
outline-offset: 2px;
|
|
73
|
+
border-radius: var(--pd-radius-sm, 2px);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.dialog-content {
|
|
77
|
+
flex: 1;
|
|
78
|
+
overflow-y: auto;
|
|
79
|
+
min-height: var(--pd-assistant-dialog-content-min-height, 120px);
|
|
80
|
+
max-height: var(--pd-assistant-dialog-content-max-height, 50vh);
|
|
81
|
+
padding: 16px 20px;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
updated(changed) {
|
|
86
|
+
if (changed.has("open")) {
|
|
87
|
+
if (this.open) {
|
|
88
|
+
this._popup?.showPopup();
|
|
89
|
+
} else {
|
|
90
|
+
this._popup?.hidePopup();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
return html`
|
|
96
|
+
<pd-popup
|
|
97
|
+
closeByEscape
|
|
98
|
+
closeByBackdrop
|
|
99
|
+
blockScroll
|
|
100
|
+
hideCloseIcon
|
|
101
|
+
popupLabel="${this.dialogTitle}"
|
|
102
|
+
@popup-close="${this._onPopupClose}"
|
|
103
|
+
>
|
|
104
|
+
<div slot="content">
|
|
105
|
+
<div class="dialog-header">
|
|
106
|
+
${this.dialogIcon ? html`<pd-icon
|
|
107
|
+
class="header-icon"
|
|
108
|
+
.icon="${this.dialogIcon}"
|
|
109
|
+
></pd-icon>` : nothing}
|
|
110
|
+
<h3>${this.dialogTitle}</h3>
|
|
111
|
+
<pd-icon
|
|
112
|
+
class="close-icon"
|
|
113
|
+
.icon="${pdIcons.ICON_CLOSE}"
|
|
114
|
+
tabindex="0"
|
|
115
|
+
role="button"
|
|
116
|
+
aria-label="Schließen"
|
|
117
|
+
@click="${this.hide}"
|
|
118
|
+
@keydown="${this._onCloseKeyDown}"
|
|
119
|
+
></pd-icon>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div class="dialog-content">
|
|
123
|
+
<slot></slot>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
${this.hideInput ? nothing : html`
|
|
127
|
+
<pd-assistant-input-bar
|
|
128
|
+
placeholder="${this.inputPlaceholder}"
|
|
129
|
+
buttonText="${this.inputButtonText}"
|
|
130
|
+
?disabled="${this.inputDisabled}"
|
|
131
|
+
></pd-assistant-input-bar>
|
|
132
|
+
`}
|
|
133
|
+
</div>
|
|
134
|
+
</pd-popup>
|
|
135
|
+
`;
|
|
136
|
+
}
|
|
137
|
+
/** Open the dialog. */
|
|
138
|
+
show() {
|
|
139
|
+
this.open = true;
|
|
140
|
+
}
|
|
141
|
+
/** Close the dialog. */
|
|
142
|
+
hide() {
|
|
143
|
+
this.open = false;
|
|
144
|
+
}
|
|
145
|
+
/** Clear the input bar value. */
|
|
146
|
+
clearInput() {
|
|
147
|
+
const inputBar = this.renderRoot.querySelector(
|
|
148
|
+
"pd-assistant-input-bar"
|
|
149
|
+
);
|
|
150
|
+
inputBar?.clear();
|
|
151
|
+
}
|
|
152
|
+
_onPopupClose() {
|
|
153
|
+
this.open = false;
|
|
154
|
+
this.dispatchEvent(
|
|
155
|
+
new CustomEvent("pd-assistant-dialog-close", {
|
|
156
|
+
bubbles: true,
|
|
157
|
+
composed: true
|
|
158
|
+
})
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
_onCloseKeyDown(e) {
|
|
162
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
this.hide();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
__decorateClass([
|
|
169
|
+
property({ type: Boolean, reflect: true })
|
|
170
|
+
], PdAssistantDialog.prototype, "open");
|
|
171
|
+
__decorateClass([
|
|
172
|
+
property({ type: String })
|
|
173
|
+
], PdAssistantDialog.prototype, "dialogTitle");
|
|
174
|
+
__decorateClass([
|
|
175
|
+
property({ type: String })
|
|
176
|
+
], PdAssistantDialog.prototype, "dialogIcon");
|
|
177
|
+
__decorateClass([
|
|
178
|
+
property({ type: String })
|
|
179
|
+
], PdAssistantDialog.prototype, "inputPlaceholder");
|
|
180
|
+
__decorateClass([
|
|
181
|
+
property({ type: String })
|
|
182
|
+
], PdAssistantDialog.prototype, "inputButtonText");
|
|
183
|
+
__decorateClass([
|
|
184
|
+
property({ type: Boolean })
|
|
185
|
+
], PdAssistantDialog.prototype, "inputDisabled");
|
|
186
|
+
__decorateClass([
|
|
187
|
+
property({ type: Boolean })
|
|
188
|
+
], PdAssistantDialog.prototype, "hideInput");
|
|
189
|
+
__decorateClass([
|
|
190
|
+
query("pd-popup")
|
|
191
|
+
], PdAssistantDialog.prototype, "_popup");
|
|
192
|
+
|
|
193
|
+
export { PdAssistantDialog };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-assistant-dialog.d.ts","sourceRoot":"","sources":["../../src/pd-assistant-dialog/pd-assistant-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAO3D,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LitElement, CSSResultGroup } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Input bar for assistant-style dialogs (search, chat).
|
|
4
|
+
*
|
|
5
|
+
* @tagname pd-assistant-input-bar
|
|
6
|
+
* @summary Text input with submit button for assistant dialogs.
|
|
7
|
+
*
|
|
8
|
+
* @event pd-assistant-submit - Fired on submit. Detail: `{ value: string }`.
|
|
9
|
+
*
|
|
10
|
+
* @cssprop --pd-assistant-input-bar-gap - Gap between input and button. Default: `8px`.
|
|
11
|
+
* @cssprop --pd-assistant-input-bar-padding - Bar padding. Default: `12px 20px 16px`.
|
|
12
|
+
*/
|
|
13
|
+
export declare class PdAssistantInputBar extends LitElement {
|
|
14
|
+
/** Placeholder text for the input field. */
|
|
15
|
+
placeholder: string;
|
|
16
|
+
/** Icon for the submit button. */
|
|
17
|
+
buttonIcon: any;
|
|
18
|
+
/** Button label text (shown if no icon, or as tooltip). */
|
|
19
|
+
buttonText: string;
|
|
20
|
+
/** Disable the input bar. */
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
private _value;
|
|
23
|
+
static styles: CSSResultGroup;
|
|
24
|
+
render(): import('lit').TemplateResult<1>;
|
|
25
|
+
private _onInputChange;
|
|
26
|
+
private _onSubmit;
|
|
27
|
+
/** Clear the input field. */
|
|
28
|
+
clear(): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=PdAssistantInputBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdAssistantInputBar.d.ts","sourceRoot":"","sources":["../../src/pd-assistant-input-bar/PdAssistantInputBar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5D,OAAO,0CAA0C,CAAC;AAClD,OAAO,4CAA4C,CAAC;AACpD,OAAO,6CAA6C,CAAC;AAErD;;;;;;;;;;GAUG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IACjD,4CAA4C;IAE5C,WAAW,SAA6B;IAExC,kCAAkC;IAElC,UAAU,MAAuB;IAEjC,2DAA2D;IAE3D,UAAU,SAAY;IAEtB,6BAA6B;IAE7B,QAAQ,UAAS;IAER,OAAO,CAAC,MAAM,CAAM;IAE7B,OAAgB,MAAM,EAAE,cAAc,CAiBpC;IAEO,MAAM;IAoBf,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,SAAS;IAajB,6BAA6B;IACtB,KAAK,IAAI,IAAI;CAGrB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { pdIcons } from '@progressive-development/pd-icon';
|
|
4
|
+
import '@progressive-development/pd-icon/pd-icon';
|
|
5
|
+
import '@progressive-development/pd-forms/pd-input';
|
|
6
|
+
import '@progressive-development/pd-forms/pd-button';
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = void 0 ;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (decorator(target, key, result) ) || result;
|
|
14
|
+
if (result) __defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
class PdAssistantInputBar extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.placeholder = "Suchbegriff eingeben...";
|
|
21
|
+
this.buttonIcon = pdIcons.ICON_SEARCH;
|
|
22
|
+
this.buttonText = "Suchen";
|
|
23
|
+
this.disabled = false;
|
|
24
|
+
this._value = "";
|
|
25
|
+
}
|
|
26
|
+
static {
|
|
27
|
+
this.styles = css`
|
|
28
|
+
:host {
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.input-row {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: var(--pd-assistant-input-bar-gap, 8px);
|
|
35
|
+
padding: var(--pd-assistant-input-bar-padding, 12px 20px 16px);
|
|
36
|
+
border-top: 1px solid var(--pd-default-light-col, #e0e0e0);
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.input-row pd-input {
|
|
41
|
+
flex: 1;
|
|
42
|
+
--pd-input-field-width: 100%;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return html`
|
|
48
|
+
<div class="input-row">
|
|
49
|
+
<pd-input
|
|
50
|
+
placeHolder="${this.placeholder}"
|
|
51
|
+
.value="${this._value}"
|
|
52
|
+
?disabled="${this.disabled}"
|
|
53
|
+
@pd-form-element-change="${this._onInputChange}"
|
|
54
|
+
@enter-pressed="${this._onSubmit}"
|
|
55
|
+
></pd-input>
|
|
56
|
+
<pd-button
|
|
57
|
+
text="${this.buttonText}"
|
|
58
|
+
primary
|
|
59
|
+
?disabled="${this.disabled || !this._value.trim()}"
|
|
60
|
+
@button-clicked="${this._onSubmit}"
|
|
61
|
+
></pd-button>
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
_onInputChange(e) {
|
|
66
|
+
this._value = e.detail.value;
|
|
67
|
+
}
|
|
68
|
+
_onSubmit() {
|
|
69
|
+
const value = this._value.trim();
|
|
70
|
+
if (!value || this.disabled) return;
|
|
71
|
+
this.dispatchEvent(
|
|
72
|
+
new CustomEvent("pd-assistant-submit", {
|
|
73
|
+
bubbles: true,
|
|
74
|
+
composed: true,
|
|
75
|
+
detail: { value }
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
/** Clear the input field. */
|
|
80
|
+
clear() {
|
|
81
|
+
this._value = "";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
__decorateClass([
|
|
85
|
+
property({ type: String })
|
|
86
|
+
], PdAssistantInputBar.prototype, "placeholder");
|
|
87
|
+
__decorateClass([
|
|
88
|
+
property({ type: String })
|
|
89
|
+
], PdAssistantInputBar.prototype, "buttonIcon");
|
|
90
|
+
__decorateClass([
|
|
91
|
+
property({ type: String })
|
|
92
|
+
], PdAssistantInputBar.prototype, "buttonText");
|
|
93
|
+
__decorateClass([
|
|
94
|
+
property({ type: Boolean })
|
|
95
|
+
], PdAssistantInputBar.prototype, "disabled");
|
|
96
|
+
__decorateClass([
|
|
97
|
+
state()
|
|
98
|
+
], PdAssistantInputBar.prototype, "_value");
|
|
99
|
+
|
|
100
|
+
export { PdAssistantInputBar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-assistant-input-bar.d.ts","sourceRoot":"","sources":["../../src/pd-assistant-input-bar/pd-assistant-input-bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAO/D,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progressive-development/pd-dialog",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Progressive Development dialog components.",
|
|
5
5
|
"author": "PD Progressive Development",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"./pd-popup-dialog": "./dist/pd-popup-dialog.js",
|
|
17
17
|
"./pd-popup": "./dist/pd-popup.js",
|
|
18
18
|
"./pd-submit-dialog": "./dist/pd-submit-dialog.js",
|
|
19
|
+
"./pd-assistant-input-bar": "./dist/pd-assistant-input-bar.js",
|
|
20
|
+
"./pd-assistant-dialog": "./dist/pd-assistant-dialog.js",
|
|
19
21
|
"./locales/be": "./dist/locales/be.js",
|
|
20
22
|
"./locales/de": "./dist/locales/de.js",
|
|
21
23
|
"./locales/en": "./dist/locales/en.js"
|
|
@@ -30,10 +32,10 @@
|
|
|
30
32
|
"lit": "^3.3.1",
|
|
31
33
|
"@lit/localize": "^0.12.2",
|
|
32
34
|
"tslib": "^2.8.1",
|
|
33
|
-
"@progressive-development/pd-shared-styles": "0.
|
|
34
|
-
"@progressive-development/pd-
|
|
35
|
-
"@progressive-development/pd-
|
|
36
|
-
"@progressive-development/pd-forms": "1.0
|
|
35
|
+
"@progressive-development/pd-shared-styles": "0.4.0",
|
|
36
|
+
"@progressive-development/pd-price": "1.0.2",
|
|
37
|
+
"@progressive-development/pd-icon": "1.1.0",
|
|
38
|
+
"@progressive-development/pd-forms": "1.1.0"
|
|
37
39
|
},
|
|
38
40
|
"customElements": "custom-elements.json",
|
|
39
41
|
"keywords": [
|