@luzmo/analytics-components-kit 1.1.1 → 1.2.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.
Files changed (161) hide show
  1. package/README.md +8 -2
  2. package/angular/components/interactive-viz-item.ts +40 -3
  3. package/angular/components/item-option-color-picker.ts +30 -3
  4. package/angular/components/item-option-color-range.ts +30 -3
  5. package/angular/components/item-option-guidelines.ts +31 -4
  6. package/angular/components/item-option-panel.ts +41 -4
  7. package/angular/components/item-option-slider.ts +41 -4
  8. package/angular/components/item-option.ts +41 -4
  9. package/angular/esm/components/interactive-viz-item.d.ts +13 -4
  10. package/angular/esm/components/interactive-viz-item.js +29 -3
  11. package/angular/esm/components/item-option-color-picker.d.ts +11 -4
  12. package/angular/esm/components/item-option-color-picker.js +23 -3
  13. package/angular/esm/components/item-option-color-range.d.ts +11 -4
  14. package/angular/esm/components/item-option-color-range.js +23 -3
  15. package/angular/esm/components/item-option-guidelines.d.ts +11 -4
  16. package/angular/esm/components/item-option-guidelines.js +24 -4
  17. package/angular/esm/components/item-option-panel.d.ts +13 -4
  18. package/angular/esm/components/item-option-panel.js +30 -4
  19. package/angular/esm/components/item-option-slider.d.ts +13 -4
  20. package/angular/esm/components/item-option-slider.js +30 -4
  21. package/angular/esm/components/item-option.d.ts +13 -4
  22. package/angular/esm/components/item-option.js +30 -4
  23. package/angular/package.json +2 -2
  24. package/angular/utils/option-interaction/index.d.ts +2 -0
  25. package/angular/utils/option-interaction/is-same-option-value.d.ts +10 -0
  26. package/angular/utils/option-interaction/option-interaction-controller.d.ts +54 -0
  27. package/angular/utils/option-interaction/tests/option-interaction-controller.test.d.ts +1 -0
  28. package/angular/utils/store/base-store.d.ts +9 -0
  29. package/angular/utils/store/tests/store-base-history.test.d.ts +1 -0
  30. package/components/{base-store-SgJsjLap.cjs → base-store-D3whjduR.cjs} +1 -1
  31. package/components/{base-store-g0dt7ru7.js → base-store-DQYj8A1W.js} +3 -0
  32. package/components/{choropleth-map-options.config-D9-u-NwX.js → choropleth-map-options.config-Blu0Z2tR.js} +1 -1
  33. package/components/{choropleth-map-options.config-CXDGMiSJ.cjs → choropleth-map-options.config-DwFJ00CS.cjs} +1 -1
  34. package/components/{color-range-utils-CUCTsRXM.js → color-range-utils-CgwRGUkg.js} +18 -18
  35. package/components/{color-range-utils-BCFQAeY1.cjs → color-range-utils-D8uygiMe.cjs} +1 -1
  36. package/components/{heat-map-options.config-ChZeslEy.js → heat-map-options.config-BQkhkLPb.js} +16 -16
  37. package/components/{heat-map-options.config-DiNa8NnG.cjs → heat-map-options.config-DjQkB039.cjs} +1 -1
  38. package/components/{heat-table-options.config-BPCszrFn.js → heat-table-options.config-CMWWTeyo.js} +1 -1
  39. package/components/{heat-table-options.config-BvE6coaV.cjs → heat-table-options.config-D21xtaIk.cjs} +1 -1
  40. package/components/index.cjs +1 -1
  41. package/components/index.js +7 -7
  42. package/components/interactive-viz-item/index.cjs +1 -1
  43. package/components/interactive-viz-item/index.d.ts +2 -1
  44. package/components/interactive-viz-item/index.js +1 -1
  45. package/components/interactive-viz-item/interactive-viz-item.d.ts +31 -1
  46. package/components/interactive-viz-item/types.d.ts +13 -0
  47. package/components/{interactive-viz-item-CofUkpP6.js → interactive-viz-item-CwRRaCZB.js} +144 -84
  48. package/components/interactive-viz-item-CxdrGRKc.cjs +265 -0
  49. package/components/is-same-option-value-B2oyvEqT.js +42 -0
  50. package/components/is-same-option-value-Cf6BQcs7.cjs +20 -0
  51. package/components/item-option/helpers/control-markup.d.ts +7 -0
  52. package/components/item-option/index.cjs +1 -1
  53. package/components/item-option/index.d.ts +1 -1
  54. package/components/item-option/index.js +1 -1
  55. package/components/item-option/item-option.d.ts +23 -2
  56. package/components/item-option/types.d.ts +19 -0
  57. package/components/{item-option-Cgx3c08E.js → item-option-DKLRnicU.js} +182 -136
  58. package/components/item-option-DpLdospV.cjs +285 -0
  59. package/components/item-option-color-picker/index.cjs +1 -1
  60. package/components/item-option-color-picker/index.d.ts +1 -1
  61. package/components/item-option-color-picker/index.js +1 -1
  62. package/components/item-option-color-picker/item-option-color-picker.d.ts +17 -1
  63. package/components/item-option-color-picker-CNW7GsCO.cjs +37 -0
  64. package/components/item-option-color-picker-DDvsY7hV.js +129 -0
  65. package/components/item-option-color-range/index.cjs +1 -1
  66. package/components/item-option-color-range/index.d.ts +1 -1
  67. package/components/item-option-color-range/index.js +1 -1
  68. package/components/item-option-color-range/item-option-color-range.d.ts +20 -1
  69. package/components/item-option-color-range-BqSbuSZh.cjs +101 -0
  70. package/components/item-option-color-range-FQduqtz3.js +265 -0
  71. package/components/item-option-guidelines/index.cjs +1 -1
  72. package/components/item-option-guidelines/index.d.ts +1 -1
  73. package/components/item-option-guidelines/index.js +1 -1
  74. package/components/item-option-guidelines/item-option-guidelines.d.ts +16 -1
  75. package/components/{item-option-guidelines-DNJevmVD.js → item-option-guidelines-k5DwMONo.js} +132 -104
  76. package/components/item-option-guidelines-z9BsGR-l.cjs +138 -0
  77. package/components/item-option-panel/index.cjs +1 -1
  78. package/components/item-option-panel/index.d.ts +1 -1
  79. package/components/item-option-panel/index.js +1 -1
  80. package/components/item-option-panel/item-option-panel.d.ts +12 -1
  81. package/components/{item-option-panel-DHdnisRb.js → item-option-panel-BLXWIbjX.js} +18 -6
  82. package/components/{item-option-panel-Dl3aYBNe.cjs → item-option-panel-CU51qvgV.cjs} +6 -4
  83. package/components/item-option-slider/index.cjs +1 -1
  84. package/components/item-option-slider/index.d.ts +1 -1
  85. package/components/item-option-slider/index.js +1 -1
  86. package/components/item-option-slider/item-option-slider.d.ts +15 -2
  87. package/components/item-option-slider-BKtJfL3D.js +119 -0
  88. package/components/item-option-slider-Kz2eFBql.cjs +36 -0
  89. package/components/item-options-configs.cjs +1 -1
  90. package/components/item-options-configs.js +5 -5
  91. package/components/option-interaction-controller-B8S1N_Oo.js +90 -0
  92. package/components/option-interaction-controller-D0U-CTpZ.cjs +20 -0
  93. package/components/{route-map-options.config-DdCaVtIF.cjs → route-map-options.config-DER6ENky.cjs} +1 -1
  94. package/components/{route-map-options.config-B7vT6KG_.js → route-map-options.config-DTcS47fW.js} +1 -1
  95. package/components/{spike-map-options.config-DkmRZ1JZ.js → spike-map-options.config-CPYfKWoF.js} +1 -1
  96. package/components/{spike-map-options.config-B3hDh2qU.cjs → spike-map-options.config-DeF1Whq5.cjs} +1 -1
  97. package/components/utils/store.cjs +1 -1
  98. package/components/utils/store.js +1 -1
  99. package/custom-elements.json +409 -103
  100. package/package.json +1 -1
  101. package/react/components/interactive-viz-item.component.ts +11 -2
  102. package/react/components/item-option-color-picker.component.ts +9 -3
  103. package/react/components/item-option-color-range.component.ts +9 -3
  104. package/react/components/item-option-guidelines.component.ts +9 -3
  105. package/react/components/item-option-panel.component.ts +12 -3
  106. package/react/components/item-option-slider.component.ts +12 -3
  107. package/react/components/item-option.component.ts +12 -3
  108. package/react/esm/components/interactive-viz-item.component.d.ts +8 -2
  109. package/react/esm/components/interactive-viz-item.component.js +7 -1
  110. package/react/esm/components/item-option-color-picker.component.d.ts +6 -2
  111. package/react/esm/components/item-option-color-picker.component.js +6 -2
  112. package/react/esm/components/item-option-color-range.component.d.ts +6 -2
  113. package/react/esm/components/item-option-color-range.component.js +6 -2
  114. package/react/esm/components/item-option-guidelines.component.d.ts +6 -2
  115. package/react/esm/components/item-option-guidelines.component.js +6 -2
  116. package/react/esm/components/item-option-panel.component.d.ts +8 -2
  117. package/react/esm/components/item-option-panel.component.js +8 -2
  118. package/react/esm/components/item-option-slider.component.d.ts +8 -2
  119. package/react/esm/components/item-option-slider.component.js +8 -2
  120. package/react/esm/components/item-option.component.d.ts +8 -2
  121. package/react/esm/components/item-option.component.js +8 -2
  122. package/react/luzmo-stub.d.ts +7 -0
  123. package/react/package.json +2 -2
  124. package/standalone/chunks/{choropleth-map-options.config-Cs4Kvr9h.js → choropleth-map-options.config-rUJsEJcm.js} +1 -1
  125. package/standalone/chunks/{color-range-utils-CKDpd3gZ.js → color-range-utils-DxOtqAKB.js} +1 -1
  126. package/standalone/chunks/embed-CBu7iQRx.js +231 -0
  127. package/standalone/chunks/{heat-map-options.config-DF5kjOOe.js → heat-map-options.config-D93AeYFi.js} +1 -1
  128. package/standalone/chunks/{heat-table-options.config-DaePzfHG.js → heat-table-options.config-ZVML76FK.js} +1 -1
  129. package/standalone/chunks/is-same-option-value-Di-A7Wmg.js +2 -0
  130. package/standalone/chunks/item-option-color-picker-lLvBPnKA.js +19 -0
  131. package/standalone/chunks/{item-option-color-range-CyJd1LZ_.js → item-option-color-range-BqeatOei.js} +18 -15
  132. package/standalone/chunks/item-option-guidelines-Cop8rM8y.js +120 -0
  133. package/standalone/chunks/item-option-panel-CzSKFCVl.js +316 -0
  134. package/standalone/chunks/item-option-slider-K_bsNci8.js +18 -0
  135. package/standalone/chunks/option-interaction-controller-BslAXAHF.js +2 -0
  136. package/standalone/chunks/{route-map-options.config-D7FfzIiU.js → route-map-options.config-Dwy0JSVq.js} +1 -1
  137. package/standalone/chunks/{spike-map-options.config-CZiFzDm9.js → spike-map-options.config-DFmuNxym.js} +1 -1
  138. package/standalone/interactive-viz-item.js +24 -20
  139. package/standalone/item-grid.js +1 -1
  140. package/standalone/manifest.json +14 -13
  141. package/utils/option-interaction/index.d.ts +2 -0
  142. package/utils/option-interaction/is-same-option-value.d.ts +10 -0
  143. package/utils/option-interaction/option-interaction-controller.d.ts +54 -0
  144. package/utils/option-interaction/tests/option-interaction-controller.test.d.ts +1 -0
  145. package/utils/store/base-store.d.ts +9 -0
  146. package/utils/store/tests/store-base-history.test.d.ts +1 -0
  147. package/components/interactive-viz-item-D537mo3l.cjs +0 -261
  148. package/components/item-option-CqGDFdPj.cjs +0 -269
  149. package/components/item-option-color-picker-BpPoOO2b.cjs +0 -34
  150. package/components/item-option-color-picker-cojuCvu5.js +0 -84
  151. package/components/item-option-color-range-CMBEx1fi.cjs +0 -98
  152. package/components/item-option-color-range-Dt7Bv06p.js +0 -217
  153. package/components/item-option-guidelines-Beh0DlG0.cjs +0 -135
  154. package/components/item-option-slider-Bo5vs6nr.js +0 -89
  155. package/components/item-option-slider-CyWKWr5D.cjs +0 -33
  156. package/standalone/chunks/color-7IgCGZKz.js +0 -2
  157. package/standalone/chunks/embed-BfHBKhIe.js +0 -231
  158. package/standalone/chunks/item-option-color-picker-Cr7ujQNO.js +0 -16
  159. package/standalone/chunks/item-option-guidelines-6NjpzS6b.js +0 -117
  160. package/standalone/chunks/item-option-panel-VxvWU56c.js +0 -298
  161. package/standalone/chunks/item-option-slider-l9wt7_0c.js +0 -15
