@shoper/phoenix_design_system 1.18.42 → 1.18.43-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 (21) hide show
  1. package/build/cjs/packages/phoenix/src/components/form/input_stepper/button_stepper.js +10 -5
  2. package/build/cjs/packages/phoenix/src/components/form/input_stepper/button_stepper.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper.js +12 -0
  4. package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js +4 -0
  6. package/build/cjs/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/slider/slider.js +11 -50
  8. package/build/cjs/packages/phoenix/src/components/slider/slider.js.map +1 -1
  9. package/build/esm/packages/phoenix/src/components/form/input_stepper/button_stepper.d.ts +1 -0
  10. package/build/esm/packages/phoenix/src/components/form/input_stepper/button_stepper.js +11 -6
  11. package/build/esm/packages/phoenix/src/components/form/input_stepper/button_stepper.js.map +1 -1
  12. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.d.ts +2 -0
  13. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.js +13 -1
  14. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper.js.map +1 -1
  15. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.d.ts +3 -0
  16. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js +4 -1
  17. package/build/esm/packages/phoenix/src/components/form/input_stepper/input_stepper_constants.js.map +1 -1
  18. package/build/esm/packages/phoenix/src/components/slider/slider.d.ts +0 -3
  19. package/build/esm/packages/phoenix/src/components/slider/slider.js +11 -50
  20. package/build/esm/packages/phoenix/src/components/slider/slider.js.map +1 -1
  21. package/package.json +1 -1
@@ -21,9 +21,10 @@ exports.HButtonStepper = class HButtonStepper extends phoenix_light_lit_element.
21
21
  };
22
22
  this.type = '';
23
23
  this.disabled = false;
24
+ this.limitReached = false;
24
25
  this._dispatchStepperEvent = (ev) => {
25
26
  ev.stopImmediatePropagation();
26
- if (this.disabled)
27
+ if (this.disabled || this.limitReached)
27
28
  return;
28
29
  if (!this.type)
29
30
  throw new Error(`The type ${this.type} cannot be empty. Allowed values: 'increment', 'decrement'`);
@@ -39,10 +40,10 @@ exports.HButtonStepper = class HButtonStepper extends phoenix_light_lit_element.
39
40
  this.addEventListener(input_stepper_constants.INPUT_STEPPER_EVENT_NAMES.click, this._dispatchStepperEvent);
40
41
  }
41
42
  updated(changedProperties) {
42
- if (!changedProperties.has('disabled'))
43
- return;
44
- this.setAttribute('aria-disabled', String(this.disabled));
45
- this.disabled ? utilities.UiDomUtils.makeUnnavigable(this) : utilities.UiDomUtils.makeNavigable(this);
43
+ if (changedProperties.has('disabled')) {
44
+ this.disabled ? utilities.UiDomUtils.makeUnnavigable(this) : utilities.UiDomUtils.makeNavigable(this);
45
+ }
46
+ this.setAttribute('aria-disabled', String(this.disabled || this.limitReached));
46
47
  }
47
48
  };
