@sebgroup/green-core 3.28.0 → 3.29.0-rc.20261012203419455

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.
@@ -7,10 +7,18 @@ declare class CheckboxGroup extends GdsFormControlElement<string[]> {
7
7
  * Controls the font-size of label and supporting text on group form control header and single checkbox buttons respectively.
8
8
  */
9
9
  size: 'large' | 'small';
10
+ /**
11
+ * Style Expression Property that controls the `flex-direction` property of
12
+ * the checkbox list. Supports all valid CSS `flex-direction` values.
13
+ */
14
+ 'flex-direction'?: string;
10
15
  /**
11
16
  * The flex-direction in which checkbox buttons are displayed.
17
+ *
18
+ * @deprecated Use `flex-direction` instead.
12
19
  */
13
- flexDirection: 'row' | 'column';
20
+ get flexDirection(): string | undefined;
21
+ set flexDirection(value: string | undefined);
14
22
  /**
15
23
  * Whether to hide the label for the checkbox group. Usable if you want a single checkbox to act as the label.
16
24
  */
@@ -13,6 +13,7 @@ import { GdsFormControlHeader } from "../../../primitives/form-control-header/fo
13
13
  import { gdsCustomElement, html } from "../../../scoping.js";
14
14
  import { observeLightDOM } from "../../../utils/decorators/index.js";
15
15
  import { ariaForwarding } from "../../../utils/decorators/aria-forwarding.js";
16
+ import { styleExpressionProperty } from "../../../utils/decorators/style-expression-property.js";
16
17
  import { watch } from "../../../utils/decorators/watch.js";
17
18
  import {
18
19
  withLayoutChildProps,
@@ -26,7 +27,6 @@ let CheckboxGroup = class extends GdsFormControlElement {
26
27
  super(...arguments);
27
28
  __privateAdd(this, _CheckboxGroup_instances);
28
29
  this.size = "large";
29
- this.flexDirection = "column";
30
30
  this.hideLabel = false;
31
31
  this.supportingText = "";
32
32
  this.showExtendedSupportingText = false;
@@ -38,6 +38,17 @@ let CheckboxGroup = class extends GdsFormControlElement {
38
38
  });
39
39
  });
40
40
  }
41
+ /**
42
+ * The flex-direction in which checkbox buttons are displayed.
43
+ *
44
+ * @deprecated Use `flex-direction` instead.
45
+ */
46
+ get flexDirection() {
47
+ return this["flex-direction"];
48
+ }
49
+ set flexDirection(value) {
50
+ this["flex-direction"] = value;
51
+ }
41
52
  get value() {
42
53
  return this._internalValue || [];
43
54
  }
@@ -73,15 +84,10 @@ let CheckboxGroup = class extends GdsFormControlElement {
73
84
  this.addEventListener("gds-validity-state", __privateGet(this, _syncCheckboxes));
74
85
  }
