@feugene/granularity 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/_plugin-vue_export-helper-BG_EqiDU.js +8 -0
- package/dist/chunks/adapter-C7fKeUa4.js +6 -0
- package/dist/chunks/adapter-C7fKeUa4.js.map +1 -0
- package/dist/chunks/arrow-up-DNXrMoAI.js +25 -0
- package/dist/chunks/arrow-up-DNXrMoAI.js.map +1 -0
- package/dist/chunks/classTokens-BPeBXNzu.js +8 -0
- package/dist/chunks/classTokens-BPeBXNzu.js.map +1 -0
- package/dist/chunks/config-2wgwWaAB.js +10 -0
- package/dist/chunks/config-2wgwWaAB.js.map +1 -0
- package/dist/chunks/config-BKRmlivc.js +10 -0
- package/dist/chunks/config-BKRmlivc.js.map +1 -0
- package/dist/chunks/config-BRU5PR8_.js +10 -0
- package/dist/chunks/config-BRU5PR8_.js.map +1 -0
- package/dist/chunks/config-BUGfFjmC.js +16 -0
- package/dist/chunks/config-BUGfFjmC.js.map +1 -0
- package/dist/chunks/config-BXffa3ta.js +60 -0
- package/dist/chunks/config-BXffa3ta.js.map +1 -0
- package/dist/chunks/config-BaMO9dQh.js +22 -0
- package/dist/chunks/config-BaMO9dQh.js.map +1 -0
- package/dist/chunks/config-BbtK511H.js +11 -0
- package/dist/chunks/config-BbtK511H.js.map +1 -0
- package/dist/chunks/config-BcFOkUhh.js +15 -0
- package/dist/chunks/config-BcFOkUhh.js.map +1 -0
- package/dist/chunks/config-BcpRsZTe.js +10 -0
- package/dist/chunks/config-BcpRsZTe.js.map +1 -0
- package/dist/chunks/config-BhubOeci.js +15 -0
- package/dist/chunks/config-BhubOeci.js.map +1 -0
- package/dist/chunks/config-BhvNm4Pp.js +173 -0
- package/dist/chunks/config-BhvNm4Pp.js.map +1 -0
- package/dist/chunks/config-Bv2G0OU6.js +10 -0
- package/dist/chunks/config-Bv2G0OU6.js.map +1 -0
- package/dist/chunks/config-Bv5Dok4j.js +41 -0
- package/dist/chunks/config-Bv5Dok4j.js.map +1 -0
- package/dist/chunks/config-BzQ4S4Hb.js +11 -0
- package/dist/chunks/config-BzQ4S4Hb.js.map +1 -0
- package/dist/chunks/config-BzZGpWsj.js +11 -0
- package/dist/chunks/config-BzZGpWsj.js.map +1 -0
- package/dist/chunks/config-C0b_3LJV.js +42 -0
- package/dist/chunks/config-C0b_3LJV.js.map +1 -0
- package/dist/chunks/config-C2JKq8-2.js +60 -0
- package/dist/chunks/config-C2JKq8-2.js.map +1 -0
- package/dist/chunks/config-C6SBJxcH.js +10 -0
- package/dist/chunks/config-C6SBJxcH.js.map +1 -0
- package/dist/chunks/config-CJbjLC5X.js +55 -0
- package/dist/chunks/config-CJbjLC5X.js.map +1 -0
- package/dist/chunks/config-CJeyaUTp.js +40 -0
- package/dist/chunks/config-CJeyaUTp.js.map +1 -0
- package/dist/chunks/config-CMZE2fu0.js +11 -0
- package/dist/chunks/config-CMZE2fu0.js.map +1 -0
- package/dist/chunks/config-CU_CBd0k.js +24 -0
- package/dist/chunks/config-CU_CBd0k.js.map +1 -0
- package/dist/chunks/config-CYPU3ztl.js +26 -0
- package/dist/chunks/config-CYPU3ztl.js.map +1 -0
- package/dist/chunks/config-CcmeMlic.js +19 -0
- package/dist/chunks/config-CcmeMlic.js.map +1 -0
- package/dist/chunks/config-CdAx6ify2.js +11 -0
- package/dist/chunks/config-CdAx6ify2.js.map +1 -0
- package/dist/chunks/config-CxCAfXZ1.js +23 -0
- package/dist/chunks/config-CxCAfXZ1.js.map +1 -0
- package/dist/chunks/config-D1gSaT52.js +11 -0
- package/dist/chunks/config-D1gSaT52.js.map +1 -0
- package/dist/chunks/config-D7iuXJbl.js +11 -0
- package/dist/chunks/config-D7iuXJbl.js.map +1 -0
- package/dist/chunks/config-D7tRu8u3.js +11 -0
- package/dist/chunks/config-D7tRu8u3.js.map +1 -0
- package/dist/chunks/config-DBYCntwl.js +10 -0
- package/dist/chunks/config-DBYCntwl.js.map +1 -0
- package/dist/chunks/config-DFRYOcrP.js +11 -0
- package/dist/chunks/config-DFRYOcrP.js.map +1 -0
- package/dist/chunks/config-DW_RqmUp.js +10 -0
- package/dist/chunks/config-DW_RqmUp.js.map +1 -0
- package/dist/chunks/config-Dkq0HeLe.js +11 -0
- package/dist/chunks/config-Dkq0HeLe.js.map +1 -0
- package/dist/chunks/config-DlLE49_I.js +11 -0
- package/dist/chunks/config-DlLE49_I.js.map +1 -0
- package/dist/chunks/config-DvTUDLT1.js +46 -0
- package/dist/chunks/config-DvTUDLT1.js.map +1 -0
- package/dist/chunks/config-DwB5-qdP2.js +10 -0
- package/dist/chunks/config-DwB5-qdP2.js.map +1 -0
- package/dist/chunks/config-DxqMXzNV2.js +25 -0
- package/dist/chunks/config-DxqMXzNV2.js.map +1 -0
- package/dist/chunks/config-DxqpV-KM.js +47 -0
- package/dist/chunks/config-DxqpV-KM.js.map +1 -0
- package/dist/chunks/config-Dzz9P-GV2.js +11 -0
- package/dist/chunks/config-Dzz9P-GV2.js.map +1 -0
- package/dist/chunks/config-KGTIAFD92.js +10 -0
- package/dist/chunks/config-KGTIAFD92.js.map +1 -0
- package/dist/chunks/config-TyzU6gLf.js +10 -0
- package/dist/chunks/config-TyzU6gLf.js.map +1 -0
- package/dist/chunks/config-cn6knwud.js +37 -0
- package/dist/chunks/config-cn6knwud.js.map +1 -0
- package/dist/chunks/config-dD6Po-Cq.js +10 -0
- package/dist/chunks/config-dD6Po-Cq.js.map +1 -0
- package/dist/chunks/config-rFwazRKi.js +11 -0
- package/dist/chunks/config-rFwazRKi.js.map +1 -0
- package/dist/chunks/config-rQlbnEKn.js +10 -0
- package/dist/chunks/config-rQlbnEKn.js.map +1 -0
- package/dist/chunks/config-rxFL-6yF2.js +80 -0
- package/dist/chunks/config-rxFL-6yF2.js.map +1 -0
- package/dist/chunks/config-ug8O8epd.js +13 -0
- package/dist/chunks/config-ug8O8epd.js.map +1 -0
- package/dist/chunks/dialogShared-BtXUk6Zc.js +34 -0
- package/dist/chunks/dialogShared-BtXUk6Zc.js.map +1 -0
- package/dist/chunks/directives-Cuib0yOO.js +728 -0
- package/dist/chunks/directives-Cuib0yOO.js.map +1 -0
- package/dist/chunks/en-BMjJZttK.js +50 -0
- package/dist/chunks/en-BMjJZttK.js.map +1 -0
- package/dist/chunks/es-Cu_RlgIr.js +22 -0
- package/dist/chunks/es-Cu_RlgIr.js.map +1 -0
- package/dist/chunks/es-EYCf8G_1.js +50 -0
- package/dist/chunks/es-EYCf8G_1.js.map +1 -0
- package/dist/chunks/fileValidation-CgjTGoUx.js +221 -0
- package/dist/chunks/fileValidation-CgjTGoUx.js.map +1 -0
- package/dist/chunks/{grBadgeStyles-Bu4H8bFc.js → grBadgeStyles-pqqbVgLk.js} +20 -13
- package/dist/chunks/grBadgeStyles-pqqbVgLk.js.map +1 -0
- package/dist/chunks/{grButtonStyles-C5k0bN2e.js → grButtonStyles-BxZW2x0-.js} +62 -52
- package/dist/chunks/grButtonStyles-BxZW2x0-.js.map +1 -0
- package/dist/chunks/grDropdownStyles-DQfLh-bp.js +34 -0
- package/dist/chunks/grDropdownStyles-DQfLh-bp.js.map +1 -0
- package/dist/chunks/grLoadingStyles-CERsxyk9.js +19 -0
- package/dist/chunks/grLoadingStyles-CERsxyk9.js.map +1 -0
- package/dist/chunks/grModalStyles-Dv2NXBKi.js +49 -0
- package/dist/chunks/grModalStyles-Dv2NXBKi.js.map +1 -0
- package/dist/chunks/grSelectStyles-C1zNEkV7.js +52 -0
- package/dist/chunks/grSelectStyles-C1zNEkV7.js.map +1 -0
- package/dist/chunks/granularityI18n-BEWP9aJs.js +28 -0
- package/dist/chunks/granularityI18n-BEWP9aJs.js.map +1 -0
- package/dist/chunks/info-C0bHmdZq.js +28 -0
- package/dist/chunks/info-C0bHmdZq.js.map +1 -0
- package/dist/chunks/loader-circle-B2rWDk5u.js +25 -0
- package/dist/chunks/loader-circle-B2rWDk5u.js.map +1 -0
- package/dist/chunks/ru-DKswMSdd.js +50 -0
- package/dist/chunks/ru-DKswMSdd.js.map +1 -0
- package/dist/chunks/safelist-BF822K15.js +15 -0
- package/dist/chunks/safelist-BF822K15.js.map +1 -0
- package/dist/chunks/safelist-BY7z8fOl.js +26 -0
- package/dist/chunks/safelist-BY7z8fOl.js.map +1 -0
- package/dist/chunks/{shared-BqUqjuxn.js → shared-Bvjkhhm2.js} +151 -111
- package/dist/chunks/shared-Bvjkhhm2.js.map +1 -0
- package/dist/chunks/transition-mJ3PZCHH.js +1694 -0
- package/dist/chunks/transition-mJ3PZCHH.js.map +1 -0
- package/dist/chunks/x-Pa6C2hwi.js +25 -0
- package/dist/chunks/x-Pa6C2hwi.js.map +1 -0
- package/dist/chunks/x-circle-DQSlBLmX.js +69 -0
- package/dist/chunks/x-circle-DQSlBLmX.js.map +1 -0
- package/dist/components/GrAlert/chunks/GrAlert-BjerGcU8.js +148 -0
- package/dist/components/GrAlert/chunks/GrAlert-BjerGcU8.js.map +1 -0
- package/dist/components/GrAlert/index.js +3 -3
- package/dist/components/GrAvatar/chunks/GrAvatar-BjnPKNAL.js +43 -0
- package/dist/components/GrAvatar/chunks/GrAvatar-BjnPKNAL.js.map +1 -0
- package/dist/components/GrAvatar/index.js +3 -3
- package/dist/components/GrBadge/chunks/GrBadge-wuIb4_2K.js +34 -0
- package/dist/components/GrBadge/chunks/GrBadge-wuIb4_2K.js.map +1 -0
- package/dist/components/GrBadge/index.js +3 -3
- package/dist/components/GrBadgeWrap/chunks/GrBadgeWrap-CxtamOZ-.js +35 -0
- package/dist/components/GrBadgeWrap/chunks/GrBadgeWrap-CxtamOZ-.js.map +1 -0
- package/dist/components/GrBadgeWrap/index.js +3 -3
- package/dist/components/GrBottomNav/chunks/GrBottomNav-CsmQ7mTJ.js +33 -0
- package/dist/components/GrBottomNav/chunks/GrBottomNav-CsmQ7mTJ.js.map +1 -0
- package/dist/components/GrBottomNav/index.js +3 -3
- package/dist/components/GrButton/chunks/GrButton-BmGdp8-4.js +85 -0
- package/dist/components/GrButton/chunks/GrButton-BmGdp8-4.js.map +1 -0
- package/dist/components/GrButton/index.js +5 -5
- package/dist/components/GrButtonGroup/chunks/GrButtonGroup-CBj4tpms.js +23 -0
- package/dist/components/GrButtonGroup/chunks/GrButtonGroup-CBj4tpms.js.map +1 -0
- package/dist/components/GrButtonGroup/index.js +3 -3
- package/dist/components/GrCard/chunks/GrCard-xtDcXBr7.js +13 -0
- package/dist/components/GrCard/chunks/GrCard-xtDcXBr7.js.map +1 -0
- package/dist/components/GrCard/index.js +3 -3
- package/dist/components/GrCheckbox/chunks/GrCheckbox-Bt3d7ckE.js +136 -0
- package/dist/components/GrCheckbox/chunks/GrCheckbox-Bt3d7ckE.js.map +1 -0
- package/dist/components/GrCheckbox/index.js +3 -3
- package/dist/components/GrCollapse/chunks/GrCollapse-HU20VTVn.js +207 -0
- package/dist/components/GrCollapse/chunks/GrCollapse-HU20VTVn.js.map +1 -0
- package/dist/components/GrCollapse/index.js +3 -3
- package/dist/components/GrConfirmDialog/chunks/GrConfirmDialog-DjGOX9Hd.js +133 -0
- package/dist/components/GrConfirmDialog/chunks/GrConfirmDialog-DjGOX9Hd.js.map +1 -0
- package/dist/components/GrConfirmDialog/index.js +3 -3
- package/dist/components/GrDataTable/chunks/GrDataTable-QDOJWmdY.js +181 -0
- package/dist/components/GrDataTable/chunks/GrDataTable-QDOJWmdY.js.map +1 -0
- package/dist/components/GrDataTable/index.js +3 -3
- package/dist/components/GrDialog/chunks/GrDialog-gObmaVEl.js +223 -0
- package/dist/components/GrDialog/chunks/GrDialog-gObmaVEl.js.map +1 -0
- package/dist/components/GrDialog/index.js +4 -4
- package/dist/components/GrDrawer/chunks/GrDrawer-BJL_gTxI.js +158 -0
- package/dist/components/GrDrawer/chunks/GrDrawer-BJL_gTxI.js.map +1 -0
- package/dist/components/GrDrawer/index.js +3 -3
- package/dist/components/GrDropdown/chunks/GrDropdown-DVTU32T_.js +153 -0
- package/dist/components/GrDropdown/chunks/GrDropdown-DVTU32T_.js.map +1 -0
- package/dist/components/GrDropdown/index.js +3 -3
- package/dist/components/GrDropdownMenu/chunks/GrDropdownMenu-fePQRcgh.js +311 -0
- package/dist/components/GrDropdownMenu/chunks/GrDropdownMenu-fePQRcgh.js.map +1 -0
- package/dist/components/GrDropdownMenu/index.js +3 -3
- package/dist/components/GrEmptyState/chunks/GrEmptyState-Bs8d3tgb.js +64 -0
- package/dist/components/GrEmptyState/chunks/GrEmptyState-Bs8d3tgb.js.map +1 -0
- package/dist/components/GrEmptyState/index.js +3 -3
- package/dist/components/GrFileUpload/chunks/GrFileUpload-DVv8yXpl.js +370 -0
- package/dist/components/GrFileUpload/chunks/GrFileUpload-DVv8yXpl.js.map +1 -0
- package/dist/components/GrFileUpload/index.js +4 -4
- package/dist/components/GrFormField/chunks/GrFormField-BzezYcS8.js +37 -0
- package/dist/components/GrFormField/chunks/GrFormField-BzezYcS8.js.map +1 -0
- package/dist/components/GrFormField/index.js +3 -3
- package/dist/components/GrFormFile/chunks/GrFormFile-DtZOypJW.js +315 -0
- package/dist/components/GrFormFile/chunks/GrFormFile-DtZOypJW.js.map +1 -0
- package/dist/components/GrFormFile/index.js +3 -3
- package/dist/components/GrFormSection/chunks/GrFormSection-BIPB1RIk.js +37 -0
- package/dist/components/GrFormSection/chunks/GrFormSection-BIPB1RIk.js.map +1 -0
- package/dist/components/GrFormSection/index.js +3 -3
- package/dist/components/GrIcon/chunks/GrIcon-BV7RBU_0.js +34 -0
- package/dist/components/GrIcon/chunks/GrIcon-BV7RBU_0.js.map +1 -0
- package/dist/components/GrIcon/index.js +3 -3
- package/dist/components/GrImageViewer/chunks/GrImageViewer-fn8ilJTA.js +399 -0
- package/dist/components/GrImageViewer/chunks/GrImageViewer-fn8ilJTA.js.map +1 -0
- package/dist/components/GrImageViewer/index.js +3 -3
- package/dist/components/GrInput/chunks/GrInput-DLLRrH1A.js +213 -0
- package/dist/components/GrInput/chunks/GrInput-DLLRrH1A.js.map +1 -0
- package/dist/components/GrInput/index.js +3 -3
- package/dist/components/GrInputTag/chunks/GrInputTag-CzrrBxgU.js +259 -0
- package/dist/components/GrInputTag/chunks/GrInputTag-CzrrBxgU.js.map +1 -0
- package/dist/components/GrInputTag/index.js +3 -3
- package/dist/components/GrLink/chunks/GrLink-Dhkid3Mp.js +82 -0
- package/dist/components/GrLink/chunks/GrLink-Dhkid3Mp.js.map +1 -0
- package/dist/components/GrLink/index.js +3 -3
- package/dist/components/GrList/chunks/GrList-CjgeVjhY.js +79 -0
- package/dist/components/GrList/chunks/GrList-CjgeVjhY.js.map +1 -0
- package/dist/components/GrList/index.js +3 -3
- package/dist/components/GrLoading/chunks/GrLoading-DihGX3ol.js +71 -0
- package/dist/components/GrLoading/chunks/GrLoading-DihGX3ol.js.map +1 -0
- package/dist/components/GrLoading/index.js +3 -3
- package/dist/components/GrModal/chunks/GrModal-gvfvlp7k.js +170 -0
- package/dist/components/GrModal/chunks/GrModal-gvfvlp7k.js.map +1 -0
- package/dist/components/GrModal/index.js +4 -4
- package/dist/components/GrNavbar/chunks/GrNavbar-CQOAfO6y.js +77 -0
- package/dist/components/GrNavbar/chunks/GrNavbar-CQOAfO6y.js.map +1 -0
- package/dist/components/GrNavbar/index.js +3 -3
- package/dist/components/GrNumberInput/chunks/GrNumberInput-CyHgUotG.js +399 -0
- package/dist/components/GrNumberInput/chunks/GrNumberInput-CyHgUotG.js.map +1 -0
- package/dist/components/GrNumberInput/index.js +3 -3
- package/dist/components/GrPagination/chunks/GrPagination-C5cxRJsF.js +116 -0
- package/dist/components/GrPagination/chunks/GrPagination-C5cxRJsF.js.map +1 -0
- package/dist/components/GrPagination/index.js +3 -3
- package/dist/components/GrProgressBar/chunks/GrProgressBar-C9wAAFxR.js +41 -0
- package/dist/components/GrProgressBar/chunks/GrProgressBar-C9wAAFxR.js.map +1 -0
- package/dist/components/GrProgressBar/index.js +3 -3
- package/dist/components/GrPromptDialog/chunks/GrPromptDialog-Cfq9bvL3.js +192 -0
- package/dist/components/GrPromptDialog/chunks/GrPromptDialog-Cfq9bvL3.js.map +1 -0
- package/dist/components/GrPromptDialog/index.js +3 -3
- package/dist/components/GrRadio/chunks/GrRadio-B_t_ZNVl.js +186 -0
- package/dist/components/GrRadio/chunks/GrRadio-B_t_ZNVl.js.map +1 -0
- package/dist/components/GrRadio/index.js +3 -3
- package/dist/components/GrRadioGroup/chunks/GrRadioGroup-CVlgpUBr.js +82 -0
- package/dist/components/GrRadioGroup/chunks/GrRadioGroup-CVlgpUBr.js.map +1 -0
- package/dist/components/GrRadioGroup/index.js +3 -3
- package/dist/components/GrSegmented/chunks/GrSegmented-BPl1koHc.js +325 -0
- package/dist/components/GrSegmented/chunks/GrSegmented-BPl1koHc.js.map +1 -0
- package/dist/components/GrSegmented/index.js +3 -3
- package/dist/components/GrSelect/chunks/GrSelect-aVqUL-1F.js +445 -0
- package/dist/components/GrSelect/chunks/GrSelect-aVqUL-1F.js.map +1 -0
- package/dist/components/GrSelect/index.js +3 -3
- package/dist/components/GrSidebar/chunks/GrSidebar-DVucgcfV.js +46 -0
- package/dist/components/GrSidebar/chunks/GrSidebar-DVucgcfV.js.map +1 -0
- package/dist/components/GrSidebar/index.js +3 -3
- package/dist/components/GrSkeleton/chunks/GrSkeleton-CDTvCSoH.js +35 -0
- package/dist/components/GrSkeleton/chunks/GrSkeleton-CDTvCSoH.js.map +1 -0
- package/dist/components/GrSkeleton/index.js +3 -3
- package/dist/components/GrSwitch/chunks/GrSwitch-Bnamgqb2.js +81 -0
- package/dist/components/GrSwitch/chunks/GrSwitch-Bnamgqb2.js.map +1 -0
- package/dist/components/GrSwitch/index.js +3 -3
- package/dist/components/GrTable/chunks/GrTable-CyQ9uw8A.js +59 -0
- package/dist/components/GrTable/chunks/GrTable-CyQ9uw8A.js.map +1 -0
- package/dist/components/GrTable/index.js +3 -3
- package/dist/components/GrTabs/chunks/GrTabs-CiGmcmvm.js +120 -0
- package/dist/components/GrTabs/chunks/GrTabs-CiGmcmvm.js.map +1 -0
- package/dist/components/GrTabs/index.js +3 -3
- package/dist/components/GrTextarea/chunks/GrTextarea-VBSc6A7D.js +73 -0
- package/dist/components/GrTextarea/chunks/GrTextarea-VBSc6A7D.js.map +1 -0
- package/dist/components/GrTextarea/index.js +3 -3
- package/dist/components/GrToaster/chunks/GrToaster-I1e-zCpf.js +173 -0
- package/dist/components/GrToaster/chunks/GrToaster-I1e-zCpf.js.map +1 -0
- package/dist/components/GrToaster/index.js +3 -3
- package/dist/components/GrTooltip/chunks/GrTooltip-CrV1gI_c.js +57 -0
- package/dist/components/GrTooltip/chunks/GrTooltip-CrV1gI_c.js.map +1 -0
- package/dist/components/GrTooltip/index.js +3 -3
- package/dist/components/GrTree/chunks/GrTree-Dlev9oBd.js +736 -0
- package/dist/components/GrTree/chunks/GrTree-Dlev9oBd.js.map +1 -0
- package/dist/components/GrTree/index.js +3 -3
- package/dist/components/GrTreeSelect/chunks/GrTreeSelect-DN6XFjOD.js +456 -0
- package/dist/components/GrTreeSelect/chunks/GrTreeSelect-DN6XFjOD.js.map +1 -0
- package/dist/components/GrTreeSelect/index.js +3 -3
- package/dist/composables/useTheme.js +41 -30
- package/dist/composables/useTheme.js.map +1 -0
- package/dist/composables/useToast.js +43 -34
- package/dist/composables/useToast.js.map +1 -0
- package/dist/directives/index.js +2 -2
- package/dist/fileValidation/index.js +2 -2
- package/dist/granular-provider-node.js +25 -14
- package/dist/granular-provider-node.js.map +1 -0
- package/dist/granular-provider.js +5 -3
- package/dist/granular-provider.js.map +1 -0
- package/dist/i18n/all.js +8 -6
- package/dist/i18n/all.js.map +1 -0
- package/dist/i18n/index.js +3 -3
- package/dist/index.js +105 -105
- package/dist/vue/index.js +66 -26
- package/dist/vue/index.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunks/_plugin-vue_export-helper-CHO2XVys.js +0 -8
- package/dist/chunks/adapter-D5uYoOZj.js +0 -4
- package/dist/chunks/arrow-up-Dv3dC3hu.js +0 -23
- package/dist/chunks/classTokens-CT1tqF2j.js +0 -6
- package/dist/chunks/config-B5JCvHys.js +0 -13
- package/dist/chunks/config-BDXa5Sna2.js +0 -9
- package/dist/chunks/config-BG5_FuZ-.js +0 -34
- package/dist/chunks/config-BMYKG1oB.js +0 -10
- package/dist/chunks/config-BQREEXFD.js +0 -8
- package/dist/chunks/config-BUZtbeTr.js +0 -40
- package/dist/chunks/config-BVXycfiO.js +0 -9
- package/dist/chunks/config-BZW-RL6E.js +0 -14
- package/dist/chunks/config-BhbfV-Is.js +0 -48
- package/dist/chunks/config-BmYFupZh.js +0 -8
- package/dist/chunks/config-BsZc_QQ-2.js +0 -20
- package/dist/chunks/config-C1Sn7mn-.js +0 -27
- package/dist/chunks/config-C4_REX-3.js +0 -9
- package/dist/chunks/config-CBFllZZ4.js +0 -9
- package/dist/chunks/config-CDyD_fCt.js +0 -8
- package/dist/chunks/config-CJeG727i.js +0 -149
- package/dist/chunks/config-CLawBqde.js +0 -21
- package/dist/chunks/config-CMz46RPG.js +0 -8
- package/dist/chunks/config-CO-7HRZd2.js +0 -8
- package/dist/chunks/config-CS7E7LME.js +0 -9
- package/dist/chunks/config-CVy124Xj.js +0 -8
- package/dist/chunks/config-CcixQGaN.js +0 -47
- package/dist/chunks/config-CiVXZxyQ.js +0 -9
- package/dist/chunks/config-CoMQmunP.js +0 -8
- package/dist/chunks/config-Cq6ufYtp.js +0 -9
- package/dist/chunks/config-D8CIEWcb.js +0 -8
- package/dist/chunks/config-D8hKc39m.js +0 -18
- package/dist/chunks/config-D9MxGwCJ.js +0 -8
- package/dist/chunks/config-DBXTZE36.js +0 -15
- package/dist/chunks/config-DK9C8O7L.js +0 -9
- package/dist/chunks/config-DTegOmx2.js +0 -8
- package/dist/chunks/config-DYI8XADo.js +0 -47
- package/dist/chunks/config-DlidGf7P.js +0 -8
- package/dist/chunks/config-DtNe7EIX.js +0 -35
- package/dist/chunks/config-EdWeK_ge.js +0 -17
- package/dist/chunks/config-FGAkxHFh.js +0 -8
- package/dist/chunks/config-M76gNxd2.js +0 -37
- package/dist/chunks/config-NuqoO_Of.js +0 -33
- package/dist/chunks/config-QsovJrku2.js +0 -66
- package/dist/chunks/config-R6F6zRJk.js +0 -9
- package/dist/chunks/config-SLwkDc4Q2.js +0 -9
- package/dist/chunks/config-aJ7sb62Y.js +0 -8
- package/dist/chunks/config-b9nc87Oc.js +0 -9
- package/dist/chunks/config-dSI8RttH2.js +0 -8
- package/dist/chunks/config-im2VHeSM.js +0 -9
- package/dist/chunks/config-vKeQ035f.js +0 -9
- package/dist/chunks/config-vMcxHlWi.js +0 -14
- package/dist/chunks/dialogShared-CONROtU2.js +0 -26
- package/dist/chunks/directives-Dr5NPOT8.js +0 -530
- package/dist/chunks/en-j3simI0h.js +0 -41
- package/dist/chunks/es-CIT9s_vo.js +0 -4
- package/dist/chunks/es-CLpJj7KP.js +0 -41
- package/dist/chunks/fileValidation-LFD-vwil.js +0 -193
- package/dist/chunks/grDropdownStyles-149X1NeB.js +0 -31
- package/dist/chunks/grLoadingStyles-Bjo7ylmq.js +0 -15
- package/dist/chunks/grModalStyles-Dmd4havY.js +0 -38
- package/dist/chunks/grSelectStyles-C3QKIn1J.js +0 -40
- package/dist/chunks/granularityI18n-8_v1B11L.js +0 -24
- package/dist/chunks/info-CNJnuTYC.js +0 -26
- package/dist/chunks/loader-circle-C5vCCMfB.js +0 -23
- package/dist/chunks/ru-CiOZPnBu.js +0 -41
- package/dist/chunks/safelist-Bq32hAXc.js +0 -13
- package/dist/chunks/safelist-CLcTRYB-.js +0 -22
- package/dist/chunks/transition-BJXMi52x.js +0 -1617
- package/dist/chunks/x--kxrj3ez.js +0 -23
- package/dist/chunks/x-circle-ChJ87u1v.js +0 -61
- package/dist/components/GrAlert/chunks/GrAlert-DLHkusb-.js +0 -129
- package/dist/components/GrAvatar/chunks/GrAvatar-BFYH3HJw.js +0 -32
- package/dist/components/GrBadge/chunks/GrBadge-D_AoqGrn.js +0 -27
- package/dist/components/GrBadgeWrap/chunks/GrBadgeWrap-C_N0QJfA.js +0 -26
- package/dist/components/GrBottomNav/chunks/GrBottomNav-Chpu3SVd.js +0 -21
- package/dist/components/GrButton/chunks/GrButton-BXVVt6Od.js +0 -67
- package/dist/components/GrButtonGroup/chunks/GrButtonGroup-CmnYHVH7.js +0 -16
- package/dist/components/GrCard/chunks/GrCard-DEpN6Ptf.js +0 -10
- package/dist/components/GrCheckbox/chunks/GrCheckbox-DF3vJApB.js +0 -111
- package/dist/components/GrCollapse/chunks/GrCollapse-D7QYRqNa.js +0 -150
- package/dist/components/GrConfirmDialog/chunks/GrConfirmDialog-C7Eh8-Vn.js +0 -111
- package/dist/components/GrDataTable/chunks/GrDataTable-Dxsg1NMP.js +0 -142
- package/dist/components/GrDialog/chunks/GrDialog-BSd4-uP5.js +0 -169
- package/dist/components/GrDrawer/chunks/GrDrawer-DBBSwe1s.js +0 -135
- package/dist/components/GrDropdown/chunks/GrDropdown-BELyRP4A.js +0 -110
- package/dist/components/GrDropdownMenu/chunks/GrDropdownMenu-B8fuk7iP.js +0 -233
- package/dist/components/GrEmptyState/chunks/GrEmptyState-BPGoafJI.js +0 -49
- package/dist/components/GrFileUpload/chunks/GrFileUpload-BPzx3LEM.js +0 -294
- package/dist/components/GrFormField/chunks/GrFormField-Cn8g9eFP.js +0 -28
- package/dist/components/GrFormFile/chunks/GrFormFile-DfinD5Iv.js +0 -248
- package/dist/components/GrFormSection/chunks/GrFormSection-dKpQw-vh.js +0 -27
- package/dist/components/GrIcon/chunks/GrIcon-CXIHuG7L.js +0 -25
- package/dist/components/GrImageViewer/chunks/GrImageViewer-CQSNx-D7.js +0 -322
- package/dist/components/GrInput/chunks/GrInput-CLKX1inm.js +0 -158
- package/dist/components/GrInputTag/chunks/GrInputTag-BAtLody2.js +0 -214
- package/dist/components/GrLink/chunks/GrLink-BpXnly-Y.js +0 -59
- package/dist/components/GrList/chunks/GrList-BrFc7VdS.js +0 -55
- package/dist/components/GrLoading/chunks/GrLoading-dFuoryMY.js +0 -53
- package/dist/components/GrModal/chunks/GrModal-uaWXH08K.js +0 -136
- package/dist/components/GrNavbar/chunks/GrNavbar-KzLHgdjX.js +0 -62
- package/dist/components/GrNumberInput/chunks/GrNumberInput-rENn1802.js +0 -315
- package/dist/components/GrPagination/chunks/GrPagination-DP0x3rx6.js +0 -93
- package/dist/components/GrProgressBar/chunks/GrProgressBar-DpW93sOi.js +0 -29
- package/dist/components/GrPromptDialog/chunks/GrPromptDialog-ASfBwyzQ.js +0 -158
- package/dist/components/GrRadio/chunks/GrRadio-8BOo97XV.js +0 -147
- package/dist/components/GrRadioGroup/chunks/GrRadioGroup-BymbUmqI.js +0 -66
- package/dist/components/GrSegmented/chunks/GrSegmented-CK5C_lN7.js +0 -250
- package/dist/components/GrSelect/chunks/GrSelect-BMfc1-vs.js +0 -314
- package/dist/components/GrSidebar/chunks/GrSidebar-C4SXXhfO.js +0 -29
- package/dist/components/GrSkeleton/chunks/GrSkeleton-QlieOdpY.js +0 -25
- package/dist/components/GrSwitch/chunks/GrSwitch-Cefiutzu.js +0 -64
- package/dist/components/GrTable/chunks/GrTable-k_FUiJQk.js +0 -44
- package/dist/components/GrTabs/chunks/GrTabs-B46P-lUc.js +0 -98
- package/dist/components/GrTextarea/chunks/GrTextarea-BX7L1MJk.js +0 -57
- package/dist/components/GrToaster/chunks/GrToaster-C4l_BjOh.js +0 -139
- package/dist/components/GrTooltip/chunks/GrTooltip-BqRAzuLT.js +0 -37
- package/dist/components/GrTree/chunks/GrTree-C2CXR_vW.js +0 -614
- package/dist/components/GrTreeSelect/chunks/GrTreeSelect-DAAay-QB.js +0 -353
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, nextTick, normalizeStyle, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, useSlots } from "vue";
|
|
2
|
+
//#region src/components/GrInput/GrInput.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var _hoisted_1 = { class: "relative w-full" };
|
|
4
|
+
var _hoisted_2 = [
|
|
5
|
+
"id",
|
|
6
|
+
"name",
|
|
7
|
+
"type",
|
|
8
|
+
"inputmode",
|
|
9
|
+
"autocomplete",
|
|
10
|
+
"placeholder",
|
|
11
|
+
"disabled",
|
|
12
|
+
"value",
|
|
13
|
+
"aria-invalid"
|
|
14
|
+
];
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/GrInput/GrInput.vue
|
|
17
|
+
var GrInput_default = /* @__PURE__ */ defineComponent({
|
|
18
|
+
inheritAttrs: false,
|
|
19
|
+
__name: "GrInput",
|
|
20
|
+
props: {
|
|
21
|
+
modelValue: {},
|
|
22
|
+
type: { default: "text" },
|
|
23
|
+
placeholder: { default: void 0 },
|
|
24
|
+
autocomplete: { default: void 0 },
|
|
25
|
+
inputmode: { default: void 0 },
|
|
26
|
+
disabled: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
invalid: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
state: { default: "default" },
|
|
35
|
+
name: { default: void 0 },
|
|
36
|
+
id: { default: void 0 },
|
|
37
|
+
size: { default: "md" },
|
|
38
|
+
textAlign: { default: "left" },
|
|
39
|
+
prefixMinWidth: { default: void 0 },
|
|
40
|
+
prefixMaxWidth: { default: void 0 },
|
|
41
|
+
suffixMinWidth: { default: void 0 },
|
|
42
|
+
suffixMaxWidth: { default: void 0 }
|
|
43
|
+
},
|
|
44
|
+
emits: ["update:modelValue"],
|
|
45
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
46
|
+
const props = __props;
|
|
47
|
+
const emit = __emit;
|
|
48
|
+
const inputEl = ref(null);
|
|
49
|
+
function focus() {
|
|
50
|
+
inputEl.value?.focus();
|
|
51
|
+
}
|
|
52
|
+
__expose({ focus });
|
|
53
|
+
const slots = useSlots();
|
|
54
|
+
const hasPrefix = computed(() => Boolean(slots.prefix));
|
|
55
|
+
const hasSuffix = computed(() => Boolean(slots.suffix));
|
|
56
|
+
const defaultAddonMinWidth = computed(() => {
|
|
57
|
+
return {
|
|
58
|
+
xs: "2rem",
|
|
59
|
+
sm: "2.25rem",
|
|
60
|
+
md: "2.5rem",
|
|
61
|
+
lg: "3rem"
|
|
62
|
+
}[props.size];
|
|
63
|
+
});
|
|
64
|
+
const prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value);
|
|
65
|
+
const suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value);
|
|
66
|
+
const prefixEl = ref(null);
|
|
67
|
+
const suffixEl = ref(null);
|
|
68
|
+
const measuredPrefixWidth = ref(void 0);
|
|
69
|
+
const measuredSuffixWidth = ref(void 0);
|
|
70
|
+
let ro = null;
|
|
71
|
+
let scheduled = false;
|
|
72
|
+
function readWidthPx(el) {
|
|
73
|
+
if (!el) return void 0;
|
|
74
|
+
const width = Math.ceil(el.getBoundingClientRect().width || 0);
|
|
75
|
+
if (width <= 0) return void 0;
|
|
76
|
+
return `${width}px`;
|
|
77
|
+
}
|
|
78
|
+
function measure() {
|
|
79
|
+
measuredPrefixWidth.value = hasPrefix.value ? readWidthPx(prefixEl.value) : void 0;
|
|
80
|
+
measuredSuffixWidth.value = hasSuffix.value ? readWidthPx(suffixEl.value) : void 0;
|
|
81
|
+
}
|
|
82
|
+
function refreshObserver() {
|
|
83
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
84
|
+
if (!ro) ro = new ResizeObserver(() => measure());
|
|
85
|
+
ro.disconnect();
|
|
86
|
+
if (prefixEl.value) ro.observe(prefixEl.value);
|
|
87
|
+
if (suffixEl.value) ro.observe(suffixEl.value);
|
|
88
|
+
}
|
|
89
|
+
function scheduleMeasure() {
|
|
90
|
+
if (scheduled) return;
|
|
91
|
+
scheduled = true;
|
|
92
|
+
nextTick(() => {
|
|
93
|
+
scheduled = false;
|
|
94
|
+
measure();
|
|
95
|
+
refreshObserver();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
onMounted(() => scheduleMeasure());
|
|
99
|
+
onUpdated(() => scheduleMeasure());
|
|
100
|
+
onBeforeUnmount(() => ro?.disconnect());
|
|
101
|
+
function addLen(a, b) {
|
|
102
|
+
if (a === "0px") return b;
|
|
103
|
+
if (b === "0px") return a;
|
|
104
|
+
const apx = a.endsWith("px") ? Number(a.slice(0, -2)) : null;
|
|
105
|
+
const bpx = b.endsWith("px") ? Number(b.slice(0, -2)) : null;
|
|
106
|
+
if (apx !== null && Number.isFinite(apx) && bpx !== null && Number.isFinite(bpx)) return `${apx + bpx}px`;
|
|
107
|
+
return `calc(${a} + ${b})`;
|
|
108
|
+
}
|
|
109
|
+
const basePaddingXLen = computed(() => {
|
|
110
|
+
return {
|
|
111
|
+
xs: "10px",
|
|
112
|
+
sm: "12px",
|
|
113
|
+
md: "12px",
|
|
114
|
+
lg: "16px"
|
|
115
|
+
}[props.size];
|
|
116
|
+
});
|
|
117
|
+
const inputStyle = computed(() => {
|
|
118
|
+
const leftReserved = hasPrefix.value ? measuredPrefixWidth.value ?? prefixMinWidth.value : "0px";
|
|
119
|
+
const rightReserved = hasSuffix.value ? measuredSuffixWidth.value ?? suffixMinWidth.value : "0px";
|
|
120
|
+
return {
|
|
121
|
+
paddingLeft: hasPrefix.value ? addLen(leftReserved, basePaddingXLen.value) : void 0,
|
|
122
|
+
paddingRight: hasSuffix.value ? addLen(rightReserved, basePaddingXLen.value) : void 0
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
const prefixStyle = computed(() => {
|
|
126
|
+
return {
|
|
127
|
+
minWidth: prefixMinWidth.value,
|
|
128
|
+
maxWidth: props.prefixMaxWidth
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
const suffixStyle = computed(() => {
|
|
132
|
+
return {
|
|
133
|
+
minWidth: suffixMinWidth.value,
|
|
134
|
+
maxWidth: props.suffixMaxWidth
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
const sizeClass = computed(() => {
|
|
138
|
+
return {
|
|
139
|
+
xs: "h-7 px-2.5 text-[12px]",
|
|
140
|
+
sm: "h-8 px-3 text-[13px]",
|
|
141
|
+
md: "h-10 px-3 text-[14px]",
|
|
142
|
+
lg: "h-11 px-4 text-[16px]"
|
|
143
|
+
}[props.size];
|
|
144
|
+
});
|
|
145
|
+
const textAlignClass = computed(() => {
|
|
146
|
+
return {
|
|
147
|
+
left: "text-left",
|
|
148
|
+
center: "text-center",
|
|
149
|
+
right: "text-right"
|
|
150
|
+
}[props.textAlign];
|
|
151
|
+
});
|
|
152
|
+
const className = computed(() => {
|
|
153
|
+
const state = props.state;
|
|
154
|
+
const borderByState = {
|
|
155
|
+
default: "border-[var(--brd)]",
|
|
156
|
+
success: "border-[var(--ds-success)] focus-visible:ring-[var(--ds-success)]",
|
|
157
|
+
warning: "border-[var(--ds-warning)] focus-visible:ring-[var(--ds-warning)]",
|
|
158
|
+
danger: "border-[var(--ds-danger)] focus-visible:ring-[var(--ds-danger)]"
|
|
159
|
+
};
|
|
160
|
+
return [
|
|
161
|
+
sizeClass.value,
|
|
162
|
+
textAlignClass.value,
|
|
163
|
+
props.invalid ? borderByState.danger : borderByState[state]
|
|
164
|
+
].join(" ");
|
|
165
|
+
});
|
|
166
|
+
function onInput(e) {
|
|
167
|
+
emit("update:modelValue", e.target.value);
|
|
168
|
+
}
|
|
169
|
+
return (_ctx, _cache) => {
|
|
170
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
171
|
+
_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
|
|
172
|
+
key: 0,
|
|
173
|
+
ref_key: "prefixEl",
|
|
174
|
+
ref: prefixEl,
|
|
175
|
+
"data-testid": "ds-input-prefix",
|
|
176
|
+
class: "absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate",
|
|
177
|
+
style: normalizeStyle(prefixStyle.value),
|
|
178
|
+
"aria-hidden": "true"
|
|
179
|
+
}, [renderSlot(_ctx.$slots, "prefix")], 4)) : createCommentVNode("", true),
|
|
180
|
+
createElementVNode("input", mergeProps({
|
|
181
|
+
id: props.id,
|
|
182
|
+
ref_key: "inputEl",
|
|
183
|
+
ref: inputEl
|
|
184
|
+
}, _ctx.$attrs, {
|
|
185
|
+
name: props.name,
|
|
186
|
+
type: props.type,
|
|
187
|
+
inputmode: props.inputmode,
|
|
188
|
+
autocomplete: props.autocomplete,
|
|
189
|
+
placeholder: props.placeholder,
|
|
190
|
+
disabled: props.disabled,
|
|
191
|
+
value: props.modelValue,
|
|
192
|
+
"aria-invalid": props.invalid ? "true" : void 0,
|
|
193
|
+
class: ["w-full rounded-md border bg-[var(--bg)] text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-50 disabled:cursor-not-allowed", className.value],
|
|
194
|
+
style: inputStyle.value,
|
|
195
|
+
onInput
|
|
196
|
+
}), null, 16, _hoisted_2),
|
|
197
|
+
_ctx.$slots.suffix ? (openBlock(), createElementBlock("div", {
|
|
198
|
+
key: 1,
|
|
199
|
+
ref_key: "suffixEl",
|
|
200
|
+
ref: suffixEl,
|
|
201
|
+
"data-testid": "ds-input-suffix",
|
|
202
|
+
class: "absolute inset-y-0 right-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate",
|
|
203
|
+
style: normalizeStyle(suffixStyle.value),
|
|
204
|
+
"aria-hidden": "true"
|
|
205
|
+
}, [renderSlot(_ctx.$slots, "suffix")], 4)) : createCommentVNode("", true)
|
|
206
|
+
]);
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
//#endregion
|
|
211
|
+
export { GrInput_default as t };
|
|
212
|
+
|
|
213
|
+
//# sourceMappingURL=GrInput-DLLRrH1A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrInput-DLLRrH1A.js","names":["$slots","$attrs"],"sources":["../../../../src/components/GrInput/GrInput.vue","../../../../src/components/GrInput/GrInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {computed, nextTick, onBeforeUnmount, onMounted, onUpdated, ref, useSlots} from 'vue'\nimport type {InputHTMLAttributes} from 'vue'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nexport type GrInputSize = 'xs' | 'sm' | 'md' | 'lg'\nexport type GrInputTextAlign = 'left' | 'center' | 'right'\n\nconst props = withDefaults(\n defineProps<{\n modelValue: string\n type?: 'text' | 'email' | 'password' | 'number' | 'search'\n placeholder?: string\n autocomplete?: string\n inputmode?: InputHTMLAttributes['inputmode']\n disabled?: boolean\n invalid?: boolean\n state?: 'default' | 'success' | 'warning' | 'danger'\n name?: string\n id?: string\n size?: GrInputSize\n\n textAlign?: GrInputTextAlign\n\n prefixMinWidth?: string\n prefixMaxWidth?: string\n suffixMinWidth?: string\n suffixMaxWidth?: string\n }>(),\n {\n type: 'text',\n placeholder: undefined,\n autocomplete: undefined,\n inputmode: undefined,\n disabled: false,\n invalid: false,\n state: 'default',\n name: undefined,\n id: undefined,\n size: 'md',\n\n textAlign: 'left',\n\n prefixMinWidth: undefined,\n prefixMaxWidth: undefined,\n suffixMinWidth: undefined,\n suffixMaxWidth: undefined,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: string): void\n}>()\n\nconst inputEl = ref<HTMLInputElement | null>(null)\n\nfunction focus(): void {\n inputEl.value?.focus()\n}\n\ndefineExpose({\n focus,\n})\n\nconst slots = useSlots()\n\nconst hasPrefix = computed(() => Boolean(slots.prefix))\nconst hasSuffix = computed(() => Boolean(slots.suffix))\n\nconst defaultAddonMinWidth = computed(() => {\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: '2rem', // w-8\n sm: '2.25rem', // w-9\n md: '2.5rem', // w-10\n lg: '3rem', // w-12\n }\n\n return map[props.size]\n})\n\nconst prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value)\nconst suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value)\n\nconst prefixEl = ref<HTMLElement | null>(null)\nconst suffixEl = ref<HTMLElement | null>(null)\n\nconst measuredPrefixWidth = ref<string | undefined>(undefined)\nconst measuredSuffixWidth = ref<string | undefined>(undefined)\n\nlet ro: ResizeObserver | null = null\nlet scheduled = false\n\nfunction readWidthPx(el: HTMLElement | null): string | undefined {\n if (!el) return undefined\n\n const width = Math.ceil(el.getBoundingClientRect().width || 0)\n // jsdom often reports 0; don't overwrite fallback minWidth in that case.\n if (width <= 0) return undefined\n\n return `${width}px`\n}\n\nfunction measure(): void {\n measuredPrefixWidth.value = hasPrefix.value ? readWidthPx(prefixEl.value) : undefined\n measuredSuffixWidth.value = hasSuffix.value ? readWidthPx(suffixEl.value) : undefined\n}\n\nfunction refreshObserver(): void {\n if (typeof ResizeObserver === 'undefined') return\n if (!ro) ro = new ResizeObserver(() => measure())\n\n ro.disconnect()\n if (prefixEl.value) ro.observe(prefixEl.value)\n if (suffixEl.value) ro.observe(suffixEl.value)\n}\n\nfunction scheduleMeasure(): void {\n if (scheduled) return\n scheduled = true\n\n void nextTick(() => {\n scheduled = false\n measure()\n refreshObserver()\n })\n}\n\nonMounted(() => scheduleMeasure())\nonUpdated(() => scheduleMeasure())\nonBeforeUnmount(() => ro?.disconnect())\n\nfunction addLen(a: string, b: string): string {\n if (a === '0px') return b\n if (b === '0px') return a\n\n const apx = a.endsWith('px') ? Number(a.slice(0, -2)) : null\n const bpx = b.endsWith('px') ? Number(b.slice(0, -2)) : null\n\n if (apx !== null && Number.isFinite(apx) && bpx !== null && Number.isFinite(bpx)) {\n return `${apx + bpx}px`\n }\n\n return `calc(${a} + ${b})`\n}\n\nconst basePaddingXLen = computed(() => {\n // Must mirror `sizeClass` horizontal padding (px-*) because inline paddings override class paddings.\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: '10px', // px-2.5\n sm: '12px', // px-3\n md: '12px', // px-3\n lg: '16px', // px-4\n }\n\n return map[props.size]\n})\n\nconst inputStyle = computed(() => {\n const leftReserved = hasPrefix.value ? measuredPrefixWidth.value ?? prefixMinWidth.value : '0px'\n const rightReserved = hasSuffix.value ? measuredSuffixWidth.value ?? suffixMinWidth.value : '0px'\n\n // Keep the same visual text padding as without addons (px-*), but add it on top of reserved space.\n const left = hasPrefix.value ? addLen(leftReserved, basePaddingXLen.value) : undefined\n const right = hasSuffix.value ? addLen(rightReserved, basePaddingXLen.value) : undefined\n\n return {\n paddingLeft: left,\n paddingRight: right,\n } as Record<string, string | undefined>\n})\n\nconst prefixStyle = computed(() => {\n return {\n minWidth: prefixMinWidth.value,\n maxWidth: props.prefixMaxWidth,\n } as Record<string, string | undefined>\n})\n\nconst suffixStyle = computed(() => {\n return {\n minWidth: suffixMinWidth.value,\n maxWidth: props.suffixMaxWidth,\n } as Record<string, string | undefined>\n})\n\nconst sizeClass = computed(() => {\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: 'h-7 px-2.5 text-[12px]',\n sm: 'h-8 px-3 text-[13px]',\n md: 'h-10 px-3 text-[14px]',\n lg: 'h-11 px-4 text-[16px]',\n }\n\n return map[props.size]\n})\n\nconst textAlignClass = computed(() => {\n const map: Record<NonNullable<typeof props.textAlign>, string> = {\n left: 'text-left',\n center: 'text-center',\n right: 'text-right',\n }\n\n return map[props.textAlign]\n})\n\nconst className = computed(() => {\n const state = props.state\n\n const borderByState: Record<typeof state, string> = {\n default: 'border-[var(--brd)]',\n success: 'border-[var(--ds-success)] focus-visible:ring-[var(--ds-success)]',\n warning: 'border-[var(--ds-warning)] focus-visible:ring-[var(--ds-warning)]',\n danger: 'border-[var(--ds-danger)] focus-visible:ring-[var(--ds-danger)]',\n }\n\n return [\n sizeClass.value,\n textAlignClass.value,\n props.invalid ? borderByState.danger : borderByState[state],\n ].join(' ')\n})\n\nfunction onInput(e: Event): void {\n emit('update:modelValue', (e.target as HTMLInputElement).value)\n}\n</script>\n\n<template>\n <div class=\"relative w-full\">\n <div\n v-if=\"$slots.prefix\"\n ref=\"prefixEl\"\n data-testid=\"ds-input-prefix\"\n class=\"absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"prefixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"prefix\" />\n </div>\n\n <input\n :id=\"props.id\"\n ref=\"inputEl\"\n v-bind=\"$attrs\"\n :name=\"props.name\"\n :type=\"props.type\"\n :inputmode=\"props.inputmode\"\n :autocomplete=\"props.autocomplete\"\n :placeholder=\"props.placeholder\"\n :disabled=\"props.disabled\"\n :value=\"props.modelValue\"\n :aria-invalid=\"props.invalid ? 'true' : undefined\"\n class=\"w-full rounded-md border bg-[var(--bg)] text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-50 disabled:cursor-not-allowed\"\n :class=\"className\"\n :style=\"inputStyle\"\n @input=\"onInput\"\n >\n\n <div\n v-if=\"$slots.suffix\"\n ref=\"suffixEl\"\n data-testid=\"ds-input-suffix\"\n class=\"absolute inset-y-0 right-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"suffixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"suffix\" />\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport {computed, nextTick, onBeforeUnmount, onMounted, onUpdated, ref, useSlots} from 'vue'\nimport type {InputHTMLAttributes} from 'vue'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nexport type GrInputSize = 'xs' | 'sm' | 'md' | 'lg'\nexport type GrInputTextAlign = 'left' | 'center' | 'right'\n\nconst props = withDefaults(\n defineProps<{\n modelValue: string\n type?: 'text' | 'email' | 'password' | 'number' | 'search'\n placeholder?: string\n autocomplete?: string\n inputmode?: InputHTMLAttributes['inputmode']\n disabled?: boolean\n invalid?: boolean\n state?: 'default' | 'success' | 'warning' | 'danger'\n name?: string\n id?: string\n size?: GrInputSize\n\n textAlign?: GrInputTextAlign\n\n prefixMinWidth?: string\n prefixMaxWidth?: string\n suffixMinWidth?: string\n suffixMaxWidth?: string\n }>(),\n {\n type: 'text',\n placeholder: undefined,\n autocomplete: undefined,\n inputmode: undefined,\n disabled: false,\n invalid: false,\n state: 'default',\n name: undefined,\n id: undefined,\n size: 'md',\n\n textAlign: 'left',\n\n prefixMinWidth: undefined,\n prefixMaxWidth: undefined,\n suffixMinWidth: undefined,\n suffixMaxWidth: undefined,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: string): void\n}>()\n\nconst inputEl = ref<HTMLInputElement | null>(null)\n\nfunction focus(): void {\n inputEl.value?.focus()\n}\n\ndefineExpose({\n focus,\n})\n\nconst slots = useSlots()\n\nconst hasPrefix = computed(() => Boolean(slots.prefix))\nconst hasSuffix = computed(() => Boolean(slots.suffix))\n\nconst defaultAddonMinWidth = computed(() => {\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: '2rem', // w-8\n sm: '2.25rem', // w-9\n md: '2.5rem', // w-10\n lg: '3rem', // w-12\n }\n\n return map[props.size]\n})\n\nconst prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value)\nconst suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value)\n\nconst prefixEl = ref<HTMLElement | null>(null)\nconst suffixEl = ref<HTMLElement | null>(null)\n\nconst measuredPrefixWidth = ref<string | undefined>(undefined)\nconst measuredSuffixWidth = ref<string | undefined>(undefined)\n\nlet ro: ResizeObserver | null = null\nlet scheduled = false\n\nfunction readWidthPx(el: HTMLElement | null): string | undefined {\n if (!el) return undefined\n\n const width = Math.ceil(el.getBoundingClientRect().width || 0)\n // jsdom often reports 0; don't overwrite fallback minWidth in that case.\n if (width <= 0) return undefined\n\n return `${width}px`\n}\n\nfunction measure(): void {\n measuredPrefixWidth.value = hasPrefix.value ? readWidthPx(prefixEl.value) : undefined\n measuredSuffixWidth.value = hasSuffix.value ? readWidthPx(suffixEl.value) : undefined\n}\n\nfunction refreshObserver(): void {\n if (typeof ResizeObserver === 'undefined') return\n if (!ro) ro = new ResizeObserver(() => measure())\n\n ro.disconnect()\n if (prefixEl.value) ro.observe(prefixEl.value)\n if (suffixEl.value) ro.observe(suffixEl.value)\n}\n\nfunction scheduleMeasure(): void {\n if (scheduled) return\n scheduled = true\n\n void nextTick(() => {\n scheduled = false\n measure()\n refreshObserver()\n })\n}\n\nonMounted(() => scheduleMeasure())\nonUpdated(() => scheduleMeasure())\nonBeforeUnmount(() => ro?.disconnect())\n\nfunction addLen(a: string, b: string): string {\n if (a === '0px') return b\n if (b === '0px') return a\n\n const apx = a.endsWith('px') ? Number(a.slice(0, -2)) : null\n const bpx = b.endsWith('px') ? Number(b.slice(0, -2)) : null\n\n if (apx !== null && Number.isFinite(apx) && bpx !== null && Number.isFinite(bpx)) {\n return `${apx + bpx}px`\n }\n\n return `calc(${a} + ${b})`\n}\n\nconst basePaddingXLen = computed(() => {\n // Must mirror `sizeClass` horizontal padding (px-*) because inline paddings override class paddings.\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: '10px', // px-2.5\n sm: '12px', // px-3\n md: '12px', // px-3\n lg: '16px', // px-4\n }\n\n return map[props.size]\n})\n\nconst inputStyle = computed(() => {\n const leftReserved = hasPrefix.value ? measuredPrefixWidth.value ?? prefixMinWidth.value : '0px'\n const rightReserved = hasSuffix.value ? measuredSuffixWidth.value ?? suffixMinWidth.value : '0px'\n\n // Keep the same visual text padding as without addons (px-*), but add it on top of reserved space.\n const left = hasPrefix.value ? addLen(leftReserved, basePaddingXLen.value) : undefined\n const right = hasSuffix.value ? addLen(rightReserved, basePaddingXLen.value) : undefined\n\n return {\n paddingLeft: left,\n paddingRight: right,\n } as Record<string, string | undefined>\n})\n\nconst prefixStyle = computed(() => {\n return {\n minWidth: prefixMinWidth.value,\n maxWidth: props.prefixMaxWidth,\n } as Record<string, string | undefined>\n})\n\nconst suffixStyle = computed(() => {\n return {\n minWidth: suffixMinWidth.value,\n maxWidth: props.suffixMaxWidth,\n } as Record<string, string | undefined>\n})\n\nconst sizeClass = computed(() => {\n const map: Record<NonNullable<typeof props.size>, string> = {\n xs: 'h-7 px-2.5 text-[12px]',\n sm: 'h-8 px-3 text-[13px]',\n md: 'h-10 px-3 text-[14px]',\n lg: 'h-11 px-4 text-[16px]',\n }\n\n return map[props.size]\n})\n\nconst textAlignClass = computed(() => {\n const map: Record<NonNullable<typeof props.textAlign>, string> = {\n left: 'text-left',\n center: 'text-center',\n right: 'text-right',\n }\n\n return map[props.textAlign]\n})\n\nconst className = computed(() => {\n const state = props.state\n\n const borderByState: Record<typeof state, string> = {\n default: 'border-[var(--brd)]',\n success: 'border-[var(--ds-success)] focus-visible:ring-[var(--ds-success)]',\n warning: 'border-[var(--ds-warning)] focus-visible:ring-[var(--ds-warning)]',\n danger: 'border-[var(--ds-danger)] focus-visible:ring-[var(--ds-danger)]',\n }\n\n return [\n sizeClass.value,\n textAlignClass.value,\n props.invalid ? borderByState.danger : borderByState[state],\n ].join(' ')\n})\n\nfunction onInput(e: Event): void {\n emit('update:modelValue', (e.target as HTMLInputElement).value)\n}\n</script>\n\n<template>\n <div class=\"relative w-full\">\n <div\n v-if=\"$slots.prefix\"\n ref=\"prefixEl\"\n data-testid=\"ds-input-prefix\"\n class=\"absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"prefixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"prefix\" />\n </div>\n\n <input\n :id=\"props.id\"\n ref=\"inputEl\"\n v-bind=\"$attrs\"\n :name=\"props.name\"\n :type=\"props.type\"\n :inputmode=\"props.inputmode\"\n :autocomplete=\"props.autocomplete\"\n :placeholder=\"props.placeholder\"\n :disabled=\"props.disabled\"\n :value=\"props.modelValue\"\n :aria-invalid=\"props.invalid ? 'true' : undefined\"\n class=\"w-full rounded-md border bg-[var(--bg)] text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-50 disabled:cursor-not-allowed\"\n :class=\"className\"\n :style=\"inputStyle\"\n @input=\"onInput\"\n >\n\n <div\n v-if=\"$slots.suffix\"\n ref=\"suffixEl\"\n data-testid=\"ds-input-suffix\"\n class=\"absolute inset-y-0 right-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"suffixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"suffix\" />\n </div>\n </div>\n</template>\n"],"mappings":"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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { n as
|
|
3
|
-
export {
|
|
1
|
+
import { t as GrInput_default } from "./chunks/GrInput-DLLRrH1A.js";
|
|
2
|
+
import { n as grInputSafelist, t as grInputConfig } from "../../chunks/config-cn6knwud.js";
|
|
3
|
+
export { GrInput_default as GrInput, GrInput_default as default, grInputConfig, grInputSafelist };
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { t as x_default } from "../../../chunks/x-Pa6C2hwi.js";
|
|
2
|
+
import { t as GrBadge_default } from "../../GrBadge/chunks/GrBadge-wuIb4_2K.js";
|
|
3
|
+
import { t as GrIcon_default } from "../../GrIcon/chunks/GrIcon-BV7RBU_0.js";
|
|
4
|
+
import { i as grInputTagWrapperClass, r as grInputTagInputClass } from "../../../chunks/config-CJbjLC5X.js";
|
|
5
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
6
|
+
//#region src/components/GrInputTag/GrInputTag.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var _hoisted_1 = { class: "truncate max-w-[18rem]" };
|
|
8
|
+
var _hoisted_2 = [
|
|
9
|
+
"aria-label",
|
|
10
|
+
"data-index",
|
|
11
|
+
"onClick"
|
|
12
|
+
];
|
|
13
|
+
var _hoisted_3 = [
|
|
14
|
+
"value",
|
|
15
|
+
"disabled",
|
|
16
|
+
"readonly",
|
|
17
|
+
"placeholder",
|
|
18
|
+
"aria-invalid"
|
|
19
|
+
];
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/GrInputTag/GrInputTag.vue
|
|
22
|
+
var GrInputTag_default = /* @__PURE__ */ defineComponent({
|
|
23
|
+
__name: "GrInputTag",
|
|
24
|
+
props: {
|
|
25
|
+
modelValue: {},
|
|
26
|
+
placeholder: { default: void 0 },
|
|
27
|
+
disabled: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
readonly: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
invalid: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
state: { default: "default" },
|
|
40
|
+
size: { default: "md" },
|
|
41
|
+
separators: { default: () => [","] },
|
|
42
|
+
allowDuplicates: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
trim: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: true
|
|
49
|
+
},
|
|
50
|
+
max: { default: void 0 },
|
|
51
|
+
addOnBlur: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
clearInputOnAdd: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true
|
|
58
|
+
},
|
|
59
|
+
tagTone: { default: "neutral" },
|
|
60
|
+
tagDark: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false
|
|
63
|
+
},
|
|
64
|
+
tagSize: { default: "md" },
|
|
65
|
+
tagRadius: { default: "round" },
|
|
66
|
+
tagClosable: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
70
|
+
removeTagLabel: { default: "Remove tag" }
|
|
71
|
+
},
|
|
72
|
+
emits: [
|
|
73
|
+
"update:modelValue",
|
|
74
|
+
"add",
|
|
75
|
+
"remove"
|
|
76
|
+
],
|
|
77
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
78
|
+
const REGEX_SPECIAL_CHAR_RE = /[.*+?^${}()|[\]\\]/g;
|
|
79
|
+
/**
|
|
80
|
+
* Props for {@link GrInputTag}.
|
|
81
|
+
* Tag-input primitive: renders a set of badges with an inline `<input>` for entering new tags.
|
|
82
|
+
* Splits input by configurable `separators`, supports paste, Enter and Backspace editing.
|
|
83
|
+
*/
|
|
84
|
+
const props = __props;
|
|
85
|
+
const emit = __emit;
|
|
86
|
+
const inputValue = ref("");
|
|
87
|
+
const inputEl = ref(null);
|
|
88
|
+
function focus() {
|
|
89
|
+
inputEl.value?.focus();
|
|
90
|
+
}
|
|
91
|
+
__expose({ focus });
|
|
92
|
+
const isMaxed = computed(() => props.max !== void 0 && props.modelValue.length >= props.max);
|
|
93
|
+
const canEdit = computed(() => !props.disabled && !props.readonly);
|
|
94
|
+
const showRemove = computed(() => props.tagClosable && canEdit.value);
|
|
95
|
+
function escapeRegexChar(ch) {
|
|
96
|
+
return ch.replace(REGEX_SPECIAL_CHAR_RE, "\\$&");
|
|
97
|
+
}
|
|
98
|
+
const splitRegex = computed(() => {
|
|
99
|
+
const seps = (props.separators ?? []).filter(Boolean).map((s) => s[0]);
|
|
100
|
+
const body = [...new Set([
|
|
101
|
+
...seps,
|
|
102
|
+
"\n",
|
|
103
|
+
"\r",
|
|
104
|
+
" "
|
|
105
|
+
])].map(escapeRegexChar).join("");
|
|
106
|
+
return new RegExp(`[${body}]+`, "g");
|
|
107
|
+
});
|
|
108
|
+
function normalizeTag(raw) {
|
|
109
|
+
return props.trim ? raw.trim() : raw;
|
|
110
|
+
}
|
|
111
|
+
function splitToTags(raw) {
|
|
112
|
+
return raw.split(splitRegex.value).map((v) => normalizeTag(v)).filter(Boolean);
|
|
113
|
+
}
|
|
114
|
+
function addMany(rawTags) {
|
|
115
|
+
if (!canEdit.value || isMaxed.value) return false;
|
|
116
|
+
const next = props.modelValue.slice();
|
|
117
|
+
let changed = false;
|
|
118
|
+
for (const raw of rawTags) {
|
|
119
|
+
const tag = normalizeTag(raw);
|
|
120
|
+
if (!tag) continue;
|
|
121
|
+
if (!props.allowDuplicates && next.includes(tag)) continue;
|
|
122
|
+
if (props.max !== void 0 && next.length >= props.max) break;
|
|
123
|
+
next.push(tag);
|
|
124
|
+
changed = true;
|
|
125
|
+
emit("add", tag);
|
|
126
|
+
}
|
|
127
|
+
if (!changed) return false;
|
|
128
|
+
emit("update:modelValue", next);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
function commitInput() {
|
|
132
|
+
if (!canEdit.value || isMaxed.value || !inputValue.value) return;
|
|
133
|
+
const tags = splitToTags(inputValue.value);
|
|
134
|
+
if (!tags.length) return;
|
|
135
|
+
if (addMany(tags) && props.clearInputOnAdd) inputValue.value = "";
|
|
136
|
+
}
|
|
137
|
+
function removeAt(index) {
|
|
138
|
+
if (!canEdit.value) return;
|
|
139
|
+
const next = props.modelValue.slice();
|
|
140
|
+
const removed = next[index];
|
|
141
|
+
if (removed === void 0) return;
|
|
142
|
+
next.splice(index, 1);
|
|
143
|
+
emit("update:modelValue", next);
|
|
144
|
+
emit("remove", removed, index);
|
|
145
|
+
}
|
|
146
|
+
function onInput(e) {
|
|
147
|
+
inputValue.value = e.target.value;
|
|
148
|
+
}
|
|
149
|
+
function onKeydown(e) {
|
|
150
|
+
if (!canEdit.value) return;
|
|
151
|
+
if (e.key === "Enter") {
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
commitInput();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if ((props.separators ?? []).includes(e.key)) {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
commitInput();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (e.key === "Backspace" && inputValue.value.length === 0 && props.modelValue.length > 0) {
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
removeAt(props.modelValue.length - 1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function onBlur() {
|
|
167
|
+
if (props.addOnBlur) commitInput();
|
|
168
|
+
}
|
|
169
|
+
function onPaste(e) {
|
|
170
|
+
if (!canEdit.value || isMaxed.value) return;
|
|
171
|
+
const pasted = e.clipboardData?.getData("text");
|
|
172
|
+
if (!pasted) return;
|
|
173
|
+
const tags = splitToTags(pasted);
|
|
174
|
+
if (tags.length <= 1) return;
|
|
175
|
+
e.preventDefault();
|
|
176
|
+
addMany(tags);
|
|
177
|
+
}
|
|
178
|
+
const wrapperClassName = computed(() => {
|
|
179
|
+
return grInputTagWrapperClass({
|
|
180
|
+
size: props.size,
|
|
181
|
+
state: props.state,
|
|
182
|
+
invalid: props.invalid,
|
|
183
|
+
disabled: props.disabled
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
const inputClassName = computed(() => {
|
|
187
|
+
return grInputTagInputClass(props.size);
|
|
188
|
+
});
|
|
189
|
+
const placeholderText = computed(() => props.modelValue.length > 0 ? void 0 : props.placeholder);
|
|
190
|
+
return (_ctx, _cache) => {
|
|
191
|
+
return openBlock(), createElementBlock("div", {
|
|
192
|
+
"data-ds-input-tag": "",
|
|
193
|
+
"data-testid": "ds-input-tag",
|
|
194
|
+
class: normalizeClass(["w-full flex flex-wrap items-center rounded-md border bg-[var(--bg)] text-[var(--fg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]", wrapperClassName.value]),
|
|
195
|
+
onClick: focus
|
|
196
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.modelValue, (tag, i) => {
|
|
197
|
+
return openBlock(), createBlock(GrBadge_default, {
|
|
198
|
+
key: `${tag}-${i}`,
|
|
199
|
+
tone: __props.tagTone,
|
|
200
|
+
dark: __props.tagDark,
|
|
201
|
+
size: __props.tagSize,
|
|
202
|
+
radius: __props.tagRadius,
|
|
203
|
+
class: "gap-1",
|
|
204
|
+
"data-ds-input-tag-item": "",
|
|
205
|
+
"data-testid": "ds-input-tag-item",
|
|
206
|
+
"data-index": i
|
|
207
|
+
}, {
|
|
208
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "tag", {
|
|
209
|
+
tag,
|
|
210
|
+
index: i,
|
|
211
|
+
remove: () => removeAt(i)
|
|
212
|
+
}, () => [createElementVNode("span", _hoisted_1, toDisplayString(tag), 1)]), showRemove.value ? (openBlock(), createElementBlock("button", {
|
|
213
|
+
key: 0,
|
|
214
|
+
type: "button",
|
|
215
|
+
class: "-mr-0.5 inline-flex items-center justify-center rounded-[6px] p-0.5 opacity-70 hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",
|
|
216
|
+
"aria-label": __props.removeTagLabel,
|
|
217
|
+
"data-ds-input-tag-remove": "",
|
|
218
|
+
"data-testid": "ds-input-tag-remove",
|
|
219
|
+
"data-index": i,
|
|
220
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent", "stop"])),
|
|
221
|
+
onClick: withModifiers(($event) => removeAt(i), ["stop"])
|
|
222
|
+
}, [createVNode(GrIcon_default, {
|
|
223
|
+
size: "sm",
|
|
224
|
+
"aria-hidden": "true"
|
|
225
|
+
}, {
|
|
226
|
+
default: withCtx(() => [createVNode(unref(x_default))]),
|
|
227
|
+
_: 1
|
|
228
|
+
})], 40, _hoisted_2)) : createCommentVNode("", true)]),
|
|
229
|
+
_: 2
|
|
230
|
+
}, 1032, [
|
|
231
|
+
"tone",
|
|
232
|
+
"dark",
|
|
233
|
+
"size",
|
|
234
|
+
"radius",
|
|
235
|
+
"data-index"
|
|
236
|
+
]);
|
|
237
|
+
}), 128)), createElementVNode("input", {
|
|
238
|
+
ref_key: "inputEl",
|
|
239
|
+
ref: inputEl,
|
|
240
|
+
"data-ds-input-tag-input": "",
|
|
241
|
+
"data-testid": "ds-input-tag-input",
|
|
242
|
+
value: inputValue.value,
|
|
243
|
+
disabled: __props.disabled || isMaxed.value,
|
|
244
|
+
readonly: __props.readonly,
|
|
245
|
+
placeholder: placeholderText.value,
|
|
246
|
+
"aria-invalid": __props.invalid ? "true" : void 0,
|
|
247
|
+
class: normalizeClass(["flex-1 min-w-[120px] bg-transparent border-none outline-none placeholder:text-[var(--muted-fg)]", inputClassName.value]),
|
|
248
|
+
onInput,
|
|
249
|
+
onKeydown,
|
|
250
|
+
onBlur,
|
|
251
|
+
onPaste
|
|
252
|
+
}, null, 42, _hoisted_3)], 2);
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
//#endregion
|
|
257
|
+
export { GrInputTag_default as t };
|
|
258
|
+
|
|
259
|
+
//# sourceMappingURL=GrInputTag-CzrrBxgU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrInputTag-CzrrBxgU.js","names":[],"sources":["../../../../src/components/GrInputTag/GrInputTag.vue","../../../../src/components/GrInputTag/GrInputTag.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue'\n\nimport GrBadge from '../GrBadge/GrBadge.vue'\nimport type { GrBadgeRadius, GrBadgeSize, GrBadgeTone } from '../GrBadge'\nimport GrIcon from '../GrIcon/GrIcon.vue'\nimport IconClose from '~icons/lucide/x'\n\nimport {\n grInputTagInputClass,\n grInputTagWrapperClass,\n type GrInputTagSize,\n type GrInputTagState,\n} from './grInputTagStyles'\n\nexport type { GrInputTagSize, GrInputTagState } from './grInputTagStyles'\n\nconst REGEX_SPECIAL_CHAR_RE = /[.*+?^${}()|[\\]\\\\]/g\n\n/**\n * Props for {@link GrInputTag}.\n * Tag-input primitive: renders a set of badges with an inline `<input>` for entering new tags.\n * Splits input by configurable `separators`, supports paste, Enter and Backspace editing.\n */\nexport interface GrInputTagProps {\n modelValue: string[]\n placeholder?: string\n disabled?: boolean\n readonly?: boolean\n invalid?: boolean\n state?: GrInputTagState\n size?: GrInputTagSize\n separators?: string[]\n allowDuplicates?: boolean\n trim?: boolean\n max?: number\n addOnBlur?: boolean\n clearInputOnAdd?: boolean\n tagTone?: GrBadgeTone\n tagDark?: boolean\n tagSize?: GrBadgeSize\n tagRadius?: GrBadgeRadius\n tagClosable?: boolean\n /** i18n-friendly aria-label for the per-tag remove button. */\n removeTagLabel?: string\n}\n\nconst props = withDefaults(\n defineProps<GrInputTagProps>(),\n {\n placeholder: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n state: 'default',\n size: 'md',\n separators: () => [','],\n allowDuplicates: false,\n trim: true,\n max: undefined,\n addOnBlur: false,\n clearInputOnAdd: true,\n tagTone: 'neutral',\n tagDark: false,\n tagSize: 'md',\n tagRadius: 'round',\n tagClosable: true,\n removeTagLabel: 'Remove tag',\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: string[]): void\n (e: 'add', value: string): void\n (e: 'remove', value: string, index: number): void\n}>()\n\nconst inputValue = ref('')\nconst inputEl = ref<HTMLInputElement | null>(null)\n\nfunction focus(): void {\n inputEl.value?.focus()\n}\n\ndefineExpose({ focus })\n\nconst isMaxed = computed(() => props.max !== undefined && props.modelValue.length >= props.max)\nconst canEdit = computed(() => !props.disabled && !props.readonly)\nconst showRemove = computed(() => props.tagClosable && canEdit.value)\n\nfunction escapeRegexChar(ch: string): string {\n return ch.replace(REGEX_SPECIAL_CHAR_RE, '\\\\$&')\n}\n\nconst splitRegex = computed(() => {\n const seps = (props.separators ?? []).filter(Boolean).map(s => s[0]!)\n const uniq = [...new Set([...seps, '\\n', '\\r', '\\t'])]\n const body = uniq.map(escapeRegexChar).join('')\n return new RegExp(`[${body}]+`, 'g')\n})\n\nfunction normalizeTag(raw: string): string {\n return props.trim ? raw.trim() : raw\n}\n\nfunction splitToTags(raw: string): string[] {\n return raw\n .split(splitRegex.value)\n .map(v => normalizeTag(v))\n .filter(Boolean)\n}\n\nfunction addMany(rawTags: string[]): boolean {\n if (!canEdit.value || isMaxed.value)\n return false\n\n const next = props.modelValue.slice()\n let changed = false\n\n for (const raw of rawTags) {\n const tag = normalizeTag(raw)\n if (!tag)\n continue\n\n if (!props.allowDuplicates && next.includes(tag))\n continue\n\n if (props.max !== undefined && next.length >= props.max)\n break\n\n next.push(tag)\n changed = true\n emit('add', tag)\n }\n\n if (!changed)\n return false\n\n emit('update:modelValue', next)\n return true\n}\n\nfunction commitInput(): void {\n if (!canEdit.value || isMaxed.value || !inputValue.value)\n return\n\n const tags = splitToTags(inputValue.value)\n if (!tags.length)\n return\n\n const changed = addMany(tags)\n if (changed && props.clearInputOnAdd)\n inputValue.value = ''\n}\n\nfunction removeAt(index: number): void {\n if (!canEdit.value)\n return\n\n const next = props.modelValue.slice()\n const removed = next[index]\n if (removed === undefined)\n return\n\n next.splice(index, 1)\n emit('update:modelValue', next)\n emit('remove', removed, index)\n}\n\nfunction onInput(e: Event): void {\n inputValue.value = (e.target as HTMLInputElement).value\n}\n\nfunction onKeydown(e: KeyboardEvent): void {\n if (!canEdit.value)\n return\n\n if (e.key === 'Enter') {\n e.preventDefault()\n commitInput()\n return\n }\n\n if ((props.separators ?? []).includes(e.key)) {\n e.preventDefault()\n commitInput()\n return\n }\n\n if (e.key === 'Backspace' && inputValue.value.length === 0 && props.modelValue.length > 0) {\n e.preventDefault()\n removeAt(props.modelValue.length - 1)\n }\n}\n\nfunction onBlur(): void {\n if (props.addOnBlur)\n commitInput()\n}\n\nfunction onPaste(e: ClipboardEvent): void {\n if (!canEdit.value || isMaxed.value)\n return\n\n const pasted = e.clipboardData?.getData('text')\n if (!pasted)\n return\n\n const tags = splitToTags(pasted)\n if (tags.length <= 1)\n return\n\n e.preventDefault()\n addMany(tags)\n}\n\nconst wrapperClassName = computed(() => {\n return grInputTagWrapperClass({\n size: props.size,\n state: props.state,\n invalid: props.invalid,\n disabled: props.disabled,\n })\n})\n\nconst inputClassName = computed(() => {\n return grInputTagInputClass(props.size)\n})\n\nconst placeholderText = computed(() => props.modelValue.length > 0 ? undefined : props.placeholder)\n</script>\n\n<template>\n <div\n data-ds-input-tag\n data-testid=\"ds-input-tag\"\n class=\"w-full flex flex-wrap items-center rounded-md border bg-[var(--bg)] text-[var(--fg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]\"\n :class=\"wrapperClassName\"\n @click=\"focus\"\n >\n <GrBadge\n v-for=\"(tag, i) in modelValue\"\n :key=\"`${tag}-${i}`\"\n :tone=\"tagTone\"\n :dark=\"tagDark\"\n :size=\"tagSize\"\n :radius=\"tagRadius\"\n class=\"gap-1\"\n data-ds-input-tag-item\n data-testid=\"ds-input-tag-item\"\n :data-index=\"i\"\n >\n <slot name=\"tag\" :tag=\"tag\" :index=\"i\" :remove=\"() => removeAt(i)\">\n <span class=\"truncate max-w-[18rem]\">{{ tag }}</span>\n </slot>\n\n <button\n v-if=\"showRemove\"\n type=\"button\"\n class=\"-mr-0.5 inline-flex items-center justify-center rounded-[6px] p-0.5 opacity-70 hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n :aria-label=\"removeTagLabel\"\n data-ds-input-tag-remove\n data-testid=\"ds-input-tag-remove\"\n :data-index=\"i\"\n @mousedown.prevent.stop\n @click.stop=\"removeAt(i)\"\n >\n <GrIcon size=\"sm\" aria-hidden=\"true\">\n <IconClose />\n </GrIcon>\n </button>\n </GrBadge>\n\n <input\n ref=\"inputEl\"\n data-ds-input-tag-input\n data-testid=\"ds-input-tag-input\"\n :value=\"inputValue\"\n :disabled=\"disabled || isMaxed\"\n :readonly=\"readonly\"\n :placeholder=\"placeholderText\"\n :aria-invalid=\"invalid ? 'true' : undefined\"\n class=\"flex-1 min-w-[120px] bg-transparent border-none outline-none placeholder:text-[var(--muted-fg)]\"\n :class=\"inputClassName\"\n @input=\"onInput\"\n @keydown=\"onKeydown\"\n @blur=\"onBlur\"\n @paste=\"onPaste\"\n >\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref } from 'vue'\n\nimport GrBadge from '../GrBadge/GrBadge.vue'\nimport type { GrBadgeRadius, GrBadgeSize, GrBadgeTone } from '../GrBadge'\nimport GrIcon from '../GrIcon/GrIcon.vue'\nimport IconClose from '~icons/lucide/x'\n\nimport {\n grInputTagInputClass,\n grInputTagWrapperClass,\n type GrInputTagSize,\n type GrInputTagState,\n} from './grInputTagStyles'\n\nexport type { GrInputTagSize, GrInputTagState } from './grInputTagStyles'\n\nconst REGEX_SPECIAL_CHAR_RE = /[.*+?^${}()|[\\]\\\\]/g\n\n/**\n * Props for {@link GrInputTag}.\n * Tag-input primitive: renders a set of badges with an inline `<input>` for entering new tags.\n * Splits input by configurable `separators`, supports paste, Enter and Backspace editing.\n */\nexport interface GrInputTagProps {\n modelValue: string[]\n placeholder?: string\n disabled?: boolean\n readonly?: boolean\n invalid?: boolean\n state?: GrInputTagState\n size?: GrInputTagSize\n separators?: string[]\n allowDuplicates?: boolean\n trim?: boolean\n max?: number\n addOnBlur?: boolean\n clearInputOnAdd?: boolean\n tagTone?: GrBadgeTone\n tagDark?: boolean\n tagSize?: GrBadgeSize\n tagRadius?: GrBadgeRadius\n tagClosable?: boolean\n /** i18n-friendly aria-label for the per-tag remove button. */\n removeTagLabel?: string\n}\n\nconst props = withDefaults(\n defineProps<GrInputTagProps>(),\n {\n placeholder: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n state: 'default',\n size: 'md',\n separators: () => [','],\n allowDuplicates: false,\n trim: true,\n max: undefined,\n addOnBlur: false,\n clearInputOnAdd: true,\n tagTone: 'neutral',\n tagDark: false,\n tagSize: 'md',\n tagRadius: 'round',\n tagClosable: true,\n removeTagLabel: 'Remove tag',\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: string[]): void\n (e: 'add', value: string): void\n (e: 'remove', value: string, index: number): void\n}>()\n\nconst inputValue = ref('')\nconst inputEl = ref<HTMLInputElement | null>(null)\n\nfunction focus(): void {\n inputEl.value?.focus()\n}\n\ndefineExpose({ focus })\n\nconst isMaxed = computed(() => props.max !== undefined && props.modelValue.length >= props.max)\nconst canEdit = computed(() => !props.disabled && !props.readonly)\nconst showRemove = computed(() => props.tagClosable && canEdit.value)\n\nfunction escapeRegexChar(ch: string): string {\n return ch.replace(REGEX_SPECIAL_CHAR_RE, '\\\\$&')\n}\n\nconst splitRegex = computed(() => {\n const seps = (props.separators ?? []).filter(Boolean).map(s => s[0]!)\n const uniq = [...new Set([...seps, '\\n', '\\r', '\\t'])]\n const body = uniq.map(escapeRegexChar).join('')\n return new RegExp(`[${body}]+`, 'g')\n})\n\nfunction normalizeTag(raw: string): string {\n return props.trim ? raw.trim() : raw\n}\n\nfunction splitToTags(raw: string): string[] {\n return raw\n .split(splitRegex.value)\n .map(v => normalizeTag(v))\n .filter(Boolean)\n}\n\nfunction addMany(rawTags: string[]): boolean {\n if (!canEdit.value || isMaxed.value)\n return false\n\n const next = props.modelValue.slice()\n let changed = false\n\n for (const raw of rawTags) {\n const tag = normalizeTag(raw)\n if (!tag)\n continue\n\n if (!props.allowDuplicates && next.includes(tag))\n continue\n\n if (props.max !== undefined && next.length >= props.max)\n break\n\n next.push(tag)\n changed = true\n emit('add', tag)\n }\n\n if (!changed)\n return false\n\n emit('update:modelValue', next)\n return true\n}\n\nfunction commitInput(): void {\n if (!canEdit.value || isMaxed.value || !inputValue.value)\n return\n\n const tags = splitToTags(inputValue.value)\n if (!tags.length)\n return\n\n const changed = addMany(tags)\n if (changed && props.clearInputOnAdd)\n inputValue.value = ''\n}\n\nfunction removeAt(index: number): void {\n if (!canEdit.value)\n return\n\n const next = props.modelValue.slice()\n const removed = next[index]\n if (removed === undefined)\n return\n\n next.splice(index, 1)\n emit('update:modelValue', next)\n emit('remove', removed, index)\n}\n\nfunction onInput(e: Event): void {\n inputValue.value = (e.target as HTMLInputElement).value\n}\n\nfunction onKeydown(e: KeyboardEvent): void {\n if (!canEdit.value)\n return\n\n if (e.key === 'Enter') {\n e.preventDefault()\n commitInput()\n return\n }\n\n if ((props.separators ?? []).includes(e.key)) {\n e.preventDefault()\n commitInput()\n return\n }\n\n if (e.key === 'Backspace' && inputValue.value.length === 0 && props.modelValue.length > 0) {\n e.preventDefault()\n removeAt(props.modelValue.length - 1)\n }\n}\n\nfunction onBlur(): void {\n if (props.addOnBlur)\n commitInput()\n}\n\nfunction onPaste(e: ClipboardEvent): void {\n if (!canEdit.value || isMaxed.value)\n return\n\n const pasted = e.clipboardData?.getData('text')\n if (!pasted)\n return\n\n const tags = splitToTags(pasted)\n if (tags.length <= 1)\n return\n\n e.preventDefault()\n addMany(tags)\n}\n\nconst wrapperClassName = computed(() => {\n return grInputTagWrapperClass({\n size: props.size,\n state: props.state,\n invalid: props.invalid,\n disabled: props.disabled,\n })\n})\n\nconst inputClassName = computed(() => {\n return grInputTagInputClass(props.size)\n})\n\nconst placeholderText = computed(() => props.modelValue.length > 0 ? undefined : props.placeholder)\n</script>\n\n<template>\n <div\n data-ds-input-tag\n data-testid=\"ds-input-tag\"\n class=\"w-full flex flex-wrap items-center rounded-md border bg-[var(--bg)] text-[var(--fg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]\"\n :class=\"wrapperClassName\"\n @click=\"focus\"\n >\n <GrBadge\n v-for=\"(tag, i) in modelValue\"\n :key=\"`${tag}-${i}`\"\n :tone=\"tagTone\"\n :dark=\"tagDark\"\n :size=\"tagSize\"\n :radius=\"tagRadius\"\n class=\"gap-1\"\n data-ds-input-tag-item\n data-testid=\"ds-input-tag-item\"\n :data-index=\"i\"\n >\n <slot name=\"tag\" :tag=\"tag\" :index=\"i\" :remove=\"() => removeAt(i)\">\n <span class=\"truncate max-w-[18rem]\">{{ tag }}</span>\n </slot>\n\n <button\n v-if=\"showRemove\"\n type=\"button\"\n class=\"-mr-0.5 inline-flex items-center justify-center rounded-[6px] p-0.5 opacity-70 hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n :aria-label=\"removeTagLabel\"\n data-ds-input-tag-remove\n data-testid=\"ds-input-tag-remove\"\n :data-index=\"i\"\n @mousedown.prevent.stop\n @click.stop=\"removeAt(i)\"\n >\n <GrIcon size=\"sm\" aria-hidden=\"true\">\n <IconClose />\n </GrIcon>\n </button>\n </GrBadge>\n\n <input\n ref=\"inputEl\"\n data-ds-input-tag-input\n data-testid=\"ds-input-tag-input\"\n :value=\"inputValue\"\n :disabled=\"disabled || isMaxed\"\n :readonly=\"readonly\"\n :placeholder=\"placeholderText\"\n :aria-invalid=\"invalid ? 'true' : undefined\"\n class=\"flex-1 min-w-[120px] bg-transparent border-none outline-none placeholder:text-[var(--muted-fg)]\"\n :class=\"inputClassName\"\n @input=\"onInput\"\n @keydown=\"onKeydown\"\n @blur=\"onBlur\"\n @paste=\"onPaste\"\n >\n </div>\n</template>\n"],"mappings":"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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { t as
|
|
3
|
-
export {
|
|
1
|
+
import { n as grInputTagSafelist, t as grInputTagConfig } from "../../chunks/config-CJbjLC5X.js";
|
|
2
|
+
import { t as GrInputTag_default } from "./chunks/GrInputTag-CzrrBxgU.js";
|
|
3
|
+
export { GrInputTag_default as GrInputTag, GrInputTag_default as default, grInputTagConfig, grInputTagSafelist };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { a as grLinkClass, i as focusRingClass, r as baseRootClass } from "../../../chunks/config-C2JKq8-2.js";
|
|
2
|
+
import { computed, createElementBlock, defineComponent, mergeProps, openBlock, renderSlot, unref, useAttrs } from "vue";
|
|
3
|
+
//#region src/components/GrLink/GrLink.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var _hoisted_1 = [
|
|
5
|
+
"href",
|
|
6
|
+
"target",
|
|
7
|
+
"rel",
|
|
8
|
+
"aria-label"
|
|
9
|
+
];
|
|
10
|
+
var _hoisted_2 = ["aria-label", "aria-disabled"];
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/components/GrLink/GrLink.vue
|
|
13
|
+
var GrLink_default = /* @__PURE__ */ defineComponent({
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
__name: "GrLink",
|
|
16
|
+
props: {
|
|
17
|
+
href: { default: void 0 },
|
|
18
|
+
external: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false
|
|
21
|
+
},
|
|
22
|
+
target: { default: void 0 },
|
|
23
|
+
rel: { default: void 0 },
|
|
24
|
+
disabled: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
ariaLabel: { default: void 0 },
|
|
29
|
+
variant: { default: "primary" },
|
|
30
|
+
underline: { default: "auto" },
|
|
31
|
+
size: { default: "md" }
|
|
32
|
+
},
|
|
33
|
+
setup(__props) {
|
|
34
|
+
/**
|
|
35
|
+
* GrLink — DS-примитив ссылки.
|
|
36
|
+
*
|
|
37
|
+
* Корневой тег зависит от пропов:
|
|
38
|
+
* - `<a>` — когда заданы `href` и не `disabled`;
|
|
39
|
+
* - `<span>` — во всех остальных случаях (включая `disabled`, даже если `href` задан).
|
|
40
|
+
*
|
|
41
|
+
* Это осознанное решение, чтобы отключённая ссылка не была кликабельной и
|
|
42
|
+
* не участвовала в порядке табуляции. Учтите это в внешних CSS-селекторах.
|
|
43
|
+
*/
|
|
44
|
+
const props = __props;
|
|
45
|
+
const attrs = useAttrs();
|
|
46
|
+
const isAnchor = computed(() => !!props.href && !props.disabled);
|
|
47
|
+
const resolvedTarget = computed(() => {
|
|
48
|
+
if (props.target) return props.target;
|
|
49
|
+
if (props.external) return "_blank";
|
|
50
|
+
});
|
|
51
|
+
const resolvedRel = computed(() => {
|
|
52
|
+
if (props.rel) return props.rel;
|
|
53
|
+
if (resolvedTarget.value === "_blank") return "noopener noreferrer";
|
|
54
|
+
});
|
|
55
|
+
const rootClass = computed(() => {
|
|
56
|
+
const variantClass = grLinkClass({
|
|
57
|
+
size: props.size,
|
|
58
|
+
underline: props.underline,
|
|
59
|
+
variant: props.variant,
|
|
60
|
+
disabled: props.disabled
|
|
61
|
+
});
|
|
62
|
+
return props.disabled ? `${baseRootClass} ${variantClass}` : `${baseRootClass} ${focusRingClass} ${variantClass}`;
|
|
63
|
+
});
|
|
64
|
+
return (_ctx, _cache) => {
|
|
65
|
+
return isAnchor.value ? (openBlock(), createElementBlock("a", mergeProps({ key: 0 }, unref(attrs), {
|
|
66
|
+
href: __props.href,
|
|
67
|
+
target: resolvedTarget.value,
|
|
68
|
+
rel: resolvedRel.value,
|
|
69
|
+
"aria-label": __props.ariaLabel,
|
|
70
|
+
class: rootClass.value
|
|
71
|
+
}), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1)) : (openBlock(), createElementBlock("span", mergeProps({ key: 1 }, unref(attrs), {
|
|
72
|
+
"aria-label": __props.ariaLabel,
|
|
73
|
+
"aria-disabled": __props.disabled ? "true" : void 0,
|
|
74
|
+
class: rootClass.value
|
|
75
|
+
}), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_2));
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
//#endregion
|
|
80
|
+
export { GrLink_default as t };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=GrLink-Dhkid3Mp.js.map
|