@aurodesignsystem-dev/auro-formkit 0.0.0-pr1142.0 → 0.0.0-pr1144.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.
@@ -9,6 +9,7 @@
9
9
  |---------------------------------|---------------------------------|-----------|-------------|--------------------------------------------------|
10
10
  | [disabled](#disabled) | `disabled` | `boolean` | false | |
11
11
  | [error](#error) | `error` | `String` | | When defined, sets persistent validity to `customError` and sets `setCustomValidity` = attribute value. |
12
+ | [hasLegend](#hasLegend) | | `boolean` | false | |
12
13
  | [horizontal](#horizontal) | `horizontal` | `boolean` | false | |
13
14
  | [noValidate](#noValidate) | `noValidate` | `Boolean` | | If set, disables auto-validation on blur. |
14
15
  | [onDark](#onDark) | `onDark` | `Boolean` | false | Applies dark mode styles to the component. |
@@ -441,7 +441,7 @@ class AuroRadio extends i$2 {
441
441
  */
442
442
  const a=Symbol.for(""),o=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n(x);
443
443
 
444
- var styleCss$1 = i$5`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
444
+ var styleCss$1 = i$5`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}.hidden{display:none}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
445
445
 
446
446
  var colorCss$1 = i$5`:host legend{color:var(--ds-auro-radio-group-label-color)}:host([disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([onDark]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}`;
447
447
 
@@ -1527,6 +1527,7 @@ class AuroRadioGroup extends i$2 {
1527
1527
  this.optionSelected = undefined;
1528
1528
  this.onDark = false;
1529
1529
  this.touched = false;
1530
+ this.hasLegend = false;
1530
1531
 
1531
1532
  /**
1532
1533
  * @private
@@ -1620,6 +1621,18 @@ class AuroRadioGroup extends i$2 {
1620
1621
  type: Boolean,
1621
1622
  reflect: true,
1622
1623
  attribute: false
1624
+ },
1625
+
1626
+ /**
1627
+ * Indicates whether the legend slot is set or not.
1628
+ * @type {boolean}
1629
+ * @default false
1630
+ * @private
1631
+ */
1632
+ hasLegened: {
1633
+ type: Boolean,
1634
+ reflect: false,
1635
+ attribute: false
1623
1636
  }
1624
1637
  };
1625
1638
  }
@@ -1801,6 +1814,16 @@ class AuroRadioGroup extends i$2 {
1801
1814
  this.handleItems();
1802
1815
  }
1803
1816
 
1817
+ /**
1818
+ * Method for handling legend slot changes.
1819
+ * @private
1820
+ * @returns {void}
1821
+ */
1822
+ handleLegendSlotChange() {
1823
+ const slot = this.shadowRoot.querySelector("[slot='legend']");
1824
+ this.hasLegend = Boolean(slot);
1825
+ }
1826
+
1804
1827
  /**
1805
1828
  * Method for initializing the tab index of the checked radio input.
1806
1829
  * @private
@@ -1915,11 +1938,14 @@ class AuroRadioGroup extends i$2 {
1915
1938
  const groupClasses = {
1916
1939
  'displayFlex': this.horizontal && this.items.length <= this.max
1917
1940
  };
1941
+ const legendClasses = {
1942
+ 'hidden': !this.hasLegened && this.required
1943
+ };
1918
1944
 
1919
1945
  return u`
1920
1946
  <fieldset class="${e(groupClasses)}" part="radio-group" role="radiogroup">
1921
- <legend>
1922
- <slot name="legend"></slot>
1947
+ <legend class="${e(legendClasses)}">
1948
+ <slot name="legend" @slotchange=${this.handleLegendSlotChange}></slot>
1923
1949
  ${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
1924
1950
  </legend>
1925
1951
  <slot @slotchange=${this.handleSlotChange}></slot>
@@ -416,7 +416,7 @@ class AuroRadio extends i$2 {
416
416
  */
417
417
  const a=Symbol.for(""),o=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n(x);
418
418
 
419
- var styleCss$1 = i$5`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
419
+ var styleCss$1 = i$5`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}.hidden{display:none}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
420
420
 
421
421
  var colorCss$1 = i$5`:host legend{color:var(--ds-auro-radio-group-label-color)}:host([disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([onDark]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}`;
422
422
 
@@ -1502,6 +1502,7 @@ class AuroRadioGroup extends i$2 {
1502
1502
  this.optionSelected = undefined;
1503
1503
  this.onDark = false;
1504
1504
  this.touched = false;
1505
+ this.hasLegend = false;
1505
1506
 
1506
1507
  /**
1507
1508
  * @private
@@ -1595,6 +1596,18 @@ class AuroRadioGroup extends i$2 {
1595
1596
  type: Boolean,
1596
1597
  reflect: true,
1597
1598
  attribute: false
1599
+ },
1600
+
1601
+ /**
1602
+ * Indicates whether the legend slot is set or not.
1603
+ * @type {boolean}
1604
+ * @default false
1605
+ * @private
1606
+ */
1607
+ hasLegened: {
1608
+ type: Boolean,
1609
+ reflect: false,
1610
+ attribute: false
1598
1611
  }
1599
1612
  };
1600
1613
  }
@@ -1776,6 +1789,16 @@ class AuroRadioGroup extends i$2 {
1776
1789
  this.handleItems();
1777
1790
  }
1778
1791
 
1792
+ /**
1793
+ * Method for handling legend slot changes.
1794
+ * @private
1795
+ * @returns {void}
1796
+ */
1797
+ handleLegendSlotChange() {
1798
+ const slot = this.shadowRoot.querySelector("[slot='legend']");
1799
+ this.hasLegend = Boolean(slot);
1800
+ }
1801
+
1779
1802
  /**
1780
1803
  * Method for initializing the tab index of the checked radio input.
1781
1804
  * @private
@@ -1890,11 +1913,14 @@ class AuroRadioGroup extends i$2 {
1890
1913
  const groupClasses = {
1891
1914
  'displayFlex': this.horizontal && this.items.length <= this.max
1892
1915
  };
1916
+ const legendClasses = {
1917
+ 'hidden': !this.hasLegened && this.required
1918
+ };
1893
1919
 
1894
1920
  return u`
1895
1921
  <fieldset class="${e(groupClasses)}" part="radio-group" role="radiogroup">
1896
- <legend>
1897
- <slot name="legend"></slot>
1922
+ <legend class="${e(legendClasses)}">
1923
+ <slot name="legend" @slotchange=${this.handleLegendSlotChange}></slot>
1898
1924
  ${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
1899
1925
  </legend>
1900
1926
  <slot @slotchange=${this.handleSlotChange}></slot>
@@ -67,6 +67,13 @@ export class AuroRadioGroup extends LitElement {
67
67
  * @private
68
68
  */
69
69
  touched: boolean;
70
+ /**
71
+ * Indicates whether the legend slot is set or not.
72
+ * @type {boolean}
73
+ * @default false
74
+ * @private
75
+ */
76
+ hasLegened: boolean;
70
77
  };
71
78
  /**
72
79
  * This will register this element with the browser.
@@ -85,6 +92,7 @@ export class AuroRadioGroup extends LitElement {
85
92
  optionSelected: EventTarget;
86
93
  onDark: boolean;
87
94
  touched: boolean;
95
+ hasLegend: boolean;
88
96
  /**
89
97
  * @private
90
98
  */
@@ -154,6 +162,12 @@ export class AuroRadioGroup extends LitElement {
154
162
  * @returns {void}
155
163
  */
156
164
  private handleSlotChange;
165
+ /**
166
+ * Method for handling legend slot changes.
167
+ * @private
168
+ * @returns {void}
169
+ */
170
+ private handleLegendSlotChange;
157
171
  /**
158
172
  * Method for initializing the tab index of the checked radio input.
159
173
  * @private
@@ -369,7 +369,7 @@ class AuroRadio extends LitElement {
369
369
  }
370
370
  }
371
371
 
372
- var styleCss$1 = css`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
372
+ var styleCss$1 = css`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}.hidden{display:none}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
373
373
 
374
374
  var colorCss$1 = css`:host legend{color:var(--ds-auro-radio-group-label-color)}:host([disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([onDark]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}`;
375
375
 
@@ -1455,6 +1455,7 @@ class AuroRadioGroup extends LitElement {
1455
1455
  this.optionSelected = undefined;
1456
1456
  this.onDark = false;
1457
1457
  this.touched = false;
1458
+ this.hasLegend = false;
1458
1459
 
1459
1460
  /**
1460
1461
  * @private
@@ -1548,6 +1549,18 @@ class AuroRadioGroup extends LitElement {
1548
1549
  type: Boolean,
1549
1550
  reflect: true,
1550
1551
  attribute: false
1552
+ },
1553
+
1554
+ /**
1555
+ * Indicates whether the legend slot is set or not.
1556
+ * @type {boolean}
1557
+ * @default false
1558
+ * @private
1559
+ */
1560
+ hasLegened: {
1561
+ type: Boolean,
1562
+ reflect: false,
1563
+ attribute: false
1551
1564
  }
1552
1565
  };
1553
1566
  }
@@ -1729,6 +1742,16 @@ class AuroRadioGroup extends LitElement {
1729
1742
  this.handleItems();
1730
1743
  }
1731
1744
 
1745
+ /**
1746
+ * Method for handling legend slot changes.
1747
+ * @private
1748
+ * @returns {void}
1749
+ */
1750
+ handleLegendSlotChange() {
1751
+ const slot = this.shadowRoot.querySelector("[slot='legend']");
1752
+ this.hasLegend = Boolean(slot);
1753
+ }
1754
+
1732
1755
  /**
1733
1756
  * Method for initializing the tab index of the checked radio input.
1734
1757
  * @private
@@ -1843,11 +1866,14 @@ class AuroRadioGroup extends LitElement {
1843
1866
  const groupClasses = {
1844
1867
  'displayFlex': this.horizontal && this.items.length <= this.max
1845
1868
  };
1869
+ const legendClasses = {
1870
+ 'hidden': !this.hasLegened && this.required
1871
+ };
1846
1872
 
1847
1873
  return html$1`
1848
1874
  <fieldset class="${classMap(groupClasses)}" part="radio-group" role="radiogroup">
1849
- <legend>
1850
- <slot name="legend"></slot>
1875
+ <legend class="${classMap(legendClasses)}">
1876
+ <slot name="legend" @slotchange=${this.handleLegendSlotChange}></slot>
1851
1877
  ${this.required ? undefined : html$1`<slot name="optionalLabel"> (optional)</slot>`}
1852
1878
  </legend>
1853
1879
  <slot @slotchange=${this.handleSlotChange}></slot>
@@ -369,7 +369,7 @@ class AuroRadio extends LitElement {
369
369
  }
370
370
  }
371
371
 
372
- var styleCss$1 = css`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
372
+ var styleCss$1 = css`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}.hidden{display:none}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
373
373
 
374
374
  var colorCss$1 = css`:host legend{color:var(--ds-auro-radio-group-label-color)}:host([disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([onDark]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}`;
375
375
 
@@ -1455,6 +1455,7 @@ class AuroRadioGroup extends LitElement {
1455
1455
  this.optionSelected = undefined;
1456
1456
  this.onDark = false;
1457
1457
  this.touched = false;
1458
+ this.hasLegend = false;
1458
1459
 
1459
1460
  /**
1460
1461
  * @private
@@ -1548,6 +1549,18 @@ class AuroRadioGroup extends LitElement {
1548
1549
  type: Boolean,
1549
1550
  reflect: true,
1550
1551
  attribute: false
1552
+ },
1553
+
1554
+ /**
1555
+ * Indicates whether the legend slot is set or not.
1556
+ * @type {boolean}
1557
+ * @default false
1558
+ * @private
1559
+ */
1560
+ hasLegened: {
1561
+ type: Boolean,
1562
+ reflect: false,
1563
+ attribute: false
1551
1564
  }
1552
1565
  };
