@shoper/phoenix_design_system 1.9.0-7 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +1 -1
  2. package/build/cjs/packages/phoenix/src/components/form/select/model/select_option_mapper.js +4 -4
  3. package/build/cjs/packages/phoenix/src/components/form/select/select.js +36 -68
  4. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/messages/base_message.js +2 -1
  6. package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator.js +229 -0
  8. package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator.js.map +1 -0
  9. package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller.js +2 -2
  10. package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_constants.js +43 -0
  11. package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_constants.js.map +1 -1
  12. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +2 -2
  13. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_types.d.ts +1 -1
  14. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_types.js +1 -1
  15. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_types.js.map +1 -1
  16. package/build/esm/packages/phoenix/src/components/form/select/model/select_option.d.ts +1 -1
  17. package/build/esm/packages/phoenix/src/components/form/select/model/{select_option_types.d.ts → select_option_constants.d.ts} +1 -2
  18. package/build/esm/packages/phoenix/src/components/form/select/model/select_option_constants.js +2 -0
  19. package/build/esm/packages/phoenix/src/components/form/select/model/select_option_constants.js.map +1 -0
  20. package/build/esm/packages/phoenix/src/components/form/select/model/select_option_mapper.js +4 -4
  21. package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +0 -6
  22. package/build/esm/packages/phoenix/src/components/form/select/select.js +35 -67
  23. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  24. package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +1 -1
  25. package/build/esm/packages/phoenix/src/components/messages/base_message.js +2 -1
  26. package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  27. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator.d.ts +24 -0
  28. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator.js +225 -0
  29. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator.js.map +1 -0
  30. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator_types.d.ts +44 -0
  31. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator_types.js +4 -0
  32. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_calculator_types.js.map +1 -0
  33. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller.d.ts +1 -2
  34. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller.js +2 -2
  35. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_constants.d.ts +55 -0
  36. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_constants.js +39 -1
  37. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_constants.js.map +1 -1
  38. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_types.d.ts +12 -2
  39. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_types.js +1 -1
  40. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_types.js.map +1 -1
  41. package/build/esm/packages/phoenix/src/index.d.ts +0 -1
  42. package/package.json +1 -1
  43. package/build/esm/packages/phoenix/src/components/form/select/model/select_option_types.js +0 -2
  44. package/build/esm/packages/phoenix/src/components/form/select/model/select_option_types.js.map +0 -1
