@punica/components 0.0.0-stage → 2.1.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/CHANGELOG.md +40 -0
- package/LICENSE +21 -0
- package/README.md +139 -2
- package/bin/punica-components.mjs +138 -0
- package/custom-elements.json +38745 -0
- package/dist/ai/index.d.ts +39 -0
- package/dist/ai/index.mjs +615 -0
- package/dist/ai/node.d.ts +5 -0
- package/dist/ai/node.mjs +625 -0
- package/dist/esm/chunks/chunk-25RFU6B5.js +25 -0
- package/dist/esm/chunks/chunk-2EK3PZFT.js +179 -0
- package/dist/esm/chunks/chunk-2KBDCVUH.js +20 -0
- package/dist/esm/chunks/chunk-2NCRRDPI.js +151 -0
- package/dist/esm/chunks/chunk-33GO7Z32.js +40 -0
- package/dist/esm/chunks/chunk-36BKRO3B.js +281 -0
- package/dist/esm/chunks/chunk-3DWJAU5S.js +607 -0
- package/dist/esm/chunks/chunk-3GOFXBR7.js +61 -0
- package/dist/esm/chunks/chunk-3H5QEUFO.js +21 -0
- package/dist/esm/chunks/chunk-3NHCLXYC.js +6 -0
- package/dist/esm/chunks/chunk-3NQ2RVWE.js +36 -0
- package/dist/esm/chunks/chunk-3SYFLID6.js +20 -0
- package/dist/esm/chunks/chunk-3TK5BG5K.js +322 -0
- package/dist/esm/chunks/chunk-3WLKVJO4.js +36 -0
- package/dist/esm/chunks/chunk-427DCAZS.js +49 -0
- package/dist/esm/chunks/chunk-4446KGJH.js +67 -0
- package/dist/esm/chunks/chunk-45UR4HAQ.js +128 -0
- package/dist/esm/chunks/chunk-46P3CPXM.js +81 -0
- package/dist/esm/chunks/chunk-4C3AUANN.js +271 -0
- package/dist/esm/chunks/chunk-4RURT4SK.js +142 -0
- package/dist/esm/chunks/chunk-4XJKCJQG.js +166 -0
- package/dist/esm/chunks/chunk-5PKJV3JP.js +61 -0
- package/dist/esm/chunks/chunk-5SSKNOUZ.js +141 -0
- package/dist/esm/chunks/chunk-5XB5CUJU.js +18 -0
- package/dist/esm/chunks/chunk-5XQX7D2B.js +27 -0
- package/dist/esm/chunks/chunk-6A5Q3TR2.js +73 -0
- package/dist/esm/chunks/chunk-6HE2DQS5.js +29 -0
- package/dist/esm/chunks/chunk-6IWDX7AR.js +32 -0
- package/dist/esm/chunks/chunk-6LO2ITXI.js +138 -0
- package/dist/esm/chunks/chunk-6NSNMUZE.js +36 -0
- package/dist/esm/chunks/chunk-6UQOC4YG.js +61 -0
- package/dist/esm/chunks/chunk-72ANEBJJ.js +138 -0
- package/dist/esm/chunks/chunk-7JTOYPC7.js +24 -0
- package/dist/esm/chunks/chunk-7O3D52ZO.js +27 -0
- package/dist/esm/chunks/chunk-7UN7TAOI.js +39 -0
- package/dist/esm/chunks/chunk-7WEISIJL.js +123 -0
- package/dist/esm/chunks/chunk-7YAUHJR2.js +225 -0
- package/dist/esm/chunks/chunk-7ZT7WUEL.js +35 -0
- package/dist/esm/chunks/chunk-ALU2KZWS.js +177 -0
- package/dist/esm/chunks/chunk-AMVMOCUW.js +81 -0
- package/dist/esm/chunks/chunk-APPQS53K.js +81 -0
- package/dist/esm/chunks/chunk-AVTATVAG.js +410 -0
- package/dist/esm/chunks/chunk-AZMUP33Z.js +56 -0
- package/dist/esm/chunks/chunk-B32J3O2V.js +21 -0
- package/dist/esm/chunks/chunk-B7YCX5VB.js +38 -0
- package/dist/esm/chunks/chunk-BBSDD7DS.js +55 -0
- package/dist/esm/chunks/chunk-BC657356.js +93 -0
- package/dist/esm/chunks/chunk-BFRWXGP4.js +44 -0
- package/dist/esm/chunks/chunk-BYZADSVQ.js +49 -0
- package/dist/esm/chunks/chunk-CDXX27FL.js +28 -0
- package/dist/esm/chunks/chunk-CKI34FQL.js +166 -0
- package/dist/esm/chunks/chunk-CNT47W5N.js +60 -0
- package/dist/esm/chunks/chunk-CU3RW3AS.js +515 -0
- package/dist/esm/chunks/chunk-CZ3R7GRW.js +73 -0
- package/dist/esm/chunks/chunk-DLEJ74RA.js +18 -0
- package/dist/esm/chunks/chunk-DPOPZQ7A.js +150 -0
- package/dist/esm/chunks/chunk-DYXHKPQU.js +18 -0
- package/dist/esm/chunks/chunk-E3XOZZSK.js +77 -0
- package/dist/esm/chunks/chunk-EJLQD3FS.js +89 -0
- package/dist/esm/chunks/chunk-ELY5HYAI.js +45 -0
- package/dist/esm/chunks/chunk-ELY5NJBV.js +152 -0
- package/dist/esm/chunks/chunk-EWIF3VBH.js +45 -0
- package/dist/esm/chunks/chunk-F2OASWR4.js +79 -0
- package/dist/esm/chunks/chunk-F4ODKLNS.js +62 -0
- package/dist/esm/chunks/chunk-F5HKSUTX.js +127 -0
- package/dist/esm/chunks/chunk-FFH6CIAJ.js +208 -0
- package/dist/esm/chunks/chunk-FFLBSXWE.js +21 -0
- package/dist/esm/chunks/chunk-FNTBMCUQ.js +184 -0
- package/dist/esm/chunks/chunk-FYSNICNC.js +71 -0
- package/dist/esm/chunks/chunk-G2QRQLP5.js +18 -0
- package/dist/esm/chunks/chunk-G36PG2LK.js +27 -0
- package/dist/esm/chunks/chunk-G5LARXMF.js +73 -0
- package/dist/esm/chunks/chunk-GQLNLUQX.js +42 -0
- package/dist/esm/chunks/chunk-GRWYCZQZ.js +73 -0
- package/dist/esm/chunks/chunk-GSXWSHYU.js +304 -0
- package/dist/esm/chunks/chunk-GVH32USX.js +48 -0
- package/dist/esm/chunks/chunk-GW3IYQNO.js +271 -0
- package/dist/esm/chunks/chunk-H4Q2HHZA.js +151 -0
- package/dist/esm/chunks/chunk-HDHVTBGS.js +330 -0
- package/dist/esm/chunks/chunk-HK6DEJO3.js +74 -0
- package/dist/esm/chunks/chunk-HUMTZKOD.js +114 -0
- package/dist/esm/chunks/chunk-HW2CN2JV.js +118 -0
- package/dist/esm/chunks/chunk-I6WGYC6M.js +50 -0
- package/dist/esm/chunks/chunk-ICGI6UOP.js +28 -0
- package/dist/esm/chunks/chunk-IYZKVVEX.js +285 -0
- package/dist/esm/chunks/chunk-J4HTWL4Q.js +34 -0
- package/dist/esm/chunks/chunk-J6FXZP6E.js +99 -0
- package/dist/esm/chunks/chunk-JTIBDZBU.js +392 -0
- package/dist/esm/chunks/chunk-K2OIQJ36.js +23 -0
- package/dist/esm/chunks/chunk-K5D5UHVI.js +99 -0
- package/dist/esm/chunks/chunk-K753LIJX.js +157 -0
- package/dist/esm/chunks/chunk-KV4Y5ZP5.js +105 -0
- package/dist/esm/chunks/chunk-KVWZQINH.js +44 -0
- package/dist/esm/chunks/chunk-LKKKFYM4.js +106 -0
- package/dist/esm/chunks/chunk-LKPOFLSP.js +337 -0
- package/dist/esm/chunks/chunk-LSDTMST7.js +6 -0
- package/dist/esm/chunks/chunk-LUASZ5NH.js +271 -0
- package/dist/esm/chunks/chunk-LUPYODQN.js +54 -0
- package/dist/esm/chunks/chunk-M3HQENQG.js +93 -0
- package/dist/esm/chunks/chunk-MCHPBSW4.js +155 -0
- package/dist/esm/chunks/chunk-MDEV5WIN.js +25 -0
- package/dist/esm/chunks/chunk-MF2ASALV.js +194 -0
- package/dist/esm/chunks/chunk-MIUSZNAX.js +62 -0
- package/dist/esm/chunks/chunk-NINGLTB2.js +194 -0
- package/dist/esm/chunks/chunk-NLFUTVKG.js +158 -0
- package/dist/esm/chunks/chunk-NNCGUKTM.js +44 -0
- package/dist/esm/chunks/chunk-NSCGX5GB.js +408 -0
- package/dist/esm/chunks/chunk-NTIMVMDT.js +51 -0
- package/dist/esm/chunks/chunk-OBUW2HDW.js +99 -0
- package/dist/esm/chunks/chunk-OKRRNW3E.js +202 -0
- package/dist/esm/chunks/chunk-PGWADMK3.js +198 -0
- package/dist/esm/chunks/chunk-PMGKVE2V.js +30 -0
- package/dist/esm/chunks/chunk-PMLVGWVZ.js +80 -0
- package/dist/esm/chunks/chunk-PXECURYJ.js +78 -0
- package/dist/esm/chunks/chunk-Q2766HFS.js +34 -0
- package/dist/esm/chunks/chunk-Q62K7757.js +22 -0
- package/dist/esm/chunks/chunk-Q7JNV3UN.js +192 -0
- package/dist/esm/chunks/chunk-QRJKBLYH.js +43 -0
- package/dist/esm/chunks/chunk-QRZWLIUQ.js +551 -0
- package/dist/esm/chunks/chunk-RKF3ZNBC.js +25 -0
- package/dist/esm/chunks/chunk-RMJM6NWT.js +58 -0
- package/dist/esm/chunks/chunk-ROTG34TD.js +81 -0
- package/dist/esm/chunks/chunk-RQ2NYS2W.js +51 -0
- package/dist/esm/chunks/chunk-RX5HOB7L.js +187 -0
- package/dist/esm/chunks/chunk-RYOY6CGB.js +174 -0
- package/dist/esm/chunks/chunk-S2P6I4PF.js +191 -0
- package/dist/esm/chunks/chunk-SCSGRIQM.js +27 -0
- package/dist/esm/chunks/chunk-SENDWPHS.js +115 -0
- package/dist/esm/chunks/chunk-SFY6NIVM.js +106 -0
- package/dist/esm/chunks/chunk-SHEACXCO.js +67 -0
- package/dist/esm/chunks/chunk-SII4GAN2.js +302 -0
- package/dist/esm/chunks/chunk-SIUUXS2M.js +172 -0
- package/dist/esm/chunks/chunk-SLXOGLX4.js +39 -0
- package/dist/esm/chunks/chunk-ST7UASSS.js +43 -0
- package/dist/esm/chunks/chunk-SUNHM3W2.js +211 -0
- package/dist/esm/chunks/chunk-SWTIN4AS.js +43 -0
- package/dist/esm/chunks/chunk-T2FH4DTZ.js +163 -0
- package/dist/esm/chunks/chunk-TK5H2DLW.js +157 -0
- package/dist/esm/chunks/chunk-U3SSEG6P.js +31 -0
- package/dist/esm/chunks/chunk-UNQEQ3F2.js +118 -0
- package/dist/esm/chunks/chunk-UP3ZQ5S6.js +155 -0
- package/dist/esm/chunks/chunk-UQFS4FAE.js +80 -0
- package/dist/esm/chunks/chunk-UZXXUKV6.js +124 -0
- package/dist/esm/chunks/chunk-VF4NHXZG.js +33 -0
- package/dist/esm/chunks/chunk-VIGFMBQW.js +337 -0
- package/dist/esm/chunks/chunk-VJBXT6L2.js +86 -0
- package/dist/esm/chunks/chunk-VM4IKZDR.js +211 -0
- package/dist/esm/chunks/chunk-VPCWI2SH.js +18 -0
- package/dist/esm/chunks/chunk-VR225VA6.js +29 -0
- package/dist/esm/chunks/chunk-WEGQW4SS.js +285 -0
- package/dist/esm/chunks/chunk-WHXEETCS.js +80 -0
- package/dist/esm/chunks/chunk-X2XT4SYI.js +71 -0
- package/dist/esm/chunks/chunk-X6Y3S66P.js +91 -0
- package/dist/esm/chunks/chunk-XBFOPEHZ.js +86 -0
- package/dist/esm/chunks/chunk-XE74KQOC.js +18 -0
- package/dist/esm/chunks/chunk-XNMQ4SC7.js +95 -0
- package/dist/esm/chunks/chunk-XWPDELI6.js +53 -0
- package/dist/esm/chunks/chunk-XWZPKK2I.js +6 -0
- package/dist/esm/chunks/chunk-XZSAOJUV.js +83 -0
- package/dist/esm/chunks/chunk-Y5BQXWLM.js +58 -0
- package/dist/esm/chunks/chunk-Y5HOTHVK.js +22 -0
- package/dist/esm/chunks/chunk-Y7B65FYJ.js +336 -0
- package/dist/esm/chunks/chunk-YIAEOUGS.js +46 -0
- package/dist/esm/chunks/chunk-YKL6MAIV.js +208 -0
- package/dist/esm/chunks/chunk-YPH3G6P7.js +125 -0
- package/dist/esm/chunks/chunk-YSGWORUD.js +36 -0
- package/dist/esm/chunks/chunk-ZB7DQSJK.js +204 -0
- package/dist/esm/chunks/chunk-ZC7JPIL7.js +182 -0
- package/dist/esm/chunks/chunk-ZGBBW7U4.js +35 -0
- package/dist/esm/chunks/chunk-ZIQREEEI.js +210 -0
- package/dist/esm/chunks/chunk-ZJ3UIJ46.js +30 -0
- package/dist/esm/chunks/chunk-ZK6JTE6K.js +826 -0
- package/dist/esm/chunks/chunk-ZPIJWNFB.js +150 -0
- package/dist/esm/chunks/chunk-ZQVI42RW.js +136 -0
- package/dist/esm/chunks/chunk-ZWP6KATC.js +25 -0
- package/dist/esm/chunks/chunk-ZY5YHMTQ.js +88 -0
- package/dist/esm/components/accordion/accordion.js +8 -0
- package/dist/esm/components/accordion/accordionGroup.js +7 -0
- package/dist/esm/components/agenda/agenda.js +9 -0
- package/dist/esm/components/alert/alert.js +8 -0
- package/dist/esm/components/alertDialog/alertDialog.js +14 -0
- package/dist/esm/components/appBar/appBar.js +7 -0
- package/dist/esm/components/appShell/appShell.js +11 -0
- package/dist/esm/components/aspectRatio/aspectRatio.js +7 -0
- package/dist/esm/components/autocomplete/autocomplete.js +14 -0
- package/dist/esm/components/avatar/avatar.js +7 -0
- package/dist/esm/components/avatarGroup/avatarGroup.js +11 -0
- package/dist/esm/components/badge/badge.js +7 -0
- package/dist/esm/components/banner/banner.js +9 -0
- package/dist/esm/components/blockquote/blockquote.js +7 -0
- package/dist/esm/components/bottomSheet/bottomSheet.js +9 -0
- package/dist/esm/components/box/box.js +7 -0
- package/dist/esm/components/breadcrumbs/breadcrumbItem.js +8 -0
- package/dist/esm/components/breadcrumbs/breadcrumbs.js +11 -0
- package/dist/esm/components/button/button.js +8 -0
- package/dist/esm/components/buttonGroup/buttonGroup.js +7 -0
- package/dist/esm/components/calendar/calendar.js +12 -0
- package/dist/esm/components/calendar/dates.js +44 -0
- package/dist/esm/components/card/card.js +7 -0
- package/dist/esm/components/card/cardActions.js +7 -0
- package/dist/esm/components/card/cardContent.js +7 -0
- package/dist/esm/components/card/cardHeader.js +7 -0
- package/dist/esm/components/card/cardMedia.js +7 -0
- package/dist/esm/components/carousel/carousel.js +9 -0
- package/dist/esm/components/carousel/carouselItem.js +7 -0
- package/dist/esm/components/center/center.js +7 -0
- package/dist/esm/components/chat/chatComposer.js +9 -0
- package/dist/esm/components/chat/chatDictationButton.js +8 -0
- package/dist/esm/components/chat/chatLayout.js +9 -0
- package/dist/esm/components/chat/chatMessage.js +9 -0
- package/dist/esm/components/chat/chatMessageBubble.js +7 -0
- package/dist/esm/components/chat/chatMessageList.js +8 -0
- package/dist/esm/components/chat/chatMessageMetadata.js +7 -0
- package/dist/esm/components/chat/chatSystemMessage.js +7 -0
- package/dist/esm/components/chat/chatToolCall.js +9 -0
- package/dist/esm/components/chat/chatToolCalls.js +8 -0
- package/dist/esm/components/chat/slots.js +6 -0
- package/dist/esm/components/checkbox/checkbox.js +9 -0
- package/dist/esm/components/checkboxGroup/checkboxGroup.js +10 -0
- package/dist/esm/components/chip/chip.js +8 -0
- package/dist/esm/components/citation/citation.js +11 -0
- package/dist/esm/components/code/code.js +7 -0
- package/dist/esm/components/codeBlock/codeBlock.js +8 -0
- package/dist/esm/components/collapsible/collapsible.js +7 -0
- package/dist/esm/components/commandPalette/commandGroup.js +7 -0
- package/dist/esm/components/commandPalette/commandItem.js +7 -0
- package/dist/esm/components/commandPalette/commandPalette.js +10 -0
- package/dist/esm/components/complexSelector/complexOption.js +9 -0
- package/dist/esm/components/complexSelector/complexSelector.js +16 -0
- package/dist/esm/components/complexSelector/optionGroup.js +7 -0
- package/dist/esm/components/container/container.js +7 -0
- package/dist/esm/components/contextMenu/contextMenu.js +12 -0
- package/dist/esm/components/datePicker/datePicker.js +15 -0
- package/dist/esm/components/dateRangeInput/dateRangeInput.js +15 -0
- package/dist/esm/components/dateTimeInput/dateTimeInput.js +18 -0
- package/dist/esm/components/dialog/dialog.js +11 -0
- package/dist/esm/components/dialog/dialogContent.js +7 -0
- package/dist/esm/components/dialog/dialogFooter.js +7 -0
- package/dist/esm/components/dialog/dialogHeader.js +7 -0
- package/dist/esm/components/dialog/modalSurface.js +8 -0
- package/dist/esm/components/divider/divider.js +7 -0
- package/dist/esm/components/drawer/drawer.js +10 -0
- package/dist/esm/components/emptyState/emptyState.js +7 -0
- package/dist/esm/components/field/field.js +7 -0
- package/dist/esm/components/fileInput/fileInput.js +9 -0
- package/dist/esm/components/formLayout/formLayout.js +7 -0
- package/dist/esm/components/grid/col.js +7 -0
- package/dist/esm/components/grid/row.js +7 -0
- package/dist/esm/components/heading/heading.js +7 -0
- package/dist/esm/components/hidden/hidden.js +7 -0
- package/dist/esm/components/hoverCard/hoverCard.js +9 -0
- package/dist/esm/components/icon/icon.js +8 -0
- package/dist/esm/components/iconButton/iconButton.js +8 -0
- package/dist/esm/components/infoTip/infoTip.js +10 -0
- package/dist/esm/components/input/input.js +9 -0
- package/dist/esm/components/inputGroup/inputGroup.js +9 -0
- package/dist/esm/components/inputGroup/inputGroupText.js +7 -0
- package/dist/esm/components/kbd/kbd.js +7 -0
- package/dist/esm/components/lightbox/lightbox.js +10 -0
- package/dist/esm/components/link/link.js +8 -0
- package/dist/esm/components/listView/list.js +7 -0
- package/dist/esm/components/listView/listItem.js +7 -0
- package/dist/esm/components/listbox/listbox.js +9 -0
- package/dist/esm/components/listbox/listboxItem.js +8 -0
- package/dist/esm/components/markdown/markdown.js +9 -0
- package/dist/esm/components/markdown/parser.js +9 -0
- package/dist/esm/components/markdown/url.js +6 -0
- package/dist/esm/components/menu/menu.js +11 -0
- package/dist/esm/components/menu/menuCheckboxItem.js +9 -0
- package/dist/esm/components/menu/menuDivider.js +7 -0
- package/dist/esm/components/menu/menuGroup.js +7 -0
- package/dist/esm/components/menu/menuItem.js +8 -0
- package/dist/esm/components/menu/menuRadioGroup.js +7 -0
- package/dist/esm/components/menu/menuRadioItem.js +9 -0
- package/dist/esm/components/metadataList/metadataList.js +9 -0
- package/dist/esm/components/metadataList/metadataListItem.js +8 -0
- package/dist/esm/components/mobileNav/mobileNav.js +10 -0
- package/dist/esm/components/numberInput/numberInput.js +9 -0
- package/dist/esm/components/outline/outline.js +8 -0
- package/dist/esm/components/overflowList/overflowList.js +11 -0
- package/dist/esm/components/pagination/pagination.js +8 -0
- package/dist/esm/components/paper/paper.js +7 -0
- package/dist/esm/components/popover/popover.js +9 -0
- package/dist/esm/components/powerSearch/powerSearch.js +14 -0
- package/dist/esm/components/progressBar/progressBar.js +7 -0
- package/dist/esm/components/qrCode/qrCode.js +9 -0
- package/dist/esm/components/radio/radio.js +7 -0
- package/dist/esm/components/radio/radioGroup.js +10 -0
- package/dist/esm/components/scrollArea/scrollArea.js +8 -0
- package/dist/esm/components/section/section.js +8 -0
- package/dist/esm/components/segmentedControl/segmentedControl.js +12 -0
- package/dist/esm/components/segmentedControl/segmentedControlItem.js +7 -0
- package/dist/esm/components/select/field.js +18 -0
- package/dist/esm/components/select/option.js +8 -0
- package/dist/esm/components/select/select.js +14 -0
- package/dist/esm/components/selectableCard/selectableCard.js +9 -0
- package/dist/esm/components/selectableCard/selectableCardGroup.js +13 -0
- package/dist/esm/components/sideNav/sideNav.js +9 -0
- package/dist/esm/components/sideNav/sideNavItem.js +9 -0
- package/dist/esm/components/sideNav/sideNavSection.js +8 -0
- package/dist/esm/components/skeleton/skeleton.js +7 -0
- package/dist/esm/components/slider/slider.js +9 -0
- package/dist/esm/components/spinner/spinner.js +7 -0
- package/dist/esm/components/split/split.js +8 -0
- package/dist/esm/components/splitButton/splitButton.js +12 -0
- package/dist/esm/components/stack/stack.js +7 -0
- package/dist/esm/components/statusDot/statusDot.js +7 -0
- package/dist/esm/components/stepper/step.js +8 -0
- package/dist/esm/components/stepper/stepper.js +7 -0
- package/dist/esm/components/switch/switch.js +8 -0
- package/dist/esm/components/tab/tab.js +7 -0
- package/dist/esm/components/tab/tabPanel.js +7 -0
- package/dist/esm/components/tab/tabs.js +8 -0
- package/dist/esm/components/table/table.js +7 -0
- package/dist/esm/components/table/tableBody.js +7 -0
- package/dist/esm/components/table/tableCell.js +7 -0
- package/dist/esm/components/table/tableFooter.js +7 -0
- package/dist/esm/components/table/tableHeader.js +7 -0
- package/dist/esm/components/table/tableHeaderCell.js +8 -0
- package/dist/esm/components/table/tableRow.js +7 -0
- package/dist/esm/components/table/tableSelectionToolbar.js +8 -0
- package/dist/esm/components/text/text.js +7 -0
- package/dist/esm/components/textarea/textarea.js +8 -0
- package/dist/esm/components/thumbnail/thumbnail.js +8 -0
- package/dist/esm/components/timePicker/timePicker.js +15 -0
- package/dist/esm/components/timer/timer.js +7 -0
- package/dist/esm/components/timestamp/timestamp.js +7 -0
- package/dist/esm/components/toast/toast.js +8 -0
- package/dist/esm/components/toast/toaster.js +12 -0
- package/dist/esm/components/toggleButton/toggleButton.js +8 -0
- package/dist/esm/components/toggleButtonGroup/toggleButtonGroup.js +10 -0
- package/dist/esm/components/tokenizer/tokenizer.js +14 -0
- package/dist/esm/components/toolbar/toolbar.js +8 -0
- package/dist/esm/components/tooltip/tooltip.js +9 -0
- package/dist/esm/components/topNav/topNav.js +11 -0
- package/dist/esm/components/topNav/topNavItem.js +11 -0
- package/dist/esm/components/topNav/topNavMegaMenu.js +7 -0
- package/dist/esm/components/topNav/topNavMegaMenuCard.js +8 -0
- package/dist/esm/components/topNav/topNavMegaMenuGroup.js +7 -0
- package/dist/esm/components/topNav/topNavMegaMenuItem.js +7 -0
- package/dist/esm/components/tree/tree.js +8 -0
- package/dist/esm/components/tree/treeItem.js +8 -0
- package/dist/esm/components/virtualList/virtualList.js +7 -0
- package/dist/esm/components/virtualTable/virtualTable.js +9 -0
- package/dist/esm/components/visuallyHidden/visuallyHidden.js +7 -0
- package/dist/esm/core/a11y.js +22 -0
- package/dist/esm/core/element.js +14 -0
- package/dist/esm/core/form.js +6 -0
- package/dist/esm/core/overlay.js +8 -0
- package/dist/esm/index.js +779 -0
- package/dist/llms-full.txt +8890 -0
- package/dist/llms.txt +275 -0
- package/dist/punica-components.min.js +14283 -0
- package/dist/tokens.css +158 -0
- package/dist/types/index.d.ts +6753 -0
- package/dist/types/react.d.ts +1914 -0
- package/dist/vscode.css-custom-data.json +3892 -0
- package/dist/vscode.html-custom-data.json +6912 -0
- package/dist/web-types.json +12404 -0
- package/docs/MIGRATION-2.0.md +112 -0
- package/docs/contract.md +130 -0
- package/docs/migration/chat.md +309 -0
- package/docs/migration/content.md +806 -0
- package/docs/migration/data.md +140 -0
- package/docs/migration/display.md +625 -0
- package/docs/migration/form-basic.md +262 -0
- package/docs/migration/navigation.md +368 -0
- package/docs/migration/overlays.md +261 -0
- package/docs/migration/pickers.md +194 -0
- package/package.json +131 -4
- package/scripts/codemod-2.0.mjs +50 -0
- package/scripts/codemod-rules.mjs +102 -0
- package/skills/punica-components/SKILL.md +48 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PunicaMenuItem
|
|
3
|
+
} from "./chunk-E3XOZZSK.js";
|
|
4
|
+
import {
|
|
5
|
+
Overlay,
|
|
6
|
+
overlayCss
|
|
7
|
+
} from "./chunk-FNTBMCUQ.js";
|
|
8
|
+
import {
|
|
9
|
+
composedContains,
|
|
10
|
+
deepActiveElement,
|
|
11
|
+
isRtl,
|
|
12
|
+
nextIndex
|
|
13
|
+
} from "./chunk-4RURT4SK.js";
|
|
14
|
+
import {
|
|
15
|
+
PunicaElement,
|
|
16
|
+
define
|
|
17
|
+
} from "./chunk-Y7B65FYJ.js";
|
|
18
|
+
|
|
19
|
+
// src/components/menu/menu.css
|
|
20
|
+
var menu_default = ":host {\n --punica-menu-radius: var(--punica-radius);\n --punica-menu-padding: var(--punica-space-4);\n --punica-menu-background: var(--punica-color-surface-raised);\n --punica-menu-shadow: var(--punica-shadow-md);\n --punica-menu-min-width: 160px;\n --punica-menu-max-width: min(90vw, 320px);\n --punica-menu-max-height: 320px;\n\n display: contents;\n}\n\n[part='panel'] {\n min-inline-size: var(--punica-menu-min-width);\n max-inline-size: var(--punica-menu-max-width);\n border: var(--punica-border-width) solid var(--punica-color-border);\n border-radius: var(--punica-menu-radius);\n background: var(--punica-menu-background);\n color: var(--punica-color-text);\n font-family: var(--punica-font-family);\n font-size: var(--punica-font-size-sm);\n box-shadow: var(--punica-menu-shadow);\n outline: none;\n opacity: 0;\n transition: opacity var(--punica-duration-fast) var(--punica-ease),\n display var(--punica-duration-fast) allow-discrete,\n overlay var(--punica-duration-fast) allow-discrete;\n}\n\n[part='panel']:popover-open,\n[part='panel'][data-open] {\n opacity: 1;\n}\n\n@starting-style {\n [part='panel']:popover-open {\n opacity: 0;\n }\n}\n\n.items {\n display: flex;\n flex-direction: column;\n max-block-size: var(--punica-menu-max-height);\n padding: var(--punica-menu-padding);\n overflow-x: hidden;\n overflow-y: auto;\n}\n\n@media (forced-colors: active) {\n [part='panel'] {\n border-color: CanvasText;\n }\n}\n";
|
|
21
|
+
|
|
22
|
+
// src/components/menu/menu.js
|
|
23
|
+
var GROUPS = /* @__PURE__ */ new Set(["punica-menu-group", "punica-menu-radio-group"]);
|
|
24
|
+
var PunicaMenu = class _PunicaMenu extends PunicaElement {
|
|
25
|
+
static properties = {
|
|
26
|
+
label: {},
|
|
27
|
+
open: { type: Boolean },
|
|
28
|
+
side: { default: "block-end" },
|
|
29
|
+
align: { default: "start" },
|
|
30
|
+
offset: { type: Number, default: 4 },
|
|
31
|
+
anchor: { type: Object, attribute: false },
|
|
32
|
+
point: { type: Object, attribute: false }
|
|
33
|
+
};
|
|
34
|
+
static styles = [overlayCss, menu_default];
|
|
35
|
+
static template = `
|
|
36
|
+
<slot name="trigger"></slot>
|
|
37
|
+
<div part="panel" popover="manual" role="menu" tabindex="-1"><div class="items"><slot></slot></div></div>
|
|
38
|
+
`;
|
|
39
|
+
#panel = this.$('[part="panel"]');
|
|
40
|
+
#slot = this.$("slot:not([name])");
|
|
41
|
+
#triggerSlot = this.$('slot[name="trigger"]');
|
|
42
|
+
#overlay = new Overlay(this.#panel);
|
|
43
|
+
#typed = "";
|
|
44
|
+
#typedTimer = 0;
|
|
45
|
+
/** @type {PunicaMenu | null} */
|
|
46
|
+
#parent = null;
|
|
47
|
+
/** @type {PunicaMenuItem | null} */
|
|
48
|
+
#parentItem = null;
|
|
49
|
+
/** @type {'first' | 'last' | 'panel' | 'none'} */
|
|
50
|
+
#focusMode = "first";
|
|
51
|
+
#reason = "api";
|
|
52
|
+
/** @type {Element | null} */
|
|
53
|
+
#returnFocus = null;
|
|
54
|
+
/** @type {AbortController | null} */
|
|
55
|
+
#openAbort = null;
|
|
56
|
+
#shown = false;
|
|
57
|
+
#hoverTimer = 0;
|
|
58
|
+
constructor() {
|
|
59
|
+
super();
|
|
60
|
+
this.#triggerSlot.addEventListener("click", (event) => this.#onTriggerClick(event));
|
|
61
|
+
this.#triggerSlot.addEventListener("keydown", (event) => this.#onTriggerKeydown(event));
|
|
62
|
+
this.#triggerSlot.addEventListener("slotchange", () => this.requestUpdate());
|
|
63
|
+
this.#panel.addEventListener("keydown", (event) => this.#onKeydown(event));
|
|
64
|
+
this.#panel.addEventListener("click", (event) => {
|
|
65
|
+
const item = this.#itemOf(event);
|
|
66
|
+
if (item) this.#activate(item, false);
|
|
67
|
+
});
|
|
68
|
+
this.#panel.addEventListener("pointerover", (event) => {
|
|
69
|
+
const item = this.#itemOf(event);
|
|
70
|
+
if (item && !item.disabled) this.#hover(item);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
get #trigger() {
|
|
74
|
+
return this.#triggerSlot.assignedElements({ flatten: true })[0] || null;
|
|
75
|
+
}
|
|
76
|
+
get #isSubmenu() {
|
|
77
|
+
return !!this.#parent && this.#parent.#shown;
|
|
78
|
+
}
|
|
79
|
+
/** Every item of this menu, in order, without those of its submenus. */
|
|
80
|
+
get items() {
|
|
81
|
+
const out = [];
|
|
82
|
+
const visit = (el) => {
|
|
83
|
+
if (el instanceof PunicaMenuItem) out.push(el);
|
|
84
|
+
else if (GROUPS.has(el.localName)) for (const child of el.children) visit(child);
|
|
85
|
+
};
|
|
86
|
+
for (const el of this.#slot.assignedElements({ flatten: true })) visit(el);
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
/** The floating menu element. */
|
|
90
|
+
get panel() {
|
|
91
|
+
return this.#panel;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Opens the menu.
|
|
95
|
+
* @param {{ focus?: 'first' | 'last' | 'panel' | 'none' }} [options] where
|
|
96
|
+
* focus goes: the first item by default.
|
|
97
|
+
*/
|
|
98
|
+
show(options) {
|
|
99
|
+
this.#focusMode = options?.focus || "first";
|
|
100
|
+
if (this.#shown) this.#focusInitial();
|
|
101
|
+
this.open = true;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Closes the menu and its submenus.
|
|
105
|
+
* @param {'select' | 'escape' | 'outside' | 'tab' | 'api'} [reason]
|
|
106
|
+
*/
|
|
107
|
+
hide(reason = "api") {
|
|
108
|
+
if (!this.open) return;
|
|
109
|
+
this.#reason = reason;
|
|
110
|
+
this.open = false;
|
|
111
|
+
this.#teardown(true);
|
|
112
|
+
}
|
|
113
|
+
/** Opens the menu when it is closed, closes it when it is open. */
|
|
114
|
+
toggle() {
|
|
115
|
+
if (this.open) this.hide();
|
|
116
|
+
else this.show();
|
|
117
|
+
}
|
|
118
|
+
/** Re-measures after the items changed. */
|
|
119
|
+
reposition() {
|
|
120
|
+
this.#overlay.reposition();
|
|
121
|
+
}
|
|
122
|
+
connected() {
|
|
123
|
+
if (this.open && !this.#shown) {
|
|
124
|
+
queueMicrotask(() => this.isConnected && this.open && !this.#shown && this.#setup());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
disconnected() {
|
|
128
|
+
this.#teardown(false);
|
|
129
|
+
}
|
|
130
|
+
update(changed) {
|
|
131
|
+
const panel = this.#panel;
|
|
132
|
+
const trigger = this.#trigger;
|
|
133
|
+
if (this.label) panel.setAttribute("aria-label", this.label);
|
|
134
|
+
else panel.removeAttribute("aria-label");
|
|
135
|
+
if ("ariaLabelledByElements" in panel) {
|
|
136
|
+
panel.ariaLabelledByElements = !this.label && trigger ? [trigger] : null;
|
|
137
|
+
}
|
|
138
|
+
if (trigger) {
|
|
139
|
+
trigger.setAttribute("aria-haspopup", "menu");
|
|
140
|
+
trigger.setAttribute("aria-expanded", String(this.open));
|
|
141
|
+
}
|
|
142
|
+
if (this.open && !this.#shown) this.#setup();
|
|
143
|
+
else if (!this.open && this.#shown) this.#teardown(true);
|
|
144
|
+
else if (this.open && ["side", "align", "offset", "anchor", "point"].some((name) => changed.has(name))) {
|
|
145
|
+
this.#place();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
#place() {
|
|
149
|
+
if (this.#isSubmenu && this.#parentItem) {
|
|
150
|
+
this.#overlay.show(this.#parentItem, { side: "inline-end", align: "start", offset: 0 });
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const point = (
|
|
154
|
+
/** @type {any} */
|
|
155
|
+
this.point
|
|
156
|
+
);
|
|
157
|
+
this.#overlay.show(point ? null : (
|
|
158
|
+
/** @type {any} */
|
|
159
|
+
this.anchor || this.#trigger || this
|
|
160
|
+
), {
|
|
161
|
+
side: (
|
|
162
|
+
/** @type {any} */
|
|
163
|
+
this.side
|
|
164
|
+
),
|
|
165
|
+
align: (
|
|
166
|
+
/** @type {any} */
|
|
167
|
+
this.align
|
|
168
|
+
),
|
|
169
|
+
offset: this.offset,
|
|
170
|
+
point: point || void 0
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
#setup() {
|
|
174
|
+
this.#shown = true;
|
|
175
|
+
this.#returnFocus = deepActiveElement();
|
|
176
|
+
this.#place();
|
|
177
|
+
this.#openAbort = new AbortController();
|
|
178
|
+
if (!this.#isSubmenu) {
|
|
179
|
+
document.addEventListener(
|
|
180
|
+
"pointerdown",
|
|
181
|
+
(event) => {
|
|
182
|
+
const path = event.composedPath();
|
|
183
|
+
if (path.includes(this) || path.includes(this.#panel)) return;
|
|
184
|
+
const anchor = this.anchor;
|
|
185
|
+
if (anchor && path.includes(
|
|
186
|
+
/** @type {any} */
|
|
187
|
+
anchor
|
|
188
|
+
)) return;
|
|
189
|
+
this.hide("outside");
|
|
190
|
+
},
|
|
191
|
+
{ capture: true, signal: this.#openAbort.signal }
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
this.#focusInitial();
|
|
195
|
+
this.emit("open");
|
|
196
|
+
}
|
|
197
|
+
#focusInitial() {
|
|
198
|
+
const mode = this.#focusMode;
|
|
199
|
+
this.#focusMode = "first";
|
|
200
|
+
if (mode === "none") return;
|
|
201
|
+
const items = this.#enabled();
|
|
202
|
+
if (mode === "panel" || !items.length) this.#panel.focus({ preventScroll: true });
|
|
203
|
+
else (mode === "last" ? items[items.length - 1] : items[0]).focus({ preventScroll: true });
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @param {boolean} announce
|
|
207
|
+
* @param {boolean} [refocus]
|
|
208
|
+
*/
|
|
209
|
+
#teardown(announce, refocus = true) {
|
|
210
|
+
if (!this.#shown) return;
|
|
211
|
+
const active = deepActiveElement();
|
|
212
|
+
const inside = !active || active === document.body || composedContains(this.#panel, active);
|
|
213
|
+
this.#shown = false;
|
|
214
|
+
clearTimeout(this.#hoverTimer);
|
|
215
|
+
clearTimeout(this.#typedTimer);
|
|
216
|
+
this.#typed = "";
|
|
217
|
+
this.#openAbort?.abort();
|
|
218
|
+
this.#openAbort = null;
|
|
219
|
+
for (const item of this.items) {
|
|
220
|
+
const sub = item.submenu;
|
|
221
|
+
if (sub instanceof _PunicaMenu && sub.#shown) {
|
|
222
|
+
sub.open = false;
|
|
223
|
+
sub.#teardown(announce, false);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
this.#overlay.hide();
|
|
227
|
+
const back = this.#parentItem && this.#parent?.#shown ? this.#parentItem : this.#trigger || this.#returnFocus;
|
|
228
|
+
this.#returnFocus = null;
|
|
229
|
+
if (!announce) return;
|
|
230
|
+
const reason = this.#reason;
|
|
231
|
+
this.#reason = "api";
|
|
232
|
+
if (refocus && reason !== "outside" && inside && back instanceof HTMLElement && back.isConnected) {
|
|
233
|
+
back.focus({ preventScroll: true });
|
|
234
|
+
}
|
|
235
|
+
this.emit("close", { reason });
|
|
236
|
+
}
|
|
237
|
+
#enabled() {
|
|
238
|
+
return this.items.filter((item) => !item.disabled);
|
|
239
|
+
}
|
|
240
|
+
#root() {
|
|
241
|
+
let menu = this;
|
|
242
|
+
while (menu.#isSubmenu) menu = /** @type {PunicaMenu} */
|
|
243
|
+
menu.#parent;
|
|
244
|
+
return menu;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The item of this menu an event came from; `null` for the panel itself or
|
|
248
|
+
* other content, `undefined` when the event belongs to a submenu.
|
|
249
|
+
* @param {Event} event
|
|
250
|
+
*/
|
|
251
|
+
#itemOf(event) {
|
|
252
|
+
const path = event.composedPath();
|
|
253
|
+
const end = path.indexOf(this.#panel);
|
|
254
|
+
for (let i = 0; i < end; i++) {
|
|
255
|
+
const node = path[i];
|
|
256
|
+
if (node instanceof _PunicaMenu) return void 0;
|
|
257
|
+
if (node instanceof PunicaMenuItem) return this.items.includes(node) ? node : void 0;
|
|
258
|
+
}
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
#onTriggerClick(event) {
|
|
262
|
+
const trigger = this.#trigger;
|
|
263
|
+
if (!trigger || trigger.hasAttribute("disabled")) return;
|
|
264
|
+
if (this.open) this.hide();
|
|
265
|
+
else this.show({ focus: event.detail === 0 ? "first" : "panel" });
|
|
266
|
+
}
|
|
267
|
+
#onTriggerKeydown(event) {
|
|
268
|
+
const trigger = this.#trigger;
|
|
269
|
+
if (!trigger || trigger.hasAttribute("disabled")) return;
|
|
270
|
+
if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
|
|
271
|
+
event.preventDefault();
|
|
272
|
+
this.show({ focus: event.key === "ArrowUp" ? "last" : "first" });
|
|
273
|
+
}
|
|
274
|
+
#onKeydown(event) {
|
|
275
|
+
const item = this.#itemOf(event);
|
|
276
|
+
if (item === void 0) return;
|
|
277
|
+
if (event.key === "Escape") {
|
|
278
|
+
event.preventDefault();
|
|
279
|
+
this.hide("escape");
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (event.key === "Tab") {
|
|
283
|
+
this.#root().hide("tab");
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (!item && event.composedPath()[0] !== this.#panel) return;
|
|
287
|
+
const rtl = isRtl(this.#panel);
|
|
288
|
+
const forward = rtl ? "ArrowLeft" : "ArrowRight";
|
|
289
|
+
const back = rtl ? "ArrowRight" : "ArrowLeft";
|
|
290
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
291
|
+
if (!item) return;
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
this.#activate(item, true);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (event.key === forward) {
|
|
297
|
+
if (!item?.submenu) return;
|
|
298
|
+
event.preventDefault();
|
|
299
|
+
this.#openSubmenu(item, true);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (event.key === back) {
|
|
303
|
+
if (!this.#isSubmenu) return;
|
|
304
|
+
event.preventDefault();
|
|
305
|
+
this.hide("escape");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const items = this.#enabled();
|
|
309
|
+
const current = item ? items.indexOf(item) : -1;
|
|
310
|
+
let next = nextIndex(event, items.length, current, { orientation: "vertical" });
|
|
311
|
+
if (next < 0) next = this.#typeahead(event, items, current);
|
|
312
|
+
if (next < 0) return;
|
|
313
|
+
event.preventDefault();
|
|
314
|
+
this.#closeSubmenus(items[next]);
|
|
315
|
+
items[next].focus({ preventScroll: false });
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Type-to-select. `createTypeahead` in core/a11y.js stops matching on a
|
|
319
|
+
* repeated letter (its buffer becomes "cc"), so the menu keeps its own:
|
|
320
|
+
* a run of one letter cycles through the items starting with it.
|
|
321
|
+
* @param {KeyboardEvent} event
|
|
322
|
+
* @param {PunicaMenuItem[]} items
|
|
323
|
+
* @param {number} current
|
|
324
|
+
*/
|
|
325
|
+
#typeahead(event, items, current) {
|
|
326
|
+
if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey) return -1;
|
|
327
|
+
clearTimeout(this.#typedTimer);
|
|
328
|
+
this.#typedTimer = setTimeout(() => this.#typed = "", 500);
|
|
329
|
+
this.#typed += event.key.toLowerCase();
|
|
330
|
+
const cycling = [...this.#typed].every((c) => c === this.#typed[0]);
|
|
331
|
+
const query = cycling ? this.#typed[0] : this.#typed;
|
|
332
|
+
const start = cycling ? current + 1 : Math.max(current, 0);
|
|
333
|
+
for (let i = 0; i < items.length; i++) {
|
|
334
|
+
const index = (start + i) % items.length;
|
|
335
|
+
if (items[index].labelText.toLowerCase().startsWith(query)) return index;
|
|
336
|
+
}
|
|
337
|
+
return -1;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* @param {PunicaMenuItem} item
|
|
341
|
+
* @param {boolean} keyboard
|
|
342
|
+
*/
|
|
343
|
+
#activate(item, keyboard) {
|
|
344
|
+
if (item.disabled) return;
|
|
345
|
+
if (item.submenu) {
|
|
346
|
+
this.#openSubmenu(item, keyboard);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
item.activate();
|
|
350
|
+
const value = item.value ?? item.labelText;
|
|
351
|
+
const event = this.emit("select", { value, item }, { cancelable: true });
|
|
352
|
+
if (!event.defaultPrevented) this.#root().hide("select");
|
|
353
|
+
}
|
|
354
|
+
/** @param {PunicaMenuItem} item */
|
|
355
|
+
#hover(item) {
|
|
356
|
+
if (deepActiveElement() !== item) item.focus({ preventScroll: true });
|
|
357
|
+
clearTimeout(this.#hoverTimer);
|
|
358
|
+
this.#hoverTimer = setTimeout(() => {
|
|
359
|
+
if (!this.#shown) return;
|
|
360
|
+
this.#closeSubmenus(item);
|
|
361
|
+
this.#openSubmenu(item, false);
|
|
362
|
+
}, 150);
|
|
363
|
+
}
|
|
364
|
+
/** @param {PunicaMenuItem} [except] */
|
|
365
|
+
#closeSubmenus(except) {
|
|
366
|
+
for (const item of this.items) {
|
|
367
|
+
if (item !== except && item.submenu?.open) item.submenu.hide();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* @param {PunicaMenuItem} item
|
|
372
|
+
* @param {boolean} focus move focus to the submenu's first item
|
|
373
|
+
*/
|
|
374
|
+
#openSubmenu(item, focus) {
|
|
375
|
+
const sub = item.submenu;
|
|
376
|
+
if (!(sub instanceof _PunicaMenu)) return;
|
|
377
|
+
clearTimeout(this.#hoverTimer);
|
|
378
|
+
this.#closeSubmenus(item);
|
|
379
|
+
sub.#parent = this;
|
|
380
|
+
sub.#parentItem = item;
|
|
381
|
+
if (sub.open && sub.#shown) {
|
|
382
|
+
if (focus) sub.show({ focus: "first" });
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
sub.show({ focus: focus ? "first" : "none" });
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
define("punica-menu", PunicaMenu);
|
|
389
|
+
|
|
390
|
+
export {
|
|
391
|
+
PunicaMenu
|
|
392
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PunicaElement,
|
|
3
|
+
define
|
|
4
|
+
} from "./chunk-Y7B65FYJ.js";
|
|
5
|
+
|
|
6
|
+
// src/components/hidden/hidden.css
|
|
7
|
+
var hidden_default = ":host {\n display: contents;\n}\n\n:host([above='xs']) {\n display: none;\n}\n\n@media (min-width: 600px) {\n :host([above='sm']) {\n display: none;\n }\n}\n@media (min-width: 900px) {\n :host([above='md']) {\n display: none;\n }\n}\n@media (min-width: 1200px) {\n :host([above='lg']) {\n display: none;\n }\n}\n@media (min-width: 1536px) {\n :host([above='xl']),\n :host([only='xl']) {\n display: none;\n }\n}\n\n@media (max-width: 599.98px) {\n :host([below='sm']),\n :host([only='xs']) {\n display: none;\n }\n}\n@media (max-width: 899.98px) {\n :host([below='md']) {\n display: none;\n }\n}\n@media (max-width: 1199.98px) {\n :host([below='lg']) {\n display: none;\n }\n}\n@media (max-width: 1535.98px) {\n :host([below='xl']) {\n display: none;\n }\n}\n\n@media (min-width: 600px) and (max-width: 899.98px) {\n :host([only='sm']) {\n display: none;\n }\n}\n@media (min-width: 900px) and (max-width: 1199.98px) {\n :host([only='md']) {\n display: none;\n }\n}\n@media (min-width: 1200px) and (max-width: 1535.98px) {\n :host([only='lg']) {\n display: none;\n }\n}\n";
|
|
8
|
+
|
|
9
|
+
// src/components/hidden/hidden.js
|
|
10
|
+
var PunicaHidden = class extends PunicaElement {
|
|
11
|
+
static properties = {
|
|
12
|
+
above: {},
|
|
13
|
+
below: {},
|
|
14
|
+
only: {}
|
|
15
|
+
};
|
|
16
|
+
static styles = hidden_default;
|
|
17
|
+
static template = `<slot></slot>`;
|
|
18
|
+
};
|
|
19
|
+
define("punica-hidden", PunicaHidden);
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
PunicaHidden
|
|
23
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormControl
|
|
3
|
+
} from "./chunk-HW2CN2JV.js";
|
|
4
|
+
import {
|
|
5
|
+
icons
|
|
6
|
+
} from "./chunk-YSGWORUD.js";
|
|
7
|
+
import {
|
|
8
|
+
PunicaElement,
|
|
9
|
+
define
|
|
10
|
+
} from "./chunk-Y7B65FYJ.js";
|
|
11
|
+
|
|
12
|
+
// src/components/checkbox/checkbox.css
|
|
13
|
+
var checkbox_default = ":host {\n --_accent: var(--punica-color-primary);\n --punica-checkbox-size: var(--punica-space-18);\n --punica-checkbox-radius: var(--punica-radius-sm);\n --punica-checkbox-border-color: var(--punica-color-border-strong);\n --punica-checkbox-color: var(--_accent);\n --punica-checkbox-gap: var(--punica-space-8);\n\n display: inline-flex;\n vertical-align: middle;\n}\n\n:host([color='secondary']) {\n --_accent: var(--punica-color-secondary);\n}\n:host([color='error']) {\n --_accent: var(--punica-color-error);\n}\n:host([color='warning']) {\n --_accent: var(--punica-color-warning);\n}\n:host([color='info']) {\n --_accent: var(--punica-color-info);\n}\n:host([color='success']) {\n --_accent: var(--punica-color-success);\n}\n:host([color='neutral']) {\n --_accent: var(--punica-color-neutral-dark);\n}\n\n.base {\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: var(--punica-checkbox-gap);\n inline-size: 100%;\n color: var(--punica-color-text);\n font-family: var(--punica-font-family);\n font-size: var(--punica-font-size-sm);\n line-height: 1.43;\n cursor: pointer;\n user-select: none;\n}\n\ninput {\n position: absolute;\n inset-inline-start: 0;\n inline-size: var(--punica-checkbox-size);\n block-size: var(--punica-checkbox-size);\n margin: 0;\n opacity: 0;\n cursor: inherit;\n}\n\n.control {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n inline-size: var(--punica-checkbox-size);\n block-size: var(--punica-checkbox-size);\n border: var(--punica-border-width) solid var(--punica-checkbox-border-color);\n border-radius: var(--punica-checkbox-radius);\n background: var(--punica-color-surface);\n color: var(--punica-color-on-accent);\n font-size: var(--punica-font-size-sm);\n transition: background-color var(--punica-duration-fast) var(--punica-ease),\n border-color var(--punica-duration-fast) var(--punica-ease);\n}\n\n.control .icon {\n display: none;\n stroke-width: 3;\n}\n\ninput:checked + .control,\ninput:indeterminate + .control {\n background: var(--punica-checkbox-color);\n border-color: var(--punica-checkbox-color);\n}\ninput:checked:not(:indeterminate) + .control .icon:first-child,\ninput:indeterminate + .control .icon:last-child {\n display: block;\n}\n\ninput:focus-visible + .control {\n outline: var(--punica-focus-ring);\n outline-offset: var(--punica-focus-ring-offset);\n}\n\n.label[hidden] {\n display: none;\n}\n\n:host([disabled]) .base,\n:host(:state(disabled)) .base {\n cursor: default;\n opacity: var(--punica-disabled-opacity);\n}\n\n@media (forced-colors: active) {\n .control {\n border-color: FieldText;\n color: HighlightText;\n }\n input:checked + .control,\n input:indeterminate + .control {\n background: Highlight;\n border-color: Highlight;\n }\n :host([disabled]) .base,\n :host(:state(disabled)) .base {\n opacity: 1;\n color: GrayText;\n }\n}\n";
|
|
14
|
+
|
|
15
|
+
// src/components/checkbox/checkbox.js
|
|
16
|
+
var flagsOf = (validity) => {
|
|
17
|
+
const flags = {};
|
|
18
|
+
for (const key in validity) if (key !== "valid" && validity[key]) flags[key] = true;
|
|
19
|
+
return flags;
|
|
20
|
+
};
|
|
21
|
+
var PunicaCheckbox = class extends FormControl(PunicaElement) {
|
|
22
|
+
static properties = {
|
|
23
|
+
checked: { type: Boolean },
|
|
24
|
+
indeterminate: { type: Boolean },
|
|
25
|
+
value: { default: "on" },
|
|
26
|
+
label: {},
|
|
27
|
+
color: {}
|
|
28
|
+
};
|
|
29
|
+
static styles = checkbox_default;
|
|
30
|
+
static shadowOptions = { delegatesFocus: true };
|
|
31
|
+
static template = `
|
|
32
|
+
<label part="base" class="base">
|
|
33
|
+
<input part="input" type="checkbox" />
|
|
34
|
+
<span part="control" class="control">${icons.check}${icons.minus}</span>
|
|
35
|
+
<span part="label" class="label" hidden><slot></slot></span>
|
|
36
|
+
</label>
|
|
37
|
+
`;
|
|
38
|
+
#input = this.$("input");
|
|
39
|
+
#default = { checked: false, indeterminate: false };
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
const input = this.#input;
|
|
43
|
+
input.addEventListener("change", () => {
|
|
44
|
+
this.checked = input.checked;
|
|
45
|
+
this.indeterminate = false;
|
|
46
|
+
this.emit("change", { checked: this.checked, value: this.value });
|
|
47
|
+
});
|
|
48
|
+
const slot = this.$("slot");
|
|
49
|
+
slot.addEventListener("slotchange", () => {
|
|
50
|
+
const filled = slot.assignedNodes().some((n) => n.nodeType === 1 || n.textContent.trim());
|
|
51
|
+
this.$(".label").hidden = !filled;
|
|
52
|
+
});
|
|
53
|
+
this.addEventListener("click", (event) => {
|
|
54
|
+
if (event.composedPath()[0] === this && !this.isDisabled) input.click();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
update() {
|
|
58
|
+
const input = this.#input;
|
|
59
|
+
input.checked = this.checked;
|
|
60
|
+
input.indeterminate = this.indeterminate;
|
|
61
|
+
input.required = this.required;
|
|
62
|
+
input.disabled = this.isDisabled;
|
|
63
|
+
const name = this.#name();
|
|
64
|
+
if (name) input.setAttribute("aria-label", name);
|
|
65
|
+
else input.removeAttribute("aria-label");
|
|
66
|
+
this.toggleState("checked", this.checked);
|
|
67
|
+
this.toggleState("indeterminate", this.indeterminate);
|
|
68
|
+
this.setFormValue(this.checked ? this.value ?? "on" : null, String(this.checked));
|
|
69
|
+
this.setValidity(flagsOf(input.validity), input.validationMessage, input);
|
|
70
|
+
}
|
|
71
|
+
firstUpdated() {
|
|
72
|
+
this.#default = { checked: this.checked, indeterminate: this.indeterminate };
|
|
73
|
+
}
|
|
74
|
+
formReset() {
|
|
75
|
+
this.checked = this.#default.checked;
|
|
76
|
+
this.indeterminate = this.#default.indeterminate;
|
|
77
|
+
}
|
|
78
|
+
formRestore(state) {
|
|
79
|
+
this.checked = state === "true";
|
|
80
|
+
}
|
|
81
|
+
#name() {
|
|
82
|
+
if (this.label) return this.label;
|
|
83
|
+
const text = [...this.labels].map((l) => l.textContent.trim()).filter(Boolean);
|
|
84
|
+
return text.length ? text.join(" ") : null;
|
|
85
|
+
}
|
|
86
|
+
/** Moves focus to the checkbox. */
|
|
87
|
+
focus(options) {
|
|
88
|
+
this.#input.focus(options);
|
|
89
|
+
}
|
|
90
|
+
/** Toggles the checkbox the way a user would, firing `punica-change`. */
|
|
91
|
+
click() {
|
|
92
|
+
this.#input.click();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
define("punica-checkbox", PunicaCheckbox);
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
PunicaCheckbox
|
|
99
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormControl
|
|
3
|
+
} from "./chunk-HW2CN2JV.js";
|
|
4
|
+
import {
|
|
5
|
+
PunicaElement,
|
|
6
|
+
define
|
|
7
|
+
} from "./chunk-Y7B65FYJ.js";
|
|
8
|
+
|
|
9
|
+
// src/components/checkboxGroup/checkboxGroup.css
|
|
10
|
+
var checkboxGroup_default = ":host {\n --punica-checkbox-group-gap: var(--punica-space-8);\n --punica-checkbox-group-label-color: var(--punica-color-text);\n\n display: inline-flex;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--punica-space-8);\n vertical-align: middle;\n font-family: var(--punica-font-family);\n font-size: var(--punica-font-size-sm);\n line-height: 1.43;\n}\n\n.label {\n color: var(--punica-checkbox-group-label-color);\n font-weight: var(--punica-font-weight-semi-bold);\n}\n\n.items {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--punica-checkbox-group-gap);\n}\n\n:host([orientation='horizontal']) .items {\n flex-flow: row wrap;\n align-items: center;\n column-gap: var(--punica-space-16);\n}\n\n[hidden] {\n display: none !important;\n}\n\n:host(:state(disabled)) .label {\n opacity: var(--punica-disabled-opacity);\n}\n\n@media (forced-colors: active) {\n :host(:state(disabled)) .label {\n color: GrayText;\n opacity: 1;\n }\n}\n";
|
|
11
|
+
|
|
12
|
+
// src/components/checkboxGroup/checkboxGroup.js
|
|
13
|
+
var missingMessage = () => {
|
|
14
|
+
const probe = document.createElement("input");
|
|
15
|
+
probe.type = "radio";
|
|
16
|
+
probe.name = "punica-probe";
|
|
17
|
+
probe.required = true;
|
|
18
|
+
return probe.validationMessage || " ";
|
|
19
|
+
};
|
|
20
|
+
var valueOf = (box) => box.value ?? box.getAttribute("value") ?? "on";
|
|
21
|
+
var PunicaCheckboxGroup = class extends FormControl(PunicaElement) {
|
|
22
|
+
static properties = {
|
|
23
|
+
defaultValue: { attribute: "value", reflect: false },
|
|
24
|
+
value: { type: Array, attribute: false },
|
|
25
|
+
label: {},
|
|
26
|
+
labelHidden: { type: Boolean },
|
|
27
|
+
orientation: { default: "vertical" },
|
|
28
|
+
min: { type: Number },
|
|
29
|
+
max: { type: Number },
|
|
30
|
+
labelTooFew: { default: "Choose at least {min}." },
|
|
31
|
+
labelTooMany: { default: "Choose no more than {max}." }
|
|
32
|
+
};
|
|
33
|
+
static styles = checkboxGroup_default;
|
|
34
|
+
static template = `
|
|
35
|
+
<div part="label" class="label" hidden><slot name="label"><span class="label-text"></span></slot></div>
|
|
36
|
+
<div part="items" class="items"><slot></slot></div>
|
|
37
|
+
`;
|
|
38
|
+
#slot = this.$("slot:not([name])");
|
|
39
|
+
#labelSlot = this.$('slot[name="label"]');
|
|
40
|
+
/** Boxes the group disabled, to be given back when it is enabled. */
|
|
41
|
+
#disabledByGroup = /* @__PURE__ */ new WeakSet();
|
|
42
|
+
/** Boxes ticked in the markup when first seen. */
|
|
43
|
+
#defaults = /* @__PURE__ */ new WeakSet();
|
|
44
|
+
#seen = /* @__PURE__ */ new WeakSet();
|
|
45
|
+
#initialised = false;
|
|
46
|
+
constructor() {
|
|
47
|
+
super();
|
|
48
|
+
this.#slot.addEventListener("slotchange", () => this.#sync());
|
|
49
|
+
this.#labelSlot.addEventListener("slotchange", () => this.requestUpdate());
|
|
50
|
+
this.addEventListener("punica-change", (event) => {
|
|
51
|
+
const box = (
|
|
52
|
+
/** @type {any} */
|
|
53
|
+
event.target
|
|
54
|
+
);
|
|
55
|
+
if (box === this || !this.items.includes(box)) return;
|
|
56
|
+
event.stopImmediatePropagation();
|
|
57
|
+
this.value = this.items.filter((item) => item.checked).map(valueOf);
|
|
58
|
+
this.update(/* @__PURE__ */ new Map());
|
|
59
|
+
this.emit("change", { value: this.value });
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/** @returns {any[]} */
|
|
63
|
+
get items() {
|
|
64
|
+
return this.#slot.assignedElements({ flatten: true }).filter((el) => el.localName === "punica-checkbox");
|
|
65
|
+
}
|
|
66
|
+
connected() {
|
|
67
|
+
queueMicrotask(() => this.isConnected && this.#sync());
|
|
68
|
+
}
|
|
69
|
+
/** @returns {string[]} */
|
|
70
|
+
#values() {
|
|
71
|
+
return Array.isArray(this.value) ? this.value.map(String) : [];
|
|
72
|
+
}
|
|
73
|
+
#defaultValue() {
|
|
74
|
+
if (this.defaultValue != null) return this.defaultValue.split(/\s+/).filter(Boolean);
|
|
75
|
+
return this.items.filter((box) => this.#defaults.has(box)).map(valueOf);
|
|
76
|
+
}
|
|
77
|
+
#sync() {
|
|
78
|
+
let fresh = false;
|
|
79
|
+
for (const box of this.items) {
|
|
80
|
+
if (this.#seen.has(box)) continue;
|
|
81
|
+
this.#seen.add(box);
|
|
82
|
+
fresh = true;
|
|
83
|
+
if (box.hasAttribute("checked")) this.#defaults.add(box);
|
|
84
|
+
}
|
|
85
|
+
if (!this.#initialised || fresh && this.value == null) {
|
|
86
|
+
this.#initialised = true;
|
|
87
|
+
if (this.value == null) this.value = this.#defaultValue();
|
|
88
|
+
}
|
|
89
|
+
if (this.isConnected) this.update(/* @__PURE__ */ new Map());
|
|
90
|
+
}
|
|
91
|
+
update(changed) {
|
|
92
|
+
if (changed.has("defaultValue") && this.#initialised && changed.get("defaultValue") !== void 0) {
|
|
93
|
+
this.value = this.#defaultValue();
|
|
94
|
+
}
|
|
95
|
+
const internals = this.internals;
|
|
96
|
+
const disabled = this.isDisabled;
|
|
97
|
+
internals.role = "group";
|
|
98
|
+
internals.ariaLabel = this.label || null;
|
|
99
|
+
internals.ariaRequired = this.required ? "true" : null;
|
|
100
|
+
internals.ariaDisabled = disabled ? "true" : null;
|
|
101
|
+
this.toggleState("disabled", disabled);
|
|
102
|
+
const labelled = this.#labelSlot.assignedElements();
|
|
103
|
+
if ("ariaLabelledByElements" in internals) {
|
|
104
|
+
internals.ariaLabelledByElements = labelled.length && !this.label ? labelled : null;
|
|
105
|
+
}
|
|
106
|
+
this.$(".label-text").textContent = this.label ?? "";
|
|
107
|
+
const inField = this.parentElement?.localName === "punica-field";
|
|
108
|
+
this.$(".label").hidden = this.labelHidden || inField || !this.label && !labelled.length;
|
|
109
|
+
const items = this.items;
|
|
110
|
+
const values = this.#values();
|
|
111
|
+
for (const box of items) {
|
|
112
|
+
if (this.#initialised) box.checked = values.includes(valueOf(box));
|
|
113
|
+
if (disabled && !box.disabled) {
|
|
114
|
+
box.disabled = true;
|
|
115
|
+
this.#disabledByGroup.add(box);
|
|
116
|
+
} else if (!disabled && this.#disabledByGroup.has(box)) {
|
|
117
|
+
this.#disabledByGroup.delete(box);
|
|
118
|
+
box.disabled = false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (this.name && values.length) {
|
|
122
|
+
const data = new FormData();
|
|
123
|
+
for (const value of values) data.append(this.name, value);
|
|
124
|
+
this.setFormValue(data);
|
|
125
|
+
} else {
|
|
126
|
+
this.setFormValue(null);
|
|
127
|
+
}
|
|
128
|
+
const count = values.length;
|
|
129
|
+
const first = items.find((box) => !box.disabled);
|
|
130
|
+
const anchor = first?.shadowRoot?.querySelector("input") || first || void 0;
|
|
131
|
+
const format = (n) => new Intl.NumberFormat(this.closest("[lang]")?.lang || navigator.language).format(n);
|
|
132
|
+
if (this.required && count === 0) {
|
|
133
|
+
this.setValidity({ valueMissing: true }, missingMessage(), anchor);
|
|
134
|
+
} else if (this.min != null && count > 0 && count < this.min) {
|
|
135
|
+
this.setValidity({ rangeUnderflow: true }, this.labelTooFew.replace("{min}", format(this.min)), anchor);
|
|
136
|
+
} else if (this.max != null && count > this.max) {
|
|
137
|
+
this.setValidity({ rangeOverflow: true }, this.labelTooMany.replace("{max}", format(this.max)), anchor);
|
|
138
|
+
} else {
|
|
139
|
+
this.setValidity({});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
formReset() {
|
|
143
|
+
this.value = this.#defaultValue();
|
|
144
|
+
}
|
|
145
|
+
formRestore(state) {
|
|
146
|
+
if (state instanceof FormData) this.value = state.getAll(this.name).map(String);
|
|
147
|
+
}
|
|
148
|
+
/** Moves focus to the first box that can take it. */
|
|
149
|
+
focus(options) {
|
|
150
|
+
this.items.find((box) => !box.disabled)?.focus(options);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
define("punica-checkbox-group", PunicaCheckboxGroup);
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
PunicaCheckboxGroup
|
|
157
|
+
};
|