48
49
  tslib_es6.__decorate([
@@ -53,6 +54,10 @@ tslib_es6.__decorate([
53
54
  decorators.property({ type: Boolean, reflect: true }),
54
55
  tslib_es6.__metadata("design:type", Boolean)
55
56
  ], exports.HButtonStepper.prototype, "disabled", void 0);
57
+ tslib_es6.__decorate([
58
+ decorators.property({ type: Boolean, attribute: input_stepper_constants.INPUT_STEPPER_ATTRIBUTE_NAMES.limitReached }),
59
+ tslib_es6.__metadata("design:type", Boolean)
60
+ ], exports.HButtonStepper.prototype, "limitReached", void 0);
56
61
  exports.HButtonStepper = tslib_es6.__decorate([
57
62
  phoenix_custom_element.phoenixCustomElement(input_stepper_constants.INPUT_STEPPER_COMPONENT_NAMES.button),
58
63
  tslib_es6.__metadata("design:paramtypes", [])
@@ -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;"}
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;"}
@@ -23,6 +23,7 @@ exports.HInputStepper = class HInputStepper extends phoenix_light_lit_element.Ph
23
23
  this.max = Infinity;
24
24
  this.step = 1;
25
25
  this.disabled = false;
26
+ this.disableButtonsAtLimits = false;
26
27
  this.increment = () => {
27
28
  if (this.disabled)
28
29
  return;
@@ -120,11 +121,18 @@ exports.HInputStepper = class HInputStepper extends phoenix_light_lit_element.Ph
120
121
  _outsideRangeEdges(number) {
121
122
  return number > this.max || number < this.min;
122
123
  }
124
+ _markButtonsAtLimit() {
125
+ this.querySelectorAll(input_stepper_constants.INPUT_STEPPER_COMPONENT_NAMES.button).forEach(($button) => {
126
+ const isAtLimit = $button.getAttribute('type') === 'decrement' ? this.value <= this.min : this.value >= this.max;
127
+ $button.toggleAttribute(input_stepper_constants.INPUT_STEPPER_ATTRIBUTE_NAMES.limitReached, this.disableButtonsAtLimits && isAtLimit);
128
+ });
129
+ }
123
130
  updated(changedProperties) {
124
131
  var _a;
125
132
  if (changedProperties.has('disabled')) {
126
133
  this.classList.toggle(input_stepper_constants.INPUT_STEPPER_CLASS_NAMES.inputStepperDisabled, this.disabled);
127
134
  }
135
+ this._markButtonsAtLimit();
128
136
  if (this._outsideRangeEdges(this.value))
129
137
  return;
130
138
  const digits = (_a = this.allowedFractionDigits) !== null && _a !== void 0 ? _a : this._calculateFractionDigitsByStepSize(this.step);
@@ -164,6 +172,10 @@ tslib_es6.__decorate([
164
172
  decorators.property({ type: Boolean, reflect: true }),
165
173
  tslib_es6.__metadata("design:type", Boolean)
166
174
  ], exports.HInputStepper.prototype, "disabled", void 0);
175
+ tslib_es6.__decorate([
176
+ decorators.property({ type: Boolean, attribute: 'disable-buttons-at-limits' }),
177
+ tslib_es6.__metadata("design:type", Boolean)
178
+ ], exports.HInputStepper.prototype, "disableButtonsAtLimits", void 0);
167
179
  exports.HInputStepper = tslib_es6.__decorate([
168
180
  phoenix_custom_element.phoenixCustomElement(input_stepper_constants.INPUT_STEPPER_COMPONENT_NAMES.control),
169
181
  tslib_es6.__metadata("design:paramtypes", [])
@@ -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;"}
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;"}
@@ -21,6 +21,9 @@ const INPUT_STEPPER_COMPONENT_NAMES = {
21
21
  input: 'h-display-stepper',
22
22
  button: 'h-button-stepper'
23
23
  };
24
+ const INPUT_STEPPER_ATTRIBUTE_NAMES = {
25
+ limitReached: 'limit-reached'
26
+ };
24
27
  const INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES = {
25
28
  stepperContext: 'stepperContext'
26
29
  };
@@ -28,6 +31,7 @@ const INPUT_STEPPER_PROPS_TO_SYNC = {
28
31
  disabled: 'disabled'
29
32
  };
30
33
 
34
+ exports.INPUT_STEPPER_ATTRIBUTE_NAMES = INPUT_STEPPER_ATTRIBUTE_NAMES;
31
35
  exports.INPUT_STEPPER_CLASS_NAMES = INPUT_STEPPER_CLASS_NAMES;
32
36
  exports.INPUT_STEPPER_COMPONENT_NAMES = INPUT_STEPPER_COMPONENT_NAMES;
33
37
  exports.INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES = INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES;
@@ -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;"}
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;"}
@@ -15,7 +15,6 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
15
15
  super(...arguments);
16
16
  this.settings = '';
17
17
  this.id = '';
18
- this.isSliderOptimizationFlagEnabled = false;
19
18
  this._settings = {
20
19
  mountOnConnectedCallback: true,
21
20
  type: 'loop',
@@ -36,35 +35,17 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
36
35
  if ($focusableSlideChildren.length === 0)
37
36
  return;
38
37
  let updateFocusability;
39
- if (this.isSliderOptimizationFlagEnabled) {
40
- updateFocusability = action === slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? utilities.UiDomUtils.showFocusableElement : utilities.UiDomUtils.hideFocusableElement;
41
- }
42
- else {
43
- updateFocusability = action === slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? this._showFocusableElement : this._hideFocusableElement;
44
- }
38
+ updateFocusability = action === slider_constants.SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? utilities.UiDomUtils.showFocusableElement : utilities.UiDomUtils.hideFocusableElement;
45
39
  $focusableSlideChildren.forEach(($element) => updateFocusability($element));
46
40
  };
47
41
  this._scanMutationsForNewFocusableElements = (mutationList) => {
48
- if (this.isSliderOptimizationFlagEnabled) {
49
- for (const mutation of mutationList) {
50
- for (const addedNode of mutation.addedNodes) {
51
- if (!(addedNode instanceof HTMLElement))
52
- continue;
53
- if (utilities.UiDomUtils.isFocusable(addedNode))
54
- this._initializeFocusableElement(addedNode);
55
- const $focusableChildren = [...addedNode.querySelectorAll(utilities.UiDomUtils.getFocusableSelector())];
56
- $focusableChildren.forEach(($child) => this._initializeFocusableElement($child));
57
- }
58
- }
59
- }
60
- else {
61
- for (const mutation of mutationList) {
62
- if (mutation.type !== 'childList')
42
+ for (const mutation of mutationList) {
43
+ for (const addedNode of mutation.addedNodes) {
44
+ if (!(addedNode instanceof HTMLElement))
63
45
  continue;
64
- const $target = mutation.target;
65
- const isFocusable = utilities.UiDomUtils.isFocusable($target);
66
- const $focusableChildren = [...$target.querySelectorAll(utilities.UiDomUtils.getFocusableSelector())];
67
- isFocusable && this._initializeFocusableElement($target);
46
+ if (utilities.UiDomUtils.isFocusable(addedNode))
47
+ this._initializeFocusableElement(addedNode);
48
+ const $focusableChildren = [...addedNode.querySelectorAll(utilities.UiDomUtils.getFocusableSelector())];
68
49
  $focusableChildren.forEach(($child) => this._initializeFocusableElement($child));
69
50
  }
70
51
  }
@@ -96,22 +77,8 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
96
77
  }
97
78
  this._slider.on('visible', this._showFocusableNodes);
98
79
  this._slider.on('hidden', this._hideFocusableNodes);
99
- if (this.isSliderOptimizationFlagEnabled) {
100
- this._mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
101
- this._mutationObserver.observe(this, { childList: true, subtree: true });
102
- }
103
- else {
104
- const mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
105
- mutationObserver.observe(this, { childList: true, subtree: true, attributes: true });
106
- }
107
- }
108
- _showFocusableElement($element) {
109
- $element.setAttribute('tabindex', '0');
110
- $element.removeAttribute('aria-hidden');
111
- }
112
- _hideFocusableElement($element) {
113
- $element.setAttribute('tabindex', '-1');
114
- $element.setAttribute('aria-hidden', 'true');
80
+ this._mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
81
+ this._mutationObserver.observe(this, { childList: true, subtree: true });
115
82
  }
116
83
  getSlider() {
117
84
  return this._slider;
@@ -121,10 +88,8 @@ exports.HSlider = class HSlider extends phoenix_light_lit_element.PhoenixLightLi
121
88
  super.disconnectedCallback();
122
89
  (_a = this._slider) === null || _a === void 0 ? void 0 : _a.off('visible');
123
90
  (_b = this._slider) === null || _b === void 0 ? void 0 : _b.off('hidden');
124
- if (this.isSliderOptimizationFlagEnabled) {
125
- (_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
126
- this._mutationObserver = null;
127
- }
91
+ (_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
92
+ this._mutationObserver = null;
128
93
  }
129
94
  };
130
95
  tslib_es6.__decorate([
@@ -135,10 +100,6 @@ tslib_es6.__decorate([
135
100
  decorators.property(),
136
101
  tslib_es6.__metadata("design:type", String)
137
102
  ], exports.HSlider.prototype, "id", void 0);
138
- tslib_es6.__decorate([
139
- decorators.property({ attribute: 'is-slider-optimization-flag-enabled' }),
140
- tslib_es6.__metadata("design:type", Boolean)
141
- ], exports.HSlider.prototype, "isSliderOptimizationFlagEnabled", void 0);
142
103
  exports.HSlider = tslib_es6.__decorate([
143
104
  phoenix_custom_element.phoenixCustomElement('h-slider')
144
105
  ], exports.HSlider);
@@ -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,yBAAyB,gEAAoE;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,yBAAyB,gEAAoE;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -5,6 +5,7 @@ export declare class HButtonStepper extends PhoenixLightLitElement {
5
5
  private _allowedEvents;
6
6
  type: string;
7
7
  disabled: boolean;
8
+ limitReached: boolean;
8
9
  constructor();
9
10
  connectedCallback(): void;
10
11
  updated(changedProperties: PropertyValues): void;
@@ -6,7 +6,7 @@ import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/
6
6
  import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
7
7
  import { BtnController } from '../../../controllers/btn_controller/btn_controller.js';
8
8
  import { ControlPropsSyncConsumerController } from '../controllers/props_synchronizing/control_props_sync_consumer_controller.js';
9
- import { INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_EVENT_NAMES, INPUT_STEPPER_COMPONENT_NAMES } from './input_stepper_constants.js';
9
+ import { INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_EVENT_NAMES, INPUT_STEPPER_ATTRIBUTE_NAMES, INPUT_STEPPER_COMPONENT_NAMES } from './input_stepper_constants.js';
10
10
 
11
11
  let HButtonStepper = class HButtonStepper extends PhoenixLightLitElement {
12
12
  constructor() {
@@ -17,9 +17,10 @@ let HButtonStepper = class HButtonStepper extends PhoenixLightLitElement {
17
17
  };
18
18
  this.type = '';
19
19
  this.disabled = false;
20
+ this.limitReached = false;
20
21
  this._dispatchStepperEvent = (ev) => {
21
22
  ev.stopImmediatePropagation();
22
- if (this.disabled)
23
+ if (this.disabled || this.limitReached)
23
24
  return;
24
25
  if (!this.type)
25
26
  throw new Error(`The type ${this.type} cannot be empty. Allowed values: 'increment', 'decrement'`);
@@ -35,10 +36,10 @@ let HButtonStepper = class HButtonStepper extends PhoenixLightLitElement {
35
36
  this.addEventListener(INPUT_STEPPER_EVENT_NAMES.click, this._dispatchStepperEvent);
36
37
  }
37
38
  updated(changedProperties) {
38
- if (!changedProperties.has('disabled'))
39
- return;
40
- this.setAttribute('aria-disabled', String(this.disabled));
41
- this.disabled ? UiDomUtils.makeUnnavigable(this) : UiDomUtils.makeNavigable(this);
39
+ if (changedProperties.has('disabled')) {
40
+ this.disabled ? UiDomUtils.makeUnnavigable(this) : UiDomUtils.makeNavigable(this);
41
+ }
42
+ this.setAttribute('aria-disabled', String(this.disabled || this.limitReached));
42
43
  }
43
44
  };
44
45
  __decorate([
@@ -49,6 +50,10 @@ __decorate([
49
50
  property({ type: Boolean, reflect: true }),
50
51
  __metadata("design:type", Boolean)
51
52
  ], HButtonStepper.prototype, "disabled", void 0);
53
+ __decorate([
54
+ property({ type: Boolean, attribute: INPUT_STEPPER_ATTRIBUTE_NAMES.limitReached }),
55
+ __metadata("design:type", Boolean)
56
+ ], HButtonStepper.prototype, "limitReached", void 0);
52
57
  HButtonStepper = __decorate([
53
58
  phoenixCustomElement(INPUT_STEPPER_COMPONENT_NAMES.button),
54
59
  __metadata("design:paramtypes", [])
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -12,6 +12,7 @@ export declare class HInputStepper extends PhoenixLightLitElement {
12
12
  max: number;
13
13
  step: number;
14
14
  disabled: boolean;
15
+ disableButtonsAtLimits: boolean;
15
16
  constructor();
16
17
  connectedCallback(): void;
17
18
  disconnectedCallback(): void;
@@ -23,6 +24,7 @@ export declare class HInputStepper extends PhoenixLightLitElement {
23
24
  private _calculateFractionDigitsByStepSize;
24
25
  private _roundToFractionDigits;
25
26
  private _outsideRangeEdges;
27
+ private _markButtonsAtLimit;
26
28
  private _dispatchChangedValue;
27
29
  updated(changedProperties: PropertyValues): void;
28
30
  }
@@ -6,7 +6,7 @@ import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_el
6
6
  import { BehaviorSubject } from '../../../core/classes/behavior_subject/behavior_subject.js';
7
7
  import { ContextProviderController } from '../../../core/context/context_provider_controller.js';
8
8
  import { ControlPropsSyncProviderController } from '../controllers/props_synchronizing/control_props_sync_provider_controller.js';
9
- import { INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_PROPS_TO_SYNC, INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES, INPUT_STEPPER_CLASS_NAMES, INPUT_STEPPER_COMPONENT_NAMES } from './input_stepper_constants.js';
9
+ import { INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_PROPS_TO_SYNC, INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES, INPUT_STEPPER_COMPONENT_NAMES, INPUT_STEPPER_ATTRIBUTE_NAMES, INPUT_STEPPER_CLASS_NAMES } from './input_stepper_constants.js';
10
10
 
11
11
  let HInputStepper = class HInputStepper extends PhoenixLightLitElement {
12
12
  constructor() {
@@ -19,6 +19,7 @@ let HInputStepper = class HInputStepper extends PhoenixLightLitElement {
19
19
  this.max = Infinity;
20
20
  this.step = 1;
21
21
  this.disabled = false;
22
+ this.disableButtonsAtLimits = false;
22
23
  this.increment = () => {
23
24
  if (this.disabled)
24
25
  return;
@@ -116,11 +117,18 @@ let HInputStepper = class HInputStepper extends PhoenixLightLitElement {
116
117
  _outsideRangeEdges(number) {
117
118
  return number > this.max || number < this.min;
118
119
  }
120
+ _markButtonsAtLimit() {
121
+ this.querySelectorAll(INPUT_STEPPER_COMPONENT_NAMES.button).forEach(($button) => {
122
+ const isAtLimit = $button.getAttribute('type') === 'decrement' ? this.value <= this.min : this.value >= this.max;
123
+ $button.toggleAttribute(INPUT_STEPPER_ATTRIBUTE_NAMES.limitReached, this.disableButtonsAtLimits && isAtLimit);
124
+ });
125
+ }
119
126
  updated(changedProperties) {
120
127
  var _a;
121
128
  if (changedProperties.has('disabled')) {
122
129
  this.classList.toggle(INPUT_STEPPER_CLASS_NAMES.inputStepperDisabled, this.disabled);
123
130
  }
131
+ this._markButtonsAtLimit();
124
132
  if (this._outsideRangeEdges(this.value))
125
133
  return;
126
134
  const digits = (_a = this.allowedFractionDigits) !== null && _a !== void 0 ? _a : this._calculateFractionDigitsByStepSize(this.step);
@@ -160,6 +168,10 @@ __decorate([
160
168
  property({ type: Boolean, reflect: true }),
161
169
  __metadata("design:type", Boolean)
162
170
  ], HInputStepper.prototype, "disabled", void 0);
171
+ __decorate([
172
+ property({ type: Boolean, attribute: 'disable-buttons-at-limits' }),
173
+ __metadata("design:type", Boolean)
174
+ ], HInputStepper.prototype, "disableButtonsAtLimits", void 0);
163
175
  HInputStepper = __decorate([
164
176
  phoenixCustomElement(INPUT_STEPPER_COMPONENT_NAMES.control),
165
177
  __metadata("design:paramtypes", [])
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -17,6 +17,9 @@ export declare const INPUT_STEPPER_COMPONENT_NAMES: {
17
17
  readonly input: "h-display-stepper";
18
18
  readonly button: "h-button-stepper";
19
19
  };
20
+ export declare const INPUT_STEPPER_ATTRIBUTE_NAMES: {
21
+ readonly limitReached: "limit-reached";
22
+ };
20
23
  export declare const INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES: {
21
24
  readonly stepperContext: "stepperContext";
22
25
  };
@@ -17,6 +17,9 @@ const INPUT_STEPPER_COMPONENT_NAMES = {
17
17
  input: 'h-display-stepper',
18
18
  button: 'h-button-stepper'
19
19
  };
20
+ const INPUT_STEPPER_ATTRIBUTE_NAMES = {
21
+ limitReached: 'limit-reached'
22
+ };
20
23
  const INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES = {
21
24
  stepperContext: 'stepperContext'
22
25
  };
@@ -24,5 +27,5 @@ const INPUT_STEPPER_PROPS_TO_SYNC = {
24
27
  disabled: 'disabled'
25
28
  };
26
29
 
27
- export { INPUT_STEPPER_CLASS_NAMES, INPUT_STEPPER_COMPONENT_NAMES, INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES, INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_EVENT_NAMES, INPUT_STEPPER_PROPS_TO_SYNC };
30
+ export { INPUT_STEPPER_ATTRIBUTE_NAMES, INPUT_STEPPER_CLASS_NAMES, INPUT_STEPPER_COMPONENT_NAMES, INPUT_STEPPER_CONTEXTS_VARIABLE_NAMES, INPUT_STEPPER_CUSTOM_EVENT_NAMES, INPUT_STEPPER_EVENT_NAMES, INPUT_STEPPER_PROPS_TO_SYNC };
28
31
  //# sourceMappingURL=input_stepper_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;"}
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;"}
@@ -3,7 +3,6 @@ import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/pho
3
3
  export declare class HSlider extends PhoenixLightLitElement {
4
4
  settings: string;
5
5
  id: string;
6
- isSliderOptimizationFlagEnabled: boolean;
7
6
  get sliderSettings(): ISliderOptions;
8
7
  set sliderSettings(newSettingsObject: ISliderOptions);
9
8
  private _settings;
@@ -14,8 +13,6 @@ export declare class HSlider extends PhoenixLightLitElement {
14
13
  private _showFocusableNodes;
15
14
  private _hideFocusableNodes;
16
15
  private _handleFocusableNodes;
17
- private _showFocusableElement;
18
- private _hideFocusableElement;
19
16
  private _scanMutationsForNewFocusableElements;
20
17
  private _initializeFocusableElement;
21
18
  getSlider(): ISlider | null;
@@ -11,7 +11,6 @@ let HSlider = class HSlider extends PhoenixLightLitElement {
11
11
  super(...arguments);
12
12
  this.settings = '';
13
13
  this.id = '';
14
- this.isSliderOptimizationFlagEnabled = false;
15
14
  this._settings = {
16
15
  mountOnConnectedCallback: true,
17
16
  type: 'loop',
@@ -32,35 +31,17 @@ let HSlider = class HSlider extends PhoenixLightLitElement {
32
31
  if ($focusableSlideChildren.length === 0)
33
32
  return;
34
33
  let updateFocusability;
35
- if (this.isSliderOptimizationFlagEnabled) {
36
- updateFocusability = action === SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? UiDomUtils.showFocusableElement : UiDomUtils.hideFocusableElement;
37
- }
38
- else {
39
- updateFocusability = action === SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? this._showFocusableElement : this._hideFocusableElement;
40
- }
34
+ updateFocusability = action === SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? UiDomUtils.showFocusableElement : UiDomUtils.hideFocusableElement;
41
35
  $focusableSlideChildren.forEach(($element) => updateFocusability($element));
42
36
  };
43
37
  this._scanMutationsForNewFocusableElements = (mutationList) => {
44
- if (this.isSliderOptimizationFlagEnabled) {
45
- for (const mutation of mutationList) {
46
- for (const addedNode of mutation.addedNodes) {
47
- if (!(addedNode instanceof HTMLElement))
48
- continue;
49
- if (UiDomUtils.isFocusable(addedNode))
50
- this._initializeFocusableElement(addedNode);
51
- const $focusableChildren = [...addedNode.querySelectorAll(UiDomUtils.getFocusableSelector())];
52
- $focusableChildren.forEach(($child) => this._initializeFocusableElement($child));
53
- }
54
- }
55
- }
56
- else {
57
- for (const mutation of mutationList) {
58
- if (mutation.type !== 'childList')
38
+ for (const mutation of mutationList) {
39
+ for (const addedNode of mutation.addedNodes) {
40
+ if (!(addedNode instanceof HTMLElement))
59
41
  continue;
60
- const $target = mutation.target;
61
- const isFocusable = UiDomUtils.isFocusable($target);
62
- const $focusableChildren = [...$target.querySelectorAll(UiDomUtils.getFocusableSelector())];
63
- isFocusable && this._initializeFocusableElement($target);
42
+ if (UiDomUtils.isFocusable(addedNode))
43
+ this._initializeFocusableElement(addedNode);
44
+ const $focusableChildren = [...addedNode.querySelectorAll(UiDomUtils.getFocusableSelector())];
64
45
  $focusableChildren.forEach(($child) => this._initializeFocusableElement($child));
65
46
  }
66
47
  }
@@ -92,22 +73,8 @@ let HSlider = class HSlider extends PhoenixLightLitElement {
92
73
  }
93
74
  this._slider.on('visible', this._showFocusableNodes);
94
75
  this._slider.on('hidden', this._hideFocusableNodes);
95
- if (this.isSliderOptimizationFlagEnabled) {
96
- this._mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
97
- this._mutationObserver.observe(this, { childList: true, subtree: true });
98
- }
99
- else {
100
- const mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
101
- mutationObserver.observe(this, { childList: true, subtree: true, attributes: true });
102
- }
103
- }
104
- _showFocusableElement($element) {
105
- $element.setAttribute('tabindex', '0');
106
- $element.removeAttribute('aria-hidden');
107
- }
108
- _hideFocusableElement($element) {
109
- $element.setAttribute('tabindex', '-1');
110
- $element.setAttribute('aria-hidden', 'true');
76
+ this._mutationObserver = new MutationObserver(this._scanMutationsForNewFocusableElements);
77
+ this._mutationObserver.observe(this, { childList: true, subtree: true });
111
78
  }
112
79
  getSlider() {
113
80
  return this._slider;
@@ -117,10 +84,8 @@ let HSlider = class HSlider extends PhoenixLightLitElement {
117
84
  super.disconnectedCallback();
118
85
  (_a = this._slider) === null || _a === void 0 ? void 0 : _a.off('visible');
119
86
  (_b = this._slider) === null || _b === void 0 ? void 0 : _b.off('hidden');
120
- if (this.isSliderOptimizationFlagEnabled) {
121
- (_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
122
- this._mutationObserver = null;
123
- }
87
+ (_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
88
+ this._mutationObserver = null;
124
89
  }
125
90
  };
126
91
  __decorate([
@@ -131,10 +96,6 @@ __decorate([
131
96
  property(),
132
97
  __metadata("design:type", String)
133
98
  ], HSlider.prototype, "id", void 0);
134
- __decorate([
135
- property({ attribute: 'is-slider-optimization-flag-enabled' }),
136
- __metadata("design:type", Boolean)
137
- ], HSlider.prototype, "isSliderOptimizationFlagEnabled", void 0);
138
99
  HSlider = __decorate([
139
100
  phoenixCustomElement('h-slider')
140
101
  ], HSlider);
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA,uBAAuB,gEAAoE;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA,uBAAuB,gEAAoE;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@shoper/phoenix_design_system",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "1.18.42",
5
+ "version": "1.18.43-0",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",