@limetech/lime-elements 37.66.1 → 37.68.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.
Files changed (127) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/limel-action-bar_4.cjs.entry.js +1 -1
  4. package/dist/cjs/limel-callout.cjs.entry.js +1 -1
  5. package/dist/cjs/limel-chart.cjs.entry.js +216 -0
  6. package/dist/cjs/limel-chart.cjs.entry.js.map +1 -0
  7. package/dist/cjs/limel-chip_2.cjs.entry.js +1 -1
  8. package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
  9. package/dist/cjs/limel-file.cjs.entry.js +1 -1
  10. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
  11. package/dist/cjs/limel-icon.cjs.entry.js +208 -0
  12. package/dist/cjs/limel-icon.cjs.entry.js.map +1 -0
  13. package/dist/cjs/limel-linear-progress.cjs.entry.js +1 -1
  14. package/dist/cjs/{limel-icon_2.cjs.entry.js → limel-portal.cjs.entry.js} +1 -201
  15. package/dist/cjs/limel-portal.cjs.entry.js.map +1 -0
  16. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1472 -10
  17. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
  18. package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
  19. package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/{translations-6c4447f4.js → translations-9ccca4b6.js} +9 -1
  22. package/dist/cjs/translations-9ccca4b6.js.map +1 -0
  23. package/dist/collection/collection-manifest.json +1 -0
  24. package/dist/collection/components/chart/chart.css +758 -0
  25. package/dist/collection/components/chart/chart.js +418 -0
  26. package/dist/collection/components/chart/chart.js.map +1 -0
  27. package/dist/collection/components/chart/chart.types.js +2 -0
  28. package/dist/collection/components/chart/chart.types.js.map +1 -0
  29. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/table-plugin.js +27 -0
  30. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/table-plugin.js.map +1 -0
  31. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +5 -0
  32. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
  33. package/dist/collection/components/text-editor/text-editor.js +1 -0
  34. package/dist/collection/components/text-editor/text-editor.js.map +1 -1
  35. package/dist/collection/style/mixins.scss +16 -0
  36. package/dist/collection/translations/da.js +1 -0
  37. package/dist/collection/translations/da.js.map +1 -1
  38. package/dist/collection/translations/de.js +1 -0
  39. package/dist/collection/translations/de.js.map +1 -1
  40. package/dist/collection/translations/en.js +1 -0
  41. package/dist/collection/translations/en.js.map +1 -1
  42. package/dist/collection/translations/fi.js +1 -0
  43. package/dist/collection/translations/fi.js.map +1 -1
  44. package/dist/collection/translations/fr.js +1 -0
  45. package/dist/collection/translations/fr.js.map +1 -1
  46. package/dist/collection/translations/nl.js +1 -0
  47. package/dist/collection/translations/nl.js.map +1 -1
  48. package/dist/collection/translations/no.js +1 -0
  49. package/dist/collection/translations/no.js.map +1 -1
  50. package/dist/collection/translations/sv.js +1 -0
  51. package/dist/collection/translations/sv.js.map +1 -1
  52. package/dist/esm/lime-elements.js +1 -1
  53. package/dist/esm/limel-action-bar_4.entry.js +1 -1
  54. package/dist/esm/limel-callout.entry.js +1 -1
  55. package/dist/esm/limel-chart.entry.js +212 -0
  56. package/dist/esm/limel-chart.entry.js.map +1 -0
  57. package/dist/esm/limel-chip_2.entry.js +1 -1
  58. package/dist/esm/limel-file-viewer.entry.js +1 -1
  59. package/dist/esm/limel-file.entry.js +1 -1
  60. package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
  61. package/dist/esm/limel-icon.entry.js +204 -0
  62. package/dist/esm/limel-icon.entry.js.map +1 -0
  63. package/dist/esm/limel-linear-progress.entry.js +1 -1
  64. package/dist/esm/{limel-icon_2.entry.js → limel-portal.entry.js} +2 -201
  65. package/dist/esm/limel-portal.entry.js.map +1 -0
  66. package/dist/esm/limel-prosemirror-adapter.entry.js +1472 -10
  67. package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
  68. package/dist/esm/limel-snackbar.entry.js +1 -1
  69. package/dist/esm/limel-text-editor.entry.js.map +1 -1
  70. package/dist/esm/loader.js +1 -1
  71. package/dist/esm/{translations-26583a3b.js → translations-453e0db7.js} +9 -1
  72. package/dist/esm/translations-453e0db7.js.map +1 -0
  73. package/dist/lime-elements/lime-elements.esm.js +1 -1
  74. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  75. package/dist/lime-elements/{p-5d12d8d2.entry.js → p-0ee1d461.entry.js} +2 -2
  76. package/dist/lime-elements/{p-195df464.entry.js → p-1e99b371.entry.js} +2 -2
  77. package/dist/lime-elements/{p-4fd0ac1e.entry.js → p-2cbfe8f9.entry.js} +2 -2
  78. package/dist/lime-elements/{p-adfa2c05.entry.js → p-3fcb2b67.entry.js} +2 -2
  79. package/dist/lime-elements/{p-1a0aaf41.entry.js → p-488decb0.entry.js} +2 -2
  80. package/dist/lime-elements/{p-61047574.entry.js → p-589ba37a.entry.js} +2 -2
  81. package/dist/lime-elements/p-5d08ef7d.entry.js +2 -0
  82. package/dist/lime-elements/p-5d08ef7d.entry.js.map +1 -0
  83. package/dist/lime-elements/p-8915fa60.js +2 -0
  84. package/dist/lime-elements/p-8915fa60.js.map +1 -0
  85. package/dist/lime-elements/p-8d388c5c.entry.js.map +1 -1
  86. package/dist/lime-elements/p-9d2f6454.entry.js +2 -0
  87. package/dist/lime-elements/p-9d2f6454.entry.js.map +1 -0
  88. package/dist/lime-elements/{p-03eea223.entry.js → p-a451cece.entry.js} +2 -2
  89. package/dist/lime-elements/p-d696f6b8.entry.js +2 -0
  90. package/dist/lime-elements/p-d696f6b8.entry.js.map +1 -0
  91. package/dist/lime-elements/p-d93f1964.entry.js +2 -0
  92. package/dist/lime-elements/p-d93f1964.entry.js.map +1 -0
  93. package/dist/lime-elements/{p-0f484317.entry.js → p-dd031410.entry.js} +2 -2
  94. package/dist/lime-elements/style/mixins.scss +16 -0
  95. package/dist/scss/mixins.scss +16 -0
  96. package/dist/types/components/chart/chart.d.ts +94 -0
  97. package/dist/types/components/chart/chart.types.d.ts +25 -0
  98. package/dist/types/components/text-editor/prosemirror-adapter/plugins/table-plugin.d.ts +4 -0
  99. package/dist/types/components/text-editor/text-editor.d.ts +1 -0
  100. package/dist/types/components.d.ts +207 -0
  101. package/dist/types/translations/da.d.ts +1 -0
  102. package/dist/types/translations/de.d.ts +1 -0
  103. package/dist/types/translations/en.d.ts +1 -0
  104. package/dist/types/translations/fi.d.ts +1 -0
  105. package/dist/types/translations/fr.d.ts +1 -0
  106. package/dist/types/translations/nl.d.ts +1 -0
  107. package/dist/types/translations/no.d.ts +1 -0
  108. package/dist/types/translations/sv.d.ts +1 -0
  109. package/package.json +2 -1
  110. package/dist/cjs/limel-icon_2.cjs.entry.js.map +0 -1
  111. package/dist/cjs/translations-6c4447f4.js.map +0 -1
  112. package/dist/esm/limel-icon_2.entry.js.map +0 -1
  113. package/dist/esm/translations-26583a3b.js.map +0 -1
  114. package/dist/lime-elements/p-975f1ee3.entry.js +0 -2
  115. package/dist/lime-elements/p-975f1ee3.entry.js.map +0 -1
  116. package/dist/lime-elements/p-e78fcffb.entry.js +0 -2
  117. package/dist/lime-elements/p-e78fcffb.entry.js.map +0 -1
  118. package/dist/lime-elements/p-fe15bcbb.js +0 -2
  119. package/dist/lime-elements/p-fe15bcbb.js.map +0 -1
  120. /package/dist/lime-elements/{p-5d12d8d2.entry.js.map → p-0ee1d461.entry.js.map} +0 -0
  121. /package/dist/lime-elements/{p-195df464.entry.js.map → p-1e99b371.entry.js.map} +0 -0
  122. /package/dist/lime-elements/{p-4fd0ac1e.entry.js.map → p-2cbfe8f9.entry.js.map} +0 -0
  123. /package/dist/lime-elements/{p-adfa2c05.entry.js.map → p-3fcb2b67.entry.js.map} +0 -0
  124. /package/dist/lime-elements/{p-1a0aaf41.entry.js.map → p-488decb0.entry.js.map} +0 -0
  125. /package/dist/lime-elements/{p-61047574.entry.js.map → p-589ba37a.entry.js.map} +0 -0
  126. /package/dist/lime-elements/{p-03eea223.entry.js.map → p-a451cece.entry.js.map} +0 -0
  127. /package/dist/lime-elements/{p-0f484317.entry.js.map → p-dd031410.entry.js.map} +0 -0