1553
1566
  }
@@ -1729,6 +1742,16 @@ class AuroRadioGroup extends LitElement {
1729
1742
  this.handleItems();
1730
1743
  }
1731
1744
 
1745
+ /**
1746
+ * Method for handling legend slot changes.
1747
+ * @private
1748
+ * @returns {void}
1749
+ */
1750
+ handleLegendSlotChange() {
1751
+ const slot = this.shadowRoot.querySelector("[slot='legend']");
1752
+ this.hasLegend = Boolean(slot);
1753
+ }
1754
+
1732
1755
  /**
1733
1756
  * Method for initializing the tab index of the checked radio input.
1734
1757
  * @private
@@ -1843,11 +1866,14 @@ class AuroRadioGroup extends LitElement {
1843
1866
  const groupClasses = {
1844
1867
  'displayFlex': this.horizontal && this.items.length <= this.max
1845
1868
  };
1869
+ const legendClasses = {
1870
+ 'hidden': !this.hasLegened && this.required
1871
+ };
1846
1872
 
1847
1873
  return html$1`
1848
1874
  <fieldset class="${classMap(groupClasses)}" part="radio-group" role="radiogroup">
1849
- <legend>
1850
- <slot name="legend"></slot>
1875
+ <legend class="${classMap(legendClasses)}">
1876
+ <slot name="legend" @slotchange=${this.handleLegendSlotChange}></slot>
1851
1877
  ${this.required ? undefined : html$1`<slot name="optionalLabel"> (optional)</slot>`}
1852
1878
  </legend>
1853
1879
  <slot @slotchange=${this.handleSlotChange}></slot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem-dev/auro-formkit",
3
- "version": "0.0.0-pr1142.0",
3
+ "version": "0.0.0-pr1144.0",
4
4
  "description": "A collection of web components used to build forms.",
5
5
  "homepage": "https://github.com/AlaskaAirlines/auro-formkit#readme",
6
6
  "bugs": {