@shoper/phoenix_design_system 1.2.0-1 → 1.2.0-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file.js +67 -0
  2. package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file.js.map +1 -0
  3. package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file_model.js +18 -0
  4. package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file_model.js.map +1 -0
  5. package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js +177 -0
  6. package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js.map +1 -0
  7. package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_constants.js +37 -0
  8. package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map +1 -0
  9. package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_label.js +59 -0
  10. package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_label.js.map +1 -0
  11. package/build/cjs/packages/phoenix/src/components/form/select/components/option/select_option.js +6 -5
  12. package/build/cjs/packages/phoenix/src/components/form/select/components/option/select_option.js.map +1 -1
  13. package/build/cjs/packages/phoenix/src/components/form/select/controllers/base_select_controller.js +13 -13
  14. package/build/cjs/packages/phoenix/src/components/form/select/controllers/multi_select_controller.js +6 -6
  15. package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_controller.js +2 -2
  16. package/build/cjs/packages/phoenix/src/components/form/select/select.js +23 -79
  17. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  18. package/build/cjs/packages/phoenix/src/components/form/select/select_constants.js +0 -5
  19. package/build/cjs/packages/phoenix/src/components/form/select/select_constants.js.map +1 -1
  20. package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js +0 -6
  21. package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
  22. package/build/cjs/packages/phoenix/src/components/modal/modal.js +1 -1
  23. package/build/cjs/packages/phoenix/src/index.js +21 -0
  24. package/build/cjs/packages/phoenix/src/index.js.map +1 -1
  25. package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.d.ts +12 -0
  26. package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.js +65 -0
  27. package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.js.map +1 -0
  28. package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.d.ts +9 -0
  29. package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.js +14 -0
  30. package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.js.map +1 -0
  31. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.d.ts +31 -0
  32. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js +175 -0
  33. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js.map +1 -0
  34. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.d.ts +29 -0
  35. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js +29 -0
  36. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map +1 -0
  37. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.d.ts +13 -0
  38. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.js +57 -0
  39. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.js.map +1 -0
  40. package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.d.ts +1 -2
  41. package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.js +6 -5
  42. package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.js.map +1 -1
  43. package/build/esm/packages/phoenix/src/components/form/select/controllers/base_select_controller.d.ts +10 -10
  44. package/build/esm/packages/phoenix/src/components/form/select/controllers/base_select_controller.js +13 -13
  45. package/build/esm/packages/phoenix/src/components/form/select/controllers/multi_select_controller.d.ts +3 -3
  46. package/build/esm/packages/phoenix/src/components/form/select/controllers/multi_select_controller.js +6 -6
  47. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controller.d.ts +1 -1
  48. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controller.js +2 -2
  49. package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controllers_types.d.ts +9 -9
  50. package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +3 -16
  51. package/build/esm/packages/phoenix/src/components/form/select/select.js +24 -80
  52. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  53. package/build/esm/packages/phoenix/src/components/form/select/select_constants.d.ts +0 -4
  54. package/build/esm/packages/phoenix/src/components/form/select/select_constants.js +1 -5
  55. package/build/esm/packages/phoenix/src/components/form/select/select_constants.js.map +1 -1
  56. package/build/esm/packages/phoenix/src/components/form/select/select_utils.d.ts +0 -2
  57. package/build/esm/packages/phoenix/src/components/form/select/select_utils.js +0 -6
  58. package/build/esm/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
  59. package/build/esm/packages/phoenix/src/components/modal/modal.js +1 -1
  60. package/build/esm/packages/phoenix/src/index.d.ts +3 -0
  61. package/build/esm/packages/phoenix/src/index.js +3 -0
  62. package/build/esm/packages/phoenix/src/index.js.map +1 -1
  63. package/package.json +2 -2
  64. package/build/esm/packages/phoenix/src/components/form/input_stepper/display_input.d.ts +0 -9
  65. package/build/esm/packages/phoenix/src/components/form/input_stepper/display_input.js +0 -49
  66. package/build/esm/packages/phoenix/src/components/form/input_stepper/display_input.js.map +0 -1
  67. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.d.ts +0 -19
  68. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.js +0 -93
  69. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.js.map +0 -1
  70. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.d.ts +0 -11
  71. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js +0 -12
  72. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js.map +0 -1
  73. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.d.ts +0 -3
  74. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.js +0 -3
  75. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_types.js.map +0 -1
  76. package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.d.ts +0 -8
  77. package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.js +0 -35
  78. package/build/esm/packages/phoenix/src/components/form/input_stepper/stepper_action_button.js.map +0 -1
  79. package/build/esm/packages/phoenix/src/components/form/select/select_types.d.ts +0 -2
  80. package/build/esm/packages/phoenix/src/components/form/select/select_types.js +0 -2
  81. package/build/esm/packages/phoenix/src/components/form/select/select_types.js.map +0 -1