@@ -0,0 +1,212 @@
1
+ import { r as registerInstance, h } from './index-6156b4fd.js';
2
+ import { t as translate } from './translations-453e0db7.js';
3
+ import { c as createRandomString } from './random-string-812b1c35.js';
4
+
5
+ const chartCss = "@charset \"UTF-8\";:host(limel-chart){--chart-axis-line-color:var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );box-sizing:border-box;isolation:isolate;display:flex;width:100%;height:100%;min-width:0;min-height:0;padding:var(--limel-chart-padding)}table{all:unset;border-collapse:collapse;border-spacing:0;empty-cells:show;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}table colgroup,table thead,table tbody,table tr,table th,table td{all:unset}table caption,table colgroup,table thead,table tfoot,table th,table td{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}*,*:before,*:after{box-sizing:border-box}.chart{position:relative;flex-grow:1;width:100%;height:100%;min-height:0;min-width:0}.chart:has(.item:hover) .item,.chart:has(.item:focus-visible) .item{opacity:0.4}.item{transition:background-color 0.2s ease, filter 0.2s ease, opacity 0.4s ease;cursor:help}.item:focus-visible,.item:hover{opacity:1 !important}limel-spinner{margin:auto}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart,:host(limel-chart[type=line]) .chart,:host(limel-chart[type=area]) .chart{display:flex;background-color:var(--chart-background-color, transparent)}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item,:host(limel-chart[type=line]) .item,:host(limel-chart[type=area]) .item{position:relative;mix-blend-mode:hard-light}:host(limel-chart[type=bar]) .item:focus,:host(limel-chart[type=dot]) .item:focus,:host(limel-chart[type=line]) .item:focus,:host(limel-chart[type=area]) .item:focus{outline:none}:host(limel-chart[type=bar]) .item:focus-visible,:host(limel-chart[type=dot]) .item:focus-visible,:host(limel-chart[type=line]) .item:focus-visible,:host(limel-chart[type=area]) .item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-chart[type=bar][orientation=landscape]),:host(limel-chart[type=dot][orientation=landscape]),:host(limel-chart[type=line][orientation=landscape]),:host(limel-chart[type=area][orientation=landscape]){--limel-chart-padding:0.5rem 0.5rem 0.5rem 2rem}:host(limel-chart[type=bar][orientation=landscape]) .chart,:host(limel-chart[type=dot][orientation=landscape]) .chart,:host(limel-chart[type=line][orientation=landscape]) .chart,:host(limel-chart[type=area][orientation=landscape]) .chart{flex-direction:row;align-items:flex-end;overflow:auto hidden;padding:0 0.125rem}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item,:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{min-width:0.5rem;width:inherit}:host(limel-chart[type=bar][orientation=portrait]),:host(limel-chart[type=dot][orientation=portrait]),:host(limel-chart[type=line][orientation=portrait]),:host(limel-chart[type=area][orientation=portrait]){--limel-chart-padding:0.5rem 0.5rem 1rem 0.5rem}:host(limel-chart[type=bar][orientation=portrait]) .chart,:host(limel-chart[type=dot][orientation=portrait]) .chart,:host(limel-chart[type=line][orientation=portrait]) .chart,:host(limel-chart[type=area][orientation=portrait]) .chart{flex-direction:column;overflow:hidden auto;padding:0.125rem 0}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item,:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{min-height:0.5rem;height:inherit}:host(limel-chart[type=pie]) table,:host(limel-chart[type=doughnut]) table,:host(limel-chart[type=ring]) table{min-height:2rem;min-width:2rem}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .chart,:host(limel-chart[type=ring]) .item{aspect-ratio:1;display:flex;margin:auto}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=ring]) .chart{justify-content:center;align-items:center}:host(limel-chart[type=pie]) .chart:before,:host(limel-chart[type=doughnut]) .chart:before,:host(limel-chart[type=ring]) .chart:before{aspect-ratio:1;content:\"\";position:absolute;z-index:0;inset:0;margin:auto;border-radius:50%;max-width:100%;max-height:100%;background-color:var(--chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .item{max-width:100%;max-height:100%;border-radius:50%;position:absolute;inset:0}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart{gap:0.5rem}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item{display:flex;align-items:center;justify-content:center;border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=bar]) .item{background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item:before,:host(limel-chart[type=dot]) .item:after{content:\"\";position:absolute;margin:auto;width:0.5rem;height:0.5rem;border-radius:50%}:host(limel-chart[type=dot]) .item::after{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item.has-start-value:before{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item{height:calc(var(--limel-chart-item-size) * 1%);bottom:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=landscape]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=landscape]) .item.has-negative-value-only{height:calc(var(--limel-chart-item-size) * -1%);transform-origin:bottom;transform:rotateX(180deg)}:host(limel-chart[type=dot][orientation=landscape]) .item.has-start-value,:host(limel-chart[type=dot][orientation=landscape]) .item:hover,:host(limel-chart[type=dot][orientation=landscape]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=dot][orientation=landscape]) .item:before{inset:auto 0 0 0;transform:translateY(50%)}:host(limel-chart[type=dot][orientation=landscape]) .item::after{inset:0 0 auto 0;transform:translateY(-50%)}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item{width:calc(var(--limel-chart-item-size) * 1%);left:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=portrait]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=portrait]) .item.has-negative-value-only{width:calc(var(--limel-chart-item-size) * -1%);transform-origin:left;transform:rotateY(180deg)}:host(limel-chart[type=dot][orientation=portrait]) .item.has-start-value,:host(limel-chart[type=dot][orientation=portrait]) .item:hover,:host(limel-chart[type=dot][orientation=portrait]) .item:focus-visible{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/100% 1px no-repeat}:host(limel-chart[type=dot][orientation=portrait]) .item:before{inset:0 auto 0 0;transform:translateX(-50%)}:host(limel-chart[type=dot][orientation=portrait]) .item:after{inset:0 0 0 auto;transform:translateX(50%)}:host(limel-chart[type=area]) .item,:host(limel-chart[type=line]) .item{position:relative}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=line]) .item:after{margin:auto;width:0.5rem;height:0.5rem;border-radius:50%;border:1px solid rgb(var(--contrast-100))}:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:before{inset:0}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:after,:host(limel-chart[type=line]) .item:before{transition:border-color 0.2s ease, opacity 0.4s ease;content:\"\";position:absolute;background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after,:host(limel-chart[type=line]) .item:hover:after,:host(limel-chart[type=line]) .item:focus-visible:after{border-color:transparent}:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{height:100%}:host(limel-chart[type=line][orientation=landscape]) .item:after,:host(limel-chart[type=area][orientation=landscape]) .item:after{transform:translateX(-50%) translateY(50%);left:0;bottom:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{width:100%}:host(limel-chart[type=line][orientation=portrait]) .item:after,:host(limel-chart[type=area][orientation=portrait]) .item:after{transform:translateX(-50%) translateY(-50%);left:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=area]) .item:after{opacity:0}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after{opacity:1}:host(limel-chart[type=area]) .item:hover:before,:host(limel-chart[type=area]) .item:focus-visible:before{opacity:0.7}:host(limel-chart[type=area][orientation=landscape]){}:host(limel-chart[type=area][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - var(--limel-chart-item-offset)) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%), 100% calc((100 - var(--limel-chart-next-item-offset)) * 1%))}:host(limel-chart[type=area][orientation=portrait]){}:host(limel-chart[type=area][orientation=portrait]) .item:before{clip-path:polygon(calc(var(--limel-chart-item-offset) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%, calc(var(--limel-chart-next-item-offset) * 1%) 100%)}:host(limel-chart[type=line]){--limel-chart-line-thickness:0.125rem}:host(limel-chart[type=line]) .item:hover:before{opacity:0.4}:host(limel-chart[type=line][orientation=landscape]){}:host(limel-chart[type=line][orientation=landscape]) .item:hover{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) left/1px 100% no-repeat}:host(limel-chart[type=line][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%))}:host(limel-chart[type=line][orientation=portrait]){}:host(limel-chart[type=line][orientation=portrait]) .item:hover{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) top/100% 1px no-repeat}:host(limel-chart[type=line][orientation=portrait]) .item:before{clip-path:polygon(calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1% + var(--limel-chart-line-thickness)) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1% + var(--limel-chart-line-thickness)) 100%, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%)}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{background:conic-gradient(transparent 0 calc(var(--limel-chart-item-offset) * 1%), var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) calc(var(--limel-chart-item-offset) * 1%) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), transparent calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%))}:host(limel-chart[type=pie]) .item:focus,:host(limel-chart[type=pie]) .item:focus-visible,:host(limel-chart[type=doughnut]) .item:focus,:host(limel-chart[type=doughnut]) .item:focus-visible{outline:none}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{pointer-events:none}:host(limel-chart[type=doughnut]) .chart:after{aspect-ratio:1;content:\"\";position:absolute;inset:0;margin:auto;max-width:60%;max-height:60%;border-radius:50%;background-color:rgb(var(--contrast-100))}:host(limel-chart[type=ring]) .chart:after{content:\"\";position:absolute;inset:0;aspect-ratio:1;border-radius:50%;max-height:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));max-width:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));background-color:var(--limel-chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=ring]) .chart:has(.item:hover) .item,:host(limel-chart[type=ring]) .chart:has(.item:focus-visible) .item{opacity:1;filter:grayscale(1)}:host(limel-chart[type=ring]) .chart:after,:host(limel-chart[type=ring]) .item{margin:auto;border:1px solid var(--limel-chart-background-color, rgb(var(--contrast-400)))}:host(limel-chart[type=ring]) .item{background:conic-gradient(var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) 0 calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), var(--chart-background-color, rgb(var(--contrast-200))) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%));max-width:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1));max-height:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1))}:host(limel-chart[type=ring]) .item:focus{outline:none}:host(limel-chart[type=ring]) .item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-chart[type=ring]) .item:focus-visible,:host(limel-chart[type=ring]) .item:hover{filter:grayscale(0) !important}:host(limel-chart[type=stacked-bar]) .chart{display:flex;border-radius:0.25rem;overflow:hidden;background-color:var(--chart-background-color, rgb(var(--contrast-800), 0.2))}:host(limel-chart[type=stacked-bar]) .item{display:flex;border-radius:var(--chart-item-border-radius, 0);background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=stacked-bar]) .item:focus{outline:none}:host(limel-chart[type=stacked-bar]) .item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-chart[type=stacked-bar]) .item:last-of-type{box-shadow:none !important}:host(limel-chart[type=stacked-bar][orientation=landscape]) .chart{flex-direction:row}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item{min-height:0.5rem;width:calc(var(--limel-chart-item-size) * 1%);box-shadow:-1px 0 0 0 var(--chart-item-divider-color, rgb(var(--color-white), 0.6)) inset}:host(limel-chart[type=stacked-bar][orientation=portrait]) .chart{flex-direction:column-reverse}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item{min-width:0.5rem;height:calc(var(--limel-chart-item-size) * 1%);box-shadow:0 -1px 0 0 rgb(var(--color-white), 0.6) inset}:host(limel-chart[type=nps]){--limel-chart-nps-gauge-angel:220deg}:host(limel-chart[type=nps]) table{min-height:4rem;min-width:4rem}:host(limel-chart[type=nps]) .chart{position:relative;display:flex;justify-content:center;align-items:center;aspect-ratio:1;margin:auto;width:unset;height:unset;max-width:100%;max-height:100%;rotate:calc(var(--limel-chart-nps-gauge-angel) / 2 * -1);transform:translate(-15%, -5%)}:host(limel-chart[type=nps]) .chart:before,:host(limel-chart[type=nps]) .chart:after{content:\"\";aspect-ratio:1;position:absolute;border-radius:50%;z-index:-1;min-height:0;min-width:0}:host(limel-chart[type=nps]) .chart:before{height:100%;max-height:100%;background:conic-gradient(rgb(var(--color-coral-default)) 0deg calc(var(--limel-chart-nps-gauge-angel) / 2), rgb(var(--color-amber-light)) calc(var(--limel-chart-nps-gauge-angel) / 2) calc(var(--limel-chart-nps-gauge-angel) * 0.65), rgb(var(--color-lime-light)) calc(var(--limel-chart-nps-gauge-angel) * 0.65) calc(var(--limel-chart-nps-gauge-angel) * 0.85), rgb(var(--color-lime-default)) calc(var(--limel-chart-nps-gauge-angel) * 0.85) var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .chart:after{height:calc(100% - min(3rem, 20%) * 2);max-height:calc(100% - min(3rem, 20%) * 2);background:conic-gradient(var(--chart-background-color, rgb(var(--contrast-100))) 0deg var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .item{display:flex;align-items:flex-start;justify-content:center;border-radius:0.5rem;position:absolute;height:calc(50% - min(3rem, 20%) + 0.5rem);width:0.5rem;transform:translateY(-50%) rotate(calc((var(--limel-chart-item-value) + 100) / 200 * var(--limel-chart-nps-gauge-angel)));transform-origin:bottom}:host(limel-chart[type=nps]) .item:focus{outline:none}:host(limel-chart[type=nps]) .item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-chart[type=nps]) .item:hover,:host(limel-chart[type=nps]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=nps]) .item:before,:host(limel-chart[type=nps]) .item:after{content:\"\";position:absolute}:host(limel-chart[type=nps]) .item:before{transform:translateY(-60%);width:0.4rem;border-radius:1rem;border-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));border-style:solid;border-bottom-width:1.75rem;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent}:host(limel-chart[type=nps]) .item:after{border-radius:50%;background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));aspect-ratio:1;height:clamp(0.75rem, 10%, 1.25rem);border:0.125rem solid rgb(var(--contrast-100), 0.8);box-shadow:var(--shadow-depth-8)}.axises{position:absolute;display:flex;justify-content:space-between;min-height:100%;min-width:100%;height:100%;width:100%}.axis-line{transition:opacity 0.4s ease;position:relative;opacity:0.2;font-size:0.625rem;border-color:var(--limel-chart-axis-line-color)}.axis-line:hover{opacity:0.6;transition-duration:0.2s}.axis-line.zero-line{opacity:0.6;z-index:1}.axis-line limel-badge{--badge-background-color:transparent;--badge-text-color:currentColor;position:absolute;text-align:right;min-width:2rem}:host(limel-chart[orientation=landscape]) .axises{flex-direction:column-reverse}:host(limel-chart[orientation=landscape]) .axis-line{border-bottom:1px solid;transform:translateY(50%)}:host(limel-chart[orientation=landscape]) .axis-line limel-badge{bottom:0;left:-2rem;transform:translateY(50%)}:host(limel-chart[orientation=portrait]) .axises{flex-direction:row}:host(limel-chart[orientation=portrait]) .axis-line{border-left:1px solid;transform:translateX(-50%)}:host(limel-chart[orientation=portrait]) .axis-line limel-badge{bottom:-1rem;right:-1rem}";
6
+
7
+ const PERCENT = 100;
8
+ const DEFAULT_INCREMENT_SIZE = 10;
9
+ const Chart = class {
10
+ constructor(hostRef) {
11
+ registerInstance(this, hostRef);
12
+ this.language = 'en';
13
+ this.accessibleLabel = undefined;
14
+ this.accessibleItemsLabel = undefined;
15
+ this.items = undefined;
16
+ this.type = 'stacked-bar';
17
+ this.orientation = 'landscape';
18
+ this.maxValue = undefined;
19
+ this.axisIncrement = undefined;
20
+ this.loading = false;
21
+ }
22
+ componentWillLoad() {
23
+ this.recalculateRangeData();
24
+ }
25
+ render() {
26
+ if (this.loading) {
27
+ return h("limel-spinner", { limeBranded: false });
28
+ }
29
+ return (h("table", { "aria-busy": this.loading ? 'true' : 'false', "aria-live": "polite", style: {
30
+ '--limel-chart-number-of-items': this.items.length.toString(),
31
+ } }, this.renderCaption(), this.renderTableHeader(), this.renderAxises(), h("tbody", { class: "chart" }, this.renderItems())));
32
+ }
33
+ renderCaption() {
34
+ if (!this.accessibleLabel) {
35
+ return;
36
+ }
37
+ return h("caption", null, this.accessibleLabel);
38
+ }
39
+ renderTableHeader() {
40
+ return (h("thead", null, h("tr", null, h("th", { scope: "col" }, this.accessibleItemsLabel), h("th", { scope: "col" }, translate.get('value', this.language)))));
41
+ }
42
+ renderAxises() {
43
+ if (!['bar', 'dot', 'area', 'line'].includes(this.type)) {
44
+ return;
45
+ }
46
+ const { minValue, maxValue } = this.range;
47
+ const lines = [];
48
+ const adjustedMinRange = Math.floor(minValue / this.axisIncrement) * this.axisIncrement;
49
+ const adjustedMaxRange = Math.ceil(maxValue / this.axisIncrement) * this.axisIncrement;
50
+ for (let value = adjustedMinRange; value <= adjustedMaxRange; value += this.axisIncrement) {
51
+ lines.push(h("div", { class: {
52
+ 'axis-line': true,
53
+ 'zero-line': value === 0,
54
+ }, role: "presentation" }, h("limel-badge", { label: value })));
55
+ }
56
+ return (h("div", { class: "axises", role: "presentation" }, lines));
57
+ }
58
+ renderItems() {
59
+ var _a;
60
+ if (!((_a = this.items) === null || _a === void 0 ? void 0 : _a.length)) {
61
+ return;
62
+ }
63
+ let cumulativeOffset = 0;
64
+ return this.items.map((item, index) => {
65
+ const itemId = createRandomString();
66
+ const sizeAndOffset = this.calculateSizeAndOffset(item);
67
+ const size = sizeAndOffset.size;
68
+ let offset = sizeAndOffset.offset;
69
+ if (this.type === 'pie' || this.type === 'doughnut') {
70
+ offset = cumulativeOffset;
71
+ cumulativeOffset += size;
72
+ }
73
+ return (h("tr", { style: this.getItemStyle(item, index, size, offset), class: this.getItemClass(item), key: itemId, id: itemId, tabIndex: 0 }, h("th", null, this.getItemText(item)), h("td", null, this.getFormattedValue(item)), this.renderTooltip(item, itemId, size)));
74
+ });
75
+ }
76
+ getItemStyle(item, index, size, offset) {
77
+ const style = {
78
+ '--limel-chart-item-offset': `${offset}`,
79
+ '--limel-chart-item-size': `${size}`,
80
+ '--limel-chart-item-index': `${index}`,
81
+ '--limel-chart-item-value': `${item.value}`,
82
+ };
83
+ if (item.color) {
84
+ style['--limel-chart-item-color'] = item.color;
85
+ }
86
+ if (this.type === 'line' || this.type === 'area') {
87
+ const nextItem = this.calculateSizeAndOffset(this.items[index + 1]);
88
+ style['--limel-chart-next-item-size'] = `${nextItem.size}`;
89
+ style['--limel-chart-next-item-offset'] = `${nextItem.offset}`;
90
+ }
91
+ return style;
92
+ }
93
+ getItemClass(item) {
94
+ return {
95
+ item: true,
96
+ 'has-start-value': Array.isArray(item.value),
97
+ 'has-negative-value-only': this.getMaximumValue(item) < 0 && !this.isRangeItem(item),
98
+ };
99
+ }
100
+ calculateSizeAndOffset(item) {
101
+ const { minValue, totalRange } = this.range;
102
+ if (!item) {
103
+ return {
104
+ size: 0,
105
+ offset: 0,
106
+ };
107
+ }
108
+ let startValue = 0;
109
+ if (this.isRangeItem(item)) {
110
+ startValue = this.getMinimumValue(item);
111
+ }
112
+ const normalizedStart = ((startValue - minValue) / totalRange) * PERCENT;
113
+ const normalizedEnd = ((this.getMaximumValue(item) - minValue) / totalRange) * PERCENT;
114
+ return {
115
+ size: normalizedEnd - normalizedStart,
116
+ offset: normalizedStart,
117
+ };
118
+ }
119
+ getFormattedValue(item) {
120
+ const { value, formattedValue } = item;
121
+ if (formattedValue) {
122
+ return formattedValue;
123
+ }
124
+ if (Array.isArray(value)) {
125
+ return `${value[0]} — ${value[1]}`;
126
+ }
127
+ return `${value}`;
128
+ }
129
+ getItemText(item) {
130
+ return item.text;
131
+ }
132
+ renderTooltip(item, itemId, size) {
133
+ const text = this.getItemText(item);
134
+ const PERCENT_DECIMAL = 2;
135
+ const formattedValue = this.getFormattedValue(item);
136
+ const tooltipProps = {
137
+ label: text,
138
+ helperLabel: formattedValue,
139
+ elementId: itemId,
140
+ };
141
+ if (this.type !== 'bar' && this.type !== 'dot' && this.type !== 'nps') {
142
+ tooltipProps.label = `${text} (${size.toFixed(PERCENT_DECIMAL)}%)`;
143
+ }
144
+ return (h("limel-tooltip", Object.assign({}, tooltipProps, { openDirection: this.orientation === 'portrait' ? 'right' : 'top' })));
145
+ }
146
+ calculateRange() {
147
+ var _a;
148
+ if (this.range) {
149
+ return this.range;
150
+ }
151
+ const minRange = Math.min(0, ...this.items.map(this.getMinimumValue));
152
+ const maxRange = Math.max(...this.items.map(this.getMaximumValue));
153
+ const totalSum = this.items.reduce((sum, item) => sum + this.getMaximumValue(item), 0);
154
+ let finalMaxRange = (_a = this.maxValue) !== null && _a !== void 0 ? _a : maxRange;
155
+ if ((this.type === 'pie' || this.type === 'doughnut') &&
156
+ !this.maxValue) {
157
+ finalMaxRange = totalSum;
158
+ }
159
+ if (!this.axisIncrement) {
160
+ this.axisIncrement = this.calculateAxisIncrement(this.items);
161
+ }
162
+ const visualMaxValue = Math.ceil(finalMaxRange / this.axisIncrement) * this.axisIncrement;
163
+ const visualMinValue = Math.floor(minRange / this.axisIncrement) * this.axisIncrement;
164
+ const totalRange = visualMaxValue - visualMinValue;
165
+ return {
166
+ minValue: visualMinValue,
167
+ maxValue: visualMaxValue,
168
+ totalRange: totalRange,
169
+ };
170
+ }
171
+ calculateAxisIncrement(items, steps = DEFAULT_INCREMENT_SIZE) {
172
+ const maxValue = Math.max(...items.map((item) => {
173
+ const value = item.value;
174
+ if (Array.isArray(value)) {
175
+ return Math.max(...value);
176
+ }
177
+ return value;
178
+ }));
179
+ const roughStep = maxValue / steps;
180
+ // eslint-disable-next-line no-magic-numbers
181
+ const magnitude = 10 ** Math.floor(Math.log10(roughStep));
182
+ return Math.ceil(roughStep / magnitude) * magnitude;
183
+ }
184
+ getMinimumValue(item) {
185
+ const value = item.value;
186
+ return Array.isArray(value) ? Math.min(...value) : value;
187
+ }
188
+ getMaximumValue(item) {
189
+ const value = item.value;
190
+ return Array.isArray(value) ? Math.max(...value) : value;
191
+ }
192
+ isRangeItem(item) {
193
+ return Array.isArray(item.value);
194
+ }
195
+ handleChange() {
196
+ this.range = null;
197
+ this.recalculateRangeData();
198
+ }
199
+ recalculateRangeData() {
200
+ this.range = this.calculateRange();
201
+ }
202
+ static get watchers() { return {
203
+ "items": ["handleChange"],
204
+ "axisIncrement": ["handleChange"],
205
+ "maxValue": ["handleChange"]
206
+ }; }
207
+ };
208
+ Chart.style = chartCss;
209
+
210
+ export { Chart as limel_chart };
211
+
212
+ //# sourceMappingURL=limel-chart.entry.js.map
@@ -0,0 +1 @@
1
+ {"file":"limel-chart.entry.js","mappings":";;;;AAAA,MAAM,QAAQ,GAAG,85mBAA85mB;;ACM/6mB,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,sBAAsB,GAAG,EAAE,CAAC;MAkCrB,KAAK;;;oBAMe,IAAI;;;;gBAoCX,aAAa;uBAOa,WAAW;;;mBAoBjC,KAAK;;EAQxB,iBAAiB;IACpB,IAAI,CAAC,oBAAoB,EAAE,CAAC;GAC/B;EAEM,MAAM;IACT,IAAI,IAAI,CAAC,OAAO,EAAE;MACd,OAAO,qBAAe,WAAW,EAAE,KAAK,GAAI,CAAC;KAChD;IAED,QACI,0BACe,IAAI,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,eAChC,QAAQ,EAClB,KAAK,EAAE;QACH,+BAA+B,EAC3B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;OACnC,IAEA,IAAI,CAAC,aAAa,EAAE,EACpB,IAAI,CAAC,iBAAiB,EAAE,EACxB,IAAI,CAAC,YAAY,EAAE,EACpB,aAAO,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,WAAW,EAAE,CAAS,CAC7C,EACV;GACL;EAEO,aAAa;IACjB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;MACvB,OAAO;KACV;IAED,OAAO,mBAAU,IAAI,CAAC,eAAe,CAAW,CAAC;GACpD;EAEO,iBAAiB;IACrB,QACI,iBACI,cACI,UAAI,KAAK,EAAC,KAAK,IAAE,IAAI,CAAC,oBAAoB,CAAM,EAChD,UAAI,KAAK,EAAC,KAAK,IAAE,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAA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,KAAK,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;OAC7B;MAED,OAAO,KAAK,CAAC;KAChB,CAAC,CACL,CAAC;IAEF,MAAM,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;;IAEnC,MAAM,SAAS,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAE1D,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;GACvD;EAEO,eAAe,CAAC,IAAe;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAEzB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;GAC5D;EAEO,eAAe,CAAC,IAAe;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAEzB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;GAC5D;EAEO,WAAW,CAAC,IAAe;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GACpC;EAKD,YAAY;IACR,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,oBAAoB,EAAE,CAAC;GAC/B;EAEO,oBAAoB;IACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;GACtC;;;;;;;;;;;","names":[],"sources":["./src/components/chart/chart.scss?tag=limel-chart&encapsulation=shadow","./src/components/chart/chart.tsx"],"sourcesContent":["@use '../../style/mixins';\n$min-item-size: 0.5rem;\n$default-item-color: var(--chart-item-color, rgb(var(--contrast-1100), 0.8));\n\n/**\n* @prop --chart-background-color: Defines the background color of the chart. Defaults to `transparent` for _most_ chart types.\n* @prop --chart-item-color: If no color is defined for chart items, this color will be use. Defaults to `rgb(var(--contrast-1100), 0.8)`.\n* @prop --chart-item-divider-color: Defines the color that visually separates items in some charts, such as `stacked-bar` chart items. Defaults to `rgb(var(--color-white), 0.6)`.\n* @prop --chart-axis-line-color: Defines color of the axis lines. Defaults to `--contrast-900`. Note that lines have opacity as well, and get opaque on hover.\n* @prop --chart-item-border-radius: Defines the roundness of corners of items in a chart. Defaults to different values depending on the chart type. Does not have any effect on `pie` and `doughnut` types.\n*/\n\n:host(limel-chart) {\n --chart-axis-line-color: var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );\n box-sizing: border-box;\n isolation: isolate;\n\n display: flex;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n padding: var(--limel-chart-padding);\n}\n\ntable {\n // Since these are mainly \"resets\", no styles should be before them.\n all: unset;\n border-collapse: collapse;\n border-spacing: 0;\n empty-cells: show;\n\n position: relative;\n display: flex;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n\n colgroup,\n thead,\n tbody,\n tr,\n th,\n td {\n all: unset;\n }\n\n caption,\n colgroup,\n thead,\n tfoot,\n th,\n td {\n @include mixins.visually-hidden;\n }\n}\n\n*,\n*:before,\n*:after {\n box-sizing: border-box;\n}\n\n.chart {\n position: relative;\n flex-grow: 1;\n width: 100%;\n height: 100%;\n min-height: 0;\n min-width: 0;\n\n &:has(.item:hover),\n &:has(.item:focus-visible) {\n .item {\n opacity: 0.4;\n }\n }\n}\n\n.item {\n transition:\n background-color 0.2s ease,\n filter 0.2s ease,\n opacity 0.4s ease;\n cursor: help;\n\n &:focus-visible,\n &:hover {\n opacity: 1 !important;\n }\n}\n\nlimel-spinner {\n margin: auto;\n}\n\n@mixin line(\n $direction: vertical,\n $color: rgb(var(--contrast-800), 0.4),\n $position: center\n) {\n @if $direction == vertical {\n background: linear-gradient(to bottom, $color 0%, $color 100%)\n $position/1px\n 100%\n no-repeat;\n } @else if $direction == horizontal {\n background: linear-gradient(to right, $color 0%, $color 100%)\n $position/100%\n 1px\n no-repeat;\n }\n}\n\n@import './partial-styles/_layout-for-charts-with-x-y-axises';\n@import './partial-styles/_layout-for-charts-with-circular-shape';\n@import './partial-styles/_bar-gantt-dot';\n@import './partial-styles/_area_line';\n@import './partial-styles/_pie-doughnut';\n@import './partial-styles/_ring';\n@import './partial-styles/_stacked-bar';\n@import './partial-styles/_nps';\n@import './partial-styles/_axises';\n","import { Component, h, Prop, Watch } from '@stencil/core';\nimport { Languages } from '../date-picker/date.types';\nimport translate from '../../global/translations';\nimport { createRandomString } from '../../util/random-string';\nimport { ChartItem } from './chart.types';\n\nconst PERCENT = 100;\nconst DEFAULT_INCREMENT_SIZE = 10;\n\n/**\n * A chart is a graphical representation of data, in which\n * visual symbols such as such bars, dots, lines, or slices, represent\n * each data point, in comparison to others.\n *\n * @exampleComponent limel-example-chart-stacked-bar\n * @exampleComponent limel-example-chart-orientation\n * @exampleComponent limel-example-chart-max-value\n * @exampleComponent limel-example-chart-type-bar\n * @exampleComponent limel-example-chart-type-dot\n * @exampleComponent limel-example-chart-type-area\n * @exampleComponent limel-example-chart-type-line\n * @exampleComponent limel-example-chart-type-pie\n * @exampleComponent limel-example-chart-type-doughnut\n * @exampleComponent limel-example-chart-type-ring\n * @exampleComponent limel-example-chart-type-gantt\n * @exampleComponent limel-example-chart-type-nps\n * @exampleComponent limel-example-chart-multi-axis\n * @exampleComponent limel-example-chart-multi-axis-with-negative-start-values\n * @exampleComponent limel-example-chart-multi-axis-area-with-negative-start-values\n * @exampleComponent limel-example-chart-axis-increment\n * @exampleComponent limel-example-chart-accessibility\n * @exampleComponent limel-example-chart-styling\n * @exampleComponent limel-example-chart-creative-styling\n * @beta\n */\n\n@Component({\n tag: 'limel-chart',\n shadow: true,\n styleUrl: 'chart.scss',\n})\nexport class Chart {\n /**\n * Defines the language for translations.\n * Will translate the translatable strings on the components.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\n /**\n * Helps users of assistive technologies to understand\n * the context of the chart, and what is being displayed.\n */\n @Prop({ reflect: true })\n public accessibleLabel?: string;\n\n /**\n * Helps users of assistive technologies to understand\n * what the items in the chart represent.\n */\n @Prop({ reflect: true })\n public accessibleItemsLabel?: string;\n\n /**\n * List of items in the chart,\n * each representing a data point.\n */\n @Prop()\n public items!: ChartItem[];\n\n /**\n * Defines how items are visualized in the chart.\n */\n @Prop({ reflect: true })\n public type?:\n | 'area'\n | 'bar'\n | 'doughnut'\n | 'line'\n | 'nps'\n | 'pie'\n | 'ring'\n | 'dot'\n | 'stacked-bar' = 'stacked-bar';\n\n /**\n * Defines whether the chart is intended to be displayed wide or tall.\n * Does not have any effect on chart types which generate circular forms.\n */\n @Prop({ reflect: true })\n public orientation?: 'landscape' | 'portrait' = 'landscape';\n\n /**\n * Specifies the range that items' values could be in.\n * This is used in calculation of the size of the items in the chart.\n * When not provided, the sum of all values in the items will be considered as the range.\n */\n @Prop({ reflect: true })\n public maxValue?: number;\n\n /**\n * Specifies the increment for the axis lines.\n */\n @Prop({ reflect: true })\n public axisIncrement?: number;\n\n /**\n * Indicates whether the chart is in a loading state.\n */\n @Prop({ reflect: true })\n public loading: boolean = false;\n\n private range: {\n minValue: number;\n maxValue: number;\n totalRange: number;\n };\n\n public componentWillLoad() {\n this.recalculateRangeData();\n }\n\n public render() {\n if (this.loading) {\n return <limel-spinner limeBranded={false} />;\n }\n\n return (\n <table\n aria-busy={this.loading ? 'true' : 'false'}\n aria-live=\"polite\"\n style={{\n '--limel-chart-number-of-items':\n this.items.length.toString(),\n }}\n >\n {this.renderCaption()}\n {this.renderTableHeader()}\n {this.renderAxises()}\n <tbody class=\"chart\">{this.renderItems()}</tbody>\n </table>\n );\n }\n\n private renderCaption() {\n if (!this.accessibleLabel) {\n return;\n }\n\n return <caption>{this.accessibleLabel}</caption>;\n }\n\n private renderTableHeader() {\n return (\n <thead>\n <tr>\n <th scope=\"col\">{this.accessibleItemsLabel}</th>\n <th scope=\"col\">{translate.get('value', this.language)}</th>\n </tr>\n </thead>\n );\n }\n\n private renderAxises() {\n if (!['bar', 'dot', 'area', 'line'].includes(this.type)) {\n return;\n }\n\n const { minValue, maxValue } = this.range;\n const lines = [];\n const adjustedMinRange =\n Math.floor(minValue / this.axisIncrement) * this.axisIncrement;\n const adjustedMaxRange =\n Math.ceil(maxValue / this.axisIncrement) * this.axisIncrement;\n\n for (\n let value = adjustedMinRange;\n value <= adjustedMaxRange;\n value += this.axisIncrement\n ) {\n lines.push(\n <div\n class={{\n 'axis-line': true,\n 'zero-line': value === 0,\n }}\n role=\"presentation\"\n >\n <limel-badge label={value} />\n </div>,\n );\n }\n\n return (\n <div class=\"axises\" role=\"presentation\">\n {lines}\n </div>\n );\n }\n\n private renderItems() {\n if (!this.items?.length) {\n return;\n }\n\n let cumulativeOffset = 0;\n\n return this.items.map((item, index) => {\n const itemId = createRandomString();\n const sizeAndOffset = this.calculateSizeAndOffset(item);\n const size = sizeAndOffset.size;\n let offset = sizeAndOffset.offset;\n\n if (this.type === 'pie' || this.type === 'doughnut') {\n offset = cumulativeOffset;\n cumulativeOffset += size;\n }\n\n return (\n <tr\n style={this.getItemStyle(item, index, size, offset)}\n class={this.getItemClass(item)}\n key={itemId}\n id={itemId}\n tabIndex={0}\n >\n <th>{this.getItemText(item)}</th>\n <td>{this.getFormattedValue(item)}</td>\n {this.renderTooltip(item, itemId, size)}\n </tr>\n );\n });\n }\n\n private getItemStyle(\n item: ChartItem,\n index: number,\n size: number,\n offset: number,\n ): Record<string, string> {\n const style: Record<string, string> = {\n '--limel-chart-item-offset': `${offset}`,\n '--limel-chart-item-size': `${size}`,\n '--limel-chart-item-index': `${index}`,\n '--limel-chart-item-value': `${item.value}`,\n };\n\n if (item.color) {\n style['--limel-chart-item-color'] = item.color;\n }\n\n if (this.type === 'line' || this.type === 'area') {\n const nextItem = this.calculateSizeAndOffset(this.items[index + 1]);\n\n style['--limel-chart-next-item-size'] = `${nextItem.size}`;\n style['--limel-chart-next-item-offset'] = `${nextItem.offset}`;\n }\n\n return style;\n }\n\n private getItemClass(item: ChartItem) {\n return {\n item: true,\n 'has-start-value': Array.isArray(item.value),\n 'has-negative-value-only':\n this.getMaximumValue(item) < 0 && !this.isRangeItem(item),\n };\n }\n\n private calculateSizeAndOffset(item?: ChartItem) {\n const { minValue, totalRange } = this.range;\n if (!item) {\n return {\n size: 0,\n offset: 0,\n };\n }\n\n let startValue = 0;\n if (this.isRangeItem(item)) {\n startValue = this.getMinimumValue(item);\n }\n\n const normalizedStart =\n ((startValue - minValue) / totalRange) * PERCENT;\n const normalizedEnd =\n ((this.getMaximumValue(item) - minValue) / totalRange) * PERCENT;\n\n return {\n size: normalizedEnd - normalizedStart,\n offset: normalizedStart,\n };\n }\n\n private getFormattedValue(item: ChartItem): string {\n const { value, formattedValue } = item;\n\n if (formattedValue) {\n return formattedValue;\n }\n\n if (Array.isArray(value)) {\n return `${value[0]} — ${value[1]}`;\n }\n\n return `${value}`;\n }\n\n private getItemText(item: ChartItem): string {\n return item.text;\n }\n\n private renderTooltip(item: ChartItem, itemId: string, size: number) {\n const text = this.getItemText(item);\n const PERCENT_DECIMAL = 2;\n const formattedValue = this.getFormattedValue(item);\n\n const tooltipProps: any = {\n label: text,\n helperLabel: formattedValue,\n elementId: itemId,\n };\n\n if (this.type !== 'bar' && this.type !== 'dot' && this.type !== 'nps') {\n tooltipProps.label = `${text} (${size.toFixed(PERCENT_DECIMAL)}%)`;\n }\n\n return (\n <limel-tooltip\n {...tooltipProps}\n openDirection={\n this.orientation === 'portrait' ? 'right' : 'top'\n }\n />\n );\n }\n\n private calculateRange() {\n if (this.range) {\n return this.range;\n }\n\n const minRange = Math.min(0, ...this.items.map(this.getMinimumValue));\n const maxRange = Math.max(...this.items.map(this.getMaximumValue));\n const totalSum = this.items.reduce(\n (sum, item) => sum + this.getMaximumValue(item),\n 0,\n );\n\n let finalMaxRange = this.maxValue ?? maxRange;\n if (\n (this.type === 'pie' || this.type === 'doughnut') &&\n !this.maxValue\n ) {\n finalMaxRange = totalSum;\n }\n\n if (!this.axisIncrement) {\n this.axisIncrement = this.calculateAxisIncrement(this.items);\n }\n\n const visualMaxValue =\n Math.ceil(finalMaxRange / this.axisIncrement) * this.axisIncrement;\n const visualMinValue =\n Math.floor(minRange / this.axisIncrement) * this.axisIncrement;\n const totalRange = visualMaxValue - visualMinValue;\n\n return {\n minValue: visualMinValue,\n maxValue: visualMaxValue,\n totalRange: totalRange,\n };\n }\n\n private calculateAxisIncrement(\n items: ChartItem[],\n steps: number = DEFAULT_INCREMENT_SIZE,\n ) {\n const maxValue = Math.max(\n ...items.map((item) => {\n const value = item.value;\n if (Array.isArray(value)) {\n return Math.max(...value);\n }\n\n return value;\n }),\n );\n\n const roughStep = maxValue / steps;\n // eslint-disable-next-line no-magic-numbers\n const magnitude = 10 ** Math.floor(Math.log10(roughStep));\n\n return Math.ceil(roughStep / magnitude) * magnitude;\n }\n\n private getMinimumValue(item: ChartItem): number {\n const value = item.value;\n\n return Array.isArray(value) ? Math.min(...value) : value;\n }\n\n private getMaximumValue(item: ChartItem): number {\n const value = item.value;\n\n return Array.isArray(value) ? Math.max(...value) : value;\n }\n\n private isRangeItem(item: ChartItem): item is ChartItem<[number, number]> {\n return Array.isArray(item.value);\n }\n\n @Watch('items')\n @Watch('axisIncrement')\n @Watch('maxValue')\n handleChange() {\n this.range = null;\n this.recalculateRangeData();\n }\n\n private recalculateRangeData() {\n this.range = this.calculateRange();\n }\n}\n"],"version":3}
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-6156b4fd.js';
2
2
  import { g as getIconName } from './get-icon-props-0b65f85e.js';
