@justeattakeaway/pie-select 0.5.2 → 0.6.1

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.
@@ -34,7 +34,7 @@
34
34
  "type": {
35
35
  "text": "DefaultProps"
36
36
  },
37
- "default": "{\n size: 'medium',\n status: 'default',\n disabled: false,\n options: [],\n}"
37
+ "default": "{\r\n size: 'medium',\r\n status: 'default',\r\n disabled: false,\r\n options: [],\r\n}"
38
38
  }
39
39
  ],
40
40
  "exports": [
@@ -168,7 +168,7 @@
168
168
  "text": "ValidityState"
169
169
  },
170
170
  "privacy": "public",
171
- "description": "(Read-only) returns a ValidityState with the validity states that this element is in.\nhttps://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validity",
171
+ "description": "(Read-only) returns a ValidityState with the validity states that this element is in.\r\nhttps://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validity",
172
172
  "readonly": true
173
173
  },
174
174
  {
@@ -189,7 +189,7 @@
189
189
  "description": "The latest disabled state of the select."
190
190
  }
191
191
  ],
192
- "description": "Called after the disabled state of the element changes,\neither because the disabled attribute of this element was added or removed;\nor because the disabled state changed on a <fieldset> that's an ancestor of this element."
192
+ "description": "Called after the disabled state of the element changes,\r\neither because the disabled attribute of this element was added or removed;\r\nor because the disabled state changed on a <fieldset> that's an ancestor of this element."
193
193
  },
194
194
  {
195
195
  "kind": "method",
@@ -200,7 +200,7 @@
200
200
  "text": "void"
201
201
  }
202
202
  },
203
- "description": "Called when the form that owns this component is reset.\nResets the value to the default select value."
203
+ "description": "Called when the form that owns this component is reset.\r\nResets the value to the default select value."
204
204
  },
