bitboss-ui 2.0.7 → 2.0.9
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/dist/index.js +139 -138
- package/dist/index.js.map +1 -1
- package/dist/index10.js +7 -78
- package/dist/index10.js.map +1 -1
- package/dist/{index100.js → index101.js} +3 -3
- package/dist/{index100.js.map → index101.js.map} +1 -1
- package/dist/{index102.js → index103.js} +3 -3
- package/dist/{index102.js.map → index103.js.map} +1 -1
- package/dist/{index104.js → index105.js} +8 -8
- package/dist/{index104.js.map → index105.js.map} +1 -1
- package/dist/{index106.js → index107.js} +9 -9
- package/dist/{index106.js.map → index107.js.map} +1 -1
- package/dist/{index108.js → index109.js} +3 -3
- package/dist/{index108.js.map → index109.js.map} +1 -1
- package/dist/index11.js +74 -35
- package/dist/index11.js.map +1 -1
- package/dist/{index110.js → index111.js} +3 -3
- package/dist/{index110.js.map → index111.js.map} +1 -1
- package/dist/{index112.js → index113.js} +3 -3
- package/dist/{index112.js.map → index113.js.map} +1 -1
- package/dist/{index114.js → index115.js} +3 -3
- package/dist/{index114.js.map → index115.js.map} +1 -1
- package/dist/{index116.js → index117.js} +8 -8
- package/dist/{index116.js.map → index117.js.map} +1 -1
- package/dist/{index118.js → index119.js} +2 -2
- package/dist/{index118.js.map → index119.js.map} +1 -1
- package/dist/index12.js +36 -189
- package/dist/index12.js.map +1 -1
- package/dist/index121.js +34 -38
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +38 -38
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +39 -42
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +43 -31
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +35 -2
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +2 -21
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +21 -2
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +2 -312
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +309 -21
- package/dist/index129.js.map +1 -1
- package/dist/index13.js +189 -78
- package/dist/index13.js.map +1 -1
- package/dist/index130.js +24 -2
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +2 -5
- package/dist/index131.js.map +1 -1
- package/dist/index132.js +5 -9
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +8 -5
- package/dist/index133.js.map +1 -1
- package/dist/index134.js +6 -3
- package/dist/index134.js.map +1 -1
- package/dist/index135.js +1 -1
- package/dist/index136.js +1 -1
- package/dist/index137.js +1 -1
- package/dist/index138.js +1 -1
- package/dist/index139.js +1 -1
- package/dist/index14.js +85 -0
- package/dist/index14.js.map +1 -0
- package/dist/index140.js +1 -1
- package/dist/index141.js +1 -1
- package/dist/index142.js +1 -1
- package/dist/index143.js +1 -1
- package/dist/index144.js +1 -1
- package/dist/index145.js +1 -1
- package/dist/index146.js +1 -1
- package/dist/index147.js +1 -1
- package/dist/index148.js +1 -1
- package/dist/index149.js +1 -1
- package/dist/index150.js +1 -1
- package/dist/index151.js +1 -1
- package/dist/index152.js +1 -1
- package/dist/index153.js +1 -1
- package/dist/index154.js +1 -1
- package/dist/index155.js +1 -1
- package/dist/index156.js +1 -1
- package/dist/index157.js +1 -1
- package/dist/index158.js +1 -1
- package/dist/index159.js +1 -1
- package/dist/{index15.js → index16.js} +4 -4
- package/dist/{index15.js.map → index16.js.map} +1 -1
- package/dist/index160.js +2 -2
- package/dist/{index162.js → index161.js} +1 -1
- package/dist/index161.js.map +1 -0
- package/dist/index163.js +6 -0
- package/dist/index163.js.map +1 -0
- package/dist/index165.js +1 -1
- package/dist/index166.js +1 -1
- package/dist/index167.js +1 -1
- package/dist/index168.js +1 -1
- package/dist/index169.js +1 -1
- package/dist/index170.js +2 -2
- package/dist/index171.js +6 -0
- package/dist/index171.js.map +1 -0
- package/dist/index173.js +2 -3
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +1 -1
- package/dist/index175.js +1 -1
- package/dist/index176.js +1 -1
- package/dist/index177.js +1 -1
- package/dist/index178.js +1 -1
- package/dist/index179.js +1 -1
- package/dist/{index17.js → index18.js} +4 -4
- package/dist/{index17.js.map → index18.js.map} +1 -1
- package/dist/index180.js +1 -1
- package/dist/index181.js +1 -1
- package/dist/index182.js +1 -1
- package/dist/index183.js +1 -1
- package/dist/index184.js +1 -1
- package/dist/{index186.js → index185.js} +1 -1
- package/dist/index185.js.map +1 -0
- package/dist/index187.js +6 -0
- package/dist/index187.js.map +1 -0
- package/dist/index189.js +1 -1
- package/dist/index190.js +1 -1
- package/dist/index191.js +1 -1
- package/dist/index192.js +1 -1
- package/dist/index193.js +1 -1
- package/dist/index194.js +1 -1
- package/dist/index195.js +1 -1
- package/dist/index196.js +1 -1
- package/dist/index197.js +1 -1
- package/dist/index198.js +3 -81
- package/dist/index198.js.map +1 -1
- package/dist/{index19.js → index20.js} +19 -18
- package/dist/{index19.js.map → index20.js.map} +1 -1
- package/dist/index200.js +126 -2
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +5 -4
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +123 -2
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +19 -8
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +14 -124
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +16 -5
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +2 -123
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +2 -19
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +35 -16
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +172 -14
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +6 -2
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +44 -2
- package/dist/index211.js.map +1 -1
- package/dist/index213.js +12 -173
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +5 -6
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +369 -43
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +161 -0
- package/dist/index216.js.map +1 -0
- package/dist/index217.js +84 -13
- package/dist/index217.js.map +1 -1
- package/dist/index219.js +67 -355
- package/dist/index219.js.map +1 -1
- package/dist/{index21.js → index22.js} +21 -21
- package/dist/{index21.js.map → index22.js.map} +1 -1
- package/dist/index220.js +8 -19
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +3 -27
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +2 -3
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +4 -249
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +2 -52
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +3 -44
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +7 -5
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +19 -49
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +27 -3
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +3 -3
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +249 -7
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +50 -156
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +38 -78
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +8 -0
- package/dist/index233.js.map +1 -0
- package/dist/index234.js +49 -2
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +2 -18
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +2 -106
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +21 -0
- package/dist/index237.js.map +1 -0
- package/dist/index238.js +53 -47
- package/dist/index238.js.map +1 -1
- package/dist/{index23.js → index24.js} +8 -8
- package/dist/{index23.js.map → index24.js.map} +1 -1
- package/dist/index240.js +100 -2
- package/dist/index240.js.map +1 -1
- package/dist/index242.js +9 -2
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +2 -3
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +3 -6
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +12 -16
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +8 -8
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +9 -23
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +17 -9
- package/dist/index248.js.map +1 -1
- package/dist/index257.js +1 -1
- package/dist/index258.js +1 -1
- package/dist/{index25.js → index26.js} +6 -6
- package/dist/{index25.js.map → index26.js.map} +1 -1
- package/dist/index263.js +224 -2
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +4 -2
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +9 -2
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +5 -1
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +16 -2
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +9 -2
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +23 -28
- package/dist/index269.js.map +1 -1
- package/dist/index270.js +199 -21
- package/dist/index270.js.map +1 -1
- package/dist/index271.js +439 -0
- package/dist/index271.js.map +1 -0
- package/dist/index272.js +121 -218
- package/dist/index272.js.map +1 -1
- package/dist/index274.js +5 -200
- package/dist/index274.js.map +1 -1
- package/dist/index275.js +2 -436
- package/dist/index275.js.map +1 -1
- package/dist/index276.js +2 -127
- package/dist/index276.js.map +1 -1
- package/dist/index277.js +2 -5
- package/dist/index277.js.map +1 -1
- package/dist/index278.js +2 -2
- package/dist/index278.js.map +1 -1
- package/dist/index279.js +2 -9
- package/dist/index279.js.map +1 -1
- package/dist/{index27.js → index28.js} +3 -3
- package/dist/{index27.js.map → index28.js.map} +1 -1
- package/dist/index280.js +2 -69
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +28 -3
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +22 -12
- package/dist/index282.js.map +1 -1
- package/dist/index284.js +2 -17
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +68 -2
- package/dist/index285.js.map +1 -1
- package/dist/index287.js +3 -211
- package/dist/index287.js.map +1 -1
- package/dist/index288.js +211 -15
- package/dist/index288.js.map +1 -1
- package/dist/index289.js +15 -4
- package/dist/index289.js.map +1 -1
- package/dist/index290.js +11 -4
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +34 -58
- package/dist/index291.js.map +1 -1
- package/dist/index292.js +4 -35
- package/dist/index292.js.map +1 -1
- package/dist/index293.js +4 -7
- package/dist/index293.js.map +1 -1
- package/dist/index294.js +57 -17
- package/dist/index294.js.map +1 -1
- package/dist/index295.js +2 -7
- package/dist/index295.js.map +1 -1
- package/dist/index296.js +7 -2
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +6 -10
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +17 -45
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +50 -0
- package/dist/index299.js.map +1 -0
- package/dist/{index29.js → index30.js} +3 -3
- package/dist/{index29.js.map → index30.js.map} +1 -1
- package/dist/index301.js +416 -42
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +50 -0
- package/dist/index302.js.map +1 -0
- package/dist/{index31.js → index32.js} +4 -4
- package/dist/{index31.js.map → index32.js.map} +1 -1
- package/dist/{index33.js → index34.js} +5 -5
- package/dist/{index33.js.map → index34.js.map} +1 -1
- package/dist/{index35.js → index36.js} +23 -22
- package/dist/{index35.js.map → index36.js.map} +1 -1
- package/dist/{index37.js → index38.js} +7 -7
- package/dist/{index37.js.map → index38.js.map} +1 -1
- package/dist/{index39.js → index40.js} +3 -3
- package/dist/{index39.js.map → index40.js.map} +1 -1
- package/dist/{index41.js → index42.js} +4 -4
- package/dist/{index41.js.map → index42.js.map} +1 -1
- package/dist/{index43.js → index44.js} +12 -11
- package/dist/{index43.js.map → index44.js.map} +1 -1
- package/dist/{index45.js → index46.js} +4 -4
- package/dist/{index45.js.map → index46.js.map} +1 -1
- package/dist/{index47.js → index48.js} +3 -3
- package/dist/{index47.js.map → index48.js.map} +1 -1
- package/dist/index5.js +14 -40
- package/dist/index5.js.map +1 -1
- package/dist/{index49.js → index50.js} +4 -4
- package/dist/{index49.js.map → index50.js.map} +1 -1
- package/dist/{index51.js → index52.js} +3 -3
- package/dist/{index51.js.map → index52.js.map} +1 -1
- package/dist/{index53.js → index54.js} +3 -3
- package/dist/{index53.js.map → index54.js.map} +1 -1
- package/dist/{index55.js → index56.js} +3 -3
- package/dist/{index55.js.map → index56.js.map} +1 -1
- package/dist/{index57.js → index58.js} +2 -2
- package/dist/{index57.js.map → index58.js.map} +1 -1
- package/dist/index6.js +38 -76
- package/dist/index6.js.map +1 -1
- package/dist/{index59.js → index60.js} +14 -13
- package/dist/{index59.js.map → index60.js.map} +1 -1
- package/dist/{index61.js → index62.js} +3 -3
- package/dist/{index61.js.map → index62.js.map} +1 -1
- package/dist/{index63.js → index64.js} +3 -3
- package/dist/{index63.js.map → index64.js.map} +1 -1
- package/dist/{index65.js → index66.js} +5 -5
- package/dist/{index65.js.map → index66.js.map} +1 -1
- package/dist/{index67.js → index68.js} +3 -3
- package/dist/{index67.js.map → index68.js.map} +1 -1
- package/dist/index7.js +78 -62
- package/dist/index7.js.map +1 -1
- package/dist/{index69.js → index70.js} +2 -2
- package/dist/{index69.js.map → index70.js.map} +1 -1
- package/dist/{index71.js → index72.js} +9 -9
- package/dist/{index71.js.map → index72.js.map} +1 -1
- package/dist/{index73.js → index74.js} +3 -3
- package/dist/{index73.js.map → index74.js.map} +1 -1
- package/dist/{index75.js → index76.js} +5 -5
- package/dist/{index75.js.map → index76.js.map} +1 -1
- package/dist/index78.js +37 -120
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +130 -0
- package/dist/index79.js.map +1 -0
- package/dist/index8.js +60 -18
- package/dist/index8.js.map +1 -1
- package/dist/{index80.js → index81.js} +5 -5
- package/dist/{index80.js.map → index81.js.map} +1 -1
- package/dist/{index82.js → index83.js} +25 -24
- package/dist/{index82.js.map → index83.js.map} +1 -1
- package/dist/{index84.js → index85.js} +7 -7
- package/dist/{index84.js.map → index85.js.map} +1 -1
- package/dist/{index86.js → index87.js} +2 -2
- package/dist/{index86.js.map → index87.js.map} +1 -1
- package/dist/{index88.js → index89.js} +3 -3
- package/dist/{index88.js.map → index89.js.map} +1 -1
- package/dist/index9.js +19 -7
- package/dist/index9.js.map +1 -1
- package/dist/{index90.js → index91.js} +3 -3
- package/dist/{index90.js.map → index91.js.map} +1 -1
- package/dist/{index92.js → index93.js} +3 -3
- package/dist/{index92.js.map → index93.js.map} +1 -1
- package/dist/{index94.js → index95.js} +1 -1
- package/dist/index95.js.map +1 -0
- package/dist/{index96.js → index97.js} +3 -3
- package/dist/{index96.js.map → index97.js.map} +1 -1
- package/dist/{index98.js → index99.js} +3 -3
- package/dist/{index98.js.map → index99.js.map} +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/index120.js +0 -43
- package/dist/index120.js.map +0 -1
- package/dist/index162.js.map +0 -1
- package/dist/index164.js +0 -6
- package/dist/index164.js.map +0 -1
- package/dist/index172.js +0 -5
- package/dist/index172.js.map +0 -1
- package/dist/index186.js.map +0 -1
- package/dist/index188.js +0 -6
- package/dist/index188.js.map +0 -1
- package/dist/index212.js +0 -38
- package/dist/index212.js.map +0 -1
- package/dist/index218.js +0 -8
- package/dist/index218.js.map +0 -1
- package/dist/index241.js +0 -13
- package/dist/index241.js.map +0 -1
- package/dist/index283.js +0 -12
- package/dist/index283.js.map +0 -1
- package/dist/index300.js +0 -424
- package/dist/index300.js.map +0 -1
- package/dist/index4.js +0 -17
- package/dist/index4.js.map +0 -1
- package/dist/index77.js +0 -47
- package/dist/index77.js.map +0 -1
- package/dist/index94.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index31.js","sources":["../src/components/BaseRadioGroup/BaseRadioGroup.vue"],"sourcesContent":["<template>\n\t<OptionsContainer\n\t\tclass=\"bb-base-radio-group\"\n\t\t:direction=\"direction\"\n\t\t:has-errors=\"hasErrors\"\n\t\t:hide-label=\"hideLabel\"\n\t\t:loading=\"!!loading\"\n\t\t:loading-text=\"loadingText\"\n\t\t:no-data-text=\"noDataText\"\n\t\t:options=\"options\"\n\t>\n\t\t<template #prepend><slot name=\"prepend\"></slot></template>\n\t\t<template #loading><slot name=\"loading\"></slot></template>\n\t\t<template #no-data><slot name=\"no-data\"></slot></template>\n\t\t<template #option:prepend=\"data\"\n\t\t\t><slot name=\"option:prepend\" v-bind=\"data\"></slot\n\t\t></template>\n\t\t<template #input=\"{ option, index }\">\n\t\t\t<BaseRadio\n\t\t\t\t:id=\"option.valueHash\"\n\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t:autofocus=\"autofocus && !index\"\n\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t:color=\"color\"\n\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t:has-errors=\"hasErrors\"\n\t\t\t\t:model-value=\"props.modelValue\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:required=\"required\"\n\t\t\t\t:value=\"option.value\"\n\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t>\n\t\t\t\t<template v-if=\"$slots.icon\" #icon=\"data\">\n\t\t\t\t\t<slot\n\t\t\t\t\t\t:item=\"option.item\"\n\t\t\t\t\t\tname=\"icon\"\n\t\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\t\tv-bind=\"data\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t</BaseRadio>\n\t\t</template>\n\t\t<template #option:append=\"data\"\n\t\t\t><slot name=\"option:prepend\" v-bind=\"data\"></slot\n\t\t></template>\n\t\t<template #append><slot name=\"prepend\"></slot></template>\n\t</OptionsContainer>\n</template>\n\n<script setup lang=\"ts\" generic=\"T = any\">\nimport { ref, toRef } from 'vue';\nimport { useOptions } from '@/composables/useOptions';\nimport BaseRadio from '../BaseRadio/BaseRadio.vue';\nimport OptionsContainer from '../OptionsContainer.vue';\nimport type { InputHTMLAttributes, HTMLAttributes } from 'vue';\nimport type { NestedKeyOf } from '@/types/NestedKeyOf';\nimport type { SlotAttributes } from '../BaseRadio/BaseRadio.vue';\n\nexport type BaseRadioGroupProps<T> = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Define a color for the component.\n\t *\n\t * Either a custom color or a coded color in common HEX, RGB, etc... format.\n\t */\n\tcolor?: string;\n\n\t/**\n\t * Defines an array of dependencies that will trigger actions in the component upon change.\n\t */\n\tdependencies?: any[];\n\n\t/**\n\t * Timeout used to debounce response to changes to dependencies.\n\t */\n\tdepsDebounceTime?: number;\n\n\t/**\n\t * Direction of the layout of the inputs inside the fieldset. It can be either `horizontal` or `vertical`\n\t */\n\tdirection?: 'horizontal' | 'vertical';\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * If coherence is enforce the input cannot have a modelValue the is incoherent with its current items.\n\t *\n\t * e.g. You cannot set v-model to a user that is not present in the items passed.\n\t *\n\t * modelValue will be reset upon incoherence.\n\t */\n\tenforceCoherence?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * Visually hides the label of the input while maintaining accessibility.\n\t */\n\thideLabel?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Used to retrieve items can be an array or a function.\n\t */\n\titems:\n\t\t| T[]\n\t\t| ((prefill: boolean, modelValue?: any[]) => Promise<T[]>)\n\t\t| ((prefill: boolean, modelValue?: any[]) => T[]);\n\n\t/**\n\t * Defines a path that returns a property of the object to use as text or a function that returns a string\n\t */\n\titemText?: T extends object\n\t\t? NestedKeyOf<T> | ((item: T) => string)\n\t\t: ((item: T) => string) | undefined;\n\n\t/**\n\t * Defines a path that returns a property of the object to use as value or a function that returns any value\n\t */\n\titemValue?: T extends object\n\t\t? NestedKeyOf<T> | ((item: T) => string)\n\t\t: ((item: T) => any) | undefined;\n\n\t/**\n\t * String displayed while items are being loaded.\n\t */\n\tloadingText?: string;\n\n\t/**\n\t * Used by v-model. Can be any serializable type.\n\t */\n\tmodelValue: any;\n\n\t/**\n\t * Timeout used to debounce response to changes to modelValue.\n\t */\n\tmodelValueDebounceTime?: number;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there are no items to display.\n\t */\n\tnoDataText?: string;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n};\n\nexport type BaseRadioGroupEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'mousedown', event: MouseEvent): void;\n\t(e: 'mouseup', event: MouseEvent): void;\n\t(e: 'update:modelValue', value: any): void;\n};\n\nconst props = withDefaults(defineProps<BaseRadioGroupProps<T>>(), {\n\tdepsDebounceTime: 0,\n\tdirection: 'horizontal',\n\titems: () => [],\n\tloadingText: 'Caricamento...',\n\tmodelValueDebounceTime: 0,\n\tnoDataText: 'Nessun elemento da visualizzare',\n});\n\nconst emit = defineEmits<BaseRadioGroupEvents>();\n\ndefineSlots<{\n\tprepend?: (props: object) => any;\n\tloading?: (props: object) => any;\n\t'no-data'?: (props: object) => any;\n\t'option:prepend'?: (props: {\n\t\tchecked: boolean;\n\t\tdisabled: boolean;\n\t\tid?: string;\n\t\titem: T;\n\t\ttext: string;\n\t}) => any;\n\ticon?: (\n\t\tprops: SlotAttributes & {\n\t\t\titem: T;\n\t\t\ttext: string;\n\t\t}\n\t) => any;\n\tlabel?: (props: { item: T; text: string; checked: boolean }) => any;\n\t'option:append'?: (props: {\n\t\tchecked: boolean;\n\t\tdisabled: boolean;\n\t\tid?: string;\n\t\titem: T;\n\t\ttext: string;\n\t}) => any;\n\tappend?: (props: object) => any;\n}>();\n\nconst container = ref<HTMLElement>();\nconst active = ref(false);\n\nconst { innerLoading: loading, options } = useOptions({\n\tdependencies: toRef(props, 'dependencies'),\n\tdepsDebounceTime: props.depsDebounceTime,\n\tdisabled: toRef(props, 'disabled'),\n\temit,\n\tenforceCoherence: props.enforceCoherence,\n\titems: toRef(props, 'items'),\n\titemText: props.itemText,\n\titemValue: props.itemValue,\n\tmodelValue: toRef(props, 'modelValue'),\n\tmodelValueDebounceTime: props.modelValueDebounceTime,\n\tmultiple: false,\n\tprefill: true,\n\tqueryDebounceTime: 0,\n\tresetQueryOnOptionSelected: false,\n\tstash: false,\n});\n\nconst onFocus = (event: FocusEvent) => {\n\temit('focus', event);\n\tif (!active.value) {\n\t\tdocument.addEventListener('focusin', onDocumentFocus, { passive: true });\n\t\tdocument.addEventListener('click', onDocumentClick, { passive: true });\n\t\tactive.value = true;\n\t}\n};\n\nconst eventListeners = {\n\tonBlur: (event: FocusEvent) => emit('blur', event),\n\tonChange: (event: Event) => emit('change', event),\n\tonClick: (event: MouseEvent) => emit('click', event),\n\tonFocus,\n\tonInput: (event: Event) => emit('input', event),\n\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n\t'onUpdate:modelValue': (value: any) => emit('update:modelValue', value),\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseRadioGroup';\n</style>\n"],"names":["props","__props","emit","__emit","container","ref","active","loading","options","useOptions","toRef","eventListeners","event","onDocumentFocus","onDocumentClick","value","_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiMA,UAAMA,IAAQC,GASRC,IAAOC,GA8BPC,IAAYC,KACZC,IAASD,EAAI,EAAK,GAElB,EAAE,cAAcE,GAAS,SAAAC,EAAA,IAAYC,EAAW;AAAA,MACrD,cAAcC,EAAMV,GAAO,cAAc;AAAA,MACzC,kBAAkBA,EAAM;AAAA,MACxB,UAAUU,EAAMV,GAAO,UAAU;AAAA,MACjC,MAAAE;AAAA,MACA,kBAAkBF,EAAM;AAAA,MACxB,OAAOU,EAAMV,GAAO,OAAO;AAAA,MAC3B,UAAUA,EAAM;AAAA,MAChB,WAAWA,EAAM;AAAA,MACjB,YAAYU,EAAMV,GAAO,YAAY;AAAA,MACrC,wBAAwBA,EAAM;AAAA,MAC9B,UAAU;AAAA,MACV,SAAS;AAAA,MACT,mBAAmB;AAAA,MACnB,4BAA4B;AAAA,MAC5B,OAAO;AAAA,IAAA,CACP,GAWKW,IAAiB;AAAA,MACtB,QAAQ,CAACC,MAAsBV,EAAK,QAAQU,CAAK;AAAA,MACjD,UAAU,CAACA,MAAiBV,EAAK,UAAUU,CAAK;AAAA,MAChD,SAAS,CAACA,MAAsBV,EAAK,SAASU,CAAK;AAAA,MACnD,SAbe,CAACA,MAAsB;AACtC,QAAAV,EAAK,SAASU,CAAK,GACdN,EAAO,UACX,SAAS,iBAAiB,WAAWO,GAAiB,EAAE,SAAS,IAAM,GACvE,SAAS,iBAAiB,SAASC,GAAiB,EAAE,SAAS,IAAM,GACrER,EAAO,QAAQ;AAAA,MAChB;AAAA,MAQA,SAAS,CAACM,MAAiBV,EAAK,SAASU,CAAK;AAAA,MAC9C,WAAW,CAACA,MAAyBV,EAAK,WAAWU,CAAK;AAAA,MAC1D,aAAa,CAACA,MAAsBV,EAAK,aAAaU,CAAK;AAAA,MAC3D,WAAW,CAACA,MAAsBV,EAAK,WAAWU,CAAK;AAAA,MACvD,uBAAuB,CAACG,MAAeb,EAAK,qBAAqBa,CAAK;AAAA,IAAA,GAGjEF,IAAkB,CAACD,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBI,IAAAZ,EAAU,UAAV,QAAAY,EAAiB,SAASJ,EAAM,YACpCV,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWO,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD,GAGKA,IAAkB,CAACF,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBI,IAAAZ,EAAU,UAAV,QAAAY,EAAiB,SAASJ,EAAM,YACpCV,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWO,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index32.js","sources":["../src/components/BaseRadioGroup/BaseRadioGroup.vue"],"sourcesContent":["<template>\n\t<OptionsContainer\n\t\tclass=\"bb-base-radio-group\"\n\t\t:direction=\"direction\"\n\t\t:has-errors=\"hasErrors\"\n\t\t:hide-label=\"hideLabel\"\n\t\t:loading=\"!!loading\"\n\t\t:loading-text=\"loadingText\"\n\t\t:no-data-text=\"noDataText\"\n\t\t:options=\"options\"\n\t>\n\t\t<template #prepend><slot name=\"prepend\"></slot></template>\n\t\t<template #loading><slot name=\"loading\"></slot></template>\n\t\t<template #no-data><slot name=\"no-data\"></slot></template>\n\t\t<template #option:prepend=\"data\"\n\t\t\t><slot name=\"option:prepend\" v-bind=\"data\"></slot\n\t\t></template>\n\t\t<template #input=\"{ option, index }\">\n\t\t\t<BaseRadio\n\t\t\t\t:id=\"option.valueHash\"\n\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t:autofocus=\"autofocus && !index\"\n\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t:color=\"color\"\n\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t:has-errors=\"hasErrors\"\n\t\t\t\t:model-value=\"props.modelValue\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:required=\"required\"\n\t\t\t\t:value=\"option.value\"\n\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t>\n\t\t\t\t<template v-if=\"$slots.icon\" #icon=\"data\">\n\t\t\t\t\t<slot\n\t\t\t\t\t\t:item=\"option.item\"\n\t\t\t\t\t\tname=\"icon\"\n\t\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\t\tv-bind=\"data\"\n\t\t\t\t\t/>\n\t\t\t\t</template>\n\t\t\t</BaseRadio>\n\t\t</template>\n\t\t<template #option:append=\"data\"\n\t\t\t><slot name=\"option:prepend\" v-bind=\"data\"></slot\n\t\t></template>\n\t\t<template #append><slot name=\"prepend\"></slot></template>\n\t</OptionsContainer>\n</template>\n\n<script setup lang=\"ts\" generic=\"T = any\">\nimport { ref, toRef } from 'vue';\nimport { useOptions } from '@/composables/useOptions';\nimport BaseRadio from '../BaseRadio/BaseRadio.vue';\nimport OptionsContainer from '../OptionsContainer.vue';\nimport type { InputHTMLAttributes, HTMLAttributes } from 'vue';\nimport type { NestedKeyOf } from '@/types/NestedKeyOf';\nimport type { SlotAttributes } from '../BaseRadio/BaseRadio.vue';\n\nexport type BaseRadioGroupProps<T> = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Define a color for the component.\n\t *\n\t * Either a custom color or a coded color in common HEX, RGB, etc... format.\n\t */\n\tcolor?: string;\n\n\t/**\n\t * Defines an array of dependencies that will trigger actions in the component upon change.\n\t */\n\tdependencies?: any[];\n\n\t/**\n\t * Timeout used to debounce response to changes to dependencies.\n\t */\n\tdepsDebounceTime?: number;\n\n\t/**\n\t * Direction of the layout of the inputs inside the fieldset. It can be either `horizontal` or `vertical`\n\t */\n\tdirection?: 'horizontal' | 'vertical';\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * If coherence is enforce the input cannot have a modelValue the is incoherent with its current items.\n\t *\n\t * e.g. You cannot set v-model to a user that is not present in the items passed.\n\t *\n\t * modelValue will be reset upon incoherence.\n\t */\n\tenforceCoherence?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * Visually hides the label of the input while maintaining accessibility.\n\t */\n\thideLabel?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Used to retrieve items can be an array or a function.\n\t */\n\titems:\n\t\t| T[]\n\t\t| ((prefill: boolean, modelValue?: any[]) => Promise<T[]>)\n\t\t| ((prefill: boolean, modelValue?: any[]) => T[]);\n\n\t/**\n\t * Defines a path that returns a property of the object to use as text or a function that returns a string\n\t */\n\titemText?: T extends object\n\t\t? NestedKeyOf<T> | ((item: T) => string)\n\t\t: ((item: T) => string) | undefined;\n\n\t/**\n\t * Defines a path that returns a property of the object to use as value or a function that returns any value\n\t */\n\titemValue?: T extends object\n\t\t? NestedKeyOf<T> | ((item: T) => string)\n\t\t: ((item: T) => any) | undefined;\n\n\t/**\n\t * String displayed while items are being loaded.\n\t */\n\tloadingText?: string;\n\n\t/**\n\t * Used by v-model. Can be any serializable type.\n\t */\n\tmodelValue: any;\n\n\t/**\n\t * Timeout used to debounce response to changes to modelValue.\n\t */\n\tmodelValueDebounceTime?: number;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there are no items to display.\n\t */\n\tnoDataText?: string;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n};\n\nexport type BaseRadioGroupEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'mousedown', event: MouseEvent): void;\n\t(e: 'mouseup', event: MouseEvent): void;\n\t(e: 'update:modelValue', value: any): void;\n};\n\nconst props = withDefaults(defineProps<BaseRadioGroupProps<T>>(), {\n\tdepsDebounceTime: 0,\n\tdirection: 'horizontal',\n\titems: () => [],\n\tloadingText: 'Caricamento...',\n\tmodelValueDebounceTime: 0,\n\tnoDataText: 'Nessun elemento da visualizzare',\n});\n\nconst emit = defineEmits<BaseRadioGroupEvents>();\n\ndefineSlots<{\n\tprepend?: (props: object) => any;\n\tloading?: (props: object) => any;\n\t'no-data'?: (props: object) => any;\n\t'option:prepend'?: (props: {\n\t\tchecked: boolean;\n\t\tdisabled: boolean;\n\t\tid?: string;\n\t\titem: T;\n\t\ttext: string;\n\t}) => any;\n\ticon?: (\n\t\tprops: SlotAttributes & {\n\t\t\titem: T;\n\t\t\ttext: string;\n\t\t}\n\t) => any;\n\tlabel?: (props: { item: T; text: string; checked: boolean }) => any;\n\t'option:append'?: (props: {\n\t\tchecked: boolean;\n\t\tdisabled: boolean;\n\t\tid?: string;\n\t\titem: T;\n\t\ttext: string;\n\t}) => any;\n\tappend?: (props: object) => any;\n}>();\n\nconst container = ref<HTMLElement>();\nconst active = ref(false);\n\nconst { innerLoading: loading, options } = useOptions({\n\tdependencies: toRef(props, 'dependencies'),\n\tdepsDebounceTime: props.depsDebounceTime,\n\tdisabled: toRef(props, 'disabled'),\n\temit,\n\tenforceCoherence: props.enforceCoherence,\n\titems: toRef(props, 'items'),\n\titemText: props.itemText,\n\titemValue: props.itemValue,\n\tmodelValue: toRef(props, 'modelValue'),\n\tmodelValueDebounceTime: props.modelValueDebounceTime,\n\tmultiple: false,\n\tprefill: true,\n\tqueryDebounceTime: 0,\n\tresetQueryOnOptionSelected: false,\n\tstash: false,\n});\n\nconst onFocus = (event: FocusEvent) => {\n\temit('focus', event);\n\tif (!active.value) {\n\t\tdocument.addEventListener('focusin', onDocumentFocus, { passive: true });\n\t\tdocument.addEventListener('click', onDocumentClick, { passive: true });\n\t\tactive.value = true;\n\t}\n};\n\nconst eventListeners = {\n\tonBlur: (event: FocusEvent) => emit('blur', event),\n\tonChange: (event: Event) => emit('change', event),\n\tonClick: (event: MouseEvent) => emit('click', event),\n\tonFocus,\n\tonInput: (event: Event) => emit('input', event),\n\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n\t'onUpdate:modelValue': (value: any) => emit('update:modelValue', value),\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseRadioGroup';\n</style>\n"],"names":["props","__props","emit","__emit","container","ref","active","loading","options","useOptions","toRef","eventListeners","event","onDocumentFocus","onDocumentClick","value","_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiMA,UAAMA,IAAQC,GASRC,IAAOC,GA8BPC,IAAYC,KACZC,IAASD,EAAI,EAAK,GAElB,EAAE,cAAcE,GAAS,SAAAC,EAAA,IAAYC,EAAW;AAAA,MACrD,cAAcC,EAAMV,GAAO,cAAc;AAAA,MACzC,kBAAkBA,EAAM;AAAA,MACxB,UAAUU,EAAMV,GAAO,UAAU;AAAA,MACjC,MAAAE;AAAA,MACA,kBAAkBF,EAAM;AAAA,MACxB,OAAOU,EAAMV,GAAO,OAAO;AAAA,MAC3B,UAAUA,EAAM;AAAA,MAChB,WAAWA,EAAM;AAAA,MACjB,YAAYU,EAAMV,GAAO,YAAY;AAAA,MACrC,wBAAwBA,EAAM;AAAA,MAC9B,UAAU;AAAA,MACV,SAAS;AAAA,MACT,mBAAmB;AAAA,MACnB,4BAA4B;AAAA,MAC5B,OAAO;AAAA,IAAA,CACP,GAWKW,IAAiB;AAAA,MACtB,QAAQ,CAACC,MAAsBV,EAAK,QAAQU,CAAK;AAAA,MACjD,UAAU,CAACA,MAAiBV,EAAK,UAAUU,CAAK;AAAA,MAChD,SAAS,CAACA,MAAsBV,EAAK,SAASU,CAAK;AAAA,MACnD,SAbe,CAACA,MAAsB;AACtC,QAAAV,EAAK,SAASU,CAAK,GACdN,EAAO,UACX,SAAS,iBAAiB,WAAWO,GAAiB,EAAE,SAAS,IAAM,GACvE,SAAS,iBAAiB,SAASC,GAAiB,EAAE,SAAS,IAAM,GACrER,EAAO,QAAQ;AAAA,MAChB;AAAA,MAQA,SAAS,CAACM,MAAiBV,EAAK,SAASU,CAAK;AAAA,MAC9C,WAAW,CAACA,MAAyBV,EAAK,WAAWU,CAAK;AAAA,MAC1D,aAAa,CAACA,MAAsBV,EAAK,aAAaU,CAAK;AAAA,MAC3D,WAAW,CAACA,MAAsBV,EAAK,WAAWU,CAAK;AAAA,MACvD,uBAAuB,CAACG,MAAeb,EAAK,qBAAqBa,CAAK;AAAA,IAAA,GAGjEF,IAAkB,CAACD,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBI,IAAAZ,EAAU,UAAV,QAAAY,EAAiB,SAASJ,EAAM,YACpCV,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWO,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD,GAGKA,IAAkB,CAACF,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBI,IAAAZ,EAAU,UAAV,QAAAY,EAAiB,SAASJ,EAAM,YACpCV,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWO,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as C, ref as g, computed as f, openBlock as l, createElementBlock as i, mergeProps as h, createElementVNode as r, renderSlot as p, Fragment as I, renderList as V, normalizeClass as B, toDisplayString as M } from "vue";
|
|
2
|
-
import { booleanishToBoolean as D } from "./
|
|
3
|
-
import { identity as F } from "./
|
|
4
|
-
import { isCssColor as v } from "./
|
|
5
|
-
import { isNotNil as T } from "./
|
|
2
|
+
import { booleanishToBoolean as D } from "./index224.js";
|
|
3
|
+
import { identity as F } from "./index206.js";
|
|
4
|
+
import { isCssColor as v } from "./index222.js";
|
|
5
|
+
import { isNotNil as T } from "./index131.js";
|
|
6
6
|
const $ = { class: "bb-base-rating__inner-container" }, q = { class: "bb-base-rating__label-text sr-only" }, x = ["id", "aria-describedby", "autofocus", "checked", "disabled", "name", "required", "value"], H = ["height", "width"], N = /* @__PURE__ */ r("path", {
|
|
7
7
|
d: "m8.243 7.34l-6.38.925l-.113.023a1 1 0 0 0-.44 1.684l4.622 4.499l-1.09 6.355l-.013.11a1 1 0 0 0 1.464.944l5.706-3l5.693 3l.1.046a1 1 0 0 0 1.352-1.1l-1.091-6.355l4.624-4.5l.078-.085a1 1 0 0 0-.633-1.62l-6.38-.926l-2.852-5.78a1 1 0 0 0-1.794 0L8.243 7.34z",
|
|
8
8
|
"stroke-linecap": "round",
|
|
@@ -130,4 +130,4 @@ const $ = { class: "bb-base-rating__inner-container" }, q = { class: "bb-base-ra
|
|
|
130
130
|
export {
|
|
131
131
|
Q as default
|
|
132
132
|
};
|
|
133
|
-
//# sourceMappingURL=
|
|
133
|
+
//# sourceMappingURL=index34.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index33.js","sources":["../src/components/BaseRating/BaseRating.vue"],"sourcesContent":["<template>\n\t<span v-bind=\"outerContainerAttributes\" ref=\"container\">\n\t\t<span class=\"bb-base-rating__inner-container\">\n\t\t\t<slot name=\"prepend\"></slot>\n\t\t\t<label\n\t\t\t\tv-for=\"(option, index) in options\"\n\t\t\t\t:key=\"option.value\"\n\t\t\t\tclass=\"bb-base-rating__option\"\n\t\t\t\t:class=\"{ 'bb-base-rating__option--highlighted': option.highlighted }\"\n\t\t\t>\n\t\t\t\t<span class=\"bb-base-rating__label-text sr-only\">{{\n\t\t\t\t\toption.value\n\t\t\t\t}}</span>\n\t\t\t\t<input\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t\t:autofocus=\"autofocus && !index\"\n\t\t\t\t\t:checked=\"option.checked\"\n\t\t\t\t\tclass=\"sr-only\"\n\t\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t\t:name=\"option.name\"\n\t\t\t\t\t:required=\"required\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t:value=\"option.value\"\n\t\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t\t/>\n\t\t\t\t<slot\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:checked=\"option.checked\"\n\t\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t\tname=\"icon\"\n\t\t\t\t\t:size=\"option.size\"\n\t\t\t\t\t:value=\"option.value\"\n\t\t\t\t>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t:height=\"option.size\"\n\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t:width=\"option.size\"\n\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<path\n\t\t\t\t\t\t\td=\"m8.243 7.34l-6.38.925l-.113.023a1 1 0 0 0-.44 1.684l4.622 4.499l-1.09 6.355l-.013.11a1 1 0 0 0 1.464.944l5.706-3l5.693 3l.1.046a1 1 0 0 0 1.352-1.1l-1.091-6.355l4.624-4.5l.078-.085a1 1 0 0 0-.633-1.62l-6.38-.926l-2.852-5.78a1 1 0 0 0-1.794 0L8.243 7.34z\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</svg>\n\t\t\t\t</slot>\n\t\t\t</label>\n\t\t\t<slot name=\"append\"></slot>\n\t\t</span>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { booleanishToBoolean } from '@/utilities/functions/booleanishToBoolean';\nimport { computed, ref } from 'vue';\nimport { identity } from '@/utilities/functions/identity';\nimport { isCssColor } from '@/utilities/functions/isCssColor';\nimport { isNotNil } from '@/utilities/functions/isNotNil';\nimport type { InputHTMLAttributes, HTMLAttributes } from 'vue';\nimport type { Size, BbIconProps } from '../BbIcon/BbIcon.vue';\n\nexport type BaseRatingProps = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Define a color for the component.\n\t *\n\t * Either a custom color or a coded color in common HEX, RGB, etc... format.\n\t */\n\tcolor?: string;\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\t/**\n\t * Used by v-model\n\t */\n\tmodelValue: null | number;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname: Exclude<InputHTMLAttributes['name'], undefined>;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * Maximum number of stars to render and maximum value of the component\n\t */\n\tstars?: number;\n} & Pick<BbIconProps, 'size'>;\n\ntype Option = {\n\tchecked: boolean;\n\tdisabled: boolean;\n\thighlighted: boolean;\n\tid?: string;\n\tname: string;\n\tsize: number | undefined;\n\tvalue: number;\n};\n\nconst props = withDefaults(defineProps<BaseRatingProps>(), {\n\tstars: 5,\n});\n\nexport type BaseRatingEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'mousedown', event: MouseEvent): void;\n\t(e: 'mouseup', event: MouseEvent): void;\n\t(e: 'update:modelValue', value: number | null): void;\n};\n\nexport type BaseRatingSlots = {\n\ticon?: (props: {\n\t\tchecked: boolean;\n\t\tdisabled: boolean;\n\t\tid?: string;\n\t\tsize: number | undefined;\n\t\tvalue: number;\n\t}) => any;\n\tprepend?: (props: object) => any;\n\tappend?: (props: object) => any;\n};\n\ndefineSlots<BaseRatingSlots>();\n\nconst emit = defineEmits<BaseRatingEvents>();\n\nconst container = ref<HTMLElement>();\nconst active = ref(false);\n\nconst onInputChange = (event: Event) => {\n\temit('change', event);\n\tif (event.target instanceof HTMLInputElement) {\n\t\tif (event.target.checked) {\n\t\t\temit('update:modelValue', +event.target.value);\n\t\t}\n\t}\n};\n\nconst onInputClick = (event: MouseEvent) => {\n\temit('click', event);\n\tif (event.target instanceof HTMLInputElement) {\n\t\tif (event.target.checked) {\n\t\t\tif (+event.target.value === props.modelValue) {\n\t\t\t\temit('update:modelValue', null);\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst onInputFocus = (event: FocusEvent) => {\n\temit('focus', event);\n\tif (!active.value) {\n\t\tdocument.addEventListener('focusin', onDocumentFocus, { passive: true });\n\t\tdocument.addEventListener('click', onDocumentClick, { passive: true });\n\t\tactive.value = true;\n\t}\n};\n\nconst eventListeners = {\n\tonBlur: (event: FocusEvent) => emit('blur', event),\n\tonChange: onInputChange,\n\tonClick: onInputClick,\n\tonFocus: onInputFocus,\n\tonInput: (event: Event) => emit('input', event),\n\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst sizeMap: Size = {\n\txs: 12,\n\tsm: 16,\n\tmd: 24,\n\tlg: 28,\n\txl: 36,\n\txxl: 40,\n};\n\nconst size = computed(() => {\n\tlet dimension: number | undefined;\n\tif (typeof props.size === 'string') {\n\t\tdimension = sizeMap[props.size as keyof Size] ?? parseInt(props.size, 10);\n\t} else {\n\t\tdimension = props.size;\n\t}\n\treturn dimension;\n});\n\nconst options = computed(() => {\n\treturn new Array(props.stars)\n\t\t.fill(0)\n\t\t.map((_, index) => index + 1)\n\t\t.map((number): Option => {\n\t\t\tconst id = props.id\n\t\t\t\t? [props.id, number].filter(identity).join('_')\n\t\t\t\t: undefined;\n\n\t\t\tconst checked = number === props.modelValue;\n\t\t\tconst highlighted = !!(props.modelValue && number <= props.modelValue);\n\n\t\t\tconst disabled = !!(\n\t\t\t\tprops.disabled ||\n\t\t\t\t(isNotNil(props.readonly) ? booleanishToBoolean(props.readonly) : false)\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tchecked,\n\t\t\t\tdisabled,\n\t\t\t\thighlighted,\n\t\t\t\tid,\n\t\t\t\tname: props.name,\n\t\t\t\tsize: size.value,\n\t\t\t\tvalue: number,\n\t\t\t};\n\t\t});\n});\n\nconst outerContainerAttributes = computed(() => {\n\tlet style: { [key: string]: string } = {};\n\tif (props.color && isCssColor(props.color)) {\n\t\tstyle['--color'] = props.color;\n\t}\n\tif (size.value) {\n\t\tstyle['--size'] = `${size.value}px`;\n\t}\n\treturn {\n\t\tclass: {\n\t\t\t'bb-base-rating': true,\n\t\t\t'bb-base-rating--has-value': props.modelValue,\n\t\t\t'bb-base-rating--disabled': props.disabled,\n\t\t\t'bb-base-rating--errors': props.hasErrors,\n\t\t\t'bb-base-rating--readonly': props.readonly,\n\t\t\t[`bb-base-rating--${props.color}`]:\n\t\t\t\tprops.color && !isCssColor(props.color),\n\t\t},\n\t\tstyle,\n\t};\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseRating';\n</style>\n"],"names":["props","__props","emit","__emit","container","ref","active","eventListeners","event","onDocumentFocus","onDocumentClick","_a","sizeMap","size","computed","dimension","options","_","index","number","id","identity","checked","highlighted","disabled","isNotNil","booleanishToBoolean","outerContainerAttributes","style","isCssColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmIA,UAAMA,IAAQC,GA+BRC,IAAOC,GAEPC,IAAYC,KACZC,IAASD,EAAI,EAAK,GA+BlBE,IAAiB;AAAA,MACtB,QAAQ,CAACC,MAAsBN,EAAK,QAAQM,CAAK;AAAA,MACjD,UA/BqB,CAACA,MAAiB;AACvC,QAAAN,EAAK,UAAUM,CAAK,GAChBA,EAAM,kBAAkB,oBACvBA,EAAM,OAAO,WAChBN,EAAK,qBAAqB,CAACM,EAAM,OAAO,KAAK;AAAA,MAE/C;AAAA,MA0BA,SAvBoB,CAACA,MAAsB;AAC3C,QAAAN,EAAK,SAASM,CAAK,GACfA,EAAM,kBAAkB,oBACvBA,EAAM,OAAO,WACZ,CAACA,EAAM,OAAO,UAAUR,EAAM,cACjCE,EAAK,qBAAqB,IAAI;AAAA,MAGjC;AAAA,MAgBA,SAboB,CAACM,MAAsB;AAC3C,QAAAN,EAAK,SAASM,CAAK,GACdF,EAAO,UACX,SAAS,iBAAiB,WAAWG,GAAiB,EAAE,SAAS,IAAM,GACvE,SAAS,iBAAiB,SAASC,GAAiB,EAAE,SAAS,IAAM,GACrEJ,EAAO,QAAQ;AAAA,MAChB;AAAA,MAQA,SAAS,CAACE,MAAiBN,EAAK,SAASM,CAAK;AAAA,MAC9C,WAAW,CAACA,MAAyBN,EAAK,WAAWM,CAAK;AAAA,MAC1D,aAAa,CAACA,MAAsBN,EAAK,aAAaM,CAAK;AAAA,MAC3D,WAAW,CAACA,MAAsBN,EAAK,WAAWM,CAAK;AAAA,IAAA,GAGlDC,IAAkB,CAACD,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBG,IAAAP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MpB,EAAM;AAAA,QACZ,MAAMa,EAAK;AAAA,QACX,OAAOM;AAAA,MAAA;AAAA,IACR,CACA,CACF,GAEKQ,IAA2Bb,EAAS,MAAM;AAC/C,UAAIc,IAAmC,CAAA;AACvC,aAAI5B,EAAM,SAAS6B,EAAW7B,EAAM,KAAK,MAClC4B,EAAA,SAAS,IAAI5B,EAAM,QAEtBa,EAAK,UACRe,EAAM,QAAQ,IAAI,GAAGf,EAAK,KAAK,OAEzB;AAAA,QACN,OAAO;AAAA,UACN,kBAAkB;AAAA,UAClB,6BAA6Bb,EAAM;AAAA,UACnC,4BAA4BA,EAAM;AAAA,UAClC,0BAA0BA,EAAM;AAAA,UAChC,4BAA4BA,EAAM;AAAA,UAClC,CAAC,mBAAmBA,EAAM,KAAK,EAAE,GAChCA,EAAM,SAAS,CAAC6B,EAAW7B,EAAM,KAAK;AAAA,QACxC;AAAA,QACA,OAAA4B;AAAA,MAAA;AAAA,IACD,CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index34.js","sources":["../src/components/BaseRating/BaseRating.vue"],"sourcesContent":["<template>\n\t<span v-bind=\"outerContainerAttributes\" ref=\"container\">\n\t\t<span class=\"bb-base-rating__inner-container\">\n\t\t\t<slot name=\"prepend\"></slot>\n\t\t\t<label\n\t\t\t\tv-for=\"(option, index) in options\"\n\t\t\t\t:key=\"option.value\"\n\t\t\t\tclass=\"bb-base-rating__option\"\n\t\t\t\t:class=\"{ 'bb-base-rating__option--highlighted': option.highlighted }\"\n\t\t\t>\n\t\t\t\t<span class=\"bb-base-rating__label-text sr-only\">{{\n\t\t\t\t\toption.value\n\t\t\t\t}}</span>\n\t\t\t\t<input\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t\t:autofocus=\"autofocus && !index\"\n\t\t\t\t\t:checked=\"option.checked\"\n\t\t\t\t\tclass=\"sr-only\"\n\t\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t\t:name=\"option.name\"\n\t\t\t\t\t:required=\"required\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t:value=\"option.value\"\n\t\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t\t/>\n\t\t\t\t<slot\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:checked=\"option.checked\"\n\t\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t\tname=\"icon\"\n\t\t\t\t\t:size=\"option.size\"\n\t\t\t\t\t:value=\"option.value\"\n\t\t\t\t>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t:height=\"option.size\"\n\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t:width=\"option.size\"\n\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<path\n\t\t\t\t\t\t\td=\"m8.243 7.34l-6.38.925l-.113.023a1 1 0 0 0-.44 1.684l4.622 4.499l-1.09 6.355l-.013.11a1 1 0 0 0 1.464.944l5.706-3l5.693 3l.1.046a1 1 0 0 0 1.352-1.1l-1.091-6.355l4.624-4.5l.078-.085a1 1 0 0 0-.633-1.62l-6.38-.926l-2.852-5.78a1 1 0 0 0-1.794 0L8.243 7.34z\"\n\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</svg>\n\t\t\t\t</slot>\n\t\t\t</label>\n\t\t\t<slot name=\"append\"></slot>\n\t\t</span>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { booleanishToBoolean } from '@/utilities/functions/booleanishToBoolean';\nimport { computed, ref } from 'vue';\nimport { identity } from '@/utilities/functions/identity';\nimport { isCssColor } from '@/utilities/functions/isCssColor';\nimport { isNotNil } from '@/utilities/functions/isNotNil';\nimport type { InputHTMLAttributes, HTMLAttributes } from 'vue';\nimport type { Size, BbIconProps } from '../BbIcon/BbIcon.vue';\n\nexport type BaseRatingProps = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Define a color for the component.\n\t *\n\t * Either a custom color or a coded color in common HEX, RGB, etc... format.\n\t */\n\tcolor?: string;\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\t/**\n\t * Used by v-model\n\t */\n\tmodelValue: null | number;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname: Exclude<InputHTMLAttributes['name'], undefined>;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * Maximum number of stars to render and maximum value of the component\n\t */\n\tstars?: number;\n} & Pick<BbIconProps, 'size'>;\n\ntype Option = {\n\tchecked: boolean;\n\tdisabled: boolean;\n\thighlighted: boolean;\n\tid?: string;\n\tname: string;\n\tsize: number | undefined;\n\tvalue: number;\n};\n\nconst props = withDefaults(defineProps<BaseRatingProps>(), {\n\tstars: 5,\n});\n\nexport type BaseRatingEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'mousedown', event: MouseEvent): void;\n\t(e: 'mouseup', event: MouseEvent): void;\n\t(e: 'update:modelValue', value: number | null): void;\n};\n\nexport type BaseRatingSlots = {\n\ticon?: (props: {\n\t\tchecked: boolean;\n\t\tdisabled: boolean;\n\t\tid?: string;\n\t\tsize: number | undefined;\n\t\tvalue: number;\n\t}) => any;\n\tprepend?: (props: object) => any;\n\tappend?: (props: object) => any;\n};\n\ndefineSlots<BaseRatingSlots>();\n\nconst emit = defineEmits<BaseRatingEvents>();\n\nconst container = ref<HTMLElement>();\nconst active = ref(false);\n\nconst onInputChange = (event: Event) => {\n\temit('change', event);\n\tif (event.target instanceof HTMLInputElement) {\n\t\tif (event.target.checked) {\n\t\t\temit('update:modelValue', +event.target.value);\n\t\t}\n\t}\n};\n\nconst onInputClick = (event: MouseEvent) => {\n\temit('click', event);\n\tif (event.target instanceof HTMLInputElement) {\n\t\tif (event.target.checked) {\n\t\t\tif (+event.target.value === props.modelValue) {\n\t\t\t\temit('update:modelValue', null);\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst onInputFocus = (event: FocusEvent) => {\n\temit('focus', event);\n\tif (!active.value) {\n\t\tdocument.addEventListener('focusin', onDocumentFocus, { passive: true });\n\t\tdocument.addEventListener('click', onDocumentClick, { passive: true });\n\t\tactive.value = true;\n\t}\n};\n\nconst eventListeners = {\n\tonBlur: (event: FocusEvent) => emit('blur', event),\n\tonChange: onInputChange,\n\tonClick: onInputClick,\n\tonFocus: onInputFocus,\n\tonInput: (event: Event) => emit('input', event),\n\tonKeydown: (event: KeyboardEvent) => emit('keydown', event),\n\tonMousedown: (event: MouseEvent) => emit('mousedown', event),\n\tonMouseup: (event: MouseEvent) => emit('mouseup', event),\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\temit('inactive');\n\t\t\tactive.value = false;\n\t\t\tdocument.removeEventListener('focusin', onDocumentFocus);\n\t\t\tdocument.removeEventListener('click', onDocumentClick);\n\t\t}\n\t}\n};\n\nconst sizeMap: Size = {\n\txs: 12,\n\tsm: 16,\n\tmd: 24,\n\tlg: 28,\n\txl: 36,\n\txxl: 40,\n};\n\nconst size = computed(() => {\n\tlet dimension: number | undefined;\n\tif (typeof props.size === 'string') {\n\t\tdimension = sizeMap[props.size as keyof Size] ?? parseInt(props.size, 10);\n\t} else {\n\t\tdimension = props.size;\n\t}\n\treturn dimension;\n});\n\nconst options = computed(() => {\n\treturn new Array(props.stars)\n\t\t.fill(0)\n\t\t.map((_, index) => index + 1)\n\t\t.map((number): Option => {\n\t\t\tconst id = props.id\n\t\t\t\t? [props.id, number].filter(identity).join('_')\n\t\t\t\t: undefined;\n\n\t\t\tconst checked = number === props.modelValue;\n\t\t\tconst highlighted = !!(props.modelValue && number <= props.modelValue);\n\n\t\t\tconst disabled = !!(\n\t\t\t\tprops.disabled ||\n\t\t\t\t(isNotNil(props.readonly) ? booleanishToBoolean(props.readonly) : false)\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tchecked,\n\t\t\t\tdisabled,\n\t\t\t\thighlighted,\n\t\t\t\tid,\n\t\t\t\tname: props.name,\n\t\t\t\tsize: size.value,\n\t\t\t\tvalue: number,\n\t\t\t};\n\t\t});\n});\n\nconst outerContainerAttributes = computed(() => {\n\tlet style: { [key: string]: string } = {};\n\tif (props.color && isCssColor(props.color)) {\n\t\tstyle['--color'] = props.color;\n\t}\n\tif (size.value) {\n\t\tstyle['--size'] = `${size.value}px`;\n\t}\n\treturn {\n\t\tclass: {\n\t\t\t'bb-base-rating': true,\n\t\t\t'bb-base-rating--has-value': props.modelValue,\n\t\t\t'bb-base-rating--disabled': props.disabled,\n\t\t\t'bb-base-rating--errors': props.hasErrors,\n\t\t\t'bb-base-rating--readonly': props.readonly,\n\t\t\t[`bb-base-rating--${props.color}`]:\n\t\t\t\tprops.color && !isCssColor(props.color),\n\t\t},\n\t\tstyle,\n\t};\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseRating';\n</style>\n"],"names":["props","__props","emit","__emit","container","ref","active","eventListeners","event","onDocumentFocus","onDocumentClick","_a","sizeMap","size","computed","dimension","options","_","index","number","id","identity","checked","highlighted","disabled","isNotNil","booleanishToBoolean","outerContainerAttributes","style","isCssColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmIA,UAAMA,IAAQC,GA+BRC,IAAOC,GAEPC,IAAYC,KACZC,IAASD,EAAI,EAAK,GA+BlBE,IAAiB;AAAA,MACtB,QAAQ,CAACC,MAAsBN,EAAK,QAAQM,CAAK;AAAA,MACjD,UA/BqB,CAACA,MAAiB;AACvC,QAAAN,EAAK,UAAUM,CAAK,GAChBA,EAAM,kBAAkB,oBACvBA,EAAM,OAAO,WAChBN,EAAK,qBAAqB,CAACM,EAAM,OAAO,KAAK;AAAA,MAE/C;AAAA,MA0BA,SAvBoB,CAACA,MAAsB;AAC3C,QAAAN,EAAK,SAASM,CAAK,GACfA,EAAM,kBAAkB,oBACvBA,EAAM,OAAO,WACZ,CAACA,EAAM,OAAO,UAAUR,EAAM,cACjCE,EAAK,qBAAqB,IAAI;AAAA,MAGjC;AAAA,MAgBA,SAboB,CAACM,MAAsB;AAC3C,QAAAN,EAAK,SAASM,CAAK,GACdF,EAAO,UACX,SAAS,iBAAiB,WAAWG,GAAiB,EAAE,SAAS,IAAM,GACvE,SAAS,iBAAiB,SAASC,GAAiB,EAAE,SAAS,IAAM,GACrEJ,EAAO,QAAQ;AAAA,MAChB;AAAA,MAQA,SAAS,CAACE,MAAiBN,EAAK,SAASM,CAAK;AAAA,MAC9C,WAAW,CAACA,MAAyBN,EAAK,WAAWM,CAAK;AAAA,MAC1D,aAAa,CAACA,MAAsBN,EAAK,aAAaM,CAAK;AAAA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,KAAI0B,EAAoB1B,EAAM,QAAQ;AAGxD,aAAA;AAAA,QACN,SAAAsB;AAAA,QACA,UAAAE;AAAA,QACA,aAAAD;AAAA,QACA,IAAAH;AAAA,QACA,MAAMpB,EAAM;AAAA,QACZ,MAAMa,EAAK;AAAA,QACX,OAAOM;AAAA,MAAA;AAAA,IACR,CACA,CACF,GAEKQ,IAA2Bb,EAAS,MAAM;AAC/C,UAAIc,IAAmC,CAAA;AACvC,aAAI5B,EAAM,SAAS6B,EAAW7B,EAAM,KAAK,MAClC4B,EAAA,SAAS,IAAI5B,EAAM,QAEtBa,EAAK,UACRe,EAAM,QAAQ,IAAI,GAAGf,EAAK,KAAK,OAEzB;AAAA,QACN,OAAO;AAAA,UACN,kBAAkB;AAAA,UAClB,6BAA6Bb,EAAM;AAAA,UACnC,4BAA4BA,EAAM;AAAA,UAClC,0BAA0BA,EAAM;AAAA,UAChC,4BAA4BA,EAAM;AAAA,UAClC,CAAC,mBAAmBA,EAAM,KAAK,EAAE,GAChCA,EAAM,SAAS,CAAC6B,EAAW7B,EAAM,KAAK;AAAA,QACxC;AAAA,QACA,OAAA4B;AAAA,MAAA;AAAA,IACD,CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { defineComponent as Me, defineAsyncComponent as Ne, ref as m, computed as y, toRef as I, openBlock as b, createBlock as $, normalizeClass as W, withCtx as r, renderSlot as p, unref as s, createVNode as F, createElementVNode as S, createElementBlock as M, Fragment as R, createCommentVNode as J, withDirectives as xe, isRef as He, withModifiers as c, withKeys as g, vModelDynamic as Pe, renderList as _e, mergeProps as Y, Teleport as ze, normalizeStyle as Qe, nextTick as Ke } from "vue";
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { useId as Ue } from "./index9.js";
|
|
6
|
+
import { useMobile as We } from "./index10.js";
|
|
7
|
+
import Re from "./index124.js";
|
|
7
8
|
/* empty css */
|
|
8
|
-
import { isNotNil as Je } from "./
|
|
9
|
-
import { last as Ye } from "./
|
|
10
|
-
import { matchAnyKey as j } from "./
|
|
11
|
-
import { useFloating as je } from "./
|
|
12
|
-
import { useIntersectionObserver as Ge } from "./
|
|
13
|
-
import { useLogger as Xe } from "./
|
|
14
|
-
import { useOptions as Ze } from "./
|
|
15
|
-
import { wait as T } from "./
|
|
16
|
-
import { when as et } from "./
|
|
17
|
-
import tt from "./
|
|
9
|
+
import { isNotNil as Je } from "./index131.js";
|
|
10
|
+
import { last as Ye } from "./index207.js";
|
|
11
|
+
import { matchAnyKey as j } from "./index237.js";
|
|
12
|
+
import { useFloating as je } from "./index200.js";
|
|
13
|
+
import { useIntersectionObserver as Ge } from "./index129.js";
|
|
14
|
+
import { useLogger as Xe } from "./index220.js";
|
|
15
|
+
import { useOptions as Ze } from "./index216.js";
|
|
16
|
+
import { wait as T } from "./index128.js";
|
|
17
|
+
import { when as et } from "./index223.js";
|
|
18
|
+
import tt from "./index238.js";
|
|
18
19
|
/* empty css */
|
|
19
|
-
import ot from "./
|
|
20
|
+
import ot from "./index240.js";
|
|
20
21
|
/* empty css */
|
|
21
|
-
import nt from "./
|
|
22
|
+
import nt from "./index211.js";
|
|
22
23
|
/* empty css */
|
|
23
|
-
import lt from "./
|
|
24
|
-
import { waitFor as at } from "./
|
|
25
|
-
import { autoUpdate as it, flip as rt, offset as st, shift as ut } from "./
|
|
24
|
+
import lt from "./index213.js";
|
|
25
|
+
import { waitFor as at } from "./index210.js";
|
|
26
|
+
import { autoUpdate as it, flip as rt, offset as st, shift as ut } from "./index215.js";
|
|
26
27
|
const pt = { class: "bb-base-select__input-container" }, ct = ["id", "aria-controls", "aria-describedby", "aria-expanded", "autocomplete", "autofocus", "disabled", "inputmode", "placeholder", "readonly", "required", "onKeydown"], dt = /* @__PURE__ */ S("svg", {
|
|
27
28
|
class: "bb-base-select__chevron",
|
|
28
29
|
viewBox: "0 0 24 24",
|
|
@@ -32,7 +33,7 @@ const pt = { class: "bb-base-select__input-container" }, ct = ["id", "aria-contr
|
|
|
32
33
|
d: "M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z",
|
|
33
34
|
fill: "currentColor"
|
|
34
35
|
})
|
|
35
|
-
], -1),
|
|
36
|
+
], -1), Ht = /* @__PURE__ */ Me({
|
|
36
37
|
__name: "BaseSelect",
|
|
37
38
|
props: {
|
|
38
39
|
addOptions: { type: Boolean },
|
|
@@ -75,7 +76,7 @@ const pt = { class: "bb-base-select__input-container" }, ct = ["id", "aria-contr
|
|
|
75
76
|
const t = G, h = X;
|
|
76
77
|
if (t.multiple && !Array.isArray(t.modelValue))
|
|
77
78
|
throw new Error('Multiple is set to "true" but modelValue is not an array.');
|
|
78
|
-
const Z = Ne(() => import("./
|
|
79
|
+
const Z = Ne(() => import("./index236.js")), A = m(null), B = m(null), a = m(null), N = m(null), x = m(null), u = y(
|
|
79
80
|
() => t.comma ? N.value : x.value
|
|
80
81
|
), { isMobile: ee } = We(), te = y(
|
|
81
82
|
() => t.allowWriting === "not-mobile" && ee.value ? "none" : void 0
|
|
@@ -380,6 +381,6 @@ const pt = { class: "bb-base-select__input-container" }, ct = ["id", "aria-contr
|
|
|
380
381
|
}
|
|
381
382
|
});
|
|
382
383
|
export {
|
|
383
|
-
|
|
384
|
+
Ht as default
|
|
384
385
|
};
|
|
385
|
-
//# sourceMappingURL=
|
|
386
|
+
//# sourceMappingURL=index36.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index35.js","sources":["../src/components/BaseSelect/BaseSelect.vue"],"sourcesContent":["<template>\n\t<CommonInputOuterContainer\n\t\tref=\"outerContainer\"\n\t\t:class=\"{\n\t\t\t'bb-base-select': true,\n\t\t\t'bb-base-select--active': active,\n\t\t\t'bb-base-select--shown': shown,\n\t\t\t'bb-base-select--loading': computedLoading,\n\t\t\t'bb-base-select--disabled': disabled,\n\t\t\t'bb-base-select--errors': hasErrors,\n\t\t\t'bb-base-select--readonly': readonly,\n\t\t}\"\n\t\t@click=\"onOuterContainerClick\"\n\t>\n\t\t<template #prepend-outer\n\t\t\t><slot name=\"prepend-outer\" :query=\"query\"></slot\n\t\t></template>\n\n\t\t<CommonInputInnerContainer\n\t\t\tref=\"innerContainer\"\n\t\t\t:append:icon=\"props['append:icon']\"\n\t\t\t:prepend:icon=\"props['prepend:icon']\"\n\t\t>\n\t\t\t<template #prepend><slot name=\"prepend\" :query=\"query\"></slot></template>\n\t\t\t<template #prefix><slot name=\"prefix\" /></template>\n\t\t\t<BbSmoothHeight tag=\"span\">\n\t\t\t\t<span class=\"bb-base-select__input-container\">\n\t\t\t\t\t<template v-if=\"multiple\">\n\t\t\t\t\t\t<template v-if=\"comma\">\n\t\t\t\t\t\t\t<CommaBox ref=\"commaBox\" :options=\"selectedOptions\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template v-else>\n\t\t\t\t\t\t\t<ChipsBox\n\t\t\t\t\t\t\t\tref=\"chipsBox\"\n\t\t\t\t\t\t\t\t:options=\"selectedOptions\"\n\t\t\t\t\t\t\t\t@option:unselected=\"onOptionUnselected\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</template>\n\t\t\t\t\t<input\n\t\t\t\t\t\t:id=\"id\"\n\t\t\t\t\t\tref=\"input\"\n\t\t\t\t\t\tv-model=\"query\"\n\t\t\t\t\t\t:aria-autocomplete=\"'list'\"\n\t\t\t\t\t\t:aria-controls=\"`${id}_listbox`\"\n\t\t\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t\t\t:aria-expanded=\"shown\"\n\t\t\t\t\t\t:autocomplete=\"autocomplete\"\n\t\t\t\t\t\t:autofocus=\"autofocus\"\n\t\t\t\t\t\t:class=\"'bb-base-select__text-input'\"\n\t\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t\t:inputmode=\"inputmode\"\n\t\t\t\t\t\t:placeholder=\"computedPlaceholder\"\n\t\t\t\t\t\t:readonly=\"readonly || !allowWriting\"\n\t\t\t\t\t\t:required=\"\n\t\t\t\t\t\t\t(required && !multiple) || (multiple && !modelValue.length)\n\t\t\t\t\t\t\"\n\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t:type=\"'text'\"\n\t\t\t\t\t\t@blur.stop=\"onInputBlur\"\n\t\t\t\t\t\t@change.stop=\"onInputChange\"\n\t\t\t\t\t\t@focus.once.stop=\"onInputFirstFocus\"\n\t\t\t\t\t\t@focus.stop=\"onInputFocus\"\n\t\t\t\t\t\t@input.stop=\"onInputInput\"\n\t\t\t\t\t\t@keydown.stop.delete=\"onBackspace\"\n\t\t\t\t\t\t@keydown.stop.left=\"onArrowLeft\"\n\t\t\t\t\t\t@keydown.stop.prevent.down=\"onArrowDown\"\n\t\t\t\t\t\t@keydown.stop.prevent.enter=\"onEnter\"\n\t\t\t\t\t\t@keydown.stop.prevent.esc=\"onEscape\"\n\t\t\t\t\t\t@keydown.stop.prevent.up=\"onArrowUp\"\n\t\t\t\t\t\t@keydown.stop.right=\"onArrowRight\"\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t</BbSmoothHeight>\n\t\t\t<slot :loading=\"!!innerLoading\" name=\"chevron\" :shown=\"shown\">\n\t\t\t\t<svg\n\t\t\t\t\tclass=\"bb-base-select__chevron\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t</slot>\n\t\t\t<template #append><slot name=\"append\" :query=\"query\"></slot></template>\n\n\t\t\t<template #suffix><slot name=\"suffix\" /></template>\n\t\t</CommonInputInnerContainer>\n\t\t<template #append-outer\n\t\t\t><slot name=\"append-outer\" :query=\"query\"></slot\n\t\t></template>\n\t\t<input v-for=\"input in hiddenInputs\" :key=\"input.value\" v-bind=\"input\" />\n\n\t\t<teleport v-if=\"renderListBox\" to=\"body\">\n\t\t\t<ListBox\n\t\t\t\tref=\"optionsContainer\"\n\t\t\t\t:loading=\"computedLoading\"\n\t\t\t\t:open=\"shown\"\n\t\t\t\t:options=\"filteredOptions\"\n\t\t\t\t:style=\"optionsContainerStyles\"\n\t\t\t\t@option:selected=\"onOptionSelected\"\n\t\t\t\t@option:unselected=\"onOptionUnselected\"\n\t\t\t>\n\t\t\t\t<template #options:prepend><slot name=\"options:prepend\" /></template>\n\t\t\t\t<template #loading><slot name=\"loading\" :query=\"query\" /></template>\n\t\t\t\t<template #no-data><slot name=\"no-data\" :query=\"query\" /></template>\n\t\t\t\t<template #options:append><slot name=\"options:append\" /></template>\n\t\t\t\t<template #option=\"data\"\n\t\t\t\t\t><slot\n\t\t\t\t\t\t:has-errors=\"hasErrors\"\n\t\t\t\t\t\t:loading=\"computedLoading\"\n\t\t\t\t\t\tname=\"option\"\n\t\t\t\t\t\tv-bind=\"data\"\n\t\t\t\t/></template>\n\t\t\t</ListBox>\n\t\t</teleport>\n\t</CommonInputOuterContainer>\n</template>\n\n<script setup lang=\"ts\">\nimport { BbSmoothHeight } from '@/index';\nimport { computed, ref, nextTick, defineAsyncComponent } from 'vue';\nimport { isNotNil } from '@/utilities/functions/isNotNil';\nimport { last } from '@/utilities/functions/last';\nimport { matchAnyKey } from '@/utilities/functions/matchAnyKey';\nimport { toRef } from 'vue';\nimport { useFloating, autoUpdate, flip, shift, offset } from '@floating-ui/vue';\nimport { useId } from '@/composables/useId';\nimport { useIntersectionObserver } from '@vueuse/core';\nimport { useLogger } from '@/composables/useLogger';\nimport { useMobile } from '@/composables/useMobile';\nimport { useOptions } from '@/composables/useOptions';\nimport { wait } from '@/utilities/functions/wait';\nimport { when } from '@/utilities/functions/when';\nimport ChipsBox from '../ChipsBox.vue';\nimport CommaBox from '../CommaBox.vue';\nimport CommonInputInnerContainer from '../CommonInputInnerContainer.vue';\nimport CommonInputOuterContainer from '../CommonInputOuterContainer.vue';\nimport type { HTMLAttributes, InputHTMLAttributes } from 'vue';\nimport type { Option as BaseOption } from '@/types/Option';\nimport { waitFor } from '@/utilities/functions/waitFor';\n\nexport type BaseSelectProps = {\n\t/**\n\t * Allows the user to add options to the list by\n\t * inserting text in the input and pressing ENTER.\n\t * The value and text of the option generated is a\n\t * string equal to what has been inserted.\n\t */\n\taddOptions?: boolean;\n\n\t/**\n\t * Allows typing into the input.\n\t */\n\tallowWriting?: boolean | 'not-mobile';\n\n\t/**\n\t * Name of the icon to be added at the end of the input.\n\t */\n\t// eslint-disable-next-line vue/prop-name-casing\n\t'append:icon'?: string;\n\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tautocomplete?: InputHTMLAttributes['autocomplete'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Sets the display model for selected values to a list\n\t * of comma separated string. In this mode the user\n\t * cannot deselect an option by pressing the close button.\n\t */\n\tcomma?: boolean;\n\n\t/**\n\t * Defines an array of dependencies that will trigger actions in the component upon change.\n\t */\n\tdependencies?: any[];\n\n\t/**\n\t * Timeout used to debounce response to changes to dependencies.\n\t */\n\tdepsDebounceTime?: number;\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * If coherence is enforce the input cannot have a modelValue that is incoherent with its current items.\n\t *\n\t * e.g. You cannot set v-model to a user that is not present in the items passed.\n\t *\n\t * modelValue will be reset upon incoherence.\n\t */\n\tenforceCoherence?: boolean;\n\n\t/**\n\t * Defines how the filtering should work.\n\t * In any case options are always filtered by the text displayed but\n\t * they can also take into account other properties of the\n\t * passed elements when this property is a string or an array of string.\n\t * E.g. items could be a list of users and you can filter users by email or phone by passing `['email', 'phone']`\n\t * You can also pass false to not filter anything or a function for more granular control.\n\t *\n\t */\n\tfilterBy?:\n\t\t| string\n\t\t| string[]\n\t\t| false\n\t\t| ((value: any, item: any) => boolean)\n\t\t| null;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Used to retrieve items can be an array or a function.\n\t */\n\titems:\n\t\t| any[]\n\t\t| ((query: string, prefill: boolean, modelValue: any) => Promise<any[]>)\n\t\t| ((query: string, prefill: boolean, modelValue: any) => any[]);\n\n\t/**\n\t * Defines a path that returns a property of the object to use as text or a function that returns a string\n\t */\n\titemText?: string | ((item: any) => string) | undefined;\n\n\t/**\n\t * Defines a path that returns a property of the object to use as value or a function that returns any value\n\t */\n\titemValue?: string | ((item: any) => string) | undefined;\n\n\t/**\n\t * Sets the component in a loading state, usually triggering some visual styles.\n\t */\n\tloading?: boolean;\n\n\t/**\n\t * String displayed while items are being loaded.\n\t */\n\tloadingText?: string;\n\n\t/**\n\t * Used by v-model. Can be any serializable type.\n\t */\n\tmodelValue: any;\n\n\t/**\n\t * Timeout used to debounce response to changes to modelValue.\n\t */\n\tmodelValueDebounceTime?: number;\n\n\t/**\n\t * Allows the selection of multiple items.\n\t */\n\tmultiple?: boolean;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there are no items to display.\n\t */\n\tnoDataText?: string;\n\n\t/**\n\t * String displayed when there's no data.\n\t */\n\tplaceholder?: InputHTMLAttributes['placeholder'];\n\n\t/**\n\t * Defines the prefill strategy for the input. By default the input will prefill\n\t * on focus. It can also always prefill with `true` and only prefill on search with `false`.\n\t */\n\tprefill?: boolean | 'focus';\n\n\t/**\n\t * Name of the icon to be added at the start of the input.\n\t */\n\t// eslint-disable-next-line vue/prop-name-casing\n\t'prepend:icon'?: string;\n\n\t/**\n\t * Time to wait when the users stops writing in the input before querying data.\n\t * Especially useful when searching live data on big datasets.\n\t */\n\tqueryDebounceTime?: number;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: boolean;\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * If `true` when in multiple selection, reset the query immediately\n\t * upon selecting an option. By default the query is\n\t * not reset until focus is lost so the user can search\n\t * for \"Cath\" and select \"Cathy\" and then write more to\n\t * search for \"Catherine\"\n\t */\n\tresetQueryOnOptionSelected?: boolean;\n\n\t/**\n\t * Adds a stash to accumulate selected values. Especially\n\t * useful when searching in a big database of items.\n\t * E.g. if you search for \"John\" and then search for \"Richard\"\n\t * you either always return the previous items or you stash them passing `true` to this option.\n\t */\n\tstash?: boolean;\n\n\t/**\n\t * How long the transition has to last in milliseconds\n\t */\n\ttransitionDuration?: number;\n\n\t/**\n\t * Pass `true` if the dropdown is not updating following movement in the UI, like in modals. Very expensive so use with care.\n\t */\n\tupdateOnAnimationFrame?: boolean;\n};\nexport type BaseSelectEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'update:modelValue', value: any): void;\n};\n\nexport type BaseSelectSlots = {\n\tappend?: (props: { query: string }) => any;\n\t'append-outer'?: (props: { query: string }) => any;\n\tchevron?: (props: { loading: boolean; shown: boolean }) => any;\n\tchip?: (props: {\n\t\tdisabled: boolean | undefined;\n\t\thasErrors?: boolean;\n\t\tindex: number;\n\t\titem: any;\n\t\tloading: boolean;\n\t\tmanual: boolean;\n\t\tselected: boolean | undefined;\n\t\ttext: string;\n\t\tvalue: any;\n\t}) => any;\n\tloading?: (props: { query: string }) => any;\n\t'no-data'?: (props: { query: string }) => any;\n\toption?: (props: {\n\t\tdisabled: boolean;\n\t\tfocused: boolean;\n\t\tindex: number;\n\t\thasErrors?: boolean;\n\t\titem: any;\n\t\tloading: boolean;\n\t\tselected: boolean;\n\t\ttext: string;\n\t\tvalue: any;\n\t}) => any;\n\t'option:append'?: (props: { item: any }) => any;\n\t'option:prepend'?: (props: { item: any }) => any;\n\t'options:append'?: (props: object) => any;\n\t'options:prepend'?: (props: object) => any;\n\tprefix?: (props: object) => any;\n\tprepend?: (props: { query: string }) => any;\n\t'prepend-outer'?: (props: { query: string }) => any;\n\tsuffix?: (props: object) => any;\n};\n\nconst props = withDefaults(defineProps<BaseSelectProps>(), {\n\tallowWriting: true,\n\tdepsDebounceTime: 0,\n\tdependencies: () => [],\n\tfilterBy: () => [],\n\tloadingText: 'Caricamento...',\n\tmodelValueDebounceTime: 0,\n\tnoDataText: 'Nessun elemento da visualizzare',\n\tprefill: 'focus',\n\tqueryDebounceTime: 500,\n\ttransitionDuration: 300,\n\tupdateOnAnimationFrame: false,\n});\n\nconst emit = defineEmits<BaseSelectEvents>();\n\ndefineSlots<BaseSelectSlots>();\n\nif (props.multiple && !Array.isArray(props.modelValue)) {\n\tthrow new Error('Multiple is set to \"true\" but modelValue is not an array.');\n}\n\n/**\n * START ELEMENT REFERENCES\n */\nconst ListBox = defineAsyncComponent(() => import('../ListBox.vue'));\nconst outerContainer = ref<InstanceType<\n\ttypeof CommonInputOuterContainer\n> | null>(null);\nconst innerContainer = ref<InstanceType<\n\ttypeof CommonInputInnerContainer\n> | null>(null);\nconst optionsContainer = ref<InstanceType<typeof ListBox> | null>(null);\nconst commaBox = ref<InstanceType<typeof CommaBox> | null>(null);\nconst chipsBox = ref<InstanceType<typeof ChipsBox> | null>(null);\nconst selectedBox = computed(() =>\n\tprops.comma ? commaBox.value : chipsBox.value\n);\n/**\n * END ELEMENT REFERENCES\n */\n\nconst { isMobile } = useMobile();\nconst inputmode = computed(() =>\n\tprops.allowWriting === 'not-mobile' && isMobile.value ? 'none' : undefined\n);\n\n// Always provide an id so that inputs can be focussed by clicking oin the label\nconst id = props.id || useId().id.value;\n\nuseIntersectionObserver(\n\tinnerContainer,\n\t([{ intersectionRatio }]) => {\n\t\tif (intersectionRatio !== 1) {\n\t\t\tclose();\n\t\t}\n\t},\n\t{ threshold: [0, 1] }\n);\n\nconst { floatingStyles } = useFloating(\n\tinnerContainer,\n\toptionsContainer as any,\n\t{\n\t\tplacement: 'bottom',\n\t\twhileElementsMounted: autoUpdate,\n\t\tmiddleware: [flip(), offset(5), shift()],\n\t}\n);\n\nconst optionsContainerStyles = computed(() => {\n\tconst base: Record<string, any> = {\n\t\t...floatingStyles.value,\n\t\tzIndex: '10',\n\t};\n\tif (innerContainer.value) {\n\t\tbase.width = `${innerContainer.value?.$el.clientWidth}px`;\n\t}\n\n\treturn base;\n});\n\n/**\n * START INPUT HANDLING\n */\nconst input = ref<HTMLElement | null>(null);\nconst focusInput = () => {\n\tif (input.value instanceof HTMLInputElement) {\n\t\tinput.value.focus();\n\t}\n};\n\n/**\n * When the focus goes to the input we select the current text\n * so the user can replace or delete it.\n * On top of that if the prefill strategy is to prefill on first focus and options\n * weren't already retrieved by the watcher on mount, we do that\n */\nconst onInputFocus = async (event: FocusEvent) => {\n\temit('focus', event);\n\tsetActive();\n\tdocument.addEventListener('click', onOutsideInteraction);\n\tdocument.addEventListener('focusin', onOutsideInteraction);\n};\n\nconst onInputFirstFocus = () => {\n\tif (props.prefill === 'focus' && !isPrefilling.value && !hasPrefilled.value) {\n\t\tprefillItems();\n\t}\n};\n\nconst onInputBlur = async (event: FocusEvent) => {\n\temit('blur', event);\n};\n\nconst onInputChange = (event: Event) => emit('change', event);\n\n/**\n * Search at every input by the user.\n * When the user deletes the query unselect the current option\n */\nconst onInputInput = (event: Event) => {\n\temit('input', event);\n\tif (query.value === '') {\n\t\tif (!props.multiple) {\n\t\t\tupdateModelValue(null);\n\t\t}\n\t}\n\tselectedBox.value?.blur();\n\tsearchByQuery();\n};\n\n/**\n * On click outside of the container close the panel, remove active state.\n * In multiple selection clear query after a timeout\n */\nconst onOutsideInteraction = async (event: Event) => {\n\tif (event.target instanceof Node) {\n\t\tif (outerContainer.value && optionsContainer.value) {\n\t\t\tif (\n\t\t\t\t!outerContainer.value.$el.contains(event.target) &&\n\t\t\t\t!optionsContainer.value.$el.contains(event.target)\n\t\t\t) {\n\t\t\t\tclose();\n\t\t\t\tsetInactive();\n\t\t\t\tdocument.removeEventListener('click', onOutsideInteraction);\n\t\t\t\tdocument.removeEventListener('focusin', onOutsideInteraction);\n\t\t\t\tawait wait(props.transitionDuration);\n\t\t\t\talignQueryToState();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst canProcessKeyboardBindings = computed(() => {\n\tif (props.readonly) return false;\n\tif (props.disabled) return false;\n\tif (computedLoading.value) return false;\n\tif (!selectedBox.value && props.multiple) return false;\n\treturn true;\n});\n\n/**\n * On arrow prevent the page from scrolling.\n * Reset horizontal focus\n * When the panel is open\n * - Focus on the previous option\n * When the panel is closed\n * - focus on the first selected option\n */\nconst onArrowUp = async () => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\t// Reset horizontal focus while moving vertically\n\tselectedBox.value?.blur();\n\tif (shown.value) {\n\t\toptionsContainer.value?.focusPrevious();\n\t} else {\n\t\tawait open();\n\t\tawait wait(props.transitionDuration);\n\t\toptionsContainer.value?.focusLastSelected();\n\t}\n};\n\nconst onArrowDown = async () => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\t// Reset horizontal focus while moving vertically\n\tselectedBox.value?.blur();\n\tif (shown.value) {\n\t\toptionsContainer.value?.focusNext();\n\t} else {\n\t\tawait open();\n\t\tawait wait(props.transitionDuration);\n\t\toptionsContainer.value?.focusFirstSelected();\n\t}\n};\n\nconst onArrowLeft = (event: KeyboardEvent) => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\tif (!props.multiple || query.value) {\n\t\treturn;\n\t}\n\tevent.preventDefault();\n\t// Reset vertical focus while moving horizontally\n\toptionsContainer.value?.blur();\n\tif (!selectedOptions.value.length) return;\n\tselectedBox.value?.focusPrevious();\n\tconst highlightedOption = selectedBox.value?.getHighlighted();\n\tif (highlightedOption) {\n\t\toptionsContainer.value?.focusByHash(highlightedOption.valueHash);\n\t}\n};\n\nconst onArrowRight = (event: KeyboardEvent) => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\tif (!props.multiple || query.value) {\n\t\treturn;\n\t}\n\tevent.preventDefault();\n\t// Reset vertical focus while moving horizontally\n\toptionsContainer.value?.blur();\n\tif (!selectedOptions.value.length) return;\n\tselectedBox.value?.focusNext();\n\tconst highlightedOption = selectedBox.value?.getHighlighted();\n\tif (highlightedOption) {\n\t\toptionsContainer.value?.focusByHash(highlightedOption.valueHash);\n\t}\n};\n\nconst onEnter = async () => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\tif (!shown.value) {\n\t\tawait open();\n\t\tawait wait(props.transitionDuration);\n\t\tif (selectedOptions.value.length) {\n\t\t\toptionsContainer.value?.focusFirstSelected();\n\t\t}\n\t} else if (optionsContainer.value?.getHighlighted()) {\n\t\toptionsContainer.value.confirmOption();\n\t} else if (props.addOptions) {\n\t\tif (props.itemText || props.itemValue) {\n\t\t\tconst { error } = useLogger();\n\t\t\terror(\n\t\t\t\t`Adding an option for mapped items is not supported. You can't create an option while passing \"item-text\" or \"item-value\".`\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tconst text = query.value.trim();\n\t\t// Do not add manual items that are already present\n\t\tif (valueIsSelected(text)) return;\n\t\taddCurrentQueryToManualItems();\n\t\tonOptionSelected(last(manualItems.value)!);\n\t}\n};\n\nconst onEscape = async () => {\n\tif (shown.value) {\n\t\tawait close();\n\t}\n};\n\n/**\n * Delete behavior is different when query is empty\n * If query is empty\n * If no chip is selected - select rightmost chip\n * If a chip is selected - deselect that option\n * If any option remains move focus to that or reset\n */\nconst onBackspace = async () => {\n\tif (\n\t\t!canProcessKeyboardBindings.value ||\n\t\tquery.value ||\n\t\t!selectedOptions.value.length\n\t) {\n\t\treturn;\n\t}\n\tif (selectedBox.value?.getHighlighted()) {\n\t\tselectedBox.value.confirmOption();\n\t}\n\tawait nextTick();\n\tselectedBox.value?.focusPrevious();\n};\n\n/**\n * It should prefill if asked, or\n * when single if modelValue is not null\n * when multiple if modelValue is not empty\n */\nconst shouldPrefill =\n\tprops.prefill === true ||\n\t(!props.multiple && isNotNil(props.modelValue)) ||\n\t(props.multiple && !!props.modelValue.length);\n\nconst {\n\tquery,\n\talignQueryToState,\n\taddCurrentQueryToManualItems,\n\tinnerLoading,\n\toptions,\n\tselectedOptions,\n\tselectOption,\n\tunselectOption,\n\tprefillItems,\n\tisPrefilling,\n\thasPrefilled,\n\tupdateModelValue,\n\tvalueIsSelected,\n\tmanualItems,\n\tsearchByQuery,\n} = useOptions({\n\temit,\n\titemText: props.itemText,\n\titemValue: props.itemValue,\n\tmodelValue: toRef(props, 'modelValue'),\n\tmultiple: props.multiple,\n\tresetQueryOnOptionSelected: props.resetQueryOnOptionSelected,\n\tstash: props.stash,\n\titems: toRef(props, 'items'),\n\tenforceCoherence: props.enforceCoherence,\n\tprefill: shouldPrefill,\n\tmodelValueDebounceTime: props.modelValueDebounceTime,\n\tdependencies: toRef(props, 'dependencies'),\n\tdepsDebounceTime: props.depsDebounceTime,\n\tqueryDebounceTime: props.queryDebounceTime,\n\tdisabled: toRef(props, 'disabled'),\n});\n\nconst computedPlaceholder = computed(() => {\n\tif (selectedOptions.value.length) return '';\n\telse return props.placeholder;\n});\n\nconst computedLoading = computed(() => !!(innerLoading.value || props.loading));\n\n/**\n * Filter options to be displayed based on the current query.\n * If no query is used or when query is set from the inside (after a selection) display all possible options\n */\nconst filteredOptions = computed<BaseOption[]>(() => {\n\tlet base = [];\n\t/** Only filter when a value is being searched not when the query is fully set on a selected option text */\n\tconst queryMatchesASelectedOption = selectedOptions.value.some(\n\t\t(option: BaseOption) => option.text === query.value\n\t);\n\tconst shouldFilter =\n\t\t(props.multiple && query.value) ||\n\t\t(query.value && !queryMatchesASelectedOption && !props.multiple);\n\n\tif (shouldFilter && props.filterBy) {\n\t\tbase = options.value.filter((item: BaseOption) => {\n\t\t\tlet matchedAnything = false;\n\t\t\tif (typeof props.filterBy === 'function')\n\t\t\t\tmatchedAnything = props.filterBy(item.value, item.item);\n\t\t\telse if (Array.isArray(props.filterBy) && props.filterBy.length) {\n\t\t\t\tmatchedAnything =\n\t\t\t\t\tmatchedAnything ||\n\t\t\t\t\tmatchAnyKey(item.item, props.filterBy, query.value.trim());\n\t\t\t}\n\t\t\treturn matchedAnything || matchAnyKey(item, ['text'], query.value.trim());\n\t\t});\n\t\t/** Otherwise default to the whole set of options */\n\t} else base = options.value;\n\n\t/** This is done here so that only visible options are highlighted */\n\treturn base;\n});\n\nconst onOptionSelected = (option: BaseOption) => {\n\tselectOption(option);\n\tfocusInput();\n\tif (!props.multiple) {\n\t\tclose();\n\t}\n};\n\nconst onOptionUnselected = (option: BaseOption) => {\n\tunselectOption(option);\n\tfocusInput();\n};\n\n/**\n * We need the transitions because elements must be hidden and shown\n * to accessibility tools when they are fully closed or fully open,\n * while still being animated for sighted users.\n */\n\n// Option panel is open\nconst shown = ref(false);\n// Option panel il closed\nconst hidden = ref(true);\n\nconst renderListBox = ref(false);\n\nconst open = async () => {\n\trenderListBox.value = true;\n\tawait waitFor(() => !!optionsContainer.value);\n\thidden.value = false;\n\tshown.value = true;\n};\n\nconst close = async () => {\n\tshown.value = false;\n\thidden.value = true;\n\tselectedBox.value?.blur();\n};\n\nconst toggle = () => {\n\tif (shown.value) return close();\n\treturn open();\n};\n\n/**\n * Applies a class when the user is inside this whole component.\n * We cannot use focus within as it doesn't work for elements that are teleported.\n * Also we cannot use the <input/> if we physically move focus to the options so\n * we track it manually.\n */\nconst active = ref(false);\n\nconst setActive = () => {\n\tactive.value = true;\n};\nconst setInactive = () => {\n\tactive.value = false;\n\temit('inactive');\n};\n\n/**\n * When clicking on the outside container seamlessly move focus to the input and open the panel\n */\nconst onOuterContainerClick = (event: MouseEvent) => {\n\tevent.preventDefault();\n\temit('click', event);\n\tif (props.disabled || props.readonly) return;\n\tfocusInput();\n\ttoggle();\n};\n\n/**\n * When using this component for submission we add a bunch of hidden\n * inputs so the submitted inputs are on par with v-model\n */\n/**\n * This is used to keep the value compatible to common html expected values.\n * Convert to string everything that's not but do not double encode strings\n */\nconst makeInputValue = when(\n\t(item: unknown) => typeof item !== 'string',\n\tJSON.stringify\n);\n\nconst hiddenInputs = computed(() => {\n\treturn [].concat(props.modelValue).map((current) => {\n\t\tconst value = makeInputValue(current);\n\t\treturn {\n\t\t\tdisabled: props.disabled,\n\t\t\tname: props.name,\n\t\t\ttype: 'hidden',\n\t\t\tvalue: value,\n\t\t};\n\t});\n});\n</script>\n<style lang=\"postcss\">\n@import '@/assets/css/BaseSelect';\n</style>\n"],"names":["props","__props","emit","__emit","ListBox","defineAsyncComponent","outerContainer","ref","innerContainer","optionsContainer","commaBox","chipsBox","selectedBox","computed","isMobile","useMobile","inputmode","id","useId","useIntersectionObserver","intersectionRatio","close","floatingStyles","useFloating","autoUpdate","flip","offset","shift","optionsContainerStyles","base","_a","input","focusInput","onInputFocus","event","setActive","onOutsideInteraction","onInputFirstFocus","isPrefilling","hasPrefilled","prefillItems","onInputBlur","onInputChange","onInputInput","query","updateModelValue","searchByQuery","setInactive","wait","alignQueryToState","canProcessKeyboardBindings","computedLoading","onArrowUp","shown","_b","open","_c","onArrowDown","onArrowLeft","selectedOptions","highlightedOption","_d","onArrowRight","onEnter","error","useLogger","text","valueIsSelected","addCurrentQueryToManualItems","onOptionSelected","last","manualItems","onEscape","onBackspace","nextTick","shouldPrefill","isNotNil","innerLoading","options","selectOption","unselectOption","useOptions","toRef","computedPlaceholder","filteredOptions","queryMatchesASelectedOption","option","item","matchedAnything","matchAnyKey","onOptionUnselected","hidden","renderListBox","waitFor","toggle","active","onOuterContainerClick","makeInputValue","when","hiddenInputs","current","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8YA,UAAMA,IAAQC,GAcRC,IAAOC;AAIb,QAAIH,EAAM,YAAY,CAAC,MAAM,QAAQA,EAAM,UAAU;AAC9C,YAAA,IAAI,MAAM,2DAA2D;AAM5E,UAAMI,IAAUC,GAAqB,MAAM,OAAO,eAAgB,CAAC,GAC7DC,IAAiBC,EAEb,IAAI,GACRC,IAAiBD,EAEb,IAAI,GACRE,IAAmBF,EAAyC,IAAI,GAChEG,IAAWH,EAA0C,IAAI,GACzDI,IAAWJ,EAA0C,IAAI,GACzDK,IAAcC;AAAA,MAAS,MAC5Bb,EAAM,QAAQU,EAAS,QAAQC,EAAS;AAAA,IAAA,GAMnC,EAAE,UAAAG,OAAaC,MACfC,KAAYH;AAAA,MAAS,MAC1Bb,EAAM,iBAAiB,gBAAgBc,GAAS,QAAQ,SAAS;AAAA,IAAA,GAI5DG,IAAKjB,EAAM,MAAMkB,KAAQ,GAAG;AAElC,IAAAC;AAAA,MACCX;AAAA,MACA,CAAC,CAAC,EAAE,mBAAAY,EAAA,CAAmB,MAAM;AAC5B,QAAIA,MAAsB,KACnBC;MAER;AAAA,MACA,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE;AAAA,IAAA;AAGf,UAAA,EAAE,gBAAAC,OAAmBC;AAAA,MAC1Bf;AAAA,MACAC;AAAA,MACA;AAAA,QACC,WAAW;AAAA,QACX,sBAAsBe;AAAA,QACtB,YAAY,CAACC,GAAK,GAAGC,GAAO,CAAC,GAAGC,IAAO;AAAA,MACxC;AAAA,IAAA,GAGKC,KAAyBf,EAAS,MAAM;;AAC7C,YAAMgB,IAA4B;AAAA,QACjC,GAAGP,GAAe;AAAA,QAClB,QAAQ;AAA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,IAAI,CAACoG,MAAY;AAC7C,YAAAC,IAAQJ,GAAeG,CAAO;AAC7B,aAAA;AAAA,QACN,UAAUpG,EAAM;AAAA,QAChB,MAAMA,EAAM;AAAA,QACZ,MAAM;AAAA,QACN,OAAAqG;AAAA,MAAA;AAAA,IACD,CACA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index36.js","sources":["../src/components/BaseSelect/BaseSelect.vue"],"sourcesContent":["<template>\n\t<CommonInputOuterContainer\n\t\tref=\"outerContainer\"\n\t\t:class=\"{\n\t\t\t'bb-base-select': true,\n\t\t\t'bb-base-select--active': active,\n\t\t\t'bb-base-select--shown': shown,\n\t\t\t'bb-base-select--loading': computedLoading,\n\t\t\t'bb-base-select--disabled': disabled,\n\t\t\t'bb-base-select--errors': hasErrors,\n\t\t\t'bb-base-select--readonly': readonly,\n\t\t}\"\n\t\t@click=\"onOuterContainerClick\"\n\t>\n\t\t<template #prepend-outer\n\t\t\t><slot name=\"prepend-outer\" :query=\"query\"></slot\n\t\t></template>\n\n\t\t<CommonInputInnerContainer\n\t\t\tref=\"innerContainer\"\n\t\t\t:append:icon=\"props['append:icon']\"\n\t\t\t:prepend:icon=\"props['prepend:icon']\"\n\t\t>\n\t\t\t<template #prepend><slot name=\"prepend\" :query=\"query\"></slot></template>\n\t\t\t<template #prefix><slot name=\"prefix\" /></template>\n\t\t\t<BbSmoothHeight tag=\"span\">\n\t\t\t\t<span class=\"bb-base-select__input-container\">\n\t\t\t\t\t<template v-if=\"multiple\">\n\t\t\t\t\t\t<template v-if=\"comma\">\n\t\t\t\t\t\t\t<CommaBox ref=\"commaBox\" :options=\"selectedOptions\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template v-else>\n\t\t\t\t\t\t\t<ChipsBox\n\t\t\t\t\t\t\t\tref=\"chipsBox\"\n\t\t\t\t\t\t\t\t:options=\"selectedOptions\"\n\t\t\t\t\t\t\t\t@option:unselected=\"onOptionUnselected\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</template>\n\t\t\t\t\t<input\n\t\t\t\t\t\t:id=\"id\"\n\t\t\t\t\t\tref=\"input\"\n\t\t\t\t\t\tv-model=\"query\"\n\t\t\t\t\t\t:aria-autocomplete=\"'list'\"\n\t\t\t\t\t\t:aria-controls=\"`${id}_listbox`\"\n\t\t\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t\t\t:aria-expanded=\"shown\"\n\t\t\t\t\t\t:autocomplete=\"autocomplete\"\n\t\t\t\t\t\t:autofocus=\"autofocus\"\n\t\t\t\t\t\t:class=\"'bb-base-select__text-input'\"\n\t\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t\t:inputmode=\"inputmode\"\n\t\t\t\t\t\t:placeholder=\"computedPlaceholder\"\n\t\t\t\t\t\t:readonly=\"readonly || !allowWriting\"\n\t\t\t\t\t\t:required=\"\n\t\t\t\t\t\t\t(required && !multiple) || (multiple && !modelValue.length)\n\t\t\t\t\t\t\"\n\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t:type=\"'text'\"\n\t\t\t\t\t\t@blur.stop=\"onInputBlur\"\n\t\t\t\t\t\t@change.stop=\"onInputChange\"\n\t\t\t\t\t\t@focus.once.stop=\"onInputFirstFocus\"\n\t\t\t\t\t\t@focus.stop=\"onInputFocus\"\n\t\t\t\t\t\t@input.stop=\"onInputInput\"\n\t\t\t\t\t\t@keydown.stop.delete=\"onBackspace\"\n\t\t\t\t\t\t@keydown.stop.left=\"onArrowLeft\"\n\t\t\t\t\t\t@keydown.stop.prevent.down=\"onArrowDown\"\n\t\t\t\t\t\t@keydown.stop.prevent.enter=\"onEnter\"\n\t\t\t\t\t\t@keydown.stop.prevent.esc=\"onEscape\"\n\t\t\t\t\t\t@keydown.stop.prevent.up=\"onArrowUp\"\n\t\t\t\t\t\t@keydown.stop.right=\"onArrowRight\"\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t</BbSmoothHeight>\n\t\t\t<slot :loading=\"!!innerLoading\" name=\"chevron\" :shown=\"shown\">\n\t\t\t\t<svg\n\t\t\t\t\tclass=\"bb-base-select__chevron\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t</slot>\n\t\t\t<template #append><slot name=\"append\" :query=\"query\"></slot></template>\n\n\t\t\t<template #suffix><slot name=\"suffix\" /></template>\n\t\t</CommonInputInnerContainer>\n\t\t<template #append-outer\n\t\t\t><slot name=\"append-outer\" :query=\"query\"></slot\n\t\t></template>\n\t\t<input v-for=\"input in hiddenInputs\" :key=\"input.value\" v-bind=\"input\" />\n\n\t\t<teleport v-if=\"renderListBox\" to=\"body\">\n\t\t\t<ListBox\n\t\t\t\tref=\"optionsContainer\"\n\t\t\t\t:loading=\"computedLoading\"\n\t\t\t\t:open=\"shown\"\n\t\t\t\t:options=\"filteredOptions\"\n\t\t\t\t:style=\"optionsContainerStyles\"\n\t\t\t\t@option:selected=\"onOptionSelected\"\n\t\t\t\t@option:unselected=\"onOptionUnselected\"\n\t\t\t>\n\t\t\t\t<template #options:prepend><slot name=\"options:prepend\" /></template>\n\t\t\t\t<template #loading><slot name=\"loading\" :query=\"query\" /></template>\n\t\t\t\t<template #no-data><slot name=\"no-data\" :query=\"query\" /></template>\n\t\t\t\t<template #options:append><slot name=\"options:append\" /></template>\n\t\t\t\t<template #option=\"data\"\n\t\t\t\t\t><slot\n\t\t\t\t\t\t:has-errors=\"hasErrors\"\n\t\t\t\t\t\t:loading=\"computedLoading\"\n\t\t\t\t\t\tname=\"option\"\n\t\t\t\t\t\tv-bind=\"data\"\n\t\t\t\t/></template>\n\t\t\t</ListBox>\n\t\t</teleport>\n\t</CommonInputOuterContainer>\n</template>\n\n<script setup lang=\"ts\">\nimport { BbSmoothHeight } from '@/index';\nimport { computed, ref, nextTick, defineAsyncComponent } from 'vue';\nimport { isNotNil } from '@/utilities/functions/isNotNil';\nimport { last } from '@/utilities/functions/last';\nimport { matchAnyKey } from '@/utilities/functions/matchAnyKey';\nimport { toRef } from 'vue';\nimport { useFloating, autoUpdate, flip, shift, offset } from '@floating-ui/vue';\nimport { useId } from '@/composables/useId';\nimport { useIntersectionObserver } from '@vueuse/core';\nimport { useLogger } from '@/composables/useLogger';\nimport { useMobile } from '@/composables/useMobile';\nimport { useOptions } from '@/composables/useOptions';\nimport { wait } from '@/utilities/functions/wait';\nimport { when } from '@/utilities/functions/when';\nimport ChipsBox from '../ChipsBox.vue';\nimport CommaBox from '../CommaBox.vue';\nimport CommonInputInnerContainer from '../CommonInputInnerContainer.vue';\nimport CommonInputOuterContainer from '../CommonInputOuterContainer.vue';\nimport type { HTMLAttributes, InputHTMLAttributes } from 'vue';\nimport type { Option as BaseOption } from '@/types/Option';\nimport { waitFor } from '@/utilities/functions/waitFor';\n\nexport type BaseSelectProps = {\n\t/**\n\t * Allows the user to add options to the list by\n\t * inserting text in the input and pressing ENTER.\n\t * The value and text of the option generated is a\n\t * string equal to what has been inserted.\n\t */\n\taddOptions?: boolean;\n\n\t/**\n\t * Allows typing into the input.\n\t */\n\tallowWriting?: boolean | 'not-mobile';\n\n\t/**\n\t * Name of the icon to be added at the end of the input.\n\t */\n\t// eslint-disable-next-line vue/prop-name-casing\n\t'append:icon'?: string;\n\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tautocomplete?: InputHTMLAttributes['autocomplete'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Sets the display model for selected values to a list\n\t * of comma separated string. In this mode the user\n\t * cannot deselect an option by pressing the close button.\n\t */\n\tcomma?: boolean;\n\n\t/**\n\t * Defines an array of dependencies that will trigger actions in the component upon change.\n\t */\n\tdependencies?: any[];\n\n\t/**\n\t * Timeout used to debounce response to changes to dependencies.\n\t */\n\tdepsDebounceTime?: number;\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * If coherence is enforce the input cannot have a modelValue that is incoherent with its current items.\n\t *\n\t * e.g. You cannot set v-model to a user that is not present in the items passed.\n\t *\n\t * modelValue will be reset upon incoherence.\n\t */\n\tenforceCoherence?: boolean;\n\n\t/**\n\t * Defines how the filtering should work.\n\t * In any case options are always filtered by the text displayed but\n\t * they can also take into account other properties of the\n\t * passed elements when this property is a string or an array of string.\n\t * E.g. items could be a list of users and you can filter users by email or phone by passing `['email', 'phone']`\n\t * You can also pass false to not filter anything or a function for more granular control.\n\t *\n\t */\n\tfilterBy?:\n\t\t| string\n\t\t| string[]\n\t\t| false\n\t\t| ((value: any, item: any) => boolean)\n\t\t| null;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Used to retrieve items can be an array or a function.\n\t */\n\titems:\n\t\t| any[]\n\t\t| ((query: string, prefill: boolean, modelValue: any) => Promise<any[]>)\n\t\t| ((query: string, prefill: boolean, modelValue: any) => any[]);\n\n\t/**\n\t * Defines a path that returns a property of the object to use as text or a function that returns a string\n\t */\n\titemText?: string | ((item: any) => string) | undefined;\n\n\t/**\n\t * Defines a path that returns a property of the object to use as value or a function that returns any value\n\t */\n\titemValue?: string | ((item: any) => string) | undefined;\n\n\t/**\n\t * Sets the component in a loading state, usually triggering some visual styles.\n\t */\n\tloading?: boolean;\n\n\t/**\n\t * String displayed while items are being loaded.\n\t */\n\tloadingText?: string;\n\n\t/**\n\t * Used by v-model. Can be any serializable type.\n\t */\n\tmodelValue: any;\n\n\t/**\n\t * Timeout used to debounce response to changes to modelValue.\n\t */\n\tmodelValueDebounceTime?: number;\n\n\t/**\n\t * Allows the selection of multiple items.\n\t */\n\tmultiple?: boolean;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * String displayed when there are no items to display.\n\t */\n\tnoDataText?: string;\n\n\t/**\n\t * String displayed when there's no data.\n\t */\n\tplaceholder?: InputHTMLAttributes['placeholder'];\n\n\t/**\n\t * Defines the prefill strategy for the input. By default the input will prefill\n\t * on focus. It can also always prefill with `true` and only prefill on search with `false`.\n\t */\n\tprefill?: boolean | 'focus';\n\n\t/**\n\t * Name of the icon to be added at the start of the input.\n\t */\n\t// eslint-disable-next-line vue/prop-name-casing\n\t'prepend:icon'?: string;\n\n\t/**\n\t * Time to wait when the users stops writing in the input before querying data.\n\t * Especially useful when searching live data on big datasets.\n\t */\n\tqueryDebounceTime?: number;\n\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: boolean;\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * If `true` when in multiple selection, reset the query immediately\n\t * upon selecting an option. By default the query is\n\t * not reset until focus is lost so the user can search\n\t * for \"Cath\" and select \"Cathy\" and then write more to\n\t * search for \"Catherine\"\n\t */\n\tresetQueryOnOptionSelected?: boolean;\n\n\t/**\n\t * Adds a stash to accumulate selected values. Especially\n\t * useful when searching in a big database of items.\n\t * E.g. if you search for \"John\" and then search for \"Richard\"\n\t * you either always return the previous items or you stash them passing `true` to this option.\n\t */\n\tstash?: boolean;\n\n\t/**\n\t * How long the transition has to last in milliseconds\n\t */\n\ttransitionDuration?: number;\n\n\t/**\n\t * Pass `true` if the dropdown is not updating following movement in the UI, like in modals. Very expensive so use with care.\n\t */\n\tupdateOnAnimationFrame?: boolean;\n};\nexport type BaseSelectEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'change', event: Event): void;\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'inactive'): void;\n\t(e: 'input', event: Event): void;\n\t(e: 'update:modelValue', value: any): void;\n};\n\nexport type BaseSelectSlots = {\n\tappend?: (props: { query: string }) => any;\n\t'append-outer'?: (props: { query: string }) => any;\n\tchevron?: (props: { loading: boolean; shown: boolean }) => any;\n\tchip?: (props: {\n\t\tdisabled: boolean | undefined;\n\t\thasErrors?: boolean;\n\t\tindex: number;\n\t\titem: any;\n\t\tloading: boolean;\n\t\tmanual: boolean;\n\t\tselected: boolean | undefined;\n\t\ttext: string;\n\t\tvalue: any;\n\t}) => any;\n\tloading?: (props: { query: string }) => any;\n\t'no-data'?: (props: { query: string }) => any;\n\toption?: (props: {\n\t\tdisabled: boolean;\n\t\tfocused: boolean;\n\t\tindex: number;\n\t\thasErrors?: boolean;\n\t\titem: any;\n\t\tloading: boolean;\n\t\tselected: boolean;\n\t\ttext: string;\n\t\tvalue: any;\n\t}) => any;\n\t'option:append'?: (props: { item: any }) => any;\n\t'option:prepend'?: (props: { item: any }) => any;\n\t'options:append'?: (props: object) => any;\n\t'options:prepend'?: (props: object) => any;\n\tprefix?: (props: object) => any;\n\tprepend?: (props: { query: string }) => any;\n\t'prepend-outer'?: (props: { query: string }) => any;\n\tsuffix?: (props: object) => any;\n};\n\nconst props = withDefaults(defineProps<BaseSelectProps>(), {\n\tallowWriting: true,\n\tdepsDebounceTime: 0,\n\tdependencies: () => [],\n\tfilterBy: () => [],\n\tloadingText: 'Caricamento...',\n\tmodelValueDebounceTime: 0,\n\tnoDataText: 'Nessun elemento da visualizzare',\n\tprefill: 'focus',\n\tqueryDebounceTime: 500,\n\ttransitionDuration: 300,\n\tupdateOnAnimationFrame: false,\n});\n\nconst emit = defineEmits<BaseSelectEvents>();\n\ndefineSlots<BaseSelectSlots>();\n\nif (props.multiple && !Array.isArray(props.modelValue)) {\n\tthrow new Error('Multiple is set to \"true\" but modelValue is not an array.');\n}\n\n/**\n * START ELEMENT REFERENCES\n */\nconst ListBox = defineAsyncComponent(() => import('../ListBox.vue'));\nconst outerContainer = ref<InstanceType<\n\ttypeof CommonInputOuterContainer\n> | null>(null);\nconst innerContainer = ref<InstanceType<\n\ttypeof CommonInputInnerContainer\n> | null>(null);\nconst optionsContainer = ref<InstanceType<typeof ListBox> | null>(null);\nconst commaBox = ref<InstanceType<typeof CommaBox> | null>(null);\nconst chipsBox = ref<InstanceType<typeof ChipsBox> | null>(null);\nconst selectedBox = computed(() =>\n\tprops.comma ? commaBox.value : chipsBox.value\n);\n/**\n * END ELEMENT REFERENCES\n */\n\nconst { isMobile } = useMobile();\nconst inputmode = computed(() =>\n\tprops.allowWriting === 'not-mobile' && isMobile.value ? 'none' : undefined\n);\n\n// Always provide an id so that inputs can be focussed by clicking oin the label\nconst id = props.id || useId().id.value;\n\nuseIntersectionObserver(\n\tinnerContainer,\n\t([{ intersectionRatio }]) => {\n\t\tif (intersectionRatio !== 1) {\n\t\t\tclose();\n\t\t}\n\t},\n\t{ threshold: [0, 1] }\n);\n\nconst { floatingStyles } = useFloating(\n\tinnerContainer,\n\toptionsContainer as any,\n\t{\n\t\tplacement: 'bottom',\n\t\twhileElementsMounted: autoUpdate,\n\t\tmiddleware: [flip(), offset(5), shift()],\n\t}\n);\n\nconst optionsContainerStyles = computed(() => {\n\tconst base: Record<string, any> = {\n\t\t...floatingStyles.value,\n\t\tzIndex: '10',\n\t};\n\tif (innerContainer.value) {\n\t\tbase.width = `${innerContainer.value?.$el.clientWidth}px`;\n\t}\n\n\treturn base;\n});\n\n/**\n * START INPUT HANDLING\n */\nconst input = ref<HTMLElement | null>(null);\nconst focusInput = () => {\n\tif (input.value instanceof HTMLInputElement) {\n\t\tinput.value.focus();\n\t}\n};\n\n/**\n * When the focus goes to the input we select the current text\n * so the user can replace or delete it.\n * On top of that if the prefill strategy is to prefill on first focus and options\n * weren't already retrieved by the watcher on mount, we do that\n */\nconst onInputFocus = async (event: FocusEvent) => {\n\temit('focus', event);\n\tsetActive();\n\tdocument.addEventListener('click', onOutsideInteraction);\n\tdocument.addEventListener('focusin', onOutsideInteraction);\n};\n\nconst onInputFirstFocus = () => {\n\tif (props.prefill === 'focus' && !isPrefilling.value && !hasPrefilled.value) {\n\t\tprefillItems();\n\t}\n};\n\nconst onInputBlur = async (event: FocusEvent) => {\n\temit('blur', event);\n};\n\nconst onInputChange = (event: Event) => emit('change', event);\n\n/**\n * Search at every input by the user.\n * When the user deletes the query unselect the current option\n */\nconst onInputInput = (event: Event) => {\n\temit('input', event);\n\tif (query.value === '') {\n\t\tif (!props.multiple) {\n\t\t\tupdateModelValue(null);\n\t\t}\n\t}\n\tselectedBox.value?.blur();\n\tsearchByQuery();\n};\n\n/**\n * On click outside of the container close the panel, remove active state.\n * In multiple selection clear query after a timeout\n */\nconst onOutsideInteraction = async (event: Event) => {\n\tif (event.target instanceof Node) {\n\t\tif (outerContainer.value && optionsContainer.value) {\n\t\t\tif (\n\t\t\t\t!outerContainer.value.$el.contains(event.target) &&\n\t\t\t\t!optionsContainer.value.$el.contains(event.target)\n\t\t\t) {\n\t\t\t\tclose();\n\t\t\t\tsetInactive();\n\t\t\t\tdocument.removeEventListener('click', onOutsideInteraction);\n\t\t\t\tdocument.removeEventListener('focusin', onOutsideInteraction);\n\t\t\t\tawait wait(props.transitionDuration);\n\t\t\t\talignQueryToState();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst canProcessKeyboardBindings = computed(() => {\n\tif (props.readonly) return false;\n\tif (props.disabled) return false;\n\tif (computedLoading.value) return false;\n\tif (!selectedBox.value && props.multiple) return false;\n\treturn true;\n});\n\n/**\n * On arrow prevent the page from scrolling.\n * Reset horizontal focus\n * When the panel is open\n * - Focus on the previous option\n * When the panel is closed\n * - focus on the first selected option\n */\nconst onArrowUp = async () => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\t// Reset horizontal focus while moving vertically\n\tselectedBox.value?.blur();\n\tif (shown.value) {\n\t\toptionsContainer.value?.focusPrevious();\n\t} else {\n\t\tawait open();\n\t\tawait wait(props.transitionDuration);\n\t\toptionsContainer.value?.focusLastSelected();\n\t}\n};\n\nconst onArrowDown = async () => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\t// Reset horizontal focus while moving vertically\n\tselectedBox.value?.blur();\n\tif (shown.value) {\n\t\toptionsContainer.value?.focusNext();\n\t} else {\n\t\tawait open();\n\t\tawait wait(props.transitionDuration);\n\t\toptionsContainer.value?.focusFirstSelected();\n\t}\n};\n\nconst onArrowLeft = (event: KeyboardEvent) => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\tif (!props.multiple || query.value) {\n\t\treturn;\n\t}\n\tevent.preventDefault();\n\t// Reset vertical focus while moving horizontally\n\toptionsContainer.value?.blur();\n\tif (!selectedOptions.value.length) return;\n\tselectedBox.value?.focusPrevious();\n\tconst highlightedOption = selectedBox.value?.getHighlighted();\n\tif (highlightedOption) {\n\t\toptionsContainer.value?.focusByHash(highlightedOption.valueHash);\n\t}\n};\n\nconst onArrowRight = (event: KeyboardEvent) => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\tif (!props.multiple || query.value) {\n\t\treturn;\n\t}\n\tevent.preventDefault();\n\t// Reset vertical focus while moving horizontally\n\toptionsContainer.value?.blur();\n\tif (!selectedOptions.value.length) return;\n\tselectedBox.value?.focusNext();\n\tconst highlightedOption = selectedBox.value?.getHighlighted();\n\tif (highlightedOption) {\n\t\toptionsContainer.value?.focusByHash(highlightedOption.valueHash);\n\t}\n};\n\nconst onEnter = async () => {\n\tif (!canProcessKeyboardBindings.value) {\n\t\treturn;\n\t}\n\tif (!shown.value) {\n\t\tawait open();\n\t\tawait wait(props.transitionDuration);\n\t\tif (selectedOptions.value.length) {\n\t\t\toptionsContainer.value?.focusFirstSelected();\n\t\t}\n\t} else if (optionsContainer.value?.getHighlighted()) {\n\t\toptionsContainer.value.confirmOption();\n\t} else if (props.addOptions) {\n\t\tif (props.itemText || props.itemValue) {\n\t\t\tconst { error } = useLogger();\n\t\t\terror(\n\t\t\t\t`Adding an option for mapped items is not supported. You can't create an option while passing \"item-text\" or \"item-value\".`\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tconst text = query.value.trim();\n\t\t// Do not add manual items that are already present\n\t\tif (valueIsSelected(text)) return;\n\t\taddCurrentQueryToManualItems();\n\t\tonOptionSelected(last(manualItems.value)!);\n\t}\n};\n\nconst onEscape = async () => {\n\tif (shown.value) {\n\t\tawait close();\n\t}\n};\n\n/**\n * Delete behavior is different when query is empty\n * If query is empty\n * If no chip is selected - select rightmost chip\n * If a chip is selected - deselect that option\n * If any option remains move focus to that or reset\n */\nconst onBackspace = async () => {\n\tif (\n\t\t!canProcessKeyboardBindings.value ||\n\t\tquery.value ||\n\t\t!selectedOptions.value.length\n\t) {\n\t\treturn;\n\t}\n\tif (selectedBox.value?.getHighlighted()) {\n\t\tselectedBox.value.confirmOption();\n\t}\n\tawait nextTick();\n\tselectedBox.value?.focusPrevious();\n};\n\n/**\n * It should prefill if asked, or\n * when single if modelValue is not null\n * when multiple if modelValue is not empty\n */\nconst shouldPrefill =\n\tprops.prefill === true ||\n\t(!props.multiple && isNotNil(props.modelValue)) ||\n\t(props.multiple && !!props.modelValue.length);\n\nconst {\n\tquery,\n\talignQueryToState,\n\taddCurrentQueryToManualItems,\n\tinnerLoading,\n\toptions,\n\tselectedOptions,\n\tselectOption,\n\tunselectOption,\n\tprefillItems,\n\tisPrefilling,\n\thasPrefilled,\n\tupdateModelValue,\n\tvalueIsSelected,\n\tmanualItems,\n\tsearchByQuery,\n} = useOptions({\n\temit,\n\titemText: props.itemText,\n\titemValue: props.itemValue,\n\tmodelValue: toRef(props, 'modelValue'),\n\tmultiple: props.multiple,\n\tresetQueryOnOptionSelected: props.resetQueryOnOptionSelected,\n\tstash: props.stash,\n\titems: toRef(props, 'items'),\n\tenforceCoherence: props.enforceCoherence,\n\tprefill: shouldPrefill,\n\tmodelValueDebounceTime: props.modelValueDebounceTime,\n\tdependencies: toRef(props, 'dependencies'),\n\tdepsDebounceTime: props.depsDebounceTime,\n\tqueryDebounceTime: props.queryDebounceTime,\n\tdisabled: toRef(props, 'disabled'),\n});\n\nconst computedPlaceholder = computed(() => {\n\tif (selectedOptions.value.length) return '';\n\telse return props.placeholder;\n});\n\nconst computedLoading = computed(() => !!(innerLoading.value || props.loading));\n\n/**\n * Filter options to be displayed based on the current query.\n * If no query is used or when query is set from the inside (after a selection) display all possible options\n */\nconst filteredOptions = computed<BaseOption[]>(() => {\n\tlet base = [];\n\t/** Only filter when a value is being searched not when the query is fully set on a selected option text */\n\tconst queryMatchesASelectedOption = selectedOptions.value.some(\n\t\t(option: BaseOption) => option.text === query.value\n\t);\n\tconst shouldFilter =\n\t\t(props.multiple && query.value) ||\n\t\t(query.value && !queryMatchesASelectedOption && !props.multiple);\n\n\tif (shouldFilter && props.filterBy) {\n\t\tbase = options.value.filter((item: BaseOption) => {\n\t\t\tlet matchedAnything = false;\n\t\t\tif (typeof props.filterBy === 'function')\n\t\t\t\tmatchedAnything = props.filterBy(item.value, item.item);\n\t\t\telse if (Array.isArray(props.filterBy) && props.filterBy.length) {\n\t\t\t\tmatchedAnything =\n\t\t\t\t\tmatchedAnything ||\n\t\t\t\t\tmatchAnyKey(item.item, props.filterBy, query.value.trim());\n\t\t\t}\n\t\t\treturn matchedAnything || matchAnyKey(item, ['text'], query.value.trim());\n\t\t});\n\t\t/** Otherwise default to the whole set of options */\n\t} else base = options.value;\n\n\t/** This is done here so that only visible options are highlighted */\n\treturn base;\n});\n\nconst onOptionSelected = (option: BaseOption) => {\n\tselectOption(option);\n\tfocusInput();\n\tif (!props.multiple) {\n\t\tclose();\n\t}\n};\n\nconst onOptionUnselected = (option: BaseOption) => {\n\tunselectOption(option);\n\tfocusInput();\n};\n\n/**\n * We need the transitions because elements must be hidden and shown\n * to accessibility tools when they are fully closed or fully open,\n * while still being animated for sighted users.\n */\n\n// Option panel is open\nconst shown = ref(false);\n// Option panel il closed\nconst hidden = ref(true);\n\nconst renderListBox = ref(false);\n\nconst open = async () => {\n\trenderListBox.value = true;\n\tawait waitFor(() => !!optionsContainer.value);\n\thidden.value = false;\n\tshown.value = true;\n};\n\nconst close = async () => {\n\tshown.value = false;\n\thidden.value = true;\n\tselectedBox.value?.blur();\n};\n\nconst toggle = () => {\n\tif (shown.value) return close();\n\treturn open();\n};\n\n/**\n * Applies a class when the user is inside this whole component.\n * We cannot use focus within as it doesn't work for elements that are teleported.\n * Also we cannot use the <input/> if we physically move focus to the options so\n * we track it manually.\n */\nconst active = ref(false);\n\nconst setActive = () => {\n\tactive.value = true;\n};\nconst setInactive = () => {\n\tactive.value = false;\n\temit('inactive');\n};\n\n/**\n * When clicking on the outside container seamlessly move focus to the input and open the panel\n */\nconst onOuterContainerClick = (event: MouseEvent) => {\n\tevent.preventDefault();\n\temit('click', event);\n\tif (props.disabled || props.readonly) return;\n\tfocusInput();\n\ttoggle();\n};\n\n/**\n * When using this component for submission we add a bunch of hidden\n * inputs so the submitted inputs are on par with v-model\n */\n/**\n * This is used to keep the value compatible to common html expected values.\n * Convert to string everything that's not but do not double encode strings\n */\nconst makeInputValue = when(\n\t(item: unknown) => typeof item !== 'string',\n\tJSON.stringify\n);\n\nconst hiddenInputs = computed(() => {\n\treturn [].concat(props.modelValue).map((current) => {\n\t\tconst value = makeInputValue(current);\n\t\treturn {\n\t\t\tdisabled: props.disabled,\n\t\t\tname: props.name,\n\t\t\ttype: 'hidden',\n\t\t\tvalue: value,\n\t\t};\n\t});\n});\n</script>\n<style lang=\"postcss\">\n@import '@/assets/css/BaseSelect';\n</style>\n"],"names":["props","__props","emit","__emit","ListBox","defineAsyncComponent","outerContainer","ref","innerContainer","optionsContainer","commaBox","chipsBox","selectedBox","computed","isMobile","useMobile","inputmode","id","useId","useIntersectionObserver","intersectionRatio","close","floatingStyles","useFloating","autoUpdate","flip","offset","shift","optionsContainerStyles","base","_a","input","focusInput","onInputFocus","event","setActive","onOutsideInteraction","onInputFirstFocus","isPrefilling","hasPrefilled","prefillItems","onInputBlur","onInputChange","onInputInput","query","updateModelValue","searchByQuery","setInactive","wait","alignQueryToState","canProcessKeyboardBindings","computedLoading","onArrowUp","shown","_b","open","_c","onArrowDown","onArrowLeft","selectedOptions","highlightedOption","_d","onArrowRight","onEnter","error","useLogger","text","valueIsSelected","addCurrentQueryToManualItems","onOptionSelected","last","manualItems","onEscape","onBackspace","nextTick","shouldPrefill","isNotNil","innerLoading","options","selectOption","unselectOption","useOptions","toRef","computedPlaceholder","filteredOptions","queryMatchesASelectedOption","option","item","matchedAnything","matchAnyKey","onOptionUnselected","hidden","renderListBox","waitFor","toggle","active","onOuterContainerClick","makeInputValue","when","hiddenInputs","current","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8YA,UAAMA,IAAQC,GAcRC,IAAOC;AAIb,QAAIH,EAAM,YAAY,CAAC,MAAM,QAAQA,EAAM,UAAU;AAC9C,YAAA,IAAI,MAAM,2DAA2D;AAM5E,UAAMI,IAAUC,GAAqB,MAAM,OAAO,eAAgB,CAAC,GAC7DC,IAAiBC,EAEb,IAAI,GACRC,IAAiBD,EAEb,IAAI,GACRE,IAAmBF,EAAyC,IAAI,GAChEG,IAAWH,EAA0C,IAAI,GACzDI,IAAWJ,EAA0C,IAAI,GACzDK,IAAcC;AAAA,MAAS,MAC5Bb,EAAM,QAAQU,EAAS,QAAQC,EAAS;AAAA,IAAA,GAMnC,EAAE,UAAA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YAAY;;AACzB,MAAAgC,EAAM,QAAQ,IACdsC,EAAO,QAAQ,KACf7D,IAAAlB,EAAY,UAAZ,QAAAkB,EAAmB;AAAA,IAAK,GAGnBgE,KAAS,MACVzC,EAAM,QAAchC,MACjBkC,EAAK,GASPwC,IAASxF,EAAI,EAAK,GAElB4B,KAAY,MAAM;AACvB,MAAA4D,EAAO,QAAQ;AAAA,IAAA,GAEVhD,KAAc,MAAM;AACzB,MAAAgD,EAAO,QAAQ,IACf7F,EAAK,UAAU;AAAA,IAAA,GAMV8F,KAAwB,CAAC9D,MAAsB;AAGhD,MAFJA,EAAM,eAAe,GACrBhC,EAAK,SAASgC,CAAK,GACf,EAAAlC,EAAM,YAAYA,EAAM,cACjBgC,KACJ8D;IAAA,GAWFG,KAAiBC;AAAA,MACtB,CAACX,MAAkB,OAAOA,KAAS;AAAA,MACnC,KAAK;AAAA,IAAA,GAGAY,KAAetF,EAAS,MACtB,CAAA,EAAG,OAAOb,EAAM,UAAU,EAAE,IAAI,CAACoG,MAAY;AAC7C,YAAAC,IAAQJ,GAAeG,CAAO;AAC7B,aAAA;AAAA,QACN,UAAUpG,EAAM;AAAA,QAChB,MAAMA,EAAM;AAAA,QACZ,MAAM;AAAA,QACN,OAAAqG;AAAA,MAAA;AAAA,IACD,CACA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineComponent as U, ref as d, computed as h, onMounted as W, watch as Z, openBlock as g, createElementBlock as w, mergeProps as T, renderSlot as f, createElementVNode as b, Fragment as ee, renderList as ae, createCommentVNode as H, normalizeProps as re, guardReactiveProps as te, unref as c, normalizeClass as F, normalizeStyle as I } from "vue";
|
|
2
2
|
import { clamp as le } from "./index199.js";
|
|
3
|
-
import { head as O } from "./
|
|
4
|
-
import { isCssColor as Y } from "./
|
|
5
|
-
import { isNil as P } from "./
|
|
6
|
-
import { isNotNil as ne } from "./
|
|
7
|
-
import { transposeValue as y } from "./
|
|
8
|
-
import { hash as J } from "./
|
|
3
|
+
import { head as O } from "./index235.js";
|
|
4
|
+
import { isCssColor as Y } from "./index222.js";
|
|
5
|
+
import { isNil as P } from "./index126.js";
|
|
6
|
+
import { isNotNil as ne } from "./index131.js";
|
|
7
|
+
import { transposeValue as y } from "./index127.js";
|
|
8
|
+
import { hash as J } from "./index229.js";
|
|
9
9
|
const oe = { class: "bb-base-slider__slider-container" }, ie = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "bb-base-slider__ticks-container"
|
|
@@ -306,4 +306,4 @@ const oe = { class: "bb-base-slider__slider-container" }, ie = {
|
|
|
306
306
|
export {
|
|
307
307
|
ke as default
|
|
308
308
|
};
|
|
309
|
-
//# sourceMappingURL=
|
|
309
|
+
//# sourceMappingURL=index38.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index37.js","sources":["../src/components/BaseSlider/BaseSlider.vue"],"sourcesContent":["<template>\n\t<span v-bind=\"containerAttributes\" ref=\"container\">\n\t\t<slot name=\"prepend\"></slot>\n\t\t<span class=\"bb-base-slider__slider-container\">\n\t\t\t<span v-if=\"ticks.length\" class=\"bb-base-slider__ticks-container\">\n\t\t\t\t<span\n\t\t\t\t\tv-for=\"tick in ticks\"\n\t\t\t\t\t:key=\"tick.value\"\n\t\t\t\t\tclass=\"bb-base-slider__tick\"\n\t\t\t\t\t><slot\n\t\t\t\t\t\t:active=\"tick.active\"\n\t\t\t\t\t\tname=\"tick\"\n\t\t\t\t\t\t:percent=\"tick.percent\"\n\t\t\t\t\t\t:value=\"tick.value\"\n\t\t\t\t/></span>\n\t\t\t</span>\n\t\t\t<input\n\t\t\t\t:id=\"id\"\n\t\t\t\tclass=\"sr-only\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:required=\"required\"\n\t\t\t\t:tabindex=\"-1\"\n\t\t\t\t:type=\"'number'\"\n\t\t\t\t:value=\"JSON.stringify(modelValue)\"\n\t\t\t/>\n\t\t\t<span ref=\"track\" class=\"bb-base-slider__track-container\">\n\t\t\t\t<span class=\"bb-base-slider__track-fill\"></span>\n\t\t\t\t<span v-bind=\"sliderBackgroundAttributes\"></span>\n\t\t\t</span>\n\t\t\t<span\n\t\t\t\tv-if=\"props.range\"\n\t\t\t\tv-bind=\"listeners\"\n\t\t\t\tkey=\"thumblower\"\n\t\t\t\tref=\"thumblower\"\n\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t:aria-orientation=\"'horizontal'\"\n\t\t\t\t:aria-readonly=\"!readonly\"\n\t\t\t\t:aria-valuemax=\"max\"\n\t\t\t\t:aria-valuemin=\"min\"\n\t\t\t\t:aria-valuenow=\"valueNowLower\"\n\t\t\t\t:class=\"'bb-base-slider__thumb-container'\"\n\t\t\t\tdata-thumb=\"lower\"\n\t\t\t\t:role=\"'slider'\"\n\t\t\t\t:style=\"{ left: `${internalValueLower}%` }\"\n\t\t\t\t:tabindex=\"disabled ? -1 : 0\"\n\t\t\t\t@focus=\"onFocus\"\n\t\t\t\t@keydown=\"onKeydown\"\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'bb-base-slider__thumb': true,\n\t\t\t\t\t\t'bb-base-slider__thumb--lower': true,\n\t\t\t\t\t\t'bb-base-slider__thumb--focused': targetThumb === 'lower',\n\t\t\t\t\t}\"\n\t\t\t\t\t:style=\"{\n\t\t\t\t\t\ttransform: `translateY(-50%) ${thumbTranslate ? `translateX(-${internalValueLower}%)` : `translateX(-50%)`}`,\n\t\t\t\t\t\tleft: `${internalValueLower}%`,\n\t\t\t\t\t}\"\n\t\t\t\t\t><slot\n\t\t\t\t\t\t:focused=\"targetThumb === 'lower'\"\n\t\t\t\t\t\tname=\"thumb:lower\"\n\t\t\t\t\t\t:percent=\"internalValueLower\"\n\t\t\t\t\t\t:value=\"valueNowLower\"\n\t\t\t\t\t\t><slot\n\t\t\t\t\t\t\t:focused=\"targetThumb === 'lower'\"\n\t\t\t\t\t\t\tname=\"thumb\"\n\t\t\t\t\t\t\t:percent=\"internalValueLower\"\n\t\t\t\t\t\t\t:value=\"valueNowLower\" /></slot\n\t\t\t\t></span>\n\t\t\t</span>\n\t\t\t<span\n\t\t\t\tv-bind=\"listeners\"\n\t\t\t\tkey=\"thumbhigher\"\n\t\t\t\tref=\"thumbhigher\"\n\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t:aria-orientation=\"'horizontal'\"\n\t\t\t\t:aria-readonly=\"!readonly\"\n\t\t\t\t:aria-valuemax=\"max\"\n\t\t\t\t:aria-valuemin=\"min\"\n\t\t\t\t:aria-valuenow=\"valueNowHigher\"\n\t\t\t\t:class=\"'bb-base-slider__thumb-container'\"\n\t\t\t\tdata-thumb=\"higher\"\n\t\t\t\t:role=\"'slider'\"\n\t\t\t\t:style=\"{ left: `${internalValueHigher}%` }\"\n\t\t\t\t:tabindex=\"disabled ? -1 : 0\"\n\t\t\t\t@focus=\"onFocus\"\n\t\t\t\t@keydown=\"onKeydown\"\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'bb-base-slider__thumb': true,\n\t\t\t\t\t\t'bb-base-slider__thumb--higher': true,\n\t\t\t\t\t\t'bb-base-slider__thumb--focused': targetThumb === 'higher',\n\t\t\t\t\t}\"\n\t\t\t\t\t:style=\"{\n\t\t\t\t\t\ttransform: `translateY(-50%) ${thumbTranslate ? `translateX(-${internalValueHigher}%)` : `translateX(-50%)`}`,\n\t\t\t\t\t\tleft: `${internalValueHigher}%`,\n\t\t\t\t\t}\"\n\t\t\t\t\t><slot\n\t\t\t\t\t\t:focused=\"targetThumb === 'higher'\"\n\t\t\t\t\t\tname=\"thumb:higher\"\n\t\t\t\t\t\t:percent=\"internalValueHigher\"\n\t\t\t\t\t\t:value=\"valueNowHigher\"\n\t\t\t\t\t\t><slot\n\t\t\t\t\t\t\t:focused=\"targetThumb === 'higher'\"\n\t\t\t\t\t\t\tname=\"thumb\"\n\t\t\t\t\t\t\t:percent=\"internalValueHigher\"\n\t\t\t\t\t\t\t:value=\"valueNowHigher\" /></slot\n\t\t\t\t></span>\n\t\t\t</span>\n\t\t</span>\n\t\t<slot name=\"append\"></slot>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { clamp } from '@/utilities/functions/clamp';\nimport { computed, onMounted, ref, watch } from 'vue';\nimport { head } from '@/utilities/functions/head';\nimport { isCssColor } from '@/utilities/functions/isCssColor';\nimport { isNil } from '@/utilities/functions/isNil';\nimport { isNotNil } from '@/utilities/functions/isNotNil';\nimport { transposeValue } from '@/utilities/functions/percentage';\nimport type { InputHTMLAttributes, HTMLAttributes } from 'vue';\nimport { hash } from '@/utilities/functions/hash';\n\nexport type BaseSliderProps = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Define a color for the component.\n\t *\n\t * Either a custom color or a coded color in common HEX, RGB, etc... format.\n\t */\n\tcolor?: string;\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Maximum value cap.\n\t */\n\tmax?: number;\n\n\t/**\n\t * Minimum value cap.\n\t */\n\tmin?: number;\n\n\t/**\n\t * Used by v-model.\n\t */\n\tmodelValue: number[] | number | string | null;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * Set the input as range.\n\t * modelValue must be an array\n\t */\n\trange?: boolean;\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * The step attribute is a number that specifies the granularity that the value must adhere to.\n\t */\n\tstep?: number;\n\n\t/**\n\t * Displays ticks on step\n\t */\n\tticks?: boolean;\n\t/**\n\t * Proportionally translates the thumb so it remains on track. Set it to false when displaying ticks so they align with less effort.\n\t */\n\tthumbTranslate?: boolean;\n};\n\nconst props = withDefaults(defineProps<BaseSliderProps>(), {\n\tmax: 100,\n\tmin: 0,\n\tmodelValue: 0,\n\tstep: 1,\n\tthumbTranslate: true,\n});\n\nexport type BaseSliderEvents = {\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'active'): void;\n\t(e: 'inactive'): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'pointerdown', event: PointerEvent): void;\n\t(e: 'pointermove', event: PointerEvent): void;\n\t(e: 'pointerup', event: PointerEvent): void;\n\t(e: 'update:modelValue', event: number | number[]): void;\n};\n\nconst emit = defineEmits<BaseSliderEvents>();\n\nexport type BaseSliderSlots = {\n\t'thumb:higher': (props: {\n\t\tvalue: number | undefined;\n\t\tpercent: number;\n\t\tfocused: boolean;\n\t}) => any;\n\t'thumb:lower': (props: {\n\t\tvalue: number | undefined;\n\t\tpercent: number;\n\t\tfocused: boolean;\n\t}) => any;\n\tappend: (props: object) => any;\n\tprepend: (props: object) => any;\n\tthumb: (props: {\n\t\tvalue: number | undefined;\n\t\tpercent: number;\n\t\tfocused: boolean;\n\t}) => any;\n\ttick: (props: { value: number; percent: number; active: boolean }) => any;\n};\n\ndefineSlots<BaseSliderSlots>();\n\nconst container = ref<HTMLElement>();\nconst track = ref<HTMLElement>();\nconst thumblower = ref<HTMLElement>();\nconst thumbhigher = ref<HTMLElement>();\nconst internalValueLower = ref(0);\nconst internalValueHigher = ref(0);\nconst valueNowLower = computed(() => {\n\tif (Array.isArray(props.modelValue))\n\t\treturn head(props.modelValue) ?? undefined;\n\treturn isNil(props.modelValue) ? undefined : Number(props.modelValue);\n});\nconst valueNowHigher = computed(() => {\n\tif (Array.isArray(props.modelValue))\n\t\treturn head(props.modelValue) ?? undefined;\n\treturn isNil(props.modelValue) ? undefined : Number(props.modelValue);\n});\nconst sortedInternalValues = computed(() => {\n\treturn [internalValueLower.value, internalValueHigher.value].sort(\n\t\t(a, b) => a - b\n\t);\n});\n\nconst proportionalStep = transposeValue({\n\tvalue: props.min + props.step,\n\toriginalBounds: { min: props.min, max: props.max },\n\ttargetBounds: { min: 0, max: 100 },\n\tstep: 1,\n});\n\nconst active = ref(false);\n\nif (props.range && !Array.isArray(props.modelValue)) {\n\tthrow new TypeError(\n\t\t'BaseSlider mode is set as range but modelValue is not an array'\n\t);\n}\n\nonMounted(() => {\n\tif (props.autofocus) {\n\t\tthumbhigher.value?.focus();\n\t}\n});\n\n/**\n * When modelValue changes realign the internal positioning\n */\nwatch(\n\t() => props.modelValue,\n\t(value) => {\n\t\tlet values: number[];\n\t\tif (props.range) {\n\t\t\tconst [min = props.min, max = props.min] = value as number[];\n\t\t\tvalues = [min, max];\n\t\t} else {\n\t\t\tvalues = [props.min, isNotNil(value) ? Number(value) : props.min];\n\t\t}\n\t\tconst [lBound, uBound] = values.map((value) => {\n\t\t\t// Useful for ranges from negative to positive\n\t\t\tlet fallback = isNil(value) ? props.min : Number(value);\n\t\t\tconst transposedValue = transposeValue({\n\t\t\t\tvalue: fallback,\n\t\t\t\ttargetBounds: { min: 0, max: 100 },\n\t\t\t\toriginalBounds: { min: props.min, max: props.max },\n\t\t\t\tstep: 1,\n\t\t\t});\n\t\t\treturn transposedValue;\n\t\t});\n\t\tinternalValueLower.value = lBound;\n\t\tinternalValueHigher.value = uBound;\n\t},\n\t{ immediate: true }\n);\n\nlet thumbPressed = ref(false);\nlet targetThumb = ref<'higher' | 'lower' | null>(null);\n\nconst getTargetThumb = (event: FocusEvent) => {\n\tif (thumbhigher.value && thumbhigher.value.contains(event.target as Node))\n\t\treturn 'higher';\n\tif (thumblower.value && thumblower.value.contains(event.target as Node))\n\t\treturn 'lower';\n\tthrow new Error('Could not identify target thumb');\n};\n\nconst onPointerdown = (event: PointerEvent) => {\n\tif (props.disabled || props.readonly) return;\n\tif (!targetThumb.value) {\n\t\ttargetThumb.value = getTargetThumb(event);\n\t}\n\tthumbPressed.value = true;\n\tdocument.addEventListener('pointermove', onPointermove);\n\tdocument.addEventListener('pointerup', onPointerup);\n\temit('pointerdown', event);\n};\n\nlet listeners = computed(() => (thumbPressed.value ? {} : { onPointerdown }));\n\nconst onPointermove = (event: PointerEvent | MouseEvent) => {\n\tif (props.disabled || props.readonly) return;\n\tif (track.value) {\n\t\tconst trackPosition = track.value.getBoundingClientRect();\n\t\tconst clickOffset = event.clientX;\n\t\tconst trackStart = trackPosition.left;\n\t\tconst trackLength = trackPosition.width;\n\t\tif (event instanceof PointerEvent) {\n\t\t\temit('pointermove', event);\n\t\t} else {\n\t\t\temit('click', event);\n\t\t}\n\t\tconst position = transposeValue({\n\t\t\tvalue: clamp(clickOffset, trackStart, trackStart + trackLength),\n\t\t\toriginalBounds: { min: trackStart, max: trackStart + trackLength },\n\t\t\ttargetBounds: { min: 0, max: 100 },\n\t\t\tstep: proportionalStep,\n\t\t});\n\t\tif (targetThumb.value === 'higher') {\n\t\t\tinternalValueHigher.value = position;\n\t\t} else if (targetThumb.value === 'lower') {\n\t\t\tinternalValueLower.value = position;\n\t\t}\n\t}\n};\n\nconst getValueToEmit = () => {\n\tconst [min, max] = [internalValueLower.value, internalValueHigher.value].sort(\n\t\t(a, b) => a - b\n\t);\n\tconst refined = [min, max].map((value) =>\n\t\ttransposeValue({\n\t\t\tvalue,\n\t\t\toriginalBounds: { min: 0, max: 100 },\n\t\t\ttargetBounds: { min: props.min, max: props.max },\n\t\t\tstep: props.step,\n\t\t})\n\t);\n\tif (props.range) return refined;\n\treturn refined[1];\n};\n\nconst onPointerup = (event: PointerEvent) => {\n\tthumbPressed.value = false;\n\ttargetThumb.value = null;\n\tdocument.removeEventListener('pointermove', onPointermove);\n\tdocument.removeEventListener('pointerup', onPointerup);\n\temit('pointerup', event);\n\temit('update:modelValue', getValueToEmit());\n};\n\nconst onKeydown = (event: KeyboardEvent) => {\n\temit('keydown', event);\n\tif (\n\t\tprops.disabled ||\n\t\tprops.readonly ||\n\t\t(event.key !== 'ArrowLeft' && event.key !== 'ArrowRight')\n\t) {\n\t\treturn;\n\t}\n\n\tif (event.key === 'ArrowLeft') {\n\t\tif (\n\t\t\ttargetThumb.value === 'higher' ||\n\t\t\tdocument.activeElement === thumbhigher.value\n\t\t) {\n\t\t\tinternalValueHigher.value = Math.max(\n\t\t\t\tinternalValueHigher.value - proportionalStep,\n\t\t\t\tinternalValueLower.value\n\t\t\t);\n\t\t} else if (targetThumb.value === 'lower') {\n\t\t\tinternalValueLower.value = Math.max(\n\t\t\t\tinternalValueLower.value - proportionalStep,\n\t\t\t\t0\n\t\t\t);\n\t\t}\n\t} else if (event.key === 'ArrowRight') {\n\t\tif (\n\t\t\ttargetThumb.value === 'higher' ||\n\t\t\tdocument.activeElement === thumbhigher.value\n\t\t) {\n\t\t\tinternalValueHigher.value = Math.min(\n\t\t\t\tinternalValueHigher.value + proportionalStep,\n\t\t\t\t100\n\t\t\t);\n\t\t} else if (targetThumb.value === 'lower') {\n\t\t\tinternalValueLower.value = Math.min(\n\t\t\t\tinternalValueLower.value + proportionalStep,\n\t\t\t\tinternalValueHigher.value\n\t\t\t);\n\t\t}\n\t}\n\temit('update:modelValue', getValueToEmit());\n};\n\nconst onFocus = (event: FocusEvent) => {\n\temit('focus', event);\n\tconst found = getTargetThumb(event);\n\tif (found) targetThumb.value = found;\n\tif (!active.value) {\n\t\tactive.value = true;\n\t\temit('active');\n\t\tdocument.addEventListener('focusin', onDocumentInteraction);\n\t\tdocument.addEventListener('click', onDocumentInteraction);\n\t}\n};\n\nconst onDocumentInteraction = (event: FocusEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\tactive.value = false;\n\t\t\ttargetThumb.value = null;\n\t\t\temit('inactive');\n\t\t\tdocument.removeEventListener('focusin', onDocumentInteraction);\n\t\t\tdocument.removeEventListener('click', onDocumentInteraction);\n\t\t}\n\t}\n};\n\nconst containerAttributes: Record<string, any> = {\n\tclass: {\n\t\t'bb-base-slider': true,\n\t\t'bb-base-slider--disabled': props.disabled,\n\t\t'bb-base-slider--errors': props.hasErrors,\n\t\t'bb-base-slider--readonly': props.readonly,\n\t\t[`bb-base-slider--${props.color}`]: props.color && !isCssColor(props.color),\n\t},\n\tonClick: (event: MouseEvent) => {\n\t\tif (props.range) return;\n\t\tthumbhigher.value?.focus();\n\t\tonPointermove(event);\n\t\tconst valueToEmit = getValueToEmit();\n\t\t// Prevent emitting twice when clicking on the thumb directly\n\t\tif (hash(valueToEmit) === hash(props.modelValue)) return;\n\t\temit('update:modelValue', getValueToEmit());\n\t},\n\tstyle: {},\n};\n\nif (props.color && isCssColor(props.color)) {\n\tcontainerAttributes.style['--color'] = props.color;\n}\n\nconst sliderBackgroundAttributes = computed(() => {\n\tconst classes = 'bb-base-slider__track-background';\n\tconst style: Record<string, any> = {\n\t\twidth: `${sortedInternalValues.value[1] - sortedInternalValues.value[0]}%`,\n\t\tleft: `${sortedInternalValues.value[0]}%`,\n\t};\n\treturn {\n\t\tclass: classes,\n\t\tstyle,\n\t};\n});\n\ntype Tick = {\n\tvalue: number;\n\tpercent: number;\n\tactive: boolean;\n};\n\nconst ticks = computed<Tick[]>(() => {\n\tif (!props.ticks) return [] as Tick[];\n\tlet ticks: Tick[] = [];\n\tlet current = props.min;\n\twhile (current <= props.max) {\n\t\tlet value = current;\n\t\tlet percent = transposeValue({\n\t\t\tvalue,\n\t\t\toriginalBounds: { min: props.min, max: props.max },\n\t\t\ttargetBounds: { min: 0, max: 100 },\n\t\t\tstep: proportionalStep,\n\t\t});\n\t\tlet transposedValue = transposeValue({\n\t\t\tvalue: current,\n\t\t\toriginalBounds: { min: props.min, max: props.max },\n\t\t\ttargetBounds: { min: 0, max: 100 },\n\t\t\tstep: props.step,\n\t\t});\n\t\tconst active =\n\t\t\ttransposedValue >= internalValueLower.value &&\n\t\t\ttransposedValue <= internalValueHigher.value;\n\t\tticks.push({\n\t\t\tvalue,\n\t\t\tpercent,\n\t\t\tactive,\n\t\t});\n\t\tcurrent += props.step;\n\t}\n\treturn ticks;\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseSlider';\n</style>\n"],"names":["props","__props","emit","__emit","container","ref","track","thumblower","thumbhigher","internalValueLower","internalValueHigher","valueNowLower","computed","head","isNil","valueNowHigher","sortedInternalValues","a","b","proportionalStep","transposeValue","active","onMounted","_a","watch","value","values","min","max","isNotNil","lBound","uBound","fallback","thumbPressed","targetThumb","getTargetThumb","event","onPointerdown","onPointermove","onPointerup","listeners","trackPosition","clickOffset","trackStart","trackLength","position","clamp","getValueToEmit","refined","onKeydown","onFocus","found","onDocumentInteraction","containerAttributes","isCssColor","valueToEmit","hash","sliderBackgroundAttributes","classes","style","ticks","current","percent","transposedValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoNA,UAAMA,IAAQC,GAoBRC,IAAOC,GAyBPC,IAAYC,KACZC,IAAQD,KACRE,IAAaF,KACbG,IAAcH,KACdI,IAAqBJ,EAAI,CAAC,GAC1BK,IAAsBL,EAAI,CAAC,GAC3BM,IAAgBC,EAAS,MAC1B,MAAM,QAAQZ,EAAM,UAAU,IAC1Ba,EAAKb,EAAM,UAAU,KAAK,SAC3Bc,EAAMd,EAAM,UAAU,IAAI,SAAY,OAAOA,EAAM,UAAU,CACpE,GACKe,IAAiBH,EAAS,MAC3B,MAAM,QAAQZ,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A,UACV,OAAAnC;AAAA,UACA,SAAAqC;AAAA,UACA,QAAAzC;AAAAA,QAAA,CACA,GACDwC,KAAW7D,EAAM;AAAA,MAClB;AACO4D,aAAAA;AAAAA,IAAA,CACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index38.js","sources":["../src/components/BaseSlider/BaseSlider.vue"],"sourcesContent":["<template>\n\t<span v-bind=\"containerAttributes\" ref=\"container\">\n\t\t<slot name=\"prepend\"></slot>\n\t\t<span class=\"bb-base-slider__slider-container\">\n\t\t\t<span v-if=\"ticks.length\" class=\"bb-base-slider__ticks-container\">\n\t\t\t\t<span\n\t\t\t\t\tv-for=\"tick in ticks\"\n\t\t\t\t\t:key=\"tick.value\"\n\t\t\t\t\tclass=\"bb-base-slider__tick\"\n\t\t\t\t\t><slot\n\t\t\t\t\t\t:active=\"tick.active\"\n\t\t\t\t\t\tname=\"tick\"\n\t\t\t\t\t\t:percent=\"tick.percent\"\n\t\t\t\t\t\t:value=\"tick.value\"\n\t\t\t\t/></span>\n\t\t\t</span>\n\t\t\t<input\n\t\t\t\t:id=\"id\"\n\t\t\t\tclass=\"sr-only\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:required=\"required\"\n\t\t\t\t:tabindex=\"-1\"\n\t\t\t\t:type=\"'number'\"\n\t\t\t\t:value=\"JSON.stringify(modelValue)\"\n\t\t\t/>\n\t\t\t<span ref=\"track\" class=\"bb-base-slider__track-container\">\n\t\t\t\t<span class=\"bb-base-slider__track-fill\"></span>\n\t\t\t\t<span v-bind=\"sliderBackgroundAttributes\"></span>\n\t\t\t</span>\n\t\t\t<span\n\t\t\t\tv-if=\"props.range\"\n\t\t\t\tv-bind=\"listeners\"\n\t\t\t\tkey=\"thumblower\"\n\t\t\t\tref=\"thumblower\"\n\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t:aria-orientation=\"'horizontal'\"\n\t\t\t\t:aria-readonly=\"!readonly\"\n\t\t\t\t:aria-valuemax=\"max\"\n\t\t\t\t:aria-valuemin=\"min\"\n\t\t\t\t:aria-valuenow=\"valueNowLower\"\n\t\t\t\t:class=\"'bb-base-slider__thumb-container'\"\n\t\t\t\tdata-thumb=\"lower\"\n\t\t\t\t:role=\"'slider'\"\n\t\t\t\t:style=\"{ left: `${internalValueLower}%` }\"\n\t\t\t\t:tabindex=\"disabled ? -1 : 0\"\n\t\t\t\t@focus=\"onFocus\"\n\t\t\t\t@keydown=\"onKeydown\"\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'bb-base-slider__thumb': true,\n\t\t\t\t\t\t'bb-base-slider__thumb--lower': true,\n\t\t\t\t\t\t'bb-base-slider__thumb--focused': targetThumb === 'lower',\n\t\t\t\t\t}\"\n\t\t\t\t\t:style=\"{\n\t\t\t\t\t\ttransform: `translateY(-50%) ${thumbTranslate ? `translateX(-${internalValueLower}%)` : `translateX(-50%)`}`,\n\t\t\t\t\t\tleft: `${internalValueLower}%`,\n\t\t\t\t\t}\"\n\t\t\t\t\t><slot\n\t\t\t\t\t\t:focused=\"targetThumb === 'lower'\"\n\t\t\t\t\t\tname=\"thumb:lower\"\n\t\t\t\t\t\t:percent=\"internalValueLower\"\n\t\t\t\t\t\t:value=\"valueNowLower\"\n\t\t\t\t\t\t><slot\n\t\t\t\t\t\t\t:focused=\"targetThumb === 'lower'\"\n\t\t\t\t\t\t\tname=\"thumb\"\n\t\t\t\t\t\t\t:percent=\"internalValueLower\"\n\t\t\t\t\t\t\t:value=\"valueNowLower\" /></slot\n\t\t\t\t></span>\n\t\t\t</span>\n\t\t\t<span\n\t\t\t\tv-bind=\"listeners\"\n\t\t\t\tkey=\"thumbhigher\"\n\t\t\t\tref=\"thumbhigher\"\n\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t:aria-orientation=\"'horizontal'\"\n\t\t\t\t:aria-readonly=\"!readonly\"\n\t\t\t\t:aria-valuemax=\"max\"\n\t\t\t\t:aria-valuemin=\"min\"\n\t\t\t\t:aria-valuenow=\"valueNowHigher\"\n\t\t\t\t:class=\"'bb-base-slider__thumb-container'\"\n\t\t\t\tdata-thumb=\"higher\"\n\t\t\t\t:role=\"'slider'\"\n\t\t\t\t:style=\"{ left: `${internalValueHigher}%` }\"\n\t\t\t\t:tabindex=\"disabled ? -1 : 0\"\n\t\t\t\t@focus=\"onFocus\"\n\t\t\t\t@keydown=\"onKeydown\"\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'bb-base-slider__thumb': true,\n\t\t\t\t\t\t'bb-base-slider__thumb--higher': true,\n\t\t\t\t\t\t'bb-base-slider__thumb--focused': targetThumb === 'higher',\n\t\t\t\t\t}\"\n\t\t\t\t\t:style=\"{\n\t\t\t\t\t\ttransform: `translateY(-50%) ${thumbTranslate ? `translateX(-${internalValueHigher}%)` : `translateX(-50%)`}`,\n\t\t\t\t\t\tleft: `${internalValueHigher}%`,\n\t\t\t\t\t}\"\n\t\t\t\t\t><slot\n\t\t\t\t\t\t:focused=\"targetThumb === 'higher'\"\n\t\t\t\t\t\tname=\"thumb:higher\"\n\t\t\t\t\t\t:percent=\"internalValueHigher\"\n\t\t\t\t\t\t:value=\"valueNowHigher\"\n\t\t\t\t\t\t><slot\n\t\t\t\t\t\t\t:focused=\"targetThumb === 'higher'\"\n\t\t\t\t\t\t\tname=\"thumb\"\n\t\t\t\t\t\t\t:percent=\"internalValueHigher\"\n\t\t\t\t\t\t\t:value=\"valueNowHigher\" /></slot\n\t\t\t\t></span>\n\t\t\t</span>\n\t\t</span>\n\t\t<slot name=\"append\"></slot>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { clamp } from '@/utilities/functions/clamp';\nimport { computed, onMounted, ref, watch } from 'vue';\nimport { head } from '@/utilities/functions/head';\nimport { isCssColor } from '@/utilities/functions/isCssColor';\nimport { isNil } from '@/utilities/functions/isNil';\nimport { isNotNil } from '@/utilities/functions/isNotNil';\nimport { transposeValue } from '@/utilities/functions/percentage';\nimport type { InputHTMLAttributes, HTMLAttributes } from 'vue';\nimport { hash } from '@/utilities/functions/hash';\n\nexport type BaseSliderProps = {\n\t/**\n\t * Guides to the browser as to the type of information expected in the field.\n\t */\n\tariaDescribedby?: InputHTMLAttributes['aria-describedby'];\n\n\t/**\n\t * Sets autofocus on page load.\n\t */\n\tautofocus?: InputHTMLAttributes['autofocus'];\n\n\t/**\n\t * Define a color for the component.\n\t *\n\t * Either a custom color or a coded color in common HEX, RGB, etc... format.\n\t */\n\tcolor?: string;\n\n\t/**\n\t * Disables the component\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Define if the component should be in an error state.\n\t * It usually attaches a CSS class for styling purposes.\n\t */\n\thasErrors?: boolean;\n\n\t/**\n\t * The identifier of the component.\n\t */\n\tid?: HTMLAttributes['id'];\n\n\t/**\n\t * Maximum value cap.\n\t */\n\tmax?: number;\n\n\t/**\n\t * Minimum value cap.\n\t */\n\tmin?: number;\n\n\t/**\n\t * Used by v-model.\n\t */\n\tmodelValue: number[] | number | string | null;\n\n\t/**\n\t * Defines the name of the input.\n\t */\n\tname?: InputHTMLAttributes['name'];\n\n\t/**\n\t * Set the input as range.\n\t * modelValue must be an array\n\t */\n\trange?: boolean;\n\t/**\n\t * Sets the input in a readonly state.\n\t */\n\treadonly?: InputHTMLAttributes['readonly'];\n\n\t/**\n\t * Sets the input as required.\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * The step attribute is a number that specifies the granularity that the value must adhere to.\n\t */\n\tstep?: number;\n\n\t/**\n\t * Displays ticks on step\n\t */\n\tticks?: boolean;\n\t/**\n\t * Proportionally translates the thumb so it remains on track. Set it to false when displaying ticks so they align with less effort.\n\t */\n\tthumbTranslate?: boolean;\n};\n\nconst props = withDefaults(defineProps<BaseSliderProps>(), {\n\tmax: 100,\n\tmin: 0,\n\tmodelValue: 0,\n\tstep: 1,\n\tthumbTranslate: true,\n});\n\nexport type BaseSliderEvents = {\n\t(e: 'click', event: MouseEvent): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'active'): void;\n\t(e: 'inactive'): void;\n\t(e: 'keydown', event: KeyboardEvent): void;\n\t(e: 'pointerdown', event: PointerEvent): void;\n\t(e: 'pointermove', event: PointerEvent): void;\n\t(e: 'pointerup', event: PointerEvent): void;\n\t(e: 'update:modelValue', event: number | number[]): void;\n};\n\nconst emit = defineEmits<BaseSliderEvents>();\n\nexport type BaseSliderSlots = {\n\t'thumb:higher': (props: {\n\t\tvalue: number | undefined;\n\t\tpercent: number;\n\t\tfocused: boolean;\n\t}) => any;\n\t'thumb:lower': (props: {\n\t\tvalue: number | undefined;\n\t\tpercent: number;\n\t\tfocused: boolean;\n\t}) => any;\n\tappend: (props: object) => any;\n\tprepend: (props: object) => any;\n\tthumb: (props: {\n\t\tvalue: number | undefined;\n\t\tpercent: number;\n\t\tfocused: boolean;\n\t}) => any;\n\ttick: (props: { value: number; percent: number; active: boolean }) => any;\n};\n\ndefineSlots<BaseSliderSlots>();\n\nconst container = ref<HTMLElement>();\nconst track = ref<HTMLElement>();\nconst thumblower = ref<HTMLElement>();\nconst thumbhigher = ref<HTMLElement>();\nconst internalValueLower = ref(0);\nconst internalValueHigher = ref(0);\nconst valueNowLower = computed(() => {\n\tif (Array.isArray(props.modelValue))\n\t\treturn head(props.modelValue) ?? undefined;\n\treturn isNil(props.modelValue) ? undefined : Number(props.modelValue);\n});\nconst valueNowHigher = computed(() => {\n\tif (Array.isArray(props.modelValue))\n\t\treturn head(props.modelValue) ?? undefined;\n\treturn isNil(props.modelValue) ? undefined : Number(props.modelValue);\n});\nconst sortedInternalValues = computed(() => {\n\treturn [internalValueLower.value, internalValueHigher.value].sort(\n\t\t(a, b) => a - b\n\t);\n});\n\nconst proportionalStep = transposeValue({\n\tvalue: props.min + props.step,\n\toriginalBounds: { min: props.min, max: props.max },\n\ttargetBounds: { min: 0, max: 100 },\n\tstep: 1,\n});\n\nconst active = ref(false);\n\nif (props.range && !Array.isArray(props.modelValue)) {\n\tthrow new TypeError(\n\t\t'BaseSlider mode is set as range but modelValue is not an array'\n\t);\n}\n\nonMounted(() => {\n\tif (props.autofocus) {\n\t\tthumbhigher.value?.focus();\n\t}\n});\n\n/**\n * When modelValue changes realign the internal positioning\n */\nwatch(\n\t() => props.modelValue,\n\t(value) => {\n\t\tlet values: number[];\n\t\tif (props.range) {\n\t\t\tconst [min = props.min, max = props.min] = value as number[];\n\t\t\tvalues = [min, max];\n\t\t} else {\n\t\t\tvalues = [props.min, isNotNil(value) ? Number(value) : props.min];\n\t\t}\n\t\tconst [lBound, uBound] = values.map((value) => {\n\t\t\t// Useful for ranges from negative to positive\n\t\t\tlet fallback = isNil(value) ? props.min : Number(value);\n\t\t\tconst transposedValue = transposeValue({\n\t\t\t\tvalue: fallback,\n\t\t\t\ttargetBounds: { min: 0, max: 100 },\n\t\t\t\toriginalBounds: { min: props.min, max: props.max },\n\t\t\t\tstep: 1,\n\t\t\t});\n\t\t\treturn transposedValue;\n\t\t});\n\t\tinternalValueLower.value = lBound;\n\t\tinternalValueHigher.value = uBound;\n\t},\n\t{ immediate: true }\n);\n\nlet thumbPressed = ref(false);\nlet targetThumb = ref<'higher' | 'lower' | null>(null);\n\nconst getTargetThumb = (event: FocusEvent) => {\n\tif (thumbhigher.value && thumbhigher.value.contains(event.target as Node))\n\t\treturn 'higher';\n\tif (thumblower.value && thumblower.value.contains(event.target as Node))\n\t\treturn 'lower';\n\tthrow new Error('Could not identify target thumb');\n};\n\nconst onPointerdown = (event: PointerEvent) => {\n\tif (props.disabled || props.readonly) return;\n\tif (!targetThumb.value) {\n\t\ttargetThumb.value = getTargetThumb(event);\n\t}\n\tthumbPressed.value = true;\n\tdocument.addEventListener('pointermove', onPointermove);\n\tdocument.addEventListener('pointerup', onPointerup);\n\temit('pointerdown', event);\n};\n\nlet listeners = computed(() => (thumbPressed.value ? {} : { onPointerdown }));\n\nconst onPointermove = (event: PointerEvent | MouseEvent) => {\n\tif (props.disabled || props.readonly) return;\n\tif (track.value) {\n\t\tconst trackPosition = track.value.getBoundingClientRect();\n\t\tconst clickOffset = event.clientX;\n\t\tconst trackStart = trackPosition.left;\n\t\tconst trackLength = trackPosition.width;\n\t\tif (event instanceof PointerEvent) {\n\t\t\temit('pointermove', event);\n\t\t} else {\n\t\t\temit('click', event);\n\t\t}\n\t\tconst position = transposeValue({\n\t\t\tvalue: clamp(clickOffset, trackStart, trackStart + trackLength),\n\t\t\toriginalBounds: { min: trackStart, max: trackStart + trackLength },\n\t\t\ttargetBounds: { min: 0, max: 100 },\n\t\t\tstep: proportionalStep,\n\t\t});\n\t\tif (targetThumb.value === 'higher') {\n\t\t\tinternalValueHigher.value = position;\n\t\t} else if (targetThumb.value === 'lower') {\n\t\t\tinternalValueLower.value = position;\n\t\t}\n\t}\n};\n\nconst getValueToEmit = () => {\n\tconst [min, max] = [internalValueLower.value, internalValueHigher.value].sort(\n\t\t(a, b) => a - b\n\t);\n\tconst refined = [min, max].map((value) =>\n\t\ttransposeValue({\n\t\t\tvalue,\n\t\t\toriginalBounds: { min: 0, max: 100 },\n\t\t\ttargetBounds: { min: props.min, max: props.max },\n\t\t\tstep: props.step,\n\t\t})\n\t);\n\tif (props.range) return refined;\n\treturn refined[1];\n};\n\nconst onPointerup = (event: PointerEvent) => {\n\tthumbPressed.value = false;\n\ttargetThumb.value = null;\n\tdocument.removeEventListener('pointermove', onPointermove);\n\tdocument.removeEventListener('pointerup', onPointerup);\n\temit('pointerup', event);\n\temit('update:modelValue', getValueToEmit());\n};\n\nconst onKeydown = (event: KeyboardEvent) => {\n\temit('keydown', event);\n\tif (\n\t\tprops.disabled ||\n\t\tprops.readonly ||\n\t\t(event.key !== 'ArrowLeft' && event.key !== 'ArrowRight')\n\t) {\n\t\treturn;\n\t}\n\n\tif (event.key === 'ArrowLeft') {\n\t\tif (\n\t\t\ttargetThumb.value === 'higher' ||\n\t\t\tdocument.activeElement === thumbhigher.value\n\t\t) {\n\t\t\tinternalValueHigher.value = Math.max(\n\t\t\t\tinternalValueHigher.value - proportionalStep,\n\t\t\t\tinternalValueLower.value\n\t\t\t);\n\t\t} else if (targetThumb.value === 'lower') {\n\t\t\tinternalValueLower.value = Math.max(\n\t\t\t\tinternalValueLower.value - proportionalStep,\n\t\t\t\t0\n\t\t\t);\n\t\t}\n\t} else if (event.key === 'ArrowRight') {\n\t\tif (\n\t\t\ttargetThumb.value === 'higher' ||\n\t\t\tdocument.activeElement === thumbhigher.value\n\t\t) {\n\t\t\tinternalValueHigher.value = Math.min(\n\t\t\t\tinternalValueHigher.value + proportionalStep,\n\t\t\t\t100\n\t\t\t);\n\t\t} else if (targetThumb.value === 'lower') {\n\t\t\tinternalValueLower.value = Math.min(\n\t\t\t\tinternalValueLower.value + proportionalStep,\n\t\t\t\tinternalValueHigher.value\n\t\t\t);\n\t\t}\n\t}\n\temit('update:modelValue', getValueToEmit());\n};\n\nconst onFocus = (event: FocusEvent) => {\n\temit('focus', event);\n\tconst found = getTargetThumb(event);\n\tif (found) targetThumb.value = found;\n\tif (!active.value) {\n\t\tactive.value = true;\n\t\temit('active');\n\t\tdocument.addEventListener('focusin', onDocumentInteraction);\n\t\tdocument.addEventListener('click', onDocumentInteraction);\n\t}\n};\n\nconst onDocumentInteraction = (event: FocusEvent) => {\n\tif (event.target instanceof HTMLElement) {\n\t\tif (!container.value?.contains(event.target)) {\n\t\t\tactive.value = false;\n\t\t\ttargetThumb.value = null;\n\t\t\temit('inactive');\n\t\t\tdocument.removeEventListener('focusin', onDocumentInteraction);\n\t\t\tdocument.removeEventListener('click', onDocumentInteraction);\n\t\t}\n\t}\n};\n\nconst containerAttributes: Record<string, any> = {\n\tclass: {\n\t\t'bb-base-slider': true,\n\t\t'bb-base-slider--disabled': props.disabled,\n\t\t'bb-base-slider--errors': props.hasErrors,\n\t\t'bb-base-slider--readonly': props.readonly,\n\t\t[`bb-base-slider--${props.color}`]: props.color && !isCssColor(props.color),\n\t},\n\tonClick: (event: MouseEvent) => {\n\t\tif (props.range) return;\n\t\tthumbhigher.value?.focus();\n\t\tonPointermove(event);\n\t\tconst valueToEmit = getValueToEmit();\n\t\t// Prevent emitting twice when clicking on the thumb directly\n\t\tif (hash(valueToEmit) === hash(props.modelValue)) return;\n\t\temit('update:modelValue', getValueToEmit());\n\t},\n\tstyle: {},\n};\n\nif (props.color && isCssColor(props.color)) {\n\tcontainerAttributes.style['--color'] = props.color;\n}\n\nconst sliderBackgroundAttributes = computed(() => {\n\tconst classes = 'bb-base-slider__track-background';\n\tconst style: Record<string, any> = {\n\t\twidth: `${sortedInternalValues.value[1] - sortedInternalValues.value[0]}%`,\n\t\tleft: `${sortedInternalValues.value[0]}%`,\n\t};\n\treturn {\n\t\tclass: classes,\n\t\tstyle,\n\t};\n});\n\ntype Tick = {\n\tvalue: number;\n\tpercent: number;\n\tactive: boolean;\n};\n\nconst ticks = computed<Tick[]>(() => {\n\tif (!props.ticks) return [] as Tick[];\n\tlet ticks: Tick[] = [];\n\tlet current = props.min;\n\twhile (current <= props.max) {\n\t\tlet value = current;\n\t\tlet percent = transposeValue({\n\t\t\tvalue,\n\t\t\toriginalBounds: { min: props.min, max: props.max },\n\t\t\ttargetBounds: { min: 0, max: 100 },\n\t\t\tstep: proportionalStep,\n\t\t});\n\t\tlet transposedValue = transposeValue({\n\t\t\tvalue: current,\n\t\t\toriginalBounds: { min: props.min, max: props.max },\n\t\t\ttargetBounds: { min: 0, max: 100 },\n\t\t\tstep: props.step,\n\t\t});\n\t\tconst active =\n\t\t\ttransposedValue >= internalValueLower.value &&\n\t\t\ttransposedValue <= internalValueHigher.value;\n\t\tticks.push({\n\t\t\tvalue,\n\t\t\tpercent,\n\t\t\tactive,\n\t\t});\n\t\tcurrent += props.step;\n\t}\n\treturn ticks;\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BaseSlider';\n</style>\n"],"names":["props","__props","emit","__emit","container","ref","track","thumblower","thumbhigher","internalValueLower","internalValueHigher","valueNowLower","computed","head","isNil","valueNowHigher","sortedInternalValues","a","b","proportionalStep","transposeValue","active","onMounted","_a","watch","value","values","min","max","isNotNil","lBound","uBound","fallback","thumbPressed","targetThumb","getTargetThumb","event","onPointerdown","onPointermove","onPointerup","listeners","trackPosition","clickOffset","trackStart","trackLength","position","clamp","getValueToEmit","refined","onKeydown","onFocus","found","onDocumentInteraction","containerAttributes","isCssColor","valueToEmit","hash","sliderBackgroundAttributes","classes","style","ticks","current","percent","transposedValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoNA,UAAMA,IAAQC,GAoBRC,IAAOC,GAyBPC,IAAYC,KACZC,IAAQD,KACRE,IAAaF,KACbG,IAAcH,KACdI,IAAqBJ,EAAI,CAAC,GAC1BK,IAAsBL,EAAI,CAAC,GAC3BM,IAAgBC,EAAS,MAC1B,MAAM,QAAQZ,EAAM,UAAU,IAC1Ba,EAAKb,EAAM,UAAU,KAAK,SAC3Bc,EAAMd,EAAM,UAAU,IAAI,SAAY,OAAOA,EAAM,UAAU,CACpE,GACKe,IAAiBH,EAAS,MAC3B,MAAM,QAAQZ,EAAM,UAAU,IAC1Ba,EAAKb,EAAM,UAAU,KAAK,SAC3Bc,EAAMd,EAAM,UAAU,IAAI,SAAY,OAAOA,EAAM,UAAU,CACpE,GACKgB,IAAuBJ,EAAS,MAC9B,CAACH,EAAmB,OAAOC,EAAoB,KAAK,EAAE;AAAA,MAC5D,CAACO,GAAGC,MAAMD,IAAIC;AAAA,IAAA,CAEf,GAEKC,IAAmBC,EAAe;AAAA,MACvC,OAAOpB,EAAM,MAAMA,EAAM;AAAA,MACzB,gBAAgB,EAAE,KAAKA,EAAM,KAAK,KAAKA,EAAM,IAAI;A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, createElementBlock as f, normalizeProps as r, guardReactiveProps as c, mergeProps as y, createCommentVNode as q, createElementVNode as l, renderSlot as A } from "vue";
|
|
2
|
-
import { isCssColor as d } from "./
|
|
3
|
-
import { when as F } from "./
|
|
2
|
+
import { isCssColor as d } from "./index222.js";
|
|
3
|
+
import { when as F } from "./index223.js";
|
|
4
4
|
const N = { class: "bb-base-switch-container" }, x = /* @__PURE__ */ l("span", { class: "bb-base-switch-container__icon-thumb" }, null, -1), J = [
|
|
5
5
|
x
|
|
6
6
|
], L = /* @__PURE__ */ I({
|
|
@@ -125,4 +125,4 @@ const N = { class: "bb-base-switch-container" }, x = /* @__PURE__ */ l("span", {
|
|
|
125
125
|
export {
|
|
126
126
|
L as default
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=
|
|
128
|
+
//# sourceMappingURL=index40.js.map
|