@@ -23,7 +23,7 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
23
23
  constructor() {
24
24
  super();
25
25
  this.opened = false;
26
- this.direction = utilities.DIRECTIONS.bottomCenter;
26
+ this.direction = relative_position_controller_constants.DIRECTIONS.bottomCenter;
27
27
  this.toggleOnHover = false;
28
28
  this.name = '';
29
29
  this.transition = 'direction';
@@ -7,19 +7,19 @@ var select_option = require('./select_option.js');
7
7
 
8
8
  class SelectOptionMapper {
9
9
  static toModel($option) {
10
- const $optionContent = $option.querySelector(select_components_constatns.SELECT_RELATED_COMPONENTS_NAMES.optionContent);
11
- const optionContentText = ($optionContent === null || $optionContent === void 0 ? void 0 : $optionContent.textContent) || ($optionContent === null || $optionContent === void 0 ? void 0 : $optionContent.innerText);
10
+ var _a;
11
+ const optionContent = (_a = $option.querySelector(select_components_constatns.SELECT_RELATED_COMPONENTS_NAMES.optionContent)) === null || _a === void 0 ? void 0 : _a.textContent;
12
12
  const value = $option.getAttribute('value');
13
13
  if (!value)
14
14
  throw new Error('h-option must contain a unique value');
15
- if (!optionContentText)
15
+ if (!optionContent)
16
16
  throw new Error('h-options must contains a h-option-content element inside');
17
17
  return select_option.SelectOption.create({
18
18
  value,
19
19
  disabled: $option.hasAttribute('disabled'),
20
20
  hidden: $option.hasAttribute('hidden'),
21
21
  inactive: $option.hasAttribute('inactive'),
22
- content: optionContentText,
22
+ content: optionContent,
23
23
  selected: $option.hasAttribute('selected')
24
24
  });
25
25
  }
@@ -11,8 +11,7 @@ var decorators_js = require('@lit/reactive-element/decorators.js');
11
11
  var select_components_constatns = require('./components/select_components_constatns.js');
12
12
  var observer = require('../../../core/classes/observer/observer.js');
13
13
  var icon = require('../../icon/icon.js');
14
- var select_option$1 = require('./components/option/select_option.js');
15
- var select_option = require('./model/select_option.js');
14
+ var select_option = require('./components/option/select_option.js');
16
15
  var select_constants = require('./select_constants.js');
17
16
  var observable_directive = require('../../../directives/observable_directive.js');
18
17
  var select_toggler = require('./components/toggler/select_toggler.js');
@@ -28,7 +27,6 @@ var multi_select_controller = require('./controllers/multi_select_controller.js'
28
27
  var select_utils = require('./select_utils.js');
29
28
  var select_controller = require('./controllers/select_controller.js');
30
29
  var select_option_mapper = require('./model/select_option_mapper.js');
31
- var repeat = require('lit/directives/repeat');
32
30
 
33
31
  exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLitElement {
34
32
  constructor() {
@@ -39,7 +37,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
39
37
  this.offset = 2;
40
38
  this.searchDisabled = false;
41
39
  this.type = select_constants.SELECT_TYPES.select;
42
- this.noDeselect = false;
43
40
  this._searchValue = '';
44
41
  this._$options = {};
45
42
  this._$dropdown = ref_js.createRef();
@@ -47,40 +44,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
47
44
  this._$optionsList = ref_js.createRef();
48
45
  this._$dropdownContent = ref_js.createRef();
49
46
  this._selectContext = new context_provider_controller.ContextProviderController(this);
50
- this._updateOptions = () => {
51
- const $options = this._getOptions();
52
- this._$options = $options.reduce((acc, $option) => {
53
- const value = $option.getAttribute('value');
54
- if (!value)
55
- throw Error('Select option must hava a value');
56
- if (acc[value] !== undefined)
57
- throw Error('Select options must hava a unique values.');
58
- return {
59
- ...acc,
60
- [value]: $option
61
- };
62
- }, {});
63
- const options = $options.map(select_option_mapper.SelectOptionMapper.toModel);
64
- this._selectController.options$.notify(options);
65
- if (options.length)
66
- this._selectController.selectedOptions$.notify(options.filter((option) => option.selected));
67
- };
68
- this._getOptions = () => {
69
- let $options;
70
- if (this.optionsList) {
71
- $options = this.optionsList.map(option => {
72
- return select_utils.SelectControlUtils.createHTMLOption(select_option.SelectOption.create(option));
73
- });
74
- }
75
- else {
76
- $options = this.hasSlot(select_constants.SELECT_SLOT_NAMES.content)
77
- ? this.getSlot(select_constants.SELECT_SLOT_NAMES.content)
78
- .map((litElement) => litElement.values[0])
79
- .filter((element) => element instanceof select_option$1.HOption)
80
- : Array.from(this.querySelectorAll(select_components_constatns.SELECT_RELATED_COMPONENTS_NAMES.option));
81
- }
82
- return $options;
83
- };
84
47
  this._handleOptionDeselect = (event) => {
85
48
  const selectedOption = this._selectController.getOption(event.detail);
86
49
  if (!selectedOption)
@@ -180,9 +143,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
180
143
  this.classList.remove(select_constants.SELECT_CSS_CLASSES.selectOpened);
181
144
  }
182
145
  }
183
- if (changedProperties.has('optionsList')) {
184
- this._updateOptions();
185
- }
186
146
  if (this._$optionsList.value && !this._listBoxController)
187
147
  this._listBoxController = new list_box_keyboard_controller.ListBoxKeyboardController({
188
148
  host: this,
@@ -203,9 +163,28 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
203
163
  this._selectController = this.multiple ? new multi_select_controller.MultiSelectController({ host: this }) : new select_controller.SelectController({ host: this });
204
164
  this._selectContext.provide(select_constants.SELECT_CONTEXTS.selectedOptions$, this._selectController.selectedOptions$);
205
165
  this._selectContext.provide(select_constants.SELECT_CONTEXTS.isMultiselect, this.multiple);
166
+ const $options = this.hasSlot(select_constants.SELECT_SLOT_NAMES.content)
167
+ ? this.getSlot(select_constants.SELECT_SLOT_NAMES.content)
168
+ .map((litElement) => litElement.values[0])
169
+ .filter((element) => element instanceof select_option.HOption)
170
+ : Array.from(this.querySelectorAll(select_components_constatns.SELECT_RELATED_COMPONENTS_NAMES.option));
206
171
  this._optionsObserver = new observer.Observer((selectedOptions) => this._updateOptionsView(selectedOptions));
207
172
  this._selectController.options$.subscribe(this._optionsObserver);
208
- this._updateOptions();
173
+ this._$options = $options.reduce((acc, $option) => {
174
+ const value = $option.getAttribute('value');
175
+ if (!value)
176
+ throw Error('Select option must hava a value');
177
+ if (acc[value] !== undefined)
178
+ throw Error('Select options must hava a unique values.');
179
+ return {
180
+ ...acc,
181
+ [value]: $option
182
+ };
183
+ }, {});
184
+ const options = $options.map(select_option_mapper.SelectOptionMapper.toModel);
185
+ this._selectController.options$.notify(options);
186
+ if (options.length)
187
+ this._selectController.selectedOptions$.notify(options.filter((option) => option.selected));
209
188
  this._setupEvents();
210
189
  }
211
190
  attributeChangedCallback(name, _old, value) {
@@ -245,7 +224,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
245
224
  const option = this._selectController.getOption(value);
246
225
  if (!option)
247
226
  return;
248
- this.noDeselect ? this._selectController.select(option) : this._selectController.toggle(option);
227
+ this._selectController.toggle(option);
249
228
  if (!this.multiple)
250
229
  this._closeSelect();
251
230
  this._dispatchChangeEvent();
@@ -278,11 +257,6 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
278
257
  _searchNoResult() {
279
258
  return Boolean(!this._selectController.visibleOptionsCount && Object.keys(this._$options).length);
280
259
  }
281
- _renderOption(option) {
282
- const fragment = document.createDocumentFragment();
283
- fragment.appendChild(option);
284
- return fragment;
285
- }
286
260
  render() {
287
261
  var _a;
288
262
  const options = (_a = this._selectController.options$.getValue()) !== null && _a !== void 0 ? _a : [];
@@ -318,18 +292,20 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
318
292
  @selectSearch.search=${this._handleSearch}
319
293
  ></h-select-search>`
320
294
  : lit.nothing}
321
-
322
- <h-options
323
- class="${select_constants.SELECT_CSS_CLASSES.selectOptions} ${this._searchNoResult()
324
- ? select_constants.SELECT_CSS_CLASSES.selectOptionsEmpty
325
- : ''}"
326
- ${ref_js.ref(this._$optionsList)}
327
- @selectOptions.clicked=${this._handleOptionClicked}
328
- @selectOptions.updated=${this._handleOptionUpdated}
329
- >
330
- ${this._$options ? repeat.repeat(Object.values(this._$options), (option) => option.value, (option) => this._renderOption(option)) : lit.nothing}
331
- </h-options>
332
-
295
+ ${this.hasSlot(select_constants.SELECT_SLOT_NAMES.content)
296
+ ? lit.html `
297
+ <h-options
298
+ class="${select_constants.SELECT_CSS_CLASSES.selectOptions} ${this._searchNoResult()
299
+ ? select_constants.SELECT_CSS_CLASSES.selectOptionsEmpty
300
+ : ''}"
301
+ ${ref_js.ref(this._$optionsList)}
302
+ @selectOptions.clicked=${this._handleOptionClicked}
303
+ @selectOptions.updated=${this._handleOptionUpdated}
304
+ >
305
+ ${this.getSlot(select_constants.SELECT_SLOT_NAMES.content)}
306
+ </h-options>
307
+ `
308
+ : lit.nothing}
333
309
  ${this._searchNoResult()
334
310
  ? lit.html ` <div>
335
311
  <p class=${select_constants.SELECT_CSS_CLASSES.selectNoResult}>
@@ -403,14 +379,6 @@ tslib_es6.__decorate([
403
379
  decorators_js.property({ type: Boolean }),
404
380
  tslib_es6.__metadata("design:type", Boolean)
405
381
  ], exports.HSelect.prototype, "required", void 0);
406
- tslib_es6.__decorate([
407
- decorators_js.property({ type: Array }),
408
- tslib_es6.__metadata("design:type", Array)
409
- ], exports.HSelect.prototype, "optionsList", void 0);
410
- tslib_es6.__decorate([
411
- decorators_js.property({ type: Boolean, attribute: 'no-deselect' }),
412
- tslib_es6.__metadata("design:type", Boolean)
413
- ], exports.HSelect.prototype, "noDeselect", void 0);
414
382
  tslib_es6.__decorate([
415
383
  decorators.state(),
416
384
  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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -7,6 +7,7 @@ var decorators = require('lit/decorators');
7
7
  var utilities = require('@dreamcommerce/utilities');
8
8
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
9
9
  var keystrokes_controller = require('../../controllers/keystrokes_controller/keystrokes_controller.js');
10
+ var relative_position_controller_constants = require('../../controllers/relative_position_controller/relative_position_controller_constants.js');
10
11
  var portal_constants = require('../portal/portal_constants.js');
11
12
  var click_outside_controller = require('../../controllers/click_outside_controller/click_outside_controller.js');
12
13
  var relative_position_controller = require('../../controllers/relative_position_controller/relative_position_controller.js');
@@ -17,7 +18,7 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
17
18
  super();
18
19
  this.opened = false;
19
20
  this.portalTarget = base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME;
20
- this.direction = utilities.DIRECTIONS.topCenter;
21
+ this.direction = relative_position_controller_constants.DIRECTIONS.topCenter;
21
22
  this.offset = base_message_constants.DEFAULT_MESSAGE_OFFSET;
22
23
  this._setupEventListeners = () => {
23
24
  this.addEventListener('mouseenter', this.open);
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,229 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
+ var relative_position_controller_constants = require('./relative_position_controller_constants.js');
7
+
8
+ var _PositionCalculator_direction, _PositionCalculator_relativeElementRect, _PositionCalculator_positionElementRect, _PositionCalculator_containerRect, _PositionCalculator_documentHeight, _PositionCalculator_documentWidth, _PositionCalculator_shouldNotReposition, _PositionCalculator_offset;
9
+ class PositionCalculator {
10
+ constructor({ direction, relativeElementRect, positionElementRect, container = document.body, offset = 0, shouldNotReposition }) {
11
+ _PositionCalculator_direction.set(this, void 0);
12
+ _PositionCalculator_relativeElementRect.set(this, void 0);
13
+ _PositionCalculator_positionElementRect.set(this, void 0);
14
+ _PositionCalculator_containerRect.set(this, void 0);
15
+ _PositionCalculator_documentHeight.set(this, void 0);
16
+ _PositionCalculator_documentWidth.set(this, void 0);
17
+ _PositionCalculator_shouldNotReposition.set(this, void 0);
18
+ _PositionCalculator_offset.set(this, void 0);
19
+ tslib_es6.__classPrivateFieldSet(this, _PositionCalculator_direction, direction, "f");
20
+ tslib_es6.__classPrivateFieldSet(this, _PositionCalculator_relativeElementRect, relativeElementRect, "f");
21
+ tslib_es6.__classPrivateFieldSet(this, _PositionCalculator_positionElementRect, positionElementRect, "f");
22
+ tslib_es6.__classPrivateFieldSet(this, _PositionCalculator_containerRect, container.getBoundingClientRect(), "f");
23
+ tslib_es6.__classPrivateFieldSet(this, _PositionCalculator_shouldNotReposition, !!shouldNotReposition, "f");
24
+ tslib_es6.__classPrivateFieldSet(this, _PositionCalculator_offset, offset, "f");
25
+ const body = document.body;
26
+ const documentElement = document.documentElement;
27
+ tslib_es6.__classPrivateFieldSet(this, _PositionCalculator_documentHeight, Math.max(body.scrollHeight, body.offsetHeight, documentElement.clientHeight, documentElement.scrollHeight, documentElement.offsetHeight), "f");
28
+ tslib_es6.__classPrivateFieldSet(this, _PositionCalculator_documentWidth, Math.max(body.scrollWidth, body.offsetWidth, documentElement.clientWidth, documentElement.scrollWidth, documentElement.offsetWidth), "f");
29
+ }
30
+ calculatePosition() {
31
+ const [side, alignment = relative_position_controller_constants.CALCULATOR_DIRECTIONS.center] = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_direction, "f").split('-');
32
+ const sidePosition = this._calculateSidePosition(side, alignment);
33
+ const alignmentPosition = this.calculateAlignmentPosition(alignment, side);
34
+ return {
35
+ ...sidePosition,
36
+ ...alignmentPosition,
37
+ calculatedSide: `${sidePosition.calculatedSide || ''}-${alignmentPosition.calculatedSide || ''}`
38
+ };
39
+ }
40
+ _canFitTopSide() {
41
+ const elementPositionTop = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").top - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").height - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
42
+ return elementPositionTop > tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_containerRect, "f").top && elementPositionTop > 0;
43
+ }
44
+ _canFitBottomSide() {
45
+ const elementPositionBottom = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").bottom + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").height + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
46
+ return elementPositionBottom < tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_containerRect, "f").bottom && elementPositionBottom < tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_documentHeight, "f");
47
+ }
48
+ _canFitCenter(centerPosition) {
49
+ return centerPosition + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").height - window.scrollY < window.innerHeight && centerPosition - window.scrollY > 0;
50
+ }
51
+ _canFitLeftSide() {
52
+ const positionElementLeftSide = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").left + window.scrollX - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").width - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
53
+ return positionElementLeftSide >= tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_containerRect, "f").left && positionElementLeftSide > 0;
54
+ }
55
+ _canFitRightSide() {
56
+ const positionElementRightSide = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").right + window.scrollX + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").width + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
57
+ return positionElementRightSide <= tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_containerRect, "f").width && positionElementRightSide < tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_documentWidth, "f");
58
+ }
59
+ _calculateSidePosition(side, alignment) {
60
+ const topSideOfRelativeElement = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").top + window.scrollY - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").height - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
61
+ const bottomSideOfRelativeElement = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").bottom + window.scrollY + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
62
+ const leftSideOfRelativeElement = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").left + window.scrollX - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").width - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
63
+ const rightSideOfRelativeElement = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").right + window.scrollX + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
64
+ const verticalCenterOfRelativeElement = (topSideOfRelativeElement + bottomSideOfRelativeElement) / 2;
65
+ const horizontalCenterOfRelativeElement = (leftSideOfRelativeElement + rightSideOfRelativeElement) / 2;
66
+ switch (side) {
67
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.top:
68
+ return this._calculateTopSide({
69
+ topSide: topSideOfRelativeElement,
70
+ bottomSide: bottomSideOfRelativeElement,
71
+ verticalCenter: verticalCenterOfRelativeElement
72
+ });
73
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom:
74
+ return this._calculateBottomSide({
75
+ topSide: topSideOfRelativeElement,
76
+ bottomSide: bottomSideOfRelativeElement,
77
+ verticalCenter: verticalCenterOfRelativeElement
78
+ });
79
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.center:
80
+ return this._calculateCenterSide({
81
+ verticalCenter: verticalCenterOfRelativeElement,
82
+ horizontalCenter: horizontalCenterOfRelativeElement,
83
+ alignment
84
+ });
85
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.left:
86
+ return this._calculateLeftSide({
87
+ leftSide: leftSideOfRelativeElement,
88
+ rightSide: rightSideOfRelativeElement
89
+ });
90
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.right:
91
+ return this._calculateRightSide({
92
+ leftSide: leftSideOfRelativeElement,
93
+ rightSide: rightSideOfRelativeElement
94
+ });
95
+ default:
96
+ return { top: 0 };
97
+ }
98
+ }
99
+ _calculateTopSide({ topSide, bottomSide, verticalCenter }) {
100
+ if (tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_shouldNotReposition, "f"))
101
+ return { top: topSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.top };
102
+ if (!this._canFitTopSide() && !this._canFitBottomSide() && !this._canFitCenter(verticalCenter))
103
+ return { top: bottomSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom, shrinkMode: true };
104
+ if (!this._canFitTopSide() && !this._canFitBottomSide())
105
+ return { top: verticalCenter, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.center };
106
+ if (!this._canFitTopSide())
107
+ return { top: bottomSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom };
108
+ return { top: topSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.top };
109
+ }
110
+ _calculateBottomSide({ topSide, bottomSide, verticalCenter }) {
111
+ if (tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_shouldNotReposition, "f"))
112
+ return { top: bottomSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom };
113
+ if (!this._canFitTopSide() && !this._canFitBottomSide() && !this._canFitCenter(verticalCenter))
114
+ return { top: bottomSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom, shrinkMode: true };
115
+ if (!this._canFitTopSide() && !this._canFitBottomSide())
116
+ return { top: verticalCenter, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.center };
117
+ if (!this._canFitBottomSide())
118
+ return { top: topSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.top };
119
+ return { top: bottomSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom };
120
+ }
121
+ _calculateCenterSide({ verticalCenter, horizontalCenter, alignment }) {
122
+ if (alignment === relative_position_controller_constants.CALCULATOR_DIRECTIONS.left || alignment === relative_position_controller_constants.CALCULATOR_DIRECTIONS.right)
123
+ return { top: verticalCenter, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.center };
124
+ return { left: horizontalCenter, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.center };
125
+ }
126
+ _calculateLeftSide({ leftSide, rightSide }) {
127
+ if (tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_shouldNotReposition, "f"))
128
+ return { left: leftSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
129
+ if (!this._canFitLeftSide() && !this._canFitRightSide())
130
+ return { left: leftSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
131
+ if (!this._canFitLeftSide())
132
+ return { left: rightSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
133
+ return { left: leftSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
134
+ }
135
+ _calculateRightSide({ leftSide, rightSide }) {
136
+ if (tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_shouldNotReposition, "f"))
137
+ return { left: rightSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
138
+ if (!this._canFitRightSide() && !this._canFitLeftSide())
139
+ return { left: rightSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
140
+ if (!this._canFitRightSide())
141
+ return { left: leftSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
142
+ return { left: rightSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
143
+ }
144
+ calculateAlignmentPosition(alignment, side) {
145
+ const alignmentToLeftSide = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").left + window.scrollX;
146
+ const alignmentToRightSide = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").right + window.scrollX - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").width;
147
+ const alignmentToTopSide = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").top + window.scrollY;
148
+ const alignmentToBottomSide = tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_relativeElementRect, "f").bottom + window.scrollY - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").height;
149
+ const verticalCenterOfRelativeElement = (alignmentToTopSide + alignmentToBottomSide) / 2;
150
+ const horizontalCenterOfRelativeElement = (alignmentToLeftSide + alignmentToRightSide) / 2;
151
+ const isSideCenter = side === relative_position_controller_constants.CALCULATOR_DIRECTIONS.center;
152
+ switch (alignment) {
153
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.top: {
154
+ return this._calculateTopAlignment({ topAlignment: alignmentToTopSide, isSideCenter });
155
+ }
156
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom: {
157
+ return this._calculateBottomAlignment({ bottomAlignment: alignmentToBottomSide, isSideCenter });
158
+ }
159
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.left: {
160
+ return this._calculateLeftAlignment({
161
+ leftAlignment: alignmentToLeftSide,
162
+ rightAlignment: alignmentToRightSide,
163
+ isSideCenter
164
+ });
165
+ }
166
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.right: {
167
+ return this._calculateRightAlignment({
168
+ leftAlignment: alignmentToLeftSide,
169
+ rightAlignment: alignmentToRightSide,
170
+ isSideCenter
171
+ });
172
+ }
173
+ case relative_position_controller_constants.CALCULATOR_DIRECTIONS.center:
174
+ return this._calculateCenterAlignment({
175
+ horizontalCenter: horizontalCenterOfRelativeElement,
176
+ verticalCenter: verticalCenterOfRelativeElement,
177
+ side
178
+ });
179
+ default:
180
+ return { left: 0 };
181
+ }
182
+ }
183
+ _calculateTopAlignment({ topAlignment, isSideCenter }) {
184
+ const alignmentToTop = isSideCenter ? topAlignment - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").height - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f") : topAlignment;
185
+ return {
186
+ top: alignmentToTop,
187
+ calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.top
188
+ };
189
+ }
190
+ _calculateBottomAlignment({ bottomAlignment, isSideCenter }) {
191
+ const alignmentToBottom = isSideCenter ? bottomAlignment + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").height + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f") : bottomAlignment;
192
+ return { top: alignmentToBottom, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom };
193
+ }
194
+ _calculateLeftAlignment({ leftAlignment, rightAlignment, isSideCenter }) {
195
+ const alignmentToLeftSide = isSideCenter ? leftAlignment - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").width : leftAlignment;
196
+ const alignmentToRightSide = rightAlignment + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").width + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
197
+ if (!isSideCenter)
198
+ return { left: alignmentToLeftSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
199
+ if (tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_shouldNotReposition, "f"))
200
+ return { left: alignmentToLeftSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
201
+ if (!this._canFitLeftSide() && !this._canFitRightSide())
202
+ return { left: alignmentToLeftSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
203
+ if (!this._canFitLeftSide())
204
+ return { left: alignmentToRightSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
205
+ return { left: alignmentToLeftSide - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f"), calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
206
+ }
207
+ _calculateRightAlignment({ leftAlignment, rightAlignment, isSideCenter }) {
208
+ const alignmentToRightSide = isSideCenter ? rightAlignment + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").width : rightAlignment;
209
+ const alignmentToLeftSide = leftAlignment - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_positionElementRect, "f").width - tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f");
210
+ if (!isSideCenter)
211
+ return { left: alignmentToRightSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
212
+ if (tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_shouldNotReposition, "f"))
213
+ return { left: alignmentToRightSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
214
+ if (!this._canFitLeftSide() && !this._canFitRightSide())
215
+ return { left: alignmentToRightSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
216
+ if (!this._canFitRightSide())
217
+ return { left: alignmentToLeftSide, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.left };
218
+ return { left: alignmentToRightSide + tslib_es6.__classPrivateFieldGet(this, _PositionCalculator_offset, "f"), calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.right };
219
+ }
220
+ _calculateCenterAlignment({ horizontalCenter, verticalCenter, side }) {
221
+ if (side === relative_position_controller_constants.CALCULATOR_DIRECTIONS.top || side === relative_position_controller_constants.CALCULATOR_DIRECTIONS.bottom)
222
+ return { left: horizontalCenter, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.center };
223
+ return { top: verticalCenter, calculatedSide: relative_position_controller_constants.CALCULATOR_DIRECTIONS.center };
224
+ }
225
+ }
226
+ _PositionCalculator_direction = new WeakMap(), _PositionCalculator_relativeElementRect = new WeakMap(), _PositionCalculator_positionElementRect = new WeakMap(), _PositionCalculator_containerRect = new WeakMap(), _PositionCalculator_documentHeight = new WeakMap(), _PositionCalculator_documentWidth = new WeakMap(), _PositionCalculator_shouldNotReposition = new WeakMap(), _PositionCalculator_offset = new WeakMap();
227
+
228
+ exports.PositionCalculator = PositionCalculator;
229
+ //# sourceMappingURL=relative_position_calculator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
6
  require('lit');
7
- var utilities = require('@dreamcommerce/utilities');
8
7
  var global_constants = require('../../global_constants.js');
9
8
  var relative_position_controller_constants = require('./relative_position_controller_constants.js');
9
+ var relative_position_calculator = require('./relative_position_calculator.js');
10
10
  var throttle = require('../../../../../external/lodash/throttle.js');
11
11
 
12
12
  var _RelativePositionController_host, _RelativePositionController_container, _RelativePositionController_direction, _RelativePositionController_nearestScrollableElement, _RelativePositionController_relativeElement, _RelativePositionController_elementToPosition, _RelativePositionController_disablePositioningOnCondition, _RelativePositionController_portalElementsNames, _RelativePositionController_isInitiallyScrollable, _RelativePositionController_initialMaxHeight, _RelativePositionController_initialHeight, _RelativePositionController_calculatedDirection, _RelativePositionController_hasPositioningBeenDisabled, _RelativePositionController_doesCurrentlyHaveShrinkMode, _RelativePositionController_offset, _RelativePositionController_mobileElementPosition, _RelativePositionController_throttledReposition, _RelativePositionController_throttledRepositionForScroll;
@@ -75,7 +75,7 @@ class RelativePositionController {
75
75
  const positionElementRect = tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_initialHeight, "f")
76
76
  ? { ...tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_elementToPosition, "f").getBoundingClientRect().toJSON(), height: tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_initialHeight, "f") }
77
77
  : tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_elementToPosition, "f").getBoundingClientRect();
78
- const position = new utilities.RelativePositionCalculator({
78
+ const position = new relative_position_calculator.PositionCalculator({
79
79
  direction: shouldNotReposition && tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_calculatedDirection, "f") ? tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_calculatedDirection, "f") : tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_direction, "f"),
80
80
  relativeElementRect: tslib_es6.__classPrivateFieldGet(this, _RelativePositionController_relativeElement, "f").getBoundingClientRect(),
81
81
  positionElementRect,
@@ -2,6 +2,44 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ const VERTICAL_DIRECTIONS = {
6
+ bottomLeft: 'bottom-left',
7
+ bottomRight: 'bottom-right',
8
+ bottomCenter: 'bottom-center',
9
+ topLeft: 'top-left',
10
+ topRight: 'top-right',
11
+ topCenter: 'top-center'
12
+ };
13
+ const HORIZONTAL_DIRECTIONS = {
14
+ rightTop: 'right-top',
15
+ rightCenter: 'right-center',
16
+ rightBottom: 'right-bottom',
17
+ leftTop: 'left-top',
18
+ leftCenter: 'left-center',
19
+ leftBottom: 'left-bottom'
20
+ };
21
+ const CENTER_DIRECTIONS = {
22
+ centerTop: 'center-top',
23
+ centerRight: 'center-right',
24
+ centerBottom: 'center-bottom',
25
+ centerLeft: 'center-left',
26
+ top: 'top',
27
+ right: 'right',
28
+ bottom: 'bottom',
29
+ left: 'left'
30
+ };
31
+ const DIRECTIONS = {
32
+ ...HORIZONTAL_DIRECTIONS,
33
+ ...VERTICAL_DIRECTIONS,
34
+ ...CENTER_DIRECTIONS
35
+ };
36
+ const CALCULATOR_DIRECTIONS = {
37
+ bottom: 'bottom',
38
+ top: 'top',
39
+ left: 'left',
40
+ right: 'right',
41
+ center: 'center'
42
+ };
5
43
  const NON_STATIC_POSITIONS = ['relative', 'absolute', 'fixed', 'sticky'];
6
44
  const OVERFLOW_SCROLL = 'scroll';
7
45
  const OVERFLOW_AUTO = 'auto';
@@ -19,8 +57,12 @@ const MOBILE_ELEMENT_POSITIONS = {
19
57
  right: 'right'
20
58
  };
21
59
 
60
+ exports.CALCULATOR_DIRECTIONS = CALCULATOR_DIRECTIONS;
61
+ exports.CENTER_DIRECTIONS = CENTER_DIRECTIONS;
22
62
  exports.DEFAULT_SCROLL_THROTTLE_WAIT_TIME = DEFAULT_SCROLL_THROTTLE_WAIT_TIME;
23
63
  exports.DEFAULT_THROTTLE_WAIT_TIME = DEFAULT_THROTTLE_WAIT_TIME;
64
+ exports.DIRECTIONS = DIRECTIONS;
65
+ exports.HORIZONTAL_DIRECTIONS = HORIZONTAL_DIRECTIONS;
24
66
  exports.MOBILE_ELEMENT_POSITIONS = MOBILE_ELEMENT_POSITIONS;
25
67
  exports.NON_STATIC_POSITIONS = NON_STATIC_POSITIONS;
26
68
  exports.OVERFLOW_AUTO = OVERFLOW_AUTO;
@@ -28,4 +70,5 @@ exports.OVERFLOW_SCROLL = OVERFLOW_SCROLL;
28
70
  exports.RELATIVE_POSITION_CONTROLLER_EVENTS = RELATIVE_POSITION_CONTROLLER_EVENTS;
29
71
  exports.SHRINK_MODE_BOTTOM_MARGIN = SHRINK_MODE_BOTTOM_MARGIN;
30
72
  exports.SHRINK_MODE_MIN_HEIGHT = SHRINK_MODE_MIN_HEIGHT;
73
+ exports.VERTICAL_DIRECTIONS = VERTICAL_DIRECTIONS;
31
74
  //# sourceMappingURL=relative_position_controller_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;"}
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;"}
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
2
- import { DIRECTIONS, UiDomUtils } from '@dreamcommerce/utilities';
2
+ import { UiDomUtils } from '@dreamcommerce/utilities';
3
3
  import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
4
4
  import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
5
5
  import { property } from '@lit/reactive-element/decorators.js';
@@ -7,7 +7,7 @@ import { KeystrokesController } from '../../controllers/keystrokes_controller/ke
7
7
  import { html } from 'lit-html';
8
8
  import { BREAKPOINTS, SCROLLABLE_CLASS_NAME } from '../../global_constants.js';
9
9
  import { DEFAULT_DROPDOWN_PORTAL_NAME, DROPDOWN_CONTENT_CSS_CLASSES, DROPDOWN_EVENTS, DROPDOWN_CONTAINER_NAME, DROPDOWN_CONTENT_NAME, DROPDOWN_CONTENT_WIDTH, DROPDOWN_TOGGLER_NAME } from './dropdown_constants.js';
10
- import { RELATIVE_POSITION_CONTROLLER_EVENTS, DEFAULT_THROTTLE_WAIT_TIME } from '../../controllers/relative_position_controller/relative_position_controller_constants.js';
10
+ import { DIRECTIONS, RELATIVE_POSITION_CONTROLLER_EVENTS, DEFAULT_THROTTLE_WAIT_TIME } from '../../controllers/relative_position_controller/relative_position_controller_constants.js';
11
11
  import { PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP } from '../portal/portal_constants.js';
12
12
  import { BackdropController } from '../backdrop/controller/backdrop_controller.js';
13
13
  import { ClickOutsideController } from '../../controllers/click_outside_controller/click_outside_controller.js';
@@ -1,6 +1,6 @@
1
1
  import { Any } from 'ts-toolbelt';
2
2
  import { DROPDOWN_CONTENT_WIDTH } from "./dropdown_constants";
3
- import { VERTICAL_DIRECTIONS } from '@dreamcommerce/utilities';
3
+ import { VERTICAL_DIRECTIONS } from "../../controllers/relative_position_controller/relative_position_controller_constants";
4
4
  export declare type TDropdownSelectors = {
5
5
  getDropdownPortalTargetName(): string;
6
6
  getDropdownContainerName(): string;
@@ -1,4 +1,4 @@
1
1
  import 'ts-toolbelt';
2
2
  import '@phoenixRoot/components/dropdown/dropdown_constants';
3
- import '@dreamcommerce/utilities';
3
+ import '@phoenixRoot/controllers/relative_position_controller/relative_position_controller_constants';
4
4
  //# sourceMappingURL=dropdown_types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown_types.js","sourceRoot":"","sources":["../../../../../../../src/components/dropdown/dropdown_types.ts"],"names":[],"mappings":"AAAA,OAAoB,aAAa,CAAC;AAClC,OAAuC,qDAAqD,CAAC;AAC7F,OAAoC,0BAA0B,CAAC"}
1
+ {"version":3,"file":"dropdown_types.js","sourceRoot":"","sources":["../../../../../../../src/components/dropdown/dropdown_types.ts"],"names":[],"mappings":"AAAA,OAAoB,aAAa,CAAC;AAClC,OAAuC,qDAAqD,CAAC;AAC7F,OAAoC,8FAA8F,CAAC"}
@@ -1,4 +1,4 @@
1
- import { TSelectOptionConstructorOptions } from "./select_option_types";
1
+ import { TSelectOptionConstructorOptions } from "./select_option_constants";
2
2
  export declare class SelectOption {
3
3
  selected: boolean;
4
4
  disabled: boolean;