bitboss-ui 0.2.76 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +4 -0
- package/dist/components/BaseCheckboxGroup/BaseCheckboxGroup.vue.d.ts +10 -3
- package/dist/components/BaseDatePicker/BaseDatePicker.vue.d.ts +4 -1
- package/dist/components/BaseDatePickerInput/BaseDatePickerInput.vue.d.ts +10 -4
- package/dist/components/BaseInputContainer/BaseInputContainer.vue.d.ts +9 -0
- package/dist/components/BaseNumberInput/BaseNumberInput.vue.d.ts +4 -0
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +4 -0
- package/dist/components/BaseRadioGroup/BaseRadioGroup.vue.d.ts +10 -3
- package/dist/components/BaseRating/BaseRating.vue.d.ts +5 -1
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +4 -0
- package/dist/components/BaseSlider/BaseSlider.vue.d.ts +48 -11
- package/dist/components/BaseSwitchGroup/BaseSwitchGroup.vue.d.ts +6 -3
- package/dist/components/BaseTag/BaseTag.vue.d.ts +4 -0
- package/dist/components/BaseTextInput/BaseTextInput.vue.d.ts +10 -6
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +4 -0
- package/dist/components/BbButton/BbButton.vue.d.ts +12 -0
- package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +35 -27
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +38 -24
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +15 -3
- package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +33 -25
- package/dist/components/BbRadio/BbRadio.vue.d.ts +33 -25
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +38 -24
- package/dist/components/BbRating/BbRating.vue.d.ts +9 -1
- package/dist/components/BbSelect/BbSelect.vue.d.ts +18 -4
- package/dist/components/BbSlider/BbSlider.vue.d.ts +44 -11
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +9 -3
- package/dist/components/BbTag/BbTag.vue.d.ts +11 -3
- package/dist/components/BbTextInput/BbTextInput.vue.d.ts +33 -25
- package/dist/components/BbTextarea/BbTextarea.vue.d.ts +9 -1
- package/dist/composables/useQueue.d.ts +58 -0
- package/dist/index.js +186 -185
- package/dist/index.js.map +1 -1
- package/dist/index10.js +65 -1
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +227 -1
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +1 -437
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +437 -1
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +1 -94
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +103 -1
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +1 -88
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +97 -1
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +1 -89
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +98 -1
- package/dist/index108.js.map +1 -1
- package/dist/index109.js +1 -29
- package/dist/index109.js.map +1 -1
- package/dist/index11.js +1 -131
- package/dist/index11.js.map +1 -1
- package/dist/index110.js +29 -1
- package/dist/index110.js.map +1 -1
- package/dist/index111.js +1 -151
- package/dist/index111.js.map +1 -1
- package/dist/index112.js +151 -1
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +1 -122
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +122 -1
- package/dist/index114.js.map +1 -1
- package/dist/index115.js +1 -46
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +40 -33
- package/dist/index116.js.map +1 -1
- package/dist/index117.js +32 -39
- package/dist/index117.js.map +1 -1
- package/dist/index118.js +39 -42
- package/dist/index118.js.map +1 -1
- package/dist/index119.js +43 -39
- package/dist/index119.js.map +1 -1
- package/dist/index12.js +128 -1
- package/dist/index12.js.map +1 -1
- package/dist/index120.js +43 -2
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +2 -21
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +21 -2
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +2 -224
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +224 -2
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +2 -18
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +16 -10
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +12 -24
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +24 -5
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +5 -9
- package/dist/index129.js.map +1 -1
- package/dist/index13.js +1 -159
- package/dist/index13.js.map +1 -1
- package/dist/index130.js +8 -5
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +5 -69
- package/dist/index131.js.map +1 -1
- package/dist/index132.js +70 -3
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +2 -2
- package/dist/index134.js +2 -2
- package/dist/index135.js +2 -2
- package/dist/index136.js +2 -2
- package/dist/index137.js +2 -2
- package/dist/index138.js +2 -2
- package/dist/index139.js +2 -2
- package/dist/index14.js +161 -1
- package/dist/index14.js.map +1 -1
- package/dist/index140.js +2 -2
- package/dist/index141.js +2 -2
- package/dist/index142.js +2 -2
- package/dist/index143.js +2 -2
- package/dist/index144.js +2 -2
- package/dist/index145.js +2 -2
- package/dist/index146.js +2 -2
- package/dist/index147.js +2 -2
- package/dist/index148.js +2 -2
- package/dist/index149.js +2 -2
- package/dist/index15.js +1 -457
- package/dist/index15.js.map +1 -1
- package/dist/index150.js +2 -2
- package/dist/index151.js +2 -2
- package/dist/index152.js +2 -2
- package/dist/index153.js +2 -2
- package/dist/index154.js +2 -2
- package/dist/index155.js +2 -2
- package/dist/index156.js +2 -2
- package/dist/index157.js +2 -2
- package/dist/index158.js +5 -1
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +1 -5
- package/dist/index159.js.map +1 -1
- package/dist/index16.js +514 -1
- package/dist/index16.js.map +1 -1
- package/dist/index160.js +5 -1
- package/dist/index160.js.map +1 -1
- package/dist/index161.js +1 -5
- package/dist/index161.js.map +1 -1
- package/dist/index162.js +2 -2
- package/dist/index163.js +2 -2
- package/dist/index164.js +2 -2
- package/dist/index165.js +2 -2
- package/dist/index166.js +2 -2
- package/dist/index167.js +3 -2
- package/dist/index167.js.map +1 -1
- package/dist/index168.js +2 -3
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +5 -1
- package/dist/index169.js.map +1 -1
- package/dist/index17.js +1 -211
- package/dist/index17.js.map +1 -1
- package/dist/index170.js +1 -4
- package/dist/index170.js.map +1 -1
- package/dist/index171.js +2 -3
- package/dist/index171.js.map +1 -1
- package/dist/index172.js +2 -2
- package/dist/index173.js +2 -2
- package/dist/index174.js +2 -2
- package/dist/index175.js +2 -2
- package/dist/index176.js +2 -2
- package/dist/index177.js +2 -2
- package/dist/index178.js +2 -2
- package/dist/index179.js +2 -2
- package/dist/index18.js +220 -1
- package/dist/index18.js.map +1 -1
- package/dist/index180.js +2 -2
- package/dist/index181.js +2 -2
- package/dist/index182.js +2 -2
- package/dist/index183.js +5 -1
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +1 -5
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +5 -1
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +1 -5
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +2 -2
- package/dist/index188.js +2 -2
- package/dist/index189.js +2 -2
- package/dist/index19.js +1 -239
- package/dist/index19.js.map +1 -1
- package/dist/index190.js +2 -2
- package/dist/index191.js +2 -2
- package/dist/index192.js +2 -2
- package/dist/index193.js +2 -2
- package/dist/index194.js +2 -2
- package/dist/index195.js +2 -2
- package/dist/index196.js +3 -10
- package/dist/index196.js.map +1 -1
- package/dist/index198.js +2 -3
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +4 -3
- package/dist/index199.js.map +1 -1
- package/dist/index2.js +1 -42
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +239 -1
- package/dist/index20.js.map +1 -1
- package/dist/index200.js +5 -368
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +13 -131
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +16 -5
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +3 -3
- package/dist/index204.js +20 -2
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +29 -2
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +8 -174
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +2 -23
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +111 -363
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +131 -13
- package/dist/index209.js.map +1 -1
- package/dist/index21.js +1 -115
- package/dist/index21.js.map +1 -1
- package/dist/index210.js +2 -16
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +35 -20
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +172 -27
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +6 -8
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +346 -213
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +373 -3
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +3 -35
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +3 -6
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +235 -2
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +3 -2
- package/dist/index219.js.map +1 -1
- package/dist/index22.js +131 -1
- package/dist/index22.js.map +1 -1
- package/dist/index220.js +2 -4
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +8 -119
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +2 -2
- package/dist/index222.js.map +1 -1
- package/dist/index224.js +23 -6
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +4 -17
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +294 -78
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +6 -2
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +2 -160
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +4 -1
- package/dist/index229.js.map +1 -1
- package/dist/index23.js +1 -115
- package/dist/index23.js.map +1 -1
- package/dist/index230.js +2 -5
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +2 -69
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +2 -224
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +2 -258
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +78 -5
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +6 -2
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +17 -295
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +2 -2
- package/dist/index238.js +106 -2
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +428 -110
- package/dist/index239.js.map +1 -1
- package/dist/index24.js +119 -1
- package/dist/index24.js.map +1 -1
- package/dist/index240.js +218 -100
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +255 -12
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +117 -2
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +200 -2
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +2 -2
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +69 -2
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +5 -435
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +163 -88
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +1 -202
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +2 -4
- package/dist/index249.js.map +1 -1
- package/dist/index25.js +1 -92
- package/dist/index25.js.map +1 -1
- package/dist/index250.js +89 -2
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +15 -4
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +4 -4
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +4 -61
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +61 -2
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +2 -3
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +3 -2
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +5 -0
- package/dist/index257.js.map +1 -0
- package/dist/index26.js +94 -1
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +1 -157
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +160 -1
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +1 -124
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +38 -76
- package/dist/index3.js.map +1 -1
- package/dist/index30.js +126 -1
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +1 -691
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +693 -1
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +1 -145
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +302 -1
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +1 -118
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +120 -1
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +1 -154
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +156 -1
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +1 -83
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +78 -62
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +87 -1
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +1 -61
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +64 -1
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +1 -65
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +65 -1
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +1 -96
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +96 -1
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +1 -61
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +61 -1
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +1 -49
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +60 -38
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +49 -1
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +1 -62
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +62 -1
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +1 -45
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +69 -1
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +1 -89
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +98 -1
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +1 -120
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +129 -1
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +1 -85
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +37 -171
- package/dist/index6.js.map +1 -1
- package/dist/index60.js +85 -1
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +1 -88
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +98 -1
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +1 -59
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +59 -1
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +1 -313
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +313 -1
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +1 -129
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +129 -1
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +1 -225
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +172 -18
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +225 -1
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +1 -24
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +19 -41
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +37 -86
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +104 -1
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +1 -227
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +227 -1
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +1 -143
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +165 -1
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +1 -213
- package/dist/index79.js.map +1 -1
- package/dist/index8.js +18 -192
- package/dist/index8.js.map +1 -1
- package/dist/index80.js +213 -1
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +1 -35
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +35 -1
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +1 -83
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +92 -1
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +1 -120
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +129 -1
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +1 -83
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +92 -1
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +1 -30
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +192 -61
- package/dist/index9.js.map +1 -1
- package/dist/index90.js +30 -1
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +1 -157
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +166 -1
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +1 -86
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +112 -1
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +1 -89
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +98 -1
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +1 -119
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +129 -1
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +1 -227
- package/dist/index99.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/utilities/functions/last.d.ts +1 -1
- package/package.json +1 -1
package/dist/index27.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index27.js","sources":["../src/components/BaseRadioGroup/BaseRadioGroup.vue"],"sourcesContent":["<template>\n\t<span\n\t\tref=\"container\"\n\t\tclass=\"bb-base-radio-group\"\n\t\t:class=\"{\n\t\t\t'bb-base-radio-group--errors': hasErrors,\n\t\t\t'bb-base-radio-group--horizontal': direction === 'horizontal',\n\t\t\t'bb-base-radio-group--vertical': direction === 'vertical',\n\t\t}\"\n\t>\n\t\t<span class=\"bb-base-radio-group__container\">\n\t\t\t<slot name=\"prepend\"></slot>\n\t\t\t<span\n\t\t\t\tv-if=\"!options.length && loading\"\n\t\t\t\tclass=\"bb-base-radio-group__loading-container\"\n\t\t\t>\n\t\t\t\t<slot :name=\"'loading'\">{{ loadingText }}</slot></span\n\t\t\t>\n\t\t\t<span\n\t\t\t\tv-else-if=\"!options.length\"\n\t\t\t\tclass=\"bb-base-select__no-data-container\"\n\t\t\t\t><slot :name=\"'no-data'\">{{ noDataText }}</slot></span\n\t\t\t>\n\t\t\t<template v-for=\"(option, index) in options\" :key=\"option?.id || index\">\n\t\t\t\t<slot\n\t\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t\t:disabled=\"!!option.disabled\"\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:item=\"option.original\"\n\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\tname=\"option:prepend\"\n\t\t\t\t></slot>\n\t\t\t\t<label\n\t\t\t\t\tclass=\"bb-base-radio-group-option\"\n\t\t\t\t\t:class=\"{ 'bb-base-radio-selected': option.selected }\"\n\t\t\t\t>\n\t\t\t\t\t<BaseRadio\n\t\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t\t:autofocus=\"autofocus && !index\"\n\t\t\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t\t\t:color=\"color\"\n\t\t\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t\t\t:has-errors=\"hasErrors\"\n\t\t\t\t\t\t:model-value=\"props.modelValue\"\n\t\t\t\t\t\t:name=\"name\"\n\t\t\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t\t\t:value=\"option.value\"\n\t\t\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<template v-if=\"$slots.icon\" #icon=\"data\">\n\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t:item=\"option.original\"\n\t\t\t\t\t\t\t\tname=\"icon\"\n\t\t\t\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\t\t\t\tv-bind=\"data\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</BaseRadio>\n\t\t\t\t\t<span\n\t\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t\t'bb-base-radio-group-option__text': true,\n\t\t\t\t\t\t\t'bb-base-radio-group-option__text--hidden': hideLabel,\n\t\t\t\t\t\t}\"\n\t\t\t\t\t\t><slot\n\t\t\t\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t\t\t\t:item=\"option.original\"\n\t\t\t\t\t\t\tname=\"label\"\n\t\t\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\t\t\t>{{ option.text }}</slot\n\t\t\t\t\t\t></span\n\t\t\t\t\t>\n\t\t\t\t</label>\n\t\t\t\t<slot\n\t\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t\t:disabled=\"!!option.disabled\"\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:item=\"option.original\"\n\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\tname=\"option:append\"\n\t\t\t\t></slot>\n\t\t\t</template>\n\t\t\t<slot name=\"append\"></slot>\n\t\t</span>\n\t</span>\n</template>\n\n<script setup lang=\"ts\" generic=\"T = any\">\nimport { ref, toRef } from 'vue';\nimport { useOptions } from '@/index';\nimport BaseRadio from '../BaseRadio/BaseRadio.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 * 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 * Defines the strategy used to understand whether an option has been selected.\n\t * `string` is 40% faster but relies on property order.\n\t * `equality` is more reliable but is slower.\n\t */\n\tmatchStrategy?: 'string' | 'equality';\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\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: '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\t(e: 'inactive'): void;\n};\n\nconst props = withDefaults(defineProps<BaseRadioGroupProps<T>>(), {\n\tdepsDebounceTime: 0,\n\tdirection: 'horizontal',\n\titems: () => [],\n\tloadingText: 'Caricamento...',\n\tmatchStrategy: 'string',\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 { loading, options } = useOptions({\n\tdependencies: toRef(() => props.dependencies),\n\tdepsDebounceTime: props.depsDebounceTime,\n\tdisabled: toRef(() => props.disabled),\n\temitter: (value) => emit('update:modelValue', value),\n\tenforceCoherence: toRef(() => props.enforceCoherence),\n\tid: props.id,\n\timmediate: true,\n\tinitialItems: toRef(() => props.items),\n\titemText: props.itemText,\n\titemValue: props.itemValue,\n\tmatchStrategy: props.matchStrategy,\n\tmodelValue: toRef(() => props.modelValue),\n\tmodelValueDebounceTime: props.modelValueDebounceTime,\n\tmultiple: 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","value","eventListeners","event","onDocumentFocus","onDocumentClick","_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiOA,UAAMA,IAAQC,GAURC,IAAOC,GA8BPC,IAAYC,KACZC,IAASD,EAAI,EAAK,GAElB,EAAE,SAAAE,GAAS,SAAAC,EAAQ,IAAIC,EAAW;AAAA,MACvC,cAAcC,EAAM,MAAMV,EAAM,YAAY;AAAA,MAC5C,kBAAkBA,EAAM;AAAA,MACxB,UAAUU,EAAM,MAAMV,EAAM,QAAQ;AAAA,MACpC,SAAS,CAACW,MAAUT,EAAK,qBAAqBS,CAAK;AAAA,MACnD,kBAAkBD,EAAM,MAAMV,EAAM,gBAAgB;AAAA,MACpD,IAAIA,EAAM;AAAA,MACV,WAAW;AAAA,MACX,cAAcU,EAAM,MAAMV,EAAM,KAAK;AAAA,MACrC,UAAUA,EAAM;AAAA,MAChB,WAAWA,EAAM;AAAA,MACjB,eAAeA,EAAM;AAAA,MACrB,YAAYU,EAAM,MAAMV,EAAM,UAAU;AAAA,MACxC,wBAAwBA,EAAM;AAAA,MAC9B,UAAU;AAAA,IAAA,CACV,GAWKY,IAAiB;AAAA,MACtB,QAAQ,CAACC,MAAsBX,EAAK,QAAQW,CAAK;AAAA,MACjD,UAAU,CAACA,MAAiBX,EAAK,UAAUW,CAAK;AAAA,MAChD,SAAS,CAACA,MAAsBX,EAAK,SAASW,CAAK;AAAA,MACnD,SAbe,CAACA,MAAsB;AACtC,QAAAX,EAAK,SAASW,CAAK,GACdP,EAAO,UACX,SAAS,iBAAiB,WAAWQ,GAAiB,EAAE,SAAS,IAAM,GACvE,SAAS,iBAAiB,SAASC,GAAiB,EAAE,SAAS,IAAM,GACrET,EAAO,QAAQ;AAAA,MAChB;AAAA,MAQA,SAAS,CAACO,MAAiBX,EAAK,SAASW,CAAK;AAAA,MAC9C,WAAW,CAACA,MAAyBX,EAAK,WAAWW,CAAK;AAAA,MAC1D,aAAa,CAACA,MAAsBX,EAAK,aAAaW,CAAK;AAAA,MAC3D,WAAW,CAACA,MAAsBX,EAAK,WAAWW,CAAK;AAAA,MACvD,uBAAuB,CAACF,MAAeT,EAAK,qBAAqBS,CAAK;AAAA,IAAA,GAGjEG,IAAkB,CAACD,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBG,IAAAZ,EAAU,UAAV,QAAAY,EAAiB,SAASH,EAAM,YACpCX,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWQ,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD,GAGKA,IAAkB,CAACF,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBG,IAAAZ,EAAU,UAAV,QAAAY,EAAiB,SAASH,EAAM,YACpCX,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWQ,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index27.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index28.js
CHANGED
|
@@ -1,2 +1,161 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineComponent as B, ref as k, toRef as r, openBlock as i, createElementBlock as d, normalizeClass as f, createElementVNode as g, renderSlot as s, unref as c, createTextVNode as h, toDisplayString as v, createCommentVNode as w, Fragment as V, renderList as z, createVNode as S, mergeProps as T, createSlots as F, withCtx as N } from "vue";
|
|
2
|
+
import "./index2.js";
|
|
3
|
+
import { useOptions as _ } from "./index7.js";
|
|
4
|
+
import M from "./index26.js";
|
|
5
|
+
import "./index27.js";
|
|
6
|
+
const H = { class: "bb-base-radio-group__container" }, I = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "bb-base-radio-group__loading-container"
|
|
9
|
+
}, R = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "bb-base-radio-group__no-data-container"
|
|
12
|
+
}, j = /* @__PURE__ */ B({
|
|
13
|
+
__name: "BaseRadioGroup",
|
|
14
|
+
props: {
|
|
15
|
+
ariaDescribedby: {},
|
|
16
|
+
autofocus: {},
|
|
17
|
+
color: {},
|
|
18
|
+
dependencies: {},
|
|
19
|
+
depsDebounceTime: { default: 0 },
|
|
20
|
+
direction: { default: "horizontal" },
|
|
21
|
+
disabled: { type: Boolean },
|
|
22
|
+
enforceCoherence: { type: Boolean },
|
|
23
|
+
hasErrors: { type: Boolean },
|
|
24
|
+
hideLabel: { type: Boolean },
|
|
25
|
+
id: {},
|
|
26
|
+
items: { type: [Array, Function], default: () => [] },
|
|
27
|
+
itemText: {},
|
|
28
|
+
itemValue: {},
|
|
29
|
+
loadingText: { default: "Caricamento..." },
|
|
30
|
+
matchStrategy: { default: "string" },
|
|
31
|
+
modelValue: {},
|
|
32
|
+
modelValueDebounceTime: { default: 0 },
|
|
33
|
+
name: {},
|
|
34
|
+
noDataText: { default: "Nessun elemento da visualizzare" },
|
|
35
|
+
readonly: {}
|
|
36
|
+
},
|
|
37
|
+
emits: ["blur", "change", "click", "focus", "input", "keydown", "mousedown", "mouseup", "update:modelValue", "inactive"],
|
|
38
|
+
setup(D, { emit: E }) {
|
|
39
|
+
const o = D, t = E, u = k(), l = k(!1), { loading: L, options: m } = _({
|
|
40
|
+
dependencies: r(() => o.dependencies),
|
|
41
|
+
depsDebounceTime: o.depsDebounceTime,
|
|
42
|
+
disabled: r(() => o.disabled),
|
|
43
|
+
emitter: (e) => t("update:modelValue", e),
|
|
44
|
+
enforceCoherence: r(() => o.enforceCoherence),
|
|
45
|
+
id: o.id,
|
|
46
|
+
immediate: !0,
|
|
47
|
+
initialItems: r(() => o.items),
|
|
48
|
+
itemText: o.itemText,
|
|
49
|
+
itemValue: o.itemValue,
|
|
50
|
+
matchStrategy: o.matchStrategy,
|
|
51
|
+
modelValue: r(() => o.modelValue),
|
|
52
|
+
modelValueDebounceTime: o.modelValueDebounceTime,
|
|
53
|
+
multiple: !1
|
|
54
|
+
}), C = {
|
|
55
|
+
onBlur: (e) => t("blur", e),
|
|
56
|
+
onChange: (e) => t("change", e),
|
|
57
|
+
onClick: (e) => t("click", e),
|
|
58
|
+
onFocus: (e) => {
|
|
59
|
+
t("focus", e), l.value || (document.addEventListener("focusin", b, { passive: !0 }), document.addEventListener("click", p, { passive: !0 }), l.value = !0);
|
|
60
|
+
},
|
|
61
|
+
onInput: (e) => t("input", e),
|
|
62
|
+
onKeydown: (e) => t("keydown", e),
|
|
63
|
+
onMousedown: (e) => t("mousedown", e),
|
|
64
|
+
onMouseup: (e) => t("mouseup", e),
|
|
65
|
+
"onUpdate:modelValue": (e) => t("update:modelValue", e)
|
|
66
|
+
}, b = (e) => {
|
|
67
|
+
var n;
|
|
68
|
+
e.target instanceof HTMLElement && ((n = u.value) != null && n.contains(e.target) || (t("inactive"), l.value = !1, document.removeEventListener("focusin", b), document.removeEventListener("click", p)));
|
|
69
|
+
}, p = (e) => {
|
|
70
|
+
var n;
|
|
71
|
+
e.target instanceof HTMLElement && ((n = u.value) != null && n.contains(e.target) || (t("inactive"), l.value = !1, document.removeEventListener("focusin", b), document.removeEventListener("click", p)));
|
|
72
|
+
};
|
|
73
|
+
return (e, n) => (i(), d("span", {
|
|
74
|
+
ref_key: "container",
|
|
75
|
+
ref: u,
|
|
76
|
+
class: f(["bb-base-radio-group", {
|
|
77
|
+
"bb-base-radio-group--errors": e.hasErrors,
|
|
78
|
+
"bb-base-radio-group--horizontal": e.direction === "horizontal",
|
|
79
|
+
"bb-base-radio-group--vertical": e.direction === "vertical"
|
|
80
|
+
}])
|
|
81
|
+
}, [
|
|
82
|
+
g("span", H, [
|
|
83
|
+
s(e.$slots, "prepend"),
|
|
84
|
+
!c(m).length && c(L) ? (i(), d("span", I, [
|
|
85
|
+
s(e.$slots, "loading", {}, () => [
|
|
86
|
+
h(v(e.loadingText), 1)
|
|
87
|
+
])
|
|
88
|
+
])) : c(m).length ? w("", !0) : (i(), d("span", R, [
|
|
89
|
+
s(e.$slots, "no-data", {}, () => [
|
|
90
|
+
h(v(e.noDataText), 1)
|
|
91
|
+
])
|
|
92
|
+
])),
|
|
93
|
+
(i(!0), d(V, null, z(c(m), (a, y) => (i(), d(V, {
|
|
94
|
+
key: (a == null ? void 0 : a.id) || y
|
|
95
|
+
}, [
|
|
96
|
+
s(e.$slots, "option:prepend", {
|
|
97
|
+
checked: a.selected,
|
|
98
|
+
disabled: !!a.disabled,
|
|
99
|
+
id: a.id,
|
|
100
|
+
item: a.original,
|
|
101
|
+
text: a.text
|
|
102
|
+
}),
|
|
103
|
+
g("label", {
|
|
104
|
+
class: f(["bb-base-radio-group-option", { "bb-base-radio-selected": a.selected }])
|
|
105
|
+
}, [
|
|
106
|
+
S(M, T({
|
|
107
|
+
"aria-describedby": e.ariaDescribedby,
|
|
108
|
+
autofocus: e.autofocus && !y,
|
|
109
|
+
checked: a.selected,
|
|
110
|
+
color: e.color,
|
|
111
|
+
disabled: a.disabled,
|
|
112
|
+
"has-errors": e.hasErrors,
|
|
113
|
+
id: a.id,
|
|
114
|
+
"model-value": o.modelValue,
|
|
115
|
+
name: e.name,
|
|
116
|
+
readonly: e.readonly,
|
|
117
|
+
value: a.value
|
|
118
|
+
}, C), F({ _: 2 }, [
|
|
119
|
+
e.$slots.icon ? {
|
|
120
|
+
name: "icon",
|
|
121
|
+
fn: N(($) => [
|
|
122
|
+
s(e.$slots, "icon", T({
|
|
123
|
+
item: a.original,
|
|
124
|
+
text: a.text
|
|
125
|
+
}, $))
|
|
126
|
+
]),
|
|
127
|
+
key: "0"
|
|
128
|
+
} : void 0
|
|
129
|
+
]), 1040, ["aria-describedby", "autofocus", "checked", "color", "disabled", "has-errors", "id", "model-value", "name", "readonly", "value"]),
|
|
130
|
+
g("span", {
|
|
131
|
+
class: f({
|
|
132
|
+
"bb-base-radio-group-option__text": !0,
|
|
133
|
+
"bb-base-radio-group-option__text--hidden": e.hideLabel
|
|
134
|
+
})
|
|
135
|
+
}, [
|
|
136
|
+
s(e.$slots, "label", {
|
|
137
|
+
checked: a.selected,
|
|
138
|
+
item: a.original,
|
|
139
|
+
text: a.text
|
|
140
|
+
}, () => [
|
|
141
|
+
h(v(a.text), 1)
|
|
142
|
+
])
|
|
143
|
+
], 2)
|
|
144
|
+
], 2),
|
|
145
|
+
s(e.$slots, "option:append", {
|
|
146
|
+
checked: a.selected,
|
|
147
|
+
disabled: !!a.disabled,
|
|
148
|
+
id: a.id,
|
|
149
|
+
item: a.original,
|
|
150
|
+
text: a.text
|
|
151
|
+
})
|
|
152
|
+
], 64))), 128)),
|
|
153
|
+
s(e.$slots, "append")
|
|
154
|
+
])
|
|
155
|
+
], 2));
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
export {
|
|
159
|
+
j as default
|
|
160
|
+
};
|
|
2
161
|
//# sourceMappingURL=index28.js.map
|
package/dist/index28.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index28.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index28.js","sources":["../src/components/BaseRadioGroup/BaseRadioGroup.vue"],"sourcesContent":["<template>\n\t<span\n\t\tref=\"container\"\n\t\tclass=\"bb-base-radio-group\"\n\t\t:class=\"{\n\t\t\t'bb-base-radio-group--errors': hasErrors,\n\t\t\t'bb-base-radio-group--horizontal': direction === 'horizontal',\n\t\t\t'bb-base-radio-group--vertical': direction === 'vertical',\n\t\t}\"\n\t>\n\t\t<span class=\"bb-base-radio-group__container\">\n\t\t\t<slot name=\"prepend\"></slot>\n\t\t\t<span\n\t\t\t\tv-if=\"!options.length && loading\"\n\t\t\t\tclass=\"bb-base-radio-group__loading-container\"\n\t\t\t>\n\t\t\t\t<slot :name=\"'loading'\">{{ loadingText }}</slot></span\n\t\t\t>\n\t\t\t<span\n\t\t\t\tv-else-if=\"!options.length\"\n\t\t\t\tclass=\"bb-base-radio-group__no-data-container\"\n\t\t\t\t><slot :name=\"'no-data'\">{{ noDataText }}</slot></span\n\t\t\t>\n\t\t\t<template v-for=\"(option, index) in options\" :key=\"option?.id || index\">\n\t\t\t\t<slot\n\t\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t\t:disabled=\"!!option.disabled\"\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:item=\"option.original\"\n\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\tname=\"option:prepend\"\n\t\t\t\t></slot>\n\t\t\t\t<label\n\t\t\t\t\tclass=\"bb-base-radio-group-option\"\n\t\t\t\t\t:class=\"{ 'bb-base-radio-selected': option.selected }\"\n\t\t\t\t>\n\t\t\t\t\t<BaseRadio\n\t\t\t\t\t\t:aria-describedby=\"ariaDescribedby\"\n\t\t\t\t\t\t:autofocus=\"autofocus && !index\"\n\t\t\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t\t\t:color=\"color\"\n\t\t\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t\t\t:has-errors=\"hasErrors\"\n\t\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t\t:model-value=\"props.modelValue\"\n\t\t\t\t\t\t:name=\"name\"\n\t\t\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t\t\t:value=\"option.value\"\n\t\t\t\t\t\tv-bind=\"eventListeners\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<template v-if=\"$slots.icon\" #icon=\"data\">\n\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t:item=\"option.original\"\n\t\t\t\t\t\t\t\tname=\"icon\"\n\t\t\t\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\t\t\t\tv-bind=\"data\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</BaseRadio>\n\t\t\t\t\t<span\n\t\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t\t'bb-base-radio-group-option__text': true,\n\t\t\t\t\t\t\t'bb-base-radio-group-option__text--hidden': hideLabel,\n\t\t\t\t\t\t}\"\n\t\t\t\t\t\t><slot\n\t\t\t\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t\t\t\t:item=\"option.original\"\n\t\t\t\t\t\t\tname=\"label\"\n\t\t\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\t\t\t>{{ option.text }}</slot\n\t\t\t\t\t\t></span\n\t\t\t\t\t>\n\t\t\t\t</label>\n\t\t\t\t<slot\n\t\t\t\t\t:checked=\"option.selected\"\n\t\t\t\t\t:disabled=\"!!option.disabled\"\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:item=\"option.original\"\n\t\t\t\t\t:text=\"option.text\"\n\t\t\t\t\tname=\"option:append\"\n\t\t\t\t></slot>\n\t\t\t</template>\n\t\t\t<slot name=\"append\"></slot>\n\t\t</span>\n\t</span>\n</template>\n\n<script setup lang=\"ts\" generic=\"T = any\">\nimport { ref, toRef } from 'vue';\nimport { useOptions } from '@/index';\nimport BaseRadio from '../BaseRadio/BaseRadio.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 * Defines the strategy used to understand whether an option has been selected.\n\t * `string` is 40% faster but relies on property order.\n\t * `equality` is more reliable but is slower.\n\t */\n\tmatchStrategy?: 'string' | 'equality';\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\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: '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\t(e: 'inactive'): void;\n};\n\nconst props = withDefaults(defineProps<BaseRadioGroupProps<T>>(), {\n\tdepsDebounceTime: 0,\n\tdirection: 'horizontal',\n\titems: () => [],\n\tloadingText: 'Caricamento...',\n\tmatchStrategy: 'string',\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 { loading, options } = useOptions({\n\tdependencies: toRef(() => props.dependencies),\n\tdepsDebounceTime: props.depsDebounceTime,\n\tdisabled: toRef(() => props.disabled),\n\temitter: (value) => emit('update:modelValue', value),\n\tenforceCoherence: toRef(() => props.enforceCoherence),\n\tid: props.id,\n\timmediate: true,\n\tinitialItems: toRef(() => props.items),\n\titemText: props.itemText,\n\titemValue: props.itemValue,\n\tmatchStrategy: props.matchStrategy,\n\tmodelValue: toRef(() => props.modelValue),\n\tmodelValueDebounceTime: props.modelValueDebounceTime,\n\tmultiple: 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","value","eventListeners","event","onDocumentFocus","onDocumentClick","_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuOA,UAAMA,IAAQC,GAURC,IAAOC,GA8BPC,IAAYC,KACZC,IAASD,EAAI,EAAK,GAElB,EAAE,SAAAE,GAAS,SAAAC,EAAQ,IAAIC,EAAW;AAAA,MACvC,cAAcC,EAAM,MAAMV,EAAM,YAAY;AAAA,MAC5C,kBAAkBA,EAAM;AAAA,MACxB,UAAUU,EAAM,MAAMV,EAAM,QAAQ;AAAA,MACpC,SAAS,CAACW,MAAUT,EAAK,qBAAqBS,CAAK;AAAA,MACnD,kBAAkBD,EAAM,MAAMV,EAAM,gBAAgB;AAAA,MACpD,IAAIA,EAAM;AAAA,MACV,WAAW;AAAA,MACX,cAAcU,EAAM,MAAMV,EAAM,KAAK;AAAA,MACrC,UAAUA,EAAM;AAAA,MAChB,WAAWA,EAAM;AAAA,MACjB,eAAeA,EAAM;AAAA,MACrB,YAAYU,EAAM,MAAMV,EAAM,UAAU;AAAA,MACxC,wBAAwBA,EAAM;AAAA,MAC9B,UAAU;AAAA,IAAA,CACV,GAWKY,IAAiB;AAAA,MACtB,QAAQ,CAACC,MAAsBX,EAAK,QAAQW,CAAK;AAAA,MACjD,UAAU,CAACA,MAAiBX,EAAK,UAAUW,CAAK;AAAA,MAChD,SAAS,CAACA,MAAsBX,EAAK,SAASW,CAAK;AAAA,MACnD,SAbe,CAACA,MAAsB;AACtC,QAAAX,EAAK,SAASW,CAAK,GACdP,EAAO,UACX,SAAS,iBAAiB,WAAWQ,GAAiB,EAAE,SAAS,IAAM,GACvE,SAAS,iBAAiB,SAASC,GAAiB,EAAE,SAAS,IAAM,GACrET,EAAO,QAAQ;AAAA,MAChB;AAAA,MAQA,SAAS,CAACO,MAAiBX,EAAK,SAASW,CAAK;AAAA,MAC9C,WAAW,CAACA,MAAyBX,EAAK,WAAWW,CAAK;AAAA,MAC1D,aAAa,CAACA,MAAsBX,EAAK,aAAaW,CAAK;AAAA,MAC3D,WAAW,CAACA,MAAsBX,EAAK,WAAWW,CAAK;AAAA,MACvD,uBAAuB,CAACF,MAAeT,EAAK,qBAAqBS,CAAK;AAAA,IAAA,GAGjEG,IAAkB,CAACD,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBG,IAAAZ,EAAU,UAAV,QAAAY,EAAiB,SAASH,EAAM,YACpCX,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWQ,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD,GAGKA,IAAkB,CAACF,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBG,IAAAZ,EAAU,UAAV,QAAAY,EAAiB,SAASH,EAAM,YACpCX,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWQ,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index29.js
CHANGED
|
@@ -1,125 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { booleanishToBoolean as M } from "./index218.js";
|
|
3
|
-
import { identity as F } from "./index204.js";
|
|
4
|
-
import { isCssColor as p } from "./index219.js";
|
|
5
|
-
import { isNotNil as T } from "./index124.js";
|
|
6
|
-
const H = { class: "bb-base-rating__inner-container" }, D = { class: "bb-base-rating__label-text" }, N = ["id", "autofocus", "checked", "disabled", "name", "value"], j = ["height", "width"], A = /* @__PURE__ */ r("path", {
|
|
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
|
-
"stroke-linecap": "round",
|
|
9
|
-
"stroke-linejoin": "round"
|
|
10
|
-
}, null, -1), S = [
|
|
11
|
-
A
|
|
12
|
-
], Q = /* @__PURE__ */ C({
|
|
13
|
-
__name: "BaseRating",
|
|
14
|
-
props: {
|
|
15
|
-
autofocus: {},
|
|
16
|
-
color: {},
|
|
17
|
-
disabled: { type: Boolean },
|
|
18
|
-
hasErrors: { type: Boolean },
|
|
19
|
-
id: {},
|
|
20
|
-
modelValue: {},
|
|
21
|
-
name: {},
|
|
22
|
-
readonly: {},
|
|
23
|
-
stars: { default: 5 },
|
|
24
|
-
size: { default: "md" }
|
|
25
|
-
},
|
|
26
|
-
emits: ["blur", "change", "click", "focus", "inactive", "input", "keydown", "mousedown", "mouseup", "update:modelValue"],
|
|
27
|
-
setup(v, { emit: _ }) {
|
|
28
|
-
const t = v, n = _, c = b(), o = b(!1), k = {
|
|
29
|
-
onBlur: (e) => n("blur", e),
|
|
30
|
-
onChange: (e) => {
|
|
31
|
-
n("change", e), e.target instanceof HTMLInputElement && e.target.checked && n("update:modelValue", +e.target.value);
|
|
32
|
-
},
|
|
33
|
-
onClick: (e) => {
|
|
34
|
-
n("click", e), e.target instanceof HTMLInputElement && e.target.checked && +e.target.value === t.modelValue && n("update:modelValue", null);
|
|
35
|
-
},
|
|
36
|
-
onFocus: (e) => {
|
|
37
|
-
n("focus", e), o.value || (document.addEventListener("focusin", u, { passive: !0 }), document.addEventListener("click", d, { passive: !0 }), o.value = !0);
|
|
38
|
-
},
|
|
39
|
-
onInput: (e) => n("input", e),
|
|
40
|
-
onKeydown: (e) => n("keydown", e),
|
|
41
|
-
onMousedown: (e) => n("mousedown", e),
|
|
42
|
-
onMouseup: (e) => n("mouseup", e)
|
|
43
|
-
}, u = (e) => {
|
|
44
|
-
var s;
|
|
45
|
-
e.target instanceof HTMLElement && ((s = c.value) != null && s.contains(e.target) || (n("inactive"), o.value = !1, document.removeEventListener("focusin", u), document.removeEventListener("click", d)));
|
|
46
|
-
}, d = (e) => {
|
|
47
|
-
var s;
|
|
48
|
-
e.target instanceof HTMLElement && ((s = c.value) != null && s.contains(e.target) || (n("inactive"), o.value = !1, document.removeEventListener("focusin", u), document.removeEventListener("click", d)));
|
|
49
|
-
}, y = {
|
|
50
|
-
xs: 12,
|
|
51
|
-
sm: 16,
|
|
52
|
-
md: 24,
|
|
53
|
-
lg: 28,
|
|
54
|
-
xl: 36,
|
|
55
|
-
xxl: 40
|
|
56
|
-
}, w = f(() => {
|
|
57
|
-
let e;
|
|
58
|
-
return typeof t.size == "string" ? e = y[t.size] ?? parseInt(t.size, 10) : e = t.size, e;
|
|
59
|
-
}), z = f(() => new Array(t.stars).fill(0).map((e, s) => s + 1).map((e) => {
|
|
60
|
-
const s = t.id ? [t.id, e].filter(F).join("_") : void 0, a = e === t.modelValue, m = !!(t.modelValue && e <= t.modelValue), L = !!(t.disabled || T(t.readonly) && M(t.readonly));
|
|
61
|
-
return {
|
|
62
|
-
checked: a,
|
|
63
|
-
disabled: L,
|
|
64
|
-
highlighted: m,
|
|
65
|
-
id: s,
|
|
66
|
-
name: t.name,
|
|
67
|
-
size: w.value,
|
|
68
|
-
value: e
|
|
69
|
-
};
|
|
70
|
-
})), E = f(() => {
|
|
71
|
-
let e = {};
|
|
72
|
-
return t.color && p(t.color) && (e.color = t.color), {
|
|
73
|
-
class: {
|
|
74
|
-
"bb-base-rating": !0,
|
|
75
|
-
"bb-base-rating--has-value": t.modelValue,
|
|
76
|
-
"bb-base-rating--disabled": t.disabled,
|
|
77
|
-
"bb-base-rating--errors": t.hasErrors,
|
|
78
|
-
"bb-base-rating--readonly": t.readonly,
|
|
79
|
-
[`bb-base-rating--${t.color}`]: t.color && !p(t.color)
|
|
80
|
-
},
|
|
81
|
-
style: e
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
return (e, s) => (l(), i("span", g(E.value, {
|
|
85
|
-
ref_key: "container",
|
|
86
|
-
ref: c
|
|
87
|
-
}), [
|
|
88
|
-
r("span", H, [
|
|
89
|
-
(l(!0), i(I, null, V(z.value, (a, m) => (l(), i("label", {
|
|
90
|
-
key: a.value,
|
|
91
|
-
class: B(["bb-base-rating__option", { "bb-base-rating__option--highlighted": a.highlighted }])
|
|
92
|
-
}, [
|
|
93
|
-
r("span", D, h(a.value) + " stell" + h(a.value === 1 ? "a" : "e"), 1),
|
|
94
|
-
r("input", g({
|
|
95
|
-
id: a.id,
|
|
96
|
-
autofocus: e.autofocus && !m,
|
|
97
|
-
checked: a.checked,
|
|
98
|
-
disabled: a.disabled,
|
|
99
|
-
name: a.name,
|
|
100
|
-
type: "radio",
|
|
101
|
-
value: a.value
|
|
102
|
-
}, k), null, 16, N),
|
|
103
|
-
x(e.$slots, "icon", {
|
|
104
|
-
id: a.id,
|
|
105
|
-
checked: a.checked,
|
|
106
|
-
disabled: a.disabled,
|
|
107
|
-
size: a.size,
|
|
108
|
-
value: a.value
|
|
109
|
-
}, () => [
|
|
110
|
-
(l(), i("svg", {
|
|
111
|
-
height: a.size,
|
|
112
|
-
viewBox: "0 0 24 24",
|
|
113
|
-
width: a.size,
|
|
114
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
115
|
-
}, S, 8, j))
|
|
116
|
-
])
|
|
117
|
-
], 2))), 128))
|
|
118
|
-
])
|
|
119
|
-
], 16));
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
export {
|
|
123
|
-
Q as default
|
|
124
|
-
};
|
|
1
|
+
|
|
125
2
|
//# sourceMappingURL=index29.js.map
|
package/dist/index29.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index29.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<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\"\n\t\t\t\t\t>{{ option.value }} stell{{ option.value === 1 ? 'a' : 'e' }}</span\n\t\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\t:id=\"option.id\"\n\t\t\t\t\t:autofocus=\"autofocus && !index\"\n\t\t\t\t\t:checked=\"option.checked\"\n\t\t\t\t\t:disabled=\"option.disabled\"\n\t\t\t\t\t:name=\"option.name\"\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</span>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { booleanishToBoolean } from '@/utilities/functions/booleanishToBoolean';\nimport {\n\tcomputed,\n\tref,\n\ttype InputHTMLAttributes,\n\ttype HTMLAttributes,\n} from 'vue';\nimport { identity } from '@/utilities/functions/identity';\nimport { isCssColor } from '@/utilities/functions/isCssColor';\nimport { isNotNil } from '@/utilities/functions/isNotNil';\nimport type { Size, BbIconProps } from '../BbIcon/BbIcon.vue';\n\nexport type BaseRatingProps = {\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\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\n\tdisabled: boolean;\n\n\thighlighted: boolean;\n\n\tid?: string;\n\n\tname: string;\n\n\tsize: number;\n\n\tvalue: number;\n};\n\nconst props = withDefaults(defineProps<BaseRatingProps>(), {\n\tsize: 'md',\n\tstars: 5,\n});\n\nexport type BaseRatingEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\n\t(e: 'change', event: Event): void;\n\n\t(e: 'click', event: MouseEvent): void;\n\n\t(e: 'focus', event: FocusEvent): void;\n\n\t(e: 'inactive'): void;\n\n\t(e: 'input', event: Event): void;\n\n\t(e: 'keydown', event: KeyboardEvent): void;\n\n\t(e: 'mousedown', event: MouseEvent): void;\n\n\t(e: 'mouseup', event: MouseEvent): void;\n\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;\n\t\tvalue: number;\n\t}) => 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;\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\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,UAAMA,IAAQC,GAuCRC,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,EAAU,UAAV,QAAAO,EAAiB,SAASH,EAAM,YACpCN,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWG,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD,GAGKA,IAAkB,CAACF,MAAsB;;AAC1C,MAAAA,EAAM,kBAAkB,iBACtBG,IAAAP,EAAU,UAAV,QAAAO,EAAiB,SAASH,EAAM,YACpCN,EAAK,UAAU,GACfI,EAAO,QAAQ,IACN,SAAA,oBAAoB,WAAWG,CAAe,GAC9C,SAAA,oBAAoB,SAASC,CAAe;AAAA,IAEvD,GAGKE,IAAgB;AAAA,MACrB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,KAAK;AAAA,IAAA,GAGAC,IAAOC,EAAS,MAAM;AACvB,UAAAC;AACA,aAAA,OAAOf,EAAM,QAAS,WACzBe,IAAYH,EAAQZ,EAAM,IAAkB,KAAK,SAASA,EAAM,MAAM,EAAE,IAExEe,IAAYf,EAAM,MAEZe;AAAA,IAAA,CACP,GAEKC,IAAUF,EAAS,MACjB,IAAI,MAAMd,EAAM,KAAK,EAC1B,KAAK,CAAC,EACN,IAAI,CAACiB,GAAGC,MAAUA,IAAQ,CAAC,EAC3B,IAAI,CAACC,MAAmB;AACxB,YAAMC,IAAKpB,EAAM,KACd,CAACA,EAAM,IAAImB,CAAM,EAAE,OAAOE,CAAQ,EAAE,KAAK,GAAG,IAC5C,QAEGC,IAAUH,MAAWnB,EAAM,YAC3BuB,IAAc,CAAC,EAAEvB,EAAM,cAAcmB,KAAUnB,EAAM,aAErDwB,IAAW,CAAC,EACjBxB,EAAM,YACLyB,EAASzB,EAAM,QAAQ,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,MACxC4B,EAAM,QAAQ5B,EAAM,QAEd;AAAA,QACN,OAAO;AAAA,UACN,kBAAkB;AAAA,UAClB,6BAA6BA,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":"index29.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index3.js
CHANGED
|
@@ -1,81 +1,43 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
|
|
3
|
-
let r =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
);
|
|
11
|
-
const o = {
|
|
12
|
-
actions: !0,
|
|
13
|
-
description: "",
|
|
14
|
-
loading: !1,
|
|
15
|
-
no: !0,
|
|
16
|
-
noText: "",
|
|
17
|
-
open: !1,
|
|
18
|
-
size: "sm",
|
|
19
|
-
text: "",
|
|
20
|
-
theme: "default",
|
|
21
|
-
title: "",
|
|
22
|
-
yes: !0,
|
|
23
|
-
yesText: ""
|
|
24
|
-
}, d = {
|
|
25
|
-
actions: !0,
|
|
26
|
-
description: "",
|
|
27
|
-
no: !0,
|
|
28
|
-
noText: "Annulla",
|
|
29
|
-
text: "",
|
|
30
|
-
theme: "default",
|
|
31
|
-
title: "",
|
|
32
|
-
yes: !0,
|
|
33
|
-
yesText: "OK"
|
|
34
|
-
}, e = x({
|
|
35
|
-
...o
|
|
36
|
-
}), m = f(() => [
|
|
37
|
-
{
|
|
38
|
-
text: e.noText,
|
|
39
|
-
handler: () => {
|
|
40
|
-
i.value = !1;
|
|
1
|
+
import { ref as i, onBeforeUnmount as h } from "vue";
|
|
2
|
+
const b = (l = "bitboss-ui") => {
|
|
3
|
+
let r = 0;
|
|
4
|
+
return { useBroadCastChannel: () => {
|
|
5
|
+
r++;
|
|
6
|
+
const f = i(!1), o = i(), s = {};
|
|
7
|
+
function d(e, n = void 0) {
|
|
8
|
+
o.value && o.value.postMessage({ type: e, params: n });
|
|
41
9
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
10
|
+
const v = () => {
|
|
11
|
+
r--, o.value && !r && o.value.close(), f.value = !0;
|
|
12
|
+
}, p = (e, n, a = {
|
|
13
|
+
removeonUnmount: !0
|
|
14
|
+
}) => {
|
|
15
|
+
var t;
|
|
16
|
+
s[e] === void 0 && (s[e] = []), (t = s[e]) == null || t.push(n), a.removeonUnmount && s[e] && h(() => {
|
|
17
|
+
const c = s[e], u = c.indexOf(n);
|
|
18
|
+
u !== -1 && c.splice(u, 1);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
try {
|
|
22
|
+
o.value = new BroadcastChannel(l), o.value.addEventListener(
|
|
23
|
+
"message",
|
|
24
|
+
(e) => {
|
|
25
|
+
const n = e.data, a = s[n.type] ?? [];
|
|
26
|
+
"params" in n ? a.forEach((t) => t(n.params)) : a.forEach((t) => t());
|
|
27
|
+
},
|
|
28
|
+
{ passive: !0 }
|
|
29
|
+
);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error(e);
|
|
47
32
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
confirm: (s) => {
|
|
56
|
-
i.value = null;
|
|
57
|
-
const n = { ...d, ...s }, t = { ...o };
|
|
58
|
-
return t.title = n.title, t.text = n.text, n.description && (t.description = n.description), n.noText && (t.noText = n.noText), n.yesText && (t.yesText = n.yesText), n.size && (t.size = n.size), n.theme && (t.theme = n.theme), l(n.yes) || (t.yes = !!n.yes), l(n.no) || (t.no = !!n.no), l(n.actions) || (t.actions = !!n.actions), e.actions = t.actions, e.description = t.description, e.no = t.no, e.noText = t.noText, e.open = !0, e.size = t.size, e.text = t.text, e.theme = t.theme, e.title = t.title, e.yes = t.yes, e.yesText = t.yesText, new Promise((a) => {
|
|
59
|
-
r.push(() => a(i.value));
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* Sets the state of the confirm to loading and displays a spinner.
|
|
64
|
-
*/
|
|
65
|
-
setLoading: (s = !0) => {
|
|
66
|
-
e.loading = s;
|
|
67
|
-
},
|
|
68
|
-
/**
|
|
69
|
-
* Closes the confirmation modal. It is a manual operation
|
|
70
|
-
* so you can update the state while the modal is still open.
|
|
71
|
-
*/
|
|
72
|
-
close: () => (e.description = o.description, e.loading = o.loading, e.noText = o.noText, e.open = o.open, e.text = o.text, e.theme = o.theme, e.title = o.title, e.yesText = o.yesText, i.value = !1, Promise.resolve().then(() => {
|
|
73
|
-
i.value = null;
|
|
74
|
-
}))
|
|
75
|
-
});
|
|
33
|
+
return {
|
|
34
|
+
on: p,
|
|
35
|
+
post: d,
|
|
36
|
+
close: v
|
|
37
|
+
};
|
|
38
|
+
} };
|
|
39
|
+
};
|
|
76
40
|
export {
|
|
77
|
-
|
|
78
|
-
e as state,
|
|
79
|
-
y as useConfirm
|
|
41
|
+
b as useBroadcastChannelInstance
|
|
80
42
|
};
|
|
81
43
|
//# sourceMappingURL=index3.js.map
|
package/dist/index3.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.js","sources":["../src/composables/
|
|
1
|
+
{"version":3,"file":"index3.js","sources":["../src/composables/useBroadcastChannelInstance.ts"],"sourcesContent":["import { onBeforeUnmount, ref } from 'vue';\n\ntype MessageMap = { [key: string]: any };\n\ntype Message<T extends MessageMap> = {\n\t[Name in keyof T]: T[Name] extends void\n\t\t? { type: Name }\n\t\t: { type: Name; params: T[Name] };\n}[keyof T];\n\nexport const useBroadcastChannelInstance = <T extends MessageMap>(\n\tname = 'bitboss-ui'\n) => {\n\tlet instances = 0;\n\tconst useBroadCastChannel = () => {\n\t\tinstances++;\n\n\t\tconst isClosed = ref(false);\n\t\tconst channel = ref<BroadcastChannel | undefined>();\n\t\tconst subscribers: Partial<Record<keyof T, ((...args: any[]) => any)[]>> =\n\t\t\t{};\n\n\t\tfunction post<Key extends keyof T>(message: Key, params: T[Key]): void;\n\t\tfunction post<Key extends keyof T>(message: Key, params?: never): void;\n\t\tfunction post(message: keyof T, params: any = undefined) {\n\t\t\tif (channel.value) channel.value.postMessage({ type: message, params });\n\t\t}\n\n\t\tconst close = () => {\n\t\t\tinstances--;\n\t\t\tif (channel.value && !instances) {\n\t\t\t\tchannel.value.close();\n\t\t\t}\n\t\t\tisClosed.value = true;\n\t\t};\n\n\t\tconst on = <Key extends keyof T>(\n\t\t\tmessage: Key,\n\t\t\tfn: T[Key] extends void ? () => any : (arg: T[Key]) => any,\n\t\t\toptions: {\n\t\t\t\tremoveonUnmount: boolean;\n\t\t\t} = {\n\t\t\t\tremoveonUnmount: true,\n\t\t\t}\n\t\t) => {\n\t\t\tif (subscribers[message] === undefined) subscribers[message] = [];\n\n\t\t\tsubscribers[message]?.push(fn);\n\t\t\tif (options.removeonUnmount && subscribers[message]) {\n\t\t\t\tonBeforeUnmount(() => {\n\t\t\t\t\tconst arr = subscribers[message]!;\n\t\t\t\t\tconst indexOfFn = arr.indexOf(fn);\n\t\t\t\t\tif (indexOfFn !== -1) {\n\t\t\t\t\t\tarr.splice(indexOfFn, 1);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tchannel.value = new BroadcastChannel(name);\n\n\t\t\tchannel.value.addEventListener(\n\t\t\t\t'message',\n\t\t\t\t(e: MessageEvent) => {\n\t\t\t\t\tconst data = e.data as Message<T>;\n\t\t\t\t\tconst subs = subscribers[data.type] ?? [];\n\t\t\t\t\tif ('params' in data) {\n\t\t\t\t\t\tsubs.forEach((s) => s(data.params));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsubs.forEach((s) => s());\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ passive: true }\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconsole.error(error);\n\t\t}\n\n\t\treturn {\n\t\t\ton,\n\t\t\tpost,\n\t\t\tclose,\n\t\t};\n\t};\n\treturn { useBroadCastChannel };\n};\n"],"names":["useBroadcastChannelInstance","name","instances","isClosed","ref","channel","subscribers","post","message","params","close","on","fn","options","_a","onBeforeUnmount","arr","indexOfFn","data","subs","s","error"],"mappings":";AAUa,MAAAA,IAA8B,CAC1CC,IAAO,iBACH;AACJ,MAAIC,IAAY;AAwEhB,SAAO,EAAE,qBAvEmB,MAAM;AACjC,IAAAA;AAEM,UAAAC,IAAWC,EAAI,EAAK,GACpBC,IAAUD,KACVE,IACL,CAAA;AAIQ,aAAAC,EAAKC,GAAkBC,IAAc,QAAW;AACxD,MAAIJ,EAAQ,SAAOA,EAAQ,MAAM,YAAY,EAAE,MAAMG,GAAS,QAAAC,GAAQ;AAAA,IACvE;AAEA,UAAMC,IAAQ,MAAM;AACnB,MAAAR,KACIG,EAAQ,SAAS,CAACH,KACrBG,EAAQ,MAAM,SAEfF,EAAS,QAAQ;AAAA,IAAA,GAGZQ,IAAK,CACVH,GACAI,GACAC,IAEI;AAAA,MACH,iBAAiB;AAAA,IAAA,MAEd;;AACA,MAAAP,EAAYE,CAAO,MAAM,WAAuBF,EAAAE,CAAO,IAAI,MAEnDM,IAAAR,EAAAE,CAAO,MAAP,QAAAM,EAAU,KAAKF,IACvBC,EAAQ,mBAAmBP,EAAYE,CAAO,KACjDO,EAAgB,MAAM;AACf,cAAAC,IAAMV,EAAYE,CAAO,GACzBS,IAAYD,EAAI,QAAQJ,CAAE;AAChC,QAAIK,MAAc,MACbD,EAAA,OAAOC,GAAW,CAAC;AAAA,MACxB,CACA;AAAA,IACF;AAGG,QAAA;AACK,MAAAZ,EAAA,QAAQ,IAAI,iBAAiBJ,CAAI,GAEzCI,EAAQ,MAAM;AAAA,QACb;AAAA,QACA,CAAC,MAAoB;AACpB,gBAAMa,IAAO,EAAE,MACTC,IAAOb,EAAYY,EAAK,IAAI,KAAK,CAAA;AACvC,UAAI,YAAYA,IACfC,EAAK,QAAQ,CAACC,MAAMA,EAAEF,EAAK,MAAM,CAAC,IAElCC,EAAK,QAAQ,CAACC,MAAMA,EAAG,CAAA;AAAA,QAEzB;AAAA,QACA,EAAE,SAAS,GAAK;AAAA,MAAA;AAAA,aAETC,GAAO;AACf,cAAQ,MAAMA,CAAK;AAAA,IACpB;AAEO,WAAA;AAAA,MACN,IAAAV;AAAA,MACA,MAAAJ;AAAA,MACA,OAAAG;AAAA,IAAA;AAAA,EACD,EAE4B;AAC9B;"}
|