205
205
  {
206
206
  "kind": "field",
package/dist/index.js CHANGED
@@ -1,39 +1,34 @@
1
- import { LitElement as b, html as p, nothing as $, unsafeCSS as I } from "lit";
2
- import { property as a, query as f, queryAssignedElements as k, state as w } from "lit/decorators.js";
3
- import { FormControlMixin as z, RtlMixin as C, wrapNativeEvent as S, validPropertyValues as m, defineCustomElement as L } from "@justeattakeaway/pie-webc-core";
1
+ import { LitElement as b, html as p, nothing as _, unsafeCSS as $ } from "lit";
2
+ import { FormControlMixin as I, RtlMixin as w, wrapNativeEvent as z, validPropertyValues as f, safeCustomElement as k } from "@justeattakeaway/pie-webc-core";
3
+ import { property as c, query as m, queryAssignedElements as S, state as C } from "lit/decorators.js";
4
4
  import { ifDefined as h } from "lit/directives/if-defined.js";
5
- import { classMap as T } from "lit/directives/class-map.js";
6
- import { live as E } from "lit/directives/live.js";
5
+ import { classMap as L } from "lit/directives/class-map.js";
6
+ import { live as T } from "lit/directives/live.js";
7
7
  import "@justeattakeaway/pie-icons-webc/dist/IconChevronDown.js";
8
8
  import "@justeattakeaway/pie-assistive-text";
9
- var A = Object.defineProperty, F = (c, t, e, d) => {
10
- for (var s = void 0, i = c.length - 1, l; i >= 0; i--)
11
- (l = c[i]) && (s = l(t, e, s) || s);
12
- return s && A(t, e, s), s;
13
- };
14
- class x extends b {
15
- constructor() {
16
- super(...arguments), this.v = "0.5.2";
9
+ const v = class v extends b {
10
+ willUpdate() {
11
+ this.getAttribute("v") || this.setAttribute("v", v.v);
17
12
  }
18
- }
19
- F([
20
- a({ type: String, reflect: !0 })
21
- ], x.prototype, "v");
22
- const V = "*,*:after,*:before{box-sizing:inherit}.c-select{--select-padding-block: var(--dt-spacing-c);--select-padding-inline-start: var(--dt-spacing-d);--select-padding-inline-end: 52px;--select-background-color: var(--dt-color-container-default);--select-text-color: var(--dt-color-content-default);--select-border-color: var(--dt-color-border-form);--select-font-size: calc(var(--dt-font-body-l-size) * 1px);--select-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--select-height: 48px;--select-cursor: pointer;position:relative;color:var(--select-text-color);font-size:var(--select-font-size);line-height:var(--select-line-height)}.c-select select{height:var(--select-height);width:100%;border:1px solid var(--select-border-color);border-radius:var(--dt-radius-rounded-c);padding-inline-start:var(--select-padding-inline-start);padding-inline-end:var(--select-padding-inline-end);padding-block-start:var(--select-padding-block);padding-block-end:var(--select-padding-block);background-color:var(--select-background-color);font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:var(--select-cursor);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.c-select select:focus-within{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-select.c-select--small{--select-padding-block: var(--dt-spacing-b);--select-height: 40px}.c-select.c-select--large{--select-padding-block: var(--dt-spacing-d);--select-height: 56px}.c-select.c-select--error{--select-border-color: var(--dt-color-support-error)}.c-select.c-select--withLeadingIcon{--select-padding-inline-start: calc(var(--dt-spacing-h) - var(--dt-spacing-a))}.c-select ::slotted([slot=leadingIcon]),.c-select .c-select-trailingIcon{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}.c-select:not(.is-disabled) ::slotted([slot=leadingIcon]),.c-select:not(.is-disabled) .c-select-trailingIcon{color:var(--dt-color-content-subdued)}.c-select ::slotted([slot=leadingIcon]){--icon-display-override: block;--icon-size-override: 24px;inset-inline-start:var(--dt-spacing-d)}.c-select .c-select-trailingIcon{inset-inline-end:var(--dt-spacing-d)}@media (hover: hover){.c-select:hover{--select-background-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01))))}@supports (background-color: color-mix(in srgb,black,white)){.c-select:hover{--select-background-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-container-default))}}}.c-select.is-disabled{--select-background-color: var(--dt-color-disabled-01);--select-border-color: var(--dt-color-disabled-01);--select-text-color: var(--dt-color-content-disabled);--select-cursor: auto}", O = ["small", "medium", "large"], P = ["default", "error"], n = {
13
+ };
14
+ v.v = "0.6.1";
15
+ let g = v;
16
+ const A = "*,*:after,*:before{box-sizing:inherit}.c-select{--select-padding-block: var(--dt-spacing-c);--select-padding-inline-start: var(--dt-spacing-d);--select-padding-inline-end: 52px;--select-background-color: var(--dt-color-container-default);--select-text-color: var(--dt-color-content-default);--select-border-color: var(--dt-color-border-form);--select-font-size: calc(var(--dt-font-body-l-size) * 1px);--select-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--select-height: 48px;--select-cursor: pointer;position:relative;color:var(--select-text-color);font-size:var(--select-font-size);line-height:var(--select-line-height)}.c-select select{height:var(--select-height);width:100%;border:1px solid var(--select-border-color);border-radius:var(--dt-radius-rounded-c);padding-inline-start:var(--select-padding-inline-start);padding-inline-end:var(--select-padding-inline-end);padding-block-start:var(--select-padding-block);padding-block-end:var(--select-padding-block);background-color:var(--select-background-color);font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:var(--select-cursor);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.c-select select:focus-within{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-select.c-select--small{--select-padding-block: var(--dt-spacing-b);--select-height: 40px}.c-select.c-select--large{--select-padding-block: var(--dt-spacing-d);--select-height: 56px}.c-select.c-select--error{--select-border-color: var(--dt-color-support-error)}.c-select.c-select--withLeadingIcon{--select-padding-inline-start: calc(var(--dt-spacing-h) - var(--dt-spacing-a))}.c-select ::slotted([slot=leadingIcon]),.c-select .c-select-trailingIcon{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}.c-select:not(.is-disabled) ::slotted([slot=leadingIcon]),.c-select:not(.is-disabled) .c-select-trailingIcon{color:var(--dt-color-content-subdued)}.c-select ::slotted([slot=leadingIcon]){--icon-display-override: block;--icon-size-override: 24px;inset-inline-start:var(--dt-spacing-d)}.c-select .c-select-trailingIcon{inset-inline-end:var(--dt-spacing-d)}@media (hover: hover){.c-select:hover{--select-background-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01))))}@supports (background-color: color-mix(in srgb,black,white)){.c-select:hover{--select-background-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-container-default))}}}.c-select.is-disabled{--select-background-color: var(--dt-color-disabled-01);--select-border-color: var(--dt-color-disabled-01);--select-text-color: var(--dt-color-content-disabled);--select-cursor: auto}", O = ["small", "medium", "large"], F = ["default", "error"], a = {
23
17
  size: "medium",
24
18
  status: "default",
25
19
  disabled: !1,
26
20
  options: []
27
21
  };
28
- var R = Object.defineProperty, o = (c, t, e, d) => {
29
- for (var s = void 0, i = c.length - 1, l; i >= 0; i--)
30
- (l = c[i]) && (s = l(t, e, s) || s);
31
- return s && R(t, e, s), s;
22
+ var P = Object.defineProperty, V = Object.getOwnPropertyDescriptor, o = (t, e, r, l) => {
23
+ for (var i = l > 1 ? void 0 : l ? V(e, r) : e, n = t.length - 1, d; n >= 0; n--)
24
+ (d = t[n]) && (i = (l ? d(e, r, i) : d(i)) || i);
25
+ return l && i && P(e, r, i), i;
32
26
  };
33
- const g = "pie-select", u = "assistive-text", v = class v extends z(C(x)) {
27
+ const x = "pie-select", u = "assistive-text";
28
+ let s = class extends I(w(g)) {
34
29
  constructor() {
35
- super(...arguments), this.size = n.size, this.disabled = n.disabled, this.status = n.status, this.options = n.options, this._hasLeadingIcon = !1, this._handleChange = (t) => {
36
- const e = S(t);
30
+ super(...arguments), this.size = a.size, this.disabled = a.disabled, this.status = a.status, this.options = a.options, this._hasLeadingIcon = !1, this._handleChange = (t) => {
31
+ const e = z(t);
37
32
  this.dispatchEvent(e), this._internals.setFormValue(this._select.value);
38
33
  };
39
34
  }
@@ -82,7 +77,7 @@ const g = "pie-select", u = "assistive-text", v = class v extends z(C(x)) {
82
77
  </optgroup>
83
78
  ` : p`
84
79
  <option
85
- .value="${E(e.value)}"
80
+ .value="${T(e.value)}"
86
81
  ?disabled="${e.disabled}"
87
82
  ?selected="${e.selected}">
88
83
  ${e.text}
@@ -102,27 +97,27 @@ const g = "pie-select", u = "assistive-text", v = class v extends z(C(x)) {
102
97
  data-test-id="pie-select-assistive-text">
103
98
  ${this.assistiveText}
104
99
  </pie-assistive-text>
105
- ` : $;
100
+ ` : _;
106
101
  }
107
102
  render() {
108
103
  const {
109
104
  assistiveText: t,
110
105
  disabled: e,
111
- status: d,
112
- size: s,
106
+ status: r,
107
+ size: l,
113
108
  name: i,
114
- options: l,
115
- _hasLeadingIcon: y
116
- } = this, _ = {
109
+ options: n,
110
+ _hasLeadingIcon: d
111
+ } = this, y = {
117
112
  "c-select": !0,
118
- [`c-select--${s}`]: !0,
119
- [`c-select--${d}`]: !0,
120
- "c-select--withLeadingIcon": y,
113
+ [`c-select--${l}`]: !0,
114
+ [`c-select--${r}`]: !0,
115
+ "c-select--withLeadingIcon": d,
121
116
  "is-disabled": e
122
117
  };
123
118
  return p`
124
119
  <div
125
- class="${T(_)}"
120
+ class="${L(y)}"
126
121
  data-test-id="pie-select-shell">
127
122
  <slot name="leadingIcon" @slotchange=${this._handleLeadingIconSlotchange}></slot>
128
123
  <select
@@ -130,10 +125,10 @@ const g = "pie-select", u = "assistive-text", v = class v extends z(C(x)) {
130
125
  name="${h(i)}"
131
126
  ?disabled="${e}"
132
127
  aria-describedby="${h(t ? u : void 0)}"
133
- aria-invalid="${d === "error" ? "true" : "false"}"
134
- aria-errormessage="${h(d === "error" ? u : void 0)}"
128
+ aria-invalid="${r === "error" ? "true" : "false"}"
129
+ aria-errormessage="${h(r === "error" ? u : void 0)}"
135
130
  @change=${this._handleChange}>
136
- ${this.renderChildren(l)}
131
+ ${this.renderChildren(n)}
137
132
  </select>
138
133
  <icon-chevron-down size='s' class='c-select-trailingIcon'></icon-chevron-down>
139
134
  </div>
@@ -141,44 +136,46 @@ const g = "pie-select", u = "assistive-text", v = class v extends z(C(x)) {
141
136
  `;
142
137
  }
143
138
  };
144
- v.shadowRootOptions = { ...b.shadowRootOptions, delegatesFocus: !0 }, v.styles = I(V);
145
- let r = v;
139
+ s.shadowRootOptions = { ...b.shadowRootOptions, delegatesFocus: !0 };
140
+ s.styles = $(A);
146
141
  o([
147
- a({ type: String }),
148
- m(g, O, n.size)
149
- ], r.prototype, "size");
142
+ c({ type: String }),
143
+ f(x, O, a.size)
144
+ ], s.prototype, "size", 2);
150
145
  o([
151
- a({ type: Boolean })
152
- ], r.prototype, "disabled");
146
+ c({ type: Boolean })
147
+ ], s.prototype, "disabled", 2);
153
148
  o([
154
- a({ type: String }),
155
- m(g, P, n.status)
156
- ], r.prototype, "status");
149
+ c({ type: String }),
150
+ f(x, F, a.status)
151
+ ], s.prototype, "status", 2);
157
152
  o([
158
- a({ type: String })
159
- ], r.prototype, "assistiveText");
153
+ c({ type: String })
154
+ ], s.prototype, "assistiveText", 2);
160
155
  o([
161
- a({ type: String, reflect: !0 })
162
- ], r.prototype, "name");
156
+ c({ type: String, reflect: !0 })
157
+ ], s.prototype, "name", 2);
163
158
  o([
164
- a({ type: Array })
165
- ], r.prototype, "options");
159
+ c({ type: Array })
160
+ ], s.prototype, "options", 2);
166
161
  o([
167
- f("select")
168
- ], r.prototype, "focusTarget");
162
+ m("select")
163
+ ], s.prototype, "focusTarget", 2);
169
164
  o([
170
- f("select")
171
- ], r.prototype, "_select");
165
+ m("select")
166
+ ], s.prototype, "_select", 2);
172
167
  o([
173
- k({ slot: "leadingIcon", flatten: !0 })
174
- ], r.prototype, "_leadingIconSlot");
168
+ S({ slot: "leadingIcon", flatten: !0 })
169
+ ], s.prototype, "_leadingIconSlot", 2);
175
170
  o([
176
- w()
177
- ], r.prototype, "_hasLeadingIcon");
178
- L(g, r);
171
+ C()
172
+ ], s.prototype, "_hasLeadingIcon", 2);
173
+ s = o([
174
+ k("pie-select")
175
+ ], s);
179
176
  export {
180
- r as PieSelect,
181
- n as defaultProps,
177
+ s as PieSelect,
178
+ a as defaultProps,
182
179
  O as sizes,
183
- P as statusTypes
180
+ F as statusTypes
184
181
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-select",
3
3
  "description": "PIE Design System Select built using Web Components",
4
- "version": "0.5.2",
4
+ "version": "0.6.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -39,8 +39,8 @@
39
39
  "cem-plugin-module-file-extensions": "0.0.5"
40
40
  },
