@shoper/phoenix_design_system 1.2.3 → 1.2.5-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.
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file.js +69 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file_model.js +16 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file_model.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js +183 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_constants.js +37 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_label.js +53 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_label.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/input/input_constants.js +2 -1
- package/build/cjs/packages/phoenix/src/components/form/input/input_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select.js +11 -5
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js +2 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js +5 -3
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js.map +1 -1
- package/build/cjs/packages/phoenix/src/index.js +27 -6
- package/build/cjs/packages/phoenix/src/index.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.d.ts +11 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.js +67 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.d.ts +7 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.js +12 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.d.ts +32 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js +181 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.d.ts +27 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js +29 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.d.ts +11 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.js +51 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_types.d.ts +6 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_types.js +2 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/input/input_constants.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/input/input_constants.js +2 -1
- package/build/esm/packages/phoenix/src/components/form/input/input_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select.js +11 -5
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.js +2 -1
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js +5 -3
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js.map +1 -1
- package/build/esm/packages/phoenix/src/index.d.ts +3 -0
- package/build/esm/packages/phoenix/src/index.js +4 -1
- package/build/esm/packages/phoenix/src/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
|
+
import { phoenixCustomElement } from '../../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import { ICON_CSS_CLASSES } from '../../../icon/icon_constants.js';
|
|
7
|
+
import { FILE_ITEM_EVENT_NAMES, FILE_ITEM_CSS_CLASSES, FILE_PICKER_ICON_CSS_CLASSES } from '../file_picker_constants.js';
|
|
8
|
+
|
|
9
|
+
let HFile = class HFile extends PhoenixLightLitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._handleClick = () => {
|
|
13
|
+
const removeItemEvent = new CustomEvent(FILE_ITEM_EVENT_NAMES.removed, {
|
|
14
|
+
bubbles: true,
|
|
15
|
+
detail: {
|
|
16
|
+
fileId: this.id
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
this.dispatchEvent(removeItemEvent);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback();
|
|
24
|
+
this.setAttribute('aria-label', this.name);
|
|
25
|
+
this.classList.add(FILE_ITEM_CSS_CLASSES.file);
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return html `
|
|
29
|
+
<span class="${FILE_ITEM_CSS_CLASSES.fileName}">${this.name}</span>
|
|
30
|
+
<button
|
|
31
|
+
class="${FILE_ITEM_CSS_CLASSES.fileRemoveButton}"
|
|
32
|
+
@click="${this._handleClick}"
|
|
33
|
+
aria-label="${this.removeButtonText} ${this.name}"
|
|
34
|
+
>
|
|
35
|
+
${this.removeButtonIconName
|
|
36
|
+
? html `<h-icon
|
|
37
|
+
class="${ICON_CSS_CLASSES.icon} ${FILE_PICKER_ICON_CSS_CLASSES.filePickerIcon}"
|
|
38
|
+
icon-name=${this.removeButtonIconName}
|
|
39
|
+
/>`
|
|
40
|
+
: nothing}
|
|
41
|
+
${this.removeButtonText}
|
|
42
|
+
</button>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
__decorate([
|
|
47
|
+
property({ type: String }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], HFile.prototype, "name", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
property({ type: String }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], HFile.prototype, "id", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
property({ type: String, attribute: 'remove-button-text' }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], HFile.prototype, "removeButtonText", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
property({ type: String, attribute: 'remove-button-icon-name' }),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], HFile.prototype, "removeButtonIconName", void 0);
|
|
62
|
+
HFile = __decorate([
|
|
63
|
+
phoenixCustomElement('h-file')
|
|
64
|
+
], HFile);
|
|
65
|
+
|
|
66
|
+
export { HFile };
|
|
67
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,kDAAsD;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
|
+
import type { TInputControlType } from "../input/input_types";
|
|
4
|
+
export declare class HFilePicker extends PhoenixLightLitElement {
|
|
5
|
+
controlId: string;
|
|
6
|
+
controlName: string;
|
|
7
|
+
type: TInputControlType;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
required: boolean;
|
|
10
|
+
error: boolean;
|
|
11
|
+
labelText: string;
|
|
12
|
+
labelIconName: string;
|
|
13
|
+
removeButtonText: string;
|
|
14
|
+
removeButtonIconName: string;
|
|
15
|
+
accept: string;
|
|
16
|
+
private _file;
|
|
17
|
+
private _$fileInputRef;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
protected render(): TemplateResult;
|
|
20
|
+
get files(): FileList | null;
|
|
21
|
+
set files(files: FileList | null);
|
|
22
|
+
get name(): string;
|
|
23
|
+
get id(): string;
|
|
24
|
+
private _addEventListeners;
|
|
25
|
+
private _handleChangeEvent;
|
|
26
|
+
private _getFiles;
|
|
27
|
+
private _getFileName;
|
|
28
|
+
private _getInputRefValue;
|
|
29
|
+
private _removeFileItem;
|
|
30
|
+
private _triggerClickOnLabel;
|
|
31
|
+
private _dispatchChangeEvent;
|
|
32
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
|
+
import { property, state } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
|
+
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import classnames from '../../../../external/classnames/index.js';
|
|
7
|
+
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
8
|
+
import v4 from '../../../../../../external/uuid/dist/esm-browser/v4.js';
|
|
9
|
+
import { FILE_PICKER_CONTROL_CSS_CLASSES, FILE_ITEM_EVENT_NAMES, FILE_PICKER_LABEL_EVENT_NAMES } from './file_picker_constants.js';
|
|
10
|
+
import { FileItem } from './file/file_model.js';
|
|
11
|
+
import { INPUT_CONTROL_TYPES } from '../input/input_constants.js';
|
|
12
|
+
import { ifDefined } from 'lit/directives/if-defined';
|
|
13
|
+
|
|
14
|
+
let HFilePicker = class HFilePicker extends PhoenixLightLitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.type = INPUT_CONTROL_TYPES.file;
|
|
18
|
+
this._$fileInputRef = createRef();
|
|
19
|
+
this._handleChangeEvent = (event) => {
|
|
20
|
+
const filesList = this._getFiles(event);
|
|
21
|
+
if (filesList && filesList.length > 0) {
|
|
22
|
+
this._file = FileItem.create({
|
|
23
|
+
name: this._getFileName(filesList),
|
|
24
|
+
id: `file-${v4()}`
|
|
25
|
+
});
|
|
26
|
+
this.classList.add(FILE_PICKER_CONTROL_CSS_CLASSES.filePickerHasValue);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
this._getFiles = (event) => {
|
|
30
|
+
const targetElement = event.currentTarget;
|
|
31
|
+
return targetElement.files;
|
|
32
|
+
};
|
|
33
|
+
this._getFileName = (fileList) => {
|
|
34
|
+
return fileList[0].name;
|
|
35
|
+
};
|
|
36
|
+
this._getInputRefValue = () => {
|
|
37
|
+
return this._$fileInputRef.value;
|
|
38
|
+
};
|
|
39
|
+
this._removeFileItem = () => {
|
|
40
|
+
const $fileInput = this._getInputRefValue();
|
|
41
|
+
if ($fileInput) {
|
|
42
|
+
$fileInput.value = '';
|
|
43
|
+
$fileInput.files = null;
|
|
44
|
+
}
|
|
45
|
+
this._file = null;
|
|
46
|
+
this.classList.remove(FILE_PICKER_CONTROL_CSS_CLASSES.filePickerHasValue);
|
|
47
|
+
this._dispatchChangeEvent();
|
|
48
|
+
};
|
|
49
|
+
this._triggerClickOnLabel = () => {
|
|
50
|
+
const $fileInput = this._getInputRefValue();
|
|
51
|
+
if ($fileInput)
|
|
52
|
+
$fileInput.click();
|
|
53
|
+
};
|
|
54
|
+
this._dispatchChangeEvent = () => {
|
|
55
|
+
this.dispatchEvent(new Event('change'));
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
connectedCallback() {
|
|
59
|
+
super.connectedCallback();
|
|
60
|
+
this._addEventListeners();
|
|
61
|
+
const cssClasses = classnames({
|
|
62
|
+
[FILE_PICKER_CONTROL_CSS_CLASSES.filePickerDisabled]: this.disabled,
|
|
63
|
+
[FILE_PICKER_CONTROL_CSS_CLASSES.filePickerRequired]: this.required,
|
|
64
|
+
[FILE_PICKER_CONTROL_CSS_CLASSES.filePickerError]: this.error
|
|
65
|
+
});
|
|
66
|
+
if (cssClasses)
|
|
67
|
+
this.classList.add(cssClasses);
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
super.render();
|
|
72
|
+
return html `
|
|
73
|
+
<input
|
|
74
|
+
${ref(this._$fileInputRef)}
|
|
75
|
+
type="file"
|
|
76
|
+
class="${FILE_PICKER_CONTROL_CSS_CLASSES.filePickerInput}"
|
|
77
|
+
id="${ifDefined(this.controlId)}"
|
|
78
|
+
name="${ifDefined(this.controlName)}"
|
|
79
|
+
?disabled="${this.disabled}"
|
|
80
|
+
?required="${this.required}"
|
|
81
|
+
accept="${ifDefined(this.accept)}"
|
|
82
|
+
@change="${this._handleChangeEvent}"
|
|
83
|
+
hidden
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
${!((_a = this._file) === null || _a === void 0 ? void 0 : _a.name)
|
|
87
|
+
? html ` <h-file-picker-label
|
|
88
|
+
control-id="${this.controlId}"
|
|
89
|
+
label-text="${this.labelText}"
|
|
90
|
+
label-icon-name="${ifDefined(this.labelIconName)}"
|
|
91
|
+
/>`
|
|
92
|
+
: nothing}
|
|
93
|
+
${((_b = this._file) === null || _b === void 0 ? void 0 : _b.name)
|
|
94
|
+
? html `<h-file
|
|
95
|
+
name="${this._file.name}"
|
|
96
|
+
id="${this._file.id}"
|
|
97
|
+
remove-button-text="${this.removeButtonText}"
|
|
98
|
+
remove-button-icon-name="${ifDefined(this.removeButtonIconName)}"
|
|
99
|
+
/>`
|
|
100
|
+
: nothing}
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
get files() {
|
|
104
|
+
const $fileInput = this._getInputRefValue();
|
|
105
|
+
return $fileInput.files;
|
|
106
|
+
}
|
|
107
|
+
set files(files) {
|
|
108
|
+
if (!files)
|
|
109
|
+
return;
|
|
110
|
+
const $fileInput = this._getInputRefValue();
|
|
111
|
+
const dataTransfer = new DataTransfer();
|
|
112
|
+
const filesArray = Array.from(files);
|
|
113
|
+
filesArray.forEach((file) => dataTransfer.items.add(file));
|
|
114
|
+
if ($fileInput)
|
|
115
|
+
$fileInput.files = dataTransfer.files;
|
|
116
|
+
}
|
|
117
|
+
get name() {
|
|
118
|
+
return this.controlName;
|
|
119
|
+
}
|
|
120
|
+
get id() {
|
|
121
|
+
return this.controlId;
|
|
122
|
+
}
|
|
123
|
+
_addEventListeners() {
|
|
124
|
+
this.addEventListener(FILE_ITEM_EVENT_NAMES.removed, this._removeFileItem);
|
|
125
|
+
this.addEventListener(FILE_PICKER_LABEL_EVENT_NAMES.filePickerLabelClickedByEnterKey, this._triggerClickOnLabel);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: String, attribute: 'control-id', reflect: true }),
|
|
130
|
+
__metadata("design:type", String)
|
|
131
|
+
], HFilePicker.prototype, "controlId", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
property({ type: String, attribute: 'control-name' }),
|
|
134
|
+
__metadata("design:type", String)
|
|
135
|
+
], HFilePicker.prototype, "controlName", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: String }),
|
|
138
|
+
__metadata("design:type", String)
|
|
139
|
+
], HFilePicker.prototype, "type", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ type: Boolean }),
|
|
142
|
+
__metadata("design:type", Boolean)
|
|
143
|
+
], HFilePicker.prototype, "disabled", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
property({ type: Boolean }),
|
|
146
|
+
__metadata("design:type", Boolean)
|
|
147
|
+
], HFilePicker.prototype, "required", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: Boolean }),
|
|
150
|
+
__metadata("design:type", Boolean)
|
|
151
|
+
], HFilePicker.prototype, "error", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
property({ type: String, attribute: 'label-text' }),
|
|
154
|
+
__metadata("design:type", String)
|
|
155
|
+
], HFilePicker.prototype, "labelText", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
property({ type: String, attribute: 'label-icon-name' }),
|
|
158
|
+
__metadata("design:type", String)
|
|
159
|
+
], HFilePicker.prototype, "labelIconName", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: String, attribute: 'remove-button-text' }),
|
|
162
|
+
__metadata("design:type", String)
|
|
163
|
+
], HFilePicker.prototype, "removeButtonText", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
property({ type: String, attribute: 'remove-button-icon-name' }),
|
|
166
|
+
__metadata("design:type", String)
|
|
167
|
+
], HFilePicker.prototype, "removeButtonIconName", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
property({ type: String }),
|
|
170
|
+
__metadata("design:type", String)
|
|
171
|
+
], HFilePicker.prototype, "accept", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
state(),
|
|
174
|
+
__metadata("design:type", Object)
|
|
175
|
+
], HFilePicker.prototype, "_file", void 0);
|
|
176
|
+
HFilePicker = __decorate([
|
|
177
|
+
phoenixCustomElement('h-file-picker')
|
|
178
|
+
], HFilePicker);
|
|
179
|
+
|
|
180
|
+
export { HFilePicker };
|
|
181
|
+
//# sourceMappingURL=file_picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA,uBAAuB,0CAA8C;AACrE;AACA,eAAe,wDAA4D;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const FILE_ITEM_CSS_CLASSES: {
|
|
2
|
+
readonly file: "file";
|
|
3
|
+
readonly fileName: "file__name";
|
|
4
|
+
readonly fileRemoveButton: "file__remove-button";
|
|
5
|
+
};
|
|
6
|
+
export declare const FILE_ITEM_EVENT_NAMES: {
|
|
7
|
+
readonly removed: "fileItemRemoved";
|
|
8
|
+
};
|
|
9
|
+
export declare type TFileItemConstructorOptions = {
|
|
10
|
+
name: string;
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const FILE_PICKER_CONTROL_CSS_CLASSES: {
|
|
14
|
+
readonly filePicker: "file-picker";
|
|
15
|
+
readonly filePickerDisabled: "file-picker_disabled";
|
|
16
|
+
readonly filePickerRequired: "file-picker_required";
|
|
17
|
+
readonly filePickerError: "file-picker_error";
|
|
18
|
+
readonly filePickerHasValue: "file-picker_has-value";
|
|
19
|
+
readonly filePickerInput: "file-picker__input";
|
|
20
|
+
readonly filePickerLabel: "file-picker__label";
|
|
21
|
+
};
|
|
22
|
+
export declare const FILE_PICKER_LABEL_EVENT_NAMES: {
|
|
23
|
+
readonly filePickerLabelClickedByEnterKey: "filePickerLabelClickedByEnterKey";
|
|
24
|
+
};
|
|
25
|
+
export declare const FILE_PICKER_ICON_CSS_CLASSES: {
|
|
26
|
+
readonly filePickerIcon: "file-picker-icon";
|
|
27
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const baseFileItemClass = 'file';
|
|
2
|
+
const FILE_ITEM_CSS_CLASSES = {
|
|
3
|
+
file: baseFileItemClass,
|
|
4
|
+
fileName: `${baseFileItemClass}__name`,
|
|
5
|
+
fileRemoveButton: `${baseFileItemClass}__remove-button`
|
|
6
|
+
};
|
|
7
|
+
const FILE_ITEM_EVENT_NAMES = {
|
|
8
|
+
removed: 'fileItemRemoved'
|
|
9
|
+
};
|
|
10
|
+
const baseFilePickerControlClass = 'file-picker';
|
|
11
|
+
const FILE_PICKER_CONTROL_CSS_CLASSES = {
|
|
12
|
+
filePicker: baseFilePickerControlClass,
|
|
13
|
+
filePickerDisabled: `${baseFilePickerControlClass}_disabled`,
|
|
14
|
+
filePickerRequired: `${baseFilePickerControlClass}_required`,
|
|
15
|
+
filePickerError: `${baseFilePickerControlClass}_error`,
|
|
16
|
+
filePickerHasValue: `${baseFilePickerControlClass}_has-value`,
|
|
17
|
+
filePickerInput: `${baseFilePickerControlClass}__input`,
|
|
18
|
+
filePickerLabel: `${baseFilePickerControlClass}__label`
|
|
19
|
+
};
|
|
20
|
+
const FILE_PICKER_LABEL_EVENT_NAMES = {
|
|
21
|
+
filePickerLabelClickedByEnterKey: 'filePickerLabelClickedByEnterKey'
|
|
22
|
+
};
|
|
23
|
+
const baseFilePickerIconClass = 'file-picker-icon';
|
|
24
|
+
const FILE_PICKER_ICON_CSS_CLASSES = {
|
|
25
|
+
filePickerIcon: baseFilePickerIconClass
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { FILE_ITEM_CSS_CLASSES, FILE_ITEM_EVENT_NAMES, FILE_PICKER_CONTROL_CSS_CLASSES, FILE_PICKER_ICON_CSS_CLASSES, FILE_PICKER_LABEL_EVENT_NAMES };
|
|
29
|
+
//# sourceMappingURL=file_picker_constants.js.map
|
package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
|
+
export declare class HFilePickerLabel extends PhoenixLightLitElement {
|
|
4
|
+
controlId: string;
|
|
5
|
+
labelText: string;
|
|
6
|
+
labelIconName: string;
|
|
7
|
+
private _btnController;
|
|
8
|
+
constructor();
|
|
9
|
+
protected render(): TemplateResult;
|
|
10
|
+
private _dispatchClickEvent;
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
|
+
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import { BtnController } from '../../../controllers/btn_controller/btn_controller.js';
|
|
7
|
+
import { ICON_CSS_CLASSES } from '../../icon/icon_constants.js';
|
|
8
|
+
import { FILE_PICKER_LABEL_EVENT_NAMES, FILE_PICKER_CONTROL_CSS_CLASSES, FILE_PICKER_ICON_CSS_CLASSES } from './file_picker_constants.js';
|
|
9
|
+
|
|
10
|
+
let HFilePickerLabel = class HFilePickerLabel extends PhoenixLightLitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this._dispatchClickEvent = () => {
|
|
14
|
+
this.dispatchEvent(new CustomEvent(FILE_PICKER_LABEL_EVENT_NAMES.filePickerLabelClickedByEnterKey, {
|
|
15
|
+
bubbles: true
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
18
|
+
this._btnController = new BtnController(this, this._dispatchClickEvent);
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
super.render();
|
|
22
|
+
return html `<label class="${FILE_PICKER_CONTROL_CSS_CLASSES.filePickerLabel}" for="${this.controlId}">
|
|
23
|
+
${this.labelIconName
|
|
24
|
+
? html `<h-icon
|
|
25
|
+
class="${ICON_CSS_CLASSES.icon} ${FILE_PICKER_ICON_CSS_CLASSES.filePickerIcon}"
|
|
26
|
+
icon-name=${this.labelIconName}
|
|
27
|
+
/>`
|
|
28
|
+
: nothing}
|
|
29
|
+
${this.labelText}
|
|
30
|
+
</label>`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
__decorate([
|
|
34
|
+
property({ type: String, attribute: 'control-id', reflect: true }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], HFilePickerLabel.prototype, "controlId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
property({ type: String, attribute: 'label-text' }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], HFilePickerLabel.prototype, "labelText", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
property({ type: String, attribute: 'label-icon-name' }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], HFilePickerLabel.prototype, "labelIconName", void 0);
|
|
45
|
+
HFilePickerLabel = __decorate([
|
|
46
|
+
phoenixCustomElement('h-file-picker-label'),
|
|
47
|
+
__metadata("design:paramtypes", [])
|
|
48
|
+
], HFilePickerLabel);
|
|
49
|
+
|
|
50
|
+
export { HFilePickerLabel };
|
|
51
|
+
//# sourceMappingURL=file_picker_label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file_picker_types.js","sourceRoot":"","sources":["../../../../../../../../src/components/form/file_picker/file_picker_types.ts"],"names":[],"mappings":"AAAA,OAA4B,sDAAsD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -13,7 +13,10 @@ import { HSelectToggler } from './components/toggler/select_toggler.js';
|
|
|
13
13
|
import { ContextProviderController } from '../../../core/context/context_provider_controller.js';
|
|
14
14
|
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
15
15
|
import { BREAKPOINTS } from '../../../global_constants.js';
|
|
16
|
+
import { HDropdownContent } from '../../dropdown/dropdown_content.js';
|
|
17
|
+
import { HDropdownToggler } from '../../dropdown/dropdown_toggler.js';
|
|
16
18
|
import debounce_1 from '../../../../../../external/lodash/debounce.js';
|
|
19
|
+
import { HDropdown } from '../../dropdown/dropdown.js';
|
|
17
20
|
import { MultiSelectController } from './controllers/multi_select_controller.js';
|
|
18
21
|
import { SelectController } from './controllers/select_controller.js';
|
|
19
22
|
import { HSelectSearch } from './components/search/select_search.js';
|
|
@@ -258,7 +261,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
258
261
|
${ref(this._$dropdown)}
|
|
259
262
|
@dropdown.showed=${() => (this.opened = true)}
|
|
260
263
|
@dropdown.hidden=${this._handleDropdownHidden}
|
|
261
|
-
name
|
|
264
|
+
name="${this.controlName}$"
|
|
262
265
|
offset=${this.offset}
|
|
263
266
|
>
|
|
264
267
|
<h-dropdown-toggler name=${this.controlName}> ${this.getSlot(SELECT_SLOT_NAMES.toggler)} </h-dropdown-toggler>
|
|
@@ -306,9 +309,9 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
306
309
|
${this.multiple && this._selectController.selectedOptionsCount >= 1
|
|
307
310
|
? html `
|
|
308
311
|
<section class=${SELECT_CSS_CLASSES.selectFooter}>
|
|
309
|
-
<button class="${SELECT_CSS_CLASSES.selectClearButton}" @click=${this._clearOptions}>
|
|
312
|
+
<button class="${SELECT_CSS_CLASSES.selectClearButton}" @click=${this._clearOptions}>Reset</button>
|
|
310
313
|
<h-select-close-btn class="${SELECT_CSS_CLASSES.selectCloseButton}" @selectCloseBtn.close=${this._closeSelect}
|
|
311
|
-
><span slot=${SELECT_CLOSE_BUTTON_CONTENT_SLOT_NAME}>
|
|
314
|
+
><span slot=${SELECT_CLOSE_BUTTON_CONTENT_SLOT_NAME}>Choose</span>
|
|
312
315
|
</h-select-close-btn>
|
|
313
316
|
</section>
|
|
314
317
|
`
|
|
@@ -324,7 +327,10 @@ HSelect._components = {
|
|
|
324
327
|
search: HSelectSearch,
|
|
325
328
|
icon: HIcon,
|
|
326
329
|
closeBtn: HSelectCloseBtn,
|
|
327
|
-
toggler: HSelectToggler
|
|
330
|
+
toggler: HSelectToggler,
|
|
331
|
+
dropdown: HDropdown,
|
|
332
|
+
dropdownContent: HDropdownContent,
|
|
333
|
+
dropdownToggler: HDropdownToggler
|
|
328
334
|
};
|
|
329
335
|
__decorate([
|
|
330
336
|
property({ type: String, attribute: 'control-name' }),
|
|
@@ -339,7 +345,7 @@ __decorate([
|
|
|
339
345
|
__metadata("design:type", Boolean)
|
|
340
346
|
], HSelect.prototype, "multiple", void 0);
|
|
341
347
|
__decorate([
|
|
342
|
-
property({ type: Boolean }),
|
|
348
|
+
property({ type: Boolean, reflect: true }),
|
|
343
349
|
__metadata("design:type", Boolean)
|
|
344
350
|
], HSelect.prototype, "opened", void 0);
|
|
345
351
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+CAAmD;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+CAAmD;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -46,7 +46,8 @@ class SelectControlUtils {
|
|
|
46
46
|
return options.findIndex((option) => option.selected);
|
|
47
47
|
}
|
|
48
48
|
static getLastIndexOfSelectedOption(options) {
|
|
49
|
-
|
|
49
|
+
const firstIndexInReversed = [...options].reverse().findIndex((option) => option.selected);
|
|
50
|
+
return options.length - firstIndexInReversed - 1;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js
CHANGED
|
@@ -2,6 +2,7 @@ import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.
|
|
|
2
2
|
import { PHOENIX_LIGHT_LIT_ELEMENTS_EVENT_NAMES, DEFAULT_SLOT_NAME } from './phoenix_light_lit_elements_constants.js';
|
|
3
3
|
import { LitElement, html, nothing } from 'lit';
|
|
4
4
|
import { state, property } from 'lit/decorators';
|
|
5
|
+
import { UiDomUtils } from '@dreamcommerce/utilities';
|
|
5
6
|
import { PhoenixLightLitElementUtils } from './phoenix_light_lit_element_utils.js';
|
|
6
7
|
|
|
7
8
|
class PhoenixLightLitElement extends LitElement {
|
|
@@ -48,10 +49,10 @@ class PhoenixLightLitElement extends LitElement {
|
|
|
48
49
|
}
|
|
49
50
|
firstUpdated(props) {
|
|
50
51
|
super.firstUpdated(props);
|
|
52
|
+
this.isWebComponentRendered = true;
|
|
51
53
|
this._slots = this._assignSlots();
|
|
52
54
|
this.requestUpdate();
|
|
53
55
|
this._dispatchLifecycleEvent(PHOENIX_LIGHT_LIT_ELEMENTS_EVENT_NAMES.rendered);
|
|
54
|
-
this.isWebComponentRendered = true;
|
|
55
56
|
}
|
|
56
57
|
_setupChildrenConnectedWatch() {
|
|
57
58
|
this._childrenForConnectionToWatch = this.childrenToWatch
|
|
@@ -100,11 +101,12 @@ class PhoenixLightLitElement extends LitElement {
|
|
|
100
101
|
allChildrenConnected() { }
|
|
101
102
|
allChildrenRendered() { }
|
|
102
103
|
_assignSlots() {
|
|
103
|
-
return
|
|
104
|
+
return UiDomUtils.getDirectChildren(this, '[slot]').reduce((acc, $el) => {
|
|
104
105
|
var _a;
|
|
105
106
|
const slotName = $el.slot || DEFAULT_SLOT_NAME;
|
|
107
|
+
const $slottedElement = $el instanceof HTMLTemplateElement ? $el.content.cloneNode(true) : $el;
|
|
106
108
|
acc[slotName] = acc[slotName] || [];
|
|
107
|
-
acc[slotName].push(html `${$
|
|
109
|
+
acc[slotName].push(html `${$slottedElement}`);
|
|
108
110
|
(_a = $el.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild($el);
|
|
109
111
|
$el.removeAttribute('slot');
|
|
110
112
|
return acc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -3,6 +3,9 @@ export { HOptionContent } from "./components/form/select/components/option/selec
|
|
|
3
3
|
export { HOptions } from "./components/form/select/components/select_options";
|
|
4
4
|
export { HSelectToggler } from "./components/form/select/components/toggler/select_toggler";
|
|
5
5
|
export { HSelect } from "./components/form/select/select";
|
|
6
|
+
export { HFile } from "./components/form/file_picker/file/file";
|
|
7
|
+
export { HFilePicker } from "./components/form/file_picker/file_picker";
|
|
8
|
+
export { HFilePickerLabel } from "./components/form/file_picker/file_picker_label";
|
|
6
9
|
export { DEFAULT_SLOT_NAME } from "./core/phoenix_light_lit_element/phoenix_light_lit_elements_constants";
|
|
7
10
|
export { IPhoenixWebComponentClass } from "./global_types";
|
|
8
11
|
export { ContextProviderController } from "./core/context/context_provider_controller";
|
|
@@ -19,6 +19,10 @@ export { HDropdownToggler } from './components/dropdown/dropdown_toggler.js';
|
|
|
19
19
|
export { RelativePositionController } from './controllers/relative_position_controller/relative_position_controller.js';
|
|
20
20
|
export { HDropdown } from './components/dropdown/dropdown.js';
|
|
21
21
|
export { HSelect } from './components/form/select/select.js';
|
|
22
|
+
export { HFile } from './components/form/file_picker/file/file.js';
|
|
23
|
+
export { INPUT_CONTROL_CSS_CLASSES, INPUT_CONTROL_EVENTS, INPUT_CONTROL_SIZES, INPUT_CONTROL_TYPES, INPUT_PROPS_TO_SYNC } from './components/form/input/input_constants.js';
|
|
24
|
+
export { HFilePicker } from './components/form/file_picker/file_picker.js';
|
|
25
|
+
export { HFilePickerLabel } from './components/form/file_picker/file_picker_label.js';
|
|
22
26
|
export { HModal } from './components/modal/modal.js';
|
|
23
27
|
export { HModalOpener } from './components/modal/modal_opener.js';
|
|
24
28
|
export { HModalBody } from './components/modal/modal_body.js';
|
|
@@ -32,7 +36,6 @@ export { HControlContent } from './components/form/control/control_content.js';
|
|
|
32
36
|
export { HControlElement } from './components/form/control/control_element.js';
|
|
33
37
|
export { HControlLabel } from './components/form/control/control_label.js';
|
|
34
38
|
export { HControlAdditionalContent } from './components/form/control/control_additional_content.js';
|
|
35
|
-
export { INPUT_CONTROL_CSS_CLASSES, INPUT_CONTROL_EVENTS, INPUT_CONTROL_SIZES, INPUT_CONTROL_TYPES, INPUT_PROPS_TO_SYNC } from './components/form/input/input_constants.js';
|
|
36
39
|
export { HInput } from './components/form/input/input.js';
|
|
37
40
|
export { HInputControl } from './components/form/input/input_control.js';
|
|
38
41
|
export { HInputIcon } from './components/form/input/input_icon.js';
|