@eturnity/eturnity_reusable_components 9.34.0 → 9.34.2-panel-placement.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.
- package/package.json +1 -1
- package/src/assets/svgIcons/broom.svg +6 -0
- package/src/assets/svgIcons/building_details.svg +3 -0
- package/src/assets/svgIcons/compass_two_arrows.svg +3 -0
- package/src/assets/svgIcons/house_3d.svg +3 -8
- package/src/assets/svgIcons/length_2d.svg +3 -3
- package/src/assets/svgIcons/length_2d_vertical.svg +3 -0
- package/src/assets/svgIcons/obstacle_flat_top.svg +3 -0
- package/src/assets/svgIcons/obstacle_sloped_top.svg +3 -0
- package/src/assets/svgIcons/outline_tool.svg +10 -10
- package/src/assets/svgIcons/panel_orientation_horizontal.svg +3 -0
- package/src/assets/svgIcons/panel_orientation_vertical.svg +3 -0
- package/src/assets/svgIcons/pv_panel.svg +3 -0
- package/src/assets/tests/__mocks__/fileMock.js +1 -0
- package/src/components/buttons/buttonIcon/buttonIcon.spec.js +40 -0
- package/src/components/buttons/buttonIcon/index.vue +18 -0
- package/src/components/infoText/index.vue +24 -2
- package/src/components/infoText/infoText.spec.js +87 -0
- package/src/components/inputs/inputNumber/index.vue +10 -0
- package/src/components/inputs/switchField/index.vue +23 -14
- package/src/components/inputs/switchField/switchField.spec.js +3 -3
- package/src/components/inputs/toggle/index.vue +22 -1
- package/src/components/inputs/toggle/toggle.spec.js +9 -9
- package/src/components/spinner/index.vue +2 -1
package/package.json
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Uploaded to svgrepo.com" width="800px" height="800px" viewBox="0 0 32 32" xml:space="preserve">
|
|
2
|
+
<style type="text/css">
|
|
3
|
+
.linesandangles_een{fill:#000000;}
|
|
4
|
+
</style>
|
|
5
|
+
<path class="linesandangles_een" d="M26.281,30l-2-8H25v-5h-8V2h-2v15H7v5h0.719l-2,8H26.281z M23.719,28H21v-4h-2v4h-2v-4h-2v4h-2 v-4h-2v4H8.281l1.5-6h12.438L23.719,28z M9,19h14v1H9V19z"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path transform="translate(1.5 1.5)" d="M12.5357 12.0714H11.1429V0.928571H11.6071C11.7303 0.928571 11.8484 0.879656 11.9354 0.792585C12.0225 0.705515 12.0714 0.587422 12.0714 0.464286C12.0714 0.341149 12.0225 0.223057 11.9354 0.135986C11.8484 0.0489157 11.7303 0 11.6071 0H1.39286C1.26972 0 1.15163 0.0489157 1.06456 0.135986C0.977487 0.223057 0.928571 0.341149 0.928571 0.464286C0.928571 0.587422 0.977487 0.705515 1.06456 0.792585C1.15163 0.879656 1.26972 0.928571 1.39286 0.928571H1.85714V12.0714H0.464286C0.341149 12.0714 0.223057 12.1203 0.135986 12.2074C0.0489157 12.2945 0 12.4126 0 12.5357C0 12.6589 0.0489157 12.7769 0.135986 12.864C0.223057 12.9511 0.341149 13 0.464286 13H12.5357C12.6589 13 12.7769 12.9511 12.864 12.864C12.9511 12.7769 13 12.6589 13 12.5357C13 12.4126 12.9511 12.2945 12.864 12.2074C12.7769 12.1203 12.6589 12.0714 12.5357 12.0714ZM2.78571 0.928571H10.2143V12.0714H8.35714V9.75C8.35714 9.62686 8.30823 9.50877 8.22116 9.4217C8.13409 9.33463 8.01599 9.28571 7.89286 9.28571H5.10714C4.98401 9.28571 4.86591 9.33463 4.77884 9.4217C4.69177 9.50877 4.64286 9.62686 4.64286 9.75V12.0714H2.78571V0.928571ZM7.42857 12.0714H5.57143V10.2143H7.42857V12.0714ZM4.17857 2.78571C4.17857 2.66258 4.22749 2.54449 4.31456 2.45741C4.40163 2.37034 4.51972 2.32143 4.64286 2.32143H5.57143C5.69456 2.32143 5.81266 2.37034 5.89973 2.45741C5.9868 2.54449 6.03571 2.66258 6.03571 2.78571C6.03571 2.90885 5.9868 3.02694 5.89973 3.11401C5.81266 3.20108 5.69456 3.25 5.57143 3.25H4.64286C4.51972 3.25 4.40163 3.20108 4.31456 3.11401C4.22749 3.02694 4.17857 2.90885 4.17857 2.78571ZM6.96429 2.78571C6.96429 2.66258 7.0132 2.54449 7.10027 2.45741C7.18734 2.37034 7.30543 2.32143 7.42857 2.32143H8.35714C8.48028 2.32143 8.59837 2.37034 8.68544 2.45741C8.77251 2.54449 8.82143 2.66258 8.82143 2.78571C8.82143 2.90885 8.77251 3.02694 8.68544 3.11401C8.59837 3.20108 8.48028 3.25 8.35714 3.25H7.42857C7.30543 3.25 7.18734 3.20108 7.10027 3.11401C7.0132 3.02694 6.96429 2.90885 6.96429 2.78571ZM4.17857 5.10714C4.17857 4.98401 4.22749 4.86591 4.31456 4.77884C4.40163 4.69177 4.51972 4.64286 4.64286 4.64286H5.57143C5.69456 4.64286 5.81266 4.69177 5.89973 4.77884C5.9868 4.86591 6.03571 4.98401 6.03571 5.10714C6.03571 5.23028 5.9868 5.34837 5.89973 5.43544C5.81266 5.52251 5.69456 5.57143 5.57143 5.57143H4.64286C4.51972 5.57143 4.40163 5.52251 4.31456 5.43544C4.22749 5.34837 4.17857 5.23028 4.17857 5.10714ZM6.96429 5.10714C6.96429 4.98401 7.0132 4.86591 7.10027 4.77884C7.18734 4.69177 7.30543 4.64286 7.42857 4.64286H8.35714C8.48028 4.64286 8.59837 4.69177 8.68544 4.77884C8.77251 4.86591 8.82143 4.98401 8.82143 5.10714C8.82143 5.23028 8.77251 5.34837 8.68544 5.43544C8.59837 5.52251 8.48028 5.57143 8.35714 5.57143H7.42857C7.30543 5.57143 7.18734 5.52251 7.10027 5.43544C7.0132 5.34837 6.96429 5.23028 6.96429 5.10714ZM4.17857 7.42857C4.17857 7.30543 4.22749 7.18734 4.31456 7.10027C4.40163 7.0132 4.51972 6.96429 4.64286 6.96429H5.57143C5.69456 6.96429 5.81266 7.0132 5.89973 7.10027C5.9868 7.18734 6.03571 7.30543 6.03571 7.42857C6.03571 7.55171 5.9868 7.6698 5.89973 7.75687C5.81266 7.84394 5.69456 7.89286 5.57143 7.89286H4.64286C4.51972 7.89286 4.40163 7.84394 4.31456 7.75687C4.22749 7.6698 4.17857 7.55171 4.17857 7.42857ZM6.96429 7.42857C6.96429 7.30543 7.0132 7.18734 7.10027 7.10027C7.18734 7.0132 7.30543 6.96429 7.42857 6.96429H8.35714C8.48028 6.96429 8.59837 7.0132 8.68544 7.10027C8.77251 7.18734 8.82143 7.30543 8.82143 7.42857C8.82143 7.55171 8.77251 7.6698 8.68544 7.75687C8.59837 7.84394 8.48028 7.89286 8.35714 7.89286H7.42857C7.30543 7.89286 7.18734 7.84394 7.10027 7.75687C7.0132 7.6698 6.96429 7.55171 6.96429 7.42857Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path transform="translate(4.97 1.24)" d="M4.89579 7.48736C5.67453 7.35516 6.322 8.17595 5.94852 8.9229L3.92313 12.9747C3.55456 13.7116 2.50258 13.7117 2.13407 12.9747L0.108677 8.9229L0.0471536 8.77251C-0.193592 8.02052 0.52665 7.26383 1.31864 7.5274L2.71219 7.99126C2.91736 8.05965 3.13982 8.05959 3.34501 7.99126L4.73856 7.5274L4.89579 7.48736ZM3.66141 8.94048C3.25096 9.07723 2.80622 9.07729 2.39579 8.94048L1.00223 8.47564L3.0286 12.5274L5.05497 8.47564L3.66141 8.94048ZM2.13407 0.552786C2.50259 -0.184262 3.55461 -0.184262 3.92313 0.552786L5.9495 4.60454C6.34772 5.40135 5.58368 6.28176 4.73856 6.00005L3.34501 5.53618C3.13986 5.46781 2.91833 5.46787 2.71317 5.53618L1.31961 6.00005C0.474448 6.28177 -0.289683 5.40138 0.108677 4.60454L2.13407 0.552786Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
</mask>
|
|
5
|
-
<path d="M0 6.28736L-0.698673 5.19107L-1.3 5.5743V6.28736H0ZM4.03081 3.71851L5.06922 2.9364L4.34595 1.9761L3.33213 2.62221L4.03081 3.71851ZM0 12.2814H-1.3V13.2079L-0.424205 13.5102L0 12.2814ZM3.41065 13.4587L2.98645 14.6876L4.71065 15.2828V13.4587H3.41065ZM3.41065 9.98801L3.89722 8.78251L2.11065 8.0614V9.98801H3.41065ZM4.532 10.4406H5.832V9.56343L5.01858 9.23511L4.532 10.4406ZM4.532 13.8458H3.232V14.7723L4.1078 15.0747L4.532 13.8458ZM8.06161 15.0643L7.63741 16.2931L9.36161 16.8883V15.0643H8.06161ZM8.06161 9.07028H9.36161V8.63549L9.10003 8.28818L8.06161 9.07028ZM0.698673 7.38365L4.72948 4.8148L3.33213 2.62221L-0.698673 5.19107L0.698673 7.38365ZM1.3 12.2814V6.28736H-1.3V12.2814H1.3ZM3.83485 12.2299L0.424205 11.0525L-0.424205 13.5102L2.98645 14.6876L3.83485 12.2299ZM4.71065 13.4587V9.98801H2.11065V13.4587H4.71065ZM2.92408 11.1935L4.04543 11.6461L5.01858 9.23511L3.89722 8.78251L2.92408 11.1935ZM3.232 10.4406V13.8458H5.832V10.4406H3.232ZM8.48582 13.8354L4.95621 12.617L4.1078 15.0747L7.63741 16.2931L8.48582 13.8354ZM6.76161 9.07028V15.0643H9.36161V9.07028H6.76161ZM2.99239 4.50061L7.0232 9.85239L9.10003 8.28818L5.06922 2.9364L2.99239 4.50061Z" fill="white" mask="url(#path-1-inside-1_57915_3657)"/>
|
|
6
|
-
<path d="M8.5625 14.2779V9.38818L13.5026 7.07375V11.9634L8.5625 14.2779Z" fill="white" stroke="white"/>
|
|
7
|
-
<path d="M8.21735 8.44534L4.80134 3.90984L9.81609 1.56045L13.2321 6.09596L8.21735 8.44534Z" fill="white" stroke="white"/>
|
|
8
|
-
</svg>
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.23926 0.0928743C9.66555 -0.105047 10.1726 0.021414 10.457 0.395609L13.7962 4.78952C13.9284 4.96352 14 5.17604 14 5.39458V10.358C14 10.7472 13.7742 11.1011 13.4211 11.265L8.42517 13.5847C8.19119 13.6933 7.92427 13.7074 7.6802 13.6238L5.20741 12.7774C4.80297 12.639 4.53125 12.2588 4.53125 11.8313V9.17295L3.41016 8.72471V10.7634C3.41016 11.4493 2.73554 11.9315 2.08662 11.7097L0.676466 11.2275C0.27187 11.0892 0 10.7089 0 10.2813V5.60883C0 5.26575 0.175879 4.94662 0.465938 4.76339L4.03027 2.51182L9.23926 0.0928743ZM1 5.6085V10.2804L2.41016 10.7628V7.24815L5.53125 8.49619V11.8302L7.06055 12.3536V8.15147L3.78906 3.84678L1 5.6085Z" fill="#263238"/>
|
|
3
|
+
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
|
|
3
|
-
</svg>
|
|
1
|
+
<svg width="14" height="10" viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M0.5 0C0.776142 0 1 0.223858 1 0.5V4.95312L1.25391 4.66797L3.03125 2.66797C3.21464 2.46172 3.53093 2.44277 3.7373 2.62598C3.94324 2.80939 3.96234 3.12575 3.7793 3.33203L2.74121 4.5H11.1797L10.1416 3.33203C9.95837 3.12563 9.97728 2.80936 10.1836 2.62598C10.39 2.44282 10.7063 2.46167 10.8896 2.66797L12.667 4.66797L12.9619 5L12.667 5.33203L10.8896 7.33203C10.7064 7.53822 10.39 7.55692 10.1836 7.37402C9.97727 7.19065 9.95838 6.87437 10.1416 6.66797L11.1797 5.5H2.74121L3.7793 6.66797C3.96214 6.87434 3.94338 7.19074 3.7373 7.37402C3.53103 7.55713 3.21468 7.538 3.03125 7.33203L1.25391 5.33203L1 5.0459V9.5C1 9.77614 0.776142 10 0.5 10C0.223858 10 0 9.77614 0 9.5V0.5C0 0.223858 0.223858 0 0.5 0ZM13.5 0C13.7761 0 14 0.223858 14 0.5V9.5C14 9.77614 13.7761 10 13.5 10C13.2239 10 13 9.77614 13 9.5V0.5C13 0.223858 13.2239 0 13.5 0Z" fill="#D9DEE9"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="10" height="14" viewBox="0 0 10 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10 0.5C10 0.776142 9.77614 1 9.5 1L5.04687 1L5.33203 1.25391L7.33203 3.03125C7.53828 3.21464 7.55723 3.53093 7.37402 3.7373C7.19061 3.94324 6.87425 3.96234 6.66797 3.7793L5.5 2.74121L5.5 11.1797L6.66797 10.1416C6.87437 9.95837 7.19064 9.97728 7.37402 10.1836C7.55718 10.39 7.53833 10.7063 7.33203 10.8896L5.33203 12.667L5 12.9619L4.66797 12.667L2.66797 10.8896C2.46178 10.7064 2.44307 10.39 2.62598 10.1836C2.80935 9.97727 3.12563 9.95838 3.33203 10.1416L4.5 11.1797L4.5 2.74121L3.33203 3.7793C3.12566 3.96214 2.80926 3.94338 2.62598 3.7373C2.44287 3.53103 2.462 3.21468 2.66797 3.03125L4.66797 1.25391L4.9541 1L0.5 1C0.223858 1 -3.39263e-08 0.776142 -2.18557e-08 0.5C-9.78513e-09 0.223857 0.223858 -4.27329e-07 0.5 -4.15258e-07L9.5 -2.18557e-08C9.77614 -9.78513e-09 10 0.223858 10 0.5ZM10 13.5C10 13.7761 9.77614 14 9.5 14L0.499999 14C0.223857 14 -6.02174e-07 13.7761 -5.90104e-07 13.5C-5.78033e-07 13.2239 0.223857 13 0.499999 13L9.5 13C9.77614 13 10 13.2239 10 13.5Z" fill="#D9DEE9"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path transform="translate(1 3)" d="M10.5002 0C10.7763 0 11.0002 0.223858 11.0002 0.5V4.10254L13.2902 3.0459C13.5408 2.93024 13.8384 3.0396 13.9543 3.29004C14.0699 3.54066 13.9606 3.83828 13.7101 3.9541L0.710133 9.9541C0.459551 10.0696 0.161861 9.9604 0.0460701 9.70996C-0.0695019 9.45942 0.0398765 9.16177 0.290211 9.0459L3.00017 7.79492V0.5C3.00017 0.223939 3.22414 0.000131124 3.50017 0H10.5002ZM4.00017 7.33301L10.006 4.56055C10.0036 4.54062 10.0002 4.52058 10.0002 4.5V1H4.00017V7.33301Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path transform="translate(1 3.5)" d="M10.0411 0.0457596C10.1959 -0.0254973 10.3771 -0.0128598 10.5206 0.0789627C10.664 0.170879 10.751 0.329551 10.7511 0.499861V3.71763L13.2901 2.54576C13.5407 2.43012 13.8383 2.53955 13.9542 2.7899C14.0699 3.04052 13.9606 3.33814 13.7101 3.45396L0.710068 9.45396C0.459503 9.56943 0.161784 9.46024 0.0460058 9.20982C-0.0694542 8.95934 0.0399117 8.66164 0.290146 8.54576L3.25108 7.17857V3.49986L3.25597 3.4276C3.28014 3.26211 3.38642 3.11729 3.54112 3.04576L10.0411 0.0457596ZM7.21104 2.45396L4.25108 3.8192V6.71763L9.75108 4.17857V1.28111L7.21104 2.45396Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<svg width="15" height="16" viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<path d="M8.5 3.07846L6.00098 0.935599L6.00098 5.22131L8.5 3.07846Z" fill="white"/>
|
|
5
|
-
<
|
|
6
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 4.06409C2.55228 4.06409 3 3.61637 3 3.06409C3 2.5118 2.55228 2.06409 2 2.06409C1.44772 2.06409 1 2.5118 1 3.06409C1 3.61637 1.44772 4.06409 2 4.06409ZM2 5.06409C3.10457 5.06409 4 4.16866 4 3.06409C4 1.95952 3.10457 1.06409 2 1.06409C0.895431 1.06409 0 1.95952 0 3.06409C0 4.16866 0.895431 5.06409 2 5.06409Z" fill="white"/>
|
|
7
|
-
<
|
|
8
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.002 4.06421C12.5542 4.06421 13.002 3.61649 13.002 3.06421C13.002 2.51192 12.5542 2.06421 12.002 2.06421C11.4497 2.06421 11.002 2.51192 11.002 3.06421C11.002 3.61649 11.4497 4.06421 12.002 4.06421ZM12.002 5.06421C13.1065 5.06421 14.002 4.16878 14.002 3.06421C14.002 1.95964 13.1065 1.06421 12.002 1.06421C10.8974 1.06421 10.002 1.95964 10.002 3.06421C10.002 4.16878 10.8974 5.06421 12.002 5.06421Z" fill="white"/>
|
|
9
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.002 14.0643C12.5542 14.0643 13.002 13.6166 13.002 13.0643C13.002 12.512 12.5542 12.0643 12.002 12.0643C11.4497 12.0643 11.002 12.512 11.002 13.0643C11.002 13.6166 11.4497 14.0643 12.002 14.0643ZM12.002 15.0643C13.1065 15.0643 14.002 14.1688 14.002 13.0643C14.002 11.9597 13.1065 11.0643 12.002 11.0643C10.8974 11.0643 10.002 11.9597 10.002 13.0643C10.002 14.1688 10.8974 15.0643 12.002 15.0643Z" fill="white"/>
|
|
10
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 14.0644C2.55228 14.0644 3 13.6167 3 13.0644C3 12.5121 2.55228 12.0644 2 12.0644C1.44772 12.0644 1 12.5121 1 13.0644C1 13.6167 1.44772 14.0644 2 14.0644ZM2 15.0644C3.10457 15.0644 4 14.169 4 13.0644C4 11.9598 3.10457 11.0644 2 11.0644C0.895431 11.0644 0 11.9598 0 13.0644C0 14.169 0.895431 15.0644 2 15.0644Z" fill="white"/>
|
|
11
|
-
</svg>
|
|
2
|
+
<path transform="rotate(90 2.80078 4.06415)" fill="white" d="M2.8008 4.0642h8v1.6H2.8008Z" />
|
|
3
|
+
<path transform="rotate(-180 7.00195 3.8642)" fill="white" d="M7.002 3.8642h4v1.6H7.002Z" />
|
|
4
|
+
<path d="M8.5 3.07846L6.00098 0.935599L6.00098 5.22131L8.5 3.07846Z" fill="white" />
|
|
5
|
+
<path transform="rotate(-180 11.002 13.8643)" fill="white" d="M11.002 13.8643h8v1.6H11.002Z" />
|
|
6
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 4.06409C2.55228 4.06409 3 3.61637 3 3.06409C3 2.5118 2.55228 2.06409 2 2.06409C1.44772 2.06409 1 2.5118 1 3.06409C1 3.61637 1.44772 4.06409 2 4.06409ZM2 5.06409C3.10457 5.06409 4 4.16866 4 3.06409C4 1.95952 3.10457 1.06409 2 1.06409C0.895431 1.06409 0 1.95952 0 3.06409C0 4.16866 0.895431 5.06409 2 5.06409Z" fill="white" />
|
|
7
|
+
<path transform="rotate(90 12.7988 4.06433)" fill="white" d="M12.7988 4.0643h8v1.6H12.7988Z" />
|
|
8
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.002 4.06421C12.5542 4.06421 13.002 3.61649 13.002 3.06421C13.002 2.51192 12.5542 2.06421 12.002 2.06421C11.4497 2.06421 11.002 2.51192 11.002 3.06421C11.002 3.61649 11.4497 4.06421 12.002 4.06421ZM12.002 5.06421C13.1065 5.06421 14.002 4.16878 14.002 3.06421C14.002 1.95964 13.1065 1.06421 12.002 1.06421C10.8974 1.06421 10.002 1.95964 10.002 3.06421C10.002 4.16878 10.8974 5.06421 12.002 5.06421Z" fill="white" />
|
|
9
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.002 14.0643C12.5542 14.0643 13.002 13.6166 13.002 13.0643C13.002 12.512 12.5542 12.0643 12.002 12.0643C11.4497 12.0643 11.002 12.512 11.002 13.0643C11.002 13.6166 11.4497 14.0643 12.002 14.0643ZM12.002 15.0643C13.1065 15.0643 14.002 14.1688 14.002 13.0643C14.002 11.9597 13.1065 11.0643 12.002 11.0643C10.8974 11.0643 10.002 11.9597 10.002 13.0643C10.002 14.1688 10.8974 15.0643 12.002 15.0643Z" fill="white" />
|
|
10
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 14.0644C2.55228 14.0644 3 13.6167 3 13.0644C3 12.5121 2.55228 12.0644 2 12.0644C1.44772 12.0644 1 12.5121 1 13.0644C1 13.6167 1.44772 14.0644 2 14.0644ZM2 15.0644C3.10457 15.0644 4 14.169 4 13.0644C4 11.9598 3.10457 11.0644 2 11.0644C0.895431 11.0644 0 11.9598 0 13.0644C0 14.169 0.895431 15.0644 2 15.0644Z" fill="white" />
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path transform="translate(2 1.5)" d="M0.5 0C0.776142 0 1 0.223858 1 0.5V12.5C1 12.7761 0.776142 13 0.5 13C0.223858 13 0 12.7761 0 12.5V0.5C0 0.223858 0.223858 0 0.5 0ZM7.10254 7.50488C7.60667 7.55621 8 7.98232 8 8.5C8 9.01768 7.60667 9.44379 7.10254 9.49512L7 9.5H3C2.44772 9.5 2 9.05228 2 8.5C2 7.94772 2.44772 7.5 3 7.5H7L7.10254 7.50488ZM11.1025 3.50488C11.6067 3.55621 12 3.98232 12 4.5C12 5.01768 11.6067 5.44379 11.1025 5.49512L11 5.5H3C2.44772 5.5 2 5.05228 2 4.5C2 3.94772 2.44772 3.5 3 3.5H11L11.1025 3.50488Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path transform="translate(1.5 1)" d="M4.5 2C5.05228 2 5.5 2.44772 5.5 3V11L5.49512 11.1025C5.44379 11.6067 5.01768 12 4.5 12C3.98232 12 3.55621 11.6067 3.50488 11.1025L3.5 11V3C3.5 2.44772 3.94772 2 4.5 2ZM8.5 2C9.05228 2 9.5 2.44772 9.5 3V7L9.49512 7.10254C9.44379 7.60667 9.01768 8 8.5 8C7.98232 8 7.55621 7.60667 7.50488 7.10254L7.5 7V3C7.5 2.44772 7.94772 2 8.5 2ZM12.5 0C12.7761 1.20706e-08 13 0.223858 13 0.5C13 0.776142 12.7761 1 12.5 1H0.5C0.223858 1 2.83224e-07 0.776142 0 0.5C1.20706e-08 0.223858 0.223858 -2.58771e-10 0.5 0H12.5Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path transform="translate(1.04 1.5)" d="M13.3232 0C13.7327 4.6248e-05 14.022 0.401551 13.8926 0.790039L9.95896 12.5898C9.87726 12.8348 9.64784 13 9.38963 13H0.600565C0.191116 12.9999 -0.0982598 12.5984 0.0312292 12.21L3.96482 0.410156L4.00193 0.322266C4.10404 0.126506 4.30821 3.58696e-05 4.53416 0H13.3232ZM2.15623 9L1.15623 12H3.10154L4.10154 9H2.15623ZM5.15623 9L4.15623 12H6.10154L7.10154 9H5.15623ZM8.15623 9L7.15623 12H9.10154L10.1015 9H8.15623ZM2.48924 8H4.43455L5.43455 5H3.48924L2.48924 8ZM5.48924 8H7.43455L8.43455 5H6.48924L5.48924 8ZM8.48924 8H10.4345L11.4345 5H9.48924L8.48924 8ZM3.82224 4H5.76756L6.76756 1H4.82224L3.82224 4ZM6.82224 4H8.76756L9.76756 1H7.82224L6.82224 4ZM9.82224 4H11.7676L12.7676 1H10.8222L9.82224 4Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = 'test-file-stub'
|
|
@@ -157,6 +157,46 @@ describe('ButtonIcon.vue', () => {
|
|
|
157
157
|
}
|
|
158
158
|
})
|
|
159
159
|
|
|
160
|
+
it('replaces the icon with a spinner while loading', async () => {
|
|
161
|
+
expect(wrapper.find('[data-test-id="spinner_container"]').exists()).toBe(
|
|
162
|
+
false
|
|
163
|
+
)
|
|
164
|
+
expect(wrapper.findComponent({ name: 'Icon' }).exists()).toBe(true)
|
|
165
|
+
|
|
166
|
+
await wrapper.setProps({ isLoading: true })
|
|
167
|
+
expect(wrapper.find('[data-test-id="spinner_container"]').exists()).toBe(
|
|
168
|
+
true
|
|
169
|
+
)
|
|
170
|
+
expect(wrapper.findComponent({ name: 'Icon' }).exists()).toBe(false)
|
|
171
|
+
|
|
172
|
+
await wrapper.setProps({ isLoading: false })
|
|
173
|
+
expect(wrapper.find('[data-test-id="spinner_container"]').exists()).toBe(
|
|
174
|
+
false
|
|
175
|
+
)
|
|
176
|
+
expect(wrapper.findComponent({ name: 'Icon' }).props('name')).toBe(
|
|
177
|
+
'settings'
|
|
178
|
+
)
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
it('keeps rendering the text while loading', async () => {
|
|
182
|
+
await wrapper.setProps({ isLoading: true })
|
|
183
|
+
expect(wrapper.find('[data-test-id="button-icon-text"]').text()).toBe(
|
|
184
|
+
'Click Me'
|
|
185
|
+
)
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
it('renders a white spinner on types with white button text', async () => {
|
|
189
|
+
await wrapper.setProps({ isLoading: true, type: 'primary' })
|
|
190
|
+
expect(wrapper.findComponent({ name: 'NewSpinner' }).props('isWhite')).toBe(
|
|
191
|
+
true
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
await wrapper.setProps({ type: 'secondary' })
|
|
195
|
+
expect(wrapper.findComponent({ name: 'NewSpinner' }).props('isWhite')).toBe(
|
|
196
|
+
false
|
|
197
|
+
)
|
|
198
|
+
})
|
|
199
|
+
|
|
160
200
|
it('renders caret based on showCaret prop', async () => {
|
|
161
201
|
await wrapper.setProps({ showCaret: true })
|
|
162
202
|
let caret = wrapper.find('[data-test-id="button-icon-caret"]')
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
:type="type"
|
|
29
29
|
:variant="variant"
|
|
30
30
|
>
|
|
31
|
+
<RCSpinner v-if="isLoading" :is-white="isSpinnerWhite" size="tiny" />
|
|
31
32
|
<Icon
|
|
33
|
+
v-else
|
|
32
34
|
:color="getIconColor"
|
|
33
35
|
:disable-hover="disableIconHover"
|
|
34
36
|
:fill-type="fillType"
|
|
@@ -83,9 +85,11 @@
|
|
|
83
85
|
// iconName="external_icon"
|
|
84
86
|
// fontColor="white"
|
|
85
87
|
// fontSize="12px"
|
|
88
|
+
// :isLoading="false" // swaps the icon for a spinner
|
|
86
89
|
// />
|
|
87
90
|
|
|
88
91
|
import Icon from '../../icon'
|
|
92
|
+
import RCSpinner from '../../spinner'
|
|
89
93
|
import styled from 'vue3-styled-components'
|
|
90
94
|
import theme from '../../../assets/theme'
|
|
91
95
|
|
|
@@ -419,6 +423,7 @@
|
|
|
419
423
|
ButtonWrapper,
|
|
420
424
|
IconContainer,
|
|
421
425
|
Icon,
|
|
426
|
+
RCSpinner,
|
|
422
427
|
NumberContainer,
|
|
423
428
|
NumberText,
|
|
424
429
|
CountBadge,
|
|
@@ -541,11 +546,24 @@
|
|
|
541
546
|
default: false,
|
|
542
547
|
type: Boolean,
|
|
543
548
|
},
|
|
549
|
+
isLoading: {
|
|
550
|
+
required: false,
|
|
551
|
+
default: false,
|
|
552
|
+
type: Boolean,
|
|
553
|
+
},
|
|
544
554
|
},
|
|
545
555
|
computed: {
|
|
546
556
|
theme() {
|
|
547
557
|
return theme
|
|
548
558
|
},
|
|
559
|
+
// The spinner only offers white/purple, so pick whichever contrasts with
|
|
560
|
+
// the button background the same way the label already does.
|
|
561
|
+
isSpinnerWhite() {
|
|
562
|
+
return (
|
|
563
|
+
this.theme.mainButton[this.appTheme][this.type][this.variant].default
|
|
564
|
+
.textColor === this.theme.colors.white
|
|
565
|
+
)
|
|
566
|
+
},
|
|
549
567
|
getIconColor() {
|
|
550
568
|
if (this.iconColor) return this.iconColor
|
|
551
569
|
if (this.isDisabled) {
|
|
@@ -244,6 +244,14 @@
|
|
|
244
244
|
default: '400px',
|
|
245
245
|
type: String,
|
|
246
246
|
},
|
|
247
|
+
minWidth: {
|
|
248
|
+
default: '230px',
|
|
249
|
+
type: String,
|
|
250
|
+
},
|
|
251
|
+
contentPadding: {
|
|
252
|
+
default: '',
|
|
253
|
+
type: String,
|
|
254
|
+
},
|
|
247
255
|
openTrigger: {
|
|
248
256
|
type: String,
|
|
249
257
|
default: 'onHover',
|
|
@@ -494,6 +502,7 @@
|
|
|
494
502
|
width: '100%',
|
|
495
503
|
maxWidth: props.maxWidth,
|
|
496
504
|
overflowY: 'auto',
|
|
505
|
+
...(props.contentPadding ? { padding: props.contentPadding } : {}),
|
|
497
506
|
backgroundColor: props.contentBackgroundColor
|
|
498
507
|
? props.contentBackgroundColor
|
|
499
508
|
: props.image
|
|
@@ -567,12 +576,16 @@
|
|
|
567
576
|
document.body.appendChild(clone)
|
|
568
577
|
|
|
569
578
|
// Get fresh content width from clone
|
|
570
|
-
const contentWidth = clone.
|
|
579
|
+
const contentWidth = Math.ceil(clone.getBoundingClientRect().width)
|
|
571
580
|
document.body.removeChild(clone)
|
|
572
581
|
|
|
573
582
|
// Calculate new width
|
|
583
|
+
const TEXT_OVERLAY_HORIZONTAL_PADDING_PX = 20
|
|
574
584
|
const calculatedWidth = Math.min(
|
|
575
|
-
Math.max(
|
|
585
|
+
Math.max(
|
|
586
|
+
contentWidth + TEXT_OVERLAY_HORIZONTAL_PADDING_PX,
|
|
587
|
+
parseInt(props.minWidth, 10) || 0
|
|
588
|
+
),
|
|
576
589
|
parseInt(props.maxWidth, 10)
|
|
577
590
|
)
|
|
578
591
|
|
|
@@ -644,6 +657,15 @@
|
|
|
644
657
|
}
|
|
645
658
|
})
|
|
646
659
|
|
|
660
|
+
watch(
|
|
661
|
+
() => props.text,
|
|
662
|
+
async () => {
|
|
663
|
+
if (!isVisible.value) return
|
|
664
|
+
await nextTick()
|
|
665
|
+
await updatePosition()
|
|
666
|
+
}
|
|
667
|
+
)
|
|
668
|
+
|
|
647
669
|
return {
|
|
648
670
|
isVisible,
|
|
649
671
|
boxStyle,
|
|
@@ -79,6 +79,93 @@ describe('InfoText Component', () => {
|
|
|
79
79
|
expect(wrapper.find('[data-test-id="infoText_dot"]').exists()).toBe(true)
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
+
describe("popup width floor (minWidth)", () => {
|
|
83
|
+
const showPopup = async (w) => {
|
|
84
|
+
w.vm.isMobile = false
|
|
85
|
+
await w.vm.$nextTick()
|
|
86
|
+
await w.trigger("mouseenter")
|
|
87
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
88
|
+
await w.vm.$nextTick()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
it("keeps the 230px width floor by default", async () => {
|
|
92
|
+
const roomy = mount(InfoText, {
|
|
93
|
+
props: { ...defaultProps, maxWidth: "400px" },
|
|
94
|
+
global: { stubs: { teleport: true } },
|
|
95
|
+
})
|
|
96
|
+
await showPopup(roomy)
|
|
97
|
+
expect(roomy.vm.infoBoxWidth).toBe(230)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("applies contentPadding to the popup box", async () => {
|
|
101
|
+
const padded = mount(InfoText, {
|
|
102
|
+
props: { ...defaultProps, contentPadding: "6px 10px" },
|
|
103
|
+
global: { stubs: { teleport: true } },
|
|
104
|
+
})
|
|
105
|
+
await showPopup(padded)
|
|
106
|
+
const box = padded.find('[data-test-id="info_text_wrapper"]')
|
|
107
|
+
.element.firstElementChild
|
|
108
|
+
expect(box.style.padding).toBe("6px 10px")
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it("allows a lower minWidth for tooltip-style content", async () => {
|
|
112
|
+
const small = mount(InfoText, {
|
|
113
|
+
props: { ...defaultProps, minWidth: "0" },
|
|
114
|
+
global: { stubs: { teleport: true } },
|
|
115
|
+
})
|
|
116
|
+
await showPopup(small)
|
|
117
|
+
expect(small.vm.infoBoxWidth).toBe(20)
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
describe('re-measures the popup when text changes while open', () => {
|
|
122
|
+
let rectSpy
|
|
123
|
+
|
|
124
|
+
beforeEach(() => {
|
|
125
|
+
rectSpy = jest
|
|
126
|
+
.spyOn(Element.prototype, 'getBoundingClientRect')
|
|
127
|
+
.mockImplementation(function () {
|
|
128
|
+
const width = (this.textContent || '').length * 8
|
|
129
|
+
return {
|
|
130
|
+
width,
|
|
131
|
+
height: 10,
|
|
132
|
+
top: 0,
|
|
133
|
+
left: 0,
|
|
134
|
+
bottom: 10,
|
|
135
|
+
right: width,
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
afterEach(() => {
|
|
141
|
+
rectSpy.mockRestore()
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
const showPopup = async (w) => {
|
|
145
|
+
w.vm.isMobile = false
|
|
146
|
+
await w.vm.$nextTick()
|
|
147
|
+
await w.trigger('mouseenter')
|
|
148
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
149
|
+
await w.vm.$nextTick()
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
it('recalculates the width for the new text', async () => {
|
|
153
|
+
const tooltip = mount(InfoText, {
|
|
154
|
+
props: { ...defaultProps, text: 'Save', minWidth: '0' },
|
|
155
|
+
global: { stubs: { teleport: true } },
|
|
156
|
+
})
|
|
157
|
+
await showPopup(tooltip)
|
|
158
|
+
const initialWidth = tooltip.vm.infoBoxWidth
|
|
159
|
+
expect(initialWidth).toBe('Save'.length * 8 + 20)
|
|
160
|
+
|
|
161
|
+
await tooltip.setProps({ text: 'Saving in progress' })
|
|
162
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
163
|
+
await tooltip.vm.$nextTick()
|
|
164
|
+
|
|
165
|
+
expect(tooltip.vm.infoBoxWidth).toBe('Saving in progress'.length * 8 + 20)
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
|
|
82
169
|
test('iconTextContent slot is correctly rendered', async () => {
|
|
83
170
|
// override
|
|
84
171
|
const props = defaultProps.iconTextContent
|
|
@@ -484,6 +484,7 @@
|
|
|
484
484
|
display: flex;
|
|
485
485
|
gap: 10px;
|
|
486
486
|
align-items: center;
|
|
487
|
+
padding: ${(props) => (props.isInteractive ? '0 4px' : '0')};
|
|
487
488
|
cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
|
|
488
489
|
border: ${(props) =>
|
|
489
490
|
props.alignItems == 'vertical'
|
|
@@ -729,6 +730,11 @@
|
|
|
729
730
|
required: false,
|
|
730
731
|
default: true,
|
|
731
732
|
},
|
|
733
|
+
undefinedState: {
|
|
734
|
+
type: Boolean,
|
|
735
|
+
required: false,
|
|
736
|
+
default: false,
|
|
737
|
+
},
|
|
732
738
|
allowNegative: {
|
|
733
739
|
type: Boolean,
|
|
734
740
|
required: false,
|
|
@@ -844,6 +850,7 @@
|
|
|
844
850
|
},
|
|
845
851
|
computed: {
|
|
846
852
|
displayedPlaceholder() {
|
|
853
|
+
if (this.undefinedState) return '-'
|
|
847
854
|
if (this.placeholder) return this.placeholder
|
|
848
855
|
if (this.defaultNumber)
|
|
849
856
|
return `${this.defaultNumber}${this.hasSpaceBetweenUnit ? ' ' : ''}${
|
|
@@ -1121,6 +1128,9 @@
|
|
|
1121
1128
|
}
|
|
1122
1129
|
},
|
|
1123
1130
|
formatWithCurrency(value) {
|
|
1131
|
+
if (this.undefinedState && !this.isFocused) {
|
|
1132
|
+
return '-'
|
|
1133
|
+
}
|
|
1124
1134
|
let adjustedMinValue =
|
|
1125
1135
|
value || value === 0
|
|
1126
1136
|
? value
|
|
@@ -31,15 +31,16 @@
|
|
|
31
31
|
:border-color="borderColor"
|
|
32
32
|
:color-mode="colorMode"
|
|
33
33
|
:data-id="item.hasOwnProperty('dataId') ? item.dataId : ''"
|
|
34
|
+
:disabled="!!item.disabled"
|
|
34
35
|
:height="height"
|
|
35
36
|
:inactive-border-color="inactiveBorderColor"
|
|
36
37
|
:inactive-color="inactiveColor"
|
|
37
|
-
:is-active="value == item.value"
|
|
38
|
+
:is-active="!undefinedState && value == item.value"
|
|
38
39
|
:primary-color="primaryColor"
|
|
39
40
|
:secondary-color="secondaryColor"
|
|
40
41
|
:size="size"
|
|
41
42
|
:width="item.width || 'auto'"
|
|
42
|
-
@click="selectItem(item
|
|
43
|
+
@click="selectItem(item)"
|
|
43
44
|
>
|
|
44
45
|
<OptionIconContainer v-if="item.icon">
|
|
45
46
|
<RCIcon
|
|
@@ -145,6 +146,7 @@
|
|
|
145
146
|
height: String,
|
|
146
147
|
borderColor: String,
|
|
147
148
|
inactiveBorderColor: String,
|
|
149
|
+
disabled: Boolean,
|
|
148
150
|
}
|
|
149
151
|
const SwitchOption = styled('div', optionAttrs)`
|
|
150
152
|
color: ${(props) =>
|
|
@@ -167,17 +169,19 @@
|
|
|
167
169
|
props.height
|
|
168
170
|
? props.height
|
|
169
171
|
: props.size === 'medium'
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
? '24px'
|
|
173
|
+
: props.size === 'small'
|
|
174
|
+
? '16px'
|
|
175
|
+
: '24px'};
|
|
174
176
|
padding: 0 10px;
|
|
175
177
|
margin-right: -1px;
|
|
176
178
|
transition: all 0.1s ease-in-out;
|
|
177
179
|
overflow: hidden;
|
|
178
180
|
gap: 5px;
|
|
181
|
+
opacity: ${(props) => (props.disabled ? 0.4 : 1)};
|
|
182
|
+
pointer-events: ${(props) => (props.disabled ? 'none' : 'auto')};
|
|
179
183
|
& :hover {
|
|
180
|
-
cursor: pointer;
|
|
184
|
+
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
|
181
185
|
}
|
|
182
186
|
&:first-child {
|
|
183
187
|
border-radius: 4px 0 0 4px;
|
|
@@ -264,6 +268,11 @@
|
|
|
264
268
|
default: false,
|
|
265
269
|
type: Boolean,
|
|
266
270
|
},
|
|
271
|
+
undefinedState: {
|
|
272
|
+
required: false,
|
|
273
|
+
default: false,
|
|
274
|
+
type: Boolean,
|
|
275
|
+
},
|
|
267
276
|
},
|
|
268
277
|
data() {
|
|
269
278
|
return {
|
|
@@ -282,19 +291,19 @@
|
|
|
282
291
|
this.borderColor = this.secondaryColor
|
|
283
292
|
this.inactiveBorderColor = theme.semanticColors.teal[600]
|
|
284
293
|
} else {
|
|
285
|
-
this.primaryColor = theme.semanticColors.teal[
|
|
286
|
-
this.secondaryColor = theme.semanticColors.
|
|
287
|
-
this.inactiveColor = theme.semanticColors.
|
|
294
|
+
this.primaryColor = theme.semanticColors.teal[100]
|
|
295
|
+
this.secondaryColor = theme.semanticColors.purple[500]
|
|
296
|
+
this.inactiveColor = theme.semanticColors.purple[500]
|
|
288
297
|
this.borderColor = this.secondaryColor
|
|
289
|
-
this.inactiveBorderColor = theme.semanticColors.teal[
|
|
298
|
+
this.inactiveBorderColor = theme.semanticColors.teal[200]
|
|
290
299
|
}
|
|
291
300
|
},
|
|
292
301
|
methods: {
|
|
293
|
-
selectItem(
|
|
294
|
-
if (this.disabled) {
|
|
302
|
+
selectItem(item) {
|
|
303
|
+
if (this.disabled || item.disabled) {
|
|
295
304
|
return
|
|
296
305
|
}
|
|
297
|
-
this.$emit('on-switch-change', value)
|
|
306
|
+
this.$emit('on-switch-change', item.value)
|
|
298
307
|
},
|
|
299
308
|
},
|
|
300
309
|
}
|
|
@@ -65,9 +65,9 @@ describe('SwitchField', () => {
|
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
it('renders the info text only when a message is provided', () => {
|
|
68
|
-
expect(
|
|
69
|
-
|
|
70
|
-
)
|
|
68
|
+
expect(
|
|
69
|
+
mountSwitch({ label: 'Mode' }).findComponent(InfoText).exists()
|
|
70
|
+
).toBe(false)
|
|
71
71
|
expect(
|
|
72
72
|
mountSwitch({ label: 'Mode', infoTextMessage: 'Helpful hint' })
|
|
73
73
|
.findComponent(InfoText)
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
role="checkbox"
|
|
33
33
|
:size="size"
|
|
34
34
|
tabindex="0"
|
|
35
|
+
:undefined-state="undefinedState"
|
|
35
36
|
@keydown.space.prevent="onToggleChange"
|
|
36
37
|
>
|
|
37
38
|
<ToggleBackground
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
data-test-id="toggle_background"
|
|
42
43
|
:disabled="disabled"
|
|
43
44
|
:is-checked="isChecked"
|
|
45
|
+
:undefined-state="undefinedState"
|
|
44
46
|
/>
|
|
45
47
|
<ToggleDot
|
|
46
48
|
data-test-id="toggle_dot"
|
|
@@ -49,6 +51,7 @@
|
|
|
49
51
|
:size="size"
|
|
50
52
|
:toggle-color="toggleColor"
|
|
51
53
|
:toggle-margin="toggleMargin"
|
|
54
|
+
:undefined-state="undefinedState"
|
|
52
55
|
/>
|
|
53
56
|
</ToggleWrapper>
|
|
54
57
|
<LabelContainer
|
|
@@ -125,6 +128,7 @@
|
|
|
125
128
|
disabled: Boolean,
|
|
126
129
|
backgroundColor: String,
|
|
127
130
|
isChecked: Boolean,
|
|
131
|
+
undefinedState: Boolean,
|
|
128
132
|
}
|
|
129
133
|
const LabelText = styled('div', toggleAttrs)`
|
|
130
134
|
color: ${(props) =>
|
|
@@ -140,6 +144,8 @@
|
|
|
140
144
|
border: ${(props) =>
|
|
141
145
|
props.disabled
|
|
142
146
|
? '1px solid ' + props.theme.colors.disabled
|
|
147
|
+
: props.undefinedState
|
|
148
|
+
? '1px solid ' + props.theme.colors.grey3
|
|
143
149
|
: props.isChecked
|
|
144
150
|
? props.backgroundColor
|
|
145
151
|
? '1px solid ' + props.backgroundColor
|
|
@@ -175,6 +181,7 @@
|
|
|
175
181
|
backgroundColor: String,
|
|
176
182
|
isChecked: Boolean,
|
|
177
183
|
disabled: Boolean,
|
|
184
|
+
undefinedState: Boolean,
|
|
178
185
|
}
|
|
179
186
|
const ToggleBackground = styled('span', backgroundAttrs)`
|
|
180
187
|
display: block;
|
|
@@ -184,6 +191,8 @@
|
|
|
184
191
|
background-color: ${(props) =>
|
|
185
192
|
props.disabled
|
|
186
193
|
? props.theme.colors.grey5
|
|
194
|
+
: props.undefinedState
|
|
195
|
+
? props.theme.colors.grey3
|
|
187
196
|
: props.isChecked
|
|
188
197
|
? props.backgroundColor
|
|
189
198
|
? props.backgroundColor
|
|
@@ -198,6 +207,7 @@
|
|
|
198
207
|
size: String,
|
|
199
208
|
disabled: Boolean,
|
|
200
209
|
toggleMargin: String,
|
|
210
|
+
undefinedState: Boolean,
|
|
201
211
|
}
|
|
202
212
|
const ToggleDot = styled('span', toggleProps)`
|
|
203
213
|
position: absolute;
|
|
@@ -233,7 +243,13 @@
|
|
|
233
243
|
border-radius: 100%;
|
|
234
244
|
transition: transform 0.4s ease;
|
|
235
245
|
transform: ${(props) =>
|
|
236
|
-
props.
|
|
246
|
+
props.undefinedState
|
|
247
|
+
? props.size === 'medium'
|
|
248
|
+
? 'translateX(15px)'
|
|
249
|
+
: props.size === 'small'
|
|
250
|
+
? 'translateX(6px)'
|
|
251
|
+
: 'translateX(15px)'
|
|
252
|
+
: props.isChecked
|
|
237
253
|
? props.size === 'medium'
|
|
238
254
|
? 'translateX(25px)'
|
|
239
255
|
: props.size === 'small'
|
|
@@ -336,6 +352,11 @@
|
|
|
336
352
|
default: null,
|
|
337
353
|
required: false,
|
|
338
354
|
},
|
|
355
|
+
undefinedState: {
|
|
356
|
+
type: Boolean,
|
|
357
|
+
default: false,
|
|
358
|
+
required: false,
|
|
359
|
+
},
|
|
339
360
|
},
|
|
340
361
|
methods: {
|
|
341
362
|
onToggleChange() {
|
|
@@ -77,16 +77,16 @@ describe('RCToggle', () => {
|
|
|
77
77
|
expect(wrapper.find('[data-test-id="label_left_container"]').exists()).toBe(
|
|
78
78
|
false
|
|
79
79
|
)
|
|
80
|
-
expect(
|
|
81
|
-
|
|
82
|
-
)
|
|
80
|
+
expect(
|
|
81
|
+
wrapper.find('[data-test-id="label_right_container"]').exists()
|
|
82
|
+
).toBe(false)
|
|
83
83
|
})
|
|
84
84
|
|
|
85
85
|
it('renders the label on the right by default', () => {
|
|
86
86
|
const wrapper = mountToggle({ label: 'My Label' })
|
|
87
|
-
expect(
|
|
88
|
-
|
|
89
|
-
)
|
|
87
|
+
expect(
|
|
88
|
+
wrapper.find('[data-test-id="label_right_container"]').exists()
|
|
89
|
+
).toBe(true)
|
|
90
90
|
expect(wrapper.find('[data-test-id="label_left_container"]').exists()).toBe(
|
|
91
91
|
false
|
|
92
92
|
)
|
|
@@ -98,9 +98,9 @@ describe('RCToggle', () => {
|
|
|
98
98
|
expect(wrapper.find('[data-test-id="label_left_container"]').exists()).toBe(
|
|
99
99
|
true
|
|
100
100
|
)
|
|
101
|
-
expect(
|
|
102
|
-
|
|
103
|
-
)
|
|
101
|
+
expect(
|
|
102
|
+
wrapper.find('[data-test-id="label_right_container"]').exists()
|
|
103
|
+
).toBe(false)
|
|
104
104
|
})
|
|
105
105
|
|
|
106
106
|
it('renders the info text only when infoTextMessage is provided', () => {
|
|
@@ -113,7 +113,8 @@
|
|
|
113
113
|
size: {
|
|
114
114
|
type: String,
|
|
115
115
|
default: 'medium',
|
|
116
|
-
validator: (value) =>
|
|
116
|
+
validator: (value) =>
|
|
117
|
+
['tiny', 'small', 'medium', 'large'].includes(value),
|
|
117
118
|
},
|
|
118
119
|
isWhite: {
|
|
119
120
|
required: false,
|