@warp-ds/elements 2.8.2-next.2 → 2.8.2-next.4

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 (150) hide show
  1. package/dist/custom-elements.json +166 -69
  2. package/dist/index.d.ts +63 -11
  3. package/dist/packages/affix/affix.hydration.test.d.ts +1 -0
  4. package/dist/packages/affix/affix.hydration.test.js +33 -0
  5. package/dist/packages/affix/affix.js +3 -3
  6. package/dist/packages/affix/affix.js.map +3 -3
  7. package/dist/packages/alert/alert.hydration.test.d.ts +1 -0
  8. package/dist/packages/alert/alert.hydration.test.js +47 -0
  9. package/dist/packages/alert/alert.js +5 -5
  10. package/dist/packages/alert/alert.js.map +3 -3
  11. package/dist/packages/attention/attention.hydration.test.d.ts +1 -0
  12. package/dist/packages/attention/attention.hydration.test.js +66 -0
  13. package/dist/packages/attention/attention.js +11 -11
  14. package/dist/packages/attention/attention.js.map +3 -3
  15. package/dist/packages/badge/badge.hydration.test.d.ts +1 -0
  16. package/dist/packages/badge/badge.hydration.test.js +50 -0
  17. package/dist/packages/box/box.hydration.test.d.ts +1 -0
  18. package/dist/packages/box/box.hydration.test.js +37 -0
  19. package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.d.ts +1 -0
  20. package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +141 -0
  21. package/dist/packages/breadcrumbs/breadcrumbs.js.map +2 -2
  22. package/dist/packages/button/button.hydration.test.d.ts +1 -0
  23. package/dist/packages/button/button.hydration.test.js +43 -0
  24. package/dist/packages/button/button.js +3 -3
  25. package/dist/packages/button/button.js.map +3 -3
  26. package/dist/packages/button/button.react.stories.d.ts +1 -1
  27. package/dist/packages/card/card.hydration.test.d.ts +1 -0
  28. package/dist/packages/card/card.hydration.test.js +38 -0
  29. package/dist/packages/card/card.react.stories.d.ts +1 -1
  30. package/dist/packages/checkbox/checkbox.d.ts +17 -1
  31. package/dist/packages/checkbox/checkbox.hydration.test.d.ts +1 -0
  32. package/dist/packages/checkbox/checkbox.hydration.test.js +47 -0
  33. package/dist/packages/checkbox/checkbox.js +20 -19
  34. package/dist/packages/checkbox/checkbox.js.map +3 -3
  35. package/dist/packages/checkbox/styles.js +10 -9
  36. package/dist/packages/checkbox-group/checkbox-group.d.ts +7 -0
  37. package/dist/packages/checkbox-group/checkbox-group.hydration.test.d.ts +2 -0
  38. package/dist/packages/checkbox-group/checkbox-group.hydration.test.js +40 -0
  39. package/dist/packages/checkbox-group/checkbox-group.js +14 -14
  40. package/dist/packages/checkbox-group/checkbox-group.js.map +3 -3
  41. package/dist/packages/checkbox-group/checkbox-group.test.js +10 -0
  42. package/dist/packages/combobox/combobox.hydration.test.d.ts +1 -0
  43. package/dist/packages/combobox/combobox.hydration.test.js +43 -0
  44. package/dist/packages/combobox/combobox.react.stories.d.ts +1 -1
  45. package/dist/packages/datepicker/datepicker.hydration.test.d.ts +1 -0
  46. package/dist/packages/datepicker/datepicker.hydration.test.js +40 -0
  47. package/dist/packages/datepicker/datepicker.js +1 -1
  48. package/dist/packages/datepicker/datepicker.js.map +3 -3
  49. package/dist/packages/datepicker/datepicker.react.stories.d.ts +1 -1
  50. package/dist/packages/expandable/expandable.hydration.test.d.ts +1 -0
  51. package/dist/packages/expandable/expandable.hydration.test.js +47 -0
  52. package/dist/packages/expandable/expandable.js +3 -3
  53. package/dist/packages/expandable/expandable.js.map +3 -3
  54. package/dist/packages/icon/icon.hydration.test.d.ts +1 -0
  55. package/dist/packages/icon/icon.hydration.test.js +47 -0
  56. package/dist/packages/icon/icon.js +2 -2
  57. package/dist/packages/icon/icon.js.map +3 -3
  58. package/dist/packages/link/link.hydration.test.d.ts +1 -0
  59. package/dist/packages/link/link.hydration.test.js +54 -0
  60. package/dist/packages/modal/modal.hydration.test.d.ts +1 -0
  61. package/dist/packages/modal/modal.hydration.test.js +25 -0
  62. package/dist/packages/modal-header/modal-header.js +6 -6
  63. package/dist/packages/modal-header/modal-header.js.map +3 -3
  64. package/dist/packages/page-indicator/page-indicator.hydration.test.d.ts +1 -0
  65. package/dist/packages/page-indicator/page-indicator.hydration.test.js +41 -0
  66. package/dist/packages/pagination/locales/da/messages.mjs +1 -1
  67. package/dist/packages/pagination/locales/en/messages.mjs +1 -1
  68. package/dist/packages/pagination/locales/fi/messages.mjs +1 -1
  69. package/dist/packages/pagination/locales/nb/messages.mjs +1 -1
  70. package/dist/packages/pagination/locales/sv/messages.mjs +1 -1
  71. package/dist/packages/pagination/pagination.hydration.test.d.ts +1 -0
  72. package/dist/packages/pagination/pagination.hydration.test.js +38 -0
  73. package/dist/packages/pagination/pagination.js +13 -13
  74. package/dist/packages/pagination/pagination.js.map +3 -3
  75. package/dist/packages/pill/pill.hydration.test.d.ts +1 -0
  76. package/dist/packages/pill/pill.hydration.test.js +32 -0
  77. package/dist/packages/pill/pill.js +1 -1
  78. package/dist/packages/pill/pill.js.map +3 -3
  79. package/dist/packages/radio/radio.d.ts +33 -1
  80. package/dist/packages/radio/radio.hydration.test.d.ts +1 -0
  81. package/dist/packages/radio/radio.hydration.test.js +29 -0
  82. package/dist/packages/radio/radio.js +7 -7
  83. package/dist/packages/radio/radio.js.map +3 -3
  84. package/dist/packages/radio/radio.test.js +15 -8
  85. package/dist/packages/radio-group/locales/da/messages.mjs +1 -1
  86. package/dist/packages/radio-group/locales/en/messages.mjs +1 -1
  87. package/dist/packages/radio-group/locales/fi/messages.mjs +1 -1
  88. package/dist/packages/radio-group/locales/nb/messages.mjs +1 -1
  89. package/dist/packages/radio-group/locales/sv/messages.mjs +1 -1
  90. package/dist/packages/radio-group/radio-group.a11y.test.js +4 -0
  91. package/dist/packages/radio-group/radio-group.hydration.test.d.ts +2 -0
  92. package/dist/packages/radio-group/radio-group.hydration.test.js +32 -0
  93. package/dist/packages/radio-group/radio-group.js +17 -17
  94. package/dist/packages/radio-group/radio-group.js.map +3 -3
  95. package/dist/packages/select/select.hydration.test.d.ts +1 -0
  96. package/dist/packages/select/select.hydration.test.js +37 -0
  97. package/dist/packages/select/select.js +1 -1
  98. package/dist/packages/select/select.js.map +3 -3
  99. package/dist/packages/select/select.react.stories.d.ts +1 -1
  100. package/dist/packages/slider/slider.hydration.test.d.ts +1 -0
  101. package/dist/packages/slider/slider.hydration.test.js +33 -0
  102. package/dist/packages/slider/slider.js +9 -9
  103. package/dist/packages/slider/slider.js.map +3 -3
  104. package/dist/packages/slider/slider.test.js +13 -0
  105. package/dist/packages/slider-thumb/slider-thumb.hydration.test.d.ts +1 -0
  106. package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +35 -0
  107. package/dist/packages/slider-thumb/slider-thumb.js +16 -16
  108. package/dist/packages/slider-thumb/slider-thumb.js.map +3 -3
  109. package/dist/packages/step/step.hydration.test.d.ts +1 -0
  110. package/dist/packages/step/step.hydration.test.js +25 -0
  111. package/dist/packages/step/step.js +1 -1
  112. package/dist/packages/step/step.js.map +3 -3
  113. package/dist/packages/step-indicator/step-indicator.hydration.test.d.ts +1 -0
  114. package/dist/packages/step-indicator/step-indicator.hydration.test.js +25 -0
  115. package/dist/packages/switch/switch.a11y.test.js +13 -3
  116. package/dist/packages/switch/switch.d.ts +6 -0
  117. package/dist/packages/switch/switch.hydration.test.d.ts +1 -0
  118. package/dist/packages/switch/switch.hydration.test.js +54 -0
  119. package/dist/packages/switch/switch.js +7 -13
  120. package/dist/packages/switch/switch.js.map +2 -2
  121. package/dist/packages/tab/tab.d.ts +37 -2
  122. package/dist/packages/tab/tab.hydration.test.d.ts +1 -0
  123. package/dist/packages/tab/tab.hydration.test.js +25 -0
  124. package/dist/packages/tab/tab.js +22 -12
  125. package/dist/packages/tab/tab.js.map +3 -3
  126. package/dist/packages/tab-panel/tab-panel.d.ts +21 -0
  127. package/dist/packages/tab-panel/tab-panel.hydration.test.d.ts +1 -0
  128. package/dist/packages/tab-panel/tab-panel.hydration.test.js +21 -0
  129. package/dist/packages/tab-panel/tab-panel.js +16 -5
  130. package/dist/packages/tab-panel/tab-panel.js.map +3 -3
  131. package/dist/packages/tabs/tabs.a11y.test.js +45 -3
  132. package/dist/packages/tabs/tabs.hydration.test.d.ts +1 -0
  133. package/dist/packages/tabs/tabs.hydration.test.js +20 -0
  134. package/dist/packages/tabs/tabs.js +6 -6
  135. package/dist/packages/tabs/tabs.js.map +3 -3
  136. package/dist/packages/tabs/tabs.test.js +52 -4
  137. package/dist/packages/textarea/textarea.hydration.test.d.ts +1 -0
  138. package/dist/packages/textarea/textarea.hydration.test.js +43 -0
  139. package/dist/packages/textarea/textarea.react.stories.d.ts +1 -1
  140. package/dist/packages/textfield/textfield.hydration.test.d.ts +1 -0
  141. package/dist/packages/textfield/textfield.hydration.test.js +43 -0
  142. package/dist/packages/textfield/textfield.react.stories.d.ts +1 -1
  143. package/dist/packages/toast/toast.js +4 -4
  144. package/dist/packages/toast/toast.js.map +3 -3
  145. package/dist/setup-tests.d.ts +2 -1
  146. package/dist/setup-tests.js +4 -3
  147. package/dist/tests/react-hydration.d.ts +20 -0
  148. package/dist/tests/react-hydration.js +138 -0
  149. package/dist/web-types.json +59 -21
  150. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1121,6 +1121,12 @@ export type WRadioProps = {
1121
1121
  required?: WRadio["required"];
1122
1122
  /** Draws the radio in an invalid state. */
1123
1123
  invalid?: WRadio["invalid"];
1124
+ /** Override tabIndex setter to set _groupTabIndex (for backwards compatibility).
1125
+ Radio-group should use _groupTabIndex directly for clarity. */
1126
+ tabIndex?: WRadio["tabIndex"];
1127
+ /** Internal tabindex for standalone radios (not in a group).
1128
+ Non-reflecting to avoid DOM changes during hydration. */
1129
+ _standaloneTabIndex?: WRadio["_standaloneTabIndex"];
1124
1130
  };