@@ -1,261 +0,0 @@
1
- /*! * A kit of modern Luzmo Web Components for analytics in your web application.
2
- *
3
- * Copyright © 2026 Luzmo
4
- * All rights reserved.
5
- * Luzmo web components (“Luzmo Web Components”)
6
- * must be used according to the Luzmo Terms of Service.
7
- * This license allows users with a current active Luzmo account
8
- * to use the Luzmo Web Components. This license terminates
9
- * automatically if a user no longer has an active Luzmo account.
10
- * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
11
- *
12
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
- * SOFTWARE.
19
- * */
20
- require("./tokens-BWMfo_w4.cjs");const e=require("./base-CGDNY_7v.cjs"),t=require("./decorate-DCJt-2rt.cjs"),n=require("./localized-mixin-EoNvtTBG.cjs"),r=require("./chart-helpers-ufZ6VbXs.cjs"),i=require("./create-lazy-loader-DYPgQh0L.cjs");let a=require("@luzmo/icons");require("@luzmo/lucero/action-button"),require("@luzmo/lucero/icon"),require("@luzmo/lucero/overlay"),require("@luzmo/lucero/popover");let o=require("lit"),s=require("lit/decorators.js"),c=require("@lit/localize");require("@luzmo/embed"),require("@luzmo/lucero/action-group"),require("@luzmo/lucero/field-label"),require("@luzmo/lucero/number-field"),require("@luzmo/lucero/picker"),require("@luzmo/lucero/progress-circle"),require("@luzmo/lucero/tabs");var l=`:host{box-sizing:border-box;display:block;container-type:inline-size}.answer{width:100%;display:block}.chart-actions-bar{justify-content:space-between;align-items:flex-start;gap:var(--luzmo-interactive-viz-item-actions-gap,var(--interactive-viz-item-actions-gap));padding-block:var(--luzmo-interactive-viz-item-actions-padding-block,var(--interactive-viz-item-actions-padding-block));flex-wrap:nowrap;margin-block-start:var(--luzmo-interactive-viz-item-actions-margin-block-start,var(--interactive-viz-item-actions-margin-block-start));display:flex}.chart-actions-primary{gap:var(--luzmo-interactive-viz-item-actions-gap,var(--interactive-viz-item-actions-gap));flex-wrap:wrap;flex:1;align-items:center;min-width:0;display:flex}.ranking-content{gap:var(--luzmo-spacing-3);padding:var(--luzmo-spacing-3);flex-direction:column;display:flex}.ranking-row{gap:var(--luzmo-spacing-3);align-items:center;display:flex}.ranking-number{width:4rem}.icon-flipped{transform:scaleY(-1)}.chart-container{border-radius:var(--luzmo-interactive-viz-item-chart-border-radius,var(--interactive-viz-item-chart-border-radius));height:var(--luzmo-interactive-viz-item-chart-height,var(--interactive-viz-item-chart-height));overflow:hidden}.chart-container luzmo-embed-viz-item{width:100%;height:100%;display:block}.feedback-row{padding-block:var(--luzmo-interactive-viz-item-feedback-padding-block,var(--interactive-viz-item-feedback-padding-block));justify-content:space-between;align-items:center;display:flex}.rating-btn-positive{--luzmo-action-button-content-color-default-selected:var(--luzmo-interactive-viz-item-rating-positive-color,var(--interactive-viz-item-rating-positive-color));--luzmo-action-button-content-color-hover-selected:var(--luzmo-interactive-viz-item-rating-positive-color,var(--interactive-viz-item-rating-positive-color));--luzmo-action-button-content-color-down-selected:var(--luzmo-interactive-viz-item-rating-positive-color,var(--interactive-viz-item-rating-positive-color));--luzmo-action-button-content-color-focus-selected:var(--luzmo-interactive-viz-item-rating-positive-color,var(--interactive-viz-item-rating-positive-color));--luzmo-action-button-background-color-default-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-hover-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-down-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-focus-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background))}.rating-btn-negative{--luzmo-action-button-content-color-default-selected:var(--luzmo-interactive-viz-item-rating-negative-color,var(--interactive-viz-item-rating-negative-color));--luzmo-action-button-content-color-hover-selected:var(--luzmo-interactive-viz-item-rating-negative-color,var(--interactive-viz-item-rating-negative-color));--luzmo-action-button-content-color-down-selected:var(--luzmo-interactive-viz-item-rating-negative-color,var(--interactive-viz-item-rating-negative-color));--luzmo-action-button-content-color-focus-selected:var(--luzmo-interactive-viz-item-rating-negative-color,var(--interactive-viz-item-rating-negative-color));--luzmo-action-button-background-color-default-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-hover-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-down-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background));--luzmo-action-button-background-color-focus-selected:var(--luzmo-interactive-viz-item-rating-selected-background,var(--interactive-viz-item-rating-selected-background))}.config-toggle{--luzmo-action-button-border-radius:32px;margin-inline-start:auto}.sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.config-panel{border:1px solid var(--luzmo-interactive-viz-item-config-panel-border-color,var(--interactive-viz-item-config-panel-border-color));border-radius:var(--luzmo-interactive-viz-item-config-panel-border-radius,var(--interactive-viz-item-config-panel-border-radius));padding:var(--luzmo-interactive-viz-item-config-panel-padding,var(--interactive-viz-item-config-panel-padding));background:var(--luzmo-interactive-viz-item-config-panel-background,var(--interactive-viz-item-config-panel-background));margin-block-start:var(--luzmo-spacing-2)}.config-panel luzmo-tab-panel[selected]{padding-block-start:var(--luzmo-spacing-4);display:block}.config-panel luzmo-item-option-panel,.config-panel luzmo-item-slot-picker-panel,.config-panel luzmo-filters{width:100%;max-height:15rem;scrollbar-width:thin;scrollbar-color:var(--luzmo-interactive-viz-item-config-panel-border-color,var(--interactive-viz-item-config-panel-border-color)) transparent;padding-inline-end:var(--luzmo-spacing-3);overflow-y:auto}.edit-grid{min-height:12.5rem;display:flex}.edit-column{gap:var(--luzmo-spacing-3);flex-direction:column;display:flex}.edit-column:first-child{flex-shrink:0;max-width:15rem}.edit-column-filters{border-inline-start:1px solid var(--luzmo-interactive-viz-item-config-panel-border-color,var(--interactive-viz-item-config-panel-border-color));flex:1;min-width:18.75rem;padding-inline-start:var(--luzmo-spacing-5)}@container (width<=520px){.edit-grid{flex-direction:column}.edit-column,.edit-column:first-child{width:100%;min-width:0;max-width:100%}.edit-column-filters{border-inline-start:none;border-block-start:1px solid var(--luzmo-interactive-viz-item-config-panel-border-color,var(--interactive-viz-item-config-panel-border-color));min-width:0;margin-block-start:var(--luzmo-spacing-3);padding-block-start:var(--luzmo-spacing-4);padding-inline-start:0}}@container (width<=768px){.chart-container{height:calc(var(--luzmo-interactive-viz-item-chart-height,var(--interactive-viz-item-chart-height)) - var(--luzmo-interactive-viz-item-chart-narrow-offset,var(--interactive-viz-item-chart-narrow-offset)))}}:host{--interactive-viz-item-actions-gap:var(--luzmo-spacing-3);--interactive-viz-item-actions-padding-block:var(--luzmo-spacing-3);--interactive-viz-item-actions-margin-block-start:var(--luzmo-spacing-5);--interactive-viz-item-chart-height:20rem;--interactive-viz-item-chart-narrow-offset:2.5rem;--interactive-viz-item-chart-border-radius:var(--luzmo-border-radius);--interactive-viz-item-feedback-padding-block:var(--luzmo-spacing-4);--interactive-viz-item-config-panel-padding:var(--luzmo-spacing-5);--interactive-viz-item-config-panel-border-color:var(--luzmo-border-color);--interactive-viz-item-config-panel-border-radius:var(--luzmo-border-radius);--interactive-viz-item-config-panel-background:var(--luzmo-background-color);--interactive-viz-item-rating-positive-color:var(--luzmo-positive-color,#12855a);--interactive-viz-item-rating-negative-color:var(--luzmo-negative-color,#ca221c);--interactive-viz-item-rating-selected-background:var(--luzmo-background-color-focus,#0000000f)}:host([size=s]){--interactive-viz-item-chart-height:17.5rem}:host([size=l]){--interactive-viz-item-chart-height:22rem}:host([size=xl]){--interactive-viz-item-chart-height:24rem}`,u=i.t(()=>Promise.resolve().then(()=>require("./add-to-dashboard/index.cjs"))).load,d=[`luzmo-filters`,`luzmo-item-option-panel`,`luzmo-item-slot-picker-panel`],f=i.t(()=>Promise.all([Promise.resolve().then(()=>require("./filters/index.cjs")),Promise.resolve().then(()=>require("./item-option-panel/index.cjs")),Promise.resolve().then(()=>require("./item-slot-picker-panel/index.cjs"))])),p=f.load,m=()=>f.isLoaded()||d.every(e=>customElements.get(e)!==void 0),h=0,g=class extends n.t(e.n(e.i,{validSizes:Object.values(e.t)})){constructor(...e){super(...e),this.chart=null,this.feedback=null,this.messageId=``,this.authKey=``,this.authToken=``,this.apiUrl=`https://api.luzmo.com`,this.appServer=`https://app.luzmo.com`,this.contentLanguage=``,this.hideActions=!1,this.hideFeedback=!1,this.hideConfigPanel=!1,this.addToDashboard=!1,this.dashboardActions=null,this.controlled=!1,this._configPanelOpen=!1,this._configPanelPending=!1,this._configPanelLoadFailed=!1,this._rankingTriggerId=`interactive-viz-item-ranking-${++h}`,this._handleSlotsChanged=e=>{this.chart&&this._emitChart({...this.chart,slots:e.detail.slotsContents})},this._handleFiltersChanged=e=>{this.chart&&this._emitChart({...this.chart,filters:e.detail.filters})},this._handleOptionsChanged=e=>{if(!this.chart)return;let t=e.detail.options;if(!t)return;let n=this.chart.options.theme??{};this._emitChart({...this.chart,options:{...t,theme:{...n}}})}}static get styles(){return[(0,o.unsafeCSS)(l)]}get _effectiveContentLanguage(){return this.contentLanguage||this.language}_dispatch(e,t){let n=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0});this.dispatchEvent(n)}get _chartActions(){return this.chart?r.n(r.o(this.chart)):[]}get _rating(){return this.feedback?.rating??0}get _canShowConfigPanel(){return!!this.chart&&!this.hideConfigPanel}async _toggleConfigPanel(){if(this._configPanelLoadFailed=!1,this._configPanelOpen)this._configPanelOpen=!1;else if(!this._configPanelPending){if(!m()){this._configPanelPending=!0;try{await p()}catch(e){console.warn(`Failed to load the chart configuration panel:`,e),this._configPanelLoadFailed=!0;return}finally{this._configPanelPending=!1}}this.isConnected&&this._canShowConfigPanel&&(this._configPanelOpen=!0)}}willUpdate(e){super.willUpdate(e),e.has(`addToDashboard`)&&this.addToDashboard&&u().catch(e=>console.warn(`Failed to load add to dashboard:`,e))}_emitOptions(e){!this.controlled&&this.chart&&(this.chart={...this.chart,options:e}),this._dispatch(`luzmo-chart-options-changed`,{options:e})}_emitChart(e){this.controlled||(this.chart=e),this._dispatch(`luzmo-chart-changed`,{chart:e})}_handleDropdownChange(e,t){if(!this.chart)return;t.stopPropagation();let n=t.detail,i=typeof n==`string`?n:n?.value??t.target?.value;if(!i)return;let a=r.t({...r.o(this.chart),options:this.chart.options},{type:`chartAction`,actionType:e.mutationType,key:i});this._emitOptions(a.options)}_currentRanking(e){return e.ranking??{active:!1,number:5,direction:r.c.Top}}_currentSort(e){return e.sort??{direction:r.u.Desc,by:r.l.Measure}}_emitRankAndSort(e,t){this.chart&&this._emitOptions({...this.chart.options,ranking:e,sort:t})}_renderOptionDropdown(e){let t=e.values??[],n=e.currentValue||t[0]?.key||``;return o.html`
21
- <luzmo-picker
22
- size=${this.size}
23
- variant="highlight"
24
- value=${n}
25
- @change=${t=>this._handleDropdownChange(e,t)}
26
- >
27
- ${t.map(e=>o.html`<luzmo-menu-item value=${e.key}>${e.label}</luzmo-menu-item>`)}
28
- </luzmo-picker>
29
- `}_renderRankingPicker(e){let t=this._currentRanking(e),n=this._currentSort(e);if(!t.active)return o.html`
30
- <luzmo-action-button
31
- size=${this.size}
32
- @click=${()=>this._emitRankAndSort({active:!0,number:5,direction:r.c.Top},n)}
33
- >
34
- <luzmo-icon slot="icon" size="xs" .icon=${a.luzmoAlignLeft}></luzmo-icon>
35
- ${(0,c.msg)(`Show top 5`,{desc:`Label to activate top-N ranking on a chart`})}
36
- </luzmo-action-button>
37
- `;let i=t.direction===r.c.Bottom?(0,c.msg)(`Bottom`,{desc:`Ranking direction: keep the lowest values`}):(0,c.msg)(`Top`,{desc:`Ranking direction: keep the highest values`});return o.html`
38
- <luzmo-action-button size=${this.size} id=${this._rankingTriggerId}>
39
- <luzmo-icon slot="icon" size="xs" .icon=${a.luzmoAlignLeft}></luzmo-icon>
40
- ${i} ${t.number||5}
41
- </luzmo-action-button>
42
-
43
- <luzmo-overlay type="auto" placement="bottom-start" trigger=${`${this._rankingTriggerId}@click`}>
44
- <luzmo-popover>
45
- <div class="ranking-content">
46
- <div class="ranking-row">
47
- <luzmo-action-group
48
- size=${this.size}
49
- compact
50
- selects="single"
51
- .selected=${[t.direction]}
52
- @change=${t=>this._handleDirectionChange(e,t)}
53
- >
54
- <luzmo-action-button value="top" emphasized
55
- >${(0,c.msg)(`Top`,{desc:`Ranking direction: keep the highest values`})}</luzmo-action-button
56
- >
57
- <luzmo-action-button value="bottom" emphasized
58
- >${(0,c.msg)(`Bottom`,{desc:`Ranking direction: keep the lowest values`})}</luzmo-action-button
59
- >
60
- </luzmo-action-group>
61
-
62
- <luzmo-number-field
63
- class="ranking-number"
64
- size=${this.size}
65
- hide-stepper
66
- min="1"
67
- max="100"
68
- step="1"
69
- .value=${t.number}
70
- @change=${t=>this._handleNumberChange(e,t)}
71
- @input=${t=>this._handleNumberChange(e,t)}
72
- ></luzmo-number-field>
73
- </div>
74
-
75
- <div class="ranking-row">
76
- <luzmo-action-group
77
- size=${this.size}
78
- compact
79
- selects="single"
80
- .selected=${[n.by]}
81
- @change=${t=>this._handleSortByChange(e,t)}
82
- >
83
- <luzmo-action-button value="measure" emphasized>123</luzmo-action-button>
84
- <luzmo-action-button value="category" emphasized>ABC</luzmo-action-button>
85
- </luzmo-action-group>
86
-
87
- <luzmo-action-group
88
- size=${this.size}
89
- compact
90
- selects="single"
91
- .selected=${[n.direction]}
92
- @change=${t=>this._handleSortDirectionChange(e,t)}
93
- >
94
- <luzmo-action-button
95
- value="desc"
96
- emphasized
97
- label=${(0,c.msg)(`Sort descending`,{desc:`Sort chart values in descending order`})}
98
- >
99
- <luzmo-icon slot="icon" size="xs" .icon=${a.luzmoAlignLeft}></luzmo-icon>
100
- </luzmo-action-button>
101
- <luzmo-action-button
102
- value="asc"
103
- emphasized
104
- label=${(0,c.msg)(`Sort ascending`,{desc:`Sort chart values in ascending order`})}
105
- >
106
- <luzmo-icon slot="icon" size="xs" class="icon-flipped" .icon=${a.luzmoAlignLeft}></luzmo-icon>
107
- </luzmo-action-button>
108
- </luzmo-action-group>
109
- </div>
110
- </div>
111
- </luzmo-popover>
112
- </luzmo-overlay>
113
- `}_handleDirectionChange(e,t){t.stopPropagation();let n=t.target?.selected;n?.length&&this._emitRankAndSort({...this._currentRanking(e),direction:n[0]},this._currentSort(e))}_handleNumberChange(e,t){t.stopPropagation();let n=t.target?.value,r=typeof n==`number`?n:Number.parseInt(String(n),10);!Number.isNaN(r)&&r>=1&&this._emitRankAndSort({...this._currentRanking(e),number:r},this._currentSort(e))}_handleSortByChange(e,t){t.stopPropagation();let n=t.target?.selected;n?.length&&this._emitRankAndSort(this._currentRanking(e),{...this._currentSort(e),by:n[0]})}_handleSortDirectionChange(e,t){t.stopPropagation();let n=t.target?.selected;n?.length&&this._emitRankAndSort(this._currentRanking(e),{...this._currentSort(e),direction:n[0]})}_renderAddToDashboard(){return this.addToDashboard?o.html`
114
- <luzmo-add-to-dashboard
115
- size=${this.size}
116
- language=${this.language}
117
- .chart=${this.chart}
118
- .dashboardActions=${this.dashboardActions}
119
- .authKey=${this.authKey}
120
- .authToken=${this.authToken}
121
- .apiUrl=${this.apiUrl}
122
- ></luzmo-add-to-dashboard>
123
- `:o.nothing}_renderActions(){return this.hideActions?o.html`
124
- <div class="chart-actions-bar">
125
- <div class="chart-actions-primary"></div>
126
- <slot name="chart-actions-extra"></slot>
127
- ${this._renderAddToDashboard()}
128
- </div>
129
- `:o.html`
130
- <div class="chart-actions-bar">
131
- <div class="chart-actions-primary">
132
- ${this._chartActions.map(e=>e.type===`optionDropdown`?this._renderOptionDropdown(e):this._renderRankingPicker(e))}
133
- </div>
134
- <slot name="chart-actions-extra"></slot>
135
- ${this._renderAddToDashboard()}
136
- </div>
137
- `}_renderChart(){if(!this.chart)return o.nothing;let e=r.o(this.chart);return o.html`
138
- <div class="chart-container" part="chart-container">
139
- <luzmo-embed-viz-item
140
- .type=${e.type}
141
- .options=${e.options}
142
- .slots=${e.slots}
143
- .filters=${e.filters??[]}
144
- .authKey=${this.authKey}
145
- .authToken=${this.authToken}
146
- .apiHost=${this.apiUrl}
147
- .appServer=${this.appServer}
148
- .language=${this._effectiveContentLanguage}
149
- .canFilter=${this.canFilter??!1}
150
- ></luzmo-embed-viz-item>
151
- </div>
152
- `}_renderFeedback(){let e=!this.hideFeedback&&!!this.messageId,t=this._canShowConfigPanel,n=(0,c.msg)(`Loading`,{desc:`Loading spinner label`});return!e&&!t?o.nothing:o.html`
153
- <div class="feedback-row">
154
- ${e?o.html`
155
- <luzmo-action-group quiet size=${this.size}>
156
- <luzmo-action-button
157
- class="rating-btn-positive"
158
- value="positive"
159
- quiet
160
- label=${(0,c.msg)(`Good response`,{desc:`Accessible label for the positive feedback button`})}
161
- ?selected=${this._rating===1}
162
- @click=${()=>this._toggleRating(!0)}
163
- >
164
- <luzmo-icon slot="icon" size="s" .icon=${a.luzmoThumbsUp}></luzmo-icon>
165
- </luzmo-action-button>
166
- <luzmo-action-button
167
- class="rating-btn-negative"
168
- value="negative"
169
- quiet
170
- label=${(0,c.msg)(`Bad response`,{desc:`Accessible label for the negative feedback button`})}
171
- ?selected=${this._rating===-1}
172
- @click=${()=>this._toggleRating(!1)}
173
- >
174
- <luzmo-icon slot="icon" size="s" .icon=${a.luzmoThumbsDown}></luzmo-icon>
175
- </luzmo-action-button>
176
- </luzmo-action-group>
177
- `:o.nothing}
178
- ${t?o.html`
179
- <luzmo-action-button
180
- class="config-toggle"
181
- size=${this.size}
182
- quiet
183
- ?selected=${this._configPanelOpen}
184
- aria-expanded=${this._configPanelOpen}
185
- aria-label=${this._configPanelPending?n:(0,c.msg)(`Configure chart`,{desc:`Accessible label for the chart config toggle`})}
186
- @click=${()=>this._toggleConfigPanel()}
187
- >
188
- ${this._configPanelPending?o.html`<luzmo-progress-circle slot="icon" size="s" indeterminate .label=${n}></luzmo-progress-circle>`:o.html`<luzmo-icon slot="icon" size="s" .icon=${a.luzmoInfoCircle}></luzmo-icon>`}
189
- </luzmo-action-button>
190
- <span class="sr-only" role="status" aria-live="polite">${this._configPanelPending?n:``}</span>
191
- <span class="sr-only" role="alert">${this._configPanelLoadFailed?(0,c.msg)(`Failed to load the chart configuration. Please try again.`,{desc:`Error message when the chart config panel fails to load`}):``}</span>
192
- `:o.nothing}
193
- </div>
194
- `}_toggleRating(e){let t=e?1:-1,n=this._rating===t?0:t;this._dispatch(`luzmo-feedback-changed`,{rating:n,comment:this.feedback?.comment})}_renderConfigPanel(){if(!this.chart||this.hideConfigPanel||!this._configPanelOpen)return o.nothing;let e=this.chart,t=r.r(e.slots??[]),n=r.i(t),i=e.options.theme??{};return o.html`
195
- <div class="config-panel" part="config-panel">
196
- <luzmo-tabs selected="data" size=${this.size}>
197
- <luzmo-tab value="data">${(0,c.msg)(`Data`,{desc:`Label for the data section`})}</luzmo-tab>
198
- <luzmo-tab value="options">${(0,c.msg)(`Options`,{desc:`Label for the options section`})}</luzmo-tab>
199
-
200
- <luzmo-tab-panel value="data">
201
- <div class="edit-grid">
202
- <div class="edit-column">
203
- <luzmo-item-slot-picker-panel
204
- size=${this.size}
205
- slot-menu-placement="bottom-end"
206
- .itemType=${e.type}
207
- .slotsContents=${t}
208
- .datasetIds=${n}
209
- .authKey=${this.authKey}
210
- .authToken=${this.authToken}
211
- .apiUrl=${this.apiUrl}
212
- .language=${this.language}
213
- .contentLanguage=${this._effectiveContentLanguage}
214
- @luzmo-slots-contents-changed=${this._handleSlotsChanged}
215
- ></luzmo-item-slot-picker-panel>
216
- </div>
217
- <div class="edit-column edit-column-filters">
218
- <luzmo-field-label size=${this.size}
219
- >${(0,c.msg)(`Filters`,{desc:`Label for the filters section`})}</luzmo-field-label
220
- >
221
- <luzmo-filters
222
- size=${this.size}
223
- .datasetIds=${n}
224
- .filters=${e.filters??[]}
225
- .authKey=${this.authKey}
226
- .authToken=${this.authToken}
227
- .apiUrl=${this.apiUrl}
228
- .language=${this.language}
229
- .contentLanguage=${this._effectiveContentLanguage}
230
- @luzmo-filters-changed=${this._handleFiltersChanged}
231
- ></luzmo-filters>
232
- </div>
233
- </div>
234
- </luzmo-tab-panel>
235
-
236
- <luzmo-tab-panel value="options">
237
- <luzmo-item-option-panel
238
- size=${this.size}
239
- .itemType=${e.type}
240
- .options=${e.options||{}}
241
- .slots=${t}
242
- .theme=${i}
243
- .authKey=${this.authKey}
244
- .authToken=${this.authToken}
245
- .apiUrl=${this.apiUrl}
246
- .language=${this.language}
247
- @luzmo-options-changed=${this._handleOptionsChanged}
248
- ></luzmo-item-option-panel>
249
- </luzmo-tab-panel>
250
- </luzmo-tabs>
251
- </div>
252
- `}render(){return this.chart?o.html`
253
- <div class="answer" part="container">
254
- ${this._renderActions()} ${this._renderChart()} ${this._renderFeedback()} ${this._renderConfigPanel()}
255
- </div>
256
- `:o.html`
257
- <div
258
- class="answer"
259
- part="container"
260
- ></div>
261
- `}};t.t([(0,s.property)({type:Object})],g.prototype,`chart`,void 0),t.t([(0,s.property)({type:Object})],g.prototype,`feedback`,void 0),t.t([(0,s.property)({type:String,attribute:`message-id`})],g.prototype,`messageId`,void 0),t.t([(0,s.property)({type:String,attribute:`auth-key`})],g.prototype,`authKey`,void 0),t.t([(0,s.property)({type:String,attribute:`auth-token`})],g.prototype,`authToken`,void 0),t.t([(0,s.property)({type:String,attribute:`api-url`})],g.prototype,`apiUrl`,void 0),t.t([(0,s.property)({type:String,attribute:`app-server`})],g.prototype,`appServer`,void 0),t.t([(0,s.property)({type:String,attribute:`content-language`})],g.prototype,`contentLanguage`,void 0),t.t([(0,s.property)({type:Boolean,attribute:`hide-actions`,reflect:!0})],g.prototype,`hideActions`,void 0),t.t([(0,s.property)({type:Boolean,attribute:`hide-feedback`,reflect:!0})],g.prototype,`hideFeedback`,void 0),t.t([(0,s.property)({type:Boolean,attribute:`hide-config-panel`,reflect:!0})],g.prototype,`hideConfigPanel`,void 0),t.t([(0,s.property)({type:Boolean,attribute:`add-to-dashboard`,reflect:!0})],g.prototype,`addToDashboard`,void 0),t.t([(0,s.property)({attribute:!1})],g.prototype,`dashboardActions`,void 0),t.t([(0,s.property)({type:Boolean,reflect:!0})],g.prototype,`controlled`,void 0),t.t([(0,s.property)({attribute:`can-filter`,converter:{fromAttribute:e=>e===null?void 0:`all`}})],g.prototype,`canFilter`,void 0),t.t([(0,s.state)()],g.prototype,`_configPanelOpen`,void 0),t.t([(0,s.state)()],g.prototype,`_configPanelPending`,void 0),t.t([(0,s.state)()],g.prototype,`_configPanelLoadFailed`,void 0),customElements.get(`luzmo-interactive-viz-item`)||customElements.define(`luzmo-interactive-viz-item`,g),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return g}});