3
3
  import { m as makeEnterClickable, r as removeEnterClickable } from './make-enter-clickable-a30589fb.js';
4
- import { t as translate } from './translations-26583a3b.js';
4
+ import { t as translate } from './translations-453e0db7.js';
5
5
  import { D as DELETE, B as BACKSPACE, i as DELETE_KEY_CODE, j as BACKSPACE_KEY_CODE, k as ARROW_LEFT, l as ARROW_LEFT_KEY_CODE, m as ARROW_RIGHT, n as ARROW_RIGHT_KEY_CODE, a as ENTER, d as ENTER_KEY_CODE, E as ESCAPE, c as ESCAPE_KEY_CODE } from './keycodes-bf11a644.js';
6
6
  import { i as isEmpty } from './isEmpty-3b1e5881.js';
7
7
  import { g as getHref, a as getTarget } from './link-helper-0c4a5c2e.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-6156b4fd.js';
2
- import { t as translate } from './translations-26583a3b.js';
2
+ import { t as translate } from './translations-453e0db7.js';
3
3
 
4
4
  function detectExtension(fileName, url) {
5
5
  const pathLike = fileName || url;
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-6156b4fd.js';
2
- import { t as translate } from './translations-26583a3b.js';
2
+ import { t as translate } from './translations-453e0db7.js';
3
3
  import { g as getFileIcon, a as getFileExtensionTitle, b as getFileColor, c as getFileBackgroundColor } from './file-metadata-9a4780e2.js';
4
4
  import './get-icon-props-0b65f85e.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-6156b4fd.js';
2
- import { t as translate } from './translations-26583a3b.js';
2
+ import { t as translate } from './translations-453e0db7.js';
3
3
  import { c as createCommonjsModule, a as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-5ec8f9b7.js';
4
4
  import './sv-f0ccdb13.js';
5
5
  import { m as moment } from './moment-be8ab0fa.js';
@@ -0,0 +1,204 @@
1
+ import { r as registerInstance, h, g as getElement } from './index-6156b4fd.js';
2
+ import { g as globalConfig } from './config-656a588f.js';
3
+
4
+ class CacheStorageIconCache {
5
+ constructor(cache) {
6
+ this.promises = {};
7
+ this.cache = cache;
8
+ }
9
+ /**
10
+ * Get icon data from the cache
11
+ *
12
+ * @param name - Name of the icon
13
+ * @param path - Path on the server where the assets are located
14
+ * @returns SVG markup
15
+ */
16
+ async get(name, path = '') {
17
+ const cache = await this.cache;
18
+ const url = this.getUrl(name, path);
19
+ let response = await cache.match(url);
20
+ if (!response) {
21
+ response = await this.fetchData(url, cache);
22
+ }
23
+ return this.getIcon(response);
24
+ }
25
+ async fetchData(url, cache) {
26
+ let requestPromise = this.promises[url];
27
+ if (requestPromise === undefined) {
28
+ requestPromise = cache.add(url);
29
+ this.promises[url] = requestPromise;
30
+ }
31
+ await requestPromise;
32
+ return cache.match(url);
33
+ }
34
+ /*
35
+ * Get icon data from a response
36
+ */
37
+ async getIcon(response) {
38
+ let svgData = await response.text();
39
+ // Some of the icons in the Icons8 library have hard coded black color on some of the paths.
40
+ // In order to apply coloring with CSS, these have to be set to 'currentColor'
41
+ svgData = svgData.replace(/#000000/g, 'currentColor');
42
+ if (!this.validSvg(svgData)) {
43
+ throw new Error('Invalid SVG');
44
+ }
45
+ return svgData;
46
+ }
47
+ /*
48
+ * Check if the given data is a valid SVG document
49
+ */
50
+ validSvg(data) {
51
+ const parser = new DOMParser();
52
+ const svgDoc = parser.parseFromString(data, 'image/svg+xml');
53
+ return svgDoc.documentElement.tagName.toLowerCase() === 'svg';
54
+ }
55
+ getUrl(name, path) {
56
+ let iconPath = path || '';
57
+ if (path && !path.endsWith('/')) {
58
+ iconPath = `${path}/`;
59
+ }
60
+ return `${iconPath}assets/icons/${name}.svg`;
61
+ }
62
+ }
63
+
64
+ class InMemoryIconCache {
65
+ constructor() {
66
+ /*
67
+ * Cache of all loaded SVGs
68
+ */
69
+ this.cache = {};
70
+ /*
71
+ * Contains resolve functions for all unresolved promises that are waiting for SVG data.
72
+ */
73
+ this.resolveFunctions = {};
74
+ }
75
+ /**
76
+ * Get icon data from the cache
77
+ *
78
+ * @param name - Name of the icon
79
+ * @param path - Path on the server where the assets are located
80
+ * @returns SVG markup
81
+ */
82
+ async get(name, path = '') {
83
+ if (!this.cache[name]) {
84
+ this.cache[name] = await this.getIcon(name, path);
85
+ }
86
+ return this.cache[name];
87
+ }
88
+ /*
89
+ * Creates and returns a promise that will be resolved when SVG data is available
90
+ */
91
+ getIcon(name, path) {
92
+ return new Promise((resolve) => {
93
+ if (!this.resolveFunctions[name]) {
94
+ this.resolveFunctions[name] = [];
95
+ this.fetchData(name, path);
96
+ }
97
+ this.resolveFunctions[name].push(resolve);
98
+ });
99
+ }
100
+ /*
101
+ * Fetch SVG data from the server
102
+ */
103
+ async fetchData(name, path) {
104
+ let iconPath = path || '';
105
+ if (path && !path.endsWith('/')) {
106
+ iconPath = `${path}/`;
107
+ }
108
+ const response = await fetch(`${iconPath}assets/icons/${name}.svg`);
109
+ let svgData = await response.text();
110
+ // Some of the icons in the Icons8 library have hard coded black color on some of the paths.
111
+ // In order to apply coloring with CSS, these have to be set to 'currentColor'
112
+ svgData = svgData.replace(/#000000/g, 'currentColor');
113
+ if (!this.validSvg(svgData)) {
114
+ throw new Error('Invalid SVG');
115
+ }
116
+ this.resolvePromises(name, svgData);
117
+ }
118
+ /*
119
+ * Check if the given data is a valid SVG document
120
+ */
121
+ validSvg(data) {
122
+ const parser = new DOMParser();
123
+ const svgDoc = parser.parseFromString(data, 'image/svg+xml');
124
+ return svgDoc.documentElement.tagName.toLowerCase() === 'svg';
125
+ }
126
+ /*
127
+ * Resolve all promises waiting for data for a specific icon
128
+ */
129
+ resolvePromises(name, svgData) {
130
+ const resolves = this.resolveFunctions[name];
131
+ resolves.forEach((resolve) => {
132
+ resolve(svgData);
133
+ });
134
+ this.resolveFunctions[name] = null;
135
+ }
136
+ }
137
+
138
+ const CACHE_NAME = '@limetech/lime-elements/icons';
139
+ function createIconCache() {
140
+ try {
141
+ const cache = caches.open(CACHE_NAME);
142
+ return new CacheStorageIconCache(cache);
143
+ }
144
+ catch (_a) {
145
+ return new InMemoryIconCache();
146
+ }
147
+ }
148
+ const iconCache = (() => {
149
+ return createIconCache();
150
+ })();
151
+
152
+ const iconCss = ":host{background-color:var(--icon-background-color, transparent);border-radius:50%;display:inline-block;line-height:0;box-sizing:border-box}:host svg{fill:currentColor;height:100%;pointer-events:none;width:100%}:host div{margin:var(--limel-icon-svg-margin, 0)}:host([hidden]){display:none}:host([size=x-small]){height:1rem !important;width:1rem !important}:host([size=small]){height:1.25rem !important;width:1.25rem !important}:host([size=medium]){height:1.5rem !important;width:1.5rem !important}:host([size=large]){height:1.75rem !important;width:1.75rem !important}:host([badge][size=x-small]){height:1.5rem !important;width:1.5rem !important;--limel-icon-svg-margin:0.25rem}:host([badge][size=small]){height:1.75rem !important;width:1.75rem !important;--limel-icon-svg-margin:0.25rem}:host([badge][size=medium]){height:2.5rem !important;width:2.5rem !important;--limel-icon-svg-margin:0.5rem}:host([badge][size=large]){height:2.75rem !important;width:2.75rem !important;--limel-icon-svg-margin:0.5rem}";
153
+
154
+ const Icon = class {
155
+ constructor(hostRef) {
156
+ registerInstance(this, hostRef);
157
+ this.size = undefined;
158
+ this.name = undefined;
159
+ this.badge = undefined;
160
+ }
161
+ componentDidLoad() {
162
+ this.loadIcon(this.name);
163
+ }
164
+ render() {
165
+ return h("div", { class: "container" });
166
+ }
167
+ async loadIcon(name) {
168
+ if (name === undefined || name === '') {
169
+ return;
170
+ }
171
+ const svgData = await this.loadSvg(name);
172
+ this.renderSvg(svgData);
173
+ }
174
+ /**
175
+ * Load the SVG data for the icon from the icon cache
176
+ *
177
+ * @param name - name of the icon
178
+ * @returns the icon SVG data
179
+ */
180
+ loadSvg(name) {
181
+ return iconCache.get(name, globalConfig.iconPath);
182
+ }
183
+ /*
184
+ * There is no way to style external SVG files with CSS, i.e. SVGs loaded
185
+ * with <img src="file.svg" /> or <object data="file.svg" type="image/svg+xml" />
186
+ * will remain the way they look in the file.
187
+ * Therefore we inject the svg as inline markup instead.
188
+ */
189
+ renderSvg(svgData) {
190
+ const container = this.host.shadowRoot.querySelector('div.container');
191
+ if (container) {
192
+ container.innerHTML = svgData;
193
+ }
194
+ }
195
+ get host() { return getElement(this); }
196
+ static get watchers() { return {
197
+ "name": ["loadIcon"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;;;;;","names":[],"sources":["./src/global/icon-cache/cache-storage-icon-cache.ts","./src/global/icon-cache/in-memory-icon-cache.ts","./src/global/icon-cache/factory.ts","./src/components/icon/icon.scss?tag=limel-icon&encapsulation=shadow","./src/components/icon/icon.tsx"],"sourcesContent":["export class CacheStorageIconCache {\n /*\n * Cache of all loaded SVGs\n */\n private cache: Promise<Cache>;\n\n private promises: Record<string, Promise<void>> = {};\n\n constructor(cache: Promise<Cache>) {\n this.cache = cache;\n }\n\n /**\n * Get icon data from the cache\n *\n * @param name - Name of the icon\n * @param path - Path on the server where the assets are located\n * @returns SVG markup\n */\n public async get(name: string, path = ''): Promise<string> {\n const cache = await this.cache;\n const url = this.getUrl(name, path);\n\n let response = await cache.match(url);\n if (!response) {\n response = await this.fetchData(url, cache);\n }\n\n return this.getIcon(response);\n }\n\n private async fetchData(url: string, cache: Cache): Promise<Response> {\n let requestPromise = this.promises[url];\n if (requestPromise === undefined) {\n requestPromise = cache.add(url);\n this.promises[url] = requestPromise;\n }\n\n await requestPromise;\n\n return cache.match(url);\n }\n\n /*\n * Get icon data from a response\n */\n private async getIcon(response: Response): Promise<string> {\n let svgData = await response.text();\n\n // Some of the icons in the Icons8 library have hard coded black color on some of the paths.\n // In order to apply coloring with CSS, these have to be set to 'currentColor'\n svgData = svgData.replace(/#000000/g, 'currentColor');\n\n if (!this.validSvg(svgData)) {\n throw new Error('Invalid SVG');\n }\n\n return svgData;\n }\n\n /*\n * Check if the given data is a valid SVG document\n */\n private validSvg(data) {\n const parser = new DOMParser();\n const svgDoc = parser.parseFromString(data, 'image/svg+xml');\n\n return svgDoc.documentElement.tagName.toLowerCase() === 'svg';\n }\n\n private getUrl(name: string, path: string): string {\n let iconPath = path || '';\n if (path && !path.endsWith('/')) {\n iconPath = `${path}/`;\n }\n\n return `${iconPath}assets/icons/${name}.svg`;\n }\n}\n","export class InMemoryIconCache {\n /*\n * Cache of all loaded SVGs\n */\n private cache = {};\n\n /*\n * Contains resolve functions for all unresolved promises that are waiting for SVG data.\n */\n private resolveFunctions = {};\n\n /**\n * Get icon data from the cache\n *\n * @param name - Name of the icon\n * @param path - Path on the server where the assets are located\n * @returns SVG markup\n */\n public async get(name: string, path = ''): Promise<string> {\n if (!this.cache[name]) {\n this.cache[name] = await this.getIcon(name, path);\n }\n\n return this.cache[name];\n }\n\n /*\n * Creates and returns a promise that will be resolved when SVG data is available\n */\n private getIcon(name, path) {\n return new Promise((resolve) => {\n if (!this.resolveFunctions[name]) {\n this.resolveFunctions[name] = [];\n this.fetchData(name, path);\n }\n\n this.resolveFunctions[name].push(resolve);\n });\n }\n\n /*\n * Fetch SVG data from the server\n */\n private async fetchData(name, path) {\n let iconPath = path || '';\n if (path && !path.endsWith('/')) {\n iconPath = `${path}/`;\n }\n\n const response = await fetch(`${iconPath}assets/icons/${name}.svg`);\n\n let svgData = await response.text();\n\n // Some of the icons in the Icons8 library have hard coded black color on some of the paths.\n // In order to apply coloring with CSS, these have to be set to 'currentColor'\n svgData = svgData.replace(/#000000/g, 'currentColor');\n if (!this.validSvg(svgData)) {\n throw new Error('Invalid SVG');\n }\n\n this.resolvePromises(name, svgData);\n }\n\n /*\n * Check if the given data is a valid SVG document\n */\n private validSvg(data) {\n const parser = new DOMParser();\n const svgDoc = parser.parseFromString(data, 'image/svg+xml');\n\n return svgDoc.documentElement.tagName.toLowerCase() === 'svg';\n }\n\n /*\n * Resolve all promises waiting for data for a specific icon\n */\n private resolvePromises(name, svgData) {\n const resolves = this.resolveFunctions[name];\n resolves.forEach((resolve) => {\n resolve(svgData);\n });\n this.resolveFunctions[name] = null;\n }\n}\n","import { CacheStorageIconCache } from './cache-storage-icon-cache';\nimport { InMemoryIconCache } from './in-memory-icon-cache';\n\nconst CACHE_NAME = '@limetech/lime-elements/icons';\n\nfunction createIconCache() {\n try {\n const cache = caches.open(CACHE_NAME);\n\n return new CacheStorageIconCache(cache);\n } catch {\n return new InMemoryIconCache();\n }\n}\n\nexport default (() => {\n return createIconCache();\n})();\n","/**\n * @prop --icon-background-color: Background color when attribute `badge` is set to `true`. Defaults to `transparent`.\n */\n\n:host {\n background-color: var(--icon-background-color, transparent);\n border-radius: 50%;\n display: inline-block;\n line-height: 0;\n box-sizing: border-box;\n\n svg {\n fill: currentColor;\n height: 100%;\n pointer-events: none;\n width: 100%;\n }\n\n div {\n margin: var(--limel-icon-svg-margin, 0);\n }\n}\n\n:host([hidden]) {\n display: none;\n}\n\n:host([size='x-small']) {\n height: 1rem !important;\n width: 1rem !important;\n}\n:host([size='small']) {\n height: 1.25rem !important;\n width: 1.25rem !important;\n}\n:host([size='medium']) {\n height: 1.5rem !important;\n width: 1.5rem !important;\n}\n:host([size='large']) {\n height: 1.75rem !important;\n width: 1.75rem !important;\n}\n\n:host([badge][size='x-small']) {\n height: 1.5rem !important;\n width: 1.5rem !important;\n\n --limel-icon-svg-margin: 0.25rem;\n}\n:host([badge][size='small']) {\n height: 1.75rem !important;\n width: 1.75rem !important;\n\n --limel-icon-svg-margin: 0.25rem;\n}\n:host([badge][size='medium']) {\n height: 2.5rem !important;\n width: 2.5rem !important;\n\n --limel-icon-svg-margin: 0.5rem;\n}\n:host([badge][size='large']) {\n height: 2.75rem !important;\n width: 2.75rem !important;\n\n --limel-icon-svg-margin: 0.5rem;\n}\n","import { Component, Element, h, Prop, Watch } from '@stencil/core';\nimport { globalConfig } from '../../global/config';\nimport iconCache from '../../global/icon-cache/factory';\nimport { IconSize } from './icon.types';\n\n/**\n * Search for an icon and **click on it to copy its name to clipboard**.\n * <limel-example-icon-finder />\n *\n * *******\n *\n * :::important\n * To install your icon set correctly, please read the [documentation here](#/).\n * :::\n *\n * The size and color of the icon is normally set in CSS, however there are a few\n * standard sizes defined that can be used with the `size` property.\n *\n * :::note\n * There are icons included in the `@lundalogik/lime-icons8` package which are\n * designed by our designers at Lime.\n * The names of these icons start with `-lime-`, which makes them easy to\n * find using the Icon Finder tool below.\n *\n * Some of the multi-colored `-lime-` icons use our own CSS variables\n * (instead of HEX or RGB) values to visualize their colors. Thus, you must import\n * our color palette css files into your project to render the icons properly.\n * Read more about our [Color System](#/DesignGuidelines/color-system.md/)\n * and how to do this.\n * :::\n *\n * @exampleComponent limel-example-icon-name\n * @exampleComponent limel-example-icon-size\n * @exampleComponent limel-example-icon-color\n */\n@Component({\n tag: 'limel-icon',\n shadow: true,\n styleUrl: 'icon.scss',\n})\nexport class Icon {\n /**\n * Size of the icon\n */\n @Prop({ reflect: true })\n public size: IconSize;\n\n /**\n * Name of the icon\n */\n @Prop({ reflect: true })\n public name: string;\n\n /**\n * Set to `true` to give the icon a round background with some padding.\n * Only works when the `size` attribute is also set.\n */\n @Prop({ reflect: true })\n public badge: boolean;\n\n @Element()\n private host: HTMLLimelIconElement;\n\n public componentDidLoad() {\n this.loadIcon(this.name);\n }\n\n public render() {\n return <div class=\"container\" />;\n }\n\n @Watch('name')\n protected async loadIcon(name: string) {\n if (name === undefined || name === '') {\n return;\n }\n\n const svgData = await this.loadSvg(name);\n this.renderSvg(svgData);\n }\n\n /**\n * Load the SVG data for the icon from the icon cache\n *\n * @param name - name of the icon\n * @returns the icon SVG data\n */\n private loadSvg(name: string) {\n return iconCache.get(name, globalConfig.iconPath);\n }\n\n /*\n * There is no way to style external SVG files with CSS, i.e. SVGs loaded\n * with <img src=\"file.svg\" /> or <object data=\"file.svg\" type=\"image/svg+xml\" />\n * will remain the way they look in the file.\n * Therefore we inject the svg as inline markup instead.\n */\n private renderSvg(svgData: string) {\n const container = this.host.shadowRoot.querySelector('div.container');\n if (container) {\n container.innerHTML = svgData;\n }\n }\n}\n"],"version":3}
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement } from './index-6156b4fd.js';
2
- import { t as translate } from './translations-26583a3b.js';
2
+ import { t as translate } from './translations-453e0db7.js';
3
3
 
4
4
  const linearProgressCss = ":host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host(limel-linear-progress){isolation:isolate;position:relative;overflow:hidden;display:flex;width:100%;height:0.25rem;border-radius:0.25rem;background-color:var(--background-color, rgb(var(--contrast-800), 0.5))}.progress{height:100%;width:var(--percentage, 0%);border-radius:0.25rem;background-color:var(--mdc-theme-primary)}:host(limel-linear-progress[indeterminate]) .progress{background-color:transparent;width:100%}:host(limel-linear-progress[indeterminate]) .progress:before,:host(limel-linear-progress[indeterminate]) .progress:after{will-change:left, right, opacity;content:\"\";position:absolute;inset:0;height:100%;border-radius:0.25rem;opacity:0;background-color:var(--mdc-theme-primary)}:host(limel-linear-progress[indeterminate]) .progress:before{animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite}:host(limel-linear-progress[indeterminate]) .progress:after{animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite 1.15s}@keyframes indeterminate{0%{left:-35%;right:100%;opacity:0}10%,80%{opacity:1}60%{left:100%;right:-90%}100%{left:100%;right:-90%;opacity:0}}@keyframes indeterminate-short{0%{left:-200%;right:100%;opacity:0}10%,80%{opacity:1}60%{left:107%;right:-8%}100%{left:107%;right:-8%;opacity:0}}";
5
5