@shoper/phoenix_design_system 1.1.1 → 1.1.2

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 (16) hide show
  1. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js +20 -5
  2. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +1 -1
  4. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +8 -6
  5. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  6. package/build/cjs/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_constants.js +1 -1
  7. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.d.ts +3 -0
  8. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +20 -5
  9. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
  10. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +1 -1
  11. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.d.ts +2 -1
  12. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +8 -6
  13. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  14. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_constants.d.ts +1 -1
  15. package/build/esm/packages/phoenix/src/controllers/relative_position_controller/relative_position_controller_constants.js +1 -1
  16. package/package.json +2 -2
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
6
6
  var decorators = require('lit/decorators');
7
+ var utilities = require('@dreamcommerce/utilities');
7
8
  var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
8
9
  var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
9
10
  var btn_controller = require('../../../controllers/btn_controller/btn_controller.js');
@@ -15,6 +16,8 @@ exports.HColorItem = class HColorItem extends phoenix_light_lit_element.PhoenixL
15
16
  super();
16
17
  this.disabled = false;
17
18
  this.selected = false;
19
+ this.small = false;
20
+ this.unclickable = false;
18
21
  this._dispatchClickedEvent = () => {
19
22
  this.dispatchEvent(new Event(color_item_constants.COLOR_ITEM_EVENT_NAMES.selected, {
20
23
  bubbles: true
@@ -25,11 +28,12 @@ exports.HColorItem = class HColorItem extends phoenix_light_lit_element.PhoenixL
25
28
  connectedCallback() {
26
29
  super.connectedCallback();
27
30
  this.setupEvents();
28
- this.style.backgroundColor = this.color;
31
+ this.style.backgroundColor = this.setBgColor(this.disabled);
29
32
  this._syncAriaPressed();
30
33
  this.setAttribute('aria-label', this.label ? this.label : this.color);
31
- this.disabled && this.removeAttribute('tabindex');
34
+ this.unclickable && this.removeAttribute('tabindex');
32
35
  this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorItem);
36
+ this.small && this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorItemSmall);
33
37
  }
34
38
  attributeChangedCallback(name, value, newValue) {
35
39
  super.attributeChangedCallback(name, value, newValue);
@@ -44,7 +48,10 @@ exports.HColorItem = class HColorItem extends phoenix_light_lit_element.PhoenixL
44
48
  this.selected ? this.setAttribute('aria-pressed', '') : this.removeAttribute('aria-pressed');
45
49
  }
46
50
  setupEvents() {
47
- !this.disabled && this.addEventListener('click', this._dispatchClickedEvent);
51
+ !this.unclickable && this.addEventListener('click', this._dispatchClickedEvent);
52
+ }
53
+ setBgColor(itemIsDisabled) {
54
+ return itemIsDisabled ? utilities.ColorUtils.hexToRgba(this.color, 0.5) : this.color;
48
55
  }
49
56
  };
50
57
  tslib_es6.__decorate([
@@ -56,13 +63,21 @@ tslib_es6.__decorate([
56
63
  tslib_es6.__metadata("design:type", String)
57
64
  ], exports.HColorItem.prototype, "label", void 0);
58
65
  tslib_es6.__decorate([
59
- decorators.property({ type: Boolean, attribute: true }),
66
+ decorators.property({ type: Boolean, reflect: true }),
60
67
  tslib_es6.__metadata("design:type", Boolean)
61
68
  ], exports.HColorItem.prototype, "disabled", void 0);
62
69
  tslib_es6.__decorate([
63
- decorators.property({ type: Boolean, attribute: true }),
70
+ decorators.property({ type: Boolean, reflect: true }),
64
71
  tslib_es6.__metadata("design:type", Boolean)
65
72
  ], exports.HColorItem.prototype, "selected", void 0);
73
+ tslib_es6.__decorate([
74
+ decorators.property({ type: Boolean }),
75
+ tslib_es6.__metadata("design:type", Boolean)
76
+ ], exports.HColorItem.prototype, "small", void 0);
77
+ tslib_es6.__decorate([
78
+ decorators.property({ type: Boolean }),
79
+ tslib_es6.__metadata("design:type", Boolean)
80
+ ], exports.HColorItem.prototype, "unclickable", void 0);
66
81
  exports.HColorItem = tslib_es6.__decorate([
67
82
  phoenix_custom_element.phoenixCustomElement('h-color-item'),
68
83
  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;"}
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;"}
@@ -99,7 +99,7 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
99
99
  };
100
100
  tslib_es6.__decorate([
101
101
  decorators.property({ type: Boolean }),
102
- tslib_es6.__metadata("design:type", Object)
102
+ tslib_es6.__metadata("design:type", Boolean)
103
103
  ], exports.HColorSwatches.prototype, "multiple", void 0);
104
104
  tslib_es6.__decorate([
105
105
  decorators.property({ type: Number, attribute: 'number-of-visible-colors' }),
@@ -2,16 +2,18 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const baseCssClass = 'color-swatches';
5
+ const colorSwatchesBaseCssClass = 'color-swatches';
6
+ const colorItemBaseCssClass = 'color-item';
6
7
  const COLOR_ITEM_TAG_NAME = 'h-color-item';
7
8
  const COLOR_SWATCHES_CSS_CLASSES = {
8
- colorItem: 'color-item',
9
- colorSwatches: baseCssClass,
10
- colorSwatchesItem: `${baseCssClass}__color-item`,
11
- colorSwatchesItems: `${baseCssClass}__color-items`
9
+ colorItem: colorItemBaseCssClass,
10
+ colorItemSmall: `${colorItemBaseCssClass}_small`,
11
+ colorSwatches: colorSwatchesBaseCssClass,
12
+ colorSwatchesItem: `${colorSwatchesBaseCssClass}__color-item`
12
13
  };
13
14
  const COLOR_SWATCHES_EVENT_NAMES = {
14
- selected: 'colorSwatchesSelected'
15
+ selected: 'colorSwatchesSelected',
16
+ markDisabledItems: 'markDisabledItems'
15
17
  };
16
18
  const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
17
19
 
@@ -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;"}
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;"}
@@ -43,7 +43,7 @@ const CALCULATOR_DIRECTIONS = {
43
43
  const NON_STATIC_POSITIONS = ['relative', 'absolute', 'fixed', 'sticky'];
44
44
  const OVERFLOW_SCROLL = 'scroll';
45
45
  const OVERFLOW_AUTO = 'auto';
46
- const DEFAULT_THROTTLE_WAIT_TIME = 150;
46
+ const DEFAULT_THROTTLE_WAIT_TIME = 300;
47
47
  const DEFAULT_SCROLL_THROTTLE_WAIT_TIME = 15;
48
48
  const SHRINK_MODE_BOTTOM_MARGIN = 20;
49
49
  const SHRINK_MODE_MIN_HEIGHT = 80;
@@ -4,11 +4,14 @@ export declare class HColorItem extends PhoenixLightLitElement {
4
4
  label?: string;
5
5
  disabled: boolean;
6
6
  selected: boolean;
7
+ small: boolean;
8
+ unclickable: boolean;
7
9
  private _btnController;
8
10
  constructor();
9
11
  connectedCallback(): void;
10
12
  attributeChangedCallback(name: string, value: string | null, newValue: string | null): void;
11
13
  private _syncAriaPressed;
12
14
  private setupEvents;
15
+ private setBgColor;
13
16
  private _dispatchClickedEvent;
14
17
  }
@@ -1,5 +1,6 @@
1
1
  import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
2
2
  import { property } from 'lit/decorators';
3
+ import { ColorUtils } from '@dreamcommerce/utilities';
3
4
  import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
4
5
  import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
5
6
  import { BtnController } from '../../../controllers/btn_controller/btn_controller.js';
@@ -11,6 +12,8 @@ let HColorItem = class HColorItem extends PhoenixLightLitElement {
11
12
  super();
12
13
  this.disabled = false;
13
14
  this.selected = false;
15
+ this.small = false;
16
+ this.unclickable = false;
14
17
  this._dispatchClickedEvent = () => {
15
18
  this.dispatchEvent(new Event(COLOR_ITEM_EVENT_NAMES.selected, {
16
19
  bubbles: true
@@ -21,11 +24,12 @@ let HColorItem = class HColorItem extends PhoenixLightLitElement {
21
24
  connectedCallback() {
22
25
  super.connectedCallback();
23
26
  this.setupEvents();
24
- this.style.backgroundColor = this.color;
27
+ this.style.backgroundColor = this.setBgColor(this.disabled);
25
28
  this._syncAriaPressed();
26
29
  this.setAttribute('aria-label', this.label ? this.label : this.color);
27
- this.disabled && this.removeAttribute('tabindex');
30
+ this.unclickable && this.removeAttribute('tabindex');
28
31
  this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorItem);
32
+ this.small && this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorItemSmall);
29
33
  }
30
34
  attributeChangedCallback(name, value, newValue) {
31
35
  super.attributeChangedCallback(name, value, newValue);
@@ -40,7 +44,10 @@ let HColorItem = class HColorItem extends PhoenixLightLitElement {
40
44
  this.selected ? this.setAttribute('aria-pressed', '') : this.removeAttribute('aria-pressed');
41
45
  }
42
46
  setupEvents() {
43
- !this.disabled && this.addEventListener('click', this._dispatchClickedEvent);
47
+ !this.unclickable && this.addEventListener('click', this._dispatchClickedEvent);
48
+ }
49
+ setBgColor(itemIsDisabled) {
50
+ return itemIsDisabled ? ColorUtils.hexToRgba(this.color, 0.5) : this.color;
44
51
  }
45
52
  };
46
53
  __decorate([
@@ -52,13 +59,21 @@ __decorate([
52
59
  __metadata("design:type", String)
53
60
  ], HColorItem.prototype, "label", void 0);
54
61
  __decorate([
55
- property({ type: Boolean, attribute: true }),
62
+ property({ type: Boolean, reflect: true }),
56
63
  __metadata("design:type", Boolean)
57
64
  ], HColorItem.prototype, "disabled", void 0);
58
65
  __decorate([
59
- property({ type: Boolean, attribute: true }),
66
+ property({ type: Boolean, reflect: true }),
60
67
  __metadata("design:type", Boolean)
61
68
  ], HColorItem.prototype, "selected", void 0);
69
+ __decorate([
70
+ property({ type: Boolean }),
71
+ __metadata("design:type", Boolean)
72
+ ], HColorItem.prototype, "small", void 0);
73
+ __decorate([
74
+ property({ type: Boolean }),
75
+ __metadata("design:type", Boolean)
76
+ ], HColorItem.prototype, "unclickable", void 0);
62
77
  HColorItem = __decorate([
63
78
  phoenixCustomElement('h-color-item'),
64
79
  __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;"}
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;"}
@@ -95,7 +95,7 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
95
95
  };
96
96
  __decorate([
97
97
  property({ type: Boolean }),
98
- __metadata("design:type", Object)
98
+ __metadata("design:type", Boolean)
99
99
  ], HColorSwatches.prototype, "multiple", void 0);
100
100
  __decorate([
101
101
  property({ type: Number, attribute: 'number-of-visible-colors' }),
@@ -1,11 +1,12 @@
1
1
  export declare const COLOR_ITEM_TAG_NAME = "h-color-item";
2
2
  export declare const COLOR_SWATCHES_CSS_CLASSES: {
3
3
  readonly colorItem: "color-item";
4
+ readonly colorItemSmall: "color-item_small";
4
5
  readonly colorSwatches: "color-swatches";
5
6
  readonly colorSwatchesItem: "color-swatches__color-item";
6
- readonly colorSwatchesItems: "color-swatches__color-items";
7
7
  };
8
8
  export declare const COLOR_SWATCHES_EVENT_NAMES: {
9
9
  readonly selected: "colorSwatchesSelected";
10
+ readonly markDisabledItems: "markDisabledItems";
10
11
  };
11
12
  export declare const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = "hidden";
@@ -1,13 +1,15 @@
1
- const baseCssClass = 'color-swatches';
1
+ const colorSwatchesBaseCssClass = 'color-swatches';
2
+ const colorItemBaseCssClass = 'color-item';
2
3
  const COLOR_ITEM_TAG_NAME = 'h-color-item';
3
4
  const COLOR_SWATCHES_CSS_CLASSES = {
4
- colorItem: 'color-item',
5
- colorSwatches: baseCssClass,
6
- colorSwatchesItem: `${baseCssClass}__color-item`,
7
- colorSwatchesItems: `${baseCssClass}__color-items`
5
+ colorItem: colorItemBaseCssClass,
6
+ colorItemSmall: `${colorItemBaseCssClass}_small`,
7
+ colorSwatches: colorSwatchesBaseCssClass,
8
+ colorSwatchesItem: `${colorSwatchesBaseCssClass}__color-item`
8
9
  };
9
10
  const COLOR_SWATCHES_EVENT_NAMES = {
10
- selected: 'colorSwatchesSelected'
11
+ selected: 'colorSwatchesSelected',
12
+ markDisabledItems: 'markDisabledItems'
11
13
  };
12
14
  const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
13
15
 
@@ -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;"}
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;"}
@@ -56,7 +56,7 @@ export declare const CALCULATOR_DIRECTIONS: {
56
56
  export declare const NON_STATIC_POSITIONS: string[];
57
57
  export declare const OVERFLOW_SCROLL = "scroll";
58
58
  export declare const OVERFLOW_AUTO = "auto";
59
- export declare const DEFAULT_THROTTLE_WAIT_TIME = 150;
59
+ export declare const DEFAULT_THROTTLE_WAIT_TIME = 300;
60
60
  export declare const DEFAULT_SCROLL_THROTTLE_WAIT_TIME = 15;
61
61
  export declare const SHRINK_MODE_BOTTOM_MARGIN = 20;
62
62
  export declare const SHRINK_MODE_MIN_HEIGHT = 80;
@@ -39,7 +39,7 @@ const CALCULATOR_DIRECTIONS = {
39
39
  const NON_STATIC_POSITIONS = ['relative', 'absolute', 'fixed', 'sticky'];
40
40
  const OVERFLOW_SCROLL = 'scroll';
41
41
  const OVERFLOW_AUTO = 'auto';
42
- const DEFAULT_THROTTLE_WAIT_TIME = 150;
42
+ const DEFAULT_THROTTLE_WAIT_TIME = 300;
43
43
  const DEFAULT_SCROLL_THROTTLE_WAIT_TIME = 15;
44
44
  const SHRINK_MODE_BOTTOM_MARGIN = 20;
45
45
  const SHRINK_MODE_MIN_HEIGHT = 80;
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.1.1",
5
+ "version": "1.1.2",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "@splidejs/splide": "^4.0.7"
31
31
  },
32
32
  "devDependencies": {
33
- "@dreamcommerce/utilities": "^1.1.0",
33
+ "@dreamcommerce/utilities": "^1.2.0",
34
34
  "@shoper/jest_config": "^0.0.0",
35
35
  "@shoper/tsconfig": "^0.0.0",
36
36
  "@splidejs/splide": "4.0.7",