41
41
  "dependencies": {
42
- "@justeattakeaway/pie-assistive-text": "0.9.4",
43
- "@justeattakeaway/pie-webc-core": "0.25.1"
42
+ "@justeattakeaway/pie-assistive-text": "0.10.1",
43
+ "@justeattakeaway/pie-webc-core": "0.26.0"
44
44
  },
45
45
  "volta": {
46
46
  "extends": "../../../package.json"
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@ import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElem
9
9
  import {
10
10
  FormControlMixin,
11
11
  RtlMixin,
12
- defineCustomElement,
12
+ safeCustomElement,
13
13
  validPropertyValues,
14
14
  wrapNativeEvent,
15
15
  } from '@justeattakeaway/pie-webc-core';
@@ -43,6 +43,7 @@ const assistiveTextIdValue = 'assistive-text';
43
43
  * @tagname pie-select
44
44
  * @event {CustomEvent} change - when the selected option is changed.
45
45
  */
46
+ @safeCustomElement('pie-select')
46
47
  export class PieSelect extends FormControlMixin(RtlMixin(PieElement)) implements SelectProps {
47
48
  static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
48
49
 
@@ -224,8 +225,6 @@ export class PieSelect extends FormControlMixin(RtlMixin(PieElement)) implements
224
225
  static styles = unsafeCSS(styles);
225
226
  }
226
227
 
227
- defineCustomElement(componentSelector, PieSelect);
228
-
229
228
  declare global {
230
229
  interface HTMLElementTagNameMap {
231
230
  [componentSelector]: PieSelect;