@shoper/phoenix_design_system 1.2.3 → 1.2.4
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/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/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 +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var lit = require('lit');
|
|
7
|
+
var decorators = require('lit/decorators');
|
|
8
|
+
var phoenix_light_lit_element = require('../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
|
+
var phoenix_custom_element = require('../../../../core/decorators/phoenix_custom_element.js');
|
|
10
|
+
var icon_constants = require('../../../icon/icon_constants.js');
|
|
11
|
+
var file_picker_constants = require('../file_picker_constants.js');
|
|
12
|
+
|
|
13
|
+
exports.HFile = class HFile extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this._handleClick = () => {
|
|
17
|
+
const removeItemEvent = new CustomEvent(file_picker_constants.FILE_ITEM_EVENT_NAMES.removed, {
|
|
18
|
+
bubbles: true,
|
|
19
|
+
detail: {
|
|
20
|
+
fileId: this.id
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
this.dispatchEvent(removeItemEvent);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
super.connectedCallback();
|
|
28
|
+
this.setAttribute('aria-label', this.name);
|
|
29
|
+
this.classList.add(file_picker_constants.FILE_ITEM_CSS_CLASSES.file);
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return lit.html `
|
|
33
|
+
<span class="${file_picker_constants.FILE_ITEM_CSS_CLASSES.fileName}">${this.name}</span>
|
|
34
|
+
<button
|
|
35
|
+
class="${file_picker_constants.FILE_ITEM_CSS_CLASSES.fileRemoveButton}"
|
|
36
|
+
@click="${this._handleClick}"
|
|
37
|
+
aria-label="${this.removeButtonText} ${this.name}"
|
|
38
|
+
>
|
|
39
|
+
${this.removeButtonIconName
|
|
40
|
+
? lit.html `<h-icon
|
|
41
|
+
class="${icon_constants.ICON_CSS_CLASSES.icon} ${file_picker_constants.FILE_PICKER_ICON_CSS_CLASSES.filePickerIcon}"
|
|
42
|
+
icon-name=${this.removeButtonIconName}
|
|
43
|
+
/>`
|
|
44
|
+
: lit.nothing}
|
|
45
|
+
${this.removeButtonText}
|
|
46
|
+
</button>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
tslib_es6.__decorate([
|
|
51
|
+
decorators.property({ type: String }),
|
|
52
|
+
tslib_es6.__metadata("design:type", String)
|
|
53
|
+
], exports.HFile.prototype, "name", void 0);
|
|
54
|
+
tslib_es6.__decorate([
|
|
55
|
+
decorators.property({ type: String }),
|
|
56
|
+
tslib_es6.__metadata("design:type", String)
|
|
57
|
+
], exports.HFile.prototype, "id", void 0);
|
|
58
|
+
tslib_es6.__decorate([
|
|
59
|
+
decorators.property({ type: String, attribute: 'remove-button-text' }),
|
|
60
|
+
tslib_es6.__metadata("design:type", String)
|
|
61
|
+
], exports.HFile.prototype, "removeButtonText", void 0);
|
|
62
|
+
tslib_es6.__decorate([
|
|
63
|
+
decorators.property({ type: String, attribute: 'remove-button-icon-name' }),
|
|
64
|
+
tslib_es6.__metadata("design:type", String)
|
|
65
|
+
], exports.HFile.prototype, "removeButtonIconName", void 0);
|
|
66
|
+
exports.HFile = tslib_es6.__decorate([
|
|
67
|
+
phoenix_custom_element.phoenixCustomElement('h-file')
|
|
68
|
+
], exports.HFile);
|
|
69
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,kDAAsD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
class FileItem {
|
|
6
|
+
constructor({ name, id }) {
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.id = id;
|
|
9
|
+
}
|
|
10
|
+
static create(options) {
|
|
11
|
+
return new FileItem(options);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.FileItem = FileItem;
|
|
16
|
+
//# sourceMappingURL=file_model.js.map
|
|
@@ -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;"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var lit = require('lit');
|
|
7
|
+
var decorators = require('lit/decorators');
|
|
8
|
+
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
|
+
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
10
|
+
var index = require('../../../../external/classnames/index.js');
|
|
11
|
+
var ref_js = require('lit-html/directives/ref.js');
|
|
12
|
+
var v4 = require('../../../../../../external/uuid/dist/esm-browser/v4.js');
|
|
13
|
+
var file_picker_constants = require('./file_picker_constants.js');
|
|
14
|
+
var file_model = require('./file/file_model.js');
|
|
15
|
+
var input_constants = require('../input/input_constants.js');
|
|
16
|
+
var ifDefined = require('lit/directives/if-defined');
|
|
17
|
+
|
|
18
|
+
exports.HFilePicker = class HFilePicker extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.type = input_constants.INPUT_CONTROL_TYPES.file;
|
|
22
|
+
this._$fileInputRef = ref_js.createRef();
|
|
23
|
+
this._handleChangeEvent = (event) => {
|
|
24
|
+
const filesList = this._getFiles(event);
|
|
25
|
+
if (filesList && filesList.length > 0) {
|
|
26
|
+
this._file = file_model.FileItem.create({
|
|
27
|
+
name: this._getFileName(filesList),
|
|
28
|
+
id: `file-${v4['default']()}`
|
|
29
|
+
});
|
|
30
|
+
this.classList.add(file_picker_constants.FILE_PICKER_CONTROL_CSS_CLASSES.filePickerHasValue);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this._getFiles = (event) => {
|
|
34
|
+
const targetElement = event.currentTarget;
|
|
35
|
+
return targetElement.files;
|
|
36
|
+
};
|
|
37
|
+
this._getFileName = (fileList) => {
|
|
38
|
+
return fileList[0].name;
|
|
39
|
+
};
|
|
40
|
+
this._getInputRefValue = () => {
|
|
41
|
+
return this._$fileInputRef.value;
|
|
42
|
+
};
|
|
43
|
+
this._removeFileItem = () => {
|
|
44
|
+
const $fileInput = this._getInputRefValue();
|
|
45
|
+
if ($fileInput) {
|
|
46
|
+
$fileInput.value = '';
|
|
47
|
+
$fileInput.files = null;
|
|
48
|
+
}
|
|
49
|
+
this._file = null;
|
|
50
|
+
this.classList.remove(file_picker_constants.FILE_PICKER_CONTROL_CSS_CLASSES.filePickerHasValue);
|
|
51
|
+
this._dispatchChangeEvent();
|
|
52
|
+
};
|
|
53
|
+
this._triggerClickOnLabel = () => {
|
|
54
|
+
const $fileInput = this._getInputRefValue();
|
|
55
|
+
if ($fileInput)
|
|
56
|
+
$fileInput.click();
|
|
57
|
+
};
|
|
58
|
+
this._dispatchChangeEvent = () => {
|
|
59
|
+
this.dispatchEvent(new Event('change'));
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
connectedCallback() {
|
|
63
|
+
super.connectedCallback();
|
|
64
|
+
this._addEventListeners();
|
|
65
|
+
const cssClasses = index['default']({
|
|
66
|
+
[file_picker_constants.FILE_PICKER_CONTROL_CSS_CLASSES.filePickerDisabled]: this.disabled,
|
|
67
|
+
[file_picker_constants.FILE_PICKER_CONTROL_CSS_CLASSES.filePickerRequired]: this.required,
|
|
68
|
+
[file_picker_constants.FILE_PICKER_CONTROL_CSS_CLASSES.filePickerError]: this.error
|
|
69
|
+
});
|
|
70
|
+
if (cssClasses)
|
|
71
|
+
this.classList.add(cssClasses);
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
super.render();
|
|
76
|
+
return lit.html `
|
|
77
|
+
<input
|
|
78
|
+
${ref_js.ref(this._$fileInputRef)}
|
|
79
|
+
type="file"
|
|
80
|
+
class="${file_picker_constants.FILE_PICKER_CONTROL_CSS_CLASSES.filePickerInput}"
|
|
81
|
+
id="${ifDefined.ifDefined(this.controlId)}"
|
|
82
|
+
name="${ifDefined.ifDefined(this.controlName)}"
|
|
83
|
+
?disabled="${this.disabled}"
|
|
84
|
+
?required="${this.required}"
|
|
85
|
+
accept="${ifDefined.ifDefined(this.accept)}"
|
|
86
|
+
@change="${this._handleChangeEvent}"
|
|
87
|
+
hidden
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
${!((_a = this._file) === null || _a === void 0 ? void 0 : _a.name)
|
|
91
|
+
? lit.html ` <h-file-picker-label
|
|
92
|
+
control-id="${this.controlId}"
|
|
93
|
+
label-text="${this.labelText}"
|
|
94
|
+
label-icon-name="${ifDefined.ifDefined(this.labelIconName)}"
|
|
95
|
+
/>`
|
|
96
|
+
: lit.nothing}
|
|
97
|
+
${((_b = this._file) === null || _b === void 0 ? void 0 : _b.name)
|
|
98
|
+
? lit.html `<h-file
|
|
99
|
+
name="${this._file.name}"
|
|
100
|
+
id="${this._file.id}"
|
|
101
|
+
remove-button-text="${this.removeButtonText}"
|
|
102
|
+
remove-button-icon-name="${ifDefined.ifDefined(this.removeButtonIconName)}"
|
|
103
|
+
/>`
|
|
104
|
+
: lit.nothing}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
get files() {
|
|
108
|
+
const $fileInput = this._getInputRefValue();
|
|
109
|
+
return $fileInput.files;
|
|
110
|
+
}
|
|
111
|
+
set files(files) {
|
|
112
|
+
if (!files)
|
|
113
|
+
return;
|
|
114
|
+
const $fileInput = this._getInputRefValue();
|
|
115
|
+
const dataTransfer = new DataTransfer();
|
|
116
|
+
const filesArray = Array.from(files);
|
|
117
|
+
filesArray.forEach((file) => dataTransfer.items.add(file));
|
|
118
|
+
if ($fileInput)
|
|
119
|
+
$fileInput.files = dataTransfer.files;
|
|
120
|
+
}
|
|
121
|
+
get name() {
|
|
122
|
+
return this.controlName;
|
|
123
|
+
}
|
|
124
|
+
get id() {
|
|
125
|
+
return this.controlId;
|
|
126
|
+
}
|
|
127
|
+
_addEventListeners() {
|
|
128
|
+
this.addEventListener(file_picker_constants.FILE_ITEM_EVENT_NAMES.removed, this._removeFileItem);
|
|
129
|
+
this.addEventListener(file_picker_constants.FILE_PICKER_LABEL_EVENT_NAMES.filePickerLabelClickedByEnterKey, this._triggerClickOnLabel);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
tslib_es6.__decorate([
|
|
133
|
+
decorators.property({ type: String, attribute: 'control-id', reflect: true }),
|
|
134
|
+
tslib_es6.__metadata("design:type", String)
|
|
135
|
+
], exports.HFilePicker.prototype, "controlId", void 0);
|
|
136
|
+
tslib_es6.__decorate([
|
|
137
|
+
decorators.property({ type: String, attribute: 'control-name' }),
|
|
138
|
+
tslib_es6.__metadata("design:type", String)
|
|
139
|
+
], exports.HFilePicker.prototype, "controlName", void 0);
|
|
140
|
+
tslib_es6.__decorate([
|
|
141
|
+
decorators.property({ type: String }),
|
|
142
|
+
tslib_es6.__metadata("design:type", String)
|
|
143
|
+
], exports.HFilePicker.prototype, "type", void 0);
|
|
144
|
+
tslib_es6.__decorate([
|
|
145
|
+
decorators.property({ type: Boolean }),
|
|
146
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
147
|
+
], exports.HFilePicker.prototype, "disabled", void 0);
|
|
148
|
+
tslib_es6.__decorate([
|
|
149
|
+
decorators.property({ type: Boolean }),
|
|
150
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
151
|
+
], exports.HFilePicker.prototype, "required", void 0);
|
|
152
|
+
tslib_es6.__decorate([
|
|
153
|
+
decorators.property({ type: Boolean }),
|
|
154
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
155
|
+
], exports.HFilePicker.prototype, "error", void 0);
|
|
156
|
+
tslib_es6.__decorate([
|
|
157
|
+
decorators.property({ type: String, attribute: 'label-text' }),
|
|
158
|
+
tslib_es6.__metadata("design:type", String)
|
|
159
|
+
], exports.HFilePicker.prototype, "labelText", void 0);
|
|
160
|
+
tslib_es6.__decorate([
|
|
161
|
+
decorators.property({ type: String, attribute: 'label-icon-name' }),
|
|
162
|
+
tslib_es6.__metadata("design:type", String)
|
|
163
|
+
], exports.HFilePicker.prototype, "labelIconName", void 0);
|
|
164
|
+
tslib_es6.__decorate([
|
|
165
|
+
decorators.property({ type: String, attribute: 'remove-button-text' }),
|
|
166
|
+
tslib_es6.__metadata("design:type", String)
|
|
167
|
+
], exports.HFilePicker.prototype, "removeButtonText", void 0);
|
|
168
|
+
tslib_es6.__decorate([
|
|
169
|
+
decorators.property({ type: String, attribute: 'remove-button-icon-name' }),
|
|
170
|
+
tslib_es6.__metadata("design:type", String)
|
|
171
|
+
], exports.HFilePicker.prototype, "removeButtonIconName", void 0);
|
|
172
|
+
tslib_es6.__decorate([
|
|
173
|
+
decorators.property({ type: String }),
|
|
174
|
+
tslib_es6.__metadata("design:type", String)
|
|
175
|
+
], exports.HFilePicker.prototype, "accept", void 0);
|
|
176
|
+
tslib_es6.__decorate([
|
|
177
|
+
decorators.state(),
|
|
178
|
+
tslib_es6.__metadata("design:type", Object)
|
|
179
|
+
], exports.HFilePicker.prototype, "_file", void 0);
|
|
180
|
+
exports.HFilePicker = tslib_es6.__decorate([
|
|
181
|
+
phoenix_custom_element.phoenixCustomElement('h-file-picker')
|
|
182
|
+
], exports.HFilePicker);
|
|
183
|
+
//# sourceMappingURL=file_picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA,oBAAoB,0CAA8C;AAClE;AACA,iBAAiB,wDAA4D;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const baseFileItemClass = 'file';
|
|
6
|
+
const FILE_ITEM_CSS_CLASSES = {
|
|
7
|
+
file: baseFileItemClass,
|
|
8
|
+
fileName: `${baseFileItemClass}__name`,
|
|
9
|
+
fileRemoveButton: `${baseFileItemClass}__remove-button`
|
|
10
|
+
};
|
|
11
|
+
const FILE_ITEM_EVENT_NAMES = {
|
|
12
|
+
removed: 'fileItemRemoved'
|
|
13
|
+
};
|
|
14
|
+
const baseFilePickerControlClass = 'file-picker';
|
|
15
|
+
const FILE_PICKER_CONTROL_CSS_CLASSES = {
|
|
16
|
+
filePicker: baseFilePickerControlClass,
|
|
17
|
+
filePickerDisabled: `${baseFilePickerControlClass}_disabled`,
|
|
18
|
+
filePickerRequired: `${baseFilePickerControlClass}_required`,
|
|
19
|
+
filePickerError: `${baseFilePickerControlClass}_error`,
|
|
20
|
+
filePickerHasValue: `${baseFilePickerControlClass}_has-value`,
|
|
21
|
+
filePickerInput: `${baseFilePickerControlClass}__input`,
|
|
22
|
+
filePickerLabel: `${baseFilePickerControlClass}__label`
|
|
23
|
+
};
|
|
24
|
+
const FILE_PICKER_LABEL_EVENT_NAMES = {
|
|
25
|
+
filePickerLabelClickedByEnterKey: 'filePickerLabelClickedByEnterKey'
|
|
26
|
+
};
|
|
27
|
+
const baseFilePickerIconClass = 'file-picker-icon';
|
|
28
|
+
const FILE_PICKER_ICON_CSS_CLASSES = {
|
|
29
|
+
filePickerIcon: baseFilePickerIconClass
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.FILE_ITEM_CSS_CLASSES = FILE_ITEM_CSS_CLASSES;
|
|
33
|
+
exports.FILE_ITEM_EVENT_NAMES = FILE_ITEM_EVENT_NAMES;
|
|
34
|
+
exports.FILE_PICKER_CONTROL_CSS_CLASSES = FILE_PICKER_CONTROL_CSS_CLASSES;
|
|
35
|
+
exports.FILE_PICKER_ICON_CSS_CLASSES = FILE_PICKER_ICON_CSS_CLASSES;
|
|
36
|
+
exports.FILE_PICKER_LABEL_EVENT_NAMES = FILE_PICKER_LABEL_EVENT_NAMES;
|
|
37
|
+
//# sourceMappingURL=file_picker_constants.js.map
|
package/build/cjs/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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var lit = require('lit');
|
|
7
|
+
var decorators = require('lit/decorators');
|
|
8
|
+
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
|
+
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
10
|
+
var btn_controller = require('../../../controllers/btn_controller/btn_controller.js');
|
|
11
|
+
var icon_constants = require('../../icon/icon_constants.js');
|
|
12
|
+
var file_picker_constants = require('./file_picker_constants.js');
|
|
13
|
+
|
|
14
|
+
exports.HFilePickerLabel = class HFilePickerLabel extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this._dispatchClickEvent = () => {
|
|
18
|
+
this.dispatchEvent(new CustomEvent(file_picker_constants.FILE_PICKER_LABEL_EVENT_NAMES.filePickerLabelClickedByEnterKey, {
|
|
19
|
+
bubbles: true
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
this._btnController = new btn_controller.BtnController(this, this._dispatchClickEvent);
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
super.render();
|
|
26
|
+
return lit.html `<label class="${file_picker_constants.FILE_PICKER_CONTROL_CSS_CLASSES.filePickerLabel}" for="${this.controlId}">
|
|
27
|
+
${this.labelIconName
|
|
28
|
+
? lit.html `<h-icon
|
|
29
|
+
class="${icon_constants.ICON_CSS_CLASSES.icon} ${file_picker_constants.FILE_PICKER_ICON_CSS_CLASSES.filePickerIcon}"
|
|
30
|
+
icon-name=${this.labelIconName}
|
|
31
|
+
/>`
|
|
32
|
+
: lit.nothing}
|
|
33
|
+
${this.labelText}
|
|
34
|
+
</label>`;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
tslib_es6.__decorate([
|
|
38
|
+
decorators.property({ type: String, attribute: 'control-id', reflect: true }),
|
|
39
|
+
tslib_es6.__metadata("design:type", String)
|
|
40
|
+
], exports.HFilePickerLabel.prototype, "controlId", void 0);
|
|
41
|
+
tslib_es6.__decorate([
|
|
42
|
+
decorators.property({ type: String, attribute: 'label-text' }),
|
|
43
|
+
tslib_es6.__metadata("design:type", String)
|
|
44
|
+
], exports.HFilePickerLabel.prototype, "labelText", void 0);
|
|
45
|
+
tslib_es6.__decorate([
|
|
46
|
+
decorators.property({ type: String, attribute: 'label-icon-name' }),
|
|
47
|
+
tslib_es6.__metadata("design:type", String)
|
|
48
|
+
], exports.HFilePickerLabel.prototype, "labelIconName", void 0);
|
|
49
|
+
exports.HFilePickerLabel = tslib_es6.__decorate([
|
|
50
|
+
phoenix_custom_element.phoenixCustomElement('h-file-picker-label'),
|
|
51
|
+
tslib_es6.__metadata("design:paramtypes", [])
|
|
52
|
+
], exports.HFilePickerLabel);
|
|
53
|
+
//# sourceMappingURL=file_picker_label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;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;"}
|
|
@@ -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;"}
|
|
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;"}
|
|
@@ -23,6 +23,10 @@ var dropdown_toggler = require('./components/dropdown/dropdown_toggler.js');
|
|
|
23
23
|
var relative_position_controller = require('./controllers/relative_position_controller/relative_position_controller.js');
|
|
24
24
|
var dropdown = require('./components/dropdown/dropdown.js');
|
|
25
25
|
var select = require('./components/form/select/select.js');
|
|
26
|
+
var file = require('./components/form/file_picker/file/file.js');
|
|
27
|
+
var input_constants = require('./components/form/input/input_constants.js');
|
|
28
|
+
var file_picker = require('./components/form/file_picker/file_picker.js');
|
|
29
|
+
var file_picker_label = require('./components/form/file_picker/file_picker_label.js');
|
|
26
30
|
var modal = require('./components/modal/modal.js');
|
|
27
31
|
var modal_opener = require('./components/modal/modal_opener.js');
|
|
28
32
|
var modal_body = require('./components/modal/modal_body.js');
|
|
@@ -36,7 +40,6 @@ var control_content = require('./components/form/control/control_content.js');
|
|
|
36
40
|
var control_element = require('./components/form/control/control_element.js');
|
|
37
41
|
var control_label = require('./components/form/control/control_label.js');
|
|
38
42
|
var control_additional_content = require('./components/form/control/control_additional_content.js');
|
|
39
|
-
var input_constants = require('./components/form/input/input_constants.js');
|
|
40
43
|
var input = require('./components/form/input/input.js');
|
|
41
44
|
var input_control = require('./components/form/input/input_control.js');
|
|
42
45
|
var input_icon = require('./components/form/input/input_icon.js');
|
|
@@ -165,6 +168,29 @@ Object.defineProperty(exports, 'HSelect', {
|
|
|
165
168
|
return select.HSelect;
|
|
166
169
|
}
|
|
167
170
|
});
|
|
171
|
+
Object.defineProperty(exports, 'HFile', {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
get: function () {
|
|
174
|
+
return file.HFile;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
exports.INPUT_CONTROL_CSS_CLASSES = input_constants.INPUT_CONTROL_CSS_CLASSES;
|
|
178
|
+
exports.INPUT_CONTROL_EVENTS = input_constants.INPUT_CONTROL_EVENTS;
|
|
179
|
+
exports.INPUT_CONTROL_SIZES = input_constants.INPUT_CONTROL_SIZES;
|
|
180
|
+
exports.INPUT_CONTROL_TYPES = input_constants.INPUT_CONTROL_TYPES;
|
|
181
|
+
exports.INPUT_PROPS_TO_SYNC = input_constants.INPUT_PROPS_TO_SYNC;
|
|
182
|
+
Object.defineProperty(exports, 'HFilePicker', {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function () {
|
|
185
|
+
return file_picker.HFilePicker;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
Object.defineProperty(exports, 'HFilePickerLabel', {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: function () {
|
|
191
|
+
return file_picker_label.HFilePickerLabel;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
168
194
|
Object.defineProperty(exports, 'HModal', {
|
|
169
195
|
enumerable: true,
|
|
170
196
|
get: function () {
|
|
@@ -241,11 +267,6 @@ Object.defineProperty(exports, 'HControlAdditionalContent', {
|
|
|
241
267
|
return control_additional_content.HControlAdditionalContent;
|
|
242
268
|
}
|
|
243
269
|
});
|
|
244
|
-
exports.INPUT_CONTROL_CSS_CLASSES = input_constants.INPUT_CONTROL_CSS_CLASSES;
|
|
245
|
-
exports.INPUT_CONTROL_EVENTS = input_constants.INPUT_CONTROL_EVENTS;
|
|
246
|
-
exports.INPUT_CONTROL_SIZES = input_constants.INPUT_CONTROL_SIZES;
|
|
247
|
-
exports.INPUT_CONTROL_TYPES = input_constants.INPUT_CONTROL_TYPES;
|
|
248
|
-
exports.INPUT_PROPS_TO_SYNC = input_constants.INPUT_PROPS_TO_SYNC;
|
|
249
270
|
Object.defineProperty(exports, 'HInput', {
|
|
250
271
|
enumerable: true,
|
|
251
272
|
get: function () {
|
|
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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 HFile extends PhoenixLightLitElement {
|
|
4
|
+
name: string;
|
|
5
|
+
id: string;
|
|
6
|
+
removeButtonText: string;
|
|
7
|
+
removeButtonIconName: string;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
protected render(): TemplateResult;
|
|
10
|
+
private _handleClick;
|
|
11
|
+
}
|
|
@@ -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;"}
|
|
@@ -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';
|
|
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|