@@ -30,10 +30,9 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
30
30
  constructor() {
31
31
  var _a;
32
32
  super();
33
- this.multiple = false;
33
+ this.multiselect = false;
34
34
  this.opened = false;
35
35
  this.offset = 2;
36
- this.type = select_constants.SELECT_TYPES.select;
37
36
  this._searchValue = '';
38
37
  this._$options = {};
39
38
  this._$dropdown = ref_js.createRef();
@@ -46,11 +45,10 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
46
45
  this._$dropdownContent.value.style.width = `${width !== null && width !== void 0 ? width : ''}px`;
47
46
  };
48
47
  this._handleOptionDeselect = (event) => {
49
- const selectedOption = this._selectController.getOption(event.detail);
48
+ const selectedOption = this._selectController.getSelectOption(event.detail);
50
49
  if (!selectedOption)
51
50
  return;
52
- this._selectController.deselect(selectedOption);
53
- this._dispatchChangeEvent();
51
+ this._selectController.deselectOption(selectedOption);
54
52
  };
55
53
  this._updateOptionsView = (options) => {
56
54
  if (options.length < Object.keys(this._$options).length)
@@ -65,11 +63,16 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
65
63
  select_utils.SelectControlUtils.syncHTMLOptionWithModel(option, $option);
66
64
  if (!selected)
67
65
  return;
68
- $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'true');
66
+ $option.setAttribute(this.multiselect ? 'aria-checked' : 'aria-selected', 'true');
69
67
  });
70
68
  };
71
69
  this._handleOptionClicked = (event) => {
72
- this._selectOption(event.detail.$option.value);
70
+ const selectedOption = this._selectController.getSelectOption(event.detail.$option.value);
71
+ if (!selectedOption)
72
+ return;
73
+ this._selectController.toggleOption(selectedOption);
74
+ if (!this.multiselect)
75
+ this._closeSelect();
73
76
  };
74
77
  this._handleDropdownHidden = () => {
75
78
  this._searchValue = '';
@@ -82,11 +85,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
82
85
  (_a = this._$dropdown.value) === null || _a === void 0 ? void 0 : _a.hide();
83
86
  };
84
87
  this._clearOptions = () => {
85
- this._selectController.deselectAll();
86
- this._dispatchChangeEvent();
87
- };
88
- this._dispatchChangeEvent = () => {
89
- this.dispatchEvent(new Event('change'));
88
+ this._selectController.deselectOptions();
90
89
  };