75
86
  render() {
76
- const classes = {
77
- "checkbox-group": true,
78
- "direction-row": this.flexDirection === "row",
79
- "direction-column": this.flexDirection === "column"
80
- };
81
87
  return html`<div
82
88
  role="group"
83
89
  id="checkboxgroup"
84
- class=${classMap(classes)}
90
+ class="checkbox-group"
85
91
  aria-labelledby="group-label"
86
92
  aria-describedby="supporting-text extended-supporting-text footer"
87
93
  aria-invalid=${this.invalid}
@@ -162,8 +168,8 @@ __decorateClass([
162
168
  property()
163
169
  ], CheckboxGroup.prototype, "size", 2);
164
170
  __decorateClass([
165
- property({ attribute: "flex-direction" })
166
- ], CheckboxGroup.prototype, "flexDirection", 2);
171
+ styleExpressionProperty({ selector: ".content" })
172
+ ], CheckboxGroup.prototype, "flex-direction", 2);
167
173
  __decorateClass([
168
174
  property({ type: Boolean, attribute: "hide-label" })
169
175
  ], CheckboxGroup.prototype, "hideLabel", 2);
@@ -38,27 +38,18 @@ const styles = css`
38
38
 
39
39
  .content {
40
40
  display: flex;
41
+ flex-direction: column;
42
+ flex-wrap: wrap;
43
+ /* row-gap/column-gap set once: the browser only renders whichever axis the
44
+ resolved flex-direction actually uses, so this reproduces the former
45
+ per-direction gap values without needing to key off direction. */
46
+ gap: var(--gds-sys-space-s) var(--gds-sys-space-xl);
41
47
  position: relative;
42
48
  max-width: max-content;
43
49
  color: var(--_checkbox-label-color);
44
50
  }
45
51
 
46
- .direction-row .content {
47
- flex-direction: row;
48
- flex-wrap: wrap;
49
- gap: var(--gds-sys-space-s) var(--gds-sys-space-xl);
50
- }
51
-
52
- .direction-column .content {
53
- flex-direction: column;
54
- gap: var(--gds-sys-space-s);
55
- }
56
-
57
- :host([size='small']) .direction-column .content {
58
- gap: var(--gds-sys-space-xs);
59
- }
60
-
61
- :host([size='small']) .direction-row .content {
52
+ :host([size='small']) .content {
62
53
  gap: var(--gds-sys-space-xs) var(--gds-sys-space-m);
63
54
  }
64
55
 
@@ -7,10 +7,18 @@ declare class RadioGroup extends GdsFormControlElement<string | boolean> {
7
7
  * Controls the font-size of label and supporting text on group form control header and single radio buttons respectively.
8
8
  */
9
9
  size: 'large' | 'small';
10
+ /**
11
+ * Style Expression Property that controls the `flex-direction` property of
12
+ * the radio list. Supports all valid CSS `flex-direction` values.
13
+ */
14
+ 'flex-direction'?: string;
10
15
  /**
11
16
  * The flex-direction in which radio buttons are displayed.
17
+ *
18
+ * @deprecated Use `flex-direction` instead.
12
19
  */
13
- flexDirection: 'row' | 'column';
20
+ get flexDirection(): string | undefined;
21
+ set flexDirection(value: string | undefined);
14
22
  /**
15
23
  * The supporting text displayed between the label and the field.
16
24
  * This text provides additional context or information to the user.
@@ -6,12 +6,12 @@ import {
6
6
  var _RadioGroup_instances, initializeFocusable_fn, handleFocus_fn, dispatchChangeEvents_fn, handleRadioChange_fn, handleKeyDown_fn, focusAndSelectRadio_fn, renderRadioGroupContents_fn, renderFieldControlHeader_fn, renderRadios_fn, renderFieldControlFooter_fn;
7
7
  import { localized } from "@lit/localize";
8
8
  import { property, query } from "lit/decorators.js";
9
- import { classMap } from "lit/directives/class-map.js";
10
9
  import { GdsFormControlFooter } from "../../../primitives/form-control-footer/form-control-footer.component.js";
11
10
  import { GdsFormControlHeader } from "../../../primitives/form-control-header/form-control-header.component.js";
12
11
  import { gdsCustomElement, html } from "../../../scoping.js";
13
12
  import { tokens } from "../../../tokens.style.js";
14
13
  import { ariaForwarding } from "../../../utils/decorators/aria-forwarding.js";
14
+ import { styleExpressionProperty } from "../../../utils/decorators/style-expression-property.js";
15
15
  import { watch } from "../../../utils/decorators/watch.js";
16
16
  import {
17
17
  withLayoutChildProps,
@@ -25,11 +25,21 @@ let RadioGroup = class extends GdsFormControlElement {
25
25
  super(...arguments);
26
26
  __privateAdd(this, _RadioGroup_instances);
27
27
  this.size = "large";
28
- this.flexDirection = "column";
29
28
  this.supportingText = "";
30
29
  this.showExtendedSupportingText = false;
31
30
  this._isConnected = false;
32
31
  }
32
+ /**
33
+ * The flex-direction in which radio buttons are displayed.
34
+ *
35
+ * @deprecated Use `flex-direction` instead.
36
+ */
37
+ get flexDirection() {
38
+ return this["flex-direction"];
39
+ }
40
+ set flexDirection(value) {
41
+ this["flex-direction"] = value;
42
+ }
33
43
  /**
34
44
  * Returns an array of `<gds-radio>` elements in the radio group.
35
45
  *
@@ -80,15 +90,10 @@ let RadioGroup = class extends GdsFormControlElement {
80
90
  });
81
91
  }
82
92
  render() {
83
- const classes = {
84
- "radio-group": true,
85
- "direction-row": this.flexDirection === "row",
86
- "direction-column": this.flexDirection === "column"
87
- };
88
93
  return html`<div
89
94
  role="radiogroup"
90
95
  id="radiogroup"
91
- class=${classMap(classes)}
96
+ class="radio-group"
92
97
  aria-labelledby="group-label"
93
98
  aria-describedby="supporting-text extended-supporting-text footer"
94
99
  aria-invalid=${this.invalid}
@@ -236,8 +241,8 @@ __decorateClass([
236
241
  property()
237
242
  ], RadioGroup.prototype, "size", 2);
238
243
  __decorateClass([
239
- property({ attribute: "flex-direction" })
240
- ], RadioGroup.prototype, "flexDirection", 2);
244
+ styleExpressionProperty({ selector: ".content" })
245
+ ], RadioGroup.prototype, "flex-direction", 2);
241
246
  __decorateClass([
242
247
  property({ attribute: "supporting-text" })
243
248
  ], RadioGroup.prototype, "supportingText", 2);
@@ -34,27 +34,18 @@ const styles = css`
34
34
 
35
35
  .content {
36
36
  display: flex;
37
+ flex-direction: column;
38
+ flex-wrap: wrap;
39
+ /* row-gap/column-gap set once: the browser only renders whichever axis the
40
+ resolved flex-direction actually uses, so this reproduces the former
41
+ per-direction gap values without needing to key off direction. */
42
+ gap: var(--gds-sys-space-s) var(--gds-sys-space-xl);
37
43
  position: relative;
38
44
  max-width: max-content;
39
45
  color: var(--_radio-label-color);
40
46
  }
41
47
 
42
- .direction-row .content {
43
- flex-direction: row;
44
- flex-wrap: wrap;
45
- gap: var(--gds-sys-space-s) var(--gds-sys-space-xl);
46
- }
47
-
48
- .direction-column .content {
49
- flex-direction: column;
50
- gap: var(--gds-sys-space-s);
51
- }
52
-
53
- :host([size='small']) .direction-column .content {
54
- gap: var(--gds-sys-space-xs);
55
- }
56
-
57
- :host([size='small']) .direction-row .content {
48
+ :host([size='small']) .content {
58
49
  gap: var(--gds-sys-space-xs) var(--gds-sys-space-m);
59
50
  }
60
51
  `;