1125
1131
 
1126
1132
  export type WRadioSolidJsProps = {
@@ -1136,6 +1142,12 @@ export type WRadioSolidJsProps = {
1136
1142
  "prop:required"?: WRadio["required"];
1137
1143
  /** Draws the radio in an invalid state. */
1138
1144
  "prop:invalid"?: WRadio["invalid"];
1145
+ /** Override tabIndex setter to set _groupTabIndex (for backwards compatibility).
1146
+ Radio-group should use _groupTabIndex directly for clarity. */
1147
+ "prop:tabIndex"?: WRadio["tabIndex"];
1148
+ /** Internal tabindex for standalone radios (not in a group).
1149
+ Non-reflecting to avoid DOM changes during hydration. */
1150
+ "prop:_standaloneTabIndex"?: WRadio["_standaloneTabIndex"];
1139
1151
 
1140
1152
  /** Set the innerHTML of the element */
1141
1153
  innerHTML?: string;
@@ -1632,17 +1644,19 @@ export type WarpTabProps = {
1632
1644
  /** */
1633
1645
  for?: WarpTab["for"];
1634
1646
  /** */
1635
- "aria-selected"?: WarpTab["ariaSelected"];
1647
+ "aria-controls"?: WarpTab["_ariaControlsAttr"];
1636
1648
  /** */
1637
- ariaSelected?: WarpTab["ariaSelected"];
1649
+ _ariaControlsAttr?: WarpTab["_ariaControlsAttr"];
1638
1650
  /** */
1639
- tabindex?: WarpTab["tabIndex"];
1651
+ "aria-selected"?: WarpTab["ariaSelected"];
1640
1652
  /** */
1641
- tabIndex?: WarpTab["tabIndex"];
1653
+ ariaSelected?: WarpTab["ariaSelected"];
1642
1654
  /** @deprecated Use `aria-selected="true"` instead */
1643
1655
  active?: WarpTab["active"];
1644
1656
  /** */
1645
1657
  over?: WarpTab["over"];
1658
+ /** Override tabIndex setter to set _parentTabIndex (for backwards compatibility). */
1659
+ tabIndex?: WarpTab["tabIndex"];
1646
1660
  };
1647
1661
 
1648
1662
  export type WarpTabSolidJsProps = {
@@ -1651,17 +1665,19 @@ export type WarpTabSolidJsProps = {
1651
1665
  /** */
1652
1666
  "prop:for"?: WarpTab["for"];
1653
1667
  /** */
1654
- "attr:aria-selected"?: WarpTab["ariaSelected"];
1668
+ "attr:aria-controls"?: WarpTab["_ariaControlsAttr"];
1655
1669
  /** */
1656
- "prop:ariaSelected"?: WarpTab["ariaSelected"];
1670
+ "prop:_ariaControlsAttr"?: WarpTab["_ariaControlsAttr"];
1657
1671
  /** */
1658
- "attr:tabindex"?: WarpTab["tabIndex"];
1672
+ "attr:aria-selected"?: WarpTab["ariaSelected"];
1659
1673
  /** */
1660
- "prop:tabIndex"?: WarpTab["tabIndex"];
1674
+ "prop:ariaSelected"?: WarpTab["ariaSelected"];
1661
1675
  /** @deprecated Use `aria-selected="true"` instead */
1662
1676
  "prop:active"?: WarpTab["active"];
1663
1677
  /** */
1664
1678
  "prop:over"?: WarpTab["over"];
1679
+ /** Override tabIndex setter to set _parentTabIndex (for backwards compatibility). */
1680
+ "prop:tabIndex"?: WarpTab["tabIndex"];
1665
1681
 
1666
1682
  /** Set the innerHTML of the element */
1667
1683
  innerHTML?: string;
@@ -1669,9 +1685,17 @@ export type WarpTabSolidJsProps = {
1669
1685
  textContent?: string | number;
1670
1686
  };
1671
1687
 
1672
- export type WarpTabPanelProps = {};
1688
+ export type WarpTabPanelProps = {
1689
+ /** Whether this panel is active (visible).
1690
+ Set by parent w-tabs via the _parentActive property. */
1691
+ active?: WarpTabPanel["active"];
1692
+ };
1673
1693
 
1674
1694
  export type WarpTabPanelSolidJsProps = {
1695
+ /** Whether this panel is active (visible).
1696
+ Set by parent w-tabs via the _parentActive property. */
1697
+ "prop:active"?: WarpTabPanel["active"];
1698
+
1675
1699
  /** Set the innerHTML of the element */
1676
1700
  innerHTML?: string;
1677
1701
  /** Set the textContent of the element */
@@ -2019,6 +2043,7 @@ export type CustomElements = {
2019
2043
  * - `required`: Makes the checkbox a required field.
2020
2044
  * - `invalid`: Draws the checkbox in an invalid state.
2021
2045
  * - `input`: undefined (property only)
2046
+ * - `_computedInvalid`: Computed invalid state: combines own invalid with group invalid (property only) (readonly)
2022
2047
  * - `validationMessage`: Returns the validation message if the checkbox is invalid, otherwise an empty string (property only) (readonly)
2023
2048
  * - `validity`: Returns the validity state of the checkbox (property only) (readonly)
2024
2049
  *
@@ -2360,8 +2385,12 @@ export type CustomElements = {
2360
2385
  * - `disabled`: Disables the radio.
2361
2386
  * - `required`: Makes the radio a required field.
2362
2387
  * - `invalid`: Draws the radio in an invalid state.
2388
+ * - `tabIndex`: Override tabIndex setter to set _groupTabIndex (for backwards compatibility).
2389
+ * Radio-group should use _groupTabIndex directly for clarity. (property only)
2363
2390
  * - `validationMessage`: Returns the validation message if the radio is invalid, otherwise an empty string (property only) (readonly)
2364
2391
  * - `validity`: Returns the validity state of the radio (property only) (readonly)
2392
+ * - `_standaloneTabIndex`: Internal tabindex for standalone radios (not in a group).
2393
+ * Non-reflecting to avoid DOM changes during hydration. (property only)
2365
2394
  *
2366
2395
  * ## Methods
2367
2396
  *
@@ -2665,10 +2694,12 @@ export type CustomElements = {
2665
2694
  *
2666
2695
  * - `id`: undefined
2667
2696
  * - `for`: undefined
2697
+ * - `aria-controls`/`_ariaControlsAttr`: undefined
2668
2698
  * - `aria-selected`/`ariaSelected`: undefined
2669
- * - `tabindex`/`tabIndex`: undefined
2670
2699
  * - `active`: undefined
2671
2700
  * - `over`: undefined
2701
+ * - `tabIndex`: Override tabIndex setter to set _parentTabIndex (for backwards compatibility). (property only)
2702
+ * - `_computedAriaSelected`: Computed aria-selected: prefers parent-managed, falls back to own property (property only) (readonly)
2672
2703
  */
2673
2704
  "w-tab": Partial<WarpTabProps & BaseProps<WarpTab> & BaseEvents>;
2674
2705
 
@@ -2677,6 +2708,13 @@ export type CustomElements = {
2677
2708
  * Each tab panel should have a name that matches a corresponding tab.
2678
2709
  *
2679
2710
  * [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/tabs--docs)
2711
+ *
2712
+ * ## Attributes & Properties
2713
+ *
2714
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
2715
+ *
2716
+ * - `active`: Whether this panel is active (visible).
2717
+ * Set by parent w-tabs via the _parentActive property.
2680
2718
  */
2681
2719
  "w-tab-panel": Partial<
2682
2720
  WarpTabPanelProps & BaseProps<WarpTabPanel> & BaseEvents
@@ -3011,6 +3049,7 @@ export type CustomElementsSolidJs = {
3011
3049
  * - `required`: Makes the checkbox a required field.
3012
3050
  * - `invalid`: Draws the checkbox in an invalid state.
3013
3051
  * - `input`: undefined (property only)
3052
+ * - `_computedInvalid`: Computed invalid state: combines own invalid with group invalid (property only) (readonly)
3014
3053
  * - `validationMessage`: Returns the validation message if the checkbox is invalid, otherwise an empty string (property only) (readonly)
3015
3054
  * - `validity`: Returns the validity state of the checkbox (property only) (readonly)
3016
3055
  *
@@ -3382,8 +3421,12 @@ export type CustomElementsSolidJs = {
3382
3421
  * - `disabled`: Disables the radio.
3383
3422
  * - `required`: Makes the radio a required field.
3384
3423
  * - `invalid`: Draws the radio in an invalid state.
3424
+ * - `tabIndex`: Override tabIndex setter to set _groupTabIndex (for backwards compatibility).
3425
+ * Radio-group should use _groupTabIndex directly for clarity. (property only)
3385
3426
  * - `validationMessage`: Returns the validation message if the radio is invalid, otherwise an empty string (property only) (readonly)
3386
3427
  * - `validity`: Returns the validity state of the radio (property only) (readonly)
3428
+ * - `_standaloneTabIndex`: Internal tabindex for standalone radios (not in a group).
3429
+ * Non-reflecting to avoid DOM changes during hydration. (property only)
3387
3430
  *
3388
3431
  * ## Methods
3389
3432
  *
@@ -3718,10 +3761,12 @@ export type CustomElementsSolidJs = {
3718
3761
  *
3719
3762
  * - `id`: undefined
3720
3763
  * - `for`: undefined
3764
+ * - `aria-controls`/`_ariaControlsAttr`: undefined
3721
3765
  * - `aria-selected`/`ariaSelected`: undefined
3722
- * - `tabindex`/`tabIndex`: undefined
3723
3766
  * - `active`: undefined
3724
3767
  * - `over`: undefined
3768
+ * - `tabIndex`: Override tabIndex setter to set _parentTabIndex (for backwards compatibility). (property only)
3769
+ * - `_computedAriaSelected`: Computed aria-selected: prefers parent-managed, falls back to own property (property only) (readonly)
3725
3770
  */
3726
3771
  "w-tab": Partial<
3727
3772
  WarpTabProps & WarpTabSolidJsProps & BaseProps<WarpTab> & BaseEvents
@@ -3732,6 +3777,13 @@ export type CustomElementsSolidJs = {
3732
3777
  * Each tab panel should have a name that matches a corresponding tab.
3733
3778
  *
3734
3779
  * [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/tabs--docs)
3780
+ *
3781
+ * ## Attributes & Properties
3782
+ *
3783
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
3784
+ *
3785
+ * - `active`: Whether this panel is active (visible).
3786
+ * Set by parent w-tabs via the _parentActive property.
3735
3787
  */
3736
3788
  "w-tab-panel": Partial<
3737
3789
  WarpTabPanelProps &
@@ -0,0 +1 @@
1
+ import './affix.js';
@@ -0,0 +1,33 @@
1
+ import { describe, expect, test, beforeEach, afterEach } from 'vitest';
2
+ import { setupHydrationWarningCapture, testHydration } from '../../tests/react-hydration';
3
+ import './affix.js';
4
+ describe('w-affix React SSR hydration', () => {
5
+ beforeEach(() => setupHydrationWarningCapture());
6
+ afterEach(() => {
7
+ window.__HYDRATION_WARNINGS__ = [];
8
+ });
9
+ test('default (no attributes) hydrates without warnings', async () => {
10
+ const warnings = await testHydration('w-affix', {});
11
+ expect(warnings).toEqual([]);
12
+ });
13
+ test('with label hydrates without warnings', async () => {
14
+ const warnings = await testHydration('w-affix', {
15
+ label: 'kr',
16
+ });
17
+ expect(warnings).toEqual([]);
18
+ });
19
+ test('with search hydrates without warnings', async () => {
20
+ const warnings = await testHydration('w-affix', {
21
+ search: true,
22
+ 'aria-label': 'Search',
23
+ });
24
+ expect(warnings).toEqual([]);
25
+ });
26
+ test('with clear hydrates without warnings', async () => {
27
+ const warnings = await testHydration('w-affix', {
28
+ clear: true,
29
+ 'aria-label': 'Clear',
30
+ });
31
+ expect(warnings).toEqual([]);
32
+ });
33
+ });
@@ -1,4 +1,4 @@
1
- var L=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var i=(e,o,r,t)=>{for(var a=t>1?void 0:t?E(o,r):o,l=e.length-1,c;l>=0;l--)(c=e[l])&&(a=(t?c(o,r,a):c(a))||a);return t&&a&&L(o,r,a),a};var g=function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];return e.reduce(function(r,t){return r.concat(typeof t=="string"?t:Array.isArray(t)?g.apply(void 0,t):typeof t=="object"&&t?Object.keys(t).map(function(a){return t[a]?a:""}):"")},[]).join(" ")};import{html as b,LitElement as F}from"lit";import{property as p}from"lit/decorators.js";import{ifDefined as z}from"lit/directives/if-defined.js";import{css as w}from"lit";var f=w`
1
+ var L=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var i=(e,o,r,t)=>{for(var a=t>1?void 0:t?E(o,r):o,n=e.length-1,c;n>=0;n--)(c=e[n])&&(a=(t?c(o,r,a):c(a))||a);return t&&a&&L(o,r,a),a};var g=function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];return e.reduce(function(r,t){return r.concat(typeof t=="string"?t:Array.isArray(t)?g.apply(void 0,t):typeof t=="object"&&t?Object.keys(t).map(function(a){return t[a]?a:""}):"")},[]).join(" ")};import{html as b,LitElement as F}from"lit";import{property as p}from"lit/decorators.js";import{ifDefined as z}from"lit/directives/if-defined.js";import{css as w}from"lit";var f=w`
2
2
  *,
3
3
  :before,
4
4
  :after {
@@ -2462,7 +2462,7 @@ var L=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var i=(e,o,r,t
2462
2462
  --w-icon-size: 32px;
2463
2463
  }
2464
2464
 
2465
- `;var v=new Map,T='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function X(e,o={}){var t;let r=(t=o.responseParser)!=null?t:(a=>a.text());return v.has(e)||v.set(e,fetch(e).then(r)),v.get(e)}var n=class extends S{constructor(){super(...arguments);this.name="";this.svg=null}async fetchIcon(r){let a=`https://assets.finn.no/pkg/eikons/v1/${this.locale||"en"}/${r}.svg`;try{let l=await X(a);return new DOMParser().parseFromString(l,"text/html").body.querySelector("svg")}catch(l){return null}}firstUpdated(){this.loadIcon()}updated(r){(r.has("name")||r.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let r=await this.fetchIcon(this.name);r||(r=new DOMParser().parseFromString(T,"text/html").body.firstElementChild),this.svg=r}render(){let r=this.size||"medium",t={"w-icon":!0,"w-icon--s":r==="small","w-icon--m":r==="medium","w-icon--l":r==="large"},a=typeof r=="string"&&r.endsWith("px")?`--w-icon-size: ${r};`:"";return j`<div class="${P(t)}" style="${a}" part="w-${this.name.toLowerCase()}">${this.svg}</div>`}};n.styles=[k],i([u({type:String,reflect:!0})],n.prototype,"name",2),i([u({type:String,reflect:!0})],n.prototype,"size",2),i([u({type:String,reflect:!0})],n.prototype,"locale",2),i([$()],n.prototype,"svg",2);customElements.get("w-icon")||customElements.define("w-icon",n);var Z=["en","nb","fi","da","sv"],h="en",d=e=>Z.find(o=>e===o||e.toLowerCase().includes(o))||h;function m(){if(typeof window=="undefined"){let e=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return d(e)}try{let e=y(document);if(e)return d(e);let o=C();if(o)return d(o);let r=y(B());return r?d(r):h}catch(e){return console.warn("could not detect locale, falling back to source locale",e),h}}function B(){var e,o;try{return(o=(e=window.parent)==null?void 0:e.document)!=null?o:null}catch(r){return null}}function y(e){var o,r;try{return(r=(o=e==null?void 0:e.documentElement)==null?void 0:o.lang)!=null?r:""}catch(t){return""}}function C(){var e,o,r;try{return(r=(o=(e=window.frameElement)==null?void 0:e.getAttribute)==null?void 0:o.call(e,"lang"))!=null?r:""}catch(t){return""}}var _="absolute top-0 bottom-0 flex justify-center items-center focusable rounded-4 focus:[--w-outline-offset:-2px] bg-transparent ",O={wrapper:_+"right-0",wrapperWithLabel:"w-max pr-12",wrapperWithIcon:"w-40",label:"antialiased block relative cursor-default pb-0 font-bold text-xs s-text"},R={wrapper:_+"left-0",wrapperWithLabel:"w-max pl-12",wrapperWithIcon:"w-40",label:"antialiased block relative cursor-default pb-0 font-bold text-xs s-text"},s=class extends F{constructor(){super(...arguments);this.clear=!1;this.search=!1}get _classBase(){return this.slot==="suffix"?O:R}get _classes(){return g([this._classBase.wrapper,this.label?this._classBase.wrapperWithLabel:this._classBase.wrapperWithIcon])}get _searchButton(){return b`
2465
+ `;var v=new Map,T='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function X(e,o={}){var t;let r=(t=o.responseParser)!=null?t:(a=>a.text());return v.has(e)||v.set(e,fetch(e).then(r)),v.get(e)}var s=class extends S{constructor(){super(...arguments);this.svg=null}async fetchIcon(r){let a=`https://assets.finn.no/pkg/eikons/v1/${this.locale||"en"}/${r}.svg`;try{let n=await X(a);return new DOMParser().parseFromString(n,"text/html").body.querySelector("svg")}catch(n){return null}}firstUpdated(){this.loadIcon()}updated(r){(r.has("name")||r.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let r=await this.fetchIcon(this.name);r||(r=new DOMParser().parseFromString(T,"text/html").body.firstElementChild),this.svg=r}render(){let r=this.size||"medium",t=this.name||"",a={"w-icon":!0,"w-icon--s":r==="small","w-icon--m":r==="medium","w-icon--l":r==="large"},n=typeof r=="string"&&r.endsWith("px")?`--w-icon-size: ${r};`:"";return j`<div class="${P(a)}" style="${n}" part="w-${t.toLowerCase()}">${this.svg}</div>`}};s.styles=[k],i([u({type:String,reflect:!0})],s.prototype,"name",2),i([u({type:String,reflect:!0})],s.prototype,"size",2),i([u({type:String,reflect:!0})],s.prototype,"locale",2),i([$()],s.prototype,"svg",2);customElements.get("w-icon")||customElements.define("w-icon",s);var Z=["en","nb","fi","da","sv"],h="en",d=e=>Z.find(o=>e===o||e.toLowerCase().includes(o))||h;function m(){if(typeof window=="undefined"){let e=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return d(e)}try{let e=y(document);if(e)return d(e);let o=C();if(o)return d(o);let r=y(B());return r?d(r):h}catch(e){return console.warn("could not detect locale, falling back to source locale",e),h}}function B(){var e,o;try{return(o=(e=window.parent)==null?void 0:e.document)!=null?o:null}catch(r){return null}}function y(e){var o,r;try{return(r=(o=e==null?void 0:e.documentElement)==null?void 0:o.lang)!=null?r:""}catch(t){return""}}function C(){var e,o,r;try{return(r=(o=(e=window.frameElement)==null?void 0:e.getAttribute)==null?void 0:o.call(e,"lang"))!=null?r:""}catch(t){return""}}var _="absolute top-0 bottom-0 flex justify-center items-center focusable rounded-4 focus:[--w-outline-offset:-2px] bg-transparent ",O={wrapper:_+"right-0",wrapperWithLabel:"w-max pr-12",wrapperWithIcon:"w-40",label:"antialiased block relative cursor-default pb-0 font-bold text-xs s-text"},R={wrapper:_+"left-0",wrapperWithLabel:"w-max pl-12",wrapperWithIcon:"w-40",label:"antialiased block relative cursor-default pb-0 font-bold text-xs s-text"},l=class extends F{constructor(){super(...arguments);this.clear=!1;this.search=!1}get _classBase(){return this.slot==="suffix"?O:R}get _classes(){return g([this._classBase.wrapper,this.label?this._classBase.wrapperWithLabel:this._classBase.wrapperWithIcon])}get _searchButton(){return b`
2466
2466
  <button aria-label="${z(this.ariaLabel)}" class="${this._classes}" type="submit">
2467
2467
  <w-icon name="Search" size="small" locale="${m()}" class="flex"></w-icon>
2468
2468
  </button>
@@ -2474,5 +2474,5 @@ var L=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var i=(e,o,r,t
2474
2474
  <div class="${this._classes}">
2475
2475
  <span class="${this._classBase.label}">${this.label}</span>
2476
2476
  </div>
2477
- `}get _markup(){if(this.label)return this._text;if(this.search)return this._searchButton;if(this.clear)return this._clearButton}render(){return b`${this._markup}`}};s.styles=[f,x],i([p({attribute:"aria-label"})],s.prototype,"ariaLabel",2),i([p({type:Boolean})],s.prototype,"clear",2),i([p({type:Boolean})],s.prototype,"search",2),i([p()],s.prototype,"label",2);customElements.get("w-affix")||customElements.define("w-affix",s);export{s as WarpAffix};
2477
+ `}get _markup(){if(this.label)return this._text;if(this.search)return this._searchButton;if(this.clear)return this._clearButton}render(){return b`${this._markup}`}};l.styles=[f,x],i([p({attribute:"aria-label"})],l.prototype,"ariaLabel",2),i([p({type:Boolean})],l.prototype,"clear",2),i([p({type:Boolean})],l.prototype,"search",2),i([p()],l.prototype,"label",2);customElements.get("w-affix")||customElements.define("w-affix",l);export{l as WarpAffix};
2478
2478
  //# sourceMappingURL=affix.js.map