@justeattakeaway/pie-checkbox-group 0.8.4 → 0.9.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.
package/dist/index.js CHANGED
@@ -1,38 +1,33 @@
1
- import { LitElement as g, html as p, unsafeCSS as v } from "lit";
2
- import { property as l, state as k, queryAssignedElements as m } from "lit/decorators.js";
3
- import { FormControlMixin as y, RtlMixin as _, validPropertyValues as G, defineCustomElement as C } from "@justeattakeaway/pie-webc-core";
4
- import { ifDefined as b } from "lit/directives/if-defined.js";
5
- import { classMap as E } from "lit/directives/class-map.js";
1
+ import { LitElement as x, html as n, unsafeCSS as g } from "lit";
2
+ import { state as v, property as l, queryAssignedElements as k } from "lit/decorators.js";
3
+ import { FormControlMixin as m, RtlMixin as y, validPropertyValues as _, safeCustomElement as G } from "@justeattakeaway/pie-webc-core";
4
+ import { ifDefined as u } from "lit/directives/if-defined.js";
5
+ import { classMap as C } from "lit/directives/class-map.js";
6
6
  import "@justeattakeaway/pie-assistive-text";
7
- var S = Object.defineProperty, $ = (c, e, o, n) => {
8
- for (var t = void 0, i = c.length - 1, a; i >= 0; i--)
9
- (a = c[i]) && (t = a(e, o, t) || t);
10
- return t && S(e, o, t), t;
11
- };
12
- class f extends g {
13
- constructor() {
14
- super(...arguments), this.v = "0.8.4";
7
+ const d = class d extends x {
8
+ willUpdate() {
9
+ this.getAttribute("v") || this.setAttribute("v", d.v);
15
10
  }
16
- }
17
- $([
18
- l({ type: String, reflect: !0 })
19
- ], f.prototype, "v");
20
- const O = "*,*:after,*:before{box-sizing:inherit}.c-checkboxGroup{--checkbox-group-offset: var(--dt-spacing-c);--checkbox-group-offset--inline: var(--dt-spacing-e);--checkbox-group-label-offset: var(--dt-spacing-a);margin:0;padding:0;border:0;min-width:0}.c-checkboxGroup ::slotted(pie-checkbox){display:flex}.c-checkboxGroup ::slotted(pie-form-label){display:block;padding-block-end:var(--checkbox-group-label-offset)}.c-checkboxGroup:not(.c-checkboxGroup--inline) ::slotted(pie-checkbox:not(:last-child)){margin-block-end:var(--checkbox-group-offset)}.c-checkboxGroup--inline{display:flex;align-items:flex-start;flex-wrap:wrap}.c-checkboxGroup.c-checkboxGroup--inline{margin:calc(-1 * var(--checkbox-group-offset) / 2) calc(-1 * var(--checkbox-group-offset--inline) / 2)}.c-checkboxGroup.c-checkboxGroup--inline ::slotted(pie-checkbox){margin:calc(var(--checkbox-group-offset) / 2) calc(var(--checkbox-group-offset--inline) / 2)}.c-checkboxGroup.c-checkboxGroup--inline ::slotted(pie-form-label){margin:0 calc(var(--checkbox-group-offset--inline) / 2) calc(-1 * (var(--checkbox-group-offset) / 2 - var(--checkbox-group-label-offset)));padding-block-end:0}.c-checkboxGroup-assistiveText{--checkbox-group-assistive-text-offset: var(--dt-spacing-a);display:block;margin-block-start:var(--checkbox-group-assistive-text-offset)}", T = ["default", "success", "error"], L = "pie-checkbox-group-disabled", I = "pie-checkbox-group-error", d = {
11
+ };
12
+ d.v = "0.9.0";
13
+ let b = d;
14
+ const S = "*,*:after,*:before{box-sizing:inherit}.c-checkboxGroup{--checkbox-group-offset: var(--dt-spacing-c);--checkbox-group-offset--inline: var(--dt-spacing-e);--checkbox-group-label-offset: var(--dt-spacing-a);margin:0;padding:0;border:0;min-width:0}.c-checkboxGroup ::slotted(pie-checkbox){display:flex}.c-checkboxGroup ::slotted(pie-form-label){display:block;padding-block-end:var(--checkbox-group-label-offset)}.c-checkboxGroup:not(.c-checkboxGroup--inline) ::slotted(pie-checkbox:not(:last-child)){margin-block-end:var(--checkbox-group-offset)}.c-checkboxGroup--inline{display:flex;align-items:flex-start;flex-wrap:wrap}.c-checkboxGroup.c-checkboxGroup--inline{margin:calc(-1 * var(--checkbox-group-offset) / 2) calc(-1 * var(--checkbox-group-offset--inline) / 2)}.c-checkboxGroup.c-checkboxGroup--inline ::slotted(pie-checkbox){margin:calc(var(--checkbox-group-offset) / 2) calc(var(--checkbox-group-offset--inline) / 2)}.c-checkboxGroup.c-checkboxGroup--inline ::slotted(pie-form-label){margin:0 calc(var(--checkbox-group-offset--inline) / 2) calc(-1 * (var(--checkbox-group-offset) / 2 - var(--checkbox-group-label-offset)));padding-block-end:0}.c-checkboxGroup-assistiveText{--checkbox-group-assistive-text-offset: var(--dt-spacing-a);display:block;margin-block-start:var(--checkbox-group-assistive-text-offset)}", E = ["default", "success", "error"], O = "pie-checkbox-group-disabled", $ = "pie-checkbox-group-error", p = {
21
15
  status: "default",
22
16
  disabled: !1,
23
17
  isInline: !1
24
18
  };
25
- var P = Object.defineProperty, r = (c, e, o, n) => {
26
- for (var t = void 0, i = c.length - 1, a; i >= 0; i--)
27
- (a = c[i]) && (t = a(e, o, t) || t);
28
- return t && P(e, o, t), t;
19
+ var T = Object.defineProperty, w = Object.getOwnPropertyDescriptor, i = (e, o, a, c) => {
20
+ for (var s = c > 1 ? void 0 : c ? w(o, a) : o, r = e.length - 1, h; r >= 0; r--)
21
+ (h = e[r]) && (s = (c ? h(o, a, s) : h(s)) || s);
22
+ return c && s && T(o, a, s), s;
29
23
  };
30
- const x = "pie-checkbox-group", u = "assistive-text", h = class h extends y(_(f)) {
24
+ const L = "pie-checkbox-group", f = "assistive-text";
25
+ let t = class extends m(y(b)) {
31
26
  constructor() {
32
- super(...arguments), this._hasLabel = !1, this.isInline = d.isInline, this.status = d.status, this.disabled = d.disabled;
27
+ super(...arguments), this._hasLabel = !1, this.isInline = p.isInline, this.status = p.status, this.disabled = p.disabled;
33
28
  }
34
29
  _handleDisabled() {
35
- this._slottedChildren.forEach((e) => e.dispatchEvent(new CustomEvent(L, {
30
+ this._slottedChildren.forEach((e) => e.dispatchEvent(new CustomEvent(O, {
36
31
  bubbles: !1,
37
32
  composed: !1,
38
33
  detail: { disabled: this.disabled }
@@ -40,7 +35,7 @@ const x = "pie-checkbox-group", u = "assistive-text", h = class h extends y(_(f)
40
35
  }
41
36
  _handleStatus() {
42
37
  this._slottedChildren.forEach((e) => {
43
- e.setAttribute("status", this.status), this.status === "error" && this.assistiveText && (e.setAttribute("assistiveText", this.assistiveText), e.dispatchEvent(new CustomEvent(I, { bubbles: !1, composed: !1, detail: { error: !0 } })));
38
+ e.setAttribute("status", this.status), this.status === "error" && this.assistiveText && (e.setAttribute("assistiveText", this.assistiveText), e.dispatchEvent(new CustomEvent($, { bubbles: !1, composed: !1, detail: { error: !0 } })));
44
39
  });
45
40
  }
46
41
  /**
@@ -58,7 +53,7 @@ const x = "pie-checkbox-group", u = "assistive-text", h = class h extends y(_(f)
58
53
  * @private
59
54
  */
60
55
  renderWrappedLabel() {
61
- return this._hasLabel ? p`<legend><slot name='label' @slotchange=${this.handleSlotChange}></slot></legend>` : p`<slot name='label' @slotchange=${this.handleSlotChange}></slot>`;
56
+ return this._hasLabel ? n`<legend><slot name='label' @slotchange=${this.handleSlotChange}></slot></legend>` : n`<slot name='label' @slotchange=${this.handleSlotChange}></slot>`;
62
57
  }
63
58
  updated(e) {
64
59
  e.has("disabled") && this._handleDisabled(), e.has("status") && this._handleStatus();
@@ -67,64 +62,65 @@ const x = "pie-checkbox-group", u = "assistive-text", h = class h extends y(_(f)
67
62
  const {
68
63
  name: e,
69
64
  isInline: o,
70
- assistiveText: n,
71
- status: t,
72
- disabled: i
73
- } = this, a = {
65
+ assistiveText: a,
66
+ status: c,
67
+ disabled: s
68
+ } = this, r = {
74
69
  "c-checkboxGroup": !0,
75
70
  "c-checkboxGroup--inline": o
76
71
  };
77
- return p`
72
+ return n`
78
73
  <fieldset
79
- name=${b(e)}
80
- ?disabled=${i}
81
- aria-describedby="${b(n ? u : void 0)}"
74
+ name=${u(e)}
75
+ ?disabled=${s}
76
+ aria-describedby="${u(a ? f : void 0)}"
82
77
  data-test-id="pie-checkbox-group-fieldset"
83
- class="${E(a)}"
78
+ class="${C(r)}"
84
79
  >
85
80
  ${this.renderWrappedLabel()}
86
81
  <slot></slot>
87
82
  </fieldset>
88
- ${n && p`
83
+ ${a && n`
89
84
  <pie-assistive-text
90
- id="${u}"
91
- variant=${t}
85
+ id="${f}"
86
+ variant=${c}
92
87
  class="c-checkboxGroup-assistiveText"
93
88
  data-test-id="pie-checkbox-group-assistive-text">
94
- ${n}
89
+ ${a}
95
90
  </pie-assistive-text>`}
96
91
  `;
97
92
  }
98
93
  };
99
- h.styles = v(O);
100
- let s = h;
101
- r([
102
- k()
103
- ], s.prototype, "_hasLabel");
104
- r([
94
+ t.styles = g(S);
95
+ i([
96
+ v()
97
+ ], t.prototype, "_hasLabel", 2);
98
+ i([
105
99
  l({ type: String, reflect: !0 })
106
- ], s.prototype, "name");
107
- r([
100
+ ], t.prototype, "name", 2);
101
+ i([
108
102
  l({ type: String })
109
- ], s.prototype, "assistiveText");
110
- r([
103
+ ], t.prototype, "assistiveText", 2);
104
+ i([
111
105
  l({ type: Boolean })
112
- ], s.prototype, "isInline");
113
- r([
106
+ ], t.prototype, "isInline", 2);
107
+ i([
114
108
  l({ type: String }),
115
- G(x, T, d.status)
116
- ], s.prototype, "status");
117
- r([
109
+ _(L, E, p.status)
110
+ ], t.prototype, "status", 2);
111
+ i([
118
112
  l({ type: Boolean, reflect: !0 })
119
- ], s.prototype, "disabled");
120
- r([
121
- m({ selector: "pie-checkbox" })
122
- ], s.prototype, "_slottedChildren");
123
- C(x, s);
113
+ ], t.prototype, "disabled", 2);
114
+ i([
115
+ k({ selector: "pie-checkbox" })
116
+ ], t.prototype, "_slottedChildren", 2);
117
+ t = i([
118
+ G("pie-checkbox-group")
119
+ ], t);
124
120
  export {
125
- L as ON_CHECKBOX_GROUP_DISABLED,
126
- I as ON_CHECKBOX_GROUP_ERROR,
127
- s as PieCheckboxGroup,
128
- d as defaultProps,
129
- T as statusTypes
121
+ O as ON_CHECKBOX_GROUP_DISABLED,
122
+ $ as ON_CHECKBOX_GROUP_ERROR,
123
+ t as PieCheckboxGroup,
124
+ p as defaultProps,
125
+ E as statusTypes
130
126
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-checkbox-group",
3
3
  "description": "PIE Design System Checkbox Group built using Web Components",
4
- "version": "0.8.4",
4
+ "version": "0.9.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/justeattakeaway/pie",
@@ -39,15 +39,15 @@
39
39
  "license": "Apache-2.0",
40
40
  "devDependencies": {
41
41
  "@custom-elements-manifest/analyzer": "0.9.0",
42
- "@justeattakeaway/pie-checkbox": "0.15.5",
42
+ "@justeattakeaway/pie-checkbox": "0.16.0",
43
43
  "@justeattakeaway/pie-components-config": "0.20.1",
44
44
  "@justeattakeaway/pie-css": "0.16.0",
45
45
  "@justeattakeaway/pie-monorepo-utils": "0.5.1",
46
46
  "cem-plugin-module-file-extensions": "0.0.5"
47
47
  },
48
48
  "dependencies": {
49
- "@justeattakeaway/pie-assistive-text": "0.9.3",
50
- "@justeattakeaway/pie-webc-core": "0.25.1"
49
+ "@justeattakeaway/pie-assistive-text": "0.10.0",
50
+ "@justeattakeaway/pie-webc-core": "0.26.0"
51
51
  },
52
52
  "volta": {
53
53
  "extends": "../../../package.json"
package/src/index.ts CHANGED
@@ -2,12 +2,14 @@ import {
2
2
  html, unsafeCSS, type PropertyValues, type TemplateResult,
3
3
  } from 'lit';
4
4
  import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
5
- import { property, queryAssignedElements, state } from 'lit/decorators.js';
5
+ import {
6
+ property, queryAssignedElements, state,
7
+ } from 'lit/decorators.js';
6
8
  import {
7
9
  RtlMixin,
8
- defineCustomElement,
9
10
  FormControlMixin,
10
11
  validPropertyValues,
12
+ safeCustomElement,
11
13
  } from '@justeattakeaway/pie-webc-core';
12
14
  import { ifDefined } from 'lit/directives/if-defined.js';
13
15
  import { classMap } from 'lit/directives/class-map.js';
@@ -34,6 +36,7 @@ const assistiveTextId = 'assistive-text';
34
36
  * @event {CustomEvent} pie-checkbox-group-disabled - triggered after the disabled state of the checkbox group changes.
35
37
  * @event {CustomEvent} pie-checkbox-group-error - triggered after the state of the checkbox group changes to error.
36
38
  */
39
+ @safeCustomElement('pie-checkbox-group')
37
40
  export class PieCheckboxGroup extends FormControlMixin(RtlMixin(PieElement)) implements CheckboxGroupProps {
38
41
  @state()
39
42
  private _hasLabel = false;
@@ -142,8 +145,6 @@ export class PieCheckboxGroup extends FormControlMixin(RtlMixin(PieElement)) imp
142
145
  static styles = unsafeCSS(styles);
143
146
  }
144
147
 
145
- defineCustomElement(componentSelector, PieCheckboxGroup);
146
-
147
148
  declare global {
148
149
  interface HTMLElementTagNameMap {
149
150
  [componentSelector]: PieCheckboxGroup;