91
90
  this._handleResize = debounce['default'](() => {
92
91
  this._closeSelect();
@@ -95,39 +94,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
95
94
  const $options = Array.from(this.querySelectorAll(select_components_constatns.SELECT_RELATED_COMPONENTS_NAMES.option));
96
95
  $options.forEach(($option) => $option.setAttribute('slot', select_constants.SELECT_SLOT_NAMES.content));
97
96
  this.$placeholder = (_a = this.querySelector(`[slot="${select_components_constatns.SELECT_INPUT_PLACEHOLDER_SLOT_NAME}"]`)) !== null && _a !== void 0 ? _a : 'Select';
98
- if (this.multiple)
99
- this.type = select_constants.SELECT_TYPES.multiple;
100
- }
101
- get selectedIndex() {
102
- const selectedOptions = this._selectController.selectedOptions$.getValue();
103
- if (!selectedOptions || selectedOptions.length === 0)
104
- return -1;
105
- const htmlOptions = Object.values(this._$options);
106
- return this.multiple
107
- ? select_utils.SelectControlUtils.getFirstIndexSelectedOption(htmlOptions)
108
- : select_utils.SelectControlUtils.getLastIndexOfSelectedOption(htmlOptions);
109
- }
110
- set selectedIndex(index) {
111
- const option = Object.values(this._$options)[index];
112
- if (!option) {
113
- this._selectController.deselectAll();
114
- return;
115
- }
116
- this._selectOption(option.value);
117
- }
118
- get selectedOptions() {
119
- var _a;
120
- const selectedOptions = (_a = this._selectController.selectedOptions$.getValue()) !== null && _a !== void 0 ? _a : [];
121
- return selectedOptions.filter((option) => option.selected).map((option) => this._$options[option.value]);
122
- }
123
- get name() {
124
- return this.controlName;
125
- }
126
- get id() {
127
- return this.controlId;
128
- }
129
- get options() {
130
- return Object.values(this._$options);
131
97
  }
132
98
  updated(changedProperties) {
133
99
  super.updated(changedProperties);
@@ -154,9 +120,9 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
154
120
  connectedCallback() {
155
121
  super.connectedCallback();
156
122
  this.classList.add(select_constants.SELECT_CSS_CLASSES.select);
157
- this._selectController = this.multiple ? new multi_select_controller.MultiSelectController({ host: this }) : new select_controller.SelectController({ host: this });
123
+ this._selectController = this.multiselect ? new multi_select_controller.MultiSelectController({ host: this }) : new select_controller.SelectController({ host: this });
158
124
  this._selectContext.provide(select_constants.SELECT_CONTEXTS.selectedOptions$, this._selectController.selectedOptions$);
159
- this._selectContext.provide(select_constants.SELECT_CONTEXTS.isMultiselect, this.multiple);
125
+ this._selectContext.provide(select_constants.SELECT_CONTEXTS.isMultiselect, this.multiselect);
160
126
  const $options = Array.from(this.querySelectorAll(select_components_constatns.SELECT_RELATED_COMPONENTS_NAMES.option));
161
127
  this._optionsObserver = new observer.Observer((selectedOptions) => this._updateOptionsView(selectedOptions));
162
128
  this._selectController.options$.subscribe(this._optionsObserver);
@@ -200,38 +166,29 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
200
166
  const { value, selected } = option;
201
167
  const $option = select_utils.SelectControlUtils.createHTMLOption(option);
202
168
  if (selected)
203
- $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'true');
169
+ $option.setAttribute(this.multiselect ? 'aria-checked' : 'aria-selected', 'true');
204
170
  this._$options[value] = $option;
205
171
  select_utils.SelectControlUtils.appendHTMLOption($option, $list, position);
206
172
  }
207
173
  _removeHTMLOptions(optionsValues) {
208
174
  this._$options = select_utils.SelectControlUtils.removeHTMLOptions(Object.values(this._$options), optionsValues);
209
175
  }
210
- _selectOption(value) {
211
- const option = this._selectController.getOption(value);
212
- if (!option)
213
- return;
214
- this._selectController.toggle(option);
215
- if (!this.multiple)
216
- this._closeSelect();
217
- this._dispatchChangeEvent();
218
- }
219
176
  _handleSearch({ detail }) {
220
177
  this._searchValue = detail;
221
178
  }
222
179
  update(changedProperties) {
223
180
  super.update(changedProperties);
224
181
  if (changedProperties.has('_searchValue'))
225
- this._selectController.filter(this._searchValue);
182
+ this._selectController.filterOptions(this._searchValue);
226
183
  }
227
- add(option, position) {
228
- this._selectController.add(option, position);
184
+ addOption(option, position) {
185
+ this._selectController.addOption(option, position);
229
186
  }
230
187
  removeOption(optionValue) {
231
- this._selectController.remove(optionValue);
188
+ this._selectController.removeOption(optionValue);
232
189
  }
233
- replace(options) {
234
- this._selectController.replace(options);
190
+ replaceOptions(options) {
191
+ this._selectController.replaceOptions(options);
235
192
  }
236
193
  disconnectedCallback() {
237
194
  super.disconnectedCallback();
@@ -261,7 +218,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
261
218
  <h-dropdown-toggler name=${this.controlName}> ${this.getSlot(select_constants.SELECT_SLOT_NAMES.toggler)} </h-dropdown-toggler>
262
219
 
263
220
  <h-dropdown-content
264
- @focusout=${this._dispatchChangeEvent}
265
221
  class="${select_constants.SELECT_CSS_CLASSES.selectContent} ${this.error ? select_constants.SELECT_CSS_CLASSES.selectContentError : ''}"
266
222
  ${ref_js.ref(this._$dropdownContent)}
267
223
  name=${this.controlName}
@@ -301,7 +257,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
301
257
  </p>
302
258
  </div>`
303
259
  : lit.nothing}
304
- ${this.multiple && this._selectController.selectedOptionsCount >= 1
260
+ ${this.multiselect && this._selectController.selectedOptionsCount >= 1
305
261
  ? lit.html `
306
262
  <section class=${select_constants.SELECT_CSS_CLASSES.selectFooter}>
307
263
  <button class="${select_constants.SELECT_CSS_CLASSES.selectClearButton}" @click=${this._clearOptions}>clear</button>
@@ -325,17 +281,13 @@ exports.HSelect._components = {
325
281
  toggler: select_toggler.HSelectToggler
326
282
  };
327
283
  tslib_es6.__decorate([
328
- decorators_js.property({ type: String, attribute: 'control-name' }),
284
+ decorators_js.property({ type: String }),
329
285
  tslib_es6.__metadata("design:type", String)
330
286
  ], exports.HSelect.prototype, "controlName", void 0);
331
- tslib_es6.__decorate([
332
- decorators_js.property({ type: String, attribute: 'control-id' }),
333
- tslib_es6.__metadata("design:type", String)
334
- ], exports.HSelect.prototype, "controlId", void 0);
335
287
  tslib_es6.__decorate([
336
288
  decorators_js.property({ type: Boolean }),
337
289
  tslib_es6.__metadata("design:type", Boolean)
338
- ], exports.HSelect.prototype, "multiple", void 0);
290
+ ], exports.HSelect.prototype, "multiselect", void 0);
339
291
  tslib_es6.__decorate([
340
292
  decorators_js.property({ type: Boolean }),
341
293
  tslib_es6.__metadata("design:type", Boolean)
@@ -352,14 +304,6 @@ tslib_es6.__decorate([
352
304
  decorators_js.property({ type: Boolean }),
353
305
  tslib_es6.__metadata("design:type", Boolean)
354
306
  ], exports.HSelect.prototype, "disabled", void 0);
355
- tslib_es6.__decorate([
356
- decorators_js.property({ type: String }),
357
- tslib_es6.__metadata("design:type", String)
358
- ], exports.HSelect.prototype, "type", void 0);
359
- tslib_es6.__decorate([
360
- decorators_js.property({ type: Boolean }),
361
- tslib_es6.__metadata("design:type", Boolean)
362
- ], exports.HSelect.prototype, "required", void 0);
363
307
  tslib_es6.__decorate([
364
308
  decorators.state(),
365
309
  tslib_es6.__metadata("design:type", String)
@@ -1 +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,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;"}
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,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;"}
@@ -10,10 +10,6 @@ const SELECT_SLOT_NAMES = {
10
10
  content: 'content',
11
11
  toggler: 'toggler'
12
12
  };
13
- const SELECT_TYPES = {
14
- select: 'select-one',
15
- multiple: 'select-multiple'
16
- };
17
13
  const SELECT_EVENT_NAMES = {
18
14
  selectOption: 'selectOption.select',
19
15
  deselectOption: 'selectOption.deselect'
@@ -46,5 +42,4 @@ exports.SELECT_CSS_CLASSES = SELECT_CSS_CLASSES;
46
42
  exports.SELECT_EVENT_NAMES = SELECT_EVENT_NAMES;
47
43
  exports.SELECT_RESIZE_DEBOUNCE_TIME = SELECT_RESIZE_DEBOUNCE_TIME;
48
44
  exports.SELECT_SLOT_NAMES = SELECT_SLOT_NAMES;
49
- exports.SELECT_TYPES = SELECT_TYPES;
50
45
  //# sourceMappingURL=select_constants.js.map
@@ -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;"}
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;"}
@@ -46,12 +46,6 @@ class SelectControlUtils {
46
46
  }
47
47
  $list.append($option);
48
48
  }
49
- static getFirstIndexSelectedOption(options) {
50
- return options.findIndex((option) => option.selected);
51
- }
52
- static getLastIndexOfSelectedOption(options) {
53
- return [...options].reverse().findIndex((option) => option.selected);
54
- }
55
49
  }
56
50
 
57
51
  exports.SelectControlUtils = SelectControlUtils;
@@ -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;"}
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;"}
@@ -6,11 +6,11 @@ var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
6
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
7
7
  var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
8
8
  var decorators_js = require('@lit/reactive-element/decorators.js');
9
- require('@lit/reactive-element');
10
9
  var litHtml = require('lit-html');
11
10
  var ref_js = require('lit-html/directives/ref.js');
12
11
  var portal_constants = require('../portal/portal_constants.js');
13
12
  var backdrop_controller = require('../backdrop/controller/backdrop_controller.js');
13
+ require('@lit/reactive-element');
14
14
  var modal_constants = require('./modal_constants.js');
15
15
 
16
16
  var HModal_1;
@@ -23,6 +23,9 @@ 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 file_picker = require('./components/form/file_picker/file_picker.js');
28
+ var file_picker_label = require('./components/form/file_picker/file_picker_label.js');
26
29
  var modal = require('./components/modal/modal.js');
27
30
  var modal_opener = require('./components/modal/modal_opener.js');
28
31
  var modal_body = require('./components/modal/modal_body.js');
@@ -162,6 +165,24 @@ Object.defineProperty(exports, 'HSelect', {
162
165
  return select.HSelect;
163
166
  }
164
167
  });
168
+ Object.defineProperty(exports, 'HFile', {
169
+ enumerable: true,
170
+ get: function () {
171
+ return file.HFile;
172
+ }
173
+ });
174
+ Object.defineProperty(exports, 'HFilePicker', {
175
+ enumerable: true,
176
+ get: function () {
177
+ return file_picker.HFilePicker;
178
+ }
179
+ });
180
+ Object.defineProperty(exports, 'HFilePickerLabel', {
181
+ enumerable: true,
182
+ get: function () {
183
+ return file_picker_label.HFilePickerLabel;
184
+ }
185
+ });
165
186
  Object.defineProperty(exports, 'HModal', {
166
187
  enumerable: true,
167
188
  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;"}
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;"}
@@ -0,0 +1,12 @@
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
+ containerId: string;
6
+ removeButtonText: string;
7
+ removeButtonIconName: string;
8
+ constructor();
9
+ connectedCallback(): void;
10
+ protected render(): TemplateResult;
11
+ private _handleClick;
12
+ }
@@ -0,0 +1,65 @@
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();
12
+ this._handleClick = () => {
13
+ const removeItemEvent = new CustomEvent(FILE_ITEM_EVENT_NAMES.removed, {
14
+ bubbles: true
15
+ });
16
+ this.dispatchEvent(removeItemEvent);
17
+ };
18
+ }
19
+ connectedCallback() {
20
+ super.connectedCallback();
21
+ this.setAttribute('aria-label', this.name);
22
+ this.classList.add(FILE_ITEM_CSS_CLASSES.file);
23
+ }
24
+ render() {
25
+ return html `
26
+ <span class="${FILE_ITEM_CSS_CLASSES.fileName}">${this.name}</span>
27
+ <button
28
+ class="${FILE_ITEM_CSS_CLASSES.fileRemoveButton}"
29
+ @click="${this._handleClick}"
30
+ aria-label="${this.removeButtonText} ${this.name}"
31
+ >
32
+ ${this.removeButtonIconName
33
+ ? html `<h-icon
34
+ class="${ICON_CSS_CLASSES.icon} ${FILE_PICKER_ICON_CSS_CLASSES.filePickerIcon}"
35
+ icon-name=${this.removeButtonIconName}
36
+ />`
37
+ : nothing}
38
+ ${this.removeButtonText}
39
+ </button>
40
+ `;
41
+ }
42
+ };
43
+ __decorate([
44
+ property({ type: String }),
45
+ __metadata("design:type", String)
46
+ ], HFile.prototype, "name", void 0);
47
+ __decorate([
48
+ property({ type: String, attribute: 'container-id' }),
49
+ __metadata("design:type", String)
50
+ ], HFile.prototype, "containerId", void 0);
51
+ __decorate([
52
+ property({ type: String, attribute: 'remove-button-text' }),
53
+ __metadata("design:type", String)
54
+ ], HFile.prototype, "removeButtonText", void 0);
55
+ __decorate([
56
+ property({ type: String, attribute: 'remove-button-icon-name' }),
57
+ __metadata("design:type", String)
58
+ ], HFile.prototype, "removeButtonIconName", void 0);
59
+ HFile = __decorate([
60
+ phoenixCustomElement('h-file'),
61
+ __metadata("design:paramtypes", [])
62
+ ], HFile);
63
+
64
+ export { HFile };
65
+ //# 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;"}
@@ -0,0 +1,9 @@
1
+ import { TFileItemConstructorOptions } from '../file_picker_constants';
2
+ export declare class FileItem {
3
+ name: string;
4
+ containerId: string;
5
+ removeButtonText: string;
6
+ removeButtonIconName: string | undefined;
7
+ private constructor();
8
+ static create(options: TFileItemConstructorOptions): FileItem;
9
+ }
@@ -0,0 +1,14 @@
1
+ class FileItem {
2
+ constructor({ name, containerId, removeButtonText, removeButtonIconName }) {
3
+ this.name = name;
4
+ this.containerId = containerId;
5
+ this.removeButtonText = removeButtonText;
6
+ this.removeButtonIconName = removeButtonIconName;
7
+ }
8
+ static create(options) {
9
+ return new FileItem(options);
10
+ }
11
+ }
12
+
13
+ export { FileItem };
14
+ //# 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;"}
@@ -0,0 +1,31 @@
1
+ import { TemplateResult } from 'lit';
2
+ import { FileItem } from "./file/file_model";
3
+ import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
4
+ export declare class HFilePicker extends PhoenixLightLitElement {
5
+ controlId: string;
6
+ controlName: string;
7
+ disabled: boolean;
8
+ required: boolean;
9
+ error: boolean;
10
+ value: string;
11
+ labelText: string;
12
+ labelIconName: string;
13
+ removeButtonText: string;
14
+ removeButtonIconName: string;
15
+ formats: string;
16
+ files: FileList | null;
17
+ file: FileItem;
18
+ private _$fileInputRef;
19
+ constructor();
20
+ connectedCallback(): void;
21
+ disconnectedCallback(): void;
22
+ protected render(): TemplateResult;
23
+ private _addEventListeners;
24
+ private _handleChangeEvent;
25
+ private _getFiles;
26
+ private _getFileName;
27
+ private _getInputRefValue;
28
+ private _removeFileItem;
29
+ private _triggerClickOnLabel;
30
+ private _dispatchChangeEvent;
31
+ }
@@ -0,0 +1,175 @@
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 { FILE_PICKER_CONTROL_CSS_CLASSES, FILE_ITEM_EVENT_NAMES, FILE_PICKER_LABEL_EVENT_NAMES } from './file_picker_constants.js';
9
+ import { FileItem } from './file/file_model.js';
10
+ import { ifDefined } from 'lit/directives/if-defined';
11
+
12
+ let HFilePicker = class HFilePicker extends PhoenixLightLitElement {
13
+ constructor() {
14
+ super();
15
+ this._$fileInputRef = createRef();
16
+ this._handleChangeEvent = (event) => {
17
+ const filesList = this._getFiles(event);
18
+ if (filesList.length > 0) {
19
+ this.file = FileItem.create({
20
+ name: this._getFileName(filesList),
21
+ containerId: this.controlId,
22
+ removeButtonText: this.removeButtonText,
23
+ removeButtonIconName: this.removeButtonIconName
24
+ });
25
+ this.classList.add(FILE_PICKER_CONTROL_CSS_CLASSES.filePickerHasValue);
26
+ this._dispatchChangeEvent();
27
+ }
28
+ };
29
+ this._getFiles = (event) => {
30
+ const targetElement = event.currentTarget;
31
+ this.files = targetElement.files;
32
+ return this.files;
33
+ };
34
+ this._getFileName = (fileList) => {
35
+ return fileList[0].name;
36
+ };
37
+ this._getInputRefValue = () => {
38
+ return this._$fileInputRef.value;
39
+ };
40
+ this._removeFileItem = () => {
41
+ const $fileInput = this._getInputRefValue();
42
+ if ($fileInput)
43
+ $fileInput.value = '';
44
+ this.files = null;
45
+ this.file = FileItem.create({
46
+ name: '',
47
+ containerId: '',
48
+ removeButtonText: '',
49
+ removeButtonIconName: ''
50
+ });
51
+ this.classList.remove(FILE_PICKER_CONTROL_CSS_CLASSES.filePickerHasValue);
52
+ this._dispatchChangeEvent();
53
+ };
54
+ this._triggerClickOnLabel = () => {
55
+ const $fileInput = this._getInputRefValue();
56
+ if ($fileInput)
57
+ $fileInput.click();
58
+ };
59
+ this._dispatchChangeEvent = () => {
60
+ this.dispatchEvent(new Event('change'));
61
+ };
62
+ }
63
+ connectedCallback() {
64
+ super.connectedCallback();
65
+ this._addEventListeners();
66
+ const cssClasses = classnames({
67
+ [FILE_PICKER_CONTROL_CSS_CLASSES.filePickerDisabled]: this.disabled,
68
+ [FILE_PICKER_CONTROL_CSS_CLASSES.filePickerRequired]: this.required,
69
+ [FILE_PICKER_CONTROL_CSS_CLASSES.filePickerError]: this.error
70
+ });
71
+ if (cssClasses)
72
+ this.classList.add(cssClasses);
73
+ }
74
+ disconnectedCallback() {
75
+ super.disconnectedCallback();
76
+ }
77
+ render() {
78
+ var _a, _b;
79
+ super.render();
80
+ return html `
81
+ <input
82
+ ${ref(this._$fileInputRef)}
83
+ type="file"
84
+ class="${FILE_PICKER_CONTROL_CSS_CLASSES.filePickerInput}"
85
+ id="${ifDefined(this.controlId)}"
86
+ name="${ifDefined(this.controlName)}"
87
+ value="${ifDefined(this.value)}"
88
+ ?disabled="${this.disabled}"
89
+ ?required="${this.required}"
90
+ accept="${ifDefined(this.formats)}"
91
+ @change="${this._handleChangeEvent}"
92
+ hidden
93
+ />
94
+
95
+ ${!((_a = this.file) === null || _a === void 0 ? void 0 : _a.name)
96
+ ? html ` <h-file-picker-label
97
+ control-id="${this.controlId}"
98
+ label-text="${this.labelText}"
99
+ label-icon-name="${ifDefined(this.labelIconName)}"
100
+ />`
101
+ : nothing}
102
+ ${((_b = this.file) === null || _b === void 0 ? void 0 : _b.name)
103
+ ? html `<h-file
104
+ name="${this.file.name}"
105
+ container-id="${this.file.containerId}"
106
+ remove-button-text="${this.file.removeButtonText}"
107
+ remove-button-icon-name="${ifDefined(this.file.removeButtonIconName)}"
108
+ />`
109
+ : nothing}
110
+ `;
111
+ }
112
+ _addEventListeners() {
113
+ this.addEventListener(FILE_ITEM_EVENT_NAMES.removed, this._removeFileItem);
114
+ this.addEventListener(FILE_PICKER_LABEL_EVENT_NAMES.filePickerLabelClicked, this._triggerClickOnLabel);
115
+ }
116
+ };
117
+ __decorate([
118
+ property({ type: String, attribute: 'control-id', reflect: true }),
119
+ __metadata("design:type", String)
120
+ ], HFilePicker.prototype, "controlId", void 0);
121
+ __decorate([
122
+ property({ type: String, attribute: 'control-name' }),
123
+ __metadata("design:type", String)
124
+ ], HFilePicker.prototype, "controlName", void 0);
125
+ __decorate([
126
+ property({ type: Boolean }),
127
+ __metadata("design:type", Boolean)
128
+ ], HFilePicker.prototype, "disabled", void 0);
129
+ __decorate([
130
+ property({ type: Boolean }),
131
+ __metadata("design:type", Boolean)
132
+ ], HFilePicker.prototype, "required", void 0);
133
+ __decorate([
134
+ property({ type: Boolean }),
135
+ __metadata("design:type", Boolean)
136
+ ], HFilePicker.prototype, "error", void 0);
137
+ __decorate([
138
+ property({ type: String }),
139
+ __metadata("design:type", String)
140
+ ], HFilePicker.prototype, "value", void 0);
141
+ __decorate([
142
+ property({ type: String, attribute: 'label-text' }),
143
+ __metadata("design:type", String)
144
+ ], HFilePicker.prototype, "labelText", void 0);
145
+ __decorate([
146
+ property({ type: String, attribute: 'label-icon-name' }),
147
+ __metadata("design:type", String)
148
+ ], HFilePicker.prototype, "labelIconName", void 0);
149
+ __decorate([
150
+ property({ type: String, attribute: 'remove-button-text' }),
151
+ __metadata("design:type", String)
152
+ ], HFilePicker.prototype, "removeButtonText", void 0);
153
+ __decorate([
154
+ property({ type: String, attribute: 'remove-button-icon-name' }),
155
+ __metadata("design:type", String)
156
+ ], HFilePicker.prototype, "removeButtonIconName", void 0);
157
+ __decorate([
158
+ property({ type: String }),
159
+ __metadata("design:type", String)
160
+ ], HFilePicker.prototype, "formats", void 0);
161
+ __decorate([
162
+ property({ type: FileList, reflect: true }),
163
+ __metadata("design:type", Object)
164
+ ], HFilePicker.prototype, "files", void 0);
165
+ __decorate([
166
+ state(),
167
+ __metadata("design:type", FileItem)
168
+ ], HFilePicker.prototype, "file", void 0);
169
+ HFilePicker = __decorate([
170
+ phoenixCustomElement('h-file-picker'),
171
+ __metadata("design:paramtypes", [])
172
+ ], HFilePicker);
173
+
174
+ export { HFilePicker };
175
